Loading src/com/android/launcher3/Utilities.java +5 −0 Original line number Diff line number Diff line Loading @@ -551,6 +551,11 @@ public final class Utilities { LauncherFiles.SHARED_PREFERENCES_KEY, Context.MODE_PRIVATE); } public static SharedPreferences getDevicePrefs(Context context) { return context.getSharedPreferences( LauncherFiles.DEVICE_PREFERENCES_KEY, Context.MODE_PRIVATE); } public static boolean isPowerSaverOn(Context context) { PowerManager powerManager = (PowerManager) context.getSystemService(Context.POWER_SERVICE); return powerManager.isPowerSaveMode(); Loading src/com/android/launcher3/compat/WallpaperManagerCompatVL.java +4 −9 Original line number Diff line number Diff line Loading @@ -17,6 +17,8 @@ package com.android.launcher3.compat; import static android.app.WallpaperManager.FLAG_SYSTEM; import static com.android.launcher3.Utilities.getDevicePrefs; import android.app.IntentService; import android.app.WallpaperInfo; import android.app.WallpaperManager; Loading @@ -24,7 +26,6 @@ import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.content.SharedPreferences; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.BitmapRegionDecoder; Loading @@ -41,7 +42,6 @@ import android.util.Log; import android.util.Pair; import android.util.SparseIntArray; import com.android.launcher3.LauncherFiles; import com.android.launcher3.Utilities; import java.io.IOException; Loading @@ -63,7 +63,7 @@ public class WallpaperManagerCompatVL extends WallpaperManagerCompat { WallpaperManagerCompatVL(Context context) { mContext = context; String colors = prefs(mContext).getString(KEY_COLORS, ""); String colors = getDevicePrefs(mContext).getString(KEY_COLORS, ""); int wallpaperId = -1; if (colors.startsWith(VERSION_PREFIX)) { Pair<Integer, WallpaperColorsCompat> storedValue = parseValue(colors); Loading Loading @@ -106,18 +106,13 @@ public class WallpaperManagerCompatVL extends WallpaperManagerCompat { } private void handleResult(String result) { prefs(mContext).edit().putString(KEY_COLORS, result).apply(); getDevicePrefs(mContext).edit().putString(KEY_COLORS, result).apply(); mColorsCompat = parseValue(result).second; for (OnColorsChangedListenerCompat listener : mListeners) { listener.onColorsChanged(mColorsCompat, FLAG_SYSTEM); } } private static SharedPreferences prefs(Context context) { return context.getSharedPreferences( LauncherFiles.DEVICE_PREFERENCES_KEY, Context.MODE_PRIVATE); } private static final int getWallpaperId(Context context) { if (!Utilities.ATLEAST_NOUGAT) { return -1; Loading src/com/android/launcher3/graphics/IconShapeOverride.java +5 −9 Original line number Diff line number Diff line Loading @@ -15,13 +15,14 @@ */ package com.android.launcher3.graphics; import static com.android.launcher3.Utilities.getDevicePrefs; import android.annotation.TargetApi; import android.app.AlarmManager; import android.app.PendingIntent; import android.app.ProgressDialog; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.content.res.Resources; import android.os.Build; import android.os.SystemClock; Loading @@ -34,7 +35,6 @@ import android.text.TextUtils; import android.util.Log; import com.android.launcher3.LauncherAppState; import com.android.launcher3.LauncherFiles; import com.android.launcher3.LauncherModel; import com.android.launcher3.R; import com.android.launcher3.Utilities; Loading Loading @@ -101,7 +101,7 @@ public class IconShapeOverride { } catch (Exception e) { Log.e(TAG, "Unable to override icon shape", e); // revert value. prefs(context).edit().remove(KEY_PREFERENCE).apply(); getDevicePrefs(context).edit().remove(KEY_PREFERENCE).apply(); } } Loading @@ -116,11 +116,7 @@ public class IconShapeOverride { } private static String getAppliedValue(Context context) { return prefs(context).getString(KEY_PREFERENCE, ""); } private static SharedPreferences prefs(Context context) { return context.getSharedPreferences(LauncherFiles.DEVICE_PREFERENCES_KEY, 0); return getDevicePrefs(context).getString(KEY_PREFERENCE, ""); } public static void handlePreferenceUi(ListPreference preference) { Loading Loading @@ -189,7 +185,7 @@ public class IconShapeOverride { @Override public void run() { // Synchronously write the preference. prefs(mContext).edit().putString(KEY_PREFERENCE, mValue).commit(); getDevicePrefs(mContext).edit().putString(KEY_PREFERENCE, mValue).commit(); // Clear the icon cache. LauncherAppState.getInstance(mContext).getIconCache().clear(); Loading src/com/android/launcher3/provider/ImportDataTask.java +2 −5 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ package com.android.launcher3.provider; import static com.android.launcher3.Utilities.getDevicePrefs; import android.content.ContentProviderOperation; import android.content.ContentValues; import android.content.Context; Loading @@ -36,7 +38,6 @@ import com.android.launcher3.AutoInstallsLayout.LayoutParserCallback; import com.android.launcher3.DefaultLayoutParser; import com.android.launcher3.LauncherAppState; import com.android.launcher3.LauncherAppWidgetInfo; import com.android.launcher3.LauncherFiles; import com.android.launcher3.LauncherProvider; import com.android.launcher3.LauncherSettings; import com.android.launcher3.LauncherSettings.Favorites; Loading Loading @@ -377,10 +378,6 @@ public class ImportDataTask { return false; } private static SharedPreferences getDevicePrefs(Context c) { return c.getSharedPreferences(LauncherFiles.DEVICE_PREFERENCES_KEY, Context.MODE_PRIVATE); } private static final int getMyHotseatLayoutId(Context context) { return LauncherAppState.getIDP(context).numHotseatIcons <= 5 ? R.xml.dw_phone_hotseat Loading Loading
src/com/android/launcher3/Utilities.java +5 −0 Original line number Diff line number Diff line Loading @@ -551,6 +551,11 @@ public final class Utilities { LauncherFiles.SHARED_PREFERENCES_KEY, Context.MODE_PRIVATE); } public static SharedPreferences getDevicePrefs(Context context) { return context.getSharedPreferences( LauncherFiles.DEVICE_PREFERENCES_KEY, Context.MODE_PRIVATE); } public static boolean isPowerSaverOn(Context context) { PowerManager powerManager = (PowerManager) context.getSystemService(Context.POWER_SERVICE); return powerManager.isPowerSaveMode(); Loading
src/com/android/launcher3/compat/WallpaperManagerCompatVL.java +4 −9 Original line number Diff line number Diff line Loading @@ -17,6 +17,8 @@ package com.android.launcher3.compat; import static android.app.WallpaperManager.FLAG_SYSTEM; import static com.android.launcher3.Utilities.getDevicePrefs; import android.app.IntentService; import android.app.WallpaperInfo; import android.app.WallpaperManager; Loading @@ -24,7 +26,6 @@ import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.content.SharedPreferences; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.BitmapRegionDecoder; Loading @@ -41,7 +42,6 @@ import android.util.Log; import android.util.Pair; import android.util.SparseIntArray; import com.android.launcher3.LauncherFiles; import com.android.launcher3.Utilities; import java.io.IOException; Loading @@ -63,7 +63,7 @@ public class WallpaperManagerCompatVL extends WallpaperManagerCompat { WallpaperManagerCompatVL(Context context) { mContext = context; String colors = prefs(mContext).getString(KEY_COLORS, ""); String colors = getDevicePrefs(mContext).getString(KEY_COLORS, ""); int wallpaperId = -1; if (colors.startsWith(VERSION_PREFIX)) { Pair<Integer, WallpaperColorsCompat> storedValue = parseValue(colors); Loading Loading @@ -106,18 +106,13 @@ public class WallpaperManagerCompatVL extends WallpaperManagerCompat { } private void handleResult(String result) { prefs(mContext).edit().putString(KEY_COLORS, result).apply(); getDevicePrefs(mContext).edit().putString(KEY_COLORS, result).apply(); mColorsCompat = parseValue(result).second; for (OnColorsChangedListenerCompat listener : mListeners) { listener.onColorsChanged(mColorsCompat, FLAG_SYSTEM); } } private static SharedPreferences prefs(Context context) { return context.getSharedPreferences( LauncherFiles.DEVICE_PREFERENCES_KEY, Context.MODE_PRIVATE); } private static final int getWallpaperId(Context context) { if (!Utilities.ATLEAST_NOUGAT) { return -1; Loading
src/com/android/launcher3/graphics/IconShapeOverride.java +5 −9 Original line number Diff line number Diff line Loading @@ -15,13 +15,14 @@ */ package com.android.launcher3.graphics; import static com.android.launcher3.Utilities.getDevicePrefs; import android.annotation.TargetApi; import android.app.AlarmManager; import android.app.PendingIntent; import android.app.ProgressDialog; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.content.res.Resources; import android.os.Build; import android.os.SystemClock; Loading @@ -34,7 +35,6 @@ import android.text.TextUtils; import android.util.Log; import com.android.launcher3.LauncherAppState; import com.android.launcher3.LauncherFiles; import com.android.launcher3.LauncherModel; import com.android.launcher3.R; import com.android.launcher3.Utilities; Loading Loading @@ -101,7 +101,7 @@ public class IconShapeOverride { } catch (Exception e) { Log.e(TAG, "Unable to override icon shape", e); // revert value. prefs(context).edit().remove(KEY_PREFERENCE).apply(); getDevicePrefs(context).edit().remove(KEY_PREFERENCE).apply(); } } Loading @@ -116,11 +116,7 @@ public class IconShapeOverride { } private static String getAppliedValue(Context context) { return prefs(context).getString(KEY_PREFERENCE, ""); } private static SharedPreferences prefs(Context context) { return context.getSharedPreferences(LauncherFiles.DEVICE_PREFERENCES_KEY, 0); return getDevicePrefs(context).getString(KEY_PREFERENCE, ""); } public static void handlePreferenceUi(ListPreference preference) { Loading Loading @@ -189,7 +185,7 @@ public class IconShapeOverride { @Override public void run() { // Synchronously write the preference. prefs(mContext).edit().putString(KEY_PREFERENCE, mValue).commit(); getDevicePrefs(mContext).edit().putString(KEY_PREFERENCE, mValue).commit(); // Clear the icon cache. LauncherAppState.getInstance(mContext).getIconCache().clear(); Loading
src/com/android/launcher3/provider/ImportDataTask.java +2 −5 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ package com.android.launcher3.provider; import static com.android.launcher3.Utilities.getDevicePrefs; import android.content.ContentProviderOperation; import android.content.ContentValues; import android.content.Context; Loading @@ -36,7 +38,6 @@ import com.android.launcher3.AutoInstallsLayout.LayoutParserCallback; import com.android.launcher3.DefaultLayoutParser; import com.android.launcher3.LauncherAppState; import com.android.launcher3.LauncherAppWidgetInfo; import com.android.launcher3.LauncherFiles; import com.android.launcher3.LauncherProvider; import com.android.launcher3.LauncherSettings; import com.android.launcher3.LauncherSettings.Favorites; Loading Loading @@ -377,10 +378,6 @@ public class ImportDataTask { return false; } private static SharedPreferences getDevicePrefs(Context c) { return c.getSharedPreferences(LauncherFiles.DEVICE_PREFERENCES_KEY, Context.MODE_PRIVATE); } private static final int getMyHotseatLayoutId(Context context) { return LauncherAppState.getIDP(context).numHotseatIcons <= 5 ? R.xml.dw_phone_hotseat Loading