Loading packages/SystemUI/src/com/android/systemui/media/taptotransfer/MediaTttCommandLineHelper.kt +19 −4 Original line number Diff line number Diff line Loading @@ -71,20 +71,32 @@ class MediaTttCommandLineHelper @Inject constructor( when (args[1]) { MOVE_CLOSER_TO_TRANSFER_COMMAND_NAME -> { mediaTttChipControllerSender.displayChip( MoveCloserToTransfer(appIconDrawable, otherDeviceName) MoveCloserToTransfer( appIconDrawable, APP_ICON_CONTENT_DESCRIPTION, otherDeviceName ) ) } TRANSFER_INITIATED_COMMAND_NAME -> { val futureTask = FutureTask { fakeUndoRunnable } mediaTttChipControllerSender.displayChip( TransferInitiated(appIconDrawable, otherDeviceName, futureTask) TransferInitiated( appIconDrawable, APP_ICON_CONTENT_DESCRIPTION, otherDeviceName, futureTask ) ) mainExecutor.executeDelayed({ futureTask.run() }, FUTURE_WAIT_TIME) } TRANSFER_SUCCEEDED_COMMAND_NAME -> { mediaTttChipControllerSender.displayChip( TransferSucceeded(appIconDrawable, otherDeviceName, fakeUndoRunnable) TransferSucceeded( appIconDrawable, APP_ICON_CONTENT_DESCRIPTION, otherDeviceName, fakeUndoRunnable ) ) } else -> { Loading Loading @@ -118,7 +130,9 @@ class MediaTttCommandLineHelper @Inject constructor( /** A command to DISPLAY the media ttt chip on the RECEIVER device. */ inner class AddChipCommandReceiver : Command { override fun execute(pw: PrintWriter, args: List<String>) { mediaTttChipControllerReceiver.displayChip(ChipStateReceiver(appIconDrawable)) mediaTttChipControllerReceiver.displayChip( ChipStateReceiver(appIconDrawable, APP_ICON_CONTENT_DESCRIPTION) ) } override fun help(pw: PrintWriter) { pw.println("Usage: adb shell cmd statusbar $ADD_CHIP_COMMAND_RECEIVER_TAG") Loading Loading @@ -156,4 +170,5 @@ val TRANSFER_INITIATED_COMMAND_NAME = TransferInitiated::class.simpleName!! val TRANSFER_SUCCEEDED_COMMAND_NAME = TransferSucceeded::class.simpleName!! private const val FUTURE_WAIT_TIME = 2000L private const val APP_ICON_CONTENT_DESCRIPTION = "Fake media app icon" private const val TAG = "MediaTapToTransferCli" packages/SystemUI/src/com/android/systemui/media/taptotransfer/common/MediaTttChipControllerCommon.kt +1 −0 Original line number Diff line number Diff line Loading @@ -99,6 +99,7 @@ abstract class MediaTttChipControllerCommon<T : MediaTttChipState>( internal fun setIcon(chipState: T, currentChipView: ViewGroup) { currentChipView.findViewById<CachingIconView>(R.id.app_icon).apply { this.setImageDrawable(chipState.appIconDrawable) this.contentDescription = chipState.appIconContentDescription } } } packages/SystemUI/src/com/android/systemui/media/taptotransfer/common/MediaTttChipState.kt +3 −1 Original line number Diff line number Diff line Loading @@ -22,7 +22,9 @@ import android.graphics.drawable.Drawable * A superclass chip state that will be subclassed by the sender chip and receiver chip. * * @property appIconDrawable a drawable representing the icon of the app playing the media. * @property appIconContentDescription a string to use as the content description for the icon. */ open class MediaTttChipState( internal val appIconDrawable: Drawable internal val appIconDrawable: Drawable, internal val appIconContentDescription: String ) packages/SystemUI/src/com/android/systemui/media/taptotransfer/receiver/ChipStateReceiver.kt +3 −2 Original line number Diff line number Diff line Loading @@ -24,5 +24,6 @@ import com.android.systemui.media.taptotransfer.common.MediaTttChipState * the receiver device. */ class ChipStateReceiver( appIconDrawable: Drawable ) : MediaTttChipState(appIconDrawable) appIconDrawable: Drawable, appIconContentDescription: String ) : MediaTttChipState(appIconDrawable, appIconContentDescription) packages/SystemUI/src/com/android/systemui/media/taptotransfer/sender/ChipStateSender.kt +22 −4 Original line number Diff line number Diff line Loading @@ -34,9 +34,10 @@ import java.util.concurrent.Future */ sealed class ChipStateSender( appIconDrawable: Drawable, appIconContentDescription: String, @StringRes internal val chipText: Int, internal val otherDeviceName: String, ) : MediaTttChipState(appIconDrawable) ) : MediaTttChipState(appIconDrawable, appIconContentDescription) /** * A state representing that the two devices are close but not close enough to initiate a transfer. Loading @@ -44,8 +45,14 @@ sealed class ChipStateSender( */ class MoveCloserToTransfer( appIconDrawable: Drawable, appIconContentDescription: String, otherDeviceName: String, ) : ChipStateSender(appIconDrawable, R.string.media_move_closer_to_transfer, otherDeviceName) ) : ChipStateSender( appIconDrawable, appIconContentDescription, R.string.media_move_closer_to_transfer, otherDeviceName ) /** * A state representing that a transfer has been initiated (but not completed). Loading @@ -57,9 +64,15 @@ class MoveCloserToTransfer( */ class TransferInitiated( appIconDrawable: Drawable, appIconContentDescription: String, otherDeviceName: String, val future: Future<Runnable?> ) : ChipStateSender(appIconDrawable, R.string.media_transfer_playing, otherDeviceName) ) : ChipStateSender( appIconDrawable, appIconContentDescription, R.string.media_transfer_playing, otherDeviceName ) /** * A state representing that a transfer has been successfully completed. Loading @@ -69,6 +82,11 @@ class TransferInitiated( */ class TransferSucceeded( appIconDrawable: Drawable, appIconContentDescription: String, otherDeviceName: String, val undoRunnable: Runnable? = null ) : ChipStateSender(appIconDrawable, R.string.media_transfer_playing, otherDeviceName) ) : ChipStateSender(appIconDrawable, appIconContentDescription, R.string.media_transfer_playing, otherDeviceName ) Loading
packages/SystemUI/src/com/android/systemui/media/taptotransfer/MediaTttCommandLineHelper.kt +19 −4 Original line number Diff line number Diff line Loading @@ -71,20 +71,32 @@ class MediaTttCommandLineHelper @Inject constructor( when (args[1]) { MOVE_CLOSER_TO_TRANSFER_COMMAND_NAME -> { mediaTttChipControllerSender.displayChip( MoveCloserToTransfer(appIconDrawable, otherDeviceName) MoveCloserToTransfer( appIconDrawable, APP_ICON_CONTENT_DESCRIPTION, otherDeviceName ) ) } TRANSFER_INITIATED_COMMAND_NAME -> { val futureTask = FutureTask { fakeUndoRunnable } mediaTttChipControllerSender.displayChip( TransferInitiated(appIconDrawable, otherDeviceName, futureTask) TransferInitiated( appIconDrawable, APP_ICON_CONTENT_DESCRIPTION, otherDeviceName, futureTask ) ) mainExecutor.executeDelayed({ futureTask.run() }, FUTURE_WAIT_TIME) } TRANSFER_SUCCEEDED_COMMAND_NAME -> { mediaTttChipControllerSender.displayChip( TransferSucceeded(appIconDrawable, otherDeviceName, fakeUndoRunnable) TransferSucceeded( appIconDrawable, APP_ICON_CONTENT_DESCRIPTION, otherDeviceName, fakeUndoRunnable ) ) } else -> { Loading Loading @@ -118,7 +130,9 @@ class MediaTttCommandLineHelper @Inject constructor( /** A command to DISPLAY the media ttt chip on the RECEIVER device. */ inner class AddChipCommandReceiver : Command { override fun execute(pw: PrintWriter, args: List<String>) { mediaTttChipControllerReceiver.displayChip(ChipStateReceiver(appIconDrawable)) mediaTttChipControllerReceiver.displayChip( ChipStateReceiver(appIconDrawable, APP_ICON_CONTENT_DESCRIPTION) ) } override fun help(pw: PrintWriter) { pw.println("Usage: adb shell cmd statusbar $ADD_CHIP_COMMAND_RECEIVER_TAG") Loading Loading @@ -156,4 +170,5 @@ val TRANSFER_INITIATED_COMMAND_NAME = TransferInitiated::class.simpleName!! val TRANSFER_SUCCEEDED_COMMAND_NAME = TransferSucceeded::class.simpleName!! private const val FUTURE_WAIT_TIME = 2000L private const val APP_ICON_CONTENT_DESCRIPTION = "Fake media app icon" private const val TAG = "MediaTapToTransferCli"
packages/SystemUI/src/com/android/systemui/media/taptotransfer/common/MediaTttChipControllerCommon.kt +1 −0 Original line number Diff line number Diff line Loading @@ -99,6 +99,7 @@ abstract class MediaTttChipControllerCommon<T : MediaTttChipState>( internal fun setIcon(chipState: T, currentChipView: ViewGroup) { currentChipView.findViewById<CachingIconView>(R.id.app_icon).apply { this.setImageDrawable(chipState.appIconDrawable) this.contentDescription = chipState.appIconContentDescription } } }
packages/SystemUI/src/com/android/systemui/media/taptotransfer/common/MediaTttChipState.kt +3 −1 Original line number Diff line number Diff line Loading @@ -22,7 +22,9 @@ import android.graphics.drawable.Drawable * A superclass chip state that will be subclassed by the sender chip and receiver chip. * * @property appIconDrawable a drawable representing the icon of the app playing the media. * @property appIconContentDescription a string to use as the content description for the icon. */ open class MediaTttChipState( internal val appIconDrawable: Drawable internal val appIconDrawable: Drawable, internal val appIconContentDescription: String )
packages/SystemUI/src/com/android/systemui/media/taptotransfer/receiver/ChipStateReceiver.kt +3 −2 Original line number Diff line number Diff line Loading @@ -24,5 +24,6 @@ import com.android.systemui.media.taptotransfer.common.MediaTttChipState * the receiver device. */ class ChipStateReceiver( appIconDrawable: Drawable ) : MediaTttChipState(appIconDrawable) appIconDrawable: Drawable, appIconContentDescription: String ) : MediaTttChipState(appIconDrawable, appIconContentDescription)
packages/SystemUI/src/com/android/systemui/media/taptotransfer/sender/ChipStateSender.kt +22 −4 Original line number Diff line number Diff line Loading @@ -34,9 +34,10 @@ import java.util.concurrent.Future */ sealed class ChipStateSender( appIconDrawable: Drawable, appIconContentDescription: String, @StringRes internal val chipText: Int, internal val otherDeviceName: String, ) : MediaTttChipState(appIconDrawable) ) : MediaTttChipState(appIconDrawable, appIconContentDescription) /** * A state representing that the two devices are close but not close enough to initiate a transfer. Loading @@ -44,8 +45,14 @@ sealed class ChipStateSender( */ class MoveCloserToTransfer( appIconDrawable: Drawable, appIconContentDescription: String, otherDeviceName: String, ) : ChipStateSender(appIconDrawable, R.string.media_move_closer_to_transfer, otherDeviceName) ) : ChipStateSender( appIconDrawable, appIconContentDescription, R.string.media_move_closer_to_transfer, otherDeviceName ) /** * A state representing that a transfer has been initiated (but not completed). Loading @@ -57,9 +64,15 @@ class MoveCloserToTransfer( */ class TransferInitiated( appIconDrawable: Drawable, appIconContentDescription: String, otherDeviceName: String, val future: Future<Runnable?> ) : ChipStateSender(appIconDrawable, R.string.media_transfer_playing, otherDeviceName) ) : ChipStateSender( appIconDrawable, appIconContentDescription, R.string.media_transfer_playing, otherDeviceName ) /** * A state representing that a transfer has been successfully completed. Loading @@ -69,6 +82,11 @@ class TransferInitiated( */ class TransferSucceeded( appIconDrawable: Drawable, appIconContentDescription: String, otherDeviceName: String, val undoRunnable: Runnable? = null ) : ChipStateSender(appIconDrawable, R.string.media_transfer_playing, otherDeviceName) ) : ChipStateSender(appIconDrawable, appIconContentDescription, R.string.media_transfer_playing, otherDeviceName )