Merge "Removing remaining references of ActivityView in fw/base" into sc-dev am: dc86e26f54

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14829810

Change-Id: I07f5d9bd292021dcc1de2249cb844c9fdfdec630
This commit is contained in:
TreeHugger Robot
2021-06-21 11:58:03 +00:00
committed by Automerger Merge Worker
6 changed files with 62 additions and 36 deletions

View File

@@ -524,8 +524,12 @@ public class ActivityInfo extends ComponentInfo implements Parcelable {
* owned ActivityContainer such as that within an ActivityView. If not set and * owned ActivityContainer such as that within an ActivityView. If not set and
* this activity is launched into such a container a SecurityException will be * this activity is launched into such a container a SecurityException will be
* thrown. Set from the {@link android.R.attr#allowEmbedded} attribute. * 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) @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
@Deprecated
public static final int FLAG_ALLOW_EMBEDDED = 0x80000000; public static final int FLAG_ALLOW_EMBEDDED = 0x80000000;
/** /**

View File

@@ -20703,8 +20703,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
} }
/** /**
* Return the window this view is currently attached to. Used in * Return the window this view is currently attached to.
* {@link android.app.ActivityView} to communicate with WM.
* @hide * @hide
*/ */
protected IWindow getWindow() { protected IWindow getWindow() {

View File

@@ -713,7 +713,7 @@ public class BubbleController {
mSysuiProxy.getShouldRestoredEntries(savedBubbleKeys, (entries) -> { mSysuiProxy.getShouldRestoredEntries(savedBubbleKeys, (entries) -> {
mMainExecutor.execute(() -> { mMainExecutor.execute(() -> {
for (BubbleEntry e : entries) { for (BubbleEntry e : entries) {
if (canLaunchInActivityView(mContext, e)) { if (canLaunchInTaskView(mContext, e)) {
updateBubble(e, true /* suppressFlyout */, false /* showInShade */); updateBubble(e, true /* suppressFlyout */, false /* showInShade */);
} }
} }
@@ -971,14 +971,14 @@ public class BubbleController {
} }
private void onEntryAdded(BubbleEntry entry) { private void onEntryAdded(BubbleEntry entry) {
if (canLaunchInActivityView(mContext, entry)) { if (canLaunchInTaskView(mContext, entry)) {
updateBubble(entry); updateBubble(entry);
} }
} }
private void onEntryUpdated(BubbleEntry entry, boolean shouldBubbleUp) { private void onEntryUpdated(BubbleEntry entry, boolean shouldBubbleUp) {
// shouldBubbleUp checks canBubble & for bubble metadata // shouldBubbleUp checks canBubble & for bubble metadata
boolean shouldBubble = shouldBubbleUp && canLaunchInActivityView(mContext, entry); boolean shouldBubble = shouldBubbleUp && canLaunchInTaskView(mContext, entry);
if (!shouldBubble && mBubbleData.hasAnyBubbleWithKey(entry.getKey())) { if (!shouldBubble && mBubbleData.hasAnyBubbleWithKey(entry.getKey())) {
// It was previously a bubble but no longer a bubble -- lets remove it // It was previously a bubble but no longer a bubble -- lets remove it
removeBubble(entry.getKey(), DISMISS_NO_LONGER_BUBBLE); removeBubble(entry.getKey(), DISMISS_NO_LONGER_BUBBLE);
@@ -1312,15 +1312,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. * that should filter out any invalid bubbles, but should protect SysUI side just in case.
* *
* @param context the context to use. * @param context the context to use.
* @param entry the entry to bubble. * @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 PendingIntent intent = entry.getBubbleMetadata() != null
? entry.getBubbleMetadata().getIntent() ? entry.getBubbleMetadata().getIntent()
: null; : null;

View File

@@ -90,15 +90,15 @@ public class BubbleExpandedView extends LinearLayout {
private boolean mNeedsNewHeight; private boolean mNeedsNewHeight;
/** /**
* Whether we want the TaskView's content to be visible (alpha = 1f). If * Whether we want the {@code TaskView}'s content to be visible (alpha = 1f). If
* {@link #mIsAlphaAnimating} is true, this may not reflect the TaskView's actual alpha value * {@link #mIsAlphaAnimating} is true, this may not reflect the {@code TaskView}'s actual alpha
* until the animation ends. * value until the animation ends.
*/ */
private boolean mIsContentVisible = false; private boolean mIsContentVisible = false;
/** /**
* Whether we're animating the TaskView's alpha value. If so, we will hold off on applying alpha * Whether we're animating the {@code TaskView}'s alpha value. If so, we will hold off on
* changes from {@link #setContentVisibility} until the animation ends. * applying alpha changes from {@link #setContentVisibility} until the animation ends.
*/ */
private boolean mIsAlphaAnimating = false; private boolean mIsAlphaAnimating = false;
@@ -127,8 +127,8 @@ public class BubbleExpandedView extends LinearLayout {
private BubblePositioner mPositioner; private BubblePositioner mPositioner;
/** /**
* Container for the ActivityView that has a solid, round-rect background that shows if the * Container for the {@code TaskView} that has a solid, round-rect background that shows if the
* ActivityView hasn't loaded. * {@code TaskView} hasn't loaded.
*/ */
private final FrameLayout mExpandedViewContainer = new FrameLayout(getContext()); private final FrameLayout mExpandedViewContainer = new FrameLayout(getContext());
@@ -139,7 +139,7 @@ public class BubbleExpandedView extends LinearLayout {
@Override @Override
public void onInitialized() { public void onInitialized() {
if (DEBUG_BUBBLE_EXPANDED_VIEW) { if (DEBUG_BUBBLE_EXPANDED_VIEW) {
Log.d(TAG, "onActivityViewReady: destroyed=" + mDestroyed Log.d(TAG, "onInitialized: destroyed=" + mDestroyed
+ " initialized=" + mInitialized + " initialized=" + mInitialized
+ " bubble=" + getBubbleKey()); + " bubble=" + getBubbleKey());
} }
@@ -159,7 +159,7 @@ public class BubbleExpandedView extends LinearLayout {
// Post to keep the lifecycle normal // Post to keep the lifecycle normal
post(() -> { post(() -> {
if (DEBUG_BUBBLE_EXPANDED_VIEW) { if (DEBUG_BUBBLE_EXPANDED_VIEW) {
Log.d(TAG, "onActivityViewReady: calling startActivity, bubble=" Log.d(TAG, "onInitialized: calling startActivity, bubble="
+ getBubbleKey()); + getBubbleKey());
} }
try { try {
@@ -265,7 +265,7 @@ public class BubbleExpandedView extends LinearLayout {
mCurrentPointer = mTopPointer; mCurrentPointer = mTopPointer;
mPointerView.setVisibility(INVISIBLE); 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); setContentVisibility(false);
mExpandedViewContainer.setOutlineProvider(new ViewOutlineProvider() { mExpandedViewContainer.setOutlineProvider(new ViewOutlineProvider() {
@@ -290,6 +290,27 @@ public class BubbleExpandedView extends LinearLayout {
applyThemeAttrs(); applyThemeAttrs();
setClipToPadding(false); 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 // BubbleStackView is forced LTR, but we want to respect the locale for expanded view layout
// so the Manage button appears on the right. // so the Manage button appears on the right.
@@ -471,7 +492,7 @@ public class BubbleExpandedView extends LinearLayout {
/** /**
* Updates the obscured touchable region for the task surface. This calls onLocationChanged, * Updates the obscured touchable region for the task surface. This calls onLocationChanged,
* which results in a call to {@link BubbleStackView#subtractObscuredTouchableRegion}. This is * 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. * manage menu.
*/ */
void updateObscuredTouchableRegion() { void updateObscuredTouchableRegion() {
@@ -491,8 +512,9 @@ public class BubbleExpandedView extends LinearLayout {
} }
/** /**
* Whether we are currently animating the TaskView's alpha value. If this is set to true, calls * Whether we are currently animating the {@code TaskView}'s alpha value. If this is set to
* to {@link #setContentVisibility} will not be applied until this is set to false again. * true, calls to {@link #setContentVisibility} will not be applied until this is set to false
* again.
*/ */
void setAlphaAnimating(boolean animating) { void setAlphaAnimating(boolean animating) {
mIsAlphaAnimating = animating; mIsAlphaAnimating = animating;
@@ -504,8 +526,8 @@ public class BubbleExpandedView extends LinearLayout {
} }
/** /**
* Sets the alpha of the underlying TaskView, since changing the expanded view's alpha does not * Sets the alpha of the underlying {@code TaskView}, since changing the expanded view's alpha
* affect the TaskView since it uses a Surface. * does not affect the {@code TaskView} since it uses a Surface.
*/ */
void setTaskViewAlpha(float alpha) { void setTaskViewAlpha(float alpha) {
if (mTaskView != null) { if (mTaskView != null) {
@@ -744,9 +766,9 @@ public class BubbleExpandedView extends LinearLayout {
} }
/** /**
* Cleans up anything related to the task and TaskView. If this view should be reused after this * Cleans up anything related to the task and {@code TaskView}. If this view should be reused
* method is called, then {@link #initialize(BubbleController, BubbleStackView, boolean)} must * after this method is called, then
* be invoked first. * {@link #initialize(BubbleController, BubbleStackView, boolean)} must be invoked first.
*/ */
public void cleanUpExpandedState() { public void cleanUpExpandedState() {
if (DEBUG_BUBBLE_EXPANDED_VIEW) { if (DEBUG_BUBBLE_EXPANDED_VIEW) {

View File

@@ -1611,7 +1611,7 @@ public class BubbleStackView extends FrameLayout
if (mIsExpanded && mExpandedBubble != null && mExpandedBubble.getExpandedView() != null if (mIsExpanded && mExpandedBubble != null && mExpandedBubble.getExpandedView() != null
&& !mExpandedViewTemporarilyHidden) { && !mExpandedViewTemporarilyHidden) {
if (mExpandedBubble != null && mExpandedBubble.getExpandedView() != null) { 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. // so that the screenshot doesn't flicker on top of it.
mExpandedBubble.getExpandedView().setSurfaceZOrderedOnTop(true); 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 * 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 ActivityView, * 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. * 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 * @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.setTranslationX(mExpandedViewContainer.getPaddingLeft());
mAnimatingOutSurfaceContainer.setTranslationY(0); mAnimatingOutSurfaceContainer.setTranslationY(0);
final int[] activityViewLocation = final int[] taskViewLocation =
mExpandedBubble.getExpandedView().getTaskViewLocationOnScreen(); mExpandedBubble.getExpandedView().getTaskViewLocationOnScreen();
final int[] surfaceViewLocation = mAnimatingOutSurfaceView.getLocationOnScreen(); final int[] surfaceViewLocation = mAnimatingOutSurfaceView.getLocationOnScreen();
// Translate the surface to overlap the real ActivityView. // Translate the surface to overlap the real TaskView.
mAnimatingOutSurfaceContainer.setTranslationY( mAnimatingOutSurfaceContainer.setTranslationY(
activityViewLocation[1] - surfaceViewLocation[1]); taskViewLocation[1] - surfaceViewLocation[1]);
// Set the width/height of the SurfaceView to match the snapshot. // Set the width/height of the SurfaceView to match the snapshot.
mAnimatingOutSurfaceView.getLayoutParams().width = mAnimatingOutSurfaceView.getLayoutParams().width =

View File

@@ -167,20 +167,20 @@ public class BubbleExtractor implements NotificationSignalExtractor {
// TODO: check the shortcut intent / ensure it can show in activity view // TODO: check the shortcut intent / ensure it can show in activity view
return true; 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 * 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 context the context to use.
* @param pendingIntent the pending intent of the bubble. * @param pendingIntent the pending intent of the bubble.
* @param packageName the notification package name for this 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 @VisibleForTesting
protected boolean canLaunchInActivityView(Context context, PendingIntent pendingIntent, protected boolean canLaunchInTaskView(Context context, PendingIntent pendingIntent,
String packageName) { String packageName) {
if (pendingIntent == null) { if (pendingIntent == null) {
Slog.w(TAG, "Unable to create bubble -- no intent"); Slog.w(TAG, "Unable to create bubble -- no intent");