Make TelecomManager APIs compatible with Lollipop (3/3).
am: 0c4c2782de

* commit '0c4c2782dea7ddf27f4e30c0bf499bc6d02ae083':
  Make TelecomManager APIs compatible with Lollipop (3/3).
diff --git a/InCallUI/src/com/android/incallui/Call.java b/InCallUI/src/com/android/incallui/Call.java
index 161c641..3ec94f9 100644
--- a/InCallUI/src/com/android/incallui/Call.java
+++ b/InCallUI/src/com/android/incallui/Call.java
@@ -34,6 +34,7 @@
 
 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 @@
             return mCameraDirection;
         }
 
+        @Override
         public String toString() {
             return "(CameraDir:" + getCameraDir() + ")";
         }
@@ -609,7 +611,8 @@
 
             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 02c4b99..0b17e1a 100644
--- a/InCallUI/src/com/android/incallui/CallCardPresenter.java
+++ b/InCallUI/src/com/android/incallui/CallCardPresenter.java
@@ -398,7 +398,7 @@
         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());
             }
@@ -836,7 +836,9 @@
         if (accountHandle == null) {
             return null;
         }
-        return InCallPresenter.getInstance().getTelecomManager().getPhoneAccount(accountHandle);
+        return TelecomManagerCompat.getPhoneAccount(
+                InCallPresenter.getInstance().getTelecomManager(),
+                accountHandle);
     }
 
     /**
@@ -856,7 +858,7 @@
         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 d4dbda8..f50da8d 100644
--- a/InCallUI/src/com/android/incallui/InCallPresenter.java
+++ b/InCallUI/src/com/android/incallui/InCallPresenter.java
@@ -44,6 +44,7 @@
 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 @@
             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()) {