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

Commit 480dca0d authored by Wale Ogunwale's avatar Wale Ogunwale
Browse files

Reduce jank during pinned stack animation

- Don’t launch Pip overlay activities during pinned stack animation.
This causes extra CPU load and takes a way resources from the running
animation.
- Finish Pip overlay activities before starting pinned stack resize
animation. Reduces the amount of work the system needs to do to keep
the overlays in-sync with the other activities in the pinned stack.
- Use AM.resizeStack with null bounds to take Pip to fullscreen so that
we can animate the bounds changed.
- Also, fixed Activity.enterPictureInPicture API to animate the transition
if Pip is entered from the app instead of Pip manager.

Bug: 25672053
Change-Id: I82399c10f1b8c675ea3861ba973dc8ecfbfbe50f
parent c61e1024
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -2882,6 +2882,11 @@ public abstract class ActivityManagerNative extends Binder implements IActivityM
            reply.writeInt(isForeground ? 1 : 0);
            return true;
        }
        case NOTIFY_PINNED_STACK_ANIMATION_ENDED_TRANSACTION: {
            data.enforceInterface(IActivityManager.descriptor);
            reply.writeNoException();
            return true;
        }
        }

        return super.onTransact(code, data, reply, flags);
@@ -6732,5 +6737,15 @@ class ActivityManagerProxy implements IActivityManager
        return isForeground;
    };

    @Override
    public void notifyPinnedStackAnimationEnded() throws RemoteException {
        Parcel data = Parcel.obtain();
        Parcel reply = Parcel.obtain();
        data.writeInterfaceToken(IActivityManager.descriptor);
        mRemote.transact(NOTIFY_PINNED_STACK_ANIMATION_ENDED_TRANSACTION, data, reply, 0);
        data.recycle();
        reply.recycle();
    };

    private IBinder mRemote;
}
+3 −0
Original line number Diff line number Diff line
@@ -597,6 +597,8 @@ public interface IActivityManager extends IInterface {

    public boolean supportsLocalVoiceInteraction() throws RemoteException;

    public void notifyPinnedStackAnimationEnded() throws RemoteException;

    /*
     * Private non-Binder interfaces
     */
@@ -972,4 +974,5 @@ public interface IActivityManager extends IInterface {
    int START_LOCAL_VOICE_INTERACTION_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION + 363;
    int STOP_LOCAL_VOICE_INTERACTION_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION + 364;
    int SUPPORTS_LOCAL_VOICE_INTERACTION_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION + 365;
    int NOTIFY_PINNED_STACK_ANIMATION_ENDED_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION + 366;
}
+5 −0
Original line number Diff line number Diff line
@@ -30,4 +30,9 @@ oneway interface ITaskStackListener {
     * brought to the front or a new Intent is delivered to it.
     */
    void onPinnedActivityRestartAttempt();

    /**
     * Called whenever the pinned stack is done animating a resize.
     */
    void onPinnedStackAnimationEnded();
}
+4 −0
Original line number Diff line number Diff line
@@ -124,6 +124,10 @@ public class RecentsImpl implements ActivityOptions.OnAnimationFinishedListener
        public void onPinnedActivityRestartAttempt() {
        }

        @Override
        public void onPinnedStackAnimationEnded() {
        }

        /** Preloads the next task */
        public void run() {
            RecentsConfiguration config = Recents.getConfiguration();
+2 −2
Original line number Diff line number Diff line
@@ -318,13 +318,13 @@ public class RecentsTvActivity extends Activity implements OnPreDrawListener {
        switch (keyCode) {
            case KeyEvent.KEYCODE_DPAD_UP: {
                SystemServicesProxy ssp = Recents.getSystemServices();
                PipManager.getInstance().showPipMenu();
                PipManager.getInstance().resizePinnedStack(PipManager.STATE_PIP_MENU);
                ssp.focusPinnedStack();
                return true;
            }
            case KeyEvent.KEYCODE_DPAD_DOWN: {
                SystemServicesProxy ssp = Recents.getSystemServices();
                PipManager.getInstance().showPipOverlay(false);
                PipManager.getInstance().resizePinnedStack(PipManager.STATE_PIP_OVERLAY);
                ssp.focusHomeStack();
                return true;
            }
Loading