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

Commit 43052bcc authored by Makoto Onuki's avatar Makoto Onuki Committed by Automerger Merge Worker
Browse files

Merge "Add TEMPORARY_ALLOW_LIST_TYPE_NONE." into sc-dev am: d0b0f4ce

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

Change-Id: If6a03bf079c5c1e07735e446db7d2b9a944c77a9
parents 77591d99 d0b0f4ce
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -82,6 +82,12 @@ public class PowerExemptionManager {
    public @interface AllowListEvent {
    }

    /**
     * Does not place the app on any temporary allow list. Nullifies the previous call to
     * {@link android.app.BroadcastOptions#setTemporaryAppAllowlist(long, int, int, String)}.
     * Note: this will not remove the receiver app from the temp allow list.
     */
    public static final int TEMPORARY_ALLOW_LIST_TYPE_NONE = -1;
    /**
     * Allow the temp allow list behavior, plus allow foreground service start from background.
     */
@@ -96,6 +102,7 @@ public class PowerExemptionManager {
     * @hide
     */
    @IntDef(flag = true, prefix = { "TEMPORARY_ALLOW_LIST_TYPE_" }, value = {
            TEMPORARY_ALLOW_LIST_TYPE_NONE,
            TEMPORARY_ALLOW_LIST_TYPE_FOREGROUND_SERVICE_ALLOWED,
            TEMPORARY_ALLOW_LIST_TYPE_FOREGROUND_SERVICE_NOT_ALLOWED,
    })
+4 −4
Original line number Diff line number Diff line
@@ -17,9 +17,9 @@
package com.android.server;

import android.annotation.Nullable;
import android.os.PowerWhitelistManager;
import android.os.PowerWhitelistManager.ReasonCode;
import android.os.PowerWhitelistManager.TempAllowListType;
import android.os.PowerExemptionManager;
import android.os.PowerExemptionManager.ReasonCode;
import android.os.PowerExemptionManager.TempAllowListType;

import com.android.server.deviceidle.IDeviceIdleConstraint;

@@ -35,7 +35,7 @@ public interface DeviceIdleInternal {

    /**
     * Same as {@link #addPowerSaveTempWhitelistApp(int, String, long, int, boolean, int, String)}
     * with {@link PowerWhitelistManager#TEMPORARY_ALLOWLIST_TYPE_FOREGROUND_SERVICE_ALLOWED}.
     * with {@link PowerExemptionManager#TEMPORARY_ALLOW_LIST_TYPE_FOREGROUND_SERVICE_ALLOWED}.
     */
    void addPowerSaveTempWhitelistApp(int callingUid, String packageName,
            long durationMs, int userId, boolean sync, @ReasonCode int reasonCode,
+7 −7
Original line number Diff line number Diff line
@@ -16,9 +16,9 @@

package com.android.server;

import static android.os.PowerWhitelistManager.REASON_SHELL;
import static android.os.PowerWhitelistManager.REASON_UNKNOWN;
import static android.os.PowerWhitelistManager.TEMPORARY_ALLOWLIST_TYPE_FOREGROUND_SERVICE_ALLOWED;
import static android.os.PowerExemptionManager.REASON_SHELL;
import static android.os.PowerExemptionManager.REASON_UNKNOWN;
import static android.os.PowerExemptionManager.TEMPORARY_ALLOW_LIST_TYPE_FOREGROUND_SERVICE_ALLOWED;
import static android.os.Process.INVALID_UID;

import android.Manifest;
@@ -58,11 +58,11 @@ import android.os.Handler;
import android.os.IDeviceIdleController;
import android.os.Looper;
import android.os.Message;
import android.os.PowerExemptionManager.ReasonCode;
import android.os.PowerExemptionManager.TempAllowListType;
import android.os.PowerManager;
import android.os.PowerManager.ServiceType;
import android.os.PowerManagerInternal;
import android.os.PowerWhitelistManager.ReasonCode;
import android.os.PowerWhitelistManager.TempAllowListType;
import android.os.Process;
import android.os.RemoteException;
import android.os.ResultReceiver;
@@ -1947,7 +1947,7 @@ public class DeviceIdleController extends SystemService
                long durationMs, int userId, boolean sync, @ReasonCode int reasonCode,
                @Nullable String reason) {
            addPowerSaveTempAllowlistAppInternal(callingUid, packageName, durationMs,
                    TEMPORARY_ALLOWLIST_TYPE_FOREGROUND_SERVICE_ALLOWED,
                    TEMPORARY_ALLOW_LIST_TYPE_FOREGROUND_SERVICE_ALLOWED,
                    userId, sync, reasonCode, reason);
        }

@@ -2706,7 +2706,7 @@ public class DeviceIdleController extends SystemService
        final long token = Binder.clearCallingIdentity();
        try {
            addPowerSaveTempAllowlistAppInternal(callingUid,
                    packageName, duration, TEMPORARY_ALLOWLIST_TYPE_FOREGROUND_SERVICE_ALLOWED,
                    packageName, duration, TEMPORARY_ALLOW_LIST_TYPE_FOREGROUND_SERVICE_ALLOWED,
                    userId, true, reasonCode, reason);
        } finally {
            Binder.restoreCallingIdentity(token);
+1 −0
Original line number Diff line number Diff line
@@ -8336,6 +8336,7 @@ package android.os {
    field public static final int REASON_UNKNOWN = 0; // 0x0
    field public static final int TEMPORARY_ALLOW_LIST_TYPE_FOREGROUND_SERVICE_ALLOWED = 0; // 0x0
    field public static final int TEMPORARY_ALLOW_LIST_TYPE_FOREGROUND_SERVICE_NOT_ALLOWED = 1; // 0x1
    field public static final int TEMPORARY_ALLOW_LIST_TYPE_NONE = -1; // 0xffffffff
  }
  public final class PowerManager {
+8 −0
Original line number Diff line number Diff line
@@ -253,6 +253,14 @@ package android.app {
    method public void offsetBeginAndEndTime(long);
  }

  public class BroadcastOptions {
    ctor public BroadcastOptions(@NonNull android.os.Bundle);
    method public long getTemporaryAppAllowlistDuration();
    method @Nullable public String getTemporaryAppAllowlistReason();
    method public int getTemporaryAppAllowlistReasonCode();
    method public int getTemporaryAppAllowlistType();
  }

  public class DownloadManager {
    field public static final String COLUMN_MEDIASTORE_URI = "mediastore_uri";
  }
Loading