Add the impl for the ability to query non-public Slices

Apps get Settings Slices through onGetSliceDescendants(), so adding some
codes here to make us be capable returning non-public Slices. As these
SliceData come from slice_index.db, where SliceDatabaseAccessor is the
middleman for us to access those data, so adding a parameter in
getSliceUris() to determine what data should be returned.

Bug: 141088937
Test: robotests
Change-Id: I411eb1ff194b7c8915b9e7309c684046dbde29fb
This commit is contained in:
Yi-Ling Chuang
2019-11-21 14:48:14 +08:00
parent 1a359b5b22
commit d57e5a5d1a
7 changed files with 254 additions and 28 deletions

View File

@@ -47,6 +47,11 @@ class SliceTestUtils {
public static void insertSliceToDb(Context context, String key, boolean isPlatformSlice,
String customizedUnavailableSliceSubtitle) {
insertSliceToDb(context, key, isPlatformSlice, customizedUnavailableSliceSubtitle, false);
}
public static void insertSliceToDb(Context context, String key, boolean isPlatformSlice,
String customizedUnavailableSliceSubtitle, boolean isPublicSlice) {
final SQLiteDatabase db = SlicesDatabaseHelper.getInstance(context).getWritableDatabase();
ContentValues values = new ContentValues();
values.put(SlicesDatabaseHelper.IndexColumns.KEY, key);
@@ -69,6 +74,7 @@ class SliceTestUtils {
values.put(SlicesDatabaseHelper.IndexColumns.SLICE_TYPE, SliceData.SliceType.INTENT);
values.put(SlicesDatabaseHelper.IndexColumns.UNAVAILABLE_SLICE_SUBTITLE,
customizedUnavailableSliceSubtitle);
values.put(SlicesDatabaseHelper.IndexColumns.PUBLIC_SLICE, isPublicSlice);
db.replaceOrThrow(SlicesDatabaseHelper.Tables.TABLE_SLICES_INDEX, null, values);
db.close();