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.os.storage.VolumeInfo;
|
||||||
import android.security.AndroidKeyStoreMaintenance;
|
import android.security.AndroidKeyStoreMaintenance;
|
||||||
import android.system.keystore2.Domain;
|
import android.system.keystore2.Domain;
|
||||||
import android.system.keystore2.KeyDescriptor;
|
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.util.Slog;
|
import android.util.Slog;
|
||||||
@@ -555,26 +554,6 @@ final class AppDataHelper {
|
|||||||
return prepareAppDataFuture;
|
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) {
|
void clearAppDataLIF(AndroidPackage pkg, int userId, int flags) {
|
||||||
if (pkg == null) {
|
if (pkg == null) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -287,9 +287,6 @@ public interface ParsingPackage extends ParsingPackageRead {
|
|||||||
|
|
||||||
ParsingPackage setInstallLocation(int installLocation);
|
ParsingPackage setInstallLocation(int installLocation);
|
||||||
|
|
||||||
/** @see R#styleable.AndroidManifest_inheritKeyStoreKeys */
|
|
||||||
ParsingPackage setInheritKeyStoreKeys(boolean inheritKeyStoreKeys);
|
|
||||||
|
|
||||||
/** @see R#styleable.AndroidManifest_sharedUserMaxSdkVersion */
|
/** @see R#styleable.AndroidManifest_sharedUserMaxSdkVersion */
|
||||||
ParsingPackage setLeavingSharedUid(boolean leavingSharedUid);
|
ParsingPackage setLeavingSharedUid(boolean leavingSharedUid);
|
||||||
|
|
||||||
|
|||||||
@@ -494,7 +494,6 @@ public class ParsingPackageImpl implements ParsingPackage, ParsingPackageHidden,
|
|||||||
ATTRIBUTIONS_ARE_USER_VISIBLE,
|
ATTRIBUTIONS_ARE_USER_VISIBLE,
|
||||||
RESET_ENABLED_SETTINGS_ON_APP_DATA_CLEARED,
|
RESET_ENABLED_SETTINGS_ON_APP_DATA_CLEARED,
|
||||||
SDK_LIBRARY,
|
SDK_LIBRARY,
|
||||||
INHERIT_KEYSTORE_KEYS,
|
|
||||||
})
|
})
|
||||||
public @interface Values {}
|
public @interface Values {}
|
||||||
private static final long EXTERNAL_STORAGE = 1L;
|
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 ATTRIBUTIONS_ARE_USER_VISIBLE = 1L << 47;
|
||||||
private static final long RESET_ENABLED_SETTINGS_ON_APP_DATA_CLEARED = 1L << 48;
|
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 SDK_LIBRARY = 1L << 49;
|
||||||
private static final long INHERIT_KEYSTORE_KEYS = 1L << 50;
|
private static final long ENABLE_ON_BACK_INVOKED_CALLBACK = 1L << 50;
|
||||||
private static final long ENABLE_ON_BACK_INVOKED_CALLBACK = 1L << 51;
|
private static final long LEAVING_SHARED_UID = 1L << 51;
|
||||||
private static final long LEAVING_SHARED_UID = 1L << 52;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private ParsingPackageImpl setBoolean(@Booleans.Values long flag, boolean value) {
|
private ParsingPackageImpl setBoolean(@Booleans.Values long flag, boolean value) {
|
||||||
@@ -2393,11 +2391,6 @@ public class ParsingPackageImpl implements ParsingPackage, ParsingPackageHidden,
|
|||||||
: mKnownActivityEmbeddingCerts;
|
: mKnownActivityEmbeddingCerts;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean shouldInheritKeyStoreKeys() {
|
|
||||||
return getBoolean(Booleans.INHERIT_KEYSTORE_KEYS);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isOnBackInvokedCallbackEnabled() {
|
public boolean isOnBackInvokedCallbackEnabled() {
|
||||||
return getBoolean(Booleans.ENABLE_ON_BACK_INVOKED_CALLBACK);
|
return getBoolean(Booleans.ENABLE_ON_BACK_INVOKED_CALLBACK);
|
||||||
@@ -2551,11 +2544,6 @@ public class ParsingPackageImpl implements ParsingPackage, ParsingPackageHidden,
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public ParsingPackageImpl setInheritKeyStoreKeys(boolean value) {
|
|
||||||
return setBoolean(Booleans.INHERIT_KEYSTORE_KEYS, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ParsingPackageImpl setLeavingSharedUid(boolean value) {
|
public ParsingPackageImpl setLeavingSharedUid(boolean value) {
|
||||||
return setBoolean(Booleans.LEAVING_SHARED_UID, value);
|
return setBoolean(Booleans.LEAVING_SHARED_UID, value);
|
||||||
|
|||||||
@@ -351,11 +351,6 @@ public interface ParsingPackageRead extends PkgWithoutStateAppInfo, PkgWithoutSt
|
|||||||
*/
|
*/
|
||||||
int getLocaleConfigRes();
|
int getLocaleConfigRes();
|
||||||
|
|
||||||
/**
|
|
||||||
* @see R.styleable#AndroidManifest_inheritKeyStoreKeys
|
|
||||||
*/
|
|
||||||
boolean shouldInheritKeyStoreKeys();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see R.styleable.AndroidManifestApplication_enableOnBackInvokedCallback
|
* @see R.styleable.AndroidManifestApplication_enableOnBackInvokedCallback
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -894,9 +894,7 @@ public class ParsingPackageUtils {
|
|||||||
.setTargetSandboxVersion(anInteger(PARSE_DEFAULT_TARGET_SANDBOX,
|
.setTargetSandboxVersion(anInteger(PARSE_DEFAULT_TARGET_SANDBOX,
|
||||||
R.styleable.AndroidManifest_targetSandboxVersion, sa))
|
R.styleable.AndroidManifest_targetSandboxVersion, sa))
|
||||||
/* Set the global "on SD card" flag */
|
/* Set the global "on SD card" flag */
|
||||||
.setExternalStorage((flags & PARSE_EXTERNAL_STORAGE) != 0)
|
.setExternalStorage((flags & PARSE_EXTERNAL_STORAGE) != 0);
|
||||||
.setInheritKeyStoreKeys(bool(false,
|
|
||||||
R.styleable.AndroidManifest_inheritKeyStoreKeys, sa));
|
|
||||||
|
|
||||||
boolean foundApp = false;
|
boolean foundApp = false;
|
||||||
final int depth = parser.getDepth();
|
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")),
|
getter(AndroidPackage::getKnownActivityEmbeddingCerts, setOf("TESTEMBEDDINGCERT")),
|
||||||
getSetByValue(
|
getSetByValue(
|
||||||
AndroidPackage::isOnBackInvokedCallbackEnabled,
|
AndroidPackage::isOnBackInvokedCallbackEnabled,
|
||||||
|
|||||||
Reference in New Issue
Block a user