summaryrefslogtreecommitdiffstats
path: root/telecomm/java/android
diff options
context:
space:
mode:
authorEvan Charlton <evanc@google.com>2014-12-06 01:45:09 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2014-12-06 01:45:12 +0000
commit59dac0e192a920682d42e2da395fb3fa62f4fdc4 (patch)
tree5fa5d965a0fb8fe7bf075bf945460e8958990945 /telecomm/java/android
parent891dd5743af17e3376b0b0438b149c565cf871c8 (diff)
parent134dd68ff980b870ce61eef0a31ea0fa5f96f87d (diff)
downloadframeworks_base-59dac0e192a920682d42e2da395fb3fa62f4fdc4.zip
frameworks_base-59dac0e192a920682d42e2da395fb3fa62f4fdc4.tar.gz
frameworks_base-59dac0e192a920682d42e2da395fb3fa62f4fdc4.tar.bz2
Merge "Associate a UserHandle with each PhoneAccountHandle" into lmp-mr1-dev
Diffstat (limited to 'telecomm/java/android')
-rw-r--r--telecomm/java/android/telecom/PhoneAccount.java15
-rw-r--r--telecomm/java/android/telecom/PhoneAccountHandle.java39
2 files changed, 47 insertions, 7 deletions
diff --git a/telecomm/java/android/telecom/PhoneAccount.java b/telecomm/java/android/telecom/PhoneAccount.java
index 6bd6a2f..052a481 100644
--- a/telecomm/java/android/telecom/PhoneAccount.java
+++ b/telecomm/java/android/telecom/PhoneAccount.java
@@ -105,6 +105,15 @@ public class PhoneAccount implements Parcelable {
public static final int CAPABILITY_PLACE_EMERGENCY_CALLS = 0x10;
/**
+ * Flag indicating that this {@code PhoneAccount} is capable of being used by all users. This
+ * should only be used by system apps (and will be ignored for all other apps trying to use it).
+ * <p>
+ * See {@link #getCapabilities}
+ * @hide
+ */
+ public static final int CAPABILITY_MULTI_USER = 0x20;
+
+ /**
* URI scheme for telephone number URIs.
*/
public static final String SCHEME_TEL = "tel";
@@ -193,6 +202,12 @@ public class PhoneAccount implements Parcelable {
mSupportedUriSchemes.addAll(phoneAccount.getSupportedUriSchemes());
}
+ /** @hide */
+ public Builder setAccountHandle(PhoneAccountHandle accountHandle) {
+ mAccountHandle = accountHandle;
+ return this;
+ }
+
/**
* Sets the address. See {@link PhoneAccount#getAddress}.
*
diff --git a/telecomm/java/android/telecom/PhoneAccountHandle.java b/telecomm/java/android/telecom/PhoneAccountHandle.java
index 7bcf147..97af41a 100644
--- a/telecomm/java/android/telecom/PhoneAccountHandle.java
+++ b/telecomm/java/android/telecom/PhoneAccountHandle.java
@@ -20,6 +20,8 @@ import android.annotation.SystemApi;
import android.content.ComponentName;
import android.os.Parcel;
import android.os.Parcelable;
+import android.os.Process;
+import android.os.UserHandle;
import java.util.Objects;
@@ -38,14 +40,24 @@ import java.util.Objects;
*/
@SystemApi
public class PhoneAccountHandle implements Parcelable {
- private ComponentName mComponentName;
- private String mId;
+ private final ComponentName mComponentName;
+ private final String mId;
+ private final UserHandle mUserHandle;
public PhoneAccountHandle(
ComponentName componentName,
String id) {
+ this(componentName, id, Process.myUserHandle());
+ }
+
+ /** @hide */
+ public PhoneAccountHandle(
+ ComponentName componentName,
+ String id,
+ UserHandle userHandle) {
mComponentName = componentName;
mId = id;
+ mUserHandle = userHandle;
}
/**
@@ -76,9 +88,17 @@ public class PhoneAccountHandle implements Parcelable {
return mId;
}
+ /**
+ * @return the {@link UserHandle} to use when connecting to this PhoneAccount.
+ * @hide
+ */
+ public UserHandle getUserHandle() {
+ return mUserHandle;
+ }
+
@Override
public int hashCode() {
- return Objects.hashCode(mComponentName) + Objects.hashCode(mId);
+ return Objects.hash(mComponentName, mId, mUserHandle);
}
@Override
@@ -88,6 +108,8 @@ public class PhoneAccountHandle implements Parcelable {
return new StringBuilder().append(mComponentName)
.append(", ")
.append(Log.pii(mId))
+ .append(", ")
+ .append(mUserHandle)
.toString();
}
@@ -97,7 +119,8 @@ public class PhoneAccountHandle implements Parcelable {
other instanceof PhoneAccountHandle &&
Objects.equals(((PhoneAccountHandle) other).getComponentName(),
getComponentName()) &&
- Objects.equals(((PhoneAccountHandle) other).getId(), getId());
+ Objects.equals(((PhoneAccountHandle) other).getId(), getId()) &&
+ Objects.equals(((PhoneAccountHandle) other).getUserHandle(), getUserHandle());
}
//
@@ -111,8 +134,9 @@ public class PhoneAccountHandle implements Parcelable {
@Override
public void writeToParcel(Parcel out, int flags) {
- out.writeParcelable(mComponentName, flags);
+ mComponentName.writeToParcel(out, flags);
out.writeString(mId);
+ mUserHandle.writeToParcel(out, flags);
}
public static final Creator<PhoneAccountHandle> CREATOR = new Creator<PhoneAccountHandle>() {
@@ -128,7 +152,8 @@ public class PhoneAccountHandle implements Parcelable {
};
private PhoneAccountHandle(Parcel in) {
- mComponentName = in.readParcelable(getClass().getClassLoader());
- mId = in.readString();
+ this(ComponentName.CREATOR.createFromParcel(in),
+ in.readString(),
+ UserHandle.CREATOR.createFromParcel(in));
}
}