Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 132eb7da authored by Jeff Sharkey's avatar Jeff Sharkey
Browse files

Suppress SharedPreferences check for buggy apps.

Test: ¯\_(ツ)_/¯
Bug: 36500886
Change-Id: I2f42711977f43631ac492dfeef8e5969aa56002a
parent 20f0d091
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -61,6 +61,7 @@ import android.os.Looper;
import android.os.Process;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.SystemProperties;
import android.os.Trace;
import android.os.UserHandle;
import android.os.UserManager;
@@ -363,12 +364,19 @@ class ContextImpl extends Context {
        return getSharedPreferences(file, mode);
    }

    private boolean isBuggy() {
        // STOPSHIP: fix buggy apps
        if (SystemProperties.getBoolean("fw.ignore_buggy", false)) return false;
        if ("com.google.android.tts".equals(getApplicationInfo().packageName)) return true;
        return false;
    }

    @Override
    public SharedPreferences getSharedPreferences(File file, int mode) {
        checkMode(mode);
        if (getApplicationInfo().targetSdkVersion >= android.os.Build.VERSION_CODES.O) {
            if (isCredentialProtectedStorage()
                    && !getSystemService(UserManager.class).isUserUnlocked()) {
                    && !getSystemService(UserManager.class).isUserUnlocked() && !isBuggy()) {
                throw new IllegalStateException("SharedPreferences in credential encrypted "
                        + "storage are not available until after user is unlocked");
            }