Merge "Unable to show correct device icon in Output Switcher" into rvc-dev am: fb87c72c66 am: 54091ba0f1 am: 864e606c40

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/12055443

Change-Id: I31b398422351f37dbc17557813f62b72d03a8bea
diff --git a/Android.bp b/Android.bp
index bf6c99d..23cd1a1 100644
--- a/Android.bp
+++ b/Android.bp
@@ -35,22 +35,96 @@
 }
 
 // These are subset of framework-core-sources that are needed by the
-// android.test.mock library. Ideally, the library should use public APIs only,
-// but unfortunately its API signature has some references to these private APIs.
+// android.test.mock library. The implementation of android.test.mock references
+// private members of various components to allow mocking of classes that cannot
+// be mocked without access to those internal implementation details.
 filegroup {
     name: "framework-core-sources-for-test-mock",
     srcs: [
+        "core/java/android/accounts/AccountManagerCallback.java",
+        "core/java/android/accounts/AccountManagerFuture.java",
+        "core/java/android/accounts/AccountManager.java",
+        "core/java/android/accounts/AccountsException.java",
+        "core/java/android/accounts/AuthenticatorException.java",
+        "core/java/android/accounts/OperationCanceledException.java",
+        "core/java/android/annotation/AnimatorRes.java",
+        "core/java/android/annotation/AnimRes.java",
+        "core/java/android/annotation/AnyRes.java",
+        "core/java/android/annotation/ArrayRes.java",
+        "core/java/android/annotation/AttrRes.java",
+        "core/java/android/annotation/BoolRes.java",
+        "core/java/android/annotation/BroadcastBehavior.java",
+        "core/java/android/annotation/CallbackExecutor.java",
+        "core/java/android/annotation/CallSuper.java",
+        "core/java/android/annotation/CheckResult.java",
+        "core/java/android/annotation/ColorInt.java",
+        "core/java/android/annotation/ColorRes.java",
+        "core/java/android/annotation/DimenRes.java",
+        "core/java/android/annotation/DrawableRes.java",
+        "core/java/android/annotation/FontRes.java",
+        "core/java/android/annotation/FractionRes.java",
+        "core/java/android/annotation/IntDef.java",
+        "core/java/android/annotation/IntegerRes.java",
+        "core/java/android/annotation/IntRange.java",
+        "core/java/android/annotation/LayoutRes.java",
+        "core/java/android/annotation/NonNull.java",
+        "core/java/android/annotation/Nullable.java",
+        "core/java/android/annotation/PluralsRes.java",
+        "core/java/android/annotation/RawRes.java",
+        "core/java/android/annotation/RequiresPermission.java",
+        "core/java/android/annotation/SdkConstant.java",
+        "core/java/android/annotation/Size.java",
+        "core/java/android/annotation/StringDef.java",
+        "core/java/android/annotation/StringRes.java",
+        "core/java/android/annotation/StyleableRes.java",
+        "core/java/android/annotation/StyleRes.java",
+        "core/java/android/annotation/SuppressLint.java",
+        "core/java/android/annotation/SystemApi.java",
+        "core/java/android/annotation/SystemService.java",
+        "core/java/android/annotation/TestApi.java",
+        "core/java/android/annotation/UserIdInt.java",
+        "core/java/android/annotation/XmlRes.java",
+        "core/java/android/app/Application.java",
         "core/java/android/app/IApplicationThread.aidl",
         "core/java/android/app/IServiceConnection.aidl",
+        "core/java/android/app/PackageDeleteObserver.java",
+        "core/java/android/content/ComponentCallbacks2.java",
+        "core/java/android/content/ComponentCallbacks.java",
+        "core/java/android/content/ContentInterface.java",
+        "core/java/android/content/ContentProvider.java",
+        "core/java/android/content/ContentProviderNative.java",
+        "core/java/android/content/ContentResolver.java",
+        "core/java/android/content/Context.java",
+        "core/java/android/content/ContextWrapper.java",
+        "core/java/android/content/DialogInterface.java",
         "core/java/android/content/IContentProvider.java",
-        "core/java/android/content/pm/IPackageDataObserver.aidl",
+        "core/java/android/content/Intent.java",
+        "core/java/android/content/IntentSender.java",
+        "core/java/android/content/OperationApplicationException.java",
+        "core/java/android/content/pm/ActivityInfo.java",
+        "core/java/android/content/pm/ApplicationInfo.java",
         "core/java/android/content/pm/InstantAppInfo.java",
+        "core/java/android/content/pm/IPackageDataObserver.aidl",
         "core/java/android/content/pm/KeySet.java",
         "core/java/android/content/pm/PackageManager.java",
         "core/java/android/content/pm/VerifierDeviceIdentity.java",
         "core/java/android/content/res/Resources.java",
+        "core/java/android/database/CrossProcessCursor.java",
+        "core/java/android/database/CrossProcessCursorWrapper.java",
+        "core/java/android/database/Cursor.java",
+        "core/java/android/database/CursorWrapper.java",
+        "core/java/android/os/Binder.java",
+        "core/java/android/os/Bundle.java",
+        "core/java/android/os/IBinder.java",
+        "core/java/android/os/IInterface.java",
+        "core/java/android/os/Parcelable.java",
+        "core/java/android/os/ParcelFileDescriptor.java",
+        "core/java/android/os/RemoteException.java",
         "core/java/android/os/storage/VolumeInfo.java",
+        "core/java/android/util/AndroidException.java",
         "core/java/android/view/DisplayAdjustments.java",
+        "core/java/android/view/ViewDebug.java",
+        "core/java/com/android/internal/annotations/VisibleForTesting.java",
     ],
     path: "core/java",
     visibility: ["//frameworks/base/test-mock"],
@@ -534,6 +608,7 @@
     static_libs: [
         "exoplayer2-extractor",
         "android.hardware.wifi-V1.0-java-constants",
+
         // Additional dependencies needed to build the ike API classes.
         "ike-internals",
     ],
@@ -1036,13 +1111,13 @@
     name: "base_default",
     version: {
         py2: {
-            enabled: true,
-            embedded_launcher: true,
-        },
-        py3: {
             enabled: false,
             embedded_launcher: false,
         },
+        py3: {
+            enabled: true,
+            embedded_launcher: true,
+        },
     },
 }
 
@@ -1215,6 +1290,7 @@
     "--hide MissingPermission --hide BroadcastBehavior " +
     "--hide HiddenSuperclass --hide DeprecationMismatch --hide UnavailableSymbol " +
     "--hide SdkConstant --hide HiddenTypeParameter --hide Todo --hide Typo " +
+    "--error NoSettingsProvider " +
     "--force-convert-to-warning-nullability-annotations +*:-android.*:+android.icu.*:-dalvik.* " +
     "--api-lint-ignore-prefix android.icu. " +
     "--api-lint-ignore-prefix java. " +
@@ -1264,4 +1340,4 @@
 filegroup {
     name: "framework-telephony-jarjar-rules",
     srcs: ["telephony/framework-telephony-jarjar-rules.txt"],
-}
+}
\ No newline at end of file
diff --git a/Android.mk b/Android.mk
index d3627e1..d853248 100644
--- a/Android.mk
+++ b/Android.mk
@@ -60,7 +60,7 @@
 $(SDK_METADATA): $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/framework-doc-stubs-metadata.zip
 	rm -rf $(SDK_METADATA_DIR)
 	mkdir -p $(SDK_METADATA_DIR)
-	unzip -qo $< -d $(SDK_METADATA_DIR)
+	unzip -DDqo $< -d $(SDK_METADATA_DIR)
 
 .PHONY: framework-doc-stubs
 framework-doc-stubs: $(SDK_METADATA)
diff --git a/ApiDocs.bp b/ApiDocs.bp
index a81342a..029699e 100644
--- a/ApiDocs.bp
+++ b/ApiDocs.bp
@@ -320,7 +320,7 @@
         ":framework-doc-stubs",
     ],
     args: "-noJdkLink -links https://kotlinlang.org/api/latest/jvm/stdlib/^external/dokka/package-list " +
-    "-noStdlibLink",
+        "-noStdlibLink",
     proofread_file: "ds-dokka-proofread.txt",
     dokka_enabled: true,
 }
@@ -340,7 +340,7 @@
         targets: ["docs"],
     },
     cmd: "$(location zip2zip) -i $(location :ds-docs-kt{.docs.zip}) -o $(genDir)/ds-docs-kt-moved.zip **/*:en/reference/kotlin && " +
-         "$(location merge_zips) $(out) $(location :ds-docs-java{.docs.zip}) $(genDir)/ds-docs-kt-moved.zip",
+        "$(location merge_zips) $(out) $(location :ds-docs-java{.docs.zip}) $(genDir)/ds-docs-kt-moved.zip",
 }
 
 java_genrule {
@@ -357,11 +357,11 @@
     dist: {
         targets: ["docs"],
     },
-    cmd: "unzip $(location :ds-docs-java{.docs.zip}) -d $(genDir) && " +
-         "unzip $(location :ds-docs-kt{.docs.zip}) -d $(genDir)/en/reference/kotlin && " +
-         "SWITCHER=$$(cd $$(dirname $(location switcher4)) && pwd)/$$(basename $(location switcher4)) && " +
-         "(cd $(genDir)/en/reference && $$SWITCHER --work platform) && " +
-         "$(location soong_zip) -o $(out) -C $(genDir) -D $(genDir)",
+    cmd: "unzip -q $(location :ds-docs-java{.docs.zip}) -d $(genDir) && " +
+        "unzip -q $(location :ds-docs-kt{.docs.zip}) -d $(genDir)/en/reference/kotlin && " +
+        "SWITCHER=$$(cd $$(dirname $(location switcher4)) && pwd)/$$(basename $(location switcher4)) && " +
+        "(cd $(genDir)/en/reference && $$SWITCHER --work platform) > /dev/null && " +
+        "$(location soong_zip) -o $(out) -C $(genDir) -D $(genDir)",
 }
 
 droiddoc {
@@ -373,7 +373,6 @@
     hdf: [
         "android.whichdoc online",
     ],
-    proofread_file: "ds-static-docs-proofrerad.txt",
     args: framework_docs_only_args +
         " -staticonly " +
         " -toroot / " +
@@ -390,7 +389,6 @@
     hdf: [
         "android.whichdoc online",
     ],
-    proofread_file: "ds-ref-navtree-docs-proofrerad.txt",
     args: framework_docs_only_args +
         " -toroot / " +
         " -atLinksNavtree " +
@@ -437,4 +435,3 @@
         " -referenceonly " +
         " -title \"Android SDK - Including hidden APIs.\"",
 }
-
diff --git a/METADATA b/METADATA
new file mode 100644
index 0000000..d97975c
--- /dev/null
+++ b/METADATA
@@ -0,0 +1,3 @@
+third_party {
+  license_type: NOTICE
+}
diff --git a/StubLibraries.bp b/StubLibraries.bp
index ef4e202..9f5b183 100644
--- a/StubLibraries.bp
+++ b/StubLibraries.bp
@@ -49,6 +49,7 @@
         ":opt-net-voip-srcs",
         ":art-module-public-api-stubs-source",
         ":android_icu4j_public_api_files",
+        "**/package.html",
     ],
     // TODO(b/147699819): remove below aidl includes.
     aidl: {
@@ -246,6 +247,10 @@
     defaults: ["metalava-full-api-stubs-default"],
     arg_files: ["core/res/AndroidManifest.xml"],
     args: metalava_framework_docs_args + module_libs,
+
+    // Do not generate stubs as they are not needed
+    generate_stubs: false,
+
     check_api: {
         current: {
             api_file: "api/module-lib-current.txt",
@@ -305,12 +310,15 @@
 java_defaults {
     name: "android_defaults_stubs_current",
     libs: [ "stub-annotations" ],
+    static_libs: [
+        // License notices from art module
+        "art-notices-for-framework-stubs-jar",
+    ],
     errorprone: {
         javacflags: [
             "-XepDisableAllChecks",
         ],
     },
-    java_resources: [":notices-for-framework-stubs"],
     sdk_version: "none",
     system_modules: "none",
     java_version: "1.8",
diff --git a/apct-tests/perftests/core/jni/Android.bp b/apct-tests/perftests/core/jni/Android.bp
index 4c0f2aa..d160d48 100644
--- a/apct-tests/perftests/core/jni/Android.bp
+++ b/apct-tests/perftests/core/jni/Android.bp
@@ -10,4 +10,5 @@
         "-Wunused",
         "-Wunreachable-code",
     ],
+    header_libs: ["jni_headers"],
 }
diff --git a/apex/Android.bp b/apex/Android.bp
index 992648b..c92d4d1 100644
--- a/apex/Android.bp
+++ b/apex/Android.bp
@@ -76,6 +76,10 @@
     // entry.
     shared_library: false,
 
+    // Prevent dependencies that do not specify an sdk_version from accessing the
+    // implementation library by default and force them to use stubs instead.
+    default_to_stubs: true,
+
     // Enable api lint. This will eventually become the default for java_sdk_library
     // but it cannot yet be turned on because some usages have not been cleaned up.
     // TODO(b/156126315) - Remove when no longer needed.
@@ -246,6 +250,10 @@
         "metalava-manual",
     ],
     filter_packages: framework_packages_to_document,
+
+    // Do not generate stubs as they are not needed
+    generate_stubs: false,
+
     check_api: {
         current: {
             api_file: "api/module-lib-current.txt",
diff --git a/apex/statsd/framework/Android.bp b/apex/statsd/framework/Android.bp
index d19faa97..b06f401 100644
--- a/apex/statsd/framework/Android.bp
+++ b/apex/statsd/framework/Android.bp
@@ -31,7 +31,8 @@
     ],
     visibility: [
         "//cts/hostsidetests/statsd/apps:__subpackages__",
-    ]
+        "//vendor:__subpackages__",
+    ],
 }
 
 filegroup {
diff --git a/api/current.txt b/api/current.txt
index 952ccda..54e4234 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -3712,7 +3712,7 @@
     ctor public ActionBar.LayoutParams(int);
     ctor public ActionBar.LayoutParams(android.app.ActionBar.LayoutParams);
     ctor public ActionBar.LayoutParams(android.view.ViewGroup.LayoutParams);
-    field @android.view.ViewDebug.ExportedProperty(category="layout", mapping={@android.view.ViewDebug.IntToString(from=0xffffffff, to="NONE"), @android.view.ViewDebug.IntToString(from=android.view.Gravity.NO_GRAVITY, to="NONE"), @android.view.ViewDebug.IntToString(from=android.view.Gravity.TOP, to="TOP"), @android.view.ViewDebug.IntToString(from=android.view.Gravity.BOTTOM, to="BOTTOM"), @android.view.ViewDebug.IntToString(from=android.view.Gravity.LEFT, to="LEFT"), @android.view.ViewDebug.IntToString(from=android.view.Gravity.RIGHT, to="RIGHT"), @android.view.ViewDebug.IntToString(from=android.view.Gravity.START, to="START"), @android.view.ViewDebug.IntToString(from=android.view.Gravity.END, to="END"), @android.view.ViewDebug.IntToString(from=android.view.Gravity.CENTER_VERTICAL, to="CENTER_VERTICAL"), @android.view.ViewDebug.IntToString(from=android.view.Gravity.FILL_VERTICAL, to="FILL_VERTICAL"), @android.view.ViewDebug.IntToString(from=android.view.Gravity.CENTER_HORIZONTAL, to="CENTER_HORIZONTAL"), @android.view.ViewDebug.IntToString(from=android.view.Gravity.FILL_HORIZONTAL, to="FILL_HORIZONTAL"), @android.view.ViewDebug.IntToString(from=android.view.Gravity.CENTER, to="CENTER"), @android.view.ViewDebug.IntToString(from=android.view.Gravity.FILL, to="FILL")}) public int gravity;
+    field public int gravity;
   }
 
   public static interface ActionBar.OnMenuVisibilityListener {
@@ -10092,7 +10092,7 @@
     method public final <T> T getSystemService(@NonNull Class<T>);
     method @Nullable public abstract String getSystemServiceName(@NonNull Class<?>);
     method @NonNull public final CharSequence getText(@StringRes int);
-    method @android.view.ViewDebug.ExportedProperty(deepExport=true) public abstract android.content.res.Resources.Theme getTheme();
+    method public abstract android.content.res.Resources.Theme getTheme();
     method @Deprecated public abstract android.graphics.drawable.Drawable getWallpaper();
     method @Deprecated public abstract int getWallpaperDesiredMinimumHeight();
     method @Deprecated public abstract int getWallpaperDesiredMinimumWidth();
@@ -11945,7 +11945,7 @@
   }
 
   public abstract class PackageManager {
-    ctor public PackageManager();
+    ctor @Deprecated public PackageManager();
     method @Deprecated public abstract void addPackageToPreferred(@NonNull String);
     method public abstract boolean addPermission(@NonNull android.content.pm.PermissionInfo);
     method public abstract boolean addPermissionAsync(@NonNull android.content.pm.PermissionInfo);
@@ -35809,6 +35809,7 @@
     field public static final String PRODUCT;
     field @Deprecated public static final String RADIO;
     field @Deprecated public static final String SERIAL;
+    field @NonNull public static final String SKU;
     field public static final String[] SUPPORTED_32_BIT_ABIS;
     field public static final String[] SUPPORTED_64_BIT_ABIS;
     field public static final String[] SUPPORTED_ABIS;
@@ -42744,6 +42745,7 @@
     method @NonNull public String[] getSignaturePaddings();
     method public int getUserAuthenticationType();
     method public int getUserAuthenticationValidityDurationSeconds();
+    method public boolean isDevicePropertiesAttestationIncluded();
     method @NonNull public boolean isDigestsSpecified();
     method public boolean isInvalidatedByBiometricEnrollment();
     method public boolean isRandomizedEncryptionRequired();
@@ -42765,6 +42767,7 @@
     method @NonNull public android.security.keystore.KeyGenParameterSpec.Builder setCertificateNotBefore(@NonNull java.util.Date);
     method @NonNull public android.security.keystore.KeyGenParameterSpec.Builder setCertificateSerialNumber(@NonNull java.math.BigInteger);
     method @NonNull public android.security.keystore.KeyGenParameterSpec.Builder setCertificateSubject(@NonNull javax.security.auth.x500.X500Principal);
+    method @NonNull public android.security.keystore.KeyGenParameterSpec.Builder setDevicePropertiesAttestationIncluded(boolean);
     method @NonNull public android.security.keystore.KeyGenParameterSpec.Builder setDigests(java.lang.String...);
     method @NonNull public android.security.keystore.KeyGenParameterSpec.Builder setEncryptionPaddings(java.lang.String...);
     method @NonNull public android.security.keystore.KeyGenParameterSpec.Builder setInvalidatedByBiometricEnrollment(boolean);
@@ -47448,6 +47451,88 @@
     field public static final int VSNCP_TIMEOUT = 2236; // 0x8bc
   }
 
+  public final class DisconnectCause {
+    field public static final int ALREADY_DIALING = 72; // 0x48
+    field public static final int ANSWERED_ELSEWHERE = 52; // 0x34
+    field public static final int BUSY = 4; // 0x4
+    field public static final int CALLING_DISABLED = 74; // 0x4a
+    field public static final int CALL_BARRED = 20; // 0x14
+    field public static final int CALL_PULLED = 51; // 0x33
+    field public static final int CANT_CALL_WHILE_RINGING = 73; // 0x49
+    field public static final int CDMA_ACCESS_BLOCKED = 35; // 0x23
+    field public static final int CDMA_ACCESS_FAILURE = 32; // 0x20
+    field public static final int CDMA_ALREADY_ACTIVATED = 49; // 0x31
+    field public static final int CDMA_DROP = 27; // 0x1b
+    field public static final int CDMA_INTERCEPT = 28; // 0x1c
+    field public static final int CDMA_LOCKED_UNTIL_POWER_CYCLE = 26; // 0x1a
+    field public static final int CDMA_NOT_EMERGENCY = 34; // 0x22
+    field public static final int CDMA_PREEMPTED = 33; // 0x21
+    field public static final int CDMA_REORDER = 29; // 0x1d
+    field public static final int CDMA_RETRY_ORDER = 31; // 0x1f
+    field public static final int CDMA_SO_REJECT = 30; // 0x1e
+    field public static final int CONGESTION = 5; // 0x5
+    field public static final int CS_RESTRICTED = 22; // 0x16
+    field public static final int CS_RESTRICTED_EMERGENCY = 24; // 0x18
+    field public static final int CS_RESTRICTED_NORMAL = 23; // 0x17
+    field public static final int DATA_DISABLED = 54; // 0x36
+    field public static final int DATA_LIMIT_REACHED = 55; // 0x37
+    field public static final int DIALED_CALL_FORWARDING_WHILE_ROAMING = 57; // 0x39
+    field public static final int DIALED_MMI = 39; // 0x27
+    field public static final int DIAL_LOW_BATTERY = 62; // 0x3e
+    field public static final int DIAL_MODIFIED_TO_DIAL = 48; // 0x30
+    field public static final int DIAL_MODIFIED_TO_DIAL_VIDEO = 66; // 0x42
+    field public static final int DIAL_MODIFIED_TO_SS = 47; // 0x2f
+    field public static final int DIAL_MODIFIED_TO_USSD = 46; // 0x2e
+    field public static final int DIAL_VIDEO_MODIFIED_TO_DIAL = 69; // 0x45
+    field public static final int DIAL_VIDEO_MODIFIED_TO_DIAL_VIDEO = 70; // 0x46
+    field public static final int DIAL_VIDEO_MODIFIED_TO_SS = 67; // 0x43
+    field public static final int DIAL_VIDEO_MODIFIED_TO_USSD = 68; // 0x44
+    field public static final int EMERGENCY_CALL_OVER_WFC_NOT_AVAILABLE = 78; // 0x4e
+    field public static final int EMERGENCY_PERM_FAILURE = 64; // 0x40
+    field public static final int EMERGENCY_TEMP_FAILURE = 63; // 0x3f
+    field public static final int ERROR_UNSPECIFIED = 36; // 0x24
+    field public static final int FDN_BLOCKED = 21; // 0x15
+    field public static final int ICC_ERROR = 19; // 0x13
+    field public static final int IMEI_NOT_ACCEPTED = 58; // 0x3a
+    field public static final int IMS_ACCESS_BLOCKED = 60; // 0x3c
+    field public static final int IMS_MERGED_SUCCESSFULLY = 45; // 0x2d
+    field public static final int IMS_SIP_ALTERNATE_EMERGENCY_CALL = 71; // 0x47
+    field public static final int INCOMING_AUTO_REJECTED = 81; // 0x51
+    field public static final int INCOMING_MISSED = 1; // 0x1
+    field public static final int INCOMING_REJECTED = 16; // 0x10
+    field public static final int INVALID_CREDENTIALS = 10; // 0xa
+    field public static final int INVALID_NUMBER = 7; // 0x7
+    field public static final int LIMIT_EXCEEDED = 15; // 0xf
+    field public static final int LOCAL = 3; // 0x3
+    field public static final int LOST_SIGNAL = 14; // 0xe
+    field public static final int LOW_BATTERY = 61; // 0x3d
+    field public static final int MAXIMUM_NUMBER_OF_CALLS_REACHED = 53; // 0x35
+    field public static final int MEDIA_TIMEOUT = 77; // 0x4d
+    field public static final int MMI = 6; // 0x6
+    field public static final int NORMAL = 2; // 0x2
+    field public static final int NORMAL_UNSPECIFIED = 65; // 0x41
+    field public static final int NOT_DISCONNECTED = 0; // 0x0
+    field public static final int NOT_VALID = -1; // 0xffffffff
+    field public static final int NO_PHONE_NUMBER_SUPPLIED = 38; // 0x26
+    field public static final int NUMBER_UNREACHABLE = 8; // 0x8
+    field public static final int OTASP_PROVISIONING_IN_PROCESS = 76; // 0x4c
+    field public static final int OUTGOING_CANCELED = 44; // 0x2c
+    field public static final int OUTGOING_EMERGENCY_CALL_PLACED = 80; // 0x50
+    field public static final int OUTGOING_FAILURE = 43; // 0x2b
+    field public static final int OUT_OF_NETWORK = 11; // 0xb
+    field public static final int OUT_OF_SERVICE = 18; // 0x12
+    field public static final int POWER_OFF = 17; // 0x11
+    field public static final int SERVER_ERROR = 12; // 0xc
+    field public static final int SERVER_UNREACHABLE = 9; // 0x9
+    field public static final int TIMED_OUT = 13; // 0xd
+    field public static final int TOO_MANY_ONGOING_CALLS = 75; // 0x4b
+    field public static final int UNOBTAINABLE_NUMBER = 25; // 0x19
+    field public static final int VIDEO_CALL_NOT_ALLOWED_WHILE_TTY_ENABLED = 50; // 0x32
+    field public static final int VOICEMAIL_NUMBER_MISSING = 40; // 0x28
+    field public static final int WFC_SERVICE_NOT_AVAILABLE_IN_THIS_LOCATION = 79; // 0x4f
+    field public static final int WIFI_LOST = 59; // 0x3b
+  }
+
   public class IccOpenLogicalChannelResponse implements android.os.Parcelable {
     method public int describeContents();
     method public int getChannel();
@@ -47464,12 +47549,14 @@
 
   public class MbmsDownloadSession implements java.lang.AutoCloseable {
     method public void addProgressListener(@NonNull android.telephony.mbms.DownloadRequest, @NonNull java.util.concurrent.Executor, @NonNull android.telephony.mbms.DownloadProgressListener);
+    method public void addServiceAnnouncement(@NonNull byte[]);
     method public void addStatusListener(@NonNull android.telephony.mbms.DownloadRequest, @NonNull java.util.concurrent.Executor, @NonNull android.telephony.mbms.DownloadStatusListener);
     method public void cancelDownload(@NonNull android.telephony.mbms.DownloadRequest);
     method public void close();
     method public static android.telephony.MbmsDownloadSession create(@NonNull android.content.Context, @NonNull java.util.concurrent.Executor, @NonNull android.telephony.mbms.MbmsDownloadSessionCallback);
     method @Nullable public static android.telephony.MbmsDownloadSession create(@NonNull android.content.Context, @NonNull java.util.concurrent.Executor, int, @NonNull android.telephony.mbms.MbmsDownloadSessionCallback);
     method public void download(@NonNull android.telephony.mbms.DownloadRequest);
+    method public static int getMaximumServiceAnnouncementSize();
     method @Nullable public java.io.File getTempFileRootDirectory();
     method @NonNull public java.util.List<android.telephony.mbms.DownloadRequest> listPendingDownloads();
     method public void removeProgressListener(@NonNull android.telephony.mbms.DownloadRequest, @NonNull android.telephony.mbms.DownloadProgressListener);
@@ -47917,6 +48004,7 @@
     method public static int[] calculateLength(String, boolean);
     method @Deprecated public static android.telephony.SmsMessage createFromPdu(byte[]);
     method public static android.telephony.SmsMessage createFromPdu(byte[], String);
+    method @Nullable public static android.telephony.SmsMessage createSmsSubmitPdu(@NonNull byte[], boolean);
     method public String getDisplayMessageBody();
     method public String getDisplayOriginatingAddress();
     method public String getEmailBody();
@@ -47999,7 +48087,7 @@
 
   public class SubscriptionManager {
     method public void addOnOpportunisticSubscriptionsChangedListener(@NonNull java.util.concurrent.Executor, @NonNull android.telephony.SubscriptionManager.OnOpportunisticSubscriptionsChangedListener);
-    method public void addOnSubscriptionsChangedListener(android.telephony.SubscriptionManager.OnSubscriptionsChangedListener);
+    method @Deprecated public void addOnSubscriptionsChangedListener(android.telephony.SubscriptionManager.OnSubscriptionsChangedListener);
     method public void addOnSubscriptionsChangedListener(@NonNull java.util.concurrent.Executor, @NonNull android.telephony.SubscriptionManager.OnSubscriptionsChangedListener);
     method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void addSubscriptionsIntoGroup(@NonNull java.util.List<java.lang.Integer>, @NonNull android.os.ParcelUuid);
     method public boolean canManageSubscription(android.telephony.SubscriptionInfo);
@@ -49080,6 +49168,7 @@
 
   public static class MbmsErrors.DownloadErrors {
     field public static final int ERROR_CANNOT_CHANGE_TEMP_FILE_ROOT = 401; // 0x191
+    field public static final int ERROR_MALFORMED_SERVICE_ANNOUNCEMENT = 404; // 0x194
     field public static final int ERROR_UNKNOWN_DOWNLOAD_REQUEST = 402; // 0x192
     field public static final int ERROR_UNKNOWN_FILE_INFO = 403; // 0x193
   }
@@ -53838,13 +53927,13 @@
     method @Nullable public CharSequence getAccessibilityPaneTitle();
     method @IdRes public int getAccessibilityTraversalAfter();
     method @IdRes public int getAccessibilityTraversalBefore();
-    method @android.view.ViewDebug.ExportedProperty(category="drawing") public float getAlpha();
+    method public float getAlpha();
     method public android.view.animation.Animation getAnimation();
     method @Nullable public android.graphics.Matrix getAnimationMatrix();
     method public android.os.IBinder getApplicationWindowToken();
     method @NonNull public int[] getAttributeResolutionStack(@AttrRes int);
     method @NonNull public java.util.Map<java.lang.Integer,java.lang.Integer> getAttributeSourceResourceMap();
-    method @android.view.ViewDebug.ExportedProperty @Nullable public String[] getAutofillHints();
+    method @Nullable public String[] getAutofillHints();
     method public final android.view.autofill.AutofillId getAutofillId();
     method public int getAutofillType();
     method @Nullable public android.view.autofill.AutofillValue getAutofillValue();
@@ -53852,8 +53941,8 @@
     method @Nullable public android.graphics.BlendMode getBackgroundTintBlendMode();
     method @Nullable public android.content.res.ColorStateList getBackgroundTintList();
     method @Nullable public android.graphics.PorterDuff.Mode getBackgroundTintMode();
-    method @android.view.ViewDebug.ExportedProperty(category="layout") public int getBaseline();
-    method @android.view.ViewDebug.CapturedViewProperty public final int getBottom();
+    method public int getBaseline();
+    method public final int getBottom();
     method protected float getBottomFadingEdgeStrength();
     method protected int getBottomPaddingOffset();
     method public float getCameraDistance();
@@ -53861,10 +53950,10 @@
     method public boolean getClipBounds(android.graphics.Rect);
     method public final boolean getClipToOutline();
     method @Nullable public final android.view.contentcapture.ContentCaptureSession getContentCaptureSession();
-    method @android.view.ViewDebug.ExportedProperty(category="accessibility") public CharSequence getContentDescription();
-    method @android.view.ViewDebug.CapturedViewProperty public final android.content.Context getContext();
+    method public CharSequence getContentDescription();
+    method public final android.content.Context getContext();
     method protected android.view.ContextMenu.ContextMenuInfo getContextMenuInfo();
-    method @android.view.ViewDebug.ExportedProperty(category="focus") public final boolean getDefaultFocusHighlightEnabled();
+    method public final boolean getDefaultFocusHighlightEnabled();
     method public static int getDefaultSize(int, int);
     method public android.view.Display getDisplay();
     method public final int[] getDrawableState();
@@ -53874,11 +53963,11 @@
     method @Deprecated public int getDrawingCacheQuality();
     method public void getDrawingRect(android.graphics.Rect);
     method public long getDrawingTime();
-    method @android.view.ViewDebug.ExportedProperty(category="drawing") public float getElevation();
+    method public float getElevation();
     method @StyleRes public int getExplicitStyle();
-    method @android.view.ViewDebug.ExportedProperty public boolean getFilterTouchesWhenObscured();
-    method @android.view.ViewDebug.ExportedProperty public boolean getFitsSystemWindows();
-    method @android.view.ViewDebug.ExportedProperty(mapping={@android.view.ViewDebug.IntToString(from=android.view.View.NOT_FOCUSABLE, to="NOT_FOCUSABLE"), @android.view.ViewDebug.IntToString(from=android.view.View.FOCUSABLE, to="FOCUSABLE"), @android.view.ViewDebug.IntToString(from=android.view.View.FOCUSABLE_AUTO, to="FOCUSABLE_AUTO")}, category="focus") public int getFocusable();
+    method public boolean getFilterTouchesWhenObscured();
+    method public boolean getFitsSystemWindows();
+    method public int getFocusable();
     method public java.util.ArrayList<android.view.View> getFocusables(int);
     method public void getFocusedRect(android.graphics.Rect);
     method public android.graphics.drawable.Drawable getForeground();
@@ -53890,23 +53979,23 @@
     method public final boolean getGlobalVisibleRect(android.graphics.Rect);
     method public android.os.Handler getHandler();
     method public final boolean getHasOverlappingRendering();
-    method @android.view.ViewDebug.ExportedProperty(category="layout") public final int getHeight();
+    method public final int getHeight();
     method public void getHitRect(android.graphics.Rect);
     method public int getHorizontalFadingEdgeLength();
     method protected int getHorizontalScrollbarHeight();
     method @Nullable public android.graphics.drawable.Drawable getHorizontalScrollbarThumbDrawable();
     method @Nullable public android.graphics.drawable.Drawable getHorizontalScrollbarTrackDrawable();
-    method @android.view.ViewDebug.CapturedViewProperty @IdRes public int getId();
-    method @android.view.ViewDebug.ExportedProperty(category="accessibility", mapping={@android.view.ViewDebug.IntToString(from=android.view.View.IMPORTANT_FOR_ACCESSIBILITY_AUTO, to="auto"), @android.view.ViewDebug.IntToString(from=android.view.View.IMPORTANT_FOR_ACCESSIBILITY_YES, to="yes"), @android.view.ViewDebug.IntToString(from=android.view.View.IMPORTANT_FOR_ACCESSIBILITY_NO, to="no"), @android.view.ViewDebug.IntToString(from=android.view.View.IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS, to="noHideDescendants")}) public int getImportantForAccessibility();
-    method @android.view.ViewDebug.ExportedProperty(mapping={@android.view.ViewDebug.IntToString(from=android.view.View.IMPORTANT_FOR_AUTOFILL_AUTO, to="auto"), @android.view.ViewDebug.IntToString(from=android.view.View.IMPORTANT_FOR_AUTOFILL_YES, to="yes"), @android.view.ViewDebug.IntToString(from=android.view.View.IMPORTANT_FOR_AUTOFILL_NO, to="no"), @android.view.ViewDebug.IntToString(from=android.view.View.IMPORTANT_FOR_AUTOFILL_YES_EXCLUDE_DESCENDANTS, to="yesExcludeDescendants"), @android.view.ViewDebug.IntToString(from=android.view.View.IMPORTANT_FOR_AUTOFILL_NO_EXCLUDE_DESCENDANTS, to="noExcludeDescendants")}) public int getImportantForAutofill();
-    method @android.view.ViewDebug.ExportedProperty(mapping={@android.view.ViewDebug.IntToString(from=android.view.View.IMPORTANT_FOR_CONTENT_CAPTURE_AUTO, to="auto"), @android.view.ViewDebug.IntToString(from=android.view.View.IMPORTANT_FOR_CONTENT_CAPTURE_YES, to="yes"), @android.view.ViewDebug.IntToString(from=android.view.View.IMPORTANT_FOR_CONTENT_CAPTURE_NO, to="no"), @android.view.ViewDebug.IntToString(from=android.view.View.IMPORTANT_FOR_CONTENT_CAPTURE_YES_EXCLUDE_DESCENDANTS, to="yesExcludeDescendants"), @android.view.ViewDebug.IntToString(from=android.view.View.IMPORTANT_FOR_CONTENT_CAPTURE_NO_EXCLUDE_DESCENDANTS, to="noExcludeDescendants")}) public int getImportantForContentCapture();
+    method @IdRes public int getId();
+    method public int getImportantForAccessibility();
+    method public int getImportantForAutofill();
+    method public int getImportantForContentCapture();
     method public boolean getKeepScreenOn();
     method public android.view.KeyEvent.DispatcherState getKeyDispatcherState();
-    method @android.view.ViewDebug.ExportedProperty(category="accessibility") @IdRes public int getLabelFor();
+    method @IdRes public int getLabelFor();
     method public int getLayerType();
-    method @android.view.ViewDebug.ExportedProperty(category="layout", mapping={@android.view.ViewDebug.IntToString(from=android.view.View.LAYOUT_DIRECTION_LTR, to="RESOLVED_DIRECTION_LTR"), @android.view.ViewDebug.IntToString(from=android.view.View.LAYOUT_DIRECTION_RTL, to="RESOLVED_DIRECTION_RTL")}) public int getLayoutDirection();
-    method @android.view.ViewDebug.ExportedProperty(deepExport=true, prefix="layout_") public android.view.ViewGroup.LayoutParams getLayoutParams();
-    method @android.view.ViewDebug.CapturedViewProperty public final int getLeft();
+    method public int getLayoutDirection();
+    method public android.view.ViewGroup.LayoutParams getLayoutParams();
+    method public final int getLeft();
     method protected float getLeftFadingEdgeStrength();
     method protected int getLeftPaddingOffset();
     method public final boolean getLocalVisibleRect(android.graphics.Rect);
@@ -53915,10 +54004,10 @@
     method public void getLocationOnScreen(@Size(2) int[]);
     method public android.graphics.Matrix getMatrix();
     method public final int getMeasuredHeight();
-    method @android.view.ViewDebug.ExportedProperty(category="measurement", flagMapping={@android.view.ViewDebug.FlagToString(mask=android.view.View.MEASURED_STATE_MASK, equals=android.view.View.MEASURED_STATE_TOO_SMALL, name="MEASURED_STATE_TOO_SMALL")}) public final int getMeasuredHeightAndState();
+    method public final int getMeasuredHeightAndState();
     method public final int getMeasuredState();
     method public final int getMeasuredWidth();
-    method @android.view.ViewDebug.ExportedProperty(category="measurement", flagMapping={@android.view.ViewDebug.FlagToString(mask=android.view.View.MEASURED_STATE_MASK, equals=android.view.View.MEASURED_STATE_TOO_SMALL, name="MEASURED_STATE_TOO_SMALL")}) public final int getMeasuredWidthAndState();
+    method public final int getMeasuredWidthAndState();
     method public int getMinimumHeight();
     method public int getMinimumWidth();
     method @IdRes public int getNextClusterForwardId();
@@ -53941,51 +54030,51 @@
     method public int getPaddingTop();
     method public final android.view.ViewParent getParent();
     method public android.view.ViewParent getParentForAccessibility();
-    method @android.view.ViewDebug.ExportedProperty(category="drawing") public float getPivotX();
-    method @android.view.ViewDebug.ExportedProperty(category="drawing") public float getPivotY();
+    method public float getPivotX();
+    method public float getPivotY();
     method public android.view.PointerIcon getPointerIcon();
     method public android.content.res.Resources getResources();
     method public final boolean getRevealOnFocusHint();
-    method @android.view.ViewDebug.CapturedViewProperty public final int getRight();
+    method public final int getRight();
     method protected float getRightFadingEdgeStrength();
     method protected int getRightPaddingOffset();
     method public android.view.View getRootView();
     method public android.view.WindowInsets getRootWindowInsets();
-    method @android.view.ViewDebug.ExportedProperty(category="drawing") public float getRotation();
-    method @android.view.ViewDebug.ExportedProperty(category="drawing") public float getRotationX();
-    method @android.view.ViewDebug.ExportedProperty(category="drawing") public float getRotationY();
-    method @android.view.ViewDebug.ExportedProperty(category="drawing") public float getScaleX();
-    method @android.view.ViewDebug.ExportedProperty(category="drawing") public float getScaleY();
+    method public float getRotation();
+    method public float getRotationX();
+    method public float getRotationY();
+    method public float getScaleX();
+    method public float getScaleY();
     method public int getScrollBarDefaultDelayBeforeFade();
     method public int getScrollBarFadeDuration();
     method public int getScrollBarSize();
-    method @android.view.ViewDebug.ExportedProperty(mapping={@android.view.ViewDebug.IntToString(from=android.view.View.SCROLLBARS_INSIDE_OVERLAY, to="INSIDE_OVERLAY"), @android.view.ViewDebug.IntToString(from=android.view.View.SCROLLBARS_INSIDE_INSET, to="INSIDE_INSET"), @android.view.ViewDebug.IntToString(from=android.view.View.SCROLLBARS_OUTSIDE_OVERLAY, to="OUTSIDE_OVERLAY"), @android.view.ViewDebug.IntToString(from=android.view.View.SCROLLBARS_OUTSIDE_INSET, to="OUTSIDE_INSET")}) public int getScrollBarStyle();
+    method public int getScrollBarStyle();
     method public int getScrollIndicators();
     method public final int getScrollX();
     method public final int getScrollY();
-    method @android.view.ViewDebug.ExportedProperty(category="drawing") @ColorInt public int getSolidColor();
+    method @ColorInt public int getSolidColor();
     method @LayoutRes public int getSourceLayoutResId();
-    method @android.view.ViewDebug.ExportedProperty(category="accessibility") @Nullable public final CharSequence getStateDescription();
+    method @Nullable public final CharSequence getStateDescription();
     method public android.animation.StateListAnimator getStateListAnimator();
     method protected int getSuggestedMinimumHeight();
     method protected int getSuggestedMinimumWidth();
     method @NonNull public java.util.List<android.graphics.Rect> getSystemGestureExclusionRects();
     method @Deprecated public int getSystemUiVisibility();
-    method @android.view.ViewDebug.ExportedProperty public Object getTag();
+    method public Object getTag();
     method public Object getTag(int);
-    method @android.view.ViewDebug.ExportedProperty(category="text", mapping={@android.view.ViewDebug.IntToString(from=android.view.View.TEXT_ALIGNMENT_INHERIT, to="INHERIT"), @android.view.ViewDebug.IntToString(from=android.view.View.TEXT_ALIGNMENT_GRAVITY, to="GRAVITY"), @android.view.ViewDebug.IntToString(from=android.view.View.TEXT_ALIGNMENT_TEXT_START, to="TEXT_START"), @android.view.ViewDebug.IntToString(from=android.view.View.TEXT_ALIGNMENT_TEXT_END, to="TEXT_END"), @android.view.ViewDebug.IntToString(from=android.view.View.TEXT_ALIGNMENT_CENTER, to="CENTER"), @android.view.ViewDebug.IntToString(from=android.view.View.TEXT_ALIGNMENT_VIEW_START, to="VIEW_START"), @android.view.ViewDebug.IntToString(from=android.view.View.TEXT_ALIGNMENT_VIEW_END, to="VIEW_END")}) public int getTextAlignment();
-    method @android.view.ViewDebug.ExportedProperty(category="text", mapping={@android.view.ViewDebug.IntToString(from=android.view.View.TEXT_DIRECTION_INHERIT, to="INHERIT"), @android.view.ViewDebug.IntToString(from=android.view.View.TEXT_DIRECTION_FIRST_STRONG, to="FIRST_STRONG"), @android.view.ViewDebug.IntToString(from=android.view.View.TEXT_DIRECTION_ANY_RTL, to="ANY_RTL"), @android.view.ViewDebug.IntToString(from=android.view.View.TEXT_DIRECTION_LTR, to="LTR"), @android.view.ViewDebug.IntToString(from=android.view.View.TEXT_DIRECTION_RTL, to="RTL"), @android.view.ViewDebug.IntToString(from=android.view.View.TEXT_DIRECTION_LOCALE, to="LOCALE"), @android.view.ViewDebug.IntToString(from=android.view.View.TEXT_DIRECTION_FIRST_STRONG_LTR, to="FIRST_STRONG_LTR"), @android.view.ViewDebug.IntToString(from=android.view.View.TEXT_DIRECTION_FIRST_STRONG_RTL, to="FIRST_STRONG_RTL")}) public int getTextDirection();
+    method public int getTextAlignment();
+    method public int getTextDirection();
     method @Nullable public CharSequence getTooltipText();
-    method @android.view.ViewDebug.CapturedViewProperty public final int getTop();
+    method public final int getTop();
     method protected float getTopFadingEdgeStrength();
     method protected int getTopPaddingOffset();
     method public android.view.TouchDelegate getTouchDelegate();
     method public java.util.ArrayList<android.view.View> getTouchables();
-    method @android.view.ViewDebug.ExportedProperty(category="drawing") public float getTransitionAlpha();
-    method @android.view.ViewDebug.ExportedProperty public String getTransitionName();
-    method @android.view.ViewDebug.ExportedProperty(category="drawing") public float getTranslationX();
-    method @android.view.ViewDebug.ExportedProperty(category="drawing") public float getTranslationY();
-    method @android.view.ViewDebug.ExportedProperty(category="drawing") public float getTranslationZ();
+    method public float getTransitionAlpha();
+    method public String getTransitionName();
+    method public float getTranslationX();
+    method public float getTranslationY();
+    method public float getTranslationZ();
     method public long getUniqueDrawingId();
     method public int getVerticalFadingEdgeLength();
     method public int getVerticalScrollbarPosition();
@@ -53993,8 +54082,8 @@
     method @Nullable public android.graphics.drawable.Drawable getVerticalScrollbarTrackDrawable();
     method public int getVerticalScrollbarWidth();
     method public android.view.ViewTreeObserver getViewTreeObserver();
-    method @android.view.ViewDebug.ExportedProperty(mapping={@android.view.ViewDebug.IntToString(from=android.view.View.VISIBLE, to="VISIBLE"), @android.view.ViewDebug.IntToString(from=android.view.View.INVISIBLE, to="INVISIBLE"), @android.view.ViewDebug.IntToString(from=android.view.View.GONE, to="GONE")}) public int getVisibility();
-    method @android.view.ViewDebug.ExportedProperty(category="layout") public final int getWidth();
+    method public int getVisibility();
+    method public final int getWidth();
     method protected int getWindowAttachCount();
     method public android.view.WindowId getWindowId();
     method @Nullable public android.view.WindowInsetsController getWindowInsetsController();
@@ -54002,18 +54091,18 @@
     method public android.os.IBinder getWindowToken();
     method public int getWindowVisibility();
     method public void getWindowVisibleDisplayFrame(android.graphics.Rect);
-    method @android.view.ViewDebug.ExportedProperty(category="drawing") public float getX();
-    method @android.view.ViewDebug.ExportedProperty(category="drawing") public float getY();
-    method @android.view.ViewDebug.ExportedProperty(category="drawing") public float getZ();
+    method public float getX();
+    method public float getY();
+    method public float getZ();
     method public boolean hasExplicitFocusable();
-    method @android.view.ViewDebug.ExportedProperty(category="focus") public boolean hasFocus();
+    method public boolean hasFocus();
     method public boolean hasFocusable();
     method public boolean hasNestedScrollingParent();
     method public boolean hasOnClickListeners();
     method public boolean hasOnLongClickListeners();
-    method @android.view.ViewDebug.ExportedProperty(category="drawing") public boolean hasOverlappingRendering();
+    method public boolean hasOverlappingRendering();
     method public boolean hasPointerCapture();
-    method @android.view.ViewDebug.ExportedProperty(category="layout") public boolean hasTransientState();
+    method public boolean hasTransientState();
     method public boolean hasWindowFocus();
     method public static android.view.View inflate(android.content.Context, @LayoutRes int, android.view.ViewGroup);
     method @Deprecated public void invalidate(android.graphics.Rect);
@@ -54023,50 +54112,50 @@
     method public void invalidateOutline();
     method public boolean isAccessibilityFocused();
     method public boolean isAccessibilityHeading();
-    method @android.view.ViewDebug.ExportedProperty public boolean isActivated();
+    method public boolean isActivated();
     method public boolean isAttachedToWindow();
-    method @android.view.ViewDebug.ExportedProperty public boolean isClickable();
+    method public boolean isClickable();
     method public boolean isContextClickable();
     method public boolean isDirty();
-    method @Deprecated @android.view.ViewDebug.ExportedProperty(category="drawing") public boolean isDrawingCacheEnabled();
+    method @Deprecated public boolean isDrawingCacheEnabled();
     method public boolean isDuplicateParentStateEnabled();
-    method @android.view.ViewDebug.ExportedProperty public boolean isEnabled();
-    method @android.view.ViewDebug.ExportedProperty(category="focus") public final boolean isFocusable();
-    method @android.view.ViewDebug.ExportedProperty(category="focus") public final boolean isFocusableInTouchMode();
-    method @android.view.ViewDebug.ExportedProperty(category="focus") public boolean isFocused();
-    method @android.view.ViewDebug.ExportedProperty(category="focus") public final boolean isFocusedByDefault();
-    method @android.view.ViewDebug.ExportedProperty(category="drawing") public boolean isForceDarkAllowed();
-    method @android.view.ViewDebug.ExportedProperty public boolean isHapticFeedbackEnabled();
-    method @android.view.ViewDebug.ExportedProperty(category="drawing") public boolean isHardwareAccelerated();
+    method public boolean isEnabled();
+    method public final boolean isFocusable();
+    method public final boolean isFocusableInTouchMode();
+    method public boolean isFocused();
+    method public final boolean isFocusedByDefault();
+    method public boolean isForceDarkAllowed();
+    method public boolean isHapticFeedbackEnabled();
+    method public boolean isHardwareAccelerated();
     method public boolean isHorizontalFadingEdgeEnabled();
     method public boolean isHorizontalScrollBarEnabled();
-    method @android.view.ViewDebug.ExportedProperty public boolean isHovered();
+    method public boolean isHovered();
     method public boolean isImportantForAccessibility();
     method public final boolean isImportantForAutofill();
     method public final boolean isImportantForContentCapture();
     method public boolean isInEditMode();
     method public boolean isInLayout();
-    method @android.view.ViewDebug.ExportedProperty public boolean isInTouchMode();
-    method @android.view.ViewDebug.ExportedProperty(category="focus") public final boolean isKeyboardNavigationCluster();
+    method public boolean isInTouchMode();
+    method public final boolean isKeyboardNavigationCluster();
     method public boolean isLaidOut();
     method public boolean isLayoutDirectionResolved();
     method public boolean isLayoutRequested();
     method public boolean isLongClickable();
     method public boolean isNestedScrollingEnabled();
-    method @android.view.ViewDebug.ExportedProperty(category="drawing") public boolean isOpaque();
+    method public boolean isOpaque();
     method protected boolean isPaddingOffsetRequired();
     method public boolean isPaddingRelative();
     method public boolean isPivotSet();
-    method @android.view.ViewDebug.ExportedProperty public boolean isPressed();
+    method public boolean isPressed();
     method public boolean isSaveEnabled();
     method public boolean isSaveFromParentEnabled();
     method public boolean isScreenReaderFocusable();
     method public boolean isScrollContainer();
     method public boolean isScrollbarFadingEnabled();
-    method @android.view.ViewDebug.ExportedProperty public boolean isSelected();
+    method public boolean isSelected();
     method public final boolean isShowingLayoutBounds();
     method public boolean isShown();
-    method @android.view.ViewDebug.ExportedProperty public boolean isSoundEffectsEnabled();
+    method public boolean isSoundEffectsEnabled();
     method public final boolean isTemporarilyDetached();
     method public boolean isTextAlignmentResolved();
     method public boolean isTextDirectionResolved();
@@ -54357,8 +54446,8 @@
     method public void unscheduleDrawable(android.graphics.drawable.Drawable);
     method public final void updateDragShadow(android.view.View.DragShadowBuilder);
     method @CallSuper protected boolean verifyDrawable(@NonNull android.graphics.drawable.Drawable);
-    method @Deprecated @android.view.ViewDebug.ExportedProperty(category="drawing") public boolean willNotCacheDrawing();
-    method @android.view.ViewDebug.ExportedProperty(category="drawing") public boolean willNotDraw();
+    method @Deprecated public boolean willNotCacheDrawing();
+    method public boolean willNotDraw();
     field public static final int ACCESSIBILITY_LIVE_REGION_ASSERTIVE = 2; // 0x2
     field public static final int ACCESSIBILITY_LIVE_REGION_NONE = 0; // 0x0
     field public static final int ACCESSIBILITY_LIVE_REGION_POLITE = 1; // 0x1
@@ -54799,9 +54888,9 @@
     method public static int getChildMeasureSpec(int, int, int);
     method protected boolean getChildStaticTransformation(android.view.View, android.view.animation.Transformation);
     method public boolean getChildVisibleRect(android.view.View, android.graphics.Rect, android.graphics.Point);
-    method @android.view.ViewDebug.ExportedProperty(category="drawing") public boolean getClipChildren();
-    method @android.view.ViewDebug.ExportedProperty(category="drawing") public boolean getClipToPadding();
-    method @android.view.ViewDebug.ExportedProperty(category="focus", mapping={@android.view.ViewDebug.IntToString(from=android.view.ViewGroup.FOCUS_BEFORE_DESCENDANTS, to="FOCUS_BEFORE_DESCENDANTS"), @android.view.ViewDebug.IntToString(from=android.view.ViewGroup.FOCUS_AFTER_DESCENDANTS, to="FOCUS_AFTER_DESCENDANTS"), @android.view.ViewDebug.IntToString(from=android.view.ViewGroup.FOCUS_BLOCK_DESCENDANTS, to="FOCUS_BLOCK_DESCENDANTS")}) public int getDescendantFocusability();
+    method public boolean getClipChildren();
+    method public boolean getClipToPadding();
+    method public int getDescendantFocusability();
     method public android.view.View getFocusedChild();
     method public android.view.animation.LayoutAnimationController getLayoutAnimation();
     method public android.view.animation.Animation.AnimationListener getLayoutAnimationListener();
@@ -54809,14 +54898,14 @@
     method public android.animation.LayoutTransition getLayoutTransition();
     method public int getNestedScrollAxes();
     method public android.view.ViewGroupOverlay getOverlay();
-    method @Deprecated @android.view.ViewDebug.ExportedProperty(category="drawing", mapping={@android.view.ViewDebug.IntToString(from=android.view.ViewGroup.PERSISTENT_NO_CACHE, to="NONE"), @android.view.ViewDebug.IntToString(from=android.view.ViewGroup.PERSISTENT_ANIMATION_CACHE, to="ANIMATION"), @android.view.ViewDebug.IntToString(from=android.view.ViewGroup.PERSISTENT_SCROLLING_CACHE, to="SCROLLING"), @android.view.ViewDebug.IntToString(from=android.view.ViewGroup.PERSISTENT_ALL_CACHES, to="ALL")}) public int getPersistentDrawingCache();
-    method @android.view.ViewDebug.ExportedProperty(category="focus") public boolean getTouchscreenBlocksFocus();
+    method @Deprecated public int getPersistentDrawingCache();
+    method public boolean getTouchscreenBlocksFocus();
     method public int indexOfChild(android.view.View);
     method @Deprecated public final void invalidateChild(android.view.View, android.graphics.Rect);
     method @Deprecated public android.view.ViewParent invalidateChildInParent(int[], android.graphics.Rect);
     method @Deprecated public boolean isAlwaysDrawnWithCacheEnabled();
     method @Deprecated public boolean isAnimationCacheEnabled();
-    method @android.view.ViewDebug.ExportedProperty(category="drawing") protected boolean isChildrenDrawingOrderEnabled();
+    method protected boolean isChildrenDrawingOrderEnabled();
     method @Deprecated protected boolean isChildrenDrawnWithCacheEnabled();
     method public boolean isLayoutSuppressed();
     method public boolean isMotionEventSplittingEnabled();
@@ -54907,9 +54996,9 @@
     field @Deprecated public static final int FILL_PARENT = -1; // 0xffffffff
     field public static final int MATCH_PARENT = -1; // 0xffffffff
     field public static final int WRAP_CONTENT = -2; // 0xfffffffe
-    field @android.view.ViewDebug.ExportedProperty(category="layout", mapping={@android.view.ViewDebug.IntToString(from=android.view.ViewGroup.LayoutParams.MATCH_PARENT, to="MATCH_PARENT"), @android.view.ViewDebug.IntToString(from=android.view.ViewGroup.LayoutParams.WRAP_CONTENT, to="WRAP_CONTENT")}) public int height;
+    field public int height;
     field public android.view.animation.LayoutAnimationController.AnimationParameters layoutAnimationParameters;
-    field @android.view.ViewDebug.ExportedProperty(category="layout", mapping={@android.view.ViewDebug.IntToString(from=android.view.ViewGroup.LayoutParams.MATCH_PARENT, to="MATCH_PARENT"), @android.view.ViewDebug.IntToString(from=android.view.ViewGroup.LayoutParams.WRAP_CONTENT, to="WRAP_CONTENT")}) public int width;
+    field public int width;
   }
 
   public static class ViewGroup.MarginLayoutParams extends android.view.ViewGroup.LayoutParams {
@@ -54925,10 +55014,10 @@
     method public void setMarginEnd(int);
     method public void setMarginStart(int);
     method public void setMargins(int, int, int, int);
-    field @android.view.ViewDebug.ExportedProperty(category="layout") public int bottomMargin;
-    field @android.view.ViewDebug.ExportedProperty(category="layout") public int leftMargin;
-    field @android.view.ViewDebug.ExportedProperty(category="layout") public int rightMargin;
-    field @android.view.ViewDebug.ExportedProperty(category="layout") public int topMargin;
+    field public int bottomMargin;
+    field public int leftMargin;
+    field public int rightMargin;
+    field public int topMargin;
   }
 
   public static interface ViewGroup.OnHierarchyChangeListener {
@@ -55725,11 +55814,11 @@
     field public float alpha;
     field public float buttonBrightness;
     field public float dimAmount;
-    field @android.view.ViewDebug.ExportedProperty(flagMapping={@android.view.ViewDebug.FlagToString(mask=android.view.WindowManager.LayoutParams.FLAG_ALLOW_LOCK_WHILE_SCREEN_ON, equals=android.view.WindowManager.LayoutParams.FLAG_ALLOW_LOCK_WHILE_SCREEN_ON, name="ALLOW_LOCK_WHILE_SCREEN_ON"), @android.view.ViewDebug.FlagToString(mask=android.view.WindowManager.LayoutParams.FLAG_DIM_BEHIND, equals=android.view.WindowManager.LayoutParams.FLAG_DIM_BEHIND, name="DIM_BEHIND"), @android.view.ViewDebug.FlagToString(mask=android.view.WindowManager.LayoutParams.FLAG_BLUR_BEHIND, equals=android.view.WindowManager.LayoutParams.FLAG_BLUR_BEHIND, name="BLUR_BEHIND"), @android.view.ViewDebug.FlagToString(mask=android.view.WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE, equals=android.view.WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE, name="NOT_FOCUSABLE"), @android.view.ViewDebug.FlagToString(mask=android.view.WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE, equals=android.view.WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE, name="NOT_TOUCHABLE"), @android.view.ViewDebug.FlagToString(mask=android.view.WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL, equals=android.view.WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL, name="NOT_TOUCH_MODAL"), @android.view.ViewDebug.FlagToString(mask=android.view.WindowManager.LayoutParams.FLAG_TOUCHABLE_WHEN_WAKING, equals=android.view.WindowManager.LayoutParams.FLAG_TOUCHABLE_WHEN_WAKING, name="TOUCHABLE_WHEN_WAKING"), @android.view.ViewDebug.FlagToString(mask=android.view.WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON, equals=android.view.WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON, name="KEEP_SCREEN_ON"), @android.view.ViewDebug.FlagToString(mask=android.view.WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN, equals=android.view.WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN, name="LAYOUT_IN_SCREEN"), @android.view.ViewDebug.FlagToString(mask=android.view.WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, equals=android.view.WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, name="LAYOUT_NO_LIMITS"), @android.view.ViewDebug.FlagToString(mask=android.view.WindowManager.LayoutParams.FLAG_FULLSCREEN, equals=android.view.WindowManager.LayoutParams.FLAG_FULLSCREEN, name="FULLSCREEN"), @android.view.ViewDebug.FlagToString(mask=android.view.WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN, equals=android.view.WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN, name="FORCE_NOT_FULLSCREEN"), @android.view.ViewDebug.FlagToString(mask=android.view.WindowManager.LayoutParams.FLAG_DITHER, equals=android.view.WindowManager.LayoutParams.FLAG_DITHER, name="DITHER"), @android.view.ViewDebug.FlagToString(mask=android.view.WindowManager.LayoutParams.FLAG_SECURE, equals=android.view.WindowManager.LayoutParams.FLAG_SECURE, name="SECURE"), @android.view.ViewDebug.FlagToString(mask=android.view.WindowManager.LayoutParams.FLAG_SCALED, equals=android.view.WindowManager.LayoutParams.FLAG_SCALED, name="SCALED"), @android.view.ViewDebug.FlagToString(mask=android.view.WindowManager.LayoutParams.FLAG_IGNORE_CHEEK_PRESSES, equals=android.view.WindowManager.LayoutParams.FLAG_IGNORE_CHEEK_PRESSES, name="IGNORE_CHEEK_PRESSES"), @android.view.ViewDebug.FlagToString(mask=android.view.WindowManager.LayoutParams.FLAG_LAYOUT_INSET_DECOR, equals=android.view.WindowManager.LayoutParams.FLAG_LAYOUT_INSET_DECOR, name="LAYOUT_INSET_DECOR"), @android.view.ViewDebug.FlagToString(mask=android.view.WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM, equals=android.view.WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM, name="ALT_FOCUSABLE_IM"), @android.view.ViewDebug.FlagToString(mask=android.view.WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH, equals=android.view.WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH, name="WATCH_OUTSIDE_TOUCH"), @android.view.ViewDebug.FlagToString(mask=android.view.WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED, equals=android.view.WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED, name="SHOW_WHEN_LOCKED"), @android.view.ViewDebug.FlagToString(mask=android.view.WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER, equals=android.view.WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER, name="SHOW_WALLPAPER"), @android.view.ViewDebug.FlagToString(mask=android.view.WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON, equals=android.view.WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON, name="TURN_SCREEN_ON"), @android.view.ViewDebug.FlagToString(mask=android.view.WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD, equals=android.view.WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD, name="DISMISS_KEYGUARD"), @android.view.ViewDebug.FlagToString(mask=android.view.WindowManager.LayoutParams.FLAG_SPLIT_TOUCH, equals=android.view.WindowManager.LayoutParams.FLAG_SPLIT_TOUCH, name="SPLIT_TOUCH"), @android.view.ViewDebug.FlagToString(mask=android.view.WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED, equals=android.view.WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED, name="HARDWARE_ACCELERATED"), @android.view.ViewDebug.FlagToString(mask=android.view.WindowManager.LayoutParams.FLAG_LAYOUT_IN_OVERSCAN, equals=android.view.WindowManager.LayoutParams.FLAG_LAYOUT_IN_OVERSCAN, name="LOCAL_FOCUS_MODE"), @android.view.ViewDebug.FlagToString(mask=android.view.WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS, equals=android.view.WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS, name="TRANSLUCENT_STATUS"), @android.view.ViewDebug.FlagToString(mask=android.view.WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION, equals=android.view.WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION, name="TRANSLUCENT_NAVIGATION"), @android.view.ViewDebug.FlagToString(mask=android.view.WindowManager.LayoutParams.FLAG_LOCAL_FOCUS_MODE, equals=android.view.WindowManager.LayoutParams.FLAG_LOCAL_FOCUS_MODE, name="LOCAL_FOCUS_MODE"), @android.view.ViewDebug.FlagToString(mask=0x20000000, equals=0x20000000, name="FLAG_SLIPPERY"), @android.view.ViewDebug.FlagToString(mask=android.view.WindowManager.LayoutParams.FLAG_LAYOUT_ATTACHED_IN_DECOR, equals=android.view.WindowManager.LayoutParams.FLAG_LAYOUT_ATTACHED_IN_DECOR, name="FLAG_LAYOUT_ATTACHED_IN_DECOR"), @android.view.ViewDebug.FlagToString(mask=android.view.WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS, equals=android.view.WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS, name="DRAWS_SYSTEM_BAR_BACKGROUNDS")}, formatToHexString=true) public int flags;
+    field public int flags;
     field public int format;
     field public int gravity;
     field public float horizontalMargin;
-    field @android.view.ViewDebug.ExportedProperty public float horizontalWeight;
+    field public float horizontalWeight;
     field public int layoutInDisplayCutoutMode;
     field @Deprecated public int memoryType;
     field public String packageName;
@@ -55742,12 +55831,12 @@
     field public int softInputMode;
     field @Deprecated public int systemUiVisibility;
     field public android.os.IBinder token;
-    field @android.view.ViewDebug.ExportedProperty(mapping={@android.view.ViewDebug.IntToString(from=android.view.WindowManager.LayoutParams.TYPE_BASE_APPLICATION, to="BASE_APPLICATION"), @android.view.ViewDebug.IntToString(from=android.view.WindowManager.LayoutParams.TYPE_APPLICATION, to="APPLICATION"), @android.view.ViewDebug.IntToString(from=android.view.WindowManager.LayoutParams.TYPE_APPLICATION_STARTING, to="APPLICATION_STARTING"), @android.view.ViewDebug.IntToString(from=android.view.WindowManager.LayoutParams.TYPE_DRAWN_APPLICATION, to="DRAWN_APPLICATION"), @android.view.ViewDebug.IntToString(from=android.view.WindowManager.LayoutParams.TYPE_APPLICATION_PANEL, to="APPLICATION_PANEL"), @android.view.ViewDebug.IntToString(from=android.view.WindowManager.LayoutParams.TYPE_APPLICATION_MEDIA, to="APPLICATION_MEDIA"), @android.view.ViewDebug.IntToString(from=android.view.WindowManager.LayoutParams.TYPE_APPLICATION_SUB_PANEL, to="APPLICATION_SUB_PANEL"), @android.view.ViewDebug.IntToString(from=0x3ed, to="APPLICATION_ABOVE_SUB_PANEL"), @android.view.ViewDebug.IntToString(from=android.view.WindowManager.LayoutParams.TYPE_APPLICATION_ATTACHED_DIALOG, to="APPLICATION_ATTACHED_DIALOG"), @android.view.ViewDebug.IntToString(from=0x3ec, to="APPLICATION_MEDIA_OVERLAY"), @android.view.ViewDebug.IntToString(from=android.view.WindowManager.LayoutParams.TYPE_STATUS_BAR, to="STATUS_BAR"), @android.view.ViewDebug.IntToString(from=android.view.WindowManager.LayoutParams.TYPE_SEARCH_BAR, to="SEARCH_BAR"), @android.view.ViewDebug.IntToString(from=android.view.WindowManager.LayoutParams.TYPE_PHONE, to="PHONE"), @android.view.ViewDebug.IntToString(from=android.view.WindowManager.LayoutParams.TYPE_SYSTEM_ALERT, to="SYSTEM_ALERT"), @android.view.ViewDebug.IntToString(from=android.view.WindowManager.LayoutParams.TYPE_TOAST, to="TOAST"), @android.view.ViewDebug.IntToString(from=android.view.WindowManager.LayoutParams.TYPE_SYSTEM_OVERLAY, to="SYSTEM_OVERLAY"), @android.view.ViewDebug.IntToString(from=android.view.WindowManager.LayoutParams.TYPE_PRIORITY_PHONE, to="PRIORITY_PHONE"), @android.view.ViewDebug.IntToString(from=android.view.WindowManager.LayoutParams.TYPE_SYSTEM_DIALOG, to="SYSTEM_DIALOG"), @android.view.ViewDebug.IntToString(from=android.view.WindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG, to="KEYGUARD_DIALOG"), @android.view.ViewDebug.IntToString(from=android.view.WindowManager.LayoutParams.TYPE_SYSTEM_ERROR, to="SYSTEM_ERROR"), @android.view.ViewDebug.IntToString(from=android.view.WindowManager.LayoutParams.TYPE_INPUT_METHOD, to="INPUT_METHOD"), @android.view.ViewDebug.IntToString(from=android.view.WindowManager.LayoutParams.TYPE_INPUT_METHOD_DIALOG, to="INPUT_METHOD_DIALOG"), @android.view.ViewDebug.IntToString(from=android.view.WindowManager.LayoutParams.TYPE_WALLPAPER, to="WALLPAPER"), @android.view.ViewDebug.IntToString(from=android.view.WindowManager.LayoutParams.TYPE_STATUS_BAR_PANEL, to="STATUS_BAR_PANEL"), @android.view.ViewDebug.IntToString(from=0x7df, to="SECURE_SYSTEM_OVERLAY"), @android.view.ViewDebug.IntToString(from=0x7e0, to="DRAG"), @android.view.ViewDebug.IntToString(from=0x7e1, to="STATUS_BAR_SUB_PANEL"), @android.view.ViewDebug.IntToString(from=0x7e2, to="POINTER"), @android.view.ViewDebug.IntToString(from=0x7e3, to="NAVIGATION_BAR"), @android.view.ViewDebug.IntToString(from=0x7e4, to="VOLUME_OVERLAY"), @android.view.ViewDebug.IntToString(from=0x7e5, to="BOOT_PROGRESS"), @android.view.ViewDebug.IntToString(from=0x7e6, to="INPUT_CONSUMER"), @android.view.ViewDebug.IntToString(from=0x7e8, to="NAVIGATION_BAR_PANEL"), @android.view.ViewDebug.IntToString(from=0x7ea, to="DISPLAY_OVERLAY"), @android.view.ViewDebug.IntToString(from=0x7eb, to="MAGNIFICATION_OVERLAY"), @android.view.ViewDebug.IntToString(from=0x7f5, to="PRESENTATION"), @android.view.ViewDebug.IntToString(from=android.view.WindowManager.LayoutParams.TYPE_PRIVATE_PRESENTATION, to="PRIVATE_PRESENTATION"), @android.view.ViewDebug.IntToString(from=0x7ef, to="VOICE_INTERACTION"), @android.view.ViewDebug.IntToString(from=0x7f1, to="VOICE_INTERACTION_STARTING"), @android.view.ViewDebug.IntToString(from=0x7f2, to="DOCK_DIVIDER"), @android.view.ViewDebug.IntToString(from=0x7f3, to="QS_DIALOG"), @android.view.ViewDebug.IntToString(from=0x7f4, to="SCREENSHOT"), @android.view.ViewDebug.IntToString(from=android.view.WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY, to="APPLICATION_OVERLAY")}) public int type;
+    field public int type;
     field public float verticalMargin;
-    field @android.view.ViewDebug.ExportedProperty public float verticalWeight;
+    field public float verticalWeight;
     field public int windowAnimations;
-    field @android.view.ViewDebug.ExportedProperty public int x;
-    field @android.view.ViewDebug.ExportedProperty public int y;
+    field public int x;
+    field public int y;
   }
 
   public final class WindowMetrics {
@@ -58484,21 +58573,21 @@
     method public void flingScroll(int, int);
     method @Deprecated public void freeMemory();
     method @Nullable public android.net.http.SslCertificate getCertificate();
-    method @android.view.ViewDebug.ExportedProperty(category="webview") public int getContentHeight();
+    method public int getContentHeight();
     method @Nullable public static android.content.pm.PackageInfo getCurrentWebViewPackage();
     method @Nullable public android.graphics.Bitmap getFavicon();
     method @NonNull public android.webkit.WebView.HitTestResult getHitTestResult();
     method @Deprecated @Nullable public String[] getHttpAuthUsernamePassword(String, String);
-    method @android.view.ViewDebug.ExportedProperty(category="webview") @Nullable public String getOriginalUrl();
+    method @Nullable public String getOriginalUrl();
     method public int getProgress();
     method public boolean getRendererPriorityWaivedWhenNotVisible();
     method public int getRendererRequestedPriority();
     method @NonNull public static android.net.Uri getSafeBrowsingPrivacyPolicyUrl();
-    method @Deprecated @android.view.ViewDebug.ExportedProperty(category="webview") public float getScale();
+    method @Deprecated public float getScale();
     method @NonNull public android.webkit.WebSettings getSettings();
     method @NonNull public android.view.textclassifier.TextClassifier getTextClassifier();
-    method @android.view.ViewDebug.ExportedProperty(category="webview") @Nullable public String getTitle();
-    method @android.view.ViewDebug.ExportedProperty(category="webview") @Nullable public String getUrl();
+    method @Nullable public String getTitle();
+    method @Nullable public String getUrl();
     method @Nullable public android.webkit.WebChromeClient getWebChromeClient();
     method @NonNull public static ClassLoader getWebViewClassLoader();
     method @NonNull public android.webkit.WebViewClient getWebViewClient();
@@ -58700,7 +58789,7 @@
     method public void fling(int);
     method public android.widget.AbsListView.LayoutParams generateLayoutParams(android.util.AttributeSet);
     method @ColorInt public int getBottomEdgeEffectColor();
-    method @android.view.ViewDebug.ExportedProperty(category="drawing") @ColorInt public int getCacheColorHint();
+    method @ColorInt public int getCacheColorHint();
     method public int getCheckedItemCount();
     method public long[] getCheckedItemIds();
     method public int getCheckedItemPosition();
@@ -58710,7 +58799,7 @@
     method public int getListPaddingLeft();
     method public int getListPaddingRight();
     method public int getListPaddingTop();
-    method @android.view.ViewDebug.ExportedProperty public android.view.View getSelectedView();
+    method public android.view.View getSelectedView();
     method public android.graphics.drawable.Drawable getSelector();
     method public CharSequence getTextFilter();
     method @ColorInt public int getTopEdgeEffectColor();
@@ -58720,13 +58809,13 @@
     method public void invalidateViews();
     method public boolean isDrawSelectorOnTop();
     method public boolean isFastScrollAlwaysVisible();
-    method @android.view.ViewDebug.ExportedProperty public boolean isFastScrollEnabled();
+    method public boolean isFastScrollEnabled();
     method protected boolean isInFilterMode();
     method public boolean isItemChecked(int);
-    method @android.view.ViewDebug.ExportedProperty public boolean isScrollingCacheEnabled();
-    method @android.view.ViewDebug.ExportedProperty public boolean isSmoothScrollbarEnabled();
-    method @android.view.ViewDebug.ExportedProperty public boolean isStackFromBottom();
-    method @android.view.ViewDebug.ExportedProperty public boolean isTextFilterEnabled();
+    method public boolean isScrollingCacheEnabled();
+    method public boolean isSmoothScrollbarEnabled();
+    method public boolean isStackFromBottom();
+    method public boolean isTextFilterEnabled();
     method protected void layoutChildren();
     method public void onFilterComplete(int);
     method public void onGlobalLayout();
@@ -58923,7 +59012,7 @@
     ctor public AdapterView(android.content.Context, android.util.AttributeSet, int);
     ctor public AdapterView(android.content.Context, android.util.AttributeSet, int, int);
     method public abstract T getAdapter();
-    method @android.view.ViewDebug.CapturedViewProperty public int getCount();
+    method public int getCount();
     method public android.view.View getEmptyView();
     method public int getFirstVisiblePosition();
     method public Object getItemAtPosition(int);
@@ -58934,8 +59023,8 @@
     method @Nullable public final android.widget.AdapterView.OnItemSelectedListener getOnItemSelectedListener();
     method public int getPositionForView(android.view.View);
     method public Object getSelectedItem();
-    method @android.view.ViewDebug.CapturedViewProperty public long getSelectedItemId();
-    method @android.view.ViewDebug.CapturedViewProperty public int getSelectedItemPosition();
+    method public long getSelectedItemId();
+    method public int getSelectedItemPosition();
     method public abstract android.view.View getSelectedView();
     method public boolean performItemClick(android.view.View, int, long);
     method public abstract void setAdapter(T);
@@ -59236,7 +59325,7 @@
     method @Nullable public android.graphics.BlendMode getCheckMarkTintBlendMode();
     method @Nullable public android.content.res.ColorStateList getCheckMarkTintList();
     method @Nullable public android.graphics.PorterDuff.Mode getCheckMarkTintMode();
-    method @android.view.ViewDebug.ExportedProperty public boolean isChecked();
+    method public boolean isChecked();
     method public void setCheckMarkDrawable(@DrawableRes int);
     method public void setCheckMarkDrawable(@Nullable android.graphics.drawable.Drawable);
     method public void setCheckMarkTintBlendMode(@Nullable android.graphics.BlendMode);
@@ -59277,7 +59366,7 @@
     method @Nullable public android.graphics.BlendMode getButtonTintBlendMode();
     method @Nullable public android.content.res.ColorStateList getButtonTintList();
     method @Nullable public android.graphics.PorterDuff.Mode getButtonTintMode();
-    method @android.view.ViewDebug.ExportedProperty public boolean isChecked();
+    method public boolean isChecked();
     method public void setButtonDrawable(@DrawableRes int);
     method public void setButtonDrawable(@Nullable android.graphics.drawable.Drawable);
     method public void setButtonTintBlendMode(@Nullable android.graphics.BlendMode);
@@ -59666,7 +59755,7 @@
     method public int getColumnWidth();
     method public int getGravity();
     method public int getHorizontalSpacing();
-    method @android.view.ViewDebug.ExportedProperty public int getNumColumns();
+    method public int getNumColumns();
     method public int getRequestedColumnWidth();
     method public int getRequestedHorizontalSpacing();
     method public int getStretchMode();
@@ -59857,8 +59946,8 @@
     ctor public LinearLayout.LayoutParams(android.view.ViewGroup.MarginLayoutParams);
     ctor public LinearLayout.LayoutParams(android.widget.LinearLayout.LayoutParams);
     method public String debug(String);
-    field @android.view.ViewDebug.ExportedProperty(category="layout", mapping={@android.view.ViewDebug.IntToString(from=0xffffffff, to="NONE"), @android.view.ViewDebug.IntToString(from=android.view.Gravity.NO_GRAVITY, to="NONE"), @android.view.ViewDebug.IntToString(from=android.view.Gravity.TOP, to="TOP"), @android.view.ViewDebug.IntToString(from=android.view.Gravity.BOTTOM, to="BOTTOM"), @android.view.ViewDebug.IntToString(from=android.view.Gravity.LEFT, to="LEFT"), @android.view.ViewDebug.IntToString(from=android.view.Gravity.RIGHT, to="RIGHT"), @android.view.ViewDebug.IntToString(from=android.view.Gravity.START, to="START"), @android.view.ViewDebug.IntToString(from=android.view.Gravity.END, to="END"), @android.view.ViewDebug.IntToString(from=android.view.Gravity.CENTER_VERTICAL, to="CENTER_VERTICAL"), @android.view.ViewDebug.IntToString(from=android.view.Gravity.FILL_VERTICAL, to="FILL_VERTICAL"), @android.view.ViewDebug.IntToString(from=android.view.Gravity.CENTER_HORIZONTAL, to="CENTER_HORIZONTAL"), @android.view.ViewDebug.IntToString(from=android.view.Gravity.FILL_HORIZONTAL, to="FILL_HORIZONTAL"), @android.view.ViewDebug.IntToString(from=android.view.Gravity.CENTER, to="CENTER"), @android.view.ViewDebug.IntToString(from=android.view.Gravity.FILL, to="FILL")}) public int gravity;
-    field @android.view.ViewDebug.ExportedProperty(category="layout") public float weight;
+    field public int gravity;
+    field public float weight;
   }
 
   public interface ListAdapter extends android.widget.Adapter {
@@ -60247,13 +60336,13 @@
     method @Nullable public android.content.res.ColorStateList getIndeterminateTintList();
     method @Nullable public android.graphics.PorterDuff.Mode getIndeterminateTintMode();
     method public android.view.animation.Interpolator getInterpolator();
-    method @android.view.ViewDebug.ExportedProperty(category="progress") public int getMax();
+    method public int getMax();
     method @Px public int getMaxHeight();
     method @Px public int getMaxWidth();
-    method @android.view.ViewDebug.ExportedProperty(category="progress") public int getMin();
+    method public int getMin();
     method @Px public int getMinHeight();
     method @Px public int getMinWidth();
-    method @android.view.ViewDebug.ExportedProperty(category="progress") public int getProgress();
+    method public int getProgress();
     method @Nullable public android.graphics.BlendMode getProgressBackgroundTintBlendMode();
     method @Nullable public android.content.res.ColorStateList getProgressBackgroundTintList();
     method @Nullable public android.graphics.PorterDuff.Mode getProgressBackgroundTintMode();
@@ -60261,14 +60350,14 @@
     method @Nullable public android.graphics.BlendMode getProgressTintBlendMode();
     method @Nullable public android.content.res.ColorStateList getProgressTintList();
     method @Nullable public android.graphics.PorterDuff.Mode getProgressTintMode();
-    method @android.view.ViewDebug.ExportedProperty(category="progress") public int getSecondaryProgress();
+    method public int getSecondaryProgress();
     method @Nullable public android.graphics.BlendMode getSecondaryProgressTintBlendMode();
     method @Nullable public android.content.res.ColorStateList getSecondaryProgressTintList();
     method @Nullable public android.graphics.PorterDuff.Mode getSecondaryProgressTintMode();
     method public final void incrementProgressBy(int);
     method public final void incrementSecondaryProgressBy(int);
     method public boolean isAnimating();
-    method @android.view.ViewDebug.ExportedProperty(category="progress") public boolean isIndeterminate();
+    method public boolean isIndeterminate();
     method public void onRestoreInstanceState(android.os.Parcelable);
     method public android.os.Parcelable onSaveInstanceState();
     method public void setIndeterminate(boolean);
@@ -60419,7 +60508,7 @@
     method public int getRule(int);
     method public int[] getRules();
     method public void removeRule(int);
-    field @android.view.ViewDebug.ExportedProperty(category="layout") public boolean alignWithParent;
+    field public boolean alignWithParent;
   }
 
   public class RemoteViews implements android.view.LayoutInflater.Filter android.os.Parcelable {
@@ -60978,8 +61067,8 @@
     ctor public TableRow.LayoutParams(int);
     ctor public TableRow.LayoutParams(android.view.ViewGroup.LayoutParams);
     ctor public TableRow.LayoutParams(android.view.ViewGroup.MarginLayoutParams);
-    field @android.view.ViewDebug.ExportedProperty(category="layout") public int column;
-    field @android.view.ViewDebug.ExportedProperty(category="layout") public int span;
+    field public int column;
+    field public int span;
   }
 
   @android.widget.RemoteViews.RemoteView public class TextClock extends android.widget.TextView {
@@ -60987,8 +61076,8 @@
     ctor public TextClock(android.content.Context, android.util.AttributeSet);
     ctor public TextClock(android.content.Context, android.util.AttributeSet, int);
     ctor public TextClock(android.content.Context, android.util.AttributeSet, int, int);
-    method @android.view.ViewDebug.ExportedProperty public CharSequence getFormat12Hour();
-    method @android.view.ViewDebug.ExportedProperty public CharSequence getFormat24Hour();
+    method public CharSequence getFormat12Hour();
+    method public CharSequence getFormat24Hour();
     method public String getTimeZone();
     method public boolean is24HourModeEnabled();
     method public void refreshTime();
@@ -61047,7 +61136,7 @@
     method protected boolean getDefaultEditable();
     method protected android.text.method.MovementMethod getDefaultMovementMethod();
     method public android.text.Editable getEditableText();
-    method @android.view.ViewDebug.ExportedProperty public android.text.TextUtils.TruncateAt getEllipsize();
+    method public android.text.TextUtils.TruncateAt getEllipsize();
     method public CharSequence getError();
     method public int getExtendedPaddingBottom();
     method public int getExtendedPaddingTop();
@@ -61058,7 +61147,7 @@
     method public boolean getFreezesText();
     method public int getGravity();
     method @ColorInt public int getHighlightColor();
-    method @android.view.ViewDebug.CapturedViewProperty public CharSequence getHint();
+    method public CharSequence getHint();
     method public final android.content.res.ColorStateList getHintTextColors();
     method public int getHyphenationFrequency();
     method public int getImeActionId();
@@ -61094,14 +61183,14 @@
     method public android.text.TextPaint getPaint();
     method public int getPaintFlags();
     method public String getPrivateImeOptions();
-    method @android.view.ViewDebug.ExportedProperty(category="text") public int getSelectionEnd();
-    method @android.view.ViewDebug.ExportedProperty(category="text") public int getSelectionStart();
+    method public int getSelectionEnd();
+    method public int getSelectionStart();
     method @ColorInt public int getShadowColor();
     method public float getShadowDx();
     method public float getShadowDy();
     method public float getShadowRadius();
     method public final boolean getShowSoftInputOnFocus();
-    method @android.view.ViewDebug.CapturedViewProperty public CharSequence getText();
+    method public CharSequence getText();
     method @NonNull public android.view.textclassifier.TextClassifier getTextClassifier();
     method public final android.content.res.ColorStateList getTextColors();
     method @Nullable public android.graphics.drawable.Drawable getTextCursorDrawable();
@@ -61113,7 +61202,7 @@
     method @Nullable public android.graphics.drawable.Drawable getTextSelectHandle();
     method @Nullable public android.graphics.drawable.Drawable getTextSelectHandleLeft();
     method @Nullable public android.graphics.drawable.Drawable getTextSelectHandleRight();
-    method @android.view.ViewDebug.ExportedProperty(category="text") public float getTextSize();
+    method public float getTextSize();
     method public int getTextSizeUnit();
     method public int getTotalPaddingBottom();
     method public int getTotalPaddingEnd();
diff --git a/api/system-current.txt b/api/system-current.txt
index f07ebaf..8558326 100755
--- a/api/system-current.txt
+++ b/api/system-current.txt
@@ -8958,6 +8958,7 @@
     field public static final String NAMESPACE_AUTOFILL = "autofill";
     field public static final String NAMESPACE_BIOMETRICS = "biometrics";
     field public static final String NAMESPACE_BLOBSTORE = "blobstore";
+    field public static final String NAMESPACE_BLUETOOTH = "bluetooth";
     field public static final String NAMESPACE_CONNECTIVITY = "connectivity";
     field public static final String NAMESPACE_CONTENT_CAPTURE = "content_capture";
     field @Deprecated public static final String NAMESPACE_DEX_BOOT = "dex_boot";
@@ -9766,7 +9767,7 @@
   public abstract class EuiccService extends android.app.Service {
     ctor public EuiccService();
     method public void dump(@NonNull java.io.PrintWriter);
-    method public int encodeSmdxSubjectAndReasonCode(@Nullable String, @Nullable String) throws java.lang.IllegalArgumentException, java.lang.NumberFormatException, java.lang.UnsupportedOperationException;
+    method public int encodeSmdxSubjectAndReasonCode(@Nullable String, @Nullable String);
     method @CallSuper public android.os.IBinder onBind(android.content.Intent);
     method public abstract int onDeleteSubscription(int, String);
     method public android.service.euicc.DownloadSubscriptionResult onDownloadSubscription(int, @NonNull android.telephony.euicc.DownloadableSubscription, boolean, boolean, @Nullable android.os.Bundle);
@@ -10203,7 +10204,7 @@
   }
 
   public static class CallScreeningService.CallResponse.Builder {
-    method @NonNull public android.telecom.CallScreeningService.CallResponse.Builder setShouldScreenCallViaAudioProcessing(boolean);
+    method @NonNull @RequiresPermission(android.Manifest.permission.CAPTURE_AUDIO_OUTPUT) public android.telecom.CallScreeningService.CallResponse.Builder setShouldScreenCallViaAudioProcessing(boolean);
   }
 
   public abstract class Conference extends android.telecom.Conferenceable {
@@ -10659,85 +10660,6 @@
     field @NonNull public static final android.os.Parcelable.Creator<android.telephony.DataSpecificRegistrationInfo> CREATOR;
   }
 
-  public final class DisconnectCause {
-    field public static final int ALREADY_DIALING = 72; // 0x48
-    field public static final int ANSWERED_ELSEWHERE = 52; // 0x34
-    field public static final int BUSY = 4; // 0x4
-    field public static final int CALLING_DISABLED = 74; // 0x4a
-    field public static final int CALL_BARRED = 20; // 0x14
-    field public static final int CALL_PULLED = 51; // 0x33
-    field public static final int CANT_CALL_WHILE_RINGING = 73; // 0x49
-    field public static final int CDMA_ACCESS_BLOCKED = 35; // 0x23
-    field public static final int CDMA_ACCESS_FAILURE = 32; // 0x20
-    field public static final int CDMA_ALREADY_ACTIVATED = 49; // 0x31
-    field public static final int CDMA_DROP = 27; // 0x1b
-    field public static final int CDMA_INTERCEPT = 28; // 0x1c
-    field public static final int CDMA_LOCKED_UNTIL_POWER_CYCLE = 26; // 0x1a
-    field public static final int CDMA_NOT_EMERGENCY = 34; // 0x22
-    field public static final int CDMA_PREEMPTED = 33; // 0x21
-    field public static final int CDMA_REORDER = 29; // 0x1d
-    field public static final int CDMA_RETRY_ORDER = 31; // 0x1f
-    field public static final int CDMA_SO_REJECT = 30; // 0x1e
-    field public static final int CONGESTION = 5; // 0x5
-    field public static final int CS_RESTRICTED = 22; // 0x16
-    field public static final int CS_RESTRICTED_EMERGENCY = 24; // 0x18
-    field public static final int CS_RESTRICTED_NORMAL = 23; // 0x17
-    field public static final int DATA_DISABLED = 54; // 0x36
-    field public static final int DATA_LIMIT_REACHED = 55; // 0x37
-    field public static final int DIALED_CALL_FORWARDING_WHILE_ROAMING = 57; // 0x39
-    field public static final int DIALED_MMI = 39; // 0x27
-    field public static final int DIAL_LOW_BATTERY = 62; // 0x3e
-    field public static final int DIAL_MODIFIED_TO_DIAL = 48; // 0x30
-    field public static final int DIAL_MODIFIED_TO_DIAL_VIDEO = 66; // 0x42
-    field public static final int DIAL_MODIFIED_TO_SS = 47; // 0x2f
-    field public static final int DIAL_MODIFIED_TO_USSD = 46; // 0x2e
-    field public static final int DIAL_VIDEO_MODIFIED_TO_DIAL = 69; // 0x45
-    field public static final int DIAL_VIDEO_MODIFIED_TO_DIAL_VIDEO = 70; // 0x46
-    field public static final int DIAL_VIDEO_MODIFIED_TO_SS = 67; // 0x43
-    field public static final int DIAL_VIDEO_MODIFIED_TO_USSD = 68; // 0x44
-    field public static final int EMERGENCY_PERM_FAILURE = 64; // 0x40
-    field public static final int EMERGENCY_TEMP_FAILURE = 63; // 0x3f
-    field public static final int ERROR_UNSPECIFIED = 36; // 0x24
-    field public static final int FDN_BLOCKED = 21; // 0x15
-    field public static final int ICC_ERROR = 19; // 0x13
-    field public static final int IMEI_NOT_ACCEPTED = 58; // 0x3a
-    field public static final int IMS_ACCESS_BLOCKED = 60; // 0x3c
-    field public static final int IMS_MERGED_SUCCESSFULLY = 45; // 0x2d
-    field public static final int IMS_SIP_ALTERNATE_EMERGENCY_CALL = 71; // 0x47
-    field public static final int INCOMING_AUTO_REJECTED = 81; // 0x51
-    field public static final int INCOMING_MISSED = 1; // 0x1
-    field public static final int INCOMING_REJECTED = 16; // 0x10
-    field public static final int INVALID_CREDENTIALS = 10; // 0xa
-    field public static final int INVALID_NUMBER = 7; // 0x7
-    field public static final int LIMIT_EXCEEDED = 15; // 0xf
-    field public static final int LOCAL = 3; // 0x3
-    field public static final int LOST_SIGNAL = 14; // 0xe
-    field public static final int LOW_BATTERY = 61; // 0x3d
-    field public static final int MAXIMUM_NUMBER_OF_CALLS_REACHED = 53; // 0x35
-    field public static final int MMI = 6; // 0x6
-    field public static final int NORMAL = 2; // 0x2
-    field public static final int NORMAL_UNSPECIFIED = 65; // 0x41
-    field public static final int NOT_DISCONNECTED = 0; // 0x0
-    field public static final int NOT_VALID = -1; // 0xffffffff
-    field public static final int NO_PHONE_NUMBER_SUPPLIED = 38; // 0x26
-    field public static final int NUMBER_UNREACHABLE = 8; // 0x8
-    field public static final int OTASP_PROVISIONING_IN_PROCESS = 76; // 0x4c
-    field public static final int OUTGOING_CANCELED = 44; // 0x2c
-    field public static final int OUTGOING_EMERGENCY_CALL_PLACED = 80; // 0x50
-    field public static final int OUTGOING_FAILURE = 43; // 0x2b
-    field public static final int OUT_OF_NETWORK = 11; // 0xb
-    field public static final int OUT_OF_SERVICE = 18; // 0x12
-    field public static final int POWER_OFF = 17; // 0x11
-    field public static final int SERVER_ERROR = 12; // 0xc
-    field public static final int SERVER_UNREACHABLE = 9; // 0x9
-    field public static final int TIMED_OUT = 13; // 0xd
-    field public static final int TOO_MANY_ONGOING_CALLS = 75; // 0x4b
-    field public static final int UNOBTAINABLE_NUMBER = 25; // 0x19
-    field public static final int VIDEO_CALL_NOT_ALLOWED_WHILE_TTY_ENABLED = 50; // 0x32
-    field public static final int VOICEMAIL_NUMBER_MISSING = 40; // 0x28
-    field public static final int WIFI_LOST = 59; // 0x3b
-  }
-
   public final class ImsiEncryptionInfo implements android.os.Parcelable {
     method public int describeContents();
     method @Nullable public String getKeyIdentifier();
@@ -12513,6 +12435,7 @@
   public class MbmsDownloadServiceBase extends android.os.Binder implements android.os.IInterface {
     ctor public MbmsDownloadServiceBase();
     method public int addProgressListener(android.telephony.mbms.DownloadRequest, android.telephony.mbms.DownloadProgressListener) throws android.os.RemoteException;
+    method public int addServiceAnnouncement(int, @NonNull byte[]);
     method public int addStatusListener(android.telephony.mbms.DownloadRequest, android.telephony.mbms.DownloadStatusListener) throws android.os.RemoteException;
     method public android.os.IBinder asBinder();
     method public int cancelDownload(android.telephony.mbms.DownloadRequest) throws android.os.RemoteException;
diff --git a/api/system-lint-baseline.txt b/api/system-lint-baseline.txt
index 10c96a3..9c40b6c 100644
--- a/api/system-lint-baseline.txt
+++ b/api/system-lint-baseline.txt
@@ -217,6 +217,13 @@
 
 
 NoClone: android.service.contentcapture.ContentCaptureService#dump(java.io.FileDescriptor, java.io.PrintWriter, String[]) parameter #0:
+
+
+
+NoSettingsProvider: android.provider.Settings.Global#TETHER_OFFLOAD_DISABLED:
+    New setting keys are not allowed. (Field: TETHER_OFFLOAD_DISABLED)
+NoSettingsProvider: android.provider.Settings.Global#TETHER_SUPPORTED:
+    New setting keys are not allowed. (Field: TETHER_SUPPORTED)
     
 
 
diff --git a/api/test-current.txt b/api/test-current.txt
index 3838bad5..5172e59 100644
--- a/api/test-current.txt
+++ b/api/test-current.txt
@@ -3858,7 +3858,7 @@
   }
 
   public static class CallScreeningService.CallResponse.Builder {
-    method @NonNull public android.telecom.CallScreeningService.CallResponse.Builder setShouldScreenCallViaAudioProcessing(boolean);
+    method @NonNull @RequiresPermission(android.Manifest.permission.CAPTURE_AUDIO_OUTPUT) public android.telecom.CallScreeningService.CallResponse.Builder setShouldScreenCallViaAudioProcessing(boolean);
   }
 
   public abstract class Conference extends android.telecom.Conferenceable {
@@ -3926,6 +3926,7 @@
     method @RequiresPermission("android.permission.READ_PRIVILEGED_PHONE_STATE") public int getCurrentTtyMode();
     method @Nullable @RequiresPermission("android.permission.READ_PRIVILEGED_PHONE_STATE") public String getDefaultDialerPackage(@NonNull android.os.UserHandle);
     method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean isInEmergencyCall();
+    method @RequiresPermission(anyOf={"android.permission.READ_PRIVILEGED_PHONE_STATE", android.Manifest.permission.READ_PHONE_STATE}) public boolean isRinging();
     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
     field public static final int TTY_MODE_HCO = 2; // 0x2
@@ -4908,6 +4909,7 @@
   public class MbmsDownloadServiceBase extends android.os.Binder implements android.os.IInterface {
     ctor public MbmsDownloadServiceBase();
     method public int addProgressListener(android.telephony.mbms.DownloadRequest, android.telephony.mbms.DownloadProgressListener) throws android.os.RemoteException;
+    method public int addServiceAnnouncement(int, @NonNull byte[]);
     method public int addStatusListener(android.telephony.mbms.DownloadRequest, android.telephony.mbms.DownloadStatusListener) throws android.os.RemoteException;
     method public android.os.IBinder asBinder();
     method public int cancelDownload(android.telephony.mbms.DownloadRequest) throws android.os.RemoteException;
@@ -5209,7 +5211,7 @@
     field public static final int ACCESSIBILITY_TITLE_CHANGED = 33554432; // 0x2000000
     field public static final int PRIVATE_FLAG_NO_MOVE_ANIMATION = 64; // 0x40
     field public CharSequence accessibilityTitle;
-    field @android.view.ViewDebug.ExportedProperty(flagMapping={@android.view.ViewDebug.FlagToString(mask=0x1, equals=0x1, name="FAKE_HARDWARE_ACCELERATED"), @android.view.ViewDebug.FlagToString(mask=0x2, equals=0x2, name="FORCE_HARDWARE_ACCELERATED"), @android.view.ViewDebug.FlagToString(mask=0x4, equals=0x4, name="WANTS_OFFSET_NOTIFICATIONS"), @android.view.ViewDebug.FlagToString(mask=0x10, equals=0x10, name="SHOW_FOR_ALL_USERS"), @android.view.ViewDebug.FlagToString(mask=android.view.WindowManager.LayoutParams.PRIVATE_FLAG_NO_MOVE_ANIMATION, equals=android.view.WindowManager.LayoutParams.PRIVATE_FLAG_NO_MOVE_ANIMATION, name="NO_MOVE_ANIMATION"), @android.view.ViewDebug.FlagToString(mask=0x80, equals=0x80, name="COMPATIBLE_WINDOW"), @android.view.ViewDebug.FlagToString(mask=0x100, equals=0x100, name="SYSTEM_ERROR"), @android.view.ViewDebug.FlagToString(mask=0x800, equals=0x800, name="DISABLE_WALLPAPER_TOUCH_EVENTS"), @android.view.ViewDebug.FlagToString(mask=0x1000, equals=0x1000, name="FORCE_STATUS_BAR_VISIBLE"), @android.view.ViewDebug.FlagToString(mask=0x2000, equals=0x2000, name="PRESERVE_GEOMETRY"), @android.view.ViewDebug.FlagToString(mask=0x4000, equals=0x4000, name="FORCE_DECOR_VIEW_VISIBILITY"), @android.view.ViewDebug.FlagToString(mask=0x8000, equals=0x8000, name="WILL_NOT_REPLACE_ON_RELAUNCH"), @android.view.ViewDebug.FlagToString(mask=0x10000, equals=0x10000, name="LAYOUT_CHILD_WINDOW_IN_PARENT_FRAME"), @android.view.ViewDebug.FlagToString(mask=0x20000, equals=0x20000, name="FORCE_DRAW_STATUS_BAR_BACKGROUND"), @android.view.ViewDebug.FlagToString(mask=0x40000, equals=0x40000, name="SUSTAINED_PERFORMANCE_MODE"), @android.view.ViewDebug.FlagToString(mask=0x80000, equals=0x80000, name="HIDE_NON_SYSTEM_OVERLAY_WINDOWS"), @android.view.ViewDebug.FlagToString(mask=0x100000, equals=0x100000, name="IS_ROUNDED_CORNERS_OVERLAY"), @android.view.ViewDebug.FlagToString(mask=0x400000, equals=0x400000, name="IS_SCREEN_DECOR"), @android.view.ViewDebug.FlagToString(mask=0x800000, equals=0x800000, name="STATUS_FORCE_SHOW_NAVIGATION"), @android.view.ViewDebug.FlagToString(mask=0x1000000, equals=0x1000000, name="COLOR_SPACE_AGNOSTIC"), @android.view.ViewDebug.FlagToString(mask=0x4000000, equals=0x4000000, name="APPEARANCE_CONTROLLED"), @android.view.ViewDebug.FlagToString(mask=0x8000000, equals=0x8000000, name="BEHAVIOR_CONTROLLED"), @android.view.ViewDebug.FlagToString(mask=0x10000000, equals=0x10000000, name="FIT_INSETS_CONTROLLED")}) public int privateFlags;
+    field public int privateFlags;
   }
 
 }
diff --git a/api/test-lint-baseline.txt b/api/test-lint-baseline.txt
index caf8fdb..6562c7e 100644
--- a/api/test-lint-baseline.txt
+++ b/api/test-lint-baseline.txt
@@ -2294,6 +2294,88 @@
 NoClone: android.service.contentcapture.ContentCaptureService#dump(java.io.FileDescriptor, java.io.PrintWriter, String[]) parameter #0:
     
 NoClone: android.util.proto.ProtoOutputStream#ProtoOutputStream(java.io.FileDescriptor) parameter #0:
+
+
+
+NoSettingsProvider: android.provider.Settings.Global#APP_OPS_CONSTANTS:
+    New setting keys are not allowed (Field: APP_OPS_CONSTANTS); use getters/setters in relevant manager class
+NoSettingsProvider: android.provider.Settings.Global#AUTOFILL_COMPAT_MODE_ALLOWED_PACKAGES:
+    
+NoSettingsProvider: android.provider.Settings.Global#AUTOMATIC_POWER_SAVE_MODE:
+    
+NoSettingsProvider: android.provider.Settings.Global#BATTERY_SAVER_CONSTANTS:
+    
+NoSettingsProvider: android.provider.Settings.Global#DYNAMIC_POWER_SAVINGS_DISABLE_THRESHOLD:
+    
+NoSettingsProvider: android.provider.Settings.Global#DYNAMIC_POWER_SAVINGS_ENABLED:
+    
+NoSettingsProvider: android.provider.Settings.Global#HIDDEN_API_BLACKLIST_EXEMPTIONS:
+    
+NoSettingsProvider: android.provider.Settings.Global#HIDE_ERROR_DIALOGS:
+    New setting keys are not allowed (Field: HIDE_ERROR_DIALOGS); use getters/setters in relevant manager class
+NoSettingsProvider: android.provider.Settings.Global#LOCATION_GLOBAL_KILL_SWITCH:
+    
+NoSettingsProvider: android.provider.Settings.Global#LOCATION_IGNORE_SETTINGS_PACKAGE_WHITELIST:
+    
+NoSettingsProvider: android.provider.Settings.Global#LOW_POWER_MODE:
+    
+NoSettingsProvider: android.provider.Settings.Global#LOW_POWER_MODE_STICKY:
+    
+NoSettingsProvider: android.provider.Settings.Global#NOTIFICATION_BUBBLES:
+    
+NoSettingsProvider: android.provider.Settings.Global#OVERLAY_DISPLAY_DEVICES:
+    
+NoSettingsProvider: android.provider.Settings.Global#TETHER_OFFLOAD_DISABLED:
+    
+NoSettingsProvider: android.provider.Settings.Global#USE_OPEN_WIFI_PACKAGE:
+    
+NoSettingsProvider: android.provider.Settings.Secure#ACCESSIBILITY_DISPLAY_MAGNIFICATION_ENABLED:
+    
+NoSettingsProvider: android.provider.Settings.Secure#ACCESSIBILITY_SHORTCUT_TARGET_SERVICE:
+    
+NoSettingsProvider: android.provider.Settings.Secure#AUTOFILL_FEATURE_FIELD_CLASSIFICATION:
+    
+NoSettingsProvider: android.provider.Settings.Secure#AUTOFILL_SERVICE:
+    
+NoSettingsProvider: android.provider.Settings.Secure#AUTOFILL_USER_DATA_MAX_CATEGORY_COUNT:
+    
+NoSettingsProvider: android.provider.Settings.Secure#AUTOFILL_USER_DATA_MAX_FIELD_CLASSIFICATION_IDS_SIZE:
+    
+NoSettingsProvider: android.provider.Settings.Secure#AUTOFILL_USER_DATA_MAX_USER_DATA_SIZE:
+    
+NoSettingsProvider: android.provider.Settings.Secure#AUTOFILL_USER_DATA_MAX_VALUE_LENGTH:
+    
+NoSettingsProvider: android.provider.Settings.Secure#AUTOFILL_USER_DATA_MIN_VALUE_LENGTH:
+    
+NoSettingsProvider: android.provider.Settings.Secure#CONTENT_CAPTURE_ENABLED:
+    
+NoSettingsProvider: android.provider.Settings.Secure#DISABLED_PRINT_SERVICES:
+    
+NoSettingsProvider: android.provider.Settings.Secure#DOZE_ALWAYS_ON:
+    
+NoSettingsProvider: android.provider.Settings.Secure#ENABLED_VR_LISTENERS:
+    
+NoSettingsProvider: android.provider.Settings.Secure#IMMERSIVE_MODE_CONFIRMATIONS:
+    New setting keys are not allowed (Field: IMMERSIVE_MODE_CONFIRMATIONS); use getters/setters in relevant manager class
+NoSettingsProvider: android.provider.Settings.Secure#LOCATION_ACCESS_CHECK_DELAY_MILLIS:
+    
+NoSettingsProvider: android.provider.Settings.Secure#LOCATION_ACCESS_CHECK_INTERVAL_MILLIS:
+    
+NoSettingsProvider: android.provider.Settings.Secure#LOCK_SCREEN_ALLOW_PRIVATE_NOTIFICATIONS:
+    New setting keys are not allowed (Field: LOCK_SCREEN_ALLOW_PRIVATE_NOTIFICATIONS); use getters/setters in relevant manager class
+NoSettingsProvider: android.provider.Settings.Secure#LOCK_SCREEN_SHOW_NOTIFICATIONS:
+    New setting keys are not allowed (Field: LOCK_SCREEN_SHOW_NOTIFICATIONS); use getters/setters in relevant manager class
+NoSettingsProvider: android.provider.Settings.Secure#NFC_PAYMENT_DEFAULT_COMPONENT:
+    New setting keys are not allowed (Field: NFC_PAYMENT_DEFAULT_COMPONENT); use getters/setters in relevant manager class
+NoSettingsProvider: android.provider.Settings.Secure#NOTIFICATION_BADGING:
+    
+NoSettingsProvider: android.provider.Settings.Secure#POWER_MENU_LOCKED_SHOW_CONTENT:
+    New setting keys are not allowed (Field: POWER_MENU_LOCKED_SHOW_CONTENT); use getters/setters in relevant manager class
+NoSettingsProvider: android.provider.Settings.Secure#SYNC_PARENT_SOUNDS:
+    
+NoSettingsProvider: android.provider.Settings.Secure#USER_SETUP_COMPLETE:
+    
+NoSettingsProvider: android.provider.Settings.Secure#VOICE_INTERACTION_SERVICE:
     
 
 
diff --git a/cmds/app_process/Android.bp b/cmds/app_process/Android.bp
index 8be95e4..07221f9 100644
--- a/cmds/app_process/Android.bp
+++ b/cmds/app_process/Android.bp
@@ -5,11 +5,13 @@
 
     multilib: {
         lib32: {
-            version_script: ":art_sigchain_version_script32.txt",
+            // TODO(b/142944043): Remove version script when libsigchain is a DSO.
+            version_script: "version-script32.txt",
             suffix: "32",
         },
         lib64: {
-            version_script: ":art_sigchain_version_script64.txt",
+            // TODO(b/142944043): Remove version script when libsigchain is a DSO.
+            version_script: "version-script64.txt",
             suffix: "64",
         },
     },
diff --git a/cmds/app_process/version-script32.txt b/cmds/app_process/version-script32.txt
new file mode 100644
index 0000000..70810e0
--- /dev/null
+++ b/cmds/app_process/version-script32.txt
@@ -0,0 +1,15 @@
+{
+global:
+  EnsureFrontOfChain;
+  AddSpecialSignalHandlerFn;
+  RemoveSpecialSignalHandlerFn;
+  SkipAddSignalHandler;
+  bsd_signal;
+  sigaction;
+  sigaction64;
+  signal;
+  sigprocmask;
+  sigprocmask64;
+local:
+  *;
+};
diff --git a/cmds/app_process/version-script64.txt b/cmds/app_process/version-script64.txt
new file mode 100644
index 0000000..7bcd76b
--- /dev/null
+++ b/cmds/app_process/version-script64.txt
@@ -0,0 +1,14 @@
+{
+global:
+  EnsureFrontOfChain;
+  AddSpecialSignalHandlerFn;
+  RemoveSpecialSignalHandlerFn;
+  SkipAddSignalHandler;
+  sigaction;
+  sigaction64;
+  signal;
+  sigprocmask;
+  sigprocmask64;
+local:
+  *;
+};
diff --git a/cmds/bootanimation/Android.bp b/cmds/bootanimation/Android.bp
index befb67b..757c2b2 100644
--- a/cmds/bootanimation/Android.bp
+++ b/cmds/bootanimation/Android.bp
@@ -28,6 +28,8 @@
     name: "bootanimation",
     defaults: ["bootanimation_defaults"],
 
+    header_libs: ["jni_headers"],
+
     shared_libs: [
         "libOpenSLES",
         "libbootanimation",
diff --git a/cmds/device_config/Android.bp b/cmds/device_config/Android.bp
new file mode 100644
index 0000000..67e014a
--- /dev/null
+++ b/cmds/device_config/Android.bp
@@ -0,0 +1,7 @@
+// Copyright 2018 The Android Open Source Project
+//
+
+sh_binary {
+    name: "device_config",
+    src: "device_config",
+}
diff --git a/cmds/device_config/Android.mk b/cmds/device_config/Android.mk
deleted file mode 100644
index 4041e01..0000000
--- a/cmds/device_config/Android.mk
+++ /dev/null
@@ -1,10 +0,0 @@
-# Copyright 2018 The Android Open Source Project
-#
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-LOCAL_MODULE := device_config
-LOCAL_SRC_FILES := device_config
-LOCAL_MODULE_CLASS := EXECUTABLES
-LOCAL_MODULE_TAGS := optional
-include $(BUILD_PREBUILT)
diff --git a/cmds/idmap2/idmap2d/Idmap2Service.cpp b/cmds/idmap2/idmap2d/Idmap2Service.cpp
index f95b73f..a6c402c 100644
--- a/cmds/idmap2/idmap2d/Idmap2Service.cpp
+++ b/cmds/idmap2/idmap2d/Idmap2Service.cpp
@@ -169,7 +169,7 @@
                                   aidl::nullable<std::string>* _aidl_return) {
   assert(_aidl_return);
   SYSTRACE << "Idmap2Service::createIdmap " << target_apk_path << " " << overlay_apk_path;
-  _aidl_return->reset(nullptr);
+  _aidl_return->reset();
 
   const PolicyBitmask policy_bitmask = ConvertAidlArgToPolicyBitmask(fulfilled_policies);
 
diff --git a/cmds/incidentd/src/Section.cpp b/cmds/incidentd/src/Section.cpp
index 33e7649..e56ed39 100644
--- a/cmds/incidentd/src/Section.cpp
+++ b/cmds/incidentd/src/Section.cpp
@@ -33,7 +33,6 @@
 #include <debuggerd/client.h>
 #include <dumputils/dump_utils.h>
 #include <log/log_event_list.h>
-#include <log/log_read.h>
 #include <log/logprint.h>
 #include <private/android_logger.h>
 #include <sys/mman.h>
diff --git a/cmds/incidentd/src/Section.h b/cmds/incidentd/src/Section.h
index bc4909d..698cc04 100644
--- a/cmds/incidentd/src/Section.h
+++ b/cmds/incidentd/src/Section.h
@@ -24,7 +24,7 @@
 #include <map>
 
 #include <android/os/IIncidentDumpCallback.h>
-
+#include <log/log_read.h>
 #include <utils/String16.h>
 #include <utils/String8.h>
 #include <utils/Vector.h>
@@ -164,8 +164,8 @@
     // global last log retrieved timestamp for each log_id_t.
     static map<log_id_t, log_time> gLastLogsRetrieved;
 
-    // log mode: read only & non blocking.
-    const static int logModeBase = ANDROID_LOG_RDONLY | ANDROID_LOG_NONBLOCK;
+    // log mode: non blocking.
+    const static int logModeBase = ANDROID_LOG_NONBLOCK;
 
 public:
     LogSection(int id, const char* logID, ...);
diff --git a/cmds/statsd/src/StatsService.cpp b/cmds/statsd/src/StatsService.cpp
index 6f952f6..3226482 100644
--- a/cmds/statsd/src/StatsService.cpp
+++ b/cmds/statsd/src/StatsService.cpp
@@ -1093,36 +1093,26 @@
     }
 }
 
-Status StatsService::getData(int64_t key, const int32_t callingUid, vector<int8_t>* output) {
+Status StatsService::getData(int64_t key, const int32_t callingUid, vector<uint8_t>* output) {
     ENFORCE_UID(AID_SYSTEM);
 
     VLOG("StatsService::getData with Uid %i", callingUid);
     ConfigKey configKey(callingUid, key);
-    // TODO(b/149254662): Since libbinder_ndk uses int8_t instead of uint8_t,
-    // there are inconsistencies with internal statsd logic. Instead of
-    // modifying lots of files, we create a temporary output array of int8_t and
-    // copy its data into output. This is a bad hack, but hopefully
-    // libbinder_ndk will transition to using uint8_t soon: progress is tracked
-    // in b/144957764. Same applies to StatsService::getMetadata.
-    vector<uint8_t> unsignedOutput;
     // The dump latency does not matter here since we do not include the current bucket, we do not
     // need to pull any new data anyhow.
     mProcessor->onDumpReport(configKey, getElapsedRealtimeNs(), false /* include_current_bucket*/,
-                             true /* erase_data */, GET_DATA_CALLED, FAST, &unsignedOutput);
-    *output = vector<int8_t>(unsignedOutput.begin(), unsignedOutput.end());
+                             true /* erase_data */, GET_DATA_CALLED, FAST, output);
     return Status::ok();
 }
 
-Status StatsService::getMetadata(vector<int8_t>* output) {
+Status StatsService::getMetadata(vector<uint8_t>* output) {
     ENFORCE_UID(AID_SYSTEM);
 
-    vector<uint8_t> unsignedOutput;
-    StatsdStats::getInstance().dumpStats(&unsignedOutput, false); // Don't reset the counters.
-    *output = vector<int8_t>(unsignedOutput.begin(), unsignedOutput.end());
+    StatsdStats::getInstance().dumpStats(output, false); // Don't reset the counters.
     return Status::ok();
 }
 
-Status StatsService::addConfiguration(int64_t key, const vector <int8_t>& config,
+Status StatsService::addConfiguration(int64_t key, const vector <uint8_t>& config,
                                       const int32_t callingUid) {
     ENFORCE_UID(AID_SYSTEM);
 
@@ -1133,7 +1123,7 @@
     }
 }
 
-bool StatsService::addConfigurationChecked(int uid, int64_t key, const vector<int8_t>& config) {
+bool StatsService::addConfigurationChecked(int uid, int64_t key, const vector<uint8_t>& config) {
     ConfigKey configKey(uid, key);
     StatsdConfig cfg;
     if (config.size() > 0) {  // If the config is empty, skip parsing.
diff --git a/cmds/statsd/src/StatsService.h b/cmds/statsd/src/StatsService.h
index b49fa1d..324ffbd 100644
--- a/cmds/statsd/src/StatsService.h
+++ b/cmds/statsd/src/StatsService.h
@@ -96,13 +96,13 @@
      */
     virtual Status getData(int64_t key,
                            const int32_t callingUid,
-                           vector<int8_t>* output) override;
+                           vector<uint8_t>* output) override;
 
 
     /**
      * Binder call for clients to get metadata across all configs in statsd.
      */
-    virtual Status getMetadata(vector<int8_t>* output) override;
+    virtual Status getMetadata(vector<uint8_t>* output) override;
 
 
     /**
@@ -110,7 +110,7 @@
      * should requestData for this configuration.
      */
     virtual Status addConfiguration(int64_t key,
-                                    const vector<int8_t>& config,
+                                    const vector<uint8_t>& config,
                                     const int32_t callingUid) override;
 
     /**
@@ -320,7 +320,7 @@
     /**
      * Adds a configuration after checking permissions and obtaining UID from binder call.
      */
-    bool addConfigurationChecked(int uid, int64_t key, const vector<int8_t>& config);
+    bool addConfigurationChecked(int uid, int64_t key, const vector<uint8_t>& config);
 
     /**
      * Update a configuration.
diff --git a/cmds/statsd/tests/e2e/PartialBucket_e2e_test.cpp b/cmds/statsd/tests/e2e/PartialBucket_e2e_test.cpp
index 783f31c..c03b925 100644
--- a/cmds/statsd/tests/e2e/PartialBucket_e2e_test.cpp
+++ b/cmds/statsd/tests/e2e/PartialBucket_e2e_test.cpp
@@ -39,7 +39,7 @@
 void SendConfig(shared_ptr<StatsService>& service, const StatsdConfig& config) {
     string str;
     config.SerializeToString(&str);
-    std::vector<int8_t> configAsVec(str.begin(), str.end());
+    std::vector<uint8_t> configAsVec(str.begin(), str.end());
     service->addConfiguration(kConfigKey, configAsVec, kCallingUid);
 }
 
diff --git a/cmds/telecom/src/com/android/commands/telecom/Telecom.java b/cmds/telecom/src/com/android/commands/telecom/Telecom.java
index fe270a4..fed9c43 100644
--- a/cmds/telecom/src/com/android/commands/telecom/Telecom.java
+++ b/cmds/telecom/src/com/android/commands/telecom/Telecom.java
@@ -68,6 +68,8 @@
     private static final String COMMAND_UNREGISTER_PHONE_ACCOUNT = "unregister-phone-account";
     private static final String COMMAND_SET_DEFAULT_DIALER = "set-default-dialer";
     private static final String COMMAND_GET_DEFAULT_DIALER = "get-default-dialer";
+    private static final String COMMAND_STOP_BLOCK_SUPPRESSION = "stop-block-suppression";
+
     /**
      * Change the system dialer package name if a package name was specified,
      * Example: adb shell telecom set-system-dialer <PACKAGE>
@@ -115,6 +117,8 @@
                 + "usage: telecom set-sim-count <COUNT>\n"
                 + "usage: telecom get-sim-config\n"
                 + "usage: telecom get-max-phones\n"
+                + "usage: telecom stop-block-suppression: Stop suppressing the blocked number"
+                        + " provider after a call to emergency services.\n"
                 + "usage: telecom set-emer-phone-account-filter <PACKAGE>\n"
                 + "\n"
                 + "telecom set-phone-account-enabled: Enables the given phone account, if it has"
@@ -207,6 +211,9 @@
             case COMMAND_UNREGISTER_PHONE_ACCOUNT:
                 runUnregisterPhoneAccount();
                 break;
+            case COMMAND_STOP_BLOCK_SUPPRESSION:
+                runStopBlockSuppression();
+                break;
             case COMMAND_SET_DEFAULT_DIALER:
                 runSetDefaultDialer();
                 break;
@@ -324,8 +331,13 @@
         System.out.println("Success - " + handle + " unregistered.");
     }
 
+    private void runStopBlockSuppression() throws RemoteException {
+        mTelecomService.stopBlockSuppression();
+    }
+
     private void runSetDefaultDialer() throws RemoteException {
-        final String packageName = nextArgRequired();
+        String packageName = nextArg();
+        if ("default".equals(packageName)) packageName = null;
         mTelecomService.setTestDefaultDialer(packageName);
         System.out.println("Success - " + packageName + " set as override default dialer.");
     }
diff --git a/config/OWNERS b/config/OWNERS
index 53f80e6..3d4924d 100644
--- a/config/OWNERS
+++ b/config/OWNERS
@@ -1,5 +1,5 @@
 # compat-team@ for changes to hiddenapi files
-per-file hiddenapi-* = andreionea@google.com, atrost@google.com, mathewi@google.com, satayev@google.com
+per-file hiddenapi-* = andreionea@google.com, mathewi@google.com, satayev@google.com
 
 # Escalations:
-per-file hiddenapi-* = bdc@google.com, narayan@google.com
\ No newline at end of file
+per-file hiddenapi-* = bdc@google.com, narayan@google.com
diff --git a/config/preloaded-classes b/config/preloaded-classes
index 0bac2d1..481bcb5 100644
--- a/config/preloaded-classes
+++ b/config/preloaded-classes
@@ -9990,8 +9990,6 @@
 dalvik.system.CloseGuard$Reporter
 dalvik.system.CloseGuard$Tracker
 dalvik.system.CloseGuard
-dalvik.system.DalvikLogHandler
-dalvik.system.DalvikLogging
 dalvik.system.DelegateLastClassLoader
 dalvik.system.DexClassLoader
 dalvik.system.DexFile$1
@@ -11952,6 +11950,7 @@
 sun.nio.fs.NativeBuffer$Deallocator
 sun.nio.fs.NativeBuffer
 sun.nio.fs.NativeBuffers
+sun.nio.fs.UnixChannelFactory
 sun.nio.fs.UnixChannelFactory$Flags
 sun.nio.fs.UnixConstants
 sun.nio.fs.UnixException
diff --git a/config/preloaded-classes-blacklist b/config/preloaded-classes-blacklist
index 48d579c..8ab5273 100644
--- a/config/preloaded-classes-blacklist
+++ b/config/preloaded-classes-blacklist
@@ -1,6 +1,5 @@
 android.content.AsyncTaskLoader$LoadTask
 android.net.ConnectivityThread$Singleton
-android.os.AsyncTask
 android.os.FileObserver
 android.os.NullVibrator
 android.speech.tts.TextToSpeech$Connection$SetupConnectionAsyncTask
diff --git a/core/java/android/annotation/OWNERS b/core/java/android/annotation/OWNERS
index 8aceb56..e1ef544 100644
--- a/core/java/android/annotation/OWNERS
+++ b/core/java/android/annotation/OWNERS
@@ -1,3 +1,3 @@
 tnorbye@google.com
 aurimas@google.com
-per-file UnsupportedAppUsage.java = mathewi@google.com, dbrazdil@google.com, atrost@google.com, andreionea@google.com
+per-file UnsupportedAppUsage.java = mathewi@google.com, satayev@google.com, andreionea@google.com
diff --git a/core/java/android/app/Activity.java b/core/java/android/app/Activity.java
index 3772755..63e8638 100644
--- a/core/java/android/app/Activity.java
+++ b/core/java/android/app/Activity.java
@@ -220,8 +220,8 @@
  * <a name="Fragments"></a>
  * <h3>Fragments</h3>
  *
- * <p>The {@link android.support.v4.app.FragmentActivity} subclass
- * can make use of the {@link android.support.v4.app.Fragment} class to better
+ * <p>The {@link androidx.fragment.app.FragmentActivity} subclass
+ * can make use of the {@link androidx.fragment.app.Fragment} class to better
  * modularize their code, build more sophisticated user interfaces for larger
  * screens, and help scale their application between small and large screens.</p>
  *
@@ -1100,7 +1100,7 @@
     /**
      * Return the LoaderManager for this activity, creating it if needed.
      *
-     * @deprecated Use {@link android.support.v4.app.FragmentActivity#getSupportLoaderManager()}
+     * @deprecated Use {@link androidx.fragment.app.FragmentActivity#getSupportLoaderManager()}
      */
     @Deprecated
     public LoaderManager getLoaderManager() {
@@ -3159,7 +3159,7 @@
      * Return the FragmentManager for interacting with fragments associated
      * with this activity.
      *
-     * @deprecated Use {@link android.support.v4.app.FragmentActivity#getSupportFragmentManager()}
+     * @deprecated Use {@link androidx.fragment.app.FragmentActivity#getSupportFragmentManager()}
      */
     @Deprecated
     public FragmentManager getFragmentManager() {
@@ -3172,7 +3172,7 @@
      * method and before {@link Fragment#onCreate Fragment.onCreate()}.
      *
      * @deprecated Use {@link
-     * android.support.v4.app.FragmentActivity#onAttachFragment(android.support.v4.app.Fragment)}
+     * androidx.fragment.app.FragmentActivity#onAttachFragment(androidx.fragment.app.Fragment)}
      */
     @Deprecated
     public void onAttachFragment(Fragment fragment) {
diff --git a/core/java/android/app/AlarmManager.java b/core/java/android/app/AlarmManager.java
index ae8a2cb..12ec9eb4 100644
--- a/core/java/android/app/AlarmManager.java
+++ b/core/java/android/app/AlarmManager.java
@@ -34,9 +34,8 @@
 import android.util.Log;
 import android.util.proto.ProtoOutputStream;
 
-import libcore.timezone.ZoneInfoDb;
+import com.android.i18n.timezone.ZoneInfoDb;
 
-import java.io.IOException;
 import java.lang.annotation.Retention;
 import java.lang.annotation.RetentionPolicy;
 import java.lang.ref.WeakReference;
@@ -996,12 +995,7 @@
 
         // Reject this timezone if it isn't an Olson zone we recognize.
         if (mTargetSdkVersion >= Build.VERSION_CODES.M) {
-            boolean hasTimeZone = false;
-            try {
-                hasTimeZone = ZoneInfoDb.getInstance().hasTimeZone(timeZone);
-            } catch (IOException ignored) {
-            }
-
+            boolean hasTimeZone = ZoneInfoDb.getInstance().hasTimeZone(timeZone);
             if (!hasTimeZone) {
                 throw new IllegalArgumentException("Timezone: " + timeZone + " is not an Olson ID");
             }
diff --git a/core/java/android/app/Fragment.java b/core/java/android/app/Fragment.java
index e4e5ba3..f7fb3c3 100644
--- a/core/java/android/app/Fragment.java
+++ b/core/java/android/app/Fragment.java
@@ -102,7 +102,7 @@
  * While the Fragment API was introduced in
  * {@link android.os.Build.VERSION_CODES#HONEYCOMB}, a version of the API
  * at is also available for use on older platforms through
- * {@link android.support.v4.app.FragmentActivity}.  See the blog post
+ * {@link androidx.fragment.app.FragmentActivity}.  See the blog post
  * <a href="http://android-developers.blogspot.com/2011/03/fragments-for-all.html">
  * Fragments For All</a> for more details.
  *
@@ -258,8 +258,8 @@
  * pressing back will pop it to return the user to whatever previous state
  * the activity UI was in.
  *
- * @deprecated Use the <a href="{@docRoot}tools/extras/support-library.html">Support Library</a>
- *      {@link android.support.v4.app.Fragment} for consistent behavior across all devices
+ * @deprecated Use the <a href="{@docRoot}jetpack">Jetpack Fragment Library</a>
+ *      {@link androidx.fragment.app.Fragment} for consistent behavior across all devices
  *      and access to <a href="{@docRoot}topic/libraries/architecture/lifecycle.html">Lifecycle</a>.
  */
 @Deprecated
@@ -432,7 +432,7 @@
      * through {@link FragmentManager#saveFragmentInstanceState(Fragment)
      * FragmentManager.saveFragmentInstanceState}.
      *
-     * @deprecated Use {@link android.support.v4.app.Fragment.SavedState}
+     * @deprecated Use {@link androidx.fragment.app.Fragment.SavedState}
      */
     @Deprecated
     public static class SavedState implements Parcelable {
@@ -479,7 +479,7 @@
      * Thrown by {@link Fragment#instantiate(Context, String, Bundle)} when
      * there is an instantiation failure.
      *
-     * @deprecated Use {@link android.support.v4.app.Fragment.InstantiationException}
+     * @deprecated Use {@link androidx.fragment.app.Fragment.InstantiationException}
      */
     @Deprecated
     static public class InstantiationException extends AndroidRuntimeException {
@@ -1055,7 +1055,7 @@
     /**
      * Return the LoaderManager for this fragment, creating it if needed.
      *
-     * @deprecated Use {@link android.support.v4.app.Fragment#getLoaderManager()}
+     * @deprecated Use {@link androidx.fragment.app.Fragment#getLoaderManager()}
      */
     @Deprecated
     public LoaderManager getLoaderManager() {
diff --git a/core/java/android/app/ResourcesManager.java b/core/java/android/app/ResourcesManager.java
index 4cba6ea..7477899 100644
--- a/core/java/android/app/ResourcesManager.java
+++ b/core/java/android/app/ResourcesManager.java
@@ -20,7 +20,6 @@
 
 import android.annotation.NonNull;
 import android.annotation.Nullable;
-import android.annotation.TestApi;
 import android.compat.annotation.UnsupportedAppUsage;
 import android.content.pm.ActivityInfo;
 import android.content.pm.ApplicationInfo;
@@ -1043,7 +1042,6 @@
         }
     }
 
-    @TestApi
     public final boolean applyConfigurationToResources(@NonNull Configuration config,
             @Nullable CompatibilityInfo compat) {
         synchronized(this) {
diff --git a/core/java/android/app/role/OWNERS b/core/java/android/app/role/OWNERS
new file mode 100644
index 0000000..b94d988
--- /dev/null
+++ b/core/java/android/app/role/OWNERS
@@ -0,0 +1,6 @@
+svetoslavganov@google.com
+moltmann@google.com
+zhanghai@google.com
+evanseverson@google.com
+eugenesusla@google.com
+ntmyren@google.com
diff --git a/core/java/android/bluetooth/BluetoothCodecConfig.java b/core/java/android/bluetooth/BluetoothCodecConfig.java
index d2a1535..e07bc02 100644
--- a/core/java/android/bluetooth/BluetoothCodecConfig.java
+++ b/core/java/android/bluetooth/BluetoothCodecConfig.java
@@ -614,8 +614,9 @@
         if (other == null && mCodecType != other.mCodecType) {
             return false;
         }
-        // Currently we only care about the LDAC Playback Quality at CodecSpecific1
+        // Currently we only care about the AAC VBR and LDAC Playback Quality at CodecSpecific1
         switch (mCodecType) {
+            case SOURCE_CODEC_TYPE_AAC:
             case SOURCE_CODEC_TYPE_LDAC:
                 if (mCodecSpecific1 != other.mCodecSpecific1) {
                     return false;
diff --git a/core/java/android/bluetooth/BluetoothDevice.java b/core/java/android/bluetooth/BluetoothDevice.java
index 594e5ff..dc7d053 100644
--- a/core/java/android/bluetooth/BluetoothDevice.java
+++ b/core/java/android/bluetooth/BluetoothDevice.java
@@ -1031,7 +1031,11 @@
         try {
             String name = service.getRemoteName(this);
             if (name != null) {
-                return name.replaceAll("[\\t\\n\\r]+", " ");
+                // remove whitespace characters from the name
+                return name
+                        .replace('\t', ' ')
+                        .replace('\n', ' ')
+                        .replace('\r', ' ');
             }
             return null;
         } catch (RemoteException e) {
diff --git a/core/java/android/bluetooth/BluetoothHeadsetClient.java b/core/java/android/bluetooth/BluetoothHeadsetClient.java
index 85e0e08..2836325 100644
--- a/core/java/android/bluetooth/BluetoothHeadsetClient.java
+++ b/core/java/android/bluetooth/BluetoothHeadsetClient.java
@@ -19,7 +19,6 @@
 import android.Manifest;
 import android.annotation.NonNull;
 import android.annotation.RequiresPermission;
-import android.annotation.SystemApi;
 import android.compat.annotation.UnsupportedAppUsage;
 import android.content.Context;
 import android.os.Binder;
@@ -587,7 +586,6 @@
      * @return true if connectionPolicy is set, false on error
      * @hide
      */
-    @SystemApi
     @RequiresPermission(Manifest.permission.BLUETOOTH_PRIVILEGED)
     public boolean setConnectionPolicy(@NonNull BluetoothDevice device,
             @ConnectionPolicy int connectionPolicy) {
@@ -637,7 +635,6 @@
      * @return connection policy of the device
      * @hide
      */
-    @SystemApi
     @RequiresPermission(Manifest.permission.BLUETOOTH)
     public @ConnectionPolicy int getConnectionPolicy(@NonNull BluetoothDevice device) {
         if (VDBG) log("getConnectionPolicy(" + device + ")");
diff --git a/core/java/android/bluetooth/BluetoothMapClient.java b/core/java/android/bluetooth/BluetoothMapClient.java
index 19240dc..4f5c4fe 100644
--- a/core/java/android/bluetooth/BluetoothMapClient.java
+++ b/core/java/android/bluetooth/BluetoothMapClient.java
@@ -19,7 +19,6 @@
 import android.Manifest;
 import android.annotation.NonNull;
 import android.annotation.RequiresPermission;
-import android.annotation.SystemApi;
 import android.app.PendingIntent;
 import android.compat.annotation.UnsupportedAppUsage;
 import android.content.Context;
@@ -276,7 +275,6 @@
      * @return true if connectionPolicy is set, false on error
      * @hide
      */
-    @SystemApi
     @RequiresPermission(Manifest.permission.BLUETOOTH_PRIVILEGED)
     public boolean setConnectionPolicy(@NonNull BluetoothDevice device,
             @ConnectionPolicy int connectionPolicy) {
@@ -325,7 +323,6 @@
      * @return connection policy of the device
      * @hide
      */
-    @SystemApi
     @RequiresPermission(Manifest.permission.BLUETOOTH_PRIVILEGED)
     public @ConnectionPolicy int getConnectionPolicy(@NonNull BluetoothDevice device) {
         if (VDBG) Log.d(TAG, "getConnectionPolicy(" + device + ")");
diff --git a/core/java/android/bluetooth/BluetoothPan.java b/core/java/android/bluetooth/BluetoothPan.java
index a80f5b7..bfc28fa 100644
--- a/core/java/android/bluetooth/BluetoothPan.java
+++ b/core/java/android/bluetooth/BluetoothPan.java
@@ -367,7 +367,7 @@
         final IBluetoothPan service = getService();
         if (service != null && isEnabled()) {
             try {
-                service.setBluetoothTethering(value, pkgName);
+                service.setBluetoothTethering(value, pkgName, null);
             } catch (RemoteException e) {
                 Log.e(TAG, "Stack:" + Log.getStackTraceString(new Throwable()));
             }
diff --git a/core/java/android/bluetooth/BluetoothPbapClient.java b/core/java/android/bluetooth/BluetoothPbapClient.java
index d3452ff..f356da1 100644
--- a/core/java/android/bluetooth/BluetoothPbapClient.java
+++ b/core/java/android/bluetooth/BluetoothPbapClient.java
@@ -19,7 +19,6 @@
 import android.Manifest;
 import android.annotation.NonNull;
 import android.annotation.RequiresPermission;
-import android.annotation.SystemApi;
 import android.content.Context;
 import android.os.Binder;
 import android.os.IBinder;
@@ -276,7 +275,6 @@
      * @return true if connectionPolicy is set, false on error
      * @hide
      */
-    @SystemApi
     @RequiresPermission(Manifest.permission.BLUETOOTH_PRIVILEGED)
     public boolean setConnectionPolicy(@NonNull BluetoothDevice device,
             @ConnectionPolicy int connectionPolicy) {
@@ -329,7 +327,6 @@
      * @return connection policy of the device
      * @hide
      */
-    @SystemApi
     @RequiresPermission(Manifest.permission.BLUETOOTH_PRIVILEGED)
     public @ConnectionPolicy int getConnectionPolicy(@NonNull BluetoothDevice device) {
         if (VDBG) {
diff --git a/core/java/android/bluetooth/BluetoothSap.java b/core/java/android/bluetooth/BluetoothSap.java
index 6e03481..48e8c1a 100644
--- a/core/java/android/bluetooth/BluetoothSap.java
+++ b/core/java/android/bluetooth/BluetoothSap.java
@@ -18,7 +18,6 @@
 
 import android.Manifest;
 import android.annotation.RequiresPermission;
-import android.annotation.SystemApi;
 import android.compat.annotation.UnsupportedAppUsage;
 import android.content.Context;
 import android.os.Binder;
@@ -328,7 +327,6 @@
      * @return true if connectionPolicy is set, false on error
      * @hide
      */
-    @SystemApi
     @RequiresPermission(Manifest.permission.BLUETOOTH_PRIVILEGED)
     public boolean setConnectionPolicy(BluetoothDevice device,
             @ConnectionPolicy int connectionPolicy) {
@@ -377,7 +375,6 @@
      * @return connection policy of the device
      * @hide
      */
-    @SystemApi
     @RequiresPermission(Manifest.permission.BLUETOOTH_PRIVILEGED)
     public @ConnectionPolicy int getConnectionPolicy(BluetoothDevice device) {
         if (VDBG) log("getConnectionPolicy(" + device + ")");
diff --git a/core/java/android/bluetooth/le/BluetoothLeScanner.java b/core/java/android/bluetooth/le/BluetoothLeScanner.java
index 9a17346..2888fbd 100644
--- a/core/java/android/bluetooth/le/BluetoothLeScanner.java
+++ b/core/java/android/bluetooth/le/BluetoothLeScanner.java
@@ -110,8 +110,9 @@
      * off to save power. Scanning is resumed when screen is turned on again. To avoid this, use
      * {@link #startScan(List, ScanSettings, ScanCallback)} with desired {@link ScanFilter}.
      * <p>
-     * An app must hold
-     * {@link android.Manifest.permission#ACCESS_COARSE_LOCATION ACCESS_COARSE_LOCATION} or
+     * An app must have
+     * {@link android.Manifest.permission#ACCESS_COARSE_LOCATION ACCESS_COARSE_LOCATION} permission
+     * in order to get results. An App targeting Android Q or later must have
      * {@link android.Manifest.permission#ACCESS_FINE_LOCATION ACCESS_FINE_LOCATION} permission
      * in order to get results.
      *
@@ -129,8 +130,9 @@
      * resumed when screen is turned on again. To avoid this, do filetered scanning by
      * using proper {@link ScanFilter}.
      * <p>
-     * An app must hold
-     * {@link android.Manifest.permission#ACCESS_COARSE_LOCATION ACCESS_COARSE_LOCATION} or
+     * An app must have
+     * {@link android.Manifest.permission#ACCESS_COARSE_LOCATION ACCESS_COARSE_LOCATION} permission
+     * in order to get results. An App targeting Android Q or later must have
      * {@link android.Manifest.permission#ACCESS_FINE_LOCATION ACCESS_FINE_LOCATION} permission
      * in order to get results.
      *
@@ -150,8 +152,9 @@
      * the PendingIntent. Use this method of scanning if your process is not always running and it
      * should be started when scan results are available.
      * <p>
-     * An app must hold
-     * {@link android.Manifest.permission#ACCESS_COARSE_LOCATION ACCESS_COARSE_LOCATION} or
+     * An app must have
+     * {@link android.Manifest.permission#ACCESS_COARSE_LOCATION ACCESS_COARSE_LOCATION} permission
+     * in order to get results. An App targeting Android Q or later must have
      * {@link android.Manifest.permission#ACCESS_FINE_LOCATION ACCESS_FINE_LOCATION} permission
      * in order to get results.
      * <p>
diff --git a/core/java/android/content/om/OverlayManager.java b/core/java/android/content/om/OverlayManager.java
index 2bdca7d..fd3d48f 100644
--- a/core/java/android/content/om/OverlayManager.java
+++ b/core/java/android/content/om/OverlayManager.java
@@ -21,7 +21,6 @@
 import android.annotation.RequiresPermission;
 import android.annotation.SystemApi;
 import android.annotation.SystemService;
-import android.annotation.TestApi;
 import android.compat.Compatibility;
 import android.compat.annotation.ChangeId;
 import android.compat.annotation.EnabledAfter;
@@ -241,7 +240,6 @@
      *
      * @hide
      */
-    @TestApi
     @RequiresPermission(anyOf = {
             "android.permission.INTERACT_ACROSS_USERS",
     })
diff --git a/core/java/android/content/pm/PackageManager.java b/core/java/android/content/pm/PackageManager.java
index c577d0e..d0f9187 100644
--- a/core/java/android/content/pm/PackageManager.java
+++ b/core/java/android/content/pm/PackageManager.java
@@ -3741,6 +3741,13 @@
     }
 
     /**
+     * @deprecated Do not instantiate or subclass - obtain an instance from
+     * {@link Context#getPackageManager}
+     */
+    @Deprecated
+    public PackageManager() {}
+
+    /**
      * Retrieve overall information about an application package that is
      * installed on the system.
      *
diff --git a/core/java/android/content/pm/PackageParser.java b/core/java/android/content/pm/PackageParser.java
index 70e4e6c..43632f5 100644
--- a/core/java/android/content/pm/PackageParser.java
+++ b/core/java/android/content/pm/PackageParser.java
@@ -46,7 +46,6 @@
 import android.annotation.NonNull;
 import android.annotation.Nullable;
 import android.annotation.StringRes;
-import android.annotation.TestApi;
 import android.apex.ApexInfo;
 import android.app.ActivityTaskManager;
 import android.app.ActivityThread;
@@ -2545,7 +2544,6 @@
      *         not compatible with this platform
      * @hide Exposed for unit testing only.
      */
-    @TestApi
     public static int computeTargetSdkVersion(@IntRange(from = 0) int targetVers,
             @Nullable String targetCode, @NonNull String[] platformSdkCodenames,
             @NonNull String[] outError) {
@@ -2610,7 +2608,6 @@
      *         compatible with this platform
      * @hide Exposed for unit testing only.
      */
-    @TestApi
     public static int computeMinSdkVersion(@IntRange(from = 1) int minVers,
             @Nullable String minCode, @IntRange(from = 1) int platformSdkVersion,
             @NonNull String[] platformSdkCodenames, @NonNull String[] outError) {
@@ -4732,7 +4729,6 @@
      *                                AndroidManifest.xml.
      * @hide Exposed for unit testing only.
      */
-    @TestApi
     public static int getActivityConfigChanges(int configChanges, int recreateOnConfigChanges) {
         return configChanges | ((~recreateOnConfigChanges) & RECREATE_ON_CONFIG_CHANGES_MASK);
     }
diff --git a/core/java/android/hardware/GeomagneticField.java b/core/java/android/hardware/GeomagneticField.java
index 0d7b695..cbfe4fa 100644
--- a/core/java/android/hardware/GeomagneticField.java
+++ b/core/java/android/hardware/GeomagneticField.java
@@ -16,7 +16,8 @@
 
 package android.hardware;
 
-import java.util.GregorianCalendar;
+import java.util.Calendar;
+import java.util.TimeZone;
 
 /**
  * Estimates magnetic field at a given point on
@@ -26,7 +27,7 @@
  * <p>This uses the World Magnetic Model produced by the United States National
  * Geospatial-Intelligence Agency.  More details about the model can be found at
  * <a href="http://www.ngdc.noaa.gov/geomag/WMM/DoDWMM.shtml">http://www.ngdc.noaa.gov/geomag/WMM/DoDWMM.shtml</a>.
- * This class currently uses WMM-2015 which is valid until 2020, but should
+ * This class currently uses WMM-2020 which is valid until 2025, but should
  * produce acceptable results for several years after that. Future versions of
  * Android may use a newer version of the model.
  */
@@ -48,69 +49,72 @@
     static private final float EARTH_REFERENCE_RADIUS_KM = 6371.2f;
 
     // These coefficients and the formulae used below are from:
-    // NOAA Technical Report: The US/UK World Magnetic Model for 2015-2020
-    static private final float[][] G_COEFF = new float[][] {
-        { 0.0f },
-        { -29438.5f, -1501.1f },
-        { -2445.3f, 3012.5f, 1676.6f },
-        { 1351.1f, -2352.3f, 1225.6f, 581.9f },
-        { 907.2f, 813.7f, 120.3f, -335.0f, 70.3f },
-        { -232.6f, 360.1f, 192.4f, -141.0f, -157.4f, 4.3f },
-        { 69.5f, 67.4f, 72.8f, -129.8f, -29.0f, 13.2f, -70.9f },
-        { 81.6f, -76.1f, -6.8f, 51.9f, 15.0f, 9.3f, -2.8f, 6.7f },
-        { 24.0f, 8.6f, -16.9f, -3.2f, -20.6f, 13.3f, 11.7f, -16.0f, -2.0f },
-        { 5.4f, 8.8f, 3.1f, -3.1f, 0.6f, -13.3f, -0.1f, 8.7f, -9.1f, -10.5f },
-        { -1.9f, -6.5f, 0.2f, 0.6f, -0.6f, 1.7f, -0.7f, 2.1f, 2.3f, -1.8f, -3.6f },
-        { 3.1f, -1.5f, -2.3f, 2.1f, -0.9f, 0.6f, -0.7f, 0.2f, 1.7f, -0.2f, 0.4f, 3.5f },
-        { -2.0f, -0.3f, 0.4f, 1.3f, -0.9f, 0.9f, 0.1f, 0.5f, -0.4f, -0.4f, 0.2f, -0.9f, 0.0f } };
+    // NOAA Technical Report: The US/UK World Magnetic Model for 2020-2025
+    static private final float[][] G_COEFF = new float[][]{
+            {0.0f},
+            {-29404.5f, -1450.7f},
+            {-2500.0f, 2982.0f, 1676.8f},
+            {1363.9f, -2381.0f, 1236.2f, 525.7f},
+            {903.1f, 809.4f, 86.2f, -309.4f, 47.9f},
+            {-234.4f, 363.1f, 187.8f, -140.7f, -151.2f, 13.7f},
+            {65.9f, 65.6f, 73.0f, -121.5f, -36.2f, 13.5f, -64.7f},
+            {80.6f, -76.8f, -8.3f, 56.5f, 15.8f, 6.4f, -7.2f, 9.8f},
+            {23.6f, 9.8f, -17.5f, -0.4f, -21.1f, 15.3f, 13.7f, -16.5f, -0.3f},
+            {5.0f, 8.2f, 2.9f, -1.4f, -1.1f, -13.3f, 1.1f, 8.9f, -9.3f, -11.9f},
+            {-1.9f, -6.2f, -0.1f, 1.7f, -0.9f, 0.6f, -0.9f, 1.9f, 1.4f, -2.4f, -3.9f},
+            {3.0f, -1.4f, -2.5f, 2.4f, -0.9f, 0.3f, -0.7f, -0.1f, 1.4f, -0.6f, 0.2f, 3.1f},
+            {-2.0f, -0.1f, 0.5f, 1.3f, -1.2f, 0.7f, 0.3f, 0.5f, -0.2f, -0.5f, 0.1f, -1.1f, -0.3f}};
 
-    static private final float[][] H_COEFF = new float[][] {
-        { 0.0f },
-        { 0.0f, 4796.2f },
-        { 0.0f, -2845.6f, -642.0f },
-        { 0.0f, -115.3f, 245.0f, -538.3f },
-        { 0.0f, 283.4f, -188.6f, 180.9f, -329.5f },
-        { 0.0f, 47.4f, 196.9f, -119.4f, 16.1f, 100.1f },
-        { 0.0f, -20.7f, 33.2f, 58.8f, -66.5f, 7.3f, 62.5f },
-        { 0.0f, -54.1f, -19.4f, 5.6f, 24.4f, 3.3f, -27.5f, -2.3f },
-        { 0.0f, 10.2f, -18.1f, 13.2f, -14.6f, 16.2f, 5.7f, -9.1f, 2.2f },
-        { 0.0f, -21.6f, 10.8f, 11.7f, -6.8f, -6.9f, 7.8f, 1.0f, -3.9f, 8.5f },
-        { 0.0f, 3.3f, -0.3f, 4.6f, 4.4f, -7.9f, -0.6f, -4.1f, -2.8f, -1.1f, -8.7f },
-        { 0.0f, -0.1f, 2.1f, -0.7f, -1.1f, 0.7f, -0.2f, -2.1f, -1.5f, -2.5f, -2.0f, -2.3f },
-        { 0.0f, -1.0f, 0.5f, 1.8f, -2.2f, 0.3f, 0.7f, -0.1f, 0.3f, 0.2f, -0.9f, -0.2f, 0.7f } };
+    static private final float[][] H_COEFF = new float[][]{
+            {0.0f},
+            {0.0f, 4652.9f},
+            {0.0f, -2991.6f, -734.8f},
+            {0.0f, -82.2f, 241.8f, -542.9f},
+            {0.0f, 282.0f, -158.4f, 199.8f, -350.1f},
+            {0.0f, 47.7f, 208.4f, -121.3f, 32.2f, 99.1f},
+            {0.0f, -19.1f, 25.0f, 52.7f, -64.4f, 9.0f, 68.1f},
+            {0.0f, -51.4f, -16.8f, 2.3f, 23.5f, -2.2f, -27.2f, -1.9f},
+            {0.0f, 8.4f, -15.3f, 12.8f, -11.8f, 14.9f, 3.6f, -6.9f, 2.8f},
+            {0.0f, -23.3f, 11.1f, 9.8f, -5.1f, -6.2f, 7.8f, 0.4f, -1.5f, 9.7f},
+            {0.0f, 3.4f, -0.2f, 3.5f, 4.8f, -8.6f, -0.1f, -4.2f, -3.4f, -0.1f, -8.8f},
+            {0.0f, 0.0f, 2.6f, -0.5f, -0.4f, 0.6f, -0.2f, -1.7f, -1.6f, -3.0f, -2.0f, -2.6f},
+            {0.0f, -1.2f, 0.5f, 1.3f, -1.8f, 0.1f, 0.7f, -0.1f, 0.6f, 0.2f, -0.9f, 0.0f, 0.5f}};
 
-    static private final float[][] DELTA_G = new float[][] {
-        { 0.0f },
-        { 10.7f, 17.9f },
-        { -8.6f, -3.3f, 2.4f },
-        { 3.1f, -6.2f, -0.4f, -10.4f },
-        { -0.4f, 0.8f, -9.2f, 4.0f, -4.2f },
-        { -0.2f, 0.1f, -1.4f, 0.0f, 1.3f, 3.8f },
-        { -0.5f, -0.2f, -0.6f, 2.4f, -1.1f, 0.3f, 1.5f },
-        { 0.2f, -0.2f, -0.4f, 1.3f, 0.2f, -0.4f, -0.9f, 0.3f },
-        { 0.0f, 0.1f, -0.5f, 0.5f, -0.2f, 0.4f, 0.2f, -0.4f, 0.3f },
-        { 0.0f, -0.1f, -0.1f, 0.4f, -0.5f, -0.2f, 0.1f, 0.0f, -0.2f, -0.1f },
-        { 0.0f, 0.0f, -0.1f, 0.3f, -0.1f, -0.1f, -0.1f, 0.0f, -0.2f, -0.1f, -0.2f },
-        { 0.0f, 0.0f, -0.1f, 0.1f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, -0.1f, -0.1f },
-        { 0.1f, 0.0f, 0.0f, 0.1f, -0.1f, 0.0f, 0.1f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f } };
+    static private final float[][] DELTA_G = new float[][]{
+            {0.0f},
+            {6.7f, 7.7f},
+            {-11.5f, -7.1f, -2.2f},
+            {2.8f, -6.2f, 3.4f, -12.2f},
+            {-1.1f, -1.6f, -6.0f, 5.4f, -5.5f},
+            {-0.3f, 0.6f, -0.7f, 0.1f, 1.2f, 1.0f},
+            {-0.6f, -0.4f, 0.5f, 1.4f, -1.4f, 0.0f, 0.8f},
+            {-0.1f, -0.3f, -0.1f, 0.7f, 0.2f, -0.5f, -0.8f, 1.0f},
+            {-0.1f, 0.1f, -0.1f, 0.5f, -0.1f, 0.4f, 0.5f, 0.0f, 0.4f},
+            {-0.1f, -0.2f, 0.0f, 0.4f, -0.3f, 0.0f, 0.3f, 0.0f, 0.0f, -0.4f},
+            {0.0f, 0.0f, 0.0f, 0.2f, -0.1f, -0.2f, 0.0f, -0.1f, -0.2f, -0.1f, 0.0f},
+            {0.0f, -0.1f, 0.0f, 0.0f, 0.0f, -0.1f, 0.0f, 0.0f, -0.1f, -0.1f, -0.1f, -0.1f},
+            {0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, -0.1f}};
 
-    static private final float[][] DELTA_H = new float[][] {
-        { 0.0f },
-        { 0.0f, -26.8f },
-        { 0.0f, -27.1f, -13.3f },
-        { 0.0f, 8.4f, -0.4f, 2.3f },
-        { 0.0f, -0.6f, 5.3f, 3.0f, -5.3f },
-        { 0.0f, 0.4f, 1.6f, -1.1f, 3.3f, 0.1f },
-        { 0.0f, 0.0f, -2.2f, -0.7f, 0.1f, 1.0f, 1.3f },
-        { 0.0f, 0.7f, 0.5f, -0.2f, -0.1f, -0.7f, 0.1f, 0.1f },
-        { 0.0f, -0.3f, 0.3f, 0.3f, 0.6f, -0.1f, -0.2f, 0.3f, 0.0f },
-        { 0.0f, -0.2f, -0.1f, -0.2f, 0.1f, 0.1f, 0.0f, -0.2f, 0.4f, 0.3f },
-        { 0.0f, 0.1f, -0.1f, 0.0f, 0.0f, -0.2f, 0.1f, -0.1f, -0.2f, 0.1f, -0.1f },
-        { 0.0f, 0.0f, 0.1f, 0.0f, 0.1f, 0.0f, 0.0f, 0.1f, 0.0f, -0.1f, 0.0f, -0.1f },
-        { 0.0f, 0.0f, 0.0f, -0.1f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f } };
+    static private final float[][] DELTA_H = new float[][]{
+            {0.0f},
+            {0.0f, -25.1f},
+            {0.0f, -30.2f, -23.9f},
+            {0.0f, 5.7f, -1.0f, 1.1f},
+            {0.0f, 0.2f, 6.9f, 3.7f, -5.6f},
+            {0.0f, 0.1f, 2.5f, -0.9f, 3.0f, 0.5f},
+            {0.0f, 0.1f, -1.8f, -1.4f, 0.9f, 0.1f, 1.0f},
+            {0.0f, 0.5f, 0.6f, -0.7f, -0.2f, -1.2f, 0.2f, 0.3f},
+            {0.0f, -0.3f, 0.7f, -0.2f, 0.5f, -0.3f, -0.5f, 0.4f, 0.1f},
+            {0.0f, -0.3f, 0.2f, -0.4f, 0.4f, 0.1f, 0.0f, -0.2f, 0.5f, 0.2f},
+            {0.0f, 0.0f, 0.1f, -0.3f, 0.1f, -0.2f, 0.1f, 0.0f, -0.1f, 0.2f, 0.0f},
+            {0.0f, 0.0f, 0.1f, 0.0f, 0.2f, 0.0f, 0.0f, 0.1f, 0.0f, -0.1f, 0.0f, 0.0f},
+            {0.0f, 0.0f, 0.0f, -0.1f, 0.1f, 0.0f, 0.0f, 0.0f, 0.1f, 0.0f, 0.0f, 0.0f, -0.1f}};
 
-    static private final long BASE_TIME =
-            new GregorianCalendar(2015, 1, 1).getTimeInMillis();
+    static private final long BASE_TIME = new Calendar.Builder()
+            .setTimeZone(TimeZone.getTimeZone("UTC"))
+            .setDate(2020, Calendar.JANUARY, 1)
+            .build()
+            .getTimeInMillis();
 
     // The ratio between the Gauss-normalized associated Legendre functions and
     // the Schmid quasi-normalized ones. Compute these once staticly since they
@@ -190,7 +194,7 @@
         // We now compute the magnetic field strength given the geocentric
         // location. The magnetic field is the derivative of the potential
         // function defined by the model. See NOAA Technical Report: The US/UK
-        // World Magnetic Model for 2015-2020 for the derivation.
+        // World Magnetic Model for 2020-2025 for the derivation.
         float gcX = 0.0f;  // Geocentric northwards component.
         float gcY = 0.0f;  // Geocentric eastwards component.
         float gcZ = 0.0f;  // Geocentric downwards component.
@@ -203,7 +207,7 @@
 
                 // Negative derivative with respect to latitude, divided by
                 // radius.  This looks like the negation of the version in the
-                // NOAA Techincal report because that report used
+                // NOAA Technical report because that report used
                 // P_n^m(sin(theta)) and we use P_n^m(cos(90 - theta)), so the
                 // derivative with respect to theta is negated.
                 gcX += relativeRadiusPower[n+2]
diff --git a/core/java/android/hardware/usb/OWNERS b/core/java/android/hardware/usb/OWNERS
new file mode 100644
index 0000000..8ee72b5
--- /dev/null
+++ b/core/java/android/hardware/usb/OWNERS
@@ -0,0 +1,6 @@
+badhri@google.com
+elaurent@google.com
+moltmann@google.com
+albertccwang@google.com
+jameswei@google.com
+howardyen@google.com
\ No newline at end of file
diff --git a/core/java/android/net/ConnectivityManager.java b/core/java/android/net/ConnectivityManager.java
index a29f878..c60373c 100644
--- a/core/java/android/net/ConnectivityManager.java
+++ b/core/java/android/net/ConnectivityManager.java
@@ -2044,13 +2044,22 @@
     public boolean requestRouteToHostAddress(int networkType, InetAddress hostAddress) {
         checkLegacyRoutingApiAccess();
         try {
-            return mService.requestRouteToHostAddress(networkType, hostAddress.getAddress());
+            return mService.requestRouteToHostAddress(networkType, hostAddress.getAddress(),
+                    mContext.getOpPackageName(), getAttributionTag());
         } catch (RemoteException e) {
             throw e.rethrowFromSystemServer();
         }
     }
 
     /**
+     * @return the context's attribution tag
+     */
+    // TODO: Remove method and replace with direct call once R code is pushed to AOSP
+    private @Nullable String getAttributionTag() {
+        return null;
+    }
+
+    /**
      * Returns the value of the setting for background data usage. If false,
      * applications should not use the network if the application is not in the
      * foreground. Developers should respect this setting, and check the value
@@ -2240,10 +2249,39 @@
      * services.jar, possibly in com.android.server.net. */
 
     /** {@hide} */
-    public static final void enforceChangePermission(Context context) {
+    public static final void enforceChangePermission(Context context,
+            String callingPkg, String callingAttributionTag) {
         int uid = Binder.getCallingUid();
-        Settings.checkAndNoteChangeNetworkStateOperation(context, uid, Settings
-                .getPackageNameForUid(context, uid), true /* throwException */);
+        checkAndNoteChangeNetworkStateOperation(context, uid, callingPkg,
+                callingAttributionTag, true /* throwException */);
+    }
+
+    /**
+     * Check if the package is a allowed to change the network state. This also accounts that such
+     * an access happened.
+     *
+     * @return {@code true} iff the package is allowed to change the network state.
+     */
+    // TODO: Remove method and replace with direct call once R code is pushed to AOSP
+    private static boolean checkAndNoteChangeNetworkStateOperation(@NonNull Context context,
+            int uid, @NonNull String callingPackage, @Nullable String callingAttributionTag,
+            boolean throwException) {
+        return Settings.checkAndNoteChangeNetworkStateOperation(context, uid, callingPackage,
+                throwException);
+    }
+
+    /**
+     * Check if the package is a allowed to write settings. This also accounts that such an access
+     * happened.
+     *
+     * @return {@code true} iff the package is allowed to write settings.
+     */
+    // TODO: Remove method and replace with direct call once R code is pushed to AOSP
+    private static boolean checkAndNoteWriteSettingsOperation(@NonNull Context context, int uid,
+            @NonNull String callingPackage, @Nullable String callingAttributionTag,
+            boolean throwException) {
+        return Settings.checkAndNoteWriteSettingsOperation(context, uid, callingPackage,
+                throwException);
     }
 
     /**
@@ -3686,7 +3724,8 @@
                             need, messenger, binder, callingPackageName);
                 } else {
                     request = mService.requestNetwork(
-                            need, messenger, timeoutMs, binder, legacyType, callingPackageName);
+                            need, messenger, timeoutMs, binder, legacyType, callingPackageName,
+                            getAttributionTag());
                 }
                 if (request != null) {
                     sCallbacks.put(request, callback);
@@ -3980,7 +4019,8 @@
         checkPendingIntentNotNull(operation);
         try {
             mService.pendingRequestForNetwork(
-                    request.networkCapabilities, operation, mContext.getOpPackageName());
+                    request.networkCapabilities, operation, mContext.getOpPackageName(),
+                    getAttributionTag());
         } catch (RemoteException e) {
             throw e.rethrowFromSystemServer();
         } catch (ServiceSpecificException e) {
diff --git a/core/java/android/net/IConnectivityManager.aidl b/core/java/android/net/IConnectivityManager.aidl
index 69a47f2..d7f178c 100644
--- a/core/java/android/net/IConnectivityManager.aidl
+++ b/core/java/android/net/IConnectivityManager.aidl
@@ -79,7 +79,8 @@
     NetworkQuotaInfo getActiveNetworkQuotaInfo();
     boolean isActiveNetworkMetered();
 
-    boolean requestRouteToHostAddress(int networkType, in byte[] hostAddress);
+    boolean requestRouteToHostAddress(int networkType, in byte[] hostAddress,
+            String callingPackageName, String callingAttributionTag);
 
     @UnsupportedAppUsage(maxTargetSdk = 29,
             publicAlternatives = "Use {@code TetheringManager#getLastTetherError} as alternative")
@@ -170,10 +171,10 @@
 
     NetworkRequest requestNetwork(in NetworkCapabilities networkCapabilities,
             in Messenger messenger, int timeoutSec, in IBinder binder, int legacy,
-            String callingPackageName);
+            String callingPackageName, String callingAttributionTag);
 
     NetworkRequest pendingRequestForNetwork(in NetworkCapabilities networkCapabilities,
-            in PendingIntent operation, String callingPackageName);
+            in PendingIntent operation, String callingPackageName, String callingAttributionTag);
 
     void releasePendingNetworkRequest(in PendingIntent operation);
 
diff --git a/core/java/android/net/MatchAllNetworkSpecifier.java b/core/java/android/net/MatchAllNetworkSpecifier.java
index 68a3935..70c4a72 100644
--- a/core/java/android/net/MatchAllNetworkSpecifier.java
+++ b/core/java/android/net/MatchAllNetworkSpecifier.java
@@ -43,7 +43,8 @@
     }
 
     /** @hide */
-    public boolean satisfiedBy(NetworkSpecifier other) {
+    @Override
+    public boolean canBeSatisfiedBy(NetworkSpecifier other) {
         /*
          * The method is called by a NetworkRequest to see if it is satisfied by a proposed
          * network (e.g. as offered by a network factory). Since MatchAllNetweorkSpecifier must
diff --git a/core/java/android/net/Network.java b/core/java/android/net/Network.java
index f807a49..b872617 100644
--- a/core/java/android/net/Network.java
+++ b/core/java/android/net/Network.java
@@ -27,6 +27,7 @@
 import android.system.OsConstants;
 import android.util.proto.ProtoOutputStream;
 
+import com.android.internal.annotations.GuardedBy;
 import com.android.okhttp.internalandroidapi.Dns;
 import com.android.okhttp.internalandroidapi.HttpURLConnectionFactory;
 
@@ -70,9 +71,9 @@
     // Objects used to perform per-network operations such as getSocketFactory
     // and openConnection, and a lock to protect access to them.
     private volatile NetworkBoundSocketFactory mNetworkBoundSocketFactory = null;
-    // mLock should be used to control write access to mUrlConnectionFactory.
-    // maybeInitUrlConnectionFactory() must be called prior to reading this field.
-    private volatile HttpURLConnectionFactory mUrlConnectionFactory;
+    // mUrlConnectionFactory is initialized lazily when it is first needed.
+    @GuardedBy("mLock")
+    private HttpURLConnectionFactory mUrlConnectionFactory;
     private final Object mLock = new Object();
 
     // Default connection pool values. These are evaluated at startup, just
@@ -295,36 +296,16 @@
         return mNetworkBoundSocketFactory;
     }
 
-    // TODO: This creates a connection pool and host resolver for
-    // every Network object, instead of one for every NetId. This is
-    // suboptimal, because an app could potentially have more than one
-    // Network object for the same NetId, causing increased memory footprint
-    // and performance penalties due to lack of connection reuse (connection
-    // setup time, congestion window growth time, etc.).
-    //
-    // Instead, investigate only having one connection pool and host resolver
-    // for every NetId, perhaps by using a static HashMap of NetIds to
-    // connection pools and host resolvers. The tricky part is deciding when
-    // to remove a map entry; a WeakHashMap shouldn't be used because whether
-    // a Network is referenced doesn't correlate with whether a new Network
-    // will be instantiated in the near future with the same NetID. A good
-    // solution would involve purging empty (or when all connections are timed
-    // out) ConnectionPools.
-    private void maybeInitUrlConnectionFactory() {
-        synchronized (mLock) {
-            if (mUrlConnectionFactory == null) {
-                // Set configuration on the HttpURLConnectionFactory that will be good for all
-                // connections created by this Network. Configuration that might vary is left
-                // until openConnection() and passed as arguments.
-                Dns dnsLookup = hostname -> Arrays.asList(Network.this.getAllByName(hostname));
-                HttpURLConnectionFactory urlConnectionFactory = new HttpURLConnectionFactory();
-                urlConnectionFactory.setDns(dnsLookup); // Let traffic go via dnsLookup
-                // A private connection pool just for this Network.
-                urlConnectionFactory.setNewConnectionPool(httpMaxConnections,
-                        httpKeepAliveDurationMs, TimeUnit.MILLISECONDS);
-                mUrlConnectionFactory = urlConnectionFactory;
-            }
-        }
+    private static HttpURLConnectionFactory createUrlConnectionFactory(Dns dnsLookup) {
+        // Set configuration on the HttpURLConnectionFactory that will be good for all
+        // connections created by this Network. Configuration that might vary is left
+        // until openConnection() and passed as arguments.
+        HttpURLConnectionFactory urlConnectionFactory = new HttpURLConnectionFactory();
+        urlConnectionFactory.setDns(dnsLookup); // Let traffic go via dnsLookup
+        // A private connection pool just for this Network.
+        urlConnectionFactory.setNewConnectionPool(httpMaxConnections,
+                httpKeepAliveDurationMs, TimeUnit.MILLISECONDS);
+        return urlConnectionFactory;
     }
 
     /**
@@ -365,9 +346,31 @@
      */
     public URLConnection openConnection(URL url, java.net.Proxy proxy) throws IOException {
         if (proxy == null) throw new IllegalArgumentException("proxy is null");
-        maybeInitUrlConnectionFactory();
+        // TODO: This creates a connection pool and host resolver for
+        // every Network object, instead of one for every NetId. This is
+        // suboptimal, because an app could potentially have more than one
+        // Network object for the same NetId, causing increased memory footprint
+        // and performance penalties due to lack of connection reuse (connection
+        // setup time, congestion window growth time, etc.).
+        //
+        // Instead, investigate only having one connection pool and host resolver
+        // for every NetId, perhaps by using a static HashMap of NetIds to
+        // connection pools and host resolvers. The tricky part is deciding when
+        // to remove a map entry; a WeakHashMap shouldn't be used because whether
+        // a Network is referenced doesn't correlate with whether a new Network
+        // will be instantiated in the near future with the same NetID. A good
+        // solution would involve purging empty (or when all connections are timed
+        // out) ConnectionPools.
+        final HttpURLConnectionFactory urlConnectionFactory;
+        synchronized (mLock) {
+            if (mUrlConnectionFactory == null) {
+                Dns dnsLookup = hostname -> Arrays.asList(getAllByName(hostname));
+                mUrlConnectionFactory = createUrlConnectionFactory(dnsLookup);
+            }
+            urlConnectionFactory = mUrlConnectionFactory;
+        }
         SocketFactory socketFactory = getSocketFactory();
-        return mUrlConnectionFactory.openConnection(url, socketFactory, proxy);
+        return urlConnectionFactory.openConnection(url, socketFactory, proxy);
     }
 
     /**
diff --git a/core/java/android/net/NetworkInfo.java b/core/java/android/net/NetworkInfo.java
index 08fe159..d752901 100644
--- a/core/java/android/net/NetworkInfo.java
+++ b/core/java/android/net/NetworkInfo.java
@@ -22,6 +22,7 @@
 import android.os.Parcel;
 import android.os.Parcelable;
 import android.telephony.Annotation.NetworkType;
+import android.text.TextUtils;
 
 import com.android.internal.annotations.VisibleForTesting;
 
@@ -538,7 +539,7 @@
     @Override
     public String toString() {
         synchronized (this) {
-            StringBuilder builder = new StringBuilder("[");
+            final StringBuilder builder = new StringBuilder("[");
             builder.append("type: ").append(getTypeName()).append("[").append(getSubtypeName()).
             append("], state: ").append(mState).append("/").append(mDetailedState).
             append(", reason: ").append(mReason == null ? "(unspecified)" : mReason).
@@ -551,6 +552,32 @@
         }
     }
 
+    /**
+     * Returns a brief summary string suitable for debugging.
+     * @hide
+     */
+    public String toShortString() {
+        synchronized (this) {
+            final StringBuilder builder = new StringBuilder();
+            builder.append(getTypeName());
+
+            final String subtype = getSubtypeName();
+            if (!TextUtils.isEmpty(subtype)) {
+                builder.append("[").append(subtype).append("]");
+            }
+
+            builder.append(" ");
+            builder.append(mDetailedState);
+            if (mIsRoaming) {
+                builder.append(" ROAMING");
+            }
+            if (mExtraInfo != null) {
+                builder.append(" extra: ").append(mExtraInfo);
+            }
+            return builder.toString();
+        }
+    }
+
     @Override
     public int describeContents() {
         return 0;
diff --git a/core/java/android/net/OWNERS b/core/java/android/net/OWNERS
index 767b693..5e2a718 100644
--- a/core/java/android/net/OWNERS
+++ b/core/java/android/net/OWNERS
@@ -8,4 +8,4 @@
 reminv@google.com
 satk@google.com
 
-per-file SSL*, Uri*, Url* = prb@google.com, dauletz@google.com, narayan@google.com, tobiast@google.com
+per-file SSL*, Uri*, Url* = prb@google.com, dauletz@google.com, narayan@google.com, ngeoffray@google.com
diff --git a/core/java/android/net/http/OWNERS b/core/java/android/net/http/OWNERS
index 3092612..3271d24 100644
--- a/core/java/android/net/http/OWNERS
+++ b/core/java/android/net/http/OWNERS
@@ -1,4 +1,4 @@
 narayan@google.com
-tobiast@google.com
+ngeoffray@google.com
 include platform/libcore:/OWNERS
 include platform/external/conscrypt:/OWNERS
diff --git a/core/java/android/os/BadParcelableException.java b/core/java/android/os/BadParcelableException.java
index 7e0b1a5..9b1343c 100644
--- a/core/java/android/os/BadParcelableException.java
+++ b/core/java/android/os/BadParcelableException.java
@@ -32,4 +32,8 @@
     public BadParcelableException(Exception cause) {
         super(cause);
     }
+    /** @hide */
+    public BadParcelableException(String msg, Throwable cause) {
+        super(msg, cause);
+    }
 }
diff --git a/core/java/android/os/Binder.java b/core/java/android/os/Binder.java
index e5f0760..947b773 100644
--- a/core/java/android/os/Binder.java
+++ b/core/java/android/os/Binder.java
@@ -284,6 +284,8 @@
      * system services to determine its identity and check permissions.
      * If the current thread is not currently executing an incoming transaction,
      * then its own pid is returned.
+     *
+     * Warning: oneway transactions do not receive PID.
      */
     @CriticalNative
     public static final native int getCallingPid();
diff --git a/core/java/android/os/Build.java b/core/java/android/os/Build.java
index b36aeb8..e2486af 100755
--- a/core/java/android/os/Build.java
+++ b/core/java/android/os/Build.java
@@ -106,6 +106,12 @@
     public static final String HARDWARE = getString("ro.hardware");
 
     /**
+     * The hardware variant (SKU), if available.
+     */
+    @NonNull
+    public static final String SKU = getString("ro.boot.hardware.sku");
+
+    /**
      * Whether this build was for an emulator device.
      * @hide
      */
diff --git a/core/java/android/os/Debug.java b/core/java/android/os/Debug.java
index 9f592e8..4b2cfe2 100644
--- a/core/java/android/os/Debug.java
+++ b/core/java/android/os/Debug.java
@@ -1115,8 +1115,6 @@
             if (outStream != null)
                 outStream.close();
         }
-
-        VMDebug.startEmulatorTracing();
     }
 
     /**
@@ -1130,8 +1128,6 @@
      * region of code.</p>
      */
     public static void stopNativeTracing() {
-        VMDebug.stopEmulatorTracing();
-
         // Open the sysfs file for writing and write "0" to it.
         PrintWriter outStream = null;
         try {
@@ -1160,7 +1156,7 @@
      * To temporarily enable tracing, use {@link #startNativeTracing()}.
      */
     public static void enableEmulatorTraceOutput() {
-        VMDebug.startEmulatorTracing();
+        Log.w(TAG, "Unimplemented");
     }
 
     /**
@@ -2097,25 +2093,6 @@
     public static final native int getBinderDeathObjectCount();
 
     /**
-     * Primes the register map cache.
-     *
-     * Only works for classes in the bootstrap class loader.  Does not
-     * cause classes to be loaded if they're not already present.
-     *
-     * The classAndMethodDesc argument is a concatentation of the VM-internal
-     * class descriptor, method name, and method descriptor.  Examples:
-     *     Landroid/os/Looper;.loop:()V
-     *     Landroid/app/ActivityThread;.main:([Ljava/lang/String;)V
-     *
-     * @param classAndMethodDesc the method to prepare
-     *
-     * @hide
-     */
-    public static final boolean cacheRegisterMap(String classAndMethodDesc) {
-        return VMDebug.cacheRegisterMap(classAndMethodDesc);
-    }
-
-    /**
      * Dumps the contents of VM reference tables (e.g. JNI locals and
      * globals) to the log file.
      *
diff --git a/core/java/android/os/HandlerThread.java b/core/java/android/os/HandlerThread.java
index 92fcbb6..4dd797a 100644
--- a/core/java/android/os/HandlerThread.java
+++ b/core/java/android/os/HandlerThread.java
@@ -71,23 +71,35 @@
     /**
      * This method returns the Looper associated with this thread. If this thread not been started
      * or for any reason isAlive() returns false, this method will return null. If this thread
-     * has been started, this method will block until the looper has been initialized.  
+     * has been started, this method will block until the looper has been initialized.
      * @return The looper.
      */
     public Looper getLooper() {
         if (!isAlive()) {
             return null;
         }
-        
+
+        boolean wasInterrupted = false;
+
         // If the thread has been started, wait until the looper has been created.
         synchronized (this) {
             while (isAlive() && mLooper == null) {
                 try {
                     wait();
                 } catch (InterruptedException e) {
+                    wasInterrupted = true;
                 }
             }
         }
+
+        /*
+         * We may need to restore the thread's interrupted flag, because it may
+         * have been cleared above since we eat InterruptedExceptions
+         */
+        if (wasInterrupted) {
+            Thread.currentThread().interrupt();
+        }
+
         return mLooper;
     }
 
diff --git a/core/java/android/os/IBinder.java b/core/java/android/os/IBinder.java
index 486ec2a..8a8a6af 100644
--- a/core/java/android/os/IBinder.java
+++ b/core/java/android/os/IBinder.java
@@ -313,13 +313,16 @@
      * then the given {@link DeathRecipient}'s
      * {@link DeathRecipient#binderDied DeathRecipient.binderDied()} method
      * will be called.
-     * 
+     *
+     * <p>This will automatically be unlinked when all references to the linked
+     * binder proxy are dropped.</p>
+     *
      * <p>You will only receive death notifications for remote binders,
-     * as local binders by definition can't die without you dying as well.
-     * 
+     * as local binders by definition can't die without you dying as well.</p>
+     *
      * @throws RemoteException if the target IBinder's
      * process has already died.
-     * 
+     *
      * @see #unlinkToDeath
      */
     public void linkToDeath(@NonNull DeathRecipient recipient, int flags)
diff --git a/core/java/android/os/MessageQueue.java b/core/java/android/os/MessageQueue.java
index 1a3cf2d..7213b06 100644
--- a/core/java/android/os/MessageQueue.java
+++ b/core/java/android/os/MessageQueue.java
@@ -726,7 +726,7 @@
                 Message n = p.next;
                 if (n != null) {
                     if (n.target == h && n.what == what
-                            && (object == null || object.equals(n.obj))) {
+                        && (object == null || object.equals(n.obj))) {
                         Message nn = n.next;
                         n.recycleUnchecked();
                         p.next = nn;
@@ -794,7 +794,7 @@
                 Message n = p.next;
                 if (n != null) {
                     if (n.target == h && n.callback == r
-                            && (object == null || object.equals(n.obj))) {
+                        && (object == null || object.equals(n.obj))) {
                         Message nn = n.next;
                         n.recycleUnchecked();
                         p.next = nn;
diff --git a/core/java/android/os/Parcel.java b/core/java/android/os/Parcel.java
index e5bab6f..7b82b1a 100644
--- a/core/java/android/os/Parcel.java
+++ b/core/java/android/os/Parcel.java
@@ -3358,15 +3358,15 @@
         } catch (IllegalAccessException e) {
             Log.e(TAG, "Illegal access when unmarshalling: " + name, e);
             throw new BadParcelableException(
-                    "IllegalAccessException when unmarshalling: " + name);
+                    "IllegalAccessException when unmarshalling: " + name, e);
         } catch (ClassNotFoundException e) {
             Log.e(TAG, "Class not found when unmarshalling: " + name, e);
             throw new BadParcelableException(
-                    "ClassNotFoundException when unmarshalling: " + name);
+                    "ClassNotFoundException when unmarshalling: " + name, e);
         } catch (NoSuchFieldException e) {
             throw new BadParcelableException("Parcelable protocol requires a "
                     + "Parcelable.Creator object called "
-                    + "CREATOR on class " + name);
+                    + "CREATOR on class " + name, e);
         }
         if (creator == null) {
             throw new BadParcelableException("Parcelable protocol requires a "
diff --git a/core/java/android/os/Parcelable.java b/core/java/android/os/Parcelable.java
index 6632ca5..9b360ed 100644
--- a/core/java/android/os/Parcelable.java
+++ b/core/java/android/os/Parcelable.java
@@ -118,7 +118,21 @@
      * by this Parcelable object instance.
      */
     public @ContentsFlags int describeContents();
-    
+
+    /**
+     * 'Stable' means this parcelable is guaranteed to be stable for multiple years.
+     * It must be guaranteed by setting stability field in aidl_interface,
+     * OR explicitly override this method from @JavaOnlyStableParcelable marked Parcelable.
+     * WARNING: isStable() is only expected to be overridden by auto-generated code,
+     * OR @JavaOnlyStableParcelable marked Parcelable only if there is guaranteed to
+     * be only once copy of the parcelable on the system.
+     * @return true if this parcelable is stable.
+     * @hide
+     */
+    default boolean isStable() {
+        return false;
+    }
+
     /**
      * Flatten this object in to a Parcel.
      * 
diff --git a/core/java/android/os/ParcelableHolder.java b/core/java/android/os/ParcelableHolder.java
new file mode 100644
index 0000000..c37a2ff
--- /dev/null
+++ b/core/java/android/os/ParcelableHolder.java
@@ -0,0 +1,177 @@
+/*
+ * Copyright (C) 2020 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.os;
+
+import android.annotation.NonNull;
+import android.annotation.Nullable;
+import android.util.MathUtils;
+
+/**
+ * Parcelable containing the other Parcelable object.
+ * @hide
+ */
+public final class ParcelableHolder implements Parcelable {
+    /**
+     * This is set by {@link #setParcelable}.
+     * {@link #mParcelable} and {@link #mParcel} are mutually exclusive
+     * if {@link ParcelableHolder} contains value, otherwise, both are null.
+     */
+    private Parcelable mParcelable;
+    /**
+     * This is set by {@link #readFromParcel}.
+     * {@link #mParcelable} and {@link #mParcel} are mutually exclusive
+     * if {@link ParcelableHolder} contains value, otherwise, both are null.
+     */
+    private Parcel mParcel;
+    private boolean mIsStable = false;
+
+    public ParcelableHolder(boolean isStable) {
+        mIsStable = isStable;
+    }
+
+    private ParcelableHolder() {
+
+    }
+
+    /**
+     * {@link ParcelableHolder}'s stability is determined by the parcelable
+     * which contains this ParcelableHolder.
+     * For more detail refer to {@link Parcelable#isStable}.
+     */
+    @Override
+    public boolean isStable() {
+        return mIsStable;
+    }
+
+    @NonNull
+    public static final Parcelable.Creator<ParcelableHolder> CREATOR =
+            new Parcelable.Creator<ParcelableHolder>() {
+                @NonNull
+                @Override
+                public ParcelableHolder createFromParcel(@NonNull Parcel parcel) {
+                    ParcelableHolder parcelable = new ParcelableHolder();
+                    parcelable.readFromParcel(parcel);
+                    return parcelable;
+                }
+
+                @NonNull
+                @Override
+                public ParcelableHolder[] newArray(int size) {
+                    return new ParcelableHolder[size];
+                }
+            };
+
+
+    /**
+     * Write a parcelable into ParcelableHolder, the previous parcelable will be removed.
+     * @return {@code false} if the parcelable's stability is more unstable ParcelableHolder.
+     */
+    public synchronized boolean setParcelable(@Nullable Parcelable p) {
+        if (p != null && this.isStable() && !p.isStable()) {
+            return false;
+        }
+        mParcelable = p;
+        if (mParcel != null) {
+            mParcel.recycle();
+            mParcel = null;
+        }
+        return true;
+    }
+
+    /**
+     * @return the parcelable that was written by {@link #setParcelable} or {@link #readFromParcel},
+     *         or {@code null} if the parcelable has not been written, or T is different from
+     *         the type written by (@link #setParcelable}.
+     */
+    @Nullable
+    public synchronized <T extends Parcelable> T getParcelable(@NonNull Class<T> clazz) {
+        if (mParcel == null) {
+            if (!clazz.isInstance(mParcelable)) {
+                return null;
+            }
+            return (T) mParcelable;
+        }
+
+        mParcel.setDataPosition(0);
+
+        T parcelable = mParcel.readParcelable(clazz.getClassLoader());
+        if (!clazz.isInstance(parcelable)) {
+            return null;
+        }
+        mParcelable = parcelable;
+
+        mParcel.recycle();
+        mParcel = null;
+        return parcelable;
+    }
+
+    /**
+     * Read ParcelableHolder from a parcel.
+     */
+    public synchronized void readFromParcel(@NonNull Parcel parcel) {
+        this.mIsStable = parcel.readBoolean();
+
+        mParcelable = null;
+
+        if (mParcel == null) {
+            mParcel = Parcel.obtain();
+        }
+        mParcel.setDataPosition(0);
+        mParcel.setDataSize(0);
+
+        int dataSize = parcel.readInt();
+        if (dataSize < 0) {
+            throw new IllegalArgumentException("dataSize from parcel is negative");
+        }
+        int dataStartPos = parcel.dataPosition();
+
+        mParcel.appendFrom(parcel, dataStartPos, dataSize);
+        parcel.setDataPosition(MathUtils.addOrThrow(dataStartPos, dataSize));
+    }
+
+    @Override
+    public synchronized void writeToParcel(@NonNull Parcel parcel, int flags) {
+        parcel.writeBoolean(this.mIsStable);
+
+        if (mParcel != null) {
+            parcel.writeInt(mParcel.dataSize());
+            parcel.appendFrom(mParcel, 0, mParcel.dataSize());
+            return;
+        }
+
+        int sizePos = parcel.dataPosition();
+        parcel.writeInt(0);
+        int dataStartPos = parcel.dataPosition();
+        parcel.writeParcelable(mParcelable, 0);
+        int dataSize = parcel.dataPosition() - dataStartPos;
+
+        parcel.setDataPosition(sizePos);
+        parcel.writeInt(dataSize);
+        parcel.setDataPosition(MathUtils.addOrThrow(parcel.dataPosition(), dataSize));
+    }
+
+    @Override
+    public synchronized int describeContents() {
+        if (mParcel != null) {
+            return mParcel.hasFileDescriptors() ? Parcelable.CONTENTS_FILE_DESCRIPTOR : 0;
+        }
+        if (mParcelable != null) {
+            return mParcelable.describeContents();
+        }
+        return 0;
+    }
+}
diff --git a/core/java/android/os/Registrant.java b/core/java/android/os/Registrant.java
index d6afd04..bde7ec1 100644
--- a/core/java/android/os/Registrant.java
+++ b/core/java/android/os/Registrant.java
@@ -46,7 +46,7 @@
     {
         internalNotifyRegistrant (null, null);
     }
-    
+
     @UnsupportedAppUsage
     public void
     notifyResult(Object result)
@@ -81,9 +81,7 @@
             Message msg = Message.obtain();
 
             msg.what = what;
-            
             msg.obj = new AsyncResult(userObj, result, exception);
-            
             h.sendMessage(msg);
         }
     }
@@ -126,4 +124,3 @@
     int             what;
     Object          userObj;
 }
-
diff --git a/core/java/android/os/RegistrantList.java b/core/java/android/os/RegistrantList.java
index 8175002..b36734b 100644
--- a/core/java/android/os/RegistrantList.java
+++ b/core/java/android/os/RegistrantList.java
@@ -42,9 +42,9 @@
     {
         // if the handler is already in the registrant list, remove it
         remove(h);
-        add(new Registrant(h, what, obj));        
+        add(new Registrant(h, what, obj));
     }
-    
+
     @UnsupportedAppUsage
     public synchronized void
     add(Registrant r)
@@ -59,7 +59,7 @@
     {
         for (int i = registrants.size() - 1; i >= 0 ; i--) {
             Registrant  r = (Registrant) registrants.get(i);
-            
+
             if (r.refH == null) {
                 registrants.remove(i);
             }
@@ -92,7 +92,7 @@
             r.internalNotifyRegistrant(result, exception);
        }
     }
-    
+
     @UnsupportedAppUsage
     public /*synchronized*/ void
     notifyRegistrants()
@@ -113,14 +113,14 @@
         internalNotifyRegistrants (result, null);
     }
 
-    
+
     @UnsupportedAppUsage
     public /*synchronized*/ void
     notifyRegistrants(AsyncResult ar)
     {
         internalNotifyRegistrants(ar.result, ar.exception);
     }
-    
+
     @UnsupportedAppUsage
     public synchronized void
     remove(Handler h)
diff --git a/core/java/android/provider/DeviceConfig.java b/core/java/android/provider/DeviceConfig.java
index e86aa62..b45a1eb 100644
--- a/core/java/android/provider/DeviceConfig.java
+++ b/core/java/android/provider/DeviceConfig.java
@@ -119,6 +119,14 @@
     public static final String NAMESPACE_BLOBSTORE = "blobstore";
 
     /**
+     * Namespace for all Bluetooth related features.
+     *
+     * @hide
+     */
+    @SystemApi
+    public static final String NAMESPACE_BLUETOOTH = "bluetooth";
+
+    /**
      * Namespace for all networking connectivity related features.
      *
      * @hide
diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java
index 64d9c9d..9ee8898 100755
--- a/core/java/android/provider/Settings.java
+++ b/core/java/android/provider/Settings.java
@@ -11618,17 +11618,6 @@
         public static final String ALWAYS_ON_DISPLAY_CONSTANTS = "always_on_display_constants";
 
         /**
-        * System VDSO global setting. This links to the "sys.vdso" system property.
-        * The following values are supported:
-        * false  -> both 32 and 64 bit vdso disabled
-        * 32     -> 32 bit vdso enabled
-        * 64     -> 64 bit vdso enabled
-        * Any other value defaults to both 32 bit and 64 bit true.
-        * @hide
-        */
-        public static final String SYS_VDSO = "sys_vdso";
-
-        /**
         * UidCpuPower global setting. This links the sys.uidcpupower system property.
         * The following values are supported:
         * 0 -> /proc/uid_cpupower/* are disabled
diff --git a/core/java/android/telephony/PhoneStateListener.java b/core/java/android/telephony/PhoneStateListener.java
index 4adcd69..a6e6d05 100644
--- a/core/java/android/telephony/PhoneStateListener.java
+++ b/core/java/android/telephony/PhoneStateListener.java
@@ -780,7 +780,8 @@
      *
      */
     @RequiresPermission((android.Manifest.permission.READ_PRECISE_PHONE_STATE))
-    public void onCallDisconnectCauseChanged(int disconnectCause, int preciseDisconnectCause) {
+    public void onCallDisconnectCauseChanged(@Annotation.DisconnectCauses int disconnectCause,
+            int preciseDisconnectCause) {
         // default implementation empty
     }
 
diff --git a/core/java/android/telephony/TelephonyRegistryManager.java b/core/java/android/telephony/TelephonyRegistryManager.java
index 0854452..8ab120f 100644
--- a/core/java/android/telephony/TelephonyRegistryManager.java
+++ b/core/java/android/telephony/TelephonyRegistryManager.java
@@ -18,7 +18,6 @@
 import android.annotation.NonNull;
 import android.annotation.Nullable;
 import android.annotation.RequiresPermission;
-import android.annotation.TestApi;
 import android.compat.Compatibility;
 import android.compat.annotation.ChangeId;
 import android.compat.annotation.EnabledAfter;
@@ -283,7 +282,6 @@
      * @param incomingNumber incoming phone number.
      * @hide
      */
-    @TestApi
     @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE)
     public void notifyCallStateChangedForAllSubscriptions(@CallState int state,
             @Nullable String incomingNumber) {
diff --git a/core/java/android/text/format/Time.java b/core/java/android/text/format/Time.java
index 49cebc1..80c8ec8 100644
--- a/core/java/android/text/format/Time.java
+++ b/core/java/android/text/format/Time.java
@@ -18,10 +18,9 @@
 
 import android.util.TimeFormatException;
 
-import libcore.timezone.ZoneInfoDb;
-import libcore.util.ZoneInfo;
+import com.android.i18n.timezone.ZoneInfoData;
+import com.android.i18n.timezone.ZoneInfoDb;
 
-import java.io.IOException;
 import java.util.Locale;
 import java.util.TimeZone;
 
@@ -1071,15 +1070,15 @@
      * to the enclosing object, but others do not: thus separate state is retained.
      */
     private static class TimeCalculator {
-        public final ZoneInfo.WallTime wallTime;
+        public final ZoneInfoData.WallTime wallTime;
         public String timezone;
 
         // Information about the current timezone.
-        private ZoneInfo zoneInfo;
+        private ZoneInfoData mZoneInfoData;
 
         public TimeCalculator(String timezoneId) {
-            this.zoneInfo = lookupZoneInfo(timezoneId);
-            this.wallTime = new ZoneInfo.WallTime();
+            this.mZoneInfoData = lookupZoneInfoData(timezoneId);
+            this.wallTime = new ZoneInfoData.WallTime();
         }
 
         public long toMillis(boolean ignoreDst) {
@@ -1087,7 +1086,7 @@
                 wallTime.setIsDst(-1);
             }
 
-            int r = wallTime.mktime(zoneInfo);
+            int r = wallTime.mktime(mZoneInfoData);
             if (r == -1) {
                 return -1;
             }
@@ -1099,7 +1098,7 @@
             int intSeconds = (int) (millis / 1000);
 
             updateZoneInfoFromTimeZone();
-            wallTime.localtime(intSeconds, zoneInfo);
+            wallTime.localtime(intSeconds, mZoneInfoData);
         }
 
         public String format(String format) {
@@ -1107,36 +1106,31 @@
                 format = "%c";
             }
             TimeFormatter formatter = new TimeFormatter();
-            return formatter.format(format, wallTime, zoneInfo);
+            return formatter.format(format, wallTime, mZoneInfoData);
         }
 
         private void updateZoneInfoFromTimeZone() {
-            if (!zoneInfo.getID().equals(timezone)) {
-                this.zoneInfo = lookupZoneInfo(timezone);
+            if (!mZoneInfoData.getID().equals(timezone)) {
+                this.mZoneInfoData = lookupZoneInfoData(timezone);
             }
         }
 
-        private static ZoneInfo lookupZoneInfo(String timezoneId) {
-            try {
-                ZoneInfo zoneInfo = ZoneInfoDb.getInstance().makeTimeZone(timezoneId);
-                if (zoneInfo == null) {
-                    zoneInfo = ZoneInfoDb.getInstance().makeTimeZone("GMT");
-                }
-                if (zoneInfo == null) {
-                    throw new AssertionError("GMT not found: \"" + timezoneId + "\"");
-                }
-                return zoneInfo;
-            } catch (IOException e) {
-                // This should not ever be thrown.
-                throw new AssertionError("Error loading timezone: \"" + timezoneId + "\"", e);
+        private static ZoneInfoData lookupZoneInfoData(String timezoneId) {
+            ZoneInfoData zoneInfoData = ZoneInfoDb.getInstance().makeZoneInfoData(timezoneId);
+            if (zoneInfoData == null) {
+                zoneInfoData = ZoneInfoDb.getInstance().makeZoneInfoData("GMT");
             }
+            if (zoneInfoData == null) {
+                throw new AssertionError("GMT not found: \"" + timezoneId + "\"");
+            }
+            return zoneInfoData;
         }
 
         public void switchTimeZone(String timezone) {
-            int seconds = wallTime.mktime(zoneInfo);
+            int seconds = wallTime.mktime(mZoneInfoData);
             this.timezone = timezone;
             updateZoneInfoFromTimeZone();
-            wallTime.localtime(seconds, zoneInfo);
+            wallTime.localtime(seconds, mZoneInfoData);
         }
 
         public String format2445(boolean hasTime) {
diff --git a/core/java/android/text/format/TimeFormatter.java b/core/java/android/text/format/TimeFormatter.java
index f7fd89d..cd541f2 100644
--- a/core/java/android/text/format/TimeFormatter.java
+++ b/core/java/android/text/format/TimeFormatter.java
@@ -22,8 +22,9 @@
 
 import android.content.res.Resources;
 
+import com.android.i18n.timezone.ZoneInfoData;
+
 import libcore.icu.LocaleData;
-import libcore.util.ZoneInfo;
 
 import java.nio.CharBuffer;
 import java.time.Instant;
@@ -94,8 +95,8 @@
      * incorrect digit localization behavior.
      */
     String formatMillisWithFixedFormat(long timeMillis) {
-        // This method is deliberately not a general purpose replacement for
-        // format(String, ZoneInfo.WallTime, ZoneInfo): It hard-codes the pattern used; many of the
+        // This method is deliberately not a general purpose replacement for format(String,
+        // ZoneInfoData.WallTime, ZoneInfoData): It hard-codes the pattern used; many of the
         // pattern characters supported by Time.format() have unusual behavior which would make
         // using java.time.format or similar packages difficult. It would be a lot of work to share
         // behavior and many internal Android usecases can be covered by this common pattern
@@ -144,7 +145,8 @@
     /**
      * Format the specified {@code wallTime} using {@code pattern}. The output is returned.
      */
-    public String format(String pattern, ZoneInfo.WallTime wallTime, ZoneInfo zoneInfo) {
+    public String format(String pattern, ZoneInfoData.WallTime wallTime,
+            ZoneInfoData zoneInfoData) {
         try {
             StringBuilder stringBuilder = new StringBuilder();
 
@@ -153,7 +155,7 @@
             // and locale sensitive strings are output directly using outputBuilder.
             numberFormatter = new Formatter(stringBuilder, Locale.US);
 
-            formatInternal(pattern, wallTime, zoneInfo);
+            formatInternal(pattern, wallTime, zoneInfoData);
             String result = stringBuilder.toString();
             // The localizeDigits() behavior is the source of a bug since some formats are defined
             // as being in ASCII and not localized.
@@ -186,13 +188,14 @@
      * Format the specified {@code wallTime} using {@code pattern}. The output is written to
      * {@link #outputBuilder}.
      */
-    private void formatInternal(String pattern, ZoneInfo.WallTime wallTime, ZoneInfo zoneInfo) {
+    private void formatInternal(String pattern, ZoneInfoData.WallTime wallTime,
+            ZoneInfoData zoneInfoData) {
         CharBuffer formatBuffer = CharBuffer.wrap(pattern);
         while (formatBuffer.remaining() > 0) {
             boolean outputCurrentChar = true;
             char currentChar = formatBuffer.get(formatBuffer.position());
             if (currentChar == '%') {
-                outputCurrentChar = handleToken(formatBuffer, wallTime, zoneInfo);
+                outputCurrentChar = handleToken(formatBuffer, wallTime, zoneInfoData);
             }
             if (outputCurrentChar) {
                 outputBuilder.append(formatBuffer.get(formatBuffer.position()));
@@ -201,8 +204,8 @@
         }
     }
 
-    private boolean handleToken(CharBuffer formatBuffer, ZoneInfo.WallTime wallTime,
-            ZoneInfo zoneInfo) {
+    private boolean handleToken(CharBuffer formatBuffer, ZoneInfoData.WallTime wallTime,
+            ZoneInfoData zoneInfoData) {
 
         // The char at formatBuffer.position() is expected to be '%' at this point.
         int modifier = 0;
@@ -247,10 +250,10 @@
                     outputYear(wallTime.getYear(), true, false, modifier);
                     return false;
                 case 'c':
-                    formatInternal(dateTimeFormat, wallTime, zoneInfo);
+                    formatInternal(dateTimeFormat, wallTime, zoneInfoData);
                     return false;
                 case 'D':
-                    formatInternal("%m/%d/%y", wallTime, zoneInfo);
+                    formatInternal("%m/%d/%y", wallTime, zoneInfoData);
                     return false;
                 case 'd':
                     numberFormatter.format(getFormat(modifier, "%02d", "%2d", "%d", "%02d"),
@@ -272,7 +275,7 @@
                             wallTime.getMonthDay());
                     return false;
                 case 'F':
-                    formatInternal("%Y-%m-%d", wallTime, zoneInfo);
+                    formatInternal("%Y-%m-%d", wallTime, zoneInfoData);
                     return false;
                 case 'H':
                     numberFormatter.format(getFormat(modifier, "%02d", "%2d", "%d", "%02d"),
@@ -315,21 +318,21 @@
                             : localeData.amPm[0], FORCE_LOWER_CASE);
                     return false;
                 case 'R':
-                    formatInternal("%H:%M", wallTime, zoneInfo);
+                    formatInternal("%H:%M", wallTime, zoneInfoData);
                     return false;
                 case 'r':
-                    formatInternal("%I:%M:%S %p", wallTime, zoneInfo);
+                    formatInternal("%I:%M:%S %p", wallTime, zoneInfoData);
                     return false;
                 case 'S':
                     numberFormatter.format(getFormat(modifier, "%02d", "%2d", "%d", "%02d"),
                             wallTime.getSecond());
                     return false;
                 case 's':
-                    int timeInSeconds = wallTime.mktime(zoneInfo);
+                    int timeInSeconds = wallTime.mktime(zoneInfoData);
                     outputBuilder.append(Integer.toString(timeInSeconds));
                     return false;
                 case 'T':
-                    formatInternal("%H:%M:%S", wallTime, zoneInfo);
+                    formatInternal("%H:%M:%S", wallTime, zoneInfoData);
                     return false;
                 case 't':
                     outputBuilder.append('\t');
@@ -383,7 +386,7 @@
                     return false;
                 }
                 case 'v':
-                    formatInternal("%e-%b-%Y", wallTime, zoneInfo);
+                    formatInternal("%e-%b-%Y", wallTime, zoneInfoData);
                     return false;
                 case 'W':
                     int n = (wallTime.getYearDay() + DAYSPERWEEK - (
@@ -395,10 +398,10 @@
                     numberFormatter.format("%d", wallTime.getWeekDay());
                     return false;
                 case 'X':
-                    formatInternal(timeOnlyFormat, wallTime, zoneInfo);
+                    formatInternal(timeOnlyFormat, wallTime, zoneInfoData);
                     return false;
                 case 'x':
-                    formatInternal(dateOnlyFormat, wallTime, zoneInfo);
+                    formatInternal(dateOnlyFormat, wallTime, zoneInfoData);
                     return false;
                 case 'y':
                     outputYear(wallTime.getYear(), false, true, modifier);
@@ -411,7 +414,8 @@
                         return false;
                     }
                     boolean isDst = wallTime.getIsDst() != 0;
-                    modifyAndAppend(zoneInfo.getDisplayName(isDst, TimeZone.SHORT), modifier);
+                    modifyAndAppend(TimeZone.getTimeZone(zoneInfoData.getID())
+                            .getDisplayName(isDst, TimeZone.SHORT), modifier);
                     return false;
                 case 'z': {
                     if (wallTime.getIsDst() < 0) {
@@ -432,7 +436,7 @@
                     return false;
                 }
                 case '+':
-                    formatInternal("%a %b %e %H:%M:%S %Z %Y", wallTime, zoneInfo);
+                    formatInternal("%a %b %e %H:%M:%S %Z %Y", wallTime, zoneInfoData);
                     return false;
                 case '%':
                     // If conversion char is undefined, behavior is undefined. Print out the
diff --git a/core/java/android/text/util/Linkify.java b/core/java/android/text/util/Linkify.java
index 82c7ea7..a7ddfa9 100644
--- a/core/java/android/text/util/Linkify.java
+++ b/core/java/android/text/util/Linkify.java
@@ -304,7 +304,7 @@
 
         if ((mask & WEB_URLS) != 0) {
             gatherLinks(links, text, Patterns.AUTOLINK_WEB_URL,
-                new String[] { "http://", "https://", "rtsp://" },
+                new String[] { "http://", "https://", "rtsp://", "ftp://" },
                 sUrlMatchFilter, null);
         }
 
diff --git a/core/java/android/timezone/CountryTimeZones.java b/core/java/android/timezone/CountryTimeZones.java
index a8db50e..44d1402 100644
--- a/core/java/android/timezone/CountryTimeZones.java
+++ b/core/java/android/timezone/CountryTimeZones.java
@@ -40,9 +40,9 @@
     public static final class TimeZoneMapping {
 
         @NonNull
-        private libcore.timezone.CountryTimeZones.TimeZoneMapping mDelegate;
+        private com.android.i18n.timezone.CountryTimeZones.TimeZoneMapping mDelegate;
 
-        TimeZoneMapping(libcore.timezone.CountryTimeZones.TimeZoneMapping delegate) {
+        TimeZoneMapping(com.android.i18n.timezone.CountryTimeZones.TimeZoneMapping delegate) {
             this.mDelegate = Objects.requireNonNull(delegate);
         }
 
@@ -147,9 +147,9 @@
     }
 
     @NonNull
-    private final libcore.timezone.CountryTimeZones mDelegate;
+    private final com.android.i18n.timezone.CountryTimeZones mDelegate;
 
-    CountryTimeZones(libcore.timezone.CountryTimeZones delegate) {
+    CountryTimeZones(com.android.i18n.timezone.CountryTimeZones delegate) {
         mDelegate = delegate;
     }
 
@@ -158,7 +158,7 @@
      * supplied.
      */
     public boolean matchesCountryCode(@NonNull String countryIso) {
-        return mDelegate.isForCountryCode(countryIso);
+        return mDelegate.matchesCountryCode(countryIso);
     }
 
     /**
@@ -221,7 +221,7 @@
     @Nullable
     public OffsetResult lookupByOffsetWithBias(long whenMillis, @Nullable TimeZone bias,
             int totalOffsetMillis, boolean isDst) {
-        libcore.timezone.CountryTimeZones.OffsetResult delegateOffsetResult =
+        com.android.i18n.timezone.CountryTimeZones.OffsetResult delegateOffsetResult =
                 mDelegate.lookupByOffsetWithBias(
                         whenMillis, bias, totalOffsetMillis, isDst);
         return delegateOffsetResult == null ? null :
@@ -244,7 +244,7 @@
     @Nullable
     public OffsetResult lookupByOffsetWithBias(long whenMillis, @Nullable TimeZone bias,
             int totalOffsetMillis) {
-        libcore.timezone.CountryTimeZones.OffsetResult delegateOffsetResult =
+        com.android.i18n.timezone.CountryTimeZones.OffsetResult delegateOffsetResult =
                 mDelegate.lookupByOffsetWithBias(whenMillis, bias, totalOffsetMillis);
         return delegateOffsetResult == null ? null :
                 new OffsetResult(
@@ -260,11 +260,12 @@
      */
     @NonNull
     public List<TimeZoneMapping> getEffectiveTimeZoneMappingsAt(long whenMillis) {
-        List<libcore.timezone.CountryTimeZones.TimeZoneMapping> delegateList =
+        List<com.android.i18n.timezone.CountryTimeZones.TimeZoneMapping> delegateList =
                 mDelegate.getEffectiveTimeZoneMappingsAt(whenMillis);
 
         List<TimeZoneMapping> toReturn = new ArrayList<>(delegateList.size());
-        for (libcore.timezone.CountryTimeZones.TimeZoneMapping delegateMapping : delegateList) {
+        for (com.android.i18n.timezone.CountryTimeZones.TimeZoneMapping delegateMapping
+                : delegateList) {
             toReturn.add(new TimeZoneMapping(delegateMapping));
         }
         return Collections.unmodifiableList(toReturn);
diff --git a/core/java/android/timezone/TelephonyLookup.java b/core/java/android/timezone/TelephonyLookup.java
index a4c3fbd..c97bf28 100644
--- a/core/java/android/timezone/TelephonyLookup.java
+++ b/core/java/android/timezone/TelephonyLookup.java
@@ -41,16 +41,17 @@
     public static TelephonyLookup getInstance() {
         synchronized (sLock) {
             if (sInstance == null) {
-                sInstance = new TelephonyLookup(libcore.timezone.TelephonyLookup.getInstance());
+                sInstance = new TelephonyLookup(com.android.i18n.timezone.TelephonyLookup
+                    .getInstance());
             }
             return sInstance;
         }
     }
 
     @NonNull
-    private final libcore.timezone.TelephonyLookup mDelegate;
+    private final com.android.i18n.timezone.TelephonyLookup mDelegate;
 
-    private TelephonyLookup(@NonNull libcore.timezone.TelephonyLookup delegate) {
+    private TelephonyLookup(@NonNull com.android.i18n.timezone.TelephonyLookup delegate) {
         mDelegate = Objects.requireNonNull(delegate);
     }
 
@@ -60,7 +61,7 @@
      */
     @Nullable
     public TelephonyNetworkFinder getTelephonyNetworkFinder() {
-        libcore.timezone.TelephonyNetworkFinder telephonyNetworkFinderDelegate =
+        com.android.i18n.timezone.TelephonyNetworkFinder telephonyNetworkFinderDelegate =
                 mDelegate.getTelephonyNetworkFinder();
         return telephonyNetworkFinderDelegate != null
                 ? new TelephonyNetworkFinder(telephonyNetworkFinderDelegate) : null;
diff --git a/core/java/android/timezone/TelephonyNetwork.java b/core/java/android/timezone/TelephonyNetwork.java
index 823cd25..3b65c6f 100644
--- a/core/java/android/timezone/TelephonyNetwork.java
+++ b/core/java/android/timezone/TelephonyNetwork.java
@@ -28,9 +28,9 @@
 public final class TelephonyNetwork {
 
     @NonNull
-    private final libcore.timezone.TelephonyNetwork mDelegate;
+    private final com.android.i18n.timezone.TelephonyNetwork mDelegate;
 
-    TelephonyNetwork(@NonNull libcore.timezone.TelephonyNetwork delegate) {
+    TelephonyNetwork(@NonNull com.android.i18n.timezone.TelephonyNetwork delegate) {
         mDelegate = Objects.requireNonNull(delegate);
     }
 
diff --git a/core/java/android/timezone/TelephonyNetworkFinder.java b/core/java/android/timezone/TelephonyNetworkFinder.java
index 4bfeff8..c69ddf8 100644
--- a/core/java/android/timezone/TelephonyNetworkFinder.java
+++ b/core/java/android/timezone/TelephonyNetworkFinder.java
@@ -29,9 +29,9 @@
 public final class TelephonyNetworkFinder {
 
     @NonNull
-    private final libcore.timezone.TelephonyNetworkFinder mDelegate;
+    private final com.android.i18n.timezone.TelephonyNetworkFinder mDelegate;
 
-    TelephonyNetworkFinder(libcore.timezone.TelephonyNetworkFinder delegate) {
+    TelephonyNetworkFinder(com.android.i18n.timezone.TelephonyNetworkFinder delegate) {
         mDelegate = Objects.requireNonNull(delegate);
     }
 
@@ -45,7 +45,7 @@
         Objects.requireNonNull(mcc);
         Objects.requireNonNull(mnc);
 
-        libcore.timezone.TelephonyNetwork telephonyNetworkDelegate =
+        com.android.i18n.timezone.TelephonyNetwork telephonyNetworkDelegate =
                 mDelegate.findNetworkByMccMnc(mcc, mnc);
         return telephonyNetworkDelegate != null
                 ? new TelephonyNetwork(telephonyNetworkDelegate) : null;
diff --git a/core/java/android/timezone/TimeZoneFinder.java b/core/java/android/timezone/TimeZoneFinder.java
index 03f5013..bf4275f 100644
--- a/core/java/android/timezone/TimeZoneFinder.java
+++ b/core/java/android/timezone/TimeZoneFinder.java
@@ -41,16 +41,17 @@
     public static TimeZoneFinder getInstance() {
         synchronized (sLock) {
             if (sInstance == null) {
-                sInstance = new TimeZoneFinder(libcore.timezone.TimeZoneFinder.getInstance());
+                sInstance = new TimeZoneFinder(com.android.i18n.timezone.TimeZoneFinder
+                    .getInstance());
             }
         }
         return sInstance;
     }
 
     @NonNull
-    private final libcore.timezone.TimeZoneFinder mDelegate;
+    private final com.android.i18n.timezone.TimeZoneFinder mDelegate;
 
-    private TimeZoneFinder(@NonNull libcore.timezone.TimeZoneFinder delegate) {
+    private TimeZoneFinder(@NonNull com.android.i18n.timezone.TimeZoneFinder delegate) {
         mDelegate = Objects.requireNonNull(delegate);
     }
 
@@ -70,7 +71,8 @@
      */
     @Nullable
     public CountryTimeZones lookupCountryTimeZones(@NonNull String countryIso) {
-        libcore.timezone.CountryTimeZones delegate = mDelegate.lookupCountryTimeZones(countryIso);
+        com.android.i18n.timezone.CountryTimeZones delegate = mDelegate
+                .lookupCountryTimeZones(countryIso);
         return delegate == null ? null : new CountryTimeZones(delegate);
     }
 }
diff --git a/core/java/android/timezone/TzDataSetVersion.java b/core/java/android/timezone/TzDataSetVersion.java
index f993012..e1fb932 100644
--- a/core/java/android/timezone/TzDataSetVersion.java
+++ b/core/java/android/timezone/TzDataSetVersion.java
@@ -50,14 +50,14 @@
      * Returns the major tz data format version supported by this device.
      */
     public static int currentFormatMajorVersion() {
-        return libcore.timezone.TzDataSetVersion.currentFormatMajorVersion();
+        return com.android.i18n.timezone.TzDataSetVersion.currentFormatMajorVersion();
     }
 
     /**
      * Returns the minor tz data format version supported by this device.
      */
     public static int currentFormatMinorVersion() {
-        return libcore.timezone.TzDataSetVersion.currentFormatMinorVersion();
+        return com.android.i18n.timezone.TzDataSetVersion.currentFormatMinorVersion();
     }
 
     /**
@@ -65,7 +65,7 @@
      * with the current system image, and set of active modules.
      */
     public static boolean isCompatibleWithThisDevice(TzDataSetVersion tzDataSetVersion) {
-        return libcore.timezone.TzDataSetVersion.isCompatibleWithThisDevice(
+        return com.android.i18n.timezone.TzDataSetVersion.isCompatibleWithThisDevice(
                 tzDataSetVersion.mDelegate);
     }
 
@@ -76,8 +76,8 @@
     public static TzDataSetVersion read() throws IOException, TzDataSetException {
         try {
             return new TzDataSetVersion(
-                    libcore.timezone.TzDataSetVersion.readTimeZoneModuleVersion());
-        } catch (libcore.timezone.TzDataSetVersion.TzDataSetException e) {
+                    com.android.i18n.timezone.TzDataSetVersion.readTimeZoneModuleVersion());
+        } catch (com.android.i18n.timezone.TzDataSetVersion.TzDataSetException e) {
             throw new TzDataSetException(e.getMessage(), e);
         }
     }
@@ -100,9 +100,9 @@
     }
 
     @NonNull
-    private final libcore.timezone.TzDataSetVersion mDelegate;
+    private final com.android.i18n.timezone.TzDataSetVersion mDelegate;
 
-    private TzDataSetVersion(@NonNull libcore.timezone.TzDataSetVersion delegate) {
+    private TzDataSetVersion(@NonNull com.android.i18n.timezone.TzDataSetVersion delegate) {
         mDelegate = Objects.requireNonNull(delegate);
     }
 
diff --git a/core/java/android/timezone/ZoneInfoDb.java b/core/java/android/timezone/ZoneInfoDb.java
index 9354a69..65d6ead 100644
--- a/core/java/android/timezone/ZoneInfoDb.java
+++ b/core/java/android/timezone/ZoneInfoDb.java
@@ -41,16 +41,16 @@
     public static ZoneInfoDb getInstance() {
         synchronized (sLock) {
             if (sInstance == null) {
-                sInstance = new ZoneInfoDb(libcore.timezone.ZoneInfoDb.getInstance());
+                sInstance = new ZoneInfoDb(com.android.i18n.timezone.ZoneInfoDb.getInstance());
             }
         }
         return sInstance;
     }
 
     @NonNull
-    private final libcore.timezone.ZoneInfoDb mDelegate;
+    private final com.android.i18n.timezone.ZoneInfoDb mDelegate;
 
-    private ZoneInfoDb(libcore.timezone.ZoneInfoDb delegate) {
+    private ZoneInfoDb(com.android.i18n.timezone.ZoneInfoDb delegate) {
         mDelegate = Objects.requireNonNull(delegate);
     }
 
diff --git a/core/java/android/util/Patterns.java b/core/java/android/util/Patterns.java
index 50cd7b1..7ad16ff 100644
--- a/core/java/android/util/Patterns.java
+++ b/core/java/android/util/Patterns.java
@@ -301,7 +301,7 @@
     private static final String DOMAIN_NAME_STR = "(" + HOST_NAME + "|" + IP_ADDRESS_STRING + ")";
     public static final Pattern DOMAIN_NAME = Pattern.compile(DOMAIN_NAME_STR);
 
-    private static final String PROTOCOL = "(?i:http|https|rtsp)://";
+    private static final String PROTOCOL = "(?i:http|https|rtsp|ftp)://";
 
     /* A word boundary or end of input.  This is to stop foo.sure from matching as foo.su */
     private static final String WORD_BOUNDARY = "(?:\\b|$|^)";
diff --git a/core/java/android/util/TimeUtils.java b/core/java/android/util/TimeUtils.java
index e8d3459..e0b8d52 100644
--- a/core/java/android/util/TimeUtils.java
+++ b/core/java/android/util/TimeUtils.java
@@ -23,10 +23,10 @@
 import android.os.Build;
 import android.os.SystemClock;
 
-import libcore.timezone.CountryTimeZones;
-import libcore.timezone.CountryTimeZones.TimeZoneMapping;
-import libcore.timezone.TimeZoneFinder;
-import libcore.timezone.ZoneInfoDb;
+import com.android.i18n.timezone.CountryTimeZones;
+import com.android.i18n.timezone.CountryTimeZones.TimeZoneMapping;
+import com.android.i18n.timezone.TimeZoneFinder;
+import com.android.i18n.timezone.ZoneInfoDb;
 
 import java.io.PrintWriter;
 import java.text.SimpleDateFormat;
diff --git a/core/java/android/view/FocusFinder.java b/core/java/android/view/FocusFinder.java
index 713cfb4..064bc69 100644
--- a/core/java/android/view/FocusFinder.java
+++ b/core/java/android/view/FocusFinder.java
@@ -311,6 +311,9 @@
         }
 
         final int count = focusables.size();
+        if (count < 2) {
+            return null;
+        }
         switch (direction) {
             case View.FOCUS_FORWARD:
                 return getNextFocusable(focused, focusables, count);
@@ -373,29 +376,29 @@
     }
 
     private static View getNextFocusable(View focused, ArrayList<View> focusables, int count) {
+        if (count < 2) {
+            return null;
+        }
         if (focused != null) {
             int position = focusables.lastIndexOf(focused);
             if (position >= 0 && position + 1 < count) {
                 return focusables.get(position + 1);
             }
         }
-        if (!focusables.isEmpty()) {
-            return focusables.get(0);
-        }
-        return null;
+        return focusables.get(0);
     }
 
     private static View getPreviousFocusable(View focused, ArrayList<View> focusables, int count) {
+        if (count < 2) {
+            return null;
+        }
         if (focused != null) {
             int position = focusables.indexOf(focused);
             if (position > 0) {
                 return focusables.get(position - 1);
             }
         }
-        if (!focusables.isEmpty()) {
-            return focusables.get(count - 1);
-        }
-        return null;
+        return focusables.get(count - 1);
     }
 
     private static View getNextKeyboardNavigationCluster(
diff --git a/core/java/android/view/Surface.java b/core/java/android/view/Surface.java
index 4e07a5f..b1d5520 100644
--- a/core/java/android/view/Surface.java
+++ b/core/java/android/view/Surface.java
@@ -221,12 +221,12 @@
     }
 
     /**
-     * Create a Surface assosciated with a given {@link SurfaceControl}. Buffers submitted to this
+     * Create a Surface associated with a given {@link SurfaceControl}. Buffers submitted to this
      * surface will be displayed by the system compositor according to the parameters
      * specified by the control. Multiple surfaces may be constructed from one SurfaceControl,
      * but only one can be connected (e.g. have an active EGL context) at a time.
      *
-     * @param from The SurfaceControl to assosciate this Surface with
+     * @param from The SurfaceControl to associate this Surface with
      */
     public Surface(@NonNull SurfaceControl from) {
         copyFrom(from);
diff --git a/core/java/android/view/SurfaceControl.java b/core/java/android/view/SurfaceControl.java
index 87b2f4b..6826253 100644
--- a/core/java/android/view/SurfaceControl.java
+++ b/core/java/android/view/SurfaceControl.java
@@ -2559,7 +2559,7 @@
         }
 
         /**
-         * Specify how the buffer assosciated with this Surface is mapped in to the
+         * Specify how the buffer associated with this Surface is mapped in to the
          * parent coordinate space. The source frame will be scaled to fit the destination
          * frame, after being rotated according to the orientation parameter.
          *
diff --git a/core/java/android/view/textclassifier/OWNERS b/core/java/android/view/textclassifier/OWNERS
index 893a083..be4fbaa 100644
--- a/core/java/android/view/textclassifier/OWNERS
+++ b/core/java/android/view/textclassifier/OWNERS
@@ -7,4 +7,8 @@
 joannechung@google.com
 svetoslavganov@google.com
 eugeniom@google.com
-samsellem@google.com
\ No newline at end of file
+samsellem@google.com
+adamhe@google.com
+augale@google.com
+lpeter@google.com
+tymtsai@google.com
\ No newline at end of file
diff --git a/core/java/android/webkit/DateSorter.java b/core/java/android/webkit/DateSorter.java
index fede244..90d44db 100644
--- a/core/java/android/webkit/DateSorter.java
+++ b/core/java/android/webkit/DateSorter.java
@@ -19,11 +19,11 @@
 import android.content.Context;
 import android.content.res.Resources;
 
+import com.android.icu.text.DateSorterBridge;
+
 import java.util.Calendar;
 import java.util.Locale;
 
-import libcore.icu.LocaleData;
-
 /**
  * Sorts dates into the following groups:
  *   Today
@@ -69,9 +69,9 @@
         if (locale == null) {
             locale = Locale.getDefault();
         }
-        LocaleData localeData = LocaleData.get(locale);
-        mLabels[0] = localeData.today;
-        mLabels[1] = localeData.yesterday;
+        DateSorterBridge dateSorterBridge = DateSorterBridge.createInstance(locale);
+        mLabels[0] = dateSorterBridge.getToday();
+        mLabels[1] = dateSorterBridge.getYesterday();
 
         int resId = com.android.internal.R.plurals.last_num_days;
         String format = resources.getQuantityString(resId, NUM_DAYS_AGO);
diff --git a/core/java/android/widget/Magnifier.java b/core/java/android/widget/Magnifier.java
index 7fa8f9a..23bbe69 100644
--- a/core/java/android/widget/Magnifier.java
+++ b/core/java/android/widget/Magnifier.java
@@ -140,8 +140,6 @@
     // Lock to synchronize between the UI thread and the thread that handles pixel copy results.
     // Only sync mWindow writes from UI thread with mWindow reads from sPixelCopyHandlerThread.
     private final Object mLock = new Object();
-    // The lock used to synchronize the UI and render threads when a #dismiss is performed.
-    private final Object mDestroyLock = new Object();
 
     // Members for new styled magnifier (Eloquent style).
 
diff --git a/core/java/android/widget/ProgressBar.java b/core/java/android/widget/ProgressBar.java
index 970d70c..4b32e10 100644
--- a/core/java/android/widget/ProgressBar.java
+++ b/core/java/android/widget/ProgressBar.java
@@ -16,6 +16,8 @@
 
 package android.widget;
 
+import android.animation.Animator;
+import android.animation.AnimatorListenerAdapter;
 import android.animation.ObjectAnimator;
 import android.annotation.InterpolatorRes;
 import android.annotation.NonNull;
@@ -245,6 +247,8 @@
 
     private final ArrayList<RefreshData> mRefreshData = new ArrayList<RefreshData>();
 
+    private ObjectAnimator mLastProgressAnimator;
+
     /**
      * Create a new progress bar with range 0...100 and initial progress of 0.
      * @param context the application environment
@@ -1546,8 +1550,19 @@
             animator.setAutoCancel(true);
             animator.setDuration(PROGRESS_ANIM_DURATION);
             animator.setInterpolator(PROGRESS_ANIM_INTERPOLATOR);
+            animator.addListener(new AnimatorListenerAdapter() {
+                @Override
+                public void onAnimationEnd(Animator animation) {
+                    mLastProgressAnimator = null;
+                }
+            });
             animator.start();
+            mLastProgressAnimator = animator;
         } else {
+            if (isPrimary && mLastProgressAnimator != null) {
+                mLastProgressAnimator.cancel();
+                mLastProgressAnimator = null;
+            }
             setVisualProgress(id, scale);
         }
 
diff --git a/core/java/com/android/internal/accessibility/OWNERS b/core/java/com/android/internal/accessibility/OWNERS
new file mode 100644
index 0000000..b3c09e9
--- /dev/null
+++ b/core/java/com/android/internal/accessibility/OWNERS
@@ -0,0 +1,4 @@
+# Bug component: 44214
+svetoslavganov@google.com
+pweaver@google.com
+qasid@google.com
diff --git a/core/java/com/android/internal/compat/OWNERS b/core/java/com/android/internal/compat/OWNERS
index 2b7cdb0..cfd0a4b 100644
--- a/core/java/com/android/internal/compat/OWNERS
+++ b/core/java/com/android/internal/compat/OWNERS
@@ -2,6 +2,5 @@
 platform-compat-eng+reviews@google.com
 
 andreionea@google.com
-atrost@google.com
 mathewi@google.com
 satayev@google.com
diff --git a/core/java/com/android/internal/logging/AndroidHandler.java b/core/java/com/android/internal/logging/AndroidHandler.java
index f55a31f..119f366 100644
--- a/core/java/com/android/internal/logging/AndroidHandler.java
+++ b/core/java/com/android/internal/logging/AndroidHandler.java
@@ -17,9 +17,8 @@
 package com.android.internal.logging;
 
 import android.util.Log;
+
 import com.android.internal.util.FastPrintWriter;
-import dalvik.system.DalvikLogging;
-import dalvik.system.DalvikLogHandler;
 
 import java.io.PrintWriter;
 import java.io.StringWriter;
@@ -82,7 +81,7 @@
  *   </tr>
  * </table>
  */
-public class AndroidHandler extends Handler implements DalvikLogHandler {
+public class AndroidHandler extends Handler {
     /**
      * Holds the formatter for all Android log handlers.
      */
@@ -121,10 +120,32 @@
         // No need to flush, but must implement abstract method.
     }
 
+    /**
+     * Returns the short logger tag (up to 23 chars) for the given logger name.
+     * Traditionally loggers are named by fully-qualified Java classes; this
+     * method attempts to return a concise identifying part of such names.
+     */
+    private static String loggerNameToTag(String loggerName) {
+        // Anonymous logger.
+        if (loggerName == null) {
+            return "null";
+        }
+
+        int length = loggerName.length();
+        if (length <= 23) {
+            return loggerName;
+        }
+
+        int lastPeriod = loggerName.lastIndexOf(".");
+        return length - (lastPeriod + 1) <= 23
+                ? loggerName.substring(lastPeriod + 1)
+                : loggerName.substring(loggerName.length() - 23);
+    }
+
     @Override
     public void publish(LogRecord record) {
         int level = getAndroidLevel(record.getLevel());
-        String tag = DalvikLogging.loggerNameToTag(record.getLoggerName());
+        String tag = loggerNameToTag(record.getLoggerName());
         if (!Log.isLoggable(tag, level)) {
             return;
         }
diff --git a/core/java/com/android/internal/os/BatteryStatsImpl.java b/core/java/com/android/internal/os/BatteryStatsImpl.java
index 5a1af84..bb4623b 100644
--- a/core/java/com/android/internal/os/BatteryStatsImpl.java
+++ b/core/java/com/android/internal/os/BatteryStatsImpl.java
@@ -5433,7 +5433,7 @@
         if (mVideoOnNesting > 0) {
             final long elapsedRealtime = mClocks.elapsedRealtime();
             final long uptime = mClocks.uptimeMillis();
-            mAudioOnNesting = 0;
+            mVideoOnNesting = 0;
             mHistoryCur.states2 &= ~HistoryItem.STATE2_VIDEO_ON_FLAG;
             if (DEBUG_HISTORY) Slog.v(TAG, "Video off to: "
                     + Integer.toHexString(mHistoryCur.states));
diff --git a/core/java/com/android/internal/os/KernelCpuUidBpfMapReader.java b/core/java/com/android/internal/os/KernelCpuUidBpfMapReader.java
index 26f81d9..dafb924 100644
--- a/core/java/com/android/internal/os/KernelCpuUidBpfMapReader.java
+++ b/core/java/com/android/internal/os/KernelCpuUidBpfMapReader.java
@@ -16,7 +16,6 @@
 
 package com.android.internal.os;
 
-import android.os.StrictMode;
 import android.os.SystemClock;
 import android.util.Slog;
 import android.util.SparseArray;
@@ -90,9 +89,21 @@
         if (mErrors > ERROR_THRESHOLD) {
             return;
         }
+        if (endUid < startUid || startUid < 0) {
+            return;
+        }
+
         mWriteLock.lock();
         int firstIndex = mData.indexOfKey(startUid);
+        if (firstIndex < 0) {
+            mData.put(startUid, null);
+            firstIndex = mData.indexOfKey(startUid);
+        }
         int lastIndex = mData.indexOfKey(endUid);
+        if (lastIndex < 0) {
+            mData.put(endUid, null);
+            lastIndex = mData.indexOfKey(endUid);
+        }
         mData.removeAtRange(firstIndex, lastIndex - firstIndex + 1);
         mWriteLock.unlock();
     }
diff --git a/core/java/com/android/internal/os/ProcessCpuTracker.java b/core/java/com/android/internal/os/ProcessCpuTracker.java
index 7a9b659..8e0546e 100644
--- a/core/java/com/android/internal/os/ProcessCpuTracker.java
+++ b/core/java/com/android/internal/os/ProcessCpuTracker.java
@@ -945,8 +945,11 @@
 
     private void getName(Stats st, String cmdlineFile) {
         String newName = st.name;
-        if (st.name == null || st.name.equals("app_process")
-                || st.name.equals("<pre-initialized>")) {
+        if (st.name == null
+                || st.name.equals("app_process")
+                || st.name.equals("<pre-initialized>")
+                || st.name.equals("usap32")
+                || st.name.equals("usap64")) {
             String cmdName = ProcStatsUtil.readTerminatedProcFile(cmdlineFile, (byte) '\0');
             if (cmdName != null && cmdName.length() > 1) {
                 newName = cmdName;
diff --git a/core/java/com/android/internal/os/Zygote.java b/core/java/com/android/internal/os/Zygote.java
index a7d9827..2c653bb 100644
--- a/core/java/com/android/internal/os/Zygote.java
+++ b/core/java/com/android/internal/os/Zygote.java
@@ -1092,6 +1092,11 @@
     public static native int nativeParseSigChld(byte[] in, int length, int[] out);
 
     /**
+     * Returns whether the hardware supports memory tagging (ARM MTE).
+     */
+    public static native boolean nativeSupportsMemoryTagging();
+
+    /**
      * Returns whether the kernel supports tagged pointers. Present in the
      * Android Common Kernel from 4.14 and up. By default, you should prefer
      * fully-feature Memory Tagging, rather than the static Tagged Pointers.
diff --git a/core/java/com/android/internal/os/ZygoteInit.java b/core/java/com/android/internal/os/ZygoteInit.java
index 2e32730..a70955c 100644
--- a/core/java/com/android/internal/os/ZygoteInit.java
+++ b/core/java/com/android/internal/os/ZygoteInit.java
@@ -763,7 +763,11 @@
             Zygote.applyDebuggerSystemProperty(parsedArgs);
             Zygote.applyInvokeWithSystemProperty(parsedArgs);
 
-            if (Zygote.nativeSupportsTaggedPointers()) {
+            if (Zygote.nativeSupportsMemoryTagging()) {
+                /* The system server is more privileged than regular app processes, so it has async
+                 * tag checks enabled on hardware that supports memory tagging. */
+                parsedArgs.mRuntimeFlags |= Zygote.MEMORY_TAG_LEVEL_ASYNC;
+            } else if (Zygote.nativeSupportsTaggedPointers()) {
                 /* Enable pointer tagging in the system server. Hardware support for this is present
                  * in all ARMv8 CPUs. */
                 parsedArgs.mRuntimeFlags |= Zygote.MEMORY_TAG_LEVEL_TBI;
diff --git a/core/java/com/android/internal/util/ContrastColorUtil.java b/core/java/com/android/internal/util/ContrastColorUtil.java
index bf088e0a..8508a8d 100644
--- a/core/java/com/android/internal/util/ContrastColorUtil.java
+++ b/core/java/com/android/internal/util/ContrastColorUtil.java
@@ -73,7 +73,7 @@
 
     private ContrastColorUtil(Context context) {
         mGrayscaleIconMaxSize = context.getResources().getDimensionPixelSize(
-                com.android.internal.R.dimen.notification_large_icon_width);
+                com.android.internal.R.dimen.notification_grayscale_icon_max_size);
     }
 
     /**
diff --git a/core/jni/Android.bp b/core/jni/Android.bp
index 0797b18..f0f1b74 100644
--- a/core/jni/Android.bp
+++ b/core/jni/Android.bp
@@ -309,4 +309,10 @@
             ],
         },
     },
+
+    product_variables: {
+        experimental_mte: {
+            cflags: ["-DANDROID_EXPERIMENTAL_MTE"],
+        },
+    },
 }
diff --git a/core/jni/android_app_ActivityThread.cpp b/core/jni/android_app_ActivityThread.cpp
index 5aa684d..e9d9a20 100644
--- a/core/jni/android_app_ActivityThread.cpp
+++ b/core/jni/android_app_ActivityThread.cpp
@@ -15,7 +15,7 @@
  */
 
 #include "jni.h"
-#include <nativehelper/JNIHelp.h>
+#include <nativehelper/JNIPlatformHelp.h>
 
 #include "core_jni_helpers.h"
 #include <unistd.h>
diff --git a/core/jni/android_app_admin_SecurityLog.cpp b/core/jni/android_app_admin_SecurityLog.cpp
index b3bcaa0..e5a13db 100644
--- a/core/jni/android_app_admin_SecurityLog.cpp
+++ b/core/jni/android_app_admin_SecurityLog.cpp
@@ -41,7 +41,7 @@
         jniThrowNullPointerException(env, NULL);
         return;
     }
-    SLog::readEvents(env, ANDROID_LOG_RDONLY | ANDROID_LOG_NONBLOCK, 0, out);
+    SLog::readEvents(env, ANDROID_LOG_NONBLOCK, 0, out);
 }
 
 static void android_app_admin_SecurityLog_readEventsSince(JNIEnv* env, jobject /* clazz */,
@@ -52,7 +52,7 @@
         jniThrowNullPointerException(env, NULL);
         return;
     }
-    SLog::readEvents(env, ANDROID_LOG_RDONLY | ANDROID_LOG_NONBLOCK, timestamp, out);
+    SLog::readEvents(env, ANDROID_LOG_NONBLOCK, timestamp, out);
 }
 
 static void android_app_admin_SecurityLog_readPreviousEvents(JNIEnv* env, jobject /* clazz */,
@@ -62,7 +62,7 @@
         jniThrowNullPointerException(env, NULL);
         return;
     }
-    SLog::readEvents(env, ANDROID_LOG_RDONLY | ANDROID_LOG_NONBLOCK | ANDROID_LOG_PSTORE, 0, out);
+    SLog::readEvents(env, ANDROID_LOG_NONBLOCK | ANDROID_LOG_PSTORE, 0, out);
 }
 
 static void android_app_admin_SecurityLog_readEventsOnWrapping(JNIEnv* env, jobject /* clazz */,
@@ -72,8 +72,7 @@
         jniThrowNullPointerException(env, NULL);
         return;
     }
-    SLog::readEvents(env, ANDROID_LOG_RDONLY | ANDROID_LOG_NONBLOCK | ANDROID_LOG_WRAP, timestamp,
-            out);
+    SLog::readEvents(env, ANDROID_LOG_NONBLOCK | ANDROID_LOG_WRAP, timestamp, out);
 }
 
 /*
diff --git a/core/jni/android_backup_BackupDataInput.cpp b/core/jni/android_backup_BackupDataInput.cpp
index aa8acc16..79fa2a2 100644
--- a/core/jni/android_backup_BackupDataInput.cpp
+++ b/core/jni/android_backup_BackupDataInput.cpp
@@ -17,7 +17,7 @@
 #define LOG_TAG "FileBackupHelper_native"
 #include <utils/Log.h>
 
-#include <nativehelper/JNIHelp.h>
+#include <nativehelper/JNIPlatformHelp.h>
 #include <android_runtime/AndroidRuntime.h>
 
 #include <androidfw/BackupHelpers.h>
diff --git a/core/jni/android_backup_BackupDataOutput.cpp b/core/jni/android_backup_BackupDataOutput.cpp
index 4f5d1f80..324b3e7 100644
--- a/core/jni/android_backup_BackupDataOutput.cpp
+++ b/core/jni/android_backup_BackupDataOutput.cpp
@@ -17,7 +17,7 @@
 #define LOG_TAG "FileBackupHelper_native"
 #include <utils/Log.h>
 
-#include <nativehelper/JNIHelp.h>
+#include <nativehelper/JNIPlatformHelp.h>
 #include "core_jni_helpers.h"
 
 #include <androidfw/BackupHelpers.h>
diff --git a/core/jni/android_backup_BackupHelperDispatcher.cpp b/core/jni/android_backup_BackupHelperDispatcher.cpp
index fac7eba..efe7d0b 100644
--- a/core/jni/android_backup_BackupHelperDispatcher.cpp
+++ b/core/jni/android_backup_BackupHelperDispatcher.cpp
@@ -17,7 +17,7 @@
 #define LOG_TAG "BackupHelperDispatcher_native"
 #include <utils/Log.h>
 
-#include <nativehelper/JNIHelp.h>
+#include <nativehelper/JNIPlatformHelp.h>
 #include <android_runtime/AndroidRuntime.h>
 
 #include <sys/types.h>
diff --git a/core/jni/android_backup_FileBackupHelperBase.cpp b/core/jni/android_backup_FileBackupHelperBase.cpp
index 65840ee..5f84faf 100644
--- a/core/jni/android_backup_FileBackupHelperBase.cpp
+++ b/core/jni/android_backup_FileBackupHelperBase.cpp
@@ -17,7 +17,7 @@
 #define LOG_TAG "FileBackupHelper_native"
 #include <utils/Log.h>
 
-#include <nativehelper/JNIHelp.h>
+#include <nativehelper/JNIPlatformHelp.h>
 #include "core_jni_helpers.h"
 
 #include <androidfw/BackupHelpers.h>
diff --git a/core/jni/android_hardware_SerialPort.cpp b/core/jni/android_hardware_SerialPort.cpp
index 3ff2446..d06107e 100644
--- a/core/jni/android_hardware_SerialPort.cpp
+++ b/core/jni/android_hardware_SerialPort.cpp
@@ -19,7 +19,7 @@
 #include "utils/Log.h"
 
 #include "jni.h"
-#include <nativehelper/JNIHelp.h>
+#include <nativehelper/JNIPlatformHelp.h>
 #include "core_jni_helpers.h"
 
 #include <stdio.h>
diff --git a/core/jni/android_hardware_UsbDeviceConnection.cpp b/core/jni/android_hardware_UsbDeviceConnection.cpp
index b885c28..845d65c 100644
--- a/core/jni/android_hardware_UsbDeviceConnection.cpp
+++ b/core/jni/android_hardware_UsbDeviceConnection.cpp
@@ -19,7 +19,7 @@
 #include "utils/Log.h"
 
 #include "jni.h"
-#include <nativehelper/JNIHelp.h>
+#include <nativehelper/JNIPlatformHelp.h>
 #include "core_jni_helpers.h"
 
 #include <usbhost/usbhost.h>
diff --git a/core/jni/android_net_LocalSocketImpl.cpp b/core/jni/android_net_LocalSocketImpl.cpp
index 1163b86..42cf1f4 100644
--- a/core/jni/android_net_LocalSocketImpl.cpp
+++ b/core/jni/android_net_LocalSocketImpl.cpp
@@ -16,7 +16,7 @@
 
 #define LOG_TAG "LocalSocketImpl"
 
-#include <nativehelper/JNIHelp.h>
+#include <nativehelper/JNIPlatformHelp.h>
 #include "jni.h"
 #include "utils/Log.h"
 #include "utils/misc.h"
diff --git a/core/jni/android_net_NetUtils.cpp b/core/jni/android_net_NetUtils.cpp
index d4805ac..e56809f 100644
--- a/core/jni/android_net_NetUtils.cpp
+++ b/core/jni/android_net_NetUtils.cpp
@@ -30,7 +30,7 @@
 #include <DnsProxydProtocol.h> // NETID_USE_LOCAL_NAMESERVERS
 #include <android_runtime/AndroidRuntime.h>
 #include <cutils/properties.h>
-#include <nativehelper/JNIHelp.h>
+#include <nativehelper/JNIPlatformHelp.h>
 #include <nativehelper/ScopedLocalRef.h>
 #include <utils/Log.h>
 #include <utils/misc.h>
diff --git a/core/jni/android_opengl_EGL14.cpp b/core/jni/android_opengl_EGL14.cpp
index de5e3a5..2f29cae 100644
--- a/core/jni/android_opengl_EGL14.cpp
+++ b/core/jni/android_opengl_EGL14.cpp
@@ -20,7 +20,7 @@
 #pragma GCC diagnostic ignored "-Wunused-function"
 
 #include "jni.h"
-#include <nativehelper/JNIHelp.h>
+#include <nativehelper/JNIPlatformHelp.h>
 #include <android_runtime/AndroidRuntime.h>
 #include <android_runtime/android_view_Surface.h>
 #include <android_runtime/android_graphics_SurfaceTexture.h>
diff --git a/core/jni/android_opengl_EGL15.cpp b/core/jni/android_opengl_EGL15.cpp
index 4aeed87..b9c36b9 100644
--- a/core/jni/android_opengl_EGL15.cpp
+++ b/core/jni/android_opengl_EGL15.cpp
@@ -20,7 +20,7 @@
 #pragma GCC diagnostic ignored "-Wunused-function"
 
 #include "jni.h"
-#include <nativehelper/JNIHelp.h>
+#include <nativehelper/JNIPlatformHelp.h>
 #include <android_runtime/AndroidRuntime.h>
 #include <utils/misc.h>
 
diff --git a/core/jni/android_opengl_EGLExt.cpp b/core/jni/android_opengl_EGLExt.cpp
index fef8116..1758807 100644
--- a/core/jni/android_opengl_EGLExt.cpp
+++ b/core/jni/android_opengl_EGLExt.cpp
@@ -20,7 +20,7 @@
 #pragma GCC diagnostic ignored "-Wunused-function"
 
 #include "jni.h"
-#include <nativehelper/JNIHelp.h>
+#include <nativehelper/JNIPlatformHelp.h>
 #include <android_runtime/AndroidRuntime.h>
 #include <android_runtime/android_view_Surface.h>
 #include <android_runtime/android_graphics_SurfaceTexture.h>
diff --git a/core/jni/android_opengl_GLES10.cpp b/core/jni/android_opengl_GLES10.cpp
index 3d9a3b6..e4d138d 100644
--- a/core/jni/android_opengl_GLES10.cpp
+++ b/core/jni/android_opengl_GLES10.cpp
@@ -24,7 +24,7 @@
 #include <GLES/glext.h>
 
 #include <jni.h>
-#include <nativehelper/JNIHelp.h>
+#include <nativehelper/JNIPlatformHelp.h>
 #include <android_runtime/AndroidRuntime.h>
 #include <utils/misc.h>
 #include <assert.h>
diff --git a/core/jni/android_opengl_GLES10Ext.cpp b/core/jni/android_opengl_GLES10Ext.cpp
index 6d7f41e..3638b87 100644
--- a/core/jni/android_opengl_GLES10Ext.cpp
+++ b/core/jni/android_opengl_GLES10Ext.cpp
@@ -24,7 +24,7 @@
 #include <GLES/glext.h>
 
 #include <jni.h>
-#include <nativehelper/JNIHelp.h>
+#include <nativehelper/JNIPlatformHelp.h>
 #include <android_runtime/AndroidRuntime.h>
 #include <utils/misc.h>
 #include <assert.h>
diff --git a/core/jni/android_opengl_GLES11.cpp b/core/jni/android_opengl_GLES11.cpp
index 39ef41a..1069a1d 100644
--- a/core/jni/android_opengl_GLES11.cpp
+++ b/core/jni/android_opengl_GLES11.cpp
@@ -24,7 +24,7 @@
 #include <GLES/glext.h>
 
 #include <jni.h>
-#include <nativehelper/JNIHelp.h>
+#include <nativehelper/JNIPlatformHelp.h>
 #include <android_runtime/AndroidRuntime.h>
 #include <utils/misc.h>
 #include <assert.h>
diff --git a/core/jni/android_opengl_GLES11Ext.cpp b/core/jni/android_opengl_GLES11Ext.cpp
index 1144d5bf..86d7ecd 100644
--- a/core/jni/android_opengl_GLES11Ext.cpp
+++ b/core/jni/android_opengl_GLES11Ext.cpp
@@ -24,7 +24,7 @@
 #include <GLES/glext.h>
 
 #include <jni.h>
-#include <nativehelper/JNIHelp.h>
+#include <nativehelper/JNIPlatformHelp.h>
 #include <android_runtime/AndroidRuntime.h>
 #include <utils/misc.h>
 #include <assert.h>
diff --git a/core/jni/android_opengl_GLES20.cpp b/core/jni/android_opengl_GLES20.cpp
index 2add72d..49baa51 100644
--- a/core/jni/android_opengl_GLES20.cpp
+++ b/core/jni/android_opengl_GLES20.cpp
@@ -24,7 +24,7 @@
 #include <GLES2/gl2ext.h>
 
 #include <jni.h>
-#include <nativehelper/JNIHelp.h>
+#include <nativehelper/JNIPlatformHelp.h>
 #include <android_runtime/AndroidRuntime.h>
 #include <utils/misc.h>
 #include <assert.h>
diff --git a/core/jni/android_opengl_GLES30.cpp b/core/jni/android_opengl_GLES30.cpp
index a9c0219..32a2a24 100644
--- a/core/jni/android_opengl_GLES30.cpp
+++ b/core/jni/android_opengl_GLES30.cpp
@@ -24,7 +24,7 @@
 #include <GLES3/gl3ext.h>
 
 #include <jni.h>
-#include <nativehelper/JNIHelp.h>
+#include <nativehelper/JNIPlatformHelp.h>
 #include <android_runtime/AndroidRuntime.h>
 #include <utils/misc.h>
 #include <assert.h>
diff --git a/core/jni/android_opengl_GLES31.cpp b/core/jni/android_opengl_GLES31.cpp
index 456da93..afe7c63 100644
--- a/core/jni/android_opengl_GLES31.cpp
+++ b/core/jni/android_opengl_GLES31.cpp
@@ -22,7 +22,7 @@
 #include <stdint.h>
 #include <GLES3/gl31.h>
 #include <jni.h>
-#include <nativehelper/JNIHelp.h>
+#include <nativehelper/JNIPlatformHelp.h>
 #include <android_runtime/AndroidRuntime.h>
 #include <utils/misc.h>
 #include <assert.h>
diff --git a/core/jni/android_opengl_GLES31Ext.cpp b/core/jni/android_opengl_GLES31Ext.cpp
index dcaf4a5..8127433 100644
--- a/core/jni/android_opengl_GLES31Ext.cpp
+++ b/core/jni/android_opengl_GLES31Ext.cpp
@@ -23,7 +23,7 @@
 #include <GLES2/gl2ext.h>
 
 #include <jni.h>
-#include <nativehelper/JNIHelp.h>
+#include <nativehelper/JNIPlatformHelp.h>
 #include <android_runtime/AndroidRuntime.h>
 #include <utils/misc.h>
 #include <assert.h>
diff --git a/core/jni/android_opengl_GLES32.cpp b/core/jni/android_opengl_GLES32.cpp
index 6bdc711..07a794d 100644
--- a/core/jni/android_opengl_GLES32.cpp
+++ b/core/jni/android_opengl_GLES32.cpp
@@ -22,7 +22,7 @@
 #include <stdint.h>
 #include <GLES3/gl32.h>
 #include <jni.h>
-#include <nativehelper/JNIHelp.h>
+#include <nativehelper/JNIPlatformHelp.h>
 #include <android_runtime/AndroidRuntime.h>
 #include <utils/misc.h>
 #include <assert.h>
diff --git a/core/jni/android_os_Debug.cpp b/core/jni/android_os_Debug.cpp
index f7c6dbd..3da2fa2 100644
--- a/core/jni/android_os_Debug.cpp
+++ b/core/jni/android_os_Debug.cpp
@@ -40,7 +40,7 @@
 #include <utils/misc.h>
 #include <utils/String8.h>
 
-#include <nativehelper/JNIHelp.h>
+#include <nativehelper/JNIPlatformHelp.h>
 #include <nativehelper/ScopedUtfChars.h>
 #include "jni.h"
 #include <dmabufinfo/dmabufinfo.h>
diff --git a/core/jni/android_os_HwParcel.cpp b/core/jni/android_os_HwParcel.cpp
index 151dbfce..a88f891 100644
--- a/core/jni/android_os_HwParcel.cpp
+++ b/core/jni/android_os_HwParcel.cpp
@@ -292,19 +292,11 @@
         return;
     }
 
-    const jchar *interfaceName = env->GetStringCritical(interfaceNameObj, NULL);
+    const char *interfaceName = env->GetStringUTFChars(interfaceNameObj, NULL);
     if (interfaceName) {
-        String8 interfaceNameCopy = String8(String16(
-                reinterpret_cast<const char16_t *>(interfaceName),
-                env->GetStringLength(interfaceNameObj)));
-
-        env->ReleaseStringCritical(interfaceNameObj, interfaceName);
-        interfaceName = NULL;
-
         hardware::Parcel *parcel =
             JHwParcel::GetNativeContext(env, thiz)->getParcel();
-
-        bool valid = parcel->enforceInterface(interfaceNameCopy.string());
+        bool valid = parcel->enforceInterface(interfaceName);
 
         if (!valid) {
             jniThrowException(
@@ -312,6 +304,7 @@
                     "java/lang/SecurityException",
                     "HWBinder invocation to an incorrect interface");
         }
+        env->ReleaseStringUTFChars(interfaceNameObj, interfaceName);
     }
 }
 
diff --git a/core/jni/android_os_MemoryFile.cpp b/core/jni/android_os_MemoryFile.cpp
index b21566b..8d91e63 100644
--- a/core/jni/android_os_MemoryFile.cpp
+++ b/core/jni/android_os_MemoryFile.cpp
@@ -19,7 +19,7 @@
 
 #include <cutils/ashmem.h>
 #include "core_jni_helpers.h"
-#include <nativehelper/JNIHelp.h>
+#include <nativehelper/JNIPlatformHelp.h>
 #include <unistd.h>
 #include <sys/mman.h>
 
diff --git a/core/jni/android_os_Parcel.cpp b/core/jni/android_os_Parcel.cpp
index e7a2fb4..6ec5bce 100644
--- a/core/jni/android_os_Parcel.cpp
+++ b/core/jni/android_os_Parcel.cpp
@@ -20,7 +20,7 @@
 #include "android_os_Parcel.h"
 #include "android_util_Binder.h"
 
-#include <nativehelper/JNIHelp.h>
+#include <nativehelper/JNIPlatformHelp.h>
 
 #include <fcntl.h>
 #include <stdio.h>
@@ -510,7 +510,11 @@
         if (fd < 0) return NULL;
         fd = fcntl(fd, F_DUPFD_CLOEXEC, 0);
         if (fd < 0) return NULL;
-        return jniCreateFileDescriptor(env, fd);
+        jobject jifd = jniCreateFileDescriptor(env, fd);
+        if (jifd == NULL) {
+            close(fd);
+        }
+        return jifd;
     }
     return NULL;
 }
@@ -660,8 +664,8 @@
             IPCThreadState* threadState = IPCThreadState::self();
             const int32_t oldPolicy = threadState->getStrictModePolicy();
             const bool isValid = parcel->enforceInterface(
-                String16(reinterpret_cast<const char16_t*>(str),
-                         env->GetStringLength(name)),
+                reinterpret_cast<const char16_t*>(str),
+                env->GetStringLength(name),
                 threadState);
             env->ReleaseStringCritical(name, str);
             if (isValid) {
diff --git a/core/jni/android_os_SELinux.cpp b/core/jni/android_os_SELinux.cpp
index 236ee61..43c1cfd 100644
--- a/core/jni/android_os_SELinux.cpp
+++ b/core/jni/android_os_SELinux.cpp
@@ -15,14 +15,17 @@
  */
 
 #define LOG_TAG "SELinuxJNI"
+
+#include <errno.h>
+#include <fcntl.h>
+
 #include <utils/Log.h>
 
-#include <nativehelper/JNIHelp.h>
+#include <nativehelper/JNIPlatformHelp.h>
 #include "jni.h"
 #include "core_jni_helpers.h"
 #include "selinux/selinux.h"
 #include "selinux/android.h"
-#include <errno.h>
 #include <memory>
 #include <atomic>
 #include <nativehelper/ScopedLocalRef.h>
diff --git a/core/jni/android_os_SharedMemory.cpp b/core/jni/android_os_SharedMemory.cpp
index c33405d..dc86187 100644
--- a/core/jni/android_os_SharedMemory.cpp
+++ b/core/jni/android_os_SharedMemory.cpp
@@ -22,7 +22,7 @@
 #include <utils/Log.h>
 
 #include <nativehelper/jni_macros.h>
-#include <nativehelper/JNIHelp.h>
+#include <nativehelper/JNIPlatformHelp.h>
 #include <nativehelper/ScopedLocalRef.h>
 
 #include <algorithm>
@@ -69,7 +69,11 @@
         return nullptr;
     }
 
-    return jniCreateFileDescriptor(env, fd);
+    jobject jifd = jniCreateFileDescriptor(env, fd);
+    if (jifd == nullptr) {
+        close(fd);
+    }
+    return jifd;
 }
 
 jint SharedMemory_nGetSize(JNIEnv* env, jobject, jobject fileDescriptor) {
diff --git a/core/jni/android_server_NetworkManagementSocketTagger.cpp b/core/jni/android_server_NetworkManagementSocketTagger.cpp
index 58295af..afad08a 100644
--- a/core/jni/android_server_NetworkManagementSocketTagger.cpp
+++ b/core/jni/android_server_NetworkManagementSocketTagger.cpp
@@ -17,7 +17,7 @@
 #define LOG_TAG "NMST_QTagUidNative"
 #include <utils/Log.h>
 
-#include <nativehelper/JNIHelp.h>
+#include <nativehelper/JNIPlatformHelp.h>
 
 #include "jni.h"
 #include <utils/misc.h>
diff --git a/core/jni/android_text_Hyphenator.cpp b/core/jni/android_text_Hyphenator.cpp
index de30773..21402b6 100644
--- a/core/jni/android_text_Hyphenator.cpp
+++ b/core/jni/android_text_Hyphenator.cpp
@@ -14,9 +14,10 @@
  * limitations under the License.
  */
 
+#include <fcntl.h>
 #include <sys/mman.h>
-#include <sys/types.h>
 #include <sys/stat.h>
+#include <sys/types.h>
 #include <unistd.h>
 
 #include <algorithm>
diff --git a/core/jni/android_util_AssetManager.cpp b/core/jni/android_util_AssetManager.cpp
index 12abc25..e6881b3 100644
--- a/core/jni/android_util_AssetManager.cpp
+++ b/core/jni/android_util_AssetManager.cpp
@@ -18,14 +18,13 @@
 #define LOG_TAG "asset"
 
 #include <inttypes.h>
+#include <linux/capability.h>
 #include <stdio.h>
 #include <sys/stat.h>
 #include <sys/types.h>
 #include <sys/wait.h>
 #include <unistd.h>
 
-#include <private/android_filesystem_config.h> // for AID_SYSTEM
-
 #include <sstream>
 #include <string>
 
@@ -46,7 +45,7 @@
 
 #include "core_jni_helpers.h"
 #include "jni.h"
-#include "nativehelper/JNIHelp.h"
+#include "nativehelper/JNIPlatformHelp.h"
 #include "nativehelper/ScopedPrimitiveArray.h"
 #include "nativehelper/ScopedStringChars.h"
 #include "nativehelper/ScopedUtfChars.h"
diff --git a/core/jni/android_util_EventLog.cpp b/core/jni/android_util_EventLog.cpp
index 3b5a144..0a5e786 100644
--- a/core/jni/android_util_EventLog.cpp
+++ b/core/jni/android_util_EventLog.cpp
@@ -44,7 +44,7 @@
         return;
     }
 
-    ELog::readEvents(env, ANDROID_LOG_RDONLY | ANDROID_LOG_NONBLOCK, tags, 0, out);
+    ELog::readEvents(env, ANDROID_LOG_NONBLOCK, tags, 0, out);
  }
 /*
  * In class android.util.EventLog:
@@ -60,8 +60,7 @@
         jniThrowNullPointerException(env, NULL);
         return;
     }
-    ELog::readEvents(env, ANDROID_LOG_RDONLY | ANDROID_LOG_NONBLOCK | ANDROID_LOG_WRAP, tags,
-            timestamp, out);
+    ELog::readEvents(env, ANDROID_LOG_NONBLOCK | ANDROID_LOG_WRAP, tags, timestamp, out);
 }
 
 /*
diff --git a/core/jni/com_android_internal_os_Zygote.cpp b/core/jni/com_android_internal_os_Zygote.cpp
index 9eede83..6e49c0d 100644
--- a/core/jni/com_android_internal_os_Zygote.cpp
+++ b/core/jni/com_android_internal_os_Zygote.cpp
@@ -55,6 +55,7 @@
 #include <signal.h>
 #include <stdio.h>
 #include <stdlib.h>
+#include <sys/auxv.h>
 #include <sys/capability.h>
 #include <sys/cdefs.h>
 #include <sys/eventfd.h>
@@ -76,6 +77,8 @@
 #include <android-base/stringprintf.h>
 #include <android-base/unique_fd.h>
 #include <bionic/malloc.h>
+#include <bionic/mte.h>
+#include <bionic/mte_kernel.h>
 #include <cutils/fs.h>
 #include <cutils/multiuser.h>
 #include <cutils/sockets.h>
@@ -344,6 +347,8 @@
     PROFILE_FROM_SHELL = 1 << 15,
     MEMORY_TAG_LEVEL_MASK = (1 << 19) | (1 << 20),
     MEMORY_TAG_LEVEL_TBI = 1 << 19,
+    MEMORY_TAG_LEVEL_ASYNC = 2 << 19,
+    MEMORY_TAG_LEVEL_SYNC = 3 << 19,
     GWP_ASAN_LEVEL_MASK = (1 << 21) | (1 << 22),
     GWP_ASAN_LEVEL_NEVER = 0 << 21,
     GWP_ASAN_LEVEL_LOTTERY = 1 << 21,
@@ -1599,6 +1604,28 @@
   }
 }
 
+#ifdef ANDROID_EXPERIMENTAL_MTE
+static void SetTagCheckingLevel(int level) {
+#ifdef __aarch64__
+  if (!(getauxval(AT_HWCAP2) & HWCAP2_MTE)) {
+    return;
+  }
+
+  int tagged_addr_ctrl = prctl(PR_GET_TAGGED_ADDR_CTRL, 0, 0, 0, 0);
+  if (tagged_addr_ctrl < 0) {
+    ALOGE("prctl(PR_GET_TAGGED_ADDR_CTRL) failed: %s", strerror(errno));
+    return;
+  }
+
+  tagged_addr_ctrl = (tagged_addr_ctrl & ~PR_MTE_TCF_MASK) | level;
+  if (prctl(PR_SET_TAGGED_ADDR_CTRL, tagged_addr_ctrl, 0, 0, 0) < 0) {
+    ALOGE("prctl(PR_SET_TAGGED_ADDR_CTRL, %d) failed: %s", tagged_addr_ctrl,
+          strerror(errno));
+  }
+#endif
+}
+#endif
+
 // Utility routine to specialize a zygote child process.
 static void SpecializeCommon(JNIEnv* env, uid_t uid, gid_t gid, jintArray gids,
                              jint runtime_flags, jobjectArray rlimits,
@@ -1733,7 +1760,23 @@
     case RuntimeFlags::MEMORY_TAG_LEVEL_TBI:
       heap_tagging_level = M_HEAP_TAGGING_LEVEL_TBI;
       break;
+    case RuntimeFlags::MEMORY_TAG_LEVEL_ASYNC:
+#ifdef ANDROID_EXPERIMENTAL_MTE
+      SetTagCheckingLevel(PR_MTE_TCF_ASYNC);
+#endif
+      heap_tagging_level = M_HEAP_TAGGING_LEVEL_ASYNC;
+      break;
+    case RuntimeFlags::MEMORY_TAG_LEVEL_SYNC:
+#ifdef ANDROID_EXPERIMENTAL_MTE
+      SetTagCheckingLevel(PR_MTE_TCF_SYNC);
+#endif
+      // TODO(pcc): Use SYNC here once the allocator supports it.
+      heap_tagging_level = M_HEAP_TAGGING_LEVEL_ASYNC;
+      break;
     default:
+#ifdef ANDROID_EXPERIMENTAL_MTE
+      SetTagCheckingLevel(PR_MTE_TCF_NONE);
+#endif
       heap_tagging_level = M_HEAP_TAGGING_LEVEL_NONE;
   }
   android_mallopt(M_SET_HEAP_TAGGING_LEVEL, &heap_tagging_level, sizeof(heap_tagging_level));
@@ -2432,6 +2475,14 @@
     return -1;
 }
 
+static jboolean com_android_internal_os_Zygote_nativeSupportsMemoryTagging(JNIEnv* env, jclass) {
+#if defined(__aarch64__)
+  return mte_supported();
+#else
+  return false;
+#endif
+}
+
 static jboolean com_android_internal_os_Zygote_nativeSupportsTaggedPointers(JNIEnv* env, jclass) {
 #ifdef __aarch64__
   int res = prctl(PR_GET_TAGGED_ADDR_CTRL, 0, 0, 0, 0);
@@ -2476,6 +2527,8 @@
          (void*)com_android_internal_os_Zygote_nativeBoostUsapPriority},
         {"nativeParseSigChld", "([BI[I)I",
          (void*)com_android_internal_os_Zygote_nativeParseSigChld},
+        {"nativeSupportsMemoryTagging", "()Z",
+         (void*)com_android_internal_os_Zygote_nativeSupportsMemoryTagging},
         {"nativeSupportsTaggedPointers", "()Z",
          (void*)com_android_internal_os_Zygote_nativeSupportsTaggedPointers},
 };
diff --git a/core/jni/com_google_android_gles_jni_GLImpl.cpp b/core/jni/com_google_android_gles_jni_GLImpl.cpp
index 6b893cb..ffc1ddc 100644
--- a/core/jni/com_google_android_gles_jni_GLImpl.cpp
+++ b/core/jni/com_google_android_gles_jni_GLImpl.cpp
@@ -21,7 +21,7 @@
 #pragma GCC diagnostic ignored "-Wunused-function"
 
 #include "jni.h"
-#include <nativehelper/JNIHelp.h>
+#include <nativehelper/JNIPlatformHelp.h>
 #include <android_runtime/AndroidRuntime.h>
 #include <utils/misc.h>
 
diff --git a/core/jni/core_jni_helpers.h b/core/jni/core_jni_helpers.h
index 8bb4d50..eeda275 100644
--- a/core/jni/core_jni_helpers.h
+++ b/core/jni/core_jni_helpers.h
@@ -17,7 +17,7 @@
 #ifndef CORE_JNI_HELPERS
 #define CORE_JNI_HELPERS
 
-#include <nativehelper/JNIHelp.h>
+#include <nativehelper/JNIPlatformHelp.h>
 #include <nativehelper/scoped_local_ref.h>
 #include <nativehelper/scoped_utf_chars.h>
 #include <android_runtime/AndroidRuntime.h>
diff --git a/core/jni/eventlog_helper.h b/core/jni/eventlog_helper.h
index 3a05195..29c023a 100644
--- a/core/jni/eventlog_helper.h
+++ b/core/jni/eventlog_helper.h
@@ -24,7 +24,7 @@
 #include <android-base/macros.h>
 #include <log/log_event_list.h>
 
-#include <log/log.h>
+#include <log/log_read.h>
 
 #include <nativehelper/JNIHelp.h>
 #include <nativehelper/ScopedLocalRef.h>
diff --git a/core/jni/fd_utils.cpp b/core/jni/fd_utils.cpp
index c72668f..38981b0 100644
--- a/core/jni/fd_utils.cpp
+++ b/core/jni/fd_utils.cpp
@@ -35,6 +35,7 @@
 static const char* kPathWhitelist[] = {
         "/apex/com.android.conscrypt/javalib/conscrypt.jar",
         "/apex/com.android.ipsec/javalib/ike.jar",
+        "/apex/com.android.i18n/javalib/core-icu4j.jar",
         "/apex/com.android.media/javalib/updatable-media.jar",
         "/apex/com.android.mediaprovider/javalib/framework-mediaprovider.jar",
         "/apex/com.android.os.statsd/javalib/framework-statsd.jar",
@@ -85,11 +86,18 @@
   }
 
   // Framework jars are allowed.
-  static const char* kFrameworksPrefix = "/system/framework/";
+  static const char* kFrameworksPrefix[] = {
+          "/system/framework/",
+          "/system_ext/framework/",
+  };
+
   static const char* kJarSuffix = ".jar";
-  if (android::base::StartsWith(path, kFrameworksPrefix)
-      && android::base::EndsWith(path, kJarSuffix)) {
-    return true;
+
+  for (const auto& frameworks_prefix : kFrameworksPrefix) {
+    if (android::base::StartsWith(path, frameworks_prefix)
+        && android::base::EndsWith(path, kJarSuffix)) {
+      return true;
+    }
   }
 
   // Jars from the ART APEX are allowed.
diff --git a/core/proto/android/bluetooth/enums.proto b/core/proto/android/bluetooth/enums.proto
index 22f2498..dc60ede 100644
--- a/core/proto/android/bluetooth/enums.proto
+++ b/core/proto/android/bluetooth/enums.proto
@@ -41,6 +41,7 @@
     ENABLE_DISABLE_REASON_USER_SWITCH = 8;
     ENABLE_DISABLE_REASON_RESTORE_USER_SETTING = 9;
     ENABLE_DISABLE_REASON_FACTORY_RESET = 10;
+    ENABLE_DISABLE_REASON_INIT_FLAGS_CHANGED = 11;
 }
 
 enum DirectionEnum {
diff --git a/core/proto/android/providers/settings/global.proto b/core/proto/android/providers/settings/global.proto
index 023197b..9bbe0ca 100644
--- a/core/proto/android/providers/settings/global.proto
+++ b/core/proto/android/providers/settings/global.proto
@@ -910,13 +910,8 @@
         optional SettingProto storage_full_threshold_bytes = 4 [ (android.privacy).dest = DEST_AUTOMATIC ];
         optional SettingProto storage_cache_percentage = 5 [ (android.privacy).dest = DEST_AUTOMATIC ];
         optional SettingProto storage_cache_max_bytes = 6 [ (android.privacy).dest = DEST_AUTOMATIC ];
-        // System VDSO global setting. This links to the "sys.vdso" system property.
-        // The following values are supported:
-        // false  -> both 32 and 64 bit vdso disabled
-        // 32     -> 32 bit vdso enabled
-        // 64     -> 64 bit vdso enabled
-        // Any other value defaults to both 32 bit and 64 bit true.
-        optional SettingProto vdso = 7 [ (android.privacy).dest = DEST_AUTOMATIC ];
+        // Used to be sys_vdso
+        reserved 7;
         // UidCpuPower global setting. This links the sys.uidcpupower system property.
         // The following values are supported:
         // 0 -> /proc/uid_cpupower/* are disabled
diff --git a/core/proto/android/server/connectivity/Android.bp b/core/proto/android/server/connectivity/Android.bp
index 4136239..50c238b 100644
--- a/core/proto/android/server/connectivity/Android.bp
+++ b/core/proto/android/server/connectivity/Android.bp
@@ -21,4 +21,6 @@
         "data_stall_event.proto",
     ],
     sdk_version: "system_current",
+    // this is part of updatable modules(NetworkStack) which targets 29(Q)
+    min_sdk_version: "29",
 }
diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml
index 3d91474..81cfbc2 100644
--- a/core/res/res/values/config.xml
+++ b/core/res/res/values/config.xml
@@ -2905,6 +2905,11 @@
          empty string is passed in -->
     <string name="config_wlan_data_service_package" translatable="false"></string>
 
+    <!-- Boolean indicating whether the Iwlan data service supports persistence of iwlan ipsec
+         tunnels across service restart. If iwlan tunnels are not persisted across restart,
+         Framework will clean up dangling data connections when service restarts -->
+    <bool name="config_wlan_data_service_conn_persistence_on_restart">true</bool>
+
     <!-- Cellular data service class name to bind to by default. If none is specified in an overlay, an
          empty string is passed in -->
     <string name="config_wwan_data_service_class" translatable="false"></string>
diff --git a/core/res/res/values/dimens.xml b/core/res/res/values/dimens.xml
index ebaf85c..cbc08ba 100644
--- a/core/res/res/values/dimens.xml
+++ b/core/res/res/values/dimens.xml
@@ -694,6 +694,8 @@
     <dimen name="notification_media_image_max_width_low_ram">100dp</dimen>
     <!-- The size of the right icon image when on low ram -->
     <dimen name="notification_right_icon_size_low_ram">@dimen/notification_right_icon_size</dimen>
+    <!-- The maximum size of the grayscale icon -->
+    <dimen name="notification_grayscale_icon_max_size">256dp</dimen>
 
     <dimen name="messaging_avatar_size">@dimen/notification_right_icon_size</dimen>
     <dimen name="conversation_avatar_size">52dp</dimen>
diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml
index 8719242..7c92021 100644
--- a/core/res/res/values/symbols.xml
+++ b/core/res/res/values/symbols.xml
@@ -302,6 +302,7 @@
   <java-symbol type="string" name="config_wlan_network_service_package" />
   <java-symbol type="string" name="config_wwan_network_service_class" />
   <java-symbol type="string" name="config_wlan_network_service_class" />
+  <java-symbol type="bool" name="config_wlan_data_service_conn_persistence_on_restart" />
   <java-symbol type="string" name="config_wwan_data_service_package" />
   <java-symbol type="string" name="config_wlan_data_service_package" />
   <java-symbol type="string" name="config_wwan_data_service_class" />
@@ -3363,6 +3364,7 @@
   <java-symbol type="dimen" name="notification_media_image_max_width_low_ram"/>
   <java-symbol type="dimen" name="notification_media_image_max_height_low_ram"/>
   <java-symbol type="dimen" name="notification_right_icon_size_low_ram"/>
+  <java-symbol type="dimen" name="notification_grayscale_icon_max_size"/>
   <java-symbol type="dimen" name="notification_custom_view_max_image_height_low_ram"/>
   <java-symbol type="dimen" name="notification_custom_view_max_image_width_low_ram"/>
 
diff --git a/core/tests/PlatformCompatFramework/OWNERS b/core/tests/PlatformCompatFramework/OWNERS
index 2b7cdb0..cfd0a4b 100644
--- a/core/tests/PlatformCompatFramework/OWNERS
+++ b/core/tests/PlatformCompatFramework/OWNERS
@@ -2,6 +2,5 @@
 platform-compat-eng+reviews@google.com
 
 andreionea@google.com
-atrost@google.com
 mathewi@google.com
 satayev@google.com
diff --git a/core/tests/coretests/apks/install_jni_lib/Android.bp b/core/tests/coretests/apks/install_jni_lib/Android.bp
index f20f599..df19fa0 100644
--- a/core/tests/coretests/apks/install_jni_lib/Android.bp
+++ b/core/tests/coretests/apks/install_jni_lib/Android.bp
@@ -24,4 +24,5 @@
         "-Wall",
         "-Werror",
     ],
+    header_libs: ["jni_headers"]
 }
diff --git a/core/tests/coretests/src/com/android/internal/os/KernelCpuUidBpfMapReaderTest.java b/core/tests/coretests/src/com/android/internal/os/KernelCpuUidBpfMapReaderTest.java
index 257b388..bda21c6 100644
--- a/core/tests/coretests/src/com/android/internal/os/KernelCpuUidBpfMapReaderTest.java
+++ b/core/tests/coretests/src/com/android/internal/os/KernelCpuUidBpfMapReaderTest.java
@@ -179,6 +179,21 @@
         testOpenAndReadData(changedData);
     }
 
+    @Test
+    public void testRemoveUidsInRange_firstAndLastAbsent() {
+        final SparseArray<long[]> data = getTestSparseArray(200, 50);
+        data.delete(0);
+        data.delete(5);
+        mReader.setData(data);
+        testOpenAndReadData(data);
+        SparseArray<long[]> changedData = new SparseArray<>();
+        for (int i = 6; i < 200; i++) {
+            changedData.put(i, data.get(i));
+        }
+        mReader.removeUidsInRange(0, 5);
+        testOpenAndReadData(changedData);
+    }
+
     private void testOpenAndReadData(SparseArray<long[]> expectedData) {
         try (BpfMapIterator iter = mReader.open()) {
             long[] actual;
diff --git a/core/tests/hdmitests/Android.bp b/core/tests/hdmitests/Android.bp
new file mode 100644
index 0000000..2194d4b
--- /dev/null
+++ b/core/tests/hdmitests/Android.bp
@@ -0,0 +1,27 @@
+// Copyright (C) 2018 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.
+
+android_test {
+    name: "HdmiCecTests",
+    // Include all test java files
+    srcs: ["src/**/*.java"],
+    static_libs: [
+        "androidx.test.rules",
+        "frameworks-base-testutils",
+        "truth-prebuilt",
+    ],
+    libs: ["android.test.runner"],
+    platform_apis: true,
+    certificate: "platform",
+}
diff --git a/core/tests/hdmitests/Android.mk b/core/tests/hdmitests/Android.mk
deleted file mode 100644
index f155feb..0000000
--- a/core/tests/hdmitests/Android.mk
+++ /dev/null
@@ -1,31 +0,0 @@
-# Copyright (C) 2018 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.
-
-LOCAL_PATH := $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := tests
-
-# Include all test java files
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules frameworks-base-testutils truth-prebuilt
-
-LOCAL_JAVA_LIBRARIES := android.test.runner
-LOCAL_PACKAGE_NAME := HdmiCecTests
-LOCAL_PRIVATE_PLATFORM_APIS := true
-
-LOCAL_CERTIFICATE := platform
-
-include $(BUILD_PACKAGE)
diff --git a/core/tests/hosttests/test-apps/SharedUid/32/jni/Android.bp b/core/tests/hosttests/test-apps/SharedUid/32/jni/Android.bp
index 6db0ba5..9e6c17f 100644
--- a/core/tests/hosttests/test-apps/SharedUid/32/jni/Android.bp
+++ b/core/tests/hosttests/test-apps/SharedUid/32/jni/Android.bp
@@ -26,6 +26,7 @@
     // All of the source files that we will compile.
     srcs: ["native.cpp"],
 
+    header_libs: ["jni_headers"],
     shared_libs: ["liblog"],
 
     cflags: [
diff --git a/core/tests/hosttests/test-apps/SharedUid/64/jni/Android.bp b/core/tests/hosttests/test-apps/SharedUid/64/jni/Android.bp
index 582f2a7..91da6e4 100644
--- a/core/tests/hosttests/test-apps/SharedUid/64/jni/Android.bp
+++ b/core/tests/hosttests/test-apps/SharedUid/64/jni/Android.bp
@@ -25,6 +25,7 @@
     // All of the source files that we will compile.
     srcs: ["native.cpp"],
 
+    header_libs: ["jni_headers"],
     shared_libs: ["liblog"],
 
     cflags: [
diff --git a/core/tests/hosttests/test-apps/SharedUid/dual/jni/Android.bp b/core/tests/hosttests/test-apps/SharedUid/dual/jni/Android.bp
index 3e043afe..662755d 100644
--- a/core/tests/hosttests/test-apps/SharedUid/dual/jni/Android.bp
+++ b/core/tests/hosttests/test-apps/SharedUid/dual/jni/Android.bp
@@ -27,6 +27,7 @@
     // All of the source files that we will compile.
     srcs: ["native.cpp"],
 
+    header_libs: ["jni_headers"],
     shared_libs: ["liblog"],
 
     cflags: [
diff --git a/core/tests/packagemanagertests/Android.bp b/core/tests/packagemanagertests/Android.bp
new file mode 100644
index 0000000..6f39af8
--- /dev/null
+++ b/core/tests/packagemanagertests/Android.bp
@@ -0,0 +1,14 @@
+android_test {
+    name: "FrameworksCorePackageManagerTests",
+    // We only want this apk build for tests.
+    // Include all test java files.
+    srcs: ["src/**/*.java"],
+    static_libs: [
+        "androidx.test.rules",
+        "frameworks-base-testutils",
+        "mockito-target-minus-junit4",
+    ],
+    libs: ["android.test.runner"],
+    platform_apis: true,
+    certificate: "platform",
+}
diff --git a/core/tests/packagemanagertests/Android.mk b/core/tests/packagemanagertests/Android.mk
deleted file mode 100644
index 8c00d14..0000000
--- a/core/tests/packagemanagertests/Android.mk
+++ /dev/null
@@ -1,22 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-# We only want this apk build for tests.
-LOCAL_MODULE_TAGS := tests
-
-# Include all test java files.
-LOCAL_SRC_FILES := \
-    $(call all-java-files-under, src)
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
-    androidx.test.rules \
-    frameworks-base-testutils \
-    mockito-target-minus-junit4
-
-LOCAL_JAVA_LIBRARIES := android.test.runner
-LOCAL_PACKAGE_NAME := FrameworksCorePackageManagerTests
-LOCAL_PRIVATE_PLATFORM_APIS := true
-
-LOCAL_CERTIFICATE := platform
-
-include $(BUILD_PACKAGE)
diff --git a/core/tests/privacytests/Android.bp b/core/tests/privacytests/Android.bp
new file mode 100644
index 0000000..7f56992
--- /dev/null
+++ b/core/tests/privacytests/Android.bp
@@ -0,0 +1,14 @@
+android_test {
+    name: "FrameworksPrivacyLibraryTests",
+    srcs: ["src/**/*.java"],
+    static_libs: [
+        "junit",
+        "rappor-tests",
+        "androidx.test.rules",
+        "truth-prebuilt",
+    ],
+    libs: ["android.test.runner"],
+    platform_apis: true,
+    certificate: "platform",
+    test_suites: ["device-tests"],
+}
diff --git a/core/tests/privacytests/Android.mk b/core/tests/privacytests/Android.mk
deleted file mode 100644
index 7765977..0000000
--- a/core/tests/privacytests/Android.mk
+++ /dev/null
@@ -1,20 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-# We only want this apk build for tests.
-LOCAL_MODULE_TAGS := tests
-
-# Include all test java files.
-LOCAL_SRC_FILES := \
-    $(call all-java-files-under, src)
-
-LOCAL_STATIC_JAVA_LIBRARIES := junit rappor-tests androidx.test.rules truth-prebuilt
-
-LOCAL_JAVA_LIBRARIES := android.test.runner
-LOCAL_PACKAGE_NAME := FrameworksPrivacyLibraryTests
-LOCAL_PRIVATE_PLATFORM_APIS := true
-
-LOCAL_CERTIFICATE := platform
-LOCAL_COMPATIBILITY_SUITE := device-tests
-
-include $(BUILD_PACKAGE)
diff --git a/core/tests/utiltests/Android.bp b/core/tests/utiltests/Android.bp
index f13885e..a9b9c41 100644
--- a/core/tests/utiltests/Android.bp
+++ b/core/tests/utiltests/Android.bp
@@ -8,7 +8,10 @@
     // We only want this apk build for tests.
 
     // Include all test java files.
-    srcs: ["src/**/*.java"] + ["src/android/util/IRemoteMemoryIntArray.aidl"],
+    srcs: [
+        "src/**/*.java",
+        "src/android/util/IRemoteMemoryIntArray.aidl",
+    ],
 
     jni_libs: [
         "libmemoryintarraytest",
diff --git a/core/tests/utiltests/jni/Android.bp b/core/tests/utiltests/jni/Android.bp
index b0b09c2..6b75471 100644
--- a/core/tests/utiltests/jni/Android.bp
+++ b/core/tests/utiltests/jni/Android.bp
@@ -14,6 +14,7 @@
 

 cc_library_shared {

     name: "libmemoryintarraytest",

+    header_libs: ["jni_headers"],

     shared_libs: [

         "libcutils",

     ],

@@ -23,4 +24,4 @@
         "android_util_MemoryIntArrayTest.cpp",

     ],

     cflags: ["-Werror"],

-}
\ No newline at end of file
+}

diff --git a/core/xsd/vts/Android.bp b/core/xsd/vts/Android.bp
index ca655f1..4b43b41 100644
--- a/core/xsd/vts/Android.bp
+++ b/core/xsd/vts/Android.bp
@@ -40,3 +40,7 @@
     ],
     test_config: "vts_permission_validate_test.xml",
 }
+
+vts_config {
+    name: "VtsValidatePermission",
+}
diff --git a/core/xsd/vts/Android.mk b/core/xsd/vts/Android.mk
deleted file mode 100644
index a5754a4..0000000
--- a/core/xsd/vts/Android.mk
+++ /dev/null
@@ -1,22 +0,0 @@
-#
-# Copyright (C) 2019 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.
-#
-
-LOCAL_PATH := $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := VtsValidatePermission
-include test/vts/tools/build/Android.host_config.mk
diff --git a/data/fonts/Android.bp b/data/fonts/Android.bp
new file mode 100644
index 0000000..3a3bea4
--- /dev/null
+++ b/data/fonts/Android.bp
@@ -0,0 +1,38 @@
+// Copyright (C) 2011 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.
+
+prebuilt_font {
+    name: "DroidSansMono.ttf",
+    src: "DroidSansMono.ttf",
+    required: [
+        // Roboto-Regular.ttf provides DroidSans.ttf as a symlink to itself
+        "Roboto-Regular.ttf",
+        // Roboto-Bold.ttf provides DroidSans-Bold.ttf as a symlink to itself
+        "Roboto-Bold.ttf",
+    ],
+}
+
+prebuilt_font {
+    name: "AndroidClock.ttf",
+    src: "AndroidClock.ttf",
+}
+
+/////////////////////////////////
+// Copies the font configuration file into system/etc for the product as fonts.xml.
+// Additional fonts should be installed to /product/fonts/ alongside a corresponding
+// fonts_customiztion.xml in /product/etc/
+prebuilt_etc {
+    name: "fonts.xml",
+    src: "fonts.xml",
+}
diff --git a/data/fonts/Android.mk b/data/fonts/Android.mk
index 4226e08..a322b82 100644
--- a/data/fonts/Android.mk
+++ b/data/fonts/Android.mk
@@ -12,87 +12,8 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-# We have to use BUILD_PREBUILT instead of PRODUCT_COPY_FIES,
-# because MINIMAL_FONT_FOOTPRINT is only available in Android.mks.
-
 LOCAL_PATH := $(call my-dir)
 
-##########################################
-# create symlink for given font
-# $(1): new font $(2): link target
-# should be used with eval: $(eval $(call ...))
-define create-font-symlink
-$(PRODUCT_OUT)/system/fonts/$(1) : $(PRODUCT_OUT)/system/fonts/$(2)
-	@echo "Symlink: $$@ -> $$<"
-	@mkdir -p $$(dir $$@)
-	@rm -rf $$@
-	$(hide) ln -sf $$(notdir $$<) $$@
-# this magic makes LOCAL_REQUIRED_MODULES work
-ALL_MODULES.$(1).INSTALLED := \
-    $(ALL_MODULES.$(1).INSTALLED) $(PRODUCT_OUT)/system/fonts/$(1)
-endef
-
-##########################################
-# The following fonts are just symlinks, for backward compatibility.
-##########################################
-$(eval $(call create-font-symlink,DroidSans.ttf,Roboto-Regular.ttf))
-$(eval $(call create-font-symlink,DroidSans-Bold.ttf,Roboto-Bold.ttf))
-$(eval $(call create-font-symlink,DroidSerif-Regular.ttf,NotoSerif-Regular.ttf))
-$(eval $(call create-font-symlink,DroidSerif-Bold.ttf,NotoSerif-Bold.ttf))
-$(eval $(call create-font-symlink,DroidSerif-Italic.ttf,NotoSerif-Italic.ttf))
-$(eval $(call create-font-symlink,DroidSerif-BoldItalic.ttf,NotoSerif-BoldItalic.ttf))
-
-extra_font_files := \
-    DroidSans.ttf \
-    DroidSans-Bold.ttf
-
-################################
-# Use DroidSansMono to hang extra_font_files on
-include $(CLEAR_VARS)
-LOCAL_MODULE := DroidSansMono.ttf
-LOCAL_SRC_FILES := $(LOCAL_MODULE)
-LOCAL_MODULE_CLASS := ETC
-LOCAL_MODULE_TAGS := optional
-LOCAL_MODULE_PATH := $(TARGET_OUT)/fonts
-LOCAL_REQUIRED_MODULES := $(extra_font_files)
-include $(BUILD_PREBUILT)
-extra_font_files :=
-
-################################
-# Build the rest of font files as prebuilt.
-
-# $(1): The source file name in LOCAL_PATH.
-#       It also serves as the module name and the dest file name.
-define build-one-font-module
-$(eval include $(CLEAR_VARS))\
-$(eval LOCAL_MODULE := $(1))\
-$(eval LOCAL_SRC_FILES := $(1))\
-$(eval LOCAL_MODULE_CLASS := ETC)\
-$(eval LOCAL_MODULE_TAGS := optional)\
-$(eval LOCAL_MODULE_PATH := $(TARGET_OUT)/fonts)\
-$(eval include $(BUILD_PREBUILT))
-endef
-
-font_src_files := \
-    AndroidClock.ttf
-
-$(foreach f, $(font_src_files), $(call build-one-font-module, $(f)))
-
-build-one-font-module :=
-font_src_files :=
-
-################################
-# Copies the font configuration file into system/etc for the product as fonts.xml.
-# Additional fonts should be installed to /product/fonts/ alongside a corresponding
-# fonts_customiztion.xml in /product/etc/
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := fonts.xml
-LOCAL_MODULE_CLASS := ETC
-LOCAL_PREBUILT_MODULE_FILE := frameworks/base/data/fonts/fonts.xml
-
-include $(BUILD_PREBUILT)
-
 # Run sanity tests on fonts on checkbuild
 checkbuild: fontchain_lint
 
diff --git a/data/keyboards/Vendor_0a5c_Product_8502.kl b/data/keyboards/Vendor_0a5c_Product_8502.kl
new file mode 100644
index 0000000..6d4a163
--- /dev/null
+++ b/data/keyboards/Vendor_0a5c_Product_8502.kl
@@ -0,0 +1,37 @@
+# Copyright (C) 2020 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.
+
+# SnakeByte iDroid:con
+
+key 304   BUTTON_A
+key 305   BUTTON_B
+key 306   BUTTON_THUMBL
+key 307   BUTTON_X
+key 308   BUTTON_Y
+key 309   BUTTON_THUMBR
+key 310   BUTTON_L1
+key 311   BUTTON_R1
+key 312   BUTTON_L2
+key 313   BUTTON_R2
+key 314   BUTTON_SELECT
+key 315   BUTTON_START
+
+axis 0x00 X
+axis 0x01 Y
+axis 0x02 Z
+axis 0x03 RX
+axis 0x04 RY
+axis 0x05 RZ
+axis 0x10 HAT_X
+axis 0x11 HAT_Y
diff --git a/data/keyboards/Vendor_0f0d_Product_00c1.kl b/data/keyboards/Vendor_0f0d_Product_00c1.kl
new file mode 100644
index 0000000..c74512a
--- /dev/null
+++ b/data/keyboards/Vendor_0f0d_Product_00c1.kl
@@ -0,0 +1,55 @@
+# Copyright (C) 2020 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.
+
+# Device name: HORI CO.,LTD. HORIPAD S
+# HORIPAD for Nintendo Switch, USB game controller
+# https://hori.co.uk/horipad-for-nintendo-switch/
+
+# Button labeled as "Y" but should really produce keycode "X"
+key 0x130 BUTTON_X
+# Button labeled as "B" but should really produce keycode "A"
+key 0x131 BUTTON_A
+# Button labeled as "A" but should really produce keycode "B"
+key 0x132 BUTTON_B
+# Button labeled as "X" but should really product keycode "Y"
+key 0x133 BUTTON_Y
+
+key 0x134 BUTTON_L1
+key 0x135 BUTTON_R1
+key 0x136 BUTTON_L2
+key 0x137 BUTTON_R2
+
+# Minus
+key 0x138 BUTTON_SELECT
+# Plus
+key 0x139 BUTTON_START
+
+# Analog stick buttons
+key 0x13a BUTTON_THUMBL
+key 0x13b BUTTON_THUMBR
+
+# Home
+key 0x13c HOME
+# Capture
+key 0x13d BUTTON_MODE
+
+# Left analog stick
+axis 0x00 X
+axis 0x01 Y
+# Right analog stick
+axis 0x02 Z
+axis 0x05 RZ
+# D-pad
+axis 0x10 HAT_X
+axis 0x11 HAT_Y
diff --git a/drm/jni/android_drm_DrmManagerClient.cpp b/drm/jni/android_drm_DrmManagerClient.cpp
index 52ea8e3..e2bb6a6 100644
--- a/drm/jni/android_drm_DrmManagerClient.cpp
+++ b/drm/jni/android_drm_DrmManagerClient.cpp
@@ -19,7 +19,7 @@
 #include <utils/Log.h>
 
 #include <jni.h>
-#include <nativehelper/JNIHelp.h>
+#include <nativehelper/JNIPlatformHelp.h>
 #include <nativehelper/ScopedLocalRef.h>
 #include <android_runtime/AndroidRuntime.h>
 
diff --git a/errorprone/Android.bp b/errorprone/Android.bp
index 098f4bf..7d0557d 100644
--- a/errorprone/Android.bp
+++ b/errorprone/Android.bp
@@ -14,10 +14,13 @@
 
     static_libs: [
         "//external/error_prone:error_prone_core",
-        "//external/dagger2:dagger2-auto-service",
+    ],
+
+    libs: [
+        "//external/auto:auto_service_annotations",
     ],
 
     plugins: [
-        "//external/dagger2:dagger2-auto-service",
+        "//external/auto:auto_service_plugin",
     ],
 }
diff --git a/graphics/java/android/graphics/GraphicsStatsService.java b/graphics/java/android/graphics/GraphicsStatsService.java
index 8dfd6ee..2d6848b 100644
--- a/graphics/java/android/graphics/GraphicsStatsService.java
+++ b/graphics/java/android/graphics/GraphicsStatsService.java
@@ -16,7 +16,6 @@
 
 package android.graphics;
 
-import android.annotation.SystemApi;
 import android.app.AlarmManager;
 import android.app.AppOpsManager;
 import android.content.Context;
@@ -100,7 +99,6 @@
     private Handler mWriteOutHandler;
     private boolean mRotateIsScheduled = false;
 
-    @SystemApi
     public GraphicsStatsService(Context context) {
         mContext = context;
         mAppOps = context.getSystemService(AppOpsManager.class);
diff --git a/keystore/java/android/security/keystore/AndroidKeyStoreKeyPairGeneratorSpi.java b/keystore/java/android/security/keystore/AndroidKeyStoreKeyPairGeneratorSpi.java
index c52fd48..d4cf53e 100644
--- a/keystore/java/android/security/keystore/AndroidKeyStoreKeyPairGeneratorSpi.java
+++ b/keystore/java/android/security/keystore/AndroidKeyStoreKeyPairGeneratorSpi.java
@@ -17,6 +17,7 @@
 package android.security.keystore;
 
 import android.annotation.Nullable;
+import android.os.Build;
 import android.security.Credentials;
 import android.security.KeyPairGeneratorSpec;
 import android.security.KeyStore;
@@ -50,6 +51,7 @@
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 import java.math.BigInteger;
+import java.nio.charset.StandardCharsets;
 import java.security.InvalidAlgorithmParameterException;
 import java.security.KeyPair;
 import java.security.KeyPairGenerator;
@@ -495,6 +497,20 @@
         if (challenge != null) {
             KeymasterArguments args = new KeymasterArguments();
             args.addBytes(KeymasterDefs.KM_TAG_ATTESTATION_CHALLENGE, challenge);
+
+            if (mSpec.isDevicePropertiesAttestationIncluded()) {
+                args.addBytes(KeymasterDefs.KM_TAG_ATTESTATION_ID_BRAND,
+                        Build.BRAND.getBytes(StandardCharsets.UTF_8));
+                args.addBytes(KeymasterDefs.KM_TAG_ATTESTATION_ID_DEVICE,
+                        Build.DEVICE.getBytes(StandardCharsets.UTF_8));
+                args.addBytes(KeymasterDefs.KM_TAG_ATTESTATION_ID_PRODUCT,
+                        Build.PRODUCT.getBytes(StandardCharsets.UTF_8));
+                args.addBytes(KeymasterDefs.KM_TAG_ATTESTATION_ID_MANUFACTURER,
+                        Build.MANUFACTURER.getBytes(StandardCharsets.UTF_8));
+                args.addBytes(KeymasterDefs.KM_TAG_ATTESTATION_ID_MODEL,
+                        Build.MODEL.getBytes(StandardCharsets.UTF_8));
+            }
+
             return getAttestationChain(privateKeyAlias, keyPair, args);
         }
 
@@ -604,8 +620,14 @@
     private Iterable<byte[]> getAttestationChain(String privateKeyAlias,
             KeyPair keyPair, KeymasterArguments args)
                     throws ProviderException {
-        KeymasterCertificateChain outChain = new KeymasterCertificateChain();
-        int errorCode = mKeyStore.attestKey(privateKeyAlias, args, outChain);
+        final KeymasterCertificateChain outChain = new KeymasterCertificateChain();
+        final int errorCode;
+        if (mSpec.isDevicePropertiesAttestationIncluded()
+                && mSpec.getAttestationChallenge() == null) {
+            throw new ProviderException("An attestation challenge must be provided when requesting "
+                    + "device properties attestation.");
+        }
+        errorCode = mKeyStore.attestKey(privateKeyAlias, args, outChain);
         if (errorCode != KeyStore.NO_ERROR) {
             throw new ProviderException("Failed to generate attestation certificate chain",
                     KeyStore.getKeyStoreException(errorCode));
diff --git a/keystore/java/android/security/keystore/KeyGenParameterSpec.java b/keystore/java/android/security/keystore/KeyGenParameterSpec.java
index a7d0cb8..688c4a7 100644
--- a/keystore/java/android/security/keystore/KeyGenParameterSpec.java
+++ b/keystore/java/android/security/keystore/KeyGenParameterSpec.java
@@ -25,6 +25,7 @@
 import android.compat.annotation.UnsupportedAppUsage;
 import android.hardware.biometrics.BiometricManager;
 import android.hardware.biometrics.BiometricPrompt;
+import android.os.Build;
 import android.security.GateKeeper;
 import android.security.KeyStore;
 import android.text.TextUtils;
@@ -266,6 +267,7 @@
     private final @KeyProperties.AuthEnum int mUserAuthenticationType;
     private final boolean mUserPresenceRequired;
     private final byte[] mAttestationChallenge;
+    private final boolean mDevicePropertiesAttestationIncluded;
     private final boolean mUniqueIdIncluded;
     private final boolean mUserAuthenticationValidWhileOnBody;
     private final boolean mInvalidatedByBiometricEnrollment;
@@ -305,6 +307,7 @@
             @KeyProperties.AuthEnum int userAuthenticationType,
             boolean userPresenceRequired,
             byte[] attestationChallenge,
+            boolean devicePropertiesAttestationIncluded,
             boolean uniqueIdIncluded,
             boolean userAuthenticationValidWhileOnBody,
             boolean invalidatedByBiometricEnrollment,
@@ -356,6 +359,7 @@
         mUserAuthenticationValidityDurationSeconds = userAuthenticationValidityDurationSeconds;
         mUserAuthenticationType = userAuthenticationType;
         mAttestationChallenge = Utils.cloneIfNotNull(attestationChallenge);
+        mDevicePropertiesAttestationIncluded = devicePropertiesAttestationIncluded;
         mUniqueIdIncluded = uniqueIdIncluded;
         mUserAuthenticationValidWhileOnBody = userAuthenticationValidWhileOnBody;
         mInvalidatedByBiometricEnrollment = invalidatedByBiometricEnrollment;
@@ -667,6 +671,21 @@
     }
 
     /**
+     * Returns {@code true} if attestation for the base device properties ({@link Build#BRAND},
+     * {@link Build#DEVICE}, {@link Build#MANUFACTURER}, {@link Build#MODEL}, {@link Build#PRODUCT})
+     * was requested to be added in the attestation certificate for the generated key.
+     *
+     * {@link javax.crypto.KeyGenerator#generateKey()} will throw
+     * {@link java.security.ProviderException} if device properties attestation fails or is not
+     * supported.
+     *
+     * @see Builder#setDevicePropertiesAttestationIncluded(boolean)
+     */
+    public boolean isDevicePropertiesAttestationIncluded() {
+        return mDevicePropertiesAttestationIncluded;
+    }
+
+    /**
      * @hide This is a system-only API
      *
      * Returns {@code true} if the attestation certificate will contain a unique ID field.
@@ -769,6 +788,7 @@
                 KeyProperties.AUTH_BIOMETRIC_STRONG;
         private boolean mUserPresenceRequired = false;
         private byte[] mAttestationChallenge = null;
+        private boolean mDevicePropertiesAttestationIncluded = false;
         private boolean mUniqueIdIncluded = false;
         private boolean mUserAuthenticationValidWhileOnBody;
         private boolean mInvalidatedByBiometricEnrollment = true;
@@ -834,6 +854,8 @@
             mUserAuthenticationType = sourceSpec.getUserAuthenticationType();
             mUserPresenceRequired = sourceSpec.isUserPresenceRequired();
             mAttestationChallenge = sourceSpec.getAttestationChallenge();
+            mDevicePropertiesAttestationIncluded =
+                    sourceSpec.isDevicePropertiesAttestationIncluded();
             mUniqueIdIncluded = sourceSpec.isUniqueIdIncluded();
             mUserAuthenticationValidWhileOnBody = sourceSpec.isUserAuthenticationValidWhileOnBody();
             mInvalidatedByBiometricEnrollment = sourceSpec.isInvalidatedByBiometricEnrollment();
@@ -1340,6 +1362,31 @@
         }
 
         /**
+         * Sets whether to include the base device properties in the attestation certificate.
+         *
+         * <p>If {@code attestationChallenge} is not {@code null}, the public key certificate for
+         * this key pair will contain an extension that describes the details of the key's
+         * configuration and authorizations, including the device properties values (brand, device,
+         * manufacturer, model, product). These should be the same as in ({@link Build#BRAND},
+         * {@link Build#DEVICE}, {@link Build#MANUFACTURER}, {@link Build#MODEL},
+         * {@link Build#PRODUCT}). The attestation certificate chain can
+         * be retrieved with {@link java.security.KeyStore#getCertificateChain(String)}.
+         *
+         * <p> If {@code attestationChallenge} is {@code null}, the public key certificate for
+         * this key pair will not contain the extension with the requested attested values.
+         *
+         * <p> {@link javax.crypto.KeyGenerator#generateKey()} will throw
+         * {@link java.security.ProviderException} if device properties attestation fails or is not
+         * supported.
+         */
+        @NonNull
+        public Builder setDevicePropertiesAttestationIncluded(
+                boolean devicePropertiesAttestationIncluded) {
+            mDevicePropertiesAttestationIncluded = devicePropertiesAttestationIncluded;
+            return this;
+        }
+
+        /**
          * @hide Only system apps can use this method.
          *
          * Sets whether to include a temporary unique ID field in the attestation certificate.
@@ -1463,6 +1510,7 @@
                     mUserAuthenticationType,
                     mUserPresenceRequired,
                     mAttestationChallenge,
+                    mDevicePropertiesAttestationIncluded,
                     mUniqueIdIncluded,
                     mUserAuthenticationValidWhileOnBody,
                     mInvalidatedByBiometricEnrollment,
diff --git a/keystore/java/android/security/keystore/ParcelableKeyGenParameterSpec.java b/keystore/java/android/security/keystore/ParcelableKeyGenParameterSpec.java
index 9c9773e..69c15cc 100644
--- a/keystore/java/android/security/keystore/ParcelableKeyGenParameterSpec.java
+++ b/keystore/java/android/security/keystore/ParcelableKeyGenParameterSpec.java
@@ -100,6 +100,7 @@
         out.writeInt(mSpec.getUserAuthenticationType());
         out.writeBoolean(mSpec.isUserPresenceRequired());
         out.writeByteArray(mSpec.getAttestationChallenge());
+        out.writeBoolean(mSpec.isDevicePropertiesAttestationIncluded());
         out.writeBoolean(mSpec.isUniqueIdIncluded());
         out.writeBoolean(mSpec.isUserAuthenticationValidWhileOnBody());
         out.writeBoolean(mSpec.isInvalidatedByBiometricEnrollment());
@@ -157,6 +158,7 @@
         final int userAuthenticationTypes = in.readInt();
         final boolean userPresenceRequired = in.readBoolean();
         final byte[] attestationChallenge = in.createByteArray();
+        final boolean devicePropertiesAttestationIncluded = in.readBoolean();
         final boolean uniqueIdIncluded = in.readBoolean();
         final boolean userAuthenticationValidWhileOnBody = in.readBoolean();
         final boolean invalidatedByBiometricEnrollment = in.readBoolean();
@@ -190,6 +192,7 @@
                 userAuthenticationTypes,
                 userPresenceRequired,
                 attestationChallenge,
+                devicePropertiesAttestationIncluded,
                 uniqueIdIncluded,
                 userAuthenticationValidWhileOnBody,
                 invalidatedByBiometricEnrollment,
diff --git a/keystore/tests/OWNERS b/keystore/tests/OWNERS
index 9e65f88..86c31f4 100644
--- a/keystore/tests/OWNERS
+++ b/keystore/tests/OWNERS
@@ -1,5 +1,4 @@
 # Android Enterprise security team
 eranm@google.com
-irinaid@google.com
 pgrafov@google.com
 rubinxu@google.com
diff --git a/libs/androidfw/OWNERS b/libs/androidfw/OWNERS
index 8cffd6a..bc056df 100644
--- a/libs/androidfw/OWNERS
+++ b/libs/androidfw/OWNERS
@@ -3,4 +3,4 @@
 rtmitchell@google.com
 
 per-file CursorWindow.cpp=omakoto@google.com
-per-file LocaleDataTables.cpp=vichang@google.com,tobiast@google.com,nikitai@google.com
+per-file LocaleDataTables.cpp=vichang@google.com,ngeoffray@google.com,nikitai@google.com
diff --git a/libs/androidfw/ZipUtils.cpp b/libs/androidfw/ZipUtils.cpp
index 5be2105..568e3b6 100644
--- a/libs/androidfw/ZipUtils.cpp
+++ b/libs/androidfw/ZipUtils.cpp
@@ -40,7 +40,7 @@
     explicit FileReader(FILE* fp) : Reader(), mFp(fp), mCurrentOffset(0) {
     }
 
-    bool ReadAtOffset(uint8_t* buf, size_t len, uint32_t offset) const {
+    bool ReadAtOffset(uint8_t* buf, size_t len, off64_t offset) const {
         // Data is usually requested sequentially, so this helps avoid pointless
         // fseeks every time we perform a read. There's an impedence mismatch
         // here because the original API was designed around pread and pwrite.
@@ -63,7 +63,7 @@
 
   private:
     FILE* mFp;
-    mutable uint32_t mCurrentOffset;
+    mutable off64_t mCurrentOffset;
 };
 
 class FdReader : public zip_archive::Reader {
@@ -71,8 +71,8 @@
     explicit FdReader(int fd) : mFd(fd) {
     }
 
-    bool ReadAtOffset(uint8_t* buf, size_t len, uint32_t offset) const {
-      return android::base::ReadFullyAtOffset(mFd, buf, len, static_cast<off_t>(offset));
+    bool ReadAtOffset(uint8_t* buf, size_t len, off64_t offset) const {
+      return android::base::ReadFullyAtOffset(mFd, buf, len, offset);
     }
 
   private:
@@ -86,8 +86,8 @@
         mInputSize(inputSize) {
     }
 
-    bool ReadAtOffset(uint8_t* buf, size_t len, uint32_t offset) const {
-        if (offset + len > mInputSize) {
+    bool ReadAtOffset(uint8_t* buf, size_t len, off64_t offset) const {
+        if (mInputSize < len || offset > mInputSize - len) {
             return false;
         }
 
diff --git a/libs/androidfw/include/androidfw/ConfigDescription.h b/libs/androidfw/include/androidfw/ConfigDescription.h
index 6fa089a..acf413a 100644
--- a/libs/androidfw/include/androidfw/ConfigDescription.h
+++ b/libs/androidfw/include/androidfw/ConfigDescription.h
@@ -151,8 +151,8 @@
   size = sizeof(android::ResTable_config);
 }
 
-inline ConfigDescription::ConfigDescription(const ConfigDescription& o) {
-  *static_cast<android::ResTable_config*>(this) = o;
+inline ConfigDescription::ConfigDescription(const ConfigDescription& o)
+  : android::ResTable_config(o) {
 }
 
 inline ConfigDescription::ConfigDescription(ConfigDescription&& o) noexcept {
diff --git a/libs/androidfw/tests/CommonHelpers.h b/libs/androidfw/tests/CommonHelpers.h
index 8af13f2..316a57a 100644
--- a/libs/androidfw/tests/CommonHelpers.h
+++ b/libs/androidfw/tests/CommonHelpers.h
@@ -21,8 +21,6 @@
 #include <string>
 
 #include "androidfw/ResourceTypes.h"
-#include "utils/String16.h"
-#include "utils/String8.h"
 
 namespace android {
 
@@ -40,10 +38,6 @@
   return a.compare(b) == 0;
 }
 
-static inline ::std::ostream& operator<<(::std::ostream& out, const String8& str) {
-  return out << str.string();
-}
-
 static inline ::std::ostream& operator<<(::std::ostream& out, const ResTable_config& c) {
   return out << c.toString();
 }
diff --git a/libs/hwui/PathParser.cpp b/libs/hwui/PathParser.cpp
index 808921d..61d06c2 100644
--- a/libs/hwui/PathParser.cpp
+++ b/libs/hwui/PathParser.cpp
@@ -16,8 +16,6 @@
 
 #include "PathParser.h"
 
-#include "jni.h"
-
 #include <errno.h>
 #include <stdlib.h>
 #include <utils/Log.h>
diff --git a/libs/hwui/PathParser.h b/libs/hwui/PathParser.h
index f5bebce..878bb7c 100644
--- a/libs/hwui/PathParser.h
+++ b/libs/hwui/PathParser.h
@@ -22,7 +22,6 @@
 
 #include <android/log.h>
 #include <cutils/compiler.h>
-#include <jni.h>
 
 #include <string>
 
diff --git a/libs/hwui/jni/BitmapFactory.cpp b/libs/hwui/jni/BitmapFactory.cpp
index d4e27d8..e8e89d8 100644
--- a/libs/hwui/jni/BitmapFactory.cpp
+++ b/libs/hwui/jni/BitmapFactory.cpp
@@ -16,7 +16,7 @@
 #include "Utils.h"
 
 #include <HardwareBitmapUploader.h>
-#include <nativehelper/JNIHelp.h>
+#include <nativehelper/JNIPlatformHelp.h>
 #include <androidfw/Asset.h>
 #include <androidfw/ResourceTypes.h>
 #include <cutils/compiler.h>
diff --git a/libs/hwui/jni/android_graphics_HardwareRenderer.cpp b/libs/hwui/jni/android_graphics_HardwareRenderer.cpp
index 49c7fcd..9815e85 100644
--- a/libs/hwui/jni/android_graphics_HardwareRenderer.cpp
+++ b/libs/hwui/jni/android_graphics_HardwareRenderer.cpp
@@ -27,7 +27,7 @@
 #include <inttypes.h>
 #include <media/NdkImage.h>
 #include <media/NdkImageReader.h>
-#include <nativehelper/JNIHelp.h>
+#include <nativehelper/JNIPlatformHelp.h>
 #include <pipeline/skia/ShaderCache.h>
 #include <private/EGL/cache.h>
 #include <renderthread/CanvasContext.h>
diff --git a/libs/hwui/jni/android_nio_utils.cpp b/libs/hwui/jni/android_nio_utils.cpp
index c2b09c1..0663821 100644
--- a/libs/hwui/jni/android_nio_utils.cpp
+++ b/libs/hwui/jni/android_nio_utils.cpp
@@ -16,7 +16,7 @@
 
 #include "android_nio_utils.h"
 
-#include <nativehelper/JNIHelp.h>
+#include <nativehelper/JNIPlatformHelp.h>
 
 namespace android {
 
diff --git a/libs/hwui/jni/android_nio_utils.h b/libs/hwui/jni/android_nio_utils.h
index 4aaa0a7..4760d9c 100644
--- a/libs/hwui/jni/android_nio_utils.h
+++ b/libs/hwui/jni/android_nio_utils.h
@@ -17,7 +17,9 @@
 #ifndef _ANDROID_NIO_UTILS_H_
 #define _ANDROID_NIO_UTILS_H_
 
-#include <nativehelper/JNIHelp.h>
+#include <jni.h>
+
+#include <cstddef>
 
 namespace android {
 
diff --git a/libs/hwui/jni/graphics_jni_helpers.h b/libs/hwui/jni/graphics_jni_helpers.h
index b97cc6a..78db54a 100644
--- a/libs/hwui/jni/graphics_jni_helpers.h
+++ b/libs/hwui/jni/graphics_jni_helpers.h
@@ -18,7 +18,7 @@
 #define GRAPHICS_JNI_HELPERS
 
 #include <log/log.h>
-#include <nativehelper/JNIHelp.h>
+#include <nativehelper/JNIPlatformHelp.h>
 #include <nativehelper/scoped_local_ref.h>
 #include <nativehelper/scoped_utf_chars.h>
 #include <string>
diff --git a/libs/input/Android.bp b/libs/input/Android.bp
index 88d6033..5252cd0 100644
--- a/libs/input/Android.bp
+++ b/libs/input/Android.bp
@@ -17,6 +17,7 @@
     srcs: [
         "PointerController.cpp",
         "SpriteController.cpp",
+        "SpriteIcon.cpp",
     ],
 
     shared_libs: [
diff --git a/libs/input/SpriteController.cpp b/libs/input/SpriteController.cpp
index 804644c..acd8bce 100644
--- a/libs/input/SpriteController.cpp
+++ b/libs/input/SpriteController.cpp
@@ -23,11 +23,6 @@
 #include <utils/String8.h>
 #include <gui/Surface.h>
 
-#include <android/graphics/bitmap.h>
-#include <android/graphics/canvas.h>
-#include <android/graphics/paint.h>
-#include <android/native_window.h>
-
 namespace android {
 
 // --- SpriteController ---
@@ -130,8 +125,8 @@
         SpriteUpdate& update = updates.editItemAt(i);
 
         if (update.state.surfaceControl == NULL && update.state.wantSurfaceVisible()) {
-            update.state.surfaceWidth = update.state.icon.bitmap.getInfo().width;
-            update.state.surfaceHeight = update.state.icon.bitmap.getInfo().height;
+            update.state.surfaceWidth = update.state.icon.width();
+            update.state.surfaceHeight = update.state.icon.height();
             update.state.surfaceDrawn = false;
             update.state.surfaceVisible = false;
             update.state.surfaceControl = obtainSurface(
@@ -152,8 +147,8 @@
         }
 
         if (update.state.wantSurfaceVisible()) {
-            int32_t desiredWidth = update.state.icon.bitmap.getInfo().width;
-            int32_t desiredHeight = update.state.icon.bitmap.getInfo().height;
+            int32_t desiredWidth = update.state.icon.width();
+            int32_t desiredHeight = update.state.icon.height();
             if (update.state.surfaceWidth < desiredWidth
                     || update.state.surfaceHeight < desiredHeight) {
                 needApplyTransaction = true;
@@ -194,36 +189,9 @@
         if (update.state.surfaceControl != NULL && !update.state.surfaceDrawn
                 && update.state.wantSurfaceVisible()) {
             sp<Surface> surface = update.state.surfaceControl->getSurface();
-            ANativeWindow_Buffer outBuffer;
-            status_t status = surface->lock(&outBuffer, NULL);
-            if (status) {
-                ALOGE("Error %d locking sprite surface before drawing.", status);
-            } else {
-                graphics::Paint paint;
-                paint.setBlendMode(ABLEND_MODE_SRC);
-
-                graphics::Canvas canvas(outBuffer, (int32_t) surface->getBuffersDataSpace());
-                canvas.drawBitmap(update.state.icon.bitmap, 0, 0, &paint);
-
-                const int iconWidth = update.state.icon.bitmap.getInfo().width;
-                const int iconHeight = update.state.icon.bitmap.getInfo().height;
-
-                if (outBuffer.width > iconWidth) {
-                    paint.setBlendMode(ABLEND_MODE_CLEAR); // clear to transparent
-                    canvas.drawRect({iconWidth, 0, outBuffer.width, iconHeight}, paint);
-                }
-                if (outBuffer.height > iconHeight) {
-                    paint.setBlendMode(ABLEND_MODE_CLEAR); // clear to transparent
-                    canvas.drawRect({0, iconHeight, outBuffer.width, outBuffer.height}, paint);
-                }
-
-                status = surface->unlockAndPost();
-                if (status) {
-                    ALOGE("Error %d unlocking and posting sprite surface after drawing.", status);
-                } else {
-                    update.state.surfaceDrawn = true;
-                    update.surfaceChanged = surfaceChanged = true;
-                }
+            if (update.state.icon.draw(surface)) {
+                update.state.surfaceDrawn = true;
+                update.surfaceChanged = surfaceChanged = true;
             }
         }
     }
diff --git a/libs/input/SpriteController.h b/libs/input/SpriteController.h
index 2513544..137b564 100644
--- a/libs/input/SpriteController.h
+++ b/libs/input/SpriteController.h
@@ -20,9 +20,10 @@
 #include <utils/RefBase.h>
 #include <utils/Looper.h>
 
-#include <android/graphics/bitmap.h>
 #include <gui/SurfaceComposerClient.h>
 
+#include "SpriteIcon.h"
+
 namespace android {
 
 /*
@@ -51,35 +52,6 @@
 };
 
 /*
- * Icon that a sprite displays, including its hotspot.
- */
-struct SpriteIcon {
-    inline SpriteIcon() : style(0), hotSpotX(0), hotSpotY(0) { }
-    inline SpriteIcon(const graphics::Bitmap& bitmap, int32_t style, float hotSpotX, float hotSpotY) :
-            bitmap(bitmap), style(style), hotSpotX(hotSpotX), hotSpotY(hotSpotY) { }
-
-    graphics::Bitmap bitmap;
-    int32_t style;
-    float hotSpotX;
-    float hotSpotY;
-
-    inline SpriteIcon copy() const {
-        return SpriteIcon(bitmap.copy(ANDROID_BITMAP_FORMAT_RGBA_8888), style, hotSpotX, hotSpotY);
-    }
-
-    inline void reset() {
-        bitmap.reset();
-        style = 0;
-        hotSpotX = 0;
-        hotSpotY = 0;
-    }
-
-    inline bool isValid() const {
-        return bitmap.isValid() && !bitmap.isEmpty();
-    }
-};
-
-/*
  * A sprite is a simple graphical object that is displayed on-screen above other layers.
  * The basic sprite class is an interface.
  * The implementation is provided by the sprite controller.
diff --git a/libs/input/SpriteIcon.cpp b/libs/input/SpriteIcon.cpp
new file mode 100644
index 0000000..b7e51e2
--- /dev/null
+++ b/libs/input/SpriteIcon.cpp
@@ -0,0 +1,60 @@
+/*
+ * Copyright (C) 2020 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 "SpriteIcon.h"
+
+#include <android/graphics/bitmap.h>
+#include <android/graphics/canvas.h>
+#include <android/graphics/paint.h>
+#include <android/native_window.h>
+#include <log/log.h>
+
+namespace android {
+
+bool SpriteIcon::draw(sp<Surface> surface) const {
+    ANativeWindow_Buffer outBuffer;
+    status_t status = surface->lock(&outBuffer, NULL);
+    if (status) {
+        ALOGE("Error %d locking sprite surface before drawing.", status);
+        return false;
+    }
+
+    graphics::Paint paint;
+    paint.setBlendMode(ABLEND_MODE_SRC);
+
+    graphics::Canvas canvas(outBuffer, (int32_t)surface->getBuffersDataSpace());
+    canvas.drawBitmap(bitmap, 0, 0, &paint);
+
+    const int iconWidth = width();
+    const int iconHeight = height();
+
+    if (outBuffer.width > iconWidth) {
+        paint.setBlendMode(ABLEND_MODE_CLEAR); // clear to transparent
+        canvas.drawRect({iconWidth, 0, outBuffer.width, iconHeight}, paint);
+    }
+    if (outBuffer.height > iconHeight) {
+        paint.setBlendMode(ABLEND_MODE_CLEAR); // clear to transparent
+        canvas.drawRect({0, iconHeight, outBuffer.width, outBuffer.height}, paint);
+    }
+
+    status = surface->unlockAndPost();
+    if (status) {
+        ALOGE("Error %d unlocking and posting sprite surface after drawing.", status);
+    }
+    return !status;
+}
+
+} // namespace android
diff --git a/libs/input/SpriteIcon.h b/libs/input/SpriteIcon.h
new file mode 100644
index 0000000..a257d7e
--- /dev/null
+++ b/libs/input/SpriteIcon.h
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2020 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.
+ */
+
+#ifndef _UI_SPRITE_ICON_H
+#define _UI_SPRITE_ICON_H
+
+#include <android/graphics/bitmap.h>
+#include <gui/Surface.h>
+
+namespace android {
+
+/*
+ * Icon that a sprite displays, including its hotspot.
+ */
+struct SpriteIcon {
+    inline SpriteIcon() : style(0), hotSpotX(0), hotSpotY(0) {}
+    inline SpriteIcon(const graphics::Bitmap& bitmap, int32_t style, float hotSpotX, float hotSpotY)
+          : bitmap(bitmap), style(style), hotSpotX(hotSpotX), hotSpotY(hotSpotY) {}
+
+    graphics::Bitmap bitmap;
+    int32_t style;
+    float hotSpotX;
+    float hotSpotY;
+
+    inline SpriteIcon copy() const {
+        return SpriteIcon(bitmap.copy(ANDROID_BITMAP_FORMAT_RGBA_8888), style, hotSpotX, hotSpotY);
+    }
+
+    inline void reset() {
+        bitmap.reset();
+        style = 0;
+        hotSpotX = 0;
+        hotSpotY = 0;
+    }
+
+    inline bool isValid() const { return bitmap.isValid() && !bitmap.isEmpty(); }
+
+    inline int32_t width() const { return bitmap.getInfo().width; }
+    inline int32_t height() const { return bitmap.getInfo().height; }
+
+    // Draw the bitmap onto the given surface. Returns true if it's successful, or false otherwise.
+    // Note it doesn't set any metadata to the surface.
+    bool draw(const sp<Surface> surface) const;
+};
+
+} // namespace android
+
+#endif // _UI_SPRITE_ICON_H
diff --git a/lowpan/tests/Android.bp b/lowpan/tests/Android.bp
new file mode 100644
index 0000000..ad2bc27
--- /dev/null
+++ b/lowpan/tests/Android.bp
@@ -0,0 +1,41 @@
+// Copyright (C) 2017 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.
+
+// Make test APK
+// ============================================================
+android_test {
+    name: "FrameworksLowpanApiTests",
+    srcs: ["**/*.java"],
+    // Filter all src files to just java files
+    jacoco: {
+        include_filter: ["android.net.lowpan.*"],
+        exclude_filter: [
+	    "android.net.lowpan.LowpanInterfaceTest*",
+	    "android.net.lowpan.LowpanManagerTest*",
+	],
+    },
+    static_libs: [
+        "androidx.test.rules",
+        "guava",
+        "mockito-target-minus-junit4",
+        "frameworks-base-testutils",
+    ],
+    libs: [
+        "android.test.runner",
+        "android.test.base",
+    ],
+    platform_apis: true,
+    test_suites: ["device-tests"],
+    certificate: "platform",
+}
diff --git a/lowpan/tests/Android.mk b/lowpan/tests/Android.mk
deleted file mode 100644
index 832ed2f..0000000
--- a/lowpan/tests/Android.mk
+++ /dev/null
@@ -1,63 +0,0 @@
-# Copyright (C) 2017 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.
-
-LOCAL_PATH:= $(call my-dir)
-
-# Make test APK
-# ============================================================
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_SRC_FILES := $(call all-subdir-java-files)
-
-# This list is generated from the java source files in this module
-# The list is a comma separated list of class names with * matching zero or more characters.
-# Example:
-#   Input files: src/com/android/server/lowpan/Test.java src/com/android/server/lowpan/AnotherTest.java
-#   Generated exclude list: com.android.server.lowpan.Test*,com.android.server.lowpan.AnotherTest*
-
-# Filter all src files to just java files
-local_java_files := $(filter %.java,$(LOCAL_SRC_FILES))
-# Transform java file names into full class names.
-# This only works if the class name matches the file name and the directory structure
-# matches the package.
-local_classes := $(subst /,.,$(patsubst src/%.java,%,$(local_java_files)))
-# Convert class name list to jacoco exclude list
-# This appends a * to all classes and replace the space separators with commas.
-# These patterns will match all classes in this module and their inner classes.
-jacoco_exclude := $(subst $(space),$(comma),$(patsubst %,%*,$(local_classes)))
-
-jacoco_include := android.net.lowpan.*
-
-LOCAL_JACK_COVERAGE_INCLUDE_FILTER := $(jacoco_include)
-LOCAL_JACK_COVERAGE_EXCLUDE_FILTER := $(jacoco_exclude)
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
-	androidx.test.rules \
-	guava \
-	mockito-target-minus-junit4 \
-	frameworks-base-testutils \
-
-LOCAL_JAVA_LIBRARIES := \
-	android.test.runner \
-	android.test.base \
-
-LOCAL_PACKAGE_NAME := FrameworksLowpanApiTests
-LOCAL_PRIVATE_PLATFORM_APIS := true
-LOCAL_COMPATIBILITY_SUITE := device-tests
-
-LOCAL_CERTIFICATE := platform
-LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
-include $(BUILD_PACKAGE)
diff --git a/media/OWNERS b/media/OWNERS
index a16373e..c95ac6c 100644
--- a/media/OWNERS
+++ b/media/OWNERS
@@ -14,6 +14,7 @@
 klhyun@google.com
 lajos@google.com
 marcone@google.com
+philburk@google.com
 sungsoo@google.com
 wonsik@google.com
 
diff --git a/media/java/android/media/MediaMetrics.java b/media/java/android/media/MediaMetrics.java
index f6f482d..2cfaf4f 100644
--- a/media/java/android/media/MediaMetrics.java
+++ b/media/java/android/media/MediaMetrics.java
@@ -18,7 +18,6 @@
 
 import android.annotation.NonNull;
 import android.annotation.Nullable;
-import android.annotation.TestApi;
 import android.os.Bundle;
 
 import java.nio.ByteBuffer;
@@ -578,7 +577,6 @@
          *
          * @return a Bundle with the keys set according to data in the Item's buffer.
          */
-        @TestApi
         public Bundle toBundle() {
             updateHeader();
 
@@ -591,23 +589,14 @@
 
         // The following constants are used for tests to extract
         // the content of the Bundle for CTS testing.
-        @TestApi
         public static final String BUNDLE_TOTAL_SIZE = "_totalSize";
-        @TestApi
         public static final String BUNDLE_HEADER_SIZE = "_headerSize";
-        @TestApi
         public static final String BUNDLE_VERSION = "_version";
-        @TestApi
         public static final String BUNDLE_KEY_SIZE = "_keySize";
-        @TestApi
         public static final String BUNDLE_KEY = "_key";
-        @TestApi
         public static final String BUNDLE_PID = "_pid";
-        @TestApi
         public static final String BUNDLE_UID = "_uid";
-        @TestApi
         public static final String BUNDLE_TIMESTAMP = "_timestamp";
-        @TestApi
         public static final String BUNDLE_PROPERTY_COUNT = "_propertyCount";
 
         /**
@@ -618,7 +607,6 @@
          * @param buffer contains the byte data serialized according to the byte string version.
          * @return a Bundle with the keys set according to data in the buffer.
          */
-        @TestApi
         public static Bundle toBundle(ByteBuffer buffer) {
             final Bundle bundle = new Bundle();
 
diff --git a/media/java/android/media/Utils.java b/media/java/android/media/Utils.java
index 7a4e7b8..ecb6b3d 100644
--- a/media/java/android/media/Utils.java
+++ b/media/java/android/media/Utils.java
@@ -18,7 +18,6 @@
 
 import android.annotation.NonNull;
 import android.annotation.Nullable;
-import android.annotation.TestApi;
 import android.content.ContentResolver;
 import android.content.Context;
 import android.database.Cursor;
@@ -440,7 +439,6 @@
      *
      * @param <V> The class of the object returned to the listener.
      */
-    @TestApi
     public static class ListenerList<V> {
         /**
          * The Listener interface for callback.
diff --git a/media/java/android/media/audiopolicy/AudioProductStrategy.java b/media/java/android/media/audiopolicy/AudioProductStrategy.java
index 090f78e..fca3498 100644
--- a/media/java/android/media/audiopolicy/AudioProductStrategy.java
+++ b/media/java/android/media/audiopolicy/AudioProductStrategy.java
@@ -19,7 +19,6 @@
 import android.annotation.NonNull;
 import android.annotation.Nullable;
 import android.annotation.SystemApi;
-import android.annotation.TestApi;
 import android.media.AudioAttributes;
 import android.media.AudioSystem;
 import android.media.MediaRecorder;
@@ -108,7 +107,6 @@
      * @param id the ID for the invalid strategy, always use a different one than in use
      * @return an invalid instance that cannot successfully be used for volume groups or routing
      */
-    @TestApi
     @SystemApi
     public static @NonNull AudioProductStrategy createInvalidAudioProductStrategy(int id) {
         return new AudioProductStrategy("dummy strategy", id, new AudioAttributesGroup[0]);
diff --git a/media/java/android/mtp/MtpStorageManager.java b/media/java/android/mtp/MtpStorageManager.java
index e783788..c0eb5e8 100644
--- a/media/java/android/mtp/MtpStorageManager.java
+++ b/media/java/android/mtp/MtpStorageManager.java
@@ -229,9 +229,16 @@
         }
 
         private void setParent(MtpObject parent) {
+            if (this.getStorageId() != parent.getStorageId()) {
+                mStorage = Preconditions.checkNotNull(parent.getStorage());
+            }
             mParent = parent;
         }
 
+        private MtpStorage getStorage() {
+            return mStorage;
+        }
+
         private void setDir(boolean dir) {
             if (dir != mIsDir) {
                 mIsDir = dir;
diff --git a/media/jni/android_media_JetPlayer.cpp b/media/jni/android_media_JetPlayer.cpp
index 8a05f85..481f80b 100644
--- a/media/jni/android_media_JetPlayer.cpp
+++ b/media/jni/android_media_JetPlayer.cpp
@@ -23,7 +23,7 @@
 #include <fcntl.h>
 
 #include <jni.h>
-#include <nativehelper/JNIHelp.h>
+#include <nativehelper/JNIPlatformHelp.h>
 #include "core_jni_helpers.h"
 
 #include <utils/Log.h>
diff --git a/media/jni/android_media_MediaExtractor.cpp b/media/jni/android_media_MediaExtractor.cpp
index 528dc62..948ebcd 100644
--- a/media/jni/android_media_MediaExtractor.cpp
+++ b/media/jni/android_media_MediaExtractor.cpp
@@ -28,7 +28,7 @@
 #include "android_runtime/Log.h"
 #include "android_util_Binder.h"
 #include "jni.h"
-#include <nativehelper/JNIHelp.h>
+#include <nativehelper/JNIPlatformHelp.h>
 
 #include <android/hardware/cas/1.0/BpHwCas.h>
 #include <android/hardware/cas/1.0/BnHwCas.h>
diff --git a/media/jni/android_media_MediaMetadataRetriever.cpp b/media/jni/android_media_MediaMetadataRetriever.cpp
index 1c9b349..6fbd29c 100644
--- a/media/jni/android_media_MediaMetadataRetriever.cpp
+++ b/media/jni/android_media_MediaMetadataRetriever.cpp
@@ -30,7 +30,7 @@
 #include <private/media/VideoFrame.h>
 
 #include "jni.h"
-#include <nativehelper/JNIHelp.h>
+#include <nativehelper/JNIPlatformHelp.h>
 #include "android_runtime/AndroidRuntime.h"
 #include "android_media_MediaDataSource.h"
 #include "android_media_Streams.h"
diff --git a/media/jni/android_media_MediaMuxer.cpp b/media/jni/android_media_MediaMuxer.cpp
index 262ec76..2679176 100644
--- a/media/jni/android_media_MediaMuxer.cpp
+++ b/media/jni/android_media_MediaMuxer.cpp
@@ -21,7 +21,7 @@
 #include "android_media_Streams.h"
 #include "android_runtime/AndroidRuntime.h"
 #include "jni.h"
-#include <nativehelper/JNIHelp.h>
+#include <nativehelper/JNIPlatformHelp.h>
 
 #include <unistd.h>
 #include <fcntl.h>
diff --git a/media/jni/android_media_MediaPlayer.cpp b/media/jni/android_media_MediaPlayer.cpp
index 5cb42a9a..e910add 100644
--- a/media/jni/android_media_MediaPlayer.cpp
+++ b/media/jni/android_media_MediaPlayer.cpp
@@ -32,7 +32,7 @@
 #include <fcntl.h>
 #include <utils/threads.h>
 #include "jni.h"
-#include <nativehelper/JNIHelp.h>
+#include <nativehelper/JNIPlatformHelp.h>
 #include "android_runtime/AndroidRuntime.h"
 #include "android_runtime/android_view_Surface.h"
 #include "android_runtime/Log.h"
diff --git a/media/jni/android_media_MediaRecorder.cpp b/media/jni/android_media_MediaRecorder.cpp
index 6eeccf0..f99dc01 100644
--- a/media/jni/android_media_MediaRecorder.cpp
+++ b/media/jni/android_media_MediaRecorder.cpp
@@ -37,7 +37,7 @@
 #include <nativehelper/ScopedUtfChars.h>
 
 #include "jni.h"
-#include <nativehelper/JNIHelp.h>
+#include <nativehelper/JNIPlatformHelp.h>
 #include "android_media_AudioErrors.h"
 #include "android_media_MediaMetricsJNI.h"
 #include "android_media_MicrophoneInfo.h"
diff --git a/media/jni/android_mtp_MtpServer.cpp b/media/jni/android_mtp_MtpServer.cpp
index 39ff04a..8a1ae92 100644
--- a/media/jni/android_mtp_MtpServer.cpp
+++ b/media/jni/android_mtp_MtpServer.cpp
@@ -25,7 +25,7 @@
 #include <utils/threads.h>
 
 #include "jni.h"
-#include <nativehelper/JNIHelp.h>
+#include <nativehelper/JNIPlatformHelp.h>
 #include "android_runtime/AndroidRuntime.h"
 #include "private/android_filesystem_config.h"
 
diff --git a/media/jni/audioeffect/Visualizer.cpp b/media/jni/audioeffect/Visualizer.cpp
index efeb335..f4d65d0 100644
--- a/media/jni/audioeffect/Visualizer.cpp
+++ b/media/jni/audioeffect/Visualizer.cpp
@@ -25,6 +25,7 @@
 #include <limits.h>
 
 #include <audio_utils/fixedfft.h>
+#include <cutils/bitops.h>
 #include <utils/Thread.h>
 
 #include "Visualizer.h"
diff --git a/media/jni/soundpool/android_media_SoundPool.cpp b/media/jni/soundpool/android_media_SoundPool.cpp
index 8f6df3d..ca3cc855 100644
--- a/media/jni/soundpool/android_media_SoundPool.cpp
+++ b/media/jni/soundpool/android_media_SoundPool.cpp
@@ -21,7 +21,7 @@
 
 #include <utils/Log.h>
 #include <jni.h>
-#include <nativehelper/JNIHelp.h>
+#include <nativehelper/JNIPlatformHelp.h>
 #include <android_runtime/AndroidRuntime.h>
 #include "SoundPool.h"
 
diff --git a/media/mca/filterfw/Android.bp b/media/mca/filterfw/Android.bp
index 71899cf..0e0ecf3 100644
--- a/media/mca/filterfw/Android.bp
+++ b/media/mca/filterfw/Android.bp
@@ -65,6 +65,8 @@
         "-Wno-unused-parameter",
     ],
 
+    header_libs: ["jni_headers"],
+
     shared_libs: [
         "libmedia",
         "libgui",
diff --git a/media/tests/EffectsTest/res/layout/visualizertest.xml b/media/tests/EffectsTest/res/layout/visualizertest.xml
index 50ac7bb..18d7a36 100644
--- a/media/tests/EffectsTest/res/layout/visualizertest.xml
+++ b/media/tests/EffectsTest/res/layout/visualizertest.xml
@@ -56,6 +56,37 @@
          android:layout_height="wrap_content"
          android:scaleType="fitXY"/>
 
+    <LinearLayout android:id="@+id/visuMultithreadedLayout"
+        android:orientation="horizontal"
+        android:layout_width="fill_parent"
+        android:layout_height="wrap_content"
+        android:layout_marginLeft="10dip"
+        android:layout_marginTop="10dip"
+        android:layout_marginRight="10dip"
+        android:layout_marginBottom="10dip" >
+
+        <TextView android:id="@+id/visuMultithreaded"
+            android:layout_width="fill_parent"
+            android:layout_height="fill_parent"
+            android:layout_weight="1.0"
+            android:layout_gravity="center_vertical|left"
+            android:text="@string/effect_multithreaded"
+            style="@android:style/TextAppearance.Medium" />
+
+        <ToggleButton android:id="@+id/visuMultithreadedOnOff"
+            android:layout_width="wrap_content"
+            android:layout_height="fill_parent"
+            android:layout_gravity="center_vertical|right"
+            android:layout_weight="0.0" />
+
+    </LinearLayout>
+
+    <ImageView
+         android:src="@android:drawable/divider_horizontal_dark"
+         android:layout_width="fill_parent"
+         android:layout_height="wrap_content"
+         android:scaleType="fitXY"/>
+
     <LinearLayout android:id="@+id/visuControlLayout"
         android:orientation="horizontal"
         android:layout_width="fill_parent"
diff --git a/media/tests/EffectsTest/res/values/strings.xml b/media/tests/EffectsTest/res/values/strings.xml
index 2a85184..7c12da1 100644
--- a/media/tests/EffectsTest/res/values/strings.xml
+++ b/media/tests/EffectsTest/res/values/strings.xml
@@ -35,4 +35,6 @@
     <string name="effect_attach_off">Attach</string>
     <string name="effect_attach_on">Detach</string>
     <string name="send_level_name">Send Level</string>
+    <!-- Toggles use of a multi-threaded client for an effect [CHAR LIMIT=24] -->
+    <string name="effect_multithreaded">Multithreaded Use</string>
 </resources>
diff --git a/tools/aapt/tests/TestHelper.h b/media/tests/EffectsTest/src/com/android/effectstest/VisualizerInstance.java
similarity index 61%
copy from tools/aapt/tests/TestHelper.h
copy to media/tests/EffectsTest/src/com/android/effectstest/VisualizerInstance.java
index 79174832..817bd3d 100644
--- a/tools/aapt/tests/TestHelper.h
+++ b/media/tests/EffectsTest/src/com/android/effectstest/VisualizerInstance.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2014 The Android Open Source Project
+ * Copyright (C) 2020 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.
@@ -14,20 +14,12 @@
  * limitations under the License.
  */
 
-#ifndef __TEST_HELPER_H
-#define __TEST_HELPER_H
+package com.android.effectstest;
 
-#include <utils/String8.h>
-
-namespace android {
-
-/**
- * Stream operator for nicely printing String8's in gtest output.
- */
-inline std::ostream& operator<<(std::ostream& stream, const String8& str) {
-    return stream << str.string();
+interface VisualizerInstance {
+    void enableDataCaptureListener(boolean enable);
+    boolean getEnabled();
+    void release();
+    void setEnabled(boolean enabled);
+    void startStopCapture(boolean start);
 }
-
-}
-
-#endif
diff --git a/media/tests/EffectsTest/src/com/android/effectstest/VisualizerInstanceMT.java b/media/tests/EffectsTest/src/com/android/effectstest/VisualizerInstanceMT.java
new file mode 100644
index 0000000..89cfbeb
--- /dev/null
+++ b/media/tests/EffectsTest/src/com/android/effectstest/VisualizerInstanceMT.java
@@ -0,0 +1,113 @@
+/*
+ * Copyright (C) 2020 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 com.android.effectstest;
+
+import android.os.Handler;
+import android.os.Looper;
+import android.util.Log;
+
+import com.android.internal.annotations.GuardedBy;
+
+class VisualizerInstanceMT implements VisualizerInstance {
+
+    private static final String TAG = "VisualizerInstanceMT";
+
+    private final Object mLock = new Object();
+    private final int mThreadCount;
+    @GuardedBy("mLock")
+    private Handler mVisualizerHandler;
+    @GuardedBy("mLock")
+    private VisualizerInstanceSync mVisualizer;
+
+    VisualizerInstanceMT(int session, Handler uiHandler, int extraThreadCount) {
+        Log.d(TAG, "Multi-threaded constructor");
+        mThreadCount = 1 + extraThreadCount;
+        Thread t = new Thread() {
+            @Override public void run() {
+                Looper.prepare();
+                VisualizerInstanceSync v = new VisualizerInstanceSync(session, uiHandler);
+                synchronized (mLock) {
+                    mVisualizerHandler = new Handler();
+                    mVisualizer = v;
+                }
+                Looper.loop();
+            }
+        };
+        t.start();
+    }
+
+    private VisualizerInstance getVisualizer() {
+        synchronized (mLock) {
+            return mVisualizer != null ? new VisualizerInstanceSync(mVisualizer) : null;
+        }
+    }
+
+    private interface VisualizerOperation {
+        void run(VisualizerInstance v);
+    }
+
+    private void runOperationMt(VisualizerOperation op) {
+        final VisualizerInstance v = getVisualizer();
+        if (v == null) return;
+        for (int i = 0; i < mThreadCount; ++i) {
+            Thread t = new Thread() {
+                @Override
+                public void run() {
+                    op.run(v);
+                }
+            };
+            t.start();
+        }
+    }
+
+    @Override
+    public void enableDataCaptureListener(boolean enable) {
+        runOperationMt(v -> v.enableDataCaptureListener(enable));
+    }
+
+    @Override
+    public boolean getEnabled() {
+        final VisualizerInstance v = getVisualizer();
+        return v != null ? v.getEnabled() : false;
+    }
+
+    @Override
+    public void release() {
+        runOperationMt(v -> v.release());
+        synchronized (mLock) {
+            if (mVisualizerHandler == null) return;
+            mVisualizerHandler.post(() -> {
+                synchronized (mLock) {
+                    mVisualizerHandler = null;
+                    mVisualizer = null;
+                    Looper.myLooper().quitSafely();
+                }
+                Log.d(TAG, "Exiting looper");
+            });
+        }
+    }
+
+    @Override
+    public void setEnabled(boolean enabled) {
+        runOperationMt(v -> v.setEnabled(enabled));
+    }
+
+    @Override
+    public void startStopCapture(boolean start) {
+        runOperationMt(v -> v.startStopCapture(start));
+    }
+}
diff --git a/media/tests/EffectsTest/src/com/android/effectstest/VisualizerInstanceSync.java b/media/tests/EffectsTest/src/com/android/effectstest/VisualizerInstanceSync.java
new file mode 100644
index 0000000..e64f4e5
--- /dev/null
+++ b/media/tests/EffectsTest/src/com/android/effectstest/VisualizerInstanceSync.java
@@ -0,0 +1,170 @@
+/*
+ * Copyright (C) 2020 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 com.android.effectstest;
+
+import android.media.audiofx.Visualizer;
+import android.os.Handler;
+import android.os.Message;
+import android.util.Log;
+
+// This class only has `final' members, thus any thread-safety concerns
+// can only come from the Visualizer effect class.
+class VisualizerInstanceSync implements VisualizerInstance {
+
+    private static final String TAG = "VisualizerInstance";
+
+    private final Handler mUiHandler;
+    private final Visualizer mVisualizer;
+    private final VisualizerTestHandler mVisualizerTestHandler;
+    private final VisualizerListener mVisualizerListener;
+
+    VisualizerInstanceSync(int session, Handler uiHandler) {
+        mUiHandler = uiHandler;
+        try {
+            mVisualizer = new Visualizer(session);
+        } catch (UnsupportedOperationException e) {
+            Log.e(TAG, "Visualizer library not loaded");
+            throw new RuntimeException("Cannot initialize effect");
+        } catch (RuntimeException e) {
+            throw e;
+        }
+        mVisualizerTestHandler = new VisualizerTestHandler();
+        mVisualizerListener = new VisualizerListener();
+    }
+
+    // Not a "deep" copy, only copies the references.
+    VisualizerInstanceSync(VisualizerInstanceSync other) {
+        mUiHandler = other.mUiHandler;
+        mVisualizer = other.mVisualizer;
+        mVisualizerTestHandler = other.mVisualizerTestHandler;
+        mVisualizerListener = other.mVisualizerListener;
+    }
+
+    @Override
+    public void enableDataCaptureListener(boolean enable) {
+        mVisualizer.setDataCaptureListener(enable ? mVisualizerListener : null,
+                10000, enable, enable);
+    }
+
+    @Override
+    public boolean getEnabled() {
+        return mVisualizer.getEnabled();
+    }
+
+    @Override
+    public void release() {
+        mVisualizer.release();
+        Log.d(TAG, "Visualizer released");
+    }
+
+    @Override
+    public void setEnabled(boolean enabled) {
+        mVisualizer.setEnabled(enabled);
+    }
+
+    @Override
+    public void startStopCapture(boolean start) {
+        mVisualizerTestHandler.sendMessage(mVisualizerTestHandler.obtainMessage(
+                        start ? MSG_START_CAPTURE : MSG_STOP_CAPTURE));
+    }
+
+    private static final int MSG_START_CAPTURE = 0;
+    private static final int MSG_STOP_CAPTURE = 1;
+    private static final int MSG_NEW_CAPTURE = 2;
+    private static final int CAPTURE_PERIOD_MS = 100;
+
+    private static int[] dataToMinMaxCenter(byte[] data, int len) {
+        int[] minMaxCenter = new int[3];
+        minMaxCenter[0] = data[0];
+        minMaxCenter[1] = data[len - 1];
+        minMaxCenter[2] = data[len / 2];
+        return minMaxCenter;
+    }
+
+    private class VisualizerTestHandler extends Handler {
+        private final int mCaptureSize;
+        private boolean mActive = false;
+
+        VisualizerTestHandler() {
+            mCaptureSize = mVisualizer.getCaptureSize();
+        }
+
+        @Override
+        public void handleMessage(Message msg) {
+            switch (msg.what) {
+                case MSG_START_CAPTURE:
+                    if (!mActive) {
+                        Log.d(TAG, "Start capture");
+                        mActive = true;
+                        sendMessageDelayed(obtainMessage(MSG_NEW_CAPTURE), CAPTURE_PERIOD_MS);
+                    }
+                    break;
+                case MSG_STOP_CAPTURE:
+                    if (mActive) {
+                        Log.d(TAG, "Stop capture");
+                        mActive = false;
+                    }
+                    break;
+                case MSG_NEW_CAPTURE:
+                    if (mActive) {
+                        if (mCaptureSize > 0) {
+                            byte[] data = new byte[mCaptureSize];
+                            if (mVisualizer.getWaveForm(data) == Visualizer.SUCCESS) {
+                                int len = data.length < mCaptureSize ? data.length : mCaptureSize;
+                                mUiHandler.sendMessage(
+                                        mUiHandler.obtainMessage(
+                                                VisualizerTest.MSG_DISPLAY_WAVEFORM_VAL,
+                                                dataToMinMaxCenter(data, len)));
+                            }
+                            if (mVisualizer.getFft(data) == Visualizer.SUCCESS) {
+                                int len = data.length < mCaptureSize ? data.length : mCaptureSize;
+                                mUiHandler.sendMessage(
+                                        mUiHandler.obtainMessage(VisualizerTest.MSG_DISPLAY_FFT_VAL,
+                                                dataToMinMaxCenter(data, len)));
+                            }
+                        }
+                        sendMessageDelayed(obtainMessage(MSG_NEW_CAPTURE), CAPTURE_PERIOD_MS);
+                    }
+                    break;
+            }
+        }
+    }
+
+    private class VisualizerListener implements Visualizer.OnDataCaptureListener {
+        @Override
+        public void onWaveFormDataCapture(Visualizer visualizer, byte[] waveform,
+                int samplingRate) {
+            if (visualizer == mVisualizer && waveform.length > 0) {
+                Log.d(TAG, "onWaveFormDataCapture(): " + waveform[0]
+                        + " smp rate: " + samplingRate / 1000);
+                mUiHandler.sendMessage(
+                        mUiHandler.obtainMessage(VisualizerTest.MSG_DISPLAY_WAVEFORM_VAL,
+                                dataToMinMaxCenter(waveform, waveform.length)));
+            }
+        }
+
+        @Override
+        public void onFftDataCapture(Visualizer visualizer, byte[] fft, int samplingRate) {
+            if (visualizer == mVisualizer && fft.length > 0) {
+                Log.d(TAG, "onFftDataCapture(): " + fft[0]);
+                mUiHandler.sendMessage(
+                        mUiHandler.obtainMessage(VisualizerTest.MSG_DISPLAY_FFT_VAL,
+                                dataToMinMaxCenter(fft, fft.length)));
+            }
+        }
+    }
+}
diff --git a/media/tests/EffectsTest/src/com/android/effectstest/VisualizerTest.java b/media/tests/EffectsTest/src/com/android/effectstest/VisualizerTest.java
index 7db1d8d..2e141c5 100644
--- a/media/tests/EffectsTest/src/com/android/effectstest/VisualizerTest.java
+++ b/media/tests/EffectsTest/src/com/android/effectstest/VisualizerTest.java
@@ -17,51 +17,42 @@
 package com.android.effectstest;
 
 import android.app.Activity;
-import android.content.Context;
-import android.content.Intent;
-import android.media.audiofx.Visualizer;
 import android.os.Bundle;
 import android.os.Handler;
 import android.os.Looper;
 import android.os.Message;
 import android.util.Log;
 import android.view.KeyEvent;
-import android.view.Menu;
 import android.view.View;
-import android.view.View.OnClickListener;
-import android.view.ViewGroup;
-import android.widget.Button;
 import android.widget.CompoundButton;
 import android.widget.CompoundButton.OnCheckedChangeListener;
 import android.widget.EditText;
 import android.widget.TextView;
 import android.widget.ToggleButton;
-import android.widget.SeekBar;
 
-import java.nio.ByteOrder;
-import java.nio.ByteBuffer;
 import java.util.HashMap;
-import java.util.Map;
 
 public class VisualizerTest extends Activity implements OnCheckedChangeListener {
 
     private final static String TAG = "Visualizer Test";
 
-    private Visualizer mVisualizer;
+    private VisualizerInstance mVisualizer;
+    ToggleButton mMultithreadedButton;
     ToggleButton mOnOffButton;
     ToggleButton mReleaseButton;
+    boolean mUseMTInstance;
     boolean mEnabled;
     EditText mSessionText;
     static int sSession = 0;
-    int mCaptureSize;
     ToggleButton mCallbackButton;
     boolean mCallbackOn;
-    VisualizerListener mVisualizerListener;
-    private static HashMap<Integer, Visualizer> sInstances = new HashMap<Integer, Visualizer>(10);
-    private VisualizerTestHandler mVisualizerTestHandler = null;
+    private static HashMap<Integer, VisualizerInstance> sInstances =
+            new HashMap<Integer, VisualizerInstance>(10);
+    private Handler mUiHandler;
 
     public VisualizerTest() {
         Log.d(TAG, "contructor");
+        mUiHandler = new UiHandler(Looper.getMainLooper());
     }
 
     @Override
@@ -76,109 +67,45 @@
         mSessionText.setOnKeyListener(mSessionKeyListener);
         mSessionText.setText(Integer.toString(sSession));
 
-        mReleaseButton = (ToggleButton)findViewById(R.id.visuReleaseButton);
-        mOnOffButton = (ToggleButton)findViewById(R.id.visualizerOnOff);
-        mCallbackButton = (ToggleButton)findViewById(R.id.visuCallbackOnOff);
+        mMultithreadedButton = (ToggleButton) findViewById(R.id.visuMultithreadedOnOff);
+        mReleaseButton = (ToggleButton) findViewById(R.id.visuReleaseButton);
+        mOnOffButton = (ToggleButton) findViewById(R.id.visualizerOnOff);
+        mCallbackButton = (ToggleButton) findViewById(R.id.visuCallbackOnOff);
         mCallbackOn = false;
         mCallbackButton.setChecked(mCallbackOn);
 
-        mVisualizerTestHandler = new VisualizerTestHandler();
-        mVisualizerListener = new VisualizerListener();
-
-        getEffect(sSession);
-
-        if (mVisualizer != null) {
+        mMultithreadedButton.setOnCheckedChangeListener(this);
+        if (getEffect(sSession) != null) {
             mReleaseButton.setOnCheckedChangeListener(this);
             mOnOffButton.setOnCheckedChangeListener(this);
             mCallbackButton.setOnCheckedChangeListener(this);
         }
     }
 
-    private static final int MSG_START_CAPTURE = 0;
-    private static final int MSG_STOP_CAPTURE = 1;
-    private static final int MSG_NEW_CAPTURE = 2;
-    private static final int CAPTURE_PERIOD_MS = 100;
+    public static final int MSG_DISPLAY_WAVEFORM_VAL = 0;
+    public static final int MSG_DISPLAY_FFT_VAL = 1;
 
-    private class VisualizerTestHandler extends Handler {
-        boolean mActive = false;
+    private class UiHandler extends Handler {
+        UiHandler(Looper looper) {
+            super(looper);
+        }
+
         @Override
         public void handleMessage(Message msg) {
             switch (msg.what) {
-            case MSG_START_CAPTURE:
-                if (!mActive) {
-                    Log.d(TAG, "Start capture");
-                    mActive = true;
-                    sendMessageDelayed(obtainMessage(MSG_NEW_CAPTURE, 0, 0, null), CAPTURE_PERIOD_MS);
+                case MSG_DISPLAY_WAVEFORM_VAL:
+                case MSG_DISPLAY_FFT_VAL:
+                    int[] minMaxCenter = (int[]) msg.obj;
+                    boolean waveform = msg.what == MSG_DISPLAY_WAVEFORM_VAL;
+                    displayVal(waveform ? R.id.waveformMin : R.id.fftMin, minMaxCenter[0]);
+                    displayVal(waveform ? R.id.waveformMax : R.id.fftMax, minMaxCenter[1]);
+                    displayVal(waveform ? R.id.waveformCenter : R.id.fftCenter, minMaxCenter[2]);
+                    break;
                 }
-                break;
-            case MSG_STOP_CAPTURE:
-                if (mActive) {
-                    Log.d(TAG, "Stop capture");
-                    mActive = false;
-                }
-                break;
-            case MSG_NEW_CAPTURE:
-                if (mActive && mVisualizer != null) {
-                    if (mCaptureSize > 0) {
-                        byte[] data = new byte[mCaptureSize];
-                        if (mVisualizer.getWaveForm(data) == Visualizer.SUCCESS) {
-                            int len = data.length < mCaptureSize ? data.length : mCaptureSize;
-                            displayVal(R.id.waveformMin, data[0]);
-                            displayVal(R.id.waveformMax, data[len-1]);
-                            displayVal(R.id.waveformCenter, data[len/2]);
-                        };
-                        if (mVisualizer.getFft(data) == Visualizer.SUCCESS) {
-                            int len = data.length < mCaptureSize ? data.length : mCaptureSize;
-                            displayVal(R.id.fftMin, data[0]);
-                            displayVal(R.id.fftMax, data[len-1]);
-                            displayVal(R.id.fftCenter, data[len/2]);
-                        };
-                    }
-                    sendMessageDelayed(obtainMessage(MSG_NEW_CAPTURE, 0, 0, null), CAPTURE_PERIOD_MS);
-                }
-                break;
-            }
         }
     }
 
-    private class VisualizerListener implements Visualizer.OnDataCaptureListener {
-
-        public VisualizerListener() {
-        }
-        public void onWaveFormDataCapture(Visualizer visualizer, byte[] waveform, int samplingRate) {
-            if (visualizer == mVisualizer) {
-                if (waveform.length > 0) {
-                    Log.d(TAG, "onWaveFormDataCapture(): "+waveform[0]+" smp rate: "+samplingRate/1000);
-                    displayVal(R.id.waveformMin, waveform[0]);
-                    displayVal(R.id.waveformMax, waveform[waveform.length - 1]);
-                    displayVal(R.id.waveformCenter, waveform[waveform.length/2]);
-                }
-            }
-        }
-        public void onFftDataCapture(Visualizer visualizer, byte[] fft, int samplingRate) {
-            if (visualizer == mVisualizer) {
-                if (fft.length > 0) {
-                    Log.d(TAG, "onFftDataCapture(): "+fft[0]);
-                    displayVal(R.id.fftMin, fft[0]);
-                    displayVal(R.id.fftMax, fft[fft.length - 1]);
-                    displayVal(R.id.fftCenter, fft[fft.length/2]);
-                }
-            }
-        }
-    }
-
-    @Override
-    public void onResume() {
-        super.onResume();
-    }
-
-    @Override
-    public void onPause() {
-        super.onPause();
-    }
-
-    private View.OnKeyListener mSessionKeyListener
-    = new View.OnKeyListener() {
+    private View.OnKeyListener mSessionKeyListener = new View.OnKeyListener() {
         public boolean onKey(View v, int keyCode, KeyEvent event) {
             if (event.getAction() == KeyEvent.ACTION_DOWN) {
                 switch (keyCode) {
@@ -199,29 +126,26 @@
     };
 
     // OnCheckedChangeListener
+    @Override
     public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
+        if (buttonView.getId() == R.id.visuMultithreadedOnOff) {
+            mUseMTInstance = isChecked;
+            Log.d(TAG, "Multi-threaded client: " + (isChecked ? "enabled" : "disabled"));
+        }
         if (buttonView.getId() == R.id.visualizerOnOff) {
             if (mVisualizer != null) {
                 mEnabled = isChecked;
                 mCallbackButton.setEnabled(!mEnabled);
                 if (mCallbackOn && mEnabled) {
-                    mVisualizer.setDataCaptureListener(mVisualizerListener,
-                            10000,
-                            true,
-                            true);
+                    mVisualizer.enableDataCaptureListener(true);
                 }
                 mVisualizer.setEnabled(mEnabled);
                 if (mCallbackOn) {
                     if (!mEnabled) {
-                        mVisualizer.setDataCaptureListener(null,
-                                10000,
-                                false,
-                                false);
+                        mVisualizer.enableDataCaptureListener(false);
                     }
                 } else {
-                    int msg = isChecked ? MSG_START_CAPTURE : MSG_STOP_CAPTURE;
-                    mVisualizerTestHandler.sendMessage(
-                            mVisualizerTestHandler.obtainMessage(msg, 0, 0, null));
+                    mVisualizer.startStopCapture(isChecked);
                 }
             }
         }
@@ -248,16 +172,15 @@
     }
 
 
-    private void getEffect(int session) {
+    private VisualizerInstance getEffect(int session) {
         synchronized (sInstances) {
             if (sInstances.containsKey(session)) {
                 mVisualizer = sInstances.get(session);
             } else {
-                try{
-                    mVisualizer = new Visualizer(session);
-                } catch (UnsupportedOperationException e) {
-                    Log.e(TAG,"Visualizer library not loaded");
-                    throw (new RuntimeException("Cannot initialize effect"));
+                try {
+                    mVisualizer = mUseMTInstance
+                            ? new VisualizerInstanceMT(session, mUiHandler, 0 /*extraThreadCount*/)
+                            : new VisualizerInstanceSync(session, mUiHandler);
                 } catch (RuntimeException e) {
                     throw e;
                 }
@@ -267,8 +190,6 @@
         mReleaseButton.setEnabled(false);
         mOnOffButton.setEnabled(false);
         if (mVisualizer != null) {
-            mCaptureSize = mVisualizer.getCaptureSize();
-
             mReleaseButton.setChecked(true);
             mReleaseButton.setEnabled(true);
 
@@ -278,6 +199,7 @@
 
             mCallbackButton.setEnabled(!mEnabled);
         }
+        return mVisualizer;
     }
 
     private void putEffect(int session) {
@@ -286,9 +208,8 @@
         synchronized (sInstances) {
             if (mVisualizer != null) {
                 mVisualizer.release();
-                Log.d(TAG,"Visualizer released");
-                mVisualizer = null;
                 sInstances.remove(session);
+                mVisualizer = null;
             }
         }
     }
diff --git a/native/android/sharedmem.cpp b/native/android/sharedmem.cpp
index 4410bd6..338b280 100644
--- a/native/android/sharedmem.cpp
+++ b/native/android/sharedmem.cpp
@@ -16,6 +16,9 @@
 
 #include <jni.h>
 
+#include <fcntl.h>
+#include <unistd.h>
+
 #include <android/sharedmem.h>
 #include <android/sharedmem_jni.h>
 #include <cutils/ashmem.h>
@@ -23,7 +26,6 @@
 #include <utils/Errors.h>
 
 #include <mutex>
-#include <unistd.h>
 
 static struct {
     jclass clazz;
diff --git a/native/webview/loader/Android.bp b/native/webview/loader/Android.bp
index 0ba256f..dfa5bdd 100644
--- a/native/webview/loader/Android.bp
+++ b/native/webview/loader/Android.bp
@@ -24,6 +24,8 @@
 
     cflags: ["-Werror"],
 
+    header_libs: ["jni_headers"],
+
     shared_libs: [
         "libdl",
         "liblog",
diff --git a/non-updatable-api/current.txt b/non-updatable-api/current.txt
index 5f15216..8e01620 100644
--- a/non-updatable-api/current.txt
+++ b/non-updatable-api/current.txt
@@ -3712,7 +3712,7 @@
     ctor public ActionBar.LayoutParams(int);
     ctor public ActionBar.LayoutParams(android.app.ActionBar.LayoutParams);
     ctor public ActionBar.LayoutParams(android.view.ViewGroup.LayoutParams);
-    field @android.view.ViewDebug.ExportedProperty(category="layout", mapping={@android.view.ViewDebug.IntToString(from=0xffffffff, to="NONE"), @android.view.ViewDebug.IntToString(from=android.view.Gravity.NO_GRAVITY, to="NONE"), @android.view.ViewDebug.IntToString(from=android.view.Gravity.TOP, to="TOP"), @android.view.ViewDebug.IntToString(from=android.view.Gravity.BOTTOM, to="BOTTOM"), @android.view.ViewDebug.IntToString(from=android.view.Gravity.LEFT, to="LEFT"), @android.view.ViewDebug.IntToString(from=android.view.Gravity.RIGHT, to="RIGHT"), @android.view.ViewDebug.IntToString(from=android.view.Gravity.START, to="START"), @android.view.ViewDebug.IntToString(from=android.view.Gravity.END, to="END"), @android.view.ViewDebug.IntToString(from=android.view.Gravity.CENTER_VERTICAL, to="CENTER_VERTICAL"), @android.view.ViewDebug.IntToString(from=android.view.Gravity.FILL_VERTICAL, to="FILL_VERTICAL"), @android.view.ViewDebug.IntToString(from=android.view.Gravity.CENTER_HORIZONTAL, to="CENTER_HORIZONTAL"), @android.view.ViewDebug.IntToString(from=android.view.Gravity.FILL_HORIZONTAL, to="FILL_HORIZONTAL"), @android.view.ViewDebug.IntToString(from=android.view.Gravity.CENTER, to="CENTER"), @android.view.ViewDebug.IntToString(from=android.view.Gravity.FILL, to="FILL")}) public int gravity;
+    field public int gravity;
   }
 
   public static interface ActionBar.OnMenuVisibilityListener {
@@ -10092,7 +10092,7 @@
     method public final <T> T getSystemService(@NonNull Class<T>);
     method @Nullable public abstract String getSystemServiceName(@NonNull Class<?>);
     method @NonNull public final CharSequence getText(@StringRes int);
-    method @android.view.ViewDebug.ExportedProperty(deepExport=true) public abstract android.content.res.Resources.Theme getTheme();
+    method public abstract android.content.res.Resources.Theme getTheme();
     method @Deprecated public abstract android.graphics.drawable.Drawable getWallpaper();
     method @Deprecated public abstract int getWallpaperDesiredMinimumHeight();
     method @Deprecated public abstract int getWallpaperDesiredMinimumWidth();
@@ -11945,7 +11945,7 @@
   }
 
   public abstract class PackageManager {
-    ctor public PackageManager();
+    ctor @Deprecated public PackageManager();
     method @Deprecated public abstract void addPackageToPreferred(@NonNull String);
     method public abstract boolean addPermission(@NonNull android.content.pm.PermissionInfo);
     method public abstract boolean addPermissionAsync(@NonNull android.content.pm.PermissionInfo);
@@ -34376,6 +34376,7 @@
     field public static final String PRODUCT;
     field @Deprecated public static final String RADIO;
     field @Deprecated public static final String SERIAL;
+    field @NonNull public static final String SKU;
     field public static final String[] SUPPORTED_32_BIT_ABIS;
     field public static final String[] SUPPORTED_64_BIT_ABIS;
     field public static final String[] SUPPORTED_ABIS;
@@ -40912,6 +40913,7 @@
     method @NonNull public String[] getSignaturePaddings();
     method public int getUserAuthenticationType();
     method public int getUserAuthenticationValidityDurationSeconds();
+    method public boolean isDevicePropertiesAttestationIncluded();
     method @NonNull public boolean isDigestsSpecified();
     method public boolean isInvalidatedByBiometricEnrollment();
     method public boolean isRandomizedEncryptionRequired();
@@ -40933,6 +40935,7 @@
     method @NonNull public android.security.keystore.KeyGenParameterSpec.Builder setCertificateNotBefore(@NonNull java.util.Date);
     method @NonNull public android.security.keystore.KeyGenParameterSpec.Builder setCertificateSerialNumber(@NonNull java.math.BigInteger);
     method @NonNull public android.security.keystore.KeyGenParameterSpec.Builder setCertificateSubject(@NonNull javax.security.auth.x500.X500Principal);
+    method @NonNull public android.security.keystore.KeyGenParameterSpec.Builder setDevicePropertiesAttestationIncluded(boolean);
     method @NonNull public android.security.keystore.KeyGenParameterSpec.Builder setDigests(java.lang.String...);
     method @NonNull public android.security.keystore.KeyGenParameterSpec.Builder setEncryptionPaddings(java.lang.String...);
     method @NonNull public android.security.keystore.KeyGenParameterSpec.Builder setInvalidatedByBiometricEnrollment(boolean);
@@ -45616,6 +45619,88 @@
     field public static final int VSNCP_TIMEOUT = 2236; // 0x8bc
   }
 
+  public final class DisconnectCause {
+    field public static final int ALREADY_DIALING = 72; // 0x48
+    field public static final int ANSWERED_ELSEWHERE = 52; // 0x34
+    field public static final int BUSY = 4; // 0x4
+    field public static final int CALLING_DISABLED = 74; // 0x4a
+    field public static final int CALL_BARRED = 20; // 0x14
+    field public static final int CALL_PULLED = 51; // 0x33
+    field public static final int CANT_CALL_WHILE_RINGING = 73; // 0x49
+    field public static final int CDMA_ACCESS_BLOCKED = 35; // 0x23
+    field public static final int CDMA_ACCESS_FAILURE = 32; // 0x20
+    field public static final int CDMA_ALREADY_ACTIVATED = 49; // 0x31
+    field public static final int CDMA_DROP = 27; // 0x1b
+    field public static final int CDMA_INTERCEPT = 28; // 0x1c
+    field public static final int CDMA_LOCKED_UNTIL_POWER_CYCLE = 26; // 0x1a
+    field public static final int CDMA_NOT_EMERGENCY = 34; // 0x22
+    field public static final int CDMA_PREEMPTED = 33; // 0x21
+    field public static final int CDMA_REORDER = 29; // 0x1d
+    field public static final int CDMA_RETRY_ORDER = 31; // 0x1f
+    field public static final int CDMA_SO_REJECT = 30; // 0x1e
+    field public static final int CONGESTION = 5; // 0x5
+    field public static final int CS_RESTRICTED = 22; // 0x16
+    field public static final int CS_RESTRICTED_EMERGENCY = 24; // 0x18
+    field public static final int CS_RESTRICTED_NORMAL = 23; // 0x17
+    field public static final int DATA_DISABLED = 54; // 0x36
+    field public static final int DATA_LIMIT_REACHED = 55; // 0x37
+    field public static final int DIALED_CALL_FORWARDING_WHILE_ROAMING = 57; // 0x39
+    field public static final int DIALED_MMI = 39; // 0x27
+    field public static final int DIAL_LOW_BATTERY = 62; // 0x3e
+    field public static final int DIAL_MODIFIED_TO_DIAL = 48; // 0x30
+    field public static final int DIAL_MODIFIED_TO_DIAL_VIDEO = 66; // 0x42
+    field public static final int DIAL_MODIFIED_TO_SS = 47; // 0x2f
+    field public static final int DIAL_MODIFIED_TO_USSD = 46; // 0x2e
+    field public static final int DIAL_VIDEO_MODIFIED_TO_DIAL = 69; // 0x45
+    field public static final int DIAL_VIDEO_MODIFIED_TO_DIAL_VIDEO = 70; // 0x46
+    field public static final int DIAL_VIDEO_MODIFIED_TO_SS = 67; // 0x43
+    field public static final int DIAL_VIDEO_MODIFIED_TO_USSD = 68; // 0x44
+    field public static final int EMERGENCY_CALL_OVER_WFC_NOT_AVAILABLE = 78; // 0x4e
+    field public static final int EMERGENCY_PERM_FAILURE = 64; // 0x40
+    field public static final int EMERGENCY_TEMP_FAILURE = 63; // 0x3f
+    field public static final int ERROR_UNSPECIFIED = 36; // 0x24
+    field public static final int FDN_BLOCKED = 21; // 0x15
+    field public static final int ICC_ERROR = 19; // 0x13
+    field public static final int IMEI_NOT_ACCEPTED = 58; // 0x3a
+    field public static final int IMS_ACCESS_BLOCKED = 60; // 0x3c
+    field public static final int IMS_MERGED_SUCCESSFULLY = 45; // 0x2d
+    field public static final int IMS_SIP_ALTERNATE_EMERGENCY_CALL = 71; // 0x47
+    field public static final int INCOMING_AUTO_REJECTED = 81; // 0x51
+    field public static final int INCOMING_MISSED = 1; // 0x1
+    field public static final int INCOMING_REJECTED = 16; // 0x10
+    field public static final int INVALID_CREDENTIALS = 10; // 0xa
+    field public static final int INVALID_NUMBER = 7; // 0x7
+    field public static final int LIMIT_EXCEEDED = 15; // 0xf
+    field public static final int LOCAL = 3; // 0x3
+    field public static final int LOST_SIGNAL = 14; // 0xe
+    field public static final int LOW_BATTERY = 61; // 0x3d
+    field public static final int MAXIMUM_NUMBER_OF_CALLS_REACHED = 53; // 0x35
+    field public static final int MEDIA_TIMEOUT = 77; // 0x4d
+    field public static final int MMI = 6; // 0x6
+    field public static final int NORMAL = 2; // 0x2
+    field public static final int NORMAL_UNSPECIFIED = 65; // 0x41
+    field public static final int NOT_DISCONNECTED = 0; // 0x0
+    field public static final int NOT_VALID = -1; // 0xffffffff
+    field public static final int NO_PHONE_NUMBER_SUPPLIED = 38; // 0x26
+    field public static final int NUMBER_UNREACHABLE = 8; // 0x8
+    field public static final int OTASP_PROVISIONING_IN_PROCESS = 76; // 0x4c
+    field public static final int OUTGOING_CANCELED = 44; // 0x2c
+    field public static final int OUTGOING_EMERGENCY_CALL_PLACED = 80; // 0x50
+    field public static final int OUTGOING_FAILURE = 43; // 0x2b
+    field public static final int OUT_OF_NETWORK = 11; // 0xb
+    field public static final int OUT_OF_SERVICE = 18; // 0x12
+    field public static final int POWER_OFF = 17; // 0x11
+    field public static final int SERVER_ERROR = 12; // 0xc
+    field public static final int SERVER_UNREACHABLE = 9; // 0x9
+    field public static final int TIMED_OUT = 13; // 0xd
+    field public static final int TOO_MANY_ONGOING_CALLS = 75; // 0x4b
+    field public static final int UNOBTAINABLE_NUMBER = 25; // 0x19
+    field public static final int VIDEO_CALL_NOT_ALLOWED_WHILE_TTY_ENABLED = 50; // 0x32
+    field public static final int VOICEMAIL_NUMBER_MISSING = 40; // 0x28
+    field public static final int WFC_SERVICE_NOT_AVAILABLE_IN_THIS_LOCATION = 79; // 0x4f
+    field public static final int WIFI_LOST = 59; // 0x3b
+  }
+
   public class IccOpenLogicalChannelResponse implements android.os.Parcelable {
     method public int describeContents();
     method public int getChannel();
@@ -45632,12 +45717,14 @@
 
   public class MbmsDownloadSession implements java.lang.AutoCloseable {
     method public void addProgressListener(@NonNull android.telephony.mbms.DownloadRequest, @NonNull java.util.concurrent.Executor, @NonNull android.telephony.mbms.DownloadProgressListener);
+    method public void addServiceAnnouncement(@NonNull byte[]);
     method public void addStatusListener(@NonNull android.telephony.mbms.DownloadRequest, @NonNull java.util.concurrent.Executor, @NonNull android.telephony.mbms.DownloadStatusListener);
     method public void cancelDownload(@NonNull android.telephony.mbms.DownloadRequest);
     method public void close();
     method public static android.telephony.MbmsDownloadSession create(@NonNull android.content.Context, @NonNull java.util.concurrent.Executor, @NonNull android.telephony.mbms.MbmsDownloadSessionCallback);
     method @Nullable public static android.telephony.MbmsDownloadSession create(@NonNull android.content.Context, @NonNull java.util.concurrent.Executor, int, @NonNull android.telephony.mbms.MbmsDownloadSessionCallback);
     method public void download(@NonNull android.telephony.mbms.DownloadRequest);
+    method public static int getMaximumServiceAnnouncementSize();
     method @Nullable public java.io.File getTempFileRootDirectory();
     method @NonNull public java.util.List<android.telephony.mbms.DownloadRequest> listPendingDownloads();
     method public void removeProgressListener(@NonNull android.telephony.mbms.DownloadRequest, @NonNull android.telephony.mbms.DownloadProgressListener);
@@ -46085,6 +46172,7 @@
     method public static int[] calculateLength(String, boolean);
     method @Deprecated public static android.telephony.SmsMessage createFromPdu(byte[]);
     method public static android.telephony.SmsMessage createFromPdu(byte[], String);
+    method @Nullable public static android.telephony.SmsMessage createSmsSubmitPdu(@NonNull byte[], boolean);
     method public String getDisplayMessageBody();
     method public String getDisplayOriginatingAddress();
     method public String getEmailBody();
@@ -46167,7 +46255,7 @@
 
   public class SubscriptionManager {
     method public void addOnOpportunisticSubscriptionsChangedListener(@NonNull java.util.concurrent.Executor, @NonNull android.telephony.SubscriptionManager.OnOpportunisticSubscriptionsChangedListener);
-    method public void addOnSubscriptionsChangedListener(android.telephony.SubscriptionManager.OnSubscriptionsChangedListener);
+    method @Deprecated public void addOnSubscriptionsChangedListener(android.telephony.SubscriptionManager.OnSubscriptionsChangedListener);
     method public void addOnSubscriptionsChangedListener(@NonNull java.util.concurrent.Executor, @NonNull android.telephony.SubscriptionManager.OnSubscriptionsChangedListener);
     method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void addSubscriptionsIntoGroup(@NonNull java.util.List<java.lang.Integer>, @NonNull android.os.ParcelUuid);
     method public boolean canManageSubscription(android.telephony.SubscriptionInfo);
@@ -47248,6 +47336,7 @@
 
   public static class MbmsErrors.DownloadErrors {
     field public static final int ERROR_CANNOT_CHANGE_TEMP_FILE_ROOT = 401; // 0x191
+    field public static final int ERROR_MALFORMED_SERVICE_ANNOUNCEMENT = 404; // 0x194
     field public static final int ERROR_UNKNOWN_DOWNLOAD_REQUEST = 402; // 0x192
     field public static final int ERROR_UNKNOWN_FILE_INFO = 403; // 0x193
   }
@@ -51999,13 +52088,13 @@
     method @Nullable public CharSequence getAccessibilityPaneTitle();
     method @IdRes public int getAccessibilityTraversalAfter();
     method @IdRes public int getAccessibilityTraversalBefore();
-    method @android.view.ViewDebug.ExportedProperty(category="drawing") public float getAlpha();
+    method public float getAlpha();
     method public android.view.animation.Animation getAnimation();
     method @Nullable public android.graphics.Matrix getAnimationMatrix();
     method public android.os.IBinder getApplicationWindowToken();
     method @NonNull public int[] getAttributeResolutionStack(@AttrRes int);
     method @NonNull public java.util.Map<java.lang.Integer,java.lang.Integer> getAttributeSourceResourceMap();
-    method @android.view.ViewDebug.ExportedProperty @Nullable public String[] getAutofillHints();
+    method @Nullable public String[] getAutofillHints();
     method public final android.view.autofill.AutofillId getAutofillId();
     method public int getAutofillType();
     method @Nullable public android.view.autofill.AutofillValue getAutofillValue();
@@ -52013,8 +52102,8 @@
     method @Nullable public android.graphics.BlendMode getBackgroundTintBlendMode();
     method @Nullable public android.content.res.ColorStateList getBackgroundTintList();
     method @Nullable public android.graphics.PorterDuff.Mode getBackgroundTintMode();
-    method @android.view.ViewDebug.ExportedProperty(category="layout") public int getBaseline();
-    method @android.view.ViewDebug.CapturedViewProperty public final int getBottom();
+    method public int getBaseline();
+    method public final int getBottom();
     method protected float getBottomFadingEdgeStrength();
     method protected int getBottomPaddingOffset();
     method public float getCameraDistance();
@@ -52022,10 +52111,10 @@
     method public boolean getClipBounds(android.graphics.Rect);
     method public final boolean getClipToOutline();
     method @Nullable public final android.view.contentcapture.ContentCaptureSession getContentCaptureSession();
-    method @android.view.ViewDebug.ExportedProperty(category="accessibility") public CharSequence getContentDescription();
-    method @android.view.ViewDebug.CapturedViewProperty public final android.content.Context getContext();
+    method public CharSequence getContentDescription();
+    method public final android.content.Context getContext();
     method protected android.view.ContextMenu.ContextMenuInfo getContextMenuInfo();
-    method @android.view.ViewDebug.ExportedProperty(category="focus") public final boolean getDefaultFocusHighlightEnabled();
+    method public final boolean getDefaultFocusHighlightEnabled();
     method public static int getDefaultSize(int, int);
     method public android.view.Display getDisplay();
     method public final int[] getDrawableState();
@@ -52035,11 +52124,11 @@
     method @Deprecated public int getDrawingCacheQuality();
     method public void getDrawingRect(android.graphics.Rect);
     method public long getDrawingTime();
-    method @android.view.ViewDebug.ExportedProperty(category="drawing") public float getElevation();
+    method public float getElevation();
     method @StyleRes public int getExplicitStyle();
-    method @android.view.ViewDebug.ExportedProperty public boolean getFilterTouchesWhenObscured();
-    method @android.view.ViewDebug.ExportedProperty public boolean getFitsSystemWindows();
-    method @android.view.ViewDebug.ExportedProperty(mapping={@android.view.ViewDebug.IntToString(from=android.view.View.NOT_FOCUSABLE, to="NOT_FOCUSABLE"), @android.view.ViewDebug.IntToString(from=android.view.View.FOCUSABLE, to="FOCUSABLE"), @android.view.ViewDebug.IntToString(from=android.view.View.FOCUSABLE_AUTO, to="FOCUSABLE_AUTO")}, category="focus") public int getFocusable();
+    method public boolean getFilterTouchesWhenObscured();
+    method public boolean getFitsSystemWindows();
+    method public int getFocusable();
     method public java.util.ArrayList<android.view.View> getFocusables(int);
     method public void getFocusedRect(android.graphics.Rect);
     method public android.graphics.drawable.Drawable getForeground();
@@ -52051,23 +52140,23 @@
     method public final boolean getGlobalVisibleRect(android.graphics.Rect);
     method public android.os.Handler getHandler();
     method public final boolean getHasOverlappingRendering();
-    method @android.view.ViewDebug.ExportedProperty(category="layout") public final int getHeight();
+    method public final int getHeight();
     method public void getHitRect(android.graphics.Rect);
     method public int getHorizontalFadingEdgeLength();
     method protected int getHorizontalScrollbarHeight();
     method @Nullable public android.graphics.drawable.Drawable getHorizontalScrollbarThumbDrawable();
     method @Nullable public android.graphics.drawable.Drawable getHorizontalScrollbarTrackDrawable();
-    method @android.view.ViewDebug.CapturedViewProperty @IdRes public int getId();
-    method @android.view.ViewDebug.ExportedProperty(category="accessibility", mapping={@android.view.ViewDebug.IntToString(from=android.view.View.IMPORTANT_FOR_ACCESSIBILITY_AUTO, to="auto"), @android.view.ViewDebug.IntToString(from=android.view.View.IMPORTANT_FOR_ACCESSIBILITY_YES, to="yes"), @android.view.ViewDebug.IntToString(from=android.view.View.IMPORTANT_FOR_ACCESSIBILITY_NO, to="no"), @android.view.ViewDebug.IntToString(from=android.view.View.IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS, to="noHideDescendants")}) public int getImportantForAccessibility();
-    method @android.view.ViewDebug.ExportedProperty(mapping={@android.view.ViewDebug.IntToString(from=android.view.View.IMPORTANT_FOR_AUTOFILL_AUTO, to="auto"), @android.view.ViewDebug.IntToString(from=android.view.View.IMPORTANT_FOR_AUTOFILL_YES, to="yes"), @android.view.ViewDebug.IntToString(from=android.view.View.IMPORTANT_FOR_AUTOFILL_NO, to="no"), @android.view.ViewDebug.IntToString(from=android.view.View.IMPORTANT_FOR_AUTOFILL_YES_EXCLUDE_DESCENDANTS, to="yesExcludeDescendants"), @android.view.ViewDebug.IntToString(from=android.view.View.IMPORTANT_FOR_AUTOFILL_NO_EXCLUDE_DESCENDANTS, to="noExcludeDescendants")}) public int getImportantForAutofill();
-    method @android.view.ViewDebug.ExportedProperty(mapping={@android.view.ViewDebug.IntToString(from=android.view.View.IMPORTANT_FOR_CONTENT_CAPTURE_AUTO, to="auto"), @android.view.ViewDebug.IntToString(from=android.view.View.IMPORTANT_FOR_CONTENT_CAPTURE_YES, to="yes"), @android.view.ViewDebug.IntToString(from=android.view.View.IMPORTANT_FOR_CONTENT_CAPTURE_NO, to="no"), @android.view.ViewDebug.IntToString(from=android.view.View.IMPORTANT_FOR_CONTENT_CAPTURE_YES_EXCLUDE_DESCENDANTS, to="yesExcludeDescendants"), @android.view.ViewDebug.IntToString(from=android.view.View.IMPORTANT_FOR_CONTENT_CAPTURE_NO_EXCLUDE_DESCENDANTS, to="noExcludeDescendants")}) public int getImportantForContentCapture();
+    method @IdRes public int getId();
+    method public int getImportantForAccessibility();
+    method public int getImportantForAutofill();
+    method public int getImportantForContentCapture();
     method public boolean getKeepScreenOn();
     method public android.view.KeyEvent.DispatcherState getKeyDispatcherState();
-    method @android.view.ViewDebug.ExportedProperty(category="accessibility") @IdRes public int getLabelFor();
+    method @IdRes public int getLabelFor();
     method public int getLayerType();
-    method @android.view.ViewDebug.ExportedProperty(category="layout", mapping={@android.view.ViewDebug.IntToString(from=android.view.View.LAYOUT_DIRECTION_LTR, to="RESOLVED_DIRECTION_LTR"), @android.view.ViewDebug.IntToString(from=android.view.View.LAYOUT_DIRECTION_RTL, to="RESOLVED_DIRECTION_RTL")}) public int getLayoutDirection();
-    method @android.view.ViewDebug.ExportedProperty(deepExport=true, prefix="layout_") public android.view.ViewGroup.LayoutParams getLayoutParams();
-    method @android.view.ViewDebug.CapturedViewProperty public final int getLeft();
+    method public int getLayoutDirection();
+    method public android.view.ViewGroup.LayoutParams getLayoutParams();
+    method public final int getLeft();
     method protected float getLeftFadingEdgeStrength();
     method protected int getLeftPaddingOffset();
     method public final boolean getLocalVisibleRect(android.graphics.Rect);
@@ -52076,10 +52165,10 @@
     method public void getLocationOnScreen(@Size(2) int[]);
     method public android.graphics.Matrix getMatrix();
     method public final int getMeasuredHeight();
-    method @android.view.ViewDebug.ExportedProperty(category="measurement", flagMapping={@android.view.ViewDebug.FlagToString(mask=android.view.View.MEASURED_STATE_MASK, equals=android.view.View.MEASURED_STATE_TOO_SMALL, name="MEASURED_STATE_TOO_SMALL")}) public final int getMeasuredHeightAndState();
+    method public final int getMeasuredHeightAndState();
     method public final int getMeasuredState();
     method public final int getMeasuredWidth();
-    method @android.view.ViewDebug.ExportedProperty(category="measurement", flagMapping={@android.view.ViewDebug.FlagToString(mask=android.view.View.MEASURED_STATE_MASK, equals=android.view.View.MEASURED_STATE_TOO_SMALL, name="MEASURED_STATE_TOO_SMALL")}) public final int getMeasuredWidthAndState();
+    method public final int getMeasuredWidthAndState();
     method public int getMinimumHeight();
     method public int getMinimumWidth();
     method @IdRes public int getNextClusterForwardId();
@@ -52102,51 +52191,51 @@
     method public int getPaddingTop();
     method public final android.view.ViewParent getParent();
     method public android.view.ViewParent getParentForAccessibility();
-    method @android.view.ViewDebug.ExportedProperty(category="drawing") public float getPivotX();
-    method @android.view.ViewDebug.ExportedProperty(category="drawing") public float getPivotY();
+    method public float getPivotX();
+    method public float getPivotY();
     method public android.view.PointerIcon getPointerIcon();
     method public android.content.res.Resources getResources();
     method public final boolean getRevealOnFocusHint();
-    method @android.view.ViewDebug.CapturedViewProperty public final int getRight();
+    method public final int getRight();
     method protected float getRightFadingEdgeStrength();
     method protected int getRightPaddingOffset();
     method public android.view.View getRootView();
     method public android.view.WindowInsets getRootWindowInsets();
-    method @android.view.ViewDebug.ExportedProperty(category="drawing") public float getRotation();
-    method @android.view.ViewDebug.ExportedProperty(category="drawing") public float getRotationX();
-    method @android.view.ViewDebug.ExportedProperty(category="drawing") public float getRotationY();
-    method @android.view.ViewDebug.ExportedProperty(category="drawing") public float getScaleX();
-    method @android.view.ViewDebug.ExportedProperty(category="drawing") public float getScaleY();
+    method public float getRotation();
+    method public float getRotationX();
+    method public float getRotationY();
+    method public float getScaleX();
+    method public float getScaleY();
     method public int getScrollBarDefaultDelayBeforeFade();
     method public int getScrollBarFadeDuration();
     method public int getScrollBarSize();
-    method @android.view.ViewDebug.ExportedProperty(mapping={@android.view.ViewDebug.IntToString(from=android.view.View.SCROLLBARS_INSIDE_OVERLAY, to="INSIDE_OVERLAY"), @android.view.ViewDebug.IntToString(from=android.view.View.SCROLLBARS_INSIDE_INSET, to="INSIDE_INSET"), @android.view.ViewDebug.IntToString(from=android.view.View.SCROLLBARS_OUTSIDE_OVERLAY, to="OUTSIDE_OVERLAY"), @android.view.ViewDebug.IntToString(from=android.view.View.SCROLLBARS_OUTSIDE_INSET, to="OUTSIDE_INSET")}) public int getScrollBarStyle();
+    method public int getScrollBarStyle();
     method public int getScrollIndicators();
     method public final int getScrollX();
     method public final int getScrollY();
-    method @android.view.ViewDebug.ExportedProperty(category="drawing") @ColorInt public int getSolidColor();
+    method @ColorInt public int getSolidColor();
     method @LayoutRes public int getSourceLayoutResId();
-    method @android.view.ViewDebug.ExportedProperty(category="accessibility") @Nullable public final CharSequence getStateDescription();
+    method @Nullable public final CharSequence getStateDescription();
     method public android.animation.StateListAnimator getStateListAnimator();
     method protected int getSuggestedMinimumHeight();
     method protected int getSuggestedMinimumWidth();
     method @NonNull public java.util.List<android.graphics.Rect> getSystemGestureExclusionRects();
     method @Deprecated public int getSystemUiVisibility();
-    method @android.view.ViewDebug.ExportedProperty public Object getTag();
+    method public Object getTag();
     method public Object getTag(int);
-    method @android.view.ViewDebug.ExportedProperty(category="text", mapping={@android.view.ViewDebug.IntToString(from=android.view.View.TEXT_ALIGNMENT_INHERIT, to="INHERIT"), @android.view.ViewDebug.IntToString(from=android.view.View.TEXT_ALIGNMENT_GRAVITY, to="GRAVITY"), @android.view.ViewDebug.IntToString(from=android.view.View.TEXT_ALIGNMENT_TEXT_START, to="TEXT_START"), @android.view.ViewDebug.IntToString(from=android.view.View.TEXT_ALIGNMENT_TEXT_END, to="TEXT_END"), @android.view.ViewDebug.IntToString(from=android.view.View.TEXT_ALIGNMENT_CENTER, to="CENTER"), @android.view.ViewDebug.IntToString(from=android.view.View.TEXT_ALIGNMENT_VIEW_START, to="VIEW_START"), @android.view.ViewDebug.IntToString(from=android.view.View.TEXT_ALIGNMENT_VIEW_END, to="VIEW_END")}) public int getTextAlignment();
-    method @android.view.ViewDebug.ExportedProperty(category="text", mapping={@android.view.ViewDebug.IntToString(from=android.view.View.TEXT_DIRECTION_INHERIT, to="INHERIT"), @android.view.ViewDebug.IntToString(from=android.view.View.TEXT_DIRECTION_FIRST_STRONG, to="FIRST_STRONG"), @android.view.ViewDebug.IntToString(from=android.view.View.TEXT_DIRECTION_ANY_RTL, to="ANY_RTL"), @android.view.ViewDebug.IntToString(from=android.view.View.TEXT_DIRECTION_LTR, to="LTR"), @android.view.ViewDebug.IntToString(from=android.view.View.TEXT_DIRECTION_RTL, to="RTL"), @android.view.ViewDebug.IntToString(from=android.view.View.TEXT_DIRECTION_LOCALE, to="LOCALE"), @android.view.ViewDebug.IntToString(from=android.view.View.TEXT_DIRECTION_FIRST_STRONG_LTR, to="FIRST_STRONG_LTR"), @android.view.ViewDebug.IntToString(from=android.view.View.TEXT_DIRECTION_FIRST_STRONG_RTL, to="FIRST_STRONG_RTL")}) public int getTextDirection();
+    method public int getTextAlignment();
+    method public int getTextDirection();
     method @Nullable public CharSequence getTooltipText();
-    method @android.view.ViewDebug.CapturedViewProperty public final int getTop();
+    method public final int getTop();
     method protected float getTopFadingEdgeStrength();
     method protected int getTopPaddingOffset();
     method public android.view.TouchDelegate getTouchDelegate();
     method public java.util.ArrayList<android.view.View> getTouchables();
-    method @android.view.ViewDebug.ExportedProperty(category="drawing") public float getTransitionAlpha();
-    method @android.view.ViewDebug.ExportedProperty public String getTransitionName();
-    method @android.view.ViewDebug.ExportedProperty(category="drawing") public float getTranslationX();
-    method @android.view.ViewDebug.ExportedProperty(category="drawing") public float getTranslationY();
-    method @android.view.ViewDebug.ExportedProperty(category="drawing") public float getTranslationZ();
+    method public float getTransitionAlpha();
+    method public String getTransitionName();
+    method public float getTranslationX();
+    method public float getTranslationY();
+    method public float getTranslationZ();
     method public long getUniqueDrawingId();
     method public int getVerticalFadingEdgeLength();
     method public int getVerticalScrollbarPosition();
@@ -52154,8 +52243,8 @@
     method @Nullable public android.graphics.drawable.Drawable getVerticalScrollbarTrackDrawable();
     method public int getVerticalScrollbarWidth();
     method public android.view.ViewTreeObserver getViewTreeObserver();
-    method @android.view.ViewDebug.ExportedProperty(mapping={@android.view.ViewDebug.IntToString(from=android.view.View.VISIBLE, to="VISIBLE"), @android.view.ViewDebug.IntToString(from=android.view.View.INVISIBLE, to="INVISIBLE"), @android.view.ViewDebug.IntToString(from=android.view.View.GONE, to="GONE")}) public int getVisibility();
-    method @android.view.ViewDebug.ExportedProperty(category="layout") public final int getWidth();
+    method public int getVisibility();
+    method public final int getWidth();
     method protected int getWindowAttachCount();
     method public android.view.WindowId getWindowId();
     method @Nullable public android.view.WindowInsetsController getWindowInsetsController();
@@ -52163,18 +52252,18 @@
     method public android.os.IBinder getWindowToken();
     method public int getWindowVisibility();
     method public void getWindowVisibleDisplayFrame(android.graphics.Rect);
-    method @android.view.ViewDebug.ExportedProperty(category="drawing") public float getX();
-    method @android.view.ViewDebug.ExportedProperty(category="drawing") public float getY();
-    method @android.view.ViewDebug.ExportedProperty(category="drawing") public float getZ();
+    method public float getX();
+    method public float getY();
+    method public float getZ();
     method public boolean hasExplicitFocusable();
-    method @android.view.ViewDebug.ExportedProperty(category="focus") public boolean hasFocus();
+    method public boolean hasFocus();
     method public boolean hasFocusable();
     method public boolean hasNestedScrollingParent();
     method public boolean hasOnClickListeners();
     method public boolean hasOnLongClickListeners();
-    method @android.view.ViewDebug.ExportedProperty(category="drawing") public boolean hasOverlappingRendering();
+    method public boolean hasOverlappingRendering();
     method public boolean hasPointerCapture();
-    method @android.view.ViewDebug.ExportedProperty(category="layout") public boolean hasTransientState();
+    method public boolean hasTransientState();
     method public boolean hasWindowFocus();
     method public static android.view.View inflate(android.content.Context, @LayoutRes int, android.view.ViewGroup);
     method @Deprecated public void invalidate(android.graphics.Rect);
@@ -52184,50 +52273,50 @@
     method public void invalidateOutline();
     method public boolean isAccessibilityFocused();
     method public boolean isAccessibilityHeading();
-    method @android.view.ViewDebug.ExportedProperty public boolean isActivated();
+    method public boolean isActivated();
     method public boolean isAttachedToWindow();
-    method @android.view.ViewDebug.ExportedProperty public boolean isClickable();
+    method public boolean isClickable();
     method public boolean isContextClickable();
     method public boolean isDirty();
-    method @Deprecated @android.view.ViewDebug.ExportedProperty(category="drawing") public boolean isDrawingCacheEnabled();
+    method @Deprecated public boolean isDrawingCacheEnabled();
     method public boolean isDuplicateParentStateEnabled();
-    method @android.view.ViewDebug.ExportedProperty public boolean isEnabled();
-    method @android.view.ViewDebug.ExportedProperty(category="focus") public final boolean isFocusable();
-    method @android.view.ViewDebug.ExportedProperty(category="focus") public final boolean isFocusableInTouchMode();
-    method @android.view.ViewDebug.ExportedProperty(category="focus") public boolean isFocused();
-    method @android.view.ViewDebug.ExportedProperty(category="focus") public final boolean isFocusedByDefault();
-    method @android.view.ViewDebug.ExportedProperty(category="drawing") public boolean isForceDarkAllowed();
-    method @android.view.ViewDebug.ExportedProperty public boolean isHapticFeedbackEnabled();
-    method @android.view.ViewDebug.ExportedProperty(category="drawing") public boolean isHardwareAccelerated();
+    method public boolean isEnabled();
+    method public final boolean isFocusable();
+    method public final boolean isFocusableInTouchMode();
+    method public boolean isFocused();
+    method public final boolean isFocusedByDefault();
+    method public boolean isForceDarkAllowed();
+    method public boolean isHapticFeedbackEnabled();
+    method public boolean isHardwareAccelerated();
     method public boolean isHorizontalFadingEdgeEnabled();
     method public boolean isHorizontalScrollBarEnabled();
-    method @android.view.ViewDebug.ExportedProperty public boolean isHovered();
+    method public boolean isHovered();
     method public boolean isImportantForAccessibility();
     method public final boolean isImportantForAutofill();
     method public final boolean isImportantForContentCapture();
     method public boolean isInEditMode();
     method public boolean isInLayout();
-    method @android.view.ViewDebug.ExportedProperty public boolean isInTouchMode();
-    method @android.view.ViewDebug.ExportedProperty(category="focus") public final boolean isKeyboardNavigationCluster();
+    method public boolean isInTouchMode();
+    method public final boolean isKeyboardNavigationCluster();
     method public boolean isLaidOut();
     method public boolean isLayoutDirectionResolved();
     method public boolean isLayoutRequested();
     method public boolean isLongClickable();
     method public boolean isNestedScrollingEnabled();
-    method @android.view.ViewDebug.ExportedProperty(category="drawing") public boolean isOpaque();
+    method public boolean isOpaque();
     method protected boolean isPaddingOffsetRequired();
     method public boolean isPaddingRelative();
     method public boolean isPivotSet();
-    method @android.view.ViewDebug.ExportedProperty public boolean isPressed();
+    method public boolean isPressed();
     method public boolean isSaveEnabled();
     method public boolean isSaveFromParentEnabled();
     method public boolean isScreenReaderFocusable();
     method public boolean isScrollContainer();
     method public boolean isScrollbarFadingEnabled();
-    method @android.view.ViewDebug.ExportedProperty public boolean isSelected();
+    method public boolean isSelected();
     method public final boolean isShowingLayoutBounds();
     method public boolean isShown();
-    method @android.view.ViewDebug.ExportedProperty public boolean isSoundEffectsEnabled();
+    method public boolean isSoundEffectsEnabled();
     method public final boolean isTemporarilyDetached();
     method public boolean isTextAlignmentResolved();
     method public boolean isTextDirectionResolved();
@@ -52518,8 +52607,8 @@
     method public void unscheduleDrawable(android.graphics.drawable.Drawable);
     method public final void updateDragShadow(android.view.View.DragShadowBuilder);
     method @CallSuper protected boolean verifyDrawable(@NonNull android.graphics.drawable.Drawable);
-    method @Deprecated @android.view.ViewDebug.ExportedProperty(category="drawing") public boolean willNotCacheDrawing();
-    method @android.view.ViewDebug.ExportedProperty(category="drawing") public boolean willNotDraw();
+    method @Deprecated public boolean willNotCacheDrawing();
+    method public boolean willNotDraw();
     field public static final int ACCESSIBILITY_LIVE_REGION_ASSERTIVE = 2; // 0x2
     field public static final int ACCESSIBILITY_LIVE_REGION_NONE = 0; // 0x0
     field public static final int ACCESSIBILITY_LIVE_REGION_POLITE = 1; // 0x1
@@ -52960,9 +53049,9 @@
     method public static int getChildMeasureSpec(int, int, int);
     method protected boolean getChildStaticTransformation(android.view.View, android.view.animation.Transformation);
     method public boolean getChildVisibleRect(android.view.View, android.graphics.Rect, android.graphics.Point);
-    method @android.view.ViewDebug.ExportedProperty(category="drawing") public boolean getClipChildren();
-    method @android.view.ViewDebug.ExportedProperty(category="drawing") public boolean getClipToPadding();
-    method @android.view.ViewDebug.ExportedProperty(category="focus", mapping={@android.view.ViewDebug.IntToString(from=android.view.ViewGroup.FOCUS_BEFORE_DESCENDANTS, to="FOCUS_BEFORE_DESCENDANTS"), @android.view.ViewDebug.IntToString(from=android.view.ViewGroup.FOCUS_AFTER_DESCENDANTS, to="FOCUS_AFTER_DESCENDANTS"), @android.view.ViewDebug.IntToString(from=android.view.ViewGroup.FOCUS_BLOCK_DESCENDANTS, to="FOCUS_BLOCK_DESCENDANTS")}) public int getDescendantFocusability();
+    method public boolean getClipChildren();
+    method public boolean getClipToPadding();
+    method public int getDescendantFocusability();
     method public android.view.View getFocusedChild();
     method public android.view.animation.LayoutAnimationController getLayoutAnimation();
     method public android.view.animation.Animation.AnimationListener getLayoutAnimationListener();
@@ -52970,14 +53059,14 @@
     method public android.animation.LayoutTransition getLayoutTransition();
     method public int getNestedScrollAxes();
     method public android.view.ViewGroupOverlay getOverlay();
-    method @Deprecated @android.view.ViewDebug.ExportedProperty(category="drawing", mapping={@android.view.ViewDebug.IntToString(from=android.view.ViewGroup.PERSISTENT_NO_CACHE, to="NONE"), @android.view.ViewDebug.IntToString(from=android.view.ViewGroup.PERSISTENT_ANIMATION_CACHE, to="ANIMATION"), @android.view.ViewDebug.IntToString(from=android.view.ViewGroup.PERSISTENT_SCROLLING_CACHE, to="SCROLLING"), @android.view.ViewDebug.IntToString(from=android.view.ViewGroup.PERSISTENT_ALL_CACHES, to="ALL")}) public int getPersistentDrawingCache();
-    method @android.view.ViewDebug.ExportedProperty(category="focus") public boolean getTouchscreenBlocksFocus();
+    method @Deprecated public int getPersistentDrawingCache();
+    method public boolean getTouchscreenBlocksFocus();
     method public int indexOfChild(android.view.View);
     method @Deprecated public final void invalidateChild(android.view.View, android.graphics.Rect);
     method @Deprecated public android.view.ViewParent invalidateChildInParent(int[], android.graphics.Rect);
     method @Deprecated public boolean isAlwaysDrawnWithCacheEnabled();
     method @Deprecated public boolean isAnimationCacheEnabled();
-    method @android.view.ViewDebug.ExportedProperty(category="drawing") protected boolean isChildrenDrawingOrderEnabled();
+    method protected boolean isChildrenDrawingOrderEnabled();
     method @Deprecated protected boolean isChildrenDrawnWithCacheEnabled();
     method public boolean isLayoutSuppressed();
     method public boolean isMotionEventSplittingEnabled();
@@ -53068,9 +53157,9 @@
     field @Deprecated public static final int FILL_PARENT = -1; // 0xffffffff
     field public static final int MATCH_PARENT = -1; // 0xffffffff
     field public static final int WRAP_CONTENT = -2; // 0xfffffffe
-    field @android.view.ViewDebug.ExportedProperty(category="layout", mapping={@android.view.ViewDebug.IntToString(from=android.view.ViewGroup.LayoutParams.MATCH_PARENT, to="MATCH_PARENT"), @android.view.ViewDebug.IntToString(from=android.view.ViewGroup.LayoutParams.WRAP_CONTENT, to="WRAP_CONTENT")}) public int height;
+    field public int height;
     field public android.view.animation.LayoutAnimationController.AnimationParameters layoutAnimationParameters;
-    field @android.view.ViewDebug.ExportedProperty(category="layout", mapping={@android.view.ViewDebug.IntToString(from=android.view.ViewGroup.LayoutParams.MATCH_PARENT, to="MATCH_PARENT"), @android.view.ViewDebug.IntToString(from=android.view.ViewGroup.LayoutParams.WRAP_CONTENT, to="WRAP_CONTENT")}) public int width;
+    field public int width;
   }
 
   public static class ViewGroup.MarginLayoutParams extends android.view.ViewGroup.LayoutParams {
@@ -53086,10 +53175,10 @@
     method public void setMarginEnd(int);
     method public void setMarginStart(int);
     method public void setMargins(int, int, int, int);
-    field @android.view.ViewDebug.ExportedProperty(category="layout") public int bottomMargin;
-    field @android.view.ViewDebug.ExportedProperty(category="layout") public int leftMargin;
-    field @android.view.ViewDebug.ExportedProperty(category="layout") public int rightMargin;
-    field @android.view.ViewDebug.ExportedProperty(category="layout") public int topMargin;
+    field public int bottomMargin;
+    field public int leftMargin;
+    field public int rightMargin;
+    field public int topMargin;
   }
 
   public static interface ViewGroup.OnHierarchyChangeListener {
@@ -53886,11 +53975,11 @@
     field public float alpha;
     field public float buttonBrightness;
     field public float dimAmount;
-    field @android.view.ViewDebug.ExportedProperty(flagMapping={@android.view.ViewDebug.FlagToString(mask=android.view.WindowManager.LayoutParams.FLAG_ALLOW_LOCK_WHILE_SCREEN_ON, equals=android.view.WindowManager.LayoutParams.FLAG_ALLOW_LOCK_WHILE_SCREEN_ON, name="ALLOW_LOCK_WHILE_SCREEN_ON"), @android.view.ViewDebug.FlagToString(mask=android.view.WindowManager.LayoutParams.FLAG_DIM_BEHIND, equals=android.view.WindowManager.LayoutParams.FLAG_DIM_BEHIND, name="DIM_BEHIND"), @android.view.ViewDebug.FlagToString(mask=android.view.WindowManager.LayoutParams.FLAG_BLUR_BEHIND, equals=android.view.WindowManager.LayoutParams.FLAG_BLUR_BEHIND, name="BLUR_BEHIND"), @android.view.ViewDebug.FlagToString(mask=android.view.WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE, equals=android.view.WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE, name="NOT_FOCUSABLE"), @android.view.ViewDebug.FlagToString(mask=android.view.WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE, equals=android.view.WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE, name="NOT_TOUCHABLE"), @android.view.ViewDebug.FlagToString(mask=android.view.WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL, equals=android.view.WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL, name="NOT_TOUCH_MODAL"), @android.view.ViewDebug.FlagToString(mask=android.view.WindowManager.LayoutParams.FLAG_TOUCHABLE_WHEN_WAKING, equals=android.view.WindowManager.LayoutParams.FLAG_TOUCHABLE_WHEN_WAKING, name="TOUCHABLE_WHEN_WAKING"), @android.view.ViewDebug.FlagToString(mask=android.view.WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON, equals=android.view.WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON, name="KEEP_SCREEN_ON"), @android.view.ViewDebug.FlagToString(mask=android.view.WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN, equals=android.view.WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN, name="LAYOUT_IN_SCREEN"), @android.view.ViewDebug.FlagToString(mask=android.view.WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, equals=android.view.WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, name="LAYOUT_NO_LIMITS"), @android.view.ViewDebug.FlagToString(mask=android.view.WindowManager.LayoutParams.FLAG_FULLSCREEN, equals=android.view.WindowManager.LayoutParams.FLAG_FULLSCREEN, name="FULLSCREEN"), @android.view.ViewDebug.FlagToString(mask=android.view.WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN, equals=android.view.WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN, name="FORCE_NOT_FULLSCREEN"), @android.view.ViewDebug.FlagToString(mask=android.view.WindowManager.LayoutParams.FLAG_DITHER, equals=android.view.WindowManager.LayoutParams.FLAG_DITHER, name="DITHER"), @android.view.ViewDebug.FlagToString(mask=android.view.WindowManager.LayoutParams.FLAG_SECURE, equals=android.view.WindowManager.LayoutParams.FLAG_SECURE, name="SECURE"), @android.view.ViewDebug.FlagToString(mask=android.view.WindowManager.LayoutParams.FLAG_SCALED, equals=android.view.WindowManager.LayoutParams.FLAG_SCALED, name="SCALED"), @android.view.ViewDebug.FlagToString(mask=android.view.WindowManager.LayoutParams.FLAG_IGNORE_CHEEK_PRESSES, equals=android.view.WindowManager.LayoutParams.FLAG_IGNORE_CHEEK_PRESSES, name="IGNORE_CHEEK_PRESSES"), @android.view.ViewDebug.FlagToString(mask=android.view.WindowManager.LayoutParams.FLAG_LAYOUT_INSET_DECOR, equals=android.view.WindowManager.LayoutParams.FLAG_LAYOUT_INSET_DECOR, name="LAYOUT_INSET_DECOR"), @android.view.ViewDebug.FlagToString(mask=android.view.WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM, equals=android.view.WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM, name="ALT_FOCUSABLE_IM"), @android.view.ViewDebug.FlagToString(mask=android.view.WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH, equals=android.view.WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH, name="WATCH_OUTSIDE_TOUCH"), @android.view.ViewDebug.FlagToString(mask=android.view.WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED, equals=android.view.WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED, name="SHOW_WHEN_LOCKED"), @android.view.ViewDebug.FlagToString(mask=android.view.WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER, equals=android.view.WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER, name="SHOW_WALLPAPER"), @android.view.ViewDebug.FlagToString(mask=android.view.WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON, equals=android.view.WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON, name="TURN_SCREEN_ON"), @android.view.ViewDebug.FlagToString(mask=android.view.WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD, equals=android.view.WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD, name="DISMISS_KEYGUARD"), @android.view.ViewDebug.FlagToString(mask=android.view.WindowManager.LayoutParams.FLAG_SPLIT_TOUCH, equals=android.view.WindowManager.LayoutParams.FLAG_SPLIT_TOUCH, name="SPLIT_TOUCH"), @android.view.ViewDebug.FlagToString(mask=android.view.WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED, equals=android.view.WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED, name="HARDWARE_ACCELERATED"), @android.view.ViewDebug.FlagToString(mask=android.view.WindowManager.LayoutParams.FLAG_LAYOUT_IN_OVERSCAN, equals=android.view.WindowManager.LayoutParams.FLAG_LAYOUT_IN_OVERSCAN, name="LOCAL_FOCUS_MODE"), @android.view.ViewDebug.FlagToString(mask=android.view.WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS, equals=android.view.WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS, name="TRANSLUCENT_STATUS"), @android.view.ViewDebug.FlagToString(mask=android.view.WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION, equals=android.view.WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION, name="TRANSLUCENT_NAVIGATION"), @android.view.ViewDebug.FlagToString(mask=android.view.WindowManager.LayoutParams.FLAG_LOCAL_FOCUS_MODE, equals=android.view.WindowManager.LayoutParams.FLAG_LOCAL_FOCUS_MODE, name="LOCAL_FOCUS_MODE"), @android.view.ViewDebug.FlagToString(mask=0x20000000, equals=0x20000000, name="FLAG_SLIPPERY"), @android.view.ViewDebug.FlagToString(mask=android.view.WindowManager.LayoutParams.FLAG_LAYOUT_ATTACHED_IN_DECOR, equals=android.view.WindowManager.LayoutParams.FLAG_LAYOUT_ATTACHED_IN_DECOR, name="FLAG_LAYOUT_ATTACHED_IN_DECOR"), @android.view.ViewDebug.FlagToString(mask=android.view.WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS, equals=android.view.WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS, name="DRAWS_SYSTEM_BAR_BACKGROUNDS")}, formatToHexString=true) public int flags;
+    field public int flags;
     field public int format;
     field public int gravity;
     field public float horizontalMargin;
-    field @android.view.ViewDebug.ExportedProperty public float horizontalWeight;
+    field public float horizontalWeight;
     field public int layoutInDisplayCutoutMode;
     field @Deprecated public int memoryType;
     field public String packageName;
@@ -53903,12 +53992,12 @@
     field public int softInputMode;
     field @Deprecated public int systemUiVisibility;
     field public android.os.IBinder token;
-    field @android.view.ViewDebug.ExportedProperty(mapping={@android.view.ViewDebug.IntToString(from=android.view.WindowManager.LayoutParams.TYPE_BASE_APPLICATION, to="BASE_APPLICATION"), @android.view.ViewDebug.IntToString(from=android.view.WindowManager.LayoutParams.TYPE_APPLICATION, to="APPLICATION"), @android.view.ViewDebug.IntToString(from=android.view.WindowManager.LayoutParams.TYPE_APPLICATION_STARTING, to="APPLICATION_STARTING"), @android.view.ViewDebug.IntToString(from=android.view.WindowManager.LayoutParams.TYPE_DRAWN_APPLICATION, to="DRAWN_APPLICATION"), @android.view.ViewDebug.IntToString(from=android.view.WindowManager.LayoutParams.TYPE_APPLICATION_PANEL, to="APPLICATION_PANEL"), @android.view.ViewDebug.IntToString(from=android.view.WindowManager.LayoutParams.TYPE_APPLICATION_MEDIA, to="APPLICATION_MEDIA"), @android.view.ViewDebug.IntToString(from=android.view.WindowManager.LayoutParams.TYPE_APPLICATION_SUB_PANEL, to="APPLICATION_SUB_PANEL"), @android.view.ViewDebug.IntToString(from=0x3ed, to="APPLICATION_ABOVE_SUB_PANEL"), @android.view.ViewDebug.IntToString(from=android.view.WindowManager.LayoutParams.TYPE_APPLICATION_ATTACHED_DIALOG, to="APPLICATION_ATTACHED_DIALOG"), @android.view.ViewDebug.IntToString(from=0x3ec, to="APPLICATION_MEDIA_OVERLAY"), @android.view.ViewDebug.IntToString(from=android.view.WindowManager.LayoutParams.TYPE_STATUS_BAR, to="STATUS_BAR"), @android.view.ViewDebug.IntToString(from=android.view.WindowManager.LayoutParams.TYPE_SEARCH_BAR, to="SEARCH_BAR"), @android.view.ViewDebug.IntToString(from=android.view.WindowManager.LayoutParams.TYPE_PHONE, to="PHONE"), @android.view.ViewDebug.IntToString(from=android.view.WindowManager.LayoutParams.TYPE_SYSTEM_ALERT, to="SYSTEM_ALERT"), @android.view.ViewDebug.IntToString(from=android.view.WindowManager.LayoutParams.TYPE_TOAST, to="TOAST"), @android.view.ViewDebug.IntToString(from=android.view.WindowManager.LayoutParams.TYPE_SYSTEM_OVERLAY, to="SYSTEM_OVERLAY"), @android.view.ViewDebug.IntToString(from=android.view.WindowManager.LayoutParams.TYPE_PRIORITY_PHONE, to="PRIORITY_PHONE"), @android.view.ViewDebug.IntToString(from=android.view.WindowManager.LayoutParams.TYPE_SYSTEM_DIALOG, to="SYSTEM_DIALOG"), @android.view.ViewDebug.IntToString(from=android.view.WindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG, to="KEYGUARD_DIALOG"), @android.view.ViewDebug.IntToString(from=android.view.WindowManager.LayoutParams.TYPE_SYSTEM_ERROR, to="SYSTEM_ERROR"), @android.view.ViewDebug.IntToString(from=android.view.WindowManager.LayoutParams.TYPE_INPUT_METHOD, to="INPUT_METHOD"), @android.view.ViewDebug.IntToString(from=android.view.WindowManager.LayoutParams.TYPE_INPUT_METHOD_DIALOG, to="INPUT_METHOD_DIALOG"), @android.view.ViewDebug.IntToString(from=android.view.WindowManager.LayoutParams.TYPE_WALLPAPER, to="WALLPAPER"), @android.view.ViewDebug.IntToString(from=android.view.WindowManager.LayoutParams.TYPE_STATUS_BAR_PANEL, to="STATUS_BAR_PANEL"), @android.view.ViewDebug.IntToString(from=0x7df, to="SECURE_SYSTEM_OVERLAY"), @android.view.ViewDebug.IntToString(from=0x7e0, to="DRAG"), @android.view.ViewDebug.IntToString(from=0x7e1, to="STATUS_BAR_SUB_PANEL"), @android.view.ViewDebug.IntToString(from=0x7e2, to="POINTER"), @android.view.ViewDebug.IntToString(from=0x7e3, to="NAVIGATION_BAR"), @android.view.ViewDebug.IntToString(from=0x7e4, to="VOLUME_OVERLAY"), @android.view.ViewDebug.IntToString(from=0x7e5, to="BOOT_PROGRESS"), @android.view.ViewDebug.IntToString(from=0x7e6, to="INPUT_CONSUMER"), @android.view.ViewDebug.IntToString(from=0x7e8, to="NAVIGATION_BAR_PANEL"), @android.view.ViewDebug.IntToString(from=0x7ea, to="DISPLAY_OVERLAY"), @android.view.ViewDebug.IntToString(from=0x7eb, to="MAGNIFICATION_OVERLAY"), @android.view.ViewDebug.IntToString(from=0x7f5, to="PRESENTATION"), @android.view.ViewDebug.IntToString(from=android.view.WindowManager.LayoutParams.TYPE_PRIVATE_PRESENTATION, to="PRIVATE_PRESENTATION"), @android.view.ViewDebug.IntToString(from=0x7ef, to="VOICE_INTERACTION"), @android.view.ViewDebug.IntToString(from=0x7f1, to="VOICE_INTERACTION_STARTING"), @android.view.ViewDebug.IntToString(from=0x7f2, to="DOCK_DIVIDER"), @android.view.ViewDebug.IntToString(from=0x7f3, to="QS_DIALOG"), @android.view.ViewDebug.IntToString(from=0x7f4, to="SCREENSHOT"), @android.view.ViewDebug.IntToString(from=android.view.WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY, to="APPLICATION_OVERLAY")}) public int type;
+    field public int type;
     field public float verticalMargin;
-    field @android.view.ViewDebug.ExportedProperty public float verticalWeight;
+    field public float verticalWeight;
     field public int windowAnimations;
-    field @android.view.ViewDebug.ExportedProperty public int x;
-    field @android.view.ViewDebug.ExportedProperty public int y;
+    field public int x;
+    field public int y;
   }
 
   public final class WindowMetrics {
@@ -56645,21 +56734,21 @@
     method public void flingScroll(int, int);
     method @Deprecated public void freeMemory();
     method @Nullable public android.net.http.SslCertificate getCertificate();
-    method @android.view.ViewDebug.ExportedProperty(category="webview") public int getContentHeight();
+    method public int getContentHeight();
     method @Nullable public static android.content.pm.PackageInfo getCurrentWebViewPackage();
     method @Nullable public android.graphics.Bitmap getFavicon();
     method @NonNull public android.webkit.WebView.HitTestResult getHitTestResult();
     method @Deprecated @Nullable public String[] getHttpAuthUsernamePassword(String, String);
-    method @android.view.ViewDebug.ExportedProperty(category="webview") @Nullable public String getOriginalUrl();
+    method @Nullable public String getOriginalUrl();
     method public int getProgress();
     method public boolean getRendererPriorityWaivedWhenNotVisible();
     method public int getRendererRequestedPriority();
     method @NonNull public static android.net.Uri getSafeBrowsingPrivacyPolicyUrl();
-    method @Deprecated @android.view.ViewDebug.ExportedProperty(category="webview") public float getScale();
+    method @Deprecated public float getScale();
     method @NonNull public android.webkit.WebSettings getSettings();
     method @NonNull public android.view.textclassifier.TextClassifier getTextClassifier();
-    method @android.view.ViewDebug.ExportedProperty(category="webview") @Nullable public String getTitle();
-    method @android.view.ViewDebug.ExportedProperty(category="webview") @Nullable public String getUrl();
+    method @Nullable public String getTitle();
+    method @Nullable public String getUrl();
     method @Nullable public android.webkit.WebChromeClient getWebChromeClient();
     method @NonNull public static ClassLoader getWebViewClassLoader();
     method @NonNull public android.webkit.WebViewClient getWebViewClient();
@@ -56861,7 +56950,7 @@
     method public void fling(int);
     method public android.widget.AbsListView.LayoutParams generateLayoutParams(android.util.AttributeSet);
     method @ColorInt public int getBottomEdgeEffectColor();
-    method @android.view.ViewDebug.ExportedProperty(category="drawing") @ColorInt public int getCacheColorHint();
+    method @ColorInt public int getCacheColorHint();
     method public int getCheckedItemCount();
     method public long[] getCheckedItemIds();
     method public int getCheckedItemPosition();
@@ -56871,7 +56960,7 @@
     method public int getListPaddingLeft();
     method public int getListPaddingRight();
     method public int getListPaddingTop();
-    method @android.view.ViewDebug.ExportedProperty public android.view.View getSelectedView();
+    method public android.view.View getSelectedView();
     method public android.graphics.drawable.Drawable getSelector();
     method public CharSequence getTextFilter();
     method @ColorInt public int getTopEdgeEffectColor();
@@ -56881,13 +56970,13 @@
     method public void invalidateViews();
     method public boolean isDrawSelectorOnTop();
     method public boolean isFastScrollAlwaysVisible();
-    method @android.view.ViewDebug.ExportedProperty public boolean isFastScrollEnabled();
+    method public boolean isFastScrollEnabled();
     method protected boolean isInFilterMode();
     method public boolean isItemChecked(int);
-    method @android.view.ViewDebug.ExportedProperty public boolean isScrollingCacheEnabled();
-    method @android.view.ViewDebug.ExportedProperty public boolean isSmoothScrollbarEnabled();
-    method @android.view.ViewDebug.ExportedProperty public boolean isStackFromBottom();
-    method @android.view.ViewDebug.ExportedProperty public boolean isTextFilterEnabled();
+    method public boolean isScrollingCacheEnabled();
+    method public boolean isSmoothScrollbarEnabled();
+    method public boolean isStackFromBottom();
+    method public boolean isTextFilterEnabled();
     method protected void layoutChildren();
     method public void onFilterComplete(int);
     method public void onGlobalLayout();
@@ -57084,7 +57173,7 @@
     ctor public AdapterView(android.content.Context, android.util.AttributeSet, int);
     ctor public AdapterView(android.content.Context, android.util.AttributeSet, int, int);
     method public abstract T getAdapter();
-    method @android.view.ViewDebug.CapturedViewProperty public int getCount();
+    method public int getCount();
     method public android.view.View getEmptyView();
     method public int getFirstVisiblePosition();
     method public Object getItemAtPosition(int);
@@ -57095,8 +57184,8 @@
     method @Nullable public final android.widget.AdapterView.OnItemSelectedListener getOnItemSelectedListener();
     method public int getPositionForView(android.view.View);
     method public Object getSelectedItem();
-    method @android.view.ViewDebug.CapturedViewProperty public long getSelectedItemId();
-    method @android.view.ViewDebug.CapturedViewProperty public int getSelectedItemPosition();
+    method public long getSelectedItemId();
+    method public int getSelectedItemPosition();
     method public abstract android.view.View getSelectedView();
     method public boolean performItemClick(android.view.View, int, long);
     method public abstract void setAdapter(T);
@@ -57397,7 +57486,7 @@
     method @Nullable public android.graphics.BlendMode getCheckMarkTintBlendMode();
     method @Nullable public android.content.res.ColorStateList getCheckMarkTintList();
     method @Nullable public android.graphics.PorterDuff.Mode getCheckMarkTintMode();
-    method @android.view.ViewDebug.ExportedProperty public boolean isChecked();
+    method public boolean isChecked();
     method public void setCheckMarkDrawable(@DrawableRes int);
     method public void setCheckMarkDrawable(@Nullable android.graphics.drawable.Drawable);
     method public void setCheckMarkTintBlendMode(@Nullable android.graphics.BlendMode);
@@ -57438,7 +57527,7 @@
     method @Nullable public android.graphics.BlendMode getButtonTintBlendMode();
     method @Nullable public android.content.res.ColorStateList getButtonTintList();
     method @Nullable public android.graphics.PorterDuff.Mode getButtonTintMode();
-    method @android.view.ViewDebug.ExportedProperty public boolean isChecked();
+    method public boolean isChecked();
     method public void setButtonDrawable(@DrawableRes int);
     method public void setButtonDrawable(@Nullable android.graphics.drawable.Drawable);
     method public void setButtonTintBlendMode(@Nullable android.graphics.BlendMode);
@@ -57827,7 +57916,7 @@
     method public int getColumnWidth();
     method public int getGravity();
     method public int getHorizontalSpacing();
-    method @android.view.ViewDebug.ExportedProperty public int getNumColumns();
+    method public int getNumColumns();
     method public int getRequestedColumnWidth();
     method public int getRequestedHorizontalSpacing();
     method public int getStretchMode();
@@ -58018,8 +58107,8 @@
     ctor public LinearLayout.LayoutParams(android.view.ViewGroup.MarginLayoutParams);
     ctor public LinearLayout.LayoutParams(android.widget.LinearLayout.LayoutParams);
     method public String debug(String);
-    field @android.view.ViewDebug.ExportedProperty(category="layout", mapping={@android.view.ViewDebug.IntToString(from=0xffffffff, to="NONE"), @android.view.ViewDebug.IntToString(from=android.view.Gravity.NO_GRAVITY, to="NONE"), @android.view.ViewDebug.IntToString(from=android.view.Gravity.TOP, to="TOP"), @android.view.ViewDebug.IntToString(from=android.view.Gravity.BOTTOM, to="BOTTOM"), @android.view.ViewDebug.IntToString(from=android.view.Gravity.LEFT, to="LEFT"), @android.view.ViewDebug.IntToString(from=android.view.Gravity.RIGHT, to="RIGHT"), @android.view.ViewDebug.IntToString(from=android.view.Gravity.START, to="START"), @android.view.ViewDebug.IntToString(from=android.view.Gravity.END, to="END"), @android.view.ViewDebug.IntToString(from=android.view.Gravity.CENTER_VERTICAL, to="CENTER_VERTICAL"), @android.view.ViewDebug.IntToString(from=android.view.Gravity.FILL_VERTICAL, to="FILL_VERTICAL"), @android.view.ViewDebug.IntToString(from=android.view.Gravity.CENTER_HORIZONTAL, to="CENTER_HORIZONTAL"), @android.view.ViewDebug.IntToString(from=android.view.Gravity.FILL_HORIZONTAL, to="FILL_HORIZONTAL"), @android.view.ViewDebug.IntToString(from=android.view.Gravity.CENTER, to="CENTER"), @android.view.ViewDebug.IntToString(from=android.view.Gravity.FILL, to="FILL")}) public int gravity;
-    field @android.view.ViewDebug.ExportedProperty(category="layout") public float weight;
+    field public int gravity;
+    field public float weight;
   }
 
   public interface ListAdapter extends android.widget.Adapter {
@@ -58408,13 +58497,13 @@
     method @Nullable public android.content.res.ColorStateList getIndeterminateTintList();
     method @Nullable public android.graphics.PorterDuff.Mode getIndeterminateTintMode();
     method public android.view.animation.Interpolator getInterpolator();
-    method @android.view.ViewDebug.ExportedProperty(category="progress") public int getMax();
+    method public int getMax();
     method @Px public int getMaxHeight();
     method @Px public int getMaxWidth();
-    method @android.view.ViewDebug.ExportedProperty(category="progress") public int getMin();
+    method public int getMin();
     method @Px public int getMinHeight();
     method @Px public int getMinWidth();
-    method @android.view.ViewDebug.ExportedProperty(category="progress") public int getProgress();
+    method public int getProgress();
     method @Nullable public android.graphics.BlendMode getProgressBackgroundTintBlendMode();
     method @Nullable public android.content.res.ColorStateList getProgressBackgroundTintList();
     method @Nullable public android.graphics.PorterDuff.Mode getProgressBackgroundTintMode();
@@ -58422,14 +58511,14 @@
     method @Nullable public android.graphics.BlendMode getProgressTintBlendMode();
     method @Nullable public android.content.res.ColorStateList getProgressTintList();
     method @Nullable public android.graphics.PorterDuff.Mode getProgressTintMode();
-    method @android.view.ViewDebug.ExportedProperty(category="progress") public int getSecondaryProgress();
+    method public int getSecondaryProgress();
     method @Nullable public android.graphics.BlendMode getSecondaryProgressTintBlendMode();
     method @Nullable public android.content.res.ColorStateList getSecondaryProgressTintList();
     method @Nullable public android.graphics.PorterDuff.Mode getSecondaryProgressTintMode();
     method public final void incrementProgressBy(int);
     method public final void incrementSecondaryProgressBy(int);
     method public boolean isAnimating();
-    method @android.view.ViewDebug.ExportedProperty(category="progress") public boolean isIndeterminate();
+    method public boolean isIndeterminate();
     method public void onRestoreInstanceState(android.os.Parcelable);
     method public android.os.Parcelable onSaveInstanceState();
     method public void setIndeterminate(boolean);
@@ -58580,7 +58669,7 @@
     method public int getRule(int);
     method public int[] getRules();
     method public void removeRule(int);
-    field @android.view.ViewDebug.ExportedProperty(category="layout") public boolean alignWithParent;
+    field public boolean alignWithParent;
   }
 
   public class RemoteViews implements android.view.LayoutInflater.Filter android.os.Parcelable {
@@ -59139,8 +59228,8 @@
     ctor public TableRow.LayoutParams(int);
     ctor public TableRow.LayoutParams(android.view.ViewGroup.LayoutParams);
     ctor public TableRow.LayoutParams(android.view.ViewGroup.MarginLayoutParams);
-    field @android.view.ViewDebug.ExportedProperty(category="layout") public int column;
-    field @android.view.ViewDebug.ExportedProperty(category="layout") public int span;
+    field public int column;
+    field public int span;
   }
 
   @android.widget.RemoteViews.RemoteView public class TextClock extends android.widget.TextView {
@@ -59148,8 +59237,8 @@
     ctor public TextClock(android.content.Context, android.util.AttributeSet);
     ctor public TextClock(android.content.Context, android.util.AttributeSet, int);
     ctor public TextClock(android.content.Context, android.util.AttributeSet, int, int);
-    method @android.view.ViewDebug.ExportedProperty public CharSequence getFormat12Hour();
-    method @android.view.ViewDebug.ExportedProperty public CharSequence getFormat24Hour();
+    method public CharSequence getFormat12Hour();
+    method public CharSequence getFormat24Hour();
     method public String getTimeZone();
     method public boolean is24HourModeEnabled();
     method public void refreshTime();
@@ -59208,7 +59297,7 @@
     method protected boolean getDefaultEditable();
     method protected android.text.method.MovementMethod getDefaultMovementMethod();
     method public android.text.Editable getEditableText();
-    method @android.view.ViewDebug.ExportedProperty public android.text.TextUtils.TruncateAt getEllipsize();
+    method public android.text.TextUtils.TruncateAt getEllipsize();
     method public CharSequence getError();
     method public int getExtendedPaddingBottom();
     method public int getExtendedPaddingTop();
@@ -59219,7 +59308,7 @@
     method public boolean getFreezesText();
     method public int getGravity();
     method @ColorInt public int getHighlightColor();
-    method @android.view.ViewDebug.CapturedViewProperty public CharSequence getHint();
+    method public CharSequence getHint();
     method public final android.content.res.ColorStateList getHintTextColors();
     method public int getHyphenationFrequency();
     method public int getImeActionId();
@@ -59255,14 +59344,14 @@
     method public android.text.TextPaint getPaint();
     method public int getPaintFlags();
     method public String getPrivateImeOptions();
-    method @android.view.ViewDebug.ExportedProperty(category="text") public int getSelectionEnd();
-    method @android.view.ViewDebug.ExportedProperty(category="text") public int getSelectionStart();
+    method public int getSelectionEnd();
+    method public int getSelectionStart();
     method @ColorInt public int getShadowColor();
     method public float getShadowDx();
     method public float getShadowDy();
     method public float getShadowRadius();
     method public final boolean getShowSoftInputOnFocus();
-    method @android.view.ViewDebug.CapturedViewProperty public CharSequence getText();
+    method public CharSequence getText();
     method @NonNull public android.view.textclassifier.TextClassifier getTextClassifier();
     method public final android.content.res.ColorStateList getTextColors();
     method @Nullable public android.graphics.drawable.Drawable getTextCursorDrawable();
@@ -59274,7 +59363,7 @@
     method @Nullable public android.graphics.drawable.Drawable getTextSelectHandle();
     method @Nullable public android.graphics.drawable.Drawable getTextSelectHandleLeft();
     method @Nullable public android.graphics.drawable.Drawable getTextSelectHandleRight();
-    method @android.view.ViewDebug.ExportedProperty(category="text") public float getTextSize();
+    method public float getTextSize();
     method public int getTextSizeUnit();
     method public int getTotalPaddingBottom();
     method public int getTotalPaddingEnd();
diff --git a/non-updatable-api/system-current.txt b/non-updatable-api/system-current.txt
index 256bf33..9e66800 100644
--- a/non-updatable-api/system-current.txt
+++ b/non-updatable-api/system-current.txt
@@ -7849,6 +7849,7 @@
     field public static final String NAMESPACE_AUTOFILL = "autofill";
     field public static final String NAMESPACE_BIOMETRICS = "biometrics";
     field public static final String NAMESPACE_BLOBSTORE = "blobstore";
+    field public static final String NAMESPACE_BLUETOOTH = "bluetooth";
     field public static final String NAMESPACE_CONNECTIVITY = "connectivity";
     field public static final String NAMESPACE_CONTENT_CAPTURE = "content_capture";
     field @Deprecated public static final String NAMESPACE_DEX_BOOT = "dex_boot";
@@ -8648,7 +8649,7 @@
   public abstract class EuiccService extends android.app.Service {
     ctor public EuiccService();
     method public void dump(@NonNull java.io.PrintWriter);
-    method public int encodeSmdxSubjectAndReasonCode(@Nullable String, @Nullable String) throws java.lang.IllegalArgumentException, java.lang.NumberFormatException, java.lang.UnsupportedOperationException;
+    method public int encodeSmdxSubjectAndReasonCode(@Nullable String, @Nullable String);
     method @CallSuper public android.os.IBinder onBind(android.content.Intent);
     method public abstract int onDeleteSubscription(int, String);
     method public android.service.euicc.DownloadSubscriptionResult onDownloadSubscription(int, @NonNull android.telephony.euicc.DownloadableSubscription, boolean, boolean, @Nullable android.os.Bundle);
@@ -9085,7 +9086,7 @@
   }
 
   public static class CallScreeningService.CallResponse.Builder {
-    method @NonNull public android.telecom.CallScreeningService.CallResponse.Builder setShouldScreenCallViaAudioProcessing(boolean);
+    method @NonNull @RequiresPermission(android.Manifest.permission.CAPTURE_AUDIO_OUTPUT) public android.telecom.CallScreeningService.CallResponse.Builder setShouldScreenCallViaAudioProcessing(boolean);
   }
 
   public abstract class Conference extends android.telecom.Conferenceable {
@@ -9541,85 +9542,6 @@
     field @NonNull public static final android.os.Parcelable.Creator<android.telephony.DataSpecificRegistrationInfo> CREATOR;
   }
 
-  public final class DisconnectCause {
-    field public static final int ALREADY_DIALING = 72; // 0x48
-    field public static final int ANSWERED_ELSEWHERE = 52; // 0x34
-    field public static final int BUSY = 4; // 0x4
-    field public static final int CALLING_DISABLED = 74; // 0x4a
-    field public static final int CALL_BARRED = 20; // 0x14
-    field public static final int CALL_PULLED = 51; // 0x33
-    field public static final int CANT_CALL_WHILE_RINGING = 73; // 0x49
-    field public static final int CDMA_ACCESS_BLOCKED = 35; // 0x23
-    field public static final int CDMA_ACCESS_FAILURE = 32; // 0x20
-    field public static final int CDMA_ALREADY_ACTIVATED = 49; // 0x31
-    field public static final int CDMA_DROP = 27; // 0x1b
-    field public static final int CDMA_INTERCEPT = 28; // 0x1c
-    field public static final int CDMA_LOCKED_UNTIL_POWER_CYCLE = 26; // 0x1a
-    field public static final int CDMA_NOT_EMERGENCY = 34; // 0x22
-    field public static final int CDMA_PREEMPTED = 33; // 0x21
-    field public static final int CDMA_REORDER = 29; // 0x1d
-    field public static final int CDMA_RETRY_ORDER = 31; // 0x1f
-    field public static final int CDMA_SO_REJECT = 30; // 0x1e
-    field public static final int CONGESTION = 5; // 0x5
-    field public static final int CS_RESTRICTED = 22; // 0x16
-    field public static final int CS_RESTRICTED_EMERGENCY = 24; // 0x18
-    field public static final int CS_RESTRICTED_NORMAL = 23; // 0x17
-    field public static final int DATA_DISABLED = 54; // 0x36
-    field public static final int DATA_LIMIT_REACHED = 55; // 0x37
-    field public static final int DIALED_CALL_FORWARDING_WHILE_ROAMING = 57; // 0x39
-    field public static final int DIALED_MMI = 39; // 0x27
-    field public static final int DIAL_LOW_BATTERY = 62; // 0x3e
-    field public static final int DIAL_MODIFIED_TO_DIAL = 48; // 0x30
-    field public static final int DIAL_MODIFIED_TO_DIAL_VIDEO = 66; // 0x42
-    field public static final int DIAL_MODIFIED_TO_SS = 47; // 0x2f
-    field public static final int DIAL_MODIFIED_TO_USSD = 46; // 0x2e
-    field public static final int DIAL_VIDEO_MODIFIED_TO_DIAL = 69; // 0x45
-    field public static final int DIAL_VIDEO_MODIFIED_TO_DIAL_VIDEO = 70; // 0x46
-    field public static final int DIAL_VIDEO_MODIFIED_TO_SS = 67; // 0x43
-    field public static final int DIAL_VIDEO_MODIFIED_TO_USSD = 68; // 0x44
-    field public static final int EMERGENCY_PERM_FAILURE = 64; // 0x40
-    field public static final int EMERGENCY_TEMP_FAILURE = 63; // 0x3f
-    field public static final int ERROR_UNSPECIFIED = 36; // 0x24
-    field public static final int FDN_BLOCKED = 21; // 0x15
-    field public static final int ICC_ERROR = 19; // 0x13
-    field public static final int IMEI_NOT_ACCEPTED = 58; // 0x3a
-    field public static final int IMS_ACCESS_BLOCKED = 60; // 0x3c
-    field public static final int IMS_MERGED_SUCCESSFULLY = 45; // 0x2d
-    field public static final int IMS_SIP_ALTERNATE_EMERGENCY_CALL = 71; // 0x47
-    field public static final int INCOMING_AUTO_REJECTED = 81; // 0x51
-    field public static final int INCOMING_MISSED = 1; // 0x1
-    field public static final int INCOMING_REJECTED = 16; // 0x10
-    field public static final int INVALID_CREDENTIALS = 10; // 0xa
-    field public static final int INVALID_NUMBER = 7; // 0x7
-    field public static final int LIMIT_EXCEEDED = 15; // 0xf
-    field public static final int LOCAL = 3; // 0x3
-    field public static final int LOST_SIGNAL = 14; // 0xe
-    field public static final int LOW_BATTERY = 61; // 0x3d
-    field public static final int MAXIMUM_NUMBER_OF_CALLS_REACHED = 53; // 0x35
-    field public static final int MMI = 6; // 0x6
-    field public static final int NORMAL = 2; // 0x2
-    field public static final int NORMAL_UNSPECIFIED = 65; // 0x41
-    field public static final int NOT_DISCONNECTED = 0; // 0x0
-    field public static final int NOT_VALID = -1; // 0xffffffff
-    field public static final int NO_PHONE_NUMBER_SUPPLIED = 38; // 0x26
-    field public static final int NUMBER_UNREACHABLE = 8; // 0x8
-    field public static final int OTASP_PROVISIONING_IN_PROCESS = 76; // 0x4c
-    field public static final int OUTGOING_CANCELED = 44; // 0x2c
-    field public static final int OUTGOING_EMERGENCY_CALL_PLACED = 80; // 0x50
-    field public static final int OUTGOING_FAILURE = 43; // 0x2b
-    field public static final int OUT_OF_NETWORK = 11; // 0xb
-    field public static final int OUT_OF_SERVICE = 18; // 0x12
-    field public static final int POWER_OFF = 17; // 0x11
-    field public static final int SERVER_ERROR = 12; // 0xc
-    field public static final int SERVER_UNREACHABLE = 9; // 0x9
-    field public static final int TIMED_OUT = 13; // 0xd
-    field public static final int TOO_MANY_ONGOING_CALLS = 75; // 0x4b
-    field public static final int UNOBTAINABLE_NUMBER = 25; // 0x19
-    field public static final int VIDEO_CALL_NOT_ALLOWED_WHILE_TTY_ENABLED = 50; // 0x32
-    field public static final int VOICEMAIL_NUMBER_MISSING = 40; // 0x28
-    field public static final int WIFI_LOST = 59; // 0x3b
-  }
-
   public final class ImsiEncryptionInfo implements android.os.Parcelable {
     method public int describeContents();
     method @Nullable public String getKeyIdentifier();
@@ -11395,6 +11317,7 @@
   public class MbmsDownloadServiceBase extends android.os.Binder implements android.os.IInterface {
     ctor public MbmsDownloadServiceBase();
     method public int addProgressListener(android.telephony.mbms.DownloadRequest, android.telephony.mbms.DownloadProgressListener) throws android.os.RemoteException;
+    method public int addServiceAnnouncement(int, @NonNull byte[]);
     method public int addStatusListener(android.telephony.mbms.DownloadRequest, android.telephony.mbms.DownloadStatusListener) throws android.os.RemoteException;
     method public android.os.IBinder asBinder();
     method public int cancelDownload(android.telephony.mbms.DownloadRequest) throws android.os.RemoteException;
diff --git a/non-updatable-api/system-lint-baseline.txt b/non-updatable-api/system-lint-baseline.txt
index 2829243..395ddc1 100644
--- a/non-updatable-api/system-lint-baseline.txt
+++ b/non-updatable-api/system-lint-baseline.txt
@@ -1,74 +1,88 @@
 // Baseline format: 1.0
 ArrayReturn: android.view.contentcapture.ViewNode#getAutofillOptions():
-    Method should return Collection<CharSequence> (or subclass) instead of raw array; was `java.lang.CharSequence[]`
+    
+
+
+BuilderSetStyle: android.net.IpSecTransform.Builder#buildTunnelModeTransform(java.net.InetAddress, android.net.IpSecManager.SecurityParameterIndex):
+    Builder methods names should use setFoo() / addFoo() / clearFoo() style: method android.net.IpSecTransform.Builder.buildTunnelModeTransform(java.net.InetAddress,android.net.IpSecManager.SecurityParameterIndex)
 
 
 GenericException: android.app.prediction.AppPredictor#finalize():
-    Methods must not throw generic exceptions (`java.lang.Throwable`)
+    
 GenericException: android.hardware.location.ContextHubClient#finalize():
-    Methods must not throw generic exceptions (`java.lang.Throwable`)
+    
 GenericException: android.net.IpSecManager.IpSecTunnelInterface#finalize():
-    Methods must not throw generic exceptions (`java.lang.Throwable`)
+    
 GenericException: android.service.autofill.augmented.FillWindow#finalize():
-    Methods must not throw generic exceptions (`java.lang.Throwable`)
+    
 
 
 KotlinKeyword: android.app.Notification#when:
-    Avoid field names that are Kotlin hard keywords ("when"); see https://android.github.io/kotlin-guides/interop.html#no-hard-keywords
+    
+
+
+MissingGetterMatchingBuilder: android.security.keystore.KeyGenParameterSpec.Builder#setUid(int):
+    android.security.keystore.KeyGenParameterSpec does not declare a `getUid()` method matching method android.security.keystore.KeyGenParameterSpec.Builder.setUid(int)
+MissingGetterMatchingBuilder: android.service.autofill.Dataset.Builder#setFieldInlinePresentation(android.view.autofill.AutofillId, android.view.autofill.AutofillValue, java.util.regex.Pattern, android.service.autofill.InlinePresentation):
+    android.service.autofill.Dataset does not declare a `getFieldInlinePresentation()` method matching method android.service.autofill.Dataset.Builder.setFieldInlinePresentation(android.view.autofill.AutofillId,android.view.autofill.AutofillValue,java.util.regex.Pattern,android.service.autofill.InlinePresentation)
+MissingGetterMatchingBuilder: android.telecom.CallScreeningService.CallResponse.Builder#setShouldScreenCallViaAudioProcessing(boolean):
+    android.telecom.CallScreeningService.CallResponse does not declare a `shouldScreenCallViaAudioProcessing()` method matching method android.telecom.CallScreeningService.CallResponse.Builder.setShouldScreenCallViaAudioProcessing(boolean)
+MissingGetterMatchingBuilder: android.telephony.mbms.DownloadRequest.Builder#setServiceId(String):
+    android.telephony.mbms.DownloadRequest does not declare a `getServiceId()` method matching method android.telephony.mbms.DownloadRequest.Builder.setServiceId(String)
 
 
 MissingNullability: android.media.soundtrigger.SoundTriggerDetectionService#onUnbind(android.content.Intent) parameter #0:
-    Missing nullability on parameter `intent` in method `onUnbind`
+    
 MissingNullability: android.media.tv.TvRecordingClient.RecordingCallback#onEvent(String, String, android.os.Bundle) parameter #0:
-    Missing nullability on parameter `inputId` in method `onEvent`
+    
 MissingNullability: android.media.tv.TvRecordingClient.RecordingCallback#onEvent(String, String, android.os.Bundle) parameter #1:
-    Missing nullability on parameter `eventType` in method `onEvent`
+    
 MissingNullability: android.media.tv.TvRecordingClient.RecordingCallback#onEvent(String, String, android.os.Bundle) parameter #2:
-    Missing nullability on parameter `eventArgs` in method `onEvent`
+    
 MissingNullability: android.printservice.recommendation.RecommendationService#attachBaseContext(android.content.Context) parameter #0:
-    Missing nullability on parameter `base` in method `attachBaseContext`
+    
 MissingNullability: android.provider.ContactsContract.MetadataSync#CONTENT_URI:
-    Missing nullability on field `CONTENT_URI` in class `class android.provider.ContactsContract.MetadataSync`
+    
 MissingNullability: android.provider.ContactsContract.MetadataSync#METADATA_AUTHORITY_URI:
-    Missing nullability on field `METADATA_AUTHORITY_URI` in class `class android.provider.ContactsContract.MetadataSync`
+    
 MissingNullability: android.provider.ContactsContract.MetadataSyncState#CONTENT_URI:
-    Missing nullability on field `CONTENT_URI` in class `class android.provider.ContactsContract.MetadataSyncState`
+    
 MissingNullability: android.provider.SearchIndexablesProvider#attachInfo(android.content.Context, android.content.pm.ProviderInfo) parameter #0:
-    Missing nullability on parameter `context` in method `attachInfo`
+    
 MissingNullability: android.provider.SearchIndexablesProvider#attachInfo(android.content.Context, android.content.pm.ProviderInfo) parameter #1:
-    Missing nullability on parameter `info` in method `attachInfo`
+    
 MissingNullability: android.service.autofill.augmented.AugmentedAutofillService#onUnbind(android.content.Intent) parameter #0:
-    Missing nullability on parameter `intent` in method `onUnbind`
+    
 MissingNullability: android.service.contentcapture.ContentCaptureService#dump(java.io.FileDescriptor, java.io.PrintWriter, String[]) parameter #0:
-    Missing nullability on parameter `fd` in method `dump`
+    
 MissingNullability: android.service.contentcapture.ContentCaptureService#dump(java.io.FileDescriptor, java.io.PrintWriter, String[]) parameter #1:
-    Missing nullability on parameter `pw` in method `dump`
+    
 MissingNullability: android.service.contentcapture.ContentCaptureService#dump(java.io.FileDescriptor, java.io.PrintWriter, String[]) parameter #2:
-    Missing nullability on parameter `args` in method `dump`
+    
 MissingNullability: android.service.notification.NotificationAssistantService#attachBaseContext(android.content.Context) parameter #0:
-    Missing nullability on parameter `base` in method `attachBaseContext`
+    
 MissingNullability: android.telephony.NetworkService#onUnbind(android.content.Intent) parameter #0:
-    Missing nullability on parameter `intent` in method `onUnbind`
+    
 MissingNullability: android.telephony.SubscriptionPlan.Builder#createRecurringDaily(java.time.ZonedDateTime) parameter #0:
-    Missing nullability on parameter `start` in method `createRecurringDaily`
+    
 MissingNullability: android.telephony.SubscriptionPlan.Builder#createRecurringMonthly(java.time.ZonedDateTime) parameter #0:
-    Missing nullability on parameter `start` in method `createRecurringMonthly`
+    
 MissingNullability: android.telephony.SubscriptionPlan.Builder#createRecurringWeekly(java.time.ZonedDateTime) parameter #0:
-    Missing nullability on parameter `start` in method `createRecurringWeekly`
+    
 MissingNullability: android.telephony.data.DataService#onUnbind(android.content.Intent) parameter #0:
-    Missing nullability on parameter `intent` in method `onUnbind`
+    
 MissingNullability: android.telephony.mbms.DownloadRequest.Builder#setServiceId(String):
-    Missing nullability on method `setServiceId` return
+    
 MissingNullability: android.telephony.mbms.DownloadRequest.Builder#setServiceId(String) parameter #0:
-    Missing nullability on parameter `serviceId` in method `setServiceId`
+    
 
 
 ProtectedMember: android.printservice.recommendation.RecommendationService#attachBaseContext(android.content.Context):
-    Protected methods not allowed; must be public: method android.printservice.recommendation.RecommendationService.attachBaseContext(android.content.Context)}
+    
 ProtectedMember: android.service.contentcapture.ContentCaptureService#dump(java.io.FileDescriptor, java.io.PrintWriter, String[]):
-    Protected methods not allowed; must be public: method android.service.contentcapture.ContentCaptureService.dump(java.io.FileDescriptor,java.io.PrintWriter,String[])}
+    
 ProtectedMember: android.service.notification.NotificationAssistantService#attachBaseContext(android.content.Context):
-    Protected methods not allowed; must be public: method android.service.notification.NotificationAssistantService.attachBaseContext(android.content.Context)}
+    
 
 
 SamShouldBeLast: android.accounts.AccountManager#addAccount(String, String, String[], android.os.Bundle, android.app.Activity, android.accounts.AccountManagerCallback<android.os.Bundle>, android.os.Handler):
@@ -168,7 +182,7 @@
 SamShouldBeLast: android.media.AudioRouting#addOnRoutingChangedListener(android.media.AudioRouting.OnRoutingChangedListener, android.os.Handler):
     
 SamShouldBeLast: android.media.AudioTrack#addOnRoutingChangedListener(android.media.AudioRouting.OnRoutingChangedListener, android.os.Handler):
-    SAM-compatible parameters (such as parameter 1, "listener", in android.media.AudioTrack.addOnRoutingChangedListener) should be last to improve Kotlin interoperability; see https://kotlinlang.org/docs/reference/java-interop.html#sam-conversions
+    
 SamShouldBeLast: android.media.MediaRecorder#addOnRoutingChangedListener(android.media.AudioRouting.OnRoutingChangedListener, android.os.Handler):
     
 SamShouldBeLast: android.media.MediaRecorder#registerAudioRecordingCallback(java.util.concurrent.Executor, android.media.AudioManager.AudioRecordingCallback):
diff --git a/packages/CarrierDefaultApp/OWNERS b/packages/CarrierDefaultApp/OWNERS
index 0d8e69b..5668840 100644
--- a/packages/CarrierDefaultApp/OWNERS
+++ b/packages/CarrierDefaultApp/OWNERS
@@ -1,8 +1,8 @@
+set noparent
 tgunn@google.com
 breadley@google.com
 hallliu@google.com
 rgreenwalt@google.com
-mpq@google.com
 amitmahajan@google.com
 fionaxu@google.com
 jackyu@google.com
@@ -12,3 +12,6 @@
 refuhoo@google.com
 nazaninb@google.com
 sarahchin@google.com
+dbright@google.com
+xiaotonj@google.com
+
diff --git a/packages/CarrierDefaultApp/src/com/android/carrierdefaultapp/CaptivePortalLoginActivity.java b/packages/CarrierDefaultApp/src/com/android/carrierdefaultapp/CaptivePortalLoginActivity.java
index 5054281..6fab9e4 100644
--- a/packages/CarrierDefaultApp/src/com/android/carrierdefaultapp/CaptivePortalLoginActivity.java
+++ b/packages/CarrierDefaultApp/src/com/android/carrierdefaultapp/CaptivePortalLoginActivity.java
@@ -106,6 +106,7 @@
         webSettings.setSupportZoom(true);
         webSettings.setBuiltInZoomControls(true);
         webSettings.setDomStorageEnabled(true);
+        webSettings.setAllowFileAccess(false);
         mWebViewClient = new MyWebViewClient();
         mWebView.setWebViewClient(mWebViewClient);
         mWebView.setWebChromeClient(new MyWebChromeClient());
diff --git a/packages/CtsShim/Android.bp b/packages/CtsShim/Android.bp
index 7728464..49608b3 100644
--- a/packages/CtsShim/Android.bp
+++ b/packages/CtsShim/Android.bp
@@ -43,6 +43,16 @@
         },
     },
     presigned: true,
+
+    apex_available: [
+        "//apex_available:platform",
+        "com.android.apex.cts.shim.v1",
+        "com.android.apex.cts.shim.v2",
+        "com.android.apex.cts.shim.v2_legacy",
+        "com.android.apex.cts.shim.v2_no_hashtree",
+        "com.android.apex.cts.shim.v2_sdk_target_p",
+        "com.android.apex.cts.shim.v3",
+    ],
 }
 
 //##########################################################
@@ -71,4 +81,14 @@
         },
     },
     presigned: true,
+
+    apex_available: [
+        "//apex_available:platform",
+        "com.android.apex.cts.shim.v1",
+        "com.android.apex.cts.shim.v2",
+        "com.android.apex.cts.shim.v2_legacy",
+        "com.android.apex.cts.shim.v2_no_hashtree",
+        "com.android.apex.cts.shim.v2_sdk_target_p",
+        "com.android.apex.cts.shim.v3",
+    ],
 }
diff --git a/packages/CtsShim/build/jni/Android.bp b/packages/CtsShim/build/jni/Android.bp
index 4477582..4a1973c 100644
--- a/packages/CtsShim/build/jni/Android.bp
+++ b/packages/CtsShim/build/jni/Android.bp
@@ -17,6 +17,7 @@
 cc_library_shared {
     name: "libshim_jni",
     srcs: ["Shim.c"],
+    header_libs: ["jni_headers"],
     sdk_version: "24",
     apex_available: [
         "//apex_available:platform",
diff --git a/packages/InputDevices/res/raw/keyboard_layout_belarusian.kcm b/packages/InputDevices/res/raw/keyboard_layout_belarusian.kcm
new file mode 100644
index 0000000..3deb9dd
--- /dev/null
+++ b/packages/InputDevices/res/raw/keyboard_layout_belarusian.kcm
@@ -0,0 +1,343 @@
+# Copyright (C) 2020 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.
+
+# Belarusian keyboard layout.
+# This is a typical Belarusian PC keyboard layout.
+# As an added convenience, English characters are accessible using ralt (Alt Gr).
+#
+
+type OVERLAY
+map key 86 BACKSLASH
+### ROW 1
+key GRAVE {
+    label:                              '\u0401'
+    base:                               '\u0451'
+    shift, capslock:                    '\u0401'
+    ralt:                               '`'
+    ralt+shift:                         '~'
+}
+key 1 {
+    label:                              '1'
+    base:                               '1'
+    shift:                              '!'
+    ralt:                               '!'
+}
+key 2 {
+    label:                              '2'
+    base:                               '2'
+    shift:                              '"'
+    ralt:                               '@'
+}
+key 3 {
+    label:                              '3'
+    base:                               '3'
+    shift:                              '\u2116'
+    ralt:                               '#'
+}
+key 4 {
+    label:                              '4'
+    base:                               '4'
+    shift:                              ';'
+    ralt:                               '$'
+}
+key 5 {
+    label:                              '5'
+    base:                               '5'
+    shift:                              '%'
+    ralt:                               '%'
+}
+key 6 {
+    label:                              '6'
+    base:                               '6'
+    shift:                              ':'
+    ralt:                               '^'
+}
+key 7 {
+    label:                              '7'
+    base:                               '7'
+    shift:                              '?'
+    ralt:                               '&'
+}
+key 8 {
+    label:                              '8'
+    base:                               '8'
+    shift:                              '*'
+    ralt:                               '*'
+}
+key 9 {
+    label:                              '9'
+    base:                               '9'
+    shift:                              '('
+    ralt:                               '('
+}
+key 0 {
+    label:                              '0'
+    base:                               '0'
+    shift:                              ')'
+    ralt:                               ')'
+}
+key MINUS {
+    label:                              '-'
+    base:                               '-'
+    shift:                              '_'
+    ralt:                               '-'
+    ralt+shift:                         '_'
+}
+key EQUALS {
+    label:                              '='
+    base:                               '='
+    shift:                              '+'
+    ralt:                               '='
+    ralt+shift:                         '+'
+}
+### ROW 2
+key Q {
+    label:                              '\u0419'
+    base:                               '\u0439'
+    shift, capslock:                    '\u0419'
+    ralt:                               'q'
+    ralt+shift, ralt+capslock:          'Q'
+}
+key W {
+    label:                              '\u0426'
+    base:                               '\u0446'
+    shift, capslock:                    '\u0426'
+    ralt:                               'w'
+    ralt+shift, ralt+capslock:          'W'
+}
+key E {
+    label:                              '\u0423'
+    base:                               '\u0443'
+    shift, capslock:                    '\u0423'
+    ralt:                               'e'
+    ralt+shift, ralt+capslock:          'E'
+}
+key R {
+    label:                              '\u041a'
+    base:                               '\u043a'
+    shift, capslock:                    '\u041a'
+    ralt:                               'r'
+    ralt+shift, ralt+capslock:          'R'
+}
+key T {
+    label:                              '\u0415'
+    base:                               '\u0435'
+    shift, capslock:                    '\u0415'
+    ralt:                               't'
+    ralt+shift, ralt+capslock:          'T'
+}
+key Y {
+    label:                              '\u041d'
+    base:                               '\u043d'
+    shift, capslock:                    '\u041d'
+    ralt:                               'y'
+    ralt+shift, ralt+capslock:          'Y'
+}
+key U {
+    label:                              '\u0413'
+    base:                               '\u0433'
+    shift, capslock:                    '\u0413'
+    ralt:                               'u'
+    ralt+shift, ralt+capslock:          'U'
+}
+key I {
+    label:                              '\u0428'
+    base:                               '\u0448'
+    shift, capslock:                    '\u0428'
+    ralt:                               'i'
+    ralt+shift, ralt+capslock:          'I'
+}
+key O {
+    label:                              '\u040E'
+    base:                               '\u045E'
+    shift, capslock:                    '\u040E'
+    ralt:                               'o'
+    ralt+shift, ralt+capslock:          'O'
+}
+key P {
+    label:                              '\u0417'
+    base:                               '\u0437'
+    shift, capslock:                    '\u0417'
+    ralt:                               'p'
+    ralt+shift, ralt+capslock:          'P'
+}
+key LEFT_BRACKET {
+    label:                              '\u0425'
+    base:                               '\u0445'
+    shift, capslock:                    '\u0425'
+    ralt:                               '['
+    ralt+shift:                         '{'
+}
+key RIGHT_BRACKET {
+    label:                              '\u0027'
+    base:                               '\u0027'
+    shift, capslock:                    '\u0027'
+    ralt:                               ']'
+    ralt+shift:                         '}'
+}
+### ROW 3
+key A {
+    label:                              '\u0424'
+    base:                               '\u0444'
+    shift, capslock:                    '\u0424'
+    ralt:                               'a'
+    ralt+shift, ralt+capslock:          'A'
+}
+key S {
+    label:                              '\u042b'
+    base:                               '\u044b'
+    shift, capslock:                    '\u042b'
+    ralt:                               's'
+    ralt+shift, ralt+capslock:          'S'
+}
+key D {
+    label:                              '\u0412'
+    base:                               '\u0432'
+    shift, capslock:                    '\u0412'
+    ralt:                               'd'
+    ralt+shift, ralt+capslock:          'D'
+}
+key F {
+    label:                              '\u0410'
+    base:                               '\u0430'
+    shift, capslock:                    '\u0410'
+    ralt:                               'f'
+    ralt+shift, ralt+capslock:          'F'
+}
+key G {
+    label:                              '\u041f'
+    base:                               '\u043f'
+    shift, capslock:                    '\u041f'
+    ralt:                               'g'
+    ralt+shift, ralt+capslock:          'G'
+}
+key H {
+    label:                              '\u0420'
+    base:                               '\u0440'
+    shift, capslock:                    '\u0420'
+    ralt:                               'h'
+    ralt+shift, ralt+capslock:          'H'
+}
+key J {
+    label:                              '\u041e'
+    base:                               '\u043e'
+    shift, capslock:                    '\u041e'
+    ralt:                               'j'
+    ralt+shift, ralt+capslock:          'J'
+}
+key K {
+    label:                              '\u041b'
+    base:                               '\u043b'
+    shift, capslock:                    '\u041b'
+    ralt:                               'k'
+    ralt+shift, ralt+capslock:          'K'
+}
+key L {
+    label:                              '\u0414'
+    base:                               '\u0434'
+    shift, capslock:                    '\u0414'
+    ralt:                               'l'
+    ralt+shift, ralt+capslock:          'L'
+}
+key SEMICOLON {
+    label:                              '\u0416'
+    base:                               '\u0436'
+    shift, capslock:                    '\u0416'
+    ralt:                               ';'
+    ralt+shift:                         ':'
+}
+key APOSTROPHE {
+    label:                              '\u042d'
+    base:                               '\u044d'
+    shift, capslock:                    '\u042d'
+    ralt:                               '\''
+    ralt+shift:                         '"'
+}
+key BACKSLASH {
+    label:                              '\\'
+    base:                               '\\'
+    shift:                              '/'
+    ralt:                               '|'
+}
+### ROW 4
+key Z {
+    label:                              '\u042f'
+    base:                               '\u044f'
+    shift, capslock:                    '\u042f'
+    ralt:                               'z'
+    ralt+shift, ralt+capslock:          'Z'
+}
+key X {
+    label:                              '\u0427'
+    base:                               '\u0447'
+    shift, capslock:                    '\u0427'
+    ralt:                               'x'
+    ralt+shift, ralt+capslock:          'X'
+}
+key C {
+    label:                              '\u0421'
+    base:                               '\u0441'
+    shift, capslock:                    '\u0421'
+    ralt:                               'c'
+    ralt+shift, ralt+capslock:          'C'
+}
+key V {
+    label:                              '\u041c'
+    base:                               '\u043c'
+    shift, capslock:                    '\u041c'
+    ralt:                               'v'
+    ralt+shift, ralt+capslock:          'V'
+}
+key B {
+    label:                              '\u0406'
+    base:                               '\u0456'
+    shift, capslock:                    '\u0406'
+    ralt:                               'b'
+    ralt+shift, ralt+capslock:          'B'
+}
+key N {
+    label:                              '\u0422'
+    base:                               '\u0442'
+    shift, capslock:                    '\u0422'
+    ralt:                               'n'
+    ralt+shift, ralt+capslock:          'N'
+}
+key M {
+    label:                              '\u042c'
+    base:                               '\u044c'
+    shift, capslock:                    '\u042c'
+    ralt:                               'm'
+    ralt+shift, ralt+capslock:          'M'
+}
+key COMMA {
+    label:                              '\u0411'
+    base:                               '\u0431'
+    shift, capslock:                    '\u0411'
+    ralt:                               ','
+    ralt+shift:                         '<'
+}
+key PERIOD {
+    label:                              '\u042e'
+    base:                               '\u044e'
+    shift, capslock:                    '\u042e'
+    ralt:                               '.'
+    ralt+shift:                         '>'
+}
+key SLASH {
+    label:                              '.'
+    base:                               '.'
+    shift:                              ','
+    ralt:                               '/'
+    ralt+shift:                         '?'
+}
diff --git a/packages/InputDevices/res/values/strings.xml b/packages/InputDevices/res/values/strings.xml
index 5fdc4a6..ac70c94 100644
--- a/packages/InputDevices/res/values/strings.xml
+++ b/packages/InputDevices/res/values/strings.xml
@@ -128,4 +128,7 @@
 
     <!-- Polish keyboard layout label. [CHAR LIMIT=35] -->
     <string name="keyboard_layout_polish">Polish</string>
+
+    <!-- Belarusian keyboard layout label. [CHAR LIMIT=35] -->
+    <string name="keyboard_layout_belarusian">Belarusian</string>
 </resources>
diff --git a/packages/InputDevices/res/xml/keyboard_layouts.xml b/packages/InputDevices/res/xml/keyboard_layouts.xml
index 1807aea..68ca093 100644
--- a/packages/InputDevices/res/xml/keyboard_layouts.xml
+++ b/packages/InputDevices/res/xml/keyboard_layouts.xml
@@ -163,4 +163,8 @@
     <keyboard-layout android:name="keyboard_layout_polish"
             android:label="@string/keyboard_layout_polish"
             android:keyboardLayout="@raw/keyboard_layout_polish" />
+
+    <keyboard-layout android:name="keyboard_layout_belarusian"
+            android:label="@string/keyboard_layout_belarusian"
+            android:keyboardLayout="@raw/keyboard_layout_belarusian" />
 </keyboard-layouts>
diff --git a/packages/SettingsLib/OWNERS b/packages/SettingsLib/OWNERS
index d7bd6a4..8eafbdf 100644
--- a/packages/SettingsLib/OWNERS
+++ b/packages/SettingsLib/OWNERS
@@ -5,10 +5,8 @@
 evanlaird@google.com
 juliacr@google.com
 leifhendrik@google.com
-rafftsai@google.com
 tmfang@google.com
 virgild@google.com
-zhfan@google.com
 
 # Exempt resource files (because they are in a flat directory and too hard to manage via OWNERS)
 per-file *.xml=*
diff --git a/packages/SettingsLib/src/com/android/settingslib/bluetooth/CachedBluetoothDevice.java b/packages/SettingsLib/src/com/android/settingslib/bluetooth/CachedBluetoothDevice.java
index db219c9..287f804 100644
--- a/packages/SettingsLib/src/com/android/settingslib/bluetooth/CachedBluetoothDevice.java
+++ b/packages/SettingsLib/src/com/android/settingslib/bluetooth/CachedBluetoothDevice.java
@@ -688,8 +688,8 @@
          * If a connect was attempted earlier without any UUID, we will do the connect now.
          * Otherwise, allow the connect on UUID change.
          */
-        if (!mProfiles.isEmpty()
-                && ((mConnectAttempted + timeout) > SystemClock.elapsedRealtime())) {
+        if ((mConnectAttempted + timeout) > SystemClock.elapsedRealtime()) {
+            Log.d(TAG, "onUuidChanged: triggering connectAllEnabledProfiles");
             connectAllEnabledProfiles();
         }
 
diff --git a/packages/SettingsLib/src/com/android/settingslib/datetime/ZoneGetter.java b/packages/SettingsLib/src/com/android/settingslib/datetime/ZoneGetter.java
index d48aa24..e5fd0ba 100644
--- a/packages/SettingsLib/src/com/android/settingslib/datetime/ZoneGetter.java
+++ b/packages/SettingsLib/src/com/android/settingslib/datetime/ZoneGetter.java
@@ -32,12 +32,11 @@
 import androidx.core.text.BidiFormatter;
 import androidx.core.text.TextDirectionHeuristicsCompat;
 
+import com.android.i18n.timezone.CountryTimeZones;
+import com.android.i18n.timezone.CountryTimeZones.TimeZoneMapping;
+import com.android.i18n.timezone.TimeZoneFinder;
 import com.android.settingslib.R;
 
-import libcore.timezone.CountryTimeZones;
-import libcore.timezone.CountryTimeZones.TimeZoneMapping;
-import libcore.timezone.TimeZoneFinder;
-
 import org.xmlpull.v1.XmlPullParserException;
 
 import java.util.ArrayList;
@@ -242,7 +241,16 @@
         final TimeZoneNames.NameType nameType =
                 tz.inDaylightTime(now) ? TimeZoneNames.NameType.LONG_DAYLIGHT
                         : TimeZoneNames.NameType.LONG_STANDARD;
-        return names.getDisplayName(tz.getID(), nameType, now.getTime());
+        return names.getDisplayName(getCanonicalZoneId(tz), nameType, now.getTime());
+    }
+
+    private static String getCanonicalZoneId(TimeZone timeZone) {
+        final String id = timeZone.getID();
+        final String canonicalId = android.icu.util.TimeZone.getCanonicalID(id);
+        if (canonicalId != null) {
+            return canonicalId;
+        }
+        return id;
     }
 
     private static void appendWithTtsSpan(SpannableStringBuilder builder, CharSequence content,
diff --git a/packages/SettingsLib/src/com/android/settingslib/wifi/WifiStatusTracker.java b/packages/SettingsLib/src/com/android/settingslib/wifi/WifiStatusTracker.java
index d7e76a1..b7ae3dc 100644
--- a/packages/SettingsLib/src/com/android/settingslib/wifi/WifiStatusTracker.java
+++ b/packages/SettingsLib/src/com/android/settingslib/wifi/WifiStatusTracker.java
@@ -214,6 +214,9 @@
     }
 
     private void updateStatusLabel() {
+        if (mWifiManager == null) {
+            return;
+        }
         NetworkCapabilities networkCapabilities;
         final Network currentWifiNetwork = mWifiManager.getCurrentNetwork();
         if (currentWifiNetwork != null && currentWifiNetwork.equals(mDefaultNetwork)) {
diff --git a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProtoDumpUtil.java b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProtoDumpUtil.java
index aae72e5..1d25b1a 100644
--- a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProtoDumpUtil.java
+++ b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProtoDumpUtil.java
@@ -1413,9 +1413,6 @@
                 Settings.Global.SYS_STORAGE_CACHE_MAX_BYTES,
                 GlobalSettingsProto.Sys.STORAGE_CACHE_MAX_BYTES);
         dumpSetting(s, p,
-                Settings.Global.SYS_VDSO,
-                GlobalSettingsProto.Sys.VDSO);
-        dumpSetting(s, p,
                 Settings.Global.SYS_UIDCPUPOWER,
                 GlobalSettingsProto.Sys.UIDCPUPOWER);
         p.end(sysToken);
diff --git a/packages/SettingsProvider/test/src/android/provider/SettingsBackupTest.java b/packages/SettingsProvider/test/src/android/provider/SettingsBackupTest.java
index eb7ad72..b90b9c1 100644
--- a/packages/SettingsProvider/test/src/android/provider/SettingsBackupTest.java
+++ b/packages/SettingsProvider/test/src/android/provider/SettingsBackupTest.java
@@ -464,7 +464,6 @@
                     Settings.Global.SYS_STORAGE_FULL_THRESHOLD_BYTES,
                     Settings.Global.SYS_STORAGE_THRESHOLD_MAX_BYTES,
                     Settings.Global.SYS_STORAGE_THRESHOLD_PERCENTAGE,
-                    Settings.Global.SYS_VDSO,
                     Settings.Global.SYS_UIDCPUPOWER,
                     Settings.Global.SYS_TRACED,
                     Settings.Global.FPS_DEVISOR,
diff --git a/packages/Shell/AndroidManifest.xml b/packages/Shell/AndroidManifest.xml
index 570c2ab3..d50dc7c 100644
--- a/packages/Shell/AndroidManifest.xml
+++ b/packages/Shell/AndroidManifest.xml
@@ -365,6 +365,7 @@
 
         <receiver
             android:name=".BugreportRequestedReceiver"
+            android:exported="true"
             android:permission="android.permission.TRIGGER_SHELL_BUGREPORT">
             <intent-filter>
                 <action android:name="com.android.internal.intent.action.BUGREPORT_REQUESTED" />
@@ -373,6 +374,7 @@
 
         <receiver
             android:name=".HeapDumpReceiver"
+            android:exported="true"
             android:permission="android.permission.DUMP">
             <intent-filter>
                 <action android:name="android.intent.action.BOOT_COMPLETED" />
diff --git a/packages/Shell/tests/AndroidManifest.xml b/packages/Shell/tests/AndroidManifest.xml
index e845ef9..23877fd 100644
--- a/packages/Shell/tests/AndroidManifest.xml
+++ b/packages/Shell/tests/AndroidManifest.xml
@@ -27,6 +27,7 @@
             android:label="ActionSendMultipleConsumer"
             android:theme="@android:style/Theme.NoDisplay"
             android:noHistory="true"
+            android:exported="true"
             android:excludeFromRecents="true">
             <intent-filter>
                 <action android:name="android.intent.action.SEND_MULTIPLE" />
diff --git a/packages/SystemUI/OWNERS b/packages/SystemUI/OWNERS
index 28491d6..17d2f9c 100644
--- a/packages/SystemUI/OWNERS
+++ b/packages/SystemUI/OWNERS
@@ -44,7 +44,7 @@
 zakcohen@google.com
 
 #Android Auto
-stenning@google.com
+hseog@google.com
 
 #Android TV
 rgl@google.com
diff --git a/packages/SystemUI/res/drawable/ic_qs_nfc_enabled.xml b/packages/SystemUI/res/drawable/ic_qs_nfc.xml
similarity index 95%
rename from packages/SystemUI/res/drawable/ic_qs_nfc_enabled.xml
rename to packages/SystemUI/res/drawable/ic_qs_nfc.xml
index becb18a..2c08096 100644
--- a/packages/SystemUI/res/drawable/ic_qs_nfc_enabled.xml
+++ b/packages/SystemUI/res/drawable/ic_qs_nfc.xml
@@ -14,8 +14,8 @@
      limitations under the License.
 -->
 <vector xmlns:android="http://schemas.android.com/apk/res/android"
-    android:width="24dp"
-    android:height="24dp"
+    android:width="48dp"
+    android:height="48dp"
     android:viewportWidth="24"
     android:viewportHeight="24">
 
diff --git a/packages/SystemUI/res/drawable/ic_qs_nfc_disabled.xml b/packages/SystemUI/res/drawable/ic_qs_nfc_disabled.xml
deleted file mode 100644
index 558f3d0..0000000
--- a/packages/SystemUI/res/drawable/ic_qs_nfc_disabled.xml
+++ /dev/null
@@ -1,31 +0,0 @@
-<!--
-     Copyright (C) 2016 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.
--->
-<vector xmlns:android="http://schemas.android.com/apk/res/android"
-    android:width="24dp"
-    android:height="24dp"
-    android:viewportWidth="24"
-    android:viewportHeight="24">
-
-    <path
-        android:pathData="M4 20h16V4H4v16z" />
-    <path
-        android:fillColor="#4DFFFFFF"
-        android:pathData="M20 2H4c-1.1 0-2 .9-2 2v16c0 1.1 .9 2 2 2h16c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm0
-18H4V4h16v16zM18 6h-5c-1.1 0-2 .9-2 2v2.28c-.6 .35 -1 .98-1 1.72 0 1.1 .9 2 2
-2s2-.9 2-2c0-.74-.4-1.38-1-1.72V8h3v8H8V8h2V6H6v12h12V6z" />
-    <path
-        android:pathData="M0 0h24v24H0z" />
-</vector>
diff --git a/packages/SystemUI/res/layout/menu_ime.xml b/packages/SystemUI/res/layout/menu_ime.xml
index 24374e8..df717f6 100644
--- a/packages/SystemUI/res/layout/menu_ime.xml
+++ b/packages/SystemUI/res/layout/menu_ime.xml
@@ -17,13 +17,13 @@
 <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:systemui="http://schemas.android.com/apk/res-auto"
     android:id="@+id/menu_container"
-    android:layout_width="@dimen/navigation_key_width"
+    android:layout_width="@dimen/navigation_side_padding"
     android:layout_height="match_parent"
     android:importantForAccessibility="no"
     >
     <!-- Use nav button width & height=match_parent for parent FrameLayout and buttons because they
     are placed inside a view that has a size controlled by weight. Ensure weight is large enough to
-    support icon size. -->
+    support icon size. Use layout_width=navigation_side_padding like other navbar buttons. -->
 
     <com.android.systemui.statusbar.policy.KeyButtonView
         android:id="@+id/menu"
diff --git a/packages/SystemUI/src/com/android/systemui/dagger/SystemServicesModule.java b/packages/SystemUI/src/com/android/systemui/dagger/SystemServicesModule.java
index 1e99a7b..f683a63 100644
--- a/packages/SystemUI/src/com/android/systemui/dagger/SystemServicesModule.java
+++ b/packages/SystemUI/src/com/android/systemui/dagger/SystemServicesModule.java
@@ -312,6 +312,7 @@
 
     @Provides
     @Singleton
+    @Nullable
     static WifiManager provideWifiManager(Context context) {
         return context.getSystemService(WifiManager.class);
     }
diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/DataSaverTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/DataSaverTile.java
index 8ba6084..7ae8fbc 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/tiles/DataSaverTile.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/DataSaverTile.java
@@ -66,11 +66,13 @@
         dialog.setTitle(com.android.internal.R.string.data_saver_enable_title);
         dialog.setMessage(com.android.internal.R.string.data_saver_description);
         dialog.setPositiveButton(com.android.internal.R.string.data_saver_enable_button,
-                (OnClickListener) (dialogInterface, which) -> toggleDataSaver());
+                (OnClickListener) (dialogInterface, which) -> {
+                    toggleDataSaver();
+                    Prefs.putBoolean(mContext, Prefs.Key.QS_DATA_SAVER_DIALOG_SHOWN, true);
+                });
         dialog.setNegativeButton(com.android.internal.R.string.cancel, null);
         dialog.setShowForAllUsers(true);
         dialog.show();
-        Prefs.putBoolean(mContext, Prefs.Key.QS_DATA_SAVER_DIALOG_SHOWN, true);
     }
 
     private void toggleDataSaver() {
diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/NfcTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/NfcTile.java
index 4bee075..7da9135 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/tiles/NfcTile.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/NfcTile.java
@@ -39,6 +39,8 @@
 /** Quick settings tile: Enable/Disable NFC **/
 public class NfcTile extends QSTileImpl<BooleanState> {
 
+    private final Icon mIcon = ResourceIcon.get(R.drawable.ic_qs_nfc);
+
     private NfcAdapter mAdapter;
     private BroadcastDispatcher mBroadcastDispatcher;
 
@@ -109,8 +111,7 @@
         state.state = getAdapter() == null
                 ? Tile.STATE_UNAVAILABLE
                 : state.value ? Tile.STATE_ACTIVE : Tile.STATE_INACTIVE;
-        state.icon = ResourceIcon.get(
-                state.value ? R.drawable.ic_qs_nfc_enabled : R.drawable.ic_qs_nfc_disabled);
+        state.icon = mIcon;
         state.label = mContext.getString(R.string.quick_settings_nfc_label);
         state.expandedAccessibilityClassName = Switch.class.getName();
         state.contentDescription = state.label;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java
index f41a27c..4ac3a9b 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java
@@ -24,6 +24,7 @@
 import static android.net.wifi.WifiManager.TrafficStateCallback.DATA_ACTIVITY_OUT;
 import static android.telephony.PhoneStateListener.LISTEN_ACTIVE_DATA_SUBSCRIPTION_ID_CHANGE;
 
+import android.annotation.Nullable;
 import android.content.BroadcastReceiver;
 import android.content.Context;
 import android.content.Intent;
@@ -175,7 +176,7 @@
     public NetworkControllerImpl(Context context, @Background Looper bgLooper,
             DeviceProvisionedController deviceProvisionedController,
             BroadcastDispatcher broadcastDispatcher, ConnectivityManager connectivityManager,
-            TelephonyManager telephonyManager, WifiManager wifiManager,
+            TelephonyManager telephonyManager, @Nullable WifiManager wifiManager,
             NetworkScoreManager networkScoreManager) {
         this(context, connectivityManager,
                 telephonyManager,
diff --git a/packages/Tethering/Android.bp b/packages/Tethering/Android.bp
index 12daa61..40f394a 100644
--- a/packages/Tethering/Android.bp
+++ b/packages/Tethering/Android.bp
@@ -25,9 +25,10 @@
     ],
     static_libs: [
         "androidx.annotation_annotation",
-        "netd_aidl_interface-java",
+        "netd_aidl_interface-unstable-java",
         "netlink-client",
-        "networkstack-aidl-interfaces-java",
+        // TODO: use networkstack-client instead of just including the AIDL interface
+        "networkstack-aidl-interfaces-unstable-java",
         "android.hardware.tetheroffload.config-V1.0-java",
         "android.hardware.tetheroffload.control-V1.0-java",
         "net-utils-framework-common",
diff --git a/packages/Tethering/common/TetheringLib/src/android/net/ITetheringConnector.aidl b/packages/Tethering/common/TetheringLib/src/android/net/ITetheringConnector.aidl
index 8be7964..cf094aa 100644
--- a/packages/Tethering/common/TetheringLib/src/android/net/ITetheringConnector.aidl
+++ b/packages/Tethering/common/TetheringLib/src/android/net/ITetheringConnector.aidl
@@ -22,25 +22,31 @@
 
 /** @hide */
 oneway interface ITetheringConnector {
-    void tether(String iface, String callerPkg, IIntResultListener receiver);
-
-    void untether(String iface, String callerPkg, IIntResultListener receiver);
-
-    void setUsbTethering(boolean enable, String callerPkg, IIntResultListener receiver);
-
-    void startTethering(in TetheringRequestParcel request, String callerPkg,
+    void tether(String iface, String callerPkg, String callingAttributionTag,
             IIntResultListener receiver);
 
-    void stopTethering(int type, String callerPkg, IIntResultListener receiver);
+    void untether(String iface, String callerPkg, String callingAttributionTag,
+            IIntResultListener receiver);
+
+    void setUsbTethering(boolean enable, String callerPkg,
+            String callingAttributionTag, IIntResultListener receiver);
+
+    void startTethering(in TetheringRequestParcel request, String callerPkg,
+            String callingAttributionTag, IIntResultListener receiver);
+
+    void stopTethering(int type, String callerPkg, String callingAttributionTag,
+            IIntResultListener receiver);
 
     void requestLatestTetheringEntitlementResult(int type, in ResultReceiver receiver,
-            boolean showEntitlementUi, String callerPkg);
+            boolean showEntitlementUi, String callerPkg, String callingAttributionTag);
 
     void registerTetheringEventCallback(ITetheringEventCallback callback, String callerPkg);
 
     void unregisterTetheringEventCallback(ITetheringEventCallback callback, String callerPkg);
 
-    void isTetheringSupported(String callerPkg, IIntResultListener receiver);
+    void isTetheringSupported(String callerPkg, String callingAttributionTag,
+            IIntResultListener receiver);
 
-    void stopAllTethering(String callerPkg, IIntResultListener receiver);
+    void stopAllTethering(String callerPkg, String callingAttributionTag,
+            IIntResultListener receiver);
 }
diff --git a/packages/Tethering/common/TetheringLib/src/android/net/TetheringManager.java b/packages/Tethering/common/TetheringLib/src/android/net/TetheringManager.java
index 4f053cb..d36cf93 100644
--- a/packages/Tethering/common/TetheringLib/src/android/net/TetheringManager.java
+++ b/packages/Tethering/common/TetheringLib/src/android/net/TetheringManager.java
@@ -492,7 +492,7 @@
 
         return dispatcher.waitForResult((connector, listener) -> {
             try {
-                connector.tether(iface, callerPkg, listener);
+                connector.tether(iface, callerPkg, getAttributionTag(), listener);
             } catch (RemoteException e) {
                 throw new IllegalStateException(e);
             }
@@ -500,6 +500,13 @@
     }
 
     /**
+     * @return the context's attribution tag
+     */
+    private @Nullable String getAttributionTag() {
+        return null;
+    }
+
+    /**
      * Stop tethering the named interface.
      *
      * @deprecated The only usages is PanService. It uses this for legacy reasons
@@ -517,7 +524,7 @@
 
         return dispatcher.waitForResult((connector, listener) -> {
             try {
-                connector.untether(iface, callerPkg, listener);
+                connector.untether(iface, callerPkg, getAttributionTag(), listener);
             } catch (RemoteException e) {
                 throw new IllegalStateException(e);
             }
@@ -544,7 +551,8 @@
 
         return dispatcher.waitForResult((connector, listener) -> {
             try {
-                connector.setUsbTethering(enable, callerPkg, listener);
+                connector.setUsbTethering(enable, callerPkg, getAttributionTag(),
+                        listener);
             } catch (RemoteException e) {
                 throw new IllegalStateException(e);
             }
@@ -743,7 +751,8 @@
                 });
             }
         };
-        getConnector(c -> c.startTethering(request.getParcel(), callerPkg, listener));
+        getConnector(c -> c.startTethering(request.getParcel(), callerPkg,
+                getAttributionTag(), listener));
     }
 
     /**
@@ -783,7 +792,8 @@
         final String callerPkg = mContext.getOpPackageName();
         Log.i(TAG, "stopTethering caller:" + callerPkg);
 
-        getConnector(c -> c.stopTethering(type, callerPkg, new IIntResultListener.Stub() {
+        getConnector(c -> c.stopTethering(type, callerPkg, getAttributionTag(),
+                new IIntResultListener.Stub() {
             @Override
             public void onResult(int resultCode) {
                 // TODO: provide an API to obtain result
@@ -869,7 +879,7 @@
         Log.i(TAG, "getLatestTetheringEntitlementResult caller:" + callerPkg);
 
         getConnector(c -> c.requestLatestTetheringEntitlementResult(
-                type, receiver, showEntitlementUi, callerPkg));
+                type, receiver, showEntitlementUi, callerPkg, getAttributionTag()));
     }
 
     /**
@@ -1320,7 +1330,7 @@
         final RequestDispatcher dispatcher = new RequestDispatcher();
         final int ret = dispatcher.waitForResult((connector, listener) -> {
             try {
-                connector.isTetheringSupported(callerPkg, listener);
+                connector.isTetheringSupported(callerPkg, getAttributionTag(), listener);
             } catch (RemoteException e) {
                 throw new IllegalStateException(e);
             }
@@ -1343,14 +1353,15 @@
         final String callerPkg = mContext.getOpPackageName();
         Log.i(TAG, "stopAllTethering caller:" + callerPkg);
 
-        getConnector(c -> c.stopAllTethering(callerPkg, new IIntResultListener.Stub() {
-            @Override
-            public void onResult(int resultCode) {
-                // TODO: add an API parameter to send result to caller.
-                // This has never been possible as stopAllTethering has always been void and never
-                // taken a callback object. The only indication that callers have is if the call
-                // results in a TETHER_STATE_CHANGE broadcast.
-            }
-        }));
+        getConnector(c -> c.stopAllTethering(callerPkg, getAttributionTag(),
+                new IIntResultListener.Stub() {
+                    @Override
+                    public void onResult(int resultCode) {
+                        // TODO: add an API parameter to send result to caller.
+                        // This has never been possible as stopAllTethering has always been void
+                        // and never taken a callback object. The only indication that callers have
+                        // is if the call results in a TETHER_STATE_CHANGE broadcast.
+                    }
+                }));
     }
 }
diff --git a/packages/Tethering/jni/android_net_util_TetheringUtils.cpp b/packages/Tethering/jni/android_net_util_TetheringUtils.cpp
index 54934406..f6eb40a 100644
--- a/packages/Tethering/jni/android_net_util_TetheringUtils.cpp
+++ b/packages/Tethering/jni/android_net_util_TetheringUtils.cpp
@@ -18,6 +18,7 @@
 #include <error.h>
 #include <jni.h>
 #include <nativehelper/JNIHelp.h>
+#include <nativehelper/JNIHelpCompat.h>
 #include <nativehelper/ScopedUtfChars.h>
 #include <net/if.h>
 #include <netinet/icmp6.h>
diff --git a/packages/Tethering/src/com/android/networkstack/tethering/PrivateAddressCoordinator.java b/packages/Tethering/src/com/android/networkstack/tethering/PrivateAddressCoordinator.java
index 160a166..aa58a4b 100644
--- a/packages/Tethering/src/com/android/networkstack/tethering/PrivateAddressCoordinator.java
+++ b/packages/Tethering/src/com/android/networkstack/tethering/PrivateAddressCoordinator.java
@@ -15,6 +15,8 @@
  */
 package com.android.networkstack.tethering;
 
+import static java.util.Arrays.asList;
+
 import android.content.Context;
 import android.net.ConnectivityManager;
 import android.net.IpPrefix;
@@ -34,9 +36,10 @@
 import java.net.InetAddress;
 import java.net.UnknownHostException;
 import java.util.ArrayList;
-import java.util.Arrays;
+import java.util.HashSet;
 import java.util.List;
 import java.util.Random;
+import java.util.Set;
 
 /**
  * This class coordinate IP addresses conflict problem.
@@ -60,8 +63,8 @@
     // Upstream monitor would be stopped when tethering is down. When tethering restart, downstream
     // address may be requested before coordinator get current upstream notification. To ensure
     // coordinator do not select conflict downstream prefix, mUpstreamPrefixMap would not be cleared
-    // when tethering is down. Instead coordinator would remove all depcreted upstreams from
-    // mUpstreamPrefixMap when tethering is starting. See #maybeRemoveDeprectedUpstreams().
+    // when tethering is down. Instead tethering would remove all deprecated upstreams from
+    // mUpstreamPrefixMap when tethering is starting. See #maybeRemoveDeprecatedUpstreams().
     private final ArrayMap<Network, List<IpPrefix>> mUpstreamPrefixMap;
     private final ArraySet<IpServer> mDownstreams;
     // IANA has reserved the following three blocks of the IP address space for private intranets:
@@ -124,15 +127,16 @@
         mUpstreamPrefixMap.remove(network);
     }
 
-    private void maybeRemoveDeprectedUpstreams() {
-        if (!mDownstreams.isEmpty() || mUpstreamPrefixMap.isEmpty()) return;
+    /**
+     * Maybe remove deprecated upstream records, this would be called once tethering started without
+     * any exiting tethered downstream.
+     */
+    public void maybeRemoveDeprecatedUpstreams() {
+        if (mUpstreamPrefixMap.isEmpty()) return;
 
-        final ArrayList<Network> toBeRemoved = new ArrayList<>();
-        List<Network> allNetworks = Arrays.asList(mConnectivityMgr.getAllNetworks());
-        for (int i = 0; i < mUpstreamPrefixMap.size(); i++) {
-            final Network network = mUpstreamPrefixMap.keyAt(i);
-            if (!allNetworks.contains(network)) toBeRemoved.add(network);
-        }
+        // Remove all upstreams that are no longer valid networks
+        final Set<Network> toBeRemoved = new HashSet<>(mUpstreamPrefixMap.keySet());
+        toBeRemoved.removeAll(asList(mConnectivityMgr.getAllNetworks()));
 
         mUpstreamPrefixMap.removeAll(toBeRemoved);
     }
@@ -143,8 +147,6 @@
      */
     @Nullable
     public LinkAddress requestDownstreamAddress(final IpServer ipServer) {
-        maybeRemoveDeprectedUpstreams();
-
         // Address would be 192.168.[subAddress]/24.
         final byte[] bytes = mTetheringPrefix.getRawAddress();
         final int subAddress = getRandomSubAddr();
@@ -237,7 +239,6 @@
     }
 
     void dump(final IndentingPrintWriter pw) {
-        pw.decreaseIndent();
         pw.println("mUpstreamPrefixMap:");
         pw.increaseIndent();
         for (int i = 0; i < mUpstreamPrefixMap.size(); i++) {
diff --git a/packages/Tethering/src/com/android/networkstack/tethering/Tethering.java b/packages/Tethering/src/com/android/networkstack/tethering/Tethering.java
index 3695ec6..7508a65 100644
--- a/packages/Tethering/src/com/android/networkstack/tethering/Tethering.java
+++ b/packages/Tethering/src/com/android/networkstack/tethering/Tethering.java
@@ -1751,6 +1751,7 @@
                     return;
                 }
 
+                mPrivateAddressCoordinator.maybeRemoveDeprecatedUpstreams();
                 mUpstreamNetworkMonitor.startObserveAllNetworks();
 
                 // TODO: De-duplicate with updateUpstreamWanted() below.
diff --git a/packages/Tethering/src/com/android/networkstack/tethering/TetheringNotificationUpdater.java b/packages/Tethering/src/com/android/networkstack/tethering/TetheringNotificationUpdater.java
index 593d04a..a0198cc 100644
--- a/packages/Tethering/src/com/android/networkstack/tethering/TetheringNotificationUpdater.java
+++ b/packages/Tethering/src/com/android/networkstack/tethering/TetheringNotificationUpdater.java
@@ -273,8 +273,9 @@
                 mContext.createContextAsUser(UserHandle.CURRENT, 0 /* flags */),
                 0 /* requestCode */,
                 new Intent(Settings.ACTION_TETHER_SETTINGS)
-                        .setPackage(getSettingsPackageName(mContext.getPackageManager())),
-                Intent.FLAG_ACTIVITY_NEW_TASK | PendingIntent.FLAG_IMMUTABLE,
+                        .setPackage(getSettingsPackageName(mContext.getPackageManager()))
+                        .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK),
+                PendingIntent.FLAG_IMMUTABLE,
                 null /* options */);
 
         showNotification(R.drawable.stat_sys_tether_general, title, message,
@@ -317,8 +318,9 @@
                 mContext.createContextAsUser(UserHandle.CURRENT, 0 /* flags */),
                 0 /* requestCode */,
                 new Intent(Settings.ACTION_TETHER_SETTINGS)
-                        .setPackage(getSettingsPackageName(mContext.getPackageManager())),
-                Intent.FLAG_ACTIVITY_NEW_TASK | PendingIntent.FLAG_IMMUTABLE,
+                        .setPackage(getSettingsPackageName(mContext.getPackageManager()))
+                        .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK),
+                PendingIntent.FLAG_IMMUTABLE,
                 null /* options */);
 
         showNotification(R.drawable.stat_sys_tether_general, title, message,
diff --git a/packages/Tethering/src/com/android/networkstack/tethering/TetheringService.java b/packages/Tethering/src/com/android/networkstack/tethering/TetheringService.java
index d084ca0..613328d 100644
--- a/packages/Tethering/src/com/android/networkstack/tethering/TetheringService.java
+++ b/packages/Tethering/src/com/android/networkstack/tethering/TetheringService.java
@@ -102,8 +102,9 @@
         }
 
         @Override
-        public void tether(String iface, String callerPkg, IIntResultListener listener) {
-            if (checkAndNotifyCommonError(callerPkg, listener)) return;
+        public void tether(String iface, String callerPkg, String callingAttributionTag,
+                IIntResultListener listener) {
+            if (checkAndNotifyCommonError(callerPkg, callingAttributionTag, listener)) return;
 
             try {
                 listener.onResult(mTethering.tether(iface));
@@ -111,8 +112,9 @@
         }
 
         @Override
-        public void untether(String iface, String callerPkg, IIntResultListener listener) {
-            if (checkAndNotifyCommonError(callerPkg, listener)) return;
+        public void untether(String iface, String callerPkg, String callingAttributionTag,
+                IIntResultListener listener) {
+            if (checkAndNotifyCommonError(callerPkg, callingAttributionTag, listener)) return;
 
             try {
                 listener.onResult(mTethering.untether(iface));
@@ -120,8 +122,9 @@
         }
 
         @Override
-        public void setUsbTethering(boolean enable, String callerPkg, IIntResultListener listener) {
-            if (checkAndNotifyCommonError(callerPkg, listener)) return;
+        public void setUsbTethering(boolean enable, String callerPkg, String callingAttributionTag,
+                IIntResultListener listener) {
+            if (checkAndNotifyCommonError(callerPkg, callingAttributionTag, listener)) return;
 
             try {
                 listener.onResult(mTethering.setUsbTethering(enable));
@@ -130,8 +133,9 @@
 
         @Override
         public void startTethering(TetheringRequestParcel request, String callerPkg,
-                IIntResultListener listener) {
+                String callingAttributionTag, IIntResultListener listener) {
             if (checkAndNotifyCommonError(callerPkg,
+                    callingAttributionTag,
                     request.exemptFromEntitlementCheck /* onlyAllowPrivileged */,
                     listener)) {
                 return;
@@ -141,8 +145,9 @@
         }
 
         @Override
-        public void stopTethering(int type, String callerPkg, IIntResultListener listener) {
-            if (checkAndNotifyCommonError(callerPkg, listener)) return;
+        public void stopTethering(int type, String callerPkg, String callingAttributionTag,
+                IIntResultListener listener) {
+            if (checkAndNotifyCommonError(callerPkg, callingAttributionTag, listener)) return;
 
             try {
                 mTethering.stopTethering(type);
@@ -152,8 +157,8 @@
 
         @Override
         public void requestLatestTetheringEntitlementResult(int type, ResultReceiver receiver,
-                boolean showEntitlementUi, String callerPkg) {
-            if (checkAndNotifyCommonError(callerPkg, receiver)) return;
+                boolean showEntitlementUi, String callerPkg, String callingAttributionTag) {
+            if (checkAndNotifyCommonError(callerPkg, callingAttributionTag, receiver)) return;
 
             mTethering.requestLatestTetheringEntitlementResult(type, receiver, showEntitlementUi);
         }
@@ -183,8 +188,9 @@
         }
 
         @Override
-        public void stopAllTethering(String callerPkg, IIntResultListener listener) {
-            if (checkAndNotifyCommonError(callerPkg, listener)) return;
+        public void stopAllTethering(String callerPkg, String callingAttributionTag,
+                IIntResultListener listener) {
+            if (checkAndNotifyCommonError(callerPkg, callingAttributionTag, listener)) return;
 
             try {
                 mTethering.untetherAll();
@@ -193,8 +199,9 @@
         }
 
         @Override
-        public void isTetheringSupported(String callerPkg, IIntResultListener listener) {
-            if (checkAndNotifyCommonError(callerPkg, listener)) return;
+        public void isTetheringSupported(String callerPkg, String callingAttributionTag,
+                IIntResultListener listener) {
+            if (checkAndNotifyCommonError(callerPkg, callingAttributionTag, listener)) return;
 
             try {
                 listener.onResult(TETHER_ERROR_NO_ERROR);
@@ -207,14 +214,18 @@
             mTethering.dump(fd, writer, args);
         }
 
-        private boolean checkAndNotifyCommonError(String callerPkg, IIntResultListener listener) {
-            return checkAndNotifyCommonError(callerPkg, false /* onlyAllowPrivileged */, listener);
+        private boolean checkAndNotifyCommonError(final String callerPkg,
+                final String callingAttributionTag, final IIntResultListener listener) {
+            return checkAndNotifyCommonError(callerPkg, callingAttributionTag,
+                    false /* onlyAllowPrivileged */, listener);
         }
 
         private boolean checkAndNotifyCommonError(final String callerPkg,
-                final boolean onlyAllowPrivileged, final IIntResultListener listener) {
+                final String callingAttributionTag, final boolean onlyAllowPrivileged,
+                final IIntResultListener listener) {
             try {
-                if (!hasTetherChangePermission(callerPkg, onlyAllowPrivileged)) {
+                if (!hasTetherChangePermission(callerPkg, callingAttributionTag,
+                        onlyAllowPrivileged)) {
                     listener.onResult(TETHER_ERROR_NO_CHANGE_TETHERING_PERMISSION);
                     return true;
                 }
@@ -229,8 +240,10 @@
             return false;
         }
 
-        private boolean checkAndNotifyCommonError(String callerPkg, ResultReceiver receiver) {
-            if (!hasTetherChangePermission(callerPkg, false /* onlyAllowPrivileged */)) {
+        private boolean checkAndNotifyCommonError(final String callerPkg,
+                final String callingAttributionTag, final ResultReceiver receiver) {
+            if (!hasTetherChangePermission(callerPkg, callingAttributionTag,
+                    false /* onlyAllowPrivileged */)) {
                 receiver.send(TETHER_ERROR_NO_CHANGE_TETHERING_PERMISSION, null);
                 return true;
             }
@@ -256,7 +269,7 @@
         }
 
         private boolean hasTetherChangePermission(final String callerPkg,
-                final boolean onlyAllowPrivileged) {
+                final String callingAttributionTag, final boolean onlyAllowPrivileged) {
             if (onlyAllowPrivileged && !hasNetworkStackPermission()) return false;
 
             if (hasTetherPrivilegedPermission()) return true;
@@ -264,11 +277,12 @@
             if (mTethering.isTetherProvisioningRequired()) return false;
 
             int uid = Binder.getCallingUid();
+
             // If callerPkg's uid is not same as Binder.getCallingUid(),
             // checkAndNoteWriteSettingsOperation will return false and the operation will be
             // denied.
             return mService.checkAndNoteWriteSettingsOperation(mService, uid, callerPkg,
-                    false /* throwException */);
+                    callingAttributionTag, false /* throwException */);
         }
 
         private boolean hasTetherAccessPermission() {
@@ -287,7 +301,8 @@
      */
     @VisibleForTesting
     boolean checkAndNoteWriteSettingsOperation(@NonNull Context context, int uid,
-            @NonNull String callingPackage, boolean throwException) {
+            @NonNull String callingPackage, @Nullable String callingAttributionTag,
+            boolean throwException) {
         return Settings.checkAndNoteWriteSettingsOperation(context, uid, callingPackage,
                 throwException);
     }
diff --git a/packages/Tethering/tests/unit/src/com/android/networkstack/tethering/MockTetheringService.java b/packages/Tethering/tests/unit/src/com/android/networkstack/tethering/MockTetheringService.java
index f4d24891..071a290e 100644
--- a/packages/Tethering/tests/unit/src/com/android/networkstack/tethering/MockTetheringService.java
+++ b/packages/Tethering/tests/unit/src/com/android/networkstack/tethering/MockTetheringService.java
@@ -27,6 +27,7 @@
 import android.os.IBinder;
 
 import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
 
 public class MockTetheringService extends TetheringService {
     private final Tethering mTethering = mock(Tethering.class);
@@ -43,7 +44,8 @@
 
     @Override
     boolean checkAndNoteWriteSettingsOperation(@NonNull Context context, int uid,
-            @NonNull String callingPackage, boolean throwException) {
+            @NonNull String callingPackage, @Nullable String callingAttributionTag,
+            boolean throwException) {
         // Test this does not verify the calling package / UID, as calling package could be shell
         // and not match the UID.
         return context.checkCallingOrSelfPermission(WRITE_SETTINGS) == PERMISSION_GRANTED;
diff --git a/packages/Tethering/tests/unit/src/com/android/networkstack/tethering/PrivateAddressCoordinatorTest.java b/packages/Tethering/tests/unit/src/com/android/networkstack/tethering/PrivateAddressCoordinatorTest.java
index 93efd49..2c0df6f 100644
--- a/packages/Tethering/tests/unit/src/com/android/networkstack/tethering/PrivateAddressCoordinatorTest.java
+++ b/packages/Tethering/tests/unit/src/com/android/networkstack/tethering/PrivateAddressCoordinatorTest.java
@@ -127,10 +127,15 @@
         mPrivateAddressCoordinator.releaseDownstream(mHotspotIpServer);
     }
 
+    private int getBluetoothSubAddress() {
+        final byte[] rawAddress = mBluetoothPrefix.getRawAddress();
+        int bluetoothSubNet = rawAddress[2] & 0xff;
+        return (bluetoothSubNet << 8) + 0x5;
+    }
+
     @Test
     public void testReserveBluetoothPrefix() throws Exception {
-        final int fakeSubAddr = 0x2c05;
-        when(mPrivateAddressCoordinator.getRandomSubAddr()).thenReturn(fakeSubAddr);
+        when(mPrivateAddressCoordinator.getRandomSubAddr()).thenReturn(getBluetoothSubAddress());
         LinkAddress address = mPrivateAddressCoordinator.requestDownstreamAddress(
                 mHotspotIpServer);
         final IpPrefix hotspotPrefix = PrefixUtils.asIpPrefix(address);
@@ -146,7 +151,7 @@
         LinkAddress address = mPrivateAddressCoordinator.requestDownstreamAddress(
                 mHotspotIpServer);
         final IpPrefix hotspotPrefix = PrefixUtils.asIpPrefix(address);
-        assertEquals("Wrong wifi perfix: ", predefinedPrefix, hotspotPrefix);
+        assertEquals("Wrong wifi prefix: ", predefinedPrefix, hotspotPrefix);
         when(mHotspotIpServer.getAddress()).thenReturn(address);
 
         address = mPrivateAddressCoordinator.requestDownstreamAddress(
@@ -159,7 +164,7 @@
         address = mPrivateAddressCoordinator.requestDownstreamAddress(
                 mUsbIpServer);
         final IpPrefix allowUseFreePrefix = PrefixUtils.asIpPrefix(address);
-        assertEquals("Fail to reselect available perfix: ", predefinedPrefix, allowUseFreePrefix);
+        assertEquals("Fail to reselect available prefix: ", predefinedPrefix, allowUseFreePrefix);
     }
 
     private LinkProperties buildUpstreamLinkProperties(boolean withIPv4, boolean withIPv6,
@@ -202,7 +207,7 @@
         final LinkAddress hotspotAddr = mPrivateAddressCoordinator.requestDownstreamAddress(
                 mHotspotIpServer);
         final IpPrefix hotspotPrefix = PrefixUtils.asIpPrefix(hotspotAddr);
-        assertEquals("Wrong wifi perfix: ", predefinedPrefix, hotspotPrefix);
+        assertEquals("Wrong wifi prefix: ", predefinedPrefix, hotspotPrefix);
         when(mHotspotIpServer.getAddress()).thenReturn(hotspotAddr);
         // 2. Update v6 only mobile network, hotspot prefix should not be removed.
         List<String> testConflicts;
diff --git a/packages/Tethering/tests/unit/src/com/android/networkstack/tethering/TetheringServiceTest.java b/packages/Tethering/tests/unit/src/com/android/networkstack/tethering/TetheringServiceTest.java
index 22d894b..7bba67b 100644
--- a/packages/Tethering/tests/unit/src/com/android/networkstack/tethering/TetheringServiceTest.java
+++ b/packages/Tethering/tests/unit/src/com/android/networkstack/tethering/TetheringServiceTest.java
@@ -18,7 +18,6 @@
 
 import static android.Manifest.permission.ACCESS_NETWORK_STATE;
 import static android.Manifest.permission.TETHER_PRIVILEGED;
-import static android.Manifest.permission.UPDATE_APP_OPS_STATS;
 import static android.Manifest.permission.WRITE_SETTINGS;
 import static android.net.TetheringManager.TETHERING_WIFI;
 import static android.net.TetheringManager.TETHER_ERROR_NO_ACCESS_TETHERING_PERMISSION;
@@ -62,6 +61,7 @@
 public final class TetheringServiceTest {
     private static final String TEST_IFACE_NAME = "test_wlan0";
     private static final String TEST_CALLER_PKG = "com.android.shell";
+    private static final String TEST_ATTRIBUTION_TAG = null;
     @Mock private ITetheringEventCallback mITetheringEventCallback;
     @Rule public ServiceTestRule mServiceTestRule;
     private Tethering mTethering;
@@ -135,7 +135,7 @@
     }
 
     private void runAsWriteSettings(final TestTetheringCall test) throws Exception {
-        runTetheringCall(test, WRITE_SETTINGS, UPDATE_APP_OPS_STATS);
+        runTetheringCall(test, WRITE_SETTINGS);
     }
 
     private void runTetheringCall(final TestTetheringCall test, String... permissions)
@@ -157,7 +157,7 @@
 
     private void runTether(final TestTetheringResult result) throws Exception {
         when(mTethering.tether(TEST_IFACE_NAME)).thenReturn(TETHER_ERROR_NO_ERROR);
-        mTetheringConnector.tether(TEST_IFACE_NAME, TEST_CALLER_PKG, result);
+        mTetheringConnector.tether(TEST_IFACE_NAME, TEST_CALLER_PKG, TEST_ATTRIBUTION_TAG, result);
         verify(mTethering).isTetheringSupported();
         verify(mTethering).tether(TEST_IFACE_NAME);
         result.assertResult(TETHER_ERROR_NO_ERROR);
@@ -166,7 +166,8 @@
     @Test
     public void testTether() throws Exception {
         runAsNoPermission((result) -> {
-            mTetheringConnector.tether(TEST_IFACE_NAME, TEST_CALLER_PKG, result);
+            mTetheringConnector.tether(TEST_IFACE_NAME, TEST_CALLER_PKG, TEST_ATTRIBUTION_TAG,
+                    result);
             verify(mTethering).isTetherProvisioningRequired();
             result.assertResult(TETHER_ERROR_NO_CHANGE_TETHERING_PERMISSION);
             verifyNoMoreInteractionsForTethering();
@@ -186,7 +187,8 @@
 
     private void runUnTether(final TestTetheringResult result) throws Exception {
         when(mTethering.untether(TEST_IFACE_NAME)).thenReturn(TETHER_ERROR_NO_ERROR);
-        mTetheringConnector.untether(TEST_IFACE_NAME, TEST_CALLER_PKG, result);
+        mTetheringConnector.untether(TEST_IFACE_NAME, TEST_CALLER_PKG, TEST_ATTRIBUTION_TAG,
+                result);
         verify(mTethering).isTetheringSupported();
         verify(mTethering).untether(TEST_IFACE_NAME);
         result.assertResult(TETHER_ERROR_NO_ERROR);
@@ -195,7 +197,8 @@
     @Test
     public void testUntether() throws Exception {
         runAsNoPermission((result) -> {
-            mTetheringConnector.untether(TEST_IFACE_NAME, TEST_CALLER_PKG, result);
+            mTetheringConnector.untether(TEST_IFACE_NAME, TEST_CALLER_PKG, TEST_ATTRIBUTION_TAG,
+                    result);
             verify(mTethering).isTetherProvisioningRequired();
             result.assertResult(TETHER_ERROR_NO_CHANGE_TETHERING_PERMISSION);
             verifyNoMoreInteractionsForTethering();
@@ -215,7 +218,8 @@
 
     private void runSetUsbTethering(final TestTetheringResult result) throws Exception {
         when(mTethering.setUsbTethering(true /* enable */)).thenReturn(TETHER_ERROR_NO_ERROR);
-        mTetheringConnector.setUsbTethering(true /* enable */, TEST_CALLER_PKG, result);
+        mTetheringConnector.setUsbTethering(true /* enable */, TEST_CALLER_PKG,
+                TEST_ATTRIBUTION_TAG, result);
         verify(mTethering).isTetheringSupported();
         verify(mTethering).setUsbTethering(true /* enable */);
         result.assertResult(TETHER_ERROR_NO_ERROR);
@@ -224,7 +228,8 @@
     @Test
     public void testSetUsbTethering() throws Exception {
         runAsNoPermission((result) -> {
-            mTetheringConnector.setUsbTethering(true /* enable */, TEST_CALLER_PKG, result);
+            mTetheringConnector.setUsbTethering(true /* enable */, TEST_CALLER_PKG,
+                    TEST_ATTRIBUTION_TAG, result);
             verify(mTethering).isTetherProvisioningRequired();
             result.assertResult(TETHER_ERROR_NO_CHANGE_TETHERING_PERMISSION);
             verifyNoMoreInteractionsForTethering();
@@ -245,7 +250,8 @@
 
     private void runStartTethering(final TestTetheringResult result,
             final TetheringRequestParcel request) throws Exception {
-        mTetheringConnector.startTethering(request, TEST_CALLER_PKG, result);
+        mTetheringConnector.startTethering(request, TEST_CALLER_PKG, TEST_ATTRIBUTION_TAG,
+                result);
         verify(mTethering).isTetheringSupported();
         verify(mTethering).startTethering(eq(request), eq(result));
     }
@@ -256,7 +262,8 @@
         request.tetheringType = TETHERING_WIFI;
 
         runAsNoPermission((result) -> {
-            mTetheringConnector.startTethering(request, TEST_CALLER_PKG, result);
+            mTetheringConnector.startTethering(request, TEST_CALLER_PKG, TEST_ATTRIBUTION_TAG,
+                    result);
             verify(mTethering).isTetherProvisioningRequired();
             result.assertResult(TETHER_ERROR_NO_CHANGE_TETHERING_PERMISSION);
             verifyNoMoreInteractionsForTethering();
@@ -279,7 +286,8 @@
         final TetheringRequestParcel request = new TetheringRequestParcel();
         request.tetheringType = TETHERING_WIFI;
         request.exemptFromEntitlementCheck = true;
-        mTetheringConnector.startTethering(request, TEST_CALLER_PKG, result);
+        mTetheringConnector.startTethering(request, TEST_CALLER_PKG, TEST_ATTRIBUTION_TAG,
+                result);
         result.assertResult(TETHER_ERROR_NO_CHANGE_TETHERING_PERMISSION);
         verifyNoMoreInteractionsForTethering();
     }
@@ -304,7 +312,8 @@
     }
 
     private void runStopTethering(final TestTetheringResult result) throws Exception {
-        mTetheringConnector.stopTethering(TETHERING_WIFI, TEST_CALLER_PKG, result);
+        mTetheringConnector.stopTethering(TETHERING_WIFI, TEST_CALLER_PKG,
+                TEST_ATTRIBUTION_TAG, result);
         verify(mTethering).isTetheringSupported();
         verify(mTethering).stopTethering(TETHERING_WIFI);
         result.assertResult(TETHER_ERROR_NO_ERROR);
@@ -313,7 +322,8 @@
     @Test
     public void testStopTethering() throws Exception {
         runAsNoPermission((result) -> {
-            mTetheringConnector.stopTethering(TETHERING_WIFI, TEST_CALLER_PKG, result);
+            mTetheringConnector.stopTethering(TETHERING_WIFI, TEST_CALLER_PKG,
+                    TEST_ATTRIBUTION_TAG, result);
             verify(mTethering).isTetherProvisioningRequired();
             result.assertResult(TETHER_ERROR_NO_CHANGE_TETHERING_PERMISSION);
             verifyNoMoreInteractionsForTethering();
@@ -334,7 +344,7 @@
     private void runRequestLatestTetheringEntitlementResult() throws Exception {
         final MyResultReceiver result = new MyResultReceiver(null);
         mTetheringConnector.requestLatestTetheringEntitlementResult(TETHERING_WIFI, result,
-                true /* showEntitlementUi */, TEST_CALLER_PKG);
+                true /* showEntitlementUi */, TEST_CALLER_PKG, TEST_ATTRIBUTION_TAG);
         verify(mTethering).isTetheringSupported();
         verify(mTethering).requestLatestTetheringEntitlementResult(eq(TETHERING_WIFI),
                 eq(result), eq(true) /* showEntitlementUi */);
@@ -345,7 +355,7 @@
         // Run as no permission.
         final MyResultReceiver result = new MyResultReceiver(null);
         mTetheringConnector.requestLatestTetheringEntitlementResult(TETHERING_WIFI, result,
-                true /* showEntitlementUi */, TEST_CALLER_PKG);
+                true /* showEntitlementUi */, TEST_CALLER_PKG, TEST_ATTRIBUTION_TAG);
         verify(mTethering).isTetherProvisioningRequired();
         result.assertResult(TETHER_ERROR_NO_CHANGE_TETHERING_PERMISSION);
         verifyNoMoreInteractions(mTethering);
@@ -417,7 +427,7 @@
     }
 
     private void runStopAllTethering(final TestTetheringResult result) throws Exception {
-        mTetheringConnector.stopAllTethering(TEST_CALLER_PKG, result);
+        mTetheringConnector.stopAllTethering(TEST_CALLER_PKG, TEST_ATTRIBUTION_TAG, result);
         verify(mTethering).isTetheringSupported();
         verify(mTethering).untetherAll();
         result.assertResult(TETHER_ERROR_NO_ERROR);
@@ -426,7 +436,7 @@
     @Test
     public void testStopAllTethering() throws Exception {
         runAsNoPermission((result) -> {
-            mTetheringConnector.stopAllTethering(TEST_CALLER_PKG, result);
+            mTetheringConnector.stopAllTethering(TEST_CALLER_PKG, TEST_ATTRIBUTION_TAG, result);
             verify(mTethering).isTetherProvisioningRequired();
             result.assertResult(TETHER_ERROR_NO_CHANGE_TETHERING_PERMISSION);
             verifyNoMoreInteractionsForTethering();
@@ -445,7 +455,7 @@
     }
 
     private void runIsTetheringSupported(final TestTetheringResult result) throws Exception {
-        mTetheringConnector.isTetheringSupported(TEST_CALLER_PKG, result);
+        mTetheringConnector.isTetheringSupported(TEST_CALLER_PKG, TEST_ATTRIBUTION_TAG, result);
         verify(mTethering).isTetheringSupported();
         result.assertResult(TETHER_ERROR_NO_ERROR);
     }
@@ -453,7 +463,8 @@
     @Test
     public void testIsTetheringSupported() throws Exception {
         runAsNoPermission((result) -> {
-            mTetheringConnector.isTetheringSupported(TEST_CALLER_PKG, result);
+            mTetheringConnector.isTetheringSupported(TEST_CALLER_PKG, TEST_ATTRIBUTION_TAG,
+                    result);
             verify(mTethering).isTetherProvisioningRequired();
             result.assertResult(TETHER_ERROR_NO_CHANGE_TETHERING_PERMISSION);
             verifyNoMoreInteractionsForTethering();
diff --git a/packages/Tethering/tests/unit/src/com/android/networkstack/tethering/TetheringTest.java b/packages/Tethering/tests/unit/src/com/android/networkstack/tethering/TetheringTest.java
index 64538c7..1b710d0 100644
--- a/packages/Tethering/tests/unit/src/com/android/networkstack/tethering/TetheringTest.java
+++ b/packages/Tethering/tests/unit/src/com/android/networkstack/tethering/TetheringTest.java
@@ -1897,7 +1897,7 @@
                 0,
                 upstreamNetwork);
         mLooper.dispatchAll();
-        // verify trun off usb tethering
+        // verify turn off usb tethering
         verify(mUsbManager).setCurrentFunctions(UsbManager.FUNCTION_NONE);
         mTethering.interfaceRemoved(TEST_USB_IFNAME);
         mLooper.dispatchAll();
@@ -1935,9 +1935,9 @@
                 0,
                 upstreamNetwork);
         mLooper.dispatchAll();
-        // verify trun off usb tethering
+        // verify turn off usb tethering
         verify(mUsbManager).setCurrentFunctions(UsbManager.FUNCTION_NONE);
-        // verify trun off ethernet tethering
+        // verify turn off ethernet tethering
         verify(mockRequest).release();
         mTethering.interfaceRemoved(TEST_USB_IFNAME);
         ethCallback.onUnavailable();
diff --git a/packages/overlays/IconShapeHeartOverlay/AndroidManifest.xml b/packages/overlays/IconShapeHeartOverlay/AndroidManifest.xml
index 82bff7d..8fb19df 100644
--- a/packages/overlays/IconShapeHeartOverlay/AndroidManifest.xml
+++ b/packages/overlays/IconShapeHeartOverlay/AndroidManifest.xml
@@ -21,6 +21,7 @@
     android:versionName="1.0">
 <overlay
         android:targetPackage="android"
+        android:targetName="IconShapeCustomization"
         android:category="android.theme.customization.adaptive_icon_shape"
         android:priority="1"/>
 
diff --git a/packages/overlays/IconShapePebbleOverlay/AndroidManifest.xml b/packages/overlays/IconShapePebbleOverlay/AndroidManifest.xml
index d719a97..6842dde 100644
--- a/packages/overlays/IconShapePebbleOverlay/AndroidManifest.xml
+++ b/packages/overlays/IconShapePebbleOverlay/AndroidManifest.xml
@@ -21,6 +21,7 @@
     android:versionName="1.0">
 <overlay
         android:targetPackage="android"
+        android:targetName="IconShapeCustomization"
         android:category="android.theme.customization.adaptive_icon_shape"
         android:priority="1"/>
 
diff --git a/proto/Android.bp b/proto/Android.bp
index 01a72ea..86d8ee3 100644
--- a/proto/Android.bp
+++ b/proto/Android.bp
@@ -26,6 +26,8 @@
     },
     srcs: ["src/metrics_constants/metrics_constants.proto"],
     sdk_version: "system_current",
+    // this is part of updatable modules(CaptivePortalLogin) which targets 29(Q)
+    min_sdk_version: "29",
 }
 
 filegroup {
diff --git a/services/Android.bp b/services/Android.bp
index 00676e3..8c251e9 100644
--- a/services/Android.bp
+++ b/services/Android.bp
@@ -125,7 +125,6 @@
         " --hide InternalClasses" + // com.android.* classes are okay in this interface
         // TODO: remove the --hide options below
         " --hide-package com.google.android.startop.iorap" +
-        " --hide ReferencesHidden" +
         " --hide DeprecationMismatch" +
         " --hide HiddenTypedefConstant",
     visibility: ["//visibility:private"],
diff --git a/services/backup/OWNERS b/services/backup/OWNERS
index 9c21e8f..ba61d1c0 100644
--- a/services/backup/OWNERS
+++ b/services/backup/OWNERS
@@ -1,9 +1,7 @@
+# Bug component: 656484
+
 alsutton@google.com
-anniemeng@google.com
-brufino@google.com
 bryanmawhinney@google.com
-ctate@google.com
-jorlow@google.com
 nathch@google.com
 rthakohov@google.com
-
+tobiast@google.com
diff --git a/services/core/java/com/android/server/BatteryService.java b/services/core/java/com/android/server/BatteryService.java
index 8dd4fa6..65ac784 100644
--- a/services/core/java/com/android/server/BatteryService.java
+++ b/services/core/java/com/android/server/BatteryService.java
@@ -166,6 +166,7 @@
     private int mLastInvalidCharger;
 
     private int mLowBatteryWarningLevel;
+    private int mLastLowBatteryWarningLevel;
     private int mLowBatteryCloseWarningLevel;
     private int mShutdownBatteryTemperature;
 
@@ -314,6 +315,7 @@
         final ContentResolver resolver = mContext.getContentResolver();
         int defWarnLevel = mContext.getResources().getInteger(
                 com.android.internal.R.integer.config_lowBatteryWarningLevel);
+        mLastLowBatteryWarningLevel = mLowBatteryWarningLevel;
         mLowBatteryWarningLevel = Settings.Global.getInt(resolver,
                 Settings.Global.LOW_POWER_MODE_TRIGGER_LEVEL, defWarnLevel);
         if (mLowBatteryWarningLevel == 0) {
@@ -358,7 +360,8 @@
         return !plugged
                 && mHealthInfo.batteryStatus != BatteryManager.BATTERY_STATUS_UNKNOWN
                 && mHealthInfo.batteryLevel <= mLowBatteryWarningLevel
-                && (oldPlugged || mLastBatteryLevel > mLowBatteryWarningLevel);
+                && (oldPlugged || mLastBatteryLevel > mLowBatteryWarningLevel
+                    || mHealthInfo.batteryLevel > mLastLowBatteryWarningLevel);
     }
 
     private boolean shouldShutdownLocked() {
diff --git a/services/core/java/com/android/server/BluetoothManagerService.java b/services/core/java/com/android/server/BluetoothManagerService.java
index 0d4efed..2e4d44c 100644
--- a/services/core/java/com/android/server/BluetoothManagerService.java
+++ b/services/core/java/com/android/server/BluetoothManagerService.java
@@ -63,6 +63,7 @@
 import android.os.UserManager;
 import android.os.UserManagerInternal;
 import android.os.UserManagerInternal.UserRestrictionsListener;
+import android.provider.DeviceConfig;
 import android.provider.Settings;
 import android.provider.Settings.SettingNotFoundException;
 import android.text.TextUtils;
@@ -114,6 +115,7 @@
     private static final int ADD_PROXY_DELAY_MS = 100;
     // Delay for retrying enable and disable in msec
     private static final int ENABLE_DISABLE_DELAY_MS = 300;
+    private static final int DELAY_BEFORE_RESTART_DUE_TO_INIT_FLAGS_CHANGED_MS = 300;
 
     private static final int MESSAGE_ENABLE = 1;
     private static final int MESSAGE_DISABLE = 2;
@@ -133,6 +135,7 @@
     private static final int MESSAGE_ADD_PROXY_DELAYED = 400;
     private static final int MESSAGE_BIND_PROFILE_SERVICE = 401;
     private static final int MESSAGE_RESTORE_USER_SETTING = 500;
+    private static final int MESSAGE_INIT_FLAGS_CHANGED = 600;
 
     private static final int RESTORE_SETTING_TO_ON = 1;
     private static final int RESTORE_SETTING_TO_OFF = 0;
@@ -278,6 +281,30 @@
                 }
             };
 
+    private final DeviceConfig.OnPropertiesChangedListener mDeviceConfigChangedListener =
+            new DeviceConfig.OnPropertiesChangedListener() {
+                @Override
+                public void onPropertiesChanged(DeviceConfig.Properties properties) {
+                    if (!properties.getNamespace().equals(DeviceConfig.NAMESPACE_BLUETOOTH)) {
+                        return;
+                    }
+                    boolean foundInit = false;
+                    for (String name : properties.getKeyset()) {
+                        if (name.startsWith("INIT_")) {
+                            foundInit = true;
+                            break;
+                        }
+                    }
+                    if (!foundInit) {
+                        return;
+                    }
+                    mHandler.removeMessages(MESSAGE_INIT_FLAGS_CHANGED);
+                    mHandler.sendEmptyMessageDelayed(
+                            MESSAGE_INIT_FLAGS_CHANGED,
+                            DELAY_BEFORE_RESTART_DUE_TO_INIT_FLAGS_CHANGED_MS);
+                }
+            };
+
     public boolean onFactoryReset() {
         // Wait for stable state if bluetooth is temporary state.
         int state = getState();
@@ -507,6 +534,10 @@
             Slog.w(TAG, "Unable to resolve SystemUI's UID.");
         }
         mSystemUiUid = systemUiUid;
+        DeviceConfig.addOnPropertiesChangedListener(
+                DeviceConfig.NAMESPACE_BLUETOOTH,
+                (Runnable r) -> r.run(),
+                mDeviceConfigChangedListener);
     }
 
     /**
@@ -2148,80 +2179,7 @@
 
                     /* disable and enable BT when detect a user switch */
                     if (mBluetooth != null && isEnabled()) {
-                        try {
-                            mBluetoothLock.readLock().lock();
-                            if (mBluetooth != null) {
-                                mBluetooth.unregisterCallback(mBluetoothCallback);
-                            }
-                        } catch (RemoteException re) {
-                            Slog.e(TAG, "Unable to unregister", re);
-                        } finally {
-                            mBluetoothLock.readLock().unlock();
-                        }
-
-                        if (mState == BluetoothAdapter.STATE_TURNING_OFF) {
-                            // MESSAGE_USER_SWITCHED happened right after MESSAGE_ENABLE
-                            bluetoothStateChangeHandler(mState, BluetoothAdapter.STATE_OFF);
-                            mState = BluetoothAdapter.STATE_OFF;
-                        }
-                        if (mState == BluetoothAdapter.STATE_OFF) {
-                            bluetoothStateChangeHandler(mState, BluetoothAdapter.STATE_TURNING_ON);
-                            mState = BluetoothAdapter.STATE_TURNING_ON;
-                        }
-
-                        waitForState(Set.of(BluetoothAdapter.STATE_ON));
-
-                        if (mState == BluetoothAdapter.STATE_TURNING_ON) {
-                            bluetoothStateChangeHandler(mState, BluetoothAdapter.STATE_ON);
-                        }
-
-                        unbindAllBluetoothProfileServices();
-                        // disable
-                        addActiveLog(BluetoothProtoEnums.ENABLE_DISABLE_REASON_USER_SWITCH,
-                                mContext.getPackageName(), false);
-                        handleDisable();
-                        // Pbap service need receive STATE_TURNING_OFF intent to close
-                        bluetoothStateChangeHandler(BluetoothAdapter.STATE_ON,
-                                BluetoothAdapter.STATE_TURNING_OFF);
-
-                        boolean didDisableTimeout =
-                                !waitForState(Set.of(BluetoothAdapter.STATE_OFF));
-
-                        bluetoothStateChangeHandler(BluetoothAdapter.STATE_TURNING_OFF,
-                                BluetoothAdapter.STATE_OFF);
-                        sendBluetoothServiceDownCallback();
-
-                        try {
-                            mBluetoothLock.writeLock().lock();
-                            if (mBluetooth != null) {
-                                mBluetooth = null;
-                                // Unbind
-                                mContext.unbindService(mConnection);
-                            }
-                            mBluetoothGatt = null;
-                        } finally {
-                            mBluetoothLock.writeLock().unlock();
-                        }
-
-                        //
-                        // If disabling Bluetooth times out, wait for an
-                        // additional amount of time to ensure the process is
-                        // shut down completely before attempting to restart.
-                        //
-                        if (didDisableTimeout) {
-                            SystemClock.sleep(3000);
-                        } else {
-                            SystemClock.sleep(100);
-                        }
-
-                        mHandler.removeMessages(MESSAGE_BLUETOOTH_STATE_CHANGE);
-                        mState = BluetoothAdapter.STATE_OFF;
-                        // enable
-                        addActiveLog(BluetoothProtoEnums.ENABLE_DISABLE_REASON_USER_SWITCH,
-                                mContext.getPackageName(), true);
-                        // mEnable flag could have been reset on disableBLE. Reenable it.
-                        mEnable = true;
-                        handleEnable(mQuietEnable);
+                        restartForReason(BluetoothProtoEnums.ENABLE_DISABLE_REASON_USER_SWITCH);
                     } else if (mBinding || mBluetooth != null) {
                         Message userMsg = mHandler.obtainMessage(MESSAGE_USER_SWITCHED);
                         userMsg.arg2 = 1 + msg.arg2;
@@ -2248,9 +2206,96 @@
                         }
                         handleEnable(mQuietEnable);
                     }
+                    break;
+                }
+                case MESSAGE_INIT_FLAGS_CHANGED: {
+                    if (DBG) {
+                        Slog.d(TAG, "MESSAGE_INIT_FLAGS_CHANGED");
+                    }
+                    mHandler.removeMessages(MESSAGE_INIT_FLAGS_CHANGED);
+                    if (mBluetooth != null && isEnabled()) {
+                        restartForReason(
+                                BluetoothProtoEnums.ENABLE_DISABLE_REASON_INIT_FLAGS_CHANGED);
+                    }
+                    break;
                 }
             }
         }
+
+        private void restartForReason(int reason) {
+            try {
+                mBluetoothLock.readLock().lock();
+                if (mBluetooth != null) {
+                    mBluetooth.unregisterCallback(mBluetoothCallback);
+                }
+            } catch (RemoteException re) {
+                Slog.e(TAG, "Unable to unregister", re);
+            } finally {
+                mBluetoothLock.readLock().unlock();
+            }
+
+            if (mState == BluetoothAdapter.STATE_TURNING_OFF) {
+                // MESSAGE_USER_SWITCHED happened right after MESSAGE_ENABLE
+                bluetoothStateChangeHandler(mState, BluetoothAdapter.STATE_OFF);
+                mState = BluetoothAdapter.STATE_OFF;
+            }
+            if (mState == BluetoothAdapter.STATE_OFF) {
+                bluetoothStateChangeHandler(mState, BluetoothAdapter.STATE_TURNING_ON);
+                mState = BluetoothAdapter.STATE_TURNING_ON;
+            }
+
+            waitForState(Set.of(BluetoothAdapter.STATE_ON));
+
+            if (mState == BluetoothAdapter.STATE_TURNING_ON) {
+                bluetoothStateChangeHandler(mState, BluetoothAdapter.STATE_ON);
+            }
+
+            unbindAllBluetoothProfileServices();
+            // disable
+            addActiveLog(reason, mContext.getPackageName(), false);
+            handleDisable();
+            // Pbap service need receive STATE_TURNING_OFF intent to close
+            bluetoothStateChangeHandler(BluetoothAdapter.STATE_ON,
+                    BluetoothAdapter.STATE_TURNING_OFF);
+
+            boolean didDisableTimeout =
+                    !waitForState(Set.of(BluetoothAdapter.STATE_OFF));
+
+            bluetoothStateChangeHandler(BluetoothAdapter.STATE_TURNING_OFF,
+                    BluetoothAdapter.STATE_OFF);
+            sendBluetoothServiceDownCallback();
+
+            try {
+                mBluetoothLock.writeLock().lock();
+                if (mBluetooth != null) {
+                    mBluetooth = null;
+                    // Unbind
+                    mContext.unbindService(mConnection);
+                }
+                mBluetoothGatt = null;
+            } finally {
+                mBluetoothLock.writeLock().unlock();
+            }
+
+            //
+            // If disabling Bluetooth times out, wait for an
+            // additional amount of time to ensure the process is
+            // shut down completely before attempting to restart.
+            //
+            if (didDisableTimeout) {
+                SystemClock.sleep(3000);
+            } else {
+                SystemClock.sleep(100);
+            }
+
+            mHandler.removeMessages(MESSAGE_BLUETOOTH_STATE_CHANGE);
+            mState = BluetoothAdapter.STATE_OFF;
+            // enable
+            addActiveLog(reason, mContext.getPackageName(), true);
+            // mEnable flag could have been reset on disableBLE. Reenable it.
+            mEnable = true;
+            handleEnable(mQuietEnable);
+        }
     }
 
     private void handleEnable(boolean quietMode) {
@@ -2711,6 +2756,8 @@
                 return "RESTORE_USER_SETTING";
             case BluetoothProtoEnums.ENABLE_DISABLE_REASON_FACTORY_RESET:
                 return "FACTORY_RESET";
+            case BluetoothProtoEnums.ENABLE_DISABLE_REASON_INIT_FLAGS_CHANGED:
+                return "INIT_FLAGS_CHANGED";
             case BluetoothProtoEnums.ENABLE_DISABLE_REASON_UNSPECIFIED:
             default: return "UNKNOWN[" + reason + "]";
         }
diff --git a/services/core/java/com/android/server/ConnectivityService.java b/services/core/java/com/android/server/ConnectivityService.java
index 77cd5d2..02c08cc 100644
--- a/services/core/java/com/android/server/ConnectivityService.java
+++ b/services/core/java/com/android/server/ConnectivityService.java
@@ -1835,11 +1835,12 @@
      * @return {@code true} on success, {@code false} on failure
      */
     @Override
-    public boolean requestRouteToHostAddress(int networkType, byte[] hostAddress) {
+    public boolean requestRouteToHostAddress(int networkType, byte[] hostAddress,
+            String callingPackageName, String callingAttributionTag) {
         if (disallowedBecauseSystemCaller()) {
             return false;
         }
-        enforceChangePermission();
+        enforceChangePermission(callingPackageName, callingAttributionTag);
         if (mProtectedNetworks.contains(networkType)) {
             enforceConnectivityRestrictedNetworksPermission();
         }
@@ -2093,8 +2094,8 @@
                 "ConnectivityService");
     }
 
-    private void enforceChangePermission() {
-        ConnectivityManager.enforceChangePermission(mContext);
+    private void enforceChangePermission(String callingPkg, String callingAttributionTag) {
+        ConnectivityManager.enforceChangePermission(mContext, callingPkg, callingAttributionTag);
     }
 
     private void enforceSettingsPermission() {
@@ -5149,14 +5150,6 @@
         }
     }
 
-    private void onPackageAdded(String packageName, int uid) {
-        if (TextUtils.isEmpty(packageName) || uid < 0) {
-            Slog.wtf(TAG, "Invalid package in onPackageAdded: " + packageName + " | " + uid);
-            return;
-        }
-        mPermissionMonitor.onPackageAdded(packageName, uid);
-    }
-
     private void onPackageReplaced(String packageName, int uid) {
         if (TextUtils.isEmpty(packageName) || uid < 0) {
             Slog.wtf(TAG, "Invalid package in onPackageReplaced: " + packageName + " | " + uid);
@@ -5182,7 +5175,6 @@
             Slog.wtf(TAG, "Invalid package in onPackageRemoved: " + packageName + " | " + uid);
             return;
         }
-        mPermissionMonitor.onPackageRemoved(uid);
 
         final int userId = UserHandle.getUserId(uid);
         synchronized (mVpns) {
@@ -5232,8 +5224,6 @@
                 onUserRemoved(userId);
             } else if (Intent.ACTION_USER_UNLOCKED.equals(action)) {
                 onUserUnlocked(userId);
-            } else if (Intent.ACTION_PACKAGE_ADDED.equals(action)) {
-                onPackageAdded(packageName, uid);
             } else if (Intent.ACTION_PACKAGE_REPLACED.equals(action)) {
                 onPackageReplaced(packageName, uid);
             } else if (Intent.ACTION_PACKAGE_REMOVED.equals(action)) {
@@ -5509,7 +5499,7 @@
     @Override
     public NetworkRequest requestNetwork(NetworkCapabilities networkCapabilities,
             Messenger messenger, int timeoutMs, IBinder binder, int legacyType,
-            @NonNull String callingPackageName) {
+            @NonNull String callingPackageName, @Nullable String callingAttributionTag) {
         if (legacyType != TYPE_NONE && !checkNetworkStackPermission()) {
             if (checkUnsupportedStartingFrom(Build.VERSION_CODES.M, callingPackageName)) {
                 throw new SecurityException("Insufficient permissions to specify legacy type");
@@ -5527,7 +5517,8 @@
             enforceAccessPermission();
         } else {
             networkCapabilities = new NetworkCapabilities(networkCapabilities);
-            enforceNetworkRequestPermissions(networkCapabilities);
+            enforceNetworkRequestPermissions(networkCapabilities, callingPackageName,
+                    callingAttributionTag);
             // TODO: this is incorrect. We mark the request as metered or not depending on the state
             // of the app when the request is filed, but we never change the request if the app
             // changes network state. http://b/29964605
@@ -5562,11 +5553,12 @@
         return networkRequest;
     }
 
-    private void enforceNetworkRequestPermissions(NetworkCapabilities networkCapabilities) {
+    private void enforceNetworkRequestPermissions(NetworkCapabilities networkCapabilities,
+            String callingPackageName, String callingAttributionTag) {
         if (networkCapabilities.hasCapability(NET_CAPABILITY_NOT_RESTRICTED) == false) {
             enforceConnectivityRestrictedNetworksPermission();
         } else {
-            enforceChangePermission();
+            enforceChangePermission(callingPackageName, callingAttributionTag);
         }
     }
 
@@ -5617,11 +5609,13 @@
 
     @Override
     public NetworkRequest pendingRequestForNetwork(NetworkCapabilities networkCapabilities,
-            PendingIntent operation, @NonNull String callingPackageName) {
+            PendingIntent operation, @NonNull String callingPackageName,
+            @Nullable String callingAttributionTag) {
         Objects.requireNonNull(operation, "PendingIntent cannot be null.");
         final int callingUid = Binder.getCallingUid();
         networkCapabilities = new NetworkCapabilities(networkCapabilities);
-        enforceNetworkRequestPermissions(networkCapabilities);
+        enforceNetworkRequestPermissions(networkCapabilities, callingPackageName,
+                callingAttributionTag);
         enforceMeteredApnPolicy(networkCapabilities);
         ensureRequestableCapabilities(networkCapabilities);
         ensureSufficientPermissionsForRequest(networkCapabilities,
diff --git a/services/core/java/com/android/server/RuntimeService.java b/services/core/java/com/android/server/RuntimeService.java
index bb39ccc..f4249f8 100644
--- a/services/core/java/com/android/server/RuntimeService.java
+++ b/services/core/java/com/android/server/RuntimeService.java
@@ -23,10 +23,9 @@
 import android.util.Slog;
 import android.util.proto.ProtoOutputStream;
 
-import libcore.timezone.TimeZoneDataFiles;
-import libcore.util.CoreLibraryDebug;
-import libcore.util.DebugInfo;
-
+import com.android.i18n.timezone.DebugInfo;
+import com.android.i18n.timezone.I18nModuleDebug;
+import com.android.i18n.timezone.TimeZoneDataFiles;
 import com.android.internal.util.DumpUtils;
 import com.android.timezone.distro.DistroException;
 import com.android.timezone.distro.DistroVersion;
@@ -61,14 +60,14 @@
         boolean protoFormat = hasOption(args, "--proto");
         ProtoOutputStream proto = null;
 
-        DebugInfo coreLibraryDebugInfo = CoreLibraryDebug.getDebugInfo();
-        addTimeZoneApkDebugInfo(coreLibraryDebugInfo);
+        DebugInfo i18nLibraryDebugInfo = I18nModuleDebug.getDebugInfo();
+        addTimeZoneApkDebugInfo(i18nLibraryDebugInfo);
 
         if (protoFormat) {
             proto = new ProtoOutputStream(fd);
-            reportTimeZoneInfoProto(coreLibraryDebugInfo, proto);
+            reportTimeZoneInfoProto(i18nLibraryDebugInfo, proto);
         } else {
-            reportTimeZoneInfo(coreLibraryDebugInfo, pw);
+            reportTimeZoneInfo(i18nLibraryDebugInfo, pw);
         }
 
         if (protoFormat) {
diff --git a/services/core/java/com/android/server/accounts/TokenCache.java b/services/core/java/com/android/server/accounts/TokenCache.java
index e38cf5f..66e550f 100644
--- a/services/core/java/com/android/server/accounts/TokenCache.java
+++ b/services/core/java/com/android/server/accounts/TokenCache.java
@@ -148,7 +148,7 @@
                 accountEvictor = new Evictor();
             }
             accountEvictor.add(k);
-            mAccountEvictors.put(k.account, tokenEvictor);
+            mAccountEvictors.put(k.account, accountEvictor);
 
             // Only cache the token once we can remove it directly or by account.
             put(k, v);
diff --git a/services/core/java/com/android/server/am/ProcessList.java b/services/core/java/com/android/server/am/ProcessList.java
index 2e62864..5a0ea75 100644
--- a/services/core/java/com/android/server/am/ProcessList.java
+++ b/services/core/java/com/android/server/am/ProcessList.java
@@ -110,6 +110,7 @@
 import com.android.internal.annotations.VisibleForTesting;
 import com.android.internal.app.ProcessMap;
 import com.android.internal.app.procstats.ProcessStats;
+import com.android.internal.os.RuntimeInit;
 import com.android.internal.os.Zygote;
 import com.android.internal.util.ArrayUtils;
 import com.android.internal.util.FrameworkStatsLog;
@@ -124,7 +125,6 @@
 import com.android.server.wm.ActivityServiceConnectionsHolder;
 import com.android.server.wm.WindowManagerService;
 
-import dalvik.annotation.compat.VersionCodes;
 import dalvik.system.VMRuntime;
 
 import java.io.File;
@@ -345,10 +345,18 @@
      * Pointers</a>
      */
     @ChangeId
-    @EnabledAfter(targetSdkVersion = VersionCodes.Q)
+    @EnabledAfter(targetSdkVersion = Build.VERSION_CODES.Q)
     private static final long NATIVE_HEAP_POINTER_TAGGING = 135754954; // This is a bug id.
 
     /**
+     * Enable memory tag checks in non-system apps. This flag will only have an effect on
+     * hardware supporting the ARM Memory Tagging Extension (MTE).
+     */
+    @ChangeId
+    @Disabled
+    private static final long NATIVE_MEMORY_TAGGING = 135772972; // This is a bug id.
+
+    /**
      * Enable sampled memory bug detection in the app.
      * @see <a href="https://source.android.com/devices/tech/debug/gwp-asan">GWP-ASan</a>.
      */
@@ -361,7 +369,7 @@
      * app has made them world-readable.
      */
     @ChangeId
-    @EnabledAfter(targetSdkVersion = VersionCodes.Q)
+    @EnabledAfter(targetSdkVersion = Build.VERSION_CODES.Q)
     private static final long APP_DATA_DIRECTORY_ISOLATION = 143937733; // See b/143937733
 
     ActivityManagerService mService = null;
@@ -1669,6 +1677,25 @@
         return gidArray;
     }
 
+    private boolean shouldEnableMemoryTagging(ProcessRecord app) {
+        // Ensure the hardware + kernel actually supports MTE.
+        if (!Zygote.nativeSupportsMemoryTagging()) {
+            return false;
+        }
+
+        // Enable MTE for system apps if supported.
+        if ((app.info.flags & ApplicationInfo.FLAG_SYSTEM) != 0) {
+            return true;
+        }
+
+        // Enable MTE if the compat feature is enabled.
+        if (mPlatformCompat.isChangeEnabled(NATIVE_MEMORY_TAGGING, app.info)) {
+            return true;
+        }
+
+        return false;
+    }
+
     private boolean shouldEnableTaggedPointers(ProcessRecord app) {
         // Ensure we have platform + kernel support for TBI.
         if (!Zygote.nativeSupportsTaggedPointers()) {
@@ -1689,6 +1716,11 @@
     }
 
     private int decideTaggingLevel(ProcessRecord app) {
+        // Check MTE support first, as it should take precedence over TBI.
+        if (shouldEnableMemoryTagging(app)) {
+            return Zygote.MEMORY_TAG_LEVEL_ASYNC;
+        }
+
         if (shouldEnableTaggedPointers(app)) {
             return Zygote.MEMORY_TAG_LEVEL_TBI;
         }
@@ -1917,13 +1949,13 @@
             // If instructionSet is non-null, this indicates that the system_server is spawning a
             // process with an ISA that may be different from its own. System (kernel and hardware)
             // compatililty for these features is checked in the decideTaggingLevel in the
-            // system_server process (not the child process). As TBI is only supported in aarch64,
-            // we can simply ensure that the new process is also aarch64. This prevents the mismatch
-            // where a 64-bit system server spawns a 32-bit child that thinks it should enable some
-            // tagging variant. Theoretically, a 32-bit system server could exist that spawns 64-bit
-            // processes, in which case the new process won't get any tagging. This is fine as we
-            // haven't seen this configuration in practice, and we can reasonable assume that if
-            // tagging is desired, the system server will be 64-bit.
+            // system_server process (not the child process). As both MTE and TBI are only supported
+            // in aarch64, we can simply ensure that the new process is also aarch64. This prevents
+            // the mismatch where a 64-bit system server spawns a 32-bit child that thinks it should
+            // enable some tagging variant. Theoretically, a 32-bit system server could exist that
+            // spawns 64-bit processes, in which case the new process won't get any tagging. This is
+            // fine as we haven't seen this configuration in practice, and we can reasonable assume
+            // that if tagging is desired, the system server will be 64-bit.
             if (instructionSet == null || instructionSet.equals("arm64")) {
                 runtimeFlags |= decideTaggingLevel(app);
             }
diff --git a/services/core/java/com/android/server/audio/AudioService.java b/services/core/java/com/android/server/audio/AudioService.java
index 5e908b2..5e12a73 100755
--- a/services/core/java/com/android/server/audio/AudioService.java
+++ b/services/core/java/com/android/server/audio/AudioService.java
@@ -3805,7 +3805,7 @@
                 iter.remove();
                 try {
                     hdlr.getBinder().unlinkToDeath(hdlr, 0);
-                    if (cb != hdlr.getBinder()) {
+                    if (cb != hdlr.getBinder()){
                         hdlr = null;
                     }
                 } catch (NoSuchElementException e) {
diff --git a/services/core/java/com/android/server/audio/MediaFocusControl.java b/services/core/java/com/android/server/audio/MediaFocusControl.java
index 26281b7..bbc29b0 100755
--- a/services/core/java/com/android/server/audio/MediaFocusControl.java
+++ b/services/core/java/com/android/server/audio/MediaFocusControl.java
@@ -682,7 +682,12 @@
                 return;
             }
         }
-        final FocusRequester fr = mFocusOwnersForFocusPolicy.get(afi.getClientId());
+        final FocusRequester fr;
+        if (requestResult == AudioManager.AUDIOFOCUS_REQUEST_FAILED) {
+            fr = mFocusOwnersForFocusPolicy.remove(afi.getClientId());
+        } else {
+            fr = mFocusOwnersForFocusPolicy.get(afi.getClientId());
+        }
         if (fr != null) {
             fr.dispatchFocusResultFromExtPolicy(requestResult);
         }
diff --git a/services/core/java/com/android/server/compat/OWNERS b/services/core/java/com/android/server/compat/OWNERS
index 2b7cdb0..cfd0a4b 100644
--- a/services/core/java/com/android/server/compat/OWNERS
+++ b/services/core/java/com/android/server/compat/OWNERS
@@ -2,6 +2,5 @@
 platform-compat-eng+reviews@google.com
 
 andreionea@google.com
-atrost@google.com
 mathewi@google.com
 satayev@google.com
diff --git a/services/core/java/com/android/server/compat/PlatformCompat.java b/services/core/java/com/android/server/compat/PlatformCompat.java
index d7e9499..92fce8a 100644
--- a/services/core/java/com/android/server/compat/PlatformCompat.java
+++ b/services/core/java/com/android/server/compat/PlatformCompat.java
@@ -20,6 +20,7 @@
 import static android.Manifest.permission.OVERRIDE_COMPAT_CHANGE_CONFIG;
 import static android.Manifest.permission.READ_COMPAT_CHANGE_CONFIG;
 import static android.content.pm.PackageManager.PERMISSION_GRANTED;
+import static android.os.Process.SYSTEM_UID;
 
 import android.annotation.UserIdInt;
 import android.app.ActivityManager;
@@ -333,6 +334,10 @@
     }
 
     private void checkCompatChangeLogPermission() throws SecurityException {
+        // Don't check for permissions within the system process
+        if (Binder.getCallingUid() == SYSTEM_UID) {
+            return;
+        }
         if (mContext.checkCallingOrSelfPermission(LOG_COMPAT_CHANGE)
                 != PERMISSION_GRANTED) {
             throw new SecurityException("Cannot log compat change usage");
@@ -340,6 +345,10 @@
     }
 
     private void checkCompatChangeReadPermission() throws SecurityException {
+        // Don't check for permissions within the system process
+        if (Binder.getCallingUid() == SYSTEM_UID) {
+            return;
+        }
         if (mContext.checkCallingOrSelfPermission(READ_COMPAT_CHANGE_CONFIG)
                 != PERMISSION_GRANTED) {
             throw new SecurityException("Cannot read compat change");
@@ -347,6 +356,10 @@
     }
 
     private void checkCompatChangeOverridePermission() throws SecurityException {
+        // Don't check for permissions within the system process
+        if (Binder.getCallingUid() == SYSTEM_UID) {
+            return;
+        }
         if (mContext.checkCallingOrSelfPermission(OVERRIDE_COMPAT_CHANGE_CONFIG)
                 != PERMISSION_GRANTED) {
             throw new SecurityException("Cannot override compat change");
diff --git a/services/core/java/com/android/server/connectivity/NetworkAgentInfo.java b/services/core/java/com/android/server/connectivity/NetworkAgentInfo.java
index 37b2de1..a9f62d9 100644
--- a/services/core/java/com/android/server/connectivity/NetworkAgentInfo.java
+++ b/services/core/java/com/android/server/connectivity/NetworkAgentInfo.java
@@ -658,19 +658,22 @@
     // TODO: Print shorter members first and only print the boolean variable which value is true
     // to improve readability.
     public String toString() {
-        return "NetworkAgentInfo{ ni{" + networkInfo + "}  "
-                + "network{" + network + "}  nethandle{" + network.getNetworkHandle() + "}  "
-                + "lp{" + linkProperties + "}  "
-                + "nc{" + networkCapabilities + "}  Score{" + getCurrentScore() + "}  "
-                + "everValidated{" + everValidated + "}  lastValidated{" + lastValidated + "}  "
-                + "created{" + created + "} lingering{" + isLingering() + "} "
-                + "explicitlySelected{" + networkAgentConfig.explicitlySelected + "} "
-                + "acceptUnvalidated{" + networkAgentConfig.acceptUnvalidated + "} "
-                + "everCaptivePortalDetected{" + everCaptivePortalDetected + "} "
-                + "lastCaptivePortalDetected{" + lastCaptivePortalDetected + "} "
-                + "partialConnectivity{" + partialConnectivity + "} "
-                + "acceptPartialConnectivity{" + networkAgentConfig.acceptPartialConnectivity + "} "
-                + "clat{" + clatd + "} "
+        return "NetworkAgentInfo{"
+                + "network{" + network + "}  handle{" + network.getNetworkHandle() + "}  ni{"
+                + networkInfo.toShortString() + "} "
+                + "  Score{" + getCurrentScore() + "} "
+                + (isLingering() ? " lingering" : "")
+                + (everValidated ? " everValidated" : "")
+                + (lastValidated ? " lastValidated" : "")
+                + (partialConnectivity ? " partialConnectivity" : "")
+                + (everCaptivePortalDetected ? " everCaptivePortal" : "")
+                + (lastCaptivePortalDetected ? " isCaptivePortal" : "")
+                + (networkAgentConfig.explicitlySelected ? " explicitlySelected" : "")
+                + (networkAgentConfig.acceptUnvalidated ? " acceptUnvalidated" : "")
+                + (networkAgentConfig.acceptPartialConnectivity ? " acceptPartialConnectivity" : "")
+                + (clatd.isStarted() ? " clat{" + clatd + "} " : "")
+                + "  lp{" + linkProperties + "}"
+                + "  nc{" + networkCapabilities + "}"
                 + "}";
     }
 
diff --git a/services/core/java/com/android/server/connectivity/PermissionMonitor.java b/services/core/java/com/android/server/connectivity/PermissionMonitor.java
index f0b7150..c5aa8d5 100644
--- a/services/core/java/com/android/server/connectivity/PermissionMonitor.java
+++ b/services/core/java/com/android/server/connectivity/PermissionMonitor.java
@@ -72,7 +72,7 @@
  *
  * @hide
  */
-public class PermissionMonitor {
+public class PermissionMonitor implements PackageManagerInternal.PackageListObserver {
     private static final String TAG = "PermissionMonitor";
     private static final boolean DBG = true;
     protected static final Boolean SYSTEM = Boolean.TRUE;
@@ -102,44 +102,6 @@
     @GuardedBy("this")
     private final Set<Integer> mAllApps = new HashSet<>();
 
-    private class PackageListObserver implements PackageManagerInternal.PackageListObserver {
-
-        private int getPermissionForUid(int uid) {
-            int permission = 0;
-            // Check all the packages for this UID. The UID has the permission if any of the
-            // packages in it has the permission.
-            String[] packages = mPackageManager.getPackagesForUid(uid);
-            if (packages != null && packages.length > 0) {
-                for (String name : packages) {
-                    final PackageInfo app = getPackageInfo(name);
-                    if (app != null && app.requestedPermissions != null) {
-                        permission |= getNetdPermissionMask(app.requestedPermissions,
-                              app.requestedPermissionsFlags);
-                    }
-                }
-            } else {
-                // The last package of this uid is removed from device. Clean the package up.
-                permission = INetd.PERMISSION_UNINSTALLED;
-            }
-            return permission;
-        }
-
-        @Override
-        public void onPackageAdded(String packageName, int uid) {
-            sendPackagePermissionsForUid(uid, getPermissionForUid(uid));
-        }
-
-        @Override
-        public void onPackageChanged(@NonNull String packageName, int uid) {
-            sendPackagePermissionsForUid(uid, getPermissionForUid(uid));
-        }
-
-        @Override
-        public void onPackageRemoved(String packageName, int uid) {
-            sendPackagePermissionsForUid(uid, getPermissionForUid(uid));
-        }
-    }
-
     public PermissionMonitor(Context context, INetd netd) {
         mPackageManager = context.getPackageManager();
         mUserManager = (UserManager) context.getSystemService(Context.USER_SERVICE);
@@ -153,7 +115,7 @@
 
         PackageManagerInternal pmi = LocalServices.getService(PackageManagerInternal.class);
         if (pmi != null) {
-            pmi.getPackageList(new PackageListObserver());
+            pmi.getPackageList(this);
         } else {
             loge("failed to get the PackageManagerInternal service");
         }
@@ -363,15 +325,38 @@
         return currentPermission;
     }
 
+    private int getPermissionForUid(final int uid) {
+        int permission = INetd.PERMISSION_NONE;
+        // Check all the packages for this UID. The UID has the permission if any of the
+        // packages in it has the permission.
+        final String[] packages = mPackageManager.getPackagesForUid(uid);
+        if (packages != null && packages.length > 0) {
+            for (String name : packages) {
+                final PackageInfo app = getPackageInfo(name);
+                if (app != null && app.requestedPermissions != null) {
+                    permission |= getNetdPermissionMask(app.requestedPermissions,
+                            app.requestedPermissionsFlags);
+                }
+            }
+        } else {
+            // The last package of this uid is removed from device. Clean the package up.
+            permission = INetd.PERMISSION_UNINSTALLED;
+        }
+        return permission;
+    }
+
     /**
-     * Called when a package is added. See {link #ACTION_PACKAGE_ADDED}.
+     * Called when a package is added.
      *
      * @param packageName The name of the new package.
      * @param uid The uid of the new package.
      *
      * @hide
      */
-    public synchronized void onPackageAdded(String packageName, int uid) {
+    @Override
+    public synchronized void onPackageAdded(@NonNull final String packageName, final int uid) {
+        sendPackagePermissionsForUid(uid, getPermissionForUid(uid));
+
         // If multiple packages share a UID (cf: android:sharedUserId) and ask for different
         // permissions, don't downgrade (i.e., if it's already SYSTEM, leave it as is).
         final Boolean permission = highestPermissionForUid(mApps.get(uid), packageName);
@@ -398,13 +383,17 @@
     }
 
     /**
-     * Called when a package is removed. See {link #ACTION_PACKAGE_REMOVED}.
+     * Called when a package is removed.
      *
+     * @param packageName The name of the removed package or null.
      * @param uid containing the integer uid previously assigned to the package.
      *
      * @hide
      */
-    public synchronized void onPackageRemoved(int uid) {
+    @Override
+    public synchronized void onPackageRemoved(@NonNull final String packageName, final int uid) {
+        sendPackagePermissionsForUid(uid, getPermissionForUid(uid));
+
         // If the newly-removed package falls within some VPN's uid range, update Netd with it.
         // This needs to happen before the mApps update below, since removeBypassingUids() depends
         // on mApps to check if the package can bypass VPN.
@@ -449,6 +438,19 @@
         }
     }
 
+    /**
+     * Called when a package is changed.
+     *
+     * @param packageName The name of the changed package.
+     * @param uid The uid of the changed package.
+     *
+     * @hide
+     */
+    @Override
+    public synchronized void onPackageChanged(@NonNull final String packageName, final int uid) {
+        sendPackagePermissionsForUid(uid, getPermissionForUid(uid));
+    }
+
     private static int getNetdPermissionMask(String[] requestedPermissions,
                                              int[] requestedPermissionsFlags) {
         int permissions = 0;
diff --git a/services/core/java/com/android/server/hdmi/HdmiCecController.java b/services/core/java/com/android/server/hdmi/HdmiCecController.java
index 75ab33d..66652ca 100644
--- a/services/core/java/com/android/server/hdmi/HdmiCecController.java
+++ b/services/core/java/com/android/server/hdmi/HdmiCecController.java
@@ -27,9 +27,7 @@
 import android.os.Handler;
 import android.os.IHwBinder;
 import android.os.Looper;
-import android.os.MessageQueue;
 import android.os.RemoteException;
-import android.os.SystemProperties;
 import android.util.Slog;
 import android.util.SparseArray;
 
@@ -125,18 +123,10 @@
 
     private final NativeWrapper mNativeWrapperImpl;
 
-    /** List of logical addresses that should not be assigned to the current device.
-     *
-     * <p>Parsed from {@link Constants#PROPERTY_HDMI_CEC_NEVER_ASSIGN_LOGICAL_ADDRESSES}
-     */
-    private final List<Integer> mNeverAssignLogicalAddresses;
-
     // Private constructor.  Use HdmiCecController.create().
     private HdmiCecController(HdmiControlService service, NativeWrapper nativeWrapper) {
         mService = service;
         mNativeWrapperImpl = nativeWrapper;
-        mNeverAssignLogicalAddresses = mService.getIntList(SystemProperties.get(
-            Constants.PROPERTY_HDMI_CEC_NEVER_ASSIGN_LOGICAL_ADDRESSES));
     }
 
     /**
@@ -227,8 +217,7 @@
         for (int i = 0; i < NUM_LOGICAL_ADDRESS; ++i) {
             int curAddress = (startAddress + i) % NUM_LOGICAL_ADDRESS;
             if (curAddress != Constants.ADDR_UNREGISTERED
-                    && deviceType == HdmiUtils.getTypeFromAddress(curAddress)
-                    && !mNeverAssignLogicalAddresses.contains(curAddress)) {
+                    && deviceType == HdmiUtils.getTypeFromAddress(curAddress)) {
                 boolean acked = false;
                 for (int j = 0; j < HdmiConfig.ADDRESS_ALLOCATION_RETRY; ++j) {
                     if (sendPollMessage(curAddress, curAddress, 1)) {
@@ -731,21 +720,6 @@
         boolean nativeIsConnected(int port);
     }
 
-    private static native long nativeInit(HdmiCecController handler, MessageQueue messageQueue);
-    private static native int nativeSendCecCommand(long controllerPtr, int srcAddress,
-        int dstAddress, byte[] body);
-    private static native int nativeAddLogicalAddress(long controllerPtr, int logicalAddress);
-    private static native void nativeClearLogicalAddress(long controllerPtr);
-    private static native int nativeGetPhysicalAddress(long controllerPtr);
-    private static native int nativeGetVersion(long controllerPtr);
-    private static native int nativeGetVendorId(long controllerPtr);
-    private static native HdmiPortInfo[] nativeGetPortInfos(long controllerPtr);
-    private static native void nativeSetOption(long controllerPtr, int flag, boolean enabled);
-    private static native void nativeSetLanguage(long controllerPtr, String language);
-    private static native void nativeEnableAudioReturnChannel(long controllerPtr,
-        int port, boolean flag);
-    private static native boolean nativeIsConnected(long controllerPtr, int port);
-
     private static final class NativeWrapperImpl implements NativeWrapper,
             IHwBinder.DeathRecipient, getPhysicalAddressCallback {
         private IHdmiCec mHdmiCec;
diff --git a/services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceTv.java b/services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceTv.java
index f4a8667..2c0ddaf 100644
--- a/services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceTv.java
+++ b/services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceTv.java
@@ -214,9 +214,11 @@
         resetSelectRequestBuffer();
         launchDeviceDiscovery();
         startQueuedActions();
+        if (!mDelayedMessageBuffer.isBuffered(Constants.MESSAGE_ACTIVE_SOURCE)) {
+            mService.sendCecCommand(HdmiCecMessageBuilder.buildRequestActiveSource(mAddress));
+        }
     }
 
-
     @ServiceThreadOnly
     private List<Integer> initLocalDeviceAddresses() {
         assertRunOnServiceThread();
@@ -1096,10 +1098,11 @@
         HdmiDeviceInfo avr = getAvrDeviceInfo();
         if (avr != null
                 && (avrAddress == avr.getLogicalAddress())
-                && isConnectedToArcPort(avr.getPhysicalAddress())
-                && isDirectConnectAddress(avr.getPhysicalAddress())) {
+                && isConnectedToArcPort(avr.getPhysicalAddress())) {
             if (enabled) {
-                return isConnected(avr.getPortId()) && isArcFeatureEnabled(avr.getPortId());
+                return isConnected(avr.getPortId())
+                    && isArcFeatureEnabled(avr.getPortId())
+                    && isDirectConnectAddress(avr.getPhysicalAddress());
             } else {
                 return true;
             }
diff --git a/services/core/java/com/android/server/hdmi/HdmiControlService.java b/services/core/java/com/android/server/hdmi/HdmiControlService.java
index 87a908c..4e04b72 100644
--- a/services/core/java/com/android/server/hdmi/HdmiControlService.java
+++ b/services/core/java/com/android/server/hdmi/HdmiControlService.java
@@ -187,10 +187,6 @@
     @GuardedBy("mLock")
     private boolean mSystemAudioActivated = false;
 
-    private static final boolean isHdmiCecNeverClaimPlaybackLogicAddr =
-            SystemProperties.getBoolean(
-                    Constants.PROPERTY_HDMI_CEC_NEVER_CLAIM_PLAYBACK_LOGICAL_ADDRESS, false);
-
     /**
      * Interface to report send result.
      */
@@ -789,10 +785,6 @@
         // A container for [Device type, Local device info].
         ArrayList<HdmiCecLocalDevice> localDevices = new ArrayList<>();
         for (int type : mLocalDevices) {
-            if (type == HdmiDeviceInfo.DEVICE_PLAYBACK
-                    && isHdmiCecNeverClaimPlaybackLogicAddr) {
-                continue;
-            }
             HdmiCecLocalDevice localDevice = mCecController.getLocalDevice(type);
             if (localDevice == null) {
                 localDevice = HdmiCecLocalDevice.create(this, type);
@@ -1207,10 +1199,6 @@
             }
             ArrayList<HdmiCecLocalDevice> localDevices = new ArrayList<>();
             for (int type : mLocalDevices) {
-                if (type == HdmiDeviceInfo.DEVICE_PLAYBACK
-                        && isHdmiCecNeverClaimPlaybackLogicAddr) {
-                    continue;
-                }
                 HdmiCecLocalDevice localDevice = mCecController.getLocalDevice(type);
                 if (localDevice == null) {
                     localDevice = HdmiCecLocalDevice.create(this, type);
diff --git a/services/core/java/com/android/server/hdmi/HdmiLogger.java b/services/core/java/com/android/server/hdmi/HdmiLogger.java
index 8da3c93..0104064 100644
--- a/services/core/java/com/android/server/hdmi/HdmiLogger.java
+++ b/services/core/java/com/android/server/hdmi/HdmiLogger.java
@@ -18,9 +18,9 @@
 
 import android.annotation.Nullable;
 import android.os.SystemClock;
-import android.util.Log;
 import android.util.Pair;
 import android.util.Slog;
+import android.util.Log;
 
 import java.util.HashMap;
 
@@ -71,7 +71,7 @@
         getLogger().errorInternal(toLogString(logMessage, objs));
     }
 
-    static void error(String logMessage, Exception e, Object... objs) {
+    static final void error(String logMessage, Exception e, Object... objs) {
         getLogger().errorInternal(toLogString(logMessage + e, objs));
     }
 
diff --git a/services/core/java/com/android/server/net/NetworkStatsService.java b/services/core/java/com/android/server/net/NetworkStatsService.java
index ba9f486..71e7c8a 100644
--- a/services/core/java/com/android/server/net/NetworkStatsService.java
+++ b/services/core/java/com/android/server/net/NetworkStatsService.java
@@ -87,6 +87,7 @@
 import android.content.IntentFilter;
 import android.content.pm.ApplicationInfo;
 import android.content.pm.PackageManager;
+import android.database.ContentObserver;
 import android.net.DataUsageRequest;
 import android.net.INetworkManagementEventObserver;
 import android.net.INetworkStatsService;
@@ -103,6 +104,7 @@
 import android.net.NetworkStatsHistory;
 import android.net.NetworkTemplate;
 import android.net.TrafficStats;
+import android.net.Uri;
 import android.net.netstats.provider.INetworkStatsProvider;
 import android.net.netstats.provider.INetworkStatsProviderCallback;
 import android.net.netstats.provider.NetworkStatsProvider;
@@ -213,6 +215,9 @@
 
     private final boolean mUseBpfTrafficStats;
 
+    private final ContentObserver mContentObserver;
+    private final ContentResolver mContentResolver;
+
     @VisibleForTesting
     public static final String ACTION_NETWORK_STATS_POLL =
             "com.android.server.action.NETWORK_STATS_POLL";
@@ -437,7 +442,10 @@
         handlerThread.start();
         mHandler = new NetworkStatsHandler(handlerThread.getLooper());
         mNetworkStatsSubscriptionsMonitor = deps.makeSubscriptionsMonitor(mContext,
-                new HandlerExecutor(mHandler), this);
+                mHandler.getLooper(), new HandlerExecutor(mHandler), this);
+        mContentResolver = mContext.getContentResolver();
+        mContentObserver = mDeps.makeContentObserver(mHandler, mSettings,
+                mNetworkStatsSubscriptionsMonitor);
     }
 
     /**
@@ -460,11 +468,31 @@
          */
         @NonNull
         public NetworkStatsSubscriptionsMonitor makeSubscriptionsMonitor(@NonNull Context context,
-                @NonNull Executor executor, @NonNull NetworkStatsService service) {
+                @NonNull Looper looper, @NonNull Executor executor,
+                @NonNull NetworkStatsService service) {
             // TODO: Update RatType passively in NSS, instead of querying into the monitor
             //  when forceUpdateIface.
-            return new NetworkStatsSubscriptionsMonitor(context, executor, (subscriberId, type) ->
-                    service.handleOnCollapsedRatTypeChanged());
+            return new NetworkStatsSubscriptionsMonitor(context, looper, executor,
+                    (subscriberId, type) -> service.handleOnCollapsedRatTypeChanged());
+        }
+
+        /**
+         * Create a ContentObserver instance which is used to observe settings changes,
+         * and dispatch onChange events on handler thread.
+         */
+        public @NonNull ContentObserver makeContentObserver(@NonNull Handler handler,
+                @NonNull NetworkStatsSettings settings,
+                @NonNull NetworkStatsSubscriptionsMonitor monitor) {
+            return new ContentObserver(handler) {
+                @Override
+                public void onChange(boolean selfChange, @NonNull Uri uri) {
+                    if (!settings.getCombineSubtypeEnabled()) {
+                        monitor.start();
+                    } else {
+                        monitor.stop();
+                    }
+                }
+            };
         }
     }
 
@@ -530,11 +558,14 @@
         mAlarmManager.setInexactRepeating(AlarmManager.ELAPSED_REALTIME, currentRealtime,
                 mSettings.getPollInterval(), pollIntent);
 
-        // TODO: listen to settings changed to support dynamically enable/disable.
-        // watch for networkType changes
-        if (!mSettings.getCombineSubtypeEnabled()) {
-            mNetworkStatsSubscriptionsMonitor.start();
-        }
+        mContentResolver.registerContentObserver(Settings.Global
+                .getUriFor(Settings.Global.NETSTATS_COMBINE_SUBTYPE_ENABLED),
+                        false /* notifyForDescendants */, mContentObserver);
+
+        // Post a runnable on handler thread to call onChange(). It's for getting current value of
+        // NETSTATS_COMBINE_SUBTYPE_ENABLED to decide start or stop monitoring RAT type changes.
+        mHandler.post(() -> mContentObserver.onChange(false, Settings.Global
+                .getUriFor(Settings.Global.NETSTATS_COMBINE_SUBTYPE_ENABLED)));
 
         registerGlobalAlert();
     }
@@ -560,6 +591,8 @@
             mNetworkStatsSubscriptionsMonitor.stop();
         }
 
+        mContentResolver.unregisterContentObserver(mContentObserver);
+
         final long currentTime = mClock.millis();
 
         // persist any pending stats
diff --git a/services/core/java/com/android/server/net/NetworkStatsSubscriptionsMonitor.java b/services/core/java/com/android/server/net/NetworkStatsSubscriptionsMonitor.java
index a0ab5ea..db553ee 100644
--- a/services/core/java/com/android/server/net/NetworkStatsSubscriptionsMonitor.java
+++ b/services/core/java/com/android/server/net/NetworkStatsSubscriptionsMonitor.java
@@ -20,6 +20,7 @@
 
 import android.annotation.NonNull;
 import android.content.Context;
+import android.os.Looper;
 import android.telephony.Annotation;
 import android.telephony.PhoneStateListener;
 import android.telephony.ServiceState;
@@ -75,9 +76,9 @@
     @NonNull
     private final Executor mExecutor;
 
-    NetworkStatsSubscriptionsMonitor(@NonNull Context context, @NonNull Executor executor,
-            @NonNull Delegate delegate) {
-        super();
+    NetworkStatsSubscriptionsMonitor(@NonNull Context context, @NonNull Looper looper,
+            @NonNull Executor executor, @NonNull Delegate delegate) {
+        super(looper);
         mSubscriptionManager = (SubscriptionManager) context.getSystemService(
                 Context.TELEPHONY_SUBSCRIPTION_SERVICE);
         mTeleManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
diff --git a/services/core/java/com/android/server/notification/NotificationManagerService.java b/services/core/java/com/android/server/notification/NotificationManagerService.java
index 18635e8..26237f8 100755
--- a/services/core/java/com/android/server/notification/NotificationManagerService.java
+++ b/services/core/java/com/android/server/notification/NotificationManagerService.java
@@ -6975,6 +6975,10 @@
         if (isInCall() || mScreenOn) {
             return false;
         }
+        // check current user
+        if (!isNotificationForCurrentUser(record)) {
+            return false;
+        }
 
         return true;
     }
diff --git a/services/core/java/com/android/server/notification/ZenModeHelper.java b/services/core/java/com/android/server/notification/ZenModeHelper.java
index 4931d3f..5417275 100644
--- a/services/core/java/com/android/server/notification/ZenModeHelper.java
+++ b/services/core/java/com/android/server/notification/ZenModeHelper.java
@@ -869,13 +869,13 @@
             final boolean policyChanged = !Objects.equals(getNotificationPolicy(mConfig),
                     getNotificationPolicy(config));
             if (!config.equals(mConfig)) {
+                mConfig = config;
                 dispatchOnConfigChanged();
                 updateConsolidatedPolicy(reason);
             }
             if (policyChanged) {
                 dispatchOnPolicyChanged();
             }
-            mConfig = config;
             mHandler.postApplyConfig(config, reason, triggeringComponent, setRingerMode);
             return true;
         } catch (SecurityException e) {
diff --git a/services/core/java/com/android/server/pm/OWNERS b/services/core/java/com/android/server/pm/OWNERS
index f8c173f..fe6aad7 100644
--- a/services/core/java/com/android/server/pm/OWNERS
+++ b/services/core/java/com/android/server/pm/OWNERS
@@ -10,8 +10,8 @@
 toddke@google.com
 
 # apex support
-per-file ApexManager.java = dariofreni@google.com
-per-file StagingManager.java = dariofreni@google.com
+per-file ApexManager.java = dariofreni@google.com, ioffe@google.com, olilan@google.com
+per-file StagingManager.java = dariofreni@google.com, ioffe@google.com, olilan@google.com
 
 # dex
 per-file AbstractStatsBase.java = agampe@google.com, calin@google.com, ngeoffray@google.com
@@ -30,8 +30,9 @@
 per-file CrossProfileAppsService.java = omakoto@google.com, yamasani@google.com
 per-file CrossProfileIntentFilter.java = omakoto@google.com, yamasani@google.com
 per-file CrossProfileIntentResolver.java = omakoto@google.com, yamasani@google.com
-per-file UserManagerService.java = omakoto@google.com, yamasani@google.com
+per-file UserManagerService.java = bookatz@google.com, omakoto@google.com, yamasani@google.com
 per-file UserRestrictionsUtils.java = omakoto@google.com, rubinxu@google.com, sandness@google.com, yamasani@google.com
+per-file RestrictionsSet.java = bookatz@google.com, omakoto@google.com, yamasani@google.com, rubinxu@google.com, sandness@google.com
 per-file UserSystemPackageInstaller.java = bookatz@google.com, omakoto@google.com, yamasani@google.com
 per-file UserTypeDetails.java = bookatz@google.com, omakoto@google.com, yamasani@google.com
 per-file UserTypeFactory.java = bookatz@google.com, omakoto@google.com, yamasani@google.com
diff --git a/services/core/java/com/android/server/role/OWNERS b/services/core/java/com/android/server/role/OWNERS
new file mode 100644
index 0000000..b94d988
--- /dev/null
+++ b/services/core/java/com/android/server/role/OWNERS
@@ -0,0 +1,6 @@
+svetoslavganov@google.com
+moltmann@google.com
+zhanghai@google.com
+evanseverson@google.com
+eugenesusla@google.com
+ntmyren@google.com
diff --git a/services/core/java/com/android/server/timezone/RulesManagerService.java b/services/core/java/com/android/server/timezone/RulesManagerService.java
index bbd1ae6..fd5c6e9 100644
--- a/services/core/java/com/android/server/timezone/RulesManagerService.java
+++ b/services/core/java/com/android/server/timezone/RulesManagerService.java
@@ -37,6 +37,10 @@
 import android.os.RemoteException;
 import android.util.Slog;
 
+import com.android.i18n.timezone.TimeZoneDataFiles;
+import com.android.i18n.timezone.TimeZoneFinder;
+import com.android.i18n.timezone.TzDataSetVersion;
+import com.android.i18n.timezone.ZoneInfoDb;
 import com.android.internal.annotations.VisibleForTesting;
 import com.android.server.EventLogTags;
 import com.android.server.SystemService;
@@ -46,10 +50,6 @@
 import com.android.timezone.distro.TimeZoneDistro;
 import com.android.timezone.distro.installer.TimeZoneDistroInstaller;
 
-import libcore.timezone.TimeZoneDataFiles;
-import libcore.timezone.TimeZoneFinder;
-import libcore.timezone.TzDataSetVersion;
-import libcore.timezone.ZoneInfoDb;
 
 import java.io.File;
 import java.io.FileDescriptor;
diff --git a/services/core/jni/Android.bp b/services/core/jni/Android.bp
index 925ad0f..e897274 100644
--- a/services/core/jni/Android.bp
+++ b/services/core/jni/Android.bp
@@ -31,7 +31,6 @@
         "com_android_server_devicepolicy_CryptoTestHelper.cpp",
         "com_android_server_gpu_GpuService.cpp",
         "com_android_server_HardwarePropertiesManagerService.cpp",
-        "com_android_server_hdmi_HdmiCecController.cpp",
         "com_android_server_input_InputManagerService.cpp",
         "com_android_server_lights_LightsService.cpp",
         "com_android_server_location_GnssLocationProvider.cpp",
@@ -152,7 +151,6 @@
         "android.hardware.power-cpp",
         "android.hardware.power.stats@1.0",
         "android.hardware.thermal@1.0",
-        "android.hardware.tv.cec@1.0",
         "android.hardware.tv.input@1.0",
         "android.hardware.vibrator-cpp",
         "android.hardware.vibrator@1.0",
diff --git a/services/core/jni/com_android_server_AlarmManagerService.cpp b/services/core/jni/com_android_server_AlarmManagerService.cpp
index e79612f..335040a 100644
--- a/services/core/jni/com_android_server_AlarmManagerService.cpp
+++ b/services/core/jni/com_android_server_AlarmManagerService.cpp
@@ -1,5 +1,4 @@
-/* //device/libs/android_runtime/android_server_AlarmManagerService.cpp
-**
+/*
 ** Copyright 2006, The Android Open Source Project
 **
 ** Licensed under the Apache License, Version 2.0 (the "License");
@@ -19,6 +18,8 @@
 
 #include <nativehelper/JNIHelp.h>
 #include "jni.h"
+#include <android-base/file.h>
+#include <android-base/unique_fd.h>
 #include <utils/Log.h>
 #include <utils/misc.h>
 #include <utils/String8.h>
@@ -40,6 +41,7 @@
 #include <linux/rtc.h>
 
 #include <array>
+#include <limits>
 #include <memory>
 
 namespace android {
@@ -74,8 +76,8 @@
 class AlarmImpl
 {
 public:
-    AlarmImpl(const TimerFds &fds, int epollfd, int rtc_id) :
-        fds{fds}, epollfd{epollfd}, rtc_id{rtc_id} { }
+    AlarmImpl(const TimerFds &fds, int epollfd, const std::string& rtc_dev) :
+        fds{fds}, epollfd{epollfd}, rtc_dev{rtc_dev} { }
     ~AlarmImpl();
 
     int set(int type, struct timespec *ts);
@@ -86,7 +88,7 @@
 private:
     const TimerFds fds;
     const int epollfd;
-    const int rtc_id;
+    std::string rtc_dev;
 };
 
 AlarmImpl::~AlarmImpl()
@@ -131,38 +133,24 @@
 
 int AlarmImpl::setTime(struct timeval *tv)
 {
-    struct rtc_time rtc;
-    struct tm tm, *gmtime_res;
-    int fd;
-    int res;
-
-    res = settimeofday(tv, NULL);
-    if (res < 0) {
-        ALOGV("settimeofday() failed: %s\n", strerror(errno));
+    if (settimeofday(tv, NULL) == -1) {
+        ALOGV("settimeofday() failed: %s", strerror(errno));
         return -1;
     }
 
-    if (rtc_id < 0) {
-        ALOGV("Not setting RTC because wall clock RTC was not found");
-        errno = ENODEV;
+    android::base::unique_fd fd{open(rtc_dev.c_str(), O_RDWR)};
+    if (!fd.ok()) {
+        ALOGE("Unable to open %s: %s", rtc_dev.c_str(), strerror(errno));
         return -1;
     }
 
-    android::String8 rtc_dev = String8::format("/dev/rtc%d", rtc_id);
-    fd = open(rtc_dev.string(), O_RDWR);
-    if (fd < 0) {
-        ALOGV("Unable to open %s: %s\n", rtc_dev.string(), strerror(errno));
-        return res;
+    struct tm tm;
+    if (!gmtime_r(&tv->tv_sec, &tm)) {
+        ALOGV("gmtime_r() failed: %s", strerror(errno));
+        return -1;
     }
 
-    gmtime_res = gmtime_r(&tv->tv_sec, &tm);
-    if (!gmtime_res) {
-        ALOGV("gmtime_r() failed: %s\n", strerror(errno));
-        res = -1;
-        goto done;
-    }
-
-    memset(&rtc, 0, sizeof(rtc));
+    struct rtc_time rtc = {};
     rtc.tm_sec = tm.tm_sec;
     rtc.tm_min = tm.tm_min;
     rtc.tm_hour = tm.tm_hour;
@@ -172,12 +160,12 @@
     rtc.tm_wday = tm.tm_wday;
     rtc.tm_yday = tm.tm_yday;
     rtc.tm_isdst = tm.tm_isdst;
-    res = ioctl(fd, RTC_SET_TIME, &rtc);
-    if (res < 0)
-        ALOGV("RTC_SET_TIME ioctl failed: %s\n", strerror(errno));
-done:
-    close(fd);
-    return res;
+    if (ioctl(fd, RTC_SET_TIME, &rtc) == -1) {
+        ALOGV("RTC_SET_TIME ioctl failed: %s", strerror(errno));
+        return -1;
+    }
+
+    return 0;
 }
 
 int AlarmImpl::waitForAlarm()
@@ -213,22 +201,20 @@
 static jint android_server_AlarmManagerService_setKernelTime(JNIEnv*, jobject, jlong nativeData, jlong millis)
 {
     AlarmImpl *impl = reinterpret_cast<AlarmImpl *>(nativeData);
-    struct timeval tv;
-    int ret;
 
-    if (millis <= 0 || millis / 1000LL >= INT_MAX) {
+    if (millis <= 0 || millis / 1000LL >= std::numeric_limits<time_t>::max()) {
         return -1;
     }
 
-    tv.tv_sec = (time_t) (millis / 1000LL);
-    tv.tv_usec = (suseconds_t) ((millis % 1000LL) * 1000LL);
+    struct timeval tv;
+    tv.tv_sec = (millis / 1000LL);
+    tv.tv_usec = ((millis % 1000LL) * 1000LL);
 
-    ALOGD("Setting time of day to sec=%d\n", (int) tv.tv_sec);
+    ALOGD("Setting time of day to sec=%ld", tv.tv_sec);
 
-    ret = impl->setTime(&tv);
-
-    if(ret < 0) {
-        ALOGW("Unable to set rtc to %ld: %s\n", tv.tv_sec, strerror(errno));
+    int ret = impl->setTime(&tv);
+    if (ret < 0) {
+        ALOGW("Unable to set rtc to %ld: %s", tv.tv_sec, strerror(errno));
         ret = -1;
     }
     return ret;
@@ -252,65 +238,6 @@
     return 0;
 }
 
-static const char rtc_sysfs[] = "/sys/class/rtc";
-
-static bool rtc_is_hctosys(unsigned int rtc_id)
-{
-    android::String8 hctosys_path = String8::format("%s/rtc%u/hctosys",
-            rtc_sysfs, rtc_id);
-    FILE *file = fopen(hctosys_path.string(), "re");
-    if (!file) {
-        ALOGE("failed to open %s: %s", hctosys_path.string(), strerror(errno));
-        return false;
-    }
-
-    unsigned int hctosys;
-    bool ret = false;
-    int err = fscanf(file, "%u", &hctosys);
-    if (err == EOF)
-        ALOGE("failed to read from %s: %s", hctosys_path.string(),
-                strerror(errno));
-    else if (err == 0)
-        ALOGE("%s did not have expected contents", hctosys_path.string());
-    else
-        ret = hctosys;
-
-    fclose(file);
-    return ret;
-}
-
-static int wall_clock_rtc()
-{
-    std::unique_ptr<DIR, int(*)(DIR*)> dir(opendir(rtc_sysfs), closedir);
-    if (!dir.get()) {
-        ALOGE("failed to open %s: %s", rtc_sysfs, strerror(errno));
-        return -1;
-    }
-
-    struct dirent *dirent;
-    while (errno = 0, dirent = readdir(dir.get())) {
-        unsigned int rtc_id;
-        int matched = sscanf(dirent->d_name, "rtc%u", &rtc_id);
-
-        if (matched < 0)
-            break;
-        else if (matched != 1)
-            continue;
-
-        if (rtc_is_hctosys(rtc_id)) {
-            ALOGV("found wall clock RTC %u", rtc_id);
-            return rtc_id;
-        }
-    }
-
-    if (errno == 0)
-        ALOGW("no wall clock RTC found");
-    else
-        ALOGE("failed to enumerate RTCs: %s", strerror(errno));
-
-    return -1;
-}
-
 static void log_timerfd_create_error(clockid_t id)
 {
     if (errno == EINVAL) {
@@ -344,8 +271,7 @@
 
     epollfd = epoll_create(fds.size());
     if (epollfd < 0) {
-        ALOGE("epoll_create(%zu) failed: %s", fds.size(),
-                strerror(errno));
+        ALOGE("epoll_create(%zu) failed: %s", fds.size(), strerror(errno));
         return 0;
     }
 
@@ -361,7 +287,19 @@
         }
     }
 
-    AlarmImpl *ret = new AlarmImpl(fds, epollfd, wall_clock_rtc());
+    // Find the wall clock RTC. We expect this always to be /dev/rtc0, but
+    // check the /dev/rtc symlink first so that legacy devices that don't use
+    // rtc0 can add a symlink rather than need to carry a local patch to this
+    // code.
+    //
+    // TODO: if you're reading this in a world where all devices are using the
+    // GKI, you can remove the readlink and just assume /dev/rtc0.
+    std::string dev_rtc;
+    if (!android::base::Readlink("/dev/rtc", &dev_rtc)) {
+        dev_rtc = "/dev/rtc0";
+    }
+
+    std::unique_ptr<AlarmImpl> alarm{new AlarmImpl(fds, epollfd, dev_rtc)};
 
     for (size_t i = 0; i < fds.size(); i++) {
         epoll_event event;
@@ -371,13 +309,11 @@
         int err = epoll_ctl(epollfd, EPOLL_CTL_ADD, fds[i], &event);
         if (err < 0) {
             ALOGE("epoll_ctl(EPOLL_CTL_ADD) failed: %s", strerror(errno));
-            delete ret;
             return 0;
         }
     }
 
-    struct itimerspec spec;
-    memset(&spec, 0, sizeof(spec));
+    struct itimerspec spec = {};
     /* 0 = disarmed; the timerfd doesn't need to be armed to get
        RTC change notifications, just set up as cancelable */
 
@@ -385,11 +321,10 @@
             TFD_TIMER_ABSTIME | TFD_TIMER_CANCEL_ON_SET, &spec, NULL);
     if (err < 0) {
         ALOGE("timerfd_settime() failed: %s", strerror(errno));
-        delete ret;
         return 0;
     }
 
-    return reinterpret_cast<jlong>(ret);
+    return reinterpret_cast<jlong>(alarm.release());
 }
 
 static jlong android_server_AlarmManagerService_getNextAlarm(JNIEnv*, jobject, jlong nativeData, jint type)
diff --git a/services/core/jni/com_android_server_SerialService.cpp b/services/core/jni/com_android_server_SerialService.cpp
index aef0b25..6600c98 100644
--- a/services/core/jni/com_android_server_SerialService.cpp
+++ b/services/core/jni/com_android_server_SerialService.cpp
@@ -18,7 +18,7 @@
 #include "utils/Log.h"
 
 #include "jni.h"
-#include <nativehelper/JNIHelp.h>
+#include <nativehelper/JNIPlatformHelp.h>
 #include "android_runtime/AndroidRuntime.h"
 
 #include <sys/types.h>
@@ -48,6 +48,7 @@
 
     jobject fileDescriptor = jniCreateFileDescriptor(env, fd);
     if (fileDescriptor == NULL) {
+        close(fd);
         return NULL;
     }
     return env->NewObject(gParcelFileDescriptorOffsets.mClass,
diff --git a/services/core/jni/com_android_server_UsbDeviceManager.cpp b/services/core/jni/com_android_server_UsbDeviceManager.cpp
index ff1ec04..3ab5920 100644
--- a/services/core/jni/com_android_server_UsbDeviceManager.cpp
+++ b/services/core/jni/com_android_server_UsbDeviceManager.cpp
@@ -18,7 +18,8 @@
 #include "utils/Log.h"
 
 #include "jni.h"
-#include <nativehelper/JNIHelp.h>
+#include <nativehelper/JNIPlatformHelp.h>
+#include <nativehelper/ScopedUtfChars.h>
 #include "android_runtime/AndroidRuntime.h"
 #include "android_runtime/Log.h"
 #include "MtpDescriptors.h"
@@ -88,6 +89,7 @@
     }
     jobject fileDescriptor = jniCreateFileDescriptor(env, fd);
     if (fileDescriptor == NULL) {
+        close(fd);
         return NULL;
     }
     return env->NewObject(gParcelFileDescriptorOffsets.mClass,
@@ -120,35 +122,30 @@
 }
 
 static jobject android_server_UsbDeviceManager_openControl(JNIEnv *env, jobject /* thiz */, jstring jFunction) {
-    const char *function = env->GetStringUTFChars(jFunction, NULL);
+    ScopedUtfChars function(env, jFunction);
     bool ptp = false;
     int fd = -1;
-    if (!strcmp(function, "ptp")) {
+    if (!strcmp(function.c_str(), "ptp")) {
         ptp = true;
     }
-    if (!strcmp(function, "mtp") || ptp) {
+    if (!strcmp(function.c_str(), "mtp") || ptp) {
         fd = TEMP_FAILURE_RETRY(open(ptp ? FFS_PTP_EP0 : FFS_MTP_EP0, O_RDWR));
         if (fd < 0) {
-            ALOGE("could not open control for %s %s", function, strerror(errno));
-            goto error;
+            ALOGE("could not open control for %s %s", function.c_str(), strerror(errno));
+            return NULL;
         }
         if (!writeDescriptors(fd, ptp)) {
-            goto error;
+            close(fd);
+            return NULL;
         }
     }
 
-    if (function != NULL) {
-        env->ReleaseStringUTFChars(jFunction, function);
-    }
-    return jniCreateFileDescriptor(env, fd);
-error:
-    if (fd != -1) {
+    jobject jifd = jniCreateFileDescriptor(env, fd);
+    if (jifd == NULL) {
+        // OutOfMemoryError will be pending.
         close(fd);
     }
-    if (function != NULL) {
-        env->ReleaseStringUTFChars(jFunction, function);
-    }
-    return NULL;
+    return jifd;
 }
 
 static const JNINativeMethod method_table[] = {
diff --git a/services/core/jni/com_android_server_UsbHostManager.cpp b/services/core/jni/com_android_server_UsbHostManager.cpp
index 24f2014..a629b69 100644
--- a/services/core/jni/com_android_server_UsbHostManager.cpp
+++ b/services/core/jni/com_android_server_UsbHostManager.cpp
@@ -18,7 +18,7 @@
 #include "utils/Log.h"
 
 #include "jni.h"
-#include <nativehelper/JNIHelp.h>
+#include <nativehelper/JNIPlatformHelp.h>
 #include "android_runtime/AndroidRuntime.h"
 #include "android_runtime/Log.h"
 
@@ -134,6 +134,7 @@
 
     jobject fileDescriptor = jniCreateFileDescriptor(env, newFD);
     if (fileDescriptor == NULL) {
+        close(newFD);
         return NULL;
     }
     return env->NewObject(gParcelFileDescriptorOffsets.mClass,
diff --git a/services/core/jni/com_android_server_UsbMidiDevice.cpp b/services/core/jni/com_android_server_UsbMidiDevice.cpp
index 79d935f..d6b5bed 100644
--- a/services/core/jni/com_android_server_UsbMidiDevice.cpp
+++ b/services/core/jni/com_android_server_UsbMidiDevice.cpp
@@ -19,7 +19,8 @@
 #include "utils/Log.h"
 
 #include "jni.h"
-#include <nativehelper/JNIHelp.h>
+#include <nativehelper/JNIPlatformHelp.h>
+#include <nativehelper/ScopedLocalRef.h>
 #include "android_runtime/AndroidRuntime.h"
 #include "android_runtime/Log.h"
 
@@ -99,24 +100,45 @@
         int fd = open(path, O_RDWR);
         if (fd < 0) {
             ALOGE("open failed on %s for index %d", path, i);
-            return NULL;
+            goto release_fds;
         }
-
-        jobject fileDescriptor = jniCreateFileDescriptor(env, fd);
-        env->SetObjectArrayElement(fds, i, fileDescriptor);
-        env->DeleteLocalRef(fileDescriptor);
+        ScopedLocalRef<jobject> jifd(env, jniCreateFileDescriptor(env, fd));
+        if (jifd.get() == NULL) {
+            goto release_fds;
+        }
+        env->SetObjectArrayElement(fds, i, jifd.get());
     }
 
     // create a pipe to use for unblocking our input thread
-    int pipeFD[2];
-    pipe(pipeFD);
-    jobject fileDescriptor = jniCreateFileDescriptor(env, pipeFD[0]);
-    env->SetObjectArrayElement(fds, subdevice_count, fileDescriptor);
-    env->DeleteLocalRef(fileDescriptor);
-    // store our end of the pipe in mPipeFD
-    env->SetIntField(thiz, sPipeFDField, pipeFD[1]);
+    {
+        int pipeFD[2];
+        if (pipe(pipeFD) == -1) {
+            ALOGE("pipe() failed, errno = %d", errno);
+            goto release_fds;
+        }
 
+        ScopedLocalRef<jobject> jifd(env, jniCreateFileDescriptor(env, pipeFD[0]));
+        if (jifd.get() == NULL) {
+            close(pipeFD[0]);
+            close(pipeFD[1]);
+            goto release_fds;
+        }
+        env->SetObjectArrayElement(fds, subdevice_count, jifd.get());
+        // store our end of the pipe in mPipeFD
+        env->SetIntField(thiz, sPipeFDField, pipeFD[1]);
+    }
     return fds;
+
+release_fds:
+    for (int i = 0; i < subdevice_count + 1; ++i) {
+        ScopedLocalRef<jobject> jifd(env, env->GetObjectArrayElement(fds, i));
+        if (jifd.get() == NULL) {
+            break;
+        }
+        int fd = jniGetFDFromFileDescriptor(env, jifd.get());
+        close(fd);
+    }
+    return NULL;
 }
 
 static void
diff --git a/services/core/jni/com_android_server_hdmi_HdmiCecController.cpp b/services/core/jni/com_android_server_hdmi_HdmiCecController.cpp
deleted file mode 100644
index b08d13f..0000000
--- a/services/core/jni/com_android_server_hdmi_HdmiCecController.cpp
+++ /dev/null
@@ -1,463 +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.
- */
-
-#define LOG_TAG "HdmiCecControllerJni"
-
-#define LOG_NDEBUG 1
-
-#include <nativehelper/JNIHelp.h>
-#include <nativehelper/ScopedPrimitiveArray.h>
-
-#include <android/hardware/tv/cec/1.0/IHdmiCec.h>
-#include <android/hardware/tv/cec/1.0/IHdmiCecCallback.h>
-#include <android/hardware/tv/cec/1.0/types.h>
-#include <android_os_MessageQueue.h>
-#include <android_runtime/AndroidRuntime.h>
-#include <android_runtime/Log.h>
-#include <sys/param.h>
-#include <utils/Errors.h>
-#include <utils/Looper.h>
-#include <utils/RefBase.h>
-
-using ::android::hardware::tv::cec::V1_0::CecLogicalAddress;
-using ::android::hardware::tv::cec::V1_0::CecMessage;
-using ::android::hardware::tv::cec::V1_0::HdmiPortInfo;
-using ::android::hardware::tv::cec::V1_0::HotplugEvent;
-using ::android::hardware::tv::cec::V1_0::IHdmiCec;
-using ::android::hardware::tv::cec::V1_0::IHdmiCecCallback;
-using ::android::hardware::tv::cec::V1_0::MaxLength;
-using ::android::hardware::tv::cec::V1_0::OptionKey;
-using ::android::hardware::tv::cec::V1_0::Result;
-using ::android::hardware::tv::cec::V1_0::SendMessageResult;
-using ::android::hardware::Return;
-using ::android::hardware::Void;
-using ::android::hardware::hidl_vec;
-using ::android::hardware::hidl_string;
-
-namespace android {
-
-static struct {
-    jmethodID handleIncomingCecCommand;
-    jmethodID handleHotplug;
-} gHdmiCecControllerClassInfo;
-
-class HdmiCecController {
-public:
-    HdmiCecController(sp<IHdmiCec> hdmiCec, jobject callbacksObj, const sp<Looper>& looper);
-    ~HdmiCecController();
-
-    // Send message to other device. Note that it runs in IO thread.
-    int sendMessage(const CecMessage& message);
-    // Add a logical address to device.
-    int addLogicalAddress(CecLogicalAddress address);
-    // Clear all logical address registered to the device.
-    void clearLogicaladdress();
-    // Get physical address of device.
-    int getPhysicalAddress();
-    // Get CEC version from driver.
-    int getVersion();
-    // Get vendor id used for vendor command.
-    uint32_t getVendorId();
-    // Get Port information on all the HDMI ports.
-    jobjectArray getPortInfos();
-    // Set an option to CEC HAL.
-    void setOption(OptionKey key, bool enabled);
-    // Informs CEC HAL about the current system language.
-    void setLanguage(hidl_string language);
-    // Enable audio return channel.
-    void enableAudioReturnChannel(int port, bool flag);
-    // Whether to hdmi device is connected to the given port.
-    bool isConnected(int port);
-
-    jobject getCallbacksObj() const {
-        return mCallbacksObj;
-    }
-
-private:
-    class HdmiCecCallback : public IHdmiCecCallback {
-    public:
-        explicit HdmiCecCallback(HdmiCecController* controller) : mController(controller) {};
-        Return<void> onCecMessage(const CecMessage& event)  override;
-        Return<void> onHotplugEvent(const HotplugEvent& event)  override;
-    private:
-        HdmiCecController* mController;
-    };
-
-    static const int INVALID_PHYSICAL_ADDRESS = 0xFFFF;
-
-    sp<IHdmiCec> mHdmiCec;
-    jobject mCallbacksObj;
-    sp<IHdmiCecCallback> mHdmiCecCallback;
-    sp<Looper> mLooper;
-};
-
-// Handler class to delegate incoming message to service thread.
-class HdmiCecEventHandler : public MessageHandler {
-public:
-    enum EventType {
-        CEC_MESSAGE,
-        HOT_PLUG
-    };
-
-    HdmiCecEventHandler(HdmiCecController* controller, const CecMessage& cecMessage)
-            : mController(controller),
-              mCecMessage(cecMessage) {}
-
-    HdmiCecEventHandler(HdmiCecController* controller, const HotplugEvent& hotplugEvent)
-            : mController(controller),
-              mHotplugEvent(hotplugEvent) {}
-
-    virtual ~HdmiCecEventHandler() {}
-
-    void handleMessage(const Message& message) {
-        switch (message.what) {
-        case EventType::CEC_MESSAGE:
-            propagateCecCommand(mCecMessage);
-            break;
-        case EventType::HOT_PLUG:
-            propagateHotplugEvent(mHotplugEvent);
-            break;
-        default:
-            // TODO: add more type whenever new type is introduced.
-            break;
-        }
-    }
-
-private:
-    // Propagate the message up to Java layer.
-    void propagateCecCommand(const CecMessage& message) {
-        JNIEnv* env = AndroidRuntime::getJNIEnv();
-        jint srcAddr = static_cast<jint>(message.initiator);
-        jint dstAddr = static_cast<jint>(message.destination);
-        jbyteArray body = env->NewByteArray(message.body.size());
-        const jbyte* bodyPtr = reinterpret_cast<const jbyte *>(message.body.data());
-        env->SetByteArrayRegion(body, 0, message.body.size(), bodyPtr);
-        env->CallVoidMethod(mController->getCallbacksObj(),
-                gHdmiCecControllerClassInfo.handleIncomingCecCommand, srcAddr,
-                dstAddr, body);
-        env->DeleteLocalRef(body);
-
-        checkAndClearExceptionFromCallback(env, __FUNCTION__);
-    }
-
-    void propagateHotplugEvent(const HotplugEvent& event) {
-        // Note that this method should be called in service thread.
-        JNIEnv* env = AndroidRuntime::getJNIEnv();
-        jint port = static_cast<jint>(event.portId);
-        jboolean connected = (jboolean) event.connected;
-        env->CallVoidMethod(mController->getCallbacksObj(),
-                gHdmiCecControllerClassInfo.handleHotplug, port, connected);
-
-        checkAndClearExceptionFromCallback(env, __FUNCTION__);
-    }
-
-    // static
-    static void checkAndClearExceptionFromCallback(JNIEnv* env, const char* methodName) {
-        if (env->ExceptionCheck()) {
-            ALOGE("An exception was thrown by callback '%s'.", methodName);
-            LOGE_EX(env);
-            env->ExceptionClear();
-        }
-    }
-
-    HdmiCecController* mController;
-    CecMessage mCecMessage;
-    HotplugEvent mHotplugEvent;
-};
-
-HdmiCecController::HdmiCecController(sp<IHdmiCec> hdmiCec,
-        jobject callbacksObj, const sp<Looper>& looper)
-        : mHdmiCec(hdmiCec),
-          mCallbacksObj(callbacksObj),
-          mLooper(looper) {
-    mHdmiCecCallback = new HdmiCecCallback(this);
-    Return<void> ret = mHdmiCec->setCallback(mHdmiCecCallback);
-    if (!ret.isOk()) {
-        ALOGE("Failed to set a cec callback.");
-    }
-}
-
-HdmiCecController::~HdmiCecController() {
-    Return<void> ret = mHdmiCec->setCallback(nullptr);
-    if (!ret.isOk()) {
-        ALOGE("Failed to set a cec callback.");
-    }
-}
-
-int HdmiCecController::sendMessage(const CecMessage& message) {
-    // TODO: propagate send_message's return value.
-    Return<SendMessageResult> ret = mHdmiCec->sendMessage(message);
-    if (!ret.isOk()) {
-        ALOGE("Failed to send CEC message.");
-        return static_cast<int>(SendMessageResult::FAIL);
-    }
-    return static_cast<int>((SendMessageResult) ret);
-}
-
-int HdmiCecController::addLogicalAddress(CecLogicalAddress address) {
-    Return<Result> ret = mHdmiCec->addLogicalAddress(address);
-    if (!ret.isOk()) {
-        ALOGE("Failed to add a logical address.");
-        return static_cast<int>(Result::FAILURE_UNKNOWN);
-    }
-    return static_cast<int>((Result) ret);
-}
-
-void HdmiCecController::clearLogicaladdress() {
-    Return<void> ret = mHdmiCec->clearLogicalAddress();
-    if (!ret.isOk()) {
-        ALOGE("Failed to clear logical address.");
-    }
-}
-
-int HdmiCecController::getPhysicalAddress() {
-    Result result;
-    uint16_t addr;
-    Return<void> ret = mHdmiCec->getPhysicalAddress([&result, &addr](Result res, uint16_t paddr) {
-            result = res;
-            addr = paddr;
-        });
-    if (!ret.isOk()) {
-        ALOGE("Failed to get physical address.");
-        return INVALID_PHYSICAL_ADDRESS;
-    }
-    return result == Result::SUCCESS ? addr : INVALID_PHYSICAL_ADDRESS;
-}
-
-int HdmiCecController::getVersion() {
-    Return<int32_t> ret = mHdmiCec->getCecVersion();
-    if (!ret.isOk()) {
-        ALOGE("Failed to get cec version.");
-    }
-    return ret;
-}
-
-uint32_t HdmiCecController::getVendorId() {
-    Return<uint32_t> ret = mHdmiCec->getVendorId();
-    if (!ret.isOk()) {
-        ALOGE("Failed to get vendor id.");
-    }
-    return ret;
-}
-
-jobjectArray HdmiCecController::getPortInfos() {
-    JNIEnv* env = AndroidRuntime::getJNIEnv();
-    jclass hdmiPortInfo = env->FindClass("android/hardware/hdmi/HdmiPortInfo");
-    if (hdmiPortInfo == NULL) {
-        return NULL;
-    }
-    jmethodID ctor = env->GetMethodID(hdmiPortInfo, "<init>", "(IIIZZZ)V");
-    if (ctor == NULL) {
-        return NULL;
-    }
-    hidl_vec<HdmiPortInfo> ports;
-    Return<void> ret = mHdmiCec->getPortInfo([&ports](hidl_vec<HdmiPortInfo> list) {
-            ports = list;
-        });
-    if (!ret.isOk()) {
-        ALOGE("Failed to get port information.");
-        return NULL;
-    }
-    jobjectArray res = env->NewObjectArray(ports.size(), hdmiPortInfo, NULL);
-
-    // MHL support field will be obtained from MHL HAL. Leave it to false.
-    jboolean mhlSupported = (jboolean) 0;
-    for (size_t i = 0; i < ports.size(); ++i) {
-        jboolean cecSupported = (jboolean) ports[i].cecSupported;
-        jboolean arcSupported = (jboolean) ports[i].arcSupported;
-        jobject infoObj = env->NewObject(hdmiPortInfo, ctor, ports[i].portId, ports[i].type,
-                ports[i].physicalAddress, cecSupported, mhlSupported, arcSupported);
-        env->SetObjectArrayElement(res, i, infoObj);
-    }
-    return res;
-}
-
-void HdmiCecController::setOption(OptionKey key, bool enabled) {
-    Return<void> ret = mHdmiCec->setOption(key, enabled);
-    if (!ret.isOk()) {
-        ALOGE("Failed to set option.");
-    }
-}
-
-void HdmiCecController::setLanguage(hidl_string language) {
-    Return<void> ret = mHdmiCec->setLanguage(language);
-    if (!ret.isOk()) {
-        ALOGE("Failed to set language.");
-    }
-}
-
-// Enable audio return channel.
-void HdmiCecController::enableAudioReturnChannel(int port, bool enabled) {
-    Return<void> ret = mHdmiCec->enableAudioReturnChannel(port, enabled);
-    if (!ret.isOk()) {
-        ALOGE("Failed to enable/disable ARC.");
-    }
-}
-
-// Whether to hdmi device is connected to the given port.
-bool HdmiCecController::isConnected(int port) {
-    Return<bool> ret = mHdmiCec->isConnected(port);
-    if (!ret.isOk()) {
-        ALOGE("Failed to get connection info.");
-    }
-    return ret;
-}
-
-Return<void> HdmiCecController::HdmiCecCallback::onCecMessage(const CecMessage& message) {
-    sp<HdmiCecEventHandler> handler(new HdmiCecEventHandler(mController, message));
-    mController->mLooper->sendMessage(handler, HdmiCecEventHandler::EventType::CEC_MESSAGE);
-    return Void();
-}
-
-Return<void> HdmiCecController::HdmiCecCallback::onHotplugEvent(const HotplugEvent& event) {
-    sp<HdmiCecEventHandler> handler(new HdmiCecEventHandler(mController, event));
-    mController->mLooper->sendMessage(handler, HdmiCecEventHandler::EventType::HOT_PLUG);
-    return Void();
-}
-
-//------------------------------------------------------------------------------
-#define GET_METHOD_ID(var, clazz, methodName, methodDescriptor) \
-        var = env->GetMethodID(clazz, methodName, methodDescriptor); \
-        LOG_FATAL_IF(! (var), "Unable to find method " methodName);
-
-static jlong nativeInit(JNIEnv* env, jclass clazz, jobject callbacksObj,
-        jobject messageQueueObj) {
-    // TODO(b/31632518)
-    sp<IHdmiCec> hdmiCec = IHdmiCec::getService();
-    if (hdmiCec == nullptr) {
-        ALOGE("Couldn't get tv.cec service.");
-        return 0;
-    }
-    sp<MessageQueue> messageQueue =
-            android_os_MessageQueue_getMessageQueue(env, messageQueueObj);
-
-    HdmiCecController* controller = new HdmiCecController(
-            hdmiCec,
-            env->NewGlobalRef(callbacksObj),
-            messageQueue->getLooper());
-
-    GET_METHOD_ID(gHdmiCecControllerClassInfo.handleIncomingCecCommand, clazz,
-            "handleIncomingCecCommand", "(II[B)V");
-    GET_METHOD_ID(gHdmiCecControllerClassInfo.handleHotplug, clazz,
-            "handleHotplug", "(IZ)V");
-
-    return reinterpret_cast<jlong>(controller);
-}
-
-static jint nativeSendCecCommand(JNIEnv* env, jclass clazz, jlong controllerPtr,
-        jint srcAddr, jint dstAddr, jbyteArray body) {
-    CecMessage message;
-    message.initiator = static_cast<CecLogicalAddress>(srcAddr);
-    message.destination = static_cast<CecLogicalAddress>(dstAddr);
-
-    jsize len = env->GetArrayLength(body);
-    ScopedByteArrayRO bodyPtr(env, body);
-    size_t bodyLength = MIN(static_cast<size_t>(len),
-            static_cast<size_t>(MaxLength::MESSAGE_BODY));
-    message.body.resize(bodyLength);
-    for (size_t i = 0; i < bodyLength; ++i) {
-        message.body[i] = static_cast<uint8_t>(bodyPtr[i]);
-    }
-
-    HdmiCecController* controller =
-            reinterpret_cast<HdmiCecController*>(controllerPtr);
-    return controller->sendMessage(message);
-}
-
-static jint nativeAddLogicalAddress(JNIEnv* env, jclass clazz, jlong controllerPtr,
-        jint logicalAddress) {
-    HdmiCecController* controller = reinterpret_cast<HdmiCecController*>(controllerPtr);
-    return controller->addLogicalAddress(static_cast<CecLogicalAddress>(logicalAddress));
-}
-
-static void nativeClearLogicalAddress(JNIEnv* env, jclass clazz, jlong controllerPtr) {
-    HdmiCecController* controller = reinterpret_cast<HdmiCecController*>(controllerPtr);
-    controller->clearLogicaladdress();
-}
-
-static jint nativeGetPhysicalAddress(JNIEnv* env, jclass clazz, jlong controllerPtr) {
-    HdmiCecController* controller = reinterpret_cast<HdmiCecController*>(controllerPtr);
-    return controller->getPhysicalAddress();
-}
-
-static jint nativeGetVersion(JNIEnv* env, jclass clazz, jlong controllerPtr) {
-    HdmiCecController* controller = reinterpret_cast<HdmiCecController*>(controllerPtr);
-    return controller->getVersion();
-}
-
-static jint nativeGetVendorId(JNIEnv* env, jclass clazz, jlong controllerPtr) {
-    HdmiCecController* controller = reinterpret_cast<HdmiCecController*>(controllerPtr);
-    return controller->getVendorId();
-}
-
-static jobjectArray nativeGetPortInfos(JNIEnv* env, jclass clazz, jlong controllerPtr) {
-    HdmiCecController* controller = reinterpret_cast<HdmiCecController*>(controllerPtr);
-    return controller->getPortInfos();
-}
-
-static void nativeSetOption(JNIEnv* env, jclass clazz, jlong controllerPtr, jint flag, jint value) {
-    HdmiCecController* controller = reinterpret_cast<HdmiCecController*>(controllerPtr);
-    controller->setOption(static_cast<OptionKey>(flag), value > 0 ? true : false);
-}
-
-static void nativeSetLanguage(JNIEnv* env, jclass clazz, jlong controllerPtr, jstring language) {
-    HdmiCecController* controller = reinterpret_cast<HdmiCecController*>(controllerPtr);
-    const char *languageStr = env->GetStringUTFChars(language, NULL);
-    controller->setLanguage(languageStr);
-    env->ReleaseStringUTFChars(language, languageStr);
-}
-
-static void nativeEnableAudioReturnChannel(JNIEnv* env, jclass clazz, jlong controllerPtr,
-        jint port, jboolean enabled) {
-    HdmiCecController* controller = reinterpret_cast<HdmiCecController*>(controllerPtr);
-    controller->enableAudioReturnChannel(port, enabled == JNI_TRUE);
-}
-
-static jboolean nativeIsConnected(JNIEnv* env, jclass clazz, jlong controllerPtr, jint port) {
-    HdmiCecController* controller = reinterpret_cast<HdmiCecController*>(controllerPtr);
-    return controller->isConnected(port) ? JNI_TRUE : JNI_FALSE ;
-}
-
-static const JNINativeMethod sMethods[] = {
-    /* name, signature, funcPtr */
-    { "nativeInit",
-      "(Lcom/android/server/hdmi/HdmiCecController;Landroid/os/MessageQueue;)J",
-      (void *) nativeInit },
-    { "nativeSendCecCommand", "(JII[B)I", (void *) nativeSendCecCommand },
-    { "nativeAddLogicalAddress", "(JI)I", (void *) nativeAddLogicalAddress },
-    { "nativeClearLogicalAddress", "(J)V", (void *) nativeClearLogicalAddress },
-    { "nativeGetPhysicalAddress", "(J)I", (void *) nativeGetPhysicalAddress },
-    { "nativeGetVersion", "(J)I", (void *) nativeGetVersion },
-    { "nativeGetVendorId", "(J)I", (void *) nativeGetVendorId },
-    { "nativeGetPortInfos",
-      "(J)[Landroid/hardware/hdmi/HdmiPortInfo;",
-      (void *) nativeGetPortInfos },
-    { "nativeSetOption", "(JIZ)V", (void *) nativeSetOption },
-    { "nativeSetLanguage", "(JLjava/lang/String;)V", (void *) nativeSetLanguage },
-    { "nativeEnableAudioReturnChannel", "(JIZ)V", (void *) nativeEnableAudioReturnChannel },
-    { "nativeIsConnected", "(JI)Z", (void *) nativeIsConnected },
-};
-
-#define CLASS_PATH "com/android/server/hdmi/HdmiCecController"
-
-int register_android_server_hdmi_HdmiCecController(JNIEnv* env) {
-    int res = jniRegisterNativeMethods(env, CLASS_PATH, sMethods, NELEM(sMethods));
-    LOG_FATAL_IF(res < 0, "Unable to register native methods.");
-    (void)res; // Don't scream about unused variable in the LOG_NDEBUG case
-    return 0;
-}
-
-}  /* namespace android */
diff --git a/services/core/jni/onload.cpp b/services/core/jni/onload.cpp
index e5d2a83..8cb3e6d 100644
--- a/services/core/jni/onload.cpp
+++ b/services/core/jni/onload.cpp
@@ -43,7 +43,6 @@
 int register_android_server_connectivity_Vpn(JNIEnv* env);
 int register_android_server_TestNetworkService(JNIEnv* env);
 int register_android_server_devicepolicy_CryptoTestHelper(JNIEnv*);
-int register_android_server_hdmi_HdmiCecController(JNIEnv* env);
 int register_android_server_tv_TvUinputBridge(JNIEnv* env);
 int register_android_server_tv_TvInputHal(JNIEnv* env);
 int register_android_server_PersistentDataBlockService(JNIEnv* env);
@@ -99,7 +98,6 @@
     register_android_server_devicepolicy_CryptoTestHelper(env);
     register_android_server_ConsumerIrService(env);
     register_android_server_BatteryStatsService(env);
-    register_android_server_hdmi_HdmiCecController(env);
     register_android_server_tv_TvUinputBridge(env);
     register_android_server_tv_TvInputHal(env);
     register_android_server_PersistentDataBlockService(env);
diff --git a/services/incremental/Android.bp b/services/incremental/Android.bp
index de639c5..7534c7c 100644
--- a/services/incremental/Android.bp
+++ b/services/incremental/Android.bp
@@ -39,6 +39,7 @@
 cc_defaults {
     name: "service.incremental-defaults",
     defaults: ["service.incremental-proto-defaults"],
+    header_libs: ["jni_headers"],
     local_include_dirs: ["include/"],
     cflags: [
         "-Wall",
@@ -53,7 +54,6 @@
         "libdataloader_aidl-cpp",
         "libincremental_aidl-cpp",
         "libincremental_manager_aidl-cpp",
-        "libnativehelper",
         "libprotobuf-cpp-lite",
         "service.incremental.proto",
         "libutils",
diff --git a/services/incremental/BinderIncrementalService.cpp b/services/incremental/BinderIncrementalService.cpp
index 7132706..0ae10b6 100644
--- a/services/incremental/BinderIncrementalService.cpp
+++ b/services/incremental/BinderIncrementalService.cpp
@@ -25,7 +25,6 @@
 
 #include "ServiceWrappers.h"
 #include "jni.h"
-#include "nativehelper/JNIHelp.h"
 #include "path.h"
 
 using namespace std::literals;
diff --git a/services/java/com/android/server/SystemServer.java b/services/java/com/android/server/SystemServer.java
index 2a200fb..7a1b074 100644
--- a/services/java/com/android/server/SystemServer.java
+++ b/services/java/com/android/server/SystemServer.java
@@ -80,6 +80,7 @@
 import android.util.Slog;
 import android.view.contentcapture.ContentCaptureManager;
 
+import com.android.i18n.timezone.ZoneInfoDb;
 import com.android.internal.R;
 import com.android.internal.notification.SystemNotificationChannels;
 import com.android.internal.os.BinderInternal;
@@ -199,12 +200,6 @@
     private static final String ENCRYPTING_STATE = "trigger_restart_min_framework";
     private static final String ENCRYPTED_STATE = "1";
 
-    private static final long SNAPSHOT_INTERVAL = 60 * 60 * 1000; // 1hr
-
-    // The earliest supported time.  We pick one day into 1970, to
-    // give any timezone code room without going into negative time.
-    private static final long EARLIEST_SUPPORTED_TIME = 86400 * 1000;
-
     private static final long SLOW_DISPATCH_THRESHOLD_MS = 100;
     private static final long SLOW_DELIVERY_THRESHOLD_MS = 200;
 
@@ -444,8 +439,9 @@
             // Default the timezone property to GMT if not set.
             //
             String timezoneProperty = SystemProperties.get("persist.sys.timezone");
-            if (timezoneProperty == null || timezoneProperty.isEmpty()) {
-                Slog.w(TAG, "Timezone not set; setting to GMT.");
+            if (!isValidTimeZoneId(timezoneProperty)) {
+                Slog.w(TAG, "persist.sys.timezone is not valid (" + timezoneProperty
+                        + "); setting to GMT.");
                 SystemProperties.set("persist.sys.timezone", "GMT");
             }
 
@@ -623,6 +619,12 @@
         throw new RuntimeException("Main thread loop unexpectedly exited");
     }
 
+    private static boolean isValidTimeZoneId(String timezoneProperty) {
+        return timezoneProperty != null
+                && !timezoneProperty.isEmpty()
+                && ZoneInfoDb.getInstance().hasTimeZone(timezoneProperty);
+    }
+
     private boolean isFirstBootOrUpgrade() {
         return mPackageManagerService.isFirstBoot() || mPackageManagerService.isDeviceUpgrading();
     }
diff --git a/services/tests/servicestests/src/com/android/server/StorageManagerServiceTest.java b/services/tests/servicestests/src/com/android/server/StorageManagerServiceTest.java
deleted file mode 100644
index d192748..0000000
--- a/services/tests/servicestests/src/com/android/server/StorageManagerServiceTest.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright (C) 2018 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 com.android.server;
-
-import static org.mockito.Mockito.when;
-
-import android.content.Context;
-import android.content.pm.PackageManager;
-import android.content.pm.PackageManagerInternal;
-import android.os.storage.StorageManagerInternal;
-
-import androidx.test.filters.SmallTest;
-import androidx.test.runner.AndroidJUnit4;
-
-import org.junit.Before;
-import org.junit.runner.RunWith;
-import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
-
-@SmallTest
-@RunWith(AndroidJUnit4.class)
-public class StorageManagerServiceTest {
-
-    private StorageManagerService mService;
-
-    @Mock private Context mContext;
-    @Mock private PackageManager mPm;
-    @Mock private PackageManagerInternal mPmi;
-
-    @Before
-    public void setUp() throws Exception {
-        MockitoAnnotations.initMocks(this);
-
-        LocalServices.removeServiceForTest(StorageManagerInternal.class);
-
-        LocalServices.removeServiceForTest(PackageManagerInternal.class);
-        LocalServices.addService(PackageManagerInternal.class, mPmi);
-
-        when(mContext.getPackageManager()).thenReturn(mPm);
-
-        mService = new StorageManagerService(mContext);
-    }
-}
diff --git a/services/tests/servicestests/src/com/android/server/hdmi/HdmiCecLocalDeviceAudioSystemTest.java b/services/tests/servicestests/src/com/android/server/hdmi/HdmiCecLocalDeviceAudioSystemTest.java
index 28887fd..dd98c4b 100644
--- a/services/tests/servicestests/src/com/android/server/hdmi/HdmiCecLocalDeviceAudioSystemTest.java
+++ b/services/tests/servicestests/src/com/android/server/hdmi/HdmiCecLocalDeviceAudioSystemTest.java
@@ -75,7 +75,6 @@
     private static final int HDMI_3_PHYSICAL_ADDRESS = 0x2300;
     private int mInvokeDeviceEventState;
     private HdmiDeviceInfo mDeviceInfo;
-    private boolean mMutingEnabled;
     private boolean mArcSupport;
     private HdmiPortInfo[] mHdmiPortInfo;
     private boolean mWokenUp;
@@ -159,8 +158,6 @@
                 @Override
                 boolean readBooleanSystemProperty(String key, boolean defVal) {
                     switch (key) {
-                        case Constants.PROPERTY_SYSTEM_AUDIO_MODE_MUTING_ENABLE:
-                            return mMutingEnabled;
                         case Constants.PROPERTY_ARC_SUPPORT:
                             return mArcSupport;
                         default:
@@ -216,7 +213,6 @@
         mHdmiControlService.allocateLogicalAddress(mLocalDevices, INITIATED_BY_ENABLE_CEC);
         mTestLooper.dispatchAll();
         mNativeWrapper.clearResultMessages();
-        mMutingEnabled = true;
         mArcSupport = true;
         mInvokeDeviceEventState = 0;
         mDeviceInfo = null;
diff --git a/services/tests/servicestests/src/com/android/server/pm/parsing/AndroidPackageInfoFlagBehaviorTest.kt b/services/tests/servicestests/src/com/android/server/pm/parsing/AndroidPackageInfoFlagBehaviorTest.kt
index 0a32e4a..946f27e 100644
--- a/services/tests/servicestests/src/com/android/server/pm/parsing/AndroidPackageInfoFlagBehaviorTest.kt
+++ b/services/tests/servicestests/src/com/android/server/pm/parsing/AndroidPackageInfoFlagBehaviorTest.kt
@@ -26,6 +26,7 @@
 import com.android.server.pm.parsing.pkg.AndroidPackage
 import com.google.common.truth.Truth.assertThat
 import com.google.common.truth.Truth.assertWithMessage
+import org.junit.Ignore
 import org.junit.Test
 import org.junit.runner.RunWith
 import org.junit.runners.Parameterized
@@ -102,6 +103,7 @@
     lateinit var param: Param<Any>
 
     @Test
+    @Ignore("b/155935153")
     fun fieldPresence() {
         oldPackages.asSequence().zip(newPackages.asSequence())
                 .forEach { (old, new) ->
@@ -124,6 +126,7 @@
     }
 
     @Test
+    @Ignore("b/155935153")
     fun fieldAbsence() {
         newPackages.forEach {
             val newWithoutFlag = param.newPkgFunction(it, 0)
diff --git a/services/tests/servicestests/src/com/android/server/pm/parsing/AndroidPackageParsingEquivalenceTest.kt b/services/tests/servicestests/src/com/android/server/pm/parsing/AndroidPackageParsingEquivalenceTest.kt
index 74b4d12..9f9ec31 100644
--- a/services/tests/servicestests/src/com/android/server/pm/parsing/AndroidPackageParsingEquivalenceTest.kt
+++ b/services/tests/servicestests/src/com/android/server/pm/parsing/AndroidPackageParsingEquivalenceTest.kt
@@ -20,6 +20,7 @@
 import android.platform.test.annotations.Presubmit
 import androidx.test.filters.LargeTest
 import com.google.common.truth.Expect
+
 import org.junit.Rule
 import org.junit.Test
 
diff --git a/services/tests/servicestests/src/com/android/server/timezone/RulesManagerServiceTest.java b/services/tests/servicestests/src/com/android/server/timezone/RulesManagerServiceTest.java
index 5c6fe0f..2c4c4d0 100644
--- a/services/tests/servicestests/src/com/android/server/timezone/RulesManagerServiceTest.java
+++ b/services/tests/servicestests/src/com/android/server/timezone/RulesManagerServiceTest.java
@@ -43,13 +43,13 @@
 import android.app.timezone.RulesState;
 import android.os.ParcelFileDescriptor;
 
+import com.android.i18n.timezone.TzDataSetVersion;
 import com.android.timezone.distro.DistroVersion;
 import com.android.timezone.distro.StagedDistroOperation;
 import com.android.timezone.distro.TimeZoneDistro;
 import com.android.timezone.distro.installer.TimeZoneDistroInstaller;
 
 import libcore.io.IoUtils;
-import libcore.timezone.TzDataSetVersion;
 
 import org.junit.Before;
 import org.junit.Test;
diff --git a/services/tests/uiservicestests/src/com/android/server/UiModeManagerServiceTest.java b/services/tests/uiservicestests/src/com/android/server/UiModeManagerServiceTest.java
index b100c84..1d75967 100644
--- a/services/tests/uiservicestests/src/com/android/server/UiModeManagerServiceTest.java
+++ b/services/tests/uiservicestests/src/com/android/server/UiModeManagerServiceTest.java
@@ -39,6 +39,7 @@
 import com.android.server.twilight.TwilightState;
 import com.android.server.wm.WindowManagerInternal;
 import org.junit.Before;
+import org.junit.Ignore;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.mockito.Mock;
@@ -165,6 +166,7 @@
         LocalServices.addService(clazz, service);
     }
 
+    @Ignore // b/152719290 - Fails on stage-aosp-master
     @Test
     public void setNightMoveActivated_overridesFunctionCorrectly() throws RemoteException {
         // set up
@@ -205,6 +207,7 @@
         verify(mContext, atLeastOnce()).registerReceiver(any(BroadcastReceiver.class), any());
     }
 
+    @Ignore // b/152719290 - Fails on stage-aosp-master
     @Test
     public void setAutoMode_screenOffUnRegistered() throws RemoteException {
         try {
diff --git a/services/tests/uiservicestests/src/com/android/server/notification/BuzzBeepBlinkTest.java b/services/tests/uiservicestests/src/com/android/server/notification/BuzzBeepBlinkTest.java
index afd10dd..abcc14c 100644
--- a/services/tests/uiservicestests/src/com/android/server/notification/BuzzBeepBlinkTest.java
+++ b/services/tests/uiservicestests/src/com/android/server/notification/BuzzBeepBlinkTest.java
@@ -1346,6 +1346,22 @@
     }
 
     @Test
+    public void testLightsCheckCurrentUser() {
+        final Notification n = new Builder(getContext(), "test")
+                .setSmallIcon(android.R.drawable.sym_def_app_icon).build();
+        int userId = mUser.getIdentifier() + 10;
+        StatusBarNotification sbn = new StatusBarNotification(mPkg, mPkg, 0, mTag, mUid,
+                mPid, n, UserHandle.of(userId), null, System.currentTimeMillis());
+        NotificationRecord r = new NotificationRecord(getContext(), sbn,
+                new NotificationChannel("test", "test", IMPORTANCE_HIGH));
+
+        mService.buzzBeepBlinkLocked(r);
+        verifyNeverLights();
+        assertFalse(r.isInterruptive());
+        assertEquals(-1, r.getLastAudiblyAlertedMs());
+    }
+
+    @Test
     public void testListenerHintCall() throws Exception {
         NotificationChannel ringtoneChannel =
                 new NotificationChannel("ringtone", "", IMPORTANCE_HIGH);
diff --git a/services/tests/uiservicestests/src/com/android/server/notification/PreferencesHelperTest.java b/services/tests/uiservicestests/src/com/android/server/notification/PreferencesHelperTest.java
index 5b0a7fb..e10dfee 100644
--- a/services/tests/uiservicestests/src/com/android/server/notification/PreferencesHelperTest.java
+++ b/services/tests/uiservicestests/src/com/android/server/notification/PreferencesHelperTest.java
@@ -56,6 +56,7 @@
 import static org.mockito.ArgumentMatchers.anyInt;
 import static org.mockito.ArgumentMatchers.anyString;
 import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.Mockito.doAnswer;
 import static org.mockito.Mockito.doReturn;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.never;
@@ -70,6 +71,7 @@
 import android.app.NotificationChannelGroup;
 import android.app.NotificationManager;
 import android.content.ContentProvider;
+import android.content.ContentResolver;
 import android.content.Context;
 import android.content.IContentProvider;
 import android.content.pm.ApplicationInfo;
@@ -80,13 +82,16 @@
 import android.graphics.Color;
 import android.media.AudioAttributes;
 import android.net.Uri;
+import android.os.AsyncTask;
 import android.os.Build;
+import android.os.Bundle;
+import android.os.RemoteCallback;
+import android.os.RemoteException;
 import android.os.UserHandle;
 import android.provider.Settings;
 import android.provider.Settings.Global;
 import android.provider.Settings.Secure;
 import android.service.notification.ConversationChannelWrapper;
-import android.test.mock.MockIContentProvider;
 import android.test.suitebuilder.annotation.SmallTest;
 import android.testing.TestableContentResolver;
 import android.util.ArrayMap;
@@ -108,7 +113,6 @@
 import org.junit.runner.RunWith;
 import org.mockito.Mock;
 import org.mockito.MockitoAnnotations;
-import org.mockito.Spy;
 import org.xmlpull.v1.XmlPullParser;
 import org.xmlpull.v1.XmlSerializer;
 
@@ -146,7 +150,7 @@
     @Mock NotificationUsageStats mUsageStats;
     @Mock RankingHandler mHandler;
     @Mock PackageManager mPm;
-    @Spy IContentProvider mTestIContentProvider = new MockIContentProvider();
+    IContentProvider mTestIContentProvider;
     @Mock Context mContext;
     @Mock ZenModeHelper mMockZenModeHelper;
     @Mock AppOpsManager mAppOpsManager;
@@ -193,6 +197,39 @@
         Global.putInt(contentResolver, Global.NOTIFICATION_BUBBLES, 1);
 
         ContentProvider testContentProvider = mock(ContentProvider.class);
+        mTestIContentProvider = mock(IContentProvider.class, invocation -> {
+            throw new UnsupportedOperationException("unimplemented mock method");
+        });
+        doAnswer(invocation -> {
+            String callingPkg = invocation.getArgument(0);
+            String featureId = invocation.getArgument(1);
+            Uri uri = invocation.getArgument(2);
+            RemoteCallback cb = invocation.getArgument(3);
+            IContentProvider mock = (IContentProvider) (invocation.getMock());
+            AsyncTask.SERIAL_EXECUTOR.execute(() -> {
+                final Bundle bundle = new Bundle();
+                try {
+                    bundle.putParcelable(ContentResolver.REMOTE_CALLBACK_RESULT,
+                            mock.canonicalize(callingPkg, featureId, uri));
+                } catch (RemoteException e) { /* consume */ }
+                cb.sendResult(bundle);
+            });
+            return null;
+        }).when(mTestIContentProvider).canonicalizeAsync(any(), any(), any(), any());
+        doAnswer(invocation -> {
+            Uri uri = invocation.getArgument(0);
+            RemoteCallback cb = invocation.getArgument(1);
+            IContentProvider mock = (IContentProvider) (invocation.getMock());
+            AsyncTask.SERIAL_EXECUTOR.execute(() -> {
+                final Bundle bundle = new Bundle();
+                try {
+                    bundle.putString(ContentResolver.REMOTE_CALLBACK_RESULT, mock.getType(uri));
+                } catch (RemoteException e) { /* consume */ }
+                cb.sendResult(bundle);
+            });
+            return null;
+        }).when(mTestIContentProvider).getTypeAsync(any(), any());
+
         when(testContentProvider.getIContentProvider()).thenReturn(mTestIContentProvider);
         contentResolver.addProvider(TEST_AUTHORITY, testContentProvider);
 
diff --git a/services/usb/OWNERS b/services/usb/OWNERS
index 7897a0c..8ee72b5 100644
--- a/services/usb/OWNERS
+++ b/services/usb/OWNERS
@@ -1,4 +1,6 @@
 badhri@google.com
 elaurent@google.com
 moltmann@google.com
-zhangjerry@google.com
+albertccwang@google.com
+jameswei@google.com
+howardyen@google.com
\ No newline at end of file
diff --git a/telecomm/java/android/telecom/CallScreeningService.java b/telecomm/java/android/telecom/CallScreeningService.java
index 8abab90..4d9311c 100644
--- a/telecomm/java/android/telecom/CallScreeningService.java
+++ b/telecomm/java/android/telecom/CallScreeningService.java
@@ -16,7 +16,9 @@
 
 package android.telecom;
 
+import android.Manifest;
 import android.annotation.NonNull;
+import android.annotation.RequiresPermission;
 import android.annotation.SdkConstant;
 import android.annotation.SystemApi;
 import android.annotation.TestApi;
@@ -302,6 +304,7 @@
              */
             @SystemApi
             @TestApi
+            @RequiresPermission(Manifest.permission.CAPTURE_AUDIO_OUTPUT)
             public @NonNull Builder setShouldScreenCallViaAudioProcessing(
                     boolean shouldScreenCallViaAudioProcessing) {
                 mShouldScreenCallViaAudioProcessing = shouldScreenCallViaAudioProcessing;
diff --git a/telecomm/java/android/telecom/TelecomManager.java b/telecomm/java/android/telecom/TelecomManager.java
index f2f1412..8eebbed 100644
--- a/telecomm/java/android/telecom/TelecomManager.java
+++ b/telecomm/java/android/telecom/TelecomManager.java
@@ -1645,6 +1645,7 @@
      * @hide
      */
     @SystemApi
+    @TestApi
     @RequiresPermission(anyOf = {
             READ_PRIVILEGED_PHONE_STATE,
             android.Manifest.permission.READ_PHONE_STATE
diff --git a/telecomm/java/com/android/internal/telecom/ITelecomService.aidl b/telecomm/java/com/android/internal/telecom/ITelecomService.aidl
index 285cf43..dee5a98 100644
--- a/telecomm/java/com/android/internal/telecom/ITelecomService.aidl
+++ b/telecomm/java/com/android/internal/telecom/ITelecomService.aidl
@@ -277,6 +277,11 @@
     boolean setDefaultDialer(in String packageName);
 
     /**
+     * Stop suppressing blocked numbers after a call to emergency services. Shell only.
+     */
+    void stopBlockSuppression();
+
+    /**
     * @see TelecomServiceImpl#createManageBlockedNumbersIntent
     **/
     Intent createManageBlockedNumbersIntent();
diff --git a/telephony/api/system-current.txt b/telephony/api/system-current.txt
index 8ce4b0d..73799dc 100644
--- a/telephony/api/system-current.txt
+++ b/telephony/api/system-current.txt
@@ -179,85 +179,6 @@
     field @NonNull public static final android.os.Parcelable.Creator<android.telephony.DataSpecificRegistrationInfo> CREATOR;
   }
 
-  public final class DisconnectCause {
-    field public static final int ALREADY_DIALING = 72; // 0x48
-    field public static final int ANSWERED_ELSEWHERE = 52; // 0x34
-    field public static final int BUSY = 4; // 0x4
-    field public static final int CALLING_DISABLED = 74; // 0x4a
-    field public static final int CALL_BARRED = 20; // 0x14
-    field public static final int CALL_PULLED = 51; // 0x33
-    field public static final int CANT_CALL_WHILE_RINGING = 73; // 0x49
-    field public static final int CDMA_ACCESS_BLOCKED = 35; // 0x23
-    field public static final int CDMA_ACCESS_FAILURE = 32; // 0x20
-    field public static final int CDMA_ALREADY_ACTIVATED = 49; // 0x31
-    field public static final int CDMA_DROP = 27; // 0x1b
-    field public static final int CDMA_INTERCEPT = 28; // 0x1c
-    field public static final int CDMA_LOCKED_UNTIL_POWER_CYCLE = 26; // 0x1a
-    field public static final int CDMA_NOT_EMERGENCY = 34; // 0x22
-    field public static final int CDMA_PREEMPTED = 33; // 0x21
-    field public static final int CDMA_REORDER = 29; // 0x1d
-    field public static final int CDMA_RETRY_ORDER = 31; // 0x1f
-    field public static final int CDMA_SO_REJECT = 30; // 0x1e
-    field public static final int CONGESTION = 5; // 0x5
-    field public static final int CS_RESTRICTED = 22; // 0x16
-    field public static final int CS_RESTRICTED_EMERGENCY = 24; // 0x18
-    field public static final int CS_RESTRICTED_NORMAL = 23; // 0x17
-    field public static final int DATA_DISABLED = 54; // 0x36
-    field public static final int DATA_LIMIT_REACHED = 55; // 0x37
-    field public static final int DIALED_CALL_FORWARDING_WHILE_ROAMING = 57; // 0x39
-    field public static final int DIALED_MMI = 39; // 0x27
-    field public static final int DIAL_LOW_BATTERY = 62; // 0x3e
-    field public static final int DIAL_MODIFIED_TO_DIAL = 48; // 0x30
-    field public static final int DIAL_MODIFIED_TO_DIAL_VIDEO = 66; // 0x42
-    field public static final int DIAL_MODIFIED_TO_SS = 47; // 0x2f
-    field public static final int DIAL_MODIFIED_TO_USSD = 46; // 0x2e
-    field public static final int DIAL_VIDEO_MODIFIED_TO_DIAL = 69; // 0x45
-    field public static final int DIAL_VIDEO_MODIFIED_TO_DIAL_VIDEO = 70; // 0x46
-    field public static final int DIAL_VIDEO_MODIFIED_TO_SS = 67; // 0x43
-    field public static final int DIAL_VIDEO_MODIFIED_TO_USSD = 68; // 0x44
-    field public static final int EMERGENCY_PERM_FAILURE = 64; // 0x40
-    field public static final int EMERGENCY_TEMP_FAILURE = 63; // 0x3f
-    field public static final int ERROR_UNSPECIFIED = 36; // 0x24
-    field public static final int FDN_BLOCKED = 21; // 0x15
-    field public static final int ICC_ERROR = 19; // 0x13
-    field public static final int IMEI_NOT_ACCEPTED = 58; // 0x3a
-    field public static final int IMS_ACCESS_BLOCKED = 60; // 0x3c
-    field public static final int IMS_MERGED_SUCCESSFULLY = 45; // 0x2d
-    field public static final int IMS_SIP_ALTERNATE_EMERGENCY_CALL = 71; // 0x47
-    field public static final int INCOMING_AUTO_REJECTED = 81; // 0x51
-    field public static final int INCOMING_MISSED = 1; // 0x1
-    field public static final int INCOMING_REJECTED = 16; // 0x10
-    field public static final int INVALID_CREDENTIALS = 10; // 0xa
-    field public static final int INVALID_NUMBER = 7; // 0x7
-    field public static final int LIMIT_EXCEEDED = 15; // 0xf
-    field public static final int LOCAL = 3; // 0x3
-    field public static final int LOST_SIGNAL = 14; // 0xe
-    field public static final int LOW_BATTERY = 61; // 0x3d
-    field public static final int MAXIMUM_NUMBER_OF_CALLS_REACHED = 53; // 0x35
-    field public static final int MMI = 6; // 0x6
-    field public static final int NORMAL = 2; // 0x2
-    field public static final int NORMAL_UNSPECIFIED = 65; // 0x41
-    field public static final int NOT_DISCONNECTED = 0; // 0x0
-    field public static final int NOT_VALID = -1; // 0xffffffff
-    field public static final int NO_PHONE_NUMBER_SUPPLIED = 38; // 0x26
-    field public static final int NUMBER_UNREACHABLE = 8; // 0x8
-    field public static final int OTASP_PROVISIONING_IN_PROCESS = 76; // 0x4c
-    field public static final int OUTGOING_CANCELED = 44; // 0x2c
-    field public static final int OUTGOING_EMERGENCY_CALL_PLACED = 80; // 0x50
-    field public static final int OUTGOING_FAILURE = 43; // 0x2b
-    field public static final int OUT_OF_NETWORK = 11; // 0xb
-    field public static final int OUT_OF_SERVICE = 18; // 0x12
-    field public static final int POWER_OFF = 17; // 0x11
-    field public static final int SERVER_ERROR = 12; // 0xc
-    field public static final int SERVER_UNREACHABLE = 9; // 0x9
-    field public static final int TIMED_OUT = 13; // 0xd
-    field public static final int TOO_MANY_ONGOING_CALLS = 75; // 0x4b
-    field public static final int UNOBTAINABLE_NUMBER = 25; // 0x19
-    field public static final int VIDEO_CALL_NOT_ALLOWED_WHILE_TTY_ENABLED = 50; // 0x32
-    field public static final int VOICEMAIL_NUMBER_MISSING = 40; // 0x28
-    field public static final int WIFI_LOST = 59; // 0x3b
-  }
-
   public final class ImsiEncryptionInfo implements android.os.Parcelable {
     method public int describeContents();
     method @Nullable public String getKeyIdentifier();
diff --git a/telephony/common/com/google/android/mms/pdu/PduComposer.java b/telephony/common/com/google/android/mms/pdu/PduComposer.java
index b8b212c..5e1f556 100644
--- a/telephony/common/com/google/android/mms/pdu/PduComposer.java
+++ b/telephony/common/com/google/android/mms/pdu/PduComposer.java
@@ -745,7 +745,9 @@
             return PDU_COMPOSE_CONTENT_ERROR;
         }
 
-        // X-Mms-Report-Allowed Optional (not support)
+        // X-Mms-Report-Allowed Optional
+        appendHeader(PduHeaders.REPORT_ALLOWED);
+
         return PDU_COMPOSE_SUCCESS;
     }
 
diff --git a/telephony/java/android/service/euicc/EuiccService.java b/telephony/java/android/service/euicc/EuiccService.java
index 9315586..fcbb008 100644
--- a/telephony/java/android/service/euicc/EuiccService.java
+++ b/telephony/java/android/service/euicc/EuiccService.java
@@ -328,8 +328,7 @@
      *                                       or when an number is bigger than 15
      */
     public int encodeSmdxSubjectAndReasonCode(@Nullable String subjectCode,
-            @Nullable String reasonCode)
-            throws NumberFormatException, IllegalArgumentException, UnsupportedOperationException {
+            @Nullable String reasonCode) {
         final int maxSupportedSection = 3;
         final int maxSupportedDigit = 15;
         final int bitsPerSection = 4;
diff --git a/telephony/java/android/telephony/CarrierConfigManager.java b/telephony/java/android/telephony/CarrierConfigManager.java
index 6a95bc3..6fb08ee 100755
--- a/telephony/java/android/telephony/CarrierConfigManager.java
+++ b/telephony/java/android/telephony/CarrierConfigManager.java
@@ -354,6 +354,34 @@
             "only_auto_select_in_home_network";
 
     /**
+     * Flag indicating whether to show single operator row in the choose network setting.
+     *
+     * The device configuration value {@code config_enableNewAutoSelectNetworkUI} ultimately
+     * controls whether this carrier configuration option is used.  Where
+     * {@code config_enableNewAutoSelectNetworkUI} is false, the value of the
+     * {@link #KEY_SHOW_SINGLE_OPERATOR_ROW_IN_CHOOSE_NETWORK_SETTING_BOOL} carrier configuration
+     * option is ignored.
+     *
+     * If {@code true}, default value, merge the duplicate networks which with the same plmn, keep
+     * the one that with the higher signal strength level.
+     * If {@code false}, show all operators without merging.
+     * @hide
+     */
+    public static final String KEY_SHOW_SINGLE_OPERATOR_ROW_IN_CHOOSE_NETWORK_SETTING_BOOL =
+            "show_single_operator_row_in_choose_network_setting_bool";
+
+    /**
+     * Flag indicating whether to display SPN as network name for home network in choose
+     * network setting.
+     *
+     * If {@code true}, display SPN as network name in choose network setting.
+     * If {@code false}, display PLMN in choose network setting.
+     * @hide
+     */
+    public static final String KEY_SHOW_SPN_FOR_HOME_IN_CHOOSE_NETWORK_SETTING_BOOL =
+            "show_spn_for_home_in_choose_network_setting_bool";
+
+    /**
      * Control whether users receive a simplified network settings UI and improved network
      * selection.
      */
@@ -3758,6 +3786,15 @@
             "carrier_certificate_string_array";
 
     /**
+     * Flag specifying whether the incoming call number should be formatted to national number
+     * for Japan. @return {@code true} convert to the national format, {@code false} otherwise.
+     * e.g. "+819012345678" -> "09012345678"
+     * @hide
+     */
+    public static final String KEY_FORMAT_INCOMING_NUMBER_TO_NATIONAL_FOR_JP_BOOL =
+            "format_incoming_number_to_national_for_jp_bool";
+
+    /**
      * DisconnectCause array to play busy tone. Value should be array of
      * {@link android.telephony.DisconnectCause}.
      */
@@ -3889,6 +3926,8 @@
         sDefaults.putBoolean(KEY_HAS_IN_CALL_NOISE_SUPPRESSION_BOOL, false);
         sDefaults.putBoolean(KEY_HIDE_CARRIER_NETWORK_SETTINGS_BOOL, false);
         sDefaults.putBoolean(KEY_ONLY_AUTO_SELECT_IN_HOME_NETWORK_BOOL, false);
+        sDefaults.putBoolean(KEY_SHOW_SINGLE_OPERATOR_ROW_IN_CHOOSE_NETWORK_SETTING_BOOL, true);
+        sDefaults.putBoolean(KEY_SHOW_SPN_FOR_HOME_IN_CHOOSE_NETWORK_SETTING_BOOL, false);
         sDefaults.putBoolean(KEY_SIMPLIFIED_NETWORK_SETTINGS_BOOL, false);
         sDefaults.putBoolean(KEY_HIDE_SIM_LOCK_SETTINGS_BOOL, false);
 
@@ -4336,6 +4375,7 @@
         sDefaults.putBoolean(KEY_SUPPORT_WPS_OVER_IMS_BOOL, true);
         sDefaults.putAll(Ims.getDefaults());
         sDefaults.putStringArray(KEY_CARRIER_CERTIFICATE_STRING_ARRAY, null);
+         sDefaults.putBoolean(KEY_FORMAT_INCOMING_NUMBER_TO_NATIONAL_FOR_JP_BOOL, false);
         sDefaults.putIntArray(KEY_DISCONNECT_CAUSE_PLAY_BUSYTONE_INT_ARRAY,
                 new int[] {4 /* BUSY */});
         sDefaults.putBoolean(KEY_PREVENT_CLIR_ACTIVATION_AND_DEACTIVATION_CODE_BOOL, false);
@@ -4599,6 +4639,7 @@
         } catch (RemoteException ex) {
             Rlog.e(TAG, "getDefaultCarrierServicePackageName ICarrierConfigLoader is null"
                     + ex.toString());
+            ex.rethrowAsRuntimeException();
         }
         return "";
     }
diff --git a/telephony/java/android/telephony/DisconnectCause.java b/telephony/java/android/telephony/DisconnectCause.java
index be85b30..2704418 100644
--- a/telephony/java/android/telephony/DisconnectCause.java
+++ b/telephony/java/android/telephony/DisconnectCause.java
@@ -17,16 +17,14 @@
 package android.telephony;
 
 import android.annotation.NonNull;
-import android.annotation.SystemApi;
 import android.compat.annotation.UnsupportedAppUsage;
 
 /**
  * Describes the cause of a disconnected call. Those disconnect causes can be converted into a more
  * generic {@link android.telecom.DisconnectCause} object.
  *
- * @hide
+ * Used in {@link PhoneStateListener#onCallDisconnectCauseChanged}.
  */
-@SystemApi
 public final class DisconnectCause {
 
     /** The disconnect cause is not valid (Not received a disconnect cause) */
@@ -337,20 +335,17 @@
     /**
      * Indicates that the call is dropped due to RTCP inactivity, primarily due to media path
      * disruption.
-     * @hide
      */
     public static final int MEDIA_TIMEOUT = 77;
 
     /**
      * Indicates that an emergency call cannot be placed over WFC because the service is not
      * available in the current location.
-     * @hide
      */
     public static final int EMERGENCY_CALL_OVER_WFC_NOT_AVAILABLE = 78;
 
     /**
      * Indicates that WiFi calling service is not available in the current location.
-     * @hide
      */
     public static final int WFC_SERVICE_NOT_AVAILABLE_IN_THIS_LOCATION = 79;
 
diff --git a/telephony/java/android/telephony/MbmsDownloadSession.java b/telephony/java/android/telephony/MbmsDownloadSession.java
index 45deea2..3f671ca 100644
--- a/telephony/java/android/telephony/MbmsDownloadSession.java
+++ b/telephony/java/android/telephony/MbmsDownloadSession.java
@@ -231,6 +231,8 @@
 
     private static final String DESTINATION_SANITY_CHECK_FILE_NAME = "destinationSanityCheckFile";
 
+    private static final int MAX_SERVICE_ANNOUNCEMENT_SIZE = 10 * 1024; // 10KB
+
     private static AtomicBoolean sIsInitialized = new AtomicBoolean(false);
 
     private final Context mContext;
@@ -318,6 +320,16 @@
         return session;
     }
 
+    /**
+     * Returns the maximum size of the service announcement descriptor that can be provided via
+     * {@link #addServiceAnnouncement}
+     * @return The maximum length of the byte array passed as an argument to
+     *         {@link #addServiceAnnouncement}.
+     */
+    public static int getMaximumServiceAnnouncementSize() {
+        return MAX_SERVICE_ANNOUNCEMENT_SIZE;
+    }
+
     private int bindAndInitialize() {
         mServiceConnection = new ServiceConnection() {
             @Override
@@ -424,6 +436,61 @@
     }
 
     /**
+     * Inform the middleware of a service announcement descriptor received from a group
+     * communication server.
+     *
+     * When participating in a group call via the {@link MbmsGroupCallSession} API, applications may
+     * receive a service announcement descriptor from the group call server that informs them of
+     * files that may be relevant to users communicating on the group call.
+     *
+     * After supplying the service announcement descriptor received from the server to the
+     * middleware via this API, applications will receive information on the available files via
+     * {@link MbmsDownloadSessionCallback#onFileServicesUpdated}, and the available files will be
+     * downloadable via {@link MbmsDownloadSession#download} like other files published via
+     * {@link MbmsDownloadSessionCallback#onFileServicesUpdated}.
+     *
+     * Asynchronous error codes via the {@link MbmsDownloadSessionCallback#onError(int, String)}
+     * callback may include any of the errors that are not specific to the streaming use-case.
+     *
+     * May throw an {@link IllegalStateException} when the middleware has not yet been bound,
+     * or an {@link IllegalArgumentException} if the byte array is too large, or an
+     * {@link UnsupportedOperationException} if the middleware has not implemented this method.
+     *
+     * @param contents The contents of the service announcement descriptor received from the
+     *                     group call server. If the size of this array is greater than the value of
+     *                     {@link #getMaximumServiceAnnouncementSize()}, an
+     *                     {@link IllegalArgumentException} will be thrown.
+     */
+    public void addServiceAnnouncement(@NonNull byte[] contents) {
+        IMbmsDownloadService downloadService = mService.get();
+        if (downloadService == null) {
+            throw new IllegalStateException("Middleware not yet bound");
+        }
+
+        if (contents.length > MAX_SERVICE_ANNOUNCEMENT_SIZE) {
+            throw new IllegalArgumentException("File too large");
+        }
+
+        try {
+            int returnCode = downloadService.addServiceAnnouncement(
+                    mSubscriptionId, contents);
+            if (returnCode == MbmsErrors.UNKNOWN) {
+                // Unbind and throw an obvious error
+                close();
+                throw new IllegalStateException("Middleware must not return an unknown error code");
+            }
+            if (returnCode != MbmsErrors.SUCCESS) {
+                sendErrorToApp(returnCode, null);
+            }
+        } catch (RemoteException e) {
+            Log.w(LOG_TAG, "Remote process died");
+            mService.set(null);
+            sIsInitialized.set(false);
+            sendErrorToApp(MbmsErrors.ERROR_MIDDLEWARE_LOST, null);
+        }
+    }
+
+    /**
      * Sets the temp file root for downloads.
      * All temp files created for the middleware to write to will be contained in the specified
      * directory. Applications that wish to specify a location only need to call this method once
diff --git a/telephony/java/android/telephony/ModemActivityInfo.java b/telephony/java/android/telephony/ModemActivityInfo.java
index 2b72ab7..debb119 100644
--- a/telephony/java/android/telephony/ModemActivityInfo.java
+++ b/telephony/java/android/telephony/ModemActivityInfo.java
@@ -234,7 +234,7 @@
     }
 
     /**
-     * Indicate if the ModemActivityInfo is invalid due to modem's invalid reporting.
+     * Indicates if the modem has reported valid {@link ModemActivityInfo}.
      *
      * @return {@code true} if this {@link ModemActivityInfo} record is valid,
      * {@code false} otherwise.
diff --git a/telephony/java/android/telephony/NetworkRegistrationInfo.java b/telephony/java/android/telephony/NetworkRegistrationInfo.java
index 93fbb00..31a83c9 100644
--- a/telephony/java/android/telephony/NetworkRegistrationInfo.java
+++ b/telephony/java/android/telephony/NetworkRegistrationInfo.java
@@ -389,7 +389,7 @@
     }
 
     /**
-     * @return {@code true} if registered on roaming network, {@code false} otherwise.
+     * @return {@code true} if registered on roaming or home network, {@code false} otherwise.
      */
     public boolean isRegistered() {
         return mRegistrationState == REGISTRATION_STATE_HOME
@@ -397,7 +397,7 @@
     }
 
     /**
-     * @return {@code true} if registered on roaming network, {@code false} otherwise.
+     * @return {@code true} if searching for service, {@code false} otherwise.
      */
     public boolean isSearching() {
         return mRegistrationState == REGISTRATION_STATE_NOT_REGISTERED_SEARCHING;
diff --git a/telephony/java/android/telephony/PinResult.java b/telephony/java/android/telephony/PinResult.java
index 98d6448..c2a4f33 100644
--- a/telephony/java/android/telephony/PinResult.java
+++ b/telephony/java/android/telephony/PinResult.java
@@ -37,6 +37,7 @@
             PIN_RESULT_TYPE_SUCCESS,
             PIN_RESULT_TYPE_INCORRECT,
             PIN_RESULT_TYPE_FAILURE,
+            PIN_RESULT_TYPE_ABORTED,
     })
     public @interface PinResultType {}
 
@@ -55,6 +56,11 @@
      */
     public static final int PIN_RESULT_TYPE_FAILURE = PhoneConstants.PIN_GENERAL_FAILURE;
 
+    /**
+     * Indicates that the pin attempt was aborted.
+     */
+    public static final int PIN_RESULT_TYPE_ABORTED = PhoneConstants.PIN_OPERATION_ABORTED;
+
     private static final PinResult sFailedResult =
             new PinResult(PinResult.PIN_RESULT_TYPE_FAILURE, -1);
 
diff --git a/telephony/java/android/telephony/SmsMessage.java b/telephony/java/android/telephony/SmsMessage.java
index e537f66..347dcc8 100644
--- a/telephony/java/android/telephony/SmsMessage.java
+++ b/telephony/java/android/telephony/SmsMessage.java
@@ -321,12 +321,9 @@
      * @param data Message data.
      * @param isCdma Indicates weather the type of the SMS is CDMA.
      * @return An SmsMessage representing the message.
-     *
-     * @hide
      */
-    @SystemApi
     @Nullable
-    public static SmsMessage createFromNativeSmsSubmitPdu(@NonNull byte[] data, boolean isCdma) {
+    public static SmsMessage createSmsSubmitPdu(@NonNull byte[] data, boolean isCdma) {
         SmsMessageBase wrappedMessage;
 
         if (isCdma) {
@@ -342,6 +339,23 @@
     }
 
     /**
+     * Create an SmsMessage from a native SMS-Submit PDU, specified by Bluetooth Message Access
+     * Profile Specification v1.4.2 5.8.
+     * This is used by Bluetooth MAP profile to decode message when sending non UTF-8 SMS messages.
+     *
+     * @param data Message data.
+     * @param isCdma Indicates weather the type of the SMS is CDMA.
+     * @return An SmsMessage representing the message.
+     *
+     * @hide
+     */
+    @SystemApi
+    @Nullable
+    public static SmsMessage createFromNativeSmsSubmitPdu(@NonNull byte[] data, boolean isCdma) {
+        return null;
+    }
+
+    /**
      * Get the TP-Layer-Length for the given SMS-SUBMIT PDU Basically, the
      * length in bytes (not hex chars) less the SMSC header
      *
@@ -496,7 +510,10 @@
         String newMsgBody = null;
         Resources r = Resources.getSystem();
         if (r.getBoolean(com.android.internal.R.bool.config_sms_force_7bit_encoding)) {
-            newMsgBody = Sms7BitEncodingTranslator.translate(text, isCdma);
+            // 7-bit ASCII table based translation is required only for CDMA single-part SMS since
+            // ENCODING_7BIT_ASCII is used for CDMA single-part SMS and ENCODING_GSM_7BIT_ALPHABET
+            // is used for CDMA multi-part SMS.
+            newMsgBody = Sms7BitEncodingTranslator.translate(text, isCdma && ted.msgCount == 1);
         }
         if (TextUtils.isEmpty(newMsgBody)) {
             newMsgBody = text;
diff --git a/telephony/java/android/telephony/SubscriptionManager.java b/telephony/java/android/telephony/SubscriptionManager.java
index e9ee06c..4ad52ae 100644
--- a/telephony/java/android/telephony/SubscriptionManager.java
+++ b/telephony/java/android/telephony/SubscriptionManager.java
@@ -1111,11 +1111,15 @@
      * individual records themselves. When a change occurs the onSubscriptionsChanged method of
      * the listener will be invoked immediately if there has been a notification. The
      * onSubscriptionChanged method will also be triggered once initially when calling this
-     * function.
+     * function. The callback will be invoked on the looper specified in the listener's constructor.
      *
      * @param listener an instance of {@link OnSubscriptionsChangedListener} with
      *                 onSubscriptionsChanged overridden.
+     *
+     * @deprecated Will get exception if the parameter listener is not initialized with a Looper.
+     * Use {@link #addOnSubscriptionsChangedListener(Executor, OnSubscriptionsChangedListener)}.
      */
+    @Deprecated
     public void addOnSubscriptionsChangedListener(OnSubscriptionsChangedListener listener) {
         if (listener == null) return;
         addOnSubscriptionsChangedListener(listener.mExecutor, listener);
diff --git a/telephony/java/android/telephony/TelephonyScanManager.java b/telephony/java/android/telephony/TelephonyScanManager.java
index cdff651..e890acb 100644
--- a/telephony/java/android/telephony/TelephonyScanManager.java
+++ b/telephony/java/android/telephony/TelephonyScanManager.java
@@ -30,6 +30,7 @@
 import android.os.RemoteException;
 import android.util.SparseArray;
 
+import com.android.internal.annotations.GuardedBy;
 import com.android.internal.telephony.ITelephony;
 import com.android.telephony.Rlog;
 
@@ -55,6 +56,8 @@
     public static final int CALLBACK_SCAN_COMPLETE = 3;
     /** @hide */
     public static final int CALLBACK_RESTRICTED_SCAN_RESULTS = 4;
+    /** @hide */
+    public static final int CALLBACK_TELEPHONY_DIED = 5;
 
     /** @hide */
     public static final int INVALID_SCAN_ID = -1;
@@ -103,17 +106,44 @@
     }
 
     private final Looper mLooper;
+    private final Handler mHandler;
     private final Messenger mMessenger;
     private final SparseArray<NetworkScanInfo> mScanInfo = new SparseArray<NetworkScanInfo>();
+    private final Binder.DeathRecipient mDeathRecipient;
 
     public TelephonyScanManager() {
         HandlerThread thread = new HandlerThread(TAG);
         thread.start();
         mLooper = thread.getLooper();
-        mMessenger = new Messenger(new Handler(mLooper) {
+        mHandler = new Handler(mLooper) {
             @Override
             public void handleMessage(Message message) {
                 checkNotNull(message, "message cannot be null");
+                if (message.what == CALLBACK_TELEPHONY_DIED) {
+                    // If there are no objects in mScanInfo then binder death will simply return.
+                    synchronized (mScanInfo) {
+                        for (int i = 0; i < mScanInfo.size(); i++) {
+                            NetworkScanInfo nsi = mScanInfo.valueAt(i);
+                            // At this point we go into panic mode and ignore errors that would
+                            // normally stop the show in order to try and clean up as gracefully
+                            // as possible.
+                            if (nsi == null) continue; // shouldn't be possible
+                            Executor e = nsi.mExecutor;
+                            NetworkScanCallback cb = nsi.mCallback;
+                            if (e == null || cb == null) continue;
+                            try {
+                                e.execute(
+                                        () -> cb.onError(NetworkScan.ERROR_MODEM_UNAVAILABLE));
+                            } catch (java.util.concurrent.RejectedExecutionException ignore) {
+                                // ignore so that we can continue
+                            }
+                        }
+
+                        mScanInfo.clear();
+                    }
+                    return;
+                }
+
                 NetworkScanInfo nsi;
                 synchronized (mScanInfo) {
                     nsi = mScanInfo.get(message.arg2);
@@ -158,6 +188,9 @@
                                 Rlog.d(TAG, "onError: " + errorCode);
                                 callback.onError(errorCode);
                             });
+                            synchronized (mScanInfo) {
+                                mScanInfo.remove(message.arg2);
+                            }
                         } catch (Exception e) {
                             Rlog.e(TAG, "Exception in networkscan callback onError", e);
                         }
@@ -168,7 +201,9 @@
                                 Rlog.d(TAG, "onComplete");
                                 callback.onComplete();
                             });
-                            mScanInfo.remove(message.arg2);
+                            synchronized (mScanInfo) {
+                                mScanInfo.remove(message.arg2);
+                            }
                         } catch (Exception e) {
                             Rlog.e(TAG, "Exception in networkscan callback onComplete", e);
                         }
@@ -178,7 +213,14 @@
                         break;
                 }
             }
-        });
+        };
+        mMessenger = new Messenger(mHandler);
+        mDeathRecipient = new Binder.DeathRecipient() {
+            @Override
+            public void binderDied() {
+                mHandler.obtainMessage(CALLBACK_TELEPHONY_DIED).sendToTarget();
+            }
+        };
     }
 
     /**
@@ -189,7 +231,7 @@
      *
      * <p>
      * Requires Permission:
-     * {@link android.Manifest.permission#ACCESS_COARSE_LOCATION} and
+     * {@link android.Manifest.permission#ACCESS_FINE_LOCATION} and
      *   {@link android.Manifest.permission#MODIFY_PHONE_STATE MODIFY_PHONE_STATE}
      * Or the calling app has carrier privileges. @see #hasCarrierPrivileges
      *
@@ -204,19 +246,26 @@
             NetworkScanRequest request, Executor executor, NetworkScanCallback callback,
             String callingPackage, @Nullable String callingFeatureId) {
         try {
-            ITelephony telephony = getITelephony();
-            if (telephony != null) {
-                synchronized (mScanInfo) {
-                    int scanId = telephony.requestNetworkScan(
-                            subId, request, mMessenger, new Binder(), callingPackage,
-                            callingFeatureId);
-                    if (scanId == INVALID_SCAN_ID) {
-                        Rlog.e(TAG, "Failed to initiate network scan");
-                        return null;
-                    }
-                    saveScanInfo(scanId, request, executor, callback);
-                    return new NetworkScan(scanId, subId);
-                }
+            final ITelephony telephony = getITelephony();
+            if (telephony == null) return null;
+
+            int scanId = telephony.requestNetworkScan(
+                    subId, request, mMessenger, new Binder(), callingPackage,
+                    callingFeatureId);
+            if (scanId == INVALID_SCAN_ID) {
+                Rlog.e(TAG, "Failed to initiate network scan");
+                return null;
+            }
+            synchronized (mScanInfo) {
+                // We link to death whenever a scan is started to ensure that we are linked
+                // at the point that phone process death might matter.
+                // We never unlink because:
+                // - Duplicate links to death with the same callback do not result in
+                //   extraneous callbacks (the tracking de-dupes).
+                // - Receiving binderDeath() when no scans are active is a no-op.
+                telephony.asBinder().linkToDeath(mDeathRecipient, 0);
+                saveScanInfo(scanId, request, executor, callback);
+                return new NetworkScan(scanId, subId);
             }
         } catch (RemoteException ex) {
             Rlog.e(TAG, "requestNetworkScan RemoteException", ex);
@@ -226,6 +275,7 @@
         return null;
     }
 
+    @GuardedBy("mScanInfo")
     private void saveScanInfo(
             int id, NetworkScanRequest request, Executor executor, NetworkScanCallback callback) {
         mScanInfo.put(id, new NetworkScanInfo(request, executor, callback));
diff --git a/telephony/java/android/telephony/ims/ImsCallSessionListener.java b/telephony/java/android/telephony/ims/ImsCallSessionListener.java
index 81af99f..d21a051 100644
--- a/telephony/java/android/telephony/ims/ImsCallSessionListener.java
+++ b/telephony/java/android/telephony/ims/ImsCallSessionListener.java
@@ -683,5 +683,32 @@
             e.rethrowFromSystemServer();
         }
     }
+
+    /**
+     * Notifies the result of transfer request.
+     * @hide
+     */
+    public void callSessionTransferred() {
+        try {
+            mListener.callSessionTransferred();
+        } catch (RemoteException e) {
+            e.rethrowFromSystemServer();
+        }
+    }
+
+    /**
+     * Notifies the result of transfer request.
+     *
+     * @param reasonInfo {@link ImsReasonInfo} containing a reason for the
+     * session transfer failure
+     * @hide
+     */
+    public void callSessionTransferFailed(ImsReasonInfo reasonInfo) {
+        try {
+            mListener.callSessionTransferFailed(reasonInfo);
+        } catch (RemoteException e) {
+            e.rethrowFromSystemServer();
+        }
+    }
 }
 
diff --git a/telephony/java/android/telephony/ims/RcsUceAdapter.java b/telephony/java/android/telephony/ims/RcsUceAdapter.java
index ec11279..a427d05 100644
--- a/telephony/java/android/telephony/ims/RcsUceAdapter.java
+++ b/telephony/java/android/telephony/ims/RcsUceAdapter.java
@@ -31,7 +31,7 @@
 import android.telephony.TelephonyFrameworkInitializer;
 import android.telephony.ims.aidl.IImsRcsController;
 import android.telephony.ims.aidl.IRcsUceControllerCallback;
-import android.telephony.ims.feature.RcsFeature;
+import android.telephony.ims.aidl.IRcsUcePublishStateCallback;
 import android.util.Log;
 
 import java.lang.annotation.Retention;
@@ -185,6 +185,58 @@
     })
     public @interface PublishState {}
 
+    /**
+     * An application can use {@link #registerPublishStateCallback} to register a
+     * {@link PublishStateCallback), which will notify the user when the publish state to the
+     * network changes.
+     * @hide
+     */
+    public static class PublishStateCallback {
+
+        private static class PublishStateBinder extends IRcsUcePublishStateCallback.Stub {
+
+            private final PublishStateCallback mLocalCallback;
+            private Executor mExecutor;
+
+            PublishStateBinder(PublishStateCallback c) {
+                mLocalCallback = c;
+            }
+
+            @Override
+            public void onPublishStateChanged(int publishState) {
+                if (mLocalCallback == null) return;
+
+                long callingIdentity = Binder.clearCallingIdentity();
+                try {
+                    mExecutor.execute(() -> mLocalCallback.onChanged(publishState));
+                } finally {
+                    restoreCallingIdentity(callingIdentity);
+                }
+            }
+
+            private void setExecutor(Executor executor) {
+                mExecutor = executor;
+            }
+        }
+
+        private final PublishStateBinder mBinder = new PublishStateBinder(this);
+
+        /**@hide*/
+        public final IRcsUcePublishStateCallback getBinder() {
+            return mBinder;
+        }
+
+        private void setExecutor(Executor executor) {
+            mBinder.setExecutor(executor);
+        }
+
+        /**
+         * Notifies the callback when the publish state has changed.
+         * @param publishState The latest update to the publish state.
+         */
+        public void onChanged(@PublishState int publishState) {
+        }
+    }
 
     /**
      * Provides a one-time callback for the response to a UCE request. After this callback is called
@@ -321,6 +373,8 @@
 
         try {
             return imsRcsController.getUcePublishState(mSubId);
+        } catch (android.os.ServiceSpecificException e) {
+            throw new ImsException(e.getMessage(), e.errorCode);
         } catch (RemoteException e) {
             Log.e(TAG, "Error calling IImsRcsController#getUcePublishState", e);
             throw new ImsException("Remote IMS Service is not available",
@@ -329,6 +383,91 @@
     }
 
     /**
+     * Registers a {@link PublishStateCallback} with the system, which will provide publish state
+     * updates for the subscription specified in {@link ImsManager@getRcsManager(subid)}.
+     * <p>
+     * Use {@link SubscriptionManager.OnSubscriptionsChangedListener} to listen to subscription
+     * changed events and call {@link #unregisterPublishStateCallback} to clean up.
+     * <p>
+     * The registered {@link PublishStateCallback} will also receive a callback when it is
+     * registered with the current publish state.
+     *
+     * @param executor The executor the listener callback events should be run on.
+     * @param c The {@link PublishStateCallback} to be added.
+     * @throws ImsException if the subscription associated with this callback is valid, but
+     * the {@link ImsService} associated with the subscription is not available. This can happen if
+     * the service crashed, for example. See {@link ImsException#getCode()} for a more detailed
+     * reason.
+     * @hide
+     */
+    @RequiresPermission(Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
+    public void registerPublishStateCallback(@NonNull @CallbackExecutor Executor executor,
+            @NonNull PublishStateCallback c) throws ImsException {
+        if (c == null) {
+            throw new IllegalArgumentException("Must include a non-null PublishStateCallback.");
+        }
+        if (executor == null) {
+            throw new IllegalArgumentException("Must include a non-null Executor.");
+        }
+
+        IImsRcsController imsRcsController = getIImsRcsController();
+        if (imsRcsController == null) {
+            Log.e(TAG, "registerPublishStateCallback : IImsRcsController is null");
+            throw new ImsException("Cannot find remote IMS service",
+                    ImsException.CODE_ERROR_SERVICE_UNAVAILABLE);
+        }
+
+        c.setExecutor(executor);
+        try {
+            imsRcsController.registerUcePublishStateCallback(mSubId, c.getBinder());
+        } catch (android.os.ServiceSpecificException e) {
+            throw new ImsException(e.getMessage(), e.errorCode);
+        } catch (RemoteException e) {
+            Log.e(TAG, "Error calling IImsRcsController#registerUcePublishStateCallback", e);
+            throw new ImsException("Remote IMS Service is not available",
+                    ImsException.CODE_ERROR_SERVICE_UNAVAILABLE);
+        }
+    }
+
+    /**
+     * Removes an existing {@link PublishStateCallback}.
+     * <p>
+     * When the subscription associated with this callback is removed
+     * (SIM removed, ESIM swap,etc...), this callback will automatically be removed. If this method
+     * is called for an inactive subscription, it will result in a no-op.
+     *
+     * @param c The callback to be unregistered.
+     * @throws ImsException if the subscription associated with this callback is valid, but
+     * the {@link ImsService} associated with the subscription is not available. This can happen if
+     * the service crashed, for example. See {@link ImsException#getCode()} for a more detailed
+     * reason.
+     * @hide
+     */
+    @RequiresPermission(Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
+    public void unregisterPublishStateCallback(@NonNull PublishStateCallback c)
+            throws ImsException {
+        if (c == null) {
+            throw new IllegalArgumentException("Must include a non-null PublishStateCallback.");
+        }
+        IImsRcsController imsRcsController = getIImsRcsController();
+        if (imsRcsController == null) {
+            Log.e(TAG, "unregisterPublishStateCallback: IImsRcsController is null");
+            throw new ImsException("Cannot find remote IMS service",
+                    ImsException.CODE_ERROR_SERVICE_UNAVAILABLE);
+        }
+
+        try {
+            imsRcsController.unregisterUcePublishStateCallback(mSubId, c.getBinder());
+        } catch (android.os.ServiceSpecificException e) {
+            throw new ImsException(e.getMessage(), e.errorCode);
+        } catch (RemoteException e) {
+            Log.e(TAG, "Error calling IImsRcsController#unregisterUcePublishStateCallback", e);
+            throw new ImsException("Remote IMS Service is not available",
+                    ImsException.CODE_ERROR_SERVICE_UNAVAILABLE);
+        }
+    }
+
+    /**
      * The user’s setting for whether or not User Capability Exchange (UCE) is enabled for the
      * associated subscription.
      * <p>
diff --git a/telephony/java/android/telephony/ims/aidl/IImsRcsController.aidl b/telephony/java/android/telephony/ims/aidl/IImsRcsController.aidl
index 483c66e..9e46142 100644
--- a/telephony/java/android/telephony/ims/aidl/IImsRcsController.aidl
+++ b/telephony/java/android/telephony/ims/aidl/IImsRcsController.aidl
@@ -19,6 +19,7 @@
 import android.net.Uri;
 import android.telephony.ims.aidl.IImsCapabilityCallback;
 import android.telephony.ims.aidl.IRcsUceControllerCallback;
+import android.telephony.ims.aidl.IRcsUcePublishStateCallback;
 import android.telephony.ims.aidl.IImsRegistrationCallback;
 
 import com.android.internal.telephony.IIntegerConsumer;
@@ -47,4 +48,6 @@
     int getUcePublishState(int subId);
     boolean isUceSettingEnabled(int subId, String callingPackage, String callingFeatureId);
     void setUceSettingEnabled(int subId, boolean isEnabled);
+    void registerUcePublishStateCallback(int subId, IRcsUcePublishStateCallback c);
+    void unregisterUcePublishStateCallback(int subId, IRcsUcePublishStateCallback c);
 }
diff --git a/tools/aapt/tests/TestHelper.h b/telephony/java/android/telephony/ims/aidl/IRcsUcePublishStateCallback.aidl
similarity index 62%
rename from tools/aapt/tests/TestHelper.h
rename to telephony/java/android/telephony/ims/aidl/IRcsUcePublishStateCallback.aidl
index 79174832..b6e8415 100644
--- a/tools/aapt/tests/TestHelper.h
+++ b/telephony/java/android/telephony/ims/aidl/IRcsUcePublishStateCallback.aidl
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2014 The Android Open Source Project
+ * Copyright (c) 2020 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.
@@ -14,20 +14,13 @@
  * limitations under the License.
  */
 
-#ifndef __TEST_HELPER_H
-#define __TEST_HELPER_H
-
-#include <utils/String8.h>
-
-namespace android {
+package android.telephony.ims.aidl;
 
 /**
- * Stream operator for nicely printing String8's in gtest output.
+ * Interface for RCS UCE publish state change callbacks.
+ *
+ * {@hide}
  */
-inline std::ostream& operator<<(std::ostream& stream, const String8& str) {
-    return stream << str.string();
+oneway interface IRcsUcePublishStateCallback {
+    void onPublishStateChanged(int publishState);
 }
-
-}
-
-#endif
diff --git a/telephony/java/android/telephony/ims/feature/MmTelFeature.java b/telephony/java/android/telephony/ims/feature/MmTelFeature.java
index b3b7b20..01d468c 100644
--- a/telephony/java/android/telephony/ims/feature/MmTelFeature.java
+++ b/telephony/java/android/telephony/ims/feature/MmTelFeature.java
@@ -343,7 +343,6 @@
          * @hide
          */
         @Override
-        @SystemApi @TestApi
         public void onIncomingCall(IImsCallSession c, Bundle extras) {
 
         }
@@ -355,7 +354,6 @@
          * @hide
          */
         @Override
-        @SystemApi @TestApi
         public void onRejectedCall(ImsCallProfile callProfile, ImsReasonInfo reason) {
 
         }
@@ -366,7 +364,6 @@
          * @hide
          */
         @Override
-        @SystemApi @TestApi
         public void onVoiceMessageCountUpdate(int count) {
 
         }
diff --git a/telephony/java/android/telephony/ims/stub/ImsRegistrationImplBase.java b/telephony/java/android/telephony/ims/stub/ImsRegistrationImplBase.java
index 7069e0a..2cdf70e 100644
--- a/telephony/java/android/telephony/ims/stub/ImsRegistrationImplBase.java
+++ b/telephony/java/android/telephony/ims/stub/ImsRegistrationImplBase.java
@@ -29,6 +29,7 @@
 
 import com.android.internal.annotations.VisibleForTesting;
 import com.android.internal.telephony.util.RemoteCallbackListExt;
+import com.android.internal.util.ArrayUtils;
 
 import java.lang.annotation.Retention;
 import java.lang.annotation.RetentionPolicy;
@@ -105,6 +106,11 @@
     // Locked on mLock, create unspecified disconnect cause.
     private ImsReasonInfo mLastDisconnectCause = new ImsReasonInfo();
 
+    // We hold onto the uris each time they change so that we can send it to a callback when its
+    // first added.
+    private Uri[] mUris = new Uri[0];
+    private boolean mUrisSet = false;
+
     /**
      * @hide
      */
@@ -208,19 +214,27 @@
     }
 
     /**
-     * The this device's subscriber associated {@link Uri}s have changed, which are used to filter
-     * out this device's {@link Uri}s during conference calling.
-     * @param uris
+     * Invoked when the {@link Uri}s associated to this device's subscriber have changed.
+     * These {@link Uri}s' are filtered out during conference calls.
+     *
+     * The {@link Uri}s are not guaranteed to be different between subsequent calls.
+     * @param uris changed uris
      */
     public final void onSubscriberAssociatedUriChanged(Uri[] uris) {
-        mCallbacks.broadcastAction((c) -> {
-            try {
-                c.onSubscriberAssociatedUriChanged(uris);
-            } catch (RemoteException e) {
-                Log.w(LOG_TAG, e + " " + "onSubscriberAssociatedUriChanged() - Skipping " +
-                        "callback.");
-            }
-        });
+        synchronized (mLock) {
+            mUris = ArrayUtils.cloneOrNull(uris);
+            mUrisSet = true;
+        }
+        mCallbacks.broadcastAction((c) -> onSubscriberAssociatedUriChanged(c, uris));
+    }
+
+    private void onSubscriberAssociatedUriChanged(IImsRegistrationCallback callback, Uri[] uris) {
+        try {
+            callback.onSubscriberAssociatedUriChanged(uris);
+        } catch (RemoteException e) {
+            Log.w(LOG_TAG, e + " " + "onSubscriberAssociatedUriChanged() - Skipping "
+                    + "callback.");
+        }
     }
 
     private void updateToState(@ImsRegistrationTech int connType, int newState) {
@@ -233,6 +247,10 @@
 
     private void updateToDisconnectedState(ImsReasonInfo info) {
         synchronized (mLock) {
+            //We don't want to send this info over if we are disconnected
+            mUrisSet = false;
+            mUris = null;
+
             updateToState(REGISTRATION_TECH_NONE,
                     RegistrationManager.REGISTRATION_STATE_NOT_REGISTERED);
             if (info != null) {
@@ -260,12 +278,17 @@
      * @param c the newly registered callback that will be updated with the current registration
      *         state.
      */
-    private void updateNewCallbackWithState(IImsRegistrationCallback c) throws RemoteException {
+    private void updateNewCallbackWithState(IImsRegistrationCallback c)
+            throws RemoteException {
         int state;
         ImsReasonInfo disconnectInfo;
+        boolean urisSet;
+        Uri[] uris;
         synchronized (mLock) {
             state = mRegistrationState;
             disconnectInfo = mLastDisconnectCause;
+            urisSet = mUrisSet;
+            uris = mUris;
         }
         switch (state) {
             case RegistrationManager.REGISTRATION_STATE_NOT_REGISTERED: {
@@ -285,5 +308,8 @@
                 break;
             }
         }
+        if (urisSet) {
+            onSubscriberAssociatedUriChanged(c, uris);
+        }
     }
 }
diff --git a/telephony/java/android/telephony/ims/stub/ImsSmsImplBase.java b/telephony/java/android/telephony/ims/stub/ImsSmsImplBase.java
index ce9a73a..a9a33c0 100644
--- a/telephony/java/android/telephony/ims/stub/ImsSmsImplBase.java
+++ b/telephony/java/android/telephony/ims/stub/ImsSmsImplBase.java
@@ -403,8 +403,7 @@
                             message.mWrappedSmsMessage.mMessageRef,
                             STATUS_REPORT_STATUS_ERROR);
                 } else {
-                    Log.w(LOG_TAG,
-                            "onSmsStatusReportReceivedWithoutMessageRef: Invalid pdu entered.");
+                    Log.w(LOG_TAG, "onSmsStatusReportReceived: Invalid pdu entered.");
                     acknowledgeSmsReport(token, 0, STATUS_REPORT_STATUS_ERROR);
                 }
             }
diff --git a/telephony/java/android/telephony/mbms/MbmsErrors.java b/telephony/java/android/telephony/mbms/MbmsErrors.java
index 52e4d33..40f3ae8 100644
--- a/telephony/java/android/telephony/mbms/MbmsErrors.java
+++ b/telephony/java/android/telephony/mbms/MbmsErrors.java
@@ -16,8 +16,12 @@
 
 package android.telephony.mbms;
 
+import android.annotation.IntDef;
 import android.telephony.MbmsStreamingSession;
 
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
 public class MbmsErrors {
     /**
      * Indicates that the middleware has sent an error code that is not defined in the version of
@@ -138,6 +142,13 @@
 
         /** Indicates the the middleware has no record of the supplied {@link FileInfo} */
         public static final int ERROR_UNKNOWN_FILE_INFO = 403;
+
+        /**
+         * Indicates that the service announcement descriptor passed via
+         * {@link android.telephony.MbmsDownloadSession#addServiceAnnouncement(byte[])}
+         * is malformed.
+         */
+        public static final int ERROR_MALFORMED_SERVICE_ANNOUNCEMENT = 404;
     }
 
     /**
@@ -156,5 +167,35 @@
         public static final int ERROR_DUPLICATE_START_GROUP_CALL = 502;
     }
 
+    /** @hide */
+    @IntDef(value = {
+            SUCCESS,
+            ERROR_NO_UNIQUE_MIDDLEWARE,
+            ERROR_MIDDLEWARE_NOT_BOUND,
+            ERROR_MIDDLEWARE_LOST,
+            InitializationErrors.ERROR_DUPLICATE_INITIALIZE,
+            InitializationErrors.ERROR_APP_PERMISSIONS_NOT_GRANTED,
+            InitializationErrors.ERROR_UNABLE_TO_INITIALIZE,
+            GeneralErrors.ERROR_MIDDLEWARE_NOT_YET_READY,
+            GeneralErrors.ERROR_OUT_OF_MEMORY,
+            GeneralErrors.ERROR_MIDDLEWARE_TEMPORARILY_UNAVAILABLE,
+            GeneralErrors.ERROR_IN_E911,
+            GeneralErrors.ERROR_NOT_CONNECTED_TO_HOME_CARRIER_LTE,
+            GeneralErrors.ERROR_UNABLE_TO_READ_SIM,
+            GeneralErrors.ERROR_CARRIER_CHANGE_NOT_ALLOWED,
+            StreamingErrors.ERROR_CONCURRENT_SERVICE_LIMIT_REACHED,
+            StreamingErrors.ERROR_UNABLE_TO_START_SERVICE,
+            StreamingErrors.ERROR_DUPLICATE_START_STREAM,
+            DownloadErrors.ERROR_CANNOT_CHANGE_TEMP_FILE_ROOT,
+            DownloadErrors.ERROR_UNKNOWN_DOWNLOAD_REQUEST,
+            DownloadErrors.ERROR_UNKNOWN_FILE_INFO,
+            DownloadErrors.ERROR_MALFORMED_SERVICE_ANNOUNCEMENT,
+            GroupCallErrors.ERROR_UNABLE_TO_START_SERVICE,
+            GroupCallErrors.ERROR_DUPLICATE_START_GROUP_CALL,
+    })
+    @Retention(RetentionPolicy.SOURCE)
+    public @interface MbmsError {
+    }
+
     private MbmsErrors() {}
 }
diff --git a/telephony/java/android/telephony/mbms/vendor/IMbmsDownloadService.aidl b/telephony/java/android/telephony/mbms/vendor/IMbmsDownloadService.aidl
index 445087fb..04efd53 100755
--- a/telephony/java/android/telephony/mbms/vendor/IMbmsDownloadService.aidl
+++ b/telephony/java/android/telephony/mbms/vendor/IMbmsDownloadService.aidl
@@ -35,6 +35,8 @@
 
     int setTempFileRootDirectory(int subId, String rootDirectoryPath);
 
+    int addServiceAnnouncement(int subId, in byte[] contents);
+
     int download(in DownloadRequest downloadRequest);
 
     int addStatusListener(in DownloadRequest downloadRequest,
diff --git a/telephony/java/android/telephony/mbms/vendor/MbmsDownloadServiceBase.java b/telephony/java/android/telephony/mbms/vendor/MbmsDownloadServiceBase.java
index 9f22d0a..3053ea0 100644
--- a/telephony/java/android/telephony/mbms/vendor/MbmsDownloadServiceBase.java
+++ b/telephony/java/android/telephony/mbms/vendor/MbmsDownloadServiceBase.java
@@ -216,6 +216,29 @@
     }
 
     /**
+     * Called when the client application wishes to receive file information according to a
+     * service announcement descriptor received from a group call server.
+     *
+     * The service announcement descriptor is in the format of a multipart MIME file with XML parts,
+     * though no validation is performed on the contents of the {@code contents} argument --
+     * implementing middleware applications should perform their own validation and return
+     * {@link MbmsErrors.DownloadErrors#ERROR_MALFORMED_SERVICE_ANNOUNCEMENT} if the descriptor is
+     * malformed.
+     *
+     * @param subscriptionId The subscription id the service announcement applies to.
+     * @param contents The contents of the service announcement descriptor.
+     * @return {@link MbmsErrors#SUCCESS}, or
+     *         {@link MbmsErrors.DownloadErrors#ERROR_MALFORMED_SERVICE_ANNOUNCEMENT}
+     */
+    // TODO: are there any public specifications of what the file format is that I can link to?
+    @Override
+    public @MbmsErrors.MbmsError int addServiceAnnouncement(
+            int subscriptionId, @NonNull byte[] contents) {
+        throw new UnsupportedOperationException("addServiceAnnouncement not supported by"
+                + " this middleware.");
+    }
+
+    /**
      * Issues a request to download a set of files.
      *
      * The middleware should expect that {@link #setTempFileRootDirectory(int, String)} has been
diff --git a/telephony/java/com/android/internal/telephony/PhoneConstants.java b/telephony/java/com/android/internal/telephony/PhoneConstants.java
index 4d67754..151187c 100644
--- a/telephony/java/com/android/internal/telephony/PhoneConstants.java
+++ b/telephony/java/com/android/internal/telephony/PhoneConstants.java
@@ -108,6 +108,7 @@
     public static final int PIN_RESULT_SUCCESS = 0;
     public static final int PIN_PASSWORD_INCORRECT = 1;
     public static final int PIN_GENERAL_FAILURE = 2;
+    public static final int PIN_OPERATION_ABORTED = 3;
 
     /**
      * Return codes for <code>enableApnType()</code>
diff --git a/telephony/java/com/android/internal/telephony/cdma/SmsMessage.java b/telephony/java/com/android/internal/telephony/cdma/SmsMessage.java
index 6ed0be2..542e08d 100644
--- a/telephony/java/com/android/internal/telephony/cdma/SmsMessage.java
+++ b/telephony/java/com/android/internal/telephony/cdma/SmsMessage.java
@@ -17,7 +17,7 @@
 package com.android.internal.telephony.cdma;
 
 import android.compat.annotation.UnsupportedAppUsage;
-import android.content.res.Resources;
+import android.os.Build;
 import android.sysprop.TelephonyProperties;
 import android.telephony.PhoneNumberUtils;
 import android.telephony.SmsCbLocation;
@@ -27,7 +27,6 @@
 import android.util.Log;
 
 import com.android.internal.telephony.GsmAlphabet.TextEncodingDetails;
-import com.android.internal.telephony.Sms7BitEncodingTranslator;
 import com.android.internal.telephony.SmsAddress;
 import com.android.internal.telephony.SmsConstants;
 import com.android.internal.telephony.SmsHeader;
@@ -156,7 +155,8 @@
      *
      * @hide
      */
-    @UnsupportedAppUsage
+    @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.Q, publicAlternatives = "Use {@link "
+            + "android.telephony.SmsMessage} API instead")
     public static SmsMessage createFromEfRecord(int index, byte[] data) {
         try {
             SmsMessage msg = new SmsMessage();
@@ -414,15 +414,7 @@
     @UnsupportedAppUsage
     public static TextEncodingDetails calculateLength(CharSequence messageBody,
             boolean use7bitOnly, boolean isEntireMsg) {
-        CharSequence newMsgBody = null;
-        Resources r = Resources.getSystem();
-        if (r.getBoolean(com.android.internal.R.bool.config_sms_force_7bit_encoding)) {
-            newMsgBody = Sms7BitEncodingTranslator.translate(messageBody, true /* isCdmaFormat */);
-        }
-        if (TextUtils.isEmpty(newMsgBody)) {
-            newMsgBody = messageBody;
-        }
-        return BearerData.calcTextEncodingDetails(newMsgBody, use7bitOnly, isEntireMsg);
+        return BearerData.calcTextEncodingDetails(messageBody, use7bitOnly, isEntireMsg);
     }
 
     /**
diff --git a/telephony/java/com/android/internal/telephony/cdma/sms/BearerData.java b/telephony/java/com/android/internal/telephony/cdma/sms/BearerData.java
index c074e6e..4fbafb7 100644
--- a/telephony/java/com/android/internal/telephony/cdma/sms/BearerData.java
+++ b/telephony/java/com/android/internal/telephony/cdma/sms/BearerData.java
@@ -21,9 +21,11 @@
 import android.telephony.SmsCbCmasInfo;
 import android.telephony.cdma.CdmaSmsCbProgramData;
 import android.telephony.cdma.CdmaSmsCbProgramResults;
+import android.text.TextUtils;
 
 import com.android.internal.telephony.GsmAlphabet;
 import com.android.internal.telephony.GsmAlphabet.TextEncodingDetails;
+import com.android.internal.telephony.Sms7BitEncodingTranslator;
 import com.android.internal.telephony.SmsConstants;
 import com.android.internal.telephony.SmsHeader;
 import com.android.internal.telephony.SmsMessageBase;
@@ -540,8 +542,17 @@
      */
     public static TextEncodingDetails calcTextEncodingDetails(CharSequence msg,
             boolean force7BitEncoding, boolean isEntireMsg) {
+        CharSequence newMsg = null;
+        Resources r = Resources.getSystem();
+        if (r.getBoolean(com.android.internal.R.bool.config_sms_force_7bit_encoding)) {
+            newMsg = Sms7BitEncodingTranslator.translate(msg, true /* isCdmaFormat */);
+        }
+        if (TextUtils.isEmpty(newMsg)) {
+            newMsg = msg;
+        }
+
         TextEncodingDetails ted;
-        int septets = countAsciiSeptets(msg, force7BitEncoding);
+        int septets = countAsciiSeptets(newMsg, force7BitEncoding);
         if (septets != -1 && septets <= SmsConstants.MAX_USER_DATA_SEPTETS) {
             ted = new TextEncodingDetails();
             ted.msgCount = 1;
diff --git a/telephony/java/com/android/internal/telephony/gsm/SmsMessage.java b/telephony/java/com/android/internal/telephony/gsm/SmsMessage.java
index 08580012..ccb1474 100644
--- a/telephony/java/com/android/internal/telephony/gsm/SmsMessage.java
+++ b/telephony/java/com/android/internal/telephony/gsm/SmsMessage.java
@@ -27,6 +27,7 @@
 
 import android.compat.annotation.UnsupportedAppUsage;
 import android.content.res.Resources;
+import android.os.Build;
 import android.telephony.PhoneNumberUtils;
 import android.text.TextUtils;
 
@@ -178,7 +179,8 @@
      *
      * @hide
      */
-    @UnsupportedAppUsage
+    @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.Q, publicAlternatives = "Use {@link "
+            + "android.telephony.SmsMessage} API instead")
     public static SmsMessage createFromEfRecord(int index, byte[] data) {
         try {
             SmsMessage msg = new SmsMessage();
diff --git a/test-base/Android.bp b/test-base/Android.bp
index 69c296e..c7c9fc7 100644
--- a/test-base/Android.bp
+++ b/test-base/Android.bp
@@ -38,6 +38,7 @@
     ],
 
     compile_dex: true,
+    default_to_stubs: true,
 }
 
 // Build the android.test.base_static library
diff --git a/test-base/api/current.txt b/test-base/api/current.txt
index 750fb59..823e24d 100644
--- a/test-base/api/current.txt
+++ b/test-base/api/current.txt
@@ -7,8 +7,10 @@
     method @Deprecated public void assertReadingContentUriRequiresPermission(android.net.Uri, String);
     method @Deprecated public void assertWritingContentUriRequiresPermission(android.net.Uri, String);
     method @Deprecated public android.content.Context getContext();
+    method @Deprecated public android.content.Context getTestContext();
     method @Deprecated protected void scrubClass(Class<?>) throws java.lang.IllegalAccessException;
     method @Deprecated public void setContext(android.content.Context);
+    method @Deprecated public void setTestContext(android.content.Context);
     method @Deprecated @android.test.suitebuilder.annotation.Suppress public void testAndroidTestCaseSetupProperly();
     field @Deprecated protected android.content.Context mContext;
   }
diff --git a/test-base/hiddenapi/src/android/test/AndroidTestCase.java b/test-base/hiddenapi/src/android/test/AndroidTestCase.java
deleted file mode 100644
index fcb8d43..0000000
--- a/test-base/hiddenapi/src/android/test/AndroidTestCase.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright (C) 2019 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.test;
-
-import android.compat.annotation.UnsupportedAppUsage;
-import android.content.Context;
-
-import junit.framework.TestCase;
-
-/**
- * @deprecated Stub only
- */
-@SuppressWarnings({ "unchecked", "deprecation", "all" })
-@Deprecated
-public class AndroidTestCase extends TestCase {
-
-    /**
-     * Stub only
-     */
-    @UnsupportedAppUsage
-    public void setTestContext(Context context) {
-        throw new RuntimeException("Stub!");
-    }
-
-    /**
-     * Stub only
-     */
-    @UnsupportedAppUsage
-    public Context getTestContext() {
-        throw new RuntimeException("Stub!");
-    }
-}
diff --git a/test-base/src/android/test/AndroidTestCase.java b/test-base/src/android/test/AndroidTestCase.java
index 1e6bd9c..d3e896b 100644
--- a/test-base/src/android/test/AndroidTestCase.java
+++ b/test-base/src/android/test/AndroidTestCase.java
@@ -71,14 +71,13 @@
      * latter is provided by the context set with the {@link #setContext}
      * method.
      *
-     * @hide
      */
     public void setTestContext(Context context) {
         mTestContext = context;
     }
 
     /**
-     * @hide
+     * Returns the test context that was set via {@link #setTestContext(Context)}.
      */
     public Context getTestContext() {
         return mTestContext;
diff --git a/test-mock/Android.bp b/test-mock/Android.bp
index 248c117..7d0f92f 100644
--- a/test-mock/Android.bp
+++ b/test-mock/Android.bp
@@ -37,6 +37,7 @@
         "android.test.mock",
     ],
     compile_dex: true,
+    default_to_stubs: true,
 }
 
 // Make the current.txt available for use by the cts/tests/signature tests.
diff --git a/test-mock/src/android/test/mock/MockContentProvider.java b/test-mock/src/android/test/mock/MockContentProvider.java
index d1d64d3..a5c254f 100644
--- a/test-mock/src/android/test/mock/MockContentProvider.java
+++ b/test-mock/src/android/test/mock/MockContentProvider.java
@@ -33,6 +33,7 @@
 import android.database.Cursor;
 import android.net.Uri;
 import android.os.AsyncTask;
+import android.os.Binder;
 import android.os.Bundle;
 import android.os.IBinder;
 import android.os.ICancellationSignal;
@@ -336,7 +337,7 @@
      * @hide
      */
     public IBinder getIContentProviderBinder() {
-        throw new UnsupportedOperationException("unimplemented mock method");
+        return new Binder();
     }
 
     /**
diff --git a/test-runner/Android.bp b/test-runner/Android.bp
index 75f5b5a..1f6db84 100644
--- a/test-runner/Android.bp
+++ b/test-runner/Android.bp
@@ -41,6 +41,7 @@
     ],
 
     compile_dex: true,
+    default_to_stubs: true,
 }
 
 // Build the android.test.runner-minus-junit library
diff --git a/test-runner/api/current.txt b/test-runner/api/current.txt
index c093ac7..5407b68 100644
--- a/test-runner/api/current.txt
+++ b/test-runner/api/current.txt
@@ -78,6 +78,7 @@
 
   @Deprecated public class InstrumentationTestRunner extends android.app.Instrumentation implements android.test.TestSuiteProvider {
     ctor @Deprecated public InstrumentationTestRunner();
+    method @Deprecated protected void addTestListener(junit.framework.TestListener);
     method @Deprecated public junit.framework.TestSuite getAllTests();
     method @Deprecated protected android.test.AndroidTestRunner getAndroidTestRunner();
     method @Deprecated public android.os.Bundle getArguments();
@@ -100,6 +101,13 @@
     method @Deprecated public java.util.List<android.content.Intent> getAndClearBroadcastIntents();
   }
 
+  @Deprecated public class LaunchPerformanceBase extends android.app.Instrumentation {
+    ctor @Deprecated public LaunchPerformanceBase();
+    method @Deprecated protected void LaunchApp();
+    field @Deprecated protected android.content.Intent mIntent;
+    field @Deprecated protected android.os.Bundle mResults;
+  }
+
   public class LoaderTestCase extends android.test.AndroidTestCase {
     ctor public LoaderTestCase();
     method public <T> T getLoaderResultSynchronously(android.content.Loader<T>);
@@ -285,6 +293,11 @@
     method @Deprecated public void testSuiteConstructionFailed();
   }
 
+  @Deprecated public class UnitTestSuiteBuilder extends android.test.suitebuilder.TestSuiteBuilder {
+    ctor @Deprecated public UnitTestSuiteBuilder(Class);
+    ctor @Deprecated public UnitTestSuiteBuilder(String, ClassLoader);
+  }
+
 }
 
 package junit.runner {
diff --git a/test-runner/src/android/test/InstrumentationTestRunner.java b/test-runner/src/android/test/InstrumentationTestRunner.java
index b2582c1..07e3f87 100644
--- a/test-runner/src/android/test/InstrumentationTestRunner.java
+++ b/test-runner/src/android/test/InstrumentationTestRunner.java
@@ -410,7 +410,6 @@
 
     /**
      * Add a {@link TestListener}
-     * @hide
      */
     protected void addTestListener(TestListener listener){
         if(mTestRunner!=null && listener!=null){
diff --git a/test-runner/src/android/test/LaunchPerformanceBase.java b/test-runner/src/android/test/LaunchPerformanceBase.java
index 62c90d6..d87a811 100644
--- a/test-runner/src/android/test/LaunchPerformanceBase.java
+++ b/test-runner/src/android/test/LaunchPerformanceBase.java
@@ -23,12 +23,11 @@
 
 /**
  * Base class for all launch performance Instrumentation classes.
- *
- * @hide
  */
 @Deprecated
 public class LaunchPerformanceBase extends Instrumentation {
 
+    /** @hide */
     public static final String LOG_TAG = "Launch Performance";
 
     protected Bundle mResults;
@@ -43,8 +42,6 @@
 
     /**
      * Launches intent, and waits for idle before returning.
-     *
-     * @hide
      */
     protected void LaunchApp() {
         startActivitySync(mIntent);
diff --git a/test-runner/src/android/test/suitebuilder/UnitTestSuiteBuilder.java b/test-runner/src/android/test/suitebuilder/UnitTestSuiteBuilder.java
index a746b35..ea7405b 100644
--- a/test-runner/src/android/test/suitebuilder/UnitTestSuiteBuilder.java
+++ b/test-runner/src/android/test/suitebuilder/UnitTestSuiteBuilder.java
@@ -19,8 +19,9 @@
 /**
  * A suite builder that finds unit tests.
  *
- * {@hide} Not needed for 1.0 SDK.
+ * @deprecated android.test.runner is obsolete
  */
+@Deprecated
 public class UnitTestSuiteBuilder extends TestSuiteBuilder {
 
     public UnitTestSuiteBuilder(Class clazz) {
diff --git a/test-runner/tests/Android.bp b/test-runner/tests/Android.bp
index 03c7398..d74cee4 100644
--- a/test-runner/tests/Android.bp
+++ b/test-runner/tests/Android.bp
@@ -25,7 +25,7 @@
     //
 
     libs: [
-        "android.test.runner",
+        "android.test.runner.impl",
         "android.test.base",
         "android.test.mock",
     ],
diff --git a/tests/Camera2Tests/SmartCamera/SimpleCamera/jni/Android.bp b/tests/Camera2Tests/SmartCamera/SimpleCamera/jni/Android.bp
index a23ac38..125deb5 100644
--- a/tests/Camera2Tests/SmartCamera/SimpleCamera/jni/Android.bp
+++ b/tests/Camera2Tests/SmartCamera/SimpleCamera/jni/Android.bp
@@ -33,5 +33,6 @@
         "-Werror",
         "-Wno-unused-parameter",
     ],
+    header_libs: ["jni_headers"],
     stl: "c++_static",
 }
diff --git a/tests/FlickerTests/AndroidTest.xml b/tests/FlickerTests/AndroidTest.xml
index d1da47f..a331ec5 100644
--- a/tests/FlickerTests/AndroidTest.xml
+++ b/tests/FlickerTests/AndroidTest.xml
@@ -9,6 +9,14 @@
         <option name="screen-always-on" value="on" />
         <!-- prevents the phone from restarting -->
         <option name="force-skip-system-props" value="true" />
+        <!-- set WM tracing verbose level to all -->
+        <option name="run-command" value="adb shell cmd window tracing level all" />
+        <!-- inform WM to log all transactions -->
+        <option name="run-command" value="adb shell cmd window tracing transaction" />
+    </target_preparer>
+    <target_preparer class="com.android.tradefed.targetprep.DeviceCleaner">
+        <!-- keeps the screen on during tests -->
+        <option name="cleanup-action" value="REBOOT" />
     </target_preparer>
     <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true"/>
diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/ChangeAppRotationTest.java b/tests/FlickerTests/src/com/android/server/wm/flicker/ChangeAppRotationTest.java
index 5a66e80..ad64840 100644
--- a/tests/FlickerTests/src/com/android/server/wm/flicker/ChangeAppRotationTest.java
+++ b/tests/FlickerTests/src/com/android/server/wm/flicker/ChangeAppRotationTest.java
@@ -144,6 +144,19 @@
         );
     }
 
+    @Test
+    public void checkVisibility_screenshotLayerBecomesInvisible() {
+        checkResults(result -> LayersTraceSubject.assertThat(result)
+                .showsLayer(mTestApp.getPackage())
+                .then()
+                .replaceVisibleLayer(mTestApp.getPackage(), "Screenshot")
+                .then()
+                .showsLayer(mTestApp.getPackage()).and().showsLayer("Screenshot")
+                .then()
+                .replaceVisibleLayer("Screenshot", mTestApp.getPackage())
+                .forAllEntries());
+    }
+
     @FlakyTest(bugId = 140855415)
     @Ignore("Waiting bug feedback")
     @Test
diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/CommonTransitions.java b/tests/FlickerTests/src/com/android/server/wm/flicker/CommonTransitions.java
index e033d0a..0201a95 100644
--- a/tests/FlickerTests/src/com/android/server/wm/flicker/CommonTransitions.java
+++ b/tests/FlickerTests/src/com/android/server/wm/flicker/CommonTransitions.java
@@ -20,7 +20,6 @@
 import static android.view.Surface.rotationToString;
 
 import static com.android.server.wm.flicker.helpers.AutomationUtils.clearRecents;
-import static com.android.server.wm.flicker.helpers.AutomationUtils.closePipWindow;
 import static com.android.server.wm.flicker.helpers.AutomationUtils.exitSplitScreen;
 import static com.android.server.wm.flicker.helpers.AutomationUtils.expandPipWindow;
 import static com.android.server.wm.flicker.helpers.AutomationUtils.launchSplitScreen;
@@ -176,11 +175,15 @@
                 .repeat(ITERATIONS);
     }
 
-    static TransitionBuilder appToSplitScreen(IAppHelper testApp, UiDevice device) {
+    static TransitionBuilder appToSplitScreen(IAppHelper testApp, UiDevice device,
+            int beginRotation) {
+        final String testTag = "appToSplitScreen_" + testApp.getLauncherName() + "_"
+                + rotationToString(beginRotation);
         return TransitionRunner.newBuilder()
-                .withTag("appToSplitScreen_" + testApp.getLauncherName())
+                .withTag(testTag)
                 .recordAllRuns()
                 .runBeforeAll(AutomationUtils::wakeUpAndGoToHomeScreen)
+                .runBeforeAll(() -> setRotation(device, beginRotation))
                 .runBefore(testApp::open)
                 .runBefore(device::waitForIdle)
                 .runBefore(() -> sleep(500))
@@ -285,41 +288,52 @@
                 .repeat(ITERATIONS);
     }
 
-    static TransitionBuilder enterPipMode(PipAppHelper testApp, UiDevice device) {
+    static TransitionBuilder enterPipMode(PipAppHelper testApp, UiDevice device,
+            int beginRotation) {
         return TransitionRunner.newBuilder()
-                .withTag("enterPipMode_" + testApp.getLauncherName())
+                .withTag("enterPipMode_" + testApp.getLauncherName()
+                        + rotationToString(beginRotation))
                 .runBeforeAll(AutomationUtils::wakeUpAndGoToHomeScreen)
                 .runBefore(device::pressHome)
+                .runBefore(() -> setRotation(device, beginRotation))
                 .runBefore(testApp::open)
                 .run(() -> testApp.clickEnterPipButton(device))
-                .runAfter(() -> closePipWindow(device))
+                .runAfter(() -> testApp.closePipWindow(device))
                 .runAfterAll(testApp::exit)
                 .repeat(ITERATIONS);
     }
 
-    static TransitionBuilder exitPipModeToHome(PipAppHelper testApp, UiDevice device) {
+    static TransitionBuilder exitPipModeToHome(PipAppHelper testApp, UiDevice device,
+            int beginRotation) {
         return TransitionRunner.newBuilder()
-                .withTag("exitPipModeToHome_" + testApp.getLauncherName())
+                .withTag("exitPipModeToHome_" + testApp.getLauncherName()
+                        + rotationToString(beginRotation))
+                .recordAllRuns()
                 .runBeforeAll(AutomationUtils::wakeUpAndGoToHomeScreen)
                 .runBefore(device::pressHome)
+                .runBefore(() -> setRotation(device, beginRotation))
                 .runBefore(testApp::open)
-                .runBefore(() -> testApp.clickEnterPipButton(device))
-                .run(() -> closePipWindow(device))
+                .run(() -> testApp.clickEnterPipButton(device))
+                .run(() -> testApp.closePipWindow(device))
                 .run(device::waitForIdle)
-                .runAfterAll(testApp::exit)
+                .run(testApp::exit)
                 .repeat(ITERATIONS);
     }
 
-    static TransitionBuilder exitPipModeToApp(PipAppHelper testApp, UiDevice device) {
+    static TransitionBuilder exitPipModeToApp(PipAppHelper testApp, UiDevice device,
+            int beginRotation) {
         return TransitionRunner.newBuilder()
-                .withTag("exitPipModeToApp_" + testApp.getLauncherName())
+                .withTag("exitPipModeToApp_" + testApp.getLauncherName()
+                        + rotationToString(beginRotation))
+                .recordAllRuns()
                 .runBeforeAll(AutomationUtils::wakeUpAndGoToHomeScreen)
-                .runBefore(device::pressHome)
-                .runBefore(testApp::open)
-                .runBefore(() -> testApp.clickEnterPipButton(device))
+                .run(device::pressHome)
+                .run(() -> setRotation(device, beginRotation))
+                .run(testApp::open)
+                .run(() -> testApp.clickEnterPipButton(device))
                 .run(() -> expandPipWindow(device))
                 .run(device::waitForIdle)
-                .runAfterAll(testApp::exit)
+                .run(testApp::exit)
                 .repeat(ITERATIONS);
     }
 }
diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/DebugTest.java b/tests/FlickerTests/src/com/android/server/wm/flicker/DebugTest.java
index 8f0177c..666a0b9 100644
--- a/tests/FlickerTests/src/com/android/server/wm/flicker/DebugTest.java
+++ b/tests/FlickerTests/src/com/android/server/wm/flicker/DebugTest.java
@@ -94,7 +94,8 @@
      */
     @Test
     public void openAppToSplitScreen() {
-        CommonTransitions.appToSplitScreen(testApp, uiDevice).includeJankyRuns().recordAllRuns()
+        CommonTransitions.appToSplitScreen(testApp, uiDevice,
+                Surface.ROTATION_0).includeJankyRuns().recordAllRuns()
                 .build().run();
     }
 
@@ -116,7 +117,7 @@
         ImeAppHelper bottomApp = new ImeAppHelper(InstrumentationRegistry.getInstrumentation());
         CommonTransitions.resizeSplitScreen(testApp, bottomApp, uiDevice, Surface.ROTATION_0,
                 new Rational(1, 3), new Rational(2, 3))
-                .includeJankyRuns().recordEachRun().build().run();
+                .includeJankyRuns().build().run();
     }
 
     // IME tests
@@ -128,7 +129,7 @@
     public void editTextSetFocus() {
         ImeAppHelper testApp = new ImeAppHelper(InstrumentationRegistry.getInstrumentation());
         CommonTransitions.editTextSetFocus(testApp, uiDevice, Surface.ROTATION_0)
-                .includeJankyRuns().recordEachRun()
+                .includeJankyRuns()
                 .build().run();
     }
 
@@ -139,7 +140,7 @@
     public void editTextLoseFocusToHome() {
         ImeAppHelper testApp = new ImeAppHelper(InstrumentationRegistry.getInstrumentation());
         CommonTransitions.editTextLoseFocusToHome(testApp, uiDevice, Surface.ROTATION_0)
-                .includeJankyRuns().recordEachRun()
+                .includeJankyRuns()
                 .build().run();
     }
 
@@ -150,7 +151,7 @@
     public void editTextLoseFocusToApp() {
         ImeAppHelper testApp = new ImeAppHelper(InstrumentationRegistry.getInstrumentation());
         CommonTransitions.editTextLoseFocusToHome(testApp, uiDevice, Surface.ROTATION_0)
-                .includeJankyRuns().recordEachRun()
+                .includeJankyRuns()
                 .build().run();
     }
 
@@ -162,7 +163,7 @@
     @Test
     public void enterPipMode() {
         PipAppHelper testApp = new PipAppHelper(InstrumentationRegistry.getInstrumentation());
-        CommonTransitions.enterPipMode(testApp, uiDevice).includeJankyRuns().recordEachRun()
+        CommonTransitions.enterPipMode(testApp, uiDevice, Surface.ROTATION_0).includeJankyRuns()
                 .build().run();
     }
 
@@ -172,7 +173,8 @@
     @Test
     public void exitPipModeToHome() {
         PipAppHelper testApp = new PipAppHelper(InstrumentationRegistry.getInstrumentation());
-        CommonTransitions.exitPipModeToHome(testApp, uiDevice).includeJankyRuns().recordEachRun()
+        CommonTransitions.exitPipModeToHome(testApp, uiDevice, Surface.ROTATION_0)
+                .includeJankyRuns()
                 .build().run();
     }
 
@@ -182,7 +184,7 @@
     @Test
     public void exitPipModeToApp() {
         PipAppHelper testApp = new PipAppHelper(InstrumentationRegistry.getInstrumentation());
-        CommonTransitions.exitPipModeToApp(testApp, uiDevice).includeJankyRuns().recordEachRun()
+        CommonTransitions.exitPipModeToApp(testApp, uiDevice, Surface.ROTATION_0).includeJankyRuns()
                 .build().run();
     }
 }
diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/FlickerTestBase.java b/tests/FlickerTests/src/com/android/server/wm/flicker/FlickerTestBase.java
index 883d59e..4578fa3 100644
--- a/tests/FlickerTests/src/com/android/server/wm/flicker/FlickerTestBase.java
+++ b/tests/FlickerTests/src/com/android/server/wm/flicker/FlickerTestBase.java
@@ -89,7 +89,7 @@
                         }
                         if (result.screenCaptureVideoExists()) {
                             Log.e(TAG, "Screen capture video saved to " + result
-                                    .screenCaptureVideo.toString());
+                                    .screenCaptureVideoPath().toString());
                         }
                     }
                 });
diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/OpenAppColdTest.java b/tests/FlickerTests/src/com/android/server/wm/flicker/OpenAppColdTest.java
index efdfaee..2981ff9 100644
--- a/tests/FlickerTests/src/com/android/server/wm/flicker/OpenAppColdTest.java
+++ b/tests/FlickerTests/src/com/android/server/wm/flicker/OpenAppColdTest.java
@@ -19,6 +19,8 @@
 import static com.android.server.wm.flicker.CommonTransitions.openAppCold;
 import static com.android.server.wm.flicker.WmTraceSubject.assertThat;
 
+import android.view.Surface;
+
 import androidx.test.InstrumentationRegistry;
 import androidx.test.filters.FlakyTest;
 import androidx.test.filters.LargeTest;
@@ -76,10 +78,20 @@
 
     @Test
     public void checkVisibility_wallpaperLayerBecomesInvisible() {
-        checkResults(result -> LayersTraceSubject.assertThat(result)
-                .showsLayer("Wallpaper")
-                .then()
-                .hidesLayer("Wallpaper")
-                .forAllEntries());
+        if (mBeginRotation == Surface.ROTATION_0) {
+            checkResults(result -> LayersTraceSubject.assertThat(result)
+                    .showsLayer("Wallpaper")
+                    .then()
+                    .replaceVisibleLayer("Wallpaper", mTestApp.getPackage())
+                    .forAllEntries());
+        } else {
+            checkResults(result -> LayersTraceSubject.assertThat(result)
+                    .showsLayer("Wallpaper")
+                    .then()
+                    .replaceVisibleLayer("Wallpaper", "Screenshot")
+                    .then()
+                    .showsLayer(mTestApp.getPackage())
+                    .forAllEntries());
+        }
     }
 }
diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/OpenAppToSplitScreenTest.java b/tests/FlickerTests/src/com/android/server/wm/flicker/OpenAppToSplitScreenTest.java
index f8b7938..ddead6d 100644
--- a/tests/FlickerTests/src/com/android/server/wm/flicker/OpenAppToSplitScreenTest.java
+++ b/tests/FlickerTests/src/com/android/server/wm/flicker/OpenAppToSplitScreenTest.java
@@ -17,35 +17,38 @@
 package com.android.server.wm.flicker;
 
 import static com.android.server.wm.flicker.CommonTransitions.appToSplitScreen;
-import static com.android.server.wm.flicker.WindowUtils.getDisplayBounds;
 
 import androidx.test.InstrumentationRegistry;
 import androidx.test.filters.LargeTest;
-import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Before;
 import org.junit.FixMethodOrder;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.junit.runners.MethodSorters;
+import org.junit.runners.Parameterized;
 
 /**
  * Test open app to split screen.
  * To run this test: {@code atest FlickerTests:OpenAppToSplitScreenTest}
  */
 @LargeTest
-@RunWith(AndroidJUnit4.class)
+@RunWith(Parameterized.class)
 @FixMethodOrder(MethodSorters.NAME_ASCENDING)
-public class OpenAppToSplitScreenTest extends FlickerTestBase {
+public class OpenAppToSplitScreenTest extends NonRotationTestBase {
 
-    public OpenAppToSplitScreenTest() {
+    public OpenAppToSplitScreenTest(String beginRotationName, int beginRotation) {
+        super(beginRotationName, beginRotation);
+
         this.mTestApp = new StandardAppHelper(InstrumentationRegistry.getInstrumentation(),
                 "com.android.server.wm.flicker.testapp", "SimpleApp");
     }
 
     @Before
     public void runTransition() {
-        super.runTransition(appToSplitScreen(mTestApp, mUiDevice).includeJankyRuns().build());
+        super.runTransition(appToSplitScreen(mTestApp, mUiDevice, mBeginRotation)
+                .includeJankyRuns()
+                .build());
     }
 
     @Test
@@ -70,25 +73,6 @@
     }
 
     @Test
-    public void checkCoveredRegion_noUncoveredRegions() {
-        checkResults(result ->
-                LayersTraceSubject.assertThat(result)
-                        .coversRegion(getDisplayBounds()).forAllEntries());
-    }
-
-    @Test
-    public void checkVisibility_navBarLayerIsAlwaysVisible() {
-        checkResults(result -> LayersTraceSubject.assertThat(result)
-                .showsLayer(NAVIGATION_BAR_WINDOW_TITLE).forAllEntries());
-    }
-
-    @Test
-    public void checkVisibility_statusBarLayerIsAlwaysVisible() {
-        checkResults(result -> LayersTraceSubject.assertThat(result)
-                .showsLayer(STATUS_BAR_WINDOW_TITLE).forAllEntries());
-    }
-
-    @Test
     public void checkVisibility_dividerLayerBecomesVisible() {
         checkResults(result -> LayersTraceSubject.assertThat(result)
                 .hidesLayer(DOCKED_STACK_DIVIDER)
diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/OpenAppWarmTest.java b/tests/FlickerTests/src/com/android/server/wm/flicker/OpenAppWarmTest.java
index 7ce6315..bb684d1 100644
--- a/tests/FlickerTests/src/com/android/server/wm/flicker/OpenAppWarmTest.java
+++ b/tests/FlickerTests/src/com/android/server/wm/flicker/OpenAppWarmTest.java
@@ -19,6 +19,8 @@
 import static com.android.server.wm.flicker.CommonTransitions.openAppWarm;
 import static com.android.server.wm.flicker.WmTraceSubject.assertThat;
 
+import android.view.Surface;
+
 import androidx.test.InstrumentationRegistry;
 import androidx.test.filters.FlakyTest;
 import androidx.test.filters.LargeTest;
@@ -76,10 +78,20 @@
 
     @Test
     public void checkVisibility_wallpaperLayerBecomesInvisible() {
-        checkResults(result -> LayersTraceSubject.assertThat(result)
-                .showsLayer("Wallpaper")
-                .then()
-                .hidesLayer("Wallpaper")
-                .forAllEntries());
+        if (mBeginRotation == Surface.ROTATION_0) {
+            checkResults(result -> LayersTraceSubject.assertThat(result)
+                    .showsLayer("Wallpaper")
+                    .then()
+                    .replaceVisibleLayer("Wallpaper", mTestApp.getPackage())
+                    .forAllEntries());
+        } else {
+            checkResults(result -> LayersTraceSubject.assertThat(result)
+                    .showsLayer("Wallpaper")
+                    .then()
+                    .replaceVisibleLayer("Wallpaper", "Screenshot")
+                    .then()
+                    .showsLayer(mTestApp.getPackage())
+                    .forAllEntries());
+        }
     }
 }
diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/PipToAppTest.java b/tests/FlickerTests/src/com/android/server/wm/flicker/PipToAppTest.java
new file mode 100644
index 0000000..85706bd
--- /dev/null
+++ b/tests/FlickerTests/src/com/android/server/wm/flicker/PipToAppTest.java
@@ -0,0 +1,89 @@
+/*
+ * Copyright (C) 2019 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 com.android.server.wm.flicker;
+
+import static com.android.server.wm.flicker.CommonTransitions.exitPipModeToApp;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.LargeTest;
+
+import com.android.server.wm.flicker.helpers.PipAppHelper;
+
+import org.junit.Before;
+import org.junit.FixMethodOrder;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.MethodSorters;
+import org.junit.runners.Parameterized;
+
+/**
+ * Test Pip launch.
+ * To run this test: {@code atest FlickerTests:PipToAppTest}
+ */
+@LargeTest
+@RunWith(Parameterized.class)
+@FixMethodOrder(MethodSorters.NAME_ASCENDING)
+public class PipToAppTest extends NonRotationTestBase {
+
+    static final String sPipWindowTitle = "PipMenuActivity";
+
+    public PipToAppTest(String beginRotationName, int beginRotation) {
+        super(beginRotationName, beginRotation);
+
+        this.mTestApp = new PipAppHelper(InstrumentationRegistry.getInstrumentation());
+    }
+
+    @Before
+    public void runTransition() {
+        run(exitPipModeToApp((PipAppHelper) mTestApp, mUiDevice, mBeginRotation)
+                .includeJankyRuns().build());
+    }
+
+    @Test
+    public void checkVisibility_pipWindowBecomesVisible() {
+        checkResults(result -> WmTraceSubject.assertThat(result)
+                .skipUntilFirstAssertion()
+                .showsAppWindowOnTop(sPipWindowTitle)
+                .then()
+                .hidesAppWindow(sPipWindowTitle)
+                .forAllEntries());
+    }
+
+    @Test
+    public void checkVisibility_pipLayerBecomesVisible() {
+        checkResults(result -> LayersTraceSubject.assertThat(result)
+                .skipUntilFirstAssertion()
+                .showsLayer(sPipWindowTitle)
+                .then()
+                .hidesLayer(sPipWindowTitle)
+                .forAllEntries());
+    }
+
+    @Test
+    public void checkVisibility_backgroundWindowVisibleBehindPipLayer() {
+        checkResults(result -> WmTraceSubject.assertThat(result)
+                .skipUntilFirstAssertion()
+                .showsAppWindowOnTop(sPipWindowTitle)
+                .then()
+                .showsBelowAppWindow("Wallpaper")
+                .then()
+                .showsAppWindowOnTop(mTestApp.getPackage())
+                .then()
+                .hidesAppWindowOnTop(mTestApp.getPackage())
+                .forAllEntries());
+    }
+}
diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/PipToHomeTest.java b/tests/FlickerTests/src/com/android/server/wm/flicker/PipToHomeTest.java
new file mode 100644
index 0000000..ef856dc
--- /dev/null
+++ b/tests/FlickerTests/src/com/android/server/wm/flicker/PipToHomeTest.java
@@ -0,0 +1,93 @@
+/*
+ * Copyright (C) 2019 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 com.android.server.wm.flicker;
+
+import static com.android.server.wm.flicker.CommonTransitions.exitPipModeToHome;
+
+import android.view.Surface;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.LargeTest;
+import androidx.test.runner.AndroidJUnit4;
+
+import com.android.server.wm.flicker.helpers.PipAppHelper;
+
+import org.junit.Before;
+import org.junit.FixMethodOrder;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.MethodSorters;
+
+/**
+ * Test Pip launch.
+ * To run this test: {@code atest FlickerTests:PipToHomeTest}
+ */
+@LargeTest
+@RunWith(AndroidJUnit4.class)
+@FixMethodOrder(MethodSorters.NAME_ASCENDING)
+public class PipToHomeTest extends FlickerTestBase {
+
+    static final String sPipWindowTitle = "PipActivity";
+
+    // public PipToHomeTest(String beginRotationName, int beginRotation) {
+    public PipToHomeTest() {
+        // super(beginRotationName, beginRotation);
+
+        this.mTestApp = new PipAppHelper(InstrumentationRegistry.getInstrumentation());
+    }
+
+    @Before
+    public void runTransition() {
+        // run(exitPipModeToHome((PipAppHelper) mTestApp, mUiDevice, mBeginRotation)
+        run(exitPipModeToHome((PipAppHelper) mTestApp, mUiDevice, Surface.ROTATION_0)
+                .includeJankyRuns().build());
+    }
+
+    @Ignore
+    @Test
+    public void checkVisibility_pipWindowBecomesVisible() {
+        checkResults(result -> WmTraceSubject.assertThat(result)
+                .skipUntilFirstAssertion()
+                .showsAppWindowOnTop(sPipWindowTitle)
+                .then()
+                .hidesAppWindow(sPipWindowTitle)
+                .forAllEntries());
+    }
+
+    @Test
+    public void checkVisibility_pipLayerBecomesVisible() {
+        checkResults(result -> LayersTraceSubject.assertThat(result)
+                .skipUntilFirstAssertion()
+                .showsLayer(sPipWindowTitle)
+                .then()
+                .hidesLayer(sPipWindowTitle)
+                .forAllEntries());
+    }
+
+    @Ignore
+    @Test
+    public void checkVisibility_backgroundWindowVisibleBehindPipLayer() {
+        checkResults(result -> WmTraceSubject.assertThat(result)
+                .showsAppWindowOnTop(sPipWindowTitle)
+                .then()
+                .showsBelowAppWindow("Wallpaper")
+                .then()
+                .showsAppWindowOnTop("Wallpaper")
+                .forAllEntries());
+    }
+}
diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/ResizeSplitScreenTest.java b/tests/FlickerTests/src/com/android/server/wm/flicker/ResizeSplitScreenTest.java
index 29b6240..e36701b 100644
--- a/tests/FlickerTests/src/com/android/server/wm/flicker/ResizeSplitScreenTest.java
+++ b/tests/FlickerTests/src/com/android/server/wm/flicker/ResizeSplitScreenTest.java
@@ -95,7 +95,7 @@
         Rect displayBounds = getDisplayBounds();
         checkResults(result -> {
             LayersTrace entries = LayersTrace.parseFrom(result.getLayersTrace(),
-                    result.getLayersTracePath());
+                    result.getLayersTracePath(), result.getLayersTraceChecksum());
 
             assertThat(entries.getEntries()).isNotEmpty();
             Rect startingDividerBounds = entries.getEntries().get(0).getVisibleBounds
@@ -124,7 +124,7 @@
         Rect displayBounds = getDisplayBounds();
         checkResults(result -> {
             LayersTrace entries = LayersTrace.parseFrom(result.getLayersTrace(),
-                    result.getLayersTracePath());
+                    result.getLayersTracePath(), result.getLayersTraceChecksum());
 
             assertThat(entries.getEntries()).isNotEmpty();
             Rect endingDividerBounds = entries.getEntries().get(
diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/PipAppHelper.java b/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/PipAppHelper.java
index d00e11b..d5f9a20 100644
--- a/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/PipAppHelper.java
+++ b/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/PipAppHelper.java
@@ -40,4 +40,8 @@
         }
     }
 
+    public void closePipWindow(UiDevice device) {
+        AutomationUtils.closePipWindow(device);
+    }
+
 }
diff --git a/tests/GamePerformance/Android.bp b/tests/GamePerformance/Android.bp
new file mode 100644
index 0000000..648fd81
--- /dev/null
+++ b/tests/GamePerformance/Android.bp
@@ -0,0 +1,32 @@
+// Copyright (C) 2018 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.
+
+android_test_helper_app {
+    name: "GamePerformance",
+    // Don't include this package in any target
+    dex_preopt: {
+        enabled: false,
+    },
+    optimize: {
+        enabled: false,
+    },
+    srcs: ["src/**/*.java"],
+    static_libs: ["android-support-test"],
+    libs: [
+        "android.test.base",
+        "android.test.runner",
+    ],
+    platform_apis: true,
+    certificate: "platform",
+}
diff --git a/tests/GamePerformance/Android.mk b/tests/GamePerformance/Android.mk
deleted file mode 100644
index 58654de..0000000
--- a/tests/GamePerformance/Android.mk
+++ /dev/null
@@ -1,39 +0,0 @@
-# Copyright (C) 2018 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.
-
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-
-# Don't include this package in any target
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_DEX_PREOPT := false
-
-LOCAL_PROGUARD_ENABLED := disabled
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
-
-LOCAL_JAVA_LIBRARIES := android.test.base android.test.runner
-
-LOCAL_PACKAGE_NAME := GamePerformance
-
-LOCAL_PRIVATE_PLATFORM_APIS := true
-
-LOCAL_CERTIFICATE := platform
-
-
-include $(BUILD_PACKAGE)
diff --git a/tests/ProtoInputStreamTests/Android.bp b/tests/ProtoInputStreamTests/Android.bp
new file mode 100644
index 0000000..ecc40566
--- /dev/null
+++ b/tests/ProtoInputStreamTests/Android.bp
@@ -0,0 +1,33 @@
+// Copyright (C) 2019 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.
+
+android_test {
+    name: "ProtoInputStreamTests",
+    proto: {
+        type: "nano",
+    },
+    srcs: [
+        "src/**/*.java",
+        "src/**/*.proto",
+    ],
+    platform_apis: true,
+    certificate: "platform",
+    test_suites: ["device-tests"],
+    libs: ["android.test.runner"],
+    static_libs: [
+        "androidx.test.rules",
+        "frameworks-base-testutils",
+        "mockito-target-minus-junit4",
+    ],
+}
diff --git a/tests/ProtoInputStreamTests/Android.mk b/tests/ProtoInputStreamTests/Android.mk
deleted file mode 100644
index eb747cc..0000000
--- a/tests/ProtoInputStreamTests/Android.mk
+++ /dev/null
@@ -1,34 +0,0 @@
-# Copyright (C) 2019 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.
-
-LOCAL_PATH := $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_PACKAGE_NAME := ProtoInputStreamTests
-LOCAL_PROTOC_OPTIMIZE_TYPE := nano
-LOCAL_MODULE_TAGS := tests optional
-LOCAL_SRC_FILES := \
-    $(call all-java-files-under, src) \
-    $(call all-proto-files-under, src)
-LOCAL_PRIVATE_PLATFORM_APIS := true
-LOCAL_CERTIFICATE := platform
-LOCAL_COMPATIBILITY_SUITE := device-tests
-
-LOCAL_JAVA_LIBRARIES := android.test.runner
-LOCAL_STATIC_JAVA_LIBRARIES := \
-    androidx.test.rules \
-    frameworks-base-testutils \
-    mockito-target-minus-junit4
-
-include $(BUILD_PACKAGE)
\ No newline at end of file
diff --git a/tests/net/common/java/android/net/MatchAllNetworkSpecifierTest.kt b/tests/net/common/java/android/net/MatchAllNetworkSpecifierTest.kt
index ef15b66..a50f046 100644
--- a/tests/net/common/java/android/net/MatchAllNetworkSpecifierTest.kt
+++ b/tests/net/common/java/android/net/MatchAllNetworkSpecifierTest.kt
@@ -39,12 +39,12 @@
     }
 
     @Test(expected = IllegalStateException::class)
-    fun testSatisfiedBy() {
+    fun testCanBeSatisfiedBy() {
         val specifier = MatchAllNetworkSpecifier()
         val discoverySession = Mockito.mock(DiscoverySession::class.java)
         val peerHandle = Mockito.mock(PeerHandle::class.java)
         val wifiAwareNetworkSpecifier = WifiAwareNetworkSpecifier.Builder(discoverySession,
                 peerHandle).build()
-        specifier.satisfiedBy(wifiAwareNetworkSpecifier)
+        specifier.canBeSatisfiedBy(wifiAwareNetworkSpecifier)
     }
 }
diff --git a/tests/net/integration/AndroidManifest.xml b/tests/net/integration/AndroidManifest.xml
index 09c0e48..f5a4234 100644
--- a/tests/net/integration/AndroidManifest.xml
+++ b/tests/net/integration/AndroidManifest.xml
@@ -16,50 +16,55 @@
  * limitations under the License.
  */
 -->
+
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
-          package="com.android.server.net.integrationtests">
+     package="com.android.server.net.integrationtests">
 
     <!-- For ConnectivityService registerReceiverAsUser (receiving broadcasts) -->
-    <uses-permission android:name="android.permission.INTERACT_ACROSS_USERS_FULL" />
+    <uses-permission android:name="android.permission.INTERACT_ACROSS_USERS_FULL"/>
     <!-- PermissionMonitor sets network permissions for each user -->
-    <uses-permission android:name="android.permission.MANAGE_USERS" />
+    <uses-permission android:name="android.permission.MANAGE_USERS"/>
     <!-- ConnectivityService sends notifications to BatteryStats -->
-    <uses-permission android:name="android.permission.UPDATE_DEVICE_STATS" />
+    <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.NETWORK_FACTORY" />
-    <uses-permission android:name="android.permission.NETWORK_STACK" />
-    <uses-permission android:name="android.permission.OBSERVE_NETWORK_POLICY" />
-    <uses-permission android:name="android.permission.READ_PRIVILEGED_PHONE_STATE" />
+    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
+    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
+    <uses-permission android:name="android.permission.NETWORK_FACTORY"/>
+    <!-- Obtain LinkProperties callbacks with sensitive fields -->
+    <uses-permission android:name="android.permission.NETWORK_SETTINGS" />
+    <uses-permission android:name="android.permission.NETWORK_STACK"/>
+    <uses-permission android:name="android.permission.OBSERVE_NETWORK_POLICY"/>
+    <uses-permission android:name="android.permission.READ_PRIVILEGED_PHONE_STATE"/>
     <!-- Reading DeviceConfig flags -->
-    <uses-permission android:name="android.permission.READ_DEVICE_CONFIG" />
+    <uses-permission android:name="android.permission.READ_DEVICE_CONFIG"/>
     <application android:debuggable="true">
-        <uses-library android:name="android.test.runner" />
+        <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 -->
+                         Remove the NetworkStackService from the base (real) manifest, and replace with a test
+                         service that responds to the same intent -->
         <service android:name=".TestNetworkStackService"
-                 android:process="com.android.server.net.integrationtests.testnetworkstack">
+             android:process="com.android.server.net.integrationtests.testnetworkstack"
+             android:exported="true">
             <intent-filter>
                 <action android:name="android.net.INetworkStackConnector.Test"/>
             </intent-filter>
         </service>
         <service android:name=".NetworkStackInstrumentationService"
-                 android:process="com.android.server.net.integrationtests.testnetworkstack">
+             android:process="com.android.server.net.integrationtests.testnetworkstack"
+             android:exported="true">
             <intent-filter>
                 <action android:name=".INetworkStackInstrumentation"/>
             </intent-filter>
         </service>
         <service android:name="com.android.server.connectivity.ipmemorystore.RegularMaintenanceJobService"
-                 android:process="com.android.server.net.integrationtests.testnetworkstack"
-                 android:permission="android.permission.BIND_JOB_SERVICE"/>
+             android:process="com.android.server.net.integrationtests.testnetworkstack"
+             android:permission="android.permission.BIND_JOB_SERVICE"/>
 
     </application>
 
     <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
-                     android:targetPackage="com.android.server.net.integrationtests"
-                     android:label="Frameworks Net Integration Tests" />
+         android:targetPackage="com.android.server.net.integrationtests"
+         android:label="Frameworks Net Integration Tests"/>
 
 </manifest>
diff --git a/tests/net/integration/src/com/android/server/net/integrationtests/ConnectivityServiceIntegrationTest.kt b/tests/net/integration/src/com/android/server/net/integrationtests/ConnectivityServiceIntegrationTest.kt
index c4801aa..bc069e1 100644
--- a/tests/net/integration/src/com/android/server/net/integrationtests/ConnectivityServiceIntegrationTest.kt
+++ b/tests/net/integration/src/com/android/server/net/integrationtests/ConnectivityServiceIntegrationTest.kt
@@ -28,10 +28,13 @@
 import android.net.INetworkPolicyManager
 import android.net.INetworkStatsService
 import android.net.LinkProperties
+import android.net.NetworkCapabilities.NET_CAPABILITY_CAPTIVE_PORTAL
 import android.net.NetworkCapabilities.NET_CAPABILITY_INTERNET
+import android.net.NetworkCapabilities.NET_CAPABILITY_VALIDATED
 import android.net.NetworkCapabilities.TRANSPORT_CELLULAR
 import android.net.NetworkRequest
 import android.net.TestNetworkStackClient
+import android.net.Uri
 import android.net.metrics.IpConnectivityLog
 import android.os.ConditionVariable
 import android.os.IBinder
@@ -64,6 +67,8 @@
 import org.mockito.MockitoAnnotations
 import org.mockito.Spy
 import kotlin.test.assertEquals
+import kotlin.test.assertFalse
+import kotlin.test.assertNotNull
 import kotlin.test.assertTrue
 import kotlin.test.fail
 
@@ -110,6 +115,10 @@
         private val bindingCondition = ConditionVariable(false)
 
         private val realContext get() = InstrumentationRegistry.getInstrumentation().context
+        private val httpProbeUrl get() =
+            realContext.getResources().getString(R.string.config_captive_portal_http_url)
+        private val httpsProbeUrl get() =
+            realContext.getResources().getString(R.string.config_captive_portal_https_url)
 
         private class InstrumentationServiceConnection : ServiceConnection {
             override fun onServiceConnected(name: ComponentName?, service: IBinder?) {
@@ -188,12 +197,8 @@
         val testCallback = TestableNetworkCallback()
 
         cm.registerNetworkCallback(request, testCallback)
-        nsInstrumentation.addHttpResponse(HttpResponse(
-                "http://test.android.com",
-                responseCode = 204, contentLength = 42, redirectUrl = null))
-        nsInstrumentation.addHttpResponse(HttpResponse(
-                "https://secure.test.android.com",
-                responseCode = 204, contentLength = 42, redirectUrl = null))
+        nsInstrumentation.addHttpResponse(HttpResponse(httpProbeUrl, responseCode = 204))
+        nsInstrumentation.addHttpResponse(HttpResponse(httpsProbeUrl, responseCode = 204))
 
         val na = NetworkAgentWrapper(TRANSPORT_CELLULAR, LinkProperties(), context)
         networkStackClient.verifyNetworkMonitorCreated(na.network, TEST_TIMEOUT_MS)
@@ -204,4 +209,52 @@
         testCallback.expectAvailableThenValidatedCallbacks(na.network, TEST_TIMEOUT_MS)
         assertEquals(2, nsInstrumentation.getRequestUrls().size)
     }
+
+    @Test
+    fun testCapportApi() {
+        val request = NetworkRequest.Builder()
+                .clearCapabilities()
+                .addCapability(NET_CAPABILITY_INTERNET)
+                .build()
+        val testCb = TestableNetworkCallback()
+        val apiUrl = "https://capport.android.com"
+
+        cm.registerNetworkCallback(request, testCb)
+        nsInstrumentation.addHttpResponse(HttpResponse(
+                apiUrl,
+                """
+                    |{
+                    |  "captive": true,
+                    |  "user-portal-url": "https://login.capport.android.com",
+                    |  "venue-info-url": "https://venueinfo.capport.android.com"
+                    |}
+                """.trimMargin()))
+
+        // Tests will fail if a non-mocked query is received: mock the HTTPS probe, but not the
+        // HTTP probe as it should not be sent.
+        // Even if the HTTPS probe succeeds, a portal should be detected as the API takes precedence
+        // in that case.
+        nsInstrumentation.addHttpResponse(HttpResponse(httpsProbeUrl, responseCode = 204))
+
+        val lp = LinkProperties()
+        lp.captivePortalApiUrl = Uri.parse(apiUrl)
+        val na = NetworkAgentWrapper(TRANSPORT_CELLULAR, lp, context)
+        networkStackClient.verifyNetworkMonitorCreated(na.network, TEST_TIMEOUT_MS)
+
+        na.addCapability(NET_CAPABILITY_INTERNET)
+        na.connect()
+
+        testCb.expectAvailableCallbacks(na.network, validated = false, tmt = TEST_TIMEOUT_MS)
+
+        val capportData = testCb.expectLinkPropertiesThat(na, TEST_TIMEOUT_MS) {
+            it.captivePortalData != null
+        }.lp.captivePortalData
+        assertNotNull(capportData)
+        assertTrue(capportData.isCaptive)
+        assertEquals(Uri.parse("https://login.capport.android.com"), capportData.userPortalUrl)
+        assertEquals(Uri.parse("https://venueinfo.capport.android.com"), capportData.venueInfoUrl)
+
+        val nc = testCb.expectCapabilitiesWith(NET_CAPABILITY_CAPTIVE_PORTAL, na, TEST_TIMEOUT_MS)
+        assertFalse(nc.hasCapability(NET_CAPABILITY_VALIDATED))
+    }
 }
\ No newline at end of file
diff --git a/tests/net/integration/src/com/android/server/net/integrationtests/HttpResponse.kt b/tests/net/integration/src/com/android/server/net/integrationtests/HttpResponse.kt
index 45073d8..e206313 100644
--- a/tests/net/integration/src/com/android/server/net/integrationtests/HttpResponse.kt
+++ b/tests/net/integration/src/com/android/server/net/integrationtests/HttpResponse.kt
@@ -22,16 +22,21 @@
 data class HttpResponse(
     val requestUrl: String,
     val responseCode: Int,
-    val contentLength: Long,
-    val redirectUrl: String?
+    val content: String = "",
+    val redirectUrl: String? = null
 ) : Parcelable {
-    constructor(p: Parcel): this(p.readString(), p.readInt(), p.readLong(), p.readString())
+    constructor(p: Parcel): this(p.readString(), p.readInt(), p.readString(), p.readString())
+    constructor(requestUrl: String, contentBody: String): this(
+            requestUrl,
+            responseCode = 200,
+            content = contentBody,
+            redirectUrl = null)
 
     override fun writeToParcel(dest: Parcel, flags: Int) {
         with(dest) {
             writeString(requestUrl)
             writeInt(responseCode)
-            writeLong(contentLength)
+            writeString(content)
             writeString(redirectUrl)
         }
     }
diff --git a/tests/net/integration/src/com/android/server/net/integrationtests/NetworkStackInstrumentationService.kt b/tests/net/integration/src/com/android/server/net/integrationtests/NetworkStackInstrumentationService.kt
index 4827d29..e807952 100644
--- a/tests/net/integration/src/com/android/server/net/integrationtests/NetworkStackInstrumentationService.kt
+++ b/tests/net/integration/src/com/android/server/net/integrationtests/NetworkStackInstrumentationService.kt
@@ -65,6 +65,9 @@
          *
          * <p>For any subsequent HTTP/HTTPS query, the first response with a matching URL will be
          * used to mock the query response.
+         *
+         * <p>All requests that are expected to be sent must have a mock response: if an unexpected
+         * request is seen, the test will fail.
          */
         override fun addHttpResponse(response: HttpResponse) {
             httpResponses.getValue(response.requestUrl).add(response)
diff --git a/tests/net/integration/src/com/android/server/net/integrationtests/TestNetworkStackService.kt b/tests/net/integration/src/com/android/server/net/integrationtests/TestNetworkStackService.kt
index 8c2de40..a44ad1e 100644
--- a/tests/net/integration/src/com/android/server/net/integrationtests/TestNetworkStackService.kt
+++ b/tests/net/integration/src/com/android/server/net/integrationtests/TestNetworkStackService.kt
@@ -33,9 +33,11 @@
 import org.mockito.Mockito.doReturn
 import org.mockito.Mockito.mock
 import org.mockito.Mockito.spy
+import java.io.ByteArrayInputStream
 import java.net.HttpURLConnection
 import java.net.URL
 import java.net.URLConnection
+import java.nio.charset.StandardCharsets
 
 private const val TEST_NETID = 42
 
@@ -71,11 +73,13 @@
         private inner class TestNetwork(netId: Int) : Network(netId) {
             override fun openConnection(url: URL): URLConnection {
                 val response = InstrumentationConnector.processRequest(url)
+                val responseBytes = response.content.toByteArray(StandardCharsets.UTF_8)
 
                 val connection = mock(HttpURLConnection::class.java)
                 doReturn(response.responseCode).`when`(connection).responseCode
-                doReturn(response.contentLength).`when`(connection).contentLengthLong
+                doReturn(responseBytes.size.toLong()).`when`(connection).contentLengthLong
                 doReturn(response.redirectUrl).`when`(connection).getHeaderField("location")
+                doReturn(ByteArrayInputStream(responseBytes)).`when`(connection).inputStream
                 return connection
             }
         }
diff --git a/tests/net/java/android/net/ConnectivityManagerTest.java b/tests/net/java/android/net/ConnectivityManagerTest.java
index d6bf334..d74a621 100644
--- a/tests/net/java/android/net/ConnectivityManagerTest.java
+++ b/tests/net/java/android/net/ConnectivityManagerTest.java
@@ -36,6 +36,7 @@
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
+import static org.mockito.ArgumentMatchers.nullable;
 import static org.mockito.Mockito.any;
 import static org.mockito.Mockito.anyBoolean;
 import static org.mockito.Mockito.anyInt;
@@ -213,7 +214,7 @@
 
         // register callback
         when(mService.requestNetwork(
-                any(), captor.capture(), anyInt(), any(), anyInt(), any()))
+                any(), captor.capture(), anyInt(), any(), anyInt(), any(), nullable(String.class)))
                 .thenReturn(request);
         manager.requestNetwork(request, callback, handler);
 
@@ -242,7 +243,7 @@
 
         // register callback
         when(mService.requestNetwork(
-                any(), captor.capture(), anyInt(), any(), anyInt(), any()))
+                any(), captor.capture(), anyInt(), any(), anyInt(), any(), nullable(String.class)))
                 .thenReturn(req1);
         manager.requestNetwork(req1, callback, handler);
 
@@ -261,7 +262,7 @@
 
         // callback can be registered again
         when(mService.requestNetwork(
-                any(), captor.capture(), anyInt(), any(), anyInt(), any()))
+                any(), captor.capture(), anyInt(), any(), anyInt(), any(), nullable(String.class)))
                 .thenReturn(req2);
         manager.requestNetwork(req2, callback, handler);
 
@@ -285,8 +286,8 @@
         info.targetSdkVersion = VERSION_CODES.N_MR1 + 1;
 
         when(mCtx.getApplicationInfo()).thenReturn(info);
-        when(mService.requestNetwork(any(), any(), anyInt(), any(), anyInt(), any()))
-                .thenReturn(request);
+        when(mService.requestNetwork(any(), any(), anyInt(), any(), anyInt(), any(),
+                nullable(String.class))).thenReturn(request);
 
         Handler handler = new Handler(Looper.getMainLooper());
         manager.requestNetwork(request, callback, handler);
diff --git a/tests/net/java/com/android/server/ConnectivityServiceTest.java b/tests/net/java/com/android/server/ConnectivityServiceTest.java
index 385005f..bc85374 100644
--- a/tests/net/java/com/android/server/ConnectivityServiceTest.java
+++ b/tests/net/java/com/android/server/ConnectivityServiceTest.java
@@ -3054,6 +3054,13 @@
         assertNoCallbacks(cEmpty1, cEmpty2, cEmpty3, cEmpty4, cFoo, cBar);
     }
 
+    /**
+     * @return the context's attribution tag
+     */
+    private String getAttributionTag() {
+        return null;
+    }
+
     @Test
     public void testInvalidNetworkSpecifier() {
         assertThrows(IllegalArgumentException.class, () -> {
@@ -3066,7 +3073,8 @@
             networkCapabilities.addTransportType(TRANSPORT_WIFI)
                     .setNetworkSpecifier(new MatchAllNetworkSpecifier());
             mService.requestNetwork(networkCapabilities, null, 0, null,
-                    ConnectivityManager.TYPE_WIFI, mContext.getPackageName());
+                    ConnectivityManager.TYPE_WIFI, mContext.getPackageName(),
+                    getAttributionTag());
         });
 
         class NonParcelableSpecifier extends NetworkSpecifier {
diff --git a/tests/net/java/com/android/server/LegacyTypeTrackerTest.kt b/tests/net/java/com/android/server/LegacyTypeTrackerTest.kt
index 42d4cf3..a10a3c8 100644
--- a/tests/net/java/com/android/server/LegacyTypeTrackerTest.kt
+++ b/tests/net/java/com/android/server/LegacyTypeTrackerTest.kt
@@ -14,6 +14,11 @@
  * limitations under the License.
  */
 
+// Don't warn about deprecated types anywhere in this test, because LegacyTypeTracker's very reason
+// for existence is to power deprecated APIs. The annotation has to apply to the whole file because
+// otherwise warnings will be generated by the imports of deprecated constants like TYPE_xxx.
+@file:Suppress("DEPRECATION")
+
 package com.android.server
 
 import android.net.ConnectivityManager.TYPE_ETHERNET
diff --git a/tests/net/java/com/android/server/connectivity/PermissionMonitorTest.java b/tests/net/java/com/android/server/connectivity/PermissionMonitorTest.java
index 39f849c..9e3aeef 100644
--- a/tests/net/java/com/android/server/connectivity/PermissionMonitorTest.java
+++ b/tests/net/java/com/android/server/connectivity/PermissionMonitorTest.java
@@ -76,7 +76,6 @@
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
-import org.mockito.ArgumentCaptor;
 import org.mockito.Mock;
 import org.mockito.MockitoAnnotations;
 import org.mockito.invocation.InvocationOnMock;
@@ -88,7 +87,6 @@
 import java.util.HashSet;
 import java.util.Set;
 
-
 @RunWith(AndroidJUnit4.class)
 @SmallTest
 public class PermissionMonitorTest {
@@ -117,7 +115,6 @@
     @Mock private PackageManagerInternal mMockPmi;
     @Mock private UserManager mUserManager;
 
-    private PackageManagerInternal.PackageListObserver mObserver;
     private PermissionMonitor mPermissionMonitor;
 
     @Before
@@ -139,11 +136,7 @@
                   /* observer */ null));
         when(mPackageManager.getInstalledPackages(anyInt())).thenReturn(/* empty app list */ null);
         mPermissionMonitor.startMonitoring();
-
-        final ArgumentCaptor<PackageManagerInternal.PackageListObserver> observerCaptor =
-                ArgumentCaptor.forClass(PackageManagerInternal.PackageListObserver.class);
-        verify(mMockPmi).getPackageList(observerCaptor.capture());
-        mObserver = observerCaptor.getValue();
+        verify(mMockPmi).getPackageList(mPermissionMonitor);
     }
 
     private boolean hasRestrictedNetworkPermission(String partition, int targetSdkVersion, int uid,
@@ -450,13 +443,13 @@
                 new int[]{MOCK_UID1});
 
         // Remove MOCK_UID1, expect no permission left for all user.
-        mPermissionMonitor.onPackageRemoved(MOCK_UID1);
-        removePackageForUsers(new int[]{MOCK_USER1, MOCK_USER2}, MOCK_UID1);
+        mPermissionMonitor.onPackageRemoved(MOCK_PACKAGE1, MOCK_UID1);
+        removePackageForUsers(new int[]{MOCK_USER1, MOCK_USER2}, MOCK_PACKAGE1, MOCK_UID1);
         mNetdMonitor.expectNoPermission(new int[]{MOCK_USER1, MOCK_USER2}, new int[]{MOCK_UID1});
 
         // Remove SYSTEM_PACKAGE1, expect permission downgrade.
         when(mPackageManager.getPackagesForUid(anyInt())).thenReturn(new String[]{SYSTEM_PACKAGE2});
-        removePackageForUsers(new int[]{MOCK_USER1, MOCK_USER2}, SYSTEM_UID);
+        removePackageForUsers(new int[]{MOCK_USER1, MOCK_USER2}, SYSTEM_PACKAGE1, SYSTEM_UID);
         mNetdMonitor.expectPermission(NETWORK, new int[]{MOCK_USER1, MOCK_USER2},
                 new int[]{SYSTEM_UID});
 
@@ -465,7 +458,7 @@
 
         // Remove all packages, expect no permission left.
         when(mPackageManager.getPackagesForUid(anyInt())).thenReturn(new String[]{});
-        removePackageForUsers(new int[]{MOCK_USER2}, SYSTEM_UID);
+        removePackageForUsers(new int[]{MOCK_USER2}, SYSTEM_PACKAGE2, SYSTEM_UID);
         mNetdMonitor.expectNoPermission(new int[]{MOCK_USER1, MOCK_USER2},
                 new int[]{SYSTEM_UID, MOCK_UID1});
 
@@ -501,7 +494,8 @@
         reset(mNetdService);
 
         // When MOCK_UID1 package is uninstalled and reinstalled, expect Netd to be updated
-        mPermissionMonitor.onPackageRemoved(UserHandle.getUid(MOCK_USER1, MOCK_UID1));
+        mPermissionMonitor.onPackageRemoved(
+                MOCK_PACKAGE1, UserHandle.getUid(MOCK_USER1, MOCK_UID1));
         verify(mNetdService).firewallRemoveUidInterfaceRules(aryEq(new int[] {MOCK_UID1}));
         mPermissionMonitor.onPackageAdded(MOCK_PACKAGE1, UserHandle.getUid(MOCK_USER1, MOCK_UID1));
         verify(mNetdService).firewallAddUidInterfaceRules(eq("tun0"),
@@ -545,7 +539,8 @@
                 aryEq(new int[] {MOCK_UID1}));
 
         // Removed package should have its uid rules removed
-        mPermissionMonitor.onPackageRemoved(UserHandle.getUid(MOCK_USER1, MOCK_UID1));
+        mPermissionMonitor.onPackageRemoved(
+                MOCK_PACKAGE1, UserHandle.getUid(MOCK_USER1, MOCK_UID1));
         verify(mNetdService).firewallRemoveUidInterfaceRules(aryEq(new int[] {MOCK_UID1}));
     }
 
@@ -559,9 +554,9 @@
         }
     }
 
-    private void removePackageForUsers(int[] users, int uid) {
+    private void removePackageForUsers(int[] users, String packageName, int uid) {
         for (final int user : users) {
-            mPermissionMonitor.onPackageRemoved(UserHandle.getUid(user, uid));
+            mPermissionMonitor.onPackageRemoved(packageName, UserHandle.getUid(user, uid));
         }
     }
 
@@ -647,7 +642,7 @@
     private PackageInfo addPackage(String packageName, int uid, String[] permissions)
             throws Exception {
         PackageInfo packageInfo = setPackagePermissions(packageName, uid, permissions);
-        mObserver.onPackageAdded(packageName, uid);
+        mPermissionMonitor.onPackageAdded(packageName, uid);
         return packageInfo;
     }
 
@@ -678,7 +673,7 @@
         when(mPackageManager.getPackageInfo(eq(MOCK_PACKAGE2), anyInt())).thenReturn(packageInfo2);
         when(mPackageManager.getPackagesForUid(MOCK_UID1))
               .thenReturn(new String[]{MOCK_PACKAGE1, MOCK_PACKAGE2});
-        mObserver.onPackageAdded(MOCK_PACKAGE2, MOCK_UID1);
+        mPermissionMonitor.onPackageAdded(MOCK_PACKAGE2, MOCK_UID1);
         mNetdServiceMonitor.expectPermission(INetd.PERMISSION_INTERNET
                 | INetd.PERMISSION_UPDATE_DEVICE_STATS, new int[]{MOCK_UID1});
     }
@@ -692,7 +687,7 @@
                 | INetd.PERMISSION_UPDATE_DEVICE_STATS, new int[]{MOCK_UID1});
 
         when(mPackageManager.getPackagesForUid(MOCK_UID1)).thenReturn(new String[]{});
-        mObserver.onPackageRemoved(MOCK_PACKAGE1, MOCK_UID1);
+        mPermissionMonitor.onPackageRemoved(MOCK_PACKAGE1, MOCK_UID1);
         mNetdServiceMonitor.expectPermission(INetd.PERMISSION_UNINSTALLED, new int[]{MOCK_UID1});
     }
 
@@ -705,7 +700,7 @@
                 | INetd.PERMISSION_UPDATE_DEVICE_STATS, new int[]{MOCK_UID1});
 
         when(mPackageManager.getPackagesForUid(MOCK_UID1)).thenReturn(new String[]{});
-        mObserver.onPackageRemoved(MOCK_PACKAGE1, MOCK_UID1);
+        mPermissionMonitor.onPackageRemoved(MOCK_PACKAGE1, MOCK_UID1);
         mNetdServiceMonitor.expectPermission(INetd.PERMISSION_UNINSTALLED, new int[]{MOCK_UID1});
 
         addPackage(MOCK_PACKAGE1, MOCK_UID1, new String[] {INTERNET});
@@ -719,10 +714,7 @@
         addPackage(MOCK_PACKAGE1, MOCK_UID1, new String[] {});
         mNetdServiceMonitor.expectPermission(INetd.PERMISSION_NONE, new int[]{MOCK_UID1});
 
-        // When updating a package, the broadcast receiver gets two broadcasts (a remove and then an
-        // add), but the observer sees only one callback (an update).
-        setPackagePermissions(MOCK_PACKAGE1, MOCK_UID1, new String[] {INTERNET});
-        mObserver.onPackageChanged(MOCK_PACKAGE1, MOCK_UID1);
+        addPackage(MOCK_PACKAGE1, MOCK_UID1, new String[] {INTERNET});
         mNetdServiceMonitor.expectPermission(INetd.PERMISSION_INTERNET, new int[]{MOCK_UID1});
     }
 
@@ -740,7 +732,7 @@
         when(mPackageManager.getPackagesForUid(MOCK_UID1)).thenReturn(new String[]{
                 MOCK_PACKAGE2});
 
-        mObserver.onPackageRemoved(MOCK_PACKAGE1, MOCK_UID1);
+        mPermissionMonitor.onPackageRemoved(MOCK_PACKAGE1, MOCK_UID1);
         mNetdServiceMonitor.expectPermission(INetd.PERMISSION_INTERNET, new int[]{MOCK_UID1});
     }
 
diff --git a/tests/net/java/com/android/server/net/NetworkStatsServiceTest.java b/tests/net/java/com/android/server/net/NetworkStatsServiceTest.java
index a1bb0d5..1307a84 100644
--- a/tests/net/java/com/android/server/net/NetworkStatsServiceTest.java
+++ b/tests/net/java/com/android/server/net/NetworkStatsServiceTest.java
@@ -41,6 +41,7 @@
 import static android.net.NetworkStats.TAG_NONE;
 import static android.net.NetworkStats.UID_ALL;
 import static android.net.NetworkStatsHistory.FIELD_ALL;
+import static android.net.NetworkTemplate.NETWORK_TYPE_ALL;
 import static android.net.NetworkTemplate.buildTemplateMobileAll;
 import static android.net.NetworkTemplate.buildTemplateMobileWithRatType;
 import static android.net.NetworkTemplate.buildTemplateWifiWildcard;
@@ -62,6 +63,7 @@
 import static org.mockito.ArgumentMatchers.anyLong;
 import static org.mockito.ArgumentMatchers.anyString;
 import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.Mockito.reset;
 import static org.mockito.Mockito.times;
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
@@ -71,6 +73,7 @@
 import android.app.usage.NetworkStatsManager;
 import android.content.Context;
 import android.content.Intent;
+import android.database.ContentObserver;
 import android.net.DataUsageRequest;
 import android.net.INetworkManagementEventObserver;
 import android.net.INetworkStatsSession;
@@ -94,6 +97,7 @@
 import android.os.Messenger;
 import android.os.PowerManager;
 import android.os.SimpleClock;
+import android.provider.Settings;
 import android.telephony.TelephonyManager;
 
 import androidx.test.InstrumentationRegistry;
@@ -173,6 +177,8 @@
     private NetworkStatsService mService;
     private INetworkStatsSession mSession;
     private INetworkManagementEventObserver mNetworkObserver;
+    private ContentObserver mContentObserver;
+    private Handler mHandler;
 
     private final Clock mClock = new SimpleClock(ZoneOffset.UTC) {
         @Override
@@ -212,6 +218,12 @@
         mService.systemReady();
         // Verify that system ready fetches realtime stats
         verify(mStatsFactory).readNetworkStatsDetail(UID_ALL, INTERFACES_ALL, TAG_ALL);
+        // Wait for posting onChange() event to handler thread and verify that when system ready,
+        // start monitoring data usage per RAT type because the settings value is mock as false
+        // by default in expectSettings().
+        waitForIdle();
+        verify(mNetworkStatsSubscriptionsMonitor).start();
+        reset(mNetworkStatsSubscriptionsMonitor);
 
         mSession = mService.openSession();
         assertNotNull("openSession() failed", mSession);
@@ -233,11 +245,19 @@
 
             @Override
             public NetworkStatsSubscriptionsMonitor makeSubscriptionsMonitor(
-                    @NonNull Context context, @NonNull Executor executor,
+                    @NonNull Context context, @NonNull Looper looper, @NonNull Executor executor,
                     @NonNull NetworkStatsService service) {
 
                 return mNetworkStatsSubscriptionsMonitor;
             }
+
+            @Override
+            public ContentObserver makeContentObserver(Handler handler,
+                    NetworkStatsSettings settings, NetworkStatsSubscriptionsMonitor monitor) {
+                mHandler = handler;
+                return mContentObserver = super.makeContentObserver(handler, settings, monitor);
+            }
+
         };
     }
 
@@ -1191,6 +1211,99 @@
         provider.expectOnSetAlert(MB_IN_BYTES);
     }
 
+    private void setCombineSubtypeEnabled(boolean enable) {
+        when(mSettings.getCombineSubtypeEnabled()).thenReturn(enable);
+        mHandler.post(() -> mContentObserver.onChange(false, Settings.Global
+                    .getUriFor(Settings.Global.NETSTATS_COMBINE_SUBTYPE_ENABLED)));
+        waitForIdle();
+        if (enable) {
+            verify(mNetworkStatsSubscriptionsMonitor).stop();
+        } else {
+            verify(mNetworkStatsSubscriptionsMonitor).start();
+        }
+    }
+
+    @Test
+    public void testDynamicWatchForNetworkRatTypeChanges() throws Exception {
+        // Build 3G template, type unknown template to get stats while network type is unknown
+        // and type all template to get the sum of all network type stats.
+        final NetworkTemplate template3g =
+                buildTemplateMobileWithRatType(null, TelephonyManager.NETWORK_TYPE_UMTS);
+        final NetworkTemplate templateUnknown =
+                buildTemplateMobileWithRatType(null, TelephonyManager.NETWORK_TYPE_UNKNOWN);
+        final NetworkTemplate templateAll =
+                buildTemplateMobileWithRatType(null, NETWORK_TYPE_ALL);
+        final NetworkState[] states = new NetworkState[]{buildMobile3gState(IMSI_1)};
+
+        expectNetworkStatsSummary(buildEmptyStats());
+        expectNetworkStatsUidDetail(buildEmptyStats());
+
+        // 3G network comes online.
+        setMobileRatTypeAndWaitForIdle(TelephonyManager.NETWORK_TYPE_UMTS);
+        mService.forceUpdateIfaces(NETWORKS_MOBILE, states, getActiveIface(states),
+                new VpnInfo[0]);
+
+        // Create some traffic.
+        incrementCurrentTime(MINUTE_IN_MILLIS);
+        expectNetworkStatsUidDetail(new NetworkStats(getElapsedRealtime(), 1)
+                .addEntry(new NetworkStats.Entry(TEST_IFACE, UID_RED, SET_DEFAULT, TAG_NONE,
+                        12L, 18L, 14L, 1L, 0L)));
+        forcePollAndWaitForIdle();
+
+        // Since CombineSubtypeEnabled is false by default in unit test, the generated traffic
+        // will be split by RAT type. Verify 3G templates gets stats, while template with unknown
+        // RAT type gets nothing, and template with NETWORK_TYPE_ALL gets all stats.
+        assertUidTotal(template3g, UID_RED, 12L, 18L, 14L, 1L, 0);
+        assertUidTotal(templateUnknown, UID_RED, 0L, 0L, 0L, 0L, 0);
+        assertUidTotal(templateAll, UID_RED, 12L, 18L, 14L, 1L, 0);
+
+        // Stop monitoring data usage per RAT type changes NetworkStatsService records data
+        // to {@link TelephonyManager#NETWORK_TYPE_UNKNOWN}.
+        setCombineSubtypeEnabled(true);
+
+        // Call handleOnCollapsedRatTypeChanged manually to simulate the callback fired
+        // when stopping monitor, this is needed by NetworkStatsService to trigger updateIfaces.
+        mService.handleOnCollapsedRatTypeChanged();
+        HandlerUtilsKt.waitForIdle(mHandlerThread, WAIT_TIMEOUT);
+        // Create some traffic.
+        incrementCurrentTime(MINUTE_IN_MILLIS);
+        // Append more traffic on existing snapshot.
+        expectNetworkStatsUidDetail(new NetworkStats(getElapsedRealtime(), 1)
+                .addEntry(new NetworkStats.Entry(TEST_IFACE, UID_RED, SET_DEFAULT, TAG_NONE,
+                        12L + 4L, 18L + 4L, 14L + 3L, 1L + 1L, 0L))
+                .addEntry(new NetworkStats.Entry(TEST_IFACE, UID_RED, SET_FOREGROUND, TAG_NONE,
+                        35L, 29L, 7L, 11L, 1L)));
+        forcePollAndWaitForIdle();
+
+        // Verify 3G counters do not increase, while template with unknown RAT type gets new
+        // traffic and template with NETWORK_TYPE_ALL gets all stats.
+        assertUidTotal(template3g, UID_RED, 12L, 18L, 14L, 1L, 0);
+        assertUidTotal(templateUnknown, UID_RED, 4L + 35L, 4L + 29L, 3L + 7L, 1L + 11L, 1);
+        assertUidTotal(templateAll, UID_RED, 16L + 35L, 22L + 29L, 17L + 7L, 2L + 11L, 1);
+
+        // Start monitoring data usage per RAT type changes and NetworkStatsService records data
+        // by a granular subtype representative of the actual subtype
+        setCombineSubtypeEnabled(false);
+
+        mService.handleOnCollapsedRatTypeChanged();
+        HandlerUtilsKt.waitForIdle(mHandlerThread, WAIT_TIMEOUT);
+        // Create some traffic.
+        incrementCurrentTime(MINUTE_IN_MILLIS);
+        // Append more traffic on existing snapshot.
+        expectNetworkStatsUidDetail(new NetworkStats(getElapsedRealtime(), 1)
+                .addEntry(new NetworkStats.Entry(TEST_IFACE, UID_RED, SET_DEFAULT, TAG_NONE,
+                        22L, 26L, 19L, 5L, 0L))
+                .addEntry(new NetworkStats.Entry(TEST_IFACE, UID_RED, SET_FOREGROUND, TAG_NONE,
+                        35L, 29L, 7L, 11L, 1L)));
+        forcePollAndWaitForIdle();
+
+        // Verify traffic is split by RAT type, no increase on template with unknown RAT type
+        // and template with NETWORK_TYPE_ALL gets all stats.
+        assertUidTotal(template3g, UID_RED, 6L + 12L , 4L + 18L, 2L + 14L, 3L + 1L, 0);
+        assertUidTotal(templateUnknown, UID_RED, 4L + 35L, 4L + 29L, 3L + 7L, 1L + 11L, 1);
+        assertUidTotal(templateAll, UID_RED, 22L + 35L, 26L + 29L, 19L + 7L, 5L + 11L, 1);
+    }
+
     private static File getBaseDir(File statsDir) {
         File baseDir = new File(statsDir, "netstats");
         baseDir.mkdirs();
@@ -1403,6 +1516,10 @@
 
     private void forcePollAndWaitForIdle() {
         mServiceContext.sendBroadcast(new Intent(ACTION_NETWORK_STATS_POLL));
+        waitForIdle();
+    }
+
+    private void waitForIdle() {
         HandlerUtilsKt.waitForIdle(mHandlerThread, WAIT_TIMEOUT);
     }
 
diff --git a/tests/net/java/com/android/server/net/NetworkStatsSubscriptionsMonitorTest.java b/tests/net/java/com/android/server/net/NetworkStatsSubscriptionsMonitorTest.java
index 058856d..16fed39 100644
--- a/tests/net/java/com/android/server/net/NetworkStatsSubscriptionsMonitorTest.java
+++ b/tests/net/java/com/android/server/net/NetworkStatsSubscriptionsMonitorTest.java
@@ -17,6 +17,7 @@
 package com.android.server.net;
 
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
 import static org.mockito.Mockito.any;
 import static org.mockito.Mockito.anyInt;
 import static org.mockito.Mockito.eq;
@@ -29,14 +30,13 @@
 
 import android.annotation.NonNull;
 import android.content.Context;
-import android.os.Looper;
+import android.os.test.TestLooper;
 import android.telephony.PhoneStateListener;
 import android.telephony.ServiceState;
 import android.telephony.SubscriptionManager;
 import android.telephony.TelephonyManager;
 
 import com.android.internal.util.CollectionUtils;
-import com.android.server.net.NetworkStatsSubscriptionsMonitor.Delegate;
 import com.android.server.net.NetworkStatsSubscriptionsMonitor.RatTypeListener;
 
 import org.junit.Before;
@@ -64,20 +64,17 @@
     @Mock private PhoneStateListener mPhoneStateListener;
     @Mock private SubscriptionManager mSubscriptionManager;
     @Mock private TelephonyManager mTelephonyManager;
-    @Mock private Delegate mDelegate;
+    @Mock private NetworkStatsSubscriptionsMonitor.Delegate mDelegate;
     private final List<Integer> mTestSubList = new ArrayList<>();
 
     private final Executor mExecutor = Executors.newSingleThreadExecutor();
     private NetworkStatsSubscriptionsMonitor mMonitor;
+    private TestLooper mTestLooper = new TestLooper();
 
     @Before
     public void setUp() {
         MockitoAnnotations.initMocks(this);
 
-        if (Looper.myLooper() == null) {
-            Looper.prepare();
-        }
-
         when(mTelephonyManager.createForSubscriptionId(anyInt())).thenReturn(mTelephonyManager);
 
         when(mContext.getSystemService(eq(Context.TELEPHONY_SUBSCRIPTION_SERVICE)))
@@ -85,7 +82,8 @@
         when(mContext.getSystemService(eq(Context.TELEPHONY_SERVICE)))
                 .thenReturn(mTelephonyManager);
 
-        mMonitor = new NetworkStatsSubscriptionsMonitor(mContext, mExecutor, mDelegate);
+        mMonitor = new NetworkStatsSubscriptionsMonitor(mContext, mTestLooper.getLooper(),
+                mExecutor, mDelegate);
     }
 
     @Test
@@ -117,16 +115,18 @@
         when(serviceState.getDataNetworkType()).thenReturn(type);
         final RatTypeListener match = CollectionUtils
                 .find(listeners, it -> it.getSubId() == subId);
-        if (match != null) {
-            match.onServiceStateChanged(serviceState);
+        if (match == null) {
+            fail("Could not find listener with subId: " + subId);
         }
+        match.onServiceStateChanged(serviceState);
     }
 
     private void addTestSub(int subId, String subscriberId) {
         // add SubId to TestSubList.
-        if (!mTestSubList.contains(subId)) {
-            mTestSubList.add(subId);
-        }
+        if (mTestSubList.contains(subId)) fail("The subscriber list already contains this ID");
+
+        mTestSubList.add(subId);
+
         final int[] subList = convertArrayListToIntArray(mTestSubList);
         when(mSubscriptionManager.getCompleteActiveSubscriptionIdList()).thenReturn(subList);
         when(mTelephonyManager.getSubscriberId(subId)).thenReturn(subscriberId);
diff --git a/tools/aapt/ConfigDescription.h b/tools/aapt/ConfigDescription.h
index b4ea624..6e9dc3d 100644
--- a/tools/aapt/ConfigDescription.h
+++ b/tools/aapt/ConfigDescription.h
@@ -34,8 +34,8 @@
         size = sizeof(android::ResTable_config);
     }
 
-    ConfigDescription(const ConfigDescription&o) {
-        *static_cast<android::ResTable_config*>(this) = o;
+    ConfigDescription(const ConfigDescription&o)
+        : android::ResTable_config(o) {
     }
 
     ConfigDescription& operator=(const android::ResTable_config& o) {
diff --git a/tools/aapt/tests/AaptConfig_test.cpp b/tools/aapt/tests/AaptConfig_test.cpp
index 4f22fa5..b7c6bd2 100644
--- a/tools/aapt/tests/AaptConfig_test.cpp
+++ b/tools/aapt/tests/AaptConfig_test.cpp
@@ -20,7 +20,6 @@
 #include "AaptConfig.h"
 #include "ConfigDescription.h"
 #include "SdkConstants.h"
-#include "TestHelper.h"
 
 using android::String8;
 
@@ -127,4 +126,4 @@
               config.colorMode & android::ResTable_config::MASK_HDR);
     EXPECT_EQ(SDK_O, config.sdkVersion);
     EXPECT_EQ(String8("lowdr-v26"), config.toString());
-}
\ No newline at end of file
+}
diff --git a/tools/aapt/tests/AaptGroupEntry_test.cpp b/tools/aapt/tests/AaptGroupEntry_test.cpp
index 7348a08..bf5ca59 100644
--- a/tools/aapt/tests/AaptGroupEntry_test.cpp
+++ b/tools/aapt/tests/AaptGroupEntry_test.cpp
@@ -19,7 +19,6 @@
 
 #include "AaptAssets.h"
 #include "ResourceFilter.h"
-#include "TestHelper.h"
 
 using android::String8;
 
diff --git a/tools/aapt/tests/ResourceTable_test.cpp b/tools/aapt/tests/ResourceTable_test.cpp
index f2c696b..0d550df 100644
--- a/tools/aapt/tests/ResourceTable_test.cpp
+++ b/tools/aapt/tests/ResourceTable_test.cpp
@@ -19,7 +19,6 @@
 
 #include "ConfigDescription.h"
 #include "ResourceTable.h"
-#include "TestHelper.h"
 
 using android::String16;
 
diff --git a/tools/aapt2/Android.bp b/tools/aapt2/Android.bp
index c1d05e4..ade0dc4 100644
--- a/tools/aapt2/Android.bp
+++ b/tools/aapt2/Android.bp
@@ -47,6 +47,7 @@
             cflags: ["-D_DARWIN_UNLIMITED_STREAMS"],
         },
     },
+    header_libs: ["jni_headers"],
     static_libs: [
         "libandroidfw",
         "libutils",
diff --git a/tools/aapt2/ResourceParser.cpp b/tools/aapt2/ResourceParser.cpp
index 234cbc4..931a14b 100644
--- a/tools/aapt2/ResourceParser.cpp
+++ b/tools/aapt2/ResourceParser.cpp
@@ -449,6 +449,7 @@
     ParsedResource parsed_resource;
     parsed_resource.config = config_;
     parsed_resource.source = source_.WithLine(parser->line_number());
+    // NOLINTNEXTLINE(bugprone-use-after-move) move+reset comment
     parsed_resource.comment = std::move(comment);
     if (options_.visibility) {
       parsed_resource.visibility_level = options_.visibility.value();
@@ -979,6 +980,7 @@
       child_resource.name.type = *parsed_type;
       child_resource.name.entry = maybe_name.value().to_string();
       child_resource.id = next_id;
+      // NOLINTNEXTLINE(bugprone-use-after-move) move+reset comment
       child_resource.comment = std::move(comment);
       child_resource.source = item_source;
       child_resource.visibility_level = Visibility::Level::kPublic;
@@ -1698,6 +1700,7 @@
       ParsedResource child_resource;
       child_resource.name = child_ref.name.value();
       child_resource.source = item_source;
+      // NOLINTNEXTLINE(bugprone-use-after-move) move+reset comment
       child_resource.comment = std::move(comment);
       if (options_.visibility) {
         child_resource.visibility_level = options_.visibility.value();
diff --git a/tools/aapt2/SdkConstants.cpp b/tools/aapt2/SdkConstants.cpp
index f9faed8..e8873bf 100644
--- a/tools/aapt2/SdkConstants.cpp
+++ b/tools/aapt2/SdkConstants.cpp
@@ -27,7 +27,7 @@
 
 static ApiVersion sDevelopmentSdkLevel = 10000;
 static const auto sDevelopmentSdkCodeNames = std::unordered_set<StringPiece>({
-    "Q", "R"
+    "Q", "R", "S"
 });
 
 static const std::vector<std::pair<uint16_t, ApiVersion>> sAttrIdMap = {
diff --git a/tools/aapt2/cmd/Link.cpp b/tools/aapt2/cmd/Link.cpp
index 3a3fb28..72cb41a 100644
--- a/tools/aapt2/cmd/Link.cpp
+++ b/tools/aapt2/cmd/Link.cpp
@@ -1272,7 +1272,8 @@
       return false;
     }
 
-    ClassDefinition::WriteJavaFile(manifest_class.get(), package_utf8, true, &fout);
+    ClassDefinition::WriteJavaFile(manifest_class.get(), package_utf8, true,
+                                   false /* strip_api_annotations */, &fout);
     fout.Flush();
 
     if (fout.HadError()) {
diff --git a/tools/aapt2/java/AnnotationProcessor.cpp b/tools/aapt2/java/AnnotationProcessor.cpp
index cec59e7..482d91a 100644
--- a/tools/aapt2/java/AnnotationProcessor.cpp
+++ b/tools/aapt2/java/AnnotationProcessor.cpp
@@ -123,7 +123,7 @@
   }
 }
 
-void AnnotationProcessor::Print(Printer* printer) const {
+void AnnotationProcessor::Print(Printer* printer, bool strip_api_annotations) const {
   if (has_comments_) {
     std::string result = comment_.str();
     for (const StringPiece& line : util::Tokenize(result, '\n')) {
@@ -137,6 +137,9 @@
     printer->Println("@Deprecated");
   }
 
+  if (strip_api_annotations) {
+    return;
+  }
   for (const AnnotationRule& rule : sAnnotationRules) {
     const auto& it = annotation_parameter_map_.find(rule.bit_mask);
     if (it != annotation_parameter_map_.end()) {
diff --git a/tools/aapt2/java/AnnotationProcessor.h b/tools/aapt2/java/AnnotationProcessor.h
index fdb5846..f217afb 100644
--- a/tools/aapt2/java/AnnotationProcessor.h
+++ b/tools/aapt2/java/AnnotationProcessor.h
@@ -65,7 +65,7 @@
   void AppendNewLine();
 
   // Writes the comments and annotations to the Printer.
-  void Print(text::Printer* printer) const;
+  void Print(text::Printer* printer, bool strip_api_annotations = false) const;
 
  private:
   std::stringstream comment_;
diff --git a/tools/aapt2/java/AnnotationProcessor_test.cpp b/tools/aapt2/java/AnnotationProcessor_test.cpp
index 7d0a4e9..6bc8902 100644
--- a/tools/aapt2/java/AnnotationProcessor_test.cpp
+++ b/tools/aapt2/java/AnnotationProcessor_test.cpp
@@ -91,6 +91,21 @@
   EXPECT_THAT(annotations, HasSubstr("This is a test API"));
 }
 
+TEST(AnnotationProcessorTest, NotEmitSystemApiAnnotation) {
+  AnnotationProcessor processor;
+  processor.AppendComment("@SystemApi This is a system API");
+
+  std::string annotations;
+  StringOutputStream out(&annotations);
+  Printer printer(&out);
+  processor.Print(&printer, true /* strip_api_annotations */);
+  out.Flush();
+
+  EXPECT_THAT(annotations, Not(HasSubstr("@android.annotation.SystemApi")));
+  EXPECT_THAT(annotations, Not(HasSubstr("@SystemApi")));
+  EXPECT_THAT(annotations, HasSubstr("This is a system API"));
+}
+
 TEST(AnnotationProcessor, ExtractsFirstSentence) {
   EXPECT_THAT(AnnotationProcessor::ExtractFirstSentence("This is the only sentence"),
               Eq("This is the only sentence"));
diff --git a/tools/aapt2/java/ClassDefinition.cpp b/tools/aapt2/java/ClassDefinition.cpp
index f5f5b05..3163497 100644
--- a/tools/aapt2/java/ClassDefinition.cpp
+++ b/tools/aapt2/java/ClassDefinition.cpp
@@ -23,15 +23,15 @@
 
 namespace aapt {
 
-void ClassMember::Print(bool /*final*/, Printer* printer) const {
-  processor_.Print(printer);
+void ClassMember::Print(bool /*final*/, Printer* printer, bool strip_api_annotations) const {
+  processor_.Print(printer, strip_api_annotations);
 }
 
 void MethodDefinition::AppendStatement(const StringPiece& statement) {
   statements_.push_back(statement.to_string());
 }
 
-void MethodDefinition::Print(bool final, Printer* printer) const {
+void MethodDefinition::Print(bool final, Printer* printer, bool) const {
   printer->Print(signature_).Println(" {");
   printer->Indent();
   for (const auto& statement : statements_) {
@@ -74,12 +74,12 @@
   return true;
 }
 
-void ClassDefinition::Print(bool final, Printer* printer) const {
+void ClassDefinition::Print(bool final, Printer* printer, bool strip_api_annotations) const {
   if (empty() && !create_if_empty_) {
     return;
   }
 
-  ClassMember::Print(final, printer);
+  ClassMember::Print(final,  printer, strip_api_annotations);
 
   printer->Print("public ");
   if (qualifier_ == ClassQualifier::kStatic) {
@@ -93,7 +93,7 @@
     // and takes precedence over a previous member with the same name. The overridden member is
     // set to nullptr.
     if (member != nullptr) {
-      member->Print(final, printer);
+      member->Print(final, printer, strip_api_annotations);
       printer->Println();
     }
   }
@@ -111,11 +111,11 @@
     " */\n\n";
 
 void ClassDefinition::WriteJavaFile(const ClassDefinition* def, const StringPiece& package,
-                                    bool final, io::OutputStream* out) {
+                                    bool final, bool strip_api_annotations, io::OutputStream* out) {
   Printer printer(out);
   printer.Print(sWarningHeader).Print("package ").Print(package).Println(";");
   printer.Println();
-  def->Print(final, &printer);
+  def->Print(final, &printer, strip_api_annotations);
 }
 
 }  // namespace aapt
diff --git a/tools/aapt2/java/ClassDefinition.h b/tools/aapt2/java/ClassDefinition.h
index fb11266..1e4b681 100644
--- a/tools/aapt2/java/ClassDefinition.h
+++ b/tools/aapt2/java/ClassDefinition.h
@@ -50,7 +50,7 @@
   // Writes the class member to the Printer. Subclasses should derive this method
   // to write their own data. Call this base method from the subclass to write out
   // this member's comments/annotations.
-  virtual void Print(bool final, text::Printer* printer) const;
+  virtual void Print(bool final, text::Printer* printer, bool strip_api_annotations = false) const;
 
  private:
   AnnotationProcessor processor_;
@@ -70,10 +70,11 @@
     return name_;
   }
 
-  void Print(bool final, text::Printer* printer) const override {
+  void Print(bool final, text::Printer* printer, bool strip_api_annotations = false)
+      const override {
     using std::to_string;
 
-    ClassMember::Print(final, printer);
+    ClassMember::Print(final, printer, strip_api_annotations);
 
     printer->Print("public static ");
     if (final) {
@@ -104,8 +105,9 @@
     return name_;
   }
 
-  void Print(bool final, text::Printer* printer) const override {
-    ClassMember::Print(final, printer);
+  void Print(bool final, text::Printer* printer, bool strip_api_annotations = false)
+      const override {
+    ClassMember::Print(final, printer, strip_api_annotations);
 
     printer->Print("public static ");
     if (final) {
@@ -142,8 +144,9 @@
     return name_;
   }
 
-  void Print(bool final, text::Printer* printer) const override {
-    ClassMember::Print(final, printer);
+  void Print(bool final, text::Printer* printer, bool strip_api_annotations = false)
+      const override {
+    ClassMember::Print(final, printer, strip_api_annotations);
 
     printer->Print("public static final int[] ").Print(name_).Print("={");
     printer->Indent();
@@ -195,7 +198,7 @@
     return false;
   }
 
-  void Print(bool final, text::Printer* printer) const override;
+  void Print(bool final, text::Printer* printer, bool strip_api_annotations = false) const override;
 
  private:
   DISALLOW_COPY_AND_ASSIGN(MethodDefinition);
@@ -209,7 +212,7 @@
 class ClassDefinition : public ClassMember {
  public:
   static void WriteJavaFile(const ClassDefinition* def, const android::StringPiece& package,
-                            bool final, io::OutputStream* out);
+                            bool final, bool strip_api_annotations, io::OutputStream* out);
 
   ClassDefinition(const android::StringPiece& name, ClassQualifier qualifier, bool createIfEmpty)
       : name_(name.to_string()), qualifier_(qualifier), create_if_empty_(createIfEmpty) {}
@@ -227,7 +230,7 @@
     return name_;
   }
 
-  void Print(bool final, text::Printer* printer) const override;
+  void Print(bool final, text::Printer* printer, bool strip_api_annotations = false) const override;
 
  private:
   DISALLOW_COPY_AND_ASSIGN(ClassDefinition);
diff --git a/tools/aapt2/java/JavaClassGenerator.cpp b/tools/aapt2/java/JavaClassGenerator.cpp
index bb541fe..dffad3b 100644
--- a/tools/aapt2/java/JavaClassGenerator.cpp
+++ b/tools/aapt2/java/JavaClassGenerator.cpp
@@ -604,6 +604,8 @@
     rewrite_method->AppendStatement("final int packageIdBits = p << 24;");
   }
 
+  const bool is_public = (options_.types == JavaClassGeneratorOptions::SymbolTypes::kPublic);
+
   for (const auto& package : table_->packages) {
     for (const auto& type : package->types) {
       if (type->type == ResourceType::kAttrPrivate) {
@@ -612,8 +614,7 @@
       }
 
       // Stay consistent with AAPT and generate an empty type class if the R class is public.
-      const bool force_creation_if_empty =
-          (options_.types == JavaClassGeneratorOptions::SymbolTypes::kPublic);
+      const bool force_creation_if_empty = is_public;
 
       std::unique_ptr<ClassDefinition> class_def;
       if (out != nullptr) {
@@ -637,8 +638,7 @@
         }
       }
 
-      if (out != nullptr && type->type == ResourceType::kStyleable &&
-          options_.types == JavaClassGeneratorOptions::SymbolTypes::kPublic) {
+      if (out != nullptr && type->type == ResourceType::kStyleable && is_public) {
         // When generating a public R class, we don't want Styleable to be part
         // of the API. It is only emitted for documentation purposes.
         class_def->GetCommentBuilder()->AppendComment("@doconly");
@@ -657,7 +657,7 @@
 
   if (out != nullptr) {
     AppendJavaDocAnnotations(options_.javadoc_annotations, r_class.GetCommentBuilder());
-    ClassDefinition::WriteJavaFile(&r_class, out_package_name, options_.use_final, out);
+    ClassDefinition::WriteJavaFile(&r_class, out_package_name, options_.use_final, !is_public, out);
   }
   return true;
 }
diff --git a/tools/aapt2/java/ManifestClassGenerator_test.cpp b/tools/aapt2/java/ManifestClassGenerator_test.cpp
index ab7f9a1..3858fc7 100644
--- a/tools/aapt2/java/ManifestClassGenerator_test.cpp
+++ b/tools/aapt2/java/ManifestClassGenerator_test.cpp
@@ -26,6 +26,7 @@
 namespace aapt {
 
 static ::testing::AssertionResult GetManifestClassText(IAaptContext* context, xml::XmlResource* res,
+                                                       bool strip_api_annotations,
                                                        std::string* out_str);
 
 TEST(ManifestClassGeneratorTest, NameIsProperlyGeneratedFromSymbol) {
@@ -39,7 +40,8 @@
       </manifest>)");
 
   std::string actual;
-  ASSERT_TRUE(GetManifestClassText(context.get(), manifest.get(), &actual));
+  ASSERT_TRUE(GetManifestClassText(context.get(), manifest.get(),
+                                   false /* strip_api_annotations */, &actual));
 
   ASSERT_THAT(actual, HasSubstr("public static final class permission {"));
   ASSERT_THAT(actual, HasSubstr("public static final class permission_group {"));
@@ -91,7 +93,8 @@
       </manifest>)");
 
   std::string actual;
-  ASSERT_TRUE(GetManifestClassText(context.get(), manifest.get(), &actual));
+  ASSERT_TRUE(GetManifestClassText(context.get(), manifest.get(),
+                                   false /* strip_api_annotations */, &actual));
 
   const char* expected_access_internet = R"(    /**
      * Required to access the internet.
@@ -123,6 +126,55 @@
   EXPECT_THAT(actual, HasSubstr(expected_test));
 }
 
+TEST(ManifestClassGeneratorTest, CommentsAndAnnotationsArePresentButNoApiAnnotations) {
+  std::unique_ptr<IAaptContext> context = test::ContextBuilder().Build();
+  std::unique_ptr<xml::XmlResource> manifest = test::BuildXmlDom(R"(
+      <manifest xmlns:android="http://schemas.android.com/apk/res/android">
+        <!-- Required to access the internet.
+             Added in API 1. -->
+        <permission android:name="android.permission.ACCESS_INTERNET" />
+        <!-- @deprecated This permission is for playing outside. -->
+        <permission android:name="android.permission.PLAY_OUTSIDE" />
+        <!-- This is a private permission for system only!
+             @hide
+             @SystemApi -->
+        <permission android:name="android.permission.SECRET" />
+        <!-- @TestApi This is a test only permission. -->
+        <permission android:name="android.permission.TEST_ONLY" />
+      </manifest>)");
+
+  std::string actual;
+  ASSERT_TRUE(GetManifestClassText(context.get(), manifest.get(),
+                                   true /* strip_api_annotations */, &actual));
+
+  const char* expected_access_internet = R"(    /**
+     * Required to access the internet.
+     * Added in API 1.
+     */
+    public static final String ACCESS_INTERNET="android.permission.ACCESS_INTERNET";)";
+  EXPECT_THAT(actual, HasSubstr(expected_access_internet));
+
+  const char* expected_play_outside = R"(    /**
+     * @deprecated This permission is for playing outside.
+     */
+    @Deprecated
+    public static final String PLAY_OUTSIDE="android.permission.PLAY_OUTSIDE";)";
+  EXPECT_THAT(actual, HasSubstr(expected_play_outside));
+
+  const char* expected_secret = R"(    /**
+     * This is a private permission for system only!
+     * @hide
+     */
+    public static final String SECRET="android.permission.SECRET";)";
+  EXPECT_THAT(actual, HasSubstr(expected_secret));
+
+  const char* expected_test = R"(    /**
+     * This is a test only permission.
+     */
+    public static final String TEST_ONLY="android.permission.TEST_ONLY";)";
+  EXPECT_THAT(actual, HasSubstr(expected_test));
+}
+
 // This is bad but part of public API behaviour so we need to preserve it.
 TEST(ManifestClassGeneratorTest, LastSeenPermissionWithSameLeafNameTakesPrecedence) {
   std::unique_ptr<IAaptContext> context = test::ContextBuilder().Build();
@@ -135,7 +187,8 @@
       </manifest>)");
 
   std::string actual;
-  ASSERT_TRUE(GetManifestClassText(context.get(), manifest.get(), &actual));
+  ASSERT_TRUE(GetManifestClassText(context.get(), manifest.get(),
+                                   false  /* strip_api_annotations */, &actual));
   EXPECT_THAT(actual, HasSubstr("ACCESS_INTERNET=\"com.android.aapt.test.ACCESS_INTERNET\";"));
   EXPECT_THAT(actual, Not(HasSubstr("ACCESS_INTERNET=\"android.permission.ACCESS_INTERNET\";")));
   EXPECT_THAT(actual, Not(HasSubstr("ACCESS_INTERNET=\"com.android.sample.ACCESS_INTERNET\";")));
@@ -149,11 +202,13 @@
         </manifest>)");
 
   std::string actual;
-  ASSERT_TRUE(GetManifestClassText(context.get(), manifest.get(), &actual));
+  ASSERT_TRUE(GetManifestClassText(context.get(), manifest.get(),
+                                   false  /* strip_api_annotations */, &actual));
   EXPECT_THAT(actual, HasSubstr("access_internet=\"android.permission.access-internet\";"));
 }
 
 static ::testing::AssertionResult GetManifestClassText(IAaptContext* context, xml::XmlResource* res,
+                                                       bool strip_api_annotations,
                                                        std::string* out_str) {
   std::unique_ptr<ClassDefinition> manifest_class =
       GenerateManifestClass(context->GetDiagnostics(), res);
@@ -162,7 +217,7 @@
   }
 
   StringOutputStream out(out_str);
-  manifest_class->WriteJavaFile(manifest_class.get(), "android", true, &out);
+  manifest_class->WriteJavaFile(manifest_class.get(), "android", true, strip_api_annotations, &out);
   out.Flush();
   return ::testing::AssertionSuccess();
 }
diff --git a/tools/aapt2/java/ProguardRules.cpp b/tools/aapt2/java/ProguardRules.cpp
index 0db1807..d9a4caa 100644
--- a/tools/aapt2/java/ProguardRules.cpp
+++ b/tools/aapt2/java/ProguardRules.cpp
@@ -115,15 +115,10 @@
 
   void Visit(xml::Element* node) override {
     bool is_view = false;
-    bool is_fragment = false;
     if (node->namespace_uri.empty()) {
       if (node->name == "view") {
         is_view = true;
-      } else if (node->name == "fragment") {
-        is_fragment = true;
       }
-    } else if (node->namespace_uri == xml::kSchemaAndroid) {
-      is_fragment = node->name == "fragment";
     }
 
     for (const auto& attr : node->attributes) {
@@ -132,12 +127,12 @@
           if (is_view) {
             AddClass(node->line_number, attr.value,
                 "android.content.Context, android.util.AttributeSet");
-          } else if (is_fragment) {
+          } else {
             AddClass(node->line_number, attr.value, "");
           }
         }
       } else if (attr.namespace_uri == xml::kSchemaAndroid && attr.name == "name") {
-        if (is_fragment && util::IsJavaClassName(attr.value)) {
+        if (util::IsJavaClassName(attr.value)) {
           AddClass(node->line_number, attr.value, "");
         }
       } else if (attr.namespace_uri == xml::kSchemaAndroid && attr.name == "onClick") {
diff --git a/tools/aapt2/java/ProguardRules_test.cpp b/tools/aapt2/java/ProguardRules_test.cpp
index b6e7602..c7ae0b6 100644
--- a/tools/aapt2/java/ProguardRules_test.cpp
+++ b/tools/aapt2/java/ProguardRules_test.cpp
@@ -131,6 +131,61 @@
   EXPECT_THAT(actual, HasSubstr("-keep class com.foo.Baz { <init>(); }"));
 }
 
+TEST(ProguardRulesTest, FragmentContainerViewNameRuleIsEmitted) {
+  std::unique_ptr<IAaptContext> context = test::ContextBuilder().Build();
+  std::unique_ptr<xml::XmlResource> layout = test::BuildXmlDom(R"(
+      <androidx.fragment.app.FragmentContainerView
+          xmlns:android="http://schemas.android.com/apk/res/android"
+          android:name="com.foo.Bar"/>)");
+  layout->file.name = test::ParseNameOrDie("layout/foo");
+
+  proguard::KeepSet set;
+  ASSERT_TRUE(proguard::CollectProguardRules(context.get(), layout.get(), &set));
+
+  std::string actual = GetKeepSetString(set, /** minimal_rules */ false);
+  EXPECT_THAT(actual, HasSubstr("-keep class com.foo.Bar { <init>(...); }"));
+
+  actual = GetKeepSetString(set, /** minimal_rules */ true);
+  EXPECT_THAT(actual, HasSubstr("-keep class com.foo.Bar { <init>(); }"));
+}
+
+TEST(ProguardRulesTest, FragmentContainerViewClassRuleIsEmitted) {
+  std::unique_ptr<IAaptContext> context = test::ContextBuilder().Build();
+  std::unique_ptr<xml::XmlResource> layout =
+      test::BuildXmlDom(R"(<androidx.fragment.app.FragmentContainerView class="com.foo.Bar"/>)");
+  layout->file.name = test::ParseNameOrDie("layout/foo");
+
+  proguard::KeepSet set;
+  ASSERT_TRUE(proguard::CollectProguardRules(context.get(), layout.get(), &set));
+
+  std::string actual = GetKeepSetString(set, /** minimal_rules */ false);
+  EXPECT_THAT(actual, HasSubstr("-keep class com.foo.Bar { <init>(...); }"));
+
+  actual = GetKeepSetString(set, /** minimal_rules */ true);
+  EXPECT_THAT(actual, HasSubstr("-keep class com.foo.Bar { <init>(); }"));
+}
+
+TEST(ProguardRulesTest, FragmentContainerViewNameAndClassRulesAreEmitted) {
+  std::unique_ptr<IAaptContext> context = test::ContextBuilder().Build();
+  std::unique_ptr<xml::XmlResource> layout = test::BuildXmlDom(R"(
+      <androidx.fragment.app.FragmentContainerView
+          xmlns:android="http://schemas.android.com/apk/res/android"
+          android:name="com.foo.Baz"
+          class="com.foo.Bar"/>)");
+  layout->file.name = test::ParseNameOrDie("layout/foo");
+
+  proguard::KeepSet set;
+  ASSERT_TRUE(proguard::CollectProguardRules(context.get(), layout.get(), &set));
+
+  std::string actual = GetKeepSetString(set, /** minimal_rules */ false);
+  EXPECT_THAT(actual, HasSubstr("-keep class com.foo.Bar { <init>(...); }"));
+  EXPECT_THAT(actual, HasSubstr("-keep class com.foo.Baz { <init>(...); }"));
+
+  actual = GetKeepSetString(set, /** minimal_rules */ true);
+  EXPECT_THAT(actual, HasSubstr("-keep class com.foo.Bar { <init>(); }"));
+  EXPECT_THAT(actual, HasSubstr("-keep class com.foo.Baz { <init>(); }"));
+}
+
 TEST(ProguardRulesTest, NavigationFragmentNameAndClassRulesAreEmitted) {
   std::unique_ptr<IAaptContext> context = test::ContextBuilder()
       .SetCompilationPackage("com.base").Build();
diff --git a/tools/aapt2/util/BigBuffer_test.cpp b/tools/aapt2/util/BigBuffer_test.cpp
index a7776e3..64dcc1d 100644
--- a/tools/aapt2/util/BigBuffer_test.cpp
+++ b/tools/aapt2/util/BigBuffer_test.cpp
@@ -62,7 +62,7 @@
     *b1 = 44;
 
     buffer.AppendBuffer(std::move(buffer2));
-    EXPECT_EQ(0u, buffer2.size());
+    EXPECT_EQ(0u, buffer2.size()); // NOLINT
     EXPECT_EQ(buffer2.begin(), buffer2.end());
   }
 
diff --git a/tools/aapt2/xml/XmlDom.cpp b/tools/aapt2/xml/XmlDom.cpp
index 9a725fa..005eeb9 100644
--- a/tools/aapt2/xml/XmlDom.cpp
+++ b/tools/aapt2/xml/XmlDom.cpp
@@ -305,6 +305,8 @@
         if (pending_element == nullptr) {
           pending_element = util::make_unique<Element>();
         }
+        // pending_element is not nullptr
+        // NOLINTNEXTLINE(bugprone-use-after-move)
         pending_element->namespace_decls.push_back(std::move(decl));
         break;
       }
diff --git a/tools/bit/adb.cpp b/tools/bit/adb.cpp
index fa7d3d4..f521a63 100644
--- a/tools/bit/adb.cpp
+++ b/tools/bit/adb.cpp
@@ -200,7 +200,7 @@
 
 static int
 skip_unknown_field(int fd, uint64_t tag, char* scratch, int scratchSize) {
-    bool done;
+    bool done = false;
     int err;
     uint64_t size;
     switch (tag & 0x7) {
diff --git a/tools/dump-coverage/Android.bp b/tools/dump-coverage/Android.bp
index 4519ce3..94356eb 100644
--- a/tools/dump-coverage/Android.bp
+++ b/tools/dump-coverage/Android.bp
@@ -19,6 +19,7 @@
     name: "libdumpcoverage",
     srcs: ["dump_coverage.cc"],
     header_libs: [
+        "jni_headers",
         "libopenjdkjvmti_headers",
     ],
 
diff --git a/tools/fonts/fontchain_linter.py b/tools/fonts/fontchain_linter.py
index 6683e2a..a4a315b 100755
--- a/tools/fonts/fontchain_linter.py
+++ b/tools/fonts/fontchain_linter.py
@@ -286,7 +286,7 @@
 
             if not fallback_for:
                 if not name or name == 'sans-serif':
-                    for _, fallback in _fallback_chains.iteritems():
+                    for _, fallback in _fallback_chains.items():
                         fallback.append(record)
                 else:
                     _fallback_chains[name].append(record)
@@ -327,7 +327,7 @@
         assert sequence in all_emoji, (
             'Emoji font should not support %s.' % printable(sequence))
 
-    for first, second in sorted(equivalent_emoji.items()):
+    for first, second in equivalent_emoji.items():
         assert coverage[first] == coverage[second], (
             '%s and %s should map to the same glyph.' % (
                 printable(first),
@@ -352,7 +352,7 @@
 
 def check_emoji_defaults(default_emoji):
     missing_text_chars = _emoji_properties['Emoji'] - default_emoji
-    for name, fallback_chain in _fallback_chains.iteritems():
+    for name, fallback_chain in _fallback_chains.items():
         emoji_font_seen = False
         for record in fallback_chain:
             if 'Zsye' in record.scripts:
@@ -369,7 +369,7 @@
                 continue
 
             # Check default emoji-style characters
-            assert_font_supports_none_of_chars(record.font, sorted(default_emoji), name)
+            assert_font_supports_none_of_chars(record.font, default_emoji, name)
 
             # Mark default text-style characters appearing in fonts above the emoji
             # font as seen
@@ -412,7 +412,7 @@
                 char_start, char_end = chars.split('..')
                 char_start = int(char_start, 16)
                 char_end = int(char_end, 16)
-                additions = xrange(char_start, char_end+1)
+                additions = range(char_start, char_end+1)
             else:  # singe character
                 additions = [int(chars, 16)]
             if reverse:
@@ -478,7 +478,7 @@
     # Unicode 12.0 adds Basic_Emoji in emoji-sequences.txt. We ignore them here since we are already
     # checking the emoji presentations with emoji-variation-sequences.txt.
     # Please refer to http://unicode.org/reports/tr51/#def_basic_emoji_set .
-    _emoji_sequences = {k: v for k, v in _emoji_sequences.iteritems() if not v == 'Basic_Emoji' }
+    _emoji_sequences = {k: v for k, v in _emoji_sequences.items() if not v == 'Basic_Emoji' }
 
 
 def remove_emoji_variation_exclude(source, items):
@@ -551,7 +551,7 @@
     rev = list(reversed(seq))
     # if there are fitzpatrick modifiers in the sequence, keep them after
     # the emoji they modify
-    for i in xrange(1, len(rev)):
+    for i in range(1, len(rev)):
         if is_fitzpatrick_modifier(rev[i-1]):
             rev[i], rev[i-1] = rev[i-1], rev[i]
     return tuple(rev)
@@ -620,7 +620,7 @@
 
 
 def check_compact_only_fallback():
-    for name, fallback_chain in _fallback_chains.iteritems():
+    for name, fallback_chain in _fallback_chains.items():
         for record in fallback_chain:
             if record.variant == 'compact':
                 same_script_elegants = [x for x in fallback_chain
@@ -650,7 +650,7 @@
 def check_cjk_punctuation():
     cjk_scripts = {'Hans', 'Hant', 'Jpan', 'Kore'}
     cjk_punctuation = range(0x3000, 0x301F + 1)
-    for name, fallback_chain in _fallback_chains.iteritems():
+    for name, fallback_chain in _fallback_chains.items():
         for record in fallback_chain:
             if record.scripts.intersection(cjk_scripts):
                 # CJK font seen. Stop checking the rest of the fonts.
diff --git a/tools/hiddenapi/generate_hiddenapi_lists.py b/tools/hiddenapi/generate_hiddenapi_lists.py
index 0b2077d..de6b478 100755
--- a/tools/hiddenapi/generate_hiddenapi_lists.py
+++ b/tools/hiddenapi/generate_hiddenapi_lists.py
@@ -18,10 +18,10 @@
 """
 import argparse
 from collections import defaultdict
-import os
-import sys
-import re
 import functools
+import os
+import re
+import sys
 
 # Names of flags recognized by the `hiddenapi` tool.
 FLAG_WHITELIST = "whitelist"
@@ -30,6 +30,7 @@
 FLAG_GREYLIST_MAX_O = "greylist-max-o"
 FLAG_GREYLIST_MAX_P = "greylist-max-p"
 FLAG_GREYLIST_MAX_Q = "greylist-max-q"
+FLAG_GREYLIST_MAX_R = "greylist-max-r"
 FLAG_CORE_PLATFORM_API = "core-platform-api"
 FLAG_PUBLIC_API = "public-api"
 FLAG_SYSTEM_API = "system-api"
@@ -43,13 +44,14 @@
     FLAG_GREYLIST_MAX_O,
     FLAG_GREYLIST_MAX_P,
     FLAG_GREYLIST_MAX_Q,
+    FLAG_GREYLIST_MAX_R,
 ]
 ALL_FLAGS = FLAGS_API_LIST + [
     FLAG_CORE_PLATFORM_API,
     FLAG_PUBLIC_API,
     FLAG_SYSTEM_API,
     FLAG_TEST_API,
-    ]
+]
 
 FLAGS_API_LIST_SET = set(FLAGS_API_LIST)
 ALL_FLAGS_SET = set(ALL_FLAGS)
diff --git a/tools/incident_section_gen/main.cpp b/tools/incident_section_gen/main.cpp
index 786223a..dd266ff 100644
--- a/tools/incident_section_gen/main.cpp
+++ b/tools/incident_section_gen/main.cpp
@@ -368,10 +368,13 @@
         // Don't generate a variable twice
         if (!hasDefaultFlags[i]) variableNames[fieldName] = false;
     }
+    // hasDefaultFlags[i] has been initialized in the above for-loop,
+    // but clang-tidy analyzer still report uninitized values.
+    // So we use NOLINT to suppress those false positives.
 
     bool allDefaults = true;
     for (size_t i=0; i<fieldsInOrder.size(); i++) {
-        allDefaults &= hasDefaultFlags[i];
+        allDefaults &= hasDefaultFlags[i];  // NOLINT(clang-analyzer-core.uninitialized.Assign)
     }
 
     parents->erase(messageName); // erase the message type name when exit the message.
@@ -384,7 +387,7 @@
     printf("Privacy* %s[] = {\n", messageName.c_str());
     for (size_t i=0; i<fieldsInOrder.size(); i++) {
         const FieldDescriptor* field = fieldsInOrder[i];
-        if (hasDefaultFlags[i]) continue;
+        if (hasDefaultFlags[i]) continue; // NOLINT(clang-analyzer-core.uninitialized.Branch)
         printf("    &%s,\n", getFieldName(field).c_str());
         policyCount++;
     }