Loading core/java/android/app/TaskInfo.java +3 −1 Original line number Diff line number Diff line Loading @@ -343,7 +343,9 @@ public class TaskInfo { // TopActivityToken and bounds are important if top activity is in size compat && (!topActivityInSizeCompat || topActivityToken.equals(that.topActivityToken)) && (!topActivityInSizeCompat || configuration.windowConfiguration.getBounds() .equals(that.configuration.windowConfiguration.getBounds())); .equals(that.configuration.windowConfiguration.getBounds())) && (!topActivityInSizeCompat || configuration.getLayoutDirection() == that.configuration.getLayoutDirection()); } /** Loading libs/WindowManager/Shell/res/layout/size_compat_ui.xml 0 → 100644 +30 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- ~ Copyright (C) 2021 The Android Open Source Project ~ ~ Licensed under the Apache License, Version 2.0 (the "License"); ~ you may not use this file except in compliance with the License. ~ You may obtain a copy of the License at ~ ~ http://www.apache.org/licenses/LICENSE-2.0 ~ ~ Unless required by applicable law or agreed to in writing, software ~ distributed under the License is distributed on an "AS IS" BASIS, ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ~ See the License for the specific language governing permissions and ~ limitations under the License. --> <com.android.wm.shell.sizecompatui.SizeCompatRestartButton xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content"> <ImageButton android:id="@+id/size_compat_restart_button" android:layout_width="@dimen/size_compat_button_size" android:layout_height="@dimen/size_compat_button_size" android:layout_gravity="center" android:src="@drawable/size_compat_restart_button" android:contentDescription="@string/restart_button_description"/> </com.android.wm.shell.sizecompatui.SizeCompatRestartButton> libs/WindowManager/Shell/res/values/dimen.xml +3 −0 Original line number Diff line number Diff line Loading @@ -174,6 +174,9 @@ <!-- The width/height of the icon view on staring surface. --> <dimen name="starting_surface_icon_size">108dp</dimen> <!-- The width/height of the size compat restart button. --> <dimen name="size_compat_button_size">48dp</dimen> <!-- The width of the brand image on staring surface. --> <dimen name="starting_surface_brand_image_width">200dp</dimen> Loading libs/WindowManager/Shell/src/com/android/wm/shell/FullscreenTaskListener.java +13 −1 Original line number Diff line number Diff line Loading @@ -94,10 +94,22 @@ public class FullscreenTaskListener implements ShellTaskOrganizer.TaskListener { taskInfo.taskId); } @Override public boolean supportSizeCompatUI() { return true; } @Override public void attachChildSurfaceToTask(int taskId, SurfaceControl.Builder b) { if (!mLeashByTaskId.contains(taskId)) { throw new IllegalArgumentException("There is no surface for taskId=" + taskId); } b.setParent(mLeashByTaskId.get(taskId)); } @Override public void dump(@NonNull PrintWriter pw, String prefix) { final String innerPrefix = prefix + " "; final String childPrefix = innerPrefix + " "; pw.println(prefix + this); pw.println(innerPrefix + mLeashByTaskId.size() + " Tasks"); } Loading libs/WindowManager/Shell/src/com/android/wm/shell/ShellTaskOrganizer.java +14 −6 Original line number Diff line number Diff line Loading @@ -82,6 +82,15 @@ public class ShellTaskOrganizer extends TaskOrganizer { default void onTaskInfoChanged(RunningTaskInfo taskInfo) {} default void onTaskVanished(RunningTaskInfo taskInfo) {} default void onBackPressedOnTaskRoot(RunningTaskInfo taskInfo) {} /** Whether this task listener supports size compat UI. */ default boolean supportSizeCompatUI() { return false; } /** Attaches the a child window surface to the task surface. */ default void attachChildSurfaceToTask(int taskId, SurfaceControl.Builder b) { throw new IllegalStateException( "This task listener doesn't support child surface attachment."); } default void dump(@NonNull PrintWriter pw, String prefix) {}; } Loading Loading @@ -358,8 +367,10 @@ public class ShellTaskOrganizer extends TaskOrganizer { return; } // The task is vanished, notify to remove size compat UI on this Task if there is any. if (taskListener == null) { // The task is vanished or doesn't support size compat UI, notify to remove size compat UI // on this Task if there is any. if (taskListener == null || !taskListener.supportSizeCompatUI() || !taskInfo.topActivityInSizeCompat) { mSizeCompatUI.onSizeCompatInfoChanged(taskInfo.displayId, taskInfo.taskId, null /* taskConfig */, null /* sizeCompatActivity*/, null /* taskListener */); Loading @@ -367,10 +378,7 @@ public class ShellTaskOrganizer extends TaskOrganizer { } mSizeCompatUI.onSizeCompatInfoChanged(taskInfo.displayId, taskInfo.taskId, taskInfo.configuration.windowConfiguration.getBounds(), // null if the top activity not in size compat. taskInfo.topActivityInSizeCompat ? taskInfo.topActivityToken : null, taskListener); taskInfo.configuration, taskInfo.topActivityToken, taskListener); } private TaskListener getTaskListener(RunningTaskInfo runningTaskInfo) { Loading Loading
core/java/android/app/TaskInfo.java +3 −1 Original line number Diff line number Diff line Loading @@ -343,7 +343,9 @@ public class TaskInfo { // TopActivityToken and bounds are important if top activity is in size compat && (!topActivityInSizeCompat || topActivityToken.equals(that.topActivityToken)) && (!topActivityInSizeCompat || configuration.windowConfiguration.getBounds() .equals(that.configuration.windowConfiguration.getBounds())); .equals(that.configuration.windowConfiguration.getBounds())) && (!topActivityInSizeCompat || configuration.getLayoutDirection() == that.configuration.getLayoutDirection()); } /** Loading
libs/WindowManager/Shell/res/layout/size_compat_ui.xml 0 → 100644 +30 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- ~ Copyright (C) 2021 The Android Open Source Project ~ ~ Licensed under the Apache License, Version 2.0 (the "License"); ~ you may not use this file except in compliance with the License. ~ You may obtain a copy of the License at ~ ~ http://www.apache.org/licenses/LICENSE-2.0 ~ ~ Unless required by applicable law or agreed to in writing, software ~ distributed under the License is distributed on an "AS IS" BASIS, ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ~ See the License for the specific language governing permissions and ~ limitations under the License. --> <com.android.wm.shell.sizecompatui.SizeCompatRestartButton xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content"> <ImageButton android:id="@+id/size_compat_restart_button" android:layout_width="@dimen/size_compat_button_size" android:layout_height="@dimen/size_compat_button_size" android:layout_gravity="center" android:src="@drawable/size_compat_restart_button" android:contentDescription="@string/restart_button_description"/> </com.android.wm.shell.sizecompatui.SizeCompatRestartButton>
libs/WindowManager/Shell/res/values/dimen.xml +3 −0 Original line number Diff line number Diff line Loading @@ -174,6 +174,9 @@ <!-- The width/height of the icon view on staring surface. --> <dimen name="starting_surface_icon_size">108dp</dimen> <!-- The width/height of the size compat restart button. --> <dimen name="size_compat_button_size">48dp</dimen> <!-- The width of the brand image on staring surface. --> <dimen name="starting_surface_brand_image_width">200dp</dimen> Loading
libs/WindowManager/Shell/src/com/android/wm/shell/FullscreenTaskListener.java +13 −1 Original line number Diff line number Diff line Loading @@ -94,10 +94,22 @@ public class FullscreenTaskListener implements ShellTaskOrganizer.TaskListener { taskInfo.taskId); } @Override public boolean supportSizeCompatUI() { return true; } @Override public void attachChildSurfaceToTask(int taskId, SurfaceControl.Builder b) { if (!mLeashByTaskId.contains(taskId)) { throw new IllegalArgumentException("There is no surface for taskId=" + taskId); } b.setParent(mLeashByTaskId.get(taskId)); } @Override public void dump(@NonNull PrintWriter pw, String prefix) { final String innerPrefix = prefix + " "; final String childPrefix = innerPrefix + " "; pw.println(prefix + this); pw.println(innerPrefix + mLeashByTaskId.size() + " Tasks"); } Loading
libs/WindowManager/Shell/src/com/android/wm/shell/ShellTaskOrganizer.java +14 −6 Original line number Diff line number Diff line Loading @@ -82,6 +82,15 @@ public class ShellTaskOrganizer extends TaskOrganizer { default void onTaskInfoChanged(RunningTaskInfo taskInfo) {} default void onTaskVanished(RunningTaskInfo taskInfo) {} default void onBackPressedOnTaskRoot(RunningTaskInfo taskInfo) {} /** Whether this task listener supports size compat UI. */ default boolean supportSizeCompatUI() { return false; } /** Attaches the a child window surface to the task surface. */ default void attachChildSurfaceToTask(int taskId, SurfaceControl.Builder b) { throw new IllegalStateException( "This task listener doesn't support child surface attachment."); } default void dump(@NonNull PrintWriter pw, String prefix) {}; } Loading Loading @@ -358,8 +367,10 @@ public class ShellTaskOrganizer extends TaskOrganizer { return; } // The task is vanished, notify to remove size compat UI on this Task if there is any. if (taskListener == null) { // The task is vanished or doesn't support size compat UI, notify to remove size compat UI // on this Task if there is any. if (taskListener == null || !taskListener.supportSizeCompatUI() || !taskInfo.topActivityInSizeCompat) { mSizeCompatUI.onSizeCompatInfoChanged(taskInfo.displayId, taskInfo.taskId, null /* taskConfig */, null /* sizeCompatActivity*/, null /* taskListener */); Loading @@ -367,10 +378,7 @@ public class ShellTaskOrganizer extends TaskOrganizer { } mSizeCompatUI.onSizeCompatInfoChanged(taskInfo.displayId, taskInfo.taskId, taskInfo.configuration.windowConfiguration.getBounds(), // null if the top activity not in size compat. taskInfo.topActivityInSizeCompat ? taskInfo.topActivityToken : null, taskListener); taskInfo.configuration, taskInfo.topActivityToken, taskListener); } private TaskListener getTaskListener(RunningTaskInfo runningTaskInfo) { Loading