diff options
author | Yorke Lee <yorkelee@google.com> | 2015-04-27 11:18:38 -0700 |
---|---|---|
committer | Yorke Lee <yorkelee@google.com> | 2015-04-27 12:55:23 -0700 |
commit | 610438230b72bc4932e6580230bfa2d5dd4e9913 (patch) | |
tree | 95ec32b6b50c7ba4a706e539d74d91eb88a24fde /telecomm | |
parent | a818a46c897157185f2367a72440325d9278bd4f (diff) | |
download | frameworks_base-610438230b72bc4932e6580230bfa2d5dd4e9913.zip frameworks_base-610438230b72bc4932e6580230bfa2d5dd4e9913.tar.gz frameworks_base-610438230b72bc4932e6580230bfa2d5dd4e9913.tar.bz2 |
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
Diffstat (limited to 'telecomm')
-rw-r--r-- | telecomm/java/android/telecom/DefaultDialerManager.java | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/telecomm/java/android/telecom/DefaultDialerManager.java b/telecomm/java/android/telecom/DefaultDialerManager.java index bf8fac6..537c3f7 100644 --- a/telecomm/java/android/telecom/DefaultDialerManager.java +++ b/telecomm/java/android/telecom/DefaultDialerManager.java @@ -150,6 +150,27 @@ public class DefaultDialerManager { } /** + * 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. * |