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:
Jason Monk
2016-02-23 17:28:29 -05:00
parent 91e2f89b0f
commit 2108d361bb
11 changed files with 270 additions and 12 deletions

View File

@@ -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);
}
}