OSDN Git Service

QuickSettings: Bluetooth updates.
authorJohn Spurlock <jspurlock@google.com>
Thu, 5 Jun 2014 13:55:37 +0000 (09:55 -0400)
committerJohn Spurlock <jspurlock@google.com>
Fri, 6 Jun 2014 03:20:15 +0000 (23:20 -0400)
- Use "Bluetooth" string when connecting.
- Use @hidden device alias (instead of name) for label.
- Use the same icon in the status bar.

Bug:15186962
Change-Id: I25613bebf069c91e76d6933f2512b3f0a8020474

12 files changed:
packages/SystemUI/res/drawable-hdpi/stat_sys_data_bluetooth.png [deleted file]
packages/SystemUI/res/drawable-hdpi/stat_sys_data_bluetooth_connected.png [deleted file]
packages/SystemUI/res/drawable-mdpi/stat_sys_data_bluetooth.png [deleted file]
packages/SystemUI/res/drawable-mdpi/stat_sys_data_bluetooth_connected.png [deleted file]
packages/SystemUI/res/drawable-xhdpi/stat_sys_data_bluetooth.png [deleted file]
packages/SystemUI/res/drawable-xhdpi/stat_sys_data_bluetooth_connected.png [deleted file]
packages/SystemUI/res/drawable-xxhdpi/stat_sys_data_bluetooth.png [deleted file]
packages/SystemUI/res/drawable-xxhdpi/stat_sys_data_bluetooth_connected.png [deleted file]
packages/SystemUI/res/drawable/stat_sys_data_bluetooth.xml [new file with mode: 0644]
packages/SystemUI/res/drawable/stat_sys_data_bluetooth_connected.xml [new file with mode: 0644]
packages/SystemUI/src/com/android/systemui/qs/tiles/BluetoothTile.java
packages/SystemUI/src/com/android/systemui/statusbar/policy/BluetoothControllerImpl.java

diff --git a/packages/SystemUI/res/drawable-hdpi/stat_sys_data_bluetooth.png b/packages/SystemUI/res/drawable-hdpi/stat_sys_data_bluetooth.png
deleted file mode 100644 (file)
index 7ed4c78..0000000
Binary files a/packages/SystemUI/res/drawable-hdpi/stat_sys_data_bluetooth.png and /dev/null differ
diff --git a/packages/SystemUI/res/drawable-hdpi/stat_sys_data_bluetooth_connected.png b/packages/SystemUI/res/drawable-hdpi/stat_sys_data_bluetooth_connected.png
deleted file mode 100644 (file)
index 08c07b2..0000000
Binary files a/packages/SystemUI/res/drawable-hdpi/stat_sys_data_bluetooth_connected.png and /dev/null differ
diff --git a/packages/SystemUI/res/drawable-mdpi/stat_sys_data_bluetooth.png b/packages/SystemUI/res/drawable-mdpi/stat_sys_data_bluetooth.png
deleted file mode 100644 (file)
index bd4e1ae..0000000
Binary files a/packages/SystemUI/res/drawable-mdpi/stat_sys_data_bluetooth.png and /dev/null differ
diff --git a/packages/SystemUI/res/drawable-mdpi/stat_sys_data_bluetooth_connected.png b/packages/SystemUI/res/drawable-mdpi/stat_sys_data_bluetooth_connected.png
deleted file mode 100644 (file)
index e82c6e4..0000000
Binary files a/packages/SystemUI/res/drawable-mdpi/stat_sys_data_bluetooth_connected.png and /dev/null differ
diff --git a/packages/SystemUI/res/drawable-xhdpi/stat_sys_data_bluetooth.png b/packages/SystemUI/res/drawable-xhdpi/stat_sys_data_bluetooth.png
deleted file mode 100644 (file)
index 757dbf3..0000000
Binary files a/packages/SystemUI/res/drawable-xhdpi/stat_sys_data_bluetooth.png and /dev/null differ
diff --git a/packages/SystemUI/res/drawable-xhdpi/stat_sys_data_bluetooth_connected.png b/packages/SystemUI/res/drawable-xhdpi/stat_sys_data_bluetooth_connected.png
deleted file mode 100644 (file)
index d431dc2..0000000
Binary files a/packages/SystemUI/res/drawable-xhdpi/stat_sys_data_bluetooth_connected.png and /dev/null differ
diff --git a/packages/SystemUI/res/drawable-xxhdpi/stat_sys_data_bluetooth.png b/packages/SystemUI/res/drawable-xxhdpi/stat_sys_data_bluetooth.png
deleted file mode 100644 (file)
index 17ffdb9..0000000
Binary files a/packages/SystemUI/res/drawable-xxhdpi/stat_sys_data_bluetooth.png and /dev/null differ
diff --git a/packages/SystemUI/res/drawable-xxhdpi/stat_sys_data_bluetooth_connected.png b/packages/SystemUI/res/drawable-xxhdpi/stat_sys_data_bluetooth_connected.png
deleted file mode 100644 (file)
index 6ec234e..0000000
Binary files a/packages/SystemUI/res/drawable-xxhdpi/stat_sys_data_bluetooth_connected.png and /dev/null differ
diff --git a/packages/SystemUI/res/drawable/stat_sys_data_bluetooth.xml b/packages/SystemUI/res/drawable/stat_sys_data_bluetooth.xml
new file mode 100644 (file)
index 0000000..e28490b
--- /dev/null
@@ -0,0 +1,28 @@
+<!--
+Copyright (C) 2014 The Android Open Source Project
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+    you may not use this file except in compliance with the License.
+    You may obtain a copy of the License at
+
+         http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+-->
+<vector xmlns:android="http://schemas.android.com/apk/res/android" >
+    <size
+        android:width="18dp"
+        android:height="18dp"/>
+
+    <viewport
+        android:viewportWidth="48.0"
+        android:viewportHeight="48.0"/>
+
+    <path
+        android:fill="#FFFFFFFF"
+        android:pathData="M35.4,15.4L24.0,4.0l-2.0,0.0l0.0,15.2L12.8,10.0L10.0,12.8L21.2,24.0L10.0,35.2l2.8,2.8l9.2,-9.2L22.0,44.0l2.0,0.0l11.4,-11.4L26.8,24.0L35.4,15.4zM26.0,11.7l3.8,3.8L26.0,19.2L26.0,11.7zM29.8,32.6L26.0,36.3l0.0,-7.5L29.8,32.6z"/>
+</vector>
diff --git a/packages/SystemUI/res/drawable/stat_sys_data_bluetooth_connected.xml b/packages/SystemUI/res/drawable/stat_sys_data_bluetooth_connected.xml
new file mode 100644 (file)
index 0000000..c012d14
--- /dev/null
@@ -0,0 +1,28 @@
+<!--
+Copyright (C) 2014 The Android Open Source Project
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+    you may not use this file except in compliance with the License.
+    You may obtain a copy of the License at
+
+         http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+-->
+<vector xmlns:android="http://schemas.android.com/apk/res/android" >
+    <size
+        android:width="18dp"
+        android:height="18dp"/>
+
+    <viewport
+        android:viewportWidth="48.0"
+        android:viewportHeight="48.0"/>
+
+    <path
+        android:fill="#FFFFFFFF"
+        android:pathData="M14.0,24.0l-4.0,-4.0l-4.0,4.0l4.0,4.0L14.0,24.0zM35.4,15.4L24.0,4.0l-2.0,0.0l0.0,15.2L12.8,10.0L10.0,12.8L21.2,24.0L10.0,35.2l2.8,2.8l9.2,-9.2L22.0,44.0l2.0,0.0l11.4,-11.4L26.8,24.0L35.4,15.4zM26.0,11.7l3.8,3.8L26.0,19.2L26.0,11.7zM29.8,32.6L26.0,36.3l0.0,-7.5L29.8,32.6zM38.0,20.0l-4.0,4.0l4.0,4.0l4.0,-4.0L38.0,20.0z"/>
+</vector>
index 20ed629..7431e69 100644 (file)
@@ -84,7 +84,7 @@ public class BluetoothTile extends QSTile<QSTile.BooleanState>  {
             } else if (connecting) {
                 state.iconId = R.drawable.ic_qs_bluetooth_connecting;
                 stateContentDescription = mContext.getString(R.string.accessibility_desc_connecting);
-                state.label = mController.getLastDeviceName();
+                state.label = mContext.getString(R.string.quick_settings_bluetooth_label);
             } else {
                 state.iconId = R.drawable.ic_qs_bluetooth_on;
                 stateContentDescription = mContext.getString(R.string.accessibility_desc_on);
index 117bf61..379b509 100644 (file)
@@ -45,6 +45,7 @@ public class BluetoothControllerImpl extends BroadcastReceiver implements Blueto
         filter.addAction(BluetoothAdapter.ACTION_STATE_CHANGED);
         filter.addAction(BluetoothAdapter.ACTION_CONNECTION_STATE_CHANGED);
         filter.addAction(BluetoothDevice.ACTION_BOND_STATE_CHANGED);
+        filter.addAction(BluetoothDevice.ACTION_ALIAS_CHANGED);
         context.registerReceiver(this, filter);
 
         final BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter();
@@ -104,8 +105,8 @@ public class BluetoothControllerImpl extends BroadcastReceiver implements Blueto
 
     @Override
     public String getLastDeviceName() {
-        return mLastDevice != null ? mLastDevice.getName()
-                : mBondedDevices.size() == 1 ? mBondedDevices.iterator().next().getName()
+        return mLastDevice != null ? mLastDevice.getAliasName()
+                : mBondedDevices.size() == 1 ? mBondedDevices.iterator().next().getAliasName()
                 : null;
     }
 
@@ -122,6 +123,9 @@ public class BluetoothControllerImpl extends BroadcastReceiver implements Blueto
                     == BluetoothAdapter.STATE_CONNECTING;
             mLastDevice = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
         }
+        if (action.equals(BluetoothDevice.ACTION_ALIAS_CHANGED)) {
+            mLastDevice = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
+        }
         fireCallbacks();
         updateBondedBluetoothDevices();
     }