mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-27 23:36:47 +00:00
Fix ToggleableGlobalSettingsFlag on user builds
TogglableFlags are not initalized if !IS_DEBUG_DEVICE. Thus, trying to read from the ContentProvider produces a NPE. Also make ENABLE_TASK_STABILIZER global again now that this fix is in place. Bug: 123429711 Change-Id: I252e9b3ef4e802e769865f13b14487a36b8e1f82
This commit is contained in:
@@ -17,13 +17,16 @@
|
||||
package com.android.launcher3.config;
|
||||
|
||||
import static androidx.core.util.Preconditions.checkNotNull;
|
||||
|
||||
import android.content.ContentResolver;
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.provider.Settings;
|
||||
|
||||
import androidx.annotation.GuardedBy;
|
||||
import androidx.annotation.Keep;
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
|
||||
import com.android.launcher3.Utilities;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -95,8 +98,9 @@ abstract class BaseFlags {
|
||||
public static final TogglableFlag APPLY_CONFIG_AT_RUNTIME = new TogglableFlag(
|
||||
"APPLY_CONFIG_AT_RUNTIME", true, "Apply display changes dynamically");
|
||||
|
||||
public static final TogglableFlag ENABLE_TASK_STABILIZER = new TogglableFlag(
|
||||
"ENABLE_TASK_STABILIZER", false, "Stable task list across fast task switches");
|
||||
public static final ToggleableGlobalSettingsFlag ENABLE_TASK_STABILIZER
|
||||
= new ToggleableGlobalSettingsFlag("ENABLE_TASK_STABILIZER", false,
|
||||
"Stable task list across fast task switches");
|
||||
|
||||
public static final TogglableFlag QUICKSTEP_SPRINGS = new TogglableFlag("QUICKSTEP_SPRINGS",
|
||||
false, "Enable springs for quickstep animations");
|
||||
@@ -249,11 +253,17 @@ abstract class BaseFlags {
|
||||
|
||||
@Override
|
||||
void updateStorage(Context context, boolean value) {
|
||||
if (contentResolver == null) {
|
||||
return;
|
||||
}
|
||||
Settings.Global.putInt(contentResolver, getKey(), value ? 1 : 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
boolean getFromStorage(Context context, boolean defaultValue) {
|
||||
if (contentResolver == null) {
|
||||
return defaultValue;
|
||||
}
|
||||
return Settings.Global.getInt(contentResolver, getKey(), defaultValue ? 1 : 0) == 1;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user