Move the bluetooth icon logic to settingslib

This cl contains the moving about:
1. Several methods in Bluetooth/Utils.java
2. Bluetooth icon drawables
3. Bluetooth strings
4. Tests

Bug: 65488978
Test: RunSettingslibRoboTests

Change-Id: I682daa3eeb5022beb90a95763c70d19d32d54915
This commit is contained in:
jackqdyulei
2017-09-18 13:43:43 -07:00
parent 9d31fa4c8f
commit 88a4b0b0e5
8 changed files with 14 additions and 226 deletions

View File

@@ -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);
}
}