Loading services/core/java/com/android/server/wm/ActivityRecord.java +9 −3 Original line number Diff line number Diff line Loading @@ -2915,9 +2915,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A */ boolean supportsPictureInPicture() { return mAtmService.mSupportsPictureInPicture && isActivityTypeStandardOrUndefined() && info.supportsPictureInPicture() && (mDisplayContent != null && mDisplayContent.mDwpcHelper.isWindowingModeSupported( WINDOWING_MODE_PINNED)); && info.supportsPictureInPicture(); } /** Loading Loading @@ -3015,6 +3013,14 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A return false; } // Check to see if PiP is supported for the display this container is on. if (mDisplayContent != null && !mDisplayContent.mDwpcHelper.isWindowingModeSupported( WINDOWING_MODE_PINNED)) { Slog.w(TAG, "Display " + mDisplayContent.getDisplayId() + " doesn't support enter picture-in-picture mode. caller = " + caller); return false; } boolean isCurrentAppLocked = mAtmService.getLockTaskModeState() != LOCK_TASK_MODE_NONE; final TaskDisplayArea taskDisplayArea = getDisplayArea(); Loading services/tests/wmtests/src/com/android/server/wm/ActivityRecordTests.java +22 −12 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ package com.android.server.wm; import static android.app.AppOpsManager.MODE_ALLOWED; import static android.app.AppOpsManager.OP_PICTURE_IN_PICTURE; import static android.app.TaskInfo.CAMERA_COMPAT_CONTROL_DISMISSED; import static android.app.TaskInfo.CAMERA_COMPAT_CONTROL_HIDDEN; import static android.app.TaskInfo.CAMERA_COMPAT_CONTROL_TREATMENT_APPLIED; Loading Loading @@ -110,6 +112,7 @@ import static org.mockito.Mockito.clearInvocations; import static org.mockito.Mockito.never; import android.app.ActivityOptions; import android.app.AppOpsManager; import android.app.ICompatCameraControlCallback; import android.app.PictureInPictureParams; import android.app.servertransaction.ActivityConfigurationChangeItem; Loading Loading @@ -2184,17 +2187,11 @@ public class ActivityRecordTests extends WindowTestsBase { @Test public void testSupportsPictureInPicture() { final Task task = new TaskBuilder(mSupervisor) .setDisplay(mDisplayContent).build(); final ActivityRecord activity = new ActivityBuilder(mAtm) .setTask(task) .setCreateTask(true) .setResizeMode(ActivityInfo.RESIZE_MODE_UNRESIZEABLE) .setActivityFlags(FLAG_SUPPORTS_PICTURE_IN_PICTURE) .build(); spyOn(mDisplayContent); spyOn(mDisplayContent.mDwpcHelper); doReturn(true).when(mDisplayContent.mDwpcHelper).isWindowingModeSupported( WINDOWING_MODE_PINNED); // Device not supports PIP mAtm.mSupportsPictureInPicture = false; Loading @@ -2207,15 +2204,28 @@ public class ActivityRecordTests extends WindowTestsBase { // Activity not supports PIP activity.info.flags &= ~FLAG_SUPPORTS_PICTURE_IN_PICTURE; assertFalse(activity.supportsPictureInPicture()); } // Activity supports PIP activity.info.flags |= FLAG_SUPPORTS_PICTURE_IN_PICTURE; assertTrue(activity.supportsPictureInPicture()); @Test public void testCheckEnterPictureInPictureState_displayNotSupportedPip() { final Task task = new TaskBuilder(mSupervisor) .setDisplay(mDisplayContent).build(); final ActivityRecord activity = new ActivityBuilder(mAtm) .setTask(task) .setResizeMode(ActivityInfo.RESIZE_MODE_UNRESIZEABLE) .setActivityFlags(FLAG_SUPPORTS_PICTURE_IN_PICTURE) .build(); mAtm.mSupportsPictureInPicture = true; AppOpsManager appOpsManager = mAtm.getAppOpsManager(); doReturn(MODE_ALLOWED).when(appOpsManager).checkOpNoThrow(eq(OP_PICTURE_IN_PICTURE), anyInt(), any()); doReturn(false).when(mAtm).shouldDisableNonVrUiLocked(); // Display not supports PIP spyOn(mDisplayContent.mDwpcHelper); doReturn(false).when(mDisplayContent.mDwpcHelper).isWindowingModeSupported( WINDOWING_MODE_PINNED); assertFalse(activity.supportsPictureInPicture()); assertFalse(activity.checkEnterPictureInPictureState("TEST", false /* beforeStopping */)); } @Test Loading Loading
services/core/java/com/android/server/wm/ActivityRecord.java +9 −3 Original line number Diff line number Diff line Loading @@ -2915,9 +2915,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A */ boolean supportsPictureInPicture() { return mAtmService.mSupportsPictureInPicture && isActivityTypeStandardOrUndefined() && info.supportsPictureInPicture() && (mDisplayContent != null && mDisplayContent.mDwpcHelper.isWindowingModeSupported( WINDOWING_MODE_PINNED)); && info.supportsPictureInPicture(); } /** Loading Loading @@ -3015,6 +3013,14 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A return false; } // Check to see if PiP is supported for the display this container is on. if (mDisplayContent != null && !mDisplayContent.mDwpcHelper.isWindowingModeSupported( WINDOWING_MODE_PINNED)) { Slog.w(TAG, "Display " + mDisplayContent.getDisplayId() + " doesn't support enter picture-in-picture mode. caller = " + caller); return false; } boolean isCurrentAppLocked = mAtmService.getLockTaskModeState() != LOCK_TASK_MODE_NONE; final TaskDisplayArea taskDisplayArea = getDisplayArea(); Loading
services/tests/wmtests/src/com/android/server/wm/ActivityRecordTests.java +22 −12 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ package com.android.server.wm; import static android.app.AppOpsManager.MODE_ALLOWED; import static android.app.AppOpsManager.OP_PICTURE_IN_PICTURE; import static android.app.TaskInfo.CAMERA_COMPAT_CONTROL_DISMISSED; import static android.app.TaskInfo.CAMERA_COMPAT_CONTROL_HIDDEN; import static android.app.TaskInfo.CAMERA_COMPAT_CONTROL_TREATMENT_APPLIED; Loading Loading @@ -110,6 +112,7 @@ import static org.mockito.Mockito.clearInvocations; import static org.mockito.Mockito.never; import android.app.ActivityOptions; import android.app.AppOpsManager; import android.app.ICompatCameraControlCallback; import android.app.PictureInPictureParams; import android.app.servertransaction.ActivityConfigurationChangeItem; Loading Loading @@ -2184,17 +2187,11 @@ public class ActivityRecordTests extends WindowTestsBase { @Test public void testSupportsPictureInPicture() { final Task task = new TaskBuilder(mSupervisor) .setDisplay(mDisplayContent).build(); final ActivityRecord activity = new ActivityBuilder(mAtm) .setTask(task) .setCreateTask(true) .setResizeMode(ActivityInfo.RESIZE_MODE_UNRESIZEABLE) .setActivityFlags(FLAG_SUPPORTS_PICTURE_IN_PICTURE) .build(); spyOn(mDisplayContent); spyOn(mDisplayContent.mDwpcHelper); doReturn(true).when(mDisplayContent.mDwpcHelper).isWindowingModeSupported( WINDOWING_MODE_PINNED); // Device not supports PIP mAtm.mSupportsPictureInPicture = false; Loading @@ -2207,15 +2204,28 @@ public class ActivityRecordTests extends WindowTestsBase { // Activity not supports PIP activity.info.flags &= ~FLAG_SUPPORTS_PICTURE_IN_PICTURE; assertFalse(activity.supportsPictureInPicture()); } // Activity supports PIP activity.info.flags |= FLAG_SUPPORTS_PICTURE_IN_PICTURE; assertTrue(activity.supportsPictureInPicture()); @Test public void testCheckEnterPictureInPictureState_displayNotSupportedPip() { final Task task = new TaskBuilder(mSupervisor) .setDisplay(mDisplayContent).build(); final ActivityRecord activity = new ActivityBuilder(mAtm) .setTask(task) .setResizeMode(ActivityInfo.RESIZE_MODE_UNRESIZEABLE) .setActivityFlags(FLAG_SUPPORTS_PICTURE_IN_PICTURE) .build(); mAtm.mSupportsPictureInPicture = true; AppOpsManager appOpsManager = mAtm.getAppOpsManager(); doReturn(MODE_ALLOWED).when(appOpsManager).checkOpNoThrow(eq(OP_PICTURE_IN_PICTURE), anyInt(), any()); doReturn(false).when(mAtm).shouldDisableNonVrUiLocked(); // Display not supports PIP spyOn(mDisplayContent.mDwpcHelper); doReturn(false).when(mDisplayContent.mDwpcHelper).isWindowingModeSupported( WINDOWING_MODE_PINNED); assertFalse(activity.supportsPictureInPicture()); assertFalse(activity.checkEnterPictureInPictureState("TEST", false /* beforeStopping */)); } @Test Loading