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

Commit 6783384e authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Optimize some binder calls when recents configuration changes" into nyc-dev

parents c81b726e 25160db7
Loading
Loading
Loading
Loading
+11 −5
Original line number Diff line number Diff line
@@ -99,6 +99,7 @@ public class RecentsActivity extends Activity implements ViewTreeObserver.OnPreD
    private RecentsPackageMonitor mPackageMonitor;
    private long mLastTabKeyEventTime;
    private int mLastDeviceOrientation = Configuration.ORIENTATION_UNDEFINED;
    private int mLastDisplayDensity;
    private boolean mFinishedOnStartup;
    private boolean mIgnoreAltTabRelease;
    private boolean mIsVisible;
@@ -276,7 +277,9 @@ public class RecentsActivity extends Activity implements ViewTreeObserver.OnPreD
        getWindow().getAttributes().privateFlags |=
                WindowManager.LayoutParams.PRIVATE_FLAG_FORCE_DECOR_VIEW_VISIBILITY;

        mLastDeviceOrientation = Utilities.getAppConfiguration(this).orientation;
        Configuration appConfiguration = Utilities.getAppConfiguration(this);
        mLastDeviceOrientation = appConfiguration.orientation;
        mLastDisplayDensity = appConfiguration.densityDpi;
        mFocusTimerDuration = getResources().getInteger(R.integer.recents_auto_advance_duration);
        mIterateTrigger = new DozeTrigger(mFocusTimerDuration, new Runnable() {
            @Override
@@ -427,11 +430,13 @@ public class RecentsActivity extends Activity implements ViewTreeObserver.OnPreD
        super.onConfigurationChanged(newConfig);

        // Notify of the config change
        int newDeviceOrientation = Utilities.getAppConfiguration(this).orientation;
        Configuration newDeviceConfiguration = Utilities.getAppConfiguration(this);
        int numStackTasks = mRecentsView.getStack().getStackTaskCount();
        EventBus.getDefault().send(new ConfigurationChangedEvent(false /* fromMultiWindow */,
                (mLastDeviceOrientation != newDeviceOrientation), numStackTasks > 0));
        mLastDeviceOrientation = newDeviceOrientation;
                mLastDeviceOrientation != newDeviceConfiguration.orientation,
                mLastDisplayDensity != newDeviceConfiguration.densityDpi, numStackTasks > 0));
        mLastDeviceOrientation = newDeviceConfiguration.orientation;
        mLastDisplayDensity = newDeviceConfiguration.densityDpi;
    }

    @Override
@@ -454,7 +459,8 @@ public class RecentsActivity extends Activity implements ViewTreeObserver.OnPreD
        int numStackTasks = stack.getStackTaskCount();

        EventBus.getDefault().send(new ConfigurationChangedEvent(true /* fromMultiWindow */,
                false /* fromDeviceOrientationChange */, numStackTasks > 0));
                false /* fromDeviceOrientationChange */, false /* fromDisplayDensityChange */,
                numStackTasks > 0));
        EventBus.getDefault().send(new MultiWindowStateChangedEvent(isInMultiWindowMode, stack));
    }

+1 −1
Original line number Diff line number Diff line
@@ -560,7 +560,7 @@ public class RecentsImpl implements ActivityOptions.OnAnimationFinishedListener
                com.android.internal.R.dimen.navigation_bar_height);
        mNavBarWidth = res.getDimensionPixelSize(
                com.android.internal.R.dimen.navigation_bar_width);
        mTaskBarHeight = TaskStackLayoutAlgorithm.getDimensionForDevice(res,
        mTaskBarHeight = TaskStackLayoutAlgorithm.getDimensionForDevice(mContext,
                R.dimen.recents_task_view_header_height,
                R.dimen.recents_task_view_header_height,
                R.dimen.recents_task_view_header_height,
+3 −1
Original line number Diff line number Diff line
@@ -25,12 +25,14 @@ public class ConfigurationChangedEvent extends EventBus.AnimatedEvent {

    public final boolean fromMultiWindow;
    public final boolean fromDeviceOrientationChange;
    public final boolean fromDisplayDensityChange;
    public final boolean hasStackTasks;

    public ConfigurationChangedEvent(boolean fromMultiWindow, boolean fromDeviceOrientationChange,
            boolean hasStackTasks) {
            boolean fromDisplayDensityChange, boolean hasStackTasks) {
        this.fromMultiWindow = fromMultiWindow;
        this.fromDeviceOrientationChange = fromDeviceOrientationChange;
        this.fromDisplayDensityChange = fromDisplayDensityChange;
        this.hasStackTasks = hasStackTasks;
    }
}
+0 −12
Original line number Diff line number Diff line
@@ -950,18 +950,6 @@ public class SystemServicesProxy {
        return displayRect;
    }

    /**
     * Returns the current display orientation.
     */
    public int getDisplayOrientation() {
        // Because of multi-window, the configuration orientation does not necessarily reflect the
        // orientation of the display, instead we just use the display's real-size.
        Rect displayRect = getDisplayRect();
        return displayRect.width() > displayRect.height()
                ? Configuration.ORIENTATION_LANDSCAPE
                : Configuration.ORIENTATION_PORTRAIT;
    }

    /**
     * Returns the window rect for the RecentsActivity, based on the dimensions of the home stack.
     */
+3 −1
Original line number Diff line number Diff line
@@ -193,8 +193,10 @@ public class RecentsViewTouchHandler {
    }

    public final void onBusEvent(ConfigurationChangedEvent event) {
        if (event.fromDisplayDensityChange) {
            updateSnapAlgorithm();
        }
    }

    /**
     * Handles dragging touch events
Loading