androidandroid-appwidgetandroid-appstandby

Android 6.0 - App Standby and AppWidgets


What is Google's definition of a user "actively using" an app, in the context of app widgets? If an app hasn't been opened for a long period of time but has a widget on the home screen, does anybody know if Android will put that app in standby mode? From the documentation, it seems like app widgets would fit into this description: "The app has a process currently in the foreground (either as an activity or foreground service, or in use by another activity or foreground service)." But I'm not quite sure.

Thoughts?

https://developer.android.com/preview/features/power-mgmt.html


Solution

  • I followed the testing steps at the link you referenced and believe i have verified that if your app has an app widget added anywhere, your app will not be put in stand by mode. When I added my app's app widget to a launcher, and ran these commands back to back:

    $ adb shell am set-inactive <packageName> false
    $ adb shell am get-inactive <packageName>
    

    the system reported:

    Idle=false
    

    This was even the case if the app widget was added to a stopped launcher that wasn't set to be my main launcher in the system settings. When I removed the app widget and ran the same commands the system reported:

    Idle=true
    

    I believe (have not verified) that when an app requests that widget be added, the system is made aware that a widget from your package is added somewhere and thus the system won't put your app in standby mode.