diff --git a/quickstep/res/xml/indexable_launcher_prefs.xml b/quickstep/res/xml/indexable_launcher_prefs.xml
index 2655402015..30f310021f 100644
--- a/quickstep/res/xml/indexable_launcher_prefs.xml
+++ b/quickstep/res/xml/indexable_launcher_prefs.xml
@@ -20,8 +20,14 @@
android:key="pref_add_icon_to_home"
android:title="@string/auto_add_shortcuts_label"
android:summary="@string/auto_add_shortcuts_description"
- android:defaultValue="true"
- />
+ android:defaultValue="true" />
+
+
Disabled by your admin
+
+ Allow Home screen rotation
+
+ When phone is rotated
+
+ Current Display setting doesn\'t permit rotation
Notification dots
diff --git a/res/xml/launcher_preferences.xml b/res/xml/launcher_preferences.xml
index 7bb19f3343..dde2c5c170 100644
--- a/res/xml/launcher_preferences.xml
+++ b/res/xml/launcher_preferences.xml
@@ -34,8 +34,13 @@
android:title="@string/auto_add_shortcuts_label"
android:summary="@string/auto_add_shortcuts_description"
android:defaultValue="true"
- android:persistent="true"
- />
+ android:persistent="true" />
+
+
= 600;
+ }
+ return false;
+ }
public static final int REQUEST_NONE = 0;
public static final int REQUEST_ROTATE = 1;
public static final int REQUEST_LOCK = 2;
private final Activity mActivity;
- private final ContentResolver mCr;
+ private final SharedPreferences mPrefs;
private final boolean mIgnoreAutoRotateSettings;
private boolean mAutoRotateEnabled;
@@ -60,23 +75,24 @@ public class RotationHelper extends ContentObserver {
private int mLastActivityFlags = -1;
public RotationHelper(Activity activity) {
- super(new Handler());
mActivity = activity;
// On large devices we do not handle auto-rotate differently.
mIgnoreAutoRotateSettings = mActivity.getResources().getBoolean(R.bool.allow_rotation);
if (!mIgnoreAutoRotateSettings) {
- mCr = mActivity.getContentResolver();
- mCr.registerContentObserver(getUriFor(ACCELEROMETER_ROTATION), false, this);
- mAutoRotateEnabled = Settings.System.getInt(mCr, ACCELEROMETER_ROTATION, 1) == 1;
+ mPrefs = Utilities.getPrefs(mActivity);
+ mPrefs.registerOnSharedPreferenceChangeListener(this);
+ mAutoRotateEnabled = mPrefs.getBoolean(ALLOW_ROTATION_PREFERENCE_KEY,
+ getAllowRotationDefaultValue());
} else {
- mCr = null;
+ mPrefs = null;
}
}
@Override
- public void onChange(boolean selfChange) {
- mAutoRotateEnabled = Settings.System.getInt(mCr, ACCELEROMETER_ROTATION, 1) == 1;
+ public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String s) {
+ mAutoRotateEnabled = mPrefs.getBoolean(ALLOW_ROTATION_PREFERENCE_KEY,
+ getAllowRotationDefaultValue());
notifyChange();
}
@@ -104,8 +120,8 @@ public class RotationHelper extends ContentObserver {
public void destroy() {
if (!mDestroyed) {
mDestroyed = true;
- if (mCr != null) {
- mCr.unregisterContentObserver(this);
+ if (mPrefs != null) {
+ mPrefs.unregisterOnSharedPreferenceChangeListener(this);
}
}
}
@@ -121,19 +137,17 @@ public class RotationHelper extends ContentObserver {
SCREEN_ORIENTATION_LOCKED : SCREEN_ORIENTATION_UNSPECIFIED;
} else if (mCurrentStateRequest == REQUEST_LOCK) {
activityFlags = SCREEN_ORIENTATION_LOCKED;
- } else if (mIgnoreAutoRotateSettings || mCurrentStateRequest == REQUEST_ROTATE) {
+ } else if (mIgnoreAutoRotateSettings || mCurrentStateRequest == REQUEST_ROTATE
+ || mAutoRotateEnabled) {
activityFlags = SCREEN_ORIENTATION_UNSPECIFIED;
- } else if (mAutoRotateEnabled) {
- // If auto rotation is on, lock to device orientation
- activityFlags = SCREEN_ORIENTATION_NOSENSOR;
} else {
// If auto rotation is off, allow rotation on the activity, in case the user is using
// forced rotation.
- activityFlags = SCREEN_ORIENTATION_UNSPECIFIED;
+ activityFlags = SCREEN_ORIENTATION_NOSENSOR;
}
if (activityFlags != mLastActivityFlags) {
mLastActivityFlags = activityFlags;
- mActivity.setRequestedOrientation(mLastActivityFlags);
+ mActivity.setRequestedOrientation(activityFlags);
}
}
}