diff options
Diffstat (limited to 'src/com/android/settings')
-rw-r--r-- | src/com/android/settings/AccessibilitySettings.java | 22 | ||||
-rw-r--r-- | src/com/android/settings/ChooseLockPassword.java | 6 | ||||
-rw-r--r-- | src/com/android/settings/InstalledAppDetails.java | 35 |
3 files changed, 58 insertions, 5 deletions
diff --git a/src/com/android/settings/AccessibilitySettings.java b/src/com/android/settings/AccessibilitySettings.java index 276a22f1a..b2debd207 100644 --- a/src/com/android/settings/AccessibilitySettings.java +++ b/src/com/android/settings/AccessibilitySettings.java @@ -105,6 +105,8 @@ public class AccessibilitySettings extends PreferenceActivity { if (!accessibilityServices.isEmpty()) { if (serviceState == 1) { mToggleCheckBox.setChecked(true); + } else { + setAccessibilityServicePreferencesState(false); } mToggleCheckBox.setEnabled(true); } else { @@ -127,6 +129,24 @@ public class AccessibilitySettings extends PreferenceActivity { persistEnabledAccessibilityServices(); } + /** + * Sets the state of the preferences for enabling/disabling + * AccessibilityServices. + * + * @param isEnabled If to enable or disable the preferences. + */ + private void setAccessibilityServicePreferencesState(boolean isEnabled) { + if (mAccessibilityServicesCategory == null) { + return; + } + + int count = mAccessibilityServicesCategory.getPreferenceCount(); + for (int i = 0; i < count; i++) { + Preference pref = mAccessibilityServicesCategory.getPreference(i); + pref.setEnabled(isEnabled); + } + } + @Override public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) { final String key = preference.getKey(); @@ -150,6 +170,7 @@ public class AccessibilitySettings extends PreferenceActivity { if (preference.isChecked()) { Settings.Secure.putInt(getContentResolver(), Settings.Secure.ACCESSIBILITY_ENABLED, 1); + setAccessibilityServicePreferencesState(true); } else { final CheckBoxPreference checkBoxPreference = preference; AlertDialog dialog = (new AlertDialog.Builder(this)) @@ -162,6 +183,7 @@ public class AccessibilitySettings extends PreferenceActivity { public void onClick(DialogInterface dialog, int which) { Settings.Secure.putInt(getContentResolver(), Settings.Secure.ACCESSIBILITY_ENABLED, 0); + setAccessibilityServicePreferencesState(false); } }) .setNegativeButton(android.R.string.cancel, diff --git a/src/com/android/settings/ChooseLockPassword.java b/src/com/android/settings/ChooseLockPassword.java index 3e3d84882..44acf95ec 100644 --- a/src/com/android/settings/ChooseLockPassword.java +++ b/src/com/android/settings/ChooseLockPassword.java @@ -54,7 +54,7 @@ public class ChooseLockPassword extends Activity implements OnClickListener, OnE private static final String KEY_UI_STAGE = "ui_stage"; private TextView mPasswordEntry; private int mPasswordMinLength = 4; - private int mPasswordMaxLength = 8; + private int mPasswordMaxLength = 16; private LockPatternUtils mLockPatternUtils; private int mRequestedMode = LockPatternUtils.MODE_PIN; private ChooseLockSettingsHelper mChooseLockSettingsHelper; @@ -109,8 +109,8 @@ public class ChooseLockPassword extends Activity implements OnClickListener, OnE super.onCreate(savedInstanceState); mLockPatternUtils = new LockPatternUtils(this); mRequestedMode = getIntent().getIntExtra(LockPatternUtils.PASSWORD_TYPE_KEY, mRequestedMode); - mPasswordMinLength = getIntent().getIntExtra("password_min_length", mPasswordMinLength); - mPasswordMaxLength = getIntent().getIntExtra("password_max_length", mPasswordMaxLength); + mPasswordMinLength = getIntent().getIntExtra(PASSWORD_MIN_KEY, mPasswordMinLength); + mPasswordMaxLength = getIntent().getIntExtra(PASSWORD_MAX_KEY, mPasswordMaxLength); int minMode = mLockPatternUtils.getRequestedPasswordMode(); if (mRequestedMode < minMode) { mRequestedMode = minMode; diff --git a/src/com/android/settings/InstalledAppDetails.java b/src/com/android/settings/InstalledAppDetails.java index a6c2c167a..5ddd1fde7 100644 --- a/src/com/android/settings/InstalledAppDetails.java +++ b/src/com/android/settings/InstalledAppDetails.java @@ -84,6 +84,7 @@ public class InstalledAppDetails extends Activity implements View.OnClickListene private Button mForceStopButton; private Button mClearDataButton; private Button mMoveAppButton; + private int mMoveErrorCode; PackageStats mSizeInfo; private PackageManager mPm; @@ -113,6 +114,7 @@ public class InstalledAppDetails extends Activity implements View.OnClickListene private static final int DLG_APP_NOT_FOUND = DLG_BASE + 3; private static final int DLG_CANNOT_CLEAR_DATA = DLG_BASE + 4; private static final int DLG_FORCE_STOP = DLG_BASE + 5; + private static final int DLG_MOVE_FAILED = DLG_BASE + 6; private Handler mHandler = new Handler() { public void handleMessage(Message msg) { @@ -188,6 +190,22 @@ public class InstalledAppDetails extends Activity implements View.OnClickListene initMoveButton(); } + private CharSequence getMoveErrMsg(int errCode) { + switch (errCode) { + case PackageManager.MOVE_FAILED_INSUFFICIENT_STORAGE: + return getString(R.string.insufficient_storage); + case PackageManager.MOVE_FAILED_DOESNT_EXIST: + return getString(R.string.does_not_exist); + case PackageManager.MOVE_FAILED_FORWARD_LOCKED: + return getString(R.string.app_forward_locked); + case PackageManager.MOVE_FAILED_INVALID_LOCATION: + return getString(R.string.invalid_location); + case PackageManager.MOVE_FAILED_SYSTEM_PACKAGE: + return getString(R.string.system_package); + } + return null; + } + private void initMoveButton() { String pkgName = mAppInfo.packageName; boolean dataOnly = false; @@ -465,14 +483,18 @@ public class InstalledAppDetails extends Activity implements View.OnClickListene mAppInfo = mPm.getApplicationInfo(packageName, PackageManager.GET_UNINSTALLED_PACKAGES); initMoveButton(); + // Refresh size info + mPm.getPackageSizeInfo(mAppInfo.packageName, mSizeObserver); } catch (NameNotFoundException e) { // TODO error handling } } else { - // TODO Present a dialog indicating failure. + initMoveButton(); + mMoveErrorCode = result; + showDialogInner(DLG_MOVE_FAILED); } } - + /* * Private method to initiate clearing user data when the user clicks the clear data * button for a system package @@ -573,6 +595,15 @@ public class InstalledAppDetails extends Activity implements View.OnClickListene }) .setNegativeButton(R.string.dlg_cancel, null) .create(); + case DLG_MOVE_FAILED: + CharSequence msg = getString(R.string.move_app_failed_dlg_text, + getMoveErrMsg(mMoveErrorCode)); + return new AlertDialog.Builder(this) + .setTitle(getString(R.string.move_app_failed_dlg_title)) + .setIcon(android.R.drawable.ic_dialog_alert) + .setMessage(msg) + .setNeutralButton(R.string.dlg_ok, null) + .create(); } return null; } |