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

Commit 01f023a4 authored by Makoto Onuki's avatar Makoto Onuki
Browse files

Move the "whitelist type" constants to PowerWhitelistManager.

And also rename them.

Fix: 179276056
Test: Build / treehugger
Change-Id: I7b794eb0c638d3fc00ad5b40d3b24c7f2ff5241b
parent 31b60153
Loading
Loading
Loading
Loading
+21 −0
Original line number Diff line number Diff line
@@ -73,6 +73,27 @@ public class PowerWhitelistManager {
    public @interface WhitelistEvent {
    }

    /**
     * Allow the temp allowlist behavior, plus allow foreground service start from background.
     */
    public static final int TEMPORARY_ALLOWLIST_TYPE_FOREGROUND_SERVICE_ALLOWED = 0;
    /**
     * Only allow the temp allowlist behavior, not allow foreground service start from
     * background.
     */
    public static final int TEMPORARY_ALLOWLIST_TYPE_FOREGROUND_SERVICE_NOT_ALLOWED = 1;

    /**
     * The list of temp allowlist types.
     * @hide
     */
    @IntDef(flag = true, prefix = { "TEMPORARY_ALLOW_TYPE_" }, value = {
            TEMPORARY_ALLOWLIST_TYPE_FOREGROUND_SERVICE_ALLOWED,
            TEMPORARY_ALLOWLIST_TYPE_FOREGROUND_SERVICE_NOT_ALLOWED,
    })
    @Retention(RetentionPolicy.SOURCE)
    public @interface TempAllowListType {}

    /**
     * @hide
     */
+3 −3
Original line number Diff line number Diff line
@@ -16,7 +16,7 @@

package com.android.server;

import android.app.BroadcastOptions;
import android.os.PowerWhitelistManager.TempAllowListType;

import com.android.server.deviceidle.IDeviceIdleConstraint;

@@ -39,12 +39,12 @@ public interface DeviceIdleInternal {
     * allowlist.
     * @param uid
     * @param duration duration in milliseconds
     * @param type temp allowlist type defined at {@link BroadcastOptions.TempAllowListType}
     * @param type temp allowlist type defined at {@link TempAllowListType}
     * @param sync
     * @param reason
     */
    void addPowerSaveTempWhitelistAppDirect(int uid, long duration,
            @BroadcastOptions.TempAllowListType int type, boolean sync,
            @TempAllowListType int type, boolean sync,
            String reason);

    // duration in milliseconds
+2 −2
Original line number Diff line number Diff line
@@ -22,7 +22,6 @@ import android.app.ActivityManager;
import android.app.ActivityManagerInternal;
import android.app.AlarmManager;
import android.app.BroadcastOptions;
import android.app.BroadcastOptions.TempAllowListType;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
@@ -57,6 +56,7 @@ import android.os.Message;
import android.os.PowerManager;
import android.os.PowerManager.ServiceType;
import android.os.PowerManagerInternal;
import android.os.PowerWhitelistManager.TempAllowListType;
import android.os.Process;
import android.os.RemoteException;
import android.os.ResultReceiver;
@@ -3879,7 +3879,7 @@ public class DeviceIdleController extends SystemService
     * @param adding true to add to temp allowlist, false to remove from temp allowlist.
     * @param durationMs duration in milliseconds to add to temp allowlist, only valid when
     *                   param adding is true.
     * @param type temp allowlist type defined at {@link BroadcastOptions.TempAllowListType}
     * @param type temp allowlist type defined at {@link TempAllowListType}
     */
    private void updateTempWhitelistAppIdsLocked(int uid, boolean adding, long durationMs,
            @TempAllowListType int type) {
+2 −2
Original line number Diff line number Diff line
@@ -629,8 +629,6 @@ package android.app {
    method @RequiresPermission(anyOf={android.Manifest.permission.CHANGE_DEVICE_IDLE_TEMP_WHITELIST, android.Manifest.permission.START_ACTIVITIES_FROM_BACKGROUND, android.Manifest.permission.START_FOREGROUND_SERVICES_FROM_BACKGROUND}) public void setTemporaryAppWhitelistDuration(long);
    method @RequiresPermission(anyOf={android.Manifest.permission.CHANGE_DEVICE_IDLE_TEMP_WHITELIST, android.Manifest.permission.START_ACTIVITIES_FROM_BACKGROUND, android.Manifest.permission.START_FOREGROUND_SERVICES_FROM_BACKGROUND}) public void setTemporaryAppWhitelistDuration(int, long);
    method public android.os.Bundle toBundle();
    field public static final int TEMPORARY_WHITELIST_TYPE_FOREGROUND_SERVICE_ALLOWED = 0; // 0x0
    field public static final int TEMPORARY_WHITELIST_TYPE_FOREGROUND_SERVICE_NOT_ALLOWED = 1; // 0x1
  }
  public class DownloadManager {
@@ -8462,6 +8460,8 @@ package android.os {
    field public static final int EVENT_MMS = 2; // 0x2
    field public static final int EVENT_SMS = 1; // 0x1
    field public static final int EVENT_UNSPECIFIED = 0; // 0x0
    field public static final int TEMPORARY_ALLOWLIST_TYPE_FOREGROUND_SERVICE_ALLOWED = 0; // 0x0
    field public static final int TEMPORARY_ALLOWLIST_TYPE_FOREGROUND_SERVICE_NOT_ALLOWED = 1; // 0x1
  }
  public class RecoverySystem {
+5 −4
Original line number Diff line number Diff line
@@ -30,6 +30,7 @@ import android.content.pm.UserInfo;
import android.net.Uri;
import android.os.Bundle;
import android.os.IBinder;
import android.os.PowerWhitelistManager.TempAllowListType;
import android.os.TransactionTooLargeException;
import android.os.WorkSource;
import android.util.ArraySet;
@@ -103,7 +104,7 @@ public abstract class ActivityManagerInternal {
     * @param target
     * @param whitelistToken
     * @param duration temp allowlist duration in milliseconds.
     * @param type temp allowlist type defined at {@link BroadcastOptions.TempAllowListType}
     * @param type temp allowlist type defined at {@link TempAllowListType}
     */
    public abstract void setPendingIntentWhitelistDuration(IIntentSender target,
            IBinder whitelistToken, long duration, int type);
@@ -136,10 +137,10 @@ public abstract class ActivityManagerInternal {
     * @param changingUid uid to add or remove to temp allowlist.
     * @param adding true to add to temp allowlist, false to remove from temp allowlist.
     * @param durationMs when adding is true, the duration to be in temp allowlist.
     * @param type temp allowlist type defined at {@link BroadcastOptions.TempAllowListType}.
     * @param type temp allowlist type defined at {@link TempAllowListType}.
     */
    public abstract void updateDeviceIdleTempWhitelist(int[] appids, int changingUid,
            boolean adding, long durationMs, @BroadcastOptions.TempAllowListType int type);
            boolean adding, long durationMs, @TempAllowListType int type);

    /**
     * Get the procstate for the UID.  The return value will be between
@@ -333,7 +334,7 @@ public abstract class ActivityManagerInternal {
     * @param callerUid the UID that sent the PendingIntent.
     * @param targetUid the UID that is been temp allowlisted.
     * @param duration temp allowlist duration in milliseconds.
     * @param type temp allowlist type defined at {@link BroadcastOptions.TempAllowListType}
     * @param type temp allowlist type defined at {@link TempAllowListType}
     * @param tag
     */
    public abstract void tempWhitelistForPendingIntent(int callerPid, int callerUid, int targetUid,
Loading