Add utility method isDefaultOrSystemDialer
Will be used by various system components to determine if a given package name is a privileged Dialer Bug: 20333102 Bug: 20304411 Change-Id: I1e5bcbde8ee9a5dc6936b118b1b78f32d97737a6
This commit is contained in:
@@ -149,6 +149,27 @@ public class DefaultDialerManager {
|
||||
return getComponentName(getInstalledDialerApplications(context), packageName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines if the package name belongs to the user-selected default dialer or the preloaded
|
||||
* system dialer, and thus should be allowed to perform certain privileged operations.
|
||||
*
|
||||
* @param context A valid context.
|
||||
* @param packageName of the package to check for.
|
||||
*
|
||||
* @return {@code true} if the provided package name corresponds to the user-selected default
|
||||
* dialer or the preloaded system dialer, {@code false} otherwise.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public static boolean isDefaultOrSystemDialer(Context context, String packageName) {
|
||||
if (TextUtils.isEmpty(packageName)) {
|
||||
return false;
|
||||
}
|
||||
final TelecomManager tm = getTelecomManager(context);
|
||||
return packageName.equals(tm.getDefaultDialerPackage())
|
||||
|| packageName.equals(tm.getSystemDialerPackage());
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the component from a list of application components that corresponds to the package
|
||||
* name.
|
||||
|
||||
Reference in New Issue
Block a user