Add default app prefs to app info
This makes them easier to discover and to know the state of them. Bug: 27276982 Change-Id: I24a9d34d7e189b19df39cc0b9028b6412f76aa05
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
|
||||
package com.android.settings.applications;
|
||||
|
||||
import android.content.ComponentName;
|
||||
import android.content.ContentResolver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
@@ -29,6 +30,7 @@ import android.telephony.TelephonyManager;
|
||||
import android.text.TextUtils;
|
||||
import android.util.ArraySet;
|
||||
import android.util.AttributeSet;
|
||||
import com.android.internal.telephony.SmsApplication;
|
||||
import com.android.settings.AppListPreference;
|
||||
import com.android.settings.SelfAvailablePreference;
|
||||
|
||||
@@ -146,4 +148,18 @@ public class DefaultEmergencyPreference extends AppListPreference
|
||||
return isCapable(context)
|
||||
&& context.getPackageManager().resolveActivity(QUERY_INTENT, 0) != null;
|
||||
}
|
||||
|
||||
public static boolean hasEmergencyPreference(String pkg, Context context) {
|
||||
Intent i = new Intent(QUERY_INTENT);
|
||||
i.setPackage(pkg);
|
||||
final List<ResolveInfo> resolveInfos =
|
||||
context.getPackageManager().queryIntentActivities(i, 0);
|
||||
return resolveInfos != null && resolveInfos.size() != 0;
|
||||
}
|
||||
|
||||
public static boolean isEmergencyDefault(String pkg, Context context) {
|
||||
String defaultPackage = Settings.Secure.getString(context.getContentResolver(),
|
||||
Settings.Secure.EMERGENCY_ASSISTANCE_APPLICATION);
|
||||
return defaultPackage != null && defaultPackage.equals(pkg);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user