Only allow Settings app launch search result page
Bug: 68199963 Test: robotest Change-Id: I0018e9c60b0dd46fc2420a563a93b706bf252dc4
This commit is contained in:
@@ -17,6 +17,7 @@
|
||||
|
||||
package com.android.settings.search;
|
||||
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
@@ -42,6 +43,18 @@ public class SearchFeatureProviderImpl implements SearchFeatureProvider {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void verifyLaunchSearchResultPageCaller(Context context, ComponentName caller) {
|
||||
if (caller == null) {
|
||||
throw new IllegalArgumentException("ExternalSettingsTrampoline intents "
|
||||
+ "must be called with startActivityForResult");
|
||||
}
|
||||
final String packageName = caller.getPackageName();
|
||||
if (!TextUtils.equals(packageName, context.getPackageName())) {
|
||||
throw new SecurityException("Only Settings app can launch search result page");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public DatabaseResultLoader getDatabaseSearchLoader(Context context, String query) {
|
||||
return new DatabaseResultLoader(context, cleanQuery(query), getSiteMapManager());
|
||||
|
Reference in New Issue
Block a user