Add option for settings to push to a device index

The index implementation is optional and left up to the OEM.

Test: Open settings, see content in index
Test: robo tests
Bug: 68378569
Bug: 76102600
Change-Id: Idb8bb1e0cabbbe92e7a852e2eadbdcd8c2ab7d56
This commit is contained in:
Jason Monk
2017-11-22 10:04:38 -05:00
parent 2c1de66c58
commit f6edc7c80a
10 changed files with 316 additions and 5 deletions

View File

@@ -17,27 +17,26 @@
package com.android.settings.slices;
import android.app.PendingIntent;
import android.content.ContentResolver;
import android.app.slice.SliceManager;
import android.content.Context;
import android.content.Intent;
import android.graphics.drawable.Icon;
import android.net.Uri;
import android.net.wifi.WifiManager;
import android.provider.SettingsSlicesContract;
import android.support.annotation.VisibleForTesting;
import android.util.Log;
import com.android.settings.R;
import com.android.settingslib.utils.ThreadUtils;
import java.net.URISyntaxException;
import java.util.Map;
import java.util.WeakHashMap;
import androidx.slice.Slice;
import androidx.slice.SliceProvider;
import androidx.slice.builders.SliceAction;
import androidx.slice.builders.ListBuilder;
import androidx.slice.builders.SliceAction;
/**
* A {@link SliceProvider} for Settings to enabled inline results in system apps.
@@ -106,6 +105,17 @@ public class SettingsSliceProvider extends SliceProvider {
return true;
}
@Override
public Uri onMapIntentToUri(Intent intent) {
try {
return getContext().getSystemService(SliceManager.class).mapIntentToUri(
SliceDeepLinkSpringBoard.parse(
intent.getData(), getContext().getPackageName()));
} catch (URISyntaxException e) {
return null;
}
}
@Override
public Slice onBindSlice(Uri sliceUri) {
String path = sliceUri.getPath();