Merge "Fix glob pattern for notification owners" into main
diff --git a/Android.bp b/Android.bp
index b739c43..5211fe2 100644
--- a/Android.bp
+++ b/Android.bp
@@ -506,6 +506,9 @@
     },
     lint: {
         baseline_filename: "lint-baseline.xml",
+        warning_checks: [
+            "FlaggedApi",
+        ],
     },
     jarjar_prefix: "com.android.internal.hidden_from_bootclasspath",
 }
diff --git a/apex/jobscheduler/service/Android.bp b/apex/jobscheduler/service/Android.bp
index ace56d4..06c7d64 100644
--- a/apex/jobscheduler/service/Android.bp
+++ b/apex/jobscheduler/service/Android.bp
@@ -24,6 +24,7 @@
         "app-compat-annotations",
         "error_prone_annotations",
         "framework",
+        "keepanno-annotations",
         "services.core",
         "unsupportedappusage",
     ],
diff --git a/apex/jobscheduler/service/java/com/android/server/usage/AppStandbyController.java b/apex/jobscheduler/service/java/com/android/server/usage/AppStandbyController.java
index 19bc716..613678b 100644
--- a/apex/jobscheduler/service/java/com/android/server/usage/AppStandbyController.java
+++ b/apex/jobscheduler/service/java/com/android/server/usage/AppStandbyController.java
@@ -130,6 +130,8 @@
 import com.android.server.LocalServices;
 import com.android.server.pm.pkg.AndroidPackage;
 import com.android.server.usage.AppIdleHistory.AppUsageHistory;
+import com.android.tools.r8.keepanno.annotations.KeepItemKind;
+import com.android.tools.r8.keepanno.annotations.UsedByReflection;
 
 import libcore.util.EmptyArray;
 
@@ -588,6 +590,8 @@
         }
     }
 
+    // This constructor is reflectively invoked from framework code in AppStandbyInternal.
+    @UsedByReflection(kind = KeepItemKind.CLASS_AND_METHODS)
     public AppStandbyController(Context context) {
         this(new Injector(context, AppSchedulingModuleThread.get().getLooper()));
     }
diff --git a/api/gen_combined_removed_dex.sh b/api/gen_combined_removed_dex.sh
index e0153f7..2860e2e 100755
--- a/api/gen_combined_removed_dex.sh
+++ b/api/gen_combined_removed_dex.sh
@@ -6,6 +6,6 @@
 
 # Convert each removed.txt to the "dex format" equivalent, and print all output.
 for f in "$@"; do
-    "$metalava_path" signature-to-dex "$f" "${tmp_dir}/tmp"
+    "$metalava_path" signature-to-dex "$f" --out "${tmp_dir}/tmp"
     cat "${tmp_dir}/tmp"
 done
diff --git a/core/java/android/os/DeadObjectException.java b/core/java/android/os/DeadObjectException.java
index fc3870e..0a50778 100644
--- a/core/java/android/os/DeadObjectException.java
+++ b/core/java/android/os/DeadObjectException.java
@@ -26,7 +26,7 @@
  * receive this error from an app, at a minimum, you should
  * recover by resetting the connection. For instance, you should
  * drop the binder, clean up associated state, and reset your
- * connection to the service which through this error. In order
+ * connection to the service which threw this error. In order
  * to simplify your error recovery paths, you may also want to
  * "simply" restart your process. However, this may not be an
  * option if the service you are talking to is unreliable or
diff --git a/core/java/android/os/ServiceManagerNative.java b/core/java/android/os/ServiceManagerNative.java
index f2143f6..7b91dd5 100644
--- a/core/java/android/os/ServiceManagerNative.java
+++ b/core/java/android/os/ServiceManagerNative.java
@@ -50,7 +50,7 @@
 class ServiceManagerProxy implements IServiceManager {
     public ServiceManagerProxy(IBinder remote) {
         mRemote = remote;
-        mServiceManager = IServiceManager.Stub.asInterface(remote);
+        mServiceManager = IServiceManager.Stub.asInterface(this.getNativeServiceManager());
     }
 
     public IBinder asBinder() {
@@ -128,4 +128,6 @@
     private IBinder mRemote;
 
     private IServiceManager mServiceManager;
+
+    private native IBinder getNativeServiceManager();
 }
diff --git a/core/java/android/os/SharedMemory.java b/core/java/android/os/SharedMemory.java
index d008034..c801fabf 100644
--- a/core/java/android/os/SharedMemory.java
+++ b/core/java/android/os/SharedMemory.java
@@ -278,7 +278,6 @@
      */
     @Override
     public void close() {
-        mFileDescriptor.setInt$(-1);
         if (mCleaner != null) {
             mCleaner.clean();
             mCleaner = null;
diff --git a/core/java/android/security/flags.aconfig b/core/java/android/security/flags.aconfig
index aadc8db..38afb80 100644
--- a/core/java/android/security/flags.aconfig
+++ b/core/java/android/security/flags.aconfig
@@ -26,14 +26,6 @@
 }
 
 flag {
-    name: "fix_unlocked_device_required_keys_v2"
-    namespace: "hardware_backed_security"
-    description: "Fix bugs in behavior of UnlockedDeviceRequired keystore keys"
-    bug: "296464083"
-    is_fixed_read_only: true
-}
-
-flag {
     name: "keyinfo_unlocked_device_required"
     is_exported: true
     namespace: "hardware_backed_security"
diff --git a/core/java/android/view/autofill/OWNERS b/core/java/android/view/autofill/OWNERS
index 898947a..7f3b4e5 100644
--- a/core/java/android/view/autofill/OWNERS
+++ b/core/java/android/view/autofill/OWNERS
@@ -1,10 +1,11 @@
 # Bug component: 351486
 
-simranjit@google.com
 haoranzhang@google.com
+jiewenlei@google.com
+simranjit@google.com
 skxu@google.com
+shuc@google.com
 yunicorn@google.com
-reemabajwa@google.com
 
 # Bug component: 543785 = per-file *Augmented*
 per-file *Augmented* = wangqi@google.com
diff --git a/core/jni/Android.bp b/core/jni/Android.bp
index f67f161..ce19965 100644
--- a/core/jni/Android.bp
+++ b/core/jni/Android.bp
@@ -117,6 +117,7 @@
     ],
 
     defaults: [
+        "aconfig_lib_cc_shared_link.defaults",
         "latest_android_media_audio_common_types_cpp_target_shared",
     ],
 
@@ -191,6 +192,7 @@
                 "android_os_PerformanceHintManager.cpp",
                 "android_os_SELinux.cpp",
                 "android_os_ServiceManager.cpp",
+                "android_os_ServiceManagerNative.cpp",
                 "android_os_SharedMemory.cpp",
                 "android_os_storage_StorageManager.cpp",
                 "android_os_UEventObserver.cpp",
@@ -361,6 +363,7 @@
                 "libdl_android",
                 "libtimeinstate",
                 "server_configurable_flags",
+                "libaconfig_storage_read_api_cc",
                 "libimage_io",
                 "libultrahdr",
                 "libperfetto_c",
diff --git a/core/jni/AndroidRuntime.cpp b/core/jni/AndroidRuntime.cpp
index aa63f4f..9111129 100644
--- a/core/jni/AndroidRuntime.cpp
+++ b/core/jni/AndroidRuntime.cpp
@@ -148,6 +148,7 @@
 extern int register_android_os_HwRemoteBinder(JNIEnv *env);
 extern int register_android_os_NativeHandle(JNIEnv *env);
 extern int register_android_os_ServiceManager(JNIEnv *env);
+extern int register_android_os_ServiceManagerNative(JNIEnv* env);
 extern int register_android_os_MessageQueue(JNIEnv* env);
 extern int register_android_os_Parcel(JNIEnv* env);
 extern int register_android_os_PerformanceHintManager(JNIEnv* env);
@@ -1542,6 +1543,7 @@
         REG_JNI(register_android_os_HwRemoteBinder),
         REG_JNI(register_android_os_NativeHandle),
         REG_JNI(register_android_os_ServiceManager),
+        REG_JNI(register_android_os_ServiceManagerNative),
         REG_JNI(register_android_os_storage_StorageManager),
         REG_JNI(register_android_service_DataLoaderService),
         REG_JNI(register_android_view_DisplayEventReceiver),
diff --git a/core/jni/android_os_ServiceManagerNative.cpp b/core/jni/android_os_ServiceManagerNative.cpp
new file mode 100644
index 0000000..39a3013
--- /dev/null
+++ b/core/jni/android_os_ServiceManagerNative.cpp
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2024 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 <binder/IServiceManagerFFI.h>
+#include <jni.h>
+#include <nativehelper/JNIHelp.h>
+
+#include "android_util_Binder.h"
+namespace android {
+
+jobject JNICALL Java_android_os_ServiceManagerProxy_getNativeServiceManager(JNIEnv *env,
+                                                                            jobject obj) {
+    sp<IBinder> service = IInterface::asBinder(
+            impl::getJavaServicemanagerImplPrivateDoNotUseExceptInTheOnePlaceItIsUsed());
+    return javaObjectForIBinder(env, service);
+}
+
+// ----------------------------------------------------------------------------
+
+static const JNINativeMethod serviceManagerNativeMethods[] = {
+        /* name, signature, funcPtr */
+        {"getNativeServiceManager", "()Landroid/os/IBinder;",
+         (void *)Java_android_os_ServiceManagerProxy_getNativeServiceManager}};
+
+int register_android_os_ServiceManagerNative(JNIEnv *env) {
+    return jniRegisterNativeMethods(env, "android/os/ServiceManagerProxy",
+                                    serviceManagerNativeMethods,
+                                    NELEM(serviceManagerNativeMethods));
+}
+} // namespace android
\ No newline at end of file
diff --git a/core/res/res/xml/sms_short_codes.xml b/core/res/res/xml/sms_short_codes.xml
index 67cceb5..581dee5 100644
--- a/core/res/res/xml/sms_short_codes.xml
+++ b/core/res/res/xml/sms_short_codes.xml
@@ -185,6 +185,9 @@
          https://www.itu.int/dms_pub/itu-t/oth/02/02/T020200006B0001PDFE.pdf -->
     <shortcode country="it" pattern="\\d{5}" premium="44[0-4]\\d{2}|47[0-4]\\d{2}|48[0-4]\\d{2}|44[5-9]\\d{4}|47[5-9]\\d{4}|48[5-9]\\d{4}|455\\d{2}|499\\d{2}" free="116\\d{3}|4112503|40\\d{0,12}" standard="430\\d{2}|431\\d{2}|434\\d{4}|435\\d{4}|439\\d{7}" />
 
+    <!-- Jordan: 1-5 digits (standard system default, not country specific) -->
+    <shortcode country="jo" pattern="\\d{1,5}" free="99066" />
+
     <!-- Japan: 8083 used by SOFTBANK_DCB_2 -->
     <shortcode country="jp" pattern="\\d{1,5}" free="8083" />
 
diff --git a/libs/nativehelper_jvm/Android.bp b/libs/nativehelper_jvm/Android.bp
new file mode 100644
index 0000000..b5b7028
--- /dev/null
+++ b/libs/nativehelper_jvm/Android.bp
@@ -0,0 +1,19 @@
+package {
+    default_applicable_licenses: ["frameworks_base_license"],
+}
+
+cc_library_host_static {
+    name: "libnativehelper_jvm",
+    srcs: [
+        "JNIPlatformHelp.c",
+        "JniConstants.c",
+        "file_descriptor_jni.c",
+    ],
+    whole_static_libs: ["libnativehelper_any_vm"],
+    export_static_lib_headers: ["libnativehelper_any_vm"],
+    target: {
+        windows: {
+            enabled: true,
+        },
+    },
+}
diff --git a/libs/nativehelper_jvm/JNIPlatformHelp.c b/libs/nativehelper_jvm/JNIPlatformHelp.c
new file mode 100644
index 0000000..9df31a8
--- /dev/null
+++ b/libs/nativehelper_jvm/JNIPlatformHelp.c
@@ -0,0 +1,104 @@
+/*
+ * Copyright (C) 2024 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 <nativehelper/JNIPlatformHelp.h>
+
+#include <stddef.h>
+
+#include "JniConstants.h"
+
+static int GetBufferPosition(JNIEnv* env, jobject nioBuffer) {
+    return(*env)->GetIntField(env, nioBuffer, JniConstants_NioBuffer_position(env));
+}
+
+static int GetBufferLimit(JNIEnv* env, jobject nioBuffer) {
+    return(*env)->GetIntField(env, nioBuffer, JniConstants_NioBuffer_limit(env));
+}
+
+static int GetBufferElementSizeShift(JNIEnv* env, jobject nioBuffer) {
+    jclass byteBufferClass = JniConstants_NioByteBufferClass(env);
+    jclass shortBufferClass = JniConstants_NioShortBufferClass(env);
+    jclass charBufferClass = JniConstants_NioCharBufferClass(env);
+    jclass intBufferClass = JniConstants_NioIntBufferClass(env);
+    jclass floatBufferClass = JniConstants_NioFloatBufferClass(env);
+    jclass longBufferClass = JniConstants_NioLongBufferClass(env);
+    jclass doubleBufferClass = JniConstants_NioDoubleBufferClass(env);
+
+    // Check the type of the Buffer
+    if ((*env)->IsInstanceOf(env, nioBuffer, byteBufferClass)) {
+        return 0;
+    } else if ((*env)->IsInstanceOf(env, nioBuffer, shortBufferClass) ||
+               (*env)->IsInstanceOf(env, nioBuffer, charBufferClass)) {
+        return 1;
+    } else if ((*env)->IsInstanceOf(env, nioBuffer, intBufferClass) ||
+               (*env)->IsInstanceOf(env, nioBuffer, floatBufferClass)) {
+        return 2;
+    } else if ((*env)->IsInstanceOf(env, nioBuffer, longBufferClass) ||
+               (*env)->IsInstanceOf(env, nioBuffer, doubleBufferClass)) {
+        return 3;
+    }
+    return 0;
+}
+
+jarray jniGetNioBufferBaseArray(JNIEnv* env, jobject nioBuffer) {
+    jmethodID hasArrayMethod = JniConstants_NioBuffer_hasArray(env);
+    jboolean hasArray = (*env)->CallBooleanMethod(env, nioBuffer, hasArrayMethod);
+    if (hasArray) {
+        jmethodID arrayMethod = JniConstants_NioBuffer_array(env);
+        return (*env)->CallObjectMethod(env, nioBuffer, arrayMethod);
+    } else {
+        return NULL;
+    }
+}
+
+int jniGetNioBufferBaseArrayOffset(JNIEnv* env, jobject nioBuffer) {
+    jmethodID hasArrayMethod = JniConstants_NioBuffer_hasArray(env);
+    jboolean hasArray = (*env)->CallBooleanMethod(env, nioBuffer, hasArrayMethod);
+    if (hasArray) {
+        jmethodID arrayOffsetMethod = JniConstants_NioBuffer_arrayOffset(env);
+        jint arrayOffset = (*env)->CallIntMethod(env, nioBuffer, arrayOffsetMethod);
+        const int position = GetBufferPosition(env, nioBuffer);
+        jint elementSizeShift = GetBufferElementSizeShift(env, nioBuffer);
+        return (arrayOffset + position) << elementSizeShift;
+    } else {
+        return 0;
+    }
+}
+
+jlong jniGetNioBufferPointer(JNIEnv* env, jobject nioBuffer) {
+    // in Java 11, the address field of a HeapByteBuffer contains a non-zero value despite
+    // HeapByteBuffer being a non-direct buffer. In that case, this should still return 0.
+    jmethodID isDirectMethod = JniConstants_NioBuffer_isDirect(env);
+    jboolean isDirect = (*env)->CallBooleanMethod(env, nioBuffer, isDirectMethod);
+    if (isDirect == JNI_FALSE) {
+        return 0L;
+    }
+    jlong baseAddress = (*env)->GetLongField(env, nioBuffer, JniConstants_NioBuffer_address(env));
+    if (baseAddress != 0) {
+        const int position = GetBufferPosition(env, nioBuffer);
+        const int shift = GetBufferElementSizeShift(env, nioBuffer);
+        baseAddress += position << shift;
+    }
+    return baseAddress;
+}
+
+jlong jniGetNioBufferFields(JNIEnv* env, jobject nioBuffer,
+                            jint* position, jint* limit, jint* elementSizeShift) {
+    *position = GetBufferPosition(env, nioBuffer);
+    *limit = GetBufferLimit(env, nioBuffer);
+    *elementSizeShift = GetBufferElementSizeShift(env, nioBuffer);
+    return (*env)->GetLongField(env, nioBuffer, JniConstants_NioBuffer_address(env));
+}
diff --git a/libs/nativehelper_jvm/JniConstants.c b/libs/nativehelper_jvm/JniConstants.c
new file mode 100644
index 0000000..ca58f61
--- /dev/null
+++ b/libs/nativehelper_jvm/JniConstants.c
@@ -0,0 +1,199 @@
+/*
+ * Copyright (C) 2024 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 "JniConstants.h"
+
+#include <pthread.h>
+#include <stdbool.h>
+#include <stddef.h>
+#include <string.h>
+
+#define LOG_TAG "JniConstants"
+#include <log/log.h>
+
+// jclass constants list:
+//   <class, signature, androidOnly>
+#define JCLASS_CONSTANTS_LIST(V)                                            \
+  V(FileDescriptor, "java/io/FileDescriptor", false)                        \
+  V(NioBuffer, "java/nio/Buffer", false)                                    \
+  V(NioByteBuffer, "java/nio/ByteBuffer", false)                            \
+  V(NioShortBuffer, "java/nio/ShortBuffer", false)                          \
+  V(NioCharBuffer, "java/nio/CharBuffer", false)                            \
+  V(NioIntBuffer, "java/nio/IntBuffer", false)                              \
+  V(NioFloatBuffer, "java/nio/FloatBuffer", false)                          \
+  V(NioLongBuffer, "java/nio/LongBuffer", false)                            \
+  V(NioDoubleBuffer, "java/nio/DoubleBuffer", false)
+
+// jmethodID's of public methods constants list:
+//   <Class, method, method-string, signature, is_static>
+#define JMETHODID_CONSTANTS_LIST(V)                                                         \
+  V(FileDescriptor, init, "<init>", "()V", false)                                           \
+  V(NioBuffer, array, "array", "()Ljava/lang/Object;", false)                               \
+  V(NioBuffer, hasArray, "hasArray", "()Z", false)                                          \
+  V(NioBuffer, isDirect, "isDirect", "()Z", false)                                          \
+  V(NioBuffer, arrayOffset, "arrayOffset", "()I", false)
+
+// jfieldID constants list:
+//   <Class, field, signature, is_static>
+#define JFIELDID_CONSTANTS_LIST(V)                                          \
+  V(FileDescriptor, fd, "I", false)                                         \
+  V(NioBuffer, address, "J", false)                                         \
+  V(NioBuffer, limit, "I", false)                                           \
+  V(NioBuffer, position, "I", false)
+
+#define CLASS_NAME(cls)             g_ ## cls
+#define METHOD_NAME(cls, method)    g_ ## cls ## _ ## method
+#define FIELD_NAME(cls, field)      g_ ## cls ## _ ## field
+
+//
+// Declare storage for cached classes, methods and fields.
+//
+
+#define JCLASS_DECLARE_STORAGE(cls, ...)                                    \
+  static jclass CLASS_NAME(cls) = NULL;
+JCLASS_CONSTANTS_LIST(JCLASS_DECLARE_STORAGE)
+#undef JCLASS_DECLARE_STORAGE
+
+#define JMETHODID_DECLARE_STORAGE(cls, method, ...)                         \
+  static jmethodID METHOD_NAME(cls, method) = NULL;
+JMETHODID_CONSTANTS_LIST(JMETHODID_DECLARE_STORAGE)
+#undef JMETHODID_DECLARE_STORAGE
+
+#define JFIELDID_DECLARE_STORAGE(cls, field, ...)                           \
+  static jfieldID FIELD_NAME(cls, field) = NULL;
+JFIELDID_CONSTANTS_LIST(JFIELDID_DECLARE_STORAGE)
+#undef JFIELDID_DECLARE_STORAGE
+
+//
+// Helper methods
+//
+
+static jclass FindClass(JNIEnv* env, const char* signature, bool androidOnly) {
+    jclass cls = (*env)->FindClass(env, signature);
+    if (cls == NULL) {
+        LOG_ALWAYS_FATAL_IF(!androidOnly, "Class not found: %s", signature);
+        return NULL;
+    }
+    return (*env)->NewGlobalRef(env, cls);
+}
+
+static jmethodID FindMethod(JNIEnv* env, jclass cls,
+                            const char* name, const char* signature, bool isStatic) {
+    jmethodID method;
+    if (isStatic) {
+        method = (*env)->GetStaticMethodID(env, cls, name, signature);
+    } else {
+        method = (*env)->GetMethodID(env, cls, name, signature);
+    }
+    LOG_ALWAYS_FATAL_IF(method == NULL, "Method not found: %s:%s", name, signature);
+    return method;
+}
+
+static jfieldID FindField(JNIEnv* env, jclass cls,
+                          const char* name, const char* signature, bool isStatic) {
+    jfieldID field;
+    if (isStatic) {
+        field = (*env)->GetStaticFieldID(env, cls, name, signature);
+    } else {
+        field = (*env)->GetFieldID(env, cls, name, signature);
+    }
+    LOG_ALWAYS_FATAL_IF(field == NULL, "Field not found: %s:%s", name, signature);
+    return field;
+}
+
+static pthread_once_t g_initialized = PTHREAD_ONCE_INIT;
+static JNIEnv* g_init_env;
+
+static void InitializeConstants() {
+    // Initialize cached classes.
+#define JCLASS_INITIALIZE(cls, signature, androidOnly)                      \
+    CLASS_NAME(cls) = FindClass(g_init_env, signature, androidOnly);
+    JCLASS_CONSTANTS_LIST(JCLASS_INITIALIZE)
+#undef JCLASS_INITIALIZE
+
+    // Initialize cached methods.
+#define JMETHODID_INITIALIZE(cls, method, name, signature, isStatic)        \
+    METHOD_NAME(cls, method) =                                              \
+        FindMethod(g_init_env, CLASS_NAME(cls), name, signature, isStatic);
+    JMETHODID_CONSTANTS_LIST(JMETHODID_INITIALIZE)
+#undef JMETHODID_INITIALIZE
+
+    // Initialize cached fields.
+#define JFIELDID_INITIALIZE(cls, field, signature, isStatic)                \
+    FIELD_NAME(cls, field) =                                                \
+        FindField(g_init_env, CLASS_NAME(cls), #field, signature, isStatic);
+    JFIELDID_CONSTANTS_LIST(JFIELDID_INITIALIZE)
+#undef JFIELDID_INITIALIZE
+}
+
+void EnsureInitialized(JNIEnv* env) {
+    // This method has to be called in every cache accesses because library can be built
+    // 2 different ways and existing usage for compat version doesn't have a good hook for
+    // initialization and is widely used.
+    g_init_env = env;
+    pthread_once(&g_initialized, InitializeConstants);
+}
+
+// API exported by libnativehelper_api.h.
+
+void jniUninitializeConstants() {
+    // Uninitialize cached classes, methods and fields.
+    //
+    // NB we assume the runtime is stopped at this point and do not delete global
+    // references.
+#define JCLASS_INVALIDATE(cls, ...) CLASS_NAME(cls) = NULL;
+    JCLASS_CONSTANTS_LIST(JCLASS_INVALIDATE);
+#undef JCLASS_INVALIDATE
+
+#define JMETHODID_INVALIDATE(cls, method, ...) METHOD_NAME(cls, method) = NULL;
+    JMETHODID_CONSTANTS_LIST(JMETHODID_INVALIDATE);
+#undef JMETHODID_INVALIDATE
+
+#define JFIELDID_INVALIDATE(cls, field, ...) FIELD_NAME(cls, field) = NULL;
+    JFIELDID_CONSTANTS_LIST(JFIELDID_INVALIDATE);
+#undef JFIELDID_INVALIDATE
+
+    // If jniConstantsUninitialize is called, runtime has shutdown. Reset
+    // state as some tests re-start the runtime.
+    pthread_once_t o = PTHREAD_ONCE_INIT;
+    memcpy(&g_initialized, &o, sizeof(o));
+}
+
+//
+// Accessors
+//
+
+#define JCLASS_ACCESSOR_IMPL(cls, ...)                                      \
+jclass JniConstants_ ## cls ## Class(JNIEnv* env) {                         \
+    EnsureInitialized(env);                                                 \
+    return CLASS_NAME(cls);                                                 \
+}
+JCLASS_CONSTANTS_LIST(JCLASS_ACCESSOR_IMPL)
+#undef JCLASS_ACCESSOR_IMPL
+
+#define JMETHODID_ACCESSOR_IMPL(cls, method, ...)                           \
+jmethodID JniConstants_ ## cls ## _ ## method(JNIEnv* env) {                \
+    EnsureInitialized(env);                                                 \
+    return METHOD_NAME(cls, method);                                        \
+}
+JMETHODID_CONSTANTS_LIST(JMETHODID_ACCESSOR_IMPL)
+
+#define JFIELDID_ACCESSOR_IMPL(cls, field, ...)                             \
+jfieldID JniConstants_ ## cls ## _ ## field(JNIEnv* env) {                  \
+    EnsureInitialized(env);                                                 \
+    return FIELD_NAME(cls, field);                                          \
+}
+JFIELDID_CONSTANTS_LIST(JFIELDID_ACCESSOR_IMPL)
diff --git a/libs/nativehelper_jvm/JniConstants.h b/libs/nativehelper_jvm/JniConstants.h
new file mode 100644
index 0000000..e7a266d
--- /dev/null
+++ b/libs/nativehelper_jvm/JniConstants.h
@@ -0,0 +1,63 @@
+/*
+ * Copyright 2024 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.
+ */
+
+#pragma once
+
+#include <sys/cdefs.h>
+
+#include <jni.h>
+
+__BEGIN_DECLS
+
+//
+// Classes in constants cache.
+//
+// NB The implementations of these methods are generated by the JCLASS_ACCESSOR_IMPL macro in
+// JniConstants.c.
+//
+jclass JniConstants_FileDescriptorClass(JNIEnv* env);
+jclass JniConstants_NioByteBufferClass(JNIEnv* env);
+jclass JniConstants_NioShortBufferClass(JNIEnv* env);
+jclass JniConstants_NioCharBufferClass(JNIEnv* env);
+jclass JniConstants_NioIntBufferClass(JNIEnv* env);
+jclass JniConstants_NioFloatBufferClass(JNIEnv* env);
+jclass JniConstants_NioLongBufferClass(JNIEnv* env);
+jclass JniConstants_NioDoubleBufferClass(JNIEnv* env);
+
+//
+// Methods in the constants cache.
+//
+// NB The implementations of these methods are generated by the JMETHODID_ACCESSOR_IMPL macro in
+// JniConstants.c.
+//
+jmethodID JniConstants_FileDescriptor_init(JNIEnv* env);
+jmethodID JniConstants_NioBuffer_array(JNIEnv* env);
+jmethodID JniConstants_NioBuffer_arrayOffset(JNIEnv* env);
+jmethodID JniConstants_NioBuffer_hasArray(JNIEnv* env);
+jmethodID JniConstants_NioBuffer_isDirect(JNIEnv* env);
+
+//
+// Fields in the constants cache.
+//
+// NB The implementations of these methods are generated by the JFIELDID_ACCESSOR_IMPL macro in
+// JniConstants.c.
+//
+jfieldID JniConstants_FileDescriptor_fd(JNIEnv* env);
+jfieldID JniConstants_NioBuffer_address(JNIEnv* env);
+jfieldID JniConstants_NioBuffer_limit(JNIEnv* env);
+jfieldID JniConstants_NioBuffer_position(JNIEnv* env);
+
+__END_DECLS
diff --git a/libs/nativehelper_jvm/OWNERS b/libs/nativehelper_jvm/OWNERS
new file mode 100644
index 0000000..5d55f6e
--- /dev/null
+++ b/libs/nativehelper_jvm/OWNERS
@@ -0,0 +1,7 @@
+# Bug component: 326772
+
+include /libs/hwui/OWNERS
+include platform/libnativehelper:/OWNERS
+
+diegoperez@google.com
+jgaillard@google.com
diff --git a/libs/nativehelper_jvm/README b/libs/nativehelper_jvm/README
new file mode 100644
index 0000000..755c422
--- /dev/null
+++ b/libs/nativehelper_jvm/README
@@ -0,0 +1,2 @@
+libnativehelper_jvm is a JVM-compatible version of libnativehelper.
+It should be used instead of libnativehelper whenever a host library is meant to run on a JVM.
\ No newline at end of file
diff --git a/libs/nativehelper_jvm/file_descriptor_jni.c b/libs/nativehelper_jvm/file_descriptor_jni.c
new file mode 100644
index 0000000..36880cd
--- /dev/null
+++ b/libs/nativehelper_jvm/file_descriptor_jni.c
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2024 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 <android/file_descriptor_jni.h>
+
+#include <stddef.h>
+
+#define LOG_TAG "file_descriptor_jni"
+#include <log/log.h>
+
+#include "JniConstants.h"
+
+static void EnsureArgumentIsFileDescriptor(JNIEnv* env, jobject instance) {
+    LOG_ALWAYS_FATAL_IF(instance == NULL, "FileDescriptor is NULL");
+    jclass jifd = JniConstants_FileDescriptorClass(env);
+    LOG_ALWAYS_FATAL_IF(!(*env)->IsInstanceOf(env, instance, jifd),
+                         "Argument is not a FileDescriptor");
+}
+
+JNIEXPORT _Nullable jobject AFileDescriptor_create(JNIEnv* env) {
+    return (*env)->NewObject(env,
+                             JniConstants_FileDescriptorClass(env),
+                             JniConstants_FileDescriptor_init(env));
+}
+
+JNIEXPORT int AFileDescriptor_getFd(JNIEnv* env, jobject fileDescriptor) {
+    EnsureArgumentIsFileDescriptor(env, fileDescriptor);
+    return (*env)->GetIntField(env, fileDescriptor, JniConstants_FileDescriptor_fd(env));
+}
+
+JNIEXPORT void AFileDescriptor_setFd(JNIEnv* env, jobject fileDescriptor, int fd) {
+    EnsureArgumentIsFileDescriptor(env, fileDescriptor);
+    (*env)->SetIntField(env, fileDescriptor, JniConstants_FileDescriptor_fd(env), fd);
+}
diff --git a/location/Android.bp b/location/Android.bp
index 5ba35ac..7f3442c 100644
--- a/location/Android.bp
+++ b/location/Android.bp
@@ -39,6 +39,11 @@
             "frameworks/base/core/java",
         ],
     },
+    lint: {
+        warning_checks: [
+            "FlaggedApi",
+        ],
+    },
 }
 
 platform_compat_config {
diff --git a/media/java/android/media/MediaCodec.java b/media/java/android/media/MediaCodec.java
index 3ba0d59..8acaf3b 100644
--- a/media/java/android/media/MediaCodec.java
+++ b/media/java/android/media/MediaCodec.java
@@ -5143,9 +5143,9 @@
      * of negative QP and positive QP are chosen wisely, the overall viewing experience can be
      * improved.
      * <p>
-     * If byte array size is too small than the expected size, components may ignore the
-     * configuration silently. If the byte array exceeds the expected size, components shall use
-     * the initial portion and ignore the rest.
+     * If byte array size is smaller than the expected size, components will ignore the
+     * configuration and print an error message. If the byte array exceeds the expected size,
+     * components will use the initial portion and ignore the rest.
      * <p>
      * The scope of this key is throughout the encoding session until it is reconfigured during
      * running state.
@@ -5159,7 +5159,8 @@
      * Set the region of interest as QpOffset-Rects on the next queued input frame.
      * <p>
      * The associated value is a String in the format "Top1,Left1-Bottom1,Right1=Offset1;Top2,
-     * Left2-Bottom2,Right2=Offset2;...". Co-ordinates (Top, Left), (Top, Right), (Bottom, Left)
+     * Left2-Bottom2,Right2=Offset2;...". If the configuration doesn't follow this pattern,
+     * it will be ignored. Co-ordinates (Top, Left), (Top, Right), (Bottom, Left)
      * and (Bottom, Right) form the vertices of bounding box of region of interest in pixels.
      * Pixel (0, 0) points to the top-left corner of the frame. Offset is the suggested
      * quantization parameter (QP) offset of the blocks in the bounding box. The bounding box
@@ -5171,9 +5172,10 @@
      * negative QP and positive QP are chosen wisely, the overall viewing experience can be
      * improved.
      * <p>
-     * If Roi rect is not valid that is bounding box width is < 0 or bounding box height is < 0,
-     * components may ignore the configuration silently. If Roi rect extends outside frame
-     * boundaries, then rect shall be clamped to the frame boundaries.
+     * If roi (region of interest) rect is outside the frame boundaries, that is, left < 0 or
+     * top < 0 or right > width or bottom > height, then rect shall be clamped to the frame
+     * boundaries. If roi rect is not valid, that is left > right or top > bottom, then the
+     * parameter setting is ignored.
      * <p>
      * The scope of this key is throughout the encoding session until it is reconfigured during
      * running state.
diff --git a/media/jni/Android.bp b/media/jni/Android.bp
index 2141516..1ed6476 100644
--- a/media/jni/Android.bp
+++ b/media/jni/Android.bp
@@ -79,7 +79,6 @@
         "libcamera_client",
         "libmtp",
         "libpiex",
-        "libprocessgroup",
         "libandroidfw",
         "libhidlallocatorutils",
         "libhidlbase",
diff --git a/native/graphics/jni/Android.bp b/native/graphics/jni/Android.bp
index 746c280..8f16f76 100644
--- a/native/graphics/jni/Android.bp
+++ b/native/graphics/jni/Android.bp
@@ -23,6 +23,9 @@
 
 cc_library_shared {
     name: "libjnigraphics",
+    defaults: [
+        "bug_24465209_workaround",
+    ],
 
     cflags: [
         "-Wall",
@@ -47,13 +50,6 @@
 
     static_libs: ["libarect"],
 
-    arch: {
-        arm: {
-            // TODO: This is to work around b/24465209. Remove after root cause is fixed
-            pack_relocations: false,
-            ldflags: ["-Wl,--hash-style=both"],
-        },
-    },
     host_supported: true,
     target: {
         android: {
diff --git a/packages/CrashRecovery/aconfig/flags.aconfig b/packages/CrashRecovery/aconfig/flags.aconfig
index 80412321..225f8c6 100644
--- a/packages/CrashRecovery/aconfig/flags.aconfig
+++ b/packages/CrashRecovery/aconfig/flags.aconfig
@@ -26,8 +26,8 @@
 }
 
 flag {
-    name: "reenable_settings_resets"
+    name: "deprecate_flags_and_settings_resets"
     namespace: "modularization"
-    description: "Re-enables settings resets only, deletes flag resets"
+    description: "Deletes flag and settings resets"
     bug: "333847376"
 }
diff --git a/packages/CtsShim/Android.bp b/packages/CtsShim/Android.bp
index baafe7b..a94c8c5 100644
--- a/packages/CtsShim/Android.bp
+++ b/packages/CtsShim/Android.bp
@@ -61,7 +61,6 @@
         "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",
     ],
@@ -102,7 +101,6 @@
         "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/Android.bp b/packages/CtsShim/build/Android.bp
index d6b7ecf..5b3d47e 100644
--- a/packages/CtsShim/build/Android.bp
+++ b/packages/CtsShim/build/Android.bp
@@ -93,7 +93,6 @@
         "com.android.apex.cts.shim.v1",
         "com.android.apex.cts.shim.v2",
         "com.android.apex.cts.shim.v2_apk_in_apex_upgrades",
-        "com.android.apex.cts.shim.v2_no_hashtree",
         "com.android.apex.cts.shim.v2_legacy",
         "com.android.apex.cts.shim.v2_sdk_target_p",
         "com.android.apex.cts.shim.v2_unsigned_payload",
@@ -200,7 +199,6 @@
         "com.android.apex.cts.shim.v1",
         "com.android.apex.cts.shim.v2",
         "com.android.apex.cts.shim.v2_apk_in_apex_upgrades",
-        "com.android.apex.cts.shim.v2_no_hashtree",
         "com.android.apex.cts.shim.v2_legacy",
         "com.android.apex.cts.shim.v2_sdk_target_p",
         "com.android.apex.cts.shim.v2_unsigned_payload",
diff --git a/packages/CtsShim/build/jni/Android.bp b/packages/CtsShim/build/jni/Android.bp
index 2dbf2a2..ac85d2b 100644
--- a/packages/CtsShim/build/jni/Android.bp
+++ b/packages/CtsShim/build/jni/Android.bp
@@ -33,7 +33,6 @@
         "com.android.apex.cts.shim.v1",
         "com.android.apex.cts.shim.v2",
         "com.android.apex.cts.shim.v2_apk_in_apex_upgrades",
-        "com.android.apex.cts.shim.v2_no_hashtree",
         "com.android.apex.cts.shim.v2_legacy",
         "com.android.apex.cts.shim.v2_sdk_target_p",
         "com.android.apex.cts.shim.v2_unsigned_payload",
diff --git a/packages/SettingsLib/src/com/android/settingslib/bluetooth/OWNERS b/packages/SettingsLib/src/com/android/settingslib/bluetooth/OWNERS
index 7669e79b..f8c3a93 100644
--- a/packages/SettingsLib/src/com/android/settingslib/bluetooth/OWNERS
+++ b/packages/SettingsLib/src/com/android/settingslib/bluetooth/OWNERS
@@ -1,9 +1,4 @@
 # Default reviewers for this and subdirectories.
-siyuanh@google.com
-hughchen@google.com
-timhypeng@google.com
-robertluo@google.com
-songferngwang@google.com
 yqian@google.com
 chelseahao@google.com
 yiyishen@google.com
diff --git a/packages/SystemUI/OWNERS b/packages/SystemUI/OWNERS
index 3a5ec92..9374bf4 100644
--- a/packages/SystemUI/OWNERS
+++ b/packages/SystemUI/OWNERS
@@ -8,6 +8,7 @@
 acul@google.com
 adamcohen@google.com
 aioana@google.com
+alexchau@google.com
 alexflo@google.com
 andonian@google.com
 aroederer@google.com
@@ -83,8 +84,10 @@
 rahulbanerjee@google.com
 roosa@google.com
 saff@google.com
+samcackett@google.com
 santie@google.com
 shanh@google.com
+silvajordan@google.com
 snoeberger@google.com
 steell@google.com
 stevenckng@google.com
@@ -96,6 +99,7 @@
 tracyzhou@google.com
 tsuji@google.com
 twickham@google.com
+uwaisashraf@google.com
 vadimt@google.com
 valiiftime@google.com
 vanjan@google.com
diff --git a/packages/SystemUI/TEST_MAPPING b/packages/SystemUI/TEST_MAPPING
index 0c89a5d..adcb8d4 100644
--- a/packages/SystemUI/TEST_MAPPING
+++ b/packages/SystemUI/TEST_MAPPING
@@ -59,7 +59,7 @@
       ]
     }
   ],
-  
+
   "auto-end-to-end-postsubmit": [
     {
       "name": "AndroidAutomotiveHomeTests",
@@ -78,7 +78,7 @@
       ]
     }
   ],
-  
+
   "postsubmit": [
     {
       // Permission indicators
@@ -90,7 +90,7 @@
       ]
     }
   ],
-  
+
   // v2/sysui/suite/test-mapping-sysui-screenshot-test
   "sysui-screenshot-test": [
     {
@@ -128,7 +128,7 @@
       ]
     }
   ],
-  
+
   // v2/sysui/suite/test-mapping-sysui-screenshot-test-staged
   "sysui-screenshot-test-staged": [
     {
@@ -153,5 +153,13 @@
         }
       ]
     }
+  ],
+  "sysui-robo-test": [
+    {
+      "name": "SystemUIGoogleRoboRNGTests"
+    },
+    {
+      "name": "SystemUIGoogleRobo2RNGTests"
+    }
   ]
 }
diff --git a/services/Android.bp b/services/Android.bp
index 0fbbd16..a0d3454 100644
--- a/services/Android.bp
+++ b/services/Android.bp
@@ -239,6 +239,7 @@
     libs: [
         "android.hidl.manager-V1.0-java",
         "framework-tethering.stubs.module_lib",
+        "keepanno-annotations",
         "service-art.stubs.system_server",
         "service-permission.stubs.system_server",
         "service-rkp.stubs.system_server",
diff --git a/services/core/Android.bp b/services/core/Android.bp
index 7fb2250..fa323fd 100644
--- a/services/core/Android.bp
+++ b/services/core/Android.bp
@@ -182,6 +182,7 @@
         "android.hardware.vibrator-V2-java",
         "app-compat-annotations",
         "framework-tethering.stubs.module_lib",
+        "keepanno-annotations",
         "service-art.stubs.system_server",
         "service-permission.stubs.system_server",
         "service-rkp.stubs.system_server",
@@ -267,6 +268,9 @@
     ],
     lint: {
         baseline_filename: "lint-baseline.xml",
+        warning_checks: [
+            "FlaggedApi",
+        ],
     },
 }
 
diff --git a/services/core/java/com/android/server/RescueParty.java b/services/core/java/com/android/server/RescueParty.java
index 189b2495..dfd148d 100644
--- a/services/core/java/com/android/server/RescueParty.java
+++ b/services/core/java/com/android/server/RescueParty.java
@@ -58,7 +58,6 @@
 import java.lang.annotation.Retention;
 import java.lang.annotation.RetentionPolicy;
 import java.util.ArrayList;
-import java.util.Arrays;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Iterator;
@@ -493,14 +492,6 @@
 
     private static void executeRescueLevelInternalOld(Context context, int level, @Nullable
             String failedPackage) throws Exception {
-
-        // Note: DeviceConfig reset is disabled currently and would be enabled using the flag,
-        // after we have figured out a way to reset flags without interfering with trunk
-        // development. TODO: b/287618292 For enabling flag resets.
-        if (!Flags.allowRescuePartyFlagResets() && level <= LEVEL_RESET_SETTINGS_TRUSTED_DEFAULTS) {
-            return;
-        }
-
         CrashRecoveryStatsLog.write(CrashRecoveryStatsLog.RESCUE_PARTY_RESET_REPORTED,
                 level, levelToString(level));
         // Try our best to reset all settings possible, and once finished
@@ -508,43 +499,10 @@
         Exception res = null;
         switch (level) {
             case LEVEL_RESET_SETTINGS_UNTRUSTED_DEFAULTS:
-                try {
-                    resetAllSettingsIfNecessary(context, Settings.RESET_MODE_UNTRUSTED_DEFAULTS,
-                            level);
-                } catch (Exception e) {
-                    res = e;
-                }
-                try {
-                    resetDeviceConfig(context, /*isScoped=*/true, failedPackage);
-                } catch (Exception e) {
-                    res = e;
-                }
                 break;
             case LEVEL_RESET_SETTINGS_UNTRUSTED_CHANGES:
-                try {
-                    resetAllSettingsIfNecessary(context, Settings.RESET_MODE_UNTRUSTED_CHANGES,
-                            level);
-                } catch (Exception e) {
-                    res = e;
-                }
-                try {
-                    resetDeviceConfig(context, /*isScoped=*/true, failedPackage);
-                } catch (Exception e) {
-                    res = e;
-                }
                 break;
             case LEVEL_RESET_SETTINGS_TRUSTED_DEFAULTS:
-                try {
-                    resetAllSettingsIfNecessary(context, Settings.RESET_MODE_TRUSTED_DEFAULTS,
-                            level);
-                } catch (Exception e) {
-                    res = e;
-                }
-                try {
-                    resetDeviceConfig(context, /*isScoped=*/false, failedPackage);
-                } catch (Exception e) {
-                    res = e;
-                }
                 break;
             case LEVEL_WARM_REBOOT:
                 executeWarmReboot(context, level, failedPackage);
@@ -572,16 +530,8 @@
                 level, levelToString(level));
         switch (level) {
             case RESCUE_LEVEL_SCOPED_DEVICE_CONFIG_RESET:
-                // Enable deviceConfig reset behind flag
-                if (Flags.allowRescuePartyFlagResets()) {
-                    resetDeviceConfig(context, /*isScoped=*/true, failedPackage);
-                }
                 break;
             case RESCUE_LEVEL_ALL_DEVICE_CONFIG_RESET:
-                // Enable deviceConfig reset behind flag
-                if (Flags.allowRescuePartyFlagResets()) {
-                    resetDeviceConfig(context, /*isScoped=*/false, failedPackage);
-                }
                 break;
             case RESCUE_LEVEL_WARM_REBOOT:
                 executeWarmReboot(context, level, failedPackage);
@@ -732,61 +682,6 @@
         }
     }
 
-    private static void resetDeviceConfig(Context context, boolean isScoped,
-            @Nullable String failedPackage) throws Exception {
-        final ContentResolver resolver = context.getContentResolver();
-        try {
-            if (!isScoped || failedPackage == null) {
-                resetAllAffectedNamespaces(context);
-            } else {
-                performScopedReset(context, failedPackage);
-            }
-        } catch (Exception e) {
-            throw new RuntimeException("Failed to reset config settings", e);
-        }
-    }
-
-    private static void resetAllAffectedNamespaces(Context context) {
-        RescuePartyObserver rescuePartyObserver = RescuePartyObserver.getInstance(context);
-        Set<String> allAffectedNamespaces = rescuePartyObserver.getAllAffectedNamespaceSet();
-
-        Slog.w(TAG,
-                "Performing reset for all affected namespaces: "
-                        + Arrays.toString(allAffectedNamespaces.toArray()));
-        Iterator<String> it = allAffectedNamespaces.iterator();
-        while (it.hasNext()) {
-            String namespace = it.next();
-            // Don't let RescueParty reset the namespace for RescueParty switches.
-            if (NAMESPACE_CONFIGURATION.equals(namespace)) {
-                continue;
-            }
-            DeviceConfig.resetToDefaults(DEVICE_CONFIG_RESET_MODE, namespace);
-        }
-    }
-
-    private static void performScopedReset(Context context, @NonNull String failedPackage) {
-        RescuePartyObserver rescuePartyObserver = RescuePartyObserver.getInstance(context);
-        Set<String> affectedNamespaces = rescuePartyObserver.getAffectedNamespaceSet(
-                failedPackage);
-        // If we can't find namespaces affected for current package,
-        // skip this round of reset.
-        if (affectedNamespaces != null) {
-            Slog.w(TAG,
-                    "Performing scoped reset for package: " + failedPackage
-                            + ", affected namespaces: "
-                            + Arrays.toString(affectedNamespaces.toArray()));
-            Iterator<String> it = affectedNamespaces.iterator();
-            while (it.hasNext()) {
-                String namespace = it.next();
-                // Don't let RescueParty reset the namespace for RescueParty switches.
-                if (NAMESPACE_CONFIGURATION.equals(namespace)) {
-                    continue;
-                }
-                DeviceConfig.resetToDefaults(DEVICE_CONFIG_RESET_MODE, namespace);
-            }
-        }
-    }
-
     /**
      * Handle mitigation action for package failures. This observer will be register to Package
      * Watchdog and will receive calls about package failures. This observer is persistent so it
diff --git a/services/core/java/com/android/server/biometrics/sensors/BiometricServiceRegistry.java b/services/core/java/com/android/server/biometrics/sensors/BiometricServiceRegistry.java
index 6a2731d..5a493e4 100644
--- a/services/core/java/com/android/server/biometrics/sensors/BiometricServiceRegistry.java
+++ b/services/core/java/com/android/server/biometrics/sensors/BiometricServiceRegistry.java
@@ -120,11 +120,13 @@
         // Register each sensor individually with BiometricService
         final List<P> allProps = new ArrayList<>();
         for (T provider : providers) {
-            final List<P> props = provider.getSensorProperties();
-            for (P prop : props) {
-                registerService(biometricService, prop);
+            if(provider != null) {
+                final List<P> props = provider.getSensorProperties();
+                for (P prop : props) {
+                    registerService(biometricService, prop);
+                }
+                allProps.addAll(props);
             }
-            allProps.addAll(props);
         }
 
         finishRegistration(providers, allProps);
diff --git a/services/core/java/com/android/server/crashrecovery/TEST_MAPPING b/services/core/java/com/android/server/crashrecovery/TEST_MAPPING
new file mode 100644
index 0000000..4a66bac
--- /dev/null
+++ b/services/core/java/com/android/server/crashrecovery/TEST_MAPPING
@@ -0,0 +1,12 @@
+{
+  "postsubmit": [
+    {
+      "name": "FrameworksMockingServicesTests",
+      "options": [
+        {
+          "include-filter": "com.android.server.RescuePartyTest"
+        }
+      ]
+    }
+  ]
+}
\ No newline at end of file
diff --git a/services/core/java/com/android/server/display/LocalDisplayAdapter.java b/services/core/java/com/android/server/display/LocalDisplayAdapter.java
index 88c24e0..cf4393b 100644
--- a/services/core/java/com/android/server/display/LocalDisplayAdapter.java
+++ b/services/core/java/com/android/server/display/LocalDisplayAdapter.java
@@ -48,6 +48,7 @@
 import android.view.SurfaceControl;
 
 import com.android.internal.R;
+import com.android.internal.annotations.KeepForWeakReference;
 import com.android.internal.annotations.VisibleForTesting;
 import com.android.internal.display.BrightnessSynchronizer;
 import com.android.internal.util.function.pooled.PooledLambda;
@@ -1394,8 +1395,9 @@
     }
 
     public static class Injector {
-        // Native callback.
+        // Ensure the callback is kept to preserve native weak reference lifecycle semantics.
         @SuppressWarnings("unused")
+        @KeepForWeakReference
         private ProxyDisplayEventReceiver mReceiver;
         public void setDisplayEventListenerLocked(Looper looper, DisplayEventListener listener) {
             mReceiver = new ProxyDisplayEventReceiver(looper, listener);
diff --git a/services/core/java/com/android/server/hdmi/HdmiControlService.java b/services/core/java/com/android/server/hdmi/HdmiControlService.java
index c8c66238..d5f8ead 100644
--- a/services/core/java/com/android/server/hdmi/HdmiControlService.java
+++ b/services/core/java/com/android/server/hdmi/HdmiControlService.java
@@ -143,6 +143,10 @@
     private static final String TAG = "HdmiControlService";
     private static final Locale HONG_KONG = new Locale("zh", "HK");
     private static final Locale MACAU = new Locale("zh", "MO");
+    private static final String TAIWAN_HantLanguageTag = "zh-Hant-TW";
+    private static final String HONG_KONG_HantLanguageTag = "zh-Hant-HK";
+    private static final String HONG_KONG_YUE_HantLanguageTag = "yue-Hant-HK";
+    private static final String MACAU_HantLanguageTag = "zh-Hant-MO";
 
     private static final Map<String, String> sTerminologyToBibliographicMap =
             createsTerminologyToBibliographicMap();
@@ -173,7 +177,11 @@
     }
 
     @VisibleForTesting static String localeToMenuLanguage(Locale locale) {
-        if (locale.equals(Locale.TAIWAN) || locale.equals(HONG_KONG) || locale.equals(MACAU)) {
+        if (locale.equals(Locale.TAIWAN) || locale.equals(HONG_KONG) || locale.equals(MACAU) ||
+                locale.toLanguageTag().equals(TAIWAN_HantLanguageTag) ||
+                locale.toLanguageTag().equals(HONG_KONG_HantLanguageTag) ||
+                locale.toLanguageTag().equals(HONG_KONG_YUE_HantLanguageTag) ||
+                locale.toLanguageTag().equals(MACAU_HantLanguageTag)) {
             // Android always returns "zho" for all Chinese variants.
             // Use "bibliographic" code defined in CEC639-2 for traditional
             // Chinese used in Taiwan/Hong Kong/Macau.
diff --git a/services/core/java/com/android/server/notification/RankingHelper.java b/services/core/java/com/android/server/notification/RankingHelper.java
index 773d10b..478868b 100644
--- a/services/core/java/com/android/server/notification/RankingHelper.java
+++ b/services/core/java/com/android/server/notification/RankingHelper.java
@@ -25,6 +25,10 @@
 import android.util.Slog;
 import android.util.proto.ProtoOutputStream;
 
+import com.android.tools.r8.keepanno.annotations.KeepItemKind;
+import com.android.tools.r8.keepanno.annotations.KeepTarget;
+import com.android.tools.r8.keepanno.annotations.UsesReflection;
+
 import java.io.PrintWriter;
 import java.util.ArrayList;
 import java.util.Collections;
@@ -41,7 +45,13 @@
     private final Context mContext;
     private final RankingHandler mRankingHandler;
 
-
+    @UsesReflection(
+            value = {
+                @KeepTarget(
+                        kind = KeepItemKind.CLASS_AND_MEMBERS,
+                        instanceOfClassConstantExclusive = NotificationSignalExtractor.class,
+                        methodName = "<init>")
+            })
     public RankingHelper(Context context, RankingHandler rankingHandler, RankingConfig config,
             ZenModeHelper zenHelper, NotificationUsageStats usageStats, String[] extractorNames) {
         mContext = context;
diff --git a/services/core/java/com/android/server/power/OWNERS b/services/core/java/com/android/server/power/OWNERS
index 94340ec..c1fad33 100644
--- a/services/core/java/com/android/server/power/OWNERS
+++ b/services/core/java/com/android/server/power/OWNERS
@@ -1,6 +1,7 @@
 michaelwr@google.com
 santoscordon@google.com
-philipjunker@google.com
+petsjonkin@google.com
+brup@google.com
 
 per-file ThermalManagerService.java=file:/THERMAL_OWNERS
 per-file LowPowerStandbyController.java=qingxun@google.com
diff --git a/services/core/java/com/android/server/timezonedetector/OWNERS b/services/core/java/com/android/server/timezonedetector/OWNERS
index dfa07d8..4220d14 100644
--- a/services/core/java/com/android/server/timezonedetector/OWNERS
+++ b/services/core/java/com/android/server/timezonedetector/OWNERS
@@ -1,7 +1,6 @@
 # Bug component: 847766
 # This is the main list for platform time / time zone detection maintainers, for this dir and
 # ultimately referenced by other OWNERS files for components maintained by the same team.
-nfuller@google.com
 boullanger@google.com
 jmorace@google.com
 kanyinsola@google.com
diff --git a/services/core/java/com/android/server/wallpaper/WallpaperManagerService.java b/services/core/java/com/android/server/wallpaper/WallpaperManagerService.java
index e7565ee..2f2512d 100644
--- a/services/core/java/com/android/server/wallpaper/WallpaperManagerService.java
+++ b/services/core/java/com/android/server/wallpaper/WallpaperManagerService.java
@@ -131,6 +131,9 @@
 import com.android.server.wallpaper.WallpaperData.BindSource;
 import com.android.server.wm.ActivityTaskManagerInternal;
 import com.android.server.wm.WindowManagerInternal;
+import com.android.tools.r8.keepanno.annotations.KeepItemKind;
+import com.android.tools.r8.keepanno.annotations.KeepTarget;
+import com.android.tools.r8.keepanno.annotations.UsesReflection;
 
 import org.xmlpull.v1.XmlPullParserException;
 
@@ -166,6 +169,13 @@
         }
 
         @Override
+        @UsesReflection(
+                value = {
+                    @KeepTarget(
+                            kind = KeepItemKind.CLASS_AND_MEMBERS,
+                            instanceOfClassConstantExclusive = IWallpaperManagerService.class,
+                            methodName = "<init>")
+                })
         public void onStart() {
             try {
                 final Class<? extends IWallpaperManagerService> klass =
@@ -629,9 +639,12 @@
             synchronized (mLock) {
                 if (mLastWallpaper != null) {
                     WallpaperData targetWallpaper = null;
-                    if (mLastWallpaper.connection.containsDisplay(displayId)) {
+                    if (mLastWallpaper.connection != null &&
+                            mLastWallpaper.connection.containsDisplay(displayId)) {
                         targetWallpaper = mLastWallpaper;
-                    } else if (mFallbackWallpaper.connection.containsDisplay(displayId)) {
+                    } else if (mFallbackWallpaper != null &&
+                            mFallbackWallpaper.connection != null &&
+                            mFallbackWallpaper.connection.containsDisplay(displayId)) {
                         targetWallpaper = mFallbackWallpaper;
                     }
                     if (targetWallpaper == null) return;
diff --git a/services/core/java/com/android/server/wm/DisplayAreaPolicy.java b/services/core/java/com/android/server/wm/DisplayAreaPolicy.java
index c18377d..3a4d02f 100644
--- a/services/core/java/com/android/server/wm/DisplayAreaPolicy.java
+++ b/services/core/java/com/android/server/wm/DisplayAreaPolicy.java
@@ -40,6 +40,10 @@
 import android.os.Bundle;
 import android.text.TextUtils;
 
+import com.android.tools.r8.keepanno.annotations.KeepItemKind;
+import com.android.tools.r8.keepanno.annotations.KeepTarget;
+import com.android.tools.r8.keepanno.annotations.UsesReflection;
+
 import java.util.ArrayList;
 import java.util.List;
 
@@ -179,6 +183,13 @@
         /**
          * Instantiates the device-specific {@link Provider}.
          */
+        @UsesReflection(
+                value = {
+                        @KeepTarget(
+                                kind = KeepItemKind.CLASS_AND_MEMBERS,
+                                instanceOfClassConstantExclusive = Provider.class,
+                                methodName = "<init>")
+                })
         static Provider fromResources(Resources res) {
             String name = res.getString(
                     com.android.internal.R.string.config_deviceSpecificDisplayAreaPolicyProvider);
diff --git a/services/core/java/com/android/server/wm/WindowManagerService.java b/services/core/java/com/android/server/wm/WindowManagerService.java
index ae5a5cb..8d6be09 100644
--- a/services/core/java/com/android/server/wm/WindowManagerService.java
+++ b/services/core/java/com/android/server/wm/WindowManagerService.java
@@ -3693,7 +3693,7 @@
             hideBootMessagesLocked();
             // If the screen still doesn't come up after 30 seconds, give
             // up and turn it on.
-            mH.sendEmptyMessageDelayed(H.BOOT_TIMEOUT, 30 * 1000);
+            mH.sendEmptyMessageDelayed(H.BOOT_TIMEOUT, 30 * 1000 * Build.HW_TIMEOUT_MULTIPLIER);
         }
 
         mPolicy.systemBooted();
diff --git a/services/proguard.flags b/services/proguard.flags
index a01e7dc..f84eff7 100644
--- a/services/proguard.flags
+++ b/services/proguard.flags
@@ -33,12 +33,6 @@
 -keep,allowoptimization,allowaccessmodification class * extends com.android.server.SystemService {
   public <methods>;
 }
--keep,allowoptimization,allowaccessmodification class * extends com.android.server.devicepolicy.BaseIDevicePolicyManager {
-  public <init>(...);
-}
--keep,allowoptimization,allowaccessmodification class com.android.server.wallpaper.WallpaperManagerService {
-  public <init>(...);
-}
 
 # Accessed from com.android.compos APEX
 -keep,allowoptimization,allowaccessmodification class com.android.internal.art.ArtStatsLog {
@@ -68,13 +62,6 @@
 -keep public class android.hidl.manager.** { *; }
 -keep public class com.android.server.wm.WindowManagerInternal { *; }
 
-# Notification extractors
-# TODO(b/210510433): Revisit and consider generating from frameworks/base/core/res/res/values/config.xml.
--keep,allowoptimization,allowaccessmodification public class com.android.server.notification.** implements com.android.server.notification.NotificationSignalExtractor
-
-# OEM provided DisplayAreaPolicy.Provider defined in frameworks/base/core/res/res/values/config.xml.
--keep,allowoptimization,allowaccessmodification class com.android.server.wm.** implements com.android.server.wm.DisplayAreaPolicy$Provider
-
 # JNI keep rules
 # The global keep rule for native methods allows stripping of such methods if they're unreferenced
 # in Java. However, because system_server explicitly registers these methods from native code,
@@ -118,9 +105,6 @@
 
 # Miscellaneous reflection keep rules
 # TODO(b/210510433): Revisit and fix with @Keep.
--keep,allowoptimization,allowaccessmodification class com.android.server.usage.AppStandbyController {
-  public <init>(...);
-}
 -keep,allowoptimization,allowaccessmodification class android.hardware.usb.gadget.** { *; }
 
 # Needed when optimizations enabled
diff --git a/services/tests/mockingservicestests/src/com/android/server/RescuePartyTest.java b/services/tests/mockingservicestests/src/com/android/server/RescuePartyTest.java
index 42814e7..3377899 100644
--- a/services/tests/mockingservicestests/src/com/android/server/RescuePartyTest.java
+++ b/services/tests/mockingservicestests/src/com/android/server/RescuePartyTest.java
@@ -74,7 +74,6 @@
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
-import java.util.Map;
 import java.util.concurrent.Executor;
 import java.util.concurrent.TimeUnit;
 
@@ -227,9 +226,6 @@
         setCrashRecoveryPropRescueBootCount(0);
         SystemProperties.set(RescueParty.PROP_ENABLE_RESCUE, Boolean.toString(true));
         SystemProperties.set(PROP_DEVICE_CONFIG_DISABLE_FLAG, Boolean.toString(false));
-
-        // enable flag resets for tests
-        mSetFlagsRule.enableFlags(Flags.FLAG_ALLOW_RESCUE_PARTY_FLAG_RESETS);
     }
 
     @After
@@ -250,9 +246,6 @@
 
         noteBoot(1);
 
-        verifySettingsResets(Settings.RESET_MODE_UNTRUSTED_DEFAULTS, /*resetNamespaces=*/ null,
-                verifiedTimesMap);
-
         // Record DeviceConfig accesses
         RescuePartyObserver observer = RescuePartyObserver.getInstance(mMockContext);
         DeviceConfig.MonitorCallback monitorCallback = mMonitorCallbackCaptor.getValue();
@@ -262,15 +255,8 @@
         final String[] expectedAllResetNamespaces = new String[]{NAMESPACE1, NAMESPACE2};
 
         noteBoot(2);
-
-        verifySettingsResets(Settings.RESET_MODE_UNTRUSTED_CHANGES, expectedAllResetNamespaces,
-                verifiedTimesMap);
-
         noteBoot(3);
 
-        verifySettingsResets(Settings.RESET_MODE_TRUSTED_DEFAULTS, expectedAllResetNamespaces,
-                verifiedTimesMap);
-
         noteBoot(4);
         assertTrue(RescueParty.isRebootPropertySet());
 
@@ -296,7 +282,6 @@
         final String[] expectedAllResetNamespaces = new String[]{NAMESPACE1, NAMESPACE2};
 
         noteBoot(1);
-        verifyDeviceConfigReset(expectedAllResetNamespaces, verifiedTimesMap);
 
         noteBoot(2);
         assertTrue(RescueParty.isRebootPropertySet());
@@ -321,20 +306,9 @@
         mSetFlagsRule.disableFlags(Flags.FLAG_RECOVERABILITY_DETECTION);
 
         noteAppCrash(1, true);
-
-        verifySettingsResets(Settings.RESET_MODE_UNTRUSTED_DEFAULTS, /*resetNamespaces=*/ null,
-                /*configResetVerifiedTimesMap=*/ null);
-
         noteAppCrash(2, true);
-
-        verifySettingsResets(Settings.RESET_MODE_UNTRUSTED_CHANGES, /*resetNamespaces=*/ null,
-                /*configResetVerifiedTimesMap=*/ null);
-
         noteAppCrash(3, true);
 
-        verifySettingsResets(Settings.RESET_MODE_TRUSTED_DEFAULTS, /*resetNamespaces=*/ null,
-                /*configResetVerifiedTimesMap=*/ null);
-
         noteAppCrash(4, true);
         assertTrue(RescueParty.isRebootPropertySet());
 
@@ -362,10 +336,8 @@
         final String[] expectedAllResetNamespaces = new String[]{NAMESPACE1, NAMESPACE2};
 
         noteAppCrash(1, true);
-        verifyDeviceConfigReset(expectedResetNamespaces, verifiedTimesMap);
 
         noteAppCrash(2, true);
-        verifyDeviceConfigReset(expectedAllResetNamespaces, verifiedTimesMap);
 
         noteAppCrash(3, true);
         assertTrue(RescueParty.isRebootPropertySet());
@@ -385,26 +357,13 @@
     }
 
     @Test
-    public void testNonPersistentAppOnlyPerformsFlagResets() {
+    public void testNonPersistentAppDoesntDoAnything() {
         // this is old test where the flag needs to be disabled
         mSetFlagsRule.disableFlags(Flags.FLAG_RECOVERABILITY_DETECTION);
 
         noteAppCrash(1, false);
-
-        verifySettingsResets(Settings.RESET_MODE_UNTRUSTED_DEFAULTS, /*resetNamespaces=*/ null,
-                /*configResetVerifiedTimesMap=*/ null);
-
         noteAppCrash(2, false);
-
-        verifySettingsResets(Settings.RESET_MODE_UNTRUSTED_CHANGES, /*resetNamespaces=*/ null,
-                /*configResetVerifiedTimesMap=*/ null);
-
         noteAppCrash(3, false);
-
-        verifySettingsResets(Settings.RESET_MODE_TRUSTED_DEFAULTS, /*resetNamespaces=*/ null,
-                /*configResetVerifiedTimesMap=*/ null);
-
-        noteAppCrash(4, false);
         assertFalse(RescueParty.isRebootPropertySet());
 
         noteAppCrash(5, false);
@@ -430,10 +389,8 @@
         final String[] expectedAllResetNamespaces = new String[]{NAMESPACE1, NAMESPACE2};
 
         noteAppCrash(1, false);
-        verifyDeviceConfigReset(expectedResetNamespaces, verifiedTimesMap);
 
         noteAppCrash(2, false);
-        verifyDeviceConfigReset(expectedAllResetNamespaces, verifiedTimesMap);
 
         noteAppCrash(3, false);
         assertFalse(RescueParty.isRebootPropertySet());
@@ -488,87 +445,12 @@
         HashMap<String, Integer> verifiedTimesMap = new HashMap<String, Integer>();
         observer.execute(new VersionedPackage(
                 CALLING_PACKAGE1, 1), PackageWatchdog.FAILURE_REASON_APP_CRASH, 1);
-        verifySettingsResets(Settings.RESET_MODE_UNTRUSTED_DEFAULTS, expectedResetNamespaces,
-                verifiedTimesMap);
 
         observer.execute(new VersionedPackage(
                 CALLING_PACKAGE1, 1), PackageWatchdog.FAILURE_REASON_APP_NOT_RESPONDING, 2);
-        verifySettingsResets(Settings.RESET_MODE_UNTRUSTED_CHANGES, expectedResetNamespaces,
-                verifiedTimesMap);
 
         observer.execute(new VersionedPackage(
                 CALLING_PACKAGE1, 1), PackageWatchdog.FAILURE_REASON_APP_NOT_RESPONDING, 3);
-        verifySettingsResets(Settings.RESET_MODE_TRUSTED_DEFAULTS, expectedAllResetNamespaces,
-                verifiedTimesMap);
-
-        observer.execute(new VersionedPackage(
-                CALLING_PACKAGE1, 1), PackageWatchdog.FAILURE_REASON_APP_NOT_RESPONDING, 4);
-        assertFalse(RescueParty.isRebootPropertySet());
-
-        observer.execute(new VersionedPackage(
-                CALLING_PACKAGE1, 1), PackageWatchdog.FAILURE_REASON_APP_NOT_RESPONDING, 5);
-        assertFalse(RescueParty.isFactoryResetPropertySet());
-    }
-
-    @Test
-    public void testNonDeviceConfigSettingsOnlyResetOncePerLevel() {
-        // this is old test where the flag needs to be disabled
-        mSetFlagsRule.disableFlags(Flags.FLAG_RECOVERABILITY_DETECTION);
-
-        RescueParty.onSettingsProviderPublished(mMockContext);
-        verify(() -> DeviceConfig.setMonitorCallback(eq(mMockContentResolver),
-                any(Executor.class),
-                mMonitorCallbackCaptor.capture()));
-
-        // Record DeviceConfig accesses
-        RescuePartyObserver observer = RescuePartyObserver.getInstance(mMockContext);
-        DeviceConfig.MonitorCallback monitorCallback = mMonitorCallbackCaptor.getValue();
-        monitorCallback.onDeviceConfigAccess(CALLING_PACKAGE1, NAMESPACE1);
-        monitorCallback.onDeviceConfigAccess(CALLING_PACKAGE1, NAMESPACE2);
-        monitorCallback.onDeviceConfigAccess(CALLING_PACKAGE2, NAMESPACE2);
-        monitorCallback.onDeviceConfigAccess(CALLING_PACKAGE2, NAMESPACE3);
-        // Fake DeviceConfig value changes
-        monitorCallback.onNamespaceUpdate(NAMESPACE1);
-        monitorCallback.onNamespaceUpdate(NAMESPACE2);
-        monitorCallback.onNamespaceUpdate(NAMESPACE3);
-        // Perform and verify scoped resets
-        final String[] expectedPackage1ResetNamespaces = new String[]{NAMESPACE1, NAMESPACE2};
-        final String[] expectedPackage2ResetNamespaces = new String[]{NAMESPACE2, NAMESPACE3};
-        final String[] expectedAllResetNamespaces =
-                new String[]{NAMESPACE1, NAMESPACE2, NAMESPACE3};
-        HashMap<String, Integer> verifiedTimesMap = new HashMap<String, Integer>();
-        observer.execute(new VersionedPackage(
-                CALLING_PACKAGE1, 1), PackageWatchdog.FAILURE_REASON_APP_CRASH, 1);
-        verifySettingsResets(Settings.RESET_MODE_UNTRUSTED_DEFAULTS,
-                expectedPackage1ResetNamespaces, verifiedTimesMap);
-
-        // Settings.Global & Settings.Secure should still remain the same execution times.
-        observer.execute(new VersionedPackage(
-                CALLING_PACKAGE2, 1), PackageWatchdog.FAILURE_REASON_APP_CRASH, 1);
-        verifySettingsResets(Settings.RESET_MODE_UNTRUSTED_DEFAULTS,
-                expectedPackage2ResetNamespaces, verifiedTimesMap);
-
-        observer.execute(new VersionedPackage(
-                CALLING_PACKAGE1, 1), PackageWatchdog.FAILURE_REASON_APP_NOT_RESPONDING, 2);
-        verifySettingsResets(Settings.RESET_MODE_UNTRUSTED_CHANGES,
-                expectedPackage1ResetNamespaces, verifiedTimesMap);
-
-        // Settings.Global & Settings.Secure should still remain the same execution times.
-        observer.execute(new VersionedPackage(
-                CALLING_PACKAGE2, 1), PackageWatchdog.FAILURE_REASON_APP_NOT_RESPONDING, 2);
-        verifySettingsResets(Settings.RESET_MODE_UNTRUSTED_CHANGES,
-                expectedPackage2ResetNamespaces, verifiedTimesMap);
-
-        observer.execute(new VersionedPackage(
-                CALLING_PACKAGE1, 1), PackageWatchdog.FAILURE_REASON_APP_NOT_RESPONDING, 3);
-        verifySettingsResets(Settings.RESET_MODE_TRUSTED_DEFAULTS, expectedAllResetNamespaces,
-                verifiedTimesMap);
-
-        // Settings.Global & Settings.Secure should still remain the same execution times.
-        observer.execute(new VersionedPackage(
-                CALLING_PACKAGE2, 1), PackageWatchdog.FAILURE_REASON_APP_NOT_RESPONDING, 3);
-        verifySettingsResets(Settings.RESET_MODE_TRUSTED_DEFAULTS, expectedAllResetNamespaces,
-                verifiedTimesMap);
 
         observer.execute(new VersionedPackage(
                 CALLING_PACKAGE1, 1), PackageWatchdog.FAILURE_REASON_APP_NOT_RESPONDING, 4);
@@ -863,27 +745,27 @@
 
         assertEquals(observer.onHealthCheckFailed(sFailingPackage,
                 PackageWatchdog.FAILURE_REASON_APP_NOT_RESPONDING, 2),
-                PackageHealthObserverImpact.USER_IMPACT_LEVEL_20);
+                PackageHealthObserverImpact.USER_IMPACT_LEVEL_40);
 
         assertEquals(observer.onHealthCheckFailed(sFailingPackage,
                 PackageWatchdog.FAILURE_REASON_APP_NOT_RESPONDING, 3),
-                PackageHealthObserverImpact.USER_IMPACT_LEVEL_20);
+                PackageHealthObserverImpact.USER_IMPACT_LEVEL_40);
 
         assertEquals(observer.onHealthCheckFailed(sFailingPackage,
                 PackageWatchdog.FAILURE_REASON_APP_NOT_RESPONDING, 4),
-                PackageHealthObserverImpact.USER_IMPACT_LEVEL_20);
+                PackageHealthObserverImpact.USER_IMPACT_LEVEL_40);
 
         assertEquals(observer.onHealthCheckFailed(sFailingPackage,
                 PackageWatchdog.FAILURE_REASON_APP_NOT_RESPONDING, 5),
-                PackageHealthObserverImpact.USER_IMPACT_LEVEL_20);
+                PackageHealthObserverImpact.USER_IMPACT_LEVEL_40);
 
         assertEquals(observer.onHealthCheckFailed(sFailingPackage,
                 PackageWatchdog.FAILURE_REASON_APP_NOT_RESPONDING, 6),
-                PackageHealthObserverImpact.USER_IMPACT_LEVEL_20);
+                PackageHealthObserverImpact.USER_IMPACT_LEVEL_40);
 
         assertEquals(observer.onHealthCheckFailed(sFailingPackage,
                 PackageWatchdog.FAILURE_REASON_APP_NOT_RESPONDING, 7),
-                PackageHealthObserverImpact.USER_IMPACT_LEVEL_20);
+                PackageHealthObserverImpact.USER_IMPACT_LEVEL_40);
     }
 
     @Test
@@ -906,7 +788,7 @@
         mSetFlagsRule.enableFlags(Flags.FLAG_RECOVERABILITY_DETECTION);
         RescuePartyObserver observer = RescuePartyObserver.getInstance(mMockContext);
 
-        assertEquals(observer.onBootLoop(1), PackageHealthObserverImpact.USER_IMPACT_LEVEL_20);
+        assertEquals(observer.onBootLoop(1), PackageHealthObserverImpact.USER_IMPACT_LEVEL_40);
         assertEquals(observer.onBootLoop(2), PackageHealthObserverImpact.USER_IMPACT_LEVEL_50);
         assertEquals(observer.onBootLoop(3), PackageHealthObserverImpact.USER_IMPACT_LEVEL_71);
         assertEquals(observer.onBootLoop(4), PackageHealthObserverImpact.USER_IMPACT_LEVEL_75);
@@ -1037,7 +919,6 @@
     private void verifySettingsResets(int resetMode, String[] resetNamespaces,
             HashMap<String, Integer> configResetVerifiedTimesMap) {
         verifyOnlySettingsReset(resetMode);
-        verifyDeviceConfigReset(resetNamespaces, configResetVerifiedTimesMap);
     }
 
     private void verifyOnlySettingsReset(int resetMode) {
@@ -1054,26 +935,6 @@
                 eq(resetMode), anyInt()), never());
     }
 
-    private void verifyDeviceConfigReset(String[] resetNamespaces,
-            Map<String, Integer> configResetVerifiedTimesMap) {
-        if (resetNamespaces == null) {
-            verify(() -> DeviceConfig.resetToDefaults(anyInt(), anyString()), never());
-        } else {
-            for (String namespace : resetNamespaces) {
-                int verifiedTimes = 0;
-                if (configResetVerifiedTimesMap != null
-                        && configResetVerifiedTimesMap.get(namespace) != null) {
-                    verifiedTimes = configResetVerifiedTimesMap.get(namespace);
-                }
-                verify(() -> DeviceConfig.resetToDefaults(RescueParty.DEVICE_CONFIG_RESET_MODE,
-                        namespace), times(verifiedTimes + 1));
-                if (configResetVerifiedTimesMap != null) {
-                    configResetVerifiedTimesMap.put(namespace, verifiedTimes + 1);
-                }
-            }
-        }
-    }
-
     private void noteBoot(int mitigationCount) {
         RescuePartyObserver.getInstance(mMockContext).executeBootLoopMitigation(mitigationCount);
     }
diff --git a/services/usage/java/com/android/server/usage/UsageStatsDatabase.java b/services/usage/java/com/android/server/usage/UsageStatsDatabase.java
index a8a9017..ba33eab 100644
--- a/services/usage/java/com/android/server/usage/UsageStatsDatabase.java
+++ b/services/usage/java/com/android/server/usage/UsageStatsDatabase.java
@@ -33,6 +33,7 @@
 import android.util.TimeUtils;
 
 import com.android.internal.annotations.VisibleForTesting;
+import com.android.internal.annotations.GuardedBy;
 import com.android.internal.util.ArrayUtils;
 import com.android.internal.util.IndentingPrintWriter;
 
@@ -136,6 +137,7 @@
     // The obfuscated packages to tokens mappings file
     private final File mPackageMappingsFile;
     // Holds all of the data related to the obfuscated packages and their token mappings.
+    @GuardedBy("mLock")
     final PackagesTokenData mPackagesTokenData = new PackagesTokenData();
 
     /**
@@ -771,27 +773,30 @@
      * all of the stats at once has an amortized cost for future calls.
      */
     void filterStats(IntervalStats stats) {
-        if (mPackagesTokenData.removedPackagesMap.isEmpty()) {
-            return;
-        }
-        final ArrayMap<String, Long> removedPackagesMap = mPackagesTokenData.removedPackagesMap;
-
-        // filter out package usage stats
-        final int removedPackagesSize = removedPackagesMap.size();
-        for (int i = 0; i < removedPackagesSize; i++) {
-            final String removedPackage = removedPackagesMap.keyAt(i);
-            final UsageStats usageStats = stats.packageStats.get(removedPackage);
-            if (usageStats != null && usageStats.mEndTimeStamp < removedPackagesMap.valueAt(i)) {
-                stats.packageStats.remove(removedPackage);
+        synchronized (mLock) {
+            if (mPackagesTokenData.removedPackagesMap.isEmpty()) {
+                return;
             }
-        }
+            final ArrayMap<String, Long> removedPackagesMap = mPackagesTokenData.removedPackagesMap;
 
-        // filter out events
-        for (int i = stats.events.size() - 1; i >= 0; i--) {
-            final UsageEvents.Event event = stats.events.get(i);
-            final Long timeRemoved = removedPackagesMap.get(event.mPackage);
-            if (timeRemoved != null && timeRemoved > event.mTimeStamp) {
-                stats.events.remove(i);
+            // filter out package usage stats
+            final int removedPackagesSize = removedPackagesMap.size();
+            for (int i = 0; i < removedPackagesSize; i++) {
+                final String removedPackage = removedPackagesMap.keyAt(i);
+                final UsageStats usageStats = stats.packageStats.get(removedPackage);
+                if (usageStats != null &&
+                        usageStats.mEndTimeStamp < removedPackagesMap.valueAt(i)) {
+                    stats.packageStats.remove(removedPackage);
+                }
+            }
+
+            // filter out events
+            for (int i = stats.events.size() - 1; i >= 0; i--) {
+                final UsageEvents.Event event = stats.events.get(i);
+                final Long timeRemoved = removedPackagesMap.get(event.mPackage);
+                if (timeRemoved != null && timeRemoved > event.mTimeStamp) {
+                    stats.events.remove(i);
+                }
             }
         }
     }
@@ -1226,12 +1231,14 @@
     }
 
     void obfuscateCurrentStats(IntervalStats[] currentStats) {
-        if (mCurrentVersion < 5) {
-            return;
-        }
-        for (int i = 0; i < currentStats.length; i++) {
-            final IntervalStats stats = currentStats[i];
-            stats.obfuscateData(mPackagesTokenData);
+        synchronized (mLock) {
+            if (mCurrentVersion < 5) {
+                return;
+            }
+            for (int i = 0; i < currentStats.length; i++) {
+                final IntervalStats stats = currentStats[i];
+                stats.obfuscateData(mPackagesTokenData);
+            }
         }
     }
 
diff --git a/tests/ChoreographerTests/src/main/java/android/view/choreographertests/AttachedChoreographerTest.java b/tests/ChoreographerTests/src/main/java/android/view/choreographertests/AttachedChoreographerTest.java
index 5460e4e87..64dbe71 100644
--- a/tests/ChoreographerTests/src/main/java/android/view/choreographertests/AttachedChoreographerTest.java
+++ b/tests/ChoreographerTests/src/main/java/android/view/choreographertests/AttachedChoreographerTest.java
@@ -43,6 +43,7 @@
 
 import org.junit.After;
 import org.junit.Before;
+import org.junit.Ignore;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
@@ -392,6 +393,7 @@
     }
 
     @Test
+    @Ignore("Can be enabled only after b/330536267 is ready")
     public void testChoreographerDivisorRefreshRate() {
         for (int divisor : new int[]{2, 3}) {
             CountDownLatch continueLatch = new CountDownLatch(1);
@@ -420,6 +422,7 @@
     }
 
     @Test
+    @Ignore("Can be enabled only after b/330536267 is ready")
     public void testChoreographerAttachedAfterSetFrameRate() {
         Log.i(TAG, "starting testChoreographerAttachedAfterSetFrameRate");
 
diff --git a/tools/lint/OWNERS b/tools/lint/OWNERS
index 33e237d..8e4569e 100644
--- a/tools/lint/OWNERS
+++ b/tools/lint/OWNERS
@@ -1,4 +1,5 @@
-brufino@google.com
+mattgilbride@google.com
+azharaa@google.com
 jsharkey@google.com
 
 per-file *CallingSettingsNonUserGetterMethods* = file:/packages/SettingsProvider/OWNERS