Merge "API Review cleanups."

This commit is contained in:
Tyler Gunn
2020-02-13 16:05:53 +00:00
committed by Android (Google) Code Review
11 changed files with 150 additions and 57 deletions

View File

@@ -45514,7 +45514,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
@@ -45603,7 +45603,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();
@@ -45633,8 +45634,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);
@@ -45794,7 +45796,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

View File

@@ -10854,27 +10854,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
@@ -11033,7 +11032,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 {
@@ -11108,7 +11107,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);

View File

@@ -3441,23 +3441,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
@@ -3489,7 +3488,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 {
@@ -3503,7 +3502,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

View File

@@ -322,7 +322,8 @@ public class DataManager {
private void updateDefaultDialer(@NonNull UserData userData) {
TelecomManager telecomManager = mContext.getSystemService(TelecomManager.class);
String defaultDialer = telecomManager != null
? telecomManager.getDefaultDialerPackage(userData.getUserId()) : null;
? telecomManager.getDefaultDialerPackage(
new UserHandle(userData.getUserId())) : null;
userData.setDefaultDialer(defaultDialer);
}

View File

@@ -142,7 +142,8 @@ public final class DataManagerTest {
when(mContext.getSystemService(Context.TELECOM_SERVICE)).thenReturn(mTelecomManager);
when(mContext.getSystemServiceName(TelecomManager.class)).thenReturn(
Context.TELECOM_SERVICE);
when(mTelecomManager.getDefaultDialerPackage(anyInt())).thenReturn(TEST_PKG_NAME);
when(mTelecomManager.getDefaultDialerPackage(any(UserHandle.class)))
.thenReturn(TEST_PKG_NAME);
when(mExecutorService.scheduleAtFixedRate(any(Runnable.class), anyLong(), anyLong(), any(
TimeUnit.class))).thenReturn(mScheduledFuture);

View File

@@ -539,7 +539,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
@@ -744,7 +744,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)) {

View File

@@ -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;
@@ -625,12 +630,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;
}
@@ -646,8 +651,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;
}
@@ -668,7 +693,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;
}
@@ -685,11 +710,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;
}
@@ -987,6 +1009,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);
@@ -1007,6 +1030,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);
@@ -1113,12 +1137,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) {

View File

@@ -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;
@@ -474,7 +479,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
@@ -2109,19 +2114,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.
*
@@ -2129,7 +2139,7 @@ public abstract class Connection extends Conferenceable {
*/
@SystemApi
@TestApi
public final long getConnectElapsedTimeMillis() {
public final @ElapsedRealtimeLong long getConnectionStartElapsedRealtimeMillis() {
return mConnectElapsedTimeMillis;
}
@@ -2550,6 +2560,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
@@ -2559,7 +2572,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;
}
@@ -2567,15 +2581,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;
}

View File

@@ -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;
@@ -1778,7 +1777,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(),
@@ -1884,7 +1883,7 @@ public abstract class ConnectionService extends Service {
connection.isRingbackRequested(),
connection.getAudioModeIsVoip(),
connection.getConnectTimeMillis(),
connection.getConnectElapsedTimeMillis(),
connection.getConnectionStartElapsedRealtimeMillis(),
connection.getStatusHints(),
connection.getDisconnectCause(),
createIdList(connection.getConferenceables()),
@@ -2374,7 +2373,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(),
@@ -2465,7 +2464,7 @@ public abstract class ConnectionService extends Service {
connection.isRingbackRequested(),
connection.getAudioModeIsVoip(),
connection.getConnectTimeMillis(),
connection.getConnectElapsedTimeMillis(),
connection.getConnectionStartElapsedRealtimeMillis(),
connection.getStatusHints(),
connection.getDisconnectCause(),
emptyList,

View File

@@ -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;
@@ -614,7 +617,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.
@@ -623,6 +627,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;

View File

@@ -819,8 +819,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.
@@ -1412,7 +1412,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
@@ -1420,10 +1420,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);