summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Maryam Dehaini <mdehaini@google.com> 2025-03-21 15:19:22 -0700
committer Android (Google) Code Review <android-gerrit@google.com> 2025-03-21 15:19:22 -0700
commite58088ca99183bb5e90ab0dac463cb0eba7f27c0 (patch)
treecf76037357a06398a8a5ad1963efa519194d9ea4
parent4263014425c24c442d172402df915f8a2f42c75a (diff)
parent47b3beb31c6076bee367514dba21a875607fb24f (diff)
Merge "Fail request when fullscreen requested from split" into main
-rw-r--r--core/java/android/app/FullscreenRequestHandler.java15
-rw-r--r--services/core/java/com/android/server/wm/ActivityClientController.java12
2 files changed, 25 insertions, 2 deletions
diff --git a/core/java/android/app/FullscreenRequestHandler.java b/core/java/android/app/FullscreenRequestHandler.java
index c78c66aa62c0..5529349dea70 100644
--- a/core/java/android/app/FullscreenRequestHandler.java
+++ b/core/java/android/app/FullscreenRequestHandler.java
@@ -18,6 +18,7 @@ package android.app;
import static android.app.Activity.FULLSCREEN_MODE_REQUEST_EXIT;
import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN;
+import static android.app.WindowConfiguration.WINDOWING_MODE_MULTI_WINDOW;
import android.annotation.IntDef;
import android.annotation.NonNull;
@@ -27,6 +28,7 @@ import android.os.Bundle;
import android.os.IBinder;
import android.os.IRemoteCallback;
import android.os.OutcomeReceiver;
+import android.window.DesktopModeFlags;
/**
* @hide
@@ -35,13 +37,15 @@ public class FullscreenRequestHandler {
@IntDef(prefix = { "RESULT_" }, value = {
RESULT_APPROVED,
RESULT_FAILED_NOT_IN_FULLSCREEN_WITH_HISTORY,
- RESULT_FAILED_NOT_TOP_FOCUSED
+ RESULT_FAILED_NOT_TOP_FOCUSED,
+ RESULT_FAILED_ALREADY_FULLY_EXPANDED
})
public @interface RequestResult {}
public static final int RESULT_APPROVED = 0;
public static final int RESULT_FAILED_NOT_IN_FULLSCREEN_WITH_HISTORY = 1;
public static final int RESULT_FAILED_NOT_TOP_FOCUSED = 2;
+ public static final int RESULT_FAILED_ALREADY_FULLY_EXPANDED = 3;
public static final String REMOTE_CALLBACK_RESULT_KEY = "result";
@@ -87,6 +91,9 @@ public class FullscreenRequestHandler {
case RESULT_FAILED_NOT_TOP_FOCUSED:
e = new IllegalStateException("The window is not the top focused window.");
break;
+ case RESULT_FAILED_ALREADY_FULLY_EXPANDED:
+ e = new IllegalStateException("The window is already fully expanded.");
+ break;
default:
callback.onResult(null);
break;
@@ -101,6 +108,12 @@ public class FullscreenRequestHandler {
if (windowingMode != WINDOWING_MODE_FULLSCREEN) {
return RESULT_FAILED_NOT_IN_FULLSCREEN_WITH_HISTORY;
}
+ return RESULT_APPROVED;
+ }
+ if (DesktopModeFlags.ENABLE_REQUEST_FULLSCREEN_BUGFIX.isTrue()
+ && (windowingMode == WINDOWING_MODE_FULLSCREEN
+ || windowingMode == WINDOWING_MODE_MULTI_WINDOW)) {
+ return RESULT_FAILED_ALREADY_FULLY_EXPANDED;
}
return RESULT_APPROVED;
}
diff --git a/services/core/java/com/android/server/wm/ActivityClientController.java b/services/core/java/com/android/server/wm/ActivityClientController.java
index 5eceb6490256..fd4e38e9813d 100644
--- a/services/core/java/com/android/server/wm/ActivityClientController.java
+++ b/services/core/java/com/android/server/wm/ActivityClientController.java
@@ -24,10 +24,12 @@ import static android.app.ActivityTaskManager.INVALID_TASK_ID;
import static android.app.ActivityTaskManager.INVALID_WINDOWING_MODE;
import static android.app.FullscreenRequestHandler.REMOTE_CALLBACK_RESULT_KEY;
import static android.app.FullscreenRequestHandler.RESULT_APPROVED;
+import static android.app.FullscreenRequestHandler.RESULT_FAILED_ALREADY_FULLY_EXPANDED;
import static android.app.FullscreenRequestHandler.RESULT_FAILED_NOT_IN_FULLSCREEN_WITH_HISTORY;
import static android.app.FullscreenRequestHandler.RESULT_FAILED_NOT_TOP_FOCUSED;
import static android.app.WindowConfiguration.WINDOWING_MODE_FREEFORM;
import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN;
+import static android.app.WindowConfiguration.WINDOWING_MODE_MULTI_WINDOW;
import static android.app.WindowConfiguration.WINDOWING_MODE_PINNED;
import static android.app.WindowConfiguration.WINDOWING_MODE_UNDEFINED;
import static android.content.pm.PackageManager.PERMISSION_DENIED;
@@ -1189,17 +1191,25 @@ class ActivityClientController extends IActivityClientController.Stub {
if (requesterActivity.getWindowingMode() == WINDOWING_MODE_PINNED) {
return RESULT_APPROVED;
}
+ final int taskWindowingMode = topFocusedRootTask.getWindowingMode();
// If this is not coming from the currently top-most activity, reject the request.
if (requesterActivity != topFocusedRootTask.getTopMostActivity()) {
return RESULT_FAILED_NOT_TOP_FOCUSED;
}
if (fullscreenRequest == FULLSCREEN_MODE_REQUEST_EXIT) {
- if (topFocusedRootTask.getWindowingMode() != WINDOWING_MODE_FULLSCREEN) {
+ if (taskWindowingMode != WINDOWING_MODE_FULLSCREEN) {
return RESULT_FAILED_NOT_IN_FULLSCREEN_WITH_HISTORY;
}
if (topFocusedRootTask.mMultiWindowRestoreWindowingMode == INVALID_WINDOWING_MODE) {
return RESULT_FAILED_NOT_IN_FULLSCREEN_WITH_HISTORY;
}
+ return RESULT_APPROVED;
+ }
+
+ if (DesktopModeFlags.ENABLE_REQUEST_FULLSCREEN_BUGFIX.isTrue()
+ && (taskWindowingMode == WINDOWING_MODE_FULLSCREEN
+ || taskWindowingMode == WINDOWING_MODE_MULTI_WINDOW)) {
+ return RESULT_FAILED_ALREADY_FULLY_EXPANDED;
}
return RESULT_APPROVED;
}