Loading packages/SystemUI/src/com/android/systemui/qs/QSDetailItems.java +6 −1 Original line number Diff line number Diff line Loading @@ -184,7 +184,11 @@ public class QSDetailItems extends FrameLayout { } view.setVisibility(mItemsVisible ? VISIBLE : INVISIBLE); final ImageView iv = (ImageView) view.findViewById(android.R.id.icon); if (item.iconDrawable != null) { iv.setImageDrawable(item.iconDrawable); } else { iv.setImageResource(item.icon); } iv.getOverlay().clear(); if (item.overlay != null) { item.overlay.setBounds(0, 0, mQsDetailIconOverlaySize, mQsDetailIconOverlaySize); Loading Loading @@ -254,6 +258,7 @@ public class QSDetailItems extends FrameLayout { public static class Item { public int icon; public Drawable iconDrawable; public Drawable overlay; public CharSequence line1; public CharSequence line2; Loading packages/SystemUI/src/com/android/systemui/qs/tiles/BluetoothTile.java +15 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ package com.android.systemui.qs.tiles; import static com.android.settingslib.graph.BluetoothDeviceLayerDrawable.createLayerDrawable; import android.bluetooth.BluetoothAdapter; import android.bluetooth.BluetoothDevice; import android.bluetooth.BluetoothProfile; Loading @@ -32,8 +34,10 @@ import com.android.internal.logging.MetricsLogger; import com.android.internal.logging.nano.MetricsProto.MetricsEvent; import com.android.settingslib.Utils; import com.android.settingslib.bluetooth.CachedBluetoothDevice; import com.android.settingslib.graph.BluetoothDeviceLayerDrawable; import com.android.systemui.Dependency; import com.android.systemui.R; import com.android.systemui.R.drawable; import com.android.systemui.plugins.ActivityStarter; import com.android.systemui.plugins.qs.DetailAdapter; import com.android.systemui.plugins.qs.QSTile.BooleanState; Loading Loading @@ -127,6 +131,15 @@ public class BluetoothTile extends QSTileImpl<BooleanState> { if (connected) { state.icon = ResourceIcon.get(R.drawable.ic_qs_bluetooth_connected); state.label = mController.getLastDeviceName(); CachedBluetoothDevice lastDevice = mController.getLastDevice(); if (lastDevice != null) { int batteryLevel = lastDevice.getBatteryLevel(); if (batteryLevel != BluetoothDevice.BATTERY_LEVEL_UNKNOWN) { BluetoothDeviceLayerDrawable drawable = createLayerDrawable(mContext, R.drawable.ic_qs_bluetooth_connected, batteryLevel); state.icon = new DrawableIcon(drawable); } } state.contentDescription = mContext.getString( R.string.accessibility_bluetooth_name, state.label); } else if (state.isTransient) { Loading Loading @@ -278,6 +291,8 @@ public class BluetoothTile extends QSTileImpl<BooleanState> { item.icon = R.drawable.ic_qs_bluetooth_connected; int batteryLevel = device.getBatteryLevel(); if (batteryLevel != BluetoothDevice.BATTERY_LEVEL_UNKNOWN) { item.iconDrawable = createLayerDrawable(mContext, item.icon, batteryLevel); item.line2 = mContext.getString( R.string.quick_settings_connected_battery_level, Utils.formatPercentage(batteryLevel)); Loading packages/SystemUI/src/com/android/systemui/statusbar/policy/BluetoothController.java +1 −0 Original line number Diff line number Diff line Loading @@ -39,6 +39,7 @@ public interface BluetoothController extends CallbackController<Callback>, Dumpa int getMaxConnectionState(CachedBluetoothDevice device); int getBondState(CachedBluetoothDevice device); CachedBluetoothDevice getLastDevice(); public interface Callback { void onBluetoothStateChange(boolean enabled); Loading packages/SystemUI/src/com/android/systemui/statusbar/policy/BluetoothControllerImpl.java +5 −0 Original line number Diff line number Diff line Loading @@ -120,6 +120,11 @@ public class BluetoothControllerImpl implements BluetoothController, BluetoothCa return getCachedState(device).mBondState; } @Override public CachedBluetoothDevice getLastDevice() { return mLastDevice; } @Override public int getMaxConnectionState(CachedBluetoothDevice device) { return getCachedState(device).mMaxConnectionState; Loading packages/SystemUI/tests/src/com/android/systemui/utils/leaks/FakeBluetoothController.java +5 −0 Original line number Diff line number Diff line Loading @@ -93,4 +93,9 @@ public class FakeBluetoothController extends BaseLeakChecker<Callback> implement public int getBondState(CachedBluetoothDevice device) { return 0; } @Override public CachedBluetoothDevice getLastDevice() { return null; } } Loading
packages/SystemUI/src/com/android/systemui/qs/QSDetailItems.java +6 −1 Original line number Diff line number Diff line Loading @@ -184,7 +184,11 @@ public class QSDetailItems extends FrameLayout { } view.setVisibility(mItemsVisible ? VISIBLE : INVISIBLE); final ImageView iv = (ImageView) view.findViewById(android.R.id.icon); if (item.iconDrawable != null) { iv.setImageDrawable(item.iconDrawable); } else { iv.setImageResource(item.icon); } iv.getOverlay().clear(); if (item.overlay != null) { item.overlay.setBounds(0, 0, mQsDetailIconOverlaySize, mQsDetailIconOverlaySize); Loading Loading @@ -254,6 +258,7 @@ public class QSDetailItems extends FrameLayout { public static class Item { public int icon; public Drawable iconDrawable; public Drawable overlay; public CharSequence line1; public CharSequence line2; Loading
packages/SystemUI/src/com/android/systemui/qs/tiles/BluetoothTile.java +15 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ package com.android.systemui.qs.tiles; import static com.android.settingslib.graph.BluetoothDeviceLayerDrawable.createLayerDrawable; import android.bluetooth.BluetoothAdapter; import android.bluetooth.BluetoothDevice; import android.bluetooth.BluetoothProfile; Loading @@ -32,8 +34,10 @@ import com.android.internal.logging.MetricsLogger; import com.android.internal.logging.nano.MetricsProto.MetricsEvent; import com.android.settingslib.Utils; import com.android.settingslib.bluetooth.CachedBluetoothDevice; import com.android.settingslib.graph.BluetoothDeviceLayerDrawable; import com.android.systemui.Dependency; import com.android.systemui.R; import com.android.systemui.R.drawable; import com.android.systemui.plugins.ActivityStarter; import com.android.systemui.plugins.qs.DetailAdapter; import com.android.systemui.plugins.qs.QSTile.BooleanState; Loading Loading @@ -127,6 +131,15 @@ public class BluetoothTile extends QSTileImpl<BooleanState> { if (connected) { state.icon = ResourceIcon.get(R.drawable.ic_qs_bluetooth_connected); state.label = mController.getLastDeviceName(); CachedBluetoothDevice lastDevice = mController.getLastDevice(); if (lastDevice != null) { int batteryLevel = lastDevice.getBatteryLevel(); if (batteryLevel != BluetoothDevice.BATTERY_LEVEL_UNKNOWN) { BluetoothDeviceLayerDrawable drawable = createLayerDrawable(mContext, R.drawable.ic_qs_bluetooth_connected, batteryLevel); state.icon = new DrawableIcon(drawable); } } state.contentDescription = mContext.getString( R.string.accessibility_bluetooth_name, state.label); } else if (state.isTransient) { Loading Loading @@ -278,6 +291,8 @@ public class BluetoothTile extends QSTileImpl<BooleanState> { item.icon = R.drawable.ic_qs_bluetooth_connected; int batteryLevel = device.getBatteryLevel(); if (batteryLevel != BluetoothDevice.BATTERY_LEVEL_UNKNOWN) { item.iconDrawable = createLayerDrawable(mContext, item.icon, batteryLevel); item.line2 = mContext.getString( R.string.quick_settings_connected_battery_level, Utils.formatPercentage(batteryLevel)); Loading
packages/SystemUI/src/com/android/systemui/statusbar/policy/BluetoothController.java +1 −0 Original line number Diff line number Diff line Loading @@ -39,6 +39,7 @@ public interface BluetoothController extends CallbackController<Callback>, Dumpa int getMaxConnectionState(CachedBluetoothDevice device); int getBondState(CachedBluetoothDevice device); CachedBluetoothDevice getLastDevice(); public interface Callback { void onBluetoothStateChange(boolean enabled); Loading
packages/SystemUI/src/com/android/systemui/statusbar/policy/BluetoothControllerImpl.java +5 −0 Original line number Diff line number Diff line Loading @@ -120,6 +120,11 @@ public class BluetoothControllerImpl implements BluetoothController, BluetoothCa return getCachedState(device).mBondState; } @Override public CachedBluetoothDevice getLastDevice() { return mLastDevice; } @Override public int getMaxConnectionState(CachedBluetoothDevice device) { return getCachedState(device).mMaxConnectionState; Loading
packages/SystemUI/tests/src/com/android/systemui/utils/leaks/FakeBluetoothController.java +5 −0 Original line number Diff line number Diff line Loading @@ -93,4 +93,9 @@ public class FakeBluetoothController extends BaseLeakChecker<Callback> implement public int getBondState(CachedBluetoothDevice device) { return 0; } @Override public CachedBluetoothDevice getLastDevice() { return null; } }