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

Commit 31bead79 authored by Piyush Singhania's avatar Piyush Singhania
Browse files

Eliminate the ACTION_POWER_SAVE_TEMP_WHITELIST_CHANGED broadcast

This is being done to prevent new clients from depending on this action.

Flag: com.android.server.deviceidle.stop_power_save_temp_whitelist_broadcast
Bug: 427271861
Test: atest JobSchedulerServiceTest DeviceIdleControllerTest
Change-Id: I1979085b525c7890ca1ff6f61a0c41af4b2294c9
parent 3d6513ac
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -2771,8 +2771,9 @@ public class DeviceIdleController extends SystemService
                mPowerSaveWhitelistChangedIntent = new Intent(
                        PowerManager.ACTION_POWER_SAVE_WHITELIST_CHANGED);
                mPowerSaveWhitelistChangedIntent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY);
                //This intent is not exposed in PowerManager, so hardcoding the broadcast string.
                mPowerSaveTempWhitelistChangedIntent = new Intent(
                        PowerManager.ACTION_POWER_SAVE_TEMP_WHITELIST_CHANGED);
                        "android.os.action.POWER_SAVE_TEMP_WHITELIST_CHANGED");
                mPowerSaveTempWhitelistChangedIntent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY);
                mPowerSaveWhitelistChangedOptions = mostRecentDeliveryOptions;
                mPowerSaveTempWhilelistChangedOptions = mostRecentDeliveryOptions;
+3 −4
Original line number Diff line number Diff line
@@ -104,7 +104,7 @@ public final class DeviceIdleJobsController extends StateController {
                        }
                    }
                    break;
                case PowerManager.ACTION_POWER_SAVE_TEMP_WHITELIST_CHANGED:
                case "android.os.action.POWER_SAVE_TEMP_WHITELIST_CHANGED":
                    synchronized (mLock) {
                        mPowerSaveTempWhitelistAppIds =
                                mLocalDeviceIdleController.getPowerSaveTempWhitelistAppIds();
@@ -115,8 +115,7 @@ public final class DeviceIdleJobsController extends StateController {
                        final ArraySet<JobStatus> changedJobs = new ArraySet<>();
                        final long nowElapsed = sElapsedRealtimeClock.millis();
                        for (int i = 0; i < mAllowInIdleJobs.size(); i++) {
                            if (updateTaskStateLocked(mAllowInIdleJobs.valueAt(i),
                                    nowElapsed)) {
                            if (updateTaskStateLocked(mAllowInIdleJobs.valueAt(i), nowElapsed)) {
                                changedJobs.add(mAllowInIdleJobs.valueAt(i));
                            }
                        }
@@ -154,7 +153,7 @@ public final class DeviceIdleJobsController extends StateController {
        filter.addAction(PowerManager.ACTION_LIGHT_DEVICE_IDLE_MODE_CHANGED);
        filter.addAction(PowerManager.ACTION_POWER_SAVE_WHITELIST_CHANGED);
        if (!Flags.stopPowerSaveTempWhitelistBroadcast()) {
            filter.addAction(PowerManager.ACTION_POWER_SAVE_TEMP_WHITELIST_CHANGED);
            filter.addAction("android.os.action.POWER_SAVE_TEMP_WHITELIST_CHANGED");
        }
        mContext.registerReceiverAsUser(mBroadcastReceiver, UserHandle.ALL, filter, null, mHandler);
    }
+0 −8
Original line number Diff line number Diff line
@@ -3598,14 +3598,6 @@ public final class PowerManager {
    public static final String ACTION_POWER_SAVE_WHITELIST_CHANGED
            = "android.os.action.POWER_SAVE_WHITELIST_CHANGED";

    /**
     * @hide Intent that is broadcast when the set of temporarily allowlisted apps has changed.
     * This broadcast is only sent to registered receivers.
     */
    @SdkConstant(SdkConstant.SdkConstantType.BROADCAST_INTENT_ACTION)
    public static final String ACTION_POWER_SAVE_TEMP_WHITELIST_CHANGED
            = "android.os.action.POWER_SAVE_TEMP_WHITELIST_CHANGED";

    /**
     * Intent that is broadcast when Low Power Standby is enabled or disabled.
     * This broadcast is only sent to registered receivers and receivers holding