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

Commit bdb905a6 authored by Valerie Hau's avatar Valerie Hau
Browse files

Query for BLAST flag outside of constructor

WindowManagerGlobal should query for flag only when the service has
successfully been retrieved.  Moving query into block where
sWindowManagerService is initalized

Bug: 149243163
Test: build, boot, adb shell device_config put
window_manager_native_boot wm_use_blast_adapter true/false

Change-Id: I864d60158236059fda9844844b07299bb97ee6d1
parent 779af293
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -385,7 +385,7 @@ public class SurfaceView extends View implements ViewRootImpl.SurfaceChangedCall
                 * This gets called on a RenderThread worker thread, so members accessed here must
                 * be protected by a lock.
                 */
                final boolean useBLAST = WindowManagerGlobal.getInstance().useBLAST();
                final boolean useBLAST = WindowManagerGlobal.useBLAST();
                viewRoot.registerRtFrameCallback(frame -> {
                    try {
                        final SurfaceControl.Transaction t = useBLAST ?
@@ -1119,7 +1119,7 @@ public class SurfaceView extends View implements ViewRootImpl.SurfaceChangedCall

    private void applySurfaceTransforms(SurfaceControl surface, SurfaceControl.Transaction t,
            Rect position, long frameNumber) {
        if (frameNumber > 0 && !WindowManagerGlobal.getInstance().useBLAST()) {
        if (frameNumber > 0 && !WindowManagerGlobal.useBLAST()) {
            final ViewRootImpl viewRoot = getViewRootImpl();

            t.deferTransactionUntil(surface, viewRoot.getRenderSurfaceControl(),
@@ -1137,7 +1137,7 @@ public class SurfaceView extends View implements ViewRootImpl.SurfaceChangedCall
    }

    private void setParentSpaceRectangle(Rect position, long frameNumber) {
        final boolean useBLAST = WindowManagerGlobal.getInstance().useBLAST();
        final boolean useBLAST = WindowManagerGlobal.useBLAST();
        final ViewRootImpl viewRoot = getViewRootImpl();
        final SurfaceControl.Transaction t = useBLAST ? viewRoot.getBLASTSyncTransaction() :
            mRtTransaction;
@@ -1198,7 +1198,7 @@ public class SurfaceView extends View implements ViewRootImpl.SurfaceChangedCall

        @Override
        public void positionLost(long frameNumber) {
            boolean useBLAST = WindowManagerGlobal.getInstance().useBLAST();
            boolean useBLAST = WindowManagerGlobal.useBLAST();
            if (DEBUG) {
                Log.d(TAG, String.format("%d windowPositionLost, frameNr = %d",
                        System.identityHashCode(this), frameNumber));
@@ -1537,7 +1537,7 @@ public class SurfaceView extends View implements ViewRootImpl.SurfaceChangedCall
    @Override
    public void invalidate(boolean invalidateCache) {
        super.invalidate(invalidateCache);
        if (!WindowManagerGlobal.getInstance().useBLAST()) {
        if (!WindowManagerGlobal.useBLAST()) {
            return;
        }
        final ViewRootImpl viewRoot = getViewRootImpl();
+1 −1
Original line number Diff line number Diff line
@@ -736,7 +736,7 @@ public final class ViewRootImpl implements ViewParent,

        loadSystemProperties();
        mImeFocusController = new ImeFocusController(this);
        mUseBLASTAdapter = WindowManagerGlobal.getInstance().useBLAST();
        mUseBLASTAdapter = WindowManagerGlobal.useBLAST();
    }

    public static void addFirstDrawHandler(Runnable callback) {
+4 −8
Original line number Diff line number Diff line
@@ -56,7 +56,7 @@ import java.util.ArrayList;
public final class WindowManagerGlobal {
    private static final String TAG = "WindowManager";

    private final boolean mUseBLASTAdapter;
    private static boolean sUseBLASTAdapter = false;

    /**
     * The user is navigating with keys (not the touch screen), so
@@ -159,11 +159,6 @@ public final class WindowManagerGlobal {
    private Runnable mSystemPropertyUpdater;

    private WindowManagerGlobal() {
        try {
            mUseBLASTAdapter = getWindowManagerService().useBLAST();
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
        }
    }

    @UnsupportedAppUsage
@@ -191,6 +186,7 @@ public final class WindowManagerGlobal {
                    if (sWindowManagerService != null) {
                        ValueAnimator.setDurationScale(
                                sWindowManagerService.getCurrentAnimatorScale());
                        sUseBLASTAdapter = sWindowManagerService.useBLAST();
                    }
                } catch (RemoteException e) {
                    throw e.rethrowFromSystemServer();
@@ -235,8 +231,8 @@ public final class WindowManagerGlobal {
    /**
     * Whether or not to use BLAST for ViewRootImpl
     */
    public boolean useBLAST() {
        return mUseBLASTAdapter;
    public static boolean useBLAST() {
        return sUseBLASTAdapter;
    }

    @UnsupportedAppUsage