Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 86ee8183 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Add dismiss intent and method for MediaOutputDialog"

parents 8588a8bc f6ee792f
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -776,6 +776,7 @@
                  android:exported="true">
            <intent-filter>
                <action android:name="com.android.systemui.action.LAUNCH_MEDIA_OUTPUT_DIALOG" />
                <action android:name="com.android.systemui.action.DISMISS_MEDIA_OUTPUT_DIALOG" />
            </intent-filter>
        </receiver>

+14 −2
Original line number Diff line number Diff line
@@ -33,10 +33,22 @@ class MediaOutputDialogFactory @Inject constructor(
    private val shadeController: ShadeController,
    private val starter: ActivityStarter
) {
    companion object {
        var mediaOutputDialog: MediaOutputDialog? = null
    }

    /** Creates a [MediaOutputDialog] for the given package. */
    fun create(packageName: String, aboveStatusBar: Boolean) {
        MediaOutputController(context, packageName, mediaSessionManager, lbm, shadeController,
                starter).run {
        mediaOutputDialog?.dismiss()

        mediaOutputDialog = MediaOutputController(context, packageName, mediaSessionManager, lbm,
                shadeController, starter).run {
            MediaOutputDialog(context, aboveStatusBar, this) }
    }

    /** dismiss [MediaOutputDialog] if exist. */
    fun dismiss() {
        mediaOutputDialog?.dismiss()
        mediaOutputDialog = null
    }
}