Fix Settings crash when clicking search bar
- When user disable settings suggestion in App Settings, click search button without leaving settings app. The search button is still existed. - Doesn't allow user to disable app in App Settings - Add check before start search intent Change-Id: Ifbc4615914678d8df734e14d63bb626403313d1e Fixes: 118805907 Test: manual
This commit is contained in:
@@ -23,6 +23,7 @@ import android.app.Activity;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.provider.Settings;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
@@ -88,6 +89,11 @@ public interface SearchFeatureProvider {
|
||||
intent.setPackage(getSettingsIntelligencePkgName(activity));
|
||||
final Context context = activity.getApplicationContext();
|
||||
|
||||
if (activity.getPackageManager().queryIntentActivities(intent,
|
||||
PackageManager.MATCH_DEFAULT_ONLY).isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
FeatureFactory.getFactory(context).getSlicesFeatureProvider()
|
||||
.indexSliceDataAsync(activity.getApplicationContext());
|
||||
FeatureFactory.getFactory(context).getMetricsFeatureProvider()
|
||||
|
Reference in New Issue
Block a user