Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3d376cf6 authored by Raymond Hernandez's avatar Raymond Hernandez Committed by Gerrit Code Review
Browse files

Merge "Add Restricted BT device name logging."

parents 3e46ff08 069f0c83
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -141,6 +141,7 @@ android_app {

    srcs: [
        ":statslog-bluetooth-java-gen",
        ":statslog-bt-restricted-java-gen",
        "src/**/*.java",
    ],
    aaptflags: [
@@ -261,6 +262,15 @@ genrule {
    out: ["com/android/bluetooth/BluetoothStatsLog.java"],
}

genrule {
    name: "statslog-bt-restricted-java-gen",
    tools: ["stats-log-api-gen"],
    cmd: "$(location stats-log-api-gen) --java $(out) --module bt_restricted" +
        " --javaPackage com.android.bluetooth --javaClass BtRestrictedStatsLog" +
        " --minApiLevel 34",
    out: ["com/android/bluetooth/BtRestrictedStatsLog.java"],
}

android_app_certificate {
    name: "com.android.bluetooth.certificate",
    certificate: "certs/com.android.bluetooth",
+9 −0
Original line number Diff line number Diff line
@@ -15,6 +15,8 @@
 */
package com.android.bluetooth.btservice;

import static com.android.bluetooth.BtRestrictedStatsLog.RESTRICTED_BLUETOOTH_DEVICE_NAME_REPORTED;

import android.app.AlarmManager;
import android.content.Context;
import android.os.SystemClock;
@@ -24,8 +26,10 @@ import com.android.bluetooth.BluetoothMetricsProto.BluetoothLog;
import com.android.bluetooth.BluetoothMetricsProto.ProfileConnectionStats;
import com.android.bluetooth.BluetoothMetricsProto.ProfileId;
import com.android.bluetooth.BluetoothStatsLog;
import com.android.bluetooth.BtRestrictedStatsLog;
import com.android.bluetooth.Utils;
import com.android.internal.annotations.VisibleForTesting;
import com.android.modules.utils.build.SdkLevel;

import com.google.common.hash.BloomFilter;
import com.google.common.hash.Funnels;
@@ -288,6 +292,11 @@ public class MetricsLogger {
            String toBeMatched = "";
            for (int end = start; end < words.length; end++) {
                toBeMatched += words[end];
                // TODO(b/280868296): Refactor to log even if bloom filter isn't initialized.
                if (SdkLevel.isAtLeastU()) {
                    BtRestrictedStatsLog.write(RESTRICTED_BLUETOOTH_DEVICE_NAME_REPORTED,
                            toBeMatched);
                }
                byte[] sha256 = getSha256(toBeMatched);
                if (sha256 == null) {
                    continue;