Loading libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipMediaController.java→libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipMediaController.java +9 −11 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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. Loading Loading @@ -113,8 +113,7 @@ public class PipMediaController { UserHandle.USER_ALL); createMediaActions(); mMediaSessionManager = (MediaSessionManager) context.getSystemService(Context.MEDIA_SESSION_SERVICE); mMediaSessionManager = context.getSystemService(MediaSessionManager.class); } /** Loading @@ -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); } Loading @@ -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<>(); Loading Loading @@ -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); Loading libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipUtils.java→libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipUtils.java +3 −4 Original line number Diff line number Diff line Loading @@ -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"; Loading @@ -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( Loading libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipAppOpsListener.java +3 −1 Original line number Diff line number Diff line Loading @@ -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(); Loading @@ -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); Loading libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipController.java +1 −0 Original line number Diff line number Diff line Loading @@ -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; Loading libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipMenuActivityController.java +2 −1 Original line number Diff line number Diff line Loading @@ -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; Loading Loading
libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipMediaController.java→libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipMediaController.java +9 −11 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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. Loading Loading @@ -113,8 +113,7 @@ public class PipMediaController { UserHandle.USER_ALL); createMediaActions(); mMediaSessionManager = (MediaSessionManager) context.getSystemService(Context.MEDIA_SESSION_SERVICE); mMediaSessionManager = context.getSystemService(MediaSessionManager.class); } /** Loading @@ -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); } Loading @@ -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<>(); Loading Loading @@ -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); Loading
libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipUtils.java→libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipUtils.java +3 −4 Original line number Diff line number Diff line Loading @@ -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"; Loading @@ -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( Loading
libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipAppOpsListener.java +3 −1 Original line number Diff line number Diff line Loading @@ -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(); Loading @@ -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); Loading
libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipController.java +1 −0 Original line number Diff line number Diff line Loading @@ -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; Loading
libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipMenuActivityController.java +2 −1 Original line number Diff line number Diff line Loading @@ -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; Loading