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

Commit 6d31848f authored by timhypeng's avatar timhypeng
Browse files

Add a receiver to launch Output Switcher dialog

-The receiver launches dialog with TYPE_APPLICATION_OVERLAY window
type
-Add receiver in manifest
-Add bindMediaOutDialogReceiver() for Dagger

Bug: 155822415
Test: build pass

Change-Id: Icb5a1f241e644307491030ed721939c18269ff86
parent 1aaa40da
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -772,5 +772,12 @@
            </intent-filter>
        </receiver>

        <receiver android:name=".media.dialog.MediaOutDialogReceiver"
                  android:exported="true">
            <intent-filter>
                <action android:name="com.android.systemui.action.LAUNCH_MEDIA_OUTPUT_DIALOG" />
            </intent-filter>
        </receiver>

    </application>
</manifest>
+10 −0
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ package com.android.systemui.dagger;

import android.content.BroadcastReceiver;

import com.android.systemui.media.dialog.MediaOutDialogReceiver;
import com.android.systemui.screenshot.ActionProxyReceiver;
import com.android.systemui.screenshot.DeleteScreenshotReceiver;
import com.android.systemui.screenshot.SmartActionsReceiver;
@@ -59,4 +60,13 @@ public abstract class DefaultBroadcastReceiverBinder {
    public abstract BroadcastReceiver bindSmartActionsReceiver(
            SmartActionsReceiver broadcastReceiver);

    /**
     *
     */
    @Binds
    @IntoMap
    @ClassKey(MediaOutDialogReceiver.class)
    public abstract BroadcastReceiver bindMediaOutDialogReceiver(
            MediaOutDialogReceiver broadcastReceiver);

}
+39 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2020 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.android.systemui.media.dialog

import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import android.text.TextUtils
import com.android.settingslib.media.MediaOutputSliceConstants
import javax.inject.Inject

/**
 * BroadcastReceiver for handling media output intent
 */
class MediaOutDialogReceiver @Inject constructor(
    private var mediaOutputDialogFactory: MediaOutputDialogFactory
) : BroadcastReceiver() {
    override fun onReceive(context: Context, intent: Intent) {
        if (TextUtils.equals(MediaOutputSliceConstants.ACTION_LAUNCH_MEDIA_OUTPUT_DIALOG,
                        intent.action)) {
            mediaOutputDialogFactory.create(
                    intent.getStringExtra(MediaOutputSliceConstants.EXTRA_PACKAGE_NAME), false)
        }
    }
}