UserCredentialsSettings: remove unneeded checks for locksettings keys
Since Android 12 (frameworks/base change Iac339e64812232875afa9dc6109b848b50b0ef2f), the locksettings keys are in their own key namespace. Therefore, they are no longer included when UserCredentialsSettings enumerates the keys in the app namespace, so there is no longer any need to explicitly ignore these keys. This is a cleanup that is a prerequisite for a cleanup in locksettings where LockPatternUtils.SYNTHETIC_PASSWORD_KEY_PREFIX will be renamed and have its visibility reduced. No change in behavior intended. Test: Added temporary logging of all key aliases enumerated by keyStore.aliases() in getCredentialsForUid(). Set an LSKF, and went to the User Credentials page in the Settings app. Verified via logcat that the locksettings keys aren't being enumerated. Change-Id: If9040b55a5743c9b0e174538f67c669e864f0312
This commit is contained in:
@@ -48,7 +48,6 @@ import androidx.fragment.app.DialogFragment;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.android.internal.widget.LockPatternUtils;
|
||||
import com.android.settings.core.instrumentation.InstrumentedDialogFragment;
|
||||
import com.android.settingslib.RestrictedLockUtils;
|
||||
import com.android.settingslib.RestrictedLockUtils.EnforcedAdmin;
|
||||
@@ -297,7 +296,6 @@ public class UserCredentialsSettings extends SettingsPreferenceFragment
|
||||
private SortedMap<String, Credential> getCredentialsForUid(KeyStore keyStore, int uid) {
|
||||
try {
|
||||
final SortedMap<String, Credential> aliasMap = new TreeMap<>();
|
||||
boolean isSystem = UserHandle.getAppId(uid) == Process.SYSTEM_UID;
|
||||
Enumeration<String> aliases = keyStore.aliases();
|
||||
while (aliases.hasMoreElements()) {
|
||||
String alias = aliases.nextElement();
|
||||
@@ -315,19 +313,6 @@ public class UserCredentialsSettings extends SettingsPreferenceFragment
|
||||
// We don't display any symmetric key entries.
|
||||
continue;
|
||||
}
|
||||
if (isSystem) {
|
||||
// Do not show work profile keys in user credentials
|
||||
if (alias.startsWith(LockPatternUtils.PROFILE_KEY_NAME_ENCRYPT) ||
|
||||
alias.startsWith(LockPatternUtils.PROFILE_KEY_NAME_DECRYPT)) {
|
||||
continue;
|
||||
}
|
||||
// Do not show synthetic password keys in user credential
|
||||
// We should never reach this point because the synthetic password key
|
||||
// is symmetric.
|
||||
if (alias.startsWith(LockPatternUtils.SYNTHETIC_PASSWORD_KEY_PREFIX)) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
// At this point we have determined that we have an asymmetric key.
|
||||
// so we have at least a USER_KEY and USER_CERTIFICATE.
|
||||
c.storedTypes.add(Credential.Type.USER_KEY);
|
||||
|
Reference in New Issue
Block a user