Stop checking FDE password cache am: f33dbe0540 am: 5576b11597
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2016256 Change-Id: I0b596cfd20e6442084c89b1a728397b031f941cf
This commit is contained in:
@@ -51,7 +51,6 @@ interface ILockSettings {
|
||||
VerifyCredentialResponse verifyTiedProfileChallenge(in LockscreenCredential credential, int userId, int flags);
|
||||
VerifyCredentialResponse verifyGatekeeperPasswordHandle(long gatekeeperPasswordHandle, long challenge, int userId);
|
||||
void removeGatekeeperPasswordHandle(long gatekeeperPasswordHandle);
|
||||
boolean checkVoldPassword(int userId);
|
||||
int getCredentialType(int userId);
|
||||
byte[] getHashFactor(in LockscreenCredential currentCredential, int userId);
|
||||
void setSeparateProfileChallengeEnabled(int userId, boolean enabled, in LockscreenCredential managedUserPassword);
|
||||
|
||||
@@ -504,20 +504,6 @@ public class LockPatternUtils {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check to see if vold already has the password.
|
||||
* Note that this also clears vold's copy of the password.
|
||||
* @return Whether the vold password matches or not.
|
||||
*/
|
||||
public boolean checkVoldPassword(int userId) {
|
||||
try {
|
||||
return getLockSettings().checkVoldPassword(userId);
|
||||
} catch (RemoteException re) {
|
||||
Log.e(TAG, "failed to check vold password", re);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the password history hash factor, needed to check new password against password
|
||||
* history with {@link #checkPasswordHistory(byte[], byte[], int)}
|
||||
|
||||
@@ -1577,14 +1577,6 @@ public class KeyguardViewMediator extends SystemUI implements Dumpable,
|
||||
if (DEBUG) Log.d(TAG, "doKeyguard: not showing because lockscreen is off");
|
||||
return;
|
||||
}
|
||||
|
||||
if (mLockPatternUtils.checkVoldPassword(KeyguardUpdateMonitor.getCurrentUser())) {
|
||||
if (DEBUG) Log.d(TAG, "Not showing lock screen since just decrypted");
|
||||
// Without this, settings is not enabled until the lock screen first appears
|
||||
setShowingLocked(false);
|
||||
hideLocked();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (DEBUG) Log.d(TAG, "doKeyguard: showing the lock screen");
|
||||
|
||||
@@ -237,8 +237,6 @@ public class LockSettingsService extends ILockSettings.Stub {
|
||||
|
||||
private final RebootEscrowManager mRebootEscrowManager;
|
||||
|
||||
private boolean mFirstCallToVold;
|
||||
|
||||
// Current password metric for all users on the device. Updated when user unlocks
|
||||
// the device or changes password. Removed when user is stopped.
|
||||
@GuardedBy("this")
|
||||
@@ -573,8 +571,6 @@ public class LockSettingsService extends ILockSettings.Stub {
|
||||
mStrongAuth = injector.getStrongAuth();
|
||||
mActivityManager = injector.getActivityManager();
|
||||
|
||||
mFirstCallToVold = true;
|
||||
|
||||
IntentFilter filter = new IntentFilter();
|
||||
filter.addAction(Intent.ACTION_USER_ADDED);
|
||||
filter.addAction(Intent.ACTION_USER_STARTING);
|
||||
@@ -2367,77 +2363,6 @@ public class LockSettingsService extends ILockSettings.Stub {
|
||||
});
|
||||
}
|
||||
|
||||
private LockscreenCredential createPattern(String patternString) {
|
||||
final byte[] patternBytes = patternString.getBytes();
|
||||
LockscreenCredential pattern = LockscreenCredential.createPattern(
|
||||
LockPatternUtils.byteArrayToPattern(patternBytes));
|
||||
Arrays.fill(patternBytes, (byte) 0);
|
||||
return pattern;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkVoldPassword(int userId) {
|
||||
if (!mFirstCallToVold) {
|
||||
return false;
|
||||
}
|
||||
mFirstCallToVold = false;
|
||||
|
||||
checkPasswordReadPermission();
|
||||
|
||||
// There's no guarantee that this will safely connect, but if it fails
|
||||
// we will simply show the lock screen when we shouldn't, so relatively
|
||||
// benign. There is an outside chance something nasty would happen if
|
||||
// this service restarted before vold stales out the password in this
|
||||
// case. The nastiness is limited to not showing the lock screen when
|
||||
// we should, within the first minute of decrypting the phone if this
|
||||
// service can't connect to vold, it restarts, and then the new instance
|
||||
// does successfully connect.
|
||||
final IStorageManager service = mInjector.getStorageManager();
|
||||
// TODO(b/120484642): Update vold to return a password as a byte array
|
||||
String password;
|
||||
final long identity = Binder.clearCallingIdentity();
|
||||
try {
|
||||
password = service.getPassword();
|
||||
service.clearPassword();
|
||||
} catch (RemoteException e) {
|
||||
Slog.w(TAG, "vold getPassword() failed", e);
|
||||
return false;
|
||||
} finally {
|
||||
Binder.restoreCallingIdentity(identity);
|
||||
}
|
||||
if (TextUtils.isEmpty(password)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
try {
|
||||
final LockscreenCredential credential;
|
||||
switch (getCredentialTypeInternal(userId)) {
|
||||
case CREDENTIAL_TYPE_PATTERN:
|
||||
credential = createPattern(password);
|
||||
break;
|
||||
case CREDENTIAL_TYPE_PIN:
|
||||
credential = LockscreenCredential.createPin(password);
|
||||
break;
|
||||
case CREDENTIAL_TYPE_PASSWORD:
|
||||
credential = LockscreenCredential.createPassword(password);
|
||||
break;
|
||||
default:
|
||||
credential = null;
|
||||
Slog.e(TAG, "Unknown credential type");
|
||||
}
|
||||
|
||||
if (credential != null
|
||||
&& checkCredential(credential, userId, null /* progressCallback */)
|
||||
.getResponseCode() == GateKeeperResponse.RESPONSE_OK) {
|
||||
return true;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Slog.e(TAG, "checkVoldPassword failed: ", e);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private void removeUser(int userId, boolean unknownUser) {
|
||||
Slog.i(TAG, "RemoveUser: " + userId);
|
||||
removeBiometricsForUser(userId);
|
||||
|
||||
Reference in New Issue
Block a user