diff options
author | Fabrice Di Meglio <fdimeglio@google.com> | 2014-04-09 12:09:42 -0700 |
---|---|---|
committer | Fabrice Di Meglio <fdimeglio@google.com> | 2014-04-09 12:09:42 -0700 |
commit | 7d39310c8d159190cfcc63aa6647714c056d76f6 (patch) | |
tree | 5e6a8fef186c30d513adf6d43f9e85573701667a /src/com/android/settings/search | |
parent | 82de8707af60e4afa6fa877cf205b45e84fc9f72 (diff) | |
download | packages_apps_Settings-7d39310c8d159190cfcc63aa6647714c056d76f6.tar.gz packages_apps_Settings-7d39310c8d159190cfcc63aa6647714c056d76f6.tar.bz2 packages_apps_Settings-7d39310c8d159190cfcc63aa6647714c056d76f6.zip |
Fix bug #13928293 Search - remove "switchTextOn" / "switchTextOff" from indexing
- remove all related code
- update the Index database schema and its version
Change-Id: Iaa5219b77efe5db3a404708663fdf82f10d043d3
Diffstat (limited to 'src/com/android/settings/search')
-rw-r--r-- | src/com/android/settings/search/Index.java | 102 | ||||
-rw-r--r-- | src/com/android/settings/search/IndexDatabaseHelper.java | 14 | ||||
-rw-r--r-- | src/com/android/settings/search/SearchIndexableRaw.java | 2 |
3 files changed, 24 insertions, 94 deletions
diff --git a/src/com/android/settings/search/Index.java b/src/com/android/settings/search/Index.java index 374894b17..219359134 100644 --- a/src/com/android/settings/search/Index.java +++ b/src/com/android/settings/search/Index.java @@ -57,21 +57,20 @@ public class Index { private static final String LOG_TAG = "Index"; // Those indices should match the indices of SELECT_COLUMNS ! + public static final int COLUMN_INDEX_RANK = 0; public static final int COLUMN_INDEX_TITLE = 1; public static final int COLUMN_INDEX_SUMMARY_ON = 2; public static final int COLUMN_INDEX_SUMMARY_OFF = 3; public static final int COLUMN_INDEX_ENTRIES = 4; - public static final int COLUMN_INDEX_SWITCH_ON = 5; - public static final int COLUMN_INDEX_SWITCH_OFF = 6; - public static final int COLUMN_INDEX_KEYWORDS = 7; - public static final int COLUMN_INDEX_CLASS_NAME = 8; - public static final int COLUMN_INDEX_SCREEN_TITLE = 9; - public static final int COLUMN_INDEX_ICON = 10; - public static final int COLUMN_INDEX_INTENT_ACTION = 11; - public static final int COLUMN_INDEX_INTENT_ACTION_TARGET_PACKAGE = 12; - public static final int COLUMN_INDEX_INTENT_ACTION_TARGET_CLASS = 13; - public static final int COLUMN_INDEX_ENABLED = 14; - public static final int COLUMN_INDEX_KEY = 15; + public static final int COLUMN_INDEX_KEYWORDS = 5; + public static final int COLUMN_INDEX_CLASS_NAME = 6; + public static final int COLUMN_INDEX_SCREEN_TITLE = 7; + public static final int COLUMN_INDEX_ICON = 8; + public static final int COLUMN_INDEX_INTENT_ACTION = 9; + public static final int COLUMN_INDEX_INTENT_ACTION_TARGET_PACKAGE = 10; + public static final int COLUMN_INDEX_INTENT_ACTION_TARGET_CLASS = 11; + public static final int COLUMN_INDEX_ENABLED = 12; + public static final int COLUMN_INDEX_KEY = 13; // If you change the order of columns here, you SHOULD change the COLUMN_INDEX_XXX values private static final String[] SELECT_COLUMNS = new String[] { @@ -80,17 +79,15 @@ public class Index { IndexColumns.DATA_SUMMARY_ON, // 2 IndexColumns.DATA_SUMMARY_OFF, // 3 IndexColumns.DATA_ENTRIES, // 4 - IndexColumns.DATA_SWITCH_ON, // 5 - IndexColumns.DATA_SWITCH_OFF, // 6 - IndexColumns.DATA_KEYWORDS, // 7 - IndexColumns.CLASS_NAME, // 8 - IndexColumns.SCREEN_TITLE, // 9 - IndexColumns.ICON, // 10 - IndexColumns.INTENT_ACTION, // 11 - IndexColumns.INTENT_TARGET_PACKAGE, // 12 - IndexColumns.INTENT_TARGET_CLASS, // 13 - IndexColumns.ENABLED, // 14 - IndexColumns.DATA_KEY_REF // 15 + IndexColumns.DATA_KEYWORDS, // 5 + IndexColumns.CLASS_NAME, // 6 + IndexColumns.SCREEN_TITLE, // 7 + IndexColumns.ICON, // 8 + IndexColumns.INTENT_ACTION, // 9 + IndexColumns.INTENT_TARGET_PACKAGE, // 10 + IndexColumns.INTENT_TARGET_CLASS, // 11 + IndexColumns.ENABLED, // 12 + IndexColumns.DATA_KEY_REF // 13 }; private static final String[] MATCH_COLUMNS = { @@ -100,10 +97,6 @@ public class Index { IndexColumns.DATA_SUMMARY_ON_NORMALIZED, IndexColumns.DATA_SUMMARY_OFF, IndexColumns.DATA_SUMMARY_OFF_NORMALIZED, - IndexColumns.DATA_SWITCH_ON, - IndexColumns.DATA_SWITCH_ON_NORMALIZED, - IndexColumns.DATA_SWITCH_OFF, - IndexColumns.DATA_SWITCH_OFF_NORMALIZED, IndexColumns.DATA_ENTRIES, IndexColumns.DATA_KEYWORDS }; @@ -118,7 +111,6 @@ public class Index { private static final String NODE_NAME_PREFERENCE_SCREEN = "PreferenceScreen"; private static final String NODE_NAME_CHECK_BOX_PREFERENCE = "CheckBoxPreference"; private static final String NODE_NAME_LIST_PREFERENCE = "ListPreference"; - private static final String NODE_NAME_SWITCH_PREFERENCE = "SwitchPreference"; private static Index sInstance; private final AtomicBoolean mIsAvailable = new AtomicBoolean(false); @@ -366,8 +358,6 @@ public class Index { final String summaryOn = cursor.getString(2); final String summaryOff = cursor.getString(3); final String entries = cursor.getString(4); - final String switchOn = cursor.getString(5); - final String switchOff = cursor.getString(6); final String keywords = cursor.getString(7); final String screenTitle = cursor.getString(8); @@ -387,8 +377,6 @@ public class Index { data.summaryOn = summaryOn; data.summaryOff = summaryOff; data.entries = entries; - data.switchOn = switchOn; - data.switchOff = switchOff; data.keywords = keywords; data.screenTitle = screenTitle; data.className = className; @@ -515,7 +503,7 @@ public class Index { // Insert rows for the main PreferenceScreen node. Rewrite the data for removing // hyphens. updateOneRowWithFilteredData(database, localeStr, title, summary, null, null, - null, null, fragmentName, screenTitle, iconResId, rank, + fragmentName, screenTitle, iconResId, rank, keywords, intentAction, intentTargetPackage, intentTargetClass, true, key); while ((type = parser.next()) != XmlPullParser.END_DOCUMENT @@ -534,19 +522,14 @@ public class Index { summary = getDataSummary(context, attrs); String entries = null; - String switchOn = null; - String switchOff = null; if (nodeName.endsWith(NODE_NAME_LIST_PREFERENCE)) { entries = getDataEntries(context, attrs); - } else if (nodeName.endsWith(NODE_NAME_SWITCH_PREFERENCE)) { - switchOn = getDataSwitchOn(context, attrs); - switchOff = getDataSwitchOff(context, attrs); } // Insert rows for the child nodes of PreferenceScreen updateOneRowWithFilteredData(database, localeStr, title, summary, null, entries, - switchOn, switchOff, fragmentName, screenTitle, iconResId, rank, + fragmentName, screenTitle, iconResId, rank, keywords, intentAction, intentTargetPackage, intentTargetClass, true, key); } else { @@ -554,7 +537,7 @@ public class Index { final String summaryOff = getDataSummaryOff(context, attrs); updateOneRowWithFilteredData(database, localeStr, title, summaryOn, summaryOff, - null, null, null, fragmentName, screenTitle, iconResId, rank, + null, fragmentName, screenTitle, iconResId, rank, keywords, intentAction, intentTargetPackage, intentTargetClass, true, key); } @@ -581,8 +564,6 @@ public class Index { raw.summaryOn, raw.summaryOff, raw.entries, - raw.switchOn, - raw.switchOff, raw.className, raw.screenTitle, raw.iconResId, @@ -621,8 +602,6 @@ public class Index { raw.summaryOn, raw.summaryOff, raw.entries, - raw.switchOn, - raw.switchOff, sir.className, raw.screenTitle, sir.iconResId, @@ -667,7 +646,7 @@ public class Index { private void updateOneRowWithFilteredData(SQLiteDatabase database, String locale, String title, String summaryOn, String summaryOff, String entries, - String switchOn, String switchOff, String className, + String className, String screenTitle, int iconResId, int rank, String keywords, String intentAction, String intentTargetPackage, String intentTargetClass, boolean enabled, String key) { @@ -694,30 +673,13 @@ public class Index { updatedSummaryOff = EMPTY; } - String updatedSwitchOn; - if (switchOn != null) { - updatedSwitchOn = switchOn.replaceAll(NON_BREAKING_HYPHEN, HYPHEN); - } else { - updatedSwitchOn = EMPTY; - } - - String updatedSwitchOff; - if (switchOff != null) { - updatedSwitchOff = switchOff.replaceAll(NON_BREAKING_HYPHEN, HYPHEN); - } else { - updatedSwitchOff = EMPTY; - } - String normalizedTitle = updatedTitle.replaceAll(HYPHEN, EMPTY); String normalizedSummaryOn = updatedSummaryOn.replaceAll(HYPHEN, EMPTY); String normalizedSummaryOff = updatedSummaryOff.replaceAll(HYPHEN, EMPTY); - String normalizedSwitchOn = updatedSwitchOn.replaceAll(HYPHEN, EMPTY); - String normalizedSwitchOff = updatedSwitchOff.replaceAll(HYPHEN, EMPTY); updateOneRow(database, locale, updatedTitle, normalizedTitle, updatedSummaryOn, normalizedSummaryOn, updatedSummaryOff, normalizedSummaryOff, entries, - updatedSwitchOn, normalizedSwitchOn, updatedSwitchOff, normalizedSwitchOff, className, screenTitle, iconResId, rank, keywords, intentAction, intentTargetPackage, intentTargetClass, enabled, key); } @@ -726,8 +688,6 @@ public class Index { String updatedTitle, String normalizedTitle, String updatedSummaryOn, String normalizedSummaryOn, String updatedSummaryOff, String normalizedSummaryOff, String entries, - String updatedSwitchOn, String normalizedSwitchOn, - String updatedSwitchOff, String normalizedSwitchOff, String className, String screenTitle, int iconResId, int rank, String keywords, String intentAction, String intentTargetPackage, String intentTargetClass, boolean enabled, String key) { @@ -747,10 +707,6 @@ public class Index { values.put(IndexColumns.DATA_SUMMARY_OFF, updatedSummaryOff); values.put(IndexColumns.DATA_SUMMARY_OFF_NORMALIZED, normalizedSummaryOff); values.put(IndexColumns.DATA_ENTRIES, entries); - values.put(IndexColumns.DATA_SWITCH_ON, updatedSwitchOn); - values.put(IndexColumns.DATA_SWITCH_ON_NORMALIZED, normalizedSwitchOn); - values.put(IndexColumns.DATA_SWITCH_OFF, updatedSwitchOff); - values.put(IndexColumns.DATA_SWITCH_OFF_NORMALIZED, normalizedSwitchOff); values.put(IndexColumns.DATA_KEYWORDS, keywords); values.put(IndexColumns.CLASS_NAME, className); values.put(IndexColumns.SCREEN_TITLE, screenTitle); @@ -800,18 +756,6 @@ public class Index { com.android.internal.R.styleable.ListPreference_entries); } - private String getDataSwitchOn(Context context, AttributeSet attrs) { - return getData(context, attrs, - com.android.internal.R.styleable.SwitchPreference, - com.android.internal.R.styleable.SwitchPreference_switchTextOn); - } - - private String getDataSwitchOff(Context context, AttributeSet attrs) { - return getData(context, attrs, - com.android.internal.R.styleable.SwitchPreference, - com.android.internal.R.styleable.SwitchPreference_switchTextOff); - } - private String getDataKeywords(Context context, AttributeSet attrs) { return getData(context, attrs, R.styleable.Preference, R.styleable.Preference_keywords); } diff --git a/src/com/android/settings/search/IndexDatabaseHelper.java b/src/com/android/settings/search/IndexDatabaseHelper.java index bc827f47d..afcbfa1aa 100644 --- a/src/com/android/settings/search/IndexDatabaseHelper.java +++ b/src/com/android/settings/search/IndexDatabaseHelper.java @@ -28,7 +28,7 @@ public class IndexDatabaseHelper extends SQLiteOpenHelper { private static final String TAG = "IndexDatabaseHelper"; private static final String DATABASE_NAME = "search_index.db"; - private static final int DATABASE_VERSION = 107; + private static final int DATABASE_VERSION = 108; public interface Tables { public static final String TABLE_PREFS_INDEX = "prefs_index"; @@ -46,10 +46,6 @@ public class IndexDatabaseHelper extends SQLiteOpenHelper { public static final String DATA_SUMMARY_OFF = "data_summary_off"; public static final String DATA_SUMMARY_OFF_NORMALIZED = "data_summary_off_normalized"; public static final String DATA_ENTRIES = "data_entries"; - public static final String DATA_SWITCH_ON = "data_switch_on"; - public static final String DATA_SWITCH_ON_NORMALIZED = "data_switch_on_normalized"; - public static final String DATA_SWITCH_OFF = "data_switch_off"; - public static final String DATA_SWITCH_OFF_NORMALIZED = "data_switch_off_normalized"; public static final String DATA_KEYWORDS = "data_keywords"; public static final String CLASS_NAME = "class_name"; public static final String SCREEN_TITLE = "screen_title"; @@ -86,14 +82,6 @@ public class IndexDatabaseHelper extends SQLiteOpenHelper { ", " + IndexColumns.DATA_ENTRIES + ", " + - IndexColumns.DATA_SWITCH_ON + - ", " + - IndexColumns.DATA_SWITCH_ON_NORMALIZED + - ", " + - IndexColumns.DATA_SWITCH_OFF + - ", " + - IndexColumns.DATA_SWITCH_OFF_NORMALIZED + - ", " + IndexColumns.DATA_KEYWORDS + ", " + IndexColumns.SCREEN_TITLE + diff --git a/src/com/android/settings/search/SearchIndexableRaw.java b/src/com/android/settings/search/SearchIndexableRaw.java index e661c87a5..c4d187e97 100644 --- a/src/com/android/settings/search/SearchIndexableRaw.java +++ b/src/com/android/settings/search/SearchIndexableRaw.java @@ -32,8 +32,6 @@ public class SearchIndexableRaw extends SearchIndexableData { public String summaryOn; public String summaryOff; public String entries; - public String switchOn; - public String switchOff; public String keywords; public String screenTitle; |