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

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

Merge "Encoding the locale list in systemState so that icons and labels are...

Merge "Encoding the locale list in systemState so that icons and labels are updated properly" into ub-launcher3-master
parents 0ea5006c ae2129e6
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -118,8 +118,7 @@ public class IconCache {
        mIconDpi = inv.fillResIconDpi;
        mIconDb = new IconDB(context, inv.iconBitmapSize);

        mIconProvider = Utilities.getOverrideObject(
                IconProvider.class, context, R.string.icon_provider_class);
        mIconProvider = IconProvider.newInstance(context);
        mWorkerHandler = new Handler(LauncherModel.getWorkerLooper());

        mLowResOptions = new BitmapFactory.Options();
@@ -254,7 +253,7 @@ public class IconCache {
        // Remove all active icon update tasks.
        mWorkerHandler.removeCallbacksAndMessages(ICON_UPDATE_TOKEN);

        mIconProvider.updateSystemStateString();
        mIconProvider.updateSystemStateString(mContext);
        for (UserHandle user : mUserManager.getUserProfiles()) {
            // Query for the set of apps
            final List<LauncherActivityInfo> apps = mLauncherApps.getActivityList(null, user);
+17 −7
Original line number Diff line number Diff line
package com.android.launcher3;

import android.content.Context;
import android.content.pm.LauncherActivityInfo;
import android.graphics.drawable.Drawable;
import android.os.Build;
@@ -8,17 +9,26 @@ import java.util.Locale;

public class IconProvider {

    private static final boolean DBG = false;
    private static final String TAG = "IconProvider";

    protected String mSystemState;

    public IconProvider() {
        updateSystemStateString();
    public static IconProvider newInstance(Context context) {
        IconProvider provider = Utilities.getOverrideObject(
                IconProvider.class, context, R.string.icon_provider_class);
        provider.updateSystemStateString(context);
        return provider;
    }

    public IconProvider() { }

    public void updateSystemStateString(Context context) {
        final String locale;
        if (Utilities.ATLEAST_NOUGAT) {
            locale = context.getResources().getConfiguration().getLocales().toLanguageTags();
        } else {
            locale = Locale.getDefault().toString();
        }

    public void updateSystemStateString() {
        mSystemState = Locale.getDefault().toString() + "," + Build.VERSION.SDK_INT;
        mSystemState = locale + "," + Build.VERSION.SDK_INT;
    }

    public String getIconSystemState(String packageName) {