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

Commit 11cc01df authored by Jorim Jaggi's avatar Jorim Jaggi
Browse files

Add animation when docking top task with long press

Change-Id: I7af4149f2c517e8d6ace22f1e49e319d2461503e
parent 28950ae5
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -26,4 +26,5 @@ oneway interface IRecentsSystemUserCallbacks {

    void updateRecentsVisibility(boolean visible);
    void startScreenPinning();
    void sendRecentsDrawnEvent();
}
+20 −0
Original line number Diff line number Diff line
@@ -38,6 +38,7 @@ import com.android.systemui.SystemUI;
import com.android.systemui.recents.events.EventBus;
import com.android.systemui.recents.events.component.RecentsVisibilityChangedEvent;
import com.android.systemui.recents.events.component.ScreenPinningRequestEvent;
import com.android.systemui.recents.events.ui.RecentsDrawnEvent;
import com.android.systemui.recents.misc.SystemServicesProxy;
import com.android.systemui.recents.model.RecentsTaskLoader;

@@ -516,6 +517,25 @@ public class Recents extends SystemUI
        }
    }

    /**
     * Handle screen pinning request.
     */
    public final void onBusEvent(final RecentsDrawnEvent event) {
        int processUser = sSystemServicesProxy.getProcessUser();
        if (!sSystemServicesProxy.isSystemUser(processUser)) {
            postToSystemUser(new Runnable() {
                @Override
                public void run() {
                    try {
                        mCallbacksToSystemUser.sendRecentsDrawnEvent();
                    } catch (RemoteException e) {
                        Log.e(TAG, "Callback failed", e);
                    }
                }
            });
        }
    }

    /**
     * Attempts to register with the system user.
     */
+12 −0
Original line number Diff line number Diff line
@@ -59,6 +59,7 @@ import com.android.systemui.recents.events.component.RecentsVisibilityChangedEve
import com.android.systemui.recents.events.component.ScreenPinningRequestEvent;
import com.android.systemui.recents.events.ui.AllTaskViewsDismissedEvent;
import com.android.systemui.recents.events.ui.DeleteTaskDataEvent;
import com.android.systemui.recents.events.ui.RecentsDrawnEvent;
import com.android.systemui.recents.events.ui.ShowApplicationInfoEvent;
import com.android.systemui.recents.events.ui.StackViewScrolledEvent;
import com.android.systemui.recents.events.ui.UpdateFreeformTaskViewVisibilityEvent;
@@ -400,6 +401,17 @@ public class RecentsActivity extends Activity implements ViewTreeObserver.OnPreD
        EventBus.getDefault().send(new RecentsVisibilityChangedEvent(this, ssp, true));

        MetricsLogger.visible(this, MetricsLogger.OVERVIEW_ACTIVITY);

        mRecentsView.getViewTreeObserver().addOnPreDrawListener(
                new ViewTreeObserver.OnPreDrawListener() {

            @Override
            public boolean onPreDraw() {
                mRecentsView.getViewTreeObserver().removeOnPreDrawListener(this);
                EventBus.getDefault().post(new RecentsDrawnEvent());
                return true;
            }
        });
    }

    @Override
+2 −1
Original line number Diff line number Diff line
@@ -41,6 +41,7 @@ import com.android.systemui.Prefs;
import com.android.systemui.R;
import com.android.systemui.SystemUIApplication;
import com.android.systemui.recents.events.EventBus;
import com.android.systemui.recents.events.activity.DockingTopTaskEvent;
import com.android.systemui.recents.events.activity.EnterRecentsWindowLastAnimationFrameEvent;
import com.android.systemui.recents.events.activity.HideRecentsEvent;
import com.android.systemui.recents.events.activity.IterateRecentsEvent;
@@ -532,7 +533,7 @@ public class RecentsImpl extends IRecentsNonSystemUserCallbacks.Stub implements
        SystemServicesProxy ssp = Recents.getSystemServices();
        ActivityManager.RunningTaskInfo topTask = ssp.getTopMostTask();
        boolean screenPinningActive = ssp.isScreenPinningActive();
        boolean isTopTaskHome = SystemServicesProxy.isHomeStack(topTask.stackId);
        boolean isTopTaskHome = topTask != null && SystemServicesProxy.isHomeStack(topTask.stackId);
        if (topTask != null && !isTopTaskHome && !screenPinningActive) {
            ssp.moveTaskToDockedStack(topTask.id, stackCreateMode, initialBounds);
            showRecents(false /* triggeredFromAltTab */, draggingInRecents, false /* animate */,
+8 −0
Original line number Diff line number Diff line
@@ -22,6 +22,9 @@ import android.os.RemoteException;
import android.util.Log;
import android.util.SparseArray;

import com.android.systemui.recents.events.EventBus;
import com.android.systemui.recents.events.ui.RecentsDrawnEvent;

/**
 * An implementation of the system user's Recents interface to be called remotely by secondary
 * users.
@@ -70,4 +73,9 @@ public class RecentsSystemUser extends IRecentsSystemUserCallbacks.Stub {
    public void startScreenPinning() {
        mImpl.onStartScreenPinning(mContext);
    }

    @Override
    public void sendRecentsDrawnEvent() {
        EventBus.getDefault().post(new RecentsDrawnEvent());
    }
}
Loading