Loading core/java/android/service/notification/NotificationListenerService.java +2 −0 Original line number Diff line number Diff line Loading @@ -258,6 +258,8 @@ public abstract class NotificationListenerService extends Service { public static final int REASON_CLEAR_DATA = 21; /** Notification was canceled due to an assistant adjustment update. */ public static final int REASON_ASSISTANT_CANCEL = 22; // If adding a new notification cancellation reason, you must also add handling for it in // NotificationCancelledEvent.fromCancelReason. /** * @hide Loading core/java/android/window/TaskConstants.java 0 → 100644 +106 −0 Original line number Diff line number Diff line /* * Copyright (C) 2022 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. */ package android.window; import android.annotation.IntDef; /** * Holds constants related to task managements but not suitable in {@code TaskOrganizer}. * @hide */ public class TaskConstants { /** * Sizes of a z-order region assigned to child layers of task layers. Components are allowed to * use all values in [assigned value, assigned value + region size). * @hide */ public static final int TASK_CHILD_LAYER_REGION_SIZE = 10000; /** * Indicates system responding to task drag resizing while app content isn't updated. * @hide */ public static final int TASK_CHILD_LAYER_TASK_BACKGROUND = -3 * TASK_CHILD_LAYER_REGION_SIZE; /** * Provides solid color letterbox background or blur effect and dimming for the wallpaper * letterbox background. It also listens to touches for double tap gesture for repositioning * letterbox. * @hide */ public static final int TASK_CHILD_LAYER_LETTERBOX_BACKGROUND = -2 * TASK_CHILD_LAYER_REGION_SIZE; /** * When a unresizable app is moved in the different configuration, a restart button appears * allowing to adapt (~resize) app to the new configuration mocks. * @hide */ public static final int TASK_CHILD_LAYER_SIZE_COMPAT_RESTART_BUTTON = TASK_CHILD_LAYER_REGION_SIZE; /** * Shown the first time an app is opened in size compat mode in landscape. * @hide */ public static final int TASK_CHILD_LAYER_LETTERBOX_EDUCATION = 2 * TASK_CHILD_LAYER_REGION_SIZE; /** * Captions, window frames and resize handlers around task windows. * @hide */ public static final int TASK_CHILD_LAYER_WINDOW_DECORATIONS = 3 * TASK_CHILD_LAYER_REGION_SIZE; /** * Overlays the task when going into PIP w/ gesture navigation. * @hide */ public static final int TASK_CHILD_LAYER_RECENTS_ANIMATION_PIP_OVERLAY = 4 * TASK_CHILD_LAYER_REGION_SIZE; /** * Allows other apps to add overlays on the task (i.e. game dashboard) * @hide */ public static final int TASK_CHILD_LAYER_TASK_OVERLAY = 5 * TASK_CHILD_LAYER_REGION_SIZE; /** * Legacy machanism to force an activity to the top of the task (i.e. for work profile * comfirmation). * @hide */ public static final int TASK_CHILD_LAYER_TASK_OVERLAY_ACTIVITIES = 6 * TASK_CHILD_LAYER_REGION_SIZE; /** * Z-orders of task child layers other than activities, task fragments and layers interleaved * with them, e.g. IME windows. [-10000, 10000) is reserved for these layers. * @hide */ @IntDef({ TASK_CHILD_LAYER_TASK_BACKGROUND, TASK_CHILD_LAYER_LETTERBOX_BACKGROUND, TASK_CHILD_LAYER_SIZE_COMPAT_RESTART_BUTTON, TASK_CHILD_LAYER_LETTERBOX_EDUCATION, TASK_CHILD_LAYER_WINDOW_DECORATIONS, TASK_CHILD_LAYER_RECENTS_ANIMATION_PIP_OVERLAY, TASK_CHILD_LAYER_TASK_OVERLAY, TASK_CHILD_LAYER_TASK_OVERLAY_ACTIVITIES }) public @interface TaskChildLayer {} } libs/WindowManager/Shell/src/com/android/wm/shell/desktopmode/DesktopModeController.java +6 −3 Original line number Diff line number Diff line Loading @@ -40,6 +40,7 @@ import android.os.UserHandle; import android.provider.Settings; import android.util.ArraySet; import android.view.SurfaceControl; import android.view.WindowManager; import android.window.DisplayAreaInfo; import android.window.TransitionInfo; import android.window.TransitionRequestInfo; Loading Loading @@ -329,15 +330,17 @@ public class DesktopModeController implements RemoteCallable<DesktopModeControll @Override public WindowContainerTransaction handleRequest(@NonNull IBinder transition, @NonNull TransitionRequestInfo request) { // Only do anything if we are in desktop mode and opening a task/app in freeform // Only do anything if we are in desktop mode and opening/moving-to-front a task/app in // freeform if (!DesktopModeStatus.isActive(mContext)) { ProtoLog.d(WM_SHELL_DESKTOP_MODE, "skip shell transition request: desktop mode not active"); return null; } if (request.getType() != TRANSIT_OPEN) { if (request.getType() != TRANSIT_OPEN && request.getType() != TRANSIT_TO_FRONT) { ProtoLog.d(WM_SHELL_DESKTOP_MODE, "skip shell transition request: only supports TRANSIT_OPEN"); "skip shell transition request: unsupported type %s", WindowManager.transitTypeToString(request.getType())); return null; } if (request.getTriggerTask() == null Loading libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/desktopmode/DesktopModeControllerTest.java +15 −3 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN; import static android.app.WindowConfiguration.WINDOWING_MODE_UNDEFINED; import static android.app.WindowConfiguration.WINDOW_CONFIG_BOUNDS; import static android.view.WindowManager.TRANSIT_CHANGE; import static android.view.WindowManager.TRANSIT_CLOSE; import static android.view.WindowManager.TRANSIT_OPEN; import static android.view.WindowManager.TRANSIT_TO_FRONT; import static android.window.WindowContainerTransaction.HierarchyOp.HIERARCHY_OP_TYPE_REORDER; Loading Loading @@ -334,10 +335,10 @@ public class DesktopModeControllerTest extends ShellTestCase { } @Test public void testHandleTransitionRequest_notTransitOpen_returnsNull() { public void testHandleTransitionRequest_unsupportedTransit_returnsNull() { WindowContainerTransaction wct = mController.handleRequest( new Binder(), new TransitionRequestInfo(TRANSIT_TO_FRONT, null /* trigger */, null /* remote */)); new TransitionRequestInfo(TRANSIT_CLOSE, null /* trigger */, null /* remote */)); assertThat(wct).isNull(); } Loading @@ -352,7 +353,7 @@ public class DesktopModeControllerTest extends ShellTestCase { } @Test public void testHandleTransitionRequest_returnsWct() { public void testHandleTransitionRequest_taskOpen_returnsWct() { RunningTaskInfo trigger = new RunningTaskInfo(); trigger.token = new MockToken().mToken; trigger.configuration.windowConfiguration.setWindowingMode(WINDOWING_MODE_FREEFORM); Loading @@ -362,6 +363,17 @@ public class DesktopModeControllerTest extends ShellTestCase { assertThat(wct).isNotNull(); } @Test public void testHandleTransitionRequest_taskToFront_returnsWct() { RunningTaskInfo trigger = new RunningTaskInfo(); trigger.token = new MockToken().mToken; trigger.configuration.windowConfiguration.setWindowingMode(WINDOWING_MODE_FREEFORM); WindowContainerTransaction wct = mController.handleRequest( mock(IBinder.class), new TransitionRequestInfo(TRANSIT_TO_FRONT, trigger, null /* remote */)); assertThat(wct).isNotNull(); } private DesktopModeController createController() { return new DesktopModeController(mContext, mShellInit, mShellController, mShellTaskOrganizer, mRootTaskDisplayAreaOrganizer, mTransitions, Loading packages/SystemUI/animation/src/com/android/systemui/surfaceeffects/ripple/MultiRippleController.kt +18 −2 Original line number Diff line number Diff line Loading @@ -21,9 +21,20 @@ import androidx.annotation.VisibleForTesting /** Controller that handles playing [RippleAnimation]. */ class MultiRippleController(private val multipleRippleView: MultiRippleView) { private val ripplesFinishedListeners = ArrayList<RipplesFinishedListener>() companion object { /** Max number of ripple animations at a time. */ @VisibleForTesting const val MAX_RIPPLE_NUMBER = 10 interface RipplesFinishedListener { /** Triggered when all the ripples finish running. */ fun onRipplesFinish() } } fun addRipplesFinishedListener(listener: RipplesFinishedListener) { ripplesFinishedListeners.add(listener) } /** Updates all the ripple colors during the animation. */ Loading @@ -38,8 +49,13 @@ class MultiRippleController(private val multipleRippleView: MultiRippleView) { multipleRippleView.ripples.add(rippleAnimation) rippleAnimation.play { // Remove ripple once the animation is done rippleAnimation.play { multipleRippleView.ripples.remove(rippleAnimation) } multipleRippleView.ripples.remove(rippleAnimation) if (multipleRippleView.ripples.isEmpty()) { ripplesFinishedListeners.forEach { listener -> listener.onRipplesFinish() } } } // Trigger drawing multipleRippleView.invalidate() Loading Loading
core/java/android/service/notification/NotificationListenerService.java +2 −0 Original line number Diff line number Diff line Loading @@ -258,6 +258,8 @@ public abstract class NotificationListenerService extends Service { public static final int REASON_CLEAR_DATA = 21; /** Notification was canceled due to an assistant adjustment update. */ public static final int REASON_ASSISTANT_CANCEL = 22; // If adding a new notification cancellation reason, you must also add handling for it in // NotificationCancelledEvent.fromCancelReason. /** * @hide Loading
core/java/android/window/TaskConstants.java 0 → 100644 +106 −0 Original line number Diff line number Diff line /* * Copyright (C) 2022 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. */ package android.window; import android.annotation.IntDef; /** * Holds constants related to task managements but not suitable in {@code TaskOrganizer}. * @hide */ public class TaskConstants { /** * Sizes of a z-order region assigned to child layers of task layers. Components are allowed to * use all values in [assigned value, assigned value + region size). * @hide */ public static final int TASK_CHILD_LAYER_REGION_SIZE = 10000; /** * Indicates system responding to task drag resizing while app content isn't updated. * @hide */ public static final int TASK_CHILD_LAYER_TASK_BACKGROUND = -3 * TASK_CHILD_LAYER_REGION_SIZE; /** * Provides solid color letterbox background or blur effect and dimming for the wallpaper * letterbox background. It also listens to touches for double tap gesture for repositioning * letterbox. * @hide */ public static final int TASK_CHILD_LAYER_LETTERBOX_BACKGROUND = -2 * TASK_CHILD_LAYER_REGION_SIZE; /** * When a unresizable app is moved in the different configuration, a restart button appears * allowing to adapt (~resize) app to the new configuration mocks. * @hide */ public static final int TASK_CHILD_LAYER_SIZE_COMPAT_RESTART_BUTTON = TASK_CHILD_LAYER_REGION_SIZE; /** * Shown the first time an app is opened in size compat mode in landscape. * @hide */ public static final int TASK_CHILD_LAYER_LETTERBOX_EDUCATION = 2 * TASK_CHILD_LAYER_REGION_SIZE; /** * Captions, window frames and resize handlers around task windows. * @hide */ public static final int TASK_CHILD_LAYER_WINDOW_DECORATIONS = 3 * TASK_CHILD_LAYER_REGION_SIZE; /** * Overlays the task when going into PIP w/ gesture navigation. * @hide */ public static final int TASK_CHILD_LAYER_RECENTS_ANIMATION_PIP_OVERLAY = 4 * TASK_CHILD_LAYER_REGION_SIZE; /** * Allows other apps to add overlays on the task (i.e. game dashboard) * @hide */ public static final int TASK_CHILD_LAYER_TASK_OVERLAY = 5 * TASK_CHILD_LAYER_REGION_SIZE; /** * Legacy machanism to force an activity to the top of the task (i.e. for work profile * comfirmation). * @hide */ public static final int TASK_CHILD_LAYER_TASK_OVERLAY_ACTIVITIES = 6 * TASK_CHILD_LAYER_REGION_SIZE; /** * Z-orders of task child layers other than activities, task fragments and layers interleaved * with them, e.g. IME windows. [-10000, 10000) is reserved for these layers. * @hide */ @IntDef({ TASK_CHILD_LAYER_TASK_BACKGROUND, TASK_CHILD_LAYER_LETTERBOX_BACKGROUND, TASK_CHILD_LAYER_SIZE_COMPAT_RESTART_BUTTON, TASK_CHILD_LAYER_LETTERBOX_EDUCATION, TASK_CHILD_LAYER_WINDOW_DECORATIONS, TASK_CHILD_LAYER_RECENTS_ANIMATION_PIP_OVERLAY, TASK_CHILD_LAYER_TASK_OVERLAY, TASK_CHILD_LAYER_TASK_OVERLAY_ACTIVITIES }) public @interface TaskChildLayer {} }
libs/WindowManager/Shell/src/com/android/wm/shell/desktopmode/DesktopModeController.java +6 −3 Original line number Diff line number Diff line Loading @@ -40,6 +40,7 @@ import android.os.UserHandle; import android.provider.Settings; import android.util.ArraySet; import android.view.SurfaceControl; import android.view.WindowManager; import android.window.DisplayAreaInfo; import android.window.TransitionInfo; import android.window.TransitionRequestInfo; Loading Loading @@ -329,15 +330,17 @@ public class DesktopModeController implements RemoteCallable<DesktopModeControll @Override public WindowContainerTransaction handleRequest(@NonNull IBinder transition, @NonNull TransitionRequestInfo request) { // Only do anything if we are in desktop mode and opening a task/app in freeform // Only do anything if we are in desktop mode and opening/moving-to-front a task/app in // freeform if (!DesktopModeStatus.isActive(mContext)) { ProtoLog.d(WM_SHELL_DESKTOP_MODE, "skip shell transition request: desktop mode not active"); return null; } if (request.getType() != TRANSIT_OPEN) { if (request.getType() != TRANSIT_OPEN && request.getType() != TRANSIT_TO_FRONT) { ProtoLog.d(WM_SHELL_DESKTOP_MODE, "skip shell transition request: only supports TRANSIT_OPEN"); "skip shell transition request: unsupported type %s", WindowManager.transitTypeToString(request.getType())); return null; } if (request.getTriggerTask() == null Loading
libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/desktopmode/DesktopModeControllerTest.java +15 −3 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN; import static android.app.WindowConfiguration.WINDOWING_MODE_UNDEFINED; import static android.app.WindowConfiguration.WINDOW_CONFIG_BOUNDS; import static android.view.WindowManager.TRANSIT_CHANGE; import static android.view.WindowManager.TRANSIT_CLOSE; import static android.view.WindowManager.TRANSIT_OPEN; import static android.view.WindowManager.TRANSIT_TO_FRONT; import static android.window.WindowContainerTransaction.HierarchyOp.HIERARCHY_OP_TYPE_REORDER; Loading Loading @@ -334,10 +335,10 @@ public class DesktopModeControllerTest extends ShellTestCase { } @Test public void testHandleTransitionRequest_notTransitOpen_returnsNull() { public void testHandleTransitionRequest_unsupportedTransit_returnsNull() { WindowContainerTransaction wct = mController.handleRequest( new Binder(), new TransitionRequestInfo(TRANSIT_TO_FRONT, null /* trigger */, null /* remote */)); new TransitionRequestInfo(TRANSIT_CLOSE, null /* trigger */, null /* remote */)); assertThat(wct).isNull(); } Loading @@ -352,7 +353,7 @@ public class DesktopModeControllerTest extends ShellTestCase { } @Test public void testHandleTransitionRequest_returnsWct() { public void testHandleTransitionRequest_taskOpen_returnsWct() { RunningTaskInfo trigger = new RunningTaskInfo(); trigger.token = new MockToken().mToken; trigger.configuration.windowConfiguration.setWindowingMode(WINDOWING_MODE_FREEFORM); Loading @@ -362,6 +363,17 @@ public class DesktopModeControllerTest extends ShellTestCase { assertThat(wct).isNotNull(); } @Test public void testHandleTransitionRequest_taskToFront_returnsWct() { RunningTaskInfo trigger = new RunningTaskInfo(); trigger.token = new MockToken().mToken; trigger.configuration.windowConfiguration.setWindowingMode(WINDOWING_MODE_FREEFORM); WindowContainerTransaction wct = mController.handleRequest( mock(IBinder.class), new TransitionRequestInfo(TRANSIT_TO_FRONT, trigger, null /* remote */)); assertThat(wct).isNotNull(); } private DesktopModeController createController() { return new DesktopModeController(mContext, mShellInit, mShellController, mShellTaskOrganizer, mRootTaskDisplayAreaOrganizer, mTransitions, Loading
packages/SystemUI/animation/src/com/android/systemui/surfaceeffects/ripple/MultiRippleController.kt +18 −2 Original line number Diff line number Diff line Loading @@ -21,9 +21,20 @@ import androidx.annotation.VisibleForTesting /** Controller that handles playing [RippleAnimation]. */ class MultiRippleController(private val multipleRippleView: MultiRippleView) { private val ripplesFinishedListeners = ArrayList<RipplesFinishedListener>() companion object { /** Max number of ripple animations at a time. */ @VisibleForTesting const val MAX_RIPPLE_NUMBER = 10 interface RipplesFinishedListener { /** Triggered when all the ripples finish running. */ fun onRipplesFinish() } } fun addRipplesFinishedListener(listener: RipplesFinishedListener) { ripplesFinishedListeners.add(listener) } /** Updates all the ripple colors during the animation. */ Loading @@ -38,8 +49,13 @@ class MultiRippleController(private val multipleRippleView: MultiRippleView) { multipleRippleView.ripples.add(rippleAnimation) rippleAnimation.play { // Remove ripple once the animation is done rippleAnimation.play { multipleRippleView.ripples.remove(rippleAnimation) } multipleRippleView.ripples.remove(rippleAnimation) if (multipleRippleView.ripples.isEmpty()) { ripplesFinishedListeners.forEach { listener -> listener.onRipplesFinish() } } } // Trigger drawing multipleRippleView.invalidate() Loading