locksettings: zero-pad IDs when shown as hex
When printing a 'long' ID as hex, use %016x instead of %x so that the width is always consistent, not shorter 1/16 of the time. This also matches the way the synthetic password state files are named. Bug: 268526331 Change-Id: I999606ff0d6a19641f32c4f4826476b4a839ad59
This commit is contained in:
@@ -2945,7 +2945,7 @@ public class LockSettingsService extends ILockSettings.Stub {
|
||||
synchronized (mSpManager) {
|
||||
disableEscrowTokenOnNonManagedDevicesIfNeeded(userId);
|
||||
for (long handle : mSpManager.getPendingTokensForUser(userId)) {
|
||||
Slog.i(TAG, TextUtils.formatSimple("activateEscrowTokens: %x %d ", handle, userId));
|
||||
Slogf.i(TAG, "activateEscrowTokens: %016x %d", handle, userId);
|
||||
mSpManager.createTokenBasedProtector(handle, sp, userId);
|
||||
}
|
||||
}
|
||||
@@ -3108,14 +3108,15 @@ public class LockSettingsService extends ILockSettings.Stub {
|
||||
pw.println("User " + userId);
|
||||
pw.increaseIndent();
|
||||
synchronized (mSpManager) {
|
||||
pw.println(TextUtils.formatSimple("LSKF-based SP protector ID: %x",
|
||||
pw.println(TextUtils.formatSimple("LSKF-based SP protector ID: %016x",
|
||||
getCurrentLskfBasedProtectorId(userId)));
|
||||
pw.println(TextUtils.formatSimple("LSKF last changed: %s (previous protector: %x)",
|
||||
timestampToString(getLong(LSKF_LAST_CHANGED_TIME_KEY, 0, userId)),
|
||||
getLong(PREV_LSKF_BASED_PROTECTOR_ID_KEY, 0, userId)));
|
||||
pw.println(TextUtils.formatSimple(
|
||||
"LSKF last changed: %s (previous protector: %016x)",
|
||||
timestampToString(getLong(LSKF_LAST_CHANGED_TIME_KEY, 0, userId)),
|
||||
getLong(PREV_LSKF_BASED_PROTECTOR_ID_KEY, 0, userId)));
|
||||
}
|
||||
try {
|
||||
pw.println(TextUtils.formatSimple("SID: %x",
|
||||
pw.println(TextUtils.formatSimple("SID: %016x",
|
||||
getGateKeeperService().getSecureUserId(userId)));
|
||||
} catch (RemoteException e) {
|
||||
// ignore.
|
||||
|
||||
@@ -1654,6 +1654,9 @@ class SyntheticPasswordManager {
|
||||
}
|
||||
|
||||
private String getProtectorKeyAlias(long protectorId) {
|
||||
// Note, this arguably has a bug: %x should be %016x so that the protector ID is left-padded
|
||||
// with zeroes, like how the synthetic password state files are named. It's too late to fix
|
||||
// this, though, and it doesn't actually matter.
|
||||
return TextUtils.formatSimple("%s%x", PROTECTOR_KEY_ALIAS_PREFIX, protectorId);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user