diff --git a/core/java/android/content/pm/ActivityInfo.java b/core/java/android/content/pm/ActivityInfo.java index af5f9ceb14d8f..60ab83aa2264b 100644 --- a/core/java/android/content/pm/ActivityInfo.java +++ b/core/java/android/content/pm/ActivityInfo.java @@ -524,8 +524,12 @@ public class ActivityInfo extends ComponentInfo implements Parcelable { * owned ActivityContainer such as that within an ActivityView. If not set and * this activity is launched into such a container a SecurityException will be * thrown. Set from the {@link android.R.attr#allowEmbedded} attribute. + * + * @deprecated this flag is no longer needed since ActivityView is now fully removed + * TODO(b/191165536): delete this flag since is no longer used */ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553) + @Deprecated public static final int FLAG_ALLOW_EMBEDDED = 0x80000000; /** diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java index a8fe875f34858..9450801d8d834 100644 --- a/core/java/android/view/View.java +++ b/core/java/android/view/View.java @@ -20703,8 +20703,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, } /** - * Return the window this view is currently attached to. Used in - * {@link android.app.ActivityView} to communicate with WM. + * Return the window this view is currently attached to. * @hide */ protected IWindow getWindow() { diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleController.java b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleController.java index 202d9f013cc0a..09fcb86e56ded 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleController.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleController.java @@ -704,7 +704,7 @@ public class BubbleController { mSysuiProxy.getShouldRestoredEntries(savedBubbleKeys, (entries) -> { mMainExecutor.execute(() -> { for (BubbleEntry e : entries) { - if (canLaunchInActivityView(mContext, e)) { + if (canLaunchInTaskView(mContext, e)) { updateBubble(e, true /* suppressFlyout */, false /* showInShade */); } } @@ -962,14 +962,14 @@ public class BubbleController { } private void onEntryAdded(BubbleEntry entry) { - if (canLaunchInActivityView(mContext, entry)) { + if (canLaunchInTaskView(mContext, entry)) { updateBubble(entry); } } private void onEntryUpdated(BubbleEntry entry, boolean shouldBubbleUp) { // shouldBubbleUp checks canBubble & for bubble metadata - boolean shouldBubble = shouldBubbleUp && canLaunchInActivityView(mContext, entry); + boolean shouldBubble = shouldBubbleUp && canLaunchInTaskView(mContext, entry); if (!shouldBubble && mBubbleData.hasAnyBubbleWithKey(entry.getKey())) { // It was previously a bubble but no longer a bubble -- lets remove it removeBubble(entry.getKey(), DISMISS_NO_LONGER_BUBBLE); @@ -1303,15 +1303,16 @@ public class BubbleController { } /** - * Whether an intent is properly configured to display in an {@link android.app.ActivityView}. + * Whether an intent is properly configured to display in a + * {@link com.android.wm.shell.TaskView}. * - * Keep checks in sync with NotificationManagerService#canLaunchInActivityView. Typically + * Keep checks in sync with BubbleExtractor#canLaunchInTaskView. Typically * that should filter out any invalid bubbles, but should protect SysUI side just in case. * * @param context the context to use. * @param entry the entry to bubble. */ - static boolean canLaunchInActivityView(Context context, BubbleEntry entry) { + static boolean canLaunchInTaskView(Context context, BubbleEntry entry) { PendingIntent intent = entry.getBubbleMetadata() != null ? entry.getBubbleMetadata().getIntent() : null; diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleExpandedView.java b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleExpandedView.java index f81f086e598f5..9687ec6a8168d 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleExpandedView.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleExpandedView.java @@ -90,15 +90,15 @@ public class BubbleExpandedView extends LinearLayout { private boolean mNeedsNewHeight; /** - * Whether we want the TaskView's content to be visible (alpha = 1f). If - * {@link #mIsAlphaAnimating} is true, this may not reflect the TaskView's actual alpha value - * until the animation ends. + * Whether we want the {@code TaskView}'s content to be visible (alpha = 1f). If + * {@link #mIsAlphaAnimating} is true, this may not reflect the {@code TaskView}'s actual alpha + * value until the animation ends. */ private boolean mIsContentVisible = false; /** - * Whether we're animating the TaskView's alpha value. If so, we will hold off on applying alpha - * changes from {@link #setContentVisibility} until the animation ends. + * Whether we're animating the {@code TaskView}'s alpha value. If so, we will hold off on + * applying alpha changes from {@link #setContentVisibility} until the animation ends. */ private boolean mIsAlphaAnimating = false; @@ -127,8 +127,8 @@ public class BubbleExpandedView extends LinearLayout { private BubblePositioner mPositioner; /** - * Container for the ActivityView that has a solid, round-rect background that shows if the - * ActivityView hasn't loaded. + * Container for the {@code TaskView} that has a solid, round-rect background that shows if the + * {@code TaskView} hasn't loaded. */ private final FrameLayout mExpandedViewContainer = new FrameLayout(getContext()); @@ -139,7 +139,7 @@ public class BubbleExpandedView extends LinearLayout { @Override public void onInitialized() { if (DEBUG_BUBBLE_EXPANDED_VIEW) { - Log.d(TAG, "onActivityViewReady: destroyed=" + mDestroyed + Log.d(TAG, "onInitialized: destroyed=" + mDestroyed + " initialized=" + mInitialized + " bubble=" + getBubbleKey()); } @@ -159,7 +159,7 @@ public class BubbleExpandedView extends LinearLayout { // Post to keep the lifecycle normal post(() -> { if (DEBUG_BUBBLE_EXPANDED_VIEW) { - Log.d(TAG, "onActivityViewReady: calling startActivity, bubble=" + Log.d(TAG, "onInitialized: calling startActivity, bubble=" + getBubbleKey()); } try { @@ -265,7 +265,7 @@ public class BubbleExpandedView extends LinearLayout { mCurrentPointer = mTopPointer; mPointerView.setVisibility(INVISIBLE); - // Set TaskView's alpha value as zero, since there is no view content to be shown. + // Set {@code TaskView}'s alpha value as zero, since there is no view content to be shown. setContentVisibility(false); mExpandedViewContainer.setOutlineProvider(new ViewOutlineProvider() { @@ -290,6 +290,27 @@ public class BubbleExpandedView extends LinearLayout { applyThemeAttrs(); setClipToPadding(false); + setOnTouchListener((view, motionEvent) -> { + if (mTaskView == null) { + return false; + } + + final Rect avBounds = new Rect(); + mTaskView.getBoundsOnScreen(avBounds); + + // Consume and ignore events on the expanded view padding that are within the + // {@code TaskView}'s vertical bounds. These events are part of a back gesture, and so + // they should not collapse the stack (which all other touches on areas around the AV + // would do). + if (motionEvent.getRawY() >= avBounds.top + && motionEvent.getRawY() <= avBounds.bottom + && (motionEvent.getRawX() < avBounds.left + || motionEvent.getRawX() > avBounds.right)) { + return true; + } + + return false; + }); // BubbleStackView is forced LTR, but we want to respect the locale for expanded view layout // so the Manage button appears on the right. @@ -470,7 +491,7 @@ public class BubbleExpandedView extends LinearLayout { /** * Updates the obscured touchable region for the task surface. This calls onLocationChanged, * which results in a call to {@link BubbleStackView#subtractObscuredTouchableRegion}. This is - * useful if a view has been added or removed from on top of the ActivityView, such as the + * useful if a view has been added or removed from on top of the {@code TaskView}, such as the * manage menu. */ void updateObscuredTouchableRegion() { @@ -490,8 +511,9 @@ public class BubbleExpandedView extends LinearLayout { } /** - * Whether we are currently animating the TaskView's alpha value. If this is set to true, calls - * to {@link #setContentVisibility} will not be applied until this is set to false again. + * Whether we are currently animating the {@code TaskView}'s alpha value. If this is set to + * true, calls to {@link #setContentVisibility} will not be applied until this is set to false + * again. */ void setAlphaAnimating(boolean animating) { mIsAlphaAnimating = animating; @@ -503,8 +525,8 @@ public class BubbleExpandedView extends LinearLayout { } /** - * Sets the alpha of the underlying TaskView, since changing the expanded view's alpha does not - * affect the TaskView since it uses a Surface. + * Sets the alpha of the underlying {@code TaskView}, since changing the expanded view's alpha + * does not affect the {@code TaskView} since it uses a Surface. */ void setTaskViewAlpha(float alpha) { if (mTaskView != null) { @@ -743,9 +765,9 @@ public class BubbleExpandedView extends LinearLayout { } /** - * Cleans up anything related to the task and TaskView. If this view should be reused after this - * method is called, then {@link #initialize(BubbleController, BubbleStackView, boolean)} must - * be invoked first. + * Cleans up anything related to the task and {@code TaskView}. If this view should be reused + * after this method is called, then + * {@link #initialize(BubbleController, BubbleStackView, boolean)} must be invoked first. */ public void cleanUpExpandedState() { if (DEBUG_BUBBLE_EXPANDED_VIEW) { diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleStackView.java b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleStackView.java index c71f123459ecb..92e455ce4e3ac 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleStackView.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleStackView.java @@ -1611,7 +1611,7 @@ public class BubbleStackView extends FrameLayout if (mIsExpanded && mExpandedBubble != null && mExpandedBubble.getExpandedView() != null && !mExpandedViewTemporarilyHidden) { if (mExpandedBubble != null && mExpandedBubble.getExpandedView() != null) { - // Before screenshotting, have the real ActivityView show on top of other surfaces + // Before screenshotting, have the real TaskView show on top of other surfaces // so that the screenshot doesn't flicker on top of it. mExpandedBubble.getExpandedView().setSurfaceZOrderedOnTop(true); } @@ -2583,8 +2583,8 @@ public class BubbleStackView extends FrameLayout } /** - * Requests a snapshot from the currently expanded bubble's ActivityView and displays it in a - * SurfaceView. This allows us to load a newly expanded bubble's Activity into the ActivityView, + * Requests a snapshot from the currently expanded bubble's TaskView and displays it in a + * SurfaceView. This allows us to load a newly expanded bubble's Activity into the TaskView, * while animating the (screenshot of the) previously selected bubble's content away. * * @param onComplete Callback to run once we're done here - called with 'false' if something @@ -2628,13 +2628,13 @@ public class BubbleStackView extends FrameLayout mAnimatingOutSurfaceContainer.setTranslationX(mExpandedViewContainer.getPaddingLeft()); mAnimatingOutSurfaceContainer.setTranslationY(0); - final int[] activityViewLocation = + final int[] taskViewLocation = mExpandedBubble.getExpandedView().getTaskViewLocationOnScreen(); final int[] surfaceViewLocation = mAnimatingOutSurfaceView.getLocationOnScreen(); - // Translate the surface to overlap the real ActivityView. + // Translate the surface to overlap the real TaskView. mAnimatingOutSurfaceContainer.setTranslationY( - activityViewLocation[1] - surfaceViewLocation[1]); + taskViewLocation[1] - surfaceViewLocation[1]); // Set the width/height of the SurfaceView to match the snapshot. mAnimatingOutSurfaceView.getLayoutParams().width = diff --git a/services/core/java/com/android/server/notification/BubbleExtractor.java b/services/core/java/com/android/server/notification/BubbleExtractor.java index 2caad5065840f..41e067e571904 100644 --- a/services/core/java/com/android/server/notification/BubbleExtractor.java +++ b/services/core/java/com/android/server/notification/BubbleExtractor.java @@ -167,20 +167,20 @@ public class BubbleExtractor implements NotificationSignalExtractor { // TODO: check the shortcut intent / ensure it can show in activity view return true; } - return canLaunchInActivityView(mContext, metadata.getIntent(), pkg); + return canLaunchInTaskView(mContext, metadata.getIntent(), pkg); } /** * Whether an intent is properly configured to display in an {@link - * android.app.ActivityView} for bubbling. + * com.android.wm.shell.TaskView} for bubbling. * * @param context the context to use. * @param pendingIntent the pending intent of the bubble. * @param packageName the notification package name for this bubble. */ - // Keep checks in sync with BubbleController#canLaunchInActivityView. + // Keep checks in sync with BubbleController#canLaunchInTaskView. @VisibleForTesting - protected boolean canLaunchInActivityView(Context context, PendingIntent pendingIntent, + protected boolean canLaunchInTaskView(Context context, PendingIntent pendingIntent, String packageName) { if (pendingIntent == null) { Slog.w(TAG, "Unable to create bubble -- no intent");