Merge "TelephonyRegistry: Avoid adding duplicate listener"
diff --git a/packages/SettingsLib/src/com/android/settingslib/bluetooth/LocalBluetoothProfileManager.java b/packages/SettingsLib/src/com/android/settingslib/bluetooth/LocalBluetoothProfileManager.java
index 35bbbc0..34fdc1e 100644
--- a/packages/SettingsLib/src/com/android/settingslib/bluetooth/LocalBluetoothProfileManager.java
+++ b/packages/SettingsLib/src/com/android/settingslib/bluetooth/LocalBluetoothProfileManager.java
@@ -543,12 +543,13 @@
             mPbapProfile.setEnabled(device, true);
         }
 
-        if (mMapClientProfile != null) {
+        if ((mMapClientProfile != null)
+                && BluetoothUuid.containsAnyUuid(uuids, MapClientProfile.UUIDS)) {
             profiles.add(mMapClientProfile);
             removedProfiles.remove(mMapClientProfile);
         }
 
-        if ((mPbapClientProfile != null) && ArrayUtils.contains(localUuids, BluetoothUuid.PBAP_PCE)
+        if ((mPbapClientProfile != null)
                 && BluetoothUuid.containsAnyUuid(uuids, PbapClientProfile.SRC_UUIDS)) {
             profiles.add(mPbapClientProfile);
             removedProfiles.remove(mPbapClientProfile);
diff --git a/packages/SettingsLib/src/com/android/settingslib/bluetooth/MapClientProfile.java b/packages/SettingsLib/src/com/android/settingslib/bluetooth/MapClientProfile.java
index 19cb2f5..4881a86 100644
--- a/packages/SettingsLib/src/com/android/settingslib/bluetooth/MapClientProfile.java
+++ b/packages/SettingsLib/src/com/android/settingslib/bluetooth/MapClientProfile.java
@@ -47,8 +47,6 @@
     private final LocalBluetoothProfileManager mProfileManager;
 
     static final ParcelUuid[] UUIDS = {
-        BluetoothUuid.MAP,
-        BluetoothUuid.MNS,
         BluetoothUuid.MAS,
     };
 
diff --git a/services/core/java/com/android/server/appop/AppOpsService.java b/services/core/java/com/android/server/appop/AppOpsService.java
index 6eab022..42af4da 100644
--- a/services/core/java/com/android/server/appop/AppOpsService.java
+++ b/services/core/java/com/android/server/appop/AppOpsService.java
@@ -1786,9 +1786,9 @@
                     }
                 }
             }
-
-            mHistoricalRegistry.clearHistory(uid, packageName);
         }
+
+        mHistoricalRegistry.clearHistory(uid, packageName);
     }
 
     public void uidRemoved(int uid) {