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

Commit 14b4e57c authored by Filip Gruszczynski's avatar Filip Gruszczynski
Browse files

Remove blink during the freeform -> recents transition.

We achieve the desired result by prolonging the last frame of the
animation until recents tells that it drew its content. The CL also
includes cleanup that moves code that depends heavily on WindowState
fields into that class.

Bug: 24913782
Change-Id: I5ee5b18504dd4a86c24033d17eca21cd31936bca
parent 243336b3
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -149,6 +149,9 @@ interface IWindowManager
    void stopAppFreezingScreen(IBinder token, boolean force);
    void removeAppToken(IBinder token);

    /** Used by system ui to report that recents has shown itself. */
    void endProlongedAnimations();

    // Re-evaluate the current orientation from the caller's state.
    // If there is a change, the new Configuration is returned and the
    // caller must call setNewConfiguration() sometime later.
+1 −1
Original line number Diff line number Diff line
@@ -335,7 +335,7 @@ public interface WindowManagerPolicy {
         * Return true if this window (or a window it is attached to, but not
         * considering its app token) is currently animating.
         */
        public boolean isAnimatingLw();
        boolean isAnimatingLw();

        /**
         * Is this window considered to be gone for purposes of layout?
+21 −3
Original line number Diff line number Diff line
@@ -35,6 +35,8 @@ import android.provider.Settings;
import android.view.KeyEvent;
import android.view.View;
import android.view.ViewStub;
import android.view.ViewTreeObserver;

import com.android.internal.logging.MetricsLogger;
import com.android.systemui.R;
import com.android.systemui.recents.events.EventBus;
@@ -73,7 +75,8 @@ import java.util.ArrayList;
/**
 * The main Recents activity that is started from AlternateRecentsComponent.
 */
public class RecentsActivity extends Activity implements RecentsView.RecentsViewCallbacks {
public class RecentsActivity extends Activity implements RecentsView.RecentsViewCallbacks,
        ViewTreeObserver.OnPreDrawListener {

    private final static String TAG = "RecentsActivity";
    private final static boolean DEBUG = false;
@@ -425,7 +428,7 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView
        final RecentsActivityLaunchState state = Recents.getConfiguration().getLaunchState();
        if (state.startHidden) {
            state.startHidden = false;
            mRecentsView.setVisibility(View.INVISIBLE);
            mRecentsView.setStackViewVisibility(View.INVISIBLE);
        }
    }

@@ -666,7 +669,8 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView
    }

    public final void onBusEvent(EnterRecentsWindowLastAnimationFrameEvent event) {
        mRecentsView.setVisibility(View.VISIBLE);
        mRecentsView.setStackViewVisibility(View.VISIBLE);
        mRecentsView.getViewTreeObserver().addOnPreDrawListener(this);
    }

    public final void onBusEvent(AppWidgetProviderChangedEvent event) {
@@ -733,4 +737,18 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView
            mRecentsView.setSearchBar(null);
        }
    }

    @Override
    public boolean onPreDraw() {
        mRecentsView.getViewTreeObserver().removeOnPreDrawListener(this);
        // We post to make sure that this information is delivered after this traversals is
        // finished.
        mRecentsView.post(new Runnable() {
            @Override
            public void run() {
                Recents.getSystemServices().endProlongedAnimations();
            }
        });
        return true;
    }
}
+11 −0
Original line number Diff line number Diff line
@@ -787,4 +787,15 @@ public class SystemServicesProxy {
            e.printStackTrace();
        }
    }

    public void endProlongedAnimations() {
        if (mWm == null) {
            return;
        }
        try {
            WindowManagerGlobal.getWindowManagerService().endProlongedAnimations();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
+10 −0
Original line number Diff line number Diff line
@@ -75,6 +75,7 @@ public class RecentsView extends FrameLayout implements TaskStackView.TaskStackV
    private static final boolean DEBUG = false;

    private static final boolean ADD_HEADER_BITMAP = true;
    private int mStackViewVisibility = View.VISIBLE;

    /** The RecentsView callbacks */
    public interface RecentsViewCallbacks {
@@ -151,6 +152,7 @@ public class RecentsView extends FrameLayout implements TaskStackView.TaskStackV
            mTaskStackView.setCallbacks(this);
            addView(mTaskStackView);
        }
        mTaskStackView.setVisibility(mStackViewVisibility);

        // Trigger a new layout
        requestLayout();
@@ -861,4 +863,12 @@ public class RecentsView extends FrameLayout implements TaskStackView.TaskStackV
            }
        }
    }

    public void setStackViewVisibility(int stackViewVisibility) {
        mStackViewVisibility = stackViewVisibility;
        if (mTaskStackView != null) {
            mTaskStackView.setVisibility(stackViewVisibility);
            invalidate();
        }
    }
}
Loading