mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-19 02:38:20 +00:00
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_HEIGHT_KEY);
|
||||
}
|
||||
editor.commit();
|
||||
editor.apply();
|
||||
WallpaperUtils.suggestWallpaperDimension(getResources(),
|
||||
sp, getWindowManager(), WallpaperManager.getInstance(getContext()), true);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user