Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 02cd91b4 authored by Philip P. Moltmann's avatar Philip P. Moltmann
Browse files

Allow null-featureIds in AppOpsService binder calls

Test: atest CtsAppOpsTestCases
Bug: 136595429
Change-Id: Ib47b8dd0c665314c4b3547895bda29de98a2258a
parent 2b041061
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -31,19 +31,19 @@ interface IAppOpsService {
    // be kept in sync with frameworks/native/libs/binder/include/binder/IAppOpsService.h
    // and not be reordered
    int checkOperation(int code, int uid, String packageName);
    int noteOperation(int code, int uid, String packageName, String featureId);
    int startOperation(IBinder token, int code, int uid, String packageName, String featureId,
            boolean startIfModeDefault);
    int noteOperation(int code, int uid, String packageName, @nullable String featureId);
    int startOperation(IBinder token, int code, int uid, String packageName,
            @nullable String featureId, boolean startIfModeDefault);
    @UnsupportedAppUsage
    void finishOperation(IBinder token, int code, int uid, String packageName,
            String featureId);
            @nullable String featureId);
    void startWatchingMode(int op, String packageName, IAppOpsCallback callback);
    void stopWatchingMode(IAppOpsCallback callback);
    IBinder getToken(IBinder clientToken);
    int permissionToOpCode(String permission);
    int checkAudioOperation(int code, int usage, int uid, String packageName);
    void noteAsyncOp(String callingPackageName, int uid, String packageName, int opCode,
            String featureId, String message);
    void noteAsyncOp(@nullable String callingPackageName, int uid, @nullable String packageName,
            int opCode, @nullable String featureId, String message);
    boolean shouldCollectNotes(int opCode);
    void setCameraAudioRestriction(int mode);
    // End of methods also called by native code.
+7 −8
Original line number Diff line number Diff line
@@ -47,8 +47,8 @@ import android.app.AppOpsManager;
import android.app.AppOpsManager.HistoricalOps;
import android.app.AppOpsManager.HistoricalOpsRequest;
import android.app.AppOpsManager.Mode;
import android.app.AppOpsManager.OpFeatureEntry;
import android.app.AppOpsManager.OpEntry;
import android.app.AppOpsManager.OpFeatureEntry;
import android.app.AppOpsManager.OpFlags;
import android.app.AppOpsManagerInternal;
import android.app.AppOpsManagerInternal.CheckOpsDelegate;
@@ -119,6 +119,12 @@ import com.android.internal.util.function.pooled.PooledLambda;
import com.android.server.LocalServices;
import com.android.server.LockGuard;

import libcore.util.EmptyArray;

import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
import org.xmlpull.v1.XmlSerializer;

import java.io.File;
import java.io.FileDescriptor;
import java.io.FileInputStream;
@@ -138,12 +144,6 @@ import java.util.List;
import java.util.Map;
import java.util.Objects;

import libcore.util.EmptyArray;

import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
import org.xmlpull.v1.XmlSerializer;

public class AppOpsService extends IAppOpsService.Stub {
    static final String TAG = "AppOps";
    static final boolean DEBUG = false;
@@ -2356,7 +2356,6 @@ public class AppOpsService extends IAppOpsService.Stub {
    public void noteAsyncOp(String callingPackageName, int uid, String packageName, int opCode,
            String featureId, String message) {
        Preconditions.checkNotNull(message);
        Preconditions.checkNotNull(packageName);
        verifyAndGetIsPrivileged(uid, packageName);

        verifyIncomingUid(uid);