[DeviceAware] Re-add proxy methods taking AttributionSource in
AppOpsService.aidl.
This is a follow up on ag/24622058, in light of some methods being mentioned in
hiddenapi-unsupported.txt.
Bug: 299160174
Test: atest CtsAppOpsTestCases CtsAppOps2TestCases
Change-Id: I8ff5f740f178111fd56bd270c73c1f255fa59a96
diff --git a/core/java/android/app/AppOpsManager.java b/core/java/android/app/AppOpsManager.java
index ecbc9b1..9a19d8e 100644
--- a/core/java/android/app/AppOpsManager.java
+++ b/core/java/android/app/AppOpsManager.java
@@ -8638,8 +8638,8 @@
}
}
- SyncNotedAppOp syncOp = mService.noteProxyOperation(op, attributionSource.asState(),
- collectionMode == COLLECT_ASYNC, message,
+ SyncNotedAppOp syncOp = mService.noteProxyOperationWithState(op,
+ attributionSource.asState(), collectionMode == COLLECT_ASYNC, message,
shouldCollectMessage, skipProxyOperation);
if (syncOp.getOpMode() == MODE_ALLOWED) {
@@ -9110,7 +9110,7 @@
}
}
- SyncNotedAppOp syncOp = mService.startProxyOperation(clientId, op,
+ SyncNotedAppOp syncOp = mService.startProxyOperationWithState(clientId, op,
attributionSource.asState(), false, collectionMode == COLLECT_ASYNC, message,
shouldCollectMessage, skipProxyOperation, proxyAttributionFlags,
proxiedAttributionFlags, attributionChainId);
@@ -9229,8 +9229,8 @@
public void finishProxyOp(@NonNull IBinder clientId, @NonNull String op,
@NonNull AttributionSource attributionSource, boolean skipProxyOperation) {
try {
- mService.finishProxyOperation(clientId, strOpToOp(op), attributionSource.asState(),
- skipProxyOperation);
+ mService.finishProxyOperationWithState(
+ clientId, strOpToOp(op), attributionSource.asState(), skipProxyOperation);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
diff --git a/core/java/com/android/internal/app/IAppOpsService.aidl b/core/java/com/android/internal/app/IAppOpsService.aidl
index 584dd80..492e2ac 100644
--- a/core/java/com/android/internal/app/IAppOpsService.aidl
+++ b/core/java/com/android/internal/app/IAppOpsService.aidl
@@ -20,6 +20,7 @@
import android.app.AsyncNotedAppOp;
import android.app.SyncNotedAppOp;
import android.app.RuntimeAppOpAccessMessage;
+import android.content.AttributionSource;
import android.content.AttributionSourceState;
import android.content.pm.ParceledListSlice;
import android.os.Bundle;
@@ -32,10 +33,17 @@
import com.android.internal.app.IAppOpsStartedCallback;
import com.android.internal.app.MessageSamplingConfig;
+// AppOpsService AIDL interface.
+// PLEASE READ BEFORE MODIFYING THIS FILE.
+// Some methods in this interface or their transaction codes are mentioned in
+// frameworks/base/boot/hiddenapi/hiddenapi-unsupported.txt, meaning that we cannot change their
+// signature or ordering as they may be used by 3p apps.
+// Also, some methods are mentioned in native code, meaning that the numbering in
+// frameworks/native/libs/permission/include/binder/IAppOpsService.h must match the order here.
+// Please be careful to respect both these issues when modifying this file.
interface IAppOpsService {
- // These methods are also called by native code, so must
- // be kept in sync with frameworks/native/libs/permission/include/binder/IAppOpsService.h
- // and not be reordered
+ // These methods are also called by native code, so please be careful that the number in
+ // frameworks/native/libs/permission/include/binder/IAppOpsService.h matches the ordering here.
int checkOperation(int code, int uid, String packageName);
SyncNotedAppOp noteOperation(int code, int uid, String packageName, @nullable String attributionTag,
boolean shouldCollectAsyncNotedOp, String message, boolean shouldCollectMessage);
@@ -54,21 +62,21 @@
void setCameraAudioRestriction(int mode);
void startWatchingModeWithFlags(int op, String packageName, int flags,
IAppOpsCallback callback);
- // End of methods also called by native code.
- // Any new method exposed to native must be added after the last one, do not reorder
-
- SyncNotedAppOp noteProxyOperation(int code, in AttributionSourceState attributionSourceState,
+ // End of methods also called by native code (there may be more blocks like this of native
+ // methods later in this file).
+ // Deprecated, use noteProxyOperationWithState instead.
+ SyncNotedAppOp noteProxyOperation(int code, in AttributionSource attributionSource,
boolean shouldCollectAsyncNotedOp, String message, boolean shouldCollectMessage,
boolean skipProxyOperation);
+ // Deprecated, use startProxyOperationWithState instead.
SyncNotedAppOp startProxyOperation(IBinder clientId, int code,
- in AttributionSourceState attributionSourceState, boolean startIfModeDefault,
+ in AttributionSource attributionSource, boolean startIfModeDefault,
boolean shouldCollectAsyncNotedOp, String message, boolean shouldCollectMessage,
boolean skipProxyOperation, int proxyAttributionFlags, int proxiedAttributionFlags,
int attributionChainId);
- void finishProxyOperation(IBinder clientId, int code,
- in AttributionSourceState attributionSourceState, boolean skipProxyOperation);
-
- // Remaining methods are only used in Java.
+ // Deprecated, use finishProxyOperationWithState instead.
+ void finishProxyOperation(IBinder clientId, int code, in AttributionSource attributionSource,
+ boolean skipProxyOperation);
int checkPackage(int uid, String packageName);
RuntimeAppOpAccessMessage collectRuntimeAppOpAccessMessage();
MessageSamplingConfig reportRuntimeAppOpAccessMessageAndGetConfig(String packageName,
@@ -127,8 +135,19 @@
List<AsyncNotedAppOp> extractAsyncOps(String packageName);
int checkOperationRaw(int code, int uid, String packageName, @nullable String attributionTag);
-
void reloadNonHistoricalState();
void collectNoteOpCallsForValidation(String stackTrace, int op, String packageName, long version);
+
+ SyncNotedAppOp noteProxyOperationWithState(int code,
+ in AttributionSourceState attributionSourceStateState,
+ boolean shouldCollectAsyncNotedOp, String message, boolean shouldCollectMessage,
+ boolean skipProxyOperation);
+ SyncNotedAppOp startProxyOperationWithState(IBinder clientId, int code,
+ in AttributionSourceState attributionSourceStateState, boolean startIfModeDefault,
+ boolean shouldCollectAsyncNotedOp, String message, boolean shouldCollectMessage,
+ boolean skipProxyOperation, int proxyAttributionFlags, int proxiedAttributionFlags,
+ int attributionChainId);
+ void finishProxyOperationWithState(IBinder clientId, int code,
+ in AttributionSourceState attributionSourceStateState, boolean skipProxyOperation);
}
diff --git a/services/core/java/com/android/server/appop/AppOpsService.java b/services/core/java/com/android/server/appop/AppOpsService.java
index 516293b..052b0c2 100644
--- a/services/core/java/com/android/server/appop/AppOpsService.java
+++ b/services/core/java/com/android/server/appop/AppOpsService.java
@@ -2680,8 +2680,17 @@
.filterAppAccess(packageName, callingUid, userId);
}
+ /** @deprecated Use {@link #noteProxyOperationWithState} instead. */
@Override
public SyncNotedAppOp noteProxyOperation(int code,
+ AttributionSource attributionSource, boolean shouldCollectAsyncNotedOp,
+ String message, boolean shouldCollectMessage, boolean skipProxyOperation) {
+ return mCheckOpsDelegateDispatcher.noteProxyOperation(code, attributionSource,
+ shouldCollectAsyncNotedOp, message, shouldCollectMessage, skipProxyOperation);
+ }
+
+ @Override
+ public SyncNotedAppOp noteProxyOperationWithState(int code,
AttributionSourceState attributionSourceState, boolean shouldCollectAsyncNotedOp,
String message, boolean shouldCollectMessage, boolean skipProxyOperation) {
AttributionSource attributionSource = new AttributionSource(attributionSourceState);
@@ -3212,8 +3221,21 @@
attributionChainId);
}
+ /** @deprecated Use {@link #startProxyOperationWithState} instead. */
@Override
public SyncNotedAppOp startProxyOperation(@NonNull IBinder clientId, int code,
+ @NonNull AttributionSource attributionSource, boolean startIfModeDefault,
+ boolean shouldCollectAsyncNotedOp, String message, boolean shouldCollectMessage,
+ boolean skipProxyOperation, @AttributionFlags int proxyAttributionFlags,
+ @AttributionFlags int proxiedAttributionFlags, int attributionChainId) {
+ return mCheckOpsDelegateDispatcher.startProxyOperation(clientId, code, attributionSource,
+ startIfModeDefault, shouldCollectAsyncNotedOp, message, shouldCollectMessage,
+ skipProxyOperation, proxyAttributionFlags, proxiedAttributionFlags,
+ attributionChainId);
+ }
+
+ @Override
+ public SyncNotedAppOp startProxyOperationWithState(@NonNull IBinder clientId, int code,
@NonNull AttributionSourceState attributionSourceState, boolean startIfModeDefault,
boolean shouldCollectAsyncNotedOp, String message, boolean shouldCollectMessage,
boolean skipProxyOperation, @AttributionFlags int proxyAttributionFlags,
@@ -3513,8 +3535,16 @@
finishOperationUnchecked(clientId, code, uid, resolvedPackageName, attributionTag);
}
+ /** @deprecated Use {@link #finishProxyOperationWithState} instead. */
@Override
public void finishProxyOperation(@NonNull IBinder clientId, int code,
+ @NonNull AttributionSource attributionSource, boolean skipProxyOperation) {
+ mCheckOpsDelegateDispatcher.finishProxyOperation(clientId, code, attributionSource,
+ skipProxyOperation);
+ }
+
+ @Override
+ public void finishProxyOperationWithState(@NonNull IBinder clientId, int code,
@NonNull AttributionSourceState attributionSourceState, boolean skipProxyOperation) {
AttributionSource attributionSource = new AttributionSource(attributionSourceState);
mCheckOpsDelegateDispatcher.finishProxyOperation(clientId, code, attributionSource,