summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNancy Chen <nancychen@google.com>2015-12-22 14:30:59 -0800
committerNancy Chen <nancychen@google.com>2015-12-28 17:41:21 -0800
commit29c01f36e9381b7bad135a9701aa3dffaf495b2f (patch)
treec732fd3a8280dd05a064948578f9bde546ab807c
parent7952f0a140d290f45f76917a3005e56bcb9b52c2 (diff)
Make TelecomManager APIs compatible with Lollipop (3/3).
Convert TelecomManager direct usages to using TelecomManagerCompat instead. Bug: 25776171 Change-Id: I534eb9ff72968f4351aaa0a3856769226c2f1941
-rw-r--r--InCallUI/src/com/android/incallui/Call.java5
-rw-r--r--InCallUI/src/com/android/incallui/CallCardPresenter.java8
-rw-r--r--InCallUI/src/com/android/incallui/InCallPresenter.java4
3 files changed, 12 insertions, 5 deletions
diff --git a/InCallUI/src/com/android/incallui/Call.java b/InCallUI/src/com/android/incallui/Call.java
index f47a4c39a..d82346ebb 100644
--- a/InCallUI/src/com/android/incallui/Call.java
+++ b/InCallUI/src/com/android/incallui/Call.java
@@ -34,6 +34,7 @@ import android.text.TextUtils;
import com.android.contacts.common.CallUtil;
import com.android.contacts.common.compat.SdkVersionOverride;
+import com.android.contacts.common.compat.telecom.TelecomManagerCompat;
import com.android.contacts.common.testing.NeededForTesting;
import com.android.dialer.util.IntentUtil;
import com.android.incallui.compat.telecom.DetailsCompat;
@@ -176,6 +177,7 @@ public class Call {
return mCameraDirection;
}
+ @Override
public String toString() {
return "(CameraDir:" + getCameraDir() + ")";
}
@@ -608,7 +610,8 @@ public class Call {
if (mPhoneAccountHandle != null) {
TelecomManager mgr = InCallPresenter.getInstance().getTelecomManager();
- PhoneAccount phoneAccount = mgr.getPhoneAccount(mPhoneAccountHandle);
+ PhoneAccount phoneAccount =
+ TelecomManagerCompat.getPhoneAccount(mgr, mPhoneAccountHandle);
if (phoneAccount != null) {
mIsCallSubjectSupported = phoneAccount.hasCapabilities(
PhoneAccount.CAPABILITY_CALL_SUBJECT);
diff --git a/InCallUI/src/com/android/incallui/CallCardPresenter.java b/InCallUI/src/com/android/incallui/CallCardPresenter.java
index 47b63c0f9..a0c1cef86 100644
--- a/InCallUI/src/com/android/incallui/CallCardPresenter.java
+++ b/InCallUI/src/com/android/incallui/CallCardPresenter.java
@@ -385,7 +385,7 @@ public class CallCardPresenter extends Presenter<CallCardPresenter.CallCardUi>
PhoneAccountHandle accountHandle = mPrimary.getAccountHandle();
if (accountHandle != null) {
TelecomManager mgr = InCallPresenter.getInstance().getTelecomManager();
- PhoneAccount account = mgr.getPhoneAccount(accountHandle);
+ PhoneAccount account = TelecomManagerCompat.getPhoneAccount(mgr, accountHandle);
if (account != null) {
return getNumberFromHandle(account.getSubscriptionAddress());
}
@@ -823,7 +823,9 @@ public class CallCardPresenter extends Presenter<CallCardPresenter.CallCardUi>
if (accountHandle == null) {
return null;
}
- return InCallPresenter.getInstance().getTelecomManager().getPhoneAccount(accountHandle);
+ return TelecomManagerCompat.getPhoneAccount(
+ InCallPresenter.getInstance().getTelecomManager(),
+ accountHandle);
}
/**
@@ -843,7 +845,7 @@ public class CallCardPresenter extends Presenter<CallCardPresenter.CallCardUi>
PhoneAccount account = getAccountForCall(call);
TelecomManager mgr = InCallPresenter.getInstance().getTelecomManager();
if (account != null && !TextUtils.isEmpty(account.getLabel())
- && mgr.getCallCapablePhoneAccounts().size() > 1) {
+ && TelecomManagerCompat.getCallCapablePhoneAccounts(mgr).size() > 1) {
return account.getLabel().toString();
}
return null;
diff --git a/InCallUI/src/com/android/incallui/InCallPresenter.java b/InCallUI/src/com/android/incallui/InCallPresenter.java
index d4dbda82a..f50da8dbd 100644
--- a/InCallUI/src/com/android/incallui/InCallPresenter.java
+++ b/InCallUI/src/com/android/incallui/InCallPresenter.java
@@ -44,6 +44,7 @@ import android.view.WindowManager;
import com.android.contacts.common.GeoUtil;
import com.android.contacts.common.compat.CompatUtils;
import com.android.contacts.common.compat.SdkVersionOverride;
+import com.android.contacts.common.compat.telecom.TelecomManagerCompat;
import com.android.contacts.common.interactions.TouchPointManager;
import com.android.contacts.common.testing.NeededForTesting;
import com.android.contacts.common.util.MaterialColorMapUtils.MaterialPalette;
@@ -1791,7 +1792,8 @@ public class InCallPresenter implements CallList.Listener,
final TelecomManager tm = getTelecomManager();
if (tm != null) {
- final PhoneAccount account = tm.getPhoneAccount(phoneAccountHandle);
+ final PhoneAccount account =
+ TelecomManagerCompat.getPhoneAccount(tm, phoneAccountHandle);
// For single-sim devices, there will be no selected highlight color, so the phone
// account will default to NO_HIGHLIGHT_COLOR.
if (account != null && CompatUtils.isLollipopMr1Compatible()) {