Rename PhoneAccount to PhoneAccountHandle
Change-Id: I2e97b348e6316a8b3ccc39fd81013e7f514a2889
diff --git a/src/com/android/telecomm/Call.java b/src/com/android/telecomm/Call.java
index 0eeb21e..5b5bf09 100644
--- a/src/com/android/telecomm/Call.java
+++ b/src/com/android/telecomm/Call.java
@@ -26,7 +26,7 @@
import android.telecomm.CallState;
import android.telecomm.ConnectionRequest;
import android.telecomm.GatewayInfo;
-import android.telecomm.PhoneAccount;
+import android.telecomm.PhoneAccountHandle;
import android.telecomm.Response;
import android.telecomm.StatusHints;
import android.telephony.DisconnectCause;
@@ -175,7 +175,7 @@
* service. */
private final GatewayInfo mGatewayInfo;
- private PhoneAccount mPhoneAccount;
+ private PhoneAccountHandle mPhoneAccountHandle;
private final Handler mHandler = new Handler();
@@ -276,14 +276,14 @@
ConnectionServiceRepository repository,
Uri handle,
GatewayInfo gatewayInfo,
- PhoneAccount account,
+ PhoneAccountHandle account,
boolean isIncoming,
boolean isConference) {
mState = isConference ? CallState.ACTIVE : CallState.NEW;
mRepository = repository;
setHandle(handle, CallPropertyPresentation.ALLOWED);
mGatewayInfo = gatewayInfo;
- mPhoneAccount = account;
+ mPhoneAccountHandle = account;
mIsIncoming = isIncoming;
mIsConference = isConference;
maybeLoadCannedSmsResponses();
@@ -438,13 +438,13 @@
return mGatewayInfo;
}
- PhoneAccount getPhoneAccount() {
- return mPhoneAccount;
+ PhoneAccountHandle getPhoneAccount() {
+ return mPhoneAccountHandle;
}
- void setPhoneAccount(PhoneAccount account) {
- if (!Objects.equals(mPhoneAccount, account)) {
- mPhoneAccount = account;
+ void setPhoneAccount(PhoneAccountHandle accountHandle) {
+ if (!Objects.equals(mPhoneAccountHandle, accountHandle)) {
+ mPhoneAccountHandle = accountHandle;
for (Listener l : mListeners) {
l.onPhoneAccountChanged(this);
}
@@ -569,7 +569,7 @@
@Override
public void handleCreateConnectionSuccessful(ConnectionRequest request) {
mCreateConnectionProcessor = null;
- mPhoneAccount = request.getAccount();
+ mPhoneAccountHandle = request.getAccount();
if (mIsIncoming) {
// We do not handle incoming calls immediately when they are verified by the connection
diff --git a/src/com/android/telecomm/CallActivity.java b/src/com/android/telecomm/CallActivity.java
index 04a9ff1..6e83173 100644
--- a/src/com/android/telecomm/CallActivity.java
+++ b/src/com/android/telecomm/CallActivity.java
@@ -20,7 +20,7 @@
import android.content.Intent;
import android.content.res.Configuration;
import android.os.Bundle;
-import android.telecomm.PhoneAccount;
+import android.telecomm.PhoneAccountHandle;
import android.telecomm.TelecommManager;
/**
@@ -96,19 +96,19 @@
}
/**
- * Processes INCOMING_CALL intents. Grabs the connection service informations from the intent
+ * Processes INCOMING_CALL intents. Grabs the connection service information from the intent
* extra and forwards that to the CallsManager to start the incoming call flow.
*
* @param intent The incoming call intent.
*/
private void processIncomingCallIntent(Intent intent) {
- PhoneAccount phoneAccount = intent.getParcelableExtra(
- TelecommManager.EXTRA_PHONE_ACCOUNT);
- if (phoneAccount == null) {
+ PhoneAccountHandle phoneAccountHandle = intent.getParcelableExtra(
+ TelecommManager.EXTRA_PHONE_ACCOUNT_HANDLE);
+ if (phoneAccountHandle == null) {
Log.w(this, "Rejecting incoming call due to null phone account");
return;
}
- if (phoneAccount.getComponentName() == null) {
+ if (phoneAccountHandle.getComponentName() == null) {
Log.w(this, "Rejecting incoming call due to null component name");
return;
}
@@ -122,7 +122,7 @@
}
Log.d(this, "Processing incoming call from connection service [%s]",
- phoneAccount.getComponentName());
- mCallsManager.processIncomingCallIntent(phoneAccount, clientExtras);
+ phoneAccountHandle.getComponentName());
+ mCallsManager.processIncomingCallIntent(phoneAccountHandle, clientExtras);
}
}
diff --git a/src/com/android/telecomm/CallLogManager.java b/src/com/android/telecomm/CallLogManager.java
index d1e2196..cc1ec24 100644
--- a/src/com/android/telecomm/CallLogManager.java
+++ b/src/com/android/telecomm/CallLogManager.java
@@ -21,7 +21,7 @@
import android.os.AsyncTask;
import android.provider.CallLog.Calls;
import android.telecomm.CallState;
-import android.telecomm.PhoneAccount;
+import android.telecomm.PhoneAccountHandle;
import android.telecomm.VideoCallProfile;
import android.telephony.PhoneNumberUtils;
@@ -39,7 +39,7 @@
*/
private static class AddCallArgs {
/**
- * @param contactInfo Caller details.
+ * @param callerInfo Caller details.
* @param number The phone number to be logged.
* @param presentation Number presentation of the phone number to be logged.
* @param callType The type of call (e.g INCOMING_TYPE). @see
@@ -51,7 +51,7 @@
* @param dataUsage Data usage in bytes, or null if not applicable.
*/
public AddCallArgs(Context context, CallerInfo callerInfo, String number,
- int presentation, int callType, int features, PhoneAccount account,
+ int presentation, int callType, int features, PhoneAccountHandle accountHandle,
long creationDate, long durationInMillis, Long dataUsage) {
this.context = context;
this.callerInfo = callerInfo;
@@ -59,7 +59,7 @@
this.presentation = presentation;
this.callType = callType;
this.features = features;
- this.mAccount = account;
+ this.accountHandle = accountHandle;
this.timestamp = creationDate;
this.durationInSec = (int)(durationInMillis / 1000);
this.dataUsage = dataUsage;
@@ -72,7 +72,7 @@
public final int presentation;
public final int callType;
public final int features;
- public final PhoneAccount mAccount;
+ public final PhoneAccountHandle accountHandle;
public final long timestamp;
public final int durationInSec;
public final Long dataUsage;
@@ -119,7 +119,7 @@
Log.d(TAG, "logNumber set to: %s", Log.pii(logNumber));
final int presentation = getPresentation(call);
- final PhoneAccount account = call.getPhoneAccount();
+ final PhoneAccountHandle account = call.getPhoneAccount();
// TODO(vt): Once data usage is available, wire it up here.
int callFeatures = getCallFeatures(call.getVideoStateHistory());
@@ -145,7 +145,7 @@
int presentation,
int callType,
int features,
- PhoneAccount account,
+ PhoneAccountHandle accountHandle,
long start,
long duration,
Long dataUsage) {
@@ -165,7 +165,7 @@
+ Log.pii(number) + "," + presentation + ", " + callType
+ ", " + start + ", " + duration);
AddCallArgs args = new AddCallArgs(mContext, callerInfo, number, presentation,
- callType, features, account, start, duration, dataUsage);
+ callType, features, accountHandle, start, duration, dataUsage);
logCallAsync(args);
} else {
Log.d(TAG, "Not adding emergency call to call log.");
@@ -249,7 +249,7 @@
try {
// May block.
result[i] = Calls.addCall(c.callerInfo, c.context, c.number, c.presentation,
- c.callType, c.features, c.mAccount, c.timestamp, c.durationInSec,
+ c.callType, c.features, c.accountHandle, c.timestamp, c.durationInSec,
c.dataUsage);
} catch (Exception e) {
// This is very rare but may happen in legitimate cases.
diff --git a/src/com/android/telecomm/CallsManager.java b/src/com/android/telecomm/CallsManager.java
index 5a53525..e41f331 100644
--- a/src/com/android/telecomm/CallsManager.java
+++ b/src/com/android/telecomm/CallsManager.java
@@ -21,7 +21,7 @@
import android.telecomm.CallAudioState;
import android.telecomm.CallState;
import android.telecomm.GatewayInfo;
-import android.telecomm.PhoneAccount;
+import android.telecomm.PhoneAccountHandle;
import android.telephony.DisconnectCause;
import com.google.common.base.Preconditions;
@@ -254,11 +254,11 @@
/**
* Starts the process to attach the call to a connection service.
*
- * @param phoneAccount The phone account which contains the component name of the connection
+ * @param phoneAccountHandle The phone account which contains the component name of the connection
* serivce to use for this call.
* @param extras The optional extras Bundle passed with the intent used for the incoming call.
*/
- void processIncomingCallIntent(PhoneAccount phoneAccount, Bundle extras) {
+ void processIncomingCallIntent(PhoneAccountHandle phoneAccountHandle, Bundle extras) {
Log.d(this, "processIncomingCallIntent");
// Create a call with no handle. The handle is eventually set when the call is attached
// to a connection service.
@@ -266,7 +266,7 @@
mConnectionServiceRepository,
null /* handle */,
null /* gatewayInfo */,
- phoneAccount,
+ phoneAccountHandle,
true /* isIncoming */,
false /* isConference */);
@@ -285,7 +285,7 @@
* @param speakerphoneOn Whether or not to turn the speakerphone on once the call connects.
* @param videoState The desired video state for the outgoing call.
*/
- void placeOutgoingCall(Uri handle, GatewayInfo gatewayInfo, PhoneAccount account,
+ void placeOutgoingCall(Uri handle, GatewayInfo gatewayInfo, PhoneAccountHandle accountHandle,
boolean speakerphoneOn, int videoState) {
final Uri uriHandle = (gatewayInfo == null) ? handle : gatewayInfo.getGatewayHandle();
@@ -301,7 +301,7 @@
mConnectionServiceRepository,
uriHandle,
gatewayInfo,
- account,
+ accountHandle,
false /* isIncoming */,
false /* isConference */);
call.setStartWithSpeakerphoneOn(speakerphoneOn);
@@ -315,11 +315,11 @@
// Emergency -- CreateConnectionProcessor will choose accounts automatically
call.setPhoneAccount(null);
call.startCreateConnection();
- } else if (account == null) {
- PhoneAccount defaultAccount = TelecommApp.getInstance().getPhoneAccountRegistrar()
- .getDefaultOutgoingPhoneAccount();
- if (defaultAccount != null) {
- call.setPhoneAccount(defaultAccount);
+ } else if (accountHandle == null) {
+ PhoneAccountHandle defaultAccountHandle = TelecommApp.getInstance()
+ .getPhoneAccountRegistrar().getDefaultOutgoingPhoneAccount();
+ if (defaultAccountHandle != null) {
+ call.setPhoneAccount(defaultAccountHandle);
call.startCreateConnection();
} else {
call.setState(CallState.PRE_DIAL_WAIT);
@@ -496,7 +496,7 @@
}
}
- void phoneAccountSelected(Call call, PhoneAccount account) {
+ void phoneAccountSelected(Call call, PhoneAccountHandle account) {
if (!mCalls.contains(call)) {
Log.i(this, "Attemped to add account to unknown call %s", call);
} else {
diff --git a/src/com/android/telecomm/CreateConnectionProcessor.java b/src/com/android/telecomm/CreateConnectionProcessor.java
index 45008c0..6a2b796 100644
--- a/src/com/android/telecomm/CreateConnectionProcessor.java
+++ b/src/com/android/telecomm/CreateConnectionProcessor.java
@@ -16,7 +16,7 @@
package com.android.telecomm;
-import android.telecomm.PhoneAccount;
+import android.telecomm.PhoneAccountHandle;
import android.telephony.DisconnectCause;
import android.telecomm.ConnectionRequest;
@@ -34,8 +34,8 @@
final class CreateConnectionProcessor {
private final Call mCall;
private final ConnectionServiceRepository mRepository;
- private List<PhoneAccount> mPhoneAccounts;
- private Iterator<PhoneAccount> mPhoneAccountIterator;
+ private List<PhoneAccountHandle> mPhoneAccountHandles;
+ private Iterator<PhoneAccountHandle> mPhoneAccountIterator;
private CreateConnectionResponse mResponse;
private int mLastErrorCode = DisconnectCause.ERROR_UNSPECIFIED;
private String mLastErrorMsg;
@@ -49,12 +49,12 @@
void process() {
Log.v(this, "process");
- mPhoneAccounts = new ArrayList<>();
+ mPhoneAccountHandles = new ArrayList<>();
if (mCall.getPhoneAccount() != null) {
- mPhoneAccounts.add(mCall.getPhoneAccount());
+ mPhoneAccountHandles.add(mCall.getPhoneAccount());
}
adjustPhoneAccountsForEmergency();
- mPhoneAccountIterator = mPhoneAccounts.iterator();
+ mPhoneAccountIterator = mPhoneAccountHandles.iterator();
attemptNextPhoneAccount();
}
@@ -80,7 +80,7 @@
Log.v(this, "attemptNextPhoneAccount");
if (mResponse != null && mPhoneAccountIterator.hasNext()) {
- PhoneAccount account = mPhoneAccountIterator.next();
+ PhoneAccountHandle account = mPhoneAccountIterator.next();
Log.i(this, "Trying account %s", account);
ConnectionServiceWrapper service = mRepository.getService(account.getComponentName());
if (service == null) {
@@ -107,13 +107,13 @@
private void adjustPhoneAccountsForEmergency() {
if (TelephonyUtil.shouldProcessAsEmergency(TelecommApp.getInstance(), mCall.getHandle())) {
Log.i(this, "Emergency number detected");
- mPhoneAccounts.clear();
- List<PhoneAccount> allAccounts = TelecommApp.getInstance().getPhoneAccountRegistrar()
+ mPhoneAccountHandles.clear();
+ List<PhoneAccountHandle> allAccounts = TelecommApp.getInstance().getPhoneAccountRegistrar()
.getEnabledPhoneAccounts();
for (int i = 0; i < allAccounts.size(); i++) {
if (TelephonyUtil.isPstnComponentName(allAccounts.get(i).getComponentName())) {
Log.i(this, "Will try PSTN account %s for emergency", allAccounts.get(i));
- mPhoneAccounts.add(allAccounts.get(i));
+ mPhoneAccountHandles.add(allAccounts.get(i));
}
}
}
diff --git a/src/com/android/telecomm/InCallAdapter.java b/src/com/android/telecomm/InCallAdapter.java
index 0822dc4..31a009e 100644
--- a/src/com/android/telecomm/InCallAdapter.java
+++ b/src/com/android/telecomm/InCallAdapter.java
@@ -18,7 +18,7 @@
import android.os.Handler;
import android.os.Message;
-import android.telecomm.PhoneAccount;
+import android.telecomm.PhoneAccountHandle;
import com.android.internal.os.SomeArgs;
import com.android.internal.telecomm.IInCallAdapter;
@@ -144,7 +144,7 @@
try {
call = mCallIdMapper.getCall(args.arg1);
if (call != null) {
- mCallsManager.phoneAccountSelected(call, (PhoneAccount) args.arg2);
+ mCallsManager.phoneAccountSelected(call, (PhoneAccountHandle) args.arg2);
} else {
Log.w(this, "phoneAccountSelected, unknown call id: %s", args.arg1);
}
@@ -266,11 +266,11 @@
}
@Override
- public void phoneAccountSelected(String callId, PhoneAccount account) {
+ public void phoneAccountSelected(String callId, PhoneAccountHandle accountHandle) {
mCallIdMapper.checkValidCallId(callId);
SomeArgs args = SomeArgs.obtain();
args.arg1 = callId;
- args.arg2 = account;
+ args.arg2 = accountHandle;
mHandler.obtainMessage(MSG_PHONE_ACCOUNT_SELECTED, args).sendToTarget();
}
diff --git a/src/com/android/telecomm/NewOutgoingCallIntentBroadcaster.java b/src/com/android/telecomm/NewOutgoingCallIntentBroadcaster.java
index 2dee24f..d99d976 100644
--- a/src/com/android/telecomm/NewOutgoingCallIntentBroadcaster.java
+++ b/src/com/android/telecomm/NewOutgoingCallIntentBroadcaster.java
@@ -24,7 +24,7 @@
import android.net.Uri;
import android.os.UserHandle;
import android.telecomm.GatewayInfo;
-import android.telecomm.PhoneAccount;
+import android.telecomm.PhoneAccountHandle;
import android.telecomm.TelecommManager;
import android.telecomm.VideoCallProfile;
import android.telephony.PhoneNumberUtils;
@@ -116,8 +116,8 @@
}
GatewayInfo gatewayInfo = getGateWayInfoFromIntent(intent, resultHandleUri);
- PhoneAccount account = getAccountFromIntent(intent);
- mCallsManager.placeOutgoingCall(resultHandleUri, gatewayInfo, account,
+ PhoneAccountHandle accountHandle = getAccountHandleFromIntent(intent);
+ mCallsManager.placeOutgoingCall(resultHandleUri, gatewayInfo, accountHandle,
mIntent.getBooleanExtra(TelecommManager.EXTRA_START_CALL_WITH_SPEAKERPHONE,
false),
mIntent.getIntExtra(TelecommManager.EXTRA_START_CALL_WITH_VIDEO_STATE,
@@ -261,9 +261,10 @@
Log.d(this, "Found and copied gateway provider extras to broadcast intent.");
return;
}
- PhoneAccount extraAccount = src.getParcelableExtra(TelecommManager.EXTRA_PHONE_ACCOUNT);
- if (extraAccount != null) {
- dst.putExtra(TelecommManager.EXTRA_PHONE_ACCOUNT, extraAccount);
+ PhoneAccountHandle extraAccountHandle =
+ src.getParcelableExtra(TelecommManager.EXTRA_PHONE_ACCOUNT_HANDLE);
+ if (extraAccountHandle != null) {
+ dst.putExtra(TelecommManager.EXTRA_PHONE_ACCOUNT_HANDLE, extraAccountHandle);
Log.d(this, "Found and copied account extra to broadcast intent.");
}
@@ -316,12 +317,12 @@
* @param intent to extract account information from.
* @return Account object containing extracted account information
*/
- public static PhoneAccount getAccountFromIntent(Intent intent) {
+ public static PhoneAccountHandle getAccountHandleFromIntent(Intent intent) {
if (intent == null) {
return null;
}
- return intent.getParcelableExtra(TelecommManager.EXTRA_PHONE_ACCOUNT);
+ return intent.getParcelableExtra(TelecommManager.EXTRA_PHONE_ACCOUNT_HANDLE);
}
private void launchSystemDialer(Context context, Uri handle) {
diff --git a/src/com/android/telecomm/PhoneAccountPreferencesActivity.java b/src/com/android/telecomm/PhoneAccountPreferencesActivity.java
index 2988a9c..e80b413 100644
--- a/src/com/android/telecomm/PhoneAccountPreferencesActivity.java
+++ b/src/com/android/telecomm/PhoneAccountPreferencesActivity.java
@@ -21,7 +21,7 @@
import android.preference.ListPreference;
import android.preference.Preference;
import android.preference.PreferenceFragment;
-import android.telecomm.PhoneAccount;
+import android.telecomm.PhoneAccountHandle;
import java.util.HashMap;
import java.util.List;
@@ -42,7 +42,7 @@
implements ListPreference.OnPreferenceChangeListener {
private ListPreference mDefaultOutgoingAccount;
private PhoneAccountRegistrar mRegistrar;
- private Map<String, PhoneAccount> mAccountByValue = new HashMap<>();
+ private Map<String, PhoneAccountHandle> mAccountByValue = new HashMap<>();
@Override
public void onCreate(Bundle savedInstanceState) {
@@ -52,23 +52,23 @@
mDefaultOutgoingAccount = (ListPreference) findPreference(KEY_DEFAULT_OUTGOING_ACCOUNT);
mRegistrar = TelecommApp.getInstance().getPhoneAccountRegistrar();
- List<PhoneAccount> accounts = mRegistrar.getEnabledPhoneAccounts();
- PhoneAccount currentDefault = mRegistrar.getDefaultOutgoingPhoneAccount();
+ List<PhoneAccountHandle> accountHandles = mRegistrar.getEnabledPhoneAccounts();
+ PhoneAccountHandle currentDefault = mRegistrar.getDefaultOutgoingPhoneAccount();
- String[] entryValues = new String[accounts.size() + 1];
- String[] entries = new String[accounts.size() + 1];
+ String[] entryValues = new String[accountHandles.size() + 1];
+ String[] entries = new String[accountHandles.size() + 1];
- int selectedIndex = accounts.size(); // Points to "ask every time" by default
+ int selectedIndex = accountHandles.size(); // Points to "ask every time" by default
int i = 0;
- for ( ; i < accounts.size(); i++) {
+ for ( ; i < accountHandles.size(); i++) {
entryValues[i] = Integer.toString(i);
entries[i] = mRegistrar
- .getPhoneAccountMetadata(accounts.get(i))
+ .getPhoneAccountMetadata(accountHandles.get(i))
.getLabel();
- if (Objects.equals(currentDefault, accounts.get(i))) {
+ if (Objects.equals(currentDefault, accountHandles.get(i))) {
selectedIndex = i;
}
- mAccountByValue.put(entryValues[i], accounts.get(i));
+ mAccountByValue.put(entryValues[i], accountHandles.get(i));
}
entryValues[i] = Integer.toString(i);
entries[i] = getString(R.string.account_ask_every_time);
diff --git a/src/com/android/telecomm/PhoneAccountRegistrar.java b/src/com/android/telecomm/PhoneAccountRegistrar.java
index 2deb557..a739250 100644
--- a/src/com/android/telecomm/PhoneAccountRegistrar.java
+++ b/src/com/android/telecomm/PhoneAccountRegistrar.java
@@ -16,6 +16,7 @@
package com.android.telecomm;
+import android.telecomm.PhoneAccountHandle;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
@@ -26,7 +27,6 @@
import android.content.SharedPreferences;
import android.net.Uri;
-import android.telecomm.PhoneAccount;
import android.telecomm.PhoneAccountMetadata;
import android.telecomm.TelecommManager;
@@ -35,11 +35,11 @@
import java.util.Objects;
/**
- * Handles writing and reading PhoneAccount registration entries. This is a simple verbatim
+ * Handles writing and reading PhoneAccountHandle registration entries. This is a simple verbatim
* delegate for all the account handling methods on {@link TelecommManager} as implemented in
* {@link TelecommServiceImpl}, with the notable exception that {@link TelecommServiceImpl} is
* responsible for security checking to make sure that the caller has proper authority over
- * the {@code ComponentName}s they are declaring in their {@code PhoneAccount}s.
+ * the {@code ComponentName}s they are declaring in their {@code PhoneAccountHandle}s.
*
* TODO(santoscordon): Replace this implementation with a proper database stored in a Telecomm
* provider.
@@ -54,46 +54,47 @@
mContext = context;
}
- public PhoneAccount getDefaultOutgoingPhoneAccount() {
+ public PhoneAccountHandle getDefaultOutgoingPhoneAccount() {
State s = read();
- return s.defaultOutgoing;
+ return s.defaultOutgoingHandle;
}
- public void setDefaultOutgoingPhoneAccount(PhoneAccount account) {
+ public void setDefaultOutgoingPhoneAccount(PhoneAccountHandle accountHandle) {
State s = read();
- if (account == null) {
+ if (accountHandle == null) {
// Asking to clear the default outgoing is a valid request
- s.defaultOutgoing = null;
+ s.defaultOutgoingHandle = null;
} else {
boolean found = false;
for (PhoneAccountMetadata m : s.accounts) {
- if (Objects.equals(account, m.getAccount())) {
+ if (Objects.equals(accountHandle, m.getAccount())) {
found = true;
break;
}
}
if (!found) {
- Log.d(this, "Trying to set nonexistent default outgoing phone account %s", account);
+ Log.w(this, "Trying to set nonexistent default outgoing phone accountHandle %s",
+ accountHandle);
return;
}
- s.defaultOutgoing = account;
+ s.defaultOutgoingHandle = accountHandle;
}
write(s);
}
- public List<PhoneAccount> getEnabledPhoneAccounts() {
+ public List<PhoneAccountHandle> getEnabledPhoneAccounts() {
State s = read();
- return accountsOnly(s);
+ return accountHandlesOnly(s);
}
- public PhoneAccountMetadata getPhoneAccountMetadata(PhoneAccount account) {
+ public PhoneAccountMetadata getPhoneAccountMetadata(PhoneAccountHandle accountHandle) {
State s = read();
for (PhoneAccountMetadata m : s.accounts) {
- if (Objects.equals(account, m.getAccount())) {
+ if (Objects.equals(accountHandle, m.getAccount())) {
return m;
}
}
@@ -118,11 +119,11 @@
write(s);
}
- public void unregisterPhoneAccount(PhoneAccount account) {
+ public void unregisterPhoneAccount(PhoneAccountHandle accountHandle) {
State s = read();
for (int i = 0; i < s.accounts.size(); i++) {
- if (Objects.equals(account, s.accounts.get(i).getAccount())) {
+ if (Objects.equals(accountHandle, s.accounts.get(i).getAccount())) {
s.accounts.remove(i);
break;
}
@@ -153,15 +154,15 @@
// Check that, after an operation that removes accounts, the account set up as the "default
// outgoing" has not been deleted. If it has, then clear out the setting.
for (PhoneAccountMetadata m : s.accounts) {
- if (Objects.equals(s.defaultOutgoing, m.getAccount())) {
+ if (Objects.equals(s.defaultOutgoingHandle, m.getAccount())) {
return;
}
}
- s.defaultOutgoing = null;
+ s.defaultOutgoingHandle = null;
}
- private List<PhoneAccount> accountsOnly(State s) {
- List<PhoneAccount> result = new ArrayList<>();
+ private List<PhoneAccountHandle> accountHandlesOnly(State s) {
+ List<PhoneAccountHandle> result = new ArrayList<>();
for (PhoneAccountMetadata m : s.accounts) {
result.add(m.getAccount());
}
@@ -214,7 +215,7 @@
}
private static class State {
- public PhoneAccount defaultOutgoing = null;
+ public PhoneAccountHandle defaultOutgoingHandle = null;
public final List<PhoneAccountMetadata> accounts = new ArrayList<>();
}
@@ -235,8 +236,8 @@
@Override
public JSONObject toJson(State o) throws JSONException {
JSONObject json = new JSONObject();
- if (o.defaultOutgoing != null) {
- json.put(DEFAULT_OUTGOING, sPhoneAccountJson.toJson(o.defaultOutgoing));
+ if (o.defaultOutgoingHandle != null) {
+ json.put(DEFAULT_OUTGOING, sPhoneAccountJson.toJson(o.defaultOutgoingHandle));
}
JSONArray accounts = new JSONArray();
for (PhoneAccountMetadata m : o.accounts) {
@@ -250,7 +251,7 @@
public State fromJson(JSONObject json) throws JSONException {
State s = new State();
if (json.has(DEFAULT_OUTGOING)) {
- s.defaultOutgoing = sPhoneAccountJson.fromJson(
+ s.defaultOutgoingHandle = sPhoneAccountJson.fromJson(
(JSONObject) json.get(DEFAULT_OUTGOING));
}
if (json.has(ACCOUNTS)) {
@@ -306,21 +307,21 @@
}
};
- private static final Json<PhoneAccount> sPhoneAccountJson =
- new Json<PhoneAccount>() {
+ private static final Json<PhoneAccountHandle> sPhoneAccountJson =
+ new Json<PhoneAccountHandle>() {
private static final String COMPONENT_NAME = "component_name";
private static final String ID = "id";
@Override
- public JSONObject toJson(PhoneAccount o) throws JSONException {
+ public JSONObject toJson(PhoneAccountHandle o) throws JSONException {
return new JSONObject()
.put(COMPONENT_NAME, o.getComponentName().flattenToString())
.put(ID, o.getId());
}
@Override
- public PhoneAccount fromJson(JSONObject json) throws JSONException {
- return new PhoneAccount(
+ public PhoneAccountHandle fromJson(JSONObject json) throws JSONException {
+ return new PhoneAccountHandle(
ComponentName.unflattenFromString((String) json.get(COMPONENT_NAME)),
(String) json.get(ID));
}
diff --git a/src/com/android/telecomm/TelecommApp.java b/src/com/android/telecomm/TelecommApp.java
index 15e489a..3884d08 100644
--- a/src/com/android/telecomm/TelecommApp.java
+++ b/src/com/android/telecomm/TelecommApp.java
@@ -20,9 +20,8 @@
import android.content.ComponentName;
import android.net.Uri;
import android.os.UserHandle;
-import android.telecomm.PhoneAccount;
+import android.telecomm.PhoneAccountHandle;
import android.telecomm.PhoneAccountMetadata;
-import android.telephony.PhoneNumberUtils;
/**
* Top-level Application class for Telecomm.
@@ -39,7 +38,7 @@
private MissedCallNotifier mMissedCallNotifier;
/**
- * Maintains the list of registered {@link android.telecomm.PhoneAccount}s.
+ * Maintains the list of registered {@link android.telecomm.PhoneAccountHandle}s.
*/
private PhoneAccountRegistrar mPhoneAccountRegistrar;
@@ -74,11 +73,11 @@
}
private void addHangoutsAccount() {
- // TODO: STOPSHIP. We are adding a hacked PhoneAccount to ensure that Wi-Fi calling in
+ // TODO: STOPSHIP. We are adding a hacked PhoneAccountHandle to ensure that Wi-Fi calling in
// Hangouts continues to work. This needs to be replaced with proper Wi-Fi calling wiring
// to the appropriate Connection Services.
PhoneAccountMetadata hangouts = new PhoneAccountMetadata(
- new PhoneAccount(
+ new PhoneAccountHandle(
new ComponentName(
"com.google.android.talk",
"com.google.android.apps.babel.telephony.TeleConnectionService"),
diff --git a/src/com/android/telecomm/TelecommServiceImpl.java b/src/com/android/telecomm/TelecommServiceImpl.java
index a9bbf8e..d413642 100644
--- a/src/com/android/telecomm/TelecommServiceImpl.java
+++ b/src/com/android/telecomm/TelecommServiceImpl.java
@@ -27,7 +27,7 @@
import android.os.ServiceManager;
import android.phone.PhoneManager;
import android.telecomm.CallState;
-import android.telecomm.PhoneAccount;
+import android.telecomm.PhoneAccountHandle;
import android.telecomm.PhoneAccountMetadata;
import android.telecomm.TelecommManager;
import android.telephony.TelephonyManager;
@@ -147,7 +147,7 @@
//
@Override
- public PhoneAccount getDefaultOutgoingPhoneAccount() {
+ public PhoneAccountHandle getDefaultOutgoingPhoneAccount() {
try {
return mPhoneAccountRegistrar.getDefaultOutgoingPhoneAccount();
} catch (Exception e) {
@@ -157,7 +157,7 @@
}
@Override
- public List<PhoneAccount> getEnabledPhoneAccounts() {
+ public List<PhoneAccountHandle> getEnabledPhoneAccounts() {
try {
return mPhoneAccountRegistrar.getEnabledPhoneAccounts();
} catch (Exception e) {
@@ -167,7 +167,7 @@
}
@Override
- public PhoneAccountMetadata getPhoneAccountMetadata(PhoneAccount account) {
+ public PhoneAccountMetadata getPhoneAccountMetadata(PhoneAccountHandle account) {
try {
return mPhoneAccountRegistrar.getPhoneAccountMetadata(account);
} catch (Exception e) {
@@ -189,7 +189,7 @@
}
@Override
- public void unregisterPhoneAccount(PhoneAccount account) {
+ public void unregisterPhoneAccount(PhoneAccountHandle account) {
try {
enforceModifyPermissionOrCallingPackage(account.getComponentName().getPackageName());
mPhoneAccountRegistrar.unregisterPhoneAccount(account);