Kepping the rotation setting UI always enabled and accessible

Bug: 77654352
Change-Id: Iade9ef33bc70fdbdac9ab39d6fa77113fb21549a
This commit is contained in:
Sunny Goyal 2018-04-20 12:00:17 -07:00
parent f589eebbec
commit c919a4fa94
3 changed files with 1 additions and 30 deletions

View File

@ -183,8 +183,6 @@
<string name="allow_rotation_title">Allow Home screen rotation</string>
<!-- Text explaining when the home screen will get rotated. [CHAR LIMIT=100] -->
<string name="allow_rotation_desc">When phone is rotated</string>
<!-- Text explaining that rotation is disabled in Display settings. 'Display' refers to the Display section in system settings [CHAR LIMIT=100] -->
<string name="allow_rotation_blocked_desc">Current Display setting doesn\'t permit rotation</string>
<!-- Title for Notification dots setting. Tapping this will link to the system Notifications settings screen where the user can turn off notification dots globally. [CHAR LIMIT=50] -->
<string name="icon_badging_title">Notification dots</string>
<!-- Text to indicate that the system icon badging setting is on [CHAR LIMIT=100] -->

View File

@ -39,6 +39,7 @@
<SwitchPreference
android:key="pref_allowRotation"
android:title="@string/allow_rotation_title"
android:summary="@string/allow_rotation_desc"
android:defaultValue="@bool/allow_rotation"
android:persistent="true" />

View File

@ -87,7 +87,6 @@ public class SettingsActivity extends Activity {
public static class LauncherSettingsFragment extends PreferenceFragment {
private IconBadgingObserver mIconBadgingObserver;
private RotationLockObserver mRotationLockObserver;
private String mPreferenceKey;
private boolean mPreferenceHighlighted = false;
@ -134,12 +133,6 @@ public class SettingsActivity extends Activity {
// Launcher supports rotation by default. No need to show this setting.
getPreferenceScreen().removePreference(rotationPref);
} else {
mRotationLockObserver = new RotationLockObserver(rotationPref, resolver);
// Register a content observer to listen for system setting changes while
// this UI is active.
mRotationLockObserver.register(Settings.System.ACCELEROMETER_ROTATION);
// Initialize the UI once
rotationPref.setDefaultValue(getAllowRotationDefaultValue());
}
@ -201,10 +194,6 @@ public class SettingsActivity extends Activity {
mIconBadgingObserver.unregister();
mIconBadgingObserver = null;
}
if (mRotationLockObserver != null) {
mRotationLockObserver.unregister();
mRotationLockObserver = null;
}
super.onDestroy();
}
@ -228,23 +217,6 @@ public class SettingsActivity extends Activity {
}
}
private static class RotationLockObserver extends SettingsObserver.System {
private final Preference mRotationPref;
public RotationLockObserver(Preference rotationPref, ContentResolver resolver) {
super(resolver);
mRotationPref = rotationPref;
}
@Override
public void onSettingChanged(boolean enabled) {
mRotationPref.setEnabled(enabled);
mRotationPref.setSummary(enabled
? R.string.allow_rotation_desc : R.string.allow_rotation_blocked_desc);
}
}
/**
* Content observer which listens for system badging setting changes,
* and updates the launcher badging setting subtext accordingly.