Loading core/java/android/content/Intent.java +20 −0 Original line number Diff line number Diff line Loading @@ -65,6 +65,7 @@ import android.provider.DocumentsContract; import android.provider.DocumentsProvider; import android.provider.MediaStore; import android.provider.OpenableColumns; import android.service.chooser.ChooserAction; import android.telecom.PhoneAccount; import android.telecom.TelecomManager; import android.text.TextUtils; Loading Loading @@ -5730,6 +5731,25 @@ public class Intent implements Parcelable, Cloneable { public static final String EXTRA_CHOOSER_REFINEMENT_INTENT_SENDER = "android.intent.extra.CHOOSER_REFINEMENT_INTENT_SENDER"; /** * A Parcelable[] of {@link ChooserAction} objects to provide the Android Sharesheet with * app-specific actions to be presented to the user when invoking {@link #ACTION_CHOOSER}. * @hide */ public static final String EXTRA_CHOOSER_CUSTOM_ACTIONS = "android.intent.extra.EXTRA_CHOOSER_CUSTOM_ACTIONS"; /** * Optional argument to be used with {@link #ACTION_CHOOSER}. * A {@link android.app.PendingIntent} to be sent when the user wants to do payload reselection * in the sharesheet. * A reselection action allows the user to return to the source app to change the content being * shared. * @hide */ public static final String EXTRA_CHOOSER_PAYLOAD_RESELECTION_ACTION = "android.intent.extra.EXTRA_CHOOSER_PAYLOAD_RESELECTION_ACTION"; /** * An {@code ArrayList} of {@code String} annotations describing content for * {@link #ACTION_CHOOSER}. Loading core/java/android/service/chooser/ChooserAction.java 0 → 100644 +144 −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.service.chooser; import android.annotation.NonNull; import android.app.PendingIntent; import android.graphics.drawable.Icon; import android.os.Parcel; import android.os.Parcelable; import android.text.TextUtils; import java.util.Objects; /** * A ChooserAction is an app-defined action that can be provided to the Android Sharesheet to * be shown to the user when {@link android.content.Intent.ACTION_CHOOSER} is invoked. * * @see android.content.Intent.EXTRA_CHOOSER_CUSTOM_ACTIONS * @see android.content.Intent.EXTRA_CHOOSER_PAYLOAD_RESELECTION_ACTION * @hide */ public final class ChooserAction implements Parcelable { private final Icon mIcon; private final CharSequence mLabel; private final PendingIntent mAction; private ChooserAction( Icon icon, CharSequence label, PendingIntent action) { mIcon = icon; mLabel = label; mAction = action; } /** * Return a user-readable label for this action. */ @NonNull public CharSequence getLabel() { return mLabel; } /** * Return an {@link Icon} representing this action. */ @NonNull public Icon getIcon() { return mIcon; } /** * Return the action intent. */ @NonNull public PendingIntent getAction() { return mAction; } @Override public int describeContents() { return 0; } @Override public void writeToParcel(@NonNull Parcel dest, int flags) { mIcon.writeToParcel(dest, flags); TextUtils.writeToParcel(mLabel, dest, flags); mAction.writeToParcel(dest, flags); } @Override public String toString() { return "ChooserAction {" + "label=" + mLabel + ", intent=" + mAction + "}"; } public static final Parcelable.Creator<ChooserAction> CREATOR = new Creator<ChooserAction>() { @Override public ChooserAction createFromParcel(Parcel source) { return new ChooserAction( Icon.CREATOR.createFromParcel(source), TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(source), PendingIntent.CREATOR.createFromParcel(source)); } @Override public ChooserAction[] newArray(int size) { return new ChooserAction[size]; } }; /** * Builder class for {@link ChooserAction} objects */ public static final class Builder { private final Icon mIcon; private final CharSequence mLabel; private final PendingIntent mAction; /** * Construct a new builder for {@link ChooserAction} object. * * @param icon an {@link Icon} representing this action, consisting of a white foreground * atop a transparent background. * @param label label the user-readable label for this action. * @param action {@link PendingIntent} to be invoked when the action is selected. */ public Builder( @NonNull Icon icon, @NonNull CharSequence label, @NonNull PendingIntent action) { Objects.requireNonNull(icon, "icon can not be null"); Objects.requireNonNull(label, "label can not be null"); Objects.requireNonNull(action, "pending intent can not be null"); mIcon = icon; mLabel = label; mAction = action; } /** * Combine all of the options that have been set and return a new {@link ChooserAction} * object. * @return the built action */ public ChooserAction build() { return new ChooserAction(mIcon, mLabel, mAction); } } } core/java/com/android/internal/jank/InteractionJankMonitor.java +13 −1 Original line number Diff line number Diff line Loading @@ -28,6 +28,8 @@ import static com.android.internal.util.FrameworkStatsLog.UIINTERACTION_FRAME_IN import static com.android.internal.util.FrameworkStatsLog.UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__LAUNCHER_APP_LAUNCH_FROM_RECENTS; import static com.android.internal.util.FrameworkStatsLog.UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__LAUNCHER_APP_LAUNCH_FROM_WIDGET; import static com.android.internal.util.FrameworkStatsLog.UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__LAUNCHER_APP_SWIPE_TO_RECENTS; import static com.android.internal.util.FrameworkStatsLog.UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__LAUNCHER_CLOSE_ALL_APPS_SWIPE; import static com.android.internal.util.FrameworkStatsLog.UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__LAUNCHER_CLOSE_ALL_APPS_TO_HOME; import static com.android.internal.util.FrameworkStatsLog.UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__LAUNCHER_OPEN_ALL_APPS; import static com.android.internal.util.FrameworkStatsLog.UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__LAUNCHER_QUICK_SWITCH; import static com.android.internal.util.FrameworkStatsLog.UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__LAUNCHER_UNLOCK_ENTRANCE_ANIMATION; Loading Loading @@ -227,6 +229,8 @@ public class InteractionJankMonitor { public static final int CUJ_LOCKSCREEN_OCCLUSION = 64; public static final int CUJ_RECENTS_SCROLLING = 65; public static final int CUJ_LAUNCHER_APP_SWIPE_TO_RECENTS = 66; public static final int CUJ_LAUNCHER_CLOSE_ALL_APPS_SWIPE = 67; public static final int CUJ_LAUNCHER_CLOSE_ALL_APPS_TO_HOME = 68; private static final int NO_STATSD_LOGGING = -1; Loading Loading @@ -302,6 +306,8 @@ public class InteractionJankMonitor { UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__LOCKSCREEN_OCCLUSION, UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__RECENTS_SCROLLING, UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__LAUNCHER_APP_SWIPE_TO_RECENTS, UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__LAUNCHER_CLOSE_ALL_APPS_SWIPE, UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__LAUNCHER_CLOSE_ALL_APPS_TO_HOME, }; private static volatile InteractionJankMonitor sInstance; Loading Loading @@ -388,7 +394,9 @@ public class InteractionJankMonitor { CUJ_LAUNCHER_UNLOCK_ENTRANCE_ANIMATION, CUJ_LOCKSCREEN_OCCLUSION, CUJ_RECENTS_SCROLLING, CUJ_LAUNCHER_APP_SWIPE_TO_RECENTS CUJ_LAUNCHER_APP_SWIPE_TO_RECENTS, CUJ_LAUNCHER_CLOSE_ALL_APPS_SWIPE, CUJ_LAUNCHER_CLOSE_ALL_APPS_TO_HOME }) @Retention(RetentionPolicy.SOURCE) public @interface CujType { Loading Loading @@ -905,6 +913,10 @@ public class InteractionJankMonitor { return "RECENTS_SCROLLING"; case CUJ_LAUNCHER_APP_SWIPE_TO_RECENTS: return "LAUNCHER_APP_SWIPE_TO_RECENTS"; case CUJ_LAUNCHER_CLOSE_ALL_APPS_SWIPE: return "LAUNCHER_CLOSE_ALL_APPS_SWIPE"; case CUJ_LAUNCHER_CLOSE_ALL_APPS_TO_HOME: return "LAUNCHER_CLOSE_ALL_APPS_TO_HOME"; } return "UNKNOWN"; } Loading libs/WindowManager/Shell/src/com/android/wm/shell/dagger/WMShellModule.java +2 −2 Original line number Diff line number Diff line Loading @@ -93,7 +93,7 @@ import com.android.wm.shell.unfold.animation.SplitTaskUnfoldAnimator; import com.android.wm.shell.unfold.animation.UnfoldTaskAnimator; import com.android.wm.shell.unfold.qualifier.UnfoldShellTransition; import com.android.wm.shell.unfold.qualifier.UnfoldTransition; import com.android.wm.shell.windowdecor.CaptionWindowDecorViewModel; import com.android.wm.shell.windowdecor.DesktopModeWindowDecorViewModel; import com.android.wm.shell.windowdecor.WindowDecorViewModel; import java.util.ArrayList; Loading Loading @@ -192,7 +192,7 @@ public abstract class WMShellModule { SyncTransactionQueue syncQueue, Optional<DesktopModeController> desktopModeController, Optional<DesktopTasksController> desktopTasksController) { return new CaptionWindowDecorViewModel( return new DesktopModeWindowDecorViewModel( context, mainHandler, mainChoreographer, Loading libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/CaptionWindowDecorViewModel.java→libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/DesktopModeWindowDecorViewModel.java +27 −26 Original line number Diff line number Diff line Loading @@ -61,12 +61,12 @@ import java.util.Optional; /** * View model for the window decoration with a caption and shadows. Works with * {@link CaptionWindowDecoration}. * {@link DesktopModeWindowDecoration}. */ public class CaptionWindowDecorViewModel implements WindowDecorViewModel { private static final String TAG = "CaptionViewModel"; private final CaptionWindowDecoration.Factory mCaptionWindowDecorFactory; public class DesktopModeWindowDecorViewModel implements WindowDecorViewModel { private static final String TAG = "DesktopModeWindowDecorViewModel"; private final DesktopModeWindowDecoration.Factory mDesktopModeWindowDecorFactory; private final ActivityTaskManager mActivityTaskManager; private final ShellTaskOrganizer mTaskOrganizer; private final Context mContext; Loading @@ -81,11 +81,12 @@ public class CaptionWindowDecorViewModel implements WindowDecorViewModel { private SparseArray<EventReceiver> mEventReceiversByDisplay = new SparseArray<>(); private final SparseArray<CaptionWindowDecoration> mWindowDecorByTaskId = new SparseArray<>(); private final SparseArray<DesktopModeWindowDecoration> mWindowDecorByTaskId = new SparseArray<>(); private final DragStartListenerImpl mDragStartListener = new DragStartListenerImpl(); private InputMonitorFactory mInputMonitorFactory; public CaptionWindowDecorViewModel( public DesktopModeWindowDecorViewModel( Context context, Handler mainHandler, Choreographer mainChoreographer, Loading @@ -103,12 +104,12 @@ public class CaptionWindowDecorViewModel implements WindowDecorViewModel { syncQueue, desktopModeController, desktopTasksController, new CaptionWindowDecoration.Factory(), new DesktopModeWindowDecoration.Factory(), new InputMonitorFactory()); } @VisibleForTesting CaptionWindowDecorViewModel( DesktopModeWindowDecorViewModel( Context context, Handler mainHandler, Choreographer mainChoreographer, Loading @@ -117,7 +118,7 @@ public class CaptionWindowDecorViewModel implements WindowDecorViewModel { SyncTransactionQueue syncQueue, Optional<DesktopModeController> desktopModeController, Optional<DesktopTasksController> desktopTasksController, CaptionWindowDecoration.Factory captionWindowDecorFactory, DesktopModeWindowDecoration.Factory desktopModeWindowDecorFactory, InputMonitorFactory inputMonitorFactory) { mContext = context; mMainHandler = mainHandler; Loading @@ -129,7 +130,7 @@ public class CaptionWindowDecorViewModel implements WindowDecorViewModel { mDesktopModeController = desktopModeController; mDesktopTasksController = desktopTasksController; mCaptionWindowDecorFactory = captionWindowDecorFactory; mDesktopModeWindowDecorFactory = desktopModeWindowDecorFactory; mInputMonitorFactory = inputMonitorFactory; } Loading @@ -151,7 +152,7 @@ public class CaptionWindowDecorViewModel implements WindowDecorViewModel { @Override public void onTaskInfoChanged(RunningTaskInfo taskInfo) { final CaptionWindowDecoration decoration = mWindowDecorByTaskId.get(taskInfo.taskId); final DesktopModeWindowDecoration decoration = mWindowDecorByTaskId.get(taskInfo.taskId); if (decoration == null) return; Loading @@ -170,7 +171,7 @@ public class CaptionWindowDecorViewModel implements WindowDecorViewModel { SurfaceControl taskSurface, SurfaceControl.Transaction startT, SurfaceControl.Transaction finishT) { final CaptionWindowDecoration decoration = mWindowDecorByTaskId.get(taskInfo.taskId); final DesktopModeWindowDecoration decoration = mWindowDecorByTaskId.get(taskInfo.taskId); if (!shouldShowWindowDecor(taskInfo)) { if (decoration != null) { Loading @@ -191,7 +192,7 @@ public class CaptionWindowDecorViewModel implements WindowDecorViewModel { RunningTaskInfo taskInfo, SurfaceControl.Transaction startT, SurfaceControl.Transaction finishT) { final CaptionWindowDecoration decoration = mWindowDecorByTaskId.get(taskInfo.taskId); final DesktopModeWindowDecoration decoration = mWindowDecorByTaskId.get(taskInfo.taskId); if (decoration == null) return; decoration.relayout(taskInfo, startT, finishT); Loading @@ -199,7 +200,7 @@ public class CaptionWindowDecorViewModel implements WindowDecorViewModel { @Override public void destroyWindowDecoration(RunningTaskInfo taskInfo) { final CaptionWindowDecoration decoration = final DesktopModeWindowDecoration decoration = mWindowDecorByTaskId.removeReturnOld(taskInfo.taskId); if (decoration == null) return; Loading Loading @@ -232,7 +233,7 @@ public class CaptionWindowDecorViewModel implements WindowDecorViewModel { @Override public void onClick(View v) { CaptionWindowDecoration decoration = mWindowDecorByTaskId.get(mTaskId); DesktopModeWindowDecoration decoration = mWindowDecorByTaskId.get(mTaskId); final int id = v.getId(); if (id == R.id.close_window) { WindowContainerTransaction wct = new WindowContainerTransaction(); Loading Loading @@ -373,7 +374,7 @@ public class CaptionWindowDecorViewModel implements WindowDecorViewModel { boolean handled = false; if (event instanceof MotionEvent) { handled = true; CaptionWindowDecorViewModel.this DesktopModeWindowDecorViewModel.this .handleReceivedMotionEvent((MotionEvent) event, mInputMonitor); } finishInputEvent(event, handled); Loading Loading @@ -433,7 +434,7 @@ public class CaptionWindowDecorViewModel implements WindowDecorViewModel { */ private void handleReceivedMotionEvent(MotionEvent ev, InputMonitor inputMonitor) { if (DesktopModeStatus.isProto2Enabled()) { CaptionWindowDecoration focusedDecor = getFocusedDecor(); DesktopModeWindowDecoration focusedDecor = getFocusedDecor(); if (focusedDecor == null || focusedDecor.mTaskInfo.getWindowingMode() != WINDOWING_MODE_FREEFORM) { handleCaptionThroughStatusBar(ev); Loading @@ -460,7 +461,7 @@ public class CaptionWindowDecorViewModel implements WindowDecorViewModel { private void handleEventOutsideFocusedCaption(MotionEvent ev) { int action = ev.getActionMasked(); if (action == MotionEvent.ACTION_UP || action == MotionEvent.ACTION_CANCEL) { CaptionWindowDecoration focusedDecor = getFocusedDecor(); DesktopModeWindowDecoration focusedDecor = getFocusedDecor(); if (focusedDecor == null) { return; } Loading @@ -480,7 +481,7 @@ public class CaptionWindowDecorViewModel implements WindowDecorViewModel { switch (ev.getActionMasked()) { case MotionEvent.ACTION_DOWN: { // Begin drag through status bar if applicable. CaptionWindowDecoration focusedDecor = getFocusedDecor(); DesktopModeWindowDecoration focusedDecor = getFocusedDecor(); if (focusedDecor != null) { boolean dragFromStatusBarAllowed = false; if (DesktopModeStatus.isProto2Enabled()) { Loading @@ -499,7 +500,7 @@ public class CaptionWindowDecorViewModel implements WindowDecorViewModel { break; } case MotionEvent.ACTION_UP: { CaptionWindowDecoration focusedDecor = getFocusedDecor(); DesktopModeWindowDecoration focusedDecor = getFocusedDecor(); if (focusedDecor == null) { mTransitionDragActive = false; return; Loading Loading @@ -529,11 +530,11 @@ public class CaptionWindowDecorViewModel implements WindowDecorViewModel { } @Nullable private CaptionWindowDecoration getFocusedDecor() { private DesktopModeWindowDecoration getFocusedDecor() { int size = mWindowDecorByTaskId.size(); CaptionWindowDecoration focusedDecor = null; DesktopModeWindowDecoration focusedDecor = null; for (int i = 0; i < size; i++) { CaptionWindowDecoration decor = mWindowDecorByTaskId.valueAt(i); DesktopModeWindowDecoration decor = mWindowDecorByTaskId.valueAt(i); if (decor != null && decor.isFocused()) { focusedDecor = decor; break; Loading Loading @@ -571,13 +572,13 @@ public class CaptionWindowDecorViewModel implements WindowDecorViewModel { SurfaceControl taskSurface, SurfaceControl.Transaction startT, SurfaceControl.Transaction finishT) { CaptionWindowDecoration oldDecoration = mWindowDecorByTaskId.get(taskInfo.taskId); DesktopModeWindowDecoration oldDecoration = mWindowDecorByTaskId.get(taskInfo.taskId); if (oldDecoration != null) { // close the old decoration if it exists to avoid two window decorations being added oldDecoration.close(); } final CaptionWindowDecoration windowDecoration = mCaptionWindowDecorFactory.create( final DesktopModeWindowDecoration windowDecoration = mDesktopModeWindowDecorFactory.create( mContext, mDisplayController, mTaskOrganizer, Loading Loading
core/java/android/content/Intent.java +20 −0 Original line number Diff line number Diff line Loading @@ -65,6 +65,7 @@ import android.provider.DocumentsContract; import android.provider.DocumentsProvider; import android.provider.MediaStore; import android.provider.OpenableColumns; import android.service.chooser.ChooserAction; import android.telecom.PhoneAccount; import android.telecom.TelecomManager; import android.text.TextUtils; Loading Loading @@ -5730,6 +5731,25 @@ public class Intent implements Parcelable, Cloneable { public static final String EXTRA_CHOOSER_REFINEMENT_INTENT_SENDER = "android.intent.extra.CHOOSER_REFINEMENT_INTENT_SENDER"; /** * A Parcelable[] of {@link ChooserAction} objects to provide the Android Sharesheet with * app-specific actions to be presented to the user when invoking {@link #ACTION_CHOOSER}. * @hide */ public static final String EXTRA_CHOOSER_CUSTOM_ACTIONS = "android.intent.extra.EXTRA_CHOOSER_CUSTOM_ACTIONS"; /** * Optional argument to be used with {@link #ACTION_CHOOSER}. * A {@link android.app.PendingIntent} to be sent when the user wants to do payload reselection * in the sharesheet. * A reselection action allows the user to return to the source app to change the content being * shared. * @hide */ public static final String EXTRA_CHOOSER_PAYLOAD_RESELECTION_ACTION = "android.intent.extra.EXTRA_CHOOSER_PAYLOAD_RESELECTION_ACTION"; /** * An {@code ArrayList} of {@code String} annotations describing content for * {@link #ACTION_CHOOSER}. Loading
core/java/android/service/chooser/ChooserAction.java 0 → 100644 +144 −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.service.chooser; import android.annotation.NonNull; import android.app.PendingIntent; import android.graphics.drawable.Icon; import android.os.Parcel; import android.os.Parcelable; import android.text.TextUtils; import java.util.Objects; /** * A ChooserAction is an app-defined action that can be provided to the Android Sharesheet to * be shown to the user when {@link android.content.Intent.ACTION_CHOOSER} is invoked. * * @see android.content.Intent.EXTRA_CHOOSER_CUSTOM_ACTIONS * @see android.content.Intent.EXTRA_CHOOSER_PAYLOAD_RESELECTION_ACTION * @hide */ public final class ChooserAction implements Parcelable { private final Icon mIcon; private final CharSequence mLabel; private final PendingIntent mAction; private ChooserAction( Icon icon, CharSequence label, PendingIntent action) { mIcon = icon; mLabel = label; mAction = action; } /** * Return a user-readable label for this action. */ @NonNull public CharSequence getLabel() { return mLabel; } /** * Return an {@link Icon} representing this action. */ @NonNull public Icon getIcon() { return mIcon; } /** * Return the action intent. */ @NonNull public PendingIntent getAction() { return mAction; } @Override public int describeContents() { return 0; } @Override public void writeToParcel(@NonNull Parcel dest, int flags) { mIcon.writeToParcel(dest, flags); TextUtils.writeToParcel(mLabel, dest, flags); mAction.writeToParcel(dest, flags); } @Override public String toString() { return "ChooserAction {" + "label=" + mLabel + ", intent=" + mAction + "}"; } public static final Parcelable.Creator<ChooserAction> CREATOR = new Creator<ChooserAction>() { @Override public ChooserAction createFromParcel(Parcel source) { return new ChooserAction( Icon.CREATOR.createFromParcel(source), TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(source), PendingIntent.CREATOR.createFromParcel(source)); } @Override public ChooserAction[] newArray(int size) { return new ChooserAction[size]; } }; /** * Builder class for {@link ChooserAction} objects */ public static final class Builder { private final Icon mIcon; private final CharSequence mLabel; private final PendingIntent mAction; /** * Construct a new builder for {@link ChooserAction} object. * * @param icon an {@link Icon} representing this action, consisting of a white foreground * atop a transparent background. * @param label label the user-readable label for this action. * @param action {@link PendingIntent} to be invoked when the action is selected. */ public Builder( @NonNull Icon icon, @NonNull CharSequence label, @NonNull PendingIntent action) { Objects.requireNonNull(icon, "icon can not be null"); Objects.requireNonNull(label, "label can not be null"); Objects.requireNonNull(action, "pending intent can not be null"); mIcon = icon; mLabel = label; mAction = action; } /** * Combine all of the options that have been set and return a new {@link ChooserAction} * object. * @return the built action */ public ChooserAction build() { return new ChooserAction(mIcon, mLabel, mAction); } } }
core/java/com/android/internal/jank/InteractionJankMonitor.java +13 −1 Original line number Diff line number Diff line Loading @@ -28,6 +28,8 @@ import static com.android.internal.util.FrameworkStatsLog.UIINTERACTION_FRAME_IN import static com.android.internal.util.FrameworkStatsLog.UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__LAUNCHER_APP_LAUNCH_FROM_RECENTS; import static com.android.internal.util.FrameworkStatsLog.UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__LAUNCHER_APP_LAUNCH_FROM_WIDGET; import static com.android.internal.util.FrameworkStatsLog.UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__LAUNCHER_APP_SWIPE_TO_RECENTS; import static com.android.internal.util.FrameworkStatsLog.UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__LAUNCHER_CLOSE_ALL_APPS_SWIPE; import static com.android.internal.util.FrameworkStatsLog.UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__LAUNCHER_CLOSE_ALL_APPS_TO_HOME; import static com.android.internal.util.FrameworkStatsLog.UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__LAUNCHER_OPEN_ALL_APPS; import static com.android.internal.util.FrameworkStatsLog.UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__LAUNCHER_QUICK_SWITCH; import static com.android.internal.util.FrameworkStatsLog.UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__LAUNCHER_UNLOCK_ENTRANCE_ANIMATION; Loading Loading @@ -227,6 +229,8 @@ public class InteractionJankMonitor { public static final int CUJ_LOCKSCREEN_OCCLUSION = 64; public static final int CUJ_RECENTS_SCROLLING = 65; public static final int CUJ_LAUNCHER_APP_SWIPE_TO_RECENTS = 66; public static final int CUJ_LAUNCHER_CLOSE_ALL_APPS_SWIPE = 67; public static final int CUJ_LAUNCHER_CLOSE_ALL_APPS_TO_HOME = 68; private static final int NO_STATSD_LOGGING = -1; Loading Loading @@ -302,6 +306,8 @@ public class InteractionJankMonitor { UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__LOCKSCREEN_OCCLUSION, UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__RECENTS_SCROLLING, UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__LAUNCHER_APP_SWIPE_TO_RECENTS, UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__LAUNCHER_CLOSE_ALL_APPS_SWIPE, UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__LAUNCHER_CLOSE_ALL_APPS_TO_HOME, }; private static volatile InteractionJankMonitor sInstance; Loading Loading @@ -388,7 +394,9 @@ public class InteractionJankMonitor { CUJ_LAUNCHER_UNLOCK_ENTRANCE_ANIMATION, CUJ_LOCKSCREEN_OCCLUSION, CUJ_RECENTS_SCROLLING, CUJ_LAUNCHER_APP_SWIPE_TO_RECENTS CUJ_LAUNCHER_APP_SWIPE_TO_RECENTS, CUJ_LAUNCHER_CLOSE_ALL_APPS_SWIPE, CUJ_LAUNCHER_CLOSE_ALL_APPS_TO_HOME }) @Retention(RetentionPolicy.SOURCE) public @interface CujType { Loading Loading @@ -905,6 +913,10 @@ public class InteractionJankMonitor { return "RECENTS_SCROLLING"; case CUJ_LAUNCHER_APP_SWIPE_TO_RECENTS: return "LAUNCHER_APP_SWIPE_TO_RECENTS"; case CUJ_LAUNCHER_CLOSE_ALL_APPS_SWIPE: return "LAUNCHER_CLOSE_ALL_APPS_SWIPE"; case CUJ_LAUNCHER_CLOSE_ALL_APPS_TO_HOME: return "LAUNCHER_CLOSE_ALL_APPS_TO_HOME"; } return "UNKNOWN"; } Loading
libs/WindowManager/Shell/src/com/android/wm/shell/dagger/WMShellModule.java +2 −2 Original line number Diff line number Diff line Loading @@ -93,7 +93,7 @@ import com.android.wm.shell.unfold.animation.SplitTaskUnfoldAnimator; import com.android.wm.shell.unfold.animation.UnfoldTaskAnimator; import com.android.wm.shell.unfold.qualifier.UnfoldShellTransition; import com.android.wm.shell.unfold.qualifier.UnfoldTransition; import com.android.wm.shell.windowdecor.CaptionWindowDecorViewModel; import com.android.wm.shell.windowdecor.DesktopModeWindowDecorViewModel; import com.android.wm.shell.windowdecor.WindowDecorViewModel; import java.util.ArrayList; Loading Loading @@ -192,7 +192,7 @@ public abstract class WMShellModule { SyncTransactionQueue syncQueue, Optional<DesktopModeController> desktopModeController, Optional<DesktopTasksController> desktopTasksController) { return new CaptionWindowDecorViewModel( return new DesktopModeWindowDecorViewModel( context, mainHandler, mainChoreographer, Loading
libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/CaptionWindowDecorViewModel.java→libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/DesktopModeWindowDecorViewModel.java +27 −26 Original line number Diff line number Diff line Loading @@ -61,12 +61,12 @@ import java.util.Optional; /** * View model for the window decoration with a caption and shadows. Works with * {@link CaptionWindowDecoration}. * {@link DesktopModeWindowDecoration}. */ public class CaptionWindowDecorViewModel implements WindowDecorViewModel { private static final String TAG = "CaptionViewModel"; private final CaptionWindowDecoration.Factory mCaptionWindowDecorFactory; public class DesktopModeWindowDecorViewModel implements WindowDecorViewModel { private static final String TAG = "DesktopModeWindowDecorViewModel"; private final DesktopModeWindowDecoration.Factory mDesktopModeWindowDecorFactory; private final ActivityTaskManager mActivityTaskManager; private final ShellTaskOrganizer mTaskOrganizer; private final Context mContext; Loading @@ -81,11 +81,12 @@ public class CaptionWindowDecorViewModel implements WindowDecorViewModel { private SparseArray<EventReceiver> mEventReceiversByDisplay = new SparseArray<>(); private final SparseArray<CaptionWindowDecoration> mWindowDecorByTaskId = new SparseArray<>(); private final SparseArray<DesktopModeWindowDecoration> mWindowDecorByTaskId = new SparseArray<>(); private final DragStartListenerImpl mDragStartListener = new DragStartListenerImpl(); private InputMonitorFactory mInputMonitorFactory; public CaptionWindowDecorViewModel( public DesktopModeWindowDecorViewModel( Context context, Handler mainHandler, Choreographer mainChoreographer, Loading @@ -103,12 +104,12 @@ public class CaptionWindowDecorViewModel implements WindowDecorViewModel { syncQueue, desktopModeController, desktopTasksController, new CaptionWindowDecoration.Factory(), new DesktopModeWindowDecoration.Factory(), new InputMonitorFactory()); } @VisibleForTesting CaptionWindowDecorViewModel( DesktopModeWindowDecorViewModel( Context context, Handler mainHandler, Choreographer mainChoreographer, Loading @@ -117,7 +118,7 @@ public class CaptionWindowDecorViewModel implements WindowDecorViewModel { SyncTransactionQueue syncQueue, Optional<DesktopModeController> desktopModeController, Optional<DesktopTasksController> desktopTasksController, CaptionWindowDecoration.Factory captionWindowDecorFactory, DesktopModeWindowDecoration.Factory desktopModeWindowDecorFactory, InputMonitorFactory inputMonitorFactory) { mContext = context; mMainHandler = mainHandler; Loading @@ -129,7 +130,7 @@ public class CaptionWindowDecorViewModel implements WindowDecorViewModel { mDesktopModeController = desktopModeController; mDesktopTasksController = desktopTasksController; mCaptionWindowDecorFactory = captionWindowDecorFactory; mDesktopModeWindowDecorFactory = desktopModeWindowDecorFactory; mInputMonitorFactory = inputMonitorFactory; } Loading @@ -151,7 +152,7 @@ public class CaptionWindowDecorViewModel implements WindowDecorViewModel { @Override public void onTaskInfoChanged(RunningTaskInfo taskInfo) { final CaptionWindowDecoration decoration = mWindowDecorByTaskId.get(taskInfo.taskId); final DesktopModeWindowDecoration decoration = mWindowDecorByTaskId.get(taskInfo.taskId); if (decoration == null) return; Loading @@ -170,7 +171,7 @@ public class CaptionWindowDecorViewModel implements WindowDecorViewModel { SurfaceControl taskSurface, SurfaceControl.Transaction startT, SurfaceControl.Transaction finishT) { final CaptionWindowDecoration decoration = mWindowDecorByTaskId.get(taskInfo.taskId); final DesktopModeWindowDecoration decoration = mWindowDecorByTaskId.get(taskInfo.taskId); if (!shouldShowWindowDecor(taskInfo)) { if (decoration != null) { Loading @@ -191,7 +192,7 @@ public class CaptionWindowDecorViewModel implements WindowDecorViewModel { RunningTaskInfo taskInfo, SurfaceControl.Transaction startT, SurfaceControl.Transaction finishT) { final CaptionWindowDecoration decoration = mWindowDecorByTaskId.get(taskInfo.taskId); final DesktopModeWindowDecoration decoration = mWindowDecorByTaskId.get(taskInfo.taskId); if (decoration == null) return; decoration.relayout(taskInfo, startT, finishT); Loading @@ -199,7 +200,7 @@ public class CaptionWindowDecorViewModel implements WindowDecorViewModel { @Override public void destroyWindowDecoration(RunningTaskInfo taskInfo) { final CaptionWindowDecoration decoration = final DesktopModeWindowDecoration decoration = mWindowDecorByTaskId.removeReturnOld(taskInfo.taskId); if (decoration == null) return; Loading Loading @@ -232,7 +233,7 @@ public class CaptionWindowDecorViewModel implements WindowDecorViewModel { @Override public void onClick(View v) { CaptionWindowDecoration decoration = mWindowDecorByTaskId.get(mTaskId); DesktopModeWindowDecoration decoration = mWindowDecorByTaskId.get(mTaskId); final int id = v.getId(); if (id == R.id.close_window) { WindowContainerTransaction wct = new WindowContainerTransaction(); Loading Loading @@ -373,7 +374,7 @@ public class CaptionWindowDecorViewModel implements WindowDecorViewModel { boolean handled = false; if (event instanceof MotionEvent) { handled = true; CaptionWindowDecorViewModel.this DesktopModeWindowDecorViewModel.this .handleReceivedMotionEvent((MotionEvent) event, mInputMonitor); } finishInputEvent(event, handled); Loading Loading @@ -433,7 +434,7 @@ public class CaptionWindowDecorViewModel implements WindowDecorViewModel { */ private void handleReceivedMotionEvent(MotionEvent ev, InputMonitor inputMonitor) { if (DesktopModeStatus.isProto2Enabled()) { CaptionWindowDecoration focusedDecor = getFocusedDecor(); DesktopModeWindowDecoration focusedDecor = getFocusedDecor(); if (focusedDecor == null || focusedDecor.mTaskInfo.getWindowingMode() != WINDOWING_MODE_FREEFORM) { handleCaptionThroughStatusBar(ev); Loading @@ -460,7 +461,7 @@ public class CaptionWindowDecorViewModel implements WindowDecorViewModel { private void handleEventOutsideFocusedCaption(MotionEvent ev) { int action = ev.getActionMasked(); if (action == MotionEvent.ACTION_UP || action == MotionEvent.ACTION_CANCEL) { CaptionWindowDecoration focusedDecor = getFocusedDecor(); DesktopModeWindowDecoration focusedDecor = getFocusedDecor(); if (focusedDecor == null) { return; } Loading @@ -480,7 +481,7 @@ public class CaptionWindowDecorViewModel implements WindowDecorViewModel { switch (ev.getActionMasked()) { case MotionEvent.ACTION_DOWN: { // Begin drag through status bar if applicable. CaptionWindowDecoration focusedDecor = getFocusedDecor(); DesktopModeWindowDecoration focusedDecor = getFocusedDecor(); if (focusedDecor != null) { boolean dragFromStatusBarAllowed = false; if (DesktopModeStatus.isProto2Enabled()) { Loading @@ -499,7 +500,7 @@ public class CaptionWindowDecorViewModel implements WindowDecorViewModel { break; } case MotionEvent.ACTION_UP: { CaptionWindowDecoration focusedDecor = getFocusedDecor(); DesktopModeWindowDecoration focusedDecor = getFocusedDecor(); if (focusedDecor == null) { mTransitionDragActive = false; return; Loading Loading @@ -529,11 +530,11 @@ public class CaptionWindowDecorViewModel implements WindowDecorViewModel { } @Nullable private CaptionWindowDecoration getFocusedDecor() { private DesktopModeWindowDecoration getFocusedDecor() { int size = mWindowDecorByTaskId.size(); CaptionWindowDecoration focusedDecor = null; DesktopModeWindowDecoration focusedDecor = null; for (int i = 0; i < size; i++) { CaptionWindowDecoration decor = mWindowDecorByTaskId.valueAt(i); DesktopModeWindowDecoration decor = mWindowDecorByTaskId.valueAt(i); if (decor != null && decor.isFocused()) { focusedDecor = decor; break; Loading Loading @@ -571,13 +572,13 @@ public class CaptionWindowDecorViewModel implements WindowDecorViewModel { SurfaceControl taskSurface, SurfaceControl.Transaction startT, SurfaceControl.Transaction finishT) { CaptionWindowDecoration oldDecoration = mWindowDecorByTaskId.get(taskInfo.taskId); DesktopModeWindowDecoration oldDecoration = mWindowDecorByTaskId.get(taskInfo.taskId); if (oldDecoration != null) { // close the old decoration if it exists to avoid two window decorations being added oldDecoration.close(); } final CaptionWindowDecoration windowDecoration = mCaptionWindowDecorFactory.create( final DesktopModeWindowDecoration windowDecoration = mDesktopModeWindowDecorFactory.create( mContext, mDisplayController, mTaskOrganizer, Loading