diff --git a/res/drawable/ic_bt_laptop.xml b/res/drawable/ic_bt_laptop.xml
deleted file mode 100644
index 029e4d91343..00000000000
--- a/res/drawable/ic_bt_laptop.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-
-
-
-
\ No newline at end of file
diff --git a/res/drawable/ic_settings_bluetooth.xml b/res/drawable/ic_settings_bluetooth.xml
deleted file mode 100644
index 6e32e1a7f63..00000000000
--- a/res/drawable/ic_settings_bluetooth.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-
-
-
-
diff --git a/res/drawable/ic_settings_print.xml b/res/drawable/ic_settings_print.xml
deleted file mode 100644
index 0eab4021956..00000000000
--- a/res/drawable/ic_settings_print.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-
-
-
-
diff --git a/res/values/strings.xml b/res/values/strings.xml
index ad64069af0d..e7d3699c32e 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -8673,27 +8673,6 @@
~%1$s wait
-
- Computer
-
-
- Headset
-
-
- Phone
-
-
- Imaging
-
-
- Headphone
-
-
- Input Peripheral
-
-
- Bluetooth
-
Manage storage
diff --git a/src/com/android/settings/bluetooth/BluetoothDetailsHeaderController.java b/src/com/android/settings/bluetooth/BluetoothDetailsHeaderController.java
index 04e9f5a6803..df7b60150ff 100644
--- a/src/com/android/settings/bluetooth/BluetoothDetailsHeaderController.java
+++ b/src/com/android/settings/bluetooth/BluetoothDetailsHeaderController.java
@@ -51,8 +51,8 @@ public class BluetoothDetailsHeaderController extends BluetoothDetailsController
}
protected void setHeaderProperties() {
- final Pair pair = Utils.getBtClassDrawableWithDescription(
- mContext, mCachedDevice,
+ final Pair pair = com.android.settingslib.bluetooth.Utils
+ .getBtClassDrawableWithDescription(mContext, mCachedDevice,
mContext.getResources().getFraction(R.fraction.bt_battery_scale_fraction, 1, 1));
String summaryText = mCachedDevice.getConnectionSummary();
mHeaderController.setLabel(mCachedDevice.getName());
diff --git a/src/com/android/settings/bluetooth/BluetoothDevicePreference.java b/src/com/android/settings/bluetooth/BluetoothDevicePreference.java
index 94ba478c5b3..043cb957b08 100644
--- a/src/com/android/settings/bluetooth/BluetoothDevicePreference.java
+++ b/src/com/android/settings/bluetooth/BluetoothDevicePreference.java
@@ -122,8 +122,8 @@ public final class BluetoothDevicePreference extends GearPreference implements
// Null check is done at the framework
setSummary(mCachedDevice.getConnectionSummary());
- final Pair pair = Utils.getBtClassDrawableWithDescription(getContext(),
- mCachedDevice);
+ final Pair pair = com.android.settingslib.bluetooth.Utils
+ .getBtClassDrawableWithDescription(getContext(), mCachedDevice);
if (pair.first != null) {
setIcon(pair.first);
contentDescription = pair.second;
diff --git a/src/com/android/settings/bluetooth/Utils.java b/src/com/android/settings/bluetooth/Utils.java
index 0ecf62d20a1..d5d4e5081e9 100755
--- a/src/com/android/settings/bluetooth/Utils.java
+++ b/src/com/android/settings/bluetooth/Utils.java
@@ -17,31 +17,19 @@
package com.android.settings.bluetooth;
import android.app.AlertDialog;
-import android.bluetooth.BluetoothClass;
import android.bluetooth.BluetoothDevice;
import android.bluetooth.BluetoothProfile;
import android.content.Context;
import android.content.DialogInterface;
-import android.content.res.Resources;
-import android.graphics.drawable.Drawable;
-import android.support.annotation.DrawableRes;
-import android.support.annotation.IdRes;
import android.support.annotation.VisibleForTesting;
-import android.util.Pair;
import android.widget.Toast;
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
import com.android.settings.R;
import com.android.settings.overlay.FeatureFactory;
-import com.android.settingslib.bluetooth.CachedBluetoothDevice;
-import com.android.settingslib.bluetooth.HidProfile;
import com.android.settingslib.bluetooth.LocalBluetoothManager;
import com.android.settingslib.bluetooth.LocalBluetoothManager.BluetoothManagerCallback;
-import com.android.settingslib.bluetooth.LocalBluetoothProfile;
import com.android.settingslib.bluetooth.Utils.ErrorListener;
-import com.android.settingslib.graph.BluetoothDeviceLayerDrawable;
-
-import java.util.List;
/**
* Utils is a helper class that contains constants for various
@@ -57,16 +45,16 @@ public final class Utils {
public static int getConnectionStateSummary(int connectionState) {
switch (connectionState) {
- case BluetoothProfile.STATE_CONNECTED:
- return R.string.bluetooth_connected;
- case BluetoothProfile.STATE_CONNECTING:
- return R.string.bluetooth_connecting;
- case BluetoothProfile.STATE_DISCONNECTED:
- return R.string.bluetooth_disconnected;
- case BluetoothProfile.STATE_DISCONNECTING:
- return R.string.bluetooth_disconnecting;
- default:
- return 0;
+ case BluetoothProfile.STATE_CONNECTED:
+ return R.string.bluetooth_connected;
+ case BluetoothProfile.STATE_CONNECTING:
+ return R.string.bluetooth_connecting;
+ case BluetoothProfile.STATE_DISCONNECTED:
+ return R.string.bluetooth_disconnected;
+ case BluetoothProfile.STATE_DISCONNECTING:
+ return R.string.bluetooth_disconnecting;
+ default:
+ return 0;
}
}
@@ -154,81 +142,4 @@ public final class Utils {
}
};
- static Pair getBtClassDrawableWithDescription(Context context,
- CachedBluetoothDevice cachedDevice) {
- return getBtClassDrawableWithDescription(context, cachedDevice, 1 /* iconScale */);
- }
-
- static Pair getBtClassDrawableWithDescription(Context context,
- CachedBluetoothDevice cachedDevice, float iconScale) {
- BluetoothClass btClass = cachedDevice.getBtClass();
- final int level = cachedDevice.getBatteryLevel();
- if (btClass != null) {
- switch (btClass.getMajorDeviceClass()) {
- case BluetoothClass.Device.Major.COMPUTER:
- return new Pair<>(getBluetoothDrawable(context, R.drawable.ic_bt_laptop, level,
- iconScale),
- context.getString(R.string.bluetooth_talkback_computer));
-
- case BluetoothClass.Device.Major.PHONE:
- return new Pair<>(
- getBluetoothDrawable(context, R.drawable.ic_bt_cellphone, level,
- iconScale),
- context.getString(R.string.bluetooth_talkback_phone));
-
- case BluetoothClass.Device.Major.PERIPHERAL:
- return new Pair<>(
- getBluetoothDrawable(context, HidProfile.getHidClassDrawable(btClass),
- level, iconScale),
- context.getString(R.string.bluetooth_talkback_input_peripheral));
-
- case BluetoothClass.Device.Major.IMAGING:
- return new Pair<>(
- getBluetoothDrawable(context, R.drawable.ic_settings_print, level,
- iconScale),
- context.getString(R.string.bluetooth_talkback_imaging));
-
- default:
- // unrecognized device class; continue
- }
- }
-
- List profiles = cachedDevice.getProfiles();
- for (LocalBluetoothProfile profile : profiles) {
- int resId = profile.getDrawableResource(btClass);
- if (resId != 0) {
- return new Pair<>(getBluetoothDrawable(context, resId, level, iconScale), null);
- }
- }
- if (btClass != null) {
- if (btClass.doesClassMatch(BluetoothClass.PROFILE_HEADSET)) {
- return new Pair<>(
- getBluetoothDrawable(context, R.drawable.ic_bt_headset_hfp, level,
- iconScale),
- context.getString(R.string.bluetooth_talkback_headset));
- }
- if (btClass.doesClassMatch(BluetoothClass.PROFILE_A2DP)) {
- return new Pair<>(
- getBluetoothDrawable(context, R.drawable.ic_bt_headphones_a2dp, level,
- iconScale),
- context.getString(R.string.bluetooth_talkback_headphone));
- }
- }
- return new Pair<>(
- getBluetoothDrawable(context, R.drawable.ic_settings_bluetooth, level, iconScale),
- context.getString(R.string.bluetooth_talkback_bluetooth));
- }
-
- @VisibleForTesting
- static Drawable getBluetoothDrawable(Context context, @DrawableRes int resId,
- int batteryLevel, float iconScale) {
- if (batteryLevel != BluetoothDevice.BATTERY_LEVEL_UNKNOWN) {
- return BluetoothDeviceLayerDrawable.createLayerDrawable(context, resId, batteryLevel,
- iconScale);
- } else if (resId != 0) {
- return context.getDrawable(resId);
- } else {
- return null;
- }
- }
}
diff --git a/tests/robotests/src/com/android/settings/bluetooth/UtilsTest.java b/tests/robotests/src/com/android/settings/bluetooth/UtilsTest.java
index 220d8299f62..e0d46388f44 100644
--- a/tests/robotests/src/com/android/settings/bluetooth/UtilsTest.java
+++ b/tests/robotests/src/com/android/settings/bluetooth/UtilsTest.java
@@ -15,21 +15,15 @@
*/
package com.android.settings.bluetooth;
-import static com.google.common.truth.Truth.assertThat;
-
-import android.bluetooth.BluetoothDevice;
import android.content.Context;
-import android.graphics.drawable.Drawable;
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
-import com.android.settings.R;
import com.android.settings.testutils.SettingsRobolectricTestRunner;
import com.android.settings.TestConfig;
import com.android.settings.core.instrumentation.MetricsFeatureProvider;
import com.android.settings.testutils.FakeFeatureFactory;
import com.android.settings.testutils.shadow.SettingsShadowResources;
import com.android.settingslib.bluetooth.LocalBluetoothManager;
-import com.android.settingslib.graph.BluetoothDeviceLayerDrawable;
import org.junit.Before;
import org.junit.Test;
@@ -37,7 +31,6 @@ import org.junit.runner.RunWith;
import org.mockito.Answers;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
-import org.robolectric.RuntimeEnvironment;
import org.robolectric.annotation.Config;
import static org.mockito.Matchers.anyInt;
@@ -76,20 +69,4 @@ public class UtilsTest {
verify(mMetricsFeatureProvider).visible(eq(mContext), anyInt(),
eq(MetricsEvent.ACTION_SETTINGS_BLUETOOTH_CONNECT_ERROR));
}
-
- @Test
- public void testGetBluetoothDrawable_noBatteryLevel_returnSimpleDrawable() {
- final Drawable drawable = Utils.getBluetoothDrawable(RuntimeEnvironment.application,
- R.drawable.ic_bt_laptop, BluetoothDevice.BATTERY_LEVEL_UNKNOWN, 1 /* iconScale */);
-
- assertThat(drawable).isNotInstanceOf(BluetoothDeviceLayerDrawable.class);
- }
-
- @Test
- public void testGetBluetoothDrawable_hasBatteryLevel_returnLayerDrawable() {
- final Drawable drawable = Utils.getBluetoothDrawable(RuntimeEnvironment.application,
- R.drawable.ic_bt_laptop, 10 /* batteryLevel */, 1 /* iconScale */);
-
- assertThat(drawable).isInstanceOf(BluetoothDeviceLayerDrawable.class);
- }
}