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

Commit a9332b53 authored by Android Build Coastguard Worker's avatar Android Build Coastguard Worker
Browse files

Snap for 8458224 from 54b8b301 to tm-qpr1-release

Change-Id: I453b4d71ae95d13d6f595d2a4d369c33dc24873b
parents 6aa9e1ce 54b8b301
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -10,4 +10,5 @@ qasimj@google.com
rahulsabnis@google.com
sattiraju@google.com
siyuanh@google.com
wescande@google.com
zachoverflow@google.com
+13 −11
Original line number Diff line number Diff line
@@ -370,15 +370,16 @@ public class DatabaseManager {
            String address = device.getAddress();

            if (!mMetadataCache.containsKey(address)) {
                Log.d(TAG, "getProfileConnectionPolicy: device xx:xx:xx:xx:xx:xx is not in cache");
                Log.d(TAG, "getProfileConnectionPolicy: device " + device.getAnonymizedAddress()
                        + " is not in cache");
                return BluetoothProfile.CONNECTION_POLICY_UNKNOWN;
            }

            Metadata data = mMetadataCache.get(address);
            int connectionPolicy = data.getProfileConnectionPolicy(profile);

            Log.v(TAG, "getProfileConnectionPolicy: xx:xx:xx:xx:xx:xx, profile="
                    + BluetoothProfile.getProfileName(profile)
            Log.v(TAG, "getProfileConnectionPolicy: device " + device.getAnonymizedAddress()
                    + " profile=" + BluetoothProfile.getProfileName(profile)
                    + ", connectionPolicy=" + connectionPolicy);
            return connectionPolicy;
        }
@@ -533,7 +534,8 @@ public class DatabaseManager {
     */
    public void setConnection(BluetoothDevice device, boolean isA2dpDevice) {
        synchronized (mMetadataCache) {
            Log.d(TAG, "setConnection: device=xx:xx:xx:xx:xx:xx and isA2dpDevice=" + isA2dpDevice);
            Log.d(TAG, "setConnection: device " + device.getAnonymizedAddress()
                    + " and isA2dpDevice=" + isA2dpDevice);
            if (device == null) {
                Log.e(TAG, "setConnection: device is null");
                return;
@@ -559,8 +561,8 @@ public class DatabaseManager {
                metadata.is_active_a2dp_device = true;
            }

            Log.d(TAG, "Updating last connected time for device: xx:xx:xx:xx:xx:xx to "
                    + metadata.last_active_time);
            Log.d(TAG, "Updating last connected time for device: " + device.getAnonymizedAddress()
                    + " to " + metadata.last_active_time);
            updateDatabase(metadata);
        }
    }
@@ -670,8 +672,8 @@ public class DatabaseManager {
            Metadata metadata = metadataList.get(index);
            if (metadata.last_active_time != MetadataDatabase.sCurrentConnectionNumber) {
                Log.d(TAG, "compactLastConnectionTime: Setting last_active_item for device: "
                        + "xx:xx:xx:xx:xx:xx from " + metadata.last_active_time + " to "
                        + MetadataDatabase.sCurrentConnectionNumber);
                        + metadata.getAnonymizedAddress() + " from " + metadata.last_active_time
                        + " to " + MetadataDatabase.sCurrentConnectionNumber);
                metadata.last_active_time = MetadataDatabase.sCurrentConnectionNumber;
                updateDatabase(metadata);
                MetadataDatabase.sCurrentConnectionNumber++;
@@ -793,7 +795,7 @@ public class DatabaseManager {
            mMigratedFromSettingsGlobal = true;
            for (Metadata data : list) {
                String address = data.getAddress();
                Log.v(TAG, "cacheMetadata: found device xx:xx:xx:xx:xx:xx");
                Log.v(TAG, "cacheMetadata: found device " + data.getAnonymizedAddress());
                mMetadataCache.put(address, data);
            }
            Log.i(TAG, "cacheMetadata: Database is ready");
@@ -1000,7 +1002,7 @@ public class DatabaseManager {
            Log.e(TAG, "updateDatabase: address is null");
            return;
        }
        Log.d(TAG, "updateDatabase xx:xx:xx:xx:xx:xx");
        Log.d(TAG, "updateDatabase " + data.getAnonymizedAddress());
        Message message = mHandler.obtainMessage(MSG_UPDATE_DATABASE);
        message.obj = data;
        mHandler.sendMessage(message);
+12 −0
Original line number Diff line number Diff line
@@ -66,6 +66,18 @@ class Metadata {
        return address;
    }

    /**
     * Returns the anonymized hardware address. The first three octets will be suppressed for
     * anonymization.
     * <p> For example, "XX:XX:XX:AA:BB:CC".
     *
     * @return Anonymized bluetooth hardware address as string
     */
    @NonNull
    public String getAnonymizedAddress() {
        return "XX:XX:XX" + getAddress().substring(8);
    }

    void setProfileConnectionPolicy(int profile, int connectionPolicy) {
        // We no longer support BluetoothProfile.PRIORITY_AUTO_CONNECT and are merging it into
        // BluetoothProfile.CONNECTION_POLICY_ALLOWED

apex/OWNERS

0 → 100644
+4 −0
Original line number Diff line number Diff line

rahulsabnis@google.com
wescande@google.com
+1 −0
Original line number Diff line number Diff line
@@ -3,4 +3,5 @@
rahulsabnis@google.com
sattiraju@google.com
siyuanh@google.com
wescande@google.com
zachoverflow@google.com
Loading