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

Commit 44849b8a authored by Winson's avatar Winson
Browse files

Should not update initial state at all on resize.

This fixes an issue with the stack scrolling upon resizing.  We only 
need to update the initial state if docking, or upon rotation.

Change-Id: Ie59ed72cb22c9b000289db3f04b1a71ad5f64816
parent 7845e8c4
Loading
Loading
Loading
Loading
+9 −2
Original line number Diff line number Diff line
@@ -90,6 +90,7 @@ public class RecentsActivity extends Activity implements ViewTreeObserver.OnPreD

    private RecentsPackageMonitor mPackageMonitor;
    private long mLastTabKeyEventTime;
    private int mLastOrientation = Configuration.ORIENTATION_UNDEFINED;
    private boolean mFinishedOnStartup;
    private boolean mIgnoreAltTabRelease;
    private boolean mIsVisible;
@@ -266,6 +267,7 @@ public class RecentsActivity extends Activity implements ViewTreeObserver.OnPreD
        getWindow().getAttributes().privateFlags |=
                WindowManager.LayoutParams.PRIVATE_FLAG_FORCE_DECOR_VIEW_VISIBILITY;

        mLastOrientation = getResources().getConfiguration().orientation;
        mFocusTimerDuration = getResources().getInteger(R.integer.recents_auto_advance_duration);
        mIterateTrigger = new DozeTrigger(mFocusTimerDuration, new Runnable() {
            @Override
@@ -418,13 +420,18 @@ public class RecentsActivity extends Activity implements ViewTreeObserver.OnPreD
        // Update the nav bar for the current orientation
        updateNavBarScrim(false /* animateNavBarScrim */, AnimationProps.IMMEDIATE);

        EventBus.getDefault().send(new ConfigurationChangedEvent(false /* fromMultiWindow */));
        // Notify of the config change
        int newOrientation = getResources().getConfiguration().orientation;
        EventBus.getDefault().send(new ConfigurationChangedEvent(false /* fromMultiWindow */,
                (mLastOrientation != newOrientation)));
        mLastOrientation = newOrientation;
    }

    @Override
    public void onMultiWindowChanged(boolean inMultiWindow) {
        super.onMultiWindowChanged(inMultiWindow);
        EventBus.getDefault().send(new ConfigurationChangedEvent(true /* fromMultiWindow */));
        EventBus.getDefault().send(new ConfigurationChangedEvent(true /* fromMultiWindow */,
                false /* fromOrientationChange */));

        if (mRecentsView != null) {
            // Reload the task stack completely
+3 −1
Original line number Diff line number Diff line
@@ -24,8 +24,10 @@ import com.android.systemui.recents.events.EventBus;
public class ConfigurationChangedEvent extends EventBus.AnimatedEvent {

    public final boolean fromMultiWindow;
    public final boolean fromOrientationChange;

    public ConfigurationChangedEvent(boolean fromMultiWindow) {
    public ConfigurationChangedEvent(boolean fromMultiWindow, boolean fromOrientationChange) {
        this.fromMultiWindow = fromMultiWindow;
        this.fromOrientationChange = fromOrientationChange;
    }
}
+6 −4
Original line number Diff line number Diff line
@@ -1999,10 +1999,12 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
            }
        }

        // Trigger a new layout and scroll to the initial state
        mInitialState = event.fromMultiWindow
                ? INITIAL_STATE_UPDATE_ALL
                : INITIAL_STATE_UPDATE_LAYOUT_ONLY;
        // Trigger a new layout and update to the initial state if necessary
        if (event.fromMultiWindow) {
            mInitialState = INITIAL_STATE_UPDATE_ALL;
        } else if (event.fromOrientationChange) {
            mInitialState = INITIAL_STATE_UPDATE_LAYOUT_ONLY;
        }
        requestLayout();
    }