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

Commit 9ea2f7ba authored by Jorim Jaggi's avatar Jorim Jaggi
Browse files

Add ability to supply initial bounds when docking task

Add an optional parameter in moveTaskToDockedStack to supply an
initial rect to be used when creating the dockeds tack. Pass in
the adjusted rect when dragging up from the navbar so it doesn't
flicker anymore.

Change-Id: Ieb3c8c73b9e2a769a2ec6270bd76a713201a2aed
parent c4d49cd6
Loading
Loading
Loading
Loading
+14 −3
Original line number Diff line number Diff line
@@ -752,7 +752,12 @@ public abstract class ActivityManagerNative extends Binder implements IActivityM
            int createMode = data.readInt();
            boolean toTop = data.readInt() != 0;
            boolean animate = data.readInt() != 0;
            moveTaskToDockedStack(taskId, createMode, toTop, animate);
            Rect bounds = null;
            boolean hasBounds = data.readInt() != 0;
            if (hasBounds) {
                bounds = Rect.CREATOR.createFromParcel(data);
            }
            moveTaskToDockedStack(taskId, createMode, toTop, animate, bounds);
            reply.writeNoException();
            return true;
        }
@@ -3578,8 +3583,8 @@ class ActivityManagerProxy implements IActivityManager
        reply.recycle();
    }
    @Override
    public void moveTaskToDockedStack(int taskId, int createMode, boolean toTop, boolean animate)
            throws RemoteException
    public void moveTaskToDockedStack(int taskId, int createMode, boolean toTop, boolean animate,
            Rect initialBounds) throws RemoteException
    {
        Parcel data = Parcel.obtain();
        Parcel reply = Parcel.obtain();
@@ -3588,6 +3593,12 @@ class ActivityManagerProxy implements IActivityManager
        data.writeInt(createMode);
        data.writeInt(toTop ? 1 : 0);
        data.writeInt(animate ? 1 : 0);
        if (initialBounds != null) {
            data.writeInt(1);
            initialBounds.writeToParcel(data, 0);
        } else {
            data.writeInt(0);
        }
        mRemote.transact(MOVE_TASK_TO_DOCKED_STACK_TRANSACTION, data, reply, 0);
        reply.readException();
        data.recycle();
+2 −2
Original line number Diff line number Diff line
@@ -142,8 +142,8 @@ public interface IActivityManager extends IInterface {
    public boolean moveActivityTaskToBack(IBinder token, boolean nonRoot) throws RemoteException;
    public void moveTaskBackwards(int task) throws RemoteException;
    public void moveTaskToStack(int taskId, int stackId, boolean toTop) throws RemoteException;
    public void moveTaskToDockedStack(int taskId, int createMode, boolean toTop, boolean animate)
            throws RemoteException;
    public void moveTaskToDockedStack(int taskId, int createMode, boolean toTop, boolean animate,
            Rect initialBounds) throws RemoteException;
    public boolean moveTopActivityToPinnedStack(int stackId, Rect bounds) throws RemoteException;
    public void resizeStack(int stackId, Rect bounds, boolean allowResizeInDockedMode) throws RemoteException;
    public void positionTaskInStack(int taskId, int stackId, int position) throws RemoteException;
+2 −1
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package com.android.systemui;

import android.graphics.Rect;
import android.view.Display;
import android.view.View;

@@ -31,7 +32,7 @@ public interface RecentsComponent {
    /**
     * Docks the top-most task and opens recents.
     */
    void dockTopTask(boolean draggingInRecents);
    void dockTopTask(boolean draggingInRecents, Rect initialBounds);

    /**
     * Called during a drag-from-navbar-in gesture.
+3 −2
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ import android.content.Context;
import android.content.Intent;
import android.content.ServiceConnection;
import android.content.res.Configuration;
import android.graphics.Rect;
import android.os.Build;
import android.os.Handler;
import android.os.IBinder;
@@ -363,8 +364,8 @@ public class Recents extends SystemUI
    }

    @Override
    public void dockTopTask(boolean draggingInRecents) {
        mImpl.dockTopTask(draggingInRecents);
    public void dockTopTask(boolean draggingInRecents, Rect initialBounds) {
        mImpl.dockTopTask(draggingInRecents, initialBounds);
        if (draggingInRecents) {
            mDraggingInRecentsCurrentUser = sSystemServicesProxy.getCurrentUser();
        }
+2 −2
Original line number Diff line number Diff line
@@ -537,12 +537,12 @@ public class RecentsImpl extends IRecentsNonSystemUserCallbacks.Stub implements
        showRelativeAffiliatedTask(false);
    }

    public void dockTopTask(boolean draggingInRecents) {
    public void dockTopTask(boolean draggingInRecents, Rect initialBounds) {
        SystemServicesProxy ssp = Recents.getSystemServices();
        ActivityManager.RunningTaskInfo topTask = ssp.getTopMostTask();
        if (topTask != null && !SystemServicesProxy.isHomeStack(topTask.stackId)) {
            ssp.moveTaskToDockedStack(topTask.id,
                    ActivityManager.DOCKED_STACK_CREATE_MODE_TOP_OR_LEFT);
                    ActivityManager.DOCKED_STACK_CREATE_MODE_TOP_OR_LEFT, initialBounds);
            showRecents(false /* triggeredFromAltTab */, draggingInRecents, false /* animate */);
        }
    }
Loading