Reputation: 83
I'm trying to add my package in doze whitelist.
With ($ adb shell dumpsys deviceidle whitelist +PACKAGE)
, I can add my package in whitelist,
and this command makes change in the file /data/system/deviceidle.xml.
Now, I'm curious about who generate deviceidle.xml.
Is there anyone who knows about deviceidle.xml
?
Upvotes: 2
Views: 6480
Reputation: 429
As far as I know, doze whitelisting is done by system creators. You can ask user for whitelisting via intent action: Settings.ACTION_IGNORE_BATTERY_OPTIMIZATION_SETTINGS.
In the DeviceIdleController soruce code you can see that it reads deviceidle.xml in constructor. It might be that, if you know the file structure and have rooted device you can manually create and edit this file.
@VisibleForTesting DeviceIdleController(Context context, Injector injector) {
super(context);
mInjector = injector;
mConfigFile = new AtomicFile(new File(getSystemDir(), "deviceidle.xml"));
[...]
}
Upvotes: 0
Reputation: 83
I found a clue in framework module,
IDeviceController.addPowerSaveWhitelistApp(String name)
helps to add my package into ;
also, /data/system/deviceidle.xml is updated.
You can check with adb dumpsys
$ adb shell dumpsys deviceidle
$ adb shell cat /data/system/deviceidle.xml
Upvotes: 2