Skip to content

Commit

Permalink
Merge pull request #801 from synchromach/patch-1
Browse files Browse the repository at this point in the history
Update the insanely outdated Sony documents
  • Loading branch information
rl885 authored Jan 15, 2024
2 parents 89f01c2 + 40fb6f5 commit 18796d4
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 19 deletions.
11 changes: 11 additions & 0 deletions _vendors-content/sony/dev.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,14 @@ manufacturer:

---

For newer Android versions, check for Battery Saver mode, which for Sony devices is rebranded as STAMINA mode. There is no way to detect if "Prefer battery time" is set, but if your app's notifications don't show up or SurfaceFlinger is at a lower framerate than usual, it's probably on. Alarms are not killed either way, but users can (and some will) deprive your app of the permission to set these alarms in the first place.

For older Android versions, there is no workaround to prevent background process optimizations in STAMINA mode, but apps can detect whether it's enabled with the following code:

```java
if (Build.MANUFACTURER.equals("sony") && android.provider.Settings.Secure.getInt(context.getContentResolver(), "somc.stamina_mode", 0) > 0) {
// show warning
}
```

The problem is this will only tell if Stamina is enabled, but not if it is currently applied, but we can assume it is when not charged and battery is under X%. (TBS)
5 changes: 2 additions & 3 deletions _vendors-content/sony/explanation.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ manufacturer:

---

Sony gets a high bar in our listing of toxic Android vendors, as historically Sony introduced the first very effective non-standard background process optimization and opened Pandora's box.
For recent Android versions on Sony devices, AOSP's Battery saver mode is rebranded as **STAMINA mode**. If left on default settings, it behaves close to AOSP, but there is an additional opt-in setting under STAMINA mode called **Prefer battery time** which will have more aggressive limitations on background activity.


It is called **Stamina mode**, and it instantly breaks all background processes and all alarms if enabled.
For older devices, Sony gets a high bar in our listing of toxic Android vendors, as historically Sony introduced the first very effective non-standard background process optimization and opened Pandora's box. STAMINA mode on their older devices instantly breaks all background processes and all alarms if enabled.
21 changes: 5 additions & 16 deletions _vendors-content/sony/user.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,13 @@ manufacturer:

---

## STAMINA mode

## Stamina mode
### "Prefer battery time"

Never use Stamina mode if you want your device to do something useful when not actively using it. Despite the official description, it does not affect only mobile data and WiFi, it also terminuates any background processes.
Newer Android versions on Sony devices have an extra "STAMINA level" setting under STAMINA mode. Avoid setting it to "Prefer battery time" if you need AOSP behaviour.

For older Android versions, never use STAMINA mode if you want your device to do something useful when not actively using it. Despite the official description, it does not affect only mobile data and WiFi, it also terminuates any background processes.
Stamine mode can be found (and disabled) at either *Battery* section or *Power management* section.

<div class="img-block">
Expand Down Expand Up @@ -54,17 +57,3 @@ _System settings ​→ Apps & Notifications ​→ Advanced ​→ Special app
## Battery optimisation

Try to make your app not battery optimized in *Phone settings > Battery > Three dots in the top right corner > Battery optimisation > Apps > your app*."

developer_solution: "
There is no workaround to prevent background process optimizations in *Stamina mode*, but at least apps can detect that Stamina mode is enabled with the following command:


```
if (Build.MANUFACTURER.equals("sony") && android.provider.Settings.Secure.getInt(context.getContentResolver(), "somc.stamina_mode", 0) > 0) {
// show warning
}
```


The problem is this will only tell if Stamina is enabled, but not if it is currently applied, but we can assume it is when not charged and battery is under X% (TBS)

0 comments on commit 18796d4

Please sign in to comment.