Loading apex/jobscheduler/framework/java/android/os/PowerWhitelistManager.java +21 −0 Original line number Original line Diff line number Diff line Loading @@ -73,6 +73,27 @@ public class PowerWhitelistManager { public @interface WhitelistEvent { 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 * @hide */ */ Loading apex/jobscheduler/framework/java/com/android/server/DeviceIdleInternal.java +3 −3 Original line number Original line Diff line number Diff line Loading @@ -16,7 +16,7 @@ package com.android.server; package com.android.server; import android.app.BroadcastOptions; import android.os.PowerWhitelistManager.TempAllowListType; import com.android.server.deviceidle.IDeviceIdleConstraint; import com.android.server.deviceidle.IDeviceIdleConstraint; Loading @@ -39,12 +39,12 @@ public interface DeviceIdleInternal { * allowlist. * allowlist. * @param uid * @param uid * @param duration duration in milliseconds * @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 sync * @param reason * @param reason */ */ void addPowerSaveTempWhitelistAppDirect(int uid, long duration, void addPowerSaveTempWhitelistAppDirect(int uid, long duration, @BroadcastOptions.TempAllowListType int type, boolean sync, @TempAllowListType int type, boolean sync, String reason); String reason); // duration in milliseconds // duration in milliseconds Loading apex/jobscheduler/service/java/com/android/server/DeviceIdleController.java +2 −2 Original line number Original line Diff line number Diff line Loading @@ -22,7 +22,6 @@ import android.app.ActivityManager; import android.app.ActivityManagerInternal; import android.app.ActivityManagerInternal; import android.app.AlarmManager; import android.app.AlarmManager; import android.app.BroadcastOptions; import android.app.BroadcastOptions; import android.app.BroadcastOptions.TempAllowListType; import android.content.BroadcastReceiver; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Context; import android.content.Intent; import android.content.Intent; Loading Loading @@ -57,6 +56,7 @@ import android.os.Message; import android.os.PowerManager; import android.os.PowerManager; import android.os.PowerManager.ServiceType; import android.os.PowerManager.ServiceType; import android.os.PowerManagerInternal; import android.os.PowerManagerInternal; import android.os.PowerWhitelistManager.TempAllowListType; import android.os.Process; import android.os.Process; import android.os.RemoteException; import android.os.RemoteException; import android.os.ResultReceiver; import android.os.ResultReceiver; Loading Loading @@ -3879,7 +3879,7 @@ public class DeviceIdleController extends SystemService * @param adding true to add to temp allowlist, false to remove from temp allowlist. * @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 durationMs duration in milliseconds to add to temp allowlist, only valid when * param adding is true. * 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, private void updateTempWhitelistAppIdsLocked(int uid, boolean adding, long durationMs, @TempAllowListType int type) { @TempAllowListType int type) { Loading core/api/system-current.txt +2 −2 Original line number Original line Diff line number Diff line Loading @@ -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(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 @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(); 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 { public class DownloadManager { Loading Loading @@ -8463,6 +8461,8 @@ package android.os { field public static final int EVENT_MMS = 2; // 0x2 field public static final int EVENT_MMS = 2; // 0x2 field public static final int EVENT_SMS = 1; // 0x1 field public static final int EVENT_SMS = 1; // 0x1 field public static final int EVENT_UNSPECIFIED = 0; // 0x0 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 { public class RecoverySystem { core/java/android/app/ActivityManagerInternal.java +5 −4 Original line number Original line Diff line number Diff line Loading @@ -30,6 +30,7 @@ import android.content.pm.UserInfo; import android.net.Uri; import android.net.Uri; import android.os.Bundle; import android.os.Bundle; import android.os.IBinder; import android.os.IBinder; import android.os.PowerWhitelistManager.TempAllowListType; import android.os.TransactionTooLargeException; import android.os.TransactionTooLargeException; import android.os.WorkSource; import android.os.WorkSource; import android.util.ArraySet; import android.util.ArraySet; Loading Loading @@ -103,7 +104,7 @@ public abstract class ActivityManagerInternal { * @param target * @param target * @param whitelistToken * @param whitelistToken * @param duration temp allowlist duration in milliseconds. * @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, public abstract void setPendingIntentWhitelistDuration(IIntentSender target, IBinder whitelistToken, long duration, int type); IBinder whitelistToken, long duration, int type); Loading Loading @@ -136,10 +137,10 @@ public abstract class ActivityManagerInternal { * @param changingUid uid to add or remove to temp allowlist. * @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 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 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, 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 * Get the procstate for the UID. The return value will be between Loading Loading @@ -333,7 +334,7 @@ public abstract class ActivityManagerInternal { * @param callerUid the UID that sent the PendingIntent. * @param callerUid the UID that sent the PendingIntent. * @param targetUid the UID that is been temp allowlisted. * @param targetUid the UID that is been temp allowlisted. * @param duration temp allowlist duration in milliseconds. * @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 * @param tag */ */ public abstract void tempWhitelistForPendingIntent(int callerPid, int callerUid, int targetUid, public abstract void tempWhitelistForPendingIntent(int callerPid, int callerUid, int targetUid, Loading Loading
apex/jobscheduler/framework/java/android/os/PowerWhitelistManager.java +21 −0 Original line number Original line Diff line number Diff line Loading @@ -73,6 +73,27 @@ public class PowerWhitelistManager { public @interface WhitelistEvent { 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 * @hide */ */ Loading
apex/jobscheduler/framework/java/com/android/server/DeviceIdleInternal.java +3 −3 Original line number Original line Diff line number Diff line Loading @@ -16,7 +16,7 @@ package com.android.server; package com.android.server; import android.app.BroadcastOptions; import android.os.PowerWhitelistManager.TempAllowListType; import com.android.server.deviceidle.IDeviceIdleConstraint; import com.android.server.deviceidle.IDeviceIdleConstraint; Loading @@ -39,12 +39,12 @@ public interface DeviceIdleInternal { * allowlist. * allowlist. * @param uid * @param uid * @param duration duration in milliseconds * @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 sync * @param reason * @param reason */ */ void addPowerSaveTempWhitelistAppDirect(int uid, long duration, void addPowerSaveTempWhitelistAppDirect(int uid, long duration, @BroadcastOptions.TempAllowListType int type, boolean sync, @TempAllowListType int type, boolean sync, String reason); String reason); // duration in milliseconds // duration in milliseconds Loading
apex/jobscheduler/service/java/com/android/server/DeviceIdleController.java +2 −2 Original line number Original line Diff line number Diff line Loading @@ -22,7 +22,6 @@ import android.app.ActivityManager; import android.app.ActivityManagerInternal; import android.app.ActivityManagerInternal; import android.app.AlarmManager; import android.app.AlarmManager; import android.app.BroadcastOptions; import android.app.BroadcastOptions; import android.app.BroadcastOptions.TempAllowListType; import android.content.BroadcastReceiver; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Context; import android.content.Intent; import android.content.Intent; Loading Loading @@ -57,6 +56,7 @@ import android.os.Message; import android.os.PowerManager; import android.os.PowerManager; import android.os.PowerManager.ServiceType; import android.os.PowerManager.ServiceType; import android.os.PowerManagerInternal; import android.os.PowerManagerInternal; import android.os.PowerWhitelistManager.TempAllowListType; import android.os.Process; import android.os.Process; import android.os.RemoteException; import android.os.RemoteException; import android.os.ResultReceiver; import android.os.ResultReceiver; Loading Loading @@ -3879,7 +3879,7 @@ public class DeviceIdleController extends SystemService * @param adding true to add to temp allowlist, false to remove from temp allowlist. * @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 durationMs duration in milliseconds to add to temp allowlist, only valid when * param adding is true. * 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, private void updateTempWhitelistAppIdsLocked(int uid, boolean adding, long durationMs, @TempAllowListType int type) { @TempAllowListType int type) { Loading
core/api/system-current.txt +2 −2 Original line number Original line Diff line number Diff line Loading @@ -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(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 @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(); 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 { public class DownloadManager { Loading Loading @@ -8463,6 +8461,8 @@ package android.os { field public static final int EVENT_MMS = 2; // 0x2 field public static final int EVENT_MMS = 2; // 0x2 field public static final int EVENT_SMS = 1; // 0x1 field public static final int EVENT_SMS = 1; // 0x1 field public static final int EVENT_UNSPECIFIED = 0; // 0x0 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 { public class RecoverySystem {
core/java/android/app/ActivityManagerInternal.java +5 −4 Original line number Original line Diff line number Diff line Loading @@ -30,6 +30,7 @@ import android.content.pm.UserInfo; import android.net.Uri; import android.net.Uri; import android.os.Bundle; import android.os.Bundle; import android.os.IBinder; import android.os.IBinder; import android.os.PowerWhitelistManager.TempAllowListType; import android.os.TransactionTooLargeException; import android.os.TransactionTooLargeException; import android.os.WorkSource; import android.os.WorkSource; import android.util.ArraySet; import android.util.ArraySet; Loading Loading @@ -103,7 +104,7 @@ public abstract class ActivityManagerInternal { * @param target * @param target * @param whitelistToken * @param whitelistToken * @param duration temp allowlist duration in milliseconds. * @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, public abstract void setPendingIntentWhitelistDuration(IIntentSender target, IBinder whitelistToken, long duration, int type); IBinder whitelistToken, long duration, int type); Loading Loading @@ -136,10 +137,10 @@ public abstract class ActivityManagerInternal { * @param changingUid uid to add or remove to temp allowlist. * @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 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 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, 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 * Get the procstate for the UID. The return value will be between Loading Loading @@ -333,7 +334,7 @@ public abstract class ActivityManagerInternal { * @param callerUid the UID that sent the PendingIntent. * @param callerUid the UID that sent the PendingIntent. * @param targetUid the UID that is been temp allowlisted. * @param targetUid the UID that is been temp allowlisted. * @param duration temp allowlist duration in milliseconds. * @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 * @param tag */ */ public abstract void tempWhitelistForPendingIntent(int callerPid, int callerUid, int targetUid, public abstract void tempWhitelistForPendingIntent(int callerPid, int callerUid, int targetUid, Loading