Merge "Cleanup video provider binder code."
diff --git a/api/current.txt b/api/current.txt
index ce4cb25..d1ea665 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";
@@ -45075,8 +45081,8 @@
     method @Nullable public CharSequence getSimSpecificCarrierIdName();
     method public int getSimState();
     method public int getSimState(int);
-    method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public int getSubIdForPhoneAccountHandle(@NonNull android.telecom.PhoneAccountHandle);
     method @RequiresPermission("android.permission.READ_PRIVILEGED_PHONE_STATE") public String getSubscriberId();
+    method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public int getSubscriptionId(@NonNull android.telecom.PhoneAccountHandle);
     method public int getSupportedModemCount();
     method @Nullable public String getTypeAllocationCode();
     method @Nullable public String getTypeAllocationCode(int);
diff --git a/api/system-current.txt b/api/system-current.txt
index 3393112..ecc9412 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);
@@ -8238,6 +8250,7 @@
     method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public boolean isPotentialEmergencyNumber(@NonNull String);
     method @Deprecated @RequiresPermission(anyOf={android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE, android.Manifest.permission.READ_PHONE_STATE}) public boolean isRadioOn();
     method @Deprecated @RequiresPermission(anyOf={android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE, android.Manifest.permission.READ_PHONE_STATE}) public boolean isRinging();
+    method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public boolean isTetherApnRequired();
     method @Deprecated @RequiresPermission(anyOf={android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE, android.Manifest.permission.READ_PHONE_STATE}) public boolean isVideoCallingEnabled();
     method @Deprecated @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public boolean isVisualVoicemailEnabled(android.telecom.PhoneAccountHandle);
     method public boolean needsOtaServiceProvisioning();
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/cmds/am/src/com/android/commands/am/Am.java b/cmds/am/src/com/android/commands/am/Am.java
index 41d546f..22e1d01 100644
--- a/cmds/am/src/com/android/commands/am/Am.java
+++ b/cmds/am/src/com/android/commands/am/Am.java
@@ -174,6 +174,8 @@
                 instrument.noWindowAnimation = true;
             } else if (opt.equals("--no-hidden-api-checks")) {
                 instrument.disableHiddenApiChecks = true;
+            } else if (opt.equals("--no-test-api-checks")) {
+                instrument.disableTestApiChecks = true;
             } else if (opt.equals("--no-isolated-storage")) {
                 instrument.disableIsolatedStorage = true;
             } else if (opt.equals("--user")) {
diff --git a/cmds/am/src/com/android/commands/am/Instrument.java b/cmds/am/src/com/android/commands/am/Instrument.java
index 4d7b5a7..6afd7c4 100644
--- a/cmds/am/src/com/android/commands/am/Instrument.java
+++ b/cmds/am/src/com/android/commands/am/Instrument.java
@@ -17,6 +17,7 @@
 package com.android.commands.am;
 
 import static android.app.ActivityManager.INSTR_FLAG_DISABLE_HIDDEN_API_CHECKS;
+import static android.app.ActivityManager.INSTR_FLAG_DISABLE_TEST_API_CHECKS;
 import static android.app.ActivityManager.INSTR_FLAG_MOUNT_EXTERNAL_STORAGE_FULL;
 
 import android.app.IActivityManager;
@@ -85,6 +86,7 @@
     String logPath = null;
     public boolean noWindowAnimation = false;
     public boolean disableHiddenApiChecks = false;
+    public boolean disableTestApiChecks = false;
     public boolean disableIsolatedStorage = false;
     public String abi = null;
     public int userId = UserHandle.USER_CURRENT;
@@ -506,6 +508,9 @@
             if (disableHiddenApiChecks) {
                 flags |= INSTR_FLAG_DISABLE_HIDDEN_API_CHECKS;
             }
+            if (disableTestApiChecks) {
+                flags |= INSTR_FLAG_DISABLE_TEST_API_CHECKS;
+            }
             if (disableIsolatedStorage) {
                 flags |= INSTR_FLAG_MOUNT_EXTERNAL_STORAGE_FULL;
             }
diff --git a/cmds/statsd/src/atoms.proto b/cmds/statsd/src/atoms.proto
index 847c298..8a8df38 100644
--- a/cmds/statsd/src/atoms.proto
+++ b/cmds/statsd/src/atoms.proto
@@ -324,6 +324,8 @@
 
         AppCompatibilityChangeReported app_compatibility_change_reported =
             228 [(allow_from_any_uid) = true];
+        PerfettoUploaded perfetto_uploaded =
+            229 [(log_from_module) = "perfetto"];
     }
 
     // Pulled events will start at field 10000.
@@ -6857,3 +6859,37 @@
     optional Source source = 4;
 
 }
+
+/**
+ * Logged from
+ *     external/perfetto/src/perfetto_cmd/perfetto_cmd.cc
+ */
+message PerfettoUploaded {
+    enum Event {
+        PERFETTO_UNDEFINED = 0;
+        PERFETTO_TRACE_BEGIN = 1;
+        PERFETTO_BACKGROUND_TRACE_BEGIN = 2;
+        PERFETTO_ON_CONNECT = 3;
+        PERFETTO_ON_TRACING_DISABLED = 4;
+        PERFETTO_UPLOAD_DROPBOX_BEGIN = 5;
+        PERFETTO_UPLOAD_DROPBOX_SUCCESS = 6;
+        PERFETTO_UPLOAD_DROPBOX_FAILURE = 7;
+        PERFETTO_UPLOAD_INCIDENT_BEGIN = 8;
+        PERFETTO_UPLOAD_INCIDENT_SUCCESS = 9;
+        PERFETTO_UPLOAD_INCIDENT_FAILURE = 10;
+        PERFETTO_FINALIZE_TRACE_AND_EXIT = 11;
+        PERFETTO_TRIGGER_BEGIN = 12;
+        PERFETTO_TRIGGER_SUCCESS = 13;
+        PERFETTO_TRIGGER_FAILURE = 14;
+        PERFETTO_HIT_GUARDRAILS = 15;
+        PERFETTO_ON_TIMEOUT = 16;
+        PERFETTO_NOT_UPLOADING_EMPTY_TRACE = 17;
+    }
+
+    // Which stage of the pipeline we are reporting from.
+    optional Event event = 1;
+
+    // UUID matching the one set inside the SystemInfo trace packet.
+    optional int64 trace_uuid_lsb = 2;
+    optional int64 trace_uuid_msb = 3;
+}
diff --git a/core/java/android/app/ActivityManager.java b/core/java/android/app/ActivityManager.java
index 91b98c7..752f3e3 100644
--- a/core/java/android/app/ActivityManager.java
+++ b/core/java/android/app/ActivityManager.java
@@ -153,6 +153,12 @@
      */
     public static final int INSTR_FLAG_MOUNT_EXTERNAL_STORAGE_FULL = 1 << 1;
 
+    /**
+     * Disable test API access for the newly started instrumentation.
+     * @hide
+     */
+    public static final int INSTR_FLAG_DISABLE_TEST_API_CHECKS = 1 << 2;
+
     static final class UidObserver extends IUidObserver.Stub {
         final OnUidImportanceListener mListener;
         final Context mContext;
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/core/res/res/values/config.xml b/core/res/res/values/config.xml
index fc93fe1..6c0fe46 100644
--- a/core/res/res/values/config.xml
+++ b/core/res/res/values/config.xml
@@ -529,7 +529,7 @@
 
              - TYPE_ETHERNET (9) is prepended to this list, and
 
-             - the return value of TelephonyManager.getTetherApnRequired()
+             - the return value of TelephonyManager.isTetherApnRequired()
                determines how the array is further modified:
 
                    * TRUE (DUN REQUIRED).
diff --git a/media/lib/tvremote/OWNERS b/media/lib/tvremote/OWNERS
new file mode 100644
index 0000000..81d52e1
--- /dev/null
+++ b/media/lib/tvremote/OWNERS
@@ -0,0 +1,2 @@
+nutka@google.com
+skill@google.com
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/MobileSignalController.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/MobileSignalController.java
index e75365e..c519f56 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/MobileSignalController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/MobileSignalController.java
@@ -22,6 +22,8 @@
 import android.os.Handler;
 import android.os.Looper;
 import android.provider.Settings.Global;
+import android.telephony.CellSignalStrength;
+import android.telephony.CellSignalStrengthCdma;
 import android.telephony.NetworkRegistrationInfo;
 import android.telephony.PhoneStateListener;
 import android.telephony.ServiceState;
@@ -48,6 +50,7 @@
 import java.io.PrintWriter;
 import java.util.BitSet;
 import java.util.Objects;
+import java.util.List;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
@@ -457,6 +460,18 @@
     }
 
     /**
+     * Extracts the CellSignalStrengthCdma from SignalStrength then returns the level
+     */
+    private final int getCdmaLevel() {
+        List<CellSignalStrengthCdma> signalStrengthCdma =
+            mSignalStrength.getCellSignalStrengths(CellSignalStrengthCdma.class);
+        if (!signalStrengthCdma.isEmpty()) {
+            return signalStrengthCdma.get(0).getLevel();
+        }
+        return CellSignalStrength.SIGNAL_STRENGTH_NONE_OR_UNKNOWN;
+    }
+
+    /**
      * Updates the current state based on mServiceState, mSignalStrength, mDataNetType,
      * mDataState, and mSimState.  It should be called any time one of these is updated.
      * This will call listeners if necessary.
@@ -470,7 +485,7 @@
                 && mSignalStrength != null;
         if (mCurrentState.connected) {
             if (!mSignalStrength.isGsm() && mConfig.alwaysShowCdmaRssi) {
-                mCurrentState.level = mSignalStrength.getCdmaLevel();
+                mCurrentState.level = getCdmaLevel();
             } else {
                 mCurrentState.level = mSignalStrength.getLevel();
             }
diff --git a/packages/Tethering/src/com/android/server/connectivity/tethering/TetheringConfiguration.java b/packages/Tethering/src/com/android/server/connectivity/tethering/TetheringConfiguration.java
index 7709727..cf0e3b2 100644
--- a/packages/Tethering/src/com/android/server/connectivity/tethering/TetheringConfiguration.java
+++ b/packages/Tethering/src/com/android/server/connectivity/tethering/TetheringConfiguration.java
@@ -251,7 +251,7 @@
     /** Check whether dun is required. */
     public static boolean checkDunRequired(Context ctx, int id) {
         final TelephonyManager tm = (TelephonyManager) ctx.getSystemService(TELEPHONY_SERVICE);
-        return (tm != null) ? tm.getTetherApnRequired(id) : false;
+        return (tm != null) ? tm.isTetherApnRequired(id) : false;
     }
 
     private static Collection<Integer> getUpstreamIfaceTypes(Resources res, boolean dunRequired) {
diff --git a/packages/Tethering/tests/unit/src/com/android/server/connectivity/tethering/TetheringConfigurationTest.java b/packages/Tethering/tests/unit/src/com/android/server/connectivity/tethering/TetheringConfigurationTest.java
index 9f9221f..9c65c0d 100644
--- a/packages/Tethering/tests/unit/src/com/android/server/connectivity/tethering/TetheringConfigurationTest.java
+++ b/packages/Tethering/tests/unit/src/com/android/server/connectivity/tethering/TetheringConfigurationTest.java
@@ -145,7 +145,7 @@
 
     @Test
     public void testDunFromTelephonyManagerMeansDun() {
-        when(mTelephonyManager.getTetherApnRequired(anyInt())).thenReturn(true);
+        when(mTelephonyManager.isTetherApnRequired(anyInt())).thenReturn(true);
 
         final TetheringConfiguration cfgWifi = getTetheringConfiguration(TYPE_WIFI);
         final TetheringConfiguration cfgMobileWifiHipri = getTetheringConfiguration(
@@ -169,7 +169,7 @@
 
     @Test
     public void testDunNotRequiredFromTelephonyManagerMeansNoDun() {
-        when(mTelephonyManager.getTetherApnRequired(anyInt())).thenReturn(false);
+        when(mTelephonyManager.isTetherApnRequired(anyInt())).thenReturn(false);
 
         final TetheringConfiguration cfgWifi = getTetheringConfiguration(TYPE_WIFI);
         final TetheringConfiguration cfgMobileWifiHipri = getTetheringConfiguration(
@@ -212,7 +212,7 @@
     @Test
     public void testNoDefinedUpstreamTypesAddsEthernet() {
         when(mResources.getIntArray(config_tether_upstream_types)).thenReturn(new int[]{});
-        when(mTelephonyManager.getTetherApnRequired(anyInt())).thenReturn(false);
+        when(mTelephonyManager.isTetherApnRequired(anyInt())).thenReturn(false);
 
         final TetheringConfiguration cfg = new TetheringConfiguration(
                 mMockContext, mLog, INVALID_SUBSCRIPTION_ID);
@@ -235,7 +235,7 @@
     public void testDefinedUpstreamTypesSansEthernetAddsEthernet() {
         when(mResources.getIntArray(config_tether_upstream_types)).thenReturn(
                 new int[]{TYPE_WIFI, TYPE_MOBILE_HIPRI});
-        when(mTelephonyManager.getTetherApnRequired(anyInt())).thenReturn(false);
+        when(mTelephonyManager.isTetherApnRequired(anyInt())).thenReturn(false);
 
         final TetheringConfiguration cfg = new TetheringConfiguration(
                 mMockContext, mLog, INVALID_SUBSCRIPTION_ID);
@@ -253,7 +253,7 @@
     public void testDefinedUpstreamTypesWithEthernetDoesNotAddEthernet() {
         when(mResources.getIntArray(config_tether_upstream_types))
                 .thenReturn(new int[]{TYPE_WIFI, TYPE_ETHERNET, TYPE_MOBILE_HIPRI});
-        when(mTelephonyManager.getTetherApnRequired(anyInt())).thenReturn(false);
+        when(mTelephonyManager.isTetherApnRequired(anyInt())).thenReturn(false);
 
         final TetheringConfiguration cfg = new TetheringConfiguration(
                 mMockContext, mLog, INVALID_SUBSCRIPTION_ID);
diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java
index 7609632..e5c8ba5 100644
--- a/services/core/java/com/android/server/am/ActivityManagerService.java
+++ b/services/core/java/com/android/server/am/ActivityManagerService.java
@@ -24,6 +24,7 @@
 import static android.Manifest.permission.REMOVE_TASKS;
 import static android.Manifest.permission.START_ACTIVITIES_FROM_BACKGROUND;
 import static android.app.ActivityManager.INSTR_FLAG_DISABLE_HIDDEN_API_CHECKS;
+import static android.app.ActivityManager.INSTR_FLAG_DISABLE_TEST_API_CHECKS;
 import static android.app.ActivityManager.INSTR_FLAG_MOUNT_EXTERNAL_STORAGE_FULL;
 import static android.app.ActivityManager.PROCESS_STATE_LAST_ACTIVITY;
 import static android.app.ActivityManager.PROCESS_STATE_NONEXISTENT;
@@ -15769,13 +15770,12 @@
 
             boolean disableHiddenApiChecks = ai.usesNonSdkApi()
                     || (flags & INSTR_FLAG_DISABLE_HIDDEN_API_CHECKS) != 0;
-            if (disableHiddenApiChecks) {
+            boolean disableTestApiChecks = disableHiddenApiChecks
+                    || (flags & INSTR_FLAG_DISABLE_TEST_API_CHECKS) != 0;
+            if (disableHiddenApiChecks || disableTestApiChecks) {
                 enforceCallingPermission(android.Manifest.permission.DISABLE_HIDDEN_API_CHECKS,
                         "disable hidden API checks");
             }
-            // Allow instrumented processes access to test APIs.
-            // TODO(satayev): make this configurable via testing framework.
-            boolean disableTestApiChecks = true;
 
             final boolean mountExtStorageFull = isCallerShell()
                     && (flags & INSTR_FLAG_MOUNT_EXTERNAL_STORAGE_FULL) != 0;
diff --git a/services/core/java/com/android/server/am/ActivityManagerShellCommand.java b/services/core/java/com/android/server/am/ActivityManagerShellCommand.java
index 0c1388c..6e92e80 100644
--- a/services/core/java/com/android/server/am/ActivityManagerShellCommand.java
+++ b/services/core/java/com/android/server/am/ActivityManagerShellCommand.java
@@ -3032,7 +3032,8 @@
             pw.println("          specified then send to all users.");
             pw.println("      --receiver-permission <PERMISSION>: Require receiver to hold permission.");
             pw.println("  instrument [-r] [-e <NAME> <VALUE>] [-p <FILE>] [-w]");
-            pw.println("          [--user <USER_ID> | current] [--no-hidden-api-checks]");
+            pw.println("          [--user <USER_ID> | current]");
+            pw.println("          [--no-hidden-api-checks [--no-test-api-checks]]");
             pw.println("          [--no-isolated-storage]");
             pw.println("          [--no-window-animation] [--abi <ABI>] <COMPONENT>");
             pw.println("      Start an Instrumentation.  Typically this target <COMPONENT> is in the");
@@ -3052,6 +3053,8 @@
             pw.println("      --user <USER_ID> | current: Specify user instrumentation runs in;");
             pw.println("          current user if not specified.");
             pw.println("      --no-hidden-api-checks: disable restrictions on use of hidden API.");
+            pw.println("      --no-test-api-checks: disable restrictions to test APIs, if hidden");
+            pw.println("          API checks are enabled.");
             pw.println("      --no-isolated-storage: don't use isolated storage sandbox and ");
             pw.println("          mount full external storage");
             pw.println("      --no-window-animation: turn off window animations while running.");
diff --git a/services/core/java/com/android/server/audio/AudioService.java b/services/core/java/com/android/server/audio/AudioService.java
index 24569a6..1f1e8a5 100644
--- a/services/core/java/com/android/server/audio/AudioService.java
+++ b/services/core/java/com/android/server/audio/AudioService.java
@@ -1461,10 +1461,13 @@
         }
         if (!TextUtils.isEmpty(packageName)) {
             PackageManager pm = mContext.getPackageManager();
+            ActivityManager am =
+                          (ActivityManager) mContext.getSystemService(mContext.ACTIVITY_SERVICE);
+
             if (pm.checkPermission(Manifest.permission.CAPTURE_AUDIO_HOTWORD, packageName)
                     == PackageManager.PERMISSION_GRANTED) {
                 try {
-                    assistantUid = pm.getPackageUid(packageName, 0);
+                    assistantUid = pm.getPackageUidAsUser(packageName, am.getCurrentUser());
                 } catch (PackageManager.NameNotFoundException e) {
                     Log.e(TAG,
                             "updateAssistantUId() could not find UID for package: " + packageName);
diff --git a/telecomm/java/android/telecom/Call.java b/telecomm/java/android/telecom/Call.java
index 3b36364..3ecf8d7 100644
--- a/telecomm/java/android/telecom/Call.java
+++ b/telecomm/java/android/telecom/Call.java
@@ -515,8 +515,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;
 
@@ -1184,7 +1184,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
@@ -1192,7 +1193,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/CallScreeningService.java b/telecomm/java/android/telecom/CallScreeningService.java
index ef1c790..b91787c 100644
--- a/telecomm/java/android/telecom/CallScreeningService.java
+++ b/telecomm/java/android/telecom/CallScreeningService.java
@@ -106,8 +106,14 @@
                     SomeArgs args = (SomeArgs) msg.obj;
                     try {
                         mCallScreeningAdapter = (ICallScreeningAdapter) args.arg1;
-                        onScreenCall(
-                                Call.Details.createFromParcelableCall((ParcelableCall) args.arg2));
+                        Call.Details callDetails = Call.Details
+                                .createFromParcelableCall((ParcelableCall) args.arg2);
+                        onScreenCall(callDetails);
+                        if (callDetails.getCallDirection() == Call.Details.DIRECTION_OUTGOING) {
+                            mCallScreeningAdapter.allowCall(callDetails.getTelecomCallId());
+                        }
+                    } catch (RemoteException e) {
+                        Log.w(this, "Exception when screening call: " + e);
                     } finally {
                         args.recycle();
                     }
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/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java
index a2e6c39..17ef4bc 100644
--- a/telephony/java/android/telephony/TelephonyManager.java
+++ b/telephony/java/android/telephony/TelephonyManager.java
@@ -477,7 +477,7 @@
      */
     @Nullable
     public TelephonyManager createForPhoneAccountHandle(PhoneAccountHandle phoneAccountHandle) {
-        int subId = getSubIdForPhoneAccountHandle(phoneAccountHandle);
+        int subId = getSubscriptionId(phoneAccountHandle);
         if (!SubscriptionManager.isValidSubscriptionId(subId)) {
             return null;
         }
@@ -7657,12 +7657,16 @@
 
     /**
      * Check whether DUN APN is required for tethering.
+     * <p>
+     * Requires Permission: READ_PRIVILEGED_PHONE_STATE.
      *
      * @return {@code true} if DUN APN is required for tethering.
      * @hide
      */
-    public boolean getTetherApnRequired() {
-        return getTetherApnRequired(getSubId(SubscriptionManager.getActiveDataSubscriptionId()));
+    @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
+    @SystemApi
+    public boolean isTetherApnRequired() {
+        return isTetherApnRequired(getSubId(SubscriptionManager.getActiveDataSubscriptionId()));
     }
 
     /**
@@ -7672,11 +7676,11 @@
      * @return {@code true} if DUN APN is required for tethering.
      * @hide
      */
-    public boolean getTetherApnRequired(int subId) {
+    public boolean isTetherApnRequired(int subId) {
         try {
             ITelephony telephony = getITelephony();
             if (telephony != null)
-                return telephony.getTetherApnRequiredForSubscriber(subId);
+                return telephony.isTetherApnRequiredForSubscriber(subId);
         } catch (RemoteException ex) {
             Rlog.e(TAG, "hasMatchedTetherApnSetting RemoteException", ex);
         } catch (NullPointerException ex) {
@@ -9467,7 +9471,7 @@
      *         permission.
      */
     @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE)
-    public int getSubIdForPhoneAccountHandle(@NonNull PhoneAccountHandle phoneAccountHandle) {
+    public int getSubscriptionId(@NonNull PhoneAccountHandle phoneAccountHandle) {
         int retval = SubscriptionManager.INVALID_SUBSCRIPTION_ID;
         try {
             ITelephony service = getITelephony();
@@ -9476,7 +9480,7 @@
                         phoneAccountHandle, mContext.getOpPackageName());
             }
         } catch (RemoteException ex) {
-            Log.e(TAG, "getSubIdForPhoneAccountHandle RemoteException", ex);
+            Log.e(TAG, "getSubscriptionId RemoteException", ex);
             ex.rethrowAsRuntimeException();
         }
         return retval;
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 +
diff --git a/telephony/java/com/android/internal/telephony/ITelephony.aidl b/telephony/java/com/android/internal/telephony/ITelephony.aidl
index 39a216d..b502ee7 100644
--- a/telephony/java/com/android/internal/telephony/ITelephony.aidl
+++ b/telephony/java/com/android/internal/telephony/ITelephony.aidl
@@ -819,7 +819,7 @@
      * @return {@code true} if DUN APN is required for tethering.
      * @hide
      */
-    boolean getTetherApnRequiredForSubscriber(int subId);
+    boolean isTetherApnRequiredForSubscriber(int subId);
 
     /**
     * Enables framework IMS and triggers IMS Registration.
diff --git a/tests/BootImageProfileTest/src/com/android/bootimageprofile/BootImageProfileTest.java b/tests/BootImageProfileTest/src/com/android/bootimageprofile/BootImageProfileTest.java
index f8e338e..59f0162 100644
--- a/tests/BootImageProfileTest/src/com/android/bootimageprofile/BootImageProfileTest.java
+++ b/tests/BootImageProfileTest/src/com/android/bootimageprofile/BootImageProfileTest.java
@@ -73,51 +73,65 @@
         res = mTestDevice.executeShellCommand("truncate -s 0 " + SYSTEM_SERVER_PROFILE).trim();
         assertTrue(res, res.length() == 0);
         // Wait up to 20 seconds for the profile to be saved.
-        for (int i = 0; i < 20; ++i) {
+        final int numIterations = 20;
+        for (int i = 1; i <= numIterations; ++i) {
             // Force save the profile since we truncated it.
             if (forceSaveProfile("system_server")) {
                 // Might fail if system server is not yet running.
                 String s = mTestDevice.executeShellCommand(
                         "wc -c <" + SYSTEM_SERVER_PROFILE).trim();
-                if (!"0".equals(s)) {
-                    break;
+                if ("0".equals(s)) {
+                    Thread.sleep(1000);
+                    continue;
                 }
             }
+
+            // In case the profile is partially saved, wait an extra second.
             Thread.sleep(1000);
-        }
-        // In case the profile is partially saved, wait an extra second.
-        Thread.sleep(1000);
-        // Validate that the profile is non empty.
-        res = mTestDevice.executeShellCommand("profman --dump-only --profile-file="
-                + SYSTEM_SERVER_PROFILE);
-        boolean sawFramework = false;
-        boolean sawServices = false;
-        for (String line : res.split("\n")) {
-            if (line.contains("framework.jar")) {
-                sawFramework = true;
-            } else if (line.contains("services.jar")) {
-                sawServices = true;
+
+            // Validate that the profile is non empty.
+            res = mTestDevice.executeShellCommand("profman --dump-only --profile-file="
+                    + SYSTEM_SERVER_PROFILE);
+            boolean sawFramework = false;
+            boolean sawServices = false;
+            for (String line : res.split("\n")) {
+                if (line.contains("framework.jar")) {
+                    sawFramework = true;
+                } else if (line.contains("services.jar")) {
+                    sawServices = true;
+                }
+            }
+            if (i == numIterations) {
+                // Only assert for last iteration since there are race conditions where the package
+                // manager might not be started whewn the profile saves.
+                assertTrue("Did not see framework.jar in " + res, sawFramework);
+                assertTrue("Did not see services.jar in " + res, sawServices);
+            }
+
+            // Test the profile contents contain common methods for core-oj that would normally be
+            // AOT compiled. Also test that services.jar has PackageManagerService.<init> since the
+            // package manager service should always be created during boot.
+            res = mTestDevice.executeShellCommand(
+                    "profman --dump-classes-and-methods --profile-file="
+                    + SYSTEM_SERVER_PROFILE + " --apk=/apex/com.android.art/javalib/core-oj.jar"
+                    + " --apk=/system/framework/services.jar");
+            boolean sawObjectInit = false;
+            boolean sawPmInit = false;
+            for (String line : res.split("\n")) {
+                if (line.contains("Ljava/lang/Object;-><init>()V")) {
+                    sawObjectInit = true;
+                } else if (line.contains("Lcom/android/server/pm/PackageManagerService;-><init>")) {
+                    sawPmInit = true;
+                }
+            }
+            if (i == numIterations) {
+                assertTrue("Did not see Object.<init> in " + res, sawObjectInit);
+                assertTrue("Did not see PackageManagerService.<init> in " + res, sawPmInit);
+            }
+
+            if (sawFramework && sawServices && sawObjectInit && sawPmInit) {
+                break;  // Asserts passed, exit.
             }
         }
-        assertTrue("Did not see framework.jar in " + res, sawFramework);
-        assertTrue("Did not see services.jar in " + res, sawServices);
-
-
-        // Test the profile contents contain common methods for core-oj that would normally be AOT
-        // compiled.
-        res = mTestDevice.executeShellCommand("profman --dump-classes-and-methods --profile-file="
-                + SYSTEM_SERVER_PROFILE + " --apk=/apex/com.android.art/javalib/core-oj.jar"
-                + " --apk=/system/framework/services.jar");
-        boolean sawObjectInit = false;
-        boolean sawPmInit = false;
-        for (String line : res.split("\n")) {
-            if (line.contains("Ljava/lang/Object;-><init>()V")) {
-                sawObjectInit = true;
-            } else if (line.contains("Lcom/android/server/pm/PackageManagerService;-><init>")) {
-                sawPmInit = true;
-            }
-        }
-        assertTrue("Did not see Object.<init> in " + res, sawObjectInit);
-        assertTrue("Did not see PackageManagerService.<init> in " + res, sawPmInit);
     }
 }
diff --git a/tests/net/integration/AndroidManifest.xml b/tests/net/integration/AndroidManifest.xml
index 91b3cd9..4dd3b5a 100644
--- a/tests/net/integration/AndroidManifest.xml
+++ b/tests/net/integration/AndroidManifest.xml
@@ -17,7 +17,6 @@
  */
 -->
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
-          xmlns:tools="http://schemas.android.com/tools"
           package="com.android.server.net.integrationtests">
 
     <!-- For ConnectivityService registerReceiverAsUser (receiving broadcasts) -->
@@ -26,13 +25,19 @@
     <uses-permission android:name="android.permission.MANAGE_USERS" />
     <!-- ConnectivityService sends notifications to BatteryStats -->
     <uses-permission android:name="android.permission.UPDATE_DEVICE_STATS" />
+    <!-- Reading network status -->
+    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
+    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
+    <uses-permission android:name="android.permission.CONNECTIVITY_INTERNAL" />
+    <uses-permission android:name="android.permission.READ_PRIVILEGED_PHONE_STATE" />
+    <!-- Reading DeviceConfig flags -->
+    <uses-permission android:name="android.permission.READ_DEVICE_CONFIG" />
     <application android:debuggable="true">
         <uses-library android:name="android.test.runner" />
 
         <!-- This manifest is merged with the base manifest of the real NetworkStack app.
              Remove the NetworkStackService from the base (real) manifest, and replace with a test
              service that responds to the same intent -->
-        <service android:name="com.android.server.NetworkStackService" tools:node="remove"/>
         <service android:name=".TestNetworkStackService"
                  android:process="com.android.server.net.integrationtests.testnetworkstack">
             <intent-filter>
@@ -45,9 +50,9 @@
                 <action android:name=".INetworkStackInstrumentation"/>
             </intent-filter>
         </service>
-        <service tools:replace="android:process"
-                 android:name="com.android.server.connectivity.ipmemorystore.RegularMaintenanceJobService"
-                 android:process="com.android.server.net.integrationtests.testnetworkstack"/>
+        <service android:name="com.android.server.connectivity.ipmemorystore.RegularMaintenanceJobService"
+                 android:process="com.android.server.net.integrationtests.testnetworkstack"
+                 android:permission="android.permission.BIND_JOB_SERVICE"/>
 
     </application>
 
diff --git a/tests/touchlag/Android.bp b/tests/touchlag/Android.bp
deleted file mode 100644
index 092eea9..0000000
--- a/tests/touchlag/Android.bp
+++ /dev/null
@@ -1,14 +0,0 @@
-cc_test {
-    name: "test-touchlag",
-    gtest: false,
-    srcs: ["touchlag.cpp"],
-    shared_libs: [
-        "libcutils",
-        "libutils",
-    ],
-    cflags: [
-        "-Wall",
-        "-Wextra",
-        "-Werror",
-    ],
-}
diff --git a/tests/touchlag/touchlag.cpp b/tests/touchlag/touchlag.cpp
deleted file mode 100644
index 9264a25..0000000
--- a/tests/touchlag/touchlag.cpp
+++ /dev/null
@@ -1,294 +0,0 @@
-/*
- * Copyright (C) 2012 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.
- */
-
-#include <stdint.h>
-#include <sys/types.h>
-
-#include <fcntl.h>
-#include <sys/ioctl.h>
-#include <linux/fb.h>
-#include <linux/input.h>
-#include <errno.h>
-#include <string.h>
-#include <stdio.h>
-#include <cutils/memory.h>
-#include <asm-generic/mman.h>
-#include <sys/mman.h>
-#include <utils/threads.h>
-#include <unistd.h>
-#include <math.h>
-
-using namespace android;
-
-#ifndef FBIO_WAITFORVSYNC
-#define FBIO_WAITFORVSYNC   _IOW('F', 0x20, __u32)
-#endif
-
-struct Buffer {
-    size_t w;
-    size_t h;
-    size_t s;
-    union {
-        void* addr;
-        uint32_t* pixels;
-    };
-};
-
-void clearBuffer(Buffer* buf, uint32_t pixel) {
-    android_memset32(buf->pixels, pixel, buf->s * buf->h * 4);
-}
-
-void drawTwoPixels(Buffer* buf, uint32_t pixel, ssize_t x, ssize_t y, size_t w) {
-    if (y>0 && y<ssize_t(buf->h)) {
-        uint32_t* bits = buf->pixels + y * buf->s;
-        if (x>=0 && x<ssize_t(buf->w)) {
-            bits[x] = pixel;
-        }
-        ssize_t W(w);
-        if ((x+W)>=0 && (x+W)<ssize_t(buf->w)) {
-            bits[x+W] = pixel;
-        }
-    }
-}
-
-void drawHLine(Buffer* buf, uint32_t pixel, ssize_t x, ssize_t y, size_t w) {
-    if (y>0 && y<ssize_t(buf->h)) {
-        ssize_t W(w);
-        if (x<0) {
-            W += x;
-            x = 0;
-        }
-        if (x+w > buf->w) {
-            W = buf->w - x;
-        }
-        if (W>0) {
-            uint32_t* bits = buf->pixels + y * buf->s + x;
-            android_memset32(bits, pixel, W*4);
-        }
-    }
-}
-
-void drawRect(Buffer* buf, uint32_t pixel, ssize_t x, ssize_t y, size_t w, size_t h) {
-    ssize_t W(w), H(h);
-    if (x<0) {
-        w += x;
-        x = 0;
-    }
-    if (y<0) {
-        h += y;
-        y = 0;
-    }
-    if (x+w > buf->w)   W = buf->w - x;
-    if (y+h > buf->h)   H = buf->h - y;
-    if (W>0 && H>0) {
-        uint32_t* bits = buf->pixels + y * buf->s + x;
-        for (ssize_t i=0 ; i<H ; i++) {
-            android_memset32(bits, pixel, W*4);
-            bits += buf->s;
-        }
-    }
-}
-
-void drawCircle(Buffer* buf, uint32_t pixel,
-        size_t x0, size_t y0, size_t radius, bool filled = false) {
-    ssize_t f = 1 - radius;
-    ssize_t ddF_x = 1;
-    ssize_t ddF_y = -2 * radius;
-    ssize_t x = 0;
-    ssize_t y = radius;
-    if (filled) {
-        drawHLine(buf, pixel, x0-radius, y0, 2*radius);
-    } else {
-        drawTwoPixels(buf, pixel, x0-radius, y0, 2*radius);
-    }
-    while (x < y) {
-        if (f >= 0) {
-            y--;
-            ddF_y += 2;
-            f += ddF_y;
-        }
-        x++;
-        ddF_x += 2;
-        f += ddF_x;
-        if (filled) {
-            drawHLine(buf, pixel, x0-x, y0+y, 2*x);
-            drawHLine(buf, pixel, x0-x, y0-y, 2*x);
-            drawHLine(buf, pixel, x0-y, y0+x, 2*y);
-            drawHLine(buf, pixel, x0-y, y0-x, 2*y);
-        } else {
-            drawTwoPixels(buf, pixel, x0-x, y0+y, 2*x);
-            drawTwoPixels(buf, pixel, x0-x, y0-y, 2*x);
-            drawTwoPixels(buf, pixel, x0-y, y0+x, 2*y);
-            drawTwoPixels(buf, pixel, x0-y, y0-x, 2*y);
-        }
-    }
-}
-
-class TouchEvents {
-    class EventThread : public Thread {
-        int fd;
-
-        virtual bool threadLoop() {
-            input_event event;
-            int first_down = 0;
-            do {
-                read(fd, &event, sizeof(event));
-                if (event.type == EV_ABS) {
-                    if (event.code == ABS_MT_TRACKING_ID) {
-                        down = event.value == -1 ? 0 : 1;
-                        first_down = down;
-                    }
-                    if (event.code == ABS_MT_POSITION_X) {
-                        x = event.value;
-                    }
-                    if (event.code == ABS_MT_POSITION_Y) {
-                        y = event.value;
-                    }
-                }
-            } while (event.type == EV_SYN);
-            return true;
-        }
-
-    public:
-        int x, y, down;
-        EventThread() : Thread(false),
-                x(0), y(0), down(0)
-        {
-            fd = open("/dev/input/event1", O_RDONLY);
-        }
-};
-    sp<EventThread> thread;
-
-public:
-    TouchEvents() {
-        thread = new EventThread();
-        thread->run("EventThread", PRIORITY_URGENT_DISPLAY);
-    }
-
-    int getMostRecentPosition(int* x, int* y) {
-        *x = thread->x;
-        *y = thread->y;
-        return thread->down;
-    }
-};
-
-
-struct Queue {
-    struct position {
-        int x, y;
-    };
-    int index;
-    position q[16];
-    Queue() : index(0) { }
-    void push(int x, int y) {
-        index++;
-        index &= 0xF;
-        q[index].x = x;
-        q[index].y = y;
-    }
-    void get(int lag, int* x, int* y) {
-        const int i = (index - lag) & 0xF;
-        *x = q[i].x;
-        *y = q[i].y;
-    }
-};
-
-extern char *optarg;
-extern int optind;
-extern int optopt;
-extern int opterr;
-extern int optreset;
-
-void usage(const char* name) {
-    printf("\nusage: %s [-h] [-l lag]\n", name);
-}
-
-int main(int argc, char** argv) {
-    fb_var_screeninfo vi;
-    fb_fix_screeninfo fi;
-
-    int lag = 0;
-    int fd = open("/dev/graphics/fb0", O_RDWR);
-    ioctl(fd, FBIOGET_VSCREENINFO, &vi);
-    ioctl(fd, FBIOGET_FSCREENINFO, &fi);
-    void* bits = mmap(0, fi.smem_len, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
-    Buffer framebuffer;
-    framebuffer.w = vi.xres;
-    framebuffer.h = vi.yres;
-    framebuffer.s = fi.line_length / (vi.bits_per_pixel >> 3);
-    framebuffer.addr = bits;
-
-    int ch;
-    while ((ch = getopt(argc, argv, "hl:")) != -1) {
-        switch (ch) {
-            case 'l':
-                lag = atoi(optarg);
-                break;
-            case 'h':
-            default:
-                usage(argv[0]);
-                exit(0);
-        }
-    }
-    argc -= optind;
-    argv += optind;
-
-
-    TouchEvents touch;
-    Queue queue;
-
-
-    int x=0, y=0;
-    int lag_x=0, lag_y=0;
-
-    clearBuffer(&framebuffer, 0);
-    while (true) {
-        uint32_t crt = 0;
-        ioctl(fd, FBIO_WAITFORVSYNC, &crt);
-
-        // draw beam marker
-        drawRect(&framebuffer, 0x400000, framebuffer.w-2, 0, 2, framebuffer.h);
-        // erase screen
-        if (lag) {
-            drawCircle(&framebuffer, 0, lag_x, lag_y, 100);
-            drawHLine(&framebuffer, 0, 0, lag_y, 32);
-        }
-        drawCircle(&framebuffer, 0, x, y, 100, true);
-        drawHLine(&framebuffer, 0, 0, y, 32);
-
-        // draw a line at y=1000
-        drawHLine(&framebuffer, 0x808080, 0, 1000, framebuffer.w);
-
-        // get touch events
-        touch.getMostRecentPosition(&x, &y);
-        queue.push(x, y);
-        queue.get(lag, &lag_x, &lag_y);
-
-        if (lag) {
-            drawCircle(&framebuffer, 0x00FF00, lag_x, lag_y, 100);
-            drawHLine(&framebuffer, 0x00FF00, 0, lag_y, 32);
-        }
-
-        drawCircle(&framebuffer, 0xFFFFFF, x, y, 100, true);
-        drawHLine(&framebuffer, 0xFFFFFF, 0, y, 32);
-
-        // draw end of frame beam marker
-        drawRect(&framebuffer, 0x004000, framebuffer.w-2, 0, 2, framebuffer.h);
-    }
-
-    close(fd);
-    return 0;
-}