Merge "Move Bluetooth off the product="..." strings xml feature"
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 9a0973c..a213973 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -395,8 +395,7 @@
         </service>
         <service
             android:process="@string/process"
-            android:name = ".hearingaid.HearingAidService"
-            android:enabled="@bool/profile_supported_hearing_aid">
+            android:name = ".hearingaid.HearingAidService">
             <intent-filter>
                 <action android:name="android.bluetooth.IBluetoothHearingAid" />
             </intent-filter>
diff --git a/src/com/android/bluetooth/btservice/Config.java b/src/com/android/bluetooth/btservice/Config.java
index db79486..8a9c0a1 100644
--- a/src/com/android/bluetooth/btservice/Config.java
+++ b/src/com/android/bluetooth/btservice/Config.java
@@ -119,10 +119,10 @@
         for (ProfileConfig config : PROFILE_SERVICES_AND_FLAGS) {
             boolean supported = resources.getBoolean(config.mSupported);
 
-            if (supported && (config.mClass == HearingAidService.class) && !FeatureFlagUtils
+            if (!supported && (config.mClass == HearingAidService.class) && FeatureFlagUtils
                                 .isEnabled(ctx, FeatureFlagUtils.HEARING_AID_SETTINGS)) {
-                Log.v(TAG, "Feature Flag disables support for HearingAidService");
-                supported = false;
+                Log.v(TAG, "Feature Flag enables support for HearingAidService");
+                supported = true;
             }
 
             if (supported && !isProfileDisabled(ctx, config.mMask)) {
diff --git a/src/com/android/bluetooth/pbapclient/CallLogPullRequest.java b/src/com/android/bluetooth/pbapclient/CallLogPullRequest.java
index 044fcf7..91652a6 100644
--- a/src/com/android/bluetooth/pbapclient/CallLogPullRequest.java
+++ b/src/com/android/bluetooth/pbapclient/CallLogPullRequest.java
@@ -88,7 +88,7 @@
                 ContentValues values = new ContentValues();
 
                 values.put(CallLog.Calls.TYPE, type);
-                values.put(Calls.PHONE_ACCOUNT_ID, mAccount.hashCode());
+                values.put(Calls.PHONE_ACCOUNT_ID, mAccount.name);
                 List<PhoneData> phones = vcard.getPhoneList();
                 if (phones == null || phones.get(0).getNumber().equals(";")) {
                     values.put(CallLog.Calls.NUMBER, "");
diff --git a/src/com/android/bluetooth/pbapclient/PbapClientConnectionHandler.java b/src/com/android/bluetooth/pbapclient/PbapClientConnectionHandler.java
index f8e78a4..c060ab2 100644
--- a/src/com/android/bluetooth/pbapclient/PbapClientConnectionHandler.java
+++ b/src/com/android/bluetooth/pbapclient/PbapClientConnectionHandler.java
@@ -411,8 +411,8 @@
                 }
                 return;
             }
-            String where = Calls.PHONE_ACCOUNT_ID + "=" + account.hashCode();
-            mContext.getContentResolver().delete(CallLog.Calls.CONTENT_URI, where, null);
+            mContext.getContentResolver().delete(CallLog.Calls.CONTENT_URI,
+                    Calls.PHONE_ACCOUNT_ID + "=?", new String[]{mAccount.name});
         } catch (IllegalArgumentException e) {
             Log.d(TAG, "Call Logs could not be deleted, they may not exist yet.");
         }
diff --git a/src/com/android/bluetooth/pbapclient/PbapClientService.java b/src/com/android/bluetooth/pbapclient/PbapClientService.java
index 5920119..9998e1b 100644
--- a/src/com/android/bluetooth/pbapclient/PbapClientService.java
+++ b/src/com/android/bluetooth/pbapclient/PbapClientService.java
@@ -116,14 +116,15 @@
         if (VDBG) Log.v(TAG, "Found " + accounts.length + " unclean accounts");
         for (Account acc : accounts) {
             Log.w(TAG, "Deleting " + acc);
+            try {
+                getContentResolver().delete(CallLog.Calls.CONTENT_URI,
+                        CallLog.Calls.PHONE_ACCOUNT_ID + "=?", new String[]{acc.name});
+            } catch (IllegalArgumentException e) {
+                Log.w(TAG, "Call Logs could not be deleted, they may not exist yet.");
+            }
             // The device ID is the name of the account.
             accountManager.removeAccountExplicitly(acc);
         }
-        try {
-            getContentResolver().delete(CallLog.Calls.CONTENT_URI, null, null);
-        } catch (IllegalArgumentException e) {
-            Log.w(TAG, "Call Logs could not be deleted, they may not exist yet.");
-        }
     }
 
     private class PbapBroadcastReceiver extends BroadcastReceiver {