Loading services/core/java/com/android/server/DeviceIdleController.java +20 −3 Original line number Diff line number Diff line Loading @@ -244,6 +244,14 @@ public class DeviceIdleController extends SystemService if (Intent.ACTION_BATTERY_CHANGED.equals(intent.getAction())) { int plugged = intent.getIntExtra("plugged", 0); updateChargingLocked(plugged != 0); } else if (Intent.ACTION_PACKAGE_REMOVED.equals(intent.getAction())) { if (!intent.getBooleanExtra(Intent.EXTRA_REPLACING, false)) { Uri data = intent.getData(); String ssp; if (data != null && (ssp=data.getSchemeSpecificPart()) != null) { removePowerSaveWhitelistAppInternal(ssp); } } } else if (ACTION_STEP_IDLE_STATE.equals(intent.getAction())) { synchronized (DeviceIdleController.this) { stepIdleStateLocked(); Loading Loading @@ -979,6 +987,10 @@ public class DeviceIdleController extends SystemService filter.addAction(Intent.ACTION_BATTERY_CHANGED); filter.addAction(ACTION_STEP_IDLE_STATE); getContext().registerReceiver(mReceiver, filter); filter = new IntentFilter(); filter.addAction(Intent.ACTION_PACKAGE_REMOVED); filter.addDataScheme("package"); getContext().registerReceiver(mReceiver, filter); mLocalPowerManager.setDeviceIdleWhitelist(mPowerSaveWhitelistAllAppIdArray); Loading @@ -991,7 +1003,10 @@ public class DeviceIdleController extends SystemService public boolean addPowerSaveWhitelistAppInternal(String name) { synchronized (this) { try { ApplicationInfo ai = getContext().getPackageManager().getApplicationInfo(name, 0); ApplicationInfo ai = getContext().getPackageManager().getApplicationInfo(name, PackageManager.GET_UNINSTALLED_PACKAGES | PackageManager.GET_DISABLED_COMPONENTS | PackageManager.GET_DISABLED_UNTIL_USED_COMPONENTS); if (mPowerSaveWhitelistUserApps.put(name, UserHandle.getAppId(ai.uid)) == null) { reportPowerSaveWhitelistChangedLocked(); updateWhitelistAppIdsLocked(); Loading Loading @@ -1595,7 +1610,6 @@ public class DeviceIdleController extends SystemService } catch (IOException e) { } } } private void readConfigFileLocked(XmlPullParser parser) { Loading Loading @@ -1624,7 +1638,10 @@ public class DeviceIdleController extends SystemService String name = parser.getAttributeValue(null, "n"); if (name != null) { try { ApplicationInfo ai = pm.getApplicationInfo(name, 0); ApplicationInfo ai = pm.getApplicationInfo(name, PackageManager.GET_UNINSTALLED_PACKAGES | PackageManager.GET_DISABLED_COMPONENTS | PackageManager.GET_DISABLED_UNTIL_USED_COMPONENTS); mPowerSaveWhitelistUserApps.put(ai.packageName, UserHandle.getAppId(ai.uid)); } catch (PackageManager.NameNotFoundException e) { Loading Loading
services/core/java/com/android/server/DeviceIdleController.java +20 −3 Original line number Diff line number Diff line Loading @@ -244,6 +244,14 @@ public class DeviceIdleController extends SystemService if (Intent.ACTION_BATTERY_CHANGED.equals(intent.getAction())) { int plugged = intent.getIntExtra("plugged", 0); updateChargingLocked(plugged != 0); } else if (Intent.ACTION_PACKAGE_REMOVED.equals(intent.getAction())) { if (!intent.getBooleanExtra(Intent.EXTRA_REPLACING, false)) { Uri data = intent.getData(); String ssp; if (data != null && (ssp=data.getSchemeSpecificPart()) != null) { removePowerSaveWhitelistAppInternal(ssp); } } } else if (ACTION_STEP_IDLE_STATE.equals(intent.getAction())) { synchronized (DeviceIdleController.this) { stepIdleStateLocked(); Loading Loading @@ -979,6 +987,10 @@ public class DeviceIdleController extends SystemService filter.addAction(Intent.ACTION_BATTERY_CHANGED); filter.addAction(ACTION_STEP_IDLE_STATE); getContext().registerReceiver(mReceiver, filter); filter = new IntentFilter(); filter.addAction(Intent.ACTION_PACKAGE_REMOVED); filter.addDataScheme("package"); getContext().registerReceiver(mReceiver, filter); mLocalPowerManager.setDeviceIdleWhitelist(mPowerSaveWhitelistAllAppIdArray); Loading @@ -991,7 +1003,10 @@ public class DeviceIdleController extends SystemService public boolean addPowerSaveWhitelistAppInternal(String name) { synchronized (this) { try { ApplicationInfo ai = getContext().getPackageManager().getApplicationInfo(name, 0); ApplicationInfo ai = getContext().getPackageManager().getApplicationInfo(name, PackageManager.GET_UNINSTALLED_PACKAGES | PackageManager.GET_DISABLED_COMPONENTS | PackageManager.GET_DISABLED_UNTIL_USED_COMPONENTS); if (mPowerSaveWhitelistUserApps.put(name, UserHandle.getAppId(ai.uid)) == null) { reportPowerSaveWhitelistChangedLocked(); updateWhitelistAppIdsLocked(); Loading Loading @@ -1595,7 +1610,6 @@ public class DeviceIdleController extends SystemService } catch (IOException e) { } } } private void readConfigFileLocked(XmlPullParser parser) { Loading Loading @@ -1624,7 +1638,10 @@ public class DeviceIdleController extends SystemService String name = parser.getAttributeValue(null, "n"); if (name != null) { try { ApplicationInfo ai = pm.getApplicationInfo(name, 0); ApplicationInfo ai = pm.getApplicationInfo(name, PackageManager.GET_UNINSTALLED_PACKAGES | PackageManager.GET_DISABLED_COMPONENTS | PackageManager.GET_DISABLED_UNTIL_USED_COMPONENTS); mPowerSaveWhitelistUserApps.put(ai.packageName, UserHandle.getAppId(ai.uid)); } catch (PackageManager.NameNotFoundException e) { Loading