diff --git a/packages/SystemUI/res/drawable/qs_screen_record_icon_off.xml b/packages/SystemUI/res/drawable/qs_screen_record_icon_off.xml new file mode 100644 index 0000000000000..b3bdd361398df --- /dev/null +++ b/packages/SystemUI/res/drawable/qs_screen_record_icon_off.xml @@ -0,0 +1,218 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/packages/SystemUI/res/drawable/qs_screen_record_icon_on.xml b/packages/SystemUI/res/drawable/qs_screen_record_icon_on.xml new file mode 100644 index 0000000000000..facbef5e43485 --- /dev/null +++ b/packages/SystemUI/res/drawable/qs_screen_record_icon_on.xml @@ -0,0 +1,286 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/ScreenRecordTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/ScreenRecordTile.java index 75fb393d84b56..f63f0444210b8 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tiles/ScreenRecordTile.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/ScreenRecordTile.java @@ -120,7 +120,9 @@ public class ScreenRecordTile extends QSTileImpl state.value = isRecording || isStarting; state.state = (isRecording || isStarting) ? Tile.STATE_ACTIVE : Tile.STATE_INACTIVE; state.label = mContext.getString(R.string.quick_settings_screen_record_label); - state.icon = ResourceIcon.get(R.drawable.ic_screenrecord); + state.icon = ResourceIcon.get(state.value + ? R.drawable.qs_screen_record_icon_on + : R.drawable.qs_screen_record_icon_off); // Show expand icon when clicking will open a dialog state.forceExpandIcon = state.state == Tile.STATE_INACTIVE; diff --git a/packages/SystemUI/tests/src/com/android/systemui/qs/tiles/ScreenRecordTileTest.java b/packages/SystemUI/tests/src/com/android/systemui/qs/tiles/ScreenRecordTileTest.java index e6bd396ebc6ce..30debdf4b7440 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/qs/tiles/ScreenRecordTileTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/qs/tiles/ScreenRecordTileTest.java @@ -41,9 +41,11 @@ import com.android.systemui.animation.DialogLaunchAnimator; import com.android.systemui.classifier.FalsingManagerFake; import com.android.systemui.flags.FeatureFlags; import com.android.systemui.plugins.ActivityStarter; +import com.android.systemui.plugins.qs.QSTile; import com.android.systemui.plugins.statusbar.StatusBarStateController; import com.android.systemui.qs.QSTileHost; import com.android.systemui.qs.logging.QSLogger; +import com.android.systemui.qs.tileimpl.QSTileImpl; import com.android.systemui.screenrecord.RecordingController; import com.android.systemui.statusbar.phone.KeyguardDismissUtil; import com.android.systemui.statusbar.policy.KeyguardStateController; @@ -229,4 +231,38 @@ public class ScreenRecordTileTest extends SysuiTestCase { assertFalse(mTile.getState().forceExpandIcon); } + + @Test + public void testIcon_whenRecording_isOnState() { + when(mController.isStarting()).thenReturn(false); + when(mController.isRecording()).thenReturn(true); + QSTile.BooleanState state = new QSTile.BooleanState(); + + mTile.handleUpdateState(state, /* arg= */ null); + + assertEquals(state.icon, QSTileImpl.ResourceIcon.get(R.drawable.qs_screen_record_icon_on)); + } + + @Test + public void testIcon_whenStarting_isOnState() { + when(mController.isStarting()).thenReturn(true); + when(mController.isRecording()).thenReturn(false); + QSTile.BooleanState state = new QSTile.BooleanState(); + + mTile.handleUpdateState(state, /* arg= */ null); + + assertEquals(state.icon, QSTileImpl.ResourceIcon.get(R.drawable.qs_screen_record_icon_on)); + } + + @Test + public void testIcon_whenRecordingOff_isOffState() { + when(mController.isStarting()).thenReturn(false); + when(mController.isRecording()).thenReturn(false); + QSTile.BooleanState state = new QSTile.BooleanState(); + + mTile.handleUpdateState(state, /* arg= */ null); + + assertEquals(state.icon, QSTileImpl.ResourceIcon.get(R.drawable.qs_screen_record_icon_off)); + } + }