Loading apex/jobscheduler/service/java/com/android/server/job/JobServiceContext.java +3 −1 Original line number Diff line number Diff line Loading @@ -271,7 +271,9 @@ public final class JobServiceContext implements ServiceConnection { if (job.shouldTreatAsExpeditedJob()) { // TODO(171305774): The job should run on the little cores. We'll probably need // another binding flag for that. bindFlags = Context.BIND_AUTO_CREATE; bindFlags = Context.BIND_AUTO_CREATE | Context.BIND_NOT_FOREGROUND | Context.BIND_ALMOST_PERCEPTIBLE | Context.BIND_ALLOW_NETWORK_ACCESS; } else { bindFlags = Context.BIND_AUTO_CREATE | Context.BIND_NOT_FOREGROUND | Context.BIND_NOT_PERCEPTIBLE; Loading core/api/test-current.txt +5 −0 Original line number Diff line number Diff line Loading @@ -91,6 +91,8 @@ package android.app { method @RequiresPermission(android.Manifest.permission.SET_ACTIVITY_WATCHER) public void addHomeVisibilityListener(@NonNull java.util.concurrent.Executor, @NonNull android.app.HomeVisibilityListener); method public void alwaysShowUnsupportedCompileSdkWarning(android.content.ComponentName); method public long getTotalRam(); method @RequiresPermission(android.Manifest.permission.PACKAGE_USAGE_STATS) public int getUidProcessCapabilities(int); method @RequiresPermission(android.Manifest.permission.PACKAGE_USAGE_STATS) public int getUidProcessState(int); method public void holdLock(android.os.IBinder, int); method public static boolean isHighEndGfx(); method @RequiresPermission(android.Manifest.permission.SET_ACTIVITY_WATCHER) public void removeHomeVisibilityListener(@NonNull android.app.HomeVisibilityListener); Loading @@ -106,7 +108,10 @@ package android.app { field public static final int PROCESS_CAPABILITY_FOREGROUND_CAMERA = 2; // 0x2 field public static final int PROCESS_CAPABILITY_FOREGROUND_LOCATION = 1; // 0x1 field public static final int PROCESS_CAPABILITY_FOREGROUND_MICROPHONE = 4; // 0x4 field public static final int PROCESS_CAPABILITY_NETWORK = 8; // 0x8 field public static final int PROCESS_CAPABILITY_NONE = 0; // 0x0 field public static final int PROCESS_STATE_FOREGROUND_SERVICE = 4; // 0x4 field public static final int PROCESS_STATE_TOP = 2; // 0x2 } public static class ActivityManager.RunningAppProcessInfo implements android.os.Parcelable { Loading core/java/android/app/ActivityManager.java +33 −0 Original line number Diff line number Diff line Loading @@ -511,6 +511,7 @@ public class ActivityManager { /** @hide Process is hosting the current top activities. Note that this covers * all activities that are visible to the user. */ @UnsupportedAppUsage @TestApi public static final int PROCESS_STATE_TOP = ProcessStateEnum.TOP; /** @hide Process is bound to a TOP app. */ Loading @@ -518,6 +519,7 @@ public class ActivityManager { /** @hide Process is hosting a foreground service. */ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553) @TestApi public static final int PROCESS_STATE_FOREGROUND_SERVICE = ProcessStateEnum.FOREGROUND_SERVICE; /** @hide Process is hosting a foreground service due to a system binding. */ Loading Loading @@ -617,6 +619,7 @@ public class ActivityManager { public static final int PROCESS_CAPABILITY_FOREGROUND_MICROPHONE = 1 << 2; /** @hide Process can access network despite any power saving resrictions */ @TestApi public static final int PROCESS_CAPABILITY_NETWORK = 1 << 3; /** @hide all capabilities, the ORing of all flags in {@link ProcessCapability}*/ Loading Loading @@ -3431,6 +3434,36 @@ public class ActivityManager { return SystemProperties.getBoolean("persist.sys.lmk.reportkills", false); } /** * Returns the process state of this uid. * * @hide */ @TestApi @RequiresPermission(Manifest.permission.PACKAGE_USAGE_STATS) public int getUidProcessState(int uid) { try { return getService().getUidProcessState(uid, mContext.getOpPackageName()); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } /** * Returns the process capability of this uid. * * @hide */ @TestApi @RequiresPermission(Manifest.permission.PACKAGE_USAGE_STATS) public @ProcessCapability int getUidProcessCapabilities(int uid) { try { return getService().getUidProcessCapabilities(uid, mContext.getOpPackageName()); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } /** * Return the importance of a given package name, based on the processes that are * currently running. The return value is one of the importance constants defined Loading core/java/android/app/IActivityManager.aidl +2 −0 Original line number Diff line number Diff line Loading @@ -707,4 +707,6 @@ interface IActivityManager { /** Called by PendingIntent.queryIntentComponents() */ List<ResolveInfo> queryIntentComponentsForIntentSender(in IIntentSender sender, int matchFlags); int getUidProcessCapabilities(int uid, in String callingPackage); } core/java/android/content/Context.java +19 −0 Original line number Diff line number Diff line Loading @@ -369,6 +369,25 @@ public abstract class Context { /*********** Public flags above this line ***********/ /*********** Hidden flags below this line ***********/ /** * Flag for {@link #bindService}: allow the process hosting the target service to be treated * as if it's as important as a perceptible app to the user and avoid the oom killer killing * this process in low memory situations until there aren't any other processes left but the * ones which are user-perceptible. * * @hide */ public static final int BIND_ALMOST_PERCEPTIBLE = 0x000010000; /** * Flag for {@link #bindService}: allow the process hosting the target service to gain * {@link ActivityManager#PROCESS_CAPABILITY_NETWORK}, which allows it be able * to access network regardless of any power saving restrictions. * * @hide */ public static final int BIND_ALLOW_NETWORK_ACCESS = 0x00020000; /** * Flag for {@link #bindService}: allow background foreground service starts from the bound * service's process. Loading Loading
apex/jobscheduler/service/java/com/android/server/job/JobServiceContext.java +3 −1 Original line number Diff line number Diff line Loading @@ -271,7 +271,9 @@ public final class JobServiceContext implements ServiceConnection { if (job.shouldTreatAsExpeditedJob()) { // TODO(171305774): The job should run on the little cores. We'll probably need // another binding flag for that. bindFlags = Context.BIND_AUTO_CREATE; bindFlags = Context.BIND_AUTO_CREATE | Context.BIND_NOT_FOREGROUND | Context.BIND_ALMOST_PERCEPTIBLE | Context.BIND_ALLOW_NETWORK_ACCESS; } else { bindFlags = Context.BIND_AUTO_CREATE | Context.BIND_NOT_FOREGROUND | Context.BIND_NOT_PERCEPTIBLE; Loading
core/api/test-current.txt +5 −0 Original line number Diff line number Diff line Loading @@ -91,6 +91,8 @@ package android.app { method @RequiresPermission(android.Manifest.permission.SET_ACTIVITY_WATCHER) public void addHomeVisibilityListener(@NonNull java.util.concurrent.Executor, @NonNull android.app.HomeVisibilityListener); method public void alwaysShowUnsupportedCompileSdkWarning(android.content.ComponentName); method public long getTotalRam(); method @RequiresPermission(android.Manifest.permission.PACKAGE_USAGE_STATS) public int getUidProcessCapabilities(int); method @RequiresPermission(android.Manifest.permission.PACKAGE_USAGE_STATS) public int getUidProcessState(int); method public void holdLock(android.os.IBinder, int); method public static boolean isHighEndGfx(); method @RequiresPermission(android.Manifest.permission.SET_ACTIVITY_WATCHER) public void removeHomeVisibilityListener(@NonNull android.app.HomeVisibilityListener); Loading @@ -106,7 +108,10 @@ package android.app { field public static final int PROCESS_CAPABILITY_FOREGROUND_CAMERA = 2; // 0x2 field public static final int PROCESS_CAPABILITY_FOREGROUND_LOCATION = 1; // 0x1 field public static final int PROCESS_CAPABILITY_FOREGROUND_MICROPHONE = 4; // 0x4 field public static final int PROCESS_CAPABILITY_NETWORK = 8; // 0x8 field public static final int PROCESS_CAPABILITY_NONE = 0; // 0x0 field public static final int PROCESS_STATE_FOREGROUND_SERVICE = 4; // 0x4 field public static final int PROCESS_STATE_TOP = 2; // 0x2 } public static class ActivityManager.RunningAppProcessInfo implements android.os.Parcelable { Loading
core/java/android/app/ActivityManager.java +33 −0 Original line number Diff line number Diff line Loading @@ -511,6 +511,7 @@ public class ActivityManager { /** @hide Process is hosting the current top activities. Note that this covers * all activities that are visible to the user. */ @UnsupportedAppUsage @TestApi public static final int PROCESS_STATE_TOP = ProcessStateEnum.TOP; /** @hide Process is bound to a TOP app. */ Loading @@ -518,6 +519,7 @@ public class ActivityManager { /** @hide Process is hosting a foreground service. */ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553) @TestApi public static final int PROCESS_STATE_FOREGROUND_SERVICE = ProcessStateEnum.FOREGROUND_SERVICE; /** @hide Process is hosting a foreground service due to a system binding. */ Loading Loading @@ -617,6 +619,7 @@ public class ActivityManager { public static final int PROCESS_CAPABILITY_FOREGROUND_MICROPHONE = 1 << 2; /** @hide Process can access network despite any power saving resrictions */ @TestApi public static final int PROCESS_CAPABILITY_NETWORK = 1 << 3; /** @hide all capabilities, the ORing of all flags in {@link ProcessCapability}*/ Loading Loading @@ -3431,6 +3434,36 @@ public class ActivityManager { return SystemProperties.getBoolean("persist.sys.lmk.reportkills", false); } /** * Returns the process state of this uid. * * @hide */ @TestApi @RequiresPermission(Manifest.permission.PACKAGE_USAGE_STATS) public int getUidProcessState(int uid) { try { return getService().getUidProcessState(uid, mContext.getOpPackageName()); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } /** * Returns the process capability of this uid. * * @hide */ @TestApi @RequiresPermission(Manifest.permission.PACKAGE_USAGE_STATS) public @ProcessCapability int getUidProcessCapabilities(int uid) { try { return getService().getUidProcessCapabilities(uid, mContext.getOpPackageName()); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } /** * Return the importance of a given package name, based on the processes that are * currently running. The return value is one of the importance constants defined Loading
core/java/android/app/IActivityManager.aidl +2 −0 Original line number Diff line number Diff line Loading @@ -707,4 +707,6 @@ interface IActivityManager { /** Called by PendingIntent.queryIntentComponents() */ List<ResolveInfo> queryIntentComponentsForIntentSender(in IIntentSender sender, int matchFlags); int getUidProcessCapabilities(int uid, in String callingPackage); }
core/java/android/content/Context.java +19 −0 Original line number Diff line number Diff line Loading @@ -369,6 +369,25 @@ public abstract class Context { /*********** Public flags above this line ***********/ /*********** Hidden flags below this line ***********/ /** * Flag for {@link #bindService}: allow the process hosting the target service to be treated * as if it's as important as a perceptible app to the user and avoid the oom killer killing * this process in low memory situations until there aren't any other processes left but the * ones which are user-perceptible. * * @hide */ public static final int BIND_ALMOST_PERCEPTIBLE = 0x000010000; /** * Flag for {@link #bindService}: allow the process hosting the target service to gain * {@link ActivityManager#PROCESS_CAPABILITY_NETWORK}, which allows it be able * to access network regardless of any power saving restrictions. * * @hide */ public static final int BIND_ALLOW_NETWORK_ACCESS = 0x00020000; /** * Flag for {@link #bindService}: allow background foreground service starts from the bound * service's process. Loading