Merge "Display -> Screen"
diff --git a/src/com/android/settings/RadioInfo.java b/src/com/android/settings/RadioInfo.java
index beea51e..4f8b374 100644
--- a/src/com/android/settings/RadioInfo.java
+++ b/src/com/android/settings/RadioInfo.java
@@ -427,7 +427,7 @@
 
         if (-1 == signalDbm) signalDbm = 0;
 
-        int signalAsu = mPhoneStateReceiver.getSignalStrength();
+        int signalAsu = mPhoneStateReceiver.getSignalStrengthLevelAsu();
 
         if (-1 == signalAsu) signalAsu = 0;
 
diff --git a/src/com/android/settings/bluetooth/BluetoothEventRedirector.java b/src/com/android/settings/bluetooth/BluetoothEventRedirector.java
index 3023daf..fa0c2c3 100644
--- a/src/com/android/settings/bluetooth/BluetoothEventRedirector.java
+++ b/src/com/android/settings/bluetooth/BluetoothEventRedirector.java
@@ -128,13 +128,11 @@
 
                 mManager.getCachedDeviceManager().onProfileStateChanged(device,
                         Profile.A2DP, newState);
-            } else if (action.equals(BluetoothInputDevice.ACTION_INPUT_DEVICE_STATE_CHANGED)) {
-                final int newState = intent.getIntExtra(
-                        BluetoothInputDevice.EXTRA_INPUT_DEVICE_STATE, 0);
-                final int oldState = intent.getIntExtra(
-                        BluetoothInputDevice.EXTRA_PREVIOUS_INPUT_DEVICE_STATE, 0);
-                if (newState == BluetoothInputDevice.STATE_DISCONNECTED &&
-                        oldState == BluetoothInputDevice.STATE_CONNECTING) {
+            } else if (action.equals(BluetoothInputDevice.ACTION_CONNECTION_STATE_CHANGED)) {
+                final int newState = intent.getIntExtra(BluetoothProfile.EXTRA_STATE, 0);
+                final int oldState = intent.getIntExtra(BluetoothProfile.EXTRA_PREVIOUS_STATE, 0);
+                if (newState == BluetoothProfile.STATE_DISCONNECTED &&
+                        oldState == BluetoothProfile.STATE_CONNECTING) {
                     Log.i(TAG, "Failed to connect BT HID");
                 }
 
@@ -202,7 +200,7 @@
 
         // Fine-grained state broadcasts
         filter.addAction(BluetoothPan.ACTION_PAN_STATE_CHANGED);
-        filter.addAction(BluetoothInputDevice.ACTION_INPUT_DEVICE_STATE_CHANGED);
+        filter.addAction(BluetoothInputDevice.ACTION_CONNECTION_STATE_CHANGED);
         filter.addAction(BluetoothA2dp.ACTION_CONNECTION_STATE_CHANGED);
         filter.addAction(BluetoothHeadset.ACTION_CONNECTION_STATE_CHANGED);
         filter.addAction(BluetoothDevice.ACTION_CLASS_CHANGED);
diff --git a/src/com/android/settings/bluetooth/LocalBluetoothProfileManager.java b/src/com/android/settings/bluetooth/LocalBluetoothProfileManager.java
index de15dcc..889cb8a 100644
--- a/src/com/android/settings/bluetooth/LocalBluetoothProfileManager.java
+++ b/src/com/android/settings/bluetooth/LocalBluetoothProfileManager.java
@@ -639,29 +639,39 @@
         }
     }
 
-    private static class HidProfileManager extends LocalBluetoothProfileManager {
-        private final BluetoothInputDevice mService;
+    private static class HidProfileManager extends LocalBluetoothProfileManager
+            implements BluetoothProfile.ServiceListener {
+        private BluetoothInputDevice mService;
 
         public HidProfileManager(LocalBluetoothManager localManager) {
             super(localManager);
-            mService = new BluetoothInputDevice(localManager.getContext());
+            BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter();
+            adapter.getProfileProxy(localManager.getContext(), this, BluetoothProfile.INPUT_DEVICE);
+        }
+
+        public void onServiceConnected(int profile, BluetoothProfile proxy) {
+            mService = (BluetoothInputDevice) proxy;
+        }
+
+        public void onServiceDisconnected(int profile) {
+            mService = null;
         }
 
         @Override
         public boolean connect(BluetoothDevice device) {
-            return mService.connectInputDevice(device);
+            return mService.connect(device);
         }
 
         @Override
         public int convertState(int hidState) {
             switch (hidState) {
-            case BluetoothInputDevice.STATE_CONNECTED:
+            case BluetoothProfile.STATE_CONNECTED:
                 return SettingsBtStatus.CONNECTION_STATUS_CONNECTED;
-            case BluetoothInputDevice.STATE_CONNECTING:
+            case BluetoothProfile.STATE_CONNECTING:
                 return SettingsBtStatus.CONNECTION_STATUS_CONNECTING;
-            case BluetoothInputDevice.STATE_DISCONNECTED:
+            case BluetoothProfile.STATE_DISCONNECTED:
                 return SettingsBtStatus.CONNECTION_STATUS_DISCONNECTED;
-            case BluetoothInputDevice.STATE_DISCONNECTING:
+            case BluetoothProfile.STATE_DISCONNECTING:
                 return SettingsBtStatus.CONNECTION_STATUS_DISCONNECTING;
             default:
                 return SettingsBtStatus.CONNECTION_STATUS_UNKNOWN;
@@ -670,22 +680,22 @@
 
         @Override
         public boolean disconnect(BluetoothDevice device) {
-            return mService.disconnectInputDevice(device);
+            return mService.disconnect(device);
         }
 
         @Override
         public List<BluetoothDevice> getConnectedDevices() {
-            return mService.getConnectedInputDevices();
+            return mService.getConnectedDevices();
         }
 
         @Override
         public int getConnectionStatus(BluetoothDevice device) {
-            return convertState(mService.getInputDeviceState(device));
+            return convertState(mService.getConnectionState(device));
         }
 
         @Override
         public int getPreferred(BluetoothDevice device) {
-            return mService.getInputDevicePriority(device);
+            return mService.getPriority(device);
         }
 
         @Override
@@ -701,7 +711,7 @@
 
         @Override
         public boolean isPreferred(BluetoothDevice device) {
-            return mService.getInputDevicePriority(device) > BluetoothInputDevice.PRIORITY_OFF;
+            return mService.getPriority(device) > BluetoothProfile.PRIORITY_OFF;
         }
 
         @Override
@@ -712,11 +722,11 @@
         @Override
         public void setPreferred(BluetoothDevice device, boolean preferred) {
             if (preferred) {
-                if (mService.getInputDevicePriority(device) < BluetoothInputDevice.PRIORITY_ON) {
-                    mService.setInputDevicePriority(device, BluetoothInputDevice.PRIORITY_ON);
+                if (mService.getPriority(device) < BluetoothProfile.PRIORITY_ON) {
+                    mService.setPriority(device, BluetoothProfile.PRIORITY_ON);
                 }
             } else {
-                mService.setInputDevicePriority(device, BluetoothInputDevice.PRIORITY_OFF);
+                mService.setPriority(device, BluetoothProfile.PRIORITY_OFF);
             }
         }
 
diff --git a/src/com/android/settings/deviceinfo/Status.java b/src/com/android/settings/deviceinfo/Status.java
index f171c81..0350631 100644
--- a/src/com/android/settings/deviceinfo/Status.java
+++ b/src/com/android/settings/deviceinfo/Status.java
@@ -373,7 +373,7 @@
 
             if (-1 == signalDbm) signalDbm = 0;
 
-            int signalAsu = mPhoneStateReceiver.getSignalStrength();
+            int signalAsu = mPhoneStateReceiver.getSignalStrengthLevelAsu();
 
             if (-1 == signalAsu) signalAsu = 0;
 
diff --git a/src/com/android/settings/fuelgauge/PowerUsageSummary.java b/src/com/android/settings/fuelgauge/PowerUsageSummary.java
index 9fafc56..c5cba03 100644
--- a/src/com/android/settings/fuelgauge/PowerUsageSummary.java
+++ b/src/com/android/settings/fuelgauge/PowerUsageSummary.java
@@ -42,6 +42,7 @@
 import android.preference.PreferenceFragment;
 import android.preference.PreferenceGroup;
 import android.preference.PreferenceScreen;
+import android.telephony.SignalStrength;
 import android.util.Log;
 import android.util.SparseArray;
 import android.view.Menu;
@@ -572,7 +573,7 @@
 
     private void addRadioUsage(long uSecNow) {
         double power = 0;
-        final int BINS = BatteryStats.NUM_SIGNAL_STRENGTH_BINS;
+        final int BINS = SignalStrength.NUM_SIGNAL_STRENGTH_BINS;
         long signalTimeMs = 0;
         for (int i = 0; i < BINS; i++) {
             long strengthTimeMs = mStats.getPhoneSignalStrengthTime(i, uSecNow, mStatsType) / 1000;