More telephony updates for mainline.

Add new TelecomManager#getDefaultDialerPackage which is multiuse aware;
this is used when showing the voicemail notification.
Remove some @hide methods from Conference; push these inline.
Move ConferenceParticipantConnection into frameworks/opt/net/ims since
it is just an IMS implementation detail.

Bug: 141576016
Test: Manual smoke test.
Test: Run unit tests.
Test: Run CTS tests.
Change-Id: I39b6955cb14cc1ca68b05c620c3d09a2cdfe30c9
Merged-In: I39b6955cb14cc1ca68b05c620c3d09a2cdfe30c9
diff --git a/api/current.txt b/api/current.txt
index ce4cb25..4651008 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -36911,6 +36911,7 @@
     field public static final String DURATION = "duration";
     field public static final String EXTRA_CALL_TYPE_FILTER = "android.provider.extra.CALL_TYPE_FILTER";
     field public static final String FEATURES = "features";
+    field public static final int FEATURES_ASSISTED_DIALING_USED = 16; // 0x10
     field public static final int FEATURES_HD_CALL = 4; // 0x4
     field public static final int FEATURES_PULLED_EXTERNALLY = 2; // 0x2
     field public static final int FEATURES_RTT = 32; // 0x20
@@ -43136,6 +43137,7 @@
     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_CONFERENCE = 1; // 0x1
     field public static final int PROPERTY_EMERGENCY_CALLBACK_MODE = 4; // 0x4
     field public static final int PROPERTY_ENTERPRISE_CALL = 32; // 0x20
@@ -43249,6 +43251,7 @@
     method public final void removeConnection(android.telecom.Connection);
     method public final void removeExtras(java.util.List<java.lang.String>);
     method public final void removeExtras(java.lang.String...);
+    method public void sendConferenceEvent(@NonNull String, @Nullable android.os.Bundle);
     method public final void setActive();
     method public final void setConferenceableConnections(java.util.List<android.telecom.Connection>);
     method public final void setConnectionCapabilities(int);
@@ -43388,6 +43391,7 @@
     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_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
@@ -43802,6 +43806,7 @@
     method public android.telecom.PhoneAccount getPhoneAccount(android.telecom.PhoneAccountHandle);
     method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public java.util.List<android.telecom.PhoneAccountHandle> getSelfManagedPhoneAccounts();
     method public android.telecom.PhoneAccountHandle getSimCallManager();
+    method @Nullable public android.telecom.PhoneAccountHandle getSimCallManagerForSubscription(int);
     method @Nullable public String getSystemDialerPackage();
     method @Nullable @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public android.telecom.PhoneAccountHandle getUserSelectedOutgoingPhoneAccount();
     method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public String getVoiceMailNumber(android.telecom.PhoneAccountHandle);
@@ -43850,6 +43855,7 @@
     field public static final String EXTRA_START_CALL_WITH_RTT = "android.telecom.extra.START_CALL_WITH_RTT";
     field public static final String EXTRA_START_CALL_WITH_SPEAKERPHONE = "android.telecom.extra.START_CALL_WITH_SPEAKERPHONE";
     field public static final String EXTRA_START_CALL_WITH_VIDEO_STATE = "android.telecom.extra.START_CALL_WITH_VIDEO_STATE";
+    field public static final String EXTRA_USE_ASSISTED_DIALING = "android.telecom.extra.USE_ASSISTED_DIALING";
     field public static final String GATEWAY_ORIGINAL_ADDRESS = "android.telecom.extra.GATEWAY_ORIGINAL_ADDRESS";
     field public static final String GATEWAY_PROVIDER_PACKAGE = "android.telecom.extra.GATEWAY_PROVIDER_PACKAGE";
     field public static final String METADATA_INCLUDE_EXTERNAL_CALLS = "android.telecom.INCLUDE_EXTERNAL_CALLS";
diff --git a/api/system-current.txt b/api/system-current.txt
index 3393112..22eec46 100644
--- a/api/system-current.txt
+++ b/api/system-current.txt
@@ -6958,14 +6958,18 @@
   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 public final void setCallerDisplayName(@NonNull String, int);
+    method 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 int getCallRadioTech();
     method public final long getConnectElapsedTimeMillis();
     method public final long getConnectTimeMillis();
     method @Nullable public android.telecom.PhoneAccountHandle getPhoneAccountHandle();
@@ -6973,7 +6977,6 @@
     method @Deprecated public void onAudioStateChanged(android.telecom.AudioState);
     method public final void resetConnectionTime();
     method public void setCallDirection(int);
-    method public final void setCallRadioTech(int);
     method public final void setConnectTimeMillis(long);
     method public final void setConnectionStartElapsedRealTime(long);
     method public void setPhoneAccountHandle(@NonNull android.telecom.PhoneAccountHandle);
@@ -6987,6 +6990,10 @@
     field public static final int PROPERTY_REMOTELY_HOSTED = 2048; // 0x800
   }
 
+  public abstract class ConnectionService extends android.app.Service {
+    method public final void addExistingConnection(@NonNull android.telecom.PhoneAccountHandle, @NonNull android.telecom.Connection, @NonNull android.telecom.Conference);
+  }
+
   public abstract class InCallService extends android.app.Service {
     method @Deprecated public android.telecom.Phone getPhone();
     method @Deprecated public void onPhoneCreated(android.telecom.Phone);
@@ -7118,6 +7125,10 @@
     field public static final int CAPABILITY_MULTI_USER = 32; // 0x20
   }
 
+  public static class PhoneAccount.Builder {
+    method @NonNull public android.telecom.PhoneAccount.Builder setGroupId(@NonNull String);
+  }
+
   public class PhoneAccountSuggestionService extends android.app.Service {
     ctor public PhoneAccountSuggestionService();
     method public void onAccountSuggestionRequest(@NonNull String);
@@ -7188,6 +7199,7 @@
     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 @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 293ca55..263dbae 100644
--- a/api/test-current.txt
+++ b/api/test-current.txt
@@ -2754,7 +2754,36 @@
   }
 
   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 public final void setCallerDisplayName(@NonNull String, int);
+    method public void setConferenceState(boolean);
+  }
+
+  public abstract class Connection extends android.telecom.Conferenceable {
+    method public final long getConnectElapsedTimeMillis();
+    method public final long getConnectTimeMillis();
+    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 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
+    field public static final int CAPABILITY_SPEED_UP_MT_AUDIO = 262144; // 0x40000
+    field public static final String EXTRA_DISABLE_ADD_CALL = "android.telecom.extra.DISABLE_ADD_CALL";
+    field public static final int PROPERTY_EMERGENCY_CALLBACK_MODE = 1; // 0x1
+    field public static final int PROPERTY_GENERIC_CONFERENCE = 2; // 0x2
+    field public static final int PROPERTY_IS_DOWNGRADED_CONFERENCE = 64; // 0x40
+    field public static final int PROPERTY_REMOTELY_HOSTED = 2048; // 0x800
+  }
+
+  public static class PhoneAccount.Builder {
+    method @NonNull public android.telecom.PhoneAccount.Builder setGroupId(@NonNull String);
   }
 
   public class PhoneAccountSuggestionService extends android.app.Service {
@@ -2767,6 +2796,7 @@
 
   public class TelecomManager {
     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 @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/core/java/android/provider/CallLog.java b/core/java/android/provider/CallLog.java
index 3d54ba1..82a3c40 100644
--- a/core/java/android/provider/CallLog.java
+++ b/core/java/android/provider/CallLog.java
@@ -227,7 +227,7 @@
 
         /**
          * Indicates the call underwent Assisted Dialing.
-         * @hide
+         * @see TelecomManager#EXTRA_USE_ASSISTED_DIALING
          */
         public static final int FEATURES_ASSISTED_DIALING_USED = 1 << 4;
 
diff --git a/telecomm/java/android/telecom/Call.java b/telecomm/java/android/telecom/Call.java
index 60290e3..24b4046 100644
--- a/telecomm/java/android/telecom/Call.java
+++ b/telecomm/java/android/telecom/Call.java
@@ -512,8 +512,8 @@
 
         /**
          * Indicates the call used Assisted Dialing.
-         * See also {@link Connection#PROPERTY_ASSISTED_DIALING_USED}
-         * @hide
+         *
+         * @see TelecomManager#EXTRA_USE_ASSISTED_DIALING
          */
         public static final int PROPERTY_ASSISTED_DIALING_USED = 0x00000200;
 
@@ -1181,7 +1181,8 @@
         public void onConferenceableCallsChanged(Call call, List<Call> conferenceableCalls) {}
 
         /**
-         * Invoked when a {@link Call} receives an event from its associated {@link Connection}.
+         * Invoked when a {@link Call} receives an event from its associated {@link Connection} or
+         * {@link Conference}.
          * <p>
          * Where possible, the Call should make an attempt to handle {@link Connection} events which
          * are part of the {@code android.telecom.*} namespace.  The Call should ignore any events
@@ -1189,7 +1190,8 @@
          * possible that a {@link ConnectionService} has defined its own Connection events which a
          * Call is not aware of.
          * <p>
-         * See {@link Connection#sendConnectionEvent(String, Bundle)}.
+         * See {@link Connection#sendConnectionEvent(String, Bundle)},
+         * {@link Conference#sendConferenceEvent(String, Bundle)}.
          *
          * @param call The {@code Call} receiving the event.
          * @param event The event.
diff --git a/telecomm/java/android/telecom/Conference.java b/telecomm/java/android/telecom/Conference.java
index cd5fd97..d669e905 100644
--- a/telecomm/java/android/telecom/Conference.java
+++ b/telecomm/java/android/telecom/Conference.java
@@ -49,7 +49,7 @@
     public static final long CONNECT_TIME_NOT_SPECIFIED = 0;
 
     /** @hide */
-    public abstract static class Listener {
+    abstract static class Listener {
         public void onStateChanged(Conference conference, int oldState, int newState) {}
         public void onDisconnected(Conference conference, DisconnectCause disconnectCause) {}
         public void onConnectionAdded(Conference conference, Connection connection) {}
@@ -120,11 +120,17 @@
 
     /**
      * Returns the telecom internal call ID associated with this conference.
+     * <p>
+     * Note: This is ONLY used for debugging purposes so that the Telephony stack can better
+     * associate logs in Telephony with those in Telecom.
+     * The ID returned should not be used for any other purpose.
      *
      * @return The telecom call ID.
      * @hide
      */
-    public final String getTelecomCallId() {
+    @SystemApi
+    @TestApi
+    public final @NonNull String getTelecomCallId() {
         return mTelecomCallId;
     }
 
@@ -186,55 +192,6 @@
     }
 
     /**
-     * Whether the given capabilities support the specified capability.
-     *
-     * @param capabilities A capability bit field.
-     * @param capability The capability to check capabilities for.
-     * @return Whether the specified capability is supported.
-     * @hide
-     */
-    public static boolean can(int capabilities, int capability) {
-        return (capabilities & capability) != 0;
-    }
-
-    /**
-     * Whether the capabilities of this {@code Connection} supports the specified capability.
-     *
-     * @param capability The capability to check capabilities for.
-     * @return Whether the specified capability is supported.
-     * @hide
-     */
-    public boolean can(int capability) {
-        return can(mConnectionCapabilities, capability);
-    }
-
-    /**
-     * Removes the specified capability from the set of capabilities of this {@code Conference}.
-     *
-     * @param capability The capability to remove from the set.
-     * @hide
-     */
-    public void removeCapability(int capability) {
-        int newCapabilities = mConnectionCapabilities;
-        newCapabilities &= ~capability;
-
-        setConnectionCapabilities(newCapabilities);
-    }
-
-    /**
-     * Adds the specified capability to the set of capabilities of this {@code Conference}.
-     *
-     * @param capability The capability to add to the set.
-     * @hide
-     */
-    public void addCapability(int capability) {
-        int newCapabilities = mConnectionCapabilities;
-        newCapabilities |= capability;
-
-        setConnectionCapabilities(newCapabilities);
-    }
-
-    /**
      * @return The audio state of the conference, describing how its audio is currently
      *         being routed by the system. This is {@code null} if this Conference
      *         does not directly know about its audio state.
@@ -553,7 +510,7 @@
      * @return This conference.
      * @hide
      */
-    public final Conference addListener(Listener listener) {
+    final Conference addListener(Listener listener) {
         mListeners.add(listener);
         return this;
     }
@@ -565,7 +522,7 @@
      * @return This conference.
      * @hide
      */
-    public final Conference removeListener(Listener listener) {
+    final Conference removeListener(Listener listener) {
         mListeners.remove(listener);
         return this;
     }
@@ -587,20 +544,6 @@
     }
 
     /**
-     * Updates RIL voice radio technology used for current conference after its creation.
-     *
-     * @hide
-     */
-    public void updateCallRadioTechAfterCreation() {
-        final Connection primaryConnection = getPrimaryConnection();
-        if (primaryConnection != null) {
-            setCallRadioTech(primaryConnection.getCallRadioTech());
-        } else {
-            Log.w(this, "No primary connection found while updateCallRadioTechAfterCreation");
-        }
-    }
-
-    /**
      * @hide
      * @deprecated Use {@link #setConnectionTime}.
      */
@@ -668,49 +611,24 @@
      * Retrieves the connection start time of the {@link Conference}, if specified.  A value of
      * {@link #CONNECT_TIME_NOT_SPECIFIED} indicates that Telecom should determine the start time
      * of the conference.
-     *
+     * <p>
      * This is based on the value of {@link SystemClock#elapsedRealtime()} to ensure that it is not
      * impacted by wall clock changes (user initiated, network initiated, time zone change, etc).
+     * <p>
+     * Note: This is only exposed for use by the Telephony framework which needs it to copy
+     * conference start times among conference participants.  It is exposed as a system API since it
+     * 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() {
         return mConnectionStartElapsedRealTime;
     }
 
     /**
-     * Sets RIL voice radio technology used for current conference.
-     *
-     * @param vrat the RIL voice radio technology used for current conference,
-     *             see {@code RIL_RADIO_TECHNOLOGY_*} in {@link android.telephony.ServiceState}.
-     *
-     * @hide
-     */
-    public final void setCallRadioTech(@ServiceState.RilRadioTechnology int vrat) {
-        putExtra(TelecomManager.EXTRA_CALL_NETWORK_TYPE,
-                ServiceState.rilRadioTechnologyToNetworkType(vrat));
-    }
-
-    /**
-     * Returns RIL voice radio technology used for current conference.
-     *
-     * @return the RIL voice radio technology used for current conference,
-     *         see {@code RIL_RADIO_TECHNOLOGY_*} in {@link android.telephony.ServiceState}.
-     *
-     * @hide
-     */
-    public final @ServiceState.RilRadioTechnology int getCallRadioTech() {
-        int voiceNetworkType = TelephonyManager.NETWORK_TYPE_UNKNOWN;
-        Bundle extras = getExtras();
-        if (extras != null) {
-            voiceNetworkType = extras.getInt(TelecomManager.EXTRA_CALL_NETWORK_TYPE,
-                    TelephonyManager.NETWORK_TYPE_UNKNOWN);
-        }
-        return ServiceState.networkTypeToRilRadioTechnology(voiceNetworkType);
-    }
-
-    /**
      * Inform this Conference that the state of its audio output has been changed externally.
      *
      * @param state The new audio state.
@@ -969,11 +887,15 @@
      * single-party call when the participant count drops to 1.  Although the dialer/phone app
      * could perform this trickery, it makes sense to do this in Telephony since a fix there will
      * ensure that bluetooth head units, auto and wearable apps all behave consistently.
+     * <p>
+     * This API is intended for use by the platform Telephony stack only.
      *
      * @param isConference {@code true} if this {@link Conference} should be treated like a
      *      conference call, {@code false} if it should be treated like a single-party call.
      * @hide
      */
+    @SystemApi
+    @TestApi
     public void setConferenceState(boolean isConference) {
         for (Listener l : mListeners) {
             l.onConferenceStateChanged(this, isConference);
@@ -983,13 +905,19 @@
     /**
      * Sets the address of this {@link Conference}.  Used when {@link #setConferenceState(boolean)}
      * is called to mark a conference temporarily as NOT a conference.
+     * <p>
+     * Note: This is a Telephony-specific implementation detail related to IMS conferences.  It is
+     * not intended for use outside of the Telephony stack.
      *
      * @param address The new address.
      * @param presentation The presentation requirements for the address.
      *        See {@link TelecomManager} for valid values.
      * @hide
      */
-    public final void setAddress(Uri address, int presentation) {
+    @SystemApi
+    @TestApi
+    public final void setAddress(@NonNull Uri address,
+            @TelecomManager.Presentation int presentation) {
         Log.d(this, "setAddress %s", address);
         mAddress = address;
         mAddressPresentation = presentation;
@@ -1055,13 +983,19 @@
      * Sets the caller display name (CNAP) of this {@link Conference}.  Used when
      * {@link #setConferenceState(boolean)} is called to mark a conference temporarily as NOT a
      * conference.
+     * <p>
+     * Note: This is a Telephony-specific implementation detail related to IMS conferences.  It is
+     * not intended for use outside of the Telephony stack.
      *
      * @param callerDisplayName The new display name.
      * @param presentation The presentation requirements for the handle.
      *        See {@link TelecomManager} for valid values.
      * @hide
      */
-    public final void setCallerDisplayName(String callerDisplayName, int presentation) {
+    @SystemApi
+    @TestApi
+    public final void setCallerDisplayName(@NonNull String callerDisplayName,
+            @TelecomManager.Presentation int presentation) {
         Log.d(this, "setCallerDisplayName %s", callerDisplayName);
         mCallerDisplayName = callerDisplayName;
         mCallerDisplayNamePresentation = presentation;
@@ -1088,10 +1022,15 @@
     }
 
     /**
-     * See {@link Connection#sendConnectionEvent(String, Bundle)}
-     * @hide
+     * 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)
+     *
+     * @param event The connection event.
+     * @param extras Optional bundle containing extra information associated with the event.
      */
-    public void sendConnectionEvent(String event, Bundle extras) {
+    public void sendConferenceEvent(@NonNull String event, @Nullable Bundle extras) {
         for (Listener l : mListeners) {
             l.onConnectionEvent(this, event, extras);
         }
diff --git a/telecomm/java/android/telecom/ConferenceParticipant.java b/telecomm/java/android/telecom/ConferenceParticipant.java
deleted file mode 100644
index 5e4818a..0000000
--- a/telecomm/java/android/telecom/ConferenceParticipant.java
+++ /dev/null
@@ -1,348 +0,0 @@
-/*
- * Copyright (C) 2014 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License
- */
-
-package android.telecom;
-
-import android.net.Uri;
-import android.os.Parcel;
-import android.os.Parcelable;
-import android.telephony.PhoneNumberUtils;
-import android.text.TextUtils;
-
-import com.android.internal.annotations.VisibleForTesting;
-import com.android.internal.telephony.PhoneConstants;
-
-/**
- * Parcelable representation of a participant's state in a conference call.
- * @hide
- */
-public class ConferenceParticipant implements Parcelable {
-
-    /**
-     * RFC5767 states that a SIP URI with an unknown number should use an address of
-     * {@code anonymous@anonymous.invalid}.  E.g. the host name is anonymous.invalid.
-     */
-    private static final String ANONYMOUS_INVALID_HOST = "anonymous.invalid";
-    /**
-     * The conference participant's handle (e.g., phone number).
-     */
-    private final Uri mHandle;
-
-    /**
-     * The display name for the participant.
-     */
-    private final String mDisplayName;
-
-    /**
-     * The endpoint Uri which uniquely identifies this conference participant.  E.g. for an IMS
-     * conference call, this is the endpoint URI for the participant on the IMS conference server.
-     */
-    private final Uri mEndpoint;
-
-    /**
-     * The state of the participant in the conference.
-     *
-     * @see android.telecom.Connection
-     */
-    private final int mState;
-
-    /**
-     * The connect time of the participant.
-     */
-    private long mConnectTime;
-
-    /**
-     * The connect elapsed time of the participant.
-     */
-    private long mConnectElapsedTime;
-
-    /**
-     * The direction of the call;
-     * {@link Call.Details#DIRECTION_INCOMING} for incoming calls, or
-     * {@link Call.Details#DIRECTION_OUTGOING} for outgoing calls.
-     */
-    private int mCallDirection;
-
-    /**
-     * Creates an instance of {@code ConferenceParticipant}.
-     *
-     * @param handle      The conference participant's handle (e.g., phone number).
-     * @param displayName The display name for the participant.
-     * @param endpoint    The enpoint Uri which uniquely identifies this conference participant.
-     * @param state       The state of the participant in the conference.
-     * @param callDirection The direction of the call (incoming/outgoing).
-     */
-    public ConferenceParticipant(Uri handle, String displayName, Uri endpoint, int state,
-            int callDirection) {
-        mHandle = handle;
-        mDisplayName = displayName;
-        mEndpoint = endpoint;
-        mState = state;
-        mCallDirection = callDirection;
-    }
-
-    /**
-     * Responsible for creating {@code ConferenceParticipant} objects for deserialized Parcels.
-     */
-    public static final @android.annotation.NonNull Parcelable.Creator<ConferenceParticipant> CREATOR =
-            new Parcelable.Creator<ConferenceParticipant>() {
-
-                @Override
-                public ConferenceParticipant createFromParcel(Parcel source) {
-                    ClassLoader classLoader = ParcelableCall.class.getClassLoader();
-                    Uri handle = source.readParcelable(classLoader);
-                    String displayName = source.readString();
-                    Uri endpoint = source.readParcelable(classLoader);
-                    int state = source.readInt();
-                    long connectTime = source.readLong();
-                    long elapsedRealTime = source.readLong();
-                    int callDirection = source.readInt();
-                    ConferenceParticipant participant =
-                            new ConferenceParticipant(handle, displayName, endpoint, state,
-                                    callDirection);
-                    participant.setConnectTime(connectTime);
-                    participant.setConnectElapsedTime(elapsedRealTime);
-                    participant.setCallDirection(callDirection);
-                    return participant;
-                }
-
-                @Override
-                public ConferenceParticipant[] newArray(int size) {
-                    return new ConferenceParticipant[size];
-                }
-            };
-
-    @Override
-    public int describeContents() {
-        return 0;
-    }
-
-    /**
-     * Determines the number presentation for a conference participant.  Per RFC5767, if the host
-     * name contains {@code anonymous.invalid} we can assume that there is no valid caller ID
-     * information for the caller, otherwise we'll assume that the URI can be shown.
-     *
-     * @return The number presentation.
-     */
-    @VisibleForTesting
-    public int getParticipantPresentation() {
-        Uri address = getHandle();
-        if (address == null) {
-            return PhoneConstants.PRESENTATION_RESTRICTED;
-        }
-
-        String number = address.getSchemeSpecificPart();
-        // If no number, bail early and set restricted presentation.
-        if (TextUtils.isEmpty(number)) {
-            return PhoneConstants.PRESENTATION_RESTRICTED;
-        }
-        // Per RFC3261, the host name portion can also potentially include extra information:
-        // E.g. sip:anonymous1@anonymous.invalid;legid=1
-        // In this case, hostName will be anonymous.invalid and there is an extra parameter for
-        // legid=1.
-        // Parameters are optional, and the address (e.g. test@test.com) will always be the first
-        // part, with any parameters coming afterwards.
-        String [] hostParts = number.split("[;]");
-        String addressPart = hostParts[0];
-
-        // Get the number portion from the address part.
-        // This will typically be formatted similar to: 6505551212@test.com
-        String [] numberParts = addressPart.split("[@]");
-
-        // If we can't parse the host name out of the URI, then there is probably other data
-        // present, and is likely a valid SIP URI.
-        if (numberParts.length != 2) {
-            return PhoneConstants.PRESENTATION_ALLOWED;
-        }
-        String hostName = numberParts[1];
-
-        // If the hostname portion of the SIP URI is the invalid host string, presentation is
-        // restricted.
-        if (hostName.equals(ANONYMOUS_INVALID_HOST)) {
-            return PhoneConstants.PRESENTATION_RESTRICTED;
-        }
-
-        return PhoneConstants.PRESENTATION_ALLOWED;
-    }
-
-    /**
-     * Writes the {@code ConferenceParticipant} to a parcel.
-     *
-     * @param dest The Parcel in which the object should be written.
-     * @param flags Additional flags about how the object should be written.
-     */
-    @Override
-    public void writeToParcel(Parcel dest, int flags) {
-        dest.writeParcelable(mHandle, 0);
-        dest.writeString(mDisplayName);
-        dest.writeParcelable(mEndpoint, 0);
-        dest.writeInt(mState);
-        dest.writeLong(mConnectTime);
-        dest.writeLong(mConnectElapsedTime);
-        dest.writeInt(mCallDirection);
-    }
-
-    /**
-     * Builds a string representation of this instance.
-     *
-     * @return String representing the conference participant.
-     */
-    @Override
-    public String toString() {
-        StringBuilder sb = new StringBuilder();
-        sb.append("[ConferenceParticipant Handle: ");
-        sb.append(Log.pii(mHandle));
-        sb.append(" DisplayName: ");
-        sb.append(Log.pii(mDisplayName));
-        sb.append(" Endpoint: ");
-        sb.append(Log.pii(mEndpoint));
-        sb.append(" State: ");
-        sb.append(Connection.stateToString(mState));
-        sb.append(" ConnectTime: ");
-        sb.append(getConnectTime());
-        sb.append(" ConnectElapsedTime: ");
-        sb.append(getConnectElapsedTime());
-        sb.append(" Direction: ");
-        sb.append(getCallDirection() == Call.Details.DIRECTION_INCOMING ? "Incoming" : "Outgoing");
-        sb.append("]");
-        return sb.toString();
-    }
-
-    /**
-     * The conference participant's handle (e.g., phone number).
-     */
-    public Uri getHandle() {
-        return mHandle;
-    }
-
-    /**
-     * The display name for the participant.
-     */
-    public String getDisplayName() {
-        return mDisplayName;
-    }
-
-    /**
-     * The enpoint Uri which uniquely identifies this conference participant.  E.g. for an IMS
-     * conference call, this is the endpoint URI for the participant on the IMS conference server.
-     */
-    public Uri getEndpoint() {
-        return mEndpoint;
-    }
-
-    /**
-     * The state of the participant in the conference.
-     *
-     * @see android.telecom.Connection
-     */
-    public int getState() {
-        return mState;
-    }
-
-    /**
-     * The connect time of the participant to the conference.
-     */
-    public long getConnectTime() {
-        return mConnectTime;
-    }
-
-    public void setConnectTime(long connectTime) {
-        this.mConnectTime = connectTime;
-    }
-
-    /**
-     * The connect elapsed time of the participant to the conference.
-     */
-    public long getConnectElapsedTime() {
-        return mConnectElapsedTime;
-    }
-
-    public void setConnectElapsedTime(long connectElapsedTime) {
-        mConnectElapsedTime = connectElapsedTime;
-    }
-
-    /**
-     * @return The direction of the call (incoming/outgoing).
-     */
-    public @Call.Details.CallDirection int getCallDirection() {
-        return mCallDirection;
-    }
-
-    /**
-     * Sets the direction of the call.
-     * @param callDirection Whether the call is incoming or outgoing.
-     */
-    public void setCallDirection(@Call.Details.CallDirection int callDirection) {
-        mCallDirection = callDirection;
-    }
-
-    /**
-     * Attempts to build a tel: style URI from a conference participant.
-     * Conference event package data contains SIP URIs, so we try to extract the phone number and
-     * format into a typical tel: style URI.
-     *
-     * @param address The conference participant's address.
-     * @param countryIso The country ISO of the current subscription; used when formatting the
-     *                   participant phone number to E.164 format.
-     * @return The participant's address URI.
-     * @hide
-     */
-    @VisibleForTesting
-    public static Uri getParticipantAddress(Uri address, String countryIso) {
-        if (address == null) {
-            return address;
-        }
-        // Even if address is already in tel: format, still parse it and rebuild.
-        // This is to recognize tel URIs such as:
-        // tel:6505551212;phone-context=ims.mnc012.mcc034.3gppnetwork.org
-
-        // Conference event package participants are identified using SIP URIs (see RFC3261).
-        // A valid SIP uri has the format: sip:user:password@host:port;uri-parameters?headers
-        // Per RFC3261, the "user" can be a telephone number.
-        // For example: sip:1650555121;phone-context=blah.com@host.com
-        // In this case, the phone number is in the user field of the URI, and the parameters can be
-        // ignored.
-        //
-        // A SIP URI can also specify a phone number in a format similar to:
-        // sip:+1-212-555-1212@something.com;user=phone
-        // In this case, the phone number is again in user field and the parameters can be ignored.
-        // We can get the user field in these instances by splitting the string on the @, ;, or :
-        // and looking at the first found item.
-        String number = address.getSchemeSpecificPart();
-        if (TextUtils.isEmpty(number)) {
-            return address;
-        }
-
-        String numberParts[] = number.split("[@;:]");
-        if (numberParts.length == 0) {
-            return address;
-        }
-        number = numberParts[0];
-
-        // Attempt to format the number in E.164 format and use that as part of the TEL URI.
-        // RFC2806 recommends to format telephone numbers using E.164 since it is independent of
-        // how the dialing of said numbers takes place.
-        // If conversion to E.164 fails, the returned value is null.  In that case, fallback to the
-        // number which was in the CEP data.
-        String formattedNumber = null;
-        if (!TextUtils.isEmpty(countryIso)) {
-            formattedNumber = PhoneNumberUtils.formatNumberToE164(number, countryIso);
-        }
-
-        return Uri.fromParts(PhoneAccount.SCHEME_TEL,
-                formattedNumber != null ? formattedNumber : number, null);
-    }
-}
diff --git a/telecomm/java/android/telecom/Connection.java b/telecomm/java/android/telecom/Connection.java
index 4f373af..e2f5d0bb 100644
--- a/telecomm/java/android/telecom/Connection.java
+++ b/telecomm/java/android/telecom/Connection.java
@@ -19,6 +19,7 @@
 import android.annotation.NonNull;
 import android.annotation.Nullable;
 import android.annotation.SystemApi;
+import android.annotation.TestApi;
 import android.annotation.UnsupportedAppUsage;
 import android.app.Notification;
 import android.bluetooth.BluetoothDevice;
@@ -273,6 +274,7 @@
      * @hide
      */
     @SystemApi
+    @TestApi
     public static final int CAPABILITY_SPEED_UP_MT_AUDIO = 0x00040000;
 
     /**
@@ -310,6 +312,7 @@
      * @hide
      */
     @SystemApi
+    @TestApi
     public static final int CAPABILITY_CONFERENCE_HAS_NO_CHILDREN = 0x00200000;
 
     /**
@@ -356,6 +359,7 @@
      * @hide
      */
     @SystemApi
+    @TestApi
     public static final int PROPERTY_EMERGENCY_CALLBACK_MODE = 1<<0;
 
     /**
@@ -366,6 +370,7 @@
      * @hide
      */
     @SystemApi
+    @TestApi
     public static final int PROPERTY_GENERIC_CONFERENCE = 1<<1;
 
     /**
@@ -417,6 +422,7 @@
      * @hide
      */
     @SystemApi
+    @TestApi
     public static final int PROPERTY_IS_DOWNGRADED_CONFERENCE = 1<<6;
 
     /**
@@ -435,7 +441,10 @@
 
     /**
      * Set by the framework to indicate that a connection is using assisted dialing.
-     * @hide
+     * <p>
+     * This is used for outgoing calls.
+     *
+     * @see TelecomManager#EXTRA_USE_ASSISTED_DIALING
      */
     public static final int PROPERTY_ASSISTED_DIALING_USED = 1 << 9;
 
@@ -457,6 +466,7 @@
      * @hide
      */
     @SystemApi
+    @TestApi
     public static final int PROPERTY_REMOTELY_HOSTED = 1 << 11;
 
     //**********************************************************************************************
@@ -515,6 +525,7 @@
      * @hide
      */
     @SystemApi
+    @TestApi
     public static final String EXTRA_DISABLE_ADD_CALL =
             "android.telecom.extra.DISABLE_ADD_CALL";
 
@@ -1806,6 +1817,7 @@
      * @hide
      */
     @SystemApi
+    @TestApi
     public final @Nullable String getTelecomCallId() {
         return mTelecomCallId;
     }
@@ -1922,6 +1934,7 @@
      * @hide
      */
     @SystemApi
+    @TestApi
     public final long getConnectTimeMillis() {
         return mConnectTimeMillis;
     }
@@ -1941,32 +1954,12 @@
      * @hide
      */
     @SystemApi
+    @TestApi
     public final long getConnectElapsedTimeMillis() {
         return mConnectElapsedTimeMillis;
     }
 
     /**
-     * Returns RIL voice radio technology used for current connection.
-     * <p>
-     * Used by the Telephony {@link ConnectionService}.
-     *
-     * @return the RIL voice radio technology used for current connection,
-     *         see {@code RIL_RADIO_TECHNOLOGY_*} in {@link android.telephony.ServiceState}.
-     *
-     * @hide
-     */
-    @SystemApi
-    public final @ServiceState.RilRadioTechnology int getCallRadioTech() {
-        int voiceNetworkType = TelephonyManager.NETWORK_TYPE_UNKNOWN;
-        Bundle extras = getExtras();
-        if (extras != null) {
-            voiceNetworkType = extras.getInt(TelecomManager.EXTRA_CALL_NETWORK_TYPE,
-                    TelephonyManager.NETWORK_TYPE_UNKNOWN);
-        }
-        return ServiceState.networkTypeToRilRadioTechnology(voiceNetworkType);
-    }
-
-    /**
      * @return The status hints for this connection.
      */
     public final StatusHints getStatusHints() {
@@ -2044,6 +2037,7 @@
      * @hide
      */
     @SystemApi
+    @TestApi
     public void setTelecomCallId(@NonNull String callId) {
         mTelecomCallId = callId;
     }
@@ -2390,6 +2384,7 @@
      * @hide
      */
     @SystemApi
+    @TestApi
     public final void setConnectTimeMillis(long connectTimeMillis) {
         mConnectTimeMillis = connectTimeMillis;
     }
@@ -2405,39 +2400,12 @@
      * @hide
      */
     @SystemApi
+    @TestApi
     public final void setConnectionStartElapsedRealTime(long connectElapsedTimeMillis) {
         mConnectElapsedTimeMillis = connectElapsedTimeMillis;
     }
 
     /**
-     * Sets RIL voice radio technology used for current connection.
-     * <p>
-     * This property is set by the Telephony {@link ConnectionService}.
-     *
-     * @param vrat the RIL Voice Radio Technology used for current connection,
-     *             see {@code RIL_RADIO_TECHNOLOGY_*} in {@link android.telephony.ServiceState}.
-     *
-     * @hide
-     */
-    @SystemApi
-    public final void setCallRadioTech(@ServiceState.RilRadioTechnology int vrat) {
-        Bundle extras = getExtras();
-        if (extras == null) {
-            extras = new Bundle();
-        }
-        extras.putInt(TelecomManager.EXTRA_CALL_NETWORK_TYPE,
-                ServiceState.rilRadioTechnologyToNetworkType(vrat));
-        putExtras(extras);
-        // Propagates the call radio technology to its parent {@link android.telecom.Conference}
-        // This action only covers non-IMS CS conference calls.
-        // For IMS PS call conference call, it can be updated via its host connection
-        // {@link #Listener.onExtrasChanged} event.
-        if (getConference() != null) {
-            getConference().setCallRadioTech(vrat);
-        }
-    }
-
-    /**
      * Sets the label and icon status to display in the in-call UI.
      *
      * @param statusHints The status label and icon to set.
@@ -2501,6 +2469,7 @@
      * @hide
      */
     @SystemApi
+    @TestApi
     public final void resetConnectionTime() {
         for (Listener l : mListeners) {
             l.onConnectionTimeReset(this);
@@ -3245,6 +3214,7 @@
      * @hide
      */
     @SystemApi
+    @TestApi
     public void setPhoneAccountHandle(@NonNull PhoneAccountHandle phoneAccountHandle) {
         if (mPhoneAccountHandle != phoneAccountHandle) {
             mPhoneAccountHandle = phoneAccountHandle;
@@ -3263,6 +3233,7 @@
      * @hide
      */
     @SystemApi
+    @TestApi
     public @Nullable PhoneAccountHandle getPhoneAccountHandle() {
         return mPhoneAccountHandle;
     }
@@ -3328,6 +3299,7 @@
      * @hide
      */
     @SystemApi
+    @TestApi
     public void setCallDirection(@Call.Details.CallDirection int callDirection) {
         mCallDirection = callDirection;
     }
diff --git a/telecomm/java/android/telecom/ConnectionService.java b/telecomm/java/android/telecom/ConnectionService.java
index 0abd9fc..812b805 100644
--- a/telecomm/java/android/telecom/ConnectionService.java
+++ b/telecomm/java/android/telecom/ConnectionService.java
@@ -16,7 +16,11 @@
 
 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;
 import android.content.ComponentName;
 import android.content.Intent;
@@ -2106,15 +2110,21 @@
 
     /**
      * Adds a connection created by the {@link ConnectionService} and informs telecom of the new
-     * connection.
+     * connection, as well as adding that connection to the specified conference.
+     * <p>
+     * Note: This API is intended ONLY for use by the Telephony stack to provide an easy way to add
+     * IMS conference participants to be added to a conference in a single step; this helps ensure
+     * UI updates happen atomically, rather than adding the connection and then adding it to
+     * the conference in another step.
      *
      * @param phoneAccountHandle The phone account handle for the connection.
      * @param connection The connection to add.
      * @param conference The parent conference of the new connection.
      * @hide
      */
-    public final void addExistingConnection(PhoneAccountHandle phoneAccountHandle,
-            Connection connection, Conference conference) {
+    @SystemApi
+    public final void addExistingConnection(@NonNull PhoneAccountHandle phoneAccountHandle,
+            @NonNull Connection connection, @NonNull Conference conference) {
 
         String id = addExistingConnectionInternal(phoneAccountHandle, connection);
         if (id != null) {
diff --git a/telecomm/java/android/telecom/PhoneAccount.java b/telecomm/java/android/telecom/PhoneAccount.java
index 1b783b7..bb858cb 100644
--- a/telecomm/java/android/telecom/PhoneAccount.java
+++ b/telecomm/java/android/telecom/PhoneAccount.java
@@ -16,7 +16,9 @@
 
 package android.telecom;
 
+import android.annotation.NonNull;
 import android.annotation.SystemApi;
+import android.annotation.TestApi;
 import android.content.Intent;
 import android.graphics.drawable.Icon;
 import android.net.Uri;
@@ -592,12 +594,17 @@
          * only be one {@link PhoneAccount} with a non-empty group number registered to Telecom at a
          * 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.
+         *
          * @param groupId The group Id of the {@link PhoneAccount} that will replace any other
          * registered {@link PhoneAccount} in Telecom with the same Group Id.
          * @return The builder
          * @hide
          */
-        public Builder setGroupId(String groupId) {
+        @SystemApi
+        @TestApi
+        public @NonNull Builder setGroupId(@NonNull String groupId) {
             if (groupId != null) {
                 mGroupId = groupId;
             } else {
diff --git a/telecomm/java/android/telecom/TelecomManager.java b/telecomm/java/android/telecom/TelecomManager.java
index 2bc20d5..cda3387 100644
--- a/telecomm/java/android/telecom/TelecomManager.java
+++ b/telecomm/java/android/telecom/TelecomManager.java
@@ -14,6 +14,8 @@
 
 package android.telecom;
 
+import static android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE;
+
 import android.Manifest;
 import android.annotation.IntDef;
 import android.annotation.Nullable;
@@ -696,7 +698,17 @@
     /**
      * The boolean indicated by this extra controls whether or not a call is eligible to undergo
      * assisted dialing. This extra is stored under {@link #EXTRA_OUTGOING_CALL_EXTRAS}.
-     * @hide
+     * <p>
+     * The call initiator can use this extra to indicate that a call used assisted dialing to help
+     * place the call.  This is most commonly used by a Dialer app which provides the ability to
+     * 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}/{@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.
      */
     public static final String EXTRA_USE_ASSISTED_DIALING =
             "android.telecom.extra.USE_ASSISTED_DIALING";
@@ -738,6 +750,14 @@
      */
     public static final int PRESENTATION_PAYPHONE = 4;
 
+    /** @hide */
+    @Retention(RetentionPolicy.SOURCE)
+    @IntDef(
+            prefix = { "PRESENTATION_" },
+            value = {PRESENTATION_ALLOWED, PRESENTATION_RESTRICTED, PRESENTATION_UNKNOWN,
+            PRESENTATION_PAYPHONE})
+    public @interface Presentation {}
+
     private static final String TAG = "TelecomManager";
 
     private final Context mContext;
@@ -883,9 +903,8 @@
      *                       queried for.
      * @return The phone account handle of the current sim call manager.
      * @see SubscriptionManager#getActiveSubscriptionInfoList()
-     * @hide
      */
-    public PhoneAccountHandle getSimCallManagerForSubscription(int subscriptionId) {
+    public @Nullable PhoneAccountHandle getSimCallManagerForSubscription(int subscriptionId) {
         try {
             if (isServiceConnected()) {
                 return getTelecomService().getSimCallManager(subscriptionId);
@@ -947,7 +966,7 @@
      */
     @SystemApi
     @RequiresPermission(anyOf = {
-            android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE,
+            READ_PRIVILEGED_PHONE_STATE,
             android.Manifest.permission.READ_PHONE_STATE
     })
     public List<PhoneAccountHandle> getPhoneAccountsSupportingScheme(String uriScheme) {
@@ -1234,6 +1253,28 @@
     }
 
     /**
+     * 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.
+     * @return package name for the default dialer package or null if no package has been
+     *         selected as the default dialer.
+     * @hide
+     */
+    @SystemApi
+    @TestApi
+    @RequiresPermission(READ_PRIVILEGED_PHONE_STATE)
+    public @Nullable String getDefaultDialerPackage(int userId) {
+        try {
+            if (isServiceConnected()) {
+                return getTelecomService().getDefaultDialerPackageForUser(userId);
+            }
+        } catch (RemoteException e) {
+            Log.e(TAG, "RemoteException attempting to get the default dialer package name.", e);
+        }
+        return null;
+    }
+
+    /**
      * Used to set the default dialer package.
      *
      * @param packageName to set the default dialer to, or {@code null} if the system provided
@@ -1432,7 +1473,7 @@
      */
     @SystemApi
     @RequiresPermission(anyOf = {
-            android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE,
+            READ_PRIVILEGED_PHONE_STATE,
             android.Manifest.permission.READ_PHONE_STATE
     })
     public boolean isRinging() {
@@ -1562,7 +1603,7 @@
      * Returns whether TTY is supported on this device.
      */
     @RequiresPermission(anyOf = {
-            android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE,
+            READ_PRIVILEGED_PHONE_STATE,
             android.Manifest.permission.READ_PHONE_STATE
     })
     public boolean isTtySupported() {
@@ -1588,7 +1629,7 @@
      */
     @SystemApi
     @TestApi
-    @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
+    @RequiresPermission(READ_PRIVILEGED_PHONE_STATE)
     public @TtyMode int getCurrentTtyMode() {
         try {
             if (isServiceConnected()) {
diff --git a/telecomm/java/com/android/internal/telecom/ITelecomService.aidl b/telecomm/java/com/android/internal/telecom/ITelecomService.aidl
index 6a1b78f..33fdb9c 100644
--- a/telecomm/java/com/android/internal/telecom/ITelecomService.aidl
+++ b/telecomm/java/com/android/internal/telecom/ITelecomService.aidl
@@ -146,6 +146,11 @@
     String getDefaultDialerPackage();
 
     /**
+     * @see TelecomServiceImpl#getDefaultDialerPackage
+     */
+    String getDefaultDialerPackageForUser(int userId);
+
+    /**
      * @see TelecomServiceImpl#getSystemDialerPackage
      */
     String getSystemDialerPackage();
diff --git a/telephony/java/android/telephony/ims/ImsConferenceState.java b/telephony/java/android/telephony/ims/ImsConferenceState.java
index 6f062f4..df0cc3a 100644
--- a/telephony/java/android/telephony/ims/ImsConferenceState.java
+++ b/telephony/java/android/telephony/ims/ImsConferenceState.java
@@ -23,7 +23,8 @@
 import android.os.Parcelable;
 import android.telecom.Call;
 import android.telecom.Connection;
-import android.telecom.Log;
+import android.telephony.Rlog;
+import android.util.Log;
 
 import java.util.HashMap;
 import java.util.Iterator;
@@ -37,6 +38,7 @@
  */
 @SystemApi
 public final class ImsConferenceState implements Parcelable {
+    private static final String TAG = "ImsConferenceState";
     /**
      * conference-info : user
      */
@@ -192,7 +194,7 @@
                 sb.append("<");
                 while (iterator.hasNext()) {
                     Entry<String, Bundle> entry = iterator.next();
-                    sb.append(Log.pii(entry.getKey()));
+                    sb.append(Rlog.pii(TAG, entry.getKey()));
                     sb.append(": ");
                     Bundle participantData = entry.getValue();
 
@@ -200,7 +202,7 @@
                         sb.append(key);
                         sb.append("=");
                         if (ENDPOINT.equals(key) || USER.equals(key)) {
-                            sb.append(Log.pii(participantData.get(key)));
+                            sb.append(Rlog.pii(TAG, participantData.get(key)));
                         } else {
                             sb.append(participantData.get(key));
                         }
diff --git a/telephony/java/android/telephony/ims/ImsExternalCallState.java b/telephony/java/android/telephony/ims/ImsExternalCallState.java
index eb2ebca..8d83257 100644
--- a/telephony/java/android/telephony/ims/ImsExternalCallState.java
+++ b/telephony/java/android/telephony/ims/ImsExternalCallState.java
@@ -23,7 +23,6 @@
 import android.net.Uri;
 import android.os.Parcel;
 import android.os.Parcelable;
-import android.telecom.Log;
 import android.telephony.Rlog;
 
 import java.lang.annotation.Retention;
@@ -217,8 +216,8 @@
     @Override
     public String toString() {
         return "ImsExternalCallState { mCallId = " + mCallId +
-                ", mAddress = " + Log.pii(mAddress) +
-                ", mLocalAddress = " + Log.pii(mLocalAddress) +
+                ", mAddress = " + Rlog.pii(TAG, mAddress) +
+                ", mLocalAddress = " + Rlog.pii(TAG, mLocalAddress) +
                 ", mIsPullable = " + mIsPullable +
                 ", mCallState = " + mCallState +
                 ", mCallType = " + mCallType +