Add public intent filters to indexing

Adds a public intent action to the index so that intents
can be created for callers outside of settings.

Change-Id: I9f87263f213b6de40542e8735c931ee1f0d82094
Fixes: 63136008
Test: make RunSettingsRoboTests
This commit is contained in:
Matthew Fritze
2017-06-29 09:54:20 -07:00
parent 3a9734261d
commit 473b6b45de
4 changed files with 69 additions and 13 deletions

View File

@@ -17,6 +17,8 @@
package com.android.settings.search;
import com.android.settings.R;
import android.content.ComponentName;
import android.content.ContentResolver;
import android.content.ContentValues;
@@ -851,7 +853,8 @@ public class DatabaseIndexingManager {
List<String> nonIndexableKeys) {
final String className = sir.className;
final int rank = sir.rank;
final String intentAction = sir.intentAction;
final String intentTargetPackage = sir.intentTargetPackage;
if (provider == null) {
Log.w(LOG_TAG, "Cannot find provider: " + className);
@@ -879,7 +882,6 @@ public class DatabaseIndexingManager {
.setClassName(className)
.setScreenTitle(raw.screenTitle)
.setIconResId(raw.iconResId)
.setRank(rank)
.setIntentAction(raw.intentAction)
.setIntentTargetPackage(raw.intentTargetPackage)
.setIntentTargetClass(raw.intentTargetClass)
@@ -904,7 +906,15 @@ public class DatabaseIndexingManager {
continue;
}
item.className = (TextUtils.isEmpty(item.className)) ? className : item.className;
item.className = TextUtils.isEmpty(item.className)
? className
: item.className;
item.intentAction = TextUtils.isEmpty(item.intentAction)
? intentAction
: item.intentAction;
item.intentTargetPackage = TextUtils.isEmpty(item.intentTargetPackage)
? intentTargetPackage
: item.intentTargetPackage;
indexFromResource(database, localeStr, item, nonIndexableKeys);
}
@@ -1238,7 +1248,11 @@ public class DatabaseIndexingManager {
private Intent buildIntent(Context context) {
final Intent intent;
if (TextUtils.isEmpty(mIntentAction)) {
boolean isEmptyIntentAction = TextUtils.isEmpty(mIntentAction);
// No intent action is set, or the intent action is for a subsetting.
if (isEmptyIntentAction
|| (!isEmptyIntentAction && TextUtils.equals(mIntentTargetPackage,
SearchIndexableResources.SUBSETTING_TARGET_PACKAGE))) {
// Action is null, we will launch it as a sub-setting
intent = DatabaseIndexingUtils.buildSubsettingIntent(context, mClassName, mKey,
mScreenTitle);