Merge "Push full slice index to device index" into pi-dev am: 3d29ca2893

am: 2332aad2a6

Change-Id: I3563eb7ed2ab93b35b1a950d89ca2466abaa59e3
This commit is contained in:
Jason Monk
2018-04-26 14:26:38 -07:00
committed by android-build-merger
12 changed files with 383 additions and 48 deletions

View File

@@ -24,6 +24,7 @@ import android.content.Intent;
import android.graphics.drawable.Icon;
import android.net.Uri;
import android.net.wifi.WifiManager;
import android.os.StrictMode;
import android.provider.Settings;
import androidx.annotation.VisibleForTesting;
import android.provider.SettingsSlicesContract;
@@ -148,6 +149,11 @@ public class SettingsSliceProvider extends SliceProvider {
@Override
public Slice onBindSlice(Uri sliceUri) {
// TODO: Remove this when all slices are not breaking strict mode
StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder()
.permitAll()
.build());
String path = sliceUri.getPath();
// If adding a new Slice, do not directly match Slice URIs.
// Use {@link SlicesDatabaseAccessor}.
@@ -277,7 +283,8 @@ public class SettingsSliceProvider extends SliceProvider {
* {@link SliceData} is loaded from {@link SlicesDatabaseHelper.Tables#TABLE_SLICES_INDEX}.
*/
private Slice getSliceStub(Uri uri) {
return new ListBuilder(getContext(), uri).build();
// TODO: Switch back to ListBuilder when slice loading states are fixed.
return new Slice.Builder(uri).build();
}
// TODO (b/70622039) remove this when the proper wifi slice is enabled.

View File

@@ -27,6 +27,8 @@ public class SliceDeepLinkSpringBoard extends Activity {
private static final String TAG = "DeeplinkSpringboard";
public static final String INTENT = "intent";
public static final String SETTINGS = "settings";
public static final String ACTION_VIEW_SLICE = "com.android.settings.action.VIEW_SLICE";
public static final String EXTRA_SLICE = "slice";
@Override
protected void onCreate(Bundle savedInstanceState) {
@@ -39,7 +41,14 @@ public class SliceDeepLinkSpringBoard extends Activity {
}
try {
Intent intent = parse(uri, getPackageName());
startActivity(intent);
if (ACTION_VIEW_SLICE.equals(intent.getAction())) {
// This shouldn't matter since the slice is shown instead of the device
// index caring about the launch uri.
Uri slice = Uri.parse(intent.getStringExtra(EXTRA_SLICE));
Log.e(TAG, "Slice intent launched: " + slice);
} else {
startActivity(intent);
}
finish();
} catch (URISyntaxException e) {
Log.e(TAG, "Error decoding uri", e);