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

Commit d91476be authored by Winson Chung's avatar Winson Chung Committed by Android (Google) Code Review
Browse files

Merge "Ensure RecentsActivity is resizeable."

parents 0f3a4f94 147ecaf3
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -205,6 +205,7 @@
                  android:stateNotNeeded="true"
                  android:resumeWhilePausing="true"
                  android:screenOrientation="behind"
                  android:resizeableActivity="true"
                  android:theme="@style/config_recents_activity_theme">
            <intent-filter>
                <action android:name="com.android.systemui.recents.TOGGLE_RECENTS" />
+0 −2
Original line number Diff line number Diff line
@@ -45,8 +45,6 @@ public class Constants {
            public static final boolean EnableSearchLayout = true;
            // Enables the thumbnail alpha on the front-most task
            public static final boolean EnableThumbnailAlphaOnFrontmost = false;
            // Enables all system stacks to show up in the same recents stack
            public static final boolean EnableMultiStackToSingleStack = true;
            // This disables the bitmap and icon caches
            public static final boolean DisableBackgroundCache = false;
            // Enables the simulated task affiliations
+14 −21
Original line number Diff line number Diff line
@@ -116,7 +116,7 @@ public class Recents extends SystemUI
        /** Preloads the next task */
        public void run() {
            // Temporarily skip this if multi stack is enabled
            if (mConfig.multiStackEnabled) return;
            if (mConfig.multiWindowEnabled) return;

            RecentsConfiguration config = RecentsConfiguration.getInstance();
            if (config.svelteLevel == RecentsConfiguration.SVELTE_NONE) {
@@ -176,7 +176,6 @@ public class Recents extends SystemUI

    // Task launching
    RecentsConfiguration mConfig;
    Rect mWindowRect = new Rect();
    Rect mTaskStackBounds = new Rect();
    Rect mSystemInsets = new Rect();
    TaskViewTransform mTmpTransform = new TaskViewTransform();
@@ -372,9 +371,9 @@ public class Recents extends SystemUI
        if (topTask != null && !mSystemServicesProxy.isRecentsTopMost(topTask, topTaskHome)) {
            sInstanceLoadPlan.preloadRawTasks(topTaskHome.value);
            loader.preloadTasks(sInstanceLoadPlan, topTaskHome.value);
            TaskStack top = sInstanceLoadPlan.getAllTaskStacks().get(0);
            if (top.getTaskCount() > 0) {
                preCacheThumbnailTransitionBitmapAsync(topTask, top, mDummyStackView,
            TaskStack stack = sInstanceLoadPlan.getTaskStack();
            if (stack.getTaskCount() > 0) {
                preCacheThumbnailTransitionBitmapAsync(topTask, stack, mDummyStackView,
                        topTaskHome.value);
            }
        }
@@ -388,16 +387,10 @@ public class Recents extends SystemUI
    void showRelativeAffiliatedTask(boolean showNextTask) {
        // Return early if there is no focused stack
        int focusedStackId = mSystemServicesProxy.getFocusedStack();
        TaskStack focusedStack = null;
        RecentsTaskLoader loader = RecentsTaskLoader.getInstance();
        RecentsTaskLoadPlan plan = loader.createLoadPlan(mContext);
        loader.preloadTasks(plan, true /* isTopTaskHome */);
        if (mConfig.multiStackEnabled) {
            if (focusedStackId < 0) return;
            focusedStack = plan.getTaskStack(focusedStackId);
        } else {
            focusedStack = plan.getAllTaskStacks().get(0);
        }
        TaskStack focusedStack = plan.getTaskStack();

        // Return early if there are no tasks in the focused stack
        if (focusedStack == null || focusedStack.getTaskCount() == 0) return;
@@ -502,7 +495,8 @@ public class Recents extends SystemUI
    /** Prepares the header bar layout. */
    void reloadHeaderBarLayout() {
        Resources res = mContext.getResources();
        mWindowRect = mSystemServicesProxy.getWindowRect();
        Rect windowRect = mSystemServicesProxy.getWindowRect();

        mStatusBarHeight = res.getDimensionPixelSize(com.android.internal.R.dimen.status_bar_height);
        mNavBarHeight = res.getDimensionPixelSize(com.android.internal.R.dimen.navigation_bar_height);
        mNavBarWidth = res.getDimensionPixelSize(com.android.internal.R.dimen.navigation_bar_width);
@@ -513,10 +507,10 @@ public class Recents extends SystemUI
        // have the right thumbnail bounds to animate to.
        // Note: We have to reload the widget id before we get the task stack bounds below
        if (mSystemServicesProxy.getOrBindSearchAppWidget(mContext, mAppWidgetHost) != null) {
            mConfig.getSearchBarBounds(mWindowRect.width(), mWindowRect.height(),
            mConfig.getSearchBarBounds(windowRect,
                    mStatusBarHeight, searchBarBounds);
        }
        mConfig.getAvailableTaskStackBounds(mWindowRect.width(), mWindowRect.height(),
        mConfig.getAvailableTaskStackBounds(windowRect,
                mStatusBarHeight, (mConfig.hasTransposedNavBar ? mNavBarWidth : 0), searchBarBounds,
                mTaskStackBounds);
        if (mConfig.isLandscape && mConfig.hasTransposedNavBar) {
@@ -531,7 +525,7 @@ public class Recents extends SystemUI
        TaskStackViewLayoutAlgorithm algo = mDummyStackView.getStackAlgorithm();
        Rect taskStackBounds = new Rect(mTaskStackBounds);
        taskStackBounds.bottom -= mSystemInsets.bottom;
        algo.computeRects(mWindowRect.width(), mWindowRect.height(), taskStackBounds);
        algo.computeRects(windowRect.width(), windowRect.height(), taskStackBounds);
        Rect taskViewSize = algo.getUntransformedTaskViewSize();
        int taskBarHeight = res.getDimensionPixelSize(R.dimen.recents_task_bar_height);
        synchronized (mHeaderBarLock) {
@@ -540,6 +534,7 @@ public class Recents extends SystemUI
            mHeaderBar.measure(
                    View.MeasureSpec.makeMeasureSpec(taskViewSize.width(), View.MeasureSpec.EXACTLY),
                    View.MeasureSpec.makeMeasureSpec(taskBarHeight, View.MeasureSpec.EXACTLY));
            // TODO: may not be needed
            mHeaderBar.layout(0, 0, taskViewSize.width(), taskBarHeight);
        }
    }
@@ -749,10 +744,9 @@ public class Recents extends SystemUI

        // Temporarily skip the transition (use a dummy fade) if multi stack is enabled.
        // For multi-stack we need to figure out where each of the tasks are going.
        if (mConfig.multiStackEnabled) {
        if (mConfig.multiWindowEnabled) {
            loader.preloadTasks(sInstanceLoadPlan, true);
            ArrayList<TaskStack> stacks = sInstanceLoadPlan.getAllTaskStacks();
            TaskStack stack = stacks.get(0);
            TaskStack stack = sInstanceLoadPlan.getTaskStack();
            mDummyStackView.updateMinMaxScrollForStack(stack, mTriggeredFromAltTab, true);
            TaskStackViewLayoutAlgorithm.VisibilityReport stackVr =
                    mDummyStackView.computeStackVisibilityReport();
@@ -765,8 +759,7 @@ public class Recents extends SystemUI
        if (!sInstanceLoadPlan.hasTasks()) {
            loader.preloadTasks(sInstanceLoadPlan, isTopTaskHome);
        }
        ArrayList<TaskStack> stacks = sInstanceLoadPlan.getAllTaskStacks();
        TaskStack stack = stacks.get(0);
        TaskStack stack = sInstanceLoadPlan.getTaskStack();

        // Prepare the dummy stack for the transition
        mDummyStackView.updateMinMaxScrollForStack(stack, mTriggeredFromAltTab, isTopTaskHome);
+12 −19
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@ import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.res.Configuration;
import android.os.Bundle;
import android.os.SystemClock;
import android.os.UserHandle;
@@ -205,10 +206,10 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView
        loadOpts.numVisibleTaskThumbnails = mConfig.launchedNumVisibleThumbnails;
        loader.loadTasks(this, plan, loadOpts);

        ArrayList<TaskStack> stacks = plan.getAllTaskStacks();
        TaskStack stack = plan.getTaskStack();
        mConfig.launchedWithNoRecentTasks = !plan.hasTasks();
        if (!mConfig.launchedWithNoRecentTasks) {
            mRecentsView.setTaskStacks(stacks);
            mRecentsView.setTaskStack(stack);
        }

        // Create the home intent runnable
@@ -224,11 +225,8 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView
                        R.anim.recents_to_launcher_exit));

        // Mark the task that is the launch target
        int taskStackCount = stacks.size();
        int launchTaskIndexInStack = 0;
        if (mConfig.launchedToTaskId != -1) {
            for (int i = 0; i < taskStackCount; i++) {
                TaskStack stack = stacks.get(i);
            ArrayList<Task> tasks = stack.getTasks();
            int taskCount = tasks.size();
            for (int j = 0; j < taskCount; j++) {
@@ -240,7 +238,6 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView
                }
            }
        }
        }

        // Update the top level view's visibilities
        if (mConfig.launchedWithNoRecentTasks) {
@@ -278,11 +275,7 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView
            MetricsLogger.count(this, "overview_source_home", 1);
        }
        // Keep track of the total stack task count
        int taskCount = 0;
        for (int i = 0; i < stacks.size(); i++) {
            TaskStack stack = stacks.get(i);
            taskCount += stack.getTaskCount();
        }
        int taskCount = stack.getTaskCount();
        MetricsLogger.histogram(this, "overview_task_count", taskCount);
    }

+12 −9
Original line number Diff line number Diff line
@@ -134,7 +134,7 @@ public class RecentsConfiguration {
    public boolean fakeShadows;

    /** Dev options and global settings */
    public boolean multiStackEnabled;
    public boolean multiWindowEnabled;
    public boolean lockToAppEnabled;
    public boolean developerOptionsEnabled;
    public boolean debugModeEnabled;
@@ -283,7 +283,7 @@ public class RecentsConfiguration {
                Settings.Global.DEVELOPMENT_SETTINGS_ENABLED) != 0;
        lockToAppEnabled = ssp.getSystemSetting(context,
                Settings.System.LOCK_TO_APP_ENABLED) != 0;
        multiStackEnabled = "true".equals(ssp.getSystemProperty("persist.sys.debug.multi_window"));
        multiWindowEnabled = "true".equals(ssp.getSystemProperty("persist.sys.debug.multi_window"));
    }

    /** Called when the configuration has changed, and we want to reset any configuration specific
@@ -320,14 +320,16 @@ public class RecentsConfiguration {
     * Returns the task stack bounds in the current orientation. These bounds do not account for
     * the system insets.
     */
    public void getAvailableTaskStackBounds(int windowWidth, int windowHeight, int topInset,
    public void getAvailableTaskStackBounds(Rect windowBounds, int topInset,
            int rightInset, Rect searchBarBounds, Rect taskStackBounds) {
        if (isLandscape && hasTransposedSearchBar) {
            // In landscape, the search bar appears on the left, but we overlay it on top
            taskStackBounds.set(0, topInset, windowWidth - rightInset, windowHeight);
            taskStackBounds.set(windowBounds.left, windowBounds.top + topInset,
                    windowBounds.right - rightInset, windowBounds.bottom);
        } else {
            // In portrait, the search bar appears on the top (which already has the inset)
            taskStackBounds.set(0, searchBarBounds.bottom, windowWidth, windowHeight);
            taskStackBounds.set(windowBounds.left, searchBarBounds.bottom,
                    windowBounds.right, windowBounds.bottom);
        }
    }

@@ -335,16 +337,17 @@ public class RecentsConfiguration {
     * Returns the search bar bounds in the current orientation.  These bounds do not account for
     * the system insets.
     */
    public void getSearchBarBounds(int windowWidth, int windowHeight, int topInset,
            Rect searchBarSpaceBounds) {
    public void getSearchBarBounds(Rect windowBounds, int topInset, Rect searchBarSpaceBounds) {
        // Return empty rects if search is not enabled
        int searchBarSize = searchBarSpaceHeightPx;
        if (isLandscape && hasTransposedSearchBar) {
            // In landscape, the search bar appears on the left
            searchBarSpaceBounds.set(0, topInset, searchBarSize, windowHeight);
            searchBarSpaceBounds.set(windowBounds.left, windowBounds.top + topInset,
                    windowBounds.left + searchBarSize, windowBounds.bottom);
        } else {
            // In portrait, the search bar appears on the top
            searchBarSpaceBounds.set(0, topInset, windowWidth, topInset + searchBarSize);
            searchBarSpaceBounds.set(windowBounds.left, windowBounds.top + topInset,
                    windowBounds.right, windowBounds.top + topInset + searchBarSize);
        }
    }
}
Loading