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

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

Merge "Preventing unnecessary options update to QSB provider by checking if...

Merge "Preventing unnecessary options update to QSB provider by checking if the options have changed before calling update" into ub-launcher3-calgary
parents ddb77003 3f732190
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -3552,7 +3552,12 @@ public class Launcher extends Activity
            if (widgetId != -1) {
                mQsb = mAppWidgetHost.createView(this, widgetId, searchProvider);
                mQsb.setId(R.id.qsb_widget);
                if (!Utilities.containsAll(
                        AppWidgetManager.getInstance(this).getAppWidgetOptions(widgetId), opts)) {
                    // Launcher should not be updating the options often.
                    FileLog.d(TAG, "Options for QSB were not same");
                    mQsb.updateAppWidgetOptions(opts);
                }
                mQsb.setPadding(0, 0, 0, 0);
                mSearchDropTargetBar.addView(mQsb);
                mSearchDropTargetBar.setQsbSearchBar(mQsb);
+20 −0
Original line number Diff line number Diff line
@@ -868,6 +868,26 @@ public final class Utilities {
        }
    }

    /**
     * Returns true if {@param original} contains all entries defined in {@param updates} and
     * have the same value.
     * The comparison uses {@link Object#equals(Object)} to compare the values.
     */
    public static boolean containsAll(Bundle original, Bundle updates) {
        for (String key : updates.keySet()) {
            Object value1 = updates.get(key);
            Object value2 = original.get(key);
            if (value1 == null) {
                if (value2 != null) {
                    return false;
                }
            } else if (!value1.equals(value2)) {
                return false;
            }
        }
        return true;
    }

    /**
     * An extension of {@link BitmapDrawable} which returns the bitmap pixel size as intrinsic size.
     * This allows the badging to be done based on the action bitmap size rather than