Loading android/app/src/com/android/bluetooth/btservice/MetricsLogger.java +8 −5 Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ import com.android.internal.annotations.VisibleForTesting; import com.google.common.hash.BloomFilter; import com.google.common.hash.Funnels; import com.google.common.hash.Hashing; import java.io.ByteArrayInputStream; import java.io.File; Loading Loading @@ -304,16 +305,18 @@ public class MetricsLogger { if (matchedSha256 == null) { return false; } statslogBluetoothDeviceNames(metricId, matchedString, matchedSha256); statslogBluetoothDeviceNames( metricId, matchedString, Hashing.sha256().hashString(matchedString, StandardCharsets.UTF_8).toString()); return true; } protected void statslogBluetoothDeviceNames(int metricId, String matchedString, byte[] sha256) { String sha256String = new String(sha256); protected void statslogBluetoothDeviceNames(int metricId, String matchedString, String sha256) { Log.d(TAG, "Uploading sha256 hash of matched bluetooth device name: " + sha256String); "Uploading sha256 hash of matched bluetooth device name: " + sha256); BluetoothStatsLog.write( BluetoothStatsLog.BLUETOOTH_HASHED_DEVICE_NAME_REPORTED, metricId, sha256String); BluetoothStatsLog.BLUETOOTH_HASHED_DEVICE_NAME_REPORTED, metricId, sha256); } protected static byte[] getSha256(String name) { Loading android/app/tests/unit/src/com/android/bluetooth/btservice/MetricsLoggerTest.java +1 −1 Original line number Diff line number Diff line Loading @@ -74,7 +74,7 @@ public class MetricsLoggerTest { @Override protected void statslogBluetoothDeviceNames( int metricId, String matchedString, byte[] sha256) { int metricId, String matchedString, String sha256) { mTestableDeviceNames.merge(matchedString, 1, Integer::sum); } } Loading Loading
android/app/src/com/android/bluetooth/btservice/MetricsLogger.java +8 −5 Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ import com.android.internal.annotations.VisibleForTesting; import com.google.common.hash.BloomFilter; import com.google.common.hash.Funnels; import com.google.common.hash.Hashing; import java.io.ByteArrayInputStream; import java.io.File; Loading Loading @@ -304,16 +305,18 @@ public class MetricsLogger { if (matchedSha256 == null) { return false; } statslogBluetoothDeviceNames(metricId, matchedString, matchedSha256); statslogBluetoothDeviceNames( metricId, matchedString, Hashing.sha256().hashString(matchedString, StandardCharsets.UTF_8).toString()); return true; } protected void statslogBluetoothDeviceNames(int metricId, String matchedString, byte[] sha256) { String sha256String = new String(sha256); protected void statslogBluetoothDeviceNames(int metricId, String matchedString, String sha256) { Log.d(TAG, "Uploading sha256 hash of matched bluetooth device name: " + sha256String); "Uploading sha256 hash of matched bluetooth device name: " + sha256); BluetoothStatsLog.write( BluetoothStatsLog.BLUETOOTH_HASHED_DEVICE_NAME_REPORTED, metricId, sha256String); BluetoothStatsLog.BLUETOOTH_HASHED_DEVICE_NAME_REPORTED, metricId, sha256); } protected static byte[] getSha256(String name) { Loading
android/app/tests/unit/src/com/android/bluetooth/btservice/MetricsLoggerTest.java +1 −1 Original line number Diff line number Diff line Loading @@ -74,7 +74,7 @@ public class MetricsLoggerTest { @Override protected void statslogBluetoothDeviceNames( int metricId, String matchedString, byte[] sha256) { int metricId, String matchedString, String sha256) { mTestableDeviceNames.merge(matchedString, 1, Integer::sum); } } Loading