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

Commit 9c177413 authored by Sunny Goyal's avatar Sunny Goyal Committed by Android (Google) Code Review
Browse files

Merge "Fixing the loader to bind the first screen as well as the hotseat...

Merge "Fixing the loader to bind the first screen as well as the hotseat together" into ub-launcher3-calgary
parents cd2717fb 93f878c1
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -997,7 +997,7 @@ public class Launcher extends Activity
        mPaused = false;
        if (mRestoring || mOnResumeNeedsLoad) {
            setWorkspaceLoading(true);
            mModel.startLoader(PagedView.INVALID_RESTORE_PAGE);
            mModel.startLoader(getCurrentWorkspaceScreen());
            mRestoring = false;
            mOnResumeNeedsLoad = false;
        }
@@ -3664,6 +3664,7 @@ public class Launcher extends Activity
     * @return true if we are currently paused.  The caller might be able to
     * skip some work in that case since we will come back again.
     */
    @Override
    public boolean setLoadOnResume() {
        if (mPaused) {
            if (LOGD) Log.d(TAG, "setLoadOnResume");
@@ -3677,6 +3678,7 @@ public class Launcher extends Activity
    /**
     * Implementation of the method from LauncherModel.Callbacks.
     */
    @Override
    public int getCurrentWorkspaceScreen() {
        if (mWorkspace != null) {
            return mWorkspace.getCurrentPage();
@@ -4046,7 +4048,6 @@ public class Launcher extends Activity
     * Restores a pending widget.
     *
     * @param appWidgetId The app widget id
     * @param cellInfo The position on screen where to create the widget.
     */
    private void completeRestoreAppWidget(final int appWidgetId) {
        LauncherAppWidgetHostView view = mWorkspace.getWidgetForAppWidgetId(appWidgetId);
+7 −8
Original line number Diff line number Diff line
@@ -1266,17 +1266,13 @@ public class LauncherModel extends BroadcastReceiver
     * of doing it now.
     */
    public void startLoaderFromBackground() {
        boolean runLoader = false;
        Callbacks callbacks = getCallback();
        if (callbacks != null) {
            // Only actually run the loader if they're not paused.
            if (!callbacks.setLoadOnResume()) {
                runLoader = true;
                startLoader(callbacks.getCurrentWorkspaceScreen());
            }
        }
        if (runLoader) {
            startLoader(PagedView.INVALID_RESTORE_PAGE);
        }
    }

    /**
@@ -1313,7 +1309,7 @@ public class LauncherModel extends BroadcastReceiver

                // If there is already one running, tell it to stop.
                stopLoaderLocked();
                mLoaderTask = new LoaderTask(mApp.getContext(), loadFlags);
                mLoaderTask = new LoaderTask(mApp.getContext(), loadFlags, synchronousBindPage);
                if (synchronousBindPage != PagedView.INVALID_RESTORE_PAGE
                        && mAllAppsLoaded && mWorkspaceLoaded && !mIsLoaderTaskRunning) {
                    mLoaderTask.runBindSynchronousPage(synchronousBindPage);
@@ -1367,14 +1363,17 @@ public class LauncherModel extends BroadcastReceiver
     */
    private class LoaderTask implements Runnable {
        private Context mContext;
        private int mPageToBindFirst;

        @Thunk boolean mIsLoadingAndBindingWorkspace;
        private boolean mStopped;
        @Thunk boolean mLoadAndBindStepFinished;
        private int mFlags;

        LoaderTask(Context context, int flags) {
        LoaderTask(Context context, int flags, int pageToBindFirst) {
            mContext = context;
            mFlags = flags;
            mPageToBindFirst = pageToBindFirst;
        }

        private void loadAndBindWorkspace() {
@@ -1396,7 +1395,7 @@ public class LauncherModel extends BroadcastReceiver
            }

            // Bind the workspace
            bindWorkspace(-1);
            bindWorkspace(mPageToBindFirst);
        }

        private void waitForIdle() {