Skip to content

Commit 73e2690

Browse files
moltmannzhanghai
authored andcommitted
DO NOT MERGE Remove unnecessary internal APIs.
Test: Built Bug: 146463528 Bug: 146590200 Bug: 147649036 Change-Id: I5391ac4989d7d5712982f5608f9fc28cf7935b00
1 parent 0bba8d5 commit 73e2690

2 files changed

Lines changed: 2 additions & 58 deletions

File tree

core/java/android/app/AppOpsManagerInternal.java

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616

1717
package android.app;
1818

19-
import android.annotation.NonNull;
2019
import android.util.SparseIntArray;
2120

2221
import com.android.internal.util.function.QuadFunction;
@@ -76,39 +75,11 @@ int noteOperation(int code, int uid, String packageName,
7675
*/
7776
public abstract void setDeviceAndProfileOwners(SparseIntArray owners);
7877

79-
/**
80-
* Sets the app-ops mode for a certain app-op and uid.
81-
*
82-
* <p>Similar as {@link AppOpsManager#setUidMode} but does not require the package manager to be
83-
* working. Hence this can be used very early during boot.
84-
*
85-
* <p>Only for internal callers. Does <u>not</u> verify that package name belongs to uid.
86-
*
87-
* @param code The op code to set.
88-
* @param uid The UID for which to set.
89-
* @param mode The new mode to set.
90-
*/
91-
public abstract void setUidMode(int code, int uid, int mode);
92-
9378
/**
9479
* Set all {@link #setMode (package) modes} for this uid to the default value.
9580
*
9681
* @param code The app-op
9782
* @param uid The uid
9883
*/
9984
public abstract void setAllPkgModesToDefault(int code, int uid);
100-
101-
/**
102-
* Get the (raw) mode of an app-op.
103-
*
104-
* <p>Does <u>not</u> verify that package belongs to uid. The caller needs to do that.
105-
*
106-
* @param code The code of the op
107-
* @param uid The uid of the package the op belongs to
108-
* @param packageName The package the op belongs to
109-
*
110-
* @return The mode of the op
111-
*/
112-
public abstract @AppOpsManager.Mode int checkOperationUnchecked(int code, int uid,
113-
@NonNull String packageName);
11485
}

services/core/java/com/android/server/appop/AppOpsService.java

Lines changed: 2 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1793,40 +1793,23 @@ private int checkOperationImpl(int code, int uid, String packageName,
17931793
return checkOperationUnchecked(code, uid, resolvedPackageName, raw);
17941794
}
17951795

1796-
/**
1797-
* @see #checkOperationUnchecked(int, int, String, boolean, boolean)
1798-
*/
1799-
private @Mode int checkOperationUnchecked(int code, int uid, @NonNull String packageName,
1800-
boolean raw) {
1801-
return checkOperationUnchecked(code, uid, packageName, raw, true);
1802-
}
1803-
18041796
/**
18051797
* Get the mode of an app-op.
18061798
*
18071799
* @param code The code of the op
18081800
* @param uid The uid of the package the op belongs to
18091801
* @param packageName The package the op belongs to
18101802
* @param raw If the raw state of eval-ed state should be checked.
1811-
* @param verify If the code should check the package belongs to the uid
18121803
*
18131804
* @return The mode of the op
18141805
*/
18151806
private @Mode int checkOperationUnchecked(int code, int uid, @NonNull String packageName,
1816-
boolean raw, boolean verify) {
1807+
boolean raw) {
18171808
if (isOpRestrictedDueToSuspend(code, packageName, uid)) {
18181809
return AppOpsManager.MODE_IGNORED;
18191810
}
18201811

1821-
boolean isPrivileged;
1822-
try {
1823-
isPrivileged = verifyAndGetIsPrivileged(uid, packageName);
1824-
} catch (Exception e) {
1825-
if (verify) {
1826-
throw e;
1827-
}
1828-
return AppOpsManager.MODE_IGNORED;
1829-
}
1812+
boolean isPrivileged = verifyAndGetIsPrivileged(uid, packageName);
18301813

18311814
synchronized (this) {
18321815
if (isOpRestrictedLocked(uid, code, packageName, isPrivileged)) {
@@ -4692,19 +4675,9 @@ private final class AppOpsManagerInternalImpl extends AppOpsManagerInternal {
46924675
}
46934676
}
46944677

4695-
@Override
4696-
public void setUidMode(int code, int uid, int mode) {
4697-
AppOpsService.this.setUidMode(code, uid, mode);
4698-
}
4699-
47004678
@Override
47014679
public void setAllPkgModesToDefault(int code, int uid) {
47024680
AppOpsService.this.setAllPkgModesToDefault(code, uid);
47034681
}
4704-
4705-
@Override
4706-
public @Mode int checkOperationUnchecked(int code, int uid, @NonNull String packageName) {
4707-
return AppOpsService.this.checkOperationUnchecked(code, uid, packageName, true, false);
4708-
}
47094682
}
47104683
}

0 commit comments

Comments
 (0)