Loading cmds/statsd/src/atoms.proto +38 −0 Original line number Diff line number Diff line Loading @@ -122,6 +122,8 @@ message Atom { WTFOccurred wtf_occurred = 80; LowMemReported low_mem_reported = 81; ThermalThrottlingStateChanged thermal_throttling = 86; // 86 - 165 are not available BluetoothClassicPairingEventReported bluetooth_classic_pairing_event_reported = 166; } // Pulled events will start at field 10000. Loading Loading @@ -1026,6 +1028,42 @@ message BluetoothConnectionStateChanged { optional int32 bt_profile = 3; } /** * Logs there is an event related Bluetooth classic pairing * * Logged from: * system/bt */ message BluetoothClassicPairingEventReported { // An identifier that can be used to match events for this device. // Currently, this is a salted hash of the MAC address of this Bluetooth device. // Salt: Randomly generated 256 bit value // Hash algorithm: HMAC-SHA256 // Size: 32 byte // Default: null or empty if the device identifier is not known // Note: string is here for backward compatibility purpose only optional string obfuscated_id = 1; // Connection handle of this connection if available // Range: 0x0000 - 0x0EFF (12 bits) // Default: 0xFFFF if the handle is unknown optional int32 connection_handle = 2; // HCI command associated with this event // Default: CMD_UNKNOWN optional int32 hci_cmd = 3; // HCI event associated with this event // Default: EVT_UNKNOWN optional int32 hci_event = 4; // HCI command status code if this is triggered by hci_cmd // Default: STATUS_UNKNOWN optional int32 cmd_status = 5; // HCI reason code associated with this event // Default: STATUS_UNKNOWN optional int32 reason_code = 6; // A status value related to this specific event // Default: 0 optional int64 event_value = 7; } /** * Logs when something is plugged into or removed from the USB-C connector. * Loading core/java/android/app/admin/PasswordMetrics.java +14 −11 Original line number Diff line number Diff line Loading @@ -107,7 +107,10 @@ public class PasswordMetrics implements Parcelable { } }; public static PasswordMetrics computeForPassword(@NonNull String password) { /** * Returns the {@code PasswordMetrics} for a given password */ public static PasswordMetrics computeForPassword(@NonNull byte[] password) { // Analyse the characters used int letters = 0; int upperCase = 0; Loading @@ -115,9 +118,9 @@ public class PasswordMetrics implements Parcelable { int numeric = 0; int symbols = 0; int nonLetter = 0; final int length = password.length(); final int length = password.length; for (int i = 0; i < length; i++) { switch (categoryChar(password.charAt(i))) { switch (categoryChar((char) password[i])) { case CHAR_LOWER_CASE: letters++; lowerCase++; Loading Loading @@ -173,7 +176,7 @@ public class PasswordMetrics implements Parcelable { && this.nonLetter == o.nonLetter; } /* /** * Returns the maximum length of a sequential characters. A sequence is defined as * monotonically increasing characters with a constant interval or the same character repeated. * Loading @@ -187,19 +190,19 @@ public class PasswordMetrics implements Parcelable { * maxLengthSequence(";;;;") == 4 (anything that repeats) * maxLengthSequence(":;<=>") == 1 (ordered, but not composed of alphas or digits) * * @param string the pass * @param bytes the pass * @return the number of sequential letters or digits */ public static int maxLengthSequence(@NonNull String string) { if (string.length() == 0) return 0; char previousChar = string.charAt(0); public static int maxLengthSequence(@NonNull byte[] bytes) { if (bytes.length == 0) return 0; char previousChar = (char) bytes[0]; @CharacterCatagory int category = categoryChar(previousChar); //current sequence category int diff = 0; //difference between two consecutive characters boolean hasDiff = false; //if we are currently targeting a sequence int maxLength = 0; //maximum length of a sequence already found int startSequence = 0; //where the current sequence started for (int current = 1; current < string.length(); current++) { char currentChar = string.charAt(current); for (int current = 1; current < bytes.length; current++) { char currentChar = (char) bytes[current]; @CharacterCatagory int categoryCurrent = categoryChar(currentChar); int currentDiff = (int) currentChar - (int) previousChar; if (categoryCurrent != category || Math.abs(currentDiff) > maxDiffCategory(category)) { Loading @@ -218,7 +221,7 @@ public class PasswordMetrics implements Parcelable { } previousChar = currentChar; } maxLength = Math.max(maxLength, string.length() - startSequence); maxLength = Math.max(maxLength, bytes.length - startSequence); return maxLength; } Loading core/java/com/android/internal/widget/ILockSettings.aidl +6 −6 Original line number Diff line number Diff line Loading @@ -36,17 +36,17 @@ interface ILockSettings { boolean getBoolean(in String key, in boolean defaultValue, in int userId); long getLong(in String key, in long defaultValue, in int userId); String getString(in String key, in String defaultValue, in int userId); void setLockCredential(in String credential, int type, in String savedCredential, int requestedQuality, int userId); void setLockCredential(in byte[] credential, int type, in byte[] savedCredential, int requestedQuality, int userId); void resetKeyStore(int userId); VerifyCredentialResponse checkCredential(in String credential, int type, int userId, VerifyCredentialResponse checkCredential(in byte[] credential, int type, int userId, in ICheckCredentialProgressCallback progressCallback); VerifyCredentialResponse verifyCredential(in String credential, int type, long challenge, int userId); VerifyCredentialResponse verifyTiedProfileChallenge(String credential, int type, long challenge, int userId); VerifyCredentialResponse verifyCredential(in byte[] credential, int type, long challenge, int userId); VerifyCredentialResponse verifyTiedProfileChallenge(in byte[] credential, int type, long challenge, int userId); boolean checkVoldPassword(int userId); boolean havePattern(int userId); boolean havePassword(int userId); byte[] getHashFactor(String currentCredential, int userId); void setSeparateProfileChallengeEnabled(int userId, boolean enabled, String managedUserPassword); byte[] getHashFactor(in byte[] currentCredential, int userId); void setSeparateProfileChallengeEnabled(int userId, boolean enabled, in byte[] managedUserPassword); boolean getSeparateProfileChallengeEnabled(int userId); void registerStrongAuthTracker(in IStrongAuthTracker tracker); void unregisterStrongAuthTracker(in IStrongAuthTracker tracker); Loading core/java/com/android/internal/widget/LockPatternChecker.java +41 −2 Original line number Diff line number Diff line Loading @@ -150,12 +150,33 @@ public final class LockPatternChecker { * @param challenge The challenge to verify against the pattern. * @param userId The user to check against the pattern. * @param callback The callback to be invoked with the verification result. * * @deprecated Pass the password as a byte array. */ @Deprecated public static AsyncTask<?, ?, ?> verifyPassword(final LockPatternUtils utils, final String password, final long challenge, final int userId, final OnVerifyCallback callback) { byte[] passwordBytes = password != null ? password.getBytes() : null; return verifyPassword(utils, passwordBytes, challenge, userId, callback); } /** * Verify a password asynchronously. * * @param utils The LockPatternUtils instance to use. * @param password The password to check. * @param challenge The challenge to verify against the pattern. * @param userId The user to check against the pattern. * @param callback The callback to be invoked with the verification result. */ public static AsyncTask<?, ?, ?> verifyPassword(final LockPatternUtils utils, final byte[] password, final long challenge, final int userId, final OnVerifyCallback callback) { AsyncTask<Void, Void, byte[]> task = new AsyncTask<Void, Void, byte[]>() { private int mThrottleTimeout; Loading Loading @@ -188,7 +209,7 @@ public final class LockPatternChecker { * @param callback The callback to be invoked with the verification result. */ public static AsyncTask<?, ?, ?> verifyTiedProfileChallenge(final LockPatternUtils utils, final String password, final byte[] password, final boolean isPattern, final long challenge, final int userId, Loading Loading @@ -222,18 +243,36 @@ public final class LockPatternChecker { * @param password The password to check. * @param userId The user to check against the pattern. * @param callback The callback to be invoked with the check result. * @deprecated Pass passwords as byte[] */ @Deprecated public static AsyncTask<?, ?, ?> checkPassword(final LockPatternUtils utils, final String password, final int userId, final OnCheckCallback callback) { byte[] passwordBytes = password != null ? password.getBytes() : null; return checkPassword(utils, passwordBytes, userId, callback); } /** * Checks a password asynchronously. * * @param utils The LockPatternUtils instance to use. * @param passwordBytes The password to check. * @param userId The user to check against the pattern. * @param callback The callback to be invoked with the check result. */ public static AsyncTask<?, ?, ?> checkPassword(final LockPatternUtils utils, final byte[] passwordBytes, final int userId, final OnCheckCallback callback) { AsyncTask<Void, Void, Boolean> task = new AsyncTask<Void, Void, Boolean>() { private int mThrottleTimeout; @Override protected Boolean doInBackground(Void... args) { try { return utils.checkPassword(password, userId, callback::onEarlyMatched); return utils.checkPassword(passwordBytes, userId, callback::onEarlyMatched); } catch (RequestThrottledException ex) { mThrottleTimeout = ex.getTimeoutMs(); return false; Loading Loading
cmds/statsd/src/atoms.proto +38 −0 Original line number Diff line number Diff line Loading @@ -122,6 +122,8 @@ message Atom { WTFOccurred wtf_occurred = 80; LowMemReported low_mem_reported = 81; ThermalThrottlingStateChanged thermal_throttling = 86; // 86 - 165 are not available BluetoothClassicPairingEventReported bluetooth_classic_pairing_event_reported = 166; } // Pulled events will start at field 10000. Loading Loading @@ -1026,6 +1028,42 @@ message BluetoothConnectionStateChanged { optional int32 bt_profile = 3; } /** * Logs there is an event related Bluetooth classic pairing * * Logged from: * system/bt */ message BluetoothClassicPairingEventReported { // An identifier that can be used to match events for this device. // Currently, this is a salted hash of the MAC address of this Bluetooth device. // Salt: Randomly generated 256 bit value // Hash algorithm: HMAC-SHA256 // Size: 32 byte // Default: null or empty if the device identifier is not known // Note: string is here for backward compatibility purpose only optional string obfuscated_id = 1; // Connection handle of this connection if available // Range: 0x0000 - 0x0EFF (12 bits) // Default: 0xFFFF if the handle is unknown optional int32 connection_handle = 2; // HCI command associated with this event // Default: CMD_UNKNOWN optional int32 hci_cmd = 3; // HCI event associated with this event // Default: EVT_UNKNOWN optional int32 hci_event = 4; // HCI command status code if this is triggered by hci_cmd // Default: STATUS_UNKNOWN optional int32 cmd_status = 5; // HCI reason code associated with this event // Default: STATUS_UNKNOWN optional int32 reason_code = 6; // A status value related to this specific event // Default: 0 optional int64 event_value = 7; } /** * Logs when something is plugged into or removed from the USB-C connector. * Loading
core/java/android/app/admin/PasswordMetrics.java +14 −11 Original line number Diff line number Diff line Loading @@ -107,7 +107,10 @@ public class PasswordMetrics implements Parcelable { } }; public static PasswordMetrics computeForPassword(@NonNull String password) { /** * Returns the {@code PasswordMetrics} for a given password */ public static PasswordMetrics computeForPassword(@NonNull byte[] password) { // Analyse the characters used int letters = 0; int upperCase = 0; Loading @@ -115,9 +118,9 @@ public class PasswordMetrics implements Parcelable { int numeric = 0; int symbols = 0; int nonLetter = 0; final int length = password.length(); final int length = password.length; for (int i = 0; i < length; i++) { switch (categoryChar(password.charAt(i))) { switch (categoryChar((char) password[i])) { case CHAR_LOWER_CASE: letters++; lowerCase++; Loading Loading @@ -173,7 +176,7 @@ public class PasswordMetrics implements Parcelable { && this.nonLetter == o.nonLetter; } /* /** * Returns the maximum length of a sequential characters. A sequence is defined as * monotonically increasing characters with a constant interval or the same character repeated. * Loading @@ -187,19 +190,19 @@ public class PasswordMetrics implements Parcelable { * maxLengthSequence(";;;;") == 4 (anything that repeats) * maxLengthSequence(":;<=>") == 1 (ordered, but not composed of alphas or digits) * * @param string the pass * @param bytes the pass * @return the number of sequential letters or digits */ public static int maxLengthSequence(@NonNull String string) { if (string.length() == 0) return 0; char previousChar = string.charAt(0); public static int maxLengthSequence(@NonNull byte[] bytes) { if (bytes.length == 0) return 0; char previousChar = (char) bytes[0]; @CharacterCatagory int category = categoryChar(previousChar); //current sequence category int diff = 0; //difference between two consecutive characters boolean hasDiff = false; //if we are currently targeting a sequence int maxLength = 0; //maximum length of a sequence already found int startSequence = 0; //where the current sequence started for (int current = 1; current < string.length(); current++) { char currentChar = string.charAt(current); for (int current = 1; current < bytes.length; current++) { char currentChar = (char) bytes[current]; @CharacterCatagory int categoryCurrent = categoryChar(currentChar); int currentDiff = (int) currentChar - (int) previousChar; if (categoryCurrent != category || Math.abs(currentDiff) > maxDiffCategory(category)) { Loading @@ -218,7 +221,7 @@ public class PasswordMetrics implements Parcelable { } previousChar = currentChar; } maxLength = Math.max(maxLength, string.length() - startSequence); maxLength = Math.max(maxLength, bytes.length - startSequence); return maxLength; } Loading
core/java/com/android/internal/widget/ILockSettings.aidl +6 −6 Original line number Diff line number Diff line Loading @@ -36,17 +36,17 @@ interface ILockSettings { boolean getBoolean(in String key, in boolean defaultValue, in int userId); long getLong(in String key, in long defaultValue, in int userId); String getString(in String key, in String defaultValue, in int userId); void setLockCredential(in String credential, int type, in String savedCredential, int requestedQuality, int userId); void setLockCredential(in byte[] credential, int type, in byte[] savedCredential, int requestedQuality, int userId); void resetKeyStore(int userId); VerifyCredentialResponse checkCredential(in String credential, int type, int userId, VerifyCredentialResponse checkCredential(in byte[] credential, int type, int userId, in ICheckCredentialProgressCallback progressCallback); VerifyCredentialResponse verifyCredential(in String credential, int type, long challenge, int userId); VerifyCredentialResponse verifyTiedProfileChallenge(String credential, int type, long challenge, int userId); VerifyCredentialResponse verifyCredential(in byte[] credential, int type, long challenge, int userId); VerifyCredentialResponse verifyTiedProfileChallenge(in byte[] credential, int type, long challenge, int userId); boolean checkVoldPassword(int userId); boolean havePattern(int userId); boolean havePassword(int userId); byte[] getHashFactor(String currentCredential, int userId); void setSeparateProfileChallengeEnabled(int userId, boolean enabled, String managedUserPassword); byte[] getHashFactor(in byte[] currentCredential, int userId); void setSeparateProfileChallengeEnabled(int userId, boolean enabled, in byte[] managedUserPassword); boolean getSeparateProfileChallengeEnabled(int userId); void registerStrongAuthTracker(in IStrongAuthTracker tracker); void unregisterStrongAuthTracker(in IStrongAuthTracker tracker); Loading
core/java/com/android/internal/widget/LockPatternChecker.java +41 −2 Original line number Diff line number Diff line Loading @@ -150,12 +150,33 @@ public final class LockPatternChecker { * @param challenge The challenge to verify against the pattern. * @param userId The user to check against the pattern. * @param callback The callback to be invoked with the verification result. * * @deprecated Pass the password as a byte array. */ @Deprecated public static AsyncTask<?, ?, ?> verifyPassword(final LockPatternUtils utils, final String password, final long challenge, final int userId, final OnVerifyCallback callback) { byte[] passwordBytes = password != null ? password.getBytes() : null; return verifyPassword(utils, passwordBytes, challenge, userId, callback); } /** * Verify a password asynchronously. * * @param utils The LockPatternUtils instance to use. * @param password The password to check. * @param challenge The challenge to verify against the pattern. * @param userId The user to check against the pattern. * @param callback The callback to be invoked with the verification result. */ public static AsyncTask<?, ?, ?> verifyPassword(final LockPatternUtils utils, final byte[] password, final long challenge, final int userId, final OnVerifyCallback callback) { AsyncTask<Void, Void, byte[]> task = new AsyncTask<Void, Void, byte[]>() { private int mThrottleTimeout; Loading Loading @@ -188,7 +209,7 @@ public final class LockPatternChecker { * @param callback The callback to be invoked with the verification result. */ public static AsyncTask<?, ?, ?> verifyTiedProfileChallenge(final LockPatternUtils utils, final String password, final byte[] password, final boolean isPattern, final long challenge, final int userId, Loading Loading @@ -222,18 +243,36 @@ public final class LockPatternChecker { * @param password The password to check. * @param userId The user to check against the pattern. * @param callback The callback to be invoked with the check result. * @deprecated Pass passwords as byte[] */ @Deprecated public static AsyncTask<?, ?, ?> checkPassword(final LockPatternUtils utils, final String password, final int userId, final OnCheckCallback callback) { byte[] passwordBytes = password != null ? password.getBytes() : null; return checkPassword(utils, passwordBytes, userId, callback); } /** * Checks a password asynchronously. * * @param utils The LockPatternUtils instance to use. * @param passwordBytes The password to check. * @param userId The user to check against the pattern. * @param callback The callback to be invoked with the check result. */ public static AsyncTask<?, ?, ?> checkPassword(final LockPatternUtils utils, final byte[] passwordBytes, final int userId, final OnCheckCallback callback) { AsyncTask<Void, Void, Boolean> task = new AsyncTask<Void, Void, Boolean>() { private int mThrottleTimeout; @Override protected Boolean doInBackground(Void... args) { try { return utils.checkPassword(password, userId, callback::onEarlyMatched); return utils.checkPassword(passwordBytes, userId, callback::onEarlyMatched); } catch (RequestThrottledException ex) { mThrottleTimeout = ex.getTimeoutMs(); return false; Loading