Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a495db27 authored by Automerger Merge Worker's avatar Automerger Merge Worker
Browse files

Merge "Merge "Check app idle states and inform listeners on power-save-wl...

Merge "Merge "Check app idle states and inform listeners on power-save-wl change." into rvc-dev am: 91294181 am: 0acff8fd am: 55727b13" into rvc-qpr-dev-plus-aosp am: c7743f00

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/12166806

Change-Id: Iff3cf7675dc0a97727175e4daaff14a957d7d84b
parents ced24cde c7743f00
Loading
Loading
Loading
Loading
+11 −6
Original line number Diff line number Diff line
@@ -488,7 +488,7 @@ public class AppStandbyController implements AppStandbyInternal {
            mSystemServicesReady = true;

            // Offload to handler thread to avoid boot time impact.
            mHandler.post(mInjector::updatePowerWhitelistCache);
            mHandler.post(AppStandbyController.this::updatePowerWhitelistCache);

            boolean userFileExists;
            synchronized (mAppIdleLock) {
@@ -1716,6 +1716,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 {
        @Override
        public void onReceive(Context context, Intent intent) {
@@ -2029,10 +2037,7 @@ public class AppStandbyController implements AppStandbyInternal {
            }
        }

        private void updatePowerWhitelistCache() {
            if (mBootPhase < PHASE_SYSTEM_SERVICES_READY) {
                return;
            }
        void updatePowerWhitelistCache() {
            try {
                // Don't call out to DeviceIdleController with the lock held.
                final String[] whitelistedPkgs =
@@ -2232,7 +2237,7 @@ public class AppStandbyController implements AppStandbyInternal {
                    break;
                case PowerManager.ACTION_POWER_SAVE_WHITELIST_CHANGED:
                    if (mSystemServicesReady) {
                        mHandler.post(mInjector::updatePowerWhitelistCache);
                        mHandler.post(AppStandbyController.this::updatePowerWhitelistCache);
                    }
                    break;
            }
+4 −0
Original line number Diff line number Diff line
@@ -217,6 +217,10 @@ public class AppStandbyControllerTests {
            return mNonIdleWhitelistApps.contains(packageName);
        }

        @Override
        void updatePowerWhitelistCache() {
        }

        @Override
        boolean isRestrictedBucketEnabled() {
            return mIsRestrictedBucketEnabled;