Loading core/java/com/android/internal/statusbar/IStatusBar.aidl +5 −2 Original line number Diff line number Diff line Loading @@ -28,6 +28,7 @@ import android.media.INearbyMediaDevicesProvider; import android.media.MediaRoute2Info; import android.os.Bundle; import android.os.ParcelFileDescriptor; import android.os.UserHandle; import android.view.KeyEvent; import android.service.notification.StatusBarNotification; Loading Loading @@ -384,9 +385,11 @@ oneway interface IStatusBar /** * Shows the media output switcher dialog. * * @param packageName of the session for which the output switcher is shown. * @param targetPackageName The package name for which to show the output switcher. * @param targetUserHandle The UserHandle on which the package for which to show the output * switcher is running. */ void showMediaOutputSwitcher(String packageName); void showMediaOutputSwitcher(String targetPackageName, in UserHandle targetUserHandle); /** Enters desktop mode from the current focused app. * Loading packages/SystemUI/src/com/android/systemui/media/dialog/MediaOutputSwitcherDialogUI.java +3 −1 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ package com.android.systemui.media.dialog; import android.annotation.MainThread; import android.content.Context; import android.os.UserHandle; import android.text.TextUtils; import android.util.Log; Loading Loading @@ -52,8 +53,9 @@ public class MediaOutputSwitcherDialogUI implements CoreStartable, CommandQueue. @Override @MainThread public void showMediaOutputSwitcher(String packageName) { public void showMediaOutputSwitcher(String packageName, UserHandle userHandle) { if (!TextUtils.isEmpty(packageName)) { // TODO: b/279555229 - Pass the userHandle into the output dialog manager. mMediaOutputDialogManager.createAndShow(packageName, false, null); } else { Log.e(TAG, "Unable to launch media output dialog. Package name is empty."); Loading packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java +7 −3 Original line number Diff line number Diff line Loading @@ -50,6 +50,7 @@ import android.os.Message; import android.os.ParcelFileDescriptor; import android.os.Process; import android.os.RemoteException; import android.os.UserHandle; import android.util.Pair; import android.util.SparseArray; import android.view.KeyEvent; Loading Loading @@ -516,7 +517,7 @@ public class CommandQueue extends IStatusBar.Stub implements /** * @see IStatusBar#showMediaOutputSwitcher */ default void showMediaOutputSwitcher(String packageName) {} default void showMediaOutputSwitcher(String packageName, UserHandle userHandle) {} /** * @see IStatusBar#confirmImmersivePrompt Loading Loading @@ -1361,7 +1362,7 @@ public class CommandQueue extends IStatusBar.Stub implements } } @Override public void showMediaOutputSwitcher(String packageName) { public void showMediaOutputSwitcher(String packageName, UserHandle userHandle) { int callingUid = Binder.getCallingUid(); if (callingUid != 0 && callingUid != Process.SYSTEM_UID) { throw new SecurityException("Call only allowed from system server."); Loading @@ -1369,6 +1370,7 @@ public class CommandQueue extends IStatusBar.Stub implements synchronized (mLock) { SomeArgs args = SomeArgs.obtain(); args.arg1 = packageName; args.arg2 = userHandle; mHandler.obtainMessage(MSG_SHOW_MEDIA_OUTPUT_SWITCHER, args).sendToTarget(); } } Loading Loading @@ -1939,8 +1941,10 @@ public class CommandQueue extends IStatusBar.Stub implements case MSG_SHOW_MEDIA_OUTPUT_SWITCHER: args = (SomeArgs) msg.obj; String clientPackageName = (String) args.arg1; UserHandle clientUserHandle = (UserHandle) args.arg2; for (int i = 0; i < mCallbacks.size(); i++) { mCallbacks.get(i).showMediaOutputSwitcher(clientPackageName); mCallbacks.get(i).showMediaOutputSwitcher(clientPackageName, clientUserHandle); } break; case MSG_CONFIRM_IMMERSIVE_PROMPT: Loading services/core/java/com/android/server/media/MediaRouterService.java +4 −2 Original line number Diff line number Diff line Loading @@ -267,9 +267,11 @@ public final class MediaRouterService extends IMediaRouterService.Stub // Binder call @Override public boolean showMediaOutputSwitcher(String packageName) { if (!validatePackageName(Binder.getCallingUid(), packageName)) { int uid = Binder.getCallingUid(); if (!validatePackageName(uid, packageName)) { throw new SecurityException("packageName must match the calling identity"); } UserHandle userHandle = UserHandle.getUserHandleForUid(uid); final long token = Binder.clearCallingIdentity(); try { if (mContext.getSystemService(ActivityManager.class).getPackageImportance(packageName) Loading @@ -280,7 +282,7 @@ public final class MediaRouterService extends IMediaRouterService.Stub synchronized (mLock) { StatusBarManagerInternal statusBar = LocalServices.getService(StatusBarManagerInternal.class); statusBar.showMediaOutputSwitcher(packageName); statusBar.showMediaOutputSwitcher(packageName, userHandle); } } finally { Binder.restoreCallingIdentity(token); Loading services/core/java/com/android/server/statusbar/StatusBarManagerInternal.java +3 −2 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ import android.content.ComponentName; import android.hardware.fingerprint.IUdfpsRefreshRateRequestCallback; import android.os.Bundle; import android.os.IBinder; import android.os.UserHandle; import android.view.WindowInsets.Type.InsetsType; import android.view.WindowInsetsController.Appearance; import android.view.WindowInsetsController.Behavior; Loading Loading @@ -248,10 +249,10 @@ public interface StatusBarManagerInternal { /** * Shows the media output switcher dialog. * * @param packageName of the session for which the output switcher is shown. * @param targetPackageName of the session for which the output switcher is shown. * @see com.android.internal.statusbar.IStatusBar#showMediaOutputSwitcher */ void showMediaOutputSwitcher(String packageName); void showMediaOutputSwitcher(String targetPackageName, UserHandle targetUserHandle); /** * Add a tile to the Quick Settings Panel Loading Loading
core/java/com/android/internal/statusbar/IStatusBar.aidl +5 −2 Original line number Diff line number Diff line Loading @@ -28,6 +28,7 @@ import android.media.INearbyMediaDevicesProvider; import android.media.MediaRoute2Info; import android.os.Bundle; import android.os.ParcelFileDescriptor; import android.os.UserHandle; import android.view.KeyEvent; import android.service.notification.StatusBarNotification; Loading Loading @@ -384,9 +385,11 @@ oneway interface IStatusBar /** * Shows the media output switcher dialog. * * @param packageName of the session for which the output switcher is shown. * @param targetPackageName The package name for which to show the output switcher. * @param targetUserHandle The UserHandle on which the package for which to show the output * switcher is running. */ void showMediaOutputSwitcher(String packageName); void showMediaOutputSwitcher(String targetPackageName, in UserHandle targetUserHandle); /** Enters desktop mode from the current focused app. * Loading
packages/SystemUI/src/com/android/systemui/media/dialog/MediaOutputSwitcherDialogUI.java +3 −1 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ package com.android.systemui.media.dialog; import android.annotation.MainThread; import android.content.Context; import android.os.UserHandle; import android.text.TextUtils; import android.util.Log; Loading Loading @@ -52,8 +53,9 @@ public class MediaOutputSwitcherDialogUI implements CoreStartable, CommandQueue. @Override @MainThread public void showMediaOutputSwitcher(String packageName) { public void showMediaOutputSwitcher(String packageName, UserHandle userHandle) { if (!TextUtils.isEmpty(packageName)) { // TODO: b/279555229 - Pass the userHandle into the output dialog manager. mMediaOutputDialogManager.createAndShow(packageName, false, null); } else { Log.e(TAG, "Unable to launch media output dialog. Package name is empty."); Loading
packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java +7 −3 Original line number Diff line number Diff line Loading @@ -50,6 +50,7 @@ import android.os.Message; import android.os.ParcelFileDescriptor; import android.os.Process; import android.os.RemoteException; import android.os.UserHandle; import android.util.Pair; import android.util.SparseArray; import android.view.KeyEvent; Loading Loading @@ -516,7 +517,7 @@ public class CommandQueue extends IStatusBar.Stub implements /** * @see IStatusBar#showMediaOutputSwitcher */ default void showMediaOutputSwitcher(String packageName) {} default void showMediaOutputSwitcher(String packageName, UserHandle userHandle) {} /** * @see IStatusBar#confirmImmersivePrompt Loading Loading @@ -1361,7 +1362,7 @@ public class CommandQueue extends IStatusBar.Stub implements } } @Override public void showMediaOutputSwitcher(String packageName) { public void showMediaOutputSwitcher(String packageName, UserHandle userHandle) { int callingUid = Binder.getCallingUid(); if (callingUid != 0 && callingUid != Process.SYSTEM_UID) { throw new SecurityException("Call only allowed from system server."); Loading @@ -1369,6 +1370,7 @@ public class CommandQueue extends IStatusBar.Stub implements synchronized (mLock) { SomeArgs args = SomeArgs.obtain(); args.arg1 = packageName; args.arg2 = userHandle; mHandler.obtainMessage(MSG_SHOW_MEDIA_OUTPUT_SWITCHER, args).sendToTarget(); } } Loading Loading @@ -1939,8 +1941,10 @@ public class CommandQueue extends IStatusBar.Stub implements case MSG_SHOW_MEDIA_OUTPUT_SWITCHER: args = (SomeArgs) msg.obj; String clientPackageName = (String) args.arg1; UserHandle clientUserHandle = (UserHandle) args.arg2; for (int i = 0; i < mCallbacks.size(); i++) { mCallbacks.get(i).showMediaOutputSwitcher(clientPackageName); mCallbacks.get(i).showMediaOutputSwitcher(clientPackageName, clientUserHandle); } break; case MSG_CONFIRM_IMMERSIVE_PROMPT: Loading
services/core/java/com/android/server/media/MediaRouterService.java +4 −2 Original line number Diff line number Diff line Loading @@ -267,9 +267,11 @@ public final class MediaRouterService extends IMediaRouterService.Stub // Binder call @Override public boolean showMediaOutputSwitcher(String packageName) { if (!validatePackageName(Binder.getCallingUid(), packageName)) { int uid = Binder.getCallingUid(); if (!validatePackageName(uid, packageName)) { throw new SecurityException("packageName must match the calling identity"); } UserHandle userHandle = UserHandle.getUserHandleForUid(uid); final long token = Binder.clearCallingIdentity(); try { if (mContext.getSystemService(ActivityManager.class).getPackageImportance(packageName) Loading @@ -280,7 +282,7 @@ public final class MediaRouterService extends IMediaRouterService.Stub synchronized (mLock) { StatusBarManagerInternal statusBar = LocalServices.getService(StatusBarManagerInternal.class); statusBar.showMediaOutputSwitcher(packageName); statusBar.showMediaOutputSwitcher(packageName, userHandle); } } finally { Binder.restoreCallingIdentity(token); Loading
services/core/java/com/android/server/statusbar/StatusBarManagerInternal.java +3 −2 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ import android.content.ComponentName; import android.hardware.fingerprint.IUdfpsRefreshRateRequestCallback; import android.os.Bundle; import android.os.IBinder; import android.os.UserHandle; import android.view.WindowInsets.Type.InsetsType; import android.view.WindowInsetsController.Appearance; import android.view.WindowInsetsController.Behavior; Loading Loading @@ -248,10 +249,10 @@ public interface StatusBarManagerInternal { /** * Shows the media output switcher dialog. * * @param packageName of the session for which the output switcher is shown. * @param targetPackageName of the session for which the output switcher is shown. * @see com.android.internal.statusbar.IStatusBar#showMediaOutputSwitcher */ void showMediaOutputSwitcher(String packageName); void showMediaOutputSwitcher(String targetPackageName, UserHandle targetUserHandle); /** * Add a tile to the Quick Settings Panel Loading