Make changes to Telecomm API per review guidelines.

Make changes to Telecomm API per review guidelines in bug:
* Rename componentName to packageName and getComponentName to
  getPackageName in StatusHints
* Hide "ROUTE_ALL" and fix misspelling in AudioState
* Change getHandle to getAddress and remove getHandlePresentation in
  ConnectionRequest

Bug: 17329632

Change-Id: I8b3666cc22d24f470c940825c77a7b4d0701dc16
This commit is contained in:
Nancy Chen
2014-09-05 16:38:49 -07:00
parent 3512bcd3af
commit ea38cca149
7 changed files with 35 additions and 49 deletions

View File

@@ -28216,7 +28216,6 @@ package android.telecomm {
method public int describeContents();
method public void writeToParcel(android.os.Parcel, int);
field public static final android.os.Parcelable.Creator CREATOR;
field public static final int ROUTE_ALL = 15; // 0xf
field public static final int ROUTE_BLUETOOTH = 2; // 0x2
field public static final int ROUTE_EARPIECE = 1; // 0x1
field public static final int ROUTE_SPEAKER = 8; // 0x8
@@ -28233,7 +28232,7 @@ package android.telecomm {
method public void destroy();
method public final int getCapabilities();
method public final java.util.List<android.telecomm.Connection> getConnections();
method public final android.telecomm.PhoneAccountHandle getPhoneAccount();
method public final android.telecomm.PhoneAccountHandle getPhoneAccountHandle();
method public final int getState();
method public void onDisconnect();
method public void onHold();
@@ -28306,12 +28305,11 @@ package android.telecomm {
}
public final class ConnectionRequest implements android.os.Parcelable {
ctor public ConnectionRequest(android.telecomm.PhoneAccountHandle, android.net.Uri, int, android.os.Bundle);
ctor public ConnectionRequest(android.telecomm.PhoneAccountHandle, android.net.Uri, android.os.Bundle);
method public int describeContents();
method public android.telecomm.PhoneAccountHandle getAccountHandle();
method public android.net.Uri getAddress();
method public android.os.Bundle getExtras();
method public android.net.Uri getHandle();
method public int getHandlePresentation();
method public void writeToParcel(android.os.Parcel, int);
field public static final android.os.Parcelable.Creator CREATOR;
}
@@ -28489,11 +28487,11 @@ package android.telecomm {
public final class StatusHints implements android.os.Parcelable {
ctor public StatusHints(android.content.ComponentName, java.lang.CharSequence, int, android.os.Bundle);
method public int describeContents();
method public android.content.ComponentName getComponentName();
method public android.os.Bundle getExtras();
method public android.graphics.drawable.Drawable getIcon(android.content.Context);
method public int getIconResId();
method public java.lang.CharSequence getLabel();
method public android.content.ComponentName getPackageName();
method public void writeToParcel(android.os.Parcel, int);
field public static final android.os.Parcelable.Creator CREATOR;
}

View File

@@ -34,7 +34,7 @@ public final class AudioState implements Parcelable {
/** Direct the audio stream through a wired headset. */
public static final int ROUTE_WIRED_HEADSET = 0x00000004;
/** Direct the audio stream through the device's spakerphone. */
/** Direct the audio stream through the device's speakerphone. */
public static final int ROUTE_SPEAKER = 0x00000008;
/**
@@ -43,7 +43,10 @@ public final class AudioState implements Parcelable {
*/
public static final int ROUTE_WIRED_OR_EARPIECE = ROUTE_EARPIECE | ROUTE_WIRED_HEADSET;
/** Bit mask of all possible audio routes. */
/** Bit mask of all possible audio routes.
*
* @hide
*/
public static final int ROUTE_ALL = ROUTE_EARPIECE | ROUTE_BLUETOOTH | ROUTE_WIRED_HEADSET |
ROUTE_SPEAKER;

View File

@@ -54,7 +54,7 @@ public abstract class Conference {
mPhoneAccount = phoneAccount;
}
public final PhoneAccountHandle getPhoneAccount() {
public final PhoneAccountHandle getPhoneAccountHandle() {
return mPhoneAccount;
}
@@ -171,7 +171,7 @@ public abstract class Conference {
}
/**
* Tears down the conference object and any of it's current connections.
* Tears down the conference object and any of its current connections.
*/
public void destroy() {
Log.d(this, "destroying conference : %s", this);

View File

@@ -29,31 +29,25 @@ public final class ConnectionRequest implements Parcelable {
// TODO: Token to limit recursive invocations
private final PhoneAccountHandle mAccountHandle;
private final Uri mHandle;
private final int mHandlePresentation;
private final Uri mAddress;
private final Bundle mExtras;
private final int mVideoState;
/**
* @param accountHandle The accountHandle which should be used to place the call.
* @param handle The handle (e.g., phone number) to which the {@link Connection} is to connect.
* @param handlePresentation The {@link PropertyPresentation} which controls how the handle
* is shown.
* @param extras Application-specific extra data.
*/
public ConnectionRequest(
PhoneAccountHandle accountHandle,
Uri handle,
int handlePresentation,
Bundle extras) {
this(accountHandle, handle, handlePresentation, extras, VideoProfile.VideoState.AUDIO_ONLY);
this(accountHandle, handle, extras, VideoProfile.VideoState.AUDIO_ONLY);
}
/**
* @param accountHandle The accountHandle which should be used to place the call.
* @param handle The handle (e.g., phone number) to which the {@link Connection} is to connect.
* @param handlePresentation The {@link PropertyPresentation} which controls how the handle
* is shown.
* @param extras Application-specific extra data.
* @param videoState Determines the video state for the connection.
* @hide
@@ -61,20 +55,17 @@ public final class ConnectionRequest implements Parcelable {
public ConnectionRequest(
PhoneAccountHandle accountHandle,
Uri handle,
int handlePresentation,
Bundle extras,
int videoState) {
mAccountHandle = accountHandle;
mHandle = handle;
mHandlePresentation = handlePresentation;
mAddress = handle;
mExtras = extras;
mVideoState = videoState;
}
private ConnectionRequest(Parcel in) {
mAccountHandle = in.readParcelable(getClass().getClassLoader());
mHandle = in.readParcelable(getClass().getClassLoader());
mHandlePresentation = in.readInt();
mAddress = in.readParcelable(getClass().getClassLoader());
mExtras = in.readParcelable(getClass().getClassLoader());
mVideoState = in.readInt();
}
@@ -87,12 +78,7 @@ public final class ConnectionRequest implements Parcelable {
/**
* The handle (e.g., phone number) to which the {@link Connection} is to connect.
*/
public Uri getHandle() { return mHandle; }
/**
* The {@link PropertyPresentation} which controls how the handle is shown.
*/
public int getHandlePresentation() { return mHandlePresentation; }
public Uri getAddress() { return mAddress; }
/**
* Application-specific extra data. Used for passing back information from an incoming
@@ -118,9 +104,9 @@ public final class ConnectionRequest implements Parcelable {
@Override
public String toString() {
return String.format("ConnectionRequest %s %s",
mHandle == null
mAddress == null
? Uri.EMPTY
: Connection.toLogSafePhoneNumber(mHandle.toString()),
: Connection.toLogSafePhoneNumber(mAddress.toString()),
mExtras == null ? "" : mExtras);
}
@@ -147,8 +133,7 @@ public final class ConnectionRequest implements Parcelable {
@Override
public void writeToParcel(Parcel destination, int flags) {
destination.writeParcelable(mAccountHandle, 0);
destination.writeParcelable(mHandle, 0);
destination.writeInt(mHandlePresentation);
destination.writeParcelable(mAddress, 0);
destination.writeParcelable(mExtras, 0);
destination.writeInt(mVideoState);
}

View File

@@ -747,7 +747,7 @@ public abstract class ConnectionService extends Service {
}
}
ParcelableConference parcelableConference = new ParcelableConference(
conference.getPhoneAccount(),
conference.getPhoneAccountHandle(),
conference.getState(),
conference.getCapabilities(),
connectionIds);

View File

@@ -325,8 +325,7 @@ final class RemoteConnectionService {
final String id = UUID.randomUUID().toString();
final ConnectionRequest newRequest = new ConnectionRequest(
request.getAccountHandle(),
request.getHandle(),
request.getHandlePresentation(),
request.getAddress(),
request.getExtras(),
request.getVideoState());
try {

View File

@@ -32,23 +32,24 @@ import java.util.Objects;
*/
public final class StatusHints implements Parcelable {
private final ComponentName mComponentName;
private final ComponentName mPackageName;
private final CharSequence mLabel;
private final int mIconResId;
private final Bundle mExtras;
public StatusHints(ComponentName componentName, CharSequence label, int iconResId, Bundle extras) {
mComponentName = componentName;
public StatusHints(ComponentName packageName, CharSequence label, int iconResId,
Bundle extras) {
mPackageName = packageName;
mLabel = label;
mIconResId = iconResId;
mExtras = extras;
}
/**
* @return A component used to load the icon.
* @return A package used to load the icon.
*/
public ComponentName getComponentName() {
return mComponentName;
public ComponentName getPackageName() {
return mPackageName;
}
/**
@@ -88,7 +89,7 @@ public final class StatusHints implements Parcelable {
@Override
public void writeToParcel(Parcel out, int flags) {
out.writeParcelable(mComponentName, flags);
out.writeParcelable(mPackageName, flags);
out.writeCharSequence(mLabel);
out.writeInt(mIconResId);
out.writeParcelable(mExtras, 0);
@@ -106,7 +107,7 @@ public final class StatusHints implements Parcelable {
};
private StatusHints(Parcel in) {
mComponentName = in.readParcelable(getClass().getClassLoader());
mPackageName = in.readParcelable(getClass().getClassLoader());
mLabel = in.readCharSequence();
mIconResId = in.readInt();
mExtras = in.readParcelable(getClass().getClassLoader());
@@ -115,16 +116,16 @@ public final class StatusHints implements Parcelable {
private Drawable getIcon(Context context, int resId) {
Context packageContext;
try {
packageContext = context.createPackageContext(mComponentName.getPackageName(), 0);
packageContext = context.createPackageContext(mPackageName.getPackageName(), 0);
} catch (PackageManager.NameNotFoundException e) {
Log.e(this, e, "Cannot find package %s", mComponentName.getPackageName());
Log.e(this, e, "Cannot find package %s", mPackageName.getPackageName());
return null;
}
try {
return packageContext.getDrawable(resId);
} catch (MissingResourceException e) {
Log.e(this, e, "Cannot find icon %d in package %s",
resId, mComponentName.getPackageName());
resId, mPackageName.getPackageName());
return null;
}
}
@@ -133,7 +134,7 @@ public final class StatusHints implements Parcelable {
public boolean equals(Object other) {
if (other != null && other instanceof StatusHints) {
StatusHints otherHints = (StatusHints) other;
return Objects.equals(otherHints.getComponentName(), getComponentName()) &&
return Objects.equals(otherHints.getPackageName(), getPackageName()) &&
Objects.equals(otherHints.getLabel(), getLabel()) &&
otherHints.getIconResId() == getIconResId() &&
Objects.equals(otherHints.getExtras(), getExtras());
@@ -143,7 +144,7 @@ public final class StatusHints implements Parcelable {
@Override
public int hashCode() {
return Objects.hashCode(mComponentName) + Objects.hashCode(mLabel) + mIconResId +
return Objects.hashCode(mPackageName) + Objects.hashCode(mLabel) + mIconResId +
Objects.hashCode(mExtras);
}
}