Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 36097dcd authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Removing remaining references of ActivityView in fw/base" into sc-dev...

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

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

Change-Id: I0078a183422562b7de3db1e98410bafd5ed2177d
parents 8e9556fc 8913c778
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -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;

    /**
+1 −2
Original line number Diff line number Diff line
@@ -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() {
+7 −6
Original line number Diff line number Diff line
@@ -713,7 +713,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 */);
                    }
                }
@@ -971,14 +971,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);
@@ -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.
     *
     * @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;
+40 −18
Original line number Diff line number Diff line
@@ -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.
@@ -471,7 +492,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() {
@@ -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
     * 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;
@@ -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
     * 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) {
@@ -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
     * 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) {
+6 −6
Original line number Diff line number Diff line
@@ -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 =
Loading