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

Commit e863fed1 authored by Rahul Chaturvedi's avatar Rahul Chaturvedi
Browse files

Read rotation setting correctly from the wallpaper picker.

If reading the rotation setting without the multi-process flag, the
WallpaperPickerActivity usually picks up a cached value. Specifying the
multi-process flag during the read fixes this and the wallpaper picker
always has the correct rotation setting.

Change-Id: Ic3639f8cd694674e92c8940b753c6bc30486076d
parent 931a2ce8
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1147,6 +1147,6 @@ public class WallpaperPickerActivity extends WallpaperCropActivity {
            return true;

        // Check if the user has specifically enabled rotation via preferences.
        return Utilities.isAllowRotationPrefEnabled(getApplicationContext());
        return Utilities.isAllowRotationPrefEnabled(getApplicationContext(), true);
    }
}
+1 −1
Original line number Diff line number Diff line
@@ -515,7 +515,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());
            mRotationEnabled = Utilities.isAllowRotationPrefEnabled(getApplicationContext(), false);
        }

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

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