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:
@@ -17,6 +17,7 @@
|
||||
package com.android.settings.applications;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.UserHandle;
|
||||
import android.os.UserManager;
|
||||
import android.telecom.DefaultDialerManager;
|
||||
import android.telephony.TelephonyManager;
|
||||
@@ -74,4 +75,16 @@ public class DefaultPhonePreference extends AppListPreference implements SelfAva
|
||||
(UserManager) context.getSystemService(Context.USER_SERVICE);
|
||||
return !um.hasUserRestriction(UserManager.DISALLOW_OUTGOING_CALLS);
|
||||
}
|
||||
|
||||
public static boolean hasPhonePreference(String pkg, Context context) {
|
||||
List<String> dialerPackages =
|
||||
DefaultDialerManager.getInstalledDialerApplications(context, UserHandle.myUserId());
|
||||
return dialerPackages.contains(pkg);
|
||||
}
|
||||
|
||||
public static boolean isPhoneDefault(String pkg, Context context) {
|
||||
String def = DefaultDialerManager.getDefaultDialerApplication(context,
|
||||
UserHandle.myUserId());
|
||||
return def != null && def.equals(pkg);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user