Search - add support for saving the UserId in the Index
- add the new "user_id" colum - use -1 as a default value This CL depends on that Framework CL for SearchIndexableData: 0d94539e67e997ed7687f33854fc581ce4668da5 See bug: #15837747 Search - update for Enterprise support Change-Id: I0cf2866600732e8e99006050bf9ad388fa44b509
This commit is contained in:
@@ -721,7 +721,8 @@ public class Index {
|
|||||||
raw.intentTargetPackage,
|
raw.intentTargetPackage,
|
||||||
raw.intentTargetClass,
|
raw.intentTargetClass,
|
||||||
raw.enabled,
|
raw.enabled,
|
||||||
raw.key);
|
raw.key,
|
||||||
|
raw.userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void indexOneResource(SQLiteDatabase database, String localeStr,
|
private void indexOneResource(SQLiteDatabase database, String localeStr,
|
||||||
@@ -819,7 +820,8 @@ public class Index {
|
|||||||
|
|
||||||
updateOneRowWithFilteredData(database, localeStr, title, summary, null, null,
|
updateOneRowWithFilteredData(database, localeStr, title, summary, null, null,
|
||||||
fragmentName, screenTitle, iconResId, rank,
|
fragmentName, screenTitle, iconResId, rank,
|
||||||
keywords, intentAction, intentTargetPackage, intentTargetClass, true, key);
|
keywords, intentAction, intentTargetPackage, intentTargetClass, true,
|
||||||
|
key, -1 /* default user id */);
|
||||||
}
|
}
|
||||||
|
|
||||||
while ((type = parser.next()) != XmlPullParser.END_DOCUMENT
|
while ((type = parser.next()) != XmlPullParser.END_DOCUMENT
|
||||||
@@ -851,7 +853,7 @@ public class Index {
|
|||||||
updateOneRowWithFilteredData(database, localeStr, title, summary, null, entries,
|
updateOneRowWithFilteredData(database, localeStr, title, summary, null, entries,
|
||||||
fragmentName, screenTitle, iconResId, rank,
|
fragmentName, screenTitle, iconResId, rank,
|
||||||
keywords, intentAction, intentTargetPackage, intentTargetClass,
|
keywords, intentAction, intentTargetPackage, intentTargetClass,
|
||||||
true, key);
|
true, key, -1 /* default user id */);
|
||||||
} else {
|
} else {
|
||||||
String summaryOn = getDataSummaryOn(context, attrs);
|
String summaryOn = getDataSummaryOn(context, attrs);
|
||||||
String summaryOff = getDataSummaryOff(context, attrs);
|
String summaryOff = getDataSummaryOff(context, attrs);
|
||||||
@@ -863,7 +865,7 @@ public class Index {
|
|||||||
updateOneRowWithFilteredData(database, localeStr, title, summaryOn, summaryOff,
|
updateOneRowWithFilteredData(database, localeStr, title, summaryOn, summaryOff,
|
||||||
null, fragmentName, screenTitle, iconResId, rank,
|
null, fragmentName, screenTitle, iconResId, rank,
|
||||||
keywords, intentAction, intentTargetPackage, intentTargetClass,
|
keywords, intentAction, intentTargetPackage, intentTargetClass,
|
||||||
true, key);
|
true, key, -1 /* default user id */);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -915,7 +917,8 @@ public class Index {
|
|||||||
raw.intentTargetPackage,
|
raw.intentTargetPackage,
|
||||||
raw.intentTargetClass,
|
raw.intentTargetClass,
|
||||||
raw.enabled,
|
raw.enabled,
|
||||||
raw.key);
|
raw.key,
|
||||||
|
raw.userId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -949,7 +952,7 @@ public class Index {
|
|||||||
String className,
|
String className,
|
||||||
String screenTitle, int iconResId, int rank, String keywords,
|
String screenTitle, int iconResId, int rank, String keywords,
|
||||||
String intentAction, String intentTargetPackage, String intentTargetClass,
|
String intentAction, String intentTargetPackage, String intentTargetClass,
|
||||||
boolean enabled, String key) {
|
boolean enabled, String key, int userId) {
|
||||||
|
|
||||||
final String updatedTitle = normalizeHyphen(title);
|
final String updatedTitle = normalizeHyphen(title);
|
||||||
final String updatedSummaryOn = normalizeHyphen(summaryOn);
|
final String updatedSummaryOn = normalizeHyphen(summaryOn);
|
||||||
@@ -963,7 +966,8 @@ public class Index {
|
|||||||
updatedTitle, normalizedTitle, updatedSummaryOn, normalizedSummaryOn,
|
updatedTitle, normalizedTitle, updatedSummaryOn, normalizedSummaryOn,
|
||||||
updatedSummaryOff, normalizedSummaryOff, entries,
|
updatedSummaryOff, normalizedSummaryOff, entries,
|
||||||
className, screenTitle, iconResId,
|
className, screenTitle, iconResId,
|
||||||
rank, keywords, intentAction, intentTargetPackage, intentTargetClass, enabled, key);
|
rank, keywords, intentAction, intentTargetPackage, intentTargetClass, enabled,
|
||||||
|
key, userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String normalizeHyphen(String input) {
|
private static String normalizeHyphen(String input) {
|
||||||
@@ -983,7 +987,7 @@ public class Index {
|
|||||||
String updatedSummaryOff, String normalizedSummaryOff, String entries,
|
String updatedSummaryOff, String normalizedSummaryOff, String entries,
|
||||||
String className, String screenTitle, int iconResId, int rank, String keywords,
|
String className, String screenTitle, int iconResId, int rank, String keywords,
|
||||||
String intentAction, String intentTargetPackage, String intentTargetClass,
|
String intentAction, String intentTargetPackage, String intentTargetClass,
|
||||||
boolean enabled, String key) {
|
boolean enabled, String key, int userId) {
|
||||||
|
|
||||||
if (TextUtils.isEmpty(updatedTitle)) {
|
if (TextUtils.isEmpty(updatedTitle)) {
|
||||||
return;
|
return;
|
||||||
@@ -1009,6 +1013,7 @@ public class Index {
|
|||||||
values.put(IndexColumns.ICON, iconResId);
|
values.put(IndexColumns.ICON, iconResId);
|
||||||
values.put(IndexColumns.ENABLED, enabled);
|
values.put(IndexColumns.ENABLED, enabled);
|
||||||
values.put(IndexColumns.DATA_KEY_REF, key);
|
values.put(IndexColumns.DATA_KEY_REF, key);
|
||||||
|
values.put(IndexColumns.USER_ID, userId);
|
||||||
|
|
||||||
database.replaceOrThrow(Tables.TABLE_PREFS_INDEX, null, values);
|
database.replaceOrThrow(Tables.TABLE_PREFS_INDEX, null, values);
|
||||||
}
|
}
|
||||||
|
@@ -28,7 +28,7 @@ public class IndexDatabaseHelper extends SQLiteOpenHelper {
|
|||||||
private static final String TAG = "IndexDatabaseHelper";
|
private static final String TAG = "IndexDatabaseHelper";
|
||||||
|
|
||||||
private static final String DATABASE_NAME = "search_index.db";
|
private static final String DATABASE_NAME = "search_index.db";
|
||||||
private static final int DATABASE_VERSION = 114;
|
private static final int DATABASE_VERSION = 115;
|
||||||
|
|
||||||
public interface Tables {
|
public interface Tables {
|
||||||
public static final String TABLE_PREFS_INDEX = "prefs_index";
|
public static final String TABLE_PREFS_INDEX = "prefs_index";
|
||||||
@@ -56,6 +56,7 @@ public class IndexDatabaseHelper extends SQLiteOpenHelper {
|
|||||||
public static final String ICON = "icon";
|
public static final String ICON = "icon";
|
||||||
public static final String ENABLED = "enabled";
|
public static final String ENABLED = "enabled";
|
||||||
public static final String DATA_KEY_REF = "data_key_reference";
|
public static final String DATA_KEY_REF = "data_key_reference";
|
||||||
|
public static final String USER_ID = "user_id";
|
||||||
}
|
}
|
||||||
|
|
||||||
public interface MetaColumns {
|
public interface MetaColumns {
|
||||||
@@ -105,6 +106,8 @@ public class IndexDatabaseHelper extends SQLiteOpenHelper {
|
|||||||
IndexColumns.ENABLED +
|
IndexColumns.ENABLED +
|
||||||
", " +
|
", " +
|
||||||
IndexColumns.DATA_KEY_REF +
|
IndexColumns.DATA_KEY_REF +
|
||||||
|
", " +
|
||||||
|
IndexColumns.USER_ID +
|
||||||
");";
|
");";
|
||||||
|
|
||||||
private static final String CREATE_META_TABLE =
|
private static final String CREATE_META_TABLE =
|
||||||
|
Reference in New Issue
Block a user