Merge "Remove Auto-rotate screen setting if a required feature is missing."

This commit is contained in:
Svetoslav
2013-05-29 22:09:17 +00:00
committed by Android (Google) Code Review
2 changed files with 15 additions and 6 deletions

View File

@@ -200,16 +200,20 @@ public class AccessibilitySettings extends SettingsPreferenceFragment implements
mSettingsPackageMonitor.register(getActivity(), getActivity().getMainLooper(), false);
mSettingsContentObserver.register(getContentResolver());
RotationPolicy.registerRotationPolicyListener(getActivity(),
mRotationPolicyListener);
if (RotationPolicy.isRotationSupported(getActivity())) {
RotationPolicy.registerRotationPolicyListener(getActivity(),
mRotationPolicyListener);
}
}
@Override
public void onPause() {
mSettingsPackageMonitor.unregister();
RotationPolicy.unregisterRotationPolicyListener(getActivity(),
mRotationPolicyListener);
mSettingsContentObserver.unregister(getContentResolver());
if (RotationPolicy.isRotationSupported(getActivity())) {
RotationPolicy.unregisterRotationPolicyListener(getActivity(),
mRotationPolicyListener);
}
super.onPause();
}
@@ -320,6 +324,9 @@ public class AccessibilitySettings extends SettingsPreferenceFragment implements
// Lock screen rotation.
mToggleLockScreenRotationPreference =
(CheckBoxPreference) findPreference(TOGGLE_LOCK_SCREEN_ROTATION_PREFERENCE);
if (!RotationPolicy.isRotationSupported(getActivity())) {
mSystemsCategory.removePreference(mToggleLockScreenRotationPreference);
}
// Speak passwords.
mToggleSpeakPasswordPreference =

View File

@@ -95,9 +95,11 @@ public class DisplaySettings extends SettingsPreferenceFragment implements
mAccelerometer = (CheckBoxPreference) findPreference(KEY_ACCELEROMETER);
mAccelerometer.setPersistent(false);
if (RotationPolicy.isRotationLockToggleSupported(getActivity())) {
if (!RotationPolicy.isRotationSupported(getActivity())
|| RotationPolicy.isRotationLockToggleSupported(getActivity())) {
// If rotation lock is supported, then we do not provide this option in
// Display settings. However, is still available in Accessibility settings.
// Display settings. However, is still available in Accessibility settings,
// if the device supports rotation.
getPreferenceScreen().removePreference(mAccelerometer);
}