Merge "turn off getState debug message, not so useful now"
diff --git a/res/values-sw/strings.xml b/res/values-sw/strings.xml
index 41384a1..384dcd9 100644
--- a/res/values-sw/strings.xml
+++ b/res/values-sw/strings.xml
@@ -16,7 +16,7 @@
 
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
-    <string name="permlab_bluetoothShareManager" msgid="311492132450338925">"Fikia kidhibiti cha vipakuzi"</string>
+    <string name="permlab_bluetoothShareManager" msgid="311492132450338925">"Fikia kidhibiti cha vipakuliwa."</string>
     <string name="permdesc_bluetoothShareManager" msgid="8930572979123190223">"Huruhusu programu kufikia kidhibiti cha BluetoothShare na kukitumia kuhamisha faili."</string>
     <string name="permlab_bluetoothWhitelist" msgid="7091552898592306386">"Ruhusu ufikiaji kifaa cha bluetooth."</string>
     <string name="permdesc_bluetoothWhitelist" msgid="5494513855192170109">"Huruhusu programu kuorodhesha kwa muda kifaa cha Bluetooth kwenye orodha ya vifaa maalum, ikiruhusu kifaa hicho kutuma faili kwa kifaa hiki bila uthibitishaji wa mtumiaji."</string>
diff --git a/src/com/android/bluetooth/a2dp/A2dpStateMachine.java b/src/com/android/bluetooth/a2dp/A2dpStateMachine.java
index 4e1a9c8..f7cf37f 100755
--- a/src/com/android/bluetooth/a2dp/A2dpStateMachine.java
+++ b/src/com/android/bluetooth/a2dp/A2dpStateMachine.java
@@ -58,7 +58,6 @@
 import java.util.Set;
 
 final class A2dpStateMachine extends StateMachine {
-    private static final String TAG = "A2dpStateMachine";
     private static final boolean DBG = false;
 
     static final int CONNECT = 1;
@@ -116,7 +115,7 @@
     }
 
     private A2dpStateMachine(A2dpService svc, Context context) {
-        super(TAG);
+        super("A2dpStateMachine");
         mService = svc;
         mContext = context;
         mAdapter = BluetoothAdapter.getDefaultAdapter();
@@ -143,7 +142,7 @@
     }
 
     static A2dpStateMachine make(A2dpService svc, Context context) {
-        Log.d(TAG, "make");
+        Log.d("A2dpStateMachine", "make");
         A2dpStateMachine a2dpSm = new A2dpStateMachine(svc, context);
         a2dpSm.start();
         return a2dpSm;
@@ -167,7 +166,7 @@
         public boolean processMessage(Message message) {
             log("Disconnected process message: " + message.what);
             if (mCurrentDevice != null || mTargetDevice != null  || mIncomingDevice != null) {
-                Log.e(TAG, "ERROR: current, target, or mIncomingDevice not null in Disconnected");
+                loge("ERROR: current, target, or mIncomingDevice not null in Disconnected");
                 return NOT_HANDLED;
             }
 
@@ -202,7 +201,7 @@
                             processConnectionEvent(event.valueInt, event.device);
                             break;
                         default:
-                            Log.e(TAG, "Unexpected stack event: " + event.type);
+                            loge("Unexpected stack event: " + event.type);
                             break;
                     }
                     break;
@@ -221,11 +220,11 @@
         private void processConnectionEvent(int state, BluetoothDevice device) {
             switch (state) {
             case CONNECTION_STATE_DISCONNECTED:
-                Log.w(TAG, "Ignore HF DISCONNECTED event, device: " + device);
+                logw("Ignore HF DISCONNECTED event, device: " + device);
                 break;
             case CONNECTION_STATE_CONNECTING:
                 if (okToConnect(device)){
-                    Log.i(TAG,"Incoming A2DP accepted");
+                    logi("Incoming A2DP accepted");
                     broadcastConnectionState(device, BluetoothProfile.STATE_CONNECTING,
                                              BluetoothProfile.STATE_DISCONNECTED);
                     synchronized (A2dpStateMachine.this) {
@@ -234,7 +233,7 @@
                     }
                 } else {
                     //reject the connection and stay in Disconnected state itself
-                    Log.i(TAG,"Incoming A2DP rejected");
+                    logi("Incoming A2DP rejected");
                     disconnectA2dpNative(getByteAddress(device));
                     // the other profile connection should be initiated
                     AdapterService adapterService = AdapterService.getAdapterService();
@@ -245,9 +244,9 @@
                 }
                 break;
             case CONNECTION_STATE_CONNECTED:
-                Log.w(TAG, "A2DP Connected from Disconnected state");
+                logw("A2DP Connected from Disconnected state");
                 if (okToConnect(device)){
-                    Log.i(TAG,"Incoming A2DP accepted");
+                    logi("Incoming A2DP accepted");
                     broadcastConnectionState(device, BluetoothProfile.STATE_CONNECTED,
                                              BluetoothProfile.STATE_DISCONNECTED);
                     synchronized (A2dpStateMachine.this) {
@@ -256,7 +255,7 @@
                     }
                 } else {
                     //reject the connection and stay in Disconnected state itself
-                    Log.i(TAG,"Incoming A2DP rejected");
+                    logi("Incoming A2DP rejected");
                     disconnectA2dpNative(getByteAddress(device));
                     // the other profile connection should be initiated
                     AdapterService adapterService = AdapterService.getAdapterService();
@@ -267,10 +266,10 @@
                 }
                 break;
             case CONNECTION_STATE_DISCONNECTING:
-                Log.w(TAG, "Ignore HF DISCONNECTING event, device: " + device);
+                logw("Ignore HF DISCONNECTING event, device: " + device);
                 break;
             default:
-                Log.e(TAG, "Incorrect state: " + state);
+                loge("Incorrect state: " + state);
                 break;
             }
         }
@@ -317,7 +316,7 @@
                             processConnectionEvent(event.valueInt, event.device);
                             break;
                         default:
-                            Log.e(TAG, "Unexpected stack event: " + event.type);
+                            loge("Unexpected stack event: " + event.type);
                             break;
                     }
                     break;
@@ -372,7 +371,7 @@
                             transitionTo(mDisconnected);
                         }
                     } else {
-                        Log.e(TAG, "Unknown device Disconnected: " + device);
+                        loge("Unknown device Disconnected: " + device);
                     }
                     break;
             case CONNECTION_STATE_CONNECTED:
@@ -405,7 +404,7 @@
                         transitionTo(mConnected);
                     }
                 } else {
-                    Log.e(TAG, "Unknown device Connected: " + device);
+                    loge("Unknown device Connected: " + device);
                     // something is wrong here, but sync our state with stack
                     broadcastConnectionState(device, BluetoothProfile.STATE_CONNECTED,
                                              BluetoothProfile.STATE_DISCONNECTED);
@@ -428,7 +427,7 @@
                     log("Stack and target device are connecting");
                 }
                 else if (mIncomingDevice != null && mIncomingDevice.equals(device)) {
-                    Log.e(TAG, "Another connecting event on the incoming device");
+                    loge("Another connecting event on the incoming device");
                 } else {
                     // We get an incoming connecting request while Pending
                     // TODO(BT) is stack handing this case? let's ignore it for now
@@ -442,15 +441,15 @@
                         log("stack is disconnecting mCurrentDevice");
                     }
                 } else if (mTargetDevice != null && mTargetDevice.equals(device)) {
-                    Log.e(TAG, "TargetDevice is getting disconnected");
+                    loge("TargetDevice is getting disconnected");
                 } else if (mIncomingDevice != null && mIncomingDevice.equals(device)) {
-                    Log.e(TAG, "IncomingDevice is getting disconnected");
+                    loge("IncomingDevice is getting disconnected");
                 } else {
-                    Log.e(TAG, "Disconnecting unknow device: " + device);
+                    loge("Disconnecting unknow device: " + device);
                 }
                 break;
             default:
-                Log.e(TAG, "Incorrect state: " + state);
+                loge("Incorrect state: " + state);
                 break;
             }
         }
@@ -470,7 +469,7 @@
         public boolean processMessage(Message message) {
             log("Connected process message: " + message.what);
             if (mCurrentDevice == null) {
-                Log.e(TAG, "ERROR: mCurrentDevice is null in Connected");
+                loge("ERROR: mCurrentDevice is null in Connected");
                 return NOT_HANDLED;
             }
 
@@ -523,7 +522,7 @@
                             processAudioStateEvent(event.valueInt, event.device);
                             break;
                         default:
-                            Log.e(TAG, "Unexpected stack event: " + event.type);
+                            loge("Unexpected stack event: " + event.type);
                             break;
                     }
                     break;
@@ -545,17 +544,17 @@
                             transitionTo(mDisconnected);
                         }
                     } else {
-                        Log.e(TAG, "Disconnected from unknown device: " + device);
+                        loge("Disconnected from unknown device: " + device);
                     }
                     break;
               default:
-                  Log.e(TAG, "Connection State Device: " + device + " bad state: " + state);
+                  loge("Connection State Device: " + device + " bad state: " + state);
                   break;
             }
         }
         private void processAudioStateEvent(int state, BluetoothDevice device) {
             if (!mCurrentDevice.equals(device)) {
-                Log.e(TAG, "Audio State Device:" + device + "is different from ConnectedDevice:" +
+                loge("Audio State Device:" + device + "is different from ConnectedDevice:" +
                                                            mCurrentDevice);
                 return;
             }
@@ -575,7 +574,7 @@
                     }
                     break;
                 default:
-                  Log.e(TAG, "Audio State Device: " + device + " bad state: " + state);
+                  loge("Audio State Device: " + device + " bad state: " + state);
                   break;
             }
         }
@@ -607,7 +606,7 @@
                 }
                 return BluetoothProfile.STATE_DISCONNECTED;
             } else {
-                Log.e(TAG, "Bad currentState: " + currentState);
+                loge("Bad currentState: " + currentState);
                 return BluetoothProfile.STATE_DISCONNECTED;
             }
         }
@@ -720,10 +719,6 @@
         return mAdapter.getRemoteDevice(Utils.getAddressStringFromByte(address));
     }
 
-    private void log(String msg) {
-        Log.d(TAG, msg);
-    }
-
     private class StackEvent {
         int type = EVENT_TYPE_NONE;
         int valueInt = 0;
diff --git a/src/com/android/bluetooth/hfp/HeadsetStateMachine.java b/src/com/android/bluetooth/hfp/HeadsetStateMachine.java
index d9b2b7d..059f326 100755
--- a/src/com/android/bluetooth/hfp/HeadsetStateMachine.java
+++ b/src/com/android/bluetooth/hfp/HeadsetStateMachine.java
@@ -1957,10 +1957,10 @@
         return ret;
     }
 
-
-    private void log(String msg) {
+    @Override
+    protected void log(String msg) {
         if (DBG) {
-            Log.d(TAG, msg);
+            super.log(msg);
         }
     }