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

Commit b6cd62cd authored by Hyunyoung Song's avatar Hyunyoung Song Committed by Android (Google) Code Review
Browse files

Merge "update widgets model when package is updated" into ub-launcher3-burnaby

parents e9a33cef 227239e7
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -79,7 +79,8 @@ public class LauncherAppWidgetHost extends AppWidgetHost {
    }

    protected void onProvidersChanged() {
        mLauncher.getModel().loadAndBindWidgetsAndShortcuts(mLauncher, mLauncher);
        mLauncher.getModel().loadAndBindWidgetsAndShortcuts(mLauncher, mLauncher,
                true /* refresh */);
        if (!mProviderChangeListeners.isEmpty()) {
            for (Runnable callback : new ArrayList<>(mProviderChangeListeners)) {
                callback.run();
+8 −6
Original line number Diff line number Diff line
@@ -2867,7 +2867,7 @@ public class LauncherModel extends BroadcastReceiver
                    final Callbacks callbacks = tryGetCallbacks(oldCallbacks);
                    if (callbacks != null) {
                        callbacks.bindAllApplications(added);
                        loadAndBindWidgetsAndShortcuts(mContext,callbacks);
                        loadAndBindWidgetsAndShortcuts(mContext, callbacks, true /* refresh */);
                        if (DEBUG_LOADERS) {
                            Log.d(TAG, "bound " + added.size() + " apps in "
                                + (SystemClock.uptimeMillis() - bindTime) + "ms");
@@ -3228,9 +3228,10 @@ public class LauncherModel extends BroadcastReceiver
                    }
                });
            }
            if (Build.VERSION.SDK_INT < 17) {
                loadAndBindWidgetsAndShortcuts(context, callbacks);
            }

            // onProvidersChanged method (API >= 17) already refreshed the widget list
            loadAndBindWidgetsAndShortcuts(context, callbacks, Build.VERSION.SDK_INT < 17);

            // Write all the logs to disk
            mHandler.post(new Runnable() {
                public void run() {
@@ -3279,11 +3280,12 @@ public class LauncherModel extends BroadcastReceiver
        }
    }

    public void loadAndBindWidgetsAndShortcuts(final Context context, final Callbacks callbacks) {
    public void loadAndBindWidgetsAndShortcuts(final Context context, final Callbacks callbacks,
            final boolean refresh) {
        runOnWorkerThread(new Runnable(){
            @Override
            public void run() {
                final ArrayList<Object> list = getWidgetsAndShortcuts(context, true /* refresh */);
                final ArrayList<Object> list = getWidgetsAndShortcuts(context, refresh);
                mHandler.post(new Runnable() {
                    @Override
                    public void run() {