diff options
10 files changed, 25 insertions, 24 deletions
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipMediaController.java b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipMediaController.java index 64e3758fd81a..1fa05e01b4d6 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipMediaController.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipMediaController.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.android.wm.shell.pip.phone; +package com.android.wm.shell.pip; import static android.app.PendingIntent.FLAG_IMMUTABLE; import static android.app.PendingIntent.FLAG_UPDATE_CURRENT; @@ -46,10 +46,10 @@ import java.util.List; */ public class PipMediaController { - private static final String ACTION_PLAY = "com.android.wm.shell.pip.phone.PLAY"; - private static final String ACTION_PAUSE = "com.android.wm.shell.pip.phone.PAUSE"; - private static final String ACTION_NEXT = "com.android.wm.shell.pip.phone.NEXT"; - private static final String ACTION_PREV = "com.android.wm.shell.pip.phone.PREV"; + private static final String ACTION_PLAY = "com.android.wm.shell.pip.PLAY"; + private static final String ACTION_PAUSE = "com.android.wm.shell.pip.PAUSE"; + private static final String ACTION_NEXT = "com.android.wm.shell.pip.NEXT"; + private static final String ACTION_PREV = "com.android.wm.shell.pip.PREV"; /** * A listener interface to receive notification on changes to the media actions. @@ -113,8 +113,7 @@ public class PipMediaController { UserHandle.USER_ALL); createMediaActions(); - mMediaSessionManager = - (MediaSessionManager) context.getSystemService(Context.MEDIA_SESSION_SERVICE); + mMediaSessionManager = context.getSystemService(MediaSessionManager.class); } /** @@ -140,7 +139,7 @@ public class PipMediaController { * Removes a media action listener. */ public void removeListener(ActionListener listener) { - listener.onMediaActionsChanged(Collections.EMPTY_LIST); + listener.onMediaActionsChanged(Collections.emptyList()); mListeners.remove(listener); } @@ -149,7 +148,7 @@ public class PipMediaController { */ private List<RemoteAction> getMediaActions() { if (mMediaController == null || mMediaController.getPlaybackState() == null) { - return Collections.EMPTY_LIST; + return Collections.emptyList(); } ArrayList<RemoteAction> mediaActions = new ArrayList<>(); @@ -216,8 +215,7 @@ public class PipMediaController { */ private void resolveActiveMediaController(List<MediaController> controllers) { if (controllers != null) { - final ComponentName topActivity = PipUtils.getTopPipActivity(mContext, - mActivityManager).first; + final ComponentName topActivity = PipUtils.getTopPipActivity(mContext).first; if (topActivity != null) { for (int i = 0; i < controllers.size(); i++) { final MediaController controller = controllers.get(i); diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipUtils.java b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipUtils.java index bd2ba32912bc..da6d9804b29d 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipUtils.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipUtils.java @@ -14,20 +14,20 @@ * limitations under the License. */ -package com.android.wm.shell.pip.phone; +package com.android.wm.shell.pip; import static android.app.WindowConfiguration.ACTIVITY_TYPE_UNDEFINED; import static android.app.WindowConfiguration.WINDOWING_MODE_PINNED; import android.app.ActivityTaskManager; import android.app.ActivityTaskManager.RootTaskInfo; -import android.app.IActivityManager; import android.content.ComponentName; import android.content.Context; import android.os.RemoteException; import android.util.Log; import android.util.Pair; +/** A class that includes convenience methods. */ public class PipUtils { private static final String TAG = "PipUtils"; @@ -35,8 +35,7 @@ public class PipUtils { * @return the ComponentName and user id of the top non-SystemUI activity in the pinned stack. * The component name may be null if no such activity exists. */ - public static Pair<ComponentName, Integer> getTopPipActivity(Context context, - IActivityManager activityManager) { + public static Pair<ComponentName, Integer> getTopPipActivity(Context context) { try { final String sysUiPackageName = context.getPackageName(); final RootTaskInfo pinnedTaskInfo = ActivityTaskManager.getService().getRootTaskInfo( diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipAppOpsListener.java b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipAppOpsListener.java index 6b6b5211b10a..2cd010796799 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipAppOpsListener.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipAppOpsListener.java @@ -29,6 +29,8 @@ import android.content.pm.PackageManager.NameNotFoundException; import android.os.Handler; import android.util.Pair; +import com.android.wm.shell.pip.PipUtils; + public class PipAppOpsListener { private static final String TAG = PipAppOpsListener.class.getSimpleName(); @@ -44,7 +46,7 @@ public class PipAppOpsListener { try { // Dismiss the PiP once the user disables the app ops setting for that package final Pair<ComponentName, Integer> topPipActivityInfo = - PipUtils.getTopPipActivity(mContext, mActivityManager); + PipUtils.getTopPipActivity(mContext); if (topPipActivityInfo.first != null) { final ApplicationInfo appInfo = mContext.getPackageManager() .getApplicationInfoAsUser(packageName, 0, topPipActivityInfo.second); diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipController.java b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipController.java index 823979b861b4..d506ca8d6470 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipController.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipController.java @@ -49,6 +49,7 @@ import com.android.wm.shell.pip.PinnedStackListenerForwarder; import com.android.wm.shell.pip.Pip; import com.android.wm.shell.pip.PipBoundsHandler; import com.android.wm.shell.pip.PipBoundsState; +import com.android.wm.shell.pip.PipMediaController; import com.android.wm.shell.pip.PipTaskOrganizer; import java.io.PrintWriter; diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipMenuActivityController.java b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipMenuActivityController.java index cd47d55da7f0..ad1b3955301d 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipMenuActivityController.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipMenuActivityController.java @@ -34,8 +34,9 @@ import android.view.MotionEvent; import android.view.WindowManager; import android.view.WindowManagerGlobal; +import com.android.wm.shell.pip.PipMediaController; +import com.android.wm.shell.pip.PipMediaController.ActionListener; import com.android.wm.shell.pip.PipTaskOrganizer; -import com.android.wm.shell.pip.phone.PipMediaController.ActionListener; import java.io.PrintWriter; import java.util.ArrayList; diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipMenuView.java b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipMenuView.java index 51951409f76c..3e06ec44989e 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipMenuView.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipMenuView.java @@ -32,7 +32,6 @@ import android.animation.AnimatorListenerAdapter; import android.animation.AnimatorSet; import android.animation.ObjectAnimator; import android.animation.ValueAnimator; -import android.app.ActivityManager; import android.app.PendingIntent.CanceledException; import android.app.RemoteAction; import android.content.ComponentName; @@ -61,6 +60,7 @@ import android.widget.LinearLayout; import com.android.wm.shell.R; import com.android.wm.shell.animation.Interpolators; +import com.android.wm.shell.pip.PipUtils; import java.util.ArrayList; import java.util.List; @@ -452,7 +452,7 @@ public class PipMenuView extends FrameLayout { private void showSettings() { final Pair<ComponentName, Integer> topPipActivityInfo = - PipUtils.getTopPipActivity(mContext, ActivityManager.getService()); + PipUtils.getTopPipActivity(mContext); if (topPipActivityInfo.first != null) { final Intent settingsIntent = new Intent(ACTION_PICTURE_IN_PICTURE_SETTINGS, Uri.fromParts("package", topPipActivityInfo.first.getPackageName(), null)); diff --git a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/pip/phone/PipControllerTest.java b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/pip/phone/PipControllerTest.java index a282a48e8494..de9d8648f43c 100644 --- a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/pip/phone/PipControllerTest.java +++ b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/pip/phone/PipControllerTest.java @@ -36,6 +36,7 @@ import com.android.wm.shell.WindowManagerShellWrapper; import com.android.wm.shell.common.DisplayController; import com.android.wm.shell.pip.PipBoundsHandler; import com.android.wm.shell.pip.PipBoundsState; +import com.android.wm.shell.pip.PipMediaController; import com.android.wm.shell.pip.PipTaskOrganizer; import com.android.wm.shell.pip.PipTestCase; diff --git a/packages/SystemUI/src/com/android/systemui/wmshell/WMShell.java b/packages/SystemUI/src/com/android/systemui/wmshell/WMShell.java index 4330659dde02..f896891c5039 100644 --- a/packages/SystemUI/src/com/android/systemui/wmshell/WMShell.java +++ b/packages/SystemUI/src/com/android/systemui/wmshell/WMShell.java @@ -71,7 +71,7 @@ import com.android.wm.shell.onehanded.OneHandedEvents; import com.android.wm.shell.onehanded.OneHandedGestureHandler.OneHandedGestureEventCallback; import com.android.wm.shell.onehanded.OneHandedTransitionCallback; import com.android.wm.shell.pip.Pip; -import com.android.wm.shell.pip.phone.PipUtils; +import com.android.wm.shell.pip.PipUtils; import com.android.wm.shell.protolog.ShellProtoLogImpl; import com.android.wm.shell.splitscreen.SplitScreen; @@ -211,8 +211,7 @@ public final class WMShell extends SystemUI @Override public void onActivityUnpinned() { final Pair<ComponentName, Integer> topPipActivityInfo = - PipUtils.getTopPipActivity( - mContext, ActivityManager.getService()); + PipUtils.getTopPipActivity(mContext); final ComponentName topActivity = topPipActivityInfo.first; pip.onActivityUnpinned(topActivity); mInputConsumerController.unregisterInputConsumer(); diff --git a/packages/SystemUI/src/com/android/systemui/wmshell/WMShellBaseModule.java b/packages/SystemUI/src/com/android/systemui/wmshell/WMShellBaseModule.java index ead2fc1cd9dc..354ed24df291 100644 --- a/packages/SystemUI/src/com/android/systemui/wmshell/WMShellBaseModule.java +++ b/packages/SystemUI/src/com/android/systemui/wmshell/WMShellBaseModule.java @@ -41,10 +41,10 @@ import com.android.wm.shell.draganddrop.DragAndDropController; import com.android.wm.shell.onehanded.OneHanded; import com.android.wm.shell.onehanded.OneHandedController; import com.android.wm.shell.pip.Pip; +import com.android.wm.shell.pip.PipMediaController; import com.android.wm.shell.pip.PipSurfaceTransactionHelper; import com.android.wm.shell.pip.PipUiEventLogger; import com.android.wm.shell.pip.phone.PipAppOpsListener; -import com.android.wm.shell.pip.phone.PipMediaController; import com.android.wm.shell.pip.phone.PipTouchHandler; import com.android.wm.shell.splitscreen.SplitScreen; diff --git a/packages/SystemUI/src/com/android/systemui/wmshell/WMShellModule.java b/packages/SystemUI/src/com/android/systemui/wmshell/WMShellModule.java index a6fe72850716..f376df06badd 100644 --- a/packages/SystemUI/src/com/android/systemui/wmshell/WMShellModule.java +++ b/packages/SystemUI/src/com/android/systemui/wmshell/WMShellModule.java @@ -33,12 +33,12 @@ import com.android.wm.shell.common.TransactionPool; import com.android.wm.shell.pip.Pip; import com.android.wm.shell.pip.PipBoundsHandler; import com.android.wm.shell.pip.PipBoundsState; +import com.android.wm.shell.pip.PipMediaController; import com.android.wm.shell.pip.PipSurfaceTransactionHelper; import com.android.wm.shell.pip.PipTaskOrganizer; import com.android.wm.shell.pip.PipUiEventLogger; import com.android.wm.shell.pip.phone.PipAppOpsListener; import com.android.wm.shell.pip.phone.PipController; -import com.android.wm.shell.pip.phone.PipMediaController; import com.android.wm.shell.pip.phone.PipMenuActivityController; import com.android.wm.shell.pip.phone.PipTouchHandler; import com.android.wm.shell.splitscreen.SplitScreen; |