Merge "Check app idle states and inform listeners on power-save-wl change." into rvc-dev am: 9129418140
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/12166806 Change-Id: Ifd81a2027a25e8058a319aea46ca642b023ad90d
This commit is contained in:
@@ -456,7 +456,7 @@ public class AppStandbyController implements AppStandbyInternal {
|
|||||||
mSystemServicesReady = true;
|
mSystemServicesReady = true;
|
||||||
|
|
||||||
// Offload to handler thread to avoid boot time impact.
|
// Offload to handler thread to avoid boot time impact.
|
||||||
mHandler.post(mInjector::updatePowerWhitelistCache);
|
mHandler.post(AppStandbyController.this::updatePowerWhitelistCache);
|
||||||
|
|
||||||
boolean userFileExists;
|
boolean userFileExists;
|
||||||
synchronized (mAppIdleLock) {
|
synchronized (mAppIdleLock) {
|
||||||
@@ -1684,6 +1684,14 @@ public class AppStandbyController implements AppStandbyInternal {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void updatePowerWhitelistCache() {
|
||||||
|
if (mInjector.getBootPhase() < PHASE_SYSTEM_SERVICES_READY) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
mInjector.updatePowerWhitelistCache();
|
||||||
|
postCheckIdleStates(UserHandle.USER_ALL);
|
||||||
|
}
|
||||||
|
|
||||||
private class PackageReceiver extends BroadcastReceiver {
|
private class PackageReceiver extends BroadcastReceiver {
|
||||||
@Override
|
@Override
|
||||||
public void onReceive(Context context, Intent intent) {
|
public void onReceive(Context context, Intent intent) {
|
||||||
@@ -1999,10 +2007,7 @@ public class AppStandbyController implements AppStandbyInternal {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updatePowerWhitelistCache() {
|
void updatePowerWhitelistCache() {
|
||||||
if (mBootPhase < PHASE_SYSTEM_SERVICES_READY) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
try {
|
try {
|
||||||
// Don't call out to DeviceIdleController with the lock held.
|
// Don't call out to DeviceIdleController with the lock held.
|
||||||
final String[] whitelistedPkgs =
|
final String[] whitelistedPkgs =
|
||||||
@@ -2204,7 +2209,7 @@ public class AppStandbyController implements AppStandbyInternal {
|
|||||||
break;
|
break;
|
||||||
case PowerManager.ACTION_POWER_SAVE_WHITELIST_CHANGED:
|
case PowerManager.ACTION_POWER_SAVE_WHITELIST_CHANGED:
|
||||||
if (mSystemServicesReady) {
|
if (mSystemServicesReady) {
|
||||||
mHandler.post(mInjector::updatePowerWhitelistCache);
|
mHandler.post(AppStandbyController.this::updatePowerWhitelistCache);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -217,6 +217,10 @@ public class AppStandbyControllerTests {
|
|||||||
return mNonIdleWhitelistApps.contains(packageName);
|
return mNonIdleWhitelistApps.contains(packageName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
void updatePowerWhitelistCache() {
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
boolean isRestrictedBucketEnabled() {
|
boolean isRestrictedBucketEnabled() {
|
||||||
return mIsRestrictedBucketEnabled;
|
return mIsRestrictedBucketEnabled;
|
||||||
|
|||||||
Reference in New Issue
Block a user