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

Commit 73e2690e authored by Philip P. Moltmann's avatar Philip P. Moltmann Committed by Hai Zhang
Browse files

DO NOT MERGE Remove unnecessary internal APIs.

Test: Built
Bug: 146463528
Bug: 146590200
Bug: 147649036
Change-Id: I5391ac4989d7d5712982f5608f9fc28cf7935b00
parent 0bba8d5f
Loading
Loading
Loading
Loading
+0 −29
Original line number Diff line number Diff line
@@ -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.
     *
     * <p>Similar as {@link AppOpsManager#setUidMode} but does not require the package manager to be
     * working. Hence this can be used very early during boot.
     *
     * <p>Only for internal callers. Does <u>not</u> 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.
     *
     * <p>Does <u>not</u> 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);
}
+2 −29
Original line number Diff line number Diff line
@@ -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);
        }
    }
}