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

Commit a23b25cd authored by Hai Zhang's avatar Hai Zhang
Browse files

Remove obsolete is/setPermissionEnforced().

isPermissionEnforced() always returns true and is only exposed on AIDL
and there is actually no API, so it is directly removed.
setPermissionEnforced() currently doesn't affect anything so its
remaining implementation is removed as well, and we consider all
permissions enforced when needed for compatibility of dumping.

Bug: 158736025
Test: presubmit
Change-Id: I0584553ac0171147b6f131b5359ddb2964113a1d
parent 93e38c95
Loading
Loading
Loading
Loading
+0 −4
Original line number Diff line number Diff line
@@ -87,10 +87,6 @@ interface IPermissionManager {

    void revokeDefaultPermissionsFromLuiApps(in String[] packageNames, int userId);

    void setPermissionEnforced(String permName, boolean enforced);

    boolean isPermissionEnforced(String permName);

    boolean shouldShowRequestPermissionRationale(String permName,
            String packageName, int userId);

+0 −3
Original line number Diff line number Diff line
@@ -949,9 +949,6 @@ public abstract class PackageManagerInternal {
    /** Returns whether or not permissions need to be upgraded for the given user */
    public abstract boolean isPermissionUpgradeNeeded(@UserIdInt int userId);

    /** Sets the enforcement of reading external storage */
    public abstract void setReadExternalStorageEnforced(boolean enforced);

    /**
     * Allows the integrity component to respond to the
     * {@link Intent#ACTION_PACKAGE_NEEDS_INTEGRITY_VERIFICATION package verification
+0 −12
Original line number Diff line number Diff line
@@ -25884,18 +25884,6 @@ public class PackageManagerService extends IPackageManager.Stub
            }
        }
        @Override
        public void setReadExternalStorageEnforced(boolean enforced) {
            synchronized (mLock) {
                if (mSettings.mReadExternalStorageEnforced != null
                        && mSettings.mReadExternalStorageEnforced == enforced) {
                    return;
                }
                mSettings.mReadExternalStorageEnforced = enforced ? Boolean.TRUE : Boolean.FALSE;
                writeSettingsLPrTEMP();
            }
        }
        @Override
        public void setIntegrityVerificationResult(int verificationId, int verificationResult) {
            final Message msg = mHandler.obtainMessage(INTEGRITY_VERIFICATION_COMPLETE);
+1 −1
Original line number Diff line number Diff line
@@ -2324,7 +2324,7 @@ class PackageManagerShellCommand extends ShellCommand {
            getErrPrintWriter().println("Error: no enforcement specified");
            return 1;
        }
        mPermissionManager.setPermissionEnforced(permission, Boolean.parseBoolean(enforcedRaw));
        // Permissions are always enforced now.
        return 0;
    }

+2 −14
Original line number Diff line number Diff line
@@ -362,8 +362,6 @@ public final class Settings {
        }
    }

    Boolean mReadExternalStorageEnforced;

    /** Device identity for the purpose of package verification. */
    private VerifierDeviceIdentity mVerifierDeviceIdentity;

@@ -2342,13 +2340,6 @@ public final class Settings {
                serializer.endTag(null, "verifier");
            }

            if (mReadExternalStorageEnforced != null) {
                serializer.startTag(null, TAG_READ_EXTERNAL_STORAGE);
                serializer.attribute(
                        null, ATTR_ENFORCEMENT, mReadExternalStorageEnforced ? "1" : "0");
                serializer.endTag(null, TAG_READ_EXTERNAL_STORAGE);
            }

            serializer.startTag(null, "permission-trees");
            mPermissions.writePermissionTrees(serializer);
            serializer.endTag(null, "permission-trees");
@@ -2959,9 +2950,7 @@ public final class Settings {
                                + e.getMessage());
                    }
                } else if (TAG_READ_EXTERNAL_STORAGE.equals(tagName)) {
                    final String enforcement = parser.getAttributeValue(null, ATTR_ENFORCEMENT);
                    mReadExternalStorageEnforced =
                            "1".equals(enforcement) ? Boolean.TRUE : Boolean.FALSE;
                    // No longer used.
                } else if (tagName.equals("keyset-settings")) {
                    mKeySetManagerService.readKeySetsLPw(parser, mKeySetRefs);
                } else if (TAG_VERSION.equals(tagName)) {
@@ -4900,8 +4889,7 @@ public final class Settings {
            DumpState dumpState) {
        LegacyPermissionSettings.dumpPermissions(pw, packageName, permissionNames,
                mPermissionDataProvider.getLegacyPermissions(),
                mPermissionDataProvider.getAllAppOpPermissionPackages(),
                (mReadExternalStorageEnforced == Boolean.TRUE), dumpState);
                mPermissionDataProvider.getAllAppOpPermissionPackages(), true, dumpState);
    }

    void dumpSharedUsersLPr(PrintWriter pw, String packageName, ArraySet<String> permissionNames,
Loading