From 73e2690eded5d035de8560aaff60a6f47290305d Mon Sep 17 00:00:00 2001 From: "Philip P. Moltmann" Date: Tue, 7 May 2019 08:57:35 -0700 Subject: [PATCH] DO NOT MERGE Remove unnecessary internal APIs. Test: Built Bug: 146463528 Bug: 146590200 Bug: 147649036 Change-Id: I5391ac4989d7d5712982f5608f9fc28cf7935b00 --- .../android/app/AppOpsManagerInternal.java | 29 ----------------- .../android/server/appop/AppOpsService.java | 31 ++----------------- 2 files changed, 2 insertions(+), 58 deletions(-) diff --git a/core/java/android/app/AppOpsManagerInternal.java b/core/java/android/app/AppOpsManagerInternal.java index 08cad04401e9c..996939eb9ee13 100644 --- a/core/java/android/app/AppOpsManagerInternal.java +++ b/core/java/android/app/AppOpsManagerInternal.java @@ -16,7 +16,6 @@ package android.app; -import android.annotation.NonNull; import android.util.SparseIntArray; import com.android.internal.util.function.QuadFunction; @@ -76,20 +75,6 @@ public abstract class AppOpsManagerInternal { */ public abstract void setDeviceAndProfileOwners(SparseIntArray owners); - /** - * Sets the app-ops mode for a certain app-op and uid. - * - *

Similar as {@link AppOpsManager#setUidMode} but does not require the package manager to be - * working. Hence this can be used very early during boot. - * - *

Only for internal callers. Does not verify that package name belongs to uid. - * - * @param code The op code to set. - * @param uid The UID for which to set. - * @param mode The new mode to set. - */ - public abstract void setUidMode(int code, int uid, int mode); - /** * Set all {@link #setMode (package) modes} for this uid to the default value. * @@ -97,18 +82,4 @@ public abstract class AppOpsManagerInternal { * @param uid The uid */ public abstract void setAllPkgModesToDefault(int code, int uid); - - /** - * Get the (raw) mode of an app-op. - * - *

Does not verify that package belongs to uid. The caller needs to do that. - * - * @param code The code of the op - * @param uid The uid of the package the op belongs to - * @param packageName The package the op belongs to - * - * @return The mode of the op - */ - public abstract @AppOpsManager.Mode int checkOperationUnchecked(int code, int uid, - @NonNull String packageName); } diff --git a/services/core/java/com/android/server/appop/AppOpsService.java b/services/core/java/com/android/server/appop/AppOpsService.java index 2949099e305ec..1760371597f10 100644 --- a/services/core/java/com/android/server/appop/AppOpsService.java +++ b/services/core/java/com/android/server/appop/AppOpsService.java @@ -1793,14 +1793,6 @@ public class AppOpsService extends IAppOpsService.Stub { return checkOperationUnchecked(code, uid, resolvedPackageName, raw); } - /** - * @see #checkOperationUnchecked(int, int, String, boolean, boolean) - */ - private @Mode int checkOperationUnchecked(int code, int uid, @NonNull String packageName, - boolean raw) { - return checkOperationUnchecked(code, uid, packageName, raw, true); - } - /** * Get the mode of an app-op. * @@ -1808,25 +1800,16 @@ public class AppOpsService extends IAppOpsService.Stub { * @param uid The uid of the package the op belongs to * @param packageName The package the op belongs to * @param raw If the raw state of eval-ed state should be checked. - * @param verify If the code should check the package belongs to the uid * * @return The mode of the op */ private @Mode int checkOperationUnchecked(int code, int uid, @NonNull String packageName, - boolean raw, boolean verify) { + boolean raw) { if (isOpRestrictedDueToSuspend(code, packageName, uid)) { return AppOpsManager.MODE_IGNORED; } - boolean isPrivileged; - try { - isPrivileged = verifyAndGetIsPrivileged(uid, packageName); - } catch (Exception e) { - if (verify) { - throw e; - } - return AppOpsManager.MODE_IGNORED; - } + boolean isPrivileged = verifyAndGetIsPrivileged(uid, packageName); synchronized (this) { if (isOpRestrictedLocked(uid, code, packageName, isPrivileged)) { @@ -4692,19 +4675,9 @@ public class AppOpsService extends IAppOpsService.Stub { } } - @Override - public void setUidMode(int code, int uid, int mode) { - AppOpsService.this.setUidMode(code, uid, mode); - } - @Override public void setAllPkgModesToDefault(int code, int uid) { AppOpsService.this.setAllPkgModesToDefault(code, uid); } - - @Override - public @Mode int checkOperationUnchecked(int code, int uid, @NonNull String packageName) { - return AppOpsService.this.checkOperationUnchecked(code, uid, packageName, true, false); - } } }