Merge "Remove AndroidKeystore key migration code in framework" into tm-dev am: 0e0c3e4342
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/17059764 Change-Id: Ieda26a7912ae665ece4b9c788ab0d7ce08f526ef
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -351,11 +351,6 @@ public interface ParsingPackageRead extends PkgWithoutStateAppInfo, PkgWithoutSt
|
||||
*/
|
||||
int getLocaleConfigRes();
|
||||
|
||||
/**
|
||||
* @see R.styleable#AndroidManifest_inheritKeyStoreKeys
|
||||
*/
|
||||
boolean shouldInheritKeyStoreKeys();
|
||||
|
||||
/**
|
||||
* @see R.styleable.AndroidManifestApplication_enableOnBackInvokedCallback
|
||||
*/
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -505,11 +505,6 @@ class AndroidPackageTest : ParcelableComponentTest(AndroidPackage::class, Packag
|
||||
)
|
||||
}
|
||||
),
|
||||
getSetByValue(
|
||||
AndroidPackage::shouldInheritKeyStoreKeys,
|
||||
ParsingPackage::setInheritKeyStoreKeys,
|
||||
true
|
||||
),
|
||||
getter(AndroidPackage::getKnownActivityEmbeddingCerts, setOf("TESTEMBEDDINGCERT")),
|
||||
getSetByValue(
|
||||
AndroidPackage::isOnBackInvokedCallbackEnabled,
|
||||
|
||||
Reference in New Issue
Block a user