Merge "Cancelling launcher reload on mcc change" into ub-launcher3-burnaby

This commit is contained in:
Sunny Goyal 2015-06-18 22:09:39 +00:00 committed by Android (Google) Code Review
commit e91a14c698
3 changed files with 4 additions and 26 deletions

View File

@ -219,7 +219,7 @@ public class IconCache {
// Remove all active icon update tasks.
mWorkerHandler.removeCallbacksAndMessages(ICON_UPDATE_TOKEN);
mIconDb.updateSystemStateString(mContext);
mIconDb.updateSystemStateString();
for (UserHandleCompat user : mUserManager.getUserProfiles()) {
// Query for the set of apps
final List<LauncherActivityInfoCompat> apps = mLauncherApps.getActivityList(null, user);
@ -756,15 +756,13 @@ public class IconCache {
public IconDB(Context context) {
super(context, LauncherFiles.APP_ICONS_DB, null, DB_VERSION);
updateSystemStateString(context);
updateSystemStateString();
}
public void updateSystemStateString(Context c) {
mSystemState = Locale.getDefault().toString() + ","
+ c.getResources().getConfiguration().mcc;
public void updateSystemStateString() {
mSystemState = Locale.getDefault().toString();
}
@Override
public void onCreate(SQLiteDatabase db) {
db.execSQL("CREATE TABLE IF NOT EXISTS " + TABLE_NAME + " (" +

View File

@ -95,7 +95,6 @@ public class LauncherAppState {
// Register intent receivers
IntentFilter filter = new IntentFilter();
filter.addAction(Intent.ACTION_LOCALE_CHANGED);
filter.addAction(Intent.ACTION_CONFIGURATION_CHANGED);
filter.addAction(SearchManager.INTENT_GLOBAL_SEARCH_ACTIVITY_CHANGED);
filter.addAction(SearchManager.INTENT_ACTION_SEARCHABLES_CHANGED);
// For handling managed profiles

View File

@ -30,8 +30,6 @@ import android.content.IntentFilter;
import android.content.pm.PackageManager;
import android.content.pm.ProviderInfo;
import android.content.pm.ResolveInfo;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.database.Cursor;
import android.graphics.Bitmap;
import android.net.Uri;
@ -177,8 +175,6 @@ public class LauncherModel extends BroadcastReceiver
@Thunk IconCache mIconCache;
protected int mPreviousConfigMcc;
@Thunk final LauncherAppsCompat mLauncherApps;
@Thunk final UserManagerCompat mUserManager;
@ -243,9 +239,6 @@ public class LauncherModel extends BroadcastReceiver
mBgWidgetsModel = new WidgetsModel(context, iconCache, appFilter);
mIconCache = iconCache;
final Resources res = context.getResources();
Configuration config = res.getConfiguration();
mPreviousConfigMcc = config.mcc;
mLauncherApps = LauncherAppsCompat.getInstance(context);
mUserManager = UserManagerCompat.getInstance(context);
}
@ -1286,18 +1279,6 @@ public class LauncherModel extends BroadcastReceiver
if (Intent.ACTION_LOCALE_CHANGED.equals(action)) {
// If we have changed locale we need to clear out the labels in all apps/workspace.
forceReload();
} else if (Intent.ACTION_CONFIGURATION_CHANGED.equals(action)) {
// Check if configuration change was an mcc/mnc change which would affect app resources
// and we would need to clear out the labels in all apps/workspace. Same handling as
// above for ACTION_LOCALE_CHANGED
Configuration currentConfig = context.getResources().getConfiguration();
if (mPreviousConfigMcc != currentConfig.mcc) {
Log.d(TAG, "Reload apps on config change. curr_mcc:"
+ currentConfig.mcc + " prevmcc:" + mPreviousConfigMcc);
forceReload();
}
// Update previousConfig
mPreviousConfigMcc = currentConfig.mcc;
} else if (SearchManager.INTENT_GLOBAL_SEARCH_ACTIVITY_CHANGED.equals(action) ||
SearchManager.INTENT_ACTION_SEARCHABLES_CHANGED.equals(action)) {
Callbacks callbacks = getCallback();