Declare official platform slice

Create the notion of an official platform slice.
This includes:
- Adding a second authority to the provider
- tagging slices in xml with a platform slice flag
- Including authority in the getUri method

Bug:73359139
Test: robotests
Change-Id: I5382be138a262dbc5a8324c34aab131c5d0d5516
Merged-In: I581ee6dfcdf935f452a15e89e5d055e375ff1877
This commit is contained in:
Matthew Fritze
2018-02-28 08:15:55 -08:00
parent e8acc0c4bd
commit a4a3dfffa2
15 changed files with 201 additions and 53 deletions

View File

@@ -19,9 +19,12 @@ package com.android.settings.slices;
import static com.android.settings.slices.SettingsSliceProvider.EXTRA_SLICE_KEY;
import android.app.PendingIntent;
import android.content.ContentResolver;
import android.content.Context;
import android.content.Intent;
import android.graphics.drawable.Icon;
import android.net.Uri;
import android.provider.SettingsSlicesContract;
import android.text.TextUtils;
import com.android.internal.annotations.VisibleForTesting;
@@ -98,6 +101,17 @@ public class SliceBuilderUtils {
sliceData.getKey());
}
public static Uri getUri(String path, boolean isPlatformSlice) {
final String authority = isPlatformSlice
? SettingsSlicesContract.AUTHORITY
: SettingsSliceProvider.SLICE_AUTHORITY;
return new Uri.Builder()
.scheme(ContentResolver.SCHEME_CONTENT)
.authority(authority)
.appendPath(path)
.build();
}
private static BasePreferenceController getPreferenceController(Context context,
String controllerClassName, String controllerKey) {
try {