diff options
4 files changed, 24 insertions, 21 deletions
diff --git a/packages/SystemUI/aconfig/systemui.aconfig b/packages/SystemUI/aconfig/systemui.aconfig index f0c855753292..8a049258c8d1 100644 --- a/packages/SystemUI/aconfig/systemui.aconfig +++ b/packages/SystemUI/aconfig/systemui.aconfig @@ -1328,10 +1328,13 @@ flag { } flag { - name: "media_controls_drawables_reuse" + name: "media_controls_drawables_reuse_bugfix" namespace: "systemui" description: "Re-use created media drawables for media controls" bug: "358402034" + metadata { + purpose: PURPOSE_BUGFIX + } } flag { diff --git a/packages/SystemUI/src/com/android/systemui/media/controls/shared/MediaControlDrawables.kt b/packages/SystemUI/src/com/android/systemui/media/controls/shared/MediaControlDrawables.kt index 95ca11c9b451..ec329d3f9d0b 100644 --- a/packages/SystemUI/src/com/android/systemui/media/controls/shared/MediaControlDrawables.kt +++ b/packages/SystemUI/src/com/android/systemui/media/controls/shared/MediaControlDrawables.kt @@ -18,7 +18,7 @@ package com.android.systemui.media.controls.shared import android.content.Context import android.graphics.drawable.Drawable -import com.android.systemui.Flags.mediaControlsDrawablesReuse +import com.android.systemui.Flags.mediaControlsDrawablesReuseBugfix import com.android.systemui.res.R object MediaControlDrawables { @@ -34,21 +34,21 @@ object MediaControlDrawables { private var homeDevices: Drawable? = null fun getNextIcon(context: Context): Drawable? { - if (!mediaControlsDrawablesReuse()) { + if (!mediaControlsDrawablesReuseBugfix()) { return context.getDrawable(R.drawable.ic_media_next) } return nextIcon ?: context.getDrawable(R.drawable.ic_media_next).also { nextIcon = it } } fun getPrevIcon(context: Context): Drawable? { - if (!mediaControlsDrawablesReuse()) { + if (!mediaControlsDrawablesReuseBugfix()) { return context.getDrawable(R.drawable.ic_media_prev) } return prevIcon ?: context.getDrawable(R.drawable.ic_media_prev).also { prevIcon = it } } fun getLeAudioSharing(context: Context): Drawable? { - if (!mediaControlsDrawablesReuse()) { + if (!mediaControlsDrawablesReuseBugfix()) { return context.getDrawable(com.android.settingslib.R.drawable.ic_bt_le_audio_sharing) } return leAudioSharing @@ -58,7 +58,7 @@ object MediaControlDrawables { } fun getAntenna(context: Context): Drawable? { - if (!mediaControlsDrawablesReuse()) { + if (!mediaControlsDrawablesReuseBugfix()) { return context.getDrawable(R.drawable.settings_input_antenna) } return antenna @@ -66,7 +66,7 @@ object MediaControlDrawables { } fun getGroupDevice(context: Context): Drawable? { - if (!mediaControlsDrawablesReuse()) { + if (!mediaControlsDrawablesReuseBugfix()) { return context.getDrawable(com.android.settingslib.R.drawable.ic_media_group_device) } return groupDevice @@ -76,7 +76,7 @@ object MediaControlDrawables { } fun getHomeDevices(context: Context): Drawable? { - if (!mediaControlsDrawablesReuse()) { + if (!mediaControlsDrawablesReuseBugfix()) { return context.getDrawable(R.drawable.ic_media_home_devices) } return homeDevices diff --git a/packages/SystemUI/tests/src/com/android/systemui/media/controls/domain/pipeline/MediaDataProcessorTest.kt b/packages/SystemUI/tests/src/com/android/systemui/media/controls/domain/pipeline/MediaDataProcessorTest.kt index 92904962339c..042d30ee23a2 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/media/controls/domain/pipeline/MediaDataProcessorTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/media/controls/domain/pipeline/MediaDataProcessorTest.kt @@ -1522,7 +1522,7 @@ class MediaDataProcessorTest(flags: FlagsParameterization) : SysuiTestCase() { } @Test - @EnableFlags(Flags.FLAG_MEDIA_CONTROLS_DRAWABLES_REUSE) + @EnableFlags(Flags.FLAG_MEDIA_CONTROLS_DRAWABLES_REUSE_BUGFIX) fun postWithPlaybackActions_drawablesReused() { whenever(notificationLockscreenUserManager.isCurrentProfile(USER_ID)).thenReturn(true) whenever(notificationLockscreenUserManager.isProfileAvailable(USER_ID)).thenReturn(true) @@ -1555,7 +1555,7 @@ class MediaDataProcessorTest(flags: FlagsParameterization) : SysuiTestCase() { } @Test - @DisableFlags(Flags.FLAG_MEDIA_CONTROLS_DRAWABLES_REUSE) + @DisableFlags(Flags.FLAG_MEDIA_CONTROLS_DRAWABLES_REUSE_BUGFIX) fun postWithPlaybackActions_drawablesNotReused() { whenever(notificationLockscreenUserManager.isCurrentProfile(USER_ID)).thenReturn(true) whenever(notificationLockscreenUserManager.isProfileAvailable(USER_ID)).thenReturn(true) diff --git a/packages/SystemUI/tests/src/com/android/systemui/media/controls/domain/pipeline/MediaDeviceManagerTest.kt b/packages/SystemUI/tests/src/com/android/systemui/media/controls/domain/pipeline/MediaDeviceManagerTest.kt index 0c8d88065a73..175e8d4331a1 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/media/controls/domain/pipeline/MediaDeviceManagerTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/media/controls/domain/pipeline/MediaDeviceManagerTest.kt @@ -169,7 +169,7 @@ public class MediaDeviceManagerTest : SysuiTestCase() { context.orCreateTestableResources.addOverride( R.drawable.ic_media_home_devices, - OTHER_DEVICE_ICON_STUB + OTHER_DEVICE_ICON_STUB, ) } @@ -384,7 +384,7 @@ public class MediaDeviceManagerTest : SysuiTestCase() { deviceCallback.onAboutToConnectDeviceAdded( "fakeAddress", "AboutToConnectDeviceName", - mock(Drawable::class.java) + mock(Drawable::class.java), ) // Run and reset the executors and listeners so we only focus on new events. fakeBgExecutor.runAllReady() @@ -423,7 +423,7 @@ public class MediaDeviceManagerTest : SysuiTestCase() { } @Test - @EnableFlags(com.android.systemui.Flags.FLAG_MEDIA_CONTROLS_DRAWABLES_REUSE) + @EnableFlags(com.android.systemui.Flags.FLAG_MEDIA_CONTROLS_DRAWABLES_REUSE_BUGFIX) fun onMediaDataLoaded_withRemotePlaybackType_usesNonNullRoutingSessionName_drawableReused() { whenever(routingSession.name).thenReturn(REMOTE_DEVICE_NAME) whenever(routingSession.selectedRoutes).thenReturn(listOf("selectedRoute", "selectedRoute")) @@ -437,7 +437,7 @@ public class MediaDeviceManagerTest : SysuiTestCase() { } @Test - @DisableFlags(com.android.systemui.Flags.FLAG_MEDIA_CONTROLS_DRAWABLES_REUSE) + @DisableFlags(com.android.systemui.Flags.FLAG_MEDIA_CONTROLS_DRAWABLES_REUSE_BUGFIX) fun onMediaDataLoaded_withRemotePlaybackType_usesNonNullRoutingSessionName_drawableNotReused() { whenever(routingSession.name).thenReturn(REMOTE_DEVICE_NAME) whenever(routingSession.selectedRoutes).thenReturn(listOf("selectedRoute", "selectedRoute")) @@ -479,7 +479,7 @@ public class MediaDeviceManagerTest : SysuiTestCase() { @Test @RequiresFlagsEnabled(FLAG_USE_PLAYBACK_INFO_FOR_ROUTING_CONTROLS) - @EnableFlags(com.android.systemui.Flags.FLAG_MEDIA_CONTROLS_DRAWABLES_REUSE) + @EnableFlags(com.android.systemui.Flags.FLAG_MEDIA_CONTROLS_DRAWABLES_REUSE_BUGFIX) fun onMediaDataLoaded_withRemotePlaybackInfo_noMatchingRoutingSession_drawableReused() { whenever(playbackInfo.playbackType).thenReturn(PlaybackInfo.PLAYBACK_TYPE_REMOTE) whenever(mr2.getRoutingSessionForMediaController(any())).thenReturn(null) @@ -494,7 +494,7 @@ public class MediaDeviceManagerTest : SysuiTestCase() { @Test @RequiresFlagsEnabled(FLAG_USE_PLAYBACK_INFO_FOR_ROUTING_CONTROLS) - @DisableFlags(com.android.systemui.Flags.FLAG_MEDIA_CONTROLS_DRAWABLES_REUSE) + @DisableFlags(com.android.systemui.Flags.FLAG_MEDIA_CONTROLS_DRAWABLES_REUSE_BUGFIX) fun onMediaDataLoaded_withRemotePlaybackInfo_noMatchingRoutingSession_drawableNotReused() { whenever(playbackInfo.playbackType).thenReturn(PlaybackInfo.PLAYBACK_TYPE_REMOTE) whenever(mr2.getRoutingSessionForMediaController(any())).thenReturn(null) @@ -856,7 +856,7 @@ public class MediaDeviceManagerTest : SysuiTestCase() { @DisableFlags(Flags.FLAG_LEGACY_LE_AUDIO_SHARING) @EnableFlags( Flags.FLAG_ENABLE_LE_AUDIO_SHARING, - com.android.systemui.Flags.FLAG_MEDIA_CONTROLS_DRAWABLES_REUSE + com.android.systemui.Flags.FLAG_MEDIA_CONTROLS_DRAWABLES_REUSE_BUGFIX, ) fun onBroadcastStarted_currentMediaDeviceDataIsBroadcasting_drawablesReused() { val broadcastCallback = setupBroadcastCallback() @@ -874,7 +874,7 @@ public class MediaDeviceManagerTest : SysuiTestCase() { @Test @DisableFlags( Flags.FLAG_LEGACY_LE_AUDIO_SHARING, - com.android.systemui.Flags.FLAG_MEDIA_CONTROLS_DRAWABLES_REUSE + com.android.systemui.Flags.FLAG_MEDIA_CONTROLS_DRAWABLES_REUSE_BUGFIX, ) @EnableFlags(Flags.FLAG_ENABLE_LE_AUDIO_SHARING) fun onBroadcastStarted_currentMediaDeviceDataIsBroadcasting_drawablesNotReused() { @@ -893,7 +893,7 @@ public class MediaDeviceManagerTest : SysuiTestCase() { @Test @EnableFlags( Flags.FLAG_LEGACY_LE_AUDIO_SHARING, - com.android.systemui.Flags.FLAG_MEDIA_CONTROLS_DRAWABLES_REUSE + com.android.systemui.Flags.FLAG_MEDIA_CONTROLS_DRAWABLES_REUSE_BUGFIX, ) @DisableFlags(Flags.FLAG_ENABLE_LE_AUDIO_SHARING) fun onBroadcastStarted_legacy_currentMediaDeviceDataIsNotBroadcasting_drawableReused() { @@ -913,7 +913,7 @@ public class MediaDeviceManagerTest : SysuiTestCase() { @EnableFlags(Flags.FLAG_LEGACY_LE_AUDIO_SHARING) @DisableFlags( Flags.FLAG_ENABLE_LE_AUDIO_SHARING, - com.android.systemui.Flags.FLAG_MEDIA_CONTROLS_DRAWABLES_REUSE + com.android.systemui.Flags.FLAG_MEDIA_CONTROLS_DRAWABLES_REUSE_BUGFIX, ) fun onBroadcastStarted_legacy_currentMediaDeviceDataIsNotBroadcasting_drawableNotReused() { val broadcastCallback = setupBroadcastCallback() @@ -984,7 +984,7 @@ public class MediaDeviceManagerTest : SysuiTestCase() { override fun onBroadcastMetadataChanged( broadcastId: Int, - metadata: BluetoothLeBroadcastMetadata + metadata: BluetoothLeBroadcastMetadata, ) {} } |