From fa413078fa5d5b69c1c8dbb4453c1fba46297749 Mon Sep 17 00:00:00 2001 From: synchromach <154671247+synchromach@users.noreply.github.com> Date: Sat, 13 Jan 2024 12:27:59 +0700 Subject: [PATCH 1/5] Remove dev tips from user.md --- _vendors-content/sony/user.md | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/_vendors-content/sony/user.md b/_vendors-content/sony/user.md index 1793f113..17234c34 100644 --- a/_vendors-content/sony/user.md +++ b/_vendors-content/sony/user.md @@ -54,17 +54,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) - From edb15192e5d97b8b4de5763f4ef8161262256a33 Mon Sep 17 00:00:00 2001 From: synchromach <154671247+synchromach@users.noreply.github.com> Date: Sat, 13 Jan 2024 12:29:20 +0700 Subject: [PATCH 2/5] Update Sony dev.md --- _vendors-content/sony/dev.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/_vendors-content/sony/dev.md b/_vendors-content/sony/dev.md index 816deca3..a68fa391 100644 --- a/_vendors-content/sony/dev.md +++ b/_vendors-content/sony/dev.md @@ -4,3 +4,13 @@ manufacturer: --- +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: + + +```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) From 3555221730826a91d0fcce163584378927c09ece Mon Sep 17 00:00:00 2001 From: synchromach <154671247+synchromach@users.noreply.github.com> Date: Sat, 13 Jan 2024 12:37:11 +0700 Subject: [PATCH 3/5] Update explanation.md --- _vendors-content/sony/explanation.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/_vendors-content/sony/explanation.md b/_vendors-content/sony/explanation.md index a9da93b4..7eb9a0fe 100644 --- a/_vendors-content/sony/explanation.md +++ b/_vendors-content/sony/explanation.md @@ -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. From bd1241a70161919ec7db9ee0f984125a8f6bb07a Mon Sep 17 00:00:00 2001 From: synchromach <154671247+synchromach@users.noreply.github.com> Date: Sat, 13 Jan 2024 12:40:12 +0700 Subject: [PATCH 4/5] Update user.md --- _vendors-content/sony/user.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/_vendors-content/sony/user.md b/_vendors-content/sony/user.md index 17234c34..9d5e7620 100644 --- a/_vendors-content/sony/user.md +++ b/_vendors-content/sony/user.md @@ -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.
From 40fb6f54db4ee43fe1b97cd98720919c5a15bbb8 Mon Sep 17 00:00:00 2001 From: synchromach <154671247+synchromach@users.noreply.github.com> Date: Sat, 13 Jan 2024 12:45:05 +0700 Subject: [PATCH 5/5] Update dev.md --- _vendors-content/sony/dev.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/_vendors-content/sony/dev.md b/_vendors-content/sony/dev.md index a68fa391..0b80a30b 100644 --- a/_vendors-content/sony/dev.md +++ b/_vendors-content/sony/dev.md @@ -4,8 +4,9 @@ manufacturer: --- -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: +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) {