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:
@@ -88,16 +88,18 @@ public class SlicesDatabaseAccessor {
|
||||
}
|
||||
|
||||
/**
|
||||
* @return a list of Slice {@link Uri}s matching {@param authority}.
|
||||
* @return a list of Slice {@link Uri}s based on their visibility {@param isPublicSlice } and
|
||||
* {@param authority}.
|
||||
*/
|
||||
public List<Uri> getSliceUris(String authority) {
|
||||
public List<Uri> getSliceUris(String authority, boolean isPublicSlice) {
|
||||
verifyIndexing();
|
||||
final List<Uri> uris = new ArrayList<>();
|
||||
final String whereClause = IndexColumns.PUBLIC_SLICE + (isPublicSlice ? "=1" : "=0");
|
||||
final SQLiteDatabase database = mHelper.getReadableDatabase();
|
||||
final String[] columns = new String[]{IndexColumns.SLICE_URI};
|
||||
try (final Cursor resultCursor = database.query(TABLE_SLICES_INDEX, columns,
|
||||
null /* where */, null /* selection */, null /* groupBy */, null /* having */,
|
||||
null /* orderBy */)) {
|
||||
try (Cursor resultCursor = database.query(TABLE_SLICES_INDEX, columns,
|
||||
whereClause /* where */, null /* selection */, null /* groupBy */,
|
||||
null /* having */, null /* orderBy */)) {
|
||||
if (!resultCursor.moveToFirst()) {
|
||||
return uris;
|
||||
}
|
||||
|
Reference in New Issue
Block a user