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

Commit f3e87908 authored by Jorim Jaggi's avatar Jorim Jaggi Committed by Android (Google) Code Review
Browse files

Merge changes I10224452,I7af4149f

* changes:
  Grow recents when in multi-window on phones
  Add animation when docking top task with long press
parents 781c53a8 cdb06cae
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -195,6 +195,10 @@
    <!-- Svelte specific logic, see RecentsConfiguration.SVELTE_* constants. -->
    <integer name="recents_svelte_level">0</integer>

    <!-- In multi-window, determines whether the stack where recents lives should grow from
         the smallest position when being launched. -->
    <bool name="recents_grow_in_multiwindow">true</bool>

    <!-- Recents: The relative range of visible tasks from the current scroll position
         while the stack is focused. -->
    <item name="recents_layout_focused_range_min" format="float" type="integer">-3</item>
+1 −1
Original line number Diff line number Diff line
@@ -32,7 +32,7 @@ public interface RecentsComponent {
    /**
     * Docks the top-most task and opens recents.
     */
    boolean dockTopTask(boolean draggingInRecents, int stackCreateMode, Rect initialBounds);
    boolean dockTopTask(int dragMode, int stackCreateMode, Rect initialBounds);

    /**
     * Called during a drag-from-navbar-in gesture.
+4 −0
Original line number Diff line number Diff line
@@ -16,6 +16,8 @@

package com.android.systemui.recents;

import android.graphics.Rect;

/**
 * Due to the fact that RecentsActivity is per-user, we need to establish an
 * interface (this) for the system user to callback to the secondary users in
@@ -29,6 +31,8 @@ oneway interface IRecentsNonSystemUserCallbacks {
    void hideRecents(boolean triggeredFromAltTab, boolean triggeredFromHomeKey);
    void toggleRecents();
    void onConfigurationChanged();
    void dockTopTask(int topTaskId, int dragMode, int stackCreateMode,
            in Rect initialBounds);
    void onDraggingInRecents(float distanceFromTop);
    void onDraggingInRecentsEnded(float velocity);
}
+3 −0
Original line number Diff line number Diff line
@@ -26,4 +26,7 @@ oneway interface IRecentsSystemUserCallbacks {

    void updateRecentsVisibility(boolean visible);
    void startScreenPinning();
    void sendRecentsDrawnEvent();
    void sendDockingTopTaskEvent(int dragMode);
    void sendLaunchRecentsEvent();
}
+79 −5
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package com.android.systemui.recents;

import android.app.ActivityManager;
import android.content.ComponentName;
import android.content.ContentResolver;
import android.content.Context;
@@ -36,8 +37,11 @@ import android.view.View;
import com.android.systemui.RecentsComponent;
import com.android.systemui.SystemUI;
import com.android.systemui.recents.events.EventBus;
import com.android.systemui.recents.events.activity.DockingTopTaskEvent;
import com.android.systemui.recents.events.activity.RecentsActivityStartingEvent;
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;

@@ -366,17 +370,38 @@ public class Recents extends SystemUI
    }

    @Override
    public boolean dockTopTask(boolean draggingInRecents, int stackCreateMode, Rect initialBounds) {
    public boolean dockTopTask(int dragMode, int stackCreateMode, Rect initialBounds) {
        // Ensure the device has been provisioned before allowing the user to interact with
        // recents
        if (!isUserSetup()) {
            return false;
        }

        if (mImpl.dockTopTask(draggingInRecents, stackCreateMode,initialBounds)) {
            if (draggingInRecents) {
                mDraggingInRecentsCurrentUser = sSystemServicesProxy.getCurrentUser();
        int currentUser = sSystemServicesProxy.getCurrentUser();
        SystemServicesProxy ssp = Recents.getSystemServices();
        ActivityManager.RunningTaskInfo topTask = ssp.getTopMostTask();
        boolean screenPinningActive = ssp.isScreenPinningActive();
        boolean isTopTaskHome = topTask != null && SystemServicesProxy.isHomeStack(topTask.stackId);
        if (topTask != null && !isTopTaskHome && !screenPinningActive) {
            if (sSystemServicesProxy.isSystemUser(currentUser)) {
                mImpl.dockTopTask(topTask.id, dragMode, stackCreateMode, initialBounds);
            } else {
                if (mSystemUserCallbacks != null) {
                    IRecentsNonSystemUserCallbacks callbacks =
                            mSystemUserCallbacks.getNonSystemUserRecentsForUser(currentUser);
                    if (callbacks != null) {
                        try {
                            callbacks.dockTopTask(topTask.id, dragMode, stackCreateMode,
                                    initialBounds);
                        } catch (RemoteException e) {
                            Log.e(TAG, "Callback failed", e);
                        }
                    } else {
                        Log.e(TAG, "No SystemUI callbacks found for user: " + currentUser);
                    }
                }
            }
            mDraggingInRecentsCurrentUser = currentUser;
            return true;
        }
        return false;
@@ -516,6 +541,54 @@ public class Recents extends SystemUI
        }
    }

    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);
                    }
                }
            });
        }
    }

    public final void onBusEvent(final DockingTopTaskEvent event) {
        int processUser = sSystemServicesProxy.getProcessUser();
        if (!sSystemServicesProxy.isSystemUser(processUser)) {
            postToSystemUser(new Runnable() {
                @Override
                public void run() {
                    try {
                        mCallbacksToSystemUser.sendDockingTopTaskEvent(event.dragMode);
                    } catch (RemoteException e) {
                        Log.e(TAG, "Callback failed", e);
                    }
                }
            });
        }
    }

    public final void onBusEvent(final RecentsActivityStartingEvent event) {
        int processUser = sSystemServicesProxy.getProcessUser();
        if (!sSystemServicesProxy.isSystemUser(processUser)) {
            postToSystemUser(new Runnable() {
                @Override
                public void run() {
                    try {
                        mCallbacksToSystemUser.sendLaunchRecentsEvent();
                    } catch (RemoteException e) {
                        Log.e(TAG, "Callback failed", e);
                    }
                }
            });
        }
    }

    /**
     * Attempts to register with the system user.
     */
@@ -525,7 +598,8 @@ public class Recents extends SystemUI
            @Override
            public void run() {
                try {
                    mCallbacksToSystemUser.registerNonSystemUserCallbacks(mImpl, processUser);
                    mCallbacksToSystemUser.registerNonSystemUserCallbacks(
                            new RecentsImplProxy(mImpl), processUser);
                } catch (RemoteException e) {
                    Log.e(TAG, "Failed to register", e);
                }
Loading