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

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

Merge "Disabling timer" into nyc-dev

parents ac31e09c e693aafe
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -292,6 +292,9 @@
    <!-- The amount to allow the stack to overscroll. -->
    <dimen name="recents_stack_overscroll">24dp</dimen>

    <!-- The size of the initial peek area at the top of the stack (below the status bar). -->
    <dimen name="recents_initial_top_peek_size">8dp</dimen>

    <!-- The size of the peek area at the top of the stack (below the status bar). -->
    <dimen name="recents_layout_focused_top_peek_size">@dimen/recents_history_button_height</dimen>

+12 −15
Original line number Diff line number Diff line
@@ -43,6 +43,7 @@ import com.android.systemui.R;
import com.android.systemui.recents.events.EventBus;
import com.android.systemui.recents.events.activity.AppWidgetProviderChangedEvent;
import com.android.systemui.recents.events.activity.CancelEnterRecentsWindowAnimationEvent;
import com.android.systemui.recents.events.activity.ConfigurationChangedEvent;
import com.android.systemui.recents.events.activity.DebugFlagsChangedEvent;
import com.android.systemui.recents.events.activity.DismissRecentsToHomeAnimationStarted;
import com.android.systemui.recents.events.activity.EnterRecentsWindowAnimationCompletedEvent;
@@ -107,7 +108,7 @@ public class RecentsActivity extends Activity implements ViewTreeObserver.OnPreD
    private RecentsAppWidgetHostView mSearchWidgetHostView;

    // Runnables to finish the Recents activity
    private FinishRecentsRunnable mFinishLaunchHomeRunnable;
    private Intent mHomeIntent;

    // The trigger to automatically launch the current task
    private int mFocusTimerDuration;
@@ -119,7 +120,7 @@ public class RecentsActivity extends Activity implements ViewTreeObserver.OnPreD
     * last activity launch state. Generally we always launch home when we exit Recents rather than
     * just finishing the activity since we don't know what is behind Recents in the task stack.
     */
    class FinishRecentsRunnable implements Runnable {
    class LaunchHomeRunnable implements Runnable {

        Intent mLaunchIntent;
        ActivityOptions mOpts;
@@ -127,7 +128,7 @@ public class RecentsActivity extends Activity implements ViewTreeObserver.OnPreD
        /**
         * Creates a finish runnable that starts the specified intent.
         */
        public FinishRecentsRunnable(Intent launchIntent, ActivityOptions opts) {
        public LaunchHomeRunnable(Intent launchIntent, ActivityOptions opts) {
            mLaunchIntent = launchIntent;
            mOpts = opts;
        }
@@ -215,7 +216,7 @@ public class RecentsActivity extends Activity implements ViewTreeObserver.OnPreD
            MetricsLogger.count(this, "overview_trigger_nav_btn", 1);
        }
        // Keep track of whether we launched from an app or from home
        if (launchState.launchedFromAppWithThumbnail) {
        if (launchState.launchedFromApp) {
            MetricsLogger.count(this, "overview_source_app", 1);
            // If from an app, track the stack index of the app in the stack (for affiliated tasks)
            MetricsLogger.histogram(this, "overview_source_app_index", launchTaskIndexInStack);
@@ -294,12 +295,8 @@ public class RecentsActivity extends Activity implements ViewTreeObserver.OnPreD
    void dismissRecentsToHome(boolean animateTaskViews, ActivityOptions overrideAnimation) {
        DismissRecentsToHomeAnimationStarted dismissEvent =
                new DismissRecentsToHomeAnimationStarted(animateTaskViews);
        if (overrideAnimation != null) {
            dismissEvent.addPostAnimationCallback(new FinishRecentsRunnable(
                    mFinishLaunchHomeRunnable.mLaunchIntent, overrideAnimation));
        } else {
            dismissEvent.addPostAnimationCallback(mFinishLaunchHomeRunnable);
        }
        dismissEvent.addPostAnimationCallback(new LaunchHomeRunnable(mHomeIntent,
                overrideAnimation));
        dismissEvent.addPostAnimationCallback(new Runnable() {
            @Override
            public void run() {
@@ -365,11 +362,10 @@ public class RecentsActivity extends Activity implements ViewTreeObserver.OnPreD
        });

        // Create the home intent runnable
        Intent homeIntent = new Intent(Intent.ACTION_MAIN, null);
        homeIntent.addCategory(Intent.CATEGORY_HOME);
        homeIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK |
        mHomeIntent = new Intent(Intent.ACTION_MAIN, null);
        mHomeIntent.addCategory(Intent.CATEGORY_HOME);
        mHomeIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK |
                Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);
        mFinishLaunchHomeRunnable = new FinishRecentsRunnable(homeIntent, null);

        // Bind the search app widget when we first start up
        if (RecentsDebugFlags.Static.EnableSearchBar) {
@@ -404,7 +400,7 @@ public class RecentsActivity extends Activity implements ViewTreeObserver.OnPreD
        RecentsConfiguration config = Recents.getConfiguration();
        RecentsActivityLaunchState launchState = config.getLaunchState();
        boolean wasLaunchedByAm = !launchState.launchedFromHome &&
                !launchState.launchedFromAppWithThumbnail;
                !launchState.launchedFromApp;
        if (launchState.launchedHasConfigurationChanged || wasLaunchedByAm) {
            EventBus.getDefault().send(new EnterRecentsWindowAnimationCompletedEvent());
        }
@@ -528,6 +524,7 @@ public class RecentsActivity extends Activity implements ViewTreeObserver.OnPreD
    @Override
    public void onMultiWindowChanged(boolean inMultiWindow) {
        super.onMultiWindowChanged(inMultiWindow);
        EventBus.getDefault().send(new ConfigurationChangedEvent());
        RecentsTaskLoader loader = Recents.getTaskLoader();
        RecentsTaskLoadPlan.Options launchOpts = new RecentsTaskLoadPlan.Options();
        launchOpts.loadIcons = false;
+5 −3
Original line number Diff line number Diff line
@@ -28,7 +28,8 @@ package com.android.systemui.recents;
public class RecentsActivityLaunchState {

    public boolean launchedWithAltTab;
    public boolean launchedFromAppWithThumbnail;
    public boolean launchedFromApp;
    public boolean launchedFromAppDocked;
    public boolean launchedFromHome;
    public boolean launchedFromSearchHome;
    public boolean launchedReuseTaskStackViews;
@@ -42,7 +43,8 @@ public class RecentsActivityLaunchState {
    public void reset() {
        launchedFromHome = false;
        launchedFromSearchHome = false;
        launchedFromAppWithThumbnail = false;
        launchedFromApp = false;
        launchedFromAppDocked = false;
        launchedToTaskId = -1;
        launchedWithAltTab = false;
        launchedHasConfigurationChanged = false;
@@ -67,7 +69,7 @@ public class RecentsActivityLaunchState {
    public int getInitialFocusTaskIndex(int numTasks) {
        RecentsDebugFlags debugFlags = Recents.getDebugFlags();
        RecentsActivityLaunchState launchState = Recents.getConfiguration().getLaunchState();
        if (launchedFromAppWithThumbnail) {
        if (launchedFromApp) {
            if (!launchState.launchedWithAltTab && debugFlags.isFastToggleRecentsEnabled()) {
                // If fast toggling, focus the front most task so that the next tap will focus the
                // N-1 task
+0 −2
Original line number Diff line number Diff line
@@ -69,7 +69,6 @@ public class RecentsConfiguration {
    public final int smallestWidth;

    /** Misc **/
    public boolean useHardwareLayers;
    public boolean fakeShadows;
    public int svelteLevel;
    public int searchBarSpaceHeightPx;
@@ -80,7 +79,6 @@ public class RecentsConfiguration {
        SystemServicesProxy ssp = Recents.getSystemServices();
        Context appContext = context.getApplicationContext();
        Resources res = appContext.getResources();
        useHardwareLayers = res.getBoolean(R.bool.config_recents_use_hardware_layers);
        fakeShadows = res.getBoolean(R.bool.config_recents_fake_shadows);
        svelteLevel = res.getInteger(R.integer.recents_svelte_level);

+16 −15
Original line number Diff line number Diff line
@@ -39,8 +39,8 @@ public class RecentsDebugFlags implements TunerService.Tunable {
        public static final boolean EnableAffiliatedTaskGroups = true;
        // Enables the history
        public static final boolean EnableHistory = false;
        // Overrides the Tuner flags and enables the fast toggle and timeout
        public static final boolean EnableFastToggleTimeoutOverride = true;
        // Overrides the Tuner flags and enables the timeout
        private static final boolean EnableFastToggleTimeout = false;

        // Enables us to create mock recents tasks
        public static final boolean EnableMockTasks = false;
@@ -54,9 +54,9 @@ public class RecentsDebugFlags implements TunerService.Tunable {
        public static final int MockTaskGroupsTaskCount = 12;
    }

    private static final String KEY_DISABLE_FAST_TOGGLE = "overview_disable_fast_toggle_via_button";
    private static final String KEY_ENABLE_PAGING = "overview_enable_paging";

    private boolean mDisableFastToggleRecents;
    private boolean mEnablePaging;

    /**
     * We read the prefs once when we start the activity, then update them as the tuner changes
@@ -65,31 +65,32 @@ 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_DISABLE_FAST_TOGGLE);
        TunerService.get(context).addTunable(this, KEY_ENABLE_PAGING);
    }

    /**
     * @return whether we are enabling fast toggling.
     */
    public boolean isFastToggleRecentsEnabled() {
        // These checks EnableFastToggleTimeoutOverride
        SystemServicesProxy ssp = Recents.getSystemServices();
        if (mDisableFastToggleRecents || ssp.hasFreeformWorkspaceSupport() || ssp.hasDockedTask()
                || ssp.isTouchExplorationEnabled()) {
        if (ssp.hasFreeformWorkspaceSupport() || ssp.isTouchExplorationEnabled()) {
            return false;
        }
        if (Static.EnableFastToggleTimeoutOverride) {
            return true;
        return Static.EnableFastToggleTimeout;
    }
        return true;

    /**
     * @return whether we are enabling paging.
     */
    public boolean isPagingEnabled() {
        return mEnablePaging;
    }

    @Override
    public void onTuningChanged(String key, String newValue) {
        switch (key) {
            case KEY_DISABLE_FAST_TOGGLE:
                mDisableFastToggleRecents = (newValue != null) &&
                        (Integer.parseInt(newValue) != 0);
            case KEY_ENABLE_PAGING:
                mEnablePaging = (newValue != null) && (Integer.parseInt(newValue) != 0);
                break;
        }
        EventBus.getDefault().send(new DebugFlagsChangedEvent());
Loading