Merge "Using SharedPrefenrece.apply instead of commit to prevent disk IO on main thread" into ub-launcher3-burnaby-polish
This commit is contained in:
@@ -471,7 +471,7 @@ public class WallpaperCropActivity extends BaseActivity implements Handler.Callb
|
|||||||
editor.remove(WALLPAPER_WIDTH_KEY);
|
editor.remove(WALLPAPER_WIDTH_KEY);
|
||||||
editor.remove(WALLPAPER_HEIGHT_KEY);
|
editor.remove(WALLPAPER_HEIGHT_KEY);
|
||||||
}
|
}
|
||||||
editor.commit();
|
editor.apply();
|
||||||
WallpaperUtils.suggestWallpaperDimension(getResources(),
|
WallpaperUtils.suggestWallpaperDimension(getResources(),
|
||||||
sp, getWindowManager(), WallpaperManager.getInstance(getContext()), true);
|
sp, getWindowManager(), WallpaperManager.getInstance(getContext()), true);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ public class InstallShortcutReceiver extends BroadcastReceiver {
|
|||||||
strings = new HashSet<String>(strings);
|
strings = new HashSet<String>(strings);
|
||||||
}
|
}
|
||||||
strings.add(encoded);
|
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();
|
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);
|
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;
|
return infos;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3672,7 +3672,7 @@ public class Launcher extends Activity
|
|||||||
mSharedPrefs.edit()
|
mSharedPrefs.edit()
|
||||||
.putInt(QSB_WIDGET_ID, widgetId)
|
.putInt(QSB_WIDGET_ID, widgetId)
|
||||||
.putString(QSB_WIDGET_PROVIDER, searchProvider.provider.flattenToString())
|
.putString(QSB_WIDGET_PROVIDER, searchProvider.provider.flattenToString())
|
||||||
.commit();
|
.apply();
|
||||||
}
|
}
|
||||||
|
|
||||||
mAppWidgetHost.setQsbWidgetId(widgetId);
|
mAppWidgetHost.setQsbWidgetId(widgetId);
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ import java.io.IOException;
|
|||||||
|
|
||||||
public class LauncherBackupAgentHelper extends BackupAgentHelper {
|
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";
|
private static final String LAUNCHER_DATA_PREFIX = "L";
|
||||||
|
|
||||||
@@ -91,7 +91,7 @@ public class LauncherBackupAgentHelper extends BackupAgentHelper {
|
|||||||
|
|
||||||
if (hasData && mHelper.restoreSuccessful) {
|
if (hasData && mHelper.restoreSuccessful) {
|
||||||
LauncherAppState.getLauncherProvider().clearFlagEmptyDbCreated();
|
LauncherAppState.getLauncherProvider().clearFlagEmptyDbCreated();
|
||||||
LauncherClings.synchonouslyMarkFirstRunClingDismissed(this);
|
LauncherClings.markFirstRunClingDismissed(this);
|
||||||
|
|
||||||
// Rank was added in v4.
|
// Rank was added in v4.
|
||||||
if (mHelper.restoredBackupVersion <= 3) {
|
if (mHelper.restoredBackupVersion <= 3) {
|
||||||
|
|||||||
@@ -251,9 +251,9 @@ class LauncherClings implements OnClickListener {
|
|||||||
!sharedPrefs.getBoolean(MIGRATION_CLING_DISMISSED_KEY, false);
|
!sharedPrefs.getBoolean(MIGRATION_CLING_DISMISSED_KEY, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void synchonouslyMarkFirstRunClingDismissed(Context ctx) {
|
public static void markFirstRunClingDismissed(Context ctx) {
|
||||||
SharedPreferences.Editor editor = Utilities.getPrefs(ctx).edit();
|
Utilities.getPrefs(ctx).edit()
|
||||||
editor.putBoolean(WORKSPACE_CLING_DISMISSED_KEY, true);
|
.putBoolean(WORKSPACE_CLING_DISMISSED_KEY, true)
|
||||||
editor.commit();
|
.apply();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -57,7 +57,6 @@ import com.android.launcher3.config.ProviderConfig;
|
|||||||
import com.android.launcher3.util.ManagedProfileHeuristic;
|
import com.android.launcher3.util.ManagedProfileHeuristic;
|
||||||
import com.android.launcher3.util.Thunk;
|
import com.android.launcher3.util.Thunk;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.net.URISyntaxException;
|
import java.net.URISyntaxException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
@@ -686,7 +685,7 @@ public class LauncherProvider extends ContentProvider {
|
|||||||
// available (tablet users). Because one of the possible cling flows (migration)
|
// available (tablet users). Because one of the possible cling flows (migration)
|
||||||
// is very destructive (wipes out workspaces), we want to prevent this from showing
|
// 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.
|
// until clear data. We do so by marking that the clings have been shown.
|
||||||
LauncherClings.synchonouslyMarkFirstRunClingDismissed(mContext);
|
LauncherClings.markFirstRunClingDismissed(mContext);
|
||||||
}
|
}
|
||||||
case 17: {
|
case 17: {
|
||||||
// No-op
|
// No-op
|
||||||
|
|||||||
Reference in New Issue
Block a user