diff options
author | Sunny Goyal <sunnygoyal@google.com> | 2015-12-18 22:38:52 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2015-12-18 22:38:52 +0000 |
commit | ffa123769807675869819037676717585d3fe647 (patch) | |
tree | 67063930054eb62c85452f90a1346ebc4656028d /src/com/android/launcher3 | |
parent | 60acb943c68e2f949fc8ad4703c9156549263897 (diff) | |
parent | d80439875557e8c94052e5b0f0327b656370b5fd (diff) | |
download | android_packages_apps_Trebuchet-ffa123769807675869819037676717585d3fe647.tar.gz android_packages_apps_Trebuchet-ffa123769807675869819037676717585d3fe647.tar.bz2 android_packages_apps_Trebuchet-ffa123769807675869819037676717585d3fe647.zip |
Merge "Using SharedPrefenrece.apply instead of commit to prevent disk IO on main thread" into ub-launcher3-burnaby-polish
Diffstat (limited to 'src/com/android/launcher3')
5 files changed, 11 insertions, 12 deletions
diff --git a/src/com/android/launcher3/InstallShortcutReceiver.java b/src/com/android/launcher3/InstallShortcutReceiver.java index 175bad1fd..46b9b7d78 100644 --- a/src/com/android/launcher3/InstallShortcutReceiver.java +++ b/src/com/android/launcher3/InstallShortcutReceiver.java @@ -82,7 +82,7 @@ public class InstallShortcutReceiver extends BroadcastReceiver { strings = new HashSet<String>(strings); } strings.add(encoded); - sharedPrefs.edit().putStringSet(APPS_PENDING_INSTALL, strings).commit(); + sharedPrefs.edit().putStringSet(APPS_PENDING_INSTALL, strings).apply(); } } } @@ -110,7 +110,7 @@ public class InstallShortcutReceiver extends BroadcastReceiver { newStringsIter.remove(); } } - sp.edit().putStringSet(APPS_PENDING_INSTALL, newStrings).commit(); + sp.edit().putStringSet(APPS_PENDING_INSTALL, newStrings).apply(); } } } @@ -131,7 +131,7 @@ public class InstallShortcutReceiver extends BroadcastReceiver { infos.add(info); } } - sharedPrefs.edit().putStringSet(APPS_PENDING_INSTALL, new HashSet<String>()).commit(); + sharedPrefs.edit().putStringSet(APPS_PENDING_INSTALL, new HashSet<String>()).apply(); return infos; } } diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java index d6760886b..0599eb8d9 100644 --- a/src/com/android/launcher3/Launcher.java +++ b/src/com/android/launcher3/Launcher.java @@ -3672,7 +3672,7 @@ public class Launcher extends Activity mSharedPrefs.edit() .putInt(QSB_WIDGET_ID, widgetId) .putString(QSB_WIDGET_PROVIDER, searchProvider.provider.flattenToString()) - .commit(); + .apply(); } mAppWidgetHost.setQsbWidgetId(widgetId); diff --git a/src/com/android/launcher3/LauncherBackupAgentHelper.java b/src/com/android/launcher3/LauncherBackupAgentHelper.java index 8eb4e6369..6619aafdb 100644 --- a/src/com/android/launcher3/LauncherBackupAgentHelper.java +++ b/src/com/android/launcher3/LauncherBackupAgentHelper.java @@ -30,7 +30,7 @@ import java.io.IOException; public class LauncherBackupAgentHelper extends BackupAgentHelper { - private static final String TAG = "LauncherBackupAgentHelper"; + private static final String TAG = "LauncherBAHelper"; private static final String LAUNCHER_DATA_PREFIX = "L"; @@ -91,7 +91,7 @@ public class LauncherBackupAgentHelper extends BackupAgentHelper { if (hasData && mHelper.restoreSuccessful) { LauncherAppState.getLauncherProvider().clearFlagEmptyDbCreated(); - LauncherClings.synchonouslyMarkFirstRunClingDismissed(this); + LauncherClings.markFirstRunClingDismissed(this); // Rank was added in v4. if (mHelper.restoredBackupVersion <= 3) { diff --git a/src/com/android/launcher3/LauncherClings.java b/src/com/android/launcher3/LauncherClings.java index 8f719e539..5c1e83036 100644 --- a/src/com/android/launcher3/LauncherClings.java +++ b/src/com/android/launcher3/LauncherClings.java @@ -251,9 +251,9 @@ class LauncherClings implements OnClickListener { !sharedPrefs.getBoolean(MIGRATION_CLING_DISMISSED_KEY, false); } - public static void synchonouslyMarkFirstRunClingDismissed(Context ctx) { - SharedPreferences.Editor editor = Utilities.getPrefs(ctx).edit(); - editor.putBoolean(WORKSPACE_CLING_DISMISSED_KEY, true); - editor.commit(); + public static void markFirstRunClingDismissed(Context ctx) { + Utilities.getPrefs(ctx).edit() + .putBoolean(WORKSPACE_CLING_DISMISSED_KEY, true) + .apply(); } } diff --git a/src/com/android/launcher3/LauncherProvider.java b/src/com/android/launcher3/LauncherProvider.java index 1390e67ad..7674d2acf 100644 --- a/src/com/android/launcher3/LauncherProvider.java +++ b/src/com/android/launcher3/LauncherProvider.java @@ -57,7 +57,6 @@ import com.android.launcher3.config.ProviderConfig; import com.android.launcher3.util.ManagedProfileHeuristic; import com.android.launcher3.util.Thunk; -import java.io.File; import java.net.URISyntaxException; import java.util.ArrayList; import java.util.Collections; @@ -686,7 +685,7 @@ public class LauncherProvider extends ContentProvider { // available (tablet users). Because one of the possible cling flows (migration) // is very destructive (wipes out workspaces), we want to prevent this from showing // until clear data. We do so by marking that the clings have been shown. - LauncherClings.synchonouslyMarkFirstRunClingDismissed(mContext); + LauncherClings.markFirstRunClingDismissed(mContext); } case 17: { // No-op |