Only allow Settings app launch search result page
Bug: 68199963 Test: robotest Change-Id: I0018e9c60b0dd46fc2420a563a93b706bf252dc4
This commit is contained in:
@@ -20,6 +20,7 @@ import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.pm.ResolveInfo;
|
||||
import android.os.UserHandle;
|
||||
import android.support.annotation.VisibleForTesting;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
|
||||
@@ -34,6 +35,8 @@ import java.util.List;
|
||||
public class IntentSearchViewHolder extends SearchViewHolder {
|
||||
|
||||
private static final String TAG = "IntentSearchViewHolder";
|
||||
@VisibleForTesting
|
||||
static final int REQUEST_CODE_NO_OP = 0;
|
||||
|
||||
public IntentSearchViewHolder(View view) {
|
||||
super(view);
|
||||
@@ -60,7 +63,7 @@ public class IntentSearchViewHolder extends SearchViewHolder {
|
||||
final PackageManager pm = fragment.getActivity().getPackageManager();
|
||||
final List<ResolveInfo> info = pm.queryIntentActivities(intent, 0 /* flags */);
|
||||
if (info != null && !info.isEmpty()) {
|
||||
fragment.startActivity(intent);
|
||||
fragment.startActivityForResult(intent, REQUEST_CODE_NO_OP);
|
||||
} else {
|
||||
Log.e(TAG, "Cannot launch search result, title: "
|
||||
+ result.title + ", " + intent);
|
||||
|
Reference in New Issue
Block a user