Merge changes Icb062ffb,I66c4e8f5,I85247411,Id47c19b7,Ib713c4ae, ...

* changes:
  [NS A36] Add a test for lost trusted capability
  [NS A35] Send updated scores to factories at the end.
  [NS A34] Still more simplification
  [NS A33] Unify changing the default network
  [NS A32] More simplification
  [NS A31] Simplification
  [NS A30] Note linger out of the rematch loop
  [NS A29] Call LOST callbacks at the end of the rematch.
  [NS A28] Move setting the default network out of the rematch loop.
diff --git a/apex/sdkextensions/framework/Android.bp b/apex/sdkextensions/framework/Android.bp
index 245a96b..86f4ab7 100644
--- a/apex/sdkextensions/framework/Android.bp
+++ b/apex/sdkextensions/framework/Android.bp
@@ -44,34 +44,68 @@
     ],
 }
 
-droidstubs {
-    name: "framework-sdkextensions-droidstubs-publicapi",
-    defaults: [
-        "framework-sdkextensions-stubs-defaults",
-        "framework-module-stubs-defaults-publicapi",
-    ]
-}
-
-droidstubs {
-    name: "framework-sdkextensions-droidstubs-systemapi",
-    defaults: [
-        "framework-sdkextensions-stubs-defaults",
-        "framework-module-stubs-defaults-systemapi",
-    ]
-}
-
 stubs_defaults {
     name: "framework-sdkextensions-stubs-defaults",
-    srcs: [
-        ":framework-sdkextensions-sources",
-        ":framework-annotations",
-    ],
+    srcs: [ ":framework-sdkextensions-sources" ],
+    libs: [ "framework-annotations-lib" ],
     sdk_version: "system_current",
 }
 
+droidstubs {
+    name: "framework-sdkextensions-stubs-srcs-publicapi",
+    defaults: [
+        "framework-module-stubs-defaults-publicapi",
+        "framework-sdkextensions-stubs-defaults",
+    ]
+}
+
+droidstubs {
+    name: "framework-sdkextensions-stubs-srcs-systemapi",
+    defaults: [
+        "framework-module-stubs-defaults-systemapi",
+        "framework-sdkextensions-stubs-defaults",
+    ]
+}
+
+droidstubs {
+    name: "framework-sdkextensions-api-module_libs_api",
+    defaults: [
+        "framework-module-api-defaults-module_libs_api",
+        "framework-sdkextensions-stubs-defaults",
+    ]
+}
+
+droidstubs {
+    name: "framework-sdkextensions-stubs-srcs-module_libs_api",
+    defaults: [
+        "framework-module-stubs-defaults-module_libs_api",
+        "framework-sdkextensions-stubs-defaults",
+    ]
+}
+
+java_library {
+    name: "framework-sdkextensions-stubs-publicapi",
+    srcs: [":framework-sdkextensions-stubs-srcs-publicapi"],
+    sdk_version: "current",
+    visibility: [
+        "//frameworks/base", // Framework
+        "//frameworks/base/apex/sdkextensions", // sdkextensions SDK
+    ]
+}
+
 java_library {
     name: "framework-sdkextensions-stubs-systemapi",
-    srcs: [":framework-sdkextensions-droidstubs-systemapi"],
+    srcs: [":framework-sdkextensions-stubs-srcs-systemapi"],
+    sdk_version: "system_current",
+    visibility: [
+        "//frameworks/base", // Framework
+        "//frameworks/base/apex/sdkextensions", // sdkextensions SDK
+    ]
+}
+
+java_library {
+    name: "framework-sdkextensions-stubs-module_libs_api",
+    srcs: [":framework-sdkextensions-stubs-srcs-module_libs_api"],
     sdk_version: "system_current",
     visibility: [
         "//frameworks/base", // Framework
diff --git a/api/module-lib-current.txt b/api/module-lib-current.txt
index 278a186..8ba204c 100644
--- a/api/module-lib-current.txt
+++ b/api/module-lib-current.txt
@@ -87,8 +87,8 @@
     method @NonNull public java.util.List<android.timezone.CountryTimeZones.TimeZoneMapping> getEffectiveTimeZoneMappingsAt(long);
     method public boolean hasUtcZone(long);
     method public boolean isDefaultTimeZoneBoosted();
-    method public boolean isForCountryCode(@NonNull String);
     method @Nullable public android.timezone.CountryTimeZones.OffsetResult lookupByOffsetWithBias(int, @Nullable Boolean, @Nullable Integer, long, @Nullable android.icu.util.TimeZone);
+    method public boolean matchesCountryCode(@NonNull String);
   }
 
   public static final class CountryTimeZones.OffsetResult {
@@ -98,7 +98,7 @@
   }
 
   public static final class CountryTimeZones.TimeZoneMapping {
-    method @Nullable public android.icu.util.TimeZone getTimeZone();
+    method @NonNull public android.icu.util.TimeZone getTimeZone();
     method @NonNull public String getTimeZoneId();
   }
 
diff --git a/api/system-current.txt b/api/system-current.txt
index 6db19a8..ef3ce2a 100755
--- a/api/system-current.txt
+++ b/api/system-current.txt
@@ -4602,6 +4602,12 @@
     field public final android.net.WifiKey wifiKey;
   }
 
+  public class NetworkPolicyManager {
+    method public void setSubscriptionOverride(int, int, int, long, @NonNull String);
+    field public static final int SUBSCRIPTION_OVERRIDE_CONGESTED = 2; // 0x2
+    field public static final int SUBSCRIPTION_OVERRIDE_UNMETERED = 1; // 0x1
+  }
+
   public class NetworkProvider {
     ctor public NetworkProvider(@NonNull android.content.Context, @NonNull android.os.Looper, @NonNull String);
     method @RequiresPermission(android.Manifest.permission.NETWORK_FACTORY) public void declareNetworkRequestUnfulfillable(@NonNull android.net.NetworkRequest);
diff --git a/cmds/statsd/src/atoms.proto b/cmds/statsd/src/atoms.proto
index 777bea0..d1fb2db 100644
--- a/cmds/statsd/src/atoms.proto
+++ b/cmds/statsd/src/atoms.proto
@@ -351,6 +351,7 @@
             228 [(allow_from_any_uid) = true];
         PerfettoUploaded perfetto_uploaded =
             229 [(log_from_module) = "perfetto"];
+        UserspaceRebootReported userspace_reboot_reported = 243;
     }
 
     // Pulled events will start at field 10000.
@@ -6987,3 +6988,43 @@
     // The number of reboot of the device during a successful update.
     optional int32 reboot_count = 7;
 }
+
+/*
+ * Logs userspace reboot outcome and duration.
+ *
+ * Logged from:
+ *   frameworks/base/core/java/com/android/server/BootReceiver.java
+ */
+message UserspaceRebootReported {
+    // Possible outcomes of userspace reboot.
+    enum Outcome {
+        // Default value in case platform failed to determine the outcome.
+        OUTCOME_UNKNOWN = 0;
+        // Userspace reboot succeeded (i.e. boot completed without a fall back to hard reboot).
+        SUCCESS = 1;
+        // Userspace reboot shutdown sequence was aborted.
+        FAILED_SHUTDOWN_SEQUENCE_ABORTED = 2;
+        // Remounting userdata into checkpointing mode failed.
+        FAILED_USERDATA_REMOUNT = 3;
+        // Device didn't finish booting before timeout and userspace reboot watchdog issued a hard
+        // reboot.
+        FAILED_USERSPACE_REBOOT_WATCHDOG_TRIGGERED = 4;
+    }
+    // Outcome of userspace reboot. Always set.
+    optional Outcome outcome = 1;
+    // Duration of userspace reboot in case it has a successful outcome.
+    // Duration is measured as time between userspace reboot was initiated and until boot completed
+    // (e.g. sys.boot_completed=1).
+    optional int64 duration_millis = 2;
+    // State of primary user's (user0) credential encryption storage.
+    enum UserEncryptionState {
+        // Default value.
+        USER_ENCRYPTION_STATE_UNKNOWN = 0;
+        // Credential encrypted storage is unlocked.
+        UNLOCKED = 1;
+        // Credential encrypted storage is locked.
+        LOCKED = 2;
+    }
+    // State of primary user's encryption storage at the moment boot completed. Always set.
+    optional UserEncryptionState user_encryption_state = 3;
+}
diff --git a/core/java/android/net/NetworkPolicyManager.java b/core/java/android/net/NetworkPolicyManager.java
index d1c1329..32e6a6d 100644
--- a/core/java/android/net/NetworkPolicyManager.java
+++ b/core/java/android/net/NetworkPolicyManager.java
@@ -18,6 +18,9 @@
 
 import static android.content.pm.PackageManager.GET_SIGNATURES;
 
+import android.annotation.IntDef;
+import android.annotation.NonNull;
+import android.annotation.SystemApi;
 import android.annotation.SystemService;
 import android.app.ActivityManager;
 import android.compat.annotation.UnsupportedAppUsage;
@@ -38,6 +41,8 @@
 
 import com.google.android.collect.Sets;
 
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
 import java.time.ZonedDateTime;
 import java.util.HashSet;
 import java.util.Iterator;
@@ -48,14 +53,24 @@
  * {@hide}
  */
 @SystemService(Context.NETWORK_POLICY_SERVICE)
+@SystemApi
 public class NetworkPolicyManager {
 
     /* POLICY_* are masks and can be ORed, although currently they are not.*/
-    /** No specific network policy, use system default. */
+    /**
+     * No specific network policy, use system default.
+     * @hide
+     */
     public static final int POLICY_NONE = 0x0;
-    /** Reject network usage on metered networks when application in background. */
+    /**
+     * Reject network usage on metered networks when application in background.
+     * @hide
+     */
     public static final int POLICY_REJECT_METERED_BACKGROUND = 0x1;
-    /** Allow metered network use in the background even when in data usage save mode. */
+    /**
+     * Allow metered network use in the background even when in data usage save mode.
+     * @hide
+     */
     public static final int POLICY_ALLOW_METERED_BACKGROUND = 0x4;
 
     /*
@@ -74,49 +89,98 @@
      *
      * See network-policy-restrictions.md for more info.
      */
-    /** No specific rule was set */
+    /**
+     * No specific rule was set
+     * @hide
+     */
     public static final int RULE_NONE = 0;
-    /** Allow traffic on metered networks. */
+    /**
+     * Allow traffic on metered networks.
+     * @hide
+     */
     public static final int RULE_ALLOW_METERED = 1 << 0;
-    /** Temporarily allow traffic on metered networks because app is on foreground. */
+    /**
+     * Temporarily allow traffic on metered networks because app is on foreground.
+     * @hide
+     */
     public static final int RULE_TEMPORARY_ALLOW_METERED = 1 << 1;
-    /** Reject traffic on metered networks. */
+    /**
+     * Reject traffic on metered networks.
+     * @hide
+     */
     public static final int RULE_REJECT_METERED = 1 << 2;
-    /** Network traffic should be allowed on all networks (metered or non-metered), although
-     * metered-network restrictions could still apply. */
+    /**
+     * Network traffic should be allowed on all networks (metered or non-metered), although
+     * metered-network restrictions could still apply.
+     * @hide
+     */
     public static final int RULE_ALLOW_ALL = 1 << 5;
-    /** Reject traffic on all networks. */
+    /**
+     * Reject traffic on all networks.
+     * @hide
+     */
     public static final int RULE_REJECT_ALL = 1 << 6;
-    /** Mask used to get the {@code RULE_xxx_METERED} rules */
+    /**
+     * Mask used to get the {@code RULE_xxx_METERED} rules
+     * @hide
+     */
     public static final int MASK_METERED_NETWORKS = 0b00001111;
-    /** Mask used to get the {@code RULE_xxx_ALL} rules */
+    /**
+     * Mask used to get the {@code RULE_xxx_ALL} rules
+     * @hide
+     */
     public static final int MASK_ALL_NETWORKS     = 0b11110000;
 
+    /** @hide */
     public static final int FIREWALL_RULE_DEFAULT = 0;
 
+    /** @hide */
     public static final String FIREWALL_CHAIN_NAME_NONE = "none";
+    /** @hide */
     public static final String FIREWALL_CHAIN_NAME_DOZABLE = "dozable";
+    /** @hide */
     public static final String FIREWALL_CHAIN_NAME_STANDBY = "standby";
+    /** @hide */
     public static final String FIREWALL_CHAIN_NAME_POWERSAVE = "powersave";
 
     private static final boolean ALLOW_PLATFORM_APP_POLICY = true;
 
+    /** @hide */
     public static final int FOREGROUND_THRESHOLD_STATE =
             ActivityManager.PROCESS_STATE_BOUND_FOREGROUND_SERVICE;
 
     /**
      * {@link Intent} extra that indicates which {@link NetworkTemplate} rule it
      * applies to.
+     * @hide
      */
     public static final String EXTRA_NETWORK_TEMPLATE = "android.net.NETWORK_TEMPLATE";
 
-    public static final int OVERRIDE_UNMETERED = 1 << 0;
-    public static final int OVERRIDE_CONGESTED = 1 << 1;
+    /**
+     * Mask used to check if an override value is marked as unmetered.
+     */
+    public static final int SUBSCRIPTION_OVERRIDE_UNMETERED = 1 << 0;
+
+    /**
+     * Mask used to check if an override value is marked as congested.
+     */
+    public static final int SUBSCRIPTION_OVERRIDE_CONGESTED = 1 << 1;
+
+    /**
+     * @hide
+     */
+    @Retention(RetentionPolicy.SOURCE)
+    @IntDef(flag = true, prefix = { "SUBSCRIPTION_OVERRIDE_" }, value = {
+        SUBSCRIPTION_OVERRIDE_UNMETERED,
+        SUBSCRIPTION_OVERRIDE_CONGESTED
+    })
+    public @interface SubscriptionOverrideMask {}
 
     private final Context mContext;
     @UnsupportedAppUsage
     private INetworkPolicyManager mService;
 
+    /** @hide */
     public NetworkPolicyManager(Context context, INetworkPolicyManager service) {
         if (service == null) {
             throw new IllegalArgumentException("missing INetworkPolicyManager");
@@ -125,6 +189,7 @@
         mService = service;
     }
 
+    /** @hide */
     @UnsupportedAppUsage
     public static NetworkPolicyManager from(Context context) {
         return (NetworkPolicyManager) context.getSystemService(Context.NETWORK_POLICY_SERVICE);
@@ -135,6 +200,7 @@
      *
      * @param policy should be {@link #POLICY_NONE} or any combination of {@code POLICY_} flags,
      *     although it is not validated.
+     * @hide
      */
     @UnsupportedAppUsage
     public void setUidPolicy(int uid, int policy) {
@@ -152,6 +218,7 @@
      *
      * @param policy should be {@link #POLICY_NONE} or any combination of {@code POLICY_} flags,
      *     although it is not validated.
+     * @hide
      */
     public void addUidPolicy(int uid, int policy) {
         try {
@@ -168,6 +235,7 @@
      *
      * @param policy should be {@link #POLICY_NONE} or any combination of {@code POLICY_} flags,
      *     although it is not validated.
+     * @hide
      */
     public void removeUidPolicy(int uid, int policy) {
         try {
@@ -177,6 +245,7 @@
         }
     }
 
+    /** @hide */
     @UnsupportedAppUsage
     public int getUidPolicy(int uid) {
         try {
@@ -186,6 +255,7 @@
         }
     }
 
+    /** @hide */
     @UnsupportedAppUsage
     public int[] getUidsWithPolicy(int policy) {
         try {
@@ -195,6 +265,7 @@
         }
     }
 
+    /** @hide */
     @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 115609023)
     public void registerListener(INetworkPolicyListener listener) {
         try {
@@ -204,6 +275,7 @@
         }
     }
 
+    /** @hide */
     @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 115609023)
     public void unregisterListener(INetworkPolicyListener listener) {
         try {
@@ -213,6 +285,7 @@
         }
     }
 
+    /** @hide */
     public void setNetworkPolicies(NetworkPolicy[] policies) {
         try {
             mService.setNetworkPolicies(policies);
@@ -221,6 +294,7 @@
         }
     }
 
+    /** @hide */
     @UnsupportedAppUsage
     public NetworkPolicy[] getNetworkPolicies() {
         try {
@@ -230,6 +304,7 @@
         }
     }
 
+    /** @hide */
     @UnsupportedAppUsage
     public void setRestrictBackground(boolean restrictBackground) {
         try {
@@ -239,6 +314,7 @@
         }
     }
 
+    /** @hide */
     @UnsupportedAppUsage
     public boolean getRestrictBackground() {
         try {
@@ -249,6 +325,32 @@
     }
 
     /**
+     * Override connections to be temporarily marked as either unmetered or congested,
+     * along with automatic timeouts if desired.
+     *
+     * @param subId the subscriber ID this override applies to.
+     * @param overrideMask the bitmask that specifies which of the overrides is being
+     *            set or cleared.
+     * @param overrideValue the override values to set or clear.
+     * @param timeoutMillis the timeout after which the requested override will
+     *            be automatically cleared, or {@code 0} to leave in the
+     *            requested state until explicitly cleared, or the next reboot,
+     *            whichever happens first
+     * @param callingPackage the name of the package making the call.
+     *
+     */
+    public void setSubscriptionOverride(int subId, @SubscriptionOverrideMask int overrideMask,
+            @SubscriptionOverrideMask int overrideValue, long timeoutMillis,
+                    @NonNull String callingPackage) {
+        try {
+            mService.setSubscriptionOverride(subId, overrideMask, overrideValue, timeoutMillis,
+                    callingPackage);
+        } catch (RemoteException e) {
+            throw e.rethrowFromSystemServer();
+        }
+    }
+
+    /**
      * Resets network policy settings back to factory defaults.
      *
      * @hide
@@ -286,6 +388,7 @@
     /**
      * Check if given UID can have a {@link #setUidPolicy(int, int)} defined,
      * usually to protect critical system services.
+     * @hide
      */
     @Deprecated
     public static boolean isUidValidForPolicy(Context context, int uid) {
@@ -353,6 +456,7 @@
     /**
      * Returns true if {@param procState} is considered foreground and as such will be allowed
      * to access network when the device is idle or in battery saver mode. Otherwise, false.
+     * @hide
      */
     public static boolean isProcStateAllowedWhileIdleOrPowerSaveMode(int procState) {
         return procState <= FOREGROUND_THRESHOLD_STATE;
@@ -361,16 +465,19 @@
     /**
      * Returns true if {@param procState} is considered foreground and as such will be allowed
      * to access network when the device is in data saver mode. Otherwise, false.
+     * @hide
      */
     public static boolean isProcStateAllowedWhileOnRestrictBackground(int procState) {
         return procState <= FOREGROUND_THRESHOLD_STATE;
     }
 
+    /** @hide */
     public static String resolveNetworkId(WifiConfiguration config) {
         return WifiInfo.sanitizeSsid(config.isPasspoint()
                 ? config.providerFriendlyName : config.SSID);
     }
 
+    /** @hide */
     public static String resolveNetworkId(String ssid) {
         return WifiInfo.sanitizeSsid(ssid);
     }
diff --git a/core/java/android/timezone/CountryTimeZones.java b/core/java/android/timezone/CountryTimeZones.java
index 5875761..970acd0 100644
--- a/core/java/android/timezone/CountryTimeZones.java
+++ b/core/java/android/timezone/CountryTimeZones.java
@@ -51,8 +51,10 @@
         }
 
         /**
-         * Returns the ID for this mapping. See also {@link #getTimeZone()} which handles when the
-         * ID is unrecognized.
+         * Returns the ID for this mapping. The ID is a tzdb time zone identifier like
+         * "America/Los_Angeles" that can be used with methods such as {@link
+         * TimeZone#getFrozenTimeZone(String)}. See {@link #getTimeZone()} which returns a frozen
+         * {@link TimeZone} object.
          */
         @NonNull
         public String getTimeZoneId() {
@@ -60,10 +62,9 @@
         }
 
         /**
-         * Returns a {@link TimeZone} object for this mapping, or {@code null} if the ID is
-         * unrecognized.
+         * Returns a frozen {@link TimeZone} object for this mapping.
          */
-        @Nullable
+        @NonNull
         public TimeZone getTimeZone() {
             return mDelegate.getTimeZone();
         }
@@ -158,9 +159,10 @@
     }
 
     /**
-     * Returns true if the ISO code for the country is a match for the one specified.
+     * Returns true if the ISO code for the country is a case-insensitive match for the one
+     * supplied.
      */
-    public boolean isForCountryCode(@NonNull String countryIso) {
+    public boolean matchesCountryCode(@NonNull String countryIso) {
         return mDelegate.isForCountryCode(countryIso);
     }
 
@@ -183,15 +185,25 @@
     }
 
     /**
-     * Qualifier for a country's default time zone. {@code true} indicates whether the default
-     * would be a good choice <em>generally</em> when there's no other information available.
+     * Qualifier for a country's default time zone. {@code true} indicates that the country's
+     * default time zone would be a good choice <em>generally</em> when there's no UTC offset
+     * information available. This will only be {@code true} in countries with multiple zones where
+     * a large majority of the population is covered by only one of them.
      */
     public boolean isDefaultTimeZoneBoosted() {
         return mDelegate.isDefaultTimeZoneBoosted();
     }
 
     /**
-     * Returns true if the country has at least one zone that is the same as UTC at the given time.
+     * Returns {@code true} if the country has at least one time zone that uses UTC at the given
+     * time. This is an efficient check when trying to validate received UTC offset information.
+     * For example, there are situations when a detected zero UTC offset cannot be distinguished
+     * from "no information available" or a corrupted signal. This method is useful because checking
+     * offset information for large countries is relatively expensive but it is generally only the
+     * countries close to the prime meridian that use UTC at <em>any</em> time of the year.
+     *
+     * @param whenMillis the time the offset information is for in milliseconds since the beginning
+     *     of the Unix epoch
      */
     public boolean hasUtcZone(long whenMillis) {
         return mDelegate.hasUtcZone(whenMillis);
diff --git a/core/java/com/android/ims/internal/uce/common/CapInfo.java b/core/java/com/android/ims/internal/uce/common/CapInfo.java
index 2bb3f1f..a7a90f6 100644
--- a/core/java/com/android/ims/internal/uce/common/CapInfo.java
+++ b/core/java/com/android/ims/internal/uce/common/CapInfo.java
@@ -78,6 +78,10 @@
     private boolean mChatbotSupported = false;
     /** Chatbot role support. */
     private boolean mChatbotRoleSupported = false;
+    /** Standalone Chatbot communication support. */
+    private boolean mSmChatbotSupported = false;
+    /** MMtel based call composer support. */
+    private boolean mMmtelCallComposerSupported = false;
     /** List of supported extensions. */
     private String[] mExts = new String[10];
     /** Time used to compute when to query again. */
@@ -498,6 +502,34 @@
         this.mChatbotRoleSupported = chatbotRoleSupported;
     }
 
+    /**
+     * Checks whether standalone chatbot communication is supported.
+     */
+    public boolean isSmChatbotSupported() {
+        return mSmChatbotSupported;
+    }
+
+    /**
+     * Sets standalone chatbot communication as supported or not supported.
+     */
+    public void setSmChatbotSupported(boolean smChatbotSupported) {
+        this.mSmChatbotSupported = smChatbotSupported;
+    }
+
+    /**
+     * Checks whether Mmtel based call composer is supported.
+     */
+    public boolean isMmtelCallComposerSupported() {
+        return mMmtelCallComposerSupported;
+    }
+
+    /**
+     * Sets Mmtel based call composer as supported or not supported.
+     */
+    public void setMmtelCallComposerSupported(boolean mmtelCallComposerSupported) {
+        this.mMmtelCallComposerSupported = mmtelCallComposerSupported;
+    }
+
     /** Gets the list of supported extensions. */
     public String[] getExts() {
         return mExts;
@@ -553,6 +585,8 @@
         dest.writeInt(mSharedSketchSupported ? 1 : 0);
         dest.writeInt(mChatbotSupported ? 1 : 0);
         dest.writeInt(mChatbotRoleSupported ? 1 : 0);
+        dest.writeInt(mSmChatbotSupported ? 1 : 0);
+        dest.writeInt(mMmtelCallComposerSupported ? 1 : 0);
 
         dest.writeInt(mRcsIpVoiceCallSupported ? 1 : 0);
         dest.writeInt(mRcsIpVideoCallSupported ? 1 : 0);
@@ -602,6 +636,8 @@
         mSharedSketchSupported = (source.readInt() == 0) ? false : true;
         mChatbotSupported = (source.readInt() == 0) ? false : true;
         mChatbotRoleSupported = (source.readInt() == 0) ? false : true;
+        mSmChatbotSupported = (source.readInt() == 0) ? false : true;
+        mMmtelCallComposerSupported = (source.readInt() == 0) ? false : true;
 
         mRcsIpVoiceCallSupported = (source.readInt() == 0) ? false : true;
         mRcsIpVideoCallSupported = (source.readInt() == 0) ? false : true;
diff --git a/core/proto/android/server/connectivity/data_stall_event.proto b/core/proto/android/server/connectivity/data_stall_event.proto
index a82326f..23fcf6e 100644
--- a/core/proto/android/server/connectivity/data_stall_event.proto
+++ b/core/proto/android/server/connectivity/data_stall_event.proto
@@ -34,7 +34,7 @@
     AP_BAND_5GHZ = 2;
 }
 
-// Refer to definition in ServiceState.java.
+// Refer to definition in TelephonyManager.java.
 enum RadioTech {
   RADIO_TECHNOLOGY_UNKNOWN = 0;
   RADIO_TECHNOLOGY_GPRS = 1;
@@ -49,8 +49,8 @@
   RADIO_TECHNOLOGY_HSUPA = 10;
   RADIO_TECHNOLOGY_HSPA = 11;
   RADIO_TECHNOLOGY_EVDO_B = 12;
-  RADIO_TECHNOLOGY_EHRPD = 13;
-  RADIO_TECHNOLOGY_LTE = 14;
+  RADIO_TECHNOLOGY_LTE = 13;
+  RADIO_TECHNOLOGY_EHRPD = 14;
   RADIO_TECHNOLOGY_HSPAP = 15;
   RADIO_TECHNOLOGY_GSM = 16;
   RADIO_TECHNOLOGY_TD_SCDMA = 17;
diff --git a/packages/SettingsLib/src/com/android/settingslib/license/LicenseHtmlGeneratorFromXml.java b/packages/SettingsLib/src/com/android/settingslib/license/LicenseHtmlGeneratorFromXml.java
index 9db4a35..b4c95e6 100644
--- a/packages/SettingsLib/src/com/android/settingslib/license/LicenseHtmlGeneratorFromXml.java
+++ b/packages/SettingsLib/src/com/android/settingslib/license/LicenseHtmlGeneratorFromXml.java
@@ -35,8 +35,10 @@
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.HashMap;
+import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
+import java.util.Set;
 import java.util.zip.GZIPInputStream;
 
 /**
@@ -84,7 +86,7 @@
      * "9645f39e9db895a4aa6e02cb57294595". Here "9645f39e9db895a4aa6e02cb57294595" is a MD5 sum
      * of the content of packages/services/Telephony/MODULE_LICENSE_APACHE2.
      */
-    private final Map<String, String> mFileNameToContentIdMap = new HashMap();
+    private final Map<String, Set<String>> mFileNameToContentIdMap = new HashMap();
 
     /*
      * A map from a content id (MD5 sum of file content) to a license file content.
@@ -186,10 +188,10 @@
      *     </licenses>
      */
     @VisibleForTesting
-    static void parse(InputStreamReader in, Map<String, String> outFileNameToContentIdMap,
+    static void parse(InputStreamReader in, Map<String, Set<String>> outFileNameToContentIdMap,
             Map<String, String> outContentIdToFileContentMap)
                     throws XmlPullParserException, IOException {
-        Map<String, String> fileNameToContentIdMap = new HashMap<String, String>();
+        Map<String, Set<String>> fileNameToContentIdMap = new HashMap<String, Set<String>>();
         Map<String, String> contentIdToFileContentMap = new HashMap<String, String>();
 
         XmlPullParser parser = Xml.newPullParser();
@@ -206,7 +208,10 @@
                     if (!TextUtils.isEmpty(contentId)) {
                         String fileName = readText(parser).trim();
                         if (!TextUtils.isEmpty(fileName)) {
-                            fileNameToContentIdMap.put(fileName, contentId);
+                            Set<String> contentIds =
+                                    fileNameToContentIdMap.computeIfAbsent(
+                                            fileName, k -> new HashSet<>());
+                            contentIds.add(contentId);
                         }
                     }
                 } else if (TAG_FILE_CONTENT.equals(parser.getName())) {
@@ -224,7 +229,13 @@
 
             state = parser.next();
         }
-        outFileNameToContentIdMap.putAll(fileNameToContentIdMap);
+        for (Map.Entry<String, Set<String>> entry : fileNameToContentIdMap.entrySet()) {
+            outFileNameToContentIdMap.merge(
+                    entry.getKey(), entry.getValue(), (s1, s2) -> {
+                        s1.addAll(s2);
+                        return s1;
+                    });
+        }
         outContentIdToFileContentMap.putAll(contentIdToFileContentMap);
     }
 
@@ -240,7 +251,7 @@
     }
 
     @VisibleForTesting
-    static void generateHtml(Map<String, String> fileNameToContentIdMap,
+    static void generateHtml(Map<String, Set<String>> fileNameToContentIdMap,
             Map<String, String> contentIdToFileContentMap, PrintWriter writer,
             String noticeHeader) {
         List<String> fileNameList = new ArrayList();
@@ -259,19 +270,20 @@
 
         // Prints all the file list with a link to its license file content.
         for (String fileName : fileNameList) {
-            String contentId = fileNameToContentIdMap.get(fileName);
-            // Assigns an id to a newly referred license file content.
-            if (!contentIdToOrderMap.containsKey(contentId)) {
-                contentIdToOrderMap.put(contentId, count);
+            for (String contentId : fileNameToContentIdMap.get(fileName)) {
+                // Assigns an id to a newly referred license file content.
+                if (!contentIdToOrderMap.containsKey(contentId)) {
+                    contentIdToOrderMap.put(contentId, count);
 
-                // An index in contentIdAndFileNamesList is the order of each element.
-                contentIdAndFileNamesList.add(new ContentIdAndFileNames(contentId));
-                count++;
+                    // An index in contentIdAndFileNamesList is the order of each element.
+                    contentIdAndFileNamesList.add(new ContentIdAndFileNames(contentId));
+                    count++;
+                }
+
+                int id = contentIdToOrderMap.get(contentId);
+                contentIdAndFileNamesList.get(id).mFileNameList.add(fileName);
+                writer.format("<li><a href=\"#id%d\">%s</a></li>\n", id, fileName);
             }
-
-            int id = contentIdToOrderMap.get(contentId);
-            contentIdAndFileNamesList.get(id).mFileNameList.add(fileName);
-            writer.format("<li><a href=\"#id%d\">%s</a></li>\n", id, fileName);
         }
 
         writer.println(HTML_MIDDLE_STRING);
diff --git a/packages/SettingsLib/tests/robotests/src/com/android/settingslib/license/LicenseHtmlGeneratorFromXmlTest.java b/packages/SettingsLib/tests/robotests/src/com/android/settingslib/license/LicenseHtmlGeneratorFromXmlTest.java
index 4b5e909..e87461f 100644
--- a/packages/SettingsLib/tests/robotests/src/com/android/settingslib/license/LicenseHtmlGeneratorFromXmlTest.java
+++ b/packages/SettingsLib/tests/robotests/src/com/android/settingslib/license/LicenseHtmlGeneratorFromXmlTest.java
@@ -28,8 +28,11 @@
 import java.io.InputStreamReader;
 import java.io.PrintWriter;
 import java.io.StringWriter;
+import java.util.Arrays;
 import java.util.HashMap;
+import java.util.HashSet;
 import java.util.Map;
+import java.util.Set;
 
 @RunWith(RobolectricTestRunner.class)
 public class LicenseHtmlGeneratorFromXmlTest {
@@ -68,6 +71,7 @@
 
     private static final String HTML_BODY_STRING =
             "<li><a href=\"#id0\">/file0</a></li>\n"
+            + "<li><a href=\"#id1\">/file0</a></li>\n"
             + "<li><a href=\"#id0\">/file1</a></li>\n"
             + "</ul>\n"
             + "</div><!-- table of contents -->\n"
@@ -82,6 +86,15 @@
             + "license content #0\n"
             + "</pre><!-- license-text -->\n"
             + "</td></tr><!-- same-license -->\n"
+            + "<tr id=\"id1\"><td class=\"same-license\">\n"
+            + "<div class=\"label\">Notices for file(s):</div>\n"
+            + "<div class=\"file-list\">\n"
+            + "/file0 <br/>\n"
+            + "</div><!-- file-list -->\n"
+            + "<pre class=\"license-text\">\n"
+            + "license content #1\n"
+            + "</pre><!-- license-text -->\n"
+            + "</td></tr><!-- same-license -->\n"
             + "</table></body></html>\n";
 
     private static final String EXPECTED_HTML_STRING = HTML_HEAD_STRING + HTML_BODY_STRING;
@@ -91,22 +104,22 @@
 
     @Test
     public void testParseValidXmlStream() throws XmlPullParserException, IOException {
-        Map<String, String> fileNameToContentIdMap = new HashMap<>();
+        Map<String, Set<String>> fileNameToContentIdMap = new HashMap<>();
         Map<String, String> contentIdToFileContentMap = new HashMap<>();
 
         LicenseHtmlGeneratorFromXml.parse(
                 new InputStreamReader(new ByteArrayInputStream(VALILD_XML_STRING.getBytes())),
                 fileNameToContentIdMap, contentIdToFileContentMap);
         assertThat(fileNameToContentIdMap.size()).isEqualTo(2);
-        assertThat(fileNameToContentIdMap.get("/file0")).isEqualTo("0");
-        assertThat(fileNameToContentIdMap.get("/file1")).isEqualTo("0");
+        assertThat(fileNameToContentIdMap.get("/file0")).containsExactly("0");
+        assertThat(fileNameToContentIdMap.get("/file1")).containsExactly("0");
         assertThat(contentIdToFileContentMap.size()).isEqualTo(1);
         assertThat(contentIdToFileContentMap.get("0")).isEqualTo("license content #0");
     }
 
     @Test(expected = XmlPullParserException.class)
     public void testParseInvalidXmlStream() throws XmlPullParserException, IOException {
-        Map<String, String> fileNameToContentIdMap = new HashMap<>();
+        Map<String, Set<String>> fileNameToContentIdMap = new HashMap<>();
         Map<String, String> contentIdToFileContentMap = new HashMap<>();
 
         LicenseHtmlGeneratorFromXml.parse(
@@ -116,12 +129,13 @@
 
     @Test
     public void testGenerateHtml() {
-        Map<String, String> fileNameToContentIdMap = new HashMap<>();
+        Map<String, Set<String>> fileNameToContentIdMap = new HashMap<>();
         Map<String, String> contentIdToFileContentMap = new HashMap<>();
 
-        fileNameToContentIdMap.put("/file0", "0");
-        fileNameToContentIdMap.put("/file1", "0");
+        fileNameToContentIdMap.put("/file0", new HashSet<String>(Arrays.asList("0", "1")));
+        fileNameToContentIdMap.put("/file1", new HashSet<String>(Arrays.asList("0")));
         contentIdToFileContentMap.put("0", "license content #0");
+        contentIdToFileContentMap.put("1", "license content #1");
 
         StringWriter output = new StringWriter();
         LicenseHtmlGeneratorFromXml.generateHtml(
@@ -131,12 +145,13 @@
 
     @Test
     public void testGenerateHtmlWithCustomHeading() {
-        Map<String, String> fileNameToContentIdMap = new HashMap<>();
+        Map<String, Set<String>> fileNameToContentIdMap = new HashMap<>();
         Map<String, String> contentIdToFileContentMap = new HashMap<>();
 
-        fileNameToContentIdMap.put("/file0", "0");
-        fileNameToContentIdMap.put("/file1", "0");
+        fileNameToContentIdMap.put("/file0", new HashSet<String>(Arrays.asList("0", "1")));
+        fileNameToContentIdMap.put("/file1", new HashSet<String>(Arrays.asList("0")));
         contentIdToFileContentMap.put("0", "license content #0");
+        contentIdToFileContentMap.put("1", "license content #1");
 
         StringWriter output = new StringWriter();
         LicenseHtmlGeneratorFromXml.generateHtml(
diff --git a/telephony/java/android/telephony/SubscriptionManager.java b/telephony/java/android/telephony/SubscriptionManager.java
index 96729de..ae034b5 100644
--- a/telephony/java/android/telephony/SubscriptionManager.java
+++ b/telephony/java/android/telephony/SubscriptionManager.java
@@ -16,8 +16,8 @@
 
 package android.telephony;
 
-import static android.net.NetworkPolicyManager.OVERRIDE_CONGESTED;
-import static android.net.NetworkPolicyManager.OVERRIDE_UNMETERED;
+import static android.net.NetworkPolicyManager.SUBSCRIPTION_OVERRIDE_CONGESTED;
+import static android.net.NetworkPolicyManager.SUBSCRIPTION_OVERRIDE_UNMETERED;
 
 import android.Manifest;
 import android.annotation.CallbackExecutor;
@@ -2524,9 +2524,9 @@
     public void setSubscriptionOverrideUnmetered(int subId, boolean overrideUnmetered,
             @DurationMillisLong long timeoutMillis) {
         try {
-            final int overrideValue = overrideUnmetered ? OVERRIDE_UNMETERED : 0;
-            getNetworkPolicy().setSubscriptionOverride(subId, OVERRIDE_UNMETERED, overrideValue,
-                    timeoutMillis, mContext.getOpPackageName());
+            final int overrideValue = overrideUnmetered ? SUBSCRIPTION_OVERRIDE_UNMETERED : 0;
+            getNetworkPolicy().setSubscriptionOverride(subId, SUBSCRIPTION_OVERRIDE_UNMETERED,
+                    overrideValue, timeoutMillis, mContext.getOpPackageName());
         } catch (RemoteException e) {
             throw e.rethrowFromSystemServer();
         }
@@ -2559,9 +2559,9 @@
     public void setSubscriptionOverrideCongested(int subId, boolean overrideCongested,
             @DurationMillisLong long timeoutMillis) {
         try {
-            final int overrideValue = overrideCongested ? OVERRIDE_CONGESTED : 0;
-            getNetworkPolicy().setSubscriptionOverride(subId, OVERRIDE_CONGESTED, overrideValue,
-                    timeoutMillis, mContext.getOpPackageName());
+            final int overrideValue = overrideCongested ? SUBSCRIPTION_OVERRIDE_CONGESTED : 0;
+            getNetworkPolicy().setSubscriptionOverride(subId, SUBSCRIPTION_OVERRIDE_CONGESTED,
+                    overrideValue, timeoutMillis, mContext.getOpPackageName());
         } catch (RemoteException e) {
             throw e.rethrowFromSystemServer();
         }