Merge "Remove top padding only if illustration is present" into nyc-dev
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 5941aaf..3af57fe 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -2441,7 +2441,8 @@
<activity android:name="Settings$PaymentSettingsActivity"
android:label="@string/nfc_payment_settings_title"
android:icon="@drawable/ic_settings_nfc_payment"
- android:taskAffinity="">
+ android:taskAffinity=""
+ android:enabled="false">
<intent-filter android:priority="1">
<action android:name="android.settings.NFC_PAYMENT_SETTINGS" />
<category android:name="android.intent.category.DEFAULT" />
diff --git a/res/layout/bluetooth_device_picker.xml b/res/layout/bluetooth_device_picker.xml
index 16e421f..818ebac 100755
--- a/res/layout/bluetooth_device_picker.xml
+++ b/res/layout/bluetooth_device_picker.xml
@@ -16,7 +16,7 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:gravity="center"
- android:layout_width="wrap_content"
+ android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
diff --git a/res/values/strings.xml b/res/values/strings.xml
index ef2f18b..eaa6dc0 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -3432,6 +3432,10 @@
<!-- Manage applications, text for Move button when move is in progress -->
<string name="moving">Moving</string>
+ <!-- Text of pop up message if the request for a "migrate primary storage" operation
+ (see storage_menu_migrate) is denied as another is already in progress. [CHAR LIMIT=75] -->
+ <string name="another_migration_already_in_progress">Another migration is already in progress.</string>
+
<!-- Manage applications, text for move error messages -->
<string name="insufficient_storage">Not enough storage space.</string>
<string name="does_not_exist">App doesn\u2019t exist.</string>
@@ -7203,6 +7207,9 @@
<!-- Name of the setting to disable the automatic update -->
<string name="ota_disable_automatic_update">Automatic system updates</string>
+ <!-- Name of the setting to launch Location Dogfood Tools -->
+ <string name="location_dogfood_tools">Location Dogfood Tools</string>
+
<!-- Label for category for data usage [CHAR LIMIT=30] -->
<string name="usage">Usage</string>
diff --git a/res/xml/development_prefs.xml b/res/xml/development_prefs.xml
index 6d1a9fc..23fd80a 100644
--- a/res/xml/development_prefs.xml
+++ b/res/xml/development_prefs.xml
@@ -99,6 +99,13 @@
<intent android:action="com.android.settings.action.DEMO_MODE" />
</PreferenceScreen>
+ <!--TODO(b/28251942) Remove before ship -->
+ <PreferenceScreen
+ android:key="location_dogfood_tools"
+ android:title="@string/location_dogfood_tools">
+ <intent android:action="com.android.apps.location_dogfood.MAIN" />
+ </PreferenceScreen>
+
<PreferenceCategory android:key="debug_debugging_category"
android:title="@string/debug_debugging_category">
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/res/xml/tts_settings.xml b/res/xml/tts_settings.xml
index ab57649..a74431d 100644
--- a/res/xml/tts_settings.xml
+++ b/res/xml/tts_settings.xml
@@ -39,7 +39,7 @@
android:title="@string/tts_default_pitch_title"
android:summary="@string/tts_default_pitch_summary"
android:defaultValue="100"
- android:max="500"
+ android:max="400"
android:layout="@layout/preference_iconless_slider" />
<Preference android:key="reset_speech_rate"
diff --git a/src/com/android/settings/CustomListPreference.java b/src/com/android/settings/CustomListPreference.java
index 143c909..ae83013 100644
--- a/src/com/android/settings/CustomListPreference.java
+++ b/src/com/android/settings/CustomListPreference.java
@@ -24,7 +24,6 @@
import android.support.v14.preference.ListPreferenceDialogFragment;
import android.support.v7.preference.ListPreference;
import android.util.AttributeSet;
-import android.view.View;
public class CustomListPreference extends ListPreference {
@@ -51,8 +50,14 @@
return true;
}
+ protected void onDialogStateRestored(Dialog dialog, Bundle savedInstanceState) {
+ }
+
public static class CustomListPreferenceDialogFragment extends ListPreferenceDialogFragment {
+ private static final java.lang.String KEY_CLICKED_ENTRY_INDEX
+ = "settings.CustomListPrefDialog.KEY_CLICKED_ENTRY_INDEX";
+
private int mClickedDialogEntryIndex;
public static ListPreferenceDialogFragment newInstance(String key) {
@@ -88,10 +93,26 @@
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
Dialog dialog = super.onCreateDialog(savedInstanceState);
+ if (savedInstanceState != null) {
+ mClickedDialogEntryIndex = savedInstanceState.getInt(KEY_CLICKED_ENTRY_INDEX,
+ mClickedDialogEntryIndex);
+ }
getCustomizablePreference().onDialogCreated(dialog);
return dialog;
}
+ @Override
+ public void onSaveInstanceState(Bundle outState) {
+ super.onSaveInstanceState(outState);
+ outState.putInt(KEY_CLICKED_ENTRY_INDEX, mClickedDialogEntryIndex);
+ }
+
+ @Override
+ public void onActivityCreated(Bundle savedInstanceState) {
+ super.onActivityCreated(savedInstanceState);
+ getCustomizablePreference().onDialogStateRestored(getDialog(), savedInstanceState);
+ }
+
protected DialogInterface.OnClickListener getOnItemClickListener() {
return new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
diff --git a/src/com/android/settings/DevelopmentSettings.java b/src/com/android/settings/DevelopmentSettings.java
index 760e2b8..2b96dbe 100644
--- a/src/com/android/settings/DevelopmentSettings.java
+++ b/src/com/android/settings/DevelopmentSettings.java
@@ -205,6 +205,8 @@
private static final String OTA_DISABLE_AUTOMATIC_UPDATE_KEY = "ota_disable_automatic_update";
+ private static final String LOCATION_DOGFOOD_TOOLS_KEY = "location_dogfood_tools";
+
private static final int RESULT_DEBUG_APP = 1000;
private static final int RESULT_MOCK_LOCATION_APP = 1001;
@@ -247,6 +249,7 @@
private String mMockLocationApp;
private Preference mMockLocationAppPref;
+ private Preference mLocationDogfoodTools;
private SwitchPreference mWaitForDebugger;
private SwitchPreference mVerifyAppsOverUsb;
@@ -394,6 +397,9 @@
mMockLocationAppPref = findPreference(MOCK_LOCATION_APP_KEY);
mAllPrefs.add(mMockLocationAppPref);
+ mLocationDogfoodTools = findPreference(LOCATION_DOGFOOD_TOOLS_KEY);
+ mAllPrefs.add(mLocationDogfoodTools);
+
mVerifyAppsOverUsb = findAndInitSwitchPref(VERIFY_APPS_OVER_USB_KEY);
if (!showVerifierSetting()) {
if (debugDebuggingCategory != null) {
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/dashboard/SummaryLoader.java b/src/com/android/settings/dashboard/SummaryLoader.java
index 814d1e4..f23ad3f 100644
--- a/src/com/android/settings/dashboard/SummaryLoader.java
+++ b/src/com/android/settings/dashboard/SummaryLoader.java
@@ -51,6 +51,7 @@
private DashboardAdapter mAdapter;
private boolean mListening;
+ private boolean mWorkerListening;
private ArrayList<BroadcastReceiver> mReceivers = new ArrayList<>();
public SummaryLoader(Activity activity, List<DashboardCategory> categories) {
@@ -105,6 +106,7 @@
mActivity.unregisterReceiver(mReceivers.get(i));
}
mReceivers.clear();
+ mWorker.removeMessages(Worker.MSG_SET_LISTENING);
mWorker.obtainMessage(Worker.MSG_SET_LISTENING, listening ? 1 : 0, 0).sendToTarget();
}
@@ -164,6 +166,8 @@
}
private synchronized void setListeningW(boolean listening) {
+ if (mWorkerListening == listening) return;
+ mWorkerListening = listening;
if (DEBUG) Log.d(TAG, "Listening " + listening);
for (SummaryProvider p : mSummaryMap.keySet()) {
try {
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/deviceinfo/StorageWizardMigrateConfirm.java b/src/com/android/settings/deviceinfo/StorageWizardMigrateConfirm.java
index 3eae081..7b98dc2 100644
--- a/src/com/android/settings/deviceinfo/StorageWizardMigrateConfirm.java
+++ b/src/com/android/settings/deviceinfo/StorageWizardMigrateConfirm.java
@@ -19,11 +19,16 @@
import android.content.Intent;
import android.content.pm.PackageManager;
import android.os.Bundle;
+import android.os.storage.DiskInfo;
+import android.os.storage.StorageManager;
import android.os.storage.VolumeInfo;
import android.util.Log;
+import android.widget.Toast;
import com.android.settings.R;
+import java.util.Objects;
+
import static com.android.settings.deviceinfo.StorageSettings.TAG;
public class StorageWizardMigrateConfirm extends StorageWizardBase {
@@ -70,7 +75,31 @@
@Override
public void onNavigateNext() {
- final int moveId = getPackageManager().movePrimaryStorage(mVolume);
+ int moveId;
+
+ // We only expect exceptions from MountService#setPrimaryStorageUuid
+ try {
+ moveId = getPackageManager().movePrimaryStorage(mVolume);
+ } catch (IllegalArgumentException e) {
+ StorageManager sm = (StorageManager) getSystemService(STORAGE_SERVICE);
+
+ if (Objects.equals(mVolume.getFsUuid(), sm.getPrimaryStorageVolume().getUuid())) {
+ final Intent intent = new Intent(this, StorageWizardReady.class);
+ intent.putExtra(DiskInfo.EXTRA_DISK_ID, mDisk.getId());
+ startActivity(intent);
+ finishAffinity();
+
+ return;
+ } else {
+ throw e;
+ }
+ } catch (IllegalStateException e) {
+ Toast.makeText(this, getString(R.string.another_migration_already_in_progress),
+ Toast.LENGTH_LONG).show();
+ finishAffinity();
+
+ return;
+ }
final Intent intent = new Intent(this, StorageWizardMigrateProgress.class);
intent.putExtra(VolumeInfo.EXTRA_VOLUME_ID, mVolume.getId());
diff --git a/src/com/android/settings/deviceinfo/StorageWizardMigrateProgress.java b/src/com/android/settings/deviceinfo/StorageWizardMigrateProgress.java
index 163ff42..ade3bfa 100644
--- a/src/com/android/settings/deviceinfo/StorageWizardMigrateProgress.java
+++ b/src/com/android/settings/deviceinfo/StorageWizardMigrateProgress.java
@@ -76,9 +76,11 @@
finishIntent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY);
sendBroadcast(finishIntent);
- final Intent intent = new Intent(context, StorageWizardReady.class);
- intent.putExtra(DiskInfo.EXTRA_DISK_ID, mDisk.getId());
- startActivity(intent);
+ if (!StorageWizardMigrateProgress.this.isFinishing()) {
+ final Intent intent = new Intent(context, StorageWizardReady.class);
+ intent.putExtra(DiskInfo.EXTRA_DISK_ID, mDisk.getId());
+ startActivity(intent);
+ }
}
} else {
Toast.makeText(context, getString(R.string.insufficient_storage),
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/notification/NotificationLockscreenPreference.java b/src/com/android/settings/notification/NotificationLockscreenPreference.java
index 8c89968..fc61be3 100644
--- a/src/com/android/settings/notification/NotificationLockscreenPreference.java
+++ b/src/com/android/settings/notification/NotificationLockscreenPreference.java
@@ -24,6 +24,7 @@
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
+import android.os.Bundle;
import android.os.UserHandle;
import android.os.UserManager;
import android.provider.Settings;
@@ -37,7 +38,6 @@
public class NotificationLockscreenPreference extends RestrictedListPreference {
private boolean mAllowRemoteInput;
- private int mInitialIndex;
private Listener mListener;
private boolean mShowRemoteInput;
private boolean mRemoteInputCheckBoxEnabled = true;
@@ -69,10 +69,8 @@
protected void onPrepareDialogBuilder(AlertDialog.Builder builder,
DialogInterface.OnClickListener innerListener) {
- final String selectedValue = getValue();
- mInitialIndex = (selectedValue == null) ? -1 : findIndexOfValue(selectedValue);
mListener = new Listener(innerListener);
- builder.setSingleChoiceItems(createListAdapter(), mInitialIndex, mListener);
+ builder.setSingleChoiceItems(createListAdapter(), getSelectedValuePos(), mListener);
mShowRemoteInput = getEntryValues().length == 3;
mAllowRemoteInput = Settings.Secure.getInt(getContext().getContentResolver(),
Settings.Secure.LOCK_SCREEN_ALLOW_REMOTE_INPUT, 0) != 0;
@@ -86,8 +84,17 @@
CheckBox view = (CheckBox) dialog.findViewById(R.id.lockscreen_remote_input);
view.setChecked(!mAllowRemoteInput);
view.setOnCheckedChangeListener(mListener);
+ }
+
+ @Override
+ protected void onDialogStateRestored(Dialog dialog, Bundle savedInstanceState) {
+ super.onDialogStateRestored(dialog, savedInstanceState);
+ ListView listView = ((AlertDialog) dialog).getListView();
+ int selectedPosition = listView.getCheckedItemPosition();
+
View panel = dialog.findViewById(com.android.internal.R.id.customPanel);
- panel.setVisibility(checkboxVisibilityForSelectedIndex(mInitialIndex, mShowRemoteInput));
+ panel.setVisibility(checkboxVisibilityForSelectedIndex(selectedPosition,
+ mShowRemoteInput));
mListener.setView(panel);
}
diff --git a/src/com/android/settings/search/Index.java b/src/com/android/settings/search/Index.java
index 40d34bc..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;
@@ -140,7 +141,6 @@
IndexColumns.DATA_SUMMARY_OFF_NORMALIZED,
IndexColumns.DATA_ENTRIES
};
- private static final String INDEX = "index";
// Max number of saved search queries (who will be used for proposing suggestions)
private static long MAX_SAVED_SEARCH_QUERY = 64;
@@ -1195,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) {
- setLocaleIndexed(localeStr);
+ if (fullIndex) {
+ IndexDatabaseHelper.setLocaleIndexed(mContext, localeStr);
+ }
+ } catch (SQLiteFullException e) {
+ Log.e(LOG_TAG, "Unable to index search, out of space", e);
}
return null;
@@ -1233,7 +1237,7 @@
List<SearchIndexableData> dataToUpdate, Map<String, List<String>> nonIndexableKeys,
boolean forceUpdate) {
- if (!forceUpdate && isLocaleAlreadyIndexed(database, localeStr)) {
+ if (!forceUpdate && IndexDatabaseHelper.isLocaleAlreadyIndexed(mContext, localeStr)) {
Log.d(LOG_TAG, "Locale '" + localeStr + "' is already indexed");
return true;
}
@@ -1294,14 +1298,6 @@
return database.delete(Tables.TABLE_PREFS_INDEX, whereClause, whereArgs);
}
-
- private void setLocaleIndexed(String locale) {
- mContext.getSharedPreferences(INDEX, 0).edit().putBoolean(locale, true).commit();
- }
-
- private boolean isLocaleAlreadyIndexed(SQLiteDatabase database, String locale) {
- return mContext.getSharedPreferences(INDEX, 0).getBoolean(locale, false);
- }
}
/**
diff --git a/src/com/android/settings/search/IndexDatabaseHelper.java b/src/com/android/settings/search/IndexDatabaseHelper.java
index 152cbf3..cddee68 100644
--- a/src/com/android/settings/search/IndexDatabaseHelper.java
+++ b/src/com/android/settings/search/IndexDatabaseHelper.java
@@ -30,6 +30,8 @@
private static final String DATABASE_NAME = "search_index.db";
private static final int DATABASE_VERSION = 115;
+ private static final String INDEX = "index";
+
public interface Tables {
public static final String TABLE_PREFS_INDEX = "prefs_index";
public static final String TABLE_META_INDEX = "meta_index";
@@ -63,7 +65,7 @@
public static final String BUILD = "build";
}
- public interface SavedQueriesColums {
+ public interface SavedQueriesColums {
public static final String QUERY = "query";
public static final String TIME_STAMP = "timestamp";
}
@@ -133,6 +135,8 @@
private static IndexDatabaseHelper sSingleton;
+ private final Context mContext;
+
public static synchronized IndexDatabaseHelper getInstance(Context context) {
if (sSingleton == null) {
sSingleton = new IndexDatabaseHelper(context);
@@ -142,6 +146,7 @@
public IndexDatabaseHelper(Context context) {
super(context, DATABASE_NAME, null, DATABASE_VERSION);
+ mContext = context;
}
@Override
@@ -175,7 +180,7 @@
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
if (oldVersion < DATABASE_VERSION) {
- Log.w(TAG, "Detected schema version '" + oldVersion + "'. " +
+ Log.w(TAG, "Detected schema version '" + oldVersion + "'. " +
"Index needs to be rebuilt for schema version '" + newVersion + "'.");
// We need to drop the tables and recreate them
reconstruct(db);
@@ -184,7 +189,7 @@
@Override
public void onDowngrade(SQLiteDatabase db, int oldVersion, int newVersion) {
- Log.w(TAG, "Detected schema version '" + oldVersion + "'. " +
+ Log.w(TAG, "Detected schema version '" + oldVersion + "'. " +
"Index needs to be rebuilt for schema version '" + newVersion + "'.");
// We need to drop the tables and recreate them
reconstruct(db);
@@ -203,11 +208,9 @@
if (cursor.moveToFirst()) {
version = cursor.getString(0);
}
- }
- catch (Exception e) {
+ } catch (Exception e) {
Log.e(TAG, "Cannot get build version from Index metadata");
- }
- finally {
+ } finally {
if (cursor != null) {
cursor.close();
}
@@ -215,7 +218,20 @@
return version;
}
+ public static void clearLocalesIndexed(Context context) {
+ context.getSharedPreferences(INDEX, 0).edit().clear().commit();
+ }
+
+ public static void setLocaleIndexed(Context context, String locale) {
+ context.getSharedPreferences(INDEX, 0).edit().putBoolean(locale, true).commit();
+ }
+
+ public static boolean isLocaleAlreadyIndexed(Context context, String locale) {
+ return context.getSharedPreferences(INDEX, 0).getBoolean(locale, false);
+ }
+
private void dropTables(SQLiteDatabase db) {
+ clearLocalesIndexed(mContext);
db.execSQL("DROP TABLE IF EXISTS " + Tables.TABLE_META_INDEX);
db.execSQL("DROP TABLE IF EXISTS " + Tables.TABLE_PREFS_INDEX);
db.execSQL("DROP TABLE IF EXISTS " + Tables.TABLE_SAVED_QUERIES);
diff --git a/src/com/android/settings/users/UserSettings.java b/src/com/android/settings/users/UserSettings.java
index bf93cd3..dd24ea5 100644
--- a/src/com/android/settings/users/UserSettings.java
+++ b/src/com/android/settings/users/UserSettings.java
@@ -751,6 +751,9 @@
}
pref.setTitle(user.name);
}
+ if (pref == null) {
+ continue;
+ }
if (!isInitialized(user)) {
if (user.isRestricted()) {
pref.setSummary(R.string.user_summary_restricted_not_set_up);