dirkam / backgroundable-android

Collection of stock apps and mechanisms, which might affect background tasks and scheduled alarms.
MIT License
294 stars 33 forks source link

Intents for a few devices #5

Open akwizgran opened 6 years ago

akwizgran commented 6 years ago

Thanks for maintaining this very useful resource. I'd like to contribute some notes about intents for opening power management apps on a few devices:

Huawei Ascend Y330 (Android 4.2.2, EmotionUI 2.0):

am start com.huawei.systemmanager/.power.HwPowerManagerActivity opens power saving section of system settings/battery section of Phone Manager. From there, "Protected apps" opens list of protected apps and "Bkgd power-intensive apps" opens list of power-intensive apps.

am start com.huawei.systemmanager/.optimize.process.ProtectActivity opens list of protected apps directly.

am start com.huawei.systemmanager/.power.PowerConsumeBackgroundActivity opens list of power-intensive apps directly.

am start com.huawei.systemmanager/.optimize.bootstart.BootStartActivity opens list of apps that can run at system boot.

am start com.huawei.systemmanager/.optimize.ProcessManageActivity opens list of apps currently running in the background. Apps can be selected and killed.

Huawei P8 Lite 2015 (Android 5.0.1, EMUI 3.1):

am start com.huawei.systemmanager/.power.ui.HwPowerManagerActivity opens power saving section of system settings/Phone Manager. From there, "Protected apps" opens list of protected apps and "Power-intensive apps" opens list of power-intensive apps.

am start com.huawei.systemmanager/.optimize.process.ProtectActivity opens list of protected apps directly.

Huawei P8 Lite 2017 (Android 7.0, EMUI 5.0.1):

am start com.huawei.systemmanager/.power.ui.HwPowerManagerActivity opens battery section of system settings/Phone Manager. From there, "Close apps after screen lock" opens lock screen cleanup list, and "Power-intensive apps" opens list of power-intensive apps.

am start com.huawei.systemmanager/.optimize.process.ProtectActivity opens lock screen cleanup list directly. This works the same way as the protected apps list on older versions of EMUI, but it's a blacklist rather than a whitelist.

Samsung Galaxy J3 2016 (Android 5.1.1):

am start com.samsung.android.sm/.ui.battery.BatteryActivity opens battery section of system settings. From there, "App optimisation > Detail" opens list of apps that will be killed after 3 days in the background without being used.

Sony Xperia Z3 Compact (Android 6.0.1):

am start -a android.settings.BATTERY_SAVER_SETTINGS opens battery section of system settings. From there, "Menu > Battery optimisation" opens list of protected apps.

Vivo Y11 (Android 4.4.4, Funtouch OS 2.0):

am start com.iqoo.secure/.MainGuideActivity opens iManager app. From there, "Power manager" opens battery settings and "App manager > Autostart manager" opens list of apps that can auto-start (presumably, run at system boot).

am start com.iqoo.secure/.ui.powersaving.PowerSavingManagerActivity opens battery settings directly.

am start com.iqoo.secure/.ui.phoneoptimize.AddWhiteListActivity opens an app whitelist, which doesn't seem to be reachable through the normal UI. This list protects apps from the iManager app's optimisation button.

dirkam commented 6 years ago

This is great, thank you.

Do you happen to know if these activities can be started from 3rd party apps? Or did you have a chance to test these with adb? In many cases, these activities marked with exported = false, so your intent start will not work.

akwizgran commented 6 years ago

The activities listed above could all be opened by the shell user via adb shell am start. I don't know if that necessarily means they're available to other apps, or whether shell might have special privileges.

I did run into a lot of activities that I couldn't open; for example com.huawei.systemmanager/.power.PowerConsumeBackgroundActivity exists on all three Huawei devices I tested, but can only be opened by the shell user on the device running EmotionUI 2.0.

I guess details like which activities are exported may vary between models, even within a given major/minor OS version, as each model has its own build of the OS. So my results may not be very portable across models.

If you can tell me how to find out which activities are exported, I'd be happy to update my notes for the devices above. Until now I've just used the trial-and-error method of opening the power management UI manually, running dumpsys activity activities to find out which activity I'm looking at, then closing it and trying to relaunch it with am start. There's probably a better way. :-)

dirkam commented 5 years ago

Thanks!

Would it be possible for you to create a pull request based on the README?