summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSvetoslav Ganov <svetoslavganov@google.com>2012-09-12 21:40:55 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2012-09-12 21:40:55 -0700
commit27d91832235a061cf57a78643a4d34feda7c0070 (patch)
tree5a7e447c8326fecfeacb42cb31d273617db5120d
parent3e451fa128e5b7beb22b413eb5600d6c980e5a29 (diff)
parent818d20459099ea75e9b8d27c341af482653847a1 (diff)
downloadframeworks_base-27d91832235a061cf57a78643a4d34feda7c0070.zip
frameworks_base-27d91832235a061cf57a78643a4d34feda7c0070.tar.gz
frameworks_base-27d91832235a061cf57a78643a4d34feda7c0070.tar.bz2
Merge "Core accessibility settings should not be cleared on restore." into jb-mr1-dev
-rw-r--r--packages/SettingsProvider/src/com/android/providers/settings/SettingsHelper.java32
1 files changed, 21 insertions, 11 deletions
diff --git a/packages/SettingsProvider/src/com/android/providers/settings/SettingsHelper.java b/packages/SettingsProvider/src/com/android/providers/settings/SettingsHelper.java
index 9208cae..621e662 100644
--- a/packages/SettingsProvider/src/com/android/providers/settings/SettingsHelper.java
+++ b/packages/SettingsProvider/src/com/android/providers/settings/SettingsHelper.java
@@ -20,11 +20,8 @@ import java.util.Locale;
import android.app.ActivityManagerNative;
import android.app.IActivityManager;
-import android.app.backup.BackupDataInput;
import android.app.backup.IBackupManager;
-import android.content.ContentResolver;
import android.content.Context;
-import android.content.IContentService;
import android.content.res.Configuration;
import android.location.LocationManager;
import android.media.AudioManager;
@@ -33,23 +30,15 @@ import android.os.RemoteException;
import android.os.ServiceManager;
import android.provider.Settings;
import android.text.TextUtils;
-import android.util.Log;
public class SettingsHelper {
- private static final String TAG = "SettingsHelper";
-
private Context mContext;
private AudioManager mAudioManager;
- private IContentService mContentService;
- private IPowerManager mPowerManager;
public SettingsHelper(Context context) {
mContext = context;
mAudioManager = (AudioManager) context
.getSystemService(Context.AUDIO_SERVICE);
- mContentService = ContentResolver.getContentService();
- mPowerManager = IPowerManager.Stub.asInterface(
- ServiceManager.getService("power"));
}
/**
@@ -71,10 +60,31 @@ public class SettingsHelper {
return false;
} else if (Settings.Secure.BACKUP_AUTO_RESTORE.equals(name)) {
setAutoRestore(Integer.parseInt(value) == 1);
+ } else if (isAlreadyConfiguredCriticalAccessibilitySetting(name)) {
+ return false;
}
return true;
}
+ private boolean isAlreadyConfiguredCriticalAccessibilitySetting(String name) {
+ // These are the critical accessibility settings that are required for a
+ // blind user to be able to interact with the device. If these settings are
+ // already configured, we will not overwrite them. If they are already set,
+ // it means that the user has performed a global gesture to enable accessibility
+ // and definitely needs these features working after the restore.
+ if (Settings.Secure.ACCESSIBILITY_ENABLED.equals(name)
+ || Settings.Secure.ACCESSIBILITY_SCRIPT_INJECTION.equals(name)
+ || Settings.Secure.ACCESSIBILITY_SPEAK_PASSWORD.equals(name)
+ || Settings.Secure.TOUCH_EXPLORATION_ENABLED.equals(name)) {
+ return Settings.Secure.getInt(mContext.getContentResolver(), name, 0) != 0;
+ } else if (Settings.Secure.TOUCH_EXPLORATION_GRANTED_ACCESSIBILITY_SERVICES.equals(name)
+ || Settings.Secure.ENABLED_ACCESSIBILITY_SERVICES.equals(name)) {
+ return !TextUtils.isEmpty(Settings.Secure.getString(
+ mContext.getContentResolver(), name));
+ }
+ return false;
+ }
+
private void setAutoRestore(boolean enabled) {
try {
IBackupManager bm = IBackupManager.Stub.asInterface(