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:
@@ -77,4 +77,20 @@ public class DefaultSmsPreference extends AppListPreference implements SelfAvail
|
||||
(TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
|
||||
return !isRestrictedUser && tm.isSmsCapable();
|
||||
}
|
||||
|
||||
public static boolean hasSmsPreference(String pkg, Context context) {
|
||||
Collection<SmsApplicationData> smsApplications =
|
||||
SmsApplication.getApplicationCollection(context);
|
||||
for (SmsApplicationData data : smsApplications) {
|
||||
if (data.mPackageName.equals(pkg)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean isSmsDefault(String pkg, Context context) {
|
||||
ComponentName appName = SmsApplication.getDefaultSmsApplication(context, true);
|
||||
return appName != null && appName.getPackageName().equals(pkg);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user