Rename PhoneAccount to PhoneAccountHandle

Change-Id: I2e97b348e6316a8b3ccc39fd81013e7f514a2889
diff --git a/sip/src/com/android/services/telephony/sip/SipBroadcastReceiver.java b/sip/src/com/android/services/telephony/sip/SipBroadcastReceiver.java
index 974e690..d99c97b 100644
--- a/sip/src/com/android/services/telephony/sip/SipBroadcastReceiver.java
+++ b/sip/src/com/android/services/telephony/sip/SipBroadcastReceiver.java
@@ -62,8 +62,8 @@
 
         Intent telecommIntent = new Intent(TelecommManager.ACTION_INCOMING_CALL);
         telecommIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
-        telecommIntent.putExtra(TelecommManager.EXTRA_PHONE_ACCOUNT,
-                SipConnectionService.getPhoneAccount(context));
+        telecommIntent.putExtra(TelecommManager.EXTRA_PHONE_ACCOUNT_HANDLE,
+                SipConnectionService.getPhoneAccountHandle(context));
         telecommIntent.putExtra(TelecommManager.EXTRA_INCOMING_CALL_EXTRAS, extras);
 
         context.startActivityAsUser(telecommIntent, UserHandle.CURRENT);
diff --git a/sip/src/com/android/services/telephony/sip/SipConnectionService.java b/sip/src/com/android/services/telephony/sip/SipConnectionService.java
index a87b398..f2bd120 100644
--- a/sip/src/com/android/services/telephony/sip/SipConnectionService.java
+++ b/sip/src/com/android/services/telephony/sip/SipConnectionService.java
@@ -24,29 +24,24 @@
 import android.net.sip.SipManager;
 import android.net.sip.SipProfile;
 import android.net.Uri;
-import android.os.AsyncTask;
-import android.provider.Settings;
 import android.telecomm.Connection;
 import android.telecomm.ConnectionRequest;
 import android.telecomm.ConnectionService;
-import android.telecomm.PhoneAccount;
+import android.telecomm.PhoneAccountHandle;
 import android.telecomm.Response;
 import android.telephony.DisconnectCause;
-import android.telephony.PhoneNumberUtils;
 import android.util.Log;
 
 import com.android.internal.telephony.CallStateException;
 import com.android.internal.telephony.PhoneFactory;
 import com.android.internal.telephony.sip.SipPhone;
 
-import java.util.HashMap;
-
 public final class SipConnectionService extends ConnectionService {
     private static final String PREFIX = "[SipConnectionService] ";
     private static final boolean VERBOSE = true; /* STOP SHIP if true */
 
-    static PhoneAccount getPhoneAccount(Context context) {
-        return new PhoneAccount(
+    static PhoneAccountHandle getPhoneAccountHandle(Context context) {
+        return new PhoneAccountHandle(
                 new ComponentName(context, SipConnectionService.class),
                 null /* id */);
     }
diff --git a/src/com/android/services/telephony/PstnIncomingCallNotifier.java b/src/com/android/services/telephony/PstnIncomingCallNotifier.java
index a1461df..958d0a4 100644
--- a/src/com/android/services/telephony/PstnIncomingCallNotifier.java
+++ b/src/com/android/services/telephony/PstnIncomingCallNotifier.java
@@ -156,8 +156,8 @@
 
         Intent intent = new Intent(TelecommManager.ACTION_INCOMING_CALL);
         intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
-        intent.putExtra(TelecommManager.EXTRA_PHONE_ACCOUNT,
-                TelecommAccountRegistry.makePstnPhoneAccount(mPhoneProxy));
+        intent.putExtra(TelecommManager.EXTRA_PHONE_ACCOUNT_HANDLE,
+                TelecommAccountRegistry.makePstnPhoneAccountHandle(mPhoneProxy));
 
         Log.d(this, "Sending incoming call intent: %s", intent);
         context.startActivityAsUser(intent, UserHandle.CURRENT);
diff --git a/src/com/android/services/telephony/TelecommAccountRegistry.java b/src/com/android/services/telephony/TelecommAccountRegistry.java
index 331f719..ff475d5 100644
--- a/src/com/android/services/telephony/TelecommAccountRegistry.java
+++ b/src/com/android/services/telephony/TelecommAccountRegistry.java
@@ -19,7 +19,7 @@
 import android.content.ComponentName;
 import android.content.Context;
 import android.net.Uri;
-import android.telecomm.PhoneAccount;
+import android.telecomm.PhoneAccountHandle;
 import android.telecomm.PhoneAccountMetadata;
 import android.telecomm.TelecommManager;
 import android.telephony.TelephonyManager;
@@ -48,22 +48,22 @@
         }
 
         /**
-         * Registers the specified account with Telecomm as a PhoneAccount.
+         * Registers the specified account with Telecomm as a PhoneAccountHandle.
          */
         private PhoneAccountMetadata registerPstnPhoneAccount(boolean isDummyAccount) {
             TelephonyManager telephonyManager = TelephonyManager.from(mContext);
             String dummyPrefix = isDummyAccount ? "Dummy " : "";
 
             // Build the Phone account handle.
-            PhoneAccount phoneAccount = isDummyAccount ?
-                    makePstnPhoneAccountWithPrefix(mPhone, dummyPrefix) :
-                    makePstnPhoneAccount(mPhone);
+            PhoneAccountHandle phoneAccountHandle = isDummyAccount ?
+                    makePstnPhoneAccountHandleWithPrefix(mPhone, dummyPrefix) :
+                    makePstnPhoneAccountHandle(mPhone);
 
             // Populate the phone account data.
             long subId = mPhone.getSubId();
             int slotId = mPhone.getPhoneId() + 1;
             PhoneAccountMetadata metadata = new PhoneAccountMetadata(
-                    phoneAccount,
+                    phoneAccountHandle,
                     Uri.fromParts(TEL_SCHEME, telephonyManager.getLine1Number(subId), null),
                     mPhone.getPhoneSubInfo().getLine1Number(),
                     PhoneAccountMetadata.CAPABILITY_SIM_SUBSCRIPTION |
@@ -123,14 +123,15 @@
         // TODO: Add SIP accounts.
     }
 
-    static PhoneAccount makePstnPhoneAccount(Phone phone) {
-        return makePstnPhoneAccountWithPrefix(phone, "");
+    static PhoneAccountHandle makePstnPhoneAccountHandle(Phone phone) {
+        return makePstnPhoneAccountHandleWithPrefix(phone, "");
     }
 
-    private static PhoneAccount makePstnPhoneAccountWithPrefix(Phone phone, String prefix) {
+    private static PhoneAccountHandle makePstnPhoneAccountHandleWithPrefix(
+            Phone phone, String prefix) {
         ComponentName pstnConnectionServiceName =
                 new ComponentName(phone.getContext(), TelephonyConnectionService.class);
-        return new PhoneAccount(
+        return new PhoneAccountHandle(
                 pstnConnectionServiceName, prefix + String.valueOf(phone.getSubId()));
     }
 }
diff --git a/src/com/android/services/telephony/TelephonyConnectionService.java b/src/com/android/services/telephony/TelephonyConnectionService.java
index 835e74e..a256780 100644
--- a/src/com/android/services/telephony/TelephonyConnectionService.java
+++ b/src/com/android/services/telephony/TelephonyConnectionService.java
@@ -22,7 +22,7 @@
 import android.telecomm.Connection;
 import android.telecomm.ConnectionRequest;
 import android.telecomm.ConnectionService;
-import android.telecomm.PhoneAccount;
+import android.telecomm.PhoneAccountHandle;
 import android.telecomm.Response;
 import android.telephony.DisconnectCause;
 import android.telephony.PhoneNumberUtils;
@@ -273,10 +273,10 @@
         return false;
     }
 
-    private Phone getPhoneForAccount(PhoneAccount account) {
-        if (Objects.equals(mExpectedComponentName, account.getComponentName())) {
+    private Phone getPhoneForAccount(PhoneAccountHandle accountHandle) {
+        if (Objects.equals(mExpectedComponentName, accountHandle.getComponentName())) {
             int phoneId = SubscriptionController.getInstance().getPhoneId(
-                    Long.parseLong(account.getId()));
+                    Long.parseLong(accountHandle.getId()));
             return PhoneFactory.getPhone(phoneId);
         }
         return null;