Merge "Allow EJs to obtain new network capability." into sc-dev am: 8632838c50

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

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I17dc44c86f41545b859de0afa3f7749e0cfef10e
This commit is contained in:
Sudheer Shanka
2021-02-25 14:40:07 +00:00
committed by Automerger Merge Worker
11 changed files with 170 additions and 17 deletions

View File

@@ -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. */
@@ -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. */
@@ -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}*/
@@ -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

View File

@@ -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);
}