Merge "Improve API of requestFullscreenMode"

This commit is contained in:
Yunfan Chen
2022-12-19 05:52:21 +00:00
committed by Android (Google) Code Review
2 changed files with 14 additions and 6 deletions

View File

@@ -4297,7 +4297,7 @@ package android.app {
method @Deprecated public final void removeDialog(int);
method public void reportFullyDrawn();
method public android.view.DragAndDropPermissions requestDragAndDropPermissions(android.view.DragEvent);
method public void requestFullscreenMode(@NonNull int, @Nullable android.os.OutcomeReceiver<java.lang.Void,java.lang.Throwable>);
method public void requestFullscreenMode(int, @Nullable android.os.OutcomeReceiver<java.lang.Void,java.lang.Throwable>);
method public final void requestPermissions(@NonNull String[], int);
method public final void requestShowKeyboardShortcuts();
method @Deprecated public boolean requestVisibleBehind(boolean);

View File

@@ -995,8 +995,13 @@ public class Activity extends ContextThemeWrapper
})
public @interface FullscreenModeRequest {}
/** Request type of {@link #requestFullscreenMode(int, OutcomeReceiver)}, to request exiting the
* requested fullscreen mode and restore to the previous multi-window mode.
*/
public static final int FULLSCREEN_MODE_REQUEST_EXIT = 0;
/** Request type of {@link #requestFullscreenMode(int, OutcomeReceiver)}, to request enter
* fullscreen mode from multi-window mode.
*/
public static final int FULLSCREEN_MODE_REQUEST_ENTER = 1;
private boolean mShouldDockBigOverlays;
@@ -3015,8 +3020,9 @@ public class Activity extends ContextThemeWrapper
/**
* Request to put the a freeform activity into fullscreen. This will only be allowed if the
* activity is on a freeform display, such as a desktop device. The requester has to be the
* top-most activity and the request should be a response to a user input. When getting
* fullscreen and receiving corresponding {@link #onConfigurationChanged(Configuration)} and
* top-most activity of the focused display, and the request should be a response to a user
* input. When getting fullscreen and receiving corresponding
* {@link #onConfigurationChanged(Configuration)} and
* {@link #onMultiWindowModeChanged(boolean, Configuration)}, the activity should relayout
* itself and the system bars' visibilities can be controlled as usual fullscreen apps.
*
@@ -3034,9 +3040,11 @@ public class Activity extends ContextThemeWrapper
* @param approvalCallback Optional callback, use {@code null} when not necessary. When the
* request is approved or rejected, the callback will be triggered. This
* will happen before any configuration change. The callback will be
* dispatched on the main thread.
* dispatched on the main thread. If the request is rejected, the
* Throwable provided will be an {@link IllegalStateException} with a
* detailed message can be retrieved by {@link Throwable#getMessage()}.
*/
public void requestFullscreenMode(@NonNull @FullscreenModeRequest int request,
public void requestFullscreenMode(@FullscreenModeRequest int request,
@Nullable OutcomeReceiver<Void, Throwable> approvalCallback) {
FullscreenRequestHandler.requestFullscreenMode(
request, approvalCallback, mCurrentConfig, getActivityToken());