diff options
author | 2020-02-13 18:16:25 +0000 | |
---|---|---|
committer | 2020-02-13 18:16:25 +0000 | |
commit | f2a5615087f6271751c4b9f09242f20ceb15ec9e (patch) | |
tree | 29f7a7d2bee4878e796182bbbd7bb7222cf983cf | |
parent | fdfc58fcd9477d1f23ed134da88659ce6d1131fd (diff) | |
parent | c9503d6ea6c8d2089bcc26d6f1751bed9404bc78 (diff) |
Merge "API Review cleanups."
-rw-r--r-- | api/current.txt | 12 | ||||
-rwxr-xr-x | api/system-current.txt | 17 | ||||
-rw-r--r-- | api/test-current.txt | 17 | ||||
-rw-r--r-- | telecomm/java/android/telecom/Call.java | 4 | ||||
-rw-r--r-- | telecomm/java/android/telecom/Conference.java | 88 | ||||
-rw-r--r-- | telecomm/java/android/telecom/Connection.java | 36 | ||||
-rw-r--r-- | telecomm/java/android/telecom/ConnectionService.java | 9 | ||||
-rw-r--r-- | telecomm/java/android/telecom/PhoneAccount.java | 7 | ||||
-rw-r--r-- | telecomm/java/android/telecom/TelecomManager.java | 11 |
9 files changed, 146 insertions, 55 deletions
diff --git a/api/current.txt b/api/current.txt index 5ffb05541621..6cd7d6b9fbd5 100644 --- a/api/current.txt +++ b/api/current.txt @@ -43685,7 +43685,7 @@ package android.telecom { field public static final int DIRECTION_INCOMING = 0; // 0x0 field public static final int DIRECTION_OUTGOING = 1; // 0x1 field public static final int DIRECTION_UNKNOWN = -1; // 0xffffffff - field public static final int PROPERTY_ASSISTED_DIALING_USED = 512; // 0x200 + field public static final int PROPERTY_ASSISTED_DIALING = 512; // 0x200 field public static final int PROPERTY_CONFERENCE = 1; // 0x1 field public static final int PROPERTY_EMERGENCY_CALLBACK_MODE = 4; // 0x4 field public static final int PROPERTY_ENTERPRISE_CALL = 32; // 0x20 @@ -43774,7 +43774,8 @@ package android.telecom { method public final java.util.List<android.telecom.Connection> getConferenceableConnections(); method public final int getConnectionCapabilities(); method public final int getConnectionProperties(); - method public final long getConnectionTime(); + method public final long getConnectionStartElapsedRealtimeMillis(); + method @IntRange(from=0) public final long getConnectionTime(); method public final java.util.List<android.telecom.Connection> getConnections(); method public final android.telecom.DisconnectCause getDisconnectCause(); method public final android.os.Bundle getExtras(); @@ -43804,8 +43805,9 @@ package android.telecom { method public final void setConferenceableConnections(java.util.List<android.telecom.Connection>); method public final void setConnectionCapabilities(int); method public final void setConnectionProperties(int); - method public final void setConnectionStartElapsedRealTime(long); - method public final void setConnectionTime(long); + method @Deprecated public final void setConnectionStartElapsedRealTime(long); + method public final void setConnectionStartElapsedRealtimeMillis(long); + method public final void setConnectionTime(@IntRange(from=0) long); method public final void setDialing(); method public final void setDisconnected(android.telecom.DisconnectCause); method public final void setExtras(@Nullable android.os.Bundle); @@ -43965,7 +43967,7 @@ package android.telecom { field public static final String EXTRA_IS_RTT_AUDIO_PRESENT = "android.telecom.extra.IS_RTT_AUDIO_PRESENT"; field public static final String EXTRA_LAST_FORWARDED_NUMBER = "android.telecom.extra.LAST_FORWARDED_NUMBER"; field public static final String EXTRA_SIP_INVITE = "android.telecom.extra.SIP_INVITE"; - field public static final int PROPERTY_ASSISTED_DIALING_USED = 512; // 0x200 + field public static final int PROPERTY_ASSISTED_DIALING = 512; // 0x200 field public static final int PROPERTY_HAS_CDMA_VOICE_PRIVACY = 32; // 0x20 field public static final int PROPERTY_HIGH_DEF_AUDIO = 4; // 0x4 field public static final int PROPERTY_IS_EXTERNAL_CALL = 16; // 0x10 diff --git a/api/system-current.txt b/api/system-current.txt index c978ef8b700c..469f36768de2 100755 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -8253,27 +8253,26 @@ package android.telecom { public abstract class Conference extends android.telecom.Conferenceable { method @Deprecated public final android.telecom.AudioState getAudioState(); method @Deprecated public final long getConnectTimeMillis(); - method public final long getConnectionStartElapsedRealTime(); method public android.telecom.Connection getPrimaryConnection(); method @NonNull public final String getTelecomCallId(); method @Deprecated public void onAudioStateChanged(android.telecom.AudioState); - method public final void setAddress(@NonNull android.net.Uri, int); + method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public final void setAddress(@NonNull android.net.Uri, int); method public final void setCallerDisplayName(@NonNull String, int); - method public void setConferenceState(boolean); + method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setConferenceState(boolean); method @Deprecated public final void setConnectTimeMillis(long); } public abstract class Connection extends android.telecom.Conferenceable { method @Deprecated public final android.telecom.AudioState getAudioState(); - method public final long getConnectElapsedTimeMillis(); - method public final long getConnectTimeMillis(); + method @IntRange(from=0) public final long getConnectTimeMillis(); + method public final long getConnectionStartElapsedRealtimeMillis(); method @Nullable public android.telecom.PhoneAccountHandle getPhoneAccountHandle(); method @Nullable public final String getTelecomCallId(); method @Deprecated public void onAudioStateChanged(android.telecom.AudioState); method public final void resetConnectionTime(); method public void setCallDirection(int); - method public final void setConnectTimeMillis(long); - method public final void setConnectionStartElapsedRealTime(long); + method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public final void setConnectTimeMillis(@IntRange(from=0) long); + method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public final void setConnectionStartElapsedRealtimeMillis(long); method public void setPhoneAccountHandle(@NonNull android.telecom.PhoneAccountHandle); method public void setTelecomCallId(@NonNull String); field public static final int CAPABILITY_CONFERENCE_HAS_NO_CHILDREN = 2097152; // 0x200000 @@ -8425,7 +8424,7 @@ package android.telecom { } public static class PhoneAccount.Builder { - method @NonNull public android.telecom.PhoneAccount.Builder setGroupId(@NonNull String); + method @NonNull @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public android.telecom.PhoneAccount.Builder setGroupId(@NonNull String); } public class PhoneAccountSuggestionService extends android.app.Service { @@ -8500,7 +8499,7 @@ package android.telecom { method public int getCallState(); method public android.telecom.PhoneAccountHandle getConnectionManager(); method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public int getCurrentTtyMode(); - method @Nullable @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public String getDefaultDialerPackage(int); + method @Nullable @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public String getDefaultDialerPackage(@NonNull android.os.UserHandle); method @Deprecated public android.content.ComponentName getDefaultPhoneApp(); method public java.util.List<android.telecom.PhoneAccountHandle> getPhoneAccountsForPackage(); method @RequiresPermission(anyOf={android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE, android.Manifest.permission.READ_PHONE_STATE}) public java.util.List<android.telecom.PhoneAccountHandle> getPhoneAccountsSupportingScheme(String); diff --git a/api/test-current.txt b/api/test-current.txt index 308afdc7dcee..b3e80a98a2e2 100644 --- a/api/test-current.txt +++ b/api/test-current.txt @@ -3005,23 +3005,22 @@ package android.telecom { } public abstract class Conference extends android.telecom.Conferenceable { - method public final long getConnectionStartElapsedRealTime(); method public android.telecom.Connection getPrimaryConnection(); method @NonNull public final String getTelecomCallId(); - method public final void setAddress(@NonNull android.net.Uri, int); + method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public final void setAddress(@NonNull android.net.Uri, int); method public final void setCallerDisplayName(@NonNull String, int); - method public void setConferenceState(boolean); + method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setConferenceState(boolean); } public abstract class Connection extends android.telecom.Conferenceable { - method public final long getConnectElapsedTimeMillis(); - method public final long getConnectTimeMillis(); + method @IntRange(from=0) public final long getConnectTimeMillis(); + method public final long getConnectionStartElapsedRealtimeMillis(); method @Nullable public android.telecom.PhoneAccountHandle getPhoneAccountHandle(); method @Nullable public final String getTelecomCallId(); method public final void resetConnectionTime(); method public void setCallDirection(int); - method public final void setConnectTimeMillis(long); - method public final void setConnectionStartElapsedRealTime(long); + method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public final void setConnectTimeMillis(@IntRange(from=0) long); + method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public final void setConnectionStartElapsedRealtimeMillis(long); method public void setPhoneAccountHandle(@NonNull android.telecom.PhoneAccountHandle); method public void setTelecomCallId(@NonNull String); field public static final int CAPABILITY_CONFERENCE_HAS_NO_CHILDREN = 2097152; // 0x200000 @@ -3053,7 +3052,7 @@ package android.telecom { } public static class PhoneAccount.Builder { - method @NonNull public android.telecom.PhoneAccount.Builder setGroupId(@NonNull String); + method @NonNull @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public android.telecom.PhoneAccount.Builder setGroupId(@NonNull String); } public class PhoneAccountSuggestionService extends android.app.Service { @@ -3067,7 +3066,7 @@ package android.telecom { public class TelecomManager { method @NonNull @RequiresPermission("android.permission.READ_PRIVILEGED_PHONE_STATE") public java.util.List<android.telecom.PhoneAccountHandle> getCallCapablePhoneAccounts(boolean); method @RequiresPermission("android.permission.READ_PRIVILEGED_PHONE_STATE") public int getCurrentTtyMode(); - method @Nullable @RequiresPermission("android.permission.READ_PRIVILEGED_PHONE_STATE") public String getDefaultDialerPackage(int); + method @Nullable @RequiresPermission("android.permission.READ_PRIVILEGED_PHONE_STATE") public String getDefaultDialerPackage(@NonNull android.os.UserHandle); method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean isInEmergencyCall(); method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setUserSelectedOutgoingPhoneAccount(@Nullable android.telecom.PhoneAccountHandle); field public static final int TTY_MODE_FULL = 1; // 0x1 diff --git a/telecomm/java/android/telecom/Call.java b/telecomm/java/android/telecom/Call.java index cd304b31af0d..52213d8c4fae 100644 --- a/telecomm/java/android/telecom/Call.java +++ b/telecomm/java/android/telecom/Call.java @@ -546,7 +546,7 @@ public final class Call { * * @see TelecomManager#EXTRA_USE_ASSISTED_DIALING */ - public static final int PROPERTY_ASSISTED_DIALING_USED = 0x00000200; + public static final int PROPERTY_ASSISTED_DIALING = 0x00000200; /** * Indicates that the call is an RTT call. Use {@link #getRttCall()} to get the @@ -754,7 +754,7 @@ public final class Call { if (hasProperty(properties, PROPERTY_HAS_CDMA_VOICE_PRIVACY)) { builder.append(" PROPERTY_HAS_CDMA_VOICE_PRIVACY"); } - if (hasProperty(properties, PROPERTY_ASSISTED_DIALING_USED)) { + if (hasProperty(properties, PROPERTY_ASSISTED_DIALING)) { builder.append(" PROPERTY_ASSISTED_DIALING_USED"); } if (hasProperty(properties, PROPERTY_NETWORK_IDENTIFIED_EMERGENCY_CALL)) { diff --git a/telecomm/java/android/telecom/Conference.java b/telecomm/java/android/telecom/Conference.java index c32b37416d69..f019a9d33005 100644 --- a/telecomm/java/android/telecom/Conference.java +++ b/telecomm/java/android/telecom/Conference.java @@ -16,8 +16,13 @@ package android.telecom; +import static android.Manifest.permission.MODIFY_PHONE_STATE; + +import android.annotation.ElapsedRealtimeLong; +import android.annotation.IntRange; import android.annotation.NonNull; import android.annotation.Nullable; +import android.annotation.RequiresPermission; import android.annotation.SystemApi; import android.annotation.TestApi; import android.net.Uri; @@ -632,12 +637,12 @@ public abstract class Conference extends Conferenceable { * Should be specified in wall-clock time returned by {@link System#currentTimeMillis()}. * <p> * When setting the connection time, you should always set the connection elapsed time via - * {@link #setConnectionStartElapsedRealTime(long)} to ensure the duration is reflected. + * {@link #setConnectionStartElapsedRealtimeMillis(long)} to ensure the duration is reflected. * * @param connectionTimeMillis The connection time, in milliseconds, as returned by * {@link System#currentTimeMillis()}. */ - public final void setConnectionTime(long connectionTimeMillis) { + public final void setConnectionTime(@IntRange(from = 0) long connectionTimeMillis) { mConnectTimeMillis = connectionTimeMillis; } @@ -653,8 +658,28 @@ public abstract class Conference extends Conferenceable { * * @param connectionStartElapsedRealTime The connection time, as measured by * {@link SystemClock#elapsedRealtime()}. + * @deprecated use {@link #setConnectionStartElapsedRealtimeMillis(long)} instead. */ + @Deprecated public final void setConnectionStartElapsedRealTime(long connectionStartElapsedRealTime) { + setConnectionStartElapsedRealtimeMillis(connectionStartElapsedRealTime); + } + + /** + * Sets the start time of the {@link Conference} which is the basis for the determining the + * duration of the {@link Conference}. + * <p> + * You should use a value returned by {@link SystemClock#elapsedRealtime()} to ensure that time + * zone changes do not impact the conference duration. + * <p> + * When setting this, you should also set the connection time via + * {@link #setConnectionTime(long)}. + * + * @param connectionStartElapsedRealTime The connection time, as measured by + * {@link SystemClock#elapsedRealtime()}. + */ + public final void setConnectionStartElapsedRealtimeMillis( + @ElapsedRealtimeLong long connectionStartElapsedRealTime) { mConnectionStartElapsedRealTime = connectionStartElapsedRealTime; } @@ -675,7 +700,7 @@ public abstract class Conference extends Conferenceable { * * @return The time at which the {@code Conference} was connected. */ - public final long getConnectionTime() { + public final @IntRange(from = 0) long getConnectionTime() { return mConnectTimeMillis; } @@ -692,11 +717,8 @@ public abstract class Conference extends Conferenceable { * has no general use other than to the Telephony framework. * * @return The elapsed time at which the {@link Conference} was connected. - * @hide */ - @SystemApi - @TestApi - public final long getConnectionStartElapsedRealTime() { + public final @ElapsedRealtimeLong long getConnectionStartElapsedRealtimeMillis() { return mConnectionStartElapsedRealTime; } @@ -994,6 +1016,7 @@ public abstract class Conference extends Conferenceable { */ @SystemApi @TestApi + @RequiresPermission(MODIFY_PHONE_STATE) public void setConferenceState(boolean isConference) { for (Listener l : mListeners) { l.onConferenceStateChanged(this, isConference); @@ -1014,6 +1037,7 @@ public abstract class Conference extends Conferenceable { */ @SystemApi @TestApi + @RequiresPermission(MODIFY_PHONE_STATE) public final void setAddress(@NonNull Uri address, @TelecomManager.Presentation int presentation) { Log.d(this, "setAddress %s", address); @@ -1120,12 +1144,52 @@ public abstract class Conference extends Conferenceable { } /** - * Sends an event associated with this {@code Conference} with associated event extras to the - * {@link InCallService} (note: this is identical in concept to - * {@link Connection#sendConnectionEvent(String, Bundle)}). - * @see Connection#sendConnectionEvent(String, Bundle) + * Sends an event associated with this {@link Conference} with associated event extras to the + * {@link InCallService}. + * <p> + * Connection events are used to communicate point in time information from a + * {@link ConnectionService} to an {@link InCallService} implementation. An example of a + * custom connection event includes notifying the UI when a WIFI call has been handed over to + * LTE, which the InCall UI might use to inform the user that billing charges may apply. The + * Android Telephony framework will send the {@link Connection#EVENT_MERGE_COMPLETE} + * connection event when a call to {@link Call#mergeConference()} has completed successfully. + * <p> + * Events are exposed to {@link InCallService} implementations via + * {@link Call.Callback#onConnectionEvent(Call, String, Bundle)}. + * <p> + * No assumptions should be made as to how an In-Call UI or service will handle these events. + * The {@link ConnectionService} must assume that the In-Call UI could even chose to ignore + * some events altogether. + * <p> + * Events should be fully qualified (e.g. {@code com.example.event.MY_EVENT}) to avoid + * conflicts between {@link ConnectionService} implementations. Further, custom + * {@link ConnectionService} implementations shall not re-purpose events in the + * {@code android.*} namespace, nor shall they define new event types in this namespace. When + * defining a custom event type, ensure the contents of the extras {@link Bundle} is clearly + * defined. Extra keys for this bundle should be named similar to the event type (e.g. + * {@code com.example.extra.MY_EXTRA}). + * <p> + * When defining events and the associated extras, it is important to keep their behavior + * consistent when the associated {@link ConnectionService} is updated. Support for deprecated + * events/extras should me maintained to ensure backwards compatibility with older + * {@link InCallService} implementations which were built to support the older behavior. + * <p> + * Expected connection events from the Telephony stack are: + * <p> + * <ul> + * <li>{@link Connection#EVENT_CALL_HOLD_FAILED} with {@code null} {@code extras} when the + * {@link Conference} could not be held.</li> + * <li>{@link Connection#EVENT_MERGE_START} with {@code null} {@code extras} when a new + * call is being merged into the conference.</li> + * <li>{@link Connection#EVENT_MERGE_COMPLETE} with {@code null} {@code extras} a new call + * has completed being merged into the conference.</li> + * <li>{@link Connection#EVENT_CALL_MERGE_FAILED} with {@code null} {@code extras} a new + * call has failed to merge into the conference (the dialer app can determine which call + * failed to merge based on the fact that the call still exists outside of the conference + * at the end of the merge process).</li> + * </ul> * - * @param event The connection event. + * @param event The conference event. * @param extras Optional bundle containing extra information associated with the event. */ public void sendConferenceEvent(@NonNull String event, @Nullable Bundle extras) { diff --git a/telecomm/java/android/telecom/Connection.java b/telecomm/java/android/telecom/Connection.java index 48ed6ae51139..3b0ba2548660 100644 --- a/telecomm/java/android/telecom/Connection.java +++ b/telecomm/java/android/telecom/Connection.java @@ -16,9 +16,14 @@ package android.telecom; +import static android.Manifest.permission.MODIFY_PHONE_STATE; + +import android.annotation.ElapsedRealtimeLong; import android.annotation.IntDef; +import android.annotation.IntRange; import android.annotation.NonNull; import android.annotation.Nullable; +import android.annotation.RequiresPermission; import android.annotation.SystemApi; import android.annotation.TestApi; import android.app.Notification; @@ -480,7 +485,7 @@ public abstract class Connection extends Conferenceable { * * @see TelecomManager#EXTRA_USE_ASSISTED_DIALING */ - public static final int PROPERTY_ASSISTED_DIALING_USED = 1 << 9; + public static final int PROPERTY_ASSISTED_DIALING = 1 << 9; /** * Set by the framework to indicate that the network has identified a Connection as an emergency @@ -2117,19 +2122,24 @@ public abstract class Connection extends Conferenceable { */ @SystemApi @TestApi - public final long getConnectTimeMillis() { + public final @IntRange(from = 0) long getConnectTimeMillis() { return mConnectTimeMillis; } /** * Retrieves the connection start time of the {@link Connection}, if specified. A value of * {@link Conference#CONNECT_TIME_NOT_SPECIFIED} indicates that Telecom should determine the - * start time of the conference. + * start time of the connection. * <p> * Based on the value of {@link SystemClock#elapsedRealtime()}, which ensures that wall-clock * changes do not impact the call duration. * <p> * Used internally in Telephony when migrating conference participant data for IMS conferences. + * <p> + * The value returned is the same one set using + * {@link #setConnectionStartElapsedRealtimeMillis(long)}. This value is never updated from + * the Telecom framework, so no permission enforcement occurs when retrieving the value with + * this method. * * @return The time at which the {@link Connection} was connected. * @@ -2137,7 +2147,7 @@ public abstract class Connection extends Conferenceable { */ @SystemApi @TestApi - public final long getConnectElapsedTimeMillis() { + public final @ElapsedRealtimeLong long getConnectionStartElapsedRealtimeMillis() { return mConnectElapsedTimeMillis; } @@ -2558,6 +2568,9 @@ public abstract class Connection extends Conferenceable { * Sets the time at which a call became active on this Connection. This is set only * when a conference call becomes active on this connection. * <p> + * This time corresponds to the date/time of connection and is stored in the call log in + * {@link android.provider.CallLog.Calls#DATE}. + * <p> * Used by telephony to maintain calls associated with an IMS Conference. * * @param connectTimeMillis The connection time, in milliseconds. Should be set using a value @@ -2567,7 +2580,8 @@ public abstract class Connection extends Conferenceable { */ @SystemApi @TestApi - public final void setConnectTimeMillis(long connectTimeMillis) { + @RequiresPermission(MODIFY_PHONE_STATE) + public final void setConnectTimeMillis(@IntRange(from = 0) long connectTimeMillis) { mConnectTimeMillis = connectTimeMillis; } @@ -2575,15 +2589,23 @@ public abstract class Connection extends Conferenceable { * Sets the time at which a call became active on this Connection. This is set only * when a conference call becomes active on this connection. * <p> + * This time is used to establish the duration of a call. It uses + * {@link SystemClock#elapsedRealtime()} to ensure that the call duration is not impacted by + * time zone changes during a call. The difference between the current + * {@link SystemClock#elapsedRealtime()} and the value set at the connection start time is used + * to populate {@link android.provider.CallLog.Calls#DURATION} in the call log. + * <p> * Used by telephony to maintain calls associated with an IMS Conference. + * * @param connectElapsedTimeMillis The connection time, in milliseconds. Stored in the format * {@link SystemClock#elapsedRealtime()}. - * * @hide */ @SystemApi @TestApi - public final void setConnectionStartElapsedRealTime(long connectElapsedTimeMillis) { + @RequiresPermission(MODIFY_PHONE_STATE) + public final void setConnectionStartElapsedRealtimeMillis( + @ElapsedRealtimeLong long connectElapsedTimeMillis) { mConnectElapsedTimeMillis = connectElapsedTimeMillis; } diff --git a/telecomm/java/android/telecom/ConnectionService.java b/telecomm/java/android/telecom/ConnectionService.java index f2141d31b596..2aea723cf418 100644 --- a/telecomm/java/android/telecom/ConnectionService.java +++ b/telecomm/java/android/telecom/ConnectionService.java @@ -18,7 +18,6 @@ package android.telecom; import android.annotation.NonNull; import android.annotation.Nullable; -import android.annotation.RequiresPermission; import android.annotation.SdkConstant; import android.annotation.SystemApi; import android.app.Service; @@ -1808,7 +1807,7 @@ public abstract class ConnectionService extends Service { null : conference.getVideoProvider().getInterface(), conference.getVideoState(), conference.getConnectTimeMillis(), - conference.getConnectionStartElapsedRealTime(), + conference.getConnectionStartElapsedRealtimeMillis(), conference.getStatusHints(), conference.getExtras(), conference.getAddress(), @@ -1914,7 +1913,7 @@ public abstract class ConnectionService extends Service { connection.isRingbackRequested(), connection.getAudioModeIsVoip(), connection.getConnectTimeMillis(), - connection.getConnectElapsedTimeMillis(), + connection.getConnectionStartElapsedRealtimeMillis(), connection.getStatusHints(), connection.getDisconnectCause(), createIdList(connection.getConferenceables()), @@ -2415,7 +2414,7 @@ public abstract class ConnectionService extends Service { null : conference.getVideoProvider().getInterface(), conference.getVideoState(), conference.getConnectTimeMillis(), - conference.getConnectionStartElapsedRealTime(), + conference.getConnectionStartElapsedRealtimeMillis(), conference.getStatusHints(), conference.getExtras(), conference.getAddress(), @@ -2506,7 +2505,7 @@ public abstract class ConnectionService extends Service { connection.isRingbackRequested(), connection.getAudioModeIsVoip(), connection.getConnectTimeMillis(), - connection.getConnectElapsedTimeMillis(), + connection.getConnectionStartElapsedRealtimeMillis(), connection.getStatusHints(), connection.getDisconnectCause(), emptyList, diff --git a/telecomm/java/android/telecom/PhoneAccount.java b/telecomm/java/android/telecom/PhoneAccount.java index abb210f13376..6ae4a08abaa3 100644 --- a/telecomm/java/android/telecom/PhoneAccount.java +++ b/telecomm/java/android/telecom/PhoneAccount.java @@ -16,7 +16,10 @@ package android.telecom; +import static android.Manifest.permission.MODIFY_PHONE_STATE; + import android.annotation.NonNull; +import android.annotation.RequiresPermission; import android.annotation.SystemApi; import android.annotation.TestApi; import android.content.Intent; @@ -605,7 +608,8 @@ public final class PhoneAccount implements Parcelable { * time. By default, there is no group Id for a {@link PhoneAccount} (an empty String). Only * grouped {@link PhoneAccount}s with the same {@link ConnectionService} can be replaced. * <p> - * Note: This is an API specific to the Telephony stack. + * Note: This is an API specific to the Telephony stack; the group Id will be ignored for + * callers not holding the correct permission. * * @param groupId The group Id of the {@link PhoneAccount} that will replace any other * registered {@link PhoneAccount} in Telecom with the same Group Id. @@ -614,6 +618,7 @@ public final class PhoneAccount implements Parcelable { */ @SystemApi @TestApi + @RequiresPermission(MODIFY_PHONE_STATE) public @NonNull Builder setGroupId(@NonNull String groupId) { if (groupId != null) { mGroupId = groupId; diff --git a/telecomm/java/android/telecom/TelecomManager.java b/telecomm/java/android/telecom/TelecomManager.java index 7e5fd461fafb..a7024f982247 100644 --- a/telecomm/java/android/telecom/TelecomManager.java +++ b/telecomm/java/android/telecom/TelecomManager.java @@ -802,8 +802,8 @@ public class TelecomManager { * automatically add dialing prefixes when placing international calls. * <p> * Setting this extra on the outgoing call extras will cause the - * {@link Connection#PROPERTY_ASSISTED_DIALING_USED} property and - * {@link Call.Details#PROPERTY_ASSISTED_DIALING_USED} property to be set on the + * {@link Connection#PROPERTY_ASSISTED_DIALING} property and + * {@link Call.Details#PROPERTY_ASSISTED_DIALING} property to be set on the * {@link Connection}/{@link Call} in question. When the call is logged to the call log, the * {@link android.provider.CallLog.Calls#FEATURES_ASSISTED_DIALING_USED} call feature is set to * indicate that assisted dialing was used for the call. @@ -1368,7 +1368,7 @@ public class TelecomManager { /** * Used to determine the currently selected default dialer package for a specific user. * - * @param userId the user id to query the default dialer package for. + * @param userHandle the user id to query the default dialer package for. * @return package name for the default dialer package or null if no package has been * selected as the default dialer. * @hide @@ -1376,10 +1376,11 @@ public class TelecomManager { @SystemApi @TestApi @RequiresPermission(READ_PRIVILEGED_PHONE_STATE) - public @Nullable String getDefaultDialerPackage(int userId) { + public @Nullable String getDefaultDialerPackage(@NonNull UserHandle userHandle) { try { if (isServiceConnected()) { - return getTelecomService().getDefaultDialerPackageForUser(userId); + return getTelecomService().getDefaultDialerPackageForUser( + userHandle.getIdentifier()); } } catch (RemoteException e) { Log.e(TAG, "RemoteException attempting to get the default dialer package name.", e); |