Merge "Add support for excluding tags from restrictions" into sc-dev am: fe40442304 am: b2ea76cc02
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14503384 Change-Id: If836e070472cfe80f701313537abe5ab8dd43639
This commit is contained in:
@@ -7394,20 +7394,27 @@ public class AppOpsManager {
|
||||
|
||||
/** @hide */
|
||||
public void setUserRestriction(int code, boolean restricted, IBinder token) {
|
||||
setUserRestriction(code, restricted, token, /*exceptionPackages*/null);
|
||||
setUserRestriction(code, restricted, token, (Map<String, String[]>) null);
|
||||
}
|
||||
|
||||
/** @hide */
|
||||
/**
|
||||
* An empty array of attribution tags means exclude all tags under that package.
|
||||
* @hide
|
||||
*/
|
||||
public void setUserRestriction(int code, boolean restricted, IBinder token,
|
||||
String[] exceptionPackages) {
|
||||
setUserRestrictionForUser(code, restricted, token, exceptionPackages, mContext.getUserId());
|
||||
@Nullable Map<String, String[]> excludedPackageTags) {
|
||||
setUserRestrictionForUser(code, restricted, token, excludedPackageTags,
|
||||
mContext.getUserId());
|
||||
}
|
||||
|
||||
/** @hide */
|
||||
/**
|
||||
* An empty array of attribution tags means exclude all tags under that package.
|
||||
* @hide
|
||||
*/
|
||||
public void setUserRestrictionForUser(int code, boolean restricted, IBinder token,
|
||||
String[] exceptionPackages, int userId) {
|
||||
@Nullable Map<String, String[]> excludedPackageTags, int userId) {
|
||||
try {
|
||||
mService.setUserRestriction(code, restricted, token, userId, exceptionPackages);
|
||||
mService.setUserRestriction(code, restricted, token, userId, excludedPackageTags);
|
||||
} catch (RemoteException e) {
|
||||
throw e.rethrowFromSystemServer();
|
||||
}
|
||||
@@ -7949,7 +7956,7 @@ public class AppOpsManager {
|
||||
*/
|
||||
public int unsafeCheckOpRawNoThrow(int op, int uid, @NonNull String packageName) {
|
||||
try {
|
||||
return mService.checkOperationRaw(op, uid, packageName);
|
||||
return mService.checkOperationRaw(op, uid, packageName, null);
|
||||
} catch (RemoteException e) {
|
||||
throw e.rethrowFromSystemServer();
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@ import com.android.internal.util.function.HexFunction;
|
||||
import com.android.internal.util.function.NonaFunction;
|
||||
import com.android.internal.util.function.OctFunction;
|
||||
import com.android.internal.util.function.QuadFunction;
|
||||
import com.android.internal.util.function.QuintFunction;
|
||||
import com.android.internal.util.function.TriFunction;
|
||||
|
||||
/**
|
||||
@@ -45,12 +46,14 @@ public abstract class AppOpsManagerInternal {
|
||||
* @param code The op code to check.
|
||||
* @param uid The UID for which to check.
|
||||
* @param packageName The package for which to check.
|
||||
* @param superImpl The super implementation.
|
||||
* @param attributionTag The attribution tag for which to check.
|
||||
* @param raw Whether to check the raw op i.e. not interpret the mode based on UID state.
|
||||
* @param superImpl The super implementation.
|
||||
* @return The app op check result.
|
||||
*/
|
||||
int checkOperation(int code, int uid, String packageName, boolean raw,
|
||||
QuadFunction<Integer, Integer, String, Boolean, Integer> superImpl);
|
||||
int checkOperation(int code, int uid, String packageName, @Nullable String attributionTag,
|
||||
boolean raw,
|
||||
QuintFunction<Integer, Integer, String, String, Boolean, Integer> superImpl);
|
||||
|
||||
/**
|
||||
* Allows overriding check audio operation behavior.
|
||||
|
||||
Reference in New Issue
Block a user