summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Santos Cordon <santoscordon@google.com> 2014-06-25 23:54:32 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2014-06-25 03:33:37 +0000
commit779b3f04d857586add42920d6cfeff7ea5168c16 (patch)
treeb1bb2f02887704d53b3959ce9720031c428c1c19
parentc286444f14798b783662f62c4ad3d7e8c71e9fda (diff)
parent6c7a38817c46e35277599ebb4aa4c73b14a18cff (diff)
Merge "Add a system API to get the default phone app."
-rw-r--r--telecomm/java/android/telecomm/TelecommManager.java31
-rw-r--r--telecomm/java/com/android/internal/telecomm/ITelecommService.aidl6
2 files changed, 35 insertions, 2 deletions
diff --git a/telecomm/java/android/telecomm/TelecommManager.java b/telecomm/java/android/telecomm/TelecommManager.java
index a97e7e499f5f..a0abc286144e 100644
--- a/telecomm/java/android/telecomm/TelecommManager.java
+++ b/telecomm/java/android/telecomm/TelecommManager.java
@@ -16,7 +16,12 @@
package android.telecomm;
+import android.annotation.SystemApi;
+import android.content.ComponentName;
import android.content.Context;
+import android.os.RemoteException;
+import android.os.ServiceManager;
+import android.util.Log;
import com.android.internal.telecomm.ITelecommService;
@@ -25,11 +30,14 @@ import com.android.internal.telecomm.ITelecommService;
*/
public class TelecommManager {
private static final String TAG = "TelecommManager";
+ private static final String TELECOMM_SERVICE_NAME = "telecomm";
private final Context mContext;
private final ITelecommService mService;
- /** @hide */
+ /**
+ * @hide
+ */
public TelecommManager(Context context, ITelecommService service) {
Context appContext = context.getApplicationContext();
if (appContext != null) {
@@ -41,8 +49,27 @@ public class TelecommManager {
mService = service;
}
- /** {@hide} */
+ /**
+ * @hide
+ */
public static TelecommManager from(Context context) {
return (TelecommManager) context.getSystemService(Context.TELECOMM_SERVICE);
}
+
+ /**
+ * @hide
+ */
+ @SystemApi
+ public ComponentName getDefaultPhoneApp() {
+ try {
+ return getTelecommService().getDefaultPhoneApp();
+ } catch (RemoteException e) {
+ Log.e(TAG, "RemoteException attempting to get the default phone app.", e);
+ }
+ return null;
+ }
+
+ private ITelecommService getTelecommService() {
+ return ITelecommService.Stub.asInterface(ServiceManager.getService(TELECOMM_SERVICE_NAME));
+ }
}
diff --git a/telecomm/java/com/android/internal/telecomm/ITelecommService.aidl b/telecomm/java/com/android/internal/telecomm/ITelecommService.aidl
index c758c6d36b9e..2ae5768f2e25 100644
--- a/telecomm/java/com/android/internal/telecomm/ITelecommService.aidl
+++ b/telecomm/java/com/android/internal/telecomm/ITelecommService.aidl
@@ -16,6 +16,7 @@
package com.android.internal.telecomm;
+import android.content.ComponentName;
import android.telecomm.Subscription;
/**
@@ -55,4 +56,9 @@ interface ITelecommService {
* Sets a given Subscription as the system default.
*/
void setSystemDefault(in Subscription subscription);
+
+ /**
+ * Returns the component name of the default phone application.
+ */
+ ComponentName getDefaultPhoneApp();
}