Merge "Properly handle rotation in NotificationLockscreenPreference" into nyc-dev
diff --git a/res/xml/security_settings_password_sub.xml b/res/xml/security_settings_password_sub.xml
index 4e591b8..25d00bc 100644
--- a/res/xml/security_settings_password_sub.xml
+++ b/res/xml/security_settings_password_sub.xml
@@ -35,10 +35,5 @@
android:title="@string/owner_info_settings_title"
android:summary="@string/owner_info_settings_summary"/>
- <SwitchPreference
- android:key="require_cred_before_startup"
- android:title="@string/lockpattern_settings_require_cred_before_startup"
- android:summary="@string/lockpattern_settings_require_password_before_startup_summary"/>
-
</PreferenceScreen>
diff --git a/res/xml/security_settings_pattern_sub.xml b/res/xml/security_settings_pattern_sub.xml
index 1a16572..dcc1b64 100644
--- a/res/xml/security_settings_pattern_sub.xml
+++ b/res/xml/security_settings_pattern_sub.xml
@@ -39,10 +39,5 @@
android:title="@string/owner_info_settings_title"
android:summary="@string/owner_info_settings_summary"/>
- <SwitchPreference
- android:key="require_cred_before_startup"
- android:title="@string/lockpattern_settings_require_cred_before_startup"
- android:summary="@string/lockpattern_settings_require_pattern_before_startup_summary"/>
-
</PreferenceScreen>
diff --git a/res/xml/security_settings_pin_sub.xml b/res/xml/security_settings_pin_sub.xml
index b69fc55..25d00bc 100644
--- a/res/xml/security_settings_pin_sub.xml
+++ b/res/xml/security_settings_pin_sub.xml
@@ -35,10 +35,5 @@
android:title="@string/owner_info_settings_title"
android:summary="@string/owner_info_settings_summary"/>
- <SwitchPreference
- android:key="require_cred_before_startup"
- android:title="@string/lockpattern_settings_require_cred_before_startup"
- android:summary="@string/lockpattern_settings_require_pin_before_startup_summary"/>
-
</PreferenceScreen>
diff --git a/src/com/android/settings/SecuritySettings.java b/src/com/android/settings/SecuritySettings.java
index 30c6ab4..72dacd5 100644
--- a/src/com/android/settings/SecuritySettings.java
+++ b/src/com/android/settings/SecuritySettings.java
@@ -986,10 +986,6 @@
keys.add(KEY_MANAGE_TRUST_AGENTS);
}
- if (!SecuritySubSettings.canChangeRequireCredentialBeforeStartup(context)) {
- keys.add(SecuritySubSettings.KEY_REQUIRE_CRED_BEFORE_STARTUP);
- }
-
return keys;
}
}
@@ -1001,13 +997,10 @@
private static final String KEY_LOCK_AFTER_TIMEOUT = "lock_after_timeout";
private static final String KEY_OWNER_INFO_SETTINGS = "owner_info_settings";
private static final String KEY_POWER_INSTANTLY_LOCKS = "power_button_instantly_locks";
- private static final String KEY_REQUIRE_CRED_BEFORE_STARTUP = "require_cred_before_startup";
-
- public static final int REQUEST_CHANGE_REQUIRE_CRED_FOR_START = 2;
// These switch preferences need special handling since they're not all stored in Settings.
private static final String SWITCH_PREFERENCE_KEYS[] = { KEY_LOCK_AFTER_TIMEOUT,
- KEY_VISIBLE_PATTERN, KEY_POWER_INSTANTLY_LOCKS, KEY_REQUIRE_CRED_BEFORE_STARTUP };
+ KEY_VISIBLE_PATTERN, KEY_POWER_INSTANTLY_LOCKS };
private TimeoutListPreference mLockAfter;
private SwitchPreference mVisiblePattern;
@@ -1110,29 +1103,12 @@
}
}
- Preference requireCredForStartup = findPreference(KEY_REQUIRE_CRED_BEFORE_STARTUP);
- if (requireCredForStartup instanceof SwitchPreference) {
- ((SwitchPreference) requireCredForStartup).setChecked(
- mLockPatternUtils.isCredentialRequiredToDecrypt(false));
- if (!canChangeRequireCredentialBeforeStartup(getContext())) {
- removePreference(KEY_REQUIRE_CRED_BEFORE_STARTUP);
- }
- }
-
for (int i = 0; i < SWITCH_PREFERENCE_KEYS.length; i++) {
final Preference pref = findPreference(SWITCH_PREFERENCE_KEYS[i]);
if (pref != null) pref.setOnPreferenceChangeListener(this);
}
}
- static boolean canChangeRequireCredentialBeforeStartup(Context context) {
- DevicePolicyManager dpm = context.getSystemService(DevicePolicyManager.class);
- return UserManager.get(context).isAdminUser()
- && UserManager.get(context).isPrimaryUser()
- && StorageManager.isBlockEncrypted()
- && !dpm.getDoNotAskCredentialsOnBoot();
- }
-
private void setupLockAfterPreference() {
// Compatible with pre-Froyo
long currentTimeout = Settings.Secure.getLong(getContentResolver(),
@@ -1240,15 +1216,6 @@
updateLockAfterPreferenceSummary();
} else if (KEY_VISIBLE_PATTERN.equals(key)) {
mLockPatternUtils.setVisiblePatternEnabled((Boolean) value, MY_USER_ID);
- } else if (KEY_REQUIRE_CRED_BEFORE_STARTUP.equals(key)) {
- Bundle extras = new Bundle();
- extras.putBoolean(
- ChooseLockSettingsHelper.EXTRA_KEY_FOR_CHANGE_CRED_REQUIRED_FOR_BOOT, true);
- startFragment(this,
- "com.android.settings.ChooseLockGeneric$ChooseLockGenericFragment",
- R.string.lock_settings_picker_title, REQUEST_CHANGE_REQUIRE_CRED_FOR_START,
- extras);
- return false;
}
return true;
}
diff --git a/src/com/android/settings/datausage/AppDataUsage.java b/src/com/android/settings/datausage/AppDataUsage.java
index 0bd0615..0e44a9d 100644
--- a/src/com/android/settings/datausage/AppDataUsage.java
+++ b/src/com/android/settings/datausage/AppDataUsage.java
@@ -29,6 +29,7 @@
import android.net.TrafficStats;
import android.os.AsyncTask;
import android.os.Bundle;
+import android.os.Process;
import android.os.RemoteException;
import android.os.UserHandle;
import android.os.UserManager;
@@ -140,7 +141,7 @@
mCycle = (SpinnerPreference) findPreference(KEY_CYCLE);
mCycleAdapter = new CycleAdapter(getContext(), mCycle, mCycleListener, false);
- if (UserHandle.isApp(mAppItem.key)) {
+ if (UserHandle.isApp(mAppItem.key) || mAppItem.key == Process.SYSTEM_UID) {
if (mPackages.size() != 0) {
PackageManager pm = getPackageManager();
try {
diff --git a/src/com/android/settings/deviceinfo/StorageSettings.java b/src/com/android/settings/deviceinfo/StorageSettings.java
index 902ca07..5ae3986 100644
--- a/src/com/android/settings/deviceinfo/StorageSettings.java
+++ b/src/com/android/settings/deviceinfo/StorageSettings.java
@@ -45,12 +45,14 @@
import com.android.internal.logging.MetricsProto.MetricsEvent;
import com.android.settings.R;
import com.android.settings.SettingsPreferenceFragment;
+import com.android.settings.Utils;
import com.android.settings.dashboard.SummaryLoader;
import com.android.settings.search.BaseSearchIndexProvider;
import com.android.settings.search.Indexable;
import com.android.settings.search.SearchIndexableRaw;
import com.android.settingslib.RestrictedLockUtils;
+import com.android.settingslib.drawer.SettingsDrawerActivity;
import java.io.File;
import java.util.ArrayList;
@@ -222,8 +224,11 @@
// Only showing primary internal storage, so just shortcut
final Bundle args = new Bundle();
args.putString(VolumeInfo.EXTRA_VOLUME_ID, VolumeInfo.ID_PRIVATE_INTERNAL);
- startFragment(this, PrivateVolumeSettings.class.getCanonicalName(),
- -1, 0, args);
+ Intent intent = Utils.onBuildStartFragmentIntent(getActivity(),
+ PrivateVolumeSettings.class.getName(), args, null, R.string.apps_storage, null,
+ false);
+ intent.putExtra(SettingsDrawerActivity.EXTRA_SHOW_MENU, true);
+ getActivity().startActivity(intent);
finish();
}
}
diff --git a/src/com/android/settings/localepicker/LocaleDragAndDropAdapter.java b/src/com/android/settings/localepicker/LocaleDragAndDropAdapter.java
index bc17814..f130150 100644
--- a/src/com/android/settings/localepicker/LocaleDragAndDropAdapter.java
+++ b/src/com/android/settings/localepicker/LocaleDragAndDropAdapter.java
@@ -197,6 +197,8 @@
notifyItemChanged(fromPosition); // to update the numbers
notifyItemChanged(toPosition);
notifyItemMoved(fromPosition, toPosition);
+ // We don't call doTheUpdate() here because this method is called for each item swap.
+ // So if we drag something across several positions it will be called several times.
}
void setRemoveMode(boolean removeMode) {
@@ -222,7 +224,6 @@
}
mFeedItemList.remove(position);
notifyDataSetChanged();
- doTheUpdate();
}
void removeChecked() {
diff --git a/src/com/android/settings/localepicker/LocaleLinearLayoutManager.java b/src/com/android/settings/localepicker/LocaleLinearLayoutManager.java
index 630f382..2917cc7 100644
--- a/src/com/android/settings/localepicker/LocaleLinearLayoutManager.java
+++ b/src/com/android/settings/localepicker/LocaleLinearLayoutManager.java
@@ -114,40 +114,46 @@
final int itemCount = this.getItemCount();
final int position = this.getPosition(host);
+ boolean result = false;
switch (action) {
case R.id.action_drag_move_up:
if (position > 0) {
mAdapter.onItemMove(position, position - 1);
- return true;
+ result = true;
}
- return false;
+ break;
case R.id.action_drag_move_down:
if (position + 1 < itemCount) {
mAdapter.onItemMove(position, position + 1);
- return true;
+ result = true;
}
- return false;
+ break;
case R.id.action_drag_move_top:
if (position != 0) {
mAdapter.onItemMove(position, 0);
- return true;
+ result = true;
}
- return false;
+ break;
case R.id.action_drag_move_bottom:
if (position != itemCount - 1) {
mAdapter.onItemMove(position, itemCount - 1);
- return true;
+ result = true;
}
- return false;
+ break;
case R.id.action_drag_remove:
if (itemCount > 1) {
mAdapter.removeItem(position);
- return true;
+ result = true;
}
- return false;
+ break;
default:
return super.performAccessibilityActionForItem(recycler, state, host, action, args);
}
+
+ if (result) {
+ mAdapter.doTheUpdate();
+ }
+ return result;
}
}
diff --git a/src/com/android/settings/search/Index.java b/src/com/android/settings/search/Index.java
index d4fc6f8..fd67ea6 100644
--- a/src/com/android/settings/search/Index.java
+++ b/src/com/android/settings/search/Index.java
@@ -31,6 +31,7 @@
import android.database.MergeCursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteException;
+import android.database.sqlite.SQLiteFullException;
import android.net.Uri;
import android.os.AsyncTask;
import android.provider.SearchIndexableData;
@@ -1194,35 +1195,39 @@
@Override
protected Void doInBackground(UpdateData... params) {
- final List<SearchIndexableData> dataToUpdate = params[0].dataToUpdate;
- final List<SearchIndexableData> dataToDelete = params[0].dataToDelete;
- final Map<String, List<String>> nonIndexableKeys = params[0].nonIndexableKeys;
-
- final boolean forceUpdate = params[0].forceUpdate;
- final boolean fullIndex = params[0].fullIndex;
-
- final SQLiteDatabase database = getWritableDatabase();
- if (database == null) {
- Log.e(LOG_TAG, "Cannot update Index as I cannot get a writable database");
- return null;
- }
- final String localeStr = Locale.getDefault().toString();
-
try {
- database.beginTransaction();
- if (dataToDelete.size() > 0) {
- processDataToDelete(database, localeStr, dataToDelete);
+ final List<SearchIndexableData> dataToUpdate = params[0].dataToUpdate;
+ final List<SearchIndexableData> dataToDelete = params[0].dataToDelete;
+ final Map<String, List<String>> nonIndexableKeys = params[0].nonIndexableKeys;
+
+ final boolean forceUpdate = params[0].forceUpdate;
+ final boolean fullIndex = params[0].fullIndex;
+
+ final SQLiteDatabase database = getWritableDatabase();
+ if (database == null) {
+ Log.e(LOG_TAG, "Cannot update Index as I cannot get a writable database");
+ return null;
}
- if (dataToUpdate.size() > 0) {
- processDataToUpdate(database, localeStr, dataToUpdate, nonIndexableKeys,
- forceUpdate);
+ final String localeStr = Locale.getDefault().toString();
+
+ try {
+ database.beginTransaction();
+ if (dataToDelete.size() > 0) {
+ processDataToDelete(database, localeStr, dataToDelete);
+ }
+ if (dataToUpdate.size() > 0) {
+ processDataToUpdate(database, localeStr, dataToUpdate, nonIndexableKeys,
+ forceUpdate);
+ }
+ database.setTransactionSuccessful();
+ } finally {
+ database.endTransaction();
}
- database.setTransactionSuccessful();
- } finally {
- database.endTransaction();
- }
- if (fullIndex) {
- IndexDatabaseHelper.setLocaleIndexed(mContext, localeStr);
+ if (fullIndex) {
+ IndexDatabaseHelper.setLocaleIndexed(mContext, localeStr);
+ }
+ } catch (SQLiteFullException e) {
+ Log.e(LOG_TAG, "Unable to index search, out of space", e);
}
return null;