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

Commit dea5a29c authored by Issei Suzuki's avatar Issei Suzuki Committed by android-build-merger
Browse files

Merge "Merge "Synchronize bubble activity rendering status and its visibility...

Merge "Merge "Synchronize bubble activity rendering status and its visibility change." into qt-r1-dev am: 08b7be88" into qt-r1-dev-plus-aosp
am: 2abf63ed

Change-Id: I3e8f3e678446132fd88c2f729778db1db6cf08c2
parents 12af842d 2abf63ed
Loading
Loading
Loading
Loading
+11 −0
Original line number Original line Diff line number Diff line
@@ -120,6 +120,7 @@ public class ActivityView extends ViewGroup {


        mActivityTaskManager = ActivityTaskManager.getService();
        mActivityTaskManager = ActivityTaskManager.getService();
        mSurfaceView = new SurfaceView(context);
        mSurfaceView = new SurfaceView(context);
        mSurfaceView.setAlpha(0f);
        mSurfaceCallback = new SurfaceCallback();
        mSurfaceCallback = new SurfaceCallback();
        mSurfaceView.getHolder().addCallback(mSurfaceCallback);
        mSurfaceView.getHolder().addCallback(mSurfaceCallback);
        addView(mSurfaceView);
        addView(mSurfaceView);
@@ -346,6 +347,16 @@ public class ActivityView extends ViewGroup {
        mSurfaceView.layout(0 /* left */, 0 /* top */, r - l /* right */, b - t /* bottom */);
        mSurfaceView.layout(0 /* left */, 0 /* top */, r - l /* right */, b - t /* bottom */);
    }
    }


    @Override
    public void setAlpha(float alpha) {
        mSurfaceView.setAlpha(alpha);
    }

    @Override
    public float getAlpha() {
        return mSurfaceView.getAlpha();
    }

    @Override
    @Override
    public boolean gatherTransparentRegion(Region region) {
    public boolean gatherTransparentRegion(Region region) {
        // The tap exclude region may be affected by any view on top of it, so we detect the
        // The tap exclude region may be affected by any view on top of it, so we detect the
+8 −0
Original line number Original line Diff line number Diff line
@@ -169,4 +169,12 @@ oneway interface ITaskStackListener {
     * @param taskInfo info about the task which received the back press
     * @param taskInfo info about the task which received the back press
     */
     */
    void onBackPressedOnTaskRoot(in ActivityManager.RunningTaskInfo taskInfo);
    void onBackPressedOnTaskRoot(in ActivityManager.RunningTaskInfo taskInfo);

    /*
     * Called when contents are drawn for the first time on a display which can only contain one
     * task.
     *
     * @param displayId the id of the display on which contents are drawn.
     */
    void onSingleTaskDisplayDrawn(int displayId);
}
}
+4 −0
Original line number Original line Diff line number Diff line
@@ -173,4 +173,8 @@ public abstract class TaskStackListener extends ITaskStackListener.Stub {
    public void onBackPressedOnTaskRoot(ActivityManager.RunningTaskInfo taskInfo)
    public void onBackPressedOnTaskRoot(ActivityManager.RunningTaskInfo taskInfo)
            throws RemoteException {
            throws RemoteException {
    }
    }

    @Override
    public void onSingleTaskDisplayDrawn(int displayId) throws RemoteException {
    }
}
}
+42 −0
Original line number Original line Diff line number Diff line
@@ -27,6 +27,7 @@ import android.content.res.Configuration;
import android.graphics.BlendMode;
import android.graphics.BlendMode;
import android.graphics.Canvas;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Color;
import android.graphics.HardwareRenderer;
import android.graphics.Paint;
import android.graphics.Paint;
import android.graphics.PixelFormat;
import android.graphics.PixelFormat;
import android.graphics.PorterDuff;
import android.graphics.PorterDuff;
@@ -201,6 +202,29 @@ public class SurfaceView extends View implements ViewRootImpl.WindowStoppedCallb


    private SurfaceControl.Transaction mRtTransaction = new SurfaceControl.Transaction();
    private SurfaceControl.Transaction mRtTransaction = new SurfaceControl.Transaction();


    /**
     * A callback which reflects an alpha value of this view onto the underlying surfaces.
     *
     * <p class="note"><strong>Note:</strong> This doesn't have to be defined as a member variable,
     * but can be defined as an inline lambda when calling ViewRootImpl#registerRtFrameCallback().
     * However when we do so, the callback is triggered only for a few times and stops working for
     * some reason. It's suspected that there is a problem around garbage collection, and until
     * the cause is fixed, we will keep this callback in a member variable.</p>
    */
    private HardwareRenderer.FrameDrawingCallback mSetSurfaceAlphaCallback = frame -> {
        final ViewRootImpl viewRoot = getViewRootImpl();
        if (viewRoot == null || viewRoot.mSurface == null || !viewRoot.mSurface.isValid()) {
            // In this case, the alpha value is reflected on the screen in #updateSurface() later.
            return;
        }

        final SurfaceControl.Transaction t = new SurfaceControl.Transaction();
        t.setAlpha(mSurfaceControl, getAlpha());
        t.deferTransactionUntilSurface(mSurfaceControl, viewRoot.mSurface, frame);
        t.setEarlyWakeup();
        t.apply();
    };

    public SurfaceView(Context context) {
    public SurfaceView(Context context) {
        this(context, null);
        this(context, null);
    }
    }
@@ -288,6 +312,17 @@ public class SurfaceView extends View implements ViewRootImpl.WindowStoppedCallb
        updateSurface();
        updateSurface();
    }
    }


    @Override
    public void setAlpha(float alpha) {
        super.setAlpha(alpha);
        final ViewRootImpl viewRoot = getViewRootImpl();
        if (viewRoot == null) {
            return;
        }
        viewRoot.registerRtFrameCallback(mSetSurfaceAlphaCallback);
        invalidate();
    }

    private void performDrawFinished() {
    private void performDrawFinished() {
        if (mPendingReportDraws > 0) {
        if (mPendingReportDraws > 0) {
            mDrawFinished = true;
            mDrawFinished = true;
@@ -648,6 +683,13 @@ public class SurfaceView extends View implements ViewRootImpl.WindowStoppedCallb
                        }
                        }
                        updateBackgroundVisibilityInTransaction(viewRoot.getSurfaceControl());
                        updateBackgroundVisibilityInTransaction(viewRoot.getSurfaceControl());


                        // Alpha value change is handled in setAlpha() directly using a local
                        // transaction. However it can happen that setAlpha() is called while
                        // local transactions cannot be applied, so the value is stored in a View
                        // but not yet reflected on the Surface.
                        mSurfaceControl.setAlpha(getAlpha());
                        mBackgroundControl.setAlpha(getAlpha());

                        // While creating the surface, we will set it's initial
                        // While creating the surface, we will set it's initial
                        // geometry. Outside of that though, we should generally
                        // geometry. Outside of that though, we should generally
                        // leave it to the RenderThread.
                        // leave it to the RenderThread.
+9 −1
Original line number Original line Diff line number Diff line
@@ -260,6 +260,13 @@ public interface WindowManager extends ViewManager {
     */
     */
    int TRANSIT_TASK_CHANGE_WINDOWING_MODE = 27;
    int TRANSIT_TASK_CHANGE_WINDOWING_MODE = 27;


    /**
     * A display which can only contain one task is being shown because the first activity is
     * started or it's being turned on.
     * @hide
     */
    int TRANSIT_SHOW_SINGLE_TASK_DISPLAY = 28;

    /**
    /**
     * @hide
     * @hide
     */
     */
@@ -287,7 +294,8 @@ public interface WindowManager extends ViewManager {
            TRANSIT_TRANSLUCENT_ACTIVITY_OPEN,
            TRANSIT_TRANSLUCENT_ACTIVITY_OPEN,
            TRANSIT_TRANSLUCENT_ACTIVITY_CLOSE,
            TRANSIT_TRANSLUCENT_ACTIVITY_CLOSE,
            TRANSIT_CRASHING_ACTIVITY_CLOSE,
            TRANSIT_CRASHING_ACTIVITY_CLOSE,
            TRANSIT_TASK_CHANGE_WINDOWING_MODE
            TRANSIT_TASK_CHANGE_WINDOWING_MODE,
            TRANSIT_SHOW_SINGLE_TASK_DISPLAY
    })
    })
    @Retention(RetentionPolicy.SOURCE)
    @Retention(RetentionPolicy.SOURCE)
    @interface TransitionType {}
    @interface TransitionType {}
Loading