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

Commit 6e830eb3 authored by Sunny Goyal's avatar Sunny Goyal Committed by Android (Google) Code Review
Browse files

Merge "Removing multi_process access to shared preferences" into ub-launcher3-master

parents 6f326e95 21bf5314
Loading
Loading
Loading
Loading
+5 −6
Original line number Diff line number Diff line
@@ -1159,11 +1159,10 @@ public class WallpaperPickerActivity extends WallpaperCropActivity {

    @Override
    public boolean enableRotation() {
        // Check if rotation is enabled for this device.
        if (Utilities.isRotationAllowedForDevice(getContext()))
            return true;

        // Check if the user has specifically enabled rotation via preferences.
        return Utilities.isAllowRotationPrefEnabled(getApplicationContext(), true);
        return super.enableRotation() ||
                getContentResolver().call(LauncherSettings.Settings.CONTENT_URI,
                        LauncherSettings.Settings.METHOD_GET_BOOLEAN,
                        Utilities.ALLOW_ROTATION_PREFERENCE_KEY, new Bundle())
                .getBoolean(LauncherSettings.Settings.EXTRA_VALUE);
    }
}
+1 −1
Original line number Diff line number Diff line
@@ -479,7 +479,7 @@ public class Launcher extends Activity
        // In case we are on a device with locked rotation, we should look at preferences to check
        // if the user has specifically allowed rotation.
        if (!mRotationEnabled) {
            mRotationEnabled = Utilities.isAllowRotationPrefEnabled(getApplicationContext(), false);
            mRotationEnabled = Utilities.isAllowRotationPrefEnabled(getApplicationContext());
        }

        // On large interfaces, or on devices that a user has specifically enabled screen rotation,
+2 −3
Original line number Diff line number Diff line
@@ -119,10 +119,9 @@ public final class Utilities {
        return Log.isLoggable(propertyName, Log.VERBOSE);
    }

    public static boolean isAllowRotationPrefEnabled(Context context, boolean multiProcess) {
    public static boolean isAllowRotationPrefEnabled(Context context) {
        SharedPreferences sharedPrefs = context.getSharedPreferences(
                LauncherAppState.getSharedPreferencesKey(), Context.MODE_PRIVATE | (multiProcess ?
                        Context.MODE_MULTI_PROCESS : 0));
                LauncherAppState.getSharedPreferencesKey(), Context.MODE_PRIVATE);
        boolean allowRotationPref = sharedPrefs.getBoolean(ALLOW_ROTATION_PREFERENCE_KEY, false);
        return sForceEnableRotation || allowRotationPref;
    }