fix: SettingsCache crashing due to unreadable keys

Signed-off-by: Pun Butrach <pun.butrach@gmail.com>
This commit is contained in:
Pun Butrach committed 2026-01-10 20:47:54 +07:00
1 parent 3aaf4ad0ed
commit 3962597e6e
2 files changed
+8 -1

No files matched your search

+1
View File
@@ -43,6 +43,7 @@ Compatibility list:
* Icon not responding to mouse cursor
* Rare NoSuchMethodError crash on IMS canImeRenderGesturalNavButtons
* [Lawnchair] Reimplement Bulk icons toggle
* SettingsCache crashing with SecurityException with unreadable keys (@hide) in Android 12 and newer (assume false)
#### Known Bugs
* Preview can't show device wallpaper -> (lIxkAYGg)
@@ -28,6 +28,7 @@ import android.os.Handler;
import android.os.Looper;
import android.provider.Settings;
import android.util.Log;
import androidx.annotation.UiThread;
import com.android.launcher3.dagger.ApplicationContext;
@@ -137,7 +138,12 @@ public class SettingsCache extends ContentObserver {
if (mKeyCache.containsKey(keySetting)) {
return mKeyCache.get(keySetting);
} else {
return updateValue(keySetting, defaultValue);
try {
return updateValue(keySetting, defaultValue);
} catch (SecurityException e) {
Log.d("LC_SettingsCache", "Key not readable, assume false for " + keySetting.toString());
return false;
}
}
}