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

Commit 0e0c3e43 authored by John Wu's avatar John Wu Committed by Android (Google) Code Review
Browse files

Merge "Remove AndroidKeystore key migration code in framework" into tm-dev

parents 082a9224 1b81d4d2
Loading
Loading
Loading
Loading
+0 −21
Original line number Diff line number Diff line
@@ -36,7 +36,6 @@ import android.os.storage.StorageManagerInternal;
import android.os.storage.VolumeInfo;
import android.security.AndroidKeyStoreMaintenance;
import android.system.keystore2.Domain;
import android.system.keystore2.KeyDescriptor;
import android.text.TextUtils;
import android.util.Log;
import android.util.Slog;
@@ -555,26 +554,6 @@ final class AppDataHelper {
        return prepareAppDataFuture;
    }

    public void migrateKeyStoreData(int previousAppId, int appId) {
        // If previous UID is system UID, declaring inheritKeyStoreKeys is not supported.
        // Silently ignore the request to migrate keys.
        if (previousAppId == Process.SYSTEM_UID) return;

        for (int userId : mPm.resolveUserIds(UserHandle.USER_ALL)) {
            int srcUid = UserHandle.getUid(userId, previousAppId);
            int destUid = UserHandle.getUid(userId, appId);
            final KeyDescriptor[] keys = AndroidKeyStoreMaintenance.listEntries(Domain.APP, srcUid);
            if (keys == null) continue;
            for (final KeyDescriptor key : keys) {
                KeyDescriptor dest = new KeyDescriptor();
                dest.domain = Domain.APP;
                dest.nspace = destUid;
                dest.alias = key.alias;
                AndroidKeyStoreMaintenance.migrateKeyNamespace(key, dest);
            }
        }
    }

    void clearAppDataLIF(AndroidPackage pkg, int userId, int flags) {
        if (pkg == null) {
            return;
+0 −3
Original line number Diff line number Diff line
@@ -287,9 +287,6 @@ public interface ParsingPackage extends ParsingPackageRead {

    ParsingPackage setInstallLocation(int installLocation);

    /** @see R#styleable.AndroidManifest_inheritKeyStoreKeys */
    ParsingPackage setInheritKeyStoreKeys(boolean inheritKeyStoreKeys);

    /** @see R#styleable.AndroidManifest_sharedUserMaxSdkVersion */
    ParsingPackage setLeavingSharedUid(boolean leavingSharedUid);

+2 −14
Original line number Diff line number Diff line
@@ -494,7 +494,6 @@ public class ParsingPackageImpl implements ParsingPackage, ParsingPackageHidden,
                ATTRIBUTIONS_ARE_USER_VISIBLE,
                RESET_ENABLED_SETTINGS_ON_APP_DATA_CLEARED,
                SDK_LIBRARY,
                INHERIT_KEYSTORE_KEYS,
        })
        public @interface Values {}
        private static final long EXTERNAL_STORAGE = 1L;
@@ -547,9 +546,8 @@ public class ParsingPackageImpl implements ParsingPackage, ParsingPackageHidden,
        private static final long ATTRIBUTIONS_ARE_USER_VISIBLE = 1L << 47;
        private static final long RESET_ENABLED_SETTINGS_ON_APP_DATA_CLEARED = 1L << 48;
        private static final long SDK_LIBRARY = 1L << 49;
        private static final long INHERIT_KEYSTORE_KEYS = 1L << 50;
        private static final long ENABLE_ON_BACK_INVOKED_CALLBACK = 1L << 51;
        private static final long LEAVING_SHARED_UID = 1L << 52;
        private static final long ENABLE_ON_BACK_INVOKED_CALLBACK = 1L << 50;
        private static final long LEAVING_SHARED_UID = 1L << 51;
    }

    private ParsingPackageImpl setBoolean(@Booleans.Values long flag, boolean value) {
@@ -2393,11 +2391,6 @@ public class ParsingPackageImpl implements ParsingPackage, ParsingPackageHidden,
                : mKnownActivityEmbeddingCerts;
    }

    @Override
    public boolean shouldInheritKeyStoreKeys() {
        return getBoolean(Booleans.INHERIT_KEYSTORE_KEYS);
    }

    @Override
    public boolean isOnBackInvokedCallbackEnabled() {
        return getBoolean(Booleans.ENABLE_ON_BACK_INVOKED_CALLBACK);
@@ -2551,11 +2544,6 @@ public class ParsingPackageImpl implements ParsingPackage, ParsingPackageHidden,
        return this;
    }

    @Override
    public ParsingPackageImpl setInheritKeyStoreKeys(boolean value) {
        return setBoolean(Booleans.INHERIT_KEYSTORE_KEYS, value);
    }

    @Override
    public ParsingPackageImpl setLeavingSharedUid(boolean value) {
        return setBoolean(Booleans.LEAVING_SHARED_UID, value);
+0 −5
Original line number Diff line number Diff line
@@ -351,11 +351,6 @@ public interface ParsingPackageRead extends PkgWithoutStateAppInfo, PkgWithoutSt
     */
    int getLocaleConfigRes();

    /**
     * @see R.styleable#AndroidManifest_inheritKeyStoreKeys
     */
    boolean shouldInheritKeyStoreKeys();

    /**
     * @see R.styleable.AndroidManifestApplication_enableOnBackInvokedCallback
     */
+1 −3
Original line number Diff line number Diff line
@@ -894,9 +894,7 @@ public class ParsingPackageUtils {
                .setTargetSandboxVersion(anInteger(PARSE_DEFAULT_TARGET_SANDBOX,
                        R.styleable.AndroidManifest_targetSandboxVersion, sa))
                /* Set the global "on SD card" flag */
                .setExternalStorage((flags & PARSE_EXTERNAL_STORAGE) != 0)
                .setInheritKeyStoreKeys(bool(false,
                        R.styleable.AndroidManifest_inheritKeyStoreKeys, sa));
                .setExternalStorage((flags & PARSE_EXTERNAL_STORAGE) != 0);

        boolean foundApp = false;
        final int depth = parser.getDepth();
Loading