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

Merged-In: Icb5a1f241e644307491030ed721939c18269ff86
Change-Id: Icb5a1f241e644307491030ed721939c18269ff86
This commit is contained in:
timhypeng
2020-09-14 16:01:45 +08:00
committed by tim peng
parent 03e5417ec4
commit 80a46198fc
3 changed files with 56 additions and 0 deletions

View File

@@ -781,5 +781,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>

View File

@@ -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);
}

View File

@@ -0,0 +1,39 @@
/*
* 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)
}
}
}