Fix Settings crash after disabling Settings Suggestion
- Settings Suggestion App is responsible for searching, we can not prevent user disable it. Hide search feature if user disable it. Fixes: 118805907 Fixes: 117921464 Test: manual Change-Id: I61c47c52265a6efd79ef2fa60272bf6513e678b1
This commit is contained in:
@@ -979,4 +979,14 @@ public final class Utils extends com.android.settingslib.Utils {
|
||||
return packageManager.getDefaultActivityIcon();
|
||||
}
|
||||
}
|
||||
|
||||
/** Returns true if the current package is installed & enabled. */
|
||||
public static boolean isPackageEnabled(Context context, String packageName) {
|
||||
try {
|
||||
return context.getPackageManager().getApplicationInfo(packageName, 0).enabled;
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "Error while retrieving application info for package " + packageName, e);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user