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

Commit ead5c0fc authored by Winson Chung's avatar Winson Chung
Browse files

Enabling history and paging by default

- Removing associated tuner flags

Change-Id: Ia69bf273489b0079c389e7feb1428071569092d5
parent 48f2cda8
Loading
Loading
Loading
Loading
+0 −20
Original line number Diff line number Diff line
@@ -1171,31 +1171,11 @@
    <!-- Option to use new paging layout in quick settings [CHAR LIMIT=60] -->
    <string name="qs_paging" translatable="false">Use the new Quick Settings</string>

    <!-- Toggles paging recents via the recents button. DO NOT TRANSLATE -->
    <string name="overview_page_on_toggle">Enable paging</string>
    <!-- Description for the toggle for fast-toggling recents via the recents button. DO NOT TRANSLATE -->
    <string name="overview_page_on_toggle_desc">Enable paging via the Overview button</string>

    <!-- Toggles fast-toggling recents via the recents button. DO NOT TRANSLATE -->
    <string name="overview_fast_toggle_via_button">Enable fast toggle</string>
    <!-- Description for the toggle for fast-toggling recents via the recents button. DO NOT TRANSLATE -->
    <string name="overview_fast_toggle_via_button_desc">Enable launch timeout while paging</string>

    <!-- Toggles fullscreen screenshots. DO NOT TRANSLATE -->
    <string name="overview_fullscreen_thumbnails">Enable fullscreen screenshots</string>
    <!-- Description for the toggle for fullscreen screenshots. DO NOT TRANSLATE -->
    <string name="overview_fullscreen_thumbnails_desc">Enable fullscreen screenshots in Overview. Restart required.</string>

    <!-- Toggle to enable the Overview nav bar gesture. DO NOT TRANSLATE -->
    <string name="overview_nav_bar_gesture">Enable navigation bar gesture</string>
    <!-- Description for the toggle to enable the Overview nav bar gesture. DO NOT TRANSLATE -->
    <string name="overview_nav_bar_gesture_desc">Enables the gesture to enter Overview by swiping up on the Nav bar</string>

    <!-- Toggle to show the history view in Overview. DO NOT TRANSLATE -->
    <string name="overview_show_history">Show History</string>
    <!-- Description for the toggle to show the history view in Overview. DO NOT TRANSLATE -->
    <string name="overview_show_history_desc">Enables the history view to see more recent tasks</string>

    <!-- Toggle to set the initial scroll state to be paging or stack. DO NOT TRANSLATE -->
    <string name="overview_initial_state_paging">Initialize to paging</string>
    <!-- Description for the toggle to set the initial scroll state to be paging or stack. DO NOT TRANSLATE -->
+0 −20
Original line number Diff line number Diff line
@@ -72,11 +72,6 @@
    <PreferenceScreen
        android:title="@string/overview" >

        <com.android.systemui.tuner.TunerSwitch
            android:key="overview_page_on_toggle"
            android:title="@string/overview_page_on_toggle"
            android:summary="@string/overview_page_on_toggle_desc" />

        <com.android.systemui.tuner.TunerSwitch
            android:key="overview_initial_state_paging"
            android:title="@string/overview_initial_state_paging"
@@ -87,21 +82,6 @@
            android:title="@string/overview_fast_toggle_via_button"
            android:summary="@string/overview_fast_toggle_via_button_desc" />

        <com.android.systemui.tuner.TunerSwitch
            android:key="overview_nav_bar_gesture"
            android:title="@string/overview_nav_bar_gesture"
            android:summary="@string/overview_nav_bar_gesture_desc" />

        <com.android.systemui.tuner.TunerSwitch
            android:key="overview_fullscreen_thumbnails"
            android:title="@string/overview_fullscreen_thumbnails"
            android:summary="@string/overview_fullscreen_thumbnails_desc" />

        <com.android.systemui.tuner.TunerSwitch
            android:key="overview_show_history"
            android:title="@string/overview_show_history"
            android:summary="@string/overview_show_history_desc" />

    </PreferenceScreen>

    <SwitchPreference
+11 −16
Original line number Diff line number Diff line
@@ -53,31 +53,26 @@ public class RecentsActivityLaunchState {
     */
    public int getInitialFocusTaskIndex(int numTasks) {
        RecentsDebugFlags flags = Recents.getDebugFlags();
        if (flags.isPageOnToggleEnabled() && !launchedWithAltTab) {
            // If we are fast toggling, then focus the next task depending on when you are on home
            // or coming in from another app
        if (launchedWithAltTab) {
            if (launchedFromAppWithThumbnail) {
                // If alt-tabbing from another app, focus the next task
                return numTasks - 2;
            } else {
                // If alt-tabbing from home, focus the first task
                return numTasks - 1;
            }
        } else {
            if (launchedFromHome) {
                return numTasks - 1;
            } else {
                if (flags.isFastToggleRecentsEnabled() || !flags.isInitialStatePaging()) {
                    // If we are not fast-toggling or are starting in the non-focused mode, then
                    // we should assume the front most task has focus
                    return numTasks - 1;
                } else {
                    return numTasks - 2;
                }
            }
        }

        if (launchedWithAltTab && launchedFromAppWithThumbnail) {
            // If alt-tabbing from another app, focus the next task
            return numTasks - 2;
        } else if ((launchedWithAltTab && launchedFromHome) ||
                (!launchedWithAltTab && launchedFromAppWithThumbnail)) {
            // If alt-tabbing from home, or launching from an app normally, focus that task
            return numTasks - 1;
        } else {
            // Otherwise, we are launching recents from home normally, focus no tasks so that we
            // know to return home
            return -1;
        }
    }
}
+4 −18
Original line number Diff line number Diff line
@@ -143,16 +143,13 @@ public class RecentsConfiguration {
            int rightInset, Rect searchBarBounds, Rect taskStackBounds) {
        if (hasTransposedNavBar) {
            // In landscape phones, the search bar appears on the left, but we overlay it on top
            int swInset = getInsetToSmallestWidth(windowBounds.right - rightInset -
                    windowBounds.left);
            taskStackBounds.set(windowBounds.left + swInset, windowBounds.top + topInset,
                    windowBounds.right - swInset - rightInset, windowBounds.bottom);
            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)
            int swInset = getInsetToSmallestWidth(windowBounds.right - windowBounds.left);
            int top = searchBarBounds.isEmpty() ? topInset : 0;
            taskStackBounds.set(windowBounds.left + swInset, searchBarBounds.bottom + top,
                    windowBounds.right - swInset - rightInset, windowBounds.bottom);
            taskStackBounds.set(windowBounds.left, searchBarBounds.bottom + top,
                    windowBounds.right - rightInset, windowBounds.bottom);
        }
    }

@@ -173,15 +170,4 @@ public class RecentsConfiguration {
                    windowBounds.right, windowBounds.top + topInset + searchBarSize);
        }
    }

    /**
     * Constrain the width of the landscape stack to the smallest width of the device.
     */
    private int getInsetToSmallestWidth(int availableWidth) {
        RecentsDebugFlags debugFlags = Recents.getDebugFlags();
        if (!debugFlags.isFullscreenThumbnailsEnabled() && (availableWidth > smallestWidth)) {
            return (availableWidth - smallestWidth) / 2;
        }
        return 0;
    }
}
+3 −43
Original line number Diff line number Diff line
@@ -26,10 +26,7 @@ import com.android.systemui.tuner.TunerService;
 */
public class RecentsDebugFlags implements TunerService.Tunable {

    private static final String KEY_FAST_TOGGLE = "overview_fast_toggle";
    private static final String KEY_PAGE_ON_TOGGLE = "overview_page_on_toggle";
    private static final String KEY_FULLSCREEN_THUMBNAILS = "overview_fullscreen_thumbnails";
    private static final String KEY_SHOW_HISTORY = "overview_show_history";
    private static final String KEY_FAST_TOGGLE = "overview_fast_toggle_via_button";
    private static final String KEY_INITIAL_STATE_PAGING = "overview_initial_state_paging";

    public static class Static {
@@ -52,9 +49,6 @@ public class RecentsDebugFlags implements TunerService.Tunable {
    }

    private boolean mFastToggleRecents;
    private boolean mPageOnToggle;
    private boolean mUseFullscreenThumbnails;
    private boolean mShowHistory;
    private boolean mInitialStatePaging;

    /**
@@ -64,36 +58,14 @@ public class RecentsDebugFlags implements TunerService.Tunable {
    public RecentsDebugFlags(Context context) {
        // Register all our flags, this will also call onTuningChanged() for each key, which will
        // initialize the current state of each flag
        TunerService.get(context).addTunable(this, KEY_FAST_TOGGLE, KEY_PAGE_ON_TOGGLE,
                KEY_FULLSCREEN_THUMBNAILS, KEY_SHOW_HISTORY, KEY_INITIAL_STATE_PAGING);
        TunerService.get(context).addTunable(this, KEY_FAST_TOGGLE, KEY_INITIAL_STATE_PAGING);
    }

    /**
     * @return whether we are enabling fast toggling.
     */
    public boolean isFastToggleRecentsEnabled() {
        return mPageOnToggle && mFastToggleRecents;
    }

    /**
     * @return whether the recents button toggles pages.
     */
    public boolean isPageOnToggleEnabled() {
        return mPageOnToggle;
    }

    /**
     * @return whether we should show fullscreen thumbnails
     */
    public boolean isFullscreenThumbnailsEnabled() {
        return mUseFullscreenThumbnails;
    }

    /**
     * @return whether we should show the history
     */
    public boolean isHistoryEnabled() {
        return mShowHistory;
        return mFastToggleRecents;
    }

    /**
@@ -110,18 +82,6 @@ public class RecentsDebugFlags implements TunerService.Tunable {
                mFastToggleRecents = (newValue != null) &&
                        (Integer.parseInt(newValue) != 0);
                break;
            case KEY_PAGE_ON_TOGGLE:
                mPageOnToggle = (newValue != null) &&
                        (Integer.parseInt(newValue) != 0);
                break;
            case KEY_FULLSCREEN_THUMBNAILS:
                mUseFullscreenThumbnails = (newValue != null) &&
                        (Integer.parseInt(newValue) != 0);
                break;
            case KEY_SHOW_HISTORY:
                mShowHistory = (newValue != null) &&
                        (Integer.parseInt(newValue) != 0);
                break;
            case KEY_INITIAL_STATE_PAGING:
                mInitialStatePaging = (newValue != null) &&
                        (Integer.parseInt(newValue) != 0);
Loading