diff options
author | Svetoslav Ganov <svetoslavganov@google.com> | 2012-05-29 17:36:48 -0700 |
---|---|---|
committer | Svetoslav Ganov <svetoslavganov@google.com> | 2012-05-29 17:36:51 -0700 |
commit | 3aa58b0f35c60f7bf4c97a6e12c201abf90824c7 (patch) | |
tree | 202269c5f84621d4ba2d32e8584ad129775d59ba /src | |
parent | 6e9e519560a50d735ea3c2ddd01d9b7a9cc1d89b (diff) | |
download | packages_apps_settings-3aa58b0f35c60f7bf4c97a6e12c201abf90824c7.zip packages_apps_settings-3aa58b0f35c60f7bf4c97a6e12c201abf90824c7.tar.gz packages_apps_settings-3aa58b0f35c60f7bf4c97a6e12c201abf90824c7.tar.bz2 |
Lock screen rotation accessibility preference not updated.
1. If the lock screen rotation preference is changed from the
status bar the checkbox in the accessibility settings was
not updated.
bug:6562028
Change-Id: I353e3ad59374ad207297d2a6682e50ed07df820c
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/settings/AccessibilitySettings.java | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/com/android/settings/AccessibilitySettings.java b/src/com/android/settings/AccessibilitySettings.java index 7647d01..d2bfc0d 100644 --- a/src/com/android/settings/AccessibilitySettings.java +++ b/src/com/android/settings/AccessibilitySettings.java @@ -30,6 +30,7 @@ import android.content.SharedPreferences; import android.content.pm.ResolveInfo; import android.content.pm.ServiceInfo; import android.content.res.Configuration; +import android.database.ContentObserver; import android.net.Uri; import android.os.Bundle; import android.os.Handler; @@ -44,6 +45,7 @@ import android.preference.PreferenceActivity; import android.preference.PreferenceCategory; import android.preference.PreferenceScreen; import android.provider.Settings; +import android.provider.Settings.SettingNotFoundException; import android.text.TextUtils; import android.text.TextUtils.SimpleStringSplitter; import android.util.Log; @@ -149,6 +151,25 @@ public class AccessibilitySettings extends SettingsPreferenceFragment implements } }; + private final Uri mLockScreenRotationUri = Uri.withAppendedPath(Settings.System.CONTENT_URI, + Settings.System.ACCELEROMETER_ROTATION); + + private final ContentObserver mSettingsContentObserver = new ContentObserver(mHandler) { + @Override + public void onChange(boolean selfChange, Uri uri) { + if (mLockScreenRotationUri.equals(uri)) { + try { + final boolean lockRotationEnabled = (Settings.System.getInt( + getActivity().getContentResolver(), + Settings.System.ACCELEROMETER_ROTATION) == 0); + mToggleLockScreenRotationPreference.setChecked(lockRotationEnabled); + } catch (SettingNotFoundException e) { + /* ignore */ + } + } + } + }; + // Preference controls. private PreferenceCategory mServicesCategory; private PreferenceCategory mSystemsCategory; @@ -179,11 +200,14 @@ public class AccessibilitySettings extends SettingsPreferenceFragment implements offerInstallAccessibilitySerivceOnce(); } mSettingsPackageMonitor.register(getActivity(), getActivity().getMainLooper(), false); + getActivity().getContentResolver().registerContentObserver(mLockScreenRotationUri, false, + mSettingsContentObserver); } @Override public void onPause() { mSettingsPackageMonitor.unregister(); + getContentResolver().unregisterContentObserver(mSettingsContentObserver); super.onPause(); } |