summaryrefslogtreecommitdiffstats
path: root/telecomm
diff options
context:
space:
mode:
authorNancy Chen <nancychen@google.com>2015-01-24 23:30:27 -0800
committerNancy Chen <nancychen@google.com>2015-01-24 23:32:02 -0800
commit5cf27847b011b115afa4a2e05f8c9aaa6c77ad01 (patch)
treefd6b872dae2806ef1ab7e13c2651659135895ea4 /telecomm
parenta2fa3d219bc148c196b0eb3cf7b3b1bd453e830b (diff)
downloadframeworks_base-5cf27847b011b115afa4a2e05f8c9aaa6c77ad01.zip
frameworks_base-5cf27847b011b115afa4a2e05f8c9aaa6c77ad01.tar.gz
frameworks_base-5cf27847b011b115afa4a2e05f8c9aaa6c77ad01.tar.bz2
Add method in TelecomManager to return line1Number for a PhoneAccount.
Since we do not want to expose SubIds in the app layer, we need a wrapper to extra the subId from a PhoneAccount and return the value of TelephonyManager#line1Number. Also update error strings to be more consistent. Bug: 19087382 Change-Id: Ie5a474d45336921d1007b36a4d26cd4da68f8b91
Diffstat (limited to 'telecomm')
-rw-r--r--telecomm/java/android/telecom/TelecomManager.java26
-rw-r--r--telecomm/java/com/android/internal/telecom/ITelecomService.aidl5
2 files changed, 28 insertions, 3 deletions
diff --git a/telecomm/java/android/telecom/TelecomManager.java b/telecomm/java/android/telecom/TelecomManager.java
index 6621726..1a6b292 100644
--- a/telecomm/java/android/telecom/TelecomManager.java
+++ b/telecomm/java/android/telecom/TelecomManager.java
@@ -691,7 +691,7 @@ public class TelecomManager {
getTelecomService().clearAccounts(packageName);
}
} catch (RemoteException e) {
- Log.e(TAG, "Error calling ITelecomService#clearAccountsForPackage()", e);
+ Log.e(TAG, "Error calling ITelecomService#clearAccountsForPackage", e);
}
}
@@ -726,7 +726,7 @@ public class TelecomManager {
return getTelecomService().isVoiceMailNumber(accountHandle, number);
}
} catch (RemoteException e) {
- Log.e(TAG, "RemoteException calling isInCall().", e);
+ Log.e(TAG, "RemoteException calling ITelecomService#isVoiceMailNumber.", e);
}
return false;
}
@@ -746,12 +746,32 @@ public class TelecomManager {
return getTelecomService().hasVoiceMailNumber(accountHandle);
}
} catch (RemoteException e) {
- Log.e(TAG, "RemoteException calling isInCall().", e);
+ Log.e(TAG, "RemoteException calling ITelecomService#hasVoiceMailNumber.", e);
}
return false;
}
/**
+ * Return the line 1 phone number for given phone account.
+ *
+ * @param accountHandle The handle for the account retrieve a number for.
+ * @return A string representation of the line 1 phone number.
+ *
+ * @hide
+ */
+ @SystemApi
+ public String getLine1Number(PhoneAccountHandle accountHandle) {
+ try {
+ if (isServiceConnected()) {
+ return getTelecomService().getLine1Number(accountHandle);
+ }
+ } catch (RemoteException e) {
+ Log.e(TAG, "RemoteException calling ITelecomService#getLine1Number.", e);
+ }
+ return null;
+ }
+
+ /**
* Returns whether there is an ongoing phone call (can be in dialing, ringing, active or holding
* states).
* <p>
diff --git a/telecomm/java/com/android/internal/telecom/ITelecomService.aidl b/telecomm/java/com/android/internal/telecom/ITelecomService.aidl
index f8d7539..d2030f2 100644
--- a/telecomm/java/com/android/internal/telecom/ITelecomService.aidl
+++ b/telecomm/java/com/android/internal/telecom/ITelecomService.aidl
@@ -126,6 +126,11 @@ interface ITelecomService {
boolean hasVoiceMailNumber(in PhoneAccountHandle accountHandle);
/**
+ * @see TelecomServiceImpl#getLine1Number
+ */
+ String getLine1Number(in PhoneAccountHandle accountHandle);
+
+ /**
* @see TelecomServiceImpl#getDefaultPhoneApp
*/
ComponentName getDefaultPhoneApp();