diff options
| author | jorgegil@google.com <jorgegil@google.com> | 2019-10-31 14:51:22 -0700 |
|---|---|---|
| committer | jorgegil@google.com <jorgegil@google.com> | 2019-12-20 14:38:25 -0800 |
| commit | 06bc3233c75cd29ef02779ccc795a3a16f9f23f6 (patch) | |
| tree | 0b510f6d44f727fac62589ae7798bf1b82c9f78f /core/java/android/app/ActivityTaskManager.java | |
| parent | fee05eb40bde02bb9238e95a851c6a7ee03e9f1d (diff) | |
Add #onPictureInPictureRequested to Activity and ATM
Allows vendors to signal that an activity should enter
picture-in-picture if possible.
Additionally, removes the need for an Activity to go
through onPause to enter picture-in-picture. Apps can
now override this new API and enter PIP from there
instead of relying on #onUserLeaveHint.
Bug: 143365086
Test: atest FrameworksCoreTests:android.app.activity.ActivityThreadTest
Test: atest CtsWindowManagerDeviceTestCases:PinnedStackTests
Test: atest WmTests:ActivityTaskManagerServiceTests
Change-Id: Ib7ae9d1a7055ceed73e9643982033de9d4ad7350
Diffstat (limited to 'core/java/android/app/ActivityTaskManager.java')
| -rw-r--r-- | core/java/android/app/ActivityTaskManager.java | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/core/java/android/app/ActivityTaskManager.java b/core/java/android/app/ActivityTaskManager.java index 122004cdcf1b..dd9a2bcf9c2c 100644 --- a/core/java/android/app/ActivityTaskManager.java +++ b/core/java/android/app/ActivityTaskManager.java @@ -16,6 +16,7 @@ package android.app; +import android.annotation.NonNull; import android.annotation.RequiresPermission; import android.annotation.SystemService; import android.annotation.TestApi; @@ -433,4 +434,18 @@ public class ActivityTaskManager { throw e.rethrowFromSystemServer(); } } + + /** + * Requests that an activity should enter picture-in-picture mode if possible. + * @hide + */ + @TestApi + @RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_STACKS) + public void requestPictureInPictureMode(@NonNull IBinder token) { + try { + getService().requestPictureInPictureMode(token); + } catch (RemoteException e) { + throw e.rethrowFromSystemServer(); + } + } } |
