Merge "Don't hold any locks while computing the blob digest."
diff --git a/Android.bp b/Android.bp
index 3fff2d4..2534140 100644
--- a/Android.bp
+++ b/Android.bp
@@ -346,6 +346,7 @@
         "android.hardware.cas-V1.1-java",
         "android.hardware.cas-V1.2-java",
         "android.hardware.contexthub-V1.0-java",
+        "android.hardware.contexthub-V1.1-java",
         "android.hardware.gnss-V1.0-java",
         "android.hardware.gnss-V2.1-java",
         "android.hardware.health-V1.0-java-constants",
@@ -687,6 +688,7 @@
     srcs: [
         "core/java/android/annotation/CallbackExecutor.java",
         "core/java/android/annotation/CheckResult.java",
+        "core/java/android/annotation/CurrentTimeMillisLong.java",
         "core/java/android/annotation/IntDef.java",
         "core/java/android/annotation/IntRange.java",
         "core/java/android/annotation/NonNull.java",
@@ -1126,7 +1128,6 @@
     srcs: [
         ":framework-annotations",
         "core/java/android/annotation/BytesLong.java",
-        "core/java/android/annotation/CurrentTimeMillisLong.java",
         "core/java/android/annotation/CurrentTimeSecondsLong.java",
         "core/java/android/annotation/DurationMillisLong.java",
     ],
@@ -1326,7 +1327,6 @@
     libs: [
         "framework-minus-apex",
         "unsupportedappusage",
-        "ike-stubs",
     ],
     static_libs: [
         "libphonenumber-platform",
diff --git a/apex/blobstore/TEST_MAPPING b/apex/blobstore/TEST_MAPPING
index 25a1537..6d3c0d7 100644
--- a/apex/blobstore/TEST_MAPPING
+++ b/apex/blobstore/TEST_MAPPING
@@ -4,6 +4,9 @@
       "name": "CtsBlobStoreTestCases"
     },
     {
+      "name": "CtsBlobStoreHostTestCases"
+    },
+    {
       "name": "FrameworksMockingServicesTests",
       "options": [
         {
@@ -12,4 +15,4 @@
       ]
     }
   ]
-}
\ No newline at end of file
+}
diff --git a/apex/blobstore/service/java/com/android/server/blob/BlobStoreManagerService.java b/apex/blobstore/service/java/com/android/server/blob/BlobStoreManagerService.java
index aff6fcfc..1cc1c5f 100644
--- a/apex/blobstore/service/java/com/android/server/blob/BlobStoreManagerService.java
+++ b/apex/blobstore/service/java/com/android/server/blob/BlobStoreManagerService.java
@@ -334,7 +334,8 @@
                 throw new SecurityException("Caller not allowed to access " + blobHandle
                         + "; callingUid=" + callingUid + ", callingPackage=" + callingPackage);
             }
-            if (leaseExpiryTimeMillis != 0 && leaseExpiryTimeMillis > blobHandle.expiryTimeMillis) {
+            if (leaseExpiryTimeMillis != 0 && blobHandle.expiryTimeMillis != 0
+                    && leaseExpiryTimeMillis > blobHandle.expiryTimeMillis) {
                 throw new IllegalArgumentException(
                         "Lease expiry cannot be later than blobs expiry time");
             }
diff --git a/apex/blobstore/service/java/com/android/server/blob/BlobStoreSession.java b/apex/blobstore/service/java/com/android/server/blob/BlobStoreSession.java
index 80b4235..d33a09f 100644
--- a/apex/blobstore/service/java/com/android/server/blob/BlobStoreSession.java
+++ b/apex/blobstore/service/java/com/android/server/blob/BlobStoreSession.java
@@ -514,7 +514,7 @@
     static BlobStoreSession createFromXml(@NonNull XmlPullParser in, int version,
             @NonNull Context context, @NonNull SessionStateChangeListener stateChangeListener)
             throws IOException, XmlPullParserException {
-        final int sessionId = XmlUtils.readIntAttribute(in, ATTR_ID);
+        final long sessionId = XmlUtils.readLongAttribute(in, ATTR_ID);
         final String ownerPackageName = XmlUtils.readStringAttribute(in, ATTR_PACKAGE);
         final int ownerUid = XmlUtils.readIntAttribute(in, ATTR_UID);
 
diff --git a/apex/jobscheduler/framework/java/com/android/server/usage/AppStandbyInternal.java b/apex/jobscheduler/framework/java/com/android/server/usage/AppStandbyInternal.java
index dc72d6d..f8b598a 100644
--- a/apex/jobscheduler/framework/java/com/android/server/usage/AppStandbyInternal.java
+++ b/apex/jobscheduler/framework/java/com/android/server/usage/AppStandbyInternal.java
@@ -147,7 +147,7 @@
 
     void postReportExemptedSyncStart(String packageName, int userId);
 
-    void dumpUser(IndentingPrintWriter idpw, int userId, String pkg);
+    void dumpUser(IndentingPrintWriter idpw, int userId, List<String> pkgs);
 
     void dumpState(String[] args, PrintWriter pw);
 
diff --git a/apex/jobscheduler/service/java/com/android/server/usage/AppIdleHistory.java b/apex/jobscheduler/service/java/com/android/server/usage/AppIdleHistory.java
index 9d6e012..932c25d 100644
--- a/apex/jobscheduler/service/java/com/android/server/usage/AppIdleHistory.java
+++ b/apex/jobscheduler/service/java/com/android/server/usage/AppIdleHistory.java
@@ -41,6 +41,7 @@
 import android.util.Xml;
 
 import com.android.internal.annotations.VisibleForTesting;
+import com.android.internal.util.CollectionUtils;
 import com.android.internal.util.FastXmlSerializer;
 import com.android.internal.util.IndentingPrintWriter;
 
@@ -58,6 +59,7 @@
 import java.io.IOException;
 import java.nio.charset.StandardCharsets;
 import java.util.ArrayList;
+import java.util.List;
 
 /**
  * Keeps track of recent active state changes in apps.
@@ -721,7 +723,7 @@
         }
     }
 
-    public void dump(IndentingPrintWriter idpw, int userId, String pkg) {
+    public void dump(IndentingPrintWriter idpw, int userId, List<String> pkgs) {
         idpw.println("App Standby States:");
         idpw.increaseIndent();
         ArrayMap<String, AppUsageHistory> userHistory = mIdleHistory.get(userId);
@@ -733,7 +735,7 @@
         for (int p = 0; p < P; p++) {
             final String packageName = userHistory.keyAt(p);
             final AppUsageHistory appUsageHistory = userHistory.valueAt(p);
-            if (pkg != null && !pkg.equals(packageName)) {
+            if (!CollectionUtils.isEmpty(pkgs) && !pkgs.contains(packageName)) {
                 continue;
             }
             idpw.print("package=" + packageName);
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 e343478..bf61eb4 100644
--- a/apex/jobscheduler/service/java/com/android/server/usage/AppStandbyController.java
+++ b/apex/jobscheduler/service/java/com/android/server/usage/AppStandbyController.java
@@ -1505,9 +1505,9 @@
     }
 
     @Override
-    public void dumpUser(IndentingPrintWriter idpw, int userId, String pkg) {
+    public void dumpUser(IndentingPrintWriter idpw, int userId, List<String> pkgs) {
         synchronized (mAppIdleLock) {
-            mAppIdleHistory.dump(idpw, userId, pkg);
+            mAppIdleHistory.dump(idpw, userId, pkgs);
         }
     }
 
diff --git a/apex/statsd/Android.bp b/apex/statsd/Android.bp
index c8aa526..0e93110 100644
--- a/apex/statsd/Android.bp
+++ b/apex/statsd/Android.bp
@@ -27,6 +27,7 @@
         "framework-statsd",
         "service-statsd",
     ],
+    compile_multilib: "both",
     // prebuilts: ["my_prebuilt"],
     name: "com.android.os.statsd-defaults",
     key: "com.android.os.statsd.key",
@@ -72,4 +73,4 @@
         "com.android.os.statsd",
         "test_com.android.os.statsd",
     ],
-}
\ No newline at end of file
+}
diff --git a/apex/statsd/aidl/Android.bp b/apex/statsd/aidl/Android.bp
index 7c93bc7..487c8e1 100644
--- a/apex/statsd/aidl/Android.bp
+++ b/apex/statsd/aidl/Android.bp
@@ -34,10 +34,17 @@
             enabled: false, // the platform uses statsd_java_aidl
         },
         cpp: {
-            enabled: true,
+            enabled: false,
         },
         ndk: {
             enabled: true,
-        }
+            apex_available: [
+                // TODO(b/145923087): Remove this once statsd binary is in apex
+                "//apex_available:platform",
+
+                "com.android.os.statsd",
+                "test_com.android.os.statsd",
+            ],
+        },
     }
 }
diff --git a/apex/statsd/framework/Android.bp b/apex/statsd/framework/Android.bp
index ab669d4..5533ed8 100644
--- a/apex/statsd/framework/Android.bp
+++ b/apex/statsd/framework/Android.bp
@@ -48,17 +48,8 @@
 
 java_defaults {
     name: "framework-statsd-defaults",
-
-    // TODO(b/146757305): Use "module_current" once it's ready.
-    sdk_version: "core_current",
-
-    libs: [
-        "framework-annotations-lib",
-
-        // TODO(b/146757305): should be unnecessary once
-        // sdk_version="module_lib_current" or "module_current"
-        "android_module_lib_stubs_current",
-    ],
+    sdk_version: "module_current",
+    libs: [ "framework-annotations-lib" ],
 }
 
 java_library {
@@ -72,16 +63,6 @@
         ":framework-statsd-sources",
     ],
 
-    aidl: {
-        // TODO(b/146757305): should be unnecessary once
-        // sdk_version="module_lib_current" or "module_current"
-        include_dirs: [
-            // To refer:
-            // android.app.PendintIntent
-            "frameworks/base/core/java",
-        ],
-    },
-
     permitted_packages: [
         "android.app",
         "android.os",
diff --git a/api/current.txt b/api/current.txt
index 23637eb..702744d 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -9,6 +9,7 @@
     ctor public Manifest.permission();
     field public static final String ACCEPT_HANDOVER = "android.permission.ACCEPT_HANDOVER";
     field public static final String ACCESS_BACKGROUND_LOCATION = "android.permission.ACCESS_BACKGROUND_LOCATION";
+    field public static final String ACCESS_CALL_AUDIO = "android.permission.ACCESS_CALL_AUDIO";
     field public static final String ACCESS_CHECKIN_PROPERTIES = "android.permission.ACCESS_CHECKIN_PROPERTIES";
     field public static final String ACCESS_COARSE_LOCATION = "android.permission.ACCESS_COARSE_LOCATION";
     field public static final String ACCESS_FINE_LOCATION = "android.permission.ACCESS_FINE_LOCATION";
@@ -951,6 +952,7 @@
     field public static final int mediaRouteButtonStyle = 16843693; // 0x10103ad
     field public static final int mediaRouteTypes = 16843694; // 0x10103ae
     field public static final int menuCategory = 16843230; // 0x10101de
+    field public static final int mimeGroup = 16844309; // 0x1010615
     field public static final int mimeType = 16842790; // 0x1010026
     field public static final int min = 16844089; // 0x1010539
     field public static final int minAspectRatio = 16844187; // 0x101059b
@@ -2871,7 +2873,9 @@
     method protected void onServiceConnected();
     method public void onSystemActionsChanged();
     method public final boolean performGlobalAction(int);
+    method public void setGestureDetectionPassthroughRegion(int, @NonNull android.graphics.Region);
     method public final void setServiceInfo(android.accessibilityservice.AccessibilityServiceInfo);
+    method public void setTouchExplorationPassthroughRegion(int, @NonNull android.graphics.Region);
     method public boolean takeScreenshot(int, @NonNull java.util.concurrent.Executor, @NonNull java.util.function.Consumer<android.accessibilityservice.AccessibilityService.ScreenshotResult>);
     field public static final int GESTURE_2_FINGER_DOUBLE_TAP = 20; // 0x14
     field public static final int GESTURE_2_FINGER_DOUBLE_TAP_AND_HOLD = 40; // 0x28
@@ -4351,7 +4355,7 @@
   public class AppOpsManager {
     method @Deprecated public int checkOp(@NonNull String, int, @NonNull String);
     method @Deprecated public int checkOpNoThrow(@NonNull String, int, @NonNull String);
-    method public void checkPackage(int, @NonNull String);
+    method @Deprecated public void checkPackage(int, @NonNull String);
     method @Deprecated public void finishOp(@NonNull String, int, @NonNull String);
     method public void finishOp(@NonNull String, int, @NonNull String, @Nullable String);
     method public boolean isOpActive(@NonNull String, int, @NonNull String);
@@ -4364,7 +4368,7 @@
     method @Deprecated public int noteProxyOpNoThrow(@NonNull String, @NonNull String);
     method @Deprecated public int noteProxyOpNoThrow(@NonNull String, @Nullable String, int);
     method public int noteProxyOpNoThrow(@NonNull String, @Nullable String, int, @Nullable String, @Nullable String);
-    method public static String permissionToOp(String);
+    method @Nullable public static String permissionToOp(@NonNull String);
     method public void setNotedAppOpsCollector(@Nullable android.app.AppOpsManager.AppOpsCollector);
     method @Deprecated public int startOp(@NonNull String, int, @NonNull String);
     method public int startOp(@NonNull String, int, @Nullable String, @Nullable String, @Nullable String);
@@ -10827,6 +10831,8 @@
     field public static final int FLAG_ACTIVITY_NO_USER_ACTION = 262144; // 0x40000
     field public static final int FLAG_ACTIVITY_PREVIOUS_IS_TOP = 16777216; // 0x1000000
     field public static final int FLAG_ACTIVITY_REORDER_TO_FRONT = 131072; // 0x20000
+    field public static final int FLAG_ACTIVITY_REQUIRE_DEFAULT = 512; // 0x200
+    field public static final int FLAG_ACTIVITY_REQUIRE_NON_BROWSER = 1024; // 0x400
     field public static final int FLAG_ACTIVITY_RESET_TASK_IF_NEEDED = 2097152; // 0x200000
     field public static final int FLAG_ACTIVITY_RETAIN_IN_RECENTS = 8192; // 0x2000
     field public static final int FLAG_ACTIVITY_SINGLE_TOP = 536870912; // 0x20000000
@@ -11560,7 +11566,7 @@
     method @NonNull public android.graphics.drawable.Drawable getProfileSwitchingIconDrawable(@NonNull android.os.UserHandle);
     method @NonNull public CharSequence getProfileSwitchingLabel(@NonNull android.os.UserHandle);
     method @NonNull public java.util.List<android.os.UserHandle> getTargetUserProfiles();
-    method @RequiresPermission(anyOf={android.Manifest.permission.INTERACT_ACROSS_PROFILES, "android.permission.INTERACT_ACROSS_USERS"}) public void startActivity(@NonNull android.content.Intent, @NonNull android.os.UserHandle);
+    method @RequiresPermission(anyOf={android.Manifest.permission.INTERACT_ACROSS_PROFILES, "android.permission.INTERACT_ACROSS_USERS"}) public void startActivity(@NonNull android.content.Intent, @NonNull android.os.UserHandle, @Nullable android.app.Activity);
     method public void startMainActivity(@NonNull android.content.ComponentName, @NonNull android.os.UserHandle);
     field public static final String ACTION_CAN_INTERACT_ACROSS_PROFILES_CHANGED = "android.content.pm.action.CAN_INTERACT_ACROSS_PROFILES_CHANGED";
   }
@@ -11937,6 +11943,7 @@
     method @CheckResult public abstract int checkSignatures(@NonNull String, @NonNull String);
     method @CheckResult public abstract int checkSignatures(int, int);
     method public abstract void clearInstantAppCookie();
+    method public void clearMimeGroup(@NonNull String);
     method @Deprecated public abstract void clearPackagePreferredActivities(@NonNull String);
     method public abstract String[] currentToCanonicalPackageNames(@NonNull String[]);
     method public abstract void extendVerificationTimeout(int, int, long);
@@ -11972,6 +11979,7 @@
     method @NonNull public abstract android.content.pm.InstrumentationInfo getInstrumentationInfo(@NonNull android.content.ComponentName, int) throws android.content.pm.PackageManager.NameNotFoundException;
     method @Nullable public abstract android.content.Intent getLaunchIntentForPackage(@NonNull String);
     method @Nullable public abstract android.content.Intent getLeanbackLaunchIntentForPackage(@NonNull String);
+    method @Nullable public java.util.Set<java.lang.String> getMimeGroup(@NonNull String);
     method @NonNull public android.content.pm.ModuleInfo getModuleInfo(@NonNull String, int) throws android.content.pm.PackageManager.NameNotFoundException;
     method @Nullable public abstract String getNameForUid(int);
     method @Nullable public android.content.pm.PackageInfo getPackageArchiveInfo(@NonNull String, int);
@@ -12034,6 +12042,7 @@
     method @RequiresPermission(value=android.Manifest.permission.CHANGE_COMPONENT_ENABLED_STATE, conditional=true) public abstract void setApplicationEnabledSetting(@NonNull String, int, int);
     method @RequiresPermission(value=android.Manifest.permission.CHANGE_COMPONENT_ENABLED_STATE, conditional=true) public abstract void setComponentEnabledSetting(@NonNull android.content.ComponentName, int, int);
     method public abstract void setInstallerPackageName(@NonNull String, @Nullable String);
+    method public void setMimeGroup(@NonNull String, @NonNull java.util.Set<java.lang.String>);
     method public abstract void updateInstantAppCookie(@Nullable byte[]);
     method public abstract void verifyPendingInstall(int, int);
     field public static final int CERT_INPUT_RAW_X509 = 0; // 0x0
@@ -23481,66 +23490,54 @@
   }
 
   public final class GnssAntennaInfo implements android.os.Parcelable {
-    ctor public GnssAntennaInfo(double, @NonNull android.location.GnssAntennaInfo.PhaseCenterOffsetCoordinates, @Nullable android.location.GnssAntennaInfo.PhaseCenterVariationCorrections, @Nullable android.location.GnssAntennaInfo.SignalGainCorrections);
     method public int describeContents();
-    method public double getCarrierFrequencyMHz();
-    method @NonNull public android.location.GnssAntennaInfo.PhaseCenterOffsetCoordinates getPhaseCenterOffsetCoordinates();
-    method @Nullable public android.location.GnssAntennaInfo.PhaseCenterVariationCorrections getPhaseCenterVariationCorrections();
-    method @Nullable public android.location.GnssAntennaInfo.SignalGainCorrections getSignalGainCorrections();
+    method @FloatRange(from=0.0f) public double getCarrierFrequencyMHz();
+    method @NonNull public android.location.GnssAntennaInfo.PhaseCenterOffset getPhaseCenterOffset();
+    method @Nullable public android.location.GnssAntennaInfo.SphericalCorrections getPhaseCenterVariationCorrections();
+    method @Nullable public android.location.GnssAntennaInfo.SphericalCorrections getSignalGainCorrections();
     method public void writeToParcel(@NonNull android.os.Parcel, int);
     field @NonNull public static final android.os.Parcelable.Creator<android.location.GnssAntennaInfo> CREATOR;
   }
 
-  public abstract static class GnssAntennaInfo.Callback {
-    ctor public GnssAntennaInfo.Callback();
+  public static class GnssAntennaInfo.Builder {
+    ctor public GnssAntennaInfo.Builder();
+    method @NonNull public android.location.GnssAntennaInfo build();
+    method @NonNull public android.location.GnssAntennaInfo.Builder setCarrierFrequencyMHz(@FloatRange(from=0.0f) double);
+    method @NonNull public android.location.GnssAntennaInfo.Builder setPhaseCenterOffset(@NonNull android.location.GnssAntennaInfo.PhaseCenterOffset);
+    method @NonNull public android.location.GnssAntennaInfo.Builder setPhaseCenterVariationCorrections(@Nullable android.location.GnssAntennaInfo.SphericalCorrections);
+    method @NonNull public android.location.GnssAntennaInfo.Builder setSignalGainCorrections(@Nullable android.location.GnssAntennaInfo.SphericalCorrections);
+  }
+
+  public static interface GnssAntennaInfo.Listener {
     method public void onGnssAntennaInfoReceived(@NonNull java.util.List<android.location.GnssAntennaInfo>);
-    method public void onStatusChanged(int);
-    field public static final int STATUS_LOCATION_DISABLED = 2; // 0x2
-    field public static final int STATUS_NOT_SUPPORTED = 0; // 0x0
-    field public static final int STATUS_READY = 1; // 0x1
   }
 
-  public static final class GnssAntennaInfo.PhaseCenterOffsetCoordinates implements android.os.Parcelable {
-    ctor public GnssAntennaInfo.PhaseCenterOffsetCoordinates(double, double, double, double, double, double);
+  public static final class GnssAntennaInfo.PhaseCenterOffset implements android.os.Parcelable {
+    ctor public GnssAntennaInfo.PhaseCenterOffset(double, double, double, double, double, double);
     method public int describeContents();
-    method public double getXCoordMillimeters();
-    method public double getXCoordUncertaintyMillimeters();
-    method public double getYCoordMillimeters();
-    method public double getYCoordUncertaintyMillimeters();
-    method public double getZCoordMillimeters();
-    method public double getZCoordUncertaintyMillimeters();
+    method @FloatRange public double getXOffsetMm();
+    method @FloatRange public double getXOffsetUncertaintyMm();
+    method @FloatRange public double getYOffsetMm();
+    method @FloatRange public double getYOffsetUncertaintyMm();
+    method @FloatRange public double getZOffsetMm();
+    method @FloatRange public double getZOffsetUncertaintyMm();
     method public void writeToParcel(@NonNull android.os.Parcel, int);
-    field @NonNull public static final android.os.Parcelable.Creator<android.location.GnssAntennaInfo.PhaseCenterOffsetCoordinates> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.location.GnssAntennaInfo.PhaseCenterOffset> CREATOR;
   }
 
-  public static final class GnssAntennaInfo.PhaseCenterVariationCorrections implements android.os.Parcelable {
-    ctor public GnssAntennaInfo.PhaseCenterVariationCorrections(@NonNull double[][], @NonNull double[][]);
+  public static final class GnssAntennaInfo.SphericalCorrections implements android.os.Parcelable {
+    ctor public GnssAntennaInfo.SphericalCorrections(@NonNull double[][], @NonNull double[][]);
     method public int describeContents();
-    method public double getDeltaPhi();
-    method public double getDeltaTheta();
-    method public int getNumColumns();
-    method public int getNumRows();
-    method public double getPhaseCenterVariationCorrectionMillimetersAt(int, int);
-    method public double getPhaseCenterVariationCorrectionUncertaintyMillimetersAt(int, int);
-    method @NonNull public double[][] getRawCorrectionUncertaintiesArray();
-    method @NonNull public double[][] getRawCorrectionsArray();
+    method @NonNull public double[][] getCorrectionUncertaintiesArray();
+    method @NonNull public double[][] getCorrectionsArray();
+    method @FloatRange(from=0.0f, to=180.0f) public double getDeltaPhi();
+    method @FloatRange(from=0.0f, to=360.0f) public double getDeltaTheta();
     method public void writeToParcel(@NonNull android.os.Parcel, int);
-    field @NonNull public static final android.os.Parcelable.Creator<android.location.GnssAntennaInfo.PhaseCenterVariationCorrections> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.location.GnssAntennaInfo.SphericalCorrections> CREATOR;
   }
 
-  public static final class GnssAntennaInfo.SignalGainCorrections implements android.os.Parcelable {
-    ctor public GnssAntennaInfo.SignalGainCorrections(@NonNull double[][], @NonNull double[][]);
-    method public int describeContents();
-    method public double getDeltaPhi();
-    method public double getDeltaTheta();
-    method public int getNumColumns();
-    method public int getNumRows();
-    method @NonNull public double[][] getRawCorrectionUncertaintiesArray();
-    method @NonNull public double[][] getRawCorrectionsArray();
-    method public double getSignalGainCorrectionDbiAt(int, int);
-    method public double getSignalGainCorrectionUncertaintyDbiAt(int, int);
-    method public void writeToParcel(@NonNull android.os.Parcel, int);
-    field @NonNull public static final android.os.Parcelable.Creator<android.location.GnssAntennaInfo.SignalGainCorrections> CREATOR;
+  public final class GnssCapabilities {
+    method public boolean hasGnssAntennaInfo();
   }
 
   public final class GnssClock implements android.os.Parcelable {
@@ -23851,6 +23848,7 @@
     method @NonNull public java.util.List<java.lang.String> getAllProviders();
     method @Nullable public String getBestProvider(@NonNull android.location.Criteria, boolean);
     method @RequiresPermission(anyOf={android.Manifest.permission.ACCESS_COARSE_LOCATION, android.Manifest.permission.ACCESS_FINE_LOCATION}) public void getCurrentLocation(@NonNull String, @Nullable android.os.CancellationSignal, @NonNull java.util.concurrent.Executor, @NonNull java.util.function.Consumer<android.location.Location>);
+    method @NonNull public android.location.GnssCapabilities getGnssCapabilities();
     method @Nullable public String getGnssHardwareModelName();
     method public int getGnssYearOfHardware();
     method @Deprecated @Nullable @RequiresPermission(android.Manifest.permission.ACCESS_FINE_LOCATION) public android.location.GpsStatus getGpsStatus(@Nullable android.location.GpsStatus);
@@ -23860,7 +23858,7 @@
     method @NonNull public java.util.List<java.lang.String> getProviders(@NonNull android.location.Criteria, boolean);
     method public boolean isLocationEnabled();
     method public boolean isProviderEnabled(@NonNull String);
-    method @RequiresPermission(android.Manifest.permission.ACCESS_FINE_LOCATION) public boolean registerAntennaInfoCallback(@NonNull java.util.concurrent.Executor, @NonNull android.location.GnssAntennaInfo.Callback);
+    method @RequiresPermission(android.Manifest.permission.ACCESS_FINE_LOCATION) public boolean registerAntennaInfoListener(@NonNull java.util.concurrent.Executor, @NonNull android.location.GnssAntennaInfo.Listener);
     method @Deprecated @RequiresPermission(android.Manifest.permission.ACCESS_FINE_LOCATION) public boolean registerGnssMeasurementsCallback(@NonNull android.location.GnssMeasurementsEvent.Callback);
     method @RequiresPermission(android.Manifest.permission.ACCESS_FINE_LOCATION) public boolean registerGnssMeasurementsCallback(@NonNull android.location.GnssMeasurementsEvent.Callback, @Nullable android.os.Handler);
     method @RequiresPermission(android.Manifest.permission.ACCESS_FINE_LOCATION) public boolean registerGnssMeasurementsCallback(@NonNull java.util.concurrent.Executor, @NonNull android.location.GnssMeasurementsEvent.Callback);
@@ -23892,7 +23890,7 @@
     method public void setTestProviderEnabled(@NonNull String, boolean);
     method public void setTestProviderLocation(@NonNull String, @NonNull android.location.Location);
     method @Deprecated public void setTestProviderStatus(@NonNull String, int, @Nullable android.os.Bundle, long);
-    method public void unregisterAntennaInfoCallback(@NonNull android.location.GnssAntennaInfo.Callback);
+    method public void unregisterAntennaInfoListener(@NonNull android.location.GnssAntennaInfo.Listener);
     method public void unregisterGnssMeasurementsCallback(@NonNull android.location.GnssMeasurementsEvent.Callback);
     method public void unregisterGnssNavigationMessageCallback(@NonNull android.location.GnssNavigationMessage.Callback);
     method public void unregisterGnssStatusCallback(@NonNull android.location.GnssStatus.Callback);
@@ -24377,10 +24375,8 @@
   public final class AudioPlaybackCaptureConfiguration {
     method @NonNull public int[] getExcludeUids();
     method @NonNull public int[] getExcludeUsages();
-    method @NonNull public int[] getExcludeUserIds();
     method @NonNull public int[] getMatchingUids();
     method @NonNull public int[] getMatchingUsages();
-    method @NonNull public int[] getMatchingUserIds();
     method @NonNull public android.media.projection.MediaProjection getMediaProjection();
   }
 
@@ -24388,11 +24384,9 @@
     ctor public AudioPlaybackCaptureConfiguration.Builder(@NonNull android.media.projection.MediaProjection);
     method @NonNull public android.media.AudioPlaybackCaptureConfiguration.Builder addMatchingUid(int);
     method @NonNull public android.media.AudioPlaybackCaptureConfiguration.Builder addMatchingUsage(int);
-    method @NonNull public android.media.AudioPlaybackCaptureConfiguration.Builder addMatchingUserId(int);
     method @NonNull public android.media.AudioPlaybackCaptureConfiguration build();
     method @NonNull public android.media.AudioPlaybackCaptureConfiguration.Builder excludeUid(int);
     method @NonNull public android.media.AudioPlaybackCaptureConfiguration.Builder excludeUsage(int);
-    method @NonNull public android.media.AudioPlaybackCaptureConfiguration.Builder excludeUserId(int);
   }
 
   public final class AudioPlaybackConfiguration implements android.os.Parcelable {
@@ -25096,7 +25090,7 @@
 
   public final class MediaCas implements java.lang.AutoCloseable {
     ctor public MediaCas(int) throws android.media.MediaCasException.UnsupportedCasException;
-    ctor public MediaCas(int, @Nullable String, int) throws android.media.MediaCasException.UnsupportedCasException;
+    ctor public MediaCas(@NonNull android.content.Context, int, @Nullable String, int) throws android.media.MediaCasException.UnsupportedCasException;
     method public void close();
     method public static android.media.MediaCas.PluginDescriptor[] enumeratePlugins();
     method protected void finalize();
@@ -31740,7 +31734,7 @@
     method public android.net.wifi.hotspot2.pps.Credential getCredential();
     method public android.net.wifi.hotspot2.pps.HomeSp getHomeSp();
     method public long getSubscriptionExpirationTimeMillis();
-    method @NonNull public String getUniqueId() throws java.lang.IllegalStateException;
+    method @NonNull public String getUniqueId();
     method public boolean isOsuProvisioned();
     method public void setCredential(android.net.wifi.hotspot2.pps.Credential);
     method public void setHomeSp(android.net.wifi.hotspot2.pps.HomeSp);
@@ -36629,6 +36623,7 @@
     method public void addThermalStatusListener(@NonNull java.util.concurrent.Executor, @NonNull android.os.PowerManager.OnThermalStatusChangedListener);
     method public int getCurrentThermalStatus();
     method public int getLocationPowerSaveMode();
+    method public float getThermalHeadroom(@IntRange(from=0, to=60) int);
     method public boolean isDeviceIdleMode();
     method public boolean isIgnoringBatteryOptimizations(String);
     method public boolean isInteractive();
@@ -40581,13 +40576,13 @@
     field public static final String WIFI_MAX_DHCP_RETRY_COUNT = "wifi_max_dhcp_retry_count";
     field public static final String WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS = "wifi_mobile_data_transition_wakelock_timeout_ms";
     field @Deprecated public static final String WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON = "wifi_networks_available_notification_on";
-    field public static final String WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY = "wifi_networks_available_repeat_delay";
-    field public static final String WIFI_NUM_OPEN_NETWORKS_KEPT = "wifi_num_open_networks_kept";
+    field @Deprecated public static final String WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY = "wifi_networks_available_repeat_delay";
+    field @Deprecated public static final String WIFI_NUM_OPEN_NETWORKS_KEPT = "wifi_num_open_networks_kept";
     field public static final String WIFI_ON = "wifi_on";
-    field public static final String WIFI_SLEEP_POLICY = "wifi_sleep_policy";
-    field public static final int WIFI_SLEEP_POLICY_DEFAULT = 0; // 0x0
-    field public static final int WIFI_SLEEP_POLICY_NEVER = 2; // 0x2
-    field public static final int WIFI_SLEEP_POLICY_NEVER_WHILE_PLUGGED = 1; // 0x1
+    field @Deprecated public static final String WIFI_SLEEP_POLICY = "wifi_sleep_policy";
+    field @Deprecated public static final int WIFI_SLEEP_POLICY_DEFAULT = 0; // 0x0
+    field @Deprecated public static final int WIFI_SLEEP_POLICY_NEVER = 2; // 0x2
+    field @Deprecated public static final int WIFI_SLEEP_POLICY_NEVER_WHILE_PLUGGED = 1; // 0x1
     field public static final String WIFI_WATCHDOG_ON = "wifi_watchdog_on";
     field public static final String WINDOW_ANIMATION_SCALE = "window_animation_scale";
   }
@@ -43398,11 +43393,12 @@
 
   public abstract class ControlsProviderService extends android.app.Service {
     ctor public ControlsProviderService();
-    method public abstract void loadAvailableControls(@NonNull java.util.function.Consumer<java.util.List<android.service.controls.Control>>);
-    method public void loadSuggestedControls(int, @NonNull java.util.function.Consumer<java.util.List<android.service.controls.Control>>);
+    method @Deprecated public void loadAvailableControls(@NonNull java.util.function.Consumer<java.util.List<android.service.controls.Control>>);
     method @NonNull public final android.os.IBinder onBind(@NonNull android.content.Intent);
     method public abstract void performControlAction(@NonNull String, @NonNull android.service.controls.actions.ControlAction, @NonNull java.util.function.Consumer<java.lang.Integer>);
     method @NonNull public abstract java.util.concurrent.Flow.Publisher<android.service.controls.Control> publisherFor(@NonNull java.util.List<java.lang.String>);
+    method @Nullable public java.util.concurrent.Flow.Publisher<android.service.controls.Control> publisherForAllAvailable();
+    method @Nullable public java.util.concurrent.Flow.Publisher<android.service.controls.Control> publisherForSuggested();
     field public static final String SERVICE_CONTROLS = "android.service.controls.ControlsProviderService";
     field @NonNull public static final String TAG = "ControlsProviderService";
   }
@@ -43545,7 +43541,6 @@
     method public abstract int getTemplateType();
     field @NonNull public static final android.service.controls.templates.ControlTemplate ERROR_TEMPLATE;
     field @NonNull public static final android.service.controls.templates.ControlTemplate NO_TEMPLATE;
-    field public static final int TYPE_DISCRETE_TOGGLE = 4; // 0x4
     field public static final int TYPE_ERROR = -1; // 0xffffffff
     field public static final int TYPE_NONE = 0; // 0x0
     field public static final int TYPE_RANGE = 2; // 0x2
@@ -43556,30 +43551,6 @@
     field public static final int TYPE_TOGGLE_RANGE = 6; // 0x6
   }
 
-  public final class CoordinatedRangeTemplate extends android.service.controls.templates.ControlTemplate {
-    ctor public CoordinatedRangeTemplate(@NonNull String, float, @NonNull android.service.controls.templates.RangeTemplate, @NonNull android.service.controls.templates.RangeTemplate);
-    ctor public CoordinatedRangeTemplate(@NonNull String, float, float, float, float, float, float, float, float, @Nullable CharSequence);
-    method public float getCurrentValueHigh();
-    method public float getCurrentValueLow();
-    method @NonNull public CharSequence getFormatString();
-    method public float getMaxValueHigh();
-    method public float getMaxValueLow();
-    method public float getMinGap();
-    method public float getMinValueHigh();
-    method public float getMinValueLow();
-    method @NonNull public android.service.controls.templates.RangeTemplate getRangeHigh();
-    method @NonNull public android.service.controls.templates.RangeTemplate getRangeLow();
-    method public float getStepValue();
-    method public int getTemplateType();
-  }
-
-  public final class DiscreteToggleTemplate extends android.service.controls.templates.ControlTemplate {
-    ctor public DiscreteToggleTemplate(@NonNull String, @NonNull android.service.controls.templates.ControlButton, @NonNull android.service.controls.templates.ControlButton);
-    method @NonNull public android.service.controls.templates.ControlButton getNegativeButton();
-    method @NonNull public android.service.controls.templates.ControlButton getPositiveButton();
-    method public int getTemplateType();
-  }
-
   public final class RangeTemplate extends android.service.controls.templates.ControlTemplate {
     ctor public RangeTemplate(@NonNull String, float, float, float, float, @Nullable CharSequence);
     method public float getCurrentValue();
@@ -46833,59 +46804,6 @@
     field public static final String KEY_WIFI_OFF_DEFERRING_TIME_INT = "ims.wifi_off_deferring_time_int";
   }
 
-  public static final class CarrierConfigManager.Iwlan {
-    field public static final int AUTHENTICATION_METHOD_CERT = 1; // 0x1
-    field public static final int AUTHENTICATION_METHOD_EAP_ONLY = 0; // 0x0
-    field public static final int DH_GROUP_1024_BIT_MODP = 2; // 0x2
-    field public static final int DH_GROUP_2048_BIT_MODP = 14; // 0xe
-    field public static final int DH_GROUP_NONE = 0; // 0x0
-    field public static final int ENCRYPTION_ALGORITHM_3DES = 3; // 0x3
-    field public static final int ENCRYPTION_ALGORITHM_AES_CBC = 12; // 0xc
-    field public static final int ENCRYPTION_ALGORITHM_AES_GCM_12 = 19; // 0x13
-    field public static final int ENCRYPTION_ALGORITHM_AES_GCM_16 = 20; // 0x14
-    field public static final int ENCRYPTION_ALGORITHM_AES_GCM_8 = 18; // 0x12
-    field public static final int EPDG_ADDRESS_PCO = 2; // 0x2
-    field public static final int EPDG_ADDRESS_PLMN = 1; // 0x1
-    field public static final int EPDG_ADDRESS_STATIC = 0; // 0x0
-    field public static final int INTEGRITY_ALGORITHM_AES_XCBC_96 = 5; // 0x5
-    field public static final int INTEGRITY_ALGORITHM_HMAC_SHA1_96 = 2; // 0x2
-    field public static final int INTEGRITY_ALGORITHM_HMAC_SHA2_256_128 = 12; // 0xc
-    field public static final int INTEGRITY_ALGORITHM_HMAC_SHA2_384_192 = 13; // 0xd
-    field public static final int INTEGRITY_ALGORITHM_HMAC_SHA2_512_256 = 14; // 0xe
-    field public static final int INTEGRITY_ALGORITHM_NONE = 0; // 0x0
-    field public static final String KEY_CHILD_SA_REKEY_HARD_TIMER_SEC_INT = "iwlan.child_sa_rekey_hard_timer_sec_int";
-    field public static final String KEY_CHILD_SA_REKEY_SOFT_TIMER_SEC_INT = "iwlan.child_sa_rekey_soft_timer_sec_int";
-    field public static final String KEY_CHILD_SESSION_AES_CBC_KEY_SIZE_INT_ARRAY = "iwlan.child_session_aes_cbc_key_size_int_array";
-    field public static final String KEY_CHILD_SESSION_AES_CTR_KEY_SIZE_INT_ARRAY = "iwlan.child_encryption_aes_ctr_key_size_int_array";
-    field public static final String KEY_DIFFIE_HELLMAN_GROUPS_INT_ARRAY = "iwlan.diffie_hellman_groups_int_array";
-    field public static final String KEY_DPD_TIMER_SEC_INT = "iwlan.dpd_timer_sec_int";
-    field public static final String KEY_EPDG_ADDRESS_PRIORITY_INT_ARRAY = "iwlan.epdg_address_priority_int_array";
-    field public static final String KEY_EPDG_AUTHENTICATION_METHOD_INT = "iwlan.epdg_authentication_method_int";
-    field public static final String KEY_EPDG_STATIC_ADDRESS_ROAMING_STRING = "iwlan.epdg_static_address_roaming_string";
-    field public static final String KEY_EPDG_STATIC_ADDRESS_STRING = "iwlan.epdg_static_address_string";
-    field public static final String KEY_IKE_FRAGMENTATION_ENABLED_BOOL = "iwlan.ike_fragmentation_enabled_bool";
-    field public static final String KEY_IKE_REKEY_HARD_TIMER_SEC_INT = "iwlan.ike_rekey_hard_timer_in_sec";
-    field public static final String KEY_IKE_REKEY_SOFT_TIMER_SEC_INT = "iwlan.ike_rekey_soft_timer_sec_int";
-    field public static final String KEY_IKE_SESSION_AES_CBC_KEY_SIZE_INT_ARRAY = "iwlan.ike_session_encryption_aes_cbc_key_size_int_array";
-    field public static final String KEY_IKE_SESSION_AES_CTR_KEY_SIZE_INT_ARRAY = "iwlan.ike_session_aes_ctr_key_size_int_array";
-    field public static final int KEY_LEN_AES_128 = 128; // 0x80
-    field public static final int KEY_LEN_AES_192 = 192; // 0xc0
-    field public static final int KEY_LEN_AES_256 = 256; // 0x100
-    field public static final int KEY_LEN_UNUSED = 0; // 0x0
-    field public static final String KEY_MAX_RETRIES_INT = "iwlan.max_retries_int";
-    field public static final String KEY_MCC_MNCS_STRING_ARRAY = "iwlan.mcc_mncs_string_array";
-    field public static final String KEY_NATT_ENABLED_BOOL = "iwlan.natt_enabled_bool";
-    field public static final String KEY_NATT_KEEP_ALIVE_TIMER_SEC_INT = "iwlan.natt_keep_alive_timer_sec_int";
-    field public static final String KEY_PREFIX = "iwlan.";
-    field public static final String KEY_RETRANSMIT_TIMER_SEC_INT = "iwlan.retransmit_timer_sec_int";
-    field public static final String KEY_SUPPORTED_CHILD_SESSION_ENCRYPTION_ALGORITHMS_INT_ARRAY = "iwlan.supported_child_session_encryption_algorithms_int_array";
-    field public static final String KEY_SUPPORTED_IKE_SESSION_ENCRYPTION_ALGORITHMS_INT_ARRAY = "iwlan.supported_ike_session_encryption_algorithms_int_array";
-    field public static final String KEY_SUPPORTED_INTEGRITY_ALGORITHMS_INT_ARRAY = "iwlan.supported_integrity_algorithms_int_array";
-    field public static final String KEY_SUPPORTED_PRF_ALGORITHMS_INT_ARRAY = "iwlan.supported_prf_algorithms_int_array";
-    field public static final int PSEUDORANDOM_FUNCTION_AES128_XCBC = 4; // 0x4
-    field public static final int PSEUDORANDOM_FUNCTION_HMAC_SHA1 = 2; // 0x2
-  }
-
   public abstract class CellIdentity implements android.os.Parcelable {
     method public int describeContents();
     method @Nullable public CharSequence getOperatorAlphaLong();
@@ -53260,11 +53178,13 @@
     method public android.graphics.Canvas lockHardwareCanvas();
     method public void readFromParcel(android.os.Parcel);
     method public void release();
-    method public void setFrameRate(@FloatRange(from=0.0) float);
+    method public void setFrameRate(@FloatRange(from=0.0) float, int);
     method @Deprecated public void unlockCanvas(android.graphics.Canvas);
     method public void unlockCanvasAndPost(android.graphics.Canvas);
     method public void writeToParcel(android.os.Parcel, int);
     field @NonNull public static final android.os.Parcelable.Creator<android.view.Surface> CREATOR;
+    field public static final int FRAME_RATE_COMPATIBILITY_DEFAULT = 0; // 0x0
+    field public static final int FRAME_RATE_COMPATIBILITY_FIXED_SOURCE = 1; // 0x1
     field public static final int ROTATION_0 = 0; // 0x0
     field public static final int ROTATION_180 = 2; // 0x2
     field public static final int ROTATION_270 = 3; // 0x3
@@ -53304,7 +53224,7 @@
     method @NonNull public android.view.SurfaceControl.Transaction reparent(@NonNull android.view.SurfaceControl, @Nullable android.view.SurfaceControl);
     method @NonNull public android.view.SurfaceControl.Transaction setAlpha(@NonNull android.view.SurfaceControl, @FloatRange(from=0.0, to=1.0) float);
     method @NonNull public android.view.SurfaceControl.Transaction setBufferSize(@NonNull android.view.SurfaceControl, @IntRange(from=0) int, @IntRange(from=0) int);
-    method @NonNull public android.view.SurfaceControl.Transaction setFrameRate(@NonNull android.view.SurfaceControl, @FloatRange(from=0.0) float);
+    method @NonNull public android.view.SurfaceControl.Transaction setFrameRate(@NonNull android.view.SurfaceControl, @FloatRange(from=0.0) float, int);
     method @NonNull public android.view.SurfaceControl.Transaction setGeometry(@NonNull android.view.SurfaceControl, @Nullable android.graphics.Rect, @Nullable android.graphics.Rect, int);
     method @NonNull public android.view.SurfaceControl.Transaction setLayer(@NonNull android.view.SurfaceControl, @IntRange(from=java.lang.Integer.MIN_VALUE, to=java.lang.Integer.MAX_VALUE) int);
     method @NonNull public android.view.SurfaceControl.Transaction setVisibility(@NonNull android.view.SurfaceControl, boolean);
@@ -53912,6 +53832,7 @@
     method public boolean requestRectangleOnScreen(android.graphics.Rect);
     method public boolean requestRectangleOnScreen(android.graphics.Rect, boolean);
     method public final void requestUnbufferedDispatch(android.view.MotionEvent);
+    method public final void requestUnbufferedDispatch(int);
     method @NonNull public final <T extends android.view.View> T requireViewById(@IdRes int);
     method public void resetPivot();
     method public static int resolveSize(int, int);
@@ -55625,6 +55546,7 @@
     method public CharSequence getContentDescription();
     method public int getDrawingOrder();
     method public CharSequence getError();
+    method @Nullable public android.view.accessibility.AccessibilityNodeInfo.ExtraRenderingInfo getExtraRenderingInfo();
     method public android.os.Bundle getExtras();
     method public CharSequence getHintText();
     method public int getInputType();
@@ -55777,6 +55699,7 @@
     field public static final int ACTION_SET_SELECTION = 131072; // 0x20000
     field public static final int ACTION_SET_TEXT = 2097152; // 0x200000
     field @NonNull public static final android.os.Parcelable.Creator<android.view.accessibility.AccessibilityNodeInfo> CREATOR;
+    field public static final String EXTRA_DATA_RENDERING_INFO_KEY = "android.view.accessibility.extra.DATA_RENDERING_INFO_KEY";
     field public static final String EXTRA_DATA_TEXT_CHARACTER_LOCATION_ARG_LENGTH = "android.view.accessibility.extra.DATA_TEXT_CHARACTER_LOCATION_ARG_LENGTH";
     field public static final String EXTRA_DATA_TEXT_CHARACTER_LOCATION_ARG_START_INDEX = "android.view.accessibility.extra.DATA_TEXT_CHARACTER_LOCATION_ARG_START_INDEX";
     field public static final String EXTRA_DATA_TEXT_CHARACTER_LOCATION_KEY = "android.view.accessibility.extra.DATA_TEXT_CHARACTER_LOCATION_KEY";
@@ -55864,6 +55787,12 @@
     method public static android.view.accessibility.AccessibilityNodeInfo.CollectionItemInfo obtain(int, int, int, int, boolean, boolean);
   }
 
+  public static final class AccessibilityNodeInfo.ExtraRenderingInfo {
+    method @Nullable public android.util.Size getLayoutParams();
+    method public float getTextSizeInPx();
+    method public int getTextSizeUnit();
+  }
+
   public static final class AccessibilityNodeInfo.RangeInfo {
     ctor public AccessibilityNodeInfo.RangeInfo(int, float, float, float);
     method public float getCurrent();
@@ -60846,6 +60775,7 @@
     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 int getTextSizeUnit();
     method public int getTotalPaddingBottom();
     method public int getTotalPaddingEnd();
     method public int getTotalPaddingLeft();
@@ -72122,6 +72052,7 @@
     method public static java.time.chrono.JapaneseEra[] values();
     field public static final java.time.chrono.JapaneseEra HEISEI;
     field public static final java.time.chrono.JapaneseEra MEIJI;
+    field public static final java.time.chrono.JapaneseEra REIWA;
     field public static final java.time.chrono.JapaneseEra SHOWA;
     field public static final java.time.chrono.JapaneseEra TAISHO;
   }
diff --git a/api/lint-baseline.txt b/api/lint-baseline.txt
index 2a8f04f..569e838 100644
--- a/api/lint-baseline.txt
+++ b/api/lint-baseline.txt
@@ -561,6 +561,9 @@
     
 MissingNullability: android.media.MediaMetadataRetriever#getScaledFrameAtTime(long, int, int, int, android.media.MediaMetadataRetriever.BitmapParams):
 
+    
+MissingNullability: java.time.chrono.JapaneseEra#REIWA:
+    Missing nullability on field `REIWA` in class `class java.time.chrono.JapaneseEra`
 
 
 RequiresPermission: android.accounts.AccountManager#getAccountsByTypeAndFeatures(String, String[], android.accounts.AccountManagerCallback<android.accounts.Account[]>, android.os.Handler):
diff --git a/api/system-current.txt b/api/system-current.txt
index a8c2453..202a939 100755
--- a/api/system-current.txt
+++ b/api/system-current.txt
@@ -118,6 +118,7 @@
     field public static final String MANAGE_CONTENT_CAPTURE = "android.permission.MANAGE_CONTENT_CAPTURE";
     field public static final String MANAGE_CONTENT_SUGGESTIONS = "android.permission.MANAGE_CONTENT_SUGGESTIONS";
     field public static final String MANAGE_DEBUGGING = "android.permission.MANAGE_DEBUGGING";
+    field public static final String MANAGE_FACTORY_RESET_PROTECTION = "android.permission.MANAGE_FACTORY_RESET_PROTECTION";
     field public static final String MANAGE_IPSEC_TUNNELS = "android.permission.MANAGE_IPSEC_TUNNELS";
     field public static final String MANAGE_ONE_TIME_PERMISSION_SESSIONS = "android.permission.MANAGE_ONE_TIME_PERMISSION_SESSIONS";
     field public static final String MANAGE_ROLE_HOLDERS = "android.permission.MANAGE_ROLE_HOLDERS";
@@ -371,10 +372,11 @@
     method @NonNull @RequiresPermission(android.Manifest.permission.GET_APP_OPS_STATS) public java.util.List<android.app.AppOpsManager.PackageOps> getPackagesForOps(@Nullable String[]);
     method public static int opToDefaultMode(@NonNull String);
     method @Nullable public static String opToPermission(@NonNull String);
-    method @RequiresPermission("android.permission.MANAGE_APP_OPS_MODES") public void setMode(String, int, String, int);
-    method @RequiresPermission("android.permission.MANAGE_APP_OPS_MODES") public void setUidMode(String, int, int);
+    method @RequiresPermission("android.permission.MANAGE_APP_OPS_MODES") public void setMode(@NonNull String, int, @Nullable String, int);
+    method @RequiresPermission("android.permission.MANAGE_APP_OPS_MODES") public void setUidMode(@NonNull String, int, int);
     field public static final String OPSTR_ACCEPT_HANDOVER = "android:accept_handover";
     field public static final String OPSTR_ACCESS_ACCESSIBILITY = "android:access_accessibility";
+    field public static final String OPSTR_ACCESS_CALL_AUDIO = "android:access_call_audio";
     field public static final String OPSTR_ACCESS_NOTIFICATIONS = "android:access_notifications";
     field public static final String OPSTR_ACTIVATE_VPN = "android:activate_vpn";
     field public static final String OPSTR_ASSIST_SCREENSHOT = "android:assist_screenshot";
@@ -887,7 +889,7 @@
     field public static final String ACTION_PROVISION_FINALIZATION = "android.app.action.PROVISION_FINALIZATION";
     field public static final String ACTION_PROVISION_FINANCED_DEVICE = "android.app.action.PROVISION_FINANCED_DEVICE";
     field public static final String ACTION_PROVISION_MANAGED_DEVICE_FROM_TRUSTED_SOURCE = "android.app.action.PROVISION_MANAGED_DEVICE_FROM_TRUSTED_SOURCE";
-    field public static final String ACTION_RESET_PROTECTION_POLICY_CHANGED = "android.app.action.RESET_PROTECTION_POLICY_CHANGED";
+    field @RequiresPermission(android.Manifest.permission.MANAGE_FACTORY_RESET_PROTECTION) public static final String ACTION_RESET_PROTECTION_POLICY_CHANGED = "android.app.action.RESET_PROTECTION_POLICY_CHANGED";
     field public static final String ACTION_SET_PROFILE_OWNER = "android.app.action.SET_PROFILE_OWNER";
     field public static final String ACTION_STATE_USER_SETUP_COMPLETE = "android.app.action.STATE_USER_SETUP_COMPLETE";
     field public static final String EXTRA_PROFILE_OWNER_NAME = "android.app.extra.PROFILE_OWNER_NAME";
@@ -3822,7 +3824,6 @@
 
   public final class GnssCapabilities {
     method public boolean hasGeofencing();
-    method public boolean hasGnssAntennaInfo();
     method public boolean hasLowPowerMode();
     method public boolean hasMeasurementCorrections();
     method public boolean hasMeasurementCorrectionsExcessPathLength();
@@ -4162,7 +4163,6 @@
     method @RequiresPermission(anyOf={android.Manifest.permission.ACCESS_COARSE_LOCATION, android.Manifest.permission.ACCESS_FINE_LOCATION}) public void getCurrentLocation(@NonNull android.location.LocationRequest, @Nullable android.os.CancellationSignal, @NonNull java.util.concurrent.Executor, @NonNull java.util.function.Consumer<android.location.Location>);
     method @Nullable public String getExtraLocationControllerPackage();
     method @RequiresPermission(android.Manifest.permission.LOCATION_HARDWARE) public int getGnssBatchSize();
-    method @NonNull @RequiresPermission(android.Manifest.permission.ACCESS_FINE_LOCATION) public android.location.GnssCapabilities getGnssCapabilities();
     method @RequiresPermission(android.Manifest.permission.ACCESS_FINE_LOCATION) public void injectGnssMeasurementCorrections(@NonNull android.location.GnssMeasurementCorrections);
     method public boolean isExtraLocationControllerPackageEnabled();
     method public boolean isLocationEnabledForUser(@NonNull android.os.UserHandle);
@@ -4247,15 +4247,15 @@
     method @NonNull @RequiresPermission(android.Manifest.permission.MODIFY_AUDIO_ROUTING) public android.media.AudioAttributes.Builder setSystemUsage(int);
   }
 
-  public final class AudioDevice implements android.os.Parcelable {
-    ctor public AudioDevice(@NonNull android.media.AudioDeviceInfo);
-    ctor public AudioDevice(int, int, @NonNull String);
+  public final class AudioDeviceAttributes implements android.os.Parcelable {
+    ctor public AudioDeviceAttributes(@NonNull android.media.AudioDeviceInfo);
+    ctor public AudioDeviceAttributes(int, int, @NonNull String);
     method public int describeContents();
     method @NonNull public String getAddress();
     method public int getRole();
     method public int getType();
     method public void writeToParcel(@NonNull android.os.Parcel, int);
-    field @NonNull public static final android.os.Parcelable.Creator<android.media.AudioDevice> CREATOR;
+    field @NonNull public static final android.os.Parcelable.Creator<android.media.AudioDeviceAttributes> CREATOR;
     field public static final int ROLE_INPUT = 1; // 0x1
     field public static final int ROLE_OUTPUT = 2; // 0x2
   }
@@ -4293,11 +4293,11 @@
     method @IntRange(from=0) public int getAdditionalOutputDeviceDelay(@NonNull android.media.AudioDeviceInfo);
     method @NonNull @RequiresPermission(android.Manifest.permission.MODIFY_AUDIO_ROUTING) public static java.util.List<android.media.audiopolicy.AudioProductStrategy> getAudioProductStrategies();
     method @NonNull @RequiresPermission(android.Manifest.permission.MODIFY_AUDIO_ROUTING) public static java.util.List<android.media.audiopolicy.AudioVolumeGroup> getAudioVolumeGroups();
-    method @NonNull @RequiresPermission(android.Manifest.permission.MODIFY_AUDIO_ROUTING) public java.util.List<android.media.AudioDevice> getDevicesForAttributes(@NonNull android.media.AudioAttributes);
+    method @NonNull @RequiresPermission(android.Manifest.permission.MODIFY_AUDIO_ROUTING) public java.util.List<android.media.AudioDeviceAttributes> getDevicesForAttributes(@NonNull android.media.AudioAttributes);
     method @IntRange(from=0) public int getMaxAdditionalOutputDeviceDelay(@NonNull android.media.AudioDeviceInfo);
     method @IntRange(from=0) @RequiresPermission(android.Manifest.permission.MODIFY_AUDIO_ROUTING) public int getMaxVolumeIndexForAttributes(@NonNull android.media.AudioAttributes);
     method @IntRange(from=0) @RequiresPermission(android.Manifest.permission.MODIFY_AUDIO_ROUTING) public int getMinVolumeIndexForAttributes(@NonNull android.media.AudioAttributes);
-    method @Nullable @RequiresPermission(android.Manifest.permission.MODIFY_AUDIO_ROUTING) public android.media.AudioDevice getPreferredDeviceForStrategy(@NonNull android.media.audiopolicy.AudioProductStrategy);
+    method @Nullable @RequiresPermission(android.Manifest.permission.MODIFY_AUDIO_ROUTING) public android.media.AudioDeviceAttributes getPreferredDeviceForStrategy(@NonNull android.media.audiopolicy.AudioProductStrategy);
     method @NonNull @RequiresPermission(android.Manifest.permission.MODIFY_AUDIO_ROUTING) public int[] getSupportedSystemUsages();
     method @IntRange(from=0) @RequiresPermission(android.Manifest.permission.MODIFY_AUDIO_ROUTING) public int getVolumeIndexForAttributes(@NonNull android.media.AudioAttributes);
     method public boolean isAudioServerRunning();
@@ -4312,7 +4312,7 @@
     method @RequiresPermission(android.Manifest.permission.MODIFY_AUDIO_ROUTING) public boolean setAdditionalOutputDeviceDelay(@NonNull android.media.AudioDeviceInfo, @IntRange(from=0) int);
     method public void setAudioServerStateCallback(@NonNull java.util.concurrent.Executor, @NonNull android.media.AudioManager.AudioServerStateCallback);
     method @RequiresPermission(android.Manifest.permission.MODIFY_AUDIO_ROUTING) public void setFocusRequestResult(@NonNull android.media.AudioFocusInfo, int, @NonNull android.media.audiopolicy.AudioPolicy);
-    method @RequiresPermission(android.Manifest.permission.MODIFY_AUDIO_ROUTING) public boolean setPreferredDeviceForStrategy(@NonNull android.media.audiopolicy.AudioProductStrategy, @NonNull android.media.AudioDevice);
+    method @RequiresPermission(android.Manifest.permission.MODIFY_AUDIO_ROUTING) public boolean setPreferredDeviceForStrategy(@NonNull android.media.audiopolicy.AudioProductStrategy, @NonNull android.media.AudioDeviceAttributes);
     method @RequiresPermission(android.Manifest.permission.MODIFY_AUDIO_ROUTING) public void setSupportedSystemUsages(@NonNull int[]);
     method @RequiresPermission(android.Manifest.permission.MODIFY_AUDIO_ROUTING) public void setVolumeIndexForAttributes(@NonNull android.media.AudioAttributes, int, int);
     method @RequiresPermission(android.Manifest.permission.MODIFY_AUDIO_ROUTING) public void unregisterAudioPolicy(@NonNull android.media.audiopolicy.AudioPolicy);
@@ -4332,7 +4332,7 @@
   }
 
   public static interface AudioManager.OnPreferredDeviceForStrategyChangedListener {
-    method public void onPreferredDeviceForStrategyChanged(@NonNull android.media.audiopolicy.AudioProductStrategy, @Nullable android.media.AudioDevice);
+    method public void onPreferredDeviceForStrategyChanged(@NonNull android.media.audiopolicy.AudioProductStrategy, @Nullable android.media.AudioDeviceAttributes);
   }
 
   public abstract static class AudioManager.VolumeGroupCallback {
@@ -4412,7 +4412,7 @@
 package android.media.audiofx {
 
   public class AudioEffect {
-    ctor @RequiresPermission("android.permission.MODIFY_DEFAULT_AUDIO_EFFECTS") public AudioEffect(@NonNull java.util.UUID, @NonNull android.media.AudioDevice);
+    ctor @RequiresPermission("android.permission.MODIFY_DEFAULT_AUDIO_EFFECTS") public AudioEffect(@NonNull java.util.UUID, @NonNull android.media.AudioDeviceAttributes);
   }
 
 }
@@ -4826,7 +4826,7 @@
     method public int getAudioFilterCount();
     method public int getDemuxCount();
     method public int getFilterCapabilities();
-    method @Nullable @Size(5) public int[] getLinkCapabilities();
+    method @NonNull @Size(5) public int[] getLinkCapabilities();
     method public int getPcrFilterCount();
     method public int getPesFilterCount();
     method public int getPlaybackCount();
@@ -4842,7 +4842,7 @@
     method public int addPid(int, int, @Nullable android.media.tv.tuner.filter.Filter);
     method public void close();
     method public int removePid(int, int, @Nullable android.media.tv.tuner.filter.Filter);
-    method public int setKeyToken(@Nullable byte[]);
+    method public int setKeyToken(@NonNull byte[]);
     field public static final int PID_TYPE_MMTP = 2; // 0x2
     field public static final int PID_TYPE_T = 1; // 0x1
   }
@@ -4879,10 +4879,11 @@
   }
 
   public class Tuner implements java.lang.AutoCloseable {
-    ctor @RequiresPermission(android.Manifest.permission.ACCESS_TV_TUNER) public Tuner(@NonNull android.content.Context, @NonNull String, int, @Nullable android.media.tv.tuner.Tuner.OnResourceLostListener);
+    ctor @RequiresPermission(android.Manifest.permission.ACCESS_TV_TUNER) public Tuner(@NonNull android.content.Context, @Nullable String, int);
     method @RequiresPermission(android.Manifest.permission.ACCESS_TV_TUNER) public int cancelScanning();
     method @RequiresPermission(android.Manifest.permission.ACCESS_TV_TUNER) public int cancelTuning();
     method @RequiresPermission(android.Manifest.permission.ACCESS_TV_TUNER) public void clearOnTuneEventListener();
+    method @RequiresPermission(android.Manifest.permission.ACCESS_TV_TUNER) public void clearResourceLostListener();
     method @RequiresPermission(android.Manifest.permission.ACCESS_TV_TUNER) public void close();
     method @RequiresPermission(android.Manifest.permission.ACCESS_TV_TUNER) public int connectCiCam(int);
     method @RequiresPermission(android.Manifest.permission.ACCESS_TV_TUNER) public int disconnectCiCam();
@@ -4892,15 +4893,16 @@
     method @Nullable @RequiresPermission(android.Manifest.permission.ACCESS_TV_TUNER) public android.media.tv.tuner.frontend.FrontendInfo getFrontendInfo();
     method @Nullable public android.media.tv.tuner.frontend.FrontendStatus getFrontendStatus(@NonNull int[]);
     method @Nullable @RequiresPermission(android.Manifest.permission.ACCESS_TV_DESCRAMBLER) public android.media.tv.tuner.Descrambler openDescrambler();
-    method @Nullable @RequiresPermission(android.Manifest.permission.ACCESS_TV_TUNER) public android.media.tv.tuner.dvr.DvrPlayback openDvrPlayback(long, @Nullable java.util.concurrent.Executor, @Nullable android.media.tv.tuner.dvr.OnPlaybackStatusChangedListener);
-    method @Nullable @RequiresPermission(android.Manifest.permission.ACCESS_TV_TUNER) public android.media.tv.tuner.dvr.DvrRecorder openDvrRecorder(long, @Nullable java.util.concurrent.Executor, @Nullable android.media.tv.tuner.dvr.OnRecordStatusChangedListener);
+    method @Nullable @RequiresPermission(android.Manifest.permission.ACCESS_TV_TUNER) public android.media.tv.tuner.dvr.DvrPlayback openDvrPlayback(long, @NonNull java.util.concurrent.Executor, @NonNull android.media.tv.tuner.dvr.OnPlaybackStatusChangedListener);
+    method @Nullable @RequiresPermission(android.Manifest.permission.ACCESS_TV_TUNER) public android.media.tv.tuner.dvr.DvrRecorder openDvrRecorder(long, @NonNull java.util.concurrent.Executor, @NonNull android.media.tv.tuner.dvr.OnRecordStatusChangedListener);
     method @Nullable @RequiresPermission(android.Manifest.permission.ACCESS_TV_TUNER) public android.media.tv.tuner.filter.Filter openFilter(int, int, long, @Nullable java.util.concurrent.Executor, @Nullable android.media.tv.tuner.filter.FilterCallback);
-    method @Nullable @RequiresPermission(android.Manifest.permission.ACCESS_TV_TUNER) public android.media.tv.tuner.Lnb openLnb(@Nullable java.util.concurrent.Executor, @Nullable android.media.tv.tuner.LnbCallback);
-    method @Nullable @RequiresPermission(android.Manifest.permission.ACCESS_TV_TUNER) public android.media.tv.tuner.Lnb openLnbByName(@Nullable String, @Nullable java.util.concurrent.Executor, @NonNull android.media.tv.tuner.LnbCallback);
+    method @Nullable @RequiresPermission(android.Manifest.permission.ACCESS_TV_TUNER) public android.media.tv.tuner.Lnb openLnb(@NonNull java.util.concurrent.Executor, @NonNull android.media.tv.tuner.LnbCallback);
+    method @Nullable @RequiresPermission(android.Manifest.permission.ACCESS_TV_TUNER) public android.media.tv.tuner.Lnb openLnbByName(@NonNull String, @NonNull java.util.concurrent.Executor, @NonNull android.media.tv.tuner.LnbCallback);
     method @Nullable public android.media.tv.tuner.filter.TimeFilter openTimeFilter();
     method @RequiresPermission(android.Manifest.permission.ACCESS_TV_TUNER) public int scan(@NonNull android.media.tv.tuner.frontend.FrontendSettings, int, @NonNull java.util.concurrent.Executor, @NonNull android.media.tv.tuner.frontend.ScanCallback);
-    method @RequiresPermission(android.Manifest.permission.ACCESS_TV_TUNER) public int setLna(boolean);
+    method @RequiresPermission(android.Manifest.permission.ACCESS_TV_TUNER) public int setLnaEnabled(boolean);
     method @RequiresPermission(android.Manifest.permission.ACCESS_TV_TUNER) public void setOnTuneEventListener(@NonNull java.util.concurrent.Executor, @NonNull android.media.tv.tuner.frontend.OnTuneEventListener);
+    method @RequiresPermission(android.Manifest.permission.ACCESS_TV_TUNER) public void setResourceLostListener(@NonNull java.util.concurrent.Executor, @NonNull android.media.tv.tuner.Tuner.OnResourceLostListener);
     method @RequiresPermission(android.Manifest.permission.ACCESS_TV_TUNER) public void shareFrontendFromTuner(@NonNull android.media.tv.tuner.Tuner);
     method @RequiresPermission(android.Manifest.permission.ACCESS_TV_TUNER) public int tune(@NonNull android.media.tv.tuner.frontend.FrontendSettings);
     method @RequiresPermission(android.Manifest.permission.ACCESS_TV_TUNER) public void updateResourcePriority(int, int);
@@ -7534,6 +7536,7 @@
     method public int getChannel();
     method public int getMaxNumberOfClients();
     method public int getShutdownTimeoutMillis();
+    method public boolean isAutoShutdownEnabled();
     method public boolean isClientControlByUserEnabled();
     method @Nullable public android.net.wifi.WifiConfiguration toWifiConfiguration();
     field public static final int BAND_2GHZ = 1; // 0x1
@@ -7547,14 +7550,15 @@
     ctor public SoftApConfiguration.Builder(@NonNull android.net.wifi.SoftApConfiguration);
     method @NonNull public android.net.wifi.SoftApConfiguration build();
     method @NonNull public android.net.wifi.SoftApConfiguration.Builder enableClientControlByUser(boolean);
+    method @NonNull public android.net.wifi.SoftApConfiguration.Builder setAutoShutdownEnabled(boolean);
     method @NonNull public android.net.wifi.SoftApConfiguration.Builder setBand(int);
     method @NonNull public android.net.wifi.SoftApConfiguration.Builder setBssid(@Nullable android.net.MacAddress);
     method @NonNull public android.net.wifi.SoftApConfiguration.Builder setChannel(int, int);
     method @NonNull public android.net.wifi.SoftApConfiguration.Builder setClientList(@NonNull java.util.List<android.net.MacAddress>, @NonNull java.util.List<android.net.MacAddress>);
     method @NonNull public android.net.wifi.SoftApConfiguration.Builder setHiddenSsid(boolean);
-    method @NonNull public android.net.wifi.SoftApConfiguration.Builder setMaxNumberOfClients(int);
+    method @NonNull public android.net.wifi.SoftApConfiguration.Builder setMaxNumberOfClients(@IntRange(from=0) int);
     method @NonNull public android.net.wifi.SoftApConfiguration.Builder setPassphrase(@Nullable String, int);
-    method @NonNull public android.net.wifi.SoftApConfiguration.Builder setShutdownTimeoutMillis(int);
+    method @NonNull public android.net.wifi.SoftApConfiguration.Builder setShutdownTimeoutMillis(@IntRange(from=0) int);
     method @NonNull public android.net.wifi.SoftApConfiguration.Builder setSsid(@Nullable String);
   }
 
@@ -7748,6 +7752,7 @@
     method @RequiresPermission(android.Manifest.permission.WIFI_SET_DEVICE_MOBILITY_STATE) public void setDeviceMobilityState(int);
     method @RequiresPermission(android.Manifest.permission.NETWORK_SETTINGS) public void setMacRandomizationSettingPasspointEnabled(@NonNull String, boolean);
     method @RequiresPermission(android.Manifest.permission.NETWORK_SETTINGS) public void setMeteredOverridePasspoint(@NonNull String, int);
+    method @RequiresPermission(android.Manifest.permission.NETWORK_SETTINGS) public void setScanAlwaysAvailable(boolean);
     method @RequiresPermission(android.Manifest.permission.NETWORK_SETTINGS) public void setScanThrottleEnabled(boolean);
     method @RequiresPermission(android.Manifest.permission.NETWORK_SETTINGS) public boolean setSoftApConfiguration(@NonNull android.net.wifi.SoftApConfiguration);
     method @RequiresPermission(android.Manifest.permission.NETWORK_SETTINGS) public void setVerboseLoggingEnabled(boolean);
@@ -7895,6 +7900,7 @@
 
   public final class WifiOemMigrationHook {
     method @Nullable public static android.net.wifi.WifiOemMigrationHook.ConfigStoreMigrationData loadFromConfigStore();
+    method @NonNull public static android.net.wifi.WifiOemMigrationHook.SettingsMigrationData loadFromSettings(@NonNull android.content.Context);
   }
 
   public static final class WifiOemMigrationHook.ConfigStoreMigrationData implements android.os.Parcelable {
@@ -7912,6 +7918,31 @@
     method @NonNull public android.net.wifi.WifiOemMigrationHook.ConfigStoreMigrationData.Builder setUserSoftApConfiguration(@NonNull android.net.wifi.SoftApConfiguration);
   }
 
+  public static final class WifiOemMigrationHook.SettingsMigrationData implements android.os.Parcelable {
+    method public int describeContents();
+    method @Nullable public String getP2pDeviceName();
+    method public boolean isP2pFactoryResetPending();
+    method public boolean isScanAlwaysAvailable();
+    method public boolean isScanThrottleEnabled();
+    method public boolean isSoftApTimeoutEnabled();
+    method public boolean isVerboseLoggingEnabled();
+    method public boolean isWakeUpEnabled();
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.net.wifi.WifiOemMigrationHook.SettingsMigrationData> CREATOR;
+  }
+
+  public static final class WifiOemMigrationHook.SettingsMigrationData.Builder {
+    ctor public WifiOemMigrationHook.SettingsMigrationData.Builder();
+    method @NonNull public android.net.wifi.WifiOemMigrationHook.SettingsMigrationData build();
+    method @NonNull public android.net.wifi.WifiOemMigrationHook.SettingsMigrationData.Builder setP2pDeviceName(@Nullable String);
+    method @NonNull public android.net.wifi.WifiOemMigrationHook.SettingsMigrationData.Builder setP2pFactoryResetPending(boolean);
+    method @NonNull public android.net.wifi.WifiOemMigrationHook.SettingsMigrationData.Builder setScanAlwaysAvailable(boolean);
+    method @NonNull public android.net.wifi.WifiOemMigrationHook.SettingsMigrationData.Builder setScanThrottleEnabled(boolean);
+    method @NonNull public android.net.wifi.WifiOemMigrationHook.SettingsMigrationData.Builder setSoftApTimeoutEnabled(boolean);
+    method @NonNull public android.net.wifi.WifiOemMigrationHook.SettingsMigrationData.Builder setVerboseLoggingEnabled(boolean);
+    method @NonNull public android.net.wifi.WifiOemMigrationHook.SettingsMigrationData.Builder setWakeUpEnabled(boolean);
+  }
+
   public class WifiScanner {
     method @Deprecated public void configureWifiChange(int, int, int, int, int, android.net.wifi.WifiScanner.BssidInfo[]);
     method @Deprecated public void configureWifiChange(android.net.wifi.WifiScanner.WifiChangeSettings);
@@ -9718,18 +9749,11 @@
     field public static final String INSTALL_CARRIER_APP_NOTIFICATION_SLEEP_MILLIS = "install_carrier_app_notification_sleep_millis";
     field public static final String OTA_DISABLE_AUTOMATIC_UPDATE = "ota_disable_automatic_update";
     field public static final String REQUIRE_PASSWORD_TO_DECRYPT = "require_password_to_decrypt";
-    field public static final String SOFT_AP_TIMEOUT_ENABLED = "soft_ap_timeout_enabled";
     field public static final String TETHER_OFFLOAD_DISABLED = "tether_offload_disabled";
     field public static final String TETHER_SUPPORTED = "tether_supported";
     field public static final String THEATER_MODE_ON = "theater_mode_on";
     field public static final String WEBVIEW_MULTIPROCESS = "webview_multiprocess";
     field public static final String WIFI_BADGING_THRESHOLDS = "wifi_badging_thresholds";
-    field public static final String WIFI_P2P_DEVICE_NAME = "wifi_p2p_device_name";
-    field public static final String WIFI_P2P_PENDING_FACTORY_RESET = "wifi_p2p_pending_factory_reset";
-    field public static final String WIFI_SCAN_ALWAYS_AVAILABLE = "wifi_scan_always_enabled";
-    field public static final String WIFI_SCAN_THROTTLE_ENABLED = "wifi_scan_throttle_enabled";
-    field public static final String WIFI_SCORE_PARAMS = "wifi_score_params";
-    field public static final String WIFI_VERBOSE_LOGGING_ENABLED = "wifi_verbose_logging_enabled";
     field @Deprecated public static final String WIFI_WAKEUP_ENABLED = "wifi_wakeup_enabled";
   }
 
@@ -9744,6 +9768,7 @@
     field public static final String AUTOFILL_USER_DATA_MAX_USER_DATA_SIZE = "autofill_user_data_max_user_data_size";
     field public static final String AUTOFILL_USER_DATA_MAX_VALUE_LENGTH = "autofill_user_data_max_value_length";
     field public static final String AUTOFILL_USER_DATA_MIN_VALUE_LENGTH = "autofill_user_data_min_value_length";
+    field public static final String AUTO_REVOKE_DISABLED = "auto_revoke_disabled";
     field public static final String CARRIER_APPS_HANDLED = "carrier_apps_handled";
     field public static final String COMPLETED_CATEGORY_PREFIX = "suggested.completed_category.";
     field public static final String DOZE_ALWAYS_ON = "doze_always_on";
diff --git a/api/test-current.txt b/api/test-current.txt
index 79d29f6..957794c 100644
--- a/api/test-current.txt
+++ b/api/test-current.txt
@@ -180,8 +180,8 @@
     method @RequiresPermission("android.permission.MANAGE_APPOPS") public void resetHistoryParameters();
     method @RequiresPermission("android.permission.MANAGE_APPOPS") public void setHistoryParameters(int, long, int);
     method @RequiresPermission("android.permission.MANAGE_APP_OPS_MODES") public void setMode(int, int, String, int);
-    method @RequiresPermission("android.permission.MANAGE_APP_OPS_MODES") public void setMode(String, int, String, int);
-    method @RequiresPermission("android.permission.MANAGE_APP_OPS_MODES") public void setUidMode(String, int, int);
+    method @RequiresPermission("android.permission.MANAGE_APP_OPS_MODES") public void setMode(@NonNull String, int, @Nullable String, int);
+    method @RequiresPermission("android.permission.MANAGE_APP_OPS_MODES") public void setUidMode(@NonNull String, int, int);
     method public static int strOpToOp(@NonNull String);
     field public static final int HISTORICAL_MODE_DISABLED = 0; // 0x0
     field public static final int HISTORICAL_MODE_ENABLED_ACTIVE = 1; // 0x1
diff --git a/cmds/idmap2/Android.bp b/cmds/idmap2/Android.bp
index 41a1706..66f5c39 100644
--- a/cmds/idmap2/Android.bp
+++ b/cmds/idmap2/Android.bp
@@ -146,6 +146,7 @@
     host_supported: true,
     srcs: [
         "idmap2/Create.cpp",
+        "idmap2/CreateMultiple.cpp",
         "idmap2/Dump.cpp",
         "idmap2/Lookup.cpp",
         "idmap2/Main.cpp",
diff --git a/cmds/idmap2/idmap2/Commands.h b/cmds/idmap2/idmap2/Commands.h
index 718e361..e626738 100644
--- a/cmds/idmap2/idmap2/Commands.h
+++ b/cmds/idmap2/idmap2/Commands.h
@@ -23,6 +23,7 @@
 #include "idmap2/Result.h"
 
 android::idmap2::Result<android::idmap2::Unit> Create(const std::vector<std::string>& args);
+android::idmap2::Result<android::idmap2::Unit> CreateMultiple(const std::vector<std::string>& args);
 android::idmap2::Result<android::idmap2::Unit> Dump(const std::vector<std::string>& args);
 android::idmap2::Result<android::idmap2::Unit> Lookup(const std::vector<std::string>& args);
 android::idmap2::Result<android::idmap2::Unit> Scan(const std::vector<std::string>& args);
diff --git a/cmds/idmap2/idmap2/CreateMultiple.cpp b/cmds/idmap2/idmap2/CreateMultiple.cpp
new file mode 100644
index 0000000..0b0541f
--- /dev/null
+++ b/cmds/idmap2/idmap2/CreateMultiple.cpp
@@ -0,0 +1,144 @@
+/*
+ * 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 <sys/stat.h>   // umask
+#include <sys/types.h>  // umask
+
+#include <fstream>
+#include <memory>
+#include <ostream>
+#include <sstream>
+#include <string>
+#include <vector>
+
+#include "android-base/stringprintf.h"
+#include "idmap2/BinaryStreamVisitor.h"
+#include "idmap2/CommandLineOptions.h"
+#include "idmap2/FileUtils.h"
+#include "idmap2/Idmap.h"
+#include "idmap2/Policies.h"
+#include "idmap2/SysTrace.h"
+
+using android::ApkAssets;
+using android::base::StringPrintf;
+using android::idmap2::BinaryStreamVisitor;
+using android::idmap2::CommandLineOptions;
+using android::idmap2::Error;
+using android::idmap2::Idmap;
+using android::idmap2::PoliciesToBitmask;
+using android::idmap2::PolicyBitmask;
+using android::idmap2::PolicyFlags;
+using android::idmap2::Result;
+using android::idmap2::Unit;
+using android::idmap2::utils::kIdmapCacheDir;
+using android::idmap2::utils::kIdmapFilePermissionMask;
+using android::idmap2::utils::UidHasWriteAccessToPath;
+
+Result<Unit> CreateMultiple(const std::vector<std::string>& args) {
+  SYSTRACE << "CreateMultiple " << args;
+  std::string target_apk_path;
+  std::string idmap_dir = kIdmapCacheDir;
+  std::vector<std::string> overlay_apk_paths;
+  std::vector<std::string> policies;
+  bool ignore_overlayable = false;
+
+  const CommandLineOptions opts =
+      CommandLineOptions("idmap2 create-multiple")
+          .MandatoryOption("--target-apk-path",
+                           "input: path to apk which will have its resources overlaid",
+                           &target_apk_path)
+          .MandatoryOption("--overlay-apk-path",
+                           "input: path to apk which contains the new resource values",
+                           &overlay_apk_paths)
+          .OptionalOption("--idmap-dir",
+                          StringPrintf("output: path to the directory in which to write idmap file"
+                                       " (defaults to %s)",
+                                       kIdmapCacheDir),
+                          &idmap_dir)
+          .OptionalOption("--policy",
+                          "input: an overlayable policy this overlay fulfills"
+                          " (if none or supplied, the overlay policy will default to \"public\")",
+                          &policies)
+          .OptionalFlag("--ignore-overlayable", "disables overlayable and policy checks",
+                        &ignore_overlayable);
+  const auto opts_ok = opts.Parse(args);
+  if (!opts_ok) {
+    return opts_ok.GetError();
+  }
+
+  PolicyBitmask fulfilled_policies = 0;
+  auto conv_result = PoliciesToBitmask(policies);
+  if (conv_result) {
+    fulfilled_policies |= *conv_result;
+  } else {
+    return conv_result.GetError();
+  }
+
+  if (fulfilled_policies == 0) {
+    fulfilled_policies |= PolicyFlags::POLICY_PUBLIC;
+  }
+
+  const std::unique_ptr<const ApkAssets> target_apk = ApkAssets::Load(target_apk_path);
+  if (!target_apk) {
+    return Error("failed to load apk %s", target_apk_path.c_str());
+  }
+
+  std::vector<std::string> idmap_paths;
+  for (const std::string& overlay_apk_path : overlay_apk_paths) {
+    const std::string idmap_path = Idmap::CanonicalIdmapPathFor(idmap_dir, overlay_apk_path);
+    const uid_t uid = getuid();
+    if (!UidHasWriteAccessToPath(uid, idmap_path)) {
+      LOG(WARNING) << "uid " << uid << "does not have write access to " << idmap_path.c_str();
+      continue;
+    }
+
+    const std::unique_ptr<const ApkAssets> overlay_apk = ApkAssets::Load(overlay_apk_path);
+    if (!overlay_apk) {
+      LOG(WARNING) << "failed to load apk " << overlay_apk_path.c_str();
+      continue;
+    }
+
+    const auto idmap =
+        Idmap::FromApkAssets(*target_apk, *overlay_apk, fulfilled_policies, !ignore_overlayable);
+    if (!idmap) {
+      LOG(WARNING) << "failed to create idmap";
+      continue;
+    }
+
+    umask(kIdmapFilePermissionMask);
+    std::ofstream fout(idmap_path);
+    if (fout.fail()) {
+      LOG(WARNING) << "failed to open idmap path " << idmap_path.c_str();
+      continue;
+    }
+
+    BinaryStreamVisitor visitor(fout);
+    (*idmap)->accept(&visitor);
+    fout.close();
+    if (fout.fail()) {
+      LOG(WARNING) << "failed to write to idmap path %s" << idmap_path.c_str();
+      continue;
+    }
+
+    idmap_paths.emplace_back(idmap_path);
+  }
+
+  for (const std::string& idmap_path : idmap_paths) {
+    std::cout << idmap_path << std::endl;
+  }
+
+  return Unit{};
+}
diff --git a/cmds/idmap2/idmap2/Main.cpp b/cmds/idmap2/idmap2/Main.cpp
index 8794908..a07e793 100644
--- a/cmds/idmap2/idmap2/Main.cpp
+++ b/cmds/idmap2/idmap2/Main.cpp
@@ -53,7 +53,9 @@
 int main(int argc, char** argv) {
   SYSTRACE << "main";
   const NameToFunctionMap commands = {
-      {"create", Create}, {"dump", Dump}, {"lookup", Lookup}, {"scan", Scan}, {"verify", Verify},
+      {"create", Create}, {"create-multiple", CreateMultiple},
+      {"dump", Dump},     {"lookup", Lookup},
+      {"scan", Scan},     {"verify", Verify},
   };
   if (argc <= 1) {
     PrintUsage(commands, std::cerr);
diff --git a/cmds/statsd/Android.bp b/cmds/statsd/Android.bp
index 2ee055d..93522d4 100644
--- a/cmds/statsd/Android.bp
+++ b/cmds/statsd/Android.bp
@@ -105,10 +105,6 @@
         "src/uid_data.proto",
     ],
 
-    cflags: [
-        "-DNEW_ENCODING_SCHEME",
-    ],
-
     local_include_dirs: [
         "src",
     ],
@@ -173,6 +169,11 @@
         "libcutils",
         "libstatslog",
     ],
+    apex_available: [
+        //TODO(b/149782403): Remove this once statsd no longer links against libstatsmetadata
+        "com.android.os.statsd",
+        "test_com.android.os.statsd",
+    ],
 }
 
 
@@ -316,55 +317,55 @@
 // statsd micro benchmark
 //#############################
 
-cc_benchmark {
-    name: "statsd_benchmark",
-    defaults: ["statsd_defaults"],
-
-    srcs: [
-        // atom_field_options.proto needs field_options.proto, but that is
-        // not included in libprotobuf-cpp-lite, so compile it here.
-        ":libprotobuf-internal-protos",
-
-        "benchmark/duration_metric_benchmark.cpp",
-        "benchmark/filter_value_benchmark.cpp",
-        "benchmark/get_dimensions_for_condition_benchmark.cpp",
-        "benchmark/hello_world_benchmark.cpp",
-        "benchmark/log_event_benchmark.cpp",
-        "benchmark/main.cpp",
-        "benchmark/metric_util.cpp",
-        "benchmark/stats_write_benchmark.cpp",
-        "src/atom_field_options.proto",
-        "src/atoms.proto",
-        "src/stats_log.proto",
-    ],
-
-    proto: {
-        type: "lite",
-        include_dirs: ["external/protobuf/src"],
-    },
-
-    cflags: [
-        "-Wall",
-        "-Werror",
-        "-Wno-unused-parameter",
-        "-Wno-unused-variable",
-        "-Wno-unused-function",
-
-        // Bug: http://b/29823425 Disable -Wvarargs for Clang update to r271374
-        "-Wno-varargs",
-    ],
-
-    static_libs: [
-        "libplatformprotos",
-    ],
-
-    shared_libs: [
-        "libgtest_prod",
-        "libprotobuf-cpp-lite",
-        "libstatslog",
-        "libstatssocket",
-    ],
-}
+//cc_benchmark {
+//    name: "statsd_benchmark",
+//    defaults: ["statsd_defaults"],
+//
+//    srcs: [
+//        // atom_field_options.proto needs field_options.proto, but that is
+//        // not included in libprotobuf-cpp-lite, so compile it here.
+//        ":libprotobuf-internal-protos",
+//
+//        "benchmark/duration_metric_benchmark.cpp",
+//        "benchmark/filter_value_benchmark.cpp",
+//        "benchmark/get_dimensions_for_condition_benchmark.cpp",
+//        "benchmark/hello_world_benchmark.cpp",
+//        "benchmark/log_event_benchmark.cpp",
+//        "benchmark/main.cpp",
+//        "benchmark/metric_util.cpp",
+//        "benchmark/stats_write_benchmark.cpp",
+//        "src/atom_field_options.proto",
+//        "src/atoms.proto",
+//        "src/stats_log.proto",
+//    ],
+//
+//    proto: {
+//        type: "lite",
+//        include_dirs: ["external/protobuf/src"],
+//    },
+//
+//    cflags: [
+//        "-Wall",
+//        "-Werror",
+//        "-Wno-unused-parameter",
+//        "-Wno-unused-variable",
+//        "-Wno-unused-function",
+//
+//        // Bug: http://b/29823425 Disable -Wvarargs for Clang update to r271374
+//        "-Wno-varargs",
+//    ],
+//
+//    static_libs: [
+//        "libplatformprotos",
+//    ],
+//
+//    shared_libs: [
+//        "libgtest_prod",
+//        "libprotobuf-cpp-lite",
+//        "libstatslog",
+//        "libstatssocket",
+//    ],
+//}
 
 // ====  java proto device library (for test only)  ==============================
 java_library {
diff --git a/cmds/statsd/src/StatsLogProcessor.cpp b/cmds/statsd/src/StatsLogProcessor.cpp
index 97e0a2e..649c004 100644
--- a/cmds/statsd/src/StatsLogProcessor.cpp
+++ b/cmds/statsd/src/StatsLogProcessor.cpp
@@ -208,12 +208,8 @@
     trainInfo.requiresLowLatencyMonitor =
             event->GetBool(5 /*requires low latency monitor field id*/, &err);
     trainInfo.status = int32_t(event->GetLong(6 /*state field id*/, &err));
-#ifdef NEW_ENCODING_SCHEME
     std::vector<uint8_t> trainExperimentIdBytes =
             event->GetStorage(7 /*experiment ids field id*/, &err);
-#else
-    string trainExperimentIdString = event->GetString(7 /*experiment ids field id*/, &err);
-#endif
     bool is_rollback = event->GetBool(10 /*is rollback field id*/, &err);
 
     if (err != NO_ERROR) {
@@ -221,12 +217,8 @@
         return;
     }
     ExperimentIds trainExperimentIds;
-#ifdef NEW_ENCODING_SCHEME
     if (!trainExperimentIds.ParseFromArray(trainExperimentIdBytes.data(),
                                            trainExperimentIdBytes.size())) {
-#else
-    if (!trainExperimentIds.ParseFromString(trainExperimentIdString)) {
-#endif
         ALOGE("Failed to parse experimentids in binary push state changed.");
         return;
     }
@@ -241,11 +233,7 @@
     int32_t userId = multiuser_get_user_id(uid);
 
     event->updateValue(2 /*train version field id*/, trainInfo.trainVersionCode, LONG);
-#ifdef NEW_ENCODING_SCHEME
     event->updateValue(7 /*experiment ids field id*/, trainExperimentIdProto, STORAGE);
-#else
-    event->updateValue(7 /*experiment ids field id*/, trainExperimentIdProto, STRING);
-#endif
     event->updateValue(8 /*user id field id*/, userId, INT);
 
     // If this event is a rollback event, then the following bits in the event
@@ -352,11 +340,7 @@
     vector<uint8_t> experimentIdProto;
     writeExperimentIdsToProto(experimentIds, &experimentIdProto);
 
-#ifdef NEW_ENCODING_SCHEME
     event->updateValue(6 /*experiment ids field id*/, experimentIdProto, STORAGE);
-#else
-    event->updateValue(6 /*experiment ids field id*/, experimentIdProto, STRING);
-#endif
 }
 
 vector<int64_t> StatsLogProcessor::processWatchdogRollbackOccurred(const int32_t rollbackTypeIn,
diff --git a/cmds/statsd/src/atoms.proto b/cmds/statsd/src/atoms.proto
index 27c4f4e..a4e8fdc 100644
--- a/cmds/statsd/src/atoms.proto
+++ b/cmds/statsd/src/atoms.proto
@@ -678,17 +678,32 @@
  *   frameworks/opt/net/wifi/service/java/com/android/server/wifi/WifiDataStall.java
  */
 message WifiHealthStatReported {
+    enum Band {
+        UNKNOWN = 0;
+        // All of 2.4GHz band
+        BAND_2G = 1;
+        // Frequencies in the range of [5150, 5250) GHz
+        BAND_5G_LOW = 2;
+        // Frequencies in the range of [5250, 5725) GHz
+        BAND_5G_MIDDLE = 3;
+        // Frequencies in the range of [5725, 5850) GHz
+        BAND_5G_HIGH = 4;
+        // Frequencies in the range of [5925, 6425) GHz
+        BAND_6G_LOW = 5;
+        // Frequencies in the range of [6425, 6875) GHz
+        BAND_6G_MIDDLE = 6;
+        // Frequencies in the range of [6875, 7125) GHz
+        BAND_6G_HIGH = 7;
+    }
     // duration this stat is obtained over in milliseconds
     optional int32 duration_millis = 1;
     // whether wifi is classified as sufficient for the user's data traffic, determined
     // by whether the calculated throughput exceeds the average demand within |duration_millis|
     optional bool is_sufficient = 2;
-    // whether the calculated throughput is exceeds the minimum required for typical usage
-    optional bool is_throughput_good = 3;
     // whether cellular data is available
-    optional bool is_cell_data_available = 4;
-    // the WLAN channel the connected network is on (ie. 2412)
-    optional int32 frequency = 5;
+    optional bool is_cell_data_available = 3;
+    // the Band bucket the connected network is on
+    optional Band band = 4;
 }
 
 /**
@@ -8216,14 +8231,6 @@
 }
 
 /**
- * HWUI renders pipeline type: GL (0) or Vulkan (1).
- */
-enum PipelineType {
-    GL = 0;
-    VULKAN = 1;
-}
-
-/**
  * HWUI stats for a given app.
  */
 message GraphicsStats {
@@ -8236,9 +8243,16 @@
     // The start & end timestamps in UTC as
     // milliseconds since January 1, 1970
     // Compatible with java.util.Date#setTime()
-    optional int64 stats_start = 3;
+    optional int64 start_millis = 3;
 
-    optional int64 stats_end = 4;
+    optional int64 end_millis = 4;
+
+    // HWUI renders pipeline type: GL (1) or Vulkan (2).
+    enum PipelineType {
+        UNKNOWN = 0;
+        GL = 1;
+        VULKAN = 2;
+    }
 
     // HWUI renders pipeline type: GL or Vulkan.
     optional PipelineType pipeline = 5;
diff --git a/cmds/statsd/src/external/StatsCallbackPuller.cpp b/cmds/statsd/src/external/StatsCallbackPuller.cpp
index b6c8e34..0edf40b 100644
--- a/cmds/statsd/src/external/StatsCallbackPuller.cpp
+++ b/cmds/statsd/src/external/StatsCallbackPuller.cpp
@@ -69,8 +69,7 @@
                         uint8_t* buf = reinterpret_cast<uint8_t*>(
                                 const_cast<int8_t*>(parcel.buffer.data()));
                         shared_ptr<LogEvent> event = make_shared<LogEvent>(
-                                buf, parcel.buffer.size(), /*uid=*/-1, /*pid=*/-1,
-                                /*useNewSchema=*/true);
+                                buf, parcel.buffer.size(), /*uid=*/-1, /*pid=*/-1);
                         sharedData->push_back(event);
                     }
                     *pullSuccess = success;
diff --git a/cmds/statsd/src/logd/LogEvent.cpp b/cmds/statsd/src/logd/LogEvent.cpp
index 9c50846..3e46d13 100644
--- a/cmds/statsd/src/logd/LogEvent.cpp
+++ b/cmds/statsd/src/logd/LogEvent.cpp
@@ -74,29 +74,7 @@
       mLogUid(uid),
       mLogPid(pid)
 {
-#ifdef NEW_ENCODING_SCHEME
     initNew();
-# else
-    mContext = create_android_log_parser((char*)msg, len);
-    init(mContext);
-    if (mContext) android_log_destroy(&mContext); // set mContext to NULL
-#endif
-}
-
-LogEvent::LogEvent(uint8_t* msg, uint32_t len, int32_t uid, int32_t pid, bool useNewSchema)
-    : mBuf(msg),
-      mRemainingLen(len),
-      mLogdTimestampNs(time(nullptr)),
-      mLogUid(uid),
-      mLogPid(pid)
-{
-    if (useNewSchema) {
-        initNew();
-    } else {
-        mContext = create_android_log_parser((char*)msg, len);
-        init(mContext);
-        if (mContext) android_log_destroy(&mContext);  // set mContext to NULL
-    }
 }
 
 LogEvent::LogEvent(const LogEvent& event) {
@@ -225,22 +203,6 @@
     }
 }
 
-void LogEvent::init() {
-    if (mContext) {
-        const char* buffer;
-        size_t len = android_log_write_list_buffer(mContext, &buffer);
-        // turns to reader mode
-        android_log_context contextForRead = create_android_log_parser(buffer, len);
-        if (contextForRead) {
-            init(contextForRead);
-            // destroy the context to save memory.
-            // android_log_destroy will set mContext to NULL
-            android_log_destroy(&contextForRead);
-        }
-        android_log_destroy(&mContext);
-    }
-}
-
 LogEvent::~LogEvent() {
     if (mContext) {
         // This is for the case when LogEvent is created using the test interface
@@ -577,132 +539,6 @@
     return (typeInfo >> 4) & 0x0F;
 }
 
-/**
- * The elements of each log event are stored as a vector of android_log_list_elements.
- * The goal is to do as little preprocessing as possible, because we read a tiny fraction
- * of the elements that are written to the log.
- *
- * The idea here is to read through the log items once, we get as much information we need for
- * matching as possible. Because this log will be matched against lots of matchers.
- */
-void LogEvent::init(android_log_context context) {
-    android_log_list_element elem;
-    int i = 0;
-    int depth = -1;
-    int pos[] = {1, 1, 1};
-    bool isKeyValuePairAtom = false;
-    do {
-        elem = android_log_read_next(context);
-        switch ((int)elem.type) {
-            case EVENT_TYPE_INT:
-                // elem at [0] is EVENT_TYPE_LIST, [1] is the timestamp, [2] is tag id.
-                if (i == 2) {
-                    mTagId = elem.data.int32;
-                    isKeyValuePairAtom = (mTagId == android::util::KEY_VALUE_PAIRS_ATOM);
-                } else {
-                    if (depth < 0 || depth > 2) {
-                        return;
-                    }
-
-                    mValues.push_back(
-                            FieldValue(Field(mTagId, pos, depth), Value((int32_t)elem.data.int32)));
-
-                    pos[depth]++;
-                }
-                break;
-            case EVENT_TYPE_FLOAT: {
-                if (depth < 0 || depth > 2) {
-                    ALOGE("Depth > 2. Not supported!");
-                    return;
-                }
-
-                // Handles the oneof field in KeyValuePair atom.
-                if (isKeyValuePairAtom && depth == 2) {
-                    pos[depth] = 5;
-                }
-
-                mValues.push_back(FieldValue(Field(mTagId, pos, depth), Value(elem.data.float32)));
-
-                pos[depth]++;
-
-            } break;
-            case EVENT_TYPE_STRING: {
-                if (depth < 0 || depth > 2) {
-                    ALOGE("Depth > 2. Not supported!");
-                    return;
-                }
-
-                // Handles the oneof field in KeyValuePair atom.
-                if (isKeyValuePairAtom && depth == 2) {
-                    pos[depth] = 4;
-                }
-                mValues.push_back(FieldValue(Field(mTagId, pos, depth),
-                                             Value(string(elem.data.string, elem.len))));
-
-                pos[depth]++;
-
-            } break;
-            case EVENT_TYPE_LONG: {
-                if (i == 1) {
-                    mElapsedTimestampNs = elem.data.int64;
-                } else {
-                    if (depth < 0 || depth > 2) {
-                        ALOGE("Depth > 2. Not supported!");
-                        return;
-                    }
-                    // Handles the oneof field in KeyValuePair atom.
-                    if (isKeyValuePairAtom && depth == 2) {
-                        pos[depth] = 3;
-                    }
-                    mValues.push_back(
-                            FieldValue(Field(mTagId, pos, depth), Value((int64_t)elem.data.int64)));
-
-                    pos[depth]++;
-                }
-            } break;
-            case EVENT_TYPE_LIST:
-                depth++;
-                if (depth > 2) {
-                    ALOGE("Depth > 2. Not supported!");
-                    return;
-                }
-                pos[depth] = 1;
-
-                break;
-            case EVENT_TYPE_LIST_STOP: {
-                int prevDepth = depth;
-                depth--;
-                if (depth >= 0 && depth < 2) {
-                    // Now go back to decorate the previous items that are last at prevDepth.
-                    // So that we can later easily match them with Position=Last matchers.
-                    pos[prevDepth]--;
-                    int path = getEncodedField(pos, prevDepth, false);
-                    for (auto it = mValues.rbegin(); it != mValues.rend(); ++it) {
-                        if (it->mField.getDepth() >= prevDepth &&
-                            it->mField.getPath(prevDepth) == path) {
-                            it->mField.decorateLastPos(prevDepth);
-                        } else {
-                            // Safe to break, because the items are in DFS order.
-                            break;
-                        }
-                    }
-                    pos[depth]++;
-                }
-                break;
-            }
-            case EVENT_TYPE_UNKNOWN:
-                break;
-            default:
-                break;
-        }
-        i++;
-    } while ((elem.type != EVENT_TYPE_UNKNOWN) && !elem.complete);
-    if (isKeyValuePairAtom && mValues.size() > 0) {
-        mValues[0] = FieldValue(Field(android::util::KEY_VALUE_PAIRS_ATOM, getSimpleField(1)),
-                                Value((int32_t)mLogUid));
-    }
-}
-
 int64_t LogEvent::GetLong(size_t key, status_t* err) const {
     // TODO(b/110561208): encapsulate the magical operations in Field struct as static functions
     int field = getSimpleField(key);
diff --git a/cmds/statsd/src/logd/LogEvent.h b/cmds/statsd/src/logd/LogEvent.h
index ea449b0..e167e67 100644
--- a/cmds/statsd/src/logd/LogEvent.h
+++ b/cmds/statsd/src/logd/LogEvent.h
@@ -71,11 +71,6 @@
     explicit LogEvent(uint8_t* msg, uint32_t len, int32_t uid, int32_t pid);
 
     /**
-     * Temp constructor to use for pulled atoms until we flip the socket schema.
-     */
-    explicit LogEvent(uint8_t* msg, uint32_t len, int32_t uid, int32_t pid, bool useNewSchema);
-
-    /**
      * Constructs a LogEvent with synthetic data for testing. Must call init() before reading.
      */
     explicit LogEvent(int32_t tagId, int64_t wallClockTimestampNs, int64_t elapsedTimestampNs);
@@ -172,12 +167,6 @@
     void ToProto(android::util::ProtoOutputStream& out) const;
 
     /**
-     * Used with the constructor where tag is passed in. Converts the log_event_list to read mode
-     * and prepares the list for reading.
-     */
-    void init();
-
-    /**
      * Set elapsed timestamp if the original timestamp is missing.
      */
     void setElapsedTimestampNs(int64_t timestampNs) {
@@ -304,11 +293,6 @@
     uint8_t getTypeId(uint8_t typeInfo);
     uint8_t getNumAnnotations(uint8_t typeInfo);
 
-    /**
-     * Parses a log_msg into a LogEvent object.
-     */
-    void init(android_log_context context);
-
     // The items are naturally sorted in DFS order as we read them. this allows us to do fast
     // matching.
     std::vector<FieldValue> mValues;
diff --git a/cmds/statsd/tests/FieldValue_test.cpp b/cmds/statsd/tests/FieldValue_test.cpp
index 9e69d97..a5ff067 100644
--- a/cmds/statsd/tests/FieldValue_test.cpp
+++ b/cmds/statsd/tests/FieldValue_test.cpp
@@ -72,65 +72,66 @@
     EXPECT_EQ((int32_t)0xff7f7f7f, matcher12.mMask);
 }
 
-TEST(AtomMatcherTest, TestFilter_ALL) {
-    FieldMatcher matcher1;
-    matcher1.set_field(10);
-    FieldMatcher* child = matcher1.add_child();
-    child->set_field(1);
-    child->set_position(Position::ALL);
-
-    child->add_child()->set_field(1);
-    child->add_child()->set_field(2);
-
-    child = matcher1.add_child();
-    child->set_field(2);
-
-    vector<Matcher> matchers;
-    translateFieldMatcher(matcher1, &matchers);
-
-    AttributionNodeInternal attribution_node1;
-    attribution_node1.set_uid(1111);
-    attribution_node1.set_tag("location1");
-
-    AttributionNodeInternal attribution_node2;
-    attribution_node2.set_uid(2222);
-    attribution_node2.set_tag("location2");
-
-    AttributionNodeInternal attribution_node3;
-    attribution_node3.set_uid(3333);
-    attribution_node3.set_tag("location3");
-    std::vector<AttributionNodeInternal> attribution_nodes = {attribution_node1, attribution_node2,
-                                                              attribution_node3};
-
-    // Set up the event
-    LogEvent event(10, 12345);
-    event.write(attribution_nodes);
-    event.write("some value");
-    // Convert to a LogEvent
-    event.init();
-    HashableDimensionKey output;
-
-    filterValues(matchers, event.getValues(), &output);
-
-    EXPECT_EQ((size_t)7, output.getValues().size());
-    EXPECT_EQ((int32_t)0x02010101, output.getValues()[0].mField.getField());
-    EXPECT_EQ((int32_t)1111, output.getValues()[0].mValue.int_value);
-    EXPECT_EQ((int32_t)0x02010102, output.getValues()[1].mField.getField());
-    EXPECT_EQ("location1", output.getValues()[1].mValue.str_value);
-
-    EXPECT_EQ((int32_t)0x02010201, output.getValues()[2].mField.getField());
-    EXPECT_EQ((int32_t)2222, output.getValues()[2].mValue.int_value);
-    EXPECT_EQ((int32_t)0x02010202, output.getValues()[3].mField.getField());
-    EXPECT_EQ("location2", output.getValues()[3].mValue.str_value);
-
-    EXPECT_EQ((int32_t)0x02010301, output.getValues()[4].mField.getField());
-    EXPECT_EQ((int32_t)3333, output.getValues()[4].mValue.int_value);
-    EXPECT_EQ((int32_t)0x02010302, output.getValues()[5].mField.getField());
-    EXPECT_EQ("location3", output.getValues()[5].mValue.str_value);
-
-    EXPECT_EQ((int32_t)0x00020000, output.getValues()[6].mField.getField());
-    EXPECT_EQ("some value", output.getValues()[6].mValue.str_value);
-}
+// TODO(b/149590301): Update this test to use new socket schema.
+//TEST(AtomMatcherTest, TestFilter_ALL) {
+//    FieldMatcher matcher1;
+//    matcher1.set_field(10);
+//    FieldMatcher* child = matcher1.add_child();
+//    child->set_field(1);
+//    child->set_position(Position::ALL);
+//
+//    child->add_child()->set_field(1);
+//    child->add_child()->set_field(2);
+//
+//    child = matcher1.add_child();
+//    child->set_field(2);
+//
+//    vector<Matcher> matchers;
+//    translateFieldMatcher(matcher1, &matchers);
+//
+//    AttributionNodeInternal attribution_node1;
+//    attribution_node1.set_uid(1111);
+//    attribution_node1.set_tag("location1");
+//
+//    AttributionNodeInternal attribution_node2;
+//    attribution_node2.set_uid(2222);
+//    attribution_node2.set_tag("location2");
+//
+//    AttributionNodeInternal attribution_node3;
+//    attribution_node3.set_uid(3333);
+//    attribution_node3.set_tag("location3");
+//    std::vector<AttributionNodeInternal> attribution_nodes = {attribution_node1, attribution_node2,
+//                                                              attribution_node3};
+//
+//    // Set up the event
+//    LogEvent event(10, 12345);
+//    event.write(attribution_nodes);
+//    event.write("some value");
+//    // Convert to a LogEvent
+//    event.init();
+//    HashableDimensionKey output;
+//
+//    filterValues(matchers, event.getValues(), &output);
+//
+//    EXPECT_EQ((size_t)7, output.getValues().size());
+//    EXPECT_EQ((int32_t)0x02010101, output.getValues()[0].mField.getField());
+//    EXPECT_EQ((int32_t)1111, output.getValues()[0].mValue.int_value);
+//    EXPECT_EQ((int32_t)0x02010102, output.getValues()[1].mField.getField());
+//    EXPECT_EQ("location1", output.getValues()[1].mValue.str_value);
+//
+//    EXPECT_EQ((int32_t)0x02010201, output.getValues()[2].mField.getField());
+//    EXPECT_EQ((int32_t)2222, output.getValues()[2].mValue.int_value);
+//    EXPECT_EQ((int32_t)0x02010202, output.getValues()[3].mField.getField());
+//    EXPECT_EQ("location2", output.getValues()[3].mValue.str_value);
+//
+//    EXPECT_EQ((int32_t)0x02010301, output.getValues()[4].mField.getField());
+//    EXPECT_EQ((int32_t)3333, output.getValues()[4].mValue.int_value);
+//    EXPECT_EQ((int32_t)0x02010302, output.getValues()[5].mField.getField());
+//    EXPECT_EQ("location3", output.getValues()[5].mValue.str_value);
+//
+//    EXPECT_EQ((int32_t)0x00020000, output.getValues()[6].mField.getField());
+//    EXPECT_EQ("some value", output.getValues()[6].mValue.str_value);
+//}
 
 TEST(AtomMatcherTest, TestSubDimension) {
     HashableDimensionKey dim;
@@ -173,60 +174,61 @@
     EXPECT_TRUE(dim.contains(subDim4));
 }
 
-TEST(AtomMatcherTest, TestMetric2ConditionLink) {
-    AttributionNodeInternal attribution_node1;
-    attribution_node1.set_uid(1111);
-    attribution_node1.set_tag("location1");
-
-    AttributionNodeInternal attribution_node2;
-    attribution_node2.set_uid(2222);
-    attribution_node2.set_tag("location2");
-
-    AttributionNodeInternal attribution_node3;
-    attribution_node3.set_uid(3333);
-    attribution_node3.set_tag("location3");
-    std::vector<AttributionNodeInternal> attribution_nodes = {attribution_node1, attribution_node2,
-                                                              attribution_node3};
-
-    // Set up the event
-    LogEvent event(10, 12345);
-    event.write(attribution_nodes);
-    event.write("some value");
-    // Convert to a LogEvent
-    event.init();
-
-    FieldMatcher whatMatcher;
-    whatMatcher.set_field(10);
-    FieldMatcher* child11 = whatMatcher.add_child();
-    child11->set_field(1);
-    child11->set_position(Position::ANY);
-    child11 = child11->add_child();
-    child11->set_field(1);
-
-    FieldMatcher conditionMatcher;
-    conditionMatcher.set_field(27);
-    FieldMatcher* child2 = conditionMatcher.add_child();
-    child2->set_field(2);
-    child2->set_position(Position::LAST);
-
-    child2 = child2->add_child();
-    child2->set_field(2);
-
-    Metric2Condition link;
-
-    translateFieldMatcher(whatMatcher, &link.metricFields);
-    translateFieldMatcher(conditionMatcher, &link.conditionFields);
-
-    EXPECT_EQ((size_t)1, link.metricFields.size());
-    EXPECT_EQ((int32_t)0x02010001, link.metricFields[0].mMatcher.getField());
-    EXPECT_EQ((int32_t)0xff7f007f, link.metricFields[0].mMask);
-    EXPECT_EQ((int32_t)10, link.metricFields[0].mMatcher.getTag());
-
-    EXPECT_EQ((size_t)1, link.conditionFields.size());
-    EXPECT_EQ((int32_t)0x02028002, link.conditionFields[0].mMatcher.getField());
-    EXPECT_EQ((int32_t)0xff7f807f, link.conditionFields[0].mMask);
-    EXPECT_EQ((int32_t)27, link.conditionFields[0].mMatcher.getTag());
-}
+// TODO(b/149590301): Update this test to use new socket schema.
+//TEST(AtomMatcherTest, TestMetric2ConditionLink) {
+//    AttributionNodeInternal attribution_node1;
+//    attribution_node1.set_uid(1111);
+//    attribution_node1.set_tag("location1");
+//
+//    AttributionNodeInternal attribution_node2;
+//    attribution_node2.set_uid(2222);
+//    attribution_node2.set_tag("location2");
+//
+//    AttributionNodeInternal attribution_node3;
+//    attribution_node3.set_uid(3333);
+//    attribution_node3.set_tag("location3");
+//    std::vector<AttributionNodeInternal> attribution_nodes = {attribution_node1, attribution_node2,
+//                                                              attribution_node3};
+//
+//    // Set up the event
+//    LogEvent event(10, 12345);
+//    event.write(attribution_nodes);
+//    event.write("some value");
+//    // Convert to a LogEvent
+//    event.init();
+//
+//    FieldMatcher whatMatcher;
+//    whatMatcher.set_field(10);
+//    FieldMatcher* child11 = whatMatcher.add_child();
+//    child11->set_field(1);
+//    child11->set_position(Position::ANY);
+//    child11 = child11->add_child();
+//    child11->set_field(1);
+//
+//    FieldMatcher conditionMatcher;
+//    conditionMatcher.set_field(27);
+//    FieldMatcher* child2 = conditionMatcher.add_child();
+//    child2->set_field(2);
+//    child2->set_position(Position::LAST);
+//
+//    child2 = child2->add_child();
+//    child2->set_field(2);
+//
+//    Metric2Condition link;
+//
+//    translateFieldMatcher(whatMatcher, &link.metricFields);
+//    translateFieldMatcher(conditionMatcher, &link.conditionFields);
+//
+//    EXPECT_EQ((size_t)1, link.metricFields.size());
+//    EXPECT_EQ((int32_t)0x02010001, link.metricFields[0].mMatcher.getField());
+//    EXPECT_EQ((int32_t)0xff7f007f, link.metricFields[0].mMask);
+//    EXPECT_EQ((int32_t)10, link.metricFields[0].mMatcher.getTag());
+//
+//    EXPECT_EQ((size_t)1, link.conditionFields.size());
+//    EXPECT_EQ((int32_t)0x02028002, link.conditionFields[0].mMatcher.getField());
+//    EXPECT_EQ((int32_t)0xff7f807f, link.conditionFields[0].mMask);
+//    EXPECT_EQ((int32_t)27, link.conditionFields[0].mMatcher.getTag());
+//}
 
 TEST(AtomMatcherTest, TestWriteDimensionPath) {
     for (auto position : {Position::ANY, Position::ALL, Position::FIRST, Position::LAST}) {
@@ -437,49 +439,50 @@
     EXPECT_EQ(99999, dim4.value_long());
 }
 
-TEST(AtomMatcherTest, TestWriteAtomToProto) {
-    AttributionNodeInternal attribution_node1;
-    attribution_node1.set_uid(1111);
-    attribution_node1.set_tag("location1");
-
-    AttributionNodeInternal attribution_node2;
-    attribution_node2.set_uid(2222);
-    attribution_node2.set_tag("location2");
-
-    std::vector<AttributionNodeInternal> attribution_nodes = {attribution_node1, attribution_node2};
-
-    // Set up the event
-    LogEvent event(4, 12345);
-    event.write(attribution_nodes);
-    event.write((int32_t)999);
-    // Convert to a LogEvent
-    event.init();
-
-    android::util::ProtoOutputStream protoOutput;
-    writeFieldValueTreeToStream(event.GetTagId(), event.getValues(), &protoOutput);
-
-    vector<uint8_t> outData;
-    outData.resize(protoOutput.size());
-    size_t pos = 0;
-    sp<ProtoReader> reader = protoOutput.data();
-    while (reader->readBuffer() != NULL) {
-        size_t toRead = reader->currentToRead();
-        std::memcpy(&(outData[pos]), reader->readBuffer(), toRead);
-        pos += toRead;
-        reader->move(toRead);
-    }
-
-    Atom result;
-    EXPECT_EQ(true, result.ParseFromArray(&outData[0], outData.size()));
-    EXPECT_EQ(Atom::PushedCase::kBleScanResultReceived, result.pushed_case());
-    const auto& atom = result.ble_scan_result_received();
-    EXPECT_EQ(2, atom.attribution_node_size());
-    EXPECT_EQ(1111, atom.attribution_node(0).uid());
-    EXPECT_EQ("location1", atom.attribution_node(0).tag());
-    EXPECT_EQ(2222, atom.attribution_node(1).uid());
-    EXPECT_EQ("location2", atom.attribution_node(1).tag());
-    EXPECT_EQ(999, atom.num_results());
-}
+// TODO(b/149590301): Update this test to use new socket schema.
+//TEST(AtomMatcherTest, TestWriteAtomToProto) {
+//    AttributionNodeInternal attribution_node1;
+//    attribution_node1.set_uid(1111);
+//    attribution_node1.set_tag("location1");
+//
+//    AttributionNodeInternal attribution_node2;
+//    attribution_node2.set_uid(2222);
+//    attribution_node2.set_tag("location2");
+//
+//    std::vector<AttributionNodeInternal> attribution_nodes = {attribution_node1, attribution_node2};
+//
+//    // Set up the event
+//    LogEvent event(4, 12345);
+//    event.write(attribution_nodes);
+//    event.write((int32_t)999);
+//    // Convert to a LogEvent
+//    event.init();
+//
+//    android::util::ProtoOutputStream protoOutput;
+//    writeFieldValueTreeToStream(event.GetTagId(), event.getValues(), &protoOutput);
+//
+//    vector<uint8_t> outData;
+//    outData.resize(protoOutput.size());
+//    size_t pos = 0;
+//    sp<ProtoReader> reader = protoOutput.data();
+//    while (reader->readBuffer() != NULL) {
+//        size_t toRead = reader->currentToRead();
+//        std::memcpy(&(outData[pos]), reader->readBuffer(), toRead);
+//        pos += toRead;
+//        reader->move(toRead);
+//    }
+//
+//    Atom result;
+//    EXPECT_EQ(true, result.ParseFromArray(&outData[0], outData.size()));
+//    EXPECT_EQ(Atom::PushedCase::kBleScanResultReceived, result.pushed_case());
+//    const auto& atom = result.ble_scan_result_received();
+//    EXPECT_EQ(2, atom.attribution_node_size());
+//    EXPECT_EQ(1111, atom.attribution_node(0).uid());
+//    EXPECT_EQ("location1", atom.attribution_node(0).tag());
+//    EXPECT_EQ(2222, atom.attribution_node(1).uid());
+//    EXPECT_EQ("location2", atom.attribution_node(1).tag());
+//    EXPECT_EQ(999, atom.num_results());
+//}
 
 /*
  * Test two Matchers is not a subset of one Matcher.
diff --git a/cmds/statsd/tests/LogEntryMatcher_test.cpp b/cmds/statsd/tests/LogEntryMatcher_test.cpp
index 441d3c8..2de6377 100644
--- a/cmds/statsd/tests/LogEntryMatcher_test.cpp
+++ b/cmds/statsd/tests/LogEntryMatcher_test.cpp
@@ -39,645 +39,646 @@
 
 
 #ifdef __ANDROID__
-TEST(AtomMatcherTest, TestSimpleMatcher) {
-    UidMap uidMap;
-
-    // Set up the matcher
-    AtomMatcher matcher;
-    auto simpleMatcher = matcher.mutable_simple_atom_matcher();
-    simpleMatcher->set_atom_id(TAG_ID);
-
-    LogEvent event(TAG_ID, 0);
-    EXPECT_TRUE(event.write(11));
-    event.init();
-
-    // Test
-    EXPECT_TRUE(matchesSimple(uidMap, *simpleMatcher, event));
-
-    // Wrong tag id.
-    simpleMatcher->set_atom_id(TAG_ID + 1);
-    EXPECT_FALSE(matchesSimple(uidMap, *simpleMatcher, event));
-}
-
-TEST(AtomMatcherTest, TestAttributionMatcher) {
-    UidMap uidMap;
-    AttributionNodeInternal attribution_node1;
-    attribution_node1.set_uid(1111);
-    attribution_node1.set_tag("location1");
-
-    AttributionNodeInternal attribution_node2;
-    attribution_node2.set_uid(2222);
-    attribution_node2.set_tag("location2");
-
-    AttributionNodeInternal attribution_node3;
-    attribution_node3.set_uid(3333);
-    attribution_node3.set_tag("location3");
-    std::vector<AttributionNodeInternal> attribution_nodes = {attribution_node1, attribution_node2,
-                                                              attribution_node3};
-
-    // Set up the event
-    LogEvent event(TAG_ID, 0);
-    event.write(attribution_nodes);
-    event.write("some value");
-    // Convert to a LogEvent
-    event.init();
-
-    // Set up the matcher
-    AtomMatcher matcher;
-    auto simpleMatcher = matcher.mutable_simple_atom_matcher();
-    simpleMatcher->set_atom_id(TAG_ID);
-
-    // Match first node.
-    auto attributionMatcher = simpleMatcher->add_field_value_matcher();
-    attributionMatcher->set_field(FIELD_ID_1);
-    attributionMatcher->set_position(Position::FIRST);
-    attributionMatcher->mutable_matches_tuple()->add_field_value_matcher()->set_field(
-        ATTRIBUTION_TAG_FIELD_ID);
-    attributionMatcher->mutable_matches_tuple()->mutable_field_value_matcher(0)->set_eq_string("tag");
-
-    auto fieldMatcher = simpleMatcher->add_field_value_matcher();
-    fieldMatcher->set_field(FIELD_ID_2);
-    fieldMatcher->set_eq_string("some value");
-
-    // Tag not matched.
-    EXPECT_FALSE(matchesSimple(uidMap, *simpleMatcher, event));
-    attributionMatcher->mutable_matches_tuple()->mutable_field_value_matcher(0)
-        ->set_eq_string("location3");
-    EXPECT_FALSE(matchesSimple(uidMap, *simpleMatcher, event));
-    attributionMatcher->mutable_matches_tuple()->mutable_field_value_matcher(0)
-        ->set_eq_string("location1");
-    EXPECT_TRUE(matchesSimple(uidMap, *simpleMatcher, event));
-
-    // Match last node.
-    attributionMatcher->set_position(Position::LAST);
-    EXPECT_FALSE(matchesSimple(uidMap, *simpleMatcher, event));
-    attributionMatcher->mutable_matches_tuple()->mutable_field_value_matcher(0)
-        ->set_eq_string("location3");
-    EXPECT_TRUE(matchesSimple(uidMap, *simpleMatcher, event));
-
-    // Match any node.
-    attributionMatcher->set_position(Position::ANY);
-    EXPECT_TRUE(matchesSimple(uidMap, *simpleMatcher, event));
-    attributionMatcher->mutable_matches_tuple()->mutable_field_value_matcher(0)
-        ->set_eq_string("location1");
-    EXPECT_TRUE(matchesSimple(uidMap, *simpleMatcher, event));
-    attributionMatcher->mutable_matches_tuple()->mutable_field_value_matcher(0)
-        ->set_eq_string("location2");
-    EXPECT_TRUE(matchesSimple(uidMap, *simpleMatcher, event));
-    attributionMatcher->mutable_matches_tuple()->mutable_field_value_matcher(0)
-        ->set_eq_string("location3");
-    EXPECT_TRUE(matchesSimple(uidMap, *simpleMatcher, event));
-    attributionMatcher->mutable_matches_tuple()->mutable_field_value_matcher(0)
-        ->set_eq_string("location4");
-    EXPECT_FALSE(matchesSimple(uidMap, *simpleMatcher, event));
-
-    // Attribution match but primitive field not match.
-    attributionMatcher->set_position(Position::ANY);
-    attributionMatcher->mutable_matches_tuple()->mutable_field_value_matcher(0)
-        ->set_eq_string("location2");
-    fieldMatcher->set_eq_string("wrong value");
-    EXPECT_FALSE(matchesSimple(uidMap, *simpleMatcher, event));
-
-    fieldMatcher->set_eq_string("some value");
-
-    // Uid match.
-    attributionMatcher->set_position(Position::ANY);
-    attributionMatcher->mutable_matches_tuple()->mutable_field_value_matcher(0)->set_field(
-        ATTRIBUTION_UID_FIELD_ID);
-    attributionMatcher->mutable_matches_tuple()->mutable_field_value_matcher(0)->set_eq_string("pkg0");
-    EXPECT_FALSE(matchesSimple(uidMap, *simpleMatcher, event));
-
-    uidMap.updateMap(
-            1, {1111, 1111, 2222, 3333, 3333} /* uid list */, {1, 1, 2, 1, 2} /* version list */,
-            {android::String16("v1"), android::String16("v1"), android::String16("v2"),
-             android::String16("v1"), android::String16("v2")},
-            {android::String16("pkg0"), android::String16("pkg1"), android::String16("pkg1"),
-             android::String16("Pkg2"), android::String16("PkG3")} /* package name list */,
-            {android::String16(""), android::String16(""), android::String16(""),
-             android::String16(""), android::String16("")});
-
-    EXPECT_TRUE(matchesSimple(uidMap, *simpleMatcher, event));
-    attributionMatcher->mutable_matches_tuple()->mutable_field_value_matcher(0)
-        ->set_eq_string("pkg3");
-    EXPECT_TRUE(matchesSimple(uidMap, *simpleMatcher, event));
-    attributionMatcher->mutable_matches_tuple()->mutable_field_value_matcher(0)
-        ->set_eq_string("pkg2");
-    EXPECT_TRUE(matchesSimple(uidMap, *simpleMatcher, event));
-    attributionMatcher->mutable_matches_tuple()->mutable_field_value_matcher(0)
-        ->set_eq_string("pkg1");
-    EXPECT_TRUE(matchesSimple(uidMap, *simpleMatcher, event));
-    attributionMatcher->mutable_matches_tuple()->mutable_field_value_matcher(0)
-        ->set_eq_string("pkg0");
-    EXPECT_TRUE(matchesSimple(uidMap, *simpleMatcher, event));
-
-    attributionMatcher->set_position(Position::FIRST);
-    attributionMatcher->mutable_matches_tuple()->mutable_field_value_matcher(0)
-        ->set_eq_string("pkg0");
-    EXPECT_TRUE(matchesSimple(uidMap, *simpleMatcher, event));
-    attributionMatcher->mutable_matches_tuple()->mutable_field_value_matcher(0)
-        ->set_eq_string("pkg3");
-    EXPECT_FALSE(matchesSimple(uidMap, *simpleMatcher, event));
-    attributionMatcher->mutable_matches_tuple()->mutable_field_value_matcher(0)
-        ->set_eq_string("pkg2");
-    EXPECT_FALSE(matchesSimple(uidMap, *simpleMatcher, event));
-    attributionMatcher->mutable_matches_tuple()->mutable_field_value_matcher(0)
-        ->set_eq_string("pkg1");
-    EXPECT_TRUE(matchesSimple(uidMap, *simpleMatcher, event));
-
-    attributionMatcher->set_position(Position::LAST);
-    attributionMatcher->mutable_matches_tuple()->mutable_field_value_matcher(0)
-        ->set_eq_string("pkg0");
-    EXPECT_FALSE(matchesSimple(uidMap, *simpleMatcher, event));
-    attributionMatcher->mutable_matches_tuple()->mutable_field_value_matcher(0)
-        ->set_eq_string("pkg3");
-    EXPECT_TRUE(matchesSimple(uidMap, *simpleMatcher, event));
-    attributionMatcher->mutable_matches_tuple()->mutable_field_value_matcher(0)
-        ->set_eq_string("pkg2");
-    EXPECT_TRUE(matchesSimple(uidMap, *simpleMatcher, event));
-    attributionMatcher->mutable_matches_tuple()->mutable_field_value_matcher(0)
-        ->set_eq_string("pkg1");
-    EXPECT_FALSE(matchesSimple(uidMap, *simpleMatcher, event));
-
-    // Uid + tag.
-    attributionMatcher->set_position(Position::ANY);
-    attributionMatcher->mutable_matches_tuple()->add_field_value_matcher()->set_field(
-        ATTRIBUTION_TAG_FIELD_ID);
-    attributionMatcher->mutable_matches_tuple()->mutable_field_value_matcher(0)
-        ->set_eq_string("pkg0");
-    attributionMatcher->mutable_matches_tuple()->mutable_field_value_matcher(1)
-        ->set_eq_string("location1");
-    EXPECT_TRUE(matchesSimple(uidMap, *simpleMatcher, event));
-    attributionMatcher->mutable_matches_tuple()->mutable_field_value_matcher(0)
-        ->set_eq_string("pkg1");
-    attributionMatcher->mutable_matches_tuple()->mutable_field_value_matcher(1)
-        ->set_eq_string("location1");
-    EXPECT_TRUE(matchesSimple(uidMap, *simpleMatcher, event));
-    attributionMatcher->mutable_matches_tuple()->mutable_field_value_matcher(0)
-        ->set_eq_string("pkg1");
-    attributionMatcher->mutable_matches_tuple()->mutable_field_value_matcher(1)
-        ->set_eq_string("location2");
-    EXPECT_TRUE(matchesSimple(uidMap, *simpleMatcher, event));
-    attributionMatcher->mutable_matches_tuple()->mutable_field_value_matcher(0)
-        ->set_eq_string("pkg2");
-    attributionMatcher->mutable_matches_tuple()->mutable_field_value_matcher(1)
-        ->set_eq_string("location3");
-    EXPECT_TRUE(matchesSimple(uidMap, *simpleMatcher, event));
-    attributionMatcher->mutable_matches_tuple()->mutable_field_value_matcher(0)
-        ->set_eq_string("pkg3");
-    attributionMatcher->mutable_matches_tuple()->mutable_field_value_matcher(1)
-        ->set_eq_string("location3");
-    EXPECT_TRUE(matchesSimple(uidMap, *simpleMatcher, event));
-    attributionMatcher->mutable_matches_tuple()->mutable_field_value_matcher(0)
-        ->set_eq_string("pkg3");
-    attributionMatcher->mutable_matches_tuple()->mutable_field_value_matcher(1)
-        ->set_eq_string("location1");
-    EXPECT_FALSE(matchesSimple(uidMap, *simpleMatcher, event));
-
-    attributionMatcher->set_position(Position::FIRST);
-    attributionMatcher->mutable_matches_tuple()->mutable_field_value_matcher(0)
-        ->set_eq_string("pkg0");
-    attributionMatcher->mutable_matches_tuple()->mutable_field_value_matcher(1)
-        ->set_eq_string("location1");
-    EXPECT_TRUE(matchesSimple(uidMap, *simpleMatcher, event));
-    attributionMatcher->mutable_matches_tuple()->mutable_field_value_matcher(0)
-        ->set_eq_string("pkg1");
-    attributionMatcher->mutable_matches_tuple()->mutable_field_value_matcher(1)
-        ->set_eq_string("location1");
-    EXPECT_TRUE(matchesSimple(uidMap, *simpleMatcher, event));
-    attributionMatcher->mutable_matches_tuple()->mutable_field_value_matcher(0)
-        ->set_eq_string("pkg1");
-    attributionMatcher->mutable_matches_tuple()->mutable_field_value_matcher(1)
-        ->set_eq_string("location2");
-    EXPECT_FALSE(matchesSimple(uidMap, *simpleMatcher, event));
-    attributionMatcher->mutable_matches_tuple()->mutable_field_value_matcher(0)
-        ->set_eq_string("pkg2");
-    attributionMatcher->mutable_matches_tuple()->mutable_field_value_matcher(1)
-        ->set_eq_string("location3");
-    EXPECT_FALSE(matchesSimple(uidMap, *simpleMatcher, event));
-    attributionMatcher->mutable_matches_tuple()->mutable_field_value_matcher(0)
-        ->set_eq_string("pkg3");
-    attributionMatcher->mutable_matches_tuple()->mutable_field_value_matcher(1)
-        ->set_eq_string("location3");
-    EXPECT_FALSE(matchesSimple(uidMap, *simpleMatcher, event));
-    attributionMatcher->mutable_matches_tuple()->mutable_field_value_matcher(0)
-        ->set_eq_string("pkg3");
-    attributionMatcher->mutable_matches_tuple()->mutable_field_value_matcher(1)
-        ->set_eq_string("location1");
-    EXPECT_FALSE(matchesSimple(uidMap, *simpleMatcher, event));
-
-    attributionMatcher->set_position(Position::LAST);
-    attributionMatcher->mutable_matches_tuple()->mutable_field_value_matcher(0)
-        ->set_eq_string("pkg0");
-    attributionMatcher->mutable_matches_tuple()->mutable_field_value_matcher(1)
-        ->set_eq_string("location1");
-    EXPECT_FALSE(matchesSimple(uidMap, *simpleMatcher, event));
-    attributionMatcher->mutable_matches_tuple()->mutable_field_value_matcher(0)
-        ->set_eq_string("pkg1");
-    attributionMatcher->mutable_matches_tuple()->mutable_field_value_matcher(1)
-        ->set_eq_string("location1");
-    EXPECT_FALSE(matchesSimple(uidMap, *simpleMatcher, event));
-    attributionMatcher->mutable_matches_tuple()->mutable_field_value_matcher(0)
-        ->set_eq_string("pkg1");
-    attributionMatcher->mutable_matches_tuple()->mutable_field_value_matcher(1)
-        ->set_eq_string("location2");
-    EXPECT_FALSE(matchesSimple(uidMap, *simpleMatcher, event));
-    attributionMatcher->mutable_matches_tuple()->mutable_field_value_matcher(0)
-        ->set_eq_string("pkg2");
-    attributionMatcher->mutable_matches_tuple()->mutable_field_value_matcher(1)
-        ->set_eq_string("location3");
-    EXPECT_TRUE(matchesSimple(uidMap, *simpleMatcher, event));
-    attributionMatcher->mutable_matches_tuple()->mutable_field_value_matcher(0)
-        ->set_eq_string("pkg3");
-    attributionMatcher->mutable_matches_tuple()->mutable_field_value_matcher(1)
-        ->set_eq_string("location3");
-    EXPECT_TRUE(matchesSimple(uidMap, *simpleMatcher, event));
-    attributionMatcher->mutable_matches_tuple()->mutable_field_value_matcher(0)
-        ->set_eq_string("pkg3");
-    attributionMatcher->mutable_matches_tuple()->mutable_field_value_matcher(1)
-        ->set_eq_string("location1");
-    EXPECT_FALSE(matchesSimple(uidMap, *simpleMatcher, event));
-}
-
-TEST(AtomMatcherTest, TestUidFieldMatcher) {
-    UidMap uidMap;
-    uidMap.updateMap(
-        1, {1111, 1111, 2222, 3333, 3333} /* uid list */, {1, 1, 2, 1, 2} /* version list */,
-        {android::String16("v1"), android::String16("v1"), android::String16("v2"),
-         android::String16("v1"), android::String16("v2")},
-        {android::String16("pkg0"), android::String16("pkg1"), android::String16("pkg1"),
-         android::String16("Pkg2"), android::String16("PkG3")} /* package name list */,
-        {android::String16(""), android::String16(""), android::String16(""),
-         android::String16(""), android::String16("")});
-
-    // Set up matcher
-    AtomMatcher matcher;
-    auto simpleMatcher = matcher.mutable_simple_atom_matcher();
-    simpleMatcher->set_atom_id(TAG_ID);
-    simpleMatcher->add_field_value_matcher()->set_field(1);
-    simpleMatcher->mutable_field_value_matcher(0)->set_eq_string("pkg0");
-
-    // Set up the event
-    LogEvent event(TAG_ID, 0);
-    event.write(1111);
-    event.init();
-
-    LogEvent event2(TAG_ID_2, 0);
-    event2.write(1111);
-    event2.write("some value");
-    event2.init();
-
-    // Tag not in kAtomsWithUidField
-    EXPECT_FALSE(matchesSimple(uidMap, *simpleMatcher, event));
-
-    // Tag found in kAtomsWithUidField and has matching uid
-    simpleMatcher->set_atom_id(TAG_ID_2);
-    EXPECT_TRUE(matchesSimple(uidMap, *simpleMatcher, event2));
-
-    // Tag found in kAtomsWithUidField but has non-matching uid
-    simpleMatcher->mutable_field_value_matcher(0)->set_eq_string("Pkg2");
-    EXPECT_FALSE(matchesSimple(uidMap, *simpleMatcher, event2));
-}
-
-TEST(AtomMatcherTest, TestNeqAnyStringMatcher) {
-    UidMap uidMap;
-    uidMap.updateMap(
-            1, {1111, 1111, 2222, 3333, 3333} /* uid list */, {1, 1, 2, 1, 2} /* version list */,
-            {android::String16("v1"), android::String16("v1"), android::String16("v2"),
-             android::String16("v1"), android::String16("v2")},
-            {android::String16("pkg0"), android::String16("pkg1"), android::String16("pkg1"),
-             android::String16("Pkg2"), android::String16("PkG3")} /* package name list */,
-            {android::String16(""), android::String16(""), android::String16(""),
-             android::String16(""), android::String16("")});
-
-    AttributionNodeInternal attribution_node1;
-    attribution_node1.set_uid(1111);
-    attribution_node1.set_tag("location1");
-
-    AttributionNodeInternal attribution_node2;
-    attribution_node2.set_uid(2222);
-    attribution_node2.set_tag("location2");
-
-    AttributionNodeInternal attribution_node3;
-    attribution_node3.set_uid(3333);
-    attribution_node3.set_tag("location3");
-
-    AttributionNodeInternal attribution_node4;
-    attribution_node4.set_uid(1066);
-    attribution_node4.set_tag("location3");
-    std::vector<AttributionNodeInternal> attribution_nodes = {attribution_node1, attribution_node2,
-                                                              attribution_node3, attribution_node4};
-
-    // Set up the event
-    LogEvent event(TAG_ID, 0);
-    event.write(attribution_nodes);
-    event.write("some value");
-    // Convert to a LogEvent
-    event.init();
-
-    // Set up the matcher
-    AtomMatcher matcher;
-    auto simpleMatcher = matcher.mutable_simple_atom_matcher();
-    simpleMatcher->set_atom_id(TAG_ID);
-
-    // Match first node.
-    auto attributionMatcher = simpleMatcher->add_field_value_matcher();
-    attributionMatcher->set_field(FIELD_ID_1);
-    attributionMatcher->set_position(Position::FIRST);
-    attributionMatcher->mutable_matches_tuple()->add_field_value_matcher()->set_field(
-            ATTRIBUTION_UID_FIELD_ID);
-    auto neqStringList = attributionMatcher->mutable_matches_tuple()
-                                 ->mutable_field_value_matcher(0)
-                                 ->mutable_neq_any_string();
-    neqStringList->add_str_value("pkg2");
-    neqStringList->add_str_value("pkg3");
-
-    auto fieldMatcher = simpleMatcher->add_field_value_matcher();
-    fieldMatcher->set_field(FIELD_ID_2);
-    fieldMatcher->set_eq_string("some value");
-
-    EXPECT_TRUE(matchesSimple(uidMap, *simpleMatcher, event));
-
-    neqStringList->Clear();
-    neqStringList->add_str_value("pkg1");
-    neqStringList->add_str_value("pkg3");
-    EXPECT_FALSE(matchesSimple(uidMap, *simpleMatcher, event));
-
-    attributionMatcher->set_position(Position::ANY);
-    neqStringList->Clear();
-    neqStringList->add_str_value("maps.com");
-    EXPECT_TRUE(matchesSimple(uidMap, *simpleMatcher, event));
-
-    neqStringList->Clear();
-    neqStringList->add_str_value("PkG3");
-    EXPECT_TRUE(matchesSimple(uidMap, *simpleMatcher, event));
-
-    attributionMatcher->set_position(Position::LAST);
-    neqStringList->Clear();
-    neqStringList->add_str_value("AID_STATSD");
-    EXPECT_FALSE(matchesSimple(uidMap, *simpleMatcher, event));
-}
-
-TEST(AtomMatcherTest, TestEqAnyStringMatcher) {
-    UidMap uidMap;
-    uidMap.updateMap(
-            1, {1111, 1111, 2222, 3333, 3333} /* uid list */, {1, 1, 2, 1, 2} /* version list */,
-            {android::String16("v1"), android::String16("v1"), android::String16("v2"),
-             android::String16("v1"), android::String16("v2")},
-            {android::String16("pkg0"), android::String16("pkg1"), android::String16("pkg1"),
-             android::String16("Pkg2"), android::String16("PkG3")} /* package name list */,
-            {android::String16(""), android::String16(""), android::String16(""),
-             android::String16(""), android::String16("")});
-
-    AttributionNodeInternal attribution_node1;
-    attribution_node1.set_uid(1067);
-    attribution_node1.set_tag("location1");
-
-    AttributionNodeInternal attribution_node2;
-    attribution_node2.set_uid(2222);
-    attribution_node2.set_tag("location2");
-
-    AttributionNodeInternal attribution_node3;
-    attribution_node3.set_uid(3333);
-    attribution_node3.set_tag("location3");
-
-    AttributionNodeInternal attribution_node4;
-    attribution_node4.set_uid(1066);
-    attribution_node4.set_tag("location3");
-    std::vector<AttributionNodeInternal> attribution_nodes = {attribution_node1, attribution_node2,
-                                                              attribution_node3, attribution_node4};
-
-    // Set up the event
-    LogEvent event(TAG_ID, 0);
-    event.write(attribution_nodes);
-    event.write("some value");
-    // Convert to a LogEvent
-    event.init();
-
-    // Set up the matcher
-    AtomMatcher matcher;
-    auto simpleMatcher = matcher.mutable_simple_atom_matcher();
-    simpleMatcher->set_atom_id(TAG_ID);
-
-    // Match first node.
-    auto attributionMatcher = simpleMatcher->add_field_value_matcher();
-    attributionMatcher->set_field(FIELD_ID_1);
-    attributionMatcher->set_position(Position::FIRST);
-    attributionMatcher->mutable_matches_tuple()->add_field_value_matcher()->set_field(
-            ATTRIBUTION_UID_FIELD_ID);
-    auto eqStringList = attributionMatcher->mutable_matches_tuple()
-                                ->mutable_field_value_matcher(0)
-                                ->mutable_eq_any_string();
-    eqStringList->add_str_value("AID_ROOT");
-    eqStringList->add_str_value("AID_INCIDENTD");
-
-    auto fieldMatcher = simpleMatcher->add_field_value_matcher();
-    fieldMatcher->set_field(FIELD_ID_2);
-    fieldMatcher->set_eq_string("some value");
-
-    EXPECT_TRUE(matchesSimple(uidMap, *simpleMatcher, event));
-
-    attributionMatcher->set_position(Position::ANY);
-    eqStringList->Clear();
-    eqStringList->add_str_value("AID_STATSD");
-    EXPECT_TRUE(matchesSimple(uidMap, *simpleMatcher, event));
-
-    eqStringList->Clear();
-    eqStringList->add_str_value("pkg1");
-    EXPECT_TRUE(matchesSimple(uidMap, *simpleMatcher, event));
-
-    auto normalStringField = fieldMatcher->mutable_eq_any_string();
-    normalStringField->add_str_value("some value123");
-    normalStringField->add_str_value("some value");
-    EXPECT_TRUE(matchesSimple(uidMap, *simpleMatcher, event));
-
-    normalStringField->Clear();
-    normalStringField->add_str_value("AID_STATSD");
-    EXPECT_FALSE(matchesSimple(uidMap, *simpleMatcher, event));
-
-    eqStringList->Clear();
-    eqStringList->add_str_value("maps.com");
-    EXPECT_FALSE(matchesSimple(uidMap, *simpleMatcher, event));
-}
-
-TEST(AtomMatcherTest, TestBoolMatcher) {
-    UidMap uidMap;
-    // Set up the matcher
-    AtomMatcher matcher;
-    auto simpleMatcher = matcher.mutable_simple_atom_matcher();
-    simpleMatcher->set_atom_id(TAG_ID);
-    auto keyValue1 = simpleMatcher->add_field_value_matcher();
-    keyValue1->set_field(FIELD_ID_1);
-    auto keyValue2 = simpleMatcher->add_field_value_matcher();
-    keyValue2->set_field(FIELD_ID_2);
-
-    // Set up the event
-    LogEvent event(TAG_ID, 0);
-    EXPECT_TRUE(event.write(true));
-    EXPECT_TRUE(event.write(false));
-    // Convert to a LogEvent
-    event.init();
-
-    // Test
-    keyValue1->set_eq_bool(true);
-    keyValue2->set_eq_bool(false);
-    EXPECT_TRUE(matchesSimple(uidMap, *simpleMatcher, event));
-
-    keyValue1->set_eq_bool(false);
-    keyValue2->set_eq_bool(false);
-    EXPECT_FALSE(matchesSimple(uidMap, *simpleMatcher, event));
-
-    keyValue1->set_eq_bool(false);
-    keyValue2->set_eq_bool(true);
-    EXPECT_FALSE(matchesSimple(uidMap, *simpleMatcher, event));
-
-    keyValue1->set_eq_bool(true);
-    keyValue2->set_eq_bool(true);
-    EXPECT_FALSE(matchesSimple(uidMap, *simpleMatcher, event));
-}
-
-TEST(AtomMatcherTest, TestStringMatcher) {
-    UidMap uidMap;
-    // Set up the matcher
-    AtomMatcher matcher;
-    auto simpleMatcher = matcher.mutable_simple_atom_matcher();
-    simpleMatcher->set_atom_id(TAG_ID);
-    auto keyValue = simpleMatcher->add_field_value_matcher();
-    keyValue->set_field(FIELD_ID_1);
-    keyValue->set_eq_string("some value");
-
-    // Set up the event
-    LogEvent event(TAG_ID, 0);
-    event.write("some value");
-    // Convert to a LogEvent
-    event.init();
-
-    // Test
-    EXPECT_TRUE(matchesSimple(uidMap, *simpleMatcher, event));
-}
-
-TEST(AtomMatcherTest, TestMultiFieldsMatcher) {
-    UidMap uidMap;
-    // Set up the matcher
-    AtomMatcher matcher;
-    auto simpleMatcher = matcher.mutable_simple_atom_matcher();
-    simpleMatcher->set_atom_id(TAG_ID);
-    auto keyValue1 = simpleMatcher->add_field_value_matcher();
-    keyValue1->set_field(FIELD_ID_1);
-    auto keyValue2 = simpleMatcher->add_field_value_matcher();
-    keyValue2->set_field(FIELD_ID_2);
-
-    // Set up the event
-    LogEvent event(TAG_ID, 0);
-    event.write(2);
-    event.write(3);
-
-    // Convert to a LogEvent
-    event.init();
-
-    // Test
-    keyValue1->set_eq_int(2);
-    keyValue2->set_eq_int(3);
-    EXPECT_TRUE(matchesSimple(uidMap, *simpleMatcher, event));
-
-    keyValue1->set_eq_int(2);
-    keyValue2->set_eq_int(4);
-    EXPECT_FALSE(matchesSimple(uidMap, *simpleMatcher, event));
-
-    keyValue1->set_eq_int(4);
-    keyValue2->set_eq_int(3);
-    EXPECT_FALSE(matchesSimple(uidMap, *simpleMatcher, event));
-}
-
-TEST(AtomMatcherTest, TestIntComparisonMatcher) {
-    UidMap uidMap;
-    // Set up the matcher
-    AtomMatcher matcher;
-    auto simpleMatcher = matcher.mutable_simple_atom_matcher();
-
-    simpleMatcher->set_atom_id(TAG_ID);
-    auto keyValue = simpleMatcher->add_field_value_matcher();
-    keyValue->set_field(FIELD_ID_1);
-
-    // Set up the event
-    LogEvent event(TAG_ID, 0);
-    event.write(11);
-    event.init();
-
-    // Test
-
-    // eq_int
-    keyValue->set_eq_int(10);
-    EXPECT_FALSE(matchesSimple(uidMap, *simpleMatcher, event));
-    keyValue->set_eq_int(11);
-    EXPECT_TRUE(matchesSimple(uidMap, *simpleMatcher, event));
-    keyValue->set_eq_int(12);
-    EXPECT_FALSE(matchesSimple(uidMap, *simpleMatcher, event));
-
-    // lt_int
-    keyValue->set_lt_int(10);
-    EXPECT_FALSE(matchesSimple(uidMap, *simpleMatcher, event));
-    keyValue->set_lt_int(11);
-    EXPECT_FALSE(matchesSimple(uidMap, *simpleMatcher, event));
-    keyValue->set_lt_int(12);
-    EXPECT_TRUE(matchesSimple(uidMap, *simpleMatcher, event));
-
-    // lte_int
-    keyValue->set_lte_int(10);
-    EXPECT_FALSE(matchesSimple(uidMap, *simpleMatcher, event));
-    keyValue->set_lte_int(11);
-    EXPECT_TRUE(matchesSimple(uidMap, *simpleMatcher, event));
-    keyValue->set_lte_int(12);
-    EXPECT_TRUE(matchesSimple(uidMap, *simpleMatcher, event));
-
-    // gt_int
-    keyValue->set_gt_int(10);
-    EXPECT_TRUE(matchesSimple(uidMap, *simpleMatcher, event));
-    keyValue->set_gt_int(11);
-    EXPECT_FALSE(matchesSimple(uidMap, *simpleMatcher, event));
-    keyValue->set_gt_int(12);
-    EXPECT_FALSE(matchesSimple(uidMap, *simpleMatcher, event));
-
-    // gte_int
-    keyValue->set_gte_int(10);
-    EXPECT_TRUE(matchesSimple(uidMap, *simpleMatcher, event));
-    keyValue->set_gte_int(11);
-    EXPECT_TRUE(matchesSimple(uidMap, *simpleMatcher, event));
-    keyValue->set_gte_int(12);
-    EXPECT_FALSE(matchesSimple(uidMap, *simpleMatcher, event));
-}
-
-TEST(AtomMatcherTest, TestFloatComparisonMatcher) {
-    UidMap uidMap;
-    // Set up the matcher
-    AtomMatcher matcher;
-    auto simpleMatcher = matcher.mutable_simple_atom_matcher();
-    simpleMatcher->set_atom_id(TAG_ID);
-
-    auto keyValue = simpleMatcher->add_field_value_matcher();
-    keyValue->set_field(FIELD_ID_1);
-
-    LogEvent event1(TAG_ID, 0);
-    keyValue->set_lt_float(10.0);
-    event1.write(10.1f);
-    event1.init();
-    EXPECT_FALSE(matchesSimple(uidMap, *simpleMatcher, event1));
-
-    LogEvent event2(TAG_ID, 0);
-    event2.write(9.9f);
-    event2.init();
-    EXPECT_TRUE(matchesSimple(uidMap, *simpleMatcher, event2));
-
-    LogEvent event3(TAG_ID, 0);
-    event3.write(10.1f);
-    event3.init();
-    keyValue->set_gt_float(10.0);
-    EXPECT_TRUE(matchesSimple(uidMap, *simpleMatcher, event3));
-
-    LogEvent event4(TAG_ID, 0);
-    event4.write(9.9f);
-    event4.init();
-    EXPECT_FALSE(matchesSimple(uidMap, *simpleMatcher, event4));
-}
+// TODO(b/149590301): Update these tests to use new socket schema.
+//TEST(AtomMatcherTest, TestSimpleMatcher) {
+//    UidMap uidMap;
+//
+//    // Set up the matcher
+//    AtomMatcher matcher;
+//    auto simpleMatcher = matcher.mutable_simple_atom_matcher();
+//    simpleMatcher->set_atom_id(TAG_ID);
+//
+//    LogEvent event(TAG_ID, 0);
+//    EXPECT_TRUE(event.write(11));
+//    event.init();
+//
+//    // Test
+//    EXPECT_TRUE(matchesSimple(uidMap, *simpleMatcher, event));
+//
+//    // Wrong tag id.
+//    simpleMatcher->set_atom_id(TAG_ID + 1);
+//    EXPECT_FALSE(matchesSimple(uidMap, *simpleMatcher, event));
+//}
+//
+//TEST(AtomMatcherTest, TestAttributionMatcher) {
+//    UidMap uidMap;
+//    AttributionNodeInternal attribution_node1;
+//    attribution_node1.set_uid(1111);
+//    attribution_node1.set_tag("location1");
+//
+//    AttributionNodeInternal attribution_node2;
+//    attribution_node2.set_uid(2222);
+//    attribution_node2.set_tag("location2");
+//
+//    AttributionNodeInternal attribution_node3;
+//    attribution_node3.set_uid(3333);
+//    attribution_node3.set_tag("location3");
+//    std::vector<AttributionNodeInternal> attribution_nodes = {attribution_node1, attribution_node2,
+//                                                              attribution_node3};
+//
+//    // Set up the event
+//    LogEvent event(TAG_ID, 0);
+//    event.write(attribution_nodes);
+//    event.write("some value");
+//    // Convert to a LogEvent
+//    event.init();
+//
+//    // Set up the matcher
+//    AtomMatcher matcher;
+//    auto simpleMatcher = matcher.mutable_simple_atom_matcher();
+//    simpleMatcher->set_atom_id(TAG_ID);
+//
+//    // Match first node.
+//    auto attributionMatcher = simpleMatcher->add_field_value_matcher();
+//    attributionMatcher->set_field(FIELD_ID_1);
+//    attributionMatcher->set_position(Position::FIRST);
+//    attributionMatcher->mutable_matches_tuple()->add_field_value_matcher()->set_field(
+//        ATTRIBUTION_TAG_FIELD_ID);
+//    attributionMatcher->mutable_matches_tuple()->mutable_field_value_matcher(0)->set_eq_string("tag");
+//
+//    auto fieldMatcher = simpleMatcher->add_field_value_matcher();
+//    fieldMatcher->set_field(FIELD_ID_2);
+//    fieldMatcher->set_eq_string("some value");
+//
+//    // Tag not matched.
+//    EXPECT_FALSE(matchesSimple(uidMap, *simpleMatcher, event));
+//    attributionMatcher->mutable_matches_tuple()->mutable_field_value_matcher(0)
+//        ->set_eq_string("location3");
+//    EXPECT_FALSE(matchesSimple(uidMap, *simpleMatcher, event));
+//    attributionMatcher->mutable_matches_tuple()->mutable_field_value_matcher(0)
+//        ->set_eq_string("location1");
+//    EXPECT_TRUE(matchesSimple(uidMap, *simpleMatcher, event));
+//
+//    // Match last node.
+//    attributionMatcher->set_position(Position::LAST);
+//    EXPECT_FALSE(matchesSimple(uidMap, *simpleMatcher, event));
+//    attributionMatcher->mutable_matches_tuple()->mutable_field_value_matcher(0)
+//        ->set_eq_string("location3");
+//    EXPECT_TRUE(matchesSimple(uidMap, *simpleMatcher, event));
+//
+//    // Match any node.
+//    attributionMatcher->set_position(Position::ANY);
+//    EXPECT_TRUE(matchesSimple(uidMap, *simpleMatcher, event));
+//    attributionMatcher->mutable_matches_tuple()->mutable_field_value_matcher(0)
+//        ->set_eq_string("location1");
+//    EXPECT_TRUE(matchesSimple(uidMap, *simpleMatcher, event));
+//    attributionMatcher->mutable_matches_tuple()->mutable_field_value_matcher(0)
+//        ->set_eq_string("location2");
+//    EXPECT_TRUE(matchesSimple(uidMap, *simpleMatcher, event));
+//    attributionMatcher->mutable_matches_tuple()->mutable_field_value_matcher(0)
+//        ->set_eq_string("location3");
+//    EXPECT_TRUE(matchesSimple(uidMap, *simpleMatcher, event));
+//    attributionMatcher->mutable_matches_tuple()->mutable_field_value_matcher(0)
+//        ->set_eq_string("location4");
+//    EXPECT_FALSE(matchesSimple(uidMap, *simpleMatcher, event));
+//
+//    // Attribution match but primitive field not match.
+//    attributionMatcher->set_position(Position::ANY);
+//    attributionMatcher->mutable_matches_tuple()->mutable_field_value_matcher(0)
+//        ->set_eq_string("location2");
+//    fieldMatcher->set_eq_string("wrong value");
+//    EXPECT_FALSE(matchesSimple(uidMap, *simpleMatcher, event));
+//
+//    fieldMatcher->set_eq_string("some value");
+//
+//    // Uid match.
+//    attributionMatcher->set_position(Position::ANY);
+//    attributionMatcher->mutable_matches_tuple()->mutable_field_value_matcher(0)->set_field(
+//        ATTRIBUTION_UID_FIELD_ID);
+//    attributionMatcher->mutable_matches_tuple()->mutable_field_value_matcher(0)->set_eq_string("pkg0");
+//    EXPECT_FALSE(matchesSimple(uidMap, *simpleMatcher, event));
+//
+//    uidMap.updateMap(
+//            1, {1111, 1111, 2222, 3333, 3333} /* uid list */, {1, 1, 2, 1, 2} /* version list */,
+//            {android::String16("v1"), android::String16("v1"), android::String16("v2"),
+//             android::String16("v1"), android::String16("v2")},
+//            {android::String16("pkg0"), android::String16("pkg1"), android::String16("pkg1"),
+//             android::String16("Pkg2"), android::String16("PkG3")} /* package name list */,
+//            {android::String16(""), android::String16(""), android::String16(""),
+//             android::String16(""), android::String16("")});
+//
+//    EXPECT_TRUE(matchesSimple(uidMap, *simpleMatcher, event));
+//    attributionMatcher->mutable_matches_tuple()->mutable_field_value_matcher(0)
+//        ->set_eq_string("pkg3");
+//    EXPECT_TRUE(matchesSimple(uidMap, *simpleMatcher, event));
+//    attributionMatcher->mutable_matches_tuple()->mutable_field_value_matcher(0)
+//        ->set_eq_string("pkg2");
+//    EXPECT_TRUE(matchesSimple(uidMap, *simpleMatcher, event));
+//    attributionMatcher->mutable_matches_tuple()->mutable_field_value_matcher(0)
+//        ->set_eq_string("pkg1");
+//    EXPECT_TRUE(matchesSimple(uidMap, *simpleMatcher, event));
+//    attributionMatcher->mutable_matches_tuple()->mutable_field_value_matcher(0)
+//        ->set_eq_string("pkg0");
+//    EXPECT_TRUE(matchesSimple(uidMap, *simpleMatcher, event));
+//
+//    attributionMatcher->set_position(Position::FIRST);
+//    attributionMatcher->mutable_matches_tuple()->mutable_field_value_matcher(0)
+//        ->set_eq_string("pkg0");
+//    EXPECT_TRUE(matchesSimple(uidMap, *simpleMatcher, event));
+//    attributionMatcher->mutable_matches_tuple()->mutable_field_value_matcher(0)
+//        ->set_eq_string("pkg3");
+//    EXPECT_FALSE(matchesSimple(uidMap, *simpleMatcher, event));
+//    attributionMatcher->mutable_matches_tuple()->mutable_field_value_matcher(0)
+//        ->set_eq_string("pkg2");
+//    EXPECT_FALSE(matchesSimple(uidMap, *simpleMatcher, event));
+//    attributionMatcher->mutable_matches_tuple()->mutable_field_value_matcher(0)
+//        ->set_eq_string("pkg1");
+//    EXPECT_TRUE(matchesSimple(uidMap, *simpleMatcher, event));
+//
+//    attributionMatcher->set_position(Position::LAST);
+//    attributionMatcher->mutable_matches_tuple()->mutable_field_value_matcher(0)
+//        ->set_eq_string("pkg0");
+//    EXPECT_FALSE(matchesSimple(uidMap, *simpleMatcher, event));
+//    attributionMatcher->mutable_matches_tuple()->mutable_field_value_matcher(0)
+//        ->set_eq_string("pkg3");
+//    EXPECT_TRUE(matchesSimple(uidMap, *simpleMatcher, event));
+//    attributionMatcher->mutable_matches_tuple()->mutable_field_value_matcher(0)
+//        ->set_eq_string("pkg2");
+//    EXPECT_TRUE(matchesSimple(uidMap, *simpleMatcher, event));
+//    attributionMatcher->mutable_matches_tuple()->mutable_field_value_matcher(0)
+//        ->set_eq_string("pkg1");
+//    EXPECT_FALSE(matchesSimple(uidMap, *simpleMatcher, event));
+//
+//    // Uid + tag.
+//    attributionMatcher->set_position(Position::ANY);
+//    attributionMatcher->mutable_matches_tuple()->add_field_value_matcher()->set_field(
+//        ATTRIBUTION_TAG_FIELD_ID);
+//    attributionMatcher->mutable_matches_tuple()->mutable_field_value_matcher(0)
+//        ->set_eq_string("pkg0");
+//    attributionMatcher->mutable_matches_tuple()->mutable_field_value_matcher(1)
+//        ->set_eq_string("location1");
+//    EXPECT_TRUE(matchesSimple(uidMap, *simpleMatcher, event));
+//    attributionMatcher->mutable_matches_tuple()->mutable_field_value_matcher(0)
+//        ->set_eq_string("pkg1");
+//    attributionMatcher->mutable_matches_tuple()->mutable_field_value_matcher(1)
+//        ->set_eq_string("location1");
+//    EXPECT_TRUE(matchesSimple(uidMap, *simpleMatcher, event));
+//    attributionMatcher->mutable_matches_tuple()->mutable_field_value_matcher(0)
+//        ->set_eq_string("pkg1");
+//    attributionMatcher->mutable_matches_tuple()->mutable_field_value_matcher(1)
+//        ->set_eq_string("location2");
+//    EXPECT_TRUE(matchesSimple(uidMap, *simpleMatcher, event));
+//    attributionMatcher->mutable_matches_tuple()->mutable_field_value_matcher(0)
+//        ->set_eq_string("pkg2");
+//    attributionMatcher->mutable_matches_tuple()->mutable_field_value_matcher(1)
+//        ->set_eq_string("location3");
+//    EXPECT_TRUE(matchesSimple(uidMap, *simpleMatcher, event));
+//    attributionMatcher->mutable_matches_tuple()->mutable_field_value_matcher(0)
+//        ->set_eq_string("pkg3");
+//    attributionMatcher->mutable_matches_tuple()->mutable_field_value_matcher(1)
+//        ->set_eq_string("location3");
+//    EXPECT_TRUE(matchesSimple(uidMap, *simpleMatcher, event));
+//    attributionMatcher->mutable_matches_tuple()->mutable_field_value_matcher(0)
+//        ->set_eq_string("pkg3");
+//    attributionMatcher->mutable_matches_tuple()->mutable_field_value_matcher(1)
+//        ->set_eq_string("location1");
+//    EXPECT_FALSE(matchesSimple(uidMap, *simpleMatcher, event));
+//
+//    attributionMatcher->set_position(Position::FIRST);
+//    attributionMatcher->mutable_matches_tuple()->mutable_field_value_matcher(0)
+//        ->set_eq_string("pkg0");
+//    attributionMatcher->mutable_matches_tuple()->mutable_field_value_matcher(1)
+//        ->set_eq_string("location1");
+//    EXPECT_TRUE(matchesSimple(uidMap, *simpleMatcher, event));
+//    attributionMatcher->mutable_matches_tuple()->mutable_field_value_matcher(0)
+//        ->set_eq_string("pkg1");
+//    attributionMatcher->mutable_matches_tuple()->mutable_field_value_matcher(1)
+//        ->set_eq_string("location1");
+//    EXPECT_TRUE(matchesSimple(uidMap, *simpleMatcher, event));
+//    attributionMatcher->mutable_matches_tuple()->mutable_field_value_matcher(0)
+//        ->set_eq_string("pkg1");
+//    attributionMatcher->mutable_matches_tuple()->mutable_field_value_matcher(1)
+//        ->set_eq_string("location2");
+//    EXPECT_FALSE(matchesSimple(uidMap, *simpleMatcher, event));
+//    attributionMatcher->mutable_matches_tuple()->mutable_field_value_matcher(0)
+//        ->set_eq_string("pkg2");
+//    attributionMatcher->mutable_matches_tuple()->mutable_field_value_matcher(1)
+//        ->set_eq_string("location3");
+//    EXPECT_FALSE(matchesSimple(uidMap, *simpleMatcher, event));
+//    attributionMatcher->mutable_matches_tuple()->mutable_field_value_matcher(0)
+//        ->set_eq_string("pkg3");
+//    attributionMatcher->mutable_matches_tuple()->mutable_field_value_matcher(1)
+//        ->set_eq_string("location3");
+//    EXPECT_FALSE(matchesSimple(uidMap, *simpleMatcher, event));
+//    attributionMatcher->mutable_matches_tuple()->mutable_field_value_matcher(0)
+//        ->set_eq_string("pkg3");
+//    attributionMatcher->mutable_matches_tuple()->mutable_field_value_matcher(1)
+//        ->set_eq_string("location1");
+//    EXPECT_FALSE(matchesSimple(uidMap, *simpleMatcher, event));
+//
+//    attributionMatcher->set_position(Position::LAST);
+//    attributionMatcher->mutable_matches_tuple()->mutable_field_value_matcher(0)
+//        ->set_eq_string("pkg0");
+//    attributionMatcher->mutable_matches_tuple()->mutable_field_value_matcher(1)
+//        ->set_eq_string("location1");
+//    EXPECT_FALSE(matchesSimple(uidMap, *simpleMatcher, event));
+//    attributionMatcher->mutable_matches_tuple()->mutable_field_value_matcher(0)
+//        ->set_eq_string("pkg1");
+//    attributionMatcher->mutable_matches_tuple()->mutable_field_value_matcher(1)
+//        ->set_eq_string("location1");
+//    EXPECT_FALSE(matchesSimple(uidMap, *simpleMatcher, event));
+//    attributionMatcher->mutable_matches_tuple()->mutable_field_value_matcher(0)
+//        ->set_eq_string("pkg1");
+//    attributionMatcher->mutable_matches_tuple()->mutable_field_value_matcher(1)
+//        ->set_eq_string("location2");
+//    EXPECT_FALSE(matchesSimple(uidMap, *simpleMatcher, event));
+//    attributionMatcher->mutable_matches_tuple()->mutable_field_value_matcher(0)
+//        ->set_eq_string("pkg2");
+//    attributionMatcher->mutable_matches_tuple()->mutable_field_value_matcher(1)
+//        ->set_eq_string("location3");
+//    EXPECT_TRUE(matchesSimple(uidMap, *simpleMatcher, event));
+//    attributionMatcher->mutable_matches_tuple()->mutable_field_value_matcher(0)
+//        ->set_eq_string("pkg3");
+//    attributionMatcher->mutable_matches_tuple()->mutable_field_value_matcher(1)
+//        ->set_eq_string("location3");
+//    EXPECT_TRUE(matchesSimple(uidMap, *simpleMatcher, event));
+//    attributionMatcher->mutable_matches_tuple()->mutable_field_value_matcher(0)
+//        ->set_eq_string("pkg3");
+//    attributionMatcher->mutable_matches_tuple()->mutable_field_value_matcher(1)
+//        ->set_eq_string("location1");
+//    EXPECT_FALSE(matchesSimple(uidMap, *simpleMatcher, event));
+//}
+//
+//TEST(AtomMatcherTest, TestUidFieldMatcher) {
+//    UidMap uidMap;
+//    uidMap.updateMap(
+//        1, {1111, 1111, 2222, 3333, 3333} /* uid list */, {1, 1, 2, 1, 2} /* version list */,
+//        {android::String16("v1"), android::String16("v1"), android::String16("v2"),
+//         android::String16("v1"), android::String16("v2")},
+//        {android::String16("pkg0"), android::String16("pkg1"), android::String16("pkg1"),
+//         android::String16("Pkg2"), android::String16("PkG3")} /* package name list */,
+//        {android::String16(""), android::String16(""), android::String16(""),
+//         android::String16(""), android::String16("")});
+//
+//    // Set up matcher
+//    AtomMatcher matcher;
+//    auto simpleMatcher = matcher.mutable_simple_atom_matcher();
+//    simpleMatcher->set_atom_id(TAG_ID);
+//    simpleMatcher->add_field_value_matcher()->set_field(1);
+//    simpleMatcher->mutable_field_value_matcher(0)->set_eq_string("pkg0");
+//
+//    // Set up the event
+//    LogEvent event(TAG_ID, 0);
+//    event.write(1111);
+//    event.init();
+//
+//    LogEvent event2(TAG_ID_2, 0);
+//    event2.write(1111);
+//    event2.write("some value");
+//    event2.init();
+//
+//    // Tag not in kAtomsWithUidField
+//    EXPECT_FALSE(matchesSimple(uidMap, *simpleMatcher, event));
+//
+//    // Tag found in kAtomsWithUidField and has matching uid
+//    simpleMatcher->set_atom_id(TAG_ID_2);
+//    EXPECT_TRUE(matchesSimple(uidMap, *simpleMatcher, event2));
+//
+//    // Tag found in kAtomsWithUidField but has non-matching uid
+//    simpleMatcher->mutable_field_value_matcher(0)->set_eq_string("Pkg2");
+//    EXPECT_FALSE(matchesSimple(uidMap, *simpleMatcher, event2));
+//}
+//
+//TEST(AtomMatcherTest, TestNeqAnyStringMatcher) {
+//    UidMap uidMap;
+//    uidMap.updateMap(
+//            1, {1111, 1111, 2222, 3333, 3333} /* uid list */, {1, 1, 2, 1, 2} /* version list */,
+//            {android::String16("v1"), android::String16("v1"), android::String16("v2"),
+//             android::String16("v1"), android::String16("v2")},
+//            {android::String16("pkg0"), android::String16("pkg1"), android::String16("pkg1"),
+//             android::String16("Pkg2"), android::String16("PkG3")} /* package name list */,
+//            {android::String16(""), android::String16(""), android::String16(""),
+//             android::String16(""), android::String16("")});
+//
+//    AttributionNodeInternal attribution_node1;
+//    attribution_node1.set_uid(1111);
+//    attribution_node1.set_tag("location1");
+//
+//    AttributionNodeInternal attribution_node2;
+//    attribution_node2.set_uid(2222);
+//    attribution_node2.set_tag("location2");
+//
+//    AttributionNodeInternal attribution_node3;
+//    attribution_node3.set_uid(3333);
+//    attribution_node3.set_tag("location3");
+//
+//    AttributionNodeInternal attribution_node4;
+//    attribution_node4.set_uid(1066);
+//    attribution_node4.set_tag("location3");
+//    std::vector<AttributionNodeInternal> attribution_nodes = {attribution_node1, attribution_node2,
+//                                                              attribution_node3, attribution_node4};
+//
+//    // Set up the event
+//    LogEvent event(TAG_ID, 0);
+//    event.write(attribution_nodes);
+//    event.write("some value");
+//    // Convert to a LogEvent
+//    event.init();
+//
+//    // Set up the matcher
+//    AtomMatcher matcher;
+//    auto simpleMatcher = matcher.mutable_simple_atom_matcher();
+//    simpleMatcher->set_atom_id(TAG_ID);
+//
+//    // Match first node.
+//    auto attributionMatcher = simpleMatcher->add_field_value_matcher();
+//    attributionMatcher->set_field(FIELD_ID_1);
+//    attributionMatcher->set_position(Position::FIRST);
+//    attributionMatcher->mutable_matches_tuple()->add_field_value_matcher()->set_field(
+//            ATTRIBUTION_UID_FIELD_ID);
+//    auto neqStringList = attributionMatcher->mutable_matches_tuple()
+//                                 ->mutable_field_value_matcher(0)
+//                                 ->mutable_neq_any_string();
+//    neqStringList->add_str_value("pkg2");
+//    neqStringList->add_str_value("pkg3");
+//
+//    auto fieldMatcher = simpleMatcher->add_field_value_matcher();
+//    fieldMatcher->set_field(FIELD_ID_2);
+//    fieldMatcher->set_eq_string("some value");
+//
+//    EXPECT_TRUE(matchesSimple(uidMap, *simpleMatcher, event));
+//
+//    neqStringList->Clear();
+//    neqStringList->add_str_value("pkg1");
+//    neqStringList->add_str_value("pkg3");
+//    EXPECT_FALSE(matchesSimple(uidMap, *simpleMatcher, event));
+//
+//    attributionMatcher->set_position(Position::ANY);
+//    neqStringList->Clear();
+//    neqStringList->add_str_value("maps.com");
+//    EXPECT_TRUE(matchesSimple(uidMap, *simpleMatcher, event));
+//
+//    neqStringList->Clear();
+//    neqStringList->add_str_value("PkG3");
+//    EXPECT_TRUE(matchesSimple(uidMap, *simpleMatcher, event));
+//
+//    attributionMatcher->set_position(Position::LAST);
+//    neqStringList->Clear();
+//    neqStringList->add_str_value("AID_STATSD");
+//    EXPECT_FALSE(matchesSimple(uidMap, *simpleMatcher, event));
+//}
+//
+//TEST(AtomMatcherTest, TestEqAnyStringMatcher) {
+//    UidMap uidMap;
+//    uidMap.updateMap(
+//            1, {1111, 1111, 2222, 3333, 3333} /* uid list */, {1, 1, 2, 1, 2} /* version list */,
+//            {android::String16("v1"), android::String16("v1"), android::String16("v2"),
+//             android::String16("v1"), android::String16("v2")},
+//            {android::String16("pkg0"), android::String16("pkg1"), android::String16("pkg1"),
+//             android::String16("Pkg2"), android::String16("PkG3")} /* package name list */,
+//            {android::String16(""), android::String16(""), android::String16(""),
+//             android::String16(""), android::String16("")});
+//
+//    AttributionNodeInternal attribution_node1;
+//    attribution_node1.set_uid(1067);
+//    attribution_node1.set_tag("location1");
+//
+//    AttributionNodeInternal attribution_node2;
+//    attribution_node2.set_uid(2222);
+//    attribution_node2.set_tag("location2");
+//
+//    AttributionNodeInternal attribution_node3;
+//    attribution_node3.set_uid(3333);
+//    attribution_node3.set_tag("location3");
+//
+//    AttributionNodeInternal attribution_node4;
+//    attribution_node4.set_uid(1066);
+//    attribution_node4.set_tag("location3");
+//    std::vector<AttributionNodeInternal> attribution_nodes = {attribution_node1, attribution_node2,
+//                                                              attribution_node3, attribution_node4};
+//
+//    // Set up the event
+//    LogEvent event(TAG_ID, 0);
+//    event.write(attribution_nodes);
+//    event.write("some value");
+//    // Convert to a LogEvent
+//    event.init();
+//
+//    // Set up the matcher
+//    AtomMatcher matcher;
+//    auto simpleMatcher = matcher.mutable_simple_atom_matcher();
+//    simpleMatcher->set_atom_id(TAG_ID);
+//
+//    // Match first node.
+//    auto attributionMatcher = simpleMatcher->add_field_value_matcher();
+//    attributionMatcher->set_field(FIELD_ID_1);
+//    attributionMatcher->set_position(Position::FIRST);
+//    attributionMatcher->mutable_matches_tuple()->add_field_value_matcher()->set_field(
+//            ATTRIBUTION_UID_FIELD_ID);
+//    auto eqStringList = attributionMatcher->mutable_matches_tuple()
+//                                ->mutable_field_value_matcher(0)
+//                                ->mutable_eq_any_string();
+//    eqStringList->add_str_value("AID_ROOT");
+//    eqStringList->add_str_value("AID_INCIDENTD");
+//
+//    auto fieldMatcher = simpleMatcher->add_field_value_matcher();
+//    fieldMatcher->set_field(FIELD_ID_2);
+//    fieldMatcher->set_eq_string("some value");
+//
+//    EXPECT_TRUE(matchesSimple(uidMap, *simpleMatcher, event));
+//
+//    attributionMatcher->set_position(Position::ANY);
+//    eqStringList->Clear();
+//    eqStringList->add_str_value("AID_STATSD");
+//    EXPECT_TRUE(matchesSimple(uidMap, *simpleMatcher, event));
+//
+//    eqStringList->Clear();
+//    eqStringList->add_str_value("pkg1");
+//    EXPECT_TRUE(matchesSimple(uidMap, *simpleMatcher, event));
+//
+//    auto normalStringField = fieldMatcher->mutable_eq_any_string();
+//    normalStringField->add_str_value("some value123");
+//    normalStringField->add_str_value("some value");
+//    EXPECT_TRUE(matchesSimple(uidMap, *simpleMatcher, event));
+//
+//    normalStringField->Clear();
+//    normalStringField->add_str_value("AID_STATSD");
+//    EXPECT_FALSE(matchesSimple(uidMap, *simpleMatcher, event));
+//
+//    eqStringList->Clear();
+//    eqStringList->add_str_value("maps.com");
+//    EXPECT_FALSE(matchesSimple(uidMap, *simpleMatcher, event));
+//}
+//
+//TEST(AtomMatcherTest, TestBoolMatcher) {
+//    UidMap uidMap;
+//    // Set up the matcher
+//    AtomMatcher matcher;
+//    auto simpleMatcher = matcher.mutable_simple_atom_matcher();
+//    simpleMatcher->set_atom_id(TAG_ID);
+//    auto keyValue1 = simpleMatcher->add_field_value_matcher();
+//    keyValue1->set_field(FIELD_ID_1);
+//    auto keyValue2 = simpleMatcher->add_field_value_matcher();
+//    keyValue2->set_field(FIELD_ID_2);
+//
+//    // Set up the event
+//    LogEvent event(TAG_ID, 0);
+//    EXPECT_TRUE(event.write(true));
+//    EXPECT_TRUE(event.write(false));
+//    // Convert to a LogEvent
+//    event.init();
+//
+//    // Test
+//    keyValue1->set_eq_bool(true);
+//    keyValue2->set_eq_bool(false);
+//    EXPECT_TRUE(matchesSimple(uidMap, *simpleMatcher, event));
+//
+//    keyValue1->set_eq_bool(false);
+//    keyValue2->set_eq_bool(false);
+//    EXPECT_FALSE(matchesSimple(uidMap, *simpleMatcher, event));
+//
+//    keyValue1->set_eq_bool(false);
+//    keyValue2->set_eq_bool(true);
+//    EXPECT_FALSE(matchesSimple(uidMap, *simpleMatcher, event));
+//
+//    keyValue1->set_eq_bool(true);
+//    keyValue2->set_eq_bool(true);
+//    EXPECT_FALSE(matchesSimple(uidMap, *simpleMatcher, event));
+//}
+//
+//TEST(AtomMatcherTest, TestStringMatcher) {
+//    UidMap uidMap;
+//    // Set up the matcher
+//    AtomMatcher matcher;
+//    auto simpleMatcher = matcher.mutable_simple_atom_matcher();
+//    simpleMatcher->set_atom_id(TAG_ID);
+//    auto keyValue = simpleMatcher->add_field_value_matcher();
+//    keyValue->set_field(FIELD_ID_1);
+//    keyValue->set_eq_string("some value");
+//
+//    // Set up the event
+//    LogEvent event(TAG_ID, 0);
+//    event.write("some value");
+//    // Convert to a LogEvent
+//    event.init();
+//
+//    // Test
+//    EXPECT_TRUE(matchesSimple(uidMap, *simpleMatcher, event));
+//}
+//
+//TEST(AtomMatcherTest, TestMultiFieldsMatcher) {
+//    UidMap uidMap;
+//    // Set up the matcher
+//    AtomMatcher matcher;
+//    auto simpleMatcher = matcher.mutable_simple_atom_matcher();
+//    simpleMatcher->set_atom_id(TAG_ID);
+//    auto keyValue1 = simpleMatcher->add_field_value_matcher();
+//    keyValue1->set_field(FIELD_ID_1);
+//    auto keyValue2 = simpleMatcher->add_field_value_matcher();
+//    keyValue2->set_field(FIELD_ID_2);
+//
+//    // Set up the event
+//    LogEvent event(TAG_ID, 0);
+//    event.write(2);
+//    event.write(3);
+//
+//    // Convert to a LogEvent
+//    event.init();
+//
+//    // Test
+//    keyValue1->set_eq_int(2);
+//    keyValue2->set_eq_int(3);
+//    EXPECT_TRUE(matchesSimple(uidMap, *simpleMatcher, event));
+//
+//    keyValue1->set_eq_int(2);
+//    keyValue2->set_eq_int(4);
+//    EXPECT_FALSE(matchesSimple(uidMap, *simpleMatcher, event));
+//
+//    keyValue1->set_eq_int(4);
+//    keyValue2->set_eq_int(3);
+//    EXPECT_FALSE(matchesSimple(uidMap, *simpleMatcher, event));
+//}
+//
+//TEST(AtomMatcherTest, TestIntComparisonMatcher) {
+//    UidMap uidMap;
+//    // Set up the matcher
+//    AtomMatcher matcher;
+//    auto simpleMatcher = matcher.mutable_simple_atom_matcher();
+//
+//    simpleMatcher->set_atom_id(TAG_ID);
+//    auto keyValue = simpleMatcher->add_field_value_matcher();
+//    keyValue->set_field(FIELD_ID_1);
+//
+//    // Set up the event
+//    LogEvent event(TAG_ID, 0);
+//    event.write(11);
+//    event.init();
+//
+//    // Test
+//
+//    // eq_int
+//    keyValue->set_eq_int(10);
+//    EXPECT_FALSE(matchesSimple(uidMap, *simpleMatcher, event));
+//    keyValue->set_eq_int(11);
+//    EXPECT_TRUE(matchesSimple(uidMap, *simpleMatcher, event));
+//    keyValue->set_eq_int(12);
+//    EXPECT_FALSE(matchesSimple(uidMap, *simpleMatcher, event));
+//
+//    // lt_int
+//    keyValue->set_lt_int(10);
+//    EXPECT_FALSE(matchesSimple(uidMap, *simpleMatcher, event));
+//    keyValue->set_lt_int(11);
+//    EXPECT_FALSE(matchesSimple(uidMap, *simpleMatcher, event));
+//    keyValue->set_lt_int(12);
+//    EXPECT_TRUE(matchesSimple(uidMap, *simpleMatcher, event));
+//
+//    // lte_int
+//    keyValue->set_lte_int(10);
+//    EXPECT_FALSE(matchesSimple(uidMap, *simpleMatcher, event));
+//    keyValue->set_lte_int(11);
+//    EXPECT_TRUE(matchesSimple(uidMap, *simpleMatcher, event));
+//    keyValue->set_lte_int(12);
+//    EXPECT_TRUE(matchesSimple(uidMap, *simpleMatcher, event));
+//
+//    // gt_int
+//    keyValue->set_gt_int(10);
+//    EXPECT_TRUE(matchesSimple(uidMap, *simpleMatcher, event));
+//    keyValue->set_gt_int(11);
+//    EXPECT_FALSE(matchesSimple(uidMap, *simpleMatcher, event));
+//    keyValue->set_gt_int(12);
+//    EXPECT_FALSE(matchesSimple(uidMap, *simpleMatcher, event));
+//
+//    // gte_int
+//    keyValue->set_gte_int(10);
+//    EXPECT_TRUE(matchesSimple(uidMap, *simpleMatcher, event));
+//    keyValue->set_gte_int(11);
+//    EXPECT_TRUE(matchesSimple(uidMap, *simpleMatcher, event));
+//    keyValue->set_gte_int(12);
+//    EXPECT_FALSE(matchesSimple(uidMap, *simpleMatcher, event));
+//}
+//
+//TEST(AtomMatcherTest, TestFloatComparisonMatcher) {
+//    UidMap uidMap;
+//    // Set up the matcher
+//    AtomMatcher matcher;
+//    auto simpleMatcher = matcher.mutable_simple_atom_matcher();
+//    simpleMatcher->set_atom_id(TAG_ID);
+//
+//    auto keyValue = simpleMatcher->add_field_value_matcher();
+//    keyValue->set_field(FIELD_ID_1);
+//
+//    LogEvent event1(TAG_ID, 0);
+//    keyValue->set_lt_float(10.0);
+//    event1.write(10.1f);
+//    event1.init();
+//    EXPECT_FALSE(matchesSimple(uidMap, *simpleMatcher, event1));
+//
+//    LogEvent event2(TAG_ID, 0);
+//    event2.write(9.9f);
+//    event2.init();
+//    EXPECT_TRUE(matchesSimple(uidMap, *simpleMatcher, event2));
+//
+//    LogEvent event3(TAG_ID, 0);
+//    event3.write(10.1f);
+//    event3.init();
+//    keyValue->set_gt_float(10.0);
+//    EXPECT_TRUE(matchesSimple(uidMap, *simpleMatcher, event3));
+//
+//    LogEvent event4(TAG_ID, 0);
+//    event4.write(9.9f);
+//    event4.init();
+//    EXPECT_FALSE(matchesSimple(uidMap, *simpleMatcher, event4));
+//}
 
 // Helper for the composite matchers.
 void addSimpleMatcher(SimpleAtomMatcher* simpleMatcher, int tag, int key, int val) {
diff --git a/cmds/statsd/tests/LogEvent_test.cpp b/cmds/statsd/tests/LogEvent_test.cpp
index f624e12..7542faf 100644
--- a/cmds/statsd/tests/LogEvent_test.cpp
+++ b/cmds/statsd/tests/LogEvent_test.cpp
@@ -31,9 +31,6 @@
 using util::ProtoOutputStream;
 using util::ProtoReader;
 
-
-#ifdef NEW_ENCODING_SCHEME
-
 Field getField(int32_t tag, const vector<int32_t>& pos, int32_t depth, const vector<bool>& last) {
     Field f(tag, (int32_t*)pos.data(), depth);
 
@@ -241,480 +238,6 @@
     AStatsEvent_release(event);
 }
 
-#else // NEW_ENCODING_SCHEME
-
-TEST(LogEventTest, TestLogParsing) {
-    LogEvent event1(1, 2000);
-
-    std::vector<AttributionNodeInternal> nodes;
-
-    AttributionNodeInternal node1;
-    node1.set_uid(1000);
-    node1.set_tag("tag1");
-    nodes.push_back(node1);
-
-    AttributionNodeInternal node2;
-    node2.set_uid(2000);
-    node2.set_tag("tag2");
-    nodes.push_back(node2);
-
-    event1.write(nodes);
-    event1.write("hello");
-    event1.write((int32_t)10);
-    event1.write((int64_t)20);
-    event1.write((float)1.1);
-    event1.init();
-
-    const auto& items = event1.getValues();
-    EXPECT_EQ((size_t)8, items.size());
-    EXPECT_EQ(1, event1.GetTagId());
-
-    const FieldValue& item0 = event1.getValues()[0];
-    EXPECT_EQ(0x2010101, item0.mField.getField());
-    EXPECT_EQ(Type::INT, item0.mValue.getType());
-    EXPECT_EQ(1000, item0.mValue.int_value);
-
-    const FieldValue& item1 = event1.getValues()[1];
-    EXPECT_EQ(0x2010182, item1.mField.getField());
-    EXPECT_EQ(Type::STRING, item1.mValue.getType());
-    EXPECT_EQ("tag1", item1.mValue.str_value);
-
-    const FieldValue& item2 = event1.getValues()[2];
-    EXPECT_EQ(0x2018201, item2.mField.getField());
-    EXPECT_EQ(Type::INT, item2.mValue.getType());
-    EXPECT_EQ(2000, item2.mValue.int_value);
-
-    const FieldValue& item3 = event1.getValues()[3];
-    EXPECT_EQ(0x2018282, item3.mField.getField());
-    EXPECT_EQ(Type::STRING, item3.mValue.getType());
-    EXPECT_EQ("tag2", item3.mValue.str_value);
-
-    const FieldValue& item4 = event1.getValues()[4];
-    EXPECT_EQ(0x20000, item4.mField.getField());
-    EXPECT_EQ(Type::STRING, item4.mValue.getType());
-    EXPECT_EQ("hello", item4.mValue.str_value);
-
-    const FieldValue& item5 = event1.getValues()[5];
-    EXPECT_EQ(0x30000, item5.mField.getField());
-    EXPECT_EQ(Type::INT, item5.mValue.getType());
-    EXPECT_EQ(10, item5.mValue.int_value);
-
-    const FieldValue& item6 = event1.getValues()[6];
-    EXPECT_EQ(0x40000, item6.mField.getField());
-    EXPECT_EQ(Type::LONG, item6.mValue.getType());
-    EXPECT_EQ((int64_t)20, item6.mValue.long_value);
-
-    const FieldValue& item7 = event1.getValues()[7];
-    EXPECT_EQ(0x50000, item7.mField.getField());
-    EXPECT_EQ(Type::FLOAT, item7.mValue.getType());
-    EXPECT_EQ((float)1.1, item7.mValue.float_value);
-}
-
-TEST(LogEventTest, TestKeyValuePairsAtomParsing) {
-    LogEvent event1(83, 2000, 1000);
-    std::map<int32_t, int32_t> int_map;
-    std::map<int32_t, int64_t> long_map;
-    std::map<int32_t, std::string> string_map;
-    std::map<int32_t, float> float_map;
-
-    int_map[11] = 123;
-    int_map[22] = 345;
-
-    long_map[33] = 678L;
-    long_map[44] = 890L;
-
-    string_map[1] = "test2";
-    string_map[2] = "test1";
-
-    float_map[111] = 2.2f;
-    float_map[222] = 1.1f;
-
-    EXPECT_TRUE(event1.writeKeyValuePairs(0, // Logging side logs 0 uid.
-                                          int_map,
-                                          long_map,
-                                          string_map,
-                                          float_map));
-    event1.init();
-
-    EXPECT_EQ(83, event1.GetTagId());
-    const auto& items = event1.getValues();
-    EXPECT_EQ((size_t)17, items.size());
-
-    const FieldValue& item0 = event1.getValues()[0];
-    EXPECT_EQ(0x10000, item0.mField.getField());
-    EXPECT_EQ(Type::INT, item0.mValue.getType());
-    EXPECT_EQ(1000, item0.mValue.int_value);
-
-    const FieldValue& item1 = event1.getValues()[1];
-    EXPECT_EQ(0x2010201, item1.mField.getField());
-    EXPECT_EQ(Type::INT, item1.mValue.getType());
-    EXPECT_EQ(11, item1.mValue.int_value);
-
-    const FieldValue& item2 = event1.getValues()[2];
-    EXPECT_EQ(0x2010282, item2.mField.getField());
-    EXPECT_EQ(Type::INT, item2.mValue.getType());
-    EXPECT_EQ(123, item2.mValue.int_value);
-
-    const FieldValue& item3 = event1.getValues()[3];
-    EXPECT_EQ(0x2010301, item3.mField.getField());
-    EXPECT_EQ(Type::INT, item3.mValue.getType());
-    EXPECT_EQ(22, item3.mValue.int_value);
-
-    const FieldValue& item4 = event1.getValues()[4];
-    EXPECT_EQ(0x2010382, item4.mField.getField());
-    EXPECT_EQ(Type::INT, item4.mValue.getType());
-    EXPECT_EQ(345, item4.mValue.int_value);
-
-    const FieldValue& item5 = event1.getValues()[5];
-    EXPECT_EQ(0x2010401, item5.mField.getField());
-    EXPECT_EQ(Type::INT, item5.mValue.getType());
-    EXPECT_EQ(33, item5.mValue.int_value);
-
-    const FieldValue& item6 = event1.getValues()[6];
-    EXPECT_EQ(0x2010483, item6.mField.getField());
-    EXPECT_EQ(Type::LONG, item6.mValue.getType());
-    EXPECT_EQ(678L, item6.mValue.int_value);
-
-    const FieldValue& item7 = event1.getValues()[7];
-    EXPECT_EQ(0x2010501, item7.mField.getField());
-    EXPECT_EQ(Type::INT, item7.mValue.getType());
-    EXPECT_EQ(44, item7.mValue.int_value);
-
-    const FieldValue& item8 = event1.getValues()[8];
-    EXPECT_EQ(0x2010583, item8.mField.getField());
-    EXPECT_EQ(Type::LONG, item8.mValue.getType());
-    EXPECT_EQ(890L, item8.mValue.int_value);
-
-    const FieldValue& item9 = event1.getValues()[9];
-    EXPECT_EQ(0x2010601, item9.mField.getField());
-    EXPECT_EQ(Type::INT, item9.mValue.getType());
-    EXPECT_EQ(1, item9.mValue.int_value);
-
-    const FieldValue& item10 = event1.getValues()[10];
-    EXPECT_EQ(0x2010684, item10.mField.getField());
-    EXPECT_EQ(Type::STRING, item10.mValue.getType());
-    EXPECT_EQ("test2", item10.mValue.str_value);
-
-    const FieldValue& item11 = event1.getValues()[11];
-    EXPECT_EQ(0x2010701, item11.mField.getField());
-    EXPECT_EQ(Type::INT, item11.mValue.getType());
-    EXPECT_EQ(2, item11.mValue.int_value);
-
-    const FieldValue& item12 = event1.getValues()[12];
-    EXPECT_EQ(0x2010784, item12.mField.getField());
-    EXPECT_EQ(Type::STRING, item12.mValue.getType());
-    EXPECT_EQ("test1", item12.mValue.str_value);
-
-    const FieldValue& item13 = event1.getValues()[13];
-    EXPECT_EQ(0x2010801, item13.mField.getField());
-    EXPECT_EQ(Type::INT, item13.mValue.getType());
-    EXPECT_EQ(111, item13.mValue.int_value);
-
-    const FieldValue& item14 = event1.getValues()[14];
-    EXPECT_EQ(0x2010885, item14.mField.getField());
-    EXPECT_EQ(Type::FLOAT, item14.mValue.getType());
-    EXPECT_EQ(2.2f, item14.mValue.float_value);
-
-    const FieldValue& item15 = event1.getValues()[15];
-    EXPECT_EQ(0x2018901, item15.mField.getField());
-    EXPECT_EQ(Type::INT, item15.mValue.getType());
-    EXPECT_EQ(222, item15.mValue.int_value);
-
-    const FieldValue& item16 = event1.getValues()[16];
-    EXPECT_EQ(0x2018985, item16.mField.getField());
-    EXPECT_EQ(Type::FLOAT, item16.mValue.getType());
-    EXPECT_EQ(1.1f, item16.mValue.float_value);
-}
-
-TEST(LogEventTest, TestLogParsing2) {
-    LogEvent event1(1, 2000);
-
-    std::vector<AttributionNodeInternal> nodes;
-
-    event1.write("hello");
-
-    // repeated msg can be in the middle
-    AttributionNodeInternal node1;
-    node1.set_uid(1000);
-    node1.set_tag("tag1");
-    nodes.push_back(node1);
-
-    AttributionNodeInternal node2;
-    node2.set_uid(2000);
-    node2.set_tag("tag2");
-    nodes.push_back(node2);
-    event1.write(nodes);
-
-    event1.write((int32_t)10);
-    event1.write((int64_t)20);
-    event1.write((float)1.1);
-    event1.init();
-
-    const auto& items = event1.getValues();
-    EXPECT_EQ((size_t)8, items.size());
-    EXPECT_EQ(1, event1.GetTagId());
-
-    const FieldValue& item = event1.getValues()[0];
-    EXPECT_EQ(0x00010000, item.mField.getField());
-    EXPECT_EQ(Type::STRING, item.mValue.getType());
-    EXPECT_EQ("hello", item.mValue.str_value);
-
-    const FieldValue& item0 = event1.getValues()[1];
-    EXPECT_EQ(0x2020101, item0.mField.getField());
-    EXPECT_EQ(Type::INT, item0.mValue.getType());
-    EXPECT_EQ(1000, item0.mValue.int_value);
-
-    const FieldValue& item1 = event1.getValues()[2];
-    EXPECT_EQ(0x2020182, item1.mField.getField());
-    EXPECT_EQ(Type::STRING, item1.mValue.getType());
-    EXPECT_EQ("tag1", item1.mValue.str_value);
-
-    const FieldValue& item2 = event1.getValues()[3];
-    EXPECT_EQ(0x2028201, item2.mField.getField());
-    EXPECT_EQ(Type::INT, item2.mValue.getType());
-    EXPECT_EQ(2000, item2.mValue.int_value);
-
-    const FieldValue& item3 = event1.getValues()[4];
-    EXPECT_EQ(0x2028282, item3.mField.getField());
-    EXPECT_EQ(Type::STRING, item3.mValue.getType());
-    EXPECT_EQ("tag2", item3.mValue.str_value);
-
-    const FieldValue& item5 = event1.getValues()[5];
-    EXPECT_EQ(0x30000, item5.mField.getField());
-    EXPECT_EQ(Type::INT, item5.mValue.getType());
-    EXPECT_EQ(10, item5.mValue.int_value);
-
-    const FieldValue& item6 = event1.getValues()[6];
-    EXPECT_EQ(0x40000, item6.mField.getField());
-    EXPECT_EQ(Type::LONG, item6.mValue.getType());
-    EXPECT_EQ((int64_t)20, item6.mValue.long_value);
-
-    const FieldValue& item7 = event1.getValues()[7];
-    EXPECT_EQ(0x50000, item7.mField.getField());
-    EXPECT_EQ(Type::FLOAT, item7.mValue.getType());
-    EXPECT_EQ((float)1.1, item7.mValue.float_value);
-}
-
-TEST(LogEventTest, TestKeyValuePairsEvent) {
-    std::map<int32_t, int32_t> int_map;
-    std::map<int32_t, int64_t> long_map;
-    std::map<int32_t, std::string> string_map;
-    std::map<int32_t, float> float_map;
-
-    int_map[11] = 123;
-    int_map[22] = 345;
-
-    long_map[33] = 678L;
-    long_map[44] = 890L;
-
-    string_map[1] = "test2";
-    string_map[2] = "test1";
-
-    float_map[111] = 2.2f;
-    float_map[222] = 1.1f;
-
-    LogEvent event1(83, 2000, 2001, 10001, int_map, long_map, string_map, float_map);
-    event1.init();
-
-    EXPECT_EQ(83, event1.GetTagId());
-    EXPECT_EQ((int64_t)2000, event1.GetLogdTimestampNs());
-    EXPECT_EQ((int64_t)2001, event1.GetElapsedTimestampNs());
-    EXPECT_EQ((int64_t)10001, event1.GetUid());
-
-    const auto& items = event1.getValues();
-    EXPECT_EQ((size_t)17, items.size());
-
-    const FieldValue& item0 = event1.getValues()[0];
-    EXPECT_EQ(0x00010000, item0.mField.getField());
-    EXPECT_EQ(Type::INT, item0.mValue.getType());
-    EXPECT_EQ(10001, item0.mValue.int_value);
-
-    const FieldValue& item1 = event1.getValues()[1];
-    EXPECT_EQ(0x2020101, item1.mField.getField());
-    EXPECT_EQ(Type::INT, item1.mValue.getType());
-    EXPECT_EQ(11, item1.mValue.int_value);
-
-    const FieldValue& item2 = event1.getValues()[2];
-    EXPECT_EQ(0x2020182, item2.mField.getField());
-    EXPECT_EQ(Type::INT, item2.mValue.getType());
-    EXPECT_EQ(123, item2.mValue.int_value);
-
-    const FieldValue& item3 = event1.getValues()[3];
-    EXPECT_EQ(0x2020201, item3.mField.getField());
-    EXPECT_EQ(Type::INT, item3.mValue.getType());
-    EXPECT_EQ(22, item3.mValue.int_value);
-
-    const FieldValue& item4 = event1.getValues()[4];
-    EXPECT_EQ(0x2020282, item4.mField.getField());
-    EXPECT_EQ(Type::INT, item4.mValue.getType());
-    EXPECT_EQ(345, item4.mValue.int_value);
-
-    const FieldValue& item5 = event1.getValues()[5];
-    EXPECT_EQ(0x2020301, item5.mField.getField());
-    EXPECT_EQ(Type::INT, item5.mValue.getType());
-    EXPECT_EQ(33, item5.mValue.int_value);
-
-    const FieldValue& item6 = event1.getValues()[6];
-    EXPECT_EQ(0x2020383, item6.mField.getField());
-    EXPECT_EQ(Type::LONG, item6.mValue.getType());
-    EXPECT_EQ(678L, item6.mValue.long_value);
-
-    const FieldValue& item7 = event1.getValues()[7];
-    EXPECT_EQ(0x2020401, item7.mField.getField());
-    EXPECT_EQ(Type::INT, item7.mValue.getType());
-    EXPECT_EQ(44, item7.mValue.int_value);
-
-    const FieldValue& item8 = event1.getValues()[8];
-    EXPECT_EQ(0x2020483, item8.mField.getField());
-    EXPECT_EQ(Type::LONG, item8.mValue.getType());
-    EXPECT_EQ(890L, item8.mValue.long_value);
-
-    const FieldValue& item9 = event1.getValues()[9];
-    EXPECT_EQ(0x2020501, item9.mField.getField());
-    EXPECT_EQ(Type::INT, item9.mValue.getType());
-    EXPECT_EQ(1, item9.mValue.int_value);
-
-    const FieldValue& item10 = event1.getValues()[10];
-    EXPECT_EQ(0x2020584, item10.mField.getField());
-    EXPECT_EQ(Type::STRING, item10.mValue.getType());
-    EXPECT_EQ("test2", item10.mValue.str_value);
-
-    const FieldValue& item11 = event1.getValues()[11];
-    EXPECT_EQ(0x2020601, item11.mField.getField());
-    EXPECT_EQ(Type::INT, item11.mValue.getType());
-    EXPECT_EQ(2, item11.mValue.int_value);
-
-    const FieldValue& item12 = event1.getValues()[12];
-    EXPECT_EQ(0x2020684, item12.mField.getField());
-    EXPECT_EQ(Type::STRING, item12.mValue.getType());
-    EXPECT_EQ("test1", item12.mValue.str_value);
-
-    const FieldValue& item13 = event1.getValues()[13];
-    EXPECT_EQ(0x2020701, item13.mField.getField());
-    EXPECT_EQ(Type::INT, item13.mValue.getType());
-    EXPECT_EQ(111, item13.mValue.int_value);
-
-    const FieldValue& item14 = event1.getValues()[14];
-    EXPECT_EQ(0x2020785, item14.mField.getField());
-    EXPECT_EQ(Type::FLOAT, item14.mValue.getType());
-    EXPECT_EQ(2.2f, item14.mValue.float_value);
-
-    const FieldValue& item15 = event1.getValues()[15];
-    EXPECT_EQ(0x2028801, item15.mField.getField());
-    EXPECT_EQ(Type::INT, item15.mValue.getType());
-    EXPECT_EQ(222, item15.mValue.int_value);
-
-    const FieldValue& item16 = event1.getValues()[16];
-    EXPECT_EQ(0x2028885, item16.mField.getField());
-    EXPECT_EQ(Type::FLOAT, item16.mValue.getType());
-    EXPECT_EQ(1.1f, item16.mValue.float_value);
-}
-
-TEST(LogEventTest, TestBinaryFieldAtom) {
-    Atom launcherAtom;
-    auto launcher_event = launcherAtom.mutable_launcher_event();
-    launcher_event->set_action(stats::launcher::LauncherAction::LONGPRESS);
-    launcher_event->set_src_state(stats::launcher::LauncherState::OVERVIEW);
-    launcher_event->set_dst_state(stats::launcher::LauncherState::ALLAPPS);
-
-    auto extension = launcher_event->mutable_extension();
-
-    auto src_target = extension->add_src_target();
-    src_target->set_type(stats::launcher::LauncherTarget_Type_ITEM_TYPE);
-    src_target->set_item(stats::launcher::LauncherTarget_Item_FOLDER_ICON);
-
-    auto dst_target = extension->add_dst_target();
-    dst_target->set_type(stats::launcher::LauncherTarget_Type_ITEM_TYPE);
-    dst_target->set_item(stats::launcher::LauncherTarget_Item_WIDGET);
-
-    string extension_str;
-    extension->SerializeToString(&extension_str);
-
-    LogEvent event1(Atom::kLauncherEventFieldNumber, 1000);
-
-    event1.write((int32_t)stats::launcher::LauncherAction::LONGPRESS);
-    event1.write((int32_t)stats::launcher::LauncherState::OVERVIEW);
-    event1.write((int64_t)stats::launcher::LauncherState::ALLAPPS);
-    event1.writeBytes(extension_str);
-    event1.init();
-
-    ProtoOutputStream proto;
-    event1.ToProto(proto);
-
-    std::vector<uint8_t> outData;
-    outData.resize(proto.size());
-    size_t pos = 0;
-    sp<ProtoReader> reader = proto.data();
-    while (reader->readBuffer() != NULL) {
-        size_t toRead = reader->currentToRead();
-        std::memcpy(&(outData[pos]), reader->readBuffer(), toRead);
-        pos += toRead;
-        reader->move(toRead);
-    }
-
-    std::string result_str(outData.begin(), outData.end());
-    std::string orig_str;
-    launcherAtom.SerializeToString(&orig_str);
-
-    EXPECT_EQ(orig_str, result_str);
-}
-
-TEST(LogEventTest, TestBinaryFieldAtom_empty) {
-    Atom launcherAtom;
-    auto launcher_event = launcherAtom.mutable_launcher_event();
-    launcher_event->set_action(stats::launcher::LauncherAction::LONGPRESS);
-    launcher_event->set_src_state(stats::launcher::LauncherState::OVERVIEW);
-    launcher_event->set_dst_state(stats::launcher::LauncherState::ALLAPPS);
-
-    // empty string.
-    string extension_str;
-
-    LogEvent event1(Atom::kLauncherEventFieldNumber, 1000);
-
-    event1.write((int32_t)stats::launcher::LauncherAction::LONGPRESS);
-    event1.write((int32_t)stats::launcher::LauncherState::OVERVIEW);
-    event1.write((int64_t)stats::launcher::LauncherState::ALLAPPS);
-    event1.writeBytes(extension_str);
-    event1.init();
-
-    ProtoOutputStream proto;
-    event1.ToProto(proto);
-
-    std::vector<uint8_t> outData;
-    outData.resize(proto.size());
-    size_t pos = 0;
-    sp<ProtoReader> reader = proto.data();
-    while (reader->readBuffer() != NULL) {
-        size_t toRead = reader->currentToRead();
-        std::memcpy(&(outData[pos]), reader->readBuffer(), toRead);
-        pos += toRead;
-        reader->move(toRead);
-    }
-
-    std::string result_str(outData.begin(), outData.end());
-    std::string orig_str;
-    launcherAtom.SerializeToString(&orig_str);
-
-    EXPECT_EQ(orig_str, result_str);
-}
-
-TEST(LogEventTest, TestWriteExperimentIdsToProto) {
-    std::vector<int64_t> expIds;
-    expIds.push_back(5038);
-    std::vector<uint8_t> proto;
-
-    writeExperimentIdsToProto(expIds, &proto);
-
-    EXPECT_EQ(proto.size(), 3);
-    // Proto wire format for field ID 1, varint
-    EXPECT_EQ(proto[0], 0x08);
-    // varint of 5038, 2 bytes long
-    EXPECT_EQ(proto[1], 0xae);
-    EXPECT_EQ(proto[2], 0x27);
-}
-#endif // NEW_ENCODING_SCHEME
-
-
 }  // namespace statsd
 }  // namespace os
 }  // namespace android
diff --git a/cmds/statsd/tests/StatsLogProcessor_test.cpp b/cmds/statsd/tests/StatsLogProcessor_test.cpp
index 3d7e5c9..81d6f72 100644
--- a/cmds/statsd/tests/StatsLogProcessor_test.cpp
+++ b/cmds/statsd/tests/StatsLogProcessor_test.cpp
@@ -253,1415 +253,1416 @@
     EXPECT_EQ(2, report.annotation(0).field_int32());
 }
 
-TEST(StatsLogProcessorTest, TestOnDumpReportEraseData) {
-    // Setup a simple config.
-    StatsdConfig config;
-    config.add_allowed_log_source("AID_ROOT"); // LogEvent defaults to UID of root.
-    auto wakelockAcquireMatcher = CreateAcquireWakelockAtomMatcher();
-    *config.add_atom_matcher() = wakelockAcquireMatcher;
-
-    auto countMetric = config.add_count_metric();
-    countMetric->set_id(123456);
-    countMetric->set_what(wakelockAcquireMatcher.id());
-    countMetric->set_bucket(FIVE_MINUTES);
-
-    ConfigKey cfgKey;
-    sp<StatsLogProcessor> processor = CreateStatsLogProcessor(1, 1, config, cfgKey);
-
-    std::vector<AttributionNodeInternal> attributions1 = {CreateAttribution(111, "App1")};
-    auto event = CreateAcquireWakelockEvent(attributions1, "wl1", 2);
-    processor->OnLogEvent(event.get());
-
-    vector<uint8_t> bytes;
-    ConfigMetricsReportList output;
-
-    // Dump report WITHOUT erasing data.
-    processor->onDumpReport(cfgKey, 3, true, false /* Do NOT erase data. */, ADB_DUMP, FAST, &bytes);
-    output.ParseFromArray(bytes.data(), bytes.size());
-    EXPECT_EQ(output.reports_size(), 1);
-    EXPECT_EQ(output.reports(0).metrics_size(), 1);
-    EXPECT_EQ(output.reports(0).metrics(0).count_metrics().data_size(), 1);
-
-    // Dump report WITH erasing data. There should be data since we didn't previously erase it.
-    processor->onDumpReport(cfgKey, 4, true, true /* DO erase data. */, ADB_DUMP, FAST, &bytes);
-    output.ParseFromArray(bytes.data(), bytes.size());
-    EXPECT_EQ(output.reports_size(), 1);
-    EXPECT_EQ(output.reports(0).metrics_size(), 1);
-    EXPECT_EQ(output.reports(0).metrics(0).count_metrics().data_size(), 1);
-
-    // Dump report again. There should be no data since we erased it.
-    processor->onDumpReport(cfgKey, 5, true, true /* DO erase data. */, ADB_DUMP, FAST, &bytes);
-    output.ParseFromArray(bytes.data(), bytes.size());
-    // We don't care whether statsd has a report, as long as it has no count metrics in it.
-    bool noData = output.reports_size() == 0
-            || output.reports(0).metrics_size() == 0
-            || output.reports(0).metrics(0).count_metrics().data_size() == 0;
-    EXPECT_TRUE(noData);
-}
-
-TEST(StatsLogProcessorTest, TestActiveConfigMetricDiskWriteRead) {
-    int uid = 1111;
-
-    // Setup a simple config, no activation
-    StatsdConfig config1;
-    int64_t cfgId1 = 12341;
-    config1.set_id(cfgId1);
-    config1.add_allowed_log_source("AID_ROOT");  // LogEvent defaults to UID of root.
-    auto wakelockAcquireMatcher = CreateAcquireWakelockAtomMatcher();
-    *config1.add_atom_matcher() = wakelockAcquireMatcher;
-
-    long metricId1 = 1234561;
-    long metricId2 = 1234562;
-    auto countMetric1 = config1.add_count_metric();
-    countMetric1->set_id(metricId1);
-    countMetric1->set_what(wakelockAcquireMatcher.id());
-    countMetric1->set_bucket(FIVE_MINUTES);
-
-    auto countMetric2 = config1.add_count_metric();
-    countMetric2->set_id(metricId2);
-    countMetric2->set_what(wakelockAcquireMatcher.id());
-    countMetric2->set_bucket(FIVE_MINUTES);
-
-    ConfigKey cfgKey1(uid, cfgId1);
-
-    // Add another config, with two metrics, one with activation
-    StatsdConfig config2;
-    int64_t cfgId2 = 12342;
-    config2.set_id(cfgId2);
-    config2.add_allowed_log_source("AID_ROOT");  // LogEvent defaults to UID of root.
-    *config2.add_atom_matcher() = wakelockAcquireMatcher;
-
-    long metricId3 = 1234561;
-    long metricId4 = 1234562;
-
-    auto countMetric3 = config2.add_count_metric();
-    countMetric3->set_id(metricId3);
-    countMetric3->set_what(wakelockAcquireMatcher.id());
-    countMetric3->set_bucket(FIVE_MINUTES);
-
-    auto countMetric4 = config2.add_count_metric();
-    countMetric4->set_id(metricId4);
-    countMetric4->set_what(wakelockAcquireMatcher.id());
-    countMetric4->set_bucket(FIVE_MINUTES);
-
-    auto metric3Activation = config2.add_metric_activation();
-    metric3Activation->set_metric_id(metricId3);
-    metric3Activation->set_activation_type(ACTIVATE_IMMEDIATELY);
-    auto metric3ActivationTrigger = metric3Activation->add_event_activation();
-    metric3ActivationTrigger->set_atom_matcher_id(wakelockAcquireMatcher.id());
-    metric3ActivationTrigger->set_ttl_seconds(100);
-
-    ConfigKey cfgKey2(uid, cfgId2);
-
-    // Add another config, with two metrics, both with activations
-    StatsdConfig config3;
-    int64_t cfgId3 = 12343;
-    config3.set_id(cfgId3);
-    config3.add_allowed_log_source("AID_ROOT");  // LogEvent defaults to UID of root.
-    *config3.add_atom_matcher() = wakelockAcquireMatcher;
-
-    long metricId5 = 1234565;
-    long metricId6 = 1234566;
-    auto countMetric5 = config3.add_count_metric();
-    countMetric5->set_id(metricId5);
-    countMetric5->set_what(wakelockAcquireMatcher.id());
-    countMetric5->set_bucket(FIVE_MINUTES);
-
-    auto countMetric6 = config3.add_count_metric();
-    countMetric6->set_id(metricId6);
-    countMetric6->set_what(wakelockAcquireMatcher.id());
-    countMetric6->set_bucket(FIVE_MINUTES);
-
-    auto metric5Activation = config3.add_metric_activation();
-    metric5Activation->set_metric_id(metricId5);
-    metric5Activation->set_activation_type(ACTIVATE_IMMEDIATELY);
-    auto metric5ActivationTrigger = metric5Activation->add_event_activation();
-    metric5ActivationTrigger->set_atom_matcher_id(wakelockAcquireMatcher.id());
-    metric5ActivationTrigger->set_ttl_seconds(100);
-
-    auto metric6Activation = config3.add_metric_activation();
-    metric6Activation->set_metric_id(metricId6);
-    metric6Activation->set_activation_type(ACTIVATE_IMMEDIATELY);
-    auto metric6ActivationTrigger = metric6Activation->add_event_activation();
-    metric6ActivationTrigger->set_atom_matcher_id(wakelockAcquireMatcher.id());
-    metric6ActivationTrigger->set_ttl_seconds(200);
-
-    ConfigKey cfgKey3(uid, cfgId3);
-
-    sp<UidMap> m = new UidMap();
-    sp<StatsPullerManager> pullerManager = new StatsPullerManager();
-    sp<AlarmMonitor> anomalyAlarmMonitor;
-    sp<AlarmMonitor> subscriberAlarmMonitor;
-    vector<int64_t> activeConfigsBroadcast;
-
-    long timeBase1 = 1;
-    int broadcastCount = 0;
-    StatsLogProcessor processor(m, pullerManager, anomalyAlarmMonitor, subscriberAlarmMonitor,
-            timeBase1, [](const ConfigKey& key) { return true; },
-            [&uid, &broadcastCount, &activeConfigsBroadcast](const int& broadcastUid,
-                    const vector<int64_t>& activeConfigs) {
-                broadcastCount++;
-                EXPECT_EQ(broadcastUid, uid);
-                activeConfigsBroadcast.clear();
-                activeConfigsBroadcast.insert(activeConfigsBroadcast.end(),
-                        activeConfigs.begin(), activeConfigs.end());
-                return true;
-            });
-
-    processor.OnConfigUpdated(1, cfgKey1, config1);
-    processor.OnConfigUpdated(2, cfgKey2, config2);
-    processor.OnConfigUpdated(3, cfgKey3, config3);
-
-    EXPECT_EQ(3, processor.mMetricsManagers.size());
-
-    // Expect the first config and both metrics in it to be active.
-    auto it = processor.mMetricsManagers.find(cfgKey1);
-    EXPECT_TRUE(it != processor.mMetricsManagers.end());
-    auto& metricsManager1 = it->second;
-    EXPECT_TRUE(metricsManager1->isActive());
-
-    auto metricIt = metricsManager1->mAllMetricProducers.begin();
-    for (; metricIt != metricsManager1->mAllMetricProducers.end(); metricIt++) {
-        if ((*metricIt)->getMetricId() == metricId1) {
-            break;
-        }
-    }
-    EXPECT_TRUE(metricIt != metricsManager1->mAllMetricProducers.end());
-    auto& metricProducer1 = *metricIt;
-    EXPECT_TRUE(metricProducer1->isActive());
-
-    metricIt = metricsManager1->mAllMetricProducers.begin();
-    for (; metricIt != metricsManager1->mAllMetricProducers.end(); metricIt++) {
-        if ((*metricIt)->getMetricId() == metricId2) {
-            break;
-        }
-    }
-    EXPECT_TRUE(metricIt != metricsManager1->mAllMetricProducers.end());
-    auto& metricProducer2 = *metricIt;
-    EXPECT_TRUE(metricProducer2->isActive());
-
-    // Expect config 2 to be active. Metric 3 shouldn't be active, metric 4 should be active.
-    it = processor.mMetricsManagers.find(cfgKey2);
-    EXPECT_TRUE(it != processor.mMetricsManagers.end());
-    auto& metricsManager2 = it->second;
-    EXPECT_TRUE(metricsManager2->isActive());
-
-    metricIt = metricsManager2->mAllMetricProducers.begin();
-    for (; metricIt != metricsManager2->mAllMetricProducers.end(); metricIt++) {
-        if ((*metricIt)->getMetricId() == metricId3) {
-            break;
-        }
-    }
-    EXPECT_TRUE(metricIt != metricsManager2->mAllMetricProducers.end());
-    auto& metricProducer3 = *metricIt;
-    EXPECT_FALSE(metricProducer3->isActive());
-
-    metricIt = metricsManager2->mAllMetricProducers.begin();
-    for (; metricIt != metricsManager2->mAllMetricProducers.end(); metricIt++) {
-        if ((*metricIt)->getMetricId() == metricId4) {
-            break;
-        }
-    }
-    EXPECT_TRUE(metricIt != metricsManager2->mAllMetricProducers.end());
-    auto& metricProducer4 = *metricIt;
-    EXPECT_TRUE(metricProducer4->isActive());
-
-    // Expect the third config and both metrics in it to be inactive.
-    it = processor.mMetricsManagers.find(cfgKey3);
-    EXPECT_TRUE(it != processor.mMetricsManagers.end());
-    auto& metricsManager3 = it->second;
-    EXPECT_FALSE(metricsManager3->isActive());
-
-    metricIt = metricsManager3->mAllMetricProducers.begin();
-    for (; metricIt != metricsManager2->mAllMetricProducers.end(); metricIt++) {
-        if ((*metricIt)->getMetricId() == metricId5) {
-            break;
-        }
-    }
-    EXPECT_TRUE(metricIt != metricsManager3->mAllMetricProducers.end());
-    auto& metricProducer5 = *metricIt;
-    EXPECT_FALSE(metricProducer5->isActive());
-
-    metricIt = metricsManager3->mAllMetricProducers.begin();
-    for (; metricIt != metricsManager3->mAllMetricProducers.end(); metricIt++) {
-        if ((*metricIt)->getMetricId() == metricId6) {
-            break;
-        }
-    }
-    EXPECT_TRUE(metricIt != metricsManager3->mAllMetricProducers.end());
-    auto& metricProducer6 = *metricIt;
-    EXPECT_FALSE(metricProducer6->isActive());
-
-    // No broadcast for active configs should have happened yet.
-    EXPECT_EQ(broadcastCount, 0);
-
-    // Activate all 3 metrics that were not active.
-    std::vector<AttributionNodeInternal> attributions1 = {CreateAttribution(111, "App1")};
-    auto event = CreateAcquireWakelockEvent(attributions1, "wl1", 100 + timeBase1);
-    processor.OnLogEvent(event.get());
-
-    // Assert that all 3 configs are active.
-    EXPECT_TRUE(metricsManager1->isActive());
-    EXPECT_TRUE(metricsManager2->isActive());
-    EXPECT_TRUE(metricsManager3->isActive());
-
-    // A broadcast should have happened, and all 3 configs should be active in the broadcast.
-    EXPECT_EQ(broadcastCount, 1);
-    EXPECT_EQ(activeConfigsBroadcast.size(), 3);
-    EXPECT_TRUE(std::find(activeConfigsBroadcast.begin(), activeConfigsBroadcast.end(), cfgId1)
-            != activeConfigsBroadcast.end());
-    EXPECT_TRUE(std::find(activeConfigsBroadcast.begin(), activeConfigsBroadcast.end(), cfgId2)
-            != activeConfigsBroadcast.end());
-    EXPECT_TRUE(std::find(activeConfigsBroadcast.begin(), activeConfigsBroadcast.end(), cfgId3)
-            != activeConfigsBroadcast.end());
-
-    // When we shut down, metrics 3 & 5 have 100ns remaining, metric 6 has 100s + 100ns.
-    int64_t shutDownTime = timeBase1 + 100 * NS_PER_SEC;
-    processor.SaveActiveConfigsToDisk(shutDownTime);
-    const int64_t ttl3 = event->GetElapsedTimestampNs() +
-            metric3ActivationTrigger->ttl_seconds() * NS_PER_SEC - shutDownTime;
-    const int64_t ttl5 = event->GetElapsedTimestampNs() +
-            metric5ActivationTrigger->ttl_seconds() * NS_PER_SEC - shutDownTime;
-    const int64_t ttl6 = event->GetElapsedTimestampNs() +
-            metric6ActivationTrigger->ttl_seconds() * NS_PER_SEC - shutDownTime;
-
-    // Create a second StatsLogProcessor and push the same 3 configs.
-    long timeBase2 = 1000;
-    sp<StatsLogProcessor> processor2 =
-            CreateStatsLogProcessor(timeBase2, timeBase2, config1, cfgKey1);
-    processor2->OnConfigUpdated(timeBase2, cfgKey2, config2);
-    processor2->OnConfigUpdated(timeBase2, cfgKey3, config3);
-
-    EXPECT_EQ(3, processor2->mMetricsManagers.size());
-
-    // First config and both metrics are active.
-    it = processor2->mMetricsManagers.find(cfgKey1);
-    EXPECT_TRUE(it != processor2->mMetricsManagers.end());
-    auto& metricsManager1001 = it->second;
-    EXPECT_TRUE(metricsManager1001->isActive());
-
-    metricIt = metricsManager1001->mAllMetricProducers.begin();
-    for (; metricIt != metricsManager1001->mAllMetricProducers.end(); metricIt++) {
-        if ((*metricIt)->getMetricId() == metricId1) {
-            break;
-        }
-    }
-    EXPECT_TRUE(metricIt != metricsManager1001->mAllMetricProducers.end());
-    auto& metricProducer1001 = *metricIt;
-    EXPECT_TRUE(metricProducer1001->isActive());
-
-    metricIt = metricsManager1001->mAllMetricProducers.begin();
-    for (; metricIt != metricsManager1001->mAllMetricProducers.end(); metricIt++) {
-        if ((*metricIt)->getMetricId() == metricId2) {
-            break;
-        }
-    }
-    EXPECT_TRUE(metricIt != metricsManager1001->mAllMetricProducers.end());
-    auto& metricProducer1002 = *metricIt;
-    EXPECT_TRUE(metricProducer1002->isActive());
-
-    // Second config is active. Metric 3 is inactive, metric 4 is active.
-    it = processor2->mMetricsManagers.find(cfgKey2);
-    EXPECT_TRUE(it != processor2->mMetricsManagers.end());
-    auto& metricsManager1002 = it->second;
-    EXPECT_TRUE(metricsManager1002->isActive());
-
-    metricIt = metricsManager1002->mAllMetricProducers.begin();
-    for (; metricIt != metricsManager1002->mAllMetricProducers.end(); metricIt++) {
-        if ((*metricIt)->getMetricId() == metricId3) {
-            break;
-        }
-    }
-    EXPECT_TRUE(metricIt != metricsManager1002->mAllMetricProducers.end());
-    auto& metricProducer1003 = *metricIt;
-    EXPECT_FALSE(metricProducer1003->isActive());
-
-    metricIt = metricsManager1002->mAllMetricProducers.begin();
-    for (; metricIt != metricsManager1002->mAllMetricProducers.end(); metricIt++) {
-        if ((*metricIt)->getMetricId() == metricId4) {
-            break;
-        }
-    }
-    EXPECT_TRUE(metricIt != metricsManager1002->mAllMetricProducers.end());
-    auto& metricProducer1004 = *metricIt;
-    EXPECT_TRUE(metricProducer1004->isActive());
-
-    // Config 3 is inactive. both metrics are inactive.
-    it = processor2->mMetricsManagers.find(cfgKey3);
-    EXPECT_TRUE(it != processor2->mMetricsManagers.end());
-    auto& metricsManager1003 = it->second;
-    EXPECT_FALSE(metricsManager1003->isActive());
-    EXPECT_EQ(2, metricsManager1003->mAllMetricProducers.size());
-
-    metricIt = metricsManager1003->mAllMetricProducers.begin();
-    for (; metricIt != metricsManager1002->mAllMetricProducers.end(); metricIt++) {
-        if ((*metricIt)->getMetricId() == metricId5) {
-            break;
-        }
-    }
-    EXPECT_TRUE(metricIt != metricsManager1003->mAllMetricProducers.end());
-    auto& metricProducer1005 = *metricIt;
-    EXPECT_FALSE(metricProducer1005->isActive());
-
-    metricIt = metricsManager1003->mAllMetricProducers.begin();
-    for (; metricIt != metricsManager1003->mAllMetricProducers.end(); metricIt++) {
-        if ((*metricIt)->getMetricId() == metricId6) {
-            break;
-        }
-    }
-    EXPECT_TRUE(metricIt != metricsManager1003->mAllMetricProducers.end());
-    auto& metricProducer1006 = *metricIt;
-    EXPECT_FALSE(metricProducer1006->isActive());
-
-    // Assert that all 3 metrics with activation are inactive and that the ttls were properly set.
-    EXPECT_FALSE(metricProducer1003->isActive());
-    const auto& activation1003 = metricProducer1003->mEventActivationMap.begin()->second;
-    EXPECT_EQ(100 * NS_PER_SEC, activation1003->ttl_ns);
-    EXPECT_EQ(0, activation1003->start_ns);
-    EXPECT_FALSE(metricProducer1005->isActive());
-    const auto& activation1005 = metricProducer1005->mEventActivationMap.begin()->second;
-    EXPECT_EQ(100 * NS_PER_SEC, activation1005->ttl_ns);
-    EXPECT_EQ(0, activation1005->start_ns);
-    EXPECT_FALSE(metricProducer1006->isActive());
-    const auto& activation1006 = metricProducer1006->mEventActivationMap.begin()->second;
-    EXPECT_EQ(200 * NS_PER_SEC, activation1006->ttl_ns);
-    EXPECT_EQ(0, activation1006->start_ns);
-
-    processor2->LoadActiveConfigsFromDisk();
-
-    // After loading activations from disk, assert that all 3 metrics are active.
-    EXPECT_TRUE(metricProducer1003->isActive());
-    EXPECT_EQ(timeBase2 + ttl3 - activation1003->ttl_ns, activation1003->start_ns);
-    EXPECT_TRUE(metricProducer1005->isActive());
-    EXPECT_EQ(timeBase2 + ttl5 - activation1005->ttl_ns, activation1005->start_ns);
-    EXPECT_TRUE(metricProducer1006->isActive());
-    EXPECT_EQ(timeBase2 + ttl6 - activation1006->ttl_ns, activation1003->start_ns);
-
-    // Make sure no more broadcasts have happened.
-    EXPECT_EQ(broadcastCount, 1);
-}
-
-TEST(StatsLogProcessorTest, TestActivationOnBoot) {
-    int uid = 1111;
-
-    StatsdConfig config1;
-    config1.set_id(12341);
-    config1.add_allowed_log_source("AID_ROOT");  // LogEvent defaults to UID of root.
-    auto wakelockAcquireMatcher = CreateAcquireWakelockAtomMatcher();
-    *config1.add_atom_matcher() = wakelockAcquireMatcher;
-
-    long metricId1 = 1234561;
-    long metricId2 = 1234562;
-    auto countMetric1 = config1.add_count_metric();
-    countMetric1->set_id(metricId1);
-    countMetric1->set_what(wakelockAcquireMatcher.id());
-    countMetric1->set_bucket(FIVE_MINUTES);
-
-    auto countMetric2 = config1.add_count_metric();
-    countMetric2->set_id(metricId2);
-    countMetric2->set_what(wakelockAcquireMatcher.id());
-    countMetric2->set_bucket(FIVE_MINUTES);
-
-    auto metric1Activation = config1.add_metric_activation();
-    metric1Activation->set_metric_id(metricId1);
-    metric1Activation->set_activation_type(ACTIVATE_ON_BOOT);
-    auto metric1ActivationTrigger = metric1Activation->add_event_activation();
-    metric1ActivationTrigger->set_atom_matcher_id(wakelockAcquireMatcher.id());
-    metric1ActivationTrigger->set_ttl_seconds(100);
-
-    ConfigKey cfgKey1(uid, 12341);
-    long timeBase1 = 1;
-    sp<StatsLogProcessor> processor =
-            CreateStatsLogProcessor(timeBase1, timeBase1, config1, cfgKey1);
-
-    EXPECT_EQ(1, processor->mMetricsManagers.size());
-    auto it = processor->mMetricsManagers.find(cfgKey1);
-    EXPECT_TRUE(it != processor->mMetricsManagers.end());
-    auto& metricsManager1 = it->second;
-    EXPECT_TRUE(metricsManager1->isActive());
-
-    auto metricIt = metricsManager1->mAllMetricProducers.begin();
-    for (; metricIt != metricsManager1->mAllMetricProducers.end(); metricIt++) {
-        if ((*metricIt)->getMetricId() == metricId1) {
-            break;
-        }
-    }
-    EXPECT_TRUE(metricIt != metricsManager1->mAllMetricProducers.end());
-    auto& metricProducer1 = *metricIt;
-    EXPECT_FALSE(metricProducer1->isActive());
-
-    metricIt = metricsManager1->mAllMetricProducers.begin();
-    for (; metricIt != metricsManager1->mAllMetricProducers.end(); metricIt++) {
-        if ((*metricIt)->getMetricId() == metricId2) {
-            break;
-        }
-    }
-    EXPECT_TRUE(metricIt != metricsManager1->mAllMetricProducers.end());
-    auto& metricProducer2 = *metricIt;
-    EXPECT_TRUE(metricProducer2->isActive());
-
-    const auto& activation1 = metricProducer1->mEventActivationMap.begin()->second;
-    EXPECT_EQ(100 * NS_PER_SEC, activation1->ttl_ns);
-    EXPECT_EQ(0, activation1->start_ns);
-    EXPECT_EQ(kNotActive, activation1->state);
-
-    std::vector<AttributionNodeInternal> attributions1 = {CreateAttribution(111, "App1")};
-    auto event = CreateAcquireWakelockEvent(attributions1, "wl1", 100 + timeBase1);
-    processor->OnLogEvent(event.get());
-
-    EXPECT_FALSE(metricProducer1->isActive());
-    EXPECT_EQ(0, activation1->start_ns);
-    EXPECT_EQ(kActiveOnBoot, activation1->state);
-
-    int64_t shutDownTime = timeBase1 + 100 * NS_PER_SEC;
-    processor->SaveActiveConfigsToDisk(shutDownTime);
-    EXPECT_FALSE(metricProducer1->isActive());
-    const int64_t ttl1 = metric1ActivationTrigger->ttl_seconds() * NS_PER_SEC;
-
-    long timeBase2 = 1000;
-    sp<StatsLogProcessor> processor2 =
-            CreateStatsLogProcessor(timeBase2, timeBase2, config1, cfgKey1);
-
-    EXPECT_EQ(1, processor2->mMetricsManagers.size());
-    it = processor2->mMetricsManagers.find(cfgKey1);
-    EXPECT_TRUE(it != processor2->mMetricsManagers.end());
-    auto& metricsManager1001 = it->second;
-    EXPECT_TRUE(metricsManager1001->isActive());
-
-    metricIt = metricsManager1001->mAllMetricProducers.begin();
-    for (; metricIt != metricsManager1001->mAllMetricProducers.end(); metricIt++) {
-        if ((*metricIt)->getMetricId() == metricId1) {
-            break;
-        }
-    }
-    EXPECT_TRUE(metricIt != metricsManager1001->mAllMetricProducers.end());
-    auto& metricProducer1001 = *metricIt;
-    EXPECT_FALSE(metricProducer1001->isActive());
-
-    metricIt = metricsManager1001->mAllMetricProducers.begin();
-    for (; metricIt != metricsManager1001->mAllMetricProducers.end(); metricIt++) {
-        if ((*metricIt)->getMetricId() == metricId2) {
-            break;
-        }
-    }
-    EXPECT_TRUE(metricIt != metricsManager1001->mAllMetricProducers.end());
-    auto& metricProducer1002 = *metricIt;
-    EXPECT_TRUE(metricProducer1002->isActive());
-
-    const auto& activation1001 = metricProducer1001->mEventActivationMap.begin()->second;
-    EXPECT_EQ(100 * NS_PER_SEC, activation1001->ttl_ns);
-    EXPECT_EQ(0, activation1001->start_ns);
-    EXPECT_EQ(kNotActive, activation1001->state);
-
-    processor2->LoadActiveConfigsFromDisk();
-
-    EXPECT_TRUE(metricProducer1001->isActive());
-    EXPECT_EQ(timeBase2 + ttl1 - activation1001->ttl_ns, activation1001->start_ns);
-    EXPECT_EQ(kActive, activation1001->state);
-}
-
-TEST(StatsLogProcessorTest, TestActivationOnBootMultipleActivations) {
-    int uid = 1111;
-
-    // Create config with 2 metrics:
-    // Metric 1: Activate on boot with 2 activations
-    // Metric 2: Always active
-    StatsdConfig config1;
-    config1.set_id(12341);
-    config1.add_allowed_log_source("AID_ROOT");  // LogEvent defaults to UID of root.
-    auto wakelockAcquireMatcher = CreateAcquireWakelockAtomMatcher();
-    auto screenOnMatcher = CreateScreenTurnedOnAtomMatcher();
-    *config1.add_atom_matcher() = wakelockAcquireMatcher;
-    *config1.add_atom_matcher() = screenOnMatcher;
-
-    long metricId1 = 1234561;
-    long metricId2 = 1234562;
-
-    auto countMetric1 = config1.add_count_metric();
-    countMetric1->set_id(metricId1);
-    countMetric1->set_what(wakelockAcquireMatcher.id());
-    countMetric1->set_bucket(FIVE_MINUTES);
-
-    auto countMetric2 = config1.add_count_metric();
-    countMetric2->set_id(metricId2);
-    countMetric2->set_what(wakelockAcquireMatcher.id());
-    countMetric2->set_bucket(FIVE_MINUTES);
-
-    auto metric1Activation = config1.add_metric_activation();
-    metric1Activation->set_metric_id(metricId1);
-    metric1Activation->set_activation_type(ACTIVATE_ON_BOOT);
-    auto metric1ActivationTrigger1 = metric1Activation->add_event_activation();
-    metric1ActivationTrigger1->set_atom_matcher_id(wakelockAcquireMatcher.id());
-    metric1ActivationTrigger1->set_ttl_seconds(100);
-    auto metric1ActivationTrigger2 = metric1Activation->add_event_activation();
-    metric1ActivationTrigger2->set_atom_matcher_id(screenOnMatcher.id());
-    metric1ActivationTrigger2->set_ttl_seconds(200);
-
-    ConfigKey cfgKey1(uid, 12341);
-    long timeBase1 = 1;
-    sp<StatsLogProcessor> processor =
-            CreateStatsLogProcessor(timeBase1, timeBase1, config1, cfgKey1);
-
-    // Metric 1 is not active.
-    // Metric 2 is active.
-    // {{{---------------------------------------------------------------------------
-    EXPECT_EQ(1, processor->mMetricsManagers.size());
-    auto it = processor->mMetricsManagers.find(cfgKey1);
-    EXPECT_TRUE(it != processor->mMetricsManagers.end());
-    auto& metricsManager1 = it->second;
-    EXPECT_TRUE(metricsManager1->isActive());
-
-    auto metricIt = metricsManager1->mAllMetricProducers.begin();
-    for (; metricIt != metricsManager1->mAllMetricProducers.end(); metricIt++) {
-        if ((*metricIt)->getMetricId() == metricId1) {
-            break;
-        }
-    }
-    EXPECT_TRUE(metricIt != metricsManager1->mAllMetricProducers.end());
-    auto& metricProducer1 = *metricIt;
-    EXPECT_FALSE(metricProducer1->isActive());
-
-    metricIt = metricsManager1->mAllMetricProducers.begin();
-    for (; metricIt != metricsManager1->mAllMetricProducers.end(); metricIt++) {
-        if ((*metricIt)->getMetricId() == metricId2) {
-            break;
-        }
-    }
-    EXPECT_TRUE(metricIt != metricsManager1->mAllMetricProducers.end());
-    auto& metricProducer2 = *metricIt;
-    EXPECT_TRUE(metricProducer2->isActive());
-
-    int i = 0;
-    for (; i < metricsManager1->mAllAtomMatchers.size(); i++) {
-        if (metricsManager1->mAllAtomMatchers[i]->getId() ==
-                metric1ActivationTrigger1->atom_matcher_id()) {
-            break;
-        }
-    }
-    const auto& activation1 = metricProducer1->mEventActivationMap.at(i);
-    EXPECT_EQ(100 * NS_PER_SEC, activation1->ttl_ns);
-    EXPECT_EQ(0, activation1->start_ns);
-    EXPECT_EQ(kNotActive, activation1->state);
-
-    i = 0;
-    for (; i < metricsManager1->mAllAtomMatchers.size(); i++) {
-        if (metricsManager1->mAllAtomMatchers[i]->getId() ==
-                metric1ActivationTrigger2->atom_matcher_id()) {
-            break;
-        }
-    }
-    const auto& activation2 = metricProducer1->mEventActivationMap.at(i);
-    EXPECT_EQ(200 * NS_PER_SEC, activation2->ttl_ns);
-    EXPECT_EQ(0, activation2->start_ns);
-    EXPECT_EQ(kNotActive, activation2->state);
-    // }}}------------------------------------------------------------------------------
-
-    // Trigger Activation 1 for Metric 1
-    std::vector<AttributionNodeInternal> attributions1 = {CreateAttribution(111, "App1")};
-    auto event = CreateAcquireWakelockEvent(attributions1, "wl1", 100 + timeBase1);
-    processor->OnLogEvent(event.get());
-
-    // Metric 1 is not active; Activation 1 set to kActiveOnBoot
-    // Metric 2 is active.
-    // {{{---------------------------------------------------------------------------
-    EXPECT_FALSE(metricProducer1->isActive());
-    EXPECT_EQ(0, activation1->start_ns);
-    EXPECT_EQ(kActiveOnBoot, activation1->state);
-    EXPECT_EQ(0, activation2->start_ns);
-    EXPECT_EQ(kNotActive, activation2->state);
-
-    EXPECT_TRUE(metricProducer2->isActive());
-    // }}}-----------------------------------------------------------------------------
-
-    // Simulate shutdown by saving state to disk
-    int64_t shutDownTime = timeBase1 + 100 * NS_PER_SEC;
-    processor->SaveActiveConfigsToDisk(shutDownTime);
-    EXPECT_FALSE(metricProducer1->isActive());
-    int64_t ttl1 = metric1ActivationTrigger1->ttl_seconds() * NS_PER_SEC;
-
-    // Simulate device restarted state by creating new instance of StatsLogProcessor with the
-    // same config.
-    long timeBase2 = 1000;
-    sp<StatsLogProcessor> processor2 =
-            CreateStatsLogProcessor(timeBase2, timeBase2, config1, cfgKey1);
-
-    // Metric 1 is not active.
-    // Metric 2 is active.
-    // {{{---------------------------------------------------------------------------
-    EXPECT_EQ(1, processor2->mMetricsManagers.size());
-    it = processor2->mMetricsManagers.find(cfgKey1);
-    EXPECT_TRUE(it != processor2->mMetricsManagers.end());
-    auto& metricsManager1001 = it->second;
-    EXPECT_TRUE(metricsManager1001->isActive());
-
-    metricIt = metricsManager1001->mAllMetricProducers.begin();
-    for (; metricIt != metricsManager1001->mAllMetricProducers.end(); metricIt++) {
-        if ((*metricIt)->getMetricId() == metricId1) {
-            break;
-        }
-    }
-    EXPECT_TRUE(metricIt != metricsManager1001->mAllMetricProducers.end());
-    auto& metricProducer1001 = *metricIt;
-    EXPECT_FALSE(metricProducer1001->isActive());
-
-    metricIt = metricsManager1001->mAllMetricProducers.begin();
-    for (; metricIt != metricsManager1001->mAllMetricProducers.end(); metricIt++) {
-        if ((*metricIt)->getMetricId() == metricId2) {
-            break;
-        }
-    }
-    EXPECT_TRUE(metricIt != metricsManager1001->mAllMetricProducers.end());
-    auto& metricProducer1002 = *metricIt;
-    EXPECT_TRUE(metricProducer1002->isActive());
-
-    i = 0;
-    for (; i < metricsManager1001->mAllAtomMatchers.size(); i++) {
-        if (metricsManager1001->mAllAtomMatchers[i]->getId() ==
-                metric1ActivationTrigger1->atom_matcher_id()) {
-            break;
-        }
-    }
-    const auto& activation1001_1 = metricProducer1001->mEventActivationMap.at(i);
-    EXPECT_EQ(100 * NS_PER_SEC, activation1001_1->ttl_ns);
-    EXPECT_EQ(0, activation1001_1->start_ns);
-    EXPECT_EQ(kNotActive, activation1001_1->state);
-
-    i = 0;
-    for (; i < metricsManager1001->mAllAtomMatchers.size(); i++) {
-        if (metricsManager1001->mAllAtomMatchers[i]->getId() ==
-                metric1ActivationTrigger2->atom_matcher_id()) {
-            break;
-        }
-    }
-
-    const auto& activation1001_2 = metricProducer1001->mEventActivationMap.at(i);
-    EXPECT_EQ(200 * NS_PER_SEC, activation1001_2->ttl_ns);
-    EXPECT_EQ(0, activation1001_2->start_ns);
-    EXPECT_EQ(kNotActive, activation1001_2->state);
-    // }}}-----------------------------------------------------------------------------------
-
-    // Load saved state from disk.
-    processor2->LoadActiveConfigsFromDisk();
-
-    // Metric 1 active; Activation 1 is active, Activation 2 is not active
-    // Metric 2 is active.
-    // {{{---------------------------------------------------------------------------
-    EXPECT_TRUE(metricProducer1001->isActive());
-    EXPECT_EQ(timeBase2 + ttl1 - activation1001_1->ttl_ns, activation1001_1->start_ns);
-    EXPECT_EQ(kActive, activation1001_1->state);
-    EXPECT_EQ(0, activation1001_2->start_ns);
-    EXPECT_EQ(kNotActive, activation1001_2->state);
-
-    EXPECT_TRUE(metricProducer1002->isActive());
-    // }}}--------------------------------------------------------------------------------
-
-    // Trigger Activation 2 for Metric 1.
-    auto screenOnEvent = CreateScreenStateChangedEvent(
-            android::view::DISPLAY_STATE_ON,
-            timeBase2 + 200
-    );
-    processor2->OnLogEvent(screenOnEvent.get());
-
-    // Metric 1 active; Activation 1 is active, Activation 2 is set to kActiveOnBoot
-    // Metric 2 is active.
-    // {{{---------------------------------------------------------------------------
-    EXPECT_TRUE(metricProducer1001->isActive());
-    EXPECT_EQ(timeBase2 + ttl1 - activation1001_1->ttl_ns, activation1001_1->start_ns);
-    EXPECT_EQ(kActive, activation1001_1->state);
-    EXPECT_EQ(0, activation1001_2->start_ns);
-    EXPECT_EQ(kActiveOnBoot, activation1001_2->state);
-
-    EXPECT_TRUE(metricProducer1002->isActive());
-    // }}}---------------------------------------------------------------------------
-
-    // Simulate shutdown by saving state to disk
-    shutDownTime = timeBase2 + 50 * NS_PER_SEC;
-    processor2->SaveActiveConfigsToDisk(shutDownTime);
-    EXPECT_TRUE(metricProducer1001->isActive());
-    EXPECT_TRUE(metricProducer1002->isActive());
-    ttl1 = timeBase2 + metric1ActivationTrigger1->ttl_seconds() * NS_PER_SEC - shutDownTime;
-    int64_t ttl2 = metric1ActivationTrigger2->ttl_seconds() * NS_PER_SEC;
-
-    // Simulate device restarted state by creating new instance of StatsLogProcessor with the
-    // same config.
-    long timeBase3 = timeBase2 + 120 * NS_PER_SEC;
-    sp<StatsLogProcessor> processor3 =
-            CreateStatsLogProcessor(timeBase3, timeBase3, config1, cfgKey1);
-
-    // Metric 1 is not active.
-    // Metric 2 is active.
-    // {{{---------------------------------------------------------------------------
-    EXPECT_EQ(1, processor3->mMetricsManagers.size());
-    it = processor3->mMetricsManagers.find(cfgKey1);
-    EXPECT_TRUE(it != processor3->mMetricsManagers.end());
-    auto& metricsManagerTimeBase3 = it->second;
-    EXPECT_TRUE(metricsManagerTimeBase3->isActive());
-
-    metricIt = metricsManagerTimeBase3->mAllMetricProducers.begin();
-    for (; metricIt != metricsManagerTimeBase3->mAllMetricProducers.end(); metricIt++) {
-        if ((*metricIt)->getMetricId() == metricId1) {
-            break;
-        }
-    }
-    EXPECT_TRUE(metricIt != metricsManagerTimeBase3->mAllMetricProducers.end());
-    auto& metricProducerTimeBase3_1 = *metricIt;
-    EXPECT_FALSE(metricProducerTimeBase3_1->isActive());
-
-    metricIt = metricsManagerTimeBase3->mAllMetricProducers.begin();
-    for (; metricIt != metricsManagerTimeBase3->mAllMetricProducers.end(); metricIt++) {
-        if ((*metricIt)->getMetricId() == metricId2) {
-            break;
-        }
-    }
-    EXPECT_TRUE(metricIt != metricsManagerTimeBase3->mAllMetricProducers.end());
-    auto& metricProducerTimeBase3_2 = *metricIt;
-    EXPECT_TRUE(metricProducerTimeBase3_2->isActive());
-
-    i = 0;
-    for (; i < metricsManagerTimeBase3->mAllAtomMatchers.size(); i++) {
-        if (metricsManagerTimeBase3->mAllAtomMatchers[i]->getId() ==
-                metric1ActivationTrigger1->atom_matcher_id()) {
-            break;
-        }
-    }
-    const auto& activationTimeBase3_1 = metricProducerTimeBase3_1->mEventActivationMap.at(i);
-    EXPECT_EQ(100 * NS_PER_SEC, activationTimeBase3_1->ttl_ns);
-    EXPECT_EQ(0, activationTimeBase3_1->start_ns);
-    EXPECT_EQ(kNotActive, activationTimeBase3_1->state);
-
-    i = 0;
-    for (; i < metricsManagerTimeBase3->mAllAtomMatchers.size(); i++) {
-        if (metricsManagerTimeBase3->mAllAtomMatchers[i]->getId() ==
-                metric1ActivationTrigger2->atom_matcher_id()) {
-            break;
-        }
-    }
-
-    const auto& activationTimeBase3_2 = metricProducerTimeBase3_1->mEventActivationMap.at(i);
-    EXPECT_EQ(200 * NS_PER_SEC, activationTimeBase3_2->ttl_ns);
-    EXPECT_EQ(0, activationTimeBase3_2->start_ns);
-    EXPECT_EQ(kNotActive, activationTimeBase3_2->state);
-
-    EXPECT_TRUE(metricProducerTimeBase3_2->isActive());
-    // }}}----------------------------------------------------------------------------------
-
-    // Load saved state from disk.
-    processor3->LoadActiveConfigsFromDisk();
-
-    // Metric 1 active: Activation 1 is active, Activation 2 is active
-    // Metric 2 is active.
-    // {{{---------------------------------------------------------------------------
-    EXPECT_TRUE(metricProducerTimeBase3_1->isActive());
-    EXPECT_EQ(timeBase3 + ttl1 - activationTimeBase3_1->ttl_ns, activationTimeBase3_1->start_ns);
-    EXPECT_EQ(kActive, activationTimeBase3_1->state);
-    EXPECT_EQ(timeBase3 + ttl2 - activationTimeBase3_2->ttl_ns, activationTimeBase3_2->start_ns);
-    EXPECT_EQ(kActive, activationTimeBase3_2->state);
-
-    EXPECT_TRUE(metricProducerTimeBase3_2->isActive());
-    // }}}-------------------------------------------------------------------------------
-
-    // Trigger Activation 2 for Metric 1 again.
-    screenOnEvent = CreateScreenStateChangedEvent(
-            android::view::DISPLAY_STATE_ON,
-            timeBase3 + 100 * NS_PER_SEC
-    );
-    processor3->OnLogEvent(screenOnEvent.get());
-
-    // Metric 1 active; Activation 1 is not active, Activation 2 is set to active
-    // Metric 2 is active.
-    // {{{---------------------------------------------------------------------------
-    EXPECT_TRUE(metricProducerTimeBase3_1->isActive());
-    EXPECT_EQ(kNotActive, activationTimeBase3_1->state);
-    EXPECT_EQ(timeBase3 + ttl2 - activationTimeBase3_2->ttl_ns, activationTimeBase3_2->start_ns);
-    EXPECT_EQ(kActive, activationTimeBase3_2->state);
-
-    EXPECT_TRUE(metricProducerTimeBase3_2->isActive());
-    // }}}---------------------------------------------------------------------------
-
-    // Simulate shutdown by saving state to disk.
-    shutDownTime = timeBase3 + 500 * NS_PER_SEC;
-    processor3->SaveActiveConfigsToDisk(shutDownTime);
-    EXPECT_TRUE(metricProducer1001->isActive());
-    EXPECT_TRUE(metricProducer1002->isActive());
-    ttl1 = timeBase3 + ttl1 - shutDownTime;
-    ttl2 = timeBase3 + metric1ActivationTrigger2->ttl_seconds() * NS_PER_SEC - shutDownTime;
-
-    // Simulate device restarted state by creating new instance of StatsLogProcessor with the
-    // same config.
-    long timeBase4 = timeBase3 + 600 * NS_PER_SEC;
-    sp<StatsLogProcessor> processor4 =
-            CreateStatsLogProcessor(timeBase4, timeBase4, config1, cfgKey1);
-
-    // Metric 1 is not active.
-    // Metric 2 is active.
-    // {{{---------------------------------------------------------------------------
-    EXPECT_EQ(1, processor4->mMetricsManagers.size());
-    it = processor4->mMetricsManagers.find(cfgKey1);
-    EXPECT_TRUE(it != processor4->mMetricsManagers.end());
-    auto& metricsManagerTimeBase4 = it->second;
-    EXPECT_TRUE(metricsManagerTimeBase4->isActive());
-
-    metricIt = metricsManagerTimeBase4->mAllMetricProducers.begin();
-    for (; metricIt != metricsManagerTimeBase4->mAllMetricProducers.end(); metricIt++) {
-        if ((*metricIt)->getMetricId() == metricId1) {
-            break;
-        }
-    }
-    EXPECT_TRUE(metricIt != metricsManagerTimeBase4->mAllMetricProducers.end());
-    auto& metricProducerTimeBase4_1 = *metricIt;
-    EXPECT_FALSE(metricProducerTimeBase4_1->isActive());
-
-    metricIt = metricsManagerTimeBase4->mAllMetricProducers.begin();
-    for (; metricIt != metricsManagerTimeBase4->mAllMetricProducers.end(); metricIt++) {
-        if ((*metricIt)->getMetricId() == metricId2) {
-            break;
-        }
-    }
-    EXPECT_TRUE(metricIt != metricsManagerTimeBase4->mAllMetricProducers.end());
-    auto& metricProducerTimeBase4_2 = *metricIt;
-    EXPECT_TRUE(metricProducerTimeBase4_2->isActive());
-
-    i = 0;
-    for (; i < metricsManagerTimeBase4->mAllAtomMatchers.size(); i++) {
-        if (metricsManagerTimeBase4->mAllAtomMatchers[i]->getId() ==
-                metric1ActivationTrigger1->atom_matcher_id()) {
-            break;
-        }
-    }
-    const auto& activationTimeBase4_1 = metricProducerTimeBase4_1->mEventActivationMap.at(i);
-    EXPECT_EQ(100 * NS_PER_SEC, activationTimeBase4_1->ttl_ns);
-    EXPECT_EQ(0, activationTimeBase4_1->start_ns);
-    EXPECT_EQ(kNotActive, activationTimeBase4_1->state);
-
-    i = 0;
-    for (; i < metricsManagerTimeBase4->mAllAtomMatchers.size(); i++) {
-        if (metricsManagerTimeBase4->mAllAtomMatchers[i]->getId() ==
-                metric1ActivationTrigger2->atom_matcher_id()) {
-            break;
-        }
-    }
-
-    const auto& activationTimeBase4_2 = metricProducerTimeBase4_1->mEventActivationMap.at(i);
-    EXPECT_EQ(200 * NS_PER_SEC, activationTimeBase4_2->ttl_ns);
-    EXPECT_EQ(0, activationTimeBase4_2->start_ns);
-    EXPECT_EQ(kNotActive, activationTimeBase4_2->state);
-
-    EXPECT_TRUE(metricProducerTimeBase4_2->isActive());
-    // }}}----------------------------------------------------------------------------------
-
-    // Load saved state from disk.
-    processor4->LoadActiveConfigsFromDisk();
-
-    // Metric 1 active: Activation 1 is not active, Activation 2 is not active
-    // Metric 2 is active.
-    // {{{---------------------------------------------------------------------------
-    EXPECT_FALSE(metricProducerTimeBase4_1->isActive());
-    EXPECT_EQ(kNotActive, activationTimeBase4_1->state);
-    EXPECT_EQ(kNotActive, activationTimeBase4_2->state);
-
-    EXPECT_TRUE(metricProducerTimeBase4_2->isActive());
-    // }}}-------------------------------------------------------------------------------
-}
-
-TEST(StatsLogProcessorTest, TestActivationOnBootMultipleActivationsDifferentActivationTypes) {
-    int uid = 1111;
-
-    // Create config with 2 metrics:
-    // Metric 1: Activate on boot with 2 activations
-    // Metric 2: Always active
-    StatsdConfig config1;
-    config1.set_id(12341);
-    config1.add_allowed_log_source("AID_ROOT");  // LogEvent defaults to UID of root.
-    auto wakelockAcquireMatcher = CreateAcquireWakelockAtomMatcher();
-    auto screenOnMatcher = CreateScreenTurnedOnAtomMatcher();
-    *config1.add_atom_matcher() = wakelockAcquireMatcher;
-    *config1.add_atom_matcher() = screenOnMatcher;
-
-    long metricId1 = 1234561;
-    long metricId2 = 1234562;
-
-    auto countMetric1 = config1.add_count_metric();
-    countMetric1->set_id(metricId1);
-    countMetric1->set_what(wakelockAcquireMatcher.id());
-    countMetric1->set_bucket(FIVE_MINUTES);
-
-    auto countMetric2 = config1.add_count_metric();
-    countMetric2->set_id(metricId2);
-    countMetric2->set_what(wakelockAcquireMatcher.id());
-    countMetric2->set_bucket(FIVE_MINUTES);
-
-    auto metric1Activation = config1.add_metric_activation();
-    metric1Activation->set_metric_id(metricId1);
-    metric1Activation->set_activation_type(ACTIVATE_ON_BOOT);
-    auto metric1ActivationTrigger1 = metric1Activation->add_event_activation();
-    metric1ActivationTrigger1->set_atom_matcher_id(wakelockAcquireMatcher.id());
-    metric1ActivationTrigger1->set_ttl_seconds(100);
-    auto metric1ActivationTrigger2 = metric1Activation->add_event_activation();
-    metric1ActivationTrigger2->set_atom_matcher_id(screenOnMatcher.id());
-    metric1ActivationTrigger2->set_ttl_seconds(200);
-    metric1ActivationTrigger2->set_activation_type(ACTIVATE_IMMEDIATELY);
-
-    ConfigKey cfgKey1(uid, 12341);
-    long timeBase1 = 1;
-    sp<StatsLogProcessor> processor1 =
-            CreateStatsLogProcessor(timeBase1, timeBase1, config1, cfgKey1);
-
-    // Metric 1 is not active.
-    // Metric 2 is active.
-    // {{{---------------------------------------------------------------------------
-    EXPECT_EQ(1, processor1->mMetricsManagers.size());
-    auto it = processor1->mMetricsManagers.find(cfgKey1);
-    EXPECT_TRUE(it != processor1->mMetricsManagers.end());
-    auto& metricsManager1 = it->second;
-    EXPECT_TRUE(metricsManager1->isActive());
-
-    EXPECT_EQ(metricsManager1->mAllMetricProducers.size(), 2);
-    // We assume that the index of a MetricProducer within the mAllMetricProducers
-    // array follows the order in which metrics are added to the config.
-    auto& metricProducer1_1 = metricsManager1->mAllMetricProducers[0];
-    EXPECT_EQ(metricProducer1_1->getMetricId(), metricId1);
-    EXPECT_FALSE(metricProducer1_1->isActive());  // inactive due to associated MetricActivation
-
-    auto& metricProducer1_2 = metricsManager1->mAllMetricProducers[1];
-    EXPECT_EQ(metricProducer1_2->getMetricId(), metricId2);
-    EXPECT_TRUE(metricProducer1_2->isActive());
-
-    EXPECT_EQ(metricProducer1_1->mEventActivationMap.size(), 2);
-    // The key in mEventActivationMap is the index of the associated atom matcher. We assume
-    // that matchers are indexed in the order that they are added to the config.
-    const auto& activation1_1_1 = metricProducer1_1->mEventActivationMap.at(0);
-    EXPECT_EQ(100 * NS_PER_SEC, activation1_1_1->ttl_ns);
-    EXPECT_EQ(0, activation1_1_1->start_ns);
-    EXPECT_EQ(kNotActive, activation1_1_1->state);
-    EXPECT_EQ(ACTIVATE_ON_BOOT, activation1_1_1->activationType);
-
-    const auto& activation1_1_2 = metricProducer1_1->mEventActivationMap.at(1);
-    EXPECT_EQ(200 * NS_PER_SEC, activation1_1_2->ttl_ns);
-    EXPECT_EQ(0, activation1_1_2->start_ns);
-    EXPECT_EQ(kNotActive, activation1_1_2->state);
-    EXPECT_EQ(ACTIVATE_IMMEDIATELY, activation1_1_2->activationType);
-    // }}}------------------------------------------------------------------------------
-
-    // Trigger Activation 1 for Metric 1
-    std::vector<AttributionNodeInternal> attributions1 = {CreateAttribution(111, "App1")};
-    auto event = CreateAcquireWakelockEvent(attributions1, "wl1", 100 + timeBase1);
-    processor1->OnLogEvent(event.get());
-
-    // Metric 1 is not active; Activation 1 set to kActiveOnBoot
-    // Metric 2 is active.
-    // {{{---------------------------------------------------------------------------
-    EXPECT_FALSE(metricProducer1_1->isActive());
-    EXPECT_EQ(0, activation1_1_1->start_ns);
-    EXPECT_EQ(kActiveOnBoot, activation1_1_1->state);
-    EXPECT_EQ(0, activation1_1_2->start_ns);
-    EXPECT_EQ(kNotActive, activation1_1_2->state);
-
-    EXPECT_TRUE(metricProducer1_2->isActive());
-    // }}}-----------------------------------------------------------------------------
-
-    // Simulate shutdown by saving state to disk
-    int64_t shutDownTime = timeBase1 + 100 * NS_PER_SEC;
-    processor1->SaveActiveConfigsToDisk(shutDownTime);
-    EXPECT_FALSE(metricProducer1_1->isActive());
-
-    // Simulate device restarted state by creating new instance of StatsLogProcessor with the
-    // same config.
-    long timeBase2 = 1000;
-    sp<StatsLogProcessor> processor2 =
-            CreateStatsLogProcessor(timeBase2, timeBase2, config1, cfgKey1);
-
-    // Metric 1 is not active.
-    // Metric 2 is active.
-    // {{{---------------------------------------------------------------------------
-    EXPECT_EQ(1, processor2->mMetricsManagers.size());
-    it = processor2->mMetricsManagers.find(cfgKey1);
-    EXPECT_TRUE(it != processor2->mMetricsManagers.end());
-    auto& metricsManager2 = it->second;
-    EXPECT_TRUE(metricsManager2->isActive());
-
-    EXPECT_EQ(metricsManager2->mAllMetricProducers.size(), 2);
-    // We assume that the index of a MetricProducer within the mAllMetricProducers
-    // array follows the order in which metrics are added to the config.
-    auto& metricProducer2_1 = metricsManager2->mAllMetricProducers[0];
-    EXPECT_EQ(metricProducer2_1->getMetricId(), metricId1);
-    EXPECT_FALSE(metricProducer2_1->isActive());
-
-    auto& metricProducer2_2 = metricsManager2->mAllMetricProducers[1];
-    EXPECT_EQ(metricProducer2_2->getMetricId(), metricId2);
-    EXPECT_TRUE(metricProducer2_2->isActive());
-
-    EXPECT_EQ(metricProducer2_1->mEventActivationMap.size(), 2);
-    // The key in mEventActivationMap is the index of the associated atom matcher. We assume
-    // that matchers are indexed in the order that they are added to the config.
-    const auto& activation2_1_1 = metricProducer2_1->mEventActivationMap.at(0);
-    EXPECT_EQ(100 * NS_PER_SEC, activation2_1_1->ttl_ns);
-    EXPECT_EQ(0, activation2_1_1->start_ns);
-    EXPECT_EQ(kNotActive, activation2_1_1->state);
-    EXPECT_EQ(ACTIVATE_ON_BOOT, activation2_1_1->activationType);
-
-    const auto& activation2_1_2 = metricProducer2_1->mEventActivationMap.at(1);
-    EXPECT_EQ(200 * NS_PER_SEC, activation2_1_2->ttl_ns);
-    EXPECT_EQ(0, activation2_1_2->start_ns);
-    EXPECT_EQ(kNotActive, activation2_1_2->state);
-    EXPECT_EQ(ACTIVATE_IMMEDIATELY, activation2_1_2->activationType);
-    // }}}-----------------------------------------------------------------------------------
-
-    // Load saved state from disk.
-    processor2->LoadActiveConfigsFromDisk();
-
-    // Metric 1 active; Activation 1 is active, Activation 2 is not active
-    // Metric 2 is active.
-    // {{{---------------------------------------------------------------------------
-    EXPECT_TRUE(metricProducer2_1->isActive());
-    int64_t ttl1 = metric1ActivationTrigger1->ttl_seconds() * NS_PER_SEC;
-    EXPECT_EQ(timeBase2 + ttl1 - activation2_1_1->ttl_ns, activation2_1_1->start_ns);
-    EXPECT_EQ(kActive, activation2_1_1->state);
-    EXPECT_EQ(0, activation2_1_2->start_ns);
-    EXPECT_EQ(kNotActive, activation2_1_2->state);
-
-    EXPECT_TRUE(metricProducer2_2->isActive());
-    // }}}--------------------------------------------------------------------------------
-
-    // Trigger Activation 2 for Metric 1.
-    auto screenOnEvent = CreateScreenStateChangedEvent(
-            android::view::DISPLAY_STATE_ON,
-            timeBase2 + 200
-    );
-    processor2->OnLogEvent(screenOnEvent.get());
-
-    // Metric 1 active; Activation 1 is active, Activation 2 is active
-    // Metric 2 is active.
-    // {{{---------------------------------------------------------------------------
-    EXPECT_TRUE(metricProducer2_1->isActive());
-    EXPECT_EQ(timeBase2 + ttl1 - activation2_1_1->ttl_ns, activation2_1_1->start_ns);
-    EXPECT_EQ(kActive, activation2_1_1->state);
-    EXPECT_EQ(screenOnEvent->GetElapsedTimestampNs(), activation2_1_2->start_ns);
-    EXPECT_EQ(kActive, activation2_1_2->state);
-
-    EXPECT_TRUE(metricProducer2_2->isActive());
-    // }}}---------------------------------------------------------------------------
-
-    // Simulate shutdown by saving state to disk
-    shutDownTime = timeBase2 + 50 * NS_PER_SEC;
-    processor2->SaveActiveConfigsToDisk(shutDownTime);
-    EXPECT_TRUE(metricProducer2_1->isActive());
-    EXPECT_TRUE(metricProducer2_2->isActive());
-    ttl1 -= shutDownTime - timeBase2;
-    int64_t ttl2 = metric1ActivationTrigger2->ttl_seconds() * NS_PER_SEC
-            - (shutDownTime - screenOnEvent->GetElapsedTimestampNs());
-
-    // Simulate device restarted state by creating new instance of StatsLogProcessor with the
-    // same config.
-    long timeBase3 = timeBase2 + 120 * NS_PER_SEC;
-    sp<StatsLogProcessor> processor3 =
-            CreateStatsLogProcessor(timeBase3, timeBase3, config1, cfgKey1);
-
-    // Metric 1 is not active.
-    // Metric 2 is active.
-    // {{{---------------------------------------------------------------------------
-    EXPECT_EQ(1, processor3->mMetricsManagers.size());
-    it = processor3->mMetricsManagers.find(cfgKey1);
-    EXPECT_TRUE(it != processor3->mMetricsManagers.end());
-    auto& metricsManager3 = it->second;
-    EXPECT_TRUE(metricsManager3->isActive());
-
-    EXPECT_EQ(metricsManager3->mAllMetricProducers.size(), 2);
-    // We assume that the index of a MetricProducer within the mAllMetricProducers
-    // array follows the order in which metrics are added to the config.
-    auto& metricProducer3_1 = metricsManager3->mAllMetricProducers[0];
-    EXPECT_EQ(metricProducer3_1->getMetricId(), metricId1);
-    EXPECT_FALSE(metricProducer3_1->isActive());
-
-    auto& metricProducer3_2 = metricsManager3->mAllMetricProducers[1];
-    EXPECT_EQ(metricProducer3_2->getMetricId(), metricId2);
-    EXPECT_TRUE(metricProducer3_2->isActive());
-
-    EXPECT_EQ(metricProducer3_1->mEventActivationMap.size(), 2);
-    // The key in mEventActivationMap is the index of the associated atom matcher. We assume
-    // that matchers are indexed in the order that they are added to the config.
-    const auto& activation3_1_1 = metricProducer3_1->mEventActivationMap.at(0);
-    EXPECT_EQ(100 * NS_PER_SEC, activation3_1_1->ttl_ns);
-    EXPECT_EQ(0, activation3_1_1->start_ns);
-    EXPECT_EQ(kNotActive, activation3_1_1->state);
-    EXPECT_EQ(ACTIVATE_ON_BOOT, activation3_1_1->activationType);
-
-    const auto& activation3_1_2 = metricProducer3_1->mEventActivationMap.at(1);
-    EXPECT_EQ(200 * NS_PER_SEC, activation3_1_2->ttl_ns);
-    EXPECT_EQ(0, activation3_1_2->start_ns);
-    EXPECT_EQ(kNotActive, activation3_1_2->state);
-    EXPECT_EQ(ACTIVATE_IMMEDIATELY, activation3_1_2->activationType);
-    // }}}----------------------------------------------------------------------------------
-
-    // Load saved state from disk.
-    processor3->LoadActiveConfigsFromDisk();
-
-    // Metric 1 active: Activation 1 is active, Activation 2 is active
-    // Metric 2 is active.
-    // {{{---------------------------------------------------------------------------
-    EXPECT_TRUE(metricProducer3_1->isActive());
-    EXPECT_EQ(timeBase3 + ttl1 - activation3_1_1->ttl_ns, activation3_1_1->start_ns);
-    EXPECT_EQ(kActive, activation3_1_1->state);
-    EXPECT_EQ(timeBase3 + ttl2 - activation3_1_2->ttl_ns, activation3_1_2->start_ns);
-    EXPECT_EQ(kActive, activation3_1_2->state);
-
-    EXPECT_TRUE(metricProducer3_2->isActive());
-    // }}}-------------------------------------------------------------------------------
-
-
-    // Trigger Activation 2 for Metric 1 again.
-    screenOnEvent = CreateScreenStateChangedEvent(
-            android::view::DISPLAY_STATE_ON,
-            timeBase3 + 100 * NS_PER_SEC
-    );
-    processor3->OnLogEvent(screenOnEvent.get());
-
-    // Metric 1 active; Activation 1 is inactive (above screenOnEvent causes ttl1 to expire),
-    //                  Activation 2 is set to active
-    // Metric 2 is active.
-    // {{{---------------------------------------------------------------------------
-    EXPECT_TRUE(metricProducer3_1->isActive());
-    EXPECT_EQ(kNotActive, activation3_1_1->state);
-    EXPECT_EQ(screenOnEvent->GetElapsedTimestampNs(), activation3_1_2->start_ns);
-    EXPECT_EQ(kActive, activation3_1_2->state);
-
-    EXPECT_TRUE(metricProducer3_2->isActive());
-    // }}}---------------------------------------------------------------------------
-}
-
-TEST(StatsLogProcessorTest, TestActivationsPersistAcrossSystemServerRestart) {
-    int uid = 9876;
-    long configId = 12341;
-
-    // Create config with 3 metrics:
-    // Metric 1: Activate on 2 activations, 1 on boot, 1 immediate.
-    // Metric 2: Activate on 2 activations, 1 on boot, 1 immediate.
-    // Metric 3: Always active
-    StatsdConfig config1;
-    config1.set_id(configId);
-    config1.add_allowed_log_source("AID_ROOT");  // LogEvent defaults to UID of root.
-    auto wakelockAcquireMatcher = CreateAcquireWakelockAtomMatcher();
-    auto screenOnMatcher = CreateScreenTurnedOnAtomMatcher();
-    auto jobStartMatcher = CreateStartScheduledJobAtomMatcher();
-    auto jobFinishMatcher = CreateFinishScheduledJobAtomMatcher();
-    *config1.add_atom_matcher() = wakelockAcquireMatcher;
-    *config1.add_atom_matcher() = screenOnMatcher;
-    *config1.add_atom_matcher() = jobStartMatcher;
-    *config1.add_atom_matcher() = jobFinishMatcher;
-
-    long metricId1 = 1234561;
-    long metricId2 = 1234562;
-    long metricId3 = 1234563;
-
-    auto countMetric1 = config1.add_count_metric();
-    countMetric1->set_id(metricId1);
-    countMetric1->set_what(wakelockAcquireMatcher.id());
-    countMetric1->set_bucket(FIVE_MINUTES);
-
-    auto countMetric2 = config1.add_count_metric();
-    countMetric2->set_id(metricId2);
-    countMetric2->set_what(wakelockAcquireMatcher.id());
-    countMetric2->set_bucket(FIVE_MINUTES);
-
-    auto countMetric3 = config1.add_count_metric();
-    countMetric3->set_id(metricId3);
-    countMetric3->set_what(wakelockAcquireMatcher.id());
-    countMetric3->set_bucket(FIVE_MINUTES);
-
-    // Metric 1 activates on boot for wakelock acquire, immediately for screen on.
-    auto metric1Activation = config1.add_metric_activation();
-    metric1Activation->set_metric_id(metricId1);
-    auto metric1ActivationTrigger1 = metric1Activation->add_event_activation();
-    metric1ActivationTrigger1->set_atom_matcher_id(wakelockAcquireMatcher.id());
-    metric1ActivationTrigger1->set_ttl_seconds(100);
-    metric1ActivationTrigger1->set_activation_type(ACTIVATE_ON_BOOT);
-    auto metric1ActivationTrigger2 = metric1Activation->add_event_activation();
-    metric1ActivationTrigger2->set_atom_matcher_id(screenOnMatcher.id());
-    metric1ActivationTrigger2->set_ttl_seconds(200);
-    metric1ActivationTrigger2->set_activation_type(ACTIVATE_IMMEDIATELY);
-
-    // Metric 2 activates on boot for scheduled job start, immediately for scheduled job finish.
-    auto metric2Activation = config1.add_metric_activation();
-    metric2Activation->set_metric_id(metricId2);
-    auto metric2ActivationTrigger1 = metric2Activation->add_event_activation();
-    metric2ActivationTrigger1->set_atom_matcher_id(jobStartMatcher.id());
-    metric2ActivationTrigger1->set_ttl_seconds(100);
-    metric2ActivationTrigger1->set_activation_type(ACTIVATE_ON_BOOT);
-    auto metric2ActivationTrigger2 = metric2Activation->add_event_activation();
-    metric2ActivationTrigger2->set_atom_matcher_id(jobFinishMatcher.id());
-    metric2ActivationTrigger2->set_ttl_seconds(200);
-    metric2ActivationTrigger2->set_activation_type(ACTIVATE_IMMEDIATELY);
-
-    // Send the config.
-    shared_ptr<StatsService> service = SharedRefBase::make<StatsService>(nullptr, nullptr);
-    string serialized = config1.SerializeAsString();
-    service->addConfigurationChecked(uid, configId, {serialized.begin(), serialized.end()});
-
-    // Make sure the config is stored on disk. Otherwise, we will not reset on system server death.
-    StatsdConfig tmpConfig;
-    ConfigKey cfgKey1(uid, configId);
-    EXPECT_TRUE(StorageManager::readConfigFromDisk(cfgKey1, &tmpConfig));
-
-    // Metric 1 is not active.
-    // Metric 2 is not active.
-    // Metric 3 is active.
-    // {{{---------------------------------------------------------------------------
-    sp<StatsLogProcessor> processor = service->mProcessor;
-    EXPECT_EQ(1, processor->mMetricsManagers.size());
-    auto it = processor->mMetricsManagers.find(cfgKey1);
-    EXPECT_TRUE(it != processor->mMetricsManagers.end());
-    auto& metricsManager1 = it->second;
-    EXPECT_TRUE(metricsManager1->isActive());
-    EXPECT_EQ(3, metricsManager1->mAllMetricProducers.size());
-
-    auto& metricProducer1 = metricsManager1->mAllMetricProducers[0];
-    EXPECT_EQ(metricId1, metricProducer1->getMetricId());
-    EXPECT_FALSE(metricProducer1->isActive());
-
-    auto& metricProducer2 = metricsManager1->mAllMetricProducers[1];
-    EXPECT_EQ(metricId2, metricProducer2->getMetricId());
-    EXPECT_FALSE(metricProducer2->isActive());
-
-    auto& metricProducer3 = metricsManager1->mAllMetricProducers[2];
-    EXPECT_EQ(metricId3, metricProducer3->getMetricId());
-    EXPECT_TRUE(metricProducer3->isActive());
-
-    // Check event activations.
-    EXPECT_EQ(metricsManager1->mAllAtomMatchers.size(), 4);
-    EXPECT_EQ(metricsManager1->mAllAtomMatchers[0]->getId(),
-              metric1ActivationTrigger1->atom_matcher_id());
-    const auto& activation1 = metricProducer1->mEventActivationMap.at(0);
-    EXPECT_EQ(100 * NS_PER_SEC, activation1->ttl_ns);
-    EXPECT_EQ(0, activation1->start_ns);
-    EXPECT_EQ(kNotActive, activation1->state);
-    EXPECT_EQ(ACTIVATE_ON_BOOT, activation1->activationType);
-
-    EXPECT_EQ(metricsManager1->mAllAtomMatchers[1]->getId(),
-              metric1ActivationTrigger2->atom_matcher_id());
-    const auto& activation2 = metricProducer1->mEventActivationMap.at(1);
-    EXPECT_EQ(200 * NS_PER_SEC, activation2->ttl_ns);
-    EXPECT_EQ(0, activation2->start_ns);
-    EXPECT_EQ(kNotActive, activation2->state);
-    EXPECT_EQ(ACTIVATE_IMMEDIATELY, activation2->activationType);
-
-    EXPECT_EQ(metricsManager1->mAllAtomMatchers[2]->getId(),
-              metric2ActivationTrigger1->atom_matcher_id());
-    const auto& activation3 = metricProducer2->mEventActivationMap.at(2);
-    EXPECT_EQ(100 * NS_PER_SEC, activation3->ttl_ns);
-    EXPECT_EQ(0, activation3->start_ns);
-    EXPECT_EQ(kNotActive, activation3->state);
-    EXPECT_EQ(ACTIVATE_ON_BOOT, activation3->activationType);
-
-    EXPECT_EQ(metricsManager1->mAllAtomMatchers[3]->getId(),
-              metric2ActivationTrigger2->atom_matcher_id());
-    const auto& activation4 = metricProducer2->mEventActivationMap.at(3);
-    EXPECT_EQ(200 * NS_PER_SEC, activation4->ttl_ns);
-    EXPECT_EQ(0, activation4->start_ns);
-    EXPECT_EQ(kNotActive, activation4->state);
-    EXPECT_EQ(ACTIVATE_IMMEDIATELY, activation4->activationType);
-    // }}}------------------------------------------------------------------------------
-
-    // Trigger Activation 1 for Metric 1. Should activate on boot.
-    // Trigger Activation 4 for Metric 2. Should activate immediately.
-    long configAddedTimeNs = metricsManager1->mLastReportTimeNs;
-    std::vector<AttributionNodeInternal> attributions1 = {CreateAttribution(111, "App1")};
-    auto event = CreateAcquireWakelockEvent(attributions1, "wl1", 1 + configAddedTimeNs);
-    processor->OnLogEvent(event.get());
-
-    event = CreateFinishScheduledJobEvent(attributions1, "finish1", 2 + configAddedTimeNs);
-    processor->OnLogEvent(event.get());
-
-    // Metric 1 is not active; Activation 1 set to kActiveOnBoot
-    // Metric 2 is active. Activation 4 set to kActive
-    // Metric 3 is active.
-    // {{{---------------------------------------------------------------------------
-    EXPECT_FALSE(metricProducer1->isActive());
-    EXPECT_EQ(0, activation1->start_ns);
-    EXPECT_EQ(kActiveOnBoot, activation1->state);
-    EXPECT_EQ(0, activation2->start_ns);
-    EXPECT_EQ(kNotActive, activation2->state);
-
-    EXPECT_TRUE(metricProducer2->isActive());
-    EXPECT_EQ(0, activation3->start_ns);
-    EXPECT_EQ(kNotActive, activation3->state);
-    EXPECT_EQ(2 + configAddedTimeNs, activation4->start_ns);
-    EXPECT_EQ(kActive, activation4->state);
-
-    EXPECT_TRUE(metricProducer3->isActive());
-    // }}}-----------------------------------------------------------------------------
-
-    // Can't fake time with StatsService.
-    // Lets get a time close to the system server death time and make sure it's sane.
-    int64_t approximateSystemServerDeath = getElapsedRealtimeNs();
-    EXPECT_TRUE(approximateSystemServerDeath > 2 + configAddedTimeNs);
-    EXPECT_TRUE(approximateSystemServerDeath < NS_PER_SEC + configAddedTimeNs);
-
-    // System server dies.
-    service->statsCompanionServiceDiedImpl();
-
-    // We should have a new metrics manager. Lets get it and ensure activation status is restored.
-    // {{{---------------------------------------------------------------------------
-    EXPECT_EQ(1, processor->mMetricsManagers.size());
-    it = processor->mMetricsManagers.find(cfgKey1);
-    EXPECT_TRUE(it != processor->mMetricsManagers.end());
-    auto& metricsManager2 = it->second;
-    EXPECT_TRUE(metricsManager2->isActive());
-    EXPECT_EQ(3, metricsManager2->mAllMetricProducers.size());
-
-    auto& metricProducer1001 = metricsManager2->mAllMetricProducers[0];
-    EXPECT_EQ(metricId1, metricProducer1001->getMetricId());
-    EXPECT_FALSE(metricProducer1001->isActive());
-
-    auto& metricProducer1002 = metricsManager2->mAllMetricProducers[1];
-    EXPECT_EQ(metricId2, metricProducer1002->getMetricId());
-    EXPECT_TRUE(metricProducer1002->isActive());
-
-    auto& metricProducer1003 = metricsManager2->mAllMetricProducers[2];
-    EXPECT_EQ(metricId3, metricProducer1003->getMetricId());
-    EXPECT_TRUE(metricProducer1003->isActive());
-
-    // Check event activations.
-    // Activation 1 is kActiveOnBoot.
-    // Activation 2 and 3 are not active.
-    // Activation 4 is active.
-    EXPECT_EQ(metricsManager2->mAllAtomMatchers.size(), 4);
-    EXPECT_EQ(metricsManager2->mAllAtomMatchers[0]->getId(),
-              metric1ActivationTrigger1->atom_matcher_id());
-    const auto& activation1001 = metricProducer1001->mEventActivationMap.at(0);
-    EXPECT_EQ(100 * NS_PER_SEC, activation1001->ttl_ns);
-    EXPECT_EQ(0, activation1001->start_ns);
-    EXPECT_EQ(kActiveOnBoot, activation1001->state);
-    EXPECT_EQ(ACTIVATE_ON_BOOT, activation1001->activationType);
-
-    EXPECT_EQ(metricsManager2->mAllAtomMatchers[1]->getId(),
-              metric1ActivationTrigger2->atom_matcher_id());
-    const auto& activation1002 = metricProducer1001->mEventActivationMap.at(1);
-    EXPECT_EQ(200 * NS_PER_SEC, activation1002->ttl_ns);
-    EXPECT_EQ(0, activation1002->start_ns);
-    EXPECT_EQ(kNotActive, activation1002->state);
-    EXPECT_EQ(ACTIVATE_IMMEDIATELY, activation1002->activationType);
-
-    EXPECT_EQ(metricsManager2->mAllAtomMatchers[2]->getId(),
-              metric2ActivationTrigger1->atom_matcher_id());
-    const auto& activation1003 = metricProducer1002->mEventActivationMap.at(2);
-    EXPECT_EQ(100 * NS_PER_SEC, activation1003->ttl_ns);
-    EXPECT_EQ(0, activation1003->start_ns);
-    EXPECT_EQ(kNotActive, activation1003->state);
-    EXPECT_EQ(ACTIVATE_ON_BOOT, activation1003->activationType);
-
-    EXPECT_EQ(metricsManager2->mAllAtomMatchers[3]->getId(),
-              metric2ActivationTrigger2->atom_matcher_id());
-    const auto& activation1004 = metricProducer1002->mEventActivationMap.at(3);
-    EXPECT_EQ(200 * NS_PER_SEC, activation1004->ttl_ns);
-    EXPECT_EQ(2 + configAddedTimeNs, activation1004->start_ns);
-    EXPECT_EQ(kActive, activation1004->state);
-    EXPECT_EQ(ACTIVATE_IMMEDIATELY, activation1004->activationType);
-    // }}}------------------------------------------------------------------------------
-
-    // Clear the data stored on disk as a result of the system server death.
-    vector<uint8_t> buffer;
-    processor->onDumpReport(cfgKey1, configAddedTimeNs + NS_PER_SEC, false, true,
-                                ADB_DUMP, FAST, &buffer);
-}
+// TODO(b/149590301): Update this test to use new socket schema.
+//TEST(StatsLogProcessorTest, TestOnDumpReportEraseData) {
+//    // Setup a simple config.
+//    StatsdConfig config;
+//    config.add_allowed_log_source("AID_ROOT"); // LogEvent defaults to UID of root.
+//    auto wakelockAcquireMatcher = CreateAcquireWakelockAtomMatcher();
+//    *config.add_atom_matcher() = wakelockAcquireMatcher;
+//
+//    auto countMetric = config.add_count_metric();
+//    countMetric->set_id(123456);
+//    countMetric->set_what(wakelockAcquireMatcher.id());
+//    countMetric->set_bucket(FIVE_MINUTES);
+//
+//    ConfigKey cfgKey;
+//    sp<StatsLogProcessor> processor = CreateStatsLogProcessor(1, 1, config, cfgKey);
+//
+//    std::vector<AttributionNodeInternal> attributions1 = {CreateAttribution(111, "App1")};
+//    auto event = CreateAcquireWakelockEvent(attributions1, "wl1", 2);
+//    processor->OnLogEvent(event.get());
+//
+//    vector<uint8_t> bytes;
+//    ConfigMetricsReportList output;
+//
+//    // Dump report WITHOUT erasing data.
+//    processor->onDumpReport(cfgKey, 3, true, false /* Do NOT erase data. */, ADB_DUMP, FAST, &bytes);
+//    output.ParseFromArray(bytes.data(), bytes.size());
+//    EXPECT_EQ(output.reports_size(), 1);
+//    EXPECT_EQ(output.reports(0).metrics_size(), 1);
+//    EXPECT_EQ(output.reports(0).metrics(0).count_metrics().data_size(), 1);
+//
+//    // Dump report WITH erasing data. There should be data since we didn't previously erase it.
+//    processor->onDumpReport(cfgKey, 4, true, true /* DO erase data. */, ADB_DUMP, FAST, &bytes);
+//    output.ParseFromArray(bytes.data(), bytes.size());
+//    EXPECT_EQ(output.reports_size(), 1);
+//    EXPECT_EQ(output.reports(0).metrics_size(), 1);
+//    EXPECT_EQ(output.reports(0).metrics(0).count_metrics().data_size(), 1);
+//
+//    // Dump report again. There should be no data since we erased it.
+//    processor->onDumpReport(cfgKey, 5, true, true /* DO erase data. */, ADB_DUMP, FAST, &bytes);
+//    output.ParseFromArray(bytes.data(), bytes.size());
+//    // We don't care whether statsd has a report, as long as it has no count metrics in it.
+//    bool noData = output.reports_size() == 0
+//            || output.reports(0).metrics_size() == 0
+//            || output.reports(0).metrics(0).count_metrics().data_size() == 0;
+//    EXPECT_TRUE(noData);
+//}
+//
+//TEST(StatsLogProcessorTest, TestActiveConfigMetricDiskWriteRead) {
+//    int uid = 1111;
+//
+//    // Setup a simple config, no activation
+//    StatsdConfig config1;
+//    int64_t cfgId1 = 12341;
+//    config1.set_id(cfgId1);
+//    config1.add_allowed_log_source("AID_ROOT");  // LogEvent defaults to UID of root.
+//    auto wakelockAcquireMatcher = CreateAcquireWakelockAtomMatcher();
+//    *config1.add_atom_matcher() = wakelockAcquireMatcher;
+//
+//    long metricId1 = 1234561;
+//    long metricId2 = 1234562;
+//    auto countMetric1 = config1.add_count_metric();
+//    countMetric1->set_id(metricId1);
+//    countMetric1->set_what(wakelockAcquireMatcher.id());
+//    countMetric1->set_bucket(FIVE_MINUTES);
+//
+//    auto countMetric2 = config1.add_count_metric();
+//    countMetric2->set_id(metricId2);
+//    countMetric2->set_what(wakelockAcquireMatcher.id());
+//    countMetric2->set_bucket(FIVE_MINUTES);
+//
+//    ConfigKey cfgKey1(uid, cfgId1);
+//
+//    // Add another config, with two metrics, one with activation
+//    StatsdConfig config2;
+//    int64_t cfgId2 = 12342;
+//    config2.set_id(cfgId2);
+//    config2.add_allowed_log_source("AID_ROOT");  // LogEvent defaults to UID of root.
+//    *config2.add_atom_matcher() = wakelockAcquireMatcher;
+//
+//    long metricId3 = 1234561;
+//    long metricId4 = 1234562;
+//
+//    auto countMetric3 = config2.add_count_metric();
+//    countMetric3->set_id(metricId3);
+//    countMetric3->set_what(wakelockAcquireMatcher.id());
+//    countMetric3->set_bucket(FIVE_MINUTES);
+//
+//    auto countMetric4 = config2.add_count_metric();
+//    countMetric4->set_id(metricId4);
+//    countMetric4->set_what(wakelockAcquireMatcher.id());
+//    countMetric4->set_bucket(FIVE_MINUTES);
+//
+//    auto metric3Activation = config2.add_metric_activation();
+//    metric3Activation->set_metric_id(metricId3);
+//    metric3Activation->set_activation_type(ACTIVATE_IMMEDIATELY);
+//    auto metric3ActivationTrigger = metric3Activation->add_event_activation();
+//    metric3ActivationTrigger->set_atom_matcher_id(wakelockAcquireMatcher.id());
+//    metric3ActivationTrigger->set_ttl_seconds(100);
+//
+//    ConfigKey cfgKey2(uid, cfgId2);
+//
+//    // Add another config, with two metrics, both with activations
+//    StatsdConfig config3;
+//    int64_t cfgId3 = 12343;
+//    config3.set_id(cfgId3);
+//    config3.add_allowed_log_source("AID_ROOT");  // LogEvent defaults to UID of root.
+//    *config3.add_atom_matcher() = wakelockAcquireMatcher;
+//
+//    long metricId5 = 1234565;
+//    long metricId6 = 1234566;
+//    auto countMetric5 = config3.add_count_metric();
+//    countMetric5->set_id(metricId5);
+//    countMetric5->set_what(wakelockAcquireMatcher.id());
+//    countMetric5->set_bucket(FIVE_MINUTES);
+//
+//    auto countMetric6 = config3.add_count_metric();
+//    countMetric6->set_id(metricId6);
+//    countMetric6->set_what(wakelockAcquireMatcher.id());
+//    countMetric6->set_bucket(FIVE_MINUTES);
+//
+//    auto metric5Activation = config3.add_metric_activation();
+//    metric5Activation->set_metric_id(metricId5);
+//    metric5Activation->set_activation_type(ACTIVATE_IMMEDIATELY);
+//    auto metric5ActivationTrigger = metric5Activation->add_event_activation();
+//    metric5ActivationTrigger->set_atom_matcher_id(wakelockAcquireMatcher.id());
+//    metric5ActivationTrigger->set_ttl_seconds(100);
+//
+//    auto metric6Activation = config3.add_metric_activation();
+//    metric6Activation->set_metric_id(metricId6);
+//    metric6Activation->set_activation_type(ACTIVATE_IMMEDIATELY);
+//    auto metric6ActivationTrigger = metric6Activation->add_event_activation();
+//    metric6ActivationTrigger->set_atom_matcher_id(wakelockAcquireMatcher.id());
+//    metric6ActivationTrigger->set_ttl_seconds(200);
+//
+//    ConfigKey cfgKey3(uid, cfgId3);
+//
+//    sp<UidMap> m = new UidMap();
+//    sp<StatsPullerManager> pullerManager = new StatsPullerManager();
+//    sp<AlarmMonitor> anomalyAlarmMonitor;
+//    sp<AlarmMonitor> subscriberAlarmMonitor;
+//    vector<int64_t> activeConfigsBroadcast;
+//
+//    long timeBase1 = 1;
+//    int broadcastCount = 0;
+//    StatsLogProcessor processor(m, pullerManager, anomalyAlarmMonitor, subscriberAlarmMonitor,
+//            timeBase1, [](const ConfigKey& key) { return true; },
+//            [&uid, &broadcastCount, &activeConfigsBroadcast](const int& broadcastUid,
+//                    const vector<int64_t>& activeConfigs) {
+//                broadcastCount++;
+//                EXPECT_EQ(broadcastUid, uid);
+//                activeConfigsBroadcast.clear();
+//                activeConfigsBroadcast.insert(activeConfigsBroadcast.end(),
+//                        activeConfigs.begin(), activeConfigs.end());
+//                return true;
+//            });
+//
+//    processor.OnConfigUpdated(1, cfgKey1, config1);
+//    processor.OnConfigUpdated(2, cfgKey2, config2);
+//    processor.OnConfigUpdated(3, cfgKey3, config3);
+//
+//    EXPECT_EQ(3, processor.mMetricsManagers.size());
+//
+//    // Expect the first config and both metrics in it to be active.
+//    auto it = processor.mMetricsManagers.find(cfgKey1);
+//    EXPECT_TRUE(it != processor.mMetricsManagers.end());
+//    auto& metricsManager1 = it->second;
+//    EXPECT_TRUE(metricsManager1->isActive());
+//
+//    auto metricIt = metricsManager1->mAllMetricProducers.begin();
+//    for (; metricIt != metricsManager1->mAllMetricProducers.end(); metricIt++) {
+//        if ((*metricIt)->getMetricId() == metricId1) {
+//            break;
+//        }
+//    }
+//    EXPECT_TRUE(metricIt != metricsManager1->mAllMetricProducers.end());
+//    auto& metricProducer1 = *metricIt;
+//    EXPECT_TRUE(metricProducer1->isActive());
+//
+//    metricIt = metricsManager1->mAllMetricProducers.begin();
+//    for (; metricIt != metricsManager1->mAllMetricProducers.end(); metricIt++) {
+//        if ((*metricIt)->getMetricId() == metricId2) {
+//            break;
+//        }
+//    }
+//    EXPECT_TRUE(metricIt != metricsManager1->mAllMetricProducers.end());
+//    auto& metricProducer2 = *metricIt;
+//    EXPECT_TRUE(metricProducer2->isActive());
+//
+//    // Expect config 2 to be active. Metric 3 shouldn't be active, metric 4 should be active.
+//    it = processor.mMetricsManagers.find(cfgKey2);
+//    EXPECT_TRUE(it != processor.mMetricsManagers.end());
+//    auto& metricsManager2 = it->second;
+//    EXPECT_TRUE(metricsManager2->isActive());
+//
+//    metricIt = metricsManager2->mAllMetricProducers.begin();
+//    for (; metricIt != metricsManager2->mAllMetricProducers.end(); metricIt++) {
+//        if ((*metricIt)->getMetricId() == metricId3) {
+//            break;
+//        }
+//    }
+//    EXPECT_TRUE(metricIt != metricsManager2->mAllMetricProducers.end());
+//    auto& metricProducer3 = *metricIt;
+//    EXPECT_FALSE(metricProducer3->isActive());
+//
+//    metricIt = metricsManager2->mAllMetricProducers.begin();
+//    for (; metricIt != metricsManager2->mAllMetricProducers.end(); metricIt++) {
+//        if ((*metricIt)->getMetricId() == metricId4) {
+//            break;
+//        }
+//    }
+//    EXPECT_TRUE(metricIt != metricsManager2->mAllMetricProducers.end());
+//    auto& metricProducer4 = *metricIt;
+//    EXPECT_TRUE(metricProducer4->isActive());
+//
+//    // Expect the third config and both metrics in it to be inactive.
+//    it = processor.mMetricsManagers.find(cfgKey3);
+//    EXPECT_TRUE(it != processor.mMetricsManagers.end());
+//    auto& metricsManager3 = it->second;
+//    EXPECT_FALSE(metricsManager3->isActive());
+//
+//    metricIt = metricsManager3->mAllMetricProducers.begin();
+//    for (; metricIt != metricsManager2->mAllMetricProducers.end(); metricIt++) {
+//        if ((*metricIt)->getMetricId() == metricId5) {
+//            break;
+//        }
+//    }
+//    EXPECT_TRUE(metricIt != metricsManager3->mAllMetricProducers.end());
+//    auto& metricProducer5 = *metricIt;
+//    EXPECT_FALSE(metricProducer5->isActive());
+//
+//    metricIt = metricsManager3->mAllMetricProducers.begin();
+//    for (; metricIt != metricsManager3->mAllMetricProducers.end(); metricIt++) {
+//        if ((*metricIt)->getMetricId() == metricId6) {
+//            break;
+//        }
+//    }
+//    EXPECT_TRUE(metricIt != metricsManager3->mAllMetricProducers.end());
+//    auto& metricProducer6 = *metricIt;
+//    EXPECT_FALSE(metricProducer6->isActive());
+//
+//    // No broadcast for active configs should have happened yet.
+//    EXPECT_EQ(broadcastCount, 0);
+//
+//    // Activate all 3 metrics that were not active.
+//    std::vector<AttributionNodeInternal> attributions1 = {CreateAttribution(111, "App1")};
+//    auto event = CreateAcquireWakelockEvent(attributions1, "wl1", 100 + timeBase1);
+//    processor.OnLogEvent(event.get());
+//
+//    // Assert that all 3 configs are active.
+//    EXPECT_TRUE(metricsManager1->isActive());
+//    EXPECT_TRUE(metricsManager2->isActive());
+//    EXPECT_TRUE(metricsManager3->isActive());
+//
+//    // A broadcast should have happened, and all 3 configs should be active in the broadcast.
+//    EXPECT_EQ(broadcastCount, 1);
+//    EXPECT_EQ(activeConfigsBroadcast.size(), 3);
+//    EXPECT_TRUE(std::find(activeConfigsBroadcast.begin(), activeConfigsBroadcast.end(), cfgId1)
+//            != activeConfigsBroadcast.end());
+//    EXPECT_TRUE(std::find(activeConfigsBroadcast.begin(), activeConfigsBroadcast.end(), cfgId2)
+//            != activeConfigsBroadcast.end());
+//    EXPECT_TRUE(std::find(activeConfigsBroadcast.begin(), activeConfigsBroadcast.end(), cfgId3)
+//            != activeConfigsBroadcast.end());
+//
+//    // When we shut down, metrics 3 & 5 have 100ns remaining, metric 6 has 100s + 100ns.
+//    int64_t shutDownTime = timeBase1 + 100 * NS_PER_SEC;
+//    processor.SaveActiveConfigsToDisk(shutDownTime);
+//    const int64_t ttl3 = event->GetElapsedTimestampNs() +
+//            metric3ActivationTrigger->ttl_seconds() * NS_PER_SEC - shutDownTime;
+//    const int64_t ttl5 = event->GetElapsedTimestampNs() +
+//            metric5ActivationTrigger->ttl_seconds() * NS_PER_SEC - shutDownTime;
+//    const int64_t ttl6 = event->GetElapsedTimestampNs() +
+//            metric6ActivationTrigger->ttl_seconds() * NS_PER_SEC - shutDownTime;
+//
+//    // Create a second StatsLogProcessor and push the same 3 configs.
+//    long timeBase2 = 1000;
+//    sp<StatsLogProcessor> processor2 =
+//            CreateStatsLogProcessor(timeBase2, timeBase2, config1, cfgKey1);
+//    processor2->OnConfigUpdated(timeBase2, cfgKey2, config2);
+//    processor2->OnConfigUpdated(timeBase2, cfgKey3, config3);
+//
+//    EXPECT_EQ(3, processor2->mMetricsManagers.size());
+//
+//    // First config and both metrics are active.
+//    it = processor2->mMetricsManagers.find(cfgKey1);
+//    EXPECT_TRUE(it != processor2->mMetricsManagers.end());
+//    auto& metricsManager1001 = it->second;
+//    EXPECT_TRUE(metricsManager1001->isActive());
+//
+//    metricIt = metricsManager1001->mAllMetricProducers.begin();
+//    for (; metricIt != metricsManager1001->mAllMetricProducers.end(); metricIt++) {
+//        if ((*metricIt)->getMetricId() == metricId1) {
+//            break;
+//        }
+//    }
+//    EXPECT_TRUE(metricIt != metricsManager1001->mAllMetricProducers.end());
+//    auto& metricProducer1001 = *metricIt;
+//    EXPECT_TRUE(metricProducer1001->isActive());
+//
+//    metricIt = metricsManager1001->mAllMetricProducers.begin();
+//    for (; metricIt != metricsManager1001->mAllMetricProducers.end(); metricIt++) {
+//        if ((*metricIt)->getMetricId() == metricId2) {
+//            break;
+//        }
+//    }
+//    EXPECT_TRUE(metricIt != metricsManager1001->mAllMetricProducers.end());
+//    auto& metricProducer1002 = *metricIt;
+//    EXPECT_TRUE(metricProducer1002->isActive());
+//
+//    // Second config is active. Metric 3 is inactive, metric 4 is active.
+//    it = processor2->mMetricsManagers.find(cfgKey2);
+//    EXPECT_TRUE(it != processor2->mMetricsManagers.end());
+//    auto& metricsManager1002 = it->second;
+//    EXPECT_TRUE(metricsManager1002->isActive());
+//
+//    metricIt = metricsManager1002->mAllMetricProducers.begin();
+//    for (; metricIt != metricsManager1002->mAllMetricProducers.end(); metricIt++) {
+//        if ((*metricIt)->getMetricId() == metricId3) {
+//            break;
+//        }
+//    }
+//    EXPECT_TRUE(metricIt != metricsManager1002->mAllMetricProducers.end());
+//    auto& metricProducer1003 = *metricIt;
+//    EXPECT_FALSE(metricProducer1003->isActive());
+//
+//    metricIt = metricsManager1002->mAllMetricProducers.begin();
+//    for (; metricIt != metricsManager1002->mAllMetricProducers.end(); metricIt++) {
+//        if ((*metricIt)->getMetricId() == metricId4) {
+//            break;
+//        }
+//    }
+//    EXPECT_TRUE(metricIt != metricsManager1002->mAllMetricProducers.end());
+//    auto& metricProducer1004 = *metricIt;
+//    EXPECT_TRUE(metricProducer1004->isActive());
+//
+//    // Config 3 is inactive. both metrics are inactive.
+//    it = processor2->mMetricsManagers.find(cfgKey3);
+//    EXPECT_TRUE(it != processor2->mMetricsManagers.end());
+//    auto& metricsManager1003 = it->second;
+//    EXPECT_FALSE(metricsManager1003->isActive());
+//    EXPECT_EQ(2, metricsManager1003->mAllMetricProducers.size());
+//
+//    metricIt = metricsManager1003->mAllMetricProducers.begin();
+//    for (; metricIt != metricsManager1002->mAllMetricProducers.end(); metricIt++) {
+//        if ((*metricIt)->getMetricId() == metricId5) {
+//            break;
+//        }
+//    }
+//    EXPECT_TRUE(metricIt != metricsManager1003->mAllMetricProducers.end());
+//    auto& metricProducer1005 = *metricIt;
+//    EXPECT_FALSE(metricProducer1005->isActive());
+//
+//    metricIt = metricsManager1003->mAllMetricProducers.begin();
+//    for (; metricIt != metricsManager1003->mAllMetricProducers.end(); metricIt++) {
+//        if ((*metricIt)->getMetricId() == metricId6) {
+//            break;
+//        }
+//    }
+//    EXPECT_TRUE(metricIt != metricsManager1003->mAllMetricProducers.end());
+//    auto& metricProducer1006 = *metricIt;
+//    EXPECT_FALSE(metricProducer1006->isActive());
+//
+//    // Assert that all 3 metrics with activation are inactive and that the ttls were properly set.
+//    EXPECT_FALSE(metricProducer1003->isActive());
+//    const auto& activation1003 = metricProducer1003->mEventActivationMap.begin()->second;
+//    EXPECT_EQ(100 * NS_PER_SEC, activation1003->ttl_ns);
+//    EXPECT_EQ(0, activation1003->start_ns);
+//    EXPECT_FALSE(metricProducer1005->isActive());
+//    const auto& activation1005 = metricProducer1005->mEventActivationMap.begin()->second;
+//    EXPECT_EQ(100 * NS_PER_SEC, activation1005->ttl_ns);
+//    EXPECT_EQ(0, activation1005->start_ns);
+//    EXPECT_FALSE(metricProducer1006->isActive());
+//    const auto& activation1006 = metricProducer1006->mEventActivationMap.begin()->second;
+//    EXPECT_EQ(200 * NS_PER_SEC, activation1006->ttl_ns);
+//    EXPECT_EQ(0, activation1006->start_ns);
+//
+//    processor2->LoadActiveConfigsFromDisk();
+//
+//    // After loading activations from disk, assert that all 3 metrics are active.
+//    EXPECT_TRUE(metricProducer1003->isActive());
+//    EXPECT_EQ(timeBase2 + ttl3 - activation1003->ttl_ns, activation1003->start_ns);
+//    EXPECT_TRUE(metricProducer1005->isActive());
+//    EXPECT_EQ(timeBase2 + ttl5 - activation1005->ttl_ns, activation1005->start_ns);
+//    EXPECT_TRUE(metricProducer1006->isActive());
+//    EXPECT_EQ(timeBase2 + ttl6 - activation1006->ttl_ns, activation1003->start_ns);
+//
+//    // Make sure no more broadcasts have happened.
+//    EXPECT_EQ(broadcastCount, 1);
+//}
+//
+//TEST(StatsLogProcessorTest, TestActivationOnBoot) {
+//    int uid = 1111;
+//
+//    StatsdConfig config1;
+//    config1.set_id(12341);
+//    config1.add_allowed_log_source("AID_ROOT");  // LogEvent defaults to UID of root.
+//    auto wakelockAcquireMatcher = CreateAcquireWakelockAtomMatcher();
+//    *config1.add_atom_matcher() = wakelockAcquireMatcher;
+//
+//    long metricId1 = 1234561;
+//    long metricId2 = 1234562;
+//    auto countMetric1 = config1.add_count_metric();
+//    countMetric1->set_id(metricId1);
+//    countMetric1->set_what(wakelockAcquireMatcher.id());
+//    countMetric1->set_bucket(FIVE_MINUTES);
+//
+//    auto countMetric2 = config1.add_count_metric();
+//    countMetric2->set_id(metricId2);
+//    countMetric2->set_what(wakelockAcquireMatcher.id());
+//    countMetric2->set_bucket(FIVE_MINUTES);
+//
+//    auto metric1Activation = config1.add_metric_activation();
+//    metric1Activation->set_metric_id(metricId1);
+//    metric1Activation->set_activation_type(ACTIVATE_ON_BOOT);
+//    auto metric1ActivationTrigger = metric1Activation->add_event_activation();
+//    metric1ActivationTrigger->set_atom_matcher_id(wakelockAcquireMatcher.id());
+//    metric1ActivationTrigger->set_ttl_seconds(100);
+//
+//    ConfigKey cfgKey1(uid, 12341);
+//    long timeBase1 = 1;
+//    sp<StatsLogProcessor> processor =
+//            CreateStatsLogProcessor(timeBase1, timeBase1, config1, cfgKey1);
+//
+//    EXPECT_EQ(1, processor->mMetricsManagers.size());
+//    auto it = processor->mMetricsManagers.find(cfgKey1);
+//    EXPECT_TRUE(it != processor->mMetricsManagers.end());
+//    auto& metricsManager1 = it->second;
+//    EXPECT_TRUE(metricsManager1->isActive());
+//
+//    auto metricIt = metricsManager1->mAllMetricProducers.begin();
+//    for (; metricIt != metricsManager1->mAllMetricProducers.end(); metricIt++) {
+//        if ((*metricIt)->getMetricId() == metricId1) {
+//            break;
+//        }
+//    }
+//    EXPECT_TRUE(metricIt != metricsManager1->mAllMetricProducers.end());
+//    auto& metricProducer1 = *metricIt;
+//    EXPECT_FALSE(metricProducer1->isActive());
+//
+//    metricIt = metricsManager1->mAllMetricProducers.begin();
+//    for (; metricIt != metricsManager1->mAllMetricProducers.end(); metricIt++) {
+//        if ((*metricIt)->getMetricId() == metricId2) {
+//            break;
+//        }
+//    }
+//    EXPECT_TRUE(metricIt != metricsManager1->mAllMetricProducers.end());
+//    auto& metricProducer2 = *metricIt;
+//    EXPECT_TRUE(metricProducer2->isActive());
+//
+//    const auto& activation1 = metricProducer1->mEventActivationMap.begin()->second;
+//    EXPECT_EQ(100 * NS_PER_SEC, activation1->ttl_ns);
+//    EXPECT_EQ(0, activation1->start_ns);
+//    EXPECT_EQ(kNotActive, activation1->state);
+//
+//    std::vector<AttributionNodeInternal> attributions1 = {CreateAttribution(111, "App1")};
+//    auto event = CreateAcquireWakelockEvent(attributions1, "wl1", 100 + timeBase1);
+//    processor->OnLogEvent(event.get());
+//
+//    EXPECT_FALSE(metricProducer1->isActive());
+//    EXPECT_EQ(0, activation1->start_ns);
+//    EXPECT_EQ(kActiveOnBoot, activation1->state);
+//
+//    int64_t shutDownTime = timeBase1 + 100 * NS_PER_SEC;
+//    processor->SaveActiveConfigsToDisk(shutDownTime);
+//    EXPECT_FALSE(metricProducer1->isActive());
+//    const int64_t ttl1 = metric1ActivationTrigger->ttl_seconds() * NS_PER_SEC;
+//
+//    long timeBase2 = 1000;
+//    sp<StatsLogProcessor> processor2 =
+//            CreateStatsLogProcessor(timeBase2, timeBase2, config1, cfgKey1);
+//
+//    EXPECT_EQ(1, processor2->mMetricsManagers.size());
+//    it = processor2->mMetricsManagers.find(cfgKey1);
+//    EXPECT_TRUE(it != processor2->mMetricsManagers.end());
+//    auto& metricsManager1001 = it->second;
+//    EXPECT_TRUE(metricsManager1001->isActive());
+//
+//    metricIt = metricsManager1001->mAllMetricProducers.begin();
+//    for (; metricIt != metricsManager1001->mAllMetricProducers.end(); metricIt++) {
+//        if ((*metricIt)->getMetricId() == metricId1) {
+//            break;
+//        }
+//    }
+//    EXPECT_TRUE(metricIt != metricsManager1001->mAllMetricProducers.end());
+//    auto& metricProducer1001 = *metricIt;
+//    EXPECT_FALSE(metricProducer1001->isActive());
+//
+//    metricIt = metricsManager1001->mAllMetricProducers.begin();
+//    for (; metricIt != metricsManager1001->mAllMetricProducers.end(); metricIt++) {
+//        if ((*metricIt)->getMetricId() == metricId2) {
+//            break;
+//        }
+//    }
+//    EXPECT_TRUE(metricIt != metricsManager1001->mAllMetricProducers.end());
+//    auto& metricProducer1002 = *metricIt;
+//    EXPECT_TRUE(metricProducer1002->isActive());
+//
+//    const auto& activation1001 = metricProducer1001->mEventActivationMap.begin()->second;
+//    EXPECT_EQ(100 * NS_PER_SEC, activation1001->ttl_ns);
+//    EXPECT_EQ(0, activation1001->start_ns);
+//    EXPECT_EQ(kNotActive, activation1001->state);
+//
+//    processor2->LoadActiveConfigsFromDisk();
+//
+//    EXPECT_TRUE(metricProducer1001->isActive());
+//    EXPECT_EQ(timeBase2 + ttl1 - activation1001->ttl_ns, activation1001->start_ns);
+//    EXPECT_EQ(kActive, activation1001->state);
+//}
+//
+//TEST(StatsLogProcessorTest, TestActivationOnBootMultipleActivations) {
+//    int uid = 1111;
+//
+//    // Create config with 2 metrics:
+//    // Metric 1: Activate on boot with 2 activations
+//    // Metric 2: Always active
+//    StatsdConfig config1;
+//    config1.set_id(12341);
+//    config1.add_allowed_log_source("AID_ROOT");  // LogEvent defaults to UID of root.
+//    auto wakelockAcquireMatcher = CreateAcquireWakelockAtomMatcher();
+//    auto screenOnMatcher = CreateScreenTurnedOnAtomMatcher();
+//    *config1.add_atom_matcher() = wakelockAcquireMatcher;
+//    *config1.add_atom_matcher() = screenOnMatcher;
+//
+//    long metricId1 = 1234561;
+//    long metricId2 = 1234562;
+//
+//    auto countMetric1 = config1.add_count_metric();
+//    countMetric1->set_id(metricId1);
+//    countMetric1->set_what(wakelockAcquireMatcher.id());
+//    countMetric1->set_bucket(FIVE_MINUTES);
+//
+//    auto countMetric2 = config1.add_count_metric();
+//    countMetric2->set_id(metricId2);
+//    countMetric2->set_what(wakelockAcquireMatcher.id());
+//    countMetric2->set_bucket(FIVE_MINUTES);
+//
+//    auto metric1Activation = config1.add_metric_activation();
+//    metric1Activation->set_metric_id(metricId1);
+//    metric1Activation->set_activation_type(ACTIVATE_ON_BOOT);
+//    auto metric1ActivationTrigger1 = metric1Activation->add_event_activation();
+//    metric1ActivationTrigger1->set_atom_matcher_id(wakelockAcquireMatcher.id());
+//    metric1ActivationTrigger1->set_ttl_seconds(100);
+//    auto metric1ActivationTrigger2 = metric1Activation->add_event_activation();
+//    metric1ActivationTrigger2->set_atom_matcher_id(screenOnMatcher.id());
+//    metric1ActivationTrigger2->set_ttl_seconds(200);
+//
+//    ConfigKey cfgKey1(uid, 12341);
+//    long timeBase1 = 1;
+//    sp<StatsLogProcessor> processor =
+//            CreateStatsLogProcessor(timeBase1, timeBase1, config1, cfgKey1);
+//
+//    // Metric 1 is not active.
+//    // Metric 2 is active.
+//    // {{{---------------------------------------------------------------------------
+//    EXPECT_EQ(1, processor->mMetricsManagers.size());
+//    auto it = processor->mMetricsManagers.find(cfgKey1);
+//    EXPECT_TRUE(it != processor->mMetricsManagers.end());
+//    auto& metricsManager1 = it->second;
+//    EXPECT_TRUE(metricsManager1->isActive());
+//
+//    auto metricIt = metricsManager1->mAllMetricProducers.begin();
+//    for (; metricIt != metricsManager1->mAllMetricProducers.end(); metricIt++) {
+//        if ((*metricIt)->getMetricId() == metricId1) {
+//            break;
+//        }
+//    }
+//    EXPECT_TRUE(metricIt != metricsManager1->mAllMetricProducers.end());
+//    auto& metricProducer1 = *metricIt;
+//    EXPECT_FALSE(metricProducer1->isActive());
+//
+//    metricIt = metricsManager1->mAllMetricProducers.begin();
+//    for (; metricIt != metricsManager1->mAllMetricProducers.end(); metricIt++) {
+//        if ((*metricIt)->getMetricId() == metricId2) {
+//            break;
+//        }
+//    }
+//    EXPECT_TRUE(metricIt != metricsManager1->mAllMetricProducers.end());
+//    auto& metricProducer2 = *metricIt;
+//    EXPECT_TRUE(metricProducer2->isActive());
+//
+//    int i = 0;
+//    for (; i < metricsManager1->mAllAtomMatchers.size(); i++) {
+//        if (metricsManager1->mAllAtomMatchers[i]->getId() ==
+//                metric1ActivationTrigger1->atom_matcher_id()) {
+//            break;
+//        }
+//    }
+//    const auto& activation1 = metricProducer1->mEventActivationMap.at(i);
+//    EXPECT_EQ(100 * NS_PER_SEC, activation1->ttl_ns);
+//    EXPECT_EQ(0, activation1->start_ns);
+//    EXPECT_EQ(kNotActive, activation1->state);
+//
+//    i = 0;
+//    for (; i < metricsManager1->mAllAtomMatchers.size(); i++) {
+//        if (metricsManager1->mAllAtomMatchers[i]->getId() ==
+//                metric1ActivationTrigger2->atom_matcher_id()) {
+//            break;
+//        }
+//    }
+//    const auto& activation2 = metricProducer1->mEventActivationMap.at(i);
+//    EXPECT_EQ(200 * NS_PER_SEC, activation2->ttl_ns);
+//    EXPECT_EQ(0, activation2->start_ns);
+//    EXPECT_EQ(kNotActive, activation2->state);
+//    // }}}------------------------------------------------------------------------------
+//
+//    // Trigger Activation 1 for Metric 1
+//    std::vector<AttributionNodeInternal> attributions1 = {CreateAttribution(111, "App1")};
+//    auto event = CreateAcquireWakelockEvent(attributions1, "wl1", 100 + timeBase1);
+//    processor->OnLogEvent(event.get());
+//
+//    // Metric 1 is not active; Activation 1 set to kActiveOnBoot
+//    // Metric 2 is active.
+//    // {{{---------------------------------------------------------------------------
+//    EXPECT_FALSE(metricProducer1->isActive());
+//    EXPECT_EQ(0, activation1->start_ns);
+//    EXPECT_EQ(kActiveOnBoot, activation1->state);
+//    EXPECT_EQ(0, activation2->start_ns);
+//    EXPECT_EQ(kNotActive, activation2->state);
+//
+//    EXPECT_TRUE(metricProducer2->isActive());
+//    // }}}-----------------------------------------------------------------------------
+//
+//    // Simulate shutdown by saving state to disk
+//    int64_t shutDownTime = timeBase1 + 100 * NS_PER_SEC;
+//    processor->SaveActiveConfigsToDisk(shutDownTime);
+//    EXPECT_FALSE(metricProducer1->isActive());
+//    int64_t ttl1 = metric1ActivationTrigger1->ttl_seconds() * NS_PER_SEC;
+//
+//    // Simulate device restarted state by creating new instance of StatsLogProcessor with the
+//    // same config.
+//    long timeBase2 = 1000;
+//    sp<StatsLogProcessor> processor2 =
+//            CreateStatsLogProcessor(timeBase2, timeBase2, config1, cfgKey1);
+//
+//    // Metric 1 is not active.
+//    // Metric 2 is active.
+//    // {{{---------------------------------------------------------------------------
+//    EXPECT_EQ(1, processor2->mMetricsManagers.size());
+//    it = processor2->mMetricsManagers.find(cfgKey1);
+//    EXPECT_TRUE(it != processor2->mMetricsManagers.end());
+//    auto& metricsManager1001 = it->second;
+//    EXPECT_TRUE(metricsManager1001->isActive());
+//
+//    metricIt = metricsManager1001->mAllMetricProducers.begin();
+//    for (; metricIt != metricsManager1001->mAllMetricProducers.end(); metricIt++) {
+//        if ((*metricIt)->getMetricId() == metricId1) {
+//            break;
+//        }
+//    }
+//    EXPECT_TRUE(metricIt != metricsManager1001->mAllMetricProducers.end());
+//    auto& metricProducer1001 = *metricIt;
+//    EXPECT_FALSE(metricProducer1001->isActive());
+//
+//    metricIt = metricsManager1001->mAllMetricProducers.begin();
+//    for (; metricIt != metricsManager1001->mAllMetricProducers.end(); metricIt++) {
+//        if ((*metricIt)->getMetricId() == metricId2) {
+//            break;
+//        }
+//    }
+//    EXPECT_TRUE(metricIt != metricsManager1001->mAllMetricProducers.end());
+//    auto& metricProducer1002 = *metricIt;
+//    EXPECT_TRUE(metricProducer1002->isActive());
+//
+//    i = 0;
+//    for (; i < metricsManager1001->mAllAtomMatchers.size(); i++) {
+//        if (metricsManager1001->mAllAtomMatchers[i]->getId() ==
+//                metric1ActivationTrigger1->atom_matcher_id()) {
+//            break;
+//        }
+//    }
+//    const auto& activation1001_1 = metricProducer1001->mEventActivationMap.at(i);
+//    EXPECT_EQ(100 * NS_PER_SEC, activation1001_1->ttl_ns);
+//    EXPECT_EQ(0, activation1001_1->start_ns);
+//    EXPECT_EQ(kNotActive, activation1001_1->state);
+//
+//    i = 0;
+//    for (; i < metricsManager1001->mAllAtomMatchers.size(); i++) {
+//        if (metricsManager1001->mAllAtomMatchers[i]->getId() ==
+//                metric1ActivationTrigger2->atom_matcher_id()) {
+//            break;
+//        }
+//    }
+//
+//    const auto& activation1001_2 = metricProducer1001->mEventActivationMap.at(i);
+//    EXPECT_EQ(200 * NS_PER_SEC, activation1001_2->ttl_ns);
+//    EXPECT_EQ(0, activation1001_2->start_ns);
+//    EXPECT_EQ(kNotActive, activation1001_2->state);
+//    // }}}-----------------------------------------------------------------------------------
+//
+//    // Load saved state from disk.
+//    processor2->LoadActiveConfigsFromDisk();
+//
+//    // Metric 1 active; Activation 1 is active, Activation 2 is not active
+//    // Metric 2 is active.
+//    // {{{---------------------------------------------------------------------------
+//    EXPECT_TRUE(metricProducer1001->isActive());
+//    EXPECT_EQ(timeBase2 + ttl1 - activation1001_1->ttl_ns, activation1001_1->start_ns);
+//    EXPECT_EQ(kActive, activation1001_1->state);
+//    EXPECT_EQ(0, activation1001_2->start_ns);
+//    EXPECT_EQ(kNotActive, activation1001_2->state);
+//
+//    EXPECT_TRUE(metricProducer1002->isActive());
+//    // }}}--------------------------------------------------------------------------------
+//
+//    // Trigger Activation 2 for Metric 1.
+//    auto screenOnEvent = CreateScreenStateChangedEvent(
+//            android::view::DISPLAY_STATE_ON,
+//            timeBase2 + 200
+//    );
+//    processor2->OnLogEvent(screenOnEvent.get());
+//
+//    // Metric 1 active; Activation 1 is active, Activation 2 is set to kActiveOnBoot
+//    // Metric 2 is active.
+//    // {{{---------------------------------------------------------------------------
+//    EXPECT_TRUE(metricProducer1001->isActive());
+//    EXPECT_EQ(timeBase2 + ttl1 - activation1001_1->ttl_ns, activation1001_1->start_ns);
+//    EXPECT_EQ(kActive, activation1001_1->state);
+//    EXPECT_EQ(0, activation1001_2->start_ns);
+//    EXPECT_EQ(kActiveOnBoot, activation1001_2->state);
+//
+//    EXPECT_TRUE(metricProducer1002->isActive());
+//    // }}}---------------------------------------------------------------------------
+//
+//    // Simulate shutdown by saving state to disk
+//    shutDownTime = timeBase2 + 50 * NS_PER_SEC;
+//    processor2->SaveActiveConfigsToDisk(shutDownTime);
+//    EXPECT_TRUE(metricProducer1001->isActive());
+//    EXPECT_TRUE(metricProducer1002->isActive());
+//    ttl1 = timeBase2 + metric1ActivationTrigger1->ttl_seconds() * NS_PER_SEC - shutDownTime;
+//    int64_t ttl2 = metric1ActivationTrigger2->ttl_seconds() * NS_PER_SEC;
+//
+//    // Simulate device restarted state by creating new instance of StatsLogProcessor with the
+//    // same config.
+//    long timeBase3 = timeBase2 + 120 * NS_PER_SEC;
+//    sp<StatsLogProcessor> processor3 =
+//            CreateStatsLogProcessor(timeBase3, timeBase3, config1, cfgKey1);
+//
+//    // Metric 1 is not active.
+//    // Metric 2 is active.
+//    // {{{---------------------------------------------------------------------------
+//    EXPECT_EQ(1, processor3->mMetricsManagers.size());
+//    it = processor3->mMetricsManagers.find(cfgKey1);
+//    EXPECT_TRUE(it != processor3->mMetricsManagers.end());
+//    auto& metricsManagerTimeBase3 = it->second;
+//    EXPECT_TRUE(metricsManagerTimeBase3->isActive());
+//
+//    metricIt = metricsManagerTimeBase3->mAllMetricProducers.begin();
+//    for (; metricIt != metricsManagerTimeBase3->mAllMetricProducers.end(); metricIt++) {
+//        if ((*metricIt)->getMetricId() == metricId1) {
+//            break;
+//        }
+//    }
+//    EXPECT_TRUE(metricIt != metricsManagerTimeBase3->mAllMetricProducers.end());
+//    auto& metricProducerTimeBase3_1 = *metricIt;
+//    EXPECT_FALSE(metricProducerTimeBase3_1->isActive());
+//
+//    metricIt = metricsManagerTimeBase3->mAllMetricProducers.begin();
+//    for (; metricIt != metricsManagerTimeBase3->mAllMetricProducers.end(); metricIt++) {
+//        if ((*metricIt)->getMetricId() == metricId2) {
+//            break;
+//        }
+//    }
+//    EXPECT_TRUE(metricIt != metricsManagerTimeBase3->mAllMetricProducers.end());
+//    auto& metricProducerTimeBase3_2 = *metricIt;
+//    EXPECT_TRUE(metricProducerTimeBase3_2->isActive());
+//
+//    i = 0;
+//    for (; i < metricsManagerTimeBase3->mAllAtomMatchers.size(); i++) {
+//        if (metricsManagerTimeBase3->mAllAtomMatchers[i]->getId() ==
+//                metric1ActivationTrigger1->atom_matcher_id()) {
+//            break;
+//        }
+//    }
+//    const auto& activationTimeBase3_1 = metricProducerTimeBase3_1->mEventActivationMap.at(i);
+//    EXPECT_EQ(100 * NS_PER_SEC, activationTimeBase3_1->ttl_ns);
+//    EXPECT_EQ(0, activationTimeBase3_1->start_ns);
+//    EXPECT_EQ(kNotActive, activationTimeBase3_1->state);
+//
+//    i = 0;
+//    for (; i < metricsManagerTimeBase3->mAllAtomMatchers.size(); i++) {
+//        if (metricsManagerTimeBase3->mAllAtomMatchers[i]->getId() ==
+//                metric1ActivationTrigger2->atom_matcher_id()) {
+//            break;
+//        }
+//    }
+//
+//    const auto& activationTimeBase3_2 = metricProducerTimeBase3_1->mEventActivationMap.at(i);
+//    EXPECT_EQ(200 * NS_PER_SEC, activationTimeBase3_2->ttl_ns);
+//    EXPECT_EQ(0, activationTimeBase3_2->start_ns);
+//    EXPECT_EQ(kNotActive, activationTimeBase3_2->state);
+//
+//    EXPECT_TRUE(metricProducerTimeBase3_2->isActive());
+//    // }}}----------------------------------------------------------------------------------
+//
+//    // Load saved state from disk.
+//    processor3->LoadActiveConfigsFromDisk();
+//
+//    // Metric 1 active: Activation 1 is active, Activation 2 is active
+//    // Metric 2 is active.
+//    // {{{---------------------------------------------------------------------------
+//    EXPECT_TRUE(metricProducerTimeBase3_1->isActive());
+//    EXPECT_EQ(timeBase3 + ttl1 - activationTimeBase3_1->ttl_ns, activationTimeBase3_1->start_ns);
+//    EXPECT_EQ(kActive, activationTimeBase3_1->state);
+//    EXPECT_EQ(timeBase3 + ttl2 - activationTimeBase3_2->ttl_ns, activationTimeBase3_2->start_ns);
+//    EXPECT_EQ(kActive, activationTimeBase3_2->state);
+//
+//    EXPECT_TRUE(metricProducerTimeBase3_2->isActive());
+//    // }}}-------------------------------------------------------------------------------
+//
+//    // Trigger Activation 2 for Metric 1 again.
+//    screenOnEvent = CreateScreenStateChangedEvent(
+//            android::view::DISPLAY_STATE_ON,
+//            timeBase3 + 100 * NS_PER_SEC
+//    );
+//    processor3->OnLogEvent(screenOnEvent.get());
+//
+//    // Metric 1 active; Activation 1 is not active, Activation 2 is set to active
+//    // Metric 2 is active.
+//    // {{{---------------------------------------------------------------------------
+//    EXPECT_TRUE(metricProducerTimeBase3_1->isActive());
+//    EXPECT_EQ(kNotActive, activationTimeBase3_1->state);
+//    EXPECT_EQ(timeBase3 + ttl2 - activationTimeBase3_2->ttl_ns, activationTimeBase3_2->start_ns);
+//    EXPECT_EQ(kActive, activationTimeBase3_2->state);
+//
+//    EXPECT_TRUE(metricProducerTimeBase3_2->isActive());
+//    // }}}---------------------------------------------------------------------------
+//
+//    // Simulate shutdown by saving state to disk.
+//    shutDownTime = timeBase3 + 500 * NS_PER_SEC;
+//    processor3->SaveActiveConfigsToDisk(shutDownTime);
+//    EXPECT_TRUE(metricProducer1001->isActive());
+//    EXPECT_TRUE(metricProducer1002->isActive());
+//    ttl1 = timeBase3 + ttl1 - shutDownTime;
+//    ttl2 = timeBase3 + metric1ActivationTrigger2->ttl_seconds() * NS_PER_SEC - shutDownTime;
+//
+//    // Simulate device restarted state by creating new instance of StatsLogProcessor with the
+//    // same config.
+//    long timeBase4 = timeBase3 + 600 * NS_PER_SEC;
+//    sp<StatsLogProcessor> processor4 =
+//            CreateStatsLogProcessor(timeBase4, timeBase4, config1, cfgKey1);
+//
+//    // Metric 1 is not active.
+//    // Metric 2 is active.
+//    // {{{---------------------------------------------------------------------------
+//    EXPECT_EQ(1, processor4->mMetricsManagers.size());
+//    it = processor4->mMetricsManagers.find(cfgKey1);
+//    EXPECT_TRUE(it != processor4->mMetricsManagers.end());
+//    auto& metricsManagerTimeBase4 = it->second;
+//    EXPECT_TRUE(metricsManagerTimeBase4->isActive());
+//
+//    metricIt = metricsManagerTimeBase4->mAllMetricProducers.begin();
+//    for (; metricIt != metricsManagerTimeBase4->mAllMetricProducers.end(); metricIt++) {
+//        if ((*metricIt)->getMetricId() == metricId1) {
+//            break;
+//        }
+//    }
+//    EXPECT_TRUE(metricIt != metricsManagerTimeBase4->mAllMetricProducers.end());
+//    auto& metricProducerTimeBase4_1 = *metricIt;
+//    EXPECT_FALSE(metricProducerTimeBase4_1->isActive());
+//
+//    metricIt = metricsManagerTimeBase4->mAllMetricProducers.begin();
+//    for (; metricIt != metricsManagerTimeBase4->mAllMetricProducers.end(); metricIt++) {
+//        if ((*metricIt)->getMetricId() == metricId2) {
+//            break;
+//        }
+//    }
+//    EXPECT_TRUE(metricIt != metricsManagerTimeBase4->mAllMetricProducers.end());
+//    auto& metricProducerTimeBase4_2 = *metricIt;
+//    EXPECT_TRUE(metricProducerTimeBase4_2->isActive());
+//
+//    i = 0;
+//    for (; i < metricsManagerTimeBase4->mAllAtomMatchers.size(); i++) {
+//        if (metricsManagerTimeBase4->mAllAtomMatchers[i]->getId() ==
+//                metric1ActivationTrigger1->atom_matcher_id()) {
+//            break;
+//        }
+//    }
+//    const auto& activationTimeBase4_1 = metricProducerTimeBase4_1->mEventActivationMap.at(i);
+//    EXPECT_EQ(100 * NS_PER_SEC, activationTimeBase4_1->ttl_ns);
+//    EXPECT_EQ(0, activationTimeBase4_1->start_ns);
+//    EXPECT_EQ(kNotActive, activationTimeBase4_1->state);
+//
+//    i = 0;
+//    for (; i < metricsManagerTimeBase4->mAllAtomMatchers.size(); i++) {
+//        if (metricsManagerTimeBase4->mAllAtomMatchers[i]->getId() ==
+//                metric1ActivationTrigger2->atom_matcher_id()) {
+//            break;
+//        }
+//    }
+//
+//    const auto& activationTimeBase4_2 = metricProducerTimeBase4_1->mEventActivationMap.at(i);
+//    EXPECT_EQ(200 * NS_PER_SEC, activationTimeBase4_2->ttl_ns);
+//    EXPECT_EQ(0, activationTimeBase4_2->start_ns);
+//    EXPECT_EQ(kNotActive, activationTimeBase4_2->state);
+//
+//    EXPECT_TRUE(metricProducerTimeBase4_2->isActive());
+//    // }}}----------------------------------------------------------------------------------
+//
+//    // Load saved state from disk.
+//    processor4->LoadActiveConfigsFromDisk();
+//
+//    // Metric 1 active: Activation 1 is not active, Activation 2 is not active
+//    // Metric 2 is active.
+//    // {{{---------------------------------------------------------------------------
+//    EXPECT_FALSE(metricProducerTimeBase4_1->isActive());
+//    EXPECT_EQ(kNotActive, activationTimeBase4_1->state);
+//    EXPECT_EQ(kNotActive, activationTimeBase4_2->state);
+//
+//    EXPECT_TRUE(metricProducerTimeBase4_2->isActive());
+//    // }}}-------------------------------------------------------------------------------
+//}
+//
+//TEST(StatsLogProcessorTest, TestActivationOnBootMultipleActivationsDifferentActivationTypes) {
+//    int uid = 1111;
+//
+//    // Create config with 2 metrics:
+//    // Metric 1: Activate on boot with 2 activations
+//    // Metric 2: Always active
+//    StatsdConfig config1;
+//    config1.set_id(12341);
+//    config1.add_allowed_log_source("AID_ROOT");  // LogEvent defaults to UID of root.
+//    auto wakelockAcquireMatcher = CreateAcquireWakelockAtomMatcher();
+//    auto screenOnMatcher = CreateScreenTurnedOnAtomMatcher();
+//    *config1.add_atom_matcher() = wakelockAcquireMatcher;
+//    *config1.add_atom_matcher() = screenOnMatcher;
+//
+//    long metricId1 = 1234561;
+//    long metricId2 = 1234562;
+//
+//    auto countMetric1 = config1.add_count_metric();
+//    countMetric1->set_id(metricId1);
+//    countMetric1->set_what(wakelockAcquireMatcher.id());
+//    countMetric1->set_bucket(FIVE_MINUTES);
+//
+//    auto countMetric2 = config1.add_count_metric();
+//    countMetric2->set_id(metricId2);
+//    countMetric2->set_what(wakelockAcquireMatcher.id());
+//    countMetric2->set_bucket(FIVE_MINUTES);
+//
+//    auto metric1Activation = config1.add_metric_activation();
+//    metric1Activation->set_metric_id(metricId1);
+//    metric1Activation->set_activation_type(ACTIVATE_ON_BOOT);
+//    auto metric1ActivationTrigger1 = metric1Activation->add_event_activation();
+//    metric1ActivationTrigger1->set_atom_matcher_id(wakelockAcquireMatcher.id());
+//    metric1ActivationTrigger1->set_ttl_seconds(100);
+//    auto metric1ActivationTrigger2 = metric1Activation->add_event_activation();
+//    metric1ActivationTrigger2->set_atom_matcher_id(screenOnMatcher.id());
+//    metric1ActivationTrigger2->set_ttl_seconds(200);
+//    metric1ActivationTrigger2->set_activation_type(ACTIVATE_IMMEDIATELY);
+//
+//    ConfigKey cfgKey1(uid, 12341);
+//    long timeBase1 = 1;
+//    sp<StatsLogProcessor> processor1 =
+//            CreateStatsLogProcessor(timeBase1, timeBase1, config1, cfgKey1);
+//
+//    // Metric 1 is not active.
+//    // Metric 2 is active.
+//    // {{{---------------------------------------------------------------------------
+//    EXPECT_EQ(1, processor1->mMetricsManagers.size());
+//    auto it = processor1->mMetricsManagers.find(cfgKey1);
+//    EXPECT_TRUE(it != processor1->mMetricsManagers.end());
+//    auto& metricsManager1 = it->second;
+//    EXPECT_TRUE(metricsManager1->isActive());
+//
+//    EXPECT_EQ(metricsManager1->mAllMetricProducers.size(), 2);
+//    // We assume that the index of a MetricProducer within the mAllMetricProducers
+//    // array follows the order in which metrics are added to the config.
+//    auto& metricProducer1_1 = metricsManager1->mAllMetricProducers[0];
+//    EXPECT_EQ(metricProducer1_1->getMetricId(), metricId1);
+//    EXPECT_FALSE(metricProducer1_1->isActive());  // inactive due to associated MetricActivation
+//
+//    auto& metricProducer1_2 = metricsManager1->mAllMetricProducers[1];
+//    EXPECT_EQ(metricProducer1_2->getMetricId(), metricId2);
+//    EXPECT_TRUE(metricProducer1_2->isActive());
+//
+//    EXPECT_EQ(metricProducer1_1->mEventActivationMap.size(), 2);
+//    // The key in mEventActivationMap is the index of the associated atom matcher. We assume
+//    // that matchers are indexed in the order that they are added to the config.
+//    const auto& activation1_1_1 = metricProducer1_1->mEventActivationMap.at(0);
+//    EXPECT_EQ(100 * NS_PER_SEC, activation1_1_1->ttl_ns);
+//    EXPECT_EQ(0, activation1_1_1->start_ns);
+//    EXPECT_EQ(kNotActive, activation1_1_1->state);
+//    EXPECT_EQ(ACTIVATE_ON_BOOT, activation1_1_1->activationType);
+//
+//    const auto& activation1_1_2 = metricProducer1_1->mEventActivationMap.at(1);
+//    EXPECT_EQ(200 * NS_PER_SEC, activation1_1_2->ttl_ns);
+//    EXPECT_EQ(0, activation1_1_2->start_ns);
+//    EXPECT_EQ(kNotActive, activation1_1_2->state);
+//    EXPECT_EQ(ACTIVATE_IMMEDIATELY, activation1_1_2->activationType);
+//    // }}}------------------------------------------------------------------------------
+//
+//    // Trigger Activation 1 for Metric 1
+//    std::vector<AttributionNodeInternal> attributions1 = {CreateAttribution(111, "App1")};
+//    auto event = CreateAcquireWakelockEvent(attributions1, "wl1", 100 + timeBase1);
+//    processor1->OnLogEvent(event.get());
+//
+//    // Metric 1 is not active; Activation 1 set to kActiveOnBoot
+//    // Metric 2 is active.
+//    // {{{---------------------------------------------------------------------------
+//    EXPECT_FALSE(metricProducer1_1->isActive());
+//    EXPECT_EQ(0, activation1_1_1->start_ns);
+//    EXPECT_EQ(kActiveOnBoot, activation1_1_1->state);
+//    EXPECT_EQ(0, activation1_1_2->start_ns);
+//    EXPECT_EQ(kNotActive, activation1_1_2->state);
+//
+//    EXPECT_TRUE(metricProducer1_2->isActive());
+//    // }}}-----------------------------------------------------------------------------
+//
+//    // Simulate shutdown by saving state to disk
+//    int64_t shutDownTime = timeBase1 + 100 * NS_PER_SEC;
+//    processor1->SaveActiveConfigsToDisk(shutDownTime);
+//    EXPECT_FALSE(metricProducer1_1->isActive());
+//
+//    // Simulate device restarted state by creating new instance of StatsLogProcessor with the
+//    // same config.
+//    long timeBase2 = 1000;
+//    sp<StatsLogProcessor> processor2 =
+//            CreateStatsLogProcessor(timeBase2, timeBase2, config1, cfgKey1);
+//
+//    // Metric 1 is not active.
+//    // Metric 2 is active.
+//    // {{{---------------------------------------------------------------------------
+//    EXPECT_EQ(1, processor2->mMetricsManagers.size());
+//    it = processor2->mMetricsManagers.find(cfgKey1);
+//    EXPECT_TRUE(it != processor2->mMetricsManagers.end());
+//    auto& metricsManager2 = it->second;
+//    EXPECT_TRUE(metricsManager2->isActive());
+//
+//    EXPECT_EQ(metricsManager2->mAllMetricProducers.size(), 2);
+//    // We assume that the index of a MetricProducer within the mAllMetricProducers
+//    // array follows the order in which metrics are added to the config.
+//    auto& metricProducer2_1 = metricsManager2->mAllMetricProducers[0];
+//    EXPECT_EQ(metricProducer2_1->getMetricId(), metricId1);
+//    EXPECT_FALSE(metricProducer2_1->isActive());
+//
+//    auto& metricProducer2_2 = metricsManager2->mAllMetricProducers[1];
+//    EXPECT_EQ(metricProducer2_2->getMetricId(), metricId2);
+//    EXPECT_TRUE(metricProducer2_2->isActive());
+//
+//    EXPECT_EQ(metricProducer2_1->mEventActivationMap.size(), 2);
+//    // The key in mEventActivationMap is the index of the associated atom matcher. We assume
+//    // that matchers are indexed in the order that they are added to the config.
+//    const auto& activation2_1_1 = metricProducer2_1->mEventActivationMap.at(0);
+//    EXPECT_EQ(100 * NS_PER_SEC, activation2_1_1->ttl_ns);
+//    EXPECT_EQ(0, activation2_1_1->start_ns);
+//    EXPECT_EQ(kNotActive, activation2_1_1->state);
+//    EXPECT_EQ(ACTIVATE_ON_BOOT, activation2_1_1->activationType);
+//
+//    const auto& activation2_1_2 = metricProducer2_1->mEventActivationMap.at(1);
+//    EXPECT_EQ(200 * NS_PER_SEC, activation2_1_2->ttl_ns);
+//    EXPECT_EQ(0, activation2_1_2->start_ns);
+//    EXPECT_EQ(kNotActive, activation2_1_2->state);
+//    EXPECT_EQ(ACTIVATE_IMMEDIATELY, activation2_1_2->activationType);
+//    // }}}-----------------------------------------------------------------------------------
+//
+//    // Load saved state from disk.
+//    processor2->LoadActiveConfigsFromDisk();
+//
+//    // Metric 1 active; Activation 1 is active, Activation 2 is not active
+//    // Metric 2 is active.
+//    // {{{---------------------------------------------------------------------------
+//    EXPECT_TRUE(metricProducer2_1->isActive());
+//    int64_t ttl1 = metric1ActivationTrigger1->ttl_seconds() * NS_PER_SEC;
+//    EXPECT_EQ(timeBase2 + ttl1 - activation2_1_1->ttl_ns, activation2_1_1->start_ns);
+//    EXPECT_EQ(kActive, activation2_1_1->state);
+//    EXPECT_EQ(0, activation2_1_2->start_ns);
+//    EXPECT_EQ(kNotActive, activation2_1_2->state);
+//
+//    EXPECT_TRUE(metricProducer2_2->isActive());
+//    // }}}--------------------------------------------------------------------------------
+//
+//    // Trigger Activation 2 for Metric 1.
+//    auto screenOnEvent = CreateScreenStateChangedEvent(
+//            android::view::DISPLAY_STATE_ON,
+//            timeBase2 + 200
+//    );
+//    processor2->OnLogEvent(screenOnEvent.get());
+//
+//    // Metric 1 active; Activation 1 is active, Activation 2 is active
+//    // Metric 2 is active.
+//    // {{{---------------------------------------------------------------------------
+//    EXPECT_TRUE(metricProducer2_1->isActive());
+//    EXPECT_EQ(timeBase2 + ttl1 - activation2_1_1->ttl_ns, activation2_1_1->start_ns);
+//    EXPECT_EQ(kActive, activation2_1_1->state);
+//    EXPECT_EQ(screenOnEvent->GetElapsedTimestampNs(), activation2_1_2->start_ns);
+//    EXPECT_EQ(kActive, activation2_1_2->state);
+//
+//    EXPECT_TRUE(metricProducer2_2->isActive());
+//    // }}}---------------------------------------------------------------------------
+//
+//    // Simulate shutdown by saving state to disk
+//    shutDownTime = timeBase2 + 50 * NS_PER_SEC;
+//    processor2->SaveActiveConfigsToDisk(shutDownTime);
+//    EXPECT_TRUE(metricProducer2_1->isActive());
+//    EXPECT_TRUE(metricProducer2_2->isActive());
+//    ttl1 -= shutDownTime - timeBase2;
+//    int64_t ttl2 = metric1ActivationTrigger2->ttl_seconds() * NS_PER_SEC
+//            - (shutDownTime - screenOnEvent->GetElapsedTimestampNs());
+//
+//    // Simulate device restarted state by creating new instance of StatsLogProcessor with the
+//    // same config.
+//    long timeBase3 = timeBase2 + 120 * NS_PER_SEC;
+//    sp<StatsLogProcessor> processor3 =
+//            CreateStatsLogProcessor(timeBase3, timeBase3, config1, cfgKey1);
+//
+//    // Metric 1 is not active.
+//    // Metric 2 is active.
+//    // {{{---------------------------------------------------------------------------
+//    EXPECT_EQ(1, processor3->mMetricsManagers.size());
+//    it = processor3->mMetricsManagers.find(cfgKey1);
+//    EXPECT_TRUE(it != processor3->mMetricsManagers.end());
+//    auto& metricsManager3 = it->second;
+//    EXPECT_TRUE(metricsManager3->isActive());
+//
+//    EXPECT_EQ(metricsManager3->mAllMetricProducers.size(), 2);
+//    // We assume that the index of a MetricProducer within the mAllMetricProducers
+//    // array follows the order in which metrics are added to the config.
+//    auto& metricProducer3_1 = metricsManager3->mAllMetricProducers[0];
+//    EXPECT_EQ(metricProducer3_1->getMetricId(), metricId1);
+//    EXPECT_FALSE(metricProducer3_1->isActive());
+//
+//    auto& metricProducer3_2 = metricsManager3->mAllMetricProducers[1];
+//    EXPECT_EQ(metricProducer3_2->getMetricId(), metricId2);
+//    EXPECT_TRUE(metricProducer3_2->isActive());
+//
+//    EXPECT_EQ(metricProducer3_1->mEventActivationMap.size(), 2);
+//    // The key in mEventActivationMap is the index of the associated atom matcher. We assume
+//    // that matchers are indexed in the order that they are added to the config.
+//    const auto& activation3_1_1 = metricProducer3_1->mEventActivationMap.at(0);
+//    EXPECT_EQ(100 * NS_PER_SEC, activation3_1_1->ttl_ns);
+//    EXPECT_EQ(0, activation3_1_1->start_ns);
+//    EXPECT_EQ(kNotActive, activation3_1_1->state);
+//    EXPECT_EQ(ACTIVATE_ON_BOOT, activation3_1_1->activationType);
+//
+//    const auto& activation3_1_2 = metricProducer3_1->mEventActivationMap.at(1);
+//    EXPECT_EQ(200 * NS_PER_SEC, activation3_1_2->ttl_ns);
+//    EXPECT_EQ(0, activation3_1_2->start_ns);
+//    EXPECT_EQ(kNotActive, activation3_1_2->state);
+//    EXPECT_EQ(ACTIVATE_IMMEDIATELY, activation3_1_2->activationType);
+//    // }}}----------------------------------------------------------------------------------
+//
+//    // Load saved state from disk.
+//    processor3->LoadActiveConfigsFromDisk();
+//
+//    // Metric 1 active: Activation 1 is active, Activation 2 is active
+//    // Metric 2 is active.
+//    // {{{---------------------------------------------------------------------------
+//    EXPECT_TRUE(metricProducer3_1->isActive());
+//    EXPECT_EQ(timeBase3 + ttl1 - activation3_1_1->ttl_ns, activation3_1_1->start_ns);
+//    EXPECT_EQ(kActive, activation3_1_1->state);
+//    EXPECT_EQ(timeBase3 + ttl2 - activation3_1_2->ttl_ns, activation3_1_2->start_ns);
+//    EXPECT_EQ(kActive, activation3_1_2->state);
+//
+//    EXPECT_TRUE(metricProducer3_2->isActive());
+//    // }}}-------------------------------------------------------------------------------
+//
+//
+//    // Trigger Activation 2 for Metric 1 again.
+//    screenOnEvent = CreateScreenStateChangedEvent(
+//            android::view::DISPLAY_STATE_ON,
+//            timeBase3 + 100 * NS_PER_SEC
+//    );
+//    processor3->OnLogEvent(screenOnEvent.get());
+//
+//    // Metric 1 active; Activation 1 is inactive (above screenOnEvent causes ttl1 to expire),
+//    //                  Activation 2 is set to active
+//    // Metric 2 is active.
+//    // {{{---------------------------------------------------------------------------
+//    EXPECT_TRUE(metricProducer3_1->isActive());
+//    EXPECT_EQ(kNotActive, activation3_1_1->state);
+//    EXPECT_EQ(screenOnEvent->GetElapsedTimestampNs(), activation3_1_2->start_ns);
+//    EXPECT_EQ(kActive, activation3_1_2->state);
+//
+//    EXPECT_TRUE(metricProducer3_2->isActive());
+//    // }}}---------------------------------------------------------------------------
+//}
+//
+//TEST(StatsLogProcessorTest, TestActivationsPersistAcrossSystemServerRestart) {
+//    int uid = 9876;
+//    long configId = 12341;
+//
+//    // Create config with 3 metrics:
+//    // Metric 1: Activate on 2 activations, 1 on boot, 1 immediate.
+//    // Metric 2: Activate on 2 activations, 1 on boot, 1 immediate.
+//    // Metric 3: Always active
+//    StatsdConfig config1;
+//    config1.set_id(configId);
+//    config1.add_allowed_log_source("AID_ROOT");  // LogEvent defaults to UID of root.
+//    auto wakelockAcquireMatcher = CreateAcquireWakelockAtomMatcher();
+//    auto screenOnMatcher = CreateScreenTurnedOnAtomMatcher();
+//    auto jobStartMatcher = CreateStartScheduledJobAtomMatcher();
+//    auto jobFinishMatcher = CreateFinishScheduledJobAtomMatcher();
+//    *config1.add_atom_matcher() = wakelockAcquireMatcher;
+//    *config1.add_atom_matcher() = screenOnMatcher;
+//    *config1.add_atom_matcher() = jobStartMatcher;
+//    *config1.add_atom_matcher() = jobFinishMatcher;
+//
+//    long metricId1 = 1234561;
+//    long metricId2 = 1234562;
+//    long metricId3 = 1234563;
+//
+//    auto countMetric1 = config1.add_count_metric();
+//    countMetric1->set_id(metricId1);
+//    countMetric1->set_what(wakelockAcquireMatcher.id());
+//    countMetric1->set_bucket(FIVE_MINUTES);
+//
+//    auto countMetric2 = config1.add_count_metric();
+//    countMetric2->set_id(metricId2);
+//    countMetric2->set_what(wakelockAcquireMatcher.id());
+//    countMetric2->set_bucket(FIVE_MINUTES);
+//
+//    auto countMetric3 = config1.add_count_metric();
+//    countMetric3->set_id(metricId3);
+//    countMetric3->set_what(wakelockAcquireMatcher.id());
+//    countMetric3->set_bucket(FIVE_MINUTES);
+//
+//    // Metric 1 activates on boot for wakelock acquire, immediately for screen on.
+//    auto metric1Activation = config1.add_metric_activation();
+//    metric1Activation->set_metric_id(metricId1);
+//    auto metric1ActivationTrigger1 = metric1Activation->add_event_activation();
+//    metric1ActivationTrigger1->set_atom_matcher_id(wakelockAcquireMatcher.id());
+//    metric1ActivationTrigger1->set_ttl_seconds(100);
+//    metric1ActivationTrigger1->set_activation_type(ACTIVATE_ON_BOOT);
+//    auto metric1ActivationTrigger2 = metric1Activation->add_event_activation();
+//    metric1ActivationTrigger2->set_atom_matcher_id(screenOnMatcher.id());
+//    metric1ActivationTrigger2->set_ttl_seconds(200);
+//    metric1ActivationTrigger2->set_activation_type(ACTIVATE_IMMEDIATELY);
+//
+//    // Metric 2 activates on boot for scheduled job start, immediately for scheduled job finish.
+//    auto metric2Activation = config1.add_metric_activation();
+//    metric2Activation->set_metric_id(metricId2);
+//    auto metric2ActivationTrigger1 = metric2Activation->add_event_activation();
+//    metric2ActivationTrigger1->set_atom_matcher_id(jobStartMatcher.id());
+//    metric2ActivationTrigger1->set_ttl_seconds(100);
+//    metric2ActivationTrigger1->set_activation_type(ACTIVATE_ON_BOOT);
+//    auto metric2ActivationTrigger2 = metric2Activation->add_event_activation();
+//    metric2ActivationTrigger2->set_atom_matcher_id(jobFinishMatcher.id());
+//    metric2ActivationTrigger2->set_ttl_seconds(200);
+//    metric2ActivationTrigger2->set_activation_type(ACTIVATE_IMMEDIATELY);
+//
+//    // Send the config.
+//    shared_ptr<StatsService> service = SharedRefBase::make<StatsService>(nullptr, nullptr);
+//    string serialized = config1.SerializeAsString();
+//    service->addConfigurationChecked(uid, configId, {serialized.begin(), serialized.end()});
+//
+//    // Make sure the config is stored on disk. Otherwise, we will not reset on system server death.
+//    StatsdConfig tmpConfig;
+//    ConfigKey cfgKey1(uid, configId);
+//    EXPECT_TRUE(StorageManager::readConfigFromDisk(cfgKey1, &tmpConfig));
+//
+//    // Metric 1 is not active.
+//    // Metric 2 is not active.
+//    // Metric 3 is active.
+//    // {{{---------------------------------------------------------------------------
+//    sp<StatsLogProcessor> processor = service->mProcessor;
+//    EXPECT_EQ(1, processor->mMetricsManagers.size());
+//    auto it = processor->mMetricsManagers.find(cfgKey1);
+//    EXPECT_TRUE(it != processor->mMetricsManagers.end());
+//    auto& metricsManager1 = it->second;
+//    EXPECT_TRUE(metricsManager1->isActive());
+//    EXPECT_EQ(3, metricsManager1->mAllMetricProducers.size());
+//
+//    auto& metricProducer1 = metricsManager1->mAllMetricProducers[0];
+//    EXPECT_EQ(metricId1, metricProducer1->getMetricId());
+//    EXPECT_FALSE(metricProducer1->isActive());
+//
+//    auto& metricProducer2 = metricsManager1->mAllMetricProducers[1];
+//    EXPECT_EQ(metricId2, metricProducer2->getMetricId());
+//    EXPECT_FALSE(metricProducer2->isActive());
+//
+//    auto& metricProducer3 = metricsManager1->mAllMetricProducers[2];
+//    EXPECT_EQ(metricId3, metricProducer3->getMetricId());
+//    EXPECT_TRUE(metricProducer3->isActive());
+//
+//    // Check event activations.
+//    EXPECT_EQ(metricsManager1->mAllAtomMatchers.size(), 4);
+//    EXPECT_EQ(metricsManager1->mAllAtomMatchers[0]->getId(),
+//              metric1ActivationTrigger1->atom_matcher_id());
+//    const auto& activation1 = metricProducer1->mEventActivationMap.at(0);
+//    EXPECT_EQ(100 * NS_PER_SEC, activation1->ttl_ns);
+//    EXPECT_EQ(0, activation1->start_ns);
+//    EXPECT_EQ(kNotActive, activation1->state);
+//    EXPECT_EQ(ACTIVATE_ON_BOOT, activation1->activationType);
+//
+//    EXPECT_EQ(metricsManager1->mAllAtomMatchers[1]->getId(),
+//              metric1ActivationTrigger2->atom_matcher_id());
+//    const auto& activation2 = metricProducer1->mEventActivationMap.at(1);
+//    EXPECT_EQ(200 * NS_PER_SEC, activation2->ttl_ns);
+//    EXPECT_EQ(0, activation2->start_ns);
+//    EXPECT_EQ(kNotActive, activation2->state);
+//    EXPECT_EQ(ACTIVATE_IMMEDIATELY, activation2->activationType);
+//
+//    EXPECT_EQ(metricsManager1->mAllAtomMatchers[2]->getId(),
+//              metric2ActivationTrigger1->atom_matcher_id());
+//    const auto& activation3 = metricProducer2->mEventActivationMap.at(2);
+//    EXPECT_EQ(100 * NS_PER_SEC, activation3->ttl_ns);
+//    EXPECT_EQ(0, activation3->start_ns);
+//    EXPECT_EQ(kNotActive, activation3->state);
+//    EXPECT_EQ(ACTIVATE_ON_BOOT, activation3->activationType);
+//
+//    EXPECT_EQ(metricsManager1->mAllAtomMatchers[3]->getId(),
+//              metric2ActivationTrigger2->atom_matcher_id());
+//    const auto& activation4 = metricProducer2->mEventActivationMap.at(3);
+//    EXPECT_EQ(200 * NS_PER_SEC, activation4->ttl_ns);
+//    EXPECT_EQ(0, activation4->start_ns);
+//    EXPECT_EQ(kNotActive, activation4->state);
+//    EXPECT_EQ(ACTIVATE_IMMEDIATELY, activation4->activationType);
+//    // }}}------------------------------------------------------------------------------
+//
+//    // Trigger Activation 1 for Metric 1. Should activate on boot.
+//    // Trigger Activation 4 for Metric 2. Should activate immediately.
+//    long configAddedTimeNs = metricsManager1->mLastReportTimeNs;
+//    std::vector<AttributionNodeInternal> attributions1 = {CreateAttribution(111, "App1")};
+//    auto event = CreateAcquireWakelockEvent(attributions1, "wl1", 1 + configAddedTimeNs);
+//    processor->OnLogEvent(event.get());
+//
+//    event = CreateFinishScheduledJobEvent(attributions1, "finish1", 2 + configAddedTimeNs);
+//    processor->OnLogEvent(event.get());
+//
+//    // Metric 1 is not active; Activation 1 set to kActiveOnBoot
+//    // Metric 2 is active. Activation 4 set to kActive
+//    // Metric 3 is active.
+//    // {{{---------------------------------------------------------------------------
+//    EXPECT_FALSE(metricProducer1->isActive());
+//    EXPECT_EQ(0, activation1->start_ns);
+//    EXPECT_EQ(kActiveOnBoot, activation1->state);
+//    EXPECT_EQ(0, activation2->start_ns);
+//    EXPECT_EQ(kNotActive, activation2->state);
+//
+//    EXPECT_TRUE(metricProducer2->isActive());
+//    EXPECT_EQ(0, activation3->start_ns);
+//    EXPECT_EQ(kNotActive, activation3->state);
+//    EXPECT_EQ(2 + configAddedTimeNs, activation4->start_ns);
+//    EXPECT_EQ(kActive, activation4->state);
+//
+//    EXPECT_TRUE(metricProducer3->isActive());
+//    // }}}-----------------------------------------------------------------------------
+//
+//    // Can't fake time with StatsService.
+//    // Lets get a time close to the system server death time and make sure it's sane.
+//    int64_t approximateSystemServerDeath = getElapsedRealtimeNs();
+//    EXPECT_TRUE(approximateSystemServerDeath > 2 + configAddedTimeNs);
+//    EXPECT_TRUE(approximateSystemServerDeath < NS_PER_SEC + configAddedTimeNs);
+//
+//    // System server dies.
+//    service->statsCompanionServiceDiedImpl();
+//
+//    // We should have a new metrics manager. Lets get it and ensure activation status is restored.
+//    // {{{---------------------------------------------------------------------------
+//    EXPECT_EQ(1, processor->mMetricsManagers.size());
+//    it = processor->mMetricsManagers.find(cfgKey1);
+//    EXPECT_TRUE(it != processor->mMetricsManagers.end());
+//    auto& metricsManager2 = it->second;
+//    EXPECT_TRUE(metricsManager2->isActive());
+//    EXPECT_EQ(3, metricsManager2->mAllMetricProducers.size());
+//
+//    auto& metricProducer1001 = metricsManager2->mAllMetricProducers[0];
+//    EXPECT_EQ(metricId1, metricProducer1001->getMetricId());
+//    EXPECT_FALSE(metricProducer1001->isActive());
+//
+//    auto& metricProducer1002 = metricsManager2->mAllMetricProducers[1];
+//    EXPECT_EQ(metricId2, metricProducer1002->getMetricId());
+//    EXPECT_TRUE(metricProducer1002->isActive());
+//
+//    auto& metricProducer1003 = metricsManager2->mAllMetricProducers[2];
+//    EXPECT_EQ(metricId3, metricProducer1003->getMetricId());
+//    EXPECT_TRUE(metricProducer1003->isActive());
+//
+//    // Check event activations.
+//    // Activation 1 is kActiveOnBoot.
+//    // Activation 2 and 3 are not active.
+//    // Activation 4 is active.
+//    EXPECT_EQ(metricsManager2->mAllAtomMatchers.size(), 4);
+//    EXPECT_EQ(metricsManager2->mAllAtomMatchers[0]->getId(),
+//              metric1ActivationTrigger1->atom_matcher_id());
+//    const auto& activation1001 = metricProducer1001->mEventActivationMap.at(0);
+//    EXPECT_EQ(100 * NS_PER_SEC, activation1001->ttl_ns);
+//    EXPECT_EQ(0, activation1001->start_ns);
+//    EXPECT_EQ(kActiveOnBoot, activation1001->state);
+//    EXPECT_EQ(ACTIVATE_ON_BOOT, activation1001->activationType);
+//
+//    EXPECT_EQ(metricsManager2->mAllAtomMatchers[1]->getId(),
+//              metric1ActivationTrigger2->atom_matcher_id());
+//    const auto& activation1002 = metricProducer1001->mEventActivationMap.at(1);
+//    EXPECT_EQ(200 * NS_PER_SEC, activation1002->ttl_ns);
+//    EXPECT_EQ(0, activation1002->start_ns);
+//    EXPECT_EQ(kNotActive, activation1002->state);
+//    EXPECT_EQ(ACTIVATE_IMMEDIATELY, activation1002->activationType);
+//
+//    EXPECT_EQ(metricsManager2->mAllAtomMatchers[2]->getId(),
+//              metric2ActivationTrigger1->atom_matcher_id());
+//    const auto& activation1003 = metricProducer1002->mEventActivationMap.at(2);
+//    EXPECT_EQ(100 * NS_PER_SEC, activation1003->ttl_ns);
+//    EXPECT_EQ(0, activation1003->start_ns);
+//    EXPECT_EQ(kNotActive, activation1003->state);
+//    EXPECT_EQ(ACTIVATE_ON_BOOT, activation1003->activationType);
+//
+//    EXPECT_EQ(metricsManager2->mAllAtomMatchers[3]->getId(),
+//              metric2ActivationTrigger2->atom_matcher_id());
+//    const auto& activation1004 = metricProducer1002->mEventActivationMap.at(3);
+//    EXPECT_EQ(200 * NS_PER_SEC, activation1004->ttl_ns);
+//    EXPECT_EQ(2 + configAddedTimeNs, activation1004->start_ns);
+//    EXPECT_EQ(kActive, activation1004->state);
+//    EXPECT_EQ(ACTIVATE_IMMEDIATELY, activation1004->activationType);
+//    // }}}------------------------------------------------------------------------------
+//
+//    // Clear the data stored on disk as a result of the system server death.
+//    vector<uint8_t> buffer;
+//    processor->onDumpReport(cfgKey1, configAddedTimeNs + NS_PER_SEC, false, true,
+//                                ADB_DUMP, FAST, &buffer);
+//}
 
 #else
 GTEST_LOG_(INFO) << "This test does nothing.\n";
diff --git a/cmds/statsd/tests/UidMap_test.cpp b/cmds/statsd/tests/UidMap_test.cpp
index d9fa4e9..af6de06 100644
--- a/cmds/statsd/tests/UidMap_test.cpp
+++ b/cmds/statsd/tests/UidMap_test.cpp
@@ -39,34 +39,35 @@
 const string kApp1 = "app1.sharing.1";
 const string kApp2 = "app2.sharing.1";
 
-TEST(UidMapTest, TestIsolatedUID) {
-    sp<UidMap> m = new UidMap();
-    sp<StatsPullerManager> pullerManager = new StatsPullerManager();
-    sp<AlarmMonitor> anomalyAlarmMonitor;
-    sp<AlarmMonitor> subscriberAlarmMonitor;
-    // Construct the processor with a dummy sendBroadcast function that does nothing.
-    StatsLogProcessor p(m, pullerManager, anomalyAlarmMonitor, subscriberAlarmMonitor, 0,
-                        [](const ConfigKey& key) { return true; },
-                        [](const int&, const vector<int64_t>&) {return true;});
-    LogEvent addEvent(android::util::ISOLATED_UID_CHANGED, 1);
-    addEvent.write(100);  // parent UID
-    addEvent.write(101);  // isolated UID
-    addEvent.write(1);    // Indicates creation.
-    addEvent.init();
-
-    EXPECT_EQ(101, m->getHostUidOrSelf(101));
-
-    p.OnLogEvent(&addEvent);
-    EXPECT_EQ(100, m->getHostUidOrSelf(101));
-
-    LogEvent removeEvent(android::util::ISOLATED_UID_CHANGED, 1);
-    removeEvent.write(100);  // parent UID
-    removeEvent.write(101);  // isolated UID
-    removeEvent.write(0);    // Indicates removal.
-    removeEvent.init();
-    p.OnLogEvent(&removeEvent);
-    EXPECT_EQ(101, m->getHostUidOrSelf(101));
-}
+// TODO(b/149590301): Update this test to use new socket schema.
+//TEST(UidMapTest, TestIsolatedUID) {
+//    sp<UidMap> m = new UidMap();
+//    sp<StatsPullerManager> pullerManager = new StatsPullerManager();
+//    sp<AlarmMonitor> anomalyAlarmMonitor;
+//    sp<AlarmMonitor> subscriberAlarmMonitor;
+//    // Construct the processor with a dummy sendBroadcast function that does nothing.
+//    StatsLogProcessor p(m, pullerManager, anomalyAlarmMonitor, subscriberAlarmMonitor, 0,
+//                        [](const ConfigKey& key) { return true; },
+//                        [](const int&, const vector<int64_t>&) {return true;});
+//    LogEvent addEvent(android::util::ISOLATED_UID_CHANGED, 1);
+//    addEvent.write(100);  // parent UID
+//    addEvent.write(101);  // isolated UID
+//    addEvent.write(1);    // Indicates creation.
+//    addEvent.init();
+//
+//    EXPECT_EQ(101, m->getHostUidOrSelf(101));
+//
+//    p.OnLogEvent(&addEvent);
+//    EXPECT_EQ(100, m->getHostUidOrSelf(101));
+//
+//    LogEvent removeEvent(android::util::ISOLATED_UID_CHANGED, 1);
+//    removeEvent.write(100);  // parent UID
+//    removeEvent.write(101);  // isolated UID
+//    removeEvent.write(0);    // Indicates removal.
+//    removeEvent.init();
+//    p.OnLogEvent(&removeEvent);
+//    EXPECT_EQ(101, m->getHostUidOrSelf(101));
+//}
 
 TEST(UidMapTest, TestMatching) {
     UidMap m;
diff --git a/cmds/statsd/tests/condition/SimpleConditionTracker_test.cpp b/cmds/statsd/tests/condition/SimpleConditionTracker_test.cpp
index 6eaa231..36094b2 100644
--- a/cmds/statsd/tests/condition/SimpleConditionTracker_test.cpp
+++ b/cmds/statsd/tests/condition/SimpleConditionTracker_test.cpp
@@ -67,13 +67,14 @@
     event->write(nodes);  // attribution chain.
 }
 
-void makeWakeLockEvent(
-        LogEvent* event, const std::vector<int> &uids, const string& wl, int acquire) {
-    writeAttributionNodesToEvent(event, uids);
-    event->write(wl);
-    event->write(acquire);
-    event->init();
-}
+// TODO(b/149590301): Update this helper to use new socket schema.
+//void makeWakeLockEvent(
+//        LogEvent* event, const std::vector<int> &uids, const string& wl, int acquire) {
+//    writeAttributionNodesToEvent(event, uids);
+//    event->write(wl);
+//    event->write(acquire);
+//    event->init();
+//}
 
 std::map<int64_t, HashableDimensionKey> getWakeLockQueryKey(
     const Position position,
@@ -264,377 +265,378 @@
     EXPECT_TRUE(changedCache[0]);
 }
 
-TEST(SimpleConditionTrackerTest, TestSlicedCondition) {
-    std::vector<sp<ConditionTracker>> allConditions;
-    for (Position position :
-            { Position::FIRST, Position::LAST}) {
-
-        SimplePredicate simplePredicate = getWakeLockHeldCondition(
-                true /*nesting*/, true /*default to false*/, true /*output slice by uid*/,
-                position);
-        string conditionName = "WL_HELD_BY_UID2";
-
-        unordered_map<int64_t, int> trackerNameIndexMap;
-        trackerNameIndexMap[StringToId("WAKE_LOCK_ACQUIRE")] = 0;
-        trackerNameIndexMap[StringToId("WAKE_LOCK_RELEASE")] = 1;
-        trackerNameIndexMap[StringToId("RELEASE_ALL")] = 2;
-
-        SimpleConditionTracker conditionTracker(kConfigKey, StringToId(conditionName),
-                                                0 /*condition tracker index*/, simplePredicate,
-                                                trackerNameIndexMap);
-
-        std::vector<int> uids = {111, 222, 333};
-
-        LogEvent event(1 /*tagId*/, 0 /*timestamp*/);
-        makeWakeLockEvent(&event, uids, "wl1", 1);
-
-        // one matched start
-        vector<MatchingState> matcherState;
-        matcherState.push_back(MatchingState::kMatched);
-        matcherState.push_back(MatchingState::kNotMatched);
-        matcherState.push_back(MatchingState::kNotMatched);
-        vector<sp<ConditionTracker>> allPredicates;
-        vector<ConditionState> conditionCache(1, ConditionState::kNotEvaluated);
-        vector<bool> changedCache(1, false);
-
-        conditionTracker.evaluateCondition(event, matcherState, allPredicates, conditionCache,
-                                           changedCache);
-
-        if (position == Position::FIRST ||
-            position == Position::LAST) {
-            EXPECT_EQ(1UL, conditionTracker.mSlicedConditionState.size());
-        } else {
-            EXPECT_EQ(uids.size(), conditionTracker.mSlicedConditionState.size());
-        }
-        EXPECT_TRUE(changedCache[0]);
-        if (position == Position::FIRST ||
-            position == Position::LAST) {
-            EXPECT_EQ(conditionTracker.getChangedToTrueDimensions(allConditions)->size(), 1u);
-            EXPECT_TRUE(conditionTracker.getChangedToFalseDimensions(allConditions)->empty());
-        } else {
-            EXPECT_EQ(conditionTracker.getChangedToTrueDimensions(allConditions)->size(), uids.size());
-        }
-
-        // Now test query
-        const auto queryKey = getWakeLockQueryKey(position, uids, conditionName);
-        conditionCache[0] = ConditionState::kNotEvaluated;
-
-        conditionTracker.isConditionMet(queryKey, allPredicates,
-                                        false,
-                                        conditionCache);
-        EXPECT_EQ(ConditionState::kTrue, conditionCache[0]);
-
-        // another wake lock acquired by this uid
-        LogEvent event2(1 /*tagId*/, 0 /*timestamp*/);
-        makeWakeLockEvent(&event2, uids, "wl2", 1);
-        matcherState.clear();
-        matcherState.push_back(MatchingState::kMatched);
-        matcherState.push_back(MatchingState::kNotMatched);
-        conditionCache[0] = ConditionState::kNotEvaluated;
-        changedCache[0] = false;
-        conditionTracker.evaluateCondition(event2, matcherState, allPredicates, conditionCache,
-                                           changedCache);
-        EXPECT_FALSE(changedCache[0]);
-        if (position == Position::FIRST ||
-            position == Position::LAST) {
-            EXPECT_EQ(1UL, conditionTracker.mSlicedConditionState.size());
-        } else {
-            EXPECT_EQ(uids.size(), conditionTracker.mSlicedConditionState.size());
-        }
-        EXPECT_TRUE(conditionTracker.getChangedToTrueDimensions(allConditions)->empty());
-        EXPECT_TRUE(conditionTracker.getChangedToFalseDimensions(allConditions)->empty());
-
-
-        // wake lock 1 release
-        LogEvent event3(1 /*tagId*/, 0 /*timestamp*/);
-        makeWakeLockEvent(&event3, uids, "wl1", 0);  // now release it.
-        matcherState.clear();
-        matcherState.push_back(MatchingState::kNotMatched);
-        matcherState.push_back(MatchingState::kMatched);
-        conditionCache[0] = ConditionState::kNotEvaluated;
-        changedCache[0] = false;
-        conditionTracker.evaluateCondition(event3, matcherState, allPredicates, conditionCache,
-                                           changedCache);
-        // nothing changes, because wake lock 2 is still held for this uid
-        EXPECT_FALSE(changedCache[0]);
-        if (position == Position::FIRST ||
-            position == Position::LAST) {
-            EXPECT_EQ(1UL, conditionTracker.mSlicedConditionState.size());
-        } else {
-            EXPECT_EQ(uids.size(), conditionTracker.mSlicedConditionState.size());
-        }
-        EXPECT_TRUE(conditionTracker.getChangedToTrueDimensions(allConditions)->empty());
-        EXPECT_TRUE(conditionTracker.getChangedToFalseDimensions(allConditions)->empty());
-
-        LogEvent event4(1 /*tagId*/, 0 /*timestamp*/);
-        makeWakeLockEvent(&event4, uids, "wl2", 0);  // now release it.
-        matcherState.clear();
-        matcherState.push_back(MatchingState::kNotMatched);
-        matcherState.push_back(MatchingState::kMatched);
-        conditionCache[0] = ConditionState::kNotEvaluated;
-        changedCache[0] = false;
-        conditionTracker.evaluateCondition(event4, matcherState, allPredicates, conditionCache,
-                                           changedCache);
-        EXPECT_EQ(0UL, conditionTracker.mSlicedConditionState.size());
-        EXPECT_TRUE(changedCache[0]);
-        if (position == Position::FIRST ||
-            position == Position::LAST) {
-            EXPECT_EQ(conditionTracker.getChangedToFalseDimensions(allConditions)->size(), 1u);
-            EXPECT_TRUE(conditionTracker.getChangedToTrueDimensions(allConditions)->empty());
-        } else {
-            EXPECT_EQ(conditionTracker.getChangedToFalseDimensions(allConditions)->size(), uids.size());
-        }
-
-        // query again
-        conditionCache[0] = ConditionState::kNotEvaluated;
-        conditionTracker.isConditionMet(queryKey, allPredicates,
-                                        false,
-                                        conditionCache);
-        EXPECT_EQ(ConditionState::kFalse, conditionCache[0]);
-    }
-
-}
-
-TEST(SimpleConditionTrackerTest, TestSlicedWithNoOutputDim) {
-    std::vector<sp<ConditionTracker>> allConditions;
-
-    SimplePredicate simplePredicate = getWakeLockHeldCondition(
-            true /*nesting*/, true /*default to false*/, false /*slice output by uid*/,
-            Position::ANY /* position */);
-    string conditionName = "WL_HELD";
-
-    unordered_map<int64_t, int> trackerNameIndexMap;
-    trackerNameIndexMap[StringToId("WAKE_LOCK_ACQUIRE")] = 0;
-    trackerNameIndexMap[StringToId("WAKE_LOCK_RELEASE")] = 1;
-    trackerNameIndexMap[StringToId("RELEASE_ALL")] = 2;
-
-    SimpleConditionTracker conditionTracker(kConfigKey, StringToId(conditionName),
-                                            0 /*condition tracker index*/, simplePredicate,
-                                            trackerNameIndexMap);
-
-    EXPECT_FALSE(conditionTracker.isSliced());
-
-    std::vector<int> uid_list1 = {111, 1111, 11111};
-    string uid1_wl1 = "wl1_1";
-    std::vector<int> uid_list2 = {222, 2222, 22222};
-    string uid2_wl1 = "wl2_1";
-
-    LogEvent event(1 /*tagId*/, 0 /*timestamp*/);
-    makeWakeLockEvent(&event, uid_list1, uid1_wl1, 1);
-
-    // one matched start for uid1
-    vector<MatchingState> matcherState;
-    matcherState.push_back(MatchingState::kMatched);
-    matcherState.push_back(MatchingState::kNotMatched);
-    matcherState.push_back(MatchingState::kNotMatched);
-    vector<sp<ConditionTracker>> allPredicates;
-    vector<ConditionState> conditionCache(1, ConditionState::kNotEvaluated);
-    vector<bool> changedCache(1, false);
-
-    conditionTracker.evaluateCondition(event, matcherState, allPredicates, conditionCache,
-                                       changedCache);
-
-    EXPECT_EQ(1UL, conditionTracker.mSlicedConditionState.size());
-    EXPECT_TRUE(changedCache[0]);
-
-    // Now test query
-    ConditionKey queryKey;
-    conditionCache[0] = ConditionState::kNotEvaluated;
-
-    conditionTracker.isConditionMet(queryKey, allPredicates,
-                                    true,
-                                    conditionCache);
-    EXPECT_EQ(ConditionState::kTrue, conditionCache[0]);
-
-    // another wake lock acquired by this uid
-    LogEvent event2(1 /*tagId*/, 0 /*timestamp*/);
-    makeWakeLockEvent(&event2, uid_list2, uid2_wl1, 1);
-    matcherState.clear();
-    matcherState.push_back(MatchingState::kMatched);
-    matcherState.push_back(MatchingState::kNotMatched);
-    conditionCache[0] = ConditionState::kNotEvaluated;
-    changedCache[0] = false;
-    conditionTracker.evaluateCondition(event2, matcherState, allPredicates, conditionCache,
-                                       changedCache);
-    EXPECT_FALSE(changedCache[0]);
-
-    // uid1 wake lock 1 release
-    LogEvent event3(1 /*tagId*/, 0 /*timestamp*/);
-    makeWakeLockEvent(&event3, uid_list1, uid1_wl1, 0);  // now release it.
-    matcherState.clear();
-    matcherState.push_back(MatchingState::kNotMatched);
-    matcherState.push_back(MatchingState::kMatched);
-    conditionCache[0] = ConditionState::kNotEvaluated;
-    changedCache[0] = false;
-    conditionTracker.evaluateCondition(event3, matcherState, allPredicates, conditionCache,
-                                       changedCache);
-    // nothing changes, because uid2 is still holding wl.
-    EXPECT_FALSE(changedCache[0]);
-
-    LogEvent event4(1 /*tagId*/, 0 /*timestamp*/);
-    makeWakeLockEvent(&event4, uid_list2, uid2_wl1, 0);  // now release it.
-    matcherState.clear();
-    matcherState.push_back(MatchingState::kNotMatched);
-    matcherState.push_back(MatchingState::kMatched);
-    conditionCache[0] = ConditionState::kNotEvaluated;
-    changedCache[0] = false;
-    conditionTracker.evaluateCondition(event4, matcherState, allPredicates, conditionCache,
-                                       changedCache);
-    EXPECT_EQ(0UL, conditionTracker.mSlicedConditionState.size());
-    EXPECT_TRUE(changedCache[0]);
-
-    // query again
-    conditionCache[0] = ConditionState::kNotEvaluated;
-    conditionTracker.isConditionMet(queryKey, allPredicates,
-                                    true,
-                                    conditionCache);
-    EXPECT_EQ(ConditionState::kFalse, conditionCache[0]);
-}
-
-TEST(SimpleConditionTrackerTest, TestStopAll) {
-    std::vector<sp<ConditionTracker>> allConditions;
-    for (Position position :
-            { Position::FIRST, Position::LAST }) {
-        SimplePredicate simplePredicate = getWakeLockHeldCondition(
-                true /*nesting*/, true /*default to false*/, true /*output slice by uid*/,
-                position);
-        string conditionName = "WL_HELD_BY_UID3";
-
-        unordered_map<int64_t, int> trackerNameIndexMap;
-        trackerNameIndexMap[StringToId("WAKE_LOCK_ACQUIRE")] = 0;
-        trackerNameIndexMap[StringToId("WAKE_LOCK_RELEASE")] = 1;
-        trackerNameIndexMap[StringToId("RELEASE_ALL")] = 2;
-
-        SimpleConditionTracker conditionTracker(kConfigKey, StringToId(conditionName),
-                                                0 /*condition tracker index*/, simplePredicate,
-                                                trackerNameIndexMap);
-
-        std::vector<int> uid_list1 = {111, 1111, 11111};
-        std::vector<int> uid_list2 = {222, 2222, 22222};
-
-        LogEvent event(1 /*tagId*/, 0 /*timestamp*/);
-        makeWakeLockEvent(&event, uid_list1, "wl1", 1);
-
-        // one matched start
-        vector<MatchingState> matcherState;
-        matcherState.push_back(MatchingState::kMatched);
-        matcherState.push_back(MatchingState::kNotMatched);
-        matcherState.push_back(MatchingState::kNotMatched);
-        vector<sp<ConditionTracker>> allPredicates;
-        vector<ConditionState> conditionCache(1, ConditionState::kNotEvaluated);
-        vector<bool> changedCache(1, false);
-
-        conditionTracker.evaluateCondition(event, matcherState, allPredicates, conditionCache,
-                                           changedCache);
-        if (position == Position::FIRST ||
-            position == Position::LAST) {
-            EXPECT_EQ(1UL, conditionTracker.mSlicedConditionState.size());
-        } else {
-            EXPECT_EQ(uid_list1.size(), conditionTracker.mSlicedConditionState.size());
-        }
-        EXPECT_TRUE(changedCache[0]);
-        {
-            if (position == Position::FIRST ||
-                position == Position::LAST) {
-                EXPECT_EQ(1UL, conditionTracker.getChangedToTrueDimensions(allConditions)->size());
-                EXPECT_TRUE(conditionTracker.getChangedToFalseDimensions(allConditions)->empty());
-            } else {
-                EXPECT_EQ(uid_list1.size(), conditionTracker.getChangedToTrueDimensions(allConditions)->size());
-                EXPECT_TRUE(conditionTracker.getChangedToFalseDimensions(allConditions)->empty());
-            }
-        }
-
-        // Now test query
-        const auto queryKey = getWakeLockQueryKey(position, uid_list1, conditionName);
-        conditionCache[0] = ConditionState::kNotEvaluated;
-
-        conditionTracker.isConditionMet(queryKey, allPredicates,
-                                        false,
-                                        conditionCache);
-        EXPECT_EQ(ConditionState::kTrue, conditionCache[0]);
-
-        // another wake lock acquired by uid2
-        LogEvent event2(1 /*tagId*/, 0 /*timestamp*/);
-        makeWakeLockEvent(&event2, uid_list2, "wl2", 1);
-        matcherState.clear();
-        matcherState.push_back(MatchingState::kMatched);
-        matcherState.push_back(MatchingState::kNotMatched);
-        matcherState.push_back(MatchingState::kNotMatched);
-        conditionCache[0] = ConditionState::kNotEvaluated;
-        changedCache[0] = false;
-        conditionTracker.evaluateCondition(event2, matcherState, allPredicates, conditionCache,
-                                           changedCache);
-        if (position == Position::FIRST ||
-            position == Position::LAST) {
-            EXPECT_EQ(2UL, conditionTracker.mSlicedConditionState.size());
-        } else {
-            EXPECT_EQ(uid_list1.size() + uid_list2.size(),
-                      conditionTracker.mSlicedConditionState.size());
-        }
-        EXPECT_TRUE(changedCache[0]);
-        {
-            if (position == Position::FIRST ||
-                position == Position::LAST) {
-                EXPECT_EQ(1UL, conditionTracker.getChangedToTrueDimensions(allConditions)->size());
-                EXPECT_TRUE(conditionTracker.getChangedToFalseDimensions(allConditions)->empty());
-            } else {
-                EXPECT_EQ(uid_list2.size(), conditionTracker.getChangedToTrueDimensions(allConditions)->size());
-                EXPECT_TRUE(conditionTracker.getChangedToFalseDimensions(allConditions)->empty());
-            }
-        }
-
-
-        // TEST QUERY
-        const auto queryKey2 = getWakeLockQueryKey(position, uid_list2, conditionName);
-        conditionCache[0] = ConditionState::kNotEvaluated;
-        conditionTracker.isConditionMet(queryKey, allPredicates,
-                                        false,
-                                        conditionCache);
-
-        EXPECT_EQ(ConditionState::kTrue, conditionCache[0]);
-
-
-        // stop all event
-        LogEvent event3(2 /*tagId*/, 0 /*timestamp*/);
-        matcherState.clear();
-        matcherState.push_back(MatchingState::kNotMatched);
-        matcherState.push_back(MatchingState::kNotMatched);
-        matcherState.push_back(MatchingState::kMatched);
-
-        conditionCache[0] = ConditionState::kNotEvaluated;
-        changedCache[0] = false;
-        conditionTracker.evaluateCondition(event3, matcherState, allPredicates, conditionCache,
-                                           changedCache);
-        EXPECT_TRUE(changedCache[0]);
-        EXPECT_EQ(0UL, conditionTracker.mSlicedConditionState.size());
-        {
-            if (position == Position::FIRST || position == Position::LAST) {
-                EXPECT_EQ(2UL, conditionTracker.getChangedToFalseDimensions(allConditions)->size());
-                EXPECT_TRUE(conditionTracker.getChangedToTrueDimensions(allConditions)->empty());
-            } else {
-                EXPECT_EQ(uid_list1.size() + uid_list2.size(),
-                          conditionTracker.getChangedToFalseDimensions(allConditions)->size());
-                EXPECT_TRUE(conditionTracker.getChangedToTrueDimensions(allConditions)->empty());
-            }
-        }
-
-        // TEST QUERY
-        const auto queryKey3 = getWakeLockQueryKey(position, uid_list1, conditionName);
-        conditionCache[0] = ConditionState::kNotEvaluated;
-        conditionTracker.isConditionMet(queryKey, allPredicates,
-                                        false,
-                                        conditionCache);
-        EXPECT_EQ(ConditionState::kFalse, conditionCache[0]);
-
-        // TEST QUERY
-        const auto queryKey4 = getWakeLockQueryKey(position, uid_list2, conditionName);
-        conditionCache[0] = ConditionState::kNotEvaluated;
-        conditionTracker.isConditionMet(queryKey, allPredicates,
-                                        false,
-                                        conditionCache);
-        EXPECT_EQ(ConditionState::kFalse, conditionCache[0]);
-    }
-}
+// TODO(b/149590301): Update these tests to use new socket schema.
+//TEST(SimpleConditionTrackerTest, TestSlicedCondition) {
+//    std::vector<sp<ConditionTracker>> allConditions;
+//    for (Position position :
+//            { Position::FIRST, Position::LAST}) {
+//
+//        SimplePredicate simplePredicate = getWakeLockHeldCondition(
+//                true /*nesting*/, true /*default to false*/, true /*output slice by uid*/,
+//                position);
+//        string conditionName = "WL_HELD_BY_UID2";
+//
+//        unordered_map<int64_t, int> trackerNameIndexMap;
+//        trackerNameIndexMap[StringToId("WAKE_LOCK_ACQUIRE")] = 0;
+//        trackerNameIndexMap[StringToId("WAKE_LOCK_RELEASE")] = 1;
+//        trackerNameIndexMap[StringToId("RELEASE_ALL")] = 2;
+//
+//        SimpleConditionTracker conditionTracker(kConfigKey, StringToId(conditionName),
+//                                                0 /*condition tracker index*/, simplePredicate,
+//                                                trackerNameIndexMap);
+//
+//        std::vector<int> uids = {111, 222, 333};
+//
+//        LogEvent event(1 /*tagId*/, 0 /*timestamp*/);
+//        makeWakeLockEvent(&event, uids, "wl1", 1);
+//
+//        // one matched start
+//        vector<MatchingState> matcherState;
+//        matcherState.push_back(MatchingState::kMatched);
+//        matcherState.push_back(MatchingState::kNotMatched);
+//        matcherState.push_back(MatchingState::kNotMatched);
+//        vector<sp<ConditionTracker>> allPredicates;
+//        vector<ConditionState> conditionCache(1, ConditionState::kNotEvaluated);
+//        vector<bool> changedCache(1, false);
+//
+//        conditionTracker.evaluateCondition(event, matcherState, allPredicates, conditionCache,
+//                                           changedCache);
+//
+//        if (position == Position::FIRST ||
+//            position == Position::LAST) {
+//            EXPECT_EQ(1UL, conditionTracker.mSlicedConditionState.size());
+//        } else {
+//            EXPECT_EQ(uids.size(), conditionTracker.mSlicedConditionState.size());
+//        }
+//        EXPECT_TRUE(changedCache[0]);
+//        if (position == Position::FIRST ||
+//            position == Position::LAST) {
+//            EXPECT_EQ(conditionTracker.getChangedToTrueDimensions(allConditions)->size(), 1u);
+//            EXPECT_TRUE(conditionTracker.getChangedToFalseDimensions(allConditions)->empty());
+//        } else {
+//            EXPECT_EQ(conditionTracker.getChangedToTrueDimensions(allConditions)->size(), uids.size());
+//        }
+//
+//        // Now test query
+//        const auto queryKey = getWakeLockQueryKey(position, uids, conditionName);
+//        conditionCache[0] = ConditionState::kNotEvaluated;
+//
+//        conditionTracker.isConditionMet(queryKey, allPredicates,
+//                                        false,
+//                                        conditionCache);
+//        EXPECT_EQ(ConditionState::kTrue, conditionCache[0]);
+//
+//        // another wake lock acquired by this uid
+//        LogEvent event2(1 /*tagId*/, 0 /*timestamp*/);
+//        makeWakeLockEvent(&event2, uids, "wl2", 1);
+//        matcherState.clear();
+//        matcherState.push_back(MatchingState::kMatched);
+//        matcherState.push_back(MatchingState::kNotMatched);
+//        conditionCache[0] = ConditionState::kNotEvaluated;
+//        changedCache[0] = false;
+//        conditionTracker.evaluateCondition(event2, matcherState, allPredicates, conditionCache,
+//                                           changedCache);
+//        EXPECT_FALSE(changedCache[0]);
+//        if (position == Position::FIRST ||
+//            position == Position::LAST) {
+//            EXPECT_EQ(1UL, conditionTracker.mSlicedConditionState.size());
+//        } else {
+//            EXPECT_EQ(uids.size(), conditionTracker.mSlicedConditionState.size());
+//        }
+//        EXPECT_TRUE(conditionTracker.getChangedToTrueDimensions(allConditions)->empty());
+//        EXPECT_TRUE(conditionTracker.getChangedToFalseDimensions(allConditions)->empty());
+//
+//
+//        // wake lock 1 release
+//        LogEvent event3(1 /*tagId*/, 0 /*timestamp*/);
+//        makeWakeLockEvent(&event3, uids, "wl1", 0);  // now release it.
+//        matcherState.clear();
+//        matcherState.push_back(MatchingState::kNotMatched);
+//        matcherState.push_back(MatchingState::kMatched);
+//        conditionCache[0] = ConditionState::kNotEvaluated;
+//        changedCache[0] = false;
+//        conditionTracker.evaluateCondition(event3, matcherState, allPredicates, conditionCache,
+//                                           changedCache);
+//        // nothing changes, because wake lock 2 is still held for this uid
+//        EXPECT_FALSE(changedCache[0]);
+//        if (position == Position::FIRST ||
+//            position == Position::LAST) {
+//            EXPECT_EQ(1UL, conditionTracker.mSlicedConditionState.size());
+//        } else {
+//            EXPECT_EQ(uids.size(), conditionTracker.mSlicedConditionState.size());
+//        }
+//        EXPECT_TRUE(conditionTracker.getChangedToTrueDimensions(allConditions)->empty());
+//        EXPECT_TRUE(conditionTracker.getChangedToFalseDimensions(allConditions)->empty());
+//
+//        LogEvent event4(1 /*tagId*/, 0 /*timestamp*/);
+//        makeWakeLockEvent(&event4, uids, "wl2", 0);  // now release it.
+//        matcherState.clear();
+//        matcherState.push_back(MatchingState::kNotMatched);
+//        matcherState.push_back(MatchingState::kMatched);
+//        conditionCache[0] = ConditionState::kNotEvaluated;
+//        changedCache[0] = false;
+//        conditionTracker.evaluateCondition(event4, matcherState, allPredicates, conditionCache,
+//                                           changedCache);
+//        EXPECT_EQ(0UL, conditionTracker.mSlicedConditionState.size());
+//        EXPECT_TRUE(changedCache[0]);
+//        if (position == Position::FIRST ||
+//            position == Position::LAST) {
+//            EXPECT_EQ(conditionTracker.getChangedToFalseDimensions(allConditions)->size(), 1u);
+//            EXPECT_TRUE(conditionTracker.getChangedToTrueDimensions(allConditions)->empty());
+//        } else {
+//            EXPECT_EQ(conditionTracker.getChangedToFalseDimensions(allConditions)->size(), uids.size());
+//        }
+//
+//        // query again
+//        conditionCache[0] = ConditionState::kNotEvaluated;
+//        conditionTracker.isConditionMet(queryKey, allPredicates,
+//                                        false,
+//                                        conditionCache);
+//        EXPECT_EQ(ConditionState::kFalse, conditionCache[0]);
+//    }
+//
+//}
+//
+//TEST(SimpleConditionTrackerTest, TestSlicedWithNoOutputDim) {
+//    std::vector<sp<ConditionTracker>> allConditions;
+//
+//    SimplePredicate simplePredicate = getWakeLockHeldCondition(
+//            true /*nesting*/, true /*default to false*/, false /*slice output by uid*/,
+//            Position::ANY /* position */);
+//    string conditionName = "WL_HELD";
+//
+//    unordered_map<int64_t, int> trackerNameIndexMap;
+//    trackerNameIndexMap[StringToId("WAKE_LOCK_ACQUIRE")] = 0;
+//    trackerNameIndexMap[StringToId("WAKE_LOCK_RELEASE")] = 1;
+//    trackerNameIndexMap[StringToId("RELEASE_ALL")] = 2;
+//
+//    SimpleConditionTracker conditionTracker(kConfigKey, StringToId(conditionName),
+//                                            0 /*condition tracker index*/, simplePredicate,
+//                                            trackerNameIndexMap);
+//
+//    EXPECT_FALSE(conditionTracker.isSliced());
+//
+//    std::vector<int> uid_list1 = {111, 1111, 11111};
+//    string uid1_wl1 = "wl1_1";
+//    std::vector<int> uid_list2 = {222, 2222, 22222};
+//    string uid2_wl1 = "wl2_1";
+//
+//    LogEvent event(1 /*tagId*/, 0 /*timestamp*/);
+//    makeWakeLockEvent(&event, uid_list1, uid1_wl1, 1);
+//
+//    // one matched start for uid1
+//    vector<MatchingState> matcherState;
+//    matcherState.push_back(MatchingState::kMatched);
+//    matcherState.push_back(MatchingState::kNotMatched);
+//    matcherState.push_back(MatchingState::kNotMatched);
+//    vector<sp<ConditionTracker>> allPredicates;
+//    vector<ConditionState> conditionCache(1, ConditionState::kNotEvaluated);
+//    vector<bool> changedCache(1, false);
+//
+//    conditionTracker.evaluateCondition(event, matcherState, allPredicates, conditionCache,
+//                                       changedCache);
+//
+//    EXPECT_EQ(1UL, conditionTracker.mSlicedConditionState.size());
+//    EXPECT_TRUE(changedCache[0]);
+//
+//    // Now test query
+//    ConditionKey queryKey;
+//    conditionCache[0] = ConditionState::kNotEvaluated;
+//
+//    conditionTracker.isConditionMet(queryKey, allPredicates,
+//                                    true,
+//                                    conditionCache);
+//    EXPECT_EQ(ConditionState::kTrue, conditionCache[0]);
+//
+//    // another wake lock acquired by this uid
+//    LogEvent event2(1 /*tagId*/, 0 /*timestamp*/);
+//    makeWakeLockEvent(&event2, uid_list2, uid2_wl1, 1);
+//    matcherState.clear();
+//    matcherState.push_back(MatchingState::kMatched);
+//    matcherState.push_back(MatchingState::kNotMatched);
+//    conditionCache[0] = ConditionState::kNotEvaluated;
+//    changedCache[0] = false;
+//    conditionTracker.evaluateCondition(event2, matcherState, allPredicates, conditionCache,
+//                                       changedCache);
+//    EXPECT_FALSE(changedCache[0]);
+//
+//    // uid1 wake lock 1 release
+//    LogEvent event3(1 /*tagId*/, 0 /*timestamp*/);
+//    makeWakeLockEvent(&event3, uid_list1, uid1_wl1, 0);  // now release it.
+//    matcherState.clear();
+//    matcherState.push_back(MatchingState::kNotMatched);
+//    matcherState.push_back(MatchingState::kMatched);
+//    conditionCache[0] = ConditionState::kNotEvaluated;
+//    changedCache[0] = false;
+//    conditionTracker.evaluateCondition(event3, matcherState, allPredicates, conditionCache,
+//                                       changedCache);
+//    // nothing changes, because uid2 is still holding wl.
+//    EXPECT_FALSE(changedCache[0]);
+//
+//    LogEvent event4(1 /*tagId*/, 0 /*timestamp*/);
+//    makeWakeLockEvent(&event4, uid_list2, uid2_wl1, 0);  // now release it.
+//    matcherState.clear();
+//    matcherState.push_back(MatchingState::kNotMatched);
+//    matcherState.push_back(MatchingState::kMatched);
+//    conditionCache[0] = ConditionState::kNotEvaluated;
+//    changedCache[0] = false;
+//    conditionTracker.evaluateCondition(event4, matcherState, allPredicates, conditionCache,
+//                                       changedCache);
+//    EXPECT_EQ(0UL, conditionTracker.mSlicedConditionState.size());
+//    EXPECT_TRUE(changedCache[0]);
+//
+//    // query again
+//    conditionCache[0] = ConditionState::kNotEvaluated;
+//    conditionTracker.isConditionMet(queryKey, allPredicates,
+//                                    true,
+//                                    conditionCache);
+//    EXPECT_EQ(ConditionState::kFalse, conditionCache[0]);
+//}
+//
+//TEST(SimpleConditionTrackerTest, TestStopAll) {
+//    std::vector<sp<ConditionTracker>> allConditions;
+//    for (Position position :
+//            { Position::FIRST, Position::LAST }) {
+//        SimplePredicate simplePredicate = getWakeLockHeldCondition(
+//                true /*nesting*/, true /*default to false*/, true /*output slice by uid*/,
+//                position);
+//        string conditionName = "WL_HELD_BY_UID3";
+//
+//        unordered_map<int64_t, int> trackerNameIndexMap;
+//        trackerNameIndexMap[StringToId("WAKE_LOCK_ACQUIRE")] = 0;
+//        trackerNameIndexMap[StringToId("WAKE_LOCK_RELEASE")] = 1;
+//        trackerNameIndexMap[StringToId("RELEASE_ALL")] = 2;
+//
+//        SimpleConditionTracker conditionTracker(kConfigKey, StringToId(conditionName),
+//                                                0 /*condition tracker index*/, simplePredicate,
+//                                                trackerNameIndexMap);
+//
+//        std::vector<int> uid_list1 = {111, 1111, 11111};
+//        std::vector<int> uid_list2 = {222, 2222, 22222};
+//
+//        LogEvent event(1 /*tagId*/, 0 /*timestamp*/);
+//        makeWakeLockEvent(&event, uid_list1, "wl1", 1);
+//
+//        // one matched start
+//        vector<MatchingState> matcherState;
+//        matcherState.push_back(MatchingState::kMatched);
+//        matcherState.push_back(MatchingState::kNotMatched);
+//        matcherState.push_back(MatchingState::kNotMatched);
+//        vector<sp<ConditionTracker>> allPredicates;
+//        vector<ConditionState> conditionCache(1, ConditionState::kNotEvaluated);
+//        vector<bool> changedCache(1, false);
+//
+//        conditionTracker.evaluateCondition(event, matcherState, allPredicates, conditionCache,
+//                                           changedCache);
+//        if (position == Position::FIRST ||
+//            position == Position::LAST) {
+//            EXPECT_EQ(1UL, conditionTracker.mSlicedConditionState.size());
+//        } else {
+//            EXPECT_EQ(uid_list1.size(), conditionTracker.mSlicedConditionState.size());
+//        }
+//        EXPECT_TRUE(changedCache[0]);
+//        {
+//            if (position == Position::FIRST ||
+//                position == Position::LAST) {
+//                EXPECT_EQ(1UL, conditionTracker.getChangedToTrueDimensions(allConditions)->size());
+//                EXPECT_TRUE(conditionTracker.getChangedToFalseDimensions(allConditions)->empty());
+//            } else {
+//                EXPECT_EQ(uid_list1.size(), conditionTracker.getChangedToTrueDimensions(allConditions)->size());
+//                EXPECT_TRUE(conditionTracker.getChangedToFalseDimensions(allConditions)->empty());
+//            }
+//        }
+//
+//        // Now test query
+//        const auto queryKey = getWakeLockQueryKey(position, uid_list1, conditionName);
+//        conditionCache[0] = ConditionState::kNotEvaluated;
+//
+//        conditionTracker.isConditionMet(queryKey, allPredicates,
+//                                        false,
+//                                        conditionCache);
+//        EXPECT_EQ(ConditionState::kTrue, conditionCache[0]);
+//
+//        // another wake lock acquired by uid2
+//        LogEvent event2(1 /*tagId*/, 0 /*timestamp*/);
+//        makeWakeLockEvent(&event2, uid_list2, "wl2", 1);
+//        matcherState.clear();
+//        matcherState.push_back(MatchingState::kMatched);
+//        matcherState.push_back(MatchingState::kNotMatched);
+//        matcherState.push_back(MatchingState::kNotMatched);
+//        conditionCache[0] = ConditionState::kNotEvaluated;
+//        changedCache[0] = false;
+//        conditionTracker.evaluateCondition(event2, matcherState, allPredicates, conditionCache,
+//                                           changedCache);
+//        if (position == Position::FIRST ||
+//            position == Position::LAST) {
+//            EXPECT_EQ(2UL, conditionTracker.mSlicedConditionState.size());
+//        } else {
+//            EXPECT_EQ(uid_list1.size() + uid_list2.size(),
+//                      conditionTracker.mSlicedConditionState.size());
+//        }
+//        EXPECT_TRUE(changedCache[0]);
+//        {
+//            if (position == Position::FIRST ||
+//                position == Position::LAST) {
+//                EXPECT_EQ(1UL, conditionTracker.getChangedToTrueDimensions(allConditions)->size());
+//                EXPECT_TRUE(conditionTracker.getChangedToFalseDimensions(allConditions)->empty());
+//            } else {
+//                EXPECT_EQ(uid_list2.size(), conditionTracker.getChangedToTrueDimensions(allConditions)->size());
+//                EXPECT_TRUE(conditionTracker.getChangedToFalseDimensions(allConditions)->empty());
+//            }
+//        }
+//
+//
+//        // TEST QUERY
+//        const auto queryKey2 = getWakeLockQueryKey(position, uid_list2, conditionName);
+//        conditionCache[0] = ConditionState::kNotEvaluated;
+//        conditionTracker.isConditionMet(queryKey, allPredicates,
+//                                        false,
+//                                        conditionCache);
+//
+//        EXPECT_EQ(ConditionState::kTrue, conditionCache[0]);
+//
+//
+//        // stop all event
+//        LogEvent event3(2 /*tagId*/, 0 /*timestamp*/);
+//        matcherState.clear();
+//        matcherState.push_back(MatchingState::kNotMatched);
+//        matcherState.push_back(MatchingState::kNotMatched);
+//        matcherState.push_back(MatchingState::kMatched);
+//
+//        conditionCache[0] = ConditionState::kNotEvaluated;
+//        changedCache[0] = false;
+//        conditionTracker.evaluateCondition(event3, matcherState, allPredicates, conditionCache,
+//                                           changedCache);
+//        EXPECT_TRUE(changedCache[0]);
+//        EXPECT_EQ(0UL, conditionTracker.mSlicedConditionState.size());
+//        {
+//            if (position == Position::FIRST || position == Position::LAST) {
+//                EXPECT_EQ(2UL, conditionTracker.getChangedToFalseDimensions(allConditions)->size());
+//                EXPECT_TRUE(conditionTracker.getChangedToTrueDimensions(allConditions)->empty());
+//            } else {
+//                EXPECT_EQ(uid_list1.size() + uid_list2.size(),
+//                          conditionTracker.getChangedToFalseDimensions(allConditions)->size());
+//                EXPECT_TRUE(conditionTracker.getChangedToTrueDimensions(allConditions)->empty());
+//            }
+//        }
+//
+//        // TEST QUERY
+//        const auto queryKey3 = getWakeLockQueryKey(position, uid_list1, conditionName);
+//        conditionCache[0] = ConditionState::kNotEvaluated;
+//        conditionTracker.isConditionMet(queryKey, allPredicates,
+//                                        false,
+//                                        conditionCache);
+//        EXPECT_EQ(ConditionState::kFalse, conditionCache[0]);
+//
+//        // TEST QUERY
+//        const auto queryKey4 = getWakeLockQueryKey(position, uid_list2, conditionName);
+//        conditionCache[0] = ConditionState::kNotEvaluated;
+//        conditionTracker.isConditionMet(queryKey, allPredicates,
+//                                        false,
+//                                        conditionCache);
+//        EXPECT_EQ(ConditionState::kFalse, conditionCache[0]);
+//    }
+//}
 
 }  // namespace statsd
 }  // namespace os
diff --git a/cmds/statsd/tests/condition/StateConditionTracker_test.cpp b/cmds/statsd/tests/condition/StateConditionTracker_test.cpp
index fbf6efd..86b50ae8 100644
--- a/cmds/statsd/tests/condition/StateConditionTracker_test.cpp
+++ b/cmds/statsd/tests/condition/StateConditionTracker_test.cpp
@@ -44,65 +44,66 @@
     return simplePredicate;
 }
 
-void makeUidProcStateEvent(int32_t uid, int32_t state, LogEvent* event) {
-    event->write(uid);
-    event->write(state);
-    event->init();
-}
-
-TEST(StateConditionTrackerTest, TestStateChange) {
-    int uid1 = 111;
-    int uid2 = 222;
-
-    int state1 = 1001;
-    int state2 = 1002;
-    unordered_map<int64_t, int> trackerNameIndexMap;
-    trackerNameIndexMap[StringToId("UidProcState")] = 0;
-    vector<Matcher> primaryFields;
-    primaryFields.push_back(getSimpleMatcher(kUidProcTag, 1));
-    StateConditionTracker tracker(ConfigKey(12, 123), 123, 0, getUidProcStatePredicate(),
-                         trackerNameIndexMap, primaryFields);
-
-    LogEvent event(kUidProcTag, 0 /*timestamp*/);
-    makeUidProcStateEvent(uid1, state1, &event);
-
-    vector<MatchingState> matcherState;
-    matcherState.push_back(MatchingState::kMatched);
-    vector<sp<ConditionTracker>> allPredicates;
-    vector<ConditionState> conditionCache(1, ConditionState::kNotEvaluated);
-    vector<bool> changedCache(1, false);
-
-    tracker.evaluateCondition(event, matcherState, allPredicates, conditionCache, changedCache);
-    EXPECT_EQ(1ULL, tracker.mLastChangedToTrueDimensions.size());
-    EXPECT_EQ(0ULL, tracker.mLastChangedToFalseDimensions.size());
-    EXPECT_TRUE(changedCache[0]);
-
-    changedCache[0] = false;
-    conditionCache[0] = ConditionState::kNotEvaluated;
-    tracker.evaluateCondition(event, matcherState, allPredicates, conditionCache, changedCache);
-    EXPECT_EQ(0ULL, tracker.mLastChangedToTrueDimensions.size());
-    EXPECT_EQ(0ULL, tracker.mLastChangedToFalseDimensions.size());
-    EXPECT_FALSE(changedCache[0]);
-
-    LogEvent event2(kUidProcTag, 0 /*timestamp*/);
-    makeUidProcStateEvent(uid1, state2, &event2);
-
-    changedCache[0] = false;
-    conditionCache[0] = ConditionState::kNotEvaluated;
-    tracker.evaluateCondition(event2, matcherState, allPredicates, conditionCache, changedCache);
-    EXPECT_EQ(1ULL, tracker.mLastChangedToTrueDimensions.size());
-    EXPECT_EQ(1ULL, tracker.mLastChangedToFalseDimensions.size());
-    EXPECT_TRUE(changedCache[0]);
-
-    LogEvent event3(kUidProcTag, 0 /*timestamp*/);
-    makeUidProcStateEvent(uid2, state1, &event3);
-    changedCache[0] = false;
-    conditionCache[0] = ConditionState::kNotEvaluated;
-    tracker.evaluateCondition(event3, matcherState, allPredicates, conditionCache, changedCache);
-    EXPECT_EQ(1ULL, tracker.mLastChangedToTrueDimensions.size());
-    EXPECT_EQ(0ULL, tracker.mLastChangedToFalseDimensions.size());
-    EXPECT_TRUE(changedCache[0]);
-}
+// TODO(b/149590301): Update these tests to use new socket schema.
+//void makeUidProcStateEvent(int32_t uid, int32_t state, LogEvent* event) {
+//    event->write(uid);
+//    event->write(state);
+//    event->init();
+//}
+//
+//TEST(StateConditionTrackerTest, TestStateChange) {
+//    int uid1 = 111;
+//    int uid2 = 222;
+//
+//    int state1 = 1001;
+//    int state2 = 1002;
+//    unordered_map<int64_t, int> trackerNameIndexMap;
+//    trackerNameIndexMap[StringToId("UidProcState")] = 0;
+//    vector<Matcher> primaryFields;
+//    primaryFields.push_back(getSimpleMatcher(kUidProcTag, 1));
+//    StateConditionTracker tracker(ConfigKey(12, 123), 123, 0, getUidProcStatePredicate(),
+//                         trackerNameIndexMap, primaryFields);
+//
+//    LogEvent event(kUidProcTag, 0 /*timestamp*/);
+//    makeUidProcStateEvent(uid1, state1, &event);
+//
+//    vector<MatchingState> matcherState;
+//    matcherState.push_back(MatchingState::kMatched);
+//    vector<sp<ConditionTracker>> allPredicates;
+//    vector<ConditionState> conditionCache(1, ConditionState::kNotEvaluated);
+//    vector<bool> changedCache(1, false);
+//
+//    tracker.evaluateCondition(event, matcherState, allPredicates, conditionCache, changedCache);
+//    EXPECT_EQ(1ULL, tracker.mLastChangedToTrueDimensions.size());
+//    EXPECT_EQ(0ULL, tracker.mLastChangedToFalseDimensions.size());
+//    EXPECT_TRUE(changedCache[0]);
+//
+//    changedCache[0] = false;
+//    conditionCache[0] = ConditionState::kNotEvaluated;
+//    tracker.evaluateCondition(event, matcherState, allPredicates, conditionCache, changedCache);
+//    EXPECT_EQ(0ULL, tracker.mLastChangedToTrueDimensions.size());
+//    EXPECT_EQ(0ULL, tracker.mLastChangedToFalseDimensions.size());
+//    EXPECT_FALSE(changedCache[0]);
+//
+//    LogEvent event2(kUidProcTag, 0 /*timestamp*/);
+//    makeUidProcStateEvent(uid1, state2, &event2);
+//
+//    changedCache[0] = false;
+//    conditionCache[0] = ConditionState::kNotEvaluated;
+//    tracker.evaluateCondition(event2, matcherState, allPredicates, conditionCache, changedCache);
+//    EXPECT_EQ(1ULL, tracker.mLastChangedToTrueDimensions.size());
+//    EXPECT_EQ(1ULL, tracker.mLastChangedToFalseDimensions.size());
+//    EXPECT_TRUE(changedCache[0]);
+//
+//    LogEvent event3(kUidProcTag, 0 /*timestamp*/);
+//    makeUidProcStateEvent(uid2, state1, &event3);
+//    changedCache[0] = false;
+//    conditionCache[0] = ConditionState::kNotEvaluated;
+//    tracker.evaluateCondition(event3, matcherState, allPredicates, conditionCache, changedCache);
+//    EXPECT_EQ(1ULL, tracker.mLastChangedToTrueDimensions.size());
+//    EXPECT_EQ(0ULL, tracker.mLastChangedToFalseDimensions.size());
+//    EXPECT_TRUE(changedCache[0]);
+//}
 
 }  // namespace statsd
 }  // namespace os
diff --git a/cmds/statsd/tests/e2e/Anomaly_count_e2e_test.cpp b/cmds/statsd/tests/e2e/Anomaly_count_e2e_test.cpp
index c78d99e..1eaaf08 100644
--- a/cmds/statsd/tests/e2e/Anomaly_count_e2e_test.cpp
+++ b/cmds/statsd/tests/e2e/Anomaly_count_e2e_test.cpp
@@ -53,184 +53,185 @@
 
 }  // namespace
 
-TEST(AnomalyDetectionE2eTest, TestSlicedCountMetric_single_bucket) {
-    const int num_buckets = 1;
-    const int threshold = 3;
-    auto config = CreateStatsdConfig(num_buckets, threshold);
-    const uint64_t alert_id = config.alert(0).id();
-    const uint32_t refractory_period_sec = config.alert(0).refractory_period_secs();
-
-    int64_t bucketStartTimeNs = 10000000000;
-    int64_t bucketSizeNs =
-        TimeUnitToBucketSizeInMillis(config.count_metric(0).bucket()) * 1000000;
-
-    ConfigKey cfgKey;
-    auto processor = CreateStatsLogProcessor(bucketStartTimeNs, bucketStartTimeNs, config, cfgKey);
-    EXPECT_EQ(processor->mMetricsManagers.size(), 1u);
-    EXPECT_TRUE(processor->mMetricsManagers.begin()->second->isConfigValid());
-    EXPECT_EQ(1u, processor->mMetricsManagers.begin()->second->mAllAnomalyTrackers.size());
-
-    sp<AnomalyTracker> anomalyTracker =
-        processor->mMetricsManagers.begin()->second->mAllAnomalyTrackers[0];
-
-    std::vector<AttributionNodeInternal> attributions1 = {CreateAttribution(111, "App1")};
-    std::vector<AttributionNodeInternal> attributions2 = {
-        CreateAttribution(111, "App1"), CreateAttribution(222, "GMSCoreModule1")};
-    std::vector<AttributionNodeInternal> attributions3 = {
-        CreateAttribution(111, "App1"), CreateAttribution(333, "App3")};
-    std::vector<AttributionNodeInternal> attributions4 = {
-        CreateAttribution(222, "GMSCoreModule1"), CreateAttribution(333, "App3")};
-    std::vector<AttributionNodeInternal> attributions5 = {
-        CreateAttribution(222, "GMSCoreModule1") };
-
-    FieldValue fieldValue1(Field(android::util::WAKELOCK_STATE_CHANGED, (int32_t)0x02010101),
-                           Value((int32_t)111));
-    HashableDimensionKey whatKey1({fieldValue1});
-    MetricDimensionKey dimensionKey1(whatKey1, DEFAULT_DIMENSION_KEY);
-
-    FieldValue fieldValue2(Field(android::util::WAKELOCK_STATE_CHANGED, (int32_t)0x02010101),
-                           Value((int32_t)222));
-    HashableDimensionKey whatKey2({fieldValue2});
-    MetricDimensionKey dimensionKey2(whatKey2, DEFAULT_DIMENSION_KEY);
-
-    auto event = CreateAcquireWakelockEvent(attributions1, "wl1", bucketStartTimeNs + 2);
-    processor->OnLogEvent(event.get());
-    EXPECT_EQ(0u, anomalyTracker->getRefractoryPeriodEndsSec(dimensionKey1));
-
-    event = CreateAcquireWakelockEvent(attributions4, "wl2", bucketStartTimeNs + 2);
-    processor->OnLogEvent(event.get());
-    EXPECT_EQ(0u, anomalyTracker->getRefractoryPeriodEndsSec(dimensionKey2));
-
-    event = CreateAcquireWakelockEvent(attributions2, "wl1", bucketStartTimeNs + 3);
-    processor->OnLogEvent(event.get());
-    EXPECT_EQ(0u, anomalyTracker->getRefractoryPeriodEndsSec(dimensionKey1));
-
-    event = CreateAcquireWakelockEvent(attributions5, "wl2", bucketStartTimeNs + 3);
-    processor->OnLogEvent(event.get());
-    EXPECT_EQ(0u, anomalyTracker->getRefractoryPeriodEndsSec(dimensionKey2));
-
-    event = CreateAcquireWakelockEvent(attributions3, "wl1", bucketStartTimeNs + 4);
-    processor->OnLogEvent(event.get());
-    EXPECT_EQ(0u, anomalyTracker->getRefractoryPeriodEndsSec(dimensionKey1));
-
-    event = CreateAcquireWakelockEvent(attributions5, "wl2", bucketStartTimeNs + 4);
-    processor->OnLogEvent(event.get());
-    EXPECT_EQ(0u, anomalyTracker->getRefractoryPeriodEndsSec(dimensionKey2));
-
-    // Fired alarm and refractory period end timestamp updated.
-    event = CreateAcquireWakelockEvent(attributions1, "wl1", bucketStartTimeNs + 5);
-    processor->OnLogEvent(event.get());
-    EXPECT_EQ(refractory_period_sec + bucketStartTimeNs / NS_PER_SEC + 1,
-              anomalyTracker->getRefractoryPeriodEndsSec(dimensionKey1));
-
-    event = CreateAcquireWakelockEvent(attributions1, "wl1", bucketStartTimeNs + 100);
-    processor->OnLogEvent(event.get());
-    EXPECT_EQ(refractory_period_sec + bucketStartTimeNs / NS_PER_SEC + 1,
-              anomalyTracker->getRefractoryPeriodEndsSec(dimensionKey1));
-
-    event = CreateAcquireWakelockEvent(attributions1, "wl1", bucketStartTimeNs + bucketSizeNs - 1);
-    processor->OnLogEvent(event.get());
-    EXPECT_EQ(refractory_period_sec + (bucketStartTimeNs + bucketSizeNs - 1) / NS_PER_SEC + 1,
-              anomalyTracker->getRefractoryPeriodEndsSec(dimensionKey1));
-
-    event = CreateAcquireWakelockEvent(attributions1, "wl1", bucketStartTimeNs + bucketSizeNs + 1);
-    processor->OnLogEvent(event.get());
-    EXPECT_EQ(refractory_period_sec + (bucketStartTimeNs + bucketSizeNs - 1) / NS_PER_SEC + 1,
-              anomalyTracker->getRefractoryPeriodEndsSec(dimensionKey1));
-
-    event = CreateAcquireWakelockEvent(attributions4, "wl2", bucketStartTimeNs + bucketSizeNs + 1);
-    processor->OnLogEvent(event.get());
-    EXPECT_EQ(0u, anomalyTracker->getRefractoryPeriodEndsSec(dimensionKey2));
-
-    event = CreateAcquireWakelockEvent(attributions5, "wl2", bucketStartTimeNs + bucketSizeNs + 2);
-    processor->OnLogEvent(event.get());
-    EXPECT_EQ(0u, anomalyTracker->getRefractoryPeriodEndsSec(dimensionKey2));
-
-    event = CreateAcquireWakelockEvent(attributions5, "wl2", bucketStartTimeNs + bucketSizeNs + 3);
-    processor->OnLogEvent(event.get());
-    EXPECT_EQ(0u, anomalyTracker->getRefractoryPeriodEndsSec(dimensionKey2));
-
-    event = CreateAcquireWakelockEvent(attributions5, "wl2", bucketStartTimeNs + bucketSizeNs + 4);
-    processor->OnLogEvent(event.get());
-    EXPECT_EQ(refractory_period_sec + (bucketStartTimeNs + bucketSizeNs + 4) / NS_PER_SEC + 1,
-              anomalyTracker->getRefractoryPeriodEndsSec(dimensionKey2));
-}
-
-TEST(AnomalyDetectionE2eTest, TestSlicedCountMetric_multiple_buckets) {
-    const int num_buckets = 3;
-    const int threshold = 3;
-    auto config = CreateStatsdConfig(num_buckets, threshold);
-    const uint64_t alert_id = config.alert(0).id();
-    const uint32_t refractory_period_sec = config.alert(0).refractory_period_secs();
-
-    int64_t bucketStartTimeNs = 10000000000;
-    int64_t bucketSizeNs =
-        TimeUnitToBucketSizeInMillis(config.count_metric(0).bucket()) * 1000000;
-
-    ConfigKey cfgKey;
-    auto processor = CreateStatsLogProcessor(bucketStartTimeNs, bucketStartTimeNs, config, cfgKey);
-    EXPECT_EQ(processor->mMetricsManagers.size(), 1u);
-    EXPECT_TRUE(processor->mMetricsManagers.begin()->second->isConfigValid());
-    EXPECT_EQ(1u, processor->mMetricsManagers.begin()->second->mAllAnomalyTrackers.size());
-
-    sp<AnomalyTracker> anomalyTracker =
-        processor->mMetricsManagers.begin()->second->mAllAnomalyTrackers[0];
-
-    std::vector<AttributionNodeInternal> attributions1 = {CreateAttribution(111, "App1")};
-    std::vector<AttributionNodeInternal> attributions2 = {
-        CreateAttribution(111, "App1"), CreateAttribution(222, "GMSCoreModule1")};
-    std::vector<AttributionNodeInternal> attributions3 = {
-        CreateAttribution(111, "App1"), CreateAttribution(333, "App3")};
-    std::vector<AttributionNodeInternal> attributions4 = {
-        CreateAttribution(222, "GMSCoreModule1"), CreateAttribution(333, "App3")};
-    std::vector<AttributionNodeInternal> attributions5 = {
-        CreateAttribution(222, "GMSCoreModule1") };
-
-    FieldValue fieldValue1(Field(android::util::WAKELOCK_STATE_CHANGED, (int32_t)0x02010101),
-                           Value((int32_t)111));
-    HashableDimensionKey whatKey1({fieldValue1});
-    MetricDimensionKey dimensionKey1(whatKey1, DEFAULT_DIMENSION_KEY);
-
-    FieldValue fieldValue2(Field(android::util::WAKELOCK_STATE_CHANGED, (int32_t)0x02010101),
-                           Value((int32_t)222));
-    HashableDimensionKey whatKey2({fieldValue2});
-    MetricDimensionKey dimensionKey2(whatKey2, DEFAULT_DIMENSION_KEY);
-
-    auto event = CreateAcquireWakelockEvent(attributions1, "wl1", bucketStartTimeNs + 2);
-    processor->OnLogEvent(event.get());
-    EXPECT_EQ(0u, anomalyTracker->getRefractoryPeriodEndsSec(dimensionKey1));
-
-    event = CreateAcquireWakelockEvent(attributions2, "wl1", bucketStartTimeNs + 3);
-    processor->OnLogEvent(event.get());
-    EXPECT_EQ(0u, anomalyTracker->getRefractoryPeriodEndsSec(dimensionKey1));
-
-    // Fired alarm and refractory period end timestamp updated.
-    event = CreateAcquireWakelockEvent(attributions1, "wl1", bucketStartTimeNs + 4);
-    processor->OnLogEvent(event.get());
-    EXPECT_EQ(0u, anomalyTracker->getRefractoryPeriodEndsSec(dimensionKey1));
-
-    event = CreateAcquireWakelockEvent(attributions1, "wl1", bucketStartTimeNs + bucketSizeNs + 1);
-    processor->OnLogEvent(event.get());
-    EXPECT_EQ(refractory_period_sec + (bucketStartTimeNs + bucketSizeNs + 1) / NS_PER_SEC + 1,
-              anomalyTracker->getRefractoryPeriodEndsSec(dimensionKey1));
-
-    event = CreateAcquireWakelockEvent(attributions2, "wl1", bucketStartTimeNs + bucketSizeNs + 2);
-    processor->OnLogEvent(event.get());
-    EXPECT_EQ(refractory_period_sec + (bucketStartTimeNs + bucketSizeNs + 1) / NS_PER_SEC + 1,
-              anomalyTracker->getRefractoryPeriodEndsSec(dimensionKey1));
-
-    event = CreateAcquireWakelockEvent(
-        attributions2, "wl1", bucketStartTimeNs + 3 * bucketSizeNs + 1);
-    processor->OnLogEvent(event.get());
-    EXPECT_EQ(refractory_period_sec + (bucketStartTimeNs + bucketSizeNs + 1) / NS_PER_SEC + 1,
-              anomalyTracker->getRefractoryPeriodEndsSec(dimensionKey1));
-
-    event = CreateAcquireWakelockEvent(
-        attributions2, "wl1", bucketStartTimeNs + 3 * bucketSizeNs + 2);
-    processor->OnLogEvent(event.get());
-    EXPECT_EQ(refractory_period_sec + (bucketStartTimeNs + 3 * bucketSizeNs + 2) / NS_PER_SEC + 1,
-              anomalyTracker->getRefractoryPeriodEndsSec(dimensionKey1));
-}
+// TODO(b/149590301): Update these tests to use new socket schema.
+//TEST(AnomalyDetectionE2eTest, TestSlicedCountMetric_single_bucket) {
+//    const int num_buckets = 1;
+//    const int threshold = 3;
+//    auto config = CreateStatsdConfig(num_buckets, threshold);
+//    const uint64_t alert_id = config.alert(0).id();
+//    const uint32_t refractory_period_sec = config.alert(0).refractory_period_secs();
+//
+//    int64_t bucketStartTimeNs = 10000000000;
+//    int64_t bucketSizeNs =
+//        TimeUnitToBucketSizeInMillis(config.count_metric(0).bucket()) * 1000000;
+//
+//    ConfigKey cfgKey;
+//    auto processor = CreateStatsLogProcessor(bucketStartTimeNs, bucketStartTimeNs, config, cfgKey);
+//    EXPECT_EQ(processor->mMetricsManagers.size(), 1u);
+//    EXPECT_TRUE(processor->mMetricsManagers.begin()->second->isConfigValid());
+//    EXPECT_EQ(1u, processor->mMetricsManagers.begin()->second->mAllAnomalyTrackers.size());
+//
+//    sp<AnomalyTracker> anomalyTracker =
+//        processor->mMetricsManagers.begin()->second->mAllAnomalyTrackers[0];
+//
+//    std::vector<AttributionNodeInternal> attributions1 = {CreateAttribution(111, "App1")};
+//    std::vector<AttributionNodeInternal> attributions2 = {
+//        CreateAttribution(111, "App1"), CreateAttribution(222, "GMSCoreModule1")};
+//    std::vector<AttributionNodeInternal> attributions3 = {
+//        CreateAttribution(111, "App1"), CreateAttribution(333, "App3")};
+//    std::vector<AttributionNodeInternal> attributions4 = {
+//        CreateAttribution(222, "GMSCoreModule1"), CreateAttribution(333, "App3")};
+//    std::vector<AttributionNodeInternal> attributions5 = {
+//        CreateAttribution(222, "GMSCoreModule1") };
+//
+//    FieldValue fieldValue1(Field(android::util::WAKELOCK_STATE_CHANGED, (int32_t)0x02010101),
+//                           Value((int32_t)111));
+//    HashableDimensionKey whatKey1({fieldValue1});
+//    MetricDimensionKey dimensionKey1(whatKey1, DEFAULT_DIMENSION_KEY);
+//
+//    FieldValue fieldValue2(Field(android::util::WAKELOCK_STATE_CHANGED, (int32_t)0x02010101),
+//                           Value((int32_t)222));
+//    HashableDimensionKey whatKey2({fieldValue2});
+//    MetricDimensionKey dimensionKey2(whatKey2, DEFAULT_DIMENSION_KEY);
+//
+//    auto event = CreateAcquireWakelockEvent(attributions1, "wl1", bucketStartTimeNs + 2);
+//    processor->OnLogEvent(event.get());
+//    EXPECT_EQ(0u, anomalyTracker->getRefractoryPeriodEndsSec(dimensionKey1));
+//
+//    event = CreateAcquireWakelockEvent(attributions4, "wl2", bucketStartTimeNs + 2);
+//    processor->OnLogEvent(event.get());
+//    EXPECT_EQ(0u, anomalyTracker->getRefractoryPeriodEndsSec(dimensionKey2));
+//
+//    event = CreateAcquireWakelockEvent(attributions2, "wl1", bucketStartTimeNs + 3);
+//    processor->OnLogEvent(event.get());
+//    EXPECT_EQ(0u, anomalyTracker->getRefractoryPeriodEndsSec(dimensionKey1));
+//
+//    event = CreateAcquireWakelockEvent(attributions5, "wl2", bucketStartTimeNs + 3);
+//    processor->OnLogEvent(event.get());
+//    EXPECT_EQ(0u, anomalyTracker->getRefractoryPeriodEndsSec(dimensionKey2));
+//
+//    event = CreateAcquireWakelockEvent(attributions3, "wl1", bucketStartTimeNs + 4);
+//    processor->OnLogEvent(event.get());
+//    EXPECT_EQ(0u, anomalyTracker->getRefractoryPeriodEndsSec(dimensionKey1));
+//
+//    event = CreateAcquireWakelockEvent(attributions5, "wl2", bucketStartTimeNs + 4);
+//    processor->OnLogEvent(event.get());
+//    EXPECT_EQ(0u, anomalyTracker->getRefractoryPeriodEndsSec(dimensionKey2));
+//
+//    // Fired alarm and refractory period end timestamp updated.
+//    event = CreateAcquireWakelockEvent(attributions1, "wl1", bucketStartTimeNs + 5);
+//    processor->OnLogEvent(event.get());
+//    EXPECT_EQ(refractory_period_sec + bucketStartTimeNs / NS_PER_SEC + 1,
+//              anomalyTracker->getRefractoryPeriodEndsSec(dimensionKey1));
+//
+//    event = CreateAcquireWakelockEvent(attributions1, "wl1", bucketStartTimeNs + 100);
+//    processor->OnLogEvent(event.get());
+//    EXPECT_EQ(refractory_period_sec + bucketStartTimeNs / NS_PER_SEC + 1,
+//              anomalyTracker->getRefractoryPeriodEndsSec(dimensionKey1));
+//
+//    event = CreateAcquireWakelockEvent(attributions1, "wl1", bucketStartTimeNs + bucketSizeNs - 1);
+//    processor->OnLogEvent(event.get());
+//    EXPECT_EQ(refractory_period_sec + (bucketStartTimeNs + bucketSizeNs - 1) / NS_PER_SEC + 1,
+//              anomalyTracker->getRefractoryPeriodEndsSec(dimensionKey1));
+//
+//    event = CreateAcquireWakelockEvent(attributions1, "wl1", bucketStartTimeNs + bucketSizeNs + 1);
+//    processor->OnLogEvent(event.get());
+//    EXPECT_EQ(refractory_period_sec + (bucketStartTimeNs + bucketSizeNs - 1) / NS_PER_SEC + 1,
+//              anomalyTracker->getRefractoryPeriodEndsSec(dimensionKey1));
+//
+//    event = CreateAcquireWakelockEvent(attributions4, "wl2", bucketStartTimeNs + bucketSizeNs + 1);
+//    processor->OnLogEvent(event.get());
+//    EXPECT_EQ(0u, anomalyTracker->getRefractoryPeriodEndsSec(dimensionKey2));
+//
+//    event = CreateAcquireWakelockEvent(attributions5, "wl2", bucketStartTimeNs + bucketSizeNs + 2);
+//    processor->OnLogEvent(event.get());
+//    EXPECT_EQ(0u, anomalyTracker->getRefractoryPeriodEndsSec(dimensionKey2));
+//
+//    event = CreateAcquireWakelockEvent(attributions5, "wl2", bucketStartTimeNs + bucketSizeNs + 3);
+//    processor->OnLogEvent(event.get());
+//    EXPECT_EQ(0u, anomalyTracker->getRefractoryPeriodEndsSec(dimensionKey2));
+//
+//    event = CreateAcquireWakelockEvent(attributions5, "wl2", bucketStartTimeNs + bucketSizeNs + 4);
+//    processor->OnLogEvent(event.get());
+//    EXPECT_EQ(refractory_period_sec + (bucketStartTimeNs + bucketSizeNs + 4) / NS_PER_SEC + 1,
+//              anomalyTracker->getRefractoryPeriodEndsSec(dimensionKey2));
+//}
+//
+//TEST(AnomalyDetectionE2eTest, TestSlicedCountMetric_multiple_buckets) {
+//    const int num_buckets = 3;
+//    const int threshold = 3;
+//    auto config = CreateStatsdConfig(num_buckets, threshold);
+//    const uint64_t alert_id = config.alert(0).id();
+//    const uint32_t refractory_period_sec = config.alert(0).refractory_period_secs();
+//
+//    int64_t bucketStartTimeNs = 10000000000;
+//    int64_t bucketSizeNs =
+//        TimeUnitToBucketSizeInMillis(config.count_metric(0).bucket()) * 1000000;
+//
+//    ConfigKey cfgKey;
+//    auto processor = CreateStatsLogProcessor(bucketStartTimeNs, bucketStartTimeNs, config, cfgKey);
+//    EXPECT_EQ(processor->mMetricsManagers.size(), 1u);
+//    EXPECT_TRUE(processor->mMetricsManagers.begin()->second->isConfigValid());
+//    EXPECT_EQ(1u, processor->mMetricsManagers.begin()->second->mAllAnomalyTrackers.size());
+//
+//    sp<AnomalyTracker> anomalyTracker =
+//        processor->mMetricsManagers.begin()->second->mAllAnomalyTrackers[0];
+//
+//    std::vector<AttributionNodeInternal> attributions1 = {CreateAttribution(111, "App1")};
+//    std::vector<AttributionNodeInternal> attributions2 = {
+//        CreateAttribution(111, "App1"), CreateAttribution(222, "GMSCoreModule1")};
+//    std::vector<AttributionNodeInternal> attributions3 = {
+//        CreateAttribution(111, "App1"), CreateAttribution(333, "App3")};
+//    std::vector<AttributionNodeInternal> attributions4 = {
+//        CreateAttribution(222, "GMSCoreModule1"), CreateAttribution(333, "App3")};
+//    std::vector<AttributionNodeInternal> attributions5 = {
+//        CreateAttribution(222, "GMSCoreModule1") };
+//
+//    FieldValue fieldValue1(Field(android::util::WAKELOCK_STATE_CHANGED, (int32_t)0x02010101),
+//                           Value((int32_t)111));
+//    HashableDimensionKey whatKey1({fieldValue1});
+//    MetricDimensionKey dimensionKey1(whatKey1, DEFAULT_DIMENSION_KEY);
+//
+//    FieldValue fieldValue2(Field(android::util::WAKELOCK_STATE_CHANGED, (int32_t)0x02010101),
+//                           Value((int32_t)222));
+//    HashableDimensionKey whatKey2({fieldValue2});
+//    MetricDimensionKey dimensionKey2(whatKey2, DEFAULT_DIMENSION_KEY);
+//
+//    auto event = CreateAcquireWakelockEvent(attributions1, "wl1", bucketStartTimeNs + 2);
+//    processor->OnLogEvent(event.get());
+//    EXPECT_EQ(0u, anomalyTracker->getRefractoryPeriodEndsSec(dimensionKey1));
+//
+//    event = CreateAcquireWakelockEvent(attributions2, "wl1", bucketStartTimeNs + 3);
+//    processor->OnLogEvent(event.get());
+//    EXPECT_EQ(0u, anomalyTracker->getRefractoryPeriodEndsSec(dimensionKey1));
+//
+//    // Fired alarm and refractory period end timestamp updated.
+//    event = CreateAcquireWakelockEvent(attributions1, "wl1", bucketStartTimeNs + 4);
+//    processor->OnLogEvent(event.get());
+//    EXPECT_EQ(0u, anomalyTracker->getRefractoryPeriodEndsSec(dimensionKey1));
+//
+//    event = CreateAcquireWakelockEvent(attributions1, "wl1", bucketStartTimeNs + bucketSizeNs + 1);
+//    processor->OnLogEvent(event.get());
+//    EXPECT_EQ(refractory_period_sec + (bucketStartTimeNs + bucketSizeNs + 1) / NS_PER_SEC + 1,
+//              anomalyTracker->getRefractoryPeriodEndsSec(dimensionKey1));
+//
+//    event = CreateAcquireWakelockEvent(attributions2, "wl1", bucketStartTimeNs + bucketSizeNs + 2);
+//    processor->OnLogEvent(event.get());
+//    EXPECT_EQ(refractory_period_sec + (bucketStartTimeNs + bucketSizeNs + 1) / NS_PER_SEC + 1,
+//              anomalyTracker->getRefractoryPeriodEndsSec(dimensionKey1));
+//
+//    event = CreateAcquireWakelockEvent(
+//        attributions2, "wl1", bucketStartTimeNs + 3 * bucketSizeNs + 1);
+//    processor->OnLogEvent(event.get());
+//    EXPECT_EQ(refractory_period_sec + (bucketStartTimeNs + bucketSizeNs + 1) / NS_PER_SEC + 1,
+//              anomalyTracker->getRefractoryPeriodEndsSec(dimensionKey1));
+//
+//    event = CreateAcquireWakelockEvent(
+//        attributions2, "wl1", bucketStartTimeNs + 3 * bucketSizeNs + 2);
+//    processor->OnLogEvent(event.get());
+//    EXPECT_EQ(refractory_period_sec + (bucketStartTimeNs + 3 * bucketSizeNs + 2) / NS_PER_SEC + 1,
+//              anomalyTracker->getRefractoryPeriodEndsSec(dimensionKey1));
+//}
 
 #else
 GTEST_LOG_(INFO) << "This test does nothing.\n";
diff --git a/cmds/statsd/tests/e2e/Anomaly_duration_sum_e2e_test.cpp b/cmds/statsd/tests/e2e/Anomaly_duration_sum_e2e_test.cpp
index 50da9e2..03a209a 100644
--- a/cmds/statsd/tests/e2e/Anomaly_duration_sum_e2e_test.cpp
+++ b/cmds/statsd/tests/e2e/Anomaly_duration_sum_e2e_test.cpp
@@ -89,393 +89,394 @@
                                            (int32_t)0x02010101), Value((int32_t)222))}),
     DEFAULT_DIMENSION_KEY);
 
-TEST(AnomalyDetectionE2eTest, TestDurationMetric_SUM_single_bucket) {
-    const int num_buckets = 1;
-    const uint64_t threshold_ns = NS_PER_SEC;
-    auto config = CreateStatsdConfig(num_buckets, threshold_ns, DurationMetric::SUM, true);
-    const uint64_t alert_id = config.alert(0).id();
-    const uint32_t refractory_period_sec = config.alert(0).refractory_period_secs();
-
-    int64_t bucketStartTimeNs = 10 * NS_PER_SEC;
-    int64_t bucketSizeNs =
-        TimeUnitToBucketSizeInMillis(config.duration_metric(0).bucket()) * 1000000;
-
-    ConfigKey cfgKey;
-    auto processor = CreateStatsLogProcessor(bucketStartTimeNs, bucketStartTimeNs, config, cfgKey);
-    EXPECT_EQ(processor->mMetricsManagers.size(), 1u);
-    EXPECT_TRUE(processor->mMetricsManagers.begin()->second->isConfigValid());
-    EXPECT_EQ(1u, processor->mMetricsManagers.begin()->second->mAllAnomalyTrackers.size());
-
-    sp<AnomalyTracker> anomalyTracker =
-        processor->mMetricsManagers.begin()->second->mAllAnomalyTrackers[0];
-
-    auto screen_on_event = CreateScreenStateChangedEvent(
-            android::view::DisplayStateEnum::DISPLAY_STATE_ON, bucketStartTimeNs + 1);
-    auto screen_off_event = CreateScreenStateChangedEvent(
-            android::view::DisplayStateEnum::DISPLAY_STATE_OFF, bucketStartTimeNs + 10);
-    processor->OnLogEvent(screen_on_event.get());
-    processor->OnLogEvent(screen_off_event.get());
-
-    // Acquire wakelock wl1.
-    auto acquire_event = CreateAcquireWakelockEvent(attributions1, "wl1", bucketStartTimeNs + 11);
-    processor->OnLogEvent(acquire_event.get());
-    EXPECT_EQ((bucketStartTimeNs + 11 + threshold_ns) / NS_PER_SEC + 1,
-              anomalyTracker->getAlarmTimestampSec(dimensionKey));
-    EXPECT_EQ(0u, anomalyTracker->getRefractoryPeriodEndsSec(dimensionKey));
-
-    // Release wakelock wl1. No anomaly detected. Alarm cancelled at the "release" event.
-    auto release_event = CreateReleaseWakelockEvent(attributions1, "wl1", bucketStartTimeNs + 101);
-    processor->OnLogEvent(release_event.get());
-    EXPECT_EQ(0u, anomalyTracker->getAlarmTimestampSec(dimensionKey));
-    EXPECT_EQ(0u, anomalyTracker->getRefractoryPeriodEndsSec(dimensionKey));
-
-    // Acquire wakelock wl1 within bucket #0.
-    acquire_event = CreateAcquireWakelockEvent(attributions2, "wl1", bucketStartTimeNs + 110);
-    processor->OnLogEvent(acquire_event.get());
-    EXPECT_EQ((bucketStartTimeNs + 110 + threshold_ns - 90) / NS_PER_SEC + 1,
-              anomalyTracker->getAlarmTimestampSec(dimensionKey));
-    EXPECT_EQ(0u, anomalyTracker->getRefractoryPeriodEndsSec(dimensionKey));
-
-    // Release wakelock wl1. One anomaly detected.
-    release_event = CreateReleaseWakelockEvent(
-            attributions2, "wl1", bucketStartTimeNs + NS_PER_SEC + 109);
-    processor->OnLogEvent(release_event.get());
-    EXPECT_EQ(0u, anomalyTracker->getAlarmTimestampSec(dimensionKey));
-    EXPECT_EQ(refractory_period_sec + (bucketStartTimeNs + NS_PER_SEC + 109) / NS_PER_SEC + 1,
-              anomalyTracker->getRefractoryPeriodEndsSec(dimensionKey));
-
-    // Acquire wakelock wl1.
-    acquire_event = CreateAcquireWakelockEvent(
-        attributions1, "wl1", bucketStartTimeNs + NS_PER_SEC + 112);
-    processor->OnLogEvent(acquire_event.get());
-    // Wakelock has been hold longer than the threshold in bucket #0. The alarm is set at the
-    // end of the refractory period.
-    const int64_t alarmFiredTimestampSec0 = anomalyTracker->getAlarmTimestampSec(dimensionKey);
-    EXPECT_EQ(refractory_period_sec + (bucketStartTimeNs + NS_PER_SEC + 109) / NS_PER_SEC + 1,
-              (uint32_t)alarmFiredTimestampSec0);
-
-    // Anomaly alarm fired.
-    auto alarmSet = processor->getAnomalyAlarmMonitor()->popSoonerThan(
-            static_cast<uint32_t>(alarmFiredTimestampSec0));
-    EXPECT_EQ(1u, alarmSet.size());
-    processor->onAnomalyAlarmFired(alarmFiredTimestampSec0 * NS_PER_SEC, alarmSet);
-    EXPECT_EQ(0u, anomalyTracker->getAlarmTimestampSec(dimensionKey));
-    EXPECT_EQ(refractory_period_sec + alarmFiredTimestampSec0,
-              anomalyTracker->getRefractoryPeriodEndsSec(dimensionKey));
-
-    // Release wakelock wl1.
-    release_event = CreateReleaseWakelockEvent(
-            attributions1, "wl1", alarmFiredTimestampSec0 * NS_PER_SEC + NS_PER_SEC + 1);
-    processor->OnLogEvent(release_event.get());
-    EXPECT_EQ(0u, anomalyTracker->getAlarmTimestampSec(dimensionKey));
-    // Within refractory period. No more anomaly detected.
-    EXPECT_EQ(refractory_period_sec + alarmFiredTimestampSec0,
-              anomalyTracker->getRefractoryPeriodEndsSec(dimensionKey));
-
-    // Acquire wakelock wl1.
-    acquire_event = CreateAcquireWakelockEvent(
-        attributions2, "wl1", bucketStartTimeNs + bucketSizeNs -  5 * NS_PER_SEC - 11);
-    processor->OnLogEvent(acquire_event.get());
-    const int64_t alarmFiredTimestampSec1 = anomalyTracker->getAlarmTimestampSec(dimensionKey);
-    EXPECT_EQ((bucketStartTimeNs + bucketSizeNs - 5 * NS_PER_SEC) / NS_PER_SEC,
-              (uint64_t)alarmFiredTimestampSec1);
-
-    // Release wakelock wl1.
-    release_event = CreateReleaseWakelockEvent(
-        attributions2, "wl1", bucketStartTimeNs + bucketSizeNs - 4 * NS_PER_SEC - 10);
-    processor->OnLogEvent(release_event.get());
-    EXPECT_EQ(0u, anomalyTracker->getAlarmTimestampSec(dimensionKey));
-    EXPECT_EQ(refractory_period_sec +
-                    (bucketStartTimeNs + bucketSizeNs - 4 * NS_PER_SEC - 10) / NS_PER_SEC + 1,
-              anomalyTracker->getRefractoryPeriodEndsSec(dimensionKey));
-
-    alarmSet = processor->getAnomalyAlarmMonitor()->popSoonerThan(
-                static_cast<uint32_t>(alarmFiredTimestampSec1));
-    EXPECT_EQ(0u, alarmSet.size());
-
-    // Acquire wakelock wl1 near the end of bucket #0.
-    acquire_event = CreateAcquireWakelockEvent(
-            attributions1, "wl1", bucketStartTimeNs + bucketSizeNs - 2);
-    processor->OnLogEvent(acquire_event.get());
-    EXPECT_EQ((bucketStartTimeNs + bucketSizeNs) / NS_PER_SEC,
-               anomalyTracker->getAlarmTimestampSec(dimensionKey));
-
-    // Release the event at early bucket #1.
-    release_event = CreateReleaseWakelockEvent(
-            attributions1, "wl1", bucketStartTimeNs + bucketSizeNs + NS_PER_SEC - 1);
-    processor->OnLogEvent(release_event.get());
-    EXPECT_EQ(0u, anomalyTracker->getAlarmTimestampSec(dimensionKey));
-    // Anomaly detected when stopping the alarm. The refractory period does not change.
-    EXPECT_EQ(refractory_period_sec +
-                    (bucketStartTimeNs + bucketSizeNs + NS_PER_SEC) / NS_PER_SEC,
-              anomalyTracker->getRefractoryPeriodEndsSec(dimensionKey));
-
-    // Condition changes to false.
-    screen_on_event = CreateScreenStateChangedEvent(
-        android::view::DisplayStateEnum::DISPLAY_STATE_ON,
-        bucketStartTimeNs + 2 * bucketSizeNs + 20);
-    processor->OnLogEvent(screen_on_event.get());
-    EXPECT_EQ(refractory_period_sec +
-                    (bucketStartTimeNs + bucketSizeNs + NS_PER_SEC) / NS_PER_SEC,
-              anomalyTracker->getRefractoryPeriodEndsSec(dimensionKey));
-    EXPECT_EQ(0u, anomalyTracker->getAlarmTimestampSec(dimensionKey));
-
-    acquire_event = CreateAcquireWakelockEvent(
-        attributions2, "wl1", bucketStartTimeNs + 2 * bucketSizeNs + 30);
-    processor->OnLogEvent(acquire_event.get());
-    // The condition is false. Do not start the alarm.
-    EXPECT_EQ(0u, anomalyTracker->getAlarmTimestampSec(dimensionKey));
-    EXPECT_EQ(refractory_period_sec +
-                    (bucketStartTimeNs + bucketSizeNs + NS_PER_SEC) / NS_PER_SEC,
-              anomalyTracker->getRefractoryPeriodEndsSec(dimensionKey));
-
-    // Condition turns true.
-    screen_off_event = CreateScreenStateChangedEvent(
-        android::view::DisplayStateEnum::DISPLAY_STATE_OFF,
-        bucketStartTimeNs + 2 * bucketSizeNs + NS_PER_SEC);
-    processor->OnLogEvent(screen_off_event.get());
-    EXPECT_EQ((bucketStartTimeNs + 2 * bucketSizeNs + NS_PER_SEC + threshold_ns) / NS_PER_SEC,
-              anomalyTracker->getAlarmTimestampSec(dimensionKey));
-
-    // Condition turns to false.
-    screen_on_event = CreateScreenStateChangedEvent(
-        android::view::DisplayStateEnum::DISPLAY_STATE_ON,
-        bucketStartTimeNs + 2 * bucketSizeNs + 2 * NS_PER_SEC + 1);
-    processor->OnLogEvent(screen_on_event.get());
-    // Condition turns to false. Cancelled the alarm.
-    EXPECT_EQ(0u, anomalyTracker->getAlarmTimestampSec(dimensionKey));
-    //  Detected one anomaly.
-    EXPECT_EQ(refractory_period_sec +
-                    (bucketStartTimeNs + 2 * bucketSizeNs + 2 * NS_PER_SEC + 1) / NS_PER_SEC + 1,
-              anomalyTracker->getRefractoryPeriodEndsSec(dimensionKey));
-
-    // Condition turns to true again.
-    screen_off_event = CreateScreenStateChangedEvent(
-        android::view::DisplayStateEnum::DISPLAY_STATE_OFF,
-        bucketStartTimeNs + 2 * bucketSizeNs + 2 * NS_PER_SEC + 2);
-    processor->OnLogEvent(screen_off_event.get());
-    EXPECT_EQ((bucketStartTimeNs + 2 * bucketSizeNs) / NS_PER_SEC + 2 + 2 + 1,
-              anomalyTracker->getAlarmTimestampSec(dimensionKey));
-
-    release_event = CreateReleaseWakelockEvent(
-        attributions2, "wl1", bucketStartTimeNs + 2 * bucketSizeNs + 5 * NS_PER_SEC);
-    processor->OnLogEvent(release_event.get());
-    EXPECT_EQ(refractory_period_sec +
-                    (bucketStartTimeNs + 2 * bucketSizeNs + 5 * NS_PER_SEC) / NS_PER_SEC,
-              anomalyTracker->getRefractoryPeriodEndsSec(dimensionKey));
-    EXPECT_EQ(0u, anomalyTracker->getAlarmTimestampSec(dimensionKey));
-}
-
-TEST(AnomalyDetectionE2eTest, TestDurationMetric_SUM_multiple_buckets) {
-    const int num_buckets = 3;
-    const uint64_t threshold_ns = NS_PER_SEC;
-    auto config = CreateStatsdConfig(num_buckets, threshold_ns, DurationMetric::SUM, true);
-    const uint64_t alert_id = config.alert(0).id();
-    const uint32_t refractory_period_sec = config.alert(0).refractory_period_secs();
-
-    int64_t bucketStartTimeNs = 10 * NS_PER_SEC;
-    int64_t bucketSizeNs =
-        TimeUnitToBucketSizeInMillis(config.duration_metric(0).bucket()) * 1000000;
-
-    ConfigKey cfgKey;
-    auto processor = CreateStatsLogProcessor(bucketStartTimeNs, bucketStartTimeNs, config, cfgKey);
-    EXPECT_EQ(processor->mMetricsManagers.size(), 1u);
-    EXPECT_TRUE(processor->mMetricsManagers.begin()->second->isConfigValid());
-    EXPECT_EQ(1u, processor->mMetricsManagers.begin()->second->mAllAnomalyTrackers.size());
-
-    sp<AnomalyTracker> anomalyTracker =
-        processor->mMetricsManagers.begin()->second->mAllAnomalyTrackers[0];
-
-    auto screen_off_event = CreateScreenStateChangedEvent(
-            android::view::DisplayStateEnum::DISPLAY_STATE_OFF, bucketStartTimeNs + 1);
-    processor->OnLogEvent(screen_off_event.get());
-
-    // Acquire wakelock "wc1" in bucket #0.
-    auto acquire_event = CreateAcquireWakelockEvent(
-        attributions1, "wl1", bucketStartTimeNs + bucketSizeNs -  NS_PER_SEC / 2 - 1);
-    processor->OnLogEvent(acquire_event.get());
-    EXPECT_EQ((bucketStartTimeNs + bucketSizeNs) / NS_PER_SEC + 1,
-              anomalyTracker->getAlarmTimestampSec(dimensionKey));
-    EXPECT_EQ(0u, anomalyTracker->getRefractoryPeriodEndsSec(dimensionKey));
-
-    // Release wakelock "wc1" in bucket #0.
-    auto release_event = CreateReleaseWakelockEvent(
-        attributions1, "wl1", bucketStartTimeNs + bucketSizeNs - 1);
-    processor->OnLogEvent(release_event.get());
-    EXPECT_EQ(0u, anomalyTracker->getAlarmTimestampSec(dimensionKey));
-    EXPECT_EQ(0u, anomalyTracker->getRefractoryPeriodEndsSec(dimensionKey));
-
-    // Acquire wakelock "wc1" in bucket #1.
-    acquire_event = CreateAcquireWakelockEvent(
-        attributions2, "wl1", bucketStartTimeNs + bucketSizeNs + 1);
-    processor->OnLogEvent(acquire_event.get());
-    EXPECT_EQ((bucketStartTimeNs + bucketSizeNs) / NS_PER_SEC + 1,
-              anomalyTracker->getAlarmTimestampSec(dimensionKey));
-    EXPECT_EQ(0u, anomalyTracker->getRefractoryPeriodEndsSec(dimensionKey));
-
-    release_event = CreateReleaseWakelockEvent(
-        attributions2, "wl1", bucketStartTimeNs + bucketSizeNs + 100);
-    processor->OnLogEvent(release_event.get());
-    EXPECT_EQ(0u, anomalyTracker->getAlarmTimestampSec(dimensionKey));
-    EXPECT_EQ(0u, anomalyTracker->getRefractoryPeriodEndsSec(dimensionKey));
-
-    // Acquire wakelock "wc2" in bucket #2.
-    acquire_event = CreateAcquireWakelockEvent(
-        attributions3, "wl2", bucketStartTimeNs + 2 * bucketSizeNs + 1);
-    processor->OnLogEvent(acquire_event.get());
-    EXPECT_EQ((bucketStartTimeNs + 2 *  bucketSizeNs) / NS_PER_SEC + 2,
-              anomalyTracker->getAlarmTimestampSec(dimensionKey2));
-    EXPECT_EQ(0u, anomalyTracker->getRefractoryPeriodEndsSec(dimensionKey2));
-
-    // Release wakelock "wc2" in bucket #2.
-    release_event = CreateReleaseWakelockEvent(
-        attributions3, "wl2", bucketStartTimeNs + 2 * bucketSizeNs + 2 * NS_PER_SEC);
-    processor->OnLogEvent(release_event.get());
-    EXPECT_EQ(0u, anomalyTracker->getAlarmTimestampSec(dimensionKey2));
-    EXPECT_EQ(refractory_period_sec +
-                   (bucketStartTimeNs + 2 * bucketSizeNs + 2 * NS_PER_SEC) / NS_PER_SEC,
-              anomalyTracker->getRefractoryPeriodEndsSec(dimensionKey2));
-
-    // Acquire wakelock "wc1" in bucket #2.
-    acquire_event = CreateAcquireWakelockEvent(
-        attributions2, "wl1", bucketStartTimeNs + 2 * bucketSizeNs + 2 * NS_PER_SEC);
-    processor->OnLogEvent(acquire_event.get());
-    EXPECT_EQ((bucketStartTimeNs + 2 * bucketSizeNs) / NS_PER_SEC + 2 + 1,
-              anomalyTracker->getAlarmTimestampSec(dimensionKey));
-    EXPECT_EQ(0u, anomalyTracker->getRefractoryPeriodEndsSec(dimensionKey));
-
-    // Release wakelock "wc1" in bucket #2.
-    release_event = CreateReleaseWakelockEvent(
-        attributions2, "wl1", bucketStartTimeNs + 2 * bucketSizeNs + 2.5 * NS_PER_SEC);
-    processor->OnLogEvent(release_event.get());
-    EXPECT_EQ(0u, anomalyTracker->getAlarmTimestampSec(dimensionKey));
-    EXPECT_EQ(refractory_period_sec +
-                   (int64_t)(bucketStartTimeNs + 2 * bucketSizeNs + 2.5 * NS_PER_SEC) / NS_PER_SEC + 1,
-              anomalyTracker->getRefractoryPeriodEndsSec(dimensionKey));
-
-    acquire_event = CreateAcquireWakelockEvent(
-        attributions3, "wl2", bucketStartTimeNs + 6 * bucketSizeNs - NS_PER_SEC + 4);
-    processor->OnLogEvent(acquire_event.get());
-    acquire_event = CreateAcquireWakelockEvent(
-        attributions1, "wl1", bucketStartTimeNs + 6 * bucketSizeNs - NS_PER_SEC + 5);
-    processor->OnLogEvent(acquire_event.get());
-    EXPECT_EQ((bucketStartTimeNs + 6 * bucketSizeNs) / NS_PER_SEC + 1,
-              anomalyTracker->getAlarmTimestampSec(dimensionKey));
-    EXPECT_EQ((bucketStartTimeNs + 6 * bucketSizeNs) / NS_PER_SEC + 1,
-              anomalyTracker->getAlarmTimestampSec(dimensionKey2));
-
-    release_event = CreateReleaseWakelockEvent(
-        attributions3, "wl2", bucketStartTimeNs + 6 * bucketSizeNs + 2);
-    processor->OnLogEvent(release_event.get());
-    release_event = CreateReleaseWakelockEvent(
-        attributions1, "wl1", bucketStartTimeNs + 6 * bucketSizeNs + 6);
-    processor->OnLogEvent(release_event.get());
-    EXPECT_EQ(0u, anomalyTracker->getAlarmTimestampSec(dimensionKey));
-    EXPECT_EQ(0u, anomalyTracker->getAlarmTimestampSec(dimensionKey2));
-    // The buckets are not messed up across dimensions. Only one dimension has anomaly triggered.
-    EXPECT_EQ(refractory_period_sec +
-                   (int64_t)(bucketStartTimeNs + 6 * bucketSizeNs) / NS_PER_SEC + 1,
-              anomalyTracker->getRefractoryPeriodEndsSec(dimensionKey));
-}
-
-TEST(AnomalyDetectionE2eTest, TestDurationMetric_SUM_long_refractory_period) {
-    const int num_buckets = 2;
-    const uint64_t threshold_ns = 3 * NS_PER_SEC;
-    auto config = CreateStatsdConfig(num_buckets, threshold_ns, DurationMetric::SUM, false);
-    int64_t bucketStartTimeNs = 10 * NS_PER_SEC;
-    int64_t bucketSizeNs =
-        TimeUnitToBucketSizeInMillis(config.duration_metric(0).bucket()) * 1000000;
-
-    const uint64_t alert_id = config.alert(0).id();
-    const uint32_t refractory_period_sec = 3 * bucketSizeNs / NS_PER_SEC;
-    config.mutable_alert(0)->set_refractory_period_secs(refractory_period_sec);
-
-    ConfigKey cfgKey;
-    auto processor = CreateStatsLogProcessor(bucketStartTimeNs, bucketStartTimeNs, config, cfgKey);
-    EXPECT_EQ(processor->mMetricsManagers.size(), 1u);
-    EXPECT_TRUE(processor->mMetricsManagers.begin()->second->isConfigValid());
-    EXPECT_EQ(1u, processor->mMetricsManagers.begin()->second->mAllAnomalyTrackers.size());
-
-    sp<AnomalyTracker> anomalyTracker =
-        processor->mMetricsManagers.begin()->second->mAllAnomalyTrackers[0];
-
-    auto screen_off_event = CreateScreenStateChangedEvent(
-            android::view::DisplayStateEnum::DISPLAY_STATE_OFF, bucketStartTimeNs + 1);
-    processor->OnLogEvent(screen_off_event.get());
-
-    // Acquire wakelock "wc1" in bucket #0.
-    auto acquire_event = CreateAcquireWakelockEvent(
-        attributions1, "wl1", bucketStartTimeNs + bucketSizeNs - 100);
-    processor->OnLogEvent(acquire_event.get());
-    EXPECT_EQ((bucketStartTimeNs + bucketSizeNs) / NS_PER_SEC + 3,
-              anomalyTracker->getAlarmTimestampSec(dimensionKey));
-    EXPECT_EQ(0u, anomalyTracker->getRefractoryPeriodEndsSec(dimensionKey));
-
-    // Acquire the wakelock "wc1" again.
-    acquire_event = CreateAcquireWakelockEvent(
-        attributions1, "wl1", bucketStartTimeNs + bucketSizeNs + 2 * NS_PER_SEC + 1);
-    processor->OnLogEvent(acquire_event.get());
-    // The alarm does not change.
-    EXPECT_EQ((bucketStartTimeNs + bucketSizeNs) / NS_PER_SEC + 3,
-              anomalyTracker->getAlarmTimestampSec(dimensionKey));
-    EXPECT_EQ(0u, anomalyTracker->getRefractoryPeriodEndsSec(dimensionKey));
-
-    // Anomaly alarm fired late.
-    const int64_t firedAlarmTimestampNs = bucketStartTimeNs + 2 * bucketSizeNs - NS_PER_SEC;
-    auto alarmSet = processor->getAnomalyAlarmMonitor()->popSoonerThan(
-            static_cast<uint32_t>(firedAlarmTimestampNs / NS_PER_SEC));
-    EXPECT_EQ(1u, alarmSet.size());
-    processor->onAnomalyAlarmFired(firedAlarmTimestampNs, alarmSet);
-    EXPECT_EQ(0u, anomalyTracker->getAlarmTimestampSec(dimensionKey));
-    EXPECT_EQ(refractory_period_sec + firedAlarmTimestampNs / NS_PER_SEC,
-              anomalyTracker->getRefractoryPeriodEndsSec(dimensionKey));
-
-    acquire_event = CreateAcquireWakelockEvent(
-        attributions1, "wl1", bucketStartTimeNs + 2 * bucketSizeNs - 100);
-    processor->OnLogEvent(acquire_event.get());
-    EXPECT_EQ(0u, anomalyTracker->getAlarmTimestampSec(dimensionKey));
-    EXPECT_EQ(refractory_period_sec + firedAlarmTimestampNs / NS_PER_SEC,
-              anomalyTracker->getRefractoryPeriodEndsSec(dimensionKey));
-
-    auto release_event = CreateReleaseWakelockEvent(
-        attributions1, "wl1", bucketStartTimeNs + 2 * bucketSizeNs + 1);
-    processor->OnLogEvent(release_event.get());
-    EXPECT_EQ(0u, anomalyTracker->getAlarmTimestampSec(dimensionKey));
-    // Within the refractory period. No anomaly.
-    EXPECT_EQ(refractory_period_sec + firedAlarmTimestampNs / NS_PER_SEC,
-              anomalyTracker->getRefractoryPeriodEndsSec(dimensionKey));
-
-    // A new wakelock, but still within refractory period.
-    acquire_event = CreateAcquireWakelockEvent(
-        attributions1, "wl1", bucketStartTimeNs + 2 * bucketSizeNs + 10 * NS_PER_SEC);
-    processor->OnLogEvent(acquire_event.get());
-    EXPECT_EQ(refractory_period_sec + firedAlarmTimestampNs / NS_PER_SEC,
-              anomalyTracker->getAlarmTimestampSec(dimensionKey));
-
-    release_event = CreateReleaseWakelockEvent(
-        attributions1, "wl1", bucketStartTimeNs + 3 * bucketSizeNs - NS_PER_SEC);
-    // Still in the refractory period. No anomaly.
-    processor->OnLogEvent(release_event.get());
-    EXPECT_EQ(refractory_period_sec + firedAlarmTimestampNs / NS_PER_SEC,
-              anomalyTracker->getRefractoryPeriodEndsSec(dimensionKey));
-
-    acquire_event = CreateAcquireWakelockEvent(
-        attributions1, "wl1", bucketStartTimeNs + 5 * bucketSizeNs - 3 * NS_PER_SEC - 5);
-    processor->OnLogEvent(acquire_event.get());
-    EXPECT_EQ((bucketStartTimeNs + 5 * bucketSizeNs) / NS_PER_SEC,
-              anomalyTracker->getAlarmTimestampSec(dimensionKey));
-
-    release_event = CreateReleaseWakelockEvent(
-        attributions1, "wl1", bucketStartTimeNs + 5 * bucketSizeNs - 3 * NS_PER_SEC - 4);
-    processor->OnLogEvent(release_event.get());
-    EXPECT_EQ(0u, anomalyTracker->getAlarmTimestampSec(dimensionKey));
-
-    acquire_event = CreateAcquireWakelockEvent(
-        attributions1, "wl1", bucketStartTimeNs + 5 * bucketSizeNs - 3 * NS_PER_SEC - 3);
-    processor->OnLogEvent(acquire_event.get());
-    EXPECT_EQ((bucketStartTimeNs + 5 * bucketSizeNs) / NS_PER_SEC,
-              anomalyTracker->getAlarmTimestampSec(dimensionKey));
-}
+// TODO(b/149590301): Update these tests to use new socket schema.
+//TEST(AnomalyDetectionE2eTest, TestDurationMetric_SUM_single_bucket) {
+//    const int num_buckets = 1;
+//    const uint64_t threshold_ns = NS_PER_SEC;
+//    auto config = CreateStatsdConfig(num_buckets, threshold_ns, DurationMetric::SUM, true);
+//    const uint64_t alert_id = config.alert(0).id();
+//    const uint32_t refractory_period_sec = config.alert(0).refractory_period_secs();
+//
+//    int64_t bucketStartTimeNs = 10 * NS_PER_SEC;
+//    int64_t bucketSizeNs =
+//        TimeUnitToBucketSizeInMillis(config.duration_metric(0).bucket()) * 1000000;
+//
+//    ConfigKey cfgKey;
+//    auto processor = CreateStatsLogProcessor(bucketStartTimeNs, bucketStartTimeNs, config, cfgKey);
+//    EXPECT_EQ(processor->mMetricsManagers.size(), 1u);
+//    EXPECT_TRUE(processor->mMetricsManagers.begin()->second->isConfigValid());
+//    EXPECT_EQ(1u, processor->mMetricsManagers.begin()->second->mAllAnomalyTrackers.size());
+//
+//    sp<AnomalyTracker> anomalyTracker =
+//        processor->mMetricsManagers.begin()->second->mAllAnomalyTrackers[0];
+//
+//    auto screen_on_event = CreateScreenStateChangedEvent(
+//            android::view::DisplayStateEnum::DISPLAY_STATE_ON, bucketStartTimeNs + 1);
+//    auto screen_off_event = CreateScreenStateChangedEvent(
+//            android::view::DisplayStateEnum::DISPLAY_STATE_OFF, bucketStartTimeNs + 10);
+//    processor->OnLogEvent(screen_on_event.get());
+//    processor->OnLogEvent(screen_off_event.get());
+//
+//    // Acquire wakelock wl1.
+//    auto acquire_event = CreateAcquireWakelockEvent(attributions1, "wl1", bucketStartTimeNs + 11);
+//    processor->OnLogEvent(acquire_event.get());
+//    EXPECT_EQ((bucketStartTimeNs + 11 + threshold_ns) / NS_PER_SEC + 1,
+//              anomalyTracker->getAlarmTimestampSec(dimensionKey));
+//    EXPECT_EQ(0u, anomalyTracker->getRefractoryPeriodEndsSec(dimensionKey));
+//
+//    // Release wakelock wl1. No anomaly detected. Alarm cancelled at the "release" event.
+//    auto release_event = CreateReleaseWakelockEvent(attributions1, "wl1", bucketStartTimeNs + 101);
+//    processor->OnLogEvent(release_event.get());
+//    EXPECT_EQ(0u, anomalyTracker->getAlarmTimestampSec(dimensionKey));
+//    EXPECT_EQ(0u, anomalyTracker->getRefractoryPeriodEndsSec(dimensionKey));
+//
+//    // Acquire wakelock wl1 within bucket #0.
+//    acquire_event = CreateAcquireWakelockEvent(attributions2, "wl1", bucketStartTimeNs + 110);
+//    processor->OnLogEvent(acquire_event.get());
+//    EXPECT_EQ((bucketStartTimeNs + 110 + threshold_ns - 90) / NS_PER_SEC + 1,
+//              anomalyTracker->getAlarmTimestampSec(dimensionKey));
+//    EXPECT_EQ(0u, anomalyTracker->getRefractoryPeriodEndsSec(dimensionKey));
+//
+//    // Release wakelock wl1. One anomaly detected.
+//    release_event = CreateReleaseWakelockEvent(
+//            attributions2, "wl1", bucketStartTimeNs + NS_PER_SEC + 109);
+//    processor->OnLogEvent(release_event.get());
+//    EXPECT_EQ(0u, anomalyTracker->getAlarmTimestampSec(dimensionKey));
+//    EXPECT_EQ(refractory_period_sec + (bucketStartTimeNs + NS_PER_SEC + 109) / NS_PER_SEC + 1,
+//              anomalyTracker->getRefractoryPeriodEndsSec(dimensionKey));
+//
+//    // Acquire wakelock wl1.
+//    acquire_event = CreateAcquireWakelockEvent(
+//        attributions1, "wl1", bucketStartTimeNs + NS_PER_SEC + 112);
+//    processor->OnLogEvent(acquire_event.get());
+//    // Wakelock has been hold longer than the threshold in bucket #0. The alarm is set at the
+//    // end of the refractory period.
+//    const int64_t alarmFiredTimestampSec0 = anomalyTracker->getAlarmTimestampSec(dimensionKey);
+//    EXPECT_EQ(refractory_period_sec + (bucketStartTimeNs + NS_PER_SEC + 109) / NS_PER_SEC + 1,
+//              (uint32_t)alarmFiredTimestampSec0);
+//
+//    // Anomaly alarm fired.
+//    auto alarmSet = processor->getAnomalyAlarmMonitor()->popSoonerThan(
+//            static_cast<uint32_t>(alarmFiredTimestampSec0));
+//    EXPECT_EQ(1u, alarmSet.size());
+//    processor->onAnomalyAlarmFired(alarmFiredTimestampSec0 * NS_PER_SEC, alarmSet);
+//    EXPECT_EQ(0u, anomalyTracker->getAlarmTimestampSec(dimensionKey));
+//    EXPECT_EQ(refractory_period_sec + alarmFiredTimestampSec0,
+//              anomalyTracker->getRefractoryPeriodEndsSec(dimensionKey));
+//
+//    // Release wakelock wl1.
+//    release_event = CreateReleaseWakelockEvent(
+//            attributions1, "wl1", alarmFiredTimestampSec0 * NS_PER_SEC + NS_PER_SEC + 1);
+//    processor->OnLogEvent(release_event.get());
+//    EXPECT_EQ(0u, anomalyTracker->getAlarmTimestampSec(dimensionKey));
+//    // Within refractory period. No more anomaly detected.
+//    EXPECT_EQ(refractory_period_sec + alarmFiredTimestampSec0,
+//              anomalyTracker->getRefractoryPeriodEndsSec(dimensionKey));
+//
+//    // Acquire wakelock wl1.
+//    acquire_event = CreateAcquireWakelockEvent(
+//        attributions2, "wl1", bucketStartTimeNs + bucketSizeNs -  5 * NS_PER_SEC - 11);
+//    processor->OnLogEvent(acquire_event.get());
+//    const int64_t alarmFiredTimestampSec1 = anomalyTracker->getAlarmTimestampSec(dimensionKey);
+//    EXPECT_EQ((bucketStartTimeNs + bucketSizeNs - 5 * NS_PER_SEC) / NS_PER_SEC,
+//              (uint64_t)alarmFiredTimestampSec1);
+//
+//    // Release wakelock wl1.
+//    release_event = CreateReleaseWakelockEvent(
+//        attributions2, "wl1", bucketStartTimeNs + bucketSizeNs - 4 * NS_PER_SEC - 10);
+//    processor->OnLogEvent(release_event.get());
+//    EXPECT_EQ(0u, anomalyTracker->getAlarmTimestampSec(dimensionKey));
+//    EXPECT_EQ(refractory_period_sec +
+//                    (bucketStartTimeNs + bucketSizeNs - 4 * NS_PER_SEC - 10) / NS_PER_SEC + 1,
+//              anomalyTracker->getRefractoryPeriodEndsSec(dimensionKey));
+//
+//    alarmSet = processor->getAnomalyAlarmMonitor()->popSoonerThan(
+//                static_cast<uint32_t>(alarmFiredTimestampSec1));
+//    EXPECT_EQ(0u, alarmSet.size());
+//
+//    // Acquire wakelock wl1 near the end of bucket #0.
+//    acquire_event = CreateAcquireWakelockEvent(
+//            attributions1, "wl1", bucketStartTimeNs + bucketSizeNs - 2);
+//    processor->OnLogEvent(acquire_event.get());
+//    EXPECT_EQ((bucketStartTimeNs + bucketSizeNs) / NS_PER_SEC,
+//               anomalyTracker->getAlarmTimestampSec(dimensionKey));
+//
+//    // Release the event at early bucket #1.
+//    release_event = CreateReleaseWakelockEvent(
+//            attributions1, "wl1", bucketStartTimeNs + bucketSizeNs + NS_PER_SEC - 1);
+//    processor->OnLogEvent(release_event.get());
+//    EXPECT_EQ(0u, anomalyTracker->getAlarmTimestampSec(dimensionKey));
+//    // Anomaly detected when stopping the alarm. The refractory period does not change.
+//    EXPECT_EQ(refractory_period_sec +
+//                    (bucketStartTimeNs + bucketSizeNs + NS_PER_SEC) / NS_PER_SEC,
+//              anomalyTracker->getRefractoryPeriodEndsSec(dimensionKey));
+//
+//    // Condition changes to false.
+//    screen_on_event = CreateScreenStateChangedEvent(
+//        android::view::DisplayStateEnum::DISPLAY_STATE_ON,
+//        bucketStartTimeNs + 2 * bucketSizeNs + 20);
+//    processor->OnLogEvent(screen_on_event.get());
+//    EXPECT_EQ(refractory_period_sec +
+//                    (bucketStartTimeNs + bucketSizeNs + NS_PER_SEC) / NS_PER_SEC,
+//              anomalyTracker->getRefractoryPeriodEndsSec(dimensionKey));
+//    EXPECT_EQ(0u, anomalyTracker->getAlarmTimestampSec(dimensionKey));
+//
+//    acquire_event = CreateAcquireWakelockEvent(
+//        attributions2, "wl1", bucketStartTimeNs + 2 * bucketSizeNs + 30);
+//    processor->OnLogEvent(acquire_event.get());
+//    // The condition is false. Do not start the alarm.
+//    EXPECT_EQ(0u, anomalyTracker->getAlarmTimestampSec(dimensionKey));
+//    EXPECT_EQ(refractory_period_sec +
+//                    (bucketStartTimeNs + bucketSizeNs + NS_PER_SEC) / NS_PER_SEC,
+//              anomalyTracker->getRefractoryPeriodEndsSec(dimensionKey));
+//
+//    // Condition turns true.
+//    screen_off_event = CreateScreenStateChangedEvent(
+//        android::view::DisplayStateEnum::DISPLAY_STATE_OFF,
+//        bucketStartTimeNs + 2 * bucketSizeNs + NS_PER_SEC);
+//    processor->OnLogEvent(screen_off_event.get());
+//    EXPECT_EQ((bucketStartTimeNs + 2 * bucketSizeNs + NS_PER_SEC + threshold_ns) / NS_PER_SEC,
+//              anomalyTracker->getAlarmTimestampSec(dimensionKey));
+//
+//    // Condition turns to false.
+//    screen_on_event = CreateScreenStateChangedEvent(
+//        android::view::DisplayStateEnum::DISPLAY_STATE_ON,
+//        bucketStartTimeNs + 2 * bucketSizeNs + 2 * NS_PER_SEC + 1);
+//    processor->OnLogEvent(screen_on_event.get());
+//    // Condition turns to false. Cancelled the alarm.
+//    EXPECT_EQ(0u, anomalyTracker->getAlarmTimestampSec(dimensionKey));
+//    //  Detected one anomaly.
+//    EXPECT_EQ(refractory_period_sec +
+//                    (bucketStartTimeNs + 2 * bucketSizeNs + 2 * NS_PER_SEC + 1) / NS_PER_SEC + 1,
+//              anomalyTracker->getRefractoryPeriodEndsSec(dimensionKey));
+//
+//    // Condition turns to true again.
+//    screen_off_event = CreateScreenStateChangedEvent(
+//        android::view::DisplayStateEnum::DISPLAY_STATE_OFF,
+//        bucketStartTimeNs + 2 * bucketSizeNs + 2 * NS_PER_SEC + 2);
+//    processor->OnLogEvent(screen_off_event.get());
+//    EXPECT_EQ((bucketStartTimeNs + 2 * bucketSizeNs) / NS_PER_SEC + 2 + 2 + 1,
+//              anomalyTracker->getAlarmTimestampSec(dimensionKey));
+//
+//    release_event = CreateReleaseWakelockEvent(
+//        attributions2, "wl1", bucketStartTimeNs + 2 * bucketSizeNs + 5 * NS_PER_SEC);
+//    processor->OnLogEvent(release_event.get());
+//    EXPECT_EQ(refractory_period_sec +
+//                    (bucketStartTimeNs + 2 * bucketSizeNs + 5 * NS_PER_SEC) / NS_PER_SEC,
+//              anomalyTracker->getRefractoryPeriodEndsSec(dimensionKey));
+//    EXPECT_EQ(0u, anomalyTracker->getAlarmTimestampSec(dimensionKey));
+//}
+//
+//TEST(AnomalyDetectionE2eTest, TestDurationMetric_SUM_multiple_buckets) {
+//    const int num_buckets = 3;
+//    const uint64_t threshold_ns = NS_PER_SEC;
+//    auto config = CreateStatsdConfig(num_buckets, threshold_ns, DurationMetric::SUM, true);
+//    const uint64_t alert_id = config.alert(0).id();
+//    const uint32_t refractory_period_sec = config.alert(0).refractory_period_secs();
+//
+//    int64_t bucketStartTimeNs = 10 * NS_PER_SEC;
+//    int64_t bucketSizeNs =
+//        TimeUnitToBucketSizeInMillis(config.duration_metric(0).bucket()) * 1000000;
+//
+//    ConfigKey cfgKey;
+//    auto processor = CreateStatsLogProcessor(bucketStartTimeNs, bucketStartTimeNs, config, cfgKey);
+//    EXPECT_EQ(processor->mMetricsManagers.size(), 1u);
+//    EXPECT_TRUE(processor->mMetricsManagers.begin()->second->isConfigValid());
+//    EXPECT_EQ(1u, processor->mMetricsManagers.begin()->second->mAllAnomalyTrackers.size());
+//
+//    sp<AnomalyTracker> anomalyTracker =
+//        processor->mMetricsManagers.begin()->second->mAllAnomalyTrackers[0];
+//
+//    auto screen_off_event = CreateScreenStateChangedEvent(
+//            android::view::DisplayStateEnum::DISPLAY_STATE_OFF, bucketStartTimeNs + 1);
+//    processor->OnLogEvent(screen_off_event.get());
+//
+//    // Acquire wakelock "wc1" in bucket #0.
+//    auto acquire_event = CreateAcquireWakelockEvent(
+//        attributions1, "wl1", bucketStartTimeNs + bucketSizeNs -  NS_PER_SEC / 2 - 1);
+//    processor->OnLogEvent(acquire_event.get());
+//    EXPECT_EQ((bucketStartTimeNs + bucketSizeNs) / NS_PER_SEC + 1,
+//              anomalyTracker->getAlarmTimestampSec(dimensionKey));
+//    EXPECT_EQ(0u, anomalyTracker->getRefractoryPeriodEndsSec(dimensionKey));
+//
+//    // Release wakelock "wc1" in bucket #0.
+//    auto release_event = CreateReleaseWakelockEvent(
+//        attributions1, "wl1", bucketStartTimeNs + bucketSizeNs - 1);
+//    processor->OnLogEvent(release_event.get());
+//    EXPECT_EQ(0u, anomalyTracker->getAlarmTimestampSec(dimensionKey));
+//    EXPECT_EQ(0u, anomalyTracker->getRefractoryPeriodEndsSec(dimensionKey));
+//
+//    // Acquire wakelock "wc1" in bucket #1.
+//    acquire_event = CreateAcquireWakelockEvent(
+//        attributions2, "wl1", bucketStartTimeNs + bucketSizeNs + 1);
+//    processor->OnLogEvent(acquire_event.get());
+//    EXPECT_EQ((bucketStartTimeNs + bucketSizeNs) / NS_PER_SEC + 1,
+//              anomalyTracker->getAlarmTimestampSec(dimensionKey));
+//    EXPECT_EQ(0u, anomalyTracker->getRefractoryPeriodEndsSec(dimensionKey));
+//
+//    release_event = CreateReleaseWakelockEvent(
+//        attributions2, "wl1", bucketStartTimeNs + bucketSizeNs + 100);
+//    processor->OnLogEvent(release_event.get());
+//    EXPECT_EQ(0u, anomalyTracker->getAlarmTimestampSec(dimensionKey));
+//    EXPECT_EQ(0u, anomalyTracker->getRefractoryPeriodEndsSec(dimensionKey));
+//
+//    // Acquire wakelock "wc2" in bucket #2.
+//    acquire_event = CreateAcquireWakelockEvent(
+//        attributions3, "wl2", bucketStartTimeNs + 2 * bucketSizeNs + 1);
+//    processor->OnLogEvent(acquire_event.get());
+//    EXPECT_EQ((bucketStartTimeNs + 2 *  bucketSizeNs) / NS_PER_SEC + 2,
+//              anomalyTracker->getAlarmTimestampSec(dimensionKey2));
+//    EXPECT_EQ(0u, anomalyTracker->getRefractoryPeriodEndsSec(dimensionKey2));
+//
+//    // Release wakelock "wc2" in bucket #2.
+//    release_event = CreateReleaseWakelockEvent(
+//        attributions3, "wl2", bucketStartTimeNs + 2 * bucketSizeNs + 2 * NS_PER_SEC);
+//    processor->OnLogEvent(release_event.get());
+//    EXPECT_EQ(0u, anomalyTracker->getAlarmTimestampSec(dimensionKey2));
+//    EXPECT_EQ(refractory_period_sec +
+//                   (bucketStartTimeNs + 2 * bucketSizeNs + 2 * NS_PER_SEC) / NS_PER_SEC,
+//              anomalyTracker->getRefractoryPeriodEndsSec(dimensionKey2));
+//
+//    // Acquire wakelock "wc1" in bucket #2.
+//    acquire_event = CreateAcquireWakelockEvent(
+//        attributions2, "wl1", bucketStartTimeNs + 2 * bucketSizeNs + 2 * NS_PER_SEC);
+//    processor->OnLogEvent(acquire_event.get());
+//    EXPECT_EQ((bucketStartTimeNs + 2 * bucketSizeNs) / NS_PER_SEC + 2 + 1,
+//              anomalyTracker->getAlarmTimestampSec(dimensionKey));
+//    EXPECT_EQ(0u, anomalyTracker->getRefractoryPeriodEndsSec(dimensionKey));
+//
+//    // Release wakelock "wc1" in bucket #2.
+//    release_event = CreateReleaseWakelockEvent(
+//        attributions2, "wl1", bucketStartTimeNs + 2 * bucketSizeNs + 2.5 * NS_PER_SEC);
+//    processor->OnLogEvent(release_event.get());
+//    EXPECT_EQ(0u, anomalyTracker->getAlarmTimestampSec(dimensionKey));
+//    EXPECT_EQ(refractory_period_sec +
+//                   (int64_t)(bucketStartTimeNs + 2 * bucketSizeNs + 2.5 * NS_PER_SEC) / NS_PER_SEC + 1,
+//              anomalyTracker->getRefractoryPeriodEndsSec(dimensionKey));
+//
+//    acquire_event = CreateAcquireWakelockEvent(
+//        attributions3, "wl2", bucketStartTimeNs + 6 * bucketSizeNs - NS_PER_SEC + 4);
+//    processor->OnLogEvent(acquire_event.get());
+//    acquire_event = CreateAcquireWakelockEvent(
+//        attributions1, "wl1", bucketStartTimeNs + 6 * bucketSizeNs - NS_PER_SEC + 5);
+//    processor->OnLogEvent(acquire_event.get());
+//    EXPECT_EQ((bucketStartTimeNs + 6 * bucketSizeNs) / NS_PER_SEC + 1,
+//              anomalyTracker->getAlarmTimestampSec(dimensionKey));
+//    EXPECT_EQ((bucketStartTimeNs + 6 * bucketSizeNs) / NS_PER_SEC + 1,
+//              anomalyTracker->getAlarmTimestampSec(dimensionKey2));
+//
+//    release_event = CreateReleaseWakelockEvent(
+//        attributions3, "wl2", bucketStartTimeNs + 6 * bucketSizeNs + 2);
+//    processor->OnLogEvent(release_event.get());
+//    release_event = CreateReleaseWakelockEvent(
+//        attributions1, "wl1", bucketStartTimeNs + 6 * bucketSizeNs + 6);
+//    processor->OnLogEvent(release_event.get());
+//    EXPECT_EQ(0u, anomalyTracker->getAlarmTimestampSec(dimensionKey));
+//    EXPECT_EQ(0u, anomalyTracker->getAlarmTimestampSec(dimensionKey2));
+//    // The buckets are not messed up across dimensions. Only one dimension has anomaly triggered.
+//    EXPECT_EQ(refractory_period_sec +
+//                   (int64_t)(bucketStartTimeNs + 6 * bucketSizeNs) / NS_PER_SEC + 1,
+//              anomalyTracker->getRefractoryPeriodEndsSec(dimensionKey));
+//}
+//
+//TEST(AnomalyDetectionE2eTest, TestDurationMetric_SUM_long_refractory_period) {
+//    const int num_buckets = 2;
+//    const uint64_t threshold_ns = 3 * NS_PER_SEC;
+//    auto config = CreateStatsdConfig(num_buckets, threshold_ns, DurationMetric::SUM, false);
+//    int64_t bucketStartTimeNs = 10 * NS_PER_SEC;
+//    int64_t bucketSizeNs =
+//        TimeUnitToBucketSizeInMillis(config.duration_metric(0).bucket()) * 1000000;
+//
+//    const uint64_t alert_id = config.alert(0).id();
+//    const uint32_t refractory_period_sec = 3 * bucketSizeNs / NS_PER_SEC;
+//    config.mutable_alert(0)->set_refractory_period_secs(refractory_period_sec);
+//
+//    ConfigKey cfgKey;
+//    auto processor = CreateStatsLogProcessor(bucketStartTimeNs, bucketStartTimeNs, config, cfgKey);
+//    EXPECT_EQ(processor->mMetricsManagers.size(), 1u);
+//    EXPECT_TRUE(processor->mMetricsManagers.begin()->second->isConfigValid());
+//    EXPECT_EQ(1u, processor->mMetricsManagers.begin()->second->mAllAnomalyTrackers.size());
+//
+//    sp<AnomalyTracker> anomalyTracker =
+//        processor->mMetricsManagers.begin()->second->mAllAnomalyTrackers[0];
+//
+//    auto screen_off_event = CreateScreenStateChangedEvent(
+//            android::view::DisplayStateEnum::DISPLAY_STATE_OFF, bucketStartTimeNs + 1);
+//    processor->OnLogEvent(screen_off_event.get());
+//
+//    // Acquire wakelock "wc1" in bucket #0.
+//    auto acquire_event = CreateAcquireWakelockEvent(
+//        attributions1, "wl1", bucketStartTimeNs + bucketSizeNs - 100);
+//    processor->OnLogEvent(acquire_event.get());
+//    EXPECT_EQ((bucketStartTimeNs + bucketSizeNs) / NS_PER_SEC + 3,
+//              anomalyTracker->getAlarmTimestampSec(dimensionKey));
+//    EXPECT_EQ(0u, anomalyTracker->getRefractoryPeriodEndsSec(dimensionKey));
+//
+//    // Acquire the wakelock "wc1" again.
+//    acquire_event = CreateAcquireWakelockEvent(
+//        attributions1, "wl1", bucketStartTimeNs + bucketSizeNs + 2 * NS_PER_SEC + 1);
+//    processor->OnLogEvent(acquire_event.get());
+//    // The alarm does not change.
+//    EXPECT_EQ((bucketStartTimeNs + bucketSizeNs) / NS_PER_SEC + 3,
+//              anomalyTracker->getAlarmTimestampSec(dimensionKey));
+//    EXPECT_EQ(0u, anomalyTracker->getRefractoryPeriodEndsSec(dimensionKey));
+//
+//    // Anomaly alarm fired late.
+//    const int64_t firedAlarmTimestampNs = bucketStartTimeNs + 2 * bucketSizeNs - NS_PER_SEC;
+//    auto alarmSet = processor->getAnomalyAlarmMonitor()->popSoonerThan(
+//            static_cast<uint32_t>(firedAlarmTimestampNs / NS_PER_SEC));
+//    EXPECT_EQ(1u, alarmSet.size());
+//    processor->onAnomalyAlarmFired(firedAlarmTimestampNs, alarmSet);
+//    EXPECT_EQ(0u, anomalyTracker->getAlarmTimestampSec(dimensionKey));
+//    EXPECT_EQ(refractory_period_sec + firedAlarmTimestampNs / NS_PER_SEC,
+//              anomalyTracker->getRefractoryPeriodEndsSec(dimensionKey));
+//
+//    acquire_event = CreateAcquireWakelockEvent(
+//        attributions1, "wl1", bucketStartTimeNs + 2 * bucketSizeNs - 100);
+//    processor->OnLogEvent(acquire_event.get());
+//    EXPECT_EQ(0u, anomalyTracker->getAlarmTimestampSec(dimensionKey));
+//    EXPECT_EQ(refractory_period_sec + firedAlarmTimestampNs / NS_PER_SEC,
+//              anomalyTracker->getRefractoryPeriodEndsSec(dimensionKey));
+//
+//    auto release_event = CreateReleaseWakelockEvent(
+//        attributions1, "wl1", bucketStartTimeNs + 2 * bucketSizeNs + 1);
+//    processor->OnLogEvent(release_event.get());
+//    EXPECT_EQ(0u, anomalyTracker->getAlarmTimestampSec(dimensionKey));
+//    // Within the refractory period. No anomaly.
+//    EXPECT_EQ(refractory_period_sec + firedAlarmTimestampNs / NS_PER_SEC,
+//              anomalyTracker->getRefractoryPeriodEndsSec(dimensionKey));
+//
+//    // A new wakelock, but still within refractory period.
+//    acquire_event = CreateAcquireWakelockEvent(
+//        attributions1, "wl1", bucketStartTimeNs + 2 * bucketSizeNs + 10 * NS_PER_SEC);
+//    processor->OnLogEvent(acquire_event.get());
+//    EXPECT_EQ(refractory_period_sec + firedAlarmTimestampNs / NS_PER_SEC,
+//              anomalyTracker->getAlarmTimestampSec(dimensionKey));
+//
+//    release_event = CreateReleaseWakelockEvent(
+//        attributions1, "wl1", bucketStartTimeNs + 3 * bucketSizeNs - NS_PER_SEC);
+//    // Still in the refractory period. No anomaly.
+//    processor->OnLogEvent(release_event.get());
+//    EXPECT_EQ(refractory_period_sec + firedAlarmTimestampNs / NS_PER_SEC,
+//              anomalyTracker->getRefractoryPeriodEndsSec(dimensionKey));
+//
+//    acquire_event = CreateAcquireWakelockEvent(
+//        attributions1, "wl1", bucketStartTimeNs + 5 * bucketSizeNs - 3 * NS_PER_SEC - 5);
+//    processor->OnLogEvent(acquire_event.get());
+//    EXPECT_EQ((bucketStartTimeNs + 5 * bucketSizeNs) / NS_PER_SEC,
+//              anomalyTracker->getAlarmTimestampSec(dimensionKey));
+//
+//    release_event = CreateReleaseWakelockEvent(
+//        attributions1, "wl1", bucketStartTimeNs + 5 * bucketSizeNs - 3 * NS_PER_SEC - 4);
+//    processor->OnLogEvent(release_event.get());
+//    EXPECT_EQ(0u, anomalyTracker->getAlarmTimestampSec(dimensionKey));
+//
+//    acquire_event = CreateAcquireWakelockEvent(
+//        attributions1, "wl1", bucketStartTimeNs + 5 * bucketSizeNs - 3 * NS_PER_SEC - 3);
+//    processor->OnLogEvent(acquire_event.get());
+//    EXPECT_EQ((bucketStartTimeNs + 5 * bucketSizeNs) / NS_PER_SEC,
+//              anomalyTracker->getAlarmTimestampSec(dimensionKey));
+//}
 
 #else
 GTEST_LOG_(INFO) << "This test does nothing.\n";
diff --git a/cmds/statsd/tests/e2e/Attribution_e2e_test.cpp b/cmds/statsd/tests/e2e/Attribution_e2e_test.cpp
index 3382525..6051174 100644
--- a/cmds/statsd/tests/e2e/Attribution_e2e_test.cpp
+++ b/cmds/statsd/tests/e2e/Attribution_e2e_test.cpp
@@ -55,364 +55,365 @@
 
 }  // namespace
 
-TEST(AttributionE2eTest, TestAttributionMatchAndSliceByFirstUid) {
-    auto config = CreateStatsdConfig(Position::FIRST);
-    int64_t bucketStartTimeNs = 10000000000;
-    int64_t bucketSizeNs =
-        TimeUnitToBucketSizeInMillis(config.count_metric(0).bucket()) * 1000000;
-
-    ConfigKey cfgKey;
-    auto processor = CreateStatsLogProcessor(bucketStartTimeNs, bucketStartTimeNs, config, cfgKey);
-    EXPECT_EQ(processor->mMetricsManagers.size(), 1u);
-    EXPECT_TRUE(processor->mMetricsManagers.begin()->second->isConfigValid());
-
-    // Here it assumes that GMS core has two uids.
-    processor->getUidMap()->updateMap(
-            1, {222, 444, 111, 333}, {1, 1, 2, 2},
-            {String16("v1"), String16("v1"), String16("v2"), String16("v2")},
-            {String16("com.android.gmscore"), String16("com.android.gmscore"), String16("app1"),
-             String16("APP3")},
-            {String16(""), String16(""), String16(""), String16("")});
-
-    // GMS core node is in the middle.
-    std::vector<AttributionNodeInternal> attributions1 = {CreateAttribution(111, "App1"),
-                                                          CreateAttribution(222, "GMSCoreModule1"),
-                                                          CreateAttribution(333, "App3")};
-
-    // GMS core node is the last one.
-    std::vector<AttributionNodeInternal> attributions2 = {CreateAttribution(111, "App1"),
-                                                          CreateAttribution(333, "App3"),
-                                                          CreateAttribution(222, "GMSCoreModule1")};
-
-    // GMS core node is the first one.
-    std::vector<AttributionNodeInternal> attributions3 = {CreateAttribution(222, "GMSCoreModule1"),
-                                                          CreateAttribution(333, "App3")};
-
-    // Single GMS core node.
-    std::vector<AttributionNodeInternal> attributions4 = {CreateAttribution(222, "GMSCoreModule1")};
-
-    // GMS core has another uid.
-    std::vector<AttributionNodeInternal> attributions5 = {CreateAttribution(111, "App1"),
-                                                          CreateAttribution(444, "GMSCoreModule2"),
-                                                          CreateAttribution(333, "App3")};
-
-    // Multiple GMS core nodes.
-    std::vector<AttributionNodeInternal> attributions6 = {CreateAttribution(444, "GMSCoreModule2"),
-                                                          CreateAttribution(222, "GMSCoreModule1")};
-
-    // No GMS core nodes.
-    std::vector<AttributionNodeInternal> attributions7 = {CreateAttribution(111, "App1"),
-                                                          CreateAttribution(333, "App3")};
-    std::vector<AttributionNodeInternal> attributions8 = {CreateAttribution(111, "App1")};
-
-    // GMS core node with isolated uid.
-    const int isolatedUid = 666;
-    std::vector<AttributionNodeInternal> attributions9 = {
-            CreateAttribution(isolatedUid, "GMSCoreModule3")};
-
-    std::vector<std::unique_ptr<LogEvent>> events;
-    // Events 1~4 are in the 1st bucket.
-    events.push_back(CreateAcquireWakelockEvent(
-        attributions1, "wl1", bucketStartTimeNs + 2));
-    events.push_back(CreateAcquireWakelockEvent(
-        attributions2, "wl1", bucketStartTimeNs + 200));
-    events.push_back(CreateAcquireWakelockEvent(
-        attributions3, "wl1", bucketStartTimeNs + bucketSizeNs - 1));
-    events.push_back(CreateAcquireWakelockEvent(
-        attributions4, "wl1", bucketStartTimeNs + bucketSizeNs));
-
-    // Events 5~8 are in the 3rd bucket.
-    events.push_back(CreateAcquireWakelockEvent(
-        attributions5, "wl2", bucketStartTimeNs + 2 * bucketSizeNs + 1));
-    events.push_back(CreateAcquireWakelockEvent(
-        attributions6, "wl2", bucketStartTimeNs + 2 * bucketSizeNs + 100));
-    events.push_back(CreateAcquireWakelockEvent(
-        attributions7, "wl2", bucketStartTimeNs + 3 * bucketSizeNs - 2));
-    events.push_back(CreateAcquireWakelockEvent(
-        attributions8, "wl2", bucketStartTimeNs + 3 * bucketSizeNs));
-    events.push_back(CreateAcquireWakelockEvent(
-        attributions9, "wl2", bucketStartTimeNs + 3 * bucketSizeNs + 1));
-    events.push_back(CreateAcquireWakelockEvent(
-        attributions9, "wl2", bucketStartTimeNs + 3 * bucketSizeNs + 100));
-    events.push_back(CreateIsolatedUidChangedEvent(
-        isolatedUid, 222, true/* is_create*/, bucketStartTimeNs + 3 * bucketSizeNs - 1));
-    events.push_back(CreateIsolatedUidChangedEvent(
-        isolatedUid, 222, false/* is_create*/, bucketStartTimeNs + 3 * bucketSizeNs + 10));
-
-    sortLogEventsByTimestamp(&events);
-
-    for (const auto& event : events) {
-        processor->OnLogEvent(event.get());
-    }
-    ConfigMetricsReportList reports;
-    vector<uint8_t> buffer;
-    processor->onDumpReport(cfgKey, bucketStartTimeNs + 4 * bucketSizeNs + 1, false, true,
-                            ADB_DUMP, FAST, &buffer);
-    EXPECT_TRUE(buffer.size() > 0);
-    EXPECT_TRUE(reports.ParseFromArray(&buffer[0], buffer.size()));
-    backfillDimensionPath(&reports);
-    backfillStringInReport(&reports);
-    backfillStartEndTimestamp(&reports);
-    EXPECT_EQ(reports.reports_size(), 1);
-    EXPECT_EQ(reports.reports(0).metrics_size(), 1);
-
-    StatsLogReport::CountMetricDataWrapper countMetrics;
-    sortMetricDataByDimensionsValue(reports.reports(0).metrics(0).count_metrics(), &countMetrics);
-    EXPECT_EQ(countMetrics.data_size(), 4);
-
-    auto data = countMetrics.data(0);
-    ValidateAttributionUidAndTagDimension(
-        data.dimensions_in_what(), android::util::WAKELOCK_STATE_CHANGED, 111,
-            "App1");
-    EXPECT_EQ(data.bucket_info_size(), 2);
-    EXPECT_EQ(data.bucket_info(0).count(), 2);
-    EXPECT_EQ(data.bucket_info(0).start_bucket_elapsed_nanos(), bucketStartTimeNs);
-    EXPECT_EQ(data.bucket_info(0).end_bucket_elapsed_nanos(), bucketStartTimeNs + bucketSizeNs);
-    EXPECT_EQ(data.bucket_info(1).count(), 1);
-    EXPECT_EQ(data.bucket_info(1).start_bucket_elapsed_nanos(), bucketStartTimeNs + 2 * bucketSizeNs);
-    EXPECT_EQ(data.bucket_info(1).end_bucket_elapsed_nanos(), bucketStartTimeNs + 3 * bucketSizeNs);
-
-    data = countMetrics.data(1);
-    ValidateAttributionUidAndTagDimension(
-        data.dimensions_in_what(), android::util::WAKELOCK_STATE_CHANGED, 222,
-            "GMSCoreModule1");
-    EXPECT_EQ(data.bucket_info_size(), 2);
-    EXPECT_EQ(data.bucket_info(0).count(), 1);
-    EXPECT_EQ(data.bucket_info(0).start_bucket_elapsed_nanos(), bucketStartTimeNs);
-    EXPECT_EQ(data.bucket_info(0).end_bucket_elapsed_nanos(), bucketStartTimeNs + bucketSizeNs);
-    EXPECT_EQ(data.bucket_info(1).count(), 1);
-    EXPECT_EQ(data.bucket_info(1).start_bucket_elapsed_nanos(), bucketStartTimeNs + bucketSizeNs);
-    EXPECT_EQ(data.bucket_info(1).end_bucket_elapsed_nanos(), bucketStartTimeNs + 2 * bucketSizeNs);
-
-    data = countMetrics.data(2);
-    ValidateAttributionUidAndTagDimension(
-        data.dimensions_in_what(), android::util::WAKELOCK_STATE_CHANGED, 222,
-            "GMSCoreModule3");
-    EXPECT_EQ(data.bucket_info_size(), 1);
-    EXPECT_EQ(data.bucket_info(0).count(), 1);
-    EXPECT_EQ(data.bucket_info(0).start_bucket_elapsed_nanos(), bucketStartTimeNs + 3 * bucketSizeNs);
-    EXPECT_EQ(data.bucket_info(0).end_bucket_elapsed_nanos(), bucketStartTimeNs + 4 * bucketSizeNs);
-
-    data = countMetrics.data(3);
-    ValidateAttributionUidAndTagDimension(
-        data.dimensions_in_what(), android::util::WAKELOCK_STATE_CHANGED, 444,
-            "GMSCoreModule2");
-    EXPECT_EQ(data.bucket_info_size(), 1);
-    EXPECT_EQ(data.bucket_info(0).count(), 1);
-    EXPECT_EQ(data.bucket_info(0).start_bucket_elapsed_nanos(), bucketStartTimeNs + 2 * bucketSizeNs);
-    EXPECT_EQ(data.bucket_info(0).end_bucket_elapsed_nanos(), bucketStartTimeNs + 3 * bucketSizeNs);
-}
-
-TEST(AttributionE2eTest, TestAttributionMatchAndSliceByChain) {
-    auto config = CreateStatsdConfig(Position::ALL);
-    int64_t bucketStartTimeNs = 10000000000;
-    int64_t bucketSizeNs =
-        TimeUnitToBucketSizeInMillis(config.count_metric(0).bucket()) * 1000000;
-
-    ConfigKey cfgKey;
-    auto processor = CreateStatsLogProcessor(bucketStartTimeNs, bucketStartTimeNs, config, cfgKey);
-    EXPECT_EQ(processor->mMetricsManagers.size(), 1u);
-    EXPECT_TRUE(processor->mMetricsManagers.begin()->second->isConfigValid());
-
-    // Here it assumes that GMS core has two uids.
-    processor->getUidMap()->updateMap(
-            1, {222, 444, 111, 333}, {1, 1, 2, 2},
-            {String16("v1"), String16("v1"), String16("v2"), String16("v2")},
-            {String16("com.android.gmscore"), String16("com.android.gmscore"), String16("app1"),
-             String16("APP3")},
-            {String16(""), String16(""), String16(""), String16("")});
-
-    // GMS core node is in the middle.
-    std::vector<AttributionNodeInternal> attributions1 = {CreateAttribution(111, "App1"),
-                                                          CreateAttribution(222, "GMSCoreModule1"),
-                                                          CreateAttribution(333, "App3")};
-
-    // GMS core node is the last one.
-    std::vector<AttributionNodeInternal> attributions2 = {CreateAttribution(111, "App1"),
-                                                          CreateAttribution(333, "App3"),
-                                                          CreateAttribution(222, "GMSCoreModule1")};
-
-    // GMS core node is the first one.
-    std::vector<AttributionNodeInternal> attributions3 = {CreateAttribution(222, "GMSCoreModule1"),
-                                                          CreateAttribution(333, "App3")};
-
-    // Single GMS core node.
-    std::vector<AttributionNodeInternal> attributions4 = {CreateAttribution(222, "GMSCoreModule1")};
-
-    // GMS core has another uid.
-    std::vector<AttributionNodeInternal> attributions5 = {CreateAttribution(111, "App1"),
-                                                          CreateAttribution(444, "GMSCoreModule2"),
-                                                          CreateAttribution(333, "App3")};
-
-    // Multiple GMS core nodes.
-    std::vector<AttributionNodeInternal> attributions6 = {CreateAttribution(444, "GMSCoreModule2"),
-                                                          CreateAttribution(222, "GMSCoreModule1")};
-
-    // No GMS core nodes.
-    std::vector<AttributionNodeInternal> attributions7 = {CreateAttribution(111, "App1"),
-                                                          CreateAttribution(333, "App3")};
-    std::vector<AttributionNodeInternal> attributions8 = {CreateAttribution(111, "App1")};
-
-    // GMS core node with isolated uid.
-    const int isolatedUid = 666;
-    std::vector<AttributionNodeInternal> attributions9 = {
-            CreateAttribution(isolatedUid, "GMSCoreModule1")};
-
-    std::vector<std::unique_ptr<LogEvent>> events;
-    // Events 1~4 are in the 1st bucket.
-    events.push_back(CreateAcquireWakelockEvent(
-        attributions1, "wl1", bucketStartTimeNs + 2));
-    events.push_back(CreateAcquireWakelockEvent(
-        attributions2, "wl1", bucketStartTimeNs + 200));
-    events.push_back(CreateAcquireWakelockEvent(
-        attributions3, "wl1", bucketStartTimeNs + bucketSizeNs - 1));
-    events.push_back(CreateAcquireWakelockEvent(
-        attributions4, "wl1", bucketStartTimeNs + bucketSizeNs));
-
-    // Events 5~8 are in the 3rd bucket.
-    events.push_back(CreateAcquireWakelockEvent(
-        attributions5, "wl2", bucketStartTimeNs + 2 * bucketSizeNs + 1));
-    events.push_back(CreateAcquireWakelockEvent(
-        attributions6, "wl2", bucketStartTimeNs + 2 * bucketSizeNs + 100));
-    events.push_back(CreateAcquireWakelockEvent(
-        attributions7, "wl2", bucketStartTimeNs + 3 * bucketSizeNs - 2));
-    events.push_back(CreateAcquireWakelockEvent(
-        attributions8, "wl2", bucketStartTimeNs + 3 * bucketSizeNs));
-    events.push_back(CreateAcquireWakelockEvent(
-        attributions9, "wl2", bucketStartTimeNs + 3 * bucketSizeNs + 1));
-    events.push_back(CreateAcquireWakelockEvent(
-        attributions9, "wl2", bucketStartTimeNs + 3 * bucketSizeNs + 100));
-    events.push_back(CreateIsolatedUidChangedEvent(
-        isolatedUid, 222, true/* is_create*/, bucketStartTimeNs + 3 * bucketSizeNs - 1));
-    events.push_back(CreateIsolatedUidChangedEvent(
-        isolatedUid, 222, false/* is_create*/, bucketStartTimeNs + 3 * bucketSizeNs + 10));
-
-    sortLogEventsByTimestamp(&events);
-
-    for (const auto& event : events) {
-        processor->OnLogEvent(event.get());
-    }
-    ConfigMetricsReportList reports;
-    vector<uint8_t> buffer;
-    processor->onDumpReport(cfgKey, bucketStartTimeNs + 4 * bucketSizeNs + 1, false, true,
-                            ADB_DUMP, FAST, &buffer);
-    EXPECT_TRUE(buffer.size() > 0);
-    EXPECT_TRUE(reports.ParseFromArray(&buffer[0], buffer.size()));
-    backfillDimensionPath(&reports);
-    backfillStringInReport(&reports);
-    backfillStartEndTimestamp(&reports);
-    EXPECT_EQ(reports.reports_size(), 1);
-    EXPECT_EQ(reports.reports(0).metrics_size(), 1);
-
-    StatsLogReport::CountMetricDataWrapper countMetrics;
-    sortMetricDataByDimensionsValue(reports.reports(0).metrics(0).count_metrics(), &countMetrics);
-    EXPECT_EQ(countMetrics.data_size(), 6);
-
-    auto data = countMetrics.data(0);
-    ValidateAttributionUidAndTagDimension(
-        data.dimensions_in_what(), android::util::WAKELOCK_STATE_CHANGED, 222, "GMSCoreModule1");
-    EXPECT_EQ(2, data.bucket_info_size());
-    EXPECT_EQ(1, data.bucket_info(0).count());
-    EXPECT_EQ(bucketStartTimeNs + bucketSizeNs,
-              data.bucket_info(0).start_bucket_elapsed_nanos());
-    EXPECT_EQ(bucketStartTimeNs + 2 * bucketSizeNs,
-              data.bucket_info(0).end_bucket_elapsed_nanos());
-    EXPECT_EQ(1, data.bucket_info(1).count());
-    EXPECT_EQ(bucketStartTimeNs + 3 * bucketSizeNs,
-              data.bucket_info(1).start_bucket_elapsed_nanos());
-    EXPECT_EQ(bucketStartTimeNs + 4 * bucketSizeNs,
-              data.bucket_info(1).end_bucket_elapsed_nanos());
-
-    data = countMetrics.data(1);
-    ValidateUidDimension(
-        data.dimensions_in_what(), 0, android::util::WAKELOCK_STATE_CHANGED, 222);
-    ValidateAttributionUidAndTagDimension(
-        data.dimensions_in_what(), 0, android::util::WAKELOCK_STATE_CHANGED, 222, "GMSCoreModule1");
-    ValidateUidDimension(
-        data.dimensions_in_what(), 1, android::util::WAKELOCK_STATE_CHANGED, 333);
-    ValidateAttributionUidAndTagDimension(
-        data.dimensions_in_what(), 1, android::util::WAKELOCK_STATE_CHANGED, 333, "App3");
-    EXPECT_EQ(data.bucket_info_size(), 1);
-    EXPECT_EQ(data.bucket_info(0).count(), 1);
-    EXPECT_EQ(data.bucket_info(0).start_bucket_elapsed_nanos(), bucketStartTimeNs);
-    EXPECT_EQ(data.bucket_info(0).end_bucket_elapsed_nanos(), bucketStartTimeNs + bucketSizeNs);
-
-    data = countMetrics.data(2);
-    ValidateUidDimension(
-        data.dimensions_in_what(), 0, android::util::WAKELOCK_STATE_CHANGED, 444);
-    ValidateAttributionUidAndTagDimension(
-        data.dimensions_in_what(), 0, android::util::WAKELOCK_STATE_CHANGED, 444, "GMSCoreModule2");
-    ValidateUidDimension(
-        data.dimensions_in_what(), 1, android::util::WAKELOCK_STATE_CHANGED, 222);
-    ValidateAttributionUidAndTagDimension(
-        data.dimensions_in_what(), 1, android::util::WAKELOCK_STATE_CHANGED, 222, "GMSCoreModule1");
-    EXPECT_EQ(data.bucket_info_size(), 1);
-    EXPECT_EQ(data.bucket_info(0).count(), 1);
-    EXPECT_EQ(bucketStartTimeNs + 2 * bucketSizeNs,
-              data.bucket_info(0).start_bucket_elapsed_nanos());
-    EXPECT_EQ(bucketStartTimeNs + 3 * bucketSizeNs,
-              data.bucket_info(0).end_bucket_elapsed_nanos());
-
-    data = countMetrics.data(3);
-    ValidateUidDimension(
-        data.dimensions_in_what(), 0, android::util::WAKELOCK_STATE_CHANGED, 111);
-    ValidateAttributionUidAndTagDimension(
-        data.dimensions_in_what(), 0, android::util::WAKELOCK_STATE_CHANGED, 111, "App1");
-    ValidateUidDimension(
-        data.dimensions_in_what(), 1, android::util::WAKELOCK_STATE_CHANGED, 222);
-    ValidateAttributionUidAndTagDimension(
-        data.dimensions_in_what(), 1, android::util::WAKELOCK_STATE_CHANGED, 222, "GMSCoreModule1");
-    ValidateUidDimension(
-        data.dimensions_in_what(), 2, android::util::WAKELOCK_STATE_CHANGED, 333);
-    ValidateAttributionUidAndTagDimension(
-        data.dimensions_in_what(), 2, android::util::WAKELOCK_STATE_CHANGED, 333, "App3");
-    EXPECT_EQ(data.bucket_info_size(), 1);
-    EXPECT_EQ(data.bucket_info(0).count(), 1);
-    EXPECT_EQ(bucketStartTimeNs,
-              data.bucket_info(0).start_bucket_elapsed_nanos());
-    EXPECT_EQ(bucketStartTimeNs + bucketSizeNs,
-              data.bucket_info(0).end_bucket_elapsed_nanos());
-
-    data = countMetrics.data(4);
-    ValidateUidDimension(
-        data.dimensions_in_what(), 0, android::util::WAKELOCK_STATE_CHANGED, 111);
-    ValidateAttributionUidAndTagDimension(
-        data.dimensions_in_what(), 0, android::util::WAKELOCK_STATE_CHANGED, 111, "App1");
-    ValidateUidDimension(
-        data.dimensions_in_what(), 1, android::util::WAKELOCK_STATE_CHANGED, 333);
-    ValidateAttributionUidAndTagDimension(
-        data.dimensions_in_what(), 1, android::util::WAKELOCK_STATE_CHANGED, 333, "App3");
-    ValidateUidDimension(
-        data.dimensions_in_what(), 2, android::util::WAKELOCK_STATE_CHANGED, 222);
-    ValidateAttributionUidAndTagDimension(
-        data.dimensions_in_what(), 2, android::util::WAKELOCK_STATE_CHANGED, 222, "GMSCoreModule1");
-    EXPECT_EQ(data.bucket_info_size(), 1);
-    EXPECT_EQ(data.bucket_info(0).count(), 1);
-    EXPECT_EQ(bucketStartTimeNs,
-              data.bucket_info(0).start_bucket_elapsed_nanos());
-    EXPECT_EQ(bucketStartTimeNs + bucketSizeNs,
-              data.bucket_info(0).end_bucket_elapsed_nanos());
-
-    data = countMetrics.data(5);
-    ValidateUidDimension(
-        data.dimensions_in_what(), 0, android::util::WAKELOCK_STATE_CHANGED, 111);
-    ValidateAttributionUidAndTagDimension(
-        data.dimensions_in_what(), 0, android::util::WAKELOCK_STATE_CHANGED, 111, "App1");
-    ValidateUidDimension(
-        data.dimensions_in_what(), 1, android::util::WAKELOCK_STATE_CHANGED, 444);
-    ValidateAttributionUidAndTagDimension(
-        data.dimensions_in_what(), 1, android::util::WAKELOCK_STATE_CHANGED, 444, "GMSCoreModule2");
-    ValidateUidDimension(
-        data.dimensions_in_what(), 2, android::util::WAKELOCK_STATE_CHANGED, 333);
-    ValidateAttributionUidAndTagDimension(
-        data.dimensions_in_what(), 2, android::util::WAKELOCK_STATE_CHANGED, 333, "App3");
-    EXPECT_EQ(data.bucket_info_size(), 1);
-    EXPECT_EQ(data.bucket_info(0).count(), 1);
-    EXPECT_EQ(bucketStartTimeNs + 2 * bucketSizeNs,
-              data.bucket_info(0).start_bucket_elapsed_nanos());
-    EXPECT_EQ(bucketStartTimeNs + 3 * bucketSizeNs,
-              data.bucket_info(0).end_bucket_elapsed_nanos());
-}
+// TODO(b/149590301): Update these tests to use new socket schema.
+//TEST(AttributionE2eTest, TestAttributionMatchAndSliceByFirstUid) {
+//    auto config = CreateStatsdConfig(Position::FIRST);
+//    int64_t bucketStartTimeNs = 10000000000;
+//    int64_t bucketSizeNs =
+//        TimeUnitToBucketSizeInMillis(config.count_metric(0).bucket()) * 1000000;
+//
+//    ConfigKey cfgKey;
+//    auto processor = CreateStatsLogProcessor(bucketStartTimeNs, bucketStartTimeNs, config, cfgKey);
+//    EXPECT_EQ(processor->mMetricsManagers.size(), 1u);
+//    EXPECT_TRUE(processor->mMetricsManagers.begin()->second->isConfigValid());
+//
+//    // Here it assumes that GMS core has two uids.
+//    processor->getUidMap()->updateMap(
+//            1, {222, 444, 111, 333}, {1, 1, 2, 2},
+//            {String16("v1"), String16("v1"), String16("v2"), String16("v2")},
+//            {String16("com.android.gmscore"), String16("com.android.gmscore"), String16("app1"),
+//             String16("APP3")},
+//            {String16(""), String16(""), String16(""), String16("")});
+//
+//    // GMS core node is in the middle.
+//    std::vector<AttributionNodeInternal> attributions1 = {CreateAttribution(111, "App1"),
+//                                                          CreateAttribution(222, "GMSCoreModule1"),
+//                                                          CreateAttribution(333, "App3")};
+//
+//    // GMS core node is the last one.
+//    std::vector<AttributionNodeInternal> attributions2 = {CreateAttribution(111, "App1"),
+//                                                          CreateAttribution(333, "App3"),
+//                                                          CreateAttribution(222, "GMSCoreModule1")};
+//
+//    // GMS core node is the first one.
+//    std::vector<AttributionNodeInternal> attributions3 = {CreateAttribution(222, "GMSCoreModule1"),
+//                                                          CreateAttribution(333, "App3")};
+//
+//    // Single GMS core node.
+//    std::vector<AttributionNodeInternal> attributions4 = {CreateAttribution(222, "GMSCoreModule1")};
+//
+//    // GMS core has another uid.
+//    std::vector<AttributionNodeInternal> attributions5 = {CreateAttribution(111, "App1"),
+//                                                          CreateAttribution(444, "GMSCoreModule2"),
+//                                                          CreateAttribution(333, "App3")};
+//
+//    // Multiple GMS core nodes.
+//    std::vector<AttributionNodeInternal> attributions6 = {CreateAttribution(444, "GMSCoreModule2"),
+//                                                          CreateAttribution(222, "GMSCoreModule1")};
+//
+//    // No GMS core nodes.
+//    std::vector<AttributionNodeInternal> attributions7 = {CreateAttribution(111, "App1"),
+//                                                          CreateAttribution(333, "App3")};
+//    std::vector<AttributionNodeInternal> attributions8 = {CreateAttribution(111, "App1")};
+//
+//    // GMS core node with isolated uid.
+//    const int isolatedUid = 666;
+//    std::vector<AttributionNodeInternal> attributions9 = {
+//            CreateAttribution(isolatedUid, "GMSCoreModule3")};
+//
+//    std::vector<std::unique_ptr<LogEvent>> events;
+//    // Events 1~4 are in the 1st bucket.
+//    events.push_back(CreateAcquireWakelockEvent(
+//        attributions1, "wl1", bucketStartTimeNs + 2));
+//    events.push_back(CreateAcquireWakelockEvent(
+//        attributions2, "wl1", bucketStartTimeNs + 200));
+//    events.push_back(CreateAcquireWakelockEvent(
+//        attributions3, "wl1", bucketStartTimeNs + bucketSizeNs - 1));
+//    events.push_back(CreateAcquireWakelockEvent(
+//        attributions4, "wl1", bucketStartTimeNs + bucketSizeNs));
+//
+//    // Events 5~8 are in the 3rd bucket.
+//    events.push_back(CreateAcquireWakelockEvent(
+//        attributions5, "wl2", bucketStartTimeNs + 2 * bucketSizeNs + 1));
+//    events.push_back(CreateAcquireWakelockEvent(
+//        attributions6, "wl2", bucketStartTimeNs + 2 * bucketSizeNs + 100));
+//    events.push_back(CreateAcquireWakelockEvent(
+//        attributions7, "wl2", bucketStartTimeNs + 3 * bucketSizeNs - 2));
+//    events.push_back(CreateAcquireWakelockEvent(
+//        attributions8, "wl2", bucketStartTimeNs + 3 * bucketSizeNs));
+//    events.push_back(CreateAcquireWakelockEvent(
+//        attributions9, "wl2", bucketStartTimeNs + 3 * bucketSizeNs + 1));
+//    events.push_back(CreateAcquireWakelockEvent(
+//        attributions9, "wl2", bucketStartTimeNs + 3 * bucketSizeNs + 100));
+//    events.push_back(CreateIsolatedUidChangedEvent(
+//        isolatedUid, 222, true/* is_create*/, bucketStartTimeNs + 3 * bucketSizeNs - 1));
+//    events.push_back(CreateIsolatedUidChangedEvent(
+//        isolatedUid, 222, false/* is_create*/, bucketStartTimeNs + 3 * bucketSizeNs + 10));
+//
+//    sortLogEventsByTimestamp(&events);
+//
+//    for (const auto& event : events) {
+//        processor->OnLogEvent(event.get());
+//    }
+//    ConfigMetricsReportList reports;
+//    vector<uint8_t> buffer;
+//    processor->onDumpReport(cfgKey, bucketStartTimeNs + 4 * bucketSizeNs + 1, false, true,
+//                            ADB_DUMP, FAST, &buffer);
+//    EXPECT_TRUE(buffer.size() > 0);
+//    EXPECT_TRUE(reports.ParseFromArray(&buffer[0], buffer.size()));
+//    backfillDimensionPath(&reports);
+//    backfillStringInReport(&reports);
+//    backfillStartEndTimestamp(&reports);
+//    EXPECT_EQ(reports.reports_size(), 1);
+//    EXPECT_EQ(reports.reports(0).metrics_size(), 1);
+//
+//    StatsLogReport::CountMetricDataWrapper countMetrics;
+//    sortMetricDataByDimensionsValue(reports.reports(0).metrics(0).count_metrics(), &countMetrics);
+//    EXPECT_EQ(countMetrics.data_size(), 4);
+//
+//    auto data = countMetrics.data(0);
+//    ValidateAttributionUidAndTagDimension(
+//        data.dimensions_in_what(), android::util::WAKELOCK_STATE_CHANGED, 111,
+//            "App1");
+//    EXPECT_EQ(data.bucket_info_size(), 2);
+//    EXPECT_EQ(data.bucket_info(0).count(), 2);
+//    EXPECT_EQ(data.bucket_info(0).start_bucket_elapsed_nanos(), bucketStartTimeNs);
+//    EXPECT_EQ(data.bucket_info(0).end_bucket_elapsed_nanos(), bucketStartTimeNs + bucketSizeNs);
+//    EXPECT_EQ(data.bucket_info(1).count(), 1);
+//    EXPECT_EQ(data.bucket_info(1).start_bucket_elapsed_nanos(), bucketStartTimeNs + 2 * bucketSizeNs);
+//    EXPECT_EQ(data.bucket_info(1).end_bucket_elapsed_nanos(), bucketStartTimeNs + 3 * bucketSizeNs);
+//
+//    data = countMetrics.data(1);
+//    ValidateAttributionUidAndTagDimension(
+//        data.dimensions_in_what(), android::util::WAKELOCK_STATE_CHANGED, 222,
+//            "GMSCoreModule1");
+//    EXPECT_EQ(data.bucket_info_size(), 2);
+//    EXPECT_EQ(data.bucket_info(0).count(), 1);
+//    EXPECT_EQ(data.bucket_info(0).start_bucket_elapsed_nanos(), bucketStartTimeNs);
+//    EXPECT_EQ(data.bucket_info(0).end_bucket_elapsed_nanos(), bucketStartTimeNs + bucketSizeNs);
+//    EXPECT_EQ(data.bucket_info(1).count(), 1);
+//    EXPECT_EQ(data.bucket_info(1).start_bucket_elapsed_nanos(), bucketStartTimeNs + bucketSizeNs);
+//    EXPECT_EQ(data.bucket_info(1).end_bucket_elapsed_nanos(), bucketStartTimeNs + 2 * bucketSizeNs);
+//
+//    data = countMetrics.data(2);
+//    ValidateAttributionUidAndTagDimension(
+//        data.dimensions_in_what(), android::util::WAKELOCK_STATE_CHANGED, 222,
+//            "GMSCoreModule3");
+//    EXPECT_EQ(data.bucket_info_size(), 1);
+//    EXPECT_EQ(data.bucket_info(0).count(), 1);
+//    EXPECT_EQ(data.bucket_info(0).start_bucket_elapsed_nanos(), bucketStartTimeNs + 3 * bucketSizeNs);
+//    EXPECT_EQ(data.bucket_info(0).end_bucket_elapsed_nanos(), bucketStartTimeNs + 4 * bucketSizeNs);
+//
+//    data = countMetrics.data(3);
+//    ValidateAttributionUidAndTagDimension(
+//        data.dimensions_in_what(), android::util::WAKELOCK_STATE_CHANGED, 444,
+//            "GMSCoreModule2");
+//    EXPECT_EQ(data.bucket_info_size(), 1);
+//    EXPECT_EQ(data.bucket_info(0).count(), 1);
+//    EXPECT_EQ(data.bucket_info(0).start_bucket_elapsed_nanos(), bucketStartTimeNs + 2 * bucketSizeNs);
+//    EXPECT_EQ(data.bucket_info(0).end_bucket_elapsed_nanos(), bucketStartTimeNs + 3 * bucketSizeNs);
+//}
+//
+//TEST(AttributionE2eTest, TestAttributionMatchAndSliceByChain) {
+//    auto config = CreateStatsdConfig(Position::ALL);
+//    int64_t bucketStartTimeNs = 10000000000;
+//    int64_t bucketSizeNs =
+//        TimeUnitToBucketSizeInMillis(config.count_metric(0).bucket()) * 1000000;
+//
+//    ConfigKey cfgKey;
+//    auto processor = CreateStatsLogProcessor(bucketStartTimeNs, bucketStartTimeNs, config, cfgKey);
+//    EXPECT_EQ(processor->mMetricsManagers.size(), 1u);
+//    EXPECT_TRUE(processor->mMetricsManagers.begin()->second->isConfigValid());
+//
+//    // Here it assumes that GMS core has two uids.
+//    processor->getUidMap()->updateMap(
+//            1, {222, 444, 111, 333}, {1, 1, 2, 2},
+//            {String16("v1"), String16("v1"), String16("v2"), String16("v2")},
+//            {String16("com.android.gmscore"), String16("com.android.gmscore"), String16("app1"),
+//             String16("APP3")},
+//            {String16(""), String16(""), String16(""), String16("")});
+//
+//    // GMS core node is in the middle.
+//    std::vector<AttributionNodeInternal> attributions1 = {CreateAttribution(111, "App1"),
+//                                                          CreateAttribution(222, "GMSCoreModule1"),
+//                                                          CreateAttribution(333, "App3")};
+//
+//    // GMS core node is the last one.
+//    std::vector<AttributionNodeInternal> attributions2 = {CreateAttribution(111, "App1"),
+//                                                          CreateAttribution(333, "App3"),
+//                                                          CreateAttribution(222, "GMSCoreModule1")};
+//
+//    // GMS core node is the first one.
+//    std::vector<AttributionNodeInternal> attributions3 = {CreateAttribution(222, "GMSCoreModule1"),
+//                                                          CreateAttribution(333, "App3")};
+//
+//    // Single GMS core node.
+//    std::vector<AttributionNodeInternal> attributions4 = {CreateAttribution(222, "GMSCoreModule1")};
+//
+//    // GMS core has another uid.
+//    std::vector<AttributionNodeInternal> attributions5 = {CreateAttribution(111, "App1"),
+//                                                          CreateAttribution(444, "GMSCoreModule2"),
+//                                                          CreateAttribution(333, "App3")};
+//
+//    // Multiple GMS core nodes.
+//    std::vector<AttributionNodeInternal> attributions6 = {CreateAttribution(444, "GMSCoreModule2"),
+//                                                          CreateAttribution(222, "GMSCoreModule1")};
+//
+//    // No GMS core nodes.
+//    std::vector<AttributionNodeInternal> attributions7 = {CreateAttribution(111, "App1"),
+//                                                          CreateAttribution(333, "App3")};
+//    std::vector<AttributionNodeInternal> attributions8 = {CreateAttribution(111, "App1")};
+//
+//    // GMS core node with isolated uid.
+//    const int isolatedUid = 666;
+//    std::vector<AttributionNodeInternal> attributions9 = {
+//            CreateAttribution(isolatedUid, "GMSCoreModule1")};
+//
+//    std::vector<std::unique_ptr<LogEvent>> events;
+//    // Events 1~4 are in the 1st bucket.
+//    events.push_back(CreateAcquireWakelockEvent(
+//        attributions1, "wl1", bucketStartTimeNs + 2));
+//    events.push_back(CreateAcquireWakelockEvent(
+//        attributions2, "wl1", bucketStartTimeNs + 200));
+//    events.push_back(CreateAcquireWakelockEvent(
+//        attributions3, "wl1", bucketStartTimeNs + bucketSizeNs - 1));
+//    events.push_back(CreateAcquireWakelockEvent(
+//        attributions4, "wl1", bucketStartTimeNs + bucketSizeNs));
+//
+//    // Events 5~8 are in the 3rd bucket.
+//    events.push_back(CreateAcquireWakelockEvent(
+//        attributions5, "wl2", bucketStartTimeNs + 2 * bucketSizeNs + 1));
+//    events.push_back(CreateAcquireWakelockEvent(
+//        attributions6, "wl2", bucketStartTimeNs + 2 * bucketSizeNs + 100));
+//    events.push_back(CreateAcquireWakelockEvent(
+//        attributions7, "wl2", bucketStartTimeNs + 3 * bucketSizeNs - 2));
+//    events.push_back(CreateAcquireWakelockEvent(
+//        attributions8, "wl2", bucketStartTimeNs + 3 * bucketSizeNs));
+//    events.push_back(CreateAcquireWakelockEvent(
+//        attributions9, "wl2", bucketStartTimeNs + 3 * bucketSizeNs + 1));
+//    events.push_back(CreateAcquireWakelockEvent(
+//        attributions9, "wl2", bucketStartTimeNs + 3 * bucketSizeNs + 100));
+//    events.push_back(CreateIsolatedUidChangedEvent(
+//        isolatedUid, 222, true/* is_create*/, bucketStartTimeNs + 3 * bucketSizeNs - 1));
+//    events.push_back(CreateIsolatedUidChangedEvent(
+//        isolatedUid, 222, false/* is_create*/, bucketStartTimeNs + 3 * bucketSizeNs + 10));
+//
+//    sortLogEventsByTimestamp(&events);
+//
+//    for (const auto& event : events) {
+//        processor->OnLogEvent(event.get());
+//    }
+//    ConfigMetricsReportList reports;
+//    vector<uint8_t> buffer;
+//    processor->onDumpReport(cfgKey, bucketStartTimeNs + 4 * bucketSizeNs + 1, false, true,
+//                            ADB_DUMP, FAST, &buffer);
+//    EXPECT_TRUE(buffer.size() > 0);
+//    EXPECT_TRUE(reports.ParseFromArray(&buffer[0], buffer.size()));
+//    backfillDimensionPath(&reports);
+//    backfillStringInReport(&reports);
+//    backfillStartEndTimestamp(&reports);
+//    EXPECT_EQ(reports.reports_size(), 1);
+//    EXPECT_EQ(reports.reports(0).metrics_size(), 1);
+//
+//    StatsLogReport::CountMetricDataWrapper countMetrics;
+//    sortMetricDataByDimensionsValue(reports.reports(0).metrics(0).count_metrics(), &countMetrics);
+//    EXPECT_EQ(countMetrics.data_size(), 6);
+//
+//    auto data = countMetrics.data(0);
+//    ValidateAttributionUidAndTagDimension(
+//        data.dimensions_in_what(), android::util::WAKELOCK_STATE_CHANGED, 222, "GMSCoreModule1");
+//    EXPECT_EQ(2, data.bucket_info_size());
+//    EXPECT_EQ(1, data.bucket_info(0).count());
+//    EXPECT_EQ(bucketStartTimeNs + bucketSizeNs,
+//              data.bucket_info(0).start_bucket_elapsed_nanos());
+//    EXPECT_EQ(bucketStartTimeNs + 2 * bucketSizeNs,
+//              data.bucket_info(0).end_bucket_elapsed_nanos());
+//    EXPECT_EQ(1, data.bucket_info(1).count());
+//    EXPECT_EQ(bucketStartTimeNs + 3 * bucketSizeNs,
+//              data.bucket_info(1).start_bucket_elapsed_nanos());
+//    EXPECT_EQ(bucketStartTimeNs + 4 * bucketSizeNs,
+//              data.bucket_info(1).end_bucket_elapsed_nanos());
+//
+//    data = countMetrics.data(1);
+//    ValidateUidDimension(
+//        data.dimensions_in_what(), 0, android::util::WAKELOCK_STATE_CHANGED, 222);
+//    ValidateAttributionUidAndTagDimension(
+//        data.dimensions_in_what(), 0, android::util::WAKELOCK_STATE_CHANGED, 222, "GMSCoreModule1");
+//    ValidateUidDimension(
+//        data.dimensions_in_what(), 1, android::util::WAKELOCK_STATE_CHANGED, 333);
+//    ValidateAttributionUidAndTagDimension(
+//        data.dimensions_in_what(), 1, android::util::WAKELOCK_STATE_CHANGED, 333, "App3");
+//    EXPECT_EQ(data.bucket_info_size(), 1);
+//    EXPECT_EQ(data.bucket_info(0).count(), 1);
+//    EXPECT_EQ(data.bucket_info(0).start_bucket_elapsed_nanos(), bucketStartTimeNs);
+//    EXPECT_EQ(data.bucket_info(0).end_bucket_elapsed_nanos(), bucketStartTimeNs + bucketSizeNs);
+//
+//    data = countMetrics.data(2);
+//    ValidateUidDimension(
+//        data.dimensions_in_what(), 0, android::util::WAKELOCK_STATE_CHANGED, 444);
+//    ValidateAttributionUidAndTagDimension(
+//        data.dimensions_in_what(), 0, android::util::WAKELOCK_STATE_CHANGED, 444, "GMSCoreModule2");
+//    ValidateUidDimension(
+//        data.dimensions_in_what(), 1, android::util::WAKELOCK_STATE_CHANGED, 222);
+//    ValidateAttributionUidAndTagDimension(
+//        data.dimensions_in_what(), 1, android::util::WAKELOCK_STATE_CHANGED, 222, "GMSCoreModule1");
+//    EXPECT_EQ(data.bucket_info_size(), 1);
+//    EXPECT_EQ(data.bucket_info(0).count(), 1);
+//    EXPECT_EQ(bucketStartTimeNs + 2 * bucketSizeNs,
+//              data.bucket_info(0).start_bucket_elapsed_nanos());
+//    EXPECT_EQ(bucketStartTimeNs + 3 * bucketSizeNs,
+//              data.bucket_info(0).end_bucket_elapsed_nanos());
+//
+//    data = countMetrics.data(3);
+//    ValidateUidDimension(
+//        data.dimensions_in_what(), 0, android::util::WAKELOCK_STATE_CHANGED, 111);
+//    ValidateAttributionUidAndTagDimension(
+//        data.dimensions_in_what(), 0, android::util::WAKELOCK_STATE_CHANGED, 111, "App1");
+//    ValidateUidDimension(
+//        data.dimensions_in_what(), 1, android::util::WAKELOCK_STATE_CHANGED, 222);
+//    ValidateAttributionUidAndTagDimension(
+//        data.dimensions_in_what(), 1, android::util::WAKELOCK_STATE_CHANGED, 222, "GMSCoreModule1");
+//    ValidateUidDimension(
+//        data.dimensions_in_what(), 2, android::util::WAKELOCK_STATE_CHANGED, 333);
+//    ValidateAttributionUidAndTagDimension(
+//        data.dimensions_in_what(), 2, android::util::WAKELOCK_STATE_CHANGED, 333, "App3");
+//    EXPECT_EQ(data.bucket_info_size(), 1);
+//    EXPECT_EQ(data.bucket_info(0).count(), 1);
+//    EXPECT_EQ(bucketStartTimeNs,
+//              data.bucket_info(0).start_bucket_elapsed_nanos());
+//    EXPECT_EQ(bucketStartTimeNs + bucketSizeNs,
+//              data.bucket_info(0).end_bucket_elapsed_nanos());
+//
+//    data = countMetrics.data(4);
+//    ValidateUidDimension(
+//        data.dimensions_in_what(), 0, android::util::WAKELOCK_STATE_CHANGED, 111);
+//    ValidateAttributionUidAndTagDimension(
+//        data.dimensions_in_what(), 0, android::util::WAKELOCK_STATE_CHANGED, 111, "App1");
+//    ValidateUidDimension(
+//        data.dimensions_in_what(), 1, android::util::WAKELOCK_STATE_CHANGED, 333);
+//    ValidateAttributionUidAndTagDimension(
+//        data.dimensions_in_what(), 1, android::util::WAKELOCK_STATE_CHANGED, 333, "App3");
+//    ValidateUidDimension(
+//        data.dimensions_in_what(), 2, android::util::WAKELOCK_STATE_CHANGED, 222);
+//    ValidateAttributionUidAndTagDimension(
+//        data.dimensions_in_what(), 2, android::util::WAKELOCK_STATE_CHANGED, 222, "GMSCoreModule1");
+//    EXPECT_EQ(data.bucket_info_size(), 1);
+//    EXPECT_EQ(data.bucket_info(0).count(), 1);
+//    EXPECT_EQ(bucketStartTimeNs,
+//              data.bucket_info(0).start_bucket_elapsed_nanos());
+//    EXPECT_EQ(bucketStartTimeNs + bucketSizeNs,
+//              data.bucket_info(0).end_bucket_elapsed_nanos());
+//
+//    data = countMetrics.data(5);
+//    ValidateUidDimension(
+//        data.dimensions_in_what(), 0, android::util::WAKELOCK_STATE_CHANGED, 111);
+//    ValidateAttributionUidAndTagDimension(
+//        data.dimensions_in_what(), 0, android::util::WAKELOCK_STATE_CHANGED, 111, "App1");
+//    ValidateUidDimension(
+//        data.dimensions_in_what(), 1, android::util::WAKELOCK_STATE_CHANGED, 444);
+//    ValidateAttributionUidAndTagDimension(
+//        data.dimensions_in_what(), 1, android::util::WAKELOCK_STATE_CHANGED, 444, "GMSCoreModule2");
+//    ValidateUidDimension(
+//        data.dimensions_in_what(), 2, android::util::WAKELOCK_STATE_CHANGED, 333);
+//    ValidateAttributionUidAndTagDimension(
+//        data.dimensions_in_what(), 2, android::util::WAKELOCK_STATE_CHANGED, 333, "App3");
+//    EXPECT_EQ(data.bucket_info_size(), 1);
+//    EXPECT_EQ(data.bucket_info(0).count(), 1);
+//    EXPECT_EQ(bucketStartTimeNs + 2 * bucketSizeNs,
+//              data.bucket_info(0).start_bucket_elapsed_nanos());
+//    EXPECT_EQ(bucketStartTimeNs + 3 * bucketSizeNs,
+//              data.bucket_info(0).end_bucket_elapsed_nanos());
+//}
 
 #else
 GTEST_LOG_(INFO) << "This test does nothing.\n";
diff --git a/cmds/statsd/tests/e2e/ConfigTtl_e2e_test.cpp b/cmds/statsd/tests/e2e/ConfigTtl_e2e_test.cpp
index 325e869..f8edee5 100644
--- a/cmds/statsd/tests/e2e/ConfigTtl_e2e_test.cpp
+++ b/cmds/statsd/tests/e2e/ConfigTtl_e2e_test.cpp
@@ -56,52 +56,53 @@
 
 }  // namespace
 
-TEST(ConfigTtlE2eTest, TestCountMetric) {
-    const int num_buckets = 1;
-    const int threshold = 3;
-    auto config = CreateStatsdConfig(num_buckets, threshold);
-    const uint64_t alert_id = config.alert(0).id();
-    const uint32_t refractory_period_sec = config.alert(0).refractory_period_secs();
-
-    int64_t bucketStartTimeNs = 10000000000;
-    int64_t bucketSizeNs =
-        TimeUnitToBucketSizeInMillis(config.count_metric(0).bucket()) * 1000000;
-
-    ConfigKey cfgKey;
-    auto processor = CreateStatsLogProcessor(bucketStartTimeNs, bucketStartTimeNs, config, cfgKey);
-    EXPECT_EQ(processor->mMetricsManagers.size(), 1u);
-    EXPECT_TRUE(processor->mMetricsManagers.begin()->second->isConfigValid());
-
-    std::vector<AttributionNodeInternal> attributions1 = {CreateAttribution(111, "App1")};
-
-    FieldValue fieldValue1(Field(android::util::WAKELOCK_STATE_CHANGED, (int32_t)0x02010101),
-                           Value((int32_t)111));
-    HashableDimensionKey whatKey1({fieldValue1});
-    MetricDimensionKey dimensionKey1(whatKey1, DEFAULT_DIMENSION_KEY);
-
-    FieldValue fieldValue2(Field(android::util::WAKELOCK_STATE_CHANGED, (int32_t)0x02010101),
-                           Value((int32_t)222));
-    HashableDimensionKey whatKey2({fieldValue2});
-    MetricDimensionKey dimensionKey2(whatKey2, DEFAULT_DIMENSION_KEY);
-
-    auto event = CreateAcquireWakelockEvent(attributions1, "wl1", bucketStartTimeNs + 2);
-    processor->OnLogEvent(event.get());
-
-    event = CreateAcquireWakelockEvent(attributions1, "wl2", bucketStartTimeNs + bucketSizeNs + 2);
-    processor->OnLogEvent(event.get());
-
-    event = CreateAcquireWakelockEvent(
-        attributions1, "wl1", bucketStartTimeNs + 25 * bucketSizeNs + 2);
-    processor->OnLogEvent(event.get());
-
-    EXPECT_EQ((int64_t)(bucketStartTimeNs + 25 * bucketSizeNs + 2 + 2 * 3600 * NS_PER_SEC),
-              processor->mMetricsManagers.begin()->second->getTtlEndNs());
-
-    // Clear the data stored on disk as a result of the ttl.
-    vector<uint8_t> buffer;
-    processor->onDumpReport(cfgKey, bucketStartTimeNs + 25 * bucketSizeNs + 3, false, true,
-                                ADB_DUMP, FAST, &buffer);
-}
+// TODO(b/149590301): Update this test to use new socket schema.
+//TEST(ConfigTtlE2eTest, TestCountMetric) {
+//    const int num_buckets = 1;
+//    const int threshold = 3;
+//    auto config = CreateStatsdConfig(num_buckets, threshold);
+//    const uint64_t alert_id = config.alert(0).id();
+//    const uint32_t refractory_period_sec = config.alert(0).refractory_period_secs();
+//
+//    int64_t bucketStartTimeNs = 10000000000;
+//    int64_t bucketSizeNs =
+//        TimeUnitToBucketSizeInMillis(config.count_metric(0).bucket()) * 1000000;
+//
+//    ConfigKey cfgKey;
+//    auto processor = CreateStatsLogProcessor(bucketStartTimeNs, bucketStartTimeNs, config, cfgKey);
+//    EXPECT_EQ(processor->mMetricsManagers.size(), 1u);
+//    EXPECT_TRUE(processor->mMetricsManagers.begin()->second->isConfigValid());
+//
+//    std::vector<AttributionNodeInternal> attributions1 = {CreateAttribution(111, "App1")};
+//
+//    FieldValue fieldValue1(Field(android::util::WAKELOCK_STATE_CHANGED, (int32_t)0x02010101),
+//                           Value((int32_t)111));
+//    HashableDimensionKey whatKey1({fieldValue1});
+//    MetricDimensionKey dimensionKey1(whatKey1, DEFAULT_DIMENSION_KEY);
+//
+//    FieldValue fieldValue2(Field(android::util::WAKELOCK_STATE_CHANGED, (int32_t)0x02010101),
+//                           Value((int32_t)222));
+//    HashableDimensionKey whatKey2({fieldValue2});
+//    MetricDimensionKey dimensionKey2(whatKey2, DEFAULT_DIMENSION_KEY);
+//
+//    auto event = CreateAcquireWakelockEvent(attributions1, "wl1", bucketStartTimeNs + 2);
+//    processor->OnLogEvent(event.get());
+//
+//    event = CreateAcquireWakelockEvent(attributions1, "wl2", bucketStartTimeNs + bucketSizeNs + 2);
+//    processor->OnLogEvent(event.get());
+//
+//    event = CreateAcquireWakelockEvent(
+//        attributions1, "wl1", bucketStartTimeNs + 25 * bucketSizeNs + 2);
+//    processor->OnLogEvent(event.get());
+//
+//    EXPECT_EQ((int64_t)(bucketStartTimeNs + 25 * bucketSizeNs + 2 + 2 * 3600 * NS_PER_SEC),
+//              processor->mMetricsManagers.begin()->second->getTtlEndNs());
+//
+//    // Clear the data stored on disk as a result of the ttl.
+//    vector<uint8_t> buffer;
+//    processor->onDumpReport(cfgKey, bucketStartTimeNs + 25 * bucketSizeNs + 3, false, true,
+//                                ADB_DUMP, FAST, &buffer);
+//}
 
 
 #else
diff --git a/cmds/statsd/tests/e2e/CountMetric_e2e_test.cpp b/cmds/statsd/tests/e2e/CountMetric_e2e_test.cpp
index 15fc468..a1f74a6 100644
--- a/cmds/statsd/tests/e2e/CountMetric_e2e_test.cpp
+++ b/cmds/statsd/tests/e2e/CountMetric_e2e_test.cpp
@@ -27,772 +27,773 @@
 
 #ifdef __ANDROID__
 
-/**
- * Test a count metric that has one slice_by_state with no primary fields.
- *
- * Once the CountMetricProducer is initialized, it has one atom id in
- * mSlicedStateAtoms and no entries in mStateGroupMap.
-
- * One StateTracker tracks the state atom, and it has one listener which is the
- * CountMetricProducer that was initialized.
- */
-TEST(CountMetricE2eTest, TestSlicedState) {
-    // Initialize config.
-    StatsdConfig config;
-    config.add_allowed_log_source("AID_ROOT");  // LogEvent defaults to UID of root.
-
-    auto syncStartMatcher = CreateSyncStartAtomMatcher();
-    *config.add_atom_matcher() = syncStartMatcher;
-
-    auto state = CreateScreenState();
-    *config.add_state() = state;
-
-    // Create count metric that slices by screen state.
-    int64_t metricId = 123456;
-    auto countMetric = config.add_count_metric();
-    countMetric->set_id(metricId);
-    countMetric->set_what(syncStartMatcher.id());
-    countMetric->set_bucket(TimeUnit::FIVE_MINUTES);
-    countMetric->add_slice_by_state(state.id());
-
-    // Initialize StatsLogProcessor.
-    const uint64_t bucketStartTimeNs = 10000000000;  // 0:10
-    const uint64_t bucketSizeNs =
-            TimeUnitToBucketSizeInMillis(config.count_metric(0).bucket()) * 1000000LL;
-    int uid = 12345;
-    int64_t cfgId = 98765;
-    ConfigKey cfgKey(uid, cfgId);
-    auto processor = CreateStatsLogProcessor(bucketStartTimeNs, bucketStartTimeNs, config, cfgKey);
-
-    // Check that CountMetricProducer was initialized correctly.
-    EXPECT_EQ(processor->mMetricsManagers.size(), 1u);
-    sp<MetricsManager> metricsManager = processor->mMetricsManagers.begin()->second;
-    EXPECT_TRUE(metricsManager->isConfigValid());
-    EXPECT_EQ(metricsManager->mAllMetricProducers.size(), 1);
-    sp<MetricProducer> metricProducer = metricsManager->mAllMetricProducers[0];
-    EXPECT_EQ(metricProducer->mSlicedStateAtoms.size(), 1);
-    EXPECT_EQ(metricProducer->mSlicedStateAtoms.at(0), SCREEN_STATE_ATOM_ID);
-    EXPECT_EQ(metricProducer->mStateGroupMap.size(), 0);
-
-    // Check that StateTrackers were initialized correctly.
-    EXPECT_EQ(1, StateManager::getInstance().getStateTrackersCount());
-    EXPECT_EQ(1, StateManager::getInstance().getListenersCount(SCREEN_STATE_ATOM_ID));
-
-    /*
-               bucket #1                      bucket #2
-    |     1     2     3     4     5     6     7     8     9     10 (minutes)
-    |-----------------------------|-----------------------------|--
-            x                x         x    x        x      x       (syncStartEvents)
-          |                                       |                 (ScreenIsOnEvent)
-                   |     |                                          (ScreenIsOffEvent)
-                                                        |           (ScreenUnknownEvent)
-    */
-    // Initialize log events - first bucket.
-    int appUid = 123;
-    std::vector<AttributionNodeInternal> attributions1 = {CreateAttribution(appUid, "App1")};
-    std::vector<std::unique_ptr<LogEvent>> events;
-    events.push_back(
-            CreateScreenStateChangedEvent(android::view::DisplayStateEnum::DISPLAY_STATE_ON,
-                                          bucketStartTimeNs + 50 * NS_PER_SEC));  // 1:00
-    events.push_back(CreateSyncStartEvent(attributions1, "sync_name",
-                                          bucketStartTimeNs + 75 * NS_PER_SEC));  // 1:25
-    events.push_back(
-            CreateScreenStateChangedEvent(android::view::DisplayStateEnum::DISPLAY_STATE_OFF,
-                                          bucketStartTimeNs + 150 * NS_PER_SEC));  // 2:40
-    events.push_back(
-            CreateScreenStateChangedEvent(android::view::DisplayStateEnum::DISPLAY_STATE_OFF,
-                                          bucketStartTimeNs + 200 * NS_PER_SEC));  // 3:30
-    events.push_back(CreateSyncStartEvent(attributions1, "sync_name",
-                                          bucketStartTimeNs + 250 * NS_PER_SEC));  // 4:20
-
-    // Initialize log events - second bucket.
-    events.push_back(CreateSyncStartEvent(attributions1, "sync_name",
-                                          bucketStartTimeNs + 350 * NS_PER_SEC));  // 6:00
-    events.push_back(CreateSyncStartEvent(attributions1, "sync_name",
-                                          bucketStartTimeNs + 400 * NS_PER_SEC));  // 6:50
-    events.push_back(
-            CreateScreenStateChangedEvent(android::view::DisplayStateEnum::DISPLAY_STATE_ON,
-                                          bucketStartTimeNs + 450 * NS_PER_SEC));  // 7:40
-    events.push_back(CreateSyncStartEvent(attributions1, "sync_name",
-                                          bucketStartTimeNs + 475 * NS_PER_SEC));  // 8:05
-    events.push_back(
-            CreateScreenStateChangedEvent(android::view::DisplayStateEnum::DISPLAY_STATE_UNKNOWN,
-                                          bucketStartTimeNs + 500 * NS_PER_SEC));  // 8:30
-    events.push_back(CreateSyncStartEvent(attributions1, "sync_name",
-                                          bucketStartTimeNs + 520 * NS_PER_SEC));  // 8:50
-
-    // Send log events to StatsLogProcessor.
-    for (auto& event : events) {
-        processor->OnLogEvent(event.get());
-    }
-
-    // Check dump report.
-    vector<uint8_t> buffer;
-    ConfigMetricsReportList reports;
-    processor->onDumpReport(cfgKey, bucketStartTimeNs + bucketSizeNs * 2 + 1, false, true, ADB_DUMP,
-                            FAST, &buffer);
-    EXPECT_GT(buffer.size(), 0);
-    EXPECT_TRUE(reports.ParseFromArray(&buffer[0], buffer.size()));
-    backfillDimensionPath(&reports);
-    backfillStringInReport(&reports);
-    backfillStartEndTimestamp(&reports);
-
-    EXPECT_EQ(1, reports.reports_size());
-    EXPECT_EQ(1, reports.reports(0).metrics_size());
-    EXPECT_TRUE(reports.reports(0).metrics(0).has_count_metrics());
-    EXPECT_EQ(3, reports.reports(0).metrics(0).count_metrics().data_size());
-
-    // For each CountMetricData, check StateValue info is correct and buckets
-    // have correct counts.
-    auto data = reports.reports(0).metrics(0).count_metrics().data(0);
-    EXPECT_EQ(1, data.slice_by_state_size());
-    EXPECT_EQ(SCREEN_STATE_ATOM_ID, data.slice_by_state(0).atom_id());
-    EXPECT_TRUE(data.slice_by_state(0).has_value());
-    EXPECT_EQ(android::view::DisplayStateEnum::DISPLAY_STATE_ON, data.slice_by_state(0).value());
-    EXPECT_EQ(2, data.bucket_info_size());
-    EXPECT_EQ(1, data.bucket_info(0).count());
-    EXPECT_EQ(1, data.bucket_info(1).count());
-
-    data = reports.reports(0).metrics(0).count_metrics().data(1);
-    EXPECT_EQ(1, data.slice_by_state_size());
-    EXPECT_EQ(SCREEN_STATE_ATOM_ID, data.slice_by_state(0).atom_id());
-    EXPECT_TRUE(data.slice_by_state(0).has_value());
-    EXPECT_EQ(android::view::DisplayStateEnum::DISPLAY_STATE_UNKNOWN, data.slice_by_state(0).value());
-    EXPECT_EQ(1, data.bucket_info_size());
-    EXPECT_EQ(1, data.bucket_info(0).count());
-
-    data = reports.reports(0).metrics(0).count_metrics().data(2);
-    EXPECT_EQ(1, data.slice_by_state_size());
-    EXPECT_EQ(SCREEN_STATE_ATOM_ID, data.slice_by_state(0).atom_id());
-    EXPECT_TRUE(data.slice_by_state(0).has_value());
-    EXPECT_EQ(android::view::DisplayStateEnum::DISPLAY_STATE_OFF, data.slice_by_state(0).value());
-    EXPECT_EQ(2, data.bucket_info_size());
-    EXPECT_EQ(1, data.bucket_info(0).count());
-    EXPECT_EQ(2, data.bucket_info(1).count());
-}
-
-/**
- * Test a count metric that has one slice_by_state with a mapping and no
- * primary fields.
- *
- * Once the CountMetricProducer is initialized, it has one atom id in
- * mSlicedStateAtoms and has one entry per state value in mStateGroupMap.
- *
- * One StateTracker tracks the state atom, and it has one listener which is the
- * CountMetricProducer that was initialized.
- */
-TEST(CountMetricE2eTest, TestSlicedStateWithMap) {
-    // Initialize config.
-    StatsdConfig config;
-    config.add_allowed_log_source("AID_ROOT");  // LogEvent defaults to UID of root.
-
-    auto syncStartMatcher = CreateSyncStartAtomMatcher();
-    *config.add_atom_matcher() = syncStartMatcher;
-
-    auto state = CreateScreenStateWithOnOffMap();
-    *config.add_state() = state;
-
-    // Create count metric that slices by screen state with on/off map.
-    int64_t metricId = 123456;
-    auto countMetric = config.add_count_metric();
-    countMetric->set_id(metricId);
-    countMetric->set_what(syncStartMatcher.id());
-    countMetric->set_bucket(TimeUnit::FIVE_MINUTES);
-    countMetric->add_slice_by_state(state.id());
-
-    // Initialize StatsLogProcessor.
-    const uint64_t bucketStartTimeNs = 10000000000;  // 0:10
-    const uint64_t bucketSizeNs =
-            TimeUnitToBucketSizeInMillis(config.count_metric(0).bucket()) * 1000000LL;
-    int uid = 12345;
-    int64_t cfgId = 98765;
-    ConfigKey cfgKey(uid, cfgId);
-    auto processor = CreateStatsLogProcessor(bucketStartTimeNs, bucketStartTimeNs, config, cfgKey);
-
-    // Check that StateTrackers were initialized correctly.
-    EXPECT_EQ(1, StateManager::getInstance().getStateTrackersCount());
-    EXPECT_EQ(1, StateManager::getInstance().getListenersCount(SCREEN_STATE_ATOM_ID));
-
-    // Check that CountMetricProducer was initialized correctly.
-    EXPECT_EQ(processor->mMetricsManagers.size(), 1u);
-    sp<MetricsManager> metricsManager = processor->mMetricsManagers.begin()->second;
-    EXPECT_TRUE(metricsManager->isConfigValid());
-    EXPECT_EQ(metricsManager->mAllMetricProducers.size(), 1);
-    sp<MetricProducer> metricProducer = metricsManager->mAllMetricProducers[0];
-    EXPECT_EQ(metricProducer->mSlicedStateAtoms.size(), 1);
-    EXPECT_EQ(metricProducer->mSlicedStateAtoms.at(0), SCREEN_STATE_ATOM_ID);
-    EXPECT_EQ(metricProducer->mStateGroupMap.size(), 1);
-
-    StateMap map = state.map();
-    for (auto group : map.group()) {
-        for (auto value : group.value()) {
-            EXPECT_EQ(metricProducer->mStateGroupMap[SCREEN_STATE_ATOM_ID][value],
-                      group.group_id());
-        }
-    }
-
-    /*
-               bucket #1                      bucket #2
-    |     1     2     3     4     5     6     7     8     9     10 (minutes)
-    |-----------------------------|-----------------------------|--
-      x   x     x       x    x   x      x         x         x       (syncStartEvents)
-     -----------------------------------------------------------SCREEN_OFF events
-       |                                                            (ScreenStateUnknownEvent = 0)
-             |                  |                                   (ScreenStateOffEvent = 1)
-                          |                                         (ScreenStateDozeEvent = 3)
-                                                |                   (ScreenStateDozeSuspendEvent = 4)
-     -----------------------------------------------------------SCREEN_ON events
-                   |                                       |        (ScreenStateOnEvent = 2)
-                      |                                             (ScreenStateVrEvent = 5)
-                                            |                       (ScreenStateOnSuspendEvent = 6)
-    */
-    // Initialize log events - first bucket.
-    int appUid = 123;
-    std::vector<AttributionNodeInternal> attributions1 = {CreateAttribution(appUid, "App1")};
-
-    std::vector<std::unique_ptr<LogEvent>> events;
-    events.push_back(CreateSyncStartEvent(attributions1, "sync_name",
-                                          bucketStartTimeNs + 20 * NS_PER_SEC));  // 0:30
-    events.push_back(
-            CreateScreenStateChangedEvent(android::view::DisplayStateEnum::DISPLAY_STATE_UNKNOWN,
-                                          bucketStartTimeNs + 30 * NS_PER_SEC));  // 0:40
-    events.push_back(CreateSyncStartEvent(attributions1, "sync_name",
-                                          bucketStartTimeNs + 60 * NS_PER_SEC));  // 1:10
-    events.push_back(
-            CreateScreenStateChangedEvent(android::view::DisplayStateEnum::DISPLAY_STATE_OFF,
-                                          bucketStartTimeNs + 90 * NS_PER_SEC));  // 1:40
-    events.push_back(CreateSyncStartEvent(attributions1, "sync_name",
-                                          bucketStartTimeNs + 120 * NS_PER_SEC));  // 2:10
-    events.push_back(
-            CreateScreenStateChangedEvent(android::view::DisplayStateEnum::DISPLAY_STATE_ON,
-                                          bucketStartTimeNs + 150 * NS_PER_SEC));  // 2:40
-    events.push_back(
-            CreateScreenStateChangedEvent(android::view::DisplayStateEnum::DISPLAY_STATE_VR,
-                                          bucketStartTimeNs + 180 * NS_PER_SEC));  // 3:10
-    events.push_back(CreateSyncStartEvent(attributions1, "sync_name",
-                                          bucketStartTimeNs + 200 * NS_PER_SEC));  // 3:30
-    events.push_back(
-            CreateScreenStateChangedEvent(android::view::DisplayStateEnum::DISPLAY_STATE_DOZE,
-                                          bucketStartTimeNs + 210 * NS_PER_SEC));  // 3:40
-    events.push_back(CreateSyncStartEvent(attributions1, "sync_name",
-                                          bucketStartTimeNs + 250 * NS_PER_SEC));  // 4:20
-    events.push_back(
-            CreateScreenStateChangedEvent(android::view::DisplayStateEnum::DISPLAY_STATE_OFF,
-                                          bucketStartTimeNs + 280 * NS_PER_SEC));  // 4:50
-    events.push_back(CreateSyncStartEvent(attributions1, "sync_name",
-                                          bucketStartTimeNs + 285 * NS_PER_SEC));  // 4:55
-
-    // Initialize log events - second bucket.
-    events.push_back(CreateSyncStartEvent(attributions1, "sync_name",
-                                          bucketStartTimeNs + 360 * NS_PER_SEC));  // 6:10
-    events.push_back(
-            CreateScreenStateChangedEvent(android::view::DisplayStateEnum::DISPLAY_STATE_ON_SUSPEND,
-                                          bucketStartTimeNs + 390 * NS_PER_SEC));  // 6:40
-    events.push_back(CreateScreenStateChangedEvent(
-            android::view::DisplayStateEnum::DISPLAY_STATE_DOZE_SUSPEND,
-            bucketStartTimeNs + 430 * NS_PER_SEC));  // 7:20
-    events.push_back(CreateSyncStartEvent(attributions1, "sync_name",
-                                          bucketStartTimeNs + 440 * NS_PER_SEC));  // 7:30
-    events.push_back(
-            CreateScreenStateChangedEvent(android::view::DisplayStateEnum::DISPLAY_STATE_ON,
-                                          bucketStartTimeNs + 540 * NS_PER_SEC));  // 9:10
-    events.push_back(CreateSyncStartEvent(attributions1, "sync_name",
-                                          bucketStartTimeNs + 570 * NS_PER_SEC));  // 9:40
-
-    // Send log events to StatsLogProcessor.
-    for (auto& event : events) {
-        processor->OnLogEvent(event.get());
-    }
-
-    // Check dump report.
-    vector<uint8_t> buffer;
-    ConfigMetricsReportList reports;
-    processor->onDumpReport(cfgKey, bucketStartTimeNs + bucketSizeNs * 2 + 1, false, true, ADB_DUMP,
-                            FAST, &buffer);
-    EXPECT_GT(buffer.size(), 0);
-    EXPECT_TRUE(reports.ParseFromArray(&buffer[0], buffer.size()));
-    backfillDimensionPath(&reports);
-    backfillStringInReport(&reports);
-    backfillStartEndTimestamp(&reports);
-
-    EXPECT_EQ(1, reports.reports_size());
-    EXPECT_EQ(1, reports.reports(0).metrics_size());
-    EXPECT_TRUE(reports.reports(0).metrics(0).has_count_metrics());
-    EXPECT_EQ(3, reports.reports(0).metrics(0).count_metrics().data_size());
-
-    // For each CountMetricData, check StateValue info is correct and buckets
-    // have correct counts.
-    auto data = reports.reports(0).metrics(0).count_metrics().data(0);
-    EXPECT_EQ(1, data.slice_by_state_size());
-    EXPECT_EQ(SCREEN_STATE_ATOM_ID, data.slice_by_state(0).atom_id());
-    EXPECT_TRUE(data.slice_by_state(0).has_value());
-    EXPECT_EQ(-1 /* StateTracker::kStateUnknown */, data.slice_by_state(0).value());
-    EXPECT_EQ(1, data.bucket_info_size());
-    EXPECT_EQ(1, data.bucket_info(0).count());
-
-    data = reports.reports(0).metrics(0).count_metrics().data(1);
-    EXPECT_EQ(1, data.slice_by_state_size());
-    EXPECT_EQ(SCREEN_STATE_ATOM_ID, data.slice_by_state(0).atom_id());
-    EXPECT_TRUE(data.slice_by_state(0).has_group_id());
-    EXPECT_EQ(StringToId("SCREEN_OFF"), data.slice_by_state(0).group_id());
-    EXPECT_EQ(2, data.bucket_info_size());
-    EXPECT_EQ(4, data.bucket_info(0).count());
-    EXPECT_EQ(2, data.bucket_info(1).count());
-
-    data = reports.reports(0).metrics(0).count_metrics().data(2);
-    EXPECT_EQ(1, data.slice_by_state_size());
-    EXPECT_EQ(SCREEN_STATE_ATOM_ID, data.slice_by_state(0).atom_id());
-    EXPECT_TRUE(data.slice_by_state(0).has_group_id());
-    EXPECT_EQ(StringToId("SCREEN_ON"), data.slice_by_state(0).group_id());
-    EXPECT_EQ(2, data.bucket_info_size());
-    EXPECT_EQ(1, data.bucket_info(0).count());
-    EXPECT_EQ(1, data.bucket_info(1).count());
-}
-
-/**
- * Test a count metric that has one slice_by_state with a primary field.
-
- * Once the CountMetricProducer is initialized, it should have one
- * MetricStateLink stored. State querying using a non-empty primary key
- * should also work as intended.
- */
-TEST(CountMetricE2eTest, TestSlicedStateWithPrimaryFields) {
-    // Initialize config.
-    StatsdConfig config;
-    config.add_allowed_log_source("AID_ROOT");  // LogEvent defaults to UID of root.
-
-    auto appCrashMatcher =
-            CreateSimpleAtomMatcher("APP_CRASH_OCCURRED", android::util::APP_CRASH_OCCURRED);
-    *config.add_atom_matcher() = appCrashMatcher;
-
-    auto state = CreateUidProcessState();
-    *config.add_state() = state;
-
-    // Create count metric that slices by uid process state.
-    int64_t metricId = 123456;
-    auto countMetric = config.add_count_metric();
-    countMetric->set_id(metricId);
-    countMetric->set_what(appCrashMatcher.id());
-    countMetric->set_bucket(TimeUnit::FIVE_MINUTES);
-    countMetric->add_slice_by_state(state.id());
-    MetricStateLink* stateLink = countMetric->add_state_link();
-    stateLink->set_state_atom_id(UID_PROCESS_STATE_ATOM_ID);
-    auto fieldsInWhat = stateLink->mutable_fields_in_what();
-    *fieldsInWhat = CreateDimensions(android::util::APP_CRASH_OCCURRED, {1 /* uid */});
-    auto fieldsInState = stateLink->mutable_fields_in_state();
-    *fieldsInState = CreateDimensions(UID_PROCESS_STATE_ATOM_ID, {1 /* uid */});
-
-    // Initialize StatsLogProcessor.
-    const uint64_t bucketStartTimeNs = 10000000000;  // 0:10
-    const uint64_t bucketSizeNs =
-            TimeUnitToBucketSizeInMillis(config.count_metric(0).bucket()) * 1000000LL;
-    int uid = 12345;
-    int64_t cfgId = 98765;
-    ConfigKey cfgKey(uid, cfgId);
-    auto processor = CreateStatsLogProcessor(bucketStartTimeNs, bucketStartTimeNs, config, cfgKey);
-
-    // Check that StateTrackers were initialized correctly.
-    EXPECT_EQ(1, StateManager::getInstance().getStateTrackersCount());
-    EXPECT_EQ(1, StateManager::getInstance().getListenersCount(UID_PROCESS_STATE_ATOM_ID));
-
-    // Check that CountMetricProducer was initialized correctly.
-    EXPECT_EQ(processor->mMetricsManagers.size(), 1u);
-    sp<MetricsManager> metricsManager = processor->mMetricsManagers.begin()->second;
-    EXPECT_TRUE(metricsManager->isConfigValid());
-    EXPECT_EQ(metricsManager->mAllMetricProducers.size(), 1);
-    sp<MetricProducer> metricProducer = metricsManager->mAllMetricProducers[0];
-    EXPECT_EQ(metricProducer->mSlicedStateAtoms.size(), 1);
-    EXPECT_EQ(metricProducer->mSlicedStateAtoms.at(0), UID_PROCESS_STATE_ATOM_ID);
-    EXPECT_EQ(metricProducer->mStateGroupMap.size(), 0);
-    EXPECT_EQ(metricProducer->mMetric2StateLinks.size(), 1);
-
-    /*
-    NOTE: "1" or "2" represents the uid associated with the state/app crash event
-               bucket #1                      bucket #2
-    |     1     2     3     4     5     6     7     8     9     10
-    |-----------------------------|-----------------------------|--
-      1   1     1       1    1   2      1         1          2      (AppCrashEvents)
-     -----------------------------------------------------------PROCESS STATE events
-             1                  2                                   (ProcessStateTopEvent = 1002)
-                          1                 1                       (ProcessStateForegroundServiceEvent = 1003)
-                                                2                   (ProcessStateImportantBackgroundEvent = 1006)
-        1          1                                       1        (ProcessStateImportantForegroundEvent = 1005)
-
-    Based on the diagram above, an AppCrashEvent querying for process state value would return:
-    - StateTracker::kStateUnknown
-    - Important foreground
-    - Top
-    - Important foreground
-    - Foreground service
-    - Top (both the app crash and state still have matching uid = 2)
-
-    - Foreground service
-    - Foreground service
-    - Important background
-    */
-    // Initialize log events - first bucket.
-    std::vector<std::unique_ptr<LogEvent>> events;
-    events.push_back(
-            CreateAppCrashOccurredEvent(1 /* uid */, bucketStartTimeNs + 20 * NS_PER_SEC));  // 0:30
-    events.push_back(CreateUidProcessStateChangedEvent(
-            1 /* uid */, android::app::ProcessStateEnum::PROCESS_STATE_IMPORTANT_FOREGROUND,
-            bucketStartTimeNs + 30 * NS_PER_SEC));  // 0:40
-    events.push_back(
-            CreateAppCrashOccurredEvent(1 /* uid */, bucketStartTimeNs + 60 * NS_PER_SEC));  // 1:10
-    events.push_back(CreateUidProcessStateChangedEvent(
-            1 /* uid */, android::app::ProcessStateEnum::PROCESS_STATE_TOP,
-            bucketStartTimeNs + 90 * NS_PER_SEC));  // 1:40
-    events.push_back(CreateAppCrashOccurredEvent(1 /* uid */,
-                                                 bucketStartTimeNs + 120 * NS_PER_SEC));  // 2:10
-    events.push_back(CreateUidProcessStateChangedEvent(
-            1 /* uid */, android::app::ProcessStateEnum::PROCESS_STATE_IMPORTANT_FOREGROUND,
-            bucketStartTimeNs + 150 * NS_PER_SEC));  // 2:40
-    events.push_back(CreateAppCrashOccurredEvent(1 /* uid */,
-                                                 bucketStartTimeNs + 200 * NS_PER_SEC));  // 3:30
-    events.push_back(CreateUidProcessStateChangedEvent(
-            1 /* uid */, android::app::ProcessStateEnum::PROCESS_STATE_FOREGROUND_SERVICE,
-            bucketStartTimeNs + 210 * NS_PER_SEC));  // 3:40
-    events.push_back(CreateAppCrashOccurredEvent(1 /* uid */,
-                                                 bucketStartTimeNs + 250 * NS_PER_SEC));  // 4:20
-    events.push_back(CreateUidProcessStateChangedEvent(
-            2 /* uid */, android::app::ProcessStateEnum::PROCESS_STATE_TOP,
-            bucketStartTimeNs + 280 * NS_PER_SEC));  // 4:50
-    events.push_back(CreateAppCrashOccurredEvent(2 /* uid */,
-                                                 bucketStartTimeNs + 285 * NS_PER_SEC));  // 4:55
-
-    // Initialize log events - second bucket.
-    events.push_back(CreateAppCrashOccurredEvent(1 /* uid */,
-                                                 bucketStartTimeNs + 360 * NS_PER_SEC));  // 6:10
-    events.push_back(CreateUidProcessStateChangedEvent(
-            1 /* uid */, android::app::ProcessStateEnum::PROCESS_STATE_FOREGROUND_SERVICE,
-            bucketStartTimeNs + 390 * NS_PER_SEC));  // 6:40
-    events.push_back(CreateUidProcessStateChangedEvent(
-            2 /* uid */, android::app::ProcessStateEnum::PROCESS_STATE_IMPORTANT_BACKGROUND,
-            bucketStartTimeNs + 430 * NS_PER_SEC));  // 7:20
-    events.push_back(CreateAppCrashOccurredEvent(1 /* uid */,
-                                                 bucketStartTimeNs + 440 * NS_PER_SEC));  // 7:30
-    events.push_back(CreateUidProcessStateChangedEvent(
-            1 /* uid */, android::app::ProcessStateEnum::PROCESS_STATE_IMPORTANT_FOREGROUND,
-            bucketStartTimeNs + 540 * NS_PER_SEC));  // 9:10
-    events.push_back(CreateAppCrashOccurredEvent(2 /* uid */,
-                                                 bucketStartTimeNs + 570 * NS_PER_SEC));  // 9:40
-
-    // Send log events to StatsLogProcessor.
-    for (auto& event : events) {
-        processor->OnLogEvent(event.get());
-    }
-
-    // Check dump report.
-    vector<uint8_t> buffer;
-    ConfigMetricsReportList reports;
-    processor->onDumpReport(cfgKey, bucketStartTimeNs + bucketSizeNs * 2 + 1, false, true, ADB_DUMP,
-                            FAST, &buffer);
-    EXPECT_GT(buffer.size(), 0);
-    EXPECT_TRUE(reports.ParseFromArray(&buffer[0], buffer.size()));
-    backfillDimensionPath(&reports);
-    backfillStringInReport(&reports);
-    backfillStartEndTimestamp(&reports);
-
-    EXPECT_EQ(1, reports.reports_size());
-    EXPECT_EQ(1, reports.reports(0).metrics_size());
-    EXPECT_TRUE(reports.reports(0).metrics(0).has_count_metrics());
-    EXPECT_EQ(5, reports.reports(0).metrics(0).count_metrics().data_size());
-
-    // For each CountMetricData, check StateValue info is correct and buckets
-    // have correct counts.
-    auto data = reports.reports(0).metrics(0).count_metrics().data(0);
-    EXPECT_EQ(1, data.slice_by_state_size());
-    EXPECT_EQ(UID_PROCESS_STATE_ATOM_ID, data.slice_by_state(0).atom_id());
-    EXPECT_TRUE(data.slice_by_state(0).has_value());
-    EXPECT_EQ(android::app::PROCESS_STATE_IMPORTANT_BACKGROUND, data.slice_by_state(0).value());
-    EXPECT_EQ(1, data.bucket_info_size());
-    EXPECT_EQ(1, data.bucket_info(0).count());
-
-    data = reports.reports(0).metrics(0).count_metrics().data(1);
-    EXPECT_EQ(1, data.slice_by_state_size());
-    EXPECT_EQ(UID_PROCESS_STATE_ATOM_ID, data.slice_by_state(0).atom_id());
-    EXPECT_TRUE(data.slice_by_state(0).has_value());
-    EXPECT_EQ(-1 /* StateTracker::kStateUnknown */, data.slice_by_state(0).value());
-    EXPECT_EQ(1, data.bucket_info_size());
-    EXPECT_EQ(1, data.bucket_info(0).count());
-
-    data = reports.reports(0).metrics(0).count_metrics().data(2);
-    EXPECT_EQ(1, data.slice_by_state_size());
-    EXPECT_EQ(UID_PROCESS_STATE_ATOM_ID, data.slice_by_state(0).atom_id());
-    EXPECT_TRUE(data.slice_by_state(0).has_value());
-    EXPECT_EQ(android::app::PROCESS_STATE_IMPORTANT_FOREGROUND, data.slice_by_state(0).value());
-    EXPECT_EQ(1, data.bucket_info_size());
-    EXPECT_EQ(2, data.bucket_info(0).count());
-
-    data = reports.reports(0).metrics(0).count_metrics().data(3);
-    EXPECT_EQ(1, data.slice_by_state_size());
-    EXPECT_EQ(UID_PROCESS_STATE_ATOM_ID, data.slice_by_state(0).atom_id());
-    EXPECT_TRUE(data.slice_by_state(0).has_value());
-    EXPECT_EQ(android::app::PROCESS_STATE_TOP, data.slice_by_state(0).value());
-    EXPECT_EQ(1, data.bucket_info_size());
-    EXPECT_EQ(2, data.bucket_info(0).count());
-
-    data = reports.reports(0).metrics(0).count_metrics().data(4);
-    EXPECT_EQ(1, data.slice_by_state_size());
-    EXPECT_EQ(UID_PROCESS_STATE_ATOM_ID, data.slice_by_state(0).atom_id());
-    EXPECT_TRUE(data.slice_by_state(0).has_value());
-    EXPECT_EQ(android::app::PROCESS_STATE_FOREGROUND_SERVICE, data.slice_by_state(0).value());
-    EXPECT_EQ(2, data.bucket_info_size());
-    EXPECT_EQ(1, data.bucket_info(0).count());
-    EXPECT_EQ(2, data.bucket_info(1).count());
-}
-
-TEST(CountMetricE2eTest, TestMultipleSlicedStates) {
-    // Initialize config.
-    StatsdConfig config;
-    config.add_allowed_log_source("AID_ROOT");  // LogEvent defaults to UID of root.
-
-    auto appCrashMatcher =
-            CreateSimpleAtomMatcher("APP_CRASH_OCCURRED", android::util::APP_CRASH_OCCURRED);
-    *config.add_atom_matcher() = appCrashMatcher;
-
-    auto state1 = CreateScreenStateWithOnOffMap();
-    *config.add_state() = state1;
-    auto state2 = CreateUidProcessState();
-    *config.add_state() = state2;
-
-    // Create count metric that slices by screen state with on/off map and
-    // slices by uid process state.
-    int64_t metricId = 123456;
-    auto countMetric = config.add_count_metric();
-    countMetric->set_id(metricId);
-    countMetric->set_what(appCrashMatcher.id());
-    countMetric->set_bucket(TimeUnit::FIVE_MINUTES);
-    countMetric->add_slice_by_state(state1.id());
-    countMetric->add_slice_by_state(state2.id());
-    MetricStateLink* stateLink = countMetric->add_state_link();
-    stateLink->set_state_atom_id(UID_PROCESS_STATE_ATOM_ID);
-    auto fieldsInWhat = stateLink->mutable_fields_in_what();
-    *fieldsInWhat = CreateDimensions(android::util::APP_CRASH_OCCURRED, {1 /* uid */});
-    auto fieldsInState = stateLink->mutable_fields_in_state();
-    *fieldsInState = CreateDimensions(UID_PROCESS_STATE_ATOM_ID, {1 /* uid */});
-
-    // Initialize StatsLogProcessor.
-    const uint64_t bucketStartTimeNs = 10000000000;  // 0:10
-    const uint64_t bucketSizeNs =
-            TimeUnitToBucketSizeInMillis(config.count_metric(0).bucket()) * 1000000LL;
-    int uid = 12345;
-    int64_t cfgId = 98765;
-    ConfigKey cfgKey(uid, cfgId);
-    auto processor = CreateStatsLogProcessor(bucketStartTimeNs, bucketStartTimeNs, config, cfgKey);
-
-    // Check that StateTrackers were properly initialized.
-    EXPECT_EQ(2, StateManager::getInstance().getStateTrackersCount());
-    EXPECT_EQ(1, StateManager::getInstance().getListenersCount(SCREEN_STATE_ATOM_ID));
-    EXPECT_EQ(1, StateManager::getInstance().getListenersCount(UID_PROCESS_STATE_ATOM_ID));
-
-    // Check that CountMetricProducer was initialized correctly.
-    EXPECT_EQ(processor->mMetricsManagers.size(), 1u);
-    sp<MetricsManager> metricsManager = processor->mMetricsManagers.begin()->second;
-    EXPECT_TRUE(metricsManager->isConfigValid());
-    EXPECT_EQ(metricsManager->mAllMetricProducers.size(), 1);
-    sp<MetricProducer> metricProducer = metricsManager->mAllMetricProducers[0];
-    EXPECT_EQ(metricProducer->mSlicedStateAtoms.size(), 2);
-    EXPECT_EQ(metricProducer->mSlicedStateAtoms.at(0), SCREEN_STATE_ATOM_ID);
-    EXPECT_EQ(metricProducer->mSlicedStateAtoms.at(1), UID_PROCESS_STATE_ATOM_ID);
-    EXPECT_EQ(metricProducer->mStateGroupMap.size(), 1);
-    EXPECT_EQ(metricProducer->mMetric2StateLinks.size(), 1);
-
-    StateMap map = state1.map();
-    for (auto group : map.group()) {
-        for (auto value : group.value()) {
-            EXPECT_EQ(metricProducer->mStateGroupMap[SCREEN_STATE_ATOM_ID][value],
-                      group.group_id());
-        }
-    }
-
-    /*
-               bucket #1                      bucket #2
-    |     1     2     3     4     5     6     7     8     9     10 (minutes)
-    |-----------------------------|-----------------------------|--
-      1   1     1       1    1   2      1         1           2     (AppCrashEvents)
-     -----------------------------------------------------------SCREEN_OFF events
-       |                                                            (ScreenStateUnknownEvent = 0)
-             |                                  |                   (ScreenStateOffEvent = 1)
-                          |                                         (ScreenStateDozeEvent = 3)
-     -----------------------------------------------------------SCREEN_ON events
-                    |                                    |          (ScreenStateOnEvent = 2)
-                                            |                       (ScreenStateOnSuspendEvent = 6)
-     -----------------------------------------------------------PROCESS STATE events
-             1                  2                                   (ProcessStateTopEvent = 1002)
-                                          1                         (ProcessStateForegroundServiceEvent = 1003)
-                                               2                    (ProcessStateImportantBackgroundEvent = 1006)
-     1             1                                       1        (ProcessStateImportantForegroundEvent = 1005)
-
-     Based on the diagram above, Screen State / Process State pairs for each
-     AppCrashEvent are:
-     - StateTracker::kStateUnknown / important foreground
-     - off / important foreground
-     - off / Top
-     - on / important foreground
-     - off / important foreground
-     - off / top
-
-     - off / important foreground
-     - off / foreground service
-     - on / important background
-
-    */
-    // Initialize log events - first bucket.
-    std::vector<std::unique_ptr<LogEvent>> events;
-    events.push_back(CreateUidProcessStateChangedEvent(
-            1 /* uid */, android::app::ProcessStateEnum::PROCESS_STATE_IMPORTANT_FOREGROUND,
-            bucketStartTimeNs + 5 * NS_PER_SEC));  // 0:15
-    events.push_back(
-            CreateAppCrashOccurredEvent(1 /* uid */, bucketStartTimeNs + 20 * NS_PER_SEC));  // 0:30
-    events.push_back(
-            CreateScreenStateChangedEvent(android::view::DisplayStateEnum::DISPLAY_STATE_UNKNOWN,
-                                          bucketStartTimeNs + 30 * NS_PER_SEC));  // 0:40
-    events.push_back(
-            CreateAppCrashOccurredEvent(1 /* uid */, bucketStartTimeNs + 60 * NS_PER_SEC));  // 1:10
-    events.push_back(CreateUidProcessStateChangedEvent(
-            1 /* uid */, android::app::ProcessStateEnum::PROCESS_STATE_TOP,
-            bucketStartTimeNs + 90 * NS_PER_SEC));  // 1:40
-    events.push_back(
-            CreateScreenStateChangedEvent(android::view::DisplayStateEnum::DISPLAY_STATE_OFF,
-                                          bucketStartTimeNs + 90 * NS_PER_SEC));  // 1:40
-    events.push_back(CreateAppCrashOccurredEvent(1 /* uid */,
-                                                 bucketStartTimeNs + 120 * NS_PER_SEC));  // 2:10
-    events.push_back(CreateUidProcessStateChangedEvent(
-            1 /* uid */, android::app::ProcessStateEnum::PROCESS_STATE_IMPORTANT_FOREGROUND,
-            bucketStartTimeNs + 150 * NS_PER_SEC));  // 2:40
-    events.push_back(
-            CreateScreenStateChangedEvent(android::view::DisplayStateEnum::DISPLAY_STATE_ON,
-                                          bucketStartTimeNs + 160 * NS_PER_SEC));  // 2:50
-    events.push_back(CreateAppCrashOccurredEvent(1 /* uid */,
-                                                 bucketStartTimeNs + 200 * NS_PER_SEC));  // 3:30
-    events.push_back(
-            CreateScreenStateChangedEvent(android::view::DisplayStateEnum::DISPLAY_STATE_DOZE,
-                                          bucketStartTimeNs + 210 * NS_PER_SEC));  // 3:40
-    events.push_back(CreateAppCrashOccurredEvent(1 /* uid */,
-                                                 bucketStartTimeNs + 250 * NS_PER_SEC));  // 4:20
-    events.push_back(CreateUidProcessStateChangedEvent(
-            2 /* uid */, android::app::ProcessStateEnum::PROCESS_STATE_TOP,
-            bucketStartTimeNs + 280 * NS_PER_SEC));  // 4:50
-    events.push_back(CreateAppCrashOccurredEvent(2 /* uid */,
-                                                 bucketStartTimeNs + 285 * NS_PER_SEC));  // 4:55
-
-    // Initialize log events - second bucket.
-    events.push_back(CreateAppCrashOccurredEvent(1 /* uid */,
-                                                 bucketStartTimeNs + 360 * NS_PER_SEC));  // 6:10
-    events.push_back(CreateUidProcessStateChangedEvent(
-            1 /* uid */, android::app::ProcessStateEnum::PROCESS_STATE_FOREGROUND_SERVICE,
-            bucketStartTimeNs + 380 * NS_PER_SEC));  // 6:30
-    events.push_back(
-            CreateScreenStateChangedEvent(android::view::DisplayStateEnum::DISPLAY_STATE_ON_SUSPEND,
-                                          bucketStartTimeNs + 390 * NS_PER_SEC));  // 6:40
-    events.push_back(CreateUidProcessStateChangedEvent(
-            2 /* uid */, android::app::ProcessStateEnum::PROCESS_STATE_IMPORTANT_BACKGROUND,
-            bucketStartTimeNs + 420 * NS_PER_SEC));  // 7:10
-    events.push_back(
-            CreateScreenStateChangedEvent(android::view::DisplayStateEnum::DISPLAY_STATE_OFF,
-                                          bucketStartTimeNs + 440 * NS_PER_SEC));  // 7:30
-    events.push_back(CreateAppCrashOccurredEvent(1 /* uid */,
-                                                 bucketStartTimeNs + 450 * NS_PER_SEC));  // 7:40
-    events.push_back(
-            CreateScreenStateChangedEvent(android::view::DisplayStateEnum::DISPLAY_STATE_ON,
-                                          bucketStartTimeNs + 520 * NS_PER_SEC));  // 8:50
-    events.push_back(CreateUidProcessStateChangedEvent(
-            1 /* uid */, android::app::ProcessStateEnum::PROCESS_STATE_IMPORTANT_FOREGROUND,
-            bucketStartTimeNs + 540 * NS_PER_SEC));  // 9:10
-    events.push_back(CreateAppCrashOccurredEvent(2 /* uid */,
-                                                 bucketStartTimeNs + 570 * NS_PER_SEC));  // 9:40
-
-    // Send log events to StatsLogProcessor.
-    for (auto& event : events) {
-        processor->OnLogEvent(event.get());
-    }
-
-    // Check dump report.
-    vector<uint8_t> buffer;
-    ConfigMetricsReportList reports;
-    processor->onDumpReport(cfgKey, bucketStartTimeNs + bucketSizeNs * 2 + 1, false, true, ADB_DUMP,
-                            FAST, &buffer);
-    EXPECT_GT(buffer.size(), 0);
-    EXPECT_TRUE(reports.ParseFromArray(&buffer[0], buffer.size()));
-    backfillDimensionPath(&reports);
-    backfillStringInReport(&reports);
-    backfillStartEndTimestamp(&reports);
-
-    EXPECT_EQ(1, reports.reports_size());
-    EXPECT_EQ(1, reports.reports(0).metrics_size());
-    EXPECT_TRUE(reports.reports(0).metrics(0).has_count_metrics());
-    EXPECT_EQ(6, reports.reports(0).metrics(0).count_metrics().data_size());
-
-    // For each CountMetricData, check StateValue info is correct and buckets
-    // have correct counts.
-    auto data = reports.reports(0).metrics(0).count_metrics().data(0);
-    EXPECT_EQ(2, data.slice_by_state_size());
-    EXPECT_EQ(SCREEN_STATE_ATOM_ID, data.slice_by_state(0).atom_id());
-    EXPECT_TRUE(data.slice_by_state(0).has_group_id());
-    EXPECT_EQ(StringToId("SCREEN_OFF"), data.slice_by_state(0).group_id());
-    EXPECT_EQ(UID_PROCESS_STATE_ATOM_ID, data.slice_by_state(1).atom_id());
-    EXPECT_TRUE(data.slice_by_state(1).has_value());
-    EXPECT_EQ(android::app::PROCESS_STATE_FOREGROUND_SERVICE, data.slice_by_state(1).value());
-    EXPECT_EQ(1, data.bucket_info_size());
-    EXPECT_EQ(1, data.bucket_info(0).count());
-
-    data = reports.reports(0).metrics(0).count_metrics().data(1);
-    EXPECT_EQ(2, data.slice_by_state_size());
-    EXPECT_EQ(SCREEN_STATE_ATOM_ID, data.slice_by_state(0).atom_id());
-    EXPECT_TRUE(data.slice_by_state(0).has_value());
-    EXPECT_EQ(-1, data.slice_by_state(0).value());
-    EXPECT_EQ(UID_PROCESS_STATE_ATOM_ID, data.slice_by_state(1).atom_id());
-    EXPECT_TRUE(data.slice_by_state(1).has_value());
-    EXPECT_EQ(android::app::PROCESS_STATE_IMPORTANT_FOREGROUND, data.slice_by_state(1).value());
-    EXPECT_EQ(1, data.bucket_info_size());
-    EXPECT_EQ(1, data.bucket_info(0).count());
-
-    data = reports.reports(0).metrics(0).count_metrics().data(2);
-    EXPECT_EQ(2, data.slice_by_state_size());
-    EXPECT_EQ(SCREEN_STATE_ATOM_ID, data.slice_by_state(0).atom_id());
-    EXPECT_TRUE(data.slice_by_state(0).has_group_id());
-    EXPECT_EQ(StringToId("SCREEN_OFF"), data.slice_by_state(0).group_id());
-    EXPECT_EQ(UID_PROCESS_STATE_ATOM_ID, data.slice_by_state(1).atom_id());
-    EXPECT_TRUE(data.slice_by_state(1).has_value());
-    EXPECT_EQ(android::app::PROCESS_STATE_IMPORTANT_FOREGROUND, data.slice_by_state(1).value());
-    EXPECT_EQ(2, data.bucket_info_size());
-    EXPECT_EQ(2, data.bucket_info(0).count());
-    EXPECT_EQ(1, data.bucket_info(1).count());
-
-    data = reports.reports(0).metrics(0).count_metrics().data(3);
-    EXPECT_EQ(2, data.slice_by_state_size());
-    EXPECT_EQ(SCREEN_STATE_ATOM_ID, data.slice_by_state(0).atom_id());
-    EXPECT_TRUE(data.slice_by_state(0).has_group_id());
-    EXPECT_EQ(StringToId("SCREEN_ON"), data.slice_by_state(0).group_id());
-    EXPECT_EQ(UID_PROCESS_STATE_ATOM_ID, data.slice_by_state(1).atom_id());
-    EXPECT_TRUE(data.slice_by_state(1).has_value());
-    EXPECT_EQ(android::app::PROCESS_STATE_IMPORTANT_FOREGROUND, data.slice_by_state(1).value());
-    EXPECT_EQ(1, data.bucket_info_size());
-    EXPECT_EQ(1, data.bucket_info(0).count());
-
-    data = reports.reports(0).metrics(0).count_metrics().data(4);
-    EXPECT_EQ(2, data.slice_by_state_size());
-    EXPECT_EQ(SCREEN_STATE_ATOM_ID, data.slice_by_state(0).atom_id());
-    EXPECT_TRUE(data.slice_by_state(0).has_group_id());
-    EXPECT_EQ(StringToId("SCREEN_ON"), data.slice_by_state(0).group_id());
-    EXPECT_EQ(UID_PROCESS_STATE_ATOM_ID, data.slice_by_state(1).atom_id());
-    EXPECT_TRUE(data.slice_by_state(1).has_value());
-    EXPECT_EQ(android::app::PROCESS_STATE_IMPORTANT_BACKGROUND, data.slice_by_state(1).value());
-    EXPECT_EQ(1, data.bucket_info_size());
-    EXPECT_EQ(1, data.bucket_info(0).count());
-
-    data = reports.reports(0).metrics(0).count_metrics().data(5);
-    EXPECT_EQ(2, data.slice_by_state_size());
-    EXPECT_EQ(SCREEN_STATE_ATOM_ID, data.slice_by_state(0).atom_id());
-    EXPECT_TRUE(data.slice_by_state(0).has_group_id());
-    EXPECT_EQ(StringToId("SCREEN_OFF"), data.slice_by_state(0).group_id());
-    EXPECT_EQ(UID_PROCESS_STATE_ATOM_ID, data.slice_by_state(1).atom_id());
-    EXPECT_TRUE(data.slice_by_state(1).has_value());
-    EXPECT_EQ(android::app::PROCESS_STATE_TOP, data.slice_by_state(1).value());
-    EXPECT_EQ(1, data.bucket_info_size());
-    EXPECT_EQ(2, data.bucket_info(0).count());
-}
+// TODO(b/149590301): Update these tests to use new socket schema.
+///**
+// * Test a count metric that has one slice_by_state with no primary fields.
+// *
+// * Once the CountMetricProducer is initialized, it has one atom id in
+// * mSlicedStateAtoms and no entries in mStateGroupMap.
+//
+// * One StateTracker tracks the state atom, and it has one listener which is the
+// * CountMetricProducer that was initialized.
+// */
+//TEST(CountMetricE2eTest, TestSlicedState) {
+//    // Initialize config.
+//    StatsdConfig config;
+//    config.add_allowed_log_source("AID_ROOT");  // LogEvent defaults to UID of root.
+//
+//    auto syncStartMatcher = CreateSyncStartAtomMatcher();
+//    *config.add_atom_matcher() = syncStartMatcher;
+//
+//    auto state = CreateScreenState();
+//    *config.add_state() = state;
+//
+//    // Create count metric that slices by screen state.
+//    int64_t metricId = 123456;
+//    auto countMetric = config.add_count_metric();
+//    countMetric->set_id(metricId);
+//    countMetric->set_what(syncStartMatcher.id());
+//    countMetric->set_bucket(TimeUnit::FIVE_MINUTES);
+//    countMetric->add_slice_by_state(state.id());
+//
+//    // Initialize StatsLogProcessor.
+//    const uint64_t bucketStartTimeNs = 10000000000;  // 0:10
+//    const uint64_t bucketSizeNs =
+//            TimeUnitToBucketSizeInMillis(config.count_metric(0).bucket()) * 1000000LL;
+//    int uid = 12345;
+//    int64_t cfgId = 98765;
+//    ConfigKey cfgKey(uid, cfgId);
+//    auto processor = CreateStatsLogProcessor(bucketStartTimeNs, bucketStartTimeNs, config, cfgKey);
+//
+//    // Check that CountMetricProducer was initialized correctly.
+//    EXPECT_EQ(processor->mMetricsManagers.size(), 1u);
+//    sp<MetricsManager> metricsManager = processor->mMetricsManagers.begin()->second;
+//    EXPECT_TRUE(metricsManager->isConfigValid());
+//    EXPECT_EQ(metricsManager->mAllMetricProducers.size(), 1);
+//    sp<MetricProducer> metricProducer = metricsManager->mAllMetricProducers[0];
+//    EXPECT_EQ(metricProducer->mSlicedStateAtoms.size(), 1);
+//    EXPECT_EQ(metricProducer->mSlicedStateAtoms.at(0), SCREEN_STATE_ATOM_ID);
+//    EXPECT_EQ(metricProducer->mStateGroupMap.size(), 0);
+//
+//    // Check that StateTrackers were initialized correctly.
+//    EXPECT_EQ(1, StateManager::getInstance().getStateTrackersCount());
+//    EXPECT_EQ(1, StateManager::getInstance().getListenersCount(SCREEN_STATE_ATOM_ID));
+//
+//    /*
+//               bucket #1                      bucket #2
+//    |     1     2     3     4     5     6     7     8     9     10 (minutes)
+//    |-----------------------------|-----------------------------|--
+//            x                x         x    x        x      x       (syncStartEvents)
+//          |                                       |                 (ScreenIsOnEvent)
+//                   |     |                                          (ScreenIsOffEvent)
+//                                                        |           (ScreenUnknownEvent)
+//    */
+//    // Initialize log events - first bucket.
+//    int appUid = 123;
+//    std::vector<AttributionNodeInternal> attributions1 = {CreateAttribution(appUid, "App1")};
+//    std::vector<std::unique_ptr<LogEvent>> events;
+//    events.push_back(
+//            CreateScreenStateChangedEvent(android::view::DisplayStateEnum::DISPLAY_STATE_ON,
+//                                          bucketStartTimeNs + 50 * NS_PER_SEC));  // 1:00
+//    events.push_back(CreateSyncStartEvent(attributions1, "sync_name",
+//                                          bucketStartTimeNs + 75 * NS_PER_SEC));  // 1:25
+//    events.push_back(
+//            CreateScreenStateChangedEvent(android::view::DisplayStateEnum::DISPLAY_STATE_OFF,
+//                                          bucketStartTimeNs + 150 * NS_PER_SEC));  // 2:40
+//    events.push_back(
+//            CreateScreenStateChangedEvent(android::view::DisplayStateEnum::DISPLAY_STATE_OFF,
+//                                          bucketStartTimeNs + 200 * NS_PER_SEC));  // 3:30
+//    events.push_back(CreateSyncStartEvent(attributions1, "sync_name",
+//                                          bucketStartTimeNs + 250 * NS_PER_SEC));  // 4:20
+//
+//    // Initialize log events - second bucket.
+//    events.push_back(CreateSyncStartEvent(attributions1, "sync_name",
+//                                          bucketStartTimeNs + 350 * NS_PER_SEC));  // 6:00
+//    events.push_back(CreateSyncStartEvent(attributions1, "sync_name",
+//                                          bucketStartTimeNs + 400 * NS_PER_SEC));  // 6:50
+//    events.push_back(
+//            CreateScreenStateChangedEvent(android::view::DisplayStateEnum::DISPLAY_STATE_ON,
+//                                          bucketStartTimeNs + 450 * NS_PER_SEC));  // 7:40
+//    events.push_back(CreateSyncStartEvent(attributions1, "sync_name",
+//                                          bucketStartTimeNs + 475 * NS_PER_SEC));  // 8:05
+//    events.push_back(
+//            CreateScreenStateChangedEvent(android::view::DisplayStateEnum::DISPLAY_STATE_UNKNOWN,
+//                                          bucketStartTimeNs + 500 * NS_PER_SEC));  // 8:30
+//    events.push_back(CreateSyncStartEvent(attributions1, "sync_name",
+//                                          bucketStartTimeNs + 520 * NS_PER_SEC));  // 8:50
+//
+//    // Send log events to StatsLogProcessor.
+//    for (auto& event : events) {
+//        processor->OnLogEvent(event.get());
+//    }
+//
+//    // Check dump report.
+//    vector<uint8_t> buffer;
+//    ConfigMetricsReportList reports;
+//    processor->onDumpReport(cfgKey, bucketStartTimeNs + bucketSizeNs * 2 + 1, false, true, ADB_DUMP,
+//                            FAST, &buffer);
+//    EXPECT_GT(buffer.size(), 0);
+//    EXPECT_TRUE(reports.ParseFromArray(&buffer[0], buffer.size()));
+//    backfillDimensionPath(&reports);
+//    backfillStringInReport(&reports);
+//    backfillStartEndTimestamp(&reports);
+//
+//    EXPECT_EQ(1, reports.reports_size());
+//    EXPECT_EQ(1, reports.reports(0).metrics_size());
+//    EXPECT_TRUE(reports.reports(0).metrics(0).has_count_metrics());
+//    EXPECT_EQ(3, reports.reports(0).metrics(0).count_metrics().data_size());
+//
+//    // For each CountMetricData, check StateValue info is correct and buckets
+//    // have correct counts.
+//    auto data = reports.reports(0).metrics(0).count_metrics().data(0);
+//    EXPECT_EQ(1, data.slice_by_state_size());
+//    EXPECT_EQ(SCREEN_STATE_ATOM_ID, data.slice_by_state(0).atom_id());
+//    EXPECT_TRUE(data.slice_by_state(0).has_value());
+//    EXPECT_EQ(android::view::DisplayStateEnum::DISPLAY_STATE_ON, data.slice_by_state(0).value());
+//    EXPECT_EQ(2, data.bucket_info_size());
+//    EXPECT_EQ(1, data.bucket_info(0).count());
+//    EXPECT_EQ(1, data.bucket_info(1).count());
+//
+//    data = reports.reports(0).metrics(0).count_metrics().data(1);
+//    EXPECT_EQ(1, data.slice_by_state_size());
+//    EXPECT_EQ(SCREEN_STATE_ATOM_ID, data.slice_by_state(0).atom_id());
+//    EXPECT_TRUE(data.slice_by_state(0).has_value());
+//    EXPECT_EQ(android::view::DisplayStateEnum::DISPLAY_STATE_UNKNOWN, data.slice_by_state(0).value());
+//    EXPECT_EQ(1, data.bucket_info_size());
+//    EXPECT_EQ(1, data.bucket_info(0).count());
+//
+//    data = reports.reports(0).metrics(0).count_metrics().data(2);
+//    EXPECT_EQ(1, data.slice_by_state_size());
+//    EXPECT_EQ(SCREEN_STATE_ATOM_ID, data.slice_by_state(0).atom_id());
+//    EXPECT_TRUE(data.slice_by_state(0).has_value());
+//    EXPECT_EQ(android::view::DisplayStateEnum::DISPLAY_STATE_OFF, data.slice_by_state(0).value());
+//    EXPECT_EQ(2, data.bucket_info_size());
+//    EXPECT_EQ(1, data.bucket_info(0).count());
+//    EXPECT_EQ(2, data.bucket_info(1).count());
+//}
+//
+///**
+// * Test a count metric that has one slice_by_state with a mapping and no
+// * primary fields.
+// *
+// * Once the CountMetricProducer is initialized, it has one atom id in
+// * mSlicedStateAtoms and has one entry per state value in mStateGroupMap.
+// *
+// * One StateTracker tracks the state atom, and it has one listener which is the
+// * CountMetricProducer that was initialized.
+// */
+//TEST(CountMetricE2eTest, TestSlicedStateWithMap) {
+//    // Initialize config.
+//    StatsdConfig config;
+//    config.add_allowed_log_source("AID_ROOT");  // LogEvent defaults to UID of root.
+//
+//    auto syncStartMatcher = CreateSyncStartAtomMatcher();
+//    *config.add_atom_matcher() = syncStartMatcher;
+//
+//    auto state = CreateScreenStateWithOnOffMap();
+//    *config.add_state() = state;
+//
+//    // Create count metric that slices by screen state with on/off map.
+//    int64_t metricId = 123456;
+//    auto countMetric = config.add_count_metric();
+//    countMetric->set_id(metricId);
+//    countMetric->set_what(syncStartMatcher.id());
+//    countMetric->set_bucket(TimeUnit::FIVE_MINUTES);
+//    countMetric->add_slice_by_state(state.id());
+//
+//    // Initialize StatsLogProcessor.
+//    const uint64_t bucketStartTimeNs = 10000000000;  // 0:10
+//    const uint64_t bucketSizeNs =
+//            TimeUnitToBucketSizeInMillis(config.count_metric(0).bucket()) * 1000000LL;
+//    int uid = 12345;
+//    int64_t cfgId = 98765;
+//    ConfigKey cfgKey(uid, cfgId);
+//    auto processor = CreateStatsLogProcessor(bucketStartTimeNs, bucketStartTimeNs, config, cfgKey);
+//
+//    // Check that StateTrackers were initialized correctly.
+//    EXPECT_EQ(1, StateManager::getInstance().getStateTrackersCount());
+//    EXPECT_EQ(1, StateManager::getInstance().getListenersCount(SCREEN_STATE_ATOM_ID));
+//
+//    // Check that CountMetricProducer was initialized correctly.
+//    EXPECT_EQ(processor->mMetricsManagers.size(), 1u);
+//    sp<MetricsManager> metricsManager = processor->mMetricsManagers.begin()->second;
+//    EXPECT_TRUE(metricsManager->isConfigValid());
+//    EXPECT_EQ(metricsManager->mAllMetricProducers.size(), 1);
+//    sp<MetricProducer> metricProducer = metricsManager->mAllMetricProducers[0];
+//    EXPECT_EQ(metricProducer->mSlicedStateAtoms.size(), 1);
+//    EXPECT_EQ(metricProducer->mSlicedStateAtoms.at(0), SCREEN_STATE_ATOM_ID);
+//    EXPECT_EQ(metricProducer->mStateGroupMap.size(), 1);
+//
+//    StateMap map = state.map();
+//    for (auto group : map.group()) {
+//        for (auto value : group.value()) {
+//            EXPECT_EQ(metricProducer->mStateGroupMap[SCREEN_STATE_ATOM_ID][value],
+//                      group.group_id());
+//        }
+//    }
+//
+//    /*
+//               bucket #1                      bucket #2
+//    |     1     2     3     4     5     6     7     8     9     10 (minutes)
+//    |-----------------------------|-----------------------------|--
+//      x   x     x       x    x   x      x         x         x       (syncStartEvents)
+//     -----------------------------------------------------------SCREEN_OFF events
+//       |                                                            (ScreenStateUnknownEvent = 0)
+//             |                  |                                   (ScreenStateOffEvent = 1)
+//                          |                                         (ScreenStateDozeEvent = 3)
+//                                                |                   (ScreenStateDozeSuspendEvent = 4)
+//     -----------------------------------------------------------SCREEN_ON events
+//                   |                                       |        (ScreenStateOnEvent = 2)
+//                      |                                             (ScreenStateVrEvent = 5)
+//                                            |                       (ScreenStateOnSuspendEvent = 6)
+//    */
+//    // Initialize log events - first bucket.
+//    int appUid = 123;
+//    std::vector<AttributionNodeInternal> attributions1 = {CreateAttribution(appUid, "App1")};
+//
+//    std::vector<std::unique_ptr<LogEvent>> events;
+//    events.push_back(CreateSyncStartEvent(attributions1, "sync_name",
+//                                          bucketStartTimeNs + 20 * NS_PER_SEC));  // 0:30
+//    events.push_back(
+//            CreateScreenStateChangedEvent(android::view::DisplayStateEnum::DISPLAY_STATE_UNKNOWN,
+//                                          bucketStartTimeNs + 30 * NS_PER_SEC));  // 0:40
+//    events.push_back(CreateSyncStartEvent(attributions1, "sync_name",
+//                                          bucketStartTimeNs + 60 * NS_PER_SEC));  // 1:10
+//    events.push_back(
+//            CreateScreenStateChangedEvent(android::view::DisplayStateEnum::DISPLAY_STATE_OFF,
+//                                          bucketStartTimeNs + 90 * NS_PER_SEC));  // 1:40
+//    events.push_back(CreateSyncStartEvent(attributions1, "sync_name",
+//                                          bucketStartTimeNs + 120 * NS_PER_SEC));  // 2:10
+//    events.push_back(
+//            CreateScreenStateChangedEvent(android::view::DisplayStateEnum::DISPLAY_STATE_ON,
+//                                          bucketStartTimeNs + 150 * NS_PER_SEC));  // 2:40
+//    events.push_back(
+//            CreateScreenStateChangedEvent(android::view::DisplayStateEnum::DISPLAY_STATE_VR,
+//                                          bucketStartTimeNs + 180 * NS_PER_SEC));  // 3:10
+//    events.push_back(CreateSyncStartEvent(attributions1, "sync_name",
+//                                          bucketStartTimeNs + 200 * NS_PER_SEC));  // 3:30
+//    events.push_back(
+//            CreateScreenStateChangedEvent(android::view::DisplayStateEnum::DISPLAY_STATE_DOZE,
+//                                          bucketStartTimeNs + 210 * NS_PER_SEC));  // 3:40
+//    events.push_back(CreateSyncStartEvent(attributions1, "sync_name",
+//                                          bucketStartTimeNs + 250 * NS_PER_SEC));  // 4:20
+//    events.push_back(
+//            CreateScreenStateChangedEvent(android::view::DisplayStateEnum::DISPLAY_STATE_OFF,
+//                                          bucketStartTimeNs + 280 * NS_PER_SEC));  // 4:50
+//    events.push_back(CreateSyncStartEvent(attributions1, "sync_name",
+//                                          bucketStartTimeNs + 285 * NS_PER_SEC));  // 4:55
+//
+//    // Initialize log events - second bucket.
+//    events.push_back(CreateSyncStartEvent(attributions1, "sync_name",
+//                                          bucketStartTimeNs + 360 * NS_PER_SEC));  // 6:10
+//    events.push_back(
+//            CreateScreenStateChangedEvent(android::view::DisplayStateEnum::DISPLAY_STATE_ON_SUSPEND,
+//                                          bucketStartTimeNs + 390 * NS_PER_SEC));  // 6:40
+//    events.push_back(CreateScreenStateChangedEvent(
+//            android::view::DisplayStateEnum::DISPLAY_STATE_DOZE_SUSPEND,
+//            bucketStartTimeNs + 430 * NS_PER_SEC));  // 7:20
+//    events.push_back(CreateSyncStartEvent(attributions1, "sync_name",
+//                                          bucketStartTimeNs + 440 * NS_PER_SEC));  // 7:30
+//    events.push_back(
+//            CreateScreenStateChangedEvent(android::view::DisplayStateEnum::DISPLAY_STATE_ON,
+//                                          bucketStartTimeNs + 540 * NS_PER_SEC));  // 9:10
+//    events.push_back(CreateSyncStartEvent(attributions1, "sync_name",
+//                                          bucketStartTimeNs + 570 * NS_PER_SEC));  // 9:40
+//
+//    // Send log events to StatsLogProcessor.
+//    for (auto& event : events) {
+//        processor->OnLogEvent(event.get());
+//    }
+//
+//    // Check dump report.
+//    vector<uint8_t> buffer;
+//    ConfigMetricsReportList reports;
+//    processor->onDumpReport(cfgKey, bucketStartTimeNs + bucketSizeNs * 2 + 1, false, true, ADB_DUMP,
+//                            FAST, &buffer);
+//    EXPECT_GT(buffer.size(), 0);
+//    EXPECT_TRUE(reports.ParseFromArray(&buffer[0], buffer.size()));
+//    backfillDimensionPath(&reports);
+//    backfillStringInReport(&reports);
+//    backfillStartEndTimestamp(&reports);
+//
+//    EXPECT_EQ(1, reports.reports_size());
+//    EXPECT_EQ(1, reports.reports(0).metrics_size());
+//    EXPECT_TRUE(reports.reports(0).metrics(0).has_count_metrics());
+//    EXPECT_EQ(3, reports.reports(0).metrics(0).count_metrics().data_size());
+//
+//    // For each CountMetricData, check StateValue info is correct and buckets
+//    // have correct counts.
+//    auto data = reports.reports(0).metrics(0).count_metrics().data(0);
+//    EXPECT_EQ(1, data.slice_by_state_size());
+//    EXPECT_EQ(SCREEN_STATE_ATOM_ID, data.slice_by_state(0).atom_id());
+//    EXPECT_TRUE(data.slice_by_state(0).has_value());
+//    EXPECT_EQ(-1 /* StateTracker::kStateUnknown */, data.slice_by_state(0).value());
+//    EXPECT_EQ(1, data.bucket_info_size());
+//    EXPECT_EQ(1, data.bucket_info(0).count());
+//
+//    data = reports.reports(0).metrics(0).count_metrics().data(1);
+//    EXPECT_EQ(1, data.slice_by_state_size());
+//    EXPECT_EQ(SCREEN_STATE_ATOM_ID, data.slice_by_state(0).atom_id());
+//    EXPECT_TRUE(data.slice_by_state(0).has_group_id());
+//    EXPECT_EQ(StringToId("SCREEN_OFF"), data.slice_by_state(0).group_id());
+//    EXPECT_EQ(2, data.bucket_info_size());
+//    EXPECT_EQ(4, data.bucket_info(0).count());
+//    EXPECT_EQ(2, data.bucket_info(1).count());
+//
+//    data = reports.reports(0).metrics(0).count_metrics().data(2);
+//    EXPECT_EQ(1, data.slice_by_state_size());
+//    EXPECT_EQ(SCREEN_STATE_ATOM_ID, data.slice_by_state(0).atom_id());
+//    EXPECT_TRUE(data.slice_by_state(0).has_group_id());
+//    EXPECT_EQ(StringToId("SCREEN_ON"), data.slice_by_state(0).group_id());
+//    EXPECT_EQ(2, data.bucket_info_size());
+//    EXPECT_EQ(1, data.bucket_info(0).count());
+//    EXPECT_EQ(1, data.bucket_info(1).count());
+//}
+//
+///**
+// * Test a count metric that has one slice_by_state with a primary field.
+//
+// * Once the CountMetricProducer is initialized, it should have one
+// * MetricStateLink stored. State querying using a non-empty primary key
+// * should also work as intended.
+// */
+//TEST(CountMetricE2eTest, TestSlicedStateWithPrimaryFields) {
+//    // Initialize config.
+//    StatsdConfig config;
+//    config.add_allowed_log_source("AID_ROOT");  // LogEvent defaults to UID of root.
+//
+//    auto appCrashMatcher =
+//            CreateSimpleAtomMatcher("APP_CRASH_OCCURRED", android::util::APP_CRASH_OCCURRED);
+//    *config.add_atom_matcher() = appCrashMatcher;
+//
+//    auto state = CreateUidProcessState();
+//    *config.add_state() = state;
+//
+//    // Create count metric that slices by uid process state.
+//    int64_t metricId = 123456;
+//    auto countMetric = config.add_count_metric();
+//    countMetric->set_id(metricId);
+//    countMetric->set_what(appCrashMatcher.id());
+//    countMetric->set_bucket(TimeUnit::FIVE_MINUTES);
+//    countMetric->add_slice_by_state(state.id());
+//    MetricStateLink* stateLink = countMetric->add_state_link();
+//    stateLink->set_state_atom_id(UID_PROCESS_STATE_ATOM_ID);
+//    auto fieldsInWhat = stateLink->mutable_fields_in_what();
+//    *fieldsInWhat = CreateDimensions(android::util::APP_CRASH_OCCURRED, {1 /* uid */});
+//    auto fieldsInState = stateLink->mutable_fields_in_state();
+//    *fieldsInState = CreateDimensions(UID_PROCESS_STATE_ATOM_ID, {1 /* uid */});
+//
+//    // Initialize StatsLogProcessor.
+//    const uint64_t bucketStartTimeNs = 10000000000;  // 0:10
+//    const uint64_t bucketSizeNs =
+//            TimeUnitToBucketSizeInMillis(config.count_metric(0).bucket()) * 1000000LL;
+//    int uid = 12345;
+//    int64_t cfgId = 98765;
+//    ConfigKey cfgKey(uid, cfgId);
+//    auto processor = CreateStatsLogProcessor(bucketStartTimeNs, bucketStartTimeNs, config, cfgKey);
+//
+//    // Check that StateTrackers were initialized correctly.
+//    EXPECT_EQ(1, StateManager::getInstance().getStateTrackersCount());
+//    EXPECT_EQ(1, StateManager::getInstance().getListenersCount(UID_PROCESS_STATE_ATOM_ID));
+//
+//    // Check that CountMetricProducer was initialized correctly.
+//    EXPECT_EQ(processor->mMetricsManagers.size(), 1u);
+//    sp<MetricsManager> metricsManager = processor->mMetricsManagers.begin()->second;
+//    EXPECT_TRUE(metricsManager->isConfigValid());
+//    EXPECT_EQ(metricsManager->mAllMetricProducers.size(), 1);
+//    sp<MetricProducer> metricProducer = metricsManager->mAllMetricProducers[0];
+//    EXPECT_EQ(metricProducer->mSlicedStateAtoms.size(), 1);
+//    EXPECT_EQ(metricProducer->mSlicedStateAtoms.at(0), UID_PROCESS_STATE_ATOM_ID);
+//    EXPECT_EQ(metricProducer->mStateGroupMap.size(), 0);
+//    EXPECT_EQ(metricProducer->mMetric2StateLinks.size(), 1);
+//
+//    /*
+//    NOTE: "1" or "2" represents the uid associated with the state/app crash event
+//               bucket #1                      bucket #2
+//    |     1     2     3     4     5     6     7     8     9     10
+//    |-----------------------------|-----------------------------|--
+//      1   1     1       1    1   2      1         1          2      (AppCrashEvents)
+//     -----------------------------------------------------------PROCESS STATE events
+//             1                  2                                   (ProcessStateTopEvent = 1002)
+//                          1                 1                       (ProcessStateForegroundServiceEvent = 1003)
+//                                                2                   (ProcessStateImportantBackgroundEvent = 1006)
+//        1          1                                       1        (ProcessStateImportantForegroundEvent = 1005)
+//
+//    Based on the diagram above, an AppCrashEvent querying for process state value would return:
+//    - StateTracker::kStateUnknown
+//    - Important foreground
+//    - Top
+//    - Important foreground
+//    - Foreground service
+//    - Top (both the app crash and state still have matching uid = 2)
+//
+//    - Foreground service
+//    - Foreground service
+//    - Important background
+//    */
+//    // Initialize log events - first bucket.
+//    std::vector<std::unique_ptr<LogEvent>> events;
+//    events.push_back(
+//            CreateAppCrashOccurredEvent(1 /* uid */, bucketStartTimeNs + 20 * NS_PER_SEC));  // 0:30
+//    events.push_back(CreateUidProcessStateChangedEvent(
+//            1 /* uid */, android::app::ProcessStateEnum::PROCESS_STATE_IMPORTANT_FOREGROUND,
+//            bucketStartTimeNs + 30 * NS_PER_SEC));  // 0:40
+//    events.push_back(
+//            CreateAppCrashOccurredEvent(1 /* uid */, bucketStartTimeNs + 60 * NS_PER_SEC));  // 1:10
+//    events.push_back(CreateUidProcessStateChangedEvent(
+//            1 /* uid */, android::app::ProcessStateEnum::PROCESS_STATE_TOP,
+//            bucketStartTimeNs + 90 * NS_PER_SEC));  // 1:40
+//    events.push_back(CreateAppCrashOccurredEvent(1 /* uid */,
+//                                                 bucketStartTimeNs + 120 * NS_PER_SEC));  // 2:10
+//    events.push_back(CreateUidProcessStateChangedEvent(
+//            1 /* uid */, android::app::ProcessStateEnum::PROCESS_STATE_IMPORTANT_FOREGROUND,
+//            bucketStartTimeNs + 150 * NS_PER_SEC));  // 2:40
+//    events.push_back(CreateAppCrashOccurredEvent(1 /* uid */,
+//                                                 bucketStartTimeNs + 200 * NS_PER_SEC));  // 3:30
+//    events.push_back(CreateUidProcessStateChangedEvent(
+//            1 /* uid */, android::app::ProcessStateEnum::PROCESS_STATE_FOREGROUND_SERVICE,
+//            bucketStartTimeNs + 210 * NS_PER_SEC));  // 3:40
+//    events.push_back(CreateAppCrashOccurredEvent(1 /* uid */,
+//                                                 bucketStartTimeNs + 250 * NS_PER_SEC));  // 4:20
+//    events.push_back(CreateUidProcessStateChangedEvent(
+//            2 /* uid */, android::app::ProcessStateEnum::PROCESS_STATE_TOP,
+//            bucketStartTimeNs + 280 * NS_PER_SEC));  // 4:50
+//    events.push_back(CreateAppCrashOccurredEvent(2 /* uid */,
+//                                                 bucketStartTimeNs + 285 * NS_PER_SEC));  // 4:55
+//
+//    // Initialize log events - second bucket.
+//    events.push_back(CreateAppCrashOccurredEvent(1 /* uid */,
+//                                                 bucketStartTimeNs + 360 * NS_PER_SEC));  // 6:10
+//    events.push_back(CreateUidProcessStateChangedEvent(
+//            1 /* uid */, android::app::ProcessStateEnum::PROCESS_STATE_FOREGROUND_SERVICE,
+//            bucketStartTimeNs + 390 * NS_PER_SEC));  // 6:40
+//    events.push_back(CreateUidProcessStateChangedEvent(
+//            2 /* uid */, android::app::ProcessStateEnum::PROCESS_STATE_IMPORTANT_BACKGROUND,
+//            bucketStartTimeNs + 430 * NS_PER_SEC));  // 7:20
+//    events.push_back(CreateAppCrashOccurredEvent(1 /* uid */,
+//                                                 bucketStartTimeNs + 440 * NS_PER_SEC));  // 7:30
+//    events.push_back(CreateUidProcessStateChangedEvent(
+//            1 /* uid */, android::app::ProcessStateEnum::PROCESS_STATE_IMPORTANT_FOREGROUND,
+//            bucketStartTimeNs + 540 * NS_PER_SEC));  // 9:10
+//    events.push_back(CreateAppCrashOccurredEvent(2 /* uid */,
+//                                                 bucketStartTimeNs + 570 * NS_PER_SEC));  // 9:40
+//
+//    // Send log events to StatsLogProcessor.
+//    for (auto& event : events) {
+//        processor->OnLogEvent(event.get());
+//    }
+//
+//    // Check dump report.
+//    vector<uint8_t> buffer;
+//    ConfigMetricsReportList reports;
+//    processor->onDumpReport(cfgKey, bucketStartTimeNs + bucketSizeNs * 2 + 1, false, true, ADB_DUMP,
+//                            FAST, &buffer);
+//    EXPECT_GT(buffer.size(), 0);
+//    EXPECT_TRUE(reports.ParseFromArray(&buffer[0], buffer.size()));
+//    backfillDimensionPath(&reports);
+//    backfillStringInReport(&reports);
+//    backfillStartEndTimestamp(&reports);
+//
+//    EXPECT_EQ(1, reports.reports_size());
+//    EXPECT_EQ(1, reports.reports(0).metrics_size());
+//    EXPECT_TRUE(reports.reports(0).metrics(0).has_count_metrics());
+//    EXPECT_EQ(5, reports.reports(0).metrics(0).count_metrics().data_size());
+//
+//    // For each CountMetricData, check StateValue info is correct and buckets
+//    // have correct counts.
+//    auto data = reports.reports(0).metrics(0).count_metrics().data(0);
+//    EXPECT_EQ(1, data.slice_by_state_size());
+//    EXPECT_EQ(UID_PROCESS_STATE_ATOM_ID, data.slice_by_state(0).atom_id());
+//    EXPECT_TRUE(data.slice_by_state(0).has_value());
+//    EXPECT_EQ(android::app::PROCESS_STATE_IMPORTANT_BACKGROUND, data.slice_by_state(0).value());
+//    EXPECT_EQ(1, data.bucket_info_size());
+//    EXPECT_EQ(1, data.bucket_info(0).count());
+//
+//    data = reports.reports(0).metrics(0).count_metrics().data(1);
+//    EXPECT_EQ(1, data.slice_by_state_size());
+//    EXPECT_EQ(UID_PROCESS_STATE_ATOM_ID, data.slice_by_state(0).atom_id());
+//    EXPECT_TRUE(data.slice_by_state(0).has_value());
+//    EXPECT_EQ(-1 /* StateTracker::kStateUnknown */, data.slice_by_state(0).value());
+//    EXPECT_EQ(1, data.bucket_info_size());
+//    EXPECT_EQ(1, data.bucket_info(0).count());
+//
+//    data = reports.reports(0).metrics(0).count_metrics().data(2);
+//    EXPECT_EQ(1, data.slice_by_state_size());
+//    EXPECT_EQ(UID_PROCESS_STATE_ATOM_ID, data.slice_by_state(0).atom_id());
+//    EXPECT_TRUE(data.slice_by_state(0).has_value());
+//    EXPECT_EQ(android::app::PROCESS_STATE_IMPORTANT_FOREGROUND, data.slice_by_state(0).value());
+//    EXPECT_EQ(1, data.bucket_info_size());
+//    EXPECT_EQ(2, data.bucket_info(0).count());
+//
+//    data = reports.reports(0).metrics(0).count_metrics().data(3);
+//    EXPECT_EQ(1, data.slice_by_state_size());
+//    EXPECT_EQ(UID_PROCESS_STATE_ATOM_ID, data.slice_by_state(0).atom_id());
+//    EXPECT_TRUE(data.slice_by_state(0).has_value());
+//    EXPECT_EQ(android::app::PROCESS_STATE_TOP, data.slice_by_state(0).value());
+//    EXPECT_EQ(1, data.bucket_info_size());
+//    EXPECT_EQ(2, data.bucket_info(0).count());
+//
+//    data = reports.reports(0).metrics(0).count_metrics().data(4);
+//    EXPECT_EQ(1, data.slice_by_state_size());
+//    EXPECT_EQ(UID_PROCESS_STATE_ATOM_ID, data.slice_by_state(0).atom_id());
+//    EXPECT_TRUE(data.slice_by_state(0).has_value());
+//    EXPECT_EQ(android::app::PROCESS_STATE_FOREGROUND_SERVICE, data.slice_by_state(0).value());
+//    EXPECT_EQ(2, data.bucket_info_size());
+//    EXPECT_EQ(1, data.bucket_info(0).count());
+//    EXPECT_EQ(2, data.bucket_info(1).count());
+//}
+//
+//TEST(CountMetricE2eTest, TestMultipleSlicedStates) {
+//    // Initialize config.
+//    StatsdConfig config;
+//    config.add_allowed_log_source("AID_ROOT");  // LogEvent defaults to UID of root.
+//
+//    auto appCrashMatcher =
+//            CreateSimpleAtomMatcher("APP_CRASH_OCCURRED", android::util::APP_CRASH_OCCURRED);
+//    *config.add_atom_matcher() = appCrashMatcher;
+//
+//    auto state1 = CreateScreenStateWithOnOffMap();
+//    *config.add_state() = state1;
+//    auto state2 = CreateUidProcessState();
+//    *config.add_state() = state2;
+//
+//    // Create count metric that slices by screen state with on/off map and
+//    // slices by uid process state.
+//    int64_t metricId = 123456;
+//    auto countMetric = config.add_count_metric();
+//    countMetric->set_id(metricId);
+//    countMetric->set_what(appCrashMatcher.id());
+//    countMetric->set_bucket(TimeUnit::FIVE_MINUTES);
+//    countMetric->add_slice_by_state(state1.id());
+//    countMetric->add_slice_by_state(state2.id());
+//    MetricStateLink* stateLink = countMetric->add_state_link();
+//    stateLink->set_state_atom_id(UID_PROCESS_STATE_ATOM_ID);
+//    auto fieldsInWhat = stateLink->mutable_fields_in_what();
+//    *fieldsInWhat = CreateDimensions(android::util::APP_CRASH_OCCURRED, {1 /* uid */});
+//    auto fieldsInState = stateLink->mutable_fields_in_state();
+//    *fieldsInState = CreateDimensions(UID_PROCESS_STATE_ATOM_ID, {1 /* uid */});
+//
+//    // Initialize StatsLogProcessor.
+//    const uint64_t bucketStartTimeNs = 10000000000;  // 0:10
+//    const uint64_t bucketSizeNs =
+//            TimeUnitToBucketSizeInMillis(config.count_metric(0).bucket()) * 1000000LL;
+//    int uid = 12345;
+//    int64_t cfgId = 98765;
+//    ConfigKey cfgKey(uid, cfgId);
+//    auto processor = CreateStatsLogProcessor(bucketStartTimeNs, bucketStartTimeNs, config, cfgKey);
+//
+//    // Check that StateTrackers were properly initialized.
+//    EXPECT_EQ(2, StateManager::getInstance().getStateTrackersCount());
+//    EXPECT_EQ(1, StateManager::getInstance().getListenersCount(SCREEN_STATE_ATOM_ID));
+//    EXPECT_EQ(1, StateManager::getInstance().getListenersCount(UID_PROCESS_STATE_ATOM_ID));
+//
+//    // Check that CountMetricProducer was initialized correctly.
+//    EXPECT_EQ(processor->mMetricsManagers.size(), 1u);
+//    sp<MetricsManager> metricsManager = processor->mMetricsManagers.begin()->second;
+//    EXPECT_TRUE(metricsManager->isConfigValid());
+//    EXPECT_EQ(metricsManager->mAllMetricProducers.size(), 1);
+//    sp<MetricProducer> metricProducer = metricsManager->mAllMetricProducers[0];
+//    EXPECT_EQ(metricProducer->mSlicedStateAtoms.size(), 2);
+//    EXPECT_EQ(metricProducer->mSlicedStateAtoms.at(0), SCREEN_STATE_ATOM_ID);
+//    EXPECT_EQ(metricProducer->mSlicedStateAtoms.at(1), UID_PROCESS_STATE_ATOM_ID);
+//    EXPECT_EQ(metricProducer->mStateGroupMap.size(), 1);
+//    EXPECT_EQ(metricProducer->mMetric2StateLinks.size(), 1);
+//
+//    StateMap map = state1.map();
+//    for (auto group : map.group()) {
+//        for (auto value : group.value()) {
+//            EXPECT_EQ(metricProducer->mStateGroupMap[SCREEN_STATE_ATOM_ID][value],
+//                      group.group_id());
+//        }
+//    }
+//
+//    /*
+//               bucket #1                      bucket #2
+//    |     1     2     3     4     5     6     7     8     9     10 (minutes)
+//    |-----------------------------|-----------------------------|--
+//      1   1     1       1    1   2      1         1           2     (AppCrashEvents)
+//     -----------------------------------------------------------SCREEN_OFF events
+//       |                                                            (ScreenStateUnknownEvent = 0)
+//             |                                  |                   (ScreenStateOffEvent = 1)
+//                          |                                         (ScreenStateDozeEvent = 3)
+//     -----------------------------------------------------------SCREEN_ON events
+//                    |                                    |          (ScreenStateOnEvent = 2)
+//                                            |                       (ScreenStateOnSuspendEvent = 6)
+//     -----------------------------------------------------------PROCESS STATE events
+//             1                  2                                   (ProcessStateTopEvent = 1002)
+//                                          1                         (ProcessStateForegroundServiceEvent = 1003)
+//                                               2                    (ProcessStateImportantBackgroundEvent = 1006)
+//     1             1                                       1        (ProcessStateImportantForegroundEvent = 1005)
+//
+//     Based on the diagram above, Screen State / Process State pairs for each
+//     AppCrashEvent are:
+//     - StateTracker::kStateUnknown / important foreground
+//     - off / important foreground
+//     - off / Top
+//     - on / important foreground
+//     - off / important foreground
+//     - off / top
+//
+//     - off / important foreground
+//     - off / foreground service
+//     - on / important background
+//
+//    */
+//    // Initialize log events - first bucket.
+//    std::vector<std::unique_ptr<LogEvent>> events;
+//    events.push_back(CreateUidProcessStateChangedEvent(
+//            1 /* uid */, android::app::ProcessStateEnum::PROCESS_STATE_IMPORTANT_FOREGROUND,
+//            bucketStartTimeNs + 5 * NS_PER_SEC));  // 0:15
+//    events.push_back(
+//            CreateAppCrashOccurredEvent(1 /* uid */, bucketStartTimeNs + 20 * NS_PER_SEC));  // 0:30
+//    events.push_back(
+//            CreateScreenStateChangedEvent(android::view::DisplayStateEnum::DISPLAY_STATE_UNKNOWN,
+//                                          bucketStartTimeNs + 30 * NS_PER_SEC));  // 0:40
+//    events.push_back(
+//            CreateAppCrashOccurredEvent(1 /* uid */, bucketStartTimeNs + 60 * NS_PER_SEC));  // 1:10
+//    events.push_back(CreateUidProcessStateChangedEvent(
+//            1 /* uid */, android::app::ProcessStateEnum::PROCESS_STATE_TOP,
+//            bucketStartTimeNs + 90 * NS_PER_SEC));  // 1:40
+//    events.push_back(
+//            CreateScreenStateChangedEvent(android::view::DisplayStateEnum::DISPLAY_STATE_OFF,
+//                                          bucketStartTimeNs + 90 * NS_PER_SEC));  // 1:40
+//    events.push_back(CreateAppCrashOccurredEvent(1 /* uid */,
+//                                                 bucketStartTimeNs + 120 * NS_PER_SEC));  // 2:10
+//    events.push_back(CreateUidProcessStateChangedEvent(
+//            1 /* uid */, android::app::ProcessStateEnum::PROCESS_STATE_IMPORTANT_FOREGROUND,
+//            bucketStartTimeNs + 150 * NS_PER_SEC));  // 2:40
+//    events.push_back(
+//            CreateScreenStateChangedEvent(android::view::DisplayStateEnum::DISPLAY_STATE_ON,
+//                                          bucketStartTimeNs + 160 * NS_PER_SEC));  // 2:50
+//    events.push_back(CreateAppCrashOccurredEvent(1 /* uid */,
+//                                                 bucketStartTimeNs + 200 * NS_PER_SEC));  // 3:30
+//    events.push_back(
+//            CreateScreenStateChangedEvent(android::view::DisplayStateEnum::DISPLAY_STATE_DOZE,
+//                                          bucketStartTimeNs + 210 * NS_PER_SEC));  // 3:40
+//    events.push_back(CreateAppCrashOccurredEvent(1 /* uid */,
+//                                                 bucketStartTimeNs + 250 * NS_PER_SEC));  // 4:20
+//    events.push_back(CreateUidProcessStateChangedEvent(
+//            2 /* uid */, android::app::ProcessStateEnum::PROCESS_STATE_TOP,
+//            bucketStartTimeNs + 280 * NS_PER_SEC));  // 4:50
+//    events.push_back(CreateAppCrashOccurredEvent(2 /* uid */,
+//                                                 bucketStartTimeNs + 285 * NS_PER_SEC));  // 4:55
+//
+//    // Initialize log events - second bucket.
+//    events.push_back(CreateAppCrashOccurredEvent(1 /* uid */,
+//                                                 bucketStartTimeNs + 360 * NS_PER_SEC));  // 6:10
+//    events.push_back(CreateUidProcessStateChangedEvent(
+//            1 /* uid */, android::app::ProcessStateEnum::PROCESS_STATE_FOREGROUND_SERVICE,
+//            bucketStartTimeNs + 380 * NS_PER_SEC));  // 6:30
+//    events.push_back(
+//            CreateScreenStateChangedEvent(android::view::DisplayStateEnum::DISPLAY_STATE_ON_SUSPEND,
+//                                          bucketStartTimeNs + 390 * NS_PER_SEC));  // 6:40
+//    events.push_back(CreateUidProcessStateChangedEvent(
+//            2 /* uid */, android::app::ProcessStateEnum::PROCESS_STATE_IMPORTANT_BACKGROUND,
+//            bucketStartTimeNs + 420 * NS_PER_SEC));  // 7:10
+//    events.push_back(
+//            CreateScreenStateChangedEvent(android::view::DisplayStateEnum::DISPLAY_STATE_OFF,
+//                                          bucketStartTimeNs + 440 * NS_PER_SEC));  // 7:30
+//    events.push_back(CreateAppCrashOccurredEvent(1 /* uid */,
+//                                                 bucketStartTimeNs + 450 * NS_PER_SEC));  // 7:40
+//    events.push_back(
+//            CreateScreenStateChangedEvent(android::view::DisplayStateEnum::DISPLAY_STATE_ON,
+//                                          bucketStartTimeNs + 520 * NS_PER_SEC));  // 8:50
+//    events.push_back(CreateUidProcessStateChangedEvent(
+//            1 /* uid */, android::app::ProcessStateEnum::PROCESS_STATE_IMPORTANT_FOREGROUND,
+//            bucketStartTimeNs + 540 * NS_PER_SEC));  // 9:10
+//    events.push_back(CreateAppCrashOccurredEvent(2 /* uid */,
+//                                                 bucketStartTimeNs + 570 * NS_PER_SEC));  // 9:40
+//
+//    // Send log events to StatsLogProcessor.
+//    for (auto& event : events) {
+//        processor->OnLogEvent(event.get());
+//    }
+//
+//    // Check dump report.
+//    vector<uint8_t> buffer;
+//    ConfigMetricsReportList reports;
+//    processor->onDumpReport(cfgKey, bucketStartTimeNs + bucketSizeNs * 2 + 1, false, true, ADB_DUMP,
+//                            FAST, &buffer);
+//    EXPECT_GT(buffer.size(), 0);
+//    EXPECT_TRUE(reports.ParseFromArray(&buffer[0], buffer.size()));
+//    backfillDimensionPath(&reports);
+//    backfillStringInReport(&reports);
+//    backfillStartEndTimestamp(&reports);
+//
+//    EXPECT_EQ(1, reports.reports_size());
+//    EXPECT_EQ(1, reports.reports(0).metrics_size());
+//    EXPECT_TRUE(reports.reports(0).metrics(0).has_count_metrics());
+//    EXPECT_EQ(6, reports.reports(0).metrics(0).count_metrics().data_size());
+//
+//    // For each CountMetricData, check StateValue info is correct and buckets
+//    // have correct counts.
+//    auto data = reports.reports(0).metrics(0).count_metrics().data(0);
+//    EXPECT_EQ(2, data.slice_by_state_size());
+//    EXPECT_EQ(SCREEN_STATE_ATOM_ID, data.slice_by_state(0).atom_id());
+//    EXPECT_TRUE(data.slice_by_state(0).has_group_id());
+//    EXPECT_EQ(StringToId("SCREEN_OFF"), data.slice_by_state(0).group_id());
+//    EXPECT_EQ(UID_PROCESS_STATE_ATOM_ID, data.slice_by_state(1).atom_id());
+//    EXPECT_TRUE(data.slice_by_state(1).has_value());
+//    EXPECT_EQ(android::app::PROCESS_STATE_FOREGROUND_SERVICE, data.slice_by_state(1).value());
+//    EXPECT_EQ(1, data.bucket_info_size());
+//    EXPECT_EQ(1, data.bucket_info(0).count());
+//
+//    data = reports.reports(0).metrics(0).count_metrics().data(1);
+//    EXPECT_EQ(2, data.slice_by_state_size());
+//    EXPECT_EQ(SCREEN_STATE_ATOM_ID, data.slice_by_state(0).atom_id());
+//    EXPECT_TRUE(data.slice_by_state(0).has_value());
+//    EXPECT_EQ(-1, data.slice_by_state(0).value());
+//    EXPECT_EQ(UID_PROCESS_STATE_ATOM_ID, data.slice_by_state(1).atom_id());
+//    EXPECT_TRUE(data.slice_by_state(1).has_value());
+//    EXPECT_EQ(android::app::PROCESS_STATE_IMPORTANT_FOREGROUND, data.slice_by_state(1).value());
+//    EXPECT_EQ(1, data.bucket_info_size());
+//    EXPECT_EQ(1, data.bucket_info(0).count());
+//
+//    data = reports.reports(0).metrics(0).count_metrics().data(2);
+//    EXPECT_EQ(2, data.slice_by_state_size());
+//    EXPECT_EQ(SCREEN_STATE_ATOM_ID, data.slice_by_state(0).atom_id());
+//    EXPECT_TRUE(data.slice_by_state(0).has_group_id());
+//    EXPECT_EQ(StringToId("SCREEN_OFF"), data.slice_by_state(0).group_id());
+//    EXPECT_EQ(UID_PROCESS_STATE_ATOM_ID, data.slice_by_state(1).atom_id());
+//    EXPECT_TRUE(data.slice_by_state(1).has_value());
+//    EXPECT_EQ(android::app::PROCESS_STATE_IMPORTANT_FOREGROUND, data.slice_by_state(1).value());
+//    EXPECT_EQ(2, data.bucket_info_size());
+//    EXPECT_EQ(2, data.bucket_info(0).count());
+//    EXPECT_EQ(1, data.bucket_info(1).count());
+//
+//    data = reports.reports(0).metrics(0).count_metrics().data(3);
+//    EXPECT_EQ(2, data.slice_by_state_size());
+//    EXPECT_EQ(SCREEN_STATE_ATOM_ID, data.slice_by_state(0).atom_id());
+//    EXPECT_TRUE(data.slice_by_state(0).has_group_id());
+//    EXPECT_EQ(StringToId("SCREEN_ON"), data.slice_by_state(0).group_id());
+//    EXPECT_EQ(UID_PROCESS_STATE_ATOM_ID, data.slice_by_state(1).atom_id());
+//    EXPECT_TRUE(data.slice_by_state(1).has_value());
+//    EXPECT_EQ(android::app::PROCESS_STATE_IMPORTANT_FOREGROUND, data.slice_by_state(1).value());
+//    EXPECT_EQ(1, data.bucket_info_size());
+//    EXPECT_EQ(1, data.bucket_info(0).count());
+//
+//    data = reports.reports(0).metrics(0).count_metrics().data(4);
+//    EXPECT_EQ(2, data.slice_by_state_size());
+//    EXPECT_EQ(SCREEN_STATE_ATOM_ID, data.slice_by_state(0).atom_id());
+//    EXPECT_TRUE(data.slice_by_state(0).has_group_id());
+//    EXPECT_EQ(StringToId("SCREEN_ON"), data.slice_by_state(0).group_id());
+//    EXPECT_EQ(UID_PROCESS_STATE_ATOM_ID, data.slice_by_state(1).atom_id());
+//    EXPECT_TRUE(data.slice_by_state(1).has_value());
+//    EXPECT_EQ(android::app::PROCESS_STATE_IMPORTANT_BACKGROUND, data.slice_by_state(1).value());
+//    EXPECT_EQ(1, data.bucket_info_size());
+//    EXPECT_EQ(1, data.bucket_info(0).count());
+//
+//    data = reports.reports(0).metrics(0).count_metrics().data(5);
+//    EXPECT_EQ(2, data.slice_by_state_size());
+//    EXPECT_EQ(SCREEN_STATE_ATOM_ID, data.slice_by_state(0).atom_id());
+//    EXPECT_TRUE(data.slice_by_state(0).has_group_id());
+//    EXPECT_EQ(StringToId("SCREEN_OFF"), data.slice_by_state(0).group_id());
+//    EXPECT_EQ(UID_PROCESS_STATE_ATOM_ID, data.slice_by_state(1).atom_id());
+//    EXPECT_TRUE(data.slice_by_state(1).has_value());
+//    EXPECT_EQ(android::app::PROCESS_STATE_TOP, data.slice_by_state(1).value());
+//    EXPECT_EQ(1, data.bucket_info_size());
+//    EXPECT_EQ(2, data.bucket_info(0).count());
+//}
 
 }  // namespace statsd
 }  // namespace os
diff --git a/cmds/statsd/tests/e2e/DurationMetric_e2e_test.cpp b/cmds/statsd/tests/e2e/DurationMetric_e2e_test.cpp
index 9093155..8eb5f69 100644
--- a/cmds/statsd/tests/e2e/DurationMetric_e2e_test.cpp
+++ b/cmds/statsd/tests/e2e/DurationMetric_e2e_test.cpp
@@ -26,687 +26,688 @@
 
 #ifdef __ANDROID__
 
-TEST(DurationMetricE2eTest, TestOneBucket) {
-    StatsdConfig config;
-    config.add_allowed_log_source("AID_ROOT"); // LogEvent defaults to UID of root.
-
-    auto screenOnMatcher = CreateScreenTurnedOnAtomMatcher();
-    auto screenOffMatcher = CreateScreenTurnedOffAtomMatcher();
-    *config.add_atom_matcher() = screenOnMatcher;
-    *config.add_atom_matcher() = screenOffMatcher;
-
-    auto durationPredicate = CreateScreenIsOnPredicate();
-    *config.add_predicate() = durationPredicate;
-
-    int64_t metricId = 123456;
-    auto durationMetric = config.add_duration_metric();
-    durationMetric->set_id(metricId);
-    durationMetric->set_what(durationPredicate.id());
-    durationMetric->set_bucket(FIVE_MINUTES);
-    durationMetric->set_aggregation_type(DurationMetric_AggregationType_SUM);
-
-
-    const int64_t baseTimeNs = 0; // 0:00
-    const int64_t configAddedTimeNs = baseTimeNs + 1 * NS_PER_SEC; // 0:01
-    const int64_t bucketSizeNs =
-            TimeUnitToBucketSizeInMillis(config.duration_metric(0).bucket()) * 1000LL * 1000LL;
-
-    int uid = 12345;
-    int64_t cfgId = 98765;
-    ConfigKey cfgKey(uid, cfgId);
-
-    auto processor = CreateStatsLogProcessor(baseTimeNs, configAddedTimeNs, config, cfgKey);
-
-    EXPECT_EQ(processor->mMetricsManagers.size(), 1u);
-    sp<MetricsManager> metricsManager = processor->mMetricsManagers.begin()->second;
-    EXPECT_TRUE(metricsManager->isConfigValid());
-    EXPECT_EQ(metricsManager->mAllMetricProducers.size(), 1);
-    sp<MetricProducer> metricProducer = metricsManager->mAllMetricProducers[0];
-    EXPECT_TRUE(metricsManager->isActive());
-    EXPECT_TRUE(metricProducer->mIsActive);
-
-    std::unique_ptr<LogEvent> event;
-
-    // Screen is off at start of bucket.
-    event = CreateScreenStateChangedEvent(
-            android::view::DISPLAY_STATE_OFF, configAddedTimeNs); // 0:01
-    processor->OnLogEvent(event.get());
-
-    // Turn screen on.
-    const int64_t durationStartNs = configAddedTimeNs + 10 * NS_PER_SEC; // 0:11
-    event = CreateScreenStateChangedEvent(android::view::DISPLAY_STATE_ON, durationStartNs);
-    processor->OnLogEvent(event.get());
-
-    // Turn off screen 30 seconds after turning on.
-    const int64_t durationEndNs = durationStartNs + 30 * NS_PER_SEC; // 0:41
-    event = CreateScreenStateChangedEvent(android::view::DISPLAY_STATE_OFF, durationEndNs);
-    processor->OnLogEvent(event.get());
-
-    event = CreateScreenBrightnessChangedEvent(64, durationEndNs + 1 * NS_PER_SEC); // 0:42
-    processor->OnLogEvent(event.get());
-
-    ConfigMetricsReportList reports;
-    vector<uint8_t> buffer;
-    processor->onDumpReport(cfgKey, configAddedTimeNs + bucketSizeNs + 1 * NS_PER_SEC, false, true,
-                            ADB_DUMP, FAST, &buffer); // 5:01
-    EXPECT_TRUE(buffer.size() > 0);
-    EXPECT_TRUE(reports.ParseFromArray(&buffer[0], buffer.size()));
-    backfillDimensionPath(&reports);
-    backfillStartEndTimestamp(&reports);
-    EXPECT_EQ(1, reports.reports_size());
-    EXPECT_EQ(1, reports.reports(0).metrics_size());
-    EXPECT_EQ(metricId, reports.reports(0).metrics(0).metric_id());
-    EXPECT_TRUE(reports.reports(0).metrics(0).has_duration_metrics());
-
-    const StatsLogReport::DurationMetricDataWrapper& durationMetrics =
-            reports.reports(0).metrics(0).duration_metrics();
-    EXPECT_EQ(1, durationMetrics.data_size());
-
-    auto data = durationMetrics.data(0);
-    EXPECT_EQ(1, data.bucket_info_size());
-    EXPECT_EQ(durationEndNs - durationStartNs, data.bucket_info(0).duration_nanos());
-    EXPECT_EQ(configAddedTimeNs, data.bucket_info(0).start_bucket_elapsed_nanos());
-    EXPECT_EQ(baseTimeNs + bucketSizeNs, data.bucket_info(0).end_bucket_elapsed_nanos());
-}
-
-TEST(DurationMetricE2eTest, TestTwoBuckets) {
-    StatsdConfig config;
-    config.add_allowed_log_source("AID_ROOT"); // LogEvent defaults to UID of root.
-
-    auto screenOnMatcher = CreateScreenTurnedOnAtomMatcher();
-    auto screenOffMatcher = CreateScreenTurnedOffAtomMatcher();
-    *config.add_atom_matcher() = screenOnMatcher;
-    *config.add_atom_matcher() = screenOffMatcher;
-
-    auto durationPredicate = CreateScreenIsOnPredicate();
-    *config.add_predicate() = durationPredicate;
-
-    int64_t metricId = 123456;
-    auto durationMetric = config.add_duration_metric();
-    durationMetric->set_id(metricId);
-    durationMetric->set_what(durationPredicate.id());
-    durationMetric->set_bucket(FIVE_MINUTES);
-    durationMetric->set_aggregation_type(DurationMetric_AggregationType_SUM);
-
-
-    const int64_t baseTimeNs = 0; // 0:00
-    const int64_t configAddedTimeNs = baseTimeNs + 1 * NS_PER_SEC; // 0:01
-    const int64_t bucketSizeNs =
-            TimeUnitToBucketSizeInMillis(config.duration_metric(0).bucket()) * 1000LL * 1000LL;
-
-    int uid = 12345;
-    int64_t cfgId = 98765;
-    ConfigKey cfgKey(uid, cfgId);
-
-    auto processor = CreateStatsLogProcessor(baseTimeNs, configAddedTimeNs, config, cfgKey);
-
-    EXPECT_EQ(processor->mMetricsManagers.size(), 1u);
-    sp<MetricsManager> metricsManager = processor->mMetricsManagers.begin()->second;
-    EXPECT_TRUE(metricsManager->isConfigValid());
-    EXPECT_EQ(metricsManager->mAllMetricProducers.size(), 1);
-    sp<MetricProducer> metricProducer = metricsManager->mAllMetricProducers[0];
-    EXPECT_TRUE(metricsManager->isActive());
-    EXPECT_TRUE(metricProducer->mIsActive);
-
-    std::unique_ptr<LogEvent> event;
-
-    // Screen is off at start of bucket.
-    event = CreateScreenStateChangedEvent(
-            android::view::DISPLAY_STATE_OFF, configAddedTimeNs); // 0:01
-    processor->OnLogEvent(event.get());
-
-    // Turn screen on.
-    const int64_t durationStartNs = configAddedTimeNs + 10 * NS_PER_SEC; // 0:11
-    event = CreateScreenStateChangedEvent(android::view::DISPLAY_STATE_ON, durationStartNs);
-    processor->OnLogEvent(event.get());
-
-    // Turn off screen 30 seconds after turning on.
-    const int64_t durationEndNs = durationStartNs + 30 * NS_PER_SEC; // 0:41
-    event = CreateScreenStateChangedEvent(android::view::DISPLAY_STATE_OFF, durationEndNs);
-    processor->OnLogEvent(event.get());
-
-    event = CreateScreenBrightnessChangedEvent(64, durationEndNs + 1 * NS_PER_SEC); // 0:42
-    processor->OnLogEvent(event.get());
-
-    ConfigMetricsReportList reports;
-    vector<uint8_t> buffer;
-    processor->onDumpReport(cfgKey, configAddedTimeNs + 2 * bucketSizeNs + 1 * NS_PER_SEC, false, true,
-                            ADB_DUMP, FAST, &buffer); // 10:01
-    EXPECT_TRUE(buffer.size() > 0);
-    EXPECT_TRUE(reports.ParseFromArray(&buffer[0], buffer.size()));
-    backfillDimensionPath(&reports);
-    backfillStartEndTimestamp(&reports);
-    EXPECT_EQ(1, reports.reports_size());
-    EXPECT_EQ(1, reports.reports(0).metrics_size());
-    EXPECT_EQ(metricId, reports.reports(0).metrics(0).metric_id());
-    EXPECT_TRUE(reports.reports(0).metrics(0).has_duration_metrics());
-
-    const StatsLogReport::DurationMetricDataWrapper& durationMetrics =
-            reports.reports(0).metrics(0).duration_metrics();
-    EXPECT_EQ(1, durationMetrics.data_size());
-
-    auto data = durationMetrics.data(0);
-    EXPECT_EQ(1, data.bucket_info_size());
-
-    auto bucketInfo = data.bucket_info(0);
-    EXPECT_EQ(0, bucketInfo.bucket_num());
-    EXPECT_EQ(durationEndNs - durationStartNs, bucketInfo.duration_nanos());
-    EXPECT_EQ(configAddedTimeNs, bucketInfo.start_bucket_elapsed_nanos());
-    EXPECT_EQ(baseTimeNs + bucketSizeNs, bucketInfo.end_bucket_elapsed_nanos());
-}
-
-TEST(DurationMetricE2eTest, TestWithActivation) {
-    StatsdConfig config;
-    config.add_allowed_log_source("AID_ROOT"); // LogEvent defaults to UID of root.
-
-    auto screenOnMatcher = CreateScreenTurnedOnAtomMatcher();
-    auto screenOffMatcher = CreateScreenTurnedOffAtomMatcher();
-    auto crashMatcher = CreateProcessCrashAtomMatcher();
-    *config.add_atom_matcher() = screenOnMatcher;
-    *config.add_atom_matcher() = screenOffMatcher;
-    *config.add_atom_matcher() = crashMatcher;
-
-    auto durationPredicate = CreateScreenIsOnPredicate();
-    *config.add_predicate() = durationPredicate;
-
-    int64_t metricId = 123456;
-    auto durationMetric = config.add_duration_metric();
-    durationMetric->set_id(metricId);
-    durationMetric->set_what(durationPredicate.id());
-    durationMetric->set_bucket(FIVE_MINUTES);
-    durationMetric->set_aggregation_type(DurationMetric_AggregationType_SUM);
-
-    auto metric_activation1 = config.add_metric_activation();
-    metric_activation1->set_metric_id(metricId);
-    auto event_activation1 = metric_activation1->add_event_activation();
-    event_activation1->set_atom_matcher_id(crashMatcher.id());
-    event_activation1->set_ttl_seconds(30); // 30 secs.
-
-    const int64_t bucketStartTimeNs = 10000000000;
-    const int64_t bucketSizeNs =
-            TimeUnitToBucketSizeInMillis(config.duration_metric(0).bucket()) * 1000LL * 1000LL;
-
-    int uid = 12345;
-    int64_t cfgId = 98765;
-    ConfigKey cfgKey(uid, cfgId);
-
-    sp<UidMap> m = new UidMap();
-    sp<StatsPullerManager> pullerManager = new StatsPullerManager();
-    sp<AlarmMonitor> anomalyAlarmMonitor;
-    sp<AlarmMonitor> subscriberAlarmMonitor;
-    vector<int64_t> activeConfigsBroadcast;
-
-    int broadcastCount = 0;
-    StatsLogProcessor processor(m, pullerManager, anomalyAlarmMonitor, subscriberAlarmMonitor,
-            bucketStartTimeNs, [](const ConfigKey& key) { return true; },
-            [&uid, &broadcastCount, &activeConfigsBroadcast](const int& broadcastUid,
-                    const vector<int64_t>& activeConfigs) {
-                broadcastCount++;
-                EXPECT_EQ(broadcastUid, uid);
-                activeConfigsBroadcast.clear();
-                activeConfigsBroadcast.insert(activeConfigsBroadcast.end(),
-                        activeConfigs.begin(), activeConfigs.end());
-                return true;
-            });
-
-    processor.OnConfigUpdated(bucketStartTimeNs, cfgKey, config); // 0:00
-
-    EXPECT_EQ(processor.mMetricsManagers.size(), 1u);
-    sp<MetricsManager> metricsManager = processor.mMetricsManagers.begin()->second;
-    EXPECT_TRUE(metricsManager->isConfigValid());
-    EXPECT_EQ(metricsManager->mAllMetricProducers.size(), 1);
-    sp<MetricProducer> metricProducer = metricsManager->mAllMetricProducers[0];
-    auto& eventActivationMap = metricProducer->mEventActivationMap;
-
-    EXPECT_FALSE(metricsManager->isActive());
-    EXPECT_FALSE(metricProducer->mIsActive);
-    EXPECT_EQ(eventActivationMap.size(), 1u);
-    EXPECT_TRUE(eventActivationMap.find(2) != eventActivationMap.end());
-    EXPECT_EQ(eventActivationMap[2]->state, ActivationState::kNotActive);
-    EXPECT_EQ(eventActivationMap[2]->start_ns, 0);
-    EXPECT_EQ(eventActivationMap[2]->ttl_ns, event_activation1->ttl_seconds() * NS_PER_SEC);
-
-    std::unique_ptr<LogEvent> event;
-
-    // Turn screen off.
-    event = CreateScreenStateChangedEvent(
-            android::view::DISPLAY_STATE_OFF, bucketStartTimeNs + 2 * NS_PER_SEC); // 0:02
-    processor.OnLogEvent(event.get(), bucketStartTimeNs + 2 * NS_PER_SEC);
-
-    // Turn screen on.
-    const int64_t durationStartNs = bucketStartTimeNs + 5 * NS_PER_SEC; // 0:05
-    event = CreateScreenStateChangedEvent(android::view::DISPLAY_STATE_ON, durationStartNs);
-    processor.OnLogEvent(event.get(), durationStartNs);
-
-    // Activate metric.
-    const int64_t activationStartNs = bucketStartTimeNs + 5 * NS_PER_SEC; // 0:10
-    const int64_t activationEndNs =
-            activationStartNs + event_activation1->ttl_seconds() * NS_PER_SEC; // 0:40
-    event = CreateAppCrashEvent(111, activationStartNs);
-    processor.OnLogEvent(event.get(), activationStartNs);
-    EXPECT_TRUE(metricsManager->isActive());
-    EXPECT_TRUE(metricProducer->mIsActive);
-    EXPECT_EQ(broadcastCount, 1);
-    EXPECT_EQ(activeConfigsBroadcast.size(), 1);
-    EXPECT_EQ(activeConfigsBroadcast[0], cfgId);
-    EXPECT_EQ(eventActivationMap[2]->state, ActivationState::kActive);
-    EXPECT_EQ(eventActivationMap[2]->start_ns, activationStartNs);
-    EXPECT_EQ(eventActivationMap[2]->ttl_ns, event_activation1->ttl_seconds() * NS_PER_SEC);
-
-    // Expire activation.
-    const int64_t expirationNs = activationEndNs + 7 * NS_PER_SEC;
-    event = CreateScreenBrightnessChangedEvent(64, expirationNs); // 0:47
-    processor.OnLogEvent(event.get(), expirationNs);
-    EXPECT_FALSE(metricsManager->isActive());
-    EXPECT_FALSE(metricProducer->mIsActive);
-    EXPECT_EQ(broadcastCount, 2);
-    EXPECT_EQ(activeConfigsBroadcast.size(), 0);
-    EXPECT_EQ(eventActivationMap.size(), 1u);
-    EXPECT_TRUE(eventActivationMap.find(2) != eventActivationMap.end());
-    EXPECT_EQ(eventActivationMap[2]->state, ActivationState::kNotActive);
-    EXPECT_EQ(eventActivationMap[2]->start_ns, activationStartNs);
-    EXPECT_EQ(eventActivationMap[2]->ttl_ns, event_activation1->ttl_seconds() * NS_PER_SEC);
-
-    // Turn off screen 10 seconds after activation expiration.
-    const int64_t durationEndNs = activationEndNs + 10 * NS_PER_SEC; // 0:50
-    event = CreateScreenStateChangedEvent(android::view::DISPLAY_STATE_OFF, durationEndNs);
-    processor.OnLogEvent(event.get(),durationEndNs);
-
-    // Turn screen on.
-    const int64_t duration2StartNs = durationEndNs + 5 * NS_PER_SEC; // 0:55
-    event = CreateScreenStateChangedEvent(android::view::DISPLAY_STATE_ON, duration2StartNs);
-    processor.OnLogEvent(event.get(), duration2StartNs);
-
-    // Turn off screen.
-    const int64_t duration2EndNs = duration2StartNs + 10 * NS_PER_SEC; // 1:05
-    event = CreateScreenStateChangedEvent(android::view::DISPLAY_STATE_OFF, duration2EndNs);
-    processor.OnLogEvent(event.get(), duration2EndNs);
-
-    // Activate metric.
-    const int64_t activation2StartNs = duration2EndNs + 5 * NS_PER_SEC; // 1:10
-    const int64_t activation2EndNs =
-            activation2StartNs + event_activation1->ttl_seconds() * NS_PER_SEC; // 1:40
-    event = CreateAppCrashEvent(211, activation2StartNs);
-    processor.OnLogEvent(event.get(), activation2StartNs);
-    EXPECT_TRUE(metricsManager->isActive());
-    EXPECT_TRUE(metricProducer->mIsActive);
-    EXPECT_EQ(broadcastCount, 3);
-    EXPECT_EQ(activeConfigsBroadcast.size(), 1);
-    EXPECT_EQ(activeConfigsBroadcast[0], cfgId);
-    EXPECT_EQ(eventActivationMap[2]->state, ActivationState::kActive);
-    EXPECT_EQ(eventActivationMap[2]->start_ns, activation2StartNs);
-    EXPECT_EQ(eventActivationMap[2]->ttl_ns, event_activation1->ttl_seconds() * NS_PER_SEC);
-
-    ConfigMetricsReportList reports;
-    vector<uint8_t> buffer;
-    processor.onDumpReport(cfgKey, bucketStartTimeNs + bucketSizeNs + 1 * NS_PER_SEC, false, true,
-                            ADB_DUMP, FAST, &buffer); // 5:01
-    EXPECT_TRUE(buffer.size() > 0);
-    EXPECT_TRUE(reports.ParseFromArray(&buffer[0], buffer.size()));
-    backfillDimensionPath(&reports);
-    backfillStartEndTimestamp(&reports);
-    EXPECT_EQ(1, reports.reports_size());
-    EXPECT_EQ(1, reports.reports(0).metrics_size());
-    EXPECT_EQ(metricId, reports.reports(0).metrics(0).metric_id());
-    EXPECT_TRUE(reports.reports(0).metrics(0).has_duration_metrics());
-
-    const StatsLogReport::DurationMetricDataWrapper& durationMetrics =
-            reports.reports(0).metrics(0).duration_metrics();
-    EXPECT_EQ(1, durationMetrics.data_size());
-
-    auto data = durationMetrics.data(0);
-    EXPECT_EQ(1, data.bucket_info_size());
-
-    auto bucketInfo = data.bucket_info(0);
-    EXPECT_EQ(0, bucketInfo.bucket_num());
-    EXPECT_EQ(bucketStartTimeNs, bucketInfo.start_bucket_elapsed_nanos());
-    EXPECT_EQ(expirationNs, bucketInfo.end_bucket_elapsed_nanos());
-    EXPECT_EQ(expirationNs - durationStartNs, bucketInfo.duration_nanos());
-}
-
-TEST(DurationMetricE2eTest, TestWithCondition) {
-    StatsdConfig config;
-    config.add_allowed_log_source("AID_ROOT"); // LogEvent defaults to UID of root.
-    *config.add_atom_matcher() = CreateAcquireWakelockAtomMatcher();
-    *config.add_atom_matcher() = CreateReleaseWakelockAtomMatcher();
-    *config.add_atom_matcher() = CreateMoveToBackgroundAtomMatcher();
-    *config.add_atom_matcher() = CreateMoveToForegroundAtomMatcher();
-
-    auto holdingWakelockPredicate = CreateHoldingWakelockPredicate();
-    *config.add_predicate() = holdingWakelockPredicate;
-
-    auto isInBackgroundPredicate = CreateIsInBackgroundPredicate();
-    *config.add_predicate() = isInBackgroundPredicate;
-
-    auto durationMetric = config.add_duration_metric();
-    durationMetric->set_id(StringToId("WakelockDuration"));
-    durationMetric->set_what(holdingWakelockPredicate.id());
-    durationMetric->set_condition(isInBackgroundPredicate.id());
-    durationMetric->set_aggregation_type(DurationMetric::SUM);
-    durationMetric->set_bucket(FIVE_MINUTES);
-
-    ConfigKey cfgKey;
-    uint64_t bucketStartTimeNs = 10000000000;
-    uint64_t bucketSizeNs =
-            TimeUnitToBucketSizeInMillis(config.duration_metric(0).bucket()) * 1000000LL;
-    auto processor = CreateStatsLogProcessor(bucketStartTimeNs, bucketStartTimeNs, config, cfgKey);
-    EXPECT_EQ(processor->mMetricsManagers.size(), 1u);
-    sp<MetricsManager> metricsManager = processor->mMetricsManagers.begin()->second;
-    EXPECT_TRUE(metricsManager->isConfigValid());
-    EXPECT_EQ(metricsManager->mAllMetricProducers.size(), 1);
-    sp<MetricProducer> metricProducer = metricsManager->mAllMetricProducers[0];
-    auto& eventActivationMap = metricProducer->mEventActivationMap;
-    EXPECT_TRUE(metricsManager->isActive());
-    EXPECT_TRUE(metricProducer->mIsActive);
-    EXPECT_TRUE(eventActivationMap.empty());
-
-    int appUid = 123;
-    std::vector<AttributionNodeInternal> attributions1 = {CreateAttribution(appUid, "App1")};
-
-    auto event = CreateAcquireWakelockEvent(
-            attributions1, "wl1", bucketStartTimeNs + 10 * NS_PER_SEC); // 0:10
-    processor->OnLogEvent(event.get());
-
-    event = CreateMoveToBackgroundEvent(appUid, bucketStartTimeNs + 22 * NS_PER_SEC); // 0:22
-    processor->OnLogEvent(event.get());
-
-    event = CreateMoveToForegroundEvent(
-            appUid, bucketStartTimeNs + (3 * 60 + 15) * NS_PER_SEC); // 3:15
-    processor->OnLogEvent(event.get());
-
-    event = CreateReleaseWakelockEvent(
-            attributions1, "wl1", bucketStartTimeNs + 4 * 60 * NS_PER_SEC); // 4:00
-    processor->OnLogEvent(event.get());
-
-    vector<uint8_t> buffer;
-    ConfigMetricsReportList reports;
-    processor->onDumpReport(cfgKey, bucketStartTimeNs + bucketSizeNs + 1, false, true,
-                            ADB_DUMP, FAST, &buffer);
-    EXPECT_GT(buffer.size(), 0);
-    EXPECT_TRUE(reports.ParseFromArray(&buffer[0], buffer.size()));
-    backfillDimensionPath(&reports);
-    backfillStringInReport(&reports);
-    backfillStartEndTimestamp(&reports);
-
-    EXPECT_EQ(1, reports.reports_size());
-    EXPECT_EQ(1, reports.reports(0).metrics_size());
-    EXPECT_EQ(1, reports.reports(0).metrics(0).duration_metrics().data_size());
-
-    auto data = reports.reports(0).metrics(0).duration_metrics().data(0);
-
-    // Validate bucket info.
-    EXPECT_EQ(1, data.bucket_info_size());
-
-    auto bucketInfo = data.bucket_info(0);
-    EXPECT_EQ(bucketStartTimeNs, bucketInfo.start_bucket_elapsed_nanos());
-    EXPECT_EQ(bucketStartTimeNs + bucketSizeNs, bucketInfo.end_bucket_elapsed_nanos());
-    EXPECT_EQ((2 * 60 + 53) * NS_PER_SEC, bucketInfo.duration_nanos());
-}
-
-TEST(DurationMetricE2eTest, TestWithSlicedCondition) {
-    StatsdConfig config;
-    config.add_allowed_log_source("AID_ROOT"); // LogEvent defaults to UID of root.
-    auto screenOnMatcher = CreateScreenTurnedOnAtomMatcher();
-    *config.add_atom_matcher() = CreateAcquireWakelockAtomMatcher();
-    *config.add_atom_matcher() = CreateReleaseWakelockAtomMatcher();
-    *config.add_atom_matcher() = CreateMoveToBackgroundAtomMatcher();
-    *config.add_atom_matcher() = CreateMoveToForegroundAtomMatcher();
-
-    auto holdingWakelockPredicate = CreateHoldingWakelockPredicate();
-    // The predicate is dimensioning by first attribution node by uid.
-    FieldMatcher dimensions = CreateAttributionUidDimensions(
-            android::util::WAKELOCK_STATE_CHANGED, {Position::FIRST});
-    *holdingWakelockPredicate.mutable_simple_predicate()->mutable_dimensions() = dimensions;
-    *config.add_predicate() = holdingWakelockPredicate;
-
-    auto isInBackgroundPredicate = CreateIsInBackgroundPredicate();
-    *isInBackgroundPredicate.mutable_simple_predicate()->mutable_dimensions() =
-        CreateDimensions(android::util::ACTIVITY_FOREGROUND_STATE_CHANGED, {Position::FIRST});
-    *config.add_predicate() = isInBackgroundPredicate;
-
-    auto durationMetric = config.add_duration_metric();
-    durationMetric->set_id(StringToId("WakelockDuration"));
-    durationMetric->set_what(holdingWakelockPredicate.id());
-    durationMetric->set_condition(isInBackgroundPredicate.id());
-    durationMetric->set_aggregation_type(DurationMetric::SUM);
-    // The metric is dimensioning by first attribution node and only by uid.
-    *durationMetric->mutable_dimensions_in_what() =
-        CreateAttributionUidDimensions(
-            android::util::WAKELOCK_STATE_CHANGED, {Position::FIRST});
-    durationMetric->set_bucket(FIVE_MINUTES);
-
-    // Links between wakelock state atom and condition of app is in background.
-    auto links = durationMetric->add_links();
-    links->set_condition(isInBackgroundPredicate.id());
-    auto dimensionWhat = links->mutable_fields_in_what();
-    dimensionWhat->set_field(android::util::WAKELOCK_STATE_CHANGED);
-    dimensionWhat->add_child()->set_field(1);  // uid field.
-    *links->mutable_fields_in_condition() = CreateAttributionUidDimensions(
-            android::util::ACTIVITY_FOREGROUND_STATE_CHANGED, { Position::FIRST });
-
-    ConfigKey cfgKey;
-    uint64_t bucketStartTimeNs = 10000000000;
-    uint64_t bucketSizeNs =
-            TimeUnitToBucketSizeInMillis(config.duration_metric(0).bucket()) * 1000000LL;
-    auto processor = CreateStatsLogProcessor(bucketStartTimeNs, bucketStartTimeNs, config, cfgKey);
-    EXPECT_EQ(processor->mMetricsManagers.size(), 1u);
-    sp<MetricsManager> metricsManager = processor->mMetricsManagers.begin()->second;
-    EXPECT_TRUE(metricsManager->isConfigValid());
-    EXPECT_EQ(metricsManager->mAllMetricProducers.size(), 1);
-    sp<MetricProducer> metricProducer = metricsManager->mAllMetricProducers[0];
-    auto& eventActivationMap = metricProducer->mEventActivationMap;
-    EXPECT_TRUE(metricsManager->isActive());
-    EXPECT_TRUE(metricProducer->mIsActive);
-    EXPECT_TRUE(eventActivationMap.empty());
-
-    int appUid = 123;
-    std::vector<AttributionNodeInternal> attributions1 = {CreateAttribution(appUid, "App1")};
-
-    auto event = CreateAcquireWakelockEvent(
-            attributions1, "wl1", bucketStartTimeNs + 10 * NS_PER_SEC); // 0:10
-    processor->OnLogEvent(event.get());
-
-    event = CreateMoveToBackgroundEvent(appUid, bucketStartTimeNs + 22 * NS_PER_SEC); // 0:22
-    processor->OnLogEvent(event.get());
-
-    event = CreateReleaseWakelockEvent(
-            attributions1, "wl1", bucketStartTimeNs + 60 * NS_PER_SEC); // 1:00
-    processor->OnLogEvent(event.get());
-
-
-    event = CreateMoveToForegroundEvent(
-            appUid, bucketStartTimeNs + (3 * 60 + 15) * NS_PER_SEC); // 3:15
-    processor->OnLogEvent(event.get());
-
-    vector<uint8_t> buffer;
-    ConfigMetricsReportList reports;
-    processor->onDumpReport(cfgKey, bucketStartTimeNs + bucketSizeNs + 1, false, true,
-                            ADB_DUMP, FAST, &buffer);
-    EXPECT_GT(buffer.size(), 0);
-    EXPECT_TRUE(reports.ParseFromArray(&buffer[0], buffer.size()));
-    backfillDimensionPath(&reports);
-    backfillStringInReport(&reports);
-    backfillStartEndTimestamp(&reports);
-
-    EXPECT_EQ(1, reports.reports_size());
-    EXPECT_EQ(1, reports.reports(0).metrics_size());
-    EXPECT_EQ(1, reports.reports(0).metrics(0).duration_metrics().data_size());
-
-    auto data = reports.reports(0).metrics(0).duration_metrics().data(0);
-    // Validate dimension value.
-    ValidateAttributionUidDimension(data.dimensions_in_what(),
-                                    android::util::WAKELOCK_STATE_CHANGED, appUid);
-    // Validate bucket info.
-    EXPECT_EQ(1, data.bucket_info_size());
-
-    auto bucketInfo = data.bucket_info(0);
-    EXPECT_EQ(bucketStartTimeNs, bucketInfo.start_bucket_elapsed_nanos());
-    EXPECT_EQ(bucketStartTimeNs + bucketSizeNs, bucketInfo.end_bucket_elapsed_nanos());
-    EXPECT_EQ(38 * NS_PER_SEC, bucketInfo.duration_nanos());
-}
-
-TEST(DurationMetricE2eTest, TestWithActivationAndSlicedCondition) {
-    StatsdConfig config;
-    config.add_allowed_log_source("AID_ROOT"); // LogEvent defaults to UID of root.
-    auto screenOnMatcher = CreateScreenTurnedOnAtomMatcher();
-    *config.add_atom_matcher() = CreateAcquireWakelockAtomMatcher();
-    *config.add_atom_matcher() = CreateReleaseWakelockAtomMatcher();
-    *config.add_atom_matcher() = CreateMoveToBackgroundAtomMatcher();
-    *config.add_atom_matcher() = CreateMoveToForegroundAtomMatcher();
-    *config.add_atom_matcher() = screenOnMatcher;
-
-    auto holdingWakelockPredicate = CreateHoldingWakelockPredicate();
-    // The predicate is dimensioning by first attribution node by uid.
-    FieldMatcher dimensions = CreateAttributionUidDimensions(
-            android::util::WAKELOCK_STATE_CHANGED, {Position::FIRST});
-    *holdingWakelockPredicate.mutable_simple_predicate()->mutable_dimensions() = dimensions;
-    *config.add_predicate() = holdingWakelockPredicate;
-
-    auto isInBackgroundPredicate = CreateIsInBackgroundPredicate();
-    *isInBackgroundPredicate.mutable_simple_predicate()->mutable_dimensions() =
-        CreateDimensions(android::util::ACTIVITY_FOREGROUND_STATE_CHANGED, {Position::FIRST});
-    *config.add_predicate() = isInBackgroundPredicate;
-
-    auto durationMetric = config.add_duration_metric();
-    durationMetric->set_id(StringToId("WakelockDuration"));
-    durationMetric->set_what(holdingWakelockPredicate.id());
-    durationMetric->set_condition(isInBackgroundPredicate.id());
-    durationMetric->set_aggregation_type(DurationMetric::SUM);
-    // The metric is dimensioning by first attribution node and only by uid.
-    *durationMetric->mutable_dimensions_in_what() =
-        CreateAttributionUidDimensions(
-            android::util::WAKELOCK_STATE_CHANGED, {Position::FIRST});
-    durationMetric->set_bucket(FIVE_MINUTES);
-
-    // Links between wakelock state atom and condition of app is in background.
-    auto links = durationMetric->add_links();
-    links->set_condition(isInBackgroundPredicate.id());
-    auto dimensionWhat = links->mutable_fields_in_what();
-    dimensionWhat->set_field(android::util::WAKELOCK_STATE_CHANGED);
-    dimensionWhat->add_child()->set_field(1);  // uid field.
-    *links->mutable_fields_in_condition() = CreateAttributionUidDimensions(
-            android::util::ACTIVITY_FOREGROUND_STATE_CHANGED, { Position::FIRST });
-
-    auto metric_activation1 = config.add_metric_activation();
-    metric_activation1->set_metric_id(durationMetric->id());
-    auto event_activation1 = metric_activation1->add_event_activation();
-    event_activation1->set_atom_matcher_id(screenOnMatcher.id());
-    event_activation1->set_ttl_seconds(60 * 2);  // 2 minutes.
-
-    ConfigKey cfgKey;
-    uint64_t bucketStartTimeNs = 10000000000;
-    uint64_t bucketSizeNs =
-            TimeUnitToBucketSizeInMillis(config.duration_metric(0).bucket()) * 1000000LL;
-    auto processor = CreateStatsLogProcessor(bucketStartTimeNs, bucketStartTimeNs, config, cfgKey);
-    EXPECT_EQ(processor->mMetricsManagers.size(), 1u);
-    sp<MetricsManager> metricsManager = processor->mMetricsManagers.begin()->second;
-    EXPECT_TRUE(metricsManager->isConfigValid());
-    EXPECT_EQ(metricsManager->mAllMetricProducers.size(), 1);
-    sp<MetricProducer> metricProducer = metricsManager->mAllMetricProducers[0];
-    auto& eventActivationMap = metricProducer->mEventActivationMap;
-    EXPECT_FALSE(metricsManager->isActive());
-    EXPECT_FALSE(metricProducer->mIsActive);
-    EXPECT_EQ(eventActivationMap.size(), 1u);
-    EXPECT_TRUE(eventActivationMap.find(4) != eventActivationMap.end());
-    EXPECT_EQ(eventActivationMap[4]->state, ActivationState::kNotActive);
-    EXPECT_EQ(eventActivationMap[4]->start_ns, 0);
-    EXPECT_EQ(eventActivationMap[4]->ttl_ns, event_activation1->ttl_seconds() * NS_PER_SEC);
-
-    int appUid = 123;
-    std::vector<AttributionNodeInternal> attributions1 = {CreateAttribution(appUid, "App1")};
-
-    auto event = CreateAcquireWakelockEvent(
-            attributions1, "wl1", bucketStartTimeNs + 10 * NS_PER_SEC); // 0:10
-    processor->OnLogEvent(event.get());
-    EXPECT_FALSE(metricsManager->isActive());
-    EXPECT_FALSE(metricProducer->mIsActive);
-    EXPECT_EQ(eventActivationMap[4]->state, ActivationState::kNotActive);
-    EXPECT_EQ(eventActivationMap[4]->start_ns, 0);
-    EXPECT_EQ(eventActivationMap[4]->ttl_ns, event_activation1->ttl_seconds() * NS_PER_SEC);
-
-    event = CreateMoveToBackgroundEvent(appUid, bucketStartTimeNs + 22 * NS_PER_SEC); // 0:22
-    processor->OnLogEvent(event.get());
-    EXPECT_FALSE(metricsManager->isActive());
-    EXPECT_FALSE(metricProducer->mIsActive);
-    EXPECT_EQ(eventActivationMap[4]->state, ActivationState::kNotActive);
-    EXPECT_EQ(eventActivationMap[4]->start_ns, 0);
-    EXPECT_EQ(eventActivationMap[4]->ttl_ns, event_activation1->ttl_seconds() * NS_PER_SEC);
-
-    const int64_t durationStartNs = bucketStartTimeNs + 30 * NS_PER_SEC; // 0:30
-    event = CreateScreenStateChangedEvent(android::view::DISPLAY_STATE_ON, durationStartNs);
-    processor->OnLogEvent(event.get());
-    EXPECT_TRUE(metricsManager->isActive());
-    EXPECT_TRUE(metricProducer->mIsActive);
-    EXPECT_EQ(eventActivationMap[4]->state, ActivationState::kActive);
-    EXPECT_EQ(eventActivationMap[4]->start_ns, durationStartNs);
-    EXPECT_EQ(eventActivationMap[4]->ttl_ns, event_activation1->ttl_seconds() * NS_PER_SEC);
-
-    const int64_t durationEndNs =
-            durationStartNs + (event_activation1->ttl_seconds() + 30) * NS_PER_SEC; // 3:00
-    event = CreateAppCrashEvent(333, durationEndNs);
-    processor->OnLogEvent(event.get());
-    EXPECT_FALSE(metricsManager->isActive());
-    EXPECT_FALSE(metricProducer->mIsActive);
-    EXPECT_EQ(eventActivationMap[4]->state, ActivationState::kNotActive);
-    EXPECT_EQ(eventActivationMap[4]->start_ns, durationStartNs);
-    EXPECT_EQ(eventActivationMap[4]->ttl_ns, event_activation1->ttl_seconds() * NS_PER_SEC);
-
-    event = CreateMoveToForegroundEvent(
-            appUid, bucketStartTimeNs + (3 * 60 + 15) * NS_PER_SEC); // 3:15
-    processor->OnLogEvent(event.get());
-
-    event = CreateReleaseWakelockEvent(
-            attributions1, "wl1", bucketStartTimeNs + (4 * 60 + 17) * NS_PER_SEC); // 4:17
-    processor->OnLogEvent(event.get());
-
-    event = CreateMoveToBackgroundEvent(
-            appUid, bucketStartTimeNs + (4 * 60 + 20) * NS_PER_SEC); // 4:20
-    processor->OnLogEvent(event.get());
-
-    event = CreateAcquireWakelockEvent(
-            attributions1, "wl1", bucketStartTimeNs + (4 * 60 + 25) * NS_PER_SEC); // 4:25
-    processor->OnLogEvent(event.get());
-
-    const int64_t duration2StartNs = bucketStartTimeNs + (4 * 60 + 30) * NS_PER_SEC; // 4:30
-    event = CreateScreenStateChangedEvent(android::view::DISPLAY_STATE_ON, duration2StartNs);
-    processor->OnLogEvent(event.get());
-    EXPECT_TRUE(metricsManager->isActive());
-    EXPECT_TRUE(metricProducer->mIsActive);
-    EXPECT_EQ(eventActivationMap[4]->state, ActivationState::kActive);
-    EXPECT_EQ(eventActivationMap[4]->start_ns, duration2StartNs);
-    EXPECT_EQ(eventActivationMap[4]->ttl_ns, event_activation1->ttl_seconds() * NS_PER_SEC);
-
-    vector<uint8_t> buffer;
-    ConfigMetricsReportList reports;
-    processor->onDumpReport(cfgKey, bucketStartTimeNs + bucketSizeNs + 1, false, true,
-                            ADB_DUMP, FAST, &buffer);
-    EXPECT_GT(buffer.size(), 0);
-    EXPECT_TRUE(reports.ParseFromArray(&buffer[0], buffer.size()));
-    backfillDimensionPath(&reports);
-    backfillStringInReport(&reports);
-    backfillStartEndTimestamp(&reports);
-
-    EXPECT_EQ(1, reports.reports_size());
-    EXPECT_EQ(1, reports.reports(0).metrics_size());
-    EXPECT_EQ(1, reports.reports(0).metrics(0).duration_metrics().data_size());
-
-    auto data = reports.reports(0).metrics(0).duration_metrics().data(0);
-    // Validate dimension value.
-    ValidateAttributionUidDimension(data.dimensions_in_what(),
-                                    android::util::WAKELOCK_STATE_CHANGED, appUid);
-    // Validate bucket info.
-    EXPECT_EQ(2, data.bucket_info_size());
-
-    auto bucketInfo = data.bucket_info(0);
-    EXPECT_EQ(bucketStartTimeNs, bucketInfo.start_bucket_elapsed_nanos());
-    EXPECT_EQ(durationEndNs, bucketInfo.end_bucket_elapsed_nanos());
-    EXPECT_EQ(durationEndNs - durationStartNs, bucketInfo.duration_nanos());
-
-    bucketInfo = data.bucket_info(1);
-    EXPECT_EQ(durationEndNs, bucketInfo.start_bucket_elapsed_nanos());
-    EXPECT_EQ(bucketStartTimeNs + bucketSizeNs, bucketInfo.end_bucket_elapsed_nanos());
-    EXPECT_EQ(bucketStartTimeNs + bucketSizeNs - duration2StartNs, bucketInfo.duration_nanos());
-}
+// TODO(b/149590301): Update these tests to use new socket schema.
+//TEST(DurationMetricE2eTest, TestOneBucket) {
+//    StatsdConfig config;
+//    config.add_allowed_log_source("AID_ROOT"); // LogEvent defaults to UID of root.
+//
+//    auto screenOnMatcher = CreateScreenTurnedOnAtomMatcher();
+//    auto screenOffMatcher = CreateScreenTurnedOffAtomMatcher();
+//    *config.add_atom_matcher() = screenOnMatcher;
+//    *config.add_atom_matcher() = screenOffMatcher;
+//
+//    auto durationPredicate = CreateScreenIsOnPredicate();
+//    *config.add_predicate() = durationPredicate;
+//
+//    int64_t metricId = 123456;
+//    auto durationMetric = config.add_duration_metric();
+//    durationMetric->set_id(metricId);
+//    durationMetric->set_what(durationPredicate.id());
+//    durationMetric->set_bucket(FIVE_MINUTES);
+//    durationMetric->set_aggregation_type(DurationMetric_AggregationType_SUM);
+//
+//
+//    const int64_t baseTimeNs = 0; // 0:00
+//    const int64_t configAddedTimeNs = baseTimeNs + 1 * NS_PER_SEC; // 0:01
+//    const int64_t bucketSizeNs =
+//            TimeUnitToBucketSizeInMillis(config.duration_metric(0).bucket()) * 1000LL * 1000LL;
+//
+//    int uid = 12345;
+//    int64_t cfgId = 98765;
+//    ConfigKey cfgKey(uid, cfgId);
+//
+//    auto processor = CreateStatsLogProcessor(baseTimeNs, configAddedTimeNs, config, cfgKey);
+//
+//    EXPECT_EQ(processor->mMetricsManagers.size(), 1u);
+//    sp<MetricsManager> metricsManager = processor->mMetricsManagers.begin()->second;
+//    EXPECT_TRUE(metricsManager->isConfigValid());
+//    EXPECT_EQ(metricsManager->mAllMetricProducers.size(), 1);
+//    sp<MetricProducer> metricProducer = metricsManager->mAllMetricProducers[0];
+//    EXPECT_TRUE(metricsManager->isActive());
+//    EXPECT_TRUE(metricProducer->mIsActive);
+//
+//    std::unique_ptr<LogEvent> event;
+//
+//    // Screen is off at start of bucket.
+//    event = CreateScreenStateChangedEvent(
+//            android::view::DISPLAY_STATE_OFF, configAddedTimeNs); // 0:01
+//    processor->OnLogEvent(event.get());
+//
+//    // Turn screen on.
+//    const int64_t durationStartNs = configAddedTimeNs + 10 * NS_PER_SEC; // 0:11
+//    event = CreateScreenStateChangedEvent(android::view::DISPLAY_STATE_ON, durationStartNs);
+//    processor->OnLogEvent(event.get());
+//
+//    // Turn off screen 30 seconds after turning on.
+//    const int64_t durationEndNs = durationStartNs + 30 * NS_PER_SEC; // 0:41
+//    event = CreateScreenStateChangedEvent(android::view::DISPLAY_STATE_OFF, durationEndNs);
+//    processor->OnLogEvent(event.get());
+//
+//    event = CreateScreenBrightnessChangedEvent(64, durationEndNs + 1 * NS_PER_SEC); // 0:42
+//    processor->OnLogEvent(event.get());
+//
+//    ConfigMetricsReportList reports;
+//    vector<uint8_t> buffer;
+//    processor->onDumpReport(cfgKey, configAddedTimeNs + bucketSizeNs + 1 * NS_PER_SEC, false, true,
+//                            ADB_DUMP, FAST, &buffer); // 5:01
+//    EXPECT_TRUE(buffer.size() > 0);
+//    EXPECT_TRUE(reports.ParseFromArray(&buffer[0], buffer.size()));
+//    backfillDimensionPath(&reports);
+//    backfillStartEndTimestamp(&reports);
+//    EXPECT_EQ(1, reports.reports_size());
+//    EXPECT_EQ(1, reports.reports(0).metrics_size());
+//    EXPECT_EQ(metricId, reports.reports(0).metrics(0).metric_id());
+//    EXPECT_TRUE(reports.reports(0).metrics(0).has_duration_metrics());
+//
+//    const StatsLogReport::DurationMetricDataWrapper& durationMetrics =
+//            reports.reports(0).metrics(0).duration_metrics();
+//    EXPECT_EQ(1, durationMetrics.data_size());
+//
+//    auto data = durationMetrics.data(0);
+//    EXPECT_EQ(1, data.bucket_info_size());
+//    EXPECT_EQ(durationEndNs - durationStartNs, data.bucket_info(0).duration_nanos());
+//    EXPECT_EQ(configAddedTimeNs, data.bucket_info(0).start_bucket_elapsed_nanos());
+//    EXPECT_EQ(baseTimeNs + bucketSizeNs, data.bucket_info(0).end_bucket_elapsed_nanos());
+//}
+//
+//TEST(DurationMetricE2eTest, TestTwoBuckets) {
+//    StatsdConfig config;
+//    config.add_allowed_log_source("AID_ROOT"); // LogEvent defaults to UID of root.
+//
+//    auto screenOnMatcher = CreateScreenTurnedOnAtomMatcher();
+//    auto screenOffMatcher = CreateScreenTurnedOffAtomMatcher();
+//    *config.add_atom_matcher() = screenOnMatcher;
+//    *config.add_atom_matcher() = screenOffMatcher;
+//
+//    auto durationPredicate = CreateScreenIsOnPredicate();
+//    *config.add_predicate() = durationPredicate;
+//
+//    int64_t metricId = 123456;
+//    auto durationMetric = config.add_duration_metric();
+//    durationMetric->set_id(metricId);
+//    durationMetric->set_what(durationPredicate.id());
+//    durationMetric->set_bucket(FIVE_MINUTES);
+//    durationMetric->set_aggregation_type(DurationMetric_AggregationType_SUM);
+//
+//
+//    const int64_t baseTimeNs = 0; // 0:00
+//    const int64_t configAddedTimeNs = baseTimeNs + 1 * NS_PER_SEC; // 0:01
+//    const int64_t bucketSizeNs =
+//            TimeUnitToBucketSizeInMillis(config.duration_metric(0).bucket()) * 1000LL * 1000LL;
+//
+//    int uid = 12345;
+//    int64_t cfgId = 98765;
+//    ConfigKey cfgKey(uid, cfgId);
+//
+//    auto processor = CreateStatsLogProcessor(baseTimeNs, configAddedTimeNs, config, cfgKey);
+//
+//    EXPECT_EQ(processor->mMetricsManagers.size(), 1u);
+//    sp<MetricsManager> metricsManager = processor->mMetricsManagers.begin()->second;
+//    EXPECT_TRUE(metricsManager->isConfigValid());
+//    EXPECT_EQ(metricsManager->mAllMetricProducers.size(), 1);
+//    sp<MetricProducer> metricProducer = metricsManager->mAllMetricProducers[0];
+//    EXPECT_TRUE(metricsManager->isActive());
+//    EXPECT_TRUE(metricProducer->mIsActive);
+//
+//    std::unique_ptr<LogEvent> event;
+//
+//    // Screen is off at start of bucket.
+//    event = CreateScreenStateChangedEvent(
+//            android::view::DISPLAY_STATE_OFF, configAddedTimeNs); // 0:01
+//    processor->OnLogEvent(event.get());
+//
+//    // Turn screen on.
+//    const int64_t durationStartNs = configAddedTimeNs + 10 * NS_PER_SEC; // 0:11
+//    event = CreateScreenStateChangedEvent(android::view::DISPLAY_STATE_ON, durationStartNs);
+//    processor->OnLogEvent(event.get());
+//
+//    // Turn off screen 30 seconds after turning on.
+//    const int64_t durationEndNs = durationStartNs + 30 * NS_PER_SEC; // 0:41
+//    event = CreateScreenStateChangedEvent(android::view::DISPLAY_STATE_OFF, durationEndNs);
+//    processor->OnLogEvent(event.get());
+//
+//    event = CreateScreenBrightnessChangedEvent(64, durationEndNs + 1 * NS_PER_SEC); // 0:42
+//    processor->OnLogEvent(event.get());
+//
+//    ConfigMetricsReportList reports;
+//    vector<uint8_t> buffer;
+//    processor->onDumpReport(cfgKey, configAddedTimeNs + 2 * bucketSizeNs + 1 * NS_PER_SEC, false, true,
+//                            ADB_DUMP, FAST, &buffer); // 10:01
+//    EXPECT_TRUE(buffer.size() > 0);
+//    EXPECT_TRUE(reports.ParseFromArray(&buffer[0], buffer.size()));
+//    backfillDimensionPath(&reports);
+//    backfillStartEndTimestamp(&reports);
+//    EXPECT_EQ(1, reports.reports_size());
+//    EXPECT_EQ(1, reports.reports(0).metrics_size());
+//    EXPECT_EQ(metricId, reports.reports(0).metrics(0).metric_id());
+//    EXPECT_TRUE(reports.reports(0).metrics(0).has_duration_metrics());
+//
+//    const StatsLogReport::DurationMetricDataWrapper& durationMetrics =
+//            reports.reports(0).metrics(0).duration_metrics();
+//    EXPECT_EQ(1, durationMetrics.data_size());
+//
+//    auto data = durationMetrics.data(0);
+//    EXPECT_EQ(1, data.bucket_info_size());
+//
+//    auto bucketInfo = data.bucket_info(0);
+//    EXPECT_EQ(0, bucketInfo.bucket_num());
+//    EXPECT_EQ(durationEndNs - durationStartNs, bucketInfo.duration_nanos());
+//    EXPECT_EQ(configAddedTimeNs, bucketInfo.start_bucket_elapsed_nanos());
+//    EXPECT_EQ(baseTimeNs + bucketSizeNs, bucketInfo.end_bucket_elapsed_nanos());
+//}
+//
+//TEST(DurationMetricE2eTest, TestWithActivation) {
+//    StatsdConfig config;
+//    config.add_allowed_log_source("AID_ROOT"); // LogEvent defaults to UID of root.
+//
+//    auto screenOnMatcher = CreateScreenTurnedOnAtomMatcher();
+//    auto screenOffMatcher = CreateScreenTurnedOffAtomMatcher();
+//    auto crashMatcher = CreateProcessCrashAtomMatcher();
+//    *config.add_atom_matcher() = screenOnMatcher;
+//    *config.add_atom_matcher() = screenOffMatcher;
+//    *config.add_atom_matcher() = crashMatcher;
+//
+//    auto durationPredicate = CreateScreenIsOnPredicate();
+//    *config.add_predicate() = durationPredicate;
+//
+//    int64_t metricId = 123456;
+//    auto durationMetric = config.add_duration_metric();
+//    durationMetric->set_id(metricId);
+//    durationMetric->set_what(durationPredicate.id());
+//    durationMetric->set_bucket(FIVE_MINUTES);
+//    durationMetric->set_aggregation_type(DurationMetric_AggregationType_SUM);
+//
+//    auto metric_activation1 = config.add_metric_activation();
+//    metric_activation1->set_metric_id(metricId);
+//    auto event_activation1 = metric_activation1->add_event_activation();
+//    event_activation1->set_atom_matcher_id(crashMatcher.id());
+//    event_activation1->set_ttl_seconds(30); // 30 secs.
+//
+//    const int64_t bucketStartTimeNs = 10000000000;
+//    const int64_t bucketSizeNs =
+//            TimeUnitToBucketSizeInMillis(config.duration_metric(0).bucket()) * 1000LL * 1000LL;
+//
+//    int uid = 12345;
+//    int64_t cfgId = 98765;
+//    ConfigKey cfgKey(uid, cfgId);
+//
+//    sp<UidMap> m = new UidMap();
+//    sp<StatsPullerManager> pullerManager = new StatsPullerManager();
+//    sp<AlarmMonitor> anomalyAlarmMonitor;
+//    sp<AlarmMonitor> subscriberAlarmMonitor;
+//    vector<int64_t> activeConfigsBroadcast;
+//
+//    int broadcastCount = 0;
+//    StatsLogProcessor processor(m, pullerManager, anomalyAlarmMonitor, subscriberAlarmMonitor,
+//            bucketStartTimeNs, [](const ConfigKey& key) { return true; },
+//            [&uid, &broadcastCount, &activeConfigsBroadcast](const int& broadcastUid,
+//                    const vector<int64_t>& activeConfigs) {
+//                broadcastCount++;
+//                EXPECT_EQ(broadcastUid, uid);
+//                activeConfigsBroadcast.clear();
+//                activeConfigsBroadcast.insert(activeConfigsBroadcast.end(),
+//                        activeConfigs.begin(), activeConfigs.end());
+//                return true;
+//            });
+//
+//    processor.OnConfigUpdated(bucketStartTimeNs, cfgKey, config); // 0:00
+//
+//    EXPECT_EQ(processor.mMetricsManagers.size(), 1u);
+//    sp<MetricsManager> metricsManager = processor.mMetricsManagers.begin()->second;
+//    EXPECT_TRUE(metricsManager->isConfigValid());
+//    EXPECT_EQ(metricsManager->mAllMetricProducers.size(), 1);
+//    sp<MetricProducer> metricProducer = metricsManager->mAllMetricProducers[0];
+//    auto& eventActivationMap = metricProducer->mEventActivationMap;
+//
+//    EXPECT_FALSE(metricsManager->isActive());
+//    EXPECT_FALSE(metricProducer->mIsActive);
+//    EXPECT_EQ(eventActivationMap.size(), 1u);
+//    EXPECT_TRUE(eventActivationMap.find(2) != eventActivationMap.end());
+//    EXPECT_EQ(eventActivationMap[2]->state, ActivationState::kNotActive);
+//    EXPECT_EQ(eventActivationMap[2]->start_ns, 0);
+//    EXPECT_EQ(eventActivationMap[2]->ttl_ns, event_activation1->ttl_seconds() * NS_PER_SEC);
+//
+//    std::unique_ptr<LogEvent> event;
+//
+//    // Turn screen off.
+//    event = CreateScreenStateChangedEvent(
+//            android::view::DISPLAY_STATE_OFF, bucketStartTimeNs + 2 * NS_PER_SEC); // 0:02
+//    processor.OnLogEvent(event.get(), bucketStartTimeNs + 2 * NS_PER_SEC);
+//
+//    // Turn screen on.
+//    const int64_t durationStartNs = bucketStartTimeNs + 5 * NS_PER_SEC; // 0:05
+//    event = CreateScreenStateChangedEvent(android::view::DISPLAY_STATE_ON, durationStartNs);
+//    processor.OnLogEvent(event.get(), durationStartNs);
+//
+//    // Activate metric.
+//    const int64_t activationStartNs = bucketStartTimeNs + 5 * NS_PER_SEC; // 0:10
+//    const int64_t activationEndNs =
+//            activationStartNs + event_activation1->ttl_seconds() * NS_PER_SEC; // 0:40
+//    event = CreateAppCrashEvent(111, activationStartNs);
+//    processor.OnLogEvent(event.get(), activationStartNs);
+//    EXPECT_TRUE(metricsManager->isActive());
+//    EXPECT_TRUE(metricProducer->mIsActive);
+//    EXPECT_EQ(broadcastCount, 1);
+//    EXPECT_EQ(activeConfigsBroadcast.size(), 1);
+//    EXPECT_EQ(activeConfigsBroadcast[0], cfgId);
+//    EXPECT_EQ(eventActivationMap[2]->state, ActivationState::kActive);
+//    EXPECT_EQ(eventActivationMap[2]->start_ns, activationStartNs);
+//    EXPECT_EQ(eventActivationMap[2]->ttl_ns, event_activation1->ttl_seconds() * NS_PER_SEC);
+//
+//    // Expire activation.
+//    const int64_t expirationNs = activationEndNs + 7 * NS_PER_SEC;
+//    event = CreateScreenBrightnessChangedEvent(64, expirationNs); // 0:47
+//    processor.OnLogEvent(event.get(), expirationNs);
+//    EXPECT_FALSE(metricsManager->isActive());
+//    EXPECT_FALSE(metricProducer->mIsActive);
+//    EXPECT_EQ(broadcastCount, 2);
+//    EXPECT_EQ(activeConfigsBroadcast.size(), 0);
+//    EXPECT_EQ(eventActivationMap.size(), 1u);
+//    EXPECT_TRUE(eventActivationMap.find(2) != eventActivationMap.end());
+//    EXPECT_EQ(eventActivationMap[2]->state, ActivationState::kNotActive);
+//    EXPECT_EQ(eventActivationMap[2]->start_ns, activationStartNs);
+//    EXPECT_EQ(eventActivationMap[2]->ttl_ns, event_activation1->ttl_seconds() * NS_PER_SEC);
+//
+//    // Turn off screen 10 seconds after activation expiration.
+//    const int64_t durationEndNs = activationEndNs + 10 * NS_PER_SEC; // 0:50
+//    event = CreateScreenStateChangedEvent(android::view::DISPLAY_STATE_OFF, durationEndNs);
+//    processor.OnLogEvent(event.get(),durationEndNs);
+//
+//    // Turn screen on.
+//    const int64_t duration2StartNs = durationEndNs + 5 * NS_PER_SEC; // 0:55
+//    event = CreateScreenStateChangedEvent(android::view::DISPLAY_STATE_ON, duration2StartNs);
+//    processor.OnLogEvent(event.get(), duration2StartNs);
+//
+//    // Turn off screen.
+//    const int64_t duration2EndNs = duration2StartNs + 10 * NS_PER_SEC; // 1:05
+//    event = CreateScreenStateChangedEvent(android::view::DISPLAY_STATE_OFF, duration2EndNs);
+//    processor.OnLogEvent(event.get(), duration2EndNs);
+//
+//    // Activate metric.
+//    const int64_t activation2StartNs = duration2EndNs + 5 * NS_PER_SEC; // 1:10
+//    const int64_t activation2EndNs =
+//            activation2StartNs + event_activation1->ttl_seconds() * NS_PER_SEC; // 1:40
+//    event = CreateAppCrashEvent(211, activation2StartNs);
+//    processor.OnLogEvent(event.get(), activation2StartNs);
+//    EXPECT_TRUE(metricsManager->isActive());
+//    EXPECT_TRUE(metricProducer->mIsActive);
+//    EXPECT_EQ(broadcastCount, 3);
+//    EXPECT_EQ(activeConfigsBroadcast.size(), 1);
+//    EXPECT_EQ(activeConfigsBroadcast[0], cfgId);
+//    EXPECT_EQ(eventActivationMap[2]->state, ActivationState::kActive);
+//    EXPECT_EQ(eventActivationMap[2]->start_ns, activation2StartNs);
+//    EXPECT_EQ(eventActivationMap[2]->ttl_ns, event_activation1->ttl_seconds() * NS_PER_SEC);
+//
+//    ConfigMetricsReportList reports;
+//    vector<uint8_t> buffer;
+//    processor.onDumpReport(cfgKey, bucketStartTimeNs + bucketSizeNs + 1 * NS_PER_SEC, false, true,
+//                            ADB_DUMP, FAST, &buffer); // 5:01
+//    EXPECT_TRUE(buffer.size() > 0);
+//    EXPECT_TRUE(reports.ParseFromArray(&buffer[0], buffer.size()));
+//    backfillDimensionPath(&reports);
+//    backfillStartEndTimestamp(&reports);
+//    EXPECT_EQ(1, reports.reports_size());
+//    EXPECT_EQ(1, reports.reports(0).metrics_size());
+//    EXPECT_EQ(metricId, reports.reports(0).metrics(0).metric_id());
+//    EXPECT_TRUE(reports.reports(0).metrics(0).has_duration_metrics());
+//
+//    const StatsLogReport::DurationMetricDataWrapper& durationMetrics =
+//            reports.reports(0).metrics(0).duration_metrics();
+//    EXPECT_EQ(1, durationMetrics.data_size());
+//
+//    auto data = durationMetrics.data(0);
+//    EXPECT_EQ(1, data.bucket_info_size());
+//
+//    auto bucketInfo = data.bucket_info(0);
+//    EXPECT_EQ(0, bucketInfo.bucket_num());
+//    EXPECT_EQ(bucketStartTimeNs, bucketInfo.start_bucket_elapsed_nanos());
+//    EXPECT_EQ(expirationNs, bucketInfo.end_bucket_elapsed_nanos());
+//    EXPECT_EQ(expirationNs - durationStartNs, bucketInfo.duration_nanos());
+//}
+//
+//TEST(DurationMetricE2eTest, TestWithCondition) {
+//    StatsdConfig config;
+//    config.add_allowed_log_source("AID_ROOT"); // LogEvent defaults to UID of root.
+//    *config.add_atom_matcher() = CreateAcquireWakelockAtomMatcher();
+//    *config.add_atom_matcher() = CreateReleaseWakelockAtomMatcher();
+//    *config.add_atom_matcher() = CreateMoveToBackgroundAtomMatcher();
+//    *config.add_atom_matcher() = CreateMoveToForegroundAtomMatcher();
+//
+//    auto holdingWakelockPredicate = CreateHoldingWakelockPredicate();
+//    *config.add_predicate() = holdingWakelockPredicate;
+//
+//    auto isInBackgroundPredicate = CreateIsInBackgroundPredicate();
+//    *config.add_predicate() = isInBackgroundPredicate;
+//
+//    auto durationMetric = config.add_duration_metric();
+//    durationMetric->set_id(StringToId("WakelockDuration"));
+//    durationMetric->set_what(holdingWakelockPredicate.id());
+//    durationMetric->set_condition(isInBackgroundPredicate.id());
+//    durationMetric->set_aggregation_type(DurationMetric::SUM);
+//    durationMetric->set_bucket(FIVE_MINUTES);
+//
+//    ConfigKey cfgKey;
+//    uint64_t bucketStartTimeNs = 10000000000;
+//    uint64_t bucketSizeNs =
+//            TimeUnitToBucketSizeInMillis(config.duration_metric(0).bucket()) * 1000000LL;
+//    auto processor = CreateStatsLogProcessor(bucketStartTimeNs, bucketStartTimeNs, config, cfgKey);
+//    EXPECT_EQ(processor->mMetricsManagers.size(), 1u);
+//    sp<MetricsManager> metricsManager = processor->mMetricsManagers.begin()->second;
+//    EXPECT_TRUE(metricsManager->isConfigValid());
+//    EXPECT_EQ(metricsManager->mAllMetricProducers.size(), 1);
+//    sp<MetricProducer> metricProducer = metricsManager->mAllMetricProducers[0];
+//    auto& eventActivationMap = metricProducer->mEventActivationMap;
+//    EXPECT_TRUE(metricsManager->isActive());
+//    EXPECT_TRUE(metricProducer->mIsActive);
+//    EXPECT_TRUE(eventActivationMap.empty());
+//
+//    int appUid = 123;
+//    std::vector<AttributionNodeInternal> attributions1 = {CreateAttribution(appUid, "App1")};
+//
+//    auto event = CreateAcquireWakelockEvent(
+//            attributions1, "wl1", bucketStartTimeNs + 10 * NS_PER_SEC); // 0:10
+//    processor->OnLogEvent(event.get());
+//
+//    event = CreateMoveToBackgroundEvent(appUid, bucketStartTimeNs + 22 * NS_PER_SEC); // 0:22
+//    processor->OnLogEvent(event.get());
+//
+//    event = CreateMoveToForegroundEvent(
+//            appUid, bucketStartTimeNs + (3 * 60 + 15) * NS_PER_SEC); // 3:15
+//    processor->OnLogEvent(event.get());
+//
+//    event = CreateReleaseWakelockEvent(
+//            attributions1, "wl1", bucketStartTimeNs + 4 * 60 * NS_PER_SEC); // 4:00
+//    processor->OnLogEvent(event.get());
+//
+//    vector<uint8_t> buffer;
+//    ConfigMetricsReportList reports;
+//    processor->onDumpReport(cfgKey, bucketStartTimeNs + bucketSizeNs + 1, false, true,
+//                            ADB_DUMP, FAST, &buffer);
+//    EXPECT_GT(buffer.size(), 0);
+//    EXPECT_TRUE(reports.ParseFromArray(&buffer[0], buffer.size()));
+//    backfillDimensionPath(&reports);
+//    backfillStringInReport(&reports);
+//    backfillStartEndTimestamp(&reports);
+//
+//    EXPECT_EQ(1, reports.reports_size());
+//    EXPECT_EQ(1, reports.reports(0).metrics_size());
+//    EXPECT_EQ(1, reports.reports(0).metrics(0).duration_metrics().data_size());
+//
+//    auto data = reports.reports(0).metrics(0).duration_metrics().data(0);
+//
+//    // Validate bucket info.
+//    EXPECT_EQ(1, data.bucket_info_size());
+//
+//    auto bucketInfo = data.bucket_info(0);
+//    EXPECT_EQ(bucketStartTimeNs, bucketInfo.start_bucket_elapsed_nanos());
+//    EXPECT_EQ(bucketStartTimeNs + bucketSizeNs, bucketInfo.end_bucket_elapsed_nanos());
+//    EXPECT_EQ((2 * 60 + 53) * NS_PER_SEC, bucketInfo.duration_nanos());
+//}
+//
+//TEST(DurationMetricE2eTest, TestWithSlicedCondition) {
+//    StatsdConfig config;
+//    config.add_allowed_log_source("AID_ROOT"); // LogEvent defaults to UID of root.
+//    auto screenOnMatcher = CreateScreenTurnedOnAtomMatcher();
+//    *config.add_atom_matcher() = CreateAcquireWakelockAtomMatcher();
+//    *config.add_atom_matcher() = CreateReleaseWakelockAtomMatcher();
+//    *config.add_atom_matcher() = CreateMoveToBackgroundAtomMatcher();
+//    *config.add_atom_matcher() = CreateMoveToForegroundAtomMatcher();
+//
+//    auto holdingWakelockPredicate = CreateHoldingWakelockPredicate();
+//    // The predicate is dimensioning by first attribution node by uid.
+//    FieldMatcher dimensions = CreateAttributionUidDimensions(
+//            android::util::WAKELOCK_STATE_CHANGED, {Position::FIRST});
+//    *holdingWakelockPredicate.mutable_simple_predicate()->mutable_dimensions() = dimensions;
+//    *config.add_predicate() = holdingWakelockPredicate;
+//
+//    auto isInBackgroundPredicate = CreateIsInBackgroundPredicate();
+//    *isInBackgroundPredicate.mutable_simple_predicate()->mutable_dimensions() =
+//        CreateDimensions(android::util::ACTIVITY_FOREGROUND_STATE_CHANGED, {Position::FIRST});
+//    *config.add_predicate() = isInBackgroundPredicate;
+//
+//    auto durationMetric = config.add_duration_metric();
+//    durationMetric->set_id(StringToId("WakelockDuration"));
+//    durationMetric->set_what(holdingWakelockPredicate.id());
+//    durationMetric->set_condition(isInBackgroundPredicate.id());
+//    durationMetric->set_aggregation_type(DurationMetric::SUM);
+//    // The metric is dimensioning by first attribution node and only by uid.
+//    *durationMetric->mutable_dimensions_in_what() =
+//        CreateAttributionUidDimensions(
+//            android::util::WAKELOCK_STATE_CHANGED, {Position::FIRST});
+//    durationMetric->set_bucket(FIVE_MINUTES);
+//
+//    // Links between wakelock state atom and condition of app is in background.
+//    auto links = durationMetric->add_links();
+//    links->set_condition(isInBackgroundPredicate.id());
+//    auto dimensionWhat = links->mutable_fields_in_what();
+//    dimensionWhat->set_field(android::util::WAKELOCK_STATE_CHANGED);
+//    dimensionWhat->add_child()->set_field(1);  // uid field.
+//    *links->mutable_fields_in_condition() = CreateAttributionUidDimensions(
+//            android::util::ACTIVITY_FOREGROUND_STATE_CHANGED, { Position::FIRST });
+//
+//    ConfigKey cfgKey;
+//    uint64_t bucketStartTimeNs = 10000000000;
+//    uint64_t bucketSizeNs =
+//            TimeUnitToBucketSizeInMillis(config.duration_metric(0).bucket()) * 1000000LL;
+//    auto processor = CreateStatsLogProcessor(bucketStartTimeNs, bucketStartTimeNs, config, cfgKey);
+//    EXPECT_EQ(processor->mMetricsManagers.size(), 1u);
+//    sp<MetricsManager> metricsManager = processor->mMetricsManagers.begin()->second;
+//    EXPECT_TRUE(metricsManager->isConfigValid());
+//    EXPECT_EQ(metricsManager->mAllMetricProducers.size(), 1);
+//    sp<MetricProducer> metricProducer = metricsManager->mAllMetricProducers[0];
+//    auto& eventActivationMap = metricProducer->mEventActivationMap;
+//    EXPECT_TRUE(metricsManager->isActive());
+//    EXPECT_TRUE(metricProducer->mIsActive);
+//    EXPECT_TRUE(eventActivationMap.empty());
+//
+//    int appUid = 123;
+//    std::vector<AttributionNodeInternal> attributions1 = {CreateAttribution(appUid, "App1")};
+//
+//    auto event = CreateAcquireWakelockEvent(
+//            attributions1, "wl1", bucketStartTimeNs + 10 * NS_PER_SEC); // 0:10
+//    processor->OnLogEvent(event.get());
+//
+//    event = CreateMoveToBackgroundEvent(appUid, bucketStartTimeNs + 22 * NS_PER_SEC); // 0:22
+//    processor->OnLogEvent(event.get());
+//
+//    event = CreateReleaseWakelockEvent(
+//            attributions1, "wl1", bucketStartTimeNs + 60 * NS_PER_SEC); // 1:00
+//    processor->OnLogEvent(event.get());
+//
+//
+//    event = CreateMoveToForegroundEvent(
+//            appUid, bucketStartTimeNs + (3 * 60 + 15) * NS_PER_SEC); // 3:15
+//    processor->OnLogEvent(event.get());
+//
+//    vector<uint8_t> buffer;
+//    ConfigMetricsReportList reports;
+//    processor->onDumpReport(cfgKey, bucketStartTimeNs + bucketSizeNs + 1, false, true,
+//                            ADB_DUMP, FAST, &buffer);
+//    EXPECT_GT(buffer.size(), 0);
+//    EXPECT_TRUE(reports.ParseFromArray(&buffer[0], buffer.size()));
+//    backfillDimensionPath(&reports);
+//    backfillStringInReport(&reports);
+//    backfillStartEndTimestamp(&reports);
+//
+//    EXPECT_EQ(1, reports.reports_size());
+//    EXPECT_EQ(1, reports.reports(0).metrics_size());
+//    EXPECT_EQ(1, reports.reports(0).metrics(0).duration_metrics().data_size());
+//
+//    auto data = reports.reports(0).metrics(0).duration_metrics().data(0);
+//    // Validate dimension value.
+//    ValidateAttributionUidDimension(data.dimensions_in_what(),
+//                                    android::util::WAKELOCK_STATE_CHANGED, appUid);
+//    // Validate bucket info.
+//    EXPECT_EQ(1, data.bucket_info_size());
+//
+//    auto bucketInfo = data.bucket_info(0);
+//    EXPECT_EQ(bucketStartTimeNs, bucketInfo.start_bucket_elapsed_nanos());
+//    EXPECT_EQ(bucketStartTimeNs + bucketSizeNs, bucketInfo.end_bucket_elapsed_nanos());
+//    EXPECT_EQ(38 * NS_PER_SEC, bucketInfo.duration_nanos());
+//}
+//
+//TEST(DurationMetricE2eTest, TestWithActivationAndSlicedCondition) {
+//    StatsdConfig config;
+//    config.add_allowed_log_source("AID_ROOT"); // LogEvent defaults to UID of root.
+//    auto screenOnMatcher = CreateScreenTurnedOnAtomMatcher();
+//    *config.add_atom_matcher() = CreateAcquireWakelockAtomMatcher();
+//    *config.add_atom_matcher() = CreateReleaseWakelockAtomMatcher();
+//    *config.add_atom_matcher() = CreateMoveToBackgroundAtomMatcher();
+//    *config.add_atom_matcher() = CreateMoveToForegroundAtomMatcher();
+//    *config.add_atom_matcher() = screenOnMatcher;
+//
+//    auto holdingWakelockPredicate = CreateHoldingWakelockPredicate();
+//    // The predicate is dimensioning by first attribution node by uid.
+//    FieldMatcher dimensions = CreateAttributionUidDimensions(
+//            android::util::WAKELOCK_STATE_CHANGED, {Position::FIRST});
+//    *holdingWakelockPredicate.mutable_simple_predicate()->mutable_dimensions() = dimensions;
+//    *config.add_predicate() = holdingWakelockPredicate;
+//
+//    auto isInBackgroundPredicate = CreateIsInBackgroundPredicate();
+//    *isInBackgroundPredicate.mutable_simple_predicate()->mutable_dimensions() =
+//        CreateDimensions(android::util::ACTIVITY_FOREGROUND_STATE_CHANGED, {Position::FIRST});
+//    *config.add_predicate() = isInBackgroundPredicate;
+//
+//    auto durationMetric = config.add_duration_metric();
+//    durationMetric->set_id(StringToId("WakelockDuration"));
+//    durationMetric->set_what(holdingWakelockPredicate.id());
+//    durationMetric->set_condition(isInBackgroundPredicate.id());
+//    durationMetric->set_aggregation_type(DurationMetric::SUM);
+//    // The metric is dimensioning by first attribution node and only by uid.
+//    *durationMetric->mutable_dimensions_in_what() =
+//        CreateAttributionUidDimensions(
+//            android::util::WAKELOCK_STATE_CHANGED, {Position::FIRST});
+//    durationMetric->set_bucket(FIVE_MINUTES);
+//
+//    // Links between wakelock state atom and condition of app is in background.
+//    auto links = durationMetric->add_links();
+//    links->set_condition(isInBackgroundPredicate.id());
+//    auto dimensionWhat = links->mutable_fields_in_what();
+//    dimensionWhat->set_field(android::util::WAKELOCK_STATE_CHANGED);
+//    dimensionWhat->add_child()->set_field(1);  // uid field.
+//    *links->mutable_fields_in_condition() = CreateAttributionUidDimensions(
+//            android::util::ACTIVITY_FOREGROUND_STATE_CHANGED, { Position::FIRST });
+//
+//    auto metric_activation1 = config.add_metric_activation();
+//    metric_activation1->set_metric_id(durationMetric->id());
+//    auto event_activation1 = metric_activation1->add_event_activation();
+//    event_activation1->set_atom_matcher_id(screenOnMatcher.id());
+//    event_activation1->set_ttl_seconds(60 * 2);  // 2 minutes.
+//
+//    ConfigKey cfgKey;
+//    uint64_t bucketStartTimeNs = 10000000000;
+//    uint64_t bucketSizeNs =
+//            TimeUnitToBucketSizeInMillis(config.duration_metric(0).bucket()) * 1000000LL;
+//    auto processor = CreateStatsLogProcessor(bucketStartTimeNs, bucketStartTimeNs, config, cfgKey);
+//    EXPECT_EQ(processor->mMetricsManagers.size(), 1u);
+//    sp<MetricsManager> metricsManager = processor->mMetricsManagers.begin()->second;
+//    EXPECT_TRUE(metricsManager->isConfigValid());
+//    EXPECT_EQ(metricsManager->mAllMetricProducers.size(), 1);
+//    sp<MetricProducer> metricProducer = metricsManager->mAllMetricProducers[0];
+//    auto& eventActivationMap = metricProducer->mEventActivationMap;
+//    EXPECT_FALSE(metricsManager->isActive());
+//    EXPECT_FALSE(metricProducer->mIsActive);
+//    EXPECT_EQ(eventActivationMap.size(), 1u);
+//    EXPECT_TRUE(eventActivationMap.find(4) != eventActivationMap.end());
+//    EXPECT_EQ(eventActivationMap[4]->state, ActivationState::kNotActive);
+//    EXPECT_EQ(eventActivationMap[4]->start_ns, 0);
+//    EXPECT_EQ(eventActivationMap[4]->ttl_ns, event_activation1->ttl_seconds() * NS_PER_SEC);
+//
+//    int appUid = 123;
+//    std::vector<AttributionNodeInternal> attributions1 = {CreateAttribution(appUid, "App1")};
+//
+//    auto event = CreateAcquireWakelockEvent(
+//            attributions1, "wl1", bucketStartTimeNs + 10 * NS_PER_SEC); // 0:10
+//    processor->OnLogEvent(event.get());
+//    EXPECT_FALSE(metricsManager->isActive());
+//    EXPECT_FALSE(metricProducer->mIsActive);
+//    EXPECT_EQ(eventActivationMap[4]->state, ActivationState::kNotActive);
+//    EXPECT_EQ(eventActivationMap[4]->start_ns, 0);
+//    EXPECT_EQ(eventActivationMap[4]->ttl_ns, event_activation1->ttl_seconds() * NS_PER_SEC);
+//
+//    event = CreateMoveToBackgroundEvent(appUid, bucketStartTimeNs + 22 * NS_PER_SEC); // 0:22
+//    processor->OnLogEvent(event.get());
+//    EXPECT_FALSE(metricsManager->isActive());
+//    EXPECT_FALSE(metricProducer->mIsActive);
+//    EXPECT_EQ(eventActivationMap[4]->state, ActivationState::kNotActive);
+//    EXPECT_EQ(eventActivationMap[4]->start_ns, 0);
+//    EXPECT_EQ(eventActivationMap[4]->ttl_ns, event_activation1->ttl_seconds() * NS_PER_SEC);
+//
+//    const int64_t durationStartNs = bucketStartTimeNs + 30 * NS_PER_SEC; // 0:30
+//    event = CreateScreenStateChangedEvent(android::view::DISPLAY_STATE_ON, durationStartNs);
+//    processor->OnLogEvent(event.get());
+//    EXPECT_TRUE(metricsManager->isActive());
+//    EXPECT_TRUE(metricProducer->mIsActive);
+//    EXPECT_EQ(eventActivationMap[4]->state, ActivationState::kActive);
+//    EXPECT_EQ(eventActivationMap[4]->start_ns, durationStartNs);
+//    EXPECT_EQ(eventActivationMap[4]->ttl_ns, event_activation1->ttl_seconds() * NS_PER_SEC);
+//
+//    const int64_t durationEndNs =
+//            durationStartNs + (event_activation1->ttl_seconds() + 30) * NS_PER_SEC; // 3:00
+//    event = CreateAppCrashEvent(333, durationEndNs);
+//    processor->OnLogEvent(event.get());
+//    EXPECT_FALSE(metricsManager->isActive());
+//    EXPECT_FALSE(metricProducer->mIsActive);
+//    EXPECT_EQ(eventActivationMap[4]->state, ActivationState::kNotActive);
+//    EXPECT_EQ(eventActivationMap[4]->start_ns, durationStartNs);
+//    EXPECT_EQ(eventActivationMap[4]->ttl_ns, event_activation1->ttl_seconds() * NS_PER_SEC);
+//
+//    event = CreateMoveToForegroundEvent(
+//            appUid, bucketStartTimeNs + (3 * 60 + 15) * NS_PER_SEC); // 3:15
+//    processor->OnLogEvent(event.get());
+//
+//    event = CreateReleaseWakelockEvent(
+//            attributions1, "wl1", bucketStartTimeNs + (4 * 60 + 17) * NS_PER_SEC); // 4:17
+//    processor->OnLogEvent(event.get());
+//
+//    event = CreateMoveToBackgroundEvent(
+//            appUid, bucketStartTimeNs + (4 * 60 + 20) * NS_PER_SEC); // 4:20
+//    processor->OnLogEvent(event.get());
+//
+//    event = CreateAcquireWakelockEvent(
+//            attributions1, "wl1", bucketStartTimeNs + (4 * 60 + 25) * NS_PER_SEC); // 4:25
+//    processor->OnLogEvent(event.get());
+//
+//    const int64_t duration2StartNs = bucketStartTimeNs + (4 * 60 + 30) * NS_PER_SEC; // 4:30
+//    event = CreateScreenStateChangedEvent(android::view::DISPLAY_STATE_ON, duration2StartNs);
+//    processor->OnLogEvent(event.get());
+//    EXPECT_TRUE(metricsManager->isActive());
+//    EXPECT_TRUE(metricProducer->mIsActive);
+//    EXPECT_EQ(eventActivationMap[4]->state, ActivationState::kActive);
+//    EXPECT_EQ(eventActivationMap[4]->start_ns, duration2StartNs);
+//    EXPECT_EQ(eventActivationMap[4]->ttl_ns, event_activation1->ttl_seconds() * NS_PER_SEC);
+//
+//    vector<uint8_t> buffer;
+//    ConfigMetricsReportList reports;
+//    processor->onDumpReport(cfgKey, bucketStartTimeNs + bucketSizeNs + 1, false, true,
+//                            ADB_DUMP, FAST, &buffer);
+//    EXPECT_GT(buffer.size(), 0);
+//    EXPECT_TRUE(reports.ParseFromArray(&buffer[0], buffer.size()));
+//    backfillDimensionPath(&reports);
+//    backfillStringInReport(&reports);
+//    backfillStartEndTimestamp(&reports);
+//
+//    EXPECT_EQ(1, reports.reports_size());
+//    EXPECT_EQ(1, reports.reports(0).metrics_size());
+//    EXPECT_EQ(1, reports.reports(0).metrics(0).duration_metrics().data_size());
+//
+//    auto data = reports.reports(0).metrics(0).duration_metrics().data(0);
+//    // Validate dimension value.
+//    ValidateAttributionUidDimension(data.dimensions_in_what(),
+//                                    android::util::WAKELOCK_STATE_CHANGED, appUid);
+//    // Validate bucket info.
+//    EXPECT_EQ(2, data.bucket_info_size());
+//
+//    auto bucketInfo = data.bucket_info(0);
+//    EXPECT_EQ(bucketStartTimeNs, bucketInfo.start_bucket_elapsed_nanos());
+//    EXPECT_EQ(durationEndNs, bucketInfo.end_bucket_elapsed_nanos());
+//    EXPECT_EQ(durationEndNs - durationStartNs, bucketInfo.duration_nanos());
+//
+//    bucketInfo = data.bucket_info(1);
+//    EXPECT_EQ(durationEndNs, bucketInfo.start_bucket_elapsed_nanos());
+//    EXPECT_EQ(bucketStartTimeNs + bucketSizeNs, bucketInfo.end_bucket_elapsed_nanos());
+//    EXPECT_EQ(bucketStartTimeNs + bucketSizeNs - duration2StartNs, bucketInfo.duration_nanos());
+//}
 
 #else
 GTEST_LOG_(INFO) << "This test does nothing.\n";
diff --git a/cmds/statsd/tests/e2e/GaugeMetric_e2e_pull_test.cpp b/cmds/statsd/tests/e2e/GaugeMetric_e2e_pull_test.cpp
index 9127be8..7f651d4 100644
--- a/cmds/statsd/tests/e2e/GaugeMetric_e2e_pull_test.cpp
+++ b/cmds/statsd/tests/e2e/GaugeMetric_e2e_pull_test.cpp
@@ -63,483 +63,484 @@
     return config;
 }
 
-}  // namespace
+}  // namespaces
 
-TEST(GaugeMetricE2eTest, TestRandomSamplePulledEvents) {
-    auto config = CreateStatsdConfig(GaugeMetric::RANDOM_ONE_SAMPLE);
-    int64_t baseTimeNs = getElapsedRealtimeNs();
-    int64_t configAddedTimeNs = 10 * 60 * NS_PER_SEC + baseTimeNs;
-    int64_t bucketSizeNs =
-        TimeUnitToBucketSizeInMillis(config.gauge_metric(0).bucket()) * 1000000;
-
-    ConfigKey cfgKey;
-    auto processor = CreateStatsLogProcessor(baseTimeNs, configAddedTimeNs, config, cfgKey,
-                                             SharedRefBase::make<FakeSubsystemSleepCallback>(),
-                                             ATOM_TAG);
-    EXPECT_EQ(processor->mMetricsManagers.size(), 1u);
-    EXPECT_TRUE(processor->mMetricsManagers.begin()->second->isConfigValid());
-    processor->mPullerManager->ForceClearPullerCache();
-
-    int startBucketNum = processor->mMetricsManagers.begin()->second->
-            mAllMetricProducers[0]->getCurrentBucketNum();
-    EXPECT_GT(startBucketNum, (int64_t)0);
-
-    // When creating the config, the gauge metric producer should register the alarm at the
-    // end of the current bucket.
-    EXPECT_EQ((size_t)1, processor->mPullerManager->mReceivers.size());
-    EXPECT_EQ(bucketSizeNs,
-              processor->mPullerManager->mReceivers.begin()->second.front().intervalNs);
-    int64_t& nextPullTimeNs =
-            processor->mPullerManager->mReceivers.begin()->second.front().nextPullTimeNs;
-    EXPECT_EQ(baseTimeNs + startBucketNum * bucketSizeNs + bucketSizeNs, nextPullTimeNs);
-
-    auto screenOffEvent = CreateScreenStateChangedEvent(android::view::DISPLAY_STATE_OFF,
-                                                        configAddedTimeNs + 55);
-    processor->OnLogEvent(screenOffEvent.get());
-
-    // Pulling alarm arrives on time and reset the sequential pulling alarm.
-    processor->informPullAlarmFired(nextPullTimeNs + 1);
-    EXPECT_EQ(baseTimeNs + startBucketNum * bucketSizeNs + 2 * bucketSizeNs, nextPullTimeNs);
-
-    auto screenOnEvent = CreateScreenStateChangedEvent(android::view::DISPLAY_STATE_ON,
-                                                       configAddedTimeNs + bucketSizeNs + 10);
-    processor->OnLogEvent(screenOnEvent.get());
-
-    screenOffEvent = CreateScreenStateChangedEvent(android::view::DISPLAY_STATE_OFF,
-                                                   configAddedTimeNs + bucketSizeNs + 100);
-    processor->OnLogEvent(screenOffEvent.get());
-
-    processor->informPullAlarmFired(nextPullTimeNs + 1);
-    EXPECT_EQ(baseTimeNs + startBucketNum * bucketSizeNs + 3 * bucketSizeNs,
-              nextPullTimeNs);
-
-    processor->informPullAlarmFired(nextPullTimeNs + 1);
-    EXPECT_EQ(baseTimeNs + startBucketNum * bucketSizeNs + 4 * bucketSizeNs, nextPullTimeNs);
-
-    screenOnEvent = CreateScreenStateChangedEvent(android::view::DISPLAY_STATE_ON,
-                                                  configAddedTimeNs + 3 * bucketSizeNs + 2);
-    processor->OnLogEvent(screenOnEvent.get());
-
-    processor->informPullAlarmFired(nextPullTimeNs + 3);
-    EXPECT_EQ(baseTimeNs + startBucketNum * bucketSizeNs + 5 * bucketSizeNs, nextPullTimeNs);
-
-    screenOffEvent = CreateScreenStateChangedEvent(android::view::DISPLAY_STATE_OFF,
-                                                  configAddedTimeNs + 5 * bucketSizeNs + 1);
-    processor->OnLogEvent(screenOffEvent.get());
-
-    processor->informPullAlarmFired(nextPullTimeNs + 2);
-    EXPECT_EQ(baseTimeNs + startBucketNum * bucketSizeNs + 6 * bucketSizeNs, nextPullTimeNs);
-
-    processor->informPullAlarmFired(nextPullTimeNs + 2);
-
-    ConfigMetricsReportList reports;
-    vector<uint8_t> buffer;
-    processor->onDumpReport(cfgKey, configAddedTimeNs + 7 * bucketSizeNs + 10, false, true,
-                            ADB_DUMP, FAST, &buffer);
-    EXPECT_TRUE(buffer.size() > 0);
-    EXPECT_TRUE(reports.ParseFromArray(&buffer[0], buffer.size()));
-    backfillDimensionPath(&reports);
-    backfillStringInReport(&reports);
-    backfillStartEndTimestamp(&reports);
-    EXPECT_EQ(1, reports.reports_size());
-    EXPECT_EQ(1, reports.reports(0).metrics_size());
-    StatsLogReport::GaugeMetricDataWrapper gaugeMetrics;
-    sortMetricDataByDimensionsValue(
-            reports.reports(0).metrics(0).gauge_metrics(), &gaugeMetrics);
-    EXPECT_GT((int)gaugeMetrics.data_size(), 1);
-
-    auto data = gaugeMetrics.data(0);
-    EXPECT_EQ(ATOM_TAG, data.dimensions_in_what().field());
-    EXPECT_EQ(1, data.dimensions_in_what().value_tuple().dimensions_value_size());
-    EXPECT_EQ(1 /* subsystem name field */,
-              data.dimensions_in_what().value_tuple().dimensions_value(0).field());
-    EXPECT_FALSE(data.dimensions_in_what().value_tuple().dimensions_value(0).value_str().empty());
-    EXPECT_EQ(6, data.bucket_info_size());
-
-    EXPECT_EQ(1, data.bucket_info(0).atom_size());
-    EXPECT_EQ(1, data.bucket_info(0).elapsed_timestamp_nanos_size());
-    EXPECT_EQ(configAddedTimeNs + 55, data.bucket_info(0).elapsed_timestamp_nanos(0));
-    EXPECT_EQ(0, data.bucket_info(0).wall_clock_timestamp_nanos_size());
-    EXPECT_EQ(baseTimeNs + 2 * bucketSizeNs, data.bucket_info(0).start_bucket_elapsed_nanos());
-    EXPECT_EQ(baseTimeNs + 3 * bucketSizeNs, data.bucket_info(0).end_bucket_elapsed_nanos());
-    EXPECT_TRUE(data.bucket_info(0).atom(0).subsystem_sleep_state().subsystem_name().empty());
-    EXPECT_GT(data.bucket_info(0).atom(0).subsystem_sleep_state().time_millis(), 0);
-
-    EXPECT_EQ(1, data.bucket_info(1).atom_size());
-    EXPECT_EQ(baseTimeNs + 3 * bucketSizeNs + 1,
-              data.bucket_info(1).elapsed_timestamp_nanos(0));
-    EXPECT_EQ(baseTimeNs + 3 * bucketSizeNs + 1, data.bucket_info(1).elapsed_timestamp_nanos(0));
-    EXPECT_EQ(baseTimeNs + 3 * bucketSizeNs, data.bucket_info(1).start_bucket_elapsed_nanos());
-    EXPECT_EQ(baseTimeNs + 4 * bucketSizeNs, data.bucket_info(1).end_bucket_elapsed_nanos());
-    EXPECT_TRUE(data.bucket_info(1).atom(0).subsystem_sleep_state().subsystem_name().empty());
-    EXPECT_GT(data.bucket_info(1).atom(0).subsystem_sleep_state().time_millis(), 0);
-
-    EXPECT_EQ(1, data.bucket_info(2).atom_size());
-    EXPECT_EQ(1, data.bucket_info(2).elapsed_timestamp_nanos_size());
-    EXPECT_EQ(baseTimeNs + 4 * bucketSizeNs + 1,
-              data.bucket_info(2).elapsed_timestamp_nanos(0));
-    EXPECT_EQ(baseTimeNs + 4 * bucketSizeNs, data.bucket_info(2).start_bucket_elapsed_nanos());
-    EXPECT_EQ(baseTimeNs + 5 * bucketSizeNs, data.bucket_info(2).end_bucket_elapsed_nanos());
-    EXPECT_TRUE(data.bucket_info(2).atom(0).subsystem_sleep_state().subsystem_name().empty());
-    EXPECT_GT(data.bucket_info(2).atom(0).subsystem_sleep_state().time_millis(), 0);
-
-    EXPECT_EQ(1, data.bucket_info(3).atom_size());
-    EXPECT_EQ(1, data.bucket_info(3).elapsed_timestamp_nanos_size());
-    EXPECT_EQ(baseTimeNs + 5 * bucketSizeNs + 1,
-              data.bucket_info(3).elapsed_timestamp_nanos(0));
-    EXPECT_EQ(baseTimeNs + 5 * bucketSizeNs, data.bucket_info(3).start_bucket_elapsed_nanos());
-    EXPECT_EQ(baseTimeNs + 6 * bucketSizeNs, data.bucket_info(3).end_bucket_elapsed_nanos());
-    EXPECT_TRUE(data.bucket_info(3).atom(0).subsystem_sleep_state().subsystem_name().empty());
-    EXPECT_GT(data.bucket_info(3).atom(0).subsystem_sleep_state().time_millis(), 0);
-
-    EXPECT_EQ(1, data.bucket_info(4).atom_size());
-    EXPECT_EQ(1, data.bucket_info(4).elapsed_timestamp_nanos_size());
-    EXPECT_EQ(baseTimeNs + 7 * bucketSizeNs + 1,
-              data.bucket_info(4).elapsed_timestamp_nanos(0));
-    EXPECT_EQ(baseTimeNs + 7 * bucketSizeNs, data.bucket_info(4).start_bucket_elapsed_nanos());
-    EXPECT_EQ(baseTimeNs + 8 * bucketSizeNs, data.bucket_info(4).end_bucket_elapsed_nanos());
-    EXPECT_TRUE(data.bucket_info(4).atom(0).subsystem_sleep_state().subsystem_name().empty());
-    EXPECT_GT(data.bucket_info(4).atom(0).subsystem_sleep_state().time_millis(), 0);
-
-    EXPECT_EQ(1, data.bucket_info(5).atom_size());
-    EXPECT_EQ(1, data.bucket_info(5).elapsed_timestamp_nanos_size());
-    EXPECT_EQ(baseTimeNs + 8 * bucketSizeNs + 2,
-              data.bucket_info(5).elapsed_timestamp_nanos(0));
-    EXPECT_EQ(baseTimeNs + 8 * bucketSizeNs, data.bucket_info(5).start_bucket_elapsed_nanos());
-    EXPECT_EQ(baseTimeNs + 9 * bucketSizeNs, data.bucket_info(5).end_bucket_elapsed_nanos());
-    EXPECT_TRUE(data.bucket_info(5).atom(0).subsystem_sleep_state().subsystem_name().empty());
-    EXPECT_GT(data.bucket_info(5).atom(0).subsystem_sleep_state().time_millis(), 0);
-}
-
-TEST(GaugeMetricE2eTest, TestConditionChangeToTrueSamplePulledEvents) {
-    auto config = CreateStatsdConfig(GaugeMetric::CONDITION_CHANGE_TO_TRUE);
-    int64_t baseTimeNs = getElapsedRealtimeNs();
-    int64_t configAddedTimeNs = 10 * 60 * NS_PER_SEC + baseTimeNs;
-    int64_t bucketSizeNs =
-        TimeUnitToBucketSizeInMillis(config.gauge_metric(0).bucket()) * 1000000;
-
-    ConfigKey cfgKey;
-    auto processor = CreateStatsLogProcessor(baseTimeNs, configAddedTimeNs, config, cfgKey,
-                                             SharedRefBase::make<FakeSubsystemSleepCallback>(),
-                                             ATOM_TAG);
-    EXPECT_EQ(processor->mMetricsManagers.size(), 1u);
-    EXPECT_TRUE(processor->mMetricsManagers.begin()->second->isConfigValid());
-    processor->mPullerManager->ForceClearPullerCache();
-
-    int startBucketNum = processor->mMetricsManagers.begin()->second->
-            mAllMetricProducers[0]->getCurrentBucketNum();
-    EXPECT_GT(startBucketNum, (int64_t)0);
-
-    auto screenOffEvent = CreateScreenStateChangedEvent(android::view::DISPLAY_STATE_OFF,
-                                                        configAddedTimeNs + 55);
-    processor->OnLogEvent(screenOffEvent.get());
-
-    auto screenOnEvent = CreateScreenStateChangedEvent(android::view::DISPLAY_STATE_ON,
-                                                       configAddedTimeNs + bucketSizeNs + 10);
-    processor->OnLogEvent(screenOnEvent.get());
-
-    screenOffEvent = CreateScreenStateChangedEvent(android::view::DISPLAY_STATE_OFF,
-                                                   configAddedTimeNs + bucketSizeNs + 100);
-    processor->OnLogEvent(screenOffEvent.get());
-
-    screenOnEvent = CreateScreenStateChangedEvent(android::view::DISPLAY_STATE_ON,
-                                                  configAddedTimeNs + 3 * bucketSizeNs + 2);
-    processor->OnLogEvent(screenOnEvent.get());
-
-    screenOffEvent = CreateScreenStateChangedEvent(android::view::DISPLAY_STATE_OFF,
-                                                  configAddedTimeNs + 5 * bucketSizeNs + 1);
-    processor->OnLogEvent(screenOffEvent.get());
-    screenOnEvent = CreateScreenStateChangedEvent(android::view::DISPLAY_STATE_ON,
-                                                  configAddedTimeNs + 5 * bucketSizeNs + 3);
-    processor->OnLogEvent(screenOnEvent.get());
-    screenOffEvent = CreateScreenStateChangedEvent(android::view::DISPLAY_STATE_OFF,
-                                                  configAddedTimeNs + 5 * bucketSizeNs + 10);
-    processor->OnLogEvent(screenOffEvent.get());
-
-    ConfigMetricsReportList reports;
-    vector<uint8_t> buffer;
-    processor->onDumpReport(cfgKey, configAddedTimeNs + 8 * bucketSizeNs + 10, false, true,
-                            ADB_DUMP, FAST, &buffer);
-    EXPECT_TRUE(buffer.size() > 0);
-    EXPECT_TRUE(reports.ParseFromArray(&buffer[0], buffer.size()));
-    backfillDimensionPath(&reports);
-    backfillStringInReport(&reports);
-    backfillStartEndTimestamp(&reports);
-    EXPECT_EQ(1, reports.reports_size());
-    EXPECT_EQ(1, reports.reports(0).metrics_size());
-    StatsLogReport::GaugeMetricDataWrapper gaugeMetrics;
-    sortMetricDataByDimensionsValue(
-            reports.reports(0).metrics(0).gauge_metrics(), &gaugeMetrics);
-    EXPECT_GT((int)gaugeMetrics.data_size(), 1);
-
-    auto data = gaugeMetrics.data(0);
-    EXPECT_EQ(ATOM_TAG, data.dimensions_in_what().field());
-    EXPECT_EQ(1, data.dimensions_in_what().value_tuple().dimensions_value_size());
-    EXPECT_EQ(1 /* subsystem name field */,
-              data.dimensions_in_what().value_tuple().dimensions_value(0).field());
-    EXPECT_FALSE(data.dimensions_in_what().value_tuple().dimensions_value(0).value_str().empty());
-    EXPECT_EQ(3, data.bucket_info_size());
-
-    EXPECT_EQ(1, data.bucket_info(0).atom_size());
-    EXPECT_EQ(1, data.bucket_info(0).elapsed_timestamp_nanos_size());
-    EXPECT_EQ(configAddedTimeNs + 55, data.bucket_info(0).elapsed_timestamp_nanos(0));
-    EXPECT_EQ(0, data.bucket_info(0).wall_clock_timestamp_nanos_size());
-    EXPECT_EQ(baseTimeNs + 2 * bucketSizeNs, data.bucket_info(0).start_bucket_elapsed_nanos());
-    EXPECT_EQ(baseTimeNs + 3 * bucketSizeNs, data.bucket_info(0).end_bucket_elapsed_nanos());
-    EXPECT_TRUE(data.bucket_info(0).atom(0).subsystem_sleep_state().subsystem_name().empty());
-    EXPECT_GT(data.bucket_info(0).atom(0).subsystem_sleep_state().time_millis(), 0);
-
-    EXPECT_EQ(1, data.bucket_info(1).atom_size());
-    EXPECT_EQ(baseTimeNs + 3 * bucketSizeNs + 100,
-              data.bucket_info(1).elapsed_timestamp_nanos(0));
-    EXPECT_EQ(configAddedTimeNs + 55, data.bucket_info(0).elapsed_timestamp_nanos(0));
-    EXPECT_EQ(baseTimeNs + 3 * bucketSizeNs, data.bucket_info(1).start_bucket_elapsed_nanos());
-    EXPECT_EQ(baseTimeNs + 4 * bucketSizeNs, data.bucket_info(1).end_bucket_elapsed_nanos());
-    EXPECT_TRUE(data.bucket_info(1).atom(0).subsystem_sleep_state().subsystem_name().empty());
-    EXPECT_GT(data.bucket_info(1).atom(0).subsystem_sleep_state().time_millis(), 0);
-
-    EXPECT_EQ(2, data.bucket_info(2).atom_size());
-    EXPECT_EQ(2, data.bucket_info(2).elapsed_timestamp_nanos_size());
-    EXPECT_EQ(baseTimeNs + 7 * bucketSizeNs + 1,
-              data.bucket_info(2).elapsed_timestamp_nanos(0));
-    EXPECT_EQ(baseTimeNs + 7 * bucketSizeNs + 10,
-              data.bucket_info(2).elapsed_timestamp_nanos(1));
-    EXPECT_EQ(baseTimeNs + 7 * bucketSizeNs, data.bucket_info(2).start_bucket_elapsed_nanos());
-    EXPECT_EQ(baseTimeNs + 8 * bucketSizeNs, data.bucket_info(2).end_bucket_elapsed_nanos());
-    EXPECT_TRUE(data.bucket_info(2).atom(0).subsystem_sleep_state().subsystem_name().empty());
-    EXPECT_GT(data.bucket_info(2).atom(0).subsystem_sleep_state().time_millis(), 0);
-    EXPECT_TRUE(data.bucket_info(2).atom(1).subsystem_sleep_state().subsystem_name().empty());
-    EXPECT_GT(data.bucket_info(2).atom(1).subsystem_sleep_state().time_millis(), 0);
-}
-
-
-TEST(GaugeMetricE2eTest, TestRandomSamplePulledEvent_LateAlarm) {
-    auto config = CreateStatsdConfig(GaugeMetric::RANDOM_ONE_SAMPLE);
-    int64_t baseTimeNs = getElapsedRealtimeNs();
-    int64_t configAddedTimeNs = 10 * 60 * NS_PER_SEC + baseTimeNs;
-    int64_t bucketSizeNs =
-        TimeUnitToBucketSizeInMillis(config.gauge_metric(0).bucket()) * 1000000;
-
-    ConfigKey cfgKey;
-    auto processor = CreateStatsLogProcessor(baseTimeNs, configAddedTimeNs, config, cfgKey,
-                                             SharedRefBase::make<FakeSubsystemSleepCallback>(),
-                                             ATOM_TAG);
-    EXPECT_EQ(processor->mMetricsManagers.size(), 1u);
-    EXPECT_TRUE(processor->mMetricsManagers.begin()->second->isConfigValid());
-    processor->mPullerManager->ForceClearPullerCache();
-
-    int startBucketNum = processor->mMetricsManagers.begin()->second->
-            mAllMetricProducers[0]->getCurrentBucketNum();
-    EXPECT_GT(startBucketNum, (int64_t)0);
-
-    // When creating the config, the gauge metric producer should register the alarm at the
-    // end of the current bucket.
-    EXPECT_EQ((size_t)1, processor->mPullerManager->mReceivers.size());
-    EXPECT_EQ(bucketSizeNs,
-              processor->mPullerManager->mReceivers.begin()->second.front().intervalNs);
-    int64_t& nextPullTimeNs =
-            processor->mPullerManager->mReceivers.begin()->second.front().nextPullTimeNs;
-    EXPECT_EQ(baseTimeNs + startBucketNum * bucketSizeNs + bucketSizeNs, nextPullTimeNs);
-
-    auto screenOffEvent = CreateScreenStateChangedEvent(android::view::DISPLAY_STATE_OFF,
-                                                        configAddedTimeNs + 55);
-    processor->OnLogEvent(screenOffEvent.get());
-
-    auto screenOnEvent = CreateScreenStateChangedEvent(android::view::DISPLAY_STATE_ON,
-                                                       configAddedTimeNs + bucketSizeNs + 10);
-    processor->OnLogEvent(screenOnEvent.get());
-
-    // Pulling alarm arrives one bucket size late.
-    processor->informPullAlarmFired(nextPullTimeNs + bucketSizeNs);
-    EXPECT_EQ(baseTimeNs + startBucketNum * bucketSizeNs + 3 * bucketSizeNs, nextPullTimeNs);
-
-    screenOffEvent = CreateScreenStateChangedEvent(android::view::DISPLAY_STATE_OFF,
-                                                   configAddedTimeNs + 3 * bucketSizeNs + 11);
-    processor->OnLogEvent(screenOffEvent.get());
-
-    // Pulling alarm arrives more than one bucket size late.
-    processor->informPullAlarmFired(nextPullTimeNs + bucketSizeNs + 12);
-    EXPECT_EQ(baseTimeNs + startBucketNum * bucketSizeNs + 5 * bucketSizeNs, nextPullTimeNs);
-
-    ConfigMetricsReportList reports;
-    vector<uint8_t> buffer;
-    processor->onDumpReport(cfgKey, configAddedTimeNs + 7 * bucketSizeNs + 10, false, true,
-                            ADB_DUMP, FAST, &buffer);
-    EXPECT_TRUE(buffer.size() > 0);
-    EXPECT_TRUE(reports.ParseFromArray(&buffer[0], buffer.size()));
-    backfillDimensionPath(&reports);
-    backfillStringInReport(&reports);
-    backfillStartEndTimestamp(&reports);
-    EXPECT_EQ(1, reports.reports_size());
-    EXPECT_EQ(1, reports.reports(0).metrics_size());
-    StatsLogReport::GaugeMetricDataWrapper gaugeMetrics;
-    sortMetricDataByDimensionsValue(
-            reports.reports(0).metrics(0).gauge_metrics(), &gaugeMetrics);
-    EXPECT_GT((int)gaugeMetrics.data_size(), 1);
-
-    auto data = gaugeMetrics.data(0);
-    EXPECT_EQ(ATOM_TAG, data.dimensions_in_what().field());
-    EXPECT_EQ(1, data.dimensions_in_what().value_tuple().dimensions_value_size());
-    EXPECT_EQ(1 /* subsystem name field */,
-              data.dimensions_in_what().value_tuple().dimensions_value(0).field());
-    EXPECT_FALSE(data.dimensions_in_what().value_tuple().dimensions_value(0).value_str().empty());
-    EXPECT_EQ(3, data.bucket_info_size());
-
-    EXPECT_EQ(1, data.bucket_info(0).atom_size());
-    EXPECT_EQ(1, data.bucket_info(0).elapsed_timestamp_nanos_size());
-    EXPECT_EQ(configAddedTimeNs + 55, data.bucket_info(0).elapsed_timestamp_nanos(0));
-    EXPECT_EQ(baseTimeNs + 2 * bucketSizeNs, data.bucket_info(0).start_bucket_elapsed_nanos());
-    EXPECT_EQ(baseTimeNs + 3 * bucketSizeNs, data.bucket_info(0).end_bucket_elapsed_nanos());
-    EXPECT_TRUE(data.bucket_info(0).atom(0).subsystem_sleep_state().subsystem_name().empty());
-    EXPECT_GT(data.bucket_info(0).atom(0).subsystem_sleep_state().time_millis(), 0);
-
-    EXPECT_EQ(1, data.bucket_info(1).atom_size());
-    EXPECT_EQ(configAddedTimeNs + 3 * bucketSizeNs + 11,
-              data.bucket_info(1).elapsed_timestamp_nanos(0));
-    EXPECT_EQ(configAddedTimeNs + 55, data.bucket_info(0).elapsed_timestamp_nanos(0));
-    EXPECT_EQ(baseTimeNs + 5 * bucketSizeNs, data.bucket_info(1).start_bucket_elapsed_nanos());
-    EXPECT_EQ(baseTimeNs + 6 * bucketSizeNs, data.bucket_info(1).end_bucket_elapsed_nanos());
-    EXPECT_TRUE(data.bucket_info(1).atom(0).subsystem_sleep_state().subsystem_name().empty());
-    EXPECT_GT(data.bucket_info(1).atom(0).subsystem_sleep_state().time_millis(), 0);
-
-    EXPECT_EQ(1, data.bucket_info(2).atom_size());
-    EXPECT_EQ(1, data.bucket_info(2).elapsed_timestamp_nanos_size());
-    EXPECT_EQ(baseTimeNs + 6 * bucketSizeNs + 12,
-              data.bucket_info(2).elapsed_timestamp_nanos(0));
-    EXPECT_EQ(baseTimeNs + 6 * bucketSizeNs, data.bucket_info(2).start_bucket_elapsed_nanos());
-    EXPECT_EQ(baseTimeNs + 7 * bucketSizeNs, data.bucket_info(2).end_bucket_elapsed_nanos());
-    EXPECT_TRUE(data.bucket_info(2).atom(0).subsystem_sleep_state().subsystem_name().empty());
-    EXPECT_GT(data.bucket_info(2).atom(0).subsystem_sleep_state().time_millis(), 0);
-}
-
-TEST(GaugeMetricE2eTest, TestRandomSamplePulledEventsWithActivation) {
-    auto config = CreateStatsdConfig(GaugeMetric::RANDOM_ONE_SAMPLE, /*useCondition=*/false);
-
-    int64_t baseTimeNs = getElapsedRealtimeNs();
-    int64_t configAddedTimeNs = 10 * 60 * NS_PER_SEC + baseTimeNs;
-    int64_t bucketSizeNs =
-        TimeUnitToBucketSizeInMillis(config.gauge_metric(0).bucket()) * 1000000;
-
-    auto batterySaverStartMatcher = CreateBatterySaverModeStartAtomMatcher();
-    *config.add_atom_matcher() = batterySaverStartMatcher;
-    const int64_t ttlNs = 2 * bucketSizeNs; // Two buckets.
-    auto metric_activation = config.add_metric_activation();
-    metric_activation->set_metric_id(metricId);
-    metric_activation->set_activation_type(ACTIVATE_IMMEDIATELY);
-    auto event_activation = metric_activation->add_event_activation();
-    event_activation->set_atom_matcher_id(batterySaverStartMatcher.id());
-    event_activation->set_ttl_seconds(ttlNs / 1000000000);
-
-    ConfigKey cfgKey;
-    auto processor = CreateStatsLogProcessor(baseTimeNs, configAddedTimeNs, config, cfgKey,
-                                             SharedRefBase::make<FakeSubsystemSleepCallback>(),
-                                             ATOM_TAG);
-    EXPECT_EQ(processor->mMetricsManagers.size(), 1u);
-    EXPECT_TRUE(processor->mMetricsManagers.begin()->second->isConfigValid());
-    processor->mPullerManager->ForceClearPullerCache();
-
-    int startBucketNum = processor->mMetricsManagers.begin()->second->
-            mAllMetricProducers[0]->getCurrentBucketNum();
-    EXPECT_GT(startBucketNum, (int64_t)0);
-    EXPECT_FALSE(processor->mMetricsManagers.begin()->second->mAllMetricProducers[0]->isActive());
-
-    // When creating the config, the gauge metric producer should register the alarm at the
-    // end of the current bucket.
-    EXPECT_EQ((size_t)1, processor->mPullerManager->mReceivers.size());
-    EXPECT_EQ(bucketSizeNs,
-              processor->mPullerManager->mReceivers.begin()->second.front().intervalNs);
-    int64_t& nextPullTimeNs =
-            processor->mPullerManager->mReceivers.begin()->second.front().nextPullTimeNs;
-    EXPECT_EQ(baseTimeNs + startBucketNum * bucketSizeNs + bucketSizeNs, nextPullTimeNs);
-
-    // Pulling alarm arrives on time and reset the sequential pulling alarm.
-    // Event should not be kept.
-    processor->informPullAlarmFired(nextPullTimeNs + 1); // 15 mins + 1 ns.
-    EXPECT_EQ(baseTimeNs + startBucketNum * bucketSizeNs + 2 * bucketSizeNs, nextPullTimeNs);
-    EXPECT_FALSE(processor->mMetricsManagers.begin()->second->mAllMetricProducers[0]->isActive());
-
-    // Activate the metric. A pull occurs upon activation.
-    const int64_t activationNs = configAddedTimeNs + bucketSizeNs + (2 * 1000 * 1000); // 2 millis.
-    auto batterySaverOnEvent = CreateBatterySaverOnEvent(activationNs);
-    processor->OnLogEvent(batterySaverOnEvent.get()); // 15 mins + 2 ms.
-    EXPECT_TRUE(processor->mMetricsManagers.begin()->second->mAllMetricProducers[0]->isActive());
-
-    // This event should be kept. 2 total.
-    processor->informPullAlarmFired(nextPullTimeNs + 1); // 20 mins + 1 ns.
-    EXPECT_EQ(baseTimeNs + startBucketNum * bucketSizeNs + 3 * bucketSizeNs,
-              nextPullTimeNs);
-
-    // This event should be kept. 3 total.
-    processor->informPullAlarmFired(nextPullTimeNs + 2); // 25 mins + 2 ns.
-    EXPECT_EQ(baseTimeNs + startBucketNum * bucketSizeNs + 4 * bucketSizeNs, nextPullTimeNs);
-
-    // Create random event to deactivate metric.
-    auto deactivationEvent = CreateScreenBrightnessChangedEvent(50, activationNs + ttlNs + 1);
-    processor->OnLogEvent(deactivationEvent.get());
-    EXPECT_FALSE(processor->mMetricsManagers.begin()->second->mAllMetricProducers[0]->isActive());
-
-    // Event should not be kept. 3 total.
-    processor->informPullAlarmFired(nextPullTimeNs + 3);
-    EXPECT_EQ(baseTimeNs + startBucketNum * bucketSizeNs + 5 * bucketSizeNs, nextPullTimeNs);
-
-    processor->informPullAlarmFired(nextPullTimeNs + 2);
-
-    ConfigMetricsReportList reports;
-    vector<uint8_t> buffer;
-    processor->onDumpReport(cfgKey, configAddedTimeNs + 7 * bucketSizeNs + 10, false, true,
-                            ADB_DUMP, FAST, &buffer);
-    EXPECT_TRUE(buffer.size() > 0);
-    EXPECT_TRUE(reports.ParseFromArray(&buffer[0], buffer.size()));
-    backfillDimensionPath(&reports);
-    backfillStringInReport(&reports);
-    backfillStartEndTimestamp(&reports);
-    EXPECT_EQ(1, reports.reports_size());
-    EXPECT_EQ(1, reports.reports(0).metrics_size());
-    StatsLogReport::GaugeMetricDataWrapper gaugeMetrics;
-    sortMetricDataByDimensionsValue(
-            reports.reports(0).metrics(0).gauge_metrics(), &gaugeMetrics);
-    EXPECT_GT((int)gaugeMetrics.data_size(), 0);
-
-    auto data = gaugeMetrics.data(0);
-    EXPECT_EQ(ATOM_TAG, data.dimensions_in_what().field());
-    EXPECT_EQ(1, data.dimensions_in_what().value_tuple().dimensions_value_size());
-    EXPECT_EQ(1 /* subsystem name field */,
-              data.dimensions_in_what().value_tuple().dimensions_value(0).field());
-    EXPECT_FALSE(data.dimensions_in_what().value_tuple().dimensions_value(0).value_str().empty());
-    EXPECT_EQ(3, data.bucket_info_size());
-
-    auto bucketInfo = data.bucket_info(0);
-    EXPECT_EQ(1, bucketInfo.atom_size());
-    EXPECT_EQ(1, bucketInfo.elapsed_timestamp_nanos_size());
-    EXPECT_EQ(activationNs, bucketInfo.elapsed_timestamp_nanos(0));
-    EXPECT_EQ(0, bucketInfo.wall_clock_timestamp_nanos_size());
-    EXPECT_EQ(baseTimeNs + 3 * bucketSizeNs, bucketInfo.start_bucket_elapsed_nanos());
-    EXPECT_EQ(baseTimeNs + 4 * bucketSizeNs, bucketInfo.end_bucket_elapsed_nanos());
-    EXPECT_TRUE(bucketInfo.atom(0).subsystem_sleep_state().subsystem_name().empty());
-    EXPECT_GT(bucketInfo.atom(0).subsystem_sleep_state().time_millis(), 0);
-
-    bucketInfo = data.bucket_info(1);
-    EXPECT_EQ(1, bucketInfo.atom_size());
-    EXPECT_EQ(1, bucketInfo.elapsed_timestamp_nanos_size());
-    EXPECT_EQ(baseTimeNs + 4 * bucketSizeNs + 1, bucketInfo.elapsed_timestamp_nanos(0));
-    EXPECT_EQ(0, bucketInfo.wall_clock_timestamp_nanos_size());
-    EXPECT_EQ(baseTimeNs + 4 * bucketSizeNs, bucketInfo.start_bucket_elapsed_nanos());
-    EXPECT_EQ(baseTimeNs + 5 * bucketSizeNs, bucketInfo.end_bucket_elapsed_nanos());
-    EXPECT_TRUE(bucketInfo.atom(0).subsystem_sleep_state().subsystem_name().empty());
-    EXPECT_GT(bucketInfo.atom(0).subsystem_sleep_state().time_millis(), 0);
-
-    bucketInfo = data.bucket_info(2);
-    EXPECT_EQ(1, bucketInfo.atom_size());
-    EXPECT_EQ(1, bucketInfo.elapsed_timestamp_nanos_size());
-    EXPECT_EQ(baseTimeNs + 5 * bucketSizeNs + 2, bucketInfo.elapsed_timestamp_nanos(0));
-    EXPECT_EQ(0, bucketInfo.wall_clock_timestamp_nanos_size());
-    EXPECT_EQ(MillisToNano(NanoToMillis(baseTimeNs + 5 * bucketSizeNs)),
-            bucketInfo.start_bucket_elapsed_nanos());
-    EXPECT_EQ(MillisToNano(NanoToMillis(activationNs + ttlNs + 1)),
-            bucketInfo.end_bucket_elapsed_nanos());
-    EXPECT_TRUE(bucketInfo.atom(0).subsystem_sleep_state().subsystem_name().empty());
-    EXPECT_GT(bucketInfo.atom(0).subsystem_sleep_state().time_millis(), 0);
-}
+// TODO(b/149590301): Update this test to use new socket schema.
+//TEST(GaugeMetricE2eTest, TestRandomSamplePulledEvents) {
+//    auto config = CreateStatsdConfig(GaugeMetric::RANDOM_ONE_SAMPLE);
+//    int64_t baseTimeNs = getElapsedRealtimeNs();
+//    int64_t configAddedTimeNs = 10 * 60 * NS_PER_SEC + baseTimeNs;
+//    int64_t bucketSizeNs =
+//        TimeUnitToBucketSizeInMillis(config.gauge_metric(0).bucket()) * 1000000;
+//
+//    ConfigKey cfgKey;
+//    auto processor = CreateStatsLogProcessor(baseTimeNs, configAddedTimeNs, config, cfgKey,
+//                                             SharedRefBase::make<FakeSubsystemSleepCallback>(),
+//                                             ATOM_TAG);
+//    EXPECT_EQ(processor->mMetricsManagers.size(), 1u);
+//    EXPECT_TRUE(processor->mMetricsManagers.begin()->second->isConfigValid());
+//    processor->mPullerManager->ForceClearPullerCache();
+//
+//    int startBucketNum = processor->mMetricsManagers.begin()->second->
+//            mAllMetricProducers[0]->getCurrentBucketNum();
+//    EXPECT_GT(startBucketNum, (int64_t)0);
+//
+//    // When creating the config, the gauge metric producer should register the alarm at the
+//    // end of the current bucket.
+//    EXPECT_EQ((size_t)1, processor->mPullerManager->mReceivers.size());
+//    EXPECT_EQ(bucketSizeNs,
+//              processor->mPullerManager->mReceivers.begin()->second.front().intervalNs);
+//    int64_t& nextPullTimeNs =
+//            processor->mPullerManager->mReceivers.begin()->second.front().nextPullTimeNs;
+//    EXPECT_EQ(baseTimeNs + startBucketNum * bucketSizeNs + bucketSizeNs, nextPullTimeNs);
+//
+//    auto screenOffEvent = CreateScreenStateChangedEvent(android::view::DISPLAY_STATE_OFF,
+//                                                        configAddedTimeNs + 55);
+//    processor->OnLogEvent(screenOffEvent.get());
+//
+//    // Pulling alarm arrives on time and reset the sequential pulling alarm.
+//    processor->informPullAlarmFired(nextPullTimeNs + 1);
+//    EXPECT_EQ(baseTimeNs + startBucketNum * bucketSizeNs + 2 * bucketSizeNs, nextPullTimeNs);
+//
+//    auto screenOnEvent = CreateScreenStateChangedEvent(android::view::DISPLAY_STATE_ON,
+//                                                       configAddedTimeNs + bucketSizeNs + 10);
+//    processor->OnLogEvent(screenOnEvent.get());
+//
+//    screenOffEvent = CreateScreenStateChangedEvent(android::view::DISPLAY_STATE_OFF,
+//                                                   configAddedTimeNs + bucketSizeNs + 100);
+//    processor->OnLogEvent(screenOffEvent.get());
+//
+//    processor->informPullAlarmFired(nextPullTimeNs + 1);
+//    EXPECT_EQ(baseTimeNs + startBucketNum * bucketSizeNs + 3 * bucketSizeNs,
+//              nextPullTimeNs);
+//
+//    processor->informPullAlarmFired(nextPullTimeNs + 1);
+//    EXPECT_EQ(baseTimeNs + startBucketNum * bucketSizeNs + 4 * bucketSizeNs, nextPullTimeNs);
+//
+//    screenOnEvent = CreateScreenStateChangedEvent(android::view::DISPLAY_STATE_ON,
+//                                                  configAddedTimeNs + 3 * bucketSizeNs + 2);
+//    processor->OnLogEvent(screenOnEvent.get());
+//
+//    processor->informPullAlarmFired(nextPullTimeNs + 3);
+//    EXPECT_EQ(baseTimeNs + startBucketNum * bucketSizeNs + 5 * bucketSizeNs, nextPullTimeNs);
+//
+//    screenOffEvent = CreateScreenStateChangedEvent(android::view::DISPLAY_STATE_OFF,
+//                                                  configAddedTimeNs + 5 * bucketSizeNs + 1);
+//    processor->OnLogEvent(screenOffEvent.get());
+//
+//    processor->informPullAlarmFired(nextPullTimeNs + 2);
+//    EXPECT_EQ(baseTimeNs + startBucketNum * bucketSizeNs + 6 * bucketSizeNs, nextPullTimeNs);
+//
+//    processor->informPullAlarmFired(nextPullTimeNs + 2);
+//
+//    ConfigMetricsReportList reports;
+//    vector<uint8_t> buffer;
+//    processor->onDumpReport(cfgKey, configAddedTimeNs + 7 * bucketSizeNs + 10, false, true,
+//                            ADB_DUMP, FAST, &buffer);
+//    EXPECT_TRUE(buffer.size() > 0);
+//    EXPECT_TRUE(reports.ParseFromArray(&buffer[0], buffer.size()));
+//    backfillDimensionPath(&reports);
+//    backfillStringInReport(&reports);
+//    backfillStartEndTimestamp(&reports);
+//    EXPECT_EQ(1, reports.reports_size());
+//    EXPECT_EQ(1, reports.reports(0).metrics_size());
+//    StatsLogReport::GaugeMetricDataWrapper gaugeMetrics;
+//    sortMetricDataByDimensionsValue(
+//            reports.reports(0).metrics(0).gauge_metrics(), &gaugeMetrics);
+//    EXPECT_GT((int)gaugeMetrics.data_size(), 1);
+//
+//    auto data = gaugeMetrics.data(0);
+//    EXPECT_EQ(ATOM_TAG, data.dimensions_in_what().field());
+//    EXPECT_EQ(1, data.dimensions_in_what().value_tuple().dimensions_value_size());
+//    EXPECT_EQ(1 /* subsystem name field */,
+//              data.dimensions_in_what().value_tuple().dimensions_value(0).field());
+//    EXPECT_FALSE(data.dimensions_in_what().value_tuple().dimensions_value(0).value_str().empty());
+//    EXPECT_EQ(6, data.bucket_info_size());
+//
+//    EXPECT_EQ(1, data.bucket_info(0).atom_size());
+//    EXPECT_EQ(1, data.bucket_info(0).elapsed_timestamp_nanos_size());
+//    EXPECT_EQ(configAddedTimeNs + 55, data.bucket_info(0).elapsed_timestamp_nanos(0));
+//    EXPECT_EQ(0, data.bucket_info(0).wall_clock_timestamp_nanos_size());
+//    EXPECT_EQ(baseTimeNs + 2 * bucketSizeNs, data.bucket_info(0).start_bucket_elapsed_nanos());
+//    EXPECT_EQ(baseTimeNs + 3 * bucketSizeNs, data.bucket_info(0).end_bucket_elapsed_nanos());
+//    EXPECT_TRUE(data.bucket_info(0).atom(0).subsystem_sleep_state().subsystem_name().empty());
+//    EXPECT_GT(data.bucket_info(0).atom(0).subsystem_sleep_state().time_millis(), 0);
+//
+//    EXPECT_EQ(1, data.bucket_info(1).atom_size());
+//    EXPECT_EQ(baseTimeNs + 3 * bucketSizeNs + 1,
+//              data.bucket_info(1).elapsed_timestamp_nanos(0));
+//    EXPECT_EQ(baseTimeNs + 3 * bucketSizeNs + 1, data.bucket_info(1).elapsed_timestamp_nanos(0));
+//    EXPECT_EQ(baseTimeNs + 3 * bucketSizeNs, data.bucket_info(1).start_bucket_elapsed_nanos());
+//    EXPECT_EQ(baseTimeNs + 4 * bucketSizeNs, data.bucket_info(1).end_bucket_elapsed_nanos());
+//    EXPECT_TRUE(data.bucket_info(1).atom(0).subsystem_sleep_state().subsystem_name().empty());
+//    EXPECT_GT(data.bucket_info(1).atom(0).subsystem_sleep_state().time_millis(), 0);
+//
+//    EXPECT_EQ(1, data.bucket_info(2).atom_size());
+//    EXPECT_EQ(1, data.bucket_info(2).elapsed_timestamp_nanos_size());
+//    EXPECT_EQ(baseTimeNs + 4 * bucketSizeNs + 1,
+//              data.bucket_info(2).elapsed_timestamp_nanos(0));
+//    EXPECT_EQ(baseTimeNs + 4 * bucketSizeNs, data.bucket_info(2).start_bucket_elapsed_nanos());
+//    EXPECT_EQ(baseTimeNs + 5 * bucketSizeNs, data.bucket_info(2).end_bucket_elapsed_nanos());
+//    EXPECT_TRUE(data.bucket_info(2).atom(0).subsystem_sleep_state().subsystem_name().empty());
+//    EXPECT_GT(data.bucket_info(2).atom(0).subsystem_sleep_state().time_millis(), 0);
+//
+//    EXPECT_EQ(1, data.bucket_info(3).atom_size());
+//    EXPECT_EQ(1, data.bucket_info(3).elapsed_timestamp_nanos_size());
+//    EXPECT_EQ(baseTimeNs + 5 * bucketSizeNs + 1,
+//              data.bucket_info(3).elapsed_timestamp_nanos(0));
+//    EXPECT_EQ(baseTimeNs + 5 * bucketSizeNs, data.bucket_info(3).start_bucket_elapsed_nanos());
+//    EXPECT_EQ(baseTimeNs + 6 * bucketSizeNs, data.bucket_info(3).end_bucket_elapsed_nanos());
+//    EXPECT_TRUE(data.bucket_info(3).atom(0).subsystem_sleep_state().subsystem_name().empty());
+//    EXPECT_GT(data.bucket_info(3).atom(0).subsystem_sleep_state().time_millis(), 0);
+//
+//    EXPECT_EQ(1, data.bucket_info(4).atom_size());
+//    EXPECT_EQ(1, data.bucket_info(4).elapsed_timestamp_nanos_size());
+//    EXPECT_EQ(baseTimeNs + 7 * bucketSizeNs + 1,
+//              data.bucket_info(4).elapsed_timestamp_nanos(0));
+//    EXPECT_EQ(baseTimeNs + 7 * bucketSizeNs, data.bucket_info(4).start_bucket_elapsed_nanos());
+//    EXPECT_EQ(baseTimeNs + 8 * bucketSizeNs, data.bucket_info(4).end_bucket_elapsed_nanos());
+//    EXPECT_TRUE(data.bucket_info(4).atom(0).subsystem_sleep_state().subsystem_name().empty());
+//    EXPECT_GT(data.bucket_info(4).atom(0).subsystem_sleep_state().time_millis(), 0);
+//
+//    EXPECT_EQ(1, data.bucket_info(5).atom_size());
+//    EXPECT_EQ(1, data.bucket_info(5).elapsed_timestamp_nanos_size());
+//    EXPECT_EQ(baseTimeNs + 8 * bucketSizeNs + 2,
+//              data.bucket_info(5).elapsed_timestamp_nanos(0));
+//    EXPECT_EQ(baseTimeNs + 8 * bucketSizeNs, data.bucket_info(5).start_bucket_elapsed_nanos());
+//    EXPECT_EQ(baseTimeNs + 9 * bucketSizeNs, data.bucket_info(5).end_bucket_elapsed_nanos());
+//    EXPECT_TRUE(data.bucket_info(5).atom(0).subsystem_sleep_state().subsystem_name().empty());
+//    EXPECT_GT(data.bucket_info(5).atom(0).subsystem_sleep_state().time_millis(), 0);
+//}
+//
+//TEST(GaugeMetricE2eTest, TestConditionChangeToTrueSamplePulledEvents) {
+//    auto config = CreateStatsdConfig(GaugeMetric::CONDITION_CHANGE_TO_TRUE);
+//    int64_t baseTimeNs = getElapsedRealtimeNs();
+//    int64_t configAddedTimeNs = 10 * 60 * NS_PER_SEC + baseTimeNs;
+//    int64_t bucketSizeNs =
+//        TimeUnitToBucketSizeInMillis(config.gauge_metric(0).bucket()) * 1000000;
+//
+//    ConfigKey cfgKey;
+//    auto processor = CreateStatsLogProcessor(baseTimeNs, configAddedTimeNs, config, cfgKey,
+//                                             SharedRefBase::make<FakeSubsystemSleepCallback>(),
+//                                             ATOM_TAG);
+//    EXPECT_EQ(processor->mMetricsManagers.size(), 1u);
+//    EXPECT_TRUE(processor->mMetricsManagers.begin()->second->isConfigValid());
+//    processor->mPullerManager->ForceClearPullerCache();
+//
+//    int startBucketNum = processor->mMetricsManagers.begin()->second->
+//            mAllMetricProducers[0]->getCurrentBucketNum();
+//    EXPECT_GT(startBucketNum, (int64_t)0);
+//
+//    auto screenOffEvent = CreateScreenStateChangedEvent(android::view::DISPLAY_STATE_OFF,
+//                                                        configAddedTimeNs + 55);
+//    processor->OnLogEvent(screenOffEvent.get());
+//
+//    auto screenOnEvent = CreateScreenStateChangedEvent(android::view::DISPLAY_STATE_ON,
+//                                                       configAddedTimeNs + bucketSizeNs + 10);
+//    processor->OnLogEvent(screenOnEvent.get());
+//
+//    screenOffEvent = CreateScreenStateChangedEvent(android::view::DISPLAY_STATE_OFF,
+//                                                   configAddedTimeNs + bucketSizeNs + 100);
+//    processor->OnLogEvent(screenOffEvent.get());
+//
+//    screenOnEvent = CreateScreenStateChangedEvent(android::view::DISPLAY_STATE_ON,
+//                                                  configAddedTimeNs + 3 * bucketSizeNs + 2);
+//    processor->OnLogEvent(screenOnEvent.get());
+//
+//    screenOffEvent = CreateScreenStateChangedEvent(android::view::DISPLAY_STATE_OFF,
+//                                                  configAddedTimeNs + 5 * bucketSizeNs + 1);
+//    processor->OnLogEvent(screenOffEvent.get());
+//    screenOnEvent = CreateScreenStateChangedEvent(android::view::DISPLAY_STATE_ON,
+//                                                  configAddedTimeNs + 5 * bucketSizeNs + 3);
+//    processor->OnLogEvent(screenOnEvent.get());
+//    screenOffEvent = CreateScreenStateChangedEvent(android::view::DISPLAY_STATE_OFF,
+//                                                  configAddedTimeNs + 5 * bucketSizeNs + 10);
+//    processor->OnLogEvent(screenOffEvent.get());
+//
+//    ConfigMetricsReportList reports;
+//    vector<uint8_t> buffer;
+//    processor->onDumpReport(cfgKey, configAddedTimeNs + 8 * bucketSizeNs + 10, false, true,
+//                            ADB_DUMP, FAST, &buffer);
+//    EXPECT_TRUE(buffer.size() > 0);
+//    EXPECT_TRUE(reports.ParseFromArray(&buffer[0], buffer.size()));
+//    backfillDimensionPath(&reports);
+//    backfillStringInReport(&reports);
+//    backfillStartEndTimestamp(&reports);
+//    EXPECT_EQ(1, reports.reports_size());
+//    EXPECT_EQ(1, reports.reports(0).metrics_size());
+//    StatsLogReport::GaugeMetricDataWrapper gaugeMetrics;
+//    sortMetricDataByDimensionsValue(
+//            reports.reports(0).metrics(0).gauge_metrics(), &gaugeMetrics);
+//    EXPECT_GT((int)gaugeMetrics.data_size(), 1);
+//
+//    auto data = gaugeMetrics.data(0);
+//    EXPECT_EQ(ATOM_TAG, data.dimensions_in_what().field());
+//    EXPECT_EQ(1, data.dimensions_in_what().value_tuple().dimensions_value_size());
+//    EXPECT_EQ(1 /* subsystem name field */,
+//              data.dimensions_in_what().value_tuple().dimensions_value(0).field());
+//    EXPECT_FALSE(data.dimensions_in_what().value_tuple().dimensions_value(0).value_str().empty());
+//    EXPECT_EQ(3, data.bucket_info_size());
+//
+//    EXPECT_EQ(1, data.bucket_info(0).atom_size());
+//    EXPECT_EQ(1, data.bucket_info(0).elapsed_timestamp_nanos_size());
+//    EXPECT_EQ(configAddedTimeNs + 55, data.bucket_info(0).elapsed_timestamp_nanos(0));
+//    EXPECT_EQ(0, data.bucket_info(0).wall_clock_timestamp_nanos_size());
+//    EXPECT_EQ(baseTimeNs + 2 * bucketSizeNs, data.bucket_info(0).start_bucket_elapsed_nanos());
+//    EXPECT_EQ(baseTimeNs + 3 * bucketSizeNs, data.bucket_info(0).end_bucket_elapsed_nanos());
+//    EXPECT_TRUE(data.bucket_info(0).atom(0).subsystem_sleep_state().subsystem_name().empty());
+//    EXPECT_GT(data.bucket_info(0).atom(0).subsystem_sleep_state().time_millis(), 0);
+//
+//    EXPECT_EQ(1, data.bucket_info(1).atom_size());
+//    EXPECT_EQ(baseTimeNs + 3 * bucketSizeNs + 100,
+//              data.bucket_info(1).elapsed_timestamp_nanos(0));
+//    EXPECT_EQ(configAddedTimeNs + 55, data.bucket_info(0).elapsed_timestamp_nanos(0));
+//    EXPECT_EQ(baseTimeNs + 3 * bucketSizeNs, data.bucket_info(1).start_bucket_elapsed_nanos());
+//    EXPECT_EQ(baseTimeNs + 4 * bucketSizeNs, data.bucket_info(1).end_bucket_elapsed_nanos());
+//    EXPECT_TRUE(data.bucket_info(1).atom(0).subsystem_sleep_state().subsystem_name().empty());
+//    EXPECT_GT(data.bucket_info(1).atom(0).subsystem_sleep_state().time_millis(), 0);
+//
+//    EXPECT_EQ(2, data.bucket_info(2).atom_size());
+//    EXPECT_EQ(2, data.bucket_info(2).elapsed_timestamp_nanos_size());
+//    EXPECT_EQ(baseTimeNs + 7 * bucketSizeNs + 1,
+//              data.bucket_info(2).elapsed_timestamp_nanos(0));
+//    EXPECT_EQ(baseTimeNs + 7 * bucketSizeNs + 10,
+//              data.bucket_info(2).elapsed_timestamp_nanos(1));
+//    EXPECT_EQ(baseTimeNs + 7 * bucketSizeNs, data.bucket_info(2).start_bucket_elapsed_nanos());
+//    EXPECT_EQ(baseTimeNs + 8 * bucketSizeNs, data.bucket_info(2).end_bucket_elapsed_nanos());
+//    EXPECT_TRUE(data.bucket_info(2).atom(0).subsystem_sleep_state().subsystem_name().empty());
+//    EXPECT_GT(data.bucket_info(2).atom(0).subsystem_sleep_state().time_millis(), 0);
+//    EXPECT_TRUE(data.bucket_info(2).atom(1).subsystem_sleep_state().subsystem_name().empty());
+//    EXPECT_GT(data.bucket_info(2).atom(1).subsystem_sleep_state().time_millis(), 0);
+//}
+//
+//
+//TEST(GaugeMetricE2eTest, TestRandomSamplePulledEvent_LateAlarm) {
+//    auto config = CreateStatsdConfig(GaugeMetric::RANDOM_ONE_SAMPLE);
+//    int64_t baseTimeNs = getElapsedRealtimeNs();
+//    int64_t configAddedTimeNs = 10 * 60 * NS_PER_SEC + baseTimeNs;
+//    int64_t bucketSizeNs =
+//        TimeUnitToBucketSizeInMillis(config.gauge_metric(0).bucket()) * 1000000;
+//
+//    ConfigKey cfgKey;
+//    auto processor = CreateStatsLogProcessor(baseTimeNs, configAddedTimeNs, config, cfgKey,
+//                                             SharedRefBase::make<FakeSubsystemSleepCallback>(),
+//                                             ATOM_TAG);
+//    EXPECT_EQ(processor->mMetricsManagers.size(), 1u);
+//    EXPECT_TRUE(processor->mMetricsManagers.begin()->second->isConfigValid());
+//    processor->mPullerManager->ForceClearPullerCache();
+//
+//    int startBucketNum = processor->mMetricsManagers.begin()->second->
+//            mAllMetricProducers[0]->getCurrentBucketNum();
+//    EXPECT_GT(startBucketNum, (int64_t)0);
+//
+//    // When creating the config, the gauge metric producer should register the alarm at the
+//    // end of the current bucket.
+//    EXPECT_EQ((size_t)1, processor->mPullerManager->mReceivers.size());
+//    EXPECT_EQ(bucketSizeNs,
+//              processor->mPullerManager->mReceivers.begin()->second.front().intervalNs);
+//    int64_t& nextPullTimeNs =
+//            processor->mPullerManager->mReceivers.begin()->second.front().nextPullTimeNs;
+//    EXPECT_EQ(baseTimeNs + startBucketNum * bucketSizeNs + bucketSizeNs, nextPullTimeNs);
+//
+//    auto screenOffEvent = CreateScreenStateChangedEvent(android::view::DISPLAY_STATE_OFF,
+//                                                        configAddedTimeNs + 55);
+//    processor->OnLogEvent(screenOffEvent.get());
+//
+//    auto screenOnEvent = CreateScreenStateChangedEvent(android::view::DISPLAY_STATE_ON,
+//                                                       configAddedTimeNs + bucketSizeNs + 10);
+//    processor->OnLogEvent(screenOnEvent.get());
+//
+//    // Pulling alarm arrives one bucket size late.
+//    processor->informPullAlarmFired(nextPullTimeNs + bucketSizeNs);
+//    EXPECT_EQ(baseTimeNs + startBucketNum * bucketSizeNs + 3 * bucketSizeNs, nextPullTimeNs);
+//
+//    screenOffEvent = CreateScreenStateChangedEvent(android::view::DISPLAY_STATE_OFF,
+//                                                   configAddedTimeNs + 3 * bucketSizeNs + 11);
+//    processor->OnLogEvent(screenOffEvent.get());
+//
+//    // Pulling alarm arrives more than one bucket size late.
+//    processor->informPullAlarmFired(nextPullTimeNs + bucketSizeNs + 12);
+//    EXPECT_EQ(baseTimeNs + startBucketNum * bucketSizeNs + 5 * bucketSizeNs, nextPullTimeNs);
+//
+//    ConfigMetricsReportList reports;
+//    vector<uint8_t> buffer;
+//    processor->onDumpReport(cfgKey, configAddedTimeNs + 7 * bucketSizeNs + 10, false, true,
+//                            ADB_DUMP, FAST, &buffer);
+//    EXPECT_TRUE(buffer.size() > 0);
+//    EXPECT_TRUE(reports.ParseFromArray(&buffer[0], buffer.size()));
+//    backfillDimensionPath(&reports);
+//    backfillStringInReport(&reports);
+//    backfillStartEndTimestamp(&reports);
+//    EXPECT_EQ(1, reports.reports_size());
+//    EXPECT_EQ(1, reports.reports(0).metrics_size());
+//    StatsLogReport::GaugeMetricDataWrapper gaugeMetrics;
+//    sortMetricDataByDimensionsValue(
+//            reports.reports(0).metrics(0).gauge_metrics(), &gaugeMetrics);
+//    EXPECT_GT((int)gaugeMetrics.data_size(), 1);
+//
+//    auto data = gaugeMetrics.data(0);
+//    EXPECT_EQ(ATOM_TAG, data.dimensions_in_what().field());
+//    EXPECT_EQ(1, data.dimensions_in_what().value_tuple().dimensions_value_size());
+//    EXPECT_EQ(1 /* subsystem name field */,
+//              data.dimensions_in_what().value_tuple().dimensions_value(0).field());
+//    EXPECT_FALSE(data.dimensions_in_what().value_tuple().dimensions_value(0).value_str().empty());
+//    EXPECT_EQ(3, data.bucket_info_size());
+//
+//    EXPECT_EQ(1, data.bucket_info(0).atom_size());
+//    EXPECT_EQ(1, data.bucket_info(0).elapsed_timestamp_nanos_size());
+//    EXPECT_EQ(configAddedTimeNs + 55, data.bucket_info(0).elapsed_timestamp_nanos(0));
+//    EXPECT_EQ(baseTimeNs + 2 * bucketSizeNs, data.bucket_info(0).start_bucket_elapsed_nanos());
+//    EXPECT_EQ(baseTimeNs + 3 * bucketSizeNs, data.bucket_info(0).end_bucket_elapsed_nanos());
+//    EXPECT_TRUE(data.bucket_info(0).atom(0).subsystem_sleep_state().subsystem_name().empty());
+//    EXPECT_GT(data.bucket_info(0).atom(0).subsystem_sleep_state().time_millis(), 0);
+//
+//    EXPECT_EQ(1, data.bucket_info(1).atom_size());
+//    EXPECT_EQ(configAddedTimeNs + 3 * bucketSizeNs + 11,
+//              data.bucket_info(1).elapsed_timestamp_nanos(0));
+//    EXPECT_EQ(configAddedTimeNs + 55, data.bucket_info(0).elapsed_timestamp_nanos(0));
+//    EXPECT_EQ(baseTimeNs + 5 * bucketSizeNs, data.bucket_info(1).start_bucket_elapsed_nanos());
+//    EXPECT_EQ(baseTimeNs + 6 * bucketSizeNs, data.bucket_info(1).end_bucket_elapsed_nanos());
+//    EXPECT_TRUE(data.bucket_info(1).atom(0).subsystem_sleep_state().subsystem_name().empty());
+//    EXPECT_GT(data.bucket_info(1).atom(0).subsystem_sleep_state().time_millis(), 0);
+//
+//    EXPECT_EQ(1, data.bucket_info(2).atom_size());
+//    EXPECT_EQ(1, data.bucket_info(2).elapsed_timestamp_nanos_size());
+//    EXPECT_EQ(baseTimeNs + 6 * bucketSizeNs + 12,
+//              data.bucket_info(2).elapsed_timestamp_nanos(0));
+//    EXPECT_EQ(baseTimeNs + 6 * bucketSizeNs, data.bucket_info(2).start_bucket_elapsed_nanos());
+//    EXPECT_EQ(baseTimeNs + 7 * bucketSizeNs, data.bucket_info(2).end_bucket_elapsed_nanos());
+//    EXPECT_TRUE(data.bucket_info(2).atom(0).subsystem_sleep_state().subsystem_name().empty());
+//    EXPECT_GT(data.bucket_info(2).atom(0).subsystem_sleep_state().time_millis(), 0);
+//}
+//
+//TEST(GaugeMetricE2eTest, TestRandomSamplePulledEventsWithActivation) {
+//    auto config = CreateStatsdConfig(GaugeMetric::RANDOM_ONE_SAMPLE, /*useCondition=*/false);
+//
+//    int64_t baseTimeNs = getElapsedRealtimeNs();
+//    int64_t configAddedTimeNs = 10 * 60 * NS_PER_SEC + baseTimeNs;
+//    int64_t bucketSizeNs =
+//        TimeUnitToBucketSizeInMillis(config.gauge_metric(0).bucket()) * 1000000;
+//
+//    auto batterySaverStartMatcher = CreateBatterySaverModeStartAtomMatcher();
+//    *config.add_atom_matcher() = batterySaverStartMatcher;
+//    const int64_t ttlNs = 2 * bucketSizeNs; // Two buckets.
+//    auto metric_activation = config.add_metric_activation();
+//    metric_activation->set_metric_id(metricId);
+//    metric_activation->set_activation_type(ACTIVATE_IMMEDIATELY);
+//    auto event_activation = metric_activation->add_event_activation();
+//    event_activation->set_atom_matcher_id(batterySaverStartMatcher.id());
+//    event_activation->set_ttl_seconds(ttlNs / 1000000000);
+//
+//    ConfigKey cfgKey;
+//    auto processor = CreateStatsLogProcessor(baseTimeNs, configAddedTimeNs, config, cfgKey,
+//                                             SharedRefBase::make<FakeSubsystemSleepCallback>(),
+//                                             ATOM_TAG);
+//    EXPECT_EQ(processor->mMetricsManagers.size(), 1u);
+//    EXPECT_TRUE(processor->mMetricsManagers.begin()->second->isConfigValid());
+//    processor->mPullerManager->ForceClearPullerCache();
+//
+//    int startBucketNum = processor->mMetricsManagers.begin()->second->
+//            mAllMetricProducers[0]->getCurrentBucketNum();
+//    EXPECT_GT(startBucketNum, (int64_t)0);
+//    EXPECT_FALSE(processor->mMetricsManagers.begin()->second->mAllMetricProducers[0]->isActive());
+//
+//    // When creating the config, the gauge metric producer should register the alarm at the
+//    // end of the current bucket.
+//    EXPECT_EQ((size_t)1, processor->mPullerManager->mReceivers.size());
+//    EXPECT_EQ(bucketSizeNs,
+//              processor->mPullerManager->mReceivers.begin()->second.front().intervalNs);
+//    int64_t& nextPullTimeNs =
+//            processor->mPullerManager->mReceivers.begin()->second.front().nextPullTimeNs;
+//    EXPECT_EQ(baseTimeNs + startBucketNum * bucketSizeNs + bucketSizeNs, nextPullTimeNs);
+//
+//    // Pulling alarm arrives on time and reset the sequential pulling alarm.
+//    // Event should not be kept.
+//    processor->informPullAlarmFired(nextPullTimeNs + 1); // 15 mins + 1 ns.
+//    EXPECT_EQ(baseTimeNs + startBucketNum * bucketSizeNs + 2 * bucketSizeNs, nextPullTimeNs);
+//    EXPECT_FALSE(processor->mMetricsManagers.begin()->second->mAllMetricProducers[0]->isActive());
+//
+//    // Activate the metric. A pull occurs upon activation.
+//    const int64_t activationNs = configAddedTimeNs + bucketSizeNs + (2 * 1000 * 1000); // 2 millis.
+//    auto batterySaverOnEvent = CreateBatterySaverOnEvent(activationNs);
+//    processor->OnLogEvent(batterySaverOnEvent.get()); // 15 mins + 2 ms.
+//    EXPECT_TRUE(processor->mMetricsManagers.begin()->second->mAllMetricProducers[0]->isActive());
+//
+//    // This event should be kept. 2 total.
+//    processor->informPullAlarmFired(nextPullTimeNs + 1); // 20 mins + 1 ns.
+//    EXPECT_EQ(baseTimeNs + startBucketNum * bucketSizeNs + 3 * bucketSizeNs,
+//              nextPullTimeNs);
+//
+//    // This event should be kept. 3 total.
+//    processor->informPullAlarmFired(nextPullTimeNs + 2); // 25 mins + 2 ns.
+//    EXPECT_EQ(baseTimeNs + startBucketNum * bucketSizeNs + 4 * bucketSizeNs, nextPullTimeNs);
+//
+//    // Create random event to deactivate metric.
+//    auto deactivationEvent = CreateScreenBrightnessChangedEvent(50, activationNs + ttlNs + 1);
+//    processor->OnLogEvent(deactivationEvent.get());
+//    EXPECT_FALSE(processor->mMetricsManagers.begin()->second->mAllMetricProducers[0]->isActive());
+//
+//    // Event should not be kept. 3 total.
+//    processor->informPullAlarmFired(nextPullTimeNs + 3);
+//    EXPECT_EQ(baseTimeNs + startBucketNum * bucketSizeNs + 5 * bucketSizeNs, nextPullTimeNs);
+//
+//    processor->informPullAlarmFired(nextPullTimeNs + 2);
+//
+//    ConfigMetricsReportList reports;
+//    vector<uint8_t> buffer;
+//    processor->onDumpReport(cfgKey, configAddedTimeNs + 7 * bucketSizeNs + 10, false, true,
+//                            ADB_DUMP, FAST, &buffer);
+//    EXPECT_TRUE(buffer.size() > 0);
+//    EXPECT_TRUE(reports.ParseFromArray(&buffer[0], buffer.size()));
+//    backfillDimensionPath(&reports);
+//    backfillStringInReport(&reports);
+//    backfillStartEndTimestamp(&reports);
+//    EXPECT_EQ(1, reports.reports_size());
+//    EXPECT_EQ(1, reports.reports(0).metrics_size());
+//    StatsLogReport::GaugeMetricDataWrapper gaugeMetrics;
+//    sortMetricDataByDimensionsValue(
+//            reports.reports(0).metrics(0).gauge_metrics(), &gaugeMetrics);
+//    EXPECT_GT((int)gaugeMetrics.data_size(), 0);
+//
+//    auto data = gaugeMetrics.data(0);
+//    EXPECT_EQ(ATOM_TAG, data.dimensions_in_what().field());
+//    EXPECT_EQ(1, data.dimensions_in_what().value_tuple().dimensions_value_size());
+//    EXPECT_EQ(1 /* subsystem name field */,
+//              data.dimensions_in_what().value_tuple().dimensions_value(0).field());
+//    EXPECT_FALSE(data.dimensions_in_what().value_tuple().dimensions_value(0).value_str().empty());
+//    EXPECT_EQ(3, data.bucket_info_size());
+//
+//    auto bucketInfo = data.bucket_info(0);
+//    EXPECT_EQ(1, bucketInfo.atom_size());
+//    EXPECT_EQ(1, bucketInfo.elapsed_timestamp_nanos_size());
+//    EXPECT_EQ(activationNs, bucketInfo.elapsed_timestamp_nanos(0));
+//    EXPECT_EQ(0, bucketInfo.wall_clock_timestamp_nanos_size());
+//    EXPECT_EQ(baseTimeNs + 3 * bucketSizeNs, bucketInfo.start_bucket_elapsed_nanos());
+//    EXPECT_EQ(baseTimeNs + 4 * bucketSizeNs, bucketInfo.end_bucket_elapsed_nanos());
+//    EXPECT_TRUE(bucketInfo.atom(0).subsystem_sleep_state().subsystem_name().empty());
+//    EXPECT_GT(bucketInfo.atom(0).subsystem_sleep_state().time_millis(), 0);
+//
+//    bucketInfo = data.bucket_info(1);
+//    EXPECT_EQ(1, bucketInfo.atom_size());
+//    EXPECT_EQ(1, bucketInfo.elapsed_timestamp_nanos_size());
+//    EXPECT_EQ(baseTimeNs + 4 * bucketSizeNs + 1, bucketInfo.elapsed_timestamp_nanos(0));
+//    EXPECT_EQ(0, bucketInfo.wall_clock_timestamp_nanos_size());
+//    EXPECT_EQ(baseTimeNs + 4 * bucketSizeNs, bucketInfo.start_bucket_elapsed_nanos());
+//    EXPECT_EQ(baseTimeNs + 5 * bucketSizeNs, bucketInfo.end_bucket_elapsed_nanos());
+//    EXPECT_TRUE(bucketInfo.atom(0).subsystem_sleep_state().subsystem_name().empty());
+//    EXPECT_GT(bucketInfo.atom(0).subsystem_sleep_state().time_millis(), 0);
+//
+//    bucketInfo = data.bucket_info(2);
+//    EXPECT_EQ(1, bucketInfo.atom_size());
+//    EXPECT_EQ(1, bucketInfo.elapsed_timestamp_nanos_size());
+//    EXPECT_EQ(baseTimeNs + 5 * bucketSizeNs + 2, bucketInfo.elapsed_timestamp_nanos(0));
+//    EXPECT_EQ(0, bucketInfo.wall_clock_timestamp_nanos_size());
+//    EXPECT_EQ(MillisToNano(NanoToMillis(baseTimeNs + 5 * bucketSizeNs)),
+//            bucketInfo.start_bucket_elapsed_nanos());
+//    EXPECT_EQ(MillisToNano(NanoToMillis(activationNs + ttlNs + 1)),
+//            bucketInfo.end_bucket_elapsed_nanos());
+//    EXPECT_TRUE(bucketInfo.atom(0).subsystem_sleep_state().subsystem_name().empty());
+//    EXPECT_GT(bucketInfo.atom(0).subsystem_sleep_state().time_millis(), 0);
+//}
 
 TEST(GaugeMetricE2eTest, TestRandomSamplePulledEventsNoCondition) {
     auto config = CreateStatsdConfig(GaugeMetric::RANDOM_ONE_SAMPLE, /*useCondition=*/false);
diff --git a/cmds/statsd/tests/e2e/GaugeMetric_e2e_push_test.cpp b/cmds/statsd/tests/e2e/GaugeMetric_e2e_push_test.cpp
index cd80310..ef6e753 100644
--- a/cmds/statsd/tests/e2e/GaugeMetric_e2e_push_test.cpp
+++ b/cmds/statsd/tests/e2e/GaugeMetric_e2e_push_test.cpp
@@ -68,219 +68,221 @@
     return config;
 }
 
-std::unique_ptr<LogEvent> CreateAppStartOccurredEvent(
-    const int uid, const string& pkg_name, AppStartOccurred::TransitionType type,
-    const string& activity_name, const string& calling_pkg_name, const bool is_instant_app,
-    int64_t activity_start_msec, uint64_t timestampNs) {
-    auto logEvent = std::make_unique<LogEvent>(
-        android::util::APP_START_OCCURRED, timestampNs);
-    logEvent->write(uid);
-    logEvent->write(pkg_name);
-    logEvent->write(type);
-    logEvent->write(activity_name);
-    logEvent->write(calling_pkg_name);
-    logEvent->write(is_instant_app);
-    logEvent->write(activity_start_msec);
-    logEvent->init();
-    return logEvent;
-}
+// TODO(b/149590301): Update this helper to use new socket schema.
+//std::unique_ptr<LogEvent> CreateAppStartOccurredEvent(
+//    const int uid, const string& pkg_name, AppStartOccurred::TransitionType type,
+//    const string& activity_name, const string& calling_pkg_name, const bool is_instant_app,
+//    int64_t activity_start_msec, uint64_t timestampNs) {
+//    auto logEvent = std::make_unique<LogEvent>(
+//        android::util::APP_START_OCCURRED, timestampNs);
+//    logEvent->write(uid);
+//    logEvent->write(pkg_name);
+//    logEvent->write(type);
+//    logEvent->write(activity_name);
+//    logEvent->write(calling_pkg_name);
+//    logEvent->write(is_instant_app);
+//    logEvent->write(activity_start_msec);
+//    logEvent->init();
+//    return logEvent;
+//}
 
 }  // namespace
 
-TEST(GaugeMetricE2eTest, TestMultipleFieldsForPushedEvent) {
-    for (const auto& sampling_type :
-            { GaugeMetric::FIRST_N_SAMPLES, GaugeMetric:: RANDOM_ONE_SAMPLE }) {
-        auto config = CreateStatsdConfigForPushedEvent(sampling_type);
-        int64_t bucketStartTimeNs = 10000000000;
-        int64_t bucketSizeNs =
-            TimeUnitToBucketSizeInMillis(config.gauge_metric(0).bucket()) * 1000000;
-
-        ConfigKey cfgKey;
-        auto processor = CreateStatsLogProcessor(
-                bucketStartTimeNs, bucketStartTimeNs, config, cfgKey);
-        EXPECT_EQ(processor->mMetricsManagers.size(), 1u);
-        EXPECT_TRUE(processor->mMetricsManagers.begin()->second->isConfigValid());
-
-        int appUid1 = 123;
-        int appUid2 = 456;
-        std::vector<std::unique_ptr<LogEvent>> events;
-        events.push_back(CreateMoveToBackgroundEvent(appUid1, bucketStartTimeNs + 15));
-        events.push_back(CreateMoveToForegroundEvent(
-                appUid1, bucketStartTimeNs + bucketSizeNs + 250));
-        events.push_back(CreateMoveToBackgroundEvent(
-                appUid1, bucketStartTimeNs + bucketSizeNs + 350));
-        events.push_back(CreateMoveToForegroundEvent(
-            appUid1, bucketStartTimeNs + 2 * bucketSizeNs + 100));
-
-
-        events.push_back(CreateAppStartOccurredEvent(
-            appUid1, "app1", AppStartOccurred::WARM, "activity_name1", "calling_pkg_name1",
-            true /*is_instant_app*/, 101 /*activity_start_msec*/, bucketStartTimeNs + 10));
-        events.push_back(CreateAppStartOccurredEvent(
-            appUid1, "app1", AppStartOccurred::HOT, "activity_name2", "calling_pkg_name2",
-            true /*is_instant_app*/, 102 /*activity_start_msec*/, bucketStartTimeNs + 20));
-        events.push_back(CreateAppStartOccurredEvent(
-            appUid1, "app1", AppStartOccurred::COLD, "activity_name3", "calling_pkg_name3",
-            true /*is_instant_app*/, 103 /*activity_start_msec*/, bucketStartTimeNs + 30));
-        events.push_back(CreateAppStartOccurredEvent(
-            appUid1, "app1", AppStartOccurred::WARM, "activity_name4", "calling_pkg_name4",
-            true /*is_instant_app*/, 104 /*activity_start_msec*/,
-            bucketStartTimeNs + bucketSizeNs + 30));
-        events.push_back(CreateAppStartOccurredEvent(
-            appUid1, "app1", AppStartOccurred::COLD, "activity_name5", "calling_pkg_name5",
-            true /*is_instant_app*/, 105 /*activity_start_msec*/,
-            bucketStartTimeNs + 2 * bucketSizeNs));
-        events.push_back(CreateAppStartOccurredEvent(
-            appUid1, "app1", AppStartOccurred::HOT, "activity_name6", "calling_pkg_name6",
-            false /*is_instant_app*/, 106 /*activity_start_msec*/,
-            bucketStartTimeNs + 2 * bucketSizeNs + 10));
-
-        events.push_back(CreateMoveToBackgroundEvent(
-                appUid2, bucketStartTimeNs + bucketSizeNs + 10));
-        events.push_back(CreateAppStartOccurredEvent(
-            appUid2, "app2", AppStartOccurred::COLD, "activity_name7", "calling_pkg_name7",
-            true /*is_instant_app*/, 201 /*activity_start_msec*/,
-            bucketStartTimeNs + 2 * bucketSizeNs + 10));
-
-        sortLogEventsByTimestamp(&events);
-
-        for (const auto& event : events) {
-            processor->OnLogEvent(event.get());
-        }
-        ConfigMetricsReportList reports;
-        vector<uint8_t> buffer;
-        processor->onDumpReport(cfgKey, bucketStartTimeNs + 3 * bucketSizeNs, false, true,
-                                ADB_DUMP, FAST, &buffer);
-        EXPECT_TRUE(buffer.size() > 0);
-        EXPECT_TRUE(reports.ParseFromArray(&buffer[0], buffer.size()));
-        backfillDimensionPath(&reports);
-        backfillStringInReport(&reports);
-        backfillStartEndTimestamp(&reports);
-        EXPECT_EQ(1, reports.reports_size());
-        EXPECT_EQ(1, reports.reports(0).metrics_size());
-        StatsLogReport::GaugeMetricDataWrapper gaugeMetrics;
-        sortMetricDataByDimensionsValue(
-                reports.reports(0).metrics(0).gauge_metrics(), &gaugeMetrics);
-        EXPECT_EQ(2, gaugeMetrics.data_size());
-
-        auto data = gaugeMetrics.data(0);
-        EXPECT_EQ(android::util::APP_START_OCCURRED, data.dimensions_in_what().field());
-        EXPECT_EQ(1, data.dimensions_in_what().value_tuple().dimensions_value_size());
-        EXPECT_EQ(1 /* uid field */,
-                  data.dimensions_in_what().value_tuple().dimensions_value(0).field());
-        EXPECT_EQ(appUid1, data.dimensions_in_what().value_tuple().dimensions_value(0).value_int());
-        EXPECT_EQ(3, data.bucket_info_size());
-        if (sampling_type == GaugeMetric::FIRST_N_SAMPLES) {
-            EXPECT_EQ(2, data.bucket_info(0).atom_size());
-            EXPECT_EQ(2, data.bucket_info(0).elapsed_timestamp_nanos_size());
-            EXPECT_EQ(0, data.bucket_info(0).wall_clock_timestamp_nanos_size());
-            EXPECT_EQ(bucketStartTimeNs, data.bucket_info(0).start_bucket_elapsed_nanos());
-            EXPECT_EQ(bucketStartTimeNs + bucketSizeNs,
-                      data.bucket_info(0).end_bucket_elapsed_nanos());
-            EXPECT_EQ(AppStartOccurred::HOT,
-                      data.bucket_info(0).atom(0).app_start_occurred().type());
-            EXPECT_EQ("activity_name2",
-                      data.bucket_info(0).atom(0).app_start_occurred().activity_name());
-            EXPECT_EQ(102L,
-                      data.bucket_info(0).atom(0).app_start_occurred().activity_start_millis());
-            EXPECT_EQ(AppStartOccurred::COLD,
-                      data.bucket_info(0).atom(1).app_start_occurred().type());
-            EXPECT_EQ("activity_name3",
-                      data.bucket_info(0).atom(1).app_start_occurred().activity_name());
-            EXPECT_EQ(103L,
-                      data.bucket_info(0).atom(1).app_start_occurred().activity_start_millis());
-
-            EXPECT_EQ(1, data.bucket_info(1).atom_size());
-            EXPECT_EQ(1, data.bucket_info(1).elapsed_timestamp_nanos_size());
-            EXPECT_EQ(bucketStartTimeNs + bucketSizeNs,
-                      data.bucket_info(1).start_bucket_elapsed_nanos());
-            EXPECT_EQ(bucketStartTimeNs + 2 * bucketSizeNs,
-                      data.bucket_info(1).end_bucket_elapsed_nanos());
-            EXPECT_EQ(AppStartOccurred::WARM,
-                      data.bucket_info(1).atom(0).app_start_occurred().type());
-            EXPECT_EQ("activity_name4",
-                      data.bucket_info(1).atom(0).app_start_occurred().activity_name());
-            EXPECT_EQ(104L,
-                      data.bucket_info(1).atom(0).app_start_occurred().activity_start_millis());
-
-            EXPECT_EQ(2, data.bucket_info(2).atom_size());
-            EXPECT_EQ(2, data.bucket_info(2).elapsed_timestamp_nanos_size());
-            EXPECT_EQ(bucketStartTimeNs + 2 * bucketSizeNs,
-                      data.bucket_info(2).start_bucket_elapsed_nanos());
-            EXPECT_EQ(bucketStartTimeNs + 3 * bucketSizeNs,
-                      data.bucket_info(2).end_bucket_elapsed_nanos());
-            EXPECT_EQ(AppStartOccurred::COLD,
-                      data.bucket_info(2).atom(0).app_start_occurred().type());
-            EXPECT_EQ("activity_name5",
-                      data.bucket_info(2).atom(0).app_start_occurred().activity_name());
-            EXPECT_EQ(105L,
-                      data.bucket_info(2).atom(0).app_start_occurred().activity_start_millis());
-            EXPECT_EQ(AppStartOccurred::HOT,
-                      data.bucket_info(2).atom(1).app_start_occurred().type());
-            EXPECT_EQ("activity_name6",
-                      data.bucket_info(2).atom(1).app_start_occurred().activity_name());
-            EXPECT_EQ(106L,
-                      data.bucket_info(2).atom(1).app_start_occurred().activity_start_millis());
-        } else {
-            EXPECT_EQ(1, data.bucket_info(0).atom_size());
-            EXPECT_EQ(1, data.bucket_info(0).elapsed_timestamp_nanos_size());
-            EXPECT_EQ(bucketStartTimeNs, data.bucket_info(0).start_bucket_elapsed_nanos());
-            EXPECT_EQ(bucketStartTimeNs + bucketSizeNs,
-                      data.bucket_info(0).end_bucket_elapsed_nanos());
-            EXPECT_EQ(AppStartOccurred::HOT,
-                      data.bucket_info(0).atom(0).app_start_occurred().type());
-            EXPECT_EQ("activity_name2",
-                      data.bucket_info(0).atom(0).app_start_occurred().activity_name());
-            EXPECT_EQ(102L,
-                      data.bucket_info(0).atom(0).app_start_occurred().activity_start_millis());
-
-            EXPECT_EQ(1, data.bucket_info(1).atom_size());
-            EXPECT_EQ(1, data.bucket_info(1).elapsed_timestamp_nanos_size());
-            EXPECT_EQ(bucketStartTimeNs + bucketSizeNs,
-                      data.bucket_info(1).start_bucket_elapsed_nanos());
-            EXPECT_EQ(bucketStartTimeNs + 2 * bucketSizeNs,
-                      data.bucket_info(1).end_bucket_elapsed_nanos());
-            EXPECT_EQ(AppStartOccurred::WARM,
-                      data.bucket_info(1).atom(0).app_start_occurred().type());
-            EXPECT_EQ("activity_name4",
-                      data.bucket_info(1).atom(0).app_start_occurred().activity_name());
-            EXPECT_EQ(104L,
-                      data.bucket_info(1).atom(0).app_start_occurred().activity_start_millis());
-
-            EXPECT_EQ(1, data.bucket_info(2).atom_size());
-            EXPECT_EQ(1, data.bucket_info(2).elapsed_timestamp_nanos_size());
-            EXPECT_EQ(bucketStartTimeNs + 2 * bucketSizeNs,
-                      data.bucket_info(2).start_bucket_elapsed_nanos());
-            EXPECT_EQ(bucketStartTimeNs + 3 * bucketSizeNs,
-                      data.bucket_info(2).end_bucket_elapsed_nanos());
-            EXPECT_EQ(AppStartOccurred::COLD,
-                      data.bucket_info(2).atom(0).app_start_occurred().type());
-            EXPECT_EQ("activity_name5",
-                      data.bucket_info(2).atom(0).app_start_occurred().activity_name());
-            EXPECT_EQ(105L,
-                      data.bucket_info(2).atom(0).app_start_occurred().activity_start_millis());
-        }
-
-        data = gaugeMetrics.data(1);
-
-        EXPECT_EQ(data.dimensions_in_what().field(), android::util::APP_START_OCCURRED);
-        EXPECT_EQ(data.dimensions_in_what().value_tuple().dimensions_value_size(), 1);
-        EXPECT_EQ(1 /* uid field */,
-                  data.dimensions_in_what().value_tuple().dimensions_value(0).field());
-        EXPECT_EQ(appUid2, data.dimensions_in_what().value_tuple().dimensions_value(0).value_int());
-        EXPECT_EQ(1, data.bucket_info_size());
-        EXPECT_EQ(1, data.bucket_info(0).atom_size());
-        EXPECT_EQ(1, data.bucket_info(0).elapsed_timestamp_nanos_size());
-        EXPECT_EQ(bucketStartTimeNs + 2 * bucketSizeNs,
-                  data.bucket_info(0).start_bucket_elapsed_nanos());
-        EXPECT_EQ(bucketStartTimeNs + 3 * bucketSizeNs,
-                  data.bucket_info(0).end_bucket_elapsed_nanos());
-        EXPECT_EQ(AppStartOccurred::COLD, data.bucket_info(0).atom(0).app_start_occurred().type());
-        EXPECT_EQ("activity_name7",
-                  data.bucket_info(0).atom(0).app_start_occurred().activity_name());
-        EXPECT_EQ(201L, data.bucket_info(0).atom(0).app_start_occurred().activity_start_millis());
-    }
-}
+// TODO(b/149590301): Update this test to use new socket schema.
+//TEST(GaugeMetricE2eTest, TestMultipleFieldsForPushedEvent) {
+//    for (const auto& sampling_type :
+//            { GaugeMetric::FIRST_N_SAMPLES, GaugeMetric:: RANDOM_ONE_SAMPLE }) {
+//        auto config = CreateStatsdConfigForPushedEvent(sampling_type);
+//        int64_t bucketStartTimeNs = 10000000000;
+//        int64_t bucketSizeNs =
+//            TimeUnitToBucketSizeInMillis(config.gauge_metric(0).bucket()) * 1000000;
+//
+//        ConfigKey cfgKey;
+//        auto processor = CreateStatsLogProcessor(
+//                bucketStartTimeNs, bucketStartTimeNs, config, cfgKey);
+//        EXPECT_EQ(processor->mMetricsManagers.size(), 1u);
+//        EXPECT_TRUE(processor->mMetricsManagers.begin()->second->isConfigValid());
+//
+//        int appUid1 = 123;
+//        int appUid2 = 456;
+//        std::vector<std::unique_ptr<LogEvent>> events;
+//        events.push_back(CreateMoveToBackgroundEvent(appUid1, bucketStartTimeNs + 15));
+//        events.push_back(CreateMoveToForegroundEvent(
+//                appUid1, bucketStartTimeNs + bucketSizeNs + 250));
+//        events.push_back(CreateMoveToBackgroundEvent(
+//                appUid1, bucketStartTimeNs + bucketSizeNs + 350));
+//        events.push_back(CreateMoveToForegroundEvent(
+//            appUid1, bucketStartTimeNs + 2 * bucketSizeNs + 100));
+//
+//
+//        events.push_back(CreateAppStartOccurredEvent(
+//            appUid1, "app1", AppStartOccurred::WARM, "activity_name1", "calling_pkg_name1",
+//            true /*is_instant_app*/, 101 /*activity_start_msec*/, bucketStartTimeNs + 10));
+//        events.push_back(CreateAppStartOccurredEvent(
+//            appUid1, "app1", AppStartOccurred::HOT, "activity_name2", "calling_pkg_name2",
+//            true /*is_instant_app*/, 102 /*activity_start_msec*/, bucketStartTimeNs + 20));
+//        events.push_back(CreateAppStartOccurredEvent(
+//            appUid1, "app1", AppStartOccurred::COLD, "activity_name3", "calling_pkg_name3",
+//            true /*is_instant_app*/, 103 /*activity_start_msec*/, bucketStartTimeNs + 30));
+//        events.push_back(CreateAppStartOccurredEvent(
+//            appUid1, "app1", AppStartOccurred::WARM, "activity_name4", "calling_pkg_name4",
+//            true /*is_instant_app*/, 104 /*activity_start_msec*/,
+//            bucketStartTimeNs + bucketSizeNs + 30));
+//        events.push_back(CreateAppStartOccurredEvent(
+//            appUid1, "app1", AppStartOccurred::COLD, "activity_name5", "calling_pkg_name5",
+//            true /*is_instant_app*/, 105 /*activity_start_msec*/,
+//            bucketStartTimeNs + 2 * bucketSizeNs));
+//        events.push_back(CreateAppStartOccurredEvent(
+//            appUid1, "app1", AppStartOccurred::HOT, "activity_name6", "calling_pkg_name6",
+//            false /*is_instant_app*/, 106 /*activity_start_msec*/,
+//            bucketStartTimeNs + 2 * bucketSizeNs + 10));
+//
+//        events.push_back(CreateMoveToBackgroundEvent(
+//                appUid2, bucketStartTimeNs + bucketSizeNs + 10));
+//        events.push_back(CreateAppStartOccurredEvent(
+//            appUid2, "app2", AppStartOccurred::COLD, "activity_name7", "calling_pkg_name7",
+//            true /*is_instant_app*/, 201 /*activity_start_msec*/,
+//            bucketStartTimeNs + 2 * bucketSizeNs + 10));
+//
+//        sortLogEventsByTimestamp(&events);
+//
+//        for (const auto& event : events) {
+//            processor->OnLogEvent(event.get());
+//        }
+//        ConfigMetricsReportList reports;
+//        vector<uint8_t> buffer;
+//        processor->onDumpReport(cfgKey, bucketStartTimeNs + 3 * bucketSizeNs, false, true,
+//                                ADB_DUMP, FAST, &buffer);
+//        EXPECT_TRUE(buffer.size() > 0);
+//        EXPECT_TRUE(reports.ParseFromArray(&buffer[0], buffer.size()));
+//        backfillDimensionPath(&reports);
+//        backfillStringInReport(&reports);
+//        backfillStartEndTimestamp(&reports);
+//        EXPECT_EQ(1, reports.reports_size());
+//        EXPECT_EQ(1, reports.reports(0).metrics_size());
+//        StatsLogReport::GaugeMetricDataWrapper gaugeMetrics;
+//        sortMetricDataByDimensionsValue(
+//                reports.reports(0).metrics(0).gauge_metrics(), &gaugeMetrics);
+//        EXPECT_EQ(2, gaugeMetrics.data_size());
+//
+//        auto data = gaugeMetrics.data(0);
+//        EXPECT_EQ(android::util::APP_START_OCCURRED, data.dimensions_in_what().field());
+//        EXPECT_EQ(1, data.dimensions_in_what().value_tuple().dimensions_value_size());
+//        EXPECT_EQ(1 /* uid field */,
+//                  data.dimensions_in_what().value_tuple().dimensions_value(0).field());
+//        EXPECT_EQ(appUid1, data.dimensions_in_what().value_tuple().dimensions_value(0).value_int());
+//        EXPECT_EQ(3, data.bucket_info_size());
+//        if (sampling_type == GaugeMetric::FIRST_N_SAMPLES) {
+//            EXPECT_EQ(2, data.bucket_info(0).atom_size());
+//            EXPECT_EQ(2, data.bucket_info(0).elapsed_timestamp_nanos_size());
+//            EXPECT_EQ(0, data.bucket_info(0).wall_clock_timestamp_nanos_size());
+//            EXPECT_EQ(bucketStartTimeNs, data.bucket_info(0).start_bucket_elapsed_nanos());
+//            EXPECT_EQ(bucketStartTimeNs + bucketSizeNs,
+//                      data.bucket_info(0).end_bucket_elapsed_nanos());
+//            EXPECT_EQ(AppStartOccurred::HOT,
+//                      data.bucket_info(0).atom(0).app_start_occurred().type());
+//            EXPECT_EQ("activity_name2",
+//                      data.bucket_info(0).atom(0).app_start_occurred().activity_name());
+//            EXPECT_EQ(102L,
+//                      data.bucket_info(0).atom(0).app_start_occurred().activity_start_millis());
+//            EXPECT_EQ(AppStartOccurred::COLD,
+//                      data.bucket_info(0).atom(1).app_start_occurred().type());
+//            EXPECT_EQ("activity_name3",
+//                      data.bucket_info(0).atom(1).app_start_occurred().activity_name());
+//            EXPECT_EQ(103L,
+//                      data.bucket_info(0).atom(1).app_start_occurred().activity_start_millis());
+//
+//            EXPECT_EQ(1, data.bucket_info(1).atom_size());
+//            EXPECT_EQ(1, data.bucket_info(1).elapsed_timestamp_nanos_size());
+//            EXPECT_EQ(bucketStartTimeNs + bucketSizeNs,
+//                      data.bucket_info(1).start_bucket_elapsed_nanos());
+//            EXPECT_EQ(bucketStartTimeNs + 2 * bucketSizeNs,
+//                      data.bucket_info(1).end_bucket_elapsed_nanos());
+//            EXPECT_EQ(AppStartOccurred::WARM,
+//                      data.bucket_info(1).atom(0).app_start_occurred().type());
+//            EXPECT_EQ("activity_name4",
+//                      data.bucket_info(1).atom(0).app_start_occurred().activity_name());
+//            EXPECT_EQ(104L,
+//                      data.bucket_info(1).atom(0).app_start_occurred().activity_start_millis());
+//
+//            EXPECT_EQ(2, data.bucket_info(2).atom_size());
+//            EXPECT_EQ(2, data.bucket_info(2).elapsed_timestamp_nanos_size());
+//            EXPECT_EQ(bucketStartTimeNs + 2 * bucketSizeNs,
+//                      data.bucket_info(2).start_bucket_elapsed_nanos());
+//            EXPECT_EQ(bucketStartTimeNs + 3 * bucketSizeNs,
+//                      data.bucket_info(2).end_bucket_elapsed_nanos());
+//            EXPECT_EQ(AppStartOccurred::COLD,
+//                      data.bucket_info(2).atom(0).app_start_occurred().type());
+//            EXPECT_EQ("activity_name5",
+//                      data.bucket_info(2).atom(0).app_start_occurred().activity_name());
+//            EXPECT_EQ(105L,
+//                      data.bucket_info(2).atom(0).app_start_occurred().activity_start_millis());
+//            EXPECT_EQ(AppStartOccurred::HOT,
+//                      data.bucket_info(2).atom(1).app_start_occurred().type());
+//            EXPECT_EQ("activity_name6",
+//                      data.bucket_info(2).atom(1).app_start_occurred().activity_name());
+//            EXPECT_EQ(106L,
+//                      data.bucket_info(2).atom(1).app_start_occurred().activity_start_millis());
+//        } else {
+//            EXPECT_EQ(1, data.bucket_info(0).atom_size());
+//            EXPECT_EQ(1, data.bucket_info(0).elapsed_timestamp_nanos_size());
+//            EXPECT_EQ(bucketStartTimeNs, data.bucket_info(0).start_bucket_elapsed_nanos());
+//            EXPECT_EQ(bucketStartTimeNs + bucketSizeNs,
+//                      data.bucket_info(0).end_bucket_elapsed_nanos());
+//            EXPECT_EQ(AppStartOccurred::HOT,
+//                      data.bucket_info(0).atom(0).app_start_occurred().type());
+//            EXPECT_EQ("activity_name2",
+//                      data.bucket_info(0).atom(0).app_start_occurred().activity_name());
+//            EXPECT_EQ(102L,
+//                      data.bucket_info(0).atom(0).app_start_occurred().activity_start_millis());
+//
+//            EXPECT_EQ(1, data.bucket_info(1).atom_size());
+//            EXPECT_EQ(1, data.bucket_info(1).elapsed_timestamp_nanos_size());
+//            EXPECT_EQ(bucketStartTimeNs + bucketSizeNs,
+//                      data.bucket_info(1).start_bucket_elapsed_nanos());
+//            EXPECT_EQ(bucketStartTimeNs + 2 * bucketSizeNs,
+//                      data.bucket_info(1).end_bucket_elapsed_nanos());
+//            EXPECT_EQ(AppStartOccurred::WARM,
+//                      data.bucket_info(1).atom(0).app_start_occurred().type());
+//            EXPECT_EQ("activity_name4",
+//                      data.bucket_info(1).atom(0).app_start_occurred().activity_name());
+//            EXPECT_EQ(104L,
+//                      data.bucket_info(1).atom(0).app_start_occurred().activity_start_millis());
+//
+//            EXPECT_EQ(1, data.bucket_info(2).atom_size());
+//            EXPECT_EQ(1, data.bucket_info(2).elapsed_timestamp_nanos_size());
+//            EXPECT_EQ(bucketStartTimeNs + 2 * bucketSizeNs,
+//                      data.bucket_info(2).start_bucket_elapsed_nanos());
+//            EXPECT_EQ(bucketStartTimeNs + 3 * bucketSizeNs,
+//                      data.bucket_info(2).end_bucket_elapsed_nanos());
+//            EXPECT_EQ(AppStartOccurred::COLD,
+//                      data.bucket_info(2).atom(0).app_start_occurred().type());
+//            EXPECT_EQ("activity_name5",
+//                      data.bucket_info(2).atom(0).app_start_occurred().activity_name());
+//            EXPECT_EQ(105L,
+//                      data.bucket_info(2).atom(0).app_start_occurred().activity_start_millis());
+//        }
+//
+//        data = gaugeMetrics.data(1);
+//
+//        EXPECT_EQ(data.dimensions_in_what().field(), android::util::APP_START_OCCURRED);
+//        EXPECT_EQ(data.dimensions_in_what().value_tuple().dimensions_value_size(), 1);
+//        EXPECT_EQ(1 /* uid field */,
+//                  data.dimensions_in_what().value_tuple().dimensions_value(0).field());
+//        EXPECT_EQ(appUid2, data.dimensions_in_what().value_tuple().dimensions_value(0).value_int());
+//        EXPECT_EQ(1, data.bucket_info_size());
+//        EXPECT_EQ(1, data.bucket_info(0).atom_size());
+//        EXPECT_EQ(1, data.bucket_info(0).elapsed_timestamp_nanos_size());
+//        EXPECT_EQ(bucketStartTimeNs + 2 * bucketSizeNs,
+//                  data.bucket_info(0).start_bucket_elapsed_nanos());
+//        EXPECT_EQ(bucketStartTimeNs + 3 * bucketSizeNs,
+//                  data.bucket_info(0).end_bucket_elapsed_nanos());
+//        EXPECT_EQ(AppStartOccurred::COLD, data.bucket_info(0).atom(0).app_start_occurred().type());
+//        EXPECT_EQ("activity_name7",
+//                  data.bucket_info(0).atom(0).app_start_occurred().activity_name());
+//        EXPECT_EQ(201L, data.bucket_info(0).atom(0).app_start_occurred().activity_start_millis());
+//    }
+//}
 
 #else
 GTEST_LOG_(INFO) << "This test does nothing.\n";
diff --git a/cmds/statsd/tests/e2e/MetricActivation_e2e_test.cpp b/cmds/statsd/tests/e2e/MetricActivation_e2e_test.cpp
index b6a6492..f3f7df77 100644
--- a/cmds/statsd/tests/e2e/MetricActivation_e2e_test.cpp
+++ b/cmds/statsd/tests/e2e/MetricActivation_e2e_test.cpp
@@ -233,1608 +233,1609 @@
 
 }  // namespace
 
-TEST(MetricActivationE2eTest, TestCountMetric) {
-    auto config = CreateStatsdConfig();
-
-    int64_t bucketStartTimeNs = NS_PER_SEC * 10; // 10 secs
-    int64_t bucketSizeNs =
-            TimeUnitToBucketSizeInMillis(config.count_metric(0).bucket()) * 1000LL * 1000LL;
-
-    int uid = 12345;
-    int64_t cfgId = 98765;
-    ConfigKey cfgKey(uid, cfgId);
-
-    sp<UidMap> m = new UidMap();
-    sp<StatsPullerManager> pullerManager = new StatsPullerManager();
-    sp<AlarmMonitor> anomalyAlarmMonitor;
-    sp<AlarmMonitor> subscriberAlarmMonitor;
-    vector<int64_t> activeConfigsBroadcast;
-
-    long timeBase1 = 1;
-    int broadcastCount = 0;
-    StatsLogProcessor processor(m, pullerManager, anomalyAlarmMonitor, subscriberAlarmMonitor,
-            bucketStartTimeNs, [](const ConfigKey& key) { return true; },
-            [&uid, &broadcastCount, &activeConfigsBroadcast](const int& broadcastUid,
-                    const vector<int64_t>& activeConfigs) {
-                broadcastCount++;
-                EXPECT_EQ(broadcastUid, uid);
-                activeConfigsBroadcast.clear();
-                activeConfigsBroadcast.insert(activeConfigsBroadcast.end(),
-                        activeConfigs.begin(), activeConfigs.end());
-                return true;
-            });
-
-    processor.OnConfigUpdated(bucketStartTimeNs, cfgKey, config);
-
-    EXPECT_EQ(processor.mMetricsManagers.size(), 1u);
-    sp<MetricsManager> metricsManager = processor.mMetricsManagers.begin()->second;
-    EXPECT_TRUE(metricsManager->isConfigValid());
-    EXPECT_EQ(metricsManager->mAllMetricProducers.size(), 1);
-    sp<MetricProducer> metricProducer = metricsManager->mAllMetricProducers[0];
-    auto& eventActivationMap = metricProducer->mEventActivationMap;
-
-    EXPECT_FALSE(metricsManager->isActive());
-    EXPECT_FALSE(metricProducer->mIsActive);
-    // Two activations: one is triggered by battery saver mode (tracker index 0), the other is
-    // triggered by screen on event (tracker index 2).
-    EXPECT_EQ(eventActivationMap.size(), 2u);
-    EXPECT_TRUE(eventActivationMap.find(0) != eventActivationMap.end());
-    EXPECT_TRUE(eventActivationMap.find(2) != eventActivationMap.end());
-    EXPECT_EQ(eventActivationMap[0]->state, ActivationState::kNotActive);
-    EXPECT_EQ(eventActivationMap[0]->start_ns, 0);
-    EXPECT_EQ(eventActivationMap[0]->ttl_ns, 60 * 6 * NS_PER_SEC);
-    EXPECT_EQ(eventActivationMap[2]->state, ActivationState::kNotActive);
-    EXPECT_EQ(eventActivationMap[2]->start_ns, 0);
-    EXPECT_EQ(eventActivationMap[2]->ttl_ns, 60 * 2 * NS_PER_SEC);
-
-    std::unique_ptr<LogEvent> event;
-
-    event = CreateAppCrashEvent(111, bucketStartTimeNs + 5);
-    processor.OnLogEvent(event.get(), bucketStartTimeNs + 5);
-    EXPECT_FALSE(metricsManager->isActive());
-    EXPECT_FALSE(metricProducer->mIsActive);
-    EXPECT_EQ(broadcastCount, 0);
-
-    // Activated by battery save mode.
-    event = CreateBatterySaverOnEvent(bucketStartTimeNs + 10);
-    processor.OnLogEvent(event.get(), bucketStartTimeNs + 10);
-    EXPECT_TRUE(metricsManager->isActive());
-    EXPECT_TRUE(metricProducer->mIsActive);
-    EXPECT_EQ(broadcastCount, 1);
-    EXPECT_EQ(activeConfigsBroadcast.size(), 1);
-    EXPECT_EQ(activeConfigsBroadcast[0], cfgId);
-    EXPECT_EQ(eventActivationMap[0]->state, ActivationState::kActive);
-    EXPECT_EQ(eventActivationMap[0]->start_ns, bucketStartTimeNs + 10);
-    EXPECT_EQ(eventActivationMap[0]->ttl_ns, 60 * 6 * NS_PER_SEC);
-    EXPECT_EQ(eventActivationMap[2]->state, ActivationState::kNotActive);
-    EXPECT_EQ(eventActivationMap[2]->start_ns, 0);
-    EXPECT_EQ(eventActivationMap[2]->ttl_ns, 60 * 2 * NS_PER_SEC);
-
-    // First processed event.
-    event = CreateAppCrashEvent(222, bucketStartTimeNs + 15);
-    processor.OnLogEvent(event.get(), bucketStartTimeNs + 15);
-
-    // Activated by screen on event.
-    event = CreateScreenStateChangedEvent(android::view::DISPLAY_STATE_ON,
-                                          bucketStartTimeNs + 20);
-    processor.OnLogEvent(event.get(), bucketStartTimeNs + 20);
-    EXPECT_TRUE(metricsManager->isActive());
-    EXPECT_TRUE(metricProducer->mIsActive);
-    EXPECT_EQ(eventActivationMap[0]->state, ActivationState::kActive);
-    EXPECT_EQ(eventActivationMap[0]->start_ns, bucketStartTimeNs + 10);
-    EXPECT_EQ(eventActivationMap[0]->ttl_ns, 60 * 6 * NS_PER_SEC);
-    EXPECT_EQ(eventActivationMap[2]->state, ActivationState::kActive);
-    EXPECT_EQ(eventActivationMap[2]->start_ns, bucketStartTimeNs + 20);
-    EXPECT_EQ(eventActivationMap[2]->ttl_ns, 60 * 2 * NS_PER_SEC);
-
-    // 2nd processed event.
-    // The activation by screen_on event expires, but the one by battery save mode is still active.
-    event = CreateAppCrashEvent(333, bucketStartTimeNs + NS_PER_SEC * 60 * 2 + 25);
-    processor.OnLogEvent(event.get(), bucketStartTimeNs + NS_PER_SEC * 60 * 2 + 25);
-    EXPECT_TRUE(metricsManager->isActive());
-    EXPECT_TRUE(metricProducer->mIsActive);
-    EXPECT_EQ(eventActivationMap[0]->state, ActivationState::kActive);
-    EXPECT_EQ(eventActivationMap[0]->start_ns, bucketStartTimeNs + 10);
-    EXPECT_EQ(eventActivationMap[0]->ttl_ns, 60 * 6 * NS_PER_SEC);
-    EXPECT_EQ(eventActivationMap[2]->state, ActivationState::kNotActive);
-    EXPECT_EQ(eventActivationMap[2]->start_ns, bucketStartTimeNs + 20);
-    EXPECT_EQ(eventActivationMap[2]->ttl_ns, 60 * 2 * NS_PER_SEC);
-    // No new broadcast since the config should still be active.
-    EXPECT_EQ(broadcastCount, 1);
-
-    // 3rd processed event.
-    event = CreateAppCrashEvent(444, bucketStartTimeNs + NS_PER_SEC * 60 * 5 + 25);
-    processor.OnLogEvent(event.get(), bucketStartTimeNs + NS_PER_SEC * 60 * 5 + 25);
-
-    // All activations expired.
-    event = CreateAppCrashEvent(555, bucketStartTimeNs + NS_PER_SEC * 60 * 8);
-    processor.OnLogEvent(event.get(), bucketStartTimeNs + NS_PER_SEC * 60 * 8);
-    EXPECT_FALSE(metricsManager->isActive());
-    EXPECT_FALSE(metricProducer->mIsActive);
-    // New broadcast since the config is no longer active.
-    EXPECT_EQ(broadcastCount, 2);
-    EXPECT_EQ(activeConfigsBroadcast.size(), 0);
-    EXPECT_EQ(eventActivationMap[0]->state, ActivationState::kNotActive);
-    EXPECT_EQ(eventActivationMap[0]->start_ns, bucketStartTimeNs + 10);
-    EXPECT_EQ(eventActivationMap[0]->ttl_ns, 60 * 6 * NS_PER_SEC);
-    EXPECT_EQ(eventActivationMap[2]->state, ActivationState::kNotActive);
-    EXPECT_EQ(eventActivationMap[2]->start_ns, bucketStartTimeNs + 20);
-    EXPECT_EQ(eventActivationMap[2]->ttl_ns, 60 * 2 * NS_PER_SEC);
-
-    // Re-activate metric via screen on.
-    event = CreateScreenStateChangedEvent(android::view::DISPLAY_STATE_ON,
-                                          bucketStartTimeNs + NS_PER_SEC * 60 * 10 + 10);
-    processor.OnLogEvent(event.get(), bucketStartTimeNs + NS_PER_SEC * 60 * 10 + 10);
-    EXPECT_TRUE(metricsManager->isActive());
-    EXPECT_TRUE(metricProducer->mIsActive);
-    EXPECT_EQ(broadcastCount, 3);
-    EXPECT_EQ(activeConfigsBroadcast.size(), 1);
-    EXPECT_EQ(activeConfigsBroadcast[0], cfgId);
-    EXPECT_EQ(eventActivationMap[0]->state, ActivationState::kNotActive);
-    EXPECT_EQ(eventActivationMap[0]->start_ns, bucketStartTimeNs + 10);
-    EXPECT_EQ(eventActivationMap[0]->ttl_ns, 60 * 6 * NS_PER_SEC);
-    EXPECT_EQ(eventActivationMap[2]->state, ActivationState::kActive);
-    EXPECT_EQ(eventActivationMap[2]->start_ns, bucketStartTimeNs + NS_PER_SEC * 60 * 10 + 10);
-    EXPECT_EQ(eventActivationMap[2]->ttl_ns, 60 * 2 * NS_PER_SEC);
-
-    // 4th processed event.
-    event = CreateAppCrashEvent(666, bucketStartTimeNs + NS_PER_SEC * 60 * 11 + 1);
-    processor.OnLogEvent(event.get(), bucketStartTimeNs + NS_PER_SEC * 60 * 11 + 1);
-
-    ConfigMetricsReportList reports;
-    vector<uint8_t> buffer;
-    processor.onDumpReport(cfgKey, bucketStartTimeNs + NS_PER_SEC * 60 * 15 + 1, false, true,
-                            ADB_DUMP, FAST, &buffer);
-    EXPECT_TRUE(buffer.size() > 0);
-    EXPECT_TRUE(reports.ParseFromArray(&buffer[0], buffer.size()));
-    backfillDimensionPath(&reports);
-    backfillStartEndTimestamp(&reports);
-    EXPECT_EQ(1, reports.reports_size());
-    EXPECT_EQ(1, reports.reports(0).metrics_size());
-    EXPECT_EQ(4, reports.reports(0).metrics(0).count_metrics().data_size());
-
-    StatsLogReport::CountMetricDataWrapper countMetrics;
-    sortMetricDataByDimensionsValue(
-            reports.reports(0).metrics(0).count_metrics(), &countMetrics);
-    EXPECT_EQ(4, countMetrics.data_size());
-
-    auto data = countMetrics.data(0);
-    EXPECT_EQ(android::util::PROCESS_LIFE_CYCLE_STATE_CHANGED, data.dimensions_in_what().field());
-    EXPECT_EQ(1, data.dimensions_in_what().value_tuple().dimensions_value_size());
-    EXPECT_EQ(1 /* uid field */,
-              data.dimensions_in_what().value_tuple().dimensions_value(0).field());
-    EXPECT_EQ(222, data.dimensions_in_what().value_tuple().dimensions_value(0).value_int());
-    EXPECT_EQ(1, data.bucket_info_size());
-    EXPECT_EQ(1, data.bucket_info(0).count());
-    EXPECT_EQ(bucketStartTimeNs, data.bucket_info(0).start_bucket_elapsed_nanos());
-    EXPECT_EQ(bucketStartTimeNs + bucketSizeNs, data.bucket_info(0).end_bucket_elapsed_nanos());
-
-    data = countMetrics.data(1);
-    EXPECT_EQ(android::util::PROCESS_LIFE_CYCLE_STATE_CHANGED, data.dimensions_in_what().field());
-    EXPECT_EQ(1, data.dimensions_in_what().value_tuple().dimensions_value_size());
-    EXPECT_EQ(1 /* uid field */,
-              data.dimensions_in_what().value_tuple().dimensions_value(0).field());
-    EXPECT_EQ(333, data.dimensions_in_what().value_tuple().dimensions_value(0).value_int());
-    EXPECT_EQ(1, data.bucket_info_size());
-    EXPECT_EQ(1, data.bucket_info(0).count());
-    EXPECT_EQ(bucketStartTimeNs, data.bucket_info(0).start_bucket_elapsed_nanos());
-    EXPECT_EQ(bucketStartTimeNs + bucketSizeNs, data.bucket_info(0).end_bucket_elapsed_nanos());
-
-    data = countMetrics.data(2);
-    EXPECT_EQ(android::util::PROCESS_LIFE_CYCLE_STATE_CHANGED, data.dimensions_in_what().field());
-    EXPECT_EQ(1, data.dimensions_in_what().value_tuple().dimensions_value_size());
-    EXPECT_EQ(1 /* uid field */,
-              data.dimensions_in_what().value_tuple().dimensions_value(0).field());
-    EXPECT_EQ(444, data.dimensions_in_what().value_tuple().dimensions_value(0).value_int());
-    EXPECT_EQ(1, data.bucket_info_size());
-    EXPECT_EQ(1, data.bucket_info(0).count());
-    // Partial bucket as metric is deactivated.
-    EXPECT_EQ(bucketStartTimeNs + bucketSizeNs, data.bucket_info(0).start_bucket_elapsed_nanos());
-    EXPECT_EQ(bucketStartTimeNs + NS_PER_SEC * 60 * 8,
-              data.bucket_info(0).end_bucket_elapsed_nanos());
-
-    data = countMetrics.data(3);
-    EXPECT_EQ(android::util::PROCESS_LIFE_CYCLE_STATE_CHANGED, data.dimensions_in_what().field());
-    EXPECT_EQ(1, data.dimensions_in_what().value_tuple().dimensions_value_size());
-    EXPECT_EQ(1 /* uid field */,
-              data.dimensions_in_what().value_tuple().dimensions_value(0).field());
-    EXPECT_EQ(666, data.dimensions_in_what().value_tuple().dimensions_value(0).value_int());
-    EXPECT_EQ(1, data.bucket_info_size());
-    EXPECT_EQ(1, data.bucket_info(0).count());
-    EXPECT_EQ(bucketStartTimeNs + 2 * bucketSizeNs,
-              data.bucket_info(0).start_bucket_elapsed_nanos());
-    EXPECT_EQ(bucketStartTimeNs + 3 * bucketSizeNs,
-              data.bucket_info(0).end_bucket_elapsed_nanos());
-}
-
-TEST(MetricActivationE2eTest, TestCountMetricWithOneDeactivation) {
-    auto config = CreateStatsdConfigWithOneDeactivation();
-
-    int64_t bucketStartTimeNs = NS_PER_SEC * 10; // 10 secs
-    int64_t bucketSizeNs =
-            TimeUnitToBucketSizeInMillis(config.count_metric(0).bucket()) * 1000LL * 1000LL;
-
-    int uid = 12345;
-    int64_t cfgId = 98765;
-    ConfigKey cfgKey(uid, cfgId);
-
-    sp<UidMap> m = new UidMap();
-    sp<StatsPullerManager> pullerManager = new StatsPullerManager();
-    sp<AlarmMonitor> anomalyAlarmMonitor;
-    sp<AlarmMonitor> subscriberAlarmMonitor;
-    vector<int64_t> activeConfigsBroadcast;
-
-    long timeBase1 = 1;
-    int broadcastCount = 0;
-    StatsLogProcessor processor(m, pullerManager, anomalyAlarmMonitor, subscriberAlarmMonitor,
-            bucketStartTimeNs, [](const ConfigKey& key) { return true; },
-            [&uid, &broadcastCount, &activeConfigsBroadcast](const int& broadcastUid,
-                    const vector<int64_t>& activeConfigs) {
-                broadcastCount++;
-                EXPECT_EQ(broadcastUid, uid);
-                activeConfigsBroadcast.clear();
-                activeConfigsBroadcast.insert(activeConfigsBroadcast.end(),
-                        activeConfigs.begin(), activeConfigs.end());
-                return true;
-            });
-
-    processor.OnConfigUpdated(bucketStartTimeNs, cfgKey, config);
-
-    EXPECT_EQ(processor.mMetricsManagers.size(), 1u);
-    sp<MetricsManager> metricsManager = processor.mMetricsManagers.begin()->second;
-    EXPECT_TRUE(metricsManager->isConfigValid());
-    EXPECT_EQ(metricsManager->mAllMetricProducers.size(), 1);
-    sp<MetricProducer> metricProducer = metricsManager->mAllMetricProducers[0];
-    auto& eventActivationMap = metricProducer->mEventActivationMap;
-    auto& eventDeactivationMap = metricProducer->mEventDeactivationMap;
-
-    EXPECT_FALSE(metricsManager->isActive());
-    EXPECT_FALSE(metricProducer->mIsActive);
-    // Two activations: one is triggered by battery saver mode (tracker index 0), the other is
-    // triggered by screen on event (tracker index 2).
-    EXPECT_EQ(eventActivationMap.size(), 2u);
-    EXPECT_TRUE(eventActivationMap.find(0) != eventActivationMap.end());
-    EXPECT_TRUE(eventActivationMap.find(2) != eventActivationMap.end());
-    EXPECT_EQ(eventActivationMap[0]->state, ActivationState::kNotActive);
-    EXPECT_EQ(eventActivationMap[0]->start_ns, 0);
-    EXPECT_EQ(eventActivationMap[0]->ttl_ns, 60 * 6 * NS_PER_SEC);
-    EXPECT_EQ(eventActivationMap[2]->state, ActivationState::kNotActive);
-    EXPECT_EQ(eventActivationMap[2]->start_ns, 0);
-    EXPECT_EQ(eventActivationMap[2]->ttl_ns, 60 * 2 * NS_PER_SEC);
-    EXPECT_EQ(eventDeactivationMap.size(), 1u);
-    EXPECT_TRUE(eventDeactivationMap.find(3) != eventDeactivationMap.end());
-    EXPECT_EQ(eventDeactivationMap[3].size(), 1u);
-    EXPECT_EQ(eventDeactivationMap[3][0], eventActivationMap[0]);
-
-    std::unique_ptr<LogEvent> event;
-
-    event = CreateAppCrashEvent(111, bucketStartTimeNs + 5);
-    processor.OnLogEvent(event.get(), bucketStartTimeNs + 5);
-    EXPECT_FALSE(metricsManager->isActive());
-    EXPECT_FALSE(metricProducer->mIsActive);
-    EXPECT_EQ(broadcastCount, 0);
-
-    // Activated by battery save mode.
-    event = CreateBatterySaverOnEvent(bucketStartTimeNs + 10);
-    processor.OnLogEvent(event.get(), bucketStartTimeNs + 10);
-    EXPECT_TRUE(metricsManager->isActive());
-    EXPECT_TRUE(metricProducer->mIsActive);
-    EXPECT_EQ(broadcastCount, 1);
-    EXPECT_EQ(activeConfigsBroadcast.size(), 1);
-    EXPECT_EQ(activeConfigsBroadcast[0], cfgId);
-    EXPECT_EQ(eventActivationMap[0]->state, ActivationState::kActive);
-    EXPECT_EQ(eventActivationMap[0]->start_ns, bucketStartTimeNs + 10);
-    EXPECT_EQ(eventActivationMap[0]->ttl_ns, 60 * 6 * NS_PER_SEC);
-    EXPECT_EQ(eventActivationMap[2]->state, ActivationState::kNotActive);
-    EXPECT_EQ(eventActivationMap[2]->start_ns, 0);
-    EXPECT_EQ(eventActivationMap[2]->ttl_ns, 60 * 2 * NS_PER_SEC);
-    EXPECT_EQ(eventDeactivationMap[3][0], eventActivationMap[0]);
-
-    // First processed event.
-    event = CreateAppCrashEvent(222, bucketStartTimeNs + 15);
-    processor.OnLogEvent(event.get(), bucketStartTimeNs + 15);
-
-    // Activated by screen on event.
-    event = CreateScreenStateChangedEvent(android::view::DISPLAY_STATE_ON,
-                                          bucketStartTimeNs + 20);
-    processor.OnLogEvent(event.get(), bucketStartTimeNs + 20);
-    EXPECT_TRUE(metricsManager->isActive());
-    EXPECT_TRUE(metricProducer->mIsActive);
-    EXPECT_EQ(eventActivationMap[0]->state, ActivationState::kActive);
-    EXPECT_EQ(eventActivationMap[0]->start_ns, bucketStartTimeNs + 10);
-    EXPECT_EQ(eventActivationMap[0]->ttl_ns, 60 * 6 * NS_PER_SEC);
-    EXPECT_EQ(eventActivationMap[2]->state, ActivationState::kActive);
-    EXPECT_EQ(eventActivationMap[2]->start_ns, bucketStartTimeNs + 20);
-    EXPECT_EQ(eventActivationMap[2]->ttl_ns, 60 * 2 * NS_PER_SEC);
-    EXPECT_EQ(eventDeactivationMap[3][0], eventActivationMap[0]);
-
-    // 2nd processed event.
-    // The activation by screen_on event expires, but the one by battery save mode is still active.
-    event = CreateAppCrashEvent(333, bucketStartTimeNs + NS_PER_SEC * 60 * 2 + 25);
-    processor.OnLogEvent(event.get(),bucketStartTimeNs + NS_PER_SEC * 60 * 2 + 25);
-    EXPECT_TRUE(metricsManager->isActive());
-    EXPECT_TRUE(metricProducer->mIsActive);
-    EXPECT_EQ(eventActivationMap[0]->state, ActivationState::kActive);
-    EXPECT_EQ(eventActivationMap[0]->start_ns, bucketStartTimeNs + 10);
-    EXPECT_EQ(eventActivationMap[0]->ttl_ns, 60 * 6 * NS_PER_SEC);
-    EXPECT_EQ(eventActivationMap[2]->state, ActivationState::kNotActive);
-    EXPECT_EQ(eventActivationMap[2]->start_ns, bucketStartTimeNs + 20);
-    EXPECT_EQ(eventActivationMap[2]->ttl_ns, 60 * 2 * NS_PER_SEC);
-    EXPECT_EQ(eventDeactivationMap[3][0], eventActivationMap[0]);
-    // No new broadcast since the config should still be active.
-    EXPECT_EQ(broadcastCount, 1);
-
-    // 3rd processed event.
-    event = CreateAppCrashEvent(444, bucketStartTimeNs + NS_PER_SEC * 60 * 5 + 25);
-    processor.OnLogEvent(event.get(), bucketStartTimeNs + NS_PER_SEC * 60 * 5 + 25);
-
-    // All activations expired.
-    event = CreateAppCrashEvent(555, bucketStartTimeNs + NS_PER_SEC * 60 * 8);
-    processor.OnLogEvent(event.get(), bucketStartTimeNs + NS_PER_SEC * 60 * 8);
-    EXPECT_FALSE(metricsManager->isActive());
-    EXPECT_FALSE(metricProducer->mIsActive);
-    // New broadcast since the config is no longer active.
-    EXPECT_EQ(broadcastCount, 2);
-    EXPECT_EQ(activeConfigsBroadcast.size(), 0);
-    EXPECT_EQ(eventActivationMap[0]->state, ActivationState::kNotActive);
-    EXPECT_EQ(eventActivationMap[0]->start_ns, bucketStartTimeNs + 10);
-    EXPECT_EQ(eventActivationMap[0]->ttl_ns, 60 * 6 * NS_PER_SEC);
-    EXPECT_EQ(eventActivationMap[2]->state, ActivationState::kNotActive);
-    EXPECT_EQ(eventActivationMap[2]->start_ns, bucketStartTimeNs + 20);
-    EXPECT_EQ(eventActivationMap[2]->ttl_ns, 60 * 2 * NS_PER_SEC);
-    EXPECT_EQ(eventDeactivationMap[3][0], eventActivationMap[0]);
-
-    // Re-activate metric via screen on.
-    event = CreateScreenStateChangedEvent(android::view::DISPLAY_STATE_ON,
-                                          bucketStartTimeNs + NS_PER_SEC * 60 * 10 + 10);
-    processor.OnLogEvent(event.get(), bucketStartTimeNs + NS_PER_SEC * 60 * 10 + 10);
-    EXPECT_TRUE(metricsManager->isActive());
-    EXPECT_TRUE(metricProducer->mIsActive);
-    EXPECT_EQ(broadcastCount, 3);
-    EXPECT_EQ(activeConfigsBroadcast.size(), 1);
-    EXPECT_EQ(activeConfigsBroadcast[0], cfgId);
-    EXPECT_EQ(eventActivationMap[0]->state, ActivationState::kNotActive);
-    EXPECT_EQ(eventActivationMap[0]->start_ns, bucketStartTimeNs + 10);
-    EXPECT_EQ(eventActivationMap[0]->ttl_ns, 60 * 6 * NS_PER_SEC);
-    EXPECT_EQ(eventActivationMap[2]->state, ActivationState::kActive);
-    EXPECT_EQ(eventActivationMap[2]->start_ns, bucketStartTimeNs + NS_PER_SEC * 60 * 10 + 10);
-    EXPECT_EQ(eventActivationMap[2]->ttl_ns, 60 * 2 * NS_PER_SEC);
-    EXPECT_EQ(eventDeactivationMap[3][0], eventActivationMap[0]);
-
-    // 4th processed event.
-    event = CreateAppCrashEvent(666, bucketStartTimeNs + NS_PER_SEC * 60 * 11 + 1);
-    processor.OnLogEvent(event.get(), bucketStartTimeNs + NS_PER_SEC * 60 * 11 + 1);
-
-    // Re-enable battery saver mode activation.
-    event = CreateBatterySaverOnEvent(bucketStartTimeNs + NS_PER_SEC * 60 * 11 + 15);
-    processor.OnLogEvent(event.get(), bucketStartTimeNs + NS_PER_SEC * 60 * 11 + 15);
-    EXPECT_TRUE(metricsManager->isActive());
-    EXPECT_TRUE(metricProducer->mIsActive);
-    EXPECT_EQ(broadcastCount, 3);
-    EXPECT_EQ(activeConfigsBroadcast.size(), 1);
-    EXPECT_EQ(activeConfigsBroadcast[0], cfgId);
-    EXPECT_EQ(eventActivationMap[0]->state, ActivationState::kActive);
-    EXPECT_EQ(eventActivationMap[0]->start_ns, bucketStartTimeNs + NS_PER_SEC * 60 * 11 + 15);
-    EXPECT_EQ(eventActivationMap[0]->ttl_ns, 60 * 6 * NS_PER_SEC);
-    EXPECT_EQ(eventActivationMap[2]->state, ActivationState::kActive);
-    EXPECT_EQ(eventActivationMap[2]->start_ns, bucketStartTimeNs + NS_PER_SEC * 60 * 10 + 10);
-    EXPECT_EQ(eventActivationMap[2]->ttl_ns, 60 * 2 * NS_PER_SEC);
-    EXPECT_EQ(eventDeactivationMap[3][0], eventActivationMap[0]);
-
-    // 5th processed event.
-    event = CreateAppCrashEvent(777, bucketStartTimeNs + NS_PER_SEC * 60 * 11 + 40);
-    processor.OnLogEvent(event.get(), bucketStartTimeNs + NS_PER_SEC * 60 * 11 + 40);
-
-    // Cancel battery saver mode activation.
-    event = CreateScreenBrightnessChangedEvent(64, bucketStartTimeNs + NS_PER_SEC * 60 * 11 + 60);
-    processor.OnLogEvent(event.get(), bucketStartTimeNs + NS_PER_SEC * 60 * 11 + 60);
-    EXPECT_TRUE(metricsManager->isActive());
-    EXPECT_TRUE(metricProducer->mIsActive);
-    EXPECT_EQ(broadcastCount, 3);
-    EXPECT_EQ(activeConfigsBroadcast.size(), 1);
-    EXPECT_EQ(activeConfigsBroadcast[0], cfgId);
-    EXPECT_EQ(eventActivationMap[0]->state, ActivationState::kNotActive);
-    EXPECT_EQ(eventActivationMap[0]->start_ns, bucketStartTimeNs + NS_PER_SEC * 60 * 11 + 15);
-    EXPECT_EQ(eventActivationMap[0]->ttl_ns, 60 * 6 * NS_PER_SEC);
-    EXPECT_EQ(eventActivationMap[2]->state, ActivationState::kActive);
-    EXPECT_EQ(eventActivationMap[2]->start_ns, bucketStartTimeNs + NS_PER_SEC * 60 * 10 + 10);
-    EXPECT_EQ(eventActivationMap[2]->ttl_ns, 60 * 2 * NS_PER_SEC);
-    EXPECT_EQ(eventDeactivationMap[3][0], eventActivationMap[0]);
-
-    // Screen-on activation expired.
-    event = CreateAppCrashEvent(888, bucketStartTimeNs + NS_PER_SEC * 60 * 13);
-    processor.OnLogEvent(event.get(), bucketStartTimeNs + NS_PER_SEC * 60 * 13);
-    EXPECT_FALSE(metricsManager->isActive());
-    EXPECT_FALSE(metricProducer->mIsActive);
-    // New broadcast since the config is no longer active.
-    EXPECT_EQ(broadcastCount, 4);
-    EXPECT_EQ(activeConfigsBroadcast.size(), 0);
-    EXPECT_EQ(eventActivationMap[0]->state, ActivationState::kNotActive);
-    EXPECT_EQ(eventActivationMap[0]->start_ns, bucketStartTimeNs + NS_PER_SEC * 60 * 11 + 15);
-    EXPECT_EQ(eventActivationMap[0]->ttl_ns, 60 * 6 * NS_PER_SEC);
-    EXPECT_EQ(eventActivationMap[2]->state, ActivationState::kNotActive);
-    EXPECT_EQ(eventActivationMap[2]->start_ns, bucketStartTimeNs + NS_PER_SEC * 60 * 10 + 10);
-    EXPECT_EQ(eventActivationMap[2]->ttl_ns, 60 * 2 * NS_PER_SEC);
-    EXPECT_EQ(eventDeactivationMap[3][0], eventActivationMap[0]);
-
-    event = CreateAppCrashEvent(999, bucketStartTimeNs + NS_PER_SEC * 60 * 14 + 1);
-    processor.OnLogEvent(event.get(), bucketStartTimeNs + NS_PER_SEC * 60 * 14 + 1);
-
-    // Re-enable battery saver mode activation.
-    event = CreateBatterySaverOnEvent(bucketStartTimeNs + NS_PER_SEC * 60 * 15 + 15);
-    processor.OnLogEvent(event.get(), bucketStartTimeNs + NS_PER_SEC * 60 * 15 + 15);
-    EXPECT_TRUE(metricsManager->isActive());
-    EXPECT_TRUE(metricProducer->mIsActive);
-    EXPECT_EQ(broadcastCount, 5);
-    EXPECT_EQ(activeConfigsBroadcast.size(), 1);
-    EXPECT_EQ(activeConfigsBroadcast[0], cfgId);
-    EXPECT_EQ(eventActivationMap[0]->state, ActivationState::kActive);
-    EXPECT_EQ(eventActivationMap[0]->start_ns, bucketStartTimeNs + NS_PER_SEC * 60 * 15 + 15);
-    EXPECT_EQ(eventActivationMap[0]->ttl_ns, 60 * 6 * NS_PER_SEC);
-    EXPECT_EQ(eventActivationMap[2]->state, ActivationState::kNotActive);
-    EXPECT_EQ(eventActivationMap[2]->start_ns, bucketStartTimeNs + NS_PER_SEC * 60 * 10 + 10);
-    EXPECT_EQ(eventActivationMap[2]->ttl_ns, 60 * 2 * NS_PER_SEC);
-    EXPECT_EQ(eventDeactivationMap[3][0], eventActivationMap[0]);
-
-    // Cancel battery saver mode activation.
-    event = CreateScreenBrightnessChangedEvent(140, bucketStartTimeNs + NS_PER_SEC * 60 * 16);
-    processor.OnLogEvent(event.get(), bucketStartTimeNs + NS_PER_SEC * 60 * 16);
-    EXPECT_FALSE(metricsManager->isActive());
-    EXPECT_FALSE(metricProducer->mIsActive);
-    EXPECT_EQ(broadcastCount, 6);
-    EXPECT_EQ(activeConfigsBroadcast.size(), 0);
-    EXPECT_EQ(eventActivationMap[0]->state, ActivationState::kNotActive);
-    EXPECT_EQ(eventActivationMap[0]->start_ns, bucketStartTimeNs + NS_PER_SEC * 60 * 15 + 15);
-    EXPECT_EQ(eventActivationMap[0]->ttl_ns, 60 * 6 * NS_PER_SEC);
-    EXPECT_EQ(eventActivationMap[2]->state, ActivationState::kNotActive);
-    EXPECT_EQ(eventActivationMap[2]->start_ns, bucketStartTimeNs + NS_PER_SEC * 60 * 10 + 10);
-    EXPECT_EQ(eventActivationMap[2]->ttl_ns, 60 * 2 * NS_PER_SEC);
-    EXPECT_EQ(eventDeactivationMap[3][0], eventActivationMap[0]);
-
-    ConfigMetricsReportList reports;
-    vector<uint8_t> buffer;
-    processor.onDumpReport(cfgKey, bucketStartTimeNs + NS_PER_SEC * 60 * 15 + 1, false, true,
-                            ADB_DUMP, FAST, &buffer);
-    EXPECT_TRUE(buffer.size() > 0);
-    EXPECT_TRUE(reports.ParseFromArray(&buffer[0], buffer.size()));
-    backfillDimensionPath(&reports);
-    backfillStartEndTimestamp(&reports);
-    EXPECT_EQ(1, reports.reports_size());
-    EXPECT_EQ(1, reports.reports(0).metrics_size());
-    EXPECT_EQ(5, reports.reports(0).metrics(0).count_metrics().data_size());
-
-    StatsLogReport::CountMetricDataWrapper countMetrics;
-    sortMetricDataByDimensionsValue(
-            reports.reports(0).metrics(0).count_metrics(), &countMetrics);
-    EXPECT_EQ(5, countMetrics.data_size());
-
-    auto data = countMetrics.data(0);
-    EXPECT_EQ(android::util::PROCESS_LIFE_CYCLE_STATE_CHANGED, data.dimensions_in_what().field());
-    EXPECT_EQ(1, data.dimensions_in_what().value_tuple().dimensions_value_size());
-    EXPECT_EQ(1 /* uid field */,
-              data.dimensions_in_what().value_tuple().dimensions_value(0).field());
-    EXPECT_EQ(222, data.dimensions_in_what().value_tuple().dimensions_value(0).value_int());
-    EXPECT_EQ(1, data.bucket_info_size());
-    EXPECT_EQ(1, data.bucket_info(0).count());
-    EXPECT_EQ(bucketStartTimeNs, data.bucket_info(0).start_bucket_elapsed_nanos());
-    EXPECT_EQ(bucketStartTimeNs + bucketSizeNs, data.bucket_info(0).end_bucket_elapsed_nanos());
-
-    data = countMetrics.data(1);
-    EXPECT_EQ(android::util::PROCESS_LIFE_CYCLE_STATE_CHANGED, data.dimensions_in_what().field());
-    EXPECT_EQ(1, data.dimensions_in_what().value_tuple().dimensions_value_size());
-    EXPECT_EQ(1 /* uid field */,
-              data.dimensions_in_what().value_tuple().dimensions_value(0).field());
-    EXPECT_EQ(333, data.dimensions_in_what().value_tuple().dimensions_value(0).value_int());
-    EXPECT_EQ(1, data.bucket_info_size());
-    EXPECT_EQ(1, data.bucket_info(0).count());
-    EXPECT_EQ(bucketStartTimeNs, data.bucket_info(0).start_bucket_elapsed_nanos());
-    EXPECT_EQ(bucketStartTimeNs + bucketSizeNs, data.bucket_info(0).end_bucket_elapsed_nanos());
-
-    data = countMetrics.data(2);
-    EXPECT_EQ(android::util::PROCESS_LIFE_CYCLE_STATE_CHANGED, data.dimensions_in_what().field());
-    EXPECT_EQ(1, data.dimensions_in_what().value_tuple().dimensions_value_size());
-    EXPECT_EQ(1 /* uid field */,
-              data.dimensions_in_what().value_tuple().dimensions_value(0).field());
-    EXPECT_EQ(444, data.dimensions_in_what().value_tuple().dimensions_value(0).value_int());
-    EXPECT_EQ(1, data.bucket_info_size());
-    EXPECT_EQ(1, data.bucket_info(0).count());
-    // Partial bucket as metric is deactivated.
-    EXPECT_EQ(bucketStartTimeNs + bucketSizeNs, data.bucket_info(0).start_bucket_elapsed_nanos());
-    EXPECT_EQ(bucketStartTimeNs + NS_PER_SEC * 60 * 8,
-              data.bucket_info(0).end_bucket_elapsed_nanos());
-
-    data = countMetrics.data(3);
-    EXPECT_EQ(android::util::PROCESS_LIFE_CYCLE_STATE_CHANGED, data.dimensions_in_what().field());
-    EXPECT_EQ(1, data.dimensions_in_what().value_tuple().dimensions_value_size());
-    EXPECT_EQ(1 /* uid field */,
-              data.dimensions_in_what().value_tuple().dimensions_value(0).field());
-    EXPECT_EQ(666, data.dimensions_in_what().value_tuple().dimensions_value(0).value_int());
-    EXPECT_EQ(1, data.bucket_info_size());
-    EXPECT_EQ(1, data.bucket_info(0).count());
-    EXPECT_EQ(bucketStartTimeNs + 2 * bucketSizeNs,
-              data.bucket_info(0).start_bucket_elapsed_nanos());
-    EXPECT_EQ(bucketStartTimeNs + NS_PER_SEC * 60 * 13,
-              data.bucket_info(0).end_bucket_elapsed_nanos());
-
-    data = countMetrics.data(4);
-    EXPECT_EQ(android::util::PROCESS_LIFE_CYCLE_STATE_CHANGED, data.dimensions_in_what().field());
-    EXPECT_EQ(1, data.dimensions_in_what().value_tuple().dimensions_value_size());
-    EXPECT_EQ(1 /* uid field */,
-              data.dimensions_in_what().value_tuple().dimensions_value(0).field());
-    EXPECT_EQ(777, data.dimensions_in_what().value_tuple().dimensions_value(0).value_int());
-    EXPECT_EQ(1, data.bucket_info_size());
-    EXPECT_EQ(1, data.bucket_info(0).count());
-    EXPECT_EQ(bucketStartTimeNs + 2 * bucketSizeNs,
-              data.bucket_info(0).start_bucket_elapsed_nanos());
-    EXPECT_EQ(bucketStartTimeNs + NS_PER_SEC * 60 * 13,
-              data.bucket_info(0).end_bucket_elapsed_nanos());
-}
-
-TEST(MetricActivationE2eTest, TestCountMetricWithTwoDeactivations) {
-    auto config = CreateStatsdConfigWithTwoDeactivations();
-
-    int64_t bucketStartTimeNs = NS_PER_SEC * 10; // 10 secs
-    int64_t bucketSizeNs =
-            TimeUnitToBucketSizeInMillis(config.count_metric(0).bucket()) * 1000LL * 1000LL;
-
-    int uid = 12345;
-    int64_t cfgId = 98765;
-    ConfigKey cfgKey(uid, cfgId);
-
-    sp<UidMap> m = new UidMap();
-    sp<StatsPullerManager> pullerManager = new StatsPullerManager();
-    sp<AlarmMonitor> anomalyAlarmMonitor;
-    sp<AlarmMonitor> subscriberAlarmMonitor;
-    vector<int64_t> activeConfigsBroadcast;
-
-    long timeBase1 = 1;
-    int broadcastCount = 0;
-    StatsLogProcessor processor(m, pullerManager, anomalyAlarmMonitor, subscriberAlarmMonitor,
-            bucketStartTimeNs, [](const ConfigKey& key) { return true; },
-            [&uid, &broadcastCount, &activeConfigsBroadcast](const int& broadcastUid,
-                    const vector<int64_t>& activeConfigs) {
-                broadcastCount++;
-                EXPECT_EQ(broadcastUid, uid);
-                activeConfigsBroadcast.clear();
-                activeConfigsBroadcast.insert(activeConfigsBroadcast.end(),
-                        activeConfigs.begin(), activeConfigs.end());
-                return true;
-            });
-
-    processor.OnConfigUpdated(bucketStartTimeNs, cfgKey, config);
-
-    EXPECT_EQ(processor.mMetricsManagers.size(), 1u);
-    sp<MetricsManager> metricsManager = processor.mMetricsManagers.begin()->second;
-    EXPECT_TRUE(metricsManager->isConfigValid());
-    EXPECT_EQ(metricsManager->mAllMetricProducers.size(), 1);
-    sp<MetricProducer> metricProducer = metricsManager->mAllMetricProducers[0];
-    auto& eventActivationMap = metricProducer->mEventActivationMap;
-    auto& eventDeactivationMap = metricProducer->mEventDeactivationMap;
-
-    EXPECT_FALSE(metricsManager->isActive());
-    EXPECT_FALSE(metricProducer->mIsActive);
-    // Two activations: one is triggered by battery saver mode (tracker index 0), the other is
-    // triggered by screen on event (tracker index 2).
-    EXPECT_EQ(eventActivationMap.size(), 2u);
-    EXPECT_TRUE(eventActivationMap.find(0) != eventActivationMap.end());
-    EXPECT_TRUE(eventActivationMap.find(2) != eventActivationMap.end());
-    EXPECT_EQ(eventActivationMap[0]->state, ActivationState::kNotActive);
-    EXPECT_EQ(eventActivationMap[0]->start_ns, 0);
-    EXPECT_EQ(eventActivationMap[0]->ttl_ns, 60 * 6 * NS_PER_SEC);
-    EXPECT_EQ(eventActivationMap[2]->state, ActivationState::kNotActive);
-    EXPECT_EQ(eventActivationMap[2]->start_ns, 0);
-    EXPECT_EQ(eventActivationMap[2]->ttl_ns, 60 * 2 * NS_PER_SEC);
-    EXPECT_EQ(eventDeactivationMap.size(), 2u);
-    EXPECT_TRUE(eventDeactivationMap.find(3) != eventDeactivationMap.end());
-    EXPECT_TRUE(eventDeactivationMap.find(4) != eventDeactivationMap.end());
-    EXPECT_EQ(eventDeactivationMap[3].size(), 1u);
-    EXPECT_EQ(eventDeactivationMap[4].size(), 1u);
-    EXPECT_EQ(eventDeactivationMap[3][0], eventActivationMap[0]);
-    EXPECT_EQ(eventDeactivationMap[4][0], eventActivationMap[2]);
-
-    std::unique_ptr<LogEvent> event;
-
-    event = CreateAppCrashEvent(111, bucketStartTimeNs + 5);
-    processor.OnLogEvent(event.get(), bucketStartTimeNs + 5);
-    EXPECT_FALSE(metricsManager->isActive());
-    EXPECT_FALSE(metricProducer->mIsActive);
-    EXPECT_EQ(broadcastCount, 0);
-
-    // Activated by battery save mode.
-    event = CreateBatterySaverOnEvent(bucketStartTimeNs + 10);
-    processor.OnLogEvent(event.get(), bucketStartTimeNs + 10);
-    EXPECT_TRUE(metricsManager->isActive());
-    EXPECT_TRUE(metricProducer->mIsActive);
-    EXPECT_EQ(broadcastCount, 1);
-    EXPECT_EQ(activeConfigsBroadcast.size(), 1);
-    EXPECT_EQ(activeConfigsBroadcast[0], cfgId);
-    EXPECT_EQ(eventActivationMap[0]->state, ActivationState::kActive);
-    EXPECT_EQ(eventActivationMap[0]->start_ns, bucketStartTimeNs + 10);
-    EXPECT_EQ(eventActivationMap[0]->ttl_ns, 60 * 6 * NS_PER_SEC);
-    EXPECT_EQ(eventActivationMap[2]->state, ActivationState::kNotActive);
-    EXPECT_EQ(eventActivationMap[2]->start_ns, 0);
-    EXPECT_EQ(eventActivationMap[2]->ttl_ns, 60 * 2 * NS_PER_SEC);
-    EXPECT_EQ(eventDeactivationMap[3][0], eventActivationMap[0]);
-    EXPECT_EQ(eventDeactivationMap[4][0], eventActivationMap[2]);
-
-    // First processed event.
-    event = CreateAppCrashEvent(222, bucketStartTimeNs + 15);
-    processor.OnLogEvent(event.get(), bucketStartTimeNs + 15);
-
-    // Activated by screen on event.
-    event = CreateScreenStateChangedEvent(android::view::DISPLAY_STATE_ON,
-                                          bucketStartTimeNs + 20);
-    processor.OnLogEvent(event.get(), bucketStartTimeNs + 20);
-    EXPECT_TRUE(metricsManager->isActive());
-    EXPECT_TRUE(metricProducer->mIsActive);
-    EXPECT_EQ(eventActivationMap[0]->state, ActivationState::kActive);
-    EXPECT_EQ(eventActivationMap[0]->start_ns, bucketStartTimeNs + 10);
-    EXPECT_EQ(eventActivationMap[0]->ttl_ns, 60 * 6 * NS_PER_SEC);
-    EXPECT_EQ(eventActivationMap[2]->state, ActivationState::kActive);
-    EXPECT_EQ(eventActivationMap[2]->start_ns, bucketStartTimeNs + 20);
-    EXPECT_EQ(eventActivationMap[2]->ttl_ns, 60 * 2 * NS_PER_SEC);
-    EXPECT_EQ(eventDeactivationMap[3][0], eventActivationMap[0]);
-    EXPECT_EQ(eventDeactivationMap[4][0], eventActivationMap[2]);
-
-    // 2nd processed event.
-    // The activation by screen_on event expires, but the one by battery save mode is still active.
-    event = CreateAppCrashEvent(333, bucketStartTimeNs + NS_PER_SEC * 60 * 2 + 25);
-    processor.OnLogEvent(event.get(), bucketStartTimeNs + NS_PER_SEC * 60 * 2 + 25);
-    EXPECT_TRUE(metricsManager->isActive());
-    EXPECT_TRUE(metricProducer->mIsActive);
-    EXPECT_EQ(eventActivationMap[0]->state, ActivationState::kActive);
-    EXPECT_EQ(eventActivationMap[0]->start_ns, bucketStartTimeNs + 10);
-    EXPECT_EQ(eventActivationMap[0]->ttl_ns, 60 * 6 * NS_PER_SEC);
-    EXPECT_EQ(eventActivationMap[2]->state, ActivationState::kNotActive);
-    EXPECT_EQ(eventActivationMap[2]->start_ns, bucketStartTimeNs + 20);
-    EXPECT_EQ(eventActivationMap[2]->ttl_ns, 60 * 2 * NS_PER_SEC);
-    EXPECT_EQ(eventDeactivationMap[3][0], eventActivationMap[0]);
-    EXPECT_EQ(eventDeactivationMap[4][0], eventActivationMap[2]);
-    // No new broadcast since the config should still be active.
-    EXPECT_EQ(broadcastCount, 1);
-
-    // 3rd processed event.
-    event = CreateAppCrashEvent(444, bucketStartTimeNs + NS_PER_SEC * 60 * 5 + 25);
-    processor.OnLogEvent(event.get(), bucketStartTimeNs + NS_PER_SEC * 60 * 5 + 25);
-
-    // All activations expired.
-    event = CreateAppCrashEvent(555, bucketStartTimeNs + NS_PER_SEC * 60 * 8);
-    processor.OnLogEvent(event.get(), bucketStartTimeNs + NS_PER_SEC * 60 * 8);
-    EXPECT_FALSE(metricsManager->isActive());
-    EXPECT_FALSE(metricProducer->mIsActive);
-    // New broadcast since the config is no longer active.
-    EXPECT_EQ(broadcastCount, 2);
-    EXPECT_EQ(activeConfigsBroadcast.size(), 0);
-    EXPECT_EQ(eventActivationMap[0]->state, ActivationState::kNotActive);
-    EXPECT_EQ(eventActivationMap[0]->start_ns, bucketStartTimeNs + 10);
-    EXPECT_EQ(eventActivationMap[0]->ttl_ns, 60 * 6 * NS_PER_SEC);
-    EXPECT_EQ(eventActivationMap[2]->state, ActivationState::kNotActive);
-    EXPECT_EQ(eventActivationMap[2]->start_ns, bucketStartTimeNs + 20);
-    EXPECT_EQ(eventActivationMap[2]->ttl_ns, 60 * 2 * NS_PER_SEC);
-    EXPECT_EQ(eventDeactivationMap[3][0], eventActivationMap[0]);
-    EXPECT_EQ(eventDeactivationMap[4][0], eventActivationMap[2]);
-
-    // Re-activate metric via screen on.
-    event = CreateScreenStateChangedEvent(android::view::DISPLAY_STATE_ON,
-                                          bucketStartTimeNs + NS_PER_SEC * 60 * 10 + 10);
-    processor.OnLogEvent(event.get(), bucketStartTimeNs + NS_PER_SEC * 60 * 10 + 10);
-    EXPECT_TRUE(metricsManager->isActive());
-    EXPECT_TRUE(metricProducer->mIsActive);
-    EXPECT_EQ(broadcastCount, 3);
-    EXPECT_EQ(activeConfigsBroadcast.size(), 1);
-    EXPECT_EQ(activeConfigsBroadcast[0], cfgId);
-    EXPECT_EQ(eventActivationMap[0]->state, ActivationState::kNotActive);
-    EXPECT_EQ(eventActivationMap[0]->start_ns, bucketStartTimeNs + 10);
-    EXPECT_EQ(eventActivationMap[0]->ttl_ns, 60 * 6 * NS_PER_SEC);
-    EXPECT_EQ(eventActivationMap[2]->state, ActivationState::kActive);
-    EXPECT_EQ(eventActivationMap[2]->start_ns, bucketStartTimeNs + NS_PER_SEC * 60 * 10 + 10);
-    EXPECT_EQ(eventActivationMap[2]->ttl_ns, 60 * 2 * NS_PER_SEC);
-    EXPECT_EQ(eventDeactivationMap[3][0], eventActivationMap[0]);
-    EXPECT_EQ(eventDeactivationMap[4][0], eventActivationMap[2]);
-
-    // 4th processed event.
-    event = CreateAppCrashEvent(666, bucketStartTimeNs + NS_PER_SEC * 60 * 11 + 1);
-    processor.OnLogEvent(event.get(), bucketStartTimeNs + NS_PER_SEC * 60 * 11 + 1);
-
-    // Re-enable battery saver mode activation.
-    event = CreateBatterySaverOnEvent(bucketStartTimeNs + NS_PER_SEC * 60 * 11 + 15);
-    processor.OnLogEvent(event.get(), bucketStartTimeNs + NS_PER_SEC * 60 * 11 + 15);
-    EXPECT_TRUE(metricsManager->isActive());
-    EXPECT_TRUE(metricProducer->mIsActive);
-    EXPECT_EQ(broadcastCount, 3);
-    EXPECT_EQ(activeConfigsBroadcast.size(), 1);
-    EXPECT_EQ(activeConfigsBroadcast[0], cfgId);
-    EXPECT_EQ(eventActivationMap[0]->state, ActivationState::kActive);
-    EXPECT_EQ(eventActivationMap[0]->start_ns, bucketStartTimeNs + NS_PER_SEC * 60 * 11 + 15);
-    EXPECT_EQ(eventActivationMap[0]->ttl_ns, 60 * 6 * NS_PER_SEC);
-    EXPECT_EQ(eventActivationMap[2]->state, ActivationState::kActive);
-    EXPECT_EQ(eventActivationMap[2]->start_ns, bucketStartTimeNs + NS_PER_SEC * 60 * 10 + 10);
-    EXPECT_EQ(eventActivationMap[2]->ttl_ns, 60 * 2 * NS_PER_SEC);
-    EXPECT_EQ(eventDeactivationMap[3][0], eventActivationMap[0]);
-    EXPECT_EQ(eventDeactivationMap[4][0], eventActivationMap[2]);
-
-    // 5th processed event.
-    event = CreateAppCrashEvent(777, bucketStartTimeNs + NS_PER_SEC * 60 * 11 + 40);
-    processor.OnLogEvent(event.get(), bucketStartTimeNs + NS_PER_SEC * 60 * 11 + 40);
-
-    // Cancel battery saver mode and screen on activation.
-    event = CreateScreenBrightnessChangedEvent(64, bucketStartTimeNs + NS_PER_SEC * 60 * 11 + 60);
-    processor.OnLogEvent(event.get(), bucketStartTimeNs + NS_PER_SEC * 60 * 11 + 60);
-    EXPECT_FALSE(metricsManager->isActive());
-    EXPECT_FALSE(metricProducer->mIsActive);
-    // New broadcast since the config is no longer active.
-    EXPECT_EQ(broadcastCount, 4);
-    EXPECT_EQ(activeConfigsBroadcast.size(), 0);
-    EXPECT_EQ(eventActivationMap[0]->state, ActivationState::kNotActive);
-    EXPECT_EQ(eventActivationMap[0]->start_ns, bucketStartTimeNs + NS_PER_SEC * 60 * 11 + 15);
-    EXPECT_EQ(eventActivationMap[0]->ttl_ns, 60 * 6 * NS_PER_SEC);
-    EXPECT_EQ(eventActivationMap[2]->state, ActivationState::kNotActive);
-    EXPECT_EQ(eventActivationMap[2]->start_ns, bucketStartTimeNs + NS_PER_SEC * 60 * 10 + 10);
-    EXPECT_EQ(eventActivationMap[2]->ttl_ns, 60 * 2 * NS_PER_SEC);
-    EXPECT_EQ(eventDeactivationMap[3][0], eventActivationMap[0]);
-    EXPECT_EQ(eventDeactivationMap[4][0], eventActivationMap[2]);
-
-    // Screen-on activation expired.
-    event = CreateAppCrashEvent(888, bucketStartTimeNs + NS_PER_SEC * 60 * 13);
-    processor.OnLogEvent(event.get(), bucketStartTimeNs + NS_PER_SEC * 60 * 13);
-    EXPECT_FALSE(metricsManager->isActive());
-    EXPECT_FALSE(metricProducer->mIsActive);
-    EXPECT_EQ(broadcastCount, 4);
-    EXPECT_EQ(activeConfigsBroadcast.size(), 0);
-    EXPECT_EQ(eventActivationMap[0]->state, ActivationState::kNotActive);
-    EXPECT_EQ(eventActivationMap[0]->start_ns, bucketStartTimeNs + NS_PER_SEC * 60 * 11 + 15);
-    EXPECT_EQ(eventActivationMap[0]->ttl_ns, 60 * 6 * NS_PER_SEC);
-    EXPECT_EQ(eventActivationMap[2]->state, ActivationState::kNotActive);
-    EXPECT_EQ(eventActivationMap[2]->start_ns, bucketStartTimeNs + NS_PER_SEC * 60 * 10 + 10);
-    EXPECT_EQ(eventActivationMap[2]->ttl_ns, 60 * 2 * NS_PER_SEC);
-    EXPECT_EQ(eventDeactivationMap[3][0], eventActivationMap[0]);
-    EXPECT_EQ(eventDeactivationMap[4][0], eventActivationMap[2]);
-
-    event = CreateAppCrashEvent(999, bucketStartTimeNs + NS_PER_SEC * 60 * 14 + 1);
-    processor.OnLogEvent(event.get(), bucketStartTimeNs + NS_PER_SEC * 60 * 14 + 1);
-
-    // Re-enable battery saver mode activation.
-    event = CreateBatterySaverOnEvent(bucketStartTimeNs + NS_PER_SEC * 60 * 15 + 15);
-    processor.OnLogEvent(event.get(), bucketStartTimeNs + NS_PER_SEC * 60 * 15 + 15);
-    EXPECT_TRUE(metricsManager->isActive());
-    EXPECT_TRUE(metricProducer->mIsActive);
-    EXPECT_EQ(broadcastCount, 5);
-    EXPECT_EQ(activeConfigsBroadcast.size(), 1);
-    EXPECT_EQ(activeConfigsBroadcast[0], cfgId);
-    EXPECT_EQ(eventActivationMap[0]->state, ActivationState::kActive);
-    EXPECT_EQ(eventActivationMap[0]->start_ns, bucketStartTimeNs + NS_PER_SEC * 60 * 15 + 15);
-    EXPECT_EQ(eventActivationMap[0]->ttl_ns, 60 * 6 * NS_PER_SEC);
-    EXPECT_EQ(eventActivationMap[2]->state, ActivationState::kNotActive);
-    EXPECT_EQ(eventActivationMap[2]->start_ns, bucketStartTimeNs + NS_PER_SEC * 60 * 10 + 10);
-    EXPECT_EQ(eventActivationMap[2]->ttl_ns, 60 * 2 * NS_PER_SEC);
-    EXPECT_EQ(eventDeactivationMap[3][0], eventActivationMap[0]);
-    EXPECT_EQ(eventDeactivationMap[4][0], eventActivationMap[2]);
-
-    // Cancel battery saver mode and screen on activation.
-    event = CreateScreenBrightnessChangedEvent(140, bucketStartTimeNs + NS_PER_SEC * 60 * 16);
-    processor.OnLogEvent(event.get(), bucketStartTimeNs + NS_PER_SEC * 60 * 16);
-    EXPECT_FALSE(metricsManager->isActive());
-    EXPECT_FALSE(metricProducer->mIsActive);
-    EXPECT_EQ(broadcastCount, 6);
-    EXPECT_EQ(activeConfigsBroadcast.size(), 0);
-    EXPECT_EQ(eventActivationMap[0]->state, ActivationState::kNotActive);
-    EXPECT_EQ(eventActivationMap[0]->start_ns, bucketStartTimeNs + NS_PER_SEC * 60 * 15 + 15);
-    EXPECT_EQ(eventActivationMap[0]->ttl_ns, 60 * 6 * NS_PER_SEC);
-    EXPECT_EQ(eventActivationMap[2]->state, ActivationState::kNotActive);
-    EXPECT_EQ(eventActivationMap[2]->start_ns, bucketStartTimeNs + NS_PER_SEC * 60 * 10 + 10);
-    EXPECT_EQ(eventActivationMap[2]->ttl_ns, 60 * 2 * NS_PER_SEC);
-    EXPECT_EQ(eventDeactivationMap[3][0], eventActivationMap[0]);
-    EXPECT_EQ(eventDeactivationMap[4][0], eventActivationMap[2]);
-
-    ConfigMetricsReportList reports;
-    vector<uint8_t> buffer;
-    processor.onDumpReport(cfgKey, bucketStartTimeNs + NS_PER_SEC * 60 * 15 + 1, false, true,
-                            ADB_DUMP, FAST, &buffer);
-    EXPECT_TRUE(buffer.size() > 0);
-    EXPECT_TRUE(reports.ParseFromArray(&buffer[0], buffer.size()));
-    backfillDimensionPath(&reports);
-    backfillStartEndTimestamp(&reports);
-    EXPECT_EQ(1, reports.reports_size());
-    EXPECT_EQ(1, reports.reports(0).metrics_size());
-    EXPECT_EQ(5, reports.reports(0).metrics(0).count_metrics().data_size());
-
-    StatsLogReport::CountMetricDataWrapper countMetrics;
-    sortMetricDataByDimensionsValue(
-            reports.reports(0).metrics(0).count_metrics(), &countMetrics);
-    EXPECT_EQ(5, countMetrics.data_size());
-
-    auto data = countMetrics.data(0);
-    EXPECT_EQ(android::util::PROCESS_LIFE_CYCLE_STATE_CHANGED, data.dimensions_in_what().field());
-    EXPECT_EQ(1, data.dimensions_in_what().value_tuple().dimensions_value_size());
-    EXPECT_EQ(1 /* uid field */,
-              data.dimensions_in_what().value_tuple().dimensions_value(0).field());
-    EXPECT_EQ(222, data.dimensions_in_what().value_tuple().dimensions_value(0).value_int());
-    EXPECT_EQ(1, data.bucket_info_size());
-    EXPECT_EQ(1, data.bucket_info(0).count());
-    EXPECT_EQ(bucketStartTimeNs, data.bucket_info(0).start_bucket_elapsed_nanos());
-    EXPECT_EQ(bucketStartTimeNs + bucketSizeNs, data.bucket_info(0).end_bucket_elapsed_nanos());
-
-    data = countMetrics.data(1);
-    EXPECT_EQ(android::util::PROCESS_LIFE_CYCLE_STATE_CHANGED, data.dimensions_in_what().field());
-    EXPECT_EQ(1, data.dimensions_in_what().value_tuple().dimensions_value_size());
-    EXPECT_EQ(1 /* uid field */,
-              data.dimensions_in_what().value_tuple().dimensions_value(0).field());
-    EXPECT_EQ(333, data.dimensions_in_what().value_tuple().dimensions_value(0).value_int());
-    EXPECT_EQ(1, data.bucket_info_size());
-    EXPECT_EQ(1, data.bucket_info(0).count());
-    EXPECT_EQ(bucketStartTimeNs, data.bucket_info(0).start_bucket_elapsed_nanos());
-    EXPECT_EQ(bucketStartTimeNs + bucketSizeNs, data.bucket_info(0).end_bucket_elapsed_nanos());
-
-    data = countMetrics.data(2);
-    EXPECT_EQ(android::util::PROCESS_LIFE_CYCLE_STATE_CHANGED, data.dimensions_in_what().field());
-    EXPECT_EQ(1, data.dimensions_in_what().value_tuple().dimensions_value_size());
-    EXPECT_EQ(1 /* uid field */,
-              data.dimensions_in_what().value_tuple().dimensions_value(0).field());
-    EXPECT_EQ(444, data.dimensions_in_what().value_tuple().dimensions_value(0).value_int());
-    EXPECT_EQ(1, data.bucket_info_size());
-    EXPECT_EQ(1, data.bucket_info(0).count());
-    // Partial bucket as metric is deactivated.
-    EXPECT_EQ(bucketStartTimeNs + bucketSizeNs, data.bucket_info(0).start_bucket_elapsed_nanos());
-    EXPECT_EQ(bucketStartTimeNs + NS_PER_SEC * 60 * 8,
-              data.bucket_info(0).end_bucket_elapsed_nanos());
-
-    data = countMetrics.data(3);
-    EXPECT_EQ(android::util::PROCESS_LIFE_CYCLE_STATE_CHANGED, data.dimensions_in_what().field());
-    EXPECT_EQ(1, data.dimensions_in_what().value_tuple().dimensions_value_size());
-    EXPECT_EQ(1 /* uid field */,
-              data.dimensions_in_what().value_tuple().dimensions_value(0).field());
-    EXPECT_EQ(666, data.dimensions_in_what().value_tuple().dimensions_value(0).value_int());
-    EXPECT_EQ(1, data.bucket_info_size());
-    EXPECT_EQ(1, data.bucket_info(0).count());
-    EXPECT_EQ(bucketStartTimeNs + 2 * bucketSizeNs,
-              data.bucket_info(0).start_bucket_elapsed_nanos());
-    EXPECT_EQ(bucketStartTimeNs + NS_PER_SEC * 60 * 11,
-              data.bucket_info(0).end_bucket_elapsed_nanos());
-
-    data = countMetrics.data(4);
-    EXPECT_EQ(android::util::PROCESS_LIFE_CYCLE_STATE_CHANGED, data.dimensions_in_what().field());
-    EXPECT_EQ(1, data.dimensions_in_what().value_tuple().dimensions_value_size());
-    EXPECT_EQ(1 /* uid field */,
-              data.dimensions_in_what().value_tuple().dimensions_value(0).field());
-    EXPECT_EQ(777, data.dimensions_in_what().value_tuple().dimensions_value(0).value_int());
-    EXPECT_EQ(1, data.bucket_info_size());
-    EXPECT_EQ(1, data.bucket_info(0).count());
-    EXPECT_EQ(bucketStartTimeNs + 2 * bucketSizeNs,
-              data.bucket_info(0).start_bucket_elapsed_nanos());
-    EXPECT_EQ(bucketStartTimeNs + NS_PER_SEC * 60 * 11,
-              data.bucket_info(0).end_bucket_elapsed_nanos());
-}
-
-TEST(MetricActivationE2eTest, TestCountMetricWithSameDeactivation) {
-    auto config = CreateStatsdConfigWithSameDeactivations();
-
-    int64_t bucketStartTimeNs = NS_PER_SEC * 10; // 10 secs
-    int64_t bucketSizeNs =
-            TimeUnitToBucketSizeInMillis(config.count_metric(0).bucket()) * 1000LL * 1000LL;
-
-    int uid = 12345;
-    int64_t cfgId = 98765;
-    ConfigKey cfgKey(uid, cfgId);
-
-    sp<UidMap> m = new UidMap();
-    sp<StatsPullerManager> pullerManager = new StatsPullerManager();
-    sp<AlarmMonitor> anomalyAlarmMonitor;
-    sp<AlarmMonitor> subscriberAlarmMonitor;
-    vector<int64_t> activeConfigsBroadcast;
-
-    long timeBase1 = 1;
-    int broadcastCount = 0;
-    StatsLogProcessor processor(m, pullerManager, anomalyAlarmMonitor, subscriberAlarmMonitor,
-            bucketStartTimeNs, [](const ConfigKey& key) { return true; },
-            [&uid, &broadcastCount, &activeConfigsBroadcast](const int& broadcastUid,
-                    const vector<int64_t>& activeConfigs) {
-                broadcastCount++;
-                EXPECT_EQ(broadcastUid, uid);
-                activeConfigsBroadcast.clear();
-                activeConfigsBroadcast.insert(activeConfigsBroadcast.end(),
-                        activeConfigs.begin(), activeConfigs.end());
-                return true;
-            });
-
-    processor.OnConfigUpdated(bucketStartTimeNs, cfgKey, config);
-
-    EXPECT_EQ(processor.mMetricsManagers.size(), 1u);
-    sp<MetricsManager> metricsManager = processor.mMetricsManagers.begin()->second;
-    EXPECT_TRUE(metricsManager->isConfigValid());
-    EXPECT_EQ(metricsManager->mAllMetricProducers.size(), 1);
-    sp<MetricProducer> metricProducer = metricsManager->mAllMetricProducers[0];
-    auto& eventActivationMap = metricProducer->mEventActivationMap;
-    auto& eventDeactivationMap = metricProducer->mEventDeactivationMap;
-
-    EXPECT_FALSE(metricsManager->isActive());
-    EXPECT_FALSE(metricProducer->mIsActive);
-    // Two activations: one is triggered by battery saver mode (tracker index 0), the other is
-    // triggered by screen on event (tracker index 2).
-    EXPECT_EQ(eventActivationMap.size(), 2u);
-    EXPECT_TRUE(eventActivationMap.find(0) != eventActivationMap.end());
-    EXPECT_TRUE(eventActivationMap.find(2) != eventActivationMap.end());
-    EXPECT_EQ(eventActivationMap[0]->state, ActivationState::kNotActive);
-    EXPECT_EQ(eventActivationMap[0]->start_ns, 0);
-    EXPECT_EQ(eventActivationMap[0]->ttl_ns, 60 * 6 * NS_PER_SEC);
-    EXPECT_EQ(eventActivationMap[2]->state, ActivationState::kNotActive);
-    EXPECT_EQ(eventActivationMap[2]->start_ns, 0);
-    EXPECT_EQ(eventActivationMap[2]->ttl_ns, 60 * 2 * NS_PER_SEC);
-    EXPECT_EQ(eventDeactivationMap.size(), 1u);
-    EXPECT_TRUE(eventDeactivationMap.find(3) != eventDeactivationMap.end());
-    EXPECT_EQ(eventDeactivationMap[3].size(), 2u);
-    EXPECT_EQ(eventDeactivationMap[3][0], eventActivationMap[0]);
-    EXPECT_EQ(eventDeactivationMap[3][1], eventActivationMap[2]);
-    EXPECT_EQ(broadcastCount, 0);
-
-    std::unique_ptr<LogEvent> event;
-
-    // Event that should be ignored.
-    event = CreateAppCrashEvent(111, bucketStartTimeNs + 1);
-    processor.OnLogEvent(event.get(), bucketStartTimeNs + 1);
-
-    // Activate metric via screen on for 2 minutes.
-    event = CreateScreenStateChangedEvent(android::view::DISPLAY_STATE_ON, bucketStartTimeNs + 10);
-    processor.OnLogEvent(event.get(), bucketStartTimeNs + 10);
-    EXPECT_TRUE(metricsManager->isActive());
-    EXPECT_TRUE(metricProducer->mIsActive);
-    EXPECT_EQ(broadcastCount, 1);
-    EXPECT_EQ(activeConfigsBroadcast.size(), 1);
-    EXPECT_EQ(activeConfigsBroadcast[0], cfgId);
-    EXPECT_EQ(eventActivationMap[0]->state, ActivationState::kNotActive);
-    EXPECT_EQ(eventActivationMap[2]->state, ActivationState::kActive);
-    EXPECT_EQ(eventActivationMap[2]->start_ns, bucketStartTimeNs + 10);
-
-    // 1st processed event.
-    event = CreateAppCrashEvent(222, bucketStartTimeNs + 15);
-    processor.OnLogEvent(event.get(), bucketStartTimeNs + 15);
-
-    // Enable battery saver mode activation for 5 minutes.
-    event = CreateBatterySaverOnEvent(bucketStartTimeNs + NS_PER_SEC * 60 + 10);
-    processor.OnLogEvent(event.get(), bucketStartTimeNs + NS_PER_SEC * 60 + 10);
-    EXPECT_TRUE(metricsManager->isActive());
-    EXPECT_TRUE(metricProducer->mIsActive);
-    EXPECT_EQ(broadcastCount, 1);
-    EXPECT_EQ(eventActivationMap[0]->state, ActivationState::kActive);
-    EXPECT_EQ(eventActivationMap[0]->start_ns, bucketStartTimeNs + NS_PER_SEC * 60 + 10);
-    EXPECT_EQ(eventActivationMap[2]->state, ActivationState::kActive);
-    EXPECT_EQ(eventActivationMap[2]->start_ns, bucketStartTimeNs + 10);
-
-    // 2nd processed event.
-    event = CreateAppCrashEvent(333, bucketStartTimeNs + NS_PER_SEC * 60 + 40);
-    processor.OnLogEvent(event.get(), bucketStartTimeNs + NS_PER_SEC * 60 + 40);
-
-    // Cancel battery saver mode and screen on activation.
-    int64_t firstDeactivation = bucketStartTimeNs + NS_PER_SEC * 61;
-    event = CreateScreenBrightnessChangedEvent(64, firstDeactivation);
-    processor.OnLogEvent(event.get(), firstDeactivation);
-    EXPECT_FALSE(metricsManager->isActive());
-    EXPECT_FALSE(metricProducer->mIsActive);
-    // New broadcast since the config is no longer active.
-    EXPECT_EQ(broadcastCount, 2);
-    EXPECT_EQ(activeConfigsBroadcast.size(), 0);
-    EXPECT_EQ(eventActivationMap[0]->state, ActivationState::kNotActive);
-    EXPECT_EQ(eventActivationMap[2]->state, ActivationState::kNotActive);
-
-    // Should be ignored
-    event = CreateAppCrashEvent(444, bucketStartTimeNs + NS_PER_SEC * 61 + 80);
-    processor.OnLogEvent(event.get(), bucketStartTimeNs + NS_PER_SEC * 61 + 80);
-
-    // Re-enable battery saver mode activation.
-    event = CreateBatterySaverOnEvent(bucketStartTimeNs + NS_PER_SEC * 60 * 10 + 15);
-    processor.OnLogEvent(event.get(), bucketStartTimeNs + NS_PER_SEC * 60 * 10 + 15);
-    EXPECT_TRUE(metricsManager->isActive());
-    EXPECT_TRUE(metricProducer->mIsActive);
-    EXPECT_EQ(broadcastCount, 3);
-    EXPECT_EQ(activeConfigsBroadcast.size(), 1);
-    EXPECT_EQ(activeConfigsBroadcast[0], cfgId);
-    EXPECT_EQ(eventActivationMap[0]->state, ActivationState::kActive);
-    EXPECT_EQ(eventActivationMap[0]->start_ns, bucketStartTimeNs + NS_PER_SEC * 60 * 10 + 15);
-    EXPECT_EQ(eventActivationMap[2]->state, ActivationState::kNotActive);
-
-    // 3rd processed event.
-    event = CreateAppCrashEvent(555, bucketStartTimeNs + NS_PER_SEC * 60 * 10 + 80);
-    processor.OnLogEvent(event.get(), bucketStartTimeNs + NS_PER_SEC * 60 * 10 + 80);
-
-    // Cancel battery saver mode activation.
-    int64_t secondDeactivation = bucketStartTimeNs + NS_PER_SEC * 60 * 13;
-    event = CreateScreenBrightnessChangedEvent(140, secondDeactivation);
-    processor.OnLogEvent(event.get(), secondDeactivation);
-    EXPECT_FALSE(metricsManager->isActive());
-    EXPECT_FALSE(metricProducer->mIsActive);
-    EXPECT_EQ(broadcastCount, 4);
-    EXPECT_EQ(activeConfigsBroadcast.size(), 0);
-    EXPECT_EQ(eventActivationMap[0]->state, ActivationState::kNotActive);
-    EXPECT_EQ(eventActivationMap[2]->state, ActivationState::kNotActive);
-
-    // Should be ignored.
-    event = CreateAppCrashEvent(666, bucketStartTimeNs + NS_PER_SEC * 60 * 13 + 80);
-    processor.OnLogEvent(event.get(), bucketStartTimeNs + NS_PER_SEC * 60 * 13 + 80);
-
-    ConfigMetricsReportList reports;
-    vector<uint8_t> buffer;
-    processor.onDumpReport(cfgKey, bucketStartTimeNs + NS_PER_SEC * 60 * 15 + 1, false, true,
-                            ADB_DUMP, FAST, &buffer);
-    EXPECT_TRUE(buffer.size() > 0);
-    EXPECT_TRUE(reports.ParseFromArray(&buffer[0], buffer.size()));
-    backfillDimensionPath(&reports);
-    backfillStartEndTimestamp(&reports);
-    EXPECT_EQ(1, reports.reports_size());
-    EXPECT_EQ(1, reports.reports(0).metrics_size());
-    EXPECT_EQ(3, reports.reports(0).metrics(0).count_metrics().data_size());
-
-    StatsLogReport::CountMetricDataWrapper countMetrics;
-    sortMetricDataByDimensionsValue(
-            reports.reports(0).metrics(0).count_metrics(), &countMetrics);
-    EXPECT_EQ(3, countMetrics.data_size());
-
-    auto data = countMetrics.data(0);
-    EXPECT_EQ(android::util::PROCESS_LIFE_CYCLE_STATE_CHANGED, data.dimensions_in_what().field());
-    EXPECT_EQ(1, data.dimensions_in_what().value_tuple().dimensions_value_size());
-    EXPECT_EQ(1 /* uid field */,
-              data.dimensions_in_what().value_tuple().dimensions_value(0).field());
-    EXPECT_EQ(222, data.dimensions_in_what().value_tuple().dimensions_value(0).value_int());
-    EXPECT_EQ(1, data.bucket_info_size());
-    EXPECT_EQ(1, data.bucket_info(0).count());
-    EXPECT_EQ(bucketStartTimeNs, data.bucket_info(0).start_bucket_elapsed_nanos());
-    EXPECT_EQ(firstDeactivation, data.bucket_info(0).end_bucket_elapsed_nanos());
-
-    data = countMetrics.data(1);
-    EXPECT_EQ(android::util::PROCESS_LIFE_CYCLE_STATE_CHANGED, data.dimensions_in_what().field());
-    EXPECT_EQ(1, data.dimensions_in_what().value_tuple().dimensions_value_size());
-    EXPECT_EQ(1 /* uid field */,
-              data.dimensions_in_what().value_tuple().dimensions_value(0).field());
-    EXPECT_EQ(333, data.dimensions_in_what().value_tuple().dimensions_value(0).value_int());
-    EXPECT_EQ(1, data.bucket_info_size());
-    EXPECT_EQ(1, data.bucket_info(0).count());
-    EXPECT_EQ(bucketStartTimeNs, data.bucket_info(0).start_bucket_elapsed_nanos());
-    EXPECT_EQ(firstDeactivation, data.bucket_info(0).end_bucket_elapsed_nanos());
-
-    data = countMetrics.data(2);
-    EXPECT_EQ(android::util::PROCESS_LIFE_CYCLE_STATE_CHANGED, data.dimensions_in_what().field());
-    EXPECT_EQ(1, data.dimensions_in_what().value_tuple().dimensions_value_size());
-    EXPECT_EQ(1 /* uid field */,
-              data.dimensions_in_what().value_tuple().dimensions_value(0).field());
-    EXPECT_EQ(555, data.dimensions_in_what().value_tuple().dimensions_value(0).value_int());
-    EXPECT_EQ(1, data.bucket_info_size());
-    EXPECT_EQ(1, data.bucket_info(0).count());
-    // Partial bucket as metric is deactivated.
-    EXPECT_EQ(bucketStartTimeNs + 2 * bucketSizeNs, data.bucket_info(0).start_bucket_elapsed_nanos());
-    EXPECT_EQ(secondDeactivation, data.bucket_info(0).end_bucket_elapsed_nanos());
-}
-
-TEST(MetricActivationE2eTest, TestCountMetricWithTwoMetricsTwoDeactivations) {
-    auto config = CreateStatsdConfigWithTwoMetricsTwoDeactivations();
-
-    int64_t bucketStartTimeNs = NS_PER_SEC * 10; // 10 secs
-    int64_t bucketSizeNs =
-            TimeUnitToBucketSizeInMillis(config.count_metric(0).bucket()) * 1000LL * 1000LL;
-
-    int uid = 12345;
-    int64_t cfgId = 98765;
-    ConfigKey cfgKey(uid, cfgId);
-
-    sp<UidMap> m = new UidMap();
-    sp<StatsPullerManager> pullerManager = new StatsPullerManager();
-    sp<AlarmMonitor> anomalyAlarmMonitor;
-    sp<AlarmMonitor> subscriberAlarmMonitor;
-    vector<int64_t> activeConfigsBroadcast;
-
-    long timeBase1 = 1;
-    int broadcastCount = 0;
-    StatsLogProcessor processor(m, pullerManager, anomalyAlarmMonitor, subscriberAlarmMonitor,
-            bucketStartTimeNs, [](const ConfigKey& key) { return true; },
-            [&uid, &broadcastCount, &activeConfigsBroadcast](const int& broadcastUid,
-                    const vector<int64_t>& activeConfigs) {
-                broadcastCount++;
-                EXPECT_EQ(broadcastUid, uid);
-                activeConfigsBroadcast.clear();
-                activeConfigsBroadcast.insert(activeConfigsBroadcast.end(),
-                        activeConfigs.begin(), activeConfigs.end());
-                return true;
-            });
-
-    processor.OnConfigUpdated(bucketStartTimeNs, cfgKey, config);
-
-    EXPECT_EQ(processor.mMetricsManagers.size(), 1u);
-    sp<MetricsManager> metricsManager = processor.mMetricsManagers.begin()->second;
-    EXPECT_TRUE(metricsManager->isConfigValid());
-    EXPECT_EQ(metricsManager->mAllMetricProducers.size(), 2);
-    sp<MetricProducer> metricProducer = metricsManager->mAllMetricProducers[0];
-    auto& eventActivationMap = metricProducer->mEventActivationMap;
-    auto& eventDeactivationMap = metricProducer->mEventDeactivationMap;
-    sp<MetricProducer> metricProducer2 = metricsManager->mAllMetricProducers[1];
-    auto& eventActivationMap2 = metricProducer2->mEventActivationMap;
-    auto& eventDeactivationMap2 = metricProducer2->mEventDeactivationMap;
-
-    EXPECT_FALSE(metricsManager->isActive());
-    EXPECT_FALSE(metricProducer->mIsActive);
-    EXPECT_FALSE(metricProducer2->mIsActive);
-    // Two activations: one is triggered by battery saver mode (tracker index 0), the other is
-    // triggered by screen on event (tracker index 2).
-    EXPECT_EQ(eventActivationMap.size(), 2u);
-    EXPECT_TRUE(eventActivationMap.find(0) != eventActivationMap.end());
-    EXPECT_TRUE(eventActivationMap.find(2) != eventActivationMap.end());
-    EXPECT_EQ(eventActivationMap[0]->state, ActivationState::kNotActive);
-    EXPECT_EQ(eventActivationMap[0]->start_ns, 0);
-    EXPECT_EQ(eventActivationMap[0]->ttl_ns, 60 * 6 * NS_PER_SEC);
-    EXPECT_EQ(eventActivationMap[2]->state, ActivationState::kNotActive);
-    EXPECT_EQ(eventActivationMap[2]->start_ns, 0);
-    EXPECT_EQ(eventActivationMap[2]->ttl_ns, 60 * 2 * NS_PER_SEC);
-    EXPECT_EQ(eventDeactivationMap.size(), 2u);
-    EXPECT_TRUE(eventDeactivationMap.find(3) != eventDeactivationMap.end());
-    EXPECT_TRUE(eventDeactivationMap.find(4) != eventDeactivationMap.end());
-    EXPECT_EQ(eventDeactivationMap[3].size(), 1u);
-    EXPECT_EQ(eventDeactivationMap[4].size(), 1u);
-    EXPECT_EQ(eventDeactivationMap[3][0], eventActivationMap[0]);
-    EXPECT_EQ(eventDeactivationMap[4][0], eventActivationMap[2]);
-
-    EXPECT_EQ(eventActivationMap2.size(), 2u);
-    EXPECT_TRUE(eventActivationMap2.find(0) != eventActivationMap2.end());
-    EXPECT_TRUE(eventActivationMap2.find(2) != eventActivationMap2.end());
-    EXPECT_EQ(eventActivationMap2[0]->state, ActivationState::kNotActive);
-    EXPECT_EQ(eventActivationMap2[0]->start_ns, 0);
-    EXPECT_EQ(eventActivationMap2[0]->ttl_ns, 60 * 6 * NS_PER_SEC);
-    EXPECT_EQ(eventActivationMap2[2]->state, ActivationState::kNotActive);
-    EXPECT_EQ(eventActivationMap2[2]->start_ns, 0);
-    EXPECT_EQ(eventActivationMap2[2]->ttl_ns, 60 * 2 * NS_PER_SEC);
-    EXPECT_EQ(eventDeactivationMap2.size(), 2u);
-    EXPECT_TRUE(eventDeactivationMap2.find(3) != eventDeactivationMap2.end());
-    EXPECT_TRUE(eventDeactivationMap2.find(4) != eventDeactivationMap2.end());
-    EXPECT_EQ(eventDeactivationMap[3].size(), 1u);
-    EXPECT_EQ(eventDeactivationMap[4].size(), 1u);
-    EXPECT_EQ(eventDeactivationMap2[3][0], eventActivationMap2[0]);
-    EXPECT_EQ(eventDeactivationMap2[4][0], eventActivationMap2[2]);
-
-    std::unique_ptr<LogEvent> event;
-
-    event = CreateAppCrashEvent(111, bucketStartTimeNs + 5);
-    processor.OnLogEvent(event.get(), bucketStartTimeNs + 5);
-    event = CreateMoveToForegroundEvent(1111, bucketStartTimeNs + 5);
-    processor.OnLogEvent(event.get(), bucketStartTimeNs + 5);
-    EXPECT_FALSE(metricsManager->isActive());
-    EXPECT_FALSE(metricProducer->mIsActive);
-    EXPECT_FALSE(metricProducer2->mIsActive);
-    EXPECT_EQ(broadcastCount, 0);
-
-    // Activated by battery save mode.
-    event = CreateBatterySaverOnEvent(bucketStartTimeNs + 10);
-    processor.OnLogEvent(event.get(), bucketStartTimeNs + 10);
-    EXPECT_TRUE(metricsManager->isActive());
-    EXPECT_EQ(broadcastCount, 1);
-    EXPECT_EQ(activeConfigsBroadcast.size(), 1);
-    EXPECT_EQ(activeConfigsBroadcast[0], cfgId);
-    EXPECT_TRUE(metricProducer->mIsActive);
-    EXPECT_EQ(eventActivationMap[0]->state, ActivationState::kActive);
-    EXPECT_EQ(eventActivationMap[0]->start_ns, bucketStartTimeNs + 10);
-    EXPECT_EQ(eventActivationMap[0]->ttl_ns, 60 * 6 * NS_PER_SEC);
-    EXPECT_EQ(eventActivationMap[2]->state, ActivationState::kNotActive);
-    EXPECT_EQ(eventActivationMap[2]->start_ns, 0);
-    EXPECT_EQ(eventActivationMap[2]->ttl_ns, 60 * 2 * NS_PER_SEC);
-    EXPECT_EQ(eventDeactivationMap[3][0], eventActivationMap[0]);
-    EXPECT_EQ(eventDeactivationMap[4][0], eventActivationMap[2]);
-    EXPECT_TRUE(metricProducer2->mIsActive);
-    EXPECT_EQ(eventActivationMap2[0]->state, ActivationState::kActive);
-    EXPECT_EQ(eventActivationMap2[0]->start_ns, bucketStartTimeNs + 10);
-    EXPECT_EQ(eventActivationMap2[0]->ttl_ns, 60 * 6 * NS_PER_SEC);
-    EXPECT_EQ(eventActivationMap2[2]->state, ActivationState::kNotActive);
-    EXPECT_EQ(eventActivationMap2[2]->start_ns, 0);
-    EXPECT_EQ(eventActivationMap2[2]->ttl_ns, 60 * 2 * NS_PER_SEC);
-    EXPECT_EQ(eventDeactivationMap2[3][0], eventActivationMap2[0]);
-    EXPECT_EQ(eventDeactivationMap2[4][0], eventActivationMap2[2]);
-
-    // First processed event.
-    event = CreateAppCrashEvent(222, bucketStartTimeNs + 15);
-    processor.OnLogEvent(event.get(), bucketStartTimeNs + 15);
-    event = CreateMoveToForegroundEvent(2222, bucketStartTimeNs + 15);
-    processor.OnLogEvent(event.get(), bucketStartTimeNs + 15);
-
-    // Activated by screen on event.
-    event = CreateScreenStateChangedEvent(android::view::DISPLAY_STATE_ON,
-                                          bucketStartTimeNs + 20);
-    processor.OnLogEvent(event.get(), bucketStartTimeNs + 20);
-    EXPECT_TRUE(metricsManager->isActive());
-    EXPECT_TRUE(metricProducer->mIsActive);
-    EXPECT_EQ(eventActivationMap[0]->state, ActivationState::kActive);
-    EXPECT_EQ(eventActivationMap[0]->start_ns, bucketStartTimeNs + 10);
-    EXPECT_EQ(eventActivationMap[0]->ttl_ns, 60 * 6 * NS_PER_SEC);
-    EXPECT_EQ(eventActivationMap[2]->state, ActivationState::kActive);
-    EXPECT_EQ(eventActivationMap[2]->start_ns, bucketStartTimeNs + 20);
-    EXPECT_EQ(eventActivationMap[2]->ttl_ns, 60 * 2 * NS_PER_SEC);
-    EXPECT_EQ(eventDeactivationMap[3][0], eventActivationMap[0]);
-    EXPECT_EQ(eventDeactivationMap[4][0], eventActivationMap[2]);
-    EXPECT_TRUE(metricProducer2->mIsActive);
-    EXPECT_EQ(eventActivationMap2[0]->state, ActivationState::kActive);
-    EXPECT_EQ(eventActivationMap2[0]->start_ns, bucketStartTimeNs + 10);
-    EXPECT_EQ(eventActivationMap2[0]->ttl_ns, 60 * 6 * NS_PER_SEC);
-    EXPECT_EQ(eventActivationMap2[2]->state, ActivationState::kActive);
-    EXPECT_EQ(eventActivationMap2[2]->start_ns, bucketStartTimeNs + 20);
-    EXPECT_EQ(eventActivationMap2[2]->ttl_ns, 60 * 2 * NS_PER_SEC);
-    EXPECT_EQ(eventDeactivationMap2[3][0], eventActivationMap2[0]);
-    EXPECT_EQ(eventDeactivationMap2[4][0], eventActivationMap2[2]);
-
-    // 2nd processed event.
-    // The activation by screen_on event expires, but the one by battery save mode is still active.
-    event = CreateAppCrashEvent(333, bucketStartTimeNs + NS_PER_SEC * 60 * 2 + 25);
-    processor.OnLogEvent(event.get(), bucketStartTimeNs + NS_PER_SEC * 60 * 2 + 25);
-    event = CreateMoveToForegroundEvent(3333, bucketStartTimeNs + NS_PER_SEC * 60 * 2 + 25);
-    processor.OnLogEvent(event.get(), bucketStartTimeNs + NS_PER_SEC * 60 * 2 + 25);
-    EXPECT_TRUE(metricsManager->isActive());
-    EXPECT_TRUE(metricProducer->mIsActive);
-    EXPECT_EQ(eventActivationMap[0]->state, ActivationState::kActive);
-    EXPECT_EQ(eventActivationMap[0]->start_ns, bucketStartTimeNs + 10);
-    EXPECT_EQ(eventActivationMap[0]->ttl_ns, 60 * 6 * NS_PER_SEC);
-    EXPECT_EQ(eventActivationMap[2]->state, ActivationState::kNotActive);
-    EXPECT_EQ(eventActivationMap[2]->start_ns, bucketStartTimeNs + 20);
-    EXPECT_EQ(eventActivationMap[2]->ttl_ns, 60 * 2 * NS_PER_SEC);
-    EXPECT_EQ(eventDeactivationMap[3][0], eventActivationMap[0]);
-    EXPECT_EQ(eventDeactivationMap[4][0], eventActivationMap[2]);
-    EXPECT_TRUE(metricProducer2->mIsActive);
-    EXPECT_EQ(eventActivationMap2[0]->state, ActivationState::kActive);
-    EXPECT_EQ(eventActivationMap2[0]->start_ns, bucketStartTimeNs + 10);
-    EXPECT_EQ(eventActivationMap2[0]->ttl_ns, 60 * 6 * NS_PER_SEC);
-    EXPECT_EQ(eventActivationMap2[2]->state, ActivationState::kNotActive);
-    EXPECT_EQ(eventActivationMap2[2]->start_ns, bucketStartTimeNs + 20);
-    EXPECT_EQ(eventActivationMap2[2]->ttl_ns, 60 * 2 * NS_PER_SEC);
-    EXPECT_EQ(eventDeactivationMap2[3][0], eventActivationMap2[0]);
-    EXPECT_EQ(eventDeactivationMap2[4][0], eventActivationMap2[2]);
-    // No new broadcast since the config should still be active.
-    EXPECT_EQ(broadcastCount, 1);
-
-    // 3rd processed event.
-    event = CreateAppCrashEvent(444, bucketStartTimeNs + NS_PER_SEC * 60 * 5 + 25);
-    processor.OnLogEvent(event.get(), bucketStartTimeNs + NS_PER_SEC * 60 * 5 + 25);
-    event = CreateMoveToForegroundEvent(4444, bucketStartTimeNs + NS_PER_SEC * 60 * 5 + 25);
-    processor.OnLogEvent(event.get(), bucketStartTimeNs + NS_PER_SEC * 60 * 5 + 25);
-
-    // All activations expired.
-    event = CreateAppCrashEvent(555, bucketStartTimeNs + NS_PER_SEC * 60 * 8);
-    processor.OnLogEvent(event.get(), bucketStartTimeNs + NS_PER_SEC * 60 * 8);
-    event = CreateMoveToForegroundEvent(5555, bucketStartTimeNs + NS_PER_SEC * 60 * 8);
-    processor.OnLogEvent(event.get(), bucketStartTimeNs + NS_PER_SEC * 60 * 8);
-    EXPECT_FALSE(metricsManager->isActive());
-    // New broadcast since the config is no longer active.
-    EXPECT_EQ(broadcastCount, 2);
-    EXPECT_EQ(activeConfigsBroadcast.size(), 0);
-    EXPECT_FALSE(metricProducer->mIsActive);
-    EXPECT_EQ(eventActivationMap[0]->state, ActivationState::kNotActive);
-    EXPECT_EQ(eventActivationMap[0]->start_ns, bucketStartTimeNs + 10);
-    EXPECT_EQ(eventActivationMap[0]->ttl_ns, 60 * 6 * NS_PER_SEC);
-    EXPECT_EQ(eventActivationMap[2]->state, ActivationState::kNotActive);
-    EXPECT_EQ(eventActivationMap[2]->start_ns, bucketStartTimeNs + 20);
-    EXPECT_EQ(eventActivationMap[2]->ttl_ns, 60 * 2 * NS_PER_SEC);
-    EXPECT_EQ(eventDeactivationMap[3][0], eventActivationMap[0]);
-    EXPECT_EQ(eventDeactivationMap[4][0], eventActivationMap[2]);
-    EXPECT_FALSE(metricProducer2->mIsActive);
-    EXPECT_EQ(eventActivationMap2[0]->state, ActivationState::kNotActive);
-    EXPECT_EQ(eventActivationMap2[0]->start_ns, bucketStartTimeNs + 10);
-    EXPECT_EQ(eventActivationMap2[0]->ttl_ns, 60 * 6 * NS_PER_SEC);
-    EXPECT_EQ(eventActivationMap2[2]->state, ActivationState::kNotActive);
-    EXPECT_EQ(eventActivationMap2[2]->start_ns, bucketStartTimeNs + 20);
-    EXPECT_EQ(eventActivationMap2[2]->ttl_ns, 60 * 2 * NS_PER_SEC);
-    EXPECT_EQ(eventDeactivationMap2[3][0], eventActivationMap2[0]);
-    EXPECT_EQ(eventDeactivationMap2[4][0], eventActivationMap2[2]);
-
-    // Re-activate metric via screen on.
-    event = CreateScreenStateChangedEvent(android::view::DISPLAY_STATE_ON,
-                                          bucketStartTimeNs + NS_PER_SEC * 60 * 10 + 10);
-    processor.OnLogEvent(event.get(), bucketStartTimeNs + NS_PER_SEC * 60 * 10 + 10);
-    EXPECT_TRUE(metricsManager->isActive());
-    EXPECT_EQ(broadcastCount, 3);
-    EXPECT_EQ(activeConfigsBroadcast.size(), 1);
-    EXPECT_EQ(activeConfigsBroadcast[0], cfgId);
-    EXPECT_TRUE(metricProducer->mIsActive);
-    EXPECT_EQ(eventActivationMap[0]->state, ActivationState::kNotActive);
-    EXPECT_EQ(eventActivationMap[0]->start_ns, bucketStartTimeNs + 10);
-    EXPECT_EQ(eventActivationMap[0]->ttl_ns, 60 * 6 * NS_PER_SEC);
-    EXPECT_EQ(eventActivationMap[2]->state, ActivationState::kActive);
-    EXPECT_EQ(eventActivationMap[2]->start_ns, bucketStartTimeNs + NS_PER_SEC * 60 * 10 + 10);
-    EXPECT_EQ(eventActivationMap[2]->ttl_ns, 60 * 2 * NS_PER_SEC);
-    EXPECT_EQ(eventDeactivationMap[3][0], eventActivationMap[0]);
-    EXPECT_EQ(eventDeactivationMap[4][0], eventActivationMap[2]);
-    EXPECT_TRUE(metricProducer2->mIsActive);
-    EXPECT_EQ(eventActivationMap2[0]->state, ActivationState::kNotActive);
-    EXPECT_EQ(eventActivationMap2[0]->start_ns, bucketStartTimeNs + 10);
-    EXPECT_EQ(eventActivationMap2[0]->ttl_ns, 60 * 6 * NS_PER_SEC);
-    EXPECT_EQ(eventActivationMap2[2]->state, ActivationState::kActive);
-    EXPECT_EQ(eventActivationMap2[2]->start_ns, bucketStartTimeNs + NS_PER_SEC * 60 * 10 + 10);
-    EXPECT_EQ(eventActivationMap2[2]->ttl_ns, 60 * 2 * NS_PER_SEC);
-    EXPECT_EQ(eventDeactivationMap2[3][0], eventActivationMap2[0]);
-    EXPECT_EQ(eventDeactivationMap2[4][0], eventActivationMap2[2]);
-
-    // 4th processed event.
-    event = CreateAppCrashEvent(666, bucketStartTimeNs + NS_PER_SEC * 60 * 11 + 1);
-    processor.OnLogEvent(event.get(), bucketStartTimeNs + NS_PER_SEC * 60 * 11 + 1);
-    event = CreateMoveToForegroundEvent(6666, bucketStartTimeNs + NS_PER_SEC * 60 * 11 + 1);
-    processor.OnLogEvent(event.get(), bucketStartTimeNs + NS_PER_SEC * 60 * 11 + 1);
-
-    // Re-enable battery saver mode activation.
-    event = CreateBatterySaverOnEvent(bucketStartTimeNs + NS_PER_SEC * 60 * 11 + 15);
-    processor.OnLogEvent(event.get(), bucketStartTimeNs + NS_PER_SEC * 60 * 11 + 15);
-    EXPECT_TRUE(metricsManager->isActive());
-    EXPECT_EQ(broadcastCount, 3);
-    EXPECT_EQ(activeConfigsBroadcast.size(), 1);
-    EXPECT_EQ(activeConfigsBroadcast[0], cfgId);
-    EXPECT_TRUE(metricProducer->mIsActive);
-    EXPECT_EQ(eventActivationMap[0]->state, ActivationState::kActive);
-    EXPECT_EQ(eventActivationMap[0]->start_ns, bucketStartTimeNs + NS_PER_SEC * 60 * 11 + 15);
-    EXPECT_EQ(eventActivationMap[0]->ttl_ns, 60 * 6 * NS_PER_SEC);
-    EXPECT_EQ(eventActivationMap[2]->state, ActivationState::kActive);
-    EXPECT_EQ(eventActivationMap[2]->start_ns, bucketStartTimeNs + NS_PER_SEC * 60 * 10 + 10);
-    EXPECT_EQ(eventActivationMap[2]->ttl_ns, 60 * 2 * NS_PER_SEC);
-    EXPECT_EQ(eventDeactivationMap[3][0], eventActivationMap[0]);
-    EXPECT_EQ(eventDeactivationMap[4][0], eventActivationMap[2]);
-    EXPECT_TRUE(metricProducer2->mIsActive);
-    EXPECT_EQ(eventActivationMap2[0]->state, ActivationState::kActive);
-    EXPECT_EQ(eventActivationMap2[0]->start_ns, bucketStartTimeNs + NS_PER_SEC * 60 * 11 + 15);
-    EXPECT_EQ(eventActivationMap2[0]->ttl_ns, 60 * 6 * NS_PER_SEC);
-    EXPECT_EQ(eventActivationMap2[2]->state, ActivationState::kActive);
-    EXPECT_EQ(eventActivationMap2[2]->start_ns, bucketStartTimeNs + NS_PER_SEC * 60 * 10 + 10);
-    EXPECT_EQ(eventActivationMap2[2]->ttl_ns, 60 * 2 * NS_PER_SEC);
-    EXPECT_EQ(eventDeactivationMap2[3][0], eventActivationMap2[0]);
-    EXPECT_EQ(eventDeactivationMap2[4][0], eventActivationMap2[2]);
-
-    // 5th processed event.
-    event = CreateAppCrashEvent(777, bucketStartTimeNs + NS_PER_SEC * 60 * 11 + 40);
-    processor.OnLogEvent(event.get(), bucketStartTimeNs + NS_PER_SEC * 60 * 11 + 40);
-    event = CreateMoveToForegroundEvent(7777, bucketStartTimeNs + NS_PER_SEC * 60 * 11 + 40);
-    processor.OnLogEvent(event.get(), bucketStartTimeNs + NS_PER_SEC * 60 * 11 + 40);
-
-    // Cancel battery saver mode and screen on activation.
-    event = CreateScreenBrightnessChangedEvent(64, bucketStartTimeNs + NS_PER_SEC * 60 * 11 + 60);
-    processor.OnLogEvent(event.get(),bucketStartTimeNs + NS_PER_SEC * 60 * 11 + 60);
-    EXPECT_FALSE(metricsManager->isActive());
-    // New broadcast since the config is no longer active.
-    EXPECT_EQ(broadcastCount, 4);
-    EXPECT_EQ(activeConfigsBroadcast.size(), 0);
-    EXPECT_FALSE(metricProducer->mIsActive);
-    EXPECT_EQ(eventActivationMap[0]->state, ActivationState::kNotActive);
-    EXPECT_EQ(eventActivationMap[0]->start_ns, bucketStartTimeNs + NS_PER_SEC * 60 * 11 + 15);
-    EXPECT_EQ(eventActivationMap[0]->ttl_ns, 60 * 6 * NS_PER_SEC);
-    EXPECT_EQ(eventActivationMap[2]->state, ActivationState::kNotActive);
-    EXPECT_EQ(eventActivationMap[2]->start_ns, bucketStartTimeNs + NS_PER_SEC * 60 * 10 + 10);
-    EXPECT_EQ(eventActivationMap[2]->ttl_ns, 60 * 2 * NS_PER_SEC);
-    EXPECT_EQ(eventDeactivationMap[3][0], eventActivationMap[0]);
-    EXPECT_EQ(eventDeactivationMap[4][0], eventActivationMap[2]);
-    EXPECT_FALSE(metricProducer2->mIsActive);
-    EXPECT_EQ(eventActivationMap2[0]->state, ActivationState::kNotActive);
-    EXPECT_EQ(eventActivationMap2[0]->start_ns, bucketStartTimeNs + NS_PER_SEC * 60 * 11 + 15);
-    EXPECT_EQ(eventActivationMap2[0]->ttl_ns, 60 * 6 * NS_PER_SEC);
-    EXPECT_EQ(eventActivationMap2[2]->state, ActivationState::kNotActive);
-    EXPECT_EQ(eventActivationMap2[2]->start_ns, bucketStartTimeNs + NS_PER_SEC * 60 * 10 + 10);
-    EXPECT_EQ(eventActivationMap2[2]->ttl_ns, 60 * 2 * NS_PER_SEC);
-    EXPECT_EQ(eventDeactivationMap2[3][0], eventActivationMap2[0]);
-    EXPECT_EQ(eventDeactivationMap2[4][0], eventActivationMap2[2]);
-
-    // Screen-on activation expired.
-    event = CreateAppCrashEvent(888, bucketStartTimeNs + NS_PER_SEC * 60 * 13);
-    processor.OnLogEvent(event.get(), bucketStartTimeNs + NS_PER_SEC * 60 * 13);
-    event = CreateMoveToForegroundEvent(8888, bucketStartTimeNs + NS_PER_SEC * 60 * 13);
-    processor.OnLogEvent(event.get(), bucketStartTimeNs + NS_PER_SEC * 60 * 13);
-    EXPECT_FALSE(metricsManager->isActive());
-    EXPECT_EQ(broadcastCount, 4);
-    EXPECT_EQ(activeConfigsBroadcast.size(), 0);
-    EXPECT_FALSE(metricProducer->mIsActive);
-    EXPECT_EQ(eventActivationMap[0]->state, ActivationState::kNotActive);
-    EXPECT_EQ(eventActivationMap[0]->start_ns, bucketStartTimeNs + NS_PER_SEC * 60 * 11 + 15);
-    EXPECT_EQ(eventActivationMap[0]->ttl_ns, 60 * 6 * NS_PER_SEC);
-    EXPECT_EQ(eventActivationMap[2]->state, ActivationState::kNotActive);
-    EXPECT_EQ(eventActivationMap[2]->start_ns, bucketStartTimeNs + NS_PER_SEC * 60 * 10 + 10);
-    EXPECT_EQ(eventActivationMap[2]->ttl_ns, 60 * 2 * NS_PER_SEC);
-    EXPECT_EQ(eventDeactivationMap[3][0], eventActivationMap[0]);
-    EXPECT_EQ(eventDeactivationMap[4][0], eventActivationMap[2]);
-    EXPECT_FALSE(metricProducer2->mIsActive);
-    EXPECT_EQ(eventActivationMap2[0]->state, ActivationState::kNotActive);
-    EXPECT_EQ(eventActivationMap2[0]->start_ns, bucketStartTimeNs + NS_PER_SEC * 60 * 11 + 15);
-    EXPECT_EQ(eventActivationMap2[0]->ttl_ns, 60 * 6 * NS_PER_SEC);
-    EXPECT_EQ(eventActivationMap2[2]->state, ActivationState::kNotActive);
-    EXPECT_EQ(eventActivationMap2[2]->start_ns, bucketStartTimeNs + NS_PER_SEC * 60 * 10 + 10);
-    EXPECT_EQ(eventActivationMap2[2]->ttl_ns, 60 * 2 * NS_PER_SEC);
-    EXPECT_EQ(eventDeactivationMap2[3][0], eventActivationMap2[0]);
-    EXPECT_EQ(eventDeactivationMap2[4][0], eventActivationMap2[2]);
-
-    event = CreateAppCrashEvent(999, bucketStartTimeNs + NS_PER_SEC * 60 * 14 + 1);
-    processor.OnLogEvent(event.get(), bucketStartTimeNs + NS_PER_SEC * 60 * 14 + 1);
-    event = CreateMoveToForegroundEvent(9999, bucketStartTimeNs + NS_PER_SEC * 60 * 14 + 1);
-    processor.OnLogEvent(event.get(), bucketStartTimeNs + NS_PER_SEC * 60 * 14 + 1);
-
-    // Re-enable battery saver mode activation.
-    event = CreateBatterySaverOnEvent(bucketStartTimeNs + NS_PER_SEC * 60 * 15 + 15);
-    processor.OnLogEvent(event.get(), bucketStartTimeNs + NS_PER_SEC * 60 * 15 + 15);
-    EXPECT_TRUE(metricsManager->isActive());
-    EXPECT_EQ(broadcastCount, 5);
-    EXPECT_EQ(activeConfigsBroadcast.size(), 1);
-    EXPECT_EQ(activeConfigsBroadcast[0], cfgId);
-    EXPECT_TRUE(metricProducer->mIsActive);
-    EXPECT_EQ(eventActivationMap[0]->state, ActivationState::kActive);
-    EXPECT_EQ(eventActivationMap[0]->start_ns, bucketStartTimeNs + NS_PER_SEC * 60 * 15 + 15);
-    EXPECT_EQ(eventActivationMap[0]->ttl_ns, 60 * 6 * NS_PER_SEC);
-    EXPECT_EQ(eventActivationMap[2]->state, ActivationState::kNotActive);
-    EXPECT_EQ(eventActivationMap[2]->start_ns, bucketStartTimeNs + NS_PER_SEC * 60 * 10 + 10);
-    EXPECT_EQ(eventActivationMap[2]->ttl_ns, 60 * 2 * NS_PER_SEC);
-    EXPECT_EQ(eventDeactivationMap[3][0], eventActivationMap[0]);
-    EXPECT_EQ(eventDeactivationMap[4][0], eventActivationMap[2]);
-    EXPECT_TRUE(metricProducer2->mIsActive);
-    EXPECT_EQ(eventActivationMap2[0]->state, ActivationState::kActive);
-    EXPECT_EQ(eventActivationMap2[0]->start_ns, bucketStartTimeNs + NS_PER_SEC * 60 * 15 + 15);
-    EXPECT_EQ(eventActivationMap2[0]->ttl_ns, 60 * 6 * NS_PER_SEC);
-    EXPECT_EQ(eventActivationMap2[2]->state, ActivationState::kNotActive);
-    EXPECT_EQ(eventActivationMap2[2]->start_ns, bucketStartTimeNs + NS_PER_SEC * 60 * 10 + 10);
-    EXPECT_EQ(eventActivationMap2[2]->ttl_ns, 60 * 2 * NS_PER_SEC);
-    EXPECT_EQ(eventDeactivationMap2[3][0], eventActivationMap2[0]);
-    EXPECT_EQ(eventDeactivationMap2[4][0], eventActivationMap2[2]);
-
-    // Cancel battery saver mode and screen on activation.
-    event = CreateScreenBrightnessChangedEvent(140, bucketStartTimeNs + NS_PER_SEC * 60 * 16);
-    processor.OnLogEvent(event.get(),bucketStartTimeNs + NS_PER_SEC * 60 * 16);
-    EXPECT_FALSE(metricsManager->isActive());
-    EXPECT_EQ(broadcastCount, 6);
-    EXPECT_EQ(activeConfigsBroadcast.size(), 0);
-    EXPECT_FALSE(metricProducer->mIsActive);
-    EXPECT_EQ(eventActivationMap[0]->state, ActivationState::kNotActive);
-    EXPECT_EQ(eventActivationMap[0]->start_ns, bucketStartTimeNs + NS_PER_SEC * 60 * 15 + 15);
-    EXPECT_EQ(eventActivationMap[0]->ttl_ns, 60 * 6 * NS_PER_SEC);
-    EXPECT_EQ(eventActivationMap[2]->state, ActivationState::kNotActive);
-    EXPECT_EQ(eventActivationMap[2]->start_ns, bucketStartTimeNs + NS_PER_SEC * 60 * 10 + 10);
-    EXPECT_EQ(eventActivationMap[2]->ttl_ns, 60 * 2 * NS_PER_SEC);
-    EXPECT_EQ(eventDeactivationMap[3][0], eventActivationMap[0]);
-    EXPECT_EQ(eventDeactivationMap[4][0], eventActivationMap[2]);
-    EXPECT_FALSE(metricProducer2->mIsActive);
-    EXPECT_EQ(eventActivationMap2[0]->state, ActivationState::kNotActive);
-    EXPECT_EQ(eventActivationMap2[0]->start_ns, bucketStartTimeNs + NS_PER_SEC * 60 * 15 + 15);
-    EXPECT_EQ(eventActivationMap2[0]->ttl_ns, 60 * 6 * NS_PER_SEC);
-    EXPECT_EQ(eventActivationMap2[2]->state, ActivationState::kNotActive);
-    EXPECT_EQ(eventActivationMap2[2]->start_ns, bucketStartTimeNs + NS_PER_SEC * 60 * 10 + 10);
-    EXPECT_EQ(eventActivationMap2[2]->ttl_ns, 60 * 2 * NS_PER_SEC);
-    EXPECT_EQ(eventDeactivationMap2[3][0], eventActivationMap2[0]);
-    EXPECT_EQ(eventDeactivationMap2[4][0], eventActivationMap2[2]);
-
-    ConfigMetricsReportList reports;
-    vector<uint8_t> buffer;
-    processor.onDumpReport(cfgKey, bucketStartTimeNs + NS_PER_SEC * 60 * 15 + 1, false, true,
-                            ADB_DUMP, FAST, &buffer);
-    EXPECT_TRUE(buffer.size() > 0);
-    EXPECT_TRUE(reports.ParseFromArray(&buffer[0], buffer.size()));
-    backfillDimensionPath(&reports);
-    backfillStartEndTimestamp(&reports);
-    EXPECT_EQ(1, reports.reports_size());
-    EXPECT_EQ(2, reports.reports(0).metrics_size());
-    EXPECT_EQ(5, reports.reports(0).metrics(0).count_metrics().data_size());
-    EXPECT_EQ(5, reports.reports(0).metrics(1).count_metrics().data_size());
-
-    StatsLogReport::CountMetricDataWrapper countMetrics;
-
-    sortMetricDataByDimensionsValue(
-            reports.reports(0).metrics(0).count_metrics(), &countMetrics);
-    EXPECT_EQ(5, countMetrics.data_size());
-
-    auto data = countMetrics.data(0);
-    EXPECT_EQ(android::util::PROCESS_LIFE_CYCLE_STATE_CHANGED, data.dimensions_in_what().field());
-    EXPECT_EQ(1, data.dimensions_in_what().value_tuple().dimensions_value_size());
-    EXPECT_EQ(1 /* uid field */,
-              data.dimensions_in_what().value_tuple().dimensions_value(0).field());
-    EXPECT_EQ(222, data.dimensions_in_what().value_tuple().dimensions_value(0).value_int());
-    EXPECT_EQ(1, data.bucket_info_size());
-    EXPECT_EQ(1, data.bucket_info(0).count());
-    EXPECT_EQ(bucketStartTimeNs, data.bucket_info(0).start_bucket_elapsed_nanos());
-    EXPECT_EQ(bucketStartTimeNs + bucketSizeNs, data.bucket_info(0).end_bucket_elapsed_nanos());
-
-    data = countMetrics.data(1);
-    EXPECT_EQ(android::util::PROCESS_LIFE_CYCLE_STATE_CHANGED, data.dimensions_in_what().field());
-    EXPECT_EQ(1, data.dimensions_in_what().value_tuple().dimensions_value_size());
-    EXPECT_EQ(1 /* uid field */,
-              data.dimensions_in_what().value_tuple().dimensions_value(0).field());
-    EXPECT_EQ(333, data.dimensions_in_what().value_tuple().dimensions_value(0).value_int());
-    EXPECT_EQ(1, data.bucket_info_size());
-    EXPECT_EQ(1, data.bucket_info(0).count());
-    EXPECT_EQ(bucketStartTimeNs, data.bucket_info(0).start_bucket_elapsed_nanos());
-    EXPECT_EQ(bucketStartTimeNs + bucketSizeNs, data.bucket_info(0).end_bucket_elapsed_nanos());
-
-    data = countMetrics.data(2);
-    EXPECT_EQ(android::util::PROCESS_LIFE_CYCLE_STATE_CHANGED, data.dimensions_in_what().field());
-    EXPECT_EQ(1, data.dimensions_in_what().value_tuple().dimensions_value_size());
-    EXPECT_EQ(1 /* uid field */,
-              data.dimensions_in_what().value_tuple().dimensions_value(0).field());
-    EXPECT_EQ(444, data.dimensions_in_what().value_tuple().dimensions_value(0).value_int());
-    EXPECT_EQ(1, data.bucket_info_size());
-    EXPECT_EQ(1, data.bucket_info(0).count());
-    // Partial bucket as metric is deactivated.
-    EXPECT_EQ(bucketStartTimeNs + bucketSizeNs, data.bucket_info(0).start_bucket_elapsed_nanos());
-    EXPECT_EQ(bucketStartTimeNs + NS_PER_SEC * 60 * 8,
-              data.bucket_info(0).end_bucket_elapsed_nanos());
-
-    data = countMetrics.data(3);
-    EXPECT_EQ(android::util::PROCESS_LIFE_CYCLE_STATE_CHANGED, data.dimensions_in_what().field());
-    EXPECT_EQ(1, data.dimensions_in_what().value_tuple().dimensions_value_size());
-    EXPECT_EQ(1 /* uid field */,
-              data.dimensions_in_what().value_tuple().dimensions_value(0).field());
-    EXPECT_EQ(666, data.dimensions_in_what().value_tuple().dimensions_value(0).value_int());
-    EXPECT_EQ(1, data.bucket_info_size());
-    EXPECT_EQ(1, data.bucket_info(0).count());
-    EXPECT_EQ(bucketStartTimeNs + 2 * bucketSizeNs,
-              data.bucket_info(0).start_bucket_elapsed_nanos());
-    EXPECT_EQ(bucketStartTimeNs + NS_PER_SEC * 60 * 11,
-              data.bucket_info(0).end_bucket_elapsed_nanos());
-
-    data = countMetrics.data(4);
-    EXPECT_EQ(android::util::PROCESS_LIFE_CYCLE_STATE_CHANGED, data.dimensions_in_what().field());
-    EXPECT_EQ(1, data.dimensions_in_what().value_tuple().dimensions_value_size());
-    EXPECT_EQ(1 /* uid field */,
-              data.dimensions_in_what().value_tuple().dimensions_value(0).field());
-    EXPECT_EQ(777, data.dimensions_in_what().value_tuple().dimensions_value(0).value_int());
-    EXPECT_EQ(1, data.bucket_info_size());
-    EXPECT_EQ(1, data.bucket_info(0).count());
-    EXPECT_EQ(bucketStartTimeNs + 2 * bucketSizeNs,
-              data.bucket_info(0).start_bucket_elapsed_nanos());
-    EXPECT_EQ(bucketStartTimeNs + NS_PER_SEC * 60 * 11,
-              data.bucket_info(0).end_bucket_elapsed_nanos());
-
-
-   countMetrics.clear_data();
-    sortMetricDataByDimensionsValue(
-            reports.reports(0).metrics(1).count_metrics(), &countMetrics);
-    EXPECT_EQ(5, countMetrics.data_size());
-
-    data = countMetrics.data(0);
-    EXPECT_EQ(android::util::ACTIVITY_FOREGROUND_STATE_CHANGED, data.dimensions_in_what().field());
-    EXPECT_EQ(1, data.dimensions_in_what().value_tuple().dimensions_value_size());
-    EXPECT_EQ(1 /* uid field */,
-              data.dimensions_in_what().value_tuple().dimensions_value(0).field());
-    EXPECT_EQ(2222, data.dimensions_in_what().value_tuple().dimensions_value(0).value_int());
-    EXPECT_EQ(1, data.bucket_info_size());
-    EXPECT_EQ(1, data.bucket_info(0).count());
-    EXPECT_EQ(bucketStartTimeNs, data.bucket_info(0).start_bucket_elapsed_nanos());
-    EXPECT_EQ(bucketStartTimeNs + bucketSizeNs, data.bucket_info(0).end_bucket_elapsed_nanos());
-
-    data = countMetrics.data(1);
-    EXPECT_EQ(android::util::ACTIVITY_FOREGROUND_STATE_CHANGED, data.dimensions_in_what().field());
-    EXPECT_EQ(1, data.dimensions_in_what().value_tuple().dimensions_value_size());
-    EXPECT_EQ(1 /* uid field */,
-              data.dimensions_in_what().value_tuple().dimensions_value(0).field());
-    EXPECT_EQ(3333, data.dimensions_in_what().value_tuple().dimensions_value(0).value_int());
-    EXPECT_EQ(1, data.bucket_info_size());
-    EXPECT_EQ(1, data.bucket_info(0).count());
-    EXPECT_EQ(bucketStartTimeNs, data.bucket_info(0).start_bucket_elapsed_nanos());
-    EXPECT_EQ(bucketStartTimeNs + bucketSizeNs, data.bucket_info(0).end_bucket_elapsed_nanos());
-
-    data = countMetrics.data(2);
-    EXPECT_EQ(android::util::ACTIVITY_FOREGROUND_STATE_CHANGED, data.dimensions_in_what().field());
-    EXPECT_EQ(1, data.dimensions_in_what().value_tuple().dimensions_value_size());
-    EXPECT_EQ(1 /* uid field */,
-              data.dimensions_in_what().value_tuple().dimensions_value(0).field());
-    EXPECT_EQ(4444, data.dimensions_in_what().value_tuple().dimensions_value(0).value_int());
-    EXPECT_EQ(1, data.bucket_info_size());
-    EXPECT_EQ(1, data.bucket_info(0).count());
-    // Partial bucket as metric is deactivated.
-    EXPECT_EQ(bucketStartTimeNs + bucketSizeNs, data.bucket_info(0).start_bucket_elapsed_nanos());
-    EXPECT_EQ(bucketStartTimeNs + NS_PER_SEC * 60 * 8,
-              data.bucket_info(0).end_bucket_elapsed_nanos());
-
-    data = countMetrics.data(3);
-    EXPECT_EQ(android::util::ACTIVITY_FOREGROUND_STATE_CHANGED, data.dimensions_in_what().field());
-    EXPECT_EQ(1, data.dimensions_in_what().value_tuple().dimensions_value_size());
-    EXPECT_EQ(1 /* uid field */,
-              data.dimensions_in_what().value_tuple().dimensions_value(0).field());
-    EXPECT_EQ(6666, data.dimensions_in_what().value_tuple().dimensions_value(0).value_int());
-    EXPECT_EQ(1, data.bucket_info_size());
-    EXPECT_EQ(1, data.bucket_info(0).count());
-    EXPECT_EQ(bucketStartTimeNs + 2 * bucketSizeNs,
-              data.bucket_info(0).start_bucket_elapsed_nanos());
-    EXPECT_EQ(bucketStartTimeNs + NS_PER_SEC * 60 * 11,
-              data.bucket_info(0).end_bucket_elapsed_nanos());
-
-    data = countMetrics.data(4);
-    EXPECT_EQ(android::util::ACTIVITY_FOREGROUND_STATE_CHANGED, data.dimensions_in_what().field());
-    EXPECT_EQ(1, data.dimensions_in_what().value_tuple().dimensions_value_size());
-    EXPECT_EQ(1 /* uid field */,
-              data.dimensions_in_what().value_tuple().dimensions_value(0).field());
-    EXPECT_EQ(7777, data.dimensions_in_what().value_tuple().dimensions_value(0).value_int());
-    EXPECT_EQ(1, data.bucket_info_size());
-    EXPECT_EQ(1, data.bucket_info(0).count());
-    EXPECT_EQ(bucketStartTimeNs + 2 * bucketSizeNs,
-              data.bucket_info(0).start_bucket_elapsed_nanos());
-    EXPECT_EQ(bucketStartTimeNs + NS_PER_SEC * 60 * 11,
-              data.bucket_info(0).end_bucket_elapsed_nanos());
-}
+// TODO(b/149590301): Update these tests to use new socket schema.
+//TEST(MetricActivationE2eTest, TestCountMetric) {
+//    auto config = CreateStatsdConfig();
+//
+//    int64_t bucketStartTimeNs = NS_PER_SEC * 10; // 10 secs
+//    int64_t bucketSizeNs =
+//            TimeUnitToBucketSizeInMillis(config.count_metric(0).bucket()) * 1000LL * 1000LL;
+//
+//    int uid = 12345;
+//    int64_t cfgId = 98765;
+//    ConfigKey cfgKey(uid, cfgId);
+//
+//    sp<UidMap> m = new UidMap();
+//    sp<StatsPullerManager> pullerManager = new StatsPullerManager();
+//    sp<AlarmMonitor> anomalyAlarmMonitor;
+//    sp<AlarmMonitor> subscriberAlarmMonitor;
+//    vector<int64_t> activeConfigsBroadcast;
+//
+//    long timeBase1 = 1;
+//    int broadcastCount = 0;
+//    StatsLogProcessor processor(m, pullerManager, anomalyAlarmMonitor, subscriberAlarmMonitor,
+//            bucketStartTimeNs, [](const ConfigKey& key) { return true; },
+//            [&uid, &broadcastCount, &activeConfigsBroadcast](const int& broadcastUid,
+//                    const vector<int64_t>& activeConfigs) {
+//                broadcastCount++;
+//                EXPECT_EQ(broadcastUid, uid);
+//                activeConfigsBroadcast.clear();
+//                activeConfigsBroadcast.insert(activeConfigsBroadcast.end(),
+//                        activeConfigs.begin(), activeConfigs.end());
+//                return true;
+//            });
+//
+//    processor.OnConfigUpdated(bucketStartTimeNs, cfgKey, config);
+//
+//    EXPECT_EQ(processor.mMetricsManagers.size(), 1u);
+//    sp<MetricsManager> metricsManager = processor.mMetricsManagers.begin()->second;
+//    EXPECT_TRUE(metricsManager->isConfigValid());
+//    EXPECT_EQ(metricsManager->mAllMetricProducers.size(), 1);
+//    sp<MetricProducer> metricProducer = metricsManager->mAllMetricProducers[0];
+//    auto& eventActivationMap = metricProducer->mEventActivationMap;
+//
+//    EXPECT_FALSE(metricsManager->isActive());
+//    EXPECT_FALSE(metricProducer->mIsActive);
+//    // Two activations: one is triggered by battery saver mode (tracker index 0), the other is
+//    // triggered by screen on event (tracker index 2).
+//    EXPECT_EQ(eventActivationMap.size(), 2u);
+//    EXPECT_TRUE(eventActivationMap.find(0) != eventActivationMap.end());
+//    EXPECT_TRUE(eventActivationMap.find(2) != eventActivationMap.end());
+//    EXPECT_EQ(eventActivationMap[0]->state, ActivationState::kNotActive);
+//    EXPECT_EQ(eventActivationMap[0]->start_ns, 0);
+//    EXPECT_EQ(eventActivationMap[0]->ttl_ns, 60 * 6 * NS_PER_SEC);
+//    EXPECT_EQ(eventActivationMap[2]->state, ActivationState::kNotActive);
+//    EXPECT_EQ(eventActivationMap[2]->start_ns, 0);
+//    EXPECT_EQ(eventActivationMap[2]->ttl_ns, 60 * 2 * NS_PER_SEC);
+//
+//    std::unique_ptr<LogEvent> event;
+//
+//    event = CreateAppCrashEvent(111, bucketStartTimeNs + 5);
+//    processor.OnLogEvent(event.get(), bucketStartTimeNs + 5);
+//    EXPECT_FALSE(metricsManager->isActive());
+//    EXPECT_FALSE(metricProducer->mIsActive);
+//    EXPECT_EQ(broadcastCount, 0);
+//
+//    // Activated by battery save mode.
+//    event = CreateBatterySaverOnEvent(bucketStartTimeNs + 10);
+//    processor.OnLogEvent(event.get(), bucketStartTimeNs + 10);
+//    EXPECT_TRUE(metricsManager->isActive());
+//    EXPECT_TRUE(metricProducer->mIsActive);
+//    EXPECT_EQ(broadcastCount, 1);
+//    EXPECT_EQ(activeConfigsBroadcast.size(), 1);
+//    EXPECT_EQ(activeConfigsBroadcast[0], cfgId);
+//    EXPECT_EQ(eventActivationMap[0]->state, ActivationState::kActive);
+//    EXPECT_EQ(eventActivationMap[0]->start_ns, bucketStartTimeNs + 10);
+//    EXPECT_EQ(eventActivationMap[0]->ttl_ns, 60 * 6 * NS_PER_SEC);
+//    EXPECT_EQ(eventActivationMap[2]->state, ActivationState::kNotActive);
+//    EXPECT_EQ(eventActivationMap[2]->start_ns, 0);
+//    EXPECT_EQ(eventActivationMap[2]->ttl_ns, 60 * 2 * NS_PER_SEC);
+//
+//    // First processed event.
+//    event = CreateAppCrashEvent(222, bucketStartTimeNs + 15);
+//    processor.OnLogEvent(event.get(), bucketStartTimeNs + 15);
+//
+//    // Activated by screen on event.
+//    event = CreateScreenStateChangedEvent(android::view::DISPLAY_STATE_ON,
+//                                          bucketStartTimeNs + 20);
+//    processor.OnLogEvent(event.get(), bucketStartTimeNs + 20);
+//    EXPECT_TRUE(metricsManager->isActive());
+//    EXPECT_TRUE(metricProducer->mIsActive);
+//    EXPECT_EQ(eventActivationMap[0]->state, ActivationState::kActive);
+//    EXPECT_EQ(eventActivationMap[0]->start_ns, bucketStartTimeNs + 10);
+//    EXPECT_EQ(eventActivationMap[0]->ttl_ns, 60 * 6 * NS_PER_SEC);
+//    EXPECT_EQ(eventActivationMap[2]->state, ActivationState::kActive);
+//    EXPECT_EQ(eventActivationMap[2]->start_ns, bucketStartTimeNs + 20);
+//    EXPECT_EQ(eventActivationMap[2]->ttl_ns, 60 * 2 * NS_PER_SEC);
+//
+//    // 2nd processed event.
+//    // The activation by screen_on event expires, but the one by battery save mode is still active.
+//    event = CreateAppCrashEvent(333, bucketStartTimeNs + NS_PER_SEC * 60 * 2 + 25);
+//    processor.OnLogEvent(event.get(), bucketStartTimeNs + NS_PER_SEC * 60 * 2 + 25);
+//    EXPECT_TRUE(metricsManager->isActive());
+//    EXPECT_TRUE(metricProducer->mIsActive);
+//    EXPECT_EQ(eventActivationMap[0]->state, ActivationState::kActive);
+//    EXPECT_EQ(eventActivationMap[0]->start_ns, bucketStartTimeNs + 10);
+//    EXPECT_EQ(eventActivationMap[0]->ttl_ns, 60 * 6 * NS_PER_SEC);
+//    EXPECT_EQ(eventActivationMap[2]->state, ActivationState::kNotActive);
+//    EXPECT_EQ(eventActivationMap[2]->start_ns, bucketStartTimeNs + 20);
+//    EXPECT_EQ(eventActivationMap[2]->ttl_ns, 60 * 2 * NS_PER_SEC);
+//    // No new broadcast since the config should still be active.
+//    EXPECT_EQ(broadcastCount, 1);
+//
+//    // 3rd processed event.
+//    event = CreateAppCrashEvent(444, bucketStartTimeNs + NS_PER_SEC * 60 * 5 + 25);
+//    processor.OnLogEvent(event.get(), bucketStartTimeNs + NS_PER_SEC * 60 * 5 + 25);
+//
+//    // All activations expired.
+//    event = CreateAppCrashEvent(555, bucketStartTimeNs + NS_PER_SEC * 60 * 8);
+//    processor.OnLogEvent(event.get(), bucketStartTimeNs + NS_PER_SEC * 60 * 8);
+//    EXPECT_FALSE(metricsManager->isActive());
+//    EXPECT_FALSE(metricProducer->mIsActive);
+//    // New broadcast since the config is no longer active.
+//    EXPECT_EQ(broadcastCount, 2);
+//    EXPECT_EQ(activeConfigsBroadcast.size(), 0);
+//    EXPECT_EQ(eventActivationMap[0]->state, ActivationState::kNotActive);
+//    EXPECT_EQ(eventActivationMap[0]->start_ns, bucketStartTimeNs + 10);
+//    EXPECT_EQ(eventActivationMap[0]->ttl_ns, 60 * 6 * NS_PER_SEC);
+//    EXPECT_EQ(eventActivationMap[2]->state, ActivationState::kNotActive);
+//    EXPECT_EQ(eventActivationMap[2]->start_ns, bucketStartTimeNs + 20);
+//    EXPECT_EQ(eventActivationMap[2]->ttl_ns, 60 * 2 * NS_PER_SEC);
+//
+//    // Re-activate metric via screen on.
+//    event = CreateScreenStateChangedEvent(android::view::DISPLAY_STATE_ON,
+//                                          bucketStartTimeNs + NS_PER_SEC * 60 * 10 + 10);
+//    processor.OnLogEvent(event.get(), bucketStartTimeNs + NS_PER_SEC * 60 * 10 + 10);
+//    EXPECT_TRUE(metricsManager->isActive());
+//    EXPECT_TRUE(metricProducer->mIsActive);
+//    EXPECT_EQ(broadcastCount, 3);
+//    EXPECT_EQ(activeConfigsBroadcast.size(), 1);
+//    EXPECT_EQ(activeConfigsBroadcast[0], cfgId);
+//    EXPECT_EQ(eventActivationMap[0]->state, ActivationState::kNotActive);
+//    EXPECT_EQ(eventActivationMap[0]->start_ns, bucketStartTimeNs + 10);
+//    EXPECT_EQ(eventActivationMap[0]->ttl_ns, 60 * 6 * NS_PER_SEC);
+//    EXPECT_EQ(eventActivationMap[2]->state, ActivationState::kActive);
+//    EXPECT_EQ(eventActivationMap[2]->start_ns, bucketStartTimeNs + NS_PER_SEC * 60 * 10 + 10);
+//    EXPECT_EQ(eventActivationMap[2]->ttl_ns, 60 * 2 * NS_PER_SEC);
+//
+//    // 4th processed event.
+//    event = CreateAppCrashEvent(666, bucketStartTimeNs + NS_PER_SEC * 60 * 11 + 1);
+//    processor.OnLogEvent(event.get(), bucketStartTimeNs + NS_PER_SEC * 60 * 11 + 1);
+//
+//    ConfigMetricsReportList reports;
+//    vector<uint8_t> buffer;
+//    processor.onDumpReport(cfgKey, bucketStartTimeNs + NS_PER_SEC * 60 * 15 + 1, false, true,
+//                            ADB_DUMP, FAST, &buffer);
+//    EXPECT_TRUE(buffer.size() > 0);
+//    EXPECT_TRUE(reports.ParseFromArray(&buffer[0], buffer.size()));
+//    backfillDimensionPath(&reports);
+//    backfillStartEndTimestamp(&reports);
+//    EXPECT_EQ(1, reports.reports_size());
+//    EXPECT_EQ(1, reports.reports(0).metrics_size());
+//    EXPECT_EQ(4, reports.reports(0).metrics(0).count_metrics().data_size());
+//
+//    StatsLogReport::CountMetricDataWrapper countMetrics;
+//    sortMetricDataByDimensionsValue(
+//            reports.reports(0).metrics(0).count_metrics(), &countMetrics);
+//    EXPECT_EQ(4, countMetrics.data_size());
+//
+//    auto data = countMetrics.data(0);
+//    EXPECT_EQ(android::util::PROCESS_LIFE_CYCLE_STATE_CHANGED, data.dimensions_in_what().field());
+//    EXPECT_EQ(1, data.dimensions_in_what().value_tuple().dimensions_value_size());
+//    EXPECT_EQ(1 /* uid field */,
+//              data.dimensions_in_what().value_tuple().dimensions_value(0).field());
+//    EXPECT_EQ(222, data.dimensions_in_what().value_tuple().dimensions_value(0).value_int());
+//    EXPECT_EQ(1, data.bucket_info_size());
+//    EXPECT_EQ(1, data.bucket_info(0).count());
+//    EXPECT_EQ(bucketStartTimeNs, data.bucket_info(0).start_bucket_elapsed_nanos());
+//    EXPECT_EQ(bucketStartTimeNs + bucketSizeNs, data.bucket_info(0).end_bucket_elapsed_nanos());
+//
+//    data = countMetrics.data(1);
+//    EXPECT_EQ(android::util::PROCESS_LIFE_CYCLE_STATE_CHANGED, data.dimensions_in_what().field());
+//    EXPECT_EQ(1, data.dimensions_in_what().value_tuple().dimensions_value_size());
+//    EXPECT_EQ(1 /* uid field */,
+//              data.dimensions_in_what().value_tuple().dimensions_value(0).field());
+//    EXPECT_EQ(333, data.dimensions_in_what().value_tuple().dimensions_value(0).value_int());
+//    EXPECT_EQ(1, data.bucket_info_size());
+//    EXPECT_EQ(1, data.bucket_info(0).count());
+//    EXPECT_EQ(bucketStartTimeNs, data.bucket_info(0).start_bucket_elapsed_nanos());
+//    EXPECT_EQ(bucketStartTimeNs + bucketSizeNs, data.bucket_info(0).end_bucket_elapsed_nanos());
+//
+//    data = countMetrics.data(2);
+//    EXPECT_EQ(android::util::PROCESS_LIFE_CYCLE_STATE_CHANGED, data.dimensions_in_what().field());
+//    EXPECT_EQ(1, data.dimensions_in_what().value_tuple().dimensions_value_size());
+//    EXPECT_EQ(1 /* uid field */,
+//              data.dimensions_in_what().value_tuple().dimensions_value(0).field());
+//    EXPECT_EQ(444, data.dimensions_in_what().value_tuple().dimensions_value(0).value_int());
+//    EXPECT_EQ(1, data.bucket_info_size());
+//    EXPECT_EQ(1, data.bucket_info(0).count());
+//    // Partial bucket as metric is deactivated.
+//    EXPECT_EQ(bucketStartTimeNs + bucketSizeNs, data.bucket_info(0).start_bucket_elapsed_nanos());
+//    EXPECT_EQ(bucketStartTimeNs + NS_PER_SEC * 60 * 8,
+//              data.bucket_info(0).end_bucket_elapsed_nanos());
+//
+//    data = countMetrics.data(3);
+//    EXPECT_EQ(android::util::PROCESS_LIFE_CYCLE_STATE_CHANGED, data.dimensions_in_what().field());
+//    EXPECT_EQ(1, data.dimensions_in_what().value_tuple().dimensions_value_size());
+//    EXPECT_EQ(1 /* uid field */,
+//              data.dimensions_in_what().value_tuple().dimensions_value(0).field());
+//    EXPECT_EQ(666, data.dimensions_in_what().value_tuple().dimensions_value(0).value_int());
+//    EXPECT_EQ(1, data.bucket_info_size());
+//    EXPECT_EQ(1, data.bucket_info(0).count());
+//    EXPECT_EQ(bucketStartTimeNs + 2 * bucketSizeNs,
+//              data.bucket_info(0).start_bucket_elapsed_nanos());
+//    EXPECT_EQ(bucketStartTimeNs + 3 * bucketSizeNs,
+//              data.bucket_info(0).end_bucket_elapsed_nanos());
+//}
+//
+//TEST(MetricActivationE2eTest, TestCountMetricWithOneDeactivation) {
+//    auto config = CreateStatsdConfigWithOneDeactivation();
+//
+//    int64_t bucketStartTimeNs = NS_PER_SEC * 10; // 10 secs
+//    int64_t bucketSizeNs =
+//            TimeUnitToBucketSizeInMillis(config.count_metric(0).bucket()) * 1000LL * 1000LL;
+//
+//    int uid = 12345;
+//    int64_t cfgId = 98765;
+//    ConfigKey cfgKey(uid, cfgId);
+//
+//    sp<UidMap> m = new UidMap();
+//    sp<StatsPullerManager> pullerManager = new StatsPullerManager();
+//    sp<AlarmMonitor> anomalyAlarmMonitor;
+//    sp<AlarmMonitor> subscriberAlarmMonitor;
+//    vector<int64_t> activeConfigsBroadcast;
+//
+//    long timeBase1 = 1;
+//    int broadcastCount = 0;
+//    StatsLogProcessor processor(m, pullerManager, anomalyAlarmMonitor, subscriberAlarmMonitor,
+//            bucketStartTimeNs, [](const ConfigKey& key) { return true; },
+//            [&uid, &broadcastCount, &activeConfigsBroadcast](const int& broadcastUid,
+//                    const vector<int64_t>& activeConfigs) {
+//                broadcastCount++;
+//                EXPECT_EQ(broadcastUid, uid);
+//                activeConfigsBroadcast.clear();
+//                activeConfigsBroadcast.insert(activeConfigsBroadcast.end(),
+//                        activeConfigs.begin(), activeConfigs.end());
+//                return true;
+//            });
+//
+//    processor.OnConfigUpdated(bucketStartTimeNs, cfgKey, config);
+//
+//    EXPECT_EQ(processor.mMetricsManagers.size(), 1u);
+//    sp<MetricsManager> metricsManager = processor.mMetricsManagers.begin()->second;
+//    EXPECT_TRUE(metricsManager->isConfigValid());
+//    EXPECT_EQ(metricsManager->mAllMetricProducers.size(), 1);
+//    sp<MetricProducer> metricProducer = metricsManager->mAllMetricProducers[0];
+//    auto& eventActivationMap = metricProducer->mEventActivationMap;
+//    auto& eventDeactivationMap = metricProducer->mEventDeactivationMap;
+//
+//    EXPECT_FALSE(metricsManager->isActive());
+//    EXPECT_FALSE(metricProducer->mIsActive);
+//    // Two activations: one is triggered by battery saver mode (tracker index 0), the other is
+//    // triggered by screen on event (tracker index 2).
+//    EXPECT_EQ(eventActivationMap.size(), 2u);
+//    EXPECT_TRUE(eventActivationMap.find(0) != eventActivationMap.end());
+//    EXPECT_TRUE(eventActivationMap.find(2) != eventActivationMap.end());
+//    EXPECT_EQ(eventActivationMap[0]->state, ActivationState::kNotActive);
+//    EXPECT_EQ(eventActivationMap[0]->start_ns, 0);
+//    EXPECT_EQ(eventActivationMap[0]->ttl_ns, 60 * 6 * NS_PER_SEC);
+//    EXPECT_EQ(eventActivationMap[2]->state, ActivationState::kNotActive);
+//    EXPECT_EQ(eventActivationMap[2]->start_ns, 0);
+//    EXPECT_EQ(eventActivationMap[2]->ttl_ns, 60 * 2 * NS_PER_SEC);
+//    EXPECT_EQ(eventDeactivationMap.size(), 1u);
+//    EXPECT_TRUE(eventDeactivationMap.find(3) != eventDeactivationMap.end());
+//    EXPECT_EQ(eventDeactivationMap[3].size(), 1u);
+//    EXPECT_EQ(eventDeactivationMap[3][0], eventActivationMap[0]);
+//
+//    std::unique_ptr<LogEvent> event;
+//
+//    event = CreateAppCrashEvent(111, bucketStartTimeNs + 5);
+//    processor.OnLogEvent(event.get(), bucketStartTimeNs + 5);
+//    EXPECT_FALSE(metricsManager->isActive());
+//    EXPECT_FALSE(metricProducer->mIsActive);
+//    EXPECT_EQ(broadcastCount, 0);
+//
+//    // Activated by battery save mode.
+//    event = CreateBatterySaverOnEvent(bucketStartTimeNs + 10);
+//    processor.OnLogEvent(event.get(), bucketStartTimeNs + 10);
+//    EXPECT_TRUE(metricsManager->isActive());
+//    EXPECT_TRUE(metricProducer->mIsActive);
+//    EXPECT_EQ(broadcastCount, 1);
+//    EXPECT_EQ(activeConfigsBroadcast.size(), 1);
+//    EXPECT_EQ(activeConfigsBroadcast[0], cfgId);
+//    EXPECT_EQ(eventActivationMap[0]->state, ActivationState::kActive);
+//    EXPECT_EQ(eventActivationMap[0]->start_ns, bucketStartTimeNs + 10);
+//    EXPECT_EQ(eventActivationMap[0]->ttl_ns, 60 * 6 * NS_PER_SEC);
+//    EXPECT_EQ(eventActivationMap[2]->state, ActivationState::kNotActive);
+//    EXPECT_EQ(eventActivationMap[2]->start_ns, 0);
+//    EXPECT_EQ(eventActivationMap[2]->ttl_ns, 60 * 2 * NS_PER_SEC);
+//    EXPECT_EQ(eventDeactivationMap[3][0], eventActivationMap[0]);
+//
+//    // First processed event.
+//    event = CreateAppCrashEvent(222, bucketStartTimeNs + 15);
+//    processor.OnLogEvent(event.get(), bucketStartTimeNs + 15);
+//
+//    // Activated by screen on event.
+//    event = CreateScreenStateChangedEvent(android::view::DISPLAY_STATE_ON,
+//                                          bucketStartTimeNs + 20);
+//    processor.OnLogEvent(event.get(), bucketStartTimeNs + 20);
+//    EXPECT_TRUE(metricsManager->isActive());
+//    EXPECT_TRUE(metricProducer->mIsActive);
+//    EXPECT_EQ(eventActivationMap[0]->state, ActivationState::kActive);
+//    EXPECT_EQ(eventActivationMap[0]->start_ns, bucketStartTimeNs + 10);
+//    EXPECT_EQ(eventActivationMap[0]->ttl_ns, 60 * 6 * NS_PER_SEC);
+//    EXPECT_EQ(eventActivationMap[2]->state, ActivationState::kActive);
+//    EXPECT_EQ(eventActivationMap[2]->start_ns, bucketStartTimeNs + 20);
+//    EXPECT_EQ(eventActivationMap[2]->ttl_ns, 60 * 2 * NS_PER_SEC);
+//    EXPECT_EQ(eventDeactivationMap[3][0], eventActivationMap[0]);
+//
+//    // 2nd processed event.
+//    // The activation by screen_on event expires, but the one by battery save mode is still active.
+//    event = CreateAppCrashEvent(333, bucketStartTimeNs + NS_PER_SEC * 60 * 2 + 25);
+//    processor.OnLogEvent(event.get(),bucketStartTimeNs + NS_PER_SEC * 60 * 2 + 25);
+//    EXPECT_TRUE(metricsManager->isActive());
+//    EXPECT_TRUE(metricProducer->mIsActive);
+//    EXPECT_EQ(eventActivationMap[0]->state, ActivationState::kActive);
+//    EXPECT_EQ(eventActivationMap[0]->start_ns, bucketStartTimeNs + 10);
+//    EXPECT_EQ(eventActivationMap[0]->ttl_ns, 60 * 6 * NS_PER_SEC);
+//    EXPECT_EQ(eventActivationMap[2]->state, ActivationState::kNotActive);
+//    EXPECT_EQ(eventActivationMap[2]->start_ns, bucketStartTimeNs + 20);
+//    EXPECT_EQ(eventActivationMap[2]->ttl_ns, 60 * 2 * NS_PER_SEC);
+//    EXPECT_EQ(eventDeactivationMap[3][0], eventActivationMap[0]);
+//    // No new broadcast since the config should still be active.
+//    EXPECT_EQ(broadcastCount, 1);
+//
+//    // 3rd processed event.
+//    event = CreateAppCrashEvent(444, bucketStartTimeNs + NS_PER_SEC * 60 * 5 + 25);
+//    processor.OnLogEvent(event.get(), bucketStartTimeNs + NS_PER_SEC * 60 * 5 + 25);
+//
+//    // All activations expired.
+//    event = CreateAppCrashEvent(555, bucketStartTimeNs + NS_PER_SEC * 60 * 8);
+//    processor.OnLogEvent(event.get(), bucketStartTimeNs + NS_PER_SEC * 60 * 8);
+//    EXPECT_FALSE(metricsManager->isActive());
+//    EXPECT_FALSE(metricProducer->mIsActive);
+//    // New broadcast since the config is no longer active.
+//    EXPECT_EQ(broadcastCount, 2);
+//    EXPECT_EQ(activeConfigsBroadcast.size(), 0);
+//    EXPECT_EQ(eventActivationMap[0]->state, ActivationState::kNotActive);
+//    EXPECT_EQ(eventActivationMap[0]->start_ns, bucketStartTimeNs + 10);
+//    EXPECT_EQ(eventActivationMap[0]->ttl_ns, 60 * 6 * NS_PER_SEC);
+//    EXPECT_EQ(eventActivationMap[2]->state, ActivationState::kNotActive);
+//    EXPECT_EQ(eventActivationMap[2]->start_ns, bucketStartTimeNs + 20);
+//    EXPECT_EQ(eventActivationMap[2]->ttl_ns, 60 * 2 * NS_PER_SEC);
+//    EXPECT_EQ(eventDeactivationMap[3][0], eventActivationMap[0]);
+//
+//    // Re-activate metric via screen on.
+//    event = CreateScreenStateChangedEvent(android::view::DISPLAY_STATE_ON,
+//                                          bucketStartTimeNs + NS_PER_SEC * 60 * 10 + 10);
+//    processor.OnLogEvent(event.get(), bucketStartTimeNs + NS_PER_SEC * 60 * 10 + 10);
+//    EXPECT_TRUE(metricsManager->isActive());
+//    EXPECT_TRUE(metricProducer->mIsActive);
+//    EXPECT_EQ(broadcastCount, 3);
+//    EXPECT_EQ(activeConfigsBroadcast.size(), 1);
+//    EXPECT_EQ(activeConfigsBroadcast[0], cfgId);
+//    EXPECT_EQ(eventActivationMap[0]->state, ActivationState::kNotActive);
+//    EXPECT_EQ(eventActivationMap[0]->start_ns, bucketStartTimeNs + 10);
+//    EXPECT_EQ(eventActivationMap[0]->ttl_ns, 60 * 6 * NS_PER_SEC);
+//    EXPECT_EQ(eventActivationMap[2]->state, ActivationState::kActive);
+//    EXPECT_EQ(eventActivationMap[2]->start_ns, bucketStartTimeNs + NS_PER_SEC * 60 * 10 + 10);
+//    EXPECT_EQ(eventActivationMap[2]->ttl_ns, 60 * 2 * NS_PER_SEC);
+//    EXPECT_EQ(eventDeactivationMap[3][0], eventActivationMap[0]);
+//
+//    // 4th processed event.
+//    event = CreateAppCrashEvent(666, bucketStartTimeNs + NS_PER_SEC * 60 * 11 + 1);
+//    processor.OnLogEvent(event.get(), bucketStartTimeNs + NS_PER_SEC * 60 * 11 + 1);
+//
+//    // Re-enable battery saver mode activation.
+//    event = CreateBatterySaverOnEvent(bucketStartTimeNs + NS_PER_SEC * 60 * 11 + 15);
+//    processor.OnLogEvent(event.get(), bucketStartTimeNs + NS_PER_SEC * 60 * 11 + 15);
+//    EXPECT_TRUE(metricsManager->isActive());
+//    EXPECT_TRUE(metricProducer->mIsActive);
+//    EXPECT_EQ(broadcastCount, 3);
+//    EXPECT_EQ(activeConfigsBroadcast.size(), 1);
+//    EXPECT_EQ(activeConfigsBroadcast[0], cfgId);
+//    EXPECT_EQ(eventActivationMap[0]->state, ActivationState::kActive);
+//    EXPECT_EQ(eventActivationMap[0]->start_ns, bucketStartTimeNs + NS_PER_SEC * 60 * 11 + 15);
+//    EXPECT_EQ(eventActivationMap[0]->ttl_ns, 60 * 6 * NS_PER_SEC);
+//    EXPECT_EQ(eventActivationMap[2]->state, ActivationState::kActive);
+//    EXPECT_EQ(eventActivationMap[2]->start_ns, bucketStartTimeNs + NS_PER_SEC * 60 * 10 + 10);
+//    EXPECT_EQ(eventActivationMap[2]->ttl_ns, 60 * 2 * NS_PER_SEC);
+//    EXPECT_EQ(eventDeactivationMap[3][0], eventActivationMap[0]);
+//
+//    // 5th processed event.
+//    event = CreateAppCrashEvent(777, bucketStartTimeNs + NS_PER_SEC * 60 * 11 + 40);
+//    processor.OnLogEvent(event.get(), bucketStartTimeNs + NS_PER_SEC * 60 * 11 + 40);
+//
+//    // Cancel battery saver mode activation.
+//    event = CreateScreenBrightnessChangedEvent(64, bucketStartTimeNs + NS_PER_SEC * 60 * 11 + 60);
+//    processor.OnLogEvent(event.get(), bucketStartTimeNs + NS_PER_SEC * 60 * 11 + 60);
+//    EXPECT_TRUE(metricsManager->isActive());
+//    EXPECT_TRUE(metricProducer->mIsActive);
+//    EXPECT_EQ(broadcastCount, 3);
+//    EXPECT_EQ(activeConfigsBroadcast.size(), 1);
+//    EXPECT_EQ(activeConfigsBroadcast[0], cfgId);
+//    EXPECT_EQ(eventActivationMap[0]->state, ActivationState::kNotActive);
+//    EXPECT_EQ(eventActivationMap[0]->start_ns, bucketStartTimeNs + NS_PER_SEC * 60 * 11 + 15);
+//    EXPECT_EQ(eventActivationMap[0]->ttl_ns, 60 * 6 * NS_PER_SEC);
+//    EXPECT_EQ(eventActivationMap[2]->state, ActivationState::kActive);
+//    EXPECT_EQ(eventActivationMap[2]->start_ns, bucketStartTimeNs + NS_PER_SEC * 60 * 10 + 10);
+//    EXPECT_EQ(eventActivationMap[2]->ttl_ns, 60 * 2 * NS_PER_SEC);
+//    EXPECT_EQ(eventDeactivationMap[3][0], eventActivationMap[0]);
+//
+//    // Screen-on activation expired.
+//    event = CreateAppCrashEvent(888, bucketStartTimeNs + NS_PER_SEC * 60 * 13);
+//    processor.OnLogEvent(event.get(), bucketStartTimeNs + NS_PER_SEC * 60 * 13);
+//    EXPECT_FALSE(metricsManager->isActive());
+//    EXPECT_FALSE(metricProducer->mIsActive);
+//    // New broadcast since the config is no longer active.
+//    EXPECT_EQ(broadcastCount, 4);
+//    EXPECT_EQ(activeConfigsBroadcast.size(), 0);
+//    EXPECT_EQ(eventActivationMap[0]->state, ActivationState::kNotActive);
+//    EXPECT_EQ(eventActivationMap[0]->start_ns, bucketStartTimeNs + NS_PER_SEC * 60 * 11 + 15);
+//    EXPECT_EQ(eventActivationMap[0]->ttl_ns, 60 * 6 * NS_PER_SEC);
+//    EXPECT_EQ(eventActivationMap[2]->state, ActivationState::kNotActive);
+//    EXPECT_EQ(eventActivationMap[2]->start_ns, bucketStartTimeNs + NS_PER_SEC * 60 * 10 + 10);
+//    EXPECT_EQ(eventActivationMap[2]->ttl_ns, 60 * 2 * NS_PER_SEC);
+//    EXPECT_EQ(eventDeactivationMap[3][0], eventActivationMap[0]);
+//
+//    event = CreateAppCrashEvent(999, bucketStartTimeNs + NS_PER_SEC * 60 * 14 + 1);
+//    processor.OnLogEvent(event.get(), bucketStartTimeNs + NS_PER_SEC * 60 * 14 + 1);
+//
+//    // Re-enable battery saver mode activation.
+//    event = CreateBatterySaverOnEvent(bucketStartTimeNs + NS_PER_SEC * 60 * 15 + 15);
+//    processor.OnLogEvent(event.get(), bucketStartTimeNs + NS_PER_SEC * 60 * 15 + 15);
+//    EXPECT_TRUE(metricsManager->isActive());
+//    EXPECT_TRUE(metricProducer->mIsActive);
+//    EXPECT_EQ(broadcastCount, 5);
+//    EXPECT_EQ(activeConfigsBroadcast.size(), 1);
+//    EXPECT_EQ(activeConfigsBroadcast[0], cfgId);
+//    EXPECT_EQ(eventActivationMap[0]->state, ActivationState::kActive);
+//    EXPECT_EQ(eventActivationMap[0]->start_ns, bucketStartTimeNs + NS_PER_SEC * 60 * 15 + 15);
+//    EXPECT_EQ(eventActivationMap[0]->ttl_ns, 60 * 6 * NS_PER_SEC);
+//    EXPECT_EQ(eventActivationMap[2]->state, ActivationState::kNotActive);
+//    EXPECT_EQ(eventActivationMap[2]->start_ns, bucketStartTimeNs + NS_PER_SEC * 60 * 10 + 10);
+//    EXPECT_EQ(eventActivationMap[2]->ttl_ns, 60 * 2 * NS_PER_SEC);
+//    EXPECT_EQ(eventDeactivationMap[3][0], eventActivationMap[0]);
+//
+//    // Cancel battery saver mode activation.
+//    event = CreateScreenBrightnessChangedEvent(140, bucketStartTimeNs + NS_PER_SEC * 60 * 16);
+//    processor.OnLogEvent(event.get(), bucketStartTimeNs + NS_PER_SEC * 60 * 16);
+//    EXPECT_FALSE(metricsManager->isActive());
+//    EXPECT_FALSE(metricProducer->mIsActive);
+//    EXPECT_EQ(broadcastCount, 6);
+//    EXPECT_EQ(activeConfigsBroadcast.size(), 0);
+//    EXPECT_EQ(eventActivationMap[0]->state, ActivationState::kNotActive);
+//    EXPECT_EQ(eventActivationMap[0]->start_ns, bucketStartTimeNs + NS_PER_SEC * 60 * 15 + 15);
+//    EXPECT_EQ(eventActivationMap[0]->ttl_ns, 60 * 6 * NS_PER_SEC);
+//    EXPECT_EQ(eventActivationMap[2]->state, ActivationState::kNotActive);
+//    EXPECT_EQ(eventActivationMap[2]->start_ns, bucketStartTimeNs + NS_PER_SEC * 60 * 10 + 10);
+//    EXPECT_EQ(eventActivationMap[2]->ttl_ns, 60 * 2 * NS_PER_SEC);
+//    EXPECT_EQ(eventDeactivationMap[3][0], eventActivationMap[0]);
+//
+//    ConfigMetricsReportList reports;
+//    vector<uint8_t> buffer;
+//    processor.onDumpReport(cfgKey, bucketStartTimeNs + NS_PER_SEC * 60 * 15 + 1, false, true,
+//                            ADB_DUMP, FAST, &buffer);
+//    EXPECT_TRUE(buffer.size() > 0);
+//    EXPECT_TRUE(reports.ParseFromArray(&buffer[0], buffer.size()));
+//    backfillDimensionPath(&reports);
+//    backfillStartEndTimestamp(&reports);
+//    EXPECT_EQ(1, reports.reports_size());
+//    EXPECT_EQ(1, reports.reports(0).metrics_size());
+//    EXPECT_EQ(5, reports.reports(0).metrics(0).count_metrics().data_size());
+//
+//    StatsLogReport::CountMetricDataWrapper countMetrics;
+//    sortMetricDataByDimensionsValue(
+//            reports.reports(0).metrics(0).count_metrics(), &countMetrics);
+//    EXPECT_EQ(5, countMetrics.data_size());
+//
+//    auto data = countMetrics.data(0);
+//    EXPECT_EQ(android::util::PROCESS_LIFE_CYCLE_STATE_CHANGED, data.dimensions_in_what().field());
+//    EXPECT_EQ(1, data.dimensions_in_what().value_tuple().dimensions_value_size());
+//    EXPECT_EQ(1 /* uid field */,
+//              data.dimensions_in_what().value_tuple().dimensions_value(0).field());
+//    EXPECT_EQ(222, data.dimensions_in_what().value_tuple().dimensions_value(0).value_int());
+//    EXPECT_EQ(1, data.bucket_info_size());
+//    EXPECT_EQ(1, data.bucket_info(0).count());
+//    EXPECT_EQ(bucketStartTimeNs, data.bucket_info(0).start_bucket_elapsed_nanos());
+//    EXPECT_EQ(bucketStartTimeNs + bucketSizeNs, data.bucket_info(0).end_bucket_elapsed_nanos());
+//
+//    data = countMetrics.data(1);
+//    EXPECT_EQ(android::util::PROCESS_LIFE_CYCLE_STATE_CHANGED, data.dimensions_in_what().field());
+//    EXPECT_EQ(1, data.dimensions_in_what().value_tuple().dimensions_value_size());
+//    EXPECT_EQ(1 /* uid field */,
+//              data.dimensions_in_what().value_tuple().dimensions_value(0).field());
+//    EXPECT_EQ(333, data.dimensions_in_what().value_tuple().dimensions_value(0).value_int());
+//    EXPECT_EQ(1, data.bucket_info_size());
+//    EXPECT_EQ(1, data.bucket_info(0).count());
+//    EXPECT_EQ(bucketStartTimeNs, data.bucket_info(0).start_bucket_elapsed_nanos());
+//    EXPECT_EQ(bucketStartTimeNs + bucketSizeNs, data.bucket_info(0).end_bucket_elapsed_nanos());
+//
+//    data = countMetrics.data(2);
+//    EXPECT_EQ(android::util::PROCESS_LIFE_CYCLE_STATE_CHANGED, data.dimensions_in_what().field());
+//    EXPECT_EQ(1, data.dimensions_in_what().value_tuple().dimensions_value_size());
+//    EXPECT_EQ(1 /* uid field */,
+//              data.dimensions_in_what().value_tuple().dimensions_value(0).field());
+//    EXPECT_EQ(444, data.dimensions_in_what().value_tuple().dimensions_value(0).value_int());
+//    EXPECT_EQ(1, data.bucket_info_size());
+//    EXPECT_EQ(1, data.bucket_info(0).count());
+//    // Partial bucket as metric is deactivated.
+//    EXPECT_EQ(bucketStartTimeNs + bucketSizeNs, data.bucket_info(0).start_bucket_elapsed_nanos());
+//    EXPECT_EQ(bucketStartTimeNs + NS_PER_SEC * 60 * 8,
+//              data.bucket_info(0).end_bucket_elapsed_nanos());
+//
+//    data = countMetrics.data(3);
+//    EXPECT_EQ(android::util::PROCESS_LIFE_CYCLE_STATE_CHANGED, data.dimensions_in_what().field());
+//    EXPECT_EQ(1, data.dimensions_in_what().value_tuple().dimensions_value_size());
+//    EXPECT_EQ(1 /* uid field */,
+//              data.dimensions_in_what().value_tuple().dimensions_value(0).field());
+//    EXPECT_EQ(666, data.dimensions_in_what().value_tuple().dimensions_value(0).value_int());
+//    EXPECT_EQ(1, data.bucket_info_size());
+//    EXPECT_EQ(1, data.bucket_info(0).count());
+//    EXPECT_EQ(bucketStartTimeNs + 2 * bucketSizeNs,
+//              data.bucket_info(0).start_bucket_elapsed_nanos());
+//    EXPECT_EQ(bucketStartTimeNs + NS_PER_SEC * 60 * 13,
+//              data.bucket_info(0).end_bucket_elapsed_nanos());
+//
+//    data = countMetrics.data(4);
+//    EXPECT_EQ(android::util::PROCESS_LIFE_CYCLE_STATE_CHANGED, data.dimensions_in_what().field());
+//    EXPECT_EQ(1, data.dimensions_in_what().value_tuple().dimensions_value_size());
+//    EXPECT_EQ(1 /* uid field */,
+//              data.dimensions_in_what().value_tuple().dimensions_value(0).field());
+//    EXPECT_EQ(777, data.dimensions_in_what().value_tuple().dimensions_value(0).value_int());
+//    EXPECT_EQ(1, data.bucket_info_size());
+//    EXPECT_EQ(1, data.bucket_info(0).count());
+//    EXPECT_EQ(bucketStartTimeNs + 2 * bucketSizeNs,
+//              data.bucket_info(0).start_bucket_elapsed_nanos());
+//    EXPECT_EQ(bucketStartTimeNs + NS_PER_SEC * 60 * 13,
+//              data.bucket_info(0).end_bucket_elapsed_nanos());
+//}
+//
+//TEST(MetricActivationE2eTest, TestCountMetricWithTwoDeactivations) {
+//    auto config = CreateStatsdConfigWithTwoDeactivations();
+//
+//    int64_t bucketStartTimeNs = NS_PER_SEC * 10; // 10 secs
+//    int64_t bucketSizeNs =
+//            TimeUnitToBucketSizeInMillis(config.count_metric(0).bucket()) * 1000LL * 1000LL;
+//
+//    int uid = 12345;
+//    int64_t cfgId = 98765;
+//    ConfigKey cfgKey(uid, cfgId);
+//
+//    sp<UidMap> m = new UidMap();
+//    sp<StatsPullerManager> pullerManager = new StatsPullerManager();
+//    sp<AlarmMonitor> anomalyAlarmMonitor;
+//    sp<AlarmMonitor> subscriberAlarmMonitor;
+//    vector<int64_t> activeConfigsBroadcast;
+//
+//    long timeBase1 = 1;
+//    int broadcastCount = 0;
+//    StatsLogProcessor processor(m, pullerManager, anomalyAlarmMonitor, subscriberAlarmMonitor,
+//            bucketStartTimeNs, [](const ConfigKey& key) { return true; },
+//            [&uid, &broadcastCount, &activeConfigsBroadcast](const int& broadcastUid,
+//                    const vector<int64_t>& activeConfigs) {
+//                broadcastCount++;
+//                EXPECT_EQ(broadcastUid, uid);
+//                activeConfigsBroadcast.clear();
+//                activeConfigsBroadcast.insert(activeConfigsBroadcast.end(),
+//                        activeConfigs.begin(), activeConfigs.end());
+//                return true;
+//            });
+//
+//    processor.OnConfigUpdated(bucketStartTimeNs, cfgKey, config);
+//
+//    EXPECT_EQ(processor.mMetricsManagers.size(), 1u);
+//    sp<MetricsManager> metricsManager = processor.mMetricsManagers.begin()->second;
+//    EXPECT_TRUE(metricsManager->isConfigValid());
+//    EXPECT_EQ(metricsManager->mAllMetricProducers.size(), 1);
+//    sp<MetricProducer> metricProducer = metricsManager->mAllMetricProducers[0];
+//    auto& eventActivationMap = metricProducer->mEventActivationMap;
+//    auto& eventDeactivationMap = metricProducer->mEventDeactivationMap;
+//
+//    EXPECT_FALSE(metricsManager->isActive());
+//    EXPECT_FALSE(metricProducer->mIsActive);
+//    // Two activations: one is triggered by battery saver mode (tracker index 0), the other is
+//    // triggered by screen on event (tracker index 2).
+//    EXPECT_EQ(eventActivationMap.size(), 2u);
+//    EXPECT_TRUE(eventActivationMap.find(0) != eventActivationMap.end());
+//    EXPECT_TRUE(eventActivationMap.find(2) != eventActivationMap.end());
+//    EXPECT_EQ(eventActivationMap[0]->state, ActivationState::kNotActive);
+//    EXPECT_EQ(eventActivationMap[0]->start_ns, 0);
+//    EXPECT_EQ(eventActivationMap[0]->ttl_ns, 60 * 6 * NS_PER_SEC);
+//    EXPECT_EQ(eventActivationMap[2]->state, ActivationState::kNotActive);
+//    EXPECT_EQ(eventActivationMap[2]->start_ns, 0);
+//    EXPECT_EQ(eventActivationMap[2]->ttl_ns, 60 * 2 * NS_PER_SEC);
+//    EXPECT_EQ(eventDeactivationMap.size(), 2u);
+//    EXPECT_TRUE(eventDeactivationMap.find(3) != eventDeactivationMap.end());
+//    EXPECT_TRUE(eventDeactivationMap.find(4) != eventDeactivationMap.end());
+//    EXPECT_EQ(eventDeactivationMap[3].size(), 1u);
+//    EXPECT_EQ(eventDeactivationMap[4].size(), 1u);
+//    EXPECT_EQ(eventDeactivationMap[3][0], eventActivationMap[0]);
+//    EXPECT_EQ(eventDeactivationMap[4][0], eventActivationMap[2]);
+//
+//    std::unique_ptr<LogEvent> event;
+//
+//    event = CreateAppCrashEvent(111, bucketStartTimeNs + 5);
+//    processor.OnLogEvent(event.get(), bucketStartTimeNs + 5);
+//    EXPECT_FALSE(metricsManager->isActive());
+//    EXPECT_FALSE(metricProducer->mIsActive);
+//    EXPECT_EQ(broadcastCount, 0);
+//
+//    // Activated by battery save mode.
+//    event = CreateBatterySaverOnEvent(bucketStartTimeNs + 10);
+//    processor.OnLogEvent(event.get(), bucketStartTimeNs + 10);
+//    EXPECT_TRUE(metricsManager->isActive());
+//    EXPECT_TRUE(metricProducer->mIsActive);
+//    EXPECT_EQ(broadcastCount, 1);
+//    EXPECT_EQ(activeConfigsBroadcast.size(), 1);
+//    EXPECT_EQ(activeConfigsBroadcast[0], cfgId);
+//    EXPECT_EQ(eventActivationMap[0]->state, ActivationState::kActive);
+//    EXPECT_EQ(eventActivationMap[0]->start_ns, bucketStartTimeNs + 10);
+//    EXPECT_EQ(eventActivationMap[0]->ttl_ns, 60 * 6 * NS_PER_SEC);
+//    EXPECT_EQ(eventActivationMap[2]->state, ActivationState::kNotActive);
+//    EXPECT_EQ(eventActivationMap[2]->start_ns, 0);
+//    EXPECT_EQ(eventActivationMap[2]->ttl_ns, 60 * 2 * NS_PER_SEC);
+//    EXPECT_EQ(eventDeactivationMap[3][0], eventActivationMap[0]);
+//    EXPECT_EQ(eventDeactivationMap[4][0], eventActivationMap[2]);
+//
+//    // First processed event.
+//    event = CreateAppCrashEvent(222, bucketStartTimeNs + 15);
+//    processor.OnLogEvent(event.get(), bucketStartTimeNs + 15);
+//
+//    // Activated by screen on event.
+//    event = CreateScreenStateChangedEvent(android::view::DISPLAY_STATE_ON,
+//                                          bucketStartTimeNs + 20);
+//    processor.OnLogEvent(event.get(), bucketStartTimeNs + 20);
+//    EXPECT_TRUE(metricsManager->isActive());
+//    EXPECT_TRUE(metricProducer->mIsActive);
+//    EXPECT_EQ(eventActivationMap[0]->state, ActivationState::kActive);
+//    EXPECT_EQ(eventActivationMap[0]->start_ns, bucketStartTimeNs + 10);
+//    EXPECT_EQ(eventActivationMap[0]->ttl_ns, 60 * 6 * NS_PER_SEC);
+//    EXPECT_EQ(eventActivationMap[2]->state, ActivationState::kActive);
+//    EXPECT_EQ(eventActivationMap[2]->start_ns, bucketStartTimeNs + 20);
+//    EXPECT_EQ(eventActivationMap[2]->ttl_ns, 60 * 2 * NS_PER_SEC);
+//    EXPECT_EQ(eventDeactivationMap[3][0], eventActivationMap[0]);
+//    EXPECT_EQ(eventDeactivationMap[4][0], eventActivationMap[2]);
+//
+//    // 2nd processed event.
+//    // The activation by screen_on event expires, but the one by battery save mode is still active.
+//    event = CreateAppCrashEvent(333, bucketStartTimeNs + NS_PER_SEC * 60 * 2 + 25);
+//    processor.OnLogEvent(event.get(), bucketStartTimeNs + NS_PER_SEC * 60 * 2 + 25);
+//    EXPECT_TRUE(metricsManager->isActive());
+//    EXPECT_TRUE(metricProducer->mIsActive);
+//    EXPECT_EQ(eventActivationMap[0]->state, ActivationState::kActive);
+//    EXPECT_EQ(eventActivationMap[0]->start_ns, bucketStartTimeNs + 10);
+//    EXPECT_EQ(eventActivationMap[0]->ttl_ns, 60 * 6 * NS_PER_SEC);
+//    EXPECT_EQ(eventActivationMap[2]->state, ActivationState::kNotActive);
+//    EXPECT_EQ(eventActivationMap[2]->start_ns, bucketStartTimeNs + 20);
+//    EXPECT_EQ(eventActivationMap[2]->ttl_ns, 60 * 2 * NS_PER_SEC);
+//    EXPECT_EQ(eventDeactivationMap[3][0], eventActivationMap[0]);
+//    EXPECT_EQ(eventDeactivationMap[4][0], eventActivationMap[2]);
+//    // No new broadcast since the config should still be active.
+//    EXPECT_EQ(broadcastCount, 1);
+//
+//    // 3rd processed event.
+//    event = CreateAppCrashEvent(444, bucketStartTimeNs + NS_PER_SEC * 60 * 5 + 25);
+//    processor.OnLogEvent(event.get(), bucketStartTimeNs + NS_PER_SEC * 60 * 5 + 25);
+//
+//    // All activations expired.
+//    event = CreateAppCrashEvent(555, bucketStartTimeNs + NS_PER_SEC * 60 * 8);
+//    processor.OnLogEvent(event.get(), bucketStartTimeNs + NS_PER_SEC * 60 * 8);
+//    EXPECT_FALSE(metricsManager->isActive());
+//    EXPECT_FALSE(metricProducer->mIsActive);
+//    // New broadcast since the config is no longer active.
+//    EXPECT_EQ(broadcastCount, 2);
+//    EXPECT_EQ(activeConfigsBroadcast.size(), 0);
+//    EXPECT_EQ(eventActivationMap[0]->state, ActivationState::kNotActive);
+//    EXPECT_EQ(eventActivationMap[0]->start_ns, bucketStartTimeNs + 10);
+//    EXPECT_EQ(eventActivationMap[0]->ttl_ns, 60 * 6 * NS_PER_SEC);
+//    EXPECT_EQ(eventActivationMap[2]->state, ActivationState::kNotActive);
+//    EXPECT_EQ(eventActivationMap[2]->start_ns, bucketStartTimeNs + 20);
+//    EXPECT_EQ(eventActivationMap[2]->ttl_ns, 60 * 2 * NS_PER_SEC);
+//    EXPECT_EQ(eventDeactivationMap[3][0], eventActivationMap[0]);
+//    EXPECT_EQ(eventDeactivationMap[4][0], eventActivationMap[2]);
+//
+//    // Re-activate metric via screen on.
+//    event = CreateScreenStateChangedEvent(android::view::DISPLAY_STATE_ON,
+//                                          bucketStartTimeNs + NS_PER_SEC * 60 * 10 + 10);
+//    processor.OnLogEvent(event.get(), bucketStartTimeNs + NS_PER_SEC * 60 * 10 + 10);
+//    EXPECT_TRUE(metricsManager->isActive());
+//    EXPECT_TRUE(metricProducer->mIsActive);
+//    EXPECT_EQ(broadcastCount, 3);
+//    EXPECT_EQ(activeConfigsBroadcast.size(), 1);
+//    EXPECT_EQ(activeConfigsBroadcast[0], cfgId);
+//    EXPECT_EQ(eventActivationMap[0]->state, ActivationState::kNotActive);
+//    EXPECT_EQ(eventActivationMap[0]->start_ns, bucketStartTimeNs + 10);
+//    EXPECT_EQ(eventActivationMap[0]->ttl_ns, 60 * 6 * NS_PER_SEC);
+//    EXPECT_EQ(eventActivationMap[2]->state, ActivationState::kActive);
+//    EXPECT_EQ(eventActivationMap[2]->start_ns, bucketStartTimeNs + NS_PER_SEC * 60 * 10 + 10);
+//    EXPECT_EQ(eventActivationMap[2]->ttl_ns, 60 * 2 * NS_PER_SEC);
+//    EXPECT_EQ(eventDeactivationMap[3][0], eventActivationMap[0]);
+//    EXPECT_EQ(eventDeactivationMap[4][0], eventActivationMap[2]);
+//
+//    // 4th processed event.
+//    event = CreateAppCrashEvent(666, bucketStartTimeNs + NS_PER_SEC * 60 * 11 + 1);
+//    processor.OnLogEvent(event.get(), bucketStartTimeNs + NS_PER_SEC * 60 * 11 + 1);
+//
+//    // Re-enable battery saver mode activation.
+//    event = CreateBatterySaverOnEvent(bucketStartTimeNs + NS_PER_SEC * 60 * 11 + 15);
+//    processor.OnLogEvent(event.get(), bucketStartTimeNs + NS_PER_SEC * 60 * 11 + 15);
+//    EXPECT_TRUE(metricsManager->isActive());
+//    EXPECT_TRUE(metricProducer->mIsActive);
+//    EXPECT_EQ(broadcastCount, 3);
+//    EXPECT_EQ(activeConfigsBroadcast.size(), 1);
+//    EXPECT_EQ(activeConfigsBroadcast[0], cfgId);
+//    EXPECT_EQ(eventActivationMap[0]->state, ActivationState::kActive);
+//    EXPECT_EQ(eventActivationMap[0]->start_ns, bucketStartTimeNs + NS_PER_SEC * 60 * 11 + 15);
+//    EXPECT_EQ(eventActivationMap[0]->ttl_ns, 60 * 6 * NS_PER_SEC);
+//    EXPECT_EQ(eventActivationMap[2]->state, ActivationState::kActive);
+//    EXPECT_EQ(eventActivationMap[2]->start_ns, bucketStartTimeNs + NS_PER_SEC * 60 * 10 + 10);
+//    EXPECT_EQ(eventActivationMap[2]->ttl_ns, 60 * 2 * NS_PER_SEC);
+//    EXPECT_EQ(eventDeactivationMap[3][0], eventActivationMap[0]);
+//    EXPECT_EQ(eventDeactivationMap[4][0], eventActivationMap[2]);
+//
+//    // 5th processed event.
+//    event = CreateAppCrashEvent(777, bucketStartTimeNs + NS_PER_SEC * 60 * 11 + 40);
+//    processor.OnLogEvent(event.get(), bucketStartTimeNs + NS_PER_SEC * 60 * 11 + 40);
+//
+//    // Cancel battery saver mode and screen on activation.
+//    event = CreateScreenBrightnessChangedEvent(64, bucketStartTimeNs + NS_PER_SEC * 60 * 11 + 60);
+//    processor.OnLogEvent(event.get(), bucketStartTimeNs + NS_PER_SEC * 60 * 11 + 60);
+//    EXPECT_FALSE(metricsManager->isActive());
+//    EXPECT_FALSE(metricProducer->mIsActive);
+//    // New broadcast since the config is no longer active.
+//    EXPECT_EQ(broadcastCount, 4);
+//    EXPECT_EQ(activeConfigsBroadcast.size(), 0);
+//    EXPECT_EQ(eventActivationMap[0]->state, ActivationState::kNotActive);
+//    EXPECT_EQ(eventActivationMap[0]->start_ns, bucketStartTimeNs + NS_PER_SEC * 60 * 11 + 15);
+//    EXPECT_EQ(eventActivationMap[0]->ttl_ns, 60 * 6 * NS_PER_SEC);
+//    EXPECT_EQ(eventActivationMap[2]->state, ActivationState::kNotActive);
+//    EXPECT_EQ(eventActivationMap[2]->start_ns, bucketStartTimeNs + NS_PER_SEC * 60 * 10 + 10);
+//    EXPECT_EQ(eventActivationMap[2]->ttl_ns, 60 * 2 * NS_PER_SEC);
+//    EXPECT_EQ(eventDeactivationMap[3][0], eventActivationMap[0]);
+//    EXPECT_EQ(eventDeactivationMap[4][0], eventActivationMap[2]);
+//
+//    // Screen-on activation expired.
+//    event = CreateAppCrashEvent(888, bucketStartTimeNs + NS_PER_SEC * 60 * 13);
+//    processor.OnLogEvent(event.get(), bucketStartTimeNs + NS_PER_SEC * 60 * 13);
+//    EXPECT_FALSE(metricsManager->isActive());
+//    EXPECT_FALSE(metricProducer->mIsActive);
+//    EXPECT_EQ(broadcastCount, 4);
+//    EXPECT_EQ(activeConfigsBroadcast.size(), 0);
+//    EXPECT_EQ(eventActivationMap[0]->state, ActivationState::kNotActive);
+//    EXPECT_EQ(eventActivationMap[0]->start_ns, bucketStartTimeNs + NS_PER_SEC * 60 * 11 + 15);
+//    EXPECT_EQ(eventActivationMap[0]->ttl_ns, 60 * 6 * NS_PER_SEC);
+//    EXPECT_EQ(eventActivationMap[2]->state, ActivationState::kNotActive);
+//    EXPECT_EQ(eventActivationMap[2]->start_ns, bucketStartTimeNs + NS_PER_SEC * 60 * 10 + 10);
+//    EXPECT_EQ(eventActivationMap[2]->ttl_ns, 60 * 2 * NS_PER_SEC);
+//    EXPECT_EQ(eventDeactivationMap[3][0], eventActivationMap[0]);
+//    EXPECT_EQ(eventDeactivationMap[4][0], eventActivationMap[2]);
+//
+//    event = CreateAppCrashEvent(999, bucketStartTimeNs + NS_PER_SEC * 60 * 14 + 1);
+//    processor.OnLogEvent(event.get(), bucketStartTimeNs + NS_PER_SEC * 60 * 14 + 1);
+//
+//    // Re-enable battery saver mode activation.
+//    event = CreateBatterySaverOnEvent(bucketStartTimeNs + NS_PER_SEC * 60 * 15 + 15);
+//    processor.OnLogEvent(event.get(), bucketStartTimeNs + NS_PER_SEC * 60 * 15 + 15);
+//    EXPECT_TRUE(metricsManager->isActive());
+//    EXPECT_TRUE(metricProducer->mIsActive);
+//    EXPECT_EQ(broadcastCount, 5);
+//    EXPECT_EQ(activeConfigsBroadcast.size(), 1);
+//    EXPECT_EQ(activeConfigsBroadcast[0], cfgId);
+//    EXPECT_EQ(eventActivationMap[0]->state, ActivationState::kActive);
+//    EXPECT_EQ(eventActivationMap[0]->start_ns, bucketStartTimeNs + NS_PER_SEC * 60 * 15 + 15);
+//    EXPECT_EQ(eventActivationMap[0]->ttl_ns, 60 * 6 * NS_PER_SEC);
+//    EXPECT_EQ(eventActivationMap[2]->state, ActivationState::kNotActive);
+//    EXPECT_EQ(eventActivationMap[2]->start_ns, bucketStartTimeNs + NS_PER_SEC * 60 * 10 + 10);
+//    EXPECT_EQ(eventActivationMap[2]->ttl_ns, 60 * 2 * NS_PER_SEC);
+//    EXPECT_EQ(eventDeactivationMap[3][0], eventActivationMap[0]);
+//    EXPECT_EQ(eventDeactivationMap[4][0], eventActivationMap[2]);
+//
+//    // Cancel battery saver mode and screen on activation.
+//    event = CreateScreenBrightnessChangedEvent(140, bucketStartTimeNs + NS_PER_SEC * 60 * 16);
+//    processor.OnLogEvent(event.get(), bucketStartTimeNs + NS_PER_SEC * 60 * 16);
+//    EXPECT_FALSE(metricsManager->isActive());
+//    EXPECT_FALSE(metricProducer->mIsActive);
+//    EXPECT_EQ(broadcastCount, 6);
+//    EXPECT_EQ(activeConfigsBroadcast.size(), 0);
+//    EXPECT_EQ(eventActivationMap[0]->state, ActivationState::kNotActive);
+//    EXPECT_EQ(eventActivationMap[0]->start_ns, bucketStartTimeNs + NS_PER_SEC * 60 * 15 + 15);
+//    EXPECT_EQ(eventActivationMap[0]->ttl_ns, 60 * 6 * NS_PER_SEC);
+//    EXPECT_EQ(eventActivationMap[2]->state, ActivationState::kNotActive);
+//    EXPECT_EQ(eventActivationMap[2]->start_ns, bucketStartTimeNs + NS_PER_SEC * 60 * 10 + 10);
+//    EXPECT_EQ(eventActivationMap[2]->ttl_ns, 60 * 2 * NS_PER_SEC);
+//    EXPECT_EQ(eventDeactivationMap[3][0], eventActivationMap[0]);
+//    EXPECT_EQ(eventDeactivationMap[4][0], eventActivationMap[2]);
+//
+//    ConfigMetricsReportList reports;
+//    vector<uint8_t> buffer;
+//    processor.onDumpReport(cfgKey, bucketStartTimeNs + NS_PER_SEC * 60 * 15 + 1, false, true,
+//                            ADB_DUMP, FAST, &buffer);
+//    EXPECT_TRUE(buffer.size() > 0);
+//    EXPECT_TRUE(reports.ParseFromArray(&buffer[0], buffer.size()));
+//    backfillDimensionPath(&reports);
+//    backfillStartEndTimestamp(&reports);
+//    EXPECT_EQ(1, reports.reports_size());
+//    EXPECT_EQ(1, reports.reports(0).metrics_size());
+//    EXPECT_EQ(5, reports.reports(0).metrics(0).count_metrics().data_size());
+//
+//    StatsLogReport::CountMetricDataWrapper countMetrics;
+//    sortMetricDataByDimensionsValue(
+//            reports.reports(0).metrics(0).count_metrics(), &countMetrics);
+//    EXPECT_EQ(5, countMetrics.data_size());
+//
+//    auto data = countMetrics.data(0);
+//    EXPECT_EQ(android::util::PROCESS_LIFE_CYCLE_STATE_CHANGED, data.dimensions_in_what().field());
+//    EXPECT_EQ(1, data.dimensions_in_what().value_tuple().dimensions_value_size());
+//    EXPECT_EQ(1 /* uid field */,
+//              data.dimensions_in_what().value_tuple().dimensions_value(0).field());
+//    EXPECT_EQ(222, data.dimensions_in_what().value_tuple().dimensions_value(0).value_int());
+//    EXPECT_EQ(1, data.bucket_info_size());
+//    EXPECT_EQ(1, data.bucket_info(0).count());
+//    EXPECT_EQ(bucketStartTimeNs, data.bucket_info(0).start_bucket_elapsed_nanos());
+//    EXPECT_EQ(bucketStartTimeNs + bucketSizeNs, data.bucket_info(0).end_bucket_elapsed_nanos());
+//
+//    data = countMetrics.data(1);
+//    EXPECT_EQ(android::util::PROCESS_LIFE_CYCLE_STATE_CHANGED, data.dimensions_in_what().field());
+//    EXPECT_EQ(1, data.dimensions_in_what().value_tuple().dimensions_value_size());
+//    EXPECT_EQ(1 /* uid field */,
+//              data.dimensions_in_what().value_tuple().dimensions_value(0).field());
+//    EXPECT_EQ(333, data.dimensions_in_what().value_tuple().dimensions_value(0).value_int());
+//    EXPECT_EQ(1, data.bucket_info_size());
+//    EXPECT_EQ(1, data.bucket_info(0).count());
+//    EXPECT_EQ(bucketStartTimeNs, data.bucket_info(0).start_bucket_elapsed_nanos());
+//    EXPECT_EQ(bucketStartTimeNs + bucketSizeNs, data.bucket_info(0).end_bucket_elapsed_nanos());
+//
+//    data = countMetrics.data(2);
+//    EXPECT_EQ(android::util::PROCESS_LIFE_CYCLE_STATE_CHANGED, data.dimensions_in_what().field());
+//    EXPECT_EQ(1, data.dimensions_in_what().value_tuple().dimensions_value_size());
+//    EXPECT_EQ(1 /* uid field */,
+//              data.dimensions_in_what().value_tuple().dimensions_value(0).field());
+//    EXPECT_EQ(444, data.dimensions_in_what().value_tuple().dimensions_value(0).value_int());
+//    EXPECT_EQ(1, data.bucket_info_size());
+//    EXPECT_EQ(1, data.bucket_info(0).count());
+//    // Partial bucket as metric is deactivated.
+//    EXPECT_EQ(bucketStartTimeNs + bucketSizeNs, data.bucket_info(0).start_bucket_elapsed_nanos());
+//    EXPECT_EQ(bucketStartTimeNs + NS_PER_SEC * 60 * 8,
+//              data.bucket_info(0).end_bucket_elapsed_nanos());
+//
+//    data = countMetrics.data(3);
+//    EXPECT_EQ(android::util::PROCESS_LIFE_CYCLE_STATE_CHANGED, data.dimensions_in_what().field());
+//    EXPECT_EQ(1, data.dimensions_in_what().value_tuple().dimensions_value_size());
+//    EXPECT_EQ(1 /* uid field */,
+//              data.dimensions_in_what().value_tuple().dimensions_value(0).field());
+//    EXPECT_EQ(666, data.dimensions_in_what().value_tuple().dimensions_value(0).value_int());
+//    EXPECT_EQ(1, data.bucket_info_size());
+//    EXPECT_EQ(1, data.bucket_info(0).count());
+//    EXPECT_EQ(bucketStartTimeNs + 2 * bucketSizeNs,
+//              data.bucket_info(0).start_bucket_elapsed_nanos());
+//    EXPECT_EQ(bucketStartTimeNs + NS_PER_SEC * 60 * 11,
+//              data.bucket_info(0).end_bucket_elapsed_nanos());
+//
+//    data = countMetrics.data(4);
+//    EXPECT_EQ(android::util::PROCESS_LIFE_CYCLE_STATE_CHANGED, data.dimensions_in_what().field());
+//    EXPECT_EQ(1, data.dimensions_in_what().value_tuple().dimensions_value_size());
+//    EXPECT_EQ(1 /* uid field */,
+//              data.dimensions_in_what().value_tuple().dimensions_value(0).field());
+//    EXPECT_EQ(777, data.dimensions_in_what().value_tuple().dimensions_value(0).value_int());
+//    EXPECT_EQ(1, data.bucket_info_size());
+//    EXPECT_EQ(1, data.bucket_info(0).count());
+//    EXPECT_EQ(bucketStartTimeNs + 2 * bucketSizeNs,
+//              data.bucket_info(0).start_bucket_elapsed_nanos());
+//    EXPECT_EQ(bucketStartTimeNs + NS_PER_SEC * 60 * 11,
+//              data.bucket_info(0).end_bucket_elapsed_nanos());
+//}
+//
+//TEST(MetricActivationE2eTest, TestCountMetricWithSameDeactivation) {
+//    auto config = CreateStatsdConfigWithSameDeactivations();
+//
+//    int64_t bucketStartTimeNs = NS_PER_SEC * 10; // 10 secs
+//    int64_t bucketSizeNs =
+//            TimeUnitToBucketSizeInMillis(config.count_metric(0).bucket()) * 1000LL * 1000LL;
+//
+//    int uid = 12345;
+//    int64_t cfgId = 98765;
+//    ConfigKey cfgKey(uid, cfgId);
+//
+//    sp<UidMap> m = new UidMap();
+//    sp<StatsPullerManager> pullerManager = new StatsPullerManager();
+//    sp<AlarmMonitor> anomalyAlarmMonitor;
+//    sp<AlarmMonitor> subscriberAlarmMonitor;
+//    vector<int64_t> activeConfigsBroadcast;
+//
+//    long timeBase1 = 1;
+//    int broadcastCount = 0;
+//    StatsLogProcessor processor(m, pullerManager, anomalyAlarmMonitor, subscriberAlarmMonitor,
+//            bucketStartTimeNs, [](const ConfigKey& key) { return true; },
+//            [&uid, &broadcastCount, &activeConfigsBroadcast](const int& broadcastUid,
+//                    const vector<int64_t>& activeConfigs) {
+//                broadcastCount++;
+//                EXPECT_EQ(broadcastUid, uid);
+//                activeConfigsBroadcast.clear();
+//                activeConfigsBroadcast.insert(activeConfigsBroadcast.end(),
+//                        activeConfigs.begin(), activeConfigs.end());
+//                return true;
+//            });
+//
+//    processor.OnConfigUpdated(bucketStartTimeNs, cfgKey, config);
+//
+//    EXPECT_EQ(processor.mMetricsManagers.size(), 1u);
+//    sp<MetricsManager> metricsManager = processor.mMetricsManagers.begin()->second;
+//    EXPECT_TRUE(metricsManager->isConfigValid());
+//    EXPECT_EQ(metricsManager->mAllMetricProducers.size(), 1);
+//    sp<MetricProducer> metricProducer = metricsManager->mAllMetricProducers[0];
+//    auto& eventActivationMap = metricProducer->mEventActivationMap;
+//    auto& eventDeactivationMap = metricProducer->mEventDeactivationMap;
+//
+//    EXPECT_FALSE(metricsManager->isActive());
+//    EXPECT_FALSE(metricProducer->mIsActive);
+//    // Two activations: one is triggered by battery saver mode (tracker index 0), the other is
+//    // triggered by screen on event (tracker index 2).
+//    EXPECT_EQ(eventActivationMap.size(), 2u);
+//    EXPECT_TRUE(eventActivationMap.find(0) != eventActivationMap.end());
+//    EXPECT_TRUE(eventActivationMap.find(2) != eventActivationMap.end());
+//    EXPECT_EQ(eventActivationMap[0]->state, ActivationState::kNotActive);
+//    EXPECT_EQ(eventActivationMap[0]->start_ns, 0);
+//    EXPECT_EQ(eventActivationMap[0]->ttl_ns, 60 * 6 * NS_PER_SEC);
+//    EXPECT_EQ(eventActivationMap[2]->state, ActivationState::kNotActive);
+//    EXPECT_EQ(eventActivationMap[2]->start_ns, 0);
+//    EXPECT_EQ(eventActivationMap[2]->ttl_ns, 60 * 2 * NS_PER_SEC);
+//    EXPECT_EQ(eventDeactivationMap.size(), 1u);
+//    EXPECT_TRUE(eventDeactivationMap.find(3) != eventDeactivationMap.end());
+//    EXPECT_EQ(eventDeactivationMap[3].size(), 2u);
+//    EXPECT_EQ(eventDeactivationMap[3][0], eventActivationMap[0]);
+//    EXPECT_EQ(eventDeactivationMap[3][1], eventActivationMap[2]);
+//    EXPECT_EQ(broadcastCount, 0);
+//
+//    std::unique_ptr<LogEvent> event;
+//
+//    // Event that should be ignored.
+//    event = CreateAppCrashEvent(111, bucketStartTimeNs + 1);
+//    processor.OnLogEvent(event.get(), bucketStartTimeNs + 1);
+//
+//    // Activate metric via screen on for 2 minutes.
+//    event = CreateScreenStateChangedEvent(android::view::DISPLAY_STATE_ON, bucketStartTimeNs + 10);
+//    processor.OnLogEvent(event.get(), bucketStartTimeNs + 10);
+//    EXPECT_TRUE(metricsManager->isActive());
+//    EXPECT_TRUE(metricProducer->mIsActive);
+//    EXPECT_EQ(broadcastCount, 1);
+//    EXPECT_EQ(activeConfigsBroadcast.size(), 1);
+//    EXPECT_EQ(activeConfigsBroadcast[0], cfgId);
+//    EXPECT_EQ(eventActivationMap[0]->state, ActivationState::kNotActive);
+//    EXPECT_EQ(eventActivationMap[2]->state, ActivationState::kActive);
+//    EXPECT_EQ(eventActivationMap[2]->start_ns, bucketStartTimeNs + 10);
+//
+//    // 1st processed event.
+//    event = CreateAppCrashEvent(222, bucketStartTimeNs + 15);
+//    processor.OnLogEvent(event.get(), bucketStartTimeNs + 15);
+//
+//    // Enable battery saver mode activation for 5 minutes.
+//    event = CreateBatterySaverOnEvent(bucketStartTimeNs + NS_PER_SEC * 60 + 10);
+//    processor.OnLogEvent(event.get(), bucketStartTimeNs + NS_PER_SEC * 60 + 10);
+//    EXPECT_TRUE(metricsManager->isActive());
+//    EXPECT_TRUE(metricProducer->mIsActive);
+//    EXPECT_EQ(broadcastCount, 1);
+//    EXPECT_EQ(eventActivationMap[0]->state, ActivationState::kActive);
+//    EXPECT_EQ(eventActivationMap[0]->start_ns, bucketStartTimeNs + NS_PER_SEC * 60 + 10);
+//    EXPECT_EQ(eventActivationMap[2]->state, ActivationState::kActive);
+//    EXPECT_EQ(eventActivationMap[2]->start_ns, bucketStartTimeNs + 10);
+//
+//    // 2nd processed event.
+//    event = CreateAppCrashEvent(333, bucketStartTimeNs + NS_PER_SEC * 60 + 40);
+//    processor.OnLogEvent(event.get(), bucketStartTimeNs + NS_PER_SEC * 60 + 40);
+//
+//    // Cancel battery saver mode and screen on activation.
+//    int64_t firstDeactivation = bucketStartTimeNs + NS_PER_SEC * 61;
+//    event = CreateScreenBrightnessChangedEvent(64, firstDeactivation);
+//    processor.OnLogEvent(event.get(), firstDeactivation);
+//    EXPECT_FALSE(metricsManager->isActive());
+//    EXPECT_FALSE(metricProducer->mIsActive);
+//    // New broadcast since the config is no longer active.
+//    EXPECT_EQ(broadcastCount, 2);
+//    EXPECT_EQ(activeConfigsBroadcast.size(), 0);
+//    EXPECT_EQ(eventActivationMap[0]->state, ActivationState::kNotActive);
+//    EXPECT_EQ(eventActivationMap[2]->state, ActivationState::kNotActive);
+//
+//    // Should be ignored
+//    event = CreateAppCrashEvent(444, bucketStartTimeNs + NS_PER_SEC * 61 + 80);
+//    processor.OnLogEvent(event.get(), bucketStartTimeNs + NS_PER_SEC * 61 + 80);
+//
+//    // Re-enable battery saver mode activation.
+//    event = CreateBatterySaverOnEvent(bucketStartTimeNs + NS_PER_SEC * 60 * 10 + 15);
+//    processor.OnLogEvent(event.get(), bucketStartTimeNs + NS_PER_SEC * 60 * 10 + 15);
+//    EXPECT_TRUE(metricsManager->isActive());
+//    EXPECT_TRUE(metricProducer->mIsActive);
+//    EXPECT_EQ(broadcastCount, 3);
+//    EXPECT_EQ(activeConfigsBroadcast.size(), 1);
+//    EXPECT_EQ(activeConfigsBroadcast[0], cfgId);
+//    EXPECT_EQ(eventActivationMap[0]->state, ActivationState::kActive);
+//    EXPECT_EQ(eventActivationMap[0]->start_ns, bucketStartTimeNs + NS_PER_SEC * 60 * 10 + 15);
+//    EXPECT_EQ(eventActivationMap[2]->state, ActivationState::kNotActive);
+//
+//    // 3rd processed event.
+//    event = CreateAppCrashEvent(555, bucketStartTimeNs + NS_PER_SEC * 60 * 10 + 80);
+//    processor.OnLogEvent(event.get(), bucketStartTimeNs + NS_PER_SEC * 60 * 10 + 80);
+//
+//    // Cancel battery saver mode activation.
+//    int64_t secondDeactivation = bucketStartTimeNs + NS_PER_SEC * 60 * 13;
+//    event = CreateScreenBrightnessChangedEvent(140, secondDeactivation);
+//    processor.OnLogEvent(event.get(), secondDeactivation);
+//    EXPECT_FALSE(metricsManager->isActive());
+//    EXPECT_FALSE(metricProducer->mIsActive);
+//    EXPECT_EQ(broadcastCount, 4);
+//    EXPECT_EQ(activeConfigsBroadcast.size(), 0);
+//    EXPECT_EQ(eventActivationMap[0]->state, ActivationState::kNotActive);
+//    EXPECT_EQ(eventActivationMap[2]->state, ActivationState::kNotActive);
+//
+//    // Should be ignored.
+//    event = CreateAppCrashEvent(666, bucketStartTimeNs + NS_PER_SEC * 60 * 13 + 80);
+//    processor.OnLogEvent(event.get(), bucketStartTimeNs + NS_PER_SEC * 60 * 13 + 80);
+//
+//    ConfigMetricsReportList reports;
+//    vector<uint8_t> buffer;
+//    processor.onDumpReport(cfgKey, bucketStartTimeNs + NS_PER_SEC * 60 * 15 + 1, false, true,
+//                            ADB_DUMP, FAST, &buffer);
+//    EXPECT_TRUE(buffer.size() > 0);
+//    EXPECT_TRUE(reports.ParseFromArray(&buffer[0], buffer.size()));
+//    backfillDimensionPath(&reports);
+//    backfillStartEndTimestamp(&reports);
+//    EXPECT_EQ(1, reports.reports_size());
+//    EXPECT_EQ(1, reports.reports(0).metrics_size());
+//    EXPECT_EQ(3, reports.reports(0).metrics(0).count_metrics().data_size());
+//
+//    StatsLogReport::CountMetricDataWrapper countMetrics;
+//    sortMetricDataByDimensionsValue(
+//            reports.reports(0).metrics(0).count_metrics(), &countMetrics);
+//    EXPECT_EQ(3, countMetrics.data_size());
+//
+//    auto data = countMetrics.data(0);
+//    EXPECT_EQ(android::util::PROCESS_LIFE_CYCLE_STATE_CHANGED, data.dimensions_in_what().field());
+//    EXPECT_EQ(1, data.dimensions_in_what().value_tuple().dimensions_value_size());
+//    EXPECT_EQ(1 /* uid field */,
+//              data.dimensions_in_what().value_tuple().dimensions_value(0).field());
+//    EXPECT_EQ(222, data.dimensions_in_what().value_tuple().dimensions_value(0).value_int());
+//    EXPECT_EQ(1, data.bucket_info_size());
+//    EXPECT_EQ(1, data.bucket_info(0).count());
+//    EXPECT_EQ(bucketStartTimeNs, data.bucket_info(0).start_bucket_elapsed_nanos());
+//    EXPECT_EQ(firstDeactivation, data.bucket_info(0).end_bucket_elapsed_nanos());
+//
+//    data = countMetrics.data(1);
+//    EXPECT_EQ(android::util::PROCESS_LIFE_CYCLE_STATE_CHANGED, data.dimensions_in_what().field());
+//    EXPECT_EQ(1, data.dimensions_in_what().value_tuple().dimensions_value_size());
+//    EXPECT_EQ(1 /* uid field */,
+//              data.dimensions_in_what().value_tuple().dimensions_value(0).field());
+//    EXPECT_EQ(333, data.dimensions_in_what().value_tuple().dimensions_value(0).value_int());
+//    EXPECT_EQ(1, data.bucket_info_size());
+//    EXPECT_EQ(1, data.bucket_info(0).count());
+//    EXPECT_EQ(bucketStartTimeNs, data.bucket_info(0).start_bucket_elapsed_nanos());
+//    EXPECT_EQ(firstDeactivation, data.bucket_info(0).end_bucket_elapsed_nanos());
+//
+//    data = countMetrics.data(2);
+//    EXPECT_EQ(android::util::PROCESS_LIFE_CYCLE_STATE_CHANGED, data.dimensions_in_what().field());
+//    EXPECT_EQ(1, data.dimensions_in_what().value_tuple().dimensions_value_size());
+//    EXPECT_EQ(1 /* uid field */,
+//              data.dimensions_in_what().value_tuple().dimensions_value(0).field());
+//    EXPECT_EQ(555, data.dimensions_in_what().value_tuple().dimensions_value(0).value_int());
+//    EXPECT_EQ(1, data.bucket_info_size());
+//    EXPECT_EQ(1, data.bucket_info(0).count());
+//    // Partial bucket as metric is deactivated.
+//    EXPECT_EQ(bucketStartTimeNs + 2 * bucketSizeNs, data.bucket_info(0).start_bucket_elapsed_nanos());
+//    EXPECT_EQ(secondDeactivation, data.bucket_info(0).end_bucket_elapsed_nanos());
+//}
+//
+//TEST(MetricActivationE2eTest, TestCountMetricWithTwoMetricsTwoDeactivations) {
+//    auto config = CreateStatsdConfigWithTwoMetricsTwoDeactivations();
+//
+//    int64_t bucketStartTimeNs = NS_PER_SEC * 10; // 10 secs
+//    int64_t bucketSizeNs =
+//            TimeUnitToBucketSizeInMillis(config.count_metric(0).bucket()) * 1000LL * 1000LL;
+//
+//    int uid = 12345;
+//    int64_t cfgId = 98765;
+//    ConfigKey cfgKey(uid, cfgId);
+//
+//    sp<UidMap> m = new UidMap();
+//    sp<StatsPullerManager> pullerManager = new StatsPullerManager();
+//    sp<AlarmMonitor> anomalyAlarmMonitor;
+//    sp<AlarmMonitor> subscriberAlarmMonitor;
+//    vector<int64_t> activeConfigsBroadcast;
+//
+//    long timeBase1 = 1;
+//    int broadcastCount = 0;
+//    StatsLogProcessor processor(m, pullerManager, anomalyAlarmMonitor, subscriberAlarmMonitor,
+//            bucketStartTimeNs, [](const ConfigKey& key) { return true; },
+//            [&uid, &broadcastCount, &activeConfigsBroadcast](const int& broadcastUid,
+//                    const vector<int64_t>& activeConfigs) {
+//                broadcastCount++;
+//                EXPECT_EQ(broadcastUid, uid);
+//                activeConfigsBroadcast.clear();
+//                activeConfigsBroadcast.insert(activeConfigsBroadcast.end(),
+//                        activeConfigs.begin(), activeConfigs.end());
+//                return true;
+//            });
+//
+//    processor.OnConfigUpdated(bucketStartTimeNs, cfgKey, config);
+//
+//    EXPECT_EQ(processor.mMetricsManagers.size(), 1u);
+//    sp<MetricsManager> metricsManager = processor.mMetricsManagers.begin()->second;
+//    EXPECT_TRUE(metricsManager->isConfigValid());
+//    EXPECT_EQ(metricsManager->mAllMetricProducers.size(), 2);
+//    sp<MetricProducer> metricProducer = metricsManager->mAllMetricProducers[0];
+//    auto& eventActivationMap = metricProducer->mEventActivationMap;
+//    auto& eventDeactivationMap = metricProducer->mEventDeactivationMap;
+//    sp<MetricProducer> metricProducer2 = metricsManager->mAllMetricProducers[1];
+//    auto& eventActivationMap2 = metricProducer2->mEventActivationMap;
+//    auto& eventDeactivationMap2 = metricProducer2->mEventDeactivationMap;
+//
+//    EXPECT_FALSE(metricsManager->isActive());
+//    EXPECT_FALSE(metricProducer->mIsActive);
+//    EXPECT_FALSE(metricProducer2->mIsActive);
+//    // Two activations: one is triggered by battery saver mode (tracker index 0), the other is
+//    // triggered by screen on event (tracker index 2).
+//    EXPECT_EQ(eventActivationMap.size(), 2u);
+//    EXPECT_TRUE(eventActivationMap.find(0) != eventActivationMap.end());
+//    EXPECT_TRUE(eventActivationMap.find(2) != eventActivationMap.end());
+//    EXPECT_EQ(eventActivationMap[0]->state, ActivationState::kNotActive);
+//    EXPECT_EQ(eventActivationMap[0]->start_ns, 0);
+//    EXPECT_EQ(eventActivationMap[0]->ttl_ns, 60 * 6 * NS_PER_SEC);
+//    EXPECT_EQ(eventActivationMap[2]->state, ActivationState::kNotActive);
+//    EXPECT_EQ(eventActivationMap[2]->start_ns, 0);
+//    EXPECT_EQ(eventActivationMap[2]->ttl_ns, 60 * 2 * NS_PER_SEC);
+//    EXPECT_EQ(eventDeactivationMap.size(), 2u);
+//    EXPECT_TRUE(eventDeactivationMap.find(3) != eventDeactivationMap.end());
+//    EXPECT_TRUE(eventDeactivationMap.find(4) != eventDeactivationMap.end());
+//    EXPECT_EQ(eventDeactivationMap[3].size(), 1u);
+//    EXPECT_EQ(eventDeactivationMap[4].size(), 1u);
+//    EXPECT_EQ(eventDeactivationMap[3][0], eventActivationMap[0]);
+//    EXPECT_EQ(eventDeactivationMap[4][0], eventActivationMap[2]);
+//
+//    EXPECT_EQ(eventActivationMap2.size(), 2u);
+//    EXPECT_TRUE(eventActivationMap2.find(0) != eventActivationMap2.end());
+//    EXPECT_TRUE(eventActivationMap2.find(2) != eventActivationMap2.end());
+//    EXPECT_EQ(eventActivationMap2[0]->state, ActivationState::kNotActive);
+//    EXPECT_EQ(eventActivationMap2[0]->start_ns, 0);
+//    EXPECT_EQ(eventActivationMap2[0]->ttl_ns, 60 * 6 * NS_PER_SEC);
+//    EXPECT_EQ(eventActivationMap2[2]->state, ActivationState::kNotActive);
+//    EXPECT_EQ(eventActivationMap2[2]->start_ns, 0);
+//    EXPECT_EQ(eventActivationMap2[2]->ttl_ns, 60 * 2 * NS_PER_SEC);
+//    EXPECT_EQ(eventDeactivationMap2.size(), 2u);
+//    EXPECT_TRUE(eventDeactivationMap2.find(3) != eventDeactivationMap2.end());
+//    EXPECT_TRUE(eventDeactivationMap2.find(4) != eventDeactivationMap2.end());
+//    EXPECT_EQ(eventDeactivationMap[3].size(), 1u);
+//    EXPECT_EQ(eventDeactivationMap[4].size(), 1u);
+//    EXPECT_EQ(eventDeactivationMap2[3][0], eventActivationMap2[0]);
+//    EXPECT_EQ(eventDeactivationMap2[4][0], eventActivationMap2[2]);
+//
+//    std::unique_ptr<LogEvent> event;
+//
+//    event = CreateAppCrashEvent(111, bucketStartTimeNs + 5);
+//    processor.OnLogEvent(event.get(), bucketStartTimeNs + 5);
+//    event = CreateMoveToForegroundEvent(1111, bucketStartTimeNs + 5);
+//    processor.OnLogEvent(event.get(), bucketStartTimeNs + 5);
+//    EXPECT_FALSE(metricsManager->isActive());
+//    EXPECT_FALSE(metricProducer->mIsActive);
+//    EXPECT_FALSE(metricProducer2->mIsActive);
+//    EXPECT_EQ(broadcastCount, 0);
+//
+//    // Activated by battery save mode.
+//    event = CreateBatterySaverOnEvent(bucketStartTimeNs + 10);
+//    processor.OnLogEvent(event.get(), bucketStartTimeNs + 10);
+//    EXPECT_TRUE(metricsManager->isActive());
+//    EXPECT_EQ(broadcastCount, 1);
+//    EXPECT_EQ(activeConfigsBroadcast.size(), 1);
+//    EXPECT_EQ(activeConfigsBroadcast[0], cfgId);
+//    EXPECT_TRUE(metricProducer->mIsActive);
+//    EXPECT_EQ(eventActivationMap[0]->state, ActivationState::kActive);
+//    EXPECT_EQ(eventActivationMap[0]->start_ns, bucketStartTimeNs + 10);
+//    EXPECT_EQ(eventActivationMap[0]->ttl_ns, 60 * 6 * NS_PER_SEC);
+//    EXPECT_EQ(eventActivationMap[2]->state, ActivationState::kNotActive);
+//    EXPECT_EQ(eventActivationMap[2]->start_ns, 0);
+//    EXPECT_EQ(eventActivationMap[2]->ttl_ns, 60 * 2 * NS_PER_SEC);
+//    EXPECT_EQ(eventDeactivationMap[3][0], eventActivationMap[0]);
+//    EXPECT_EQ(eventDeactivationMap[4][0], eventActivationMap[2]);
+//    EXPECT_TRUE(metricProducer2->mIsActive);
+//    EXPECT_EQ(eventActivationMap2[0]->state, ActivationState::kActive);
+//    EXPECT_EQ(eventActivationMap2[0]->start_ns, bucketStartTimeNs + 10);
+//    EXPECT_EQ(eventActivationMap2[0]->ttl_ns, 60 * 6 * NS_PER_SEC);
+//    EXPECT_EQ(eventActivationMap2[2]->state, ActivationState::kNotActive);
+//    EXPECT_EQ(eventActivationMap2[2]->start_ns, 0);
+//    EXPECT_EQ(eventActivationMap2[2]->ttl_ns, 60 * 2 * NS_PER_SEC);
+//    EXPECT_EQ(eventDeactivationMap2[3][0], eventActivationMap2[0]);
+//    EXPECT_EQ(eventDeactivationMap2[4][0], eventActivationMap2[2]);
+//
+//    // First processed event.
+//    event = CreateAppCrashEvent(222, bucketStartTimeNs + 15);
+//    processor.OnLogEvent(event.get(), bucketStartTimeNs + 15);
+//    event = CreateMoveToForegroundEvent(2222, bucketStartTimeNs + 15);
+//    processor.OnLogEvent(event.get(), bucketStartTimeNs + 15);
+//
+//    // Activated by screen on event.
+//    event = CreateScreenStateChangedEvent(android::view::DISPLAY_STATE_ON,
+//                                          bucketStartTimeNs + 20);
+//    processor.OnLogEvent(event.get(), bucketStartTimeNs + 20);
+//    EXPECT_TRUE(metricsManager->isActive());
+//    EXPECT_TRUE(metricProducer->mIsActive);
+//    EXPECT_EQ(eventActivationMap[0]->state, ActivationState::kActive);
+//    EXPECT_EQ(eventActivationMap[0]->start_ns, bucketStartTimeNs + 10);
+//    EXPECT_EQ(eventActivationMap[0]->ttl_ns, 60 * 6 * NS_PER_SEC);
+//    EXPECT_EQ(eventActivationMap[2]->state, ActivationState::kActive);
+//    EXPECT_EQ(eventActivationMap[2]->start_ns, bucketStartTimeNs + 20);
+//    EXPECT_EQ(eventActivationMap[2]->ttl_ns, 60 * 2 * NS_PER_SEC);
+//    EXPECT_EQ(eventDeactivationMap[3][0], eventActivationMap[0]);
+//    EXPECT_EQ(eventDeactivationMap[4][0], eventActivationMap[2]);
+//    EXPECT_TRUE(metricProducer2->mIsActive);
+//    EXPECT_EQ(eventActivationMap2[0]->state, ActivationState::kActive);
+//    EXPECT_EQ(eventActivationMap2[0]->start_ns, bucketStartTimeNs + 10);
+//    EXPECT_EQ(eventActivationMap2[0]->ttl_ns, 60 * 6 * NS_PER_SEC);
+//    EXPECT_EQ(eventActivationMap2[2]->state, ActivationState::kActive);
+//    EXPECT_EQ(eventActivationMap2[2]->start_ns, bucketStartTimeNs + 20);
+//    EXPECT_EQ(eventActivationMap2[2]->ttl_ns, 60 * 2 * NS_PER_SEC);
+//    EXPECT_EQ(eventDeactivationMap2[3][0], eventActivationMap2[0]);
+//    EXPECT_EQ(eventDeactivationMap2[4][0], eventActivationMap2[2]);
+//
+//    // 2nd processed event.
+//    // The activation by screen_on event expires, but the one by battery save mode is still active.
+//    event = CreateAppCrashEvent(333, bucketStartTimeNs + NS_PER_SEC * 60 * 2 + 25);
+//    processor.OnLogEvent(event.get(), bucketStartTimeNs + NS_PER_SEC * 60 * 2 + 25);
+//    event = CreateMoveToForegroundEvent(3333, bucketStartTimeNs + NS_PER_SEC * 60 * 2 + 25);
+//    processor.OnLogEvent(event.get(), bucketStartTimeNs + NS_PER_SEC * 60 * 2 + 25);
+//    EXPECT_TRUE(metricsManager->isActive());
+//    EXPECT_TRUE(metricProducer->mIsActive);
+//    EXPECT_EQ(eventActivationMap[0]->state, ActivationState::kActive);
+//    EXPECT_EQ(eventActivationMap[0]->start_ns, bucketStartTimeNs + 10);
+//    EXPECT_EQ(eventActivationMap[0]->ttl_ns, 60 * 6 * NS_PER_SEC);
+//    EXPECT_EQ(eventActivationMap[2]->state, ActivationState::kNotActive);
+//    EXPECT_EQ(eventActivationMap[2]->start_ns, bucketStartTimeNs + 20);
+//    EXPECT_EQ(eventActivationMap[2]->ttl_ns, 60 * 2 * NS_PER_SEC);
+//    EXPECT_EQ(eventDeactivationMap[3][0], eventActivationMap[0]);
+//    EXPECT_EQ(eventDeactivationMap[4][0], eventActivationMap[2]);
+//    EXPECT_TRUE(metricProducer2->mIsActive);
+//    EXPECT_EQ(eventActivationMap2[0]->state, ActivationState::kActive);
+//    EXPECT_EQ(eventActivationMap2[0]->start_ns, bucketStartTimeNs + 10);
+//    EXPECT_EQ(eventActivationMap2[0]->ttl_ns, 60 * 6 * NS_PER_SEC);
+//    EXPECT_EQ(eventActivationMap2[2]->state, ActivationState::kNotActive);
+//    EXPECT_EQ(eventActivationMap2[2]->start_ns, bucketStartTimeNs + 20);
+//    EXPECT_EQ(eventActivationMap2[2]->ttl_ns, 60 * 2 * NS_PER_SEC);
+//    EXPECT_EQ(eventDeactivationMap2[3][0], eventActivationMap2[0]);
+//    EXPECT_EQ(eventDeactivationMap2[4][0], eventActivationMap2[2]);
+//    // No new broadcast since the config should still be active.
+//    EXPECT_EQ(broadcastCount, 1);
+//
+//    // 3rd processed event.
+//    event = CreateAppCrashEvent(444, bucketStartTimeNs + NS_PER_SEC * 60 * 5 + 25);
+//    processor.OnLogEvent(event.get(), bucketStartTimeNs + NS_PER_SEC * 60 * 5 + 25);
+//    event = CreateMoveToForegroundEvent(4444, bucketStartTimeNs + NS_PER_SEC * 60 * 5 + 25);
+//    processor.OnLogEvent(event.get(), bucketStartTimeNs + NS_PER_SEC * 60 * 5 + 25);
+//
+//    // All activations expired.
+//    event = CreateAppCrashEvent(555, bucketStartTimeNs + NS_PER_SEC * 60 * 8);
+//    processor.OnLogEvent(event.get(), bucketStartTimeNs + NS_PER_SEC * 60 * 8);
+//    event = CreateMoveToForegroundEvent(5555, bucketStartTimeNs + NS_PER_SEC * 60 * 8);
+//    processor.OnLogEvent(event.get(), bucketStartTimeNs + NS_PER_SEC * 60 * 8);
+//    EXPECT_FALSE(metricsManager->isActive());
+//    // New broadcast since the config is no longer active.
+//    EXPECT_EQ(broadcastCount, 2);
+//    EXPECT_EQ(activeConfigsBroadcast.size(), 0);
+//    EXPECT_FALSE(metricProducer->mIsActive);
+//    EXPECT_EQ(eventActivationMap[0]->state, ActivationState::kNotActive);
+//    EXPECT_EQ(eventActivationMap[0]->start_ns, bucketStartTimeNs + 10);
+//    EXPECT_EQ(eventActivationMap[0]->ttl_ns, 60 * 6 * NS_PER_SEC);
+//    EXPECT_EQ(eventActivationMap[2]->state, ActivationState::kNotActive);
+//    EXPECT_EQ(eventActivationMap[2]->start_ns, bucketStartTimeNs + 20);
+//    EXPECT_EQ(eventActivationMap[2]->ttl_ns, 60 * 2 * NS_PER_SEC);
+//    EXPECT_EQ(eventDeactivationMap[3][0], eventActivationMap[0]);
+//    EXPECT_EQ(eventDeactivationMap[4][0], eventActivationMap[2]);
+//    EXPECT_FALSE(metricProducer2->mIsActive);
+//    EXPECT_EQ(eventActivationMap2[0]->state, ActivationState::kNotActive);
+//    EXPECT_EQ(eventActivationMap2[0]->start_ns, bucketStartTimeNs + 10);
+//    EXPECT_EQ(eventActivationMap2[0]->ttl_ns, 60 * 6 * NS_PER_SEC);
+//    EXPECT_EQ(eventActivationMap2[2]->state, ActivationState::kNotActive);
+//    EXPECT_EQ(eventActivationMap2[2]->start_ns, bucketStartTimeNs + 20);
+//    EXPECT_EQ(eventActivationMap2[2]->ttl_ns, 60 * 2 * NS_PER_SEC);
+//    EXPECT_EQ(eventDeactivationMap2[3][0], eventActivationMap2[0]);
+//    EXPECT_EQ(eventDeactivationMap2[4][0], eventActivationMap2[2]);
+//
+//    // Re-activate metric via screen on.
+//    event = CreateScreenStateChangedEvent(android::view::DISPLAY_STATE_ON,
+//                                          bucketStartTimeNs + NS_PER_SEC * 60 * 10 + 10);
+//    processor.OnLogEvent(event.get(), bucketStartTimeNs + NS_PER_SEC * 60 * 10 + 10);
+//    EXPECT_TRUE(metricsManager->isActive());
+//    EXPECT_EQ(broadcastCount, 3);
+//    EXPECT_EQ(activeConfigsBroadcast.size(), 1);
+//    EXPECT_EQ(activeConfigsBroadcast[0], cfgId);
+//    EXPECT_TRUE(metricProducer->mIsActive);
+//    EXPECT_EQ(eventActivationMap[0]->state, ActivationState::kNotActive);
+//    EXPECT_EQ(eventActivationMap[0]->start_ns, bucketStartTimeNs + 10);
+//    EXPECT_EQ(eventActivationMap[0]->ttl_ns, 60 * 6 * NS_PER_SEC);
+//    EXPECT_EQ(eventActivationMap[2]->state, ActivationState::kActive);
+//    EXPECT_EQ(eventActivationMap[2]->start_ns, bucketStartTimeNs + NS_PER_SEC * 60 * 10 + 10);
+//    EXPECT_EQ(eventActivationMap[2]->ttl_ns, 60 * 2 * NS_PER_SEC);
+//    EXPECT_EQ(eventDeactivationMap[3][0], eventActivationMap[0]);
+//    EXPECT_EQ(eventDeactivationMap[4][0], eventActivationMap[2]);
+//    EXPECT_TRUE(metricProducer2->mIsActive);
+//    EXPECT_EQ(eventActivationMap2[0]->state, ActivationState::kNotActive);
+//    EXPECT_EQ(eventActivationMap2[0]->start_ns, bucketStartTimeNs + 10);
+//    EXPECT_EQ(eventActivationMap2[0]->ttl_ns, 60 * 6 * NS_PER_SEC);
+//    EXPECT_EQ(eventActivationMap2[2]->state, ActivationState::kActive);
+//    EXPECT_EQ(eventActivationMap2[2]->start_ns, bucketStartTimeNs + NS_PER_SEC * 60 * 10 + 10);
+//    EXPECT_EQ(eventActivationMap2[2]->ttl_ns, 60 * 2 * NS_PER_SEC);
+//    EXPECT_EQ(eventDeactivationMap2[3][0], eventActivationMap2[0]);
+//    EXPECT_EQ(eventDeactivationMap2[4][0], eventActivationMap2[2]);
+//
+//    // 4th processed event.
+//    event = CreateAppCrashEvent(666, bucketStartTimeNs + NS_PER_SEC * 60 * 11 + 1);
+//    processor.OnLogEvent(event.get(), bucketStartTimeNs + NS_PER_SEC * 60 * 11 + 1);
+//    event = CreateMoveToForegroundEvent(6666, bucketStartTimeNs + NS_PER_SEC * 60 * 11 + 1);
+//    processor.OnLogEvent(event.get(), bucketStartTimeNs + NS_PER_SEC * 60 * 11 + 1);
+//
+//    // Re-enable battery saver mode activation.
+//    event = CreateBatterySaverOnEvent(bucketStartTimeNs + NS_PER_SEC * 60 * 11 + 15);
+//    processor.OnLogEvent(event.get(), bucketStartTimeNs + NS_PER_SEC * 60 * 11 + 15);
+//    EXPECT_TRUE(metricsManager->isActive());
+//    EXPECT_EQ(broadcastCount, 3);
+//    EXPECT_EQ(activeConfigsBroadcast.size(), 1);
+//    EXPECT_EQ(activeConfigsBroadcast[0], cfgId);
+//    EXPECT_TRUE(metricProducer->mIsActive);
+//    EXPECT_EQ(eventActivationMap[0]->state, ActivationState::kActive);
+//    EXPECT_EQ(eventActivationMap[0]->start_ns, bucketStartTimeNs + NS_PER_SEC * 60 * 11 + 15);
+//    EXPECT_EQ(eventActivationMap[0]->ttl_ns, 60 * 6 * NS_PER_SEC);
+//    EXPECT_EQ(eventActivationMap[2]->state, ActivationState::kActive);
+//    EXPECT_EQ(eventActivationMap[2]->start_ns, bucketStartTimeNs + NS_PER_SEC * 60 * 10 + 10);
+//    EXPECT_EQ(eventActivationMap[2]->ttl_ns, 60 * 2 * NS_PER_SEC);
+//    EXPECT_EQ(eventDeactivationMap[3][0], eventActivationMap[0]);
+//    EXPECT_EQ(eventDeactivationMap[4][0], eventActivationMap[2]);
+//    EXPECT_TRUE(metricProducer2->mIsActive);
+//    EXPECT_EQ(eventActivationMap2[0]->state, ActivationState::kActive);
+//    EXPECT_EQ(eventActivationMap2[0]->start_ns, bucketStartTimeNs + NS_PER_SEC * 60 * 11 + 15);
+//    EXPECT_EQ(eventActivationMap2[0]->ttl_ns, 60 * 6 * NS_PER_SEC);
+//    EXPECT_EQ(eventActivationMap2[2]->state, ActivationState::kActive);
+//    EXPECT_EQ(eventActivationMap2[2]->start_ns, bucketStartTimeNs + NS_PER_SEC * 60 * 10 + 10);
+//    EXPECT_EQ(eventActivationMap2[2]->ttl_ns, 60 * 2 * NS_PER_SEC);
+//    EXPECT_EQ(eventDeactivationMap2[3][0], eventActivationMap2[0]);
+//    EXPECT_EQ(eventDeactivationMap2[4][0], eventActivationMap2[2]);
+//
+//    // 5th processed event.
+//    event = CreateAppCrashEvent(777, bucketStartTimeNs + NS_PER_SEC * 60 * 11 + 40);
+//    processor.OnLogEvent(event.get(), bucketStartTimeNs + NS_PER_SEC * 60 * 11 + 40);
+//    event = CreateMoveToForegroundEvent(7777, bucketStartTimeNs + NS_PER_SEC * 60 * 11 + 40);
+//    processor.OnLogEvent(event.get(), bucketStartTimeNs + NS_PER_SEC * 60 * 11 + 40);
+//
+//    // Cancel battery saver mode and screen on activation.
+//    event = CreateScreenBrightnessChangedEvent(64, bucketStartTimeNs + NS_PER_SEC * 60 * 11 + 60);
+//    processor.OnLogEvent(event.get(),bucketStartTimeNs + NS_PER_SEC * 60 * 11 + 60);
+//    EXPECT_FALSE(metricsManager->isActive());
+//    // New broadcast since the config is no longer active.
+//    EXPECT_EQ(broadcastCount, 4);
+//    EXPECT_EQ(activeConfigsBroadcast.size(), 0);
+//    EXPECT_FALSE(metricProducer->mIsActive);
+//    EXPECT_EQ(eventActivationMap[0]->state, ActivationState::kNotActive);
+//    EXPECT_EQ(eventActivationMap[0]->start_ns, bucketStartTimeNs + NS_PER_SEC * 60 * 11 + 15);
+//    EXPECT_EQ(eventActivationMap[0]->ttl_ns, 60 * 6 * NS_PER_SEC);
+//    EXPECT_EQ(eventActivationMap[2]->state, ActivationState::kNotActive);
+//    EXPECT_EQ(eventActivationMap[2]->start_ns, bucketStartTimeNs + NS_PER_SEC * 60 * 10 + 10);
+//    EXPECT_EQ(eventActivationMap[2]->ttl_ns, 60 * 2 * NS_PER_SEC);
+//    EXPECT_EQ(eventDeactivationMap[3][0], eventActivationMap[0]);
+//    EXPECT_EQ(eventDeactivationMap[4][0], eventActivationMap[2]);
+//    EXPECT_FALSE(metricProducer2->mIsActive);
+//    EXPECT_EQ(eventActivationMap2[0]->state, ActivationState::kNotActive);
+//    EXPECT_EQ(eventActivationMap2[0]->start_ns, bucketStartTimeNs + NS_PER_SEC * 60 * 11 + 15);
+//    EXPECT_EQ(eventActivationMap2[0]->ttl_ns, 60 * 6 * NS_PER_SEC);
+//    EXPECT_EQ(eventActivationMap2[2]->state, ActivationState::kNotActive);
+//    EXPECT_EQ(eventActivationMap2[2]->start_ns, bucketStartTimeNs + NS_PER_SEC * 60 * 10 + 10);
+//    EXPECT_EQ(eventActivationMap2[2]->ttl_ns, 60 * 2 * NS_PER_SEC);
+//    EXPECT_EQ(eventDeactivationMap2[3][0], eventActivationMap2[0]);
+//    EXPECT_EQ(eventDeactivationMap2[4][0], eventActivationMap2[2]);
+//
+//    // Screen-on activation expired.
+//    event = CreateAppCrashEvent(888, bucketStartTimeNs + NS_PER_SEC * 60 * 13);
+//    processor.OnLogEvent(event.get(), bucketStartTimeNs + NS_PER_SEC * 60 * 13);
+//    event = CreateMoveToForegroundEvent(8888, bucketStartTimeNs + NS_PER_SEC * 60 * 13);
+//    processor.OnLogEvent(event.get(), bucketStartTimeNs + NS_PER_SEC * 60 * 13);
+//    EXPECT_FALSE(metricsManager->isActive());
+//    EXPECT_EQ(broadcastCount, 4);
+//    EXPECT_EQ(activeConfigsBroadcast.size(), 0);
+//    EXPECT_FALSE(metricProducer->mIsActive);
+//    EXPECT_EQ(eventActivationMap[0]->state, ActivationState::kNotActive);
+//    EXPECT_EQ(eventActivationMap[0]->start_ns, bucketStartTimeNs + NS_PER_SEC * 60 * 11 + 15);
+//    EXPECT_EQ(eventActivationMap[0]->ttl_ns, 60 * 6 * NS_PER_SEC);
+//    EXPECT_EQ(eventActivationMap[2]->state, ActivationState::kNotActive);
+//    EXPECT_EQ(eventActivationMap[2]->start_ns, bucketStartTimeNs + NS_PER_SEC * 60 * 10 + 10);
+//    EXPECT_EQ(eventActivationMap[2]->ttl_ns, 60 * 2 * NS_PER_SEC);
+//    EXPECT_EQ(eventDeactivationMap[3][0], eventActivationMap[0]);
+//    EXPECT_EQ(eventDeactivationMap[4][0], eventActivationMap[2]);
+//    EXPECT_FALSE(metricProducer2->mIsActive);
+//    EXPECT_EQ(eventActivationMap2[0]->state, ActivationState::kNotActive);
+//    EXPECT_EQ(eventActivationMap2[0]->start_ns, bucketStartTimeNs + NS_PER_SEC * 60 * 11 + 15);
+//    EXPECT_EQ(eventActivationMap2[0]->ttl_ns, 60 * 6 * NS_PER_SEC);
+//    EXPECT_EQ(eventActivationMap2[2]->state, ActivationState::kNotActive);
+//    EXPECT_EQ(eventActivationMap2[2]->start_ns, bucketStartTimeNs + NS_PER_SEC * 60 * 10 + 10);
+//    EXPECT_EQ(eventActivationMap2[2]->ttl_ns, 60 * 2 * NS_PER_SEC);
+//    EXPECT_EQ(eventDeactivationMap2[3][0], eventActivationMap2[0]);
+//    EXPECT_EQ(eventDeactivationMap2[4][0], eventActivationMap2[2]);
+//
+//    event = CreateAppCrashEvent(999, bucketStartTimeNs + NS_PER_SEC * 60 * 14 + 1);
+//    processor.OnLogEvent(event.get(), bucketStartTimeNs + NS_PER_SEC * 60 * 14 + 1);
+//    event = CreateMoveToForegroundEvent(9999, bucketStartTimeNs + NS_PER_SEC * 60 * 14 + 1);
+//    processor.OnLogEvent(event.get(), bucketStartTimeNs + NS_PER_SEC * 60 * 14 + 1);
+//
+//    // Re-enable battery saver mode activation.
+//    event = CreateBatterySaverOnEvent(bucketStartTimeNs + NS_PER_SEC * 60 * 15 + 15);
+//    processor.OnLogEvent(event.get(), bucketStartTimeNs + NS_PER_SEC * 60 * 15 + 15);
+//    EXPECT_TRUE(metricsManager->isActive());
+//    EXPECT_EQ(broadcastCount, 5);
+//    EXPECT_EQ(activeConfigsBroadcast.size(), 1);
+//    EXPECT_EQ(activeConfigsBroadcast[0], cfgId);
+//    EXPECT_TRUE(metricProducer->mIsActive);
+//    EXPECT_EQ(eventActivationMap[0]->state, ActivationState::kActive);
+//    EXPECT_EQ(eventActivationMap[0]->start_ns, bucketStartTimeNs + NS_PER_SEC * 60 * 15 + 15);
+//    EXPECT_EQ(eventActivationMap[0]->ttl_ns, 60 * 6 * NS_PER_SEC);
+//    EXPECT_EQ(eventActivationMap[2]->state, ActivationState::kNotActive);
+//    EXPECT_EQ(eventActivationMap[2]->start_ns, bucketStartTimeNs + NS_PER_SEC * 60 * 10 + 10);
+//    EXPECT_EQ(eventActivationMap[2]->ttl_ns, 60 * 2 * NS_PER_SEC);
+//    EXPECT_EQ(eventDeactivationMap[3][0], eventActivationMap[0]);
+//    EXPECT_EQ(eventDeactivationMap[4][0], eventActivationMap[2]);
+//    EXPECT_TRUE(metricProducer2->mIsActive);
+//    EXPECT_EQ(eventActivationMap2[0]->state, ActivationState::kActive);
+//    EXPECT_EQ(eventActivationMap2[0]->start_ns, bucketStartTimeNs + NS_PER_SEC * 60 * 15 + 15);
+//    EXPECT_EQ(eventActivationMap2[0]->ttl_ns, 60 * 6 * NS_PER_SEC);
+//    EXPECT_EQ(eventActivationMap2[2]->state, ActivationState::kNotActive);
+//    EXPECT_EQ(eventActivationMap2[2]->start_ns, bucketStartTimeNs + NS_PER_SEC * 60 * 10 + 10);
+//    EXPECT_EQ(eventActivationMap2[2]->ttl_ns, 60 * 2 * NS_PER_SEC);
+//    EXPECT_EQ(eventDeactivationMap2[3][0], eventActivationMap2[0]);
+//    EXPECT_EQ(eventDeactivationMap2[4][0], eventActivationMap2[2]);
+//
+//    // Cancel battery saver mode and screen on activation.
+//    event = CreateScreenBrightnessChangedEvent(140, bucketStartTimeNs + NS_PER_SEC * 60 * 16);
+//    processor.OnLogEvent(event.get(),bucketStartTimeNs + NS_PER_SEC * 60 * 16);
+//    EXPECT_FALSE(metricsManager->isActive());
+//    EXPECT_EQ(broadcastCount, 6);
+//    EXPECT_EQ(activeConfigsBroadcast.size(), 0);
+//    EXPECT_FALSE(metricProducer->mIsActive);
+//    EXPECT_EQ(eventActivationMap[0]->state, ActivationState::kNotActive);
+//    EXPECT_EQ(eventActivationMap[0]->start_ns, bucketStartTimeNs + NS_PER_SEC * 60 * 15 + 15);
+//    EXPECT_EQ(eventActivationMap[0]->ttl_ns, 60 * 6 * NS_PER_SEC);
+//    EXPECT_EQ(eventActivationMap[2]->state, ActivationState::kNotActive);
+//    EXPECT_EQ(eventActivationMap[2]->start_ns, bucketStartTimeNs + NS_PER_SEC * 60 * 10 + 10);
+//    EXPECT_EQ(eventActivationMap[2]->ttl_ns, 60 * 2 * NS_PER_SEC);
+//    EXPECT_EQ(eventDeactivationMap[3][0], eventActivationMap[0]);
+//    EXPECT_EQ(eventDeactivationMap[4][0], eventActivationMap[2]);
+//    EXPECT_FALSE(metricProducer2->mIsActive);
+//    EXPECT_EQ(eventActivationMap2[0]->state, ActivationState::kNotActive);
+//    EXPECT_EQ(eventActivationMap2[0]->start_ns, bucketStartTimeNs + NS_PER_SEC * 60 * 15 + 15);
+//    EXPECT_EQ(eventActivationMap2[0]->ttl_ns, 60 * 6 * NS_PER_SEC);
+//    EXPECT_EQ(eventActivationMap2[2]->state, ActivationState::kNotActive);
+//    EXPECT_EQ(eventActivationMap2[2]->start_ns, bucketStartTimeNs + NS_PER_SEC * 60 * 10 + 10);
+//    EXPECT_EQ(eventActivationMap2[2]->ttl_ns, 60 * 2 * NS_PER_SEC);
+//    EXPECT_EQ(eventDeactivationMap2[3][0], eventActivationMap2[0]);
+//    EXPECT_EQ(eventDeactivationMap2[4][0], eventActivationMap2[2]);
+//
+//    ConfigMetricsReportList reports;
+//    vector<uint8_t> buffer;
+//    processor.onDumpReport(cfgKey, bucketStartTimeNs + NS_PER_SEC * 60 * 15 + 1, false, true,
+//                            ADB_DUMP, FAST, &buffer);
+//    EXPECT_TRUE(buffer.size() > 0);
+//    EXPECT_TRUE(reports.ParseFromArray(&buffer[0], buffer.size()));
+//    backfillDimensionPath(&reports);
+//    backfillStartEndTimestamp(&reports);
+//    EXPECT_EQ(1, reports.reports_size());
+//    EXPECT_EQ(2, reports.reports(0).metrics_size());
+//    EXPECT_EQ(5, reports.reports(0).metrics(0).count_metrics().data_size());
+//    EXPECT_EQ(5, reports.reports(0).metrics(1).count_metrics().data_size());
+//
+//    StatsLogReport::CountMetricDataWrapper countMetrics;
+//
+//    sortMetricDataByDimensionsValue(
+//            reports.reports(0).metrics(0).count_metrics(), &countMetrics);
+//    EXPECT_EQ(5, countMetrics.data_size());
+//
+//    auto data = countMetrics.data(0);
+//    EXPECT_EQ(android::util::PROCESS_LIFE_CYCLE_STATE_CHANGED, data.dimensions_in_what().field());
+//    EXPECT_EQ(1, data.dimensions_in_what().value_tuple().dimensions_value_size());
+//    EXPECT_EQ(1 /* uid field */,
+//              data.dimensions_in_what().value_tuple().dimensions_value(0).field());
+//    EXPECT_EQ(222, data.dimensions_in_what().value_tuple().dimensions_value(0).value_int());
+//    EXPECT_EQ(1, data.bucket_info_size());
+//    EXPECT_EQ(1, data.bucket_info(0).count());
+//    EXPECT_EQ(bucketStartTimeNs, data.bucket_info(0).start_bucket_elapsed_nanos());
+//    EXPECT_EQ(bucketStartTimeNs + bucketSizeNs, data.bucket_info(0).end_bucket_elapsed_nanos());
+//
+//    data = countMetrics.data(1);
+//    EXPECT_EQ(android::util::PROCESS_LIFE_CYCLE_STATE_CHANGED, data.dimensions_in_what().field());
+//    EXPECT_EQ(1, data.dimensions_in_what().value_tuple().dimensions_value_size());
+//    EXPECT_EQ(1 /* uid field */,
+//              data.dimensions_in_what().value_tuple().dimensions_value(0).field());
+//    EXPECT_EQ(333, data.dimensions_in_what().value_tuple().dimensions_value(0).value_int());
+//    EXPECT_EQ(1, data.bucket_info_size());
+//    EXPECT_EQ(1, data.bucket_info(0).count());
+//    EXPECT_EQ(bucketStartTimeNs, data.bucket_info(0).start_bucket_elapsed_nanos());
+//    EXPECT_EQ(bucketStartTimeNs + bucketSizeNs, data.bucket_info(0).end_bucket_elapsed_nanos());
+//
+//    data = countMetrics.data(2);
+//    EXPECT_EQ(android::util::PROCESS_LIFE_CYCLE_STATE_CHANGED, data.dimensions_in_what().field());
+//    EXPECT_EQ(1, data.dimensions_in_what().value_tuple().dimensions_value_size());
+//    EXPECT_EQ(1 /* uid field */,
+//              data.dimensions_in_what().value_tuple().dimensions_value(0).field());
+//    EXPECT_EQ(444, data.dimensions_in_what().value_tuple().dimensions_value(0).value_int());
+//    EXPECT_EQ(1, data.bucket_info_size());
+//    EXPECT_EQ(1, data.bucket_info(0).count());
+//    // Partial bucket as metric is deactivated.
+//    EXPECT_EQ(bucketStartTimeNs + bucketSizeNs, data.bucket_info(0).start_bucket_elapsed_nanos());
+//    EXPECT_EQ(bucketStartTimeNs + NS_PER_SEC * 60 * 8,
+//              data.bucket_info(0).end_bucket_elapsed_nanos());
+//
+//    data = countMetrics.data(3);
+//    EXPECT_EQ(android::util::PROCESS_LIFE_CYCLE_STATE_CHANGED, data.dimensions_in_what().field());
+//    EXPECT_EQ(1, data.dimensions_in_what().value_tuple().dimensions_value_size());
+//    EXPECT_EQ(1 /* uid field */,
+//              data.dimensions_in_what().value_tuple().dimensions_value(0).field());
+//    EXPECT_EQ(666, data.dimensions_in_what().value_tuple().dimensions_value(0).value_int());
+//    EXPECT_EQ(1, data.bucket_info_size());
+//    EXPECT_EQ(1, data.bucket_info(0).count());
+//    EXPECT_EQ(bucketStartTimeNs + 2 * bucketSizeNs,
+//              data.bucket_info(0).start_bucket_elapsed_nanos());
+//    EXPECT_EQ(bucketStartTimeNs + NS_PER_SEC * 60 * 11,
+//              data.bucket_info(0).end_bucket_elapsed_nanos());
+//
+//    data = countMetrics.data(4);
+//    EXPECT_EQ(android::util::PROCESS_LIFE_CYCLE_STATE_CHANGED, data.dimensions_in_what().field());
+//    EXPECT_EQ(1, data.dimensions_in_what().value_tuple().dimensions_value_size());
+//    EXPECT_EQ(1 /* uid field */,
+//              data.dimensions_in_what().value_tuple().dimensions_value(0).field());
+//    EXPECT_EQ(777, data.dimensions_in_what().value_tuple().dimensions_value(0).value_int());
+//    EXPECT_EQ(1, data.bucket_info_size());
+//    EXPECT_EQ(1, data.bucket_info(0).count());
+//    EXPECT_EQ(bucketStartTimeNs + 2 * bucketSizeNs,
+//              data.bucket_info(0).start_bucket_elapsed_nanos());
+//    EXPECT_EQ(bucketStartTimeNs + NS_PER_SEC * 60 * 11,
+//              data.bucket_info(0).end_bucket_elapsed_nanos());
+//
+//
+//   countMetrics.clear_data();
+//    sortMetricDataByDimensionsValue(
+//            reports.reports(0).metrics(1).count_metrics(), &countMetrics);
+//    EXPECT_EQ(5, countMetrics.data_size());
+//
+//    data = countMetrics.data(0);
+//    EXPECT_EQ(android::util::ACTIVITY_FOREGROUND_STATE_CHANGED, data.dimensions_in_what().field());
+//    EXPECT_EQ(1, data.dimensions_in_what().value_tuple().dimensions_value_size());
+//    EXPECT_EQ(1 /* uid field */,
+//              data.dimensions_in_what().value_tuple().dimensions_value(0).field());
+//    EXPECT_EQ(2222, data.dimensions_in_what().value_tuple().dimensions_value(0).value_int());
+//    EXPECT_EQ(1, data.bucket_info_size());
+//    EXPECT_EQ(1, data.bucket_info(0).count());
+//    EXPECT_EQ(bucketStartTimeNs, data.bucket_info(0).start_bucket_elapsed_nanos());
+//    EXPECT_EQ(bucketStartTimeNs + bucketSizeNs, data.bucket_info(0).end_bucket_elapsed_nanos());
+//
+//    data = countMetrics.data(1);
+//    EXPECT_EQ(android::util::ACTIVITY_FOREGROUND_STATE_CHANGED, data.dimensions_in_what().field());
+//    EXPECT_EQ(1, data.dimensions_in_what().value_tuple().dimensions_value_size());
+//    EXPECT_EQ(1 /* uid field */,
+//              data.dimensions_in_what().value_tuple().dimensions_value(0).field());
+//    EXPECT_EQ(3333, data.dimensions_in_what().value_tuple().dimensions_value(0).value_int());
+//    EXPECT_EQ(1, data.bucket_info_size());
+//    EXPECT_EQ(1, data.bucket_info(0).count());
+//    EXPECT_EQ(bucketStartTimeNs, data.bucket_info(0).start_bucket_elapsed_nanos());
+//    EXPECT_EQ(bucketStartTimeNs + bucketSizeNs, data.bucket_info(0).end_bucket_elapsed_nanos());
+//
+//    data = countMetrics.data(2);
+//    EXPECT_EQ(android::util::ACTIVITY_FOREGROUND_STATE_CHANGED, data.dimensions_in_what().field());
+//    EXPECT_EQ(1, data.dimensions_in_what().value_tuple().dimensions_value_size());
+//    EXPECT_EQ(1 /* uid field */,
+//              data.dimensions_in_what().value_tuple().dimensions_value(0).field());
+//    EXPECT_EQ(4444, data.dimensions_in_what().value_tuple().dimensions_value(0).value_int());
+//    EXPECT_EQ(1, data.bucket_info_size());
+//    EXPECT_EQ(1, data.bucket_info(0).count());
+//    // Partial bucket as metric is deactivated.
+//    EXPECT_EQ(bucketStartTimeNs + bucketSizeNs, data.bucket_info(0).start_bucket_elapsed_nanos());
+//    EXPECT_EQ(bucketStartTimeNs + NS_PER_SEC * 60 * 8,
+//              data.bucket_info(0).end_bucket_elapsed_nanos());
+//
+//    data = countMetrics.data(3);
+//    EXPECT_EQ(android::util::ACTIVITY_FOREGROUND_STATE_CHANGED, data.dimensions_in_what().field());
+//    EXPECT_EQ(1, data.dimensions_in_what().value_tuple().dimensions_value_size());
+//    EXPECT_EQ(1 /* uid field */,
+//              data.dimensions_in_what().value_tuple().dimensions_value(0).field());
+//    EXPECT_EQ(6666, data.dimensions_in_what().value_tuple().dimensions_value(0).value_int());
+//    EXPECT_EQ(1, data.bucket_info_size());
+//    EXPECT_EQ(1, data.bucket_info(0).count());
+//    EXPECT_EQ(bucketStartTimeNs + 2 * bucketSizeNs,
+//              data.bucket_info(0).start_bucket_elapsed_nanos());
+//    EXPECT_EQ(bucketStartTimeNs + NS_PER_SEC * 60 * 11,
+//              data.bucket_info(0).end_bucket_elapsed_nanos());
+//
+//    data = countMetrics.data(4);
+//    EXPECT_EQ(android::util::ACTIVITY_FOREGROUND_STATE_CHANGED, data.dimensions_in_what().field());
+//    EXPECT_EQ(1, data.dimensions_in_what().value_tuple().dimensions_value_size());
+//    EXPECT_EQ(1 /* uid field */,
+//              data.dimensions_in_what().value_tuple().dimensions_value(0).field());
+//    EXPECT_EQ(7777, data.dimensions_in_what().value_tuple().dimensions_value(0).value_int());
+//    EXPECT_EQ(1, data.bucket_info_size());
+//    EXPECT_EQ(1, data.bucket_info(0).count());
+//    EXPECT_EQ(bucketStartTimeNs + 2 * bucketSizeNs,
+//              data.bucket_info(0).start_bucket_elapsed_nanos());
+//    EXPECT_EQ(bucketStartTimeNs + NS_PER_SEC * 60 * 11,
+//              data.bucket_info(0).end_bucket_elapsed_nanos());
+//}
 
 #else
 GTEST_LOG_(INFO) << "This test does nothing.\n";
diff --git a/cmds/statsd/tests/e2e/MetricConditionLink_e2e_test.cpp b/cmds/statsd/tests/e2e/MetricConditionLink_e2e_test.cpp
index 78fb391..7d93fcc 100644
--- a/cmds/statsd/tests/e2e/MetricConditionLink_e2e_test.cpp
+++ b/cmds/statsd/tests/e2e/MetricConditionLink_e2e_test.cpp
@@ -97,249 +97,250 @@
 }
 }  // namespace
 
-// If we want to test multiple dump data, we must do it in separate tests, because in the e2e tests,
-// we should use the real API which will clear the data after dump data is called.
-TEST(MetricConditionLinkE2eTest, TestMultiplePredicatesAndLinks1) {
-    auto config = CreateStatsdConfig();
-    uint64_t bucketStartTimeNs = 10000000000;
-    uint64_t bucketSizeNs =
-        TimeUnitToBucketSizeInMillis(config.count_metric(0).bucket()) * 1000000LL;
-
-    ConfigKey cfgKey;
-    auto processor = CreateStatsLogProcessor(bucketStartTimeNs, bucketStartTimeNs, config, cfgKey);
-    EXPECT_EQ(processor->mMetricsManagers.size(), 1u);
-    EXPECT_TRUE(processor->mMetricsManagers.begin()->second->isConfigValid());
-
-    int appUid = 123;
-    auto crashEvent1 = CreateAppCrashEvent(appUid, bucketStartTimeNs + 1);
-    auto crashEvent2 = CreateAppCrashEvent(appUid, bucketStartTimeNs + 201);
-    auto crashEvent3= CreateAppCrashEvent(appUid, bucketStartTimeNs + 2 * bucketSizeNs - 101);
-
-    auto crashEvent4 = CreateAppCrashEvent(appUid, bucketStartTimeNs + 51);
-    auto crashEvent5 = CreateAppCrashEvent(appUid, bucketStartTimeNs + bucketSizeNs + 299);
-    auto crashEvent6 = CreateAppCrashEvent(appUid, bucketStartTimeNs + bucketSizeNs + 2001);
-
-    auto crashEvent7 = CreateAppCrashEvent(appUid, bucketStartTimeNs + 16);
-    auto crashEvent8 = CreateAppCrashEvent(appUid, bucketStartTimeNs + bucketSizeNs + 249);
-
-    auto crashEvent9 = CreateAppCrashEvent(appUid, bucketStartTimeNs + bucketSizeNs + 351);
-    auto crashEvent10 = CreateAppCrashEvent(appUid, bucketStartTimeNs + 2 * bucketSizeNs - 2);
-
-    auto screenTurnedOnEvent =
-        CreateScreenStateChangedEvent(android::view::DisplayStateEnum::DISPLAY_STATE_ON,
-                                      bucketStartTimeNs + 2);
-    auto screenTurnedOffEvent =
-        CreateScreenStateChangedEvent(android::view::DisplayStateEnum::DISPLAY_STATE_OFF,
-                                      bucketStartTimeNs + 200);
-    auto screenTurnedOnEvent2 =
-        CreateScreenStateChangedEvent(android::view::DisplayStateEnum::DISPLAY_STATE_ON,
-                                      bucketStartTimeNs + 2 * bucketSizeNs - 100);
-
-    std::vector<AttributionNodeInternal> attributions = {
-            CreateAttribution(appUid, "App1"), CreateAttribution(appUid + 1, "GMSCoreModule1")};
-    auto syncOnEvent1 =
-        CreateSyncStartEvent(attributions, "ReadEmail", bucketStartTimeNs + 50);
-    auto syncOffEvent1 =
-        CreateSyncEndEvent(attributions, "ReadEmail", bucketStartTimeNs + bucketSizeNs + 300);
-    auto syncOnEvent2 =
-        CreateSyncStartEvent(attributions, "ReadDoc", bucketStartTimeNs + bucketSizeNs + 2000);
-
-    auto moveToBackgroundEvent1 =
-        CreateMoveToBackgroundEvent(appUid, bucketStartTimeNs + 15);
-    auto moveToForegroundEvent1 =
-        CreateMoveToForegroundEvent(appUid, bucketStartTimeNs + bucketSizeNs + 250);
-
-    auto moveToBackgroundEvent2 =
-        CreateMoveToBackgroundEvent(appUid, bucketStartTimeNs + bucketSizeNs + 350);
-    auto moveToForegroundEvent2 =
-        CreateMoveToForegroundEvent(appUid, bucketStartTimeNs + 2 * bucketSizeNs - 1);
-
-    /*
-                    bucket #1                               bucket #2
-
-
-       |      |   |  |                      |   |          |        |   |   |     (crashEvents)
-    |-------------------------------------|-----------------------------------|---------
-
-             |                                           |                        (MoveToBkground)
-
-                                             |                               |    (MoveToForeground)
-
-                |                                                 |                (SyncIsOn)
-                                                  |                                (SyncIsOff)
-          |                                                               |        (ScreenIsOn)
-                   |                                                               (ScreenIsOff)
-    */
-    std::vector<std::unique_ptr<LogEvent>> events;
-    events.push_back(std::move(crashEvent1));
-    events.push_back(std::move(crashEvent2));
-    events.push_back(std::move(crashEvent3));
-    events.push_back(std::move(crashEvent4));
-    events.push_back(std::move(crashEvent5));
-    events.push_back(std::move(crashEvent6));
-    events.push_back(std::move(crashEvent7));
-    events.push_back(std::move(crashEvent8));
-    events.push_back(std::move(crashEvent9));
-    events.push_back(std::move(crashEvent10));
-    events.push_back(std::move(screenTurnedOnEvent));
-    events.push_back(std::move(screenTurnedOffEvent));
-    events.push_back(std::move(screenTurnedOnEvent2));
-    events.push_back(std::move(syncOnEvent1));
-    events.push_back(std::move(syncOffEvent1));
-    events.push_back(std::move(syncOnEvent2));
-    events.push_back(std::move(moveToBackgroundEvent1));
-    events.push_back(std::move(moveToForegroundEvent1));
-    events.push_back(std::move(moveToBackgroundEvent2));
-    events.push_back(std::move(moveToForegroundEvent2));
-
-    sortLogEventsByTimestamp(&events);
-
-    for (const auto& event : events) {
-        processor->OnLogEvent(event.get());
-    }
-    ConfigMetricsReportList reports;
-    vector<uint8_t> buffer;
-    processor->onDumpReport(cfgKey, bucketStartTimeNs + 2 * bucketSizeNs - 1, false, true,
-                            ADB_DUMP, FAST, &buffer);
-    EXPECT_TRUE(buffer.size() > 0);
-    EXPECT_TRUE(reports.ParseFromArray(&buffer[0], buffer.size()));
-    backfillDimensionPath(&reports);
-    backfillStringInReport(&reports);
-    backfillStartEndTimestamp(&reports);
-    EXPECT_EQ(reports.reports_size(), 1);
-    EXPECT_EQ(reports.reports(0).metrics_size(), 1);
-    EXPECT_EQ(reports.reports(0).metrics(0).count_metrics().data_size(), 1);
-    EXPECT_EQ(reports.reports(0).metrics(0).count_metrics().data(0).bucket_info_size(), 1);
-    EXPECT_EQ(reports.reports(0).metrics(0).count_metrics().data(0).bucket_info(0).count(), 1);
-    auto data = reports.reports(0).metrics(0).count_metrics().data(0);
-    // Validate dimension value.
-    EXPECT_EQ(data.dimensions_in_what().field(), android::util::PROCESS_LIFE_CYCLE_STATE_CHANGED);
-    EXPECT_EQ(data.dimensions_in_what().value_tuple().dimensions_value_size(), 1);
-    // Uid field.
-    EXPECT_EQ(data.dimensions_in_what().value_tuple().dimensions_value(0).field(), 1);
-    EXPECT_EQ(data.dimensions_in_what().value_tuple().dimensions_value(0).value_int(), appUid);
-}
-
-TEST(MetricConditionLinkE2eTest, TestMultiplePredicatesAndLinks2) {
-    auto config = CreateStatsdConfig();
-    uint64_t bucketStartTimeNs = 10000000000;
-    uint64_t bucketSizeNs =
-            TimeUnitToBucketSizeInMillis(config.count_metric(0).bucket()) * 1000000LL;
-
-    ConfigKey cfgKey;
-    auto processor = CreateStatsLogProcessor(
-            bucketStartTimeNs, bucketStartTimeNs, config, cfgKey);
-    EXPECT_EQ(processor->mMetricsManagers.size(), 1u);
-    EXPECT_TRUE(processor->mMetricsManagers.begin()->second->isConfigValid());
-
-    int appUid = 123;
-    auto crashEvent1 = CreateAppCrashEvent(appUid, bucketStartTimeNs + 1);
-    auto crashEvent2 = CreateAppCrashEvent(appUid, bucketStartTimeNs + 201);
-    auto crashEvent3 = CreateAppCrashEvent(appUid, bucketStartTimeNs + 2 * bucketSizeNs - 101);
-
-    auto crashEvent4 = CreateAppCrashEvent(appUid, bucketStartTimeNs + 51);
-    auto crashEvent5 = CreateAppCrashEvent(appUid, bucketStartTimeNs + bucketSizeNs + 299);
-    auto crashEvent6 = CreateAppCrashEvent(appUid, bucketStartTimeNs + bucketSizeNs + 2001);
-
-    auto crashEvent7 = CreateAppCrashEvent(appUid, bucketStartTimeNs + 16);
-    auto crashEvent8 = CreateAppCrashEvent(appUid, bucketStartTimeNs + bucketSizeNs + 249);
-
-    auto crashEvent9 = CreateAppCrashEvent(appUid, bucketStartTimeNs + bucketSizeNs + 351);
-    auto crashEvent10 = CreateAppCrashEvent(appUid, bucketStartTimeNs + 2 * bucketSizeNs - 2);
-
-    auto screenTurnedOnEvent = CreateScreenStateChangedEvent(
-            android::view::DisplayStateEnum::DISPLAY_STATE_ON, bucketStartTimeNs + 2);
-    auto screenTurnedOffEvent = CreateScreenStateChangedEvent(
-            android::view::DisplayStateEnum::DISPLAY_STATE_OFF, bucketStartTimeNs + 200);
-    auto screenTurnedOnEvent2 =
-            CreateScreenStateChangedEvent(android::view::DisplayStateEnum::DISPLAY_STATE_ON,
-                                          bucketStartTimeNs + 2 * bucketSizeNs - 100);
-
-    std::vector<AttributionNodeInternal> attributions = {
-            CreateAttribution(appUid, "App1"), CreateAttribution(appUid + 1, "GMSCoreModule1")};
-    auto syncOnEvent1 = CreateSyncStartEvent(attributions, "ReadEmail", bucketStartTimeNs + 50);
-    auto syncOffEvent1 =
-            CreateSyncEndEvent(attributions, "ReadEmail", bucketStartTimeNs + bucketSizeNs + 300);
-    auto syncOnEvent2 =
-            CreateSyncStartEvent(attributions, "ReadDoc", bucketStartTimeNs + bucketSizeNs + 2000);
-
-    auto moveToBackgroundEvent1 = CreateMoveToBackgroundEvent(appUid, bucketStartTimeNs + 15);
-    auto moveToForegroundEvent1 =
-            CreateMoveToForegroundEvent(appUid, bucketStartTimeNs + bucketSizeNs + 250);
-
-    auto moveToBackgroundEvent2 =
-            CreateMoveToBackgroundEvent(appUid, bucketStartTimeNs + bucketSizeNs + 350);
-    auto moveToForegroundEvent2 =
-            CreateMoveToForegroundEvent(appUid, bucketStartTimeNs + 2 * bucketSizeNs - 1);
-
-    /*
-                    bucket #1                               bucket #2
-
-
-       |      |   |  |                      |   |          |        |   |   |     (crashEvents)
-    |-------------------------------------|-----------------------------------|---------
-
-             |                                           |                        (MoveToBkground)
-
-                                             |                               |    (MoveToForeground)
-
-                |                                                 |                (SyncIsOn)
-                                                  |                                (SyncIsOff)
-          |                                                               |        (ScreenIsOn)
-                   |                                                               (ScreenIsOff)
-    */
-    std::vector<std::unique_ptr<LogEvent>> events;
-    events.push_back(std::move(crashEvent1));
-    events.push_back(std::move(crashEvent2));
-    events.push_back(std::move(crashEvent3));
-    events.push_back(std::move(crashEvent4));
-    events.push_back(std::move(crashEvent5));
-    events.push_back(std::move(crashEvent6));
-    events.push_back(std::move(crashEvent7));
-    events.push_back(std::move(crashEvent8));
-    events.push_back(std::move(crashEvent9));
-    events.push_back(std::move(crashEvent10));
-    events.push_back(std::move(screenTurnedOnEvent));
-    events.push_back(std::move(screenTurnedOffEvent));
-    events.push_back(std::move(screenTurnedOnEvent2));
-    events.push_back(std::move(syncOnEvent1));
-    events.push_back(std::move(syncOffEvent1));
-    events.push_back(std::move(syncOnEvent2));
-    events.push_back(std::move(moveToBackgroundEvent1));
-    events.push_back(std::move(moveToForegroundEvent1));
-    events.push_back(std::move(moveToBackgroundEvent2));
-    events.push_back(std::move(moveToForegroundEvent2));
-
-    sortLogEventsByTimestamp(&events);
-
-    for (const auto& event : events) {
-        processor->OnLogEvent(event.get());
-    }
-    ConfigMetricsReportList reports;
-    vector<uint8_t> buffer;
-
-    processor->onDumpReport(cfgKey, bucketStartTimeNs + 2 * bucketSizeNs + 1, false, true,
-                            ADB_DUMP, FAST, &buffer);
-    EXPECT_TRUE(buffer.size() > 0);
-    EXPECT_TRUE(reports.ParseFromArray(&buffer[0], buffer.size()));
-    backfillDimensionPath(&reports);
-    backfillStringInReport(&reports);
-    backfillStartEndTimestamp(&reports);
-    EXPECT_EQ(reports.reports_size(), 1);
-    EXPECT_EQ(reports.reports(0).metrics_size(), 1);
-    EXPECT_EQ(reports.reports(0).metrics(0).count_metrics().data_size(), 1);
-    EXPECT_EQ(reports.reports(0).metrics(0).count_metrics().data(0).bucket_info_size(), 2);
-    EXPECT_EQ(reports.reports(0).metrics(0).count_metrics().data(0).bucket_info(0).count(), 1);
-    EXPECT_EQ(reports.reports(0).metrics(0).count_metrics().data(0).bucket_info(1).count(), 3);
-    auto data = reports.reports(0).metrics(0).count_metrics().data(0);
-    // Validate dimension value.
-    EXPECT_EQ(data.dimensions_in_what().field(),
-              android::util::PROCESS_LIFE_CYCLE_STATE_CHANGED);
-    EXPECT_EQ(data.dimensions_in_what().value_tuple().dimensions_value_size(), 1);
-    // Uid field.
-    EXPECT_EQ(data.dimensions_in_what().value_tuple().dimensions_value(0).field(), 1);
-    EXPECT_EQ(data.dimensions_in_what().value_tuple().dimensions_value(0).value_int(), appUid);
-}
+// TODO(b/149590301): Update these tests to use new socket schema.
+//// If we want to test multiple dump data, we must do it in separate tests, because in the e2e tests,
+//// we should use the real API which will clear the data after dump data is called.
+//TEST(MetricConditionLinkE2eTest, TestMultiplePredicatesAndLinks1) {
+//    auto config = CreateStatsdConfig();
+//    uint64_t bucketStartTimeNs = 10000000000;
+//    uint64_t bucketSizeNs =
+//        TimeUnitToBucketSizeInMillis(config.count_metric(0).bucket()) * 1000000LL;
+//
+//    ConfigKey cfgKey;
+//    auto processor = CreateStatsLogProcessor(bucketStartTimeNs, bucketStartTimeNs, config, cfgKey);
+//    EXPECT_EQ(processor->mMetricsManagers.size(), 1u);
+//    EXPECT_TRUE(processor->mMetricsManagers.begin()->second->isConfigValid());
+//
+//    int appUid = 123;
+//    auto crashEvent1 = CreateAppCrashEvent(appUid, bucketStartTimeNs + 1);
+//    auto crashEvent2 = CreateAppCrashEvent(appUid, bucketStartTimeNs + 201);
+//    auto crashEvent3= CreateAppCrashEvent(appUid, bucketStartTimeNs + 2 * bucketSizeNs - 101);
+//
+//    auto crashEvent4 = CreateAppCrashEvent(appUid, bucketStartTimeNs + 51);
+//    auto crashEvent5 = CreateAppCrashEvent(appUid, bucketStartTimeNs + bucketSizeNs + 299);
+//    auto crashEvent6 = CreateAppCrashEvent(appUid, bucketStartTimeNs + bucketSizeNs + 2001);
+//
+//    auto crashEvent7 = CreateAppCrashEvent(appUid, bucketStartTimeNs + 16);
+//    auto crashEvent8 = CreateAppCrashEvent(appUid, bucketStartTimeNs + bucketSizeNs + 249);
+//
+//    auto crashEvent9 = CreateAppCrashEvent(appUid, bucketStartTimeNs + bucketSizeNs + 351);
+//    auto crashEvent10 = CreateAppCrashEvent(appUid, bucketStartTimeNs + 2 * bucketSizeNs - 2);
+//
+//    auto screenTurnedOnEvent =
+//        CreateScreenStateChangedEvent(android::view::DisplayStateEnum::DISPLAY_STATE_ON,
+//                                      bucketStartTimeNs + 2);
+//    auto screenTurnedOffEvent =
+//        CreateScreenStateChangedEvent(android::view::DisplayStateEnum::DISPLAY_STATE_OFF,
+//                                      bucketStartTimeNs + 200);
+//    auto screenTurnedOnEvent2 =
+//        CreateScreenStateChangedEvent(android::view::DisplayStateEnum::DISPLAY_STATE_ON,
+//                                      bucketStartTimeNs + 2 * bucketSizeNs - 100);
+//
+//    std::vector<AttributionNodeInternal> attributions = {
+//            CreateAttribution(appUid, "App1"), CreateAttribution(appUid + 1, "GMSCoreModule1")};
+//    auto syncOnEvent1 =
+//        CreateSyncStartEvent(attributions, "ReadEmail", bucketStartTimeNs + 50);
+//    auto syncOffEvent1 =
+//        CreateSyncEndEvent(attributions, "ReadEmail", bucketStartTimeNs + bucketSizeNs + 300);
+//    auto syncOnEvent2 =
+//        CreateSyncStartEvent(attributions, "ReadDoc", bucketStartTimeNs + bucketSizeNs + 2000);
+//
+//    auto moveToBackgroundEvent1 =
+//        CreateMoveToBackgroundEvent(appUid, bucketStartTimeNs + 15);
+//    auto moveToForegroundEvent1 =
+//        CreateMoveToForegroundEvent(appUid, bucketStartTimeNs + bucketSizeNs + 250);
+//
+//    auto moveToBackgroundEvent2 =
+//        CreateMoveToBackgroundEvent(appUid, bucketStartTimeNs + bucketSizeNs + 350);
+//    auto moveToForegroundEvent2 =
+//        CreateMoveToForegroundEvent(appUid, bucketStartTimeNs + 2 * bucketSizeNs - 1);
+//
+//    /*
+//                    bucket #1                               bucket #2
+//
+//
+//       |      |   |  |                      |   |          |        |   |   |     (crashEvents)
+//    |-------------------------------------|-----------------------------------|---------
+//
+//             |                                           |                        (MoveToBkground)
+//
+//                                             |                               |    (MoveToForeground)
+//
+//                |                                                 |                (SyncIsOn)
+//                                                  |                                (SyncIsOff)
+//          |                                                               |        (ScreenIsOn)
+//                   |                                                               (ScreenIsOff)
+//    */
+//    std::vector<std::unique_ptr<LogEvent>> events;
+//    events.push_back(std::move(crashEvent1));
+//    events.push_back(std::move(crashEvent2));
+//    events.push_back(std::move(crashEvent3));
+//    events.push_back(std::move(crashEvent4));
+//    events.push_back(std::move(crashEvent5));
+//    events.push_back(std::move(crashEvent6));
+//    events.push_back(std::move(crashEvent7));
+//    events.push_back(std::move(crashEvent8));
+//    events.push_back(std::move(crashEvent9));
+//    events.push_back(std::move(crashEvent10));
+//    events.push_back(std::move(screenTurnedOnEvent));
+//    events.push_back(std::move(screenTurnedOffEvent));
+//    events.push_back(std::move(screenTurnedOnEvent2));
+//    events.push_back(std::move(syncOnEvent1));
+//    events.push_back(std::move(syncOffEvent1));
+//    events.push_back(std::move(syncOnEvent2));
+//    events.push_back(std::move(moveToBackgroundEvent1));
+//    events.push_back(std::move(moveToForegroundEvent1));
+//    events.push_back(std::move(moveToBackgroundEvent2));
+//    events.push_back(std::move(moveToForegroundEvent2));
+//
+//    sortLogEventsByTimestamp(&events);
+//
+//    for (const auto& event : events) {
+//        processor->OnLogEvent(event.get());
+//    }
+//    ConfigMetricsReportList reports;
+//    vector<uint8_t> buffer;
+//    processor->onDumpReport(cfgKey, bucketStartTimeNs + 2 * bucketSizeNs - 1, false, true,
+//                            ADB_DUMP, FAST, &buffer);
+//    EXPECT_TRUE(buffer.size() > 0);
+//    EXPECT_TRUE(reports.ParseFromArray(&buffer[0], buffer.size()));
+//    backfillDimensionPath(&reports);
+//    backfillStringInReport(&reports);
+//    backfillStartEndTimestamp(&reports);
+//    EXPECT_EQ(reports.reports_size(), 1);
+//    EXPECT_EQ(reports.reports(0).metrics_size(), 1);
+//    EXPECT_EQ(reports.reports(0).metrics(0).count_metrics().data_size(), 1);
+//    EXPECT_EQ(reports.reports(0).metrics(0).count_metrics().data(0).bucket_info_size(), 1);
+//    EXPECT_EQ(reports.reports(0).metrics(0).count_metrics().data(0).bucket_info(0).count(), 1);
+//    auto data = reports.reports(0).metrics(0).count_metrics().data(0);
+//    // Validate dimension value.
+//    EXPECT_EQ(data.dimensions_in_what().field(), android::util::PROCESS_LIFE_CYCLE_STATE_CHANGED);
+//    EXPECT_EQ(data.dimensions_in_what().value_tuple().dimensions_value_size(), 1);
+//    // Uid field.
+//    EXPECT_EQ(data.dimensions_in_what().value_tuple().dimensions_value(0).field(), 1);
+//    EXPECT_EQ(data.dimensions_in_what().value_tuple().dimensions_value(0).value_int(), appUid);
+//}
+//
+//TEST(MetricConditionLinkE2eTest, TestMultiplePredicatesAndLinks2) {
+//    auto config = CreateStatsdConfig();
+//    uint64_t bucketStartTimeNs = 10000000000;
+//    uint64_t bucketSizeNs =
+//            TimeUnitToBucketSizeInMillis(config.count_metric(0).bucket()) * 1000000LL;
+//
+//    ConfigKey cfgKey;
+//    auto processor = CreateStatsLogProcessor(
+//            bucketStartTimeNs, bucketStartTimeNs, config, cfgKey);
+//    EXPECT_EQ(processor->mMetricsManagers.size(), 1u);
+//    EXPECT_TRUE(processor->mMetricsManagers.begin()->second->isConfigValid());
+//
+//    int appUid = 123;
+//    auto crashEvent1 = CreateAppCrashEvent(appUid, bucketStartTimeNs + 1);
+//    auto crashEvent2 = CreateAppCrashEvent(appUid, bucketStartTimeNs + 201);
+//    auto crashEvent3 = CreateAppCrashEvent(appUid, bucketStartTimeNs + 2 * bucketSizeNs - 101);
+//
+//    auto crashEvent4 = CreateAppCrashEvent(appUid, bucketStartTimeNs + 51);
+//    auto crashEvent5 = CreateAppCrashEvent(appUid, bucketStartTimeNs + bucketSizeNs + 299);
+//    auto crashEvent6 = CreateAppCrashEvent(appUid, bucketStartTimeNs + bucketSizeNs + 2001);
+//
+//    auto crashEvent7 = CreateAppCrashEvent(appUid, bucketStartTimeNs + 16);
+//    auto crashEvent8 = CreateAppCrashEvent(appUid, bucketStartTimeNs + bucketSizeNs + 249);
+//
+//    auto crashEvent9 = CreateAppCrashEvent(appUid, bucketStartTimeNs + bucketSizeNs + 351);
+//    auto crashEvent10 = CreateAppCrashEvent(appUid, bucketStartTimeNs + 2 * bucketSizeNs - 2);
+//
+//    auto screenTurnedOnEvent = CreateScreenStateChangedEvent(
+//            android::view::DisplayStateEnum::DISPLAY_STATE_ON, bucketStartTimeNs + 2);
+//    auto screenTurnedOffEvent = CreateScreenStateChangedEvent(
+//            android::view::DisplayStateEnum::DISPLAY_STATE_OFF, bucketStartTimeNs + 200);
+//    auto screenTurnedOnEvent2 =
+//            CreateScreenStateChangedEvent(android::view::DisplayStateEnum::DISPLAY_STATE_ON,
+//                                          bucketStartTimeNs + 2 * bucketSizeNs - 100);
+//
+//    std::vector<AttributionNodeInternal> attributions = {
+//            CreateAttribution(appUid, "App1"), CreateAttribution(appUid + 1, "GMSCoreModule1")};
+//    auto syncOnEvent1 = CreateSyncStartEvent(attributions, "ReadEmail", bucketStartTimeNs + 50);
+//    auto syncOffEvent1 =
+//            CreateSyncEndEvent(attributions, "ReadEmail", bucketStartTimeNs + bucketSizeNs + 300);
+//    auto syncOnEvent2 =
+//            CreateSyncStartEvent(attributions, "ReadDoc", bucketStartTimeNs + bucketSizeNs + 2000);
+//
+//    auto moveToBackgroundEvent1 = CreateMoveToBackgroundEvent(appUid, bucketStartTimeNs + 15);
+//    auto moveToForegroundEvent1 =
+//            CreateMoveToForegroundEvent(appUid, bucketStartTimeNs + bucketSizeNs + 250);
+//
+//    auto moveToBackgroundEvent2 =
+//            CreateMoveToBackgroundEvent(appUid, bucketStartTimeNs + bucketSizeNs + 350);
+//    auto moveToForegroundEvent2 =
+//            CreateMoveToForegroundEvent(appUid, bucketStartTimeNs + 2 * bucketSizeNs - 1);
+//
+//    /*
+//                    bucket #1                               bucket #2
+//
+//
+//       |      |   |  |                      |   |          |        |   |   |     (crashEvents)
+//    |-------------------------------------|-----------------------------------|---------
+//
+//             |                                           |                        (MoveToBkground)
+//
+//                                             |                               |    (MoveToForeground)
+//
+//                |                                                 |                (SyncIsOn)
+//                                                  |                                (SyncIsOff)
+//          |                                                               |        (ScreenIsOn)
+//                   |                                                               (ScreenIsOff)
+//    */
+//    std::vector<std::unique_ptr<LogEvent>> events;
+//    events.push_back(std::move(crashEvent1));
+//    events.push_back(std::move(crashEvent2));
+//    events.push_back(std::move(crashEvent3));
+//    events.push_back(std::move(crashEvent4));
+//    events.push_back(std::move(crashEvent5));
+//    events.push_back(std::move(crashEvent6));
+//    events.push_back(std::move(crashEvent7));
+//    events.push_back(std::move(crashEvent8));
+//    events.push_back(std::move(crashEvent9));
+//    events.push_back(std::move(crashEvent10));
+//    events.push_back(std::move(screenTurnedOnEvent));
+//    events.push_back(std::move(screenTurnedOffEvent));
+//    events.push_back(std::move(screenTurnedOnEvent2));
+//    events.push_back(std::move(syncOnEvent1));
+//    events.push_back(std::move(syncOffEvent1));
+//    events.push_back(std::move(syncOnEvent2));
+//    events.push_back(std::move(moveToBackgroundEvent1));
+//    events.push_back(std::move(moveToForegroundEvent1));
+//    events.push_back(std::move(moveToBackgroundEvent2));
+//    events.push_back(std::move(moveToForegroundEvent2));
+//
+//    sortLogEventsByTimestamp(&events);
+//
+//    for (const auto& event : events) {
+//        processor->OnLogEvent(event.get());
+//    }
+//    ConfigMetricsReportList reports;
+//    vector<uint8_t> buffer;
+//
+//    processor->onDumpReport(cfgKey, bucketStartTimeNs + 2 * bucketSizeNs + 1, false, true,
+//                            ADB_DUMP, FAST, &buffer);
+//    EXPECT_TRUE(buffer.size() > 0);
+//    EXPECT_TRUE(reports.ParseFromArray(&buffer[0], buffer.size()));
+//    backfillDimensionPath(&reports);
+//    backfillStringInReport(&reports);
+//    backfillStartEndTimestamp(&reports);
+//    EXPECT_EQ(reports.reports_size(), 1);
+//    EXPECT_EQ(reports.reports(0).metrics_size(), 1);
+//    EXPECT_EQ(reports.reports(0).metrics(0).count_metrics().data_size(), 1);
+//    EXPECT_EQ(reports.reports(0).metrics(0).count_metrics().data(0).bucket_info_size(), 2);
+//    EXPECT_EQ(reports.reports(0).metrics(0).count_metrics().data(0).bucket_info(0).count(), 1);
+//    EXPECT_EQ(reports.reports(0).metrics(0).count_metrics().data(0).bucket_info(1).count(), 3);
+//    auto data = reports.reports(0).metrics(0).count_metrics().data(0);
+//    // Validate dimension value.
+//    EXPECT_EQ(data.dimensions_in_what().field(),
+//              android::util::PROCESS_LIFE_CYCLE_STATE_CHANGED);
+//    EXPECT_EQ(data.dimensions_in_what().value_tuple().dimensions_value_size(), 1);
+//    // Uid field.
+//    EXPECT_EQ(data.dimensions_in_what().value_tuple().dimensions_value(0).field(), 1);
+//    EXPECT_EQ(data.dimensions_in_what().value_tuple().dimensions_value(0).value_int(), appUid);
+//}
 
 #else
 GTEST_LOG_(INFO) << "This test does nothing.\n";
diff --git a/cmds/statsd/tests/e2e/PartialBucket_e2e_test.cpp b/cmds/statsd/tests/e2e/PartialBucket_e2e_test.cpp
index 1eecbe5..9ec831b 100644
--- a/cmds/statsd/tests/e2e/PartialBucket_e2e_test.cpp
+++ b/cmds/statsd/tests/e2e/PartialBucket_e2e_test.cpp
@@ -113,95 +113,96 @@
 }
 }  // anonymous namespace
 
-TEST(PartialBucketE2eTest, TestCountMetricWithoutSplit) {
-    shared_ptr<StatsService> service = SharedRefBase::make<StatsService>(nullptr, nullptr);
-    SendConfig(service, MakeConfig());
-    int64_t start = getElapsedRealtimeNs();  // This is the start-time the metrics producers are
-                                             // initialized with.
-
-    service->mProcessor->OnLogEvent(CreateAppCrashEvent(100, start + 1).get());
-    service->mProcessor->OnLogEvent(CreateAppCrashEvent(100, start + 2).get());
-
-    ConfigMetricsReport report = GetReports(service->mProcessor, start + 3);
-    // Expect no metrics since the bucket has not finished yet.
-    EXPECT_EQ(1, report.metrics_size());
-    EXPECT_EQ(0, report.metrics(0).count_metrics().data_size());
-}
-
-TEST(PartialBucketE2eTest, TestCountMetricNoSplitOnNewApp) {
-    shared_ptr<StatsService> service = SharedRefBase::make<StatsService>(nullptr, nullptr);
-    SendConfig(service, MakeConfig());
-    int64_t start = getElapsedRealtimeNs();  // This is the start-time the metrics producers are
-                                             // initialized with.
-
-    // Force the uidmap to update at timestamp 2.
-    service->mProcessor->OnLogEvent(CreateAppCrashEvent(100, start + 1).get());
-    // This is a new installation, so there shouldn't be a split (should be same as the without
-    // split case).
-    service->mUidMap->updateApp(start + 2, String16(kApp1.c_str()), 1, 2, String16("v2"),
-                               String16(""));
-    // Goes into the second bucket.
-    service->mProcessor->OnLogEvent(CreateAppCrashEvent(100, start + 3).get());
-
-    ConfigMetricsReport report = GetReports(service->mProcessor, start + 4);
-    EXPECT_EQ(1, report.metrics_size());
-    EXPECT_EQ(0, report.metrics(0).count_metrics().data_size());
-}
-
-TEST(PartialBucketE2eTest, TestCountMetricSplitOnUpgrade) {
-    shared_ptr<StatsService> service = SharedRefBase::make<StatsService>(nullptr, nullptr);
-    SendConfig(service, MakeConfig());
-    int64_t start = getElapsedRealtimeNs();  // This is the start-time the metrics producers are
-                                             // initialized with.
-    service->mUidMap->updateMap(start, {1}, {1}, {String16("v1")}, {String16(kApp1.c_str())},
-                                {String16("")});
-
-    // Force the uidmap to update at timestamp 2.
-    service->mProcessor->OnLogEvent(CreateAppCrashEvent(100, start + 1).get());
-    service->mUidMap->updateApp(start + 2, String16(kApp1.c_str()), 1, 2, String16("v2"),
-                               String16(""));
-    // Goes into the second bucket.
-    service->mProcessor->OnLogEvent(CreateAppCrashEvent(100, start + 3).get());
-
-    ConfigMetricsReport report = GetReports(service->mProcessor, start + 4);
-    backfillStartEndTimestamp(&report);
-
-    ASSERT_EQ(1, report.metrics_size());
-    ASSERT_EQ(1, report.metrics(0).count_metrics().data_size());
-    ASSERT_EQ(1, report.metrics(0).count_metrics().data(0).bucket_info_size());
-    EXPECT_TRUE(report.metrics(0).count_metrics().data(0).bucket_info(0).
-                    has_start_bucket_elapsed_nanos());
-    EXPECT_TRUE(report.metrics(0).count_metrics().data(0).bucket_info(0).
-                    has_end_bucket_elapsed_nanos());
-    EXPECT_EQ(1, report.metrics(0).count_metrics().data(0).bucket_info(0).count());
-}
-
-TEST(PartialBucketE2eTest, TestCountMetricSplitOnRemoval) {
-    shared_ptr<StatsService> service = SharedRefBase::make<StatsService>(nullptr, nullptr);
-    SendConfig(service, MakeConfig());
-    int64_t start = getElapsedRealtimeNs();  // This is the start-time the metrics producers are
-                                             // initialized with.
-    service->mUidMap->updateMap(start, {1}, {1}, {String16("v1")}, {String16(kApp1.c_str())},
-                                {String16("")});
-
-    // Force the uidmap to update at timestamp 2.
-    service->mProcessor->OnLogEvent(CreateAppCrashEvent(100, start + 1).get());
-    service->mUidMap->removeApp(start + 2, String16(kApp1.c_str()), 1);
-    // Goes into the second bucket.
-    service->mProcessor->OnLogEvent(CreateAppCrashEvent(100, start + 3).get());
-
-    ConfigMetricsReport report = GetReports(service->mProcessor, start + 4);
-    backfillStartEndTimestamp(&report);
-
-    ASSERT_EQ(1, report.metrics_size());
-    ASSERT_EQ(1, report.metrics(0).count_metrics().data_size());
-    ASSERT_EQ(1, report.metrics(0).count_metrics().data(0).bucket_info_size());
-    EXPECT_TRUE(report.metrics(0).count_metrics().data(0).bucket_info(0).
-                    has_start_bucket_elapsed_nanos());
-    EXPECT_TRUE(report.metrics(0).count_metrics().data(0).bucket_info(0).
-                    has_end_bucket_elapsed_nanos());
-    EXPECT_EQ(1, report.metrics(0).count_metrics().data(0).bucket_info(0).count());
-}
+// TODO(b/149590301): Update this test to use new socket schema.
+//TEST(PartialBucketE2eTest, TestCountMetricWithoutSplit) {
+//    shared_ptr<StatsService> service = SharedRefBase::make<StatsService>(nullptr, nullptr);
+//    SendConfig(service, MakeConfig());
+//    int64_t start = getElapsedRealtimeNs();  // This is the start-time the metrics producers are
+//                                             // initialized with.
+//
+//    service->mProcessor->OnLogEvent(CreateAppCrashEvent(100, start + 1).get());
+//    service->mProcessor->OnLogEvent(CreateAppCrashEvent(100, start + 2).get());
+//
+//    ConfigMetricsReport report = GetReports(service->mProcessor, start + 3);
+//    // Expect no metrics since the bucket has not finished yet.
+//    EXPECT_EQ(1, report.metrics_size());
+//    EXPECT_EQ(0, report.metrics(0).count_metrics().data_size());
+//}
+//
+//TEST(PartialBucketE2eTest, TestCountMetricNoSplitOnNewApp) {
+//    shared_ptr<StatsService> service = SharedRefBase::make<StatsService>(nullptr, nullptr);
+//    SendConfig(service, MakeConfig());
+//    int64_t start = getElapsedRealtimeNs();  // This is the start-time the metrics producers are
+//                                             // initialized with.
+//
+//    // Force the uidmap to update at timestamp 2.
+//    service->mProcessor->OnLogEvent(CreateAppCrashEvent(100, start + 1).get());
+//    // This is a new installation, so there shouldn't be a split (should be same as the without
+//    // split case).
+//    service->mUidMap->updateApp(start + 2, String16(kApp1.c_str()), 1, 2, String16("v2"),
+//                               String16(""));
+//    // Goes into the second bucket.
+//    service->mProcessor->OnLogEvent(CreateAppCrashEvent(100, start + 3).get());
+//
+//    ConfigMetricsReport report = GetReports(service->mProcessor, start + 4);
+//    EXPECT_EQ(1, report.metrics_size());
+//    EXPECT_EQ(0, report.metrics(0).count_metrics().data_size());
+//}
+//
+//TEST(PartialBucketE2eTest, TestCountMetricSplitOnUpgrade) {
+//    shared_ptr<StatsService> service = SharedRefBase::make<StatsService>(nullptr, nullptr);
+//    SendConfig(service, MakeConfig());
+//    int64_t start = getElapsedRealtimeNs();  // This is the start-time the metrics producers are
+//                                             // initialized with.
+//    service->mUidMap->updateMap(start, {1}, {1}, {String16("v1")}, {String16(kApp1.c_str())},
+//                                {String16("")});
+//
+//    // Force the uidmap to update at timestamp 2.
+//    service->mProcessor->OnLogEvent(CreateAppCrashEvent(100, start + 1).get());
+//    service->mUidMap->updateApp(start + 2, String16(kApp1.c_str()), 1, 2, String16("v2"),
+//                               String16(""));
+//    // Goes into the second bucket.
+//    service->mProcessor->OnLogEvent(CreateAppCrashEvent(100, start + 3).get());
+//
+//    ConfigMetricsReport report = GetReports(service->mProcessor, start + 4);
+//    backfillStartEndTimestamp(&report);
+//
+//    ASSERT_EQ(1, report.metrics_size());
+//    ASSERT_EQ(1, report.metrics(0).count_metrics().data_size());
+//    ASSERT_EQ(1, report.metrics(0).count_metrics().data(0).bucket_info_size());
+//    EXPECT_TRUE(report.metrics(0).count_metrics().data(0).bucket_info(0).
+//                    has_start_bucket_elapsed_nanos());
+//    EXPECT_TRUE(report.metrics(0).count_metrics().data(0).bucket_info(0).
+//                    has_end_bucket_elapsed_nanos());
+//    EXPECT_EQ(1, report.metrics(0).count_metrics().data(0).bucket_info(0).count());
+//}
+//
+//TEST(PartialBucketE2eTest, TestCountMetricSplitOnRemoval) {
+//    shared_ptr<StatsService> service = SharedRefBase::make<StatsService>(nullptr, nullptr);
+//    SendConfig(service, MakeConfig());
+//    int64_t start = getElapsedRealtimeNs();  // This is the start-time the metrics producers are
+//                                             // initialized with.
+//    service->mUidMap->updateMap(start, {1}, {1}, {String16("v1")}, {String16(kApp1.c_str())},
+//                                {String16("")});
+//
+//    // Force the uidmap to update at timestamp 2.
+//    service->mProcessor->OnLogEvent(CreateAppCrashEvent(100, start + 1).get());
+//    service->mUidMap->removeApp(start + 2, String16(kApp1.c_str()), 1);
+//    // Goes into the second bucket.
+//    service->mProcessor->OnLogEvent(CreateAppCrashEvent(100, start + 3).get());
+//
+//    ConfigMetricsReport report = GetReports(service->mProcessor, start + 4);
+//    backfillStartEndTimestamp(&report);
+//
+//    ASSERT_EQ(1, report.metrics_size());
+//    ASSERT_EQ(1, report.metrics(0).count_metrics().data_size());
+//    ASSERT_EQ(1, report.metrics(0).count_metrics().data(0).bucket_info_size());
+//    EXPECT_TRUE(report.metrics(0).count_metrics().data(0).bucket_info(0).
+//                    has_start_bucket_elapsed_nanos());
+//    EXPECT_TRUE(report.metrics(0).count_metrics().data(0).bucket_info(0).
+//                    has_end_bucket_elapsed_nanos());
+//    EXPECT_EQ(1, report.metrics(0).count_metrics().data(0).bucket_info(0).count());
+//}
 
 TEST(PartialBucketE2eTest, TestValueMetricWithoutMinPartialBucket) {
     shared_ptr<StatsService> service = SharedRefBase::make<StatsService>(nullptr, nullptr);
diff --git a/cmds/statsd/tests/e2e/ValueMetric_pull_e2e_test.cpp b/cmds/statsd/tests/e2e/ValueMetric_pull_e2e_test.cpp
index 9d39f9c..99dbaf1 100644
--- a/cmds/statsd/tests/e2e/ValueMetric_pull_e2e_test.cpp
+++ b/cmds/statsd/tests/e2e/ValueMetric_pull_e2e_test.cpp
@@ -64,316 +64,317 @@
 
 }  // namespace
 
-TEST(ValueMetricE2eTest, TestPulledEvents) {
-    auto config = CreateStatsdConfig();
-    int64_t baseTimeNs = getElapsedRealtimeNs();
-    int64_t configAddedTimeNs = 10 * 60 * NS_PER_SEC + baseTimeNs;
-    int64_t bucketSizeNs =
-        TimeUnitToBucketSizeInMillis(config.value_metric(0).bucket()) * 1000000;
-
-    ConfigKey cfgKey;
-    auto processor = CreateStatsLogProcessor(baseTimeNs, configAddedTimeNs, config, cfgKey,
-                                             SharedRefBase::make<FakeSubsystemSleepCallback>(),
-                                             android::util::SUBSYSTEM_SLEEP_STATE);
-    EXPECT_EQ(processor->mMetricsManagers.size(), 1u);
-    EXPECT_TRUE(processor->mMetricsManagers.begin()->second->isConfigValid());
-    processor->mPullerManager->ForceClearPullerCache();
-
-    int startBucketNum = processor->mMetricsManagers.begin()->second->
-            mAllMetricProducers[0]->getCurrentBucketNum();
-    EXPECT_GT(startBucketNum, (int64_t)0);
-
-    // When creating the config, the value metric producer should register the alarm at the
-    // end of the current bucket.
-    EXPECT_EQ((size_t)1, processor->mPullerManager->mReceivers.size());
-    EXPECT_EQ(bucketSizeNs,
-              processor->mPullerManager->mReceivers.begin()->second.front().intervalNs);
-    int64_t& expectedPullTimeNs =
-            processor->mPullerManager->mReceivers.begin()->second.front().nextPullTimeNs;
-    EXPECT_EQ(baseTimeNs + startBucketNum * bucketSizeNs + bucketSizeNs, expectedPullTimeNs);
-
-    auto screenOffEvent = CreateScreenStateChangedEvent(android::view::DISPLAY_STATE_OFF,
-                                                        configAddedTimeNs + 55);
-    processor->OnLogEvent(screenOffEvent.get());
-
-    auto screenOnEvent = CreateScreenStateChangedEvent(android::view::DISPLAY_STATE_ON,
-                                                       configAddedTimeNs + 65);
-    processor->OnLogEvent(screenOnEvent.get());
-
-    screenOffEvent = CreateScreenStateChangedEvent(android::view::DISPLAY_STATE_OFF,
-                                                   configAddedTimeNs + 75);
-    processor->OnLogEvent(screenOffEvent.get());
-
-    // Pulling alarm arrives on time and reset the sequential pulling alarm.
-    processor->informPullAlarmFired(expectedPullTimeNs + 1);
-    EXPECT_EQ(baseTimeNs + startBucketNum * bucketSizeNs + 2 * bucketSizeNs, expectedPullTimeNs);
-
-    processor->informPullAlarmFired(expectedPullTimeNs + 1);
-
-    screenOnEvent = CreateScreenStateChangedEvent(android::view::DISPLAY_STATE_ON,
-                                                       configAddedTimeNs + 2 * bucketSizeNs + 15);
-    processor->OnLogEvent(screenOnEvent.get());
-
-    processor->informPullAlarmFired(expectedPullTimeNs + 1);
-
-    processor->informPullAlarmFired(expectedPullTimeNs + 1);
-
-    screenOffEvent = CreateScreenStateChangedEvent(android::view::DISPLAY_STATE_OFF,
-                                                   configAddedTimeNs + 4 * bucketSizeNs + 11);
-    processor->OnLogEvent(screenOffEvent.get());
-
-    processor->informPullAlarmFired(expectedPullTimeNs + 1);
-
-    processor->informPullAlarmFired(expectedPullTimeNs + 1);
-
-    ConfigMetricsReportList reports;
-    vector<uint8_t> buffer;
-    processor->onDumpReport(cfgKey, configAddedTimeNs + 7 * bucketSizeNs + 10, false, true,
-                            ADB_DUMP, FAST, &buffer);
-    EXPECT_TRUE(buffer.size() > 0);
-    EXPECT_TRUE(reports.ParseFromArray(&buffer[0], buffer.size()));
-    backfillDimensionPath(&reports);
-    backfillStringInReport(&reports);
-    backfillStartEndTimestamp(&reports);
-    EXPECT_EQ(1, reports.reports_size());
-    EXPECT_EQ(1, reports.reports(0).metrics_size());
-    StatsLogReport::ValueMetricDataWrapper valueMetrics;
-    sortMetricDataByDimensionsValue(
-            reports.reports(0).metrics(0).value_metrics(), &valueMetrics);
-    EXPECT_GT((int)valueMetrics.data_size(), 1);
-
-    auto data = valueMetrics.data(0);
-    EXPECT_EQ(android::util::SUBSYSTEM_SLEEP_STATE, data.dimensions_in_what().field());
-    EXPECT_EQ(1, data.dimensions_in_what().value_tuple().dimensions_value_size());
-    EXPECT_EQ(1 /* subsystem name field */,
-              data.dimensions_in_what().value_tuple().dimensions_value(0).field());
-    EXPECT_FALSE(data.dimensions_in_what().value_tuple().dimensions_value(0).value_str().empty());
-    // We have 4 buckets, the first one was incomplete since the condition was unknown.
-    EXPECT_EQ(4, data.bucket_info_size());
-
-    EXPECT_EQ(baseTimeNs + 3 * bucketSizeNs, data.bucket_info(0).start_bucket_elapsed_nanos());
-    EXPECT_EQ(baseTimeNs + 4 * bucketSizeNs, data.bucket_info(0).end_bucket_elapsed_nanos());
-    EXPECT_EQ(1, data.bucket_info(0).values_size());
-
-    EXPECT_EQ(baseTimeNs + 4 * bucketSizeNs, data.bucket_info(1).start_bucket_elapsed_nanos());
-    EXPECT_EQ(baseTimeNs + 5 * bucketSizeNs, data.bucket_info(1).end_bucket_elapsed_nanos());
-    EXPECT_EQ(1, data.bucket_info(1).values_size());
-
-    EXPECT_EQ(baseTimeNs + 6 * bucketSizeNs, data.bucket_info(2).start_bucket_elapsed_nanos());
-    EXPECT_EQ(baseTimeNs + 7 * bucketSizeNs, data.bucket_info(2).end_bucket_elapsed_nanos());
-    EXPECT_EQ(1, data.bucket_info(2).values_size());
-
-    EXPECT_EQ(baseTimeNs + 7 * bucketSizeNs, data.bucket_info(3).start_bucket_elapsed_nanos());
-    EXPECT_EQ(baseTimeNs + 8 * bucketSizeNs, data.bucket_info(3).end_bucket_elapsed_nanos());
-    EXPECT_EQ(1, data.bucket_info(3).values_size());
-}
-
-TEST(ValueMetricE2eTest, TestPulledEvents_LateAlarm) {
-    auto config = CreateStatsdConfig();
-    int64_t baseTimeNs = getElapsedRealtimeNs();
-    // 10 mins == 2 bucket durations.
-    int64_t configAddedTimeNs = 10 * 60 * NS_PER_SEC + baseTimeNs;
-    int64_t bucketSizeNs =
-        TimeUnitToBucketSizeInMillis(config.value_metric(0).bucket()) * 1000000;
-
-    ConfigKey cfgKey;
-    auto processor = CreateStatsLogProcessor(baseTimeNs, configAddedTimeNs, config, cfgKey,
-                                             SharedRefBase::make<FakeSubsystemSleepCallback>(),
-                                             android::util::SUBSYSTEM_SLEEP_STATE);
-    EXPECT_EQ(processor->mMetricsManagers.size(), 1u);
-    EXPECT_TRUE(processor->mMetricsManagers.begin()->second->isConfigValid());
-    processor->mPullerManager->ForceClearPullerCache();
-
-    int startBucketNum = processor->mMetricsManagers.begin()->second->
-            mAllMetricProducers[0]->getCurrentBucketNum();
-    EXPECT_GT(startBucketNum, (int64_t)0);
-
-    // When creating the config, the value metric producer should register the alarm at the
-    // end of the current bucket.
-    EXPECT_EQ((size_t)1, processor->mPullerManager->mReceivers.size());
-    EXPECT_EQ(bucketSizeNs,
-              processor->mPullerManager->mReceivers.begin()->second.front().intervalNs);
-    int64_t& expectedPullTimeNs =
-            processor->mPullerManager->mReceivers.begin()->second.front().nextPullTimeNs;
-    EXPECT_EQ(baseTimeNs + startBucketNum * bucketSizeNs + bucketSizeNs, expectedPullTimeNs);
-
-    // Screen off/on/off events.
-    auto screenOffEvent = CreateScreenStateChangedEvent(android::view::DISPLAY_STATE_OFF,
-                                                        configAddedTimeNs + 55);
-    processor->OnLogEvent(screenOffEvent.get());
-
-    auto screenOnEvent = CreateScreenStateChangedEvent(android::view::DISPLAY_STATE_ON,
-                                                       configAddedTimeNs + 65);
-    processor->OnLogEvent(screenOnEvent.get());
-
-    screenOffEvent = CreateScreenStateChangedEvent(android::view::DISPLAY_STATE_OFF,
-                                                   configAddedTimeNs + 75);
-    processor->OnLogEvent(screenOffEvent.get());
-
-    // Pulling alarm arrives late by 2 buckets and 1 ns. 2 buckets late is too far away in the
-    // future, data will be skipped.
-    processor->informPullAlarmFired(expectedPullTimeNs + 2 * bucketSizeNs + 1);
-    EXPECT_EQ(baseTimeNs + startBucketNum * bucketSizeNs + 4 * bucketSizeNs, expectedPullTimeNs);
-
-    // This screen state change will start a new bucket.
-    screenOnEvent = CreateScreenStateChangedEvent(android::view::DISPLAY_STATE_ON,
-                                                       configAddedTimeNs + 4 * bucketSizeNs + 65);
-    processor->OnLogEvent(screenOnEvent.get());
-
-    // The alarm is delayed but we already created a bucket thanks to the screen state condition.
-    // This bucket does not have to be skipped since the alarm arrives in time for the next bucket.
-    processor->informPullAlarmFired(expectedPullTimeNs + bucketSizeNs + 21);
-    EXPECT_EQ(baseTimeNs + startBucketNum * bucketSizeNs + 6 * bucketSizeNs, expectedPullTimeNs);
-
-    screenOffEvent = CreateScreenStateChangedEvent(android::view::DISPLAY_STATE_OFF,
-                                                   configAddedTimeNs + 6 * bucketSizeNs + 31);
-    processor->OnLogEvent(screenOffEvent.get());
-
-    processor->informPullAlarmFired(expectedPullTimeNs + bucketSizeNs + 21);
-    EXPECT_EQ(baseTimeNs + startBucketNum * bucketSizeNs + 8 * bucketSizeNs, expectedPullTimeNs);
-
-    processor->informPullAlarmFired(expectedPullTimeNs + 1);
-    EXPECT_EQ(baseTimeNs + startBucketNum * bucketSizeNs + 9 * bucketSizeNs, expectedPullTimeNs);
-
-    ConfigMetricsReportList reports;
-    vector<uint8_t> buffer;
-    processor->onDumpReport(cfgKey, configAddedTimeNs + 9 * bucketSizeNs + 10, false, true,
-                            ADB_DUMP, FAST, &buffer);
-    EXPECT_TRUE(buffer.size() > 0);
-    EXPECT_TRUE(reports.ParseFromArray(&buffer[0], buffer.size()));
-    backfillDimensionPath(&reports);
-    backfillStringInReport(&reports);
-    backfillStartEndTimestamp(&reports);
-    EXPECT_EQ(1, reports.reports_size());
-    EXPECT_EQ(1, reports.reports(0).metrics_size());
-    StatsLogReport::ValueMetricDataWrapper valueMetrics;
-    sortMetricDataByDimensionsValue(
-            reports.reports(0).metrics(0).value_metrics(), &valueMetrics);
-    EXPECT_GT((int)valueMetrics.data_size(), 1);
-
-    auto data = valueMetrics.data(0);
-    EXPECT_EQ(android::util::SUBSYSTEM_SLEEP_STATE, data.dimensions_in_what().field());
-    EXPECT_EQ(1, data.dimensions_in_what().value_tuple().dimensions_value_size());
-    EXPECT_EQ(1 /* subsystem name field */,
-              data.dimensions_in_what().value_tuple().dimensions_value(0).field());
-    EXPECT_FALSE(data.dimensions_in_what().value_tuple().dimensions_value(0).value_str().empty());
-    EXPECT_EQ(3, data.bucket_info_size());
-
-    EXPECT_EQ(baseTimeNs + 5 * bucketSizeNs, data.bucket_info(0).start_bucket_elapsed_nanos());
-    EXPECT_EQ(baseTimeNs + 6 * bucketSizeNs, data.bucket_info(0).end_bucket_elapsed_nanos());
-    EXPECT_EQ(1, data.bucket_info(0).values_size());
-
-    EXPECT_EQ(baseTimeNs + 8 * bucketSizeNs, data.bucket_info(1).start_bucket_elapsed_nanos());
-    EXPECT_EQ(baseTimeNs + 9 * bucketSizeNs, data.bucket_info(1).end_bucket_elapsed_nanos());
-    EXPECT_EQ(1, data.bucket_info(1).values_size());
-
-    EXPECT_EQ(baseTimeNs + 9 * bucketSizeNs, data.bucket_info(2).start_bucket_elapsed_nanos());
-    EXPECT_EQ(baseTimeNs + 10 * bucketSizeNs, data.bucket_info(2).end_bucket_elapsed_nanos());
-    EXPECT_EQ(1, data.bucket_info(2).values_size());
-}
-
-TEST(ValueMetricE2eTest, TestPulledEvents_WithActivation) {
-    auto config = CreateStatsdConfig(false);
-    int64_t baseTimeNs = getElapsedRealtimeNs();
-    int64_t configAddedTimeNs = 10 * 60 * NS_PER_SEC + baseTimeNs;
-    int64_t bucketSizeNs =
-        TimeUnitToBucketSizeInMillis(config.value_metric(0).bucket()) * 1000000;
-
-    auto batterySaverStartMatcher = CreateBatterySaverModeStartAtomMatcher();
-    *config.add_atom_matcher() = batterySaverStartMatcher;
-    const int64_t ttlNs = 2 * bucketSizeNs; // Two buckets.
-    auto metric_activation = config.add_metric_activation();
-    metric_activation->set_metric_id(metricId);
-    metric_activation->set_activation_type(ACTIVATE_IMMEDIATELY);
-    auto event_activation = metric_activation->add_event_activation();
-    event_activation->set_atom_matcher_id(batterySaverStartMatcher.id());
-    event_activation->set_ttl_seconds(ttlNs / 1000000000);
-
-    ConfigKey cfgKey;
-    auto processor = CreateStatsLogProcessor(baseTimeNs, configAddedTimeNs, config, cfgKey,
-                                             SharedRefBase::make<FakeSubsystemSleepCallback>(),
-                                             android::util::SUBSYSTEM_SLEEP_STATE);
-    EXPECT_EQ(processor->mMetricsManagers.size(), 1u);
-    EXPECT_TRUE(processor->mMetricsManagers.begin()->second->isConfigValid());
-    processor->mPullerManager->ForceClearPullerCache();
-
-    int startBucketNum = processor->mMetricsManagers.begin()->second->
-            mAllMetricProducers[0]->getCurrentBucketNum();
-    EXPECT_GT(startBucketNum, (int64_t)0);
-    EXPECT_FALSE(processor->mMetricsManagers.begin()->second->mAllMetricProducers[0]->isActive());
-
-    // When creating the config, the value metric producer should register the alarm at the
-    // end of the current bucket.
-    EXPECT_EQ((size_t)1, processor->mPullerManager->mReceivers.size());
-    EXPECT_EQ(bucketSizeNs,
-              processor->mPullerManager->mReceivers.begin()->second.front().intervalNs);
-    int64_t& expectedPullTimeNs =
-            processor->mPullerManager->mReceivers.begin()->second.front().nextPullTimeNs;
-    EXPECT_EQ(baseTimeNs + startBucketNum * bucketSizeNs + bucketSizeNs, expectedPullTimeNs);
-
-    // Pulling alarm arrives on time and reset the sequential pulling alarm.
-    processor->informPullAlarmFired(expectedPullTimeNs + 1); // 15 mins + 1 ns.
-    EXPECT_EQ(baseTimeNs + startBucketNum * bucketSizeNs + 2 * bucketSizeNs, expectedPullTimeNs);
-    EXPECT_FALSE(processor->mMetricsManagers.begin()->second->mAllMetricProducers[0]->isActive());
-
-    // Activate the metric. A pull occurs here
-    const int64_t activationNs = configAddedTimeNs + bucketSizeNs + (2 * 1000 * 1000); // 2 millis.
-    auto batterySaverOnEvent = CreateBatterySaverOnEvent(activationNs);
-    processor->OnLogEvent(batterySaverOnEvent.get()); // 15 mins + 2 ms.
-    EXPECT_TRUE(processor->mMetricsManagers.begin()->second->mAllMetricProducers[0]->isActive());
-
-    processor->informPullAlarmFired(expectedPullTimeNs + 1); // 20 mins + 1 ns.
-    EXPECT_EQ(baseTimeNs + startBucketNum * bucketSizeNs + 3 * bucketSizeNs, expectedPullTimeNs);
-
-    processor->informPullAlarmFired(expectedPullTimeNs + 2); // 25 mins + 2 ns.
-    EXPECT_EQ(baseTimeNs + startBucketNum * bucketSizeNs + 4 * bucketSizeNs, expectedPullTimeNs);
-
-    // Create random event to deactivate metric.
-    auto deactivationEvent = CreateScreenBrightnessChangedEvent(50, activationNs + ttlNs + 1);
-    processor->OnLogEvent(deactivationEvent.get());
-    EXPECT_FALSE(processor->mMetricsManagers.begin()->second->mAllMetricProducers[0]->isActive());
-
-    processor->informPullAlarmFired(expectedPullTimeNs + 3);
-    EXPECT_EQ(baseTimeNs + startBucketNum * bucketSizeNs + 5 * bucketSizeNs, expectedPullTimeNs);
-
-    processor->informPullAlarmFired(expectedPullTimeNs + 4);
-    EXPECT_EQ(baseTimeNs + startBucketNum * bucketSizeNs + 6 * bucketSizeNs, expectedPullTimeNs);
-
-    ConfigMetricsReportList reports;
-    vector<uint8_t> buffer;
-    processor->onDumpReport(cfgKey, configAddedTimeNs + 7 * bucketSizeNs + 10, false, true,
-                            ADB_DUMP, FAST, &buffer);
-    EXPECT_TRUE(buffer.size() > 0);
-    EXPECT_TRUE(reports.ParseFromArray(&buffer[0], buffer.size()));
-    backfillDimensionPath(&reports);
-    backfillStringInReport(&reports);
-    backfillStartEndTimestamp(&reports);
-    EXPECT_EQ(1, reports.reports_size());
-    EXPECT_EQ(1, reports.reports(0).metrics_size());
-    StatsLogReport::ValueMetricDataWrapper valueMetrics;
-    sortMetricDataByDimensionsValue(
-            reports.reports(0).metrics(0).value_metrics(), &valueMetrics);
-    EXPECT_GT((int)valueMetrics.data_size(), 0);
-
-    auto data = valueMetrics.data(0);
-    EXPECT_EQ(android::util::SUBSYSTEM_SLEEP_STATE, data.dimensions_in_what().field());
-    EXPECT_EQ(1, data.dimensions_in_what().value_tuple().dimensions_value_size());
-    EXPECT_EQ(1 /* subsystem name field */,
-              data.dimensions_in_what().value_tuple().dimensions_value(0).field());
-    EXPECT_FALSE(data.dimensions_in_what().value_tuple().dimensions_value(0).value_str().empty());
-    // We have 2 full buckets, the two surrounding the activation are dropped.
-    EXPECT_EQ(2, data.bucket_info_size());
-
-    auto bucketInfo = data.bucket_info(0);
-    EXPECT_EQ(baseTimeNs + 3 * bucketSizeNs, bucketInfo.start_bucket_elapsed_nanos());
-    EXPECT_EQ(baseTimeNs + 4 * bucketSizeNs, bucketInfo.end_bucket_elapsed_nanos());
-    EXPECT_EQ(1, bucketInfo.values_size());
-
-    bucketInfo = data.bucket_info(1);
-    EXPECT_EQ(baseTimeNs + 4 * bucketSizeNs, bucketInfo.start_bucket_elapsed_nanos());
-    EXPECT_EQ(baseTimeNs + 5 * bucketSizeNs, bucketInfo.end_bucket_elapsed_nanos());
-    EXPECT_EQ(1, bucketInfo.values_size());
-}
+// TODO(b/149590301): Update this test to use new socket schema.
+//TEST(ValueMetricE2eTest, TestPulledEvents) {
+//    auto config = CreateStatsdConfig();
+//    int64_t baseTimeNs = getElapsedRealtimeNs();
+//    int64_t configAddedTimeNs = 10 * 60 * NS_PER_SEC + baseTimeNs;
+//    int64_t bucketSizeNs =
+//        TimeUnitToBucketSizeInMillis(config.value_metric(0).bucket()) * 1000000;
+//
+//    ConfigKey cfgKey;
+//    auto processor = CreateStatsLogProcessor(baseTimeNs, configAddedTimeNs, config, cfgKey,
+//                                             SharedRefBase::make<FakeSubsystemSleepCallback>(),
+//                                             android::util::SUBSYSTEM_SLEEP_STATE);
+//    EXPECT_EQ(processor->mMetricsManagers.size(), 1u);
+//    EXPECT_TRUE(processor->mMetricsManagers.begin()->second->isConfigValid());
+//    processor->mPullerManager->ForceClearPullerCache();
+//
+//    int startBucketNum = processor->mMetricsManagers.begin()->second->
+//            mAllMetricProducers[0]->getCurrentBucketNum();
+//    EXPECT_GT(startBucketNum, (int64_t)0);
+//
+//    // When creating the config, the value metric producer should register the alarm at the
+//    // end of the current bucket.
+//    EXPECT_EQ((size_t)1, processor->mPullerManager->mReceivers.size());
+//    EXPECT_EQ(bucketSizeNs,
+//              processor->mPullerManager->mReceivers.begin()->second.front().intervalNs);
+//    int64_t& expectedPullTimeNs =
+//            processor->mPullerManager->mReceivers.begin()->second.front().nextPullTimeNs;
+//    EXPECT_EQ(baseTimeNs + startBucketNum * bucketSizeNs + bucketSizeNs, expectedPullTimeNs);
+//
+//    auto screenOffEvent = CreateScreenStateChangedEvent(android::view::DISPLAY_STATE_OFF,
+//                                                        configAddedTimeNs + 55);
+//    processor->OnLogEvent(screenOffEvent.get());
+//
+//    auto screenOnEvent = CreateScreenStateChangedEvent(android::view::DISPLAY_STATE_ON,
+//                                                       configAddedTimeNs + 65);
+//    processor->OnLogEvent(screenOnEvent.get());
+//
+//    screenOffEvent = CreateScreenStateChangedEvent(android::view::DISPLAY_STATE_OFF,
+//                                                   configAddedTimeNs + 75);
+//    processor->OnLogEvent(screenOffEvent.get());
+//
+//    // Pulling alarm arrives on time and reset the sequential pulling alarm.
+//    processor->informPullAlarmFired(expectedPullTimeNs + 1);
+//    EXPECT_EQ(baseTimeNs + startBucketNum * bucketSizeNs + 2 * bucketSizeNs, expectedPullTimeNs);
+//
+//    processor->informPullAlarmFired(expectedPullTimeNs + 1);
+//
+//    screenOnEvent = CreateScreenStateChangedEvent(android::view::DISPLAY_STATE_ON,
+//                                                       configAddedTimeNs + 2 * bucketSizeNs + 15);
+//    processor->OnLogEvent(screenOnEvent.get());
+//
+//    processor->informPullAlarmFired(expectedPullTimeNs + 1);
+//
+//    processor->informPullAlarmFired(expectedPullTimeNs + 1);
+//
+//    screenOffEvent = CreateScreenStateChangedEvent(android::view::DISPLAY_STATE_OFF,
+//                                                   configAddedTimeNs + 4 * bucketSizeNs + 11);
+//    processor->OnLogEvent(screenOffEvent.get());
+//
+//    processor->informPullAlarmFired(expectedPullTimeNs + 1);
+//
+//    processor->informPullAlarmFired(expectedPullTimeNs + 1);
+//
+//    ConfigMetricsReportList reports;
+//    vector<uint8_t> buffer;
+//    processor->onDumpReport(cfgKey, configAddedTimeNs + 7 * bucketSizeNs + 10, false, true,
+//                            ADB_DUMP, FAST, &buffer);
+//    EXPECT_TRUE(buffer.size() > 0);
+//    EXPECT_TRUE(reports.ParseFromArray(&buffer[0], buffer.size()));
+//    backfillDimensionPath(&reports);
+//    backfillStringInReport(&reports);
+//    backfillStartEndTimestamp(&reports);
+//    EXPECT_EQ(1, reports.reports_size());
+//    EXPECT_EQ(1, reports.reports(0).metrics_size());
+//    StatsLogReport::ValueMetricDataWrapper valueMetrics;
+//    sortMetricDataByDimensionsValue(
+//            reports.reports(0).metrics(0).value_metrics(), &valueMetrics);
+//    EXPECT_GT((int)valueMetrics.data_size(), 1);
+//
+//    auto data = valueMetrics.data(0);
+//    EXPECT_EQ(android::util::SUBSYSTEM_SLEEP_STATE, data.dimensions_in_what().field());
+//    EXPECT_EQ(1, data.dimensions_in_what().value_tuple().dimensions_value_size());
+//    EXPECT_EQ(1 /* subsystem name field */,
+//              data.dimensions_in_what().value_tuple().dimensions_value(0).field());
+//    EXPECT_FALSE(data.dimensions_in_what().value_tuple().dimensions_value(0).value_str().empty());
+//    // We have 4 buckets, the first one was incomplete since the condition was unknown.
+//    EXPECT_EQ(4, data.bucket_info_size());
+//
+//    EXPECT_EQ(baseTimeNs + 3 * bucketSizeNs, data.bucket_info(0).start_bucket_elapsed_nanos());
+//    EXPECT_EQ(baseTimeNs + 4 * bucketSizeNs, data.bucket_info(0).end_bucket_elapsed_nanos());
+//    EXPECT_EQ(1, data.bucket_info(0).values_size());
+//
+//    EXPECT_EQ(baseTimeNs + 4 * bucketSizeNs, data.bucket_info(1).start_bucket_elapsed_nanos());
+//    EXPECT_EQ(baseTimeNs + 5 * bucketSizeNs, data.bucket_info(1).end_bucket_elapsed_nanos());
+//    EXPECT_EQ(1, data.bucket_info(1).values_size());
+//
+//    EXPECT_EQ(baseTimeNs + 6 * bucketSizeNs, data.bucket_info(2).start_bucket_elapsed_nanos());
+//    EXPECT_EQ(baseTimeNs + 7 * bucketSizeNs, data.bucket_info(2).end_bucket_elapsed_nanos());
+//    EXPECT_EQ(1, data.bucket_info(2).values_size());
+//
+//    EXPECT_EQ(baseTimeNs + 7 * bucketSizeNs, data.bucket_info(3).start_bucket_elapsed_nanos());
+//    EXPECT_EQ(baseTimeNs + 8 * bucketSizeNs, data.bucket_info(3).end_bucket_elapsed_nanos());
+//    EXPECT_EQ(1, data.bucket_info(3).values_size());
+//}
+//
+//TEST(ValueMetricE2eTest, TestPulledEvents_LateAlarm) {
+//    auto config = CreateStatsdConfig();
+//    int64_t baseTimeNs = getElapsedRealtimeNs();
+//    // 10 mins == 2 bucket durations.
+//    int64_t configAddedTimeNs = 10 * 60 * NS_PER_SEC + baseTimeNs;
+//    int64_t bucketSizeNs =
+//        TimeUnitToBucketSizeInMillis(config.value_metric(0).bucket()) * 1000000;
+//
+//    ConfigKey cfgKey;
+//    auto processor = CreateStatsLogProcessor(baseTimeNs, configAddedTimeNs, config, cfgKey,
+//                                             SharedRefBase::make<FakeSubsystemSleepCallback>(),
+//                                             android::util::SUBSYSTEM_SLEEP_STATE);
+//    EXPECT_EQ(processor->mMetricsManagers.size(), 1u);
+//    EXPECT_TRUE(processor->mMetricsManagers.begin()->second->isConfigValid());
+//    processor->mPullerManager->ForceClearPullerCache();
+//
+//    int startBucketNum = processor->mMetricsManagers.begin()->second->
+//            mAllMetricProducers[0]->getCurrentBucketNum();
+//    EXPECT_GT(startBucketNum, (int64_t)0);
+//
+//    // When creating the config, the value metric producer should register the alarm at the
+//    // end of the current bucket.
+//    EXPECT_EQ((size_t)1, processor->mPullerManager->mReceivers.size());
+//    EXPECT_EQ(bucketSizeNs,
+//              processor->mPullerManager->mReceivers.begin()->second.front().intervalNs);
+//    int64_t& expectedPullTimeNs =
+//            processor->mPullerManager->mReceivers.begin()->second.front().nextPullTimeNs;
+//    EXPECT_EQ(baseTimeNs + startBucketNum * bucketSizeNs + bucketSizeNs, expectedPullTimeNs);
+//
+//    // Screen off/on/off events.
+//    auto screenOffEvent = CreateScreenStateChangedEvent(android::view::DISPLAY_STATE_OFF,
+//                                                        configAddedTimeNs + 55);
+//    processor->OnLogEvent(screenOffEvent.get());
+//
+//    auto screenOnEvent = CreateScreenStateChangedEvent(android::view::DISPLAY_STATE_ON,
+//                                                       configAddedTimeNs + 65);
+//    processor->OnLogEvent(screenOnEvent.get());
+//
+//    screenOffEvent = CreateScreenStateChangedEvent(android::view::DISPLAY_STATE_OFF,
+//                                                   configAddedTimeNs + 75);
+//    processor->OnLogEvent(screenOffEvent.get());
+//
+//    // Pulling alarm arrives late by 2 buckets and 1 ns. 2 buckets late is too far away in the
+//    // future, data will be skipped.
+//    processor->informPullAlarmFired(expectedPullTimeNs + 2 * bucketSizeNs + 1);
+//    EXPECT_EQ(baseTimeNs + startBucketNum * bucketSizeNs + 4 * bucketSizeNs, expectedPullTimeNs);
+//
+//    // This screen state change will start a new bucket.
+//    screenOnEvent = CreateScreenStateChangedEvent(android::view::DISPLAY_STATE_ON,
+//                                                       configAddedTimeNs + 4 * bucketSizeNs + 65);
+//    processor->OnLogEvent(screenOnEvent.get());
+//
+//    // The alarm is delayed but we already created a bucket thanks to the screen state condition.
+//    // This bucket does not have to be skipped since the alarm arrives in time for the next bucket.
+//    processor->informPullAlarmFired(expectedPullTimeNs + bucketSizeNs + 21);
+//    EXPECT_EQ(baseTimeNs + startBucketNum * bucketSizeNs + 6 * bucketSizeNs, expectedPullTimeNs);
+//
+//    screenOffEvent = CreateScreenStateChangedEvent(android::view::DISPLAY_STATE_OFF,
+//                                                   configAddedTimeNs + 6 * bucketSizeNs + 31);
+//    processor->OnLogEvent(screenOffEvent.get());
+//
+//    processor->informPullAlarmFired(expectedPullTimeNs + bucketSizeNs + 21);
+//    EXPECT_EQ(baseTimeNs + startBucketNum * bucketSizeNs + 8 * bucketSizeNs, expectedPullTimeNs);
+//
+//    processor->informPullAlarmFired(expectedPullTimeNs + 1);
+//    EXPECT_EQ(baseTimeNs + startBucketNum * bucketSizeNs + 9 * bucketSizeNs, expectedPullTimeNs);
+//
+//    ConfigMetricsReportList reports;
+//    vector<uint8_t> buffer;
+//    processor->onDumpReport(cfgKey, configAddedTimeNs + 9 * bucketSizeNs + 10, false, true,
+//                            ADB_DUMP, FAST, &buffer);
+//    EXPECT_TRUE(buffer.size() > 0);
+//    EXPECT_TRUE(reports.ParseFromArray(&buffer[0], buffer.size()));
+//    backfillDimensionPath(&reports);
+//    backfillStringInReport(&reports);
+//    backfillStartEndTimestamp(&reports);
+//    EXPECT_EQ(1, reports.reports_size());
+//    EXPECT_EQ(1, reports.reports(0).metrics_size());
+//    StatsLogReport::ValueMetricDataWrapper valueMetrics;
+//    sortMetricDataByDimensionsValue(
+//            reports.reports(0).metrics(0).value_metrics(), &valueMetrics);
+//    EXPECT_GT((int)valueMetrics.data_size(), 1);
+//
+//    auto data = valueMetrics.data(0);
+//    EXPECT_EQ(android::util::SUBSYSTEM_SLEEP_STATE, data.dimensions_in_what().field());
+//    EXPECT_EQ(1, data.dimensions_in_what().value_tuple().dimensions_value_size());
+//    EXPECT_EQ(1 /* subsystem name field */,
+//              data.dimensions_in_what().value_tuple().dimensions_value(0).field());
+//    EXPECT_FALSE(data.dimensions_in_what().value_tuple().dimensions_value(0).value_str().empty());
+//    EXPECT_EQ(3, data.bucket_info_size());
+//
+//    EXPECT_EQ(baseTimeNs + 5 * bucketSizeNs, data.bucket_info(0).start_bucket_elapsed_nanos());
+//    EXPECT_EQ(baseTimeNs + 6 * bucketSizeNs, data.bucket_info(0).end_bucket_elapsed_nanos());
+//    EXPECT_EQ(1, data.bucket_info(0).values_size());
+//
+//    EXPECT_EQ(baseTimeNs + 8 * bucketSizeNs, data.bucket_info(1).start_bucket_elapsed_nanos());
+//    EXPECT_EQ(baseTimeNs + 9 * bucketSizeNs, data.bucket_info(1).end_bucket_elapsed_nanos());
+//    EXPECT_EQ(1, data.bucket_info(1).values_size());
+//
+//    EXPECT_EQ(baseTimeNs + 9 * bucketSizeNs, data.bucket_info(2).start_bucket_elapsed_nanos());
+//    EXPECT_EQ(baseTimeNs + 10 * bucketSizeNs, data.bucket_info(2).end_bucket_elapsed_nanos());
+//    EXPECT_EQ(1, data.bucket_info(2).values_size());
+//}
+//
+//TEST(ValueMetricE2eTest, TestPulledEvents_WithActivation) {
+//    auto config = CreateStatsdConfig(false);
+//    int64_t baseTimeNs = getElapsedRealtimeNs();
+//    int64_t configAddedTimeNs = 10 * 60 * NS_PER_SEC + baseTimeNs;
+//    int64_t bucketSizeNs =
+//        TimeUnitToBucketSizeInMillis(config.value_metric(0).bucket()) * 1000000;
+//
+//    auto batterySaverStartMatcher = CreateBatterySaverModeStartAtomMatcher();
+//    *config.add_atom_matcher() = batterySaverStartMatcher;
+//    const int64_t ttlNs = 2 * bucketSizeNs; // Two buckets.
+//    auto metric_activation = config.add_metric_activation();
+//    metric_activation->set_metric_id(metricId);
+//    metric_activation->set_activation_type(ACTIVATE_IMMEDIATELY);
+//    auto event_activation = metric_activation->add_event_activation();
+//    event_activation->set_atom_matcher_id(batterySaverStartMatcher.id());
+//    event_activation->set_ttl_seconds(ttlNs / 1000000000);
+//
+//    ConfigKey cfgKey;
+//    auto processor = CreateStatsLogProcessor(baseTimeNs, configAddedTimeNs, config, cfgKey,
+//                                             SharedRefBase::make<FakeSubsystemSleepCallback>(),
+//                                             android::util::SUBSYSTEM_SLEEP_STATE);
+//    EXPECT_EQ(processor->mMetricsManagers.size(), 1u);
+//    EXPECT_TRUE(processor->mMetricsManagers.begin()->second->isConfigValid());
+//    processor->mPullerManager->ForceClearPullerCache();
+//
+//    int startBucketNum = processor->mMetricsManagers.begin()->second->
+//            mAllMetricProducers[0]->getCurrentBucketNum();
+//    EXPECT_GT(startBucketNum, (int64_t)0);
+//    EXPECT_FALSE(processor->mMetricsManagers.begin()->second->mAllMetricProducers[0]->isActive());
+//
+//    // When creating the config, the value metric producer should register the alarm at the
+//    // end of the current bucket.
+//    EXPECT_EQ((size_t)1, processor->mPullerManager->mReceivers.size());
+//    EXPECT_EQ(bucketSizeNs,
+//              processor->mPullerManager->mReceivers.begin()->second.front().intervalNs);
+//    int64_t& expectedPullTimeNs =
+//            processor->mPullerManager->mReceivers.begin()->second.front().nextPullTimeNs;
+//    EXPECT_EQ(baseTimeNs + startBucketNum * bucketSizeNs + bucketSizeNs, expectedPullTimeNs);
+//
+//    // Pulling alarm arrives on time and reset the sequential pulling alarm.
+//    processor->informPullAlarmFired(expectedPullTimeNs + 1); // 15 mins + 1 ns.
+//    EXPECT_EQ(baseTimeNs + startBucketNum * bucketSizeNs + 2 * bucketSizeNs, expectedPullTimeNs);
+//    EXPECT_FALSE(processor->mMetricsManagers.begin()->second->mAllMetricProducers[0]->isActive());
+//
+//    // Activate the metric. A pull occurs here
+//    const int64_t activationNs = configAddedTimeNs + bucketSizeNs + (2 * 1000 * 1000); // 2 millis.
+//    auto batterySaverOnEvent = CreateBatterySaverOnEvent(activationNs);
+//    processor->OnLogEvent(batterySaverOnEvent.get()); // 15 mins + 2 ms.
+//    EXPECT_TRUE(processor->mMetricsManagers.begin()->second->mAllMetricProducers[0]->isActive());
+//
+//    processor->informPullAlarmFired(expectedPullTimeNs + 1); // 20 mins + 1 ns.
+//    EXPECT_EQ(baseTimeNs + startBucketNum * bucketSizeNs + 3 * bucketSizeNs, expectedPullTimeNs);
+//
+//    processor->informPullAlarmFired(expectedPullTimeNs + 2); // 25 mins + 2 ns.
+//    EXPECT_EQ(baseTimeNs + startBucketNum * bucketSizeNs + 4 * bucketSizeNs, expectedPullTimeNs);
+//
+//    // Create random event to deactivate metric.
+//    auto deactivationEvent = CreateScreenBrightnessChangedEvent(50, activationNs + ttlNs + 1);
+//    processor->OnLogEvent(deactivationEvent.get());
+//    EXPECT_FALSE(processor->mMetricsManagers.begin()->second->mAllMetricProducers[0]->isActive());
+//
+//    processor->informPullAlarmFired(expectedPullTimeNs + 3);
+//    EXPECT_EQ(baseTimeNs + startBucketNum * bucketSizeNs + 5 * bucketSizeNs, expectedPullTimeNs);
+//
+//    processor->informPullAlarmFired(expectedPullTimeNs + 4);
+//    EXPECT_EQ(baseTimeNs + startBucketNum * bucketSizeNs + 6 * bucketSizeNs, expectedPullTimeNs);
+//
+//    ConfigMetricsReportList reports;
+//    vector<uint8_t> buffer;
+//    processor->onDumpReport(cfgKey, configAddedTimeNs + 7 * bucketSizeNs + 10, false, true,
+//                            ADB_DUMP, FAST, &buffer);
+//    EXPECT_TRUE(buffer.size() > 0);
+//    EXPECT_TRUE(reports.ParseFromArray(&buffer[0], buffer.size()));
+//    backfillDimensionPath(&reports);
+//    backfillStringInReport(&reports);
+//    backfillStartEndTimestamp(&reports);
+//    EXPECT_EQ(1, reports.reports_size());
+//    EXPECT_EQ(1, reports.reports(0).metrics_size());
+//    StatsLogReport::ValueMetricDataWrapper valueMetrics;
+//    sortMetricDataByDimensionsValue(
+//            reports.reports(0).metrics(0).value_metrics(), &valueMetrics);
+//    EXPECT_GT((int)valueMetrics.data_size(), 0);
+//
+//    auto data = valueMetrics.data(0);
+//    EXPECT_EQ(android::util::SUBSYSTEM_SLEEP_STATE, data.dimensions_in_what().field());
+//    EXPECT_EQ(1, data.dimensions_in_what().value_tuple().dimensions_value_size());
+//    EXPECT_EQ(1 /* subsystem name field */,
+//              data.dimensions_in_what().value_tuple().dimensions_value(0).field());
+//    EXPECT_FALSE(data.dimensions_in_what().value_tuple().dimensions_value(0).value_str().empty());
+//    // We have 2 full buckets, the two surrounding the activation are dropped.
+//    EXPECT_EQ(2, data.bucket_info_size());
+//
+//    auto bucketInfo = data.bucket_info(0);
+//    EXPECT_EQ(baseTimeNs + 3 * bucketSizeNs, bucketInfo.start_bucket_elapsed_nanos());
+//    EXPECT_EQ(baseTimeNs + 4 * bucketSizeNs, bucketInfo.end_bucket_elapsed_nanos());
+//    EXPECT_EQ(1, bucketInfo.values_size());
+//
+//    bucketInfo = data.bucket_info(1);
+//    EXPECT_EQ(baseTimeNs + 4 * bucketSizeNs, bucketInfo.start_bucket_elapsed_nanos());
+//    EXPECT_EQ(baseTimeNs + 5 * bucketSizeNs, bucketInfo.end_bucket_elapsed_nanos());
+//    EXPECT_EQ(1, bucketInfo.values_size());
+//}
 
 /**
  * Test initialization of a simple value metric that is sliced by a state.
diff --git a/cmds/statsd/tests/e2e/WakelockDuration_e2e_test.cpp b/cmds/statsd/tests/e2e/WakelockDuration_e2e_test.cpp
index e13bf14..21092e2 100644
--- a/cmds/statsd/tests/e2e/WakelockDuration_e2e_test.cpp
+++ b/cmds/statsd/tests/e2e/WakelockDuration_e2e_test.cpp
@@ -69,282 +69,284 @@
                                                       CreateAttribution(222, "GMSCoreModule1"),
                                                       CreateAttribution(222, "GMSCoreModule2")};
 
-/*
-Events:
-Screen off is met from (200ns,1 min+500ns].
-Acquire event for wl1 from 2ns to 1min+2ns
-Acquire event for wl2 from 1min-10ns to 2min-15ns
-*/
-void FeedEvents(StatsdConfig config, sp<StatsLogProcessor> processor) {
-    uint64_t bucketStartTimeNs = 10000000000;
-    uint64_t bucketSizeNs =
-            TimeUnitToBucketSizeInMillis(config.duration_metric(0).bucket()) * 1000000LL;
-
-    auto screenTurnedOnEvent = CreateScreenStateChangedEvent(
-            android::view::DisplayStateEnum::DISPLAY_STATE_ON, bucketStartTimeNs + 1);
-    auto screenTurnedOffEvent = CreateScreenStateChangedEvent(
-            android::view::DisplayStateEnum::DISPLAY_STATE_OFF, bucketStartTimeNs + 200);
-    auto screenTurnedOnEvent2 =
-            CreateScreenStateChangedEvent(android::view::DisplayStateEnum::DISPLAY_STATE_ON,
-                                          bucketStartTimeNs + bucketSizeNs + 500);
-
-    auto acquireEvent1 = CreateAcquireWakelockEvent(attributions1, "wl1", bucketStartTimeNs + 2);
-    auto releaseEvent1 =
-            CreateReleaseWakelockEvent(attributions1, "wl1", bucketStartTimeNs + bucketSizeNs + 2);
-    auto acquireEvent2 =
-            CreateAcquireWakelockEvent(attributions2, "wl2", bucketStartTimeNs + bucketSizeNs - 10);
-    auto releaseEvent2 = CreateReleaseWakelockEvent(attributions2, "wl2",
-                                                    bucketStartTimeNs + 2 * bucketSizeNs - 15);
-
-    std::vector<std::unique_ptr<LogEvent>> events;
-
-    events.push_back(std::move(screenTurnedOnEvent));
-    events.push_back(std::move(screenTurnedOffEvent));
-    events.push_back(std::move(screenTurnedOnEvent2));
-    events.push_back(std::move(acquireEvent1));
-    events.push_back(std::move(acquireEvent2));
-    events.push_back(std::move(releaseEvent1));
-    events.push_back(std::move(releaseEvent2));
-
-    sortLogEventsByTimestamp(&events);
-
-    for (const auto& event : events) {
-        processor->OnLogEvent(event.get());
-    }
-}
+// TODO(b/149590301): Update this helper to use new socket schema.
+///*
+//Events:
+//Screen off is met from (200ns,1 min+500ns].
+//Acquire event for wl1 from 2ns to 1min+2ns
+//Acquire event for wl2 from 1min-10ns to 2min-15ns
+//*/
+//void FeedEvents(StatsdConfig config, sp<StatsLogProcessor> processor) {
+//    uint64_t bucketStartTimeNs = 10000000000;
+//    uint64_t bucketSizeNs =
+//            TimeUnitToBucketSizeInMillis(config.duration_metric(0).bucket()) * 1000000LL;
+//
+//    auto screenTurnedOnEvent = CreateScreenStateChangedEvent(
+//            android::view::DisplayStateEnum::DISPLAY_STATE_ON, bucketStartTimeNs + 1);
+//    auto screenTurnedOffEvent = CreateScreenStateChangedEvent(
+//            android::view::DisplayStateEnum::DISPLAY_STATE_OFF, bucketStartTimeNs + 200);
+//    auto screenTurnedOnEvent2 =
+//            CreateScreenStateChangedEvent(android::view::DisplayStateEnum::DISPLAY_STATE_ON,
+//                                          bucketStartTimeNs + bucketSizeNs + 500);
+//
+//    auto acquireEvent1 = CreateAcquireWakelockEvent(attributions1, "wl1", bucketStartTimeNs + 2);
+//    auto releaseEvent1 =
+//            CreateReleaseWakelockEvent(attributions1, "wl1", bucketStartTimeNs + bucketSizeNs + 2);
+//    auto acquireEvent2 =
+//            CreateAcquireWakelockEvent(attributions2, "wl2", bucketStartTimeNs + bucketSizeNs - 10);
+//    auto releaseEvent2 = CreateReleaseWakelockEvent(attributions2, "wl2",
+//                                                    bucketStartTimeNs + 2 * bucketSizeNs - 15);
+//
+//    std::vector<std::unique_ptr<LogEvent>> events;
+//
+//    events.push_back(std::move(screenTurnedOnEvent));
+//    events.push_back(std::move(screenTurnedOffEvent));
+//    events.push_back(std::move(screenTurnedOnEvent2));
+//    events.push_back(std::move(acquireEvent1));
+//    events.push_back(std::move(acquireEvent2));
+//    events.push_back(std::move(releaseEvent1));
+//    events.push_back(std::move(releaseEvent2));
+//
+//    sortLogEventsByTimestamp(&events);
+//
+//    for (const auto& event : events) {
+//        processor->OnLogEvent(event.get());
+//    }
+//}
 
 }  // namespace
 
-TEST(WakelockDurationE2eTest, TestAggregatedPredicateDimensionsForSumDuration1) {
-    ConfigKey cfgKey;
-    auto config = CreateStatsdConfig(DurationMetric::SUM);
-    uint64_t bucketStartTimeNs = 10000000000;
-    uint64_t bucketSizeNs =
-            TimeUnitToBucketSizeInMillis(config.duration_metric(0).bucket()) * 1000000LL;
-    auto processor = CreateStatsLogProcessor(bucketStartTimeNs, bucketStartTimeNs, config, cfgKey);
-    EXPECT_EQ(processor->mMetricsManagers.size(), 1u);
-    EXPECT_TRUE(processor->mMetricsManagers.begin()->second->isConfigValid());
-    FeedEvents(config, processor);
-    vector<uint8_t> buffer;
-    ConfigMetricsReportList reports;
-    processor->onDumpReport(cfgKey, bucketStartTimeNs + 2 * bucketSizeNs - 1, false, true,
-                            ADB_DUMP, FAST, &buffer);
-    EXPECT_TRUE(buffer.size() > 0);
-    EXPECT_TRUE(reports.ParseFromArray(&buffer[0], buffer.size()));
-    backfillDimensionPath(&reports);
-    backfillStringInReport(&reports);
-    backfillStartEndTimestamp(&reports);
-
-    EXPECT_EQ(reports.reports_size(), 1);
-    EXPECT_EQ(reports.reports(0).metrics_size(), 1);
-    // Only 1 dimension output. The tag dimension in the predicate has been aggregated.
-    EXPECT_EQ(reports.reports(0).metrics(0).duration_metrics().data_size(), 1);
-
-    auto data = reports.reports(0).metrics(0).duration_metrics().data(0);
-    // Validate dimension value.
-    ValidateAttributionUidDimension(data.dimensions_in_what(),
-                                    android::util::WAKELOCK_STATE_CHANGED, 111);
-    // Validate bucket info.
-    EXPECT_EQ(reports.reports(0).metrics(0).duration_metrics().data(0).bucket_info_size(), 1);
-    data = reports.reports(0).metrics(0).duration_metrics().data(0);
-    // The wakelock holding interval starts from the screen off event and to the end of the 1st
-    // bucket.
-    EXPECT_EQ((unsigned long long)data.bucket_info(0).duration_nanos(), bucketSizeNs - 200);
-}
-
-TEST(WakelockDurationE2eTest, TestAggregatedPredicateDimensionsForSumDuration2) {
-    ConfigKey cfgKey;
-    auto config = CreateStatsdConfig(DurationMetric::SUM);
-    uint64_t bucketStartTimeNs = 10000000000;
-    uint64_t bucketSizeNs =
-            TimeUnitToBucketSizeInMillis(config.duration_metric(0).bucket()) * 1000000LL;
-    auto processor = CreateStatsLogProcessor(bucketStartTimeNs, bucketStartTimeNs, config, cfgKey);
-    EXPECT_EQ(processor->mMetricsManagers.size(), 1u);
-    EXPECT_TRUE(processor->mMetricsManagers.begin()->second->isConfigValid());
-    FeedEvents(config, processor);
-    vector<uint8_t> buffer;
-    ConfigMetricsReportList reports;
-    processor->onDumpReport(cfgKey, bucketStartTimeNs + 2 * bucketSizeNs + 1, false, true,
-                            ADB_DUMP, FAST, &buffer);
-    EXPECT_TRUE(buffer.size() > 0);
-    EXPECT_TRUE(reports.ParseFromArray(&buffer[0], buffer.size()));
-    backfillDimensionPath(&reports);
-    backfillStringInReport(&reports);
-    backfillStartEndTimestamp(&reports);
-    EXPECT_EQ(reports.reports_size(), 1);
-    EXPECT_EQ(reports.reports(0).metrics_size(), 1);
-    EXPECT_EQ(reports.reports(0).metrics(0).duration_metrics().data_size(), 1);
-    // Dump the report after the end of 2nd bucket.
-    EXPECT_EQ(reports.reports(0).metrics(0).duration_metrics().data(0).bucket_info_size(), 2);
-    auto data = reports.reports(0).metrics(0).duration_metrics().data(0);
-    // Validate dimension value.
-    ValidateAttributionUidDimension(data.dimensions_in_what(),
-                                    android::util::WAKELOCK_STATE_CHANGED, 111);
-    // Two output buckets.
-    // The wakelock holding interval in the 1st bucket starts from the screen off event and to
-    // the end of the 1st bucket.
-    EXPECT_EQ((unsigned long long)data.bucket_info(0).duration_nanos(),
-              bucketStartTimeNs + bucketSizeNs - (bucketStartTimeNs + 200));
-    // The wakelock holding interval in the 2nd bucket starts at the beginning of the bucket and
-    // ends at the second screen on event.
-    EXPECT_EQ((unsigned long long)data.bucket_info(1).duration_nanos(), 500UL);
-}
-TEST(WakelockDurationE2eTest, TestAggregatedPredicateDimensionsForSumDuration3) {
-    ConfigKey cfgKey;
-    auto config = CreateStatsdConfig(DurationMetric::SUM);
-    uint64_t bucketStartTimeNs = 10000000000;
-    uint64_t bucketSizeNs =
-            TimeUnitToBucketSizeInMillis(config.duration_metric(0).bucket()) * 1000000LL;
-    auto processor = CreateStatsLogProcessor(bucketStartTimeNs, bucketStartTimeNs, config, cfgKey);
-    EXPECT_EQ(processor->mMetricsManagers.size(), 1u);
-    EXPECT_TRUE(processor->mMetricsManagers.begin()->second->isConfigValid());
-    FeedEvents(config, processor);
-    vector<uint8_t> buffer;
-    ConfigMetricsReportList reports;
-
-    std::vector<std::unique_ptr<LogEvent>> events;
-    events.push_back(
-            CreateScreenStateChangedEvent(android::view::DisplayStateEnum::DISPLAY_STATE_OFF,
-                                          bucketStartTimeNs + 2 * bucketSizeNs + 90));
-    events.push_back(CreateAcquireWakelockEvent(attributions1, "wl3",
-                                                bucketStartTimeNs + 2 * bucketSizeNs + 100));
-    events.push_back(CreateReleaseWakelockEvent(attributions1, "wl3",
-                                                bucketStartTimeNs + 5 * bucketSizeNs + 100));
-    sortLogEventsByTimestamp(&events);
-    for (const auto& event : events) {
-        processor->OnLogEvent(event.get());
-    }
-
-    processor->onDumpReport(cfgKey, bucketStartTimeNs + 6 * bucketSizeNs + 1, false, true,
-                            ADB_DUMP, FAST, &buffer);
-    EXPECT_TRUE(buffer.size() > 0);
-    EXPECT_TRUE(reports.ParseFromArray(&buffer[0], buffer.size()));
-    backfillDimensionPath(&reports);
-    backfillStringInReport(&reports);
-    backfillStartEndTimestamp(&reports);
-    EXPECT_EQ(reports.reports_size(), 1);
-    EXPECT_EQ(reports.reports(0).metrics_size(), 1);
-    EXPECT_EQ(reports.reports(0).metrics(0).duration_metrics().data_size(), 1);
-    EXPECT_EQ(reports.reports(0).metrics(0).duration_metrics().data(0).bucket_info_size(), 6);
-    auto data = reports.reports(0).metrics(0).duration_metrics().data(0);
-    ValidateAttributionUidDimension(data.dimensions_in_what(),
-                                    android::util::WAKELOCK_STATE_CHANGED, 111);
-    // The last wakelock holding spans 4 buckets.
-    EXPECT_EQ((unsigned long long)data.bucket_info(2).duration_nanos(), bucketSizeNs - 100);
-    EXPECT_EQ((unsigned long long)data.bucket_info(3).duration_nanos(), bucketSizeNs);
-    EXPECT_EQ((unsigned long long)data.bucket_info(4).duration_nanos(), bucketSizeNs);
-    EXPECT_EQ((unsigned long long)data.bucket_info(5).duration_nanos(), 100UL);
-}
-
-TEST(WakelockDurationE2eTest, TestAggregatedPredicateDimensionsForMaxDuration1) {
-    ConfigKey cfgKey;
-    auto config = CreateStatsdConfig(DurationMetric::MAX_SPARSE);
-    uint64_t bucketStartTimeNs = 10000000000;
-    uint64_t bucketSizeNs =
-            TimeUnitToBucketSizeInMillis(config.duration_metric(0).bucket()) * 1000000LL;
-    auto processor = CreateStatsLogProcessor(bucketStartTimeNs, bucketStartTimeNs, config, cfgKey);
-    EXPECT_EQ(processor->mMetricsManagers.size(), 1u);
-    EXPECT_TRUE(processor->mMetricsManagers.begin()->second->isConfigValid());
-    FeedEvents(config, processor);
-    ConfigMetricsReportList reports;
-    vector<uint8_t> buffer;
-    processor->onDumpReport(cfgKey, bucketStartTimeNs + 2 * bucketSizeNs - 1, false, true,
-                            ADB_DUMP, FAST, &buffer);
-    EXPECT_TRUE(buffer.size() > 0);
-
-    EXPECT_TRUE(reports.ParseFromArray(&buffer[0], buffer.size()));
-    backfillDimensionPath(&reports);
-    backfillStringInReport(&reports);
-    backfillStartEndTimestamp(&reports);
-
-    EXPECT_EQ(reports.reports_size(), 1);
-
-    // When using ProtoOutputStream, if nothing written to a sub msg, it won't be treated as
-    // one. It was previsouly 1 because we had a fake onDumpReport which calls add_metric() by
-    // itself.
-    EXPECT_EQ(1, reports.reports(0).metrics_size());
-    EXPECT_EQ(0, reports.reports(0).metrics(0).duration_metrics().data_size());
-}
-
-TEST(WakelockDurationE2eTest, TestAggregatedPredicateDimensionsForMaxDuration2) {
-    ConfigKey cfgKey;
-    auto config = CreateStatsdConfig(DurationMetric::MAX_SPARSE);
-    uint64_t bucketStartTimeNs = 10000000000;
-    uint64_t bucketSizeNs =
-            TimeUnitToBucketSizeInMillis(config.duration_metric(0).bucket()) * 1000000LL;
-    auto processor = CreateStatsLogProcessor(bucketStartTimeNs, bucketStartTimeNs, config, cfgKey);
-    EXPECT_EQ(processor->mMetricsManagers.size(), 1u);
-    EXPECT_TRUE(processor->mMetricsManagers.begin()->second->isConfigValid());
-    FeedEvents(config, processor);
-    ConfigMetricsReportList reports;
-    vector<uint8_t> buffer;
-    processor->onDumpReport(cfgKey, bucketStartTimeNs + 2 * bucketSizeNs + 1, false, true,
-                            ADB_DUMP, FAST, &buffer);
-    EXPECT_TRUE(buffer.size() > 0);
-    EXPECT_TRUE(reports.ParseFromArray(&buffer[0], buffer.size()));
-    backfillDimensionPath(&reports);
-    backfillStringInReport(&reports);
-    backfillStartEndTimestamp(&reports);
-    EXPECT_EQ(reports.reports_size(), 1);
-    EXPECT_EQ(reports.reports(0).metrics_size(), 1);
-    EXPECT_EQ(reports.reports(0).metrics(0).duration_metrics().data_size(), 1);
-    // Dump the report after the end of 2nd bucket. One dimension with one bucket.
-    EXPECT_EQ(reports.reports(0).metrics(0).duration_metrics().data(0).bucket_info_size(), 1);
-    auto data = reports.reports(0).metrics(0).duration_metrics().data(0);
-    // Validate dimension value.
-    ValidateAttributionUidDimension(data.dimensions_in_what(),
-                                    android::util::WAKELOCK_STATE_CHANGED, 111);
-    // The max is acquire event for wl1 to screen off start.
-    EXPECT_EQ((unsigned long long)data.bucket_info(0).duration_nanos(), bucketSizeNs + 2 - 200);
-}
-
-TEST(WakelockDurationE2eTest, TestAggregatedPredicateDimensionsForMaxDuration3) {
-    ConfigKey cfgKey;
-    auto config = CreateStatsdConfig(DurationMetric::MAX_SPARSE);
-    uint64_t bucketStartTimeNs = 10000000000;
-    uint64_t bucketSizeNs =
-            TimeUnitToBucketSizeInMillis(config.duration_metric(0).bucket()) * 1000000LL;
-    auto processor = CreateStatsLogProcessor(bucketStartTimeNs, bucketStartTimeNs, config, cfgKey);
-    EXPECT_EQ(processor->mMetricsManagers.size(), 1u);
-    EXPECT_TRUE(processor->mMetricsManagers.begin()->second->isConfigValid());
-    FeedEvents(config, processor);
-    ConfigMetricsReportList reports;
-    vector<uint8_t> buffer;
-
-    std::vector<std::unique_ptr<LogEvent>> events;
-    events.push_back(
-            CreateScreenStateChangedEvent(android::view::DisplayStateEnum::DISPLAY_STATE_OFF,
-                                          bucketStartTimeNs + 2 * bucketSizeNs + 90));
-    events.push_back(CreateAcquireWakelockEvent(attributions1, "wl3",
-                                                bucketStartTimeNs + 2 * bucketSizeNs + 100));
-    events.push_back(CreateReleaseWakelockEvent(attributions1, "wl3",
-                                                bucketStartTimeNs + 5 * bucketSizeNs + 100));
-    sortLogEventsByTimestamp(&events);
-    for (const auto& event : events) {
-        processor->OnLogEvent(event.get());
-    }
-
-    processor->onDumpReport(cfgKey, bucketStartTimeNs + 6 * bucketSizeNs + 1, false, true,
-                            ADB_DUMP, FAST, &buffer);
-    EXPECT_TRUE(buffer.size() > 0);
-    EXPECT_TRUE(reports.ParseFromArray(&buffer[0], buffer.size()));
-    backfillDimensionPath(&reports);
-    backfillStringInReport(&reports);
-    backfillStartEndTimestamp(&reports);
-    EXPECT_EQ(reports.reports_size(), 1);
-    EXPECT_EQ(reports.reports(0).metrics_size(), 1);
-    EXPECT_EQ(reports.reports(0).metrics(0).duration_metrics().data_size(), 1);
-    EXPECT_EQ(reports.reports(0).metrics(0).duration_metrics().data(0).bucket_info_size(), 2);
-    auto data = reports.reports(0).metrics(0).duration_metrics().data(0);
-    ValidateAttributionUidDimension(data.dimensions_in_what(),
-                                    android::util::WAKELOCK_STATE_CHANGED, 111);
-    // The last wakelock holding spans 4 buckets.
-    EXPECT_EQ((unsigned long long)data.bucket_info(1).duration_nanos(), 3 * bucketSizeNs);
-    EXPECT_EQ((unsigned long long)data.bucket_info(1).start_bucket_elapsed_nanos(),
-              bucketStartTimeNs + 5 * bucketSizeNs);
-    EXPECT_EQ((unsigned long long)data.bucket_info(1).end_bucket_elapsed_nanos(),
-              bucketStartTimeNs + 6 * bucketSizeNs);
-}
+// TODO(b/149590301): Update these tests to use new socket schema.
+//TEST(WakelockDurationE2eTest, TestAggregatedPredicateDimensionsForSumDuration1) {
+//    ConfigKey cfgKey;
+//    auto config = CreateStatsdConfig(DurationMetric::SUM);
+//    uint64_t bucketStartTimeNs = 10000000000;
+//    uint64_t bucketSizeNs =
+//            TimeUnitToBucketSizeInMillis(config.duration_metric(0).bucket()) * 1000000LL;
+//    auto processor = CreateStatsLogProcessor(bucketStartTimeNs, bucketStartTimeNs, config, cfgKey);
+//    EXPECT_EQ(processor->mMetricsManagers.size(), 1u);
+//    EXPECT_TRUE(processor->mMetricsManagers.begin()->second->isConfigValid());
+//    FeedEvents(config, processor);
+//    vector<uint8_t> buffer;
+//    ConfigMetricsReportList reports;
+//    processor->onDumpReport(cfgKey, bucketStartTimeNs + 2 * bucketSizeNs - 1, false, true,
+//                            ADB_DUMP, FAST, &buffer);
+//    EXPECT_TRUE(buffer.size() > 0);
+//    EXPECT_TRUE(reports.ParseFromArray(&buffer[0], buffer.size()));
+//    backfillDimensionPath(&reports);
+//    backfillStringInReport(&reports);
+//    backfillStartEndTimestamp(&reports);
+//
+//    EXPECT_EQ(reports.reports_size(), 1);
+//    EXPECT_EQ(reports.reports(0).metrics_size(), 1);
+//    // Only 1 dimension output. The tag dimension in the predicate has been aggregated.
+//    EXPECT_EQ(reports.reports(0).metrics(0).duration_metrics().data_size(), 1);
+//
+//    auto data = reports.reports(0).metrics(0).duration_metrics().data(0);
+//    // Validate dimension value.
+//    ValidateAttributionUidDimension(data.dimensions_in_what(),
+//                                    android::util::WAKELOCK_STATE_CHANGED, 111);
+//    // Validate bucket info.
+//    EXPECT_EQ(reports.reports(0).metrics(0).duration_metrics().data(0).bucket_info_size(), 1);
+//    data = reports.reports(0).metrics(0).duration_metrics().data(0);
+//    // The wakelock holding interval starts from the screen off event and to the end of the 1st
+//    // bucket.
+//    EXPECT_EQ((unsigned long long)data.bucket_info(0).duration_nanos(), bucketSizeNs - 200);
+//}
+//
+//TEST(WakelockDurationE2eTest, TestAggregatedPredicateDimensionsForSumDuration2) {
+//    ConfigKey cfgKey;
+//    auto config = CreateStatsdConfig(DurationMetric::SUM);
+//    uint64_t bucketStartTimeNs = 10000000000;
+//    uint64_t bucketSizeNs =
+//            TimeUnitToBucketSizeInMillis(config.duration_metric(0).bucket()) * 1000000LL;
+//    auto processor = CreateStatsLogProcessor(bucketStartTimeNs, bucketStartTimeNs, config, cfgKey);
+//    EXPECT_EQ(processor->mMetricsManagers.size(), 1u);
+//    EXPECT_TRUE(processor->mMetricsManagers.begin()->second->isConfigValid());
+//    FeedEvents(config, processor);
+//    vector<uint8_t> buffer;
+//    ConfigMetricsReportList reports;
+//    processor->onDumpReport(cfgKey, bucketStartTimeNs + 2 * bucketSizeNs + 1, false, true,
+//                            ADB_DUMP, FAST, &buffer);
+//    EXPECT_TRUE(buffer.size() > 0);
+//    EXPECT_TRUE(reports.ParseFromArray(&buffer[0], buffer.size()));
+//    backfillDimensionPath(&reports);
+//    backfillStringInReport(&reports);
+//    backfillStartEndTimestamp(&reports);
+//    EXPECT_EQ(reports.reports_size(), 1);
+//    EXPECT_EQ(reports.reports(0).metrics_size(), 1);
+//    EXPECT_EQ(reports.reports(0).metrics(0).duration_metrics().data_size(), 1);
+//    // Dump the report after the end of 2nd bucket.
+//    EXPECT_EQ(reports.reports(0).metrics(0).duration_metrics().data(0).bucket_info_size(), 2);
+//    auto data = reports.reports(0).metrics(0).duration_metrics().data(0);
+//    // Validate dimension value.
+//    ValidateAttributionUidDimension(data.dimensions_in_what(),
+//                                    android::util::WAKELOCK_STATE_CHANGED, 111);
+//    // Two output buckets.
+//    // The wakelock holding interval in the 1st bucket starts from the screen off event and to
+//    // the end of the 1st bucket.
+//    EXPECT_EQ((unsigned long long)data.bucket_info(0).duration_nanos(),
+//              bucketStartTimeNs + bucketSizeNs - (bucketStartTimeNs + 200));
+//    // The wakelock holding interval in the 2nd bucket starts at the beginning of the bucket and
+//    // ends at the second screen on event.
+//    EXPECT_EQ((unsigned long long)data.bucket_info(1).duration_nanos(), 500UL);
+//}
+//TEST(WakelockDurationE2eTest, TestAggregatedPredicateDimensionsForSumDuration3) {
+//    ConfigKey cfgKey;
+//    auto config = CreateStatsdConfig(DurationMetric::SUM);
+//    uint64_t bucketStartTimeNs = 10000000000;
+//    uint64_t bucketSizeNs =
+//            TimeUnitToBucketSizeInMillis(config.duration_metric(0).bucket()) * 1000000LL;
+//    auto processor = CreateStatsLogProcessor(bucketStartTimeNs, bucketStartTimeNs, config, cfgKey);
+//    EXPECT_EQ(processor->mMetricsManagers.size(), 1u);
+//    EXPECT_TRUE(processor->mMetricsManagers.begin()->second->isConfigValid());
+//    FeedEvents(config, processor);
+//    vector<uint8_t> buffer;
+//    ConfigMetricsReportList reports;
+//
+//    std::vector<std::unique_ptr<LogEvent>> events;
+//    events.push_back(
+//            CreateScreenStateChangedEvent(android::view::DisplayStateEnum::DISPLAY_STATE_OFF,
+//                                          bucketStartTimeNs + 2 * bucketSizeNs + 90));
+//    events.push_back(CreateAcquireWakelockEvent(attributions1, "wl3",
+//                                                bucketStartTimeNs + 2 * bucketSizeNs + 100));
+//    events.push_back(CreateReleaseWakelockEvent(attributions1, "wl3",
+//                                                bucketStartTimeNs + 5 * bucketSizeNs + 100));
+//    sortLogEventsByTimestamp(&events);
+//    for (const auto& event : events) {
+//        processor->OnLogEvent(event.get());
+//    }
+//
+//    processor->onDumpReport(cfgKey, bucketStartTimeNs + 6 * bucketSizeNs + 1, false, true,
+//                            ADB_DUMP, FAST, &buffer);
+//    EXPECT_TRUE(buffer.size() > 0);
+//    EXPECT_TRUE(reports.ParseFromArray(&buffer[0], buffer.size()));
+//    backfillDimensionPath(&reports);
+//    backfillStringInReport(&reports);
+//    backfillStartEndTimestamp(&reports);
+//    EXPECT_EQ(reports.reports_size(), 1);
+//    EXPECT_EQ(reports.reports(0).metrics_size(), 1);
+//    EXPECT_EQ(reports.reports(0).metrics(0).duration_metrics().data_size(), 1);
+//    EXPECT_EQ(reports.reports(0).metrics(0).duration_metrics().data(0).bucket_info_size(), 6);
+//    auto data = reports.reports(0).metrics(0).duration_metrics().data(0);
+//    ValidateAttributionUidDimension(data.dimensions_in_what(),
+//                                    android::util::WAKELOCK_STATE_CHANGED, 111);
+//    // The last wakelock holding spans 4 buckets.
+//    EXPECT_EQ((unsigned long long)data.bucket_info(2).duration_nanos(), bucketSizeNs - 100);
+//    EXPECT_EQ((unsigned long long)data.bucket_info(3).duration_nanos(), bucketSizeNs);
+//    EXPECT_EQ((unsigned long long)data.bucket_info(4).duration_nanos(), bucketSizeNs);
+//    EXPECT_EQ((unsigned long long)data.bucket_info(5).duration_nanos(), 100UL);
+//}
+//
+//TEST(WakelockDurationE2eTest, TestAggregatedPredicateDimensionsForMaxDuration1) {
+//    ConfigKey cfgKey;
+//    auto config = CreateStatsdConfig(DurationMetric::MAX_SPARSE);
+//    uint64_t bucketStartTimeNs = 10000000000;
+//    uint64_t bucketSizeNs =
+//            TimeUnitToBucketSizeInMillis(config.duration_metric(0).bucket()) * 1000000LL;
+//    auto processor = CreateStatsLogProcessor(bucketStartTimeNs, bucketStartTimeNs, config, cfgKey);
+//    EXPECT_EQ(processor->mMetricsManagers.size(), 1u);
+//    EXPECT_TRUE(processor->mMetricsManagers.begin()->second->isConfigValid());
+//    FeedEvents(config, processor);
+//    ConfigMetricsReportList reports;
+//    vector<uint8_t> buffer;
+//    processor->onDumpReport(cfgKey, bucketStartTimeNs + 2 * bucketSizeNs - 1, false, true,
+//                            ADB_DUMP, FAST, &buffer);
+//    EXPECT_TRUE(buffer.size() > 0);
+//
+//    EXPECT_TRUE(reports.ParseFromArray(&buffer[0], buffer.size()));
+//    backfillDimensionPath(&reports);
+//    backfillStringInReport(&reports);
+//    backfillStartEndTimestamp(&reports);
+//
+//    EXPECT_EQ(reports.reports_size(), 1);
+//
+//    // When using ProtoOutputStream, if nothing written to a sub msg, it won't be treated as
+//    // one. It was previsouly 1 because we had a fake onDumpReport which calls add_metric() by
+//    // itself.
+//    EXPECT_EQ(1, reports.reports(0).metrics_size());
+//    EXPECT_EQ(0, reports.reports(0).metrics(0).duration_metrics().data_size());
+//}
+//
+//TEST(WakelockDurationE2eTest, TestAggregatedPredicateDimensionsForMaxDuration2) {
+//    ConfigKey cfgKey;
+//    auto config = CreateStatsdConfig(DurationMetric::MAX_SPARSE);
+//    uint64_t bucketStartTimeNs = 10000000000;
+//    uint64_t bucketSizeNs =
+//            TimeUnitToBucketSizeInMillis(config.duration_metric(0).bucket()) * 1000000LL;
+//    auto processor = CreateStatsLogProcessor(bucketStartTimeNs, bucketStartTimeNs, config, cfgKey);
+//    EXPECT_EQ(processor->mMetricsManagers.size(), 1u);
+//    EXPECT_TRUE(processor->mMetricsManagers.begin()->second->isConfigValid());
+//    FeedEvents(config, processor);
+//    ConfigMetricsReportList reports;
+//    vector<uint8_t> buffer;
+//    processor->onDumpReport(cfgKey, bucketStartTimeNs + 2 * bucketSizeNs + 1, false, true,
+//                            ADB_DUMP, FAST, &buffer);
+//    EXPECT_TRUE(buffer.size() > 0);
+//    EXPECT_TRUE(reports.ParseFromArray(&buffer[0], buffer.size()));
+//    backfillDimensionPath(&reports);
+//    backfillStringInReport(&reports);
+//    backfillStartEndTimestamp(&reports);
+//    EXPECT_EQ(reports.reports_size(), 1);
+//    EXPECT_EQ(reports.reports(0).metrics_size(), 1);
+//    EXPECT_EQ(reports.reports(0).metrics(0).duration_metrics().data_size(), 1);
+//    // Dump the report after the end of 2nd bucket. One dimension with one bucket.
+//    EXPECT_EQ(reports.reports(0).metrics(0).duration_metrics().data(0).bucket_info_size(), 1);
+//    auto data = reports.reports(0).metrics(0).duration_metrics().data(0);
+//    // Validate dimension value.
+//    ValidateAttributionUidDimension(data.dimensions_in_what(),
+//                                    android::util::WAKELOCK_STATE_CHANGED, 111);
+//    // The max is acquire event for wl1 to screen off start.
+//    EXPECT_EQ((unsigned long long)data.bucket_info(0).duration_nanos(), bucketSizeNs + 2 - 200);
+//}
+//
+//TEST(WakelockDurationE2eTest, TestAggregatedPredicateDimensionsForMaxDuration3) {
+//    ConfigKey cfgKey;
+//    auto config = CreateStatsdConfig(DurationMetric::MAX_SPARSE);
+//    uint64_t bucketStartTimeNs = 10000000000;
+//    uint64_t bucketSizeNs =
+//            TimeUnitToBucketSizeInMillis(config.duration_metric(0).bucket()) * 1000000LL;
+//    auto processor = CreateStatsLogProcessor(bucketStartTimeNs, bucketStartTimeNs, config, cfgKey);
+//    EXPECT_EQ(processor->mMetricsManagers.size(), 1u);
+//    EXPECT_TRUE(processor->mMetricsManagers.begin()->second->isConfigValid());
+//    FeedEvents(config, processor);
+//    ConfigMetricsReportList reports;
+//    vector<uint8_t> buffer;
+//
+//    std::vector<std::unique_ptr<LogEvent>> events;
+//    events.push_back(
+//            CreateScreenStateChangedEvent(android::view::DisplayStateEnum::DISPLAY_STATE_OFF,
+//                                          bucketStartTimeNs + 2 * bucketSizeNs + 90));
+//    events.push_back(CreateAcquireWakelockEvent(attributions1, "wl3",
+//                                                bucketStartTimeNs + 2 * bucketSizeNs + 100));
+//    events.push_back(CreateReleaseWakelockEvent(attributions1, "wl3",
+//                                                bucketStartTimeNs + 5 * bucketSizeNs + 100));
+//    sortLogEventsByTimestamp(&events);
+//    for (const auto& event : events) {
+//        processor->OnLogEvent(event.get());
+//    }
+//
+//    processor->onDumpReport(cfgKey, bucketStartTimeNs + 6 * bucketSizeNs + 1, false, true,
+//                            ADB_DUMP, FAST, &buffer);
+//    EXPECT_TRUE(buffer.size() > 0);
+//    EXPECT_TRUE(reports.ParseFromArray(&buffer[0], buffer.size()));
+//    backfillDimensionPath(&reports);
+//    backfillStringInReport(&reports);
+//    backfillStartEndTimestamp(&reports);
+//    EXPECT_EQ(reports.reports_size(), 1);
+//    EXPECT_EQ(reports.reports(0).metrics_size(), 1);
+//    EXPECT_EQ(reports.reports(0).metrics(0).duration_metrics().data_size(), 1);
+//    EXPECT_EQ(reports.reports(0).metrics(0).duration_metrics().data(0).bucket_info_size(), 2);
+//    auto data = reports.reports(0).metrics(0).duration_metrics().data(0);
+//    ValidateAttributionUidDimension(data.dimensions_in_what(),
+//                                    android::util::WAKELOCK_STATE_CHANGED, 111);
+//    // The last wakelock holding spans 4 buckets.
+//    EXPECT_EQ((unsigned long long)data.bucket_info(1).duration_nanos(), 3 * bucketSizeNs);
+//    EXPECT_EQ((unsigned long long)data.bucket_info(1).start_bucket_elapsed_nanos(),
+//              bucketStartTimeNs + 5 * bucketSizeNs);
+//    EXPECT_EQ((unsigned long long)data.bucket_info(1).end_bucket_elapsed_nanos(),
+//              bucketStartTimeNs + 6 * bucketSizeNs);
+//}
 
 #else
 GTEST_LOG_(INFO) << "This test does nothing.\n";
diff --git a/cmds/statsd/tests/external/StatsPuller_test.cpp b/cmds/statsd/tests/external/StatsPuller_test.cpp
index f42356a..c0b4f43 100644
--- a/cmds/statsd/tests/external/StatsPuller_test.cpp
+++ b/cmds/statsd/tests/external/StatsPuller_test.cpp
@@ -57,12 +57,13 @@
 
 FakePuller puller;
 
-shared_ptr<LogEvent> createSimpleEvent(int64_t eventTimeNs, int64_t value) {
-    shared_ptr<LogEvent> event = make_shared<LogEvent>(pullTagId, eventTimeNs);
-    event->write(value);
-    event->init();
-    return event;
-}
+// TODO(b/149590301): Update this helper to use new socket schema.
+//shared_ptr<LogEvent> createSimpleEvent(int64_t eventTimeNs, int64_t value) {
+//    shared_ptr<LogEvent> event = make_shared<LogEvent>(pullTagId, eventTimeNs);
+//    event->write(value);
+//    event->init();
+//    return event;
+//}
 
 class StatsPullerTest : public ::testing::Test {
 public:
@@ -79,148 +80,149 @@
 
 }  // Anonymous namespace.
 
-TEST_F(StatsPullerTest, PullSuccess) {
-    pullData.push_back(createSimpleEvent(1111L, 33));
-
-    pullSuccess = true;
-
-    vector<std::shared_ptr<LogEvent>> dataHolder;
-    EXPECT_TRUE(puller.Pull(&dataHolder));
-    EXPECT_EQ(1, dataHolder.size());
-    EXPECT_EQ(pullTagId, dataHolder[0]->GetTagId());
-    EXPECT_EQ(1111L, dataHolder[0]->GetElapsedTimestampNs());
-    EXPECT_EQ(1, dataHolder[0]->size());
-    EXPECT_EQ(33, dataHolder[0]->getValues()[0].mValue.int_value);
-
-    sleep_for(std::chrono::seconds(1));
-
-    pullData.clear();
-    pullData.push_back(createSimpleEvent(2222L, 44));
-
-    pullSuccess = true;
-
-    EXPECT_TRUE(puller.Pull(&dataHolder));
-    EXPECT_EQ(1, dataHolder.size());
-    EXPECT_EQ(pullTagId, dataHolder[0]->GetTagId());
-    EXPECT_EQ(2222L, dataHolder[0]->GetElapsedTimestampNs());
-    EXPECT_EQ(1, dataHolder[0]->size());
-    EXPECT_EQ(44, dataHolder[0]->getValues()[0].mValue.int_value);
-}
-
-TEST_F(StatsPullerTest, PullFailAfterSuccess) {
-    pullData.push_back(createSimpleEvent(1111L, 33));
-
-    pullSuccess = true;
-
-    vector<std::shared_ptr<LogEvent>> dataHolder;
-    EXPECT_TRUE(puller.Pull(&dataHolder));
-    EXPECT_EQ(1, dataHolder.size());
-    EXPECT_EQ(pullTagId, dataHolder[0]->GetTagId());
-    EXPECT_EQ(1111L, dataHolder[0]->GetElapsedTimestampNs());
-    EXPECT_EQ(1, dataHolder[0]->size());
-    EXPECT_EQ(33, dataHolder[0]->getValues()[0].mValue.int_value);
-
-    sleep_for(std::chrono::seconds(1));
-
-    pullData.clear();
-    pullData.push_back(createSimpleEvent(2222L, 44));
-
-    pullSuccess = false;
-    dataHolder.clear();
-    EXPECT_FALSE(puller.Pull(&dataHolder));
-    EXPECT_EQ(0, dataHolder.size());
-
-    pullSuccess = true;
-    dataHolder.clear();
-    EXPECT_FALSE(puller.Pull(&dataHolder));
-    EXPECT_EQ(0, dataHolder.size());
-}
-
-// Test pull takes longer than timeout, 2nd pull happens shorter than cooldown
-TEST_F(StatsPullerTest, PullTakeTooLongAndPullFast) {
-    pullData.push_back(createSimpleEvent(1111L, 33));
-    pullSuccess = true;
-    // timeout is 0.5
-    pullDelayNs = (long)(0.8 * NS_PER_SEC);
-
-    vector<std::shared_ptr<LogEvent>> dataHolder;
-    EXPECT_FALSE(puller.Pull(&dataHolder));
-    EXPECT_EQ(0, dataHolder.size());
-
-    pullData.clear();
-    pullData.push_back(createSimpleEvent(2222L, 44));
-
-    pullSuccess = true;
-    dataHolder.clear();
-    EXPECT_FALSE(puller.Pull(&dataHolder));
-    EXPECT_EQ(0, dataHolder.size());
-}
-
-TEST_F(StatsPullerTest, PullFail) {
-    pullData.push_back(createSimpleEvent(1111L, 33));
-
-    pullSuccess = false;
-
-    vector<std::shared_ptr<LogEvent>> dataHolder;
-    EXPECT_FALSE(puller.Pull(&dataHolder));
-    EXPECT_EQ(0, dataHolder.size());
-}
-
-TEST_F(StatsPullerTest, PullTakeTooLong) {
-    pullData.push_back(createSimpleEvent(1111L, 33));
-
-    pullSuccess = true;
-    pullDelayNs = NS_PER_SEC;
-
-    vector<std::shared_ptr<LogEvent>> dataHolder;
-    EXPECT_FALSE(puller.Pull(&dataHolder));
-    EXPECT_EQ(0, dataHolder.size());
-}
-
-TEST_F(StatsPullerTest, PullTooFast) {
-    pullData.push_back(createSimpleEvent(1111L, 33));
-
-    pullSuccess = true;
-
-    vector<std::shared_ptr<LogEvent>> dataHolder;
-    EXPECT_TRUE(puller.Pull(&dataHolder));
-    EXPECT_EQ(1, dataHolder.size());
-    EXPECT_EQ(pullTagId, dataHolder[0]->GetTagId());
-    EXPECT_EQ(1111L, dataHolder[0]->GetElapsedTimestampNs());
-    EXPECT_EQ(1, dataHolder[0]->size());
-    EXPECT_EQ(33, dataHolder[0]->getValues()[0].mValue.int_value);
-
-    pullData.clear();
-    pullData.push_back(createSimpleEvent(2222L, 44));
-
-    pullSuccess = true;
-
-    dataHolder.clear();
-    EXPECT_TRUE(puller.Pull(&dataHolder));
-    EXPECT_EQ(1, dataHolder.size());
-    EXPECT_EQ(pullTagId, dataHolder[0]->GetTagId());
-    EXPECT_EQ(1111L, dataHolder[0]->GetElapsedTimestampNs());
-    EXPECT_EQ(1, dataHolder[0]->size());
-    EXPECT_EQ(33, dataHolder[0]->getValues()[0].mValue.int_value);
-}
-
-TEST_F(StatsPullerTest, PullFailsAndTooFast) {
-    pullData.push_back(createSimpleEvent(1111L, 33));
-
-    pullSuccess = false;
-
-    vector<std::shared_ptr<LogEvent>> dataHolder;
-    EXPECT_FALSE(puller.Pull(&dataHolder));
-    EXPECT_EQ(0, dataHolder.size());
-
-    pullData.clear();
-    pullData.push_back(createSimpleEvent(2222L, 44));
-
-    pullSuccess = true;
-
-    EXPECT_FALSE(puller.Pull(&dataHolder));
-    EXPECT_EQ(0, dataHolder.size());
-}
+// TODO(b/149590301): Update these tests to use new socket schema.
+//TEST_F(StatsPullerTest, PullSuccess) {
+//    pullData.push_back(createSimpleEvent(1111L, 33));
+//
+//    pullSuccess = true;
+//
+//    vector<std::shared_ptr<LogEvent>> dataHolder;
+//    EXPECT_TRUE(puller.Pull(&dataHolder));
+//    EXPECT_EQ(1, dataHolder.size());
+//    EXPECT_EQ(pullTagId, dataHolder[0]->GetTagId());
+//    EXPECT_EQ(1111L, dataHolder[0]->GetElapsedTimestampNs());
+//    EXPECT_EQ(1, dataHolder[0]->size());
+//    EXPECT_EQ(33, dataHolder[0]->getValues()[0].mValue.int_value);
+//
+//    sleep_for(std::chrono::seconds(1));
+//
+//    pullData.clear();
+//    pullData.push_back(createSimpleEvent(2222L, 44));
+//
+//    pullSuccess = true;
+//
+//    EXPECT_TRUE(puller.Pull(&dataHolder));
+//    EXPECT_EQ(1, dataHolder.size());
+//    EXPECT_EQ(pullTagId, dataHolder[0]->GetTagId());
+//    EXPECT_EQ(2222L, dataHolder[0]->GetElapsedTimestampNs());
+//    EXPECT_EQ(1, dataHolder[0]->size());
+//    EXPECT_EQ(44, dataHolder[0]->getValues()[0].mValue.int_value);
+//}
+//
+//TEST_F(StatsPullerTest, PullFailAfterSuccess) {
+//    pullData.push_back(createSimpleEvent(1111L, 33));
+//
+//    pullSuccess = true;
+//
+//    vector<std::shared_ptr<LogEvent>> dataHolder;
+//    EXPECT_TRUE(puller.Pull(&dataHolder));
+//    EXPECT_EQ(1, dataHolder.size());
+//    EXPECT_EQ(pullTagId, dataHolder[0]->GetTagId());
+//    EXPECT_EQ(1111L, dataHolder[0]->GetElapsedTimestampNs());
+//    EXPECT_EQ(1, dataHolder[0]->size());
+//    EXPECT_EQ(33, dataHolder[0]->getValues()[0].mValue.int_value);
+//
+//    sleep_for(std::chrono::seconds(1));
+//
+//    pullData.clear();
+//    pullData.push_back(createSimpleEvent(2222L, 44));
+//
+//    pullSuccess = false;
+//    dataHolder.clear();
+//    EXPECT_FALSE(puller.Pull(&dataHolder));
+//    EXPECT_EQ(0, dataHolder.size());
+//
+//    pullSuccess = true;
+//    dataHolder.clear();
+//    EXPECT_FALSE(puller.Pull(&dataHolder));
+//    EXPECT_EQ(0, dataHolder.size());
+//}
+//
+//// Test pull takes longer than timeout, 2nd pull happens shorter than cooldown
+//TEST_F(StatsPullerTest, PullTakeTooLongAndPullFast) {
+//    pullData.push_back(createSimpleEvent(1111L, 33));
+//    pullSuccess = true;
+//    // timeout is 0.5
+//    pullDelayNs = (long)(0.8 * NS_PER_SEC);
+//
+//    vector<std::shared_ptr<LogEvent>> dataHolder;
+//    EXPECT_FALSE(puller.Pull(&dataHolder));
+//    EXPECT_EQ(0, dataHolder.size());
+//
+//    pullData.clear();
+//    pullData.push_back(createSimpleEvent(2222L, 44));
+//
+//    pullSuccess = true;
+//    dataHolder.clear();
+//    EXPECT_FALSE(puller.Pull(&dataHolder));
+//    EXPECT_EQ(0, dataHolder.size());
+//}
+//
+//TEST_F(StatsPullerTest, PullFail) {
+//    pullData.push_back(createSimpleEvent(1111L, 33));
+//
+//    pullSuccess = false;
+//
+//    vector<std::shared_ptr<LogEvent>> dataHolder;
+//    EXPECT_FALSE(puller.Pull(&dataHolder));
+//    EXPECT_EQ(0, dataHolder.size());
+//}
+//
+//TEST_F(StatsPullerTest, PullTakeTooLong) {
+//    pullData.push_back(createSimpleEvent(1111L, 33));
+//
+//    pullSuccess = true;
+//    pullDelayNs = NS_PER_SEC;
+//
+//    vector<std::shared_ptr<LogEvent>> dataHolder;
+//    EXPECT_FALSE(puller.Pull(&dataHolder));
+//    EXPECT_EQ(0, dataHolder.size());
+//}
+//
+//TEST_F(StatsPullerTest, PullTooFast) {
+//    pullData.push_back(createSimpleEvent(1111L, 33));
+//
+//    pullSuccess = true;
+//
+//    vector<std::shared_ptr<LogEvent>> dataHolder;
+//    EXPECT_TRUE(puller.Pull(&dataHolder));
+//    EXPECT_EQ(1, dataHolder.size());
+//    EXPECT_EQ(pullTagId, dataHolder[0]->GetTagId());
+//    EXPECT_EQ(1111L, dataHolder[0]->GetElapsedTimestampNs());
+//    EXPECT_EQ(1, dataHolder[0]->size());
+//    EXPECT_EQ(33, dataHolder[0]->getValues()[0].mValue.int_value);
+//
+//    pullData.clear();
+//    pullData.push_back(createSimpleEvent(2222L, 44));
+//
+//    pullSuccess = true;
+//
+//    dataHolder.clear();
+//    EXPECT_TRUE(puller.Pull(&dataHolder));
+//    EXPECT_EQ(1, dataHolder.size());
+//    EXPECT_EQ(pullTagId, dataHolder[0]->GetTagId());
+//    EXPECT_EQ(1111L, dataHolder[0]->GetElapsedTimestampNs());
+//    EXPECT_EQ(1, dataHolder[0]->size());
+//    EXPECT_EQ(33, dataHolder[0]->getValues()[0].mValue.int_value);
+//}
+//
+//TEST_F(StatsPullerTest, PullFailsAndTooFast) {
+//    pullData.push_back(createSimpleEvent(1111L, 33));
+//
+//    pullSuccess = false;
+//
+//    vector<std::shared_ptr<LogEvent>> dataHolder;
+//    EXPECT_FALSE(puller.Pull(&dataHolder));
+//    EXPECT_EQ(0, dataHolder.size());
+//
+//    pullData.clear();
+//    pullData.push_back(createSimpleEvent(2222L, 44));
+//
+//    pullSuccess = true;
+//
+//    EXPECT_FALSE(puller.Pull(&dataHolder));
+//    EXPECT_EQ(0, dataHolder.size());
+//}
 
 }  // namespace statsd
 }  // namespace os
diff --git a/cmds/statsd/tests/external/puller_util_test.cpp b/cmds/statsd/tests/external/puller_util_test.cpp
index c25e657..81590a2 100644
--- a/cmds/statsd/tests/external/puller_util_test.cpp
+++ b/cmds/statsd/tests/external/puller_util_test.cpp
@@ -60,209 +60,210 @@
 }
 }  // anonymous namespace
 
-TEST(puller_util, MergeNoDimension) {
-  vector<shared_ptr<LogEvent>> inputData;
-  shared_ptr<LogEvent> event = make_shared<LogEvent>(uidAtomTagId, timestamp);
-  // 30->22->31
-  event->write(isolatedUid);
-  event->write(hostNonAdditiveData);
-  event->write(isolatedAdditiveData);
-  event->init();
-  inputData.push_back(event);
-
-  // 20->22->21
-  event = make_shared<LogEvent>(uidAtomTagId, timestamp);
-  event->write(hostUid);
-  event->write(hostNonAdditiveData);
-  event->write(hostAdditiveData);
-  event->init();
-  inputData.push_back(event);
-
-  sp<MockUidMap> uidMap = new NaggyMock<MockUidMap>();
-  EXPECT_CALL(*uidMap, getHostUidOrSelf(isolatedUid))
-      .WillRepeatedly(Return(hostUid));
-  EXPECT_CALL(*uidMap, getHostUidOrSelf(Ne(isolatedUid)))
-      .WillRepeatedly(ReturnArg<0>());
-  mapAndMergeIsolatedUidsToHostUid(inputData, uidMap, uidAtomTagId, uidAdditiveFields);
-
-  vector<vector<int>> actual;
-  extractIntoVector(inputData, actual);
-  vector<int> expectedV1 = {20, 22, 52};
-  EXPECT_EQ(1, (int)actual.size());
-  EXPECT_THAT(actual, Contains(expectedV1));
-}
-
-TEST(puller_util, MergeWithDimension) {
-  vector<shared_ptr<LogEvent>> inputData;
-  shared_ptr<LogEvent> event = make_shared<LogEvent>(uidAtomTagId, timestamp);
-  // 30->32->31
-  event->write(isolatedUid);
-  event->write(isolatedNonAdditiveData);
-  event->write(isolatedAdditiveData);
-  event->init();
-  inputData.push_back(event);
-
-  // 20->32->21
-  event = make_shared<LogEvent>(uidAtomTagId, timestamp);
-  event->write(hostUid);
-  event->write(isolatedNonAdditiveData);
-  event->write(hostAdditiveData);
-  event->init();
-  inputData.push_back(event);
-
-  // 20->22->21
-  event = make_shared<LogEvent>(uidAtomTagId, timestamp);
-  event->write(hostUid);
-  event->write(hostNonAdditiveData);
-  event->write(hostAdditiveData);
-  event->init();
-  inputData.push_back(event);
-
-  sp<MockUidMap> uidMap = new NaggyMock<MockUidMap>();
-  EXPECT_CALL(*uidMap, getHostUidOrSelf(isolatedUid))
-      .WillRepeatedly(Return(hostUid));
-  EXPECT_CALL(*uidMap, getHostUidOrSelf(Ne(isolatedUid)))
-      .WillRepeatedly(ReturnArg<0>());
-  mapAndMergeIsolatedUidsToHostUid(inputData, uidMap, uidAtomTagId, uidAdditiveFields);
-
-  vector<vector<int>> actual;
-  extractIntoVector(inputData, actual);
-  vector<int> expectedV1 = {20, 22, 21};
-  vector<int> expectedV2 = {20, 32, 52};
-  EXPECT_EQ(2, (int)actual.size());
-  EXPECT_THAT(actual, Contains(expectedV1));
-  EXPECT_THAT(actual, Contains(expectedV2));
-}
-
-TEST(puller_util, NoMergeHostUidOnly) {
-  vector<shared_ptr<LogEvent>> inputData;
-  shared_ptr<LogEvent> event = make_shared<LogEvent>(uidAtomTagId, timestamp);
-  // 20->32->31
-  event->write(hostUid);
-  event->write(isolatedNonAdditiveData);
-  event->write(isolatedAdditiveData);
-  event->init();
-  inputData.push_back(event);
-
-  // 20->22->21
-  event = make_shared<LogEvent>(uidAtomTagId, timestamp);
-  event->write(hostUid);
-  event->write(hostNonAdditiveData);
-  event->write(hostAdditiveData);
-  event->init();
-  inputData.push_back(event);
-
-  sp<MockUidMap> uidMap = new NaggyMock<MockUidMap>();
-  EXPECT_CALL(*uidMap, getHostUidOrSelf(isolatedUid))
-      .WillRepeatedly(Return(hostUid));
-  EXPECT_CALL(*uidMap, getHostUidOrSelf(Ne(isolatedUid)))
-      .WillRepeatedly(ReturnArg<0>());
-  mapAndMergeIsolatedUidsToHostUid(inputData, uidMap, uidAtomTagId, uidAdditiveFields);
-
-  // 20->32->31
-  // 20->22->21
-  vector<vector<int>> actual;
-  extractIntoVector(inputData, actual);
-  vector<int> expectedV1 = {20, 32, 31};
-  vector<int> expectedV2 = {20, 22, 21};
-  EXPECT_EQ(2, (int)actual.size());
-  EXPECT_THAT(actual, Contains(expectedV1));
-  EXPECT_THAT(actual, Contains(expectedV2));
-}
-
-TEST(puller_util, IsolatedUidOnly) {
-  vector<shared_ptr<LogEvent>> inputData;
-  shared_ptr<LogEvent> event = make_shared<LogEvent>(uidAtomTagId, timestamp);
-  // 30->32->31
-  event->write(hostUid);
-  event->write(isolatedNonAdditiveData);
-  event->write(isolatedAdditiveData);
-  event->init();
-  inputData.push_back(event);
-
-  // 30->22->21
-  event = make_shared<LogEvent>(uidAtomTagId, timestamp);
-  event->write(hostUid);
-  event->write(hostNonAdditiveData);
-  event->write(hostAdditiveData);
-  event->init();
-  inputData.push_back(event);
-
-  sp<MockUidMap> uidMap = new NaggyMock<MockUidMap>();
-  EXPECT_CALL(*uidMap, getHostUidOrSelf(isolatedUid))
-      .WillRepeatedly(Return(hostUid));
-  EXPECT_CALL(*uidMap, getHostUidOrSelf(Ne(isolatedUid)))
-      .WillRepeatedly(ReturnArg<0>());
-  mapAndMergeIsolatedUidsToHostUid(inputData, uidMap, uidAtomTagId, uidAdditiveFields);
-
-  // 20->32->31
-  // 20->22->21
-  vector<vector<int>> actual;
-  extractIntoVector(inputData, actual);
-  vector<int> expectedV1 = {20, 32, 31};
-  vector<int> expectedV2 = {20, 22, 21};
-  EXPECT_EQ(2, (int)actual.size());
-  EXPECT_THAT(actual, Contains(expectedV1));
-  EXPECT_THAT(actual, Contains(expectedV2));
-}
-
-TEST(puller_util, MultipleIsolatedUidToOneHostUid) {
-  vector<shared_ptr<LogEvent>> inputData;
-  shared_ptr<LogEvent> event = make_shared<LogEvent>(uidAtomTagId, timestamp);
-  // 30->32->31
-  event->write(isolatedUid);
-  event->write(isolatedNonAdditiveData);
-  event->write(isolatedAdditiveData);
-  event->init();
-  inputData.push_back(event);
-
-  // 31->32->21
-  event = make_shared<LogEvent>(uidAtomTagId, timestamp);
-  event->write(isolatedUid + 1);
-  event->write(isolatedNonAdditiveData);
-  event->write(hostAdditiveData);
-  event->init();
-  inputData.push_back(event);
-
-  // 20->32->21
-  event = make_shared<LogEvent>(uidAtomTagId, timestamp);
-  event->write(hostUid);
-  event->write(isolatedNonAdditiveData);
-  event->write(hostAdditiveData);
-  event->init();
-  inputData.push_back(event);
-
-  sp<MockUidMap> uidMap = new NaggyMock<MockUidMap>();
-  EXPECT_CALL(*uidMap, getHostUidOrSelf(_)).WillRepeatedly(Return(hostUid));
-  mapAndMergeIsolatedUidsToHostUid(inputData, uidMap, uidAtomTagId, uidAdditiveFields);
-
-  vector<vector<int>> actual;
-  extractIntoVector(inputData, actual);
-  vector<int> expectedV1 = {20, 32, 73};
-  EXPECT_EQ(1, (int)actual.size());
-  EXPECT_THAT(actual, Contains(expectedV1));
-}
-
-TEST(puller_util, NoNeedToMerge) {
-  vector<shared_ptr<LogEvent>> inputData;
-  shared_ptr<LogEvent> event =
-      make_shared<LogEvent>(nonUidAtomTagId, timestamp);
-  // 32
-  event->write(isolatedNonAdditiveData);
-  event->init();
-  inputData.push_back(event);
-
-  event = make_shared<LogEvent>(nonUidAtomTagId, timestamp);
-  // 22
-  event->write(hostNonAdditiveData);
-  event->init();
-  inputData.push_back(event);
-
-  sp<MockUidMap> uidMap = new NaggyMock<MockUidMap>();
-  mapAndMergeIsolatedUidsToHostUid(inputData, uidMap, nonUidAtomTagId, {} /*no additive fields*/);
-
-  EXPECT_EQ(2, (int)inputData.size());
-}
+// TODO(b/149590301): Update these tests to use new socket schema.
+//TEST(puller_util, MergeNoDimension) {
+//  vector<shared_ptr<LogEvent>> inputData;
+//  shared_ptr<LogEvent> event = make_shared<LogEvent>(uidAtomTagId, timestamp);
+//  // 30->22->31
+//  event->write(isolatedUid);
+//  event->write(hostNonAdditiveData);
+//  event->write(isolatedAdditiveData);
+//  event->init();
+//  inputData.push_back(event);
+//
+//  // 20->22->21
+//  event = make_shared<LogEvent>(uidAtomTagId, timestamp);
+//  event->write(hostUid);
+//  event->write(hostNonAdditiveData);
+//  event->write(hostAdditiveData);
+//  event->init();
+//  inputData.push_back(event);
+//
+//  sp<MockUidMap> uidMap = new NaggyMock<MockUidMap>();
+//  EXPECT_CALL(*uidMap, getHostUidOrSelf(isolatedUid))
+//      .WillRepeatedly(Return(hostUid));
+//  EXPECT_CALL(*uidMap, getHostUidOrSelf(Ne(isolatedUid)))
+//      .WillRepeatedly(ReturnArg<0>());
+//  mapAndMergeIsolatedUidsToHostUid(inputData, uidMap, uidAtomTagId, uidAdditiveFields);
+//
+//  vector<vector<int>> actual;
+//  extractIntoVector(inputData, actual);
+//  vector<int> expectedV1 = {20, 22, 52};
+//  EXPECT_EQ(1, (int)actual.size());
+//  EXPECT_THAT(actual, Contains(expectedV1));
+//}
+//
+//TEST(puller_util, MergeWithDimension) {
+//  vector<shared_ptr<LogEvent>> inputData;
+//  shared_ptr<LogEvent> event = make_shared<LogEvent>(uidAtomTagId, timestamp);
+//  // 30->32->31
+//  event->write(isolatedUid);
+//  event->write(isolatedNonAdditiveData);
+//  event->write(isolatedAdditiveData);
+//  event->init();
+//  inputData.push_back(event);
+//
+//  // 20->32->21
+//  event = make_shared<LogEvent>(uidAtomTagId, timestamp);
+//  event->write(hostUid);
+//  event->write(isolatedNonAdditiveData);
+//  event->write(hostAdditiveData);
+//  event->init();
+//  inputData.push_back(event);
+//
+//  // 20->22->21
+//  event = make_shared<LogEvent>(uidAtomTagId, timestamp);
+//  event->write(hostUid);
+//  event->write(hostNonAdditiveData);
+//  event->write(hostAdditiveData);
+//  event->init();
+//  inputData.push_back(event);
+//
+//  sp<MockUidMap> uidMap = new NaggyMock<MockUidMap>();
+//  EXPECT_CALL(*uidMap, getHostUidOrSelf(isolatedUid))
+//      .WillRepeatedly(Return(hostUid));
+//  EXPECT_CALL(*uidMap, getHostUidOrSelf(Ne(isolatedUid)))
+//      .WillRepeatedly(ReturnArg<0>());
+//  mapAndMergeIsolatedUidsToHostUid(inputData, uidMap, uidAtomTagId, uidAdditiveFields);
+//
+//  vector<vector<int>> actual;
+//  extractIntoVector(inputData, actual);
+//  vector<int> expectedV1 = {20, 22, 21};
+//  vector<int> expectedV2 = {20, 32, 52};
+//  EXPECT_EQ(2, (int)actual.size());
+//  EXPECT_THAT(actual, Contains(expectedV1));
+//  EXPECT_THAT(actual, Contains(expectedV2));
+//}
+//
+//TEST(puller_util, NoMergeHostUidOnly) {
+//  vector<shared_ptr<LogEvent>> inputData;
+//  shared_ptr<LogEvent> event = make_shared<LogEvent>(uidAtomTagId, timestamp);
+//  // 20->32->31
+//  event->write(hostUid);
+//  event->write(isolatedNonAdditiveData);
+//  event->write(isolatedAdditiveData);
+//  event->init();
+//  inputData.push_back(event);
+//
+//  // 20->22->21
+//  event = make_shared<LogEvent>(uidAtomTagId, timestamp);
+//  event->write(hostUid);
+//  event->write(hostNonAdditiveData);
+//  event->write(hostAdditiveData);
+//  event->init();
+//  inputData.push_back(event);
+//
+//  sp<MockUidMap> uidMap = new NaggyMock<MockUidMap>();
+//  EXPECT_CALL(*uidMap, getHostUidOrSelf(isolatedUid))
+//      .WillRepeatedly(Return(hostUid));
+//  EXPECT_CALL(*uidMap, getHostUidOrSelf(Ne(isolatedUid)))
+//      .WillRepeatedly(ReturnArg<0>());
+//  mapAndMergeIsolatedUidsToHostUid(inputData, uidMap, uidAtomTagId, uidAdditiveFields);
+//
+//  // 20->32->31
+//  // 20->22->21
+//  vector<vector<int>> actual;
+//  extractIntoVector(inputData, actual);
+//  vector<int> expectedV1 = {20, 32, 31};
+//  vector<int> expectedV2 = {20, 22, 21};
+//  EXPECT_EQ(2, (int)actual.size());
+//  EXPECT_THAT(actual, Contains(expectedV1));
+//  EXPECT_THAT(actual, Contains(expectedV2));
+//}
+//
+//TEST(puller_util, IsolatedUidOnly) {
+//  vector<shared_ptr<LogEvent>> inputData;
+//  shared_ptr<LogEvent> event = make_shared<LogEvent>(uidAtomTagId, timestamp);
+//  // 30->32->31
+//  event->write(hostUid);
+//  event->write(isolatedNonAdditiveData);
+//  event->write(isolatedAdditiveData);
+//  event->init();
+//  inputData.push_back(event);
+//
+//  // 30->22->21
+//  event = make_shared<LogEvent>(uidAtomTagId, timestamp);
+//  event->write(hostUid);
+//  event->write(hostNonAdditiveData);
+//  event->write(hostAdditiveData);
+//  event->init();
+//  inputData.push_back(event);
+//
+//  sp<MockUidMap> uidMap = new NaggyMock<MockUidMap>();
+//  EXPECT_CALL(*uidMap, getHostUidOrSelf(isolatedUid))
+//      .WillRepeatedly(Return(hostUid));
+//  EXPECT_CALL(*uidMap, getHostUidOrSelf(Ne(isolatedUid)))
+//      .WillRepeatedly(ReturnArg<0>());
+//  mapAndMergeIsolatedUidsToHostUid(inputData, uidMap, uidAtomTagId, uidAdditiveFields);
+//
+//  // 20->32->31
+//  // 20->22->21
+//  vector<vector<int>> actual;
+//  extractIntoVector(inputData, actual);
+//  vector<int> expectedV1 = {20, 32, 31};
+//  vector<int> expectedV2 = {20, 22, 21};
+//  EXPECT_EQ(2, (int)actual.size());
+//  EXPECT_THAT(actual, Contains(expectedV1));
+//  EXPECT_THAT(actual, Contains(expectedV2));
+//}
+//
+//TEST(puller_util, MultipleIsolatedUidToOneHostUid) {
+//  vector<shared_ptr<LogEvent>> inputData;
+//  shared_ptr<LogEvent> event = make_shared<LogEvent>(uidAtomTagId, timestamp);
+//  // 30->32->31
+//  event->write(isolatedUid);
+//  event->write(isolatedNonAdditiveData);
+//  event->write(isolatedAdditiveData);
+//  event->init();
+//  inputData.push_back(event);
+//
+//  // 31->32->21
+//  event = make_shared<LogEvent>(uidAtomTagId, timestamp);
+//  event->write(isolatedUid + 1);
+//  event->write(isolatedNonAdditiveData);
+//  event->write(hostAdditiveData);
+//  event->init();
+//  inputData.push_back(event);
+//
+//  // 20->32->21
+//  event = make_shared<LogEvent>(uidAtomTagId, timestamp);
+//  event->write(hostUid);
+//  event->write(isolatedNonAdditiveData);
+//  event->write(hostAdditiveData);
+//  event->init();
+//  inputData.push_back(event);
+//
+//  sp<MockUidMap> uidMap = new NaggyMock<MockUidMap>();
+//  EXPECT_CALL(*uidMap, getHostUidOrSelf(_)).WillRepeatedly(Return(hostUid));
+//  mapAndMergeIsolatedUidsToHostUid(inputData, uidMap, uidAtomTagId, uidAdditiveFields);
+//
+//  vector<vector<int>> actual;
+//  extractIntoVector(inputData, actual);
+//  vector<int> expectedV1 = {20, 32, 73};
+//  EXPECT_EQ(1, (int)actual.size());
+//  EXPECT_THAT(actual, Contains(expectedV1));
+//}
+//
+//TEST(puller_util, NoNeedToMerge) {
+//  vector<shared_ptr<LogEvent>> inputData;
+//  shared_ptr<LogEvent> event =
+//      make_shared<LogEvent>(nonUidAtomTagId, timestamp);
+//  // 32
+//  event->write(isolatedNonAdditiveData);
+//  event->init();
+//  inputData.push_back(event);
+//
+//  event = make_shared<LogEvent>(nonUidAtomTagId, timestamp);
+//  // 22
+//  event->write(hostNonAdditiveData);
+//  event->init();
+//  inputData.push_back(event);
+//
+//  sp<MockUidMap> uidMap = new NaggyMock<MockUidMap>();
+//  mapAndMergeIsolatedUidsToHostUid(inputData, uidMap, nonUidAtomTagId, {} /*no additive fields*/);
+//
+//  EXPECT_EQ(2, (int)inputData.size());
+//}
 
 }  // namespace statsd
 }  // namespace os
diff --git a/cmds/statsd/tests/metrics/CountMetricProducer_test.cpp b/cmds/statsd/tests/metrics/CountMetricProducer_test.cpp
index 8915c73..b882678 100644
--- a/cmds/statsd/tests/metrics/CountMetricProducer_test.cpp
+++ b/cmds/statsd/tests/metrics/CountMetricProducer_test.cpp
@@ -37,365 +37,366 @@
 
 const ConfigKey kConfigKey(0, 12345);
 
-TEST(CountMetricProducerTest, TestFirstBucket) {
-    CountMetric metric;
-    metric.set_id(1);
-    metric.set_bucket(ONE_MINUTE);
-    sp<MockConditionWizard> wizard = new NaggyMock<MockConditionWizard>();
-
-    CountMetricProducer countProducer(kConfigKey, metric, -1 /*-1 meaning no condition*/, wizard, 5,
-                                      600 * NS_PER_SEC + NS_PER_SEC / 2);
-    EXPECT_EQ(600500000000, countProducer.mCurrentBucketStartTimeNs);
-    EXPECT_EQ(10, countProducer.mCurrentBucketNum);
-    EXPECT_EQ(660000000005, countProducer.getCurrentBucketEndTimeNs());
-}
-
-TEST(CountMetricProducerTest, TestNonDimensionalEvents) {
-    int64_t bucketStartTimeNs = 10000000000;
-    int64_t bucketSizeNs = TimeUnitToBucketSizeInMillis(ONE_MINUTE) * 1000000LL;
-    int64_t bucket2StartTimeNs = bucketStartTimeNs + bucketSizeNs;
-    int64_t bucket3StartTimeNs = bucketStartTimeNs + 2 * bucketSizeNs;
-    int tagId = 1;
-
-    CountMetric metric;
-    metric.set_id(1);
-    metric.set_bucket(ONE_MINUTE);
-
-    LogEvent event1(tagId, bucketStartTimeNs + 1);
-    event1.init();
-    LogEvent event2(tagId, bucketStartTimeNs + 2);
-    event2.init();
-
-    sp<MockConditionWizard> wizard = new NaggyMock<MockConditionWizard>();
-
-    CountMetricProducer countProducer(kConfigKey, metric, -1 /*-1 meaning no condition*/, wizard,
-                                      bucketStartTimeNs, bucketStartTimeNs);
-
-    // 2 events in bucket 1.
-    countProducer.onMatchedLogEvent(1 /*log matcher index*/, event1);
-    countProducer.onMatchedLogEvent(1 /*log matcher index*/, event2);
-
-    // Flushes at event #2.
-    countProducer.flushIfNeededLocked(bucketStartTimeNs + 2);
-    EXPECT_EQ(0UL, countProducer.mPastBuckets.size());
-
-    // Flushes.
-    countProducer.flushIfNeededLocked(bucketStartTimeNs + bucketSizeNs + 1);
-    EXPECT_EQ(1UL, countProducer.mPastBuckets.size());
-    EXPECT_TRUE(countProducer.mPastBuckets.find(DEFAULT_METRIC_DIMENSION_KEY) !=
-                countProducer.mPastBuckets.end());
-    const auto& buckets = countProducer.mPastBuckets[DEFAULT_METRIC_DIMENSION_KEY];
-    EXPECT_EQ(1UL, buckets.size());
-    EXPECT_EQ(bucketStartTimeNs, buckets[0].mBucketStartNs);
-    EXPECT_EQ(bucketStartTimeNs + bucketSizeNs, buckets[0].mBucketEndNs);
-    EXPECT_EQ(2LL, buckets[0].mCount);
-
-    // 1 matched event happens in bucket 2.
-    LogEvent event3(tagId, bucketStartTimeNs + bucketSizeNs + 2);
-    event3.init();
-
-    countProducer.onMatchedLogEvent(1 /*log matcher index*/, event3);
-    countProducer.flushIfNeededLocked(bucketStartTimeNs + 2 * bucketSizeNs + 1);
-    EXPECT_EQ(1UL, countProducer.mPastBuckets.size());
-    EXPECT_TRUE(countProducer.mPastBuckets.find(DEFAULT_METRIC_DIMENSION_KEY) !=
-                countProducer.mPastBuckets.end());
-    EXPECT_EQ(2UL, countProducer.mPastBuckets[DEFAULT_METRIC_DIMENSION_KEY].size());
-    const auto& bucketInfo2 = countProducer.mPastBuckets[DEFAULT_METRIC_DIMENSION_KEY][1];
-    EXPECT_EQ(bucket2StartTimeNs, bucketInfo2.mBucketStartNs);
-    EXPECT_EQ(bucket2StartTimeNs + bucketSizeNs, bucketInfo2.mBucketEndNs);
-    EXPECT_EQ(1LL, bucketInfo2.mCount);
-
-    // nothing happens in bucket 3. we should not record anything for bucket 3.
-    countProducer.flushIfNeededLocked(bucketStartTimeNs + 3 * bucketSizeNs + 1);
-    EXPECT_EQ(1UL, countProducer.mPastBuckets.size());
-    EXPECT_TRUE(countProducer.mPastBuckets.find(DEFAULT_METRIC_DIMENSION_KEY) !=
-                countProducer.mPastBuckets.end());
-    const auto& buckets3 = countProducer.mPastBuckets[DEFAULT_METRIC_DIMENSION_KEY];
-    EXPECT_EQ(2UL, buckets3.size());
-}
-
-TEST(CountMetricProducerTest, TestEventsWithNonSlicedCondition) {
-    int64_t bucketStartTimeNs = 10000000000;
-    int64_t bucketSizeNs = TimeUnitToBucketSizeInMillis(ONE_MINUTE) * 1000000LL;
-
-    CountMetric metric;
-    metric.set_id(1);
-    metric.set_bucket(ONE_MINUTE);
-    metric.set_condition(StringToId("SCREEN_ON"));
-
-    LogEvent event1(1, bucketStartTimeNs + 1);
-    event1.init();
-
-    LogEvent event2(1, bucketStartTimeNs + 10);
-    event2.init();
-
-    sp<MockConditionWizard> wizard = new NaggyMock<MockConditionWizard>();
-
-    CountMetricProducer countProducer(kConfigKey, metric, 1, wizard, bucketStartTimeNs,
-                                      bucketStartTimeNs);
-
-    countProducer.onConditionChanged(true, bucketStartTimeNs);
-    countProducer.onMatchedLogEvent(1 /*matcher index*/, event1);
-    EXPECT_EQ(0UL, countProducer.mPastBuckets.size());
-
-    countProducer.onConditionChanged(false /*new condition*/, bucketStartTimeNs + 2);
-    // Upon this match event, the matched event1 is flushed.
-    countProducer.onMatchedLogEvent(1 /*matcher index*/, event2);
-    EXPECT_EQ(0UL, countProducer.mPastBuckets.size());
-
-    countProducer.flushIfNeededLocked(bucketStartTimeNs + bucketSizeNs + 1);
-    EXPECT_EQ(1UL, countProducer.mPastBuckets.size());
-    EXPECT_TRUE(countProducer.mPastBuckets.find(DEFAULT_METRIC_DIMENSION_KEY) !=
-                countProducer.mPastBuckets.end());
-    {
-        const auto& buckets = countProducer.mPastBuckets[DEFAULT_METRIC_DIMENSION_KEY];
-        EXPECT_EQ(1UL, buckets.size());
-        const auto& bucketInfo = buckets[0];
-        EXPECT_EQ(bucketStartTimeNs, bucketInfo.mBucketStartNs);
-        EXPECT_EQ(bucketStartTimeNs + bucketSizeNs, bucketInfo.mBucketEndNs);
-        EXPECT_EQ(1LL, bucketInfo.mCount);
-    }
-}
-
-TEST(CountMetricProducerTest, TestEventsWithSlicedCondition) {
-    int64_t bucketStartTimeNs = 10000000000;
-    int64_t bucketSizeNs = TimeUnitToBucketSizeInMillis(ONE_MINUTE) * 1000000LL;
-
-    int tagId = 1;
-    int conditionTagId = 2;
-
-    CountMetric metric;
-    metric.set_id(1);
-    metric.set_bucket(ONE_MINUTE);
-    metric.set_condition(StringToId("APP_IN_BACKGROUND_PER_UID_AND_SCREEN_ON"));
-    MetricConditionLink* link = metric.add_links();
-    link->set_condition(StringToId("APP_IN_BACKGROUND_PER_UID"));
-    buildSimpleAtomFieldMatcher(tagId, 1, link->mutable_fields_in_what());
-    buildSimpleAtomFieldMatcher(conditionTagId, 2, link->mutable_fields_in_condition());
-
-    LogEvent event1(tagId, bucketStartTimeNs + 1);
-    event1.write("111");  // uid
-    event1.init();
-    ConditionKey key1;
-    key1[StringToId("APP_IN_BACKGROUND_PER_UID")] =
-        {getMockedDimensionKey(conditionTagId, 2, "111")};
-
-    LogEvent event2(tagId, bucketStartTimeNs + 10);
-    event2.write("222");  // uid
-    event2.init();
-    ConditionKey key2;
-    key2[StringToId("APP_IN_BACKGROUND_PER_UID")] =
-        {getMockedDimensionKey(conditionTagId, 2, "222")};
-
-    sp<MockConditionWizard> wizard = new NaggyMock<MockConditionWizard>();
-    EXPECT_CALL(*wizard, query(_, key1, _)).WillOnce(Return(ConditionState::kFalse));
-
-    EXPECT_CALL(*wizard, query(_, key2, _)).WillOnce(Return(ConditionState::kTrue));
-
-    CountMetricProducer countProducer(kConfigKey, metric, 1 /*condition tracker index*/, wizard,
-                                      bucketStartTimeNs, bucketStartTimeNs);
-
-    countProducer.onMatchedLogEvent(1 /*log matcher index*/, event1);
-    countProducer.flushIfNeededLocked(bucketStartTimeNs + 1);
-    EXPECT_EQ(0UL, countProducer.mPastBuckets.size());
-
-    countProducer.onMatchedLogEvent(1 /*log matcher index*/, event2);
-    countProducer.flushIfNeededLocked(bucketStartTimeNs + bucketSizeNs + 1);
-    EXPECT_EQ(1UL, countProducer.mPastBuckets.size());
-    EXPECT_TRUE(countProducer.mPastBuckets.find(DEFAULT_METRIC_DIMENSION_KEY) !=
-                countProducer.mPastBuckets.end());
-    const auto& buckets = countProducer.mPastBuckets[DEFAULT_METRIC_DIMENSION_KEY];
-    EXPECT_EQ(1UL, buckets.size());
-    const auto& bucketInfo = buckets[0];
-    EXPECT_EQ(bucketStartTimeNs, bucketInfo.mBucketStartNs);
-    EXPECT_EQ(bucketStartTimeNs + bucketSizeNs, bucketInfo.mBucketEndNs);
-    EXPECT_EQ(1LL, bucketInfo.mCount);
-}
-
-TEST(CountMetricProducerTest, TestEventWithAppUpgrade) {
-    sp<AlarmMonitor> alarmMonitor;
-    int64_t bucketStartTimeNs = 10000000000;
-    int64_t bucketSizeNs = TimeUnitToBucketSizeInMillis(ONE_MINUTE) * 1000000LL;
-    int64_t eventUpgradeTimeNs = bucketStartTimeNs + 15 * NS_PER_SEC;
-
-    int tagId = 1;
-    int conditionTagId = 2;
-
-    CountMetric metric;
-    metric.set_id(1);
-    metric.set_bucket(ONE_MINUTE);
-    Alert alert;
-    alert.set_num_buckets(3);
-    alert.set_trigger_if_sum_gt(2);
-    LogEvent event1(tagId, bucketStartTimeNs + 1);
-    event1.write("111");  // uid
-    event1.init();
-    sp<MockConditionWizard> wizard = new NaggyMock<MockConditionWizard>();
-    CountMetricProducer countProducer(kConfigKey, metric, -1 /* no condition */, wizard,
-                                      bucketStartTimeNs, bucketStartTimeNs);
-
-    sp<AnomalyTracker> anomalyTracker = countProducer.addAnomalyTracker(alert, alarmMonitor);
-    EXPECT_TRUE(anomalyTracker != nullptr);
-
-    // Bucket is flushed yet.
-    countProducer.onMatchedLogEvent(1 /*log matcher index*/, event1);
-    EXPECT_EQ(0UL, countProducer.mPastBuckets.size());
-    EXPECT_EQ(0, anomalyTracker->getSumOverPastBuckets(DEFAULT_METRIC_DIMENSION_KEY));
-
-    // App upgrade forces bucket flush.
-    // Check that there's a past bucket and the bucket end is not adjusted.
-    countProducer.notifyAppUpgrade(eventUpgradeTimeNs, "ANY.APP", 1, 1);
-    EXPECT_EQ(1UL, countProducer.mPastBuckets[DEFAULT_METRIC_DIMENSION_KEY].size());
-    EXPECT_EQ((long long)bucketStartTimeNs,
-              countProducer.mPastBuckets[DEFAULT_METRIC_DIMENSION_KEY][0].mBucketStartNs);
-    EXPECT_EQ((long long)eventUpgradeTimeNs,
-              countProducer.mPastBuckets[DEFAULT_METRIC_DIMENSION_KEY][0].mBucketEndNs);
-    EXPECT_EQ(eventUpgradeTimeNs, countProducer.mCurrentBucketStartTimeNs);
-    // Anomaly tracker only contains full buckets.
-    EXPECT_EQ(0, anomalyTracker->getSumOverPastBuckets(DEFAULT_METRIC_DIMENSION_KEY));
-
-    int64_t lastEndTimeNs = countProducer.getCurrentBucketEndTimeNs();
-    // Next event occurs in same bucket as partial bucket created.
-    LogEvent event2(tagId, bucketStartTimeNs + 59 * NS_PER_SEC + 10);
-    event2.write("222");  // uid
-    event2.init();
-    countProducer.onMatchedLogEvent(1 /*log matcher index*/, event2);
-    EXPECT_EQ(1UL, countProducer.mPastBuckets[DEFAULT_METRIC_DIMENSION_KEY].size());
-    EXPECT_EQ(eventUpgradeTimeNs, countProducer.mCurrentBucketStartTimeNs);
-    EXPECT_EQ(0, anomalyTracker->getSumOverPastBuckets(DEFAULT_METRIC_DIMENSION_KEY));
-
-    // Third event in following bucket.
-    LogEvent event3(tagId, bucketStartTimeNs + 62 * NS_PER_SEC + 10);
-    event3.write("333");  // uid
-    event3.init();
-    countProducer.onMatchedLogEvent(1 /*log matcher index*/, event3);
-    EXPECT_EQ(2UL, countProducer.mPastBuckets[DEFAULT_METRIC_DIMENSION_KEY].size());
-    EXPECT_EQ(lastEndTimeNs, countProducer.mCurrentBucketStartTimeNs);
-    EXPECT_EQ(2, anomalyTracker->getSumOverPastBuckets(DEFAULT_METRIC_DIMENSION_KEY));
-}
-
-TEST(CountMetricProducerTest, TestEventWithAppUpgradeInNextBucket) {
-    int64_t bucketStartTimeNs = 10000000000;
-    int64_t bucketSizeNs = TimeUnitToBucketSizeInMillis(ONE_MINUTE) * 1000000LL;
-    int64_t eventUpgradeTimeNs = bucketStartTimeNs + 65 * NS_PER_SEC;
-
-    int tagId = 1;
-    int conditionTagId = 2;
-
-    CountMetric metric;
-    metric.set_id(1);
-    metric.set_bucket(ONE_MINUTE);
-    LogEvent event1(tagId, bucketStartTimeNs + 1);
-    event1.write("111");  // uid
-    event1.init();
-    sp<MockConditionWizard> wizard = new NaggyMock<MockConditionWizard>();
-    CountMetricProducer countProducer(kConfigKey, metric, -1 /* no condition */, wizard,
-                                      bucketStartTimeNs, bucketStartTimeNs);
-
-    // Bucket is flushed yet.
-    countProducer.onMatchedLogEvent(1 /*log matcher index*/, event1);
-    EXPECT_EQ(0UL, countProducer.mPastBuckets.size());
-
-    // App upgrade forces bucket flush.
-    // Check that there's a past bucket and the bucket end is not adjusted.
-    countProducer.notifyAppUpgrade(eventUpgradeTimeNs, "ANY.APP", 1, 1);
-    EXPECT_EQ(1UL, countProducer.mPastBuckets[DEFAULT_METRIC_DIMENSION_KEY].size());
-    EXPECT_EQ((int64_t)bucketStartTimeNs,
-              countProducer.mPastBuckets[DEFAULT_METRIC_DIMENSION_KEY][0].mBucketStartNs);
-    EXPECT_EQ(bucketStartTimeNs + bucketSizeNs,
-              countProducer.mPastBuckets[DEFAULT_METRIC_DIMENSION_KEY][0].mBucketEndNs);
-    EXPECT_EQ(eventUpgradeTimeNs, countProducer.mCurrentBucketStartTimeNs);
-
-    // Next event occurs in same bucket as partial bucket created.
-    LogEvent event2(tagId, bucketStartTimeNs + 70 * NS_PER_SEC + 10);
-    event2.write("222");  // uid
-    event2.init();
-    countProducer.onMatchedLogEvent(1 /*log matcher index*/, event2);
-    EXPECT_EQ(1UL, countProducer.mPastBuckets[DEFAULT_METRIC_DIMENSION_KEY].size());
-
-    // Third event in following bucket.
-    LogEvent event3(tagId, bucketStartTimeNs + 121 * NS_PER_SEC + 10);
-    event3.write("333");  // uid
-    event3.init();
-    countProducer.onMatchedLogEvent(1 /*log matcher index*/, event3);
-    EXPECT_EQ(2UL, countProducer.mPastBuckets[DEFAULT_METRIC_DIMENSION_KEY].size());
-    EXPECT_EQ((int64_t)eventUpgradeTimeNs,
-              countProducer.mPastBuckets[DEFAULT_METRIC_DIMENSION_KEY][1].mBucketStartNs);
-    EXPECT_EQ(bucketStartTimeNs + 2 * bucketSizeNs,
-              countProducer.mPastBuckets[DEFAULT_METRIC_DIMENSION_KEY][1].mBucketEndNs);
-}
-
-TEST(CountMetricProducerTest, TestAnomalyDetectionUnSliced) {
-    sp<AlarmMonitor> alarmMonitor;
-    Alert alert;
-    alert.set_id(11);
-    alert.set_metric_id(1);
-    alert.set_trigger_if_sum_gt(2);
-    alert.set_num_buckets(2);
-    const int32_t refPeriodSec = 1;
-    alert.set_refractory_period_secs(refPeriodSec);
-
-    int64_t bucketStartTimeNs = 10000000000;
-    int64_t bucketSizeNs = TimeUnitToBucketSizeInMillis(ONE_MINUTE) * 1000000LL;
-    int64_t bucket2StartTimeNs = bucketStartTimeNs + bucketSizeNs;
-    int64_t bucket3StartTimeNs = bucketStartTimeNs + 2 * bucketSizeNs;
-
-    CountMetric metric;
-    metric.set_id(1);
-    metric.set_bucket(ONE_MINUTE);
-
-    sp<MockConditionWizard> wizard = new NaggyMock<MockConditionWizard>();
-    CountMetricProducer countProducer(kConfigKey, metric, -1 /*-1 meaning no condition*/, wizard,
-                                      bucketStartTimeNs, bucketStartTimeNs);
-
-    sp<AnomalyTracker> anomalyTracker = countProducer.addAnomalyTracker(alert, alarmMonitor);
-
-    int tagId = 1;
-    LogEvent event1(tagId, bucketStartTimeNs + 1);
-    event1.init();
-    LogEvent event2(tagId, bucketStartTimeNs + 2);
-    event2.init();
-    LogEvent event3(tagId, bucketStartTimeNs + 2 * bucketSizeNs + 1);
-    event3.init();
-    LogEvent event4(tagId, bucketStartTimeNs + 3 * bucketSizeNs + 1);
-    event4.init();
-    LogEvent event5(tagId, bucketStartTimeNs + 3 * bucketSizeNs + 2);
-    event5.init();
-    LogEvent event6(tagId, bucketStartTimeNs + 3 * bucketSizeNs + 3);
-    event6.init();
-    LogEvent event7(tagId, bucketStartTimeNs + 3 * bucketSizeNs + 2 * NS_PER_SEC);
-    event7.init();
-
-    // Two events in bucket #0.
-    countProducer.onMatchedLogEvent(1 /*log matcher index*/, event1);
-    countProducer.onMatchedLogEvent(1 /*log matcher index*/, event2);
-
-    EXPECT_EQ(1UL, countProducer.mCurrentSlicedCounter->size());
-    EXPECT_EQ(2L, countProducer.mCurrentSlicedCounter->begin()->second);
-    EXPECT_EQ(anomalyTracker->getRefractoryPeriodEndsSec(DEFAULT_METRIC_DIMENSION_KEY), 0U);
-
-    // One event in bucket #2. No alarm as bucket #0 is trashed out.
-    countProducer.onMatchedLogEvent(1 /*log matcher index*/, event3);
-    EXPECT_EQ(1UL, countProducer.mCurrentSlicedCounter->size());
-    EXPECT_EQ(1L, countProducer.mCurrentSlicedCounter->begin()->second);
-    EXPECT_EQ(anomalyTracker->getRefractoryPeriodEndsSec(DEFAULT_METRIC_DIMENSION_KEY), 0U);
-
-    // Two events in bucket #3.
-    countProducer.onMatchedLogEvent(1 /*log matcher index*/, event4);
-    countProducer.onMatchedLogEvent(1 /*log matcher index*/, event5);
-    countProducer.onMatchedLogEvent(1 /*log matcher index*/, event6);
-    EXPECT_EQ(1UL, countProducer.mCurrentSlicedCounter->size());
-    EXPECT_EQ(3L, countProducer.mCurrentSlicedCounter->begin()->second);
-    // Anomaly at event 6 is within refractory period. The alarm is at event 5 timestamp not event 6
-    EXPECT_EQ(anomalyTracker->getRefractoryPeriodEndsSec(DEFAULT_METRIC_DIMENSION_KEY),
-            std::ceil(1.0 * event5.GetElapsedTimestampNs() / NS_PER_SEC + refPeriodSec));
-
-    countProducer.onMatchedLogEvent(1 /*log matcher index*/, event7);
-    EXPECT_EQ(1UL, countProducer.mCurrentSlicedCounter->size());
-    EXPECT_EQ(4L, countProducer.mCurrentSlicedCounter->begin()->second);
-    EXPECT_EQ(anomalyTracker->getRefractoryPeriodEndsSec(DEFAULT_METRIC_DIMENSION_KEY),
-            std::ceil(1.0 * event7.GetElapsedTimestampNs() / NS_PER_SEC + refPeriodSec));
-}
+// TODO(b/149590301): Update these tests to use new socket schema.
+//TEST(CountMetricProducerTest, TestFirstBucket) {
+//    CountMetric metric;
+//    metric.set_id(1);
+//    metric.set_bucket(ONE_MINUTE);
+//    sp<MockConditionWizard> wizard = new NaggyMock<MockConditionWizard>();
+//
+//    CountMetricProducer countProducer(kConfigKey, metric, -1 /*-1 meaning no condition*/, wizard, 5,
+//                                      600 * NS_PER_SEC + NS_PER_SEC / 2);
+//    EXPECT_EQ(600500000000, countProducer.mCurrentBucketStartTimeNs);
+//    EXPECT_EQ(10, countProducer.mCurrentBucketNum);
+//    EXPECT_EQ(660000000005, countProducer.getCurrentBucketEndTimeNs());
+//}
+//
+//TEST(CountMetricProducerTest, TestNonDimensionalEvents) {
+//    int64_t bucketStartTimeNs = 10000000000;
+//    int64_t bucketSizeNs = TimeUnitToBucketSizeInMillis(ONE_MINUTE) * 1000000LL;
+//    int64_t bucket2StartTimeNs = bucketStartTimeNs + bucketSizeNs;
+//    int64_t bucket3StartTimeNs = bucketStartTimeNs + 2 * bucketSizeNs;
+//    int tagId = 1;
+//
+//    CountMetric metric;
+//    metric.set_id(1);
+//    metric.set_bucket(ONE_MINUTE);
+//
+//    LogEvent event1(tagId, bucketStartTimeNs + 1);
+//    event1.init();
+//    LogEvent event2(tagId, bucketStartTimeNs + 2);
+//    event2.init();
+//
+//    sp<MockConditionWizard> wizard = new NaggyMock<MockConditionWizard>();
+//
+//    CountMetricProducer countProducer(kConfigKey, metric, -1 /*-1 meaning no condition*/, wizard,
+//                                      bucketStartTimeNs, bucketStartTimeNs);
+//
+//    // 2 events in bucket 1.
+//    countProducer.onMatchedLogEvent(1 /*log matcher index*/, event1);
+//    countProducer.onMatchedLogEvent(1 /*log matcher index*/, event2);
+//
+//    // Flushes at event #2.
+//    countProducer.flushIfNeededLocked(bucketStartTimeNs + 2);
+//    EXPECT_EQ(0UL, countProducer.mPastBuckets.size());
+//
+//    // Flushes.
+//    countProducer.flushIfNeededLocked(bucketStartTimeNs + bucketSizeNs + 1);
+//    EXPECT_EQ(1UL, countProducer.mPastBuckets.size());
+//    EXPECT_TRUE(countProducer.mPastBuckets.find(DEFAULT_METRIC_DIMENSION_KEY) !=
+//                countProducer.mPastBuckets.end());
+//    const auto& buckets = countProducer.mPastBuckets[DEFAULT_METRIC_DIMENSION_KEY];
+//    EXPECT_EQ(1UL, buckets.size());
+//    EXPECT_EQ(bucketStartTimeNs, buckets[0].mBucketStartNs);
+//    EXPECT_EQ(bucketStartTimeNs + bucketSizeNs, buckets[0].mBucketEndNs);
+//    EXPECT_EQ(2LL, buckets[0].mCount);
+//
+//    // 1 matched event happens in bucket 2.
+//    LogEvent event3(tagId, bucketStartTimeNs + bucketSizeNs + 2);
+//    event3.init();
+//
+//    countProducer.onMatchedLogEvent(1 /*log matcher index*/, event3);
+//    countProducer.flushIfNeededLocked(bucketStartTimeNs + 2 * bucketSizeNs + 1);
+//    EXPECT_EQ(1UL, countProducer.mPastBuckets.size());
+//    EXPECT_TRUE(countProducer.mPastBuckets.find(DEFAULT_METRIC_DIMENSION_KEY) !=
+//                countProducer.mPastBuckets.end());
+//    EXPECT_EQ(2UL, countProducer.mPastBuckets[DEFAULT_METRIC_DIMENSION_KEY].size());
+//    const auto& bucketInfo2 = countProducer.mPastBuckets[DEFAULT_METRIC_DIMENSION_KEY][1];
+//    EXPECT_EQ(bucket2StartTimeNs, bucketInfo2.mBucketStartNs);
+//    EXPECT_EQ(bucket2StartTimeNs + bucketSizeNs, bucketInfo2.mBucketEndNs);
+//    EXPECT_EQ(1LL, bucketInfo2.mCount);
+//
+//    // nothing happens in bucket 3. we should not record anything for bucket 3.
+//    countProducer.flushIfNeededLocked(bucketStartTimeNs + 3 * bucketSizeNs + 1);
+//    EXPECT_EQ(1UL, countProducer.mPastBuckets.size());
+//    EXPECT_TRUE(countProducer.mPastBuckets.find(DEFAULT_METRIC_DIMENSION_KEY) !=
+//                countProducer.mPastBuckets.end());
+//    const auto& buckets3 = countProducer.mPastBuckets[DEFAULT_METRIC_DIMENSION_KEY];
+//    EXPECT_EQ(2UL, buckets3.size());
+//}
+//
+//TEST(CountMetricProducerTest, TestEventsWithNonSlicedCondition) {
+//    int64_t bucketStartTimeNs = 10000000000;
+//    int64_t bucketSizeNs = TimeUnitToBucketSizeInMillis(ONE_MINUTE) * 1000000LL;
+//
+//    CountMetric metric;
+//    metric.set_id(1);
+//    metric.set_bucket(ONE_MINUTE);
+//    metric.set_condition(StringToId("SCREEN_ON"));
+//
+//    LogEvent event1(1, bucketStartTimeNs + 1);
+//    event1.init();
+//
+//    LogEvent event2(1, bucketStartTimeNs + 10);
+//    event2.init();
+//
+//    sp<MockConditionWizard> wizard = new NaggyMock<MockConditionWizard>();
+//
+//    CountMetricProducer countProducer(kConfigKey, metric, 1, wizard, bucketStartTimeNs,
+//                                      bucketStartTimeNs);
+//
+//    countProducer.onConditionChanged(true, bucketStartTimeNs);
+//    countProducer.onMatchedLogEvent(1 /*matcher index*/, event1);
+//    EXPECT_EQ(0UL, countProducer.mPastBuckets.size());
+//
+//    countProducer.onConditionChanged(false /*new condition*/, bucketStartTimeNs + 2);
+//    // Upon this match event, the matched event1 is flushed.
+//    countProducer.onMatchedLogEvent(1 /*matcher index*/, event2);
+//    EXPECT_EQ(0UL, countProducer.mPastBuckets.size());
+//
+//    countProducer.flushIfNeededLocked(bucketStartTimeNs + bucketSizeNs + 1);
+//    EXPECT_EQ(1UL, countProducer.mPastBuckets.size());
+//    EXPECT_TRUE(countProducer.mPastBuckets.find(DEFAULT_METRIC_DIMENSION_KEY) !=
+//                countProducer.mPastBuckets.end());
+//    {
+//        const auto& buckets = countProducer.mPastBuckets[DEFAULT_METRIC_DIMENSION_KEY];
+//        EXPECT_EQ(1UL, buckets.size());
+//        const auto& bucketInfo = buckets[0];
+//        EXPECT_EQ(bucketStartTimeNs, bucketInfo.mBucketStartNs);
+//        EXPECT_EQ(bucketStartTimeNs + bucketSizeNs, bucketInfo.mBucketEndNs);
+//        EXPECT_EQ(1LL, bucketInfo.mCount);
+//    }
+//}
+//
+//TEST(CountMetricProducerTest, TestEventsWithSlicedCondition) {
+//    int64_t bucketStartTimeNs = 10000000000;
+//    int64_t bucketSizeNs = TimeUnitToBucketSizeInMillis(ONE_MINUTE) * 1000000LL;
+//
+//    int tagId = 1;
+//    int conditionTagId = 2;
+//
+//    CountMetric metric;
+//    metric.set_id(1);
+//    metric.set_bucket(ONE_MINUTE);
+//    metric.set_condition(StringToId("APP_IN_BACKGROUND_PER_UID_AND_SCREEN_ON"));
+//    MetricConditionLink* link = metric.add_links();
+//    link->set_condition(StringToId("APP_IN_BACKGROUND_PER_UID"));
+//    buildSimpleAtomFieldMatcher(tagId, 1, link->mutable_fields_in_what());
+//    buildSimpleAtomFieldMatcher(conditionTagId, 2, link->mutable_fields_in_condition());
+//
+//    LogEvent event1(tagId, bucketStartTimeNs + 1);
+//    event1.write("111");  // uid
+//    event1.init();
+//    ConditionKey key1;
+//    key1[StringToId("APP_IN_BACKGROUND_PER_UID")] =
+//        {getMockedDimensionKey(conditionTagId, 2, "111")};
+//
+//    LogEvent event2(tagId, bucketStartTimeNs + 10);
+//    event2.write("222");  // uid
+//    event2.init();
+//    ConditionKey key2;
+//    key2[StringToId("APP_IN_BACKGROUND_PER_UID")] =
+//        {getMockedDimensionKey(conditionTagId, 2, "222")};
+//
+//    sp<MockConditionWizard> wizard = new NaggyMock<MockConditionWizard>();
+//    EXPECT_CALL(*wizard, query(_, key1, _)).WillOnce(Return(ConditionState::kFalse));
+//
+//    EXPECT_CALL(*wizard, query(_, key2, _)).WillOnce(Return(ConditionState::kTrue));
+//
+//    CountMetricProducer countProducer(kConfigKey, metric, 1 /*condition tracker index*/, wizard,
+//                                      bucketStartTimeNs, bucketStartTimeNs);
+//
+//    countProducer.onMatchedLogEvent(1 /*log matcher index*/, event1);
+//    countProducer.flushIfNeededLocked(bucketStartTimeNs + 1);
+//    EXPECT_EQ(0UL, countProducer.mPastBuckets.size());
+//
+//    countProducer.onMatchedLogEvent(1 /*log matcher index*/, event2);
+//    countProducer.flushIfNeededLocked(bucketStartTimeNs + bucketSizeNs + 1);
+//    EXPECT_EQ(1UL, countProducer.mPastBuckets.size());
+//    EXPECT_TRUE(countProducer.mPastBuckets.find(DEFAULT_METRIC_DIMENSION_KEY) !=
+//                countProducer.mPastBuckets.end());
+//    const auto& buckets = countProducer.mPastBuckets[DEFAULT_METRIC_DIMENSION_KEY];
+//    EXPECT_EQ(1UL, buckets.size());
+//    const auto& bucketInfo = buckets[0];
+//    EXPECT_EQ(bucketStartTimeNs, bucketInfo.mBucketStartNs);
+//    EXPECT_EQ(bucketStartTimeNs + bucketSizeNs, bucketInfo.mBucketEndNs);
+//    EXPECT_EQ(1LL, bucketInfo.mCount);
+//}
+//
+//TEST(CountMetricProducerTest, TestEventWithAppUpgrade) {
+//    sp<AlarmMonitor> alarmMonitor;
+//    int64_t bucketStartTimeNs = 10000000000;
+//    int64_t bucketSizeNs = TimeUnitToBucketSizeInMillis(ONE_MINUTE) * 1000000LL;
+//    int64_t eventUpgradeTimeNs = bucketStartTimeNs + 15 * NS_PER_SEC;
+//
+//    int tagId = 1;
+//    int conditionTagId = 2;
+//
+//    CountMetric metric;
+//    metric.set_id(1);
+//    metric.set_bucket(ONE_MINUTE);
+//    Alert alert;
+//    alert.set_num_buckets(3);
+//    alert.set_trigger_if_sum_gt(2);
+//    LogEvent event1(tagId, bucketStartTimeNs + 1);
+//    event1.write("111");  // uid
+//    event1.init();
+//    sp<MockConditionWizard> wizard = new NaggyMock<MockConditionWizard>();
+//    CountMetricProducer countProducer(kConfigKey, metric, -1 /* no condition */, wizard,
+//                                      bucketStartTimeNs, bucketStartTimeNs);
+//
+//    sp<AnomalyTracker> anomalyTracker = countProducer.addAnomalyTracker(alert, alarmMonitor);
+//    EXPECT_TRUE(anomalyTracker != nullptr);
+//
+//    // Bucket is flushed yet.
+//    countProducer.onMatchedLogEvent(1 /*log matcher index*/, event1);
+//    EXPECT_EQ(0UL, countProducer.mPastBuckets.size());
+//    EXPECT_EQ(0, anomalyTracker->getSumOverPastBuckets(DEFAULT_METRIC_DIMENSION_KEY));
+//
+//    // App upgrade forces bucket flush.
+//    // Check that there's a past bucket and the bucket end is not adjusted.
+//    countProducer.notifyAppUpgrade(eventUpgradeTimeNs, "ANY.APP", 1, 1);
+//    EXPECT_EQ(1UL, countProducer.mPastBuckets[DEFAULT_METRIC_DIMENSION_KEY].size());
+//    EXPECT_EQ((long long)bucketStartTimeNs,
+//              countProducer.mPastBuckets[DEFAULT_METRIC_DIMENSION_KEY][0].mBucketStartNs);
+//    EXPECT_EQ((long long)eventUpgradeTimeNs,
+//              countProducer.mPastBuckets[DEFAULT_METRIC_DIMENSION_KEY][0].mBucketEndNs);
+//    EXPECT_EQ(eventUpgradeTimeNs, countProducer.mCurrentBucketStartTimeNs);
+//    // Anomaly tracker only contains full buckets.
+//    EXPECT_EQ(0, anomalyTracker->getSumOverPastBuckets(DEFAULT_METRIC_DIMENSION_KEY));
+//
+//    int64_t lastEndTimeNs = countProducer.getCurrentBucketEndTimeNs();
+//    // Next event occurs in same bucket as partial bucket created.
+//    LogEvent event2(tagId, bucketStartTimeNs + 59 * NS_PER_SEC + 10);
+//    event2.write("222");  // uid
+//    event2.init();
+//    countProducer.onMatchedLogEvent(1 /*log matcher index*/, event2);
+//    EXPECT_EQ(1UL, countProducer.mPastBuckets[DEFAULT_METRIC_DIMENSION_KEY].size());
+//    EXPECT_EQ(eventUpgradeTimeNs, countProducer.mCurrentBucketStartTimeNs);
+//    EXPECT_EQ(0, anomalyTracker->getSumOverPastBuckets(DEFAULT_METRIC_DIMENSION_KEY));
+//
+//    // Third event in following bucket.
+//    LogEvent event3(tagId, bucketStartTimeNs + 62 * NS_PER_SEC + 10);
+//    event3.write("333");  // uid
+//    event3.init();
+//    countProducer.onMatchedLogEvent(1 /*log matcher index*/, event3);
+//    EXPECT_EQ(2UL, countProducer.mPastBuckets[DEFAULT_METRIC_DIMENSION_KEY].size());
+//    EXPECT_EQ(lastEndTimeNs, countProducer.mCurrentBucketStartTimeNs);
+//    EXPECT_EQ(2, anomalyTracker->getSumOverPastBuckets(DEFAULT_METRIC_DIMENSION_KEY));
+//}
+//
+//TEST(CountMetricProducerTest, TestEventWithAppUpgradeInNextBucket) {
+//    int64_t bucketStartTimeNs = 10000000000;
+//    int64_t bucketSizeNs = TimeUnitToBucketSizeInMillis(ONE_MINUTE) * 1000000LL;
+//    int64_t eventUpgradeTimeNs = bucketStartTimeNs + 65 * NS_PER_SEC;
+//
+//    int tagId = 1;
+//    int conditionTagId = 2;
+//
+//    CountMetric metric;
+//    metric.set_id(1);
+//    metric.set_bucket(ONE_MINUTE);
+//    LogEvent event1(tagId, bucketStartTimeNs + 1);
+//    event1.write("111");  // uid
+//    event1.init();
+//    sp<MockConditionWizard> wizard = new NaggyMock<MockConditionWizard>();
+//    CountMetricProducer countProducer(kConfigKey, metric, -1 /* no condition */, wizard,
+//                                      bucketStartTimeNs, bucketStartTimeNs);
+//
+//    // Bucket is flushed yet.
+//    countProducer.onMatchedLogEvent(1 /*log matcher index*/, event1);
+//    EXPECT_EQ(0UL, countProducer.mPastBuckets.size());
+//
+//    // App upgrade forces bucket flush.
+//    // Check that there's a past bucket and the bucket end is not adjusted.
+//    countProducer.notifyAppUpgrade(eventUpgradeTimeNs, "ANY.APP", 1, 1);
+//    EXPECT_EQ(1UL, countProducer.mPastBuckets[DEFAULT_METRIC_DIMENSION_KEY].size());
+//    EXPECT_EQ((int64_t)bucketStartTimeNs,
+//              countProducer.mPastBuckets[DEFAULT_METRIC_DIMENSION_KEY][0].mBucketStartNs);
+//    EXPECT_EQ(bucketStartTimeNs + bucketSizeNs,
+//              countProducer.mPastBuckets[DEFAULT_METRIC_DIMENSION_KEY][0].mBucketEndNs);
+//    EXPECT_EQ(eventUpgradeTimeNs, countProducer.mCurrentBucketStartTimeNs);
+//
+//    // Next event occurs in same bucket as partial bucket created.
+//    LogEvent event2(tagId, bucketStartTimeNs + 70 * NS_PER_SEC + 10);
+//    event2.write("222");  // uid
+//    event2.init();
+//    countProducer.onMatchedLogEvent(1 /*log matcher index*/, event2);
+//    EXPECT_EQ(1UL, countProducer.mPastBuckets[DEFAULT_METRIC_DIMENSION_KEY].size());
+//
+//    // Third event in following bucket.
+//    LogEvent event3(tagId, bucketStartTimeNs + 121 * NS_PER_SEC + 10);
+//    event3.write("333");  // uid
+//    event3.init();
+//    countProducer.onMatchedLogEvent(1 /*log matcher index*/, event3);
+//    EXPECT_EQ(2UL, countProducer.mPastBuckets[DEFAULT_METRIC_DIMENSION_KEY].size());
+//    EXPECT_EQ((int64_t)eventUpgradeTimeNs,
+//              countProducer.mPastBuckets[DEFAULT_METRIC_DIMENSION_KEY][1].mBucketStartNs);
+//    EXPECT_EQ(bucketStartTimeNs + 2 * bucketSizeNs,
+//              countProducer.mPastBuckets[DEFAULT_METRIC_DIMENSION_KEY][1].mBucketEndNs);
+//}
+//
+//TEST(CountMetricProducerTest, TestAnomalyDetectionUnSliced) {
+//    sp<AlarmMonitor> alarmMonitor;
+//    Alert alert;
+//    alert.set_id(11);
+//    alert.set_metric_id(1);
+//    alert.set_trigger_if_sum_gt(2);
+//    alert.set_num_buckets(2);
+//    const int32_t refPeriodSec = 1;
+//    alert.set_refractory_period_secs(refPeriodSec);
+//
+//    int64_t bucketStartTimeNs = 10000000000;
+//    int64_t bucketSizeNs = TimeUnitToBucketSizeInMillis(ONE_MINUTE) * 1000000LL;
+//    int64_t bucket2StartTimeNs = bucketStartTimeNs + bucketSizeNs;
+//    int64_t bucket3StartTimeNs = bucketStartTimeNs + 2 * bucketSizeNs;
+//
+//    CountMetric metric;
+//    metric.set_id(1);
+//    metric.set_bucket(ONE_MINUTE);
+//
+//    sp<MockConditionWizard> wizard = new NaggyMock<MockConditionWizard>();
+//    CountMetricProducer countProducer(kConfigKey, metric, -1 /*-1 meaning no condition*/, wizard,
+//                                      bucketStartTimeNs, bucketStartTimeNs);
+//
+//    sp<AnomalyTracker> anomalyTracker = countProducer.addAnomalyTracker(alert, alarmMonitor);
+//
+//    int tagId = 1;
+//    LogEvent event1(tagId, bucketStartTimeNs + 1);
+//    event1.init();
+//    LogEvent event2(tagId, bucketStartTimeNs + 2);
+//    event2.init();
+//    LogEvent event3(tagId, bucketStartTimeNs + 2 * bucketSizeNs + 1);
+//    event3.init();
+//    LogEvent event4(tagId, bucketStartTimeNs + 3 * bucketSizeNs + 1);
+//    event4.init();
+//    LogEvent event5(tagId, bucketStartTimeNs + 3 * bucketSizeNs + 2);
+//    event5.init();
+//    LogEvent event6(tagId, bucketStartTimeNs + 3 * bucketSizeNs + 3);
+//    event6.init();
+//    LogEvent event7(tagId, bucketStartTimeNs + 3 * bucketSizeNs + 2 * NS_PER_SEC);
+//    event7.init();
+//
+//    // Two events in bucket #0.
+//    countProducer.onMatchedLogEvent(1 /*log matcher index*/, event1);
+//    countProducer.onMatchedLogEvent(1 /*log matcher index*/, event2);
+//
+//    EXPECT_EQ(1UL, countProducer.mCurrentSlicedCounter->size());
+//    EXPECT_EQ(2L, countProducer.mCurrentSlicedCounter->begin()->second);
+//    EXPECT_EQ(anomalyTracker->getRefractoryPeriodEndsSec(DEFAULT_METRIC_DIMENSION_KEY), 0U);
+//
+//    // One event in bucket #2. No alarm as bucket #0 is trashed out.
+//    countProducer.onMatchedLogEvent(1 /*log matcher index*/, event3);
+//    EXPECT_EQ(1UL, countProducer.mCurrentSlicedCounter->size());
+//    EXPECT_EQ(1L, countProducer.mCurrentSlicedCounter->begin()->second);
+//    EXPECT_EQ(anomalyTracker->getRefractoryPeriodEndsSec(DEFAULT_METRIC_DIMENSION_KEY), 0U);
+//
+//    // Two events in bucket #3.
+//    countProducer.onMatchedLogEvent(1 /*log matcher index*/, event4);
+//    countProducer.onMatchedLogEvent(1 /*log matcher index*/, event5);
+//    countProducer.onMatchedLogEvent(1 /*log matcher index*/, event6);
+//    EXPECT_EQ(1UL, countProducer.mCurrentSlicedCounter->size());
+//    EXPECT_EQ(3L, countProducer.mCurrentSlicedCounter->begin()->second);
+//    // Anomaly at event 6 is within refractory period. The alarm is at event 5 timestamp not event 6
+//    EXPECT_EQ(anomalyTracker->getRefractoryPeriodEndsSec(DEFAULT_METRIC_DIMENSION_KEY),
+//            std::ceil(1.0 * event5.GetElapsedTimestampNs() / NS_PER_SEC + refPeriodSec));
+//
+//    countProducer.onMatchedLogEvent(1 /*log matcher index*/, event7);
+//    EXPECT_EQ(1UL, countProducer.mCurrentSlicedCounter->size());
+//    EXPECT_EQ(4L, countProducer.mCurrentSlicedCounter->begin()->second);
+//    EXPECT_EQ(anomalyTracker->getRefractoryPeriodEndsSec(DEFAULT_METRIC_DIMENSION_KEY),
+//            std::ceil(1.0 * event7.GetElapsedTimestampNs() / NS_PER_SEC + refPeriodSec));
+//}
 
 TEST(CountMetricProducerTest, TestOneWeekTimeUnit) {
     CountMetric metric;
diff --git a/cmds/statsd/tests/metrics/DurationMetricProducer_test.cpp b/cmds/statsd/tests/metrics/DurationMetricProducer_test.cpp
index b294cad..6661374 100644
--- a/cmds/statsd/tests/metrics/DurationMetricProducer_test.cpp
+++ b/cmds/statsd/tests/metrics/DurationMetricProducer_test.cpp
@@ -56,382 +56,383 @@
     EXPECT_EQ(660000000005, durationProducer.getCurrentBucketEndTimeNs());
 }
 
-TEST(DurationMetricTrackerTest, TestNoCondition) {
-    sp<MockConditionWizard> wizard = new NaggyMock<MockConditionWizard>();
-    int64_t bucketStartTimeNs = 10000000000;
-    int64_t bucketSizeNs = TimeUnitToBucketSizeInMillis(ONE_MINUTE) * 1000000LL;
-
-    DurationMetric metric;
-    metric.set_id(1);
-    metric.set_bucket(ONE_MINUTE);
-    metric.set_aggregation_type(DurationMetric_AggregationType_SUM);
-
-    int tagId = 1;
-    LogEvent event1(tagId, bucketStartTimeNs + 1);
-    event1.init();
-    LogEvent event2(tagId, bucketStartTimeNs + bucketSizeNs + 2);
-    event2.init();
-
-    FieldMatcher dimensions;
-    DurationMetricProducer durationProducer(
-            kConfigKey, metric, -1 /*no condition*/, 1 /* start index */, 2 /* stop index */,
-            3 /* stop_all index */, false /*nesting*/, wizard, dimensions, bucketStartTimeNs, bucketStartTimeNs);
-
-    durationProducer.onMatchedLogEvent(1 /* start index*/, event1);
-    durationProducer.onMatchedLogEvent(2 /* stop index*/, event2);
-    durationProducer.flushIfNeededLocked(bucketStartTimeNs + 2 * bucketSizeNs + 1);
-    EXPECT_EQ(1UL, durationProducer.mPastBuckets.size());
-    EXPECT_TRUE(durationProducer.mPastBuckets.find(DEFAULT_METRIC_DIMENSION_KEY) !=
-                durationProducer.mPastBuckets.end());
-    const auto& buckets = durationProducer.mPastBuckets[DEFAULT_METRIC_DIMENSION_KEY];
-    EXPECT_EQ(2UL, buckets.size());
-    EXPECT_EQ(bucketStartTimeNs, buckets[0].mBucketStartNs);
-    EXPECT_EQ(bucketStartTimeNs + bucketSizeNs, buckets[0].mBucketEndNs);
-    EXPECT_EQ(bucketSizeNs - 1LL, buckets[0].mDuration);
-    EXPECT_EQ(bucketStartTimeNs + bucketSizeNs, buckets[1].mBucketStartNs);
-    EXPECT_EQ(bucketStartTimeNs + 2 * bucketSizeNs, buckets[1].mBucketEndNs);
-    EXPECT_EQ(2LL, buckets[1].mDuration);
-}
-
-TEST(DurationMetricTrackerTest, TestNonSlicedCondition) {
-    sp<MockConditionWizard> wizard = new NaggyMock<MockConditionWizard>();
-    int64_t bucketStartTimeNs = 10000000000;
-    int64_t bucketSizeNs = TimeUnitToBucketSizeInMillis(ONE_MINUTE) * 1000000LL;
-
-    DurationMetric metric;
-    metric.set_id(1);
-    metric.set_bucket(ONE_MINUTE);
-    metric.set_aggregation_type(DurationMetric_AggregationType_SUM);
-
-    int tagId = 1;
-    LogEvent event1(tagId, bucketStartTimeNs + 1);
-    event1.init();
-    LogEvent event2(tagId, bucketStartTimeNs + 2);
-    event2.init();
-    LogEvent event3(tagId, bucketStartTimeNs + bucketSizeNs + 1);
-    event3.init();
-    LogEvent event4(tagId, bucketStartTimeNs + bucketSizeNs + 3);
-    event4.init();
-
-    FieldMatcher dimensions;
-    DurationMetricProducer durationProducer(
-            kConfigKey, metric, 0 /* condition index */, 1 /* start index */, 2 /* stop index */,
-            3 /* stop_all index */, false /*nesting*/, wizard, dimensions, bucketStartTimeNs, bucketStartTimeNs);
-    durationProducer.mCondition = ConditionState::kFalse;
-
-    EXPECT_FALSE(durationProducer.mCondition);
-    EXPECT_FALSE(durationProducer.isConditionSliced());
-
-    durationProducer.onMatchedLogEvent(1 /* start index*/, event1);
-    durationProducer.onMatchedLogEvent(2 /* stop index*/, event2);
-    durationProducer.flushIfNeededLocked(bucketStartTimeNs + bucketSizeNs + 1);
-    EXPECT_EQ(0UL, durationProducer.mPastBuckets.size());
-
-    durationProducer.onMatchedLogEvent(1 /* start index*/, event3);
-    durationProducer.onConditionChanged(true /* condition */, bucketStartTimeNs + bucketSizeNs + 2);
-    durationProducer.onMatchedLogEvent(2 /* stop index*/, event4);
-    durationProducer.flushIfNeededLocked(bucketStartTimeNs + 2 * bucketSizeNs + 1);
-    EXPECT_EQ(1UL, durationProducer.mPastBuckets.size());
-    EXPECT_TRUE(durationProducer.mPastBuckets.find(DEFAULT_METRIC_DIMENSION_KEY) !=
-                durationProducer.mPastBuckets.end());
-    const auto& buckets2 = durationProducer.mPastBuckets[DEFAULT_METRIC_DIMENSION_KEY];
-    EXPECT_EQ(1UL, buckets2.size());
-    EXPECT_EQ(bucketStartTimeNs + bucketSizeNs, buckets2[0].mBucketStartNs);
-    EXPECT_EQ(bucketStartTimeNs + 2 * bucketSizeNs, buckets2[0].mBucketEndNs);
-    EXPECT_EQ(1LL, buckets2[0].mDuration);
-}
-
-TEST(DurationMetricTrackerTest, TestNonSlicedConditionUnknownState) {
-    sp<MockConditionWizard> wizard = new NaggyMock<MockConditionWizard>();
-    int64_t bucketStartTimeNs = 10000000000;
-    int64_t bucketSizeNs = TimeUnitToBucketSizeInMillis(ONE_MINUTE) * 1000000LL;
-
-    DurationMetric metric;
-    metric.set_id(1);
-    metric.set_bucket(ONE_MINUTE);
-    metric.set_aggregation_type(DurationMetric_AggregationType_SUM);
-
-    int tagId = 1;
-    LogEvent event1(tagId, bucketStartTimeNs + 1);
-    event1.init();
-    LogEvent event2(tagId, bucketStartTimeNs + 2);
-    event2.init();
-    LogEvent event3(tagId, bucketStartTimeNs + bucketSizeNs + 1);
-    event3.init();
-    LogEvent event4(tagId, bucketStartTimeNs + bucketSizeNs + 3);
-    event4.init();
-
-    FieldMatcher dimensions;
-    DurationMetricProducer durationProducer(
-            kConfigKey, metric, 0 /* condition index */, 1 /* start index */, 2 /* stop index */,
-            3 /* stop_all index */, false /*nesting*/, wizard, dimensions, bucketStartTimeNs, bucketStartTimeNs);
-
-    EXPECT_EQ(ConditionState::kUnknown, durationProducer.mCondition);
-    EXPECT_FALSE(durationProducer.isConditionSliced());
-
-    durationProducer.onMatchedLogEvent(1 /* start index*/, event1);
-    durationProducer.onMatchedLogEvent(2 /* stop index*/, event2);
-    durationProducer.flushIfNeededLocked(bucketStartTimeNs + bucketSizeNs + 1);
-    EXPECT_EQ(0UL, durationProducer.mPastBuckets.size());
-
-    durationProducer.onMatchedLogEvent(1 /* start index*/, event3);
-    durationProducer.onConditionChanged(true /* condition */, bucketStartTimeNs + bucketSizeNs + 2);
-    durationProducer.onMatchedLogEvent(2 /* stop index*/, event4);
-    durationProducer.flushIfNeededLocked(bucketStartTimeNs + 2 * bucketSizeNs + 1);
-    EXPECT_EQ(1UL, durationProducer.mPastBuckets.size());
-    const auto& buckets2 = durationProducer.mPastBuckets[DEFAULT_METRIC_DIMENSION_KEY];
-    EXPECT_EQ(1UL, buckets2.size());
-    EXPECT_EQ(bucketStartTimeNs + bucketSizeNs, buckets2[0].mBucketStartNs);
-    EXPECT_EQ(bucketStartTimeNs + 2 * bucketSizeNs, buckets2[0].mBucketEndNs);
-    EXPECT_EQ(1LL, buckets2[0].mDuration);
-}
-
-TEST(DurationMetricTrackerTest, TestSumDurationWithUpgrade) {
-    /**
-     * The duration starts from the first bucket, through the two partial buckets (10-70sec),
-     * another bucket, and ends at the beginning of the next full bucket.
-     * Expected buckets:
-     *  - [10,25]: 14 secs
-     *  - [25,70]: All 45 secs
-     *  - [70,130]: All 60 secs
-     *  - [130, 210]: Only 5 secs (event ended at 135sec)
-     */
-    int64_t bucketStartTimeNs = 10000000000;
-    int64_t bucketSizeNs = TimeUnitToBucketSizeInMillis(ONE_MINUTE) * 1000000LL;
-    int64_t eventUpgradeTimeNs = bucketStartTimeNs + 15 * NS_PER_SEC;
-    int64_t startTimeNs = bucketStartTimeNs + 1 * NS_PER_SEC;
-    int64_t endTimeNs = startTimeNs + 125 * NS_PER_SEC;
-
-    int tagId = 1;
-
-    DurationMetric metric;
-    metric.set_id(1);
-    metric.set_bucket(ONE_MINUTE);
-    metric.set_aggregation_type(DurationMetric_AggregationType_SUM);
-    sp<MockConditionWizard> wizard = new NaggyMock<MockConditionWizard>();
-    FieldMatcher dimensions;
-    DurationMetricProducer durationProducer(
-            kConfigKey, metric, -1 /* no condition */, 1 /* start index */, 2 /* stop index */,
-            3 /* stop_all index */, false /*nesting*/, wizard, dimensions, bucketStartTimeNs, bucketStartTimeNs);
-
-    LogEvent start_event(tagId, startTimeNs);
-    start_event.init();
-    durationProducer.onMatchedLogEvent(1 /* start index*/, start_event);
-    EXPECT_EQ(0UL, durationProducer.mPastBuckets.size());
-    EXPECT_EQ(bucketStartTimeNs, durationProducer.mCurrentBucketStartTimeNs);
-
-    durationProducer.notifyAppUpgrade(eventUpgradeTimeNs, "ANY.APP", 1, 1);
-    EXPECT_EQ(1UL, durationProducer.mPastBuckets[DEFAULT_METRIC_DIMENSION_KEY].size());
-    std::vector<DurationBucket> buckets =
-            durationProducer.mPastBuckets[DEFAULT_METRIC_DIMENSION_KEY];
-    EXPECT_EQ(bucketStartTimeNs, buckets[0].mBucketStartNs);
-    EXPECT_EQ(eventUpgradeTimeNs, buckets[0].mBucketEndNs);
-    EXPECT_EQ(eventUpgradeTimeNs - startTimeNs, buckets[0].mDuration);
-    EXPECT_EQ(eventUpgradeTimeNs, durationProducer.mCurrentBucketStartTimeNs);
-
-    // We skip ahead one bucket, so we fill in the first two partial buckets and one full bucket.
-    LogEvent end_event(tagId, endTimeNs);
-    end_event.init();
-    durationProducer.onMatchedLogEvent(2 /* stop index*/, end_event);
-    buckets = durationProducer.mPastBuckets[DEFAULT_METRIC_DIMENSION_KEY];
-    EXPECT_EQ(3UL, buckets.size());
-    EXPECT_EQ(eventUpgradeTimeNs, buckets[1].mBucketStartNs);
-    EXPECT_EQ(bucketStartTimeNs + bucketSizeNs, buckets[1].mBucketEndNs);
-    EXPECT_EQ(bucketStartTimeNs + bucketSizeNs - eventUpgradeTimeNs, buckets[1].mDuration);
-    EXPECT_EQ(bucketStartTimeNs + bucketSizeNs, buckets[2].mBucketStartNs);
-    EXPECT_EQ(bucketStartTimeNs + 2 * bucketSizeNs, buckets[2].mBucketEndNs);
-    EXPECT_EQ(bucketSizeNs, buckets[2].mDuration);
-}
-
-TEST(DurationMetricTrackerTest, TestSumDurationWithUpgradeInFollowingBucket) {
-    /**
-     * Expected buckets (start at 11s, upgrade at 75s, end at 135s):
-     *  - [10,70]: 59 secs
-     *  - [70,75]: 5 sec
-     *  - [75,130]: 55 secs
-     */
-    int64_t bucketStartTimeNs = 10000000000;
-    int64_t bucketSizeNs = TimeUnitToBucketSizeInMillis(ONE_MINUTE) * 1000000LL;
-    int64_t eventUpgradeTimeNs = bucketStartTimeNs + 65 * NS_PER_SEC;
-    int64_t startTimeNs = bucketStartTimeNs + 1 * NS_PER_SEC;
-    int64_t endTimeNs = startTimeNs + 125 * NS_PER_SEC;
-
-    int tagId = 1;
-
-    DurationMetric metric;
-    metric.set_id(1);
-    metric.set_bucket(ONE_MINUTE);
-    metric.set_aggregation_type(DurationMetric_AggregationType_SUM);
-    sp<MockConditionWizard> wizard = new NaggyMock<MockConditionWizard>();
-    FieldMatcher dimensions;
-    DurationMetricProducer durationProducer(
-            kConfigKey, metric, -1 /* no condition */, 1 /* start index */, 2 /* stop index */,
-            3 /* stop_all index */, false /*nesting*/, wizard, dimensions, bucketStartTimeNs, bucketStartTimeNs);
-
-    LogEvent start_event(tagId, startTimeNs);
-    start_event.init();
-    durationProducer.onMatchedLogEvent(1 /* start index*/, start_event);
-    EXPECT_EQ(0UL, durationProducer.mPastBuckets.size());
-    EXPECT_EQ(bucketStartTimeNs, durationProducer.mCurrentBucketStartTimeNs);
-
-    durationProducer.notifyAppUpgrade(eventUpgradeTimeNs, "ANY.APP", 1, 1);
-    EXPECT_EQ(2UL, durationProducer.mPastBuckets[DEFAULT_METRIC_DIMENSION_KEY].size());
-    std::vector<DurationBucket> buckets =
-            durationProducer.mPastBuckets[DEFAULT_METRIC_DIMENSION_KEY];
-    EXPECT_EQ(bucketStartTimeNs, buckets[0].mBucketStartNs);
-    EXPECT_EQ(bucketStartTimeNs + bucketSizeNs, buckets[0].mBucketEndNs);
-    EXPECT_EQ(bucketStartTimeNs + bucketSizeNs - startTimeNs, buckets[0].mDuration);
-    EXPECT_EQ(bucketStartTimeNs + bucketSizeNs, buckets[1].mBucketStartNs);
-    EXPECT_EQ(eventUpgradeTimeNs, buckets[1].mBucketEndNs);
-    EXPECT_EQ(eventUpgradeTimeNs - (bucketStartTimeNs + bucketSizeNs), buckets[1].mDuration);
-    EXPECT_EQ(eventUpgradeTimeNs, durationProducer.mCurrentBucketStartTimeNs);
-
-    // We skip ahead one bucket, so we fill in the first two partial buckets and one full bucket.
-    LogEvent end_event(tagId, endTimeNs);
-    end_event.init();
-    durationProducer.onMatchedLogEvent(2 /* stop index*/, end_event);
-    buckets = durationProducer.mPastBuckets[DEFAULT_METRIC_DIMENSION_KEY];
-    EXPECT_EQ(3UL, buckets.size());
-    EXPECT_EQ(eventUpgradeTimeNs, buckets[2].mBucketStartNs);
-    EXPECT_EQ(bucketStartTimeNs + 2 * bucketSizeNs, buckets[2].mBucketEndNs);
-    EXPECT_EQ(bucketStartTimeNs + 2 * bucketSizeNs - eventUpgradeTimeNs, buckets[2].mDuration);
-}
-
-TEST(DurationMetricTrackerTest, TestSumDurationAnomalyWithUpgrade) {
-    sp<AlarmMonitor> alarmMonitor;
-    int64_t bucketStartTimeNs = 10000000000;
-    int64_t bucketSizeNs = TimeUnitToBucketSizeInMillis(ONE_MINUTE) * 1000000LL;
-    int64_t eventUpgradeTimeNs = bucketStartTimeNs + 15 * NS_PER_SEC;
-    int64_t startTimeNs = bucketStartTimeNs + 1;
-    int64_t endTimeNs = startTimeNs + 65 * NS_PER_SEC;
-
-    int tagId = 1;
-
-    // Setup metric with alert.
-    DurationMetric metric;
-    metric.set_id(1);
-    metric.set_bucket(ONE_MINUTE);
-    metric.set_aggregation_type(DurationMetric_AggregationType_SUM);
-    Alert alert;
-    alert.set_num_buckets(3);
-    alert.set_trigger_if_sum_gt(2);
-
-    sp<MockConditionWizard> wizard = new NaggyMock<MockConditionWizard>();
-    FieldMatcher dimensions;
-    DurationMetricProducer durationProducer(
-            kConfigKey, metric, -1 /* no condition */, 1 /* start index */, 2 /* stop index */,
-            3 /* stop_all index */, false /*nesting*/, wizard, dimensions, bucketStartTimeNs, bucketStartTimeNs);
-
-    sp<AnomalyTracker> anomalyTracker = durationProducer.addAnomalyTracker(alert, alarmMonitor);
-    EXPECT_TRUE(anomalyTracker != nullptr);
-
-    LogEvent start_event(tagId, startTimeNs);
-    start_event.init();
-    durationProducer.onMatchedLogEvent(1 /* start index*/, start_event);
-    durationProducer.notifyAppUpgrade(eventUpgradeTimeNs, "ANY.APP", 1, 1);
-    // We skip ahead one bucket, so we fill in the first two partial buckets and one full bucket.
-    LogEvent end_event(tagId, endTimeNs);
-    end_event.init();
-    durationProducer.onMatchedLogEvent(2 /* stop index*/, end_event);
-
-    EXPECT_EQ(bucketStartTimeNs + bucketSizeNs - startTimeNs,
-              anomalyTracker->getSumOverPastBuckets(DEFAULT_METRIC_DIMENSION_KEY));
-}
-
-TEST(DurationMetricTrackerTest, TestMaxDurationWithUpgrade) {
-    int64_t bucketStartTimeNs = 10000000000;
-    int64_t bucketSizeNs = TimeUnitToBucketSizeInMillis(ONE_MINUTE) * 1000000LL;
-    int64_t eventUpgradeTimeNs = bucketStartTimeNs + 15 * NS_PER_SEC;
-    int64_t startTimeNs = bucketStartTimeNs + 1;
-    int64_t endTimeNs = startTimeNs + 125 * NS_PER_SEC;
-
-    int tagId = 1;
-
-    DurationMetric metric;
-    metric.set_id(1);
-    metric.set_bucket(ONE_MINUTE);
-    metric.set_aggregation_type(DurationMetric_AggregationType_MAX_SPARSE);
-    LogEvent event1(tagId, startTimeNs);
-    event1.write("111");  // uid
-    event1.init();
-    sp<MockConditionWizard> wizard = new NaggyMock<MockConditionWizard>();
-    FieldMatcher dimensions;
-    DurationMetricProducer durationProducer(
-            kConfigKey, metric, -1 /* no condition */, 1 /* start index */, 2 /* stop index */,
-            3 /* stop_all index */, false /*nesting*/, wizard, dimensions, bucketStartTimeNs, bucketStartTimeNs);
-
-    LogEvent start_event(tagId, startTimeNs);
-    start_event.init();
-    durationProducer.onMatchedLogEvent(1 /* start index*/, start_event);
-    EXPECT_EQ(0UL, durationProducer.mPastBuckets.size());
-    EXPECT_EQ(bucketStartTimeNs, durationProducer.mCurrentBucketStartTimeNs);
-
-    durationProducer.notifyAppUpgrade(eventUpgradeTimeNs, "ANY.APP", 1, 1);
-    EXPECT_EQ(0UL, durationProducer.mPastBuckets[DEFAULT_METRIC_DIMENSION_KEY].size());
-    EXPECT_EQ(eventUpgradeTimeNs, durationProducer.mCurrentBucketStartTimeNs);
-
-    // We skip ahead one bucket, so we fill in the first two partial buckets and one full bucket.
-    LogEvent end_event(tagId, endTimeNs);
-    end_event.init();
-    durationProducer.onMatchedLogEvent(2 /* stop index*/, end_event);
-    EXPECT_EQ(0UL, durationProducer.mPastBuckets[DEFAULT_METRIC_DIMENSION_KEY].size());
-
-    durationProducer.flushIfNeededLocked(bucketStartTimeNs + 3 * bucketSizeNs + 1);
-    std::vector<DurationBucket> buckets =
-            durationProducer.mPastBuckets[DEFAULT_METRIC_DIMENSION_KEY];
-    EXPECT_EQ(1UL, buckets.size());
-    EXPECT_EQ(bucketStartTimeNs + 2 * bucketSizeNs, buckets[0].mBucketStartNs);
-    EXPECT_EQ(bucketStartTimeNs + 3 * bucketSizeNs, buckets[0].mBucketEndNs);
-    EXPECT_EQ(endTimeNs - startTimeNs, buckets[0].mDuration);
-}
-
-TEST(DurationMetricTrackerTest, TestMaxDurationWithUpgradeInNextBucket) {
-    int64_t bucketStartTimeNs = 10000000000;
-    int64_t bucketSizeNs = TimeUnitToBucketSizeInMillis(ONE_MINUTE) * 1000000LL;
-    int64_t eventUpgradeTimeNs = bucketStartTimeNs + 65 * NS_PER_SEC;
-    int64_t startTimeNs = bucketStartTimeNs + 1;
-    int64_t endTimeNs = startTimeNs + 115 * NS_PER_SEC;
-
-    int tagId = 1;
-
-    DurationMetric metric;
-    metric.set_id(1);
-    metric.set_bucket(ONE_MINUTE);
-    metric.set_aggregation_type(DurationMetric_AggregationType_MAX_SPARSE);
-    LogEvent event1(tagId, startTimeNs);
-    event1.write("111");  // uid
-    event1.init();
-    sp<MockConditionWizard> wizard = new NaggyMock<MockConditionWizard>();
-    FieldMatcher dimensions;
-    DurationMetricProducer durationProducer(
-            kConfigKey, metric, -1 /* no condition */, 1 /* start index */, 2 /* stop index */,
-            3 /* stop_all index */, false /*nesting*/, wizard, dimensions, bucketStartTimeNs, bucketStartTimeNs);
-
-    LogEvent start_event(tagId, startTimeNs);
-    start_event.init();
-    durationProducer.onMatchedLogEvent(1 /* start index*/, start_event);
-    EXPECT_EQ(0UL, durationProducer.mPastBuckets.size());
-    EXPECT_EQ(bucketStartTimeNs, durationProducer.mCurrentBucketStartTimeNs);
-
-    durationProducer.notifyAppUpgrade(eventUpgradeTimeNs, "ANY.APP", 1, 1);
-    EXPECT_EQ(0UL, durationProducer.mPastBuckets[DEFAULT_METRIC_DIMENSION_KEY].size());
-    EXPECT_EQ(eventUpgradeTimeNs, durationProducer.mCurrentBucketStartTimeNs);
-
-    // Stop occurs in the same partial bucket as created for the app upgrade.
-    LogEvent end_event(tagId, endTimeNs);
-    end_event.init();
-    durationProducer.onMatchedLogEvent(2 /* stop index*/, end_event);
-    EXPECT_EQ(0UL, durationProducer.mPastBuckets[DEFAULT_METRIC_DIMENSION_KEY].size());
-    EXPECT_EQ(eventUpgradeTimeNs, durationProducer.mCurrentBucketStartTimeNs);
-
-    durationProducer.flushIfNeededLocked(bucketStartTimeNs + 2 * bucketSizeNs + 1);
-    std::vector<DurationBucket> buckets =
-            durationProducer.mPastBuckets[DEFAULT_METRIC_DIMENSION_KEY];
-    EXPECT_EQ(1UL, buckets.size());
-    EXPECT_EQ(eventUpgradeTimeNs, buckets[0].mBucketStartNs);
-    EXPECT_EQ(bucketStartTimeNs + 2 * bucketSizeNs, buckets[0].mBucketEndNs);
-    EXPECT_EQ(endTimeNs - startTimeNs, buckets[0].mDuration);
-}
+// TODO(b/149590301): Update these to use new socket schema.
+//TEST(DurationMetricTrackerTest, TestNoCondition) {
+//    sp<MockConditionWizard> wizard = new NaggyMock<MockConditionWizard>();
+//    int64_t bucketStartTimeNs = 10000000000;
+//    int64_t bucketSizeNs = TimeUnitToBucketSizeInMillis(ONE_MINUTE) * 1000000LL;
+//
+//    DurationMetric metric;
+//    metric.set_id(1);
+//    metric.set_bucket(ONE_MINUTE);
+//    metric.set_aggregation_type(DurationMetric_AggregationType_SUM);
+//
+//    int tagId = 1;
+//    LogEvent event1(tagId, bucketStartTimeNs + 1);
+//    event1.init();
+//    LogEvent event2(tagId, bucketStartTimeNs + bucketSizeNs + 2);
+//    event2.init();
+//
+//    FieldMatcher dimensions;
+//    DurationMetricProducer durationProducer(
+//            kConfigKey, metric, -1 /*no condition*/, 1 /* start index */, 2 /* stop index */,
+//            3 /* stop_all index */, false /*nesting*/, wizard, dimensions, bucketStartTimeNs, bucketStartTimeNs);
+//
+//    durationProducer.onMatchedLogEvent(1 /* start index*/, event1);
+//    durationProducer.onMatchedLogEvent(2 /* stop index*/, event2);
+//    durationProducer.flushIfNeededLocked(bucketStartTimeNs + 2 * bucketSizeNs + 1);
+//    EXPECT_EQ(1UL, durationProducer.mPastBuckets.size());
+//    EXPECT_TRUE(durationProducer.mPastBuckets.find(DEFAULT_METRIC_DIMENSION_KEY) !=
+//                durationProducer.mPastBuckets.end());
+//    const auto& buckets = durationProducer.mPastBuckets[DEFAULT_METRIC_DIMENSION_KEY];
+//    EXPECT_EQ(2UL, buckets.size());
+//    EXPECT_EQ(bucketStartTimeNs, buckets[0].mBucketStartNs);
+//    EXPECT_EQ(bucketStartTimeNs + bucketSizeNs, buckets[0].mBucketEndNs);
+//    EXPECT_EQ(bucketSizeNs - 1LL, buckets[0].mDuration);
+//    EXPECT_EQ(bucketStartTimeNs + bucketSizeNs, buckets[1].mBucketStartNs);
+//    EXPECT_EQ(bucketStartTimeNs + 2 * bucketSizeNs, buckets[1].mBucketEndNs);
+//    EXPECT_EQ(2LL, buckets[1].mDuration);
+//}
+//
+//TEST(DurationMetricTrackerTest, TestNonSlicedCondition) {
+//    sp<MockConditionWizard> wizard = new NaggyMock<MockConditionWizard>();
+//    int64_t bucketStartTimeNs = 10000000000;
+//    int64_t bucketSizeNs = TimeUnitToBucketSizeInMillis(ONE_MINUTE) * 1000000LL;
+//
+//    DurationMetric metric;
+//    metric.set_id(1);
+//    metric.set_bucket(ONE_MINUTE);
+//    metric.set_aggregation_type(DurationMetric_AggregationType_SUM);
+//
+//    int tagId = 1;
+//    LogEvent event1(tagId, bucketStartTimeNs + 1);
+//    event1.init();
+//    LogEvent event2(tagId, bucketStartTimeNs + 2);
+//    event2.init();
+//    LogEvent event3(tagId, bucketStartTimeNs + bucketSizeNs + 1);
+//    event3.init();
+//    LogEvent event4(tagId, bucketStartTimeNs + bucketSizeNs + 3);
+//    event4.init();
+//
+//    FieldMatcher dimensions;
+//    DurationMetricProducer durationProducer(
+//            kConfigKey, metric, 0 /* condition index */, 1 /* start index */, 2 /* stop index */,
+//            3 /* stop_all index */, false /*nesting*/, wizard, dimensions, bucketStartTimeNs, bucketStartTimeNs);
+//    durationProducer.mCondition = ConditionState::kFalse;
+//
+//    EXPECT_FALSE(durationProducer.mCondition);
+//    EXPECT_FALSE(durationProducer.isConditionSliced());
+//
+//    durationProducer.onMatchedLogEvent(1 /* start index*/, event1);
+//    durationProducer.onMatchedLogEvent(2 /* stop index*/, event2);
+//    durationProducer.flushIfNeededLocked(bucketStartTimeNs + bucketSizeNs + 1);
+//    EXPECT_EQ(0UL, durationProducer.mPastBuckets.size());
+//
+//    durationProducer.onMatchedLogEvent(1 /* start index*/, event3);
+//    durationProducer.onConditionChanged(true /* condition */, bucketStartTimeNs + bucketSizeNs + 2);
+//    durationProducer.onMatchedLogEvent(2 /* stop index*/, event4);
+//    durationProducer.flushIfNeededLocked(bucketStartTimeNs + 2 * bucketSizeNs + 1);
+//    EXPECT_EQ(1UL, durationProducer.mPastBuckets.size());
+//    EXPECT_TRUE(durationProducer.mPastBuckets.find(DEFAULT_METRIC_DIMENSION_KEY) !=
+//                durationProducer.mPastBuckets.end());
+//    const auto& buckets2 = durationProducer.mPastBuckets[DEFAULT_METRIC_DIMENSION_KEY];
+//    EXPECT_EQ(1UL, buckets2.size());
+//    EXPECT_EQ(bucketStartTimeNs + bucketSizeNs, buckets2[0].mBucketStartNs);
+//    EXPECT_EQ(bucketStartTimeNs + 2 * bucketSizeNs, buckets2[0].mBucketEndNs);
+//    EXPECT_EQ(1LL, buckets2[0].mDuration);
+//}
+//
+//TEST(DurationMetricTrackerTest, TestNonSlicedConditionUnknownState) {
+//    sp<MockConditionWizard> wizard = new NaggyMock<MockConditionWizard>();
+//    int64_t bucketStartTimeNs = 10000000000;
+//    int64_t bucketSizeNs = TimeUnitToBucketSizeInMillis(ONE_MINUTE) * 1000000LL;
+//
+//    DurationMetric metric;
+//    metric.set_id(1);
+//    metric.set_bucket(ONE_MINUTE);
+//    metric.set_aggregation_type(DurationMetric_AggregationType_SUM);
+//
+//    int tagId = 1;
+//    LogEvent event1(tagId, bucketStartTimeNs + 1);
+//    event1.init();
+//    LogEvent event2(tagId, bucketStartTimeNs + 2);
+//    event2.init();
+//    LogEvent event3(tagId, bucketStartTimeNs + bucketSizeNs + 1);
+//    event3.init();
+//    LogEvent event4(tagId, bucketStartTimeNs + bucketSizeNs + 3);
+//    event4.init();
+//
+//    FieldMatcher dimensions;
+//    DurationMetricProducer durationProducer(
+//            kConfigKey, metric, 0 /* condition index */, 1 /* start index */, 2 /* stop index */,
+//            3 /* stop_all index */, false /*nesting*/, wizard, dimensions, bucketStartTimeNs, bucketStartTimeNs);
+//
+//    EXPECT_EQ(ConditionState::kUnknown, durationProducer.mCondition);
+//    EXPECT_FALSE(durationProducer.isConditionSliced());
+//
+//    durationProducer.onMatchedLogEvent(1 /* start index*/, event1);
+//    durationProducer.onMatchedLogEvent(2 /* stop index*/, event2);
+//    durationProducer.flushIfNeededLocked(bucketStartTimeNs + bucketSizeNs + 1);
+//    EXPECT_EQ(0UL, durationProducer.mPastBuckets.size());
+//
+//    durationProducer.onMatchedLogEvent(1 /* start index*/, event3);
+//    durationProducer.onConditionChanged(true /* condition */, bucketStartTimeNs + bucketSizeNs + 2);
+//    durationProducer.onMatchedLogEvent(2 /* stop index*/, event4);
+//    durationProducer.flushIfNeededLocked(bucketStartTimeNs + 2 * bucketSizeNs + 1);
+//    EXPECT_EQ(1UL, durationProducer.mPastBuckets.size());
+//    const auto& buckets2 = durationProducer.mPastBuckets[DEFAULT_METRIC_DIMENSION_KEY];
+//    EXPECT_EQ(1UL, buckets2.size());
+//    EXPECT_EQ(bucketStartTimeNs + bucketSizeNs, buckets2[0].mBucketStartNs);
+//    EXPECT_EQ(bucketStartTimeNs + 2 * bucketSizeNs, buckets2[0].mBucketEndNs);
+//    EXPECT_EQ(1LL, buckets2[0].mDuration);
+//}
+//
+//TEST(DurationMetricTrackerTest, TestSumDurationWithUpgrade) {
+//    /**
+//     * The duration starts from the first bucket, through the two partial buckets (10-70sec),
+//     * another bucket, and ends at the beginning of the next full bucket.
+//     * Expected buckets:
+//     *  - [10,25]: 14 secs
+//     *  - [25,70]: All 45 secs
+//     *  - [70,130]: All 60 secs
+//     *  - [130, 210]: Only 5 secs (event ended at 135sec)
+//     */
+//    int64_t bucketStartTimeNs = 10000000000;
+//    int64_t bucketSizeNs = TimeUnitToBucketSizeInMillis(ONE_MINUTE) * 1000000LL;
+//    int64_t eventUpgradeTimeNs = bucketStartTimeNs + 15 * NS_PER_SEC;
+//    int64_t startTimeNs = bucketStartTimeNs + 1 * NS_PER_SEC;
+//    int64_t endTimeNs = startTimeNs + 125 * NS_PER_SEC;
+//
+//    int tagId = 1;
+//
+//    DurationMetric metric;
+//    metric.set_id(1);
+//    metric.set_bucket(ONE_MINUTE);
+//    metric.set_aggregation_type(DurationMetric_AggregationType_SUM);
+//    sp<MockConditionWizard> wizard = new NaggyMock<MockConditionWizard>();
+//    FieldMatcher dimensions;
+//    DurationMetricProducer durationProducer(
+//            kConfigKey, metric, -1 /* no condition */, 1 /* start index */, 2 /* stop index */,
+//            3 /* stop_all index */, false /*nesting*/, wizard, dimensions, bucketStartTimeNs, bucketStartTimeNs);
+//
+//    LogEvent start_event(tagId, startTimeNs);
+//    start_event.init();
+//    durationProducer.onMatchedLogEvent(1 /* start index*/, start_event);
+//    EXPECT_EQ(0UL, durationProducer.mPastBuckets.size());
+//    EXPECT_EQ(bucketStartTimeNs, durationProducer.mCurrentBucketStartTimeNs);
+//
+//    durationProducer.notifyAppUpgrade(eventUpgradeTimeNs, "ANY.APP", 1, 1);
+//    EXPECT_EQ(1UL, durationProducer.mPastBuckets[DEFAULT_METRIC_DIMENSION_KEY].size());
+//    std::vector<DurationBucket> buckets =
+//            durationProducer.mPastBuckets[DEFAULT_METRIC_DIMENSION_KEY];
+//    EXPECT_EQ(bucketStartTimeNs, buckets[0].mBucketStartNs);
+//    EXPECT_EQ(eventUpgradeTimeNs, buckets[0].mBucketEndNs);
+//    EXPECT_EQ(eventUpgradeTimeNs - startTimeNs, buckets[0].mDuration);
+//    EXPECT_EQ(eventUpgradeTimeNs, durationProducer.mCurrentBucketStartTimeNs);
+//
+//    // We skip ahead one bucket, so we fill in the first two partial buckets and one full bucket.
+//    LogEvent end_event(tagId, endTimeNs);
+//    end_event.init();
+//    durationProducer.onMatchedLogEvent(2 /* stop index*/, end_event);
+//    buckets = durationProducer.mPastBuckets[DEFAULT_METRIC_DIMENSION_KEY];
+//    EXPECT_EQ(3UL, buckets.size());
+//    EXPECT_EQ(eventUpgradeTimeNs, buckets[1].mBucketStartNs);
+//    EXPECT_EQ(bucketStartTimeNs + bucketSizeNs, buckets[1].mBucketEndNs);
+//    EXPECT_EQ(bucketStartTimeNs + bucketSizeNs - eventUpgradeTimeNs, buckets[1].mDuration);
+//    EXPECT_EQ(bucketStartTimeNs + bucketSizeNs, buckets[2].mBucketStartNs);
+//    EXPECT_EQ(bucketStartTimeNs + 2 * bucketSizeNs, buckets[2].mBucketEndNs);
+//    EXPECT_EQ(bucketSizeNs, buckets[2].mDuration);
+//}
+//
+//TEST(DurationMetricTrackerTest, TestSumDurationWithUpgradeInFollowingBucket) {
+//    /**
+//     * Expected buckets (start at 11s, upgrade at 75s, end at 135s):
+//     *  - [10,70]: 59 secs
+//     *  - [70,75]: 5 sec
+//     *  - [75,130]: 55 secs
+//     */
+//    int64_t bucketStartTimeNs = 10000000000;
+//    int64_t bucketSizeNs = TimeUnitToBucketSizeInMillis(ONE_MINUTE) * 1000000LL;
+//    int64_t eventUpgradeTimeNs = bucketStartTimeNs + 65 * NS_PER_SEC;
+//    int64_t startTimeNs = bucketStartTimeNs + 1 * NS_PER_SEC;
+//    int64_t endTimeNs = startTimeNs + 125 * NS_PER_SEC;
+//
+//    int tagId = 1;
+//
+//    DurationMetric metric;
+//    metric.set_id(1);
+//    metric.set_bucket(ONE_MINUTE);
+//    metric.set_aggregation_type(DurationMetric_AggregationType_SUM);
+//    sp<MockConditionWizard> wizard = new NaggyMock<MockConditionWizard>();
+//    FieldMatcher dimensions;
+//    DurationMetricProducer durationProducer(
+//            kConfigKey, metric, -1 /* no condition */, 1 /* start index */, 2 /* stop index */,
+//            3 /* stop_all index */, false /*nesting*/, wizard, dimensions, bucketStartTimeNs, bucketStartTimeNs);
+//
+//    LogEvent start_event(tagId, startTimeNs);
+//    start_event.init();
+//    durationProducer.onMatchedLogEvent(1 /* start index*/, start_event);
+//    EXPECT_EQ(0UL, durationProducer.mPastBuckets.size());
+//    EXPECT_EQ(bucketStartTimeNs, durationProducer.mCurrentBucketStartTimeNs);
+//
+//    durationProducer.notifyAppUpgrade(eventUpgradeTimeNs, "ANY.APP", 1, 1);
+//    EXPECT_EQ(2UL, durationProducer.mPastBuckets[DEFAULT_METRIC_DIMENSION_KEY].size());
+//    std::vector<DurationBucket> buckets =
+//            durationProducer.mPastBuckets[DEFAULT_METRIC_DIMENSION_KEY];
+//    EXPECT_EQ(bucketStartTimeNs, buckets[0].mBucketStartNs);
+//    EXPECT_EQ(bucketStartTimeNs + bucketSizeNs, buckets[0].mBucketEndNs);
+//    EXPECT_EQ(bucketStartTimeNs + bucketSizeNs - startTimeNs, buckets[0].mDuration);
+//    EXPECT_EQ(bucketStartTimeNs + bucketSizeNs, buckets[1].mBucketStartNs);
+//    EXPECT_EQ(eventUpgradeTimeNs, buckets[1].mBucketEndNs);
+//    EXPECT_EQ(eventUpgradeTimeNs - (bucketStartTimeNs + bucketSizeNs), buckets[1].mDuration);
+//    EXPECT_EQ(eventUpgradeTimeNs, durationProducer.mCurrentBucketStartTimeNs);
+//
+//    // We skip ahead one bucket, so we fill in the first two partial buckets and one full bucket.
+//    LogEvent end_event(tagId, endTimeNs);
+//    end_event.init();
+//    durationProducer.onMatchedLogEvent(2 /* stop index*/, end_event);
+//    buckets = durationProducer.mPastBuckets[DEFAULT_METRIC_DIMENSION_KEY];
+//    EXPECT_EQ(3UL, buckets.size());
+//    EXPECT_EQ(eventUpgradeTimeNs, buckets[2].mBucketStartNs);
+//    EXPECT_EQ(bucketStartTimeNs + 2 * bucketSizeNs, buckets[2].mBucketEndNs);
+//    EXPECT_EQ(bucketStartTimeNs + 2 * bucketSizeNs - eventUpgradeTimeNs, buckets[2].mDuration);
+//}
+//
+//TEST(DurationMetricTrackerTest, TestSumDurationAnomalyWithUpgrade) {
+//    sp<AlarmMonitor> alarmMonitor;
+//    int64_t bucketStartTimeNs = 10000000000;
+//    int64_t bucketSizeNs = TimeUnitToBucketSizeInMillis(ONE_MINUTE) * 1000000LL;
+//    int64_t eventUpgradeTimeNs = bucketStartTimeNs + 15 * NS_PER_SEC;
+//    int64_t startTimeNs = bucketStartTimeNs + 1;
+//    int64_t endTimeNs = startTimeNs + 65 * NS_PER_SEC;
+//
+//    int tagId = 1;
+//
+//    // Setup metric with alert.
+//    DurationMetric metric;
+//    metric.set_id(1);
+//    metric.set_bucket(ONE_MINUTE);
+//    metric.set_aggregation_type(DurationMetric_AggregationType_SUM);
+//    Alert alert;
+//    alert.set_num_buckets(3);
+//    alert.set_trigger_if_sum_gt(2);
+//
+//    sp<MockConditionWizard> wizard = new NaggyMock<MockConditionWizard>();
+//    FieldMatcher dimensions;
+//    DurationMetricProducer durationProducer(
+//            kConfigKey, metric, -1 /* no condition */, 1 /* start index */, 2 /* stop index */,
+//            3 /* stop_all index */, false /*nesting*/, wizard, dimensions, bucketStartTimeNs, bucketStartTimeNs);
+//
+//    sp<AnomalyTracker> anomalyTracker = durationProducer.addAnomalyTracker(alert, alarmMonitor);
+//    EXPECT_TRUE(anomalyTracker != nullptr);
+//
+//    LogEvent start_event(tagId, startTimeNs);
+//    start_event.init();
+//    durationProducer.onMatchedLogEvent(1 /* start index*/, start_event);
+//    durationProducer.notifyAppUpgrade(eventUpgradeTimeNs, "ANY.APP", 1, 1);
+//    // We skip ahead one bucket, so we fill in the first two partial buckets and one full bucket.
+//    LogEvent end_event(tagId, endTimeNs);
+//    end_event.init();
+//    durationProducer.onMatchedLogEvent(2 /* stop index*/, end_event);
+//
+//    EXPECT_EQ(bucketStartTimeNs + bucketSizeNs - startTimeNs,
+//              anomalyTracker->getSumOverPastBuckets(DEFAULT_METRIC_DIMENSION_KEY));
+//}
+//
+//TEST(DurationMetricTrackerTest, TestMaxDurationWithUpgrade) {
+//    int64_t bucketStartTimeNs = 10000000000;
+//    int64_t bucketSizeNs = TimeUnitToBucketSizeInMillis(ONE_MINUTE) * 1000000LL;
+//    int64_t eventUpgradeTimeNs = bucketStartTimeNs + 15 * NS_PER_SEC;
+//    int64_t startTimeNs = bucketStartTimeNs + 1;
+//    int64_t endTimeNs = startTimeNs + 125 * NS_PER_SEC;
+//
+//    int tagId = 1;
+//
+//    DurationMetric metric;
+//    metric.set_id(1);
+//    metric.set_bucket(ONE_MINUTE);
+//    metric.set_aggregation_type(DurationMetric_AggregationType_MAX_SPARSE);
+//    LogEvent event1(tagId, startTimeNs);
+//    event1.write("111");  // uid
+//    event1.init();
+//    sp<MockConditionWizard> wizard = new NaggyMock<MockConditionWizard>();
+//    FieldMatcher dimensions;
+//    DurationMetricProducer durationProducer(
+//            kConfigKey, metric, -1 /* no condition */, 1 /* start index */, 2 /* stop index */,
+//            3 /* stop_all index */, false /*nesting*/, wizard, dimensions, bucketStartTimeNs, bucketStartTimeNs);
+//
+//    LogEvent start_event(tagId, startTimeNs);
+//    start_event.init();
+//    durationProducer.onMatchedLogEvent(1 /* start index*/, start_event);
+//    EXPECT_EQ(0UL, durationProducer.mPastBuckets.size());
+//    EXPECT_EQ(bucketStartTimeNs, durationProducer.mCurrentBucketStartTimeNs);
+//
+//    durationProducer.notifyAppUpgrade(eventUpgradeTimeNs, "ANY.APP", 1, 1);
+//    EXPECT_EQ(0UL, durationProducer.mPastBuckets[DEFAULT_METRIC_DIMENSION_KEY].size());
+//    EXPECT_EQ(eventUpgradeTimeNs, durationProducer.mCurrentBucketStartTimeNs);
+//
+//    // We skip ahead one bucket, so we fill in the first two partial buckets and one full bucket.
+//    LogEvent end_event(tagId, endTimeNs);
+//    end_event.init();
+//    durationProducer.onMatchedLogEvent(2 /* stop index*/, end_event);
+//    EXPECT_EQ(0UL, durationProducer.mPastBuckets[DEFAULT_METRIC_DIMENSION_KEY].size());
+//
+//    durationProducer.flushIfNeededLocked(bucketStartTimeNs + 3 * bucketSizeNs + 1);
+//    std::vector<DurationBucket> buckets =
+//            durationProducer.mPastBuckets[DEFAULT_METRIC_DIMENSION_KEY];
+//    EXPECT_EQ(1UL, buckets.size());
+//    EXPECT_EQ(bucketStartTimeNs + 2 * bucketSizeNs, buckets[0].mBucketStartNs);
+//    EXPECT_EQ(bucketStartTimeNs + 3 * bucketSizeNs, buckets[0].mBucketEndNs);
+//    EXPECT_EQ(endTimeNs - startTimeNs, buckets[0].mDuration);
+//}
+//
+//TEST(DurationMetricTrackerTest, TestMaxDurationWithUpgradeInNextBucket) {
+//    int64_t bucketStartTimeNs = 10000000000;
+//    int64_t bucketSizeNs = TimeUnitToBucketSizeInMillis(ONE_MINUTE) * 1000000LL;
+//    int64_t eventUpgradeTimeNs = bucketStartTimeNs + 65 * NS_PER_SEC;
+//    int64_t startTimeNs = bucketStartTimeNs + 1;
+//    int64_t endTimeNs = startTimeNs + 115 * NS_PER_SEC;
+//
+//    int tagId = 1;
+//
+//    DurationMetric metric;
+//    metric.set_id(1);
+//    metric.set_bucket(ONE_MINUTE);
+//    metric.set_aggregation_type(DurationMetric_AggregationType_MAX_SPARSE);
+//    LogEvent event1(tagId, startTimeNs);
+//    event1.write("111");  // uid
+//    event1.init();
+//    sp<MockConditionWizard> wizard = new NaggyMock<MockConditionWizard>();
+//    FieldMatcher dimensions;
+//    DurationMetricProducer durationProducer(
+//            kConfigKey, metric, -1 /* no condition */, 1 /* start index */, 2 /* stop index */,
+//            3 /* stop_all index */, false /*nesting*/, wizard, dimensions, bucketStartTimeNs, bucketStartTimeNs);
+//
+//    LogEvent start_event(tagId, startTimeNs);
+//    start_event.init();
+//    durationProducer.onMatchedLogEvent(1 /* start index*/, start_event);
+//    EXPECT_EQ(0UL, durationProducer.mPastBuckets.size());
+//    EXPECT_EQ(bucketStartTimeNs, durationProducer.mCurrentBucketStartTimeNs);
+//
+//    durationProducer.notifyAppUpgrade(eventUpgradeTimeNs, "ANY.APP", 1, 1);
+//    EXPECT_EQ(0UL, durationProducer.mPastBuckets[DEFAULT_METRIC_DIMENSION_KEY].size());
+//    EXPECT_EQ(eventUpgradeTimeNs, durationProducer.mCurrentBucketStartTimeNs);
+//
+//    // Stop occurs in the same partial bucket as created for the app upgrade.
+//    LogEvent end_event(tagId, endTimeNs);
+//    end_event.init();
+//    durationProducer.onMatchedLogEvent(2 /* stop index*/, end_event);
+//    EXPECT_EQ(0UL, durationProducer.mPastBuckets[DEFAULT_METRIC_DIMENSION_KEY].size());
+//    EXPECT_EQ(eventUpgradeTimeNs, durationProducer.mCurrentBucketStartTimeNs);
+//
+//    durationProducer.flushIfNeededLocked(bucketStartTimeNs + 2 * bucketSizeNs + 1);
+//    std::vector<DurationBucket> buckets =
+//            durationProducer.mPastBuckets[DEFAULT_METRIC_DIMENSION_KEY];
+//    EXPECT_EQ(1UL, buckets.size());
+//    EXPECT_EQ(eventUpgradeTimeNs, buckets[0].mBucketStartNs);
+//    EXPECT_EQ(bucketStartTimeNs + 2 * bucketSizeNs, buckets[0].mBucketEndNs);
+//    EXPECT_EQ(endTimeNs - startTimeNs, buckets[0].mDuration);
+//}
 
 }  // namespace statsd
 }  // namespace os
diff --git a/cmds/statsd/tests/metrics/EventMetricProducer_test.cpp b/cmds/statsd/tests/metrics/EventMetricProducer_test.cpp
index f30873b..0f39efd5 100644
--- a/cmds/statsd/tests/metrics/EventMetricProducer_test.cpp
+++ b/cmds/statsd/tests/metrics/EventMetricProducer_test.cpp
@@ -85,46 +85,47 @@
     // eventProducer.onDumpReport();
 }
 
-TEST(EventMetricProducerTest, TestEventsWithSlicedCondition) {
-    int64_t bucketStartTimeNs = 10000000000;
-    int64_t bucketSizeNs = 30 * 1000 * 1000 * 1000LL;
-
-    int tagId = 1;
-    int conditionTagId = 2;
-
-    EventMetric metric;
-    metric.set_id(1);
-    metric.set_condition(StringToId("APP_IN_BACKGROUND_PER_UID_AND_SCREEN_ON"));
-    MetricConditionLink* link = metric.add_links();
-    link->set_condition(StringToId("APP_IN_BACKGROUND_PER_UID"));
-    buildSimpleAtomFieldMatcher(tagId, 1, link->mutable_fields_in_what());
-    buildSimpleAtomFieldMatcher(conditionTagId, 2, link->mutable_fields_in_condition());
-
-    LogEvent event1(tagId, bucketStartTimeNs + 1);
-    EXPECT_TRUE(event1.write("111"));
-    event1.init();
-    ConditionKey key1;
-    key1[StringToId("APP_IN_BACKGROUND_PER_UID")] = {getMockedDimensionKey(conditionTagId, 2, "111")};
-
-    LogEvent event2(tagId, bucketStartTimeNs + 10);
-    EXPECT_TRUE(event2.write("222"));
-    event2.init();
-    ConditionKey key2;
-    key2[StringToId("APP_IN_BACKGROUND_PER_UID")] = {getMockedDimensionKey(conditionTagId, 2, "222")};
-
-    sp<MockConditionWizard> wizard = new NaggyMock<MockConditionWizard>();
-    EXPECT_CALL(*wizard, query(_, key1, _)).WillOnce(Return(ConditionState::kFalse));
-
-    EXPECT_CALL(*wizard, query(_, key2, _)).WillOnce(Return(ConditionState::kTrue));
-
-    EventMetricProducer eventProducer(kConfigKey, metric, 1, wizard, bucketStartTimeNs);
-
-    eventProducer.onMatchedLogEvent(1 /*matcher index*/, event1);
-    eventProducer.onMatchedLogEvent(1 /*matcher index*/, event2);
-
-    // TODO: get the report and check the content after the ProtoOutputStream change is done.
-    // eventProducer.onDumpReport();
-}
+// TODO(b/149590301): Update this test to use new socket schema.
+//TEST(EventMetricProducerTest, TestEventsWithSlicedCondition) {
+//    int64_t bucketStartTimeNs = 10000000000;
+//    int64_t bucketSizeNs = 30 * 1000 * 1000 * 1000LL;
+//
+//    int tagId = 1;
+//    int conditionTagId = 2;
+//
+//    EventMetric metric;
+//    metric.set_id(1);
+//    metric.set_condition(StringToId("APP_IN_BACKGROUND_PER_UID_AND_SCREEN_ON"));
+//    MetricConditionLink* link = metric.add_links();
+//    link->set_condition(StringToId("APP_IN_BACKGROUND_PER_UID"));
+//    buildSimpleAtomFieldMatcher(tagId, 1, link->mutable_fields_in_what());
+//    buildSimpleAtomFieldMatcher(conditionTagId, 2, link->mutable_fields_in_condition());
+//
+//    LogEvent event1(tagId, bucketStartTimeNs + 1);
+//    EXPECT_TRUE(event1.write("111"));
+//    event1.init();
+//    ConditionKey key1;
+//    key1[StringToId("APP_IN_BACKGROUND_PER_UID")] = {getMockedDimensionKey(conditionTagId, 2, "111")};
+//
+//    LogEvent event2(tagId, bucketStartTimeNs + 10);
+//    EXPECT_TRUE(event2.write("222"));
+//    event2.init();
+//    ConditionKey key2;
+//    key2[StringToId("APP_IN_BACKGROUND_PER_UID")] = {getMockedDimensionKey(conditionTagId, 2, "222")};
+//
+//    sp<MockConditionWizard> wizard = new NaggyMock<MockConditionWizard>();
+//    EXPECT_CALL(*wizard, query(_, key1, _)).WillOnce(Return(ConditionState::kFalse));
+//
+//    EXPECT_CALL(*wizard, query(_, key2, _)).WillOnce(Return(ConditionState::kTrue));
+//
+//    EventMetricProducer eventProducer(kConfigKey, metric, 1, wizard, bucketStartTimeNs);
+//
+//    eventProducer.onMatchedLogEvent(1 /*matcher index*/, event1);
+//    eventProducer.onMatchedLogEvent(1 /*matcher index*/, event2);
+//
+//    // TODO: get the report and check the content after the ProtoOutputStream change is done.
+//    // eventProducer.onDumpReport();
+//}
 
 }  // namespace statsd
 }  // namespace os
diff --git a/cmds/statsd/tests/metrics/GaugeMetricProducer_test.cpp b/cmds/statsd/tests/metrics/GaugeMetricProducer_test.cpp
index 308c43d..609324e 100644
--- a/cmds/statsd/tests/metrics/GaugeMetricProducer_test.cpp
+++ b/cmds/statsd/tests/metrics/GaugeMetricProducer_test.cpp
@@ -88,768 +88,769 @@
     EXPECT_EQ(660000000005, gaugeProducer.getCurrentBucketEndTimeNs());
 }
 
-TEST(GaugeMetricProducerTest, TestPulledEventsNoCondition) {
-    GaugeMetric metric;
-    metric.set_id(metricId);
-    metric.set_bucket(ONE_MINUTE);
-    metric.mutable_gauge_fields_filter()->set_include_all(false);
-    metric.set_max_pull_delay_sec(INT_MAX);
-    auto gaugeFieldMatcher = metric.mutable_gauge_fields_filter()->mutable_fields();
-    gaugeFieldMatcher->set_field(tagId);
-    gaugeFieldMatcher->add_child()->set_field(1);
-    gaugeFieldMatcher->add_child()->set_field(3);
-
-    sp<MockConditionWizard> wizard = new NaggyMock<MockConditionWizard>();
-
-    UidMap uidMap;
-    SimpleAtomMatcher atomMatcher;
-    atomMatcher.set_atom_id(tagId);
-    sp<EventMatcherWizard> eventMatcherWizard = new EventMatcherWizard({
-        new SimpleLogMatchingTracker(atomMatcherId, logEventMatcherIndex, atomMatcher, uidMap)});
-
-    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
-    EXPECT_CALL(*pullerManager, RegisterReceiver(tagId, _, _, _)).WillOnce(Return());
-    EXPECT_CALL(*pullerManager, UnRegisterReceiver(tagId, _)).WillOnce(Return());
-    EXPECT_CALL(*pullerManager, Pull(tagId, _))
-            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
-                data->clear();
-                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucketStartTimeNs + 10);
-                event->write(3);
-                event->write("some value");
-                event->write(11);
-                event->init();
-                data->push_back(event);
-                return true;
-            }));
-
-    GaugeMetricProducer gaugeProducer(kConfigKey, metric, -1 /*-1 meaning no condition*/, wizard,
-                                      logEventMatcherIndex, eventMatcherWizard,
-                                      tagId, -1, tagId, bucketStartTimeNs, bucketStartTimeNs,
-                                      pullerManager);
-
-    vector<shared_ptr<LogEvent>> allData;
-    allData.clear();
-    shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucket2StartTimeNs + 1);
-    event->write(10);
-    event->write("some value");
-    event->write(11);
-    event->init();
-    allData.push_back(event);
-
-    gaugeProducer.onDataPulled(allData, /** succeed */ true, bucket2StartTimeNs);
-    EXPECT_EQ(1UL, gaugeProducer.mCurrentSlicedBucket->size());
-    auto it = gaugeProducer.mCurrentSlicedBucket->begin()->second.front().mFields->begin();
-    EXPECT_EQ(INT, it->mValue.getType());
-    EXPECT_EQ(10, it->mValue.int_value);
-    it++;
-    EXPECT_EQ(11, it->mValue.int_value);
-    EXPECT_EQ(1UL, gaugeProducer.mPastBuckets.size());
-    EXPECT_EQ(3, gaugeProducer.mPastBuckets.begin()->second.back().mGaugeAtoms
-        .front().mFields->begin()->mValue.int_value);
-
-    allData.clear();
-    std::shared_ptr<LogEvent> event2 = std::make_shared<LogEvent>(tagId, bucket3StartTimeNs + 10);
-    event2->write(24);
-    event2->write("some value");
-    event2->write(25);
-    event2->init();
-    allData.push_back(event2);
-    gaugeProducer.onDataPulled(allData, /** succeed */ true, bucket3StartTimeNs);
-    EXPECT_EQ(1UL, gaugeProducer.mCurrentSlicedBucket->size());
-    it = gaugeProducer.mCurrentSlicedBucket->begin()->second.front().mFields->begin();
-    EXPECT_EQ(INT, it->mValue.getType());
-    EXPECT_EQ(24, it->mValue.int_value);
-    it++;
-    EXPECT_EQ(INT, it->mValue.getType());
-    EXPECT_EQ(25, it->mValue.int_value);
-    // One dimension.
-    EXPECT_EQ(1UL, gaugeProducer.mPastBuckets.size());
-    EXPECT_EQ(2UL, gaugeProducer.mPastBuckets.begin()->second.size());
-    it = gaugeProducer.mPastBuckets.begin()->second.back().mGaugeAtoms.front().mFields->begin();
-    EXPECT_EQ(INT, it->mValue.getType());
-    EXPECT_EQ(10L, it->mValue.int_value);
-    it++;
-    EXPECT_EQ(INT, it->mValue.getType());
-    EXPECT_EQ(11L, it->mValue.int_value);
-
-    gaugeProducer.flushIfNeededLocked(bucket4StartTimeNs);
-    EXPECT_EQ(0UL, gaugeProducer.mCurrentSlicedBucket->size());
-    // One dimension.
-    EXPECT_EQ(1UL, gaugeProducer.mPastBuckets.size());
-    EXPECT_EQ(3UL, gaugeProducer.mPastBuckets.begin()->second.size());
-    it = gaugeProducer.mPastBuckets.begin()->second.back().mGaugeAtoms.front().mFields->begin();
-    EXPECT_EQ(INT, it->mValue.getType());
-    EXPECT_EQ(24L, it->mValue.int_value);
-    it++;
-    EXPECT_EQ(INT, it->mValue.getType());
-    EXPECT_EQ(25L, it->mValue.int_value);
-}
-
-TEST(GaugeMetricProducerTest, TestPushedEventsWithUpgrade) {
-    sp<AlarmMonitor> alarmMonitor;
-    GaugeMetric metric;
-    metric.set_id(metricId);
-    metric.set_bucket(ONE_MINUTE);
-    metric.mutable_gauge_fields_filter()->set_include_all(true);
-
-    Alert alert;
-    alert.set_id(101);
-    alert.set_metric_id(metricId);
-    alert.set_trigger_if_sum_gt(25);
-    alert.set_num_buckets(100);
-    sp<MockConditionWizard> wizard = new NaggyMock<MockConditionWizard>();
-    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
-
-    UidMap uidMap;
-    SimpleAtomMatcher atomMatcher;
-    atomMatcher.set_atom_id(tagId);
-    sp<EventMatcherWizard> eventMatcherWizard = new EventMatcherWizard({
-        new SimpleLogMatchingTracker(atomMatcherId, logEventMatcherIndex, atomMatcher, uidMap)});
-
-    GaugeMetricProducer gaugeProducer(kConfigKey, metric, -1 /*-1 meaning no condition*/, wizard,
-                                      logEventMatcherIndex, eventMatcherWizard,
-                                      -1 /* -1 means no pulling */, -1, tagId, bucketStartTimeNs,
-                                      bucketStartTimeNs, pullerManager);
-
-    sp<AnomalyTracker> anomalyTracker = gaugeProducer.addAnomalyTracker(alert, alarmMonitor);
-    EXPECT_TRUE(anomalyTracker != nullptr);
-
-    shared_ptr<LogEvent> event1 = make_shared<LogEvent>(tagId, bucketStartTimeNs + 10);
-    event1->write(1);
-    event1->write(10);
-    event1->init();
-    gaugeProducer.onMatchedLogEvent(1 /*log matcher index*/, *event1);
-    EXPECT_EQ(1UL, (*gaugeProducer.mCurrentSlicedBucket).count(DEFAULT_METRIC_DIMENSION_KEY));
-
-    gaugeProducer.notifyAppUpgrade(eventUpgradeTimeNs, "ANY.APP", 1, 1);
-    EXPECT_EQ(0UL, (*gaugeProducer.mCurrentSlicedBucket).count(DEFAULT_METRIC_DIMENSION_KEY));
-    EXPECT_EQ(1UL, gaugeProducer.mPastBuckets[DEFAULT_METRIC_DIMENSION_KEY].size());
-    EXPECT_EQ(0L, gaugeProducer.mCurrentBucketNum);
-    EXPECT_EQ(eventUpgradeTimeNs, gaugeProducer.mCurrentBucketStartTimeNs);
-    // Partial buckets are not sent to anomaly tracker.
-    EXPECT_EQ(0, anomalyTracker->getSumOverPastBuckets(DEFAULT_METRIC_DIMENSION_KEY));
-
-    // Create an event in the same partial bucket.
-    shared_ptr<LogEvent> event2 = make_shared<LogEvent>(tagId, bucketStartTimeNs + 59 * NS_PER_SEC);
-    event2->write(1);
-    event2->write(10);
-    event2->init();
-    gaugeProducer.onMatchedLogEvent(1 /*log matcher index*/, *event2);
-    EXPECT_EQ(0L, gaugeProducer.mCurrentBucketNum);
-    EXPECT_EQ(1UL, gaugeProducer.mPastBuckets[DEFAULT_METRIC_DIMENSION_KEY].size());
-    EXPECT_EQ((int64_t)eventUpgradeTimeNs, gaugeProducer.mCurrentBucketStartTimeNs);
-    // Partial buckets are not sent to anomaly tracker.
-    EXPECT_EQ(0, anomalyTracker->getSumOverPastBuckets(DEFAULT_METRIC_DIMENSION_KEY));
-
-    // Next event should trigger creation of new bucket and send previous full bucket to anomaly
-    // tracker.
-    shared_ptr<LogEvent> event3 = make_shared<LogEvent>(tagId, bucketStartTimeNs + 65 * NS_PER_SEC);
-    event3->write(1);
-    event3->write(10);
-    event3->init();
-    gaugeProducer.onMatchedLogEvent(1 /*log matcher index*/, *event3);
-    EXPECT_EQ(1L, gaugeProducer.mCurrentBucketNum);
-    EXPECT_EQ(2UL, gaugeProducer.mPastBuckets[DEFAULT_METRIC_DIMENSION_KEY].size());
-    EXPECT_EQ((int64_t)bucketStartTimeNs + bucketSizeNs, gaugeProducer.mCurrentBucketStartTimeNs);
-    EXPECT_EQ(1, anomalyTracker->getSumOverPastBuckets(DEFAULT_METRIC_DIMENSION_KEY));
-
-    // Next event should trigger creation of new bucket.
-    shared_ptr<LogEvent> event4 =
-            make_shared<LogEvent>(tagId, bucketStartTimeNs + 125 * NS_PER_SEC);
-    event4->write(1);
-    event4->write(10);
-    event4->init();
-    gaugeProducer.onMatchedLogEvent(1 /*log matcher index*/, *event4);
-    EXPECT_EQ(2L, gaugeProducer.mCurrentBucketNum);
-    EXPECT_EQ(3UL, gaugeProducer.mPastBuckets[DEFAULT_METRIC_DIMENSION_KEY].size());
-    EXPECT_EQ(2, anomalyTracker->getSumOverPastBuckets(DEFAULT_METRIC_DIMENSION_KEY));
-}
-
-TEST(GaugeMetricProducerTest, TestPulledWithUpgrade) {
-    GaugeMetric metric;
-    metric.set_id(metricId);
-    metric.set_bucket(ONE_MINUTE);
-    metric.set_max_pull_delay_sec(INT_MAX);
-    auto gaugeFieldMatcher = metric.mutable_gauge_fields_filter()->mutable_fields();
-    gaugeFieldMatcher->set_field(tagId);
-    gaugeFieldMatcher->add_child()->set_field(2);
-
-    sp<MockConditionWizard> wizard = new NaggyMock<MockConditionWizard>();
-
-    UidMap uidMap;
-    SimpleAtomMatcher atomMatcher;
-    atomMatcher.set_atom_id(tagId);
-    sp<EventMatcherWizard> eventMatcherWizard =
-            new EventMatcherWizard({new SimpleLogMatchingTracker(
-                    atomMatcherId, logEventMatcherIndex, atomMatcher, uidMap)});
-
-    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
-    EXPECT_CALL(*pullerManager, RegisterReceiver(tagId, _, _, _)).WillOnce(Return());
-    EXPECT_CALL(*pullerManager, UnRegisterReceiver(tagId, _)).WillOnce(Return());
-    EXPECT_CALL(*pullerManager, Pull(tagId, _))
-            .WillOnce(Return(false))
-            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
-                data->clear();
-                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, eventUpgradeTimeNs);
-                event->write("some value");
-                event->write(2);
-                event->init();
-                data->push_back(event);
-                return true;
-            }));
-
-    GaugeMetricProducer gaugeProducer(kConfigKey, metric, -1 /*-1 meaning no condition*/, wizard,
-                                      logEventMatcherIndex, eventMatcherWizard, tagId, -1, tagId,
-                                      bucketStartTimeNs, bucketStartTimeNs, pullerManager);
-
-    vector<shared_ptr<LogEvent>> allData;
-    shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucketStartTimeNs + 1);
-    event->write("some value");
-    event->write(1);
-    event->init();
-    allData.push_back(event);
-    gaugeProducer.onDataPulled(allData, /** succeed */ true, bucketStartTimeNs);
-    EXPECT_EQ(1UL, gaugeProducer.mCurrentSlicedBucket->size());
-    EXPECT_EQ(1, gaugeProducer.mCurrentSlicedBucket->begin()
-                         ->second.front()
-                         .mFields->begin()
-                         ->mValue.int_value);
-
-    gaugeProducer.notifyAppUpgrade(eventUpgradeTimeNs, "ANY.APP", 1, 1);
-    EXPECT_EQ(1UL, gaugeProducer.mPastBuckets[DEFAULT_METRIC_DIMENSION_KEY].size());
-    EXPECT_EQ(0L, gaugeProducer.mCurrentBucketNum);
-    EXPECT_EQ((int64_t)eventUpgradeTimeNs, gaugeProducer.mCurrentBucketStartTimeNs);
-    EXPECT_EQ(1UL, gaugeProducer.mCurrentSlicedBucket->size());
-    EXPECT_EQ(2, gaugeProducer.mCurrentSlicedBucket->begin()
-                         ->second.front()
-                         .mFields->begin()
-                         ->mValue.int_value);
-
-    allData.clear();
-    event = make_shared<LogEvent>(tagId, bucketStartTimeNs + bucketSizeNs + 1);
-    event->write("some value");
-    event->write(3);
-    event->init();
-    allData.push_back(event);
-    gaugeProducer.onDataPulled(allData, /** succeed */ true, bucketStartTimeNs + bucketSizeNs);
-    EXPECT_EQ(2UL, gaugeProducer.mPastBuckets[DEFAULT_METRIC_DIMENSION_KEY].size());
-    EXPECT_EQ(1UL, gaugeProducer.mCurrentSlicedBucket->size());
-    EXPECT_EQ(3, gaugeProducer.mCurrentSlicedBucket->begin()
-                         ->second.front()
-                         .mFields->begin()
-                         ->mValue.int_value);
-}
-
-TEST(GaugeMetricProducerTest, TestPulledWithAppUpgradeDisabled) {
-    GaugeMetric metric;
-    metric.set_id(metricId);
-    metric.set_bucket(ONE_MINUTE);
-    metric.set_max_pull_delay_sec(INT_MAX);
-    metric.set_split_bucket_for_app_upgrade(false);
-    auto gaugeFieldMatcher = metric.mutable_gauge_fields_filter()->mutable_fields();
-    gaugeFieldMatcher->set_field(tagId);
-    gaugeFieldMatcher->add_child()->set_field(2);
-
-    sp<MockConditionWizard> wizard = new NaggyMock<MockConditionWizard>();
-
-    UidMap uidMap;
-    SimpleAtomMatcher atomMatcher;
-    atomMatcher.set_atom_id(tagId);
-    sp<EventMatcherWizard> eventMatcherWizard = new EventMatcherWizard({
-        new SimpleLogMatchingTracker(atomMatcherId, logEventMatcherIndex, atomMatcher, uidMap)});
-
-    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
-    EXPECT_CALL(*pullerManager, RegisterReceiver(tagId, _, _, _)).WillOnce(Return());
-    EXPECT_CALL(*pullerManager, UnRegisterReceiver(tagId, _)).WillOnce(Return());
-    EXPECT_CALL(*pullerManager, Pull(tagId, _)).WillOnce(Return(false));
-
-    GaugeMetricProducer gaugeProducer(kConfigKey, metric, -1 /*-1 meaning no condition*/, wizard,
-                                      logEventMatcherIndex, eventMatcherWizard,
-                                      tagId, -1, tagId, bucketStartTimeNs, bucketStartTimeNs,
-                                      pullerManager);
-
-    vector<shared_ptr<LogEvent>> allData;
-    shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucketStartTimeNs + 1);
-    event->write("some value");
-    event->write(1);
-    event->init();
-    allData.push_back(event);
-    gaugeProducer.onDataPulled(allData, /** succeed */ true, bucketStartTimeNs);
-    EXPECT_EQ(1UL, gaugeProducer.mCurrentSlicedBucket->size());
-    EXPECT_EQ(1, gaugeProducer.mCurrentSlicedBucket->begin()
-                         ->second.front()
-                         .mFields->begin()
-                         ->mValue.int_value);
-
-    gaugeProducer.notifyAppUpgrade(eventUpgradeTimeNs, "ANY.APP", 1, 1);
-    EXPECT_EQ(0UL, gaugeProducer.mPastBuckets[DEFAULT_METRIC_DIMENSION_KEY].size());
-    EXPECT_EQ(0L, gaugeProducer.mCurrentBucketNum);
-    EXPECT_EQ(bucketStartTimeNs, gaugeProducer.mCurrentBucketStartTimeNs);
-    EXPECT_EQ(1UL, gaugeProducer.mCurrentSlicedBucket->size());
-    EXPECT_EQ(1, gaugeProducer.mCurrentSlicedBucket->begin()
-                         ->second.front()
-                         .mFields->begin()
-                         ->mValue.int_value);
-}
-
-TEST(GaugeMetricProducerTest, TestPulledEventsWithCondition) {
-    GaugeMetric metric;
-    metric.set_id(metricId);
-    metric.set_bucket(ONE_MINUTE);
-    metric.set_max_pull_delay_sec(INT_MAX);
-    auto gaugeFieldMatcher = metric.mutable_gauge_fields_filter()->mutable_fields();
-    gaugeFieldMatcher->set_field(tagId);
-    gaugeFieldMatcher->add_child()->set_field(2);
-    metric.set_condition(StringToId("SCREEN_ON"));
-
-    sp<MockConditionWizard> wizard = new NaggyMock<MockConditionWizard>();
-
-    UidMap uidMap;
-    SimpleAtomMatcher atomMatcher;
-    atomMatcher.set_atom_id(tagId);
-    sp<EventMatcherWizard> eventMatcherWizard = new EventMatcherWizard({
-        new SimpleLogMatchingTracker(atomMatcherId, logEventMatcherIndex, atomMatcher, uidMap)});
-
-    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
-    EXPECT_CALL(*pullerManager, RegisterReceiver(tagId, _, _, _)).WillOnce(Return());
-    EXPECT_CALL(*pullerManager, UnRegisterReceiver(tagId, _)).WillOnce(Return());
-    EXPECT_CALL(*pullerManager, Pull(tagId, _))
-            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
-                data->clear();
-                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucketStartTimeNs + 10);
-                event->write("some value");
-                event->write(100);
-                event->init();
-                data->push_back(event);
-                return true;
-            }));
-
-    GaugeMetricProducer gaugeProducer(kConfigKey, metric, 1, wizard,
-                                      logEventMatcherIndex, eventMatcherWizard, tagId, -1, tagId,
-                                      bucketStartTimeNs, bucketStartTimeNs, pullerManager);
-
-    gaugeProducer.onConditionChanged(true, bucketStartTimeNs + 8);
-    EXPECT_EQ(1UL, gaugeProducer.mCurrentSlicedBucket->size());
-    EXPECT_EQ(100, gaugeProducer.mCurrentSlicedBucket->begin()
-                           ->second.front()
-                           .mFields->begin()
-                           ->mValue.int_value);
-    EXPECT_EQ(0UL, gaugeProducer.mPastBuckets.size());
-
-    vector<shared_ptr<LogEvent>> allData;
-    allData.clear();
-    shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucket2StartTimeNs + 1);
-    event->write("some value");
-    event->write(110);
-    event->init();
-    allData.push_back(event);
-    gaugeProducer.onDataPulled(allData, /** succeed */ true, bucket2StartTimeNs);
-
-    EXPECT_EQ(1UL, gaugeProducer.mCurrentSlicedBucket->size());
-    EXPECT_EQ(110, gaugeProducer.mCurrentSlicedBucket->begin()
-                           ->second.front()
-                           .mFields->begin()
-                           ->mValue.int_value);
-    EXPECT_EQ(1UL, gaugeProducer.mPastBuckets.size());
-    EXPECT_EQ(100, gaugeProducer.mPastBuckets.begin()
-                           ->second.back()
-                           .mGaugeAtoms.front()
-                           .mFields->begin()
-                           ->mValue.int_value);
-
-    gaugeProducer.onConditionChanged(false, bucket2StartTimeNs + 10);
-    gaugeProducer.flushIfNeededLocked(bucket3StartTimeNs + 10);
-    EXPECT_EQ(1UL, gaugeProducer.mPastBuckets.size());
-    EXPECT_EQ(2UL, gaugeProducer.mPastBuckets.begin()->second.size());
-    EXPECT_EQ(110L, gaugeProducer.mPastBuckets.begin()
-                            ->second.back()
-                            .mGaugeAtoms.front()
-                            .mFields->begin()
-                            ->mValue.int_value);
-}
-
-TEST(GaugeMetricProducerTest, TestPulledEventsWithSlicedCondition) {
-    const int conditionTag = 65;
-    GaugeMetric metric;
-    metric.set_id(1111111);
-    metric.set_bucket(ONE_MINUTE);
-    metric.mutable_gauge_fields_filter()->set_include_all(true);
-    metric.set_condition(StringToId("APP_DIED"));
-    metric.set_max_pull_delay_sec(INT_MAX);
-    auto dim = metric.mutable_dimensions_in_what();
-    dim->set_field(tagId);
-    dim->add_child()->set_field(1);
-
-    UidMap uidMap;
-    SimpleAtomMatcher atomMatcher;
-    atomMatcher.set_atom_id(tagId);
-    sp<EventMatcherWizard> eventMatcherWizard = new EventMatcherWizard({
-        new SimpleLogMatchingTracker(atomMatcherId, logEventMatcherIndex, atomMatcher, uidMap)});
-
-    sp<MockConditionWizard> wizard = new NaggyMock<MockConditionWizard>();
-    EXPECT_CALL(*wizard, query(_, _, _))
-            .WillRepeatedly(
-                    Invoke([](const int conditionIndex, const ConditionKey& conditionParameters,
-                              const bool isPartialLink) {
-                        int pos[] = {1, 0, 0};
-                        Field f(conditionTag, pos, 0);
-                        HashableDimensionKey key;
-                        key.mutableValues()->emplace_back(f, Value((int32_t)1000000));
-
-                        return ConditionState::kTrue;
-                    }));
-
-    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
-    EXPECT_CALL(*pullerManager, RegisterReceiver(tagId, _, _, _)).WillOnce(Return());
-    EXPECT_CALL(*pullerManager, UnRegisterReceiver(tagId, _)).WillOnce(Return());
-    EXPECT_CALL(*pullerManager, Pull(tagId, _))
-            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
-                data->clear();
-                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucketStartTimeNs + 10);
-                event->write(1000);
-                event->write(100);
-                event->init();
-                data->push_back(event);
-                return true;
-            }));
-
-    GaugeMetricProducer gaugeProducer(kConfigKey, metric, 1, wizard,
-                                      logEventMatcherIndex, eventMatcherWizard, tagId, -1, tagId,
-                                      bucketStartTimeNs, bucketStartTimeNs, pullerManager);
-
-    gaugeProducer.onSlicedConditionMayChange(true, bucketStartTimeNs + 8);
-
-    EXPECT_EQ(1UL, gaugeProducer.mCurrentSlicedBucket->size());
-    const auto& key = gaugeProducer.mCurrentSlicedBucket->begin()->first;
-    EXPECT_EQ(1UL, key.getDimensionKeyInWhat().getValues().size());
-    EXPECT_EQ(1000, key.getDimensionKeyInWhat().getValues()[0].mValue.int_value);
-
-    EXPECT_EQ(0UL, gaugeProducer.mPastBuckets.size());
-
-    vector<shared_ptr<LogEvent>> allData;
-    allData.clear();
-    shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucket2StartTimeNs + 1);
-    event->write(1000);
-    event->write(110);
-    event->init();
-    allData.push_back(event);
-    gaugeProducer.onDataPulled(allData, /** succeed */ true, bucket2StartTimeNs);
-
-    EXPECT_EQ(1UL, gaugeProducer.mCurrentSlicedBucket->size());
-    EXPECT_EQ(1UL, gaugeProducer.mPastBuckets.size());
-}
-
-TEST(GaugeMetricProducerTest, TestPulledEventsAnomalyDetection) {
-    sp<AlarmMonitor> alarmMonitor;
-    sp<MockConditionWizard> wizard = new NaggyMock<MockConditionWizard>();
-
-    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
-    EXPECT_CALL(*pullerManager, RegisterReceiver(tagId, _, _, _)).WillOnce(Return());
-    EXPECT_CALL(*pullerManager, UnRegisterReceiver(tagId, _)).WillOnce(Return());
-    EXPECT_CALL(*pullerManager, Pull(tagId, _)).WillOnce(Return(false));
-
-    GaugeMetric metric;
-    metric.set_id(metricId);
-    metric.set_bucket(ONE_MINUTE);
-    metric.set_max_pull_delay_sec(INT_MAX);
-    auto gaugeFieldMatcher = metric.mutable_gauge_fields_filter()->mutable_fields();
-    gaugeFieldMatcher->set_field(tagId);
-    gaugeFieldMatcher->add_child()->set_field(2);
-
-    UidMap uidMap;
-    SimpleAtomMatcher atomMatcher;
-    atomMatcher.set_atom_id(tagId);
-    sp<EventMatcherWizard> eventMatcherWizard = new EventMatcherWizard({
-        new SimpleLogMatchingTracker(atomMatcherId, logEventMatcherIndex, atomMatcher, uidMap)});
-
-    GaugeMetricProducer gaugeProducer(kConfigKey, metric, -1 /*-1 meaning no condition*/, wizard,
-                                      logEventMatcherIndex, eventMatcherWizard,
-                                      tagId, -1, tagId, bucketStartTimeNs, bucketStartTimeNs,
-                                      pullerManager);
-
-    Alert alert;
-    alert.set_id(101);
-    alert.set_metric_id(metricId);
-    alert.set_trigger_if_sum_gt(25);
-    alert.set_num_buckets(2);
-    const int32_t refPeriodSec = 60;
-    alert.set_refractory_period_secs(refPeriodSec);
-    sp<AnomalyTracker> anomalyTracker = gaugeProducer.addAnomalyTracker(alert, alarmMonitor);
-
-    int tagId = 1;
-    std::shared_ptr<LogEvent> event1 = std::make_shared<LogEvent>(tagId, bucketStartTimeNs + 1);
-    event1->write("some value");
-    event1->write(13);
-    event1->init();
-
-    gaugeProducer.onDataPulled({event1}, /** succeed */ true, bucketStartTimeNs);
-    EXPECT_EQ(1UL, gaugeProducer.mCurrentSlicedBucket->size());
-    EXPECT_EQ(13L, gaugeProducer.mCurrentSlicedBucket->begin()
-                           ->second.front()
-                           .mFields->begin()
-                           ->mValue.int_value);
-    EXPECT_EQ(anomalyTracker->getRefractoryPeriodEndsSec(DEFAULT_METRIC_DIMENSION_KEY), 0U);
-
-    std::shared_ptr<LogEvent> event2 =
-            std::make_shared<LogEvent>(tagId, bucketStartTimeNs + bucketSizeNs + 20);
-    event2->write("some value");
-    event2->write(15);
-    event2->init();
-
-    gaugeProducer.onDataPulled({event2}, /** succeed */ true, bucketStartTimeNs + bucketSizeNs);
-    EXPECT_EQ(1UL, gaugeProducer.mCurrentSlicedBucket->size());
-    EXPECT_EQ(15L, gaugeProducer.mCurrentSlicedBucket->begin()
-                           ->second.front()
-                           .mFields->begin()
-                           ->mValue.int_value);
-    EXPECT_EQ(anomalyTracker->getRefractoryPeriodEndsSec(DEFAULT_METRIC_DIMENSION_KEY),
-              std::ceil(1.0 * event2->GetElapsedTimestampNs() / NS_PER_SEC) + refPeriodSec);
-
-    std::shared_ptr<LogEvent> event3 =
-            std::make_shared<LogEvent>(tagId, bucketStartTimeNs + 2 * bucketSizeNs + 10);
-    event3->write("some value");
-    event3->write(26);
-    event3->init();
-
-    gaugeProducer.onDataPulled({event3}, /** succeed */ true, bucket2StartTimeNs + 2 * bucketSizeNs);
-    EXPECT_EQ(1UL, gaugeProducer.mCurrentSlicedBucket->size());
-    EXPECT_EQ(26L, gaugeProducer.mCurrentSlicedBucket->begin()
-                           ->second.front()
-                           .mFields->begin()
-                           ->mValue.int_value);
-    EXPECT_EQ(anomalyTracker->getRefractoryPeriodEndsSec(DEFAULT_METRIC_DIMENSION_KEY),
-              std::ceil(1.0 * event2->GetElapsedTimestampNs() / NS_PER_SEC + refPeriodSec));
-
-    // The event4 does not have the gauge field. Thus the current bucket value is 0.
-    std::shared_ptr<LogEvent> event4 =
-            std::make_shared<LogEvent>(tagId, bucketStartTimeNs + 3 * bucketSizeNs + 10);
-    event4->write("some value");
-    event4->init();
-    gaugeProducer.onDataPulled({event4}, /** succeed */ true, bucketStartTimeNs + 3 * bucketSizeNs);
-    EXPECT_EQ(1UL, gaugeProducer.mCurrentSlicedBucket->size());
-    EXPECT_TRUE(gaugeProducer.mCurrentSlicedBucket->begin()->second.front().mFields->empty());
-}
-
-TEST(GaugeMetricProducerTest, TestPullOnTrigger) {
-    GaugeMetric metric;
-    metric.set_id(metricId);
-    metric.set_bucket(ONE_MINUTE);
-    metric.set_sampling_type(GaugeMetric::FIRST_N_SAMPLES);
-    metric.mutable_gauge_fields_filter()->set_include_all(false);
-    metric.set_max_pull_delay_sec(INT_MAX);
-    auto gaugeFieldMatcher = metric.mutable_gauge_fields_filter()->mutable_fields();
-    gaugeFieldMatcher->set_field(tagId);
-    gaugeFieldMatcher->add_child()->set_field(1);
-
-    sp<MockConditionWizard> wizard = new NaggyMock<MockConditionWizard>();
-
-    UidMap uidMap;
-    SimpleAtomMatcher atomMatcher;
-    atomMatcher.set_atom_id(tagId);
-    sp<EventMatcherWizard> eventMatcherWizard = new EventMatcherWizard({
-        new SimpleLogMatchingTracker(atomMatcherId, logEventMatcherIndex, atomMatcher, uidMap)});
-
-    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
-    EXPECT_CALL(*pullerManager, Pull(tagId, _))
-            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
-                data->clear();
-                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucketStartTimeNs + 10);
-                event->write(4);
-                event->init();
-                data->push_back(event);
-                return true;
-            }))
-            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
-                data->clear();
-                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucketStartTimeNs + 20);
-                event->write(5);
-                event->init();
-                data->push_back(event);
-                return true;
-            }))
-            .WillOnce(Return(true));
-
-    int triggerId = 5;
-    GaugeMetricProducer gaugeProducer(kConfigKey, metric, -1 /*-1 meaning no condition*/, wizard,
-                                      logEventMatcherIndex, eventMatcherWizard,
-                                      tagId, triggerId, tagId, bucketStartTimeNs, bucketStartTimeNs,
-                                      pullerManager);
-
-    vector<shared_ptr<LogEvent>> allData;
-
-    EXPECT_EQ(0UL, gaugeProducer.mCurrentSlicedBucket->size());
-    LogEvent trigger(triggerId, bucketStartTimeNs + 10);
-    trigger.init();
-    gaugeProducer.onMatchedLogEvent(1 /*log matcher index*/, trigger);
-    EXPECT_EQ(1UL, gaugeProducer.mCurrentSlicedBucket->begin()->second.size());
-    trigger.setElapsedTimestampNs(bucketStartTimeNs + 20);
-    gaugeProducer.onMatchedLogEvent(1 /*log matcher index*/, trigger);
-    EXPECT_EQ(2UL, gaugeProducer.mCurrentSlicedBucket->begin()->second.size());
-    trigger.setElapsedTimestampNs(bucket2StartTimeNs + 1);
-    gaugeProducer.onMatchedLogEvent(1 /*log matcher index*/, trigger);
-
-    EXPECT_EQ(1UL, gaugeProducer.mPastBuckets.size());
-    EXPECT_EQ(2UL, gaugeProducer.mPastBuckets.begin()->second.back().mGaugeAtoms.size());
-    EXPECT_EQ(4, gaugeProducer.mPastBuckets.begin()
-                         ->second.back()
-                         .mGaugeAtoms[0]
-                         .mFields->begin()
-                         ->mValue.int_value);
-    EXPECT_EQ(5, gaugeProducer.mPastBuckets.begin()
-                         ->second.back()
-                         .mGaugeAtoms[1]
-                         .mFields->begin()
-                         ->mValue.int_value);
-}
-
-TEST(GaugeMetricProducerTest, TestRemoveDimensionInOutput) {
-    GaugeMetric metric;
-    metric.set_id(metricId);
-    metric.set_bucket(ONE_MINUTE);
-    metric.set_sampling_type(GaugeMetric::FIRST_N_SAMPLES);
-    metric.mutable_gauge_fields_filter()->set_include_all(true);
-    metric.set_max_pull_delay_sec(INT_MAX);
-    auto dimensionMatcher = metric.mutable_dimensions_in_what();
-    // use field 1 as dimension.
-    dimensionMatcher->set_field(tagId);
-    dimensionMatcher->add_child()->set_field(1);
-
-    sp<MockConditionWizard> wizard = new NaggyMock<MockConditionWizard>();
-
-    UidMap uidMap;
-    SimpleAtomMatcher atomMatcher;
-    atomMatcher.set_atom_id(tagId);
-    sp<EventMatcherWizard> eventMatcherWizard = new EventMatcherWizard({
-        new SimpleLogMatchingTracker(atomMatcherId, logEventMatcherIndex, atomMatcher, uidMap)});
-
-    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
-    EXPECT_CALL(*pullerManager, Pull(tagId, _))
-            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
-                data->clear();
-                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucketStartTimeNs + 3);
-                event->write(3);
-                event->write(4);
-                event->init();
-                data->push_back(event);
-                return true;
-            }))
-            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
-                data->clear();
-                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucketStartTimeNs + 10);
-                event->write(4);
-                event->write(5);
-                event->init();
-                data->push_back(event);
-                return true;
-            }))
-            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
-                data->clear();
-                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucketStartTimeNs + 20);
-                event->write(4);
-                event->write(6);
-                event->init();
-                data->push_back(event);
-                return true;
-            }))
-            .WillOnce(Return(true));
-
-    int triggerId = 5;
-    GaugeMetricProducer gaugeProducer(kConfigKey, metric, -1 /*-1 meaning no condition*/, wizard,
-                                      logEventMatcherIndex, eventMatcherWizard,
-                                      tagId, triggerId, tagId, bucketStartTimeNs, bucketStartTimeNs,
-                                      pullerManager);
-
-    vector<shared_ptr<LogEvent>> allData;
-
-    LogEvent trigger(triggerId, bucketStartTimeNs + 3);
-    trigger.init();
-    gaugeProducer.onMatchedLogEvent(1 /*log matcher index*/, trigger);
-    EXPECT_EQ(1UL, gaugeProducer.mCurrentSlicedBucket->size());
-    trigger.setElapsedTimestampNs(bucketStartTimeNs + 10);
-    gaugeProducer.onMatchedLogEvent(1 /*log matcher index*/, trigger);
-    EXPECT_EQ(2UL, gaugeProducer.mCurrentSlicedBucket->size());
-    EXPECT_EQ(1UL, gaugeProducer.mCurrentSlicedBucket->begin()->second.size());
-    trigger.setElapsedTimestampNs(bucketStartTimeNs + 20);
-    gaugeProducer.onMatchedLogEvent(1 /*log matcher index*/, trigger);
-    EXPECT_EQ(2UL, gaugeProducer.mCurrentSlicedBucket->begin()->second.size());
-    trigger.setElapsedTimestampNs(bucket2StartTimeNs + 1);
-    gaugeProducer.onMatchedLogEvent(1 /*log matcher index*/, trigger);
-
-    EXPECT_EQ(2UL, gaugeProducer.mPastBuckets.size());
-    auto bucketIt = gaugeProducer.mPastBuckets.begin();
-    EXPECT_EQ(1UL, bucketIt->second.back().mGaugeAtoms.size());
-    EXPECT_EQ(3, bucketIt->first.getDimensionKeyInWhat().getValues().begin()->mValue.int_value);
-    EXPECT_EQ(4, bucketIt->second.back().mGaugeAtoms[0].mFields->begin()->mValue.int_value);
-    bucketIt++;
-    EXPECT_EQ(2UL, bucketIt->second.back().mGaugeAtoms.size());
-    EXPECT_EQ(4, bucketIt->first.getDimensionKeyInWhat().getValues().begin()->mValue.int_value);
-    EXPECT_EQ(5, bucketIt->second.back().mGaugeAtoms[0].mFields->begin()->mValue.int_value);
-    EXPECT_EQ(6, bucketIt->second.back().mGaugeAtoms[1].mFields->begin()->mValue.int_value);
-}
-
-/*
- * Test that BUCKET_TOO_SMALL dump reason is logged when a flushed bucket size
- * is smaller than the "min_bucket_size_nanos" specified in the metric config.
- */
-TEST(GaugeMetricProducerTest_BucketDrop, TestBucketDropWhenBucketTooSmall) {
-    GaugeMetric metric;
-    metric.set_id(metricId);
-    metric.set_bucket(FIVE_MINUTES);
-    metric.set_sampling_type(GaugeMetric::FIRST_N_SAMPLES);
-    metric.set_min_bucket_size_nanos(10000000000);  // 10 seconds
-
-    sp<MockConditionWizard> wizard = new NaggyMock<MockConditionWizard>();
-
-    UidMap uidMap;
-    SimpleAtomMatcher atomMatcher;
-    atomMatcher.set_atom_id(tagId);
-    sp<EventMatcherWizard> eventMatcherWizard = new EventMatcherWizard({
-        new SimpleLogMatchingTracker(atomMatcherId, logEventMatcherIndex, atomMatcher, uidMap)});
-
-    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
-    EXPECT_CALL(*pullerManager, Pull(tagId, _))
-            // Bucket start.
-            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
-                data->clear();
-                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucketStartTimeNs);
-                event->write("field1");
-                event->write(10);
-                event->init();
-                data->push_back(event);
-                return true;
-            }));
-
-    int triggerId = 5;
-    GaugeMetricProducer gaugeProducer(kConfigKey, metric, -1 /*-1 meaning no condition*/, wizard,
-                                      logEventMatcherIndex, eventMatcherWizard,
-                                      tagId, triggerId, tagId, bucketStartTimeNs, bucketStartTimeNs,
-                                      pullerManager);
-
-    LogEvent trigger(triggerId, bucketStartTimeNs + 3);
-    trigger.init();
-    gaugeProducer.onMatchedLogEvent(1 /*log matcher index*/, trigger);
-
-    // Check dump report.
-    ProtoOutputStream output;
-    std::set<string> strSet;
-    gaugeProducer.onDumpReport(bucketStartTimeNs + 9000000, true /* include recent buckets */,
-                                true, FAST /* dump_latency */, &strSet, &output);
-
-    StatsLogReport report = outputStreamToProto(&output);
-    EXPECT_TRUE(report.has_gauge_metrics());
-    EXPECT_EQ(0, report.gauge_metrics().data_size());
-    EXPECT_EQ(1, report.gauge_metrics().skipped_size());
-
-    EXPECT_EQ(NanoToMillis(bucketStartTimeNs),
-              report.gauge_metrics().skipped(0).start_bucket_elapsed_millis());
-    EXPECT_EQ(NanoToMillis(bucketStartTimeNs + 9000000),
-              report.gauge_metrics().skipped(0).end_bucket_elapsed_millis());
-    EXPECT_EQ(1, report.gauge_metrics().skipped(0).drop_event_size());
-
-    auto dropEvent = report.gauge_metrics().skipped(0).drop_event(0);
-    EXPECT_EQ(BucketDropReason::BUCKET_TOO_SMALL, dropEvent.drop_reason());
-    EXPECT_EQ(NanoToMillis(bucketStartTimeNs + 9000000), dropEvent.drop_time_millis());
-}
+// TODO(b/149590301): Update these tests to use new socket schema.
+//TEST(GaugeMetricProducerTest, TestPulledEventsNoCondition) {
+//    GaugeMetric metric;
+//    metric.set_id(metricId);
+//    metric.set_bucket(ONE_MINUTE);
+//    metric.mutable_gauge_fields_filter()->set_include_all(false);
+//    metric.set_max_pull_delay_sec(INT_MAX);
+//    auto gaugeFieldMatcher = metric.mutable_gauge_fields_filter()->mutable_fields();
+//    gaugeFieldMatcher->set_field(tagId);
+//    gaugeFieldMatcher->add_child()->set_field(1);
+//    gaugeFieldMatcher->add_child()->set_field(3);
+//
+//    sp<MockConditionWizard> wizard = new NaggyMock<MockConditionWizard>();
+//
+//    UidMap uidMap;
+//    SimpleAtomMatcher atomMatcher;
+//    atomMatcher.set_atom_id(tagId);
+//    sp<EventMatcherWizard> eventMatcherWizard = new EventMatcherWizard({
+//        new SimpleLogMatchingTracker(atomMatcherId, logEventMatcherIndex, atomMatcher, uidMap)});
+//
+//    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
+//    EXPECT_CALL(*pullerManager, RegisterReceiver(tagId, _, _, _)).WillOnce(Return());
+//    EXPECT_CALL(*pullerManager, UnRegisterReceiver(tagId, _)).WillOnce(Return());
+//    EXPECT_CALL(*pullerManager, Pull(tagId, _))
+//            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
+//                data->clear();
+//                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucketStartTimeNs + 10);
+//                event->write(3);
+//                event->write("some value");
+//                event->write(11);
+//                event->init();
+//                data->push_back(event);
+//                return true;
+//            }));
+//
+//    GaugeMetricProducer gaugeProducer(kConfigKey, metric, -1 /*-1 meaning no condition*/, wizard,
+//                                      logEventMatcherIndex, eventMatcherWizard,
+//                                      tagId, -1, tagId, bucketStartTimeNs, bucketStartTimeNs,
+//                                      pullerManager);
+//
+//    vector<shared_ptr<LogEvent>> allData;
+//    allData.clear();
+//    shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucket2StartTimeNs + 1);
+//    event->write(10);
+//    event->write("some value");
+//    event->write(11);
+//    event->init();
+//    allData.push_back(event);
+//
+//    gaugeProducer.onDataPulled(allData, /** succeed */ true, bucket2StartTimeNs);
+//    EXPECT_EQ(1UL, gaugeProducer.mCurrentSlicedBucket->size());
+//    auto it = gaugeProducer.mCurrentSlicedBucket->begin()->second.front().mFields->begin();
+//    EXPECT_EQ(INT, it->mValue.getType());
+//    EXPECT_EQ(10, it->mValue.int_value);
+//    it++;
+//    EXPECT_EQ(11, it->mValue.int_value);
+//    EXPECT_EQ(1UL, gaugeProducer.mPastBuckets.size());
+//    EXPECT_EQ(3, gaugeProducer.mPastBuckets.begin()->second.back().mGaugeAtoms
+//        .front().mFields->begin()->mValue.int_value);
+//
+//    allData.clear();
+//    std::shared_ptr<LogEvent> event2 = std::make_shared<LogEvent>(tagId, bucket3StartTimeNs + 10);
+//    event2->write(24);
+//    event2->write("some value");
+//    event2->write(25);
+//    event2->init();
+//    allData.push_back(event2);
+//    gaugeProducer.onDataPulled(allData, /** succeed */ true, bucket3StartTimeNs);
+//    EXPECT_EQ(1UL, gaugeProducer.mCurrentSlicedBucket->size());
+//    it = gaugeProducer.mCurrentSlicedBucket->begin()->second.front().mFields->begin();
+//    EXPECT_EQ(INT, it->mValue.getType());
+//    EXPECT_EQ(24, it->mValue.int_value);
+//    it++;
+//    EXPECT_EQ(INT, it->mValue.getType());
+//    EXPECT_EQ(25, it->mValue.int_value);
+//    // One dimension.
+//    EXPECT_EQ(1UL, gaugeProducer.mPastBuckets.size());
+//    EXPECT_EQ(2UL, gaugeProducer.mPastBuckets.begin()->second.size());
+//    it = gaugeProducer.mPastBuckets.begin()->second.back().mGaugeAtoms.front().mFields->begin();
+//    EXPECT_EQ(INT, it->mValue.getType());
+//    EXPECT_EQ(10L, it->mValue.int_value);
+//    it++;
+//    EXPECT_EQ(INT, it->mValue.getType());
+//    EXPECT_EQ(11L, it->mValue.int_value);
+//
+//    gaugeProducer.flushIfNeededLocked(bucket4StartTimeNs);
+//    EXPECT_EQ(0UL, gaugeProducer.mCurrentSlicedBucket->size());
+//    // One dimension.
+//    EXPECT_EQ(1UL, gaugeProducer.mPastBuckets.size());
+//    EXPECT_EQ(3UL, gaugeProducer.mPastBuckets.begin()->second.size());
+//    it = gaugeProducer.mPastBuckets.begin()->second.back().mGaugeAtoms.front().mFields->begin();
+//    EXPECT_EQ(INT, it->mValue.getType());
+//    EXPECT_EQ(24L, it->mValue.int_value);
+//    it++;
+//    EXPECT_EQ(INT, it->mValue.getType());
+//    EXPECT_EQ(25L, it->mValue.int_value);
+//}
+//
+//TEST(GaugeMetricProducerTest, TestPushedEventsWithUpgrade) {
+//    sp<AlarmMonitor> alarmMonitor;
+//    GaugeMetric metric;
+//    metric.set_id(metricId);
+//    metric.set_bucket(ONE_MINUTE);
+//    metric.mutable_gauge_fields_filter()->set_include_all(true);
+//
+//    Alert alert;
+//    alert.set_id(101);
+//    alert.set_metric_id(metricId);
+//    alert.set_trigger_if_sum_gt(25);
+//    alert.set_num_buckets(100);
+//    sp<MockConditionWizard> wizard = new NaggyMock<MockConditionWizard>();
+//    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
+//
+//    UidMap uidMap;
+//    SimpleAtomMatcher atomMatcher;
+//    atomMatcher.set_atom_id(tagId);
+//    sp<EventMatcherWizard> eventMatcherWizard = new EventMatcherWizard({
+//        new SimpleLogMatchingTracker(atomMatcherId, logEventMatcherIndex, atomMatcher, uidMap)});
+//
+//    GaugeMetricProducer gaugeProducer(kConfigKey, metric, -1 /*-1 meaning no condition*/, wizard,
+//                                      logEventMatcherIndex, eventMatcherWizard,
+//                                      -1 /* -1 means no pulling */, -1, tagId, bucketStartTimeNs,
+//                                      bucketStartTimeNs, pullerManager);
+//
+//    sp<AnomalyTracker> anomalyTracker = gaugeProducer.addAnomalyTracker(alert, alarmMonitor);
+//    EXPECT_TRUE(anomalyTracker != nullptr);
+//
+//    shared_ptr<LogEvent> event1 = make_shared<LogEvent>(tagId, bucketStartTimeNs + 10);
+//    event1->write(1);
+//    event1->write(10);
+//    event1->init();
+//    gaugeProducer.onMatchedLogEvent(1 /*log matcher index*/, *event1);
+//    EXPECT_EQ(1UL, (*gaugeProducer.mCurrentSlicedBucket).count(DEFAULT_METRIC_DIMENSION_KEY));
+//
+//    gaugeProducer.notifyAppUpgrade(eventUpgradeTimeNs, "ANY.APP", 1, 1);
+//    EXPECT_EQ(0UL, (*gaugeProducer.mCurrentSlicedBucket).count(DEFAULT_METRIC_DIMENSION_KEY));
+//    EXPECT_EQ(1UL, gaugeProducer.mPastBuckets[DEFAULT_METRIC_DIMENSION_KEY].size());
+//    EXPECT_EQ(0L, gaugeProducer.mCurrentBucketNum);
+//    EXPECT_EQ(eventUpgradeTimeNs, gaugeProducer.mCurrentBucketStartTimeNs);
+//    // Partial buckets are not sent to anomaly tracker.
+//    EXPECT_EQ(0, anomalyTracker->getSumOverPastBuckets(DEFAULT_METRIC_DIMENSION_KEY));
+//
+//    // Create an event in the same partial bucket.
+//    shared_ptr<LogEvent> event2 = make_shared<LogEvent>(tagId, bucketStartTimeNs + 59 * NS_PER_SEC);
+//    event2->write(1);
+//    event2->write(10);
+//    event2->init();
+//    gaugeProducer.onMatchedLogEvent(1 /*log matcher index*/, *event2);
+//    EXPECT_EQ(0L, gaugeProducer.mCurrentBucketNum);
+//    EXPECT_EQ(1UL, gaugeProducer.mPastBuckets[DEFAULT_METRIC_DIMENSION_KEY].size());
+//    EXPECT_EQ((int64_t)eventUpgradeTimeNs, gaugeProducer.mCurrentBucketStartTimeNs);
+//    // Partial buckets are not sent to anomaly tracker.
+//    EXPECT_EQ(0, anomalyTracker->getSumOverPastBuckets(DEFAULT_METRIC_DIMENSION_KEY));
+//
+//    // Next event should trigger creation of new bucket and send previous full bucket to anomaly
+//    // tracker.
+//    shared_ptr<LogEvent> event3 = make_shared<LogEvent>(tagId, bucketStartTimeNs + 65 * NS_PER_SEC);
+//    event3->write(1);
+//    event3->write(10);
+//    event3->init();
+//    gaugeProducer.onMatchedLogEvent(1 /*log matcher index*/, *event3);
+//    EXPECT_EQ(1L, gaugeProducer.mCurrentBucketNum);
+//    EXPECT_EQ(2UL, gaugeProducer.mPastBuckets[DEFAULT_METRIC_DIMENSION_KEY].size());
+//    EXPECT_EQ((int64_t)bucketStartTimeNs + bucketSizeNs, gaugeProducer.mCurrentBucketStartTimeNs);
+//    EXPECT_EQ(1, anomalyTracker->getSumOverPastBuckets(DEFAULT_METRIC_DIMENSION_KEY));
+//
+//    // Next event should trigger creation of new bucket.
+//    shared_ptr<LogEvent> event4 =
+//            make_shared<LogEvent>(tagId, bucketStartTimeNs + 125 * NS_PER_SEC);
+//    event4->write(1);
+//    event4->write(10);
+//    event4->init();
+//    gaugeProducer.onMatchedLogEvent(1 /*log matcher index*/, *event4);
+//    EXPECT_EQ(2L, gaugeProducer.mCurrentBucketNum);
+//    EXPECT_EQ(3UL, gaugeProducer.mPastBuckets[DEFAULT_METRIC_DIMENSION_KEY].size());
+//    EXPECT_EQ(2, anomalyTracker->getSumOverPastBuckets(DEFAULT_METRIC_DIMENSION_KEY));
+//}
+//
+//TEST(GaugeMetricProducerTest, TestPulledWithUpgrade) {
+//    GaugeMetric metric;
+//    metric.set_id(metricId);
+//    metric.set_bucket(ONE_MINUTE);
+//    metric.set_max_pull_delay_sec(INT_MAX);
+//    auto gaugeFieldMatcher = metric.mutable_gauge_fields_filter()->mutable_fields();
+//    gaugeFieldMatcher->set_field(tagId);
+//    gaugeFieldMatcher->add_child()->set_field(2);
+//
+//    sp<MockConditionWizard> wizard = new NaggyMock<MockConditionWizard>();
+//
+//    UidMap uidMap;
+//    SimpleAtomMatcher atomMatcher;
+//    atomMatcher.set_atom_id(tagId);
+//    sp<EventMatcherWizard> eventMatcherWizard =
+//            new EventMatcherWizard({new SimpleLogMatchingTracker(
+//                    atomMatcherId, logEventMatcherIndex, atomMatcher, uidMap)});
+//
+//    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
+//    EXPECT_CALL(*pullerManager, RegisterReceiver(tagId, _, _, _)).WillOnce(Return());
+//    EXPECT_CALL(*pullerManager, UnRegisterReceiver(tagId, _)).WillOnce(Return());
+//    EXPECT_CALL(*pullerManager, Pull(tagId, _))
+//            .WillOnce(Return(false))
+//            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
+//                data->clear();
+//                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, eventUpgradeTimeNs);
+//                event->write("some value");
+//                event->write(2);
+//                event->init();
+//                data->push_back(event);
+//                return true;
+//            }));
+//
+//    GaugeMetricProducer gaugeProducer(kConfigKey, metric, -1 /*-1 meaning no condition*/, wizard,
+//                                      logEventMatcherIndex, eventMatcherWizard, tagId, -1, tagId,
+//                                      bucketStartTimeNs, bucketStartTimeNs, pullerManager);
+//
+//    vector<shared_ptr<LogEvent>> allData;
+//    shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucketStartTimeNs + 1);
+//    event->write("some value");
+//    event->write(1);
+//    event->init();
+//    allData.push_back(event);
+//    gaugeProducer.onDataPulled(allData, /** succeed */ true, bucketStartTimeNs);
+//    EXPECT_EQ(1UL, gaugeProducer.mCurrentSlicedBucket->size());
+//    EXPECT_EQ(1, gaugeProducer.mCurrentSlicedBucket->begin()
+//                         ->second.front()
+//                         .mFields->begin()
+//                         ->mValue.int_value);
+//
+//    gaugeProducer.notifyAppUpgrade(eventUpgradeTimeNs, "ANY.APP", 1, 1);
+//    EXPECT_EQ(1UL, gaugeProducer.mPastBuckets[DEFAULT_METRIC_DIMENSION_KEY].size());
+//    EXPECT_EQ(0L, gaugeProducer.mCurrentBucketNum);
+//    EXPECT_EQ((int64_t)eventUpgradeTimeNs, gaugeProducer.mCurrentBucketStartTimeNs);
+//    EXPECT_EQ(1UL, gaugeProducer.mCurrentSlicedBucket->size());
+//    EXPECT_EQ(2, gaugeProducer.mCurrentSlicedBucket->begin()
+//                         ->second.front()
+//                         .mFields->begin()
+//                         ->mValue.int_value);
+//
+//    allData.clear();
+//    event = make_shared<LogEvent>(tagId, bucketStartTimeNs + bucketSizeNs + 1);
+//    event->write("some value");
+//    event->write(3);
+//    event->init();
+//    allData.push_back(event);
+//    gaugeProducer.onDataPulled(allData, /** succeed */ true, bucketStartTimeNs + bucketSizeNs);
+//    EXPECT_EQ(2UL, gaugeProducer.mPastBuckets[DEFAULT_METRIC_DIMENSION_KEY].size());
+//    EXPECT_EQ(1UL, gaugeProducer.mCurrentSlicedBucket->size());
+//    EXPECT_EQ(3, gaugeProducer.mCurrentSlicedBucket->begin()
+//                         ->second.front()
+//                         .mFields->begin()
+//                         ->mValue.int_value);
+//}
+//
+//TEST(GaugeMetricProducerTest, TestPulledWithAppUpgradeDisabled) {
+//    GaugeMetric metric;
+//    metric.set_id(metricId);
+//    metric.set_bucket(ONE_MINUTE);
+//    metric.set_max_pull_delay_sec(INT_MAX);
+//    metric.set_split_bucket_for_app_upgrade(false);
+//    auto gaugeFieldMatcher = metric.mutable_gauge_fields_filter()->mutable_fields();
+//    gaugeFieldMatcher->set_field(tagId);
+//    gaugeFieldMatcher->add_child()->set_field(2);
+//
+//    sp<MockConditionWizard> wizard = new NaggyMock<MockConditionWizard>();
+//
+//    UidMap uidMap;
+//    SimpleAtomMatcher atomMatcher;
+//    atomMatcher.set_atom_id(tagId);
+//    sp<EventMatcherWizard> eventMatcherWizard = new EventMatcherWizard({
+//        new SimpleLogMatchingTracker(atomMatcherId, logEventMatcherIndex, atomMatcher, uidMap)});
+//
+//    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
+//    EXPECT_CALL(*pullerManager, RegisterReceiver(tagId, _, _, _)).WillOnce(Return());
+//    EXPECT_CALL(*pullerManager, UnRegisterReceiver(tagId, _)).WillOnce(Return());
+//    EXPECT_CALL(*pullerManager, Pull(tagId, _)).WillOnce(Return(false));
+//
+//    GaugeMetricProducer gaugeProducer(kConfigKey, metric, -1 /*-1 meaning no condition*/, wizard,
+//                                      logEventMatcherIndex, eventMatcherWizard,
+//                                      tagId, -1, tagId, bucketStartTimeNs, bucketStartTimeNs,
+//                                      pullerManager);
+//
+//    vector<shared_ptr<LogEvent>> allData;
+//    shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucketStartTimeNs + 1);
+//    event->write("some value");
+//    event->write(1);
+//    event->init();
+//    allData.push_back(event);
+//    gaugeProducer.onDataPulled(allData, /** succeed */ true, bucketStartTimeNs);
+//    EXPECT_EQ(1UL, gaugeProducer.mCurrentSlicedBucket->size());
+//    EXPECT_EQ(1, gaugeProducer.mCurrentSlicedBucket->begin()
+//                         ->second.front()
+//                         .mFields->begin()
+//                         ->mValue.int_value);
+//
+//    gaugeProducer.notifyAppUpgrade(eventUpgradeTimeNs, "ANY.APP", 1, 1);
+//    EXPECT_EQ(0UL, gaugeProducer.mPastBuckets[DEFAULT_METRIC_DIMENSION_KEY].size());
+//    EXPECT_EQ(0L, gaugeProducer.mCurrentBucketNum);
+//    EXPECT_EQ(bucketStartTimeNs, gaugeProducer.mCurrentBucketStartTimeNs);
+//    EXPECT_EQ(1UL, gaugeProducer.mCurrentSlicedBucket->size());
+//    EXPECT_EQ(1, gaugeProducer.mCurrentSlicedBucket->begin()
+//                         ->second.front()
+//                         .mFields->begin()
+//                         ->mValue.int_value);
+//}
+//
+//TEST(GaugeMetricProducerTest, TestPulledEventsWithCondition) {
+//    GaugeMetric metric;
+//    metric.set_id(metricId);
+//    metric.set_bucket(ONE_MINUTE);
+//    metric.set_max_pull_delay_sec(INT_MAX);
+//    auto gaugeFieldMatcher = metric.mutable_gauge_fields_filter()->mutable_fields();
+//    gaugeFieldMatcher->set_field(tagId);
+//    gaugeFieldMatcher->add_child()->set_field(2);
+//    metric.set_condition(StringToId("SCREEN_ON"));
+//
+//    sp<MockConditionWizard> wizard = new NaggyMock<MockConditionWizard>();
+//
+//    UidMap uidMap;
+//    SimpleAtomMatcher atomMatcher;
+//    atomMatcher.set_atom_id(tagId);
+//    sp<EventMatcherWizard> eventMatcherWizard = new EventMatcherWizard({
+//        new SimpleLogMatchingTracker(atomMatcherId, logEventMatcherIndex, atomMatcher, uidMap)});
+//
+//    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
+//    EXPECT_CALL(*pullerManager, RegisterReceiver(tagId, _, _, _)).WillOnce(Return());
+//    EXPECT_CALL(*pullerManager, UnRegisterReceiver(tagId, _)).WillOnce(Return());
+//    EXPECT_CALL(*pullerManager, Pull(tagId, _))
+//            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
+//                data->clear();
+//                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucketStartTimeNs + 10);
+//                event->write("some value");
+//                event->write(100);
+//                event->init();
+//                data->push_back(event);
+//                return true;
+//            }));
+//
+//    GaugeMetricProducer gaugeProducer(kConfigKey, metric, 1, wizard,
+//                                      logEventMatcherIndex, eventMatcherWizard, tagId, -1, tagId,
+//                                      bucketStartTimeNs, bucketStartTimeNs, pullerManager);
+//
+//    gaugeProducer.onConditionChanged(true, bucketStartTimeNs + 8);
+//    EXPECT_EQ(1UL, gaugeProducer.mCurrentSlicedBucket->size());
+//    EXPECT_EQ(100, gaugeProducer.mCurrentSlicedBucket->begin()
+//                           ->second.front()
+//                           .mFields->begin()
+//                           ->mValue.int_value);
+//    EXPECT_EQ(0UL, gaugeProducer.mPastBuckets.size());
+//
+//    vector<shared_ptr<LogEvent>> allData;
+//    allData.clear();
+//    shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucket2StartTimeNs + 1);
+//    event->write("some value");
+//    event->write(110);
+//    event->init();
+//    allData.push_back(event);
+//    gaugeProducer.onDataPulled(allData, /** succeed */ true, bucket2StartTimeNs);
+//
+//    EXPECT_EQ(1UL, gaugeProducer.mCurrentSlicedBucket->size());
+//    EXPECT_EQ(110, gaugeProducer.mCurrentSlicedBucket->begin()
+//                           ->second.front()
+//                           .mFields->begin()
+//                           ->mValue.int_value);
+//    EXPECT_EQ(1UL, gaugeProducer.mPastBuckets.size());
+//    EXPECT_EQ(100, gaugeProducer.mPastBuckets.begin()
+//                           ->second.back()
+//                           .mGaugeAtoms.front()
+//                           .mFields->begin()
+//                           ->mValue.int_value);
+//
+//    gaugeProducer.onConditionChanged(false, bucket2StartTimeNs + 10);
+//    gaugeProducer.flushIfNeededLocked(bucket3StartTimeNs + 10);
+//    EXPECT_EQ(1UL, gaugeProducer.mPastBuckets.size());
+//    EXPECT_EQ(2UL, gaugeProducer.mPastBuckets.begin()->second.size());
+//    EXPECT_EQ(110L, gaugeProducer.mPastBuckets.begin()
+//                            ->second.back()
+//                            .mGaugeAtoms.front()
+//                            .mFields->begin()
+//                            ->mValue.int_value);
+//}
+//
+//TEST(GaugeMetricProducerTest, TestPulledEventsWithSlicedCondition) {
+//    const int conditionTag = 65;
+//    GaugeMetric metric;
+//    metric.set_id(1111111);
+//    metric.set_bucket(ONE_MINUTE);
+//    metric.mutable_gauge_fields_filter()->set_include_all(true);
+//    metric.set_condition(StringToId("APP_DIED"));
+//    metric.set_max_pull_delay_sec(INT_MAX);
+//    auto dim = metric.mutable_dimensions_in_what();
+//    dim->set_field(tagId);
+//    dim->add_child()->set_field(1);
+//
+//    UidMap uidMap;
+//    SimpleAtomMatcher atomMatcher;
+//    atomMatcher.set_atom_id(tagId);
+//    sp<EventMatcherWizard> eventMatcherWizard = new EventMatcherWizard({
+//        new SimpleLogMatchingTracker(atomMatcherId, logEventMatcherIndex, atomMatcher, uidMap)});
+//
+//    sp<MockConditionWizard> wizard = new NaggyMock<MockConditionWizard>();
+//    EXPECT_CALL(*wizard, query(_, _, _))
+//            .WillRepeatedly(
+//                    Invoke([](const int conditionIndex, const ConditionKey& conditionParameters,
+//                              const bool isPartialLink) {
+//                        int pos[] = {1, 0, 0};
+//                        Field f(conditionTag, pos, 0);
+//                        HashableDimensionKey key;
+//                        key.mutableValues()->emplace_back(f, Value((int32_t)1000000));
+//
+//                        return ConditionState::kTrue;
+//                    }));
+//
+//    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
+//    EXPECT_CALL(*pullerManager, RegisterReceiver(tagId, _, _, _)).WillOnce(Return());
+//    EXPECT_CALL(*pullerManager, UnRegisterReceiver(tagId, _)).WillOnce(Return());
+//    EXPECT_CALL(*pullerManager, Pull(tagId, _))
+//            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
+//                data->clear();
+//                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucketStartTimeNs + 10);
+//                event->write(1000);
+//                event->write(100);
+//                event->init();
+//                data->push_back(event);
+//                return true;
+//            }));
+//
+//    GaugeMetricProducer gaugeProducer(kConfigKey, metric, 1, wizard,
+//                                      logEventMatcherIndex, eventMatcherWizard, tagId, -1, tagId,
+//                                      bucketStartTimeNs, bucketStartTimeNs, pullerManager);
+//
+//    gaugeProducer.onSlicedConditionMayChange(true, bucketStartTimeNs + 8);
+//
+//    EXPECT_EQ(1UL, gaugeProducer.mCurrentSlicedBucket->size());
+//    const auto& key = gaugeProducer.mCurrentSlicedBucket->begin()->first;
+//    EXPECT_EQ(1UL, key.getDimensionKeyInWhat().getValues().size());
+//    EXPECT_EQ(1000, key.getDimensionKeyInWhat().getValues()[0].mValue.int_value);
+//
+//    EXPECT_EQ(0UL, gaugeProducer.mPastBuckets.size());
+//
+//    vector<shared_ptr<LogEvent>> allData;
+//    allData.clear();
+//    shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucket2StartTimeNs + 1);
+//    event->write(1000);
+//    event->write(110);
+//    event->init();
+//    allData.push_back(event);
+//    gaugeProducer.onDataPulled(allData, /** succeed */ true, bucket2StartTimeNs);
+//
+//    EXPECT_EQ(1UL, gaugeProducer.mCurrentSlicedBucket->size());
+//    EXPECT_EQ(1UL, gaugeProducer.mPastBuckets.size());
+//}
+//
+//TEST(GaugeMetricProducerTest, TestPulledEventsAnomalyDetection) {
+//    sp<AlarmMonitor> alarmMonitor;
+//    sp<MockConditionWizard> wizard = new NaggyMock<MockConditionWizard>();
+//
+//    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
+//    EXPECT_CALL(*pullerManager, RegisterReceiver(tagId, _, _, _)).WillOnce(Return());
+//    EXPECT_CALL(*pullerManager, UnRegisterReceiver(tagId, _)).WillOnce(Return());
+//    EXPECT_CALL(*pullerManager, Pull(tagId, _)).WillOnce(Return(false));
+//
+//    GaugeMetric metric;
+//    metric.set_id(metricId);
+//    metric.set_bucket(ONE_MINUTE);
+//    metric.set_max_pull_delay_sec(INT_MAX);
+//    auto gaugeFieldMatcher = metric.mutable_gauge_fields_filter()->mutable_fields();
+//    gaugeFieldMatcher->set_field(tagId);
+//    gaugeFieldMatcher->add_child()->set_field(2);
+//
+//    UidMap uidMap;
+//    SimpleAtomMatcher atomMatcher;
+//    atomMatcher.set_atom_id(tagId);
+//    sp<EventMatcherWizard> eventMatcherWizard = new EventMatcherWizard({
+//        new SimpleLogMatchingTracker(atomMatcherId, logEventMatcherIndex, atomMatcher, uidMap)});
+//
+//    GaugeMetricProducer gaugeProducer(kConfigKey, metric, -1 /*-1 meaning no condition*/, wizard,
+//                                      logEventMatcherIndex, eventMatcherWizard,
+//                                      tagId, -1, tagId, bucketStartTimeNs, bucketStartTimeNs,
+//                                      pullerManager);
+//
+//    Alert alert;
+//    alert.set_id(101);
+//    alert.set_metric_id(metricId);
+//    alert.set_trigger_if_sum_gt(25);
+//    alert.set_num_buckets(2);
+//    const int32_t refPeriodSec = 60;
+//    alert.set_refractory_period_secs(refPeriodSec);
+//    sp<AnomalyTracker> anomalyTracker = gaugeProducer.addAnomalyTracker(alert, alarmMonitor);
+//
+//    int tagId = 1;
+//    std::shared_ptr<LogEvent> event1 = std::make_shared<LogEvent>(tagId, bucketStartTimeNs + 1);
+//    event1->write("some value");
+//    event1->write(13);
+//    event1->init();
+//
+//    gaugeProducer.onDataPulled({event1}, /** succeed */ true, bucketStartTimeNs);
+//    EXPECT_EQ(1UL, gaugeProducer.mCurrentSlicedBucket->size());
+//    EXPECT_EQ(13L, gaugeProducer.mCurrentSlicedBucket->begin()
+//                           ->second.front()
+//                           .mFields->begin()
+//                           ->mValue.int_value);
+//    EXPECT_EQ(anomalyTracker->getRefractoryPeriodEndsSec(DEFAULT_METRIC_DIMENSION_KEY), 0U);
+//
+//    std::shared_ptr<LogEvent> event2 =
+//            std::make_shared<LogEvent>(tagId, bucketStartTimeNs + bucketSizeNs + 20);
+//    event2->write("some value");
+//    event2->write(15);
+//    event2->init();
+//
+//    gaugeProducer.onDataPulled({event2}, /** succeed */ true, bucketStartTimeNs + bucketSizeNs);
+//    EXPECT_EQ(1UL, gaugeProducer.mCurrentSlicedBucket->size());
+//    EXPECT_EQ(15L, gaugeProducer.mCurrentSlicedBucket->begin()
+//                           ->second.front()
+//                           .mFields->begin()
+//                           ->mValue.int_value);
+//    EXPECT_EQ(anomalyTracker->getRefractoryPeriodEndsSec(DEFAULT_METRIC_DIMENSION_KEY),
+//              std::ceil(1.0 * event2->GetElapsedTimestampNs() / NS_PER_SEC) + refPeriodSec);
+//
+//    std::shared_ptr<LogEvent> event3 =
+//            std::make_shared<LogEvent>(tagId, bucketStartTimeNs + 2 * bucketSizeNs + 10);
+//    event3->write("some value");
+//    event3->write(26);
+//    event3->init();
+//
+//    gaugeProducer.onDataPulled({event3}, /** succeed */ true, bucket2StartTimeNs + 2 * bucketSizeNs);
+//    EXPECT_EQ(1UL, gaugeProducer.mCurrentSlicedBucket->size());
+//    EXPECT_EQ(26L, gaugeProducer.mCurrentSlicedBucket->begin()
+//                           ->second.front()
+//                           .mFields->begin()
+//                           ->mValue.int_value);
+//    EXPECT_EQ(anomalyTracker->getRefractoryPeriodEndsSec(DEFAULT_METRIC_DIMENSION_KEY),
+//              std::ceil(1.0 * event2->GetElapsedTimestampNs() / NS_PER_SEC + refPeriodSec));
+//
+//    // The event4 does not have the gauge field. Thus the current bucket value is 0.
+//    std::shared_ptr<LogEvent> event4 =
+//            std::make_shared<LogEvent>(tagId, bucketStartTimeNs + 3 * bucketSizeNs + 10);
+//    event4->write("some value");
+//    event4->init();
+//    gaugeProducer.onDataPulled({event4}, /** succeed */ true, bucketStartTimeNs + 3 * bucketSizeNs);
+//    EXPECT_EQ(1UL, gaugeProducer.mCurrentSlicedBucket->size());
+//    EXPECT_TRUE(gaugeProducer.mCurrentSlicedBucket->begin()->second.front().mFields->empty());
+//}
+//
+//TEST(GaugeMetricProducerTest, TestPullOnTrigger) {
+//    GaugeMetric metric;
+//    metric.set_id(metricId);
+//    metric.set_bucket(ONE_MINUTE);
+//    metric.set_sampling_type(GaugeMetric::FIRST_N_SAMPLES);
+//    metric.mutable_gauge_fields_filter()->set_include_all(false);
+//    metric.set_max_pull_delay_sec(INT_MAX);
+//    auto gaugeFieldMatcher = metric.mutable_gauge_fields_filter()->mutable_fields();
+//    gaugeFieldMatcher->set_field(tagId);
+//    gaugeFieldMatcher->add_child()->set_field(1);
+//
+//    sp<MockConditionWizard> wizard = new NaggyMock<MockConditionWizard>();
+//
+//    UidMap uidMap;
+//    SimpleAtomMatcher atomMatcher;
+//    atomMatcher.set_atom_id(tagId);
+//    sp<EventMatcherWizard> eventMatcherWizard = new EventMatcherWizard({
+//        new SimpleLogMatchingTracker(atomMatcherId, logEventMatcherIndex, atomMatcher, uidMap)});
+//
+//    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
+//    EXPECT_CALL(*pullerManager, Pull(tagId, _))
+//            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
+//                data->clear();
+//                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucketStartTimeNs + 10);
+//                event->write(4);
+//                event->init();
+//                data->push_back(event);
+//                return true;
+//            }))
+//            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
+//                data->clear();
+//                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucketStartTimeNs + 20);
+//                event->write(5);
+//                event->init();
+//                data->push_back(event);
+//                return true;
+//            }))
+//            .WillOnce(Return(true));
+//
+//    int triggerId = 5;
+//    GaugeMetricProducer gaugeProducer(kConfigKey, metric, -1 /*-1 meaning no condition*/, wizard,
+//                                      logEventMatcherIndex, eventMatcherWizard,
+//                                      tagId, triggerId, tagId, bucketStartTimeNs, bucketStartTimeNs,
+//                                      pullerManager);
+//
+//    vector<shared_ptr<LogEvent>> allData;
+//
+//    EXPECT_EQ(0UL, gaugeProducer.mCurrentSlicedBucket->size());
+//    LogEvent trigger(triggerId, bucketStartTimeNs + 10);
+//    trigger.init();
+//    gaugeProducer.onMatchedLogEvent(1 /*log matcher index*/, trigger);
+//    EXPECT_EQ(1UL, gaugeProducer.mCurrentSlicedBucket->begin()->second.size());
+//    trigger.setElapsedTimestampNs(bucketStartTimeNs + 20);
+//    gaugeProducer.onMatchedLogEvent(1 /*log matcher index*/, trigger);
+//    EXPECT_EQ(2UL, gaugeProducer.mCurrentSlicedBucket->begin()->second.size());
+//    trigger.setElapsedTimestampNs(bucket2StartTimeNs + 1);
+//    gaugeProducer.onMatchedLogEvent(1 /*log matcher index*/, trigger);
+//
+//    EXPECT_EQ(1UL, gaugeProducer.mPastBuckets.size());
+//    EXPECT_EQ(2UL, gaugeProducer.mPastBuckets.begin()->second.back().mGaugeAtoms.size());
+//    EXPECT_EQ(4, gaugeProducer.mPastBuckets.begin()
+//                         ->second.back()
+//                         .mGaugeAtoms[0]
+//                         .mFields->begin()
+//                         ->mValue.int_value);
+//    EXPECT_EQ(5, gaugeProducer.mPastBuckets.begin()
+//                         ->second.back()
+//                         .mGaugeAtoms[1]
+//                         .mFields->begin()
+//                         ->mValue.int_value);
+//}
+//
+//TEST(GaugeMetricProducerTest, TestRemoveDimensionInOutput) {
+//    GaugeMetric metric;
+//    metric.set_id(metricId);
+//    metric.set_bucket(ONE_MINUTE);
+//    metric.set_sampling_type(GaugeMetric::FIRST_N_SAMPLES);
+//    metric.mutable_gauge_fields_filter()->set_include_all(true);
+//    metric.set_max_pull_delay_sec(INT_MAX);
+//    auto dimensionMatcher = metric.mutable_dimensions_in_what();
+//    // use field 1 as dimension.
+//    dimensionMatcher->set_field(tagId);
+//    dimensionMatcher->add_child()->set_field(1);
+//
+//    sp<MockConditionWizard> wizard = new NaggyMock<MockConditionWizard>();
+//
+//    UidMap uidMap;
+//    SimpleAtomMatcher atomMatcher;
+//    atomMatcher.set_atom_id(tagId);
+//    sp<EventMatcherWizard> eventMatcherWizard = new EventMatcherWizard({
+//        new SimpleLogMatchingTracker(atomMatcherId, logEventMatcherIndex, atomMatcher, uidMap)});
+//
+//    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
+//    EXPECT_CALL(*pullerManager, Pull(tagId, _))
+//            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
+//                data->clear();
+//                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucketStartTimeNs + 3);
+//                event->write(3);
+//                event->write(4);
+//                event->init();
+//                data->push_back(event);
+//                return true;
+//            }))
+//            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
+//                data->clear();
+//                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucketStartTimeNs + 10);
+//                event->write(4);
+//                event->write(5);
+//                event->init();
+//                data->push_back(event);
+//                return true;
+//            }))
+//            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
+//                data->clear();
+//                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucketStartTimeNs + 20);
+//                event->write(4);
+//                event->write(6);
+//                event->init();
+//                data->push_back(event);
+//                return true;
+//            }))
+//            .WillOnce(Return(true));
+//
+//    int triggerId = 5;
+//    GaugeMetricProducer gaugeProducer(kConfigKey, metric, -1 /*-1 meaning no condition*/, wizard,
+//                                      logEventMatcherIndex, eventMatcherWizard,
+//                                      tagId, triggerId, tagId, bucketStartTimeNs, bucketStartTimeNs,
+//                                      pullerManager);
+//
+//    vector<shared_ptr<LogEvent>> allData;
+//
+//    LogEvent trigger(triggerId, bucketStartTimeNs + 3);
+//    trigger.init();
+//    gaugeProducer.onMatchedLogEvent(1 /*log matcher index*/, trigger);
+//    EXPECT_EQ(1UL, gaugeProducer.mCurrentSlicedBucket->size());
+//    trigger.setElapsedTimestampNs(bucketStartTimeNs + 10);
+//    gaugeProducer.onMatchedLogEvent(1 /*log matcher index*/, trigger);
+//    EXPECT_EQ(2UL, gaugeProducer.mCurrentSlicedBucket->size());
+//    EXPECT_EQ(1UL, gaugeProducer.mCurrentSlicedBucket->begin()->second.size());
+//    trigger.setElapsedTimestampNs(bucketStartTimeNs + 20);
+//    gaugeProducer.onMatchedLogEvent(1 /*log matcher index*/, trigger);
+//    EXPECT_EQ(2UL, gaugeProducer.mCurrentSlicedBucket->begin()->second.size());
+//    trigger.setElapsedTimestampNs(bucket2StartTimeNs + 1);
+//    gaugeProducer.onMatchedLogEvent(1 /*log matcher index*/, trigger);
+//
+//    EXPECT_EQ(2UL, gaugeProducer.mPastBuckets.size());
+//    auto bucketIt = gaugeProducer.mPastBuckets.begin();
+//    EXPECT_EQ(1UL, bucketIt->second.back().mGaugeAtoms.size());
+//    EXPECT_EQ(3, bucketIt->first.getDimensionKeyInWhat().getValues().begin()->mValue.int_value);
+//    EXPECT_EQ(4, bucketIt->second.back().mGaugeAtoms[0].mFields->begin()->mValue.int_value);
+//    bucketIt++;
+//    EXPECT_EQ(2UL, bucketIt->second.back().mGaugeAtoms.size());
+//    EXPECT_EQ(4, bucketIt->first.getDimensionKeyInWhat().getValues().begin()->mValue.int_value);
+//    EXPECT_EQ(5, bucketIt->second.back().mGaugeAtoms[0].mFields->begin()->mValue.int_value);
+//    EXPECT_EQ(6, bucketIt->second.back().mGaugeAtoms[1].mFields->begin()->mValue.int_value);
+//}
+//
+///*
+// * Test that BUCKET_TOO_SMALL dump reason is logged when a flushed bucket size
+// * is smaller than the "min_bucket_size_nanos" specified in the metric config.
+// */
+//TEST(GaugeMetricProducerTest_BucketDrop, TestBucketDropWhenBucketTooSmall) {
+//    GaugeMetric metric;
+//    metric.set_id(metricId);
+//    metric.set_bucket(FIVE_MINUTES);
+//    metric.set_sampling_type(GaugeMetric::FIRST_N_SAMPLES);
+//    metric.set_min_bucket_size_nanos(10000000000);  // 10 seconds
+//
+//    sp<MockConditionWizard> wizard = new NaggyMock<MockConditionWizard>();
+//
+//    UidMap uidMap;
+//    SimpleAtomMatcher atomMatcher;
+//    atomMatcher.set_atom_id(tagId);
+//    sp<EventMatcherWizard> eventMatcherWizard = new EventMatcherWizard({
+//        new SimpleLogMatchingTracker(atomMatcherId, logEventMatcherIndex, atomMatcher, uidMap)});
+//
+//    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
+//    EXPECT_CALL(*pullerManager, Pull(tagId, _))
+//            // Bucket start.
+//            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
+//                data->clear();
+//                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucketStartTimeNs);
+//                event->write("field1");
+//                event->write(10);
+//                event->init();
+//                data->push_back(event);
+//                return true;
+//            }));
+//
+//    int triggerId = 5;
+//    GaugeMetricProducer gaugeProducer(kConfigKey, metric, -1 /*-1 meaning no condition*/, wizard,
+//                                      logEventMatcherIndex, eventMatcherWizard,
+//                                      tagId, triggerId, tagId, bucketStartTimeNs, bucketStartTimeNs,
+//                                      pullerManager);
+//
+//    LogEvent trigger(triggerId, bucketStartTimeNs + 3);
+//    trigger.init();
+//    gaugeProducer.onMatchedLogEvent(1 /*log matcher index*/, trigger);
+//
+//    // Check dump report.
+//    ProtoOutputStream output;
+//    std::set<string> strSet;
+//    gaugeProducer.onDumpReport(bucketStartTimeNs + 9000000, true /* include recent buckets */,
+//                                true, FAST /* dump_latency */, &strSet, &output);
+//
+//    StatsLogReport report = outputStreamToProto(&output);
+//    EXPECT_TRUE(report.has_gauge_metrics());
+//    EXPECT_EQ(0, report.gauge_metrics().data_size());
+//    EXPECT_EQ(1, report.gauge_metrics().skipped_size());
+//
+//    EXPECT_EQ(NanoToMillis(bucketStartTimeNs),
+//              report.gauge_metrics().skipped(0).start_bucket_elapsed_millis());
+//    EXPECT_EQ(NanoToMillis(bucketStartTimeNs + 9000000),
+//              report.gauge_metrics().skipped(0).end_bucket_elapsed_millis());
+//    EXPECT_EQ(1, report.gauge_metrics().skipped(0).drop_event_size());
+//
+//    auto dropEvent = report.gauge_metrics().skipped(0).drop_event(0);
+//    EXPECT_EQ(BucketDropReason::BUCKET_TOO_SMALL, dropEvent.drop_reason());
+//    EXPECT_EQ(NanoToMillis(bucketStartTimeNs + 9000000), dropEvent.drop_time_millis());
+//}
 
 }  // namespace statsd
 }  // namespace os
diff --git a/cmds/statsd/tests/metrics/ValueMetricProducer_test.cpp b/cmds/statsd/tests/metrics/ValueMetricProducer_test.cpp
index f6245ac..e48f378 100644
--- a/cmds/statsd/tests/metrics/ValueMetricProducer_test.cpp
+++ b/cmds/statsd/tests/metrics/ValueMetricProducer_test.cpp
@@ -79,4533 +79,4535 @@
     }
 }
 
-class ValueMetricProducerTestHelper {
-
- public:
-    static shared_ptr<LogEvent> createEvent(int64_t eventTimeNs, int64_t value) {
-        shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, eventTimeNs);
-        event->write(tagId);
-        event->write(value);
-        event->write(value);
-        event->init();
-        return event;
-    }
-
-    static sp<ValueMetricProducer> createValueProducerNoConditions(
-            sp<MockStatsPullerManager>& pullerManager, ValueMetric& metric) {
-        UidMap uidMap;
-        SimpleAtomMatcher atomMatcher;
-        atomMatcher.set_atom_id(tagId);
-        sp<EventMatcherWizard> eventMatcherWizard =
-                new EventMatcherWizard({new SimpleLogMatchingTracker(
-                        atomMatcherId, logEventMatcherIndex, atomMatcher, uidMap)});
-        sp<MockConditionWizard> wizard = new NaggyMock<MockConditionWizard>();
-        EXPECT_CALL(*pullerManager, RegisterReceiver(tagId, _, _, _)).WillOnce(Return());
-        EXPECT_CALL(*pullerManager, UnRegisterReceiver(tagId, _)).WillRepeatedly(Return());
-
-        sp<ValueMetricProducer> valueProducer = new ValueMetricProducer(
-                kConfigKey, metric, -1 /*-1 meaning no condition*/, wizard,
-                logEventMatcherIndex, eventMatcherWizard, tagId,
-                bucketStartTimeNs, bucketStartTimeNs, pullerManager);
-        return valueProducer;
-    }
-
-    static sp<ValueMetricProducer> createValueProducerWithCondition(
-            sp<MockStatsPullerManager>& pullerManager, ValueMetric& metric) {
-        UidMap uidMap;
-        SimpleAtomMatcher atomMatcher;
-        atomMatcher.set_atom_id(tagId);
-        sp<EventMatcherWizard> eventMatcherWizard =
-                new EventMatcherWizard({new SimpleLogMatchingTracker(
-                        atomMatcherId, logEventMatcherIndex, atomMatcher, uidMap)});
-        sp<MockConditionWizard> wizard = new NaggyMock<MockConditionWizard>();
-        EXPECT_CALL(*pullerManager, RegisterReceiver(tagId, _, _, _)).WillOnce(Return());
-        EXPECT_CALL(*pullerManager, UnRegisterReceiver(tagId, _)).WillRepeatedly(Return());
-
-        sp<ValueMetricProducer> valueProducer =
-                new ValueMetricProducer(kConfigKey, metric, 1, wizard, logEventMatcherIndex,
-                                        eventMatcherWizard, tagId, bucketStartTimeNs,
-                                        bucketStartTimeNs, pullerManager);
-        valueProducer->mCondition = ConditionState::kFalse;
-        return valueProducer;
-    }
-
-    static sp<ValueMetricProducer> createValueProducerWithNoInitialCondition(
-            sp<MockStatsPullerManager>& pullerManager, ValueMetric& metric) {
-        UidMap uidMap;
-        SimpleAtomMatcher atomMatcher;
-        atomMatcher.set_atom_id(tagId);
-        sp<EventMatcherWizard> eventMatcherWizard =
-                new EventMatcherWizard({new SimpleLogMatchingTracker(
-                        atomMatcherId, logEventMatcherIndex, atomMatcher, uidMap)});
-        sp<MockConditionWizard> wizard = new NaggyMock<MockConditionWizard>();
-        EXPECT_CALL(*pullerManager, RegisterReceiver(tagId, _, _, _)).WillOnce(Return());
-        EXPECT_CALL(*pullerManager, UnRegisterReceiver(tagId, _)).WillRepeatedly(Return());
-
-        sp<ValueMetricProducer> valueProducer = new ValueMetricProducer(
-                kConfigKey, metric, 1, wizard, logEventMatcherIndex, eventMatcherWizard, tagId,
-                bucketStartTimeNs, bucketStartTimeNs, pullerManager);
-        return valueProducer;
-    }
-
-    static sp<ValueMetricProducer> createValueProducerWithState(
-            sp<MockStatsPullerManager>& pullerManager, ValueMetric& metric,
-            vector<int32_t> slicedStateAtoms,
-            unordered_map<int, unordered_map<int, int64_t>> stateGroupMap) {
-        UidMap uidMap;
-        SimpleAtomMatcher atomMatcher;
-        atomMatcher.set_atom_id(tagId);
-        sp<EventMatcherWizard> eventMatcherWizard =
-                new EventMatcherWizard({new SimpleLogMatchingTracker(
-                        atomMatcherId, logEventMatcherIndex, atomMatcher, uidMap)});
-        sp<MockConditionWizard> wizard = new NaggyMock<MockConditionWizard>();
-        EXPECT_CALL(*pullerManager, RegisterReceiver(tagId, _, _, _)).WillOnce(Return());
-        EXPECT_CALL(*pullerManager, UnRegisterReceiver(tagId, _)).WillRepeatedly(Return());
-        sp<ValueMetricProducer> valueProducer = new ValueMetricProducer(
-                kConfigKey, metric, -1 /* no condition */, wizard, logEventMatcherIndex,
-                eventMatcherWizard, tagId, bucketStartTimeNs, bucketStartTimeNs, pullerManager, {},
-                {}, slicedStateAtoms, stateGroupMap);
-        return valueProducer;
-    }
-
-    static ValueMetric createMetric() {
-        ValueMetric metric;
-        metric.set_id(metricId);
-        metric.set_bucket(ONE_MINUTE);
-        metric.mutable_value_field()->set_field(tagId);
-        metric.mutable_value_field()->add_child()->set_field(2);
-        metric.set_max_pull_delay_sec(INT_MAX);
-        return metric;
-    }
-
-    static ValueMetric createMetricWithCondition() {
-        ValueMetric metric = ValueMetricProducerTestHelper::createMetric();
-        metric.set_condition(StringToId("SCREEN_ON"));
-        return metric;
-    }
-
-    static ValueMetric createMetricWithState(string state) {
-        ValueMetric metric = ValueMetricProducerTestHelper::createMetric();
-        metric.add_slice_by_state(StringToId(state));
-        return metric;
-    }
-};
-
-/*
- * Tests that the first bucket works correctly
- */
-TEST(ValueMetricProducerTest, TestCalcPreviousBucketEndTime) {
-    ValueMetric metric = ValueMetricProducerTestHelper::createMetric();
-
-    int64_t startTimeBase = 11;
-    UidMap uidMap;
-    SimpleAtomMatcher atomMatcher;
-    atomMatcher.set_atom_id(tagId);
-    sp<EventMatcherWizard> eventMatcherWizard =
-            new EventMatcherWizard({new SimpleLogMatchingTracker(
-                    atomMatcherId, logEventMatcherIndex, atomMatcher, uidMap)});
-    sp<MockConditionWizard> wizard = new NaggyMock<MockConditionWizard>();
-    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
-
-    // statsd started long ago.
-    // The metric starts in the middle of the bucket
-    ValueMetricProducer valueProducer(kConfigKey, metric, -1 /*-1 meaning no condition*/, wizard,
-                                      logEventMatcherIndex, eventMatcherWizard, -1, startTimeBase,
-                                      22, pullerManager);
-
-    EXPECT_EQ(startTimeBase, valueProducer.calcPreviousBucketEndTime(60 * NS_PER_SEC + 10));
-    EXPECT_EQ(startTimeBase, valueProducer.calcPreviousBucketEndTime(60 * NS_PER_SEC + 10));
-    EXPECT_EQ(60 * NS_PER_SEC + startTimeBase,
-              valueProducer.calcPreviousBucketEndTime(2 * 60 * NS_PER_SEC));
-    EXPECT_EQ(2 * 60 * NS_PER_SEC + startTimeBase,
-              valueProducer.calcPreviousBucketEndTime(3 * 60 * NS_PER_SEC));
-}
-
-/*
- * Tests that the first bucket works correctly
- */
-TEST(ValueMetricProducerTest, TestFirstBucket) {
-    ValueMetric metric = ValueMetricProducerTestHelper::createMetric();
-
-    UidMap uidMap;
-    SimpleAtomMatcher atomMatcher;
-    atomMatcher.set_atom_id(tagId);
-    sp<EventMatcherWizard> eventMatcherWizard =
-            new EventMatcherWizard({new SimpleLogMatchingTracker(
-                    atomMatcherId, logEventMatcherIndex, atomMatcher, uidMap)});
-    sp<MockConditionWizard> wizard = new NaggyMock<MockConditionWizard>();
-    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
-
-    // statsd started long ago.
-    // The metric starts in the middle of the bucket
-    ValueMetricProducer valueProducer(kConfigKey, metric, -1 /*-1 meaning no condition*/, wizard,
-                                      logEventMatcherIndex, eventMatcherWizard, -1, 5,
-                                      600 * NS_PER_SEC + NS_PER_SEC / 2, pullerManager);
-
-    EXPECT_EQ(600500000000, valueProducer.mCurrentBucketStartTimeNs);
-    EXPECT_EQ(10, valueProducer.mCurrentBucketNum);
-    EXPECT_EQ(660000000005, valueProducer.getCurrentBucketEndTimeNs());
-}
-
-/*
- * Tests pulled atoms with no conditions
- */
-TEST(ValueMetricProducerTest, TestPulledEventsNoCondition) {
-    ValueMetric metric = ValueMetricProducerTestHelper::createMetric();
-    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
-    EXPECT_CALL(*pullerManager, Pull(tagId, _))
-            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
-                data->clear();
-                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucketStartTimeNs);
-                event->write(tagId);
-                event->write(3);
-                event->init();
-                data->push_back(event);
-                return true;
-            }));
-
-    sp<ValueMetricProducer> valueProducer =
-            ValueMetricProducerTestHelper::createValueProducerNoConditions(pullerManager, metric);
-
-    vector<shared_ptr<LogEvent>> allData;
-    allData.clear();
-    shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucket2StartTimeNs + 1);
-    event->write(tagId);
-    event->write(11);
-    event->init();
-    allData.push_back(event);
-
-    valueProducer->onDataPulled(allData, /** succeed */ true, bucket2StartTimeNs);
-    // has one slice
-    EXPECT_EQ(1UL, valueProducer->mCurrentSlicedBucket.size());
-    ValueMetricProducer::Interval curInterval =
-            valueProducer->mCurrentSlicedBucket.begin()->second[0];
-    ValueMetricProducer::BaseInfo curBaseInfo = valueProducer->mCurrentBaseInfo.begin()->second[0];
-
-    EXPECT_EQ(true, curBaseInfo.hasBase);
-    EXPECT_EQ(11, curBaseInfo.base.long_value);
-    EXPECT_EQ(false, curInterval.hasValue);
-    EXPECT_EQ(8, curInterval.value.long_value);
-    EXPECT_EQ(1UL, valueProducer->mPastBuckets.size());
-    EXPECT_EQ(8, valueProducer->mPastBuckets.begin()->second[0].values[0].long_value);
-    EXPECT_EQ(bucketSizeNs, valueProducer->mPastBuckets.begin()->second[0].mConditionTrueNs);
-
-    allData.clear();
-    event = make_shared<LogEvent>(tagId, bucket3StartTimeNs + 1);
-    event->write(tagId);
-    event->write(23);
-    event->init();
-    allData.push_back(event);
-    valueProducer->onDataPulled(allData, /** succeed */ true, bucket3StartTimeNs);
-    // has one slice
-    EXPECT_EQ(1UL, valueProducer->mCurrentSlicedBucket.size());
-    curInterval = valueProducer->mCurrentSlicedBucket.begin()->second[0];
-    curBaseInfo = valueProducer->mCurrentBaseInfo.begin()->second[0];
-
-    EXPECT_EQ(true, curBaseInfo.hasBase);
-    EXPECT_EQ(23, curBaseInfo.base.long_value);
-    EXPECT_EQ(false, curInterval.hasValue);
-    EXPECT_EQ(12, curInterval.value.long_value);
-    EXPECT_EQ(1UL, valueProducer->mPastBuckets.size());
-    EXPECT_EQ(2UL, valueProducer->mPastBuckets.begin()->second.size());
-    EXPECT_EQ(8, valueProducer->mPastBuckets.begin()->second[0].values[0].long_value);
-    EXPECT_EQ(bucketSizeNs, valueProducer->mPastBuckets.begin()->second[0].mConditionTrueNs);
-    EXPECT_EQ(12, valueProducer->mPastBuckets.begin()->second.back().values[0].long_value);
-    EXPECT_EQ(bucketSizeNs, valueProducer->mPastBuckets.begin()->second.back().mConditionTrueNs);
-
-    allData.clear();
-    event = make_shared<LogEvent>(tagId, bucket4StartTimeNs + 1);
-    event->write(tagId);
-    event->write(36);
-    event->init();
-    allData.push_back(event);
-    valueProducer->onDataPulled(allData, /** succeed */ true, bucket4StartTimeNs);
-    EXPECT_EQ(1UL, valueProducer->mCurrentSlicedBucket.size());
-    curInterval = valueProducer->mCurrentSlicedBucket.begin()->second[0];
-    curBaseInfo = valueProducer->mCurrentBaseInfo.begin()->second[0];
-
-    EXPECT_EQ(true, curBaseInfo.hasBase);
-    EXPECT_EQ(36, curBaseInfo.base.long_value);
-    EXPECT_EQ(false, curInterval.hasValue);
-    EXPECT_EQ(13, curInterval.value.long_value);
-    EXPECT_EQ(1UL, valueProducer->mPastBuckets.size());
-    EXPECT_EQ(3UL, valueProducer->mPastBuckets.begin()->second.size());
-    EXPECT_EQ(8, valueProducer->mPastBuckets.begin()->second[0].values[0].long_value);
-    EXPECT_EQ(bucketSizeNs, valueProducer->mPastBuckets.begin()->second[0].mConditionTrueNs);
-    EXPECT_EQ(12, valueProducer->mPastBuckets.begin()->second[1].values[0].long_value);
-    EXPECT_EQ(bucketSizeNs, valueProducer->mPastBuckets.begin()->second[1].mConditionTrueNs);
-    EXPECT_EQ(13, valueProducer->mPastBuckets.begin()->second[2].values[0].long_value);
-    EXPECT_EQ(bucketSizeNs, valueProducer->mPastBuckets.begin()->second[2].mConditionTrueNs);
-}
-
-TEST(ValueMetricProducerTest, TestPartialBucketCreated) {
-    ValueMetric metric = ValueMetricProducerTestHelper::createMetric();
-    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
-    EXPECT_CALL(*pullerManager, Pull(tagId, _))
-            // Initialize bucket.
-            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
-                data->clear();
-                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucketStartTimeNs + 1);
-                event->write(tagId);
-                event->write(1);
-                event->init();
-                data->push_back(event);
-                return true;
-            }))
-            // Partial bucket.
-            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
-                data->clear();
-                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucket2StartTimeNs + 10);
-                event->write(tagId);
-                event->write(5);
-                event->init();
-                data->push_back(event);
-                return true;
-            }));
-
-    sp<ValueMetricProducer> valueProducer =
-            ValueMetricProducerTestHelper::createValueProducerNoConditions(pullerManager, metric);
-
-    // First bucket ends.
-    vector<shared_ptr<LogEvent>> allData;
-    allData.clear();
-    shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucket2StartTimeNs + 10);
-    event->write(tagId);
-    event->write(2);
-    event->init();
-    allData.push_back(event);
-    valueProducer->onDataPulled(allData, /** success */ true, bucket2StartTimeNs);
-
-    // Partial buckets created in 2nd bucket.
-    valueProducer->notifyAppUpgrade(bucket2StartTimeNs + 2, "com.foo", 10000, 1);
-
-    // One full bucket and one partial bucket.
-    EXPECT_EQ(1UL, valueProducer->mPastBuckets.size());
-    vector<ValueBucket> buckets = valueProducer->mPastBuckets.begin()->second;
-    EXPECT_EQ(2UL, buckets.size());
-    // Full bucket (2 - 1)
-    EXPECT_EQ(1, buckets[0].values[0].long_value);
-    EXPECT_EQ(bucketSizeNs, buckets[0].mConditionTrueNs);
-    // Full bucket (5 - 3)
-    EXPECT_EQ(3, buckets[1].values[0].long_value);
-    // partial bucket [bucket2StartTimeNs, bucket2StartTimeNs + 2]
-    EXPECT_EQ(2, buckets[1].mConditionTrueNs);
-}
-
-/*
- * Tests pulled atoms with filtering
- */
-TEST(ValueMetricProducerTest, TestPulledEventsWithFiltering) {
-    ValueMetric metric = ValueMetricProducerTestHelper::createMetric();
-
-    UidMap uidMap;
-    SimpleAtomMatcher atomMatcher;
-    atomMatcher.set_atom_id(tagId);
-    auto keyValue = atomMatcher.add_field_value_matcher();
-    keyValue->set_field(1);
-    keyValue->set_eq_int(3);
-    sp<EventMatcherWizard> eventMatcherWizard =
-            new EventMatcherWizard({new SimpleLogMatchingTracker(
-                    atomMatcherId, logEventMatcherIndex, atomMatcher, uidMap)});
-    sp<MockConditionWizard> wizard = new NaggyMock<MockConditionWizard>();
-    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
-    EXPECT_CALL(*pullerManager, RegisterReceiver(tagId, _, _, _)).WillOnce(Return());
-    EXPECT_CALL(*pullerManager, UnRegisterReceiver(tagId, _)).WillOnce(Return());
-    EXPECT_CALL(*pullerManager, Pull(tagId, _))
-            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
-                data->clear();
-                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucketStartTimeNs);
-                event->write(3);
-                event->write(3);
-                event->init();
-                data->push_back(event);
-                return true;
-            }));
-
-    sp<ValueMetricProducer> valueProducer = new ValueMetricProducer(
-            kConfigKey, metric, -1 /*-1 meaning no condition*/, wizard, logEventMatcherIndex,
-            eventMatcherWizard, tagId, bucketStartTimeNs, bucketStartTimeNs, pullerManager);
-
-    vector<shared_ptr<LogEvent>> allData;
-    allData.clear();
-    shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucket2StartTimeNs + 1);
-    event->write(3);
-    event->write(11);
-    event->init();
-    allData.push_back(event);
-
-    valueProducer->onDataPulled(allData, /** succeed */ true, bucket2StartTimeNs);
-    // has one slice
-    EXPECT_EQ(1UL, valueProducer->mCurrentSlicedBucket.size());
-    ValueMetricProducer::Interval curInterval =
-            valueProducer->mCurrentSlicedBucket.begin()->second[0];
-    ValueMetricProducer::BaseInfo curBaseInfo = valueProducer->mCurrentBaseInfo.begin()->second[0];
-
-    EXPECT_EQ(true, curBaseInfo.hasBase);
-    EXPECT_EQ(11, curBaseInfo.base.long_value);
-    EXPECT_EQ(false, curInterval.hasValue);
-    EXPECT_EQ(8, curInterval.value.long_value);
-    EXPECT_EQ(1UL, valueProducer->mPastBuckets.size());
-    EXPECT_EQ(8, valueProducer->mPastBuckets.begin()->second[0].values[0].long_value);
-    EXPECT_EQ(bucketSizeNs, valueProducer->mPastBuckets.begin()->second[0].mConditionTrueNs);
-
-    allData.clear();
-    event = make_shared<LogEvent>(tagId, bucket3StartTimeNs + 1);
-    event->write(4);
-    event->write(23);
-    event->init();
-    allData.push_back(event);
-    valueProducer->onDataPulled(allData, /** succeed */ true, bucket3StartTimeNs);
-    // No new data seen, so data has been cleared.
-    EXPECT_EQ(0UL, valueProducer->mCurrentSlicedBucket.size());
-
-    EXPECT_EQ(true, curBaseInfo.hasBase);
-    EXPECT_EQ(11, curBaseInfo.base.long_value);
-    EXPECT_EQ(false, curInterval.hasValue);
-    EXPECT_EQ(8, curInterval.value.long_value);
-    EXPECT_EQ(1UL, valueProducer->mPastBuckets.size());
-    EXPECT_EQ(8, valueProducer->mPastBuckets.begin()->second[0].values[0].long_value);
-    EXPECT_EQ(bucketSizeNs, valueProducer->mPastBuckets.begin()->second[0].mConditionTrueNs);
-
-    allData.clear();
-    event = make_shared<LogEvent>(tagId, bucket4StartTimeNs + 1);
-    event->write(3);
-    event->write(36);
-    event->init();
-    allData.push_back(event);
-    valueProducer->onDataPulled(allData, /** succeed */ true, bucket4StartTimeNs);
-    EXPECT_EQ(1UL, valueProducer->mCurrentSlicedBucket.size());
-    curInterval = valueProducer->mCurrentSlicedBucket.begin()->second[0];
-    curBaseInfo = valueProducer->mCurrentBaseInfo.begin()->second[0];
-
-    // the base was reset
-    EXPECT_EQ(true, curBaseInfo.hasBase);
-    EXPECT_EQ(36, curBaseInfo.base.long_value);
-    EXPECT_EQ(false, curInterval.hasValue);
-    EXPECT_EQ(1UL, valueProducer->mPastBuckets.size());
-    EXPECT_EQ(1UL, valueProducer->mPastBuckets.begin()->second.size());
-    EXPECT_EQ(8, valueProducer->mPastBuckets.begin()->second.back().values[0].long_value);
-    EXPECT_EQ(bucketSizeNs, valueProducer->mPastBuckets.begin()->second.back().mConditionTrueNs);
-}
-
-/*
- * Tests pulled atoms with no conditions and take absolute value after reset
- */
-TEST(ValueMetricProducerTest, TestPulledEventsTakeAbsoluteValueOnReset) {
-    ValueMetric metric = ValueMetricProducerTestHelper::createMetric();
-    metric.set_use_absolute_value_on_reset(true);
-
-    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
-    EXPECT_CALL(*pullerManager, Pull(tagId, _)).WillOnce(Return(true));
-    sp<ValueMetricProducer> valueProducer =
-            ValueMetricProducerTestHelper::createValueProducerNoConditions(pullerManager, metric);
-
-    vector<shared_ptr<LogEvent>> allData;
-    allData.clear();
-    shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucket2StartTimeNs + 1);
-    event->write(tagId);
-    event->write(11);
-    event->init();
-    allData.push_back(event);
-
-    valueProducer->onDataPulled(allData, /** succeed */ true, bucket2StartTimeNs);
-    // has one slice
-    EXPECT_EQ(1UL, valueProducer->mCurrentSlicedBucket.size());
-    ValueMetricProducer::Interval curInterval = valueProducer->mCurrentSlicedBucket.begin()->second[0];
-    ValueMetricProducer::BaseInfo curBaseInfo = valueProducer->mCurrentBaseInfo.begin()->second[0];
-
-    EXPECT_EQ(true, curBaseInfo.hasBase);
-    EXPECT_EQ(11, curBaseInfo.base.long_value);
-    EXPECT_EQ(false, curInterval.hasValue);
-    EXPECT_EQ(0UL, valueProducer->mPastBuckets.size());
-
-    allData.clear();
-    event = make_shared<LogEvent>(tagId, bucket3StartTimeNs + 1);
-    event->write(tagId);
-    event->write(10);
-    event->init();
-    allData.push_back(event);
-    valueProducer->onDataPulled(allData, /** succeed */ true, bucket3StartTimeNs);
-    // has one slice
-    EXPECT_EQ(1UL, valueProducer->mCurrentSlicedBucket.size());
-    curInterval = valueProducer->mCurrentSlicedBucket.begin()->second[0];
-    curBaseInfo = valueProducer->mCurrentBaseInfo.begin()->second[0];
-    EXPECT_EQ(true, curBaseInfo.hasBase);
-    EXPECT_EQ(10, curBaseInfo.base.long_value);
-    EXPECT_EQ(false, curInterval.hasValue);
-    EXPECT_EQ(10, curInterval.value.long_value);
-    EXPECT_EQ(1UL, valueProducer->mPastBuckets.size());
-    EXPECT_EQ(10, valueProducer->mPastBuckets.begin()->second.back().values[0].long_value);
-    EXPECT_EQ(bucketSizeNs, valueProducer->mPastBuckets.begin()->second.back().mConditionTrueNs);
-
-    allData.clear();
-    event = make_shared<LogEvent>(tagId, bucket4StartTimeNs + 1);
-    event->write(tagId);
-    event->write(36);
-    event->init();
-    allData.push_back(event);
-    valueProducer->onDataPulled(allData, /** succeed */ true, bucket4StartTimeNs);
-    EXPECT_EQ(1UL, valueProducer->mCurrentSlicedBucket.size());
-    curInterval = valueProducer->mCurrentSlicedBucket.begin()->second[0];
-    curBaseInfo = valueProducer->mCurrentBaseInfo.begin()->second[0];
-    EXPECT_EQ(true, curBaseInfo.hasBase);
-    EXPECT_EQ(36, curBaseInfo.base.long_value);
-    EXPECT_EQ(false, curInterval.hasValue);
-    EXPECT_EQ(26, curInterval.value.long_value);
-    EXPECT_EQ(1UL, valueProducer->mPastBuckets.size());
-    EXPECT_EQ(2UL, valueProducer->mPastBuckets.begin()->second.size());
-    EXPECT_EQ(10, valueProducer->mPastBuckets.begin()->second[0].values[0].long_value);
-    EXPECT_EQ(bucketSizeNs, valueProducer->mPastBuckets.begin()->second[0].mConditionTrueNs);
-    EXPECT_EQ(26, valueProducer->mPastBuckets.begin()->second[1].values[0].long_value);
-    EXPECT_EQ(bucketSizeNs, valueProducer->mPastBuckets.begin()->second[1].mConditionTrueNs);
-}
-
-/*
- * Tests pulled atoms with no conditions and take zero value after reset
- */
-TEST(ValueMetricProducerTest, TestPulledEventsTakeZeroOnReset) {
-    ValueMetric metric = ValueMetricProducerTestHelper::createMetric();
-    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
-    EXPECT_CALL(*pullerManager, Pull(tagId, _)).WillOnce(Return(false));
-    sp<ValueMetricProducer> valueProducer =
-            ValueMetricProducerTestHelper::createValueProducerNoConditions(pullerManager, metric);
-
-    vector<shared_ptr<LogEvent>> allData;
-    allData.clear();
-    shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucket2StartTimeNs + 1);
-    event->write(tagId);
-    event->write(11);
-    event->init();
-    allData.push_back(event);
-
-    valueProducer->onDataPulled(allData, /** succeed */ true, bucket2StartTimeNs);
-    // has one slice
-    EXPECT_EQ(1UL, valueProducer->mCurrentSlicedBucket.size());
-    ValueMetricProducer::Interval curInterval = valueProducer->mCurrentSlicedBucket.begin()->second[0];
-    ValueMetricProducer::BaseInfo curBaseInfo = valueProducer->mCurrentBaseInfo.begin()->second[0];
-
-    EXPECT_EQ(true, curBaseInfo.hasBase);
-    EXPECT_EQ(11, curBaseInfo.base.long_value);
-    EXPECT_EQ(false, curInterval.hasValue);
-    EXPECT_EQ(0UL, valueProducer->mPastBuckets.size());
-
-    allData.clear();
-    event = make_shared<LogEvent>(tagId, bucket3StartTimeNs + 1);
-    event->write(tagId);
-    event->write(10);
-    event->init();
-    allData.push_back(event);
-    valueProducer->onDataPulled(allData, /** succeed */ true, bucket3StartTimeNs);
-    // has one slice
-    EXPECT_EQ(1UL, valueProducer->mCurrentSlicedBucket.size());
-    curInterval = valueProducer->mCurrentSlicedBucket.begin()->second[0];
-    curBaseInfo = valueProducer->mCurrentBaseInfo.begin()->second[0];
-    EXPECT_EQ(true, curBaseInfo.hasBase);
-    EXPECT_EQ(10, curBaseInfo.base.long_value);
-    EXPECT_EQ(false, curInterval.hasValue);
-    EXPECT_EQ(0UL, valueProducer->mPastBuckets.size());
-
-    allData.clear();
-    event = make_shared<LogEvent>(tagId, bucket4StartTimeNs + 1);
-    event->write(tagId);
-    event->write(36);
-    event->init();
-    allData.push_back(event);
-    valueProducer->onDataPulled(allData, /** succeed */ true, bucket4StartTimeNs);
-    EXPECT_EQ(1UL, valueProducer->mCurrentSlicedBucket.size());
-    curInterval = valueProducer->mCurrentSlicedBucket.begin()->second[0];
-    curBaseInfo = valueProducer->mCurrentBaseInfo.begin()->second[0];
-    EXPECT_EQ(true, curBaseInfo.hasBase);
-    EXPECT_EQ(36, curBaseInfo.base.long_value);
-    EXPECT_EQ(false, curInterval.hasValue);
-    EXPECT_EQ(26, curInterval.value.long_value);
-    EXPECT_EQ(1UL, valueProducer->mPastBuckets.size());
-    EXPECT_EQ(26, valueProducer->mPastBuckets.begin()->second[0].values[0].long_value);
-    EXPECT_EQ(bucketSizeNs, valueProducer->mPastBuckets.begin()->second[0].mConditionTrueNs);
-}
-
-/*
- * Test pulled event with non sliced condition.
- */
-TEST(ValueMetricProducerTest, TestEventsWithNonSlicedCondition) {
-    ValueMetric metric = ValueMetricProducerTestHelper::createMetricWithCondition();
-
-    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
-
-    EXPECT_CALL(*pullerManager, Pull(tagId, _))
-            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
-                data->clear();
-                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucketStartTimeNs + 8);
-                event->write(tagId);
-                event->write(100);
-                event->init();
-                data->push_back(event);
-                return true;
-            }))
-            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
-                data->clear();
-                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucket2StartTimeNs + 1);
-                event->write(tagId);
-                event->write(130);
-                event->init();
-                data->push_back(event);
-                return true;
-            }))
-            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
-                data->clear();
-                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucket3StartTimeNs + 1);
-                event->write(tagId);
-                event->write(180);
-                event->init();
-                data->push_back(event);
-                return true;
-            }));
-
-    sp<ValueMetricProducer> valueProducer =
-            ValueMetricProducerTestHelper::createValueProducerWithCondition(pullerManager, metric);
-
-    valueProducer->onConditionChanged(true, bucketStartTimeNs + 8);
-
-    // has one slice
-    EXPECT_EQ(1UL, valueProducer->mCurrentSlicedBucket.size());
-    ValueMetricProducer::Interval curInterval = valueProducer->mCurrentSlicedBucket.begin()->second[0];
-    ValueMetricProducer::BaseInfo curBaseInfo = valueProducer->mCurrentBaseInfo.begin()->second[0];
-    // startUpdated:false sum:0 start:100
-    EXPECT_EQ(true, curBaseInfo.hasBase);
-    EXPECT_EQ(100, curBaseInfo.base.long_value);
-    EXPECT_EQ(false, curInterval.hasValue);
-    EXPECT_EQ(0UL, valueProducer->mPastBuckets.size());
-
-    vector<shared_ptr<LogEvent>> allData;
-    allData.clear();
-    shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucket2StartTimeNs + 1);
-    event->write(1);
-    event->write(110);
-    event->init();
-    allData.push_back(event);
-    valueProducer->onDataPulled(allData, /** succeed */ true, bucket2StartTimeNs);
-    assertPastBucketValuesSingleKey(valueProducer->mPastBuckets, {10}, {bucketSizeNs - 8});
-
-    // has one slice
-    EXPECT_EQ(1UL, valueProducer->mCurrentSlicedBucket.size());
-    curInterval = valueProducer->mCurrentSlicedBucket.begin()->second[0];
-    curBaseInfo = valueProducer->mCurrentBaseInfo.begin()->second[0];
-    EXPECT_EQ(true, curBaseInfo.hasBase);
-    EXPECT_EQ(110, curBaseInfo.base.long_value);
-    EXPECT_EQ(false, curInterval.hasValue);
-    EXPECT_EQ(10, curInterval.value.long_value);
-
-    valueProducer->onConditionChanged(false, bucket2StartTimeNs + 1);
-    assertPastBucketValuesSingleKey(valueProducer->mPastBuckets, {10}, {bucketSizeNs - 8});
-
-    // has one slice
-    EXPECT_EQ(1UL, valueProducer->mCurrentSlicedBucket.size());
-    curInterval = valueProducer->mCurrentSlicedBucket.begin()->second[0];
-    curBaseInfo = valueProducer->mCurrentBaseInfo.begin()->second[0];
-    EXPECT_EQ(true, curInterval.hasValue);
-    EXPECT_EQ(20, curInterval.value.long_value);
-    EXPECT_EQ(false, curBaseInfo.hasBase);
-
-    valueProducer->onConditionChanged(true, bucket3StartTimeNs + 1);
-    assertPastBucketValuesSingleKey(valueProducer->mPastBuckets, {10, 20}, {bucketSizeNs - 8, 1});
-}
-
-TEST(ValueMetricProducerTest, TestPushedEventsWithUpgrade) {
-    ValueMetric metric = ValueMetricProducerTestHelper::createMetric();
-
-    UidMap uidMap;
-    SimpleAtomMatcher atomMatcher;
-    atomMatcher.set_atom_id(tagId);
-    sp<EventMatcherWizard> eventMatcherWizard =
-            new EventMatcherWizard({new SimpleLogMatchingTracker(
-                    atomMatcherId, logEventMatcherIndex, atomMatcher, uidMap)});
-    sp<MockConditionWizard> wizard = new NaggyMock<MockConditionWizard>();
-    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
-    ValueMetricProducer valueProducer(kConfigKey, metric, -1, wizard, logEventMatcherIndex,
-                                      eventMatcherWizard, -1, bucketStartTimeNs, bucketStartTimeNs,
-                                      pullerManager);
-
-    shared_ptr<LogEvent> event1 = make_shared<LogEvent>(tagId, bucketStartTimeNs + 10);
-    event1->write(1);
-    event1->write(10);
-    event1->init();
-    valueProducer.onMatchedLogEvent(1 /*log matcher index*/, *event1);
-    EXPECT_EQ(1UL, valueProducer.mCurrentSlicedBucket.size());
-
-    valueProducer.notifyAppUpgrade(bucketStartTimeNs + 150, "ANY.APP", 1, 1);
-    EXPECT_EQ(1UL, valueProducer.mPastBuckets[DEFAULT_METRIC_DIMENSION_KEY].size());
-    EXPECT_EQ(bucketStartTimeNs + 150, valueProducer.mCurrentBucketStartTimeNs);
-
-    shared_ptr<LogEvent> event2 = make_shared<LogEvent>(tagId, bucketStartTimeNs + 59 * NS_PER_SEC);
-    event2->write(1);
-    event2->write(10);
-    event2->init();
-    valueProducer.onMatchedLogEvent(1 /*log matcher index*/, *event2);
-    EXPECT_EQ(1UL, valueProducer.mPastBuckets[DEFAULT_METRIC_DIMENSION_KEY].size());
-    EXPECT_EQ(bucketStartTimeNs + 150, valueProducer.mCurrentBucketStartTimeNs);
-
-    // Next value should create a new bucket.
-    shared_ptr<LogEvent> event3 = make_shared<LogEvent>(tagId, bucketStartTimeNs + 65 * NS_PER_SEC);
-    event3->write(1);
-    event3->write(10);
-    event3->init();
-    valueProducer.onMatchedLogEvent(1 /*log matcher index*/, *event3);
-    EXPECT_EQ(2UL, valueProducer.mPastBuckets[DEFAULT_METRIC_DIMENSION_KEY].size());
-    EXPECT_EQ(bucketStartTimeNs + bucketSizeNs, valueProducer.mCurrentBucketStartTimeNs);
-}
-
-TEST(ValueMetricProducerTest, TestPulledValueWithUpgrade) {
-    ValueMetric metric = ValueMetricProducerTestHelper::createMetric();
-
-    UidMap uidMap;
-    SimpleAtomMatcher atomMatcher;
-    atomMatcher.set_atom_id(tagId);
-    sp<EventMatcherWizard> eventMatcherWizard =
-            new EventMatcherWizard({new SimpleLogMatchingTracker(
-                    atomMatcherId, logEventMatcherIndex, atomMatcher, uidMap)});
-    sp<MockConditionWizard> wizard = new NaggyMock<MockConditionWizard>();
-    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
-    EXPECT_CALL(*pullerManager, RegisterReceiver(tagId, _, _, _)).WillOnce(Return());
-    EXPECT_CALL(*pullerManager, UnRegisterReceiver(tagId, _)).WillOnce(Return());
-    EXPECT_CALL(*pullerManager, Pull(tagId, _))
-            .WillOnce(Return(true))
-            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
-                data->clear();
-                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucket2StartTimeNs + 149);
-                event->write(tagId);
-                event->write(120);
-                event->init();
-                data->push_back(event);
-                return true;
-            }));
-    ValueMetricProducer valueProducer(kConfigKey, metric, -1, wizard, logEventMatcherIndex,
-                                      eventMatcherWizard, tagId, bucketStartTimeNs,
-                                      bucketStartTimeNs, pullerManager);
-
-    vector<shared_ptr<LogEvent>> allData;
-    allData.clear();
-    shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucket2StartTimeNs + 1);
-    event->write(tagId);
-    event->write(100);
-    event->init();
-    allData.push_back(event);
-
-    valueProducer.onDataPulled(allData, /** succeed */ true, bucket2StartTimeNs);
-    EXPECT_EQ(1UL, valueProducer.mCurrentSlicedBucket.size());
-
-    valueProducer.notifyAppUpgrade(bucket2StartTimeNs + 150, "ANY.APP", 1, 1);
-    EXPECT_EQ(1UL, valueProducer.mPastBuckets[DEFAULT_METRIC_DIMENSION_KEY].size());
-    EXPECT_EQ(bucket2StartTimeNs + 150, valueProducer.mCurrentBucketStartTimeNs);
-    assertPastBucketValuesSingleKey(valueProducer.mPastBuckets, {20}, {150});
-
-    allData.clear();
-    event = make_shared<LogEvent>(tagId, bucket3StartTimeNs + 1);
-    event->write(tagId);
-    event->write(150);
-    event->init();
-    allData.push_back(event);
-    valueProducer.onDataPulled(allData, /** succeed */ true, bucket3StartTimeNs);
-    EXPECT_EQ(2UL, valueProducer.mPastBuckets[DEFAULT_METRIC_DIMENSION_KEY].size());
-    EXPECT_EQ(bucket3StartTimeNs, valueProducer.mCurrentBucketStartTimeNs);
-    EXPECT_EQ(20L,
-              valueProducer.mPastBuckets[DEFAULT_METRIC_DIMENSION_KEY][0].values[0].long_value);
-    assertPastBucketValuesSingleKey(valueProducer.mPastBuckets, {20, 30},
-                                    {150, bucketSizeNs - 150});
-}
-
-TEST(ValueMetricProducerTest, TestPulledWithAppUpgradeDisabled) {
-    ValueMetric metric = ValueMetricProducerTestHelper::createMetric();
-    metric.set_split_bucket_for_app_upgrade(false);
-
-    UidMap uidMap;
-    SimpleAtomMatcher atomMatcher;
-    atomMatcher.set_atom_id(tagId);
-    sp<EventMatcherWizard> eventMatcherWizard =
-            new EventMatcherWizard({new SimpleLogMatchingTracker(
-                    atomMatcherId, logEventMatcherIndex, atomMatcher, uidMap)});
-    sp<MockConditionWizard> wizard = new NaggyMock<MockConditionWizard>();
-    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
-    EXPECT_CALL(*pullerManager, RegisterReceiver(tagId, _, _, _)).WillOnce(Return());
-    EXPECT_CALL(*pullerManager, UnRegisterReceiver(tagId, _)).WillOnce(Return());
-    EXPECT_CALL(*pullerManager, Pull(tagId, _)).WillOnce(Return(true));
-    ValueMetricProducer valueProducer(kConfigKey, metric, -1, wizard, logEventMatcherIndex,
-                                      eventMatcherWizard, tagId, bucketStartTimeNs,
-                                      bucketStartTimeNs, pullerManager);
-
-    vector<shared_ptr<LogEvent>> allData;
-    allData.clear();
-    shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucket2StartTimeNs + 1);
-    event->write(tagId);
-    event->write(100);
-    event->init();
-    allData.push_back(event);
-
-    valueProducer.onDataPulled(allData, /** succeed */ true, bucket2StartTimeNs);
-    EXPECT_EQ(1UL, valueProducer.mCurrentSlicedBucket.size());
-
-    valueProducer.notifyAppUpgrade(bucket2StartTimeNs + 150, "ANY.APP", 1, 1);
-    EXPECT_EQ(0UL, valueProducer.mPastBuckets[DEFAULT_METRIC_DIMENSION_KEY].size());
-    EXPECT_EQ(bucket2StartTimeNs, valueProducer.mCurrentBucketStartTimeNs);
-}
-
-TEST(ValueMetricProducerTest, TestPulledValueWithUpgradeWhileConditionFalse) {
-    ValueMetric metric = ValueMetricProducerTestHelper::createMetricWithCondition();
-
-    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
-    EXPECT_CALL(*pullerManager, Pull(tagId, _))
-            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
-                data->clear();
-                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucketStartTimeNs + 1);
-                event->write(tagId);
-                event->write(100);
-                event->init();
-                data->push_back(event);
-                return true;
-            }))
-            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
-                data->clear();
-                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucket2StartTimeNs - 100);
-                event->write(tagId);
-                event->write(120);
-                event->init();
-                data->push_back(event);
-                return true;
-            }));
-    sp<ValueMetricProducer> valueProducer =
-            ValueMetricProducerTestHelper::createValueProducerWithCondition(pullerManager, metric);
-
-    valueProducer->onConditionChanged(true, bucketStartTimeNs + 1);
-
-    valueProducer->onConditionChanged(false, bucket2StartTimeNs-100);
-    EXPECT_FALSE(valueProducer->mCondition);
-
-    valueProducer->notifyAppUpgrade(bucket2StartTimeNs-50, "ANY.APP", 1, 1);
-    // Expect one full buckets already done and starting a partial bucket.
-    EXPECT_EQ(bucket2StartTimeNs-50, valueProducer->mCurrentBucketStartTimeNs);
-    EXPECT_EQ(1UL, valueProducer->mPastBuckets[DEFAULT_METRIC_DIMENSION_KEY].size());
-    EXPECT_EQ(bucketStartTimeNs,
-              valueProducer->mPastBuckets[DEFAULT_METRIC_DIMENSION_KEY][0].mBucketStartNs);
-    assertPastBucketValuesSingleKey(valueProducer->mPastBuckets, {20},
-                                    {(bucket2StartTimeNs - 100) - (bucketStartTimeNs + 1)});
-    EXPECT_FALSE(valueProducer->mCondition);
-}
-
-TEST(ValueMetricProducerTest, TestPushedEventsWithoutCondition) {
-    ValueMetric metric = ValueMetricProducerTestHelper::createMetric();
-
-    UidMap uidMap;
-    SimpleAtomMatcher atomMatcher;
-    atomMatcher.set_atom_id(tagId);
-    sp<EventMatcherWizard> eventMatcherWizard =
-            new EventMatcherWizard({new SimpleLogMatchingTracker(
-                    atomMatcherId, logEventMatcherIndex, atomMatcher, uidMap)});
-    sp<MockConditionWizard> wizard = new NaggyMock<MockConditionWizard>();
-    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
-
-    ValueMetricProducer valueProducer(kConfigKey, metric, -1, wizard, logEventMatcherIndex,
-                                      eventMatcherWizard, -1, bucketStartTimeNs, bucketStartTimeNs,
-                                      pullerManager);
-
-    shared_ptr<LogEvent> event1 = make_shared<LogEvent>(tagId, bucketStartTimeNs + 10);
-    event1->write(1);
-    event1->write(10);
-    event1->init();
-    shared_ptr<LogEvent> event2 = make_shared<LogEvent>(tagId, bucketStartTimeNs + 20);
-    event2->write(1);
-    event2->write(20);
-    event2->init();
-    valueProducer.onMatchedLogEvent(1 /*log matcher index*/, *event1);
-    // has one slice
-    EXPECT_EQ(1UL, valueProducer.mCurrentSlicedBucket.size());
-    ValueMetricProducer::Interval curInterval = valueProducer.mCurrentSlicedBucket.begin()->second[0];
-    ValueMetricProducer::BaseInfo curBaseInfo = valueProducer.mCurrentBaseInfo.begin()->second[0];
-    EXPECT_EQ(10, curInterval.value.long_value);
-    EXPECT_EQ(true, curInterval.hasValue);
-
-    valueProducer.onMatchedLogEvent(1 /*log matcher index*/, *event2);
-
-    // has one slice
-    EXPECT_EQ(1UL, valueProducer.mCurrentSlicedBucket.size());
-    curInterval = valueProducer.mCurrentSlicedBucket.begin()->second[0];
-    EXPECT_EQ(30, curInterval.value.long_value);
-
-    valueProducer.flushIfNeededLocked(bucket2StartTimeNs);
-    assertPastBucketValuesSingleKey(valueProducer.mPastBuckets, {30}, {bucketSizeNs});
-}
-
-TEST(ValueMetricProducerTest, TestPushedEventsWithCondition) {
-    ValueMetric metric = ValueMetricProducerTestHelper::createMetric();
-
-    UidMap uidMap;
-    SimpleAtomMatcher atomMatcher;
-    atomMatcher.set_atom_id(tagId);
-    sp<EventMatcherWizard> eventMatcherWizard =
-            new EventMatcherWizard({new SimpleLogMatchingTracker(
-                    atomMatcherId, logEventMatcherIndex, atomMatcher, uidMap)});
-    sp<MockConditionWizard> wizard = new NaggyMock<MockConditionWizard>();
-    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
-
-    ValueMetricProducer valueProducer(kConfigKey, metric, 1, wizard, logEventMatcherIndex,
-                                      eventMatcherWizard, -1, bucketStartTimeNs, bucketStartTimeNs,
-                                      pullerManager);
-    valueProducer.mCondition = ConditionState::kFalse;
-
-    shared_ptr<LogEvent> event1 = make_shared<LogEvent>(tagId, bucketStartTimeNs + 10);
-    event1->write(1);
-    event1->write(10);
-    event1->init();
-    valueProducer.onMatchedLogEvent(1 /*log matcher index*/, *event1);
-    // has 1 slice
-    EXPECT_EQ(0UL, valueProducer.mCurrentSlicedBucket.size());
-
-    valueProducer.onConditionChangedLocked(true, bucketStartTimeNs + 15);
-    shared_ptr<LogEvent> event2 = make_shared<LogEvent>(tagId, bucketStartTimeNs + 20);
-    event2->write(1);
-    event2->write(20);
-    event2->init();
-    valueProducer.onMatchedLogEvent(1 /*log matcher index*/, *event2);
-
-    // has one slice
-    EXPECT_EQ(1UL, valueProducer.mCurrentSlicedBucket.size());
-    ValueMetricProducer::Interval curInterval =
-            valueProducer.mCurrentSlicedBucket.begin()->second[0];
-    curInterval = valueProducer.mCurrentSlicedBucket.begin()->second[0];
-    EXPECT_EQ(20, curInterval.value.long_value);
-
-    shared_ptr<LogEvent> event3 = make_shared<LogEvent>(tagId, bucketStartTimeNs + 30);
-    event3->write(1);
-    event3->write(30);
-    event3->init();
-    valueProducer.onMatchedLogEvent(1 /*log matcher index*/, *event3);
-
-    // has one slice
-    EXPECT_EQ(1UL, valueProducer.mCurrentSlicedBucket.size());
-    curInterval = valueProducer.mCurrentSlicedBucket.begin()->second[0];
-    EXPECT_EQ(50, curInterval.value.long_value);
-
-    valueProducer.onConditionChangedLocked(false, bucketStartTimeNs + 35);
-    shared_ptr<LogEvent> event4 = make_shared<LogEvent>(tagId, bucketStartTimeNs + 40);
-    event4->write(1);
-    event4->write(40);
-    event4->init();
-    valueProducer.onMatchedLogEvent(1 /*log matcher index*/, *event4);
-
-    // has one slice
-    EXPECT_EQ(1UL, valueProducer.mCurrentSlicedBucket.size());
-    curInterval = valueProducer.mCurrentSlicedBucket.begin()->second[0];
-    EXPECT_EQ(50, curInterval.value.long_value);
-
-    valueProducer.flushIfNeededLocked(bucket2StartTimeNs);
-    assertPastBucketValuesSingleKey(valueProducer.mPastBuckets, {50}, {20});
-}
-
-TEST(ValueMetricProducerTest, TestAnomalyDetection) {
-    sp<AlarmMonitor> alarmMonitor;
-    Alert alert;
-    alert.set_id(101);
-    alert.set_metric_id(metricId);
-    alert.set_trigger_if_sum_gt(130);
-    alert.set_num_buckets(2);
-    const int32_t refPeriodSec = 3;
-    alert.set_refractory_period_secs(refPeriodSec);
-
-    ValueMetric metric = ValueMetricProducerTestHelper::createMetric();
-
-    UidMap uidMap;
-    SimpleAtomMatcher atomMatcher;
-    atomMatcher.set_atom_id(tagId);
-    sp<EventMatcherWizard> eventMatcherWizard =
-            new EventMatcherWizard({new SimpleLogMatchingTracker(
-                    atomMatcherId, logEventMatcherIndex, atomMatcher, uidMap)});
-    sp<MockConditionWizard> wizard = new NaggyMock<MockConditionWizard>();
-    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
-    ValueMetricProducer valueProducer(kConfigKey, metric, -1 /*-1 meaning no condition*/, wizard,
-                                      logEventMatcherIndex, eventMatcherWizard, -1 /*not pulled*/,
-                                      bucketStartTimeNs, bucketStartTimeNs, pullerManager);
-
-    sp<AnomalyTracker> anomalyTracker = valueProducer.addAnomalyTracker(alert, alarmMonitor);
-
-
-    shared_ptr<LogEvent> event1
-            = make_shared<LogEvent>(tagId, bucketStartTimeNs + 1 * NS_PER_SEC);
-    event1->write(161);
-    event1->write(10); // value of interest
-    event1->init();
-    shared_ptr<LogEvent> event2
-            = make_shared<LogEvent>(tagId, bucketStartTimeNs + 2 + NS_PER_SEC);
-    event2->write(162);
-    event2->write(20); // value of interest
-    event2->init();
-    shared_ptr<LogEvent> event3
-            = make_shared<LogEvent>(tagId, bucketStartTimeNs + 2 * bucketSizeNs + 1 * NS_PER_SEC);
-    event3->write(163);
-    event3->write(130); // value of interest
-    event3->init();
-    shared_ptr<LogEvent> event4
-            = make_shared<LogEvent>(tagId, bucketStartTimeNs + 3 * bucketSizeNs + 1 * NS_PER_SEC);
-    event4->write(35);
-    event4->write(1); // value of interest
-    event4->init();
-    shared_ptr<LogEvent> event5
-            = make_shared<LogEvent>(tagId, bucketStartTimeNs + 3 * bucketSizeNs + 2 * NS_PER_SEC);
-    event5->write(45);
-    event5->write(150); // value of interest
-    event5->init();
-    shared_ptr<LogEvent> event6
-            = make_shared<LogEvent>(tagId, bucketStartTimeNs + 3 * bucketSizeNs + 10 * NS_PER_SEC);
-    event6->write(25);
-    event6->write(160); // value of interest
-    event6->init();
-
-    // Two events in bucket #0.
-    valueProducer.onMatchedLogEvent(1 /*log matcher index*/, *event1);
-    valueProducer.onMatchedLogEvent(1 /*log matcher index*/, *event2);
-    // Value sum == 30 <= 130.
-    EXPECT_EQ(anomalyTracker->getRefractoryPeriodEndsSec(DEFAULT_METRIC_DIMENSION_KEY), 0U);
-
-    // One event in bucket #2. No alarm as bucket #0 is trashed out.
-    valueProducer.onMatchedLogEvent(1 /*log matcher index*/, *event3);
-    // Value sum == 130 <= 130.
-    EXPECT_EQ(anomalyTracker->getRefractoryPeriodEndsSec(DEFAULT_METRIC_DIMENSION_KEY), 0U);
-
-    // Three events in bucket #3.
-    valueProducer.onMatchedLogEvent(1 /*log matcher index*/, *event4);
-    // Anomaly at event 4 since Value sum == 131 > 130!
-    EXPECT_EQ(anomalyTracker->getRefractoryPeriodEndsSec(DEFAULT_METRIC_DIMENSION_KEY),
-            std::ceil(1.0 * event4->GetElapsedTimestampNs() / NS_PER_SEC + refPeriodSec));
-    valueProducer.onMatchedLogEvent(1 /*log matcher index*/, *event5);
-    // Event 5 is within 3 sec refractory period. Thus last alarm timestamp is still event4.
-    EXPECT_EQ(anomalyTracker->getRefractoryPeriodEndsSec(DEFAULT_METRIC_DIMENSION_KEY),
-            std::ceil(1.0 * event4->GetElapsedTimestampNs() / NS_PER_SEC + refPeriodSec));
-
-    valueProducer.onMatchedLogEvent(1 /*log matcher index*/, *event6);
-    // Anomaly at event 6 since Value sum == 160 > 130 and after refractory period.
-    EXPECT_EQ(anomalyTracker->getRefractoryPeriodEndsSec(DEFAULT_METRIC_DIMENSION_KEY),
-            std::ceil(1.0 * event6->GetElapsedTimestampNs() / NS_PER_SEC + refPeriodSec));
-}
-
-// Test value metric no condition, the pull on bucket boundary come in time and too late
-TEST(ValueMetricProducerTest, TestBucketBoundaryNoCondition) {
-    ValueMetric metric = ValueMetricProducerTestHelper::createMetric();
-    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
-    EXPECT_CALL(*pullerManager, Pull(tagId, _)).WillOnce(Return(true));
-    sp<ValueMetricProducer> valueProducer =
-            ValueMetricProducerTestHelper::createValueProducerNoConditions(pullerManager, metric);
-
-    vector<shared_ptr<LogEvent>> allData;
-    // pull 1
-    allData.clear();
-    shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucket2StartTimeNs + 1);
-    event->write(tagId);
-    event->write(11);
-    event->init();
-    allData.push_back(event);
-
-    valueProducer->onDataPulled(allData, /** succeed */ true, bucket2StartTimeNs);
-    // has one slice
-    EXPECT_EQ(1UL, valueProducer->mCurrentSlicedBucket.size());
-    ValueMetricProducer::Interval curInterval =
-            valueProducer->mCurrentSlicedBucket.begin()->second[0];
-    ValueMetricProducer::BaseInfo curBaseInfo = valueProducer->mCurrentBaseInfo.begin()->second[0];
-
-    // startUpdated:true sum:0 start:11
-    EXPECT_EQ(true, curBaseInfo.hasBase);
-    EXPECT_EQ(11, curBaseInfo.base.long_value);
-    EXPECT_EQ(false, curInterval.hasValue);
-    EXPECT_EQ(0UL, valueProducer->mPastBuckets.size());
-
-    // pull 2 at correct time
-    allData.clear();
-    event = make_shared<LogEvent>(tagId, bucket3StartTimeNs + 1);
-    event->write(tagId);
-    event->write(23);
-    event->init();
-    allData.push_back(event);
-    valueProducer->onDataPulled(allData, /** succeed */ true, bucket3StartTimeNs);
-    // has one slice
-    EXPECT_EQ(1UL, valueProducer->mCurrentSlicedBucket.size());
-    curInterval = valueProducer->mCurrentSlicedBucket.begin()->second[0];
-    curBaseInfo = valueProducer->mCurrentBaseInfo.begin()->second[0];
-    // tartUpdated:false sum:12
-    EXPECT_EQ(true, curBaseInfo.hasBase);
-    EXPECT_EQ(23, curBaseInfo.base.long_value);
-    EXPECT_EQ(false, curInterval.hasValue);
-    assertPastBucketValuesSingleKey(valueProducer->mPastBuckets, {12}, {bucketSizeNs});
-
-    // pull 3 come late.
-    // The previous bucket gets closed with error. (Has start value 23, no ending)
-    // Another bucket gets closed with error. (No start, but ending with 36)
-    // The new bucket is back to normal.
-    allData.clear();
-    event = make_shared<LogEvent>(tagId, bucket6StartTimeNs + 1);
-    event->write(tagId);
-    event->write(36);
-    event->init();
-    allData.push_back(event);
-    valueProducer->onDataPulled(allData, /** succeed */ true, bucket6StartTimeNs);
-    EXPECT_EQ(1UL, valueProducer->mCurrentSlicedBucket.size());
-    curInterval = valueProducer->mCurrentSlicedBucket.begin()->second[0];
-    curBaseInfo = valueProducer->mCurrentBaseInfo.begin()->second[0];
-    // startUpdated:false sum:12
-    EXPECT_EQ(true, curBaseInfo.hasBase);
-    EXPECT_EQ(36, curBaseInfo.base.long_value);
-    EXPECT_EQ(false, curInterval.hasValue);
-    assertPastBucketValuesSingleKey(valueProducer->mPastBuckets, {12}, {bucketSizeNs});
-}
-
-/*
- * Test pulled event with non sliced condition. The pull on boundary come late because the alarm
- * was delivered late.
- */
-TEST(ValueMetricProducerTest, TestBucketBoundaryWithCondition) {
-    ValueMetric metric = ValueMetricProducerTestHelper::createMetricWithCondition();
-
-    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
-    EXPECT_CALL(*pullerManager, Pull(tagId, _))
-            // condition becomes true
-            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
-                data->clear();
-                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucketStartTimeNs + 8);
-                event->write(tagId);
-                event->write(100);
-                event->init();
-                data->push_back(event);
-                return true;
-            }))
-            // condition becomes false
-            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
-                data->clear();
-                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucket2StartTimeNs + 1);
-                event->write(tagId);
-                event->write(120);
-                event->init();
-                data->push_back(event);
-                return true;
-            }));
-    sp<ValueMetricProducer> valueProducer =
-            ValueMetricProducerTestHelper::createValueProducerWithCondition(pullerManager, metric);
-
-    valueProducer->onConditionChanged(true, bucketStartTimeNs + 8);
-
-    // has one slice
-    EXPECT_EQ(1UL, valueProducer->mCurrentSlicedBucket.size());
-    ValueMetricProducer::Interval curInterval =
-            valueProducer->mCurrentSlicedBucket.begin()->second[0];
-    ValueMetricProducer::BaseInfo curBaseInfo = valueProducer->mCurrentBaseInfo.begin()->second[0];
-    EXPECT_EQ(true, curBaseInfo.hasBase);
-    EXPECT_EQ(100, curBaseInfo.base.long_value);
-    EXPECT_EQ(false, curInterval.hasValue);
-    EXPECT_EQ(0UL, valueProducer->mPastBuckets.size());
-
-    // pull on bucket boundary come late, condition change happens before it
-    valueProducer->onConditionChanged(false, bucket2StartTimeNs + 1);
-    curInterval = valueProducer->mCurrentSlicedBucket.begin()->second[0];
-    curBaseInfo = valueProducer->mCurrentBaseInfo.begin()->second[0];
-    assertPastBucketValuesSingleKey(valueProducer->mPastBuckets, {20}, {bucketSizeNs - 8});
-    EXPECT_EQ(false, curBaseInfo.hasBase);
-
-    // Now the alarm is delivered.
-    // since the condition turned to off before this pull finish, it has no effect
-    vector<shared_ptr<LogEvent>> allData;
-    allData.push_back(ValueMetricProducerTestHelper::createEvent(bucket2StartTimeNs + 30, 110));
-    valueProducer->onDataPulled(allData, /** succeed */ true, bucket2StartTimeNs);
-
-    assertPastBucketValuesSingleKey(valueProducer->mPastBuckets, {20}, {bucketSizeNs - 8});
-    curInterval = valueProducer->mCurrentSlicedBucket.begin()->second[0];
-    curBaseInfo = valueProducer->mCurrentBaseInfo.begin()->second[0];
-    EXPECT_EQ(false, curBaseInfo.hasBase);
-    EXPECT_EQ(false, curInterval.hasValue);
-}
-
-/*
- * Test pulled event with non sliced condition. The pull on boundary come late, after the condition
- * change to false, and then true again. This is due to alarm delivered late.
- */
-TEST(ValueMetricProducerTest, TestBucketBoundaryWithCondition2) {
-    ValueMetric metric = ValueMetricProducerTestHelper::createMetricWithCondition();
-
-    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
-    EXPECT_CALL(*pullerManager, Pull(tagId, _))
-            // condition becomes true
-            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
-                data->clear();
-                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucketStartTimeNs + 8);
-                event->write(tagId);
-                event->write(100);
-                event->init();
-                data->push_back(event);
-                return true;
-            }))
-            // condition becomes false
-            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
-                data->clear();
-                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucket2StartTimeNs + 1);
-                event->write(tagId);
-                event->write(120);
-                event->init();
-                data->push_back(event);
-                return true;
-            }))
-            // condition becomes true again
-            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
-                data->clear();
-                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucket2StartTimeNs + 25);
-                event->write(tagId);
-                event->write(130);
-                event->init();
-                data->push_back(event);
-                return true;
-            }));
-
-    sp<ValueMetricProducer> valueProducer =
-            ValueMetricProducerTestHelper::createValueProducerWithCondition(pullerManager, metric);
-
-    valueProducer->onConditionChanged(true, bucketStartTimeNs + 8);
-
-    // has one slice
-    EXPECT_EQ(1UL, valueProducer->mCurrentSlicedBucket.size());
-    ValueMetricProducer::Interval curInterval =
-            valueProducer->mCurrentSlicedBucket.begin()->second[0];
-    ValueMetricProducer::BaseInfo curBaseInfo = valueProducer->mCurrentBaseInfo.begin()->second[0];
-    // startUpdated:false sum:0 start:100
-    EXPECT_EQ(true, curBaseInfo.hasBase);
-    EXPECT_EQ(100, curBaseInfo.base.long_value);
-    EXPECT_EQ(false, curInterval.hasValue);
-    EXPECT_EQ(0UL, valueProducer->mPastBuckets.size());
-
-    // pull on bucket boundary come late, condition change happens before it
-    valueProducer->onConditionChanged(false, bucket2StartTimeNs + 1);
-    assertPastBucketValuesSingleKey(valueProducer->mPastBuckets, {20}, {bucketSizeNs - 8});
-    EXPECT_EQ(1UL, valueProducer->mCurrentSlicedBucket.size());
-    curInterval = valueProducer->mCurrentSlicedBucket.begin()->second[0];
-    curBaseInfo = valueProducer->mCurrentBaseInfo.begin()->second[0];
-    EXPECT_EQ(false, curBaseInfo.hasBase);
-    EXPECT_EQ(false, curInterval.hasValue);
-
-    // condition changed to true again, before the pull alarm is delivered
-    valueProducer->onConditionChanged(true, bucket2StartTimeNs + 25);
-    assertPastBucketValuesSingleKey(valueProducer->mPastBuckets, {20}, {bucketSizeNs - 8});
-    curInterval = valueProducer->mCurrentSlicedBucket.begin()->second[0];
-    curBaseInfo = valueProducer->mCurrentBaseInfo.begin()->second[0];
-    EXPECT_EQ(true, curBaseInfo.hasBase);
-    EXPECT_EQ(130, curBaseInfo.base.long_value);
-    EXPECT_EQ(false, curInterval.hasValue);
-
-    // Now the alarm is delivered, but it is considered late, the data will be used
-    // for the new bucket since it was just pulled.
-    vector<shared_ptr<LogEvent>> allData;
-    allData.push_back(ValueMetricProducerTestHelper::createEvent(bucket2StartTimeNs + 50, 140));
-    valueProducer->onDataPulled(allData, /** succeed */ true, bucket2StartTimeNs + 50);
-
-    curInterval = valueProducer->mCurrentSlicedBucket.begin()->second[0];
-    curBaseInfo = valueProducer->mCurrentBaseInfo.begin()->second[0];
-    EXPECT_EQ(true, curBaseInfo.hasBase);
-    EXPECT_EQ(140, curBaseInfo.base.long_value);
-    EXPECT_EQ(true, curInterval.hasValue);
-    EXPECT_EQ(10, curInterval.value.long_value);
-    assertPastBucketValuesSingleKey(valueProducer->mPastBuckets, {20}, {bucketSizeNs - 8});
-
-    allData.clear();
-    allData.push_back(ValueMetricProducerTestHelper::createEvent(bucket3StartTimeNs, 160));
-    valueProducer->onDataPulled(allData, /** succeed */ true, bucket3StartTimeNs);
-    assertPastBucketValuesSingleKey(valueProducer->mPastBuckets, {20, 30},
-                                    {bucketSizeNs - 8, bucketSizeNs - 24});
-}
-
-TEST(ValueMetricProducerTest, TestPushedAggregateMin) {
-    ValueMetric metric = ValueMetricProducerTestHelper::createMetric();
-    metric.set_aggregation_type(ValueMetric::MIN);
-
-    UidMap uidMap;
-    SimpleAtomMatcher atomMatcher;
-    atomMatcher.set_atom_id(tagId);
-    sp<EventMatcherWizard> eventMatcherWizard =
-            new EventMatcherWizard({new SimpleLogMatchingTracker(
-                    atomMatcherId, logEventMatcherIndex, atomMatcher, uidMap)});
-    sp<MockConditionWizard> wizard = new NaggyMock<MockConditionWizard>();
-    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
-
-    ValueMetricProducer valueProducer(kConfigKey, metric, -1, wizard, logEventMatcherIndex,
-                                      eventMatcherWizard, -1, bucketStartTimeNs, bucketStartTimeNs,
-                                      pullerManager);
-
-    shared_ptr<LogEvent> event1 = make_shared<LogEvent>(tagId, bucketStartTimeNs + 10);
-    event1->write(1);
-    event1->write(10);
-    event1->init();
-    shared_ptr<LogEvent> event2 = make_shared<LogEvent>(tagId, bucketStartTimeNs + 20);
-    event2->write(1);
-    event2->write(20);
-    event2->init();
-    valueProducer.onMatchedLogEvent(1 /*log matcher index*/, *event1);
-    // has one slice
-    EXPECT_EQ(1UL, valueProducer.mCurrentSlicedBucket.size());
-    ValueMetricProducer::Interval curInterval =
-            valueProducer.mCurrentSlicedBucket.begin()->second[0];
-    EXPECT_EQ(10, curInterval.value.long_value);
-    EXPECT_EQ(true, curInterval.hasValue);
-
-    valueProducer.onMatchedLogEvent(1 /*log matcher index*/, *event2);
-
-    // has one slice
-    EXPECT_EQ(1UL, valueProducer.mCurrentSlicedBucket.size());
-    curInterval = valueProducer.mCurrentSlicedBucket.begin()->second[0];
-    EXPECT_EQ(10, curInterval.value.long_value);
-
-    valueProducer.flushIfNeededLocked(bucket2StartTimeNs);
-    assertPastBucketValuesSingleKey(valueProducer.mPastBuckets, {10}, {bucketSizeNs});
-}
-
-TEST(ValueMetricProducerTest, TestPushedAggregateMax) {
-    ValueMetric metric = ValueMetricProducerTestHelper::createMetric();
-    metric.set_aggregation_type(ValueMetric::MAX);
-
-    UidMap uidMap;
-    SimpleAtomMatcher atomMatcher;
-    atomMatcher.set_atom_id(tagId);
-    sp<EventMatcherWizard> eventMatcherWizard =
-            new EventMatcherWizard({new SimpleLogMatchingTracker(
-                    atomMatcherId, logEventMatcherIndex, atomMatcher, uidMap)});
-    sp<MockConditionWizard> wizard = new NaggyMock<MockConditionWizard>();
-    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
-
-    ValueMetricProducer valueProducer(kConfigKey, metric, -1, wizard, logEventMatcherIndex,
-                                      eventMatcherWizard, -1, bucketStartTimeNs, bucketStartTimeNs,
-                                      pullerManager);
-
-    shared_ptr<LogEvent> event1 = make_shared<LogEvent>(tagId, bucketStartTimeNs + 10);
-    event1->write(1);
-    event1->write(10);
-    event1->init();
-    shared_ptr<LogEvent> event2 = make_shared<LogEvent>(tagId, bucketStartTimeNs + 20);
-    event2->write(1);
-    event2->write(20);
-    event2->init();
-    valueProducer.onMatchedLogEvent(1 /*log matcher index*/, *event1);
-    // has one slice
-    EXPECT_EQ(1UL, valueProducer.mCurrentSlicedBucket.size());
-    ValueMetricProducer::Interval curInterval =
-            valueProducer.mCurrentSlicedBucket.begin()->second[0];
-    EXPECT_EQ(10, curInterval.value.long_value);
-    EXPECT_EQ(true, curInterval.hasValue);
-
-    valueProducer.onMatchedLogEvent(1 /*log matcher index*/, *event2);
-
-    // has one slice
-    EXPECT_EQ(1UL, valueProducer.mCurrentSlicedBucket.size());
-    curInterval = valueProducer.mCurrentSlicedBucket.begin()->second[0];
-    EXPECT_EQ(20, curInterval.value.long_value);
-
-    valueProducer.flushIfNeededLocked(bucket3StartTimeNs);
-    /* EXPECT_EQ(1UL, valueProducer.mPastBuckets.size()); */
-    /* EXPECT_EQ(1UL, valueProducer.mPastBuckets.begin()->second.size()); */
-    /* EXPECT_EQ(20, valueProducer.mPastBuckets.begin()->second.back().values[0].long_value); */
-}
-
-TEST(ValueMetricProducerTest, TestPushedAggregateAvg) {
-    ValueMetric metric = ValueMetricProducerTestHelper::createMetric();
-    metric.set_aggregation_type(ValueMetric::AVG);
-
-    UidMap uidMap;
-    SimpleAtomMatcher atomMatcher;
-    atomMatcher.set_atom_id(tagId);
-    sp<EventMatcherWizard> eventMatcherWizard =
-            new EventMatcherWizard({new SimpleLogMatchingTracker(
-                    atomMatcherId, logEventMatcherIndex, atomMatcher, uidMap)});
-    sp<MockConditionWizard> wizard = new NaggyMock<MockConditionWizard>();
-    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
-
-    ValueMetricProducer valueProducer(kConfigKey, metric, -1, wizard, logEventMatcherIndex,
-                                      eventMatcherWizard, -1, bucketStartTimeNs, bucketStartTimeNs,
-                                      pullerManager);
-
-    shared_ptr<LogEvent> event1 = make_shared<LogEvent>(tagId, bucketStartTimeNs + 10);
-    event1->write(1);
-    event1->write(10);
-    event1->init();
-    shared_ptr<LogEvent> event2 = make_shared<LogEvent>(tagId, bucketStartTimeNs + 20);
-    event2->write(1);
-    event2->write(15);
-    event2->init();
-    valueProducer.onMatchedLogEvent(1 /*log matcher index*/, *event1);
-    // has one slice
-    EXPECT_EQ(1UL, valueProducer.mCurrentSlicedBucket.size());
-    ValueMetricProducer::Interval curInterval;
-    curInterval = valueProducer.mCurrentSlicedBucket.begin()->second[0];
-    EXPECT_EQ(10, curInterval.value.long_value);
-    EXPECT_EQ(true, curInterval.hasValue);
-    EXPECT_EQ(1, curInterval.sampleSize);
-
-    valueProducer.onMatchedLogEvent(1 /*log matcher index*/, *event2);
-
-    // has one slice
-    EXPECT_EQ(1UL, valueProducer.mCurrentSlicedBucket.size());
-    curInterval = valueProducer.mCurrentSlicedBucket.begin()->second[0];
-    EXPECT_EQ(25, curInterval.value.long_value);
-    EXPECT_EQ(2, curInterval.sampleSize);
-
-    valueProducer.flushIfNeededLocked(bucket2StartTimeNs);
-    EXPECT_EQ(1UL, valueProducer.mPastBuckets.size());
-    EXPECT_EQ(1UL, valueProducer.mPastBuckets.begin()->second.size());
-
-    EXPECT_TRUE(std::abs(valueProducer.mPastBuckets.begin()->second.back().values[0].double_value -
-                         12.5) < epsilon);
-}
-
-TEST(ValueMetricProducerTest, TestPushedAggregateSum) {
-    ValueMetric metric = ValueMetricProducerTestHelper::createMetric();
-    metric.set_aggregation_type(ValueMetric::SUM);
-
-    UidMap uidMap;
-    SimpleAtomMatcher atomMatcher;
-    atomMatcher.set_atom_id(tagId);
-    sp<EventMatcherWizard> eventMatcherWizard =
-            new EventMatcherWizard({new SimpleLogMatchingTracker(
-                    atomMatcherId, logEventMatcherIndex, atomMatcher, uidMap)});
-    sp<MockConditionWizard> wizard = new NaggyMock<MockConditionWizard>();
-    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
-
-    ValueMetricProducer valueProducer(kConfigKey, metric, -1, wizard, logEventMatcherIndex,
-                                      eventMatcherWizard, -1, bucketStartTimeNs, bucketStartTimeNs,
-                                      pullerManager);
-
-    shared_ptr<LogEvent> event1 = make_shared<LogEvent>(tagId, bucketStartTimeNs + 10);
-    event1->write(1);
-    event1->write(10);
-    event1->init();
-    shared_ptr<LogEvent> event2 = make_shared<LogEvent>(tagId, bucketStartTimeNs + 20);
-    event2->write(1);
-    event2->write(15);
-    event2->init();
-    valueProducer.onMatchedLogEvent(1 /*log matcher index*/, *event1);
-    // has one slice
-    EXPECT_EQ(1UL, valueProducer.mCurrentSlicedBucket.size());
-    ValueMetricProducer::Interval curInterval =
-            valueProducer.mCurrentSlicedBucket.begin()->second[0];
-    EXPECT_EQ(10, curInterval.value.long_value);
-    EXPECT_EQ(true, curInterval.hasValue);
-
-    valueProducer.onMatchedLogEvent(1 /*log matcher index*/, *event2);
-
-    // has one slice
-    EXPECT_EQ(1UL, valueProducer.mCurrentSlicedBucket.size());
-    curInterval = valueProducer.mCurrentSlicedBucket.begin()->second[0];
-    EXPECT_EQ(25, curInterval.value.long_value);
-
-    valueProducer.flushIfNeededLocked(bucket2StartTimeNs);
-    assertPastBucketValuesSingleKey(valueProducer.mPastBuckets, {25}, {bucketSizeNs});
-}
-
-TEST(ValueMetricProducerTest, TestSkipZeroDiffOutput) {
-    ValueMetric metric = ValueMetricProducerTestHelper::createMetric();
-    metric.set_aggregation_type(ValueMetric::MIN);
-    metric.set_use_diff(true);
-
-    UidMap uidMap;
-    SimpleAtomMatcher atomMatcher;
-    atomMatcher.set_atom_id(tagId);
-    sp<EventMatcherWizard> eventMatcherWizard =
-            new EventMatcherWizard({new SimpleLogMatchingTracker(
-                    atomMatcherId, logEventMatcherIndex, atomMatcher, uidMap)});
-    sp<MockConditionWizard> wizard = new NaggyMock<MockConditionWizard>();
-    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
-
-    ValueMetricProducer valueProducer(kConfigKey, metric, -1, wizard, logEventMatcherIndex,
-                                      eventMatcherWizard, -1, bucketStartTimeNs, bucketStartTimeNs,
-                                      pullerManager);
-
-    shared_ptr<LogEvent> event1 = make_shared<LogEvent>(tagId, bucketStartTimeNs + 10);
-    event1->write(1);
-    event1->write(10);
-    event1->init();
-    shared_ptr<LogEvent> event2 = make_shared<LogEvent>(tagId, bucketStartTimeNs + 15);
-    event2->write(1);
-    event2->write(15);
-    event2->init();
-    valueProducer.onMatchedLogEvent(1 /*log matcher index*/, *event1);
-    // has one slice
-    EXPECT_EQ(1UL, valueProducer.mCurrentSlicedBucket.size());
-    ValueMetricProducer::Interval curInterval =
-            valueProducer.mCurrentSlicedBucket.begin()->second[0];
-    ValueMetricProducer::BaseInfo curBaseInfo = valueProducer.mCurrentBaseInfo.begin()->second[0];
-    EXPECT_EQ(true, curBaseInfo.hasBase);
-    EXPECT_EQ(10, curBaseInfo.base.long_value);
-    EXPECT_EQ(false, curInterval.hasValue);
-
-    valueProducer.onMatchedLogEvent(1 /*log matcher index*/, *event2);
-
-    // has one slice
-    EXPECT_EQ(1UL, valueProducer.mCurrentSlicedBucket.size());
-    curInterval = valueProducer.mCurrentSlicedBucket.begin()->second[0];
-    EXPECT_EQ(true, curInterval.hasValue);
-    EXPECT_EQ(5, curInterval.value.long_value);
-
-    // no change in data.
-    shared_ptr<LogEvent> event3 = make_shared<LogEvent>(tagId, bucket2StartTimeNs + 10);
-    event3->write(1);
-    event3->write(15);
-    event3->init();
-    valueProducer.onMatchedLogEvent(1 /*log matcher index*/, *event3);
-    EXPECT_EQ(1UL, valueProducer.mCurrentSlicedBucket.size());
-    curInterval = valueProducer.mCurrentSlicedBucket.begin()->second[0];
-    curBaseInfo = valueProducer.mCurrentBaseInfo.begin()->second[0];
-    EXPECT_EQ(true, curBaseInfo.hasBase);
-    EXPECT_EQ(15, curBaseInfo.base.long_value);
-    EXPECT_EQ(true, curInterval.hasValue);
-
-    shared_ptr<LogEvent> event4 = make_shared<LogEvent>(tagId, bucket2StartTimeNs + 15);
-    event4->write(1);
-    event4->write(15);
-    event4->init();
-    valueProducer.onMatchedLogEvent(1 /*log matcher index*/, *event4);
-    EXPECT_EQ(1UL, valueProducer.mCurrentSlicedBucket.size());
-    curInterval = valueProducer.mCurrentSlicedBucket.begin()->second[0];
-    curBaseInfo = valueProducer.mCurrentBaseInfo.begin()->second[0];
-    EXPECT_EQ(true, curBaseInfo.hasBase);
-    EXPECT_EQ(15, curBaseInfo.base.long_value);
-    EXPECT_EQ(true, curInterval.hasValue);
-
-    valueProducer.flushIfNeededLocked(bucket3StartTimeNs);
-    EXPECT_EQ(1UL, valueProducer.mPastBuckets.size());
-    EXPECT_EQ(1UL, valueProducer.mPastBuckets.begin()->second.size());
-    assertPastBucketValuesSingleKey(valueProducer.mPastBuckets, {5}, {bucketSizeNs});
-}
-
-TEST(ValueMetricProducerTest, TestSkipZeroDiffOutputMultiValue) {
-    ValueMetric metric = ValueMetricProducerTestHelper::createMetric();
-    metric.mutable_value_field()->add_child()->set_field(3);
-    metric.set_aggregation_type(ValueMetric::MIN);
-    metric.set_use_diff(true);
-
-    UidMap uidMap;
-    SimpleAtomMatcher atomMatcher;
-    atomMatcher.set_atom_id(tagId);
-    sp<EventMatcherWizard> eventMatcherWizard =
-            new EventMatcherWizard({new SimpleLogMatchingTracker(
-                    atomMatcherId, logEventMatcherIndex, atomMatcher, uidMap)});
-    sp<MockConditionWizard> wizard = new NaggyMock<MockConditionWizard>();
-    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
-
-    ValueMetricProducer valueProducer(kConfigKey, metric, -1, wizard, logEventMatcherIndex,
-                                      eventMatcherWizard, -1, bucketStartTimeNs, bucketStartTimeNs,
-                                      pullerManager);
-
-    shared_ptr<LogEvent> event1 = make_shared<LogEvent>(tagId, bucketStartTimeNs + 10);
-    event1->write(1);
-    event1->write(10);
-    event1->write(20);
-    event1->init();
-    shared_ptr<LogEvent> event2 = make_shared<LogEvent>(tagId, bucketStartTimeNs + 15);
-    event2->write(1);
-    event2->write(15);
-    event2->write(22);
-    event2->init();
-    valueProducer.onMatchedLogEvent(1 /*log matcher index*/, *event1);
-    // has one slice
-    EXPECT_EQ(1UL, valueProducer.mCurrentSlicedBucket.size());
-    ValueMetricProducer::Interval curInterval =
-            valueProducer.mCurrentSlicedBucket.begin()->second[0];
-    ValueMetricProducer::BaseInfo curBaseInfo = valueProducer.mCurrentBaseInfo.begin()->second[0];
-    EXPECT_EQ(true, curBaseInfo.hasBase);
-    EXPECT_EQ(10, curBaseInfo.base.long_value);
-    EXPECT_EQ(false, curInterval.hasValue);
-    curBaseInfo = valueProducer.mCurrentBaseInfo.begin()->second[1];
-    EXPECT_EQ(true, curBaseInfo.hasBase);
-    EXPECT_EQ(20, curBaseInfo.base.long_value);
-    EXPECT_EQ(false, curInterval.hasValue);
-
-    valueProducer.onMatchedLogEvent(1 /*log matcher index*/, *event2);
-
-    // has one slice
-    EXPECT_EQ(1UL, valueProducer.mCurrentSlicedBucket.size());
-    curInterval = valueProducer.mCurrentSlicedBucket.begin()->second[0];
-    curBaseInfo = valueProducer.mCurrentBaseInfo.begin()->second[0];
-    EXPECT_EQ(true, curInterval.hasValue);
-    EXPECT_EQ(5, curInterval.value.long_value);
-    curInterval = valueProducer.mCurrentSlicedBucket.begin()->second[1];
-    curBaseInfo = valueProducer.mCurrentBaseInfo.begin()->second[1];
-    EXPECT_EQ(true, curInterval.hasValue);
-    EXPECT_EQ(2, curInterval.value.long_value);
-
-    // no change in first value field
-    shared_ptr<LogEvent> event3 = make_shared<LogEvent>(tagId, bucket2StartTimeNs + 10);
-    event3->write(1);
-    event3->write(15);
-    event3->write(25);
-    event3->init();
-    valueProducer.onMatchedLogEvent(1 /*log matcher index*/, *event3);
-    EXPECT_EQ(1UL, valueProducer.mCurrentSlicedBucket.size());
-    curInterval = valueProducer.mCurrentSlicedBucket.begin()->second[0];
-    curBaseInfo = valueProducer.mCurrentBaseInfo.begin()->second[0];
-
-    EXPECT_EQ(true, curBaseInfo.hasBase);
-    EXPECT_EQ(15, curBaseInfo.base.long_value);
-    EXPECT_EQ(true, curInterval.hasValue);
-    curInterval = valueProducer.mCurrentSlicedBucket.begin()->second[1];
-    curBaseInfo = valueProducer.mCurrentBaseInfo.begin()->second[1];
-    EXPECT_EQ(true, curBaseInfo.hasBase);
-    EXPECT_EQ(25, curBaseInfo.base.long_value);
-    EXPECT_EQ(true, curInterval.hasValue);
-
-    shared_ptr<LogEvent> event4 = make_shared<LogEvent>(tagId, bucket2StartTimeNs + 15);
-    event4->write(1);
-    event4->write(15);
-    event4->write(29);
-    event4->init();
-    valueProducer.onMatchedLogEvent(1 /*log matcher index*/, *event4);
-    EXPECT_EQ(1UL, valueProducer.mCurrentSlicedBucket.size());
-    curInterval = valueProducer.mCurrentSlicedBucket.begin()->second[0];
-    curBaseInfo = valueProducer.mCurrentBaseInfo.begin()->second[0];
-    EXPECT_EQ(true, curBaseInfo.hasBase);
-    EXPECT_EQ(15, curBaseInfo.base.long_value);
-    EXPECT_EQ(true, curInterval.hasValue);
-    curInterval = valueProducer.mCurrentSlicedBucket.begin()->second[1];
-    curBaseInfo = valueProducer.mCurrentBaseInfo.begin()->second[1];
-    EXPECT_EQ(true, curBaseInfo.hasBase);
-    EXPECT_EQ(29, curBaseInfo.base.long_value);
-    EXPECT_EQ(true, curInterval.hasValue);
-
-    valueProducer.flushIfNeededLocked(bucket3StartTimeNs);
-
-    EXPECT_EQ(1UL, valueProducer.mPastBuckets.size());
-    EXPECT_EQ(2UL, valueProducer.mPastBuckets.begin()->second.size());
-    EXPECT_EQ(2UL, valueProducer.mPastBuckets.begin()->second[0].values.size());
-    EXPECT_EQ(1UL, valueProducer.mPastBuckets.begin()->second[1].values.size());
-
-    EXPECT_EQ(bucketSizeNs, valueProducer.mPastBuckets.begin()->second[0].mConditionTrueNs);
-    EXPECT_EQ(5, valueProducer.mPastBuckets.begin()->second[0].values[0].long_value);
-    EXPECT_EQ(0, valueProducer.mPastBuckets.begin()->second[0].valueIndex[0]);
-    EXPECT_EQ(2, valueProducer.mPastBuckets.begin()->second[0].values[1].long_value);
-    EXPECT_EQ(1, valueProducer.mPastBuckets.begin()->second[0].valueIndex[1]);
-
-    EXPECT_EQ(bucketSizeNs, valueProducer.mPastBuckets.begin()->second[1].mConditionTrueNs);
-    EXPECT_EQ(3, valueProducer.mPastBuckets.begin()->second[1].values[0].long_value);
-    EXPECT_EQ(1, valueProducer.mPastBuckets.begin()->second[1].valueIndex[0]);
-}
-
-/*
- * Tests zero default base.
- */
-TEST(ValueMetricProducerTest, TestUseZeroDefaultBase) {
-    ValueMetric metric = ValueMetricProducerTestHelper::createMetric();
-    metric.mutable_dimensions_in_what()->set_field(tagId);
-    metric.mutable_dimensions_in_what()->add_child()->set_field(1);
-    metric.set_use_zero_default_base(true);
-
-    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
-    EXPECT_CALL(*pullerManager, Pull(tagId, _))
-            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
-                data->clear();
-                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucketStartTimeNs);
-                event->write(1);
-                event->write(3);
-                event->init();
-                data->push_back(event);
-                return true;
-            }));
-
-    sp<ValueMetricProducer> valueProducer =
-            ValueMetricProducerTestHelper::createValueProducerNoConditions(pullerManager, metric);
-
-    EXPECT_EQ(1UL, valueProducer->mCurrentSlicedBucket.size());
-    auto iter = valueProducer->mCurrentSlicedBucket.begin();
-    auto& interval1 = iter->second[0];
-    auto iterBase = valueProducer->mCurrentBaseInfo.begin();
-    auto& baseInfo1 = iterBase->second[0];
-    EXPECT_EQ(1, iter->first.getDimensionKeyInWhat().getValues()[0].mValue.int_value);
-    EXPECT_EQ(true, baseInfo1.hasBase);
-    EXPECT_EQ(3, baseInfo1.base.long_value);
-    EXPECT_EQ(false, interval1.hasValue);
-    EXPECT_EQ(true, valueProducer->mHasGlobalBase);
-    EXPECT_EQ(0UL, valueProducer->mPastBuckets.size());
-    vector<shared_ptr<LogEvent>> allData;
-
-    allData.clear();
-    shared_ptr<LogEvent> event1 = make_shared<LogEvent>(tagId, bucket2StartTimeNs + 1);
-    event1->write(2);
-    event1->write(4);
-    event1->init();
-    shared_ptr<LogEvent> event2 = make_shared<LogEvent>(tagId, bucket2StartTimeNs + 1);
-    event2->write(1);
-    event2->write(11);
-    event2->init();
-    allData.push_back(event1);
-    allData.push_back(event2);
-
-    valueProducer->onDataPulled(allData, /** succeed */ true, bucket2StartTimeNs);
-    EXPECT_EQ(2UL, valueProducer->mCurrentSlicedBucket.size());
-    EXPECT_EQ(true, baseInfo1.hasBase);
-    EXPECT_EQ(11, baseInfo1.base.long_value);
-    EXPECT_EQ(false, interval1.hasValue);
-    EXPECT_EQ(8, interval1.value.long_value);
-
-    auto it = valueProducer->mCurrentSlicedBucket.begin();
-    for (; it != valueProducer->mCurrentSlicedBucket.end(); it++) {
-        if (it != iter) {
-            break;
-        }
-    }
-    auto itBase = valueProducer->mCurrentBaseInfo.begin();
-    for (; itBase != valueProducer->mCurrentBaseInfo.end(); it++) {
-        if (itBase != iterBase) {
-            break;
-        }
-    }
-    EXPECT_TRUE(it != iter);
-    EXPECT_TRUE(itBase != iterBase);
-    auto& interval2 = it->second[0];
-    auto& baseInfo2 = itBase->second[0];
-    EXPECT_EQ(2, it->first.getDimensionKeyInWhat().getValues()[0].mValue.int_value);
-    EXPECT_EQ(true, baseInfo2.hasBase);
-    EXPECT_EQ(4, baseInfo2.base.long_value);
-    EXPECT_EQ(false, interval2.hasValue);
-    EXPECT_EQ(4, interval2.value.long_value);
-
-    EXPECT_EQ(2UL, valueProducer->mPastBuckets.size());
-    auto iterator = valueProducer->mPastBuckets.begin();
-    EXPECT_EQ(bucketSizeNs, iterator->second[0].mConditionTrueNs);
-    EXPECT_EQ(8, iterator->second[0].values[0].long_value);
-    iterator++;
-    EXPECT_EQ(bucketSizeNs, iterator->second[0].mConditionTrueNs);
-    EXPECT_EQ(4, iterator->second[0].values[0].long_value);
-}
-
-/*
- * Tests using zero default base with failed pull.
- */
-TEST(ValueMetricProducerTest, TestUseZeroDefaultBaseWithPullFailures) {
-    ValueMetric metric = ValueMetricProducerTestHelper::createMetric();
-    metric.mutable_dimensions_in_what()->set_field(tagId);
-    metric.mutable_dimensions_in_what()->add_child()->set_field(1);
-    metric.set_use_zero_default_base(true);
-
-    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
-    EXPECT_CALL(*pullerManager, Pull(tagId, _))
-            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
-                data->clear();
-                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucketStartTimeNs);
-                event->write(1);
-                event->write(3);
-                event->init();
-                data->push_back(event);
-                return true;
-            }));
-
-    sp<ValueMetricProducer> valueProducer =
-            ValueMetricProducerTestHelper::createValueProducerNoConditions(pullerManager, metric);
-
-    EXPECT_EQ(1UL, valueProducer->mCurrentSlicedBucket.size());
-    auto it = valueProducer->mCurrentSlicedBucket.begin();
-    auto& interval1 = it->second[0];
-    auto& baseInfo1 =
-            valueProducer->mCurrentBaseInfo.find(it->first.getDimensionKeyInWhat())->second[0];
-    EXPECT_EQ(1, it->first.getDimensionKeyInWhat().getValues()[0].mValue.int_value);
-    EXPECT_EQ(true, baseInfo1.hasBase);
-    EXPECT_EQ(3, baseInfo1.base.long_value);
-    EXPECT_EQ(false, interval1.hasValue);
-    EXPECT_EQ(true, valueProducer->mHasGlobalBase);
-    EXPECT_EQ(0UL, valueProducer->mPastBuckets.size());
-    vector<shared_ptr<LogEvent>> allData;
-
-    allData.clear();
-    shared_ptr<LogEvent> event1 = make_shared<LogEvent>(tagId, bucket2StartTimeNs + 1);
-    event1->write(2);
-    event1->write(4);
-    event1->init();
-    shared_ptr<LogEvent> event2 = make_shared<LogEvent>(tagId, bucket2StartTimeNs + 1);
-    event2->write(1);
-    event2->write(11);
-    event2->init();
-    allData.push_back(event1);
-    allData.push_back(event2);
-
-    valueProducer->onDataPulled(allData, /** succeed */ true, bucket2StartTimeNs);
-    EXPECT_EQ(2UL, valueProducer->mCurrentSlicedBucket.size());
-    EXPECT_EQ(true, baseInfo1.hasBase);
-    EXPECT_EQ(11, baseInfo1.base.long_value);
-    EXPECT_EQ(false, interval1.hasValue);
-    EXPECT_EQ(8, interval1.value.long_value);
-
-    auto it2 = valueProducer->mCurrentSlicedBucket.begin();
-    for (; it2 != valueProducer->mCurrentSlicedBucket.end(); it2++) {
-        if (it2 != it) {
-            break;
-        }
-    }
-    // auto itBase = valueProducer->mCurrentBaseInfo.begin();
-    // for (; itBase != valueProducer->mCurrentBaseInfo.end(); it++) {
-    //     if (itBase != iterBase) {
-    //         break;
-    //     }
-    // }
-    EXPECT_TRUE(it2 != it);
-    // EXPECT_TRUE(itBase != iterBase);
-    auto& interval2 = it2->second[0];
-    auto& baseInfo2 =
-            valueProducer->mCurrentBaseInfo.find(it2->first.getDimensionKeyInWhat())->second[0];
-    EXPECT_EQ(2, it2->first.getDimensionKeyInWhat().getValues()[0].mValue.int_value);
-    EXPECT_EQ(true, baseInfo2.hasBase);
-    EXPECT_EQ(4, baseInfo2.base.long_value);
-    EXPECT_EQ(false, interval2.hasValue);
-    EXPECT_EQ(4, interval2.value.long_value);
-    EXPECT_EQ(2UL, valueProducer->mPastBuckets.size());
-
-    // next pull somehow did not happen, skip to end of bucket 3
-    allData.clear();
-    event1 = make_shared<LogEvent>(tagId, bucket4StartTimeNs + 1);
-    event1->write(2);
-    event1->write(5);
-    event1->init();
-    allData.push_back(event1);
-    valueProducer->onDataPulled(allData, /** succeed */ true, bucket4StartTimeNs);
-
-    EXPECT_EQ(1UL, valueProducer->mCurrentSlicedBucket.size());
-    EXPECT_EQ(true, baseInfo2.hasBase);
-    EXPECT_EQ(5, baseInfo2.base.long_value);
-    EXPECT_EQ(false, interval2.hasValue);
-    EXPECT_EQ(true, valueProducer->mHasGlobalBase);
-    EXPECT_EQ(2UL, valueProducer->mPastBuckets.size());
-
-    allData.clear();
-    event1 = make_shared<LogEvent>(tagId, bucket5StartTimeNs + 1);
-    event1->write(2);
-    event1->write(13);
-    event1->init();
-    allData.push_back(event1);
-    event2 = make_shared<LogEvent>(tagId, bucket5StartTimeNs + 1);
-    event2->write(1);
-    event2->write(5);
-    event2->init();
-    allData.push_back(event2);
-    valueProducer->onDataPulled(allData, /** succeed */ true, bucket5StartTimeNs);
-
-    EXPECT_EQ(2UL, valueProducer->mCurrentSlicedBucket.size());
-    it = valueProducer->mCurrentSlicedBucket.begin();
-    it2 = std::next(valueProducer->mCurrentSlicedBucket.begin());
-    interval1 = it->second[0];
-    interval2 = it2->second[0];
-    baseInfo1 = valueProducer->mCurrentBaseInfo.find(it->first.getDimensionKeyInWhat())->second[0];
-    baseInfo2 = valueProducer->mCurrentBaseInfo.find(it2->first.getDimensionKeyInWhat())->second[0];
-
-    EXPECT_EQ(true, baseInfo1.hasBase);
-    EXPECT_EQ(5, baseInfo1.base.long_value);
-    EXPECT_EQ(false, interval1.hasValue);
-    EXPECT_EQ(5, interval1.value.long_value);
-    EXPECT_EQ(true, valueProducer->mHasGlobalBase);
-
-    EXPECT_EQ(true, baseInfo2.hasBase);
-    EXPECT_EQ(13, baseInfo2.base.long_value);
-    EXPECT_EQ(false, interval2.hasValue);
-    EXPECT_EQ(8, interval2.value.long_value);
-
-    EXPECT_EQ(2UL, valueProducer->mPastBuckets.size());
-}
-
-/*
- * Tests trim unused dimension key if no new data is seen in an entire bucket.
- */
-TEST(ValueMetricProducerTest, TestTrimUnusedDimensionKey) {
-    ValueMetric metric = ValueMetricProducerTestHelper::createMetric();
-    metric.mutable_dimensions_in_what()->set_field(tagId);
-    metric.mutable_dimensions_in_what()->add_child()->set_field(1);
-
-    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
-    EXPECT_CALL(*pullerManager, Pull(tagId, _))
-            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
-                data->clear();
-                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucketStartTimeNs);
-                event->write(1);
-                event->write(3);
-                event->init();
-                data->push_back(event);
-                return true;
-            }));
-
-    sp<ValueMetricProducer> valueProducer =
-            ValueMetricProducerTestHelper::createValueProducerNoConditions(pullerManager, metric);
-
-    EXPECT_EQ(1UL, valueProducer->mCurrentSlicedBucket.size());
-    auto iter = valueProducer->mCurrentSlicedBucket.begin();
-    auto& interval1 = iter->second[0];
-    auto iterBase = valueProducer->mCurrentBaseInfo.begin();
-    auto& baseInfo1 = iterBase->second[0];
-    EXPECT_EQ(1, iter->first.getDimensionKeyInWhat().getValues()[0].mValue.int_value);
-    EXPECT_EQ(true, baseInfo1.hasBase);
-    EXPECT_EQ(3, baseInfo1.base.long_value);
-    EXPECT_EQ(false, interval1.hasValue);
-    EXPECT_EQ(0UL, valueProducer->mPastBuckets.size());
-    vector<shared_ptr<LogEvent>> allData;
-
-    allData.clear();
-    shared_ptr<LogEvent> event1 = make_shared<LogEvent>(tagId, bucket2StartTimeNs + 1);
-    event1->write(2);
-    event1->write(4);
-    event1->init();
-    shared_ptr<LogEvent> event2 = make_shared<LogEvent>(tagId, bucket2StartTimeNs + 1);
-    event2->write(1);
-    event2->write(11);
-    event2->init();
-    allData.push_back(event1);
-    allData.push_back(event2);
-
-    valueProducer->onDataPulled(allData, /** succeed */ true, bucket2StartTimeNs);
-    EXPECT_EQ(2UL, valueProducer->mCurrentSlicedBucket.size());
-    EXPECT_EQ(true, baseInfo1.hasBase);
-    EXPECT_EQ(11, baseInfo1.base.long_value);
-    EXPECT_EQ(false, interval1.hasValue);
-    EXPECT_EQ(8, interval1.value.long_value);
-    EXPECT_FALSE(interval1.seenNewData);
-    assertPastBucketValuesSingleKey(valueProducer->mPastBuckets, {8}, {bucketSizeNs});
-
-    auto it = valueProducer->mCurrentSlicedBucket.begin();
-    for (; it != valueProducer->mCurrentSlicedBucket.end(); it++) {
-        if (it != iter) {
-            break;
-        }
-    }
-    auto itBase = valueProducer->mCurrentBaseInfo.begin();
-    for (; itBase != valueProducer->mCurrentBaseInfo.end(); it++) {
-        if (itBase != iterBase) {
-            break;
-        }
-    }
-    EXPECT_TRUE(it != iter);
-    EXPECT_TRUE(itBase != iterBase);
-    auto& interval2 = it->second[0];
-    auto& baseInfo2 = itBase->second[0];
-    EXPECT_EQ(2, it->first.getDimensionKeyInWhat().getValues()[0].mValue.int_value);
-    EXPECT_EQ(true, baseInfo2.hasBase);
-    EXPECT_EQ(4, baseInfo2.base.long_value);
-    EXPECT_EQ(false, interval2.hasValue);
-    EXPECT_FALSE(interval2.seenNewData);
-    assertPastBucketValuesSingleKey(valueProducer->mPastBuckets, {8}, {bucketSizeNs});
-
-    // next pull somehow did not happen, skip to end of bucket 3
-    allData.clear();
-    event1 = make_shared<LogEvent>(tagId, bucket4StartTimeNs + 1);
-    event1->write(2);
-    event1->write(5);
-    event1->init();
-    allData.push_back(event1);
-    valueProducer->onDataPulled(allData, /** succeed */ true, bucket4StartTimeNs);
-    // Only one interval left. One was trimmed.
-    EXPECT_EQ(1UL, valueProducer->mCurrentSlicedBucket.size());
-    interval2 = valueProducer->mCurrentSlicedBucket.begin()->second[0];
-    baseInfo2 = valueProducer->mCurrentBaseInfo.begin()->second[0];
-    EXPECT_EQ(2, it->first.getDimensionKeyInWhat().getValues()[0].mValue.int_value);
-    EXPECT_EQ(true, baseInfo2.hasBase);
-    EXPECT_EQ(5, baseInfo2.base.long_value);
-    EXPECT_EQ(false, interval2.hasValue);
-    EXPECT_FALSE(interval2.seenNewData);
-    assertPastBucketValuesSingleKey(valueProducer->mPastBuckets, {8}, {bucketSizeNs});
-
-    allData.clear();
-    event1 = make_shared<LogEvent>(tagId, bucket5StartTimeNs + 1);
-    event1->write(2);
-    event1->write(14);
-    event1->init();
-    allData.push_back(event1);
-    valueProducer->onDataPulled(allData, /** succeed */ true, bucket5StartTimeNs);
-
-    interval2 = valueProducer->mCurrentSlicedBucket.begin()->second[0];
-    baseInfo2 = valueProducer->mCurrentBaseInfo.begin()->second[0];
-    EXPECT_EQ(true, baseInfo2.hasBase);
-    EXPECT_EQ(14, baseInfo2.base.long_value);
-    EXPECT_EQ(false, interval2.hasValue);
-    EXPECT_FALSE(interval2.seenNewData);
-    ASSERT_EQ(2UL, valueProducer->mPastBuckets.size());
-    auto iterator = valueProducer->mPastBuckets.begin();
-    EXPECT_EQ(9, iterator->second[0].values[0].long_value);
-    EXPECT_EQ(bucketSizeNs, iterator->second[0].mConditionTrueNs);
-    iterator++;
-    EXPECT_EQ(8, iterator->second[0].values[0].long_value);
-    EXPECT_EQ(bucketSizeNs, iterator->second[0].mConditionTrueNs);
-}
-
-TEST(ValueMetricProducerTest, TestResetBaseOnPullFailAfterConditionChange_EndOfBucket) {
-    ValueMetric metric = ValueMetricProducerTestHelper::createMetricWithCondition();
-
-    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
-    // Used by onConditionChanged.
-    EXPECT_CALL(*pullerManager, Pull(tagId, _))
-            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
-                data->clear();
-                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucketStartTimeNs + 8);
-                event->write(tagId);
-                event->write(100);
-                event->init();
-                data->push_back(event);
-                return true;
-            }));
-
-    sp<ValueMetricProducer> valueProducer =
-            ValueMetricProducerTestHelper::createValueProducerWithCondition(pullerManager, metric);
-
-    valueProducer->onConditionChanged(true, bucketStartTimeNs + 8);
-    // has one slice
-    EXPECT_EQ(1UL, valueProducer->mCurrentSlicedBucket.size());
-    ValueMetricProducer::Interval& curInterval =
-            valueProducer->mCurrentSlicedBucket.begin()->second[0];
-    ValueMetricProducer::BaseInfo& curBaseInfo = valueProducer->mCurrentBaseInfo.begin()->second[0];
-    EXPECT_EQ(true, curBaseInfo.hasBase);
-    EXPECT_EQ(100, curBaseInfo.base.long_value);
-    EXPECT_EQ(false, curInterval.hasValue);
-
-    vector<shared_ptr<LogEvent>> allData;
-    valueProducer->onDataPulled(allData, /** succeed */ false, bucket2StartTimeNs);
-    EXPECT_EQ(1UL, valueProducer->mCurrentSlicedBucket.size());
-    EXPECT_EQ(false, curBaseInfo.hasBase);
-    EXPECT_EQ(false, curInterval.hasValue);
-    EXPECT_EQ(false, valueProducer->mHasGlobalBase);
-}
-
-TEST(ValueMetricProducerTest, TestResetBaseOnPullFailAfterConditionChange) {
-    ValueMetric metric = ValueMetricProducerTestHelper::createMetricWithCondition();
-
-    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
-    EXPECT_CALL(*pullerManager, Pull(tagId, _))
-            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
-                data->clear();
-                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucketStartTimeNs + 8);
-                event->write(tagId);
-                event->write(100);
-                event->init();
-                data->push_back(event);
-                return true;
-            }))
-            .WillOnce(Return(false));
-
-    sp<ValueMetricProducer> valueProducer =
-            ValueMetricProducerTestHelper::createValueProducerWithCondition(pullerManager, metric);
-
-    valueProducer->onConditionChanged(true, bucketStartTimeNs + 8);
-
-    // has one slice
-    EXPECT_EQ(1UL, valueProducer->mCurrentSlicedBucket.size());
-    ValueMetricProducer::Interval& curInterval =
-            valueProducer->mCurrentSlicedBucket.begin()->second[0];
-    ValueMetricProducer::BaseInfo& curBaseInfo = valueProducer->mCurrentBaseInfo.begin()->second[0];
-    EXPECT_EQ(true, curBaseInfo.hasBase);
-    EXPECT_EQ(100, curBaseInfo.base.long_value);
-    EXPECT_EQ(false, curInterval.hasValue);
-    EXPECT_EQ(0UL, valueProducer->mPastBuckets.size());
-
-    valueProducer->onConditionChanged(false, bucketStartTimeNs + 20);
-
-    // has one slice
-    EXPECT_EQ(1UL, valueProducer->mCurrentSlicedBucket.size());
-    EXPECT_EQ(false, curInterval.hasValue);
-    EXPECT_EQ(false, curBaseInfo.hasBase);
-    EXPECT_EQ(false, valueProducer->mHasGlobalBase);
-}
-
-TEST(ValueMetricProducerTest, TestResetBaseOnPullFailBeforeConditionChange) {
-    ValueMetric metric = ValueMetricProducerTestHelper::createMetricWithCondition();
-
-    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
-    EXPECT_CALL(*pullerManager, Pull(tagId, _))
-            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
-                data->clear();
-                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucketStartTimeNs);
-                event->write(tagId);
-                event->write(50);
-                event->init();
-                data->push_back(event);
-                return false;
-            }))
-            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
-                data->clear();
-                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucketStartTimeNs + 8);
-                event->write(tagId);
-                event->write(100);
-                event->init();
-                data->push_back(event);
-                return true;
-            }));
-
-    sp<ValueMetricProducer> valueProducer =
-            ValueMetricProducerTestHelper::createValueProducerWithCondition(pullerManager, metric);
-
-    // Don't directly set mCondition; the real code never does that. Go through regular code path
-    // to avoid unexpected behaviors.
-    // valueProducer->mCondition = ConditionState::kTrue;
-    valueProducer->onConditionChanged(true, bucketStartTimeNs);
-
-    EXPECT_EQ(0UL, valueProducer->mCurrentSlicedBucket.size());
-
-    valueProducer->onConditionChanged(false, bucketStartTimeNs + 1);
-    EXPECT_EQ(1UL, valueProducer->mCurrentSlicedBucket.size());
-    ValueMetricProducer::Interval& curInterval =
-            valueProducer->mCurrentSlicedBucket.begin()->second[0];
-    ValueMetricProducer::BaseInfo curBaseInfo = valueProducer->mCurrentBaseInfo.begin()->second[0];
-    EXPECT_EQ(false, curBaseInfo.hasBase);
-    EXPECT_EQ(false, curInterval.hasValue);
-    EXPECT_EQ(false, valueProducer->mHasGlobalBase);
-}
-
-TEST(ValueMetricProducerTest, TestResetBaseOnPullDelayExceeded) {
-    ValueMetric metric = ValueMetricProducerTestHelper::createMetric();
-    metric.set_condition(StringToId("SCREEN_ON"));
-    metric.set_max_pull_delay_sec(0);
-
-    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
-    EXPECT_CALL(*pullerManager, Pull(tagId, _))
-            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
-                data->clear();
-                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucketStartTimeNs + 1);
-                event->write(tagId);
-                event->write(120);
-                event->init();
-                data->push_back(event);
-                return true;
-            }));
-
-    sp<ValueMetricProducer> valueProducer =
-            ValueMetricProducerTestHelper::createValueProducerWithCondition(pullerManager, metric);
-
-    valueProducer->mCondition = ConditionState::kFalse;
-
-    // Max delay is set to 0 so pull will exceed max delay.
-    valueProducer->onConditionChanged(true, bucketStartTimeNs + 1);
-    EXPECT_EQ(0UL, valueProducer->mCurrentSlicedBucket.size());
-}
-
-TEST(ValueMetricProducerTest, TestResetBaseOnPullTooLate) {
-    ValueMetric metric = ValueMetricProducerTestHelper::createMetricWithCondition();
-
-    UidMap uidMap;
-    SimpleAtomMatcher atomMatcher;
-    atomMatcher.set_atom_id(tagId);
-    sp<EventMatcherWizard> eventMatcherWizard =
-            new EventMatcherWizard({new SimpleLogMatchingTracker(
-                    atomMatcherId, logEventMatcherIndex, atomMatcher, uidMap)});
-    sp<MockConditionWizard> wizard = new NaggyMock<MockConditionWizard>();
-    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
-    EXPECT_CALL(*pullerManager, RegisterReceiver(tagId, _, _, _)).WillOnce(Return());
-    EXPECT_CALL(*pullerManager, UnRegisterReceiver(tagId, _)).WillRepeatedly(Return());
-
-    ValueMetricProducer valueProducer(kConfigKey, metric, 1, wizard, logEventMatcherIndex,
-                                      eventMatcherWizard, tagId, bucket2StartTimeNs,
-                                      bucket2StartTimeNs, pullerManager);
-    valueProducer.mCondition = ConditionState::kFalse;
-
-    // Event should be skipped since it is from previous bucket.
-    // Pull should not be called.
-    valueProducer.onConditionChanged(true, bucketStartTimeNs);
-    EXPECT_EQ(0UL, valueProducer.mCurrentSlicedBucket.size());
-}
-
-TEST(ValueMetricProducerTest, TestBaseSetOnConditionChange) {
-    ValueMetric metric = ValueMetricProducerTestHelper::createMetricWithCondition();
-
-    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
-    EXPECT_CALL(*pullerManager, Pull(tagId, _))
-            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
-                data->clear();
-                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucketStartTimeNs + 1);
-                event->write(tagId);
-                event->write(100);
-                event->init();
-                data->push_back(event);
-                return true;
-            }));
-
-    sp<ValueMetricProducer> valueProducer =
-            ValueMetricProducerTestHelper::createValueProducerWithCondition(pullerManager, metric);
-
-    valueProducer->mCondition = ConditionState::kFalse;
-    valueProducer->mHasGlobalBase = false;
-
-    valueProducer->onConditionChanged(true, bucketStartTimeNs + 1);
-    valueProducer->mHasGlobalBase = true;
-    EXPECT_EQ(1UL, valueProducer->mCurrentSlicedBucket.size());
-    ValueMetricProducer::Interval& curInterval =
-            valueProducer->mCurrentSlicedBucket.begin()->second[0];
-    ValueMetricProducer::BaseInfo curBaseInfo = valueProducer->mCurrentBaseInfo.begin()->second[0];
-    EXPECT_EQ(true, curBaseInfo.hasBase);
-    EXPECT_EQ(100, curBaseInfo.base.long_value);
-    EXPECT_EQ(false, curInterval.hasValue);
-    EXPECT_EQ(true, valueProducer->mHasGlobalBase);
-}
-
-/*
- * Tests that a bucket is marked invalid when a condition change pull fails.
- */
-TEST(ValueMetricProducerTest_BucketDrop, TestInvalidBucketWhenOneConditionFailed) {
-    ValueMetric metric = ValueMetricProducerTestHelper::createMetricWithCondition();
-
-    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
-    EXPECT_CALL(*pullerManager, Pull(tagId, _))
-            // First onConditionChanged
-            .WillOnce(Return(false))
-            // Second onConditionChanged
-            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
-                data->clear();
-                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucketStartTimeNs + 8);
-                event->write(tagId);
-                event->write(130);
-                event->init();
-                data->push_back(event);
-                return true;
-            }));
-
-    sp<ValueMetricProducer> valueProducer =
-            ValueMetricProducerTestHelper::createValueProducerWithCondition(pullerManager, metric);
-
-    valueProducer->mCondition = ConditionState::kTrue;
-
-    // Bucket start.
-    vector<shared_ptr<LogEvent>> allData;
-    allData.clear();
-    shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucketStartTimeNs + 1);
-    event->write(1);
-    event->write(110);
-    event->init();
-    allData.push_back(event);
-    valueProducer->onDataPulled(allData, /** succeed */ true, bucketStartTimeNs);
-
-    // This will fail and should invalidate the whole bucket since we do not have all the data
-    // needed to compute the metric value when the screen was on.
-    valueProducer->onConditionChanged(false, bucketStartTimeNs + 2);
-    valueProducer->onConditionChanged(true, bucketStartTimeNs + 3);
-
-    // Bucket end.
-    allData.clear();
-    shared_ptr<LogEvent> event2 = make_shared<LogEvent>(tagId, bucket2StartTimeNs + 1);
-    event2->write(1);
-    event2->write(140);
-    event2->init();
-    allData.push_back(event2);
-    valueProducer->onDataPulled(allData, /** succeed */ true, bucket2StartTimeNs);
-
-    valueProducer->flushIfNeededLocked(bucket2StartTimeNs + 1);
-
-    EXPECT_EQ(0UL, valueProducer->mPastBuckets.size());
-    // Contains base from last pull which was successful.
-    EXPECT_EQ(1UL, valueProducer->mCurrentSlicedBucket.size());
-    ValueMetricProducer::Interval& curInterval =
-            valueProducer->mCurrentSlicedBucket.begin()->second[0];
-    ValueMetricProducer::BaseInfo curBaseInfo = valueProducer->mCurrentBaseInfo.begin()->second[0];
-    EXPECT_EQ(true, curBaseInfo.hasBase);
-    EXPECT_EQ(140, curBaseInfo.base.long_value);
-    EXPECT_EQ(false, curInterval.hasValue);
-    EXPECT_EQ(true, valueProducer->mHasGlobalBase);
-
-    // Check dump report.
-    ProtoOutputStream output;
-    std::set<string> strSet;
-    valueProducer->onDumpReport(bucket2StartTimeNs + 10, false /* include partial bucket */, true,
-                                FAST /* dumpLatency */, &strSet, &output);
-
-    StatsLogReport report = outputStreamToProto(&output);
-    EXPECT_TRUE(report.has_value_metrics());
-    EXPECT_EQ(0, report.value_metrics().data_size());
-    EXPECT_EQ(1, report.value_metrics().skipped_size());
-
-    EXPECT_EQ(NanoToMillis(bucketStartTimeNs),
-              report.value_metrics().skipped(0).start_bucket_elapsed_millis());
-    EXPECT_EQ(NanoToMillis(bucket2StartTimeNs),
-              report.value_metrics().skipped(0).end_bucket_elapsed_millis());
-    EXPECT_EQ(1, report.value_metrics().skipped(0).drop_event_size());
-
-    auto dropEvent = report.value_metrics().skipped(0).drop_event(0);
-    EXPECT_EQ(BucketDropReason::PULL_FAILED, dropEvent.drop_reason());
-    EXPECT_EQ(NanoToMillis(bucketStartTimeNs + 2), dropEvent.drop_time_millis());
-}
-
-/*
- * Tests that a bucket is marked invalid when the guardrail is hit.
- */
-TEST(ValueMetricProducerTest_BucketDrop, TestInvalidBucketWhenGuardRailHit) {
-    ValueMetric metric = ValueMetricProducerTestHelper::createMetric();
-    metric.mutable_dimensions_in_what()->set_field(tagId);
-    metric.mutable_dimensions_in_what()->add_child()->set_field(1);
-    metric.set_condition(StringToId("SCREEN_ON"));
-
-    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
-    EXPECT_CALL(*pullerManager, Pull(tagId, _))
-            // First onConditionChanged
-            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
-                for (int i = 0; i < 2000; i++) {
-                    shared_ptr<LogEvent> event =
-                            make_shared<LogEvent>(tagId, bucketStartTimeNs + 1);
-                    event->write(i);
-                    event->write(i);
-                    event->init();
-                    data->push_back(event);
-                }
-                return true;
-            }));
-
-    sp<ValueMetricProducer> valueProducer =
-            ValueMetricProducerTestHelper::createValueProducerWithCondition(pullerManager, metric);
-    valueProducer->mCondition = ConditionState::kFalse;
-
-    valueProducer->onConditionChanged(true, bucketStartTimeNs + 2);
-    EXPECT_EQ(true, valueProducer->mCurrentBucketIsInvalid);
-    EXPECT_EQ(0UL, valueProducer->mCurrentSlicedBucket.size());
-    EXPECT_EQ(0UL, valueProducer->mSkippedBuckets.size());
-
-    // Bucket 2 start.
-    vector<shared_ptr<LogEvent>> allData;
-    allData.clear();
-    shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucket2StartTimeNs + 1);
-    event->write(1);
-    event->write(10);
-    event->init();
-    allData.push_back(event);
-    valueProducer->onDataPulled(allData, /** succeed */ true, bucket2StartTimeNs);
-
-    // First bucket added to mSkippedBuckets after flush.
-    EXPECT_EQ(1UL, valueProducer->mSkippedBuckets.size());
-
-    // Check dump report.
-    ProtoOutputStream output;
-    std::set<string> strSet;
-    valueProducer->onDumpReport(bucket2StartTimeNs + 10000, false /* include recent buckets */,
-                                true, FAST /* dumpLatency */, &strSet, &output);
-
-    StatsLogReport report = outputStreamToProto(&output);
-    EXPECT_TRUE(report.has_value_metrics());
-    EXPECT_EQ(0, report.value_metrics().data_size());
-    EXPECT_EQ(1, report.value_metrics().skipped_size());
-
-    EXPECT_EQ(NanoToMillis(bucketStartTimeNs),
-              report.value_metrics().skipped(0).start_bucket_elapsed_millis());
-    EXPECT_EQ(NanoToMillis(bucket2StartTimeNs),
-              report.value_metrics().skipped(0).end_bucket_elapsed_millis());
-    EXPECT_EQ(1, report.value_metrics().skipped(0).drop_event_size());
-
-    auto dropEvent = report.value_metrics().skipped(0).drop_event(0);
-    EXPECT_EQ(BucketDropReason::DIMENSION_GUARDRAIL_REACHED, dropEvent.drop_reason());
-    EXPECT_EQ(NanoToMillis(bucketStartTimeNs + 2), dropEvent.drop_time_millis());
-}
-
-/*
- * Tests that a bucket is marked invalid when the bucket's initial pull fails.
- */
-TEST(ValueMetricProducerTest_BucketDrop, TestInvalidBucketWhenInitialPullFailed) {
-    ValueMetric metric = ValueMetricProducerTestHelper::createMetricWithCondition();
-
-    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
-    EXPECT_CALL(*pullerManager, Pull(tagId, _))
-            // First onConditionChanged
-            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
-                data->clear();
-                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucketStartTimeNs + 8);
-                event->write(tagId);
-                event->write(120);
-                event->init();
-                data->push_back(event);
-                return true;
-            }))
-            // Second onConditionChanged
-            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
-                data->clear();
-                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucketStartTimeNs + 8);
-                event->write(tagId);
-                event->write(130);
-                event->init();
-                data->push_back(event);
-                return true;
-            }));
-
-    sp<ValueMetricProducer> valueProducer =
-            ValueMetricProducerTestHelper::createValueProducerWithCondition(pullerManager, metric);
-
-    valueProducer->mCondition = ConditionState::kTrue;
-
-    // Bucket start.
-    vector<shared_ptr<LogEvent>> allData;
-    allData.clear();
-    shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucketStartTimeNs + 1);
-    event->write(1);
-    event->write(110);
-    event->init();
-    allData.push_back(event);
-    valueProducer->onDataPulled(allData, /** succeed */ false, bucketStartTimeNs);
-
-    valueProducer->onConditionChanged(false, bucketStartTimeNs + 2);
-    valueProducer->onConditionChanged(true, bucketStartTimeNs + 3);
-
-    // Bucket end.
-    allData.clear();
-    shared_ptr<LogEvent> event2 = make_shared<LogEvent>(tagId, bucket2StartTimeNs + 1);
-    event2->write(1);
-    event2->write(140);
-    event2->init();
-    allData.push_back(event2);
-    valueProducer->onDataPulled(allData, /** succeed */ true, bucket2StartTimeNs);
-
-    valueProducer->flushIfNeededLocked(bucket2StartTimeNs + 1);
-
-    EXPECT_EQ(0UL, valueProducer->mPastBuckets.size());
-    // Contains base from last pull which was successful.
-    EXPECT_EQ(1UL, valueProducer->mCurrentSlicedBucket.size());
-    ValueMetricProducer::Interval& curInterval =
-            valueProducer->mCurrentSlicedBucket.begin()->second[0];
-    ValueMetricProducer::BaseInfo curBaseInfo = valueProducer->mCurrentBaseInfo.begin()->second[0];
-    EXPECT_EQ(true, curBaseInfo.hasBase);
-    EXPECT_EQ(140, curBaseInfo.base.long_value);
-    EXPECT_EQ(false, curInterval.hasValue);
-    EXPECT_EQ(true, valueProducer->mHasGlobalBase);
-
-    // Check dump report.
-    ProtoOutputStream output;
-    std::set<string> strSet;
-    valueProducer->onDumpReport(bucket2StartTimeNs + 10000, false /* include recent buckets */,
-                                true, FAST /* dumpLatency */, &strSet, &output);
-
-    StatsLogReport report = outputStreamToProto(&output);
-    EXPECT_TRUE(report.has_value_metrics());
-    EXPECT_EQ(0, report.value_metrics().data_size());
-    EXPECT_EQ(1, report.value_metrics().skipped_size());
-
-    EXPECT_EQ(NanoToMillis(bucketStartTimeNs),
-              report.value_metrics().skipped(0).start_bucket_elapsed_millis());
-    EXPECT_EQ(NanoToMillis(bucket2StartTimeNs),
-              report.value_metrics().skipped(0).end_bucket_elapsed_millis());
-    EXPECT_EQ(1, report.value_metrics().skipped(0).drop_event_size());
-
-    auto dropEvent = report.value_metrics().skipped(0).drop_event(0);
-    EXPECT_EQ(BucketDropReason::PULL_FAILED, dropEvent.drop_reason());
-    EXPECT_EQ(NanoToMillis(bucketStartTimeNs + 2), dropEvent.drop_time_millis());
-}
-
-/*
- * Tests that a bucket is marked invalid when the bucket's final pull fails
- * (i.e. failed pull on bucket boundary).
- */
-TEST(ValueMetricProducerTest_BucketDrop, TestInvalidBucketWhenLastPullFailed) {
-    ValueMetric metric = ValueMetricProducerTestHelper::createMetricWithCondition();
-
-    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
-    EXPECT_CALL(*pullerManager, Pull(tagId, _))
-            // First onConditionChanged
-            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
-                data->clear();
-                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucketStartTimeNs + 8);
-                event->write(tagId);
-                event->write(120);
-                event->init();
-                data->push_back(event);
-                return true;
-            }))
-            // Second onConditionChanged
-            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
-                data->clear();
-                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucketStartTimeNs + 8);
-                event->write(tagId);
-                event->write(130);
-                event->init();
-                data->push_back(event);
-                return true;
-            }));
-
-    sp<ValueMetricProducer> valueProducer =
-            ValueMetricProducerTestHelper::createValueProducerWithCondition(pullerManager, metric);
-
-    valueProducer->mCondition = ConditionState::kTrue;
-
-    // Bucket start.
-    vector<shared_ptr<LogEvent>> allData;
-    allData.clear();
-    shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucketStartTimeNs + 1);
-    event->write(1);
-    event->write(110);
-    event->init();
-    allData.push_back(event);
-    valueProducer->onDataPulled(allData, /** succeed */ true, bucketStartTimeNs);
-
-    valueProducer->onConditionChanged(false, bucketStartTimeNs + 2);
-    valueProducer->onConditionChanged(true, bucketStartTimeNs + 3);
-
-    // Bucket end.
-    allData.clear();
-    shared_ptr<LogEvent> event2 = make_shared<LogEvent>(tagId, bucket2StartTimeNs + 1);
-    event2->write(1);
-    event2->write(140);
-    event2->init();
-    allData.push_back(event2);
-    valueProducer->onDataPulled(allData, /** succeed */ false, bucket2StartTimeNs);
-
-    valueProducer->flushIfNeededLocked(bucket2StartTimeNs + 1);
-
-    EXPECT_EQ(0UL, valueProducer->mPastBuckets.size());
-    // Last pull failed so base has been reset.
-    EXPECT_EQ(1UL, valueProducer->mCurrentSlicedBucket.size());
-    ValueMetricProducer::Interval& curInterval =
-            valueProducer->mCurrentSlicedBucket.begin()->second[0];
-    ValueMetricProducer::BaseInfo curBaseInfo = valueProducer->mCurrentBaseInfo.begin()->second[0];
-    EXPECT_EQ(false, curBaseInfo.hasBase);
-    EXPECT_EQ(false, curInterval.hasValue);
-    EXPECT_EQ(false, valueProducer->mHasGlobalBase);
-
-    // Check dump report.
-    ProtoOutputStream output;
-    std::set<string> strSet;
-    valueProducer->onDumpReport(bucket2StartTimeNs + 10000, false /* include recent buckets */,
-                                true, FAST /* dumpLatency */, &strSet, &output);
-
-    StatsLogReport report = outputStreamToProto(&output);
-    EXPECT_TRUE(report.has_value_metrics());
-    EXPECT_EQ(0, report.value_metrics().data_size());
-    EXPECT_EQ(1, report.value_metrics().skipped_size());
-
-    EXPECT_EQ(NanoToMillis(bucketStartTimeNs),
-              report.value_metrics().skipped(0).start_bucket_elapsed_millis());
-    EXPECT_EQ(NanoToMillis(bucket2StartTimeNs),
-              report.value_metrics().skipped(0).end_bucket_elapsed_millis());
-    EXPECT_EQ(1, report.value_metrics().skipped(0).drop_event_size());
-
-    auto dropEvent = report.value_metrics().skipped(0).drop_event(0);
-    EXPECT_EQ(BucketDropReason::PULL_FAILED, dropEvent.drop_reason());
-    EXPECT_EQ(NanoToMillis(bucket2StartTimeNs), dropEvent.drop_time_millis());
-}
-
-TEST(ValueMetricProducerTest, TestEmptyDataResetsBase_onDataPulled) {
-    ValueMetric metric = ValueMetricProducerTestHelper::createMetric();
-    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
-    EXPECT_CALL(*pullerManager, Pull(tagId, _))
-            // Start bucket.
-            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
-                data->clear();
-                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucketStartTimeNs);
-                event->write(tagId);
-                event->write(3);
-                event->init();
-                data->push_back(event);
-                return true;
-            }));
-
-    sp<ValueMetricProducer> valueProducer =
-            ValueMetricProducerTestHelper::createValueProducerNoConditions(pullerManager, metric);
-
-    // Bucket 2 start.
-    vector<shared_ptr<LogEvent>> allData;
-    allData.clear();
-    shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucket2StartTimeNs + 1);
-    event->write(tagId);
-    event->write(110);
-    event->init();
-    allData.push_back(event);
-    valueProducer->onDataPulled(allData, /** succeed */ true, bucket2StartTimeNs);
-    EXPECT_EQ(1UL, valueProducer->mCurrentSlicedBucket.size());
-    EXPECT_EQ(1UL, valueProducer->mPastBuckets.size());
-
-    // Bucket 3 empty.
-    allData.clear();
-    shared_ptr<LogEvent> event2 = make_shared<LogEvent>(tagId, bucket3StartTimeNs + 1);
-    event2->init();
-    allData.push_back(event2);
-    valueProducer->onDataPulled(allData, /** succeed */ true, bucket3StartTimeNs);
-    // Data has been trimmed.
-    EXPECT_EQ(0UL, valueProducer->mCurrentSlicedBucket.size());
-    EXPECT_EQ(1UL, valueProducer->mPastBuckets.size());
-}
-
-TEST(ValueMetricProducerTest, TestEmptyDataResetsBase_onConditionChanged) {
-    ValueMetric metric = ValueMetricProducerTestHelper::createMetricWithCondition();
-
-    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
-    EXPECT_CALL(*pullerManager, Pull(tagId, _))
-            // First onConditionChanged
-            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
-                data->clear();
-                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucketStartTimeNs);
-                event->write(tagId);
-                event->write(3);
-                event->init();
-                data->push_back(event);
-                return true;
-            }))
-            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
-                data->clear();
-                return true;
-            }));
-
-    sp<ValueMetricProducer> valueProducer =
-            ValueMetricProducerTestHelper::createValueProducerWithCondition(pullerManager, metric);
-
-    valueProducer->onConditionChanged(true, bucketStartTimeNs + 10);
-    EXPECT_EQ(1UL, valueProducer->mCurrentSlicedBucket.size());
-    ValueMetricProducer::Interval& curInterval =
-            valueProducer->mCurrentSlicedBucket.begin()->second[0];
-    ValueMetricProducer::BaseInfo curBaseInfo = valueProducer->mCurrentBaseInfo.begin()->second[0];
-    EXPECT_EQ(true, curBaseInfo.hasBase);
-    EXPECT_EQ(false, curInterval.hasValue);
-    EXPECT_EQ(true, valueProducer->mHasGlobalBase);
-
-    // Empty pull.
-    valueProducer->onConditionChanged(false, bucketStartTimeNs + 10);
-    EXPECT_EQ(1UL, valueProducer->mCurrentSlicedBucket.size());
-    curInterval = valueProducer->mCurrentSlicedBucket.begin()->second[0];
-    curBaseInfo = valueProducer->mCurrentBaseInfo.begin()->second[0];
-    EXPECT_EQ(false, curBaseInfo.hasBase);
-    EXPECT_EQ(false, curInterval.hasValue);
-    EXPECT_EQ(false, valueProducer->mHasGlobalBase);
-}
-
-TEST(ValueMetricProducerTest, TestEmptyDataResetsBase_onBucketBoundary) {
-    ValueMetric metric = ValueMetricProducerTestHelper::createMetricWithCondition();
-
-    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
-    EXPECT_CALL(*pullerManager, Pull(tagId, _))
-            // First onConditionChanged
-            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
-                data->clear();
-                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucketStartTimeNs);
-                event->write(tagId);
-                event->write(1);
-                event->init();
-                data->push_back(event);
-                return true;
-            }))
-            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
-                data->clear();
-                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucketStartTimeNs);
-                event->write(tagId);
-                event->write(2);
-                event->init();
-                data->push_back(event);
-                return true;
-            }))
-            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
-                data->clear();
-                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucketStartTimeNs);
-                event->write(tagId);
-                event->write(5);
-                event->init();
-                data->push_back(event);
-                return true;
-            }));
-
-    sp<ValueMetricProducer> valueProducer =
-            ValueMetricProducerTestHelper::createValueProducerWithCondition(pullerManager, metric);
-
-    valueProducer->onConditionChanged(true, bucketStartTimeNs + 10);
-    valueProducer->onConditionChanged(false, bucketStartTimeNs + 11);
-    valueProducer->onConditionChanged(true, bucketStartTimeNs + 12);
-    EXPECT_EQ(1UL, valueProducer->mCurrentSlicedBucket.size());
-    ValueMetricProducer::Interval& curInterval =
-            valueProducer->mCurrentSlicedBucket.begin()->second[0];
-    ValueMetricProducer::BaseInfo curBaseInfo = valueProducer->mCurrentBaseInfo.begin()->second[0];
-    EXPECT_EQ(true, curBaseInfo.hasBase);
-    EXPECT_EQ(true, curInterval.hasValue);
-    EXPECT_EQ(true, valueProducer->mHasGlobalBase);
-
-    // End of bucket
-    vector<shared_ptr<LogEvent>> allData;
-    allData.clear();
-    valueProducer->onDataPulled(allData, /** succeed */ true, bucket2StartTimeNs);
-    EXPECT_EQ(1UL, valueProducer->mCurrentSlicedBucket.size());
-    curInterval = valueProducer->mCurrentSlicedBucket.begin()->second[0];
-    curBaseInfo = valueProducer->mCurrentBaseInfo.begin()->second[0];
-    // Data is empty, base should be reset.
-    EXPECT_EQ(false, curBaseInfo.hasBase);
-    EXPECT_EQ(5, curBaseInfo.base.long_value);
-    EXPECT_EQ(false, curInterval.hasValue);
-    EXPECT_EQ(true, valueProducer->mHasGlobalBase);
-
-    EXPECT_EQ(1UL, valueProducer->mPastBuckets.size());
-    assertPastBucketValuesSingleKey(valueProducer->mPastBuckets, {1}, {bucketSizeNs - 12 + 1});
-}
-
-TEST(ValueMetricProducerTest, TestPartialResetOnBucketBoundaries) {
-    ValueMetric metric = ValueMetricProducerTestHelper::createMetric();
-    metric.mutable_dimensions_in_what()->set_field(tagId);
-    metric.mutable_dimensions_in_what()->add_child()->set_field(1);
-    metric.set_condition(StringToId("SCREEN_ON"));
-
-    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
-    EXPECT_CALL(*pullerManager, Pull(tagId, _))
-            // First onConditionChanged
-            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
-                data->clear();
-                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucketStartTimeNs);
-                event->write(tagId);
-                event->write(1);
-                event->write(1);
-                event->init();
-                data->push_back(event);
-                return true;
-            }));
-
-    sp<ValueMetricProducer> valueProducer =
-            ValueMetricProducerTestHelper::createValueProducerWithCondition(pullerManager, metric);
-
-    valueProducer->onConditionChanged(true, bucketStartTimeNs + 10);
-    EXPECT_EQ(1UL, valueProducer->mCurrentSlicedBucket.size());
-
-    // End of bucket
-    vector<shared_ptr<LogEvent>> allData;
-    allData.clear();
-    shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucket2StartTimeNs + 1);
-    event->write(2);
-    event->write(2);
-    event->init();
-    allData.push_back(event);
-    valueProducer->onDataPulled(allData, /** succeed */ true, bucket2StartTimeNs);
-
-    // Key 1 should be reset since in not present in the most pull.
-    EXPECT_EQ(2UL, valueProducer->mCurrentSlicedBucket.size());
-    auto iterator = valueProducer->mCurrentSlicedBucket.begin();
-    auto baseInfoIter = valueProducer->mCurrentBaseInfo.begin();
-    EXPECT_EQ(true, baseInfoIter->second[0].hasBase);
-    EXPECT_EQ(2, baseInfoIter->second[0].base.long_value);
-    EXPECT_EQ(false, iterator->second[0].hasValue);
-    iterator++;
-    baseInfoIter++;
-    EXPECT_EQ(false, baseInfoIter->second[0].hasBase);
-    EXPECT_EQ(1, baseInfoIter->second[0].base.long_value);
-    EXPECT_EQ(false, iterator->second[0].hasValue);
-
-    EXPECT_EQ(true, valueProducer->mHasGlobalBase);
-}
-
-TEST(ValueMetricProducerTest, TestFullBucketResetWhenLastBucketInvalid) {
-    ValueMetric metric = ValueMetricProducerTestHelper::createMetric();
-
-    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
-    EXPECT_CALL(*pullerManager, Pull(tagId, _))
-            // Initialization.
-            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
-                data->clear();
-                data->push_back(ValueMetricProducerTestHelper::createEvent(bucketStartTimeNs, 1));
-                return true;
-            }))
-            // notifyAppUpgrade.
-            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
-                data->clear();
-                data->push_back(ValueMetricProducerTestHelper::createEvent(
-                        bucketStartTimeNs + bucketSizeNs / 2, 10));
-                return true;
-            }));
-    sp<ValueMetricProducer> valueProducer =
-            ValueMetricProducerTestHelper::createValueProducerNoConditions(pullerManager, metric);
-    ASSERT_EQ(0UL, valueProducer->mCurrentFullBucket.size());
-
-    valueProducer->notifyAppUpgrade(bucketStartTimeNs + bucketSizeNs / 2, "com.foo", 10000, 1);
-    ASSERT_EQ(1UL, valueProducer->mCurrentFullBucket.size());
-
-    vector<shared_ptr<LogEvent>> allData;
-    allData.push_back(ValueMetricProducerTestHelper::createEvent(bucket3StartTimeNs + 1, 4));
-    valueProducer->onDataPulled(allData, /** fails */ false, bucket3StartTimeNs + 1);
-    ASSERT_EQ(0UL, valueProducer->mCurrentFullBucket.size());
-}
-
-TEST(ValueMetricProducerTest, TestBucketBoundariesOnConditionChange) {
-    ValueMetric metric = ValueMetricProducerTestHelper::createMetricWithCondition();
-    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
-    EXPECT_CALL(*pullerManager, Pull(tagId, _))
-            // Second onConditionChanged.
-            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
-                data->clear();
-                data->push_back(
-                        ValueMetricProducerTestHelper::createEvent(bucket2StartTimeNs + 10, 5));
-                return true;
-            }))
-            // Third onConditionChanged.
-            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
-                data->clear();
-                data->push_back(
-                        ValueMetricProducerTestHelper::createEvent(bucket3StartTimeNs + 10, 7));
-                return true;
-            }));
-
-    sp<ValueMetricProducer> valueProducer =
-            ValueMetricProducerTestHelper::createValueProducerWithCondition(pullerManager, metric);
-    valueProducer->mCondition = ConditionState::kUnknown;
-
-    valueProducer->onConditionChanged(false, bucketStartTimeNs);
-    ASSERT_EQ(0UL, valueProducer->mCurrentSlicedBucket.size());
-
-    // End of first bucket
-    vector<shared_ptr<LogEvent>> allData;
-    allData.push_back(ValueMetricProducerTestHelper::createEvent(bucket2StartTimeNs + 1, 4));
-    valueProducer->onDataPulled(allData, /** succeed */ true, bucket2StartTimeNs + 1);
-    ASSERT_EQ(0UL, valueProducer->mCurrentSlicedBucket.size());
-
-    valueProducer->onConditionChanged(true, bucket2StartTimeNs + 10);
-    ASSERT_EQ(1UL, valueProducer->mCurrentSlicedBucket.size());
-    auto curInterval = valueProducer->mCurrentSlicedBucket.begin()->second[0];
-    auto curBaseInfo = valueProducer->mCurrentBaseInfo.begin()->second[0];
-    EXPECT_EQ(true, curBaseInfo.hasBase);
-    EXPECT_EQ(5, curBaseInfo.base.long_value);
-    EXPECT_EQ(false, curInterval.hasValue);
-
-    valueProducer->onConditionChanged(false, bucket3StartTimeNs + 10);
-
-    // Bucket should have been completed.
-    assertPastBucketValuesSingleKey(valueProducer->mPastBuckets, {2}, {bucketSizeNs - 10});
-}
-
-TEST(ValueMetricProducerTest, TestLateOnDataPulledWithoutDiff) {
-    ValueMetric metric = ValueMetricProducerTestHelper::createMetric();
-    metric.set_use_diff(false);
-
-    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
-    sp<ValueMetricProducer> valueProducer =
-            ValueMetricProducerTestHelper::createValueProducerNoConditions(pullerManager, metric);
-
-    vector<shared_ptr<LogEvent>> allData;
-    allData.push_back(ValueMetricProducerTestHelper::createEvent(bucketStartTimeNs + 30, 10));
-    valueProducer->onDataPulled(allData, /** succeed */ true, bucketStartTimeNs + 30);
-
-    allData.clear();
-    allData.push_back(ValueMetricProducerTestHelper::createEvent(bucket2StartTimeNs, 20));
-    valueProducer->onDataPulled(allData, /** succeed */ true, bucket2StartTimeNs);
-
-    // Bucket should have been completed.
-    assertPastBucketValuesSingleKey(valueProducer->mPastBuckets, {30}, {bucketSizeNs});
-}
-
-TEST(ValueMetricProducerTest, TestLateOnDataPulledWithDiff) {
-    ValueMetric metric = ValueMetricProducerTestHelper::createMetric();
-
-    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
-    EXPECT_CALL(*pullerManager, Pull(tagId, _))
-            // Initialization.
-            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
-                data->clear();
-                data->push_back(ValueMetricProducerTestHelper::createEvent(bucketStartTimeNs, 1));
-                return true;
-            }));
-
-    sp<ValueMetricProducer> valueProducer =
-            ValueMetricProducerTestHelper::createValueProducerNoConditions(pullerManager, metric);
-
-    vector<shared_ptr<LogEvent>> allData;
-    allData.push_back(ValueMetricProducerTestHelper::createEvent(bucketStartTimeNs + 30, 10));
-    valueProducer->onDataPulled(allData, /** succeed */ true, bucketStartTimeNs + 30);
-
-    allData.clear();
-    allData.push_back(ValueMetricProducerTestHelper::createEvent(bucket2StartTimeNs, 20));
-    valueProducer->onDataPulled(allData, /** succeed */ true, bucket2StartTimeNs);
-
-    // Bucket should have been completed.
-    assertPastBucketValuesSingleKey(valueProducer->mPastBuckets, {19}, {bucketSizeNs});
-}
-
-TEST(ValueMetricProducerTest, TestBucketBoundariesOnAppUpgrade) {
-    ValueMetric metric = ValueMetricProducerTestHelper::createMetric();
-
-    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
-    EXPECT_CALL(*pullerManager, Pull(tagId, _))
-            // Initialization.
-            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
-                data->clear();
-                data->push_back(ValueMetricProducerTestHelper::createEvent(bucketStartTimeNs, 1));
-                return true;
-            }))
-            // notifyAppUpgrade.
-            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
-                data->clear();
-                data->push_back(
-                        ValueMetricProducerTestHelper::createEvent(bucket2StartTimeNs + 2, 10));
-                return true;
-            }));
-
-    sp<ValueMetricProducer> valueProducer =
-            ValueMetricProducerTestHelper::createValueProducerNoConditions(pullerManager, metric);
-
-    valueProducer->notifyAppUpgrade(bucket2StartTimeNs + 2, "com.foo", 10000, 1);
-
-    // Bucket should have been completed.
-    assertPastBucketValuesSingleKey(valueProducer->mPastBuckets, {9}, {bucketSizeNs});
-}
-
-TEST(ValueMetricProducerTest, TestDataIsNotUpdatedWhenNoConditionChanged) {
-    ValueMetric metric = ValueMetricProducerTestHelper::createMetricWithCondition();
-
-    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
-    EXPECT_CALL(*pullerManager, Pull(tagId, _))
-            // First on condition changed.
-            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
-                data->clear();
-                data->push_back(ValueMetricProducerTestHelper::createEvent(bucketStartTimeNs, 1));
-                return true;
-            }))
-            // Second on condition changed.
-            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
-                data->clear();
-                data->push_back(ValueMetricProducerTestHelper::createEvent(bucketStartTimeNs, 3));
-                return true;
-            }));
-
-    sp<ValueMetricProducer> valueProducer =
-            ValueMetricProducerTestHelper::createValueProducerWithCondition(pullerManager, metric);
-
-    valueProducer->onConditionChanged(true, bucketStartTimeNs + 8);
-    valueProducer->onConditionChanged(false, bucketStartTimeNs + 10);
-    valueProducer->onConditionChanged(false, bucketStartTimeNs + 10);
-
-    EXPECT_EQ(1UL, valueProducer->mCurrentSlicedBucket.size());
-    auto curInterval = valueProducer->mCurrentSlicedBucket.begin()->second[0];
-    auto curBaseInfo = valueProducer->mCurrentBaseInfo.begin()->second[0];
-    EXPECT_EQ(true, curInterval.hasValue);
-    EXPECT_EQ(2, curInterval.value.long_value);
-
-    vector<shared_ptr<LogEvent>> allData;
-    allData.push_back(ValueMetricProducerTestHelper::createEvent(bucket2StartTimeNs + 1, 10));
-    valueProducer->onDataPulled(allData, /** succeed */ true, bucket2StartTimeNs + 1);
-
-    assertPastBucketValuesSingleKey(valueProducer->mPastBuckets, {2}, {2});
-}
-
-// TODO: b/145705635 fix or delete this test
-TEST(ValueMetricProducerTest, TestBucketInvalidIfGlobalBaseIsNotSet) {
-    ValueMetric metric = ValueMetricProducerTestHelper::createMetricWithCondition();
-
-    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
-    EXPECT_CALL(*pullerManager, Pull(tagId, _))
-            // First condition change.
-            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
-                data->clear();
-                data->push_back(ValueMetricProducerTestHelper::createEvent(bucketStartTimeNs, 1));
-                return true;
-            }))
-            // 2nd condition change.
-            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
-                data->clear();
-                data->push_back(ValueMetricProducerTestHelper::createEvent(bucket2StartTimeNs, 1));
-                return true;
-            }))
-            // 3rd condition change.
-            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
-                data->clear();
-                data->push_back(ValueMetricProducerTestHelper::createEvent(bucket2StartTimeNs, 1));
-                return true;
-            }));
-
-    sp<ValueMetricProducer> valueProducer =
-            ValueMetricProducerTestHelper::createValueProducerWithCondition(pullerManager, metric);
-    valueProducer->onConditionChanged(true, bucket2StartTimeNs + 10);
-
-    vector<shared_ptr<LogEvent>> allData;
-    allData.push_back(ValueMetricProducerTestHelper::createEvent(bucketStartTimeNs + 3, 10));
-    valueProducer->onDataPulled(allData, /** succeed */ false, bucketStartTimeNs + 3);
-
-    allData.clear();
-    allData.push_back(ValueMetricProducerTestHelper::createEvent(bucket2StartTimeNs, 20));
-    valueProducer->onDataPulled(allData, /** succeed */ false, bucket2StartTimeNs);
-
-    valueProducer->onConditionChanged(false, bucket2StartTimeNs + 8);
-    valueProducer->onConditionChanged(true, bucket2StartTimeNs + 10);
-
-    allData.clear();
-    allData.push_back(ValueMetricProducerTestHelper::createEvent(bucket3StartTimeNs, 30));
-    valueProducer->onDataPulled(allData, /** succeed */ true, bucket2StartTimeNs);
-
-    // There was not global base available so all buckets are invalid.
-    assertPastBucketValuesSingleKey(valueProducer->mPastBuckets, {}, {});
-}
-
-TEST(ValueMetricProducerTest, TestPullNeededFastDump) {
-    ValueMetric metric = ValueMetricProducerTestHelper::createMetric();
-
-    UidMap uidMap;
-    SimpleAtomMatcher atomMatcher;
-    atomMatcher.set_atom_id(tagId);
-    sp<EventMatcherWizard> eventMatcherWizard =
-            new EventMatcherWizard({new SimpleLogMatchingTracker(
-                    atomMatcherId, logEventMatcherIndex, atomMatcher, uidMap)});
-    sp<MockConditionWizard> wizard = new NaggyMock<MockConditionWizard>();
-    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
-    EXPECT_CALL(*pullerManager, RegisterReceiver(tagId, _, _, _)).WillOnce(Return());
-    EXPECT_CALL(*pullerManager, UnRegisterReceiver(tagId, _)).WillRepeatedly(Return());
-
-    EXPECT_CALL(*pullerManager, Pull(tagId, _))
-            // Initial pull.
-            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
-                data->clear();
-                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucketStartTimeNs);
-                event->write(tagId);
-                event->write(1);
-                event->write(1);
-                event->init();
-                data->push_back(event);
-                return true;
-            }));
-
-    ValueMetricProducer valueProducer(kConfigKey, metric, -1, wizard, logEventMatcherIndex,
-                                      eventMatcherWizard, tagId, bucketStartTimeNs,
-                                      bucketStartTimeNs, pullerManager);
-
-    ProtoOutputStream output;
-    std::set<string> strSet;
-    valueProducer.onDumpReport(bucketStartTimeNs + 10, true /* include recent buckets */, true,
-                               FAST, &strSet, &output);
-
-    StatsLogReport report = outputStreamToProto(&output);
-    // Bucket is invalid since we did not pull when dump report was called.
-    EXPECT_EQ(0, report.value_metrics().data_size());
-}
-
-TEST(ValueMetricProducerTest, TestFastDumpWithoutCurrentBucket) {
-    ValueMetric metric = ValueMetricProducerTestHelper::createMetric();
-
-    UidMap uidMap;
-    SimpleAtomMatcher atomMatcher;
-    atomMatcher.set_atom_id(tagId);
-    sp<EventMatcherWizard> eventMatcherWizard =
-            new EventMatcherWizard({new SimpleLogMatchingTracker(
-                    atomMatcherId, logEventMatcherIndex, atomMatcher, uidMap)});
-    sp<MockConditionWizard> wizard = new NaggyMock<MockConditionWizard>();
-    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
-    EXPECT_CALL(*pullerManager, RegisterReceiver(tagId, _, _, _)).WillOnce(Return());
-    EXPECT_CALL(*pullerManager, UnRegisterReceiver(tagId, _)).WillRepeatedly(Return());
-
-    EXPECT_CALL(*pullerManager, Pull(tagId, _))
-            // Initial pull.
-            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
-                data->clear();
-                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucketStartTimeNs);
-                event->write(tagId);
-                event->write(1);
-                event->write(1);
-                event->init();
-                data->push_back(event);
-                return true;
-            }));
-
-    ValueMetricProducer valueProducer(kConfigKey, metric, -1, wizard, logEventMatcherIndex,
-                                      eventMatcherWizard, tagId, bucketStartTimeNs,
-                                      bucketStartTimeNs, pullerManager);
-
-    vector<shared_ptr<LogEvent>> allData;
-    allData.clear();
-    shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucket2StartTimeNs + 1);
-    event->write(tagId);
-    event->write(2);
-    event->write(2);
-    event->init();
-    allData.push_back(event);
-    valueProducer.onDataPulled(allData, /** succeed */ true, bucket2StartTimeNs);
-
-    ProtoOutputStream output;
-    std::set<string> strSet;
-    valueProducer.onDumpReport(bucket4StartTimeNs, false /* include recent buckets */, true, FAST,
-                               &strSet, &output);
-
-    StatsLogReport report = outputStreamToProto(&output);
-    // Previous bucket is part of the report.
-    EXPECT_EQ(1, report.value_metrics().data_size());
-    EXPECT_EQ(0, report.value_metrics().data(0).bucket_info(0).bucket_num());
-}
-
-TEST(ValueMetricProducerTest, TestPullNeededNoTimeConstraints) {
-    ValueMetric metric = ValueMetricProducerTestHelper::createMetric();
-
-    UidMap uidMap;
-    SimpleAtomMatcher atomMatcher;
-    atomMatcher.set_atom_id(tagId);
-    sp<EventMatcherWizard> eventMatcherWizard =
-            new EventMatcherWizard({new SimpleLogMatchingTracker(
-                    atomMatcherId, logEventMatcherIndex, atomMatcher, uidMap)});
-    sp<MockConditionWizard> wizard = new NaggyMock<MockConditionWizard>();
-    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
-    EXPECT_CALL(*pullerManager, RegisterReceiver(tagId, _, _, _)).WillOnce(Return());
-    EXPECT_CALL(*pullerManager, UnRegisterReceiver(tagId, _)).WillRepeatedly(Return());
-
-    EXPECT_CALL(*pullerManager, Pull(tagId, _))
-            // Initial pull.
-            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
-                data->clear();
-                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucketStartTimeNs);
-                event->write(tagId);
-                event->write(1);
-                event->write(1);
-                event->init();
-                data->push_back(event);
-                return true;
-            }))
-            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
-                data->clear();
-                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucketStartTimeNs + 10);
-                event->write(tagId);
-                event->write(3);
-                event->write(3);
-                event->init();
-                data->push_back(event);
-                return true;
-            }));
-
-    ValueMetricProducer valueProducer(kConfigKey, metric, -1, wizard, logEventMatcherIndex,
-                                      eventMatcherWizard, tagId, bucketStartTimeNs,
-                                      bucketStartTimeNs, pullerManager);
-
-    ProtoOutputStream output;
-    std::set<string> strSet;
-    valueProducer.onDumpReport(bucketStartTimeNs + 10, true /* include recent buckets */, true,
-                               NO_TIME_CONSTRAINTS, &strSet, &output);
-
-    StatsLogReport report = outputStreamToProto(&output);
-    EXPECT_EQ(1, report.value_metrics().data_size());
-    EXPECT_EQ(1, report.value_metrics().data(0).bucket_info_size());
-    EXPECT_EQ(2, report.value_metrics().data(0).bucket_info(0).values(0).value_long());
-}
-
-TEST(ValueMetricProducerTest, TestPulledData_noDiff_withoutCondition) {
-    ValueMetric metric = ValueMetricProducerTestHelper::createMetric();
-    metric.set_use_diff(false);
-
-    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
-    sp<ValueMetricProducer> valueProducer =
-            ValueMetricProducerTestHelper::createValueProducerNoConditions(pullerManager, metric);
-
-    vector<shared_ptr<LogEvent>> allData;
-    allData.push_back(ValueMetricProducerTestHelper::createEvent(bucket2StartTimeNs + 30, 10));
-    valueProducer->onDataPulled(allData, /** succeed */ true, bucket2StartTimeNs + 30);
-
-    // Bucket should have been completed.
-    assertPastBucketValuesSingleKey(valueProducer->mPastBuckets, {10}, {bucketSizeNs});
-}
-
-TEST(ValueMetricProducerTest, TestPulledData_noDiff_withMultipleConditionChanges) {
-    ValueMetric metric = ValueMetricProducerTestHelper::createMetricWithCondition();
-    metric.set_use_diff(false);
-
-    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
-    EXPECT_CALL(*pullerManager, Pull(tagId, _))
-            // condition becomes true
-            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
-                data->clear();
-                data->push_back(
-                        ValueMetricProducerTestHelper::createEvent(bucketStartTimeNs + 30, 10));
-                return true;
-            }))
-            // condition becomes false
-            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
-                data->clear();
-                data->push_back(
-                        ValueMetricProducerTestHelper::createEvent(bucketStartTimeNs + 50, 20));
-                return true;
-            }));
-    sp<ValueMetricProducer> valueProducer =
-            ValueMetricProducerTestHelper::createValueProducerWithCondition(pullerManager, metric);
-    valueProducer->mCondition = ConditionState::kFalse;
-
-    valueProducer->onConditionChanged(true, bucketStartTimeNs + 8);
-    valueProducer->onConditionChanged(false, bucketStartTimeNs + 50);
-    // has one slice
-    EXPECT_EQ(1UL, valueProducer->mCurrentSlicedBucket.size());
-    ValueMetricProducer::Interval curInterval =
-            valueProducer->mCurrentSlicedBucket.begin()->second[0];
-    ValueMetricProducer::BaseInfo curBaseInfo = valueProducer->mCurrentBaseInfo.begin()->second[0];
-    EXPECT_EQ(false, curBaseInfo.hasBase);
-    EXPECT_EQ(true, curInterval.hasValue);
-    EXPECT_EQ(20, curInterval.value.long_value);
-
-    // Now the alarm is delivered. Condition is off though.
-    vector<shared_ptr<LogEvent>> allData;
-    allData.push_back(ValueMetricProducerTestHelper::createEvent(bucket2StartTimeNs + 30, 110));
-    valueProducer->onDataPulled(allData, /** succeed */ true, bucket2StartTimeNs);
-
-    assertPastBucketValuesSingleKey(valueProducer->mPastBuckets, {20}, {50 - 8});
-    curInterval = valueProducer->mCurrentSlicedBucket.begin()->second[0];
-    curBaseInfo = valueProducer->mCurrentBaseInfo.begin()->second[0];
-    EXPECT_EQ(false, curBaseInfo.hasBase);
-    EXPECT_EQ(false, curInterval.hasValue);
-}
-
-TEST(ValueMetricProducerTest, TestPulledData_noDiff_bucketBoundaryTrue) {
-    ValueMetric metric = ValueMetricProducerTestHelper::createMetricWithCondition();
-    metric.set_use_diff(false);
-
-    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
-    EXPECT_CALL(*pullerManager, Pull(tagId, _))
-            // condition becomes true
-            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
-                data->clear();
-                data->push_back(
-                        ValueMetricProducerTestHelper::createEvent(bucketStartTimeNs + 30, 10));
-                return true;
-            }));
-    sp<ValueMetricProducer> valueProducer =
-            ValueMetricProducerTestHelper::createValueProducerWithCondition(pullerManager, metric);
-    valueProducer->mCondition = ConditionState::kFalse;
-
-    valueProducer->onConditionChanged(true, bucketStartTimeNs + 8);
-
-    // Now the alarm is delivered. Condition is off though.
-    vector<shared_ptr<LogEvent>> allData;
-    allData.push_back(ValueMetricProducerTestHelper::createEvent(bucket2StartTimeNs + 30, 30));
-    valueProducer->onDataPulled(allData, /** succeed */ true, bucket2StartTimeNs);
-
-    assertPastBucketValuesSingleKey(valueProducer->mPastBuckets, {30}, {bucketSizeNs - 8});
-    ValueMetricProducer::Interval curInterval =
-            valueProducer->mCurrentSlicedBucket.begin()->second[0];
-    ValueMetricProducer::BaseInfo curBaseInfo = valueProducer->mCurrentBaseInfo.begin()->second[0];
-    EXPECT_EQ(false, curBaseInfo.hasBase);
-    EXPECT_EQ(false, curInterval.hasValue);
-}
-
-TEST(ValueMetricProducerTest, TestPulledData_noDiff_bucketBoundaryFalse) {
-    ValueMetric metric = ValueMetricProducerTestHelper::createMetricWithCondition();
-    metric.set_use_diff(false);
-
-    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
-    sp<ValueMetricProducer> valueProducer =
-            ValueMetricProducerTestHelper::createValueProducerWithCondition(pullerManager, metric);
-    valueProducer->mCondition = ConditionState::kFalse;
-
-    // Now the alarm is delivered. Condition is off though.
-    vector<shared_ptr<LogEvent>> allData;
-    allData.push_back(ValueMetricProducerTestHelper::createEvent(bucket2StartTimeNs + 30, 30));
-    valueProducer->onDataPulled(allData, /** succeed */ true, bucket2StartTimeNs);
-
-    // Condition was always false.
-    assertPastBucketValuesSingleKey(valueProducer->mPastBuckets, {}, {});
-}
-
-TEST(ValueMetricProducerTest, TestPulledData_noDiff_withFailure) {
-    ValueMetric metric = ValueMetricProducerTestHelper::createMetricWithCondition();
-    metric.set_use_diff(false);
-
-    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
-    EXPECT_CALL(*pullerManager, Pull(tagId, _))
-            // condition becomes true
-            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
-                data->clear();
-                data->push_back(
-                        ValueMetricProducerTestHelper::createEvent(bucketStartTimeNs + 30, 10));
-                return true;
-            }))
-            .WillOnce(Return(false));
-    sp<ValueMetricProducer> valueProducer =
-            ValueMetricProducerTestHelper::createValueProducerWithCondition(pullerManager, metric);
-    valueProducer->mCondition = ConditionState::kFalse;
-
-    valueProducer->onConditionChanged(true, bucketStartTimeNs + 8);
-    valueProducer->onConditionChanged(false, bucketStartTimeNs + 50);
-
-    // Now the alarm is delivered. Condition is off though.
-    vector<shared_ptr<LogEvent>> allData;
-    allData.push_back(ValueMetricProducerTestHelper::createEvent(bucket2StartTimeNs + 30, 30));
-    valueProducer->onDataPulled(allData, /** succeed */ true, bucket2StartTimeNs);
-
-    // No buckets, we had a failure.
-    assertPastBucketValuesSingleKey(valueProducer->mPastBuckets, {}, {});
-}
-
-/*
- * Test that DUMP_REPORT_REQUESTED dump reason is logged.
- *
- * For the bucket to be marked invalid during a dump report requested,
- * three things must be true:
- * - we want to include the current partial bucket
- * - we need a pull (metric is pulled and condition is true)
- * - the dump latency must be FAST
- */
-TEST(ValueMetricProducerTest_BucketDrop, TestInvalidBucketWhenDumpReportRequested) {
-    ValueMetric metric = ValueMetricProducerTestHelper::createMetricWithCondition();
-
-    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
-    EXPECT_CALL(*pullerManager, Pull(tagId, _))
-            // Condition change to true.
-            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
-                data->clear();
-                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucketStartTimeNs + 20);
-                event->write("field1");
-                event->write(10);
-                event->init();
-                data->push_back(event);
-                return true;
-            }));
-
-    sp<ValueMetricProducer> valueProducer =
-            ValueMetricProducerTestHelper::createValueProducerWithCondition(pullerManager, metric);
-
-    // Condition change event.
-    valueProducer->onConditionChanged(true, bucketStartTimeNs + 20);
-
-    // Check dump report.
-    ProtoOutputStream output;
-    std::set<string> strSet;
-    valueProducer->onDumpReport(bucketStartTimeNs + 40, true /* include recent buckets */, true,
-                                FAST /* dumpLatency */, &strSet, &output);
-
-    StatsLogReport report = outputStreamToProto(&output);
-    EXPECT_TRUE(report.has_value_metrics());
-    EXPECT_EQ(0, report.value_metrics().data_size());
-    EXPECT_EQ(1, report.value_metrics().skipped_size());
-
-    EXPECT_EQ(NanoToMillis(bucketStartTimeNs),
-              report.value_metrics().skipped(0).start_bucket_elapsed_millis());
-    EXPECT_EQ(NanoToMillis(bucketStartTimeNs + 40),
-              report.value_metrics().skipped(0).end_bucket_elapsed_millis());
-    EXPECT_EQ(1, report.value_metrics().skipped(0).drop_event_size());
-
-    auto dropEvent = report.value_metrics().skipped(0).drop_event(0);
-    EXPECT_EQ(BucketDropReason::DUMP_REPORT_REQUESTED, dropEvent.drop_reason());
-    EXPECT_EQ(NanoToMillis(bucketStartTimeNs + 40), dropEvent.drop_time_millis());
-}
-
-/*
- * Test that EVENT_IN_WRONG_BUCKET dump reason is logged for a late condition
- * change event (i.e. the condition change occurs in the wrong bucket).
- */
-TEST(ValueMetricProducerTest_BucketDrop, TestInvalidBucketWhenConditionEventWrongBucket) {
-    ValueMetric metric = ValueMetricProducerTestHelper::createMetricWithCondition();
-
-    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
-    EXPECT_CALL(*pullerManager, Pull(tagId, _))
-            // Condition change to true.
-            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
-                data->clear();
-                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucketStartTimeNs + 50);
-                event->write("field1");
-                event->write(10);
-                event->init();
-                data->push_back(event);
-                return true;
-            }));
-
-    sp<ValueMetricProducer> valueProducer =
-            ValueMetricProducerTestHelper::createValueProducerWithCondition(pullerManager, metric);
-
-    // Condition change event.
-    valueProducer->onConditionChanged(true, bucketStartTimeNs + 50);
-
-    // Bucket boundary pull.
-    vector<shared_ptr<LogEvent>> allData;
-    shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucket2StartTimeNs);
-    event->write("field1");
-    event->write(15);
-    event->init();
-    allData.push_back(event);
-    valueProducer->onDataPulled(allData, /** succeeds */ true, bucket2StartTimeNs + 1);
-
-    // Late condition change event.
-    valueProducer->onConditionChanged(false, bucket2StartTimeNs - 100);
-
-    // Check dump report.
-    ProtoOutputStream output;
-    std::set<string> strSet;
-    valueProducer->onDumpReport(bucket2StartTimeNs + 100, true /* include recent buckets */, true,
-                                NO_TIME_CONSTRAINTS /* dumpLatency */, &strSet, &output);
-
-    StatsLogReport report = outputStreamToProto(&output);
-    EXPECT_TRUE(report.has_value_metrics());
-    EXPECT_EQ(1, report.value_metrics().data_size());
-    EXPECT_EQ(1, report.value_metrics().skipped_size());
-
-    EXPECT_EQ(NanoToMillis(bucket2StartTimeNs),
-              report.value_metrics().skipped(0).start_bucket_elapsed_millis());
-    EXPECT_EQ(NanoToMillis(bucket2StartTimeNs + 100),
-              report.value_metrics().skipped(0).end_bucket_elapsed_millis());
-    EXPECT_EQ(1, report.value_metrics().skipped(0).drop_event_size());
-
-    auto dropEvent = report.value_metrics().skipped(0).drop_event(0);
-    EXPECT_EQ(BucketDropReason::EVENT_IN_WRONG_BUCKET, dropEvent.drop_reason());
-    EXPECT_EQ(NanoToMillis(bucket2StartTimeNs - 100), dropEvent.drop_time_millis());
-}
-
-/*
- * Test that EVENT_IN_WRONG_BUCKET dump reason is logged for a late accumulate
- * event (i.e. the accumulate events call occurs in the wrong bucket).
- */
-TEST(ValueMetricProducerTest_BucketDrop, TestInvalidBucketWhenAccumulateEventWrongBucket) {
-    ValueMetric metric = ValueMetricProducerTestHelper::createMetricWithCondition();
-
-    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
-    EXPECT_CALL(*pullerManager, Pull(tagId, _))
-            // Condition change to true.
-            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
-                data->clear();
-                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucketStartTimeNs + 50);
-                event->write("field1");
-                event->write(10);
-                event->init();
-                data->push_back(event);
-                return true;
-            }))
-            // Dump report requested.
-            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
-                data->clear();
-                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucket2StartTimeNs + 100);
-                event->write("field1");
-                event->write(15);
-                event->init();
-                data->push_back(event);
-                return true;
-            }));
-
-    sp<ValueMetricProducer> valueProducer =
-            ValueMetricProducerTestHelper::createValueProducerWithCondition(pullerManager, metric);
-
-    // Condition change event.
-    valueProducer->onConditionChanged(true, bucketStartTimeNs + 50);
-
-    // Bucket boundary pull.
-    vector<shared_ptr<LogEvent>> allData;
-    shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucket2StartTimeNs);
-    event->write("field1");
-    event->write(15);
-    event->init();
-    allData.push_back(event);
-    valueProducer->onDataPulled(allData, /** succeeds */ true, bucket2StartTimeNs + 1);
-
-    allData.clear();
-    event = make_shared<LogEvent>(tagId, bucket2StartTimeNs - 100);
-    event->write("field1");
-    event->write(20);
-    event->init();
-    allData.push_back(event);
-
-    // Late accumulateEvents event.
-    valueProducer->accumulateEvents(allData, bucket2StartTimeNs - 100, bucket2StartTimeNs - 100);
-
-    // Check dump report.
-    ProtoOutputStream output;
-    std::set<string> strSet;
-    valueProducer->onDumpReport(bucket2StartTimeNs + 100, true /* include recent buckets */, true,
-                                NO_TIME_CONSTRAINTS /* dumpLatency */, &strSet, &output);
-
-    StatsLogReport report = outputStreamToProto(&output);
-    EXPECT_TRUE(report.has_value_metrics());
-    EXPECT_EQ(1, report.value_metrics().data_size());
-    EXPECT_EQ(1, report.value_metrics().skipped_size());
-
-    EXPECT_EQ(NanoToMillis(bucket2StartTimeNs),
-              report.value_metrics().skipped(0).start_bucket_elapsed_millis());
-    EXPECT_EQ(NanoToMillis(bucket2StartTimeNs + 100),
-              report.value_metrics().skipped(0).end_bucket_elapsed_millis());
-    EXPECT_EQ(1, report.value_metrics().skipped(0).drop_event_size());
-
-    auto dropEvent = report.value_metrics().skipped(0).drop_event(0);
-    EXPECT_EQ(BucketDropReason::EVENT_IN_WRONG_BUCKET, dropEvent.drop_reason());
-    EXPECT_EQ(NanoToMillis(bucket2StartTimeNs - 100), dropEvent.drop_time_millis());
-}
-
-/*
- * Test that CONDITION_UNKNOWN dump reason is logged due to an unknown condition
- * when a metric is initialized.
- */
-TEST(ValueMetricProducerTest_BucketDrop, TestInvalidBucketWhenConditionUnknown) {
-    ValueMetric metric = ValueMetricProducerTestHelper::createMetricWithCondition();
-
-    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
-    EXPECT_CALL(*pullerManager, Pull(tagId, _))
-            // Condition change to true.
-            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
-                data->clear();
-                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucketStartTimeNs + 50);
-                event->write("field1");
-                event->write(10);
-                event->init();
-                data->push_back(event);
-                return true;
-            }))
-            // Dump report requested.
-            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
-                data->clear();
-                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucketStartTimeNs + 100);
-                event->write("field1");
-                event->write(15);
-                event->init();
-                data->push_back(event);
-                return true;
-            }));
-
-    sp<ValueMetricProducer> valueProducer =
-            ValueMetricProducerTestHelper::createValueProducerWithNoInitialCondition(pullerManager,
-                                                                                     metric);
-
-    // Condition change event.
-    valueProducer->onConditionChanged(true, bucketStartTimeNs + 50);
-
-    // Check dump report.
-    ProtoOutputStream output;
-    std::set<string> strSet;
-    int64_t dumpReportTimeNs = bucketStartTimeNs + 10000;
-    valueProducer->onDumpReport(dumpReportTimeNs, true /* include recent buckets */, true,
-                                NO_TIME_CONSTRAINTS /* dumpLatency */, &strSet, &output);
-
-    StatsLogReport report = outputStreamToProto(&output);
-    EXPECT_TRUE(report.has_value_metrics());
-    EXPECT_EQ(0, report.value_metrics().data_size());
-    EXPECT_EQ(1, report.value_metrics().skipped_size());
-
-    EXPECT_EQ(NanoToMillis(bucketStartTimeNs),
-              report.value_metrics().skipped(0).start_bucket_elapsed_millis());
-    EXPECT_EQ(NanoToMillis(dumpReportTimeNs),
-              report.value_metrics().skipped(0).end_bucket_elapsed_millis());
-    EXPECT_EQ(1, report.value_metrics().skipped(0).drop_event_size());
-
-    auto dropEvent = report.value_metrics().skipped(0).drop_event(0);
-    EXPECT_EQ(BucketDropReason::CONDITION_UNKNOWN, dropEvent.drop_reason());
-    EXPECT_EQ(NanoToMillis(dumpReportTimeNs), dropEvent.drop_time_millis());
-}
-
-/*
- * Test that PULL_FAILED dump reason is logged due to a pull failure in
- * #pullAndMatchEventsLocked.
- */
-TEST(ValueMetricProducerTest_BucketDrop, TestInvalidBucketWhenPullFailed) {
-    ValueMetric metric = ValueMetricProducerTestHelper::createMetricWithCondition();
-
-    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
-    EXPECT_CALL(*pullerManager, Pull(tagId, _))
-            // Condition change to true.
-            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
-                data->clear();
-                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucketStartTimeNs + 50);
-                event->write("field1");
-                event->write(10);
-                event->init();
-                data->push_back(event);
-                return true;
-            }))
-            // Dump report requested, pull fails.
-            .WillOnce(Return(false));
-
-    sp<ValueMetricProducer> valueProducer =
-            ValueMetricProducerTestHelper::createValueProducerWithCondition(pullerManager, metric);
-
-    // Condition change event.
-    valueProducer->onConditionChanged(true, bucketStartTimeNs + 50);
-
-    // Check dump report.
-    ProtoOutputStream output;
-    std::set<string> strSet;
-    int64_t dumpReportTimeNs = bucketStartTimeNs + 10000;
-    valueProducer->onDumpReport(dumpReportTimeNs, true /* include recent buckets */, true,
-                                NO_TIME_CONSTRAINTS /* dumpLatency */, &strSet, &output);
-
-    StatsLogReport report = outputStreamToProto(&output);
-    EXPECT_TRUE(report.has_value_metrics());
-    EXPECT_EQ(0, report.value_metrics().data_size());
-    EXPECT_EQ(1, report.value_metrics().skipped_size());
-
-    EXPECT_EQ(NanoToMillis(bucketStartTimeNs),
-              report.value_metrics().skipped(0).start_bucket_elapsed_millis());
-    EXPECT_EQ(NanoToMillis(dumpReportTimeNs),
-              report.value_metrics().skipped(0).end_bucket_elapsed_millis());
-    EXPECT_EQ(1, report.value_metrics().skipped(0).drop_event_size());
-
-    auto dropEvent = report.value_metrics().skipped(0).drop_event(0);
-    EXPECT_EQ(BucketDropReason::PULL_FAILED, dropEvent.drop_reason());
-    EXPECT_EQ(NanoToMillis(dumpReportTimeNs), dropEvent.drop_time_millis());
-}
-
-/*
- * Test that MULTIPLE_BUCKETS_SKIPPED dump reason is logged when a log event
- * skips over more than one bucket.
- */
-TEST(ValueMetricProducerTest_BucketDrop, TestInvalidBucketWhenMultipleBucketsSkipped) {
-    ValueMetric metric = ValueMetricProducerTestHelper::createMetricWithCondition();
-
-    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
-    EXPECT_CALL(*pullerManager, Pull(tagId, _))
-            // Condition change to true.
-            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
-                data->clear();
-                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucketStartTimeNs + 10);
-                event->write("field1");
-                event->write(10);
-                event->init();
-                data->push_back(event);
-                return true;
-            }))
-            // Dump report requested.
-            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
-                data->clear();
-                shared_ptr<LogEvent> event =
-                        make_shared<LogEvent>(tagId, bucket4StartTimeNs + 1000);
-                event->write("field1");
-                event->write(15);
-                event->init();
-                data->push_back(event);
-                return true;
-            }));
-
-    sp<ValueMetricProducer> valueProducer =
-            ValueMetricProducerTestHelper::createValueProducerWithCondition(pullerManager, metric);
-
-    // Condition change event.
-    valueProducer->onConditionChanged(true, bucketStartTimeNs + 10);
-
-    // Condition change event that skips forward by three buckets.
-    valueProducer->onConditionChanged(false, bucket4StartTimeNs + 10);
-
-    // Check dump report.
-    ProtoOutputStream output;
-    std::set<string> strSet;
-    valueProducer->onDumpReport(bucket4StartTimeNs + 1000, true /* include recent buckets */, true,
-                                NO_TIME_CONSTRAINTS /* dumpLatency */, &strSet, &output);
-
-    StatsLogReport report = outputStreamToProto(&output);
-    EXPECT_TRUE(report.has_value_metrics());
-    EXPECT_EQ(0, report.value_metrics().data_size());
-    EXPECT_EQ(1, report.value_metrics().skipped_size());
-
-    EXPECT_EQ(NanoToMillis(bucketStartTimeNs),
-              report.value_metrics().skipped(0).start_bucket_elapsed_millis());
-    EXPECT_EQ(NanoToMillis(bucket2StartTimeNs),
-              report.value_metrics().skipped(0).end_bucket_elapsed_millis());
-    EXPECT_EQ(1, report.value_metrics().skipped(0).drop_event_size());
-
-    auto dropEvent = report.value_metrics().skipped(0).drop_event(0);
-    EXPECT_EQ(BucketDropReason::MULTIPLE_BUCKETS_SKIPPED, dropEvent.drop_reason());
-    EXPECT_EQ(NanoToMillis(bucket4StartTimeNs + 10), dropEvent.drop_time_millis());
-}
-
-/*
- * Test that BUCKET_TOO_SMALL dump reason is logged when a flushed bucket size
- * is smaller than the "min_bucket_size_nanos" specified in the metric config.
- */
-TEST(ValueMetricProducerTest_BucketDrop, TestBucketDropWhenBucketTooSmall) {
-    ValueMetric metric = ValueMetricProducerTestHelper::createMetricWithCondition();
-    metric.set_min_bucket_size_nanos(10000000000);  // 10 seconds
-
-    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
-    EXPECT_CALL(*pullerManager, Pull(tagId, _))
-            // Condition change to true.
-            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
-                data->clear();
-                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucketStartTimeNs + 10);
-                event->write("field1");
-                event->write(10);
-                event->init();
-                data->push_back(event);
-                return true;
-            }))
-            // Dump report requested.
-            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
-                data->clear();
-                shared_ptr<LogEvent> event =
-                        make_shared<LogEvent>(tagId, bucketStartTimeNs + 9000000);
-                event->write("field1");
-                event->write(15);
-                event->init();
-                data->push_back(event);
-                return true;
-            }));
-
-    sp<ValueMetricProducer> valueProducer =
-            ValueMetricProducerTestHelper::createValueProducerWithCondition(pullerManager, metric);
-
-    // Condition change event.
-    valueProducer->onConditionChanged(true, bucketStartTimeNs + 10);
-
-    // Check dump report.
-    ProtoOutputStream output;
-    std::set<string> strSet;
-    int64_t dumpReportTimeNs = bucketStartTimeNs + 9000000;
-    valueProducer->onDumpReport(dumpReportTimeNs, true /* include recent buckets */, true,
-                                NO_TIME_CONSTRAINTS /* dumpLatency */, &strSet, &output);
-
-    StatsLogReport report = outputStreamToProto(&output);
-    EXPECT_TRUE(report.has_value_metrics());
-    EXPECT_EQ(0, report.value_metrics().data_size());
-    EXPECT_EQ(1, report.value_metrics().skipped_size());
-
-    EXPECT_EQ(NanoToMillis(bucketStartTimeNs),
-              report.value_metrics().skipped(0).start_bucket_elapsed_millis());
-    EXPECT_EQ(NanoToMillis(dumpReportTimeNs),
-              report.value_metrics().skipped(0).end_bucket_elapsed_millis());
-    EXPECT_EQ(1, report.value_metrics().skipped(0).drop_event_size());
-
-    auto dropEvent = report.value_metrics().skipped(0).drop_event(0);
-    EXPECT_EQ(BucketDropReason::BUCKET_TOO_SMALL, dropEvent.drop_reason());
-    EXPECT_EQ(NanoToMillis(dumpReportTimeNs), dropEvent.drop_time_millis());
-}
-
-/*
- * Test multiple bucket drop events in the same bucket.
- */
-TEST(ValueMetricProducerTest_BucketDrop, TestMultipleBucketDropEvents) {
-    ValueMetric metric = ValueMetricProducerTestHelper::createMetricWithCondition();
-
-    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
-    EXPECT_CALL(*pullerManager, Pull(tagId, _))
-            // Condition change to true.
-            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
-                data->clear();
-                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucketStartTimeNs + 10);
-                event->write("field1");
-                event->write(10);
-                event->init();
-                data->push_back(event);
-                return true;
-            }));
-
-    sp<ValueMetricProducer> valueProducer =
-            ValueMetricProducerTestHelper::createValueProducerWithNoInitialCondition(pullerManager,
-                                                                                     metric);
-
-    // Condition change event.
-    valueProducer->onConditionChanged(true, bucketStartTimeNs + 10);
-
-    // Check dump report.
-    ProtoOutputStream output;
-    std::set<string> strSet;
-    int64_t dumpReportTimeNs = bucketStartTimeNs + 1000;
-    valueProducer->onDumpReport(dumpReportTimeNs, true /* include recent buckets */, true,
-                                FAST /* dumpLatency */, &strSet, &output);
-
-    StatsLogReport report = outputStreamToProto(&output);
-    EXPECT_TRUE(report.has_value_metrics());
-    EXPECT_EQ(0, report.value_metrics().data_size());
-    EXPECT_EQ(1, report.value_metrics().skipped_size());
-
-    EXPECT_EQ(NanoToMillis(bucketStartTimeNs),
-              report.value_metrics().skipped(0).start_bucket_elapsed_millis());
-    EXPECT_EQ(NanoToMillis(dumpReportTimeNs),
-              report.value_metrics().skipped(0).end_bucket_elapsed_millis());
-    EXPECT_EQ(2, report.value_metrics().skipped(0).drop_event_size());
-
-    auto dropEvent = report.value_metrics().skipped(0).drop_event(0);
-    EXPECT_EQ(BucketDropReason::CONDITION_UNKNOWN, dropEvent.drop_reason());
-    EXPECT_EQ(NanoToMillis(bucketStartTimeNs + 10), dropEvent.drop_time_millis());
-
-    dropEvent = report.value_metrics().skipped(0).drop_event(1);
-    EXPECT_EQ(BucketDropReason::DUMP_REPORT_REQUESTED, dropEvent.drop_reason());
-    EXPECT_EQ(NanoToMillis(dumpReportTimeNs), dropEvent.drop_time_millis());
-}
-
-/*
- * Test that the number of logged bucket drop events is capped at the maximum.
- * The maximum is currently 10 and is set in MetricProducer::maxDropEventsReached().
- */
-TEST(ValueMetricProducerTest_BucketDrop, TestMaxBucketDropEvents) {
-    ValueMetric metric = ValueMetricProducerTestHelper::createMetricWithCondition();
-
-    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
-    EXPECT_CALL(*pullerManager, Pull(tagId, _))
-            // First condition change event.
-            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
-                for (int i = 0; i < 2000; i++) {
-                    shared_ptr<LogEvent> event =
-                            make_shared<LogEvent>(tagId, bucketStartTimeNs + 1);
-                    event->write(i);
-                    event->write(i);
-                    event->init();
-                    data->push_back(event);
-                }
-                return true;
-            }))
-            .WillOnce(Return(false))
-            .WillOnce(Return(false))
-            .WillOnce(Return(false))
-            .WillOnce(Return(false))
-            .WillOnce(Return(false))
-            .WillOnce(Return(false))
-            .WillOnce(Return(false))
-            .WillOnce(Return(false))
-            .WillOnce(Return(false))
-            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
-                data->clear();
-                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucketStartTimeNs + 220);
-                event->write("field1");
-                event->write(10);
-                event->init();
-                data->push_back(event);
-                return true;
-            }));
-
-    sp<ValueMetricProducer> valueProducer =
-            ValueMetricProducerTestHelper::createValueProducerWithNoInitialCondition(pullerManager,
-                                                                                     metric);
-
-    // First condition change event causes guardrail to be reached.
-    valueProducer->onConditionChanged(true, bucketStartTimeNs + 10);
-
-    // 2-10 condition change events result in failed pulls.
-    valueProducer->onConditionChanged(false, bucketStartTimeNs + 30);
-    valueProducer->onConditionChanged(true, bucketStartTimeNs + 50);
-    valueProducer->onConditionChanged(false, bucketStartTimeNs + 70);
-    valueProducer->onConditionChanged(true, bucketStartTimeNs + 90);
-    valueProducer->onConditionChanged(false, bucketStartTimeNs + 100);
-    valueProducer->onConditionChanged(true, bucketStartTimeNs + 150);
-    valueProducer->onConditionChanged(false, bucketStartTimeNs + 170);
-    valueProducer->onConditionChanged(true, bucketStartTimeNs + 190);
-    valueProducer->onConditionChanged(false, bucketStartTimeNs + 200);
-
-    // Condition change event 11
-    valueProducer->onConditionChanged(true, bucketStartTimeNs + 220);
-
-    // Check dump report.
-    ProtoOutputStream output;
-    std::set<string> strSet;
-    int64_t dumpReportTimeNs = bucketStartTimeNs + 1000;
-    // Because we already have 10 dump events in the current bucket,
-    // this case should not be added to the list of dump events.
-    valueProducer->onDumpReport(bucketStartTimeNs + 1000, true /* include recent buckets */, true,
-                                FAST /* dumpLatency */, &strSet, &output);
-
-    StatsLogReport report = outputStreamToProto(&output);
-    EXPECT_TRUE(report.has_value_metrics());
-    EXPECT_EQ(0, report.value_metrics().data_size());
-    EXPECT_EQ(1, report.value_metrics().skipped_size());
-
-    EXPECT_EQ(NanoToMillis(bucketStartTimeNs),
-              report.value_metrics().skipped(0).start_bucket_elapsed_millis());
-    EXPECT_EQ(NanoToMillis(dumpReportTimeNs),
-              report.value_metrics().skipped(0).end_bucket_elapsed_millis());
-    EXPECT_EQ(10, report.value_metrics().skipped(0).drop_event_size());
-
-    auto dropEvent = report.value_metrics().skipped(0).drop_event(0);
-    EXPECT_EQ(BucketDropReason::CONDITION_UNKNOWN, dropEvent.drop_reason());
-    EXPECT_EQ(NanoToMillis(bucketStartTimeNs + 10), dropEvent.drop_time_millis());
-
-    dropEvent = report.value_metrics().skipped(0).drop_event(1);
-    EXPECT_EQ(BucketDropReason::PULL_FAILED, dropEvent.drop_reason());
-    EXPECT_EQ(NanoToMillis(bucketStartTimeNs + 30), dropEvent.drop_time_millis());
-
-    dropEvent = report.value_metrics().skipped(0).drop_event(2);
-    EXPECT_EQ(BucketDropReason::PULL_FAILED, dropEvent.drop_reason());
-    EXPECT_EQ(NanoToMillis(bucketStartTimeNs + 50), dropEvent.drop_time_millis());
-
-    dropEvent = report.value_metrics().skipped(0).drop_event(3);
-    EXPECT_EQ(BucketDropReason::PULL_FAILED, dropEvent.drop_reason());
-    EXPECT_EQ(NanoToMillis(bucketStartTimeNs + 70), dropEvent.drop_time_millis());
-
-    dropEvent = report.value_metrics().skipped(0).drop_event(4);
-    EXPECT_EQ(BucketDropReason::PULL_FAILED, dropEvent.drop_reason());
-    EXPECT_EQ(NanoToMillis(bucketStartTimeNs + 90), dropEvent.drop_time_millis());
-
-    dropEvent = report.value_metrics().skipped(0).drop_event(5);
-    EXPECT_EQ(BucketDropReason::PULL_FAILED, dropEvent.drop_reason());
-    EXPECT_EQ(NanoToMillis(bucketStartTimeNs + 100), dropEvent.drop_time_millis());
-
-    dropEvent = report.value_metrics().skipped(0).drop_event(6);
-    EXPECT_EQ(BucketDropReason::PULL_FAILED, dropEvent.drop_reason());
-    EXPECT_EQ(NanoToMillis(bucketStartTimeNs + 150), dropEvent.drop_time_millis());
-
-    dropEvent = report.value_metrics().skipped(0).drop_event(7);
-    EXPECT_EQ(BucketDropReason::PULL_FAILED, dropEvent.drop_reason());
-    EXPECT_EQ(NanoToMillis(bucketStartTimeNs + 170), dropEvent.drop_time_millis());
-
-    dropEvent = report.value_metrics().skipped(0).drop_event(8);
-    EXPECT_EQ(BucketDropReason::PULL_FAILED, dropEvent.drop_reason());
-    EXPECT_EQ(NanoToMillis(bucketStartTimeNs + 190), dropEvent.drop_time_millis());
-
-    dropEvent = report.value_metrics().skipped(0).drop_event(9);
-    EXPECT_EQ(BucketDropReason::PULL_FAILED, dropEvent.drop_reason());
-    EXPECT_EQ(NanoToMillis(bucketStartTimeNs + 200), dropEvent.drop_time_millis());
-}
-
-/*
- * Test metric with a simple sliced state
- * - Increasing values
- * - Using diff
- * - Second field is value field
- */
-TEST(ValueMetricProducerTest, TestSlicedState) {
-    // Set up ValueMetricProducer.
-    ValueMetric metric = ValueMetricProducerTestHelper::createMetricWithState("SCREEN_STATE");
-    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
-    EXPECT_CALL(*pullerManager, Pull(tagId, _))
-            // ValueMetricProducer initialized.
-            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
-                data->clear();
-                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucketStartTimeNs);
-                event->write("field1");
-                event->write(3);
-                event->init();
-                data->push_back(event);
-                return true;
-            }))
-            // Screen state change to ON.
-            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
-                data->clear();
-                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucketStartTimeNs + 5);
-                event->write("field1");
-                event->write(5);
-                event->init();
-                data->push_back(event);
-                return true;
-            }))
-            // Screen state change to OFF.
-            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
-                data->clear();
-                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucketStartTimeNs + 10);
-                event->write("field1");
-                event->write(9);
-                event->init();
-                data->push_back(event);
-                return true;
-            }))
-            // Screen state change to ON.
-            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
-                data->clear();
-                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucketStartTimeNs + 15);
-                event->write("field1");
-                event->write(21);
-                event->init();
-                data->push_back(event);
-                return true;
-            }))
-            // Dump report requested.
-            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
-                data->clear();
-                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucketStartTimeNs + 50);
-                event->write("field1");
-                event->write(30);
-                event->init();
-                data->push_back(event);
-                return true;
-            }));
-
-    sp<ValueMetricProducer> valueProducer =
-            ValueMetricProducerTestHelper::createValueProducerWithState(
-                    pullerManager, metric, {android::util::SCREEN_STATE_CHANGED}, {});
-
-    // Set up StateManager and check that StateTrackers are initialized.
-    StateManager::getInstance().clear();
-    StateManager::getInstance().registerListener(SCREEN_STATE_ATOM_ID, valueProducer);
-    EXPECT_EQ(1, StateManager::getInstance().getStateTrackersCount());
-    EXPECT_EQ(1, StateManager::getInstance().getListenersCount(SCREEN_STATE_ATOM_ID));
-
-    // Bucket status after metric initialized.
-    EXPECT_EQ(1UL, valueProducer->mCurrentSlicedBucket.size());
-    // Base for dimension key {}
-    auto it = valueProducer->mCurrentSlicedBucket.begin();
-    auto itBase = valueProducer->mCurrentBaseInfo.find(it->first.getDimensionKeyInWhat());
-    EXPECT_EQ(true, itBase->second[0].hasBase);
-    EXPECT_EQ(3, itBase->second[0].base.long_value);
-    // Value for dimension, state key {{}, kStateUnknown}
-    EXPECT_EQ(false, it->second[0].hasValue);
-
-    // Bucket status after screen state change kStateUnknown->ON.
-    auto screenEvent = CreateScreenStateChangedEvent(
-            android::view::DisplayStateEnum::DISPLAY_STATE_ON, bucketStartTimeNs + 5);
-    StateManager::getInstance().onLogEvent(*screenEvent);
-    EXPECT_EQ(1UL, valueProducer->mCurrentSlicedBucket.size());
-    // Base for dimension key {}
-    it = valueProducer->mCurrentSlicedBucket.begin();
-    itBase = valueProducer->mCurrentBaseInfo.find(it->first.getDimensionKeyInWhat());
-    EXPECT_EQ(true, itBase->second[0].hasBase);
-    EXPECT_EQ(5, itBase->second[0].base.long_value);
-    // Value for dimension, state key {{}, kStateUnknown}
-    EXPECT_EQ(true, it->second[0].hasValue);
-    EXPECT_EQ(2, it->second[0].value.long_value);
-
-    // Bucket status after screen state change ON->OFF.
-    screenEvent = CreateScreenStateChangedEvent(android::view::DisplayStateEnum::DISPLAY_STATE_OFF,
-                                                bucketStartTimeNs + 10);
-    StateManager::getInstance().onLogEvent(*screenEvent);
-    EXPECT_EQ(2UL, valueProducer->mCurrentSlicedBucket.size());
-    // Base for dimension key {}
-    it = valueProducer->mCurrentSlicedBucket.begin();
-    itBase = valueProducer->mCurrentBaseInfo.find(it->first.getDimensionKeyInWhat());
-    EXPECT_EQ(true, itBase->second[0].hasBase);
-    EXPECT_EQ(9, itBase->second[0].base.long_value);
-    // Value for dimension, state key {{}, ON}
-    EXPECT_EQ(android::view::DisplayStateEnum::DISPLAY_STATE_ON,
-              it->first.getStateValuesKey().getValues()[0].mValue.int_value);
-    EXPECT_EQ(true, it->second[0].hasValue);
-    EXPECT_EQ(4, it->second[0].value.long_value);
-    // Value for dimension, state key {{}, kStateUnknown}
-    it++;
-    EXPECT_EQ(true, it->second[0].hasValue);
-    EXPECT_EQ(2, it->second[0].value.long_value);
-
-    // Bucket status after screen state change OFF->ON.
-    screenEvent = CreateScreenStateChangedEvent(android::view::DisplayStateEnum::DISPLAY_STATE_ON,
-                                                bucketStartTimeNs + 15);
-    StateManager::getInstance().onLogEvent(*screenEvent);
-    EXPECT_EQ(3UL, valueProducer->mCurrentSlicedBucket.size());
-    // Base for dimension key {}
-    it = valueProducer->mCurrentSlicedBucket.begin();
-    itBase = valueProducer->mCurrentBaseInfo.find(it->first.getDimensionKeyInWhat());
-    EXPECT_EQ(true, itBase->second[0].hasBase);
-    EXPECT_EQ(21, itBase->second[0].base.long_value);
-    // Value for dimension, state key {{}, OFF}
-    EXPECT_EQ(android::view::DisplayStateEnum::DISPLAY_STATE_OFF,
-              it->first.getStateValuesKey().getValues()[0].mValue.int_value);
-    EXPECT_EQ(true, it->second[0].hasValue);
-    EXPECT_EQ(12, it->second[0].value.long_value);
-    // Value for dimension, state key {{}, ON}
-    it++;
-    EXPECT_EQ(android::view::DisplayStateEnum::DISPLAY_STATE_ON,
-              it->first.getStateValuesKey().getValues()[0].mValue.int_value);
-    EXPECT_EQ(true, it->second[0].hasValue);
-    EXPECT_EQ(4, it->second[0].value.long_value);
-    // Value for dimension, state key {{}, kStateUnknown}
-    it++;
-    EXPECT_EQ(true, it->second[0].hasValue);
-    EXPECT_EQ(2, it->second[0].value.long_value);
-
-    // Start dump report and check output.
-    ProtoOutputStream output;
-    std::set<string> strSet;
-    valueProducer->onDumpReport(bucketStartTimeNs + 50, true /* include recent buckets */, true,
-                                NO_TIME_CONSTRAINTS, &strSet, &output);
-
-    StatsLogReport report = outputStreamToProto(&output);
-    EXPECT_TRUE(report.has_value_metrics());
-    EXPECT_EQ(3, report.value_metrics().data_size());
-
-    auto data = report.value_metrics().data(0);
-    EXPECT_EQ(1, data.bucket_info_size());
-    EXPECT_EQ(2, report.value_metrics().data(0).bucket_info(0).values(0).value_long());
-
-    data = report.value_metrics().data(1);
-    EXPECT_EQ(1, report.value_metrics().data(1).bucket_info_size());
-    EXPECT_EQ(13, report.value_metrics().data(1).bucket_info(0).values(0).value_long());
-    EXPECT_EQ(SCREEN_STATE_ATOM_ID, data.slice_by_state(0).atom_id());
-    EXPECT_TRUE(data.slice_by_state(0).has_value());
-    EXPECT_EQ(android::view::DisplayStateEnum::DISPLAY_STATE_ON, data.slice_by_state(0).value());
-
-    data = report.value_metrics().data(2);
-    EXPECT_EQ(1, report.value_metrics().data(2).bucket_info_size());
-    EXPECT_EQ(12, report.value_metrics().data(2).bucket_info(0).values(0).value_long());
-    EXPECT_EQ(SCREEN_STATE_ATOM_ID, data.slice_by_state(0).atom_id());
-    EXPECT_TRUE(data.slice_by_state(0).has_value());
-    EXPECT_EQ(android::view::DisplayStateEnum::DISPLAY_STATE_OFF, data.slice_by_state(0).value());
-}
-
-/*
- * Test metric with sliced state with map
- * - Increasing values
- * - Using diff
- * - Second field is value field
- */
-TEST(ValueMetricProducerTest, TestSlicedStateWithMap) {
-    // Set up ValueMetricProducer.
-    ValueMetric metric = ValueMetricProducerTestHelper::createMetricWithState("SCREEN_STATE_ONOFF");
-    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
-    EXPECT_CALL(*pullerManager, Pull(tagId, _))
-            // ValueMetricProducer initialized.
-            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
-                data->clear();
-                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucketStartTimeNs);
-                event->write("field1");
-                event->write(3);
-                event->init();
-                data->push_back(event);
-                return true;
-            }))
-            // Screen state change to ON.
-            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
-                data->clear();
-                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucketStartTimeNs + 5);
-                event->write("field1");
-                event->write(5);
-                event->init();
-                data->push_back(event);
-                return true;
-            }))
-            // Screen state change to VR.
-            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
-                data->clear();
-                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucketStartTimeNs + 10);
-                event->write("field1");
-                event->write(9);
-                event->init();
-                data->push_back(event);
-                return true;
-            }))
-            // Screen state change to OFF.
-            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
-                data->clear();
-                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucketStartTimeNs + 15);
-                event->write("field1");
-                event->write(21);
-                event->init();
-                data->push_back(event);
-                return true;
-            }))
-            // Dump report requested.
-            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
-                data->clear();
-                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucketStartTimeNs + 50);
-                event->write("field1");
-                event->write(30);
-                event->init();
-                data->push_back(event);
-                return true;
-            }));
-
-    const StateMap& stateMap = CreateScreenStateOnOffMap();
-    const StateMap_StateGroup screenOnGroup = stateMap.group(0);
-    const StateMap_StateGroup screenOffGroup = stateMap.group(1);
-
-    unordered_map<int, unordered_map<int, int64_t>> stateGroupMap;
-    for (auto group : stateMap.group()) {
-        for (auto value : group.value()) {
-            stateGroupMap[SCREEN_STATE_ATOM_ID][value] = group.group_id();
-        }
-    }
-
-    sp<ValueMetricProducer> valueProducer =
-            ValueMetricProducerTestHelper::createValueProducerWithState(
-                    pullerManager, metric, {android::util::SCREEN_STATE_CHANGED}, stateGroupMap);
-
-    // Set up StateManager and check that StateTrackers are initialized.
-    StateManager::getInstance().clear();
-    StateManager::getInstance().registerListener(SCREEN_STATE_ATOM_ID, valueProducer);
-    EXPECT_EQ(1, StateManager::getInstance().getStateTrackersCount());
-    EXPECT_EQ(1, StateManager::getInstance().getListenersCount(SCREEN_STATE_ATOM_ID));
-
-    // Bucket status after metric initialized.
-    EXPECT_EQ(1UL, valueProducer->mCurrentSlicedBucket.size());
-    // Base for dimension key {}
-    auto it = valueProducer->mCurrentSlicedBucket.begin();
-    auto itBase = valueProducer->mCurrentBaseInfo.find(it->first.getDimensionKeyInWhat());
-    EXPECT_EQ(true, itBase->second[0].hasBase);
-    EXPECT_EQ(3, itBase->second[0].base.long_value);
-    // Value for dimension, state key {{}, {}}
-    EXPECT_EQ(false, it->second[0].hasValue);
-
-    // Bucket status after screen state change kStateUnknown->ON.
-    auto screenEvent = CreateScreenStateChangedEvent(
-            android::view::DisplayStateEnum::DISPLAY_STATE_ON, bucketStartTimeNs + 5);
-    StateManager::getInstance().onLogEvent(*screenEvent);
-    EXPECT_EQ(1UL, valueProducer->mCurrentSlicedBucket.size());
-    // Base for dimension key {}
-    it = valueProducer->mCurrentSlicedBucket.begin();
-    itBase = valueProducer->mCurrentBaseInfo.find(it->first.getDimensionKeyInWhat());
-    EXPECT_EQ(true, itBase->second[0].hasBase);
-    EXPECT_EQ(5, itBase->second[0].base.long_value);
-    // Value for dimension, state key {{}, kStateUnknown}
-    EXPECT_EQ(true, it->second[0].hasValue);
-    EXPECT_EQ(2, it->second[0].value.long_value);
-
-    // Bucket status after screen state change ON->VR (also ON).
-    screenEvent = CreateScreenStateChangedEvent(android::view::DisplayStateEnum::DISPLAY_STATE_VR,
-                                                bucketStartTimeNs + 10);
-    StateManager::getInstance().onLogEvent(*screenEvent);
-    EXPECT_EQ(2UL, valueProducer->mCurrentSlicedBucket.size());
-    // Base for dimension key {}
-    it = valueProducer->mCurrentSlicedBucket.begin();
-    itBase = valueProducer->mCurrentBaseInfo.find(it->first.getDimensionKeyInWhat());
-    EXPECT_EQ(true, itBase->second[0].hasBase);
-    EXPECT_EQ(9, itBase->second[0].base.long_value);
-    // Value for dimension, state key {{}, ON GROUP}
-    EXPECT_EQ(screenOnGroup.group_id(),
-              it->first.getStateValuesKey().getValues()[0].mValue.long_value);
-    EXPECT_EQ(true, it->second[0].hasValue);
-    EXPECT_EQ(4, it->second[0].value.long_value);
-    // Value for dimension, state key {{}, kStateUnknown}
-    it++;
-    EXPECT_EQ(true, it->second[0].hasValue);
-    EXPECT_EQ(2, it->second[0].value.long_value);
-
-    // Bucket status after screen state change VR->OFF.
-    screenEvent = CreateScreenStateChangedEvent(android::view::DisplayStateEnum::DISPLAY_STATE_OFF,
-                                                bucketStartTimeNs + 15);
-    StateManager::getInstance().onLogEvent(*screenEvent);
-    EXPECT_EQ(2UL, valueProducer->mCurrentSlicedBucket.size());
-    // Base for dimension key {}
-    it = valueProducer->mCurrentSlicedBucket.begin();
-    itBase = valueProducer->mCurrentBaseInfo.find(it->first.getDimensionKeyInWhat());
-    EXPECT_EQ(true, itBase->second[0].hasBase);
-    EXPECT_EQ(21, itBase->second[0].base.long_value);
-    // Value for dimension, state key {{}, ON GROUP}
-    EXPECT_EQ(screenOnGroup.group_id(),
-              it->first.getStateValuesKey().getValues()[0].mValue.long_value);
-    EXPECT_EQ(true, it->second[0].hasValue);
-    EXPECT_EQ(16, it->second[0].value.long_value);
-    // Value for dimension, state key {{}, kStateUnknown}
-    it++;
-    EXPECT_EQ(true, it->second[0].hasValue);
-    EXPECT_EQ(2, it->second[0].value.long_value);
-
-    // Start dump report and check output.
-    ProtoOutputStream output;
-    std::set<string> strSet;
-    valueProducer->onDumpReport(bucketStartTimeNs + 50, true /* include recent buckets */, true,
-                                NO_TIME_CONSTRAINTS, &strSet, &output);
-
-    StatsLogReport report = outputStreamToProto(&output);
-    EXPECT_TRUE(report.has_value_metrics());
-    EXPECT_EQ(3, report.value_metrics().data_size());
-
-    auto data = report.value_metrics().data(0);
-    EXPECT_EQ(1, data.bucket_info_size());
-    EXPECT_EQ(2, report.value_metrics().data(0).bucket_info(0).values(0).value_long());
-
-    data = report.value_metrics().data(1);
-    EXPECT_EQ(1, report.value_metrics().data(1).bucket_info_size());
-    EXPECT_EQ(16, report.value_metrics().data(1).bucket_info(0).values(0).value_long());
-    EXPECT_EQ(SCREEN_STATE_ATOM_ID, data.slice_by_state(0).atom_id());
-    EXPECT_TRUE(data.slice_by_state(0).has_group_id());
-    EXPECT_EQ(screenOnGroup.group_id(), data.slice_by_state(0).group_id());
-
-    data = report.value_metrics().data(2);
-    EXPECT_EQ(1, report.value_metrics().data(2).bucket_info_size());
-    EXPECT_EQ(9, report.value_metrics().data(2).bucket_info(0).values(0).value_long());
-    EXPECT_EQ(SCREEN_STATE_ATOM_ID, data.slice_by_state(0).atom_id());
-    EXPECT_TRUE(data.slice_by_state(0).has_group_id());
-    EXPECT_EQ(screenOffGroup.group_id(), data.slice_by_state(0).group_id());
-}
-
-/*
- * Test metric that slices by state with a primary field and has dimensions
- * - Increasing values
- * - Using diff
- * - Second field is value field
- */
-TEST(ValueMetricProducerTest, TestSlicedStateWithPrimaryField_WithDimensions) {
-    // Set up ValueMetricProducer.
-    ValueMetric metric = ValueMetricProducerTestHelper::createMetricWithState("UID_PROCESS_STATE");
-    metric.mutable_dimensions_in_what()->set_field(tagId);
-    metric.mutable_dimensions_in_what()->add_child()->set_field(1);
-
-    MetricStateLink* stateLink = metric.add_state_link();
-    stateLink->set_state_atom_id(UID_PROCESS_STATE_ATOM_ID);
-    auto fieldsInWhat = stateLink->mutable_fields_in_what();
-    *fieldsInWhat = CreateDimensions(tagId, {1 /* uid */});
-    auto fieldsInState = stateLink->mutable_fields_in_state();
-    *fieldsInState = CreateDimensions(UID_PROCESS_STATE_ATOM_ID, {1 /* uid */});
-
-    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
-    EXPECT_CALL(*pullerManager, Pull(tagId, _))
-            // ValueMetricProducer initialized.
-            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
-                data->clear();
-                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucketStartTimeNs);
-                event->write(2 /* uid */);
-                event->write(7);
-                event->init();
-                data->push_back(event);
-
-                event = make_shared<LogEvent>(tagId, bucketStartTimeNs);
-                event->write(1 /* uid */);
-                event->write(3);
-                event->init();
-                data->push_back(event);
-                return true;
-            }))
-            // Uid 1 process state change from kStateUnknown -> Foreground
-            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
-                data->clear();
-                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucketStartTimeNs + 20);
-                event->write(1 /* uid */);
-                event->write(6);
-                event->init();
-                data->push_back(event);
-
-                // This event should be skipped.
-                event = make_shared<LogEvent>(tagId, bucketStartTimeNs + 20);
-                event->write(2 /* uid */);
-                event->write(8);
-                event->init();
-                data->push_back(event);
-                return true;
-            }))
-            // Uid 2 process state change from kStateUnknown -> Background
-            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
-                data->clear();
-                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucketStartTimeNs + 40);
-                event->write(2 /* uid */);
-                event->write(9);
-                event->init();
-                data->push_back(event);
-
-                // This event should be skipped.
-                event = make_shared<LogEvent>(tagId, bucketStartTimeNs + 40);
-                event->write(1 /* uid */);
-                event->write(12);
-                event->init();
-                data->push_back(event);
-                return true;
-            }))
-            // Uid 1 process state change from Foreground -> Background
-            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
-                data->clear();
-                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucket2StartTimeNs + 20);
-                event->write(1 /* uid */);
-                event->write(13);
-                event->init();
-                data->push_back(event);
-
-                // This event should be skipped.
-                event = make_shared<LogEvent>(tagId, bucket2StartTimeNs + 20);
-                event->write(2 /* uid */);
-                event->write(11);
-                event->init();
-                data->push_back(event);
-                return true;
-            }))
-            // Uid 1 process state change from Background -> Foreground
-            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
-                data->clear();
-                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucket2StartTimeNs + 40);
-                event->write(1 /* uid */);
-                event->write(17);
-                event->init();
-                data->push_back(event);
-
-                // This event should be skipped.
-                event = make_shared<LogEvent>(tagId, bucket2StartTimeNs + 40);
-                event->write(2 /* uid */);
-                event->write(15);
-                event->init();
-                data->push_back(event);
-                return true;
-            }))
-            // Dump report pull.
-            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
-                data->clear();
-                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucket2StartTimeNs + 50);
-                event->write(2 /* uid */);
-                event->write(20);
-                event->init();
-                data->push_back(event);
-
-                event = make_shared<LogEvent>(tagId, bucket2StartTimeNs + 50);
-                event->write(1 /* uid */);
-                event->write(21);
-                event->init();
-                data->push_back(event);
-                return true;
-            }));
-
-    sp<ValueMetricProducer> valueProducer =
-            ValueMetricProducerTestHelper::createValueProducerWithState(
-                    pullerManager, metric, {UID_PROCESS_STATE_ATOM_ID}, {});
-
-    // Set up StateManager and check that StateTrackers are initialized.
-    StateManager::getInstance().clear();
-    StateManager::getInstance().registerListener(UID_PROCESS_STATE_ATOM_ID, valueProducer);
-    EXPECT_EQ(1, StateManager::getInstance().getStateTrackersCount());
-    EXPECT_EQ(1, StateManager::getInstance().getListenersCount(UID_PROCESS_STATE_ATOM_ID));
-
-    // Bucket status after metric initialized.
-    EXPECT_EQ(2UL, valueProducer->mCurrentSlicedBucket.size());
-    // Base for dimension key {uid 1}.
-    auto it = valueProducer->mCurrentSlicedBucket.begin();
-    EXPECT_EQ(1, it->first.getDimensionKeyInWhat().getValues()[0].mValue.int_value);
-    auto itBase = valueProducer->mCurrentBaseInfo.find(it->first.getDimensionKeyInWhat());
-    EXPECT_EQ(true, itBase->second[0].hasBase);
-    EXPECT_EQ(3, itBase->second[0].base.long_value);
-    // Value for dimension, state key {{uid 1}, kStateUnknown}
-    // TODO(tsaichristine): test equality of state values key
-    // EXPECT_EQ(-1, it->first.getStateValuesKey().getValues()[0].mValue.int_value);
-    EXPECT_EQ(false, it->second[0].hasValue);
-    // Base for dimension key {uid 2}
-    it++;
-    EXPECT_EQ(2, it->first.getDimensionKeyInWhat().getValues()[0].mValue.int_value);
-    itBase = valueProducer->mCurrentBaseInfo.find(it->first.getDimensionKeyInWhat());
-    EXPECT_EQ(true, itBase->second[0].hasBase);
-    EXPECT_EQ(7, itBase->second[0].base.long_value);
-    // Value for dimension, state key {{uid 2}, kStateUnknown}
-    // EXPECT_EQ(-1, it->first.getStateValuesKey().getValues()[0].mValue.int_value);
-    EXPECT_EQ(false, it->second[0].hasValue);
-
-    // Bucket status after uid 1 process state change kStateUnknown -> Foreground.
-    auto uidProcessEvent = CreateUidProcessStateChangedEvent(
-            1 /* uid */, android::app::PROCESS_STATE_IMPORTANT_FOREGROUND, bucketStartTimeNs + 20);
-    StateManager::getInstance().onLogEvent(*uidProcessEvent);
-    EXPECT_EQ(2UL, valueProducer->mCurrentSlicedBucket.size());
-    // Base for dimension key {uid 1}.
-    it = valueProducer->mCurrentSlicedBucket.begin();
-    EXPECT_EQ(1, it->first.getDimensionKeyInWhat().getValues()[0].mValue.int_value);
-    itBase = valueProducer->mCurrentBaseInfo.find(it->first.getDimensionKeyInWhat());
-    EXPECT_EQ(1, it->first.getDimensionKeyInWhat().getValues()[0].mValue.int_value);
-    EXPECT_EQ(true, itBase->second[0].hasBase);
-    EXPECT_EQ(6, itBase->second[0].base.long_value);
-    // Value for key {uid 1, kStateUnknown}.
-    // EXPECT_EQ(-1, it->first.getStateValuesKey().getValues()[0].mValue.int_value);
-    EXPECT_EQ(true, it->second[0].hasValue);
-    EXPECT_EQ(3, it->second[0].value.long_value);
-
-    // Base for dimension key {uid 2}
-    it++;
-    EXPECT_EQ(2, it->first.getDimensionKeyInWhat().getValues()[0].mValue.int_value);
-    itBase = valueProducer->mCurrentBaseInfo.find(it->first.getDimensionKeyInWhat());
-    EXPECT_EQ(2, it->first.getDimensionKeyInWhat().getValues()[0].mValue.int_value);
-    EXPECT_EQ(true, itBase->second[0].hasBase);
-    EXPECT_EQ(7, itBase->second[0].base.long_value);
-    // Value for key {uid 2, kStateUnknown}
-    EXPECT_EQ(false, it->second[0].hasValue);
-
-    // Bucket status after uid 2 process state change kStateUnknown -> Background.
-    uidProcessEvent = CreateUidProcessStateChangedEvent(
-            2 /* uid */, android::app::PROCESS_STATE_IMPORTANT_BACKGROUND, bucketStartTimeNs + 40);
-    StateManager::getInstance().onLogEvent(*uidProcessEvent);
-    EXPECT_EQ(2UL, valueProducer->mCurrentSlicedBucket.size());
-    // Base for dimension key {uid 1}.
-    it = valueProducer->mCurrentSlicedBucket.begin();
-    EXPECT_EQ(1, it->first.getDimensionKeyInWhat().getValues()[0].mValue.int_value);
-    itBase = valueProducer->mCurrentBaseInfo.find(it->first.getDimensionKeyInWhat());
-    EXPECT_EQ(true, itBase->second[0].hasBase);
-    EXPECT_EQ(6, itBase->second[0].base.long_value);
-    // Value for key {uid 1, kStateUnknown}.
-    EXPECT_EQ(true, it->second[0].hasValue);
-    EXPECT_EQ(3, it->second[0].value.long_value);
-
-    // Base for dimension key {uid 2}
-    it++;
-    EXPECT_EQ(2, it->first.getDimensionKeyInWhat().getValues()[0].mValue.int_value);
-    itBase = valueProducer->mCurrentBaseInfo.find(it->first.getDimensionKeyInWhat());
-    EXPECT_EQ(true, itBase->second[0].hasBase);
-    EXPECT_EQ(9, itBase->second[0].base.long_value);
-    // Value for key {uid 2, kStateUnknown}
-    // EXPECT_EQ(-1, it->first.getStateValuesKey().getValues()[0].mValue.int_value);
-    EXPECT_EQ(true, it->second[0].hasValue);
-    EXPECT_EQ(2, it->second[0].value.long_value);
-
-    // Pull at end of first bucket.
-    vector<shared_ptr<LogEvent>> allData;
-    shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucket2StartTimeNs);
-    event->write(1 /* uid */);
-    event->write(10);
-    event->init();
-    allData.push_back(event);
-
-    event = make_shared<LogEvent>(tagId, bucket2StartTimeNs);
-    event->write(2 /* uid */);
-    event->write(15);
-    event->init();
-    allData.push_back(event);
-
-    valueProducer->onDataPulled(allData, /** succeeds */ true, bucket2StartTimeNs + 1);
-
-    // Buckets flushed after end of first bucket.
-    // None of the buckets should have a value.
-    EXPECT_EQ(4UL, valueProducer->mCurrentSlicedBucket.size());
-    EXPECT_EQ(4UL, valueProducer->mPastBuckets.size());
-    EXPECT_EQ(2UL, valueProducer->mCurrentBaseInfo.size());
-    // Base for dimension key {uid 2}.
-    it = valueProducer->mCurrentSlicedBucket.begin();
-    EXPECT_EQ(2, it->first.getDimensionKeyInWhat().getValues()[0].mValue.int_value);
-    itBase = valueProducer->mCurrentBaseInfo.find(it->first.getDimensionKeyInWhat());
-    EXPECT_EQ(true, itBase->second[0].hasBase);
-    EXPECT_EQ(15, itBase->second[0].base.long_value);
-    // Value for key {uid 2, BACKGROUND}.
-    EXPECT_EQ(1, it->first.getStateValuesKey().getValues().size());
-    EXPECT_EQ(1006, it->first.getStateValuesKey().getValues()[0].mValue.int_value);
-    EXPECT_EQ(false, it->second[0].hasValue);
-
-    // Base for dimension key {uid 1}
-    it++;
-    EXPECT_EQ(1, it->first.getDimensionKeyInWhat().getValues()[0].mValue.int_value);
-    itBase = valueProducer->mCurrentBaseInfo.find(it->first.getDimensionKeyInWhat());
-    EXPECT_EQ(true, itBase->second[0].hasBase);
-    EXPECT_EQ(10, itBase->second[0].base.long_value);
-    // Value for key {uid 1, kStateUnknown}
-    EXPECT_EQ(0, it->first.getStateValuesKey().getValues().size());
-    // EXPECT_EQ(-1, it->first.getStateValuesKey().getValues()[0].mValue.int_value);
-    EXPECT_EQ(false, it->second[0].hasValue);
-
-    // Value for key {uid 1, FOREGROUND}
-    it++;
-    EXPECT_EQ(1, it->first.getStateValuesKey().getValues().size());
-    EXPECT_EQ(1005, it->first.getStateValuesKey().getValues()[0].mValue.int_value);
-    EXPECT_EQ(false, it->second[0].hasValue);
-
-    // Value for key {uid 2, kStateUnknown}
-    it++;
-    EXPECT_EQ(false, it->second[0].hasValue);
-
-    // Bucket status after uid 1 process state change from Foreground -> Background.
-    uidProcessEvent = CreateUidProcessStateChangedEvent(
-            1 /* uid */, android::app::PROCESS_STATE_IMPORTANT_BACKGROUND, bucket2StartTimeNs + 20);
-    StateManager::getInstance().onLogEvent(*uidProcessEvent);
-
-    EXPECT_EQ(4UL, valueProducer->mCurrentSlicedBucket.size());
-    EXPECT_EQ(4UL, valueProducer->mPastBuckets.size());
-    EXPECT_EQ(2UL, valueProducer->mCurrentBaseInfo.size());
-    // Base for dimension key {uid 2}.
-    it = valueProducer->mCurrentSlicedBucket.begin();
-    EXPECT_EQ(2, it->first.getDimensionKeyInWhat().getValues()[0].mValue.int_value);
-    itBase = valueProducer->mCurrentBaseInfo.find(it->first.getDimensionKeyInWhat());
-    EXPECT_EQ(true, itBase->second[0].hasBase);
-    EXPECT_EQ(15, itBase->second[0].base.long_value);
-    // Value for key {uid 2, BACKGROUND}.
-    EXPECT_EQ(false, it->second[0].hasValue);
-    // Base for dimension key {uid 1}
-    it++;
-    EXPECT_EQ(1, it->first.getDimensionKeyInWhat().getValues()[0].mValue.int_value);
-    itBase = valueProducer->mCurrentBaseInfo.find(it->first.getDimensionKeyInWhat());
-    EXPECT_EQ(true, itBase->second[0].hasBase);
-    EXPECT_EQ(13, itBase->second[0].base.long_value);
-    // Value for key {uid 1, kStateUnknown}
-    EXPECT_EQ(false, it->second[0].hasValue);
-    // Value for key {uid 1, FOREGROUND}
-    it++;
-    EXPECT_EQ(1, it->first.getDimensionKeyInWhat().getValues()[0].mValue.int_value);
-    EXPECT_EQ(1005, it->first.getStateValuesKey().getValues()[0].mValue.int_value);
-    EXPECT_EQ(true, it->second[0].hasValue);
-    EXPECT_EQ(3, it->second[0].value.long_value);
-    // Value for key {uid 2, kStateUnknown}
-    it++;
-    EXPECT_EQ(false, it->second[0].hasValue);
-
-    // Bucket status after uid 1 process state change Background->Foreground.
-    uidProcessEvent = CreateUidProcessStateChangedEvent(
-            1 /* uid */, android::app::PROCESS_STATE_IMPORTANT_FOREGROUND, bucket2StartTimeNs + 40);
-    StateManager::getInstance().onLogEvent(*uidProcessEvent);
-
-    EXPECT_EQ(5UL, valueProducer->mCurrentSlicedBucket.size());
-    EXPECT_EQ(2UL, valueProducer->mCurrentBaseInfo.size());
-    // Base for dimension key {uid 2}
-    it = valueProducer->mCurrentSlicedBucket.begin();
-    EXPECT_EQ(2, it->first.getDimensionKeyInWhat().getValues()[0].mValue.int_value);
-    itBase = valueProducer->mCurrentBaseInfo.find(it->first.getDimensionKeyInWhat());
-    EXPECT_EQ(true, itBase->second[0].hasBase);
-    EXPECT_EQ(15, itBase->second[0].base.long_value);
-    EXPECT_EQ(false, it->second[0].hasValue);
-
-    it++;
-    EXPECT_EQ(false, it->second[0].hasValue);
-
-    // Base for dimension key {uid 1}
-    it++;
-    EXPECT_EQ(1, it->first.getDimensionKeyInWhat().getValues()[0].mValue.int_value);
-    itBase = valueProducer->mCurrentBaseInfo.find(it->first.getDimensionKeyInWhat());
-    EXPECT_EQ(17, itBase->second[0].base.long_value);
-    // Value for key {uid 1, BACKGROUND}
-    EXPECT_EQ(1006, it->first.getStateValuesKey().getValues()[0].mValue.int_value);
-    EXPECT_EQ(true, it->second[0].hasValue);
-    EXPECT_EQ(4, it->second[0].value.long_value);
-    // Value for key {uid 1, FOREGROUND}
-    it++;
-    EXPECT_EQ(1005, it->first.getStateValuesKey().getValues()[0].mValue.int_value);
-    EXPECT_EQ(true, it->second[0].hasValue);
-    EXPECT_EQ(3, it->second[0].value.long_value);
-
-    // Start dump report and check output.
-    ProtoOutputStream output;
-    std::set<string> strSet;
-    valueProducer->onDumpReport(bucket2StartTimeNs + 50, true /* include recent buckets */, true,
-                                NO_TIME_CONSTRAINTS, &strSet, &output);
-
-    StatsLogReport report = outputStreamToProto(&output);
-    EXPECT_TRUE(report.has_value_metrics());
-    EXPECT_EQ(5, report.value_metrics().data_size());
-
-    auto data = report.value_metrics().data(0);
-    EXPECT_EQ(1, data.bucket_info_size());
-    EXPECT_EQ(4, report.value_metrics().data(0).bucket_info(0).values(0).value_long());
-    EXPECT_EQ(UID_PROCESS_STATE_ATOM_ID, data.slice_by_state(0).atom_id());
-    EXPECT_TRUE(data.slice_by_state(0).has_value());
-    EXPECT_EQ(android::app::ProcessStateEnum::PROCESS_STATE_IMPORTANT_BACKGROUND,
-              data.slice_by_state(0).value());
-
-    data = report.value_metrics().data(1);
-    EXPECT_EQ(1, report.value_metrics().data(1).bucket_info_size());
-    EXPECT_EQ(2, report.value_metrics().data(1).bucket_info(0).values(0).value_long());
-
-    data = report.value_metrics().data(2);
-    EXPECT_EQ(UID_PROCESS_STATE_ATOM_ID, data.slice_by_state(0).atom_id());
-    EXPECT_TRUE(data.slice_by_state(0).has_value());
-    EXPECT_EQ(android::app::ProcessStateEnum::PROCESS_STATE_IMPORTANT_FOREGROUND,
-              data.slice_by_state(0).value());
-    EXPECT_EQ(2, report.value_metrics().data(2).bucket_info_size());
-    EXPECT_EQ(4, report.value_metrics().data(2).bucket_info(0).values(0).value_long());
-    EXPECT_EQ(7, report.value_metrics().data(2).bucket_info(1).values(0).value_long());
-
-    data = report.value_metrics().data(3);
-    EXPECT_EQ(1, report.value_metrics().data(3).bucket_info_size());
-    EXPECT_EQ(3, report.value_metrics().data(3).bucket_info(0).values(0).value_long());
-
-    data = report.value_metrics().data(4);
-    EXPECT_EQ(UID_PROCESS_STATE_ATOM_ID, data.slice_by_state(0).atom_id());
-    EXPECT_TRUE(data.slice_by_state(0).has_value());
-    EXPECT_EQ(android::app::ProcessStateEnum::PROCESS_STATE_IMPORTANT_BACKGROUND,
-              data.slice_by_state(0).value());
-    EXPECT_EQ(2, report.value_metrics().data(4).bucket_info_size());
-    EXPECT_EQ(6, report.value_metrics().data(4).bucket_info(0).values(0).value_long());
-    EXPECT_EQ(5, report.value_metrics().data(4).bucket_info(1).values(0).value_long());
-}
+// TODO(b/149590301): Update these tests to use new socket schema.
+//class ValueMetricProducerTestHelper {
+//
+// public:
+//    static shared_ptr<LogEvent> createEvent(int64_t eventTimeNs, int64_t value) {
+//        shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, eventTimeNs);
+//        event->write(tagId);
+//        event->write(value);
+//        event->write(value);
+//        event->init();
+//        return event;
+//    }
+//
+//    static sp<ValueMetricProducer> createValueProducerNoConditions(
+//            sp<MockStatsPullerManager>& pullerManager, ValueMetric& metric) {
+//        UidMap uidMap;
+//        SimpleAtomMatcher atomMatcher;
+//        atomMatcher.set_atom_id(tagId);
+//        sp<EventMatcherWizard> eventMatcherWizard =
+//                new EventMatcherWizard({new SimpleLogMatchingTracker(
+//                        atomMatcherId, logEventMatcherIndex, atomMatcher, uidMap)});
+//        sp<MockConditionWizard> wizard = new NaggyMock<MockConditionWizard>();
+//        EXPECT_CALL(*pullerManager, RegisterReceiver(tagId, _, _, _)).WillOnce(Return());
+//        EXPECT_CALL(*pullerManager, UnRegisterReceiver(tagId, _)).WillRepeatedly(Return());
+//
+//        sp<ValueMetricProducer> valueProducer = new ValueMetricProducer(
+//                kConfigKey, metric, -1 /*-1 meaning no condition*/, wizard,
+//                logEventMatcherIndex, eventMatcherWizard, tagId,
+//                bucketStartTimeNs, bucketStartTimeNs, pullerManager);
+//        return valueProducer;
+//    }
+//
+//    static sp<ValueMetricProducer> createValueProducerWithCondition(
+//            sp<MockStatsPullerManager>& pullerManager, ValueMetric& metric) {
+//        UidMap uidMap;
+//        SimpleAtomMatcher atomMatcher;
+//        atomMatcher.set_atom_id(tagId);
+//        sp<EventMatcherWizard> eventMatcherWizard =
+//                new EventMatcherWizard({new SimpleLogMatchingTracker(
+//                        atomMatcherId, logEventMatcherIndex, atomMatcher, uidMap)});
+//        sp<MockConditionWizard> wizard = new NaggyMock<MockConditionWizard>();
+//        EXPECT_CALL(*pullerManager, RegisterReceiver(tagId, _, _, _)).WillOnce(Return());
+//        EXPECT_CALL(*pullerManager, UnRegisterReceiver(tagId, _)).WillRepeatedly(Return());
+//
+//        sp<ValueMetricProducer> valueProducer =
+//                new ValueMetricProducer(kConfigKey, metric, 1, wizard, logEventMatcherIndex,
+//                                        eventMatcherWizard, tagId, bucketStartTimeNs,
+//                                        bucketStartTimeNs, pullerManager);
+//        valueProducer->mCondition = ConditionState::kFalse;
+//        return valueProducer;
+//    }
+//
+//    static sp<ValueMetricProducer> createValueProducerWithNoInitialCondition(
+//            sp<MockStatsPullerManager>& pullerManager, ValueMetric& metric) {
+//        UidMap uidMap;
+//        SimpleAtomMatcher atomMatcher;
+//        atomMatcher.set_atom_id(tagId);
+//        sp<EventMatcherWizard> eventMatcherWizard =
+//                new EventMatcherWizard({new SimpleLogMatchingTracker(
+//                        atomMatcherId, logEventMatcherIndex, atomMatcher, uidMap)});
+//        sp<MockConditionWizard> wizard = new NaggyMock<MockConditionWizard>();
+//        EXPECT_CALL(*pullerManager, RegisterReceiver(tagId, _, _, _)).WillOnce(Return());
+//        EXPECT_CALL(*pullerManager, UnRegisterReceiver(tagId, _)).WillRepeatedly(Return());
+//
+//        sp<ValueMetricProducer> valueProducer = new ValueMetricProducer(
+//                kConfigKey, metric, 1, wizard, logEventMatcherIndex, eventMatcherWizard, tagId,
+//                bucketStartTimeNs, bucketStartTimeNs, pullerManager);
+//        return valueProducer;
+//    }
+//
+//    static sp<ValueMetricProducer> createValueProducerWithState(
+//            sp<MockStatsPullerManager>& pullerManager, ValueMetric& metric,
+//            vector<int32_t> slicedStateAtoms,
+//            unordered_map<int, unordered_map<int, int64_t>> stateGroupMap) {
+//        UidMap uidMap;
+//        SimpleAtomMatcher atomMatcher;
+//        atomMatcher.set_atom_id(tagId);
+//        sp<EventMatcherWizard> eventMatcherWizard =
+//                new EventMatcherWizard({new SimpleLogMatchingTracker(
+//                        atomMatcherId, logEventMatcherIndex, atomMatcher, uidMap)});
+//        sp<MockConditionWizard> wizard = new NaggyMock<MockConditionWizard>();
+//        EXPECT_CALL(*pullerManager, RegisterReceiver(tagId, _, _, _)).WillOnce(Return());
+//        EXPECT_CALL(*pullerManager, UnRegisterReceiver(tagId, _)).WillRepeatedly(Return());
+//        sp<ValueMetricProducer> valueProducer = new ValueMetricProducer(
+//                kConfigKey, metric, -1 /* no condition */, wizard, logEventMatcherIndex,
+//                eventMatcherWizard, tagId, bucketStartTimeNs, bucketStartTimeNs, pullerManager, {},
+//                {}, slicedStateAtoms, stateGroupMap);
+//        return valueProducer;
+//    }
+//
+//    static ValueMetric createMetric() {
+//        ValueMetric metric;
+//        metric.set_id(metricId);
+//        metric.set_bucket(ONE_MINUTE);
+//        metric.mutable_value_field()->set_field(tagId);
+//        metric.mutable_value_field()->add_child()->set_field(2);
+//        metric.set_max_pull_delay_sec(INT_MAX);
+//        return metric;
+//    }
+//
+//    static ValueMetric createMetricWithCondition() {
+//        ValueMetric metric = ValueMetricProducerTestHelper::createMetric();
+//        metric.set_condition(StringToId("SCREEN_ON"));
+//        return metric;
+//    }
+//
+//    static ValueMetric createMetricWithState(string state) {
+//        ValueMetric metric = ValueMetricProducerTestHelper::createMetric();
+//        metric.add_slice_by_state(StringToId(state));
+//        return metric;
+//    }
+//};
+//
+///*
+// * Tests that the first bucket works correctly
+// */
+//TEST(ValueMetricProducerTest, TestCalcPreviousBucketEndTime) {
+//    ValueMetric metric = ValueMetricProducerTestHelper::createMetric();
+//
+//    int64_t startTimeBase = 11;
+//    UidMap uidMap;
+//    SimpleAtomMatcher atomMatcher;
+//    atomMatcher.set_atom_id(tagId);
+//    sp<EventMatcherWizard> eventMatcherWizard =
+//            new EventMatcherWizard({new SimpleLogMatchingTracker(
+//                    atomMatcherId, logEventMatcherIndex, atomMatcher, uidMap)});
+//    sp<MockConditionWizard> wizard = new NaggyMock<MockConditionWizard>();
+//    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
+//
+//    // statsd started long ago.
+//    // The metric starts in the middle of the bucket
+//    ValueMetricProducer valueProducer(kConfigKey, metric, -1 /*-1 meaning no condition*/, wizard,
+//                                      logEventMatcherIndex, eventMatcherWizard, -1, startTimeBase,
+//                                      22, pullerManager);
+//
+//    EXPECT_EQ(startTimeBase, valueProducer.calcPreviousBucketEndTime(60 * NS_PER_SEC + 10));
+//    EXPECT_EQ(startTimeBase, valueProducer.calcPreviousBucketEndTime(60 * NS_PER_SEC + 10));
+//    EXPECT_EQ(60 * NS_PER_SEC + startTimeBase,
+//              valueProducer.calcPreviousBucketEndTime(2 * 60 * NS_PER_SEC));
+//    EXPECT_EQ(2 * 60 * NS_PER_SEC + startTimeBase,
+//              valueProducer.calcPreviousBucketEndTime(3 * 60 * NS_PER_SEC));
+//}
+//
+///*
+// * Tests that the first bucket works correctly
+// */
+//TEST(ValueMetricProducerTest, TestFirstBucket) {
+//    ValueMetric metric = ValueMetricProducerTestHelper::createMetric();
+//
+//    UidMap uidMap;
+//    SimpleAtomMatcher atomMatcher;
+//    atomMatcher.set_atom_id(tagId);
+//    sp<EventMatcherWizard> eventMatcherWizard =
+//            new EventMatcherWizard({new SimpleLogMatchingTracker(
+//                    atomMatcherId, logEventMatcherIndex, atomMatcher, uidMap)});
+//    sp<MockConditionWizard> wizard = new NaggyMock<MockConditionWizard>();
+//    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
+//
+//    // statsd started long ago.
+//    // The metric starts in the middle of the bucket
+//    ValueMetricProducer valueProducer(kConfigKey, metric, -1 /*-1 meaning no condition*/, wizard,
+//                                      logEventMatcherIndex, eventMatcherWizard, -1, 5,
+//                                      600 * NS_PER_SEC + NS_PER_SEC / 2, pullerManager);
+//
+//    EXPECT_EQ(600500000000, valueProducer.mCurrentBucketStartTimeNs);
+//    EXPECT_EQ(10, valueProducer.mCurrentBucketNum);
+//    EXPECT_EQ(660000000005, valueProducer.getCurrentBucketEndTimeNs());
+//}
+//
+///*
+// * Tests pulled atoms with no conditions
+// */
+//TEST(ValueMetricProducerTest, TestPulledEventsNoCondition) {
+//    ValueMetric metric = ValueMetricProducerTestHelper::createMetric();
+//    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
+//    EXPECT_CALL(*pullerManager, Pull(tagId, _))
+//            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
+//                data->clear();
+//                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucketStartTimeNs);
+//                event->write(tagId);
+//                event->write(3);
+//                event->init();
+//                data->push_back(event);
+//                return true;
+//            }));
+//
+//    sp<ValueMetricProducer> valueProducer =
+//            ValueMetricProducerTestHelper::createValueProducerNoConditions(pullerManager, metric);
+//
+//    vector<shared_ptr<LogEvent>> allData;
+//    allData.clear();
+//    shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucket2StartTimeNs + 1);
+//    event->write(tagId);
+//    event->write(11);
+//    event->init();
+//    allData.push_back(event);
+//
+//    valueProducer->onDataPulled(allData, /** succeed */ true, bucket2StartTimeNs);
+//    // has one slice
+//    EXPECT_EQ(1UL, valueProducer->mCurrentSlicedBucket.size());
+//    ValueMetricProducer::Interval curInterval =
+//            valueProducer->mCurrentSlicedBucket.begin()->second[0];
+//    ValueMetricProducer::BaseInfo curBaseInfo = valueProducer->mCurrentBaseInfo.begin()->second[0];
+//
+//    EXPECT_EQ(true, curBaseInfo.hasBase);
+//    EXPECT_EQ(11, curBaseInfo.base.long_value);
+//    EXPECT_EQ(false, curInterval.hasValue);
+//    EXPECT_EQ(8, curInterval.value.long_value);
+//    EXPECT_EQ(1UL, valueProducer->mPastBuckets.size());
+//    EXPECT_EQ(8, valueProducer->mPastBuckets.begin()->second[0].values[0].long_value);
+//    EXPECT_EQ(bucketSizeNs, valueProducer->mPastBuckets.begin()->second[0].mConditionTrueNs);
+//
+//    allData.clear();
+//    event = make_shared<LogEvent>(tagId, bucket3StartTimeNs + 1);
+//    event->write(tagId);
+//    event->write(23);
+//    event->init();
+//    allData.push_back(event);
+//    valueProducer->onDataPulled(allData, /** succeed */ true, bucket3StartTimeNs);
+//    // has one slice
+//    EXPECT_EQ(1UL, valueProducer->mCurrentSlicedBucket.size());
+//    curInterval = valueProducer->mCurrentSlicedBucket.begin()->second[0];
+//    curBaseInfo = valueProducer->mCurrentBaseInfo.begin()->second[0];
+//
+//    EXPECT_EQ(true, curBaseInfo.hasBase);
+//    EXPECT_EQ(23, curBaseInfo.base.long_value);
+//    EXPECT_EQ(false, curInterval.hasValue);
+//    EXPECT_EQ(12, curInterval.value.long_value);
+//    EXPECT_EQ(1UL, valueProducer->mPastBuckets.size());
+//    EXPECT_EQ(2UL, valueProducer->mPastBuckets.begin()->second.size());
+//    EXPECT_EQ(8, valueProducer->mPastBuckets.begin()->second[0].values[0].long_value);
+//    EXPECT_EQ(bucketSizeNs, valueProducer->mPastBuckets.begin()->second[0].mConditionTrueNs);
+//    EXPECT_EQ(12, valueProducer->mPastBuckets.begin()->second.back().values[0].long_value);
+//    EXPECT_EQ(bucketSizeNs, valueProducer->mPastBuckets.begin()->second.back().mConditionTrueNs);
+//
+//    allData.clear();
+//    event = make_shared<LogEvent>(tagId, bucket4StartTimeNs + 1);
+//    event->write(tagId);
+//    event->write(36);
+//    event->init();
+//    allData.push_back(event);
+//    valueProducer->onDataPulled(allData, /** succeed */ true, bucket4StartTimeNs);
+//    EXPECT_EQ(1UL, valueProducer->mCurrentSlicedBucket.size());
+//    curInterval = valueProducer->mCurrentSlicedBucket.begin()->second[0];
+//    curBaseInfo = valueProducer->mCurrentBaseInfo.begin()->second[0];
+//
+//    EXPECT_EQ(true, curBaseInfo.hasBase);
+//    EXPECT_EQ(36, curBaseInfo.base.long_value);
+//    EXPECT_EQ(false, curInterval.hasValue);
+//    EXPECT_EQ(13, curInterval.value.long_value);
+//    EXPECT_EQ(1UL, valueProducer->mPastBuckets.size());
+//    EXPECT_EQ(3UL, valueProducer->mPastBuckets.begin()->second.size());
+//    EXPECT_EQ(8, valueProducer->mPastBuckets.begin()->second[0].values[0].long_value);
+//    EXPECT_EQ(bucketSizeNs, valueProducer->mPastBuckets.begin()->second[0].mConditionTrueNs);
+//    EXPECT_EQ(12, valueProducer->mPastBuckets.begin()->second[1].values[0].long_value);
+//    EXPECT_EQ(bucketSizeNs, valueProducer->mPastBuckets.begin()->second[1].mConditionTrueNs);
+//    EXPECT_EQ(13, valueProducer->mPastBuckets.begin()->second[2].values[0].long_value);
+//    EXPECT_EQ(bucketSizeNs, valueProducer->mPastBuckets.begin()->second[2].mConditionTrueNs);
+//}
+//
+//TEST(ValueMetricProducerTest, TestPartialBucketCreated) {
+//    ValueMetric metric = ValueMetricProducerTestHelper::createMetric();
+//    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
+//    EXPECT_CALL(*pullerManager, Pull(tagId, _))
+//            // Initialize bucket.
+//            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
+//                data->clear();
+//                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucketStartTimeNs + 1);
+//                event->write(tagId);
+//                event->write(1);
+//                event->init();
+//                data->push_back(event);
+//                return true;
+//            }))
+//            // Partial bucket.
+//            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
+//                data->clear();
+//                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucket2StartTimeNs + 10);
+//                event->write(tagId);
+//                event->write(5);
+//                event->init();
+//                data->push_back(event);
+//                return true;
+//            }));
+//
+//    sp<ValueMetricProducer> valueProducer =
+//            ValueMetricProducerTestHelper::createValueProducerNoConditions(pullerManager, metric);
+//
+//    // First bucket ends.
+//    vector<shared_ptr<LogEvent>> allData;
+//    allData.clear();
+//    shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucket2StartTimeNs + 10);
+//    event->write(tagId);
+//    event->write(2);
+//    event->init();
+//    allData.push_back(event);
+//    valueProducer->onDataPulled(allData, /** success */ true, bucket2StartTimeNs);
+//
+//    // Partial buckets created in 2nd bucket.
+//    valueProducer->notifyAppUpgrade(bucket2StartTimeNs + 2, "com.foo", 10000, 1);
+//
+//    // One full bucket and one partial bucket.
+//    EXPECT_EQ(1UL, valueProducer->mPastBuckets.size());
+//    vector<ValueBucket> buckets = valueProducer->mPastBuckets.begin()->second;
+//    EXPECT_EQ(2UL, buckets.size());
+//    // Full bucket (2 - 1)
+//    EXPECT_EQ(1, buckets[0].values[0].long_value);
+//    EXPECT_EQ(bucketSizeNs, buckets[0].mConditionTrueNs);
+//    // Full bucket (5 - 3)
+//    EXPECT_EQ(3, buckets[1].values[0].long_value);
+//    // partial bucket [bucket2StartTimeNs, bucket2StartTimeNs + 2]
+//    EXPECT_EQ(2, buckets[1].mConditionTrueNs);
+//}
+//
+///*
+// * Tests pulled atoms with filtering
+// */
+//TEST(ValueMetricProducerTest, TestPulledEventsWithFiltering) {
+//    ValueMetric metric = ValueMetricProducerTestHelper::createMetric();
+//
+//    UidMap uidMap;
+//    SimpleAtomMatcher atomMatcher;
+//    atomMatcher.set_atom_id(tagId);
+//    auto keyValue = atomMatcher.add_field_value_matcher();
+//    keyValue->set_field(1);
+//    keyValue->set_eq_int(3);
+//    sp<EventMatcherWizard> eventMatcherWizard =
+//            new EventMatcherWizard({new SimpleLogMatchingTracker(
+//                    atomMatcherId, logEventMatcherIndex, atomMatcher, uidMap)});
+//    sp<MockConditionWizard> wizard = new NaggyMock<MockConditionWizard>();
+//    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
+//    EXPECT_CALL(*pullerManager, RegisterReceiver(tagId, _, _, _)).WillOnce(Return());
+//    EXPECT_CALL(*pullerManager, UnRegisterReceiver(tagId, _)).WillOnce(Return());
+//    EXPECT_CALL(*pullerManager, Pull(tagId, _))
+//            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
+//                data->clear();
+//                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucketStartTimeNs);
+//                event->write(3);
+//                event->write(3);
+//                event->init();
+//                data->push_back(event);
+//                return true;
+//            }));
+//
+//    sp<ValueMetricProducer> valueProducer = new ValueMetricProducer(
+//            kConfigKey, metric, -1 /*-1 meaning no condition*/, wizard, logEventMatcherIndex,
+//            eventMatcherWizard, tagId, bucketStartTimeNs, bucketStartTimeNs, pullerManager);
+//
+//    vector<shared_ptr<LogEvent>> allData;
+//    allData.clear();
+//    shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucket2StartTimeNs + 1);
+//    event->write(3);
+//    event->write(11);
+//    event->init();
+//    allData.push_back(event);
+//
+//    valueProducer->onDataPulled(allData, /** succeed */ true, bucket2StartTimeNs);
+//    // has one slice
+//    EXPECT_EQ(1UL, valueProducer->mCurrentSlicedBucket.size());
+//    ValueMetricProducer::Interval curInterval =
+//            valueProducer->mCurrentSlicedBucket.begin()->second[0];
+//    ValueMetricProducer::BaseInfo curBaseInfo = valueProducer->mCurrentBaseInfo.begin()->second[0];
+//
+//    EXPECT_EQ(true, curBaseInfo.hasBase);
+//    EXPECT_EQ(11, curBaseInfo.base.long_value);
+//    EXPECT_EQ(false, curInterval.hasValue);
+//    EXPECT_EQ(8, curInterval.value.long_value);
+//    EXPECT_EQ(1UL, valueProducer->mPastBuckets.size());
+//    EXPECT_EQ(8, valueProducer->mPastBuckets.begin()->second[0].values[0].long_value);
+//    EXPECT_EQ(bucketSizeNs, valueProducer->mPastBuckets.begin()->second[0].mConditionTrueNs);
+//
+//    allData.clear();
+//    event = make_shared<LogEvent>(tagId, bucket3StartTimeNs + 1);
+//    event->write(4);
+//    event->write(23);
+//    event->init();
+//    allData.push_back(event);
+//    valueProducer->onDataPulled(allData, /** succeed */ true, bucket3StartTimeNs);
+//    // No new data seen, so data has been cleared.
+//    EXPECT_EQ(0UL, valueProducer->mCurrentSlicedBucket.size());
+//
+//    EXPECT_EQ(true, curBaseInfo.hasBase);
+//    EXPECT_EQ(11, curBaseInfo.base.long_value);
+//    EXPECT_EQ(false, curInterval.hasValue);
+//    EXPECT_EQ(8, curInterval.value.long_value);
+//    EXPECT_EQ(1UL, valueProducer->mPastBuckets.size());
+//    EXPECT_EQ(8, valueProducer->mPastBuckets.begin()->second[0].values[0].long_value);
+//    EXPECT_EQ(bucketSizeNs, valueProducer->mPastBuckets.begin()->second[0].mConditionTrueNs);
+//
+//    allData.clear();
+//    event = make_shared<LogEvent>(tagId, bucket4StartTimeNs + 1);
+//    event->write(3);
+//    event->write(36);
+//    event->init();
+//    allData.push_back(event);
+//    valueProducer->onDataPulled(allData, /** succeed */ true, bucket4StartTimeNs);
+//    EXPECT_EQ(1UL, valueProducer->mCurrentSlicedBucket.size());
+//    curInterval = valueProducer->mCurrentSlicedBucket.begin()->second[0];
+//    curBaseInfo = valueProducer->mCurrentBaseInfo.begin()->second[0];
+//
+//    // the base was reset
+//    EXPECT_EQ(true, curBaseInfo.hasBase);
+//    EXPECT_EQ(36, curBaseInfo.base.long_value);
+//    EXPECT_EQ(false, curInterval.hasValue);
+//    EXPECT_EQ(1UL, valueProducer->mPastBuckets.size());
+//    EXPECT_EQ(1UL, valueProducer->mPastBuckets.begin()->second.size());
+//    EXPECT_EQ(8, valueProducer->mPastBuckets.begin()->second.back().values[0].long_value);
+//    EXPECT_EQ(bucketSizeNs, valueProducer->mPastBuckets.begin()->second.back().mConditionTrueNs);
+//}
+//
+///*
+// * Tests pulled atoms with no conditions and take absolute value after reset
+// */
+//TEST(ValueMetricProducerTest, TestPulledEventsTakeAbsoluteValueOnReset) {
+//    ValueMetric metric = ValueMetricProducerTestHelper::createMetric();
+//    metric.set_use_absolute_value_on_reset(true);
+//
+//    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
+//    EXPECT_CALL(*pullerManager, Pull(tagId, _)).WillOnce(Return(true));
+//    sp<ValueMetricProducer> valueProducer =
+//            ValueMetricProducerTestHelper::createValueProducerNoConditions(pullerManager, metric);
+//
+//    vector<shared_ptr<LogEvent>> allData;
+//    allData.clear();
+//    shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucket2StartTimeNs + 1);
+//    event->write(tagId);
+//    event->write(11);
+//    event->init();
+//    allData.push_back(event);
+//
+//    valueProducer->onDataPulled(allData, /** succeed */ true, bucket2StartTimeNs);
+//    // has one slice
+//    EXPECT_EQ(1UL, valueProducer->mCurrentSlicedBucket.size());
+//    ValueMetricProducer::Interval curInterval = valueProducer->mCurrentSlicedBucket.begin()->second[0];
+//    ValueMetricProducer::BaseInfo curBaseInfo = valueProducer->mCurrentBaseInfo.begin()->second[0];
+//
+//    EXPECT_EQ(true, curBaseInfo.hasBase);
+//    EXPECT_EQ(11, curBaseInfo.base.long_value);
+//    EXPECT_EQ(false, curInterval.hasValue);
+//    EXPECT_EQ(0UL, valueProducer->mPastBuckets.size());
+//
+//    allData.clear();
+//    event = make_shared<LogEvent>(tagId, bucket3StartTimeNs + 1);
+//    event->write(tagId);
+//    event->write(10);
+//    event->init();
+//    allData.push_back(event);
+//    valueProducer->onDataPulled(allData, /** succeed */ true, bucket3StartTimeNs);
+//    // has one slice
+//    EXPECT_EQ(1UL, valueProducer->mCurrentSlicedBucket.size());
+//    curInterval = valueProducer->mCurrentSlicedBucket.begin()->second[0];
+//    curBaseInfo = valueProducer->mCurrentBaseInfo.begin()->second[0];
+//    EXPECT_EQ(true, curBaseInfo.hasBase);
+//    EXPECT_EQ(10, curBaseInfo.base.long_value);
+//    EXPECT_EQ(false, curInterval.hasValue);
+//    EXPECT_EQ(10, curInterval.value.long_value);
+//    EXPECT_EQ(1UL, valueProducer->mPastBuckets.size());
+//    EXPECT_EQ(10, valueProducer->mPastBuckets.begin()->second.back().values[0].long_value);
+//    EXPECT_EQ(bucketSizeNs, valueProducer->mPastBuckets.begin()->second.back().mConditionTrueNs);
+//
+//    allData.clear();
+//    event = make_shared<LogEvent>(tagId, bucket4StartTimeNs + 1);
+//    event->write(tagId);
+//    event->write(36);
+//    event->init();
+//    allData.push_back(event);
+//    valueProducer->onDataPulled(allData, /** succeed */ true, bucket4StartTimeNs);
+//    EXPECT_EQ(1UL, valueProducer->mCurrentSlicedBucket.size());
+//    curInterval = valueProducer->mCurrentSlicedBucket.begin()->second[0];
+//    curBaseInfo = valueProducer->mCurrentBaseInfo.begin()->second[0];
+//    EXPECT_EQ(true, curBaseInfo.hasBase);
+//    EXPECT_EQ(36, curBaseInfo.base.long_value);
+//    EXPECT_EQ(false, curInterval.hasValue);
+//    EXPECT_EQ(26, curInterval.value.long_value);
+//    EXPECT_EQ(1UL, valueProducer->mPastBuckets.size());
+//    EXPECT_EQ(2UL, valueProducer->mPastBuckets.begin()->second.size());
+//    EXPECT_EQ(10, valueProducer->mPastBuckets.begin()->second[0].values[0].long_value);
+//    EXPECT_EQ(bucketSizeNs, valueProducer->mPastBuckets.begin()->second[0].mConditionTrueNs);
+//    EXPECT_EQ(26, valueProducer->mPastBuckets.begin()->second[1].values[0].long_value);
+//    EXPECT_EQ(bucketSizeNs, valueProducer->mPastBuckets.begin()->second[1].mConditionTrueNs);
+//}
+//
+///*
+// * Tests pulled atoms with no conditions and take zero value after reset
+// */
+//TEST(ValueMetricProducerTest, TestPulledEventsTakeZeroOnReset) {
+//    ValueMetric metric = ValueMetricProducerTestHelper::createMetric();
+//    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
+//    EXPECT_CALL(*pullerManager, Pull(tagId, _)).WillOnce(Return(false));
+//    sp<ValueMetricProducer> valueProducer =
+//            ValueMetricProducerTestHelper::createValueProducerNoConditions(pullerManager, metric);
+//
+//    vector<shared_ptr<LogEvent>> allData;
+//    allData.clear();
+//    shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucket2StartTimeNs + 1);
+//    event->write(tagId);
+//    event->write(11);
+//    event->init();
+//    allData.push_back(event);
+//
+//    valueProducer->onDataPulled(allData, /** succeed */ true, bucket2StartTimeNs);
+//    // has one slice
+//    EXPECT_EQ(1UL, valueProducer->mCurrentSlicedBucket.size());
+//    ValueMetricProducer::Interval curInterval = valueProducer->mCurrentSlicedBucket.begin()->second[0];
+//    ValueMetricProducer::BaseInfo curBaseInfo = valueProducer->mCurrentBaseInfo.begin()->second[0];
+//
+//    EXPECT_EQ(true, curBaseInfo.hasBase);
+//    EXPECT_EQ(11, curBaseInfo.base.long_value);
+//    EXPECT_EQ(false, curInterval.hasValue);
+//    EXPECT_EQ(0UL, valueProducer->mPastBuckets.size());
+//
+//    allData.clear();
+//    event = make_shared<LogEvent>(tagId, bucket3StartTimeNs + 1);
+//    event->write(tagId);
+//    event->write(10);
+//    event->init();
+//    allData.push_back(event);
+//    valueProducer->onDataPulled(allData, /** succeed */ true, bucket3StartTimeNs);
+//    // has one slice
+//    EXPECT_EQ(1UL, valueProducer->mCurrentSlicedBucket.size());
+//    curInterval = valueProducer->mCurrentSlicedBucket.begin()->second[0];
+//    curBaseInfo = valueProducer->mCurrentBaseInfo.begin()->second[0];
+//    EXPECT_EQ(true, curBaseInfo.hasBase);
+//    EXPECT_EQ(10, curBaseInfo.base.long_value);
+//    EXPECT_EQ(false, curInterval.hasValue);
+//    EXPECT_EQ(0UL, valueProducer->mPastBuckets.size());
+//
+//    allData.clear();
+//    event = make_shared<LogEvent>(tagId, bucket4StartTimeNs + 1);
+//    event->write(tagId);
+//    event->write(36);
+//    event->init();
+//    allData.push_back(event);
+//    valueProducer->onDataPulled(allData, /** succeed */ true, bucket4StartTimeNs);
+//    EXPECT_EQ(1UL, valueProducer->mCurrentSlicedBucket.size());
+//    curInterval = valueProducer->mCurrentSlicedBucket.begin()->second[0];
+//    curBaseInfo = valueProducer->mCurrentBaseInfo.begin()->second[0];
+//    EXPECT_EQ(true, curBaseInfo.hasBase);
+//    EXPECT_EQ(36, curBaseInfo.base.long_value);
+//    EXPECT_EQ(false, curInterval.hasValue);
+//    EXPECT_EQ(26, curInterval.value.long_value);
+//    EXPECT_EQ(1UL, valueProducer->mPastBuckets.size());
+//    EXPECT_EQ(26, valueProducer->mPastBuckets.begin()->second[0].values[0].long_value);
+//    EXPECT_EQ(bucketSizeNs, valueProducer->mPastBuckets.begin()->second[0].mConditionTrueNs);
+//}
+//
+///*
+// * Test pulled event with non sliced condition.
+// */
+//TEST(ValueMetricProducerTest, TestEventsWithNonSlicedCondition) {
+//    ValueMetric metric = ValueMetricProducerTestHelper::createMetricWithCondition();
+//
+//    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
+//
+//    EXPECT_CALL(*pullerManager, Pull(tagId, _))
+//            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
+//                data->clear();
+//                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucketStartTimeNs + 8);
+//                event->write(tagId);
+//                event->write(100);
+//                event->init();
+//                data->push_back(event);
+//                return true;
+//            }))
+//            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
+//                data->clear();
+//                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucket2StartTimeNs + 1);
+//                event->write(tagId);
+//                event->write(130);
+//                event->init();
+//                data->push_back(event);
+//                return true;
+//            }))
+//            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
+//                data->clear();
+//                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucket3StartTimeNs + 1);
+//                event->write(tagId);
+//                event->write(180);
+//                event->init();
+//                data->push_back(event);
+//                return true;
+//            }));
+//
+//    sp<ValueMetricProducer> valueProducer =
+//            ValueMetricProducerTestHelper::createValueProducerWithCondition(pullerManager, metric);
+//
+//    valueProducer->onConditionChanged(true, bucketStartTimeNs + 8);
+//
+//    // has one slice
+//    EXPECT_EQ(1UL, valueProducer->mCurrentSlicedBucket.size());
+//    ValueMetricProducer::Interval curInterval = valueProducer->mCurrentSlicedBucket.begin()->second[0];
+//    ValueMetricProducer::BaseInfo curBaseInfo = valueProducer->mCurrentBaseInfo.begin()->second[0];
+//    // startUpdated:false sum:0 start:100
+//    EXPECT_EQ(true, curBaseInfo.hasBase);
+//    EXPECT_EQ(100, curBaseInfo.base.long_value);
+//    EXPECT_EQ(false, curInterval.hasValue);
+//    EXPECT_EQ(0UL, valueProducer->mPastBuckets.size());
+//
+//    vector<shared_ptr<LogEvent>> allData;
+//    allData.clear();
+//    shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucket2StartTimeNs + 1);
+//    event->write(1);
+//    event->write(110);
+//    event->init();
+//    allData.push_back(event);
+//    valueProducer->onDataPulled(allData, /** succeed */ true, bucket2StartTimeNs);
+//    assertPastBucketValuesSingleKey(valueProducer->mPastBuckets, {10}, {bucketSizeNs - 8});
+//
+//    // has one slice
+//    EXPECT_EQ(1UL, valueProducer->mCurrentSlicedBucket.size());
+//    curInterval = valueProducer->mCurrentSlicedBucket.begin()->second[0];
+//    curBaseInfo = valueProducer->mCurrentBaseInfo.begin()->second[0];
+//    EXPECT_EQ(true, curBaseInfo.hasBase);
+//    EXPECT_EQ(110, curBaseInfo.base.long_value);
+//    EXPECT_EQ(false, curInterval.hasValue);
+//    EXPECT_EQ(10, curInterval.value.long_value);
+//
+//    valueProducer->onConditionChanged(false, bucket2StartTimeNs + 1);
+//    assertPastBucketValuesSingleKey(valueProducer->mPastBuckets, {10}, {bucketSizeNs - 8});
+//
+//    // has one slice
+//    EXPECT_EQ(1UL, valueProducer->mCurrentSlicedBucket.size());
+//    curInterval = valueProducer->mCurrentSlicedBucket.begin()->second[0];
+//    curBaseInfo = valueProducer->mCurrentBaseInfo.begin()->second[0];
+//    EXPECT_EQ(true, curInterval.hasValue);
+//    EXPECT_EQ(20, curInterval.value.long_value);
+//    EXPECT_EQ(false, curBaseInfo.hasBase);
+//
+//    valueProducer->onConditionChanged(true, bucket3StartTimeNs + 1);
+//    assertPastBucketValuesSingleKey(valueProducer->mPastBuckets, {10, 20}, {bucketSizeNs - 8, 1});
+//}
+//
+//TEST(ValueMetricProducerTest, TestPushedEventsWithUpgrade) {
+//    ValueMetric metric = ValueMetricProducerTestHelper::createMetric();
+//
+//    UidMap uidMap;
+//    SimpleAtomMatcher atomMatcher;
+//    atomMatcher.set_atom_id(tagId);
+//    sp<EventMatcherWizard> eventMatcherWizard =
+//            new EventMatcherWizard({new SimpleLogMatchingTracker(
+//                    atomMatcherId, logEventMatcherIndex, atomMatcher, uidMap)});
+//    sp<MockConditionWizard> wizard = new NaggyMock<MockConditionWizard>();
+//    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
+//    ValueMetricProducer valueProducer(kConfigKey, metric, -1, wizard, logEventMatcherIndex,
+//                                      eventMatcherWizard, -1, bucketStartTimeNs, bucketStartTimeNs,
+//                                      pullerManager);
+//
+//    shared_ptr<LogEvent> event1 = make_shared<LogEvent>(tagId, bucketStartTimeNs + 10);
+//    event1->write(1);
+//    event1->write(10);
+//    event1->init();
+//    valueProducer.onMatchedLogEvent(1 /*log matcher index*/, *event1);
+//    EXPECT_EQ(1UL, valueProducer.mCurrentSlicedBucket.size());
+//
+//    valueProducer.notifyAppUpgrade(bucketStartTimeNs + 150, "ANY.APP", 1, 1);
+//    EXPECT_EQ(1UL, valueProducer.mPastBuckets[DEFAULT_METRIC_DIMENSION_KEY].size());
+//    EXPECT_EQ(bucketStartTimeNs + 150, valueProducer.mCurrentBucketStartTimeNs);
+//
+//    shared_ptr<LogEvent> event2 = make_shared<LogEvent>(tagId, bucketStartTimeNs + 59 * NS_PER_SEC);
+//    event2->write(1);
+//    event2->write(10);
+//    event2->init();
+//    valueProducer.onMatchedLogEvent(1 /*log matcher index*/, *event2);
+//    EXPECT_EQ(1UL, valueProducer.mPastBuckets[DEFAULT_METRIC_DIMENSION_KEY].size());
+//    EXPECT_EQ(bucketStartTimeNs + 150, valueProducer.mCurrentBucketStartTimeNs);
+//
+//    // Next value should create a new bucket.
+//    shared_ptr<LogEvent> event3 = make_shared<LogEvent>(tagId, bucketStartTimeNs + 65 * NS_PER_SEC);
+//    event3->write(1);
+//    event3->write(10);
+//    event3->init();
+//    valueProducer.onMatchedLogEvent(1 /*log matcher index*/, *event3);
+//    EXPECT_EQ(2UL, valueProducer.mPastBuckets[DEFAULT_METRIC_DIMENSION_KEY].size());
+//    EXPECT_EQ(bucketStartTimeNs + bucketSizeNs, valueProducer.mCurrentBucketStartTimeNs);
+//}
+//
+//TEST(ValueMetricProducerTest, TestPulledValueWithUpgrade) {
+//    ValueMetric metric = ValueMetricProducerTestHelper::createMetric();
+//
+//    UidMap uidMap;
+//    SimpleAtomMatcher atomMatcher;
+//    atomMatcher.set_atom_id(tagId);
+//    sp<EventMatcherWizard> eventMatcherWizard =
+//            new EventMatcherWizard({new SimpleLogMatchingTracker(
+//                    atomMatcherId, logEventMatcherIndex, atomMatcher, uidMap)});
+//    sp<MockConditionWizard> wizard = new NaggyMock<MockConditionWizard>();
+//    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
+//    EXPECT_CALL(*pullerManager, RegisterReceiver(tagId, _, _, _)).WillOnce(Return());
+//    EXPECT_CALL(*pullerManager, UnRegisterReceiver(tagId, _)).WillOnce(Return());
+//    EXPECT_CALL(*pullerManager, Pull(tagId, _))
+//            .WillOnce(Return(true))
+//            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
+//                data->clear();
+//                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucket2StartTimeNs + 149);
+//                event->write(tagId);
+//                event->write(120);
+//                event->init();
+//                data->push_back(event);
+//                return true;
+//            }));
+//    ValueMetricProducer valueProducer(kConfigKey, metric, -1, wizard, logEventMatcherIndex,
+//                                      eventMatcherWizard, tagId, bucketStartTimeNs,
+//                                      bucketStartTimeNs, pullerManager);
+//
+//    vector<shared_ptr<LogEvent>> allData;
+//    allData.clear();
+//    shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucket2StartTimeNs + 1);
+//    event->write(tagId);
+//    event->write(100);
+//    event->init();
+//    allData.push_back(event);
+//
+//    valueProducer.onDataPulled(allData, /** succeed */ true, bucket2StartTimeNs);
+//    EXPECT_EQ(1UL, valueProducer.mCurrentSlicedBucket.size());
+//
+//    valueProducer.notifyAppUpgrade(bucket2StartTimeNs + 150, "ANY.APP", 1, 1);
+//    EXPECT_EQ(1UL, valueProducer.mPastBuckets[DEFAULT_METRIC_DIMENSION_KEY].size());
+//    EXPECT_EQ(bucket2StartTimeNs + 150, valueProducer.mCurrentBucketStartTimeNs);
+//    assertPastBucketValuesSingleKey(valueProducer.mPastBuckets, {20}, {150});
+//
+//    allData.clear();
+//    event = make_shared<LogEvent>(tagId, bucket3StartTimeNs + 1);
+//    event->write(tagId);
+//    event->write(150);
+//    event->init();
+//    allData.push_back(event);
+//    valueProducer.onDataPulled(allData, /** succeed */ true, bucket3StartTimeNs);
+//    EXPECT_EQ(2UL, valueProducer.mPastBuckets[DEFAULT_METRIC_DIMENSION_KEY].size());
+//    EXPECT_EQ(bucket3StartTimeNs, valueProducer.mCurrentBucketStartTimeNs);
+//    EXPECT_EQ(20L,
+//              valueProducer.mPastBuckets[DEFAULT_METRIC_DIMENSION_KEY][0].values[0].long_value);
+//    assertPastBucketValuesSingleKey(valueProducer.mPastBuckets, {20, 30},
+//                                    {150, bucketSizeNs - 150});
+//}
+//
+//TEST(ValueMetricProducerTest, TestPulledWithAppUpgradeDisabled) {
+//    ValueMetric metric = ValueMetricProducerTestHelper::createMetric();
+//    metric.set_split_bucket_for_app_upgrade(false);
+//
+//    UidMap uidMap;
+//    SimpleAtomMatcher atomMatcher;
+//    atomMatcher.set_atom_id(tagId);
+//    sp<EventMatcherWizard> eventMatcherWizard =
+//            new EventMatcherWizard({new SimpleLogMatchingTracker(
+//                    atomMatcherId, logEventMatcherIndex, atomMatcher, uidMap)});
+//    sp<MockConditionWizard> wizard = new NaggyMock<MockConditionWizard>();
+//    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
+//    EXPECT_CALL(*pullerManager, RegisterReceiver(tagId, _, _, _)).WillOnce(Return());
+//    EXPECT_CALL(*pullerManager, UnRegisterReceiver(tagId, _)).WillOnce(Return());
+//    EXPECT_CALL(*pullerManager, Pull(tagId, _)).WillOnce(Return(true));
+//    ValueMetricProducer valueProducer(kConfigKey, metric, -1, wizard, logEventMatcherIndex,
+//                                      eventMatcherWizard, tagId, bucketStartTimeNs,
+//                                      bucketStartTimeNs, pullerManager);
+//
+//    vector<shared_ptr<LogEvent>> allData;
+//    allData.clear();
+//    shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucket2StartTimeNs + 1);
+//    event->write(tagId);
+//    event->write(100);
+//    event->init();
+//    allData.push_back(event);
+//
+//    valueProducer.onDataPulled(allData, /** succeed */ true, bucket2StartTimeNs);
+//    EXPECT_EQ(1UL, valueProducer.mCurrentSlicedBucket.size());
+//
+//    valueProducer.notifyAppUpgrade(bucket2StartTimeNs + 150, "ANY.APP", 1, 1);
+//    EXPECT_EQ(0UL, valueProducer.mPastBuckets[DEFAULT_METRIC_DIMENSION_KEY].size());
+//    EXPECT_EQ(bucket2StartTimeNs, valueProducer.mCurrentBucketStartTimeNs);
+//}
+//
+//TEST(ValueMetricProducerTest, TestPulledValueWithUpgradeWhileConditionFalse) {
+//    ValueMetric metric = ValueMetricProducerTestHelper::createMetricWithCondition();
+//
+//    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
+//    EXPECT_CALL(*pullerManager, Pull(tagId, _))
+//            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
+//                data->clear();
+//                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucketStartTimeNs + 1);
+//                event->write(tagId);
+//                event->write(100);
+//                event->init();
+//                data->push_back(event);
+//                return true;
+//            }))
+//            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
+//                data->clear();
+//                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucket2StartTimeNs - 100);
+//                event->write(tagId);
+//                event->write(120);
+//                event->init();
+//                data->push_back(event);
+//                return true;
+//            }));
+//    sp<ValueMetricProducer> valueProducer =
+//            ValueMetricProducerTestHelper::createValueProducerWithCondition(pullerManager, metric);
+//
+//    valueProducer->onConditionChanged(true, bucketStartTimeNs + 1);
+//
+//    valueProducer->onConditionChanged(false, bucket2StartTimeNs-100);
+//    EXPECT_FALSE(valueProducer->mCondition);
+//
+//    valueProducer->notifyAppUpgrade(bucket2StartTimeNs-50, "ANY.APP", 1, 1);
+//    // Expect one full buckets already done and starting a partial bucket.
+//    EXPECT_EQ(bucket2StartTimeNs-50, valueProducer->mCurrentBucketStartTimeNs);
+//    EXPECT_EQ(1UL, valueProducer->mPastBuckets[DEFAULT_METRIC_DIMENSION_KEY].size());
+//    EXPECT_EQ(bucketStartTimeNs,
+//              valueProducer->mPastBuckets[DEFAULT_METRIC_DIMENSION_KEY][0].mBucketStartNs);
+//    assertPastBucketValuesSingleKey(valueProducer->mPastBuckets, {20},
+//                                    {(bucket2StartTimeNs - 100) - (bucketStartTimeNs + 1)});
+//    EXPECT_FALSE(valueProducer->mCondition);
+//}
+//
+//TEST(ValueMetricProducerTest, TestPushedEventsWithoutCondition) {
+//    ValueMetric metric = ValueMetricProducerTestHelper::createMetric();
+//
+//    UidMap uidMap;
+//    SimpleAtomMatcher atomMatcher;
+//    atomMatcher.set_atom_id(tagId);
+//    sp<EventMatcherWizard> eventMatcherWizard =
+//            new EventMatcherWizard({new SimpleLogMatchingTracker(
+//                    atomMatcherId, logEventMatcherIndex, atomMatcher, uidMap)});
+//    sp<MockConditionWizard> wizard = new NaggyMock<MockConditionWizard>();
+//    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
+//
+//    ValueMetricProducer valueProducer(kConfigKey, metric, -1, wizard, logEventMatcherIndex,
+//                                      eventMatcherWizard, -1, bucketStartTimeNs, bucketStartTimeNs,
+//                                      pullerManager);
+//
+//    shared_ptr<LogEvent> event1 = make_shared<LogEvent>(tagId, bucketStartTimeNs + 10);
+//    event1->write(1);
+//    event1->write(10);
+//    event1->init();
+//    shared_ptr<LogEvent> event2 = make_shared<LogEvent>(tagId, bucketStartTimeNs + 20);
+//    event2->write(1);
+//    event2->write(20);
+//    event2->init();
+//    valueProducer.onMatchedLogEvent(1 /*log matcher index*/, *event1);
+//    // has one slice
+//    EXPECT_EQ(1UL, valueProducer.mCurrentSlicedBucket.size());
+//    ValueMetricProducer::Interval curInterval = valueProducer.mCurrentSlicedBucket.begin()->second[0];
+//    ValueMetricProducer::BaseInfo curBaseInfo = valueProducer.mCurrentBaseInfo.begin()->second[0];
+//    EXPECT_EQ(10, curInterval.value.long_value);
+//    EXPECT_EQ(true, curInterval.hasValue);
+//
+//    valueProducer.onMatchedLogEvent(1 /*log matcher index*/, *event2);
+//
+//    // has one slice
+//    EXPECT_EQ(1UL, valueProducer.mCurrentSlicedBucket.size());
+//    curInterval = valueProducer.mCurrentSlicedBucket.begin()->second[0];
+//    EXPECT_EQ(30, curInterval.value.long_value);
+//
+//    valueProducer.flushIfNeededLocked(bucket2StartTimeNs);
+//    assertPastBucketValuesSingleKey(valueProducer.mPastBuckets, {30}, {bucketSizeNs});
+//}
+//
+//TEST(ValueMetricProducerTest, TestPushedEventsWithCondition) {
+//    ValueMetric metric = ValueMetricProducerTestHelper::createMetric();
+//
+//    UidMap uidMap;
+//    SimpleAtomMatcher atomMatcher;
+//    atomMatcher.set_atom_id(tagId);
+//    sp<EventMatcherWizard> eventMatcherWizard =
+//            new EventMatcherWizard({new SimpleLogMatchingTracker(
+//                    atomMatcherId, logEventMatcherIndex, atomMatcher, uidMap)});
+//    sp<MockConditionWizard> wizard = new NaggyMock<MockConditionWizard>();
+//    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
+//
+//    ValueMetricProducer valueProducer(kConfigKey, metric, 1, wizard, logEventMatcherIndex,
+//                                      eventMatcherWizard, -1, bucketStartTimeNs, bucketStartTimeNs,
+//                                      pullerManager);
+//    valueProducer.mCondition = ConditionState::kFalse;
+//
+//    shared_ptr<LogEvent> event1 = make_shared<LogEvent>(tagId, bucketStartTimeNs + 10);
+//    event1->write(1);
+//    event1->write(10);
+//    event1->init();
+//    valueProducer.onMatchedLogEvent(1 /*log matcher index*/, *event1);
+//    // has 1 slice
+//    EXPECT_EQ(0UL, valueProducer.mCurrentSlicedBucket.size());
+//
+//    valueProducer.onConditionChangedLocked(true, bucketStartTimeNs + 15);
+//    shared_ptr<LogEvent> event2 = make_shared<LogEvent>(tagId, bucketStartTimeNs + 20);
+//    event2->write(1);
+//    event2->write(20);
+//    event2->init();
+//    valueProducer.onMatchedLogEvent(1 /*log matcher index*/, *event2);
+//
+//    // has one slice
+//    EXPECT_EQ(1UL, valueProducer.mCurrentSlicedBucket.size());
+//    ValueMetricProducer::Interval curInterval =
+//            valueProducer.mCurrentSlicedBucket.begin()->second[0];
+//    curInterval = valueProducer.mCurrentSlicedBucket.begin()->second[0];
+//    EXPECT_EQ(20, curInterval.value.long_value);
+//
+//    shared_ptr<LogEvent> event3 = make_shared<LogEvent>(tagId, bucketStartTimeNs + 30);
+//    event3->write(1);
+//    event3->write(30);
+//    event3->init();
+//    valueProducer.onMatchedLogEvent(1 /*log matcher index*/, *event3);
+//
+//    // has one slice
+//    EXPECT_EQ(1UL, valueProducer.mCurrentSlicedBucket.size());
+//    curInterval = valueProducer.mCurrentSlicedBucket.begin()->second[0];
+//    EXPECT_EQ(50, curInterval.value.long_value);
+//
+//    valueProducer.onConditionChangedLocked(false, bucketStartTimeNs + 35);
+//    shared_ptr<LogEvent> event4 = make_shared<LogEvent>(tagId, bucketStartTimeNs + 40);
+//    event4->write(1);
+//    event4->write(40);
+//    event4->init();
+//    valueProducer.onMatchedLogEvent(1 /*log matcher index*/, *event4);
+//
+//    // has one slice
+//    EXPECT_EQ(1UL, valueProducer.mCurrentSlicedBucket.size());
+//    curInterval = valueProducer.mCurrentSlicedBucket.begin()->second[0];
+//    EXPECT_EQ(50, curInterval.value.long_value);
+//
+//    valueProducer.flushIfNeededLocked(bucket2StartTimeNs);
+//    assertPastBucketValuesSingleKey(valueProducer.mPastBuckets, {50}, {20});
+//}
+//
+//TEST(ValueMetricProducerTest, TestAnomalyDetection) {
+//    sp<AlarmMonitor> alarmMonitor;
+//    Alert alert;
+//    alert.set_id(101);
+//    alert.set_metric_id(metricId);
+//    alert.set_trigger_if_sum_gt(130);
+//    alert.set_num_buckets(2);
+//    const int32_t refPeriodSec = 3;
+//    alert.set_refractory_period_secs(refPeriodSec);
+//
+//    ValueMetric metric = ValueMetricProducerTestHelper::createMetric();
+//
+//    UidMap uidMap;
+//    SimpleAtomMatcher atomMatcher;
+//    atomMatcher.set_atom_id(tagId);
+//    sp<EventMatcherWizard> eventMatcherWizard =
+//            new EventMatcherWizard({new SimpleLogMatchingTracker(
+//                    atomMatcherId, logEventMatcherIndex, atomMatcher, uidMap)});
+//    sp<MockConditionWizard> wizard = new NaggyMock<MockConditionWizard>();
+//    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
+//    ValueMetricProducer valueProducer(kConfigKey, metric, -1 /*-1 meaning no condition*/, wizard,
+//                                      logEventMatcherIndex, eventMatcherWizard, -1 /*not pulled*/,
+//                                      bucketStartTimeNs, bucketStartTimeNs, pullerManager);
+//
+//    sp<AnomalyTracker> anomalyTracker = valueProducer.addAnomalyTracker(alert, alarmMonitor);
+//
+//
+//    shared_ptr<LogEvent> event1
+//            = make_shared<LogEvent>(tagId, bucketStartTimeNs + 1 * NS_PER_SEC);
+//    event1->write(161);
+//    event1->write(10); // value of interest
+//    event1->init();
+//    shared_ptr<LogEvent> event2
+//            = make_shared<LogEvent>(tagId, bucketStartTimeNs + 2 + NS_PER_SEC);
+//    event2->write(162);
+//    event2->write(20); // value of interest
+//    event2->init();
+//    shared_ptr<LogEvent> event3
+//            = make_shared<LogEvent>(tagId, bucketStartTimeNs + 2 * bucketSizeNs + 1 * NS_PER_SEC);
+//    event3->write(163);
+//    event3->write(130); // value of interest
+//    event3->init();
+//    shared_ptr<LogEvent> event4
+//            = make_shared<LogEvent>(tagId, bucketStartTimeNs + 3 * bucketSizeNs + 1 * NS_PER_SEC);
+//    event4->write(35);
+//    event4->write(1); // value of interest
+//    event4->init();
+//    shared_ptr<LogEvent> event5
+//            = make_shared<LogEvent>(tagId, bucketStartTimeNs + 3 * bucketSizeNs + 2 * NS_PER_SEC);
+//    event5->write(45);
+//    event5->write(150); // value of interest
+//    event5->init();
+//    shared_ptr<LogEvent> event6
+//            = make_shared<LogEvent>(tagId, bucketStartTimeNs + 3 * bucketSizeNs + 10 * NS_PER_SEC);
+//    event6->write(25);
+//    event6->write(160); // value of interest
+//    event6->init();
+//
+//    // Two events in bucket #0.
+//    valueProducer.onMatchedLogEvent(1 /*log matcher index*/, *event1);
+//    valueProducer.onMatchedLogEvent(1 /*log matcher index*/, *event2);
+//    // Value sum == 30 <= 130.
+//    EXPECT_EQ(anomalyTracker->getRefractoryPeriodEndsSec(DEFAULT_METRIC_DIMENSION_KEY), 0U);
+//
+//    // One event in bucket #2. No alarm as bucket #0 is trashed out.
+//    valueProducer.onMatchedLogEvent(1 /*log matcher index*/, *event3);
+//    // Value sum == 130 <= 130.
+//    EXPECT_EQ(anomalyTracker->getRefractoryPeriodEndsSec(DEFAULT_METRIC_DIMENSION_KEY), 0U);
+//
+//    // Three events in bucket #3.
+//    valueProducer.onMatchedLogEvent(1 /*log matcher index*/, *event4);
+//    // Anomaly at event 4 since Value sum == 131 > 130!
+//    EXPECT_EQ(anomalyTracker->getRefractoryPeriodEndsSec(DEFAULT_METRIC_DIMENSION_KEY),
+//            std::ceil(1.0 * event4->GetElapsedTimestampNs() / NS_PER_SEC + refPeriodSec));
+//    valueProducer.onMatchedLogEvent(1 /*log matcher index*/, *event5);
+//    // Event 5 is within 3 sec refractory period. Thus last alarm timestamp is still event4.
+//    EXPECT_EQ(anomalyTracker->getRefractoryPeriodEndsSec(DEFAULT_METRIC_DIMENSION_KEY),
+//            std::ceil(1.0 * event4->GetElapsedTimestampNs() / NS_PER_SEC + refPeriodSec));
+//
+//    valueProducer.onMatchedLogEvent(1 /*log matcher index*/, *event6);
+//    // Anomaly at event 6 since Value sum == 160 > 130 and after refractory period.
+//    EXPECT_EQ(anomalyTracker->getRefractoryPeriodEndsSec(DEFAULT_METRIC_DIMENSION_KEY),
+//            std::ceil(1.0 * event6->GetElapsedTimestampNs() / NS_PER_SEC + refPeriodSec));
+//}
+//
+//// Test value metric no condition, the pull on bucket boundary come in time and too late
+//TEST(ValueMetricProducerTest, TestBucketBoundaryNoCondition) {
+//    ValueMetric metric = ValueMetricProducerTestHelper::createMetric();
+//    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
+//    EXPECT_CALL(*pullerManager, Pull(tagId, _)).WillOnce(Return(true));
+//    sp<ValueMetricProducer> valueProducer =
+//            ValueMetricProducerTestHelper::createValueProducerNoConditions(pullerManager, metric);
+//
+//    vector<shared_ptr<LogEvent>> allData;
+//    // pull 1
+//    allData.clear();
+//    shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucket2StartTimeNs + 1);
+//    event->write(tagId);
+//    event->write(11);
+//    event->init();
+//    allData.push_back(event);
+//
+//    valueProducer->onDataPulled(allData, /** succeed */ true, bucket2StartTimeNs);
+//    // has one slice
+//    EXPECT_EQ(1UL, valueProducer->mCurrentSlicedBucket.size());
+//    ValueMetricProducer::Interval curInterval =
+//            valueProducer->mCurrentSlicedBucket.begin()->second[0];
+//    ValueMetricProducer::BaseInfo curBaseInfo = valueProducer->mCurrentBaseInfo.begin()->second[0];
+//
+//    // startUpdated:true sum:0 start:11
+//    EXPECT_EQ(true, curBaseInfo.hasBase);
+//    EXPECT_EQ(11, curBaseInfo.base.long_value);
+//    EXPECT_EQ(false, curInterval.hasValue);
+//    EXPECT_EQ(0UL, valueProducer->mPastBuckets.size());
+//
+//    // pull 2 at correct time
+//    allData.clear();
+//    event = make_shared<LogEvent>(tagId, bucket3StartTimeNs + 1);
+//    event->write(tagId);
+//    event->write(23);
+//    event->init();
+//    allData.push_back(event);
+//    valueProducer->onDataPulled(allData, /** succeed */ true, bucket3StartTimeNs);
+//    // has one slice
+//    EXPECT_EQ(1UL, valueProducer->mCurrentSlicedBucket.size());
+//    curInterval = valueProducer->mCurrentSlicedBucket.begin()->second[0];
+//    curBaseInfo = valueProducer->mCurrentBaseInfo.begin()->second[0];
+//    // tartUpdated:false sum:12
+//    EXPECT_EQ(true, curBaseInfo.hasBase);
+//    EXPECT_EQ(23, curBaseInfo.base.long_value);
+//    EXPECT_EQ(false, curInterval.hasValue);
+//    assertPastBucketValuesSingleKey(valueProducer->mPastBuckets, {12}, {bucketSizeNs});
+//
+//    // pull 3 come late.
+//    // The previous bucket gets closed with error. (Has start value 23, no ending)
+//    // Another bucket gets closed with error. (No start, but ending with 36)
+//    // The new bucket is back to normal.
+//    allData.clear();
+//    event = make_shared<LogEvent>(tagId, bucket6StartTimeNs + 1);
+//    event->write(tagId);
+//    event->write(36);
+//    event->init();
+//    allData.push_back(event);
+//    valueProducer->onDataPulled(allData, /** succeed */ true, bucket6StartTimeNs);
+//    EXPECT_EQ(1UL, valueProducer->mCurrentSlicedBucket.size());
+//    curInterval = valueProducer->mCurrentSlicedBucket.begin()->second[0];
+//    curBaseInfo = valueProducer->mCurrentBaseInfo.begin()->second[0];
+//    // startUpdated:false sum:12
+//    EXPECT_EQ(true, curBaseInfo.hasBase);
+//    EXPECT_EQ(36, curBaseInfo.base.long_value);
+//    EXPECT_EQ(false, curInterval.hasValue);
+//    assertPastBucketValuesSingleKey(valueProducer->mPastBuckets, {12}, {bucketSizeNs});
+//}
+//
+///*
+// * Test pulled event with non sliced condition. The pull on boundary come late because the alarm
+// * was delivered late.
+// */
+//TEST(ValueMetricProducerTest, TestBucketBoundaryWithCondition) {
+//    ValueMetric metric = ValueMetricProducerTestHelper::createMetricWithCondition();
+//
+//    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
+//    EXPECT_CALL(*pullerManager, Pull(tagId, _))
+//            // condition becomes true
+//            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
+//                data->clear();
+//                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucketStartTimeNs + 8);
+//                event->write(tagId);
+//                event->write(100);
+//                event->init();
+//                data->push_back(event);
+//                return true;
+//            }))
+//            // condition becomes false
+//            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
+//                data->clear();
+//                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucket2StartTimeNs + 1);
+//                event->write(tagId);
+//                event->write(120);
+//                event->init();
+//                data->push_back(event);
+//                return true;
+//            }));
+//    sp<ValueMetricProducer> valueProducer =
+//            ValueMetricProducerTestHelper::createValueProducerWithCondition(pullerManager, metric);
+//
+//    valueProducer->onConditionChanged(true, bucketStartTimeNs + 8);
+//
+//    // has one slice
+//    EXPECT_EQ(1UL, valueProducer->mCurrentSlicedBucket.size());
+//    ValueMetricProducer::Interval curInterval =
+//            valueProducer->mCurrentSlicedBucket.begin()->second[0];
+//    ValueMetricProducer::BaseInfo curBaseInfo = valueProducer->mCurrentBaseInfo.begin()->second[0];
+//    EXPECT_EQ(true, curBaseInfo.hasBase);
+//    EXPECT_EQ(100, curBaseInfo.base.long_value);
+//    EXPECT_EQ(false, curInterval.hasValue);
+//    EXPECT_EQ(0UL, valueProducer->mPastBuckets.size());
+//
+//    // pull on bucket boundary come late, condition change happens before it
+//    valueProducer->onConditionChanged(false, bucket2StartTimeNs + 1);
+//    curInterval = valueProducer->mCurrentSlicedBucket.begin()->second[0];
+//    curBaseInfo = valueProducer->mCurrentBaseInfo.begin()->second[0];
+//    assertPastBucketValuesSingleKey(valueProducer->mPastBuckets, {20}, {bucketSizeNs - 8});
+//    EXPECT_EQ(false, curBaseInfo.hasBase);
+//
+//    // Now the alarm is delivered.
+//    // since the condition turned to off before this pull finish, it has no effect
+//    vector<shared_ptr<LogEvent>> allData;
+//    allData.push_back(ValueMetricProducerTestHelper::createEvent(bucket2StartTimeNs + 30, 110));
+//    valueProducer->onDataPulled(allData, /** succeed */ true, bucket2StartTimeNs);
+//
+//    assertPastBucketValuesSingleKey(valueProducer->mPastBuckets, {20}, {bucketSizeNs - 8});
+//    curInterval = valueProducer->mCurrentSlicedBucket.begin()->second[0];
+//    curBaseInfo = valueProducer->mCurrentBaseInfo.begin()->second[0];
+//    EXPECT_EQ(false, curBaseInfo.hasBase);
+//    EXPECT_EQ(false, curInterval.hasValue);
+//}
+//
+///*
+// * Test pulled event with non sliced condition. The pull on boundary come late, after the condition
+// * change to false, and then true again. This is due to alarm delivered late.
+// */
+//TEST(ValueMetricProducerTest, TestBucketBoundaryWithCondition2) {
+//    ValueMetric metric = ValueMetricProducerTestHelper::createMetricWithCondition();
+//
+//    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
+//    EXPECT_CALL(*pullerManager, Pull(tagId, _))
+//            // condition becomes true
+//            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
+//                data->clear();
+//                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucketStartTimeNs + 8);
+//                event->write(tagId);
+//                event->write(100);
+//                event->init();
+//                data->push_back(event);
+//                return true;
+//            }))
+//            // condition becomes false
+//            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
+//                data->clear();
+//                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucket2StartTimeNs + 1);
+//                event->write(tagId);
+//                event->write(120);
+//                event->init();
+//                data->push_back(event);
+//                return true;
+//            }))
+//            // condition becomes true again
+//            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
+//                data->clear();
+//                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucket2StartTimeNs + 25);
+//                event->write(tagId);
+//                event->write(130);
+//                event->init();
+//                data->push_back(event);
+//                return true;
+//            }));
+//
+//    sp<ValueMetricProducer> valueProducer =
+//            ValueMetricProducerTestHelper::createValueProducerWithCondition(pullerManager, metric);
+//
+//    valueProducer->onConditionChanged(true, bucketStartTimeNs + 8);
+//
+//    // has one slice
+//    EXPECT_EQ(1UL, valueProducer->mCurrentSlicedBucket.size());
+//    ValueMetricProducer::Interval curInterval =
+//            valueProducer->mCurrentSlicedBucket.begin()->second[0];
+//    ValueMetricProducer::BaseInfo curBaseInfo = valueProducer->mCurrentBaseInfo.begin()->second[0];
+//    // startUpdated:false sum:0 start:100
+//    EXPECT_EQ(true, curBaseInfo.hasBase);
+//    EXPECT_EQ(100, curBaseInfo.base.long_value);
+//    EXPECT_EQ(false, curInterval.hasValue);
+//    EXPECT_EQ(0UL, valueProducer->mPastBuckets.size());
+//
+//    // pull on bucket boundary come late, condition change happens before it
+//    valueProducer->onConditionChanged(false, bucket2StartTimeNs + 1);
+//    assertPastBucketValuesSingleKey(valueProducer->mPastBuckets, {20}, {bucketSizeNs - 8});
+//    EXPECT_EQ(1UL, valueProducer->mCurrentSlicedBucket.size());
+//    curInterval = valueProducer->mCurrentSlicedBucket.begin()->second[0];
+//    curBaseInfo = valueProducer->mCurrentBaseInfo.begin()->second[0];
+//    EXPECT_EQ(false, curBaseInfo.hasBase);
+//    EXPECT_EQ(false, curInterval.hasValue);
+//
+//    // condition changed to true again, before the pull alarm is delivered
+//    valueProducer->onConditionChanged(true, bucket2StartTimeNs + 25);
+//    assertPastBucketValuesSingleKey(valueProducer->mPastBuckets, {20}, {bucketSizeNs - 8});
+//    curInterval = valueProducer->mCurrentSlicedBucket.begin()->second[0];
+//    curBaseInfo = valueProducer->mCurrentBaseInfo.begin()->second[0];
+//    EXPECT_EQ(true, curBaseInfo.hasBase);
+//    EXPECT_EQ(130, curBaseInfo.base.long_value);
+//    EXPECT_EQ(false, curInterval.hasValue);
+//
+//    // Now the alarm is delivered, but it is considered late, the data will be used
+//    // for the new bucket since it was just pulled.
+//    vector<shared_ptr<LogEvent>> allData;
+//    allData.push_back(ValueMetricProducerTestHelper::createEvent(bucket2StartTimeNs + 50, 140));
+//    valueProducer->onDataPulled(allData, /** succeed */ true, bucket2StartTimeNs + 50);
+//
+//    curInterval = valueProducer->mCurrentSlicedBucket.begin()->second[0];
+//    curBaseInfo = valueProducer->mCurrentBaseInfo.begin()->second[0];
+//    EXPECT_EQ(true, curBaseInfo.hasBase);
+//    EXPECT_EQ(140, curBaseInfo.base.long_value);
+//    EXPECT_EQ(true, curInterval.hasValue);
+//    EXPECT_EQ(10, curInterval.value.long_value);
+//    assertPastBucketValuesSingleKey(valueProducer->mPastBuckets, {20}, {bucketSizeNs - 8});
+//
+//    allData.clear();
+//    allData.push_back(ValueMetricProducerTestHelper::createEvent(bucket3StartTimeNs, 160));
+//    valueProducer->onDataPulled(allData, /** succeed */ true, bucket3StartTimeNs);
+//    assertPastBucketValuesSingleKey(valueProducer->mPastBuckets, {20, 30},
+//                                    {bucketSizeNs - 8, bucketSizeNs - 24});
+//}
+//
+//TEST(ValueMetricProducerTest, TestPushedAggregateMin) {
+//    ValueMetric metric = ValueMetricProducerTestHelper::createMetric();
+//    metric.set_aggregation_type(ValueMetric::MIN);
+//
+//    UidMap uidMap;
+//    SimpleAtomMatcher atomMatcher;
+//    atomMatcher.set_atom_id(tagId);
+//    sp<EventMatcherWizard> eventMatcherWizard =
+//            new EventMatcherWizard({new SimpleLogMatchingTracker(
+//                    atomMatcherId, logEventMatcherIndex, atomMatcher, uidMap)});
+//    sp<MockConditionWizard> wizard = new NaggyMock<MockConditionWizard>();
+//    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
+//
+//    ValueMetricProducer valueProducer(kConfigKey, metric, -1, wizard, logEventMatcherIndex,
+//                                      eventMatcherWizard, -1, bucketStartTimeNs, bucketStartTimeNs,
+//                                      pullerManager);
+//
+//    shared_ptr<LogEvent> event1 = make_shared<LogEvent>(tagId, bucketStartTimeNs + 10);
+//    event1->write(1);
+//    event1->write(10);
+//    event1->init();
+//    shared_ptr<LogEvent> event2 = make_shared<LogEvent>(tagId, bucketStartTimeNs + 20);
+//    event2->write(1);
+//    event2->write(20);
+//    event2->init();
+//    valueProducer.onMatchedLogEvent(1 /*log matcher index*/, *event1);
+//    // has one slice
+//    EXPECT_EQ(1UL, valueProducer.mCurrentSlicedBucket.size());
+//    ValueMetricProducer::Interval curInterval =
+//            valueProducer.mCurrentSlicedBucket.begin()->second[0];
+//    EXPECT_EQ(10, curInterval.value.long_value);
+//    EXPECT_EQ(true, curInterval.hasValue);
+//
+//    valueProducer.onMatchedLogEvent(1 /*log matcher index*/, *event2);
+//
+//    // has one slice
+//    EXPECT_EQ(1UL, valueProducer.mCurrentSlicedBucket.size());
+//    curInterval = valueProducer.mCurrentSlicedBucket.begin()->second[0];
+//    EXPECT_EQ(10, curInterval.value.long_value);
+//
+//    valueProducer.flushIfNeededLocked(bucket2StartTimeNs);
+//    assertPastBucketValuesSingleKey(valueProducer.mPastBuckets, {10}, {bucketSizeNs});
+//}
+//
+//TEST(ValueMetricProducerTest, TestPushedAggregateMax) {
+//    ValueMetric metric = ValueMetricProducerTestHelper::createMetric();
+//    metric.set_aggregation_type(ValueMetric::MAX);
+//
+//    UidMap uidMap;
+//    SimpleAtomMatcher atomMatcher;
+//    atomMatcher.set_atom_id(tagId);
+//    sp<EventMatcherWizard> eventMatcherWizard =
+//            new EventMatcherWizard({new SimpleLogMatchingTracker(
+//                    atomMatcherId, logEventMatcherIndex, atomMatcher, uidMap)});
+//    sp<MockConditionWizard> wizard = new NaggyMock<MockConditionWizard>();
+//    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
+//
+//    ValueMetricProducer valueProducer(kConfigKey, metric, -1, wizard, logEventMatcherIndex,
+//                                      eventMatcherWizard, -1, bucketStartTimeNs, bucketStartTimeNs,
+//                                      pullerManager);
+//
+//    shared_ptr<LogEvent> event1 = make_shared<LogEvent>(tagId, bucketStartTimeNs + 10);
+//    event1->write(1);
+//    event1->write(10);
+//    event1->init();
+//    shared_ptr<LogEvent> event2 = make_shared<LogEvent>(tagId, bucketStartTimeNs + 20);
+//    event2->write(1);
+//    event2->write(20);
+//    event2->init();
+//    valueProducer.onMatchedLogEvent(1 /*log matcher index*/, *event1);
+//    // has one slice
+//    EXPECT_EQ(1UL, valueProducer.mCurrentSlicedBucket.size());
+//    ValueMetricProducer::Interval curInterval =
+//            valueProducer.mCurrentSlicedBucket.begin()->second[0];
+//    EXPECT_EQ(10, curInterval.value.long_value);
+//    EXPECT_EQ(true, curInterval.hasValue);
+//
+//    valueProducer.onMatchedLogEvent(1 /*log matcher index*/, *event2);
+//
+//    // has one slice
+//    EXPECT_EQ(1UL, valueProducer.mCurrentSlicedBucket.size());
+//    curInterval = valueProducer.mCurrentSlicedBucket.begin()->second[0];
+//    EXPECT_EQ(20, curInterval.value.long_value);
+//
+//    valueProducer.flushIfNeededLocked(bucket3StartTimeNs);
+//    /* EXPECT_EQ(1UL, valueProducer.mPastBuckets.size()); */
+//    /* EXPECT_EQ(1UL, valueProducer.mPastBuckets.begin()->second.size()); */
+//    /* EXPECT_EQ(20, valueProducer.mPastBuckets.begin()->second.back().values[0].long_value); */
+//}
+//
+//TEST(ValueMetricProducerTest, TestPushedAggregateAvg) {
+//    ValueMetric metric = ValueMetricProducerTestHelper::createMetric();
+//    metric.set_aggregation_type(ValueMetric::AVG);
+//
+//    UidMap uidMap;
+//    SimpleAtomMatcher atomMatcher;
+//    atomMatcher.set_atom_id(tagId);
+//    sp<EventMatcherWizard> eventMatcherWizard =
+//            new EventMatcherWizard({new SimpleLogMatchingTracker(
+//                    atomMatcherId, logEventMatcherIndex, atomMatcher, uidMap)});
+//    sp<MockConditionWizard> wizard = new NaggyMock<MockConditionWizard>();
+//    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
+//
+//    ValueMetricProducer valueProducer(kConfigKey, metric, -1, wizard, logEventMatcherIndex,
+//                                      eventMatcherWizard, -1, bucketStartTimeNs, bucketStartTimeNs,
+//                                      pullerManager);
+//
+//    shared_ptr<LogEvent> event1 = make_shared<LogEvent>(tagId, bucketStartTimeNs + 10);
+//    event1->write(1);
+//    event1->write(10);
+//    event1->init();
+//    shared_ptr<LogEvent> event2 = make_shared<LogEvent>(tagId, bucketStartTimeNs + 20);
+//    event2->write(1);
+//    event2->write(15);
+//    event2->init();
+//    valueProducer.onMatchedLogEvent(1 /*log matcher index*/, *event1);
+//    // has one slice
+//    EXPECT_EQ(1UL, valueProducer.mCurrentSlicedBucket.size());
+//    ValueMetricProducer::Interval curInterval;
+//    curInterval = valueProducer.mCurrentSlicedBucket.begin()->second[0];
+//    EXPECT_EQ(10, curInterval.value.long_value);
+//    EXPECT_EQ(true, curInterval.hasValue);
+//    EXPECT_EQ(1, curInterval.sampleSize);
+//
+//    valueProducer.onMatchedLogEvent(1 /*log matcher index*/, *event2);
+//
+//    // has one slice
+//    EXPECT_EQ(1UL, valueProducer.mCurrentSlicedBucket.size());
+//    curInterval = valueProducer.mCurrentSlicedBucket.begin()->second[0];
+//    EXPECT_EQ(25, curInterval.value.long_value);
+//    EXPECT_EQ(2, curInterval.sampleSize);
+//
+//    valueProducer.flushIfNeededLocked(bucket2StartTimeNs);
+//    EXPECT_EQ(1UL, valueProducer.mPastBuckets.size());
+//    EXPECT_EQ(1UL, valueProducer.mPastBuckets.begin()->second.size());
+//
+//    EXPECT_TRUE(std::abs(valueProducer.mPastBuckets.begin()->second.back().values[0].double_value -
+//                         12.5) < epsilon);
+//}
+//
+//TEST(ValueMetricProducerTest, TestPushedAggregateSum) {
+//    ValueMetric metric = ValueMetricProducerTestHelper::createMetric();
+//    metric.set_aggregation_type(ValueMetric::SUM);
+//
+//    UidMap uidMap;
+//    SimpleAtomMatcher atomMatcher;
+//    atomMatcher.set_atom_id(tagId);
+//    sp<EventMatcherWizard> eventMatcherWizard =
+//            new EventMatcherWizard({new SimpleLogMatchingTracker(
+//                    atomMatcherId, logEventMatcherIndex, atomMatcher, uidMap)});
+//    sp<MockConditionWizard> wizard = new NaggyMock<MockConditionWizard>();
+//    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
+//
+//    ValueMetricProducer valueProducer(kConfigKey, metric, -1, wizard, logEventMatcherIndex,
+//                                      eventMatcherWizard, -1, bucketStartTimeNs, bucketStartTimeNs,
+//                                      pullerManager);
+//
+//    shared_ptr<LogEvent> event1 = make_shared<LogEvent>(tagId, bucketStartTimeNs + 10);
+//    event1->write(1);
+//    event1->write(10);
+//    event1->init();
+//    shared_ptr<LogEvent> event2 = make_shared<LogEvent>(tagId, bucketStartTimeNs + 20);
+//    event2->write(1);
+//    event2->write(15);
+//    event2->init();
+//    valueProducer.onMatchedLogEvent(1 /*log matcher index*/, *event1);
+//    // has one slice
+//    EXPECT_EQ(1UL, valueProducer.mCurrentSlicedBucket.size());
+//    ValueMetricProducer::Interval curInterval =
+//            valueProducer.mCurrentSlicedBucket.begin()->second[0];
+//    EXPECT_EQ(10, curInterval.value.long_value);
+//    EXPECT_EQ(true, curInterval.hasValue);
+//
+//    valueProducer.onMatchedLogEvent(1 /*log matcher index*/, *event2);
+//
+//    // has one slice
+//    EXPECT_EQ(1UL, valueProducer.mCurrentSlicedBucket.size());
+//    curInterval = valueProducer.mCurrentSlicedBucket.begin()->second[0];
+//    EXPECT_EQ(25, curInterval.value.long_value);
+//
+//    valueProducer.flushIfNeededLocked(bucket2StartTimeNs);
+//    assertPastBucketValuesSingleKey(valueProducer.mPastBuckets, {25}, {bucketSizeNs});
+//}
+//
+//TEST(ValueMetricProducerTest, TestSkipZeroDiffOutput) {
+//    ValueMetric metric = ValueMetricProducerTestHelper::createMetric();
+//    metric.set_aggregation_type(ValueMetric::MIN);
+//    metric.set_use_diff(true);
+//
+//    UidMap uidMap;
+//    SimpleAtomMatcher atomMatcher;
+//    atomMatcher.set_atom_id(tagId);
+//    sp<EventMatcherWizard> eventMatcherWizard =
+//            new EventMatcherWizard({new SimpleLogMatchingTracker(
+//                    atomMatcherId, logEventMatcherIndex, atomMatcher, uidMap)});
+//    sp<MockConditionWizard> wizard = new NaggyMock<MockConditionWizard>();
+//    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
+//
+//    ValueMetricProducer valueProducer(kConfigKey, metric, -1, wizard, logEventMatcherIndex,
+//                                      eventMatcherWizard, -1, bucketStartTimeNs, bucketStartTimeNs,
+//                                      pullerManager);
+//
+//    shared_ptr<LogEvent> event1 = make_shared<LogEvent>(tagId, bucketStartTimeNs + 10);
+//    event1->write(1);
+//    event1->write(10);
+//    event1->init();
+//    shared_ptr<LogEvent> event2 = make_shared<LogEvent>(tagId, bucketStartTimeNs + 15);
+//    event2->write(1);
+//    event2->write(15);
+//    event2->init();
+//    valueProducer.onMatchedLogEvent(1 /*log matcher index*/, *event1);
+//    // has one slice
+//    EXPECT_EQ(1UL, valueProducer.mCurrentSlicedBucket.size());
+//    ValueMetricProducer::Interval curInterval =
+//            valueProducer.mCurrentSlicedBucket.begin()->second[0];
+//    ValueMetricProducer::BaseInfo curBaseInfo = valueProducer.mCurrentBaseInfo.begin()->second[0];
+//    EXPECT_EQ(true, curBaseInfo.hasBase);
+//    EXPECT_EQ(10, curBaseInfo.base.long_value);
+//    EXPECT_EQ(false, curInterval.hasValue);
+//
+//    valueProducer.onMatchedLogEvent(1 /*log matcher index*/, *event2);
+//
+//    // has one slice
+//    EXPECT_EQ(1UL, valueProducer.mCurrentSlicedBucket.size());
+//    curInterval = valueProducer.mCurrentSlicedBucket.begin()->second[0];
+//    EXPECT_EQ(true, curInterval.hasValue);
+//    EXPECT_EQ(5, curInterval.value.long_value);
+//
+//    // no change in data.
+//    shared_ptr<LogEvent> event3 = make_shared<LogEvent>(tagId, bucket2StartTimeNs + 10);
+//    event3->write(1);
+//    event3->write(15);
+//    event3->init();
+//    valueProducer.onMatchedLogEvent(1 /*log matcher index*/, *event3);
+//    EXPECT_EQ(1UL, valueProducer.mCurrentSlicedBucket.size());
+//    curInterval = valueProducer.mCurrentSlicedBucket.begin()->second[0];
+//    curBaseInfo = valueProducer.mCurrentBaseInfo.begin()->second[0];
+//    EXPECT_EQ(true, curBaseInfo.hasBase);
+//    EXPECT_EQ(15, curBaseInfo.base.long_value);
+//    EXPECT_EQ(true, curInterval.hasValue);
+//
+//    shared_ptr<LogEvent> event4 = make_shared<LogEvent>(tagId, bucket2StartTimeNs + 15);
+//    event4->write(1);
+//    event4->write(15);
+//    event4->init();
+//    valueProducer.onMatchedLogEvent(1 /*log matcher index*/, *event4);
+//    EXPECT_EQ(1UL, valueProducer.mCurrentSlicedBucket.size());
+//    curInterval = valueProducer.mCurrentSlicedBucket.begin()->second[0];
+//    curBaseInfo = valueProducer.mCurrentBaseInfo.begin()->second[0];
+//    EXPECT_EQ(true, curBaseInfo.hasBase);
+//    EXPECT_EQ(15, curBaseInfo.base.long_value);
+//    EXPECT_EQ(true, curInterval.hasValue);
+//
+//    valueProducer.flushIfNeededLocked(bucket3StartTimeNs);
+//    EXPECT_EQ(1UL, valueProducer.mPastBuckets.size());
+//    EXPECT_EQ(1UL, valueProducer.mPastBuckets.begin()->second.size());
+//    assertPastBucketValuesSingleKey(valueProducer.mPastBuckets, {5}, {bucketSizeNs});
+//}
+//
+//TEST(ValueMetricProducerTest, TestSkipZeroDiffOutputMultiValue) {
+//    ValueMetric metric = ValueMetricProducerTestHelper::createMetric();
+//    metric.mutable_value_field()->add_child()->set_field(3);
+//    metric.set_aggregation_type(ValueMetric::MIN);
+//    metric.set_use_diff(true);
+//
+//    UidMap uidMap;
+//    SimpleAtomMatcher atomMatcher;
+//    atomMatcher.set_atom_id(tagId);
+//    sp<EventMatcherWizard> eventMatcherWizard =
+//            new EventMatcherWizard({new SimpleLogMatchingTracker(
+//                    atomMatcherId, logEventMatcherIndex, atomMatcher, uidMap)});
+//    sp<MockConditionWizard> wizard = new NaggyMock<MockConditionWizard>();
+//    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
+//
+//    ValueMetricProducer valueProducer(kConfigKey, metric, -1, wizard, logEventMatcherIndex,
+//                                      eventMatcherWizard, -1, bucketStartTimeNs, bucketStartTimeNs,
+//                                      pullerManager);
+//
+//    shared_ptr<LogEvent> event1 = make_shared<LogEvent>(tagId, bucketStartTimeNs + 10);
+//    event1->write(1);
+//    event1->write(10);
+//    event1->write(20);
+//    event1->init();
+//    shared_ptr<LogEvent> event2 = make_shared<LogEvent>(tagId, bucketStartTimeNs + 15);
+//    event2->write(1);
+//    event2->write(15);
+//    event2->write(22);
+//    event2->init();
+//    valueProducer.onMatchedLogEvent(1 /*log matcher index*/, *event1);
+//    // has one slice
+//    EXPECT_EQ(1UL, valueProducer.mCurrentSlicedBucket.size());
+//    ValueMetricProducer::Interval curInterval =
+//            valueProducer.mCurrentSlicedBucket.begin()->second[0];
+//    ValueMetricProducer::BaseInfo curBaseInfo = valueProducer.mCurrentBaseInfo.begin()->second[0];
+//    EXPECT_EQ(true, curBaseInfo.hasBase);
+//    EXPECT_EQ(10, curBaseInfo.base.long_value);
+//    EXPECT_EQ(false, curInterval.hasValue);
+//    curBaseInfo = valueProducer.mCurrentBaseInfo.begin()->second[1];
+//    EXPECT_EQ(true, curBaseInfo.hasBase);
+//    EXPECT_EQ(20, curBaseInfo.base.long_value);
+//    EXPECT_EQ(false, curInterval.hasValue);
+//
+//    valueProducer.onMatchedLogEvent(1 /*log matcher index*/, *event2);
+//
+//    // has one slice
+//    EXPECT_EQ(1UL, valueProducer.mCurrentSlicedBucket.size());
+//    curInterval = valueProducer.mCurrentSlicedBucket.begin()->second[0];
+//    curBaseInfo = valueProducer.mCurrentBaseInfo.begin()->second[0];
+//    EXPECT_EQ(true, curInterval.hasValue);
+//    EXPECT_EQ(5, curInterval.value.long_value);
+//    curInterval = valueProducer.mCurrentSlicedBucket.begin()->second[1];
+//    curBaseInfo = valueProducer.mCurrentBaseInfo.begin()->second[1];
+//    EXPECT_EQ(true, curInterval.hasValue);
+//    EXPECT_EQ(2, curInterval.value.long_value);
+//
+//    // no change in first value field
+//    shared_ptr<LogEvent> event3 = make_shared<LogEvent>(tagId, bucket2StartTimeNs + 10);
+//    event3->write(1);
+//    event3->write(15);
+//    event3->write(25);
+//    event3->init();
+//    valueProducer.onMatchedLogEvent(1 /*log matcher index*/, *event3);
+//    EXPECT_EQ(1UL, valueProducer.mCurrentSlicedBucket.size());
+//    curInterval = valueProducer.mCurrentSlicedBucket.begin()->second[0];
+//    curBaseInfo = valueProducer.mCurrentBaseInfo.begin()->second[0];
+//
+//    EXPECT_EQ(true, curBaseInfo.hasBase);
+//    EXPECT_EQ(15, curBaseInfo.base.long_value);
+//    EXPECT_EQ(true, curInterval.hasValue);
+//    curInterval = valueProducer.mCurrentSlicedBucket.begin()->second[1];
+//    curBaseInfo = valueProducer.mCurrentBaseInfo.begin()->second[1];
+//    EXPECT_EQ(true, curBaseInfo.hasBase);
+//    EXPECT_EQ(25, curBaseInfo.base.long_value);
+//    EXPECT_EQ(true, curInterval.hasValue);
+//
+//    shared_ptr<LogEvent> event4 = make_shared<LogEvent>(tagId, bucket2StartTimeNs + 15);
+//    event4->write(1);
+//    event4->write(15);
+//    event4->write(29);
+//    event4->init();
+//    valueProducer.onMatchedLogEvent(1 /*log matcher index*/, *event4);
+//    EXPECT_EQ(1UL, valueProducer.mCurrentSlicedBucket.size());
+//    curInterval = valueProducer.mCurrentSlicedBucket.begin()->second[0];
+//    curBaseInfo = valueProducer.mCurrentBaseInfo.begin()->second[0];
+//    EXPECT_EQ(true, curBaseInfo.hasBase);
+//    EXPECT_EQ(15, curBaseInfo.base.long_value);
+//    EXPECT_EQ(true, curInterval.hasValue);
+//    curInterval = valueProducer.mCurrentSlicedBucket.begin()->second[1];
+//    curBaseInfo = valueProducer.mCurrentBaseInfo.begin()->second[1];
+//    EXPECT_EQ(true, curBaseInfo.hasBase);
+//    EXPECT_EQ(29, curBaseInfo.base.long_value);
+//    EXPECT_EQ(true, curInterval.hasValue);
+//
+//    valueProducer.flushIfNeededLocked(bucket3StartTimeNs);
+//
+//    EXPECT_EQ(1UL, valueProducer.mPastBuckets.size());
+//    EXPECT_EQ(2UL, valueProducer.mPastBuckets.begin()->second.size());
+//    EXPECT_EQ(2UL, valueProducer.mPastBuckets.begin()->second[0].values.size());
+//    EXPECT_EQ(1UL, valueProducer.mPastBuckets.begin()->second[1].values.size());
+//
+//    EXPECT_EQ(bucketSizeNs, valueProducer.mPastBuckets.begin()->second[0].mConditionTrueNs);
+//    EXPECT_EQ(5, valueProducer.mPastBuckets.begin()->second[0].values[0].long_value);
+//    EXPECT_EQ(0, valueProducer.mPastBuckets.begin()->second[0].valueIndex[0]);
+//    EXPECT_EQ(2, valueProducer.mPastBuckets.begin()->second[0].values[1].long_value);
+//    EXPECT_EQ(1, valueProducer.mPastBuckets.begin()->second[0].valueIndex[1]);
+//
+//    EXPECT_EQ(bucketSizeNs, valueProducer.mPastBuckets.begin()->second[1].mConditionTrueNs);
+//    EXPECT_EQ(3, valueProducer.mPastBuckets.begin()->second[1].values[0].long_value);
+//    EXPECT_EQ(1, valueProducer.mPastBuckets.begin()->second[1].valueIndex[0]);
+//}
+//
+///*
+// * Tests zero default base.
+// */
+//TEST(ValueMetricProducerTest, TestUseZeroDefaultBase) {
+//    ValueMetric metric = ValueMetricProducerTestHelper::createMetric();
+//    metric.mutable_dimensions_in_what()->set_field(tagId);
+//    metric.mutable_dimensions_in_what()->add_child()->set_field(1);
+//    metric.set_use_zero_default_base(true);
+//
+//    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
+//    EXPECT_CALL(*pullerManager, Pull(tagId, _))
+//            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
+//                data->clear();
+//                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucketStartTimeNs);
+//                event->write(1);
+//                event->write(3);
+//                event->init();
+//                data->push_back(event);
+//                return true;
+//            }));
+//
+//    sp<ValueMetricProducer> valueProducer =
+//            ValueMetricProducerTestHelper::createValueProducerNoConditions(pullerManager, metric);
+//
+//    EXPECT_EQ(1UL, valueProducer->mCurrentSlicedBucket.size());
+//    auto iter = valueProducer->mCurrentSlicedBucket.begin();
+//    auto& interval1 = iter->second[0];
+//    auto iterBase = valueProducer->mCurrentBaseInfo.begin();
+//    auto& baseInfo1 = iterBase->second[0];
+//    EXPECT_EQ(1, iter->first.getDimensionKeyInWhat().getValues()[0].mValue.int_value);
+//    EXPECT_EQ(true, baseInfo1.hasBase);
+//    EXPECT_EQ(3, baseInfo1.base.long_value);
+//    EXPECT_EQ(false, interval1.hasValue);
+//    EXPECT_EQ(true, valueProducer->mHasGlobalBase);
+//    EXPECT_EQ(0UL, valueProducer->mPastBuckets.size());
+//    vector<shared_ptr<LogEvent>> allData;
+//
+//    allData.clear();
+//    shared_ptr<LogEvent> event1 = make_shared<LogEvent>(tagId, bucket2StartTimeNs + 1);
+//    event1->write(2);
+//    event1->write(4);
+//    event1->init();
+//    shared_ptr<LogEvent> event2 = make_shared<LogEvent>(tagId, bucket2StartTimeNs + 1);
+//    event2->write(1);
+//    event2->write(11);
+//    event2->init();
+//    allData.push_back(event1);
+//    allData.push_back(event2);
+//
+//    valueProducer->onDataPulled(allData, /** succeed */ true, bucket2StartTimeNs);
+//    EXPECT_EQ(2UL, valueProducer->mCurrentSlicedBucket.size());
+//    EXPECT_EQ(true, baseInfo1.hasBase);
+//    EXPECT_EQ(11, baseInfo1.base.long_value);
+//    EXPECT_EQ(false, interval1.hasValue);
+//    EXPECT_EQ(8, interval1.value.long_value);
+//
+//    auto it = valueProducer->mCurrentSlicedBucket.begin();
+//    for (; it != valueProducer->mCurrentSlicedBucket.end(); it++) {
+//        if (it != iter) {
+//            break;
+//        }
+//    }
+//    auto itBase = valueProducer->mCurrentBaseInfo.begin();
+//    for (; itBase != valueProducer->mCurrentBaseInfo.end(); it++) {
+//        if (itBase != iterBase) {
+//            break;
+//        }
+//    }
+//    EXPECT_TRUE(it != iter);
+//    EXPECT_TRUE(itBase != iterBase);
+//    auto& interval2 = it->second[0];
+//    auto& baseInfo2 = itBase->second[0];
+//    EXPECT_EQ(2, it->first.getDimensionKeyInWhat().getValues()[0].mValue.int_value);
+//    EXPECT_EQ(true, baseInfo2.hasBase);
+//    EXPECT_EQ(4, baseInfo2.base.long_value);
+//    EXPECT_EQ(false, interval2.hasValue);
+//    EXPECT_EQ(4, interval2.value.long_value);
+//
+//    EXPECT_EQ(2UL, valueProducer->mPastBuckets.size());
+//    auto iterator = valueProducer->mPastBuckets.begin();
+//    EXPECT_EQ(bucketSizeNs, iterator->second[0].mConditionTrueNs);
+//    EXPECT_EQ(8, iterator->second[0].values[0].long_value);
+//    iterator++;
+//    EXPECT_EQ(bucketSizeNs, iterator->second[0].mConditionTrueNs);
+//    EXPECT_EQ(4, iterator->second[0].values[0].long_value);
+//}
+//
+///*
+// * Tests using zero default base with failed pull.
+// */
+//TEST(ValueMetricProducerTest, TestUseZeroDefaultBaseWithPullFailures) {
+//    ValueMetric metric = ValueMetricProducerTestHelper::createMetric();
+//    metric.mutable_dimensions_in_what()->set_field(tagId);
+//    metric.mutable_dimensions_in_what()->add_child()->set_field(1);
+//    metric.set_use_zero_default_base(true);
+//
+//    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
+//    EXPECT_CALL(*pullerManager, Pull(tagId, _))
+//            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
+//                data->clear();
+//                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucketStartTimeNs);
+//                event->write(1);
+//                event->write(3);
+//                event->init();
+//                data->push_back(event);
+//                return true;
+//            }));
+//
+//    sp<ValueMetricProducer> valueProducer =
+//            ValueMetricProducerTestHelper::createValueProducerNoConditions(pullerManager, metric);
+//
+//    EXPECT_EQ(1UL, valueProducer->mCurrentSlicedBucket.size());
+//    auto it = valueProducer->mCurrentSlicedBucket.begin();
+//    auto& interval1 = it->second[0];
+//    auto& baseInfo1 =
+//            valueProducer->mCurrentBaseInfo.find(it->first.getDimensionKeyInWhat())->second[0];
+//    EXPECT_EQ(1, it->first.getDimensionKeyInWhat().getValues()[0].mValue.int_value);
+//    EXPECT_EQ(true, baseInfo1.hasBase);
+//    EXPECT_EQ(3, baseInfo1.base.long_value);
+//    EXPECT_EQ(false, interval1.hasValue);
+//    EXPECT_EQ(true, valueProducer->mHasGlobalBase);
+//    EXPECT_EQ(0UL, valueProducer->mPastBuckets.size());
+//    vector<shared_ptr<LogEvent>> allData;
+//
+//    allData.clear();
+//    shared_ptr<LogEvent> event1 = make_shared<LogEvent>(tagId, bucket2StartTimeNs + 1);
+//    event1->write(2);
+//    event1->write(4);
+//    event1->init();
+//    shared_ptr<LogEvent> event2 = make_shared<LogEvent>(tagId, bucket2StartTimeNs + 1);
+//    event2->write(1);
+//    event2->write(11);
+//    event2->init();
+//    allData.push_back(event1);
+//    allData.push_back(event2);
+//
+//    valueProducer->onDataPulled(allData, /** succeed */ true, bucket2StartTimeNs);
+//    EXPECT_EQ(2UL, valueProducer->mCurrentSlicedBucket.size());
+//    EXPECT_EQ(true, baseInfo1.hasBase);
+//    EXPECT_EQ(11, baseInfo1.base.long_value);
+//    EXPECT_EQ(false, interval1.hasValue);
+//    EXPECT_EQ(8, interval1.value.long_value);
+//
+//    auto it2 = valueProducer->mCurrentSlicedBucket.begin();
+//    for (; it2 != valueProducer->mCurrentSlicedBucket.end(); it2++) {
+//        if (it2 != it) {
+//            break;
+//        }
+//    }
+//    // auto itBase = valueProducer->mCurrentBaseInfo.begin();
+//    // for (; itBase != valueProducer->mCurrentBaseInfo.end(); it++) {
+//    //     if (itBase != iterBase) {
+//    //         break;
+//    //     }
+//    // }
+//    EXPECT_TRUE(it2 != it);
+//    // EXPECT_TRUE(itBase != iterBase);
+//    auto& interval2 = it2->second[0];
+//    auto& baseInfo2 =
+//            valueProducer->mCurrentBaseInfo.find(it2->first.getDimensionKeyInWhat())->second[0];
+//    EXPECT_EQ(2, it2->first.getDimensionKeyInWhat().getValues()[0].mValue.int_value);
+//    EXPECT_EQ(true, baseInfo2.hasBase);
+//    EXPECT_EQ(4, baseInfo2.base.long_value);
+//    EXPECT_EQ(false, interval2.hasValue);
+//    EXPECT_EQ(4, interval2.value.long_value);
+//    EXPECT_EQ(2UL, valueProducer->mPastBuckets.size());
+//
+//    // next pull somehow did not happen, skip to end of bucket 3
+//    allData.clear();
+//    event1 = make_shared<LogEvent>(tagId, bucket4StartTimeNs + 1);
+//    event1->write(2);
+//    event1->write(5);
+//    event1->init();
+//    allData.push_back(event1);
+//    valueProducer->onDataPulled(allData, /** succeed */ true, bucket4StartTimeNs);
+//
+//    EXPECT_EQ(1UL, valueProducer->mCurrentSlicedBucket.size());
+//    EXPECT_EQ(true, baseInfo2.hasBase);
+//    EXPECT_EQ(5, baseInfo2.base.long_value);
+//    EXPECT_EQ(false, interval2.hasValue);
+//    EXPECT_EQ(true, valueProducer->mHasGlobalBase);
+//    EXPECT_EQ(2UL, valueProducer->mPastBuckets.size());
+//
+//    allData.clear();
+//    event1 = make_shared<LogEvent>(tagId, bucket5StartTimeNs + 1);
+//    event1->write(2);
+//    event1->write(13);
+//    event1->init();
+//    allData.push_back(event1);
+//    event2 = make_shared<LogEvent>(tagId, bucket5StartTimeNs + 1);
+//    event2->write(1);
+//    event2->write(5);
+//    event2->init();
+//    allData.push_back(event2);
+//    valueProducer->onDataPulled(allData, /** succeed */ true, bucket5StartTimeNs);
+//
+//    EXPECT_EQ(2UL, valueProducer->mCurrentSlicedBucket.size());
+//    it = valueProducer->mCurrentSlicedBucket.begin();
+//    it2 = std::next(valueProducer->mCurrentSlicedBucket.begin());
+//    interval1 = it->second[0];
+//    interval2 = it2->second[0];
+//    baseInfo1 = valueProducer->mCurrentBaseInfo.find(it->first.getDimensionKeyInWhat())->second[0];
+//    baseInfo2 = valueProducer->mCurrentBaseInfo.find(it2->first.getDimensionKeyInWhat())->second[0];
+//
+//    EXPECT_EQ(true, baseInfo1.hasBase);
+//    EXPECT_EQ(5, baseInfo1.base.long_value);
+//    EXPECT_EQ(false, interval1.hasValue);
+//    EXPECT_EQ(5, interval1.value.long_value);
+//    EXPECT_EQ(true, valueProducer->mHasGlobalBase);
+//
+//    EXPECT_EQ(true, baseInfo2.hasBase);
+//    EXPECT_EQ(13, baseInfo2.base.long_value);
+//    EXPECT_EQ(false, interval2.hasValue);
+//    EXPECT_EQ(8, interval2.value.long_value);
+//
+//    EXPECT_EQ(2UL, valueProducer->mPastBuckets.size());
+//}
+//
+///*
+// * Tests trim unused dimension key if no new data is seen in an entire bucket.
+// */
+//TEST(ValueMetricProducerTest, TestTrimUnusedDimensionKey) {
+//    ValueMetric metric = ValueMetricProducerTestHelper::createMetric();
+//    metric.mutable_dimensions_in_what()->set_field(tagId);
+//    metric.mutable_dimensions_in_what()->add_child()->set_field(1);
+//
+//    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
+//    EXPECT_CALL(*pullerManager, Pull(tagId, _))
+//            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
+//                data->clear();
+//                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucketStartTimeNs);
+//                event->write(1);
+//                event->write(3);
+//                event->init();
+//                data->push_back(event);
+//                return true;
+//            }));
+//
+//    sp<ValueMetricProducer> valueProducer =
+//            ValueMetricProducerTestHelper::createValueProducerNoConditions(pullerManager, metric);
+//
+//    EXPECT_EQ(1UL, valueProducer->mCurrentSlicedBucket.size());
+//    auto iter = valueProducer->mCurrentSlicedBucket.begin();
+//    auto& interval1 = iter->second[0];
+//    auto iterBase = valueProducer->mCurrentBaseInfo.begin();
+//    auto& baseInfo1 = iterBase->second[0];
+//    EXPECT_EQ(1, iter->first.getDimensionKeyInWhat().getValues()[0].mValue.int_value);
+//    EXPECT_EQ(true, baseInfo1.hasBase);
+//    EXPECT_EQ(3, baseInfo1.base.long_value);
+//    EXPECT_EQ(false, interval1.hasValue);
+//    EXPECT_EQ(0UL, valueProducer->mPastBuckets.size());
+//    vector<shared_ptr<LogEvent>> allData;
+//
+//    allData.clear();
+//    shared_ptr<LogEvent> event1 = make_shared<LogEvent>(tagId, bucket2StartTimeNs + 1);
+//    event1->write(2);
+//    event1->write(4);
+//    event1->init();
+//    shared_ptr<LogEvent> event2 = make_shared<LogEvent>(tagId, bucket2StartTimeNs + 1);
+//    event2->write(1);
+//    event2->write(11);
+//    event2->init();
+//    allData.push_back(event1);
+//    allData.push_back(event2);
+//
+//    valueProducer->onDataPulled(allData, /** succeed */ true, bucket2StartTimeNs);
+//    EXPECT_EQ(2UL, valueProducer->mCurrentSlicedBucket.size());
+//    EXPECT_EQ(true, baseInfo1.hasBase);
+//    EXPECT_EQ(11, baseInfo1.base.long_value);
+//    EXPECT_EQ(false, interval1.hasValue);
+//    EXPECT_EQ(8, interval1.value.long_value);
+//    EXPECT_FALSE(interval1.seenNewData);
+//    assertPastBucketValuesSingleKey(valueProducer->mPastBuckets, {8}, {bucketSizeNs});
+//
+//    auto it = valueProducer->mCurrentSlicedBucket.begin();
+//    for (; it != valueProducer->mCurrentSlicedBucket.end(); it++) {
+//        if (it != iter) {
+//            break;
+//        }
+//    }
+//    auto itBase = valueProducer->mCurrentBaseInfo.begin();
+//    for (; itBase != valueProducer->mCurrentBaseInfo.end(); it++) {
+//        if (itBase != iterBase) {
+//            break;
+//        }
+//    }
+//    EXPECT_TRUE(it != iter);
+//    EXPECT_TRUE(itBase != iterBase);
+//    auto& interval2 = it->second[0];
+//    auto& baseInfo2 = itBase->second[0];
+//    EXPECT_EQ(2, it->first.getDimensionKeyInWhat().getValues()[0].mValue.int_value);
+//    EXPECT_EQ(true, baseInfo2.hasBase);
+//    EXPECT_EQ(4, baseInfo2.base.long_value);
+//    EXPECT_EQ(false, interval2.hasValue);
+//    EXPECT_FALSE(interval2.seenNewData);
+//    assertPastBucketValuesSingleKey(valueProducer->mPastBuckets, {8}, {bucketSizeNs});
+//
+//    // next pull somehow did not happen, skip to end of bucket 3
+//    allData.clear();
+//    event1 = make_shared<LogEvent>(tagId, bucket4StartTimeNs + 1);
+//    event1->write(2);
+//    event1->write(5);
+//    event1->init();
+//    allData.push_back(event1);
+//    valueProducer->onDataPulled(allData, /** succeed */ true, bucket4StartTimeNs);
+//    // Only one interval left. One was trimmed.
+//    EXPECT_EQ(1UL, valueProducer->mCurrentSlicedBucket.size());
+//    interval2 = valueProducer->mCurrentSlicedBucket.begin()->second[0];
+//    baseInfo2 = valueProducer->mCurrentBaseInfo.begin()->second[0];
+//    EXPECT_EQ(2, it->first.getDimensionKeyInWhat().getValues()[0].mValue.int_value);
+//    EXPECT_EQ(true, baseInfo2.hasBase);
+//    EXPECT_EQ(5, baseInfo2.base.long_value);
+//    EXPECT_EQ(false, interval2.hasValue);
+//    EXPECT_FALSE(interval2.seenNewData);
+//    assertPastBucketValuesSingleKey(valueProducer->mPastBuckets, {8}, {bucketSizeNs});
+//
+//    allData.clear();
+//    event1 = make_shared<LogEvent>(tagId, bucket5StartTimeNs + 1);
+//    event1->write(2);
+//    event1->write(14);
+//    event1->init();
+//    allData.push_back(event1);
+//    valueProducer->onDataPulled(allData, /** succeed */ true, bucket5StartTimeNs);
+//
+//    interval2 = valueProducer->mCurrentSlicedBucket.begin()->second[0];
+//    baseInfo2 = valueProducer->mCurrentBaseInfo.begin()->second[0];
+//    EXPECT_EQ(true, baseInfo2.hasBase);
+//    EXPECT_EQ(14, baseInfo2.base.long_value);
+//    EXPECT_EQ(false, interval2.hasValue);
+//    EXPECT_FALSE(interval2.seenNewData);
+//    ASSERT_EQ(2UL, valueProducer->mPastBuckets.size());
+//    auto iterator = valueProducer->mPastBuckets.begin();
+//    EXPECT_EQ(9, iterator->second[0].values[0].long_value);
+//    EXPECT_EQ(bucketSizeNs, iterator->second[0].mConditionTrueNs);
+//    iterator++;
+//    EXPECT_EQ(8, iterator->second[0].values[0].long_value);
+//    EXPECT_EQ(bucketSizeNs, iterator->second[0].mConditionTrueNs);
+//}
+//
+//TEST(ValueMetricProducerTest, TestResetBaseOnPullFailAfterConditionChange_EndOfBucket) {
+//    ValueMetric metric = ValueMetricProducerTestHelper::createMetricWithCondition();
+//
+//    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
+//    // Used by onConditionChanged.
+//    EXPECT_CALL(*pullerManager, Pull(tagId, _))
+//            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
+//                data->clear();
+//                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucketStartTimeNs + 8);
+//                event->write(tagId);
+//                event->write(100);
+//                event->init();
+//                data->push_back(event);
+//                return true;
+//            }));
+//
+//    sp<ValueMetricProducer> valueProducer =
+//            ValueMetricProducerTestHelper::createValueProducerWithCondition(pullerManager, metric);
+//
+//    valueProducer->onConditionChanged(true, bucketStartTimeNs + 8);
+//    // has one slice
+//    EXPECT_EQ(1UL, valueProducer->mCurrentSlicedBucket.size());
+//    ValueMetricProducer::Interval& curInterval =
+//            valueProducer->mCurrentSlicedBucket.begin()->second[0];
+//    ValueMetricProducer::BaseInfo& curBaseInfo = valueProducer->mCurrentBaseInfo.begin()->second[0];
+//    EXPECT_EQ(true, curBaseInfo.hasBase);
+//    EXPECT_EQ(100, curBaseInfo.base.long_value);
+//    EXPECT_EQ(false, curInterval.hasValue);
+//
+//    vector<shared_ptr<LogEvent>> allData;
+//    valueProducer->onDataPulled(allData, /** succeed */ false, bucket2StartTimeNs);
+//    EXPECT_EQ(1UL, valueProducer->mCurrentSlicedBucket.size());
+//    EXPECT_EQ(false, curBaseInfo.hasBase);
+//    EXPECT_EQ(false, curInterval.hasValue);
+//    EXPECT_EQ(false, valueProducer->mHasGlobalBase);
+//}
+//
+//TEST(ValueMetricProducerTest, TestResetBaseOnPullFailAfterConditionChange) {
+//    ValueMetric metric = ValueMetricProducerTestHelper::createMetricWithCondition();
+//
+//    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
+//    EXPECT_CALL(*pullerManager, Pull(tagId, _))
+//            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
+//                data->clear();
+//                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucketStartTimeNs + 8);
+//                event->write(tagId);
+//                event->write(100);
+//                event->init();
+//                data->push_back(event);
+//                return true;
+//            }))
+//            .WillOnce(Return(false));
+//
+//    sp<ValueMetricProducer> valueProducer =
+//            ValueMetricProducerTestHelper::createValueProducerWithCondition(pullerManager, metric);
+//
+//    valueProducer->onConditionChanged(true, bucketStartTimeNs + 8);
+//
+//    // has one slice
+//    EXPECT_EQ(1UL, valueProducer->mCurrentSlicedBucket.size());
+//    ValueMetricProducer::Interval& curInterval =
+//            valueProducer->mCurrentSlicedBucket.begin()->second[0];
+//    ValueMetricProducer::BaseInfo& curBaseInfo = valueProducer->mCurrentBaseInfo.begin()->second[0];
+//    EXPECT_EQ(true, curBaseInfo.hasBase);
+//    EXPECT_EQ(100, curBaseInfo.base.long_value);
+//    EXPECT_EQ(false, curInterval.hasValue);
+//    EXPECT_EQ(0UL, valueProducer->mPastBuckets.size());
+//
+//    valueProducer->onConditionChanged(false, bucketStartTimeNs + 20);
+//
+//    // has one slice
+//    EXPECT_EQ(1UL, valueProducer->mCurrentSlicedBucket.size());
+//    EXPECT_EQ(false, curInterval.hasValue);
+//    EXPECT_EQ(false, curBaseInfo.hasBase);
+//    EXPECT_EQ(false, valueProducer->mHasGlobalBase);
+//}
+//
+//TEST(ValueMetricProducerTest, TestResetBaseOnPullFailBeforeConditionChange) {
+//    ValueMetric metric = ValueMetricProducerTestHelper::createMetricWithCondition();
+//
+//    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
+//    EXPECT_CALL(*pullerManager, Pull(tagId, _))
+//            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
+//                data->clear();
+//                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucketStartTimeNs);
+//                event->write(tagId);
+//                event->write(50);
+//                event->init();
+//                data->push_back(event);
+//                return false;
+//            }))
+//            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
+//                data->clear();
+//                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucketStartTimeNs + 8);
+//                event->write(tagId);
+//                event->write(100);
+//                event->init();
+//                data->push_back(event);
+//                return true;
+//            }));
+//
+//    sp<ValueMetricProducer> valueProducer =
+//            ValueMetricProducerTestHelper::createValueProducerWithCondition(pullerManager, metric);
+//
+//    // Don't directly set mCondition; the real code never does that. Go through regular code path
+//    // to avoid unexpected behaviors.
+//    // valueProducer->mCondition = ConditionState::kTrue;
+//    valueProducer->onConditionChanged(true, bucketStartTimeNs);
+//
+//    EXPECT_EQ(0UL, valueProducer->mCurrentSlicedBucket.size());
+//
+//    valueProducer->onConditionChanged(false, bucketStartTimeNs + 1);
+//    EXPECT_EQ(1UL, valueProducer->mCurrentSlicedBucket.size());
+//    ValueMetricProducer::Interval& curInterval =
+//            valueProducer->mCurrentSlicedBucket.begin()->second[0];
+//    ValueMetricProducer::BaseInfo curBaseInfo = valueProducer->mCurrentBaseInfo.begin()->second[0];
+//    EXPECT_EQ(false, curBaseInfo.hasBase);
+//    EXPECT_EQ(false, curInterval.hasValue);
+//    EXPECT_EQ(false, valueProducer->mHasGlobalBase);
+//}
+//
+//TEST(ValueMetricProducerTest, TestResetBaseOnPullDelayExceeded) {
+//    ValueMetric metric = ValueMetricProducerTestHelper::createMetric();
+//    metric.set_condition(StringToId("SCREEN_ON"));
+//    metric.set_max_pull_delay_sec(0);
+//
+//    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
+//    EXPECT_CALL(*pullerManager, Pull(tagId, _))
+//            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
+//                data->clear();
+//                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucketStartTimeNs + 1);
+//                event->write(tagId);
+//                event->write(120);
+//                event->init();
+//                data->push_back(event);
+//                return true;
+//            }));
+//
+//    sp<ValueMetricProducer> valueProducer =
+//            ValueMetricProducerTestHelper::createValueProducerWithCondition(pullerManager, metric);
+//
+//    valueProducer->mCondition = ConditionState::kFalse;
+//
+//    // Max delay is set to 0 so pull will exceed max delay.
+//    valueProducer->onConditionChanged(true, bucketStartTimeNs + 1);
+//    EXPECT_EQ(0UL, valueProducer->mCurrentSlicedBucket.size());
+//}
+//
+//TEST(ValueMetricProducerTest, TestResetBaseOnPullTooLate) {
+//    ValueMetric metric = ValueMetricProducerTestHelper::createMetricWithCondition();
+//
+//    UidMap uidMap;
+//    SimpleAtomMatcher atomMatcher;
+//    atomMatcher.set_atom_id(tagId);
+//    sp<EventMatcherWizard> eventMatcherWizard =
+//            new EventMatcherWizard({new SimpleLogMatchingTracker(
+//                    atomMatcherId, logEventMatcherIndex, atomMatcher, uidMap)});
+//    sp<MockConditionWizard> wizard = new NaggyMock<MockConditionWizard>();
+//    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
+//    EXPECT_CALL(*pullerManager, RegisterReceiver(tagId, _, _, _)).WillOnce(Return());
+//    EXPECT_CALL(*pullerManager, UnRegisterReceiver(tagId, _)).WillRepeatedly(Return());
+//
+//    ValueMetricProducer valueProducer(kConfigKey, metric, 1, wizard, logEventMatcherIndex,
+//                                      eventMatcherWizard, tagId, bucket2StartTimeNs,
+//                                      bucket2StartTimeNs, pullerManager);
+//    valueProducer.mCondition = ConditionState::kFalse;
+//
+//    // Event should be skipped since it is from previous bucket.
+//    // Pull should not be called.
+//    valueProducer.onConditionChanged(true, bucketStartTimeNs);
+//    EXPECT_EQ(0UL, valueProducer.mCurrentSlicedBucket.size());
+//}
+//
+//TEST(ValueMetricProducerTest, TestBaseSetOnConditionChange) {
+//    ValueMetric metric = ValueMetricProducerTestHelper::createMetricWithCondition();
+//
+//    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
+//    EXPECT_CALL(*pullerManager, Pull(tagId, _))
+//            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
+//                data->clear();
+//                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucketStartTimeNs + 1);
+//                event->write(tagId);
+//                event->write(100);
+//                event->init();
+//                data->push_back(event);
+//                return true;
+//            }));
+//
+//    sp<ValueMetricProducer> valueProducer =
+//            ValueMetricProducerTestHelper::createValueProducerWithCondition(pullerManager, metric);
+//
+//    valueProducer->mCondition = ConditionState::kFalse;
+//    valueProducer->mHasGlobalBase = false;
+//
+//    valueProducer->onConditionChanged(true, bucketStartTimeNs + 1);
+//    valueProducer->mHasGlobalBase = true;
+//    EXPECT_EQ(1UL, valueProducer->mCurrentSlicedBucket.size());
+//    ValueMetricProducer::Interval& curInterval =
+//            valueProducer->mCurrentSlicedBucket.begin()->second[0];
+//    ValueMetricProducer::BaseInfo curBaseInfo = valueProducer->mCurrentBaseInfo.begin()->second[0];
+//    EXPECT_EQ(true, curBaseInfo.hasBase);
+//    EXPECT_EQ(100, curBaseInfo.base.long_value);
+//    EXPECT_EQ(false, curInterval.hasValue);
+//    EXPECT_EQ(true, valueProducer->mHasGlobalBase);
+//}
+//
+///*
+// * Tests that a bucket is marked invalid when a condition change pull fails.
+// */
+//TEST(ValueMetricProducerTest_BucketDrop, TestInvalidBucketWhenOneConditionFailed) {
+//    ValueMetric metric = ValueMetricProducerTestHelper::createMetricWithCondition();
+//
+//    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
+//    EXPECT_CALL(*pullerManager, Pull(tagId, _))
+//            // First onConditionChanged
+//            .WillOnce(Return(false))
+//            // Second onConditionChanged
+//            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
+//                data->clear();
+//                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucketStartTimeNs + 8);
+//                event->write(tagId);
+//                event->write(130);
+//                event->init();
+//                data->push_back(event);
+//                return true;
+//            }));
+//
+//    sp<ValueMetricProducer> valueProducer =
+//            ValueMetricProducerTestHelper::createValueProducerWithCondition(pullerManager, metric);
+//
+//    valueProducer->mCondition = ConditionState::kTrue;
+//
+//    // Bucket start.
+//    vector<shared_ptr<LogEvent>> allData;
+//    allData.clear();
+//    shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucketStartTimeNs + 1);
+//    event->write(1);
+//    event->write(110);
+//    event->init();
+//    allData.push_back(event);
+//    valueProducer->onDataPulled(allData, /** succeed */ true, bucketStartTimeNs);
+//
+//    // This will fail and should invalidate the whole bucket since we do not have all the data
+//    // needed to compute the metric value when the screen was on.
+//    valueProducer->onConditionChanged(false, bucketStartTimeNs + 2);
+//    valueProducer->onConditionChanged(true, bucketStartTimeNs + 3);
+//
+//    // Bucket end.
+//    allData.clear();
+//    shared_ptr<LogEvent> event2 = make_shared<LogEvent>(tagId, bucket2StartTimeNs + 1);
+//    event2->write(1);
+//    event2->write(140);
+//    event2->init();
+//    allData.push_back(event2);
+//    valueProducer->onDataPulled(allData, /** succeed */ true, bucket2StartTimeNs);
+//
+//    valueProducer->flushIfNeededLocked(bucket2StartTimeNs + 1);
+//
+//    EXPECT_EQ(0UL, valueProducer->mPastBuckets.size());
+//    // Contains base from last pull which was successful.
+//    EXPECT_EQ(1UL, valueProducer->mCurrentSlicedBucket.size());
+//    ValueMetricProducer::Interval& curInterval =
+//            valueProducer->mCurrentSlicedBucket.begin()->second[0];
+//    ValueMetricProducer::BaseInfo curBaseInfo = valueProducer->mCurrentBaseInfo.begin()->second[0];
+//    EXPECT_EQ(true, curBaseInfo.hasBase);
+//    EXPECT_EQ(140, curBaseInfo.base.long_value);
+//    EXPECT_EQ(false, curInterval.hasValue);
+//    EXPECT_EQ(true, valueProducer->mHasGlobalBase);
+//
+//    // Check dump report.
+//    ProtoOutputStream output;
+//    std::set<string> strSet;
+//    valueProducer->onDumpReport(bucket2StartTimeNs + 10, false /* include partial bucket */, true,
+//                                FAST /* dumpLatency */, &strSet, &output);
+//
+//    StatsLogReport report = outputStreamToProto(&output);
+//    EXPECT_TRUE(report.has_value_metrics());
+//    EXPECT_EQ(0, report.value_metrics().data_size());
+//    EXPECT_EQ(1, report.value_metrics().skipped_size());
+//
+//    EXPECT_EQ(NanoToMillis(bucketStartTimeNs),
+//              report.value_metrics().skipped(0).start_bucket_elapsed_millis());
+//    EXPECT_EQ(NanoToMillis(bucket2StartTimeNs),
+//              report.value_metrics().skipped(0).end_bucket_elapsed_millis());
+//    EXPECT_EQ(1, report.value_metrics().skipped(0).drop_event_size());
+//
+//    auto dropEvent = report.value_metrics().skipped(0).drop_event(0);
+//    EXPECT_EQ(BucketDropReason::PULL_FAILED, dropEvent.drop_reason());
+//    EXPECT_EQ(NanoToMillis(bucketStartTimeNs + 2), dropEvent.drop_time_millis());
+//}
+//
+///*
+// * Tests that a bucket is marked invalid when the guardrail is hit.
+// */
+//TEST(ValueMetricProducerTest_BucketDrop, TestInvalidBucketWhenGuardRailHit) {
+//    ValueMetric metric = ValueMetricProducerTestHelper::createMetric();
+//    metric.mutable_dimensions_in_what()->set_field(tagId);
+//    metric.mutable_dimensions_in_what()->add_child()->set_field(1);
+//    metric.set_condition(StringToId("SCREEN_ON"));
+//
+//    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
+//    EXPECT_CALL(*pullerManager, Pull(tagId, _))
+//            // First onConditionChanged
+//            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
+//                for (int i = 0; i < 2000; i++) {
+//                    shared_ptr<LogEvent> event =
+//                            make_shared<LogEvent>(tagId, bucketStartTimeNs + 1);
+//                    event->write(i);
+//                    event->write(i);
+//                    event->init();
+//                    data->push_back(event);
+//                }
+//                return true;
+//            }));
+//
+//    sp<ValueMetricProducer> valueProducer =
+//            ValueMetricProducerTestHelper::createValueProducerWithCondition(pullerManager, metric);
+//    valueProducer->mCondition = ConditionState::kFalse;
+//
+//    valueProducer->onConditionChanged(true, bucketStartTimeNs + 2);
+//    EXPECT_EQ(true, valueProducer->mCurrentBucketIsInvalid);
+//    EXPECT_EQ(0UL, valueProducer->mCurrentSlicedBucket.size());
+//    EXPECT_EQ(0UL, valueProducer->mSkippedBuckets.size());
+//
+//    // Bucket 2 start.
+//    vector<shared_ptr<LogEvent>> allData;
+//    allData.clear();
+//    shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucket2StartTimeNs + 1);
+//    event->write(1);
+//    event->write(10);
+//    event->init();
+//    allData.push_back(event);
+//    valueProducer->onDataPulled(allData, /** succeed */ true, bucket2StartTimeNs);
+//
+//    // First bucket added to mSkippedBuckets after flush.
+//    EXPECT_EQ(1UL, valueProducer->mSkippedBuckets.size());
+//
+//    // Check dump report.
+//    ProtoOutputStream output;
+//    std::set<string> strSet;
+//    valueProducer->onDumpReport(bucket2StartTimeNs + 10000, false /* include recent buckets */,
+//                                true, FAST /* dumpLatency */, &strSet, &output);
+//
+//    StatsLogReport report = outputStreamToProto(&output);
+//    EXPECT_TRUE(report.has_value_metrics());
+//    EXPECT_EQ(0, report.value_metrics().data_size());
+//    EXPECT_EQ(1, report.value_metrics().skipped_size());
+//
+//    EXPECT_EQ(NanoToMillis(bucketStartTimeNs),
+//              report.value_metrics().skipped(0).start_bucket_elapsed_millis());
+//    EXPECT_EQ(NanoToMillis(bucket2StartTimeNs),
+//              report.value_metrics().skipped(0).end_bucket_elapsed_millis());
+//    EXPECT_EQ(1, report.value_metrics().skipped(0).drop_event_size());
+//
+//    auto dropEvent = report.value_metrics().skipped(0).drop_event(0);
+//    EXPECT_EQ(BucketDropReason::DIMENSION_GUARDRAIL_REACHED, dropEvent.drop_reason());
+//    EXPECT_EQ(NanoToMillis(bucketStartTimeNs + 2), dropEvent.drop_time_millis());
+//}
+//
+///*
+// * Tests that a bucket is marked invalid when the bucket's initial pull fails.
+// */
+//TEST(ValueMetricProducerTest_BucketDrop, TestInvalidBucketWhenInitialPullFailed) {
+//    ValueMetric metric = ValueMetricProducerTestHelper::createMetricWithCondition();
+//
+//    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
+//    EXPECT_CALL(*pullerManager, Pull(tagId, _))
+//            // First onConditionChanged
+//            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
+//                data->clear();
+//                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucketStartTimeNs + 8);
+//                event->write(tagId);
+//                event->write(120);
+//                event->init();
+//                data->push_back(event);
+//                return true;
+//            }))
+//            // Second onConditionChanged
+//            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
+//                data->clear();
+//                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucketStartTimeNs + 8);
+//                event->write(tagId);
+//                event->write(130);
+//                event->init();
+//                data->push_back(event);
+//                return true;
+//            }));
+//
+//    sp<ValueMetricProducer> valueProducer =
+//            ValueMetricProducerTestHelper::createValueProducerWithCondition(pullerManager, metric);
+//
+//    valueProducer->mCondition = ConditionState::kTrue;
+//
+//    // Bucket start.
+//    vector<shared_ptr<LogEvent>> allData;
+//    allData.clear();
+//    shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucketStartTimeNs + 1);
+//    event->write(1);
+//    event->write(110);
+//    event->init();
+//    allData.push_back(event);
+//    valueProducer->onDataPulled(allData, /** succeed */ false, bucketStartTimeNs);
+//
+//    valueProducer->onConditionChanged(false, bucketStartTimeNs + 2);
+//    valueProducer->onConditionChanged(true, bucketStartTimeNs + 3);
+//
+//    // Bucket end.
+//    allData.clear();
+//    shared_ptr<LogEvent> event2 = make_shared<LogEvent>(tagId, bucket2StartTimeNs + 1);
+//    event2->write(1);
+//    event2->write(140);
+//    event2->init();
+//    allData.push_back(event2);
+//    valueProducer->onDataPulled(allData, /** succeed */ true, bucket2StartTimeNs);
+//
+//    valueProducer->flushIfNeededLocked(bucket2StartTimeNs + 1);
+//
+//    EXPECT_EQ(0UL, valueProducer->mPastBuckets.size());
+//    // Contains base from last pull which was successful.
+//    EXPECT_EQ(1UL, valueProducer->mCurrentSlicedBucket.size());
+//    ValueMetricProducer::Interval& curInterval =
+//            valueProducer->mCurrentSlicedBucket.begin()->second[0];
+//    ValueMetricProducer::BaseInfo curBaseInfo = valueProducer->mCurrentBaseInfo.begin()->second[0];
+//    EXPECT_EQ(true, curBaseInfo.hasBase);
+//    EXPECT_EQ(140, curBaseInfo.base.long_value);
+//    EXPECT_EQ(false, curInterval.hasValue);
+//    EXPECT_EQ(true, valueProducer->mHasGlobalBase);
+//
+//    // Check dump report.
+//    ProtoOutputStream output;
+//    std::set<string> strSet;
+//    valueProducer->onDumpReport(bucket2StartTimeNs + 10000, false /* include recent buckets */,
+//                                true, FAST /* dumpLatency */, &strSet, &output);
+//
+//    StatsLogReport report = outputStreamToProto(&output);
+//    EXPECT_TRUE(report.has_value_metrics());
+//    EXPECT_EQ(0, report.value_metrics().data_size());
+//    EXPECT_EQ(1, report.value_metrics().skipped_size());
+//
+//    EXPECT_EQ(NanoToMillis(bucketStartTimeNs),
+//              report.value_metrics().skipped(0).start_bucket_elapsed_millis());
+//    EXPECT_EQ(NanoToMillis(bucket2StartTimeNs),
+//              report.value_metrics().skipped(0).end_bucket_elapsed_millis());
+//    EXPECT_EQ(1, report.value_metrics().skipped(0).drop_event_size());
+//
+//    auto dropEvent = report.value_metrics().skipped(0).drop_event(0);
+//    EXPECT_EQ(BucketDropReason::PULL_FAILED, dropEvent.drop_reason());
+//    EXPECT_EQ(NanoToMillis(bucketStartTimeNs + 2), dropEvent.drop_time_millis());
+//}
+//
+///*
+// * Tests that a bucket is marked invalid when the bucket's final pull fails
+// * (i.e. failed pull on bucket boundary).
+// */
+//TEST(ValueMetricProducerTest_BucketDrop, TestInvalidBucketWhenLastPullFailed) {
+//    ValueMetric metric = ValueMetricProducerTestHelper::createMetricWithCondition();
+//
+//    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
+//    EXPECT_CALL(*pullerManager, Pull(tagId, _))
+//            // First onConditionChanged
+//            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
+//                data->clear();
+//                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucketStartTimeNs + 8);
+//                event->write(tagId);
+//                event->write(120);
+//                event->init();
+//                data->push_back(event);
+//                return true;
+//            }))
+//            // Second onConditionChanged
+//            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
+//                data->clear();
+//                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucketStartTimeNs + 8);
+//                event->write(tagId);
+//                event->write(130);
+//                event->init();
+//                data->push_back(event);
+//                return true;
+//            }));
+//
+//    sp<ValueMetricProducer> valueProducer =
+//            ValueMetricProducerTestHelper::createValueProducerWithCondition(pullerManager, metric);
+//
+//    valueProducer->mCondition = ConditionState::kTrue;
+//
+//    // Bucket start.
+//    vector<shared_ptr<LogEvent>> allData;
+//    allData.clear();
+//    shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucketStartTimeNs + 1);
+//    event->write(1);
+//    event->write(110);
+//    event->init();
+//    allData.push_back(event);
+//    valueProducer->onDataPulled(allData, /** succeed */ true, bucketStartTimeNs);
+//
+//    valueProducer->onConditionChanged(false, bucketStartTimeNs + 2);
+//    valueProducer->onConditionChanged(true, bucketStartTimeNs + 3);
+//
+//    // Bucket end.
+//    allData.clear();
+//    shared_ptr<LogEvent> event2 = make_shared<LogEvent>(tagId, bucket2StartTimeNs + 1);
+//    event2->write(1);
+//    event2->write(140);
+//    event2->init();
+//    allData.push_back(event2);
+//    valueProducer->onDataPulled(allData, /** succeed */ false, bucket2StartTimeNs);
+//
+//    valueProducer->flushIfNeededLocked(bucket2StartTimeNs + 1);
+//
+//    EXPECT_EQ(0UL, valueProducer->mPastBuckets.size());
+//    // Last pull failed so base has been reset.
+//    EXPECT_EQ(1UL, valueProducer->mCurrentSlicedBucket.size());
+//    ValueMetricProducer::Interval& curInterval =
+//            valueProducer->mCurrentSlicedBucket.begin()->second[0];
+//    ValueMetricProducer::BaseInfo curBaseInfo = valueProducer->mCurrentBaseInfo.begin()->second[0];
+//    EXPECT_EQ(false, curBaseInfo.hasBase);
+//    EXPECT_EQ(false, curInterval.hasValue);
+//    EXPECT_EQ(false, valueProducer->mHasGlobalBase);
+//
+//    // Check dump report.
+//    ProtoOutputStream output;
+//    std::set<string> strSet;
+//    valueProducer->onDumpReport(bucket2StartTimeNs + 10000, false /* include recent buckets */,
+//                                true, FAST /* dumpLatency */, &strSet, &output);
+//
+//    StatsLogReport report = outputStreamToProto(&output);
+//    EXPECT_TRUE(report.has_value_metrics());
+//    EXPECT_EQ(0, report.value_metrics().data_size());
+//    EXPECT_EQ(1, report.value_metrics().skipped_size());
+//
+//    EXPECT_EQ(NanoToMillis(bucketStartTimeNs),
+//              report.value_metrics().skipped(0).start_bucket_elapsed_millis());
+//    EXPECT_EQ(NanoToMillis(bucket2StartTimeNs),
+//              report.value_metrics().skipped(0).end_bucket_elapsed_millis());
+//    EXPECT_EQ(1, report.value_metrics().skipped(0).drop_event_size());
+//
+//    auto dropEvent = report.value_metrics().skipped(0).drop_event(0);
+//    EXPECT_EQ(BucketDropReason::PULL_FAILED, dropEvent.drop_reason());
+//    EXPECT_EQ(NanoToMillis(bucket2StartTimeNs), dropEvent.drop_time_millis());
+//}
+//
+//TEST(ValueMetricProducerTest, TestEmptyDataResetsBase_onDataPulled) {
+//    ValueMetric metric = ValueMetricProducerTestHelper::createMetric();
+//    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
+//    EXPECT_CALL(*pullerManager, Pull(tagId, _))
+//            // Start bucket.
+//            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
+//                data->clear();
+//                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucketStartTimeNs);
+//                event->write(tagId);
+//                event->write(3);
+//                event->init();
+//                data->push_back(event);
+//                return true;
+//            }));
+//
+//    sp<ValueMetricProducer> valueProducer =
+//            ValueMetricProducerTestHelper::createValueProducerNoConditions(pullerManager, metric);
+//
+//    // Bucket 2 start.
+//    vector<shared_ptr<LogEvent>> allData;
+//    allData.clear();
+//    shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucket2StartTimeNs + 1);
+//    event->write(tagId);
+//    event->write(110);
+//    event->init();
+//    allData.push_back(event);
+//    valueProducer->onDataPulled(allData, /** succeed */ true, bucket2StartTimeNs);
+//    EXPECT_EQ(1UL, valueProducer->mCurrentSlicedBucket.size());
+//    EXPECT_EQ(1UL, valueProducer->mPastBuckets.size());
+//
+//    // Bucket 3 empty.
+//    allData.clear();
+//    shared_ptr<LogEvent> event2 = make_shared<LogEvent>(tagId, bucket3StartTimeNs + 1);
+//    event2->init();
+//    allData.push_back(event2);
+//    valueProducer->onDataPulled(allData, /** succeed */ true, bucket3StartTimeNs);
+//    // Data has been trimmed.
+//    EXPECT_EQ(0UL, valueProducer->mCurrentSlicedBucket.size());
+//    EXPECT_EQ(1UL, valueProducer->mPastBuckets.size());
+//}
+//
+//TEST(ValueMetricProducerTest, TestEmptyDataResetsBase_onConditionChanged) {
+//    ValueMetric metric = ValueMetricProducerTestHelper::createMetricWithCondition();
+//
+//    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
+//    EXPECT_CALL(*pullerManager, Pull(tagId, _))
+//            // First onConditionChanged
+//            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
+//                data->clear();
+//                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucketStartTimeNs);
+//                event->write(tagId);
+//                event->write(3);
+//                event->init();
+//                data->push_back(event);
+//                return true;
+//            }))
+//            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
+//                data->clear();
+//                return true;
+//            }));
+//
+//    sp<ValueMetricProducer> valueProducer =
+//            ValueMetricProducerTestHelper::createValueProducerWithCondition(pullerManager, metric);
+//
+//    valueProducer->onConditionChanged(true, bucketStartTimeNs + 10);
+//    EXPECT_EQ(1UL, valueProducer->mCurrentSlicedBucket.size());
+//    ValueMetricProducer::Interval& curInterval =
+//            valueProducer->mCurrentSlicedBucket.begin()->second[0];
+//    ValueMetricProducer::BaseInfo curBaseInfo = valueProducer->mCurrentBaseInfo.begin()->second[0];
+//    EXPECT_EQ(true, curBaseInfo.hasBase);
+//    EXPECT_EQ(false, curInterval.hasValue);
+//    EXPECT_EQ(true, valueProducer->mHasGlobalBase);
+//
+//    // Empty pull.
+//    valueProducer->onConditionChanged(false, bucketStartTimeNs + 10);
+//    EXPECT_EQ(1UL, valueProducer->mCurrentSlicedBucket.size());
+//    curInterval = valueProducer->mCurrentSlicedBucket.begin()->second[0];
+//    curBaseInfo = valueProducer->mCurrentBaseInfo.begin()->second[0];
+//    EXPECT_EQ(false, curBaseInfo.hasBase);
+//    EXPECT_EQ(false, curInterval.hasValue);
+//    EXPECT_EQ(false, valueProducer->mHasGlobalBase);
+//}
+//
+//TEST(ValueMetricProducerTest, TestEmptyDataResetsBase_onBucketBoundary) {
+//    ValueMetric metric = ValueMetricProducerTestHelper::createMetricWithCondition();
+//
+//    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
+//    EXPECT_CALL(*pullerManager, Pull(tagId, _))
+//            // First onConditionChanged
+//            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
+//                data->clear();
+//                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucketStartTimeNs);
+//                event->write(tagId);
+//                event->write(1);
+//                event->init();
+//                data->push_back(event);
+//                return true;
+//            }))
+//            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
+//                data->clear();
+//                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucketStartTimeNs);
+//                event->write(tagId);
+//                event->write(2);
+//                event->init();
+//                data->push_back(event);
+//                return true;
+//            }))
+//            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
+//                data->clear();
+//                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucketStartTimeNs);
+//                event->write(tagId);
+//                event->write(5);
+//                event->init();
+//                data->push_back(event);
+//                return true;
+//            }));
+//
+//    sp<ValueMetricProducer> valueProducer =
+//            ValueMetricProducerTestHelper::createValueProducerWithCondition(pullerManager, metric);
+//
+//    valueProducer->onConditionChanged(true, bucketStartTimeNs + 10);
+//    valueProducer->onConditionChanged(false, bucketStartTimeNs + 11);
+//    valueProducer->onConditionChanged(true, bucketStartTimeNs + 12);
+//    EXPECT_EQ(1UL, valueProducer->mCurrentSlicedBucket.size());
+//    ValueMetricProducer::Interval& curInterval =
+//            valueProducer->mCurrentSlicedBucket.begin()->second[0];
+//    ValueMetricProducer::BaseInfo curBaseInfo = valueProducer->mCurrentBaseInfo.begin()->second[0];
+//    EXPECT_EQ(true, curBaseInfo.hasBase);
+//    EXPECT_EQ(true, curInterval.hasValue);
+//    EXPECT_EQ(true, valueProducer->mHasGlobalBase);
+//
+//    // End of bucket
+//    vector<shared_ptr<LogEvent>> allData;
+//    allData.clear();
+//    valueProducer->onDataPulled(allData, /** succeed */ true, bucket2StartTimeNs);
+//    EXPECT_EQ(1UL, valueProducer->mCurrentSlicedBucket.size());
+//    curInterval = valueProducer->mCurrentSlicedBucket.begin()->second[0];
+//    curBaseInfo = valueProducer->mCurrentBaseInfo.begin()->second[0];
+//    // Data is empty, base should be reset.
+//    EXPECT_EQ(false, curBaseInfo.hasBase);
+//    EXPECT_EQ(5, curBaseInfo.base.long_value);
+//    EXPECT_EQ(false, curInterval.hasValue);
+//    EXPECT_EQ(true, valueProducer->mHasGlobalBase);
+//
+//    EXPECT_EQ(1UL, valueProducer->mPastBuckets.size());
+//    assertPastBucketValuesSingleKey(valueProducer->mPastBuckets, {1}, {bucketSizeNs - 12 + 1});
+//}
+//
+//TEST(ValueMetricProducerTest, TestPartialResetOnBucketBoundaries) {
+//    ValueMetric metric = ValueMetricProducerTestHelper::createMetric();
+//    metric.mutable_dimensions_in_what()->set_field(tagId);
+//    metric.mutable_dimensions_in_what()->add_child()->set_field(1);
+//    metric.set_condition(StringToId("SCREEN_ON"));
+//
+//    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
+//    EXPECT_CALL(*pullerManager, Pull(tagId, _))
+//            // First onConditionChanged
+//            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
+//                data->clear();
+//                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucketStartTimeNs);
+//                event->write(tagId);
+//                event->write(1);
+//                event->write(1);
+//                event->init();
+//                data->push_back(event);
+//                return true;
+//            }));
+//
+//    sp<ValueMetricProducer> valueProducer =
+//            ValueMetricProducerTestHelper::createValueProducerWithCondition(pullerManager, metric);
+//
+//    valueProducer->onConditionChanged(true, bucketStartTimeNs + 10);
+//    EXPECT_EQ(1UL, valueProducer->mCurrentSlicedBucket.size());
+//
+//    // End of bucket
+//    vector<shared_ptr<LogEvent>> allData;
+//    allData.clear();
+//    shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucket2StartTimeNs + 1);
+//    event->write(2);
+//    event->write(2);
+//    event->init();
+//    allData.push_back(event);
+//    valueProducer->onDataPulled(allData, /** succeed */ true, bucket2StartTimeNs);
+//
+//    // Key 1 should be reset since in not present in the most pull.
+//    EXPECT_EQ(2UL, valueProducer->mCurrentSlicedBucket.size());
+//    auto iterator = valueProducer->mCurrentSlicedBucket.begin();
+//    auto baseInfoIter = valueProducer->mCurrentBaseInfo.begin();
+//    EXPECT_EQ(true, baseInfoIter->second[0].hasBase);
+//    EXPECT_EQ(2, baseInfoIter->second[0].base.long_value);
+//    EXPECT_EQ(false, iterator->second[0].hasValue);
+//    iterator++;
+//    baseInfoIter++;
+//    EXPECT_EQ(false, baseInfoIter->second[0].hasBase);
+//    EXPECT_EQ(1, baseInfoIter->second[0].base.long_value);
+//    EXPECT_EQ(false, iterator->second[0].hasValue);
+//
+//    EXPECT_EQ(true, valueProducer->mHasGlobalBase);
+//}
+//
+//TEST(ValueMetricProducerTest, TestFullBucketResetWhenLastBucketInvalid) {
+//    ValueMetric metric = ValueMetricProducerTestHelper::createMetric();
+//
+//    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
+//    EXPECT_CALL(*pullerManager, Pull(tagId, _))
+//            // Initialization.
+//            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
+//                data->clear();
+//                data->push_back(ValueMetricProducerTestHelper::createEvent(bucketStartTimeNs, 1));
+//                return true;
+//            }))
+//            // notifyAppUpgrade.
+//            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
+//                data->clear();
+//                data->push_back(ValueMetricProducerTestHelper::createEvent(
+//                        bucketStartTimeNs + bucketSizeNs / 2, 10));
+//                return true;
+//            }));
+//    sp<ValueMetricProducer> valueProducer =
+//            ValueMetricProducerTestHelper::createValueProducerNoConditions(pullerManager, metric);
+//    ASSERT_EQ(0UL, valueProducer->mCurrentFullBucket.size());
+//
+//    valueProducer->notifyAppUpgrade(bucketStartTimeNs + bucketSizeNs / 2, "com.foo", 10000, 1);
+//    ASSERT_EQ(1UL, valueProducer->mCurrentFullBucket.size());
+//
+//    vector<shared_ptr<LogEvent>> allData;
+//    allData.push_back(ValueMetricProducerTestHelper::createEvent(bucket3StartTimeNs + 1, 4));
+//    valueProducer->onDataPulled(allData, /** fails */ false, bucket3StartTimeNs + 1);
+//    ASSERT_EQ(0UL, valueProducer->mCurrentFullBucket.size());
+//}
+//
+//TEST(ValueMetricProducerTest, TestBucketBoundariesOnConditionChange) {
+//    ValueMetric metric = ValueMetricProducerTestHelper::createMetricWithCondition();
+//    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
+//    EXPECT_CALL(*pullerManager, Pull(tagId, _))
+//            // Second onConditionChanged.
+//            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
+//                data->clear();
+//                data->push_back(
+//                        ValueMetricProducerTestHelper::createEvent(bucket2StartTimeNs + 10, 5));
+//                return true;
+//            }))
+//            // Third onConditionChanged.
+//            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
+//                data->clear();
+//                data->push_back(
+//                        ValueMetricProducerTestHelper::createEvent(bucket3StartTimeNs + 10, 7));
+//                return true;
+//            }));
+//
+//    sp<ValueMetricProducer> valueProducer =
+//            ValueMetricProducerTestHelper::createValueProducerWithCondition(pullerManager, metric);
+//    valueProducer->mCondition = ConditionState::kUnknown;
+//
+//    valueProducer->onConditionChanged(false, bucketStartTimeNs);
+//    ASSERT_EQ(0UL, valueProducer->mCurrentSlicedBucket.size());
+//
+//    // End of first bucket
+//    vector<shared_ptr<LogEvent>> allData;
+//    allData.push_back(ValueMetricProducerTestHelper::createEvent(bucket2StartTimeNs + 1, 4));
+//    valueProducer->onDataPulled(allData, /** succeed */ true, bucket2StartTimeNs + 1);
+//    ASSERT_EQ(0UL, valueProducer->mCurrentSlicedBucket.size());
+//
+//    valueProducer->onConditionChanged(true, bucket2StartTimeNs + 10);
+//    ASSERT_EQ(1UL, valueProducer->mCurrentSlicedBucket.size());
+//    auto curInterval = valueProducer->mCurrentSlicedBucket.begin()->second[0];
+//    auto curBaseInfo = valueProducer->mCurrentBaseInfo.begin()->second[0];
+//    EXPECT_EQ(true, curBaseInfo.hasBase);
+//    EXPECT_EQ(5, curBaseInfo.base.long_value);
+//    EXPECT_EQ(false, curInterval.hasValue);
+//
+//    valueProducer->onConditionChanged(false, bucket3StartTimeNs + 10);
+//
+//    // Bucket should have been completed.
+//    assertPastBucketValuesSingleKey(valueProducer->mPastBuckets, {2}, {bucketSizeNs - 10});
+//}
+//
+//TEST(ValueMetricProducerTest, TestLateOnDataPulledWithoutDiff) {
+//    ValueMetric metric = ValueMetricProducerTestHelper::createMetric();
+//    metric.set_use_diff(false);
+//
+//    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
+//    sp<ValueMetricProducer> valueProducer =
+//            ValueMetricProducerTestHelper::createValueProducerNoConditions(pullerManager, metric);
+//
+//    vector<shared_ptr<LogEvent>> allData;
+//    allData.push_back(ValueMetricProducerTestHelper::createEvent(bucketStartTimeNs + 30, 10));
+//    valueProducer->onDataPulled(allData, /** succeed */ true, bucketStartTimeNs + 30);
+//
+//    allData.clear();
+//    allData.push_back(ValueMetricProducerTestHelper::createEvent(bucket2StartTimeNs, 20));
+//    valueProducer->onDataPulled(allData, /** succeed */ true, bucket2StartTimeNs);
+//
+//    // Bucket should have been completed.
+//    assertPastBucketValuesSingleKey(valueProducer->mPastBuckets, {30}, {bucketSizeNs});
+//}
+//
+//TEST(ValueMetricProducerTest, TestLateOnDataPulledWithDiff) {
+//    ValueMetric metric = ValueMetricProducerTestHelper::createMetric();
+//
+//    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
+//    EXPECT_CALL(*pullerManager, Pull(tagId, _))
+//            // Initialization.
+//            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
+//                data->clear();
+//                data->push_back(ValueMetricProducerTestHelper::createEvent(bucketStartTimeNs, 1));
+//                return true;
+//            }));
+//
+//    sp<ValueMetricProducer> valueProducer =
+//            ValueMetricProducerTestHelper::createValueProducerNoConditions(pullerManager, metric);
+//
+//    vector<shared_ptr<LogEvent>> allData;
+//    allData.push_back(ValueMetricProducerTestHelper::createEvent(bucketStartTimeNs + 30, 10));
+//    valueProducer->onDataPulled(allData, /** succeed */ true, bucketStartTimeNs + 30);
+//
+//    allData.clear();
+//    allData.push_back(ValueMetricProducerTestHelper::createEvent(bucket2StartTimeNs, 20));
+//    valueProducer->onDataPulled(allData, /** succeed */ true, bucket2StartTimeNs);
+//
+//    // Bucket should have been completed.
+//    assertPastBucketValuesSingleKey(valueProducer->mPastBuckets, {19}, {bucketSizeNs});
+//}
+//
+//TEST(ValueMetricProducerTest, TestBucketBoundariesOnAppUpgrade) {
+//    ValueMetric metric = ValueMetricProducerTestHelper::createMetric();
+//
+//    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
+//    EXPECT_CALL(*pullerManager, Pull(tagId, _))
+//            // Initialization.
+//            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
+//                data->clear();
+//                data->push_back(ValueMetricProducerTestHelper::createEvent(bucketStartTimeNs, 1));
+//                return true;
+//            }))
+//            // notifyAppUpgrade.
+//            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
+//                data->clear();
+//                data->push_back(
+//                        ValueMetricProducerTestHelper::createEvent(bucket2StartTimeNs + 2, 10));
+//                return true;
+//            }));
+//
+//    sp<ValueMetricProducer> valueProducer =
+//            ValueMetricProducerTestHelper::createValueProducerNoConditions(pullerManager, metric);
+//
+//    valueProducer->notifyAppUpgrade(bucket2StartTimeNs + 2, "com.foo", 10000, 1);
+//
+//    // Bucket should have been completed.
+//    assertPastBucketValuesSingleKey(valueProducer->mPastBuckets, {9}, {bucketSizeNs});
+//}
+//
+//TEST(ValueMetricProducerTest, TestDataIsNotUpdatedWhenNoConditionChanged) {
+//    ValueMetric metric = ValueMetricProducerTestHelper::createMetricWithCondition();
+//
+//    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
+//    EXPECT_CALL(*pullerManager, Pull(tagId, _))
+//            // First on condition changed.
+//            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
+//                data->clear();
+//                data->push_back(ValueMetricProducerTestHelper::createEvent(bucketStartTimeNs, 1));
+//                return true;
+//            }))
+//            // Second on condition changed.
+//            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
+//                data->clear();
+//                data->push_back(ValueMetricProducerTestHelper::createEvent(bucketStartTimeNs, 3));
+//                return true;
+//            }));
+//
+//    sp<ValueMetricProducer> valueProducer =
+//            ValueMetricProducerTestHelper::createValueProducerWithCondition(pullerManager, metric);
+//
+//    valueProducer->onConditionChanged(true, bucketStartTimeNs + 8);
+//    valueProducer->onConditionChanged(false, bucketStartTimeNs + 10);
+//    valueProducer->onConditionChanged(false, bucketStartTimeNs + 10);
+//
+//    EXPECT_EQ(1UL, valueProducer->mCurrentSlicedBucket.size());
+//    auto curInterval = valueProducer->mCurrentSlicedBucket.begin()->second[0];
+//    auto curBaseInfo = valueProducer->mCurrentBaseInfo.begin()->second[0];
+//    EXPECT_EQ(true, curInterval.hasValue);
+//    EXPECT_EQ(2, curInterval.value.long_value);
+//
+//    vector<shared_ptr<LogEvent>> allData;
+//    allData.push_back(ValueMetricProducerTestHelper::createEvent(bucket2StartTimeNs + 1, 10));
+//    valueProducer->onDataPulled(allData, /** succeed */ true, bucket2StartTimeNs + 1);
+//
+//    assertPastBucketValuesSingleKey(valueProducer->mPastBuckets, {2}, {2});
+//}
+//
+//// TODO: b/145705635 fix or delete this test
+//TEST(ValueMetricProducerTest, TestBucketInvalidIfGlobalBaseIsNotSet) {
+//    ValueMetric metric = ValueMetricProducerTestHelper::createMetricWithCondition();
+//
+//    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
+//    EXPECT_CALL(*pullerManager, Pull(tagId, _))
+//            // First condition change.
+//            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
+//                data->clear();
+//                data->push_back(ValueMetricProducerTestHelper::createEvent(bucketStartTimeNs, 1));
+//                return true;
+//            }))
+//            // 2nd condition change.
+//            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
+//                data->clear();
+//                data->push_back(ValueMetricProducerTestHelper::createEvent(bucket2StartTimeNs, 1));
+//                return true;
+//            }))
+//            // 3rd condition change.
+//            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
+//                data->clear();
+//                data->push_back(ValueMetricProducerTestHelper::createEvent(bucket2StartTimeNs, 1));
+//                return true;
+//            }));
+//
+//    sp<ValueMetricProducer> valueProducer =
+//            ValueMetricProducerTestHelper::createValueProducerWithCondition(pullerManager, metric);
+//    valueProducer->onConditionChanged(true, bucket2StartTimeNs + 10);
+//
+//    vector<shared_ptr<LogEvent>> allData;
+//    allData.push_back(ValueMetricProducerTestHelper::createEvent(bucketStartTimeNs + 3, 10));
+//    valueProducer->onDataPulled(allData, /** succeed */ false, bucketStartTimeNs + 3);
+//
+//    allData.clear();
+//    allData.push_back(ValueMetricProducerTestHelper::createEvent(bucket2StartTimeNs, 20));
+//    valueProducer->onDataPulled(allData, /** succeed */ false, bucket2StartTimeNs);
+//
+//    valueProducer->onConditionChanged(false, bucket2StartTimeNs + 8);
+//    valueProducer->onConditionChanged(true, bucket2StartTimeNs + 10);
+//
+//    allData.clear();
+//    allData.push_back(ValueMetricProducerTestHelper::createEvent(bucket3StartTimeNs, 30));
+//    valueProducer->onDataPulled(allData, /** succeed */ true, bucket2StartTimeNs);
+//
+//    // There was not global base available so all buckets are invalid.
+//    assertPastBucketValuesSingleKey(valueProducer->mPastBuckets, {}, {});
+//}
+//
+//TEST(ValueMetricProducerTest, TestPullNeededFastDump) {
+//    ValueMetric metric = ValueMetricProducerTestHelper::createMetric();
+//
+//    UidMap uidMap;
+//    SimpleAtomMatcher atomMatcher;
+//    atomMatcher.set_atom_id(tagId);
+//    sp<EventMatcherWizard> eventMatcherWizard =
+//            new EventMatcherWizard({new SimpleLogMatchingTracker(
+//                    atomMatcherId, logEventMatcherIndex, atomMatcher, uidMap)});
+//    sp<MockConditionWizard> wizard = new NaggyMock<MockConditionWizard>();
+//    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
+//    EXPECT_CALL(*pullerManager, RegisterReceiver(tagId, _, _, _)).WillOnce(Return());
+//    EXPECT_CALL(*pullerManager, UnRegisterReceiver(tagId, _)).WillRepeatedly(Return());
+//
+//    EXPECT_CALL(*pullerManager, Pull(tagId, _))
+//            // Initial pull.
+//            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
+//                data->clear();
+//                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucketStartTimeNs);
+//                event->write(tagId);
+//                event->write(1);
+//                event->write(1);
+//                event->init();
+//                data->push_back(event);
+//                return true;
+//            }));
+//
+//    ValueMetricProducer valueProducer(kConfigKey, metric, -1, wizard, logEventMatcherIndex,
+//                                      eventMatcherWizard, tagId, bucketStartTimeNs,
+//                                      bucketStartTimeNs, pullerManager);
+//
+//    ProtoOutputStream output;
+//    std::set<string> strSet;
+//    valueProducer.onDumpReport(bucketStartTimeNs + 10, true /* include recent buckets */, true,
+//                               FAST, &strSet, &output);
+//
+//    StatsLogReport report = outputStreamToProto(&output);
+//    // Bucket is invalid since we did not pull when dump report was called.
+//    EXPECT_EQ(0, report.value_metrics().data_size());
+//}
+//
+//TEST(ValueMetricProducerTest, TestFastDumpWithoutCurrentBucket) {
+//    ValueMetric metric = ValueMetricProducerTestHelper::createMetric();
+//
+//    UidMap uidMap;
+//    SimpleAtomMatcher atomMatcher;
+//    atomMatcher.set_atom_id(tagId);
+//    sp<EventMatcherWizard> eventMatcherWizard =
+//            new EventMatcherWizard({new SimpleLogMatchingTracker(
+//                    atomMatcherId, logEventMatcherIndex, atomMatcher, uidMap)});
+//    sp<MockConditionWizard> wizard = new NaggyMock<MockConditionWizard>();
+//    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
+//    EXPECT_CALL(*pullerManager, RegisterReceiver(tagId, _, _, _)).WillOnce(Return());
+//    EXPECT_CALL(*pullerManager, UnRegisterReceiver(tagId, _)).WillRepeatedly(Return());
+//
+//    EXPECT_CALL(*pullerManager, Pull(tagId, _))
+//            // Initial pull.
+//            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
+//                data->clear();
+//                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucketStartTimeNs);
+//                event->write(tagId);
+//                event->write(1);
+//                event->write(1);
+//                event->init();
+//                data->push_back(event);
+//                return true;
+//            }));
+//
+//    ValueMetricProducer valueProducer(kConfigKey, metric, -1, wizard, logEventMatcherIndex,
+//                                      eventMatcherWizard, tagId, bucketStartTimeNs,
+//                                      bucketStartTimeNs, pullerManager);
+//
+//    vector<shared_ptr<LogEvent>> allData;
+//    allData.clear();
+//    shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucket2StartTimeNs + 1);
+//    event->write(tagId);
+//    event->write(2);
+//    event->write(2);
+//    event->init();
+//    allData.push_back(event);
+//    valueProducer.onDataPulled(allData, /** succeed */ true, bucket2StartTimeNs);
+//
+//    ProtoOutputStream output;
+//    std::set<string> strSet;
+//    valueProducer.onDumpReport(bucket4StartTimeNs, false /* include recent buckets */, true, FAST,
+//                               &strSet, &output);
+//
+//    StatsLogReport report = outputStreamToProto(&output);
+//    // Previous bucket is part of the report.
+//    EXPECT_EQ(1, report.value_metrics().data_size());
+//    EXPECT_EQ(0, report.value_metrics().data(0).bucket_info(0).bucket_num());
+//}
+//
+//TEST(ValueMetricProducerTest, TestPullNeededNoTimeConstraints) {
+//    ValueMetric metric = ValueMetricProducerTestHelper::createMetric();
+//
+//    UidMap uidMap;
+//    SimpleAtomMatcher atomMatcher;
+//    atomMatcher.set_atom_id(tagId);
+//    sp<EventMatcherWizard> eventMatcherWizard =
+//            new EventMatcherWizard({new SimpleLogMatchingTracker(
+//                    atomMatcherId, logEventMatcherIndex, atomMatcher, uidMap)});
+//    sp<MockConditionWizard> wizard = new NaggyMock<MockConditionWizard>();
+//    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
+//    EXPECT_CALL(*pullerManager, RegisterReceiver(tagId, _, _, _)).WillOnce(Return());
+//    EXPECT_CALL(*pullerManager, UnRegisterReceiver(tagId, _)).WillRepeatedly(Return());
+//
+//    EXPECT_CALL(*pullerManager, Pull(tagId, _))
+//            // Initial pull.
+//            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
+//                data->clear();
+//                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucketStartTimeNs);
+//                event->write(tagId);
+//                event->write(1);
+//                event->write(1);
+//                event->init();
+//                data->push_back(event);
+//                return true;
+//            }))
+//            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
+//                data->clear();
+//                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucketStartTimeNs + 10);
+//                event->write(tagId);
+//                event->write(3);
+//                event->write(3);
+//                event->init();
+//                data->push_back(event);
+//                return true;
+//            }));
+//
+//    ValueMetricProducer valueProducer(kConfigKey, metric, -1, wizard, logEventMatcherIndex,
+//                                      eventMatcherWizard, tagId, bucketStartTimeNs,
+//                                      bucketStartTimeNs, pullerManager);
+//
+//    ProtoOutputStream output;
+//    std::set<string> strSet;
+//    valueProducer.onDumpReport(bucketStartTimeNs + 10, true /* include recent buckets */, true,
+//                               NO_TIME_CONSTRAINTS, &strSet, &output);
+//
+//    StatsLogReport report = outputStreamToProto(&output);
+//    EXPECT_EQ(1, report.value_metrics().data_size());
+//    EXPECT_EQ(1, report.value_metrics().data(0).bucket_info_size());
+//    EXPECT_EQ(2, report.value_metrics().data(0).bucket_info(0).values(0).value_long());
+//}
+//
+//TEST(ValueMetricProducerTest, TestPulledData_noDiff_withoutCondition) {
+//    ValueMetric metric = ValueMetricProducerTestHelper::createMetric();
+//    metric.set_use_diff(false);
+//
+//    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
+//    sp<ValueMetricProducer> valueProducer =
+//            ValueMetricProducerTestHelper::createValueProducerNoConditions(pullerManager, metric);
+//
+//    vector<shared_ptr<LogEvent>> allData;
+//    allData.push_back(ValueMetricProducerTestHelper::createEvent(bucket2StartTimeNs + 30, 10));
+//    valueProducer->onDataPulled(allData, /** succeed */ true, bucket2StartTimeNs + 30);
+//
+//    // Bucket should have been completed.
+//    assertPastBucketValuesSingleKey(valueProducer->mPastBuckets, {10}, {bucketSizeNs});
+//}
+//
+//TEST(ValueMetricProducerTest, TestPulledData_noDiff_withMultipleConditionChanges) {
+//    ValueMetric metric = ValueMetricProducerTestHelper::createMetricWithCondition();
+//    metric.set_use_diff(false);
+//
+//    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
+//    EXPECT_CALL(*pullerManager, Pull(tagId, _))
+//            // condition becomes true
+//            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
+//                data->clear();
+//                data->push_back(
+//                        ValueMetricProducerTestHelper::createEvent(bucketStartTimeNs + 30, 10));
+//                return true;
+//            }))
+//            // condition becomes false
+//            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
+//                data->clear();
+//                data->push_back(
+//                        ValueMetricProducerTestHelper::createEvent(bucketStartTimeNs + 50, 20));
+//                return true;
+//            }));
+//    sp<ValueMetricProducer> valueProducer =
+//            ValueMetricProducerTestHelper::createValueProducerWithCondition(pullerManager, metric);
+//    valueProducer->mCondition = ConditionState::kFalse;
+//
+//    valueProducer->onConditionChanged(true, bucketStartTimeNs + 8);
+//    valueProducer->onConditionChanged(false, bucketStartTimeNs + 50);
+//    // has one slice
+//    EXPECT_EQ(1UL, valueProducer->mCurrentSlicedBucket.size());
+//    ValueMetricProducer::Interval curInterval =
+//            valueProducer->mCurrentSlicedBucket.begin()->second[0];
+//    ValueMetricProducer::BaseInfo curBaseInfo = valueProducer->mCurrentBaseInfo.begin()->second[0];
+//    EXPECT_EQ(false, curBaseInfo.hasBase);
+//    EXPECT_EQ(true, curInterval.hasValue);
+//    EXPECT_EQ(20, curInterval.value.long_value);
+//
+//    // Now the alarm is delivered. Condition is off though.
+//    vector<shared_ptr<LogEvent>> allData;
+//    allData.push_back(ValueMetricProducerTestHelper::createEvent(bucket2StartTimeNs + 30, 110));
+//    valueProducer->onDataPulled(allData, /** succeed */ true, bucket2StartTimeNs);
+//
+//    assertPastBucketValuesSingleKey(valueProducer->mPastBuckets, {20}, {50 - 8});
+//    curInterval = valueProducer->mCurrentSlicedBucket.begin()->second[0];
+//    curBaseInfo = valueProducer->mCurrentBaseInfo.begin()->second[0];
+//    EXPECT_EQ(false, curBaseInfo.hasBase);
+//    EXPECT_EQ(false, curInterval.hasValue);
+//}
+//
+//TEST(ValueMetricProducerTest, TestPulledData_noDiff_bucketBoundaryTrue) {
+//    ValueMetric metric = ValueMetricProducerTestHelper::createMetricWithCondition();
+//    metric.set_use_diff(false);
+//
+//    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
+//    EXPECT_CALL(*pullerManager, Pull(tagId, _))
+//            // condition becomes true
+//            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
+//                data->clear();
+//                data->push_back(
+//                        ValueMetricProducerTestHelper::createEvent(bucketStartTimeNs + 30, 10));
+//                return true;
+//            }));
+//    sp<ValueMetricProducer> valueProducer =
+//            ValueMetricProducerTestHelper::createValueProducerWithCondition(pullerManager, metric);
+//    valueProducer->mCondition = ConditionState::kFalse;
+//
+//    valueProducer->onConditionChanged(true, bucketStartTimeNs + 8);
+//
+//    // Now the alarm is delivered. Condition is off though.
+//    vector<shared_ptr<LogEvent>> allData;
+//    allData.push_back(ValueMetricProducerTestHelper::createEvent(bucket2StartTimeNs + 30, 30));
+//    valueProducer->onDataPulled(allData, /** succeed */ true, bucket2StartTimeNs);
+//
+//    assertPastBucketValuesSingleKey(valueProducer->mPastBuckets, {30}, {bucketSizeNs - 8});
+//    ValueMetricProducer::Interval curInterval =
+//            valueProducer->mCurrentSlicedBucket.begin()->second[0];
+//    ValueMetricProducer::BaseInfo curBaseInfo = valueProducer->mCurrentBaseInfo.begin()->second[0];
+//    EXPECT_EQ(false, curBaseInfo.hasBase);
+//    EXPECT_EQ(false, curInterval.hasValue);
+//}
+//
+//TEST(ValueMetricProducerTest, TestPulledData_noDiff_bucketBoundaryFalse) {
+//    ValueMetric metric = ValueMetricProducerTestHelper::createMetricWithCondition();
+//    metric.set_use_diff(false);
+//
+//    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
+//    sp<ValueMetricProducer> valueProducer =
+//            ValueMetricProducerTestHelper::createValueProducerWithCondition(pullerManager, metric);
+//    valueProducer->mCondition = ConditionState::kFalse;
+//
+//    // Now the alarm is delivered. Condition is off though.
+//    vector<shared_ptr<LogEvent>> allData;
+//    allData.push_back(ValueMetricProducerTestHelper::createEvent(bucket2StartTimeNs + 30, 30));
+//    valueProducer->onDataPulled(allData, /** succeed */ true, bucket2StartTimeNs);
+//
+//    // Condition was always false.
+//    assertPastBucketValuesSingleKey(valueProducer->mPastBuckets, {}, {});
+//}
+//
+//TEST(ValueMetricProducerTest, TestPulledData_noDiff_withFailure) {
+//    ValueMetric metric = ValueMetricProducerTestHelper::createMetricWithCondition();
+//    metric.set_use_diff(false);
+//
+//    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
+//    EXPECT_CALL(*pullerManager, Pull(tagId, _))
+//            // condition becomes true
+//            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
+//                data->clear();
+//                data->push_back(
+//                        ValueMetricProducerTestHelper::createEvent(bucketStartTimeNs + 30, 10));
+//                return true;
+//            }))
+//            .WillOnce(Return(false));
+//    sp<ValueMetricProducer> valueProducer =
+//            ValueMetricProducerTestHelper::createValueProducerWithCondition(pullerManager, metric);
+//    valueProducer->mCondition = ConditionState::kFalse;
+//
+//    valueProducer->onConditionChanged(true, bucketStartTimeNs + 8);
+//    valueProducer->onConditionChanged(false, bucketStartTimeNs + 50);
+//
+//    // Now the alarm is delivered. Condition is off though.
+//    vector<shared_ptr<LogEvent>> allData;
+//    allData.push_back(ValueMetricProducerTestHelper::createEvent(bucket2StartTimeNs + 30, 30));
+//    valueProducer->onDataPulled(allData, /** succeed */ true, bucket2StartTimeNs);
+//
+//    // No buckets, we had a failure.
+//    assertPastBucketValuesSingleKey(valueProducer->mPastBuckets, {}, {});
+//}
+//
+///*
+// * Test that DUMP_REPORT_REQUESTED dump reason is logged.
+// *
+// * For the bucket to be marked invalid during a dump report requested,
+// * three things must be true:
+// * - we want to include the current partial bucket
+// * - we need a pull (metric is pulled and condition is true)
+// * - the dump latency must be FAST
+// */
+//
+//TEST(ValueMetricProducerTest_BucketDrop, TestInvalidBucketWhenDumpReportRequested) {
+//    ValueMetric metric = ValueMetricProducerTestHelper::createMetricWithCondition();
+//
+//    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
+//    EXPECT_CALL(*pullerManager, Pull(tagId, _))
+//            // Condition change to true.
+//            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
+//                data->clear();
+//                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucketStartTimeNs + 20);
+//                event->write("field1");
+//                event->write(10);
+//                event->init();
+//                data->push_back(event);
+//                return true;
+//            }));
+//
+//    sp<ValueMetricProducer> valueProducer =
+//            ValueMetricProducerTestHelper::createValueProducerWithCondition(pullerManager, metric);
+//
+//    // Condition change event.
+//    valueProducer->onConditionChanged(true, bucketStartTimeNs + 20);
+//
+//    // Check dump report.
+//    ProtoOutputStream output;
+//    std::set<string> strSet;
+//    valueProducer->onDumpReport(bucketStartTimeNs + 40, true /* include recent buckets */, true,
+//                                FAST /* dumpLatency */, &strSet, &output);
+//
+//    StatsLogReport report = outputStreamToProto(&output);
+//    EXPECT_TRUE(report.has_value_metrics());
+//    EXPECT_EQ(0, report.value_metrics().data_size());
+//    EXPECT_EQ(1, report.value_metrics().skipped_size());
+//
+//    EXPECT_EQ(NanoToMillis(bucketStartTimeNs),
+//              report.value_metrics().skipped(0).start_bucket_elapsed_millis());
+//    EXPECT_EQ(NanoToMillis(bucketStartTimeNs + 40),
+//              report.value_metrics().skipped(0).end_bucket_elapsed_millis());
+//    EXPECT_EQ(1, report.value_metrics().skipped(0).drop_event_size());
+//
+//    auto dropEvent = report.value_metrics().skipped(0).drop_event(0);
+//    EXPECT_EQ(BucketDropReason::DUMP_REPORT_REQUESTED, dropEvent.drop_reason());
+//    EXPECT_EQ(NanoToMillis(bucketStartTimeNs + 40), dropEvent.drop_time_millis());
+//}
+//
+///*
+// * Test that EVENT_IN_WRONG_BUCKET dump reason is logged for a late condition
+// * change event (i.e. the condition change occurs in the wrong bucket).
+// */
+//TEST(ValueMetricProducerTest_BucketDrop, TestInvalidBucketWhenConditionEventWrongBucket) {
+//    ValueMetric metric = ValueMetricProducerTestHelper::createMetricWithCondition();
+//
+//    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
+//    EXPECT_CALL(*pullerManager, Pull(tagId, _))
+//            // Condition change to true.
+//            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
+//                data->clear();
+//                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucketStartTimeNs + 50);
+//                event->write("field1");
+//                event->write(10);
+//                event->init();
+//                data->push_back(event);
+//                return true;
+//            }));
+//
+//    sp<ValueMetricProducer> valueProducer =
+//            ValueMetricProducerTestHelper::createValueProducerWithCondition(pullerManager, metric);
+//
+//    // Condition change event.
+//    valueProducer->onConditionChanged(true, bucketStartTimeNs + 50);
+//
+//    // Bucket boundary pull.
+//    vector<shared_ptr<LogEvent>> allData;
+//    shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucket2StartTimeNs);
+//    event->write("field1");
+//    event->write(15);
+//    event->init();
+//    allData.push_back(event);
+//    valueProducer->onDataPulled(allData, /** succeeds */ true, bucket2StartTimeNs + 1);
+//
+//    // Late condition change event.
+//    valueProducer->onConditionChanged(false, bucket2StartTimeNs - 100);
+//
+//    // Check dump report.
+//    ProtoOutputStream output;
+//    std::set<string> strSet;
+//    valueProducer->onDumpReport(bucket2StartTimeNs + 100, true /* include recent buckets */, true,
+//                                NO_TIME_CONSTRAINTS /* dumpLatency */, &strSet, &output);
+//
+//    StatsLogReport report = outputStreamToProto(&output);
+//    EXPECT_TRUE(report.has_value_metrics());
+//    EXPECT_EQ(1, report.value_metrics().data_size());
+//    EXPECT_EQ(1, report.value_metrics().skipped_size());
+//
+//    EXPECT_EQ(NanoToMillis(bucket2StartTimeNs),
+//              report.value_metrics().skipped(0).start_bucket_elapsed_millis());
+//    EXPECT_EQ(NanoToMillis(bucket2StartTimeNs + 100),
+//              report.value_metrics().skipped(0).end_bucket_elapsed_millis());
+//    EXPECT_EQ(1, report.value_metrics().skipped(0).drop_event_size());
+//
+//    auto dropEvent = report.value_metrics().skipped(0).drop_event(0);
+//    EXPECT_EQ(BucketDropReason::EVENT_IN_WRONG_BUCKET, dropEvent.drop_reason());
+//    EXPECT_EQ(NanoToMillis(bucket2StartTimeNs - 100), dropEvent.drop_time_millis());
+//}
+//
+///*
+// * Test that EVENT_IN_WRONG_BUCKET dump reason is logged for a late accumulate
+// * event (i.e. the accumulate events call occurs in the wrong bucket).
+// */
+//TEST(ValueMetricProducerTest_BucketDrop, TestInvalidBucketWhenAccumulateEventWrongBucket) {
+//    ValueMetric metric = ValueMetricProducerTestHelper::createMetricWithCondition();
+//
+//    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
+//    EXPECT_CALL(*pullerManager, Pull(tagId, _))
+//            // Condition change to true.
+//            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
+//                data->clear();
+//                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucketStartTimeNs + 50);
+//                event->write("field1");
+//                event->write(10);
+//                event->init();
+//                data->push_back(event);
+//                return true;
+//            }))
+//            // Dump report requested.
+//            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
+//                data->clear();
+//                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucket2StartTimeNs + 100);
+//                event->write("field1");
+//                event->write(15);
+//                event->init();
+//                data->push_back(event);
+//                return true;
+//            }));
+//
+//    sp<ValueMetricProducer> valueProducer =
+//            ValueMetricProducerTestHelper::createValueProducerWithCondition(pullerManager, metric);
+//
+//    // Condition change event.
+//    valueProducer->onConditionChanged(true, bucketStartTimeNs + 50);
+//
+//    // Bucket boundary pull.
+//    vector<shared_ptr<LogEvent>> allData;
+//    shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucket2StartTimeNs);
+//    event->write("field1");
+//    event->write(15);
+//    event->init();
+//    allData.push_back(event);
+//    valueProducer->onDataPulled(allData, /** succeeds */ true, bucket2StartTimeNs + 1);
+//
+//    allData.clear();
+//    event = make_shared<LogEvent>(tagId, bucket2StartTimeNs - 100);
+//    event->write("field1");
+//    event->write(20);
+//    event->init();
+//    allData.push_back(event);
+//
+//    // Late accumulateEvents event.
+//    valueProducer->accumulateEvents(allData, bucket2StartTimeNs - 100, bucket2StartTimeNs - 100);
+//
+//    // Check dump report.
+//    ProtoOutputStream output;
+//    std::set<string> strSet;
+//    valueProducer->onDumpReport(bucket2StartTimeNs + 100, true /* include recent buckets */, true,
+//                                NO_TIME_CONSTRAINTS /* dumpLatency */, &strSet, &output);
+//
+//    StatsLogReport report = outputStreamToProto(&output);
+//    EXPECT_TRUE(report.has_value_metrics());
+//    EXPECT_EQ(1, report.value_metrics().data_size());
+//    EXPECT_EQ(1, report.value_metrics().skipped_size());
+//
+//    EXPECT_EQ(NanoToMillis(bucket2StartTimeNs),
+//              report.value_metrics().skipped(0).start_bucket_elapsed_millis());
+//    EXPECT_EQ(NanoToMillis(bucket2StartTimeNs + 100),
+//              report.value_metrics().skipped(0).end_bucket_elapsed_millis());
+//    EXPECT_EQ(1, report.value_metrics().skipped(0).drop_event_size());
+//
+//    auto dropEvent = report.value_metrics().skipped(0).drop_event(0);
+//    EXPECT_EQ(BucketDropReason::EVENT_IN_WRONG_BUCKET, dropEvent.drop_reason());
+//    EXPECT_EQ(NanoToMillis(bucket2StartTimeNs - 100), dropEvent.drop_time_millis());
+//}
+//
+///*
+// * Test that CONDITION_UNKNOWN dump reason is logged due to an unknown condition
+// * when a metric is initialized.
+// */
+//TEST(ValueMetricProducerTest_BucketDrop, TestInvalidBucketWhenConditionUnknown) {
+//    ValueMetric metric = ValueMetricProducerTestHelper::createMetricWithCondition();
+//
+//    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
+//    EXPECT_CALL(*pullerManager, Pull(tagId, _))
+//            // Condition change to true.
+//            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
+//                data->clear();
+//                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucketStartTimeNs + 50);
+//                event->write("field1");
+//                event->write(10);
+//                event->init();
+//                data->push_back(event);
+//                return true;
+//            }))
+//            // Dump report requested.
+//            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
+//                data->clear();
+//                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucketStartTimeNs + 100);
+//                event->write("field1");
+//                event->write(15);
+//                event->init();
+//                data->push_back(event);
+//                return true;
+//            }));
+//
+//    sp<ValueMetricProducer> valueProducer =
+//            ValueMetricProducerTestHelper::createValueProducerWithNoInitialCondition(pullerManager,
+//                                                                                     metric);
+//
+//    // Condition change event.
+//    valueProducer->onConditionChanged(true, bucketStartTimeNs + 50);
+//
+//    // Check dump report.
+//    ProtoOutputStream output;
+//    std::set<string> strSet;
+//    int64_t dumpReportTimeNs = bucketStartTimeNs + 10000;
+//    valueProducer->onDumpReport(dumpReportTimeNs, true /* include recent buckets */, true,
+//                                NO_TIME_CONSTRAINTS /* dumpLatency */, &strSet, &output);
+//
+//    StatsLogReport report = outputStreamToProto(&output);
+//    EXPECT_TRUE(report.has_value_metrics());
+//    EXPECT_EQ(0, report.value_metrics().data_size());
+//    EXPECT_EQ(1, report.value_metrics().skipped_size());
+//
+//    EXPECT_EQ(NanoToMillis(bucketStartTimeNs),
+//              report.value_metrics().skipped(0).start_bucket_elapsed_millis());
+//    EXPECT_EQ(NanoToMillis(dumpReportTimeNs),
+//              report.value_metrics().skipped(0).end_bucket_elapsed_millis());
+//    EXPECT_EQ(1, report.value_metrics().skipped(0).drop_event_size());
+//
+//    auto dropEvent = report.value_metrics().skipped(0).drop_event(0);
+//    EXPECT_EQ(BucketDropReason::CONDITION_UNKNOWN, dropEvent.drop_reason());
+//    EXPECT_EQ(NanoToMillis(dumpReportTimeNs), dropEvent.drop_time_millis());
+//}
+//
+///*
+// * Test that PULL_FAILED dump reason is logged due to a pull failure in
+// * #pullAndMatchEventsLocked.
+// */
+//TEST(ValueMetricProducerTest_BucketDrop, TestInvalidBucketWhenPullFailed) {
+//    ValueMetric metric = ValueMetricProducerTestHelper::createMetricWithCondition();
+//
+//    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
+//    EXPECT_CALL(*pullerManager, Pull(tagId, _))
+//            // Condition change to true.
+//            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
+//                data->clear();
+//                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucketStartTimeNs + 50);
+//                event->write("field1");
+//                event->write(10);
+//                event->init();
+//                data->push_back(event);
+//                return true;
+//            }))
+//            // Dump report requested, pull fails.
+//            .WillOnce(Return(false));
+//
+//    sp<ValueMetricProducer> valueProducer =
+//            ValueMetricProducerTestHelper::createValueProducerWithCondition(pullerManager, metric);
+//
+//    // Condition change event.
+//    valueProducer->onConditionChanged(true, bucketStartTimeNs + 50);
+//
+//    // Check dump report.
+//    ProtoOutputStream output;
+//    std::set<string> strSet;
+//    int64_t dumpReportTimeNs = bucketStartTimeNs + 10000;
+//    valueProducer->onDumpReport(dumpReportTimeNs, true /* include recent buckets */, true,
+//                                NO_TIME_CONSTRAINTS /* dumpLatency */, &strSet, &output);
+//
+//    StatsLogReport report = outputStreamToProto(&output);
+//    EXPECT_TRUE(report.has_value_metrics());
+//    EXPECT_EQ(0, report.value_metrics().data_size());
+//    EXPECT_EQ(1, report.value_metrics().skipped_size());
+//
+//    EXPECT_EQ(NanoToMillis(bucketStartTimeNs),
+//              report.value_metrics().skipped(0).start_bucket_elapsed_millis());
+//    EXPECT_EQ(NanoToMillis(dumpReportTimeNs),
+//              report.value_metrics().skipped(0).end_bucket_elapsed_millis());
+//    EXPECT_EQ(1, report.value_metrics().skipped(0).drop_event_size());
+//
+//    auto dropEvent = report.value_metrics().skipped(0).drop_event(0);
+//    EXPECT_EQ(BucketDropReason::PULL_FAILED, dropEvent.drop_reason());
+//    EXPECT_EQ(NanoToMillis(dumpReportTimeNs), dropEvent.drop_time_millis());
+//}
+//
+///*
+// * Test that MULTIPLE_BUCKETS_SKIPPED dump reason is logged when a log event
+// * skips over more than one bucket.
+// */
+//TEST(ValueMetricProducerTest_BucketDrop, TestInvalidBucketWhenMultipleBucketsSkipped) {
+//    ValueMetric metric = ValueMetricProducerTestHelper::createMetricWithCondition();
+//
+//    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
+//    EXPECT_CALL(*pullerManager, Pull(tagId, _))
+//            // Condition change to true.
+//            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
+//                data->clear();
+//                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucketStartTimeNs + 10);
+//                event->write("field1");
+//                event->write(10);
+//                event->init();
+//                data->push_back(event);
+//                return true;
+//            }))
+//            // Dump report requested.
+//            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
+//                data->clear();
+//                shared_ptr<LogEvent> event =
+//                        make_shared<LogEvent>(tagId, bucket4StartTimeNs + 1000);
+//                event->write("field1");
+//                event->write(15);
+//                event->init();
+//                data->push_back(event);
+//                return true;
+//            }));
+//
+//    sp<ValueMetricProducer> valueProducer =
+//            ValueMetricProducerTestHelper::createValueProducerWithCondition(pullerManager, metric);
+//
+//    // Condition change event.
+//    valueProducer->onConditionChanged(true, bucketStartTimeNs + 10);
+//
+//    // Condition change event that skips forward by three buckets.
+//    valueProducer->onConditionChanged(false, bucket4StartTimeNs + 10);
+//
+//    // Check dump report.
+//    ProtoOutputStream output;
+//    std::set<string> strSet;
+//    valueProducer->onDumpReport(bucket4StartTimeNs + 1000, true /* include recent buckets */, true,
+//                                NO_TIME_CONSTRAINTS /* dumpLatency */, &strSet, &output);
+//
+//    StatsLogReport report = outputStreamToProto(&output);
+//    EXPECT_TRUE(report.has_value_metrics());
+//    EXPECT_EQ(0, report.value_metrics().data_size());
+//    EXPECT_EQ(1, report.value_metrics().skipped_size());
+//
+//    EXPECT_EQ(NanoToMillis(bucketStartTimeNs),
+//              report.value_metrics().skipped(0).start_bucket_elapsed_millis());
+//    EXPECT_EQ(NanoToMillis(bucket2StartTimeNs),
+//              report.value_metrics().skipped(0).end_bucket_elapsed_millis());
+//    EXPECT_EQ(1, report.value_metrics().skipped(0).drop_event_size());
+//
+//    auto dropEvent = report.value_metrics().skipped(0).drop_event(0);
+//    EXPECT_EQ(BucketDropReason::MULTIPLE_BUCKETS_SKIPPED, dropEvent.drop_reason());
+//    EXPECT_EQ(NanoToMillis(bucket4StartTimeNs + 10), dropEvent.drop_time_millis());
+//}
+//
+///*
+// * Test that BUCKET_TOO_SMALL dump reason is logged when a flushed bucket size
+// * is smaller than the "min_bucket_size_nanos" specified in the metric config.
+// */
+//TEST(ValueMetricProducerTest_BucketDrop, TestBucketDropWhenBucketTooSmall) {
+//    ValueMetric metric = ValueMetricProducerTestHelper::createMetricWithCondition();
+//    metric.set_min_bucket_size_nanos(10000000000);  // 10 seconds
+//
+//    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
+//    EXPECT_CALL(*pullerManager, Pull(tagId, _))
+//            // Condition change to true.
+//            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
+//                data->clear();
+//                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucketStartTimeNs + 10);
+//                event->write("field1");
+//                event->write(10);
+//                event->init();
+//                data->push_back(event);
+//                return true;
+//            }))
+//            // Dump report requested.
+//            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
+//                data->clear();
+//                shared_ptr<LogEvent> event =
+//                        make_shared<LogEvent>(tagId, bucketStartTimeNs + 9000000);
+//                event->write("field1");
+//                event->write(15);
+//                event->init();
+//                data->push_back(event);
+//                return true;
+//            }));
+//
+//    sp<ValueMetricProducer> valueProducer =
+//            ValueMetricProducerTestHelper::createValueProducerWithCondition(pullerManager, metric);
+//
+//    // Condition change event.
+//    valueProducer->onConditionChanged(true, bucketStartTimeNs + 10);
+//
+//    // Check dump report.
+//    ProtoOutputStream output;
+//    std::set<string> strSet;
+//    int64_t dumpReportTimeNs = bucketStartTimeNs + 9000000;
+//    valueProducer->onDumpReport(dumpReportTimeNs, true /* include recent buckets */, true,
+//                                NO_TIME_CONSTRAINTS /* dumpLatency */, &strSet, &output);
+//
+//    StatsLogReport report = outputStreamToProto(&output);
+//    EXPECT_TRUE(report.has_value_metrics());
+//    EXPECT_EQ(0, report.value_metrics().data_size());
+//    EXPECT_EQ(1, report.value_metrics().skipped_size());
+//
+//    EXPECT_EQ(NanoToMillis(bucketStartTimeNs),
+//              report.value_metrics().skipped(0).start_bucket_elapsed_millis());
+//    EXPECT_EQ(NanoToMillis(dumpReportTimeNs),
+//              report.value_metrics().skipped(0).end_bucket_elapsed_millis());
+//    EXPECT_EQ(1, report.value_metrics().skipped(0).drop_event_size());
+//
+//    auto dropEvent = report.value_metrics().skipped(0).drop_event(0);
+//    EXPECT_EQ(BucketDropReason::BUCKET_TOO_SMALL, dropEvent.drop_reason());
+//    EXPECT_EQ(NanoToMillis(dumpReportTimeNs), dropEvent.drop_time_millis());
+//}
+//
+///*
+// * Test multiple bucket drop events in the same bucket.
+// */
+//TEST(ValueMetricProducerTest_BucketDrop, TestMultipleBucketDropEvents) {
+//    ValueMetric metric = ValueMetricProducerTestHelper::createMetricWithCondition();
+//
+//    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
+//    EXPECT_CALL(*pullerManager, Pull(tagId, _))
+//            // Condition change to true.
+//            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
+//                data->clear();
+//                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucketStartTimeNs + 10);
+//                event->write("field1");
+//                event->write(10);
+//                event->init();
+//                data->push_back(event);
+//                return true;
+//            }));
+//
+//    sp<ValueMetricProducer> valueProducer =
+//            ValueMetricProducerTestHelper::createValueProducerWithNoInitialCondition(pullerManager,
+//                                                                                     metric);
+//
+//    // Condition change event.
+//    valueProducer->onConditionChanged(true, bucketStartTimeNs + 10);
+//
+//    // Check dump report.
+//    ProtoOutputStream output;
+//    std::set<string> strSet;
+//    int64_t dumpReportTimeNs = bucketStartTimeNs + 1000;
+//    valueProducer->onDumpReport(dumpReportTimeNs, true /* include recent buckets */, true,
+//                                FAST /* dumpLatency */, &strSet, &output);
+//
+//    StatsLogReport report = outputStreamToProto(&output);
+//    EXPECT_TRUE(report.has_value_metrics());
+//    EXPECT_EQ(0, report.value_metrics().data_size());
+//    EXPECT_EQ(1, report.value_metrics().skipped_size());
+//
+//    EXPECT_EQ(NanoToMillis(bucketStartTimeNs),
+//              report.value_metrics().skipped(0).start_bucket_elapsed_millis());
+//    EXPECT_EQ(NanoToMillis(dumpReportTimeNs),
+//              report.value_metrics().skipped(0).end_bucket_elapsed_millis());
+//    EXPECT_EQ(2, report.value_metrics().skipped(0).drop_event_size());
+//
+//    auto dropEvent = report.value_metrics().skipped(0).drop_event(0);
+//    EXPECT_EQ(BucketDropReason::CONDITION_UNKNOWN, dropEvent.drop_reason());
+//    EXPECT_EQ(NanoToMillis(bucketStartTimeNs + 10), dropEvent.drop_time_millis());
+//
+//    dropEvent = report.value_metrics().skipped(0).drop_event(1);
+//    EXPECT_EQ(BucketDropReason::DUMP_REPORT_REQUESTED, dropEvent.drop_reason());
+//    EXPECT_EQ(NanoToMillis(dumpReportTimeNs), dropEvent.drop_time_millis());
+//}
+//
+///*
+// * Test that the number of logged bucket drop events is capped at the maximum.
+// * The maximum is currently 10 and is set in MetricProducer::maxDropEventsReached().
+// */
+//TEST(ValueMetricProducerTest_BucketDrop, TestMaxBucketDropEvents) {
+//    ValueMetric metric = ValueMetricProducerTestHelper::createMetricWithCondition();
+//
+//    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
+//    EXPECT_CALL(*pullerManager, Pull(tagId, _))
+//            // First condition change event.
+//            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
+//                for (int i = 0; i < 2000; i++) {
+//                    shared_ptr<LogEvent> event =
+//                            make_shared<LogEvent>(tagId, bucketStartTimeNs + 1);
+//                    event->write(i);
+//                    event->write(i);
+//                    event->init();
+//                    data->push_back(event);
+//                }
+//                return true;
+//            }))
+//            .WillOnce(Return(false))
+//            .WillOnce(Return(false))
+//            .WillOnce(Return(false))
+//            .WillOnce(Return(false))
+//            .WillOnce(Return(false))
+//            .WillOnce(Return(false))
+//            .WillOnce(Return(false))
+//            .WillOnce(Return(false))
+//            .WillOnce(Return(false))
+//            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
+//                data->clear();
+//                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucketStartTimeNs + 220);
+//                event->write("field1");
+//                event->write(10);
+//                event->init();
+//                data->push_back(event);
+//                return true;
+//            }));
+//
+//    sp<ValueMetricProducer> valueProducer =
+//            ValueMetricProducerTestHelper::createValueProducerWithNoInitialCondition(pullerManager,
+//                                                                                     metric);
+//
+//    // First condition change event causes guardrail to be reached.
+//    valueProducer->onConditionChanged(true, bucketStartTimeNs + 10);
+//
+//    // 2-10 condition change events result in failed pulls.
+//    valueProducer->onConditionChanged(false, bucketStartTimeNs + 30);
+//    valueProducer->onConditionChanged(true, bucketStartTimeNs + 50);
+//    valueProducer->onConditionChanged(false, bucketStartTimeNs + 70);
+//    valueProducer->onConditionChanged(true, bucketStartTimeNs + 90);
+//    valueProducer->onConditionChanged(false, bucketStartTimeNs + 100);
+//    valueProducer->onConditionChanged(true, bucketStartTimeNs + 150);
+//    valueProducer->onConditionChanged(false, bucketStartTimeNs + 170);
+//    valueProducer->onConditionChanged(true, bucketStartTimeNs + 190);
+//    valueProducer->onConditionChanged(false, bucketStartTimeNs + 200);
+//
+//    // Condition change event 11
+//    valueProducer->onConditionChanged(true, bucketStartTimeNs + 220);
+//
+//    // Check dump report.
+//    ProtoOutputStream output;
+//    std::set<string> strSet;
+//    int64_t dumpReportTimeNs = bucketStartTimeNs + 1000;
+//    // Because we already have 10 dump events in the current bucket,
+//    // this case should not be added to the list of dump events.
+//    valueProducer->onDumpReport(bucketStartTimeNs + 1000, true /* include recent buckets */, true,
+//                                FAST /* dumpLatency */, &strSet, &output);
+//
+//    StatsLogReport report = outputStreamToProto(&output);
+//    EXPECT_TRUE(report.has_value_metrics());
+//    EXPECT_EQ(0, report.value_metrics().data_size());
+//    EXPECT_EQ(1, report.value_metrics().skipped_size());
+//
+//    EXPECT_EQ(NanoToMillis(bucketStartTimeNs),
+//              report.value_metrics().skipped(0).start_bucket_elapsed_millis());
+//    EXPECT_EQ(NanoToMillis(dumpReportTimeNs),
+//              report.value_metrics().skipped(0).end_bucket_elapsed_millis());
+//    EXPECT_EQ(10, report.value_metrics().skipped(0).drop_event_size());
+//
+//    auto dropEvent = report.value_metrics().skipped(0).drop_event(0);
+//    EXPECT_EQ(BucketDropReason::CONDITION_UNKNOWN, dropEvent.drop_reason());
+//    EXPECT_EQ(NanoToMillis(bucketStartTimeNs + 10), dropEvent.drop_time_millis());
+//
+//    dropEvent = report.value_metrics().skipped(0).drop_event(1);
+//    EXPECT_EQ(BucketDropReason::PULL_FAILED, dropEvent.drop_reason());
+//    EXPECT_EQ(NanoToMillis(bucketStartTimeNs + 30), dropEvent.drop_time_millis());
+//
+//    dropEvent = report.value_metrics().skipped(0).drop_event(2);
+//    EXPECT_EQ(BucketDropReason::PULL_FAILED, dropEvent.drop_reason());
+//    EXPECT_EQ(NanoToMillis(bucketStartTimeNs + 50), dropEvent.drop_time_millis());
+//
+//    dropEvent = report.value_metrics().skipped(0).drop_event(3);
+//    EXPECT_EQ(BucketDropReason::PULL_FAILED, dropEvent.drop_reason());
+//    EXPECT_EQ(NanoToMillis(bucketStartTimeNs + 70), dropEvent.drop_time_millis());
+//
+//    dropEvent = report.value_metrics().skipped(0).drop_event(4);
+//    EXPECT_EQ(BucketDropReason::PULL_FAILED, dropEvent.drop_reason());
+//    EXPECT_EQ(NanoToMillis(bucketStartTimeNs + 90), dropEvent.drop_time_millis());
+//
+//    dropEvent = report.value_metrics().skipped(0).drop_event(5);
+//    EXPECT_EQ(BucketDropReason::PULL_FAILED, dropEvent.drop_reason());
+//    EXPECT_EQ(NanoToMillis(bucketStartTimeNs + 100), dropEvent.drop_time_millis());
+//
+//    dropEvent = report.value_metrics().skipped(0).drop_event(6);
+//    EXPECT_EQ(BucketDropReason::PULL_FAILED, dropEvent.drop_reason());
+//    EXPECT_EQ(NanoToMillis(bucketStartTimeNs + 150), dropEvent.drop_time_millis());
+//
+//    dropEvent = report.value_metrics().skipped(0).drop_event(7);
+//    EXPECT_EQ(BucketDropReason::PULL_FAILED, dropEvent.drop_reason());
+//    EXPECT_EQ(NanoToMillis(bucketStartTimeNs + 170), dropEvent.drop_time_millis());
+//
+//    dropEvent = report.value_metrics().skipped(0).drop_event(8);
+//    EXPECT_EQ(BucketDropReason::PULL_FAILED, dropEvent.drop_reason());
+//    EXPECT_EQ(NanoToMillis(bucketStartTimeNs + 190), dropEvent.drop_time_millis());
+//
+//    dropEvent = report.value_metrics().skipped(0).drop_event(9);
+//    EXPECT_EQ(BucketDropReason::PULL_FAILED, dropEvent.drop_reason());
+//    EXPECT_EQ(NanoToMillis(bucketStartTimeNs + 200), dropEvent.drop_time_millis());
+//}
+//
+///*
+// * Test metric with a simple sliced state
+// * - Increasing values
+// * - Using diff
+// * - Second field is value field
+// */
+//TEST(ValueMetricProducerTest, TestSlicedState) {
+//    // Set up ValueMetricProducer.
+//    ValueMetric metric = ValueMetricProducerTestHelper::createMetricWithState("SCREEN_STATE");
+//    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
+//    EXPECT_CALL(*pullerManager, Pull(tagId, _))
+//            // ValueMetricProducer initialized.
+//            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
+//                data->clear();
+//                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucketStartTimeNs);
+//                event->write("field1");
+//                event->write(3);
+//                event->init();
+//                data->push_back(event);
+//                return true;
+//            }))
+//            // Screen state change to ON.
+//            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
+//                data->clear();
+//                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucketStartTimeNs + 5);
+//                event->write("field1");
+//                event->write(5);
+//                event->init();
+//                data->push_back(event);
+//                return true;
+//            }))
+//            // Screen state change to OFF.
+//            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
+//                data->clear();
+//                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucketStartTimeNs + 10);
+//                event->write("field1");
+//                event->write(9);
+//                event->init();
+//                data->push_back(event);
+//                return true;
+//            }))
+//            // Screen state change to ON.
+//            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
+//                data->clear();
+//                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucketStartTimeNs + 15);
+//                event->write("field1");
+//                event->write(21);
+//                event->init();
+//                data->push_back(event);
+//                return true;
+//            }))
+//            // Dump report requested.
+//            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
+//                data->clear();
+//                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucketStartTimeNs + 50);
+//                event->write("field1");
+//                event->write(30);
+//                event->init();
+//                data->push_back(event);
+//                return true;
+//            }));
+//
+//    sp<ValueMetricProducer> valueProducer =
+//            ValueMetricProducerTestHelper::createValueProducerWithState(
+//                    pullerManager, metric, {android::util::SCREEN_STATE_CHANGED}, {});
+//
+//    // Set up StateManager and check that StateTrackers are initialized.
+//    StateManager::getInstance().clear();
+//    StateManager::getInstance().registerListener(SCREEN_STATE_ATOM_ID, valueProducer);
+//    EXPECT_EQ(1, StateManager::getInstance().getStateTrackersCount());
+//    EXPECT_EQ(1, StateManager::getInstance().getListenersCount(SCREEN_STATE_ATOM_ID));
+//
+//    // Bucket status after metric initialized.
+//    EXPECT_EQ(1UL, valueProducer->mCurrentSlicedBucket.size());
+//    // Base for dimension key {}
+//    auto it = valueProducer->mCurrentSlicedBucket.begin();
+//    auto itBase = valueProducer->mCurrentBaseInfo.find(it->first.getDimensionKeyInWhat());
+//    EXPECT_EQ(true, itBase->second[0].hasBase);
+//    EXPECT_EQ(3, itBase->second[0].base.long_value);
+//    // Value for dimension, state key {{}, kStateUnknown}
+//    EXPECT_EQ(false, it->second[0].hasValue);
+//
+//    // Bucket status after screen state change kStateUnknown->ON.
+//    auto screenEvent = CreateScreenStateChangedEvent(
+//            android::view::DisplayStateEnum::DISPLAY_STATE_ON, bucketStartTimeNs + 5);
+//    StateManager::getInstance().onLogEvent(*screenEvent);
+//    EXPECT_EQ(1UL, valueProducer->mCurrentSlicedBucket.size());
+//    // Base for dimension key {}
+//    it = valueProducer->mCurrentSlicedBucket.begin();
+//    itBase = valueProducer->mCurrentBaseInfo.find(it->first.getDimensionKeyInWhat());
+//    EXPECT_EQ(true, itBase->second[0].hasBase);
+//    EXPECT_EQ(5, itBase->second[0].base.long_value);
+//    // Value for dimension, state key {{}, kStateUnknown}
+//    EXPECT_EQ(true, it->second[0].hasValue);
+//    EXPECT_EQ(2, it->second[0].value.long_value);
+//
+//    // Bucket status after screen state change ON->OFF.
+//    screenEvent = CreateScreenStateChangedEvent(android::view::DisplayStateEnum::DISPLAY_STATE_OFF,
+//                                                bucketStartTimeNs + 10);
+//    StateManager::getInstance().onLogEvent(*screenEvent);
+//    EXPECT_EQ(2UL, valueProducer->mCurrentSlicedBucket.size());
+//    // Base for dimension key {}
+//    it = valueProducer->mCurrentSlicedBucket.begin();
+//    itBase = valueProducer->mCurrentBaseInfo.find(it->first.getDimensionKeyInWhat());
+//    EXPECT_EQ(true, itBase->second[0].hasBase);
+//    EXPECT_EQ(9, itBase->second[0].base.long_value);
+//    // Value for dimension, state key {{}, ON}
+//    EXPECT_EQ(android::view::DisplayStateEnum::DISPLAY_STATE_ON,
+//              it->first.getStateValuesKey().getValues()[0].mValue.int_value);
+//    EXPECT_EQ(true, it->second[0].hasValue);
+//    EXPECT_EQ(4, it->second[0].value.long_value);
+//    // Value for dimension, state key {{}, kStateUnknown}
+//    it++;
+//    EXPECT_EQ(true, it->second[0].hasValue);
+//    EXPECT_EQ(2, it->second[0].value.long_value);
+//
+//    // Bucket status after screen state change OFF->ON.
+//    screenEvent = CreateScreenStateChangedEvent(android::view::DisplayStateEnum::DISPLAY_STATE_ON,
+//                                                bucketStartTimeNs + 15);
+//    StateManager::getInstance().onLogEvent(*screenEvent);
+//    EXPECT_EQ(3UL, valueProducer->mCurrentSlicedBucket.size());
+//    // Base for dimension key {}
+//    it = valueProducer->mCurrentSlicedBucket.begin();
+//    itBase = valueProducer->mCurrentBaseInfo.find(it->first.getDimensionKeyInWhat());
+//    EXPECT_EQ(true, itBase->second[0].hasBase);
+//    EXPECT_EQ(21, itBase->second[0].base.long_value);
+//    // Value for dimension, state key {{}, OFF}
+//    EXPECT_EQ(android::view::DisplayStateEnum::DISPLAY_STATE_OFF,
+//              it->first.getStateValuesKey().getValues()[0].mValue.int_value);
+//    EXPECT_EQ(true, it->second[0].hasValue);
+//    EXPECT_EQ(12, it->second[0].value.long_value);
+//    // Value for dimension, state key {{}, ON}
+//    it++;
+//    EXPECT_EQ(android::view::DisplayStateEnum::DISPLAY_STATE_ON,
+//              it->first.getStateValuesKey().getValues()[0].mValue.int_value);
+//    EXPECT_EQ(true, it->second[0].hasValue);
+//    EXPECT_EQ(4, it->second[0].value.long_value);
+//    // Value for dimension, state key {{}, kStateUnknown}
+//    it++;
+//    EXPECT_EQ(true, it->second[0].hasValue);
+//    EXPECT_EQ(2, it->second[0].value.long_value);
+//
+//    // Start dump report and check output.
+//    ProtoOutputStream output;
+//    std::set<string> strSet;
+//    valueProducer->onDumpReport(bucketStartTimeNs + 50, true /* include recent buckets */, true,
+//                                NO_TIME_CONSTRAINTS, &strSet, &output);
+//
+//    StatsLogReport report = outputStreamToProto(&output);
+//    EXPECT_TRUE(report.has_value_metrics());
+//    EXPECT_EQ(3, report.value_metrics().data_size());
+//
+//    auto data = report.value_metrics().data(0);
+//    EXPECT_EQ(1, data.bucket_info_size());
+//    EXPECT_EQ(2, report.value_metrics().data(0).bucket_info(0).values(0).value_long());
+//
+//    data = report.value_metrics().data(1);
+//    EXPECT_EQ(1, report.value_metrics().data(1).bucket_info_size());
+//    EXPECT_EQ(13, report.value_metrics().data(1).bucket_info(0).values(0).value_long());
+//    EXPECT_EQ(SCREEN_STATE_ATOM_ID, data.slice_by_state(0).atom_id());
+//    EXPECT_TRUE(data.slice_by_state(0).has_value());
+//    EXPECT_EQ(android::view::DisplayStateEnum::DISPLAY_STATE_ON, data.slice_by_state(0).value());
+//
+//    data = report.value_metrics().data(2);
+//    EXPECT_EQ(1, report.value_metrics().data(2).bucket_info_size());
+//    EXPECT_EQ(12, report.value_metrics().data(2).bucket_info(0).values(0).value_long());
+//    EXPECT_EQ(SCREEN_STATE_ATOM_ID, data.slice_by_state(0).atom_id());
+//    EXPECT_TRUE(data.slice_by_state(0).has_value());
+//    EXPECT_EQ(android::view::DisplayStateEnum::DISPLAY_STATE_OFF, data.slice_by_state(0).value());
+//}
+//
+///*
+// * Test metric with sliced state with map
+// * - Increasing values
+// * - Using diff
+// * - Second field is value field
+// */
+//TEST(ValueMetricProducerTest, TestSlicedStateWithMap) {
+//    // Set up ValueMetricProducer.
+//    ValueMetric metric = ValueMetricProducerTestHelper::createMetricWithState("SCREEN_STATE_ONOFF");
+//    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
+//    EXPECT_CALL(*pullerManager, Pull(tagId, _))
+//            // ValueMetricProducer initialized.
+//            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
+//                data->clear();
+//                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucketStartTimeNs);
+//                event->write("field1");
+//                event->write(3);
+//                event->init();
+//                data->push_back(event);
+//                return true;
+//            }))
+//            // Screen state change to ON.
+//            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
+//                data->clear();
+//                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucketStartTimeNs + 5);
+//                event->write("field1");
+//                event->write(5);
+//                event->init();
+//                data->push_back(event);
+//                return true;
+//            }))
+//            // Screen state change to VR.
+//            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
+//                data->clear();
+//                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucketStartTimeNs + 10);
+//                event->write("field1");
+//                event->write(9);
+//                event->init();
+//                data->push_back(event);
+//                return true;
+//            }))
+//            // Screen state change to OFF.
+//            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
+//                data->clear();
+//                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucketStartTimeNs + 15);
+//                event->write("field1");
+//                event->write(21);
+//                event->init();
+//                data->push_back(event);
+//                return true;
+//            }))
+//            // Dump report requested.
+//            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
+//                data->clear();
+//                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucketStartTimeNs + 50);
+//                event->write("field1");
+//                event->write(30);
+//                event->init();
+//                data->push_back(event);
+//                return true;
+//            }));
+//
+//    const StateMap& stateMap = CreateScreenStateOnOffMap();
+//    const StateMap_StateGroup screenOnGroup = stateMap.group(0);
+//    const StateMap_StateGroup screenOffGroup = stateMap.group(1);
+//
+//    unordered_map<int, unordered_map<int, int64_t>> stateGroupMap;
+//    for (auto group : stateMap.group()) {
+//        for (auto value : group.value()) {
+//            stateGroupMap[SCREEN_STATE_ATOM_ID][value] = group.group_id();
+//        }
+//    }
+//
+//    sp<ValueMetricProducer> valueProducer =
+//            ValueMetricProducerTestHelper::createValueProducerWithState(
+//                    pullerManager, metric, {android::util::SCREEN_STATE_CHANGED}, stateGroupMap);
+//
+//    // Set up StateManager and check that StateTrackers are initialized.
+//    StateManager::getInstance().clear();
+//    StateManager::getInstance().registerListener(SCREEN_STATE_ATOM_ID, valueProducer);
+//    EXPECT_EQ(1, StateManager::getInstance().getStateTrackersCount());
+//    EXPECT_EQ(1, StateManager::getInstance().getListenersCount(SCREEN_STATE_ATOM_ID));
+//
+//    // Bucket status after metric initialized.
+//    EXPECT_EQ(1UL, valueProducer->mCurrentSlicedBucket.size());
+//    // Base for dimension key {}
+//    auto it = valueProducer->mCurrentSlicedBucket.begin();
+//    auto itBase = valueProducer->mCurrentBaseInfo.find(it->first.getDimensionKeyInWhat());
+//    EXPECT_EQ(true, itBase->second[0].hasBase);
+//    EXPECT_EQ(3, itBase->second[0].base.long_value);
+//    // Value for dimension, state key {{}, {}}
+//    EXPECT_EQ(false, it->second[0].hasValue);
+//
+//    // Bucket status after screen state change kStateUnknown->ON.
+//    auto screenEvent = CreateScreenStateChangedEvent(
+//            android::view::DisplayStateEnum::DISPLAY_STATE_ON, bucketStartTimeNs + 5);
+//    StateManager::getInstance().onLogEvent(*screenEvent);
+//    EXPECT_EQ(1UL, valueProducer->mCurrentSlicedBucket.size());
+//    // Base for dimension key {}
+//    it = valueProducer->mCurrentSlicedBucket.begin();
+//    itBase = valueProducer->mCurrentBaseInfo.find(it->first.getDimensionKeyInWhat());
+//    EXPECT_EQ(true, itBase->second[0].hasBase);
+//    EXPECT_EQ(5, itBase->second[0].base.long_value);
+//    // Value for dimension, state key {{}, kStateUnknown}
+//    EXPECT_EQ(true, it->second[0].hasValue);
+//    EXPECT_EQ(2, it->second[0].value.long_value);
+//
+//    // Bucket status after screen state change ON->VR (also ON).
+//    screenEvent = CreateScreenStateChangedEvent(android::view::DisplayStateEnum::DISPLAY_STATE_VR,
+//                                                bucketStartTimeNs + 10);
+//    StateManager::getInstance().onLogEvent(*screenEvent);
+//    EXPECT_EQ(2UL, valueProducer->mCurrentSlicedBucket.size());
+//    // Base for dimension key {}
+//    it = valueProducer->mCurrentSlicedBucket.begin();
+//    itBase = valueProducer->mCurrentBaseInfo.find(it->first.getDimensionKeyInWhat());
+//    EXPECT_EQ(true, itBase->second[0].hasBase);
+//    EXPECT_EQ(9, itBase->second[0].base.long_value);
+//    // Value for dimension, state key {{}, ON GROUP}
+//    EXPECT_EQ(screenOnGroup.group_id(),
+//              it->first.getStateValuesKey().getValues()[0].mValue.long_value);
+//    EXPECT_EQ(true, it->second[0].hasValue);
+//    EXPECT_EQ(4, it->second[0].value.long_value);
+//    // Value for dimension, state key {{}, kStateUnknown}
+//    it++;
+//    EXPECT_EQ(true, it->second[0].hasValue);
+//    EXPECT_EQ(2, it->second[0].value.long_value);
+//
+//    // Bucket status after screen state change VR->OFF.
+//    screenEvent = CreateScreenStateChangedEvent(android::view::DisplayStateEnum::DISPLAY_STATE_OFF,
+//                                                bucketStartTimeNs + 15);
+//    StateManager::getInstance().onLogEvent(*screenEvent);
+//    EXPECT_EQ(2UL, valueProducer->mCurrentSlicedBucket.size());
+//    // Base for dimension key {}
+//    it = valueProducer->mCurrentSlicedBucket.begin();
+//    itBase = valueProducer->mCurrentBaseInfo.find(it->first.getDimensionKeyInWhat());
+//    EXPECT_EQ(true, itBase->second[0].hasBase);
+//    EXPECT_EQ(21, itBase->second[0].base.long_value);
+//    // Value for dimension, state key {{}, ON GROUP}
+//    EXPECT_EQ(screenOnGroup.group_id(),
+//              it->first.getStateValuesKey().getValues()[0].mValue.long_value);
+//    EXPECT_EQ(true, it->second[0].hasValue);
+//    EXPECT_EQ(16, it->second[0].value.long_value);
+//    // Value for dimension, state key {{}, kStateUnknown}
+//    it++;
+//    EXPECT_EQ(true, it->second[0].hasValue);
+//    EXPECT_EQ(2, it->second[0].value.long_value);
+//
+//    // Start dump report and check output.
+//    ProtoOutputStream output;
+//    std::set<string> strSet;
+//    valueProducer->onDumpReport(bucketStartTimeNs + 50, true /* include recent buckets */, true,
+//                                NO_TIME_CONSTRAINTS, &strSet, &output);
+//
+//    StatsLogReport report = outputStreamToProto(&output);
+//    EXPECT_TRUE(report.has_value_metrics());
+//    EXPECT_EQ(3, report.value_metrics().data_size());
+//
+//    auto data = report.value_metrics().data(0);
+//    EXPECT_EQ(1, data.bucket_info_size());
+//    EXPECT_EQ(2, report.value_metrics().data(0).bucket_info(0).values(0).value_long());
+//
+//    data = report.value_metrics().data(1);
+//    EXPECT_EQ(1, report.value_metrics().data(1).bucket_info_size());
+//    EXPECT_EQ(16, report.value_metrics().data(1).bucket_info(0).values(0).value_long());
+//    EXPECT_EQ(SCREEN_STATE_ATOM_ID, data.slice_by_state(0).atom_id());
+//    EXPECT_TRUE(data.slice_by_state(0).has_group_id());
+//    EXPECT_EQ(screenOnGroup.group_id(), data.slice_by_state(0).group_id());
+//
+//    data = report.value_metrics().data(2);
+//    EXPECT_EQ(1, report.value_metrics().data(2).bucket_info_size());
+//    EXPECT_EQ(9, report.value_metrics().data(2).bucket_info(0).values(0).value_long());
+//    EXPECT_EQ(SCREEN_STATE_ATOM_ID, data.slice_by_state(0).atom_id());
+//    EXPECT_TRUE(data.slice_by_state(0).has_group_id());
+//    EXPECT_EQ(screenOffGroup.group_id(), data.slice_by_state(0).group_id());
+//}
+//
+///*
+// * Test metric that slices by state with a primary field and has dimensions
+// * - Increasing values
+// * - Using diff
+// * - Second field is value field
+// */
+//TEST(ValueMetricProducerTest, TestSlicedStateWithPrimaryField_WithDimensions) {
+//    // Set up ValueMetricProducer.
+//    ValueMetric metric = ValueMetricProducerTestHelper::createMetricWithState("UID_PROCESS_STATE");
+//    metric.mutable_dimensions_in_what()->set_field(tagId);
+//    metric.mutable_dimensions_in_what()->add_child()->set_field(1);
+//
+//    MetricStateLink* stateLink = metric.add_state_link();
+//    stateLink->set_state_atom_id(UID_PROCESS_STATE_ATOM_ID);
+//    auto fieldsInWhat = stateLink->mutable_fields_in_what();
+//    *fieldsInWhat = CreateDimensions(tagId, {1 /* uid */});
+//    auto fieldsInState = stateLink->mutable_fields_in_state();
+//    *fieldsInState = CreateDimensions(UID_PROCESS_STATE_ATOM_ID, {1 /* uid */});
+//
+//    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
+//    EXPECT_CALL(*pullerManager, Pull(tagId, _))
+//            // ValueMetricProducer initialized.
+//            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
+//                data->clear();
+//                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucketStartTimeNs);
+//                event->write(2 /* uid */);
+//                event->write(7);
+//                event->init();
+//                data->push_back(event);
+//
+//                event = make_shared<LogEvent>(tagId, bucketStartTimeNs);
+//                event->write(1 /* uid */);
+//                event->write(3);
+//                event->init();
+//                data->push_back(event);
+//                return true;
+//            }))
+//            // Uid 1 process state change from kStateUnknown -> Foreground
+//            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
+//                data->clear();
+//                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucketStartTimeNs + 20);
+//                event->write(1 /* uid */);
+//                event->write(6);
+//                event->init();
+//                data->push_back(event);
+//
+//                // This event should be skipped.
+//                event = make_shared<LogEvent>(tagId, bucketStartTimeNs + 20);
+//                event->write(2 /* uid */);
+//                event->write(8);
+//                event->init();
+//                data->push_back(event);
+//                return true;
+//            }))
+//            // Uid 2 process state change from kStateUnknown -> Background
+//            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
+//                data->clear();
+//                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucketStartTimeNs + 40);
+//                event->write(2 /* uid */);
+//                event->write(9);
+//                event->init();
+//                data->push_back(event);
+//
+//                // This event should be skipped.
+//                event = make_shared<LogEvent>(tagId, bucketStartTimeNs + 40);
+//                event->write(1 /* uid */);
+//                event->write(12);
+//                event->init();
+//                data->push_back(event);
+//                return true;
+//            }))
+//            // Uid 1 process state change from Foreground -> Background
+//            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
+//                data->clear();
+//                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucket2StartTimeNs + 20);
+//                event->write(1 /* uid */);
+//                event->write(13);
+//                event->init();
+//                data->push_back(event);
+//
+//                // This event should be skipped.
+//                event = make_shared<LogEvent>(tagId, bucket2StartTimeNs + 20);
+//                event->write(2 /* uid */);
+//                event->write(11);
+//                event->init();
+//                data->push_back(event);
+//                return true;
+//            }))
+//            // Uid 1 process state change from Background -> Foreground
+//            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
+//                data->clear();
+//                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucket2StartTimeNs + 40);
+//                event->write(1 /* uid */);
+//                event->write(17);
+//                event->init();
+//                data->push_back(event);
+//
+//                // This event should be skipped.
+//                event = make_shared<LogEvent>(tagId, bucket2StartTimeNs + 40);
+//                event->write(2 /* uid */);
+//                event->write(15);
+//                event->init();
+//                data->push_back(event);
+//                return true;
+//            }))
+//            // Dump report pull.
+//            .WillOnce(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
+//                data->clear();
+//                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucket2StartTimeNs + 50);
+//                event->write(2 /* uid */);
+//                event->write(20);
+//                event->init();
+//                data->push_back(event);
+//
+//                event = make_shared<LogEvent>(tagId, bucket2StartTimeNs + 50);
+//                event->write(1 /* uid */);
+//                event->write(21);
+//                event->init();
+//                data->push_back(event);
+//                return true;
+//            }));
+//
+//    sp<ValueMetricProducer> valueProducer =
+//            ValueMetricProducerTestHelper::createValueProducerWithState(
+//                    pullerManager, metric, {UID_PROCESS_STATE_ATOM_ID}, {});
+//
+//    // Set up StateManager and check that StateTrackers are initialized.
+//    StateManager::getInstance().clear();
+//    StateManager::getInstance().registerListener(UID_PROCESS_STATE_ATOM_ID, valueProducer);
+//    EXPECT_EQ(1, StateManager::getInstance().getStateTrackersCount());
+//    EXPECT_EQ(1, StateManager::getInstance().getListenersCount(UID_PROCESS_STATE_ATOM_ID));
+//
+//    // Bucket status after metric initialized.
+//    EXPECT_EQ(2UL, valueProducer->mCurrentSlicedBucket.size());
+//    // Base for dimension key {uid 1}.
+//    auto it = valueProducer->mCurrentSlicedBucket.begin();
+//    EXPECT_EQ(1, it->first.getDimensionKeyInWhat().getValues()[0].mValue.int_value);
+//    auto itBase = valueProducer->mCurrentBaseInfo.find(it->first.getDimensionKeyInWhat());
+//    EXPECT_EQ(true, itBase->second[0].hasBase);
+//    EXPECT_EQ(3, itBase->second[0].base.long_value);
+//    // Value for dimension, state key {{uid 1}, kStateUnknown}
+//    // TODO(tsaichristine): test equality of state values key
+//    // EXPECT_EQ(-1, it->first.getStateValuesKey().getValues()[0].mValue.int_value);
+//    EXPECT_EQ(false, it->second[0].hasValue);
+//    // Base for dimension key {uid 2}
+//    it++;
+//    EXPECT_EQ(2, it->first.getDimensionKeyInWhat().getValues()[0].mValue.int_value);
+//    itBase = valueProducer->mCurrentBaseInfo.find(it->first.getDimensionKeyInWhat());
+//    EXPECT_EQ(true, itBase->second[0].hasBase);
+//    EXPECT_EQ(7, itBase->second[0].base.long_value);
+//    // Value for dimension, state key {{uid 2}, kStateUnknown}
+//    // EXPECT_EQ(-1, it->first.getStateValuesKey().getValues()[0].mValue.int_value);
+//    EXPECT_EQ(false, it->second[0].hasValue);
+//
+//    // Bucket status after uid 1 process state change kStateUnknown -> Foreground.
+//    auto uidProcessEvent = CreateUidProcessStateChangedEvent(
+//            1 /* uid */, android::app::PROCESS_STATE_IMPORTANT_FOREGROUND, bucketStartTimeNs + 20);
+//    StateManager::getInstance().onLogEvent(*uidProcessEvent);
+//    EXPECT_EQ(2UL, valueProducer->mCurrentSlicedBucket.size());
+//    // Base for dimension key {uid 1}.
+//    it = valueProducer->mCurrentSlicedBucket.begin();
+//    EXPECT_EQ(1, it->first.getDimensionKeyInWhat().getValues()[0].mValue.int_value);
+//    itBase = valueProducer->mCurrentBaseInfo.find(it->first.getDimensionKeyInWhat());
+//    EXPECT_EQ(1, it->first.getDimensionKeyInWhat().getValues()[0].mValue.int_value);
+//    EXPECT_EQ(true, itBase->second[0].hasBase);
+//    EXPECT_EQ(6, itBase->second[0].base.long_value);
+//    // Value for key {uid 1, kStateUnknown}.
+//    // EXPECT_EQ(-1, it->first.getStateValuesKey().getValues()[0].mValue.int_value);
+//    EXPECT_EQ(true, it->second[0].hasValue);
+//    EXPECT_EQ(3, it->second[0].value.long_value);
+//
+//    // Base for dimension key {uid 2}
+//    it++;
+//    EXPECT_EQ(2, it->first.getDimensionKeyInWhat().getValues()[0].mValue.int_value);
+//    itBase = valueProducer->mCurrentBaseInfo.find(it->first.getDimensionKeyInWhat());
+//    EXPECT_EQ(2, it->first.getDimensionKeyInWhat().getValues()[0].mValue.int_value);
+//    EXPECT_EQ(true, itBase->second[0].hasBase);
+//    EXPECT_EQ(7, itBase->second[0].base.long_value);
+//    // Value for key {uid 2, kStateUnknown}
+//    EXPECT_EQ(false, it->second[0].hasValue);
+//
+//    // Bucket status after uid 2 process state change kStateUnknown -> Background.
+//    uidProcessEvent = CreateUidProcessStateChangedEvent(
+//            2 /* uid */, android::app::PROCESS_STATE_IMPORTANT_BACKGROUND, bucketStartTimeNs + 40);
+//    StateManager::getInstance().onLogEvent(*uidProcessEvent);
+//    EXPECT_EQ(2UL, valueProducer->mCurrentSlicedBucket.size());
+//    // Base for dimension key {uid 1}.
+//    it = valueProducer->mCurrentSlicedBucket.begin();
+//    EXPECT_EQ(1, it->first.getDimensionKeyInWhat().getValues()[0].mValue.int_value);
+//    itBase = valueProducer->mCurrentBaseInfo.find(it->first.getDimensionKeyInWhat());
+//    EXPECT_EQ(true, itBase->second[0].hasBase);
+//    EXPECT_EQ(6, itBase->second[0].base.long_value);
+//    // Value for key {uid 1, kStateUnknown}.
+//    EXPECT_EQ(true, it->second[0].hasValue);
+//    EXPECT_EQ(3, it->second[0].value.long_value);
+//
+//    // Base for dimension key {uid 2}
+//    it++;
+//    EXPECT_EQ(2, it->first.getDimensionKeyInWhat().getValues()[0].mValue.int_value);
+//    itBase = valueProducer->mCurrentBaseInfo.find(it->first.getDimensionKeyInWhat());
+//    EXPECT_EQ(true, itBase->second[0].hasBase);
+//    EXPECT_EQ(9, itBase->second[0].base.long_value);
+//    // Value for key {uid 2, kStateUnknown}
+//    // EXPECT_EQ(-1, it->first.getStateValuesKey().getValues()[0].mValue.int_value);
+//    EXPECT_EQ(true, it->second[0].hasValue);
+//    EXPECT_EQ(2, it->second[0].value.long_value);
+//
+//    // Pull at end of first bucket.
+//    vector<shared_ptr<LogEvent>> allData;
+//    shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucket2StartTimeNs);
+//    event->write(1 /* uid */);
+//    event->write(10);
+//    event->init();
+//    allData.push_back(event);
+//
+//    event = make_shared<LogEvent>(tagId, bucket2StartTimeNs);
+//    event->write(2 /* uid */);
+//    event->write(15);
+//    event->init();
+//    allData.push_back(event);
+//
+//    valueProducer->onDataPulled(allData, /** succeeds */ true, bucket2StartTimeNs + 1);
+//
+//    // Buckets flushed after end of first bucket.
+//    // None of the buckets should have a value.
+//    EXPECT_EQ(4UL, valueProducer->mCurrentSlicedBucket.size());
+//    EXPECT_EQ(4UL, valueProducer->mPastBuckets.size());
+//    EXPECT_EQ(2UL, valueProducer->mCurrentBaseInfo.size());
+//    // Base for dimension key {uid 2}.
+//    it = valueProducer->mCurrentSlicedBucket.begin();
+//    EXPECT_EQ(2, it->first.getDimensionKeyInWhat().getValues()[0].mValue.int_value);
+//    itBase = valueProducer->mCurrentBaseInfo.find(it->first.getDimensionKeyInWhat());
+//    EXPECT_EQ(true, itBase->second[0].hasBase);
+//    EXPECT_EQ(15, itBase->second[0].base.long_value);
+//    // Value for key {uid 2, BACKGROUND}.
+//    EXPECT_EQ(1, it->first.getStateValuesKey().getValues().size());
+//    EXPECT_EQ(1006, it->first.getStateValuesKey().getValues()[0].mValue.int_value);
+//    EXPECT_EQ(false, it->second[0].hasValue);
+//
+//    // Base for dimension key {uid 1}
+//    it++;
+//    EXPECT_EQ(1, it->first.getDimensionKeyInWhat().getValues()[0].mValue.int_value);
+//    itBase = valueProducer->mCurrentBaseInfo.find(it->first.getDimensionKeyInWhat());
+//    EXPECT_EQ(true, itBase->second[0].hasBase);
+//    EXPECT_EQ(10, itBase->second[0].base.long_value);
+//    // Value for key {uid 1, kStateUnknown}
+//    EXPECT_EQ(0, it->first.getStateValuesKey().getValues().size());
+//    // EXPECT_EQ(-1, it->first.getStateValuesKey().getValues()[0].mValue.int_value);
+//    EXPECT_EQ(false, it->second[0].hasValue);
+//
+//    // Value for key {uid 1, FOREGROUND}
+//    it++;
+//    EXPECT_EQ(1, it->first.getStateValuesKey().getValues().size());
+//    EXPECT_EQ(1005, it->first.getStateValuesKey().getValues()[0].mValue.int_value);
+//    EXPECT_EQ(false, it->second[0].hasValue);
+//
+//    // Value for key {uid 2, kStateUnknown}
+//    it++;
+//    EXPECT_EQ(false, it->second[0].hasValue);
+//
+//    // Bucket status after uid 1 process state change from Foreground -> Background.
+//    uidProcessEvent = CreateUidProcessStateChangedEvent(
+//            1 /* uid */, android::app::PROCESS_STATE_IMPORTANT_BACKGROUND, bucket2StartTimeNs + 20);
+//    StateManager::getInstance().onLogEvent(*uidProcessEvent);
+//
+//    EXPECT_EQ(4UL, valueProducer->mCurrentSlicedBucket.size());
+//    EXPECT_EQ(4UL, valueProducer->mPastBuckets.size());
+//    EXPECT_EQ(2UL, valueProducer->mCurrentBaseInfo.size());
+//    // Base for dimension key {uid 2}.
+//    it = valueProducer->mCurrentSlicedBucket.begin();
+//    EXPECT_EQ(2, it->first.getDimensionKeyInWhat().getValues()[0].mValue.int_value);
+//    itBase = valueProducer->mCurrentBaseInfo.find(it->first.getDimensionKeyInWhat());
+//    EXPECT_EQ(true, itBase->second[0].hasBase);
+//    EXPECT_EQ(15, itBase->second[0].base.long_value);
+//    // Value for key {uid 2, BACKGROUND}.
+//    EXPECT_EQ(false, it->second[0].hasValue);
+//    // Base for dimension key {uid 1}
+//    it++;
+//    EXPECT_EQ(1, it->first.getDimensionKeyInWhat().getValues()[0].mValue.int_value);
+//    itBase = valueProducer->mCurrentBaseInfo.find(it->first.getDimensionKeyInWhat());
+//    EXPECT_EQ(true, itBase->second[0].hasBase);
+//    EXPECT_EQ(13, itBase->second[0].base.long_value);
+//    // Value for key {uid 1, kStateUnknown}
+//    EXPECT_EQ(false, it->second[0].hasValue);
+//    // Value for key {uid 1, FOREGROUND}
+//    it++;
+//    EXPECT_EQ(1, it->first.getDimensionKeyInWhat().getValues()[0].mValue.int_value);
+//    EXPECT_EQ(1005, it->first.getStateValuesKey().getValues()[0].mValue.int_value);
+//    EXPECT_EQ(true, it->second[0].hasValue);
+//    EXPECT_EQ(3, it->second[0].value.long_value);
+//    // Value for key {uid 2, kStateUnknown}
+//    it++;
+//    EXPECT_EQ(false, it->second[0].hasValue);
+//
+//    // Bucket status after uid 1 process state change Background->Foreground.
+//    uidProcessEvent = CreateUidProcessStateChangedEvent(
+//            1 /* uid */, android::app::PROCESS_STATE_IMPORTANT_FOREGROUND, bucket2StartTimeNs + 40);
+//    StateManager::getInstance().onLogEvent(*uidProcessEvent);
+//
+//    EXPECT_EQ(5UL, valueProducer->mCurrentSlicedBucket.size());
+//    EXPECT_EQ(2UL, valueProducer->mCurrentBaseInfo.size());
+//    // Base for dimension key {uid 2}
+//    it = valueProducer->mCurrentSlicedBucket.begin();
+//    EXPECT_EQ(2, it->first.getDimensionKeyInWhat().getValues()[0].mValue.int_value);
+//    itBase = valueProducer->mCurrentBaseInfo.find(it->first.getDimensionKeyInWhat());
+//    EXPECT_EQ(true, itBase->second[0].hasBase);
+//    EXPECT_EQ(15, itBase->second[0].base.long_value);
+//    EXPECT_EQ(false, it->second[0].hasValue);
+//
+//    it++;
+//    EXPECT_EQ(false, it->second[0].hasValue);
+//
+//    // Base for dimension key {uid 1}
+//    it++;
+//    EXPECT_EQ(1, it->first.getDimensionKeyInWhat().getValues()[0].mValue.int_value);
+//    itBase = valueProducer->mCurrentBaseInfo.find(it->first.getDimensionKeyInWhat());
+//    EXPECT_EQ(17, itBase->second[0].base.long_value);
+//    // Value for key {uid 1, BACKGROUND}
+//    EXPECT_EQ(1006, it->first.getStateValuesKey().getValues()[0].mValue.int_value);
+//    EXPECT_EQ(true, it->second[0].hasValue);
+//    EXPECT_EQ(4, it->second[0].value.long_value);
+//    // Value for key {uid 1, FOREGROUND}
+//    it++;
+//    EXPECT_EQ(1005, it->first.getStateValuesKey().getValues()[0].mValue.int_value);
+//    EXPECT_EQ(true, it->second[0].hasValue);
+//    EXPECT_EQ(3, it->second[0].value.long_value);
+//
+//    // Start dump report and check output.
+//    ProtoOutputStream output;
+//    std::set<string> strSet;
+//    valueProducer->onDumpReport(bucket2StartTimeNs + 50, true /* include recent buckets */, true,
+//                                NO_TIME_CONSTRAINTS, &strSet, &output);
+//
+//    StatsLogReport report = outputStreamToProto(&output);
+//    EXPECT_TRUE(report.has_value_metrics());
+//    EXPECT_EQ(5, report.value_metrics().data_size());
+//
+//    auto data = report.value_metrics().data(0);
+//    EXPECT_EQ(1, data.bucket_info_size());
+//    EXPECT_EQ(4, report.value_metrics().data(0).bucket_info(0).values(0).value_long());
+//    EXPECT_EQ(UID_PROCESS_STATE_ATOM_ID, data.slice_by_state(0).atom_id());
+//    EXPECT_TRUE(data.slice_by_state(0).has_value());
+//    EXPECT_EQ(android::app::ProcessStateEnum::PROCESS_STATE_IMPORTANT_BACKGROUND,
+//              data.slice_by_state(0).value());
+//
+//    data = report.value_metrics().data(1);
+//    EXPECT_EQ(1, report.value_metrics().data(1).bucket_info_size());
+//    EXPECT_EQ(2, report.value_metrics().data(1).bucket_info(0).values(0).value_long());
+//
+//    data = report.value_metrics().data(2);
+//    EXPECT_EQ(UID_PROCESS_STATE_ATOM_ID, data.slice_by_state(0).atom_id());
+//    EXPECT_TRUE(data.slice_by_state(0).has_value());
+//    EXPECT_EQ(android::app::ProcessStateEnum::PROCESS_STATE_IMPORTANT_FOREGROUND,
+//              data.slice_by_state(0).value());
+//    EXPECT_EQ(2, report.value_metrics().data(2).bucket_info_size());
+//    EXPECT_EQ(4, report.value_metrics().data(2).bucket_info(0).values(0).value_long());
+//    EXPECT_EQ(7, report.value_metrics().data(2).bucket_info(1).values(0).value_long());
+//
+//    data = report.value_metrics().data(3);
+//    EXPECT_EQ(1, report.value_metrics().data(3).bucket_info_size());
+//    EXPECT_EQ(3, report.value_metrics().data(3).bucket_info(0).values(0).value_long());
+//
+//    data = report.value_metrics().data(4);
+//    EXPECT_EQ(UID_PROCESS_STATE_ATOM_ID, data.slice_by_state(0).atom_id());
+//    EXPECT_TRUE(data.slice_by_state(0).has_value());
+//    EXPECT_EQ(android::app::ProcessStateEnum::PROCESS_STATE_IMPORTANT_BACKGROUND,
+//              data.slice_by_state(0).value());
+//    EXPECT_EQ(2, report.value_metrics().data(4).bucket_info_size());
+//    EXPECT_EQ(6, report.value_metrics().data(4).bucket_info(0).values(0).value_long());
+//    EXPECT_EQ(5, report.value_metrics().data(4).bucket_info(1).values(0).value_long());
+//}
 
 }  // namespace statsd
 }  // namespace os
diff --git a/cmds/statsd/tests/shell/ShellSubscriber_test.cpp b/cmds/statsd/tests/shell/ShellSubscriber_test.cpp
index dac5f33..57e4265 100644
--- a/cmds/statsd/tests/shell/ShellSubscriber_test.cpp
+++ b/cmds/statsd/tests/shell/ShellSubscriber_test.cpp
@@ -105,29 +105,30 @@
     close(fds_data[0]);
 }
 
-TEST(ShellSubscriberTest, testPushedSubscription) {
-    sp<MockUidMap> uidMap = new NaggyMock<MockUidMap>();
-
-    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
-    vector<std::shared_ptr<LogEvent>> pushedList;
-
-    std::shared_ptr<LogEvent> event1 =
-            std::make_shared<LogEvent>(29 /*screen_state_atom_id*/, 1000 /*timestamp*/);
-    event1->write(::android::view::DisplayStateEnum::DISPLAY_STATE_ON);
-    event1->init();
-    pushedList.push_back(event1);
-
-    // create a simple config to get screen events
-    ShellSubscription config;
-    config.add_pushed()->set_atom_id(29);
-
-    // this is the expected screen event atom.
-    ShellData shellData;
-    shellData.add_atom()->mutable_screen_state_changed()->set_state(
-            ::android::view::DisplayStateEnum::DISPLAY_STATE_ON);
-
-    runShellTest(config, uidMap, pullerManager, pushedList, shellData);
-}
+// TODO(b/149590301): Update this test to use new socket schema.
+//TEST(ShellSubscriberTest, testPushedSubscription) {
+//    sp<MockUidMap> uidMap = new NaggyMock<MockUidMap>();
+//
+//    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
+//    vector<std::shared_ptr<LogEvent>> pushedList;
+//
+//    std::shared_ptr<LogEvent> event1 =
+//            std::make_shared<LogEvent>(29 /*screen_state_atom_id*/, 1000 /*timestamp*/);
+//    event1->write(::android::view::DisplayStateEnum::DISPLAY_STATE_ON);
+//    event1->init();
+//    pushedList.push_back(event1);
+//
+//    // create a simple config to get screen events
+//    ShellSubscription config;
+//    config.add_pushed()->set_atom_id(29);
+//
+//    // this is the expected screen event atom.
+//    ShellData shellData;
+//    shellData.add_atom()->mutable_screen_state_changed()->set_state(
+//            ::android::view::DisplayStateEnum::DISPLAY_STATE_ON);
+//
+//    runShellTest(config, uidMap, pullerManager, pushedList, shellData);
+//}
 
 namespace {
 
@@ -160,30 +161,31 @@
 
 }  // namespace
 
-TEST(ShellSubscriberTest, testPulledSubscription) {
-    sp<MockUidMap> uidMap = new NaggyMock<MockUidMap>();
-
-    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
-    EXPECT_CALL(*pullerManager, Pull(10016, _))
-            .WillRepeatedly(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
-                data->clear();
-                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, 1111L);
-                event->write(kUid1);
-                event->write(kCpuTime1);
-                event->init();
-                data->push_back(event);
-                // another event
-                event = make_shared<LogEvent>(tagId, 1111L);
-                event->write(kUid2);
-                event->write(kCpuTime2);
-                event->init();
-                data->push_back(event);
-                return true;
-            }));
-
-    runShellTest(getPulledConfig(), uidMap, pullerManager, vector<std::shared_ptr<LogEvent>>(),
-                 getExpectedShellData());
-}
+// TODO(b/149590301): Update this test to use new socket schema.
+//TEST(ShellSubscriberTest, testPulledSubscription) {
+//    sp<MockUidMap> uidMap = new NaggyMock<MockUidMap>();
+//
+//    sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
+//    EXPECT_CALL(*pullerManager, Pull(10016, _))
+//            .WillRepeatedly(Invoke([](int tagId, vector<std::shared_ptr<LogEvent>>* data) {
+//                data->clear();
+//                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, 1111L);
+//                event->write(kUid1);
+//                event->write(kCpuTime1);
+//                event->init();
+//                data->push_back(event);
+//                // another event
+//                event = make_shared<LogEvent>(tagId, 1111L);
+//                event->write(kUid2);
+//                event->write(kCpuTime2);
+//                event->init();
+//                data->push_back(event);
+//                return true;
+//            }));
+//
+//    runShellTest(getPulledConfig(), uidMap, pullerManager, vector<std::shared_ptr<LogEvent>>(),
+//                 getExpectedShellData());
+//}
 
 #else
 GTEST_LOG_(INFO) << "This test does nothing.\n";
diff --git a/cmds/statsd/tests/state/StateTracker_test.cpp b/cmds/statsd/tests/state/StateTracker_test.cpp
index b0acd5a..36c0f32 100644
--- a/cmds/statsd/tests/state/StateTracker_test.cpp
+++ b/cmds/statsd/tests/state/StateTracker_test.cpp
@@ -56,94 +56,95 @@
     return output.mValue.int_value;
 }
 
-// START: build event functions.
-// State with no primary fields - ScreenStateChanged
-std::shared_ptr<LogEvent> buildScreenEvent(int state) {
-    std::shared_ptr<LogEvent> event =
-            std::make_shared<LogEvent>(android::util::SCREEN_STATE_CHANGED, 1000 /*timestamp*/);
-    event->write((int32_t)state);
-    event->init();
-    return event;
-}
-
-// State with one primary field - UidProcessStateChanged
-std::shared_ptr<LogEvent> buildUidProcessEvent(int uid, int state) {
-    std::shared_ptr<LogEvent> event =
-            std::make_shared<LogEvent>(android::util::UID_PROCESS_STATE_CHANGED, 1000 /*timestamp*/);
-    event->write((int32_t)uid);
-    event->write((int32_t)state);
-    event->init();
-    return event;
-}
-
-// State with first uid in attribution chain as primary field - WakelockStateChanged
-std::shared_ptr<LogEvent> buildPartialWakelockEvent(int uid, const std::string& tag, bool acquire) {
-    std::vector<AttributionNodeInternal> chain;
-    chain.push_back(AttributionNodeInternal());
-    AttributionNodeInternal& attr = chain.back();
-    attr.set_uid(uid);
-
-    std::shared_ptr<LogEvent> event =
-            std::make_shared<LogEvent>(android::util::WAKELOCK_STATE_CHANGED, 1000 /* timestamp */);
-    event->write(chain);
-    event->write((int32_t)1);  // PARTIAL_WAKE_LOCK
-    event->write(tag);
-    event->write(acquire ? 1 : 0);
-    event->init();
-    return event;
-}
-
-// State with multiple primary fields - OverlayStateChanged
-std::shared_ptr<LogEvent> buildOverlayEvent(int uid, const std::string& packageName, int state) {
-    std::shared_ptr<LogEvent> event =
-            std::make_shared<LogEvent>(android::util::OVERLAY_STATE_CHANGED, 1000 /*timestamp*/);
-    event->write((int32_t)uid);
-    event->write(packageName);
-    event->write(true);  // using_alert_window
-    event->write((int32_t)state);
-    event->init();
-    return event;
-}
-
-// Incorrect event - missing fields
-std::shared_ptr<LogEvent> buildIncorrectOverlayEvent(int uid, const std::string& packageName, int state) {
-    std::shared_ptr<LogEvent> event =
-            std::make_shared<LogEvent>(android::util::OVERLAY_STATE_CHANGED, 1000 /*timestamp*/);
-    event->write((int32_t)uid);
-    event->write(packageName);
-    event->write((int32_t)state);
-    event->init();
-    return event;
-}
-
-// Incorrect event - exclusive state has wrong type
-std::shared_ptr<LogEvent> buildOverlayEventBadStateType(int uid, const std::string& packageName) {
-    std::shared_ptr<LogEvent> event =
-            std::make_shared<LogEvent>(android::util::OVERLAY_STATE_CHANGED, 1000 /*timestamp*/);
-    event->write((int32_t)uid);
-    event->write(packageName);
-    event->write(true);
-    event->write("string");  // exclusive state: string instead of int
-    event->init();
-    return event;
-}
-
-std::shared_ptr<LogEvent> buildBleScanEvent(int uid, bool acquire, bool reset) {
-    std::vector<AttributionNodeInternal> chain;
-    chain.push_back(AttributionNodeInternal());
-    AttributionNodeInternal& attr = chain.back();
-    attr.set_uid(uid);
-
-    std::shared_ptr<LogEvent> event =
-            std::make_shared<LogEvent>(android::util::BLE_SCAN_STATE_CHANGED, 1000);
-    event->write(chain);
-    event->write(reset ? 2 : acquire ? 1 : 0);  // PARTIAL_WAKE_LOCK
-    event->write(0);                            // filtered
-    event->write(0);                            // first match
-    event->write(0);                            // opportunistic
-    event->init();
-    return event;
-}
+// TODO(b/149590301): Update these helpers to use new socket schema.
+//// START: build event functions.
+//// State with no primary fields - ScreenStateChanged
+//std::shared_ptr<LogEvent> buildScreenEvent(int state) {
+//    std::shared_ptr<LogEvent> event =
+//            std::make_shared<LogEvent>(android::util::SCREEN_STATE_CHANGED, 1000 /*timestamp*/);
+//    event->write((int32_t)state);
+//    event->init();
+//    return event;
+//}
+//
+//// State with one primary field - UidProcessStateChanged
+//std::shared_ptr<LogEvent> buildUidProcessEvent(int uid, int state) {
+//    std::shared_ptr<LogEvent> event =
+//            std::make_shared<LogEvent>(android::util::UID_PROCESS_STATE_CHANGED, 1000 /*timestamp*/);
+//    event->write((int32_t)uid);
+//    event->write((int32_t)state);
+//    event->init();
+//    return event;
+//}
+//
+//// State with first uid in attribution chain as primary field - WakelockStateChanged
+//std::shared_ptr<LogEvent> buildPartialWakelockEvent(int uid, const std::string& tag, bool acquire) {
+//    std::vector<AttributionNodeInternal> chain;
+//    chain.push_back(AttributionNodeInternal());
+//    AttributionNodeInternal& attr = chain.back();
+//    attr.set_uid(uid);
+//
+//    std::shared_ptr<LogEvent> event =
+//            std::make_shared<LogEvent>(android::util::WAKELOCK_STATE_CHANGED, 1000 /* timestamp */);
+//    event->write(chain);
+//    event->write((int32_t)1);  // PARTIAL_WAKE_LOCK
+//    event->write(tag);
+//    event->write(acquire ? 1 : 0);
+//    event->init();
+//    return event;
+//}
+//
+//// State with multiple primary fields - OverlayStateChanged
+//std::shared_ptr<LogEvent> buildOverlayEvent(int uid, const std::string& packageName, int state) {
+//    std::shared_ptr<LogEvent> event =
+//            std::make_shared<LogEvent>(android::util::OVERLAY_STATE_CHANGED, 1000 /*timestamp*/);
+//    event->write((int32_t)uid);
+//    event->write(packageName);
+//    event->write(true);  // using_alert_window
+//    event->write((int32_t)state);
+//    event->init();
+//    return event;
+//}
+//
+//// Incorrect event - missing fields
+//std::shared_ptr<LogEvent> buildIncorrectOverlayEvent(int uid, const std::string& packageName, int state) {
+//    std::shared_ptr<LogEvent> event =
+//            std::make_shared<LogEvent>(android::util::OVERLAY_STATE_CHANGED, 1000 /*timestamp*/);
+//    event->write((int32_t)uid);
+//    event->write(packageName);
+//    event->write((int32_t)state);
+//    event->init();
+//    return event;
+//}
+//
+//// Incorrect event - exclusive state has wrong type
+//std::shared_ptr<LogEvent> buildOverlayEventBadStateType(int uid, const std::string& packageName) {
+//    std::shared_ptr<LogEvent> event =
+//            std::make_shared<LogEvent>(android::util::OVERLAY_STATE_CHANGED, 1000 /*timestamp*/);
+//    event->write((int32_t)uid);
+//    event->write(packageName);
+//    event->write(true);
+//    event->write("string");  // exclusive state: string instead of int
+//    event->init();
+//    return event;
+//}
+//
+//std::shared_ptr<LogEvent> buildBleScanEvent(int uid, bool acquire, bool reset) {
+//    std::vector<AttributionNodeInternal> chain;
+//    chain.push_back(AttributionNodeInternal());
+//    AttributionNodeInternal& attr = chain.back();
+//    attr.set_uid(uid);
+//
+//    std::shared_ptr<LogEvent> event =
+//            std::make_shared<LogEvent>(android::util::BLE_SCAN_STATE_CHANGED, 1000);
+//    event->write(chain);
+//    event->write(reset ? 2 : acquire ? 1 : 0);  // PARTIAL_WAKE_LOCK
+//    event->write(0);                            // filtered
+//    event->write(0);                            // first match
+//    event->write(0);                            // opportunistic
+//    event->init();
+//    return event;
+//}
 // END: build event functions.
 
 // START: get primary key functions
@@ -292,302 +293,302 @@
     EXPECT_EQ(0, mgr.getStateTrackersCount());
     EXPECT_EQ(-1, mgr.getListenersCount(android::util::SCREEN_STATE_CHANGED));
 }
-
-/**
- * Test a binary state atom with nested counting.
- *
- * To go from an "ON" state to an "OFF" state with nested counting, we must see
- * an equal number of "OFF" events as "ON" events.
- * For example, ACQUIRE, ACQUIRE, RELEASE will still be in the ACQUIRE state.
- * ACQUIRE, ACQUIRE, RELEASE, RELEASE will be in the RELEASE state.
- */
-TEST(StateTrackerTest, TestStateChangeNested) {
-    sp<TestStateListener> listener = new TestStateListener();
-    StateManager mgr;
-    mgr.registerListener(android::util::WAKELOCK_STATE_CHANGED, listener);
-
-    std::shared_ptr<LogEvent> event1 =
-            buildPartialWakelockEvent(1000 /* uid */, "tag", true /*acquire*/);
-    mgr.onLogEvent(*event1);
-    EXPECT_EQ(1, listener->updates.size());
-    EXPECT_EQ(1000, listener->updates[0].mKey.getValues()[0].mValue.int_value);
-    EXPECT_EQ(1, listener->updates[0].mState);
-    listener->updates.clear();
-
-    std::shared_ptr<LogEvent> event2 =
-            buildPartialWakelockEvent(1000 /* uid */, "tag", true /*acquire*/);
-    mgr.onLogEvent(*event2);
-    EXPECT_EQ(0, listener->updates.size());
-
-    std::shared_ptr<LogEvent> event3 =
-            buildPartialWakelockEvent(1000 /* uid */, "tag", false /*release*/);
-    mgr.onLogEvent(*event3);
-    EXPECT_EQ(0, listener->updates.size());
-
-    std::shared_ptr<LogEvent> event4 =
-            buildPartialWakelockEvent(1000 /* uid */, "tag", false /*release*/);
-    mgr.onLogEvent(*event4);
-    EXPECT_EQ(1, listener->updates.size());
-    EXPECT_EQ(1000, listener->updates[0].mKey.getValues()[0].mValue.int_value);
-    EXPECT_EQ(0, listener->updates[0].mState);
-}
-
-/**
- * Test a state atom with a reset state.
- *
- * If the reset state value is seen, every state in the map is set to the default
- * state and every listener is notified.
- */
-TEST(StateTrackerTest, TestStateChangeReset) {
-    sp<TestStateListener> listener = new TestStateListener();
-    StateManager mgr;
-    mgr.registerListener(android::util::BLE_SCAN_STATE_CHANGED, listener);
-
-    std::shared_ptr<LogEvent> event1 =
-            buildBleScanEvent(1000 /* uid */, true /*acquire*/, false /*reset*/);
-    mgr.onLogEvent(*event1);
-    EXPECT_EQ(1, listener->updates.size());
-    EXPECT_EQ(1000, listener->updates[0].mKey.getValues()[0].mValue.int_value);
-    EXPECT_EQ(BleScanStateChanged::ON, listener->updates[0].mState);
-    listener->updates.clear();
-
-    std::shared_ptr<LogEvent> event2 =
-            buildBleScanEvent(2000 /* uid */, true /*acquire*/, false /*reset*/);
-    mgr.onLogEvent(*event2);
-    EXPECT_EQ(1, listener->updates.size());
-    EXPECT_EQ(2000, listener->updates[0].mKey.getValues()[0].mValue.int_value);
-    EXPECT_EQ(BleScanStateChanged::ON, listener->updates[0].mState);
-    listener->updates.clear();
-
-    std::shared_ptr<LogEvent> event3 =
-            buildBleScanEvent(2000 /* uid */, false /*acquire*/, true /*reset*/);
-    mgr.onLogEvent(*event3);
-    EXPECT_EQ(2, listener->updates.size());
-    EXPECT_EQ(BleScanStateChanged::OFF, listener->updates[0].mState);
-    EXPECT_EQ(BleScanStateChanged::OFF, listener->updates[1].mState);
-}
-
-/**
- * Test StateManager's onLogEvent and StateListener's onStateChanged correctly
- * updates listener for states without primary keys.
- */
-TEST(StateTrackerTest, TestStateChangeNoPrimaryFields) {
-    sp<TestStateListener> listener1 = new TestStateListener();
-    StateManager mgr;
-    mgr.registerListener(android::util::SCREEN_STATE_CHANGED, listener1);
-
-    // log event
-    std::shared_ptr<LogEvent> event =
-            buildScreenEvent(android::view::DisplayStateEnum::DISPLAY_STATE_ON);
-    mgr.onLogEvent(*event);
-
-    // check listener was updated
-    EXPECT_EQ(1, listener1->updates.size());
-    EXPECT_EQ(DEFAULT_DIMENSION_KEY, listener1->updates[0].mKey);
-    EXPECT_EQ(2, listener1->updates[0].mState);
-
-    // check StateTracker was updated by querying for state
-    HashableDimensionKey queryKey = DEFAULT_DIMENSION_KEY;
-    EXPECT_EQ(android::view::DisplayStateEnum::DISPLAY_STATE_ON,
-              getStateInt(mgr, android::util::SCREEN_STATE_CHANGED, queryKey));
-}
-
-/**
- * Test StateManager's onLogEvent and StateListener's onStateChanged correctly
- * updates listener for states with one primary key.
- */
-TEST(StateTrackerTest, TestStateChangeOnePrimaryField) {
-    sp<TestStateListener> listener1 = new TestStateListener();
-    StateManager mgr;
-    mgr.registerListener(android::util::UID_PROCESS_STATE_CHANGED, listener1);
-
-    // log event
-    std::shared_ptr<LogEvent> event =
-            buildUidProcessEvent(1000 /* uid */, android::app::ProcessStateEnum::PROCESS_STATE_TOP);
-    mgr.onLogEvent(*event);
-
-    // check listener was updated
-    EXPECT_EQ(1, listener1->updates.size());
-    EXPECT_EQ(1000, listener1->updates[0].mKey.getValues()[0].mValue.int_value);
-    EXPECT_EQ(1002, listener1->updates[0].mState);
-
-    // check StateTracker was updated by querying for state
-    HashableDimensionKey queryKey;
-    getUidProcessKey(1000 /* uid */, &queryKey);
-    EXPECT_EQ(android::app::ProcessStateEnum::PROCESS_STATE_TOP,
-              getStateInt(mgr, android::util::UID_PROCESS_STATE_CHANGED, queryKey));
-}
-
-TEST(StateTrackerTest, TestStateChangePrimaryFieldAttrChain) {
-    sp<TestStateListener> listener1 = new TestStateListener();
-    StateManager mgr;
-    mgr.registerListener(android::util::WAKELOCK_STATE_CHANGED, listener1);
-
-    // Log event.
-    std::shared_ptr<LogEvent> event =
-            buildPartialWakelockEvent(1001 /* uid */, "tag1", true /* acquire */);
-    mgr.onLogEvent(*event);
-
-    EXPECT_EQ(1, mgr.getStateTrackersCount());
-    EXPECT_EQ(1, mgr.getListenersCount(android::util::WAKELOCK_STATE_CHANGED));
-
-    // Check listener was updated.
-    EXPECT_EQ(1, listener1->updates.size());
-    EXPECT_EQ(3, listener1->updates[0].mKey.getValues().size());
-    EXPECT_EQ(1001, listener1->updates[0].mKey.getValues()[0].mValue.int_value);
-    EXPECT_EQ(1, listener1->updates[0].mKey.getValues()[1].mValue.int_value);
-    EXPECT_EQ("tag1", listener1->updates[0].mKey.getValues()[2].mValue.str_value);
-    EXPECT_EQ(WakelockStateChanged::ACQUIRE, listener1->updates[0].mState);
-
-    // Check StateTracker was updated by querying for state.
-    HashableDimensionKey queryKey;
-    getPartialWakelockKey(1001 /* uid */, "tag1", &queryKey);
-    EXPECT_EQ(WakelockStateChanged::ACQUIRE,
-              getStateInt(mgr, android::util::WAKELOCK_STATE_CHANGED, queryKey));
-
-    // No state stored for this query key.
-    HashableDimensionKey queryKey2;
-    getPartialWakelockKey(1002 /* uid */, "tag1", &queryKey2);
-    EXPECT_EQ(WakelockStateChanged::RELEASE,
-              getStateInt(mgr, android::util::WAKELOCK_STATE_CHANGED, queryKey2));
-
-    // Partial query fails.
-    HashableDimensionKey queryKey3;
-    getPartialWakelockKey(1001 /* uid */, &queryKey3);
-    EXPECT_EQ(WakelockStateChanged::RELEASE,
-              getStateInt(mgr, android::util::WAKELOCK_STATE_CHANGED, queryKey3));
-}
-
-/**
- * Test StateManager's onLogEvent and StateListener's onStateChanged correctly
- * updates listener for states with multiple primary keys.
- */
-TEST(StateTrackerTest, TestStateChangeMultiplePrimaryFields) {
-    sp<TestStateListener> listener1 = new TestStateListener();
-    StateManager mgr;
-    mgr.registerListener(android::util::OVERLAY_STATE_CHANGED, listener1);
-
-    // log event
-    std::shared_ptr<LogEvent> event =
-            buildOverlayEvent(1000 /* uid */, "package1", 1);  // state: ENTERED
-    mgr.onLogEvent(*event);
-
-    // check listener was updated
-    EXPECT_EQ(1, listener1->updates.size());
-    EXPECT_EQ(1000, listener1->updates[0].mKey.getValues()[0].mValue.int_value);
-    EXPECT_EQ(1, listener1->updates[0].mState);
-
-    // check StateTracker was updated by querying for state
-    HashableDimensionKey queryKey;
-    getOverlayKey(1000 /* uid */, "package1", &queryKey);
-    EXPECT_EQ(OverlayStateChanged::ENTERED,
-              getStateInt(mgr, android::util::OVERLAY_STATE_CHANGED, queryKey));
-}
-
-/**
- * Test StateManager's onLogEvent and StateListener's onStateChanged
- * when there is an error extracting state from log event. Listener is not
- * updated of state change.
- */
-TEST(StateTrackerTest, TestStateChangeEventError) {
-    sp<TestStateListener> listener1 = new TestStateListener();
-    StateManager mgr;
-    mgr.registerListener(android::util::OVERLAY_STATE_CHANGED, listener1);
-
-    // log event
-    std::shared_ptr<LogEvent> event1 =
-            buildIncorrectOverlayEvent(1000 /* uid */, "package1", 1 /* state */);
-    std::shared_ptr<LogEvent> event2 = buildOverlayEventBadStateType(1001 /* uid */, "package2");
-
-    // check listener was updated
-    mgr.onLogEvent(*event1);
-    EXPECT_EQ(0, listener1->updates.size());
-    mgr.onLogEvent(*event2);
-    EXPECT_EQ(0, listener1->updates.size());
-}
-
-TEST(StateTrackerTest, TestStateQuery) {
-    sp<TestStateListener> listener1 = new TestStateListener();
-    sp<TestStateListener> listener2 = new TestStateListener();
-    sp<TestStateListener> listener3 = new TestStateListener();
-    sp<TestStateListener> listener4 = new TestStateListener();
-    StateManager mgr;
-    mgr.registerListener(android::util::SCREEN_STATE_CHANGED, listener1);
-    mgr.registerListener(android::util::UID_PROCESS_STATE_CHANGED, listener2);
-    mgr.registerListener(android::util::OVERLAY_STATE_CHANGED, listener3);
-    mgr.registerListener(android::util::WAKELOCK_STATE_CHANGED, listener4);
-
-    std::shared_ptr<LogEvent> event1 = buildUidProcessEvent(
-            1000,
-            android::app::ProcessStateEnum::PROCESS_STATE_TOP);  //  state value: 1002
-    std::shared_ptr<LogEvent> event2 = buildUidProcessEvent(
-            1001,
-            android::app::ProcessStateEnum::PROCESS_STATE_FOREGROUND_SERVICE);  //  state value:
-                                                                                //  1003
-    std::shared_ptr<LogEvent> event3 = buildUidProcessEvent(
-            1002,
-            android::app::ProcessStateEnum::PROCESS_STATE_PERSISTENT);  //  state value: 1000
-    std::shared_ptr<LogEvent> event4 = buildUidProcessEvent(
-            1001,
-            android::app::ProcessStateEnum::PROCESS_STATE_TOP);  //  state value: 1002
-    std::shared_ptr<LogEvent> event5 =
-            buildScreenEvent(android::view::DisplayStateEnum::DISPLAY_STATE_ON);
-    std::shared_ptr<LogEvent> event6 =
-            buildOverlayEvent(1000, "package1", OverlayStateChanged::ENTERED);
-    std::shared_ptr<LogEvent> event7 =
-            buildOverlayEvent(1000, "package2", OverlayStateChanged::EXITED);
-    std::shared_ptr<LogEvent> event8 = buildPartialWakelockEvent(1005, "tag1", true);
-    std::shared_ptr<LogEvent> event9 = buildPartialWakelockEvent(1005, "tag2", false);
-
-    mgr.onLogEvent(*event1);
-    mgr.onLogEvent(*event2);
-    mgr.onLogEvent(*event3);
-    mgr.onLogEvent(*event5);
-    mgr.onLogEvent(*event5);
-    mgr.onLogEvent(*event6);
-    mgr.onLogEvent(*event7);
-    mgr.onLogEvent(*event8);
-    mgr.onLogEvent(*event9);
-
-    // Query for UidProcessState of uid 1001
-    HashableDimensionKey queryKey1;
-    getUidProcessKey(1001, &queryKey1);
-    EXPECT_EQ(android::app::ProcessStateEnum::PROCESS_STATE_FOREGROUND_SERVICE,
-              getStateInt(mgr, android::util::UID_PROCESS_STATE_CHANGED, queryKey1));
-
-    // Query for UidProcessState of uid 1004 - not in state map
-    HashableDimensionKey queryKey2;
-    getUidProcessKey(1004, &queryKey2);
-    EXPECT_EQ(-1, getStateInt(mgr, android::util::UID_PROCESS_STATE_CHANGED,
-                              queryKey2));  // default state
-
-    // Query for UidProcessState of uid 1001 - after change in state
-    mgr.onLogEvent(*event4);
-    EXPECT_EQ(android::app::ProcessStateEnum::PROCESS_STATE_TOP,
-              getStateInt(mgr, android::util::UID_PROCESS_STATE_CHANGED, queryKey1));
-
-    // Query for ScreenState
-    EXPECT_EQ(android::view::DisplayStateEnum::DISPLAY_STATE_ON,
-              getStateInt(mgr, android::util::SCREEN_STATE_CHANGED, DEFAULT_DIMENSION_KEY));
-
-    // Query for OverlayState of uid 1000, package name "package2"
-    HashableDimensionKey queryKey3;
-    getOverlayKey(1000, "package2", &queryKey3);
-    EXPECT_EQ(OverlayStateChanged::EXITED,
-              getStateInt(mgr, android::util::OVERLAY_STATE_CHANGED, queryKey3));
-
-    // Query for WakelockState of uid 1005, tag 2
-    HashableDimensionKey queryKey4;
-    getPartialWakelockKey(1005, "tag2", &queryKey4);
-    EXPECT_EQ(WakelockStateChanged::RELEASE,
-              getStateInt(mgr, android::util::WAKELOCK_STATE_CHANGED, queryKey4));
-
-    // Query for WakelockState of uid 1005, tag 1
-    HashableDimensionKey queryKey5;
-    getPartialWakelockKey(1005, "tag1", &queryKey5);
-    EXPECT_EQ(WakelockStateChanged::ACQUIRE,
-              getStateInt(mgr, android::util::WAKELOCK_STATE_CHANGED, queryKey5));
-}
+// TODO(b/149590301): Update these tests to use new socket schema.
+///**
+// * Test a binary state atom with nested counting.
+// *
+// * To go from an "ON" state to an "OFF" state with nested counting, we must see
+// * an equal number of "OFF" events as "ON" events.
+// * For example, ACQUIRE, ACQUIRE, RELEASE will still be in the ACQUIRE state.
+// * ACQUIRE, ACQUIRE, RELEASE, RELEASE will be in the RELEASE state.
+// */
+//TEST(StateTrackerTest, TestStateChangeNested) {
+//    sp<TestStateListener> listener = new TestStateListener();
+//    StateManager mgr;
+//    mgr.registerListener(android::util::WAKELOCK_STATE_CHANGED, listener);
+//
+//    std::shared_ptr<LogEvent> event1 =
+//            buildPartialWakelockEvent(1000 /* uid */, "tag", true /*acquire*/);
+//    mgr.onLogEvent(*event1);
+//    EXPECT_EQ(1, listener->updates.size());
+//    EXPECT_EQ(1000, listener->updates[0].mKey.getValues()[0].mValue.int_value);
+//    EXPECT_EQ(1, listener->updates[0].mState);
+//    listener->updates.clear();
+//
+//    std::shared_ptr<LogEvent> event2 =
+//            buildPartialWakelockEvent(1000 /* uid */, "tag", true /*acquire*/);
+//    mgr.onLogEvent(*event2);
+//    EXPECT_EQ(0, listener->updates.size());
+//
+//    std::shared_ptr<LogEvent> event3 =
+//            buildPartialWakelockEvent(1000 /* uid */, "tag", false /*release*/);
+//    mgr.onLogEvent(*event3);
+//    EXPECT_EQ(0, listener->updates.size());
+//
+//    std::shared_ptr<LogEvent> event4 =
+//            buildPartialWakelockEvent(1000 /* uid */, "tag", false /*release*/);
+//    mgr.onLogEvent(*event4);
+//    EXPECT_EQ(1, listener->updates.size());
+//    EXPECT_EQ(1000, listener->updates[0].mKey.getValues()[0].mValue.int_value);
+//    EXPECT_EQ(0, listener->updates[0].mState);
+//}
+//
+///**
+// * Test a state atom with a reset state.
+// *
+// * If the reset state value is seen, every state in the map is set to the default
+// * state and every listener is notified.
+// */
+//TEST(StateTrackerTest, TestStateChangeReset) {
+//    sp<TestStateListener> listener = new TestStateListener();
+//    StateManager mgr;
+//    mgr.registerListener(android::util::BLE_SCAN_STATE_CHANGED, listener);
+//
+//    std::shared_ptr<LogEvent> event1 =
+//            buildBleScanEvent(1000 /* uid */, true /*acquire*/, false /*reset*/);
+//    mgr.onLogEvent(*event1);
+//    EXPECT_EQ(1, listener->updates.size());
+//    EXPECT_EQ(1000, listener->updates[0].mKey.getValues()[0].mValue.int_value);
+//    EXPECT_EQ(BleScanStateChanged::ON, listener->updates[0].mState);
+//    listener->updates.clear();
+//
+//    std::shared_ptr<LogEvent> event2 =
+//            buildBleScanEvent(2000 /* uid */, true /*acquire*/, false /*reset*/);
+//    mgr.onLogEvent(*event2);
+//    EXPECT_EQ(1, listener->updates.size());
+//    EXPECT_EQ(2000, listener->updates[0].mKey.getValues()[0].mValue.int_value);
+//    EXPECT_EQ(BleScanStateChanged::ON, listener->updates[0].mState);
+//    listener->updates.clear();
+//
+//    std::shared_ptr<LogEvent> event3 =
+//            buildBleScanEvent(2000 /* uid */, false /*acquire*/, true /*reset*/);
+//    mgr.onLogEvent(*event3);
+//    EXPECT_EQ(2, listener->updates.size());
+//    EXPECT_EQ(BleScanStateChanged::OFF, listener->updates[0].mState);
+//    EXPECT_EQ(BleScanStateChanged::OFF, listener->updates[1].mState);
+//}
+//
+///**
+// * Test StateManager's onLogEvent and StateListener's onStateChanged correctly
+// * updates listener for states without primary keys.
+// */
+//TEST(StateTrackerTest, TestStateChangeNoPrimaryFields) {
+//    sp<TestStateListener> listener1 = new TestStateListener();
+//    StateManager mgr;
+//    mgr.registerListener(android::util::SCREEN_STATE_CHANGED, listener1);
+//
+//    // log event
+//    std::shared_ptr<LogEvent> event =
+//            buildScreenEvent(android::view::DisplayStateEnum::DISPLAY_STATE_ON);
+//    mgr.onLogEvent(*event);
+//
+//    // check listener was updated
+//    EXPECT_EQ(1, listener1->updates.size());
+//    EXPECT_EQ(DEFAULT_DIMENSION_KEY, listener1->updates[0].mKey);
+//    EXPECT_EQ(2, listener1->updates[0].mState);
+//
+//    // check StateTracker was updated by querying for state
+//    HashableDimensionKey queryKey = DEFAULT_DIMENSION_KEY;
+//    EXPECT_EQ(android::view::DisplayStateEnum::DISPLAY_STATE_ON,
+//              getStateInt(mgr, android::util::SCREEN_STATE_CHANGED, queryKey));
+//}
+//
+///**
+// * Test StateManager's onLogEvent and StateListener's onStateChanged correctly
+// * updates listener for states with one primary key.
+// */
+//TEST(StateTrackerTest, TestStateChangeOnePrimaryField) {
+//    sp<TestStateListener> listener1 = new TestStateListener();
+//    StateManager mgr;
+//    mgr.registerListener(android::util::UID_PROCESS_STATE_CHANGED, listener1);
+//
+//    // log event
+//    std::shared_ptr<LogEvent> event =
+//            buildUidProcessEvent(1000 /* uid */, android::app::ProcessStateEnum::PROCESS_STATE_TOP);
+//    mgr.onLogEvent(*event);
+//
+//    // check listener was updated
+//    EXPECT_EQ(1, listener1->updates.size());
+//    EXPECT_EQ(1000, listener1->updates[0].mKey.getValues()[0].mValue.int_value);
+//    EXPECT_EQ(1002, listener1->updates[0].mState);
+//
+//    // check StateTracker was updated by querying for state
+//    HashableDimensionKey queryKey;
+//    getUidProcessKey(1000 /* uid */, &queryKey);
+//    EXPECT_EQ(android::app::ProcessStateEnum::PROCESS_STATE_TOP,
+//              getStateInt(mgr, android::util::UID_PROCESS_STATE_CHANGED, queryKey));
+//}
+//
+//TEST(StateTrackerTest, TestStateChangePrimaryFieldAttrChain) {
+//    sp<TestStateListener> listener1 = new TestStateListener();
+//    StateManager mgr;
+//    mgr.registerListener(android::util::WAKELOCK_STATE_CHANGED, listener1);
+//
+//    // Log event.
+//    std::shared_ptr<LogEvent> event =
+//            buildPartialWakelockEvent(1001 /* uid */, "tag1", true /* acquire */);
+//    mgr.onLogEvent(*event);
+//
+//    EXPECT_EQ(1, mgr.getStateTrackersCount());
+//    EXPECT_EQ(1, mgr.getListenersCount(android::util::WAKELOCK_STATE_CHANGED));
+//
+//    // Check listener was updated.
+//    EXPECT_EQ(1, listener1->updates.size());
+//    EXPECT_EQ(3, listener1->updates[0].mKey.getValues().size());
+//    EXPECT_EQ(1001, listener1->updates[0].mKey.getValues()[0].mValue.int_value);
+//    EXPECT_EQ(1, listener1->updates[0].mKey.getValues()[1].mValue.int_value);
+//    EXPECT_EQ("tag1", listener1->updates[0].mKey.getValues()[2].mValue.str_value);
+//    EXPECT_EQ(WakelockStateChanged::ACQUIRE, listener1->updates[0].mState);
+//
+//    // Check StateTracker was updated by querying for state.
+//    HashableDimensionKey queryKey;
+//    getPartialWakelockKey(1001 /* uid */, "tag1", &queryKey);
+//    EXPECT_EQ(WakelockStateChanged::ACQUIRE,
+//              getStateInt(mgr, android::util::WAKELOCK_STATE_CHANGED, queryKey));
+//
+//    // No state stored for this query key.
+//    HashableDimensionKey queryKey2;
+//    getPartialWakelockKey(1002 /* uid */, "tag1", &queryKey2);
+//    EXPECT_EQ(WakelockStateChanged::RELEASE,
+//              getStateInt(mgr, android::util::WAKELOCK_STATE_CHANGED, queryKey2));
+//
+//    // Partial query fails.
+//    HashableDimensionKey queryKey3;
+//    getPartialWakelockKey(1001 /* uid */, &queryKey3);
+//    EXPECT_EQ(WakelockStateChanged::RELEASE,
+//              getStateInt(mgr, android::util::WAKELOCK_STATE_CHANGED, queryKey3));
+//}
+//
+///**
+// * Test StateManager's onLogEvent and StateListener's onStateChanged correctly
+// * updates listener for states with multiple primary keys.
+// */
+//TEST(StateTrackerTest, TestStateChangeMultiplePrimaryFields) {
+//    sp<TestStateListener> listener1 = new TestStateListener();
+//    StateManager mgr;
+//    mgr.registerListener(android::util::OVERLAY_STATE_CHANGED, listener1);
+//
+//    // log event
+//    std::shared_ptr<LogEvent> event =
+//            buildOverlayEvent(1000 /* uid */, "package1", 1);  // state: ENTERED
+//    mgr.onLogEvent(*event);
+//
+//    // check listener was updated
+//    EXPECT_EQ(1, listener1->updates.size());
+//    EXPECT_EQ(1000, listener1->updates[0].mKey.getValues()[0].mValue.int_value);
+//    EXPECT_EQ(1, listener1->updates[0].mState);
+//
+//    // check StateTracker was updated by querying for state
+//    HashableDimensionKey queryKey;
+//    getOverlayKey(1000 /* uid */, "package1", &queryKey);
+//    EXPECT_EQ(OverlayStateChanged::ENTERED,
+//              getStateInt(mgr, android::util::OVERLAY_STATE_CHANGED, queryKey));
+//}
+//
+///**
+// * Test StateManager's onLogEvent and StateListener's onStateChanged
+// * when there is an error extracting state from log event. Listener is not
+// * updated of state change.
+// */
+//TEST(StateTrackerTest, TestStateChangeEventError) {
+//    sp<TestStateListener> listener1 = new TestStateListener();
+//    StateManager mgr;
+//    mgr.registerListener(android::util::OVERLAY_STATE_CHANGED, listener1);
+//
+//    // log event
+//    std::shared_ptr<LogEvent> event1 =
+//            buildIncorrectOverlayEvent(1000 /* uid */, "package1", 1 /* state */);
+//    std::shared_ptr<LogEvent> event2 = buildOverlayEventBadStateType(1001 /* uid */, "package2");
+//
+//    // check listener was updated
+//    mgr.onLogEvent(*event1);
+//    EXPECT_EQ(0, listener1->updates.size());
+//    mgr.onLogEvent(*event2);
+//    EXPECT_EQ(0, listener1->updates.size());
+//}
+//
+//TEST(StateTrackerTest, TestStateQuery) {
+//    sp<TestStateListener> listener1 = new TestStateListener();
+//    sp<TestStateListener> listener2 = new TestStateListener();
+//    sp<TestStateListener> listener3 = new TestStateListener();
+//    sp<TestStateListener> listener4 = new TestStateListener();
+//    StateManager mgr;
+//    mgr.registerListener(android::util::SCREEN_STATE_CHANGED, listener1);
+//    mgr.registerListener(android::util::UID_PROCESS_STATE_CHANGED, listener2);
+//    mgr.registerListener(android::util::OVERLAY_STATE_CHANGED, listener3);
+//    mgr.registerListener(android::util::WAKELOCK_STATE_CHANGED, listener4);
+//
+//    std::shared_ptr<LogEvent> event1 = buildUidProcessEvent(
+//            1000,
+//            android::app::ProcessStateEnum::PROCESS_STATE_TOP);  //  state value: 1002
+//    std::shared_ptr<LogEvent> event2 = buildUidProcessEvent(
+//            1001,
+//            android::app::ProcessStateEnum::PROCESS_STATE_FOREGROUND_SERVICE);  //  state value:
+//                                                                                //  1003
+//    std::shared_ptr<LogEvent> event3 = buildUidProcessEvent(
+//            1002,
+//            android::app::ProcessStateEnum::PROCESS_STATE_PERSISTENT);  //  state value: 1000
+//    std::shared_ptr<LogEvent> event4 = buildUidProcessEvent(
+//            1001,
+//            android::app::ProcessStateEnum::PROCESS_STATE_TOP);  //  state value: 1002
+//    std::shared_ptr<LogEvent> event5 =
+//            buildScreenEvent(android::view::DisplayStateEnum::DISPLAY_STATE_ON);
+//    std::shared_ptr<LogEvent> event6 =
+//            buildOverlayEvent(1000, "package1", OverlayStateChanged::ENTERED);
+//    std::shared_ptr<LogEvent> event7 =
+//            buildOverlayEvent(1000, "package2", OverlayStateChanged::EXITED);
+//    std::shared_ptr<LogEvent> event8 = buildPartialWakelockEvent(1005, "tag1", true);
+//    std::shared_ptr<LogEvent> event9 = buildPartialWakelockEvent(1005, "tag2", false);
+//
+//    mgr.onLogEvent(*event1);
+//    mgr.onLogEvent(*event2);
+//    mgr.onLogEvent(*event3);
+//    mgr.onLogEvent(*event5);
+//    mgr.onLogEvent(*event5);
+//    mgr.onLogEvent(*event6);
+//    mgr.onLogEvent(*event7);
+//    mgr.onLogEvent(*event8);
+//    mgr.onLogEvent(*event9);
+//
+//    // Query for UidProcessState of uid 1001
+//    HashableDimensionKey queryKey1;
+//    getUidProcessKey(1001, &queryKey1);
+//    EXPECT_EQ(android::app::ProcessStateEnum::PROCESS_STATE_FOREGROUND_SERVICE,
+//              getStateInt(mgr, android::util::UID_PROCESS_STATE_CHANGED, queryKey1));
+//
+//    // Query for UidProcessState of uid 1004 - not in state map
+//    HashableDimensionKey queryKey2;
+//    getUidProcessKey(1004, &queryKey2);
+//    EXPECT_EQ(-1, getStateInt(mgr, android::util::UID_PROCESS_STATE_CHANGED,
+//                              queryKey2));  // default state
+//
+//    // Query for UidProcessState of uid 1001 - after change in state
+//    mgr.onLogEvent(*event4);
+//    EXPECT_EQ(android::app::ProcessStateEnum::PROCESS_STATE_TOP,
+//              getStateInt(mgr, android::util::UID_PROCESS_STATE_CHANGED, queryKey1));
+//
+//    // Query for ScreenState
+//    EXPECT_EQ(android::view::DisplayStateEnum::DISPLAY_STATE_ON,
+//              getStateInt(mgr, android::util::SCREEN_STATE_CHANGED, DEFAULT_DIMENSION_KEY));
+//
+//    // Query for OverlayState of uid 1000, package name "package2"
+//    HashableDimensionKey queryKey3;
+//    getOverlayKey(1000, "package2", &queryKey3);
+//    EXPECT_EQ(OverlayStateChanged::EXITED,
+//              getStateInt(mgr, android::util::OVERLAY_STATE_CHANGED, queryKey3));
+//
+//    // Query for WakelockState of uid 1005, tag 2
+//    HashableDimensionKey queryKey4;
+//    getPartialWakelockKey(1005, "tag2", &queryKey4);
+//    EXPECT_EQ(WakelockStateChanged::RELEASE,
+//              getStateInt(mgr, android::util::WAKELOCK_STATE_CHANGED, queryKey4));
+//
+//    // Query for WakelockState of uid 1005, tag 1
+//    HashableDimensionKey queryKey5;
+//    getPartialWakelockKey(1005, "tag1", &queryKey5);
+//    EXPECT_EQ(WakelockStateChanged::ACQUIRE,
+//              getStateInt(mgr, android::util::WAKELOCK_STATE_CHANGED, queryKey5));
+//}
 
 }  // namespace statsd
 }  // namespace os
diff --git a/cmds/statsd/tests/statsd_test_util.cpp b/cmds/statsd/tests/statsd_test_util.cpp
index 6958218..2bfce9b 100644
--- a/cmds/statsd/tests/statsd_test_util.cpp
+++ b/cmds/statsd/tests/statsd_test_util.cpp
@@ -409,180 +409,181 @@
     return dimensions;
 }
 
-std::unique_ptr<LogEvent> CreateScreenStateChangedEvent(
-    const android::view::DisplayStateEnum state, uint64_t timestampNs) {
-    auto event = std::make_unique<LogEvent>(android::util::SCREEN_STATE_CHANGED, timestampNs);
-    EXPECT_TRUE(event->write(state));
-    event->init();
-    return event;
-}
-
-std::unique_ptr<LogEvent> CreateBatterySaverOnEvent(uint64_t timestampNs) {
-    auto event = std::make_unique<LogEvent>(
-        android::util::BATTERY_SAVER_MODE_STATE_CHANGED, timestampNs);
-    EXPECT_TRUE(event->write(BatterySaverModeStateChanged::ON));
-    event->init();
-    return event;
-}
-
-std::unique_ptr<LogEvent> CreateBatterySaverOffEvent(uint64_t timestampNs) {
-    auto event = std::make_unique<LogEvent>(
-        android::util::BATTERY_SAVER_MODE_STATE_CHANGED, timestampNs);
-    EXPECT_TRUE(event->write(BatterySaverModeStateChanged::OFF));
-    event->init();
-    return event;
-}
-
-std::unique_ptr<LogEvent> CreateScreenBrightnessChangedEvent(
-    int level, uint64_t timestampNs) {
-    auto event = std::make_unique<LogEvent>(android::util::SCREEN_BRIGHTNESS_CHANGED, timestampNs);
-    EXPECT_TRUE(event->write(level));
-    event->init();
-    return event;
-
-}
-
-std::unique_ptr<LogEvent> CreateScheduledJobStateChangedEvent(
-        const std::vector<AttributionNodeInternal>& attributions, const string& jobName,
-        const ScheduledJobStateChanged::State state, uint64_t timestampNs) {
-    auto event = std::make_unique<LogEvent>(android::util::SCHEDULED_JOB_STATE_CHANGED, timestampNs);
-    event->write(attributions);
-    event->write(jobName);
-    event->write(state);
-    event->init();
-    return event;
-}
-
-std::unique_ptr<LogEvent> CreateStartScheduledJobEvent(
-    const std::vector<AttributionNodeInternal>& attributions,
-    const string& name, uint64_t timestampNs) {
-    return CreateScheduledJobStateChangedEvent(
-            attributions, name, ScheduledJobStateChanged::STARTED, timestampNs);
-}
-
-// Create log event when scheduled job finishes.
-std::unique_ptr<LogEvent> CreateFinishScheduledJobEvent(
-    const std::vector<AttributionNodeInternal>& attributions,
-    const string& name, uint64_t timestampNs) {
-    return CreateScheduledJobStateChangedEvent(
-            attributions, name, ScheduledJobStateChanged::FINISHED, timestampNs);
-}
-
-std::unique_ptr<LogEvent> CreateWakelockStateChangedEvent(
-        const std::vector<AttributionNodeInternal>& attributions, const string& wakelockName,
-        const WakelockStateChanged::State state, uint64_t timestampNs) {
-    auto event = std::make_unique<LogEvent>(android::util::WAKELOCK_STATE_CHANGED, timestampNs);
-    event->write(attributions);
-    event->write(android::os::WakeLockLevelEnum::PARTIAL_WAKE_LOCK);
-    event->write(wakelockName);
-    event->write(state);
-    event->init();
-    return event;
-}
-
-std::unique_ptr<LogEvent> CreateAcquireWakelockEvent(
-        const std::vector<AttributionNodeInternal>& attributions, const string& wakelockName,
-        uint64_t timestampNs) {
-    return CreateWakelockStateChangedEvent(
-        attributions, wakelockName, WakelockStateChanged::ACQUIRE, timestampNs);
-}
-
-std::unique_ptr<LogEvent> CreateReleaseWakelockEvent(
-        const std::vector<AttributionNodeInternal>& attributions, const string& wakelockName,
-        uint64_t timestampNs) {
-    return CreateWakelockStateChangedEvent(
-        attributions, wakelockName, WakelockStateChanged::RELEASE, timestampNs);
-}
-
-std::unique_ptr<LogEvent> CreateActivityForegroundStateChangedEvent(
-    const int uid, const ActivityForegroundStateChanged::State state, uint64_t timestampNs) {
-    auto event = std::make_unique<LogEvent>(
-        android::util::ACTIVITY_FOREGROUND_STATE_CHANGED, timestampNs);
-    event->write(uid);
-    event->write("pkg_name");
-    event->write("class_name");
-    event->write(state);
-    event->init();
-    return event;
-}
-
-std::unique_ptr<LogEvent> CreateMoveToBackgroundEvent(const int uid, uint64_t timestampNs) {
-    return CreateActivityForegroundStateChangedEvent(
-        uid, ActivityForegroundStateChanged::BACKGROUND, timestampNs);
-}
-
-std::unique_ptr<LogEvent> CreateMoveToForegroundEvent(const int uid, uint64_t timestampNs) {
-    return CreateActivityForegroundStateChangedEvent(
-        uid, ActivityForegroundStateChanged::FOREGROUND, timestampNs);
-}
-
-std::unique_ptr<LogEvent> CreateSyncStateChangedEvent(
-        const std::vector<AttributionNodeInternal>& attributions, const string& name,
-        const SyncStateChanged::State state, uint64_t timestampNs) {
-    auto event = std::make_unique<LogEvent>(android::util::SYNC_STATE_CHANGED, timestampNs);
-    event->write(attributions);
-    event->write(name);
-    event->write(state);
-    event->init();
-    return event;
-}
-
-std::unique_ptr<LogEvent> CreateSyncStartEvent(
-        const std::vector<AttributionNodeInternal>& attributions, const string& name,
-        uint64_t timestampNs) {
-    return CreateSyncStateChangedEvent(attributions, name, SyncStateChanged::ON, timestampNs);
-}
-
-std::unique_ptr<LogEvent> CreateSyncEndEvent(
-        const std::vector<AttributionNodeInternal>& attributions, const string& name,
-        uint64_t timestampNs) {
-    return CreateSyncStateChangedEvent(attributions, name, SyncStateChanged::OFF, timestampNs);
-}
-
-std::unique_ptr<LogEvent> CreateProcessLifeCycleStateChangedEvent(
-    const int uid, const ProcessLifeCycleStateChanged::State state, uint64_t timestampNs) {
-    auto logEvent = std::make_unique<LogEvent>(
-        android::util::PROCESS_LIFE_CYCLE_STATE_CHANGED, timestampNs);
-    logEvent->write(uid);
-    logEvent->write("");
-    logEvent->write(state);
-    logEvent->init();
-    return logEvent;
-}
-
-std::unique_ptr<LogEvent> CreateAppCrashEvent(const int uid, uint64_t timestampNs) {
-    return CreateProcessLifeCycleStateChangedEvent(
-        uid, ProcessLifeCycleStateChanged::CRASHED, timestampNs);
-}
-
-std::unique_ptr<LogEvent> CreateAppCrashOccurredEvent(const int uid, uint64_t timestampNs) {
-    auto event = std::make_unique<LogEvent>(android::util::APP_CRASH_OCCURRED, timestampNs);
-    event->write(uid);
-    event->write("eventType");
-    event->write("processName");
-    event->init();
-    return event;
-}
-
-std::unique_ptr<LogEvent> CreateIsolatedUidChangedEvent(
-    int isolatedUid, int hostUid, bool is_create, uint64_t timestampNs) {
-    auto logEvent = std::make_unique<LogEvent>(
-        android::util::ISOLATED_UID_CHANGED, timestampNs);
-    logEvent->write(hostUid);
-    logEvent->write(isolatedUid);
-    logEvent->write(is_create);
-    logEvent->init();
-    return logEvent;
-}
-
-std::unique_ptr<LogEvent> CreateUidProcessStateChangedEvent(
-        int uid, const android::app::ProcessStateEnum state, uint64_t timestampNs) {
-    auto event = std::make_unique<LogEvent>(android::util::UID_PROCESS_STATE_CHANGED, timestampNs);
-    event->write(uid);
-    event->write(state);
-    event->init();
-    return event;
-}
+// TODO(b/149590301): Update these helpers to use new socket schema.
+//std::unique_ptr<LogEvent> CreateScreenStateChangedEvent(
+//    const android::view::DisplayStateEnum state, uint64_t timestampNs) {
+//    auto event = std::make_unique<LogEvent>(android::util::SCREEN_STATE_CHANGED, timestampNs);
+//    EXPECT_TRUE(event->write(state));
+//    event->init();
+//    return event;
+//}
+//
+//std::unique_ptr<LogEvent> CreateBatterySaverOnEvent(uint64_t timestampNs) {
+//    auto event = std::make_unique<LogEvent>(
+//        android::util::BATTERY_SAVER_MODE_STATE_CHANGED, timestampNs);
+//    EXPECT_TRUE(event->write(BatterySaverModeStateChanged::ON));
+//    event->init();
+//    return event;
+//}
+//
+//std::unique_ptr<LogEvent> CreateBatterySaverOffEvent(uint64_t timestampNs) {
+//    auto event = std::make_unique<LogEvent>(
+//        android::util::BATTERY_SAVER_MODE_STATE_CHANGED, timestampNs);
+//    EXPECT_TRUE(event->write(BatterySaverModeStateChanged::OFF));
+//    event->init();
+//    return event;
+//}
+//
+//std::unique_ptr<LogEvent> CreateScreenBrightnessChangedEvent(
+//    int level, uint64_t timestampNs) {
+//    auto event = std::make_unique<LogEvent>(android::util::SCREEN_BRIGHTNESS_CHANGED, timestampNs);
+//    EXPECT_TRUE(event->write(level));
+//    event->init();
+//    return event;
+//
+//}
+//
+//std::unique_ptr<LogEvent> CreateScheduledJobStateChangedEvent(
+//        const std::vector<AttributionNodeInternal>& attributions, const string& jobName,
+//        const ScheduledJobStateChanged::State state, uint64_t timestampNs) {
+//    auto event = std::make_unique<LogEvent>(android::util::SCHEDULED_JOB_STATE_CHANGED, timestampNs);
+//    event->write(attributions);
+//    event->write(jobName);
+//    event->write(state);
+//    event->init();
+//    return event;
+//}
+//
+//std::unique_ptr<LogEvent> CreateStartScheduledJobEvent(
+//    const std::vector<AttributionNodeInternal>& attributions,
+//    const string& name, uint64_t timestampNs) {
+//    return CreateScheduledJobStateChangedEvent(
+//            attributions, name, ScheduledJobStateChanged::STARTED, timestampNs);
+//}
+//
+//// Create log event when scheduled job finishes.
+//std::unique_ptr<LogEvent> CreateFinishScheduledJobEvent(
+//    const std::vector<AttributionNodeInternal>& attributions,
+//    const string& name, uint64_t timestampNs) {
+//    return CreateScheduledJobStateChangedEvent(
+//            attributions, name, ScheduledJobStateChanged::FINISHED, timestampNs);
+//}
+//
+//std::unique_ptr<LogEvent> CreateWakelockStateChangedEvent(
+//        const std::vector<AttributionNodeInternal>& attributions, const string& wakelockName,
+//        const WakelockStateChanged::State state, uint64_t timestampNs) {
+//    auto event = std::make_unique<LogEvent>(android::util::WAKELOCK_STATE_CHANGED, timestampNs);
+//    event->write(attributions);
+//    event->write(android::os::WakeLockLevelEnum::PARTIAL_WAKE_LOCK);
+//    event->write(wakelockName);
+//    event->write(state);
+//    event->init();
+//    return event;
+//}
+//
+//std::unique_ptr<LogEvent> CreateAcquireWakelockEvent(
+//        const std::vector<AttributionNodeInternal>& attributions, const string& wakelockName,
+//        uint64_t timestampNs) {
+//    return CreateWakelockStateChangedEvent(
+//        attributions, wakelockName, WakelockStateChanged::ACQUIRE, timestampNs);
+//}
+//
+//std::unique_ptr<LogEvent> CreateReleaseWakelockEvent(
+//        const std::vector<AttributionNodeInternal>& attributions, const string& wakelockName,
+//        uint64_t timestampNs) {
+//    return CreateWakelockStateChangedEvent(
+//        attributions, wakelockName, WakelockStateChanged::RELEASE, timestampNs);
+//}
+//
+//std::unique_ptr<LogEvent> CreateActivityForegroundStateChangedEvent(
+//    const int uid, const ActivityForegroundStateChanged::State state, uint64_t timestampNs) {
+//    auto event = std::make_unique<LogEvent>(
+//        android::util::ACTIVITY_FOREGROUND_STATE_CHANGED, timestampNs);
+//    event->write(uid);
+//    event->write("pkg_name");
+//    event->write("class_name");
+//    event->write(state);
+//    event->init();
+//    return event;
+//}
+//
+//std::unique_ptr<LogEvent> CreateMoveToBackgroundEvent(const int uid, uint64_t timestampNs) {
+//    return CreateActivityForegroundStateChangedEvent(
+//        uid, ActivityForegroundStateChanged::BACKGROUND, timestampNs);
+//}
+//
+//std::unique_ptr<LogEvent> CreateMoveToForegroundEvent(const int uid, uint64_t timestampNs) {
+//    return CreateActivityForegroundStateChangedEvent(
+//        uid, ActivityForegroundStateChanged::FOREGROUND, timestampNs);
+//}
+//
+//std::unique_ptr<LogEvent> CreateSyncStateChangedEvent(
+//        const std::vector<AttributionNodeInternal>& attributions, const string& name,
+//        const SyncStateChanged::State state, uint64_t timestampNs) {
+//    auto event = std::make_unique<LogEvent>(android::util::SYNC_STATE_CHANGED, timestampNs);
+//    event->write(attributions);
+//    event->write(name);
+//    event->write(state);
+//    event->init();
+//    return event;
+//}
+//
+//std::unique_ptr<LogEvent> CreateSyncStartEvent(
+//        const std::vector<AttributionNodeInternal>& attributions, const string& name,
+//        uint64_t timestampNs) {
+//    return CreateSyncStateChangedEvent(attributions, name, SyncStateChanged::ON, timestampNs);
+//}
+//
+//std::unique_ptr<LogEvent> CreateSyncEndEvent(
+//        const std::vector<AttributionNodeInternal>& attributions, const string& name,
+//        uint64_t timestampNs) {
+//    return CreateSyncStateChangedEvent(attributions, name, SyncStateChanged::OFF, timestampNs);
+//}
+//
+//std::unique_ptr<LogEvent> CreateProcessLifeCycleStateChangedEvent(
+//    const int uid, const ProcessLifeCycleStateChanged::State state, uint64_t timestampNs) {
+//    auto logEvent = std::make_unique<LogEvent>(
+//        android::util::PROCESS_LIFE_CYCLE_STATE_CHANGED, timestampNs);
+//    logEvent->write(uid);
+//    logEvent->write("");
+//    logEvent->write(state);
+//    logEvent->init();
+//    return logEvent;
+//}
+//
+//std::unique_ptr<LogEvent> CreateAppCrashEvent(const int uid, uint64_t timestampNs) {
+//    return CreateProcessLifeCycleStateChangedEvent(
+//        uid, ProcessLifeCycleStateChanged::CRASHED, timestampNs);
+//}
+//
+//std::unique_ptr<LogEvent> CreateAppCrashOccurredEvent(const int uid, uint64_t timestampNs) {
+//    auto event = std::make_unique<LogEvent>(android::util::APP_CRASH_OCCURRED, timestampNs);
+//    event->write(uid);
+//    event->write("eventType");
+//    event->write("processName");
+//    event->init();
+//    return event;
+//}
+//
+//std::unique_ptr<LogEvent> CreateIsolatedUidChangedEvent(
+//    int isolatedUid, int hostUid, bool is_create, uint64_t timestampNs) {
+//    auto logEvent = std::make_unique<LogEvent>(
+//        android::util::ISOLATED_UID_CHANGED, timestampNs);
+//    logEvent->write(hostUid);
+//    logEvent->write(isolatedUid);
+//    logEvent->write(is_create);
+//    logEvent->init();
+//    return logEvent;
+//}
+//
+//std::unique_ptr<LogEvent> CreateUidProcessStateChangedEvent(
+//        int uid, const android::app::ProcessStateEnum state, uint64_t timestampNs) {
+//    auto event = std::make_unique<LogEvent>(android::util::UID_PROCESS_STATE_CHANGED, timestampNs);
+//    event->write(uid);
+//    event->write(state);
+//    event->init();
+//    return event;
+//}
 
 sp<StatsLogProcessor> CreateStatsLogProcessor(const int64_t timeBaseNs, const int64_t currentTimeNs,
                                               const StatsdConfig& config, const ConfigKey& key,
diff --git a/core/java/android/accessibilityservice/AccessibilityService.java b/core/java/android/accessibilityservice/AccessibilityService.java
index b7a35f7..0a138cf 100644
--- a/core/java/android/accessibilityservice/AccessibilityService.java
+++ b/core/java/android/accessibilityservice/AccessibilityService.java
@@ -960,7 +960,7 @@
             return false;
         }
         List<GestureDescription.GestureStep> steps =
-                MotionEventGenerator.getGestureStepsFromGestureDescription(gesture, 100);
+                MotionEventGenerator.getGestureStepsFromGestureDescription(gesture, 16);
         try {
             synchronized (mLock) {
                 mGestureStatusCallbackSequence++;
@@ -2414,4 +2414,55 @@
             return mTimestamp;
         };
     }
+
+    /**
+     * When {@link AccessibilityServiceInfo#FLAG_REQUEST_TOUCH_EXPLORATION_MODE} is enabled, this
+     * function requests that touch interactions starting in the specified region of the screen
+     * bypass the gesture detector. There can only be one gesture detection passthrough region per
+     * display. Requesting a new gesture detection passthrough region clears the existing one. To
+     * disable this passthrough and return to the original behavior, pass in an empty region. When
+     * {@link AccessibilityServiceInfo#FLAG_REQUEST_TOUCH_EXPLORATION_MODE} is disabled this
+     * function has no effect.
+     *
+     * @param displayId The display on which to set this region.
+     * @param region the region of the screen.
+     */
+    public void setGestureDetectionPassthroughRegion(int displayId, @NonNull Region region) {
+        Preconditions.checkNotNull(region, "region cannot be null");
+        final IAccessibilityServiceConnection connection =
+                AccessibilityInteractionClient.getInstance().getConnection(mConnectionId);
+        if (connection != null) {
+            try {
+                connection.setGestureDetectionPassthroughRegion(displayId, region);
+            } catch (RemoteException re) {
+                throw new RuntimeException(re);
+            }
+        }
+    }
+
+    /**
+     * When {@link AccessibilityServiceInfo#FLAG_REQUEST_TOUCH_EXPLORATION_MODE} is enabled, this
+     * function requests that touch interactions starting in the specified region of the screen
+     * bypass the touch explorer and go straight to the view hierarchy. There can only be one touch
+     * exploration passthrough region per display. Requesting a new touch explorationpassthrough
+     * region clears the existing one. To disable this passthrough and return to the original
+     * behavior, pass in an empty region. When {@link
+     * AccessibilityServiceInfo#FLAG_REQUEST_TOUCH_EXPLORATION_MODE} is disabled this function has
+     * no effect.
+     *
+     * @param displayId The display on which to set this region.
+     * @param region the region of the screen .
+     */
+    public void setTouchExplorationPassthroughRegion(int displayId, @NonNull Region region) {
+        Preconditions.checkNotNull(region, "region cannot be null");
+        final IAccessibilityServiceConnection connection =
+                AccessibilityInteractionClient.getInstance().getConnection(mConnectionId);
+        if (connection != null) {
+            try {
+                connection.setTouchExplorationPassthroughRegion(displayId, region);
+            } catch (RemoteException re) {
+                throw new RuntimeException(re);
+            }
+        }
+    }
 }
diff --git a/core/java/android/accessibilityservice/IAccessibilityServiceConnection.aidl b/core/java/android/accessibilityservice/IAccessibilityServiceConnection.aidl
index 9177d4d..0b3b9b2 100644
--- a/core/java/android/accessibilityservice/IAccessibilityServiceConnection.aidl
+++ b/core/java/android/accessibilityservice/IAccessibilityServiceConnection.aidl
@@ -111,4 +111,8 @@
     int getWindowIdForLeashToken(IBinder token);
 
     void takeScreenshot(int displayId, in RemoteCallback callback);
+
+    void setGestureDetectionPassthroughRegion(int displayId, in Region region);
+
+    void setTouchExplorationPassthroughRegion(int displayId, in Region region);
 }
diff --git a/core/java/android/app/ActivityManager.java b/core/java/android/app/ActivityManager.java
index 2838ad8..0293346 100644
--- a/core/java/android/app/ActivityManager.java
+++ b/core/java/android/app/ActivityManager.java
@@ -694,7 +694,7 @@
 
     /** @hide Should this process state be considered a background state? */
     public static final boolean isProcStateBackground(int procState) {
-        return procState >= PROCESS_STATE_TRANSIENT_BACKGROUND;
+        return procState > PROCESS_STATE_BOUND_FOREGROUND_SERVICE;
     }
 
     /** @hide Is this a foreground service type? */
diff --git a/core/java/android/app/AppOpsManager.java b/core/java/android/app/AppOpsManager.java
index f6bbc68..8f02f15 100644
--- a/core/java/android/app/AppOpsManager.java
+++ b/core/java/android/app/AppOpsManager.java
@@ -97,15 +97,77 @@
 import java.util.function.Supplier;
 
 /**
- * AppOps are mappings of [package/uid, op-name] -> [mode]. The list of existing appops is defined
- * by the system and cannot be amended by apps. Only system apps can change appop-modes.
+ * App-ops are used for two purposes: Access control and tracking.
  *
- * <p>Beside a mode the system tracks when an op was {@link #noteOp noted}. The tracked data can
- * only be read by system components.
+ * <p>App-ops cover a wide variety of functionality from helping with runtime permissions access
+ * control and tracking to battery consumption tracking.
  *
- * <p>Installed apps can usually only listen to changes and events on their own ops. E.g.
- * {@link AppOpsCollector} allows to get a callback each time an app called {@link #noteOp} or
- * {@link #startOp} for an op belonging to the app.
+ * <h2>Access control</h2>
+ *
+ * <p>App-ops can either be controlled for each uid or for each package. Which one is used depends
+ * on the API provider maintaining this app-op. For any security or privacy related app-op the
+ * provider needs to control the app-op for per uid as all security and privacy is based on uid in
+ * Android.
+ *
+ * <p>To control access the app-op can be set to a mode to:
+ * <dl>
+ *     <dt>{@link #MODE_DEFAULT}
+ *     <dd>Default behavior, might differ from app-op or app-op
+ *     <dt>{@link #MODE_ALLOWED}
+ *     <dd>Allow the access
+ *     <dt>{@link #MODE_IGNORED}
+ *     <dd>Don't allow the access, i.e. don't perform the requested action or return no or dummy
+ *     data
+ *     <dt>{@link #MODE_ERRORED}
+ *     <dd>Throw a {@link SecurityException} on access. This can be suppressed by using a
+ *     {@code ...noThrow} method to check the mode
+ * </dl>
+ *
+ * <p>API providers need to check the mode returned by {@link #noteOp} if they are are allowing
+ * access to operations gated by the app-op. {@link #unsafeCheckOp} should be used to check the
+ * mode if no access is granted. E.g. this can be used for displaying app-op state in the UI or
+ * when checking the state before later calling {@link #noteOp} anyway.
+ *
+ * <p>If an operation refers to a time span (e.g. a audio-recording session) the API provider
+ * should use {@link #startOp} and {@link #finishOp} instead of {@link #noteOp}.
+ *
+ * <h3>Runtime permissions and app-ops</h3>
+ *
+ * <p>Each platform defined runtime permission (beside background modifiers) has an associated app
+ * op which is used for tracking but also to allow for silent failures. I.e. if the runtime
+ * permission is denied the caller gets a {@link SecurityException}, but if the permission is
+ * granted and the app-op is {@link #MODE_IGNORED} then the callers gets dummy behavior, e.g.
+ * location callbacks would not happen.
+ *
+ * <h3>App-op permissions</h3>
+ *
+ * <p>App-ops permissions are platform defined permissions that can be overridden. The security
+ * check for app-op permissions should by {@link #MODE_DEFAULT default} check the permission grant
+ * state. If the app-op state is set to {@link #MODE_ALLOWED} or {@link #MODE_IGNORED} the app-op
+ * state should be checked instead of the permission grant state.
+ *
+ * <p>This functionality allows to grant access by default to apps fulfilling the requirements for
+ * a certain permission level. Still the behavior can be overridden when needed.
+ *
+ * <h2>Tracking</h2>
+ *
+ * <p>App-ops track many important events, including all accesses to runtime permission protected
+ * APIs. This is done by tracking when an app-op was {@link #noteOp noted} or
+ * {@link #startOp started}. The tracked data can only be read by system components.
+ *
+ * <p><b>Only {@link #noteOp}/{@link #startOp} are tracked; {@link #unsafeCheckOp} is not tracked.
+ * Hence it is important to eventually call {@link #noteOp} or {@link #startOp} when providing
+ * access to protected operations or data.</b>
+ *
+ * <p>Some apps are forwarding access to other apps. E.g. an app might get the location from the
+ * system's location provider and then send the location further to a 3rd app. In this case the
+ * app passing on the data needs to call {@link #noteProxyOp} to signal the access proxying. This
+ * might also make sense inside of a single app if the access is forwarded between two features of
+ * the app.
+ *
+ * <p>An app can register an {@link AppOpsCollector} to get informed about what accesses the
+ * system is tracking for it. As each runtime permission has an associated app-op this API is
+ * particularly useful for an app that want to find unexpected private data accesses.
  */
 @SystemService(Context.APP_OPS_SERVICE)
 public class AppOpsManager {
@@ -121,28 +183,6 @@
     @EnabledAfter(targetSdkVersion = Build.VERSION_CODES.Q)
     public static final long CALL_BACK_ON_CHANGED_LISTENER_WITH_SWITCHED_OP_CHANGE = 148180766L;
 
-    /**
-     * <p>App ops allows callers to:</p>
-     *
-     * <ul>
-     * <li> Note when operations are happening, and find out if they are allowed for the current
-     * caller.</li>
-     * <li> Disallow specific apps from doing specific operations.</li>
-     * <li> Collect all of the current information about operations that have been executed or
-     * are not being allowed.</li>
-     * <li> Monitor for changes in whether an operation is allowed.</li>
-     * </ul>
-     *
-     * <p>Each operation is identified by a single integer; these integers are a fixed set of
-     * operations, enumerated by the OP_* constants.
-     *
-     * <p></p>When checking operations, the result is a "mode" integer indicating the current
-     * setting for the operation under that caller: MODE_ALLOWED, MODE_IGNORED (don't execute
-     * the operation but fake its behavior enough so that the caller doesn't crash),
-     * MODE_ERRORED (throw a SecurityException back to the caller; the normal operation calls
-     * will do this for you).
-     */
-
     final Context mContext;
 
     @UnsupportedAppUsage
@@ -995,10 +1035,12 @@
     public static final int OP_ACTIVATE_PLATFORM_VPN = 94;
     /** @hide */
     public static final int OP_LOADER_USAGE_STATS = 95;
+    /** @hide Access telephony call audio */
+    public static final int OP_ACCESS_CALL_AUDIO = 96;
 
     /** @hide */
     @UnsupportedAppUsage
-    public static final int _NUM_OP = 96;
+    public static final int _NUM_OP = 97;
 
     /** Access to coarse location information. */
     public static final String OPSTR_COARSE_LOCATION = "android:coarse_location";
@@ -1093,7 +1135,7 @@
     /** Required to draw on top of other apps. */
     public static final String OPSTR_SYSTEM_ALERT_WINDOW
             = "android:system_alert_window";
-    /** Required to write/modify/update system settingss. */
+    /** Required to write/modify/update system settings. */
     public static final String OPSTR_WRITE_SETTINGS
             = "android:write_settings";
     /** @hide Get device accounts. */
@@ -1289,6 +1331,9 @@
     @SystemApi
     public static final String OPSTR_MANAGE_EXTERNAL_STORAGE =
             "android:manage_external_storage";
+    /** @hide Access telephony call audio */
+    @SystemApi
+    public static final String OPSTR_ACCESS_CALL_AUDIO = "android:access_call_audio";
 
     /** @hide Communicate cross-profile within the same profile group. */
     @SystemApi
@@ -1378,6 +1423,7 @@
             OP_MANAGE_EXTERNAL_STORAGE,
             OP_INTERACT_ACROSS_PROFILES,
             OP_LOADER_USAGE_STATS,
+            OP_ACCESS_CALL_AUDIO,
     };
 
     /**
@@ -1485,6 +1531,7 @@
             OP_INTERACT_ACROSS_PROFILES,        //INTERACT_ACROSS_PROFILES
             OP_ACTIVATE_PLATFORM_VPN,           // ACTIVATE_PLATFORM_VPN
             OP_LOADER_USAGE_STATS,              // LOADER_USAGE_STATS
+            OP_ACCESS_CALL_AUDIO,               // ACCESS_CALL_AUDIO
     };
 
     /**
@@ -1587,6 +1634,7 @@
             OPSTR_INTERACT_ACROSS_PROFILES,
             OPSTR_ACTIVATE_PLATFORM_VPN,
             OPSTR_LOADER_USAGE_STATS,
+            OPSTR_ACCESS_CALL_AUDIO,
     };
 
     /**
@@ -1690,6 +1738,7 @@
             "INTERACT_ACROSS_PROFILES",
             "ACTIVATE_PLATFORM_VPN",
             "LOADER_USAGE_STATS",
+            "ACCESS_CALL_AUDIO",
     };
 
     /**
@@ -1794,6 +1843,7 @@
             android.Manifest.permission.INTERACT_ACROSS_PROFILES,
             null, // no permission for OP_ACTIVATE_PLATFORM_VPN
             android.Manifest.permission.LOADER_USAGE_STATS,
+            Manifest.permission.ACCESS_CALL_AUDIO,
     };
 
     /**
@@ -1898,6 +1948,7 @@
             null, // INTERACT_ACROSS_PROFILES
             null, // ACTIVATE_PLATFORM_VPN
             null, // LOADER_USAGE_STATS
+            null, // ACCESS_CALL_AUDIO
     };
 
     /**
@@ -2001,6 +2052,7 @@
             false, // INTERACT_ACROSS_PROFILES
             false, // ACTIVATE_PLATFORM_VPN
             false, // LOADER_USAGE_STATS
+            false, // ACCESS_CALL_AUDIO
     };
 
     /**
@@ -2103,6 +2155,7 @@
             AppOpsManager.MODE_DEFAULT, // INTERACT_ACROSS_PROFILES
             AppOpsManager.MODE_IGNORED, // ACTIVATE_PLATFORM_VPN
             AppOpsManager.MODE_DEFAULT, // LOADER_USAGE_STATS
+            AppOpsManager.MODE_DEFAULT, // ACCESS_CALL_AUDIO
     };
 
     /**
@@ -2209,6 +2262,7 @@
             false, // INTERACT_ACROSS_PROFILES
             false, // ACTIVATE_PLATFORM_VPN
             false, // LOADER_USAGE_STATS
+            false, // ACCESS_CALL_AUDIO
     };
 
     /**
@@ -6115,7 +6169,7 @@
      */
     public interface OnOpActiveChangedListener {
         /**
-         * Called when the active state of an app op changes.
+         * Called when the active state of an app-op changes.
          *
          * @param op The operation that changed.
          * @param packageName The package performing the operation.
@@ -6406,7 +6460,7 @@
     @SystemApi
     @TestApi
     @RequiresPermission(android.Manifest.permission.MANAGE_APP_OPS_MODES)
-    public void setUidMode(String appOp, int uid, @Mode int mode) {
+    public void setUidMode(@NonNull String appOp, int uid, @Mode int mode) {
         try {
             mService.setUidMode(AppOpsManager.strOpToOp(appOp), uid, mode);
         } catch (RemoteException e) {
@@ -6461,7 +6515,8 @@
     @TestApi
     @SystemApi
     @RequiresPermission(android.Manifest.permission.MANAGE_APP_OPS_MODES)
-    public void setMode(String op, int uid, String packageName, @Mode int mode) {
+    public void setMode(@NonNull String op, int uid, @Nullable String packageName,
+            @Mode int mode) {
         try {
             mService.setMode(strOpToOp(op), uid, packageName, mode);
         } catch (RemoteException e) {
@@ -6504,16 +6559,17 @@
     }
 
     /**
-     * Gets the app op name associated with a given permission.
-     * The app op name is one of the public constants defined
+     * Gets the app-op name associated with a given permission.
+     *
+     * <p>The app-op name is one of the public constants defined
      * in this class such as {@link #OPSTR_COARSE_LOCATION}.
      * This API is intended to be used for mapping runtime
-     * permissions to the corresponding app op.
+     * permissions to the corresponding app-op.
      *
      * @param permission The permission.
-     * @return The app op associated with the permission or null.
+     * @return The app-op associated with the permission or {@code null}.
      */
-    public static String permissionToOp(String permission) {
+    public static @Nullable String permissionToOp(@NonNull String permission) {
         final Integer opCode = sPermToOp.get(permission);
         if (opCode == null) {
             return null;
@@ -6631,7 +6687,7 @@
     }
 
     /**
-     * Start watching for changes to the active state of app ops. An app op may be
+     * Start watching for changes to the active state of app-ops. An app-op may be
      * long running and it has a clear start and stop delimiters. If an op is being
      * started or stopped by any package you will get a callback. To change the
      * watched ops for a registered callback you need to unregister and register it
@@ -6690,7 +6746,7 @@
     }
 
     /**
-     * Stop watching for changes to the active state of an app op. An app op may be
+     * Stop watching for changes to the active state of an app-op. An app-op may be
      * long running and it has a clear start and stop delimiters. Unregistering a
      * non-registered callback has no effect.
      *
@@ -6921,7 +6977,8 @@
      * @param op The operation to note.  One of the OPSTR_* constants.
      * @param uid The user id of the application attempting to perform the operation.
      * @param packageName The name of the application attempting to perform the operation.
-     * @param featureId The feature in the app or {@code null} for default feature
+     * @param featureId The {@link Context#createFeatureContext feature} in the package or {@code
+     * null} for default feature
      * @param message A message describing the reason the op was noted
      *
      * @return Returns {@link #MODE_ALLOWED} if the operation is allowed, or
@@ -6996,6 +7053,8 @@
      * @param op The operation to note.  One of the OPSTR_* constants.
      * @param uid The user id of the application attempting to perform the operation.
      * @param packageName The name of the application attempting to perform the operation.
+     * @param featureId The {@link Context#createFeatureContext feature} in the package or {@code
+     * null} for default feature
      * @param message A message describing the reason the op was noted
      *
      * @return Returns {@link #MODE_ALLOWED} if the operation is allowed, or
@@ -7003,8 +7062,8 @@
      * causing the app to crash).
      */
     public int noteOpNoThrow(@NonNull String op, int uid, @NonNull String packageName,
-            @Nullable String feature, @Nullable String message) {
-        return noteOpNoThrow(strOpToOp(op), uid, packageName, feature, message);
+            @Nullable String featureId, @Nullable String message) {
+        return noteOpNoThrow(strOpToOp(op), uid, packageName, featureId, message);
     }
 
     /**
@@ -7273,11 +7332,9 @@
     }
 
     /**
-     * Do a quick check to validate if a package name belongs to a UID.
-     *
-     * @throws SecurityException if the package name doesn't belong to the given
-     *             UID, or if ownership cannot be verified.
+     * @deprecated Use {@link PackageManager#getPackageUid} instead
      */
+    @Deprecated
     public void checkPackage(int uid, @NonNull String packageName) {
         try {
             if (mService.checkPackage(uid, packageName) != MODE_ALLOWED) {
@@ -7396,7 +7453,8 @@
      * @param op The operation to start.  One of the OPSTR_* constants.
      * @param uid The user id of the application attempting to perform the operation.
      * @param packageName The name of the application attempting to perform the operation.
-     * @param featureId The feature in the app or {@code null} for default feature
+     * @param featureId The {@link Context#createFeatureContext feature} in the package or {@code
+     * null} for default feature
      * @param message Description why op was started
      *
      * @return Returns {@link #MODE_ALLOWED} if the operation is allowed, or
@@ -7587,7 +7645,8 @@
     }
 
     /**
-     * Checks whether the given op for a package is active.
+     * Checks whether the given op for a package is active, i.e. did someone call {@link #startOp}
+     * without {@link #finishOp} yet.
      * <p>
      * If you don't hold the {@code android.Manifest.permission#WATCH_APPOPS}
      * permission you can query only for your UID.
@@ -7917,18 +7976,19 @@
     }
 
     /**
-     * Callback an app can choose to {@link #setNotedAppOpsCollector register} to monitor it's noted
-     * appops. I.e. each time any app calls {@link #noteOp} or {@link #startOp} one of the callback
-     * methods of this object is called.
+     * Callback an app can {@link #setNotedAppOpsCollector register} to monitor the app-ops the
+     * system has tracked for it. I.e. each time any app calls {@link #noteOp} or {@link #startOp}
+     * one of the callback methods of this object is called.
      *
-     * <p><b>Only appops related to dangerous permissions are collected.</b>
+     * <p><b>There will be a callback for all app-ops related to runtime permissions, but not
+     * necessarily for all other app-ops.
      *
      * <pre>
      * setNotedAppOpsCollector(new AppOpsCollector() {
      *     ArraySet<Pair<String, String>> opsNotedForThisProcess = new ArraySet<>();
      *
      *     private synchronized void addAccess(String op, String accessLocation) {
-     *         // Ops are often noted when permission protected APIs were called.
+     *         // Ops are often noted when runtime permission protected APIs were called.
      *         // In this case permissionToOp() allows to resolve the permission<->op
      *         opsNotedForThisProcess.add(new Pair(accessType, accessLocation));
      *     }
@@ -7970,20 +8030,21 @@
         }
 
         /**
-         * Called when an app-op was noted for this package inside of a two-way binder-call.
+         * Called when an app-op was {@link #noteOp noted} for this package inside of a synchronous
+         * API call, i.e. a API call that returned data or waited until the action was performed.
          *
-         * <p>Called on the calling thread just after executing the binder-call. This allows
-         * the app to e.g. collect stack traces to figure out where the access came from.
+         * <p>Called on the calling thread before the API returns. This allows the app to e.g.
+         * collect stack traces to figure out where the access came from.
          *
          * @param op The op noted
          */
         public abstract void onNoted(@NonNull SyncNotedAppOp op);
 
         /**
-         * Called when this app noted an app-op for its own package.
+         * Called when this app noted an app-op for its own package,
          *
-         * <p>Called on the thread the noted the op. This allows the app to e.g. collect stack
-         * traces to figure out where the access came from.
+         * <p>This is very similar to {@link #onNoted} only that the tracking was not caused by the
+         * API provider in a separate process, but by one in the app's own process.
          *
          * @param op The op noted
          */
diff --git a/core/java/android/app/AppOpsManagerInternal.java b/core/java/android/app/AppOpsManagerInternal.java
index c13c5a5..309e91f 100644
--- a/core/java/android/app/AppOpsManagerInternal.java
+++ b/core/java/android/app/AppOpsManagerInternal.java
@@ -94,14 +94,16 @@
             boolean visible);
 
     /**
-     * Like {@link AppOpsManager#setUidMode}, but allows ignoring a certain callback.
+     * Like {@link AppOpsManager#setUidMode}, but allows ignoring our own callback and not updating
+     * the REVOKED_COMPAT flag.
      */
-    public abstract void setUidModeIgnoringCallback(int code, int uid, int mode,
-            @Nullable IAppOpsCallback callbackToIgnore);
+    public abstract void setUidModeFromPermissionPolicy(int code, int uid, int mode,
+            @Nullable IAppOpsCallback callback);
 
     /**
-     * Like {@link AppOpsManager#setMode}, but allows ignoring a certain callback.
+     * Like {@link AppOpsManager#setMode}, but allows ignoring our own callback and not updating the
+     * REVOKED_COMPAT flag.
      */
-    public abstract void setModeIgnoringCallback(int code, int uid, @NonNull String packageName,
-            int mode, @Nullable IAppOpsCallback callbackToIgnore);
+    public abstract void setModeFromPermissionPolicy(int code, int uid, @NonNull String packageName,
+            int mode, @Nullable IAppOpsCallback callback);
 }
diff --git a/core/java/android/app/ApplicationPackageManager.java b/core/java/android/app/ApplicationPackageManager.java
index cd05e2c..e781ac6 100644
--- a/core/java/android/app/ApplicationPackageManager.java
+++ b/core/java/android/app/ApplicationPackageManager.java
@@ -3334,4 +3334,35 @@
             throw e.rethrowAsRuntimeException();
         }
     }
+
+    public void setMimeGroup(String mimeGroup, Set<String> mimeTypes) {
+        try {
+            mPM.setMimeGroup(mContext.getPackageName(), mimeGroup,
+                    new ArrayList<String>(mimeTypes));
+        } catch (RemoteException e) {
+            throw e.rethrowAsRuntimeException();
+        }
+    }
+
+    @Override
+    public void clearMimeGroup(String mimeGroup) {
+        try {
+            mPM.clearMimeGroup(mContext.getPackageName(), mimeGroup);
+        } catch (RemoteException e) {
+            throw e.rethrowAsRuntimeException();
+        }
+    }
+
+    @Override
+    public Set<String> getMimeGroup(String group) {
+        try {
+            List<String> mimeGroup = mPM.getMimeGroup(mContext.getPackageName(), group);
+            if (mimeGroup == null) {
+                return null;
+            }
+            return new ArraySet<>(mimeGroup);
+        } catch (RemoteException e) {
+            throw e.rethrowAsRuntimeException();
+        }
+    }
 }
diff --git a/core/java/android/app/AsyncNotedAppOp.java b/core/java/android/app/AsyncNotedAppOp.java
index 130e2ec..6b1afda 100644
--- a/core/java/android/app/AsyncNotedAppOp.java
+++ b/core/java/android/app/AsyncNotedAppOp.java
@@ -256,10 +256,10 @@
     };
 
     @DataClass.Generated(
-            time = 1580158740502L,
+            time = 1581728574427L,
             codegenVersion = "1.0.14",
             sourceFile = "frameworks/base/core/java/android/app/AsyncNotedAppOp.java",
-            inputSignatures = "private final @android.annotation.IntRange(from=0L, to=95L) int mOpCode\nprivate final @android.annotation.IntRange(from=0L) int mNotingUid\nprivate final @android.annotation.Nullable java.lang.String mFeatureId\nprivate final @android.annotation.NonNull java.lang.String mMessage\nprivate final @android.annotation.IntRange(from=0L) long mTime\npublic @android.annotation.NonNull java.lang.String getOp()\nclass AsyncNotedAppOp extends java.lang.Object implements [android.os.Parcelable]\n@com.android.internal.util.DataClass(genEqualsHashCode=true, genAidl=true, genHiddenConstructor=true)")
+            inputSignatures = "private final @android.annotation.IntRange(from=0L, to=96L) int mOpCode\nprivate final @android.annotation.IntRange(from=0L) int mNotingUid\nprivate final @android.annotation.Nullable java.lang.String mFeatureId\nprivate final @android.annotation.NonNull java.lang.String mMessage\nprivate final @android.annotation.IntRange(from=0L) long mTime\npublic @android.annotation.NonNull java.lang.String getOp()\nclass AsyncNotedAppOp extends java.lang.Object implements [android.os.Parcelable]\n@com.android.internal.util.DataClass(genEqualsHashCode=true, genAidl=true, genHiddenConstructor=true)")
     @Deprecated
     private void __metadata() {}
 
diff --git a/core/java/android/app/IActivityTaskManager.aidl b/core/java/android/app/IActivityTaskManager.aidl
index 180507c..3c475c1 100644
--- a/core/java/android/app/IActivityTaskManager.aidl
+++ b/core/java/android/app/IActivityTaskManager.aidl
@@ -315,11 +315,6 @@
     void positionTaskInStack(int taskId, int stackId, int position);
     void reportSizeConfigurations(in IBinder token, in int[] horizontalSizeConfiguration,
             in int[] verticalSizeConfigurations, in int[] smallestWidthConfigurations);
-    /**
-     * Dismisses split-screen multi-window mode.
-     * {@param toTop} If true the current primary split-screen stack will be placed or left on top.
-     */
-    void dismissSplitScreenMode(boolean toTop);
 
     /**
      * Dismisses PiP
diff --git a/core/java/android/app/INotificationManager.aidl b/core/java/android/app/INotificationManager.aidl
index 526c0b3..948546b 100644
--- a/core/java/android/app/INotificationManager.aidl
+++ b/core/java/android/app/INotificationManager.aidl
@@ -88,6 +88,7 @@
     void createNotificationChannelGroups(String pkg, in ParceledListSlice channelGroupList);
     void createNotificationChannels(String pkg, in ParceledListSlice channelsList);
     void createNotificationChannelsForPackage(String pkg, int uid, in ParceledListSlice channelsList);
+    ParceledListSlice getConversations(boolean onlyImportant);
     ParceledListSlice getConversationsForPackage(String pkg, int uid);
     ParceledListSlice getNotificationChannelGroupsForPackage(String pkg, int uid, boolean includeDeleted);
     NotificationChannelGroup getNotificationChannelGroupForPackage(String groupId, String pkg, int uid);
diff --git a/core/java/android/app/Notification.java b/core/java/android/app/Notification.java
index 576b56f..32e7d84 100644
--- a/core/java/android/app/Notification.java
+++ b/core/java/android/app/Notification.java
@@ -6046,21 +6046,18 @@
 
         /**
          * Removes RemoteViews that were created for compatibility from {@param n}, if they did not
-         * change. Also removes extenders on low ram devices, as
-         * {@link android.service.notification.NotificationListenerService} services are disabled.
+         * change.
          *
          * @return {@param n}, if no stripping is needed, otherwise a stripped clone of {@param n}.
          *
          * @hide
          */
-        public static Notification maybeCloneStrippedForDelivery(Notification n, boolean isLowRam,
-                Context context) {
+        public static Notification maybeCloneStrippedForDelivery(Notification n) {
             String templateClass = n.extras.getString(EXTRA_TEMPLATE);
 
             // Only strip views for known Styles because we won't know how to
             // re-create them otherwise.
-            if (!isLowRam
-                    && !TextUtils.isEmpty(templateClass)
+            if (!TextUtils.isEmpty(templateClass)
                     && getNotificationStyleClass(templateClass) == null) {
                 return n;
             }
@@ -6077,8 +6074,7 @@
                             n.headsUpContentView.getSequenceNumber();
 
             // Nothing to do here, no need to clone.
-            if (!isLowRam
-                    && !stripContentView && !stripBigContentView && !stripHeadsUpContentView) {
+            if (!stripContentView && !stripBigContentView && !stripHeadsUpContentView) {
                 return n;
             }
 
@@ -6095,15 +6091,6 @@
                 clone.headsUpContentView = null;
                 clone.extras.remove(EXTRA_REBUILD_HEADS_UP_CONTENT_VIEW_ACTION_COUNT);
             }
-            if (isLowRam) {
-                String[] allowedServices = context.getResources().getStringArray(
-                        R.array.config_allowedManagedServicesOnLowRamDevices);
-                if (allowedServices.length == 0) {
-                    clone.extras.remove(Notification.TvExtender.EXTRA_TV_EXTENDER);
-                    clone.extras.remove(WearableExtender.EXTRA_WEARABLE_EXTENSIONS);
-                    clone.extras.remove(CarExtender.EXTRA_CAR_EXTENDER);
-                }
-            }
             return clone;
         }
 
diff --git a/core/java/android/app/NotificationManager.java b/core/java/android/app/NotificationManager.java
index 528b508..88edb05 100644
--- a/core/java/android/app/NotificationManager.java
+++ b/core/java/android/app/NotificationManager.java
@@ -592,10 +592,7 @@
         }
 
         notification.reduceImageSizes(mContext);
-
-        ActivityManager am = (ActivityManager) mContext.getSystemService(Context.ACTIVITY_SERVICE);
-        boolean isLowRam = am.isLowRamDevice();
-        return Builder.maybeCloneStrippedForDelivery(notification, isLowRam, mContext);
+        return Builder.maybeCloneStrippedForDelivery(notification);
     }
 
     private void fixLegacySmallIcon(Notification n, String pkg) {
diff --git a/core/java/android/app/SharedElementCallback.java b/core/java/android/app/SharedElementCallback.java
index 0287564..8eb7e72 100644
--- a/core/java/android/app/SharedElementCallback.java
+++ b/core/java/android/app/SharedElementCallback.java
@@ -19,7 +19,6 @@
 import android.content.res.Resources;
 import android.graphics.Bitmap;
 import android.graphics.ColorSpace;
-import android.graphics.GraphicBuffer;
 import android.graphics.Matrix;
 import android.graphics.RectF;
 import android.graphics.drawable.BitmapDrawable;
@@ -48,8 +47,8 @@
 public abstract class SharedElementCallback {
     private Matrix mTempMatrix;
     private static final String BUNDLE_SNAPSHOT_BITMAP = "sharedElement:snapshot:bitmap";
-    private static final String BUNDLE_SNAPSHOT_GRAPHIC_BUFFER =
-            "sharedElement:snapshot:graphicBuffer";
+    private static final String BUNDLE_SNAPSHOT_HARDWARE_BUFFER =
+            "sharedElement:snapshot:hardwareBuffer";
     private static final String BUNDLE_SNAPSHOT_COLOR_SPACE = "sharedElement:snapshot:colorSpace";
     private static final String BUNDLE_SNAPSHOT_IMAGE_SCALETYPE = "sharedElement:snapshot:imageScaleType";
     private static final String BUNDLE_SNAPSHOT_IMAGE_MATRIX = "sharedElement:snapshot:imageMatrix";
@@ -186,8 +185,8 @@
                     if (bitmap.getConfig() != Bitmap.Config.HARDWARE) {
                         bundle.putParcelable(BUNDLE_SNAPSHOT_BITMAP, bitmap);
                     } else {
-                        GraphicBuffer graphicBuffer = bitmap.createGraphicBufferHandle();
-                        bundle.putParcelable(BUNDLE_SNAPSHOT_GRAPHIC_BUFFER, graphicBuffer);
+                        HardwareBuffer hardwareBuffer = bitmap.getHardwareBuffer();
+                        bundle.putParcelable(BUNDLE_SNAPSHOT_HARDWARE_BUFFER, hardwareBuffer);
                         ColorSpace cs = bitmap.getColorSpace();
                         if (cs != null) {
                             bundle.putInt(BUNDLE_SNAPSHOT_COLOR_SPACE, cs.getId());
@@ -235,7 +234,7 @@
         View view = null;
         if (snapshot instanceof Bundle) {
             Bundle bundle = (Bundle) snapshot;
-            GraphicBuffer buffer = bundle.getParcelable(BUNDLE_SNAPSHOT_GRAPHIC_BUFFER);
+            HardwareBuffer buffer = bundle.getParcelable(BUNDLE_SNAPSHOT_HARDWARE_BUFFER);
             Bitmap bitmap = bundle.getParcelable(BUNDLE_SNAPSHOT_BITMAP);
             if (buffer == null && bitmap == null) {
                 return null;
@@ -246,8 +245,7 @@
                 if (colorSpaceId >= 0 && colorSpaceId < ColorSpace.Named.values().length) {
                     colorSpace = ColorSpace.get(ColorSpace.Named.values()[colorSpaceId]);
                 }
-                bitmap = Bitmap.wrapHardwareBuffer(HardwareBuffer.createFromGraphicBuffer(buffer),
-                                                   colorSpace);
+                bitmap = Bitmap.wrapHardwareBuffer(buffer, colorSpace);
             }
             ImageView imageView = new ImageView(context);
             view = imageView;
diff --git a/core/java/android/app/SystemServiceRegistry.java b/core/java/android/app/SystemServiceRegistry.java
index c0390d2..be87f5c 100644
--- a/core/java/android/app/SystemServiceRegistry.java
+++ b/core/java/android/app/SystemServiceRegistry.java
@@ -109,8 +109,8 @@
 import android.media.soundtrigger.SoundTriggerManager;
 import android.media.tv.ITvInputManager;
 import android.media.tv.TvInputManager;
-import android.media.tv.tuner.ITunerResourceManager;
-import android.media.tv.tuner.TunerResourceManager;
+import android.media.tv.tunerresourcemanager.ITunerResourceManager;
+import android.media.tv.tunerresourcemanager.TunerResourceManager;
 import android.net.ConnectivityDiagnosticsManager;
 import android.net.ConnectivityManager;
 import android.net.ConnectivityThread;
@@ -148,6 +148,7 @@
 import android.os.IPowerManager;
 import android.os.IRecoverySystem;
 import android.os.ISystemUpdateManager;
+import android.os.IThermalService;
 import android.os.IUserManager;
 import android.os.IncidentManager;
 import android.os.PowerManager;
@@ -185,6 +186,7 @@
 import android.telephony.TelephonyRegistryManager;
 import android.util.ArrayMap;
 import android.util.Log;
+import android.util.Slog;
 import android.view.ContextThemeWrapper;
 import android.view.LayoutInflater;
 import android.view.WindowManager;
@@ -221,6 +223,8 @@
 public final class SystemServiceRegistry {
     private static final String TAG = "SystemServiceRegistry";
 
+    private static final boolean ENABLE_SERVICE_NOT_FOUND_WTF = true;
+
     // Service registry information.
     // This information is never changed once static initialization has completed.
     private static final Map<Class<?>, String> SYSTEM_SERVICE_NAMES =
@@ -576,10 +580,12 @@
                 new CachedServiceFetcher<PowerManager>() {
             @Override
             public PowerManager createService(ContextImpl ctx) throws ServiceNotFoundException {
-                IBinder b = ServiceManager.getServiceOrThrow(Context.POWER_SERVICE);
-                IPowerManager service = IPowerManager.Stub.asInterface(b);
-                return new PowerManager(ctx.getOuterContext(),
-                        service, ctx.mMainThread.getHandler());
+                IBinder powerBinder = ServiceManager.getServiceOrThrow(Context.POWER_SERVICE);
+                IPowerManager powerService = IPowerManager.Stub.asInterface(powerBinder);
+                IBinder thermalBinder = ServiceManager.getServiceOrThrow(Context.THERMAL_SERVICE);
+                IThermalService thermalService = IThermalService.Stub.asInterface(thermalBinder);
+                return new PowerManager(ctx.getOuterContext(), powerService, thermalService,
+                        ctx.mMainThread.getHandler());
             }});
 
         registerService(Context.RECOVERY_SERVICE, RecoverySystem.class,
@@ -1370,8 +1376,29 @@
      * @hide
      */
     public static Object getSystemService(ContextImpl ctx, String name) {
-        ServiceFetcher<?> fetcher = SYSTEM_SERVICE_FETCHERS.get(name);
-        return fetcher != null ? fetcher.getService(ctx) : null;
+        if (name == null) {
+            return null;
+        }
+        final ServiceFetcher<?> fetcher = SYSTEM_SERVICE_FETCHERS.get(name);
+        if (ENABLE_SERVICE_NOT_FOUND_WTF && fetcher == null) {
+            // This should be a caller bug.
+            Slog.wtf(TAG, "Unknown manager requested: " + name);
+            return null;
+        }
+
+        final Object ret = fetcher.getService(ctx);
+        if (ENABLE_SERVICE_NOT_FOUND_WTF && ret == null) {
+            // Some services do return null in certain situations, so don't do WTF for them.
+            switch (name) {
+                case Context.CONTENT_CAPTURE_MANAGER_SERVICE:
+                case Context.APP_PREDICTION_SERVICE:
+                case Context.INCREMENTAL_SERVICE:
+                    return null;
+            }
+            Slog.wtf(TAG, "Manager wrapper not available: " + name);
+            return null;
+        }
+        return ret;
     }
 
     /**
@@ -1379,7 +1406,15 @@
      * @hide
      */
     public static String getSystemServiceName(Class<?> serviceClass) {
-        return SYSTEM_SERVICE_NAMES.get(serviceClass);
+        if (serviceClass == null) {
+            return null;
+        }
+        final String serviceName = SYSTEM_SERVICE_NAMES.get(serviceClass);
+        if (ENABLE_SERVICE_NOT_FOUND_WTF && serviceName == null) {
+            // This should be a caller bug.
+            Slog.wtf(TAG, "Unknown manager requested: " + serviceClass.getCanonicalName());
+        }
+        return serviceName;
     }
 
     /**
@@ -1676,7 +1711,9 @@
                         try {
                             cache.wait();
                         } catch (InterruptedException e) {
-                            Log.w(TAG, "getService() interrupted");
+                            // This shouldn't normally happen, but if someone interrupts the
+                            // thread, it will.
+                            Slog.wtf(TAG, "getService() interrupted");
                             Thread.currentThread().interrupt();
                             return null;
                         }
diff --git a/core/java/android/app/admin/DevicePolicyManager.java b/core/java/android/app/admin/DevicePolicyManager.java
index d08dbc6..139b179 100644
--- a/core/java/android/app/admin/DevicePolicyManager.java
+++ b/core/java/android/app/admin/DevicePolicyManager.java
@@ -1416,6 +1416,7 @@
      * @see #setFactoryResetProtectionPolicy
      * @hide
      */
+    @RequiresPermission(android.Manifest.permission.MANAGE_FACTORY_RESET_PROTECTION)
     @SystemApi
     public static final String ACTION_RESET_PROTECTION_POLICY_CHANGED =
             "android.app.action.RESET_PROTECTION_POLICY_CHANGED";
@@ -11989,4 +11990,21 @@
         }
         return 0;
     }
+
+    /**
+     * Returns {@code true} when {@code userId} has a profile owner that is capable of resetting
+     * password in RUNNING_LOCKED state. For that it should have at least one direct boot aware
+     * component and have an active password reset token. Can only be called by the system.
+     * @hide
+     */
+    public boolean canProfileOwnerResetPasswordWhenLocked(int userId) {
+        if (mService != null) {
+            try {
+                return mService.canProfileOwnerResetPasswordWhenLocked(userId);
+            } catch (RemoteException re) {
+                throw re.rethrowFromSystemServer();
+            }
+        }
+        return false;
+    }
 }
diff --git a/core/java/android/app/admin/IDevicePolicyManager.aidl b/core/java/android/app/admin/IDevicePolicyManager.aidl
index 84332ca..25c1e12 100644
--- a/core/java/android/app/admin/IDevicePolicyManager.aidl
+++ b/core/java/android/app/admin/IDevicePolicyManager.aidl
@@ -478,4 +478,5 @@
 
     long getManagedProfileMaximumTimeOff(in ComponentName admin);
     void setManagedProfileMaximumTimeOff(in ComponentName admin, long timeoutMs);
+    boolean canProfileOwnerResetPasswordWhenLocked(in int userId);
 }
diff --git a/core/java/android/app/compat/ChangeIdStateCache.java b/core/java/android/app/compat/ChangeIdStateCache.java
new file mode 100644
index 0000000..9ef63f6
--- /dev/null
+++ b/core/java/android/app/compat/ChangeIdStateCache.java
@@ -0,0 +1,86 @@
+/*
+ * 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.app.compat;
+
+import android.app.PropertyInvalidatedCache;
+import android.content.Context;
+import android.os.Binder;
+import android.os.RemoteException;
+import android.os.ServiceManager;
+
+import com.android.internal.compat.IPlatformCompat;
+
+/**
+ * Handles caching of calls to {@link com.android.internal.compat.IPlatformCompat}
+ * @hide
+ */
+public final class ChangeIdStateCache
+        extends PropertyInvalidatedCache<ChangeIdStateQuery, Boolean> {
+    private static final String CACHE_KEY = "cache_key.is_compat_change_enabled";
+    private static final int MAX_ENTRIES = 20;
+    private static boolean sDisabled = false;
+
+    /** @hide */
+    public ChangeIdStateCache() {
+        super(MAX_ENTRIES, CACHE_KEY);
+    }
+
+    /**
+     * Disable cache.
+     *
+     * <p>Should only be used in unit tests.
+     * @hide
+     */
+    public static void disable() {
+        sDisabled = true;
+    }
+
+    /**
+     * Invalidate the cache.
+     *
+     * <p>Can only be called by the system server process.
+     * @hide
+     */
+    public static void invalidate() {
+        if (!sDisabled) {
+            PropertyInvalidatedCache.invalidateCache(CACHE_KEY);
+        }
+    }
+
+    @Override
+    protected Boolean recompute(ChangeIdStateQuery query) {
+        IPlatformCompat platformCompat = IPlatformCompat.Stub.asInterface(
+                ServiceManager.getService(Context.PLATFORM_COMPAT_SERVICE));
+        final long token = Binder.clearCallingIdentity();
+        try {
+            if (query.type == ChangeIdStateQuery.QUERY_BY_PACKAGE_NAME) {
+                return platformCompat.isChangeEnabledByPackageName(query.changeId,
+                                                                   query.packageName,
+                                                                   query.userId);
+            } else if (query.type == ChangeIdStateQuery.QUERY_BY_UID) {
+                return platformCompat.isChangeEnabledByUid(query.changeId, query.uid);
+            } else {
+                throw new IllegalArgumentException("Invalid query type: " + query.type);
+            }
+        } catch (RemoteException e) {
+            e.rethrowFromSystemServer();
+        } finally {
+            Binder.restoreCallingIdentity(token);
+        }
+        throw new IllegalStateException("Could not recompute value!");
+    }
+}
diff --git a/core/java/android/app/compat/ChangeIdStateQuery.java b/core/java/android/app/compat/ChangeIdStateQuery.java
new file mode 100644
index 0000000..2c4c120
--- /dev/null
+++ b/core/java/android/app/compat/ChangeIdStateQuery.java
@@ -0,0 +1,87 @@
+/*
+ * 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.app.compat;
+
+import android.annotation.IntDef;
+import android.annotation.NonNull;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.util.Objects;
+
+
+/**
+ * A key type for caching calls to {@link com.android.internal.compat.IPlatformCompat}
+ *
+ * <p>For {@link com.android.internal.compat.IPlatformCompat#isChangeEnabledByPackageName}
+ * and {@link com.android.internal.compat.IPlatformCompat#isChangeEnabledByUid}
+ *
+ * @hide
+ */
+final class ChangeIdStateQuery {
+
+    static final int QUERY_BY_PACKAGE_NAME = 0;
+    static final int QUERY_BY_UID = 1;
+    @IntDef({QUERY_BY_PACKAGE_NAME, QUERY_BY_UID})
+    @Retention(RetentionPolicy.SOURCE)
+    @interface QueryType {}
+
+    public @QueryType int type;
+    public long changeId;
+    public String packageName;
+    public int uid;
+    public int userId;
+
+    private ChangeIdStateQuery(@QueryType int type, long changeId, String packageName,
+                               int uid, int userId) {
+        this.type = type;
+        this.changeId = changeId;
+        this.packageName = packageName;
+        this.uid = uid;
+        this.userId = userId;
+    }
+
+    static ChangeIdStateQuery byPackageName(long changeId, @NonNull String packageName,
+                                            int userId) {
+        return new ChangeIdStateQuery(QUERY_BY_PACKAGE_NAME, changeId, packageName, 0, userId);
+    }
+
+    static ChangeIdStateQuery byUid(long changeId, int uid) {
+        return new ChangeIdStateQuery(QUERY_BY_UID, changeId, null, uid, 0);
+    }
+
+    @Override
+    public boolean equals(Object other) {
+        if (this == other) {
+            return true;
+        }
+        if ((other == null) || !(other instanceof ChangeIdStateQuery)) {
+            return false;
+        }
+        final ChangeIdStateQuery that = (ChangeIdStateQuery) other;
+        return this.type == that.type
+            && this.changeId == that.changeId
+            && Objects.equals(this.packageName, that.packageName)
+            && this.uid == that.uid
+            && this.userId == that.userId;
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(type, changeId, packageName, uid, userId);
+    }
+}
diff --git a/core/java/android/app/compat/CompatChanges.java b/core/java/android/app/compat/CompatChanges.java
index e289a27..0d5e45f 100644
--- a/core/java/android/app/compat/CompatChanges.java
+++ b/core/java/android/app/compat/CompatChanges.java
@@ -19,14 +19,8 @@
 import android.annotation.NonNull;
 import android.annotation.SystemApi;
 import android.compat.Compatibility;
-import android.content.Context;
-import android.os.Binder;
-import android.os.RemoteException;
-import android.os.ServiceManager;
 import android.os.UserHandle;
 
-import com.android.internal.compat.IPlatformCompat;
-
 /**
  * CompatChanges APIs - to be used by platform code only (including mainline
  * modules).
@@ -35,6 +29,7 @@
  */
 @SystemApi
 public final class CompatChanges {
+    private static final ChangeIdStateCache QUERY_CACHE = new ChangeIdStateCache();
     private CompatChanges() {}
 
     /**
@@ -69,17 +64,8 @@
      */
     public static boolean isChangeEnabled(long changeId, @NonNull String packageName,
             @NonNull UserHandle user) {
-        IPlatformCompat platformCompat = IPlatformCompat.Stub.asInterface(
-                ServiceManager.getService(Context.PLATFORM_COMPAT_SERVICE));
-        final long token = Binder.clearCallingIdentity();
-        try {
-            return platformCompat.isChangeEnabledByPackageName(changeId, packageName,
-                    user.getIdentifier());
-        } catch (RemoteException e) {
-            throw e.rethrowFromSystemServer();
-        } finally {
-            Binder.restoreCallingIdentity(token);
-        }
+        return QUERY_CACHE.query(ChangeIdStateQuery.byPackageName(changeId, packageName,
+                                                           user.getIdentifier()));
     }
 
     /**
@@ -101,15 +87,7 @@
      * @return {@code true} if the change is enabled for the current app.
      */
     public static boolean isChangeEnabled(long changeId, int uid) {
-        IPlatformCompat platformCompat = IPlatformCompat.Stub.asInterface(
-                ServiceManager.getService(Context.PLATFORM_COMPAT_SERVICE));
-        final long token = Binder.clearCallingIdentity();
-        try {
-            return platformCompat.isChangeEnabledByUid(changeId, uid);
-        } catch (RemoteException e) {
-            throw e.rethrowFromSystemServer();
-        } finally {
-            Binder.restoreCallingIdentity(token);
-        }
+        return QUERY_CACHE.query(ChangeIdStateQuery.byUid(changeId, uid));
     }
+
 }
diff --git a/core/java/android/bluetooth/BluetoothDevice.java b/core/java/android/bluetooth/BluetoothDevice.java
index 5b60b85..3e1a480 100644
--- a/core/java/android/bluetooth/BluetoothDevice.java
+++ b/core/java/android/bluetooth/BluetoothDevice.java
@@ -25,6 +25,7 @@
 import android.annotation.SdkConstant.SdkConstantType;
 import android.annotation.SuppressLint;
 import android.annotation.SystemApi;
+import android.app.PropertyInvalidatedCache;
 import android.compat.annotation.UnsupportedAppUsage;
 import android.content.Context;
 import android.os.Handler;
@@ -1299,6 +1300,31 @@
         return false;
     }
 
+    private static final String BLUETOOTH_BONDING_CACHE_PROPERTY =
+            "cache_key.bluetooth.get_bond_state";
+    private final PropertyInvalidatedCache<BluetoothDevice, Integer> mBluetoothBondCache =
+            new PropertyInvalidatedCache<BluetoothDevice, Integer>(
+                8, BLUETOOTH_BONDING_CACHE_PROPERTY) {
+                @Override
+                protected Integer recompute(BluetoothDevice query) {
+                    try {
+                        return sService.getBondState(query);
+                    } catch (RemoteException e) {
+                        throw e.rethrowAsRuntimeException();
+                    }
+                }
+            };
+
+    /** @hide */
+    public void disableBluetoothGetBondStateCache() {
+        mBluetoothBondCache.disableLocal();
+    }
+
+    /** @hide */
+    public static void invalidateBluetoothGetBondStateCache() {
+        PropertyInvalidatedCache.invalidateCache(BLUETOOTH_BONDING_CACHE_PROPERTY);
+    }
+
     /**
      * Get the bond state of the remote device.
      * <p>Possible values for the bond state are:
@@ -1316,9 +1342,13 @@
             return BOND_NONE;
         }
         try {
-            return service.getBondState(this);
-        } catch (RemoteException e) {
-            Log.e(TAG, "", e);
+            return mBluetoothBondCache.query(this);
+        } catch (RuntimeException e) {
+            if (e.getCause() instanceof RemoteException) {
+                Log.e(TAG, "", e);
+            } else {
+                throw e;
+            }
         }
         return BOND_NONE;
     }
diff --git a/core/java/android/companion/IFindDeviceCallback.aidl b/core/java/android/companion/IFindDeviceCallback.aidl
index 4e9fa19..405277b 100644
--- a/core/java/android/companion/IFindDeviceCallback.aidl
+++ b/core/java/android/companion/IFindDeviceCallback.aidl
@@ -21,6 +21,6 @@
 /** @hide */
 interface IFindDeviceCallback {
     @UnsupportedAppUsage
-    void onSuccess(in PendingIntent launcher);
-    void onFailure(in CharSequence reason);
+    oneway void onSuccess(in PendingIntent launcher);
+    oneway void onFailure(in CharSequence reason);
 }
diff --git a/core/java/android/content/ContentResolver.java b/core/java/android/content/ContentResolver.java
index f32a4ab..0e0161f 100644
--- a/core/java/android/content/ContentResolver.java
+++ b/core/java/android/content/ContentResolver.java
@@ -700,6 +700,27 @@
     /** @hide */
     public static final String REMOTE_CALLBACK_RESULT = "result";
 
+    /**
+     * How long we wait for an attached process to publish its content providers
+     * before we decide it must be hung.
+     * @hide
+     */
+    public static final int CONTENT_PROVIDER_PUBLISH_TIMEOUT_MILLIS = 10 * 1000;
+
+    /**
+     * How long we wait for an provider to be published. Should be longer than
+     * {@link #CONTENT_PROVIDER_PUBLISH_TIMEOUT_MILLIS}.
+     * @hide
+     */
+    public static final int CONTENT_PROVIDER_WAIT_TIMEOUT_MILLIS =
+            CONTENT_PROVIDER_PUBLISH_TIMEOUT_MILLIS + 10 * 1000;
+
+    // Should be >= {@link #CONTENT_PROVIDER_WAIT_TIMEOUT_MILLIS}, because that's how
+    // long ActivityManagerService is giving a content provider to get published if a new process
+    // needs to be started for that.
+    private static final int GET_TYPE_TIMEOUT_MILLIS =
+            CONTENT_PROVIDER_WAIT_TIMEOUT_MILLIS + 5 * 1000;
+
     public ContentResolver(@Nullable Context context) {
         this(context, null);
     }
@@ -849,8 +870,6 @@
         }
     }
 
-    private static final int GET_TYPE_TIMEOUT_MILLIS = 3000;
-
     private static class GetTypeResultListener implements RemoteCallback.OnResultListener {
         @GuardedBy("this")
         public boolean done;
diff --git a/core/java/android/content/Intent.java b/core/java/android/content/Intent.java
index 2e591ca..acc4cb0 100644
--- a/core/java/android/content/Intent.java
+++ b/core/java/android/content/Intent.java
@@ -6478,6 +6478,21 @@
     public static final int FLAG_ACTIVITY_MATCH_EXTERNAL = 0x00000800;
 
     /**
+     * If set in an intent passed to {@link Context#startActivity Context.startActivity()}, this
+     * flag will only launch the intent if it resolves to a result that is not a browser. If no such
+     * result exists, an {@link ActivityNotFoundException} will be thrown.
+     */
+    public static final int FLAG_ACTIVITY_REQUIRE_NON_BROWSER = 0x00000400;
+
+    /**
+     * If set in an intent passed to {@link Context#startActivity Context.startActivity()}, this
+     * flag will only launch the intent if it resolves to a single result. If no such result exists
+     * or if the system chooser would otherwise be displayed, an {@link ActivityNotFoundException}
+     * will be thrown.
+     */
+    public static final int FLAG_ACTIVITY_REQUIRE_DEFAULT = 0x00000200;
+
+    /**
      * If set, when sending a broadcast only registered receivers will be
      * called -- no BroadcastReceiver components will be launched.
      */
diff --git a/core/java/android/content/IntentFilter.java b/core/java/android/content/IntentFilter.java
index 73c1e2f..61128f2 100644
--- a/core/java/android/content/IntentFilter.java
+++ b/core/java/android/content/IntentFilter.java
@@ -41,7 +41,9 @@
 import java.lang.annotation.RetentionPolicy;
 import java.util.ArrayList;
 import java.util.Iterator;
+import java.util.List;
 import java.util.Set;
+import java.util.function.BiConsumer;
 
 /**
  * Structured description of Intent values to be matched.  An IntentFilter can
@@ -153,7 +155,9 @@
     private static final String AUTH_STR = "auth";
     private static final String SSP_STR = "ssp";
     private static final String SCHEME_STR = "scheme";
+    private static final String STATIC_TYPE_STR = "staticType";
     private static final String TYPE_STR = "type";
+    private static final String GROUP_STR = "group";
     private static final String CAT_STR = "cat";
     private static final String NAME_STR = "name";
     private static final String ACTION_STR = "action";
@@ -280,8 +284,11 @@
     private ArrayList<PatternMatcher> mDataSchemeSpecificParts = null;
     private ArrayList<AuthorityEntry> mDataAuthorities = null;
     private ArrayList<PatternMatcher> mDataPaths = null;
+    private ArrayList<String> mStaticDataTypes = null;
     private ArrayList<String> mDataTypes = null;
-    private boolean mHasPartialTypes = false;
+    private ArrayList<String> mMimeGroups = null;
+    private boolean mHasStaticPartialTypes = false;
+    private boolean mHasDynamicPartialTypes = false;
 
     private static final int STATE_VERIFY_AUTO         = 0x00000001;
     private static final int STATE_NEED_VERIFY         = 0x00000010;
@@ -454,6 +461,9 @@
         if (o.mCategories != null) {
             mCategories = new ArrayList<String>(o.mCategories);
         }
+        if (o.mStaticDataTypes != null) {
+            mStaticDataTypes = new ArrayList<String>(o.mStaticDataTypes);
+        }
         if (o.mDataTypes != null) {
             mDataTypes = new ArrayList<String>(o.mDataTypes);
         }
@@ -469,7 +479,11 @@
         if (o.mDataPaths != null) {
             mDataPaths = new ArrayList<PatternMatcher>(o.mDataPaths);
         }
-        mHasPartialTypes = o.mHasPartialTypes;
+        if (o.mMimeGroups != null) {
+            mMimeGroups = new ArrayList<String>(o.mMimeGroups);
+        }
+        mHasStaticPartialTypes = o.mHasStaticPartialTypes;
+        mHasDynamicPartialTypes = o.mHasDynamicPartialTypes;
         mVerifyState = o.mVerifyState;
         mInstantAppVisibility = o.mInstantAppVisibility;
     }
@@ -776,25 +790,108 @@
      */
     public final void addDataType(String type)
         throws MalformedMimeTypeException {
+        processMimeType(type, (internalType, isPartial) -> {
+            if (mDataTypes == null) {
+                mDataTypes = new ArrayList<>();
+            }
+            if (mStaticDataTypes == null) {
+                mStaticDataTypes = new ArrayList<>();
+            }
+
+            if (mDataTypes.contains(internalType)) {
+                return;
+            }
+
+            mDataTypes.add(internalType.intern());
+            mStaticDataTypes.add(internalType.intern());
+            mHasStaticPartialTypes = mHasStaticPartialTypes || isPartial;
+        });
+    }
+
+    /**
+     * Add a new Intent data type <em>from MIME group</em> to match against.  If any types are
+     * included in the filter, then an Intent's data must be <em>either</em>
+     * one of these types <em>or</em> a matching scheme.  If no data types
+     * are included, then an Intent will only match if it specifies no data.
+     *
+     * <p><em>Note: MIME type matching in the Android framework is
+     * case-sensitive, unlike formal RFC MIME types.  As a result,
+     * you should always write your MIME types with lower case letters,
+     * and any MIME types you receive from outside of Android should be
+     * converted to lower case before supplying them here.</em></p>
+     *
+     * <p>Throws {@link MalformedMimeTypeException} if the given MIME type is
+     * not syntactically correct.
+     *
+     * @param type Name of the data type to match, such as "vnd.android.cursor.dir/person".
+     *
+     * @see #clearDynamicDataTypes()
+     * @hide
+     */
+    public final void addDynamicDataType(String type)
+            throws MalformedMimeTypeException {
+        processMimeType(type, (internalType, isPartial) -> {
+            if (mDataTypes == null) {
+                mDataTypes = new ArrayList<>();
+            }
+
+            if (!mDataTypes.contains(internalType)) {
+                mDataTypes.add(internalType.intern());
+
+                mHasDynamicPartialTypes = mHasDynamicPartialTypes || isPartial;
+            }
+        });
+    }
+
+    /**
+     * Process mime type - convert to representation used internally and check if type is partial,
+     * and then call provided action
+     */
+    private void processMimeType(String type, BiConsumer<String, Boolean> action)
+            throws MalformedMimeTypeException {
         final int slashpos = type.indexOf('/');
         final int typelen = type.length();
-        if (slashpos > 0 && typelen >= slashpos+2) {
-            if (mDataTypes == null) mDataTypes = new ArrayList<String>();
-            if (typelen == slashpos+2 && type.charAt(slashpos+1) == '*') {
-                String str = type.substring(0, slashpos);
-                if (!mDataTypes.contains(str)) {
-                    mDataTypes.add(str.intern());
-                }
-                mHasPartialTypes = true;
-            } else {
-                if (!mDataTypes.contains(type)) {
-                    mDataTypes.add(type.intern());
-                }
-            }
+        if (slashpos <= 0 || typelen < slashpos + 2) {
+            throw new MalformedMimeTypeException(type);
+        }
+
+        String internalType = type;
+        boolean isPartialType = false;
+        if (typelen == slashpos + 2 && type.charAt(slashpos + 1) == '*') {
+            internalType = type.substring(0, slashpos);
+            isPartialType = true;
+        }
+
+        action.accept(internalType, isPartialType);
+    }
+
+    /**
+     * Remove all previously added Intent data types from IntentFilter.
+     *
+     * @see #addDynamicDataType(String)
+     * @hide
+     */
+    public final void clearDynamicDataTypes() {
+        if (mDataTypes == null) {
             return;
         }
 
-        throw new MalformedMimeTypeException(type);
+        if (mStaticDataTypes != null) {
+            mDataTypes.clear();
+            mDataTypes.addAll(mStaticDataTypes);
+        } else {
+            mDataTypes = null;
+        }
+
+        mHasDynamicPartialTypes = false;
+    }
+
+    /**
+     * Return the number of static data types in the filter.
+     * @hide
+     */
+    public int countStaticDataTypes() {
+        return mStaticDataTypes != null ? mStaticDataTypes.size() : 0;
     }
 
     /**
@@ -815,6 +912,16 @@
         return mDataTypes != null && mDataTypes.contains(type);
     }
 
+    /** @hide */
+    public final boolean hasExactDynamicDataType(String type) {
+        return hasExactDataType(type) && !hasExactStaticDataType(type);
+    }
+
+    /** @hide */
+    public final boolean hasExactStaticDataType(String type) {
+        return mStaticDataTypes != null && mStaticDataTypes.contains(type);
+    }
+
     /**
      * Return the number of data types in the filter.
      */
@@ -837,6 +944,44 @@
     }
 
     /**
+     * Return copy of filter's data types.
+     * @hide
+     */
+    public final List<String> dataTypes() {
+        return mDataTypes != null ? new ArrayList<>(mDataTypes) : null;
+    }
+
+    /** @hide */
+    public final void addMimeGroup(String name) {
+        if (mMimeGroups == null) {
+            mMimeGroups = new ArrayList<>();
+        }
+        if (!mMimeGroups.contains(name)) {
+            mMimeGroups.add(name);
+        }
+    }
+
+    /** @hide */
+    public final boolean hasMimeGroup(String name) {
+        return mMimeGroups != null && mMimeGroups.contains(name);
+    }
+
+    /** @hide */
+    public final String getMimeGroup(int index) {
+        return mMimeGroups.get(index);
+    }
+
+    /** @hide */
+    public final int countMimeGroups() {
+        return mMimeGroups != null ? mMimeGroups.size() : 0;
+    }
+
+    /** @hide */
+    public final Iterator<String> mimeGroupsIterator() {
+        return mMimeGroups != null ? mMimeGroups.iterator() : null;
+    }
+
+    /**
      * Add a new Intent data scheme to match against.  If any schemes are
      * included in the filter, then an Intent's data must be <em>either</em>
      * one of these schemes <em>or</em> a matching data type.  If no schemes
@@ -1617,13 +1762,12 @@
             serializer.attribute(null, NAME_STR, mCategories.get(i));
             serializer.endTag(null, CAT_STR);
         }
-        N = countDataTypes();
+        writeDataTypesToXml(serializer);
+        N = countMimeGroups();
         for (int i=0; i<N; i++) {
-            serializer.startTag(null, TYPE_STR);
-            String type = mDataTypes.get(i);
-            if (type.indexOf('/') < 0) type = type + "/*";
-            serializer.attribute(null, NAME_STR, type);
-            serializer.endTag(null, TYPE_STR);
+            serializer.startTag(null, GROUP_STR);
+            serializer.attribute(null, NAME_STR, mMimeGroups.get(i));
+            serializer.endTag(null, GROUP_STR);
         }
         N = countDataSchemes();
         for (int i=0; i<N; i++) {
@@ -1683,6 +1827,46 @@
         }
     }
 
+    /**
+     * Write data types (both static and dynamic) to XML.
+     * In implementation we rely on two facts:
+     * - {@link #mStaticDataTypes} is subsequence of {@link #mDataTypes}
+     * - both {@link #mStaticDataTypes} and {@link #mDataTypes} does not contain duplicates
+     */
+    private void writeDataTypesToXml(XmlSerializer serializer) throws IOException {
+        if (mStaticDataTypes == null) {
+            return;
+        }
+
+        int i = 0;
+        for (String staticType: mStaticDataTypes) {
+            while (!mDataTypes.get(i).equals(staticType)) {
+                writeDataTypeToXml(serializer, mDataTypes.get(i), TYPE_STR);
+                i++;
+            }
+
+            writeDataTypeToXml(serializer, staticType, STATIC_TYPE_STR);
+            i++;
+        }
+
+        while (i < mDataTypes.size()) {
+            writeDataTypeToXml(serializer, mDataTypes.get(i), TYPE_STR);
+            i++;
+        }
+    }
+
+    private void writeDataTypeToXml(XmlSerializer serializer, String type, String tag)
+            throws IOException {
+        serializer.startTag(null, tag);
+
+        if (type.indexOf('/') < 0) {
+            type = type + "/*";
+        }
+
+        serializer.attribute(null, NAME_STR, type);
+        serializer.endTag(null, tag);
+    }
+
     public void readFromXml(XmlPullParser parser) throws XmlPullParserException,
             IOException {
         String autoVerify = parser.getAttributeValue(null, AUTO_VERIFY_STR);
@@ -1709,7 +1893,7 @@
                 if (name != null) {
                     addCategory(name);
                 }
-            } else if (tagName.equals(TYPE_STR)) {
+            } else if (tagName.equals(STATIC_TYPE_STR)) {
                 String name = parser.getAttributeValue(null, NAME_STR);
                 if (name != null) {
                     try {
@@ -1717,6 +1901,19 @@
                     } catch (MalformedMimeTypeException e) {
                     }
                 }
+            } else if (tagName.equals(TYPE_STR)) {
+                String name = parser.getAttributeValue(null, NAME_STR);
+                if (name != null) {
+                    try {
+                        addDynamicDataType(name);
+                    } catch (MalformedMimeTypeException e) {
+                    }
+                }
+            } else if (tagName.equals(GROUP_STR)) {
+                String name = parser.getAttributeValue(null, NAME_STR);
+                if (name != null) {
+                    addMimeGroup(name);
+                }
             } else if (tagName.equals(SCHEME_STR)) {
                 String name = parser.getAttributeValue(null, NAME_STR);
                 if (name != null) {
@@ -1802,9 +1999,15 @@
                 proto.write(IntentFilterProto.DATA_TYPES, it.next());
             }
         }
-        if (mPriority != 0 || mHasPartialTypes) {
+        if (mMimeGroups != null) {
+            Iterator<String> it = mMimeGroups.iterator();
+            while (it.hasNext()) {
+                proto.write(IntentFilterProto.MIME_GROUPS, it.next());
+            }
+        }
+        if (mPriority != 0 || hasPartialTypes()) {
             proto.write(IntentFilterProto.PRIORITY, mPriority);
-            proto.write(IntentFilterProto.HAS_PARTIAL_TYPES, mHasPartialTypes);
+            proto.write(IntentFilterProto.HAS_PARTIAL_TYPES, hasPartialTypes());
         }
         proto.write(IntentFilterProto.GET_AUTO_VERIFY, getAutoVerify());
         proto.end(token);
@@ -1871,20 +2074,45 @@
                 du.println(sb.toString());
             }
         }
-        if (mDataTypes != null) {
-            Iterator<String> it = mDataTypes.iterator();
+        if (mStaticDataTypes != null) {
+            Iterator<String> it = mStaticDataTypes.iterator();
             while (it.hasNext()) {
                 sb.setLength(0);
-                sb.append(prefix); sb.append("Type: \"");
-                        sb.append(it.next()); sb.append("\"");
+                sb.append(prefix); sb.append("StaticType: \"");
+                sb.append(it.next()); sb.append("\"");
                 du.println(sb.toString());
             }
         }
-        if (mPriority != 0 || mOrder != 0 || mHasPartialTypes) {
+        if (mDataTypes != null) {
+            Iterator<String> it = mDataTypes.iterator();
+            while (it.hasNext()) {
+                String dataType = it.next();
+                if (hasExactStaticDataType(dataType)) {
+                    continue;
+                }
+
+                sb.setLength(0);
+                sb.append(prefix); sb.append("Type: \"");
+                sb.append(dataType); sb.append("\"");
+                du.println(sb.toString());
+            }
+        }
+        if (mMimeGroups != null) {
+            Iterator<String> it = mMimeGroups.iterator();
+            while (it.hasNext()) {
+                sb.setLength(0);
+                sb.append(prefix); sb.append("MimeGroup: \"");
+                sb.append(it.next()); sb.append("\"");
+                du.println(sb.toString());
+            }
+        }
+        if (mPriority != 0 || mOrder != 0 || hasPartialTypes()) {
             sb.setLength(0);
-            sb.append(prefix); sb.append("mPriority="); sb.append(mPriority);
-                    sb.append(", mOrder="); sb.append(mOrder);
-                    sb.append(", mHasPartialTypes="); sb.append(mHasPartialTypes);
+            sb.append(prefix);
+            sb.append("mPriority="); sb.append(mPriority);
+            sb.append(", mOrder="); sb.append(mOrder);
+            sb.append(", mHasStaticPartialTypes="); sb.append(mHasStaticPartialTypes);
+            sb.append(", mHasDynamicPartialTypes="); sb.append(mHasDynamicPartialTypes);
             du.println(sb.toString());
         }
         if (getAutoVerify()) {
@@ -1923,12 +2151,24 @@
         } else {
             dest.writeInt(0);
         }
+        if (mStaticDataTypes != null) {
+            dest.writeInt(1);
+            dest.writeStringList(mStaticDataTypes);
+        } else {
+            dest.writeInt(0);
+        }
         if (mDataTypes != null) {
             dest.writeInt(1);
             dest.writeStringList(mDataTypes);
         } else {
             dest.writeInt(0);
         }
+        if (mMimeGroups != null) {
+            dest.writeInt(1);
+            dest.writeStringList(mMimeGroups);
+        } else {
+            dest.writeInt(0);
+        }
         if (mDataSchemeSpecificParts != null) {
             final int N = mDataSchemeSpecificParts.size();
             dest.writeInt(N);
@@ -1957,7 +2197,8 @@
             dest.writeInt(0);
         }
         dest.writeInt(mPriority);
-        dest.writeInt(mHasPartialTypes ? 1 : 0);
+        dest.writeInt(mHasStaticPartialTypes ? 1 : 0);
+        dest.writeInt(mHasDynamicPartialTypes ? 1 : 0);
         dest.writeInt(getAutoVerify() ? 1 : 0);
         dest.writeInt(mInstantAppVisibility);
         dest.writeInt(mOrder);
@@ -2002,9 +2243,17 @@
             source.readStringList(mDataSchemes);
         }
         if (source.readInt() != 0) {
+            mStaticDataTypes = new ArrayList<String>();
+            source.readStringList(mStaticDataTypes);
+        }
+        if (source.readInt() != 0) {
             mDataTypes = new ArrayList<String>();
             source.readStringList(mDataTypes);
         }
+        if (source.readInt() != 0) {
+            mMimeGroups = new ArrayList<String>();
+            source.readStringList(mMimeGroups);
+        }
         int N = source.readInt();
         if (N > 0) {
             mDataSchemeSpecificParts = new ArrayList<PatternMatcher>(N);
@@ -2027,12 +2276,17 @@
             }
         }
         mPriority = source.readInt();
-        mHasPartialTypes = source.readInt() > 0;
+        mHasStaticPartialTypes = source.readInt() > 0;
+        mHasDynamicPartialTypes = source.readInt() > 0;
         setAutoVerify(source.readInt() > 0);
         setVisibilityToInstantApp(source.readInt());
         mOrder = source.readInt();
     }
 
+    private boolean hasPartialTypes() {
+        return mHasStaticPartialTypes || mHasDynamicPartialTypes;
+    }
+
     private final boolean findMimeType(String type) {
         final ArrayList<String> t = mDataTypes;
 
@@ -2051,13 +2305,13 @@
         }
 
         // Deal with this IntentFilter wanting to match every Intent type.
-        if (mHasPartialTypes && t.contains("*")) {
+        if (hasPartialTypes() && t.contains("*")) {
             return true;
         }
 
         final int slashpos = type.indexOf('/');
         if (slashpos > 0) {
-            if (mHasPartialTypes && t.contains(type.substring(0, slashpos))) {
+            if (hasPartialTypes() && t.contains(type.substring(0, slashpos))) {
                 return true;
             }
             if (typeLength == slashpos+2 && type.charAt(slashpos+1) == '*') {
diff --git a/core/java/android/content/om/OverlayInfo.java b/core/java/android/content/om/OverlayInfo.java
index a3487be..55a6cab 100644
--- a/core/java/android/content/om/OverlayInfo.java
+++ b/core/java/android/content/om/OverlayInfo.java
@@ -45,7 +45,7 @@
             STATE_NO_IDMAP,
             STATE_DISABLED,
             STATE_ENABLED,
-            STATE_ENABLED_STATIC,
+            STATE_ENABLED_IMMUTABLE,
             // @Deprecated STATE_TARGET_IS_BEING_REPLACED,
             STATE_OVERLAY_IS_BEING_REPLACED,
     })
@@ -117,11 +117,12 @@
 
     /**
      * The overlay package is currently enabled because it is marked as
-     * 'static'. It cannot be disabled but will change state if for instance
+     * 'immutable'. It cannot be disabled but will change state if for instance
      * its target is uninstalled.
      * @hide
      */
-    public static final int STATE_ENABLED_STATIC = 6;
+    @Deprecated
+    public static final int STATE_ENABLED_IMMUTABLE = 6;
 
     /**
      * Overlay category: theme.
@@ -180,21 +181,21 @@
     public final int userId;
 
     /**
-     * Priority as read from the manifest. Used if isStatic is true. Not
-     * intended to be exposed to 3rd party.
+     * Priority as configured by {@link com.android.internal.content.om.OverlayConfig}.
+     * Not intended to be exposed to 3rd party.
      *
      * @hide
      */
     public final int priority;
 
     /**
-     * isStatic as read from the manifest. If true, the overlay is
-     * unconditionally loaded and cannot be unloaded. Not intended to be
+     * isMutable as configured by {@link com.android.internal.content.om.OverlayConfig}.
+     * If false, the overlay is unconditionally loaded and cannot be unloaded. Not intended to be
      * exposed to 3rd party.
      *
      * @hide
      */
-    public final boolean isStatic;
+    public final boolean isMutable;
 
     /**
      * Create a new OverlayInfo based on source with an updated state.
@@ -207,14 +208,14 @@
     public OverlayInfo(@NonNull OverlayInfo source, @State int state) {
         this(source.packageName, source.targetPackageName, source.targetOverlayableName,
                 source.category, source.baseCodePath, state, source.userId, source.priority,
-                source.isStatic);
+                source.isMutable);
     }
 
     /** @hide */
     public OverlayInfo(@NonNull String packageName, @NonNull String targetPackageName,
             @Nullable String targetOverlayableName, @Nullable String category,
             @NonNull String baseCodePath, int state, int userId,
-            int priority, boolean isStatic) {
+            int priority, boolean isMutable) {
         this.packageName = packageName;
         this.targetPackageName = targetPackageName;
         this.targetOverlayableName = targetOverlayableName;
@@ -223,7 +224,7 @@
         this.state = state;
         this.userId = userId;
         this.priority = priority;
-        this.isStatic = isStatic;
+        this.isMutable = isMutable;
         ensureValidState();
     }
 
@@ -237,7 +238,7 @@
         state = source.readInt();
         userId = source.readInt();
         priority = source.readInt();
-        isStatic = source.readBoolean();
+        isMutable = source.readBoolean();
         ensureValidState();
     }
 
@@ -307,7 +308,7 @@
             case STATE_NO_IDMAP:
             case STATE_DISABLED:
             case STATE_ENABLED:
-            case STATE_ENABLED_STATIC:
+            case STATE_ENABLED_IMMUTABLE:
             case STATE_TARGET_IS_BEING_REPLACED:
             case STATE_OVERLAY_IS_BEING_REPLACED:
                 break;
@@ -331,7 +332,7 @@
         dest.writeInt(state);
         dest.writeInt(userId);
         dest.writeInt(priority);
-        dest.writeBoolean(isStatic);
+        dest.writeBoolean(isMutable);
     }
 
     public static final @android.annotation.NonNull Parcelable.Creator<OverlayInfo> CREATOR =
@@ -360,7 +361,7 @@
     public boolean isEnabled() {
         switch (state) {
             case STATE_ENABLED:
-            case STATE_ENABLED_STATIC:
+            case STATE_ENABLED_IMMUTABLE:
                 return true;
             default:
                 return false;
@@ -386,8 +387,8 @@
                 return "STATE_DISABLED";
             case STATE_ENABLED:
                 return "STATE_ENABLED";
-            case STATE_ENABLED_STATIC:
-                return "STATE_ENABLED_STATIC";
+            case STATE_ENABLED_IMMUTABLE:
+                return "STATE_ENABLED_IMMUTABLE";
             case STATE_TARGET_IS_BEING_REPLACED:
                 return "STATE_TARGET_IS_BEING_REPLACED";
             case STATE_OVERLAY_IS_BEING_REPLACED:
diff --git a/core/java/android/content/pm/CrossProfileApps.java b/core/java/android/content/pm/CrossProfileApps.java
index eb1da67..3261cb1 100644
--- a/core/java/android/content/pm/CrossProfileApps.java
+++ b/core/java/android/content/pm/CrossProfileApps.java
@@ -19,6 +19,7 @@
 import android.annotation.Nullable;
 import android.annotation.RequiresPermission;
 import android.annotation.SystemApi;
+import android.app.Activity;
 import android.app.AppOpsManager.Mode;
 import android.content.ComponentName;
 import android.content.Context;
@@ -116,18 +117,25 @@
      * @param targetUser The {@link UserHandle} of the profile; must be one of the users returned by
      *        {@link #getTargetUserProfiles()} if different to the calling user, otherwise a
      *        {@link SecurityException} will be thrown.
+     * @param callingActivity The activity to start the new activity from for the purposes of
+     *        deciding which task the new activity should belong to. If {@code null}, the activity
+     *        will always be started in a new task.
      */
     @RequiresPermission(anyOf = {
             android.Manifest.permission.INTERACT_ACROSS_PROFILES,
             android.Manifest.permission.INTERACT_ACROSS_USERS})
-    public void startActivity(@NonNull Intent intent, @NonNull UserHandle targetUser) {
+    public void startActivity(
+            @NonNull Intent intent,
+            @NonNull UserHandle targetUser,
+            @Nullable Activity callingActivity) {
         try {
             mService.startActivityAsUserByIntent(
                     mContext.getIApplicationThread(),
                     mContext.getPackageName(),
                     mContext.getFeatureId(),
                     intent,
-                    targetUser.getIdentifier());
+                    targetUser.getIdentifier(),
+                    callingActivity != null ? callingActivity.getActivityToken() : null);
         } catch (RemoteException ex) {
             throw ex.rethrowFromSystemServer();
         }
diff --git a/core/java/android/content/pm/CrossProfileAppsInternal.java b/core/java/android/content/pm/CrossProfileAppsInternal.java
index 9ff4417..16a749f 100644
--- a/core/java/android/content/pm/CrossProfileAppsInternal.java
+++ b/core/java/android/content/pm/CrossProfileAppsInternal.java
@@ -17,6 +17,9 @@
 package android.content.pm;
 
 import android.annotation.UserIdInt;
+import android.os.UserHandle;
+
+import java.util.List;
 
 /**
  * Exposes internal methods from {@link com.android.server.pm.CrossProfileAppsServiceImpl} to other
@@ -52,4 +55,11 @@
      */
     public abstract boolean verifyUidHasInteractAcrossProfilePermission(String packageName,
             int uid);
+
+    /**
+     * Returns the list of target user profiles for the given package on the given user. See {@link
+     * CrossProfileApps#getTargetUserProfiles()}.
+     */
+    public abstract List<UserHandle> getTargetUserProfiles(
+            String packageName, @UserIdInt int userId);
 }
diff --git a/core/java/android/content/pm/ICrossProfileApps.aidl b/core/java/android/content/pm/ICrossProfileApps.aidl
index 98bf2dd..5a6e008 100644
--- a/core/java/android/content/pm/ICrossProfileApps.aidl
+++ b/core/java/android/content/pm/ICrossProfileApps.aidl
@@ -31,7 +31,7 @@
             in String callingFeatureId, in ComponentName component, int userId,
             boolean launchMainActivity);
     void startActivityAsUserByIntent(in IApplicationThread caller, in String callingPackage,
-            in String callingFeatureId, in Intent intent, int userId);
+            in String callingFeatureId, in Intent intent, int userId, in IBinder callingActivity);
     List<UserHandle> getTargetUserProfiles(in String callingPackage);
     boolean canInteractAcrossProfiles(in String callingPackage);
     boolean canRequestInteractAcrossProfiles(in String callingPackage);
diff --git a/core/java/android/content/pm/IPackageManager.aidl b/core/java/android/content/pm/IPackageManager.aidl
index 6552d1b..b89901a 100644
--- a/core/java/android/content/pm/IPackageManager.aidl
+++ b/core/java/android/content/pm/IPackageManager.aidl
@@ -749,4 +749,11 @@
     // a large change that modifies many repos.
     //------------------------------------------------------------------------
     int checkUidPermission(String permName, int uid);
+
+    void setMimeGroup(String packageName, String group, in List<String> mimeTypes);
+
+    void clearMimeGroup(String packageName, String group);
+
+    List<String> getMimeGroup(String packageName, String group);
+
 }
diff --git a/core/java/android/content/pm/PackageManager.java b/core/java/android/content/pm/PackageManager.java
index 03ed373..ab3982a 100644
--- a/core/java/android/content/pm/PackageManager.java
+++ b/core/java/android/content/pm/PackageManager.java
@@ -3023,6 +3023,18 @@
     public static final String FEATURE_TUNER = "android.hardware.tv.tuner";
 
     /**
+     * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: The device has
+     * the necessary changes to support app enumeration.
+     *
+     * @hide
+     */
+    @SdkConstant(SdkConstantType.FEATURE)
+    public static final String FEATURE_APP_ENUMERATION = "android.software.app_enumeration";
+
+    /** @hide */
+    public static final boolean APP_ENUMERATION_ENABLED_BY_DEFAULT = true;
+
+    /**
      * Extra field name for the URI to a verification file. Passed to a package
      * verifier.
      *
@@ -7818,4 +7830,37 @@
         return resId == com.android.internal.R.drawable.sym_def_app_icon
                 || resId == com.android.internal.R.drawable.sym_app_on_sd_unavailable_icon;
     }
+
+    /**
+     * Sets MIME group's MIME types
+     *
+     * @param mimeGroup MIME group to modify
+     * @param mimeTypes new MIME types contained by MIME group
+     */
+    public void setMimeGroup(@NonNull String mimeGroup, @NonNull Set<String> mimeTypes) {
+        throw new UnsupportedOperationException(
+                "setMimeGroup not implemented in subclass");
+    }
+
+    /**
+     * Clears MIME group by removing all MIME types from it
+     *
+     * @param mimeGroup MIME group to clear
+     */
+    public void clearMimeGroup(@NonNull String mimeGroup) {
+        throw new UnsupportedOperationException(
+                "clearMimeGroup not implemented in subclass");
+    }
+
+    /**
+     * Gets all MIME types that MIME group contains
+     *
+     * @return MIME types contained by the MIME group,
+     *         or null if the MIME group was not declared in the manifest.
+     */
+    @Nullable
+    public Set<String> getMimeGroup(@NonNull String mimeGroup) {
+        throw new UnsupportedOperationException(
+                "getMimeGroup not implemented in subclass");
+    }
 }
diff --git a/core/java/android/content/pm/PackageParser.java b/core/java/android/content/pm/PackageParser.java
index da44f70..168679e 100644
--- a/core/java/android/content/pm/PackageParser.java
+++ b/core/java/android/content/pm/PackageParser.java
@@ -483,6 +483,9 @@
         public final boolean isolatedSplits;
         public final boolean isSplitRequired;
         public final boolean useEmbeddedDex;
+        public final String targetPackageName;
+        public final boolean overlayIsStatic;
+        public final int overlayPriority;
 
         public ApkLite(String codePath, String packageName, String splitName,
                 boolean isFeatureSplit,
@@ -492,6 +495,7 @@
                 SigningDetails signingDetails, boolean coreApp,
                 boolean debuggable, boolean multiArch, boolean use32bitAbi,
                 boolean useEmbeddedDex, boolean extractNativeLibs, boolean isolatedSplits,
+                String targetPackageName, boolean overlayIsStatic, int overlayPriority,
                 int minSdkVersion, int targetSdkVersion) {
             this.codePath = codePath;
             this.packageName = packageName;
@@ -513,6 +517,9 @@
             this.extractNativeLibs = extractNativeLibs;
             this.isolatedSplits = isolatedSplits;
             this.isSplitRequired = isSplitRequired;
+            this.targetPackageName = targetPackageName;
+            this.overlayIsStatic = overlayIsStatic;
+            this.overlayPriority = overlayPriority;
             this.minSdkVersion = minSdkVersion;
             this.targetSdkVersion = targetSdkVersion;
         }
@@ -1784,6 +1791,12 @@
         boolean useEmbeddedDex = false;
         String configForSplit = null;
         String usesSplitName = null;
+        String targetPackage = null;
+        boolean overlayIsStatic = false;
+        int overlayPriority = 0;
+
+        String requiredSystemPropertyName = null;
+        String requiredSystemPropertyValue = null;
 
         for (int i = 0; i < attrs.getAttributeCount(); i++) {
             final String attr = attrs.getAttributeName(i);
@@ -1848,6 +1861,21 @@
                         useEmbeddedDex = attrs.getAttributeBooleanValue(i, false);
                     }
                 }
+            } else if (PackageParser.TAG_OVERLAY.equals(parser.getName())) {
+                for (int i = 0; i < attrs.getAttributeCount(); ++i) {
+                    final String attr = attrs.getAttributeName(i);
+                    if ("requiredSystemPropertyName".equals(attr)) {
+                        requiredSystemPropertyName = attrs.getAttributeValue(i);
+                    } else if ("requiredSystemPropertyValue".equals(attr)) {
+                        requiredSystemPropertyValue = attrs.getAttributeValue(i);
+                    } else if ("targetPackage".equals(attr)) {
+                        targetPackage = attrs.getAttributeValue(i);;
+                    } else if ("isStatic".equals(attr)) {
+                        overlayIsStatic = attrs.getAttributeBooleanValue(i, false);
+                    } else if ("priority".equals(attr)) {
+                        overlayPriority = attrs.getAttributeIntValue(i, 0);
+                    }
+                }
             } else if (TAG_USES_SPLIT.equals(parser.getName())) {
                 if (usesSplitName != null) {
                     Slog.w(TAG, "Only one <uses-split> permitted. Ignoring others.");
@@ -1874,11 +1902,22 @@
             }
         }
 
+        // Check to see if overlay should be excluded based on system property condition
+        if (!checkRequiredSystemProperty(requiredSystemPropertyName,
+                requiredSystemPropertyValue)) {
+            Slog.i(TAG, "Skipping target and overlay pair " + targetPackage + " and "
+                    + codePath + ": overlay ignored due to required system property: "
+                    + requiredSystemPropertyName + " with value: " + requiredSystemPropertyValue);
+            targetPackage = null;
+            overlayIsStatic = false;
+            overlayPriority = 0;
+        }
+
         return new ApkLite(codePath, packageSplit.first, packageSplit.second, isFeatureSplit,
                 configForSplit, usesSplitName, isSplitRequired, versionCode, versionCodeMajor,
                 revisionCode, installLocation, verifiers, signingDetails, coreApp, debuggable,
                 multiArch, use32bitAbi, useEmbeddedDex, extractNativeLibs, isolatedSplits,
-                minSdkVersion, targetSdkVersion);
+                targetPackage, overlayIsStatic, overlayPriority, minSdkVersion, targetSdkVersion);
     }
 
     /**
@@ -2162,7 +2201,7 @@
                 }
 
                 // check to see if overlay should be excluded based on system property condition
-                if (!checkOverlayRequiredSystemProperty(propName, propValue)) {
+                if (!checkRequiredSystemProperty(propName, propValue)) {
                     Slog.i(TAG, "Skipping target and overlay pair " + pkg.mOverlayTarget + " and "
                         + pkg.baseCodePath+ ": overlay ignored due to required system property: "
                         + propName + " with value: " + propValue);
@@ -2590,8 +2629,11 @@
         return pkg;
     }
 
-    private boolean checkOverlayRequiredSystemProperty(String propName, String propValue) {
-
+    /**
+     * Returns {@code true} if both the property name and value are empty or if the given system
+     * property is set to the specified value. In all other cases, returns {@code false}
+     */
+    public static boolean checkRequiredSystemProperty(String propName, String propValue) {
         if (TextUtils.isEmpty(propName) || TextUtils.isEmpty(propValue)) {
             if (!TextUtils.isEmpty(propName) || !TextUtils.isEmpty(propValue)) {
                 // malformed condition - incomplete
diff --git a/core/java/android/content/pm/PackagePartitions.java b/core/java/android/content/pm/PackagePartitions.java
new file mode 100644
index 0000000..9b8396e
--- /dev/null
+++ b/core/java/android/content/pm/PackagePartitions.java
@@ -0,0 +1,213 @@
+/*
+ * 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.content.pm;
+
+import android.annotation.IntDef;
+import android.annotation.NonNull;
+import android.annotation.Nullable;
+import android.os.Environment;
+import android.os.FileUtils;
+
+import com.android.internal.annotations.VisibleForTesting;
+
+import java.io.File;
+import java.io.IOException;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.function.Function;
+
+/**
+ * Exposes {@link #SYSTEM_PARTITIONS} which represents the partitions in which application packages
+ * can be installed. The partitions are ordered from most generic (lowest priority) to most specific
+ * (greatest priority).
+ *
+ * @hide
+ **/
+public class PackagePartitions {
+    public static final int PARTITION_SYSTEM = 0;
+    public static final int PARTITION_VENDOR = 1;
+    public static final int PARTITION_ODM = 2;
+    public static final int PARTITION_OEM = 3;
+    public static final int PARTITION_PRODUCT = 4;
+    public static final int PARTITION_SYSTEM_EXT = 5;
+
+    @IntDef(flag = true, prefix = { "PARTITION_" }, value = {
+        PARTITION_SYSTEM,
+        PARTITION_VENDOR,
+        PARTITION_ODM,
+        PARTITION_OEM,
+        PARTITION_PRODUCT,
+        PARTITION_SYSTEM_EXT
+    })
+    @Retention(RetentionPolicy.SOURCE)
+    public @interface PartitionType {}
+
+    /**
+     * The list of all system partitions that may contain packages in ascending order of
+     * specificity (the more generic, the earlier in the list a partition appears).
+     */
+    private static final ArrayList<SystemPartition> SYSTEM_PARTITIONS =
+            new ArrayList<>(Arrays.asList(
+                    new SystemPartition(Environment.getRootDirectory(), PARTITION_SYSTEM,
+                            true /* containsPrivApp */, false /* containsOverlay */),
+                    new SystemPartition(Environment.getVendorDirectory(), PARTITION_VENDOR,
+                            true /* containsPrivApp */, true /* containsOverlay */),
+                    new SystemPartition(Environment.getOdmDirectory(), PARTITION_ODM,
+                            true /* containsPrivApp */, true /* containsOverlay */),
+                    new SystemPartition(Environment.getOemDirectory(), PARTITION_OEM,
+                            false /* containsPrivApp */, true /* containsOverlay */),
+                    new SystemPartition(Environment.getProductDirectory(), PARTITION_PRODUCT,
+                            true /* containsPrivApp */, true /* containsOverlay */),
+                    new SystemPartition(Environment.getSystemExtDirectory(), PARTITION_SYSTEM_EXT,
+                            true /* containsPrivApp */, true /* containsOverlay */)));
+
+    /**
+     * Returns a list in which the elements are products of the specified function applied to the
+     * list of {@link #SYSTEM_PARTITIONS} in increasing specificity order.
+     */
+    public static <T> ArrayList<T> getOrderedPartitions(
+            @NonNull Function<SystemPartition, T> producer) {
+        final ArrayList<T> out = new ArrayList<>();
+        for (int i = 0, n = SYSTEM_PARTITIONS.size(); i < n; i++) {
+            final T v = producer.apply(SYSTEM_PARTITIONS.get(i));
+            if (v != null)  {
+                out.add(v);
+            }
+        }
+        return out;
+    }
+
+    /** Represents a partition that contains application packages. */
+    @VisibleForTesting(visibility = VisibleForTesting.Visibility.PRIVATE)
+    public static class SystemPartition {
+        @NonNull
+        public final File folder;
+
+        @PartitionType
+        public final int type;
+
+        @Nullable
+        private final DeferredCanonicalFile mAppFolder;
+
+        @Nullable
+        private final DeferredCanonicalFile mPrivAppFolder;
+
+        @Nullable
+        private final DeferredCanonicalFile mOverlayFolder;
+
+        private SystemPartition(@NonNull File folder, @PartitionType int type,
+                boolean containsPrivApp, boolean containsOverlay) {
+            this.folder = folder;
+            this.type = type;
+            this.mAppFolder = new DeferredCanonicalFile(folder, "app");
+            this.mPrivAppFolder = containsPrivApp ?
+                    new DeferredCanonicalFile(folder, "priv-app") : null;
+            this.mOverlayFolder = containsOverlay ?
+                    new DeferredCanonicalFile(folder, "overlay") : null;
+        }
+
+        public SystemPartition(@NonNull SystemPartition original) {
+            this.folder = original.folder;
+            this.type = original.type;
+            this.mAppFolder = original.mAppFolder;
+            this.mPrivAppFolder = original.mPrivAppFolder;
+            this.mOverlayFolder = original.mOverlayFolder;
+        }
+
+        /**
+         * Creates a partition containing the same folders as the original partition but with a
+         * different root folder.
+         */
+        public SystemPartition(@NonNull File rootFolder, @NonNull SystemPartition partition) {
+            this(rootFolder, partition.type, partition.mPrivAppFolder != null,
+                    partition.mOverlayFolder != null);
+        }
+
+        /** Returns the canonical app folder of the partition. */
+        @Nullable
+        public File getAppFolder() {
+            return mAppFolder == null ? null : mAppFolder.getFile();
+        }
+
+        /** Returns the canonical priv-app folder of the partition, if one exists. */
+        @Nullable
+        public File getPrivAppFolder() {
+            return mPrivAppFolder == null ? null : mPrivAppFolder.getFile();
+        }
+
+        /** Returns the canonical overlay folder of the partition, if one exists. */
+        @Nullable
+        public File getOverlayFolder() {
+            return mOverlayFolder == null ? null : mOverlayFolder.getFile();
+        }
+
+        /** Returns whether the partition contains the specified file in its priv-app folder. */
+        public boolean containsPrivApp(@NonNull File scanFile) {
+            return FileUtils.contains(mPrivAppFolder.getFile(), scanFile);
+        }
+
+        /** Returns whether the partition contains the specified file in its app folder. */
+        public boolean containsApp(@NonNull File scanFile) {
+            return FileUtils.contains(mAppFolder.getFile(), scanFile);
+        }
+
+        /** Returns whether the partition contains the specified file in its overlay folder. */
+        public boolean containsOverlay(@NonNull File scanFile) {
+            return FileUtils.contains(mOverlayFolder.getFile(), scanFile);
+        }
+
+        /** Returns whether the partition contains the specified file. */
+        public boolean containsPath(@NonNull String path) {
+            return path.startsWith(folder.getPath() + "/");
+        }
+
+        /** Returns whether the partition contains the specified file in its priv-app folder. */
+        public boolean containsPrivPath(@NonNull String path) {
+            return mPrivAppFolder != null
+                    && path.startsWith(mPrivAppFolder.getFile().getPath() + "/");
+        }
+    }
+
+    /**
+     * A class that defers the canonicalization of its underlying file. This must be done so
+     * processes do not attempt to canonicalize files in directories for which the process does not
+     * have the correct selinux policies.
+     */
+    private static class DeferredCanonicalFile {
+        private boolean mIsCanonical;
+        private File mFile;
+        private DeferredCanonicalFile(File dir, String fileName) {
+            mFile = new File(dir, fileName);
+            mIsCanonical = false;
+        }
+
+        private File getFile() {
+            if (mIsCanonical) {
+                return mFile;
+            }
+            mIsCanonical = true;
+            try {
+                mFile = mFile.getCanonicalFile();
+            } catch (IOException ignore) {
+                // failed to look up canonical path, continue with original one
+            }
+            return mFile;
+        }
+    }
+}
diff --git a/core/java/android/content/pm/ShortcutServiceInternal.java b/core/java/android/content/pm/ShortcutServiceInternal.java
index a69905e..3a93421 100644
--- a/core/java/android/content/pm/ShortcutServiceInternal.java
+++ b/core/java/android/content/pm/ShortcutServiceInternal.java
@@ -22,6 +22,7 @@
 import android.appwidget.AppWidgetProviderInfo;
 import android.content.ComponentName;
 import android.content.Intent;
+import android.content.IntentFilter;
 import android.content.IntentSender;
 import android.content.LocusId;
 import android.content.pm.LauncherApps.ShortcutQuery;
@@ -92,4 +93,11 @@
     public abstract void uncacheShortcuts(int launcherUserId,
             @NonNull String callingPackage, @NonNull String packageName,
             @NonNull List<String> shortcutIds, int userId);
+
+    /**
+     * Retrieves all of the direct share targets that match the given IntentFilter for the specified
+     * user.
+     */
+    public abstract List<ShortcutManager.ShareShortcutInfo> getShareTargets(
+            @NonNull String callingPackage, @NonNull IntentFilter intentFilter, int userId);
 }
diff --git a/core/java/android/content/pm/parsing/AndroidPackage.java b/core/java/android/content/pm/parsing/AndroidPackage.java
index b93c3a2..2003ce2 100644
--- a/core/java/android/content/pm/parsing/AndroidPackage.java
+++ b/core/java/android/content/pm/parsing/AndroidPackage.java
@@ -206,6 +206,9 @@
 
     Bundle getMetaData(); // TODO(b/135203078): Make all the Bundles immutable
 
+    @Nullable
+    Set<String> getMimeGroups();
+
     float getMinAspectRatio();
 
     int getMinSdkVersion();
diff --git a/core/java/android/content/pm/parsing/ApkLiteParseUtils.java b/core/java/android/content/pm/parsing/ApkLiteParseUtils.java
index 5be9c91..9087f42 100644
--- a/core/java/android/content/pm/parsing/ApkLiteParseUtils.java
+++ b/core/java/android/content/pm/parsing/ApkLiteParseUtils.java
@@ -289,6 +289,12 @@
         boolean useEmbeddedDex = false;
         String configForSplit = null;
         String usesSplitName = null;
+        String targetPackage = null;
+        boolean overlayIsStatic = false;
+        int overlayPriority = 0;
+
+        String requiredSystemPropertyName = null;
+        String requiredSystemPropertyValue = null;
 
         for (int i = 0; i < attrs.getAttributeCount(); i++) {
             final String attr = attrs.getAttributeName(i);
@@ -365,6 +371,21 @@
                             break;
                     }
                 }
+            } else if (PackageParser.TAG_OVERLAY.equals(parser.getName())) {
+                for (int i = 0; i < attrs.getAttributeCount(); ++i) {
+                    final String attr = attrs.getAttributeName(i);
+                    if ("requiredSystemPropertyName".equals(attr)) {
+                        requiredSystemPropertyName = attrs.getAttributeValue(i);
+                    } else if ("requiredSystemPropertyValue".equals(attr)) {
+                        requiredSystemPropertyValue = attrs.getAttributeValue(i);
+                    } else if ("targetPackage".equals(attr)) {
+                        targetPackage = attrs.getAttributeValue(i);;
+                    } else if ("isStatic".equals(attr)) {
+                        overlayIsStatic = attrs.getAttributeBooleanValue(i, false);
+                    } else if ("priority".equals(attr)) {
+                        overlayPriority = attrs.getAttributeIntValue(i, 0);
+                    }
+                }
             } else if (PackageParser.TAG_USES_SPLIT.equals(parser.getName())) {
                 if (usesSplitName != null) {
                     Slog.w(TAG, "Only one <uses-split> permitted. Ignoring others.");
@@ -391,11 +412,23 @@
             }
         }
 
+        // Check to see if overlay should be excluded based on system property condition
+        if (!PackageParser.checkRequiredSystemProperty(requiredSystemPropertyName,
+                requiredSystemPropertyValue)) {
+            Slog.i(TAG, "Skipping target and overlay pair " + targetPackage + " and "
+                    + codePath + ": overlay ignored due to required system property: "
+                    + requiredSystemPropertyName + " with value: " + requiredSystemPropertyValue);
+            targetPackage = null;
+            overlayIsStatic = false;
+            overlayPriority = 0;
+        }
+
         return new PackageParser.ApkLite(codePath, packageSplit.first, packageSplit.second,
                 isFeatureSplit, configForSplit, usesSplitName, isSplitRequired, versionCode,
                 versionCodeMajor, revisionCode, installLocation, verifiers, signingDetails,
                 coreApp, debuggable, multiArch, use32bitAbi, useEmbeddedDex, extractNativeLibs,
-                isolatedSplits, minSdkVersion, targetSdkVersion);
+                isolatedSplits, targetPackage, overlayIsStatic, overlayPriority, minSdkVersion,
+                targetSdkVersion);
     }
 
     public static VerifierInfo parseVerifier(AttributeSet attrs) {
diff --git a/core/java/android/content/pm/parsing/ComponentParseUtils.java b/core/java/android/content/pm/parsing/ComponentParseUtils.java
index a0f5812..6852a8c 100644
--- a/core/java/android/content/pm/parsing/ComponentParseUtils.java
+++ b/core/java/android/content/pm/parsing/ComponentParseUtils.java
@@ -3642,6 +3642,12 @@
                 }
 
                 str = sa.getNonConfigurationString(
+                        R.styleable.AndroidManifestData_mimeGroup, 0);
+                if (str != null) {
+                    intentInfo.addMimeGroup(str);
+                }
+
+                str = sa.getNonConfigurationString(
                         R.styleable.AndroidManifestData_scheme, 0);
                 if (str != null) {
                     intentInfo.addDataScheme(str);
diff --git a/core/java/android/content/pm/parsing/PackageImpl.java b/core/java/android/content/pm/parsing/PackageImpl.java
index 180714a..d06865b 100644
--- a/core/java/android/content/pm/parsing/PackageImpl.java
+++ b/core/java/android/content/pm/parsing/PackageImpl.java
@@ -23,6 +23,7 @@
 import android.annotation.NonNull;
 import android.annotation.Nullable;
 import android.content.Intent;
+import android.content.IntentFilter;
 import android.content.pm.ActivityInfo;
 import android.content.pm.ApplicationInfo;
 import android.content.pm.ConfigurationInfo;
@@ -36,6 +37,7 @@
 import android.content.pm.SharedLibraryInfo;
 import android.content.pm.parsing.ComponentParseUtils.ParsedActivity;
 import android.content.pm.parsing.ComponentParseUtils.ParsedActivityIntentInfo;
+import android.content.pm.parsing.ComponentParseUtils.ParsedComponent;
 import android.content.pm.parsing.ComponentParseUtils.ParsedFeature;
 import android.content.pm.parsing.ComponentParseUtils.ParsedInstrumentation;
 import android.content.pm.parsing.ComponentParseUtils.ParsedIntentInfo;
@@ -291,6 +293,9 @@
     private String zygotePreloadName;
     private boolean preserveLegacyExternalStorage;
 
+    @Nullable
+    private ArraySet<String> mimeGroups;
+
     @VisibleForTesting
     public PackageImpl(
             String packageName,
@@ -872,24 +877,28 @@
     @Override
     public ParsingPackage addActivity(ParsedActivity parsedActivity) {
         this.activities = ArrayUtils.add(this.activities, parsedActivity);
+        addMimeGroupsFromComponent(parsedActivity);
         return this;
     }
 
     @Override
     public ParsingPackage addReceiver(ParsedActivity parsedReceiver) {
         this.receivers = ArrayUtils.add(this.receivers, parsedReceiver);
+        addMimeGroupsFromComponent(parsedReceiver);
         return this;
     }
 
     @Override
     public ParsingPackage addService(ParsedService parsedService) {
         this.services = ArrayUtils.add(this.services, parsedService);
+        addMimeGroupsFromComponent(parsedService);
         return this;
     }
 
     @Override
     public ParsingPackage addProvider(ParsedProvider parsedProvider) {
         this.providers = ArrayUtils.add(this.providers, parsedProvider);
+        addMimeGroupsFromComponent(parsedProvider);
         return this;
     }
 
@@ -2989,6 +2998,21 @@
         return appMetaData;
     }
 
+    private void addMimeGroupsFromComponent(ParsedComponent<?> component) {
+        for (int i = component.intents.size() - 1; i >= 0; i--) {
+            IntentFilter filter = component.intents.get(i);
+            for (int groupIndex = filter.countMimeGroups() - 1; groupIndex >= 0; groupIndex--) {
+                mimeGroups = ArrayUtils.add(mimeGroups, filter.getMimeGroup(groupIndex));
+            }
+        }
+    }
+
+    @Override
+    @Nullable
+    public Set<String> getMimeGroups() {
+        return mimeGroups;
+    }
+
     @Override
     @Nullable
     public List<Intent> getQueriesIntents() {
@@ -3173,6 +3197,7 @@
         dest.writeIntArray(this.splitFlags);
         dest.writeStringArray(this.splitNames);
         dest.writeIntArray(this.splitRevisionCodes);
+        dest.writeArraySet(this.mimeGroups);
     }
 
     public PackageImpl(Parcel in) {
@@ -3337,6 +3362,7 @@
         this.splitFlags = in.createIntArray();
         this.splitNames = in.createStringArray();
         this.splitRevisionCodes = in.createIntArray();
+        this.mimeGroups = (ArraySet<String>) in.readArraySet(boot);
     }
 
     public static final Creator<PackageImpl> CREATOR = new Creator<PackageImpl>() {
diff --git a/core/java/android/content/res/AssetManager.java b/core/java/android/content/res/AssetManager.java
index 1b01758..f295f8c 100644
--- a/core/java/android/content/res/AssetManager.java
+++ b/core/java/android/content/res/AssetManager.java
@@ -38,6 +38,7 @@
 
 import com.android.internal.annotations.GuardedBy;
 import com.android.internal.annotations.VisibleForTesting;
+import com.android.internal.content.om.OverlayConfig;
 
 import java.io.FileDescriptor;
 import java.io.FileNotFoundException;
@@ -242,14 +243,11 @@
         try {
             final ArrayList<ApkAssets> apkAssets = new ArrayList<>();
             apkAssets.add(ApkAssets.loadFromPath(frameworkPath, true /*system*/));
-            final String[] systemIdmapPaths = nativeCreateIdmapsForStaticOverlaysTargetingAndroid();
-            if (systemIdmapPaths != null) {
-                for (String idmapPath : systemIdmapPaths) {
-                    apkAssets.add(ApkAssets.loadOverlayFromPath(idmapPath, true /*system*/));
-                }
-            } else {
-                Log.w(TAG, "'idmap2 --scan' failed: no static=\"true\" overlays targeting "
-                        + "\"android\" will be loaded");
+
+            final String[] systemIdmapPaths =
+                    OverlayConfig.getZygoteInstance().createImmutableFrameworkIdmapsInZygote();
+            for (String idmapPath : systemIdmapPaths) {
+                apkAssets.add(ApkAssets.loadOverlayFromPath(idmapPath, true /*system*/));
             }
 
             sSystemApkAssetsSet = new ArraySet<>(apkAssets);
diff --git a/core/java/android/hardware/display/DeviceProductInfo.java b/core/java/android/hardware/display/DeviceProductInfo.java
new file mode 100644
index 0000000..6ad7fae
--- /dev/null
+++ b/core/java/android/hardware/display/DeviceProductInfo.java
@@ -0,0 +1,224 @@
+/*
+ * 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.hardware.display;
+
+import android.os.Parcel;
+import android.os.Parcelable;
+
+import java.util.Objects;
+
+/**
+ * Product-specific information about the display or the directly connected device on the
+ * display chain. For example, if the display is transitively connected, this field may contain
+ * product information about the intermediate device.
+ * @hide
+ */
+public final class DeviceProductInfo implements Parcelable {
+    final private String mName;
+    final private String mManufacturerPnpId;
+    final private String mProductId;
+    final private Integer mModelYear;
+    final private ManufactureDate mManufactureDate;
+
+    public DeviceProductInfo(
+            String name,
+            String manufacturerPnpId,
+            String productCode,
+            Integer modelYear,
+            ManufactureDate manufactureDate) {
+        this.mName = name;
+        this.mManufacturerPnpId = manufacturerPnpId;
+        this.mProductId = productCode;
+        this.mModelYear = modelYear;
+        this.mManufactureDate = manufactureDate;
+    }
+
+    private DeviceProductInfo(Parcel in) {
+        mName = in.readString();
+        mManufacturerPnpId = in.readString();
+        mProductId = (String) in.readValue(null);
+        mModelYear = (Integer) in.readValue(null);
+        mManufactureDate = (ManufactureDate) in.readValue(null);
+    }
+
+    /**
+     * @return Display name.
+     */
+    public String getName() {
+        return mName;
+    }
+
+    /**
+     * @return Manufacturer Plug and Play ID.
+     */
+    public String getManufacturerPnpId() {
+        return mManufacturerPnpId;
+    }
+
+    /**
+     * @return Manufacturer product ID.
+     */
+    public String getProductId() {
+        return mProductId;
+    }
+
+    /**
+     * @return Model year of the device. Typically exactly one of model year or
+     *      manufacture date will be present.
+     */
+    public Integer getModelYear() {
+        return mModelYear;
+    }
+
+    /**
+     * @return Manufacture date. Typically exactly one of model year or manufacture
+     * date will be present.
+     */
+    public ManufactureDate getManufactureDate() {
+        return mManufactureDate;
+    }
+
+    @Override
+    public String toString() {
+        return "DeviceProductInfo{"
+                + "name="
+                + mName
+                + ", manufacturerPnpId="
+                + mManufacturerPnpId
+                + ", productId="
+                + mProductId
+                + ", modelYear="
+                + mModelYear
+                + ", manufactureDate="
+                + mManufactureDate
+                + '}';
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) return true;
+        if (o == null || getClass() != o.getClass()) return false;
+        DeviceProductInfo that = (DeviceProductInfo) o;
+        return Objects.equals(mName, that.mName)
+                && Objects.equals(mManufacturerPnpId, that.mManufacturerPnpId)
+                && Objects.equals(mProductId, that.mProductId)
+                && Objects.equals(mModelYear, that.mModelYear)
+                && Objects.equals(mManufactureDate, that.mManufactureDate);
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(mName, mManufacturerPnpId, mProductId, mModelYear, mManufactureDate);
+    }
+
+    public static final Creator<DeviceProductInfo> CREATOR =
+            new Creator<DeviceProductInfo>() {
+                @Override
+                public DeviceProductInfo createFromParcel(Parcel in) {
+                    return new DeviceProductInfo(in);
+                }
+
+                @Override
+                public DeviceProductInfo[] newArray(int size) {
+                    return new DeviceProductInfo[size];
+                }
+            };
+
+    @Override
+    public int describeContents() {
+        return 0;
+    }
+
+    @Override
+    public void writeToParcel(Parcel dest, int flags) {
+        dest.writeString(mName);
+        dest.writeString(mManufacturerPnpId);
+        dest.writeValue(mProductId);
+        dest.writeValue(mModelYear);
+        dest.writeValue(mManufactureDate);
+    }
+
+    /**
+     * Stores information about the date of manufacture.
+     *
+     * @hide
+     */
+    public static class ManufactureDate implements Parcelable {
+        final private Integer mWeek;
+        final private Integer mYear;
+
+        public ManufactureDate(Integer week, Integer year) {
+            mWeek = week;
+            mYear = year;
+        }
+
+        protected ManufactureDate(Parcel in) {
+            mWeek = (Integer) in.readValue(null);
+            mYear = (Integer) in.readValue(null);
+        }
+
+        @Override
+        public void writeToParcel(Parcel dest, int flags) {
+            dest.writeValue(mWeek);
+            dest.writeValue(mYear);
+        }
+
+        @Override
+        public int describeContents() {
+            return 0;
+        }
+
+        public static final Creator<ManufactureDate> CREATOR =
+                new Creator<ManufactureDate>() {
+                    @Override
+                    public ManufactureDate createFromParcel(Parcel in) {
+                        return new ManufactureDate(in);
+                    }
+
+                    @Override
+                    public ManufactureDate[] newArray(int size) {
+                        return new ManufactureDate[size];
+                    }
+                };
+
+        public int getYear() {
+            return mYear;
+        }
+
+        public int getWeek() {
+            return mWeek;
+        }
+
+        @Override
+        public String toString() {
+            return "ManufactureDate{week=" + mWeek + ", year=" + mYear + '}';
+        }
+
+        @Override
+        public boolean equals(Object o) {
+            if (this == o) return true;
+            if (o == null || getClass() != o.getClass()) return false;
+            ManufactureDate that = (ManufactureDate) o;
+            return Objects.equals(mWeek, that.mWeek) && Objects.equals(mYear, that.mYear);
+        }
+
+        @Override
+        public int hashCode() {
+            return Objects.hash(mWeek, mYear);
+        }
+    }
+}
diff --git a/core/java/android/net/VpnManager.java b/core/java/android/net/VpnManager.java
index f19ba0f..2041cfb 100644
--- a/core/java/android/net/VpnManager.java
+++ b/core/java/android/net/VpnManager.java
@@ -126,7 +126,11 @@
         return getIntentForConfirmation();
     }
 
-    /** Delete the VPN profile configuration that was provisioned by the calling app */
+    /**
+     * Delete the VPN profile configuration that was provisioned by the calling app
+     *
+     * @throws SecurityException if this would violate user settings
+     */
     public void deleteProvisionedVpnProfile() {
         try {
             mService.deleteVpnProfile(mContext.getOpPackageName());
diff --git a/core/java/android/os/IThermalService.aidl b/core/java/android/os/IThermalService.aidl
index 8c98960..ad00233 100644
--- a/core/java/android/os/IThermalService.aidl
+++ b/core/java/android/os/IThermalService.aidl
@@ -103,4 +103,11 @@
       * {@hide}
       */
     List<CoolingDevice> getCurrentCoolingDevicesWithType(in int type);
+
+    /**
+     * @param forecastSeconds how many seconds ahead to forecast the provided headroom
+     * @return forecasted thermal headroom, normalized such that 1.0 indicates that throttling will
+     *     occur; returns NaN if the headroom or forecast is unavailable
+     */
+    float getThermalHeadroom(int forecastSeconds);
 }
diff --git a/core/java/android/os/PowerManager.java b/core/java/android/os/PowerManager.java
index 267613f..199b5d5 100644
--- a/core/java/android/os/PowerManager.java
+++ b/core/java/android/os/PowerManager.java
@@ -18,7 +18,9 @@
 
 import android.Manifest.permission;
 import android.annotation.CallbackExecutor;
+import android.annotation.CurrentTimeMillisLong;
 import android.annotation.IntDef;
+import android.annotation.IntRange;
 import android.annotation.NonNull;
 import android.annotation.Nullable;
 import android.annotation.RequiresPermission;
@@ -26,6 +28,7 @@
 import android.annotation.SystemApi;
 import android.annotation.SystemService;
 import android.annotation.TestApi;
+import android.app.PropertyInvalidatedCache;
 import android.compat.annotation.UnsupportedAppUsage;
 import android.content.Context;
 import android.service.dreams.Sandman;
@@ -38,6 +41,7 @@
 import java.lang.annotation.Retention;
 import java.lang.annotation.RetentionPolicy;
 import java.util.concurrent.Executor;
+import java.util.concurrent.atomic.AtomicLong;
 
 /**
  * This class gives you control of the power state of the device.
@@ -877,25 +881,60 @@
         }
     }
 
+    private static final String CACHE_KEY_IS_POWER_SAVE_MODE_PROPERTY =
+            "cache_key.is_power_save_mode";
+
+    private static final String CACHE_KEY_IS_INTERACTIVE_PROPERTY = "cache_key.is_interactive";
+
+    private static final int MAX_CACHE_ENTRIES = 1;
+
+    private PropertyInvalidatedCache<Void, Boolean> mPowerSaveModeCache =
+            new PropertyInvalidatedCache<Void, Boolean>(MAX_CACHE_ENTRIES,
+                CACHE_KEY_IS_POWER_SAVE_MODE_PROPERTY) {
+                @Override
+                protected Boolean recompute(Void query) {
+                    try {
+                        return mService.isPowerSaveMode();
+                    } catch (RemoteException e) {
+                        throw e.rethrowFromSystemServer();
+                    }
+                }
+            };
+
+    private PropertyInvalidatedCache<Void, Boolean> mInteractiveCache =
+            new PropertyInvalidatedCache<Void, Boolean>(MAX_CACHE_ENTRIES,
+                CACHE_KEY_IS_INTERACTIVE_PROPERTY) {
+                @Override
+                protected Boolean recompute(Void query) {
+                    try {
+                        return mService.isInteractive();
+                    } catch (RemoteException e) {
+                        throw e.rethrowFromSystemServer();
+                    }
+                }
+            };
+
     final Context mContext;
     @UnsupportedAppUsage
     final IPowerManager mService;
     @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P)
     final Handler mHandler;
+    final IThermalService mThermalService;
 
     /** We lazily initialize it.*/
     private DeviceIdleManager mDeviceIdleManager;
 
-    IThermalService mThermalService;
     private final ArrayMap<OnThermalStatusChangedListener, IThermalStatusListener>
             mListenerMap = new ArrayMap<>();
 
     /**
      * {@hide}
      */
-    public PowerManager(Context context, IPowerManager service, Handler handler) {
+    public PowerManager(Context context, IPowerManager service, IThermalService thermalService,
+            Handler handler) {
         mContext = context;
         mService = service;
+        mThermalService = thermalService;
         mHandler = handler;
     }
 
@@ -1440,11 +1479,7 @@
      * @see android.content.Intent#ACTION_SCREEN_OFF
      */
     public boolean isInteractive() {
-        try {
-            return mService.isInteractive();
-        } catch (RemoteException e) {
-            throw e.rethrowFromSystemServer();
-        }
+        return mInteractiveCache.query(null);
     }
 
     /**
@@ -1504,11 +1539,7 @@
      * @return Returns true if currently in low power mode, else false.
      */
     public boolean isPowerSaveMode() {
-        try {
-            return mService.isPowerSaveMode();
-        } catch (RemoteException e) {
-            throw e.rethrowFromSystemServer();
-        }
+        return mPowerSaveModeCache.query(null);
     }
 
     /**
@@ -1851,18 +1882,11 @@
      * thermal throttling.
      */
     public @ThermalStatus int getCurrentThermalStatus() {
-        synchronized (this) {
-            if (mThermalService == null) {
-                mThermalService = IThermalService.Stub.asInterface(
-                        ServiceManager.getService(Context.THERMAL_SERVICE));
-            }
-            try {
-                return mThermalService.getCurrentThermalStatus();
-            } catch (RemoteException e) {
-                throw e.rethrowFromSystemServer();
-            }
+        try {
+            return mThermalService.getCurrentThermalStatus();
+        } catch (RemoteException e) {
+            throw e.rethrowFromSystemServer();
         }
-
     }
 
     /**
@@ -1889,13 +1913,7 @@
      */
     public void addThermalStatusListener(@NonNull OnThermalStatusChangedListener listener) {
         Preconditions.checkNotNull(listener, "listener cannot be null");
-        synchronized (this) {
-            if (mThermalService == null) {
-                mThermalService = IThermalService.Stub.asInterface(
-                        ServiceManager.getService(Context.THERMAL_SERVICE));
-            }
-            this.addThermalStatusListener(mContext.getMainExecutor(), listener);
-        }
+        this.addThermalStatusListener(mContext.getMainExecutor(), listener);
     }
 
     /**
@@ -1908,35 +1926,29 @@
             @NonNull OnThermalStatusChangedListener listener) {
         Preconditions.checkNotNull(listener, "listener cannot be null");
         Preconditions.checkNotNull(executor, "executor cannot be null");
-        synchronized (this) {
-            if (mThermalService == null) {
-                mThermalService = IThermalService.Stub.asInterface(
-                        ServiceManager.getService(Context.THERMAL_SERVICE));
-            }
-            Preconditions.checkArgument(!mListenerMap.containsKey(listener),
-                    "Listener already registered: " + listener);
-            IThermalStatusListener internalListener = new IThermalStatusListener.Stub() {
-                @Override
-                public void onStatusChange(int status) {
-                    final long token = Binder.clearCallingIdentity();
-                    try {
-                        executor.execute(() -> {
-                            listener.onThermalStatusChanged(status);
-                        });
-                    } finally {
-                        Binder.restoreCallingIdentity(token);
-                    }
+        Preconditions.checkArgument(!mListenerMap.containsKey(listener),
+                "Listener already registered: " + listener);
+        IThermalStatusListener internalListener = new IThermalStatusListener.Stub() {
+            @Override
+            public void onStatusChange(int status) {
+                final long token = Binder.clearCallingIdentity();
+                try {
+                    executor.execute(() -> {
+                        listener.onThermalStatusChanged(status);
+                    });
+                } finally {
+                    Binder.restoreCallingIdentity(token);
                 }
-            };
-            try {
-                if (mThermalService.registerThermalStatusListener(internalListener)) {
-                    mListenerMap.put(listener, internalListener);
-                } else {
-                    throw new RuntimeException("Listener failed to set");
-                }
-            } catch (RemoteException e) {
-                throw e.rethrowFromSystemServer();
             }
+        };
+        try {
+            if (mThermalService.registerThermalStatusListener(internalListener)) {
+                mListenerMap.put(listener, internalListener);
+            } else {
+                throw new RuntimeException("Listener failed to set");
+            }
+        } catch (RemoteException e) {
+            throw e.rethrowFromSystemServer();
         }
     }
 
@@ -1947,22 +1959,72 @@
      */
     public void removeThermalStatusListener(@NonNull OnThermalStatusChangedListener listener) {
         Preconditions.checkNotNull(listener, "listener cannot be null");
-        synchronized (this) {
-            if (mThermalService == null) {
-                mThermalService = IThermalService.Stub.asInterface(
-                        ServiceManager.getService(Context.THERMAL_SERVICE));
+        IThermalStatusListener internalListener = mListenerMap.get(listener);
+        Preconditions.checkArgument(internalListener != null, "Listener was not added");
+        try {
+            if (mThermalService.unregisterThermalStatusListener(internalListener)) {
+                mListenerMap.remove(listener);
+            } else {
+                throw new RuntimeException("Listener failed to remove");
             }
-            IThermalStatusListener internalListener = mListenerMap.get(listener);
-            Preconditions.checkArgument(internalListener != null, "Listener was not added");
-            try {
-                if (mThermalService.unregisterThermalStatusListener(internalListener)) {
-                    mListenerMap.remove(listener);
-                } else {
-                    throw new RuntimeException("Listener failed to remove");
-                }
-            } catch (RemoteException e) {
-                throw e.rethrowFromSystemServer();
-            }
+        } catch (RemoteException e) {
+            throw e.rethrowFromSystemServer();
+        }
+    }
+
+    @CurrentTimeMillisLong
+    private final AtomicLong mLastHeadroomUpdate = new AtomicLong(0L);
+    private static final int MINIMUM_HEADROOM_TIME_MILLIS = 500;
+
+    /**
+     * Provides an estimate of how much thermal headroom the device currently has before hitting
+     * severe throttling.
+     *
+     * Note that this only attempts to track the headroom of slow-moving sensors, such as the skin
+     * temperature sensor. This means that there is no benefit to calling this function more
+     * frequently than about once per second, and attempts to call significantly more frequently may
+     * result in the function returning {@code NaN}.
+     *
+     * In addition, in order to be able to provide an accurate forecast, the system does not attempt
+     * to forecast until it has multiple temperature samples from which to extrapolate. This should
+     * only take a few seconds from the time of the first call, but during this time, no forecasting
+     * will occur, and the current headroom will be returned regardless of the value of
+     * {@code forecastSeconds}.
+     *
+     * The value returned is a non-negative float that represents how much of the thermal envelope
+     * is in use (or is forecasted to be in use). A value of 1.0 indicates that the device is (or
+     * will be) throttled at {@link #THERMAL_STATUS_SEVERE}. Such throttling can affect the CPU,
+     * GPU, and other subsystems. Values may exceed 1.0, but there is no implied mapping to specific
+     * thermal status levels beyond that point. This means that values greater than 1.0 may
+     * correspond to {@link #THERMAL_STATUS_SEVERE}, but may also represent heavier throttling.
+     *
+     * A value of 0.0 corresponds to a fixed distance from 1.0, but does not correspond to any
+     * particular thermal status or temperature. Values on (0.0, 1.0] may be expected to scale
+     * linearly with temperature, though temperature changes over time are typically not linear.
+     * Negative values will be clamped to 0.0 before returning.
+     *
+     * @param forecastSeconds how many seconds in the future to forecast. Given that device
+     *                        conditions may change at any time, forecasts from further in the
+     *                        future will likely be less accurate than forecasts in the near future.
+     * @return a value greater than or equal to 0.0 where 1.0 indicates the SEVERE throttling
+     *         threshold, as described above. Returns NaN if the device does not support this
+     *         functionality or if this function is called significantly faster than once per
+     *         second.
+     */
+    public float getThermalHeadroom(@IntRange(from = 0, to = 60) int forecastSeconds) {
+        // Rate-limit calls into the thermal service
+        long now = SystemClock.elapsedRealtime();
+        long timeSinceLastUpdate = now - mLastHeadroomUpdate.get();
+        if (timeSinceLastUpdate < MINIMUM_HEADROOM_TIME_MILLIS) {
+            return Float.NaN;
+        }
+
+        try {
+            float forecast = mThermalService.getThermalHeadroom(forecastSeconds);
+            mLastHeadroomUpdate.set(SystemClock.elapsedRealtime());
+            return forecast;
+        } catch (RemoteException e) {
+            throw e.rethrowFromSystemServer();
         }
     }
 
@@ -2508,4 +2570,18 @@
             };
         }
     }
+
+    /**
+     * @hide
+     */
+    public static void invalidatePowerSaveModeCaches() {
+        PropertyInvalidatedCache.invalidateCache(CACHE_KEY_IS_POWER_SAVE_MODE_PROPERTY);
+    }
+
+    /**
+     * @hide
+     */
+    public static void invalidateIsInteractiveCaches() {
+        PropertyInvalidatedCache.invalidateCache(CACHE_KEY_IS_INTERACTIVE_PROPERTY);
+    }
 }
diff --git a/core/java/android/os/UserManager.java b/core/java/android/os/UserManager.java
index 6d1f646..84fd580 100644
--- a/core/java/android/os/UserManager.java
+++ b/core/java/android/os/UserManager.java
@@ -33,8 +33,8 @@
 import android.annotation.WorkerThread;
 import android.app.Activity;
 import android.app.ActivityManager;
-import android.app.admin.DevicePolicyManager;
 import android.app.PropertyInvalidatedCache;
+import android.app.admin.DevicePolicyManager;
 import android.compat.annotation.UnsupportedAppUsage;
 import android.content.ComponentName;
 import android.content.Context;
@@ -151,12 +151,23 @@
     public static final int QUIET_MODE_DISABLE_ONLY_IF_CREDENTIAL_NOT_REQUIRED = 0x1;
 
     /**
+     * Flag passed to {@link #requestQuietModeEnabled} to request disabling quiet mode without
+     * asking for credentials. This is used when managed profile password is forgotten. It starts
+     * the user in locked state so that a direct boot aware DPC could reset the password.
+     * Should not be used together with
+     * {@link #QUIET_MODE_DISABLE_ONLY_IF_CREDENTIAL_NOT_REQUIRED} or an exception will be thrown.
+     * @hide
+     */
+    public static final int QUIET_MODE_DISABLE_DONT_ASK_CREDENTIAL = 0x2;
+
+    /**
      * List of flags available for the {@link #requestQuietModeEnabled} method.
      * @hide
      */
     @Retention(RetentionPolicy.SOURCE)
     @IntDef(flag = true, prefix = { "QUIET_MODE_" }, value = {
-            QUIET_MODE_DISABLE_ONLY_IF_CREDENTIAL_NOT_REQUIRED })
+            QUIET_MODE_DISABLE_ONLY_IF_CREDENTIAL_NOT_REQUIRED,
+            QUIET_MODE_DISABLE_DONT_ASK_CREDENTIAL})
     public @interface QuietModeFlag {}
 
     /**
@@ -3521,12 +3532,13 @@
             boolean enableQuietMode, @NonNull UserHandle userHandle, IntentSender target) {
         return requestQuietModeEnabled(enableQuietMode, userHandle, target, 0);
     }
+
     /**
      * Similar to {@link #requestQuietModeEnabled(boolean, UserHandle)}, except you can specify
      * a target to start when user is unlocked. If {@code target} is specified, caller must have
      * the {@link android.Manifest.permission#MANAGE_USERS} permission.
      *
-     * @see {@link #requestQuietModeEnabled(boolean, UserHandle)}
+     * @see #requestQuietModeEnabled(boolean, UserHandle)
      * @hide
      */
     public boolean requestQuietModeEnabled(
diff --git a/core/java/android/os/storage/StorageManagerInternal.java b/core/java/android/os/storage/StorageManagerInternal.java
index e78aef5..a2def7f 100644
--- a/core/java/android/os/storage/StorageManagerInternal.java
+++ b/core/java/android/os/storage/StorageManagerInternal.java
@@ -16,9 +16,12 @@
 
 package android.os.storage;
 
+import android.annotation.NonNull;
 import android.annotation.Nullable;
 import android.os.IVold;
 
+import java.util.Set;
+
 /**
  * Mount service local interface.
  *
@@ -97,6 +100,12 @@
     }
 
     /**
+     * Check if fuse is running in target user, if it's running then setup its obb directories.
+     * TODO: System server should store a list of active pids that obb is not mounted and use it.
+     */
+    public abstract void prepareObbDirs(int userId, Set<String> packageList, String processName);
+
+    /**
      * Add a listener to listen to reset event in StorageManagerService.
      *
      * @param listener The listener that will be notified on reset events.
@@ -124,4 +133,14 @@
      * legacy storage, {@code false} otherwise.
      */
     public abstract boolean hasLegacyExternalStorage(int uid);
+
+    /**
+     * Makes sure app-private data directories on external storage are setup correctly
+     * after an application is installed or upgraded. The main use for this is OBB dirs,
+     * which can be created/modified by the installer.
+     *
+     * @param packageName the package name of the package
+     * @param uid the uid of the package
+     */
+    public abstract void prepareAppDataAfterInstall(@NonNull String packageName, int uid);
 }
diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java
index f6072f9..9511152 100644
--- a/core/java/android/provider/Settings.java
+++ b/core/java/android/provider/Settings.java
@@ -8595,6 +8595,15 @@
         public static final String NOTIFICATION_HISTORY_ENABLED = "notification_history_enabled";
 
         /**
+         * When enabled conversations marked as favorites will be set to bubble.
+         *
+         * The value 1 - enable, 0 - disable
+         * @hide
+         */
+        public static final String BUBBLE_IMPORTANT_CONVERSATIONS
+                = "bubble_important_conversations";
+
+        /**
          * Whether notifications are dismissed by a right-to-left swipe (instead of a left-to-right
          * swipe).
          *
@@ -8751,6 +8760,13 @@
                 "location_permissions_upgrade_to_q_mode";
 
         /**
+         * Whether or not the system Auto Revoke feature is disabled.
+         * @hide
+         */
+        @SystemApi
+        public static final String AUTO_REVOKE_DISABLED = "auto_revoke_disabled";
+
+        /**
          * Map of android.theme.customization.* categories to the enabled overlay package for that
          * category, formatted as a serialized {@link org.json.JSONObject}. If there is no
          * corresponding package included for a category, then all overlay packages in that
@@ -9084,26 +9100,34 @@
          * Set to one of {@link #WIFI_SLEEP_POLICY_DEFAULT},
          * {@link #WIFI_SLEEP_POLICY_NEVER_WHILE_PLUGGED}, or
          * {@link #WIFI_SLEEP_POLICY_NEVER}.
+         * @deprecated This is no longer used or set by the platform.
          */
+        @Deprecated
         public static final String WIFI_SLEEP_POLICY = "wifi_sleep_policy";
 
         /**
          * Value for {@link #WIFI_SLEEP_POLICY} to use the default Wi-Fi sleep
          * policy, which is to sleep shortly after the turning off
          * according to the {@link #STAY_ON_WHILE_PLUGGED_IN} setting.
+         * @deprecated This is no longer used by the platform.
          */
+        @Deprecated
         public static final int WIFI_SLEEP_POLICY_DEFAULT = 0;
 
         /**
          * Value for {@link #WIFI_SLEEP_POLICY} to use the default policy when
          * the device is on battery, and never go to sleep when the device is
          * plugged in.
+         * @deprecated This is no longer used by the platform.
          */
+        @Deprecated
         public static final int WIFI_SLEEP_POLICY_NEVER_WHILE_PLUGGED = 1;
 
         /**
          * Value for {@link #WIFI_SLEEP_POLICY} to never go to sleep.
+         * @deprecated This is no longer used by the platform.
          */
+        @Deprecated
         public static final int WIFI_SLEEP_POLICY_NEVER = 2;
 
         /**
@@ -10197,7 +10221,9 @@
        /**
         * Delay (in seconds) before repeating the Wi-Fi networks available notification.
         * Connecting to a network will reset the timer.
+        * @deprecated This is no longer used or set by the platform.
         */
+       @Deprecated
        public static final String WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY =
                "wifi_networks_available_repeat_delay";
 
@@ -10227,7 +10253,9 @@
        /**
         * When the number of open networks exceeds this number, the
         * least-recently-used excess networks will be removed.
+        * @deprecated This is no longer used or set by the platform.
         */
+       @Deprecated
        public static final String WIFI_NUM_OPEN_NETWORKS_KEPT = "wifi_num_open_networks_kept";
 
        /**
@@ -10238,8 +10266,8 @@
        /**
         * Setting to allow scans to be enabled even wifi is turned off for connectivity.
         * @hide
+        * @deprecated To be removed.
         */
-       @SystemApi
        public static final String WIFI_SCAN_ALWAYS_AVAILABLE =
                 "wifi_scan_always_enabled";
 
@@ -10248,8 +10276,8 @@
          *
          * Type: int (0 for false, 1 for true)
          * @hide
+         * @deprecated To be removed.
          */
-        @SystemApi
         public static final String WIFI_P2P_PENDING_FACTORY_RESET =
                 "wifi_p2p_pending_factory_reset";
 
@@ -10258,8 +10286,8 @@
          *
          * Type: int (0 for false, 1 for true)
          * @hide
+         * @deprecated To be removed.
          */
-        @SystemApi
         public static final String SOFT_AP_TIMEOUT_ENABLED = "soft_ap_timeout_enabled";
 
         /**
@@ -10304,6 +10332,7 @@
          * Most readers of this setting should simply check if value == 1 to determined the
          * enabled state.
          * @hide
+         * @deprecated To be removed.
          */
         public static final String NETWORK_RECOMMENDATIONS_ENABLED =
                 "network_recommendations_enabled";
@@ -10343,13 +10372,11 @@
 
         /**
          * Whether wifi scan throttle is enabled or not.
-         * This is intended to be used via adb commands or a menu in developer option to turn off
-         * the default wifi scan throttling mechanism for apps.
          *
          * Type: int (0 for false, 1 for true)
          * @hide
+         * @deprecated To be removed.
          */
-        @SystemApi
         public static final String WIFI_SCAN_THROTTLE_ENABLED = "wifi_scan_throttle_enabled";
 
         /**
@@ -10451,8 +10478,8 @@
         * Setting to enable verbose logging in Wi-Fi; disabled by default, and setting to 1
         * will enable it. In the future, additional values may be supported.
         * @hide
+        * @deprecated To be removed.
         */
-       @SystemApi
        public static final String WIFI_VERBOSE_LOGGING_ENABLED =
                "wifi_verbose_logging_enabled";
 
@@ -10477,8 +10504,8 @@
          * Default values are provided by code or device configurations.
          * Errors in the parameters will cause the entire setting to be ignored.
          * @hide
+         * @deprecated This is no longer used or set by the platform.
          */
-        @SystemApi
         public static final String WIFI_SCORE_PARAMS =
                 "wifi_score_params";
 
@@ -10520,8 +10547,8 @@
        /**
         * The Wi-Fi peer-to-peer device name
         * @hide
+        * @deprecated To be removed.
         */
-       @SystemApi
        public static final String WIFI_P2P_DEVICE_NAME = "wifi_p2p_device_name";
 
        /**
@@ -14129,6 +14156,13 @@
          */
         @SystemApi
         public static final String COMMON_CRITERIA_MODE = "common_criteria_mode";
+
+        /**
+         * The usage amount of advanced battery. The value is 0~100.
+         *
+         * @hide
+         */
+        public static final String ADVANCED_BATTERY_USAGE_AMOUNT = "advanced_battery_usage_amount";
     }
 
     /**
diff --git a/core/java/android/service/controls/ControlsProviderService.java b/core/java/android/service/controls/ControlsProviderService.java
index de4c056..cb20db9 100644
--- a/core/java/android/service/controls/ControlsProviderService.java
+++ b/core/java/android/service/controls/ControlsProviderService.java
@@ -16,6 +16,7 @@
 package android.service.controls;
 
 import android.annotation.NonNull;
+import android.annotation.Nullable;
 import android.annotation.SdkConstant;
 import android.annotation.SdkConstant.SdkConstantType;
 import android.app.Service;
@@ -34,7 +35,6 @@
 
 import com.android.internal.util.Preconditions;
 
-import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
 import java.util.concurrent.Flow.Publisher;
@@ -70,25 +70,48 @@
      * Retrieve all available controls, using the stateless builder
      * {@link Control.StatelessBuilder} to build each Control, then use the
      * provided consumer to callback to the call originator.
+     *
+     * @deprecated Removing consumer-based load apis. Use publisherForAllAvailable() instead
      */
-    public abstract void loadAvailableControls(@NonNull Consumer<List<Control>> consumer);
-
-    /**
-     * (Optional) The service may be asked to provide a small number of recommended controls, in
-     * order to suggest some controls to the user for favoriting. The controls shall be built using
-     * the stateless builder {@link Control.StatelessBuilder}, followed by an invocation to the
-     * provided consumer to callback to the call originator. If the number of controls
-     * is greater than maxNumber, the list will be truncated.
-     */
-    public void loadSuggestedControls(int maxNumber, @NonNull Consumer<List<Control>> consumer) {
-        // Override to change the default behavior
+    @Deprecated
+    public void loadAvailableControls(@NonNull Consumer<List<Control>> consumer) {
+        // pending removal
         consumer.accept(Collections.emptyList());
     }
 
     /**
-     * Return a valid Publisher for the given controlIds. This publisher will be asked
-     * to provide updates for the given list of controlIds as long as the Subscription
-     * is valid.
+     * Publisher for all available controls
+     *
+     * Retrieve all available controls. Use the stateless builder {@link Control.StatelessBuilder}
+     * to build each Control. Call {@link Subscriber#onComplete} when done loading all unique
+     * controls, or {@link Subscriber#onError} for error scenarios. Duplicate Controls will
+     * replace the original.
+     */
+    @Nullable
+    public Publisher<Control> publisherForAllAvailable() {
+        // will be abstract and @nonnull when consumers are removed
+        return null;
+    }
+
+    /**
+     * (Optional) Publisher for suggested controls
+     *
+     * The service may be asked to provide a small number of recommended controls, in
+     * order to suggest some controls to the user for favoriting. The controls shall be built using
+     * the stateless builder {@link Control.StatelessBuilder}. The number of controls requested
+     * through {@link Subscription#request} will be limited. Call {@link Subscriber#onComplete}
+     * when done, or {@link Subscriber#onError} for error scenarios.
+     */
+    @Nullable
+    public Publisher<Control> publisherForSuggested() {
+        return null;
+    }
+
+    /**
+     * Return a valid Publisher for the given controlIds. This publisher will be asked to provide
+     * updates for the given list of controlIds as long as the {@link Subscription} is valid.
+     * Calls to {@link Subscriber#onComplete} will not be expected. Instead, wait for the call from
+     * {@link Subscription#cancel} to indicate that updates are no longer required.
      */
     @NonNull
     public abstract Publisher<Control> publisherFor(@NonNull List<String> controlIds);
@@ -113,13 +136,13 @@
         mToken = bundle.getBinder(CALLBACK_TOKEN);
 
         return new IControlsProvider.Stub() {
-            public void load(IControlsLoadCallback cb) {
-                mHandler.obtainMessage(RequestHandler.MSG_LOAD, cb).sendToTarget();
+            public void load(IControlsSubscriber subscriber) {
+                mHandler.obtainMessage(RequestHandler.MSG_LOAD, subscriber).sendToTarget();
             }
 
-            public void loadSuggested(int maxNumber, IControlsLoadCallback cb) {
-                LoadMessage msg = new LoadMessage(maxNumber, cb);
-                mHandler.obtainMessage(RequestHandler.MSG_LOAD_SUGGESTED, msg).sendToTarget();
+            public void loadSuggested(IControlsSubscriber subscriber) {
+                mHandler.obtainMessage(RequestHandler.MSG_LOAD_SUGGESTED, subscriber)
+                        .sendToTarget();
             }
 
             public void subscribe(List<String> controlIds,
@@ -148,73 +171,56 @@
         private static final int MSG_ACTION = 3;
         private static final int MSG_LOAD_SUGGESTED = 4;
 
-        /**
-         * This the maximum number of controls that can be loaded via
-         * {@link ControlsProviderService#loadAvailablecontrols}. Anything over this number
-         * will be truncated.
-         */
-        private static final int MAX_NUMBER_OF_CONTROLS_ALLOWED = 1000;
-
         RequestHandler(Looper looper) {
             super(looper);
         }
 
         public void handleMessage(Message msg) {
             switch(msg.what) {
-                case MSG_LOAD:
-                    final IControlsLoadCallback cb = (IControlsLoadCallback) msg.obj;
-                    ControlsProviderService.this.loadAvailableControls(consumerFor(
-                            MAX_NUMBER_OF_CONTROLS_ALLOWED, cb));
-                    break;
+                case MSG_LOAD: {
+                    final IControlsSubscriber cs = (IControlsSubscriber) msg.obj;
+                    final SubscriberProxy proxy = new SubscriberProxy(true, mToken, cs);
 
-                case MSG_LOAD_SUGGESTED:
-                    final LoadMessage lMsg = (LoadMessage) msg.obj;
-                    ControlsProviderService.this.loadSuggestedControls(lMsg.mMaxNumber,
-                            consumerFor(lMsg.mMaxNumber, lMsg.mCb));
+                    Publisher<Control> publisher =
+                            ControlsProviderService.this.publisherForAllAvailable();
+                    if (publisher == null) {
+                        ControlsProviderService.this.loadAvailableControls(consumerFor(proxy));
+                    } else {
+                        publisher.subscribe(proxy);
+                    }
                     break;
+                }
 
-                case MSG_SUBSCRIBE:
+                case MSG_LOAD_SUGGESTED: {
+                    final IControlsSubscriber cs = (IControlsSubscriber) msg.obj;
+                    final SubscriberProxy proxy = new SubscriberProxy(true, mToken, cs);
+
+                    Publisher<Control> publisher =
+                            ControlsProviderService.this.publisherForSuggested();
+                    if (publisher == null) {
+                        Log.i(TAG, "No publisher provided for suggested controls");
+                        proxy.onComplete();
+                    } else {
+                        publisher.subscribe(proxy);
+                    }
+                    break;
+                }
+
+                case MSG_SUBSCRIBE: {
                     final SubscribeMessage sMsg = (SubscribeMessage) msg.obj;
-                    final IControlsSubscriber cs = sMsg.mSubscriber;
-                    Subscriber<Control> s = new Subscriber<Control>() {
-                            public void onSubscribe(Subscription subscription) {
-                                try {
-                                    cs.onSubscribe(mToken, new SubscriptionAdapter(subscription));
-                                } catch (RemoteException ex) {
-                                    ex.rethrowAsRuntimeException();
-                                }
-                            }
-                            public void onNext(@NonNull Control statefulControl) {
-                                Preconditions.checkNotNull(statefulControl);
-                                try {
-                                    cs.onNext(mToken, statefulControl);
-                                } catch (RemoteException ex) {
-                                    ex.rethrowAsRuntimeException();
-                                }
-                            }
-                            public void onError(Throwable t) {
-                                try {
-                                    cs.onError(mToken, t.toString());
-                                } catch (RemoteException ex) {
-                                    ex.rethrowAsRuntimeException();
-                                }
-                            }
-                            public void onComplete() {
-                                try {
-                                    cs.onComplete(mToken);
-                                } catch (RemoteException ex) {
-                                    ex.rethrowAsRuntimeException();
-                                }
-                            }
-                        };
-                    ControlsProviderService.this.publisherFor(sMsg.mControlIds).subscribe(s);
-                    break;
+                    final SubscriberProxy proxy = new SubscriberProxy(false, mToken,
+                            sMsg.mSubscriber);
 
-                case MSG_ACTION:
+                    ControlsProviderService.this.publisherFor(sMsg.mControlIds).subscribe(proxy);
+                    break;
+                }
+
+                case MSG_ACTION: {
                     final ActionMessage aMsg = (ActionMessage) msg.obj;
                     ControlsProviderService.this.performControlAction(aMsg.mControlId,
                             aMsg.mAction, consumerFor(aMsg.mControlId, aMsg.mCb));
                     break;
+                }
             }
         }
 
@@ -234,39 +240,88 @@
             };
         }
 
-        private Consumer<List<Control>> consumerFor(int maxNumber, IControlsLoadCallback cb) {
-            return (@NonNull List<Control> controls) -> {
+        /**
+         * Method will be removed during migration to publisher
+         */
+        private Consumer<List<Control>> consumerFor(final Subscriber<Control> subscriber) {
+            return (@NonNull final List<Control> controls) -> {
                 Preconditions.checkNotNull(controls);
-                if (controls.size() > maxNumber) {
-                    Log.w(TAG, "Too many controls. Provided: " + controls.size() + ", Max allowed: "
-                            + maxNumber + ". Truncating the list.");
-                    controls = controls.subList(0, maxNumber);
-                }
 
-                List<Control> list = new ArrayList<>();
-                for (Control control: controls) {
-                    if (control == null) {
-                        Log.e(TAG, "onLoad: null control.");
-                    }
-                    if (isStatelessControl(control)) {
-                        list.add(control);
-                    } else {
-                        Log.w(TAG, "onLoad: control is not stateless.");
-                        list.add(new Control.StatelessBuilder(control).build());
-                    }
-                }
-                try {
-                    cb.accept(mToken, list);
-                } catch (RemoteException ex) {
-                    ex.rethrowAsRuntimeException();
-                }
+                subscriber.onSubscribe(new Subscription() {
+                        public void request(long n) {
+                            for (Control control: controls) {
+                                Control c;
+                                if (control == null) {
+                                    Log.e(TAG, "onLoad: null control.");
+                                }
+                                if (isStatelessControl(control)) {
+                                    c = control;
+                                } else {
+                                    Log.w(TAG, "onLoad: control is not stateless.");
+                                    c = new Control.StatelessBuilder(control).build();
+                                }
+
+                                subscriber.onNext(c);
+                            }
+                            subscriber.onComplete();
+                        }
+
+                        public void cancel() {}
+                    });
             };
         }
+    }
 
-        private boolean isStatelessControl(Control control) {
-            return (control.getStatus() == Control.STATUS_UNKNOWN
-                    && control.getControlTemplate().getTemplateType() == ControlTemplate.TYPE_NONE
-                    && TextUtils.isEmpty(control.getStatusText()));
+    private static boolean isStatelessControl(Control control) {
+        return (control.getStatus() == Control.STATUS_UNKNOWN
+                && control.getControlTemplate().getTemplateType() == ControlTemplate.TYPE_NONE
+                && TextUtils.isEmpty(control.getStatusText()));
+    }
+
+    private static class SubscriberProxy implements Subscriber<Control> {
+        private IBinder mToken;
+        private IControlsSubscriber mCs;
+        private boolean mEnforceStateless;
+
+        SubscriberProxy(boolean enforceStateless, IBinder token, IControlsSubscriber cs) {
+            mEnforceStateless = enforceStateless;
+            mToken = token;
+            mCs = cs;
+        }
+
+        public void onSubscribe(Subscription subscription) {
+            try {
+                mCs.onSubscribe(mToken, new SubscriptionAdapter(subscription));
+            } catch (RemoteException ex) {
+                ex.rethrowAsRuntimeException();
+            }
+        }
+        public void onNext(@NonNull Control control) {
+            Preconditions.checkNotNull(control);
+            try {
+                if (mEnforceStateless && !isStatelessControl(control)) {
+                    Log.w(TAG, "onNext(): control is not stateless. Use the "
+                            + "Control.StatelessBuilder() to build the control.");
+                    control = new Control.StatelessBuilder(control).build();
+                }
+                mCs.onNext(mToken, control);
+            } catch (RemoteException ex) {
+                ex.rethrowAsRuntimeException();
+            }
+        }
+        public void onError(Throwable t) {
+            try {
+                mCs.onError(mToken, t.toString());
+            } catch (RemoteException ex) {
+                ex.rethrowAsRuntimeException();
+            }
+        }
+        public void onComplete() {
+            try {
+                mCs.onComplete(mToken);
+            } catch (RemoteException ex) {
+                ex.rethrowAsRuntimeException();
+            }
         }
     }
 
@@ -307,14 +362,4 @@
             this.mSubscriber = subscriber;
         }
     }
-
-    private static class LoadMessage {
-        final int mMaxNumber;
-        final IControlsLoadCallback mCb;
-
-        LoadMessage(int maxNumber, IControlsLoadCallback cb) {
-            this.mMaxNumber = maxNumber;
-            this.mCb = cb;
-        }
-    }
 }
diff --git a/core/java/android/service/controls/IControlsProvider.aidl b/core/java/android/service/controls/IControlsProvider.aidl
index 4375fbb..0cb06b4 100644
--- a/core/java/android/service/controls/IControlsProvider.aidl
+++ b/core/java/android/service/controls/IControlsProvider.aidl
@@ -17,7 +17,6 @@
 package android.service.controls;
 
 import android.service.controls.IControlsActionCallback;
-import android.service.controls.IControlsLoadCallback;
 import android.service.controls.IControlsSubscriber;
 import android.service.controls.actions.ControlActionWrapper;
 
@@ -25,9 +24,9 @@
  * @hide
  */
 oneway interface IControlsProvider {
-    void load(IControlsLoadCallback cb);
+    void load(IControlsSubscriber subscriber);
 
-    void loadSuggested(int maxNumber, IControlsLoadCallback cb);
+    void loadSuggested(IControlsSubscriber subscriber);
 
     void subscribe(in List<String> controlIds,
              IControlsSubscriber subscriber);
diff --git a/core/java/android/service/controls/templates/ControlTemplate.java b/core/java/android/service/controls/templates/ControlTemplate.java
index d2c0f76..a5156e3 100644
--- a/core/java/android/service/controls/templates/ControlTemplate.java
+++ b/core/java/android/service/controls/templates/ControlTemplate.java
@@ -74,8 +74,6 @@
             TYPE_TOGGLE,
             TYPE_RANGE,
             TYPE_THUMBNAIL,
-            TYPE_DISCRETE_TOGGLE,
-            TYPE_COORD_RANGE,
             TYPE_TOGGLE_RANGE,
             TYPE_TEMPERATURE,
             TYPE_STATELESS
@@ -104,16 +102,6 @@
      */
     public static final @TemplateType int TYPE_THUMBNAIL = 3;
 
-    /**
-     * Type identifier of {@link DiscreteToggleTemplate}.
-     */
-    public static final @TemplateType int TYPE_DISCRETE_TOGGLE = 4;
-
-    /**
-     * @hide
-     */
-    public static final @TemplateType int TYPE_COORD_RANGE = 5;
-
     public static final @TemplateType int TYPE_TOGGLE_RANGE = 6;
 
     public static final @TemplateType int TYPE_TEMPERATURE = 7;
@@ -190,10 +178,6 @@
                     return new RangeTemplate(bundle);
                 case TYPE_THUMBNAIL:
                     return new ThumbnailTemplate(bundle);
-                case TYPE_DISCRETE_TOGGLE:
-                    return new DiscreteToggleTemplate(bundle);
-                case TYPE_COORD_RANGE:
-                    return new CoordinatedRangeTemplate(bundle);
                 case TYPE_TOGGLE_RANGE:
                     return new ToggleRangeTemplate(bundle);
                 case TYPE_TEMPERATURE:
diff --git a/core/java/android/service/controls/templates/CoordinatedRangeTemplate.java b/core/java/android/service/controls/templates/CoordinatedRangeTemplate.java
deleted file mode 100644
index 6aa5480..0000000
--- a/core/java/android/service/controls/templates/CoordinatedRangeTemplate.java
+++ /dev/null
@@ -1,168 +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.service.controls.templates;
-
-import android.annotation.NonNull;
-import android.annotation.Nullable;
-import android.os.Bundle;
-import android.util.Log;
-
-public final class CoordinatedRangeTemplate extends ControlTemplate {
-
-    private static final String TAG = "CoordinatedRangeTemplate";
-
-    private static final @TemplateType int TYPE = TYPE_COORD_RANGE;
-    private static final String KEY_RANGE_LOW = "key_range_low";
-    private static final String KEY_RANGE_HIGH = "key_range_high";
-    private static final String KEY_MIN_GAP = "key_min_gap";
-
-    private final @NonNull RangeTemplate mRangeLow;
-    private final @NonNull RangeTemplate mRangeHigh;
-    private final float mMinGap;
-
-    public CoordinatedRangeTemplate(
-            @NonNull String templateId,
-            float minGap,
-            @NonNull RangeTemplate rangeLow,
-            @NonNull RangeTemplate rangeHigh) {
-        super(templateId);
-        mRangeLow = rangeLow;
-        mRangeHigh = rangeHigh;
-        if (minGap < 0) {
-            Log.e(TAG, "minGap must be non-negative. Setting to 0");
-            mMinGap = 0;
-        } else {
-            mMinGap = minGap;
-        }
-        validateRanges();
-    }
-
-    public CoordinatedRangeTemplate(
-            @NonNull String templateId,
-            float minGap,
-            float minValueLow,
-            float maxValueLow,
-            float currentValueLow,
-            float minValueHigh,
-            float maxValueHigh,
-            float currentValueHigh,
-            float stepValue,
-            @Nullable CharSequence formatString) {
-        this(templateId,
-                minGap,
-            new RangeTemplate("",
-                minValueLow, maxValueLow, currentValueLow, stepValue, formatString),
-            new RangeTemplate("",
-                minValueHigh, maxValueHigh, currentValueHigh, stepValue, formatString));
-    }
-
-    /**
-     * @param b
-     * @hide
-     */
-    CoordinatedRangeTemplate(Bundle b) {
-        super(b);
-        mRangeLow = new RangeTemplate(b.getBundle(KEY_RANGE_LOW));
-        mRangeHigh = new RangeTemplate(b.getBundle(KEY_RANGE_HIGH));
-        mMinGap = b.getFloat(KEY_MIN_GAP);
-        validateRanges();
-    }
-
-    @NonNull
-    public RangeTemplate getRangeLow() {
-        return mRangeLow;
-    }
-
-    @NonNull
-    public RangeTemplate getRangeHigh() {
-        return mRangeHigh;
-    }
-
-    public float getMinValueLow() {
-        return mRangeLow.getMinValue();
-    }
-
-    public float getMaxValueLow() {
-        return mRangeLow.getMaxValue();
-    }
-
-    public float getCurrentValueLow() {
-        return mRangeLow.getCurrentValue();
-    }
-
-    public float getMinValueHigh() {
-        return mRangeHigh.getMinValue();
-    }
-
-    public float getMaxValueHigh() {
-        return mRangeHigh.getMaxValue();
-    }
-
-    public float getCurrentValueHigh() {
-        return mRangeHigh.getCurrentValue();
-    }
-
-    public float getStepValue() {
-        return mRangeLow.getStepValue();
-    }
-
-    public float getMinGap() {
-        return mMinGap;
-    }
-
-    @NonNull
-    public CharSequence getFormatString() {
-        return mRangeLow.getFormatString();
-    }
-
-    @Override
-    public int getTemplateType() {
-        return TYPE;
-    }
-
-    /**
-     * @return
-     * @hide
-     */
-    @Override
-    @NonNull
-    Bundle getDataBundle() {
-        Bundle b = super.getDataBundle();
-        b.putBundle(KEY_RANGE_LOW, mRangeLow.getDataBundle());
-        b.putBundle(KEY_RANGE_HIGH, mRangeHigh.getDataBundle());
-        return b;
-    }
-
-    private void validateRanges() {
-        if (Float.compare(mRangeLow.getStepValue(), mRangeHigh.getStepValue()) != 0) {
-            throw new IllegalArgumentException(
-                    String.format("lowStepValue=%f != highStepValue=%f",
-                            mRangeLow.getStepValue(), mRangeHigh.getStepValue()));
-        }
-        if (!mRangeLow.getFormatString().equals(mRangeHigh.getFormatString())) {
-            throw new IllegalArgumentException(
-                    String.format("lowFormatString=%s != highFormatString=%s",
-                            mRangeLow.getFormatString(), mRangeHigh.getFormatString()));
-        }
-        if (mMinGap > mRangeHigh.getCurrentValue() - mRangeLow.getCurrentValue()) {
-            throw new IllegalArgumentException(
-                    String.format("Minimum gap (%f) > Current gap (%f)", mMinGap,
-                            mRangeHigh.getCurrentValue() - mRangeLow.getCurrentValue()));
-        }
-    }
-
-}
diff --git a/core/java/android/service/controls/templates/DiscreteToggleTemplate.java b/core/java/android/service/controls/templates/DiscreteToggleTemplate.java
deleted file mode 100644
index 7a1331a..0000000
--- a/core/java/android/service/controls/templates/DiscreteToggleTemplate.java
+++ /dev/null
@@ -1,107 +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.service.controls.templates;
-
-import android.annotation.NonNull;
-import android.os.Bundle;
-import android.service.controls.Control;
-import android.service.controls.actions.BooleanAction;
-
-import com.android.internal.util.Preconditions;
-
-/**
- * A template for a {@link Control} with two discrete inputs.
- *
- * The two inputs represent a <i>Negative</i> input and a <i>Positive</i> input.
- * <p>
- * When one of the buttons is actioned, a {@link BooleanAction} will be sent.
- * {@link BooleanAction#getNewState} will be {@code false} if the button was
- * {@link DiscreteToggleTemplate#getNegativeButton} and {@code true} if the button was
- * {@link DiscreteToggleTemplate#getPositiveButton}.
- */
-public final class DiscreteToggleTemplate extends ControlTemplate {
-
-    private static final @TemplateType int TYPE = TYPE_DISCRETE_TOGGLE;
-    private static final String KEY_NEGATIVE_BUTTON = "key_negative_button";
-    private static final String KEY_POSITIVE_BUTTON = "key_positive_button";
-
-    private final @NonNull ControlButton mPositiveButton;
-    private final @NonNull ControlButton mNegativeButton;
-
-    /**
-     * @param templateId the identifier for this template object
-     * @param negativeButton a {@link ControlButton} for the <i>Negative</i> input
-     * @param positiveButton a {@link ControlButton} for the <i>Positive</i> input
-     */
-    public DiscreteToggleTemplate(@NonNull String templateId,
-            @NonNull ControlButton negativeButton,
-            @NonNull ControlButton positiveButton) {
-        super(templateId);
-        Preconditions.checkNotNull(negativeButton);
-        Preconditions.checkNotNull(positiveButton);
-        mNegativeButton = negativeButton;
-        mPositiveButton = positiveButton;
-    }
-
-    /**
-     * @param b
-     * @hide
-     */
-    DiscreteToggleTemplate(Bundle b) {
-        super(b);
-        mNegativeButton = b.getParcelable(KEY_NEGATIVE_BUTTON);
-        mPositiveButton = b.getParcelable(KEY_POSITIVE_BUTTON);
-    }
-
-    /**
-     * The {@link ControlButton} associated with the <i>Negative</i> action.
-     */
-    @NonNull
-    public ControlButton getNegativeButton() {
-        return mNegativeButton;
-    }
-
-    /**
-     * The {@link ControlButton} associated with the <i>Positive</i> action.
-     */
-    @NonNull
-    public ControlButton getPositiveButton() {
-        return mPositiveButton;
-    }
-
-    /**
-     * @return {@link ControlTemplate#TYPE_DISCRETE_TOGGLE}
-     */
-    @Override
-    public int getTemplateType() {
-        return TYPE;
-    }
-
-    /**
-     * @return
-     * @hide
-     */
-    @Override
-    @NonNull
-    Bundle getDataBundle() {
-        Bundle b = super.getDataBundle();
-        b.putParcelable(KEY_NEGATIVE_BUTTON, mNegativeButton);
-        b.putParcelable(KEY_POSITIVE_BUTTON, mPositiveButton);
-        return b;
-    }
-
-}
diff --git a/core/java/android/service/notification/ConditionProviderService.java b/core/java/android/service/notification/ConditionProviderService.java
index 7d3b13b..f37e01d 100644
--- a/core/java/android/service/notification/ConditionProviderService.java
+++ b/core/java/android/service/notification/ConditionProviderService.java
@@ -58,7 +58,7 @@
  * &lt;/service></pre>
  *
  *  <p> Condition providers cannot be bound by the system on
- * {@link ActivityManager#isLowRamDevice() low ram} devices</p>
+ * {@link ActivityManager#isLowRamDevice() low ram} devices running Android Q (and below)</p>
  *
  * @deprecated Instead of using an automatically bound service, use
  * {@link android.app.NotificationManager#setAutomaticZenRuleState(String, Condition)} to tell the
diff --git a/core/java/android/service/notification/ConversationChannelWrapper.java b/core/java/android/service/notification/ConversationChannelWrapper.java
index 9847695..ab465ab 100644
--- a/core/java/android/service/notification/ConversationChannelWrapper.java
+++ b/core/java/android/service/notification/ConversationChannelWrapper.java
@@ -33,6 +33,8 @@
     private CharSequence mGroupLabel;
     private CharSequence mParentChannelLabel;
     private ShortcutInfo mShortcutInfo;
+    private String mPkg;
+    private int mUid;
 
     public ConversationChannelWrapper() {}
 
@@ -41,6 +43,8 @@
         mGroupLabel = in.readCharSequence();
         mParentChannelLabel = in.readCharSequence();
         mShortcutInfo = in.readParcelable(ShortcutInfo.class.getClassLoader());
+        mPkg = in.readStringNoHelper();
+        mUid = in.readInt();
     }
 
     @Override
@@ -49,6 +53,8 @@
         dest.writeCharSequence(mGroupLabel);
         dest.writeCharSequence(mParentChannelLabel);
         dest.writeParcelable(mShortcutInfo, flags);
+        dest.writeStringNoHelper(mPkg);
+        dest.writeInt(mUid);
     }
 
     @Override
@@ -103,6 +109,22 @@
         mShortcutInfo = shortcutInfo;
     }
 
+    public String getPkg() {
+        return mPkg;
+    }
+
+    public void setPkg(String pkg) {
+        mPkg = pkg;
+    }
+
+    public int getUid() {
+        return mUid;
+    }
+
+    public void setUid(int uid) {
+        mUid = uid;
+    }
+
     @Override
     public boolean equals(Object o) {
         if (this == o) return true;
@@ -111,12 +133,14 @@
         return Objects.equals(getNotificationChannel(), that.getNotificationChannel()) &&
                 Objects.equals(getGroupLabel(), that.getGroupLabel()) &&
                 Objects.equals(getParentChannelLabel(), that.getParentChannelLabel()) &&
-                Objects.equals(getShortcutInfo(), that.getShortcutInfo());
+                Objects.equals(getShortcutInfo(), that.getShortcutInfo()) &&
+                Objects.equals(getPkg(), that.getPkg()) &&
+                getUid() == that.getUid();
     }
 
     @Override
     public int hashCode() {
         return Objects.hash(getNotificationChannel(), getGroupLabel(), getParentChannelLabel(),
-                getShortcutInfo());
+                getShortcutInfo(), getPkg(), getUid());
     }
 }
diff --git a/core/java/android/service/notification/NotificationListenerService.java b/core/java/android/service/notification/NotificationListenerService.java
index 0ff2e03..6562572 100644
--- a/core/java/android/service/notification/NotificationListenerService.java
+++ b/core/java/android/service/notification/NotificationListenerService.java
@@ -86,8 +86,8 @@
  * or after {@link #onListenerDisconnected()}.
  * </p>
  * <p> Notification listeners cannot get notification access or be bound by the system on
- * {@linkplain ActivityManager#isLowRamDevice() low-RAM} devices. The system also ignores
- * notification listeners running in a work profile. A
+ * {@linkplain ActivityManager#isLowRamDevice() low-RAM} devices running Android Q (and below).
+ * The system also ignores notification listeners running in a work profile. A
  * {@link android.app.admin.DevicePolicyManager} might block notifications originating from a work
  * profile.</p>
  * <p>
diff --git a/core/java/android/view/AccessibilityEmbeddedConnection.java b/core/java/android/view/AccessibilityEmbeddedConnection.java
index cc1e501..5d34669 100644
--- a/core/java/android/view/AccessibilityEmbeddedConnection.java
+++ b/core/java/android/view/AccessibilityEmbeddedConnection.java
@@ -33,6 +33,7 @@
  */
 final class AccessibilityEmbeddedConnection extends IAccessibilityEmbeddedConnection.Stub {
     private final WeakReference<ViewRootImpl> mViewRootImpl;
+    private final Matrix mTmpScreenMatrix = new Matrix();
 
     AccessibilityEmbeddedConnection(ViewRootImpl viewRootImpl) {
         mViewRootImpl = new WeakReference<>(viewRootImpl);
@@ -73,9 +74,11 @@
     public void setScreenMatrix(float[] matrixValues) {
         final ViewRootImpl viewRootImpl = mViewRootImpl.get();
         if (viewRootImpl != null) {
-            // TODO(b/148821260): Implement the rest of matrix values.
-            viewRootImpl.mAttachInfo.mLocationInParentDisplay.set(
-                    (int) matrixValues[Matrix.MTRANS_X], (int) matrixValues[Matrix.MTRANS_Y]);
+            mTmpScreenMatrix.setValues(matrixValues);
+            if (viewRootImpl.mAttachInfo.mScreenMatrixInEmbeddedHierarchy == null) {
+                viewRootImpl.mAttachInfo.mScreenMatrixInEmbeddedHierarchy = new Matrix();
+            }
+            viewRootImpl.mAttachInfo.mScreenMatrixInEmbeddedHierarchy.set(mTmpScreenMatrix);
         }
     }
 }
diff --git a/core/java/android/view/AccessibilityInteractionController.java b/core/java/android/view/AccessibilityInteractionController.java
index 3ca84c1..6d4ac0e 100644
--- a/core/java/android/view/AccessibilityInteractionController.java
+++ b/core/java/android/view/AccessibilityInteractionController.java
@@ -21,6 +21,7 @@
 import static android.view.accessibility.AccessibilityNodeInfo.EXTRA_DATA_REQUESTED_KEY;
 import static android.view.accessibility.AccessibilityNodeInfo.EXTRA_DATA_TEXT_CHARACTER_LOCATION_KEY;
 
+import android.graphics.Matrix;
 import android.graphics.Point;
 import android.graphics.Rect;
 import android.graphics.RectF;
@@ -109,6 +110,7 @@
     private final Rect mTempRect = new Rect();
     private final Rect mTempRect1 = new Rect();
     private final Rect mTempRect2 = new Rect();
+    private final RectF mTempRectF = new RectF();
 
     private AddNodeInfosForViewId mAddNodeInfosForViewId;
 
@@ -855,6 +857,38 @@
         return mViewRootImpl.mAttachInfo.mLocationInParentDisplay.equals(0, 0);
     }
 
+    private void applyScreenMatrixIfNeeded(List<AccessibilityNodeInfo> infos) {
+        if (infos == null || shouldBypassApplyScreenMatrix()) {
+            return;
+        }
+        final int infoCount = infos.size();
+        for (int i = 0; i < infoCount; i++) {
+            final AccessibilityNodeInfo info = infos.get(i);
+            applyScreenMatrixIfNeeded(info);
+        }
+    }
+
+    private void applyScreenMatrixIfNeeded(AccessibilityNodeInfo info) {
+        if (info == null || shouldBypassApplyScreenMatrix()) {
+            return;
+        }
+        final Rect boundsInScreen = mTempRect;
+        final RectF transformedBounds = mTempRectF;
+        final Matrix screenMatrix = mViewRootImpl.mAttachInfo.mScreenMatrixInEmbeddedHierarchy;
+
+        info.getBoundsInScreen(boundsInScreen);
+        transformedBounds.set(boundsInScreen);
+        screenMatrix.mapRect(transformedBounds);
+        boundsInScreen.set((int) transformedBounds.left, (int) transformedBounds.top,
+                (int) transformedBounds.right, (int) transformedBounds.bottom);
+        info.setBoundsInScreen(boundsInScreen);
+    }
+
+    private boolean shouldBypassApplyScreenMatrix() {
+        final Matrix screenMatrix = mViewRootImpl.mAttachInfo.mScreenMatrixInEmbeddedHierarchy;
+        return screenMatrix == null || screenMatrix.isIdentity();
+    }
+
     private void associateLeashedParentIfNeeded(List<AccessibilityNodeInfo> infos) {
         if (infos == null || shouldBypassAssociateLeashedParent()) {
             return;
@@ -945,6 +979,7 @@
         try {
             mViewRootImpl.mAttachInfo.mAccessibilityFetchFlags = 0;
             associateLeashedParentIfNeeded(infos);
+            applyScreenMatrixIfNeeded(infos);
             adjustBoundsInScreenIfNeeded(infos);
             // To avoid applyAppScaleAndMagnificationSpecIfNeeded changing the bounds of node,
             // then impact the visibility result, we need to adjust visibility before apply scale.
@@ -967,6 +1002,7 @@
         try {
             mViewRootImpl.mAttachInfo.mAccessibilityFetchFlags = 0;
             associateLeashedParentIfNeeded(info);
+            applyScreenMatrixIfNeeded(info);
             adjustBoundsInScreenIfNeeded(info);
             // To avoid applyAppScaleAndMagnificationSpecIfNeeded changing the bounds of node,
             // then impact the visibility result, we need to adjust visibility before apply scale.
diff --git a/core/java/android/view/CutoutSpecification.java b/core/java/android/view/CutoutSpecification.java
index d21a952..850e9fc 100644
--- a/core/java/android/view/CutoutSpecification.java
+++ b/core/java/android/view/CutoutSpecification.java
@@ -406,9 +406,7 @@
                     }
                     currentIndex += RIGHT_MARKER.length();
                 } else if (specWithoutDp.startsWith(BOTTOM_MARKER, currentIndex)) {
-                    if (!mPositionFromCenterVertical) {
-                        parseSvgPathSpec(region, sb.toString());
-                    }
+                    parseSvgPathSpec(region, sb.toString());
                     currentIndex += BOTTOM_MARKER.length();
 
                     /* prepare to parse the rest path */
@@ -416,9 +414,7 @@
                     mBindBottomCutout = true;
                     mPositionFromBottom = true;
                 } else if (specWithoutDp.startsWith(CENTER_VERTICAL_MARKER, currentIndex)) {
-                    if (!mPositionFromBottom) {
-                        parseSvgPathSpec(region, sb.toString());
-                    }
+                    parseSvgPathSpec(region, sb.toString());
                     currentIndex += CENTER_VERTICAL_MARKER.length();
 
                     /* prepare to parse the rest path */
@@ -431,14 +427,16 @@
                     /* prepare to parse the rest path */
                     resetStatus(sb);
                 } else if (specWithoutDp.startsWith(BIND_LEFT_CUTOUT_MARKER, currentIndex)) {
-                    if (!mBindBottomCutout && !mBindRightCutout) {
-                        mBindLeftCutout = true;
-                    }
+                    mBindBottomCutout = false;
+                    mBindRightCutout = false;
+                    mBindLeftCutout = true;
+
                     currentIndex += BIND_LEFT_CUTOUT_MARKER.length();
                 } else if (specWithoutDp.startsWith(BIND_RIGHT_CUTOUT_MARKER, currentIndex)) {
-                    if (!mBindBottomCutout && !mBindLeftCutout) {
-                        mBindRightCutout = true;
-                    }
+                    mBindBottomCutout = false;
+                    mBindLeftCutout = false;
+                    mBindRightCutout = true;
+
                     currentIndex += BIND_RIGHT_CUTOUT_MARKER.length();
                 } else {
                     currentIndex += 1;
diff --git a/core/java/android/view/DisplayInfo.java b/core/java/android/view/DisplayInfo.java
index b9868a7..3047385 100644
--- a/core/java/android/view/DisplayInfo.java
+++ b/core/java/android/view/DisplayInfo.java
@@ -28,6 +28,7 @@
 import android.content.res.CompatibilityInfo;
 import android.content.res.Configuration;
 import android.graphics.Rect;
+import android.hardware.display.DeviceProductInfo;
 import android.os.Build;
 import android.os.Parcel;
 import android.os.Parcelable;
@@ -70,6 +71,13 @@
     public DisplayAddress address;
 
     /**
+     * Product-specific information about the display or the directly connected device on the
+     * display chain. For example, if the display is transitively connected, this field may contain
+     * product information about the intermediate device.
+     */
+    public DeviceProductInfo deviceProductInfo;
+
+    /**
      * The human-readable name of the display.
      */
     public String name;
@@ -297,6 +305,7 @@
                 && type == other.type
                 && displayId == other.displayId
                 && Objects.equals(address, other.address)
+                && Objects.equals(deviceProductInfo, other.deviceProductInfo)
                 && Objects.equals(uniqueId, other.uniqueId)
                 && appWidth == other.appWidth
                 && appHeight == other.appHeight
@@ -336,6 +345,7 @@
         type = other.type;
         displayId = other.displayId;
         address = other.address;
+        deviceProductInfo = other.deviceProductInfo;
         name = other.name;
         uniqueId = other.uniqueId;
         appWidth = other.appWidth;
@@ -373,6 +383,7 @@
         type = source.readInt();
         displayId = source.readInt();
         address = source.readParcelable(null);
+        deviceProductInfo = source.readParcelable(null);
         name = source.readString();
         appWidth = source.readInt();
         appHeight = source.readInt();
@@ -418,6 +429,7 @@
         dest.writeInt(type);
         dest.writeInt(displayId);
         dest.writeParcelable(address, flags);
+        dest.writeParcelable(deviceProductInfo, flags);
         dest.writeString(name);
         dest.writeInt(appWidth);
         dest.writeInt(appHeight);
@@ -645,6 +657,8 @@
         if (address != null) {
             sb.append(", address ").append(address);
         }
+        sb.append(", deviceProductInfo ");
+        sb.append(deviceProductInfo);
         sb.append(", state ");
         sb.append(Display.stateToString(state));
         if (ownerUid != 0 || ownerPackageName != null) {
diff --git a/core/java/android/view/InputDevice.java b/core/java/android/view/InputDevice.java
index 360dedd..58e5b2d 100644
--- a/core/java/android/view/InputDevice.java
+++ b/core/java/android/view/InputDevice.java
@@ -16,6 +16,7 @@
 
 package android.view;
 
+import android.annotation.IntDef;
 import android.annotation.RequiresPermission;
 import android.annotation.TestApi;
 import android.compat.annotation.UnsupportedAppUsage;
@@ -28,6 +29,8 @@
 import android.os.Parcelable;
 import android.os.Vibrator;
 
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
 import java.util.ArrayList;
 import java.util.List;
 
@@ -138,6 +141,19 @@
      */
     public static final int SOURCE_CLASS_JOYSTICK = 0x00000010;
 
+    /** @hide */
+    @IntDef(flag = true, prefix = { "SOURCE_CLASS_" }, value = {
+            SOURCE_CLASS_NONE,
+            SOURCE_CLASS_BUTTON,
+            SOURCE_CLASS_POINTER,
+            SOURCE_CLASS_POINTER,
+            SOURCE_CLASS_TRACKBALL,
+            SOURCE_CLASS_POSITION,
+            SOURCE_CLASS_JOYSTICK
+    })
+    @Retention(RetentionPolicy.SOURCE)
+    @interface InputSourceClass {}
+
     /**
      * The input source is unknown.
      */
diff --git a/core/java/android/view/Surface.java b/core/java/android/view/Surface.java
index 4ac6a66..13d6dd6 100644
--- a/core/java/android/view/Surface.java
+++ b/core/java/android/view/Surface.java
@@ -16,6 +16,8 @@
 
 package android.view;
 
+import static android.system.OsConstants.EINVAL;
+
 import android.annotation.FloatRange;
 import android.annotation.IntDef;
 import android.annotation.NonNull;
@@ -89,7 +91,8 @@
     private static native int nativeSetSharedBufferModeEnabled(long nativeObject, boolean enabled);
     private static native int nativeSetAutoRefreshEnabled(long nativeObject, boolean enabled);
 
-    private static native int nativeSetFrameRate(long nativeObject, float frameRate);
+    private static native int nativeSetFrameRate(
+            long nativeObject, float frameRate, int compatibility);
 
     public static final @android.annotation.NonNull Parcelable.Creator<Surface> CREATOR =
             new Parcelable.Creator<Surface>() {
@@ -184,6 +187,28 @@
      */
     public static final int ROTATION_270 = 3;
 
+    /** @hide */
+    @Retention(RetentionPolicy.SOURCE)
+    @IntDef(prefix = {"FRAME_RATE_COMPATIBILITY_"},
+            value = {FRAME_RATE_COMPATIBILITY_DEFAULT, FRAME_RATE_COMPATIBILITY_FIXED_SOURCE})
+    public @interface FrameRateCompatibility {}
+
+    // From native_window.h. Keep these in sync.
+    /**
+     * There are no inherent restrictions on the frame rate of this surface.
+     */
+    public static final int FRAME_RATE_COMPATIBILITY_DEFAULT = 0;
+
+    /**
+     * This surface is being used to display content with an inherently fixed frame rate,
+     * e.g. a video that has a specific frame rate. When the system selects a frame rate
+     * other than what the app requested, the app will need to do pull down or use some
+     * other technique to adapt to the system's frame rate. The user experience is likely
+     * to be worse (e.g. more frame stuttering) than it would be if the system had chosen
+     * the app's requested frame rate.
+     */
+    public static final int FRAME_RATE_COMPATIBILITY_FIXED_SOURCE = 1;
+
     /**
      * Create an empty surface, which will later be filled in by readFromParcel().
      * @hide
@@ -864,11 +889,23 @@
      * called. The frameRate param does *not* need to be a valid refresh rate for this
      * device's display - e.g., it's fine to pass 30fps to a device that can only run the
      * display at 60fps.
+     *
+     * @param compatibility The frame rate compatibility of this surface. The
+     * compatibility value may influence the system's choice of display frame rate. See
+     * the FRAME_RATE_COMPATIBILITY_* values for more info.
+     *
+     * @throws IllegalArgumentException If frameRate or compatibility are invalid.
      */
-    public void setFrameRate(@FloatRange(from = 0.0) float frameRate) {
-        int error = nativeSetFrameRate(mNativeObject, frameRate);
-        if (error != 0) {
-            throw new RuntimeException("Failed to set frame rate on Surface");
+    public void setFrameRate(
+            @FloatRange(from = 0.0) float frameRate, @FrameRateCompatibility int compatibility) {
+        synchronized (mLock) {
+            checkNotReleasedLocked();
+            int error = nativeSetFrameRate(mNativeObject, frameRate, compatibility);
+            if (error == -EINVAL) {
+                throw new IllegalArgumentException("Invalid argument to Surface.setFrameRate()");
+            } else if (error != 0) {
+                throw new RuntimeException("Failed to set frame rate on Surface");
+            }
         }
     }
 
diff --git a/core/java/android/view/SurfaceControl.java b/core/java/android/view/SurfaceControl.java
index cf48c52..0816e84 100644
--- a/core/java/android/view/SurfaceControl.java
+++ b/core/java/android/view/SurfaceControl.java
@@ -41,6 +41,7 @@
 import android.graphics.Point;
 import android.graphics.Rect;
 import android.graphics.Region;
+import android.hardware.display.DeviceProductInfo;
 import android.hardware.display.DisplayedContentSample;
 import android.hardware.display.DisplayedContentSamplingAttributes;
 import android.os.Build;
@@ -213,7 +214,7 @@
             @Size(4) float[] spotColor, float lightPosY, float lightPosZ, float lightRadius);
 
     private static native void nativeSetFrameRate(
-            long transactionObj, long nativeObject, float frameRate);
+            long transactionObj, long nativeObject, float frameRate, int compatibility);
 
     private final CloseGuard mCloseGuard = CloseGuard.get();
     private String mName;
@@ -1286,12 +1287,14 @@
         public boolean isInternal;
         public float density;
         public boolean secure;
+        public DeviceProductInfo deviceProductInfo;
 
         @Override
         public String toString() {
             return "DisplayInfo{isInternal=" + isInternal
                     + ", density=" + density
-                    + ", secure=" + secure + "}";
+                    + ", secure=" + secure
+                    + ", deviceProductInfo=" + deviceProductInfo + "}";
         }
     }
 
@@ -2735,13 +2738,17 @@
          *                  isn't called. The frameRate param does *not* need to be a valid refresh
          *                  rate for this device's display - e.g., it's fine to pass 30fps to a
          *                  device that can only run the display at 60fps.
+         * @param compatibility The frame rate compatibility of this surface. The compatibility
+         *                      value may influence the system's choice of display frame rate. See
+         *                      the Surface.FRAME_RATE_COMPATIBILITY_* values for more info.
          * @return This transaction object.
          */
         @NonNull
-        public Transaction setFrameRate(
-                @NonNull SurfaceControl sc, @FloatRange(from = 0.0) float frameRate) {
+        public Transaction setFrameRate(@NonNull SurfaceControl sc,
+                @FloatRange(from = 0.0) float frameRate,
+                @Surface.FrameRateCompatibility int compatibility) {
             checkPreconditions(sc);
-            nativeSetFrameRate(mNativeObject, sc.mNativeObject, frameRate);
+            nativeSetFrameRate(mNativeObject, sc.mNativeObject, frameRate, compatibility);
             return this;
         }
 
diff --git a/core/java/android/view/SurfaceView.java b/core/java/android/view/SurfaceView.java
index 5566e0e..deff79d5 100644
--- a/core/java/android/view/SurfaceView.java
+++ b/core/java/android/view/SurfaceView.java
@@ -788,9 +788,16 @@
         final boolean sizeChanged = mSurfaceWidth != myWidth || mSurfaceHeight != myHeight;
         final boolean windowVisibleChanged = mWindowVisibility != mLastWindowVisibility;
         boolean redrawNeeded = false;
+        getLocationInSurface(mLocation);
+        final boolean positionChanged = mWindowSpaceLeft != mLocation[0]
+            || mWindowSpaceTop != mLocation[1];
+        final boolean layoutSizeChanged = getWidth() != mScreenRect.width()
+            || getHeight() != mScreenRect.height();
 
-        if (creating || formatChanged || sizeChanged || visibleChanged || (mUseAlpha
-                && alphaChanged) || windowVisibleChanged) {
+
+        if (creating || formatChanged || sizeChanged || visibleChanged ||
+                (mUseAlpha && alphaChanged) || windowVisibleChanged ||
+                positionChanged || layoutSizeChanged) {
             getLocationInWindow(mLocation);
 
             if (DEBUG) Log.i(TAG, System.identityHashCode(this) + " "
@@ -922,6 +929,9 @@
                             mTmpTransaction.setWindowCrop(mSurfaceControl, mSurfaceWidth,
                                     mSurfaceHeight);
                         }
+                    } else if ((layoutSizeChanged || positionChanged) &&
+                            WindowManagerGlobal.useBLAST()) {
+                        viewRoot.setUseBLASTSyncTransaction();
                     }
                     mTmpTransaction.setCornerRadius(mSurfaceControl, mCornerRadius);
                     if (sizeChanged && !creating) {
@@ -1058,11 +1068,6 @@
         } else {
             // Calculate the window position in case RT loses the window
             // and we need to fallback to a UI-thread driven position update
-            getLocationInSurface(mLocation);
-            final boolean positionChanged = mWindowSpaceLeft != mLocation[0]
-                    || mWindowSpaceTop != mLocation[1];
-            final boolean layoutSizeChanged = getWidth() != mScreenRect.width()
-                    || getHeight() != mScreenRect.height();
             if (positionChanged || layoutSizeChanged) { // Only the position has changed
                 mWindowSpaceLeft = mLocation[0];
                 mWindowSpaceTop = mLocation[1];
@@ -1540,21 +1545,6 @@
     }
 
     /**
-     * @hide
-     * Note: Base class method is @UnsupportedAppUsage
-     */
-    @Override
-    public void invalidate(boolean invalidateCache) {
-        super.invalidate(invalidateCache);
-        if (!WindowManagerGlobal.useBLAST()) {
-            return;
-        }
-        final ViewRootImpl viewRoot = getViewRootImpl();
-        if (viewRoot == null) return;
-        viewRoot.setUseBLASTSyncTransaction();
-    }
-
-    /**
      * Display the view-hierarchy embedded within a {@link SurfaceControlViewHost.SurfacePackage}
      * within this SurfaceView. If this SurfaceView is above it's host Surface (see
      * {@link #setZOrderOnTop} then the embedded Surface hierarchy will be able to receive
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java
index c7f850a..4c7307e 100644
--- a/core/java/android/view/View.java
+++ b/core/java/android/view/View.java
@@ -110,6 +110,7 @@
 import android.view.AccessibilityIterators.TextSegmentIterator;
 import android.view.AccessibilityIterators.WordTextSegmentIterator;
 import android.view.ContextMenu.ContextMenuInfo;
+import android.view.InputDevice.InputSourceClass;
 import android.view.Window.OnContentApplyWindowInsetsListener;
 import android.view.WindowInsets.Type;
 import android.view.WindowInsetsAnimation.Bounds;
@@ -5205,6 +5206,14 @@
     private int mExplicitStyle;
 
     /**
+     * Specifies which input source classes should provide unbuffered input events to this view
+     *
+     * @see View#requestUnbufferedDispatch(int)
+     */
+    @InputSourceClass
+    int mUnbufferedInputSource = InputDevice.SOURCE_CLASS_NONE;
+
+    /**
      * Simple constructor to use when creating a view from code.
      *
      * @param context The Context the view is running in, through which it can
@@ -8013,6 +8022,10 @@
             mAttachInfo.mKeyDispatchState.reset(this);
         }
 
+        if (mParent != null) {
+            mParent.onDescendantUnbufferedRequested();
+        }
+
         notifyEnterOrExitForAutoFillIfNeeded(gainFocus);
     }
 
@@ -15820,12 +15833,17 @@
      * system not batch {@link MotionEvent}s but instead deliver them as soon as they're
      * available. This method should only be called for touch events.
      *
-     * <p class="note">This api is not intended for most applications. Buffered dispatch
+     * <p class="note">This API is not intended for most applications. Buffered dispatch
      * provides many of benefits, and just requesting unbuffered dispatch on most MotionEvent
      * streams will not improve your input latency. Side effects include: increased latency,
      * jittery scrolls and inability to take advantage of system resampling. Talk to your input
      * professional to see if {@link #requestUnbufferedDispatch(MotionEvent)} is right for
      * you.</p>
+     *
+     * To receive unbuffered events for arbitrary input device source classes, use
+     * {@link #requestUnbufferedDispatch(int)},
+     *
+     * @see View#requestUnbufferedDispatch(int)
      */
     public final void requestUnbufferedDispatch(MotionEvent event) {
         final int action = event.getAction();
@@ -15837,6 +15855,27 @@
         mAttachInfo.mUnbufferedDispatchRequested = true;
     }
 
+    /**
+     * Request unbuffered dispatch of the given event source class to this view.
+     * This is similar to {@link View#requestUnbufferedDispatch(MotionEvent)}, but does not
+     * automatically terminate, and allows the specification of arbitrary input source classes.
+     *
+     * @param source The combined input source class to request unbuffered dispatch for. All
+     *               events coming from these source classes will not be buffered. Set to
+     *               {@link InputDevice#SOURCE_CLASS_NONE} in order to return to default behaviour.
+     *
+     * @see View#requestUnbufferedDispatch(MotionEvent)
+     */
+    public final void requestUnbufferedDispatch(@InputSourceClass int source) {
+        if (mUnbufferedInputSource == source) {
+            return;
+        }
+        mUnbufferedInputSource = source;
+        if (mParent != null) {
+            mParent.onDescendantUnbufferedRequested();
+        }
+    }
+
     private boolean hasSize() {
         return (mBottom > mTop) && (mRight > mLeft);
     }
@@ -28820,6 +28859,12 @@
         final Point mLocationInParentDisplay = new Point();
 
         /**
+         * The screen matrix of this view when it's on a {@link SurfaceControlViewHost} that is
+         * embedded within a SurfaceView.
+         */
+        Matrix mScreenMatrixInEmbeddedHierarchy;
+
+        /**
          * Global to the view hierarchy used as a temporary for dealing with
          * x/y points in the transparent region computations.
          */
diff --git a/core/java/android/view/ViewGroup.java b/core/java/android/view/ViewGroup.java
index 0367536..b6c46be 100644
--- a/core/java/android/view/ViewGroup.java
+++ b/core/java/android/view/ViewGroup.java
@@ -3692,6 +3692,31 @@
             }
             childrenForAccessibility.clear();
         }
+        info.setAvailableExtraData(Collections.singletonList(
+                AccessibilityNodeInfo.EXTRA_DATA_RENDERING_INFO_KEY));
+    }
+
+    /**
+     * {@inheritDoc}
+     *
+     * @param info The info to which to add the extra data. Never {@code null}.
+     * @param extraDataKey A key specifying the type of extra data to add to the info. The
+     *                     extra data should be added to the {@link Bundle} returned by
+     *                     the info's {@link AccessibilityNodeInfo#getExtras} method. Never
+     *                     {@code null}.
+     * @param arguments A {@link Bundle} holding any arguments relevant for this request. May be
+     *                  {@code null} if the service provided no arguments.
+     *
+     */
+    @Override
+    public void addExtraDataToAccessibilityNodeInfo(@NonNull AccessibilityNodeInfo info,
+            @NonNull String extraDataKey, @Nullable Bundle arguments) {
+        if (extraDataKey.equals(AccessibilityNodeInfo.EXTRA_DATA_RENDERING_INFO_KEY)) {
+            final AccessibilityNodeInfo.ExtraRenderingInfo extraRenderingInfo =
+                    AccessibilityNodeInfo.ExtraRenderingInfo.obtain();
+            extraRenderingInfo.setLayoutParams(getLayoutParams().width, getLayoutParams().height);
+            info.setExtraRenderingInfo(extraRenderingInfo);
+        }
     }
 
     @Override
@@ -9004,4 +9029,30 @@
             getChildAt(i).encode(encoder);
         }
     }
+
+    /** @hide */
+    @Override
+    public final void onDescendantUnbufferedRequested() {
+        // First look at the focused child for focused events
+        int focusedChildNonPointerSource = InputDevice.SOURCE_CLASS_NONE;
+        if (mFocused != null) {
+            focusedChildNonPointerSource = mFocused.mUnbufferedInputSource
+                    & (~InputDevice.SOURCE_CLASS_POINTER);
+        }
+        mUnbufferedInputSource = focusedChildNonPointerSource;
+
+        // Request unbuffered dispatch for pointer events for this view if any child requested
+        // unbuffered dispatch for pointer events. This is because we can't expect that the pointer
+        // source would dispatch to the focused view.
+        for (int i = 0; i < mChildrenCount; i++) {
+            final View child = mChildren[i];
+            if ((child.mUnbufferedInputSource & InputDevice.SOURCE_CLASS_POINTER) != 0) {
+                mUnbufferedInputSource |= InputDevice.SOURCE_CLASS_POINTER;
+                break;
+            }
+        }
+        if (mParent != null) {
+            mParent.onDescendantUnbufferedRequested();
+        }
+    }
 }
diff --git a/core/java/android/view/ViewParent.java b/core/java/android/view/ViewParent.java
index f25206d..775c15e 100644
--- a/core/java/android/view/ViewParent.java
+++ b/core/java/android/view/ViewParent.java
@@ -675,4 +675,18 @@
      */
     default void subtractObscuredTouchableRegion(Region touchableRegion, View view) {
     }
+
+    /**
+     * Unbuffered dispatch has been requested by a child of this view parent.
+     * This method is called by the View hierarchy to signal ancestors that a View needs to
+     * request unbuffered dispatch.
+     *
+     * @see View#requestUnbufferedDispatch(int)
+     * @hide
+     */
+    default void onDescendantUnbufferedRequested() {
+        if (getParent() != null) {
+            getParent().onDescendantUnbufferedRequested();
+        }
+    }
 }
diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java
index 44ab596..204d2c8 100644
--- a/core/java/android/view/ViewRootImpl.java
+++ b/core/java/android/view/ViewRootImpl.java
@@ -18,6 +18,7 @@
 
 import static android.view.Display.DEFAULT_DISPLAY;
 import static android.view.Display.INVALID_DISPLAY;
+import static android.view.InputDevice.SOURCE_CLASS_NONE;
 import static android.view.InsetsState.ITYPE_NAVIGATION_BAR;
 import static android.view.InsetsState.ITYPE_STATUS_BAR;
 import static android.view.View.PFLAG_DRAW_ANIMATION;
@@ -116,6 +117,7 @@
 import android.util.SparseArray;
 import android.util.TimeUtils;
 import android.util.TypedValue;
+import android.view.InputDevice.InputSourceClass;
 import android.view.InsetsState.InternalInsetsType;
 import android.view.Surface.OutOfResourcesException;
 import android.view.SurfaceControl.Transaction;
@@ -499,6 +501,10 @@
     int mPendingInputEventCount;
     boolean mProcessInputEventsScheduled;
     boolean mUnbufferedInputDispatch;
+    boolean mUnbufferedInputDispatchBySource;
+    @InputSourceClass
+    int mUnbufferedInputSource = SOURCE_CLASS_NONE;
+
     String mPendingInputEventQueueLengthCounterName = "pq";
 
     InputStage mFirstInputStage;
@@ -666,7 +672,22 @@
         int localChanges;
     }
 
+    // If set, ViewRootImpl will call BLASTBufferQueue::setNextTransaction with
+    // mRtBLASTSyncTransaction, prior to invoking draw. This provides a way
+    // to redirect the buffers in to transactions.
     private boolean mNextDrawUseBLASTSyncTransaction;
+    // Set when calling setNextTransaction, we can't just reuse mNextDrawUseBLASTSyncTransaction
+    // because, imagine this scenario:
+    //     1. First draw is using BLAST, mNextDrawUseBLAST = true
+    //     2. We call perform draw and are waiting on the callback
+    //     3. After the first perform draw but before the first callback and the
+    //        second perform draw, a second draw sets mNextDrawUseBLAST = true (it already was)
+    //     4. At this point the callback fires and we set mNextDrawUseBLAST = false;
+    //     5. We get to performDraw and fail to sync as we intended because mNextDrawUseBLAST
+    //        is now false.
+    // This is why we use a two-step latch with the two booleans, one consumed from
+    // performDraw and one consumed from finishBLASTSync()
+    private boolean mNextReportConsumeBLAST;
     // Be very careful with the threading here. This is used from the render thread while
     // the UI thread is paused and then applied and cleared from the UI thread right after
     // draw returns.
@@ -1834,7 +1855,7 @@
             mTraversalBarrier = mHandler.getLooper().getQueue().postSyncBarrier();
             mChoreographer.postCallback(
                     Choreographer.CALLBACK_TRAVERSAL, mTraversalRunnable, null);
-            if (!mUnbufferedInputDispatch) {
+            if (!mUnbufferedInputDispatch && !mUnbufferedInputDispatchBySource) {
                 scheduleConsumeBatchedInput();
             }
             notifyRendererOfFramePending();
@@ -2206,8 +2227,9 @@
         return insets;
     }
 
-    void dispatchApplyInsets(View host) {
+    public void dispatchApplyInsets(View host) {
         Trace.traceBegin(Trace.TRACE_TAG_VIEW, "dispatchApplyInsets");
+        mApplyInsetsRequested = false;
         WindowInsets insets = getWindowInsets(true /* forceConstruct */);
         final boolean dispatchCutout = (mWindowAttributes.layoutInDisplayCutoutMode
                 == LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS);
@@ -2444,7 +2466,6 @@
         }
 
         if (mApplyInsetsRequested) {
-            mApplyInsetsRequested = false;
             updateVisibleInsets();
             dispatchApplyInsets(host);
             if (mLayoutRequested) {
@@ -2621,7 +2642,6 @@
                 if (contentInsetsChanged || mLastSystemUiVisibility !=
                         mAttachInfo.mSystemUiVisibility || mApplyInsetsRequested) {
                     mLastSystemUiVisibility = mAttachInfo.mSystemUiVisibility;
-                    mApplyInsetsRequested = false;
                     dispatchApplyInsets(host);
                     // We applied insets so force contentInsetsChanged to ensure the
                     // hierarchy is measured below.
@@ -3719,9 +3739,9 @@
             usingAsyncReport = mReportNextDraw;
             if (needFrameCompleteCallback) {
                 final Handler handler = mAttachInfo.mHandler;
-                mAttachInfo.mThreadedRenderer.setFrameCompleteCallback((long frameNr) ->
+                mAttachInfo.mThreadedRenderer.setFrameCompleteCallback((long frameNr) -> {
+                        finishBLASTSync();
                         handler.postAtFrontOfQueue(() -> {
-                            finishBLASTSync();
                             if (reportNextDraw) {
                                 // TODO: Use the frame number
                                 pendingDrawFinished();
@@ -3731,12 +3751,23 @@
                                     commitCallbacks.get(i).run();
                                 }
                             }
-                        }));
+                        });});
             }
         }
 
         try {
             if (mNextDrawUseBLASTSyncTransaction) {
+                // TODO(b/149747443)
+                // We aren't prepared to handle overlapping use of mRtBLASTSyncTransaction
+                // so if we are BLAST syncing we make sure the previous draw has
+                // totally finished.
+                if (mAttachInfo.mThreadedRenderer != null) {
+                    mAttachInfo.mThreadedRenderer.fence();
+                }
+
+                mNextReportConsumeBLAST = true;
+                mNextDrawUseBLASTSyncTransaction = false;
+
                 mBlastBufferQueue.setNextTransaction(mRtBLASTSyncTransaction);
             }
             boolean canUseAsync = draw(fullRedrawNeeded);
@@ -7480,6 +7511,9 @@
                 writer.print(mTraversalScheduled);
         writer.print(innerPrefix); writer.print("mIsAmbientMode=");
                 writer.print(mIsAmbientMode);
+        writer.print(innerPrefix); writer.print("mUnbufferedInputSource=");
+        writer.print(Integer.toHexString(mUnbufferedInputSource));
+
         if (mTraversalScheduled) {
             writer.print(" (barrier="); writer.print(mTraversalBarrier); writer.println(")");
         } else {
@@ -8084,6 +8118,7 @@
         @Override
         public void onInputEvent(InputEvent event) {
             Trace.traceBegin(Trace.TRACE_TAG_VIEW, "processInputEventForCompatibility");
+            processUnbufferedRequest(event);
             List<InputEvent> processedEvents;
             try {
                 processedEvents =
@@ -8109,7 +8144,7 @@
 
         @Override
         public void onBatchedInputEventPending() {
-            if (mUnbufferedInputDispatch) {
+            if (mUnbufferedInputDispatch || mUnbufferedInputDispatchBySource) {
                 super.onBatchedInputEventPending();
             } else {
                 scheduleConsumeBatchedInput();
@@ -8126,6 +8161,17 @@
             unscheduleConsumeBatchedInput();
             super.dispose();
         }
+
+        private void processUnbufferedRequest(InputEvent event) {
+            if (!(event instanceof MotionEvent)) {
+                return;
+            }
+            mUnbufferedInputDispatchBySource =
+                    (event.getSource() & mUnbufferedInputSource) != SOURCE_CLASS_NONE;
+            if (mUnbufferedInputDispatchBySource && mConsumeBatchedInputScheduled) {
+                scheduleConsumeBatchedInputImmediately();
+            }
+        }
     }
     WindowInputEventReceiver mInputEventReceiver;
 
@@ -9556,8 +9602,8 @@
     }
 
     private void finishBLASTSync() {
-        if (mNextDrawUseBLASTSyncTransaction) {
-            mNextDrawUseBLASTSyncTransaction = false;
+        if (mNextReportConsumeBLAST) {
+            mNextReportConsumeBLAST = false;
             mRtBLASTSyncTransaction.apply();
         }
     }
@@ -9566,11 +9612,19 @@
         return mRtBLASTSyncTransaction;
     }
 
-    SurfaceControl getRenderSurfaceControl() {
+    /**
+     * @hide
+     */
+    public SurfaceControl getRenderSurfaceControl() {
         if (mUseBLASTAdapter) {
             return mBlastSurfaceControl;
         } else {
             return mSurfaceControl;
         }
     }
+
+    @Override
+    public void onDescendantUnbufferedRequested() {
+        mUnbufferedInputSource = mView.mUnbufferedInputSource;
+    }
 }
diff --git a/core/java/android/view/WindowlessWindowManager.java b/core/java/android/view/WindowlessWindowManager.java
index 62f3fa4..87dcba0 100644
--- a/core/java/android/view/WindowlessWindowManager.java
+++ b/core/java/android/view/WindowlessWindowManager.java
@@ -163,6 +163,15 @@
         return !PixelFormat.formatHasAlpha(attrs.format);
     }
 
+    /** @hide */
+    protected SurfaceControl getSurfaceControl(View rootView) {
+        final State s = mStateForWindow.get(rootView.getViewRootImpl().mWindow.asBinder());
+        if (s == null) {
+            return null;
+        }
+        return s.mSurfaceControl;
+    }
+
     @Override
     public int relayout(IWindow window, int seq, WindowManager.LayoutParams inAttrs,
             int requestedWidth, int requestedHeight, int viewFlags, int flags, long frameNumber,
diff --git a/core/java/android/view/accessibility/AccessibilityNodeInfo.java b/core/java/android/view/accessibility/AccessibilityNodeInfo.java
index bf2de14..eb4f9db 100644
--- a/core/java/android/view/accessibility/AccessibilityNodeInfo.java
+++ b/core/java/android/view/accessibility/AccessibilityNodeInfo.java
@@ -50,8 +50,12 @@
 import android.util.Log;
 import android.util.LongArray;
 import android.util.Pools.SynchronizedPool;
+import android.util.Size;
+import android.util.TypedValue;
 import android.view.TouchDelegate;
 import android.view.View;
+import android.view.ViewGroup;
+import android.widget.TextView;
 
 import com.android.internal.R;
 import com.android.internal.util.CollectionUtils;
@@ -634,6 +638,25 @@
     public static final String EXTRA_DATA_TEXT_CHARACTER_LOCATION_ARG_LENGTH =
             "android.view.accessibility.extra.DATA_TEXT_CHARACTER_LOCATION_ARG_LENGTH";
 
+    /**
+     * Key used to request extra data for accessibility scanning tool's purposes.
+     * The key requests that a {@link AccessibilityNodeInfo.ExtraRenderingInfo} be added to this
+     * info. This request is made with {@link #refreshWithExtraData(String, Bundle)} without
+     * argument.
+     * <p>
+     * The data can be retrieved from the {@link ExtraRenderingInfo} returned by
+     * {@link #getExtraRenderingInfo()} using {@link ExtraRenderingInfo#getLayoutParams},
+     * {@link ExtraRenderingInfo#getTextSizeInPx()} and
+     * {@link ExtraRenderingInfo#getTextSizeUnit()}. For layout params, it is supported by both
+     * {@link TextView} and {@link ViewGroup}. For text size and unit, it is only supported by
+     * {@link TextView}.
+     *
+     * @see #refreshWithExtraData(String, Bundle)
+     */
+
+    public static final String EXTRA_DATA_RENDERING_INFO_KEY =
+            "android.view.accessibility.extra.DATA_RENDERING_INFO_KEY";
+
     /** @hide */
     public static final String EXTRA_DATA_REQUESTED_KEY =
             "android.view.accessibility.AccessibilityNodeInfo.extra_data_requested";
@@ -804,6 +827,8 @@
 
     private TouchDelegateInfo mTouchDelegateInfo;
 
+    private ExtraRenderingInfo mExtraRenderingInfo;
+
     private IBinder mLeashedChild;
     private IBinder mLeashedParent;
     private long mLeashedParentNodeId = UNDEFINED_NODE_ID;
@@ -991,6 +1016,7 @@
      * @param extraDataKey The extra data requested. Data that must be requested
      *                     with this mechanism is generally expensive to retrieve, so should only be
      *                     requested when needed. See
+     *                     {@link #EXTRA_DATA_RENDERING_INFO_KEY},
      *                     {@link #EXTRA_DATA_TEXT_CHARACTER_LOCATION_KEY} and
      *                     {@link #getAvailableExtraData()}.
      * @param args A bundle of arguments for the request. These depend on the particular request.
@@ -1547,6 +1573,7 @@
      * {@link #refreshWithExtraData(String, Bundle)}.
      *
      * @return An unmodifiable list of keys corresponding to extra data that can be requested.
+     * @see #EXTRA_DATA_RENDERING_INFO_KEY
      * @see #EXTRA_DATA_TEXT_CHARACTER_LOCATION_KEY
      */
     public List<String> getAvailableExtraData() {
@@ -2375,6 +2402,32 @@
     }
 
     /**
+     * Gets the conformance info if the node is meant to be refreshed with extra data.
+     *
+     * @return The conformance info.
+     */
+    @Nullable
+    public ExtraRenderingInfo getExtraRenderingInfo() {
+        return mExtraRenderingInfo;
+    }
+
+    /**
+     * Sets the conformance info if the node is meant to be refreshed with extra data.
+     * <p>
+     *   <strong>Note:</strong> Cannot be called from an
+     *   {@link android.accessibilityservice.AccessibilityService}.
+     *   This class is made immutable before being delivered to an AccessibilityService.
+     * </p>
+     *
+     * @param extraRenderingInfo The conformance info.
+     * @hide
+     */
+    public void setExtraRenderingInfo(@NonNull ExtraRenderingInfo extraRenderingInfo) {
+        enforceNotSealed();
+        mExtraRenderingInfo = extraRenderingInfo;
+    }
+
+    /**
      * Gets if the content of this node is invalid. For example,
      * a date is not well-formed.
      *
@@ -3695,6 +3748,10 @@
             nonDefaultFields |= bitAt(fieldIndex);
         }
         fieldIndex++;
+        if (!Objects.equals(mExtraRenderingInfo, DEFAULT.mExtraRenderingInfo)) {
+            nonDefaultFields |= bitAt(fieldIndex);
+        }
+        fieldIndex++;
         if (mLeashedChild != DEFAULT.mLeashedChild) {
             nonDefaultFields |= bitAt(fieldIndex);
         }
@@ -3833,6 +3890,12 @@
         }
 
         if (isBitSet(nonDefaultFields, fieldIndex++)) {
+            parcel.writeValue(mExtraRenderingInfo.getLayoutParams());
+            parcel.writeFloat(mExtraRenderingInfo.getTextSizeInPx());
+            parcel.writeInt(mExtraRenderingInfo.getTextSizeUnit());
+        }
+
+        if (isBitSet(nonDefaultFields, fieldIndex++)) {
             parcel.writeStrongBinder(mLeashedChild);
         }
         if (isBitSet(nonDefaultFields, fieldIndex++)) {
@@ -3941,6 +4004,9 @@
         if (mCollectionItemInfo != null) mCollectionItemInfo.recycle();
         mCollectionItemInfo =  (other.mCollectionItemInfo != null)
                 ? CollectionItemInfo.obtain(other.mCollectionItemInfo) : null;
+        if (mExtraRenderingInfo != null) mExtraRenderingInfo.recycle();
+        mExtraRenderingInfo = (other.mExtraRenderingInfo != null)
+                ? ExtraRenderingInfo.obtain(other.mExtraRenderingInfo) : null;
     }
 
     private void initCopyInfos(AccessibilityNodeInfo other) {
@@ -3955,6 +4021,9 @@
         mCollectionItemInfo = (cii == null)  ? null
                 : new CollectionItemInfo(cii.mRowIndex, cii.mRowSpan, cii.mColumnIndex,
                                          cii.mColumnSpan, cii.mHeading, cii.mSelected);
+        ExtraRenderingInfo ti = other.mExtraRenderingInfo;
+        mExtraRenderingInfo = (ti == null) ? null
+                : new ExtraRenderingInfo(ti);
     }
 
     /**
@@ -4083,6 +4152,14 @@
         }
 
         if (isBitSet(nonDefaultFields, fieldIndex++)) {
+            if (mExtraRenderingInfo != null) mExtraRenderingInfo.recycle();
+            mExtraRenderingInfo = ExtraRenderingInfo.obtain();
+            mExtraRenderingInfo.mLayoutParams = (Size) parcel.readValue(null);
+            mExtraRenderingInfo.mTextSizeInPx = parcel.readFloat();
+            mExtraRenderingInfo.mTextSizeUnit = parcel.readInt();
+        }
+
+        if (isBitSet(nonDefaultFields, fieldIndex++)) {
             mLeashedChild = parcel.readStrongBinder();
         }
         if (isBitSet(nonDefaultFields, fieldIndex++)) {
@@ -5679,6 +5756,134 @@
     }
 
     /**
+     * Class with information of a view useful to evaluate accessibility needs. Developers can
+     * refresh the node with the key {@link #EXTRA_DATA_RENDERING_INFO_KEY} to fetch the text size
+     * and unit if it is {@link TextView} and the height and the width of layout params from
+     * {@link ViewGroup} or {@link TextView}.
+     *
+     * @see #EXTRA_DATA_RENDERING_INFO_KEY
+     * @see #refreshWithExtraData(String, Bundle)
+     */
+    public static final class ExtraRenderingInfo {
+        private static final int UNDEFINED_VALUE = -1;
+        private static final int MAX_POOL_SIZE = 20;
+        private static final SynchronizedPool<ExtraRenderingInfo> sPool =
+                new SynchronizedPool<>(MAX_POOL_SIZE);
+
+        private Size mLayoutParams;
+        private float mTextSizeInPx = UNDEFINED_VALUE;
+        private int mTextSizeUnit = UNDEFINED_VALUE;
+
+        /**
+         * Obtains a pooled instance.
+         * @hide
+         */
+        @NonNull
+        public static ExtraRenderingInfo obtain() {
+            final ExtraRenderingInfo info = sPool.acquire();
+            if (info == null) {
+                return new ExtraRenderingInfo(null);
+            }
+            return info;
+        }
+
+        /** Obtains a pooled instance that is a clone of another one. */
+        private static ExtraRenderingInfo obtain(ExtraRenderingInfo other) {
+            ExtraRenderingInfo extraRenderingInfo = ExtraRenderingInfo.obtain();
+            extraRenderingInfo.mLayoutParams = other.mLayoutParams;
+            extraRenderingInfo.mTextSizeInPx = other.mTextSizeInPx;
+            extraRenderingInfo.mTextSizeUnit = other.mTextSizeUnit;
+            return extraRenderingInfo;
+        }
+
+        /**
+         * Creates a new conformance info of a view, and this new instance is initialized from
+         * the given <code>other</code>.
+         *
+         * @param other The instance to clone.
+         */
+        private ExtraRenderingInfo(@Nullable ExtraRenderingInfo other) {
+            if (other != null) {
+                mLayoutParams = other.mLayoutParams;
+                mTextSizeInPx = other.mTextSizeInPx;
+                mTextSizeUnit = other.mTextSizeUnit;
+            }
+        }
+
+        /**
+         * @return a {@link Size} stores layout height and layout width of the view,
+         *         or null otherwise.
+         */
+        public @Nullable Size getLayoutParams() {
+            return mLayoutParams;
+        }
+
+        /**
+         * Sets layout width and layout height of the view.
+         *
+         * @param width The layout width.
+         * @param height The layout height.
+         * @hide
+         */
+        public void setLayoutParams(int width, int height) {
+            mLayoutParams = new Size(width, height);
+        }
+
+        /**
+         * @return the text size of a {@code TextView}, or -1 otherwise.
+         */
+        public float getTextSizeInPx() {
+            return mTextSizeInPx;
+        }
+
+        /**
+         * Sets text size of the view.
+         *
+         * @param textSizeInPx The text size in pixels.
+         * @hide
+         */
+        public void setTextSizeInPx(float textSizeInPx) {
+            mTextSizeInPx = textSizeInPx;
+        }
+
+        /**
+         * @return the text size unit which type is {@link TypedValue#TYPE_DIMENSION} of a
+         *         {@code TextView}, or -1 otherwise.
+         *
+         * @see TypedValue#TYPE_DIMENSION
+         */
+        public int getTextSizeUnit() {
+            return mTextSizeUnit;
+        }
+
+        /**
+         * Sets text size unit of the view.
+         *
+         * @param textSizeUnit The text size unit.
+         * @hide
+         */
+        public void setTextSizeUnit(int textSizeUnit) {
+            mTextSizeUnit = textSizeUnit;
+        }
+
+        /**
+         * Recycles this instance.
+         *
+         * <p>In most situations object pooling is not beneficial, and recycling is not necessary.
+         */
+        void recycle() {
+            clear();
+            sPool.release(this);
+        }
+
+        private void clear() {
+            mLayoutParams = null;
+            mTextSizeInPx = UNDEFINED_VALUE;
+            mTextSizeUnit = UNDEFINED_VALUE;
+        }
+    }
+
+    /**
      * @see android.os.Parcelable.Creator
      */
     public static final @android.annotation.NonNull Parcelable.Creator<AccessibilityNodeInfo> CREATOR =
diff --git a/core/java/android/view/autofill/AutofillManager.java b/core/java/android/view/autofill/AutofillManager.java
index 54bdb88..ce7cfa7 100644
--- a/core/java/android/view/autofill/AutofillManager.java
+++ b/core/java/android/view/autofill/AutofillManager.java
@@ -1794,6 +1794,9 @@
             client.autofillClientResetableStateAvailable();
         } catch (RemoteException e) {
             throw e.rethrowFromSystemServer();
+        } catch (SyncResultReceiver.TimeoutException e) {
+            // no-op, just log the error message.
+            Log.w(TAG, "Exception getting result from SyncResultReceiver: " + e);
         }
     }
 
diff --git a/core/java/android/widget/Editor.java b/core/java/android/widget/Editor.java
index 12f245e..9de1222 100644
--- a/core/java/android/widget/Editor.java
+++ b/core/java/android/widget/Editor.java
@@ -6012,7 +6012,13 @@
     @VisibleForTesting
     public class InsertionPointCursorController implements CursorController {
         private InsertionHandleView mHandle;
+        // Tracks whether the cursor is currently being dragged.
         private boolean mIsDraggingCursor;
+        // During a drag, tracks whether the user's finger has adjusted to be over the handle rather
+        // than the cursor bar.
+        private boolean mIsTouchSnappedToHandleDuringDrag;
+        // During a drag, tracks the line of text where the cursor was last positioned.
+        private int mPrevLineDuringDrag;
 
         public void onTouchEvent(MotionEvent event) {
             if (hasSelectionController() && getSelectionController().isCursorBeingModified()) {
@@ -6043,8 +6049,8 @@
         }
 
         private void positionCursorDuringDrag(MotionEvent event) {
-            int line = mTextView.getLineAtCoordinate(event.getY());
-            int offset = mTextView.getOffsetAtCoordinate(line, event.getX());
+            mPrevLineDuringDrag = getLineDuringDrag(event);
+            int offset = mTextView.getOffsetAtCoordinate(mPrevLineDuringDrag, event.getX());
             int oldSelectionStart = mTextView.getSelectionStart();
             int oldSelectionEnd = mTextView.getSelectionEnd();
             if (offset == oldSelectionStart && offset == oldSelectionEnd) {
@@ -6057,11 +6063,58 @@
             }
         }
 
+        /**
+         * Returns the line where the cursor should be positioned during a cursor drag. Rather than
+         * simply returning the line directly at the touch position, this function has the following
+         * additional logic:
+         * 1) Apply some slop to avoid switching lines if the touch moves just slightly off the
+         * current line.
+         * 2) Allow the user's finger to slide down and "snap" to the handle to provide better
+         * visibility of the cursor and text.
+         */
+        private int getLineDuringDrag(MotionEvent event) {
+            final Layout layout = mTextView.getLayout();
+            if (mTouchState.isOnHandle()) {
+                // The drag was initiated from the handle, so no need to apply the snap logic. See
+                // InsertionHandleView.touchThrough().
+                return getCurrentLineAdjustedForSlop(layout, mPrevLineDuringDrag, event.getY());
+            }
+            if (mIsTouchSnappedToHandleDuringDrag) {
+                float cursorY = event.getY() - getHandle().getIdealVerticalOffset();
+                return getCurrentLineAdjustedForSlop(layout, mPrevLineDuringDrag, cursorY);
+            }
+            int line = getCurrentLineAdjustedForSlop(layout, mPrevLineDuringDrag, event.getY());
+            if (mPrevLineDuringDrag == UNSET_LINE || line <= mPrevLineDuringDrag) {
+                // User's finger is on the same line or moving up; continue positioning the cursor
+                // directly at the touch location.
+                return line;
+            }
+            // User's finger is moving downwards; delay jumping to the lower line to allow the
+            // touch to move to the handle.
+            float cursorY = event.getY() - getHandle().getIdealVerticalOffset();
+            line = getCurrentLineAdjustedForSlop(layout, mPrevLineDuringDrag, cursorY);
+            if (line < mPrevLineDuringDrag) {
+                return mPrevLineDuringDrag;
+            }
+            // User's finger is now over the handle, at the ideal offset from the cursor. From now
+            // on, position the cursor higher up from the actual touch location so that the user's
+            // finger stays "snapped" to the handle. This provides better visibility of the text.
+            mIsTouchSnappedToHandleDuringDrag = true;
+            if (TextView.DEBUG_CURSOR) {
+                logCursor("InsertionPointCursorController",
+                        "snapped touch to handle: eventY=%d, cursorY=%d, mLastLine=%d, line=%d",
+                        (int) event.getY(), (int) cursorY, mPrevLineDuringDrag, line);
+            }
+            return line;
+        }
+
         private void startCursorDrag(MotionEvent event) {
             if (TextView.DEBUG_CURSOR) {
                 logCursor("InsertionPointCursorController", "start cursor drag");
             }
             mIsDraggingCursor = true;
+            mIsTouchSnappedToHandleDuringDrag = false;
+            mPrevLineDuringDrag = UNSET_LINE;
             // We don't want the parent scroll/long-press handlers to take over while dragging.
             mTextView.getParent().requestDisallowInterceptTouchEvent(true);
             mTextView.cancelLongPress();
@@ -6084,6 +6137,8 @@
                 logCursor("InsertionPointCursorController", "end cursor drag");
             }
             mIsDraggingCursor = false;
+            mIsTouchSnappedToHandleDuringDrag = false;
+            mPrevLineDuringDrag = UNSET_LINE;
             // Hide the magnifier and set the handle to be hidden after a delay.
             getHandle().dismissMagnifier();
             getHandle().hideAfterDelay();
diff --git a/core/java/android/widget/Magnifier.java b/core/java/android/widget/Magnifier.java
index a6a5ec5..47ea1cb 100644
--- a/core/java/android/widget/Magnifier.java
+++ b/core/java/android/widget/Magnifier.java
@@ -1257,7 +1257,8 @@
                             return;
                         }
                         // Show or move the window at the content draw frame.
-                        mTransaction.deferTransactionUntilSurface(mSurfaceControl, mSurface, frame);
+                        mTransaction.deferTransactionUntil(mSurfaceControl, mSurfaceControl,
+                                frame);
                         if (updateWindowPosition) {
                             mTransaction.setPosition(mSurfaceControl, pendingX, pendingY);
                         }
diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java
index 0182975..815cc5c 100644
--- a/core/java/android/widget/TextView.java
+++ b/core/java/android/widget/TextView.java
@@ -17,6 +17,7 @@
 package android.widget;
 
 import static android.Manifest.permission.INTERACT_ACROSS_USERS_FULL;
+import static android.view.accessibility.AccessibilityNodeInfo.EXTRA_DATA_RENDERING_INFO_KEY;
 import static android.view.accessibility.AccessibilityNodeInfo.EXTRA_DATA_TEXT_CHARACTER_LOCATION_ARG_LENGTH;
 import static android.view.accessibility.AccessibilityNodeInfo.EXTRA_DATA_TEXT_CHARACTER_LOCATION_ARG_START_INDEX;
 import static android.view.accessibility.AccessibilityNodeInfo.EXTRA_DATA_TEXT_CHARACTER_LOCATION_KEY;
@@ -727,6 +728,7 @@
     @UnsupportedAppUsage
     private Layout mLayout;
     private boolean mLocalesChanged = false;
+    private int mTextSizeUnit = -1;
 
     // True if setKeyListener() has been explicitly called
     private boolean mListenerChanged = false;
@@ -3842,6 +3844,7 @@
         ColorStateList mTextColorHint = null;
         ColorStateList mTextColorLink = null;
         int mTextSize = -1;
+        int mTextSizeUnit = -1;
         LocaleList mTextLocales = null;
         String mFontFamily = null;
         Typeface mFontTypeface = null;
@@ -3869,6 +3872,7 @@
                     + "    mTextColorHint:" + mTextColorHint + "\n"
                     + "    mTextColorLink:" + mTextColorLink + "\n"
                     + "    mTextSize:" + mTextSize + "\n"
+                    + "    mTextSizeUnit:" + mTextSizeUnit + "\n"
                     + "    mTextLocales:" + mTextLocales + "\n"
                     + "    mFontFamily:" + mFontFamily + "\n"
                     + "    mFontTypeface:" + mFontTypeface + "\n"
@@ -3980,6 +3984,7 @@
                 case com.android.internal.R.styleable.TextAppearance_textSize:
                     attributes.mTextSize =
                             appearance.getDimensionPixelSize(attr, attributes.mTextSize);
+                    attributes.mTextSizeUnit = appearance.peekValue(attr).getComplexUnit();
                     break;
                 case com.android.internal.R.styleable.TextAppearance_textLocale:
                     final String localeString = appearance.getString(attr);
@@ -4073,6 +4078,7 @@
         }
 
         if (attributes.mTextSize != -1) {
+            mTextSizeUnit = attributes.mTextSizeUnit;
             setRawTextSize(attributes.mTextSize, true /* shouldRequestLayout */);
         }
 
@@ -4295,6 +4301,7 @@
             r = c.getResources();
         }
 
+        mTextSizeUnit = unit;
         setRawTextSize(TypedValue.applyDimension(unit, size, r.getDisplayMetrics()),
                 shouldRequestLayout);
     }
@@ -4315,6 +4322,17 @@
     }
 
     /**
+     * Gets the text size unit defined by the developer. It may be specified in resources or be
+     * passed as the unit argument of {@link #setTextSize(int, float)} at runtime.
+     *
+     * @return the dimension type of the text size unit originally defined.
+     * @see TypedValue#TYPE_DIMENSION
+     */
+    public int getTextSizeUnit() {
+        return mTextSizeUnit;
+    }
+
+    /**
      * Gets the extent by which text should be stretched horizontally.
      * This will usually be 1.0.
      * @return The horizontal scale factor.
@@ -11769,8 +11787,14 @@
                     | AccessibilityNodeInfo.MOVEMENT_GRANULARITY_PARAGRAPH
                     | AccessibilityNodeInfo.MOVEMENT_GRANULARITY_PAGE);
             info.addAction(AccessibilityNodeInfo.ACTION_SET_SELECTION);
-            info.setAvailableExtraData(
-                    Arrays.asList(EXTRA_DATA_TEXT_CHARACTER_LOCATION_KEY));
+            info.setAvailableExtraData(Arrays.asList(
+                    EXTRA_DATA_RENDERING_INFO_KEY,
+                    EXTRA_DATA_TEXT_CHARACTER_LOCATION_KEY
+            ));
+        } else {
+            info.setAvailableExtraData(Arrays.asList(
+                    EXTRA_DATA_RENDERING_INFO_KEY
+            ));
         }
 
         if (isFocused()) {
@@ -11824,11 +11848,7 @@
     @Override
     public void addExtraDataToAccessibilityNodeInfo(
             AccessibilityNodeInfo info, String extraDataKey, Bundle arguments) {
-        // The only extra data we support requires arguments.
-        if (arguments == null) {
-            return;
-        }
-        if (extraDataKey.equals(EXTRA_DATA_TEXT_CHARACTER_LOCATION_KEY)) {
+        if (arguments != null && extraDataKey.equals(EXTRA_DATA_TEXT_CHARACTER_LOCATION_KEY)) {
             int positionInfoStartIndex = arguments.getInt(
                     EXTRA_DATA_TEXT_CHARACTER_LOCATION_ARG_START_INDEX, -1);
             int positionInfoLength = arguments.getInt(
@@ -11856,6 +11876,15 @@
                 }
             }
             info.getExtras().putParcelableArray(extraDataKey, boundingRects);
+            return;
+        }
+        if (extraDataKey.equals(AccessibilityNodeInfo.EXTRA_DATA_RENDERING_INFO_KEY)) {
+            final AccessibilityNodeInfo.ExtraRenderingInfo extraRenderingInfo =
+                    AccessibilityNodeInfo.ExtraRenderingInfo.obtain();
+            extraRenderingInfo.setLayoutParams(getLayoutParams().width, getLayoutParams().height);
+            extraRenderingInfo.setTextSizeInPx(getTextSize());
+            extraRenderingInfo.setTextSizeUnit(getTextSizeUnit());
+            info.setExtraRenderingInfo(extraRenderingInfo);
         }
     }
 
diff --git a/core/java/com/android/internal/app/AbstractMultiProfilePagerAdapter.java b/core/java/com/android/internal/app/AbstractMultiProfilePagerAdapter.java
index e8f84aa..b4a0208 100644
--- a/core/java/com/android/internal/app/AbstractMultiProfilePagerAdapter.java
+++ b/core/java/com/android/internal/app/AbstractMultiProfilePagerAdapter.java
@@ -20,6 +20,7 @@
 import android.annotation.Nullable;
 import android.annotation.StringRes;
 import android.app.AppGlobals;
+import android.app.admin.DevicePolicyEventLogger;
 import android.content.ContentResolver;
 import android.content.Context;
 import android.content.Intent;
@@ -27,6 +28,7 @@
 import android.content.pm.ResolveInfo;
 import android.os.UserHandle;
 import android.os.UserManager;
+import android.stats.devicepolicy.DevicePolicyEnums;
 import android.view.View;
 import android.view.ViewGroup;
 import android.widget.Button;
@@ -251,6 +253,8 @@
 
     abstract @Nullable ViewGroup getInactiveAdapterView();
 
+    abstract String getMetricsCategory();
+
     /**
      * Rebuilds the tab that is currently visible to the user.
      * <p>Returns {@code true} if rebuild has completed.
@@ -282,6 +286,10 @@
         UserHandle listUserHandle = activeListAdapter.getUserHandle();
         if (listUserHandle == mWorkProfileUserHandle
                 && mInjector.isQuietModeEnabled(mWorkProfileUserHandle)) {
+            DevicePolicyEventLogger
+                    .createEvent(DevicePolicyEnums.RESOLVER_EMPTY_STATE_WORK_APPS_DISABLED)
+                    .setStrings(getMetricsCategory())
+                    .write();
             showEmptyState(activeListAdapter,
                     R.drawable.ic_work_apps_off,
                     R.string.resolver_turn_on_work_apps,
@@ -294,11 +302,19 @@
             if (!mInjector.hasCrossProfileIntents(activeListAdapter.getIntents(),
                     UserHandle.myUserId(), listUserHandle.getIdentifier())) {
                 if (listUserHandle == mPersonalProfileUserHandle) {
+                    DevicePolicyEventLogger.createEvent(
+                                DevicePolicyEnums.RESOLVER_EMPTY_STATE_NO_SHARING_TO_PERSONAL)
+                            .setStrings(getMetricsCategory())
+                            .write();
                     showEmptyState(activeListAdapter,
                             R.drawable.ic_sharing_disabled,
                             R.string.resolver_cant_share_with_personal_apps,
                             R.string.resolver_cant_share_cross_profile_explanation);
                 } else {
+                    DevicePolicyEventLogger.createEvent(
+                            DevicePolicyEnums.RESOLVER_EMPTY_STATE_NO_SHARING_TO_WORK)
+                            .setStrings(getMetricsCategory())
+                            .write();
                     showEmptyState(activeListAdapter,
                             R.drawable.ic_sharing_disabled,
                             R.string.resolver_cant_share_with_work_apps,
@@ -315,6 +331,12 @@
         UserHandle listUserHandle = listAdapter.getUserHandle();
         if (UserHandle.myUserId() == listUserHandle.getIdentifier()
                 || !hasAppsInOtherProfile(listAdapter)) {
+            if (mWorkProfileUserHandle != null) {
+                DevicePolicyEventLogger.createEvent(
+                        DevicePolicyEnums.RESOLVER_EMPTY_STATE_NO_APPS_RESOLVED)
+                        .setStrings(getMetricsCategory())
+                        .write();
+            }
             showEmptyState(listAdapter,
                     R.drawable.ic_no_apps,
                     R.string.resolver_no_apps_available,
diff --git a/core/java/com/android/internal/app/ChooserActivity.java b/core/java/com/android/internal/app/ChooserActivity.java
index dc801a9..a201a33 100644
--- a/core/java/com/android/internal/app/ChooserActivity.java
+++ b/core/java/com/android/internal/app/ChooserActivity.java
@@ -373,7 +373,7 @@
                 Log.i(TAG, "Hiding image preview area. Timed out waiting for preview to load"
                         + " within " + mImageLoadTimeoutMillis + "ms.");
                 collapseParentView();
-                if (hasWorkProfile() && ENABLE_TABBED_VIEW) {
+                if (shouldShowTabs()) {
                     hideStickyContentPreview();
                 } else if (mChooserMultiProfilePagerAdapter.getCurrentRootAdapter() != null) {
                     mChooserMultiProfilePagerAdapter.getCurrentRootAdapter().hideContentPreview();
@@ -773,7 +773,7 @@
             Intent[] initialIntents,
             List<ResolveInfo> rList,
             boolean filterLastUsed) {
-        if (hasWorkProfile() && ENABLE_TABBED_VIEW) {
+        if (shouldShowTabs()) {
             mChooserMultiProfilePagerAdapter = createChooserMultiProfilePagerAdapterForTwoProfiles(
                     initialIntents, rList, filterLastUsed);
         } else {
@@ -2434,7 +2434,7 @@
                     offset += findViewById(R.id.content_preview_container).getHeight();
                 }
 
-                if (hasWorkProfile() && ENABLE_TABBED_VIEW) {
+                if (shouldShowTabs()) {
                     offset += findViewById(R.id.tabs).getHeight();
                 }
 
@@ -2562,7 +2562,7 @@
     }
 
     private void setupScrollListener() {
-        if (mResolverDrawerLayout == null || (hasWorkProfile() && ENABLE_TABBED_VIEW)) {
+        if (mResolverDrawerLayout == null || shouldShowTabs()) {
             return;
         }
         final View chooserHeader = mResolverDrawerLayout.findViewById(R.id.chooser_header);
@@ -2613,8 +2613,7 @@
      * we instead show the content preview as a regular list item.
      */
     private boolean shouldShowStickyContentPreview() {
-        return hasWorkProfile()
-                && ENABLE_TABBED_VIEW
+        return shouldShowTabs()
                 && mMultiProfilePagerAdapter.getListAdapterForUserHandle(
                         UserHandle.of(UserHandle.myUserId())).getCount() > 0
                 && isSendAction(getTargetIntent())
@@ -2699,6 +2698,11 @@
     @Override
     protected void resetButtonBar() {}
 
+    @Override
+    protected String getMetricsCategory() {
+        return METRICS_CATEGORY_CHOOSER;
+    }
+
     /**
      * Adapter for all types of items and targets in ShareSheet.
      * Note that ranked sections like Direct Share - while appearing grid-like - are handled on the
@@ -2824,7 +2828,7 @@
         public int getContentPreviewRowCount() {
             // For the tabbed case we show the sticky content preview above the tabs,
             // please refer to shouldShowStickyContentPreview
-            if (hasWorkProfile() && ENABLE_TABBED_VIEW) {
+            if (shouldShowTabs()) {
                 return 0;
             }
             if (!isSendAction(getTargetIntent())) {
@@ -2840,7 +2844,7 @@
         }
 
         public int getProfileRowCount() {
-            if (hasWorkProfile() && ENABLE_TABBED_VIEW) {
+            if (shouldShowTabs()) {
                 return 0;
             }
             return mChooserListAdapter.getOtherProfile() == null ? 0 : 1;
@@ -3096,7 +3100,7 @@
             final ViewGroup viewGroup = (ViewGroup) holder.itemView;
             int start = getListPosition(position);
             int startType = getRowType(start);
-            if (viewGroup.getForeground() == null) {
+            if (viewGroup.getForeground() == null && position > 0) {
                 viewGroup.setForeground(
                         getResources().getDrawable(R.drawable.chooser_row_layer_list, null));
             }
diff --git a/core/java/com/android/internal/app/ChooserMultiProfilePagerAdapter.java b/core/java/com/android/internal/app/ChooserMultiProfilePagerAdapter.java
index e350142..d440402 100644
--- a/core/java/com/android/internal/app/ChooserMultiProfilePagerAdapter.java
+++ b/core/java/com/android/internal/app/ChooserMultiProfilePagerAdapter.java
@@ -165,6 +165,11 @@
         return getListViewForIndex(1 - getCurrentPage());
     }
 
+    @Override
+    String getMetricsCategory() {
+        return ResolverActivity.METRICS_CATEGORY_CHOOSER;
+    }
+
     class ChooserProfileDescriptor extends ProfileDescriptor {
         private ChooserActivity.ChooserGridAdapter chooserGridAdapter;
         private RecyclerView recyclerView;
diff --git a/core/java/com/android/internal/app/ResolverActivity.java b/core/java/com/android/internal/app/ResolverActivity.java
index 5dc8b0b..96bfe73 100644
--- a/core/java/com/android/internal/app/ResolverActivity.java
+++ b/core/java/com/android/internal/app/ResolverActivity.java
@@ -33,6 +33,7 @@
 import android.app.VoiceInteractor.PickOptionRequest;
 import android.app.VoiceInteractor.PickOptionRequest.Option;
 import android.app.VoiceInteractor.Prompt;
+import android.app.admin.DevicePolicyEventLogger;
 import android.compat.annotation.UnsupportedAppUsage;
 import android.content.BroadcastReceiver;
 import android.content.ComponentName;
@@ -60,6 +61,7 @@
 import android.os.UserManager;
 import android.provider.MediaStore;
 import android.provider.Settings;
+import android.stats.devicepolicy.DevicePolicyEnums;
 import android.text.TextUtils;
 import android.util.Log;
 import android.util.Slog;
@@ -84,6 +86,7 @@
 import com.android.internal.R;
 import com.android.internal.annotations.VisibleForTesting;
 import com.android.internal.app.AbstractMultiProfilePagerAdapter.Profile;
+import com.android.internal.app.chooser.ChooserTargetInfo;
 import com.android.internal.app.chooser.DisplayResolveInfo;
 import com.android.internal.app.chooser.TargetInfo;
 import com.android.internal.content.PackageMonitor;
@@ -99,6 +102,7 @@
 import java.util.Objects;
 import java.util.Set;
 
+
 /**
  * This activity is displayed when the system attempts to start an Intent for
  * which there is more than one matching activity, allowing the user to decide
@@ -152,6 +156,8 @@
     private static final String EXTRA_SHOW_FRAGMENT_ARGS = ":settings:show_fragment_args";
     private static final String EXTRA_FRAGMENT_ARG_KEY = ":settings:fragment_args_key";
     private static final String OPEN_LINKS_COMPONENT_KEY = "app_link_state";
+    protected static final String METRICS_CATEGORY_RESOLVER = "intent_resolver";
+    protected static final String METRICS_CATEGORY_CHOOSER = "intent_chooser";
 
     /**
      * TODO(arangelov): Remove a couple of weeks after work/personal tabs are finalized.
@@ -362,7 +368,7 @@
                 mMultiProfilePagerAdapter.getPersonalListAdapter());
         mPersonalPackageMonitor.register(
                 this, getMainLooper(), getPersonalProfileUserHandle(), false);
-        if (hasWorkProfile() && ENABLE_TABBED_VIEW) {
+        if (shouldShowTabs()) {
             mWorkPackageMonitor = createPackageMonitor(
                     mMultiProfilePagerAdapter.getWorkListAdapter());
             mWorkPackageMonitor.register(this, getMainLooper(), getWorkProfileUserHandle(), false);
@@ -390,7 +396,7 @@
                     | View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
             rdl.setOnApplyWindowInsetsListener(this::onApplyWindowInsets);
 
-            if (hasWorkProfile() && ENABLE_TABBED_VIEW) {
+            if (shouldShowTabs()) {
                 rdl.setMaxCollapsedHeight(getResources().getDimensionPixelSize(
                         R.dimen.resolver_empty_state_height_with_tabs));
                 findViewById(R.id.profile_pager).setMinimumHeight(
@@ -419,7 +425,7 @@
             List<ResolveInfo> rList,
             boolean filterLastUsed) {
         AbstractMultiProfilePagerAdapter resolverMultiProfilePagerAdapter = null;
-        if (hasWorkProfile() && ENABLE_TABBED_VIEW) {
+        if (shouldShowTabs()) {
             resolverMultiProfilePagerAdapter =
                     createResolverMultiProfilePagerAdapterForTwoProfiles(
                             initialIntents, rList, filterLastUsed);
@@ -500,10 +506,14 @@
         return null;
     }
 
-    protected boolean hasWorkProfile() {
+    private boolean hasWorkProfile() {
         return getWorkProfileUserHandle() != null;
     }
 
+    protected boolean shouldShowTabs() {
+        return hasWorkProfile() && ENABLE_TABBED_VIEW;
+    }
+
     protected void onProfileClick(View v) {
         final DisplayResolveInfo dri =
                 mMultiProfilePagerAdapter.getActiveListAdapter().getOtherProfile();
@@ -728,7 +738,7 @@
         if (!mRegistered) {
             mPersonalPackageMonitor.register(this, getMainLooper(),
                     getPersonalProfileUserHandle(), false);
-            if (hasWorkProfile() && ENABLE_TABBED_VIEW) {
+            if (shouldShowTabs()) {
                 if (mWorkPackageMonitor == null) {
                     mWorkPackageMonitor = createPackageMonitor(
                             mMultiProfilePagerAdapter.getWorkListAdapter());
@@ -745,7 +755,7 @@
     @Override
     protected void onStart() {
         super.onStart();
-        if (hasWorkProfile() && ENABLE_TABBED_VIEW) {
+        if (shouldShowTabs()) {
             mWorkProfileStateReceiver = createWorkProfileStateReceiver();
             registerWorkProfileStateReceiver();
         }
@@ -1197,12 +1207,14 @@
         if (!mSafeForwardingMode) {
             if (cti.startAsUser(this, null, currentUserHandle)) {
                 onActivityStarted(cti);
+                maybeLogCrossProfileTargetLaunch(cti, currentUserHandle);
             }
             return;
         }
         try {
             if (cti.startAsCaller(this, null, currentUserHandle.getIdentifier())) {
                 onActivityStarted(cti);
+                maybeLogCrossProfileTargetLaunch(cti, currentUserHandle);
             }
         } catch (RuntimeException e) {
             String launchedFromPackage;
@@ -1218,6 +1230,18 @@
         }
     }
 
+    private void maybeLogCrossProfileTargetLaunch(TargetInfo cti, UserHandle currentUserHandle) {
+        if (!hasWorkProfile() || currentUserHandle == getUser()) {
+            return;
+        }
+        DevicePolicyEventLogger
+                .createEvent(DevicePolicyEnums.RESOLVER_CROSS_PROFILE_TARGET_OPENED)
+                .setBoolean(currentUserHandle == getPersonalProfileUserHandle())
+                .setStrings(getMetricsCategory(),
+                        cti instanceof ChooserTargetInfo ? "direct_share" : "other_target")
+                .write();
+    }
+
 
     public boolean startAsCallerImpl(Intent intent, Bundle options, boolean ignoreTargetSecurity,
             int userId) {
@@ -1304,8 +1328,11 @@
                     + "cannot be null.");
         }
         // We partially rebuild the inactive adapter to determine if we should auto launch
-        boolean rebuildActiveCompleted = mMultiProfilePagerAdapter.rebuildActiveTab(true);
-        boolean rebuildInactiveCompleted = mMultiProfilePagerAdapter.rebuildInactiveTab(false);
+        boolean rebuildCompleted = mMultiProfilePagerAdapter.rebuildActiveTab(true);
+        if (hasWorkProfile() && ENABLE_TABBED_VIEW) {
+            boolean rebuildInactiveCompleted = mMultiProfilePagerAdapter.rebuildInactiveTab(false);
+            rebuildCompleted = rebuildCompleted && rebuildInactiveCompleted;
+        }
 
         if (useLayoutWithDefault()) {
             mLayoutId = R.layout.resolver_list_with_default;
@@ -1314,7 +1341,7 @@
         }
         setContentView(mLayoutId);
         mMultiProfilePagerAdapter.setupViewPager(findViewById(R.id.profile_pager));
-        return postRebuildList(rebuildActiveCompleted && rebuildInactiveCompleted);
+        return postRebuildList(rebuildCompleted);
     }
 
     /**
@@ -1343,7 +1370,7 @@
 
         setupViewVisibilities();
 
-        if (hasWorkProfile() && ENABLE_TABBED_VIEW) {
+        if (shouldShowTabs()) {
             setupProfileTabs();
         }
 
@@ -1378,6 +1405,10 @@
             return false;
         }
 
+        if (mMultiProfilePagerAdapter.getActiveListAdapter().getOtherProfile() != null) {
+            return false;
+        }
+
         // Only one target, so we're a candidate to auto-launch!
         final TargetInfo target = mMultiProfilePagerAdapter.getActiveListAdapter()
                 .targetInfoForPosition(0, false);
@@ -1414,7 +1445,8 @@
      * - The target app has declared it supports cross-profile communication via manifest metadata
      */
     private boolean maybeAutolaunchIfCrossProfileSupported() {
-        int count = mMultiProfilePagerAdapter.getActiveListAdapter().getUnfilteredCount();
+        ResolverListAdapter activeListAdapter = mMultiProfilePagerAdapter.getActiveListAdapter();
+        int count = activeListAdapter.getUnfilteredCount();
         if (count != 1) {
             return false;
         }
@@ -1423,7 +1455,7 @@
         if (inactiveListAdapter.getUnfilteredCount() != 1) {
             return false;
         }
-        TargetInfo activeProfileTarget = mMultiProfilePagerAdapter.getActiveListAdapter()
+        TargetInfo activeProfileTarget = activeListAdapter
                 .targetInfoForPosition(0, false);
         TargetInfo inactiveProfileTarget = inactiveListAdapter.targetInfoForPosition(0, false);
         if (!Objects.equals(activeProfileTarget.getResolvedComponentName(),
@@ -1438,6 +1470,11 @@
             return false;
         }
 
+        DevicePolicyEventLogger
+                .createEvent(DevicePolicyEnums.RESOLVER_AUTOLAUNCH_CROSS_PROFILE_TARGET)
+                .setBoolean(activeListAdapter.getUserHandle() == getPersonalProfileUserHandle())
+                .setStrings(getMetricsCategory())
+                .write();
         safelyStartActivity(activeProfileTarget);
         finish();
         return true;
@@ -1519,11 +1556,17 @@
                 viewPager.setCurrentItem(1);
             }
             setupViewVisibilities();
+            DevicePolicyEventLogger
+                    .createEvent(DevicePolicyEnums.RESOLVER_SWITCH_TABS)
+                    .setInt(viewPager.getCurrentItem())
+                    .setStrings(getMetricsCategory())
+                    .write();
         });
 
         viewPager.setVisibility(View.VISIBLE);
         tabHost.setCurrentTab(mMultiProfilePagerAdapter.getCurrentPage());
         mMultiProfilePagerAdapter.setOnProfileSelectedListener(tabHost::setCurrentTab);
+        findViewById(R.id.resolver_tab_divider).setVisibility(View.VISIBLE);
     }
 
     private void resetTabsHeaderStyle(TabWidget tabWidget) {
@@ -1562,7 +1605,7 @@
             stub.setVisibility(View.VISIBLE);
             TextView textView = (TextView) LayoutInflater.from(this).inflate(
                     R.layout.resolver_different_item_header, null, false);
-            if (ENABLE_TABBED_VIEW) {
+            if (shouldShowTabs()) {
                 textView.setGravity(Gravity.CENTER);
             }
             stub.addView(textView);
@@ -1686,6 +1729,10 @@
                 && Objects.equals(lhs.activityInfo.packageName, rhs.activityInfo.packageName);
     }
 
+    protected String getMetricsCategory() {
+        return METRICS_CATEGORY_RESOLVER;
+    }
+
     @Override // ResolverListCommunicator
     public void onHandlePackagesChanged(ResolverListAdapter listAdapter) {
         if (listAdapter == mMultiProfilePagerAdapter.getActiveListAdapter()) {
diff --git a/core/java/com/android/internal/app/ResolverMultiProfilePagerAdapter.java b/core/java/com/android/internal/app/ResolverMultiProfilePagerAdapter.java
index 96dc83a..21e7fd9 100644
--- a/core/java/com/android/internal/app/ResolverMultiProfilePagerAdapter.java
+++ b/core/java/com/android/internal/app/ResolverMultiProfilePagerAdapter.java
@@ -150,6 +150,11 @@
         return getListViewForIndex(1 - getCurrentPage());
     }
 
+    @Override
+    String getMetricsCategory() {
+        return ResolverActivity.METRICS_CATEGORY_RESOLVER;
+    }
+
     class ResolverProfileDescriptor extends ProfileDescriptor {
         private ResolverListAdapter resolverListAdapter;
         final ListView listView;
diff --git a/core/java/com/android/internal/content/om/OverlayConfig.java b/core/java/com/android/internal/content/om/OverlayConfig.java
new file mode 100644
index 0000000..f699eb8
--- /dev/null
+++ b/core/java/com/android/internal/content/om/OverlayConfig.java
@@ -0,0 +1,413 @@
+/*
+ * 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.internal.content.om;
+
+import android.annotation.NonNull;
+import android.annotation.Nullable;
+import android.content.pm.PackagePartitions;
+import android.content.pm.parsing.AndroidPackage;
+import android.os.Build;
+import android.os.Process;
+import android.os.Trace;
+import android.util.ArrayMap;
+import android.util.Log;
+
+import com.android.internal.annotations.VisibleForTesting;
+import com.android.internal.content.om.OverlayConfigParser.OverlayPartition;
+import com.android.internal.content.om.OverlayConfigParser.ParsedConfiguration;
+import com.android.internal.content.om.OverlayScanner.ParsedOverlayInfo;
+import com.android.internal.util.Preconditions;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Comparator;
+import java.util.function.Consumer;
+import java.util.function.Supplier;
+
+/**
+ * Responsible for reading overlay configuration files and handling queries of overlay mutability,
+ * default-enabled state, and priority.
+ *
+ * @see OverlayConfigParser
+ */
+@VisibleForTesting(visibility = VisibleForTesting.Visibility.PACKAGE)
+public class OverlayConfig {
+    static final String TAG = "OverlayConfig";
+
+    // The default priority of an overlay that has not been configured. Overlays with default
+    // priority have a higher precedence than configured overlays.
+    @VisibleForTesting
+    public static final int DEFAULT_PRIORITY = Integer.MAX_VALUE;
+
+    @VisibleForTesting
+    public static final class Configuration {
+        @Nullable
+        public final ParsedConfiguration parsedConfig;
+
+        public final int configIndex;
+
+        public Configuration(@Nullable ParsedConfiguration parsedConfig, int configIndex) {
+            this.parsedConfig = parsedConfig;
+            this.configIndex = configIndex;
+        }
+    }
+
+    /**
+     * Interface for providing information on scanned packages.
+     * TODO(147840005): Remove this when android:isStatic and android:priority are fully deprecated
+     */
+    public interface AndroidPackageProvider {
+
+        /** Performs the given action for each package. */
+        void forEachPackage(Consumer<AndroidPackage> p);
+    }
+
+    private static final Comparator<ParsedConfiguration> sStaticOverlayComparator = (c1, c2) -> {
+        final ParsedOverlayInfo o1 = c1.parsedInfo;
+        final ParsedOverlayInfo o2 = c2.parsedInfo;
+        Preconditions.checkArgument(o1.isStatic && o2.isStatic,
+                "attempted to sort non-static overlay");
+
+        if (!o1.targetPackageName.equals(o2.targetPackageName)) {
+            return o1.targetPackageName.compareTo(o2.targetPackageName);
+        }
+
+        final int comparedPriority = o1.priority - o2.priority;
+        return comparedPriority == 0 ? o1.path.compareTo(o2.path) : comparedPriority;
+    };
+
+    // Map of overlay package name to configured overlay settings
+    private final ArrayMap<String, Configuration> mConfigurations = new ArrayMap<>();
+
+    // Singleton instance only assigned in system server
+    private static OverlayConfig sInstance;
+
+    @VisibleForTesting
+    public OverlayConfig(@Nullable File rootDirectory,
+            @Nullable Supplier<OverlayScanner> scannerFactory,
+            @Nullable AndroidPackageProvider packageProvider) {
+        Preconditions.checkArgument((scannerFactory == null) != (packageProvider == null),
+                "scannerFactory and packageProvider cannot be both null or both non-null");
+
+        final ArrayList<OverlayPartition> partitions;
+        if (rootDirectory == null) {
+            partitions = new ArrayList<>(
+                    PackagePartitions.getOrderedPartitions(OverlayPartition::new));
+        } else {
+            // Rebase the system partitions and settings file on the specified root directory.
+            partitions = new ArrayList<>(PackagePartitions.getOrderedPartitions(
+                    p -> new OverlayPartition(new File(rootDirectory, p.folder.getPath()), p)));
+        }
+
+        boolean foundConfigFile = false;
+        ArrayList<ParsedOverlayInfo> packageManagerOverlayInfos = null;
+
+        final ArrayList<ParsedConfiguration> overlays = new ArrayList<>();
+        for (int i = 0, n = partitions.size(); i < n; i++) {
+            final OverlayPartition partition = partitions.get(i);
+            final OverlayScanner scanner = (scannerFactory == null) ? null : scannerFactory.get();
+            final ArrayList<ParsedConfiguration> partitionOverlays =
+                    OverlayConfigParser.getConfigurations(partition, scanner);
+            if (partitionOverlays != null) {
+                foundConfigFile = true;
+                overlays.addAll(partitionOverlays);
+                continue;
+            }
+
+            // If the configuration file is not present, then use android:isStatic and
+            // android:priority to configure the overlays in the partition.
+            // TODO(147840005): Remove converting static overlays to immutable, default-enabled
+            //  overlays when android:siStatic and android:priority are fully deprecated.
+            final ArrayList<ParsedOverlayInfo> partitionOverlayInfos;
+            if (scannerFactory != null) {
+                partitionOverlayInfos = new ArrayList<>(scanner.getAllParsedInfos());
+            } else {
+                if (packageManagerOverlayInfos == null) {
+                    packageManagerOverlayInfos = getOverlayPackageInfos(packageProvider);
+                }
+
+                // Filter out overlays not present in the partition.
+                partitionOverlayInfos = new ArrayList<>(packageManagerOverlayInfos);
+                for (int j = partitionOverlayInfos.size() - 1; j >= 0; j--) {
+                    if (!partition.containsPath(partitionOverlayInfos.get(j).path.getPath())) {
+                        partitionOverlayInfos.remove(j);
+                    }
+                }
+            }
+
+            // Static overlays are configured as immutable, default-enabled overlays.
+            final ArrayList<ParsedConfiguration> partitionConfigs = new ArrayList<>();
+            for (int j = 0, m = partitionOverlayInfos.size(); j < m; j++) {
+                final ParsedOverlayInfo p = partitionOverlayInfos.get(j);
+                if (p.isStatic) {
+                    partitionConfigs.add(new ParsedConfiguration(p.packageName,
+                            true /* enabled */, false /* mutable */, partition.policy, p));
+                }
+            }
+
+            partitionConfigs.sort(sStaticOverlayComparator);
+            overlays.addAll(partitionConfigs);
+        }
+
+        if (!foundConfigFile) {
+            // If no overlay configuration files exist, disregard partition precedence and allow
+            // android:priority to reorder overlays across partition boundaries.
+            overlays.sort(sStaticOverlayComparator);
+        }
+
+        for (int i = 0, n = overlays.size(); i < n; i++) {
+            // Add the configurations to a map so definitions of an overlay in an earlier
+            // partition can be replaced by an overlay with the same package name in a later
+            // partition.
+            final ParsedConfiguration config = overlays.get(i);
+            mConfigurations.put(config.packageName, new Configuration(config, i));
+        }
+    }
+
+    /**
+     * Creates an instance of OverlayConfig for use in the zygote process.
+     * This instance will not include information of static overlays existing outside of a partition
+     * overlay directory.
+     */
+    @NonNull
+    public static OverlayConfig getZygoteInstance() {
+        if (Process.myUid() != Process.ROOT_UID) {
+            // Scan the overlays in the zygote process to generate configuration settings for
+            // overlays on the system image. Do not cache this instance so OverlayConfig will not
+            // be present in applications by default.
+            throw new IllegalStateException("Can only be invoked in the root process");
+        }
+
+        Trace.traceBegin(Trace.TRACE_TAG_RRO, "OverlayConfig#getZygoteInstance");
+        try {
+            return new OverlayConfig(null /* rootDirectory */, OverlayScanner::new,
+                    null /* packageProvider */);
+        } finally {
+            Trace.traceEnd(Trace.TRACE_TAG_RRO);
+        }
+    }
+
+    /**
+     * Initializes a singleton instance for use in the system process.
+     * Can only be called once. This instance is cached so future invocations of
+     * {@link #getSystemInstance()} will return the initialized instance.
+     */
+    @NonNull
+    public static OverlayConfig initializeSystemInstance(AndroidPackageProvider packageProvider) {
+        if (Process.myUid() != Process.SYSTEM_UID) {
+            throw new IllegalStateException("Can only be invoked in the system process");
+        }
+
+        Trace.traceBegin(Trace.TRACE_TAG_RRO, "OverlayConfig#initializeSystemInstance");
+        sInstance = new OverlayConfig(null, null, packageProvider);
+        Trace.traceEnd(Trace.TRACE_TAG_RRO);
+        return sInstance;
+    }
+
+    /**
+     * Retrieves the singleton instance initialized by
+     * {@link #initializeSystemInstance(AndroidPackageProvider)}.
+     */
+    @NonNull
+    public static OverlayConfig getSystemInstance() {
+        if (sInstance == null) {
+            throw new IllegalStateException("System instance not initialized");
+        }
+
+        return sInstance;
+    }
+
+    @VisibleForTesting
+    @Nullable
+    public Configuration getConfiguration(@NonNull String packageName) {
+        return mConfigurations.get(packageName);
+    }
+
+    /**
+     * Returns whether the overlay is enabled by default.
+     * Overlays that are not configured are disabled by default mutable.
+     */
+    public boolean isEnabled(String packageName) {
+        final Configuration config = mConfigurations.get(packageName);
+
+        // STOPSHIP(149499802): Enabling a mutable overlay currently has no effect. Either implement
+        // some behavior for default-enabled, mutable overlays or prevent parsing of the enabled
+        // attribute on overlays that are mutable.
+        if (config != null && config.parsedConfig.mutable) {
+            Log.w(TAG, "Default-enabled configuration for mutable overlay "
+                    + config.parsedConfig.packageName + " has no effect");
+            return OverlayConfigParser.DEFAULT_ENABLED_STATE;
+        }
+
+        return config == null? OverlayConfigParser.DEFAULT_ENABLED_STATE
+                : config.parsedConfig.enabled;
+    }
+
+    /**
+     * Returns whether the overlay is mutable and can have its enabled state changed dynamically.
+     * Overlays that are not configured are mutable.
+     */
+    public boolean isMutable(String packageName) {
+        final Configuration config = mConfigurations.get(packageName);
+        return config == null ? OverlayConfigParser.DEFAULT_MUTABILITY
+                : config.parsedConfig.mutable;
+    }
+
+    /**
+     * Returns an integer corresponding to the priority of the overlay.
+     * When multiple overlays override the same resource, the overlay with the highest priority will
+     * will have its value chosen. Overlays that are not configured have a priority of
+     * {@link Integer#MAX_VALUE}.
+     */
+    public int getPriority(String packageName) {
+        final Configuration config = mConfigurations.get(packageName);
+        return config == null ? DEFAULT_PRIORITY : config.configIndex;
+    }
+
+    @NonNull
+    private ArrayList<Configuration> getSortedOverlays() {
+        final ArrayList<Configuration> sortedOverlays = new ArrayList<>();
+        for (int i = 0, n = mConfigurations.size(); i < n; i++) {
+            sortedOverlays.add(mConfigurations.valueAt(i));
+        }
+        sortedOverlays.sort(Comparator.comparingInt(o -> o.configIndex));
+        return sortedOverlays;
+    }
+
+    @NonNull
+    private static ArrayList<ParsedOverlayInfo> getOverlayPackageInfos(
+            @NonNull AndroidPackageProvider packageManager) {
+        final ArrayList<ParsedOverlayInfo> overlays = new ArrayList<>();
+        packageManager.forEachPackage((AndroidPackage p) -> {
+            if (p.getOverlayTarget() != null && p.isSystem()) {
+                overlays.add(new ParsedOverlayInfo(p.getPackageName(), p.getOverlayTarget(),
+                        p.getTargetSdkVersion(), p.isOverlayIsStatic(), p.getOverlayPriority(),
+                        new File(p.getBaseCodePath())));
+            }
+        });
+        return overlays;
+    }
+
+    /** Represents a single call to idmap create-multiple. */
+    @VisibleForTesting
+    public static class IdmapInvocation {
+        public final boolean enforceOverlayable;
+        public final String policy;
+        public final ArrayList<String> overlayPaths = new ArrayList<>();
+
+        IdmapInvocation(boolean enforceOverlayable, @NonNull String policy) {
+            this.enforceOverlayable = enforceOverlayable;
+            this.policy = policy;
+        }
+
+        @Override
+        public String toString() {
+            return getClass().getSimpleName() + String.format("{enforceOverlayable=%s, policy=%s"
+                            + ", overlayPaths=[%s]}", enforceOverlayable, policy,
+                    String.join(", ", overlayPaths));
+        }
+    }
+
+    /**
+     * Retrieves a list of immutable framework overlays in order of least precedence to greatest
+     * precedence.
+     */
+    @VisibleForTesting
+    public ArrayList<IdmapInvocation> getImmutableFrameworkOverlayIdmapInvocations() {
+        final ArrayList<IdmapInvocation> idmapInvocations = new ArrayList<>();
+        final ArrayList<Configuration> sortedConfigs = getSortedOverlays();
+        for (int i = 0, n = sortedConfigs.size(); i < n; i++) {
+            final Configuration overlay = sortedConfigs.get(i);
+            if (overlay.parsedConfig.mutable || !overlay.parsedConfig.enabled
+                    || !"android".equals(overlay.parsedConfig.parsedInfo.targetPackageName)) {
+                continue;
+            }
+
+            // Only enforce that overlays targeting packages with overlayable declarations abide by
+            // those declarations if the target sdk of the overlay is at least Q (when overlayable
+            // was introduced).
+            final boolean enforceOverlayable = overlay.parsedConfig.parsedInfo.targetSdkVersion
+                    >= Build.VERSION_CODES.Q;
+
+            // Determine if the idmap for the current overlay can be generated in the last idmap
+            // create-multiple invocation.
+            IdmapInvocation invocation = null;
+            if (!idmapInvocations.isEmpty()) {
+                final IdmapInvocation last = idmapInvocations.get(idmapInvocations.size() - 1);
+                if (last.enforceOverlayable == enforceOverlayable
+                        && last.policy.equals(overlay.parsedConfig.policy)) {
+                    invocation = last;
+                }
+            }
+
+            if (invocation == null) {
+                invocation = new IdmapInvocation(enforceOverlayable, overlay.parsedConfig.policy);
+                idmapInvocations.add(invocation);
+            }
+
+            invocation.overlayPaths.add(overlay.parsedConfig.parsedInfo.path.getAbsolutePath());
+        }
+        return idmapInvocations;
+    }
+
+    /**
+     * Creates idmap files for immutable overlays targeting the framework packages. Currently the
+     * android package is the only preloaded system package. Only the zygote can invoke this method.
+     *
+     * @return the paths of the created idmap files
+     */
+    @NonNull
+    public String[] createImmutableFrameworkIdmapsInZygote() {
+        if (Process.myUid() != Process.ROOT_UID) {
+            throw new IllegalStateException("This method can only be called from the root process");
+        }
+
+        final String targetPath = "/system/framework/framework-res.apk";
+        final ArrayList<String> idmapPaths = new ArrayList<>();
+        final ArrayList<IdmapInvocation> idmapInvocations =
+                getImmutableFrameworkOverlayIdmapInvocations();
+
+        for (int i = 0, n = idmapInvocations.size(); i < n; i++) {
+            final IdmapInvocation invocation = idmapInvocations.get(i);
+            final String[] idmaps = createIdmap(targetPath,
+                    invocation.overlayPaths.toArray(new String[0]),
+                    new String[]{OverlayConfigParser.OverlayPartition.POLICY_PUBLIC,
+                            invocation.policy},
+                    invocation.enforceOverlayable);
+
+            if (idmaps == null) {
+                Log.w(TAG, "'idmap2 create-multiple' failed: no mutable=\"false\" overlays"
+                        + " targeting \"android\" will be loaded");
+                return new String[0];
+            }
+
+            idmapPaths.addAll(Arrays.asList(idmaps));
+        }
+
+        return idmapPaths.toArray(new String[0]);
+    }
+
+    /**
+     * For each overlay APK, this creates the idmap file that allows the overlay to override the
+     * target package.
+     *
+     * @return the paths of the created idmap
+     */
+    private static native String[] createIdmap(@NonNull String targetPath,
+            @NonNull String[] overlayPath, @NonNull String[] policies, boolean enforceOverlayable);
+}
diff --git a/core/java/com/android/internal/content/om/OverlayConfigParser.java b/core/java/com/android/internal/content/om/OverlayConfigParser.java
new file mode 100644
index 0000000..139607f
--- /dev/null
+++ b/core/java/com/android/internal/content/om/OverlayConfigParser.java
@@ -0,0 +1,391 @@
+/*
+ * 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.internal.content.om;
+
+import static com.android.internal.content.om.OverlayConfig.TAG;
+
+import android.annotation.NonNull;
+import android.annotation.Nullable;
+import android.content.pm.PackagePartitions;
+import android.content.pm.PackagePartitions.SystemPartition;
+import android.os.FileUtils;
+import android.util.ArraySet;
+import android.util.Log;
+import android.util.Xml;
+
+import com.android.internal.util.XmlUtils;
+import com.android.internal.content.om.OverlayScanner.ParsedOverlayInfo;
+
+import libcore.io.IoUtils;
+
+import org.xmlpull.v1.XmlPullParser;
+import org.xmlpull.v1.XmlPullParserException;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.io.IOException;
+import java.util.ArrayList;
+
+/**
+ * Responsible for parsing configurations of Runtime Resource Overlays that control mutability,
+ * default enable state, and priority. To configure an overlay, create or modify the file located
+ * at {@code partition}/overlay/config/config.xml where {@code partition} is the partition of the
+ * overlay to be configured. In order to be configured, an overlay must reside in the overlay
+ * directory of the partition in which the overlay is configured.
+ *
+ * @see #parseOverlay(File, XmlPullParser, OverlayScanner, ParsingContext)
+ * @see #parseMerge(File, XmlPullParser, OverlayScanner, ParsingContext)
+ **/
+final class OverlayConfigParser {
+
+    // Default values for overlay configurations.
+    static final boolean DEFAULT_ENABLED_STATE = false;
+    static final boolean DEFAULT_MUTABILITY = true;
+
+    // Maximum recursive depth of processing merge tags.
+    private static final int MAXIMUM_MERGE_DEPTH = 5;
+
+    // The subdirectory within a partition's overlay directory that contains the configuration files
+    // for the partition.
+    private static final String CONFIG_DIRECTORY = "config";
+
+    /**
+     * The name of the configuration file to parse for overlay configurations. This class does not
+     * scan for overlay configuration files within the {@link #CONFIG_DIRECTORY}; rather, other
+     * files can be included at a particular position within this file using the <merge> tag.
+     *
+     * @see #parseMerge(File, XmlPullParser, OverlayScanner, ParsingContext)
+     */
+    private static final String CONFIG_DEFAULT_FILENAME = CONFIG_DIRECTORY + "/config.xml";
+
+    /** Represents the configurations of a particular overlay. */
+    public static class ParsedConfiguration {
+        @NonNull
+        public final String packageName;
+
+        /** Whether or not the overlay is enabled by default. */
+        public final boolean enabled;
+
+        /**
+         * Whether or not the overlay is mutable and can have its enabled state changed dynamically
+         * using the {@code OverlayManagerService}.
+         **/
+        public final boolean mutable;
+
+        /** The policy granted to overlays on the partition in which the overlay is located. */
+        @NonNull
+        public final String policy;
+
+        /** Information extracted from the manifest of the overlay. */
+        @NonNull
+        public final ParsedOverlayInfo parsedInfo;
+
+        ParsedConfiguration(@NonNull String packageName, boolean enabled, boolean mutable,
+                @NonNull String policy, @NonNull ParsedOverlayInfo parsedInfo) {
+            this.packageName = packageName;
+            this.enabled = enabled;
+            this.mutable = mutable;
+            this.policy = policy;
+            this.parsedInfo = parsedInfo;
+        }
+
+        @Override
+        public String toString() {
+            return getClass().getSimpleName() + String.format("{packageName=%s, enabled=%s"
+                            + ", mutable=%s, policy=%s, parsedInfo=%s}", packageName, enabled,
+                    mutable, policy, parsedInfo);
+        }
+    }
+
+    static class OverlayPartition extends SystemPartition {
+        // Policies passed to idmap2 during idmap creation.
+        // Keep partition policy constants in sync with f/b/cmds/idmap2/include/idmap2/Policies.h.
+        static final String POLICY_ODM = "odm";
+        static final String POLICY_OEM = "oem";
+        static final String POLICY_PRODUCT = "product";
+        static final String POLICY_PUBLIC = "public";
+        static final String POLICY_SYSTEM = "system";
+        static final String POLICY_VENDOR = "vendor";
+
+        @NonNull
+        public final String policy;
+
+        OverlayPartition(@NonNull SystemPartition partition) {
+            super(partition);
+            this.policy = policyForPartition(partition);
+        }
+
+        /**
+         * Creates a partition containing the same folders as the original partition but with a
+         * different root folder.
+         */
+        OverlayPartition(@NonNull File folder, @NonNull SystemPartition original) {
+            super(folder, original);
+            this.policy = policyForPartition(original);
+        }
+
+        private static String policyForPartition(SystemPartition partition) {
+            switch (partition.type) {
+                case PackagePartitions.PARTITION_SYSTEM:
+                case PackagePartitions.PARTITION_SYSTEM_EXT:
+                    return POLICY_SYSTEM;
+                case PackagePartitions.PARTITION_VENDOR:
+                    return POLICY_VENDOR;
+                case PackagePartitions.PARTITION_ODM:
+                    return POLICY_ODM;
+                case PackagePartitions.PARTITION_OEM:
+                    return POLICY_OEM;
+                case PackagePartitions.PARTITION_PRODUCT:
+                    return POLICY_PRODUCT;
+                default:
+                    throw new IllegalStateException("Unable to determine policy for "
+                            + partition.folder);
+            }
+        }
+    }
+
+    /** This class holds state related to parsing the configurations of a partition. */
+    private static class ParsingContext {
+        // The overlay directory of the partition
+        private final OverlayPartition mPartition;
+
+        // The ordered list of configured overlays
+        private final ArrayList<ParsedConfiguration> mOrderedConfigurations = new ArrayList<>();
+
+        // The packages configured in the partition
+        private final ArraySet<String> mConfiguredOverlays = new ArraySet<>();
+
+        // Whether an mutable overlay has been configured in the partition
+        private boolean mFoundMutableOverlay;
+
+        // The current recursive depth of merging configuration files
+        private int mMergeDepth;
+
+        private ParsingContext(OverlayPartition partition) {
+            mPartition = partition;
+        }
+    }
+
+    /**
+     * Retrieves overlays configured within the partition in increasing priority order.
+     *
+     * If {@code scanner} is null, then the {@link ParsedConfiguration#parsedInfo} fields of the
+     * added configured overlays will be null and the parsing logic will not assert that the
+     * configured overlays exist within the partition.
+     *
+     * @return list of configured overlays if configuration file exists; otherwise, null
+     */
+    @Nullable
+    static ArrayList<ParsedConfiguration> getConfigurations(
+            @NonNull OverlayPartition partition, @Nullable OverlayScanner scanner) {
+        if (partition.getOverlayFolder() == null) {
+            return null;
+        }
+
+        if (scanner != null) {
+            scanner.scanDir(partition.getOverlayFolder());
+        }
+
+        final File configFile = new File(partition.getOverlayFolder(), CONFIG_DEFAULT_FILENAME);
+        if (!configFile.exists()) {
+            return null;
+        }
+
+        final ParsingContext parsingContext = new ParsingContext(partition);
+        readConfigFile(configFile, scanner, parsingContext);
+        return parsingContext.mOrderedConfigurations;
+    }
+
+    private static void readConfigFile(@NonNull File configFile, @Nullable OverlayScanner scanner,
+            @NonNull ParsingContext parsingContext) {
+        FileReader configReader;
+        try {
+            configReader = new FileReader(configFile);
+        } catch (FileNotFoundException e) {
+            Log.w(TAG, "Couldn't find or open overlay configuration file " + configFile);
+            return;
+        }
+
+        try {
+            final XmlPullParser parser = Xml.newPullParser();
+            parser.setInput(configReader);
+            XmlUtils.beginDocument(parser, "config");
+
+            int depth = parser.getDepth();
+            while (XmlUtils.nextElementWithin(parser, depth)) {
+                final String name = parser.getName();
+                switch (name) {
+                    case "merge":
+                        parseMerge(configFile, parser, scanner, parsingContext);
+                        break;
+                    case "overlay":
+                        parseOverlay(configFile, parser, scanner, parsingContext);
+                        break;
+                    default:
+                        Log.w(TAG, String.format("Tag %s is unknown in %s at %s",
+                                name, configFile, parser.getPositionDescription()));
+                        break;
+                }
+            }
+        } catch (XmlPullParserException | IOException e) {
+            Log.w(TAG, "Got exception parsing overlay configuration.", e);
+        } finally {
+            IoUtils.closeQuietly(configReader);
+        }
+    }
+
+    /**
+     * Parses a <merge> tag within an overlay configuration file.
+     *
+     * Merge tags allow for other configuration files to be "merged" at the current parsing
+     * position into the current configuration file being parsed. The {@code path} attribute of the
+     * tag represents the path of the file to merge relative to the directory containing overlay
+     * configuration files.
+     */
+    private static void parseMerge(@NonNull File configFile, @NonNull XmlPullParser parser,
+            @Nullable OverlayScanner scanner, @NonNull ParsingContext parsingContext) {
+        final String path = parser.getAttributeValue(null, "path");
+        if (path == null) {
+            throw new IllegalStateException(String.format("<merge> without path in %s at %s"
+                    + configFile, parser.getPositionDescription()));
+        }
+
+        if (path.startsWith("/")) {
+            throw new IllegalStateException(String.format(
+                    "Path %s must be relative to the directory containing overlay configurations "
+                            + " files in %s at %s ", path, configFile,
+                    parser.getPositionDescription()));
+        }
+
+        if (parsingContext.mMergeDepth++ == MAXIMUM_MERGE_DEPTH) {
+            throw new IllegalStateException(String.format(
+                    "Maximum <merge> depth exceeded in %s at %s", configFile,
+                    parser.getPositionDescription()));
+        }
+
+        final File configDirectory;
+        final File includedConfigFile;
+        try {
+            configDirectory = new File(parsingContext.mPartition.getOverlayFolder(),
+                    CONFIG_DIRECTORY).getCanonicalFile();
+            includedConfigFile = new File(configDirectory, path).getCanonicalFile();
+        } catch (IOException e) {
+            throw new IllegalStateException(
+                    String.format("Couldn't find or open merged configuration file %s in %s at %s",
+                            path, configFile, parser.getPositionDescription()), e);
+        }
+
+        if (!includedConfigFile.exists()) {
+            throw new IllegalStateException(
+                    String.format("Merged configuration file %s does not exist in %s at %s",
+                            path, configFile, parser.getPositionDescription()));
+        }
+
+        if (!FileUtils.contains(configDirectory, includedConfigFile)) {
+            throw new IllegalStateException(
+                    String.format(
+                            "Merged file %s outside of configuration directory in %s at %s",
+                            includedConfigFile.getAbsolutePath(), includedConfigFile,
+                            parser.getPositionDescription()));
+        }
+
+        readConfigFile(includedConfigFile, scanner, parsingContext);
+        parsingContext.mMergeDepth--;
+    }
+
+    /**
+     * Parses an <overlay> tag within an overlay configuration file.
+     *
+     * Requires a {@code package} attribute that indicates which package is being configured.
+     * The optional {@code enabled} attribute controls whether or not the overlay is enabled by
+     * default (default is false). The optional {@code mutable} attribute controls whether or
+     * not the overlay is mutable and can have its enabled state changed at runtime (default is
+     * true).
+     *
+     * The order in which overlays that override the same resources are configured matters. An
+     * overlay will have a greater priority than overlays with configurations preceding its own
+     * configuration.
+     *
+     * Configurations of immutable overlays must precede configurations of mutable overlays.
+     * An overlay cannot be configured in multiple locations. All configured overlay must exist
+     * within the partition of the configuration file. An overlay cannot be configured multiple
+     * times in a single partition.
+     *
+     * Overlays not listed within a configuration file will be mutable and disabled by default. The
+     * order of non-configured overlays when enabled by the OverlayManagerService is undefined.
+     */
+    private static void parseOverlay(@NonNull File configFile, @NonNull XmlPullParser parser,
+            @Nullable OverlayScanner scanner, @NonNull ParsingContext parsingContext) {
+        final String packageName = parser.getAttributeValue(null, "package");
+        if (packageName == null) {
+            throw new IllegalStateException(String.format("\"<overlay> without package in %s at %s",
+                    configFile, parser.getPositionDescription()));
+        }
+
+        // Ensure the overlay being configured is present in the partition during zygote
+        // initialization.
+        ParsedOverlayInfo info = null;
+        if (scanner != null) {
+            info = scanner.getParsedInfo(packageName);
+            if (info == null|| !parsingContext.mPartition.containsOverlay(info.path)) {
+                throw new IllegalStateException(
+                        String.format("overlay %s not present in partition %s in %s at %s",
+                                packageName, parsingContext.mPartition.getOverlayFolder(),
+                                configFile, parser.getPositionDescription()));
+            }
+        }
+
+        if (parsingContext.mConfiguredOverlays.contains(packageName)) {
+            throw new IllegalStateException(
+                    String.format("overlay %s configured multiple times in a single partition"
+                                    + " in %s at %s", packageName, configFile,
+                            parser.getPositionDescription()));
+        }
+
+        boolean isEnabled = DEFAULT_ENABLED_STATE;
+        final String enabled = parser.getAttributeValue(null, "enabled");
+        if (enabled != null) {
+            isEnabled = !"false".equals(enabled);
+        }
+
+        boolean isMutable = DEFAULT_MUTABILITY;
+        final String mutable = parser.getAttributeValue(null, "mutable");
+        if (mutable != null) {
+            isMutable = !"false".equals(mutable);
+            if (!isMutable && parsingContext.mFoundMutableOverlay) {
+                throw new IllegalStateException(String.format(
+                        "immutable overlays must precede mutable overlays:"
+                                + " found in %s at %s",
+                        configFile, parser.getPositionDescription()));
+            }
+        }
+
+        if (isMutable) {
+            parsingContext.mFoundMutableOverlay = true;
+        } else if (!isEnabled) {
+            // Default disabled, immutable overlays may be a misconfiguration of the system so warn
+            // developers.
+            Log.w(TAG, "found default-disabled immutable overlay " + packageName);
+        }
+
+        final ParsedConfiguration Config = new ParsedConfiguration(packageName, isEnabled,
+                isMutable, parsingContext.mPartition.policy, info);
+        parsingContext.mConfiguredOverlays.add(packageName);
+        parsingContext.mOrderedConfigurations.add(Config);
+    }
+}
diff --git a/core/java/com/android/internal/content/om/OverlayScanner.java b/core/java/com/android/internal/content/om/OverlayScanner.java
new file mode 100644
index 0000000..a85cf56
--- /dev/null
+++ b/core/java/com/android/internal/content/om/OverlayScanner.java
@@ -0,0 +1,138 @@
+/*
+ * 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.internal.content.om;
+
+import static com.android.internal.content.om.OverlayConfig.TAG;
+
+import android.annotation.NonNull;
+import android.annotation.Nullable;
+import android.content.pm.PackageParser;
+import android.util.ArrayMap;
+import android.util.Log;
+
+import com.android.internal.annotations.VisibleForTesting;
+
+import java.io.File;
+import java.util.Collection;
+
+/**
+ * This class scans a directory containing overlay APKs and extracts information from the overlay
+ * manifests by parsing the overlay manifests.
+ */
+@VisibleForTesting(visibility = VisibleForTesting.Visibility.PACKAGE)
+public class OverlayScanner {
+
+    /** Represents information parsed from the manifest of an overlay. */
+    public static class ParsedOverlayInfo {
+        public final String packageName;
+        public final String targetPackageName;
+        public final int targetSdkVersion;
+        public final boolean isStatic;
+        public final int priority;
+        public final File path;
+
+        public ParsedOverlayInfo(String packageName, String targetPackageName,
+                int targetSdkVersion, boolean isStatic, int priority, File path) {
+            this.packageName = packageName;
+            this.targetPackageName = targetPackageName;
+            this.targetSdkVersion = targetSdkVersion;
+            this.isStatic = isStatic;
+            this.priority = priority;
+            this.path = path;
+        }
+
+        @Override
+        public String toString() {
+            return getClass().getSimpleName() + String.format("{packageName=%s"
+                            + ", targetPackageName=%s, targetSdkVersion=%s, isStatic=%s"
+                            + ", priority=%s, path=%s}",
+                    packageName, targetPackageName, targetSdkVersion, isStatic, priority, path);
+        }
+    }
+
+    /**
+     * A map of overlay package name to the parsed manifest information of the latest version of
+     * the overlay.
+     */
+    private final ArrayMap<String, ParsedOverlayInfo> mParsedOverlayInfos = new ArrayMap<>();
+
+    /** Retrieves information parsed from the overlay with the package name. */
+    @Nullable
+    public final ParsedOverlayInfo getParsedInfo(String packageName) {
+        return mParsedOverlayInfos.get(packageName);
+    }
+
+    /** Retrieves all of the scanned overlays. */
+    @NonNull
+    final Collection<ParsedOverlayInfo> getAllParsedInfos() {
+        return mParsedOverlayInfos.values();
+    }
+
+    /**
+     * Recursively searches the directory for overlay APKs. If an overlay is found with the same
+     * package name as a previously scanned overlay, the info of the new overlay will replace the
+     * info of the previously scanned overlay.
+     */
+    public void scanDir(File partitionOverlayDir) {
+        if (!partitionOverlayDir.exists() || !partitionOverlayDir.isDirectory()) {
+            return;
+        }
+
+        if (!partitionOverlayDir.canRead()) {
+            Log.w(TAG, "Directory " + partitionOverlayDir + " cannot be read");
+            return;
+        }
+
+        final File[] files = partitionOverlayDir.listFiles();
+        if (files == null) {
+            return;
+        }
+
+        for (int i = 0; i < files.length; i++) {
+            final File f = files[i];
+            if (f.isDirectory()) {
+                scanDir(f);
+            }
+
+            if (!f.isFile() || !f.getPath().endsWith(".apk")) {
+                continue;
+            }
+
+            final ParsedOverlayInfo info = parseOverlayManifest(f);
+            if (info == null) {
+                continue;
+            }
+
+            mParsedOverlayInfos.put(info.packageName, info);
+        }
+    }
+
+    /** Extracts information about the overlay from its manifest. */
+    @VisibleForTesting
+    public ParsedOverlayInfo parseOverlayManifest(File overlayApk) {
+        try {
+            final PackageParser.ApkLite apkLite = PackageParser.parseApkLite(overlayApk, 0);
+            return apkLite.targetPackageName == null ? null :
+                    new ParsedOverlayInfo(apkLite.packageName, apkLite.targetPackageName,
+                            apkLite.targetSdkVersion, apkLite.overlayIsStatic,
+                            apkLite.overlayPriority, new File(apkLite.codePath));
+        } catch (PackageParser.PackageParserException e) {
+            Log.w(TAG, "Got exception loading overlay.", e);
+            return null;
+        }
+    }
+}
diff --git a/core/java/com/android/internal/os/KernelCpuUidBpfMapReader.java b/core/java/com/android/internal/os/KernelCpuUidBpfMapReader.java
new file mode 100644
index 0000000..26f81d9
--- /dev/null
+++ b/core/java/com/android/internal/os/KernelCpuUidBpfMapReader.java
@@ -0,0 +1,202 @@
+/*
+ * 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.internal.os;
+
+import android.os.StrictMode;
+import android.os.SystemClock;
+import android.util.Slog;
+import android.util.SparseArray;
+
+import java.util.concurrent.locks.ReentrantReadWriteLock;
+
+/**
+ * Reads cpu time bpf maps.
+ *
+ * It is implemented as singletons for each separate set of per-UID times. Get___Instance() method
+ * returns the corresponding reader instance. In order to prevent frequent GC, it reuses the same
+ * SparseArray to store data read from BPF maps.
+ *
+ * A KernelCpuUidBpfMapReader instance keeps an error counter. When the number of read errors within
+ * that instance accumulates to 5, this instance will reject all further read requests.
+ *
+ * Data fetched within last 500ms is considered fresh, since the reading lifecycle can take up to
+ * 25ms. KernelCpuUidBpfMapReader always tries to use cache if it is fresh and valid, but it can
+ * be disabled through a parameter.
+ *
+ * A KernelCpuUidBpfMapReader instance is thread-safe. It acquires a write lock when reading the bpf
+ * map, releases it right after, then acquires a read lock before returning a BpfMapIterator. Caller
+ * is responsible for closing BpfMapIterator (also auto-closable) after reading, otherwise deadlock
+ * will occur.
+ */
+public abstract class KernelCpuUidBpfMapReader {
+    private static final int ERROR_THRESHOLD = 5;
+    private static final long FRESHNESS_MS = 500L;
+
+    private static final KernelCpuUidBpfMapReader FREQ_TIME_READER =
+        new KernelCpuUidFreqTimeBpfMapReader();
+
+    private static final KernelCpuUidBpfMapReader ACTIVE_TIME_READER =
+        new KernelCpuUidActiveTimeBpfMapReader();
+
+    private static final KernelCpuUidBpfMapReader CLUSTER_TIME_READER =
+        new KernelCpuUidClusterTimeBpfMapReader();
+
+    static KernelCpuUidBpfMapReader getFreqTimeReaderInstance() {
+        return FREQ_TIME_READER;
+    }
+
+    static KernelCpuUidBpfMapReader getActiveTimeReaderInstance() {
+        return ACTIVE_TIME_READER;
+    }
+
+    static KernelCpuUidBpfMapReader getClusterTimeReaderInstance() {
+        return CLUSTER_TIME_READER;
+    }
+
+    final String mTag = this.getClass().getSimpleName();
+    private int mErrors = 0;
+    private boolean mTracking = false;
+    protected SparseArray<long[]> mData = new SparseArray<>();
+    private long mLastReadTime = 0;
+    protected final ReentrantReadWriteLock mLock = new ReentrantReadWriteLock();
+    protected final ReentrantReadWriteLock.ReadLock mReadLock = mLock.readLock();
+    protected final ReentrantReadWriteLock.WriteLock mWriteLock = mLock.writeLock();
+
+    public native boolean startTrackingBpfTimes();
+
+    protected abstract boolean readBpfData();
+
+    /**
+     * Returns an array of metadata used to inform the caller of 1) the size of array required by
+     * getNextUid and 2) how to interpret the raw data copied to that array.
+     */
+    public abstract long[] getDataDimensions();
+
+    public void removeUidsInRange(int startUid, int endUid) {
+        if (mErrors > ERROR_THRESHOLD) {
+            return;
+        }
+        mWriteLock.lock();
+        int firstIndex = mData.indexOfKey(startUid);
+        int lastIndex = mData.indexOfKey(endUid);
+        mData.removeAtRange(firstIndex, lastIndex - firstIndex + 1);
+        mWriteLock.unlock();
+    }
+
+    public BpfMapIterator open() {
+        return open(false);
+    }
+
+    public BpfMapIterator open(boolean ignoreCache) {
+        if (mErrors > ERROR_THRESHOLD) {
+            return null;
+        }
+        if (!mTracking && !startTrackingBpfTimes()) {
+            Slog.w(mTag, "Failed to start tracking");
+            mErrors++;
+            return null;
+        }
+        if (ignoreCache) {
+            mWriteLock.lock();
+        } else {
+            mReadLock.lock();
+            if (dataValid()) {
+                return new BpfMapIterator();
+            }
+            mReadLock.unlock();
+            mWriteLock.lock();
+            if (dataValid()) {
+                mReadLock.lock();
+                mWriteLock.unlock();
+                return new BpfMapIterator();
+            }
+        }
+        if (readBpfData()) {
+            mLastReadTime = SystemClock.elapsedRealtime();
+            mReadLock.lock();
+            mWriteLock.unlock();
+            return new BpfMapIterator();
+        }
+
+        mWriteLock.unlock();
+        mErrors++;
+        Slog.w(mTag, "Failed to read bpf times");
+        return null;
+    }
+
+    private boolean dataValid() {
+        return mData.size() > 0 && (SystemClock.elapsedRealtime() - mLastReadTime < FRESHNESS_MS);
+    }
+
+    public class BpfMapIterator implements AutoCloseable {
+        private int mPos;
+
+        public BpfMapIterator() {
+        };
+
+        public boolean getNextUid(long[] buf) {
+            if (mPos >= mData.size()) {
+                return false;
+            }
+            buf[0] = mData.keyAt(mPos);
+            System.arraycopy(mData.valueAt(mPos), 0, buf, 1, mData.valueAt(mPos).length);
+            mPos++;
+            return true;
+        }
+
+        public void close() {
+            mReadLock.unlock();
+        }
+    }
+
+    public static class KernelCpuUidFreqTimeBpfMapReader extends KernelCpuUidBpfMapReader {
+
+        private final native boolean removeUidRange(int startUid, int endUid);
+
+        @Override
+        protected final native boolean readBpfData();
+
+        @Override
+        public final native long[] getDataDimensions();
+
+        @Override
+        public void removeUidsInRange(int startUid, int endUid) {
+            mWriteLock.lock();
+            super.removeUidsInRange(startUid, endUid);
+            removeUidRange(startUid, endUid);
+            mWriteLock.unlock();
+        }
+    }
+
+    public static class KernelCpuUidActiveTimeBpfMapReader extends KernelCpuUidBpfMapReader {
+
+        @Override
+        protected final native boolean readBpfData();
+
+        @Override
+        public final native long[] getDataDimensions();
+    }
+
+    public static class KernelCpuUidClusterTimeBpfMapReader extends KernelCpuUidBpfMapReader {
+
+        @Override
+        protected final native boolean readBpfData();
+
+        @Override
+        public final native long[] getDataDimensions();
+    }
+}
diff --git a/core/java/com/android/internal/os/KernelCpuUidTimeReader.java b/core/java/com/android/internal/os/KernelCpuUidTimeReader.java
index f1eb2fb..f7fad2c 100644
--- a/core/java/com/android/internal/os/KernelCpuUidTimeReader.java
+++ b/core/java/com/android/internal/os/KernelCpuUidTimeReader.java
@@ -28,6 +28,7 @@
 
 import com.android.internal.annotations.VisibleForTesting;
 import com.android.internal.os.KernelCpuProcStringReader.ProcFileIterator;
+import com.android.internal.os.KernelCpuUidBpfMapReader.BpfMapIterator;
 
 import java.io.BufferedReader;
 import java.io.FileWriter;
@@ -57,6 +58,8 @@
     final SparseArray<T> mLastTimes = new SparseArray<>();
     final KernelCpuProcStringReader mReader;
     final boolean mThrottle;
+    protected boolean mBpfTimesAvailable;
+    final KernelCpuUidBpfMapReader mBpfReader;
     private long mMinTimeBetweenRead = DEFAULT_MIN_TIME_BETWEEN_READ;
     private long mLastReadTimeMs = 0;
 
@@ -73,9 +76,15 @@
         void onUidCpuTime(int uid, T time);
     }
 
-    KernelCpuUidTimeReader(KernelCpuProcStringReader reader, boolean throttle) {
+    KernelCpuUidTimeReader(KernelCpuProcStringReader reader, @Nullable KernelCpuUidBpfMapReader bpfReader, boolean throttle) {
         mReader = reader;
         mThrottle = throttle;
+        mBpfReader = bpfReader;
+        mBpfTimesAvailable = (mBpfReader != null);
+    }
+
+    KernelCpuUidTimeReader(KernelCpuProcStringReader reader, boolean throttle) {
+        this(reader, null, throttle);
     }
 
     /**
@@ -151,9 +160,13 @@
         }
         mLastTimes.put(startUid, null);
         mLastTimes.put(endUid, null);
-        final int firstIndex = mLastTimes.indexOfKey(startUid);
-        final int lastIndex = mLastTimes.indexOfKey(endUid);
+        int firstIndex = mLastTimes.indexOfKey(startUid);
+        int lastIndex = mLastTimes.indexOfKey(endUid);
         mLastTimes.removeAtRange(firstIndex, lastIndex - firstIndex + 1);
+
+        if (mBpfTimesAvailable) {
+            mBpfReader.removeUidsInRange(startUid, endUid);
+        }
     }
 
     /**
@@ -323,13 +336,13 @@
 
         public KernelCpuUidFreqTimeReader(boolean throttle) {
             this(UID_TIMES_PROC_FILE, KernelCpuProcStringReader.getFreqTimeReaderInstance(),
-                    throttle);
+                 KernelCpuUidBpfMapReader.getFreqTimeReaderInstance(), throttle);
         }
 
         @VisibleForTesting
         public KernelCpuUidFreqTimeReader(String procFile, KernelCpuProcStringReader reader,
-                boolean throttle) {
-            super(reader, throttle);
+                KernelCpuUidBpfMapReader bpfReader, boolean throttle) {
+            super(reader, bpfReader, throttle);
             mProcFilePath = Paths.get(procFile);
         }
 
@@ -370,19 +383,24 @@
             if (!mAllUidTimesAvailable) {
                 return null;
             }
-            final int oldMask = StrictMode.allowThreadDiskReadsMask();
-            try (BufferedReader reader = Files.newBufferedReader(mProcFilePath)) {
-                if (readFreqs(reader.readLine()) == null) {
+            if (mBpfTimesAvailable) {
+                readFreqsThroughBpf();
+            }
+            if (mCpuFreqs == null) {
+                final int oldMask = StrictMode.allowThreadDiskReadsMask();
+                try (BufferedReader reader = Files.newBufferedReader(mProcFilePath)) {
+                    if (readFreqs(reader.readLine()) == null) {
+                        return null;
+                    }
+                } catch (IOException e) {
+                    if (++mErrors >= MAX_ERROR_COUNT) {
+                        mAllUidTimesAvailable = false;
+                    }
+                    Slog.e(mTag, "Failed to read " + UID_TIMES_PROC_FILE + ": " + e);
                     return null;
+                } finally {
+                    StrictMode.setThreadPolicyMask(oldMask);
                 }
-            } catch (IOException e) {
-                if (++mErrors >= MAX_ERROR_COUNT) {
-                    mAllUidTimesAvailable = false;
-                }
-                Slog.e(mTag, "Failed to read " + UID_TIMES_PROC_FILE + ": " + e);
-                return null;
-            } finally {
-                StrictMode.setThreadPolicyMask(oldMask);
             }
             // Check if the freqs in the proc file correspond to per-cluster freqs.
             final IntArray numClusterFreqs = extractClusterInfoFromProcFileFreqs();
@@ -402,6 +420,21 @@
             return mCpuFreqs;
         }
 
+        private long[] readFreqsThroughBpf() {
+            if (!mBpfTimesAvailable || mBpfReader == null) {
+                return null;
+            }
+            mCpuFreqs = mBpfReader.getDataDimensions();
+            if (mCpuFreqs == null) {
+                return null;
+            }
+            mFreqCount = mCpuFreqs.length;
+            mCurTimes = new long[mFreqCount];
+            mDeltaTimes = new long[mFreqCount];
+            mBuffer = new long[mFreqCount + 1];
+            return mCpuFreqs;
+        }
+
         private long[] readFreqs(String line) {
             if (line == null || line.trim().isEmpty()) {
                 return null;
@@ -422,8 +455,45 @@
             return mCpuFreqs;
         }
 
+        private void processUidDelta(@Nullable Callback<long[]> cb) {
+            final int uid = (int) mBuffer[0];
+            long[] lastTimes = mLastTimes.get(uid);
+            if (lastTimes == null) {
+                lastTimes = new long[mFreqCount];
+                mLastTimes.put(uid, lastTimes);
+            }
+            copyToCurTimes();
+            boolean notify = false;
+            boolean valid = true;
+            for (int i = 0; i < mFreqCount; i++) {
+                // Unit is 10ms.
+                mDeltaTimes[i] = mCurTimes[i] - lastTimes[i];
+                if (mDeltaTimes[i] < 0) {
+                    Slog.e(mTag, "Negative delta from freq time proc: " + mDeltaTimes[i]);
+                    valid = false;
+                }
+                notify |= mDeltaTimes[i] > 0;
+            }
+            if (notify && valid) {
+                System.arraycopy(mCurTimes, 0, lastTimes, 0, mFreqCount);
+                if (cb != null) {
+                    cb.onUidCpuTime(uid, mDeltaTimes);
+                }
+            }
+        }
+
         @Override
         void readDeltaImpl(@Nullable Callback<long[]> cb) {
+            if (mBpfTimesAvailable) {
+                try (BpfMapIterator iter = mBpfReader.open(!mThrottle)) {
+                    if (checkPrecondition(iter)) {
+                        while (iter.getNextUid(mBuffer)) {
+                            processUidDelta(cb);
+                        }
+                        return;
+                    }
+                }
+            }
             try (ProcFileIterator iter = mReader.open(!mThrottle)) {
                 if (!checkPrecondition(iter)) {
                     return;
@@ -434,36 +504,24 @@
                         Slog.wtf(mTag, "Invalid line: " + buf.toString());
                         continue;
                     }
-                    final int uid = (int) mBuffer[0];
-                    long[] lastTimes = mLastTimes.get(uid);
-                    if (lastTimes == null) {
-                        lastTimes = new long[mFreqCount];
-                        mLastTimes.put(uid, lastTimes);
-                    }
-                    copyToCurTimes();
-                    boolean notify = false;
-                    boolean valid = true;
-                    for (int i = 0; i < mFreqCount; i++) {
-                        // Unit is 10ms.
-                        mDeltaTimes[i] = mCurTimes[i] - lastTimes[i];
-                        if (mDeltaTimes[i] < 0) {
-                            Slog.e(mTag, "Negative delta from freq time proc: " + mDeltaTimes[i]);
-                            valid = false;
-                        }
-                        notify |= mDeltaTimes[i] > 0;
-                    }
-                    if (notify && valid) {
-                        System.arraycopy(mCurTimes, 0, lastTimes, 0, mFreqCount);
-                        if (cb != null) {
-                            cb.onUidCpuTime(uid, mDeltaTimes);
-                        }
-                    }
+                    processUidDelta(cb);
                 }
             }
         }
 
         @Override
         void readAbsoluteImpl(Callback<long[]> cb) {
+            if (mBpfTimesAvailable) {
+                try (BpfMapIterator iter = mBpfReader.open(!mThrottle)) {
+                    if (checkPrecondition(iter)) {
+                        while (iter.getNextUid(mBuffer)) {
+                            copyToCurTimes();
+                            cb.onUidCpuTime((int) mBuffer[0], mCurTimes);
+                        }
+                        return;
+                    }
+                }
+            }
             try (ProcFileIterator iter = mReader.open(!mThrottle)) {
                 if (!checkPrecondition(iter)) {
                     return;
@@ -481,11 +539,24 @@
         }
 
         private void copyToCurTimes() {
+            long factor = mBpfTimesAvailable ? 1 : 10;
             for (int i = 0; i < mFreqCount; i++) {
-                mCurTimes[i] = mBuffer[i + 1] * 10;
+                mCurTimes[i] = mBuffer[i + 1] * factor;
             }
         }
 
+        private boolean checkPrecondition(BpfMapIterator iter) {
+            if (iter == null) {
+                mBpfTimesAvailable = false;
+                return false;
+            }
+            if (mCpuFreqs != null) {
+                return true;
+            }
+            mBpfTimesAvailable = (readFreqsThroughBpf() != null);
+            return mBpfTimesAvailable;
+        }
+
         private boolean checkPrecondition(ProcFileIterator iter) {
             if (iter == null || !iter.hasNextLine()) {
                 // Error logged in KernelCpuProcStringReader.
@@ -544,16 +615,43 @@
         private long[] mBuffer;
 
         public KernelCpuUidActiveTimeReader(boolean throttle) {
-            super(KernelCpuProcStringReader.getActiveTimeReaderInstance(), throttle);
+            super(KernelCpuProcStringReader.getActiveTimeReaderInstance(),
+                  KernelCpuUidBpfMapReader.getActiveTimeReaderInstance(), throttle);
         }
 
         @VisibleForTesting
-        public KernelCpuUidActiveTimeReader(KernelCpuProcStringReader reader, boolean throttle) {
-            super(reader, throttle);
+        public KernelCpuUidActiveTimeReader(KernelCpuProcStringReader reader, KernelCpuUidBpfMapReader bpfReader, boolean throttle) {
+            super(reader, bpfReader, throttle);
+        }
+
+        private void processUidDelta(@Nullable Callback<Long> cb) {
+            int uid = (int) mBuffer[0];
+            long cpuActiveTime = sumActiveTime(mBuffer, mBpfTimesAvailable ? 1 : 10);
+            if (cpuActiveTime > 0) {
+                long delta = cpuActiveTime - mLastTimes.get(uid, 0L);
+                if (delta > 0) {
+                    mLastTimes.put(uid, cpuActiveTime);
+                    if (cb != null) {
+                        cb.onUidCpuTime(uid, delta);
+                    }
+                } else if (delta < 0) {
+                    Slog.e(mTag, "Negative delta from active time proc: " + delta);
+                }
+            }
         }
 
         @Override
         void readDeltaImpl(@Nullable Callback<Long> cb) {
+            if (mBpfTimesAvailable) {
+                try (BpfMapIterator iter = mBpfReader.open(!mThrottle)) {
+                    if (checkPrecondition(iter)) {
+                        while (iter.getNextUid(mBuffer)) {
+                            processUidDelta(cb);
+                        }
+                        return;
+                    }
+                }
+            }
             try (ProcFileIterator iter = mReader.open(!mThrottle)) {
                 if (!checkPrecondition(iter)) {
                     return;
@@ -564,25 +662,30 @@
                         Slog.wtf(mTag, "Invalid line: " + buf.toString());
                         continue;
                     }
-                    int uid = (int) mBuffer[0];
-                    long cpuActiveTime = sumActiveTime(mBuffer);
-                    if (cpuActiveTime > 0) {
-                        long delta = cpuActiveTime - mLastTimes.get(uid, 0L);
-                        if (delta > 0) {
-                            mLastTimes.put(uid, cpuActiveTime);
-                            if (cb != null) {
-                                cb.onUidCpuTime(uid, delta);
-                            }
-                        } else if (delta < 0) {
-                            Slog.e(mTag, "Negative delta from active time proc: " + delta);
-                        }
-                    }
+                    processUidDelta(cb);
                 }
             }
         }
 
+        private void processUidAbsolute(@Nullable Callback<Long> cb) {
+            long cpuActiveTime = sumActiveTime(mBuffer, mBpfTimesAvailable ? 1 : 10);
+            if (cpuActiveTime > 0) {
+                cb.onUidCpuTime((int) mBuffer[0], cpuActiveTime);
+            }
+        }
+
         @Override
         void readAbsoluteImpl(Callback<Long> cb) {
+            if (mBpfTimesAvailable) {
+                try (BpfMapIterator iter = mBpfReader.open(!mThrottle)) {
+                    if (checkPrecondition(iter)) {
+                        while (iter.getNextUid(mBuffer)) {
+                            processUidAbsolute(cb);
+                        }
+                        return;
+                    }
+                }
+            }
             try (ProcFileIterator iter = mReader.open(!mThrottle)) {
                 if (!checkPrecondition(iter)) {
                     return;
@@ -593,23 +696,38 @@
                         Slog.wtf(mTag, "Invalid line: " + buf.toString());
                         continue;
                     }
-                    long cpuActiveTime = sumActiveTime(mBuffer);
-                    if (cpuActiveTime > 0) {
-                        cb.onUidCpuTime((int) mBuffer[0], cpuActiveTime);
-                    }
+                    processUidAbsolute(cb);
                 }
             }
         }
 
-        private static long sumActiveTime(long[] times) {
+        private static long sumActiveTime(long[] times, double factor) {
             // UID is stored at times[0].
             double sum = 0;
             for (int i = 1; i < times.length; i++) {
-                sum += (double) times[i] * 10 / i; // Unit is 10ms.
+                sum += (double) times[i] * factor / i; // Unit is 10ms.
             }
             return (long) sum;
         }
 
+        private boolean checkPrecondition(BpfMapIterator iter) {
+            if (iter == null) {
+                mBpfTimesAvailable = false;
+                return false;
+            }
+            if (mCores > 0) {
+                return true;
+            }
+            long[] cores = mBpfReader.getDataDimensions();
+            if (cores == null || cores.length < 1) {
+                mBpfTimesAvailable = false;
+                return false;
+            }
+            mCores = (int) cores[0];
+            mBuffer = new long[mCores + 1];
+            return true;
+        }
+
         private boolean checkPrecondition(ProcFileIterator iter) {
             if (iter == null || !iter.hasNextLine()) {
                 // Error logged in KernelCpuProcStringReader.
@@ -668,16 +786,54 @@
         private long[] mDeltaTime;
 
         public KernelCpuUidClusterTimeReader(boolean throttle) {
-            super(KernelCpuProcStringReader.getClusterTimeReaderInstance(), throttle);
+            super(KernelCpuProcStringReader.getClusterTimeReaderInstance(),
+                  KernelCpuUidBpfMapReader.getClusterTimeReaderInstance(), throttle);
         }
 
         @VisibleForTesting
-        public KernelCpuUidClusterTimeReader(KernelCpuProcStringReader reader, boolean throttle) {
-            super(reader, throttle);
+        public KernelCpuUidClusterTimeReader(KernelCpuProcStringReader reader,
+                                             KernelCpuUidBpfMapReader bpfReader, boolean throttle) {
+            super(reader, bpfReader, throttle);
+        }
+
+        void processUidDelta(@Nullable Callback<long[]> cb) {
+            int uid = (int) mBuffer[0];
+            long[] lastTimes = mLastTimes.get(uid);
+            if (lastTimes == null) {
+                lastTimes = new long[mNumClusters];
+                mLastTimes.put(uid, lastTimes);
+            }
+            sumClusterTime();
+            boolean valid = true;
+            boolean notify = false;
+            for (int i = 0; i < mNumClusters; i++) {
+                mDeltaTime[i] = mCurTime[i] - lastTimes[i];
+                if (mDeltaTime[i] < 0) {
+                    Slog.e(mTag, "Negative delta from cluster time proc: " + mDeltaTime[i]);
+                    valid = false;
+                }
+                notify |= mDeltaTime[i] > 0;
+            }
+            if (notify && valid) {
+                System.arraycopy(mCurTime, 0, lastTimes, 0, mNumClusters);
+                if (cb != null) {
+                    cb.onUidCpuTime(uid, mDeltaTime);
+                }
+            }
         }
 
         @Override
         void readDeltaImpl(@Nullable Callback<long[]> cb) {
+            if (mBpfTimesAvailable) {
+                try (BpfMapIterator iter = mBpfReader.open(!mThrottle)) {
+                    if (checkPrecondition(iter)) {
+                        while (iter.getNextUid(mBuffer)) {
+                            processUidDelta(cb);
+                        }
+                        return;
+                    }
+                }
+            }
             try (ProcFileIterator iter = mReader.open(!mThrottle)) {
                 if (!checkPrecondition(iter)) {
                     return;
@@ -688,35 +844,24 @@
                         Slog.wtf(mTag, "Invalid line: " + buf.toString());
                         continue;
                     }
-                    int uid = (int) mBuffer[0];
-                    long[] lastTimes = mLastTimes.get(uid);
-                    if (lastTimes == null) {
-                        lastTimes = new long[mNumClusters];
-                        mLastTimes.put(uid, lastTimes);
-                    }
-                    sumClusterTime();
-                    boolean valid = true;
-                    boolean notify = false;
-                    for (int i = 0; i < mNumClusters; i++) {
-                        mDeltaTime[i] = mCurTime[i] - lastTimes[i];
-                        if (mDeltaTime[i] < 0) {
-                            Slog.e(mTag, "Negative delta from cluster time proc: " + mDeltaTime[i]);
-                            valid = false;
-                        }
-                        notify |= mDeltaTime[i] > 0;
-                    }
-                    if (notify && valid) {
-                        System.arraycopy(mCurTime, 0, lastTimes, 0, mNumClusters);
-                        if (cb != null) {
-                            cb.onUidCpuTime(uid, mDeltaTime);
-                        }
-                    }
+                    processUidDelta(cb);
                 }
             }
         }
 
         @Override
         void readAbsoluteImpl(Callback<long[]> cb) {
+            if (mBpfTimesAvailable) {
+                try (BpfMapIterator iter = mBpfReader.open(!mThrottle)) {
+                    if (checkPrecondition(iter)) {
+                        while (iter.getNextUid(mBuffer)) {
+                            sumClusterTime();
+                            cb.onUidCpuTime((int) mBuffer[0], mCurTime);
+                        }
+                        return;
+                    }
+                }
+            }
             try (ProcFileIterator iter = mReader.open(!mThrottle)) {
                 if (!checkPrecondition(iter)) {
                     return;
@@ -734,17 +879,45 @@
         }
 
         private void sumClusterTime() {
+            double factor = mBpfTimesAvailable ? 1 : 10;
             // UID is stored at mBuffer[0].
             int core = 1;
             for (int i = 0; i < mNumClusters; i++) {
                 double sum = 0;
                 for (int j = 1; j <= mCoresOnClusters[i]; j++) {
-                    sum += (double) mBuffer[core++] * 10 / j; // Unit is 10ms.
+                    sum += (double) mBuffer[core++] * factor / j; // Unit is 10ms.
                 }
                 mCurTime[i] = (long) sum;
             }
         }
 
+        private boolean checkPrecondition(BpfMapIterator iter) {
+            if (iter == null) {
+                mBpfTimesAvailable = false;
+                return false;
+            }
+            if (mNumClusters > 0) {
+                return true;
+            }
+            long[] coresOnClusters = mBpfReader.getDataDimensions();
+            if (coresOnClusters == null || coresOnClusters.length < 1) {
+                mBpfTimesAvailable = false;
+                return false;
+            }
+            mNumClusters = coresOnClusters.length;
+            mCoresOnClusters = new int[mNumClusters];
+            int cores = 0;
+            for (int i = 0; i < mNumClusters; i++) {
+                mCoresOnClusters[i] = (int) coresOnClusters[i];
+                cores += mCoresOnClusters[i];
+            }
+            mNumCores = cores;
+            mBuffer = new long[cores + 1];
+            mCurTime = new long[mNumClusters];
+            mDeltaTime = new long[mNumClusters];
+            return true;
+        }
+
         private boolean checkPrecondition(ProcFileIterator iter) {
             if (iter == null || !iter.hasNextLine()) {
                 // Error logged in KernelCpuProcStringReader.
diff --git a/core/java/com/android/internal/os/KernelSingleUidTimeReader.java b/core/java/com/android/internal/os/KernelSingleUidTimeReader.java
index 3c43a11..fc0ce6f 100644
--- a/core/java/com/android/internal/os/KernelSingleUidTimeReader.java
+++ b/core/java/com/android/internal/os/KernelSingleUidTimeReader.java
@@ -53,6 +53,8 @@
     private int mReadErrorCounter;
     @GuardedBy("this")
     private boolean mSingleUidCpuTimesAvailable = true;
+    @GuardedBy("this")
+    private boolean mBpfTimesAvailable = true;
     // We use the freq count obtained from /proc/uid_time_in_state to decide how many longs
     // to read from each /proc/uid/<uid>/time_in_state. On the first read, verify if this is
     // correct and if not, set {@link #mSingleUidCpuTimesAvailable} to false. This flag will
@@ -62,6 +64,8 @@
 
     private final Injector mInjector;
 
+    private static final native boolean canReadBpfTimes();
+
     KernelSingleUidTimeReader(int cpuFreqsCount) {
         this(cpuFreqsCount, new Injector());
     }
@@ -83,6 +87,18 @@
             if (!mSingleUidCpuTimesAvailable) {
                 return null;
             }
+            if (mBpfTimesAvailable) {
+                final long[] cpuTimesMs = mInjector.readBpfData(uid);
+                if (cpuTimesMs.length == 0) {
+                    mBpfTimesAvailable = false;
+                } else if (!mCpuFreqsCountVerified && cpuTimesMs.length != mCpuFreqsCount) {
+                    mSingleUidCpuTimesAvailable = false;
+                    return null;
+                } else {
+                    mCpuFreqsCountVerified = true;
+                    return computeDelta(uid, cpuTimesMs);
+                }
+            }
             // Read total cpu times from the proc file.
             final String procFile = new StringBuilder(PROC_FILE_DIR)
                     .append(uid)
@@ -230,6 +246,8 @@
         public byte[] readData(String procFile) throws IOException {
             return Files.readAllBytes(Paths.get(procFile));
         }
+
+        public native long[] readBpfData(int uid);
     }
 
     @VisibleForTesting
diff --git a/core/java/com/android/internal/policy/DockedDividerUtils.java b/core/java/com/android/internal/policy/DockedDividerUtils.java
index c68e506..b61b9de 100644
--- a/core/java/com/android/internal/policy/DockedDividerUtils.java
+++ b/core/java/com/android/internal/policy/DockedDividerUtils.java
@@ -16,14 +16,15 @@
 
 package com.android.internal.policy;
 
-import android.graphics.Rect;
-
 import static android.view.WindowManager.DOCKED_BOTTOM;
 import static android.view.WindowManager.DOCKED_INVALID;
 import static android.view.WindowManager.DOCKED_LEFT;
 import static android.view.WindowManager.DOCKED_RIGHT;
 import static android.view.WindowManager.DOCKED_TOP;
 
+import android.content.res.Resources;
+import android.graphics.Rect;
+
 /**
  * Utility functions for docked stack divider used by both window manager and System UI.
  *
@@ -105,23 +106,6 @@
         return start + (end - start) / 2 - dividerSize / 2;
     }
 
-    public static int getDockSideFromCreatedMode(boolean dockOnTopOrLeft,
-            boolean isHorizontalDivision) {
-        if (dockOnTopOrLeft) {
-            if (isHorizontalDivision) {
-                return DOCKED_TOP;
-            } else {
-                return DOCKED_LEFT;
-            }
-        } else {
-            if (isHorizontalDivision) {
-                return DOCKED_BOTTOM;
-            } else {
-                return DOCKED_RIGHT;
-            }
-        }
-    }
-
     public static int invertDockSide(int dockSide) {
         switch (dockSide) {
             case DOCKED_LEFT:
@@ -136,4 +120,21 @@
                 return DOCKED_INVALID;
         }
     }
+
+    /** Returns the inset distance from the divider window edge to the dividerview. */
+    public static int getDividerInsets(Resources res) {
+        return res.getDimensionPixelSize(com.android.internal.R.dimen.docked_stack_divider_insets);
+    }
+
+    /** Returns the size of the divider */
+    public static int getDividerSize(Resources res, int dividerInsets) {
+        final int windowWidth = res.getDimensionPixelSize(
+                com.android.internal.R.dimen.docked_stack_divider_thickness);
+        return windowWidth - 2 * dividerInsets;
+    }
+
+    /** Returns the docked-stack side */
+    public static int getDockSide(int displayWidth, int displayHeight) {
+        return displayWidth > displayHeight ? DOCKED_LEFT : DOCKED_TOP;
+    }
 }
diff --git a/core/java/com/android/internal/policy/PhoneWindow.java b/core/java/com/android/internal/policy/PhoneWindow.java
index 775368b..24222d3 100644
--- a/core/java/com/android/internal/policy/PhoneWindow.java
+++ b/core/java/com/android/internal/policy/PhoneWindow.java
@@ -335,7 +335,7 @@
         super(context);
         mLayoutInflater = LayoutInflater.from(context);
         mRenderShadowsInCompositor = Settings.Global.getInt(context.getContentResolver(),
-                DEVELOPMENT_RENDER_SHADOWS_IN_COMPOSITOR, 0) != 0;
+                DEVELOPMENT_RENDER_SHADOWS_IN_COMPOSITOR, 1) != 0;
     }
 
     /**
diff --git a/core/java/com/android/server/SystemConfig.java b/core/java/com/android/server/SystemConfig.java
index 578c0cc..3378c07 100644
--- a/core/java/com/android/server/SystemConfig.java
+++ b/core/java/com/android/server/SystemConfig.java
@@ -1160,6 +1160,10 @@
             addFeature(PackageManager.FEATURE_INCREMENTAL_DELIVERY, 0);
         }
 
+        if (PackageManager.APP_ENUMERATION_ENABLED_BY_DEFAULT) {
+            addFeature(PackageManager.FEATURE_APP_ENUMERATION, 0);
+        }
+
         for (String featureName : mUnavailableFeatures) {
             removeFeature(featureName);
         }
diff --git a/core/jni/Android.bp b/core/jni/Android.bp
index 900445c..5912f40 100644
--- a/core/jni/Android.bp
+++ b/core/jni/Android.bp
@@ -153,7 +153,7 @@
                 "android_util_Binder.cpp",
                 "android_util_MemoryIntArray.cpp",
                 "android_util_Process.cpp",
-                "android_media_AudioDevice.cpp",
+                "android_media_AudioDeviceAttributes.cpp",
                 "android_media_AudioEffectDescriptor.cpp",
                 "android_media_AudioRecord.cpp",
                 "android_media_AudioSystem.cpp",
@@ -197,8 +197,11 @@
                 "android_content_res_ObbScanner.cpp",
                 "android_content_res_Configuration.cpp",
                 "android_security_Scrypt.cpp",
+                "com_android_internal_content_om_OverlayConfig.cpp",
                 "com_android_internal_os_ClassLoaderFactory.cpp",
                 "com_android_internal_os_FuseAppLoop.cpp",
+                "com_android_internal_os_KernelCpuUidBpfMapReader.cpp",
+                "com_android_internal_os_KernelSingleUidTimeReader.cpp",
                 "com_android_internal_os_Zygote.cpp",
                 "com_android_internal_os_ZygoteInit.cpp",
                 "hwbinder/EphemeralStorage.cpp",
@@ -273,6 +276,7 @@
                 "libdl",
                 "libdl_android",
                 "libstatslog",
+                "libtimeinstate",
                 "server_configurable_flags",
                 "libstatspull",
             ],
diff --git a/core/jni/AndroidRuntime.cpp b/core/jni/AndroidRuntime.cpp
index d790ada..4879478 100644
--- a/core/jni/AndroidRuntime.cpp
+++ b/core/jni/AndroidRuntime.cpp
@@ -86,7 +86,7 @@
 extern int register_android_hardware_UsbRequest(JNIEnv *env);
 extern int register_android_hardware_location_ActivityRecognitionHardware(JNIEnv* env);
 
-extern int register_android_media_AudioDevice(JNIEnv* env);
+extern int register_android_media_AudioDeviceAttributes(JNIEnv* env);
 extern int register_android_media_AudioEffectDescriptor(JNIEnv *env);
 extern int register_android_media_AudioRecord(JNIEnv *env);
 extern int register_android_media_AudioSystem(JNIEnv *env);
@@ -186,8 +186,11 @@
 extern int register_android_animation_PropertyValuesHolder(JNIEnv *env);
 extern int register_android_security_Scrypt(JNIEnv *env);
 extern int register_com_android_internal_content_NativeLibraryHelper(JNIEnv *env);
+extern int register_com_android_internal_content_om_OverlayConfig(JNIEnv *env);
 extern int register_com_android_internal_os_ClassLoaderFactory(JNIEnv* env);
 extern int register_com_android_internal_os_FuseAppLoop(JNIEnv* env);
+extern int register_com_android_internal_os_KernelCpuUidBpfMapReader(JNIEnv *env);
+extern int register_com_android_internal_os_KernelSingleUidTimeReader(JNIEnv *env);
 extern int register_com_android_internal_os_Zygote(JNIEnv *env);
 extern int register_com_android_internal_os_ZygoteInit(JNIEnv *env);
 extern int register_com_android_internal_util_VirtualRefBasePtr(JNIEnv *env);
@@ -1497,6 +1500,7 @@
         REG_JNI(register_android_os_MemoryFile),
         REG_JNI(register_android_os_SharedMemory),
         REG_JNI(register_android_os_incremental_IncrementalManager),
+        REG_JNI(register_com_android_internal_content_om_OverlayConfig),
         REG_JNI(register_com_android_internal_os_ClassLoaderFactory),
         REG_JNI(register_com_android_internal_os_Zygote),
         REG_JNI(register_com_android_internal_os_ZygoteInit),
@@ -1513,7 +1517,7 @@
         REG_JNI(register_android_hardware_UsbDeviceConnection),
         REG_JNI(register_android_hardware_UsbRequest),
         REG_JNI(register_android_hardware_location_ActivityRecognitionHardware),
-        REG_JNI(register_android_media_AudioDevice),
+        REG_JNI(register_android_media_AudioDeviceAttributes),
         REG_JNI(register_android_media_AudioEffectDescriptor),
         REG_JNI(register_android_media_AudioSystem),
         REG_JNI(register_android_media_AudioRecord),
@@ -1558,6 +1562,8 @@
         REG_JNI(register_android_security_Scrypt),
         REG_JNI(register_com_android_internal_content_NativeLibraryHelper),
         REG_JNI(register_com_android_internal_os_FuseAppLoop),
+        REG_JNI(register_com_android_internal_os_KernelCpuUidBpfMapReader),
+        REG_JNI(register_com_android_internal_os_KernelSingleUidTimeReader),
 };
 
 /*
diff --git a/core/jni/android/graphics/Bitmap.cpp b/core/jni/android/graphics/Bitmap.cpp
index 30e914d..130322a 100755
--- a/core/jni/android/graphics/Bitmap.cpp
+++ b/core/jni/android/graphics/Bitmap.cpp
@@ -19,11 +19,10 @@
 #include <utils/Color.h>
 
 #ifdef __ANDROID__ // Layoutlib does not support graphic buffer, parcel or render thread
-#include <binder/Parcel.h>
-#include <renderthread/RenderProxy.h>
 #include <android_runtime/android_graphics_GraphicBuffer.h>
-#include <android_runtime/android_hardware_HardwareBuffer.h>
-#include <private/android/AHardwareBufferHelpers.h>
+#include <binder/Parcel.h>
+#include <dlfcn.h>
+#include <renderthread/RenderProxy.h>
 #endif
 
 #include "core_jni_helpers.h"
@@ -1027,11 +1026,18 @@
     return createBitmap(env, bitmap.release(), getPremulBitmapCreateFlags(false));
 }
 
+#ifdef __ANDROID__ // Layoutlib does not support graphic buffer
+typedef AHardwareBuffer* (*AHB_from_HB)(JNIEnv*, jobject);
+AHB_from_HB AHardwareBuffer_fromHardwareBuffer;
+
+typedef jobject (*AHB_to_HB)(JNIEnv*, AHardwareBuffer*);
+AHB_to_HB AHardwareBuffer_toHardwareBuffer;
+#endif
+
 static jobject Bitmap_wrapHardwareBufferBitmap(JNIEnv* env, jobject, jobject hardwareBuffer,
                                                jlong colorSpacePtr) {
 #ifdef __ANDROID__ // Layoutlib does not support graphic buffer
-    AHardwareBuffer* buffer = android_hardware_HardwareBuffer_getNativeHardwareBuffer(env,
-        hardwareBuffer);
+    AHardwareBuffer* buffer = AHardwareBuffer_fromHardwareBuffer(env, hardwareBuffer);
     sk_sp<Bitmap> bitmap = Bitmap::createFrom(buffer,
                                               GraphicsJNI::getNativeColorSpace(colorSpacePtr));
     if (!bitmap.get()) {
@@ -1057,6 +1063,19 @@
 #endif
 }
 
+static jobject Bitmap_getHardwareBuffer(JNIEnv* env, jobject, jlong bitmapPtr) {
+#ifdef __ANDROID__ // Layoutlib does not support graphic buffer
+    LocalScopedBitmap bitmapHandle(bitmapPtr);
+    LOG_ALWAYS_FATAL_IF(!bitmapHandle->isHardware(),
+            "Hardware config is only supported config in Bitmap_getHardwareBuffer");
+
+    Bitmap& bitmap = bitmapHandle->bitmap();
+    return AHardwareBuffer_toHardwareBuffer(env, bitmap.hardwareBuffer());
+#else
+    return NULL;
+#endif
+}
+
 static jboolean Bitmap_isImmutable(CRITICAL_JNI_PARAMS_COMMA jlong bitmapHandle) {
     LocalScopedBitmap bitmapHolder(bitmapHandle);
     if (!bitmapHolder.valid()) return JNI_FALSE;
@@ -1123,6 +1142,8 @@
         (void*) Bitmap_wrapHardwareBufferBitmap },
     {   "nativeCreateGraphicBufferHandle", "(J)Landroid/graphics/GraphicBuffer;",
         (void*) Bitmap_createGraphicBufferHandle },
+    {   "nativeGetHardwareBuffer", "(J)Landroid/hardware/HardwareBuffer;",
+        (void*) Bitmap_getHardwareBuffer },
     {   "nativeComputeColorSpace",  "(J)Landroid/graphics/ColorSpace;", (void*)Bitmap_computeColorSpace },
     {   "nativeSetColorSpace",      "(JJ)V", (void*)Bitmap_setColorSpace },
     {   "nativeIsSRGB",             "(J)Z", (void*)Bitmap_isSRGB },
@@ -1140,6 +1161,18 @@
     gBitmap_nativePtr = GetFieldIDOrDie(env, gBitmap_class, "mNativePtr", "J");
     gBitmap_constructorMethodID = GetMethodIDOrDie(env, gBitmap_class, "<init>", "(JIIIZ[BLandroid/graphics/NinePatch$InsetStruct;Z)V");
     gBitmap_reinitMethodID = GetMethodIDOrDie(env, gBitmap_class, "reinit", "(IIZ)V");
+
+#ifdef __ANDROID__ // Layoutlib does not support graphic buffer
+    void* handle_ = dlopen("libandroid.so", RTLD_NOW | RTLD_NODELETE);
+    AHardwareBuffer_fromHardwareBuffer =
+            (AHB_from_HB)dlsym(handle_, "AHardwareBuffer_fromHardwareBuffer");
+    LOG_ALWAYS_FATAL_IF(AHardwareBuffer_fromHardwareBuffer == nullptr,
+                        "Failed to find required symbol AHardwareBuffer_fromHardwareBuffer!");
+
+    AHardwareBuffer_toHardwareBuffer = (AHB_to_HB)dlsym(handle_, "AHardwareBuffer_toHardwareBuffer");
+    LOG_ALWAYS_FATAL_IF(AHardwareBuffer_toHardwareBuffer == nullptr,
+                        " Failed to find required symbol AHardwareBuffer_toHardwareBuffer!");
+#endif
     return android::RegisterMethodsOrDie(env, "android/graphics/Bitmap", gBitmapMethods,
                                          NELEM(gBitmapMethods));
 }
diff --git a/core/jni/android_media_AudioDevice.cpp b/core/jni/android_media_AudioDeviceAttributes.cpp
similarity index 64%
rename from core/jni/android_media_AudioDevice.cpp
rename to core/jni/android_media_AudioDeviceAttributes.cpp
index f6a0e4b..e79c95e 100644
--- a/core/jni/android_media_AudioDevice.cpp
+++ b/core/jni/android_media_AudioDeviceAttributes.cpp
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-#include "android_media_AudioDevice.h"
+#include "android_media_AudioDeviceAttributes.h"
 #include "android_media_AudioErrors.h"
 #include "core_jni_helpers.h"
 
@@ -22,29 +22,30 @@
 
 using namespace android;
 
-static jclass gAudioDeviceClass;
-static jmethodID gAudioDeviceCstor;
+static jclass gAudioDeviceAttributesClass;
+static jmethodID gAudioDeviceAttributesCstor;
 
 namespace android {
 
-jint createAudioDeviceFromNative(JNIEnv *env, jobject *jAudioDevice,
+jint createAudioDeviceAttributesFromNative(JNIEnv *env, jobject *jAudioDeviceAttributes,
                                  const AudioDeviceTypeAddr *devTypeAddr) {
     jint jStatus = (jint)AUDIO_JAVA_SUCCESS;
     jint jNativeType = (jint)devTypeAddr->mType;
     ScopedLocalRef<jstring> jAddress(env, env->NewStringUTF(devTypeAddr->mAddress.data()));
 
-    *jAudioDevice =
-            env->NewObject(gAudioDeviceClass, gAudioDeviceCstor, jNativeType, jAddress.get());
+    *jAudioDeviceAttributes = env->NewObject(gAudioDeviceAttributesClass, gAudioDeviceAttributesCstor,
+            jNativeType, jAddress.get());
 
     return jStatus;
 }
 
 } // namespace android
 
-int register_android_media_AudioDevice(JNIEnv *env) {
-    jclass audioDeviceTypeAddressClass = FindClassOrDie(env, "android/media/AudioDevice");
-    gAudioDeviceClass = MakeGlobalRefOrDie(env, audioDeviceTypeAddressClass);
-    gAudioDeviceCstor =
+int register_android_media_AudioDeviceAttributes(JNIEnv *env) {
+    jclass audioDeviceTypeAddressClass =
+            FindClassOrDie(env, "android/media/AudioDeviceAttributes");
+    gAudioDeviceAttributesClass = MakeGlobalRefOrDie(env, audioDeviceTypeAddressClass);
+    gAudioDeviceAttributesCstor =
             GetMethodIDOrDie(env, audioDeviceTypeAddressClass, "<init>", "(ILjava/lang/String;)V");
 
     return 0;
diff --git a/core/jni/android_media_AudioDevice.h b/core/jni/android_media_AudioDeviceAttributes.h
similarity index 75%
rename from core/jni/android_media_AudioDevice.h
rename to core/jni/android_media_AudioDeviceAttributes.h
index fc92334..b49d9ba 100644
--- a/core/jni/android_media_AudioDevice.h
+++ b/core/jni/android_media_AudioDeviceAttributes.h
@@ -14,8 +14,8 @@
  * limitations under the License.
  */
 
-#ifndef ANDROID_MEDIA_AUDIODEVICE_H
-#define ANDROID_MEDIA_AUDIODEVICE_H
+#ifndef ANDROID_MEDIA_AUDIODEVICEATTRIBUTES_H
+#define ANDROID_MEDIA_AUDIODEVICEATTRIBUTES_H
 
 #include <media/AudioDeviceTypeAddr.h>
 #include <system/audio.h>
@@ -24,9 +24,9 @@
 
 namespace android {
 
-// Create a Java AudioDevice instance from a C++ AudioDeviceTypeAddress
+// Create a Java AudioDeviceAttributes instance from a C++ AudioDeviceTypeAddress
 
-extern jint createAudioDeviceFromNative(JNIEnv *env, jobject *jAudioDevice,
+extern jint createAudioDeviceAttributesFromNative(JNIEnv *env, jobject *jAudioDeviceAttributes,
                                         const AudioDeviceTypeAddr *devTypeAddr);
 } // namespace android
 
diff --git a/core/jni/android_media_AudioSystem.cpp b/core/jni/android_media_AudioSystem.cpp
index d8f30e9..ab3cf30 100644
--- a/core/jni/android_media_AudioSystem.cpp
+++ b/core/jni/android_media_AudioSystem.cpp
@@ -34,7 +34,7 @@
 #include <system/audio.h>
 #include <system/audio_policy.h>
 #include "android_media_AudioAttributes.h"
-#include "android_media_AudioDevice.h"
+#include "android_media_AudioDeviceAttributes.h"
 #include "android_media_AudioEffectDescriptor.h"
 #include "android_media_AudioErrors.h"
 #include "android_media_AudioFormat.h"
@@ -2352,7 +2352,7 @@
         jint strategy, jobjectArray jDeviceArray)
 {
     if (jDeviceArray == nullptr || env->GetArrayLength(jDeviceArray) != 1) {
-        ALOGE("%s invalid array to store AudioDevice", __FUNCTION__);
+        ALOGE("%s invalid array to store AudioDeviceAttributes", __FUNCTION__);
         return (jint)AUDIO_JAVA_BAD_VALUE;
     }
 
@@ -2362,10 +2362,10 @@
     if (status != NO_ERROR) {
         return (jint) status;
     }
-    jobject jAudioDevice = NULL;
-    jint jStatus = createAudioDeviceFromNative(env, &jAudioDevice, &elDevice);
+    jobject jAudioDeviceAttributes = NULL;
+    jint jStatus = createAudioDeviceAttributesFromNative(env, &jAudioDeviceAttributes, &elDevice);
     if (jStatus == AUDIO_JAVA_SUCCESS) {
-        env->SetObjectArrayElement(jDeviceArray, 0, jAudioDevice);
+        env->SetObjectArrayElement(jDeviceArray, 0, jAudioDeviceAttributes);
     }
     return jStatus;
 }
@@ -2380,7 +2380,7 @@
     // with reverse JNI to make the array grow as need as this would be less efficient, and some
     // components call this method often
     if (jDeviceArray == nullptr || maxResultSize == 0) {
-        ALOGE("%s invalid array to store AudioDevice", __FUNCTION__);
+        ALOGE("%s invalid array to store AudioDeviceAttributes", __FUNCTION__);
         return (jint)AUDIO_JAVA_BAD_VALUE;
     }
 
@@ -2401,13 +2401,13 @@
         return AUDIO_JAVA_INVALID_OPERATION;
     }
     size_t index = 0;
-    jobject jAudioDevice = NULL;
+    jobject jAudioDeviceAttributes = NULL;
     for (const auto& device : devices) {
-        jStatus = createAudioDeviceFromNative(env, &jAudioDevice, &device);
+        jStatus = createAudioDeviceAttributesFromNative(env, &jAudioDeviceAttributes, &device);
         if (jStatus != AUDIO_JAVA_SUCCESS) {
             return jStatus;
         }
-        env->SetObjectArrayElement(jDeviceArray, index++, jAudioDevice);
+        env->SetObjectArrayElement(jDeviceArray, index++, jAudioDeviceAttributes);
     }
     return jStatus;
 }
@@ -2519,10 +2519,10 @@
           (void *)android_media_AudioSystem_setPreferredDeviceForStrategy},
          {"removePreferredDeviceForStrategy", "(I)I",
           (void *)android_media_AudioSystem_removePreferredDeviceForStrategy},
-         {"getPreferredDeviceForStrategy", "(I[Landroid/media/AudioDevice;)I",
+         {"getPreferredDeviceForStrategy", "(I[Landroid/media/AudioDeviceAttributes;)I",
           (void *)android_media_AudioSystem_getPreferredDeviceForStrategy},
          {"getDevicesForAttributes",
-          "(Landroid/media/AudioAttributes;[Landroid/media/AudioDevice;)I",
+          "(Landroid/media/AudioAttributes;[Landroid/media/AudioDeviceAttributes;)I",
           (void *)android_media_AudioSystem_getDevicesForAttributes},
          {"setUserIdDeviceAffinities", "(I[I[Ljava/lang/String;)I",
           (void *)android_media_AudioSystem_setUserIdDeviceAffinities},
diff --git a/core/jni/android_view_Surface.cpp b/core/jni/android_view_Surface.cpp
index b01083b..8a53bd0 100644
--- a/core/jni/android_view_Surface.cpp
+++ b/core/jni/android_view_Surface.cpp
@@ -413,10 +413,15 @@
     return anw->perform(surface, NATIVE_WINDOW_SET_AUTO_REFRESH, int(enabled));
 }
 
-static jint nativeSetFrameRate(JNIEnv* env, jclass clazz, jlong nativeObject, jfloat frameRate) {
+static jint nativeSetFrameRate(JNIEnv* env, jclass clazz, jlong nativeObject, jfloat frameRate,
+                               jint compatibility) {
     Surface* surface = reinterpret_cast<Surface*>(nativeObject);
     ANativeWindow* anw = static_cast<ANativeWindow*>(surface);
-    return anw->perform(surface, NATIVE_WINDOW_SET_FRAME_RATE, float(frameRate));
+    // Our compatibility is a Surface.FRAME_RATE_COMPATIBILITY_* value, and
+    // NATIVE_WINDOW_SET_FRAME_RATE takes an
+    // ANATIVEWINDOW_FRAME_RATE_COMPATIBILITY_* value. The values are identical
+    // though, so no need to explicitly convert.
+    return anw->perform(surface, NATIVE_WINDOW_SET_FRAME_RATE, float(frameRate), compatibility);
 }
 
 // ----------------------------------------------------------------------------
@@ -453,7 +458,7 @@
             (void*)nativeAttachAndQueueBufferWithColorSpace},
     {"nativeSetSharedBufferModeEnabled", "(JZ)I", (void*)nativeSetSharedBufferModeEnabled},
     {"nativeSetAutoRefreshEnabled", "(JZ)I", (void*)nativeSetAutoRefreshEnabled},
-    {"nativeSetFrameRate", "(JF)I", (void*)nativeSetFrameRate},
+    {"nativeSetFrameRate", "(JFI)I", (void*)nativeSetFrameRate},
 };
 
 int register_android_view_Surface(JNIEnv* env)
diff --git a/core/jni/android_view_SurfaceControl.cpp b/core/jni/android_view_SurfaceControl.cpp
index ce9a048..a9ef257 100644
--- a/core/jni/android_view_SurfaceControl.cpp
+++ b/core/jni/android_view_SurfaceControl.cpp
@@ -37,6 +37,7 @@
 #include <stdio.h>
 #include <system/graphics.h>
 #include <ui/ConfigStoreTypes.h>
+#include <ui/DeviceProductInfo.h>
 #include <ui/DisplayConfig.h>
 #include <ui/DisplayInfo.h>
 #include <ui/DisplayedFrameStats.h>
@@ -65,9 +66,19 @@
 static struct {
     jclass clazz;
     jmethodID ctor;
+} gIntegerClassInfo;
+
+static jobject toInteger(JNIEnv* env, int32_t i) {
+    return env->NewObject(gIntegerClassInfo.clazz, gIntegerClassInfo.ctor, i);
+}
+
+static struct {
+    jclass clazz;
+    jmethodID ctor;
     jfieldID isInternal;
     jfieldID density;
     jfieldID secure;
+    jfieldID deviceProductInfo;
 } gDisplayInfoClassInfo;
 
 static struct {
@@ -111,6 +122,16 @@
 
 static struct {
     jclass clazz;
+    jmethodID ctor;
+} gDeviceProductInfoClassInfo;
+
+static struct {
+    jclass clazz;
+    jmethodID ctor;
+} gDeviceProductInfoManufactureDateClassInfo;
+
+static struct {
+    jclass clazz;
     jmethodID builder;
 } gGraphicBufferClassInfo;
 
@@ -236,7 +257,6 @@
 
 static void nativeRelease(JNIEnv* env, jclass clazz, jlong nativeObject) {
     sp<SurfaceControl> ctrl(reinterpret_cast<SurfaceControl *>(nativeObject));
-    ctrl->release();
     ctrl->decStrong((void *)nativeCreate);
 }
 
@@ -593,11 +613,14 @@
 }
 
 static void nativeSetFrameRate(JNIEnv* env, jclass clazz, jlong transactionObj, jlong nativeObject,
-                               jfloat frameRate) {
+                               jfloat frameRate, jint compatibility) {
     auto transaction = reinterpret_cast<SurfaceComposerClient::Transaction*>(transactionObj);
 
     const auto ctrl = reinterpret_cast<SurfaceControl*>(nativeObject);
-    transaction->setFrameRate(ctrl, frameRate);
+    // Our compatibility is a Surface.FRAME_RATE_COMPATIBILITY_* value, and
+    // Transaction::setFrameRate() takes an ANATIVEWINDOW_FRAME_RATE_COMPATIBILITY_* value. The
+    // values are identical though, so no need to convert anything.
+    transaction->setFrameRate(ctrl, frameRate, static_cast<int8_t>(compatibility));
 }
 
 static jlongArray nativeGetPhysicalDisplayIds(JNIEnv* env, jclass clazz) {
@@ -774,6 +797,41 @@
     }
 }
 
+static jobject convertDeviceProductInfoToJavaObject(
+        JNIEnv* env, const std::optional<DeviceProductInfo>& info) {
+    using ModelYear = android::DeviceProductInfo::ModelYear;
+    using ManufactureYear = android::DeviceProductInfo::ManufactureYear;
+    using ManufactureWeekAndYear = android::DeviceProductInfo::ManufactureWeekAndYear;
+
+    if (!info) return nullptr;
+    jstring name = env->NewStringUTF(info->name.data());
+    jstring manufacturerPnpId = env->NewStringUTF(info->manufacturerPnpId.data());
+    jobject productId = env->NewStringUTF(info->productId.data());
+    const auto& date = info->manufactureOrModelDate;
+    jobject modelYear, manufactureDate;
+    if (const auto* model = std::get_if<ModelYear>(&date)) {
+        modelYear = toInteger(env, model->year);
+        manufactureDate = nullptr;
+    } else if (const auto* manufactureWeekAndYear = std::get_if<ManufactureWeekAndYear>(&date)) {
+        modelYear = nullptr;
+        manufactureDate = env->NewObject(gDeviceProductInfoManufactureDateClassInfo.clazz,
+                                               gDeviceProductInfoManufactureDateClassInfo.ctor,
+                                               toInteger(env, manufactureWeekAndYear->week),
+                                               toInteger(env, manufactureWeekAndYear->year));
+    } else if (const auto* manufactureYear = std::get_if<ManufactureYear>(&date)) {
+        modelYear = nullptr;
+        manufactureDate = env->NewObject(gDeviceProductInfoManufactureDateClassInfo.clazz,
+                                       gDeviceProductInfoManufactureDateClassInfo.ctor,
+                                       nullptr,
+                                       toInteger(env, manufactureYear->year));
+    } else {
+        LOG_FATAL("Unknown alternative for variant DeviceProductInfo::ManufactureOrModelDate");
+    }
+
+    return env->NewObject(gDeviceProductInfoClassInfo.clazz, gDeviceProductInfoClassInfo.ctor, name,
+                          manufacturerPnpId, productId, modelYear, manufactureDate);
+}
+
 static jobject nativeGetDisplayInfo(JNIEnv* env, jclass clazz, jobject tokenObj) {
     DisplayInfo info;
     if (const auto token = ibinderForJavaObject(env, tokenObj);
@@ -786,6 +844,8 @@
                          info.connectionType == DisplayConnectionType::Internal);
     env->SetFloatField(object, gDisplayInfoClassInfo.density, info.density);
     env->SetBooleanField(object, gDisplayInfoClassInfo.secure, info.secure);
+    env->SetObjectField(object, gDisplayInfoClassInfo.deviceProductInfo,
+                        convertDeviceProductInfoToJavaObject(env, info.deviceProductInfo));
     return object;
 }
 
@@ -1410,7 +1470,7 @@
             (void*)nativeSetLayerStack },
     {"nativeSetShadowRadius", "(JJF)V",
             (void*)nativeSetShadowRadius },
-    {"nativeSetFrameRate", "(JJF)V",
+    {"nativeSetFrameRate", "(JJFI)V",
             (void*)nativeSetFrameRate },
     {"nativeGetPhysicalDisplayIds", "()[J",
             (void*)nativeGetPhysicalDisplayIds },
@@ -1528,12 +1588,19 @@
     int err = RegisterMethodsOrDie(env, "android/view/SurfaceControl",
             sSurfaceControlMethods, NELEM(sSurfaceControlMethods));
 
+    jclass integerClass = FindClassOrDie(env, "java/lang/Integer");
+    gIntegerClassInfo.clazz = MakeGlobalRefOrDie(env, integerClass);
+    gIntegerClassInfo.ctor = GetMethodIDOrDie(env, gIntegerClassInfo.clazz, "<init>", "(I)V");
+
     jclass infoClazz = FindClassOrDie(env, "android/view/SurfaceControl$DisplayInfo");
     gDisplayInfoClassInfo.clazz = MakeGlobalRefOrDie(env, infoClazz);
     gDisplayInfoClassInfo.ctor = GetMethodIDOrDie(env, infoClazz, "<init>", "()V");
     gDisplayInfoClassInfo.isInternal = GetFieldIDOrDie(env, infoClazz, "isInternal", "Z");
     gDisplayInfoClassInfo.density = GetFieldIDOrDie(env, infoClazz, "density", "F");
     gDisplayInfoClassInfo.secure = GetFieldIDOrDie(env, infoClazz, "secure", "Z");
+    gDisplayInfoClassInfo.deviceProductInfo =
+            GetFieldIDOrDie(env, infoClazz, "deviceProductInfo",
+                            "Landroid/hardware/display/DeviceProductInfo;");
 
     jclass configClazz = FindClassOrDie(env, "android/view/SurfaceControl$DisplayConfig");
     gDisplayConfigClassInfo.clazz = MakeGlobalRefOrDie(env, configClazz);
@@ -1574,6 +1641,25 @@
     gHdrCapabilitiesClassInfo.ctor = GetMethodIDOrDie(env, hdrCapabilitiesClazz, "<init>",
             "([IFFF)V");
 
+    jclass deviceProductInfoClazz =
+            FindClassOrDie(env, "android/hardware/display/DeviceProductInfo");
+    gDeviceProductInfoClassInfo.clazz = MakeGlobalRefOrDie(env, deviceProductInfoClazz);
+    gDeviceProductInfoClassInfo.ctor =
+            GetMethodIDOrDie(env, deviceProductInfoClazz, "<init>",
+                             "(Ljava/lang/String;"
+                             "Ljava/lang/String;"
+                             "Ljava/lang/String;"
+                             "Ljava/lang/Integer;"
+                             "Landroid/hardware/display/DeviceProductInfo$ManufactureDate;)V");
+
+    jclass deviceProductInfoManufactureDateClazz =
+            FindClassOrDie(env, "android/hardware/display/DeviceProductInfo$ManufactureDate");
+    gDeviceProductInfoManufactureDateClassInfo.clazz =
+            MakeGlobalRefOrDie(env, deviceProductInfoManufactureDateClazz);
+    gDeviceProductInfoManufactureDateClassInfo.ctor =
+            GetMethodIDOrDie(env, deviceProductInfoManufactureDateClazz, "<init>",
+                             "(Ljava/lang/Integer;Ljava/lang/Integer;)V");
+
     jclass graphicsBufferClazz = FindClassOrDie(env, "android/graphics/GraphicBuffer");
     gGraphicBufferClassInfo.clazz = MakeGlobalRefOrDie(env, graphicsBufferClazz);
     gGraphicBufferClassInfo.builder = GetStaticMethodIDOrDie(env, graphicsBufferClazz,
diff --git a/core/jni/com_android_internal_content_om_OverlayConfig.cpp b/core/jni/com_android_internal_content_om_OverlayConfig.cpp
new file mode 100644
index 0000000..6aa7c10
--- /dev/null
+++ b/core/jni/com_android_internal_content_om_OverlayConfig.cpp
@@ -0,0 +1,122 @@
+/*
+ * 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 <sstream>
+#include <string>
+#include <vector>
+
+#include <nativehelper/JNIHelp.h>
+#include "jni.h"
+#include "core_jni_helpers.h"
+
+#include "android-base/logging.h"
+#include "androidfw/PosixUtils.h"
+
+using ::android::util::ExecuteBinary;
+
+static jclass g_stringClass = nullptr;
+
+static jobjectArray createIdmap(JNIEnv* env, jclass /*clazz*/, jstring targetPath,
+                           jobjectArray overlayPath, jobjectArray policies,
+                           jboolean enforceOverlayable) {
+  if (access("/system/bin/idmap2", X_OK) == -1) {
+    PLOG(WARNING) << "unable to execute idmap2";
+    return nullptr;
+  }
+
+  const char* targetApkPath = env->GetStringUTFChars(targetPath, NULL /* isCopy */);
+  std::vector<std::string> argv{"/system/bin/idmap2",
+    "create-multiple",
+    "--target-apk-path", targetApkPath,
+  };
+  env->ReleaseStringUTFChars(targetPath, targetApkPath);
+
+  // Add the overlays for which to generate idmap files to the idmap arguments.
+  for (size_t i = 0, count = env->GetArrayLength(overlayPath); i < count; ++i) {
+    jstring element = (jstring) env->GetObjectArrayElement(overlayPath, i);
+    const char* overlayApkPath = env->GetStringUTFChars(element, NULL /* isCopy */);
+    argv.emplace_back("--overlay-apk-path");
+    argv.emplace_back(overlayApkPath);
+    env->ReleaseStringUTFChars(element, overlayApkPath);
+  }
+
+  // Add the policies the overlays fulfill to the idmap arguments.
+  for (size_t i = 0, count = env->GetArrayLength(policies); i < count; ++i) {
+    jstring element = (jstring)env->GetObjectArrayElement(policies, i);
+    const char* policy = env->GetStringUTFChars(element, NULL /* isCopy */);
+    argv.emplace_back("--policy");
+    argv.emplace_back(policy);
+    env->ReleaseStringUTFChars(element, policy);
+  }
+
+  if (!enforceOverlayable) {
+    argv.emplace_back("--ignore-overlayable");
+  }
+
+  const auto result = ExecuteBinary(argv);
+  if (!result) {
+      LOG(ERROR) << "failed to execute idmap2";
+      return nullptr;
+  }
+
+  if (result->status != 0) {
+    LOG(ERROR) << "idmap2: " << result->stderr;
+    return nullptr;
+  }
+
+  // Return the paths of the idmaps created or updated during the idmap invocation.
+  std::vector<std::string> idmap_paths;
+  std::istringstream input(result->stdout);
+  std::string path;
+  while (std::getline(input, path)) {
+    idmap_paths.push_back(path);
+  }
+
+  jobjectArray array = env->NewObjectArray(idmap_paths.size(), g_stringClass, nullptr);
+  if (array == nullptr) {
+    return nullptr;
+  }
+  for (size_t i = 0; i < idmap_paths.size(); i++) {
+    const std::string path = idmap_paths[i];
+    jstring java_string = env->NewStringUTF(path.c_str());
+    if (env->ExceptionCheck()) {
+      return nullptr;
+    }
+    env->SetObjectArrayElement(array, i, java_string);
+    env->DeleteLocalRef(java_string);
+  }
+
+  return array;
+}
+
+static const JNINativeMethod g_methods[] = {
+    { "createIdmap",
+      "(Ljava/lang/String;[Ljava/lang/String;[Ljava/lang/String;Z)[Ljava/lang/String;",
+      (void *)createIdmap },
+};
+
+static const char* const kOverlayConfigPathName = "com/android/internal/content/om/OverlayConfig";
+
+namespace android {
+
+int register_com_android_internal_content_om_OverlayConfig(JNIEnv* env) {
+  jclass stringClass = FindClassOrDie(env, "java/lang/String");
+  g_stringClass = MakeGlobalRefOrDie(env, stringClass);
+
+  return RegisterMethodsOrDie(env, kOverlayConfigPathName, g_methods, NELEM(g_methods));
+}
+
+} // namespace android
diff --git a/core/jni/com_android_internal_os_KernelCpuUidBpfMapReader.cpp b/core/jni/com_android_internal_os_KernelCpuUidBpfMapReader.cpp
new file mode 100644
index 0000000..7c68de5
--- /dev/null
+++ b/core/jni/com_android_internal_os_KernelCpuUidBpfMapReader.cpp
@@ -0,0 +1,217 @@
+/*
+ * 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 "core_jni_helpers.h"
+
+#include <sys/sysinfo.h>
+
+#include <android-base/stringprintf.h>
+#include <cputimeinstate.h>
+
+namespace android {
+
+static constexpr uint64_t NSEC_PER_MSEC = 1000000;
+
+static struct {
+    jclass clazz;
+    jmethodID put;
+    jmethodID get;
+} gSparseArrayClassInfo;
+
+static jfieldID gmData;
+
+static jlongArray getUidArray(JNIEnv *env, jobject sparseAr, uint32_t uid, jsize sz) {
+    jlongArray ar = (jlongArray)env->CallObjectMethod(sparseAr, gSparseArrayClassInfo.get, uid);
+    if (!ar) {
+        ar = env->NewLongArray(sz);
+        if (ar == NULL) return ar;
+        env->CallVoidMethod(sparseAr, gSparseArrayClassInfo.put, uid, ar);
+    }
+    return ar;
+}
+
+static void copy2DVecToArray(JNIEnv *env, jlongArray ar, std::vector<std::vector<uint64_t>> &vec) {
+    jsize start = 0;
+    for (auto &subVec : vec) {
+        for (uint32_t i = 0; i < subVec.size(); ++i) subVec[i] /= NSEC_PER_MSEC;
+        env->SetLongArrayRegion(ar, start, subVec.size(),
+                                reinterpret_cast<const jlong *>(subVec.data()));
+        start += subVec.size();
+    }
+}
+
+static jboolean KernelCpuUidFreqTimeBpfMapReader_removeUidRange(JNIEnv *env, jclass, jint startUid,
+                                                                jint endUid) {
+    for (uint32_t uid = startUid; uid <= endUid; ++uid) {
+        if (!android::bpf::clearUidTimes(uid)) return false;
+    }
+    return true;
+}
+
+static jboolean KernelCpuUidFreqTimeBpfMapReader_readBpfData(JNIEnv *env, jobject thiz) {
+    static uint64_t lastUpdate = 0;
+    uint64_t newLastUpdate = lastUpdate;
+    auto sparseAr = env->GetObjectField(thiz, gmData);
+    if (sparseAr == NULL) return false;
+    auto data = android::bpf::getUidsUpdatedCpuFreqTimes(&newLastUpdate);
+    if (!data.has_value()) return false;
+
+    jsize s = 0;
+    for (auto &[uid, times] : *data) {
+        if (s == 0) {
+            for (const auto &subVec : times) s += subVec.size();
+        }
+        jlongArray ar = getUidArray(env, sparseAr, uid, s);
+        if (ar == NULL) return false;
+        copy2DVecToArray(env, ar, times);
+    }
+    lastUpdate = newLastUpdate;
+    return true;
+}
+
+static jlongArray KernelCpuUidFreqTimeBpfMapReader_getDataDimensions(JNIEnv *env, jobject) {
+    auto freqs = android::bpf::getCpuFreqs();
+    if (!freqs) return NULL;
+
+    std::vector<uint64_t> allFreqs;
+    for (const auto &vec : *freqs) std::copy(vec.begin(), vec.end(), std::back_inserter(allFreqs));
+
+    auto ar = env->NewLongArray(allFreqs.size());
+    if (ar != NULL) {
+        env->SetLongArrayRegion(ar, 0, allFreqs.size(),
+                                reinterpret_cast<const jlong *>(allFreqs.data()));
+    }
+    return ar;
+}
+
+static const JNINativeMethod gFreqTimeMethods[] = {
+        {"removeUidRange", "(II)Z", (void *)KernelCpuUidFreqTimeBpfMapReader_removeUidRange},
+        {"readBpfData", "()Z", (void *)KernelCpuUidFreqTimeBpfMapReader_readBpfData},
+        {"getDataDimensions", "()[J", (void *)KernelCpuUidFreqTimeBpfMapReader_getDataDimensions},
+};
+
+static jboolean KernelCpuUidActiveTimeBpfMapReader_readBpfData(JNIEnv *env, jobject thiz) {
+    static uint64_t lastUpdate = 0;
+    uint64_t newLastUpdate = lastUpdate;
+    auto sparseAr = env->GetObjectField(thiz, gmData);
+    if (sparseAr == NULL) return false;
+    auto data = android::bpf::getUidsUpdatedConcurrentTimes(&newLastUpdate);
+    if (!data.has_value()) return false;
+
+    for (auto &[uid, times] : *data) {
+        // TODO: revise calling code so we can divide by NSEC_PER_MSEC here instead
+        for (auto &time : times.active) time /= NSEC_PER_MSEC;
+        jlongArray ar = getUidArray(env, sparseAr, uid, times.active.size());
+        if (ar == NULL) return false;
+        env->SetLongArrayRegion(ar, 0, times.active.size(),
+                                reinterpret_cast<const jlong *>(times.active.data()));
+    }
+    lastUpdate = newLastUpdate;
+    return true;
+}
+
+static jlongArray KernelCpuUidActiveTimeBpfMapReader_getDataDimensions(JNIEnv *env, jobject) {
+    jlong nCpus = get_nprocs_conf();
+
+    auto ar = env->NewLongArray(1);
+    if (ar != NULL) env->SetLongArrayRegion(ar, 0, 1, &nCpus);
+    return ar;
+}
+
+static const JNINativeMethod gActiveTimeMethods[] = {
+        {"readBpfData", "()Z", (void *)KernelCpuUidActiveTimeBpfMapReader_readBpfData},
+        {"getDataDimensions", "()[J", (void *)KernelCpuUidActiveTimeBpfMapReader_getDataDimensions},
+};
+
+static jboolean KernelCpuUidClusterTimeBpfMapReader_readBpfData(JNIEnv *env, jobject thiz) {
+    static uint64_t lastUpdate = 0;
+    uint64_t newLastUpdate = lastUpdate;
+    auto sparseAr = env->GetObjectField(thiz, gmData);
+    if (sparseAr == NULL) return false;
+    auto data = android::bpf::getUidsUpdatedConcurrentTimes(&newLastUpdate);
+    if (!data.has_value()) return false;
+
+    jsize s = 0;
+    for (auto &[uid, times] : *data) {
+        if (s == 0) {
+            for (const auto &subVec : times.policy) s += subVec.size();
+        }
+        jlongArray ar = getUidArray(env, sparseAr, uid, s);
+        if (ar == NULL) return false;
+        copy2DVecToArray(env, ar, times.policy);
+    }
+    lastUpdate = newLastUpdate;
+    return true;
+}
+
+static jlongArray KernelCpuUidClusterTimeBpfMapReader_getDataDimensions(JNIEnv *env, jobject) {
+    auto times = android::bpf::getUidConcurrentTimes(0);
+    if (!times.has_value()) return NULL;
+
+    std::vector<jlong> clusterCores;
+    for (const auto &vec : times->policy) clusterCores.push_back(vec.size());
+    auto ar = env->NewLongArray(clusterCores.size());
+    if (ar != NULL) env->SetLongArrayRegion(ar, 0, clusterCores.size(), clusterCores.data());
+    return ar;
+}
+
+static const JNINativeMethod gClusterTimeMethods[] = {
+        {"readBpfData", "()Z", (void *)KernelCpuUidClusterTimeBpfMapReader_readBpfData},
+        {"getDataDimensions", "()[J",
+         (void *)KernelCpuUidClusterTimeBpfMapReader_getDataDimensions},
+};
+
+struct readerMethods {
+    const char *name;
+    const JNINativeMethod *methods;
+    int numMethods;
+};
+
+static const readerMethods gAllMethods[] = {
+        {"KernelCpuUidFreqTimeBpfMapReader", gFreqTimeMethods, NELEM(gFreqTimeMethods)},
+        {"KernelCpuUidActiveTimeBpfMapReader", gActiveTimeMethods, NELEM(gActiveTimeMethods)},
+        {"KernelCpuUidClusterTimeBpfMapReader", gClusterTimeMethods, NELEM(gClusterTimeMethods)},
+};
+
+static jboolean KernelCpuUidBpfMapReader_startTrackingBpfTimes(JNIEnv *, jobject) {
+    return android::bpf::startTrackingUidTimes();
+}
+
+int register_com_android_internal_os_KernelCpuUidBpfMapReader(JNIEnv *env) {
+    gSparseArrayClassInfo.clazz = FindClassOrDie(env, "android/util/SparseArray");
+    gSparseArrayClassInfo.clazz = MakeGlobalRefOrDie(env, gSparseArrayClassInfo.clazz);
+    gSparseArrayClassInfo.put =
+            GetMethodIDOrDie(env, gSparseArrayClassInfo.clazz, "put", "(ILjava/lang/Object;)V");
+    gSparseArrayClassInfo.get =
+            GetMethodIDOrDie(env, gSparseArrayClassInfo.clazz, "get", "(I)Ljava/lang/Object;");
+    constexpr auto readerName = "com/android/internal/os/KernelCpuUidBpfMapReader";
+    constexpr JNINativeMethod method = {"startTrackingBpfTimes", "()Z",
+                                        (void *)KernelCpuUidBpfMapReader_startTrackingBpfTimes};
+
+    int ret = RegisterMethodsOrDie(env, readerName, &method, 1);
+    if (ret < 0) return ret;
+    auto c = FindClassOrDie(env, readerName);
+    gmData = GetFieldIDOrDie(env, c, "mData", "Landroid/util/SparseArray;");
+
+    for (const auto &m : gAllMethods) {
+        auto fullName = android::base::StringPrintf("%s$%s", readerName, m.name);
+        ret = RegisterMethodsOrDie(env, fullName.c_str(), m.methods, m.numMethods);
+        if (ret < 0) break;
+    }
+    return ret;
+}
+
+} // namespace android
diff --git a/core/jni/com_android_internal_os_KernelSingleUidTimeReader.cpp b/core/jni/com_android_internal_os_KernelSingleUidTimeReader.cpp
new file mode 100644
index 0000000..c0ecf33
--- /dev/null
+++ b/core/jni/com_android_internal_os_KernelSingleUidTimeReader.cpp
@@ -0,0 +1,54 @@
+/*
+ * 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 "core_jni_helpers.h"
+
+#include <cputimeinstate.h>
+
+namespace android {
+
+static constexpr uint64_t NSEC_PER_MSEC = 1000000;
+
+static jlongArray copyVecsToArray(JNIEnv *env, std::vector<std::vector<uint64_t>> &vec) {
+    jsize s = 0;
+    for (const auto &subVec : vec) s += subVec.size();
+    jlongArray ar = env->NewLongArray(s);
+    jsize start = 0;
+    for (auto &subVec : vec) {
+        for (uint32_t i = 0; i < subVec.size(); ++i) subVec[i] /= NSEC_PER_MSEC;
+        env->SetLongArrayRegion(ar, start, subVec.size(),
+                                reinterpret_cast<const jlong*>(subVec.data()));
+        start += subVec.size();
+    }
+    return ar;
+}
+
+static jlongArray getUidCpuFreqTimeMs(JNIEnv *env, jclass, jint uid) {
+    auto out = android::bpf::getUidCpuFreqTimes(uid);
+    if (!out) return env->NewLongArray(0);
+    return copyVecsToArray(env, out.value());
+}
+
+static const JNINativeMethod g_single_methods[] = {
+    {"readBpfData", "(I)[J", (void *)getUidCpuFreqTimeMs},
+};
+
+int register_com_android_internal_os_KernelSingleUidTimeReader(JNIEnv *env) {
+    return RegisterMethodsOrDie(env, "com/android/internal/os/KernelSingleUidTimeReader$Injector",
+                                g_single_methods, NELEM(g_single_methods));
+}
+
+}
diff --git a/core/jni/com_android_internal_os_Zygote.cpp b/core/jni/com_android_internal_os_Zygote.cpp
index d91911c..e4141e0 100644
--- a/core/jni/com_android_internal_os_Zygote.cpp
+++ b/core/jni/com_android_internal_os_Zygote.cpp
@@ -105,10 +105,12 @@
 using namespace std::placeholders;
 
 using android::String8;
+using android::base::ReadFileToString;
 using android::base::StringAppendF;
 using android::base::StringPrintf;
 using android::base::WriteStringToFile;
 using android::base::GetBoolProperty;
+using android::base::GetProperty;
 
 #define CREATE_ERROR(...) StringPrintf("%s:%d: ", __FILE__, __LINE__). \
                               append(StringPrintf(__VA_ARGS__))
@@ -174,6 +176,12 @@
 static const std::string ANDROID_APP_DATA_ISOLATION_ENABLED_PROPERTY =
     "persist.zygote.app_data_isolation";
 
+/**
+ * Property to enable app data isolation for sdcard obb or data in vold.
+ */
+static const std::string ANDROID_VOLD_APP_DATA_ISOLATION_ENABLED_PROPERTY =
+    "persist.sys.vold_app_data_isolation_enabled";
+
 static constexpr const uint64_t UPPER_HALF_WORD_MASK = 0xFFFF'FFFF'0000'0000;
 static constexpr const uint64_t LOWER_HALF_WORD_MASK = 0x0000'0000'FFFF'FFFF;
 
@@ -603,6 +611,15 @@
   }
 }
 
+static bool IsFilesystemSupported(const std::string& fsType) {
+    std::string supported;
+    if (!ReadFileToString("/proc/filesystems", &supported)) {
+        ALOGE("Failed to read supported filesystems");
+        return false;
+    }
+    return supported.find(fsType + "\n") != std::string::npos;
+}
+
 static void PreApplicationInit() {
   // The child process sets this to indicate it's not the zygote.
   android_mallopt(M_SET_ZYGOTE_CHILD, nullptr, 0);
@@ -782,6 +799,31 @@
   }
 }
 
+static void BindMountObbPackage(std::string_view package_name, int userId, fail_fn_t fail_fn) {
+
+  // TODO(148772775): Pass primary volume name from zygote argument to here
+  std::string source;
+  if (IsFilesystemSupported("sdcardfs")) {
+    source = StringPrintf("/mnt/runtime/default/emulated/%d/Android/obb/%s",
+        userId, package_name.data());
+  } else {
+    source = StringPrintf("/mnt/pass_through/%d/emulated/%d/Android/obb/%s",
+        userId, userId, package_name.data());
+  }
+  std::string target(
+      StringPrintf("/storage/emulated/%d/Android/obb/%s", userId, package_name.data()));
+
+  if (access(source.c_str(), F_OK) != 0) {
+    fail_fn(CREATE_ERROR("Cannot access source %s: %s", source.c_str(), strerror(errno)));
+  }
+
+  if (access(target.c_str(), F_OK) != 0) {
+    fail_fn(CREATE_ERROR("Cannot access target %s: %s", target.c_str(), strerror(errno)));
+  }
+
+  BindMount(source, target, fail_fn);
+}
+
 // Create a private mount namespace and bind mount appropriate emulated
 // storage for the given user.
 static void MountEmulatedStorage(uid_t uid, jint mount_mode,
@@ -1504,6 +1546,60 @@
   }
 }
 
+// Bind mount all obb directories that are visible to this app.
+// If app data isolation is not enabled for this process, bind mount the whole obb
+// directory instead.
+static void BindMountAppObbDirs(JNIEnv* env, jobjectArray pkg_data_info_list,
+    uid_t uid, const char* process_name, jstring managed_nice_name, fail_fn_t fail_fn) {
+
+  auto extract_fn = std::bind(ExtractJString, env, process_name, managed_nice_name, _1);
+  const userid_t user_id = multiuser_get_user_id(uid);
+
+  // If FUSE is not ready for this user, skip it
+  // TODO(148772775): Pass primary volume name from zygote argument to here
+  std::string tmp = GetProperty("vold.fuse_running_users", "");
+  std::istringstream fuse_running_users(tmp);
+  bool user_found = false;
+  std::string s;
+  std::string user_id_str = std::to_string(user_id);
+  while (!user_found && std::getline(fuse_running_users, s, ',')) {
+    if (user_id_str == s) {
+      user_found = true;
+    }
+  }
+  if (!user_found) {
+    ALOGI("User %d is not running fuse yet, fuse_running_users=%s", user_id, tmp.c_str());
+    return;
+  }
+
+  // Fuse is ready, so we can start using fuse path.
+  int size = (pkg_data_info_list != nullptr) ? env->GetArrayLength(pkg_data_info_list) : 0;
+
+  if (size == 0) {
+    // App data isolation is not enabled for this process, so we bind mount to whole obb/ dir.
+    std::string source;
+    if (IsFilesystemSupported("sdcardfs")) {
+      source = StringPrintf("/mnt/runtime/default/emulated/%d/Android/obb", user_id);
+    } else {
+      source = StringPrintf("/mnt/pass_through/%d/emulated/%d/Android/obb", user_id, user_id);
+    }
+    std::string target(StringPrintf("/storage/emulated/%d/Android/obb", user_id));
+
+    if (access(source.c_str(), F_OK) != 0) {
+      fail_fn(CREATE_ERROR("Error accessing %s: %s", source.c_str(), strerror(errno)));
+    }
+    BindMount(source, target, fail_fn);
+    return;
+  }
+
+  // Bind mount each package obb directory
+  for (int i = 0; i < size; i += 3) {
+    jstring package_str = (jstring) (env->GetObjectArrayElement(pkg_data_info_list, i));
+    std::string packageName = extract_fn(package_str).value();
+    BindMountObbPackage(packageName, user_id, fail_fn);
+  }
+}
+
 // 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,
@@ -1552,6 +1648,12 @@
     isolateJitProfile(env, pkg_data_info_list, uid, process_name, managed_nice_name, fail_fn);
   }
 
+  if ((mount_external != MOUNT_EXTERNAL_INSTALLER) &&
+        GetBoolProperty(kPropFuse, false) &&
+        GetBoolProperty(ANDROID_VOLD_APP_DATA_ISOLATION_ENABLED_PROPERTY, false)) {
+    BindMountAppObbDirs(env, pkg_data_info_list, uid, process_name, managed_nice_name, fail_fn);
+  }
+
   // If this zygote isn't root, it won't be able to create a process group,
   // since the directory is owned by root.
   if (!is_system_server && getuid() == 0) {
diff --git a/core/proto/android/content/intent.proto b/core/proto/android/content/intent.proto
index 014d71c..26e7dbb 100644
--- a/core/proto/android/content/intent.proto
+++ b/core/proto/android/content/intent.proto
@@ -65,7 +65,7 @@
     optional string identifier = 13 [ (.android.privacy).dest = DEST_EXPLICIT ];
 }
 
-// Next Tag: 11
+// Next Tag: 12
 message IntentFilterProto {
     option (.android.msg_privacy).dest = DEST_AUTOMATIC;
 
@@ -86,6 +86,7 @@
     optional int32 priority = 8;
     optional bool has_partial_types = 9;
     optional bool get_auto_verify = 10;
+    repeated string mime_groups = 11;
 }
 
 message AuthorityEntryProto {
diff --git a/core/proto/android/server/powermanagerservice.proto b/core/proto/android/server/powermanagerservice.proto
index c039570..6850d01 100644
--- a/core/proto/android/server/powermanagerservice.proto
+++ b/core/proto/android/server/powermanagerservice.proto
@@ -366,6 +366,15 @@
     // Whether battery level is low or not.
     optional bool is_battery_level_low = 8;
 
+    // Denotes which threshold should be used for automatic Battery Saver triggering.
+    enum AutomaticTriggerEnum {
+        TRIGGER_PERCENTAGE = 0;
+        TRIGGER_DYNAMIC = 1;
+    }
+    // The value of Global.AUTOMATIC_POWER_SAVE_MODE. This is a cached value, so it could
+    // be slightly different from what's in GlobalSettingsProto.DynamicPowerSavings.
+    optional AutomaticTriggerEnum setting_automatic_trigger = 19;
+
     // The value of Global.LOW_POWER_MODE. This is a cached value, so it could
     // be slightly different from what's in GlobalSettingsProto.LowPowerMode.
     optional bool setting_battery_saver_enabled = 9;
@@ -390,5 +399,18 @@
     // using elapsed realtime as the timebase.
     optional int64 last_adaptive_battery_saver_changed_externally_elapsed = 17;
 
-    // Next tag: 19
+    // The default disable threshold for Dynamic Power Savings enabled battery saver.
+    optional int32 default_dynamic_disable_threshold = 20;
+
+    // When to disable battery saver again if it was enabled due to an external suggestion.
+    // Corresponds to Global.DYNAMIC_POWER_SAVINGS_DISABLE_THRESHOLD. This is a cached value,
+    // so it could be slightly different from what's in GlobalSettingsProto.DynamicPowerSavings.
+    optional int32 dynamic_disable_threshold = 21;
+
+    // Whether we've received a suggestion that battery saver should be on from an external app.
+    // Corresponds to Global.DYNAMIC_POWER_SAVINGS_ENABLED. This is a cached value, so it could
+    // be slightly different from what's in GlobalSettingsProto.DynamicPowerSavings.
+    optional bool dynamic_battery_saver_enabled = 22;
+
+    // Next tag: 23
 }
diff --git a/core/proto/android/server/windowmanagerservice.proto b/core/proto/android/server/windowmanagerservice.proto
index b0b9ce6f..08db454 100644
--- a/core/proto/android/server/windowmanagerservice.proto
+++ b/core/proto/android/server/windowmanagerservice.proto
@@ -275,6 +275,7 @@
     optional float adjust_divider_amount = 25;
     optional bool animating_bounds = 26;
     optional float minimize_amount = 27;
+    optional bool created_by_organizer = 28;
 }
 
 /* represents ActivityRecordProto */
diff --git a/core/proto/android/service/graphicsstats.proto b/core/proto/android/service/graphicsstats.proto
index 2de5b7f..bb654f0 100644
--- a/core/proto/android/service/graphicsstats.proto
+++ b/core/proto/android/service/graphicsstats.proto
@@ -33,8 +33,9 @@
 
 message GraphicsStatsProto {
     enum PipelineType {
-        GL = 0;
-        VULKAN = 1;
+        UNKNOWN = 0;
+        GL = 1;
+        VULKAN = 2;
     }
     option (android.msg_privacy).dest = DEST_AUTOMATIC;
 
diff --git a/core/proto/android/stats/devicepolicy/device_policy_enums.proto b/core/proto/android/stats/devicepolicy/device_policy_enums.proto
index a4e2193..3d8108d 100644
--- a/core/proto/android/stats/devicepolicy/device_policy_enums.proto
+++ b/core/proto/android/stats/devicepolicy/device_policy_enums.proto
@@ -176,4 +176,14 @@
   IS_MANAGED_PROFILE = 149;
   START_ACTIVITY_BY_INTENT = 150;
   BIND_CROSS_PROFILE_SERVICE = 151;
+  PROVISIONING_DPC_SETUP_STARTED = 152;
+  PROVISIONING_DPC_SETUP_COMPLETED = 153;
+  PROVISIONING_ORGANIZATION_OWNED_MANAGED_PROFILE = 154;
+  RESOLVER_CROSS_PROFILE_TARGET_OPENED = 155;
+  RESOLVER_SWITCH_TABS = 156;
+  RESOLVER_EMPTY_STATE_WORK_APPS_DISABLED = 157;
+  RESOLVER_EMPTY_STATE_NO_SHARING_TO_PERSONAL= 158;
+  RESOLVER_EMPTY_STATE_NO_SHARING_TO_WORK= 159;
+  RESOLVER_EMPTY_STATE_NO_APPS_RESOLVED= 160;
+  RESOLVER_AUTOLAUNCH_CROSS_PROFILE_TARGET = 161;
 }
diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml
index 6530036..62e57e4 100644
--- a/core/res/AndroidManifest.xml
+++ b/core/res/AndroidManifest.xml
@@ -645,6 +645,9 @@
 
     <protected-broadcast android:name="android.intent.action.DEVICE_CUSTOMIZATION_READY" />
 
+    <!-- Added in R -->
+    <protected-broadcast android:name="android.app.action.RESET_PROTECTION_POLICY_CHANGED" />
+
     <!-- For tether entitlement recheck-->
     <protected-broadcast
         android:name="com.android.server.connectivity.tethering.PROVISIONING_RECHECK_ALARM" />
@@ -1197,6 +1200,15 @@
                 android:description="@string/permdesc_acceptHandovers"
                 android:protectionLevel="dangerous" />
 
+    <!-- Allows an application assigned to the Dialer role to be granted access to the telephony
+         call audio streams, both TX and RX.
+         <p>Protection level: signature|appop
+    -->
+    <permission android:name="android.permission.ACCESS_CALL_AUDIO"
+                android.label="@string/permlab_accessCallAudio"
+                android:description="@string/permdesc_accessCallAudio"
+                android:protectionLevel="signature|appop" />
+
     <!-- ====================================================================== -->
     <!-- Permissions for accessing the device microphone                        -->
     <!-- ====================================================================== -->
@@ -1951,6 +1963,18 @@
         android:description="@string/permdesc_modifyAudioSettings"
         android:protectionLevel="normal" />
 
+    <!-- ======================================== -->
+    <!-- Permissions for factory reset protection -->
+    <!-- ======================================== -->
+    <eat-comment />
+
+    <!-- @SystemApi Allows an application to set a factory reset protection (FRP) policy.
+         <p>Not for use by third-party applications.
+         @hide
+    -->
+    <permission android:name="android.permission.MANAGE_FACTORY_RESET_PROTECTION"
+        android:protectionLevel="signature|privileged"/>
+
     <!-- ================================== -->
     <!-- Permissions for accessing hardware -->
     <!-- ================================== -->
diff --git a/core/res/res/drawable/ic_work_apps_off.xml b/core/res/res/drawable/ic_work_apps_off.xml
index e91806f..f62eb27 100644
--- a/core/res/res/drawable/ic_work_apps_off.xml
+++ b/core/res/res/drawable/ic_work_apps_off.xml
@@ -1,4 +1,4 @@
-<vector android:height="32dp" android:viewportHeight="24"
-    android:viewportWidth="24" android:width="32dp" xmlns:android="http://schemas.android.com/apk/res/android">
-    <path android:fillColor="@color/resolver_empty_state_icon" android:pathData="M22,7.95c0.05,-1.11 -0.84,-2 -1.95,-1.95L16,6L16,3.95c0,-1.11 -0.84,-2 -1.95,-1.95h-4C8.94,1.95 8,2.84 8,3.95v0.32l14,14L22,7.95zM14,6h-4L10,4h4v2zM21.54,20.28l-7.56,-7.56v0.01l-1.7,-1.7h0.01L7.21,5.95 3.25,1.99 1.99,3.27 4.69,6h-0.64c-1.11,0 -1.99,0.86 -1.99,1.97l-0.01,11.02c0,1.11 0.89,2.01 2,2.01h15.64l2.05,2.02L23,21.75l-1.46,-1.47z"/>
-</vector>
+<vector android:height="32dp" android:viewportHeight="24.0"
+    android:viewportWidth="24.0" android:width="32dp" xmlns:android="http://schemas.android.com/apk/res/android">
+    <path android:fillColor="@color/resolver_empty_state_icon" android:pathData="M20,6h-4L16,4c0,-1.11 -0.89,-2 -2,-2h-4c-1.11,0 -2,0.89 -2,2v1.17L10.83,8L20,8v9.17l1.98,1.98c0,-0.05 0.02,-0.1 0.02,-0.16L22,8c0,-1.11 -0.89,-2 -2,-2zM14,6h-4L10,4h4v2zM19,19L8,8 6,6 2.81,2.81 1.39,4.22 3.3,6.13C2.54,6.41 2.01,7.14 2.01,8L2,19c0,1.11 0.89,2 2,2h14.17l1.61,1.61 1.41,-1.41 -0.37,-0.37L19,19zM4,19L4,8h1.17l11,11L4,19z"/>
+</vector>
\ No newline at end of file
diff --git a/core/res/res/layout/chooser_grid.xml b/core/res/res/layout/chooser_grid.xml
index 24a21eb..c0de693 100644
--- a/core/res/res/layout/chooser_grid.xml
+++ b/core/res/res/layout/chooser_grid.xml
@@ -78,6 +78,14 @@
                 android:layout_height="wrap_content"
                 android:visibility="gone">
             </TabWidget>
+            <View
+                android:id="@+id/resolver_tab_divider"
+                android:visibility="gone"
+                android:layout_alwaysShow="true"
+                android:layout_width="match_parent"
+                android:layout_height="1dp"
+                android:background="?attr/colorBackgroundFloating"
+                android:foreground="?attr/dividerVertical" />
             <FrameLayout
                 android:id="@android:id/tabcontent"
                 android:layout_width="match_parent"
diff --git a/core/res/res/layout/resolve_grid_item.xml b/core/res/res/layout/resolve_grid_item.xml
index 7098c95..9aecfd9 100644
--- a/core/res/res/layout/resolve_grid_item.xml
+++ b/core/res/res/layout/resolve_grid_item.xml
@@ -30,8 +30,8 @@
               android:background="?attr/selectableItemBackgroundBorderless">
 
     <ImageView android:id="@+id/icon"
-               android:layout_width="@dimen/resolver_icon_size"
-               android:layout_height="@dimen/resolver_icon_size"
+               android:layout_width="@dimen/chooser_icon_size"
+               android:layout_height="@dimen/chooser_icon_size"
                android:scaleType="fitCenter" />
 
     <!-- Size manually tuned to match specs -->
diff --git a/core/res/res/layout/resolver_list.xml b/core/res/res/layout/resolver_list.xml
index b4e6286..4359b10 100644
--- a/core/res/res/layout/resolver_list.xml
+++ b/core/res/res/layout/resolver_list.xml
@@ -94,6 +94,13 @@
                 android:layout_height="wrap_content"
                 android:visibility="gone">
             </TabWidget>
+            <View
+                android:id="@+id/resolver_tab_divider"
+                android:visibility="gone"
+                android:layout_width="match_parent"
+                android:layout_height="1dp"
+                android:background="?attr/colorBackgroundFloating"
+                android:foreground="?attr/dividerVertical" />
             <FrameLayout
                 android:id="@android:id/tabcontent"
                 android:layout_width="match_parent"
@@ -102,10 +109,7 @@
                     android:id="@+id/profile_pager"
                     android:layout_width="match_parent"
                     android:layout_height="wrap_content"
-                    android:divider="?attr/dividerVertical"
-                    android:footerDividersEnabled="false"
-                    android:headerDividersEnabled="false"
-                    android:dividerHeight="1dp"/>
+                    android:minHeight="@dimen/resolver_empty_state_height" />
             </FrameLayout>
         </LinearLayout>
     </TabHost>
diff --git a/core/res/res/layout/resolver_list_per_profile.xml b/core/res/res/layout/resolver_list_per_profile.xml
index d481eff..c4f9ed9 100644
--- a/core/res/res/layout/resolver_list_per_profile.xml
+++ b/core/res/res/layout/resolver_list_per_profile.xml
@@ -29,7 +29,6 @@
         android:elevation="@dimen/resolver_elevation"
         android:nestedScrollingEnabled="true"
         android:scrollbarStyle="outsideOverlay"
-        android:scrollIndicators="top|bottom"
         android:divider="@null"
         android:footerDividersEnabled="false"
         android:headerDividersEnabled="false"
diff --git a/core/res/res/layout/resolver_list_with_default.xml b/core/res/res/layout/resolver_list_with_default.xml
index b546738..72e8b0c 100644
--- a/core/res/res/layout/resolver_list_with_default.xml
+++ b/core/res/res/layout/resolver_list_with_default.xml
@@ -175,6 +175,14 @@
                 android:layout_height="wrap_content"
                 android:visibility="gone">
             </TabWidget>
+            <View
+                android:id="@+id/resolver_tab_divider"
+                android:visibility="gone"
+                android:layout_alwaysShow="true"
+                android:layout_width="match_parent"
+                android:layout_height="1dp"
+                android:background="?attr/colorBackgroundFloating"
+                android:foreground="?attr/dividerVertical" />
             <FrameLayout
                 android:id="@android:id/tabcontent"
                 android:layout_width="match_parent"
@@ -183,10 +191,7 @@
                     android:id="@+id/profile_pager"
                     android:layout_width="match_parent"
                     android:layout_height="wrap_content"
-                    android:dividerHeight="1dp"
-                    android:divider="?attr/dividerVertical"
-                    android:footerDividersEnabled="false"
-                    android:headerDividersEnabled="false"/>
+                    android:minHeight="@dimen/resolver_empty_state_height" />
             </FrameLayout>
         </LinearLayout>
     </TabHost>
diff --git a/core/res/res/values/attrs_manifest.xml b/core/res/res/values/attrs_manifest.xml
index 16bed503..950f163 100644
--- a/core/res/res/values/attrs_manifest.xml
+++ b/core/res/res/values/attrs_manifest.xml
@@ -2809,6 +2809,9 @@
              case-sensitive, unlike formal RFC MIME types.  As a result,
              MIME types here should always use lower case letters.</em></p> -->
         <attr name="mimeType" format="string" />
+        <!-- Specify a group of MIME types that are handled. MIME types can be added and
+             removed to a package's MIME group via the PackageManager. -->
+        <attr name="mimeGroup" format="string" />
         <!-- Specify a URI scheme that is handled, as per
              {@link android.content.IntentFilter#addDataScheme
              IntentFilter.addDataScheme()}.
diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml
index b82591f..c15b794 100644
--- a/core/res/res/values/config.xml
+++ b/core/res/res/values/config.xml
@@ -3534,9 +3534,6 @@
         <item>com.android.dialer</item>
     </string-array>
 
-    <!-- An array of packages which can listen for notifications on low ram devices. -->
-    <string-array translatable="false" name="config_allowedManagedServicesOnLowRamDevices" />
-
     <!-- The default value for transition animation scale found in developer settings.
          1.0 corresponds to 1x animator scale, 0 means that there will be no transition
          animations. Note that this is only a default and will be overridden by a
diff --git a/core/res/res/values/dimens.xml b/core/res/res/values/dimens.xml
index c44a0be..48049b4 100644
--- a/core/res/res/values/dimens.xml
+++ b/core/res/res/values/dimens.xml
@@ -768,6 +768,7 @@
     <dimen name="chooser_header_scroll_elevation">4dp</dimen>
     <dimen name="chooser_max_collapsed_height">288dp</dimen>
     <dimen name="chooser_direct_share_label_placeholder_max_width">72dp</dimen>
+    <dimen name="chooser_icon_size">42dp</dimen>
     <dimen name="resolver_icon_size">32dp</dimen>
     <dimen name="resolver_button_bar_spacing">8dp</dimen>
     <dimen name="resolver_badge_size">18dp</dimen>
diff --git a/core/res/res/values/public.xml b/core/res/res/values/public.xml
index 80e5d1b..7f7bbe9 100644
--- a/core/res/res/values/public.xml
+++ b/core/res/res/values/public.xml
@@ -3014,6 +3014,7 @@
       <public name="minExtensionVersion" />
       <public name="allowNativeHeapPointerTagging" />
       <public name="preserveLegacyExternalStorage" />
+      <public name="mimeGroup" />
     </public-group>
 
     <public-group type="drawable" first-id="0x010800b5">
diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml
index e6a93e5..d513e2b 100644
--- a/core/res/res/values/strings.xml
+++ b/core/res/res/values/strings.xml
@@ -5364,4 +5364,9 @@
     <string name="resolver_no_apps_available_explanation">We couldn\u2019t find any apps</string>
     <!-- Button which switches on the disabled work profile [CHAR LIMIT=NONE] -->
     <string name="resolver_switch_on_work">Switch on work</string>
+
+    <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. [CHAR LIMIT=NONE] -->
+    <string name="permlab_accessCallAudio">Record or play audio in telephony calls</string>
+    <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. [CHAR LIMIT=NONE] -->
+    <string name="permdesc_accessCallAudio">Allows this app, when assigned as default dialer application, to record or play audio in telephony calls.</string>
 </resources>
diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml
index 02d90a7..85c2a2a 100644
--- a/core/res/res/values/symbols.xml
+++ b/core/res/res/values/symbols.xml
@@ -3167,8 +3167,6 @@
   <java-symbol type="array" name="config_nonBlockableNotificationPackages" />
   <java-symbol type="array" name="config_priorityOnlyDndExemptPackages" />
 
-  <java-symbol type="array" name="config_allowedManagedServicesOnLowRamDevices" />
-
   <!-- Screen-size-dependent modes for picker dialogs. -->
   <java-symbol type="integer" name="time_picker_mode" />
   <java-symbol type="integer" name="date_picker_mode" />
@@ -3765,6 +3763,7 @@
   <java-symbol type="dimen" name="resolver_small_margin"/>
   <java-symbol type="dimen" name="resolver_edge_margin"/>
   <java-symbol type="dimen" name="resolver_elevation"/>
+  <java-symbol type="dimen" name="chooser_icon_size"/>
 
   <!-- For DropBox -->
   <java-symbol type="integer" name="config_dropboxLowPriorityBroadcastRateLimitPeriod" />
@@ -3875,6 +3874,7 @@
   <java-symbol type="id" name="resolver_empty_state_title" />
   <java-symbol type="id" name="resolver_empty_state_subtitle" />
   <java-symbol type="id" name="resolver_empty_state_button" />
+  <java-symbol type="id" name="resolver_tab_divider" />
   <java-symbol type="string" name="resolver_cant_share_with_work_apps" />
   <java-symbol type="string" name="resolver_cant_share_with_personal_apps" />
   <java-symbol type="string" name="resolver_cant_share_cross_profile_explanation" />
diff --git a/core/java/android/service/controls/IControlsLoadCallback.aidl b/core/res/res/values/vendor_allowed_personal_apps_org_owned_device.xml
similarity index 61%
rename from core/java/android/service/controls/IControlsLoadCallback.aidl
rename to core/res/res/values/vendor_allowed_personal_apps_org_owned_device.xml
index bfc61cd..0435c30 100644
--- a/core/java/android/service/controls/IControlsLoadCallback.aidl
+++ b/core/res/res/values/vendor_allowed_personal_apps_org_owned_device.xml
@@ -1,5 +1,7 @@
-/*
- * Copyright (c) 2020, The Android Open Source Project
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/**
+ * 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.
@@ -13,14 +15,9 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
-package android.service.controls;
-
-import android.service.controls.Control;
-
-/**
- * @hide
- */
-oneway interface IControlsLoadCallback {
-    void accept(in IBinder token, in List<Control> controls);
-}
\ No newline at end of file
+-->
+<resources>
+    <!-- A list of apps to be allowed in the personal profile of an organization-owned device. -->
+    <string-array translatable="false" name="vendor_allowed_personal_apps_org_owned_device">
+    </string-array>
+</resources>
diff --git a/core/tests/coretests/Android.bp b/core/tests/coretests/Android.bp
index 18778b9..8e4e684 100644
--- a/core/tests/coretests/Android.bp
+++ b/core/tests/coretests/Android.bp
@@ -83,6 +83,7 @@
         ":FrameworksCoreTests_install_bad_dex",
         ":FrameworksCoreTests_install_complete_package_info",
         ":FrameworksCoreTests_install_decl_perm",
+        ":FrameworksCoreTests_install_intent_filters",
         ":FrameworksCoreTests_install_jni_lib_open_from_apk",
         ":FrameworksCoreTests_install_loc_auto",
         ":FrameworksCoreTests_install_loc_internal",
@@ -114,6 +115,7 @@
         ":FrameworksCoreTests_keyset_splata_api",
         ":FrameworksCoreTests_keyset_splat_api",
         ":FrameworksCoreTests_locales",
+        ":FrameworksCoreTests_overlay_config",
         ":FrameworksCoreTests_version_1",
         ":FrameworksCoreTests_version_1_diff",
         ":FrameworksCoreTests_version_1_nosys",
diff --git a/core/tests/coretests/AndroidManifest.xml b/core/tests/coretests/AndroidManifest.xml
index 59335a5..718ca46 100644
--- a/core/tests/coretests/AndroidManifest.xml
+++ b/core/tests/coretests/AndroidManifest.xml
@@ -1330,6 +1330,12 @@
             android:process=":FakeProvider">
         </provider>
 
+        <provider
+            android:name="android.content.SlowProvider"
+            android:authorities="android.content.SlowProvider"
+            android:process=":SlowProvider">
+        </provider>
+
         <!-- Application components used for os tests -->
 
         <service android:name="android.os.MessengerService"
diff --git a/core/tests/coretests/apks/install_intent_filters/Android.bp b/core/tests/coretests/apks/install_intent_filters/Android.bp
new file mode 100644
index 0000000..6cc5eba
--- /dev/null
+++ b/core/tests/coretests/apks/install_intent_filters/Android.bp
@@ -0,0 +1,7 @@
+android_test_helper_app {
+    name: "FrameworksCoreTests_install_intent_filters",
+    defaults: ["FrameworksCoreTests_apks_defaults"],
+
+    srcs: ["**/*.java"],
+}
+
diff --git a/core/tests/coretests/apks/install_intent_filters/AndroidManifest.xml b/core/tests/coretests/apks/install_intent_filters/AndroidManifest.xml
new file mode 100644
index 0000000..d7ee76e
--- /dev/null
+++ b/core/tests/coretests/apks/install_intent_filters/AndroidManifest.xml
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+  ~ 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.
+  -->
+<manifest
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    package="com.android.frameworks.coretests.install_intent_filters">
+
+<!--
+     This manifest declares an activity for testing intent filters.
+     The implementing class is an empty implementation.
+-->
+
+    <uses-feature
+        android:name="com.android.frameworks.coretests.nonexistent" />
+    <uses-configuration
+        android:reqFiveWayNav="false" />
+
+    <instrumentation
+        android:name="android.test.InstrumentationTestRunner"
+        android:targetPackage="com.android.frameworks.coretests"
+        android:label="Frameworks Core Tests" />
+
+    <permission
+        android:label="test permission"
+        android:name="test_permission"
+        android:protectionLevel="normal" />
+
+    <application
+        android:hasCode="true">
+        <activity
+            android:name="com.android.frameworks.coretests.TestActivity">
+            <intent-filter>
+                <action android:name="action1"/>
+                <data android:mimeGroup="mime_group_1"/>
+            </intent-filter>
+        </activity>
+    </application>
+</manifest>
diff --git a/media/java/android/media/tv/tuner/TunerLnbRequest.aidl b/core/tests/coretests/apks/install_intent_filters/src/com/android/frameworks/coretests/TestActivity.java
similarity index 75%
copy from media/java/android/media/tv/tuner/TunerLnbRequest.aidl
copy to core/tests/coretests/apks/install_intent_filters/src/com/android/frameworks/coretests/TestActivity.java
index b811e39..08a19aa 100644
--- a/media/java/android/media/tv/tuner/TunerLnbRequest.aidl
+++ b/core/tests/coretests/apks/install_intent_filters/src/com/android/frameworks/coretests/TestActivity.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2020 The Android Open Source Project
+ * 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.
@@ -14,11 +14,10 @@
  * limitations under the License.
  */
 
-package android.media.tv.tuner;
+package com.android.frameworks.coretests;
 
-/**
- * Information required to request a Tuner Lnb.
- *
- * @hide
- */
-parcelable TunerLnbRequest;
\ No newline at end of file
+import android.app.Activity;
+
+public class TestActivity extends Activity {
+
+}
diff --git a/core/tests/coretests/apks/overlay_config/Android.bp b/core/tests/coretests/apks/overlay_config/Android.bp
new file mode 100644
index 0000000..9573557
--- /dev/null
+++ b/core/tests/coretests/apks/overlay_config/Android.bp
@@ -0,0 +1,4 @@
+android_test_helper_app {
+    name: "FrameworksCoreTests_overlay_config",
+    defaults: ["FrameworksCoreTests_apks_defaults"],
+}
diff --git a/core/tests/coretests/apks/overlay_config/AndroidManifest.xml b/core/tests/coretests/apks/overlay_config/AndroidManifest.xml
new file mode 100644
index 0000000..b15338e
--- /dev/null
+++ b/core/tests/coretests/apks/overlay_config/AndroidManifest.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+  ~ 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.
+  -->
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+          package="com.android.frameworks.coretests.overlay_config">
+
+    <application android:hasCode="false" />
+
+    <uses-sdk android:targetSdkVersion="21"/>
+
+    <overlay android:targetPackage="android"
+             android:targetName="TestResources" />
+</manifest>
diff --git a/core/tests/coretests/src/android/content/ContentResolverTest.java b/core/tests/coretests/src/android/content/ContentResolverTest.java
index 9dcce1e..78c4420 100644
--- a/core/tests/coretests/src/android/content/ContentResolverTest.java
+++ b/core/tests/coretests/src/android/content/ContentResolverTest.java
@@ -16,6 +16,8 @@
 
 package android.content;
 
+import static com.google.common.truth.Truth.assertThat;
+
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
 import static org.mockito.ArgumentMatchers.any;
@@ -31,6 +33,7 @@
 import android.net.Uri;
 import android.os.MemoryFile;
 import android.os.ParcelFileDescriptor;
+import android.os.SystemClock;
 import android.util.Size;
 
 import androidx.test.InstrumentationRegistry;
@@ -209,4 +212,26 @@
         String type = mResolver.getType(Uri.parse("content://android.content.FakeProviderRemote"));
         assertEquals("fake/remote", type);
     }
+
+    @Test
+    public void testGetType_slowProvider() {
+        // This provider is running in a different process and is intentionally slow to start.
+        // We are trying to confirm that it does not cause an ANR
+        long start = SystemClock.uptimeMillis();
+        String type = mResolver.getType(Uri.parse("content://android.content.SlowProvider"));
+        long end = SystemClock.uptimeMillis();
+        assertEquals("slow", type);
+        assertThat(end).isLessThan(start + 5000);
+    }
+
+    @Test
+    public void testGetType_unknownProvider() {
+        // This provider does not exist.
+        // We are trying to confirm that getType returns null and does not cause an ANR
+        long start = SystemClock.uptimeMillis();
+        String type = mResolver.getType(Uri.parse("content://android.content.NonexistentProvider"));
+        long end = SystemClock.uptimeMillis();
+        assertThat(type).isNull();
+        assertThat(end).isLessThan(start + 5000);
+    }
 }
diff --git a/core/tests/coretests/src/android/content/SlowProvider.java b/core/tests/coretests/src/android/content/SlowProvider.java
new file mode 100644
index 0000000..aba32e8
--- /dev/null
+++ b/core/tests/coretests/src/android/content/SlowProvider.java
@@ -0,0 +1,65 @@
+/*
+ * 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.content;
+
+import android.database.Cursor;
+import android.net.Uri;
+
+/**
+ * A dummy content provider for tests.  This provider runs in a different process from the test and
+ * is intentionally slow.
+ */
+public class SlowProvider extends ContentProvider {
+
+    private static final int ON_CREATE_LATENCY_MILLIS = 3000;
+
+    @Override
+    public boolean onCreate() {
+        try {
+            Thread.sleep(ON_CREATE_LATENCY_MILLIS);
+        } catch (InterruptedException e) {
+            // Ignore
+        }
+        return true;
+    }
+
+    @Override
+    public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs,
+            String sortOrder) {
+        return null;
+    }
+
+    @Override
+    public String getType(Uri uri) {
+        return "slow";
+    }
+
+    @Override
+    public Uri insert(Uri uri, ContentValues values) {
+        return null;
+    }
+
+    @Override
+    public int delete(Uri uri, String selection, String[] selectionArgs) {
+        return 0;
+    }
+
+    @Override
+    public int update(Uri uri, ContentValues values, String selection, String[] selectionArgs) {
+        return 0;
+    }
+}
diff --git a/core/tests/coretests/src/android/content/pm/PackageParserTest.java b/core/tests/coretests/src/android/content/pm/PackageParserTest.java
index dfd762b..46e992e 100644
--- a/core/tests/coretests/src/android/content/pm/PackageParserTest.java
+++ b/core/tests/coretests/src/android/content/pm/PackageParserTest.java
@@ -31,6 +31,7 @@
 import android.os.Build;
 import android.os.Bundle;
 import android.os.FileUtils;
+import android.util.Log;
 
 import androidx.test.InstrumentationRegistry;
 import androidx.test.filters.SmallTest;
@@ -421,17 +422,7 @@
                 "com.android.frameworks.coretests.install_complete_package_info.test_permission",
                 PermissionInfo.PROTECTION_NORMAL, p.getPermissions().get(0));
 
-        // Hidden "app details" activity is added to every package.
-        boolean foundAppDetailsActivity = false;
-        for (int i = 0; i < ArrayUtils.size(p.getActivities()); i++) {
-            if (p.getActivities().get(i).className.equals(
-                    PackageManager.APP_DETAILS_ACTIVITY_CLASS_NAME)) {
-                foundAppDetailsActivity = true;
-                p.getActivities().remove(i);
-                break;
-            }
-        }
-        assertTrue("Did not find app details activity", foundAppDetailsActivity);
+        findAndRemoveAppDetailsActivity(p);
 
         assertOneComponentOfEachType("com.android.frameworks.coretests.Test%s", p);
 
@@ -450,6 +441,53 @@
         assertMetadata(p.getProviders().get(0).getMetaData(),
                 "key1", "value1",
                 "key2", "this_is_provider");
+
+    }
+
+    private void findAndRemoveAppDetailsActivity(ParsedPackage p) {
+        // Hidden "app details" activity is added to every package.
+        boolean foundAppDetailsActivity = false;
+        for (int i = 0; i < ArrayUtils.size(p.getActivities()); i++) {
+            if (p.getActivities().get(i).className.equals(
+                    PackageManager.APP_DETAILS_ACTIVITY_CLASS_NAME)) {
+                foundAppDetailsActivity = true;
+                p.getActivities().remove(i);
+                break;
+            }
+        }
+        assertTrue("Did not find app details activity", foundAppDetailsActivity);
+    }
+
+    @Test
+    public void testPackageWithIntentFilters_no_cache() throws Exception {
+        checkPackageWithIntentFilters(p -> p);
+    }
+
+    @Test
+    public void testPackageWithIntentFilters_cached() throws Exception {
+        checkPackageWithIntentFilters(p ->
+                PackageParser.fromCacheEntryStatic(PackageParser.toCacheEntryStatic(p)));
+    }
+
+    private void checkPackageWithIntentFilters(
+            Function<ParsedPackage, ParsedPackage> converter) throws Exception {
+        ParsedPackage p = parsePackage(
+                "install_intent_filters.apk", R.raw.install_intent_filters,
+                converter);
+        String packageName = "com.android.frameworks.coretests.install_intent_filters";
+
+        assertEquals(packageName, p.getPackageName());
+
+        findAndRemoveAppDetailsActivity(p);
+
+        Log.e("ParserTest", "" + p.getActivities());
+        assertEquals("Expected exactly one activity", 1, p.getActivities().size());
+        assertEquals("Expected exactly one intent filter",
+                1, p.getActivities().get(0).intents.size());
+        assertEquals("Expected exactly one mime group in intent filter",
+                1, p.getActivities().get(0).intents.get(0).countMimeGroups());
+        assertTrue("Did not find expected mime group 'mime_group_1'",
+                p.getActivities().get(0).intents.get(0).hasMimeGroup("mime_group_1"));
     }
 
     @Test
diff --git a/core/tests/coretests/src/android/os/PowerManagerTest.java b/core/tests/coretests/src/android/os/PowerManagerTest.java
index ea0a0fd..37e8d59 100644
--- a/core/tests/coretests/src/android/os/PowerManagerTest.java
+++ b/core/tests/coretests/src/android/os/PowerManagerTest.java
@@ -244,6 +244,28 @@
     }
 
     @Test
+    public void testGetThermalHeadroom() throws Exception {
+        float headroom = mPm.getThermalHeadroom(0);
+        // If the device doesn't support thermal headroom, return early
+        if (Float.isNaN(headroom)) {
+            return;
+        }
+        assertTrue("Expected non-negative headroom", headroom >= 0.0f);
+        assertTrue("Expected reasonably small headroom", headroom < 10.0f);
+
+        // Call again immediately to ensure rate limiting works
+        headroom = mPm.getThermalHeadroom(0);
+        assertTrue("Expected NaN because of rate limiting", Float.isNaN(headroom));
+
+        // Sleep for a second before attempting to call again so as to not get rate limited
+        Thread.sleep(1000);
+        headroom = mPm.getThermalHeadroom(5);
+        assertFalse("Expected data to still be available", Float.isNaN(headroom));
+        assertTrue("Expected non-negative headroom", headroom >= 0.0f);
+        assertTrue("Expected reasonably small headroom", headroom < 10.0f);
+    }
+
+    @Test
     public void testUserspaceRebootNotSupported_throwsUnsupportedOperationException() {
         // Can't use assumption framework with AndroidTestCase :(
         if (mPm.isRebootingUserspaceSupported()) {
diff --git a/core/tests/coretests/src/android/service/controls/ControlProviderServiceTest.java b/core/tests/coretests/src/android/service/controls/ControlProviderServiceTest.java
index a24b4e0..78c88d7 100644
--- a/core/tests/coretests/src/android/service/controls/ControlProviderServiceTest.java
+++ b/core/tests/coretests/src/android/service/controls/ControlProviderServiceTest.java
@@ -21,6 +21,7 @@
 import static org.junit.Assert.assertTrue;
 import static org.mockito.ArgumentMatchers.any;
 import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.Mockito.times;
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
 
@@ -62,8 +63,6 @@
     @Mock
     private IControlsActionCallback.Stub mActionCallback;
     @Mock
-    private IControlsLoadCallback.Stub mLoadCallback;
-    @Mock
     private IControlsSubscriber.Stub mSubscriber;
     @Mock
     private IIntentSender mIIntentSender;
@@ -79,8 +78,6 @@
 
         when(mActionCallback.asBinder()).thenCallRealMethod();
         when(mActionCallback.queryLocalInterface(any())).thenReturn(mActionCallback);
-        when(mLoadCallback.asBinder()).thenCallRealMethod();
-        when(mLoadCallback.queryLocalInterface(any())).thenReturn(mLoadCallback);
         when(mSubscriber.asBinder()).thenCallRealMethod();
         when(mSubscriber.queryLocalInterface(any())).thenReturn(mSubscriber);
 
@@ -102,22 +99,28 @@
         Control control2 = new Control.StatelessBuilder("TEST_ID_2", mPendingIntent)
                 .setDeviceType(DeviceTypes.TYPE_AIR_FRESHENER).build();
 
-        @SuppressWarnings("unchecked")
-        ArgumentCaptor<List<Control>> captor = ArgumentCaptor.forClass(List.class);
+        ArgumentCaptor<IControlsSubscription.Stub> subscriptionCaptor =
+                ArgumentCaptor.forClass(IControlsSubscription.Stub.class);
+        ArgumentCaptor<Control> controlCaptor =
+                ArgumentCaptor.forClass(Control.class);
 
         ArrayList<Control> list = new ArrayList<>();
         list.add(control1);
         list.add(control2);
 
         mControlsProviderService.setControls(list);
-        mControlsProvider.load(mLoadCallback);
+        mControlsProvider.load(mSubscriber);
         InstrumentationRegistry.getInstrumentation().waitForIdleSync();
 
-        verify(mLoadCallback).accept(eq(mToken), captor.capture());
-        List<Control> l = captor.getValue();
-        assertEquals(2, l.size());
-        assertTrue(equals(control1, l.get(0)));
-        assertTrue(equals(control2, l.get(1)));
+        verify(mSubscriber).onSubscribe(eq(mToken), subscriptionCaptor.capture());
+        subscriptionCaptor.getValue().request(1000);
+
+        verify(mSubscriber, times(2)).onNext(eq(mToken), controlCaptor.capture());
+        List<Control> values = controlCaptor.getAllValues();
+        assertTrue(equals(values.get(0), list.get(0)));
+        assertTrue(equals(values.get(1), list.get(1)));
+
+        verify(mSubscriber).onComplete(eq(mToken));
     }
 
     @Test
@@ -128,50 +131,57 @@
                 .build();
         Control statelessControl = new Control.StatelessBuilder(control).build();
 
-        @SuppressWarnings("unchecked")
-        ArgumentCaptor<List<Control>> captor = ArgumentCaptor.forClass(List.class);
+        ArgumentCaptor<IControlsSubscription.Stub> subscriptionCaptor =
+                ArgumentCaptor.forClass(IControlsSubscription.Stub.class);
+        ArgumentCaptor<Control> controlCaptor =
+                ArgumentCaptor.forClass(Control.class);
 
         ArrayList<Control> list = new ArrayList<>();
         list.add(control);
 
         mControlsProviderService.setControls(list);
-        mControlsProvider.load(mLoadCallback);
+        mControlsProvider.load(mSubscriber);
         InstrumentationRegistry.getInstrumentation().waitForIdleSync();
 
-        verify(mLoadCallback).accept(eq(mToken), captor.capture());
-        List<Control> l = captor.getValue();
-        assertEquals(1, l.size());
-        assertFalse(equals(control, l.get(0)));
-        assertTrue(equals(statelessControl, l.get(0)));
-        assertEquals(Control.STATUS_UNKNOWN, l.get(0).getStatus());
+        verify(mSubscriber).onSubscribe(eq(mToken), subscriptionCaptor.capture());
+        subscriptionCaptor.getValue().request(1000);
+
+        verify(mSubscriber).onNext(eq(mToken), controlCaptor.capture());
+        Control c = controlCaptor.getValue();
+        assertFalse(equals(control, c));
+        assertTrue(equals(statelessControl, c));
+        assertEquals(Control.STATUS_UNKNOWN, c.getStatus());
+
+        verify(mSubscriber).onComplete(eq(mToken));
     }
 
     @Test
-    public void testLoadSuggested_withMaxNumber() throws RemoteException {
+    public void testOnLoadSuggested_allStateless() throws RemoteException {
         Control control1 = new Control.StatelessBuilder("TEST_ID", mPendingIntent).build();
         Control control2 = new Control.StatelessBuilder("TEST_ID_2", mPendingIntent)
                 .setDeviceType(DeviceTypes.TYPE_AIR_FRESHENER).build();
 
-        @SuppressWarnings("unchecked")
-        ArgumentCaptor<List<Control>> captor = ArgumentCaptor.forClass(List.class);
+        ArgumentCaptor<IControlsSubscription.Stub> subscriptionCaptor =
+                ArgumentCaptor.forClass(IControlsSubscription.Stub.class);
+        ArgumentCaptor<Control> controlCaptor =
+                ArgumentCaptor.forClass(Control.class);
 
         ArrayList<Control> list = new ArrayList<>();
         list.add(control1);
         list.add(control2);
 
-        final int maxSuggested = 1;
-
         mControlsProviderService.setControls(list);
-        mControlsProvider.loadSuggested(maxSuggested, mLoadCallback);
+        mControlsProvider.loadSuggested(mSubscriber);
         InstrumentationRegistry.getInstrumentation().waitForIdleSync();
 
-        verify(mLoadCallback).accept(eq(mToken), captor.capture());
-        List<Control> l = captor.getValue();
-        assertEquals(maxSuggested, l.size());
+        verify(mSubscriber).onSubscribe(eq(mToken), subscriptionCaptor.capture());
+        subscriptionCaptor.getValue().request(1);
 
-        for (int i = 0; i < maxSuggested; ++i) {
-            assertTrue(equals(list.get(i), l.get(i)));
-        }
+        verify(mSubscriber).onNext(eq(mToken), controlCaptor.capture());
+        Control c = controlCaptor.getValue();
+        assertTrue(equals(c, list.get(0)));
+
+        verify(mSubscriber).onComplete(eq(mToken));
     }
 
     @Test
@@ -244,22 +254,19 @@
         }
 
         @Override
-        public void loadSuggestedControls(int maxNumber, Consumer<List<Control>> cb) {
-            cb.accept(mControls);
-        }
-
-        @Override
         public Publisher<Control> publisherFor(List<String> ids) {
             return new Publisher<Control>() {
                 public void subscribe(final Subscriber s) {
-                    s.onSubscribe(new Subscription() {
-                            public void request(long n) {
-                                for (Control c : mControls) {
-                                    s.onNext(c);
-                                }
-                            }
-                            public void cancel() {}
-                        });
+                    s.onSubscribe(createSubscription(s, mControls));
+                }
+            };
+        }
+
+        @Override
+        public Publisher<Control> publisherForSuggested() {
+            return new Publisher<Control>() {
+                public void subscribe(final Subscriber s) {
+                    s.onSubscribe(createSubscription(s, mControls));
                 }
             };
         }
@@ -269,7 +276,19 @@
                 Consumer<Integer> cb) {
             cb.accept(ControlAction.RESPONSE_OK);
         }
+
+        private Subscription createSubscription(Subscriber s, List<Control> controls) {
+            return new Subscription() {
+                public void request(long n) {
+                    int i = 0;
+                    for (Control c : mControls) {
+                        if (i++ < n) s.onNext(c);
+                        else break;
+                    }
+                    s.onComplete();
+                }
+                public void cancel() {}
+            };
+        }
     }
 }
-
-
diff --git a/core/tests/coretests/src/android/service/controls/templates/ControlTemplateTest.java b/core/tests/coretests/src/android/service/controls/templates/ControlTemplateTest.java
index c9b5eec..292ac09 100644
--- a/core/tests/coretests/src/android/service/controls/templates/ControlTemplateTest.java
+++ b/core/tests/coretests/src/android/service/controls/templates/ControlTemplateTest.java
@@ -113,54 +113,6 @@
     }
 
     @Test
-    public void testUnparcelingCorrectClass_discreteToggle() {
-        ControlTemplate toParcel =
-                new DiscreteToggleTemplate(TEST_ID, mControlButton, mControlButton);
-
-        ControlTemplate fromParcel = parcelAndUnparcel(toParcel);
-
-        assertEquals(ControlTemplate.TYPE_DISCRETE_TOGGLE, fromParcel.getTemplateType());
-        assertTrue(fromParcel instanceof DiscreteToggleTemplate);
-    }
-
-    @Test
-    public void testUnparcelingCorrectClass_coordRange() {
-        ControlTemplate toParcel =
-                new CoordinatedRangeTemplate(TEST_ID, 0.1f,  0, 1, 0.5f, 1, 2, 1.5f, 0.1f, "%f");
-        ControlTemplate fromParcel = parcelAndUnparcel(toParcel);
-        assertEquals(ControlTemplate.TYPE_COORD_RANGE, fromParcel.getTemplateType());
-        assertTrue(fromParcel instanceof CoordinatedRangeTemplate);
-    }
-
-    @Test
-    public void testCoordRangeParameters_negativeMinGap() {
-        CoordinatedRangeTemplate template =
-                new CoordinatedRangeTemplate(TEST_ID, -0.1f,  0, 1, 0.5f, 1, 2, 1.5f, 0.1f, "%f");
-        assertEquals(0, template.getMinGap(), 0);
-    }
-
-    @Test(expected = IllegalArgumentException.class)
-    public void testCoordRangeParameters_differentStep() {
-        RangeTemplate rangeLow = new RangeTemplate(TEST_ID, 0, 1, 0.5f, 0.1f, "%f");
-        RangeTemplate rangeHigh = new RangeTemplate(TEST_ID, 0, 1, 0.75f, 0.2f, "%f");
-        new CoordinatedRangeTemplate(TEST_ID, 0.1f, rangeLow, rangeHigh);
-    }
-
-    @Test(expected = IllegalArgumentException.class)
-    public void testCoordRangeParameters_differentFormat() {
-        RangeTemplate rangeLow = new RangeTemplate(TEST_ID, 0, 1, 0.5f, 0.1f, "%f");
-        RangeTemplate rangeHigh = new RangeTemplate(TEST_ID, 0, 1, 0.75f, 0.1f, "%.1f");
-        new CoordinatedRangeTemplate(TEST_ID, 0.1f, rangeLow, rangeHigh);
-    }
-
-    @Test(expected = IllegalArgumentException.class)
-    public void testCoordRangeParameters_LargeMinGap() {
-        RangeTemplate rangeLow = new RangeTemplate(TEST_ID, 0, 1, 0.5f, 0.1f, "%f");
-        RangeTemplate rangeHigh = new RangeTemplate(TEST_ID, 0, 1, 0.75f, 0.1f, "%f");
-        new CoordinatedRangeTemplate(TEST_ID, 0.5f, rangeLow, rangeHigh);
-    }
-
-    @Test
     public void testUnparcelingCorrectClass_toggleRange() {
         ControlTemplate toParcel = new ToggleRangeTemplate(TEST_ID, mControlButton,
                 new RangeTemplate(TEST_ID, 0, 2, 1, 1, "%f"));
diff --git a/core/tests/coretests/src/android/view/CutoutSpecificationTest.java b/core/tests/coretests/src/android/view/CutoutSpecificationTest.java
index 1f831bb..b41f90c 100644
--- a/core/tests/coretests/src/android/view/CutoutSpecificationTest.java
+++ b/core/tests/coretests/src/android/view/CutoutSpecificationTest.java
@@ -69,6 +69,13 @@
             + "z\n"
             + "@right\n"
             + "@bind_right_cutout\n"
+            + "@bottom\n"
+            + "M 0,0\n"
+            + "h -24\n"
+            + "v -48\n"
+            + "h 48\n"
+            + "v 48\n"
+            + "z\n"
             + "@dp";
     private static final String CORNER_CUTOUT_SPECIFICATION = "M 0,0\n"
             + "h 1\n"
@@ -141,13 +148,66 @@
     }
 
     @Test
+    public void parse_withBindMarker_shouldHaveTopBound() {
+        CutoutSpecification cutoutSpecification = mParser.parse(WITH_BIND_CUTOUT_SPECIFICATION);
+        assertThat(cutoutSpecification.getTopBound()).isEqualTo(new Rect(0, 0, 168, 168));
+    }
+
+    @Test
     public void parse_withBindMarker_shouldHaveRightBound() {
         CutoutSpecification cutoutSpecification = mParser.parse(WITH_BIND_CUTOUT_SPECIFICATION);
         assertThat(cutoutSpecification.getRightBound()).isEqualTo(new Rect(912, 960, 1080, 1128));
     }
 
     @Test
-    public void parse_tallCutout_shouldBeDone() {
+    public void parse_withBindMarker_shouldHaveBottomBound() {
+        CutoutSpecification cutoutSpecification = mParser.parse(WITH_BIND_CUTOUT_SPECIFICATION);
+        assertThat(cutoutSpecification.getBottomBound()).isEqualTo(new Rect(456, 1752, 624, 1920));
+    }
+
+    @Test
+    public void parse_withBindMarker_shouldMatchExpectedSafeInset() {
+        CutoutSpecification cutoutSpecification = mParser.parse(WITH_BIND_CUTOUT_SPECIFICATION);
+        assertThat(cutoutSpecification.getSafeInset()).isEqualTo(new Rect(168, 168, 168, 168));
+    }
+
+    @Test
+    public void parse_withBindMarker_tabletLikeDevice_shouldHaveLeftBound() {
+        CutoutSpecification cutoutSpecification = new CutoutSpecification.Parser(3.5f, 1920, 1080)
+                .parse(WITH_BIND_CUTOUT_SPECIFICATION);
+        assertThat(cutoutSpecification.getLeftBound()).isEqualTo(new Rect(0, 540, 168, 708));
+    }
+
+    @Test
+    public void parse_withBindMarker_tabletLikeDevice_shouldHaveTopBound() {
+        CutoutSpecification cutoutSpecification = new CutoutSpecification.Parser(3.5f, 1920, 1080)
+                .parse(WITH_BIND_CUTOUT_SPECIFICATION);
+        assertThat(cutoutSpecification.getTopBound()).isEqualTo(new Rect(0, 0, 168, 168));
+    }
+
+    @Test
+    public void parse_withBindMarker_tabletLikeDevice_shouldHaveRightBound() {
+        CutoutSpecification cutoutSpecification = new CutoutSpecification.Parser(3.5f, 1920, 1080)
+                .parse(WITH_BIND_CUTOUT_SPECIFICATION);
+        assertThat(cutoutSpecification.getRightBound()).isEqualTo(new Rect(1752, 540, 1920, 708));
+    }
+
+    @Test
+    public void parse_withBindMarker_tabletLikeDevice_shouldHaveBottomBound() {
+        CutoutSpecification cutoutSpecification = new CutoutSpecification.Parser(3.5f, 1920, 1080)
+                .parse(WITH_BIND_CUTOUT_SPECIFICATION);
+        assertThat(cutoutSpecification.getBottomBound()).isEqualTo(new Rect(876, 912, 1044, 1080));
+    }
+
+    @Test
+    public void parse_withBindMarker_tabletLikeDevice_shouldMatchExpectedSafeInset() {
+        CutoutSpecification cutoutSpecification = new CutoutSpecification.Parser(3.5f, 1920, 1080)
+                .parse(WITH_BIND_CUTOUT_SPECIFICATION);
+        assertThat(cutoutSpecification.getSafeInset()).isEqualTo(new Rect(168, 0, 168, 168));
+    }
+
+    @Test
+    public void parse_tallCutout_topBoundShouldMatchExpectedHeight() {
         CutoutSpecification cutoutSpecification = mParser.parse("M 0,0\n"
                 + "L -48, 0\n"
                 + "L -44.3940446283, 36.0595537175\n"
@@ -162,7 +222,7 @@
     }
 
     @Test
-    public void parse_wideCutout_shouldBeDone() {
+    public void parse_wideCutout_topBoundShouldMatchExpectedWidth() {
         CutoutSpecification cutoutSpecification = mParser.parse("M 0,0\n"
                 + "L -72, 0\n"
                 + "L -69.9940446283, 20.0595537175\n"
@@ -177,7 +237,7 @@
     }
 
     @Test
-    public void parse_narrowCutout_shouldBeDone() {
+    public void parse_narrowCutout_topBoundShouldHaveExpectedWidth() {
         CutoutSpecification cutoutSpecification = mParser.parse("M 0,0\n"
                 + "L -24, 0\n"
                 + "L -21.9940446283, 20.0595537175\n"
@@ -192,7 +252,7 @@
     }
 
     @Test
-    public void parse_doubleCutout_shouldBeDone() {
+    public void parse_doubleCutout_topBoundShouldHaveExpectedHeight() {
         CutoutSpecification cutoutSpecification = mParser.parse("M 0,0\n"
                 + "L -72, 0\n"
                 + "L -69.9940446283, 20.0595537175\n"
@@ -217,7 +277,7 @@
     }
 
     @Test
-    public void parse_cornerCutout_shouldBeDone() {
+    public void parse_cornerCutout_topBoundShouldHaveExpectedHeight() {
         CutoutSpecification cutoutSpecification = mParser.parse("M 0,0\n"
                 + "L -48, 0\n"
                 + "C -48,48 -48,48 0,48\n"
@@ -229,7 +289,7 @@
     }
 
     @Test
-    public void parse_holeCutout_shouldBeDone() {
+    public void parse_holeCutout_shouldMatchExpectedInset() {
         CutoutSpecification cutoutSpecification = mParser.parse("M 20.0,20.0\n"
                 + "h 136\n"
                 + "v 136\n"
@@ -259,4 +319,38 @@
         assertThat(cutoutSpecification.getSafeInset())
                 .isEqualTo(new Rect(6, 0, 8, 0));
     }
+
+    @Test
+    public void parse_bottomLeftSpec_withBindLeftMarker_shouldBeLeftBound() {
+        CutoutSpecification cutoutSpecification =
+                new CutoutSpecification.Parser(2f, 400, 200)
+                        .parse("@bottom"
+                                + "M 0,0\n"
+                                + "v -10\n"
+                                + "h 10\n"
+                                + "v 10\n"
+                                + "z\n"
+                                + "@left\n"
+                                + "@bind_left_cutout");
+
+        assertThat(cutoutSpecification.getLeftBound())
+                .isEqualTo(new Rect(0, 190, 10, 200));
+    }
+
+    @Test
+    public void parse_bottomRightSpec_withBindRightMarker_shouldBeRightBound() {
+        CutoutSpecification cutoutSpecification =
+                new CutoutSpecification.Parser(2f, 400, 200)
+                        .parse("@bottom"
+                                + "M 0,0\n"
+                                + "v -10\n"
+                                + "h 10\n"
+                                + "v 10\n"
+                                + "z\n"
+                                + "@right\n"
+                                + "@bind_right_cutout");
+
+        assertThat(cutoutSpecification.getRightBound())
+                .isEqualTo(new Rect(390, 190, 400, 200));
+    }
 }
diff --git a/core/tests/coretests/src/android/view/accessibility/AccessibilityNodeInfoTest.java b/core/tests/coretests/src/android/view/accessibility/AccessibilityNodeInfoTest.java
index ade1e0d..79e7c50 100644
--- a/core/tests/coretests/src/android/view/accessibility/AccessibilityNodeInfoTest.java
+++ b/core/tests/coretests/src/android/view/accessibility/AccessibilityNodeInfoTest.java
@@ -46,7 +46,7 @@
     // The number of fields tested in the corresponding CTS AccessibilityNodeInfoTest:
     // See fullyPopulateAccessibilityNodeInfo, assertEqualsAccessibilityNodeInfo,
     // and assertAccessibilityNodeInfoCleared in that class.
-    private static final int NUM_MARSHALLED_PROPERTIES = 38;
+    private static final int NUM_MARSHALLED_PROPERTIES = 39;
 
     /**
      * The number of properties that are purposely not marshalled
diff --git a/core/tests/coretests/src/android/view/accessibility/AccessibilityServiceConnectionImpl.java b/core/tests/coretests/src/android/view/accessibility/AccessibilityServiceConnectionImpl.java
index b71c580..75a7504 100644
--- a/core/tests/coretests/src/android/view/accessibility/AccessibilityServiceConnectionImpl.java
+++ b/core/tests/coretests/src/android/view/accessibility/AccessibilityServiceConnectionImpl.java
@@ -157,4 +157,8 @@
     }
 
     public void takeScreenshot(int displayId, RemoteCallback callback) {}
+
+    public void setTouchExplorationPassthroughRegion(int displayId, Region region) {}
+
+    public void setGestureDetectionPassthroughRegion(int displayId, Region region) {}
 }
diff --git a/core/tests/coretests/src/android/widget/EditorCursorDragTest.java b/core/tests/coretests/src/android/widget/EditorCursorDragTest.java
index a602fa3..d7abfcc 100644
--- a/core/tests/coretests/src/android/widget/EditorCursorDragTest.java
+++ b/core/tests/coretests/src/android/widget/EditorCursorDragTest.java
@@ -25,6 +25,9 @@
 import static androidx.test.espresso.action.ViewActions.replaceText;
 import static androidx.test.espresso.matcher.ViewMatchers.withId;
 
+import static com.google.common.truth.Truth.assertThat;
+import static com.google.common.truth.Truth.assertWithMessage;
+
 import static org.hamcrest.Matchers.emptyString;
 import static org.hamcrest.Matchers.not;
 import static org.junit.Assert.assertFalse;
@@ -32,11 +35,14 @@
 
 import android.app.Activity;
 import android.app.Instrumentation;
+import android.text.Layout;
+import android.util.Log;
 import android.view.InputDevice;
 import android.view.MotionEvent;
 
 import androidx.test.InstrumentationRegistry;
 import androidx.test.filters.SmallTest;
+import androidx.test.filters.Suppress;
 import androidx.test.rule.ActivityTestRule;
 import androidx.test.runner.AndroidJUnit4;
 
@@ -50,9 +56,15 @@
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
+import java.util.concurrent.atomic.AtomicLong;
+
 @RunWith(AndroidJUnit4.class)
 @SmallTest
 public class EditorCursorDragTest {
+    private static final String LOG_TAG = EditorCursorDragTest.class.getSimpleName();
+
+    private static final AtomicLong sTicker = new AtomicLong(1);
+
     @Rule
     public ActivityTestRule<TextViewActivity> mActivityRule = new ActivityTestRule<>(
             TextViewActivity.class);
@@ -119,13 +131,11 @@
         onView(withId(R.id.textview)).perform(replaceText(text));
         onView(withId(R.id.textview)).check(hasInsertionPointerAtIndex(0));
 
-        // Swipe along a diagonal path. This should drag the cursor.
-        onView(withId(R.id.textview)).perform(dragOnText(text.indexOf("line1"), text.indexOf("2")));
-        onView(withId(R.id.textview)).check(hasInsertionPointerAtIndex(text.indexOf("2")));
-
-        // Swipe along a steeper diagonal path. This should still drag the cursor.
+        // Swipe along a diagonal path. This should drag the cursor. Because we snap the finger to
+        // the handle as the touch moves downwards (and because we have some slop to avoid jumping
+        // across lines), the cursor position will end up higher than the finger position.
         onView(withId(R.id.textview)).perform(dragOnText(text.indexOf("line1"), text.indexOf("3")));
-        onView(withId(R.id.textview)).check(hasInsertionPointerAtIndex(text.indexOf("3")));
+        onView(withId(R.id.textview)).check(hasInsertionPointerAtIndex(text.indexOf("1")));
 
         // Swipe right-down along a very steep diagonal path. This should not drag the cursor.
         // Normally this would trigger a scroll, but since the full view fits on the screen there
@@ -133,12 +143,15 @@
         onView(withId(R.id.textview)).perform(dragOnText(text.indexOf("line1"), text.indexOf("7")));
         onView(withId(R.id.textview)).check(hasSelection(not(emptyString())));
 
+        // Tap to clear the selection.
+        int index = text.indexOf("line9");
+        onView(withId(R.id.textview)).perform(clickOnTextAtIndex(index));
+        onView(withId(R.id.textview)).check(hasSelection(emptyString()));
+        onView(withId(R.id.textview)).check(hasInsertionPointerAtIndex(index));
+
         // Swipe right-up along a very steep diagonal path. This should not drag the cursor.
         // Normally this would trigger a scroll, but since the full view fits on the screen there
         // is nothing to scroll and the gesture will trigger a selection drag.
-        int index = text.indexOf("line9");
-        onView(withId(R.id.textview)).perform(clickOnTextAtIndex(index));
-        onView(withId(R.id.textview)).check(hasInsertionPointerAtIndex(index));
         onView(withId(R.id.textview)).perform(dragOnText(text.indexOf("line7"), text.indexOf("1")));
         onView(withId(R.id.textview)).check(hasSelection(not(emptyString())));
     }
@@ -154,13 +167,11 @@
         onView(withId(R.id.textview)).perform(replaceText(text));
         onView(withId(R.id.textview)).check(hasInsertionPointerAtIndex(0));
 
-        // Swipe along a diagonal path. This should drag the cursor.
-        onView(withId(R.id.textview)).perform(dragOnText(text.indexOf("line1"), text.indexOf("2")));
-        onView(withId(R.id.textview)).check(hasInsertionPointerAtIndex(text.indexOf("2")));
-
-        // Swipe along a steeper diagonal path. This should still drag the cursor.
+        // Swipe along a diagonal path. This should drag the cursor. Because we snap the finger to
+        // the handle as the touch moves downwards (and because we have some slop to avoid jumping
+        // across lines), the cursor position will end up higher than the finger position.
         onView(withId(R.id.textview)).perform(dragOnText(text.indexOf("line1"), text.indexOf("3")));
-        onView(withId(R.id.textview)).check(hasInsertionPointerAtIndex(text.indexOf("3")));
+        onView(withId(R.id.textview)).check(hasInsertionPointerAtIndex(text.indexOf("1")));
 
         // Swipe right-down along a very steep diagonal path. This should not drag the cursor.
         // Normally this would trigger a scroll up, but since the view is already at the top there
@@ -168,11 +179,14 @@
         onView(withId(R.id.textview)).perform(dragOnText(text.indexOf("line1"), text.indexOf("7")));
         onView(withId(R.id.textview)).check(hasSelection(not(emptyString())));
 
-        // Swipe right-up along a very steep diagonal path. This should not drag the cursor. This
-        // will trigger a downward scroll and the cursor position will not change.
+        // Tap to clear the selection.
         int index = text.indexOf("line9");
         onView(withId(R.id.textview)).perform(clickOnTextAtIndex(index));
+        onView(withId(R.id.textview)).check(hasSelection(emptyString()));
         onView(withId(R.id.textview)).check(hasInsertionPointerAtIndex(index));
+
+        // Swipe right-up along a very steep diagonal path. This should not drag the cursor. This
+        // will trigger a downward scroll and the cursor position will not change.
         onView(withId(R.id.textview)).perform(dragOnText(text.indexOf("line7"), text.indexOf("1")));
         onView(withId(R.id.textview)).check(hasInsertionPointerAtIndex(index));
     }
@@ -387,12 +401,14 @@
         assertFalse(editor.getSelectionController().isCursorBeingModified());
     }
 
+    @Suppress // b/149712851
     @Test // Reproduces b/147366705
     public void testCursorDrag_nonSelectableTextView() throws Throwable {
         String text = "Hello world!";
         TextView tv = mActivity.findViewById(R.id.nonselectable_textview);
         tv.setText(text);
         Editor editor = tv.getEditorForTesting();
+        assertThat(editor).isNotNull();
 
         // Simulate a tap. No error should be thrown.
         long event1Time = 1001;
@@ -404,6 +420,68 @@
                 dragOnText(text.indexOf("llo"), text.indexOf("!")));
     }
 
+    @Test
+    public void testCursorDrag_slop() throws Throwable {
+        String text = "line1: This is the 1st line: A\n"
+                    + "line2: This is the 2nd line: B\n"
+                    + "line3: This is the 3rd line: C\n";
+        onView(withId(R.id.textview)).perform(replaceText(text));
+        onView(withId(R.id.textview)).check(hasInsertionPointerAtIndex(0));
+        TextView tv = mActivity.findViewById(R.id.textview);
+
+        // Simulate a drag where the finger moves slightly up and down (above and below the original
+        // line where the drag started). The cursor should just move along the original line without
+        // jumping up or down across lines.
+        MotionEventInfo[] events = new MotionEventInfo[]{
+                // Start dragging along the second line
+                motionEventInfo(text.indexOf("line2"), 1.0f),
+                motionEventInfo(text.indexOf("This is the 2nd"), 1.0f),
+                // Move to the bottom of the first line; cursor should remain on second line
+                motionEventInfo(text.indexOf("he 1st"), 0.0f, text.indexOf("he 2nd")),
+                // Move to the top of the third line; cursor should remain on second line
+                motionEventInfo(text.indexOf("e: C"), 1.0f, text.indexOf("e: B")),
+                motionEventInfo(text.indexOf("B"), 0.0f)
+        };
+        simulateDrag(tv, events, true);
+    }
+
+    @Test
+    public void testCursorDrag_snapToHandle() throws Throwable {
+        String text = "line1: This is the 1st line: A\n"
+                    + "line2: This is the 2nd line: B\n"
+                    + "line3: This is the 3rd line: C\n";
+        onView(withId(R.id.textview)).perform(replaceText(text));
+        onView(withId(R.id.textview)).check(hasInsertionPointerAtIndex(0));
+        TextView tv = mActivity.findViewById(R.id.textview);
+
+        // When the drag motion moves downward, we delay jumping to the lower line to allow the
+        // user's touch to snap to the cursor's handle. Once the finger is over the handle, we
+        // position the cursor above the user's actual touch (offset such that the finger remains
+        // over the handle rather than on top of the cursor vertical bar). This improves the
+        // visibility of the cursor and the text underneath.
+        MotionEventInfo[] events = new MotionEventInfo[]{
+                // Start dragging along the first line
+                motionEventInfo(text.indexOf("line1"), 1.0f),
+                motionEventInfo(text.indexOf("This is the 1st"), 1.0f),
+                // Move to the bottom of the third line; cursor should end up on second line
+                motionEventInfo(text.indexOf("he 3rd"), 0.0f, text.indexOf("he 2nd")),
+                // Move to the middle of the second line; cursor should end up on the first line
+                motionEventInfo(text.indexOf("he 2nd"), 0.5f, text.indexOf("he 1st"))
+        };
+        simulateDrag(tv, events, true);
+
+        // If the drag motion hasn't moved downward (ie, we haven't had a chance to snap to the
+        // handle), we position the cursor directly at the touch position.
+        events = new MotionEventInfo[]{
+                // Start dragging along the third line
+                motionEventInfo(text.indexOf("line3"), 1.0f),
+                motionEventInfo(text.indexOf("This is the 3rd"), 1.0f),
+                // Move to the middle of the second line; cursor should end up on the second line
+                motionEventInfo(text.indexOf("he 2nd"), 0.5f, text.indexOf("he 2nd")),
+        };
+        simulateDrag(tv, events, true);
+    }
+
     private static MotionEvent downEvent(long downTime, long eventTime, float x, float y) {
         return MotionEvent.obtain(downTime, eventTime, MotionEvent.ACTION_DOWN, x, y, 0);
     }
@@ -436,4 +514,89 @@
         event.setButtonState(MotionEvent.BUTTON_PRIMARY);
         return event;
     }
+
+    public static MotionEventInfo motionEventInfo(int index, float ratioToLineTop) {
+        return new MotionEventInfo(index, ratioToLineTop, index);
+    }
+
+    public static MotionEventInfo motionEventInfo(int index, float ratioToLineTop,
+            int expectedCursorIndex) {
+        return new MotionEventInfo(index, ratioToLineTop, expectedCursorIndex);
+    }
+
+    private static class MotionEventInfo {
+        public final int index;
+        public final float ratioToLineTop; // 0.0 = bottom of line, 0.5 = middle of line, etc
+        public final int expectedCursorIndex;
+
+        private MotionEventInfo(int index, float ratioToLineTop, int expectedCursorIndex) {
+            this.index = index;
+            this.ratioToLineTop = ratioToLineTop;
+            this.expectedCursorIndex = expectedCursorIndex;
+        }
+
+        public float[] getCoordinates(TextView textView) {
+            Layout layout = textView.getLayout();
+            int line = layout.getLineForOffset(index);
+            float x = layout.getPrimaryHorizontal(index) + textView.getTotalPaddingLeft();
+            int bottom = layout.getLineBottom(line);
+            int top = layout.getLineTop(line);
+            float y = bottom - ((bottom - top) * ratioToLineTop) + textView.getTotalPaddingTop();
+            return new float[]{x, y};
+        }
+    }
+
+    private void simulateDrag(TextView tv, MotionEventInfo[] events, boolean runAssertions)
+            throws Exception {
+        Editor editor = tv.getEditorForTesting();
+
+        float[] downCoords = events[0].getCoordinates(tv);
+        long downEventTime = sTicker.addAndGet(10_000);
+        MotionEvent downEvent = downEvent(downEventTime, downEventTime,
+                downCoords[0], downCoords[1]);
+        mInstrumentation.runOnMainSync(() -> editor.onTouchEvent(downEvent));
+
+        for (int i = 1; i < events.length; i++) {
+            float[] moveCoords = events[i].getCoordinates(tv);
+            long eventTime = downEventTime + i;
+            MotionEvent event = moveEvent(downEventTime, eventTime, moveCoords[0], moveCoords[1]);
+            mInstrumentation.runOnMainSync(() -> editor.onTouchEvent(event));
+            assertCursorPosition(tv, events[i].expectedCursorIndex, runAssertions);
+        }
+
+        MotionEventInfo lastEvent = events[events.length - 1];
+        float[] upCoords = lastEvent.getCoordinates(tv);
+        long upEventTime = downEventTime + events.length;
+        MotionEvent upEvent = upEvent(downEventTime, upEventTime, upCoords[0], upCoords[1]);
+        mInstrumentation.runOnMainSync(() -> editor.onTouchEvent(upEvent));
+    }
+
+    private static void assertCursorPosition(TextView tv, int expectedPosition,
+            boolean runAssertions) {
+        String textAfterExpectedPos = getTextAfterIndex(tv, expectedPosition, 15);
+        String textAfterActualPos = getTextAfterIndex(tv, tv.getSelectionStart(), 15);
+        String msg = "Expected cursor at " + expectedPosition + ", just before \""
+                + textAfterExpectedPos + "\". Cursor is at " + tv.getSelectionStart()
+                + ", just before \"" + textAfterActualPos + "\".";
+        Log.d(LOG_TAG, msg);
+        if (runAssertions) {
+            assertWithMessage(msg).that(tv.getSelectionStart()).isEqualTo(expectedPosition);
+            assertThat(tv.getSelectionEnd()).isEqualTo(expectedPosition);
+        }
+    }
+
+    private static String getTextAfterIndex(TextView tv, int position, int maxLength) {
+        int end = Math.min(position + maxLength, tv.getText().length());
+        try {
+            String afterPosition = tv.getText().subSequence(position, end).toString();
+            if (afterPosition.indexOf('\n') > 0) {
+                afterPosition = afterPosition.substring(0, afterPosition.indexOf('\n'));
+            }
+            return afterPosition;
+        } catch (StringIndexOutOfBoundsException e) {
+            Log.d(LOG_TAG, "Invalid target position: position=" + position + ", length="
+                    + tv.getText().length() + ", end=" + end);
+            return "";
+        }
+    }
 }
diff --git a/core/tests/coretests/src/com/android/internal/content/OverlayConfigIterationRule.java b/core/tests/coretests/src/com/android/internal/content/OverlayConfigIterationRule.java
new file mode 100644
index 0000000..23655a0
--- /dev/null
+++ b/core/tests/coretests/src/com/android/internal/content/OverlayConfigIterationRule.java
@@ -0,0 +1,162 @@
+/*
+ * 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.internal.content;
+
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.doAnswer;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.when;
+
+import android.content.pm.parsing.AndroidPackage;
+import android.os.Build;
+import android.util.ArrayMap;
+
+import com.android.internal.content.om.OverlayConfig.AndroidPackageProvider;
+import com.android.internal.content.om.OverlayScanner;
+import com.android.internal.content.om.OverlayScanner.ParsedOverlayInfo;
+
+import org.junit.Assert;
+import org.junit.rules.TestRule;
+import org.junit.runner.Description;
+import org.junit.runners.model.Statement;
+import org.mockito.Mockito;
+import org.mockito.invocation.InvocationOnMock;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.Map;
+import java.util.function.Consumer;
+import java.util.function.Supplier;
+
+/**
+ * A {@link TestRule} that runs a test case twice. First, the test case runs with a non-null
+ * {@link OverlayScanner} as if the zygote process is scanning the overlay packages
+ * and parsing configuration files. The test case then runs with a non-null
+ * {@link AndroidPackageProvider} as if the system server is parsing configuration files.
+ *
+ * This simulates what will happen on device. If an exception would be thrown in the zygote, then
+ * the exception should be thrown in the first run of the test case.
+ */
+public class OverlayConfigIterationRule implements TestRule {
+
+    enum Iteration {
+        ZYGOTE,
+        SYSTEM_SERVER,
+    }
+
+    private final ArrayMap<File, ParsedOverlayInfo> mOverlayStubResults = new ArrayMap<>();
+    private Supplier<OverlayScanner> mOverlayScanner;
+    private AndroidPackageProvider mAndroidPackageProvider;
+    private Iteration mIteration;
+
+    /**
+     * Mocks the parsing of the file to make it appear to the scanner that the file is a valid
+     * overlay APK.
+     **/
+    void addOverlay(File path, String packageName, String targetPackage, int targetSdkVersion,
+            boolean isStatic, int priority) {
+        try {
+            final File canonicalPath = new File(path.getCanonicalPath());
+            mOverlayStubResults.put(canonicalPath, new ParsedOverlayInfo(
+                    packageName, targetPackage, targetSdkVersion, isStatic, priority,
+                    canonicalPath));
+        } catch (IOException e) {
+            Assert.fail("Failed to add overlay " + e);
+        }
+    }
+
+    void addOverlay(File path, String packageName) {
+        addOverlay(path, packageName, "target");
+    }
+
+    void addOverlay(File path, String packageName, String targetPackage) {
+        addOverlay(path, packageName, targetPackage, Build.VERSION_CODES.CUR_DEVELOPMENT);
+    }
+
+    void addOverlay(File path, String packageName, String targetPackage, int targetSdkVersion) {
+        addOverlay(path, packageName, targetPackage, targetSdkVersion, false, 0);
+    }
+
+    /** Retrieves the {@link OverlayScanner} for the current run of the test. */
+    Supplier<OverlayScanner> getScannerFactory() {
+        return mOverlayScanner;
+    }
+
+    /** Retrieves the {@link AndroidPackageProvider} for the current run of the test. */
+    AndroidPackageProvider getPackageProvider() {
+        return mAndroidPackageProvider;
+    }
+
+    /** Retrieves the current iteration of the test. */
+    Iteration getIteration() {
+        return mIteration;
+    }
+
+
+    @Override
+    public Statement apply(Statement base, Description description) {
+        return new Statement() {
+            @Override
+            public void evaluate() throws Throwable {
+                // Run the test once as if the zygote process is scanning the overlay packages
+                // and parsing configuration files.
+                mOverlayScanner = () -> {
+                    OverlayScanner scanner = Mockito.spy(new OverlayScanner());
+                    for (Map.Entry<File, ParsedOverlayInfo> overlay :
+                            mOverlayStubResults.entrySet()) {
+                        doReturn(overlay.getValue()).when(scanner)
+                                .parseOverlayManifest(overlay.getKey());
+                    }
+                    return scanner;
+                };
+                mAndroidPackageProvider = null;
+                mIteration = Iteration.ZYGOTE;
+                base.evaluate();
+
+                // Run the test once more (if the first test did not throw an exception) as if
+                // the system server is parsing the configuration files and using PackageManager to
+                // retrieving information of overlays.
+                mOverlayScanner = null;
+                mAndroidPackageProvider = Mockito.mock(AndroidPackageProvider.class);
+                mIteration = Iteration.SYSTEM_SERVER;
+                doAnswer((InvocationOnMock invocation) -> {
+                    final Object[] args = invocation.getArguments();
+                    final Consumer<AndroidPackage> f =  (Consumer<AndroidPackage>) args[0];
+                    for (Map.Entry<File, ParsedOverlayInfo> overlay :
+                            mOverlayStubResults.entrySet()) {
+                        final AndroidPackage a = Mockito.mock(AndroidPackage.class);
+                        final ParsedOverlayInfo info = overlay.getValue();
+                        when(a.getPackageName()).thenReturn(info.packageName);
+                        when(a.getOverlayTarget()).thenReturn(info.targetPackageName);
+                        when(a.getTargetSdkVersion()).thenReturn(info.targetSdkVersion);
+                        when(a.isOverlayIsStatic()).thenReturn(info.isStatic);
+                        when(a.getOverlayPriority()).thenReturn(info.priority);
+                        when(a.getBaseCodePath()).thenReturn(info.path.getPath());
+                        when(a.isSystem()).thenReturn(
+                                !info.path.getPath().contains("data/overlay"));
+                        f.accept(a);
+                    }
+                    return null;
+                }).when(mAndroidPackageProvider).forEachPackage(any());
+
+                base.evaluate();
+            }
+        };
+    }
+}
+
+
diff --git a/core/tests/coretests/src/com/android/internal/content/OverlayConfigTest.java b/core/tests/coretests/src/com/android/internal/content/OverlayConfigTest.java
new file mode 100644
index 0000000..dee118f
--- /dev/null
+++ b/core/tests/coretests/src/com/android/internal/content/OverlayConfigTest.java
@@ -0,0 +1,603 @@
+/*
+ * 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.internal.content;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import android.os.FileUtils;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
+
+import com.android.frameworks.coretests.R;
+import com.android.internal.content.om.OverlayConfig;
+import com.android.internal.content.om.OverlayConfig.IdmapInvocation;
+import com.android.internal.content.om.OverlayScanner;
+
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.junit.rules.RuleChain;
+import org.junit.rules.TemporaryFolder;
+import org.junit.runner.RunWith;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.ArrayList;
+
+@RunWith(AndroidJUnit4.class)
+public class OverlayConfigTest {
+    private static final String TEST_APK_PACKAGE_NAME =
+            "com.android.frameworks.coretests.overlay_config";
+
+    private ExpectedException mExpectedException = ExpectedException.none();
+    private OverlayConfigIterationRule mScannerRule = new OverlayConfigIterationRule();
+    private TemporaryFolder mTestFolder = new TemporaryFolder();
+
+    @Rule
+    public RuleChain chain = RuleChain.outerRule(mExpectedException)
+            .around(mTestFolder).around(mScannerRule);
+
+    private OverlayConfig createConfigImpl() throws IOException {
+        return new OverlayConfig(mTestFolder.getRoot().getCanonicalFile(),
+                mScannerRule.getScannerFactory(), mScannerRule.getPackageProvider());
+    }
+
+    private File createFile(String fileName) throws IOException {
+        return createFile(fileName, "");
+    }
+
+    private File createFile(String fileName, String content) throws IOException {
+        final File f = new File(String.format("%s/%s", mTestFolder.getRoot(), fileName));
+        if (!f.getParentFile().equals(mTestFolder.getRoot())) {
+            f.getParentFile().mkdirs();
+        }
+        FileUtils.stringToFile(f.getPath(), content);
+        return f;
+    }
+
+    private static void assertConfig(OverlayConfig overlayConfig, String packageName,
+            boolean mutable, boolean enabled, int configIndex) {
+        final OverlayConfig.Configuration config = overlayConfig.getConfiguration(packageName);
+        assertNotNull(config);
+        assertEquals(mutable, config.parsedConfig.mutable);
+        assertEquals(enabled, config.parsedConfig.enabled);
+        assertEquals(configIndex, config.configIndex);
+    }
+
+    @Test
+    public void testImmutableAfterNonImmutableFails() throws IOException {
+        mExpectedException.expect(IllegalStateException.class);
+        mExpectedException.expectMessage("immutable overlays must precede mutable overlays");
+
+        createFile("/product/overlay/config/config.xml",
+                "<config>"
+                        + "  <overlay package=\"one\" enabled=\"true\" />"
+                        + "  <overlay package=\"two\" mutable=\"false\" enabled=\"true\" />"
+                        + "</config>");
+
+        mScannerRule.addOverlay(createFile("/product/overlay/one.apk"), "one");
+        mScannerRule.addOverlay(createFile("/product/overlay/two.apk"), "two");
+        createConfigImpl();
+    }
+
+    @Test
+    public void testConfigureAbsentPackageFails() throws IOException {
+        mExpectedException.expect(IllegalStateException.class);
+        mExpectedException.expectMessage("not present in partition");
+
+        createFile("/product/overlay/config/config.xml",
+                "<config>"
+                        + "  <overlay package=\"one\" enabled=\"true\" />"
+                        + "</config>");
+
+        createConfigImpl();
+    }
+
+    @Test
+    public void testConfigurePackageTwiceFails() throws IOException {
+        mExpectedException.expect(IllegalStateException.class);
+        mExpectedException.expectMessage("configured multiple times in a single partition");
+
+        createFile("/product/overlay/config/config.xml",
+                "<config>"
+                        + "  <overlay package=\"one\" enabled=\"true\" />"
+                        + "  <overlay package=\"one\" mutable=\"false\" />"
+                        + "</config>");
+
+        mScannerRule.addOverlay(createFile("/product/overlay/one.apk"), "one");
+        createConfigImpl();
+    }
+
+    @Test
+    public void testConfigureOverlayAcrossPartitionsFails() throws IOException {
+        mExpectedException.expect(IllegalStateException.class);
+        mExpectedException.expectMessage("not present in partition");
+
+        createFile("/vendor/overlay/config/config.xml",
+                "<config>"
+                        + "  <overlay package=\"one\" enabled=\"true\" />"
+                        + "</config>");
+
+        mScannerRule.addOverlay(createFile("/product/overlay/one.apk"), "one");
+        createConfigImpl();
+    }
+
+    @Test
+    public void testConfigureOverlayOutsideOverlayDirFails() throws IOException {
+        mExpectedException.expect(IllegalStateException.class);
+        mExpectedException.expectMessage("not present in partition");
+
+        createFile("/vendor/overlay/config/config.xml",
+                "<config>"
+                        + "  <overlay package=\"one\" enabled=\"true\" />"
+                        + "</config>");
+
+        mScannerRule.addOverlay(createFile("/product/app/one.apk"), "one");
+        createConfigImpl();
+    }
+
+    @Test
+    public void testMergeOAbsolutePathFails() throws IOException {
+        mExpectedException.expect(IllegalStateException.class);
+        mExpectedException.expectMessage("must be relative to the directory");
+
+        createFile("/product/overlay/config/config.xml",
+                "<config>"
+                        + "  <merge path=\"/product/overlay/config/auto-generated-config.xml\" />"
+                        + "</config>");
+
+        createConfigImpl();
+    }
+
+    @Test
+    public void testMergeOutsideDirFails() throws IOException {
+        mExpectedException.expect(IllegalStateException.class);
+        mExpectedException.expectMessage("outside of configuration directory");
+
+        createFile("/product/overlay/auto-generated-config.xml");
+        createFile("/product/overlay/config/config.xml",
+                "<config>"
+                        + "  <merge path=\"../auto-generated-config.xml\" />"
+                        + "</config>");
+
+        createConfigImpl();
+    }
+
+    @Test
+    public void testMergeOutsidePartitionFails() throws IOException {
+        mExpectedException.expect(IllegalStateException.class);
+        mExpectedException.expectMessage("outside of configuration directory");
+
+        createFile("/vendor/overlay/config/config2.xml");
+        createFile("/product/overlay/config/config.xml",
+                "<config>"
+                        + "  <merge path=\"../../../vendor/overlay/config/config2.xml\" />"
+                        + "</config>");
+
+        createConfigImpl();
+    }
+
+    @Test
+    public void testMergeCircularFails() throws IOException {
+        mExpectedException.expect(IllegalStateException.class);
+        mExpectedException.expectMessage("Maximum <merge> depth exceeded");
+
+        createFile("/product/overlay/config/config.xml",
+                "<config>"
+                        + "  <merge path=\"config2.xml\" />"
+                        + "</config>");
+        createFile("/product/overlay/config/config2.xml",
+                "<config>"
+                        + "  <merge path=\"config.xml\" />"
+                        + "</config>");
+
+        createConfigImpl();
+    }
+
+    @Test
+    public void testMergeMissingFileFails() throws IOException {
+        mExpectedException.expect(IllegalStateException.class);
+        mExpectedException.expectMessage("does not exist");
+
+        createFile("/product/overlay/config/config.xml",
+                "<config>"
+                        + "  <merge path=\"config2.xml\" />"
+                        + "</config>");
+        createConfigImpl();
+    }
+
+    @Test
+    public void testProductOverridesVendor() throws IOException {
+        createFile("/vendor/overlay/config/config.xml",
+                "<config>"
+                        + "  <overlay package=\"one\" enabled=\"false\" />"
+                        + "</config>");
+        createFile("/product/overlay/config/config.xml",
+                "<config>"
+                        + "  <overlay package=\"one\" enabled=\"true\" />"
+                        + "</config>");
+
+        mScannerRule.addOverlay(createFile("/vendor/overlay/one.apk"), "one");
+        mScannerRule.addOverlay(createFile("/product/overlay/one.apk"), "one");
+
+        final OverlayConfig overlayConfig = createConfigImpl();
+        assertConfig(overlayConfig, "one", true, true, 1);
+    }
+
+    @Test
+    public void testPartitionPrecedence() throws IOException {
+        createFile("/vendor/overlay/config/config.xml",
+                "<config>"
+                        + "  <overlay package=\"one\" enabled=\"true\" />"
+                        + "</config>");
+        createFile("/odm/overlay/config/config.xml",
+                "<config>"
+                        + "  <overlay package=\"two\" enabled=\"true\" />"
+                        + "</config>");
+        createFile("/oem/overlay/config/config.xml",
+                "<config>"
+                        + "  <overlay package=\"three\" enabled=\"true\" />"
+                        + "</config>");
+        createFile("/product/overlay/config/config.xml",
+                "<config>"
+                        + "  <overlay package=\"four\" enabled=\"true\" />"
+                        + "</config>");
+        createFile("/system_ext/overlay/config/config.xml",
+                "<config>"
+                        + "  <overlay package=\"five\" enabled=\"true\" />"
+                        + "</config>");
+
+        mScannerRule.addOverlay(createFile("/vendor/overlay/one.apk"), "one");
+        mScannerRule.addOverlay(createFile("/odm/overlay/two.apk"), "two");
+        mScannerRule.addOverlay(createFile("/oem/overlay/three.apk"), "three");
+        mScannerRule.addOverlay(createFile("/product/overlay/four.apk"), "four");
+        mScannerRule.addOverlay(createFile("/system_ext/overlay/five.apk"), "five");
+
+        final OverlayConfig overlayConfig = createConfigImpl();
+        assertConfig(overlayConfig, "one", true, true, 0);
+        assertConfig(overlayConfig, "two", true, true, 1);
+        assertConfig(overlayConfig, "three", true, true, 2);
+        assertConfig(overlayConfig, "four", true, true, 3);
+        assertConfig(overlayConfig, "five", true, true, 4);
+    }
+
+    @Test
+    public void testImmutable() throws IOException {
+        createFile("/product/overlay/config/config.xml",
+                "<config>"
+                        + "  <overlay package=\"one\" mutable=\"false\" />"
+                        + "  <overlay package=\"two\" />"
+                        + "  <overlay package=\"three\" mutable=\"true\" />"
+                        + "</config>");
+
+
+        mScannerRule.addOverlay(createFile("/product/overlay/one.apk"), "one");
+        mScannerRule.addOverlay(createFile("/product/overlay/two.apk"), "two");
+        mScannerRule.addOverlay(createFile("/product/overlay/three.apk"), "three");
+
+        final OverlayConfig overlayConfig = createConfigImpl();
+        assertConfig(overlayConfig, "one", false, false, 0);
+        assertConfig(overlayConfig, "two", true, false, 1);
+        assertConfig(overlayConfig, "three", true, false, 2);
+    }
+
+    @Test
+    public void testEnabled() throws IOException {
+        createFile("/product/overlay/config/config.xml",
+                "<config>"
+                        + "  <overlay package=\"one\" />"
+                        + "  <overlay package=\"two\" enabled=\"true\" />"
+                        + "  <overlay package=\"three\" enabled=\"false\" />"
+                        + "</config>");
+
+
+        mScannerRule.addOverlay(createFile("/product/overlay/one.apk"), "one");
+        mScannerRule.addOverlay(createFile("/product/overlay/two.apk"), "two");
+        mScannerRule.addOverlay(createFile("/product/overlay/three.apk"), "three");
+
+        final OverlayConfig overlayConfig = createConfigImpl();
+        assertConfig(overlayConfig, "one", true, false, 0);
+        assertConfig(overlayConfig, "two", true, true, 1);
+        assertConfig(overlayConfig, "three", true, false, 2);
+    }
+
+    @Test
+    public void testMerge() throws IOException {
+        createFile("/product/overlay/config/auto-generated-config.xml",
+                "<config>"
+                        + "  <overlay package=\"two\" mutable=\"false\" enabled=\"true\" />"
+                        + "  <overlay package=\"three\" mutable=\"false\" enabled=\"true\" />"
+                        + "</config>");
+
+        createFile("/product/overlay/config/config.xml",
+                "<config>"
+                        + "  <overlay package=\"one\" mutable=\"false\" enabled=\"true\" />"
+                        + "  <merge path=\"auto-generated-config.xml\" />"
+                        + "  <overlay package=\"four\" enabled=\"true\" />"
+                        + "</config>");
+
+        mScannerRule.addOverlay(createFile("/product/overlay/one.apk"), "one");
+        mScannerRule.addOverlay(createFile("/product/overlay/two.apk"), "two");
+        mScannerRule.addOverlay(createFile("/product/overlay/three.apk"), "three");
+        mScannerRule.addOverlay(createFile("/product/overlay/four.apk"), "four");
+
+        final OverlayConfig overlayConfig = createConfigImpl();
+        OverlayConfig.Configuration o1 = overlayConfig.getConfiguration("one");
+        assertNotNull(o1);
+        assertFalse(o1.parsedConfig.mutable);
+        assertTrue(o1.parsedConfig.enabled);
+        assertEquals(0, o1.configIndex);
+
+        OverlayConfig.Configuration o2 = overlayConfig.getConfiguration("two");
+        assertNotNull(o2);
+        assertFalse(o2.parsedConfig.mutable);
+        assertTrue(o2.parsedConfig.enabled);
+        assertEquals(1, o2.configIndex);
+
+        OverlayConfig.Configuration o3 = overlayConfig.getConfiguration("three");
+        assertNotNull(o3);
+        assertFalse(o3.parsedConfig.mutable);
+        assertTrue(o3.parsedConfig.enabled);
+        assertEquals(2, o3.configIndex);
+
+        OverlayConfig.Configuration o4 = overlayConfig.getConfiguration("four");
+        assertNotNull(o4);
+        assertTrue(o4.parsedConfig.mutable);
+        assertTrue(o4.parsedConfig.enabled);
+        assertEquals(3, o4.configIndex);
+    }
+
+    @Test
+    public void testIdmapInvocationsFrameworkImmutable() throws IOException {
+        createFile("/vendor/overlay/config/config.xml",
+                "<config>"
+                        + "  <overlay package=\"one\" mutable=\"false\" enabled=\"true\" />"
+                        + "  <overlay package=\"two\" mutable=\"false\" enabled=\"true\" />"
+                        + "  <overlay package=\"three\" enabled=\"true\" />"
+                        + "</config>");
+
+        createFile("/product/overlay/config/config.xml",
+                "<config>"
+                        + "  <overlay package=\"four\" mutable=\"false\" enabled=\"true\" />"
+                        + "  <overlay package=\"five\" mutable=\"false\" enabled=\"true\" />"
+                        + "  <overlay package=\"six\" mutable=\"false\" enabled=\"false\" />"
+                        + "</config>");
+
+        mScannerRule.addOverlay(createFile("/vendor/overlay/one.apk"), "one", "android");
+        mScannerRule.addOverlay(createFile("/vendor/overlay/two.apk"), "two", "android");
+        mScannerRule.addOverlay(createFile("/vendor/overlay/three.apk"), "three", "android");
+        mScannerRule.addOverlay(createFile("/product/overlay/four.apk"), "four", "android");
+        mScannerRule.addOverlay(createFile("/product/overlay/five.apk"), "five");
+        mScannerRule.addOverlay(createFile("/product/overlay/six.apk"), "six", "android");
+
+        final OverlayConfig overlayConfig = createConfigImpl();
+        if (mScannerRule.getIteration() == OverlayConfigIterationRule.Iteration.ZYGOTE) {
+            final ArrayList<IdmapInvocation> idmapInvocations =
+                    overlayConfig.getImmutableFrameworkOverlayIdmapInvocations();
+            assertEquals(2, idmapInvocations.size());
+
+            final IdmapInvocation i0 = idmapInvocations.get(0);
+            assertTrue(i0.enforceOverlayable);
+            assertEquals("vendor", i0.policy);
+            assertEquals(2, i0.overlayPaths.size());
+            assertTrue(i0.overlayPaths.get(0).endsWith("/vendor/overlay/one.apk"));
+            assertTrue(i0.overlayPaths.get(1).endsWith("/vendor/overlay/two.apk"));
+
+            final IdmapInvocation i1 = idmapInvocations.get(1);
+            assertTrue(i1.enforceOverlayable);
+            assertEquals("product", i1.policy);
+            assertEquals(1, i1.overlayPaths.size());
+            assertTrue(i1.overlayPaths.get(0).endsWith("/product/overlay/four.apk"));
+        }
+    }
+
+    @Test
+    public void testIdmapInvocationsDifferentTargetSdk() throws IOException {
+        createFile("/product/overlay/config/config.xml",
+                "<config>"
+                        + "  <overlay package=\"one\" mutable=\"false\" enabled=\"true\" />"
+                        + "  <overlay package=\"two\" mutable=\"false\" enabled=\"true\" />"
+                        + "  <overlay package=\"three\" mutable=\"false\" enabled=\"true\" />"
+                        + "  <overlay package=\"four\" mutable=\"false\" enabled=\"true\" />"
+                        + "</config>");
+
+        mScannerRule.addOverlay(createFile("/product/overlay/one.apk"), "one", "android");
+        mScannerRule.addOverlay(createFile("/product/overlay/two.apk"), "two", "android");
+        mScannerRule.addOverlay(createFile("/product/overlay/three.apk"), "three", "android", 28);
+        mScannerRule.addOverlay(createFile("/product/overlay/four.apk"), "four", "android");
+
+        final OverlayConfig overlayConfig = createConfigImpl();
+
+        if (mScannerRule.getIteration() == OverlayConfigIterationRule.Iteration.ZYGOTE) {
+            final ArrayList<IdmapInvocation> idmapInvocations =
+                    overlayConfig.getImmutableFrameworkOverlayIdmapInvocations();
+            assertEquals(3, idmapInvocations.size());
+
+            final IdmapInvocation i0 = idmapInvocations.get(0);
+            assertTrue(i0.enforceOverlayable);
+            assertEquals(2, i0.overlayPaths.size());
+            assertTrue(i0.overlayPaths.get(0).endsWith("/product/overlay/one.apk"));
+            assertTrue(i0.overlayPaths.get(1).endsWith("/product/overlay/two.apk"));
+
+            final IdmapInvocation i1 = idmapInvocations.get(1);
+            assertFalse(i1.enforceOverlayable);
+            assertEquals(1, i1.overlayPaths.size());
+            assertTrue(i1.overlayPaths.get(0).endsWith("/product/overlay/three.apk"));
+
+            final IdmapInvocation i2 = idmapInvocations.get(2);
+            assertTrue(i2.enforceOverlayable);
+            assertEquals(1, i2.overlayPaths.size());
+            assertTrue(i2.overlayPaths.get(0).endsWith("/product/overlay/four.apk"));
+        }
+    }
+
+    @Test
+    public void testNoConfigIsStatic() throws IOException {
+        mScannerRule.addOverlay(createFile("/product/overlay/one.apk"), "one", "android", 28, true,
+                1);
+        mScannerRule.addOverlay(createFile("/product/overlay/two.apk"), "two", "android", 28, false,
+                0);
+        mScannerRule.addOverlay(createFile("/product/overlay/three.apk"), "three", "android", 28,
+                true, 0);
+        mScannerRule.addOverlay(createFile("/product/overlay/four.apk"), "four", "android", 28,
+                false, 2);
+
+        final OverlayConfig overlayConfig = createConfigImpl();
+        assertConfig(overlayConfig, "one", false, true, 1);
+        assertConfig(overlayConfig, "three", false, true, 0);
+
+    }
+
+    @Test
+    public void testVendorStaticPrecedesProductImmutable() throws IOException {
+        createFile("/product/overlay/config/config.xml",
+                "<config>"
+                        + "  <overlay package=\"two\" mutable=\"false\" enabled=\"true\" />"
+                        + "</config>");
+
+        mScannerRule.addOverlay(createFile("/vendor/overlay/one.apk"), "one", "android", 0, true,
+                1);
+        mScannerRule.addOverlay(createFile("/product/overlay/two.apk"), "two", "android", 0, true,
+                0);
+
+        final OverlayConfig overlayConfig = createConfigImpl();
+        assertConfig(overlayConfig, "one", false, true, 0);
+        assertConfig(overlayConfig, "two", false, true, 1);
+    }
+
+    @Test
+    public void testVendorImmutablePrecededProductStatic() throws IOException {
+        createFile("/vendor/overlay/config/config.xml",
+                "<config>"
+                        + "  <overlay package=\"one\" mutable=\"false\" enabled=\"true\" />"
+                        + "</config>");
+
+        mScannerRule.addOverlay(createFile("/vendor/overlay/one.apk"), "one", "android", 0, true,
+                1);
+        mScannerRule.addOverlay(createFile("/product/overlay/two.apk"), "two", "android", 0, true,
+                0);
+
+        final OverlayConfig overlayConfig = createConfigImpl();
+        assertConfig(overlayConfig, "one", false, true, 0);
+        assertConfig(overlayConfig, "two", false, true, 1);
+    }
+
+    @Test
+    public void testNoConfigsAllowPartitionReordering() throws IOException {
+        mScannerRule.addOverlay(createFile("/vendor/overlay/one.apk"), "one", "android", 0, true,
+                1);
+        mScannerRule.addOverlay(createFile("/product/overlay/two.apk"), "two", "android", 0, true,
+                0);
+
+        final OverlayConfig overlayConfig = createConfigImpl();
+        assertConfig(overlayConfig, "one", false, true, 1);
+        assertConfig(overlayConfig, "two", false, true, 0);
+    }
+
+    @Test
+    public void testConfigDisablesPartitionReordering() throws IOException {
+        createFile("/odm/overlay/config/config.xml",
+                "<config>"
+                        + "  <overlay package=\"two\" enabled=\"true\" />"
+                        + "</config>");
+
+        mScannerRule.addOverlay(createFile("/vendor/overlay/one.apk"), "one", "android", 0, true,
+                1);
+        mScannerRule.addOverlay(createFile("/odm/overlay/two.apk"), "two");
+        mScannerRule.addOverlay(createFile("/product/overlay/three.apk"), "three", "android", 0,
+                true, 0);
+
+        final OverlayConfig overlayConfig = createConfigImpl();
+        assertConfig(overlayConfig, "one", false, true, 0);
+        assertConfig(overlayConfig, "two", true, true, 1);
+        assertConfig(overlayConfig, "three", false, true, 2);
+    }
+
+    @Test
+    public void testStaticOverlayOutsideOverlayDir() throws IOException {
+        mScannerRule.addOverlay(createFile("/product/app/one.apk"), "one", "android", 0, true, 0);
+
+        final OverlayConfig overlayConfig = createConfigImpl();
+        if (mScannerRule.getIteration() == OverlayConfigIterationRule.Iteration.SYSTEM_SERVER) {
+            assertConfig(overlayConfig, "one", false, true, 0);
+        }
+    }
+
+    @Test
+    public void testSortStaticOverlaysDifferentTargets() throws IOException {
+        mScannerRule.addOverlay(createFile("/vendor/overlay/one.apk"), "one", "other", 0, true, 0);
+        mScannerRule.addOverlay(createFile("/product/overlay/two.apk"), "two", "android", 0, true,
+                0);
+
+        final OverlayConfig overlayConfig = createConfigImpl();
+        assertConfig(overlayConfig, "one", false, true, 1);
+        assertConfig(overlayConfig, "two", false, true, 0);
+    }
+
+    @Test
+    public void testSortStaticOverlaysSamePriority() throws IOException {
+        mScannerRule.addOverlay(createFile("/vendor/overlay/one.apk"), "one", "android", 0, true,
+                0);
+        mScannerRule.addOverlay(createFile("/product/overlay/two.apk"), "two", "android", 0, true,
+                0);
+
+        final OverlayConfig overlayConfig = createConfigImpl();
+        assertConfig(overlayConfig, "one", false, true, 1);
+        assertConfig(overlayConfig, "two", false, true, 0);
+    }
+
+    @Test
+    public void testNonSystemOverlayCannotBeStatic() throws IOException {
+        mScannerRule.addOverlay(createFile("/data/overlay/one.apk"), "one", "android", 0, true,
+                0);
+
+        final OverlayConfig overlayConfig = createConfigImpl();
+        assertTrue(overlayConfig.isMutable("one"));
+        assertFalse(overlayConfig.isEnabled("one"));
+        assertEquals(Integer.MAX_VALUE, overlayConfig.getPriority("one"));
+    }
+
+    @Test
+    public void testGetOverlayInfo() throws IOException {
+        if (mScannerRule.getIteration() != OverlayConfigIterationRule.Iteration.ZYGOTE) {
+            // Run only one iteration of the test.
+            return;
+        }
+
+        final InputStream is = InstrumentationRegistry.getContext().getResources()
+                .openRawResource(R.raw.overlay_config);
+        final File partitionDir = mTestFolder.newFolder("product", "overlay");
+        final File testApk = new File(partitionDir, "test.apk");
+        FileUtils.copy(is, new FileOutputStream(testApk));
+
+        final OverlayScanner scanner = new OverlayScanner();
+        scanner.scanDir(partitionDir);
+
+        final OverlayScanner.ParsedOverlayInfo info = scanner.getParsedInfo(TEST_APK_PACKAGE_NAME);
+        assertNotNull(info);
+        assertEquals(TEST_APK_PACKAGE_NAME, info.packageName);
+        assertEquals("android", info.targetPackageName);
+        assertEquals(testApk.getPath(), info.path.getPath());
+        assertEquals(21, info.targetSdkVersion);
+    }
+}
diff --git a/core/tests/coretests/src/com/android/internal/os/BatteryStatsTests.java b/core/tests/coretests/src/com/android/internal/os/BatteryStatsTests.java
index a6329298..2ad8e18 100644
--- a/core/tests/coretests/src/com/android/internal/os/BatteryStatsTests.java
+++ b/core/tests/coretests/src/com/android/internal/os/BatteryStatsTests.java
@@ -40,6 +40,7 @@
         BatteryStatsUserLifecycleTests.class,
         KernelCpuProcStringReaderTest.class,
         KernelCpuUidActiveTimeReaderTest.class,
+        KernelCpuUidBpfMapReaderTest.class,
         KernelCpuUidClusterTimeReaderTest.class,
         KernelCpuUidFreqTimeReaderTest.class,
         KernelCpuUidUserSysTimeReaderTest.class,
diff --git a/core/tests/coretests/src/com/android/internal/os/KernelCpuUidActiveTimeReaderTest.java b/core/tests/coretests/src/com/android/internal/os/KernelCpuUidActiveTimeReaderTest.java
index 1b13a99..2ccd74e 100644
--- a/core/tests/coretests/src/com/android/internal/os/KernelCpuUidActiveTimeReaderTest.java
+++ b/core/tests/coretests/src/com/android/internal/os/KernelCpuUidActiveTimeReaderTest.java
@@ -21,11 +21,11 @@
 
 import android.content.Context;
 import android.os.FileUtils;
+import android.util.SparseArray;
 import android.util.SparseLongArray;
 
 import androidx.test.InstrumentationRegistry;
 import androidx.test.filters.SmallTest;
-import androidx.test.runner.AndroidJUnit4;
 
 import com.android.internal.os.KernelCpuUidTimeReader.KernelCpuUidActiveTimeReader;
 
@@ -33,11 +33,15 @@
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameters;
 
 import java.io.BufferedWriter;
 import java.io.File;
 import java.io.IOException;
 import java.nio.file.Files;
+import java.util.Arrays;
+import java.util.Collection;
 import java.util.Random;
 
 /**
@@ -46,14 +50,16 @@
  * $ atest FrameworksCoreTests:com.android.internal.os.KernelCpuUidActiveTimeReaderTest
  */
 @SmallTest
-@RunWith(AndroidJUnit4.class)
+@RunWith(Parameterized.class)
 public class KernelCpuUidActiveTimeReaderTest {
     private File mTestDir;
     private File mTestFile;
     private KernelCpuUidActiveTimeReader mReader;
+    private KernelCpuUidTestBpfMapReader mBpfMapReader;
     private VerifiableCallback mCallback;
 
     private Random mRand = new Random(12345);
+    protected boolean mUseBpf;
     private final int mCpus = 4;
     private final String mHeadline = "cpus: 4\n";
     private final int[] mUids = {0, 1, 22, 333, 4444, 55555};
@@ -62,12 +68,22 @@
         return InstrumentationRegistry.getContext();
     }
 
+    @Parameters(name="useBpf={0}")
+    public static Collection<Object[]> data() {
+        return Arrays.asList(new Object[][] { {true}, {false} });
+    }
+
+    public KernelCpuUidActiveTimeReaderTest(boolean useBpf) {
+        mUseBpf = useBpf;
+    }
+
     @Before
     public void setUp() {
         mTestDir = getContext().getDir("test", Context.MODE_PRIVATE);
         mTestFile = new File(mTestDir, "test.file");
+        mBpfMapReader = new KernelCpuUidTestBpfMapReader();
         mReader = new KernelCpuUidActiveTimeReader(
-                new KernelCpuProcStringReader(mTestFile.getAbsolutePath()), false);
+                new KernelCpuProcStringReader(mTestFile.getAbsolutePath()), mBpfMapReader, false);
         mCallback = new VerifiableCallback();
     }
 
@@ -80,7 +96,7 @@
     @Test
     public void testReadDelta() throws Exception {
         final long[][] times = increaseTime(new long[mUids.length][mCpus]);
-        writeToFile(mHeadline + uidLines(mUids, times));
+        setCpusAndData(times);
         mReader.readDelta(mCallback);
         for (int i = 0; i < mUids.length; ++i) {
             mCallback.verify(mUids[i], getActiveTime(times[i]));
@@ -90,7 +106,7 @@
         // Verify that a second call will only return deltas.
         mCallback.clear();
         final long[][] newTimes1 = increaseTime(times);
-        writeToFile(mHeadline + uidLines(mUids, newTimes1));
+        setCpusAndData(newTimes1);
         mReader.readDelta(mCallback);
         for (int i = 0; i < mUids.length; ++i) {
             mCallback.verify(mUids[i], getActiveTime(newTimes1[i]) - getActiveTime(times[i]));
@@ -105,7 +121,7 @@
         // Verify that calling with a null callback doesn't result in any crashes
         mCallback.clear();
         final long[][] newTimes2 = increaseTime(newTimes1);
-        writeToFile(mHeadline + uidLines(mUids, newTimes2));
+        setCpusAndData(newTimes2);
         mReader.readDelta(null);
         mCallback.verifyNoMoreInteractions();
 
@@ -113,19 +129,20 @@
         // the previous call had null callback.
         mCallback.clear();
         final long[][] newTimes3 = increaseTime(newTimes2);
+        setCpusAndData(newTimes3);
         writeToFile(mHeadline + uidLines(mUids, newTimes3));
         mReader.readDelta(mCallback);
         for (int i = 0; i < mUids.length; ++i) {
             mCallback.verify(mUids[i], getActiveTime(newTimes3[i]) - getActiveTime(newTimes2[i]));
         }
         mCallback.verifyNoMoreInteractions();
-        assertTrue(mTestFile.delete());
+        clearCpusAndData();
     }
 
     @Test
     public void testReadAbsolute() throws Exception {
         final long[][] times1 = increaseTime(new long[mUids.length][mCpus]);
-        writeToFile(mHeadline + uidLines(mUids, times1));
+        setCpusAndData(times1);
         mReader.readAbsolute(mCallback);
         for (int i = 0; i < mUids.length; i++) {
             mCallback.verify(mUids[i], getActiveTime(times1[i]));
@@ -135,19 +152,19 @@
         // Verify that a second call should still return absolute values
         mCallback.clear();
         final long[][] times2 = increaseTime(times1);
-        writeToFile(mHeadline + uidLines(mUids, times2));
+        setCpusAndData(times2);
         mReader.readAbsolute(mCallback);
         for (int i = 0; i < mUids.length; i++) {
             mCallback.verify(mUids[i], getActiveTime(times2[i]));
         }
         mCallback.verifyNoMoreInteractions();
-        assertTrue(mTestFile.delete());
+        clearCpusAndData();
     }
 
     @Test
     public void testReadDeltaDecreasedTime() throws Exception {
         final long[][] times1 = increaseTime(new long[mUids.length][mCpus]);
-        writeToFile(mHeadline + uidLines(mUids, times1));
+        setCpusAndData(times1);
         mReader.readDelta(mCallback);
 
         // Verify that there should not be a callback for a particular UID if its time decreases.
@@ -155,19 +172,19 @@
         final long[][] times2 = increaseTime(times1);
         System.arraycopy(times1[0], 0, times2[0], 0, mCpus);
         times2[0][0] = 100;
-        writeToFile(mHeadline + uidLines(mUids, times2));
+        setCpusAndData(times2);
         mReader.readDelta(mCallback);
         for (int i = 1; i < mUids.length; i++) {
             mCallback.verify(mUids[i], getActiveTime(times2[i]) - getActiveTime(times1[i]));
         }
         mCallback.verifyNoMoreInteractions();
-        assertTrue(mTestFile.delete());
+        clearCpusAndData();
 
         // Verify that the internal state was not modified.
         mCallback.clear();
         final long[][] times3 = increaseTime(times2);
         times3[0] = increaseTime(times1)[0];
-        writeToFile(mHeadline + uidLines(mUids, times3));
+        setCpusAndData(times3);
         mReader.readDelta(mCallback);
         mCallback.verify(mUids[0], getActiveTime(times3[0]) - getActiveTime(times1[0]));
         for (int i = 1; i < mUids.length; i++) {
@@ -179,26 +196,26 @@
     @Test
     public void testReadDeltaNegativeTime() throws Exception {
         final long[][] times1 = increaseTime(new long[mUids.length][mCpus]);
-        writeToFile(mHeadline + uidLines(mUids, times1));
+        setCpusAndData(times1);
         mReader.readDelta(mCallback);
 
         // Verify that there should not be a callback for a particular UID if its time is -ve.
         mCallback.clear();
         final long[][] times2 = increaseTime(times1);
         times2[0][0] *= -1;
-        writeToFile(mHeadline + uidLines(mUids, times2));
+        setCpusAndData(times2);
         mReader.readDelta(mCallback);
         for (int i = 1; i < mUids.length; i++) {
             mCallback.verify(mUids[i], getActiveTime(times2[i]) - getActiveTime(times1[i]));
         }
         mCallback.verifyNoMoreInteractions();
-        assertTrue(mTestFile.delete());
+        clearCpusAndData();
 
         // Verify that the internal state was not modified.
         mCallback.clear();
         final long[][] times3 = increaseTime(times2);
         times3[0] = increaseTime(times1)[0];
-        writeToFile(mHeadline + uidLines(mUids, times3));
+        setCpusAndData(times3);
         mReader.readDelta(mCallback);
         mCallback.verify(mUids[0], getActiveTime(times3[0]) - getActiveTime(times1[0]));
         for (int i = 1; i < mUids.length; i++) {
@@ -207,6 +224,28 @@
         mCallback.verifyNoMoreInteractions();
     }
 
+    private void setCpusAndData(long[][] times) throws IOException {
+        if (mUseBpf) {
+            mBpfMapReader.setCpus(new long[]{ mCpus });
+            SparseArray<long[]> data = new SparseArray<>();
+            for (int i = 0; i < mUids.length; i++) {
+                data.put(mUids[i], times[i]);
+            }
+            mBpfMapReader.setData(data);
+        } else {
+            writeToFile(mHeadline + uidLines(mUids, times));
+        }
+    }
+
+    private void clearCpusAndData() {
+        if (mUseBpf) {
+            mBpfMapReader.setCpus(null);
+            mBpfMapReader.setData(new SparseArray<>());
+        } else {
+            assertTrue(mTestFile.delete());
+        }
+    }
+
     private String uidLines(int[] uids, long[][] times) {
         StringBuffer sb = new StringBuffer();
         for (int i = 0; i < uids.length; i++) {
@@ -261,4 +300,36 @@
             assertEquals(0, mData.size());
         }
     }
+
+    private class KernelCpuUidTestBpfMapReader extends KernelCpuUidBpfMapReader {
+        private long[] mCpus;
+        private SparseArray<long[]> mNewData = new SparseArray<>();
+
+        public void setData(SparseArray<long[]> data) {
+            mNewData = data;
+        }
+
+        public void setCpus(long[] cpus) {
+            mCpus = cpus;
+        }
+
+        @Override
+        public final boolean startTrackingBpfTimes() {
+            return true;
+        }
+
+        @Override
+        protected final boolean readBpfData() {
+            if (!mUseBpf) {
+                return false;
+            }
+            mData = mNewData;
+            return true;
+        }
+
+        @Override
+        public final long[] getDataDimensions() {
+            return mCpus;
+        }
+    }
 }
diff --git a/core/tests/coretests/src/com/android/internal/os/KernelCpuUidBpfMapReaderTest.java b/core/tests/coretests/src/com/android/internal/os/KernelCpuUidBpfMapReaderTest.java
new file mode 100644
index 0000000..257b388
--- /dev/null
+++ b/core/tests/coretests/src/com/android/internal/os/KernelCpuUidBpfMapReaderTest.java
@@ -0,0 +1,237 @@
+/*
+ * 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.internal.os;
+
+import static org.junit.Assert.assertArrayEquals;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import android.content.Context;
+import android.util.SparseArray;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+import org.junit.runner.RunWith;
+
+import com.android.internal.os.KernelCpuUidBpfMapReader.BpfMapIterator;
+
+import org.junit.Before;
+import org.junit.Test;
+
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+import java.util.Random;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.Executors;
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.TimeUnit;
+import java.util.stream.IntStream;
+
+@SmallTest
+@RunWith(AndroidJUnit4.class)
+public class KernelCpuUidBpfMapReaderTest {
+    private Random mRand = new Random(12345);
+    private KernelCpuUidTestBpfMapReader mReader;
+
+    private Context getContext() {
+        return InstrumentationRegistry.getContext();
+    }
+
+    @Before
+    public void setUp() {
+        mReader =  new KernelCpuUidTestBpfMapReader();
+    }
+
+    /**
+     * Tests that reading returns null if readBpfData() fails.
+     */
+    @Test
+    public void testUnsuccessfulRead() {
+        assertEquals(null, mReader.open());
+    }
+
+    /**
+     * Tests that reading will always return null after 5 failures.
+     */
+    @Test
+    public void testReadErrorsLimit() {
+        for (int i = 0; i < 3; i++) {
+            try (BpfMapIterator iter = mReader.open()) {
+                assertNull(iter);
+            }
+        }
+
+        SparseArray<long[]> data = new SparseArray<>();
+        long[] times = {2};
+        data.put(1, new long[]{2});
+        mReader.setData(data);
+        testOpenAndReadData(data);
+
+        mReader.setData(null);
+        for (int i = 0; i < 3; i++) {
+            try (BpfMapIterator iter = mReader.open(true)) {
+                assertNull(iter);
+            }
+        }
+        mReader.setData(data);
+        try (BpfMapIterator iter = mReader.open(true)) {
+            assertNull(iter);
+        }
+    }
+
+    /** Tests getNextUid functionality. */
+    @Test
+    public void testGetNextUid() {
+        final SparseArray<long[]> data = getTestSparseArray(800, 50);
+        mReader.setData(data);
+        testOpenAndReadData(data);
+    }
+
+    @Test
+    public void testConcurrent() throws Exception {
+        final SparseArray<long[]> data = getTestSparseArray(200, 50);
+        final SparseArray<long[]> data1 = getTestSparseArray(180, 70);
+        final List<Throwable> errs = Collections.synchronizedList(new ArrayList<>());
+        mReader.setData(data);
+        // An additional thread for modifying the data.
+        ScheduledExecutorService threadPool = Executors.newScheduledThreadPool(11);
+        final CountDownLatch ready = new CountDownLatch(10);
+        final CountDownLatch start = new CountDownLatch(1);
+        final CountDownLatch modify = new CountDownLatch(1);
+        final CountDownLatch done = new CountDownLatch(10);
+
+        for (int i = 0; i < 5; i++) {
+            threadPool.submit(() -> {
+                    ready.countDown();
+                    try {
+                        start.await();
+                        testOpenAndReadData(data);
+                    } catch (Throwable e) {
+                        errs.add(e);
+                    } finally {
+                        done.countDown();
+                    }
+            });
+            threadPool.submit(() -> {
+                    ready.countDown();
+                    try {
+                        start.await();
+                        // Wait for data modification.
+                        modify.await();
+                        testOpenAndReadData(data1);
+                    } catch (Throwable e) {
+                        errs.add(e);
+                    } finally {
+                        done.countDown();
+                    }
+             });
+        }
+
+        assertTrue("Prep timed out", ready.await(100, TimeUnit.MILLISECONDS));
+        start.countDown();
+
+        threadPool.schedule(() -> {
+                mReader.setData(data1);
+                modify.countDown();
+        }, 600, TimeUnit.MILLISECONDS);
+
+        assertTrue("Execution timed out", done.await(3, TimeUnit.SECONDS));
+        threadPool.shutdownNow();
+
+        StringWriter sw = new StringWriter();
+        PrintWriter pw = new PrintWriter(sw);
+        errs.forEach(e -> e.printStackTrace(pw));
+
+        assertTrue("All Exceptions:\n" + sw.toString(), errs.isEmpty());
+    }
+
+    @Test
+    public void testRemoveUidsInRange() {
+        final SparseArray<long[]> data = getTestSparseArray(200, 50);
+        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;
+            if (expectedData.size() > 0) {
+                actual = new long[expectedData.valueAt(0).length + 1];
+            } else {
+                actual = new long[0];
+            }
+            for (int i = 0; i < expectedData.size(); i++) {
+                assertTrue(iter.getNextUid(actual));
+                assertEquals(expectedData.keyAt(i), actual[0]);
+                assertArrayEquals(expectedData.valueAt(i), Arrays.copyOfRange(actual, 1, actual.length));
+            }
+            assertFalse(iter.getNextUid(actual));
+            assertFalse(iter.getNextUid(actual));
+        }
+    }
+
+
+    private SparseArray<long[]> getTestSparseArray(int uids, int numPerUid) {
+        SparseArray<long[]> data = new SparseArray<>();
+        for (int i = 0; i < uids; i++) {
+            data.put(i, mRand.longs(numPerUid, 0, Long.MAX_VALUE).toArray());
+        }
+        return data;
+    }
+
+
+    private class KernelCpuUidTestBpfMapReader extends KernelCpuUidBpfMapReader {
+        private SparseArray<long[]> mNewData;
+
+        public final void setData(SparseArray<long[]> newData) {
+            mNewData = newData;
+        }
+
+        @Override
+        public final boolean startTrackingBpfTimes() {
+            return true;
+        }
+
+        @Override
+        public final boolean readBpfData() {
+            if (mNewData == null) {
+                return false;
+            }
+            mData = mNewData;
+            return true;
+        }
+
+        @Override
+        public final long[] getDataDimensions() {
+            return null;
+        }
+
+    }
+}
diff --git a/core/tests/coretests/src/com/android/internal/os/KernelCpuUidClusterTimeReaderTest.java b/core/tests/coretests/src/com/android/internal/os/KernelCpuUidClusterTimeReaderTest.java
index 2ea80da..a0dab28 100644
--- a/core/tests/coretests/src/com/android/internal/os/KernelCpuUidClusterTimeReaderTest.java
+++ b/core/tests/coretests/src/com/android/internal/os/KernelCpuUidClusterTimeReaderTest.java
@@ -27,7 +27,6 @@
 
 import androidx.test.InstrumentationRegistry;
 import androidx.test.filters.SmallTest;
-import androidx.test.runner.AndroidJUnit4;
 
 import com.android.internal.os.KernelCpuUidTimeReader.KernelCpuUidClusterTimeReader;
 
@@ -35,11 +34,15 @@
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameters;
 
 import java.io.BufferedWriter;
 import java.io.File;
 import java.io.IOException;
 import java.nio.file.Files;
+import java.util.Arrays;
+import java.util.Collection;
 import java.util.Random;
 
 /**
@@ -48,28 +51,42 @@
  * $ atest FrameworksCoreTests:com.android.internal.os.KernelCpuUidClusterTimeReaderTest
  */
 @SmallTest
-@RunWith(AndroidJUnit4.class)
+@RunWith(Parameterized.class)
 public class KernelCpuUidClusterTimeReaderTest {
     private File mTestDir;
     private File mTestFile;
     private KernelCpuUidClusterTimeReader mReader;
+    private KernelCpuUidTestBpfMapReader mBpfMapReader;
     private VerifiableCallback mCallback;
 
     private Random mRand = new Random(12345);
+    protected boolean mUseBpf;
     private final int mCpus = 6;
     private final String mHeadline = "policy0: 4 policy4: 2\n";
+    private final long[] mCores = {4, 2};
     private final int[] mUids = {0, 1, 22, 333, 4444, 55555};
 
     private Context getContext() {
         return InstrumentationRegistry.getContext();
     }
 
+    @Parameters(name="useBpf={0}")
+    public static Collection<Object[]> data() {
+        return Arrays.asList(new Object[][] { {true}, {false} });
+    }
+
+    public KernelCpuUidClusterTimeReaderTest(boolean useBpf) {
+        mUseBpf = useBpf;
+    }
+
     @Before
     public void setUp() {
         mTestDir = getContext().getDir("test", Context.MODE_PRIVATE);
         mTestFile = new File(mTestDir, "test.file");
+        mBpfMapReader = new KernelCpuUidTestBpfMapReader();
         mReader = new KernelCpuUidClusterTimeReader(
-                new KernelCpuProcStringReader(mTestFile.getAbsolutePath()), false);
+                new KernelCpuProcStringReader(mTestFile.getAbsolutePath()), mBpfMapReader,
+                false);
         mCallback = new VerifiableCallback();
     }
 
@@ -82,7 +99,7 @@
     @Test
     public void testReadDelta() throws Exception {
         final long[][] times1 = increaseTime(new long[mUids.length][mCpus]);
-        writeToFile(mHeadline + uidLines(mUids, times1));
+        setCoresAndData(times1);
         mReader.readDelta(mCallback);
         for (int i = 0; i < mUids.length; ++i) {
             mCallback.verify(mUids[i], clusterTime(times1[i]));
@@ -92,7 +109,7 @@
         // Verify that a second call will only return deltas.
         mCallback.clear();
         final long[][] times2 = increaseTime(times1);
-        writeToFile(mHeadline + uidLines(mUids, times2));
+        setCoresAndData(times2);
         mReader.readDelta(mCallback);
         for (int i = 0; i < mUids.length; ++i) {
             mCallback.verify(mUids[i], subtract(clusterTime(times2[i]), clusterTime(times1[i])));
@@ -107,7 +124,7 @@
         // Verify that calling with a null callback doesn't result in any crashes
         mCallback.clear();
         final long[][] times3 = increaseTime(times2);
-        writeToFile(mHeadline + uidLines(mUids, times3));
+        setCoresAndData(times3);
         mReader.readDelta(null);
         mCallback.verifyNoMoreInteractions();
 
@@ -115,19 +132,19 @@
         // the previous call had null callback.
         mCallback.clear();
         final long[][] times4 = increaseTime(times3);
-        writeToFile(mHeadline + uidLines(mUids, times4));
+        setCoresAndData(times4);
         mReader.readDelta(mCallback);
         for (int i = 0; i < mUids.length; ++i) {
             mCallback.verify(mUids[i], subtract(clusterTime(times4[i]), clusterTime(times3[i])));
         }
         mCallback.verifyNoMoreInteractions();
-        assertTrue(mTestFile.delete());
+        clearCoresAndData();
     }
 
     @Test
     public void testReadAbsolute() throws Exception {
         final long[][] times1 = increaseTime(new long[mUids.length][mCpus]);
-        writeToFile(mHeadline + uidLines(mUids, times1));
+        setCoresAndData(times1);
         mReader.readAbsolute(mCallback);
         for (int i = 0; i < mUids.length; i++) {
             mCallback.verify(mUids[i], clusterTime(times1[i]));
@@ -137,19 +154,19 @@
         // Verify that a second call should still return absolute values
         mCallback.clear();
         final long[][] times2 = increaseTime(times1);
-        writeToFile(mHeadline + uidLines(mUids, times2));
+        setCoresAndData(times2);
         mReader.readAbsolute(mCallback);
         for (int i = 0; i < mUids.length; i++) {
             mCallback.verify(mUids[i], clusterTime(times2[i]));
         }
         mCallback.verifyNoMoreInteractions();
-        assertTrue(mTestFile.delete());
+        clearCoresAndData();
     }
 
     @Test
     public void testReadDeltaDecreasedTime() throws Exception {
         final long[][] times1 = increaseTime(new long[mUids.length][mCpus]);
-        writeToFile(mHeadline + uidLines(mUids, times1));
+        setCoresAndData(times1);
         mReader.readDelta(mCallback);
 
         // Verify that there should not be a callback for a particular UID if its time decreases.
@@ -157,19 +174,19 @@
         final long[][] times2 = increaseTime(times1);
         System.arraycopy(times1[0], 0, times2[0], 0, mCpus);
         times2[0][0] = 100;
-        writeToFile(mHeadline + uidLines(mUids, times2));
+        setCoresAndData(times2);
         mReader.readDelta(mCallback);
         for (int i = 1; i < mUids.length; i++) {
             mCallback.verify(mUids[i], subtract(clusterTime(times2[i]), clusterTime(times1[i])));
         }
         mCallback.verifyNoMoreInteractions();
-        assertTrue(mTestFile.delete());
+        clearCoresAndData();
 
         // Verify that the internal state was not modified.
         mCallback.clear();
         final long[][] times3 = increaseTime(times2);
         times3[0] = increaseTime(times1)[0];
-        writeToFile(mHeadline + uidLines(mUids, times3));
+        setCoresAndData(times3);
         mReader.readDelta(mCallback);
         mCallback.verify(mUids[0], subtract(clusterTime(times3[0]), clusterTime(times1[0])));
         for (int i = 1; i < mUids.length; i++) {
@@ -181,26 +198,26 @@
     @Test
     public void testReadDeltaNegativeTime() throws Exception {
         final long[][] times1 = increaseTime(new long[mUids.length][mCpus]);
-        writeToFile(mHeadline + uidLines(mUids, times1));
+        setCoresAndData(times1);
         mReader.readDelta(mCallback);
 
         // Verify that there should not be a callback for a particular UID if its time decreases.
         mCallback.clear();
         final long[][] times2 = increaseTime(times1);
         times2[0][0] *= -1;
-        writeToFile(mHeadline + uidLines(mUids, times2));
+        setCoresAndData(times2);
         mReader.readDelta(mCallback);
         for (int i = 1; i < mUids.length; i++) {
             mCallback.verify(mUids[i], subtract(clusterTime(times2[i]), clusterTime(times1[i])));
         }
         mCallback.verifyNoMoreInteractions();
-        assertTrue(mTestFile.delete());
+        clearCoresAndData();
 
         // Verify that the internal state was not modified.
         mCallback.clear();
         final long[][] times3 = increaseTime(times2);
         times3[0] = increaseTime(times1)[0];
-        writeToFile(mHeadline + uidLines(mUids, times3));
+        setCoresAndData(times3);
         mReader.readDelta(mCallback);
         mCallback.verify(mUids[0], subtract(clusterTime(times3[0]), clusterTime(times1[0])));
         for (int i = 1; i < mUids.length; i++) {
@@ -209,6 +226,28 @@
         mCallback.verifyNoMoreInteractions();
     }
 
+    private void setCoresAndData(long[][] times) throws IOException {
+        if (mUseBpf) {
+            mBpfMapReader.setClusterCores(mCores);
+            SparseArray<long[]> data = new SparseArray<>();
+            for (int i = 0; i < mUids.length; i++) {
+                data.put(mUids[i], times[i]);
+            }
+            mBpfMapReader.setData(data);
+        } else {
+            writeToFile(mHeadline + uidLines(mUids, times));
+        }
+    }
+
+    private void clearCoresAndData() {
+        if (mUseBpf) {
+            mBpfMapReader.setClusterCores(null);
+            mBpfMapReader.setData(new SparseArray<>());
+        } else {
+            assertTrue(mTestFile.delete());
+        }
+    }
+
     private long[] clusterTime(long[] times) {
         // Assumes 4 + 2 cores
         return new long[]{times[0] + times[1] / 2 + times[2] / 3 + times[3] / 4,
@@ -277,4 +316,36 @@
             assertEquals(0, mData.size());
         }
     }
+
+    private class KernelCpuUidTestBpfMapReader extends KernelCpuUidBpfMapReader {
+        private long[] mClusterCores;
+        private SparseArray<long[]> mNewData = new SparseArray<>();
+
+        public void setData(SparseArray<long[]> data) {
+            mNewData = data;
+        }
+
+        public void setClusterCores(long[] cores) {
+            mClusterCores = cores;
+        }
+
+        @Override
+        public final boolean startTrackingBpfTimes() {
+            return true;
+        }
+
+        @Override
+        protected final boolean readBpfData() {
+            if (!mUseBpf) {
+                return false;
+            }
+            mData = mNewData;
+            return true;
+        }
+
+        @Override
+        public final long[] getDataDimensions() {
+            return mClusterCores;
+        }
+    }
 }
diff --git a/core/tests/coretests/src/com/android/internal/os/KernelCpuUidFreqTimeReaderTest.java b/core/tests/coretests/src/com/android/internal/os/KernelCpuUidFreqTimeReaderTest.java
index 0b6fed3..c60a6d6 100644
--- a/core/tests/coretests/src/com/android/internal/os/KernelCpuUidFreqTimeReaderTest.java
+++ b/core/tests/coretests/src/com/android/internal/os/KernelCpuUidFreqTimeReaderTest.java
@@ -29,7 +29,6 @@
 
 import androidx.test.InstrumentationRegistry;
 import androidx.test.filters.SmallTest;
-import androidx.test.runner.AndroidJUnit4;
 
 import com.android.internal.os.KernelCpuUidTimeReader.KernelCpuUidFreqTimeReader;
 
@@ -37,6 +36,8 @@
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameters;
 import org.mockito.Mock;
 import org.mockito.MockitoAnnotations;
 
@@ -45,6 +46,7 @@
 import java.io.IOException;
 import java.nio.file.Files;
 import java.util.Arrays;
+import java.util.Collection;
 import java.util.Random;
 
 /**
@@ -53,14 +55,16 @@
  * $ atest FrameworksCoreTests:com.android.internal.os.KernelCpuUidFreqTimeReaderTest
  */
 @SmallTest
-@RunWith(AndroidJUnit4.class)
+@RunWith(Parameterized.class)
 public class KernelCpuUidFreqTimeReaderTest {
     private File mTestDir;
     private File mTestFile;
     private KernelCpuUidFreqTimeReader mReader;
+    private KernelCpuUidTestBpfMapReader mBpfMapReader;
     private VerifiableCallback mCallback;
     @Mock
     private PowerProfile mPowerProfile;
+    private boolean mUseBpf;
 
     private Random mRand = new Random(12345);
     private final int[] mUids = {0, 1, 22, 333, 4444, 55555};
@@ -69,13 +73,23 @@
         return InstrumentationRegistry.getContext();
     }
 
+    @Parameters(name="useBpf={0}")
+    public static Collection<Object[]> data() {
+        return Arrays.asList(new Object[][] { {true}, {false} });
+    }
+
+    public KernelCpuUidFreqTimeReaderTest(boolean useBpf) {
+        mUseBpf = useBpf;
+    }
+
     @Before
     public void setUp() {
         MockitoAnnotations.initMocks(this);
         mTestDir = getContext().getDir("test", Context.MODE_PRIVATE);
         mTestFile = new File(mTestDir, "test.file");
+        mBpfMapReader = new KernelCpuUidTestBpfMapReader();
         mReader = new KernelCpuUidFreqTimeReader(mTestFile.getAbsolutePath(),
-                new KernelCpuProcStringReader(mTestFile.getAbsolutePath()), false);
+                new KernelCpuProcStringReader(mTestFile.getAbsolutePath()), mBpfMapReader, false);
         mCallback = new VerifiableCallback();
     }
 
@@ -97,17 +111,17 @@
         final int[][] numFreqs = {{3, 6}, {4, 5}, {3, 5, 4}, {3}};
         for (int i = 0; i < freqs.length; ++i) {
             mReader = new KernelCpuUidFreqTimeReader(mTestFile.getAbsolutePath(),
-                    new KernelCpuProcStringReader(mTestFile.getAbsolutePath()), false);
+                    new KernelCpuProcStringReader(mTestFile.getAbsolutePath()), mBpfMapReader, false);
             setCpuClusterFreqs(numClusters[i], numFreqs[i]);
-            writeToFile(freqsLine(freqs[i]));
+            setFreqs(freqs[i]);
             long[] actualFreqs = mReader.readFreqs(mPowerProfile);
             assertArrayEquals(freqs[i], actualFreqs);
             final String errMsg = String.format("Freqs=%s, nClusters=%d, nFreqs=%s",
                     Arrays.toString(freqs[i]), numClusters[i], Arrays.toString(numFreqs[i]));
             assertFalse(errMsg, mReader.perClusterTimesAvailable());
 
-            // Verify that a second call won't read the proc file again
-            assertTrue(mTestFile.delete());
+            // Verify that a second call won't re-read the freqs
+            clearFreqsAndData();
             actualFreqs = mReader.readFreqs(mPowerProfile);
             assertArrayEquals(freqs[i], actualFreqs);
             assertFalse(errMsg, mReader.perClusterTimesAvailable());
@@ -125,17 +139,17 @@
         final int[][] numFreqs = {{4}, {3, 5}, {3, 5, 4}};
         for (int i = 0; i < freqs.length; ++i) {
             mReader = new KernelCpuUidFreqTimeReader(mTestFile.getAbsolutePath(),
-                    new KernelCpuProcStringReader(mTestFile.getAbsolutePath()), false);
+                    new KernelCpuProcStringReader(mTestFile.getAbsolutePath()), mBpfMapReader, false);
             setCpuClusterFreqs(numClusters[i], numFreqs[i]);
-            writeToFile(freqsLine(freqs[i]));
+            setFreqs(freqs[i]);
             long[] actualFreqs = mReader.readFreqs(mPowerProfile);
             assertArrayEquals(freqs[i], actualFreqs);
             final String errMsg = String.format("Freqs=%s, nClusters=%d, nFreqs=%s",
                     Arrays.toString(freqs[i]), numClusters[i], Arrays.toString(numFreqs[i]));
             assertTrue(errMsg, mReader.perClusterTimesAvailable());
 
-            // Verify that a second call won't read the proc file again
-            assertTrue(mTestFile.delete());
+            // Verify that a second call won't re-read the freqs
+            clearFreqsAndData();
             actualFreqs = mReader.readFreqs(mPowerProfile);
             assertArrayEquals(freqs[i], actualFreqs);
             assertTrue(errMsg, mReader.perClusterTimesAvailable());
@@ -147,7 +161,7 @@
         final long[] freqs = {110, 123, 145, 167, 289, 997};
         final long[][] times = increaseTime(new long[mUids.length][freqs.length]);
 
-        writeToFile(freqsLine(freqs) + uidLines(mUids, times));
+        setFreqsAndData(freqs, times);
         mReader.readDelta(mCallback);
         for (int i = 0; i < mUids.length; ++i) {
             mCallback.verify(mUids[i], times[i]);
@@ -155,14 +169,14 @@
         mCallback.verifyNoMoreInteractions();
 
         // Verify that readDelta also reads the frequencies if not already available.
-        assertTrue(mTestFile.delete());
+        clearFreqsAndData();
         long[] actualFreqs = mReader.readFreqs(mPowerProfile);
         assertArrayEquals(freqs, actualFreqs);
 
         // Verify that a second call will only return deltas.
         mCallback.clear();
         final long[][] newTimes1 = increaseTime(times);
-        writeToFile(freqsLine(freqs) + uidLines(mUids, newTimes1));
+        setFreqsAndData(freqs, newTimes1);
         mReader.readDelta(mCallback);
         for (int i = 0; i < mUids.length; ++i) {
             mCallback.verify(mUids[i], subtract(newTimes1[i], times[i]));
@@ -177,7 +191,7 @@
         // Verify that calling with a null callback doesn't result in any crashes
         mCallback.clear();
         final long[][] newTimes2 = increaseTime(newTimes1);
-        writeToFile(freqsLine(freqs) + uidLines(mUids, newTimes2));
+        setFreqsAndData(freqs, newTimes2);
         mReader.readDelta(null);
         mCallback.verifyNoMoreInteractions();
 
@@ -185,13 +199,13 @@
         // the previous call had null callback.
         mCallback.clear();
         final long[][] newTimes3 = increaseTime(newTimes2);
-        writeToFile(freqsLine(freqs) + uidLines(mUids, newTimes3));
+        setFreqsAndData(freqs, newTimes3);
         mReader.readDelta(mCallback);
         for (int i = 0; i < mUids.length; ++i) {
             mCallback.verify(mUids[i], subtract(newTimes3[i], newTimes2[i]));
         }
         mCallback.verifyNoMoreInteractions();
-        assertTrue(mTestFile.delete());
+        clearFreqsAndData();
     }
 
     @Test
@@ -199,7 +213,7 @@
         final long[] freqs = {110, 123, 145, 167, 289, 997};
         final long[][] times1 = increaseTime(new long[mUids.length][freqs.length]);
 
-        writeToFile(freqsLine(freqs) + uidLines(mUids, times1));
+        setFreqsAndData(freqs, times1);
         mReader.readAbsolute(mCallback);
         for (int i = 0; i < mUids.length; i++) {
             mCallback.verify(mUids[i], times1[i]);
@@ -207,20 +221,20 @@
         mCallback.verifyNoMoreInteractions();
 
         // Verify that readDelta also reads the frequencies if not already available.
-        assertTrue(mTestFile.delete());
+        clearFreqsAndData();
         long[] actualFreqs = mReader.readFreqs(mPowerProfile);
         assertArrayEquals(freqs, actualFreqs);
 
         // Verify that a second call should still return absolute values
         mCallback.clear();
         final long[][] times2 = increaseTime(times1);
-        writeToFile(freqsLine(freqs) + uidLines(mUids, times2));
+        setFreqsAndData(freqs, times2);
         mReader.readAbsolute(mCallback);
         for (int i = 0; i < mUids.length; i++) {
             mCallback.verify(mUids[i], times2[i]);
         }
         mCallback.verifyNoMoreInteractions();
-        assertTrue(mTestFile.delete());
+        clearFreqsAndData();
     }
 
     @Test
@@ -228,14 +242,14 @@
         final long[] freqs = {110, 123, 145, 167, 289, 997};
         final long[][] times1 = increaseTime(new long[mUids.length][freqs.length]);
 
-        writeToFile(freqsLine(freqs) + uidLines(mUids, times1));
+        setFreqsAndData(freqs, times1);
         mReader.readDelta(mCallback);
 
         // Verify that there should not be a callback for a particular UID if its time decreases.
         mCallback.clear();
         final long[][] times2 = increaseTime(times1);
         times2[0][0] = 1000;
-        writeToFile(freqsLine(freqs) + uidLines(mUids, times2));
+        setFreqsAndData(freqs, times2);
         mReader.readDelta(mCallback);
         for (int i = 1; i < mUids.length; i++) {
             mCallback.verify(mUids[i], subtract(times2[i], times1[i]));
@@ -246,7 +260,7 @@
         mCallback.clear();
         final long[][] times3 = increaseTime(times2);
         times3[0] = increaseTime(times1)[0];
-        writeToFile(freqsLine(freqs) + uidLines(mUids, times3));
+        setFreqsAndData(freqs, times3);
         mReader.readDelta(mCallback);
         mCallback.verify(mUids[0], subtract(times3[0], times1[0]));
         for (int i = 1; i < mUids.length; i++) {
@@ -258,7 +272,7 @@
         mCallback.clear();
         final long[][] times4 = increaseTime(times3);
         times4[0][0] *= -1;
-        writeToFile(freqsLine(freqs) + uidLines(mUids, times4));
+        setFreqsAndData(freqs, times4);
         mReader.readDelta(mCallback);
         for (int i = 1; i < mUids.length; ++i) {
             mCallback.verify(mUids[i], subtract(times4[i], times3[i]));
@@ -269,14 +283,44 @@
         mCallback.clear();
         final long[][] times5 = increaseTime(times4);
         times5[0] = increaseTime(times3)[0];
-        writeToFile(freqsLine(freqs) + uidLines(mUids, times5));
+        setFreqsAndData(freqs, times5);
         mReader.readDelta(mCallback);
         mCallback.verify(mUids[0], subtract(times5[0], times3[0]));
         for (int i = 1; i < mUids.length; i++) {
             mCallback.verify(mUids[i], subtract(times5[i], times4[i]));
         }
 
-        assertTrue(mTestFile.delete());
+        clearFreqsAndData();
+    }
+
+    private void setFreqs(long[] freqs) throws IOException {
+        if (mUseBpf) {
+            mBpfMapReader.setFreqs(freqs);
+        } else {
+            writeToFile(freqsLine(freqs));
+        }
+    }
+
+    private void setFreqsAndData(long[] freqs, long[][] times) throws IOException {
+        if (mUseBpf) {
+            mBpfMapReader.setFreqs(freqs);
+            SparseArray<long[]> data = new SparseArray<>();
+            for (int i = 0; i < mUids.length; i++) {
+                data.put(mUids[i], times[i]);
+            }
+            mBpfMapReader.setData(data);
+        } else {
+            writeToFile(freqsLine(freqs) + uidLines(mUids, times));
+        }
+    }
+
+    private void clearFreqsAndData() {
+        if (mUseBpf) {
+            mBpfMapReader.setFreqs(null);
+            mBpfMapReader.setData(new SparseArray<>());
+        } else {
+            assertTrue(mTestFile.delete());
+        }
     }
 
     private String freqsLine(long[] freqs) {
@@ -358,4 +402,36 @@
             assertEquals(0, mData.size());
         }
     }
+
+    private class KernelCpuUidTestBpfMapReader extends KernelCpuUidBpfMapReader {
+        private long[] mCpuFreqs;
+        private SparseArray<long[]> mNewData = new SparseArray<>();
+
+        public void setData(SparseArray<long[]> data) {
+            mNewData = data;
+        }
+
+        public void setFreqs(long[] freqs) {
+            mCpuFreqs = freqs;
+        }
+
+        @Override
+        public final boolean startTrackingBpfTimes() {
+            return true;
+        }
+
+        @Override
+        protected final boolean readBpfData() {
+            if (!mUseBpf) {
+                return false;
+            }
+            mData = mNewData;
+            return true;
+        }
+
+        @Override
+        public final long[] getDataDimensions() {
+            return mCpuFreqs;
+        }
+    }
 }
diff --git a/core/tests/coretests/src/com/android/internal/os/KernelSingleUidTimeReaderTest.java b/core/tests/coretests/src/com/android/internal/os/KernelSingleUidTimeReaderTest.java
index 479e19e..dac35e5 100644
--- a/core/tests/coretests/src/com/android/internal/os/KernelSingleUidTimeReaderTest.java
+++ b/core/tests/coretests/src/com/android/internal/os/KernelSingleUidTimeReaderTest.java
@@ -31,20 +31,33 @@
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameters;
 
 import java.io.IOException;
 import java.nio.ByteBuffer;
 import java.nio.ByteOrder;
 import java.util.Arrays;
+import java.util.Collection;
 
 @SmallTest
-@RunWith(AndroidJUnit4.class)
+@RunWith(Parameterized.class)
 public class KernelSingleUidTimeReaderTest {
     private final static int TEST_UID = 2222;
     private final static int TEST_FREQ_COUNT = 5;
 
     private KernelSingleUidTimeReader mReader;
     private TestInjector mInjector;
+    protected boolean mUseBpf;
+
+    @Parameters(name="useBpf={0}")
+    public static Collection<Object[]> data() {
+        return Arrays.asList(new Object[][] { {true}, {false} });
+    }
+
+    public KernelSingleUidTimeReaderTest(boolean useBpf) {
+        mUseBpf = useBpf;
+    }
 
     @Before
     public void setUp() {
@@ -273,6 +286,7 @@
 
     class TestInjector extends Injector {
         private byte[] mData;
+        private long[] mBpfData;
         private boolean mThrowExcpetion;
 
         @Override
@@ -284,6 +298,14 @@
             }
         }
 
+        @Override
+        public long[] readBpfData(int uid) {
+            if (!mUseBpf || mBpfData == null) {
+                return new long[0];
+            }
+            return mBpfData;
+        }
+
         public void setData(long[] cpuTimes) {
             final ByteBuffer buffer = ByteBuffer.allocate(cpuTimes.length * Long.BYTES);
             buffer.order(ByteOrder.nativeOrder());
@@ -291,6 +313,7 @@
                 buffer.putLong(time / 10);
             }
             mData = buffer.array();
+            mBpfData = cpuTimes.clone();
         }
 
         public void letReadDataThrowException(boolean throwException) {
diff --git a/graphics/java/android/graphics/Bitmap.java b/graphics/java/android/graphics/Bitmap.java
index 9c2e95f..c1e7a36 100644
--- a/graphics/java/android/graphics/Bitmap.java
+++ b/graphics/java/android/graphics/Bitmap.java
@@ -2243,6 +2243,19 @@
         return nativeCreateGraphicBufferHandle(mNativePtr);
     }
 
+    /**
+     * @return {@link HardwareBuffer} which is internally used by hardware bitmap
+     *
+     * Note: the HardwareBuffer does *not* have an associated {@link ColorSpace}.
+     * To render this object the same as its rendered with this Bitmap, you
+     * should also call {@link getColorSpace}.
+     *
+     * @hide
+     */
+    public HardwareBuffer getHardwareBuffer() {
+        return nativeGetHardwareBuffer(mNativePtr);
+    }
+
     //////////// native methods
 
     private static native Bitmap nativeCreate(int[] colors, int offset,
@@ -2308,6 +2321,7 @@
     private static native Bitmap nativeWrapHardwareBufferBitmap(HardwareBuffer buffer,
                                                                 long nativeColorSpace);
     private static native GraphicBuffer nativeCreateGraphicBufferHandle(long nativeBitmap);
+    private static native HardwareBuffer nativeGetHardwareBuffer(long nativeBitmap);
     private static native ColorSpace nativeComputeColorSpace(long nativePtr);
     private static native void nativeSetColorSpace(long nativePtr, long nativeColorSpace);
     private static native boolean nativeIsSRGB(long nativePtr);
diff --git a/libs/hwui/protos/graphicsstats.proto b/libs/hwui/protos/graphicsstats.proto
index dd5676c..745393c 100644
--- a/libs/hwui/protos/graphicsstats.proto
+++ b/libs/hwui/protos/graphicsstats.proto
@@ -30,8 +30,9 @@
 
 message GraphicsStatsProto {
     enum PipelineType {
-        GL = 0;
-        VULKAN = 1;
+        UNKNOWN = 0;
+        GL = 1;
+        VULKAN = 2;
     }
 
     // The package name of the app
diff --git a/location/java/android/location/GnssAntennaInfo.java b/location/java/android/location/GnssAntennaInfo.java
index dfcaf81..b2f9a0f 100644
--- a/location/java/android/location/GnssAntennaInfo.java
+++ b/location/java/android/location/GnssAntennaInfo.java
@@ -16,72 +16,37 @@
 
 package android.location;
 
-import android.annotation.IntDef;
+import android.annotation.FloatRange;
 import android.annotation.NonNull;
 import android.annotation.Nullable;
 import android.os.Parcel;
 import android.os.Parcelable;
 
-import com.android.internal.annotations.VisibleForTesting;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
+import java.util.Arrays;
 import java.util.List;
+import java.util.Objects;
 
 /**
  * A class that contains information about a GNSS antenna. GNSS antenna characteristics can change
  * with device configuration, such as when a device is folded open or closed. Antenna information is
- * delivered to registered instances of {@link Callback}.
+ * delivered to registered instances of {@link Listener}.
  */
 public final class GnssAntennaInfo implements Parcelable {
     private final double mCarrierFrequencyMHz;
-    private final PhaseCenterOffsetCoordinates mPhaseCenterOffsetCoordinates;
-    private final PhaseCenterVariationCorrections mPhaseCenterVariationCorrections;
-    private final SignalGainCorrections mSignalGainCorrections;
+    private final PhaseCenterOffset mPhaseCenterOffset;
+    private final SphericalCorrections mPhaseCenterVariationCorrections;
+    private final SphericalCorrections mSignalGainCorrections;
 
     /**
      * Used for receiving GNSS antenna info from the GNSS engine. You can implement this interface
-     * and call {@link LocationManager#registerAntennaInfoCallback};
+     * and call {@link LocationManager#registerAntennaInfoListener};
      */
-    public abstract static class Callback {
+    public interface Listener {
         /**
-         * The status of GNSS antenna info.
-         *
-         * @hide
-         */
-        @Retention(RetentionPolicy.SOURCE)
-        @IntDef({STATUS_NOT_SUPPORTED, STATUS_READY, STATUS_LOCATION_DISABLED})
-        public @interface GnssAntennaInfoStatus {
-        }
-
-        /**
-         * The system does not support GNSS antenna info.
-         *
-         * This status will not change in the future.
-         */
-        public static final int STATUS_NOT_SUPPORTED = 0;
-
-        /**
-         * GNSS antenna info updates are being successfully tracked.
-         */
-        public static final int STATUS_READY = 1;
-
-        /**
-         * GNSS provider or Location is disabled, updated will not be received until they are
-         * enabled.
-         */
-        public static final int STATUS_LOCATION_DISABLED = 2;
-
-        /**
-         * Returns the latest GNSS antenna info. This event is triggered when a callback is
+         * Returns the latest GNSS antenna info. This event is triggered when a listener is
          * registered, and whenever the antenna info changes (due to a device configuration change).
          */
-        public void onGnssAntennaInfoReceived(@NonNull List<GnssAntennaInfo> gnssAntennaInfos) {}
-
-        /**
-         * Returns the latest status of the GNSS antenna info sub-system.
-         */
-        public void onStatusChanged(@GnssAntennaInfoStatus int status) {}
+        void onGnssAntennaInfoReceived(@NonNull List<GnssAntennaInfo> gnssAntennaInfos);
     }
 
     /**
@@ -90,37 +55,31 @@
      * for mobiles - see sensor or form factor documents for details. Uncertainties are reported
      *  to 1-sigma.
      */
-    public static final class PhaseCenterOffsetCoordinates implements Parcelable {
-        private final double mPhaseCenterOffsetCoordinateXMillimeters;
-        private final double mPhaseCenterOffsetCoordinateXUncertaintyMillimeters;
-        private final double mPhaseCenterOffsetCoordinateYMillimeters;
-        private final double mPhaseCenterOffsetCoordinateYUncertaintyMillimeters;
-        private final double mPhaseCenterOffsetCoordinateZMillimeters;
-        private final double mPhaseCenterOffsetCoordinateZUncertaintyMillimeters;
+    public static final class PhaseCenterOffset implements Parcelable {
+        private final double mOffsetXMm;
+        private final double mOffsetXUncertaintyMm;
+        private final double mOffsetYMm;
+        private final double mOffsetYUncertaintyMm;
+        private final double mOffsetZMm;
+        private final double mOffsetZUncertaintyMm;
 
-        @VisibleForTesting
-        public PhaseCenterOffsetCoordinates(double phaseCenterOffsetCoordinateXMillimeters,
-                double phaseCenterOffsetCoordinateXUncertaintyMillimeters,
-                double phaseCenterOffsetCoordinateYMillimeters,
-                double phaseCenterOffsetCoordinateYUncertaintyMillimeters,
-                double phaseCenterOffsetCoordinateZMillimeters,
-                double phaseCenterOffsetCoordinateZUncertaintyMillimeters) {
-            mPhaseCenterOffsetCoordinateXMillimeters = phaseCenterOffsetCoordinateXMillimeters;
-            mPhaseCenterOffsetCoordinateYMillimeters = phaseCenterOffsetCoordinateYMillimeters;
-            mPhaseCenterOffsetCoordinateZMillimeters = phaseCenterOffsetCoordinateZMillimeters;
-            mPhaseCenterOffsetCoordinateXUncertaintyMillimeters =
-                    phaseCenterOffsetCoordinateXUncertaintyMillimeters;
-            mPhaseCenterOffsetCoordinateYUncertaintyMillimeters =
-                    phaseCenterOffsetCoordinateYUncertaintyMillimeters;
-            mPhaseCenterOffsetCoordinateZUncertaintyMillimeters =
-                    phaseCenterOffsetCoordinateZUncertaintyMillimeters;
+        public PhaseCenterOffset(
+                double offsetXMm, double offsetXUncertaintyMm,
+                double offsetYMm, double offsetYUncertaintyMm,
+                double offsetZMm, double offsetZUncertaintyMm) {
+            mOffsetXMm = offsetXMm;
+            mOffsetYMm = offsetYMm;
+            mOffsetZMm = offsetZMm;
+            mOffsetXUncertaintyMm = offsetXUncertaintyMm;
+            mOffsetYUncertaintyMm = offsetYUncertaintyMm;
+            mOffsetZUncertaintyMm = offsetZUncertaintyMm;
         }
 
-        public static final @NonNull Creator<PhaseCenterOffsetCoordinates> CREATOR =
-                new Creator<PhaseCenterOffsetCoordinates>() {
+        public static final @NonNull Creator<PhaseCenterOffset> CREATOR =
+                new Creator<PhaseCenterOffset>() {
                     @Override
-                    public PhaseCenterOffsetCoordinates createFromParcel(Parcel in) {
-                        return new PhaseCenterOffsetCoordinates(
+                    public PhaseCenterOffset createFromParcel(Parcel in) {
+                        return new PhaseCenterOffset(
                                 in.readDouble(),
                                 in.readDouble(),
                                 in.readDouble(),
@@ -131,33 +90,39 @@
                     }
 
                     @Override
-                    public PhaseCenterOffsetCoordinates[] newArray(int size) {
-                        return new PhaseCenterOffsetCoordinates[size];
+                    public PhaseCenterOffset[] newArray(int size) {
+                        return new PhaseCenterOffset[size];
                     }
                 };
 
-        public double getXCoordMillimeters() {
-            return mPhaseCenterOffsetCoordinateXMillimeters;
+        @FloatRange()
+        public double getXOffsetMm() {
+            return mOffsetXMm;
         }
 
-        public double getXCoordUncertaintyMillimeters() {
-            return mPhaseCenterOffsetCoordinateXUncertaintyMillimeters;
+        @FloatRange()
+        public double getXOffsetUncertaintyMm() {
+            return mOffsetXUncertaintyMm;
         }
 
-        public double getYCoordMillimeters() {
-            return mPhaseCenterOffsetCoordinateYMillimeters;
+        @FloatRange()
+        public double getYOffsetMm() {
+            return mOffsetYMm;
         }
 
-        public double getYCoordUncertaintyMillimeters() {
-            return mPhaseCenterOffsetCoordinateYUncertaintyMillimeters;
+        @FloatRange()
+        public double getYOffsetUncertaintyMm() {
+            return mOffsetYUncertaintyMm;
         }
 
-        public double getZCoordMillimeters() {
-            return mPhaseCenterOffsetCoordinateZMillimeters;
+        @FloatRange()
+        public double getZOffsetMm() {
+            return mOffsetZMm;
         }
 
-        public double getZCoordUncertaintyMillimeters() {
-            return mPhaseCenterOffsetCoordinateZUncertaintyMillimeters;
+        @FloatRange()
+        public double getZOffsetUncertaintyMm() {
+            return mOffsetZUncertaintyMm;
         }
 
         @Override
@@ -167,30 +132,27 @@
 
         @Override
         public void writeToParcel(@NonNull Parcel dest, int flags) {
-            dest.writeDouble(mPhaseCenterOffsetCoordinateXMillimeters);
-            dest.writeDouble(mPhaseCenterOffsetCoordinateXUncertaintyMillimeters);
-            dest.writeDouble(mPhaseCenterOffsetCoordinateYMillimeters);
-            dest.writeDouble(mPhaseCenterOffsetCoordinateYUncertaintyMillimeters);
-            dest.writeDouble(mPhaseCenterOffsetCoordinateZMillimeters);
-            dest.writeDouble(mPhaseCenterOffsetCoordinateZUncertaintyMillimeters);
+            dest.writeDouble(mOffsetXMm);
+            dest.writeDouble(mOffsetXUncertaintyMm);
+            dest.writeDouble(mOffsetYMm);
+            dest.writeDouble(mOffsetYUncertaintyMm);
+            dest.writeDouble(mOffsetZMm);
+            dest.writeDouble(mOffsetZUncertaintyMm);
         }
 
         @Override
         public String toString() {
-            StringBuilder builder = new StringBuilder("PhaseCenteroffset:\n");
-            builder.append("X: " + mPhaseCenterOffsetCoordinateXMillimeters + " +/- "
-                    + mPhaseCenterOffsetCoordinateXUncertaintyMillimeters + "\n");
-            builder.append("Y: " + mPhaseCenterOffsetCoordinateYMillimeters + " +/- "
-                    + mPhaseCenterOffsetCoordinateYUncertaintyMillimeters + "\n");
-            builder.append("Z: " + mPhaseCenterOffsetCoordinateZMillimeters + " +/- "
-                    + mPhaseCenterOffsetCoordinateZUncertaintyMillimeters + "\n");
-            return builder.toString();
+            return "PhaseCenterOffset{"
+                    + "OffsetXMm=" + mOffsetXMm + " +/-" + mOffsetXUncertaintyMm
+                    + ", OffsetYMm=" + mOffsetYMm + " +/-" + mOffsetYUncertaintyMm
+                    + ", OffsetZMm=" + mOffsetZMm + " +/-" + mOffsetZUncertaintyMm
+                    + '}';
         }
     }
 
     /**
-     * Class containing information about the phase center variation (PCV) corrections. The PCV
-     * correction is added to the phase measurement to obtain the corrected value.
+     * Represents corrections on a spherical mapping. Corrections are added to measurements to
+     * obtain the corrected values.
      *
      * The corrections and associated (1-sigma) uncertainties are represented by respect 2D arrays.
      *
@@ -203,229 +165,7 @@
      * at 180 degrees. They are separated by deltaPhi, the regular spacing between zenith angles,
      * i.e., deltaPhi = 180 / (number of columns - 1).
      */
-    public static final class PhaseCenterVariationCorrections extends SphericalCorrections {
-
-        @VisibleForTesting
-        public PhaseCenterVariationCorrections(
-                @NonNull double[][] phaseCenterVariationCorrectionsMillimeters,
-                @NonNull double[][] phaseCenterVariationCorrectionUncertaintiesMillimeters) {
-            super(phaseCenterVariationCorrectionsMillimeters,
-                    phaseCenterVariationCorrectionUncertaintiesMillimeters);
-        }
-
-        private PhaseCenterVariationCorrections(@NonNull Parcel in) {
-            super(in);
-        }
-
-        /**
-         * Get the phase center variation correction in millimeters at the specified row and column
-         * in the underlying 2D array.
-         * @param row zero-based major index in the array
-         * @param column zero-based minor index in the array
-         * @return phase center correction in millimeters
-         */
-        public double getPhaseCenterVariationCorrectionMillimetersAt(int row, int column) {
-            return super.getCorrectionAt(row, column);
-        }
-
-        /**
-         * Get the phase center variation correction uncertainty in millimeters at the specified row
-         * and column in the underlying 2D array.
-         * @param row zero-based major index in the array
-         * @param column zero-based minor index in the array
-         * @return 1-sigma phase center correction uncertainty in millimeters
-         */
-        public double getPhaseCenterVariationCorrectionUncertaintyMillimetersAt(
-                int row, int column) {
-            return super.getCorrectionUncertaintyAt(row, column);
-        }
-
-        public @NonNull double[][] getRawCorrectionsArray() {
-            return super.getRawCorrectionsArray().clone();
-        }
-
-        public @NonNull double[][] getRawCorrectionUncertaintiesArray() {
-            return super.getRawCorrectionUncertaintiesArray().clone();
-        }
-
-        public int getNumRows() {
-            return super.getNumRows();
-        }
-
-        public int getNumColumns() {
-            return super.getNumColumns();
-        }
-
-        /**
-         * The fixed theta angle separation between successive rows.
-         */
-        public double getDeltaTheta() {
-            return super.getDeltaTheta();
-        }
-
-        /**
-         * The fixed phi angle separation between successive columns.
-         */
-        public double getDeltaPhi() {
-            return super.getDeltaPhi();
-        }
-
-        public static final @NonNull Creator<PhaseCenterVariationCorrections> CREATOR =
-                new Creator<PhaseCenterVariationCorrections>() {
-                    @Override
-                    public PhaseCenterVariationCorrections createFromParcel(Parcel in) {
-                        return new PhaseCenterVariationCorrections(in);
-                    }
-
-                    @Override
-                    public PhaseCenterVariationCorrections[] newArray(int size) {
-                        return new PhaseCenterVariationCorrections[size];
-                    }
-                };
-
-        @Override
-        public int describeContents() {
-            return 0;
-        }
-
-        @Override
-        public void writeToParcel(@NonNull Parcel dest, int flags) {
-            super.writeToParcel(dest, flags);
-        }
-
-        @Override
-        public String toString() {
-            StringBuilder builder = new StringBuilder("PhaseCenterVariationCorrections:\n");
-            builder.append(super.toString());
-            return builder.toString();
-        }
-    }
-
-    /**
-     * Class containing information about the signal gain (SG) corrections. The SG
-     * correction is added to the signal gain to obtain the corrected value.
-     *
-     * The corrections and associated (1-sigma) uncertainties are represented by respect 2D arrays.
-     *
-     * Each row (major indices) represents a fixed theta. The first row corresponds to a
-     * theta angle of 0 degrees. The last row corresponds to a theta angle of (360 - deltaTheta)
-     * degrees, where deltaTheta is the regular spacing between azimuthal angles, i.e., deltaTheta
-     * = 360 / (number of rows).
-     *
-     * The columns (minor indices) represent fixed zenith angles, beginning at 0 degrees and ending
-     * at 180 degrees. They are separated by deltaPhi, the regular spacing between zenith angles,
-     * i.e., deltaPhi = 180 / (number of columns - 1).
-     */
-    public static final class SignalGainCorrections extends SphericalCorrections {
-
-        @VisibleForTesting
-        public SignalGainCorrections(
-                @NonNull double[][] signalGainCorrectionsDbi,
-                @NonNull double[][] signalGainCorrectionUncertaintiesDbi) {
-            super(signalGainCorrectionsDbi,
-                    signalGainCorrectionUncertaintiesDbi);
-        }
-
-        private SignalGainCorrections(@NonNull Parcel in) {
-            super(in);
-        }
-
-        /**
-         * Get the signal gain correction in dbi at the specified row and column
-         * in the underlying 2D array.
-         * @param row zero-based major index in the array
-         * @param column zero-based minor index in the array
-         * @return signal gain correction in dbi
-         */
-        public double getSignalGainCorrectionDbiAt(int row, int column) {
-            return super.getCorrectionAt(row, column);
-        }
-
-        /**
-         * Get the signal gain correction correction uncertainty in dbi at the specified row
-         * and column in the underlying 2D array.
-         * @param row zero-based major index in the array
-         * @param column zero-based minor index in the array
-         * @return 1-sigma signal gain correction uncertainty in dbi
-         */
-        public double getSignalGainCorrectionUncertaintyDbiAt(int row, int column) {
-            return super.getCorrectionUncertaintyAt(row, column);
-        }
-
-        public @NonNull double[][] getRawCorrectionsArray() {
-            return super.getRawCorrectionsArray().clone();
-        }
-
-        public @NonNull double[][] getRawCorrectionUncertaintiesArray() {
-            return super.getRawCorrectionUncertaintiesArray().clone();
-        }
-
-        public int getNumRows() {
-            return super.getNumRows();
-        }
-
-        public int getNumColumns() {
-            return super.getNumColumns();
-        }
-
-        /**
-         * The fixed theta angle separation between successive rows.
-         */
-        public double getDeltaTheta() {
-            return super.getDeltaTheta();
-        }
-
-        /**
-         * The fixed phi angle separation between successive columns.
-         */
-        public double getDeltaPhi() {
-            return super.getDeltaPhi();
-        }
-
-        public static final @NonNull Creator<SignalGainCorrections> CREATOR =
-                new Creator<SignalGainCorrections>() {
-                    @Override
-                    public SignalGainCorrections createFromParcel(Parcel in) {
-                        return new SignalGainCorrections(in);
-                    }
-
-                    @Override
-                    public SignalGainCorrections[] newArray(int size) {
-                        return new SignalGainCorrections[size];
-                    }
-                };
-
-        @Override
-        public int describeContents() {
-            return 0;
-        }
-
-        @Override
-        public void writeToParcel(@NonNull Parcel dest, int flags) {
-            super.writeToParcel(dest, flags);
-        }
-
-        @Override
-        public String toString() {
-            StringBuilder builder = new StringBuilder("SignalGainCorrections:\n");
-            builder.append(super.toString());
-            return builder.toString();
-        }
-    }
-
-    /**
-     * Represents corrections on a spherical mapping.
-     *
-     * Each row (major indices) represents a fixed theta. The first row corresponds to a
-     * theta angle of 0 degrees. The last row corresponds to a theta angle of (360 - deltaTheta)
-     * degrees, where deltaTheta is the regular spacing between azimuthal angles, i.e., deltaTheta
-     * = 360 / (number of rows).
-     *
-     * The columns (minor indices) represent fixed zenith angles, beginning at 0 degrees and ending
-     * at 180 degrees. They are separated by deltaPhi, the regular spacing between zenith angles,
-     * i.e., deltaPhi = 180 / (number of columns - 1).
-     */
-    private abstract static class SphericalCorrections implements Parcelable {
+    public static final class SphericalCorrections implements Parcelable{
         private final double[][] mCorrections;
         private final double[][] mCorrectionUncertainties;
         private final double mDeltaTheta;
@@ -433,7 +173,7 @@
         private final int mNumRows;
         private final int mNumColumns;
 
-        SphericalCorrections(@NonNull double[][] corrections,
+        public SphericalCorrections(@NonNull double[][] corrections,
                 @NonNull double[][] correctionUncertainties) {
             if (corrections.length != correctionUncertainties.length
                     || corrections[0].length != correctionUncertainties[0].length) {
@@ -474,54 +214,84 @@
                 in.readDoubleArray(correctionUncertainties[row]);
             }
 
-            mNumRows = corrections.length;
-            mNumColumns = corrections[0].length;
+            mNumRows = numRows;
+            mNumColumns = numColumns;
             mCorrections = corrections;
             mCorrectionUncertainties = correctionUncertainties;
             mDeltaTheta = 360.0d / mNumRows;
             mDeltaPhi = 180.0d / (mNumColumns - 1);
         }
 
-        private double getCorrectionAt(int row, int column) {
-            return mCorrections[row][column];
-        }
-
-        private double getCorrectionUncertaintyAt(int row, int column) {
-            return mCorrectionUncertainties[row][column];
-        }
-
+        /**
+         * Array representing corrections on a spherical mapping. Corrections are added to
+         * measurements to obtain the corrected values.
+         *
+         * Each row (major indices) represents a fixed theta. The first row corresponds to a
+         * theta angle of 0 degrees. The last row corresponds to a theta angle of (360 - deltaTheta)
+         * degrees, where deltaTheta is the regular spacing between azimuthal angles, i.e.,
+         * deltaTheta = 360 / (number of rows).
+         *
+         * The columns (minor indices) represent fixed zenith angles, beginning at 0 degrees and
+         * ending at 180 degrees. They are separated by deltaPhi, the regular spacing between zenith
+         * angles, i.e., deltaPhi = 180 / (number of columns - 1).
+         */
         @NonNull
-        private double[][] getRawCorrectionsArray() {
+        public double[][] getCorrectionsArray() {
             return mCorrections;
         }
 
+        /**
+         * Array representing uncertainty on corrections on a spherical mapping.
+         *
+         * Each row (major indices) represents a fixed theta. The first row corresponds to a
+         * theta angle of 0 degrees. The last row corresponds to a theta angle of (360 - deltaTheta)
+         * degrees, where deltaTheta is the regular spacing between azimuthal angles, i.e.,
+         * deltaTheta = 360 / (number of rows).
+         *
+         * The columns (minor indices) represent fixed zenith angles, beginning at 0 degrees and
+         * ending at 180 degrees. They are separated by deltaPhi, the regular spacing between zenith
+         * angles, i.e., deltaPhi = 180 / (number of columns - 1).
+         */
         @NonNull
-        private double[][] getRawCorrectionUncertaintiesArray() {
+        public double[][] getCorrectionUncertaintiesArray() {
             return mCorrectionUncertainties;
         }
 
-        private int getNumRows() {
-            return mNumRows;
-        }
-
-        private int getNumColumns() {
-            return mNumColumns;
-        }
-
         /**
          * The fixed theta angle separation between successive rows.
          */
-        private double getDeltaTheta() {
+        @FloatRange(from = 0.0f, to = 360.0f)
+        public double getDeltaTheta() {
             return mDeltaTheta;
         }
 
         /**
          * The fixed phi angle separation between successive columns.
          */
-        private double getDeltaPhi() {
+        @FloatRange(from = 0.0f, to = 180.0f)
+        public double getDeltaPhi() {
             return mDeltaPhi;
         }
 
+
+        public static final @NonNull Creator<SphericalCorrections> CREATOR =
+                new Creator<SphericalCorrections>() {
+                    @Override
+                    public SphericalCorrections createFromParcel(Parcel in) {
+                        return new SphericalCorrections(in);
+                    }
+
+                    @Override
+                    public SphericalCorrections[] newArray(int size) {
+                        return new SphericalCorrections[size];
+                    }
+                };
+
+        @Override
+        public int describeContents() {
+            return 0;
+        }
+
         @Override
         public void writeToParcel(@NonNull Parcel dest, int flags) {
             dest.writeInt(mNumRows);
@@ -534,62 +304,114 @@
             }
         }
 
-        private String arrayToString(double[][] array) {
-            StringBuilder builder = new StringBuilder();
-            for (int row = 0; row < mNumRows; row++) {
-                builder.append("[ ");
-                for (int column = 0; column < mNumColumns - 1; column++) {
-                    builder.append(array[row][column] + ", ");
-                }
-                builder.append(array[row][mNumColumns - 1] + " ]\n");
-            }
-            return builder.toString();
-        }
-
         @Override
         public String toString() {
-            StringBuilder builder = new StringBuilder();
-            builder.append("DeltaTheta: " + mDeltaTheta + "\n");
-            builder.append("DeltaPhi: " + mDeltaPhi + "\n");
-            builder.append("CorrectionsArray:\n");
-            builder.append(arrayToString(mCorrections));
-            builder.append("CorrectionUncertaintiesArray:\n");
-            builder.append(arrayToString(mCorrectionUncertainties));
-            return builder.toString();
+            return "SphericalCorrections{"
+                    + "Corrections=" + Arrays.toString(mCorrections)
+                    + ", CorrectionUncertainties=" + Arrays.toString(mCorrectionUncertainties)
+                    + ", DeltaTheta=" + mDeltaTheta
+                    + ", DeltaPhi=" + mDeltaPhi
+                    + '}';
         }
     }
 
-    @VisibleForTesting
-    public GnssAntennaInfo(
+    private GnssAntennaInfo(
             double carrierFrequencyMHz,
-            @NonNull PhaseCenterOffsetCoordinates phaseCenterOffsetCoordinates,
-            @Nullable PhaseCenterVariationCorrections phaseCenterVariationCorrections,
-            @Nullable SignalGainCorrections signalGainCorrectionDbi) {
-        if (phaseCenterOffsetCoordinates == null) {
+            @NonNull PhaseCenterOffset phaseCenterOffset,
+            @Nullable SphericalCorrections phaseCenterVariationCorrections,
+            @Nullable SphericalCorrections signalGainCorrectionDbi) {
+        if (phaseCenterOffset == null) {
             throw new IllegalArgumentException("Phase Center Offset Coordinates cannot be null.");
         }
         mCarrierFrequencyMHz = carrierFrequencyMHz;
-        mPhaseCenterOffsetCoordinates = phaseCenterOffsetCoordinates;
+        mPhaseCenterOffset = phaseCenterOffset;
         mPhaseCenterVariationCorrections = phaseCenterVariationCorrections;
         mSignalGainCorrections = signalGainCorrectionDbi;
     }
 
+    /**
+     * Builder class for GnssAntennaInfo.
+     */
+    public static class Builder {
+        private double mCarrierFrequencyMHz;
+        private PhaseCenterOffset mPhaseCenterOffset;
+        private SphericalCorrections mPhaseCenterVariationCorrections;
+        private SphericalCorrections mSignalGainCorrections;
+
+        /**
+         * Set antenna carrier frequency (MHz).
+         * @param carrierFrequencyMHz antenna carrier frequency (MHz)
+         * @return Builder builder object
+         */
+        @NonNull
+        public Builder setCarrierFrequencyMHz(@FloatRange(from = 0.0f) double carrierFrequencyMHz) {
+            mCarrierFrequencyMHz = carrierFrequencyMHz;
+            return this;
+        }
+
+        /**
+         * Set antenna phase center offset.
+         * @param phaseCenterOffset phase center offset object
+         * @return Builder builder object
+         */
+        @NonNull
+        public Builder setPhaseCenterOffset(@NonNull PhaseCenterOffset phaseCenterOffset) {
+            mPhaseCenterOffset = Objects.requireNonNull(phaseCenterOffset);
+            return this;
+        }
+
+        /**
+         * Set phase center variation corrections.
+         * @param phaseCenterVariationCorrections phase center variation corrections object
+         * @return Builder builder object
+         */
+        @NonNull
+        public Builder setPhaseCenterVariationCorrections(
+                @Nullable SphericalCorrections phaseCenterVariationCorrections) {
+            mPhaseCenterVariationCorrections = phaseCenterVariationCorrections;
+            return this;
+        }
+
+        /**
+         * Set signal gain corrections.
+         * @param signalGainCorrections signal gain corrections object
+         * @return Builder builder object
+         */
+        @NonNull
+        public Builder setSignalGainCorrections(
+                @Nullable SphericalCorrections signalGainCorrections) {
+            mSignalGainCorrections = signalGainCorrections;
+            return this;
+        }
+
+        /**
+         * Build GnssAntennaInfo object.
+         * @return instance of GnssAntennaInfo
+         */
+        @NonNull
+        public GnssAntennaInfo build() {
+            return new GnssAntennaInfo(mCarrierFrequencyMHz, mPhaseCenterOffset,
+                    mPhaseCenterVariationCorrections, mSignalGainCorrections);
+        }
+    }
+
+    @FloatRange(from = 0.0f)
     public double getCarrierFrequencyMHz() {
         return mCarrierFrequencyMHz;
     }
 
     @NonNull
-    public PhaseCenterOffsetCoordinates getPhaseCenterOffsetCoordinates() {
-        return mPhaseCenterOffsetCoordinates;
+    public PhaseCenterOffset getPhaseCenterOffset() {
+        return mPhaseCenterOffset;
     }
 
     @Nullable
-    public PhaseCenterVariationCorrections getPhaseCenterVariationCorrections() {
+    public SphericalCorrections getPhaseCenterVariationCorrections() {
         return mPhaseCenterVariationCorrections;
     }
 
     @Nullable
-    public SignalGainCorrections getSignalGainCorrections() {
+    public SphericalCorrections getSignalGainCorrections() {
         return mSignalGainCorrections;
     }
 
@@ -600,16 +422,18 @@
                                 double carrierFrequencyMHz = in.readDouble();
 
                                 ClassLoader classLoader = getClass().getClassLoader();
-                                PhaseCenterOffsetCoordinates phaseCenterOffsetCoordinates =
+                                PhaseCenterOffset phaseCenterOffset =
                                         in.readParcelable(classLoader);
-                                PhaseCenterVariationCorrections phaseCenterVariationCorrections =
+                                SphericalCorrections phaseCenterVariationCorrections =
                                         in.readParcelable(classLoader);
-                                SignalGainCorrections signalGainCorrections =
+                                SphericalCorrections signalGainCorrections =
                                         in.readParcelable(classLoader);
 
-                                return new GnssAntennaInfo(carrierFrequencyMHz,
-                                        phaseCenterOffsetCoordinates,
-                                        phaseCenterVariationCorrections, signalGainCorrections);
+                                return new GnssAntennaInfo(
+                                            carrierFrequencyMHz,
+                                            phaseCenterOffset,
+                                            phaseCenterVariationCorrections,
+                                            signalGainCorrections);
                             }
 
                             @Override
@@ -626,29 +450,18 @@
     @Override
     public void writeToParcel(@NonNull Parcel parcel, int flags) {
         parcel.writeDouble(mCarrierFrequencyMHz);
-
-        // Write Phase Center Offset
-        parcel.writeParcelable(mPhaseCenterOffsetCoordinates, flags);
-
-        // Write Phase Center Variation Corrections
+        parcel.writeParcelable(mPhaseCenterOffset, flags);
         parcel.writeParcelable(mPhaseCenterVariationCorrections, flags);
-
-        // Write Signal Gain Corrections
         parcel.writeParcelable(mSignalGainCorrections, flags);
     }
 
     @Override
     public String toString() {
-        StringBuilder builder = new StringBuilder("[ GnssAntennaInfo:\n");
-        builder.append("CarrierFrequencyMHz: " + mCarrierFrequencyMHz + "\n");
-        builder.append(mPhaseCenterOffsetCoordinates.toString());
-        builder.append(mPhaseCenterVariationCorrections == null
-                ? "PhaseCenterVariationCorrections: null\n"
-                : mPhaseCenterVariationCorrections.toString());
-        builder.append(mSignalGainCorrections == null
-                ? "SignalGainCorrections: null\n"
-                : mSignalGainCorrections.toString());
-        builder.append("]");
-        return builder.toString();
+        return "GnssAntennaInfo{"
+                + "CarrierFrequencyMHz=" + mCarrierFrequencyMHz
+                + ", PhaseCenterOffset=" + mPhaseCenterOffset
+                + ", PhaseCenterVariationCorrections=" + mPhaseCenterVariationCorrections
+                + ", SignalGainCorrections=" + mSignalGainCorrections
+                + '}';
     }
 }
diff --git a/location/java/android/location/GnssCapabilities.java b/location/java/android/location/GnssCapabilities.java
index 930180c..5734bf2 100644
--- a/location/java/android/location/GnssCapabilities.java
+++ b/location/java/android/location/GnssCapabilities.java
@@ -16,15 +16,11 @@
 
 package android.location;
 
-import android.annotation.NonNull;
 import android.annotation.SystemApi;
 
 /**
  * A container of supported GNSS chipset capabilities.
- *
- * @hide
  */
-@SystemApi
 public final class GnssCapabilities {
     /**
      * Bit mask indicating GNSS chipset supports low power mode.
@@ -105,7 +101,10 @@
 
     /**
      * Returns {@code true} if GNSS chipset supports low power mode, {@code false} otherwise.
+     *
+     * @hide
      */
+    @SystemApi
     public boolean hasLowPowerMode() {
         return hasCapability(LOW_POWER_MODE);
     }
@@ -113,28 +112,40 @@
     /**
      * Returns {@code true} if GNSS chipset supports blacklisting satellites, {@code false}
      * otherwise.
+     *
+     * @hide
      */
+    @SystemApi
     public boolean hasSatelliteBlacklist() {
         return hasCapability(SATELLITE_BLACKLIST);
     }
 
     /**
      * Returns {@code true} if GNSS chipset supports geofencing, {@code false} otherwise.
+     *
+     * @hide
      */
+    @SystemApi
     public boolean hasGeofencing() {
         return hasCapability(GEOFENCING);
     }
 
     /**
      * Returns {@code true} if GNSS chipset supports measurements, {@code false} otherwise.
+     *
+     * @hide
      */
+    @SystemApi
     public boolean hasMeasurements() {
         return hasCapability(MEASUREMENTS);
     }
 
     /**
      * Returns {@code true} if GNSS chipset supports navigation messages, {@code false} otherwise.
+     *
+     * @hide
      */
+    @SystemApi
     public boolean hasNavMessages() {
         return hasCapability(NAV_MESSAGES);
     }
@@ -142,7 +153,10 @@
     /**
      * Returns {@code true} if GNSS chipset supports measurement corrections, {@code false}
      * otherwise.
+     *
+     * @hide
      */
+    @SystemApi
     public boolean hasMeasurementCorrections() {
         return hasCapability(MEASUREMENT_CORRECTIONS);
     }
@@ -150,7 +164,10 @@
     /**
      * Returns {@code true} if GNSS chipset supports line-of-sight satellite identification
      * measurement corrections, {@code false} otherwise.
+     *
+     * @hide
      */
+    @SystemApi
     public boolean hasMeasurementCorrectionsLosSats() {
         return hasCapability(MEASUREMENT_CORRECTIONS_LOS_SATS);
     }
@@ -158,7 +175,10 @@
     /**
      * Returns {@code true} if GNSS chipset supports per satellite excess-path-length measurement
      * corrections, {@code false} otherwise.
+     *
+     * @hide
      */
+    @SystemApi
     public boolean hasMeasurementCorrectionsExcessPathLength() {
         return hasCapability(MEASUREMENT_CORRECTIONS_EXCESS_PATH_LENGTH);
     }
@@ -166,7 +186,10 @@
     /**
      * Returns {@code true} if GNSS chipset supports reflecting planes measurement corrections,
      * {@code false} otherwise.
+     *
+     * @hide
      */
+    @SystemApi
     public boolean hasMeasurementCorrectionsReflectingPane() {
         return hasCapability(MEASUREMENT_CORRECTIONS_REFLECTING_PLANE);
     }
@@ -178,28 +201,6 @@
         return hasCapability(ANTENNA_INFO);
     }
 
-    @NonNull
-    @Override
-    public String toString() {
-        StringBuilder sb = new StringBuilder("GnssCapabilities: ( ");
-        if (hasLowPowerMode()) sb.append("LOW_POWER_MODE ");
-        if (hasSatelliteBlacklist()) sb.append("SATELLITE_BLACKLIST ");
-        if (hasGeofencing()) sb.append("GEOFENCING ");
-        if (hasGnssAntennaInfo()) sb.append("ANTENNA_INFO ");
-        if (hasMeasurements()) sb.append("MEASUREMENTS ");
-        if (hasNavMessages()) sb.append("NAV_MESSAGES ");
-        if (hasMeasurementCorrections()) sb.append("MEASUREMENT_CORRECTIONS ");
-        if (hasMeasurementCorrectionsLosSats()) sb.append("MEASUREMENT_CORRECTIONS_LOS_SATS ");
-        if (hasMeasurementCorrectionsExcessPathLength()) {
-            sb.append("MEASUREMENT_CORRECTIONS_EXCESS_PATH_LENGTH ");
-        }
-        if (hasMeasurementCorrectionsReflectingPane()) {
-            sb.append("MEASUREMENT_CORRECTIONS_REFLECTING_PLANE ");
-        }
-        sb.append(")");
-        return sb.toString();
-    }
-
     private boolean hasCapability(long capability) {
         return (mGnssCapabilities & capability) == capability;
     }
diff --git a/location/java/android/location/IGnssAntennaInfoListener.aidl b/location/java/android/location/IGnssAntennaInfoListener.aidl
index 30bf5467..603ed6a 100644
--- a/location/java/android/location/IGnssAntennaInfoListener.aidl
+++ b/location/java/android/location/IGnssAntennaInfoListener.aidl
@@ -23,5 +23,4 @@
  */
 oneway interface IGnssAntennaInfoListener {
     void onGnssAntennaInfoReceived(in List<GnssAntennaInfo> gnssAntennaInfo);
-    void onStatusChanged(in int status);
 }
\ No newline at end of file
diff --git a/location/java/android/location/LocationManager.java b/location/java/android/location/LocationManager.java
index 03e1c75..19085bf 100644
--- a/location/java/android/location/LocationManager.java
+++ b/location/java/android/location/LocationManager.java
@@ -1813,13 +1813,7 @@
 
     /**
      * Returns the supported capabilities of the GNSS chipset.
-     *
-     * @throws SecurityException if the ACCESS_FINE_LOCATION permission is not present.
-     *
-     * @hide
      */
-    @SystemApi
-    @RequiresPermission(ACCESS_FINE_LOCATION)
     public @NonNull GnssCapabilities getGnssCapabilities() {
         try {
             long gnssCapabilities = mService.getGnssCapabilities(mContext.getPackageName());
@@ -2264,35 +2258,36 @@
     }
 
     /**
-     * Registers a Gnss Antenna Info callback.
+     * Registers a Gnss Antenna Info listener. Only expect results if
+     * {@link GnssCapabilities#hasGnssAntennaInfo()} shows that antenna info is supported.
      *
-     * @param executor the executor that the callback runs on.
-     * @param callback a {@link GnssAntennaInfo.Callback} object to register.
-     * @return {@code true} if the callback was added successfully, {@code false} otherwise.
+     * @param executor the executor that the listener runs on.
+     * @param listener a {@link GnssAntennaInfo.Listener} object to register.
+     * @return {@code true} if the listener was added successfully, {@code false} otherwise.
      *
      * @throws IllegalArgumentException if executor is null
-     * @throws IllegalArgumentException if callback is null
+     * @throws IllegalArgumentException if listener is null
      * @throws SecurityException if the ACCESS_FINE_LOCATION permission is not present
      */
     @RequiresPermission(ACCESS_FINE_LOCATION)
-    public boolean registerAntennaInfoCallback(
+    public boolean registerAntennaInfoListener(
             @NonNull @CallbackExecutor Executor executor,
-            @NonNull GnssAntennaInfo.Callback callback) {
+            @NonNull GnssAntennaInfo.Listener listener) {
         try {
-            return mGnssAntennaInfoListenerManager.addListener(callback, executor);
+            return mGnssAntennaInfoListenerManager.addListener(listener, executor);
         } catch (RemoteException e) {
             throw e.rethrowFromSystemServer();
         }
     }
 
     /**
-     * Unregisters a GNSS Antenna Info callback.
+     * Unregisters a GNSS Antenna Info listener.
      *
-     * @param callback a {@link GnssAntennaInfo.Callback} object to remove.
+     * @param listener a {@link GnssAntennaInfo.Listener} object to remove.
      */
-    public void unregisterAntennaInfoCallback(@NonNull GnssAntennaInfo.Callback callback) {
+    public void unregisterAntennaInfoListener(@NonNull GnssAntennaInfo.Listener listener) {
         try {
-            mGnssAntennaInfoListenerManager.removeListener(callback);
+            mGnssAntennaInfoListenerManager.removeListener(listener);
         } catch (RemoteException e) {
             throw e.rethrowFromSystemServer();
         }
@@ -3043,7 +3038,7 @@
     }
 
     private class GnssAntennaInfoListenerManager extends
-            AbstractListenerManager<Void, GnssAntennaInfo.Callback> {
+            AbstractListenerManager<Void, GnssAntennaInfo.Listener> {
 
         @Nullable
         private IGnssAntennaInfoListener mListenerTransport;
@@ -3075,11 +3070,6 @@
             public void onGnssAntennaInfoReceived(final List<GnssAntennaInfo> gnssAntennaInfos) {
                 execute((callback) -> callback.onGnssAntennaInfoReceived(gnssAntennaInfos));
             }
-
-            @Override
-            public void onStatusChanged(int status) {
-                execute((listener) -> listener.onStatusChanged(status));
-            }
         }
 
     }
diff --git a/media/java/android/media/AudioDevice.aidl b/media/java/android/media/AudioDeviceAttributes.aidl
similarity index 94%
rename from media/java/android/media/AudioDevice.aidl
rename to media/java/android/media/AudioDeviceAttributes.aidl
index 02071e5..82d4226 100644
--- a/media/java/android/media/AudioDevice.aidl
+++ b/media/java/android/media/AudioDeviceAttributes.aidl
@@ -15,4 +15,4 @@
 
 package android.media;
 
-parcelable AudioDevice;
+parcelable AudioDeviceAttributes;
diff --git a/media/java/android/media/AudioDevice.java b/media/java/android/media/AudioDeviceAttributes.java
similarity index 82%
rename from media/java/android/media/AudioDevice.java
rename to media/java/android/media/AudioDeviceAttributes.java
index 31ecc7b..f5b0806 100644
--- a/media/java/android/media/AudioDevice.java
+++ b/media/java/android/media/AudioDeviceAttributes.java
@@ -28,8 +28,8 @@
 
 /**
  * @hide
- * Class to represent device type (speaker, headset...), address (if known) and role (input, output)
- * of an audio device.
+ * Class to represent the attributes of an audio device: its type (speaker, headset...), address
+ * (if known) and role (input, output).
  * <p>Unlike {@link AudioDeviceInfo}, the device
  * doesn't need to be connected to be uniquely identified, it can
  * for instance represent a specific A2DP headset even after a
@@ -39,7 +39,7 @@
  * permission, APIs using one rely on MODIFY_AUDIO_ROUTING.
  */
 @SystemApi
-public final class AudioDevice implements Parcelable {
+public final class AudioDeviceAttributes implements Parcelable {
 
     /**
      * A role identifying input devices, such as microphones.
@@ -78,7 +78,7 @@
      *                   type and address.
      */
     @SystemApi
-    public AudioDevice(@NonNull AudioDeviceInfo deviceInfo) {
+    public AudioDeviceAttributes(@NonNull AudioDeviceInfo deviceInfo) {
         Objects.requireNonNull(deviceInfo);
         mRole = deviceInfo.isSink() ? ROLE_OUTPUT : ROLE_INPUT;
         mType = deviceInfo.getType();
@@ -93,7 +93,7 @@
      * @param address the address of the device, or an empty string for devices without one
      */
     @SystemApi
-    public AudioDevice(@Role int role, @AudioDeviceInfo.AudioDeviceType int type,
+    public AudioDeviceAttributes(@Role int role, @AudioDeviceInfo.AudioDeviceType int type,
                               @NonNull String address) {
         Objects.requireNonNull(address);
         if (role != ROLE_OUTPUT && role != ROLE_INPUT) {
@@ -111,7 +111,7 @@
         mAddress = address;
     }
 
-    /*package*/ AudioDevice(int nativeType, @NonNull String address) {
+    /*package*/ AudioDeviceAttributes(int nativeType, @NonNull String address) {
         mRole = (nativeType & AudioSystem.DEVICE_BIT_IN) != 0 ? ROLE_INPUT : ROLE_OUTPUT;
         mType = AudioDeviceInfo.convertInternalDeviceToDeviceType(nativeType);
         mAddress = address;
@@ -157,7 +157,7 @@
         if (this == o) return true;
         if (o == null || getClass() != o.getClass()) return false;
 
-        AudioDevice that = (AudioDevice) o;
+        AudioDeviceAttributes that = (AudioDeviceAttributes) o;
         return ((mRole == that.mRole)
                 && (mType == that.mType)
                 && mAddress.equals(that.mAddress));
@@ -170,7 +170,7 @@
 
     @Override
     public String toString() {
-        return new String("AudioDevice:"
+        return new String("AudioDeviceAttributes:"
                 + " role:" + roleToString(mRole)
                 + " type:" + (mRole == ROLE_OUTPUT ? AudioSystem.getOutputDeviceName(
                         AudioDeviceInfo.convertDeviceTypeToInternalDevice(mType))
@@ -191,25 +191,25 @@
         dest.writeString(mAddress);
     }
 
-    private AudioDevice(@NonNull Parcel in) {
+    private AudioDeviceAttributes(@NonNull Parcel in) {
         mRole = in.readInt();
         mType = in.readInt();
         mAddress = in.readString();
     }
 
-    public static final @NonNull Parcelable.Creator<AudioDevice> CREATOR =
-            new Parcelable.Creator<AudioDevice>() {
+    public static final @NonNull Parcelable.Creator<AudioDeviceAttributes> CREATOR =
+            new Parcelable.Creator<AudioDeviceAttributes>() {
         /**
-         * Rebuilds an AudioDevice previously stored with writeToParcel().
-         * @param p Parcel object to read the AudioDevice from
-         * @return a new AudioDevice created from the data in the parcel
+         * Rebuilds an AudioDeviceAttributes previously stored with writeToParcel().
+         * @param p Parcel object to read the AudioDeviceAttributes from
+         * @return a new AudioDeviceAttributes created from the data in the parcel
          */
-        public AudioDevice createFromParcel(Parcel p) {
-            return new AudioDevice(p);
+        public AudioDeviceAttributes createFromParcel(Parcel p) {
+            return new AudioDeviceAttributes(p);
         }
 
-        public AudioDevice[] newArray(int size) {
-            return new AudioDevice[size];
+        public AudioDeviceAttributes[] newArray(int size) {
+            return new AudioDeviceAttributes[size];
         }
     };
 }
diff --git a/media/java/android/media/AudioManager.java b/media/java/android/media/AudioManager.java
index 112bb9c..0b825f6 100644
--- a/media/java/android/media/AudioManager.java
+++ b/media/java/android/media/AudioManager.java
@@ -1597,7 +1597,7 @@
     @SystemApi
     @RequiresPermission(android.Manifest.permission.MODIFY_AUDIO_ROUTING)
     public boolean setPreferredDeviceForStrategy(@NonNull AudioProductStrategy strategy,
-            @NonNull AudioDevice device) {
+            @NonNull AudioDeviceAttributes device) {
         Objects.requireNonNull(strategy);
         Objects.requireNonNull(device);
         try {
@@ -1612,7 +1612,7 @@
     /**
      * @hide
      * Removes the preferred audio device previously set with
-     * {@link #setPreferredDeviceForStrategy(AudioProductStrategy, AudioDevice)}.
+     * {@link #setPreferredDeviceForStrategy(AudioProductStrategy, AudioDeviceAttributes)}.
      * @param strategy the audio strategy whose routing will be affected
      * @return true if the operation was successful, false otherwise (invalid strategy, or no
      *     device set for example)
@@ -1633,14 +1633,14 @@
     /**
      * @hide
      * Return the preferred device for an audio strategy, previously set with
-     * {@link #setPreferredDeviceForStrategy(AudioProductStrategy, AudioDevice)}
+     * {@link #setPreferredDeviceForStrategy(AudioProductStrategy, AudioDeviceAttributes)}
      * @param strategy the strategy to query
      * @return the preferred device for that strategy, or null if none was ever set or if the
      *    strategy is invalid
      */
     @SystemApi
     @RequiresPermission(android.Manifest.permission.MODIFY_AUDIO_ROUTING)
-    public @Nullable AudioDevice getPreferredDeviceForStrategy(
+    public @Nullable AudioDeviceAttributes getPreferredDeviceForStrategy(
             @NonNull AudioProductStrategy strategy) {
         Objects.requireNonNull(strategy);
         try {
@@ -1654,7 +1654,7 @@
      * @hide
      * Interface to be notified of changes in the preferred audio device set for a given audio
      * strategy.
-     * @see #setPreferredDeviceForStrategy(AudioProductStrategy, AudioDevice)
+     * @see #setPreferredDeviceForStrategy(AudioProductStrategy, AudioDeviceAttributes)
      * @see #removePreferredDeviceForStrategy(AudioProductStrategy)
      * @see #getPreferredDeviceForStrategy(AudioProductStrategy)
      */
@@ -1668,7 +1668,7 @@
          *              preferred audio device
          */
         void onPreferredDeviceForStrategyChanged(@NonNull AudioProductStrategy strategy,
-                @Nullable AudioDevice device);
+                @Nullable AudioDeviceAttributes device);
     }
 
     /**
@@ -1768,7 +1768,8 @@
             extends IStrategyPreferredDeviceDispatcher.Stub {
 
         @Override
-        public void dispatchPrefDeviceChanged(int strategyId, @Nullable AudioDevice device) {
+        public void dispatchPrefDeviceChanged(int strategyId,
+                                              @Nullable AudioDeviceAttributes device) {
             // make a shallow copy of listeners so callback is not executed under lock
             final ArrayList<PrefDevListenerInfo> prefDevListeners;
             synchronized (mPrefDevListenerLock) {
@@ -4553,7 +4554,7 @@
      */
     @SystemApi
     @RequiresPermission(android.Manifest.permission.MODIFY_AUDIO_ROUTING)
-    public @NonNull List<AudioDevice> getDevicesForAttributes(
+    public @NonNull List<AudioDeviceAttributes> getDevicesForAttributes(
             @NonNull AudioAttributes attributes) {
         Objects.requireNonNull(attributes);
         final IAudioService service = getService();
diff --git a/media/java/android/media/AudioPlaybackCaptureConfiguration.java b/media/java/android/media/AudioPlaybackCaptureConfiguration.java
index 65f2f17..453704e 100644
--- a/media/java/android/media/AudioPlaybackCaptureConfiguration.java
+++ b/media/java/android/media/AudioPlaybackCaptureConfiguration.java
@@ -102,12 +102,6 @@
                                 criterion -> criterion.getIntProp());
     }
 
-    /** @return the userId's passed to {@link Builder#addMatchingUserId(int)}. */
-    public @NonNull int[] getMatchingUserIds() {
-        return getIntPredicates(AudioMixingRule.RULE_MATCH_USERID,
-                criterion -> criterion.getIntProp());
-    }
-
     /** @return the usages passed to {@link Builder#excludeUsage(int)}. */
     @AttributeUsage
     public @NonNull int[] getExcludeUsages() {
@@ -121,12 +115,6 @@
                                 criterion -> criterion.getIntProp());
     }
 
-    /** @return the userId's passed to {@link Builder#excludeUserId(int)}.  */
-    public @NonNull int[] getExcludeUserIds() {
-        return getIntPredicates(AudioMixingRule.RULE_EXCLUDE_USERID,
-                criterion -> criterion.getIntProp());
-    }
-
     private int[] getIntPredicates(int rule,
                                    ToIntFunction<AudioMixMatchCriterion> getPredicate) {
         return mAudioMixingRule.getCriteria().stream()
@@ -165,7 +153,6 @@
         private final MediaProjection mProjection;
         private int mUsageMatchType = MATCH_TYPE_UNSPECIFIED;
         private int mUidMatchType = MATCH_TYPE_UNSPECIFIED;
-        private int mUserIdMatchType = MATCH_TYPE_UNSPECIFIED;
 
         /** @param projection A MediaProjection that supports audio projection. */
         public Builder(@NonNull MediaProjection projection) {
@@ -215,23 +202,6 @@
         }
 
         /**
-         * Only capture audio output by app with the matching {@code userId}.
-         *
-         * <p>If called multiple times, will capture audio output by apps whose userId is any of the
-         * given userId's.
-         *
-         * @throws IllegalStateException if called in conjunction with {@link #excludeUserId(int)}.
-         */
-        public @NonNull Builder addMatchingUserId(int userId) {
-            Preconditions.checkState(
-                    mUserIdMatchType != MATCH_TYPE_EXCLUSIVE,
-                    ERROR_MESSAGE_MISMATCHED_RULES);
-            mAudioMixingRuleBuilder.addMixRule(AudioMixingRule.RULE_MATCH_USERID, userId);
-            mUserIdMatchType = MATCH_TYPE_INCLUSIVE;
-            return this;
-        }
-
-        /**
          * Only capture audio output that does not match the given {@link AudioAttributes}.
          *
          * <p>If called multiple times, will capture audio output that does not match any of the
@@ -268,24 +238,6 @@
         }
 
         /**
-         * Only capture audio output by apps that do not have the matching {@code userId}.
-         *
-         * <p>If called multiple times, will capture audio output by apps whose userId is not any of
-         * the given userId's.
-         *
-         * @throws IllegalStateException if called in conjunction with
-         * {@link #addMatchingUserId(int)}.
-         */
-        public @NonNull Builder excludeUserId(int userId) {
-            Preconditions.checkState(
-                    mUserIdMatchType != MATCH_TYPE_INCLUSIVE,
-                    ERROR_MESSAGE_MISMATCHED_RULES);
-            mAudioMixingRuleBuilder.excludeMixRule(AudioMixingRule.RULE_MATCH_USERID, userId);
-            mUserIdMatchType = MATCH_TYPE_EXCLUSIVE;
-            return this;
-        }
-
-        /**
          * Builds the configuration instance.
          *
          * @throws UnsupportedOperationException if the parameters set are incompatible.
diff --git a/media/java/android/media/AudioSystem.java b/media/java/android/media/AudioSystem.java
index 53379b87..8b973a1 100644
--- a/media/java/android/media/AudioSystem.java
+++ b/media/java/android/media/AudioSystem.java
@@ -1096,18 +1096,18 @@
      * @return an empty list if there was an issue with the request, a list of audio devices
      *   otherwise (typically one device, except for duplicated paths).
      */
-    public static @NonNull ArrayList<AudioDevice> getDevicesForAttributes(
+    public static @NonNull ArrayList<AudioDeviceAttributes> getDevicesForAttributes(
             @NonNull AudioAttributes attributes) {
         Objects.requireNonNull(attributes);
-        final AudioDevice[] devices = new AudioDevice[MAX_DEVICE_ROUTING];
+        final AudioDeviceAttributes[] devices = new AudioDeviceAttributes[MAX_DEVICE_ROUTING];
         final int res = getDevicesForAttributes(attributes, devices);
-        final ArrayList<AudioDevice> routeDevices = new ArrayList<>();
+        final ArrayList<AudioDeviceAttributes> routeDevices = new ArrayList<>();
         if (res != SUCCESS) {
             Log.e(TAG, "error " + res + " in getDevicesForAttributes for " + attributes);
             return routeDevices;
         }
 
-        for (AudioDevice device : devices) {
+        for (AudioDeviceAttributes device : devices) {
             if (device != null) {
                 routeDevices.add(device);
             }
@@ -1117,12 +1117,12 @@
 
     /**
      * Maximum number of audio devices a track is ever routed to, determines the size of the
-     * array passed to {@link #getDevicesForAttributes(AudioAttributes, AudioDevice[])}
+     * array passed to {@link #getDevicesForAttributes(AudioAttributes, AudioDeviceAttributes[])}
      */
     private static final int MAX_DEVICE_ROUTING = 4;
 
     private static native int getDevicesForAttributes(@NonNull AudioAttributes aa,
-                                                      @NonNull AudioDevice[] devices);
+                                                      @NonNull AudioDeviceAttributes[] devices);
 
     /** @hide returns true if master mono is enabled. */
     public static native boolean getMasterMono();
@@ -1257,7 +1257,7 @@
      * @return {@link #SUCCESS} if successfully set
      */
     public static int setPreferredDeviceForStrategy(
-            int strategy, @NonNull AudioDevice device) {
+            int strategy, @NonNull AudioDeviceAttributes device) {
         return setPreferredDeviceForStrategy(strategy,
                 AudioDeviceInfo.convertDeviceTypeToInternalDevice(device.getType()),
                 device.getAddress());
@@ -1288,7 +1288,7 @@
      *     and written to the array
      */
     public static native int getPreferredDeviceForStrategy(int strategy,
-                                                           AudioDevice[] device);
+                                                           AudioDeviceAttributes[] device);
 
     // Items shared with audio service
 
diff --git a/media/java/android/media/IAudioService.aidl b/media/java/android/media/IAudioService.aidl
index 27bf3fe..5f320cd 100644
--- a/media/java/android/media/IAudioService.aidl
+++ b/media/java/android/media/IAudioService.aidl
@@ -18,7 +18,7 @@
 
 import android.bluetooth.BluetoothDevice;
 import android.media.AudioAttributes;
-import android.media.AudioDevice;
+import android.media.AudioDeviceAttributes;
 import android.media.AudioFocusInfo;
 import android.media.AudioPlaybackConfiguration;
 import android.media.AudioRecordingConfiguration;
@@ -275,13 +275,13 @@
 
     boolean isCallScreeningModeSupported();
 
-    int setPreferredDeviceForStrategy(in int strategy, in AudioDevice device);
+    int setPreferredDeviceForStrategy(in int strategy, in AudioDeviceAttributes device);
 
     int removePreferredDeviceForStrategy(in int strategy);
 
-    AudioDevice getPreferredDeviceForStrategy(in int strategy);
+    AudioDeviceAttributes getPreferredDeviceForStrategy(in int strategy);
 
-    List<AudioDevice> getDevicesForAttributes(in AudioAttributes attributes);
+    List<AudioDeviceAttributes> getDevicesForAttributes(in AudioAttributes attributes);
 
     int setAllowedCapturePolicy(in int capturePolicy);
 
diff --git a/media/java/android/media/IStrategyPreferredDeviceDispatcher.aidl b/media/java/android/media/IStrategyPreferredDeviceDispatcher.aidl
index 6db9e52..b1f99e6 100644
--- a/media/java/android/media/IStrategyPreferredDeviceDispatcher.aidl
+++ b/media/java/android/media/IStrategyPreferredDeviceDispatcher.aidl
@@ -16,7 +16,7 @@
 
 package android.media;
 
-import android.media.AudioDevice;
+import android.media.AudioDeviceAttributes;
 
 /**
  * AIDL for AudioService to signal audio strategy-preferred device updates.
@@ -25,6 +25,6 @@
  */
 oneway interface IStrategyPreferredDeviceDispatcher {
 
-    void dispatchPrefDeviceChanged(int strategyId, in AudioDevice device);
+    void dispatchPrefDeviceChanged(int strategyId, in AudioDeviceAttributes device);
 
 }
diff --git a/media/java/android/media/MediaCas.java b/media/java/android/media/MediaCas.java
index cefc9db..3a771bb 100644
--- a/media/java/android/media/MediaCas.java
+++ b/media/java/android/media/MediaCas.java
@@ -19,14 +19,20 @@
 import android.annotation.IntDef;
 import android.annotation.NonNull;
 import android.annotation.Nullable;
+import android.content.Context;
 import android.hardware.cas.V1_0.HidlCasPluginDescriptor;
 import android.hardware.cas.V1_0.ICas;
 import android.hardware.cas.V1_0.IMediaCasService;
 import android.hardware.cas.V1_2.ICasListener;
+import android.hardware.cas.V1_2.Status;
 import android.media.MediaCasException.*;
 import android.media.tv.TvInputService.PriorityHintUseCaseType;
+import android.media.tv.tunerresourcemanager.CasSessionRequest;
+import android.media.tv.tunerresourcemanager.ResourceClientProfile;
+import android.media.tv.tunerresourcemanager.TunerResourceManager;
 import android.os.Bundle;
 import android.os.Handler;
+import android.os.HandlerExecutor;
 import android.os.HandlerThread;
 import android.os.IHwBinder;
 import android.os.Looper;
@@ -39,6 +45,9 @@
 import java.lang.annotation.Retention;
 import java.lang.annotation.RetentionPolicy;
 import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Objects;
 
 /**
  * MediaCas can be used to obtain keys for descrambling protected media streams, in
@@ -110,6 +119,10 @@
     private EventHandler mEventHandler;
     private @PriorityHintUseCaseType int mPriorityHint;
     private String mTvInputServiceSessionId;
+    private int mClientId;
+    private int mCasSystemId;
+    private TunerResourceManager mTunerResourceManager = null;
+    private final Map<Session, Integer> mSessionMap = new HashMap<>();
 
     /**
      * Scrambling modes used to open cas sessions.
@@ -329,6 +342,10 @@
                         createFromSessionId(sessionId), msg.arg1, msg.arg2,
                         bundle.getByteArray(DATA_KEY));
             } else if (msg.what == MSG_CAS_STATUS_EVENT) {
+                if ((msg.arg1 == PLUGIN_STATUS_SESSION_NUMBER_CHANGED)
+                        && (mTunerResourceManager != null)) {
+                    mTunerResourceManager.updateCasInfo(mCasSystemId, msg.arg2);
+                }
                 mListener.onPluginStatusUpdate(MediaCas.this, msg.arg1, msg.arg2);
             } else if (msg.what == MSG_CAS_RESOURCE_LOST) {
                 mListener.onResourceLost(MediaCas.this);
@@ -364,6 +381,19 @@
                     EventHandler.MSG_CAS_STATUS_EVENT, status, arg));
         }
     };
+
+    private final TunerResourceManager.ResourcesReclaimListener mResourceListener =
+            new TunerResourceManager.ResourcesReclaimListener() {
+            @Override
+            public void onReclaimResources() {
+                synchronized (mSessionMap) {
+                    mSessionMap.forEach((casSession, sessionResourceId) -> casSession.close());
+                }
+                mEventHandler.sendMessage(mEventHandler.obtainMessage(
+                        EventHandler.MSG_CAS_RESOURCE_LOST));
+            }
+        };
+
     /**
      * Describe a CAS plugin with its CA_system_ID and string name.
      *
@@ -429,11 +459,21 @@
      */
     public final class Session implements AutoCloseable {
         final ArrayList<Byte> mSessionId;
+        boolean mIsClosed = false;
 
         Session(@NonNull ArrayList<Byte> sessionId) {
             mSessionId = new ArrayList<Byte>(sessionId);
         }
 
+        private void validateSessionInternalStates() {
+            if (mICas == null) {
+                throw new IllegalStateException();
+            }
+            if (mIsClosed) {
+                MediaCasStateException.throwExceptionIfNeeded(Status.ERROR_CAS_SESSION_NOT_OPENED);
+            }
+        }
+
         /**
          * Query if an object equal current Session object.
          *
@@ -459,7 +499,7 @@
          */
         public void setPrivateData(@NonNull byte[] data)
                 throws MediaCasException {
-            validateInternalStates();
+            validateSessionInternalStates();
 
             try {
                 MediaCasException.throwExceptionIfNeeded(
@@ -483,7 +523,7 @@
          */
         public void processEcm(@NonNull byte[] data, int offset, int length)
                 throws MediaCasException {
-            validateInternalStates();
+            validateSessionInternalStates();
 
             try {
                 MediaCasException.throwExceptionIfNeeded(
@@ -522,7 +562,7 @@
          */
         public void sendSessionEvent(int event, int arg, @Nullable byte[] data)
                 throws MediaCasException {
-            validateInternalStates();
+            validateSessionInternalStates();
 
             if (mICasV11 == null) {
                 Log.d(TAG, "Send Session Event isn't supported by cas@1.0 interface");
@@ -546,7 +586,7 @@
          */
         @NonNull
         public byte[] getSessionId() {
-            validateInternalStates();
+            validateSessionInternalStates();
             return toBytes(mSessionId);
         }
 
@@ -558,11 +598,12 @@
          */
         @Override
         public void close() {
-            validateInternalStates();
-
+            validateSessionInternalStates();
             try {
                 MediaCasStateException.throwExceptionIfNeeded(
                         mICas.closeSession(mSessionId));
+                mIsClosed = true;
+                removeSessionFromResourceMap(this);
             } catch (RemoteException e) {
                 cleanupAndRethrowIllegalState();
             }
@@ -664,6 +705,7 @@
     /**
      * Instantiate a CA system of the specified system id.
      *
+     * @param context the context of the caller.
      * @param casSystemId The system id of the CA system.
      * @param tvInputServiceSessionId The Id of the session opened in TV Input Service (TIS)
      *        {@link android.media.tv.TvInputService#onCreateSession(String, String)}
@@ -672,11 +714,23 @@
      * @throws UnsupportedCasException if the device does not support the
      * specified CA system.
      */
-    public MediaCas(int casSystemId, @Nullable String tvInputServiceSessionId,
-            @PriorityHintUseCaseType int priorityHint)  throws UnsupportedCasException {
+    public MediaCas(@NonNull Context context, int casSystemId,
+            @Nullable String tvInputServiceSessionId,
+            @PriorityHintUseCaseType int priorityHint) throws UnsupportedCasException {
         this(casSystemId);
-        mPriorityHint = priorityHint;
-        mTvInputServiceSessionId = tvInputServiceSessionId;
+
+        Objects.requireNonNull(context, "context must not be null");
+        mCasSystemId = casSystemId;
+        mTunerResourceManager = (TunerResourceManager)
+                context.getSystemService(Context.TV_TUNER_RESOURCE_MGR_SERVICE);
+        if (mTunerResourceManager != null) {
+            int[] clientId = new int[1];
+            ResourceClientProfile profile =
+                    new ResourceClientProfile(tvInputServiceSessionId, priorityHint);
+            mTunerResourceManager.registerClientProfile(
+                    profile, new HandlerExecutor(mEventHandler), mResourceListener, clientId);
+            mClientId = clientId[0];
+        }
     }
 
     IHwBinder getBinder() {
@@ -813,6 +867,40 @@
         }
     }
 
+    private int getSessionResourceId() throws MediaCasException {
+        validateInternalStates();
+
+        int[] sessionResourceId = new int[1];
+        sessionResourceId[0] = -1;
+        if (mTunerResourceManager != null) {
+            CasSessionRequest casSessionRequest = new CasSessionRequest(mClientId, mCasSystemId);
+            if (!mTunerResourceManager.requestCasSession(casSessionRequest, sessionResourceId)) {
+                throw new MediaCasException.ResourceBusyException(
+                    "insufficient resource to Open Session");
+            }
+        }
+        return  sessionResourceId[0];
+    }
+
+    private void addSessionToResourceMap(Session session, int sessionResourceId) {
+
+        if (sessionResourceId != -1) {
+            synchronized (mSessionMap) {
+                mSessionMap.put(session, sessionResourceId);
+            }
+        }
+    }
+
+    private void removeSessionFromResourceMap(Session session) {
+
+        synchronized (mSessionMap) {
+            if (mSessionMap.get(session) != null) {
+                mTunerResourceManager.releaseCasSession(mSessionMap.get(session));
+                mSessionMap.remove(session);
+            }
+        }
+    }
+
     /**
      * Open a session to descramble one or more streams scrambled by the
      * conditional access system.
@@ -824,12 +912,13 @@
      * @throws MediaCasStateException for CAS-specific state exceptions.
      */
     public Session openSession() throws MediaCasException {
-        validateInternalStates();
+        int sessionResourceId = getSessionResourceId();
 
         try {
             OpenSessionCallback cb = new OpenSessionCallback();
             mICas.openSession(cb);
             MediaCasException.throwExceptionIfNeeded(cb.mStatus);
+            addSessionToResourceMap(cb.mSession, sessionResourceId);
             return cb.mSession;
         } catch (RemoteException e) {
             cleanupAndRethrowIllegalState();
@@ -853,7 +942,7 @@
     @Nullable
     public Session openSession(@SessionUsage int sessionUsage, @ScramblingMode int scramblingMode)
             throws MediaCasException {
-        validateInternalStates();
+        int sessionResourceId = getSessionResourceId();
 
         if (mICasV12 == null) {
             Log.d(TAG, "Open Session with scrambling mode is only supported by cas@1.2+ interface");
@@ -864,6 +953,7 @@
             OpenSession_1_2_Callback cb = new OpenSession_1_2_Callback();
             mICasV12.openSession_1_2(sessionUsage, scramblingMode, cb);
             MediaCasException.throwExceptionIfNeeded(cb.mStatus);
+            addSessionToResourceMap(cb.mSession, sessionResourceId);
             return cb.mSession;
         } catch (RemoteException e) {
             cleanupAndRethrowIllegalState();
@@ -987,6 +1077,16 @@
                 mICas = null;
             }
         }
+
+        if (mTunerResourceManager != null) {
+            mTunerResourceManager.unregisterClientProfile(mClientId);
+            mTunerResourceManager = null;
+        }
+
+        if (mHandlerThread != null) {
+            mHandlerThread.quit();
+            mHandlerThread = null;
+        }
     }
 
     @Override
diff --git a/media/java/android/media/MediaFormat.java b/media/java/android/media/MediaFormat.java
index b57182e..5832fc1 100644
--- a/media/java/android/media/MediaFormat.java
+++ b/media/java/android/media/MediaFormat.java
@@ -656,16 +656,20 @@
     public static final String KEY_AAC_MAX_OUTPUT_CHANNEL_COUNT = "aac-max-output-channel_count";
 
     /**
-     * A key describing a gain to be applied so that the output loudness matches the
-     * Target Reference Level. This is typically used to normalize loudness across program items.
-     * The gain is derived as the difference between the Target Reference Level and the
-     * Program Reference Level. The latter can be given in the bitstream and indicates the actual
-     * loudness value of the program item.
+     * A key describing the Target Reference Level (Target Loudness).
+     * <p>For normalizing loudness across program items, a gain is applied to the audio output so
+     * that the output loudness matches the Target Reference Level. The gain is derived as the
+     * difference between the Target Reference Level and the Program Reference Level (Program
+     * Loudness). The latter can be given in the bitstream and indicates the actual loudness value
+     * of the program item.</p>
      * <p>The Target Reference Level controls loudness normalization for both MPEG-4 DRC and
      * MPEG-D DRC.
      * <p>The value is given as an integer value between
      * 40 and 127, and is calculated as -4 * Target Reference Level in LKFS.
      * Therefore, it represents the range of -10 to -31.75 LKFS.
+     * <p>For MPEG-4 DRC, a value of -1 switches off loudness normalization and DRC processing.</p>
+     * <p>For MPEG-D DRC, a value of -1 switches off loudness normalization only. For DRC processing
+     * options of MPEG-D DRC, see {@link #KEY_AAC_DRC_EFFECT_TYPE}</p>
      * <p>The default value on mobile devices is 64 (-16 LKFS).
      * <p>This key is only used during decoding.
      */
@@ -686,7 +690,7 @@
      * <tr><th>6</th><th>General compression</th></tr>
      * </table>
      * <p>The value -1 (Off) disables DRC processing, while loudness normalization may still be
-     * active and dependent on KEY_AAC_DRC_TARGET_REFERENCE_LEVEL.<br>
+     * active and dependent on {@link #KEY_AAC_DRC_TARGET_REFERENCE_LEVEL}.<br>
      * The value 0 (None) automatically enables DRC processing if necessary to prevent signal
      * clipping<br>
      * The value 6 (General compression) can be used for enabling MPEG-D DRC without particular
@@ -703,8 +707,8 @@
      * 0 and 127, which is calculated as -4 * Encoded Target Level in LKFS.
      * If the Encoded Target Level is unknown, the value can be set to -1.
      * <p>The default value is -1 (unknown).
-     * <p>The value is ignored when heavy compression is used (see
-     * {@link #KEY_AAC_DRC_HEAVY_COMPRESSION}).
+     * <p>The value is ignored when heavy compression (see {@link #KEY_AAC_DRC_HEAVY_COMPRESSION})
+     * or MPEG-D DRC is used.
      * <p>This key is only used during decoding.
      */
     public static final String KEY_AAC_ENCODED_TARGET_LEVEL = "aac-encoded-target-level";
@@ -745,17 +749,17 @@
     public static final String KEY_AAC_DRC_ATTENUATION_FACTOR = "aac-drc-cut-level";
 
     /**
-     * A key describing the selection of the heavy compression profile for DRC.
-     * Two separate DRC gain sequences can be transmitted in one bitstream: MPEG-4 DRC light
-     * compression, and DVB-specific heavy compression. When selecting the application of the heavy
-     * compression, one of the sequences is selected:
+     * A key describing the selection of the heavy compression profile for MPEG-4 DRC.
+     * <p>Two separate DRC gain sequences can be transmitted in one bitstream: light compression
+     * and heavy compression. When selecting the application of the heavy compression, one of
+     * the sequences is selected:
      * <ul>
      * <li>0 enables light compression,</li>
      * <li>1 enables heavy compression instead.
      * </ul>
-     * Note that only light compression offers the features of scaling of DRC gains
+     * Note that heavy compression doesn't offer the features of scaling of DRC gains
      * (see {@link #KEY_AAC_DRC_BOOST_FACTOR} and {@link #KEY_AAC_DRC_ATTENUATION_FACTOR} for the
-     * boost and attenuation factors, and frequency-selective (multiband) DRC.
+     * boost and attenuation factors), and frequency-selective (multiband) DRC.
      * Light compression usually contains clipping prevention for stereo downmixing while heavy
      * compression, if additionally provided in the bitstream, is usually stronger, and contains
      * clipping prevention for stereo and mono downmixing.
diff --git a/media/java/android/media/MediaRoute2Info.java b/media/java/android/media/MediaRoute2Info.java
index 0e88c75..bf04fe8 100644
--- a/media/java/android/media/MediaRoute2Info.java
+++ b/media/java/android/media/MediaRoute2Info.java
@@ -411,11 +411,10 @@
 
     /**
      * Returns true if the route info has all of the required field.
-     * A route info only obtained from {@link com.android.server.media.MediaRouterService}
-     * is valid.
+     * A route is valid if and only if it is obtained from
+     * {@link com.android.server.media.MediaRouterService}.
      * @hide
      */
-    //TODO: Reconsider the validity of a route info when fields are added.
     public boolean isValid() {
         if (TextUtils.isEmpty(getId()) || TextUtils.isEmpty(getName())
                 || TextUtils.isEmpty(getProviderId())) {
diff --git a/media/java/android/media/MediaRoute2ProviderService.java b/media/java/android/media/MediaRoute2ProviderService.java
index e205bbb..38233fd 100644
--- a/media/java/android/media/MediaRoute2ProviderService.java
+++ b/media/java/android/media/MediaRoute2ProviderService.java
@@ -104,7 +104,6 @@
     @Override
     @Nullable
     public IBinder onBind(@NonNull Intent intent) {
-        //TODO: Allow binding from media router service only?
         if (SERVICE_INTERFACE.equals(intent.getAction())) {
             if (mStub == null) {
                 mStub = new MediaRoute2ProviderServiceStub();
diff --git a/media/java/android/media/MediaRouter2.java b/media/java/android/media/MediaRouter2.java
index 6281ccd..28bb4c1 100644
--- a/media/java/android/media/MediaRouter2.java
+++ b/media/java/android/media/MediaRouter2.java
@@ -363,7 +363,7 @@
     /**
      * Transfers the current media to the given route.
      * If it's necessary a new {@link RoutingController} is created or it is handled within
-     * the current controller.
+     * the current routing controller.
      *
      * @param route the route you want to transfer the current media to. Pass {@code null} to
      *              stop routing of the current media.
@@ -393,8 +393,11 @@
             return;
         }
 
-        // TODO: Check the given route exists
         // TODO: Check thread-safety
+        if (!mRoutes.containsKey(route.getId())) {
+            notifyTransferFailed(route);
+            return;
+        }
         if (controller.getRoutingSessionInfo().getTransferableRoutes().contains(route.getId())) {
             controller.transferToRoute(route);
             return;
@@ -877,9 +880,11 @@
          */
         @NonNull
         public List<MediaRoute2Info> getSelectedRoutes() {
+            List<String> selectedRouteIds;
             synchronized (mControllerLock) {
-                return getRoutesWithIdsLocked(mSessionInfo.getSelectedRoutes());
+                selectedRouteIds = mSessionInfo.getSelectedRoutes();
             }
+            return getRoutesWithIds(selectedRouteIds);
         }
 
         /**
@@ -887,9 +892,11 @@
          */
         @NonNull
         public List<MediaRoute2Info> getSelectableRoutes() {
+            List<String> selectableRouteIds;
             synchronized (mControllerLock) {
-                return getRoutesWithIdsLocked(mSessionInfo.getSelectableRoutes());
+                selectableRouteIds = mSessionInfo.getSelectableRoutes();
             }
+            return getRoutesWithIds(selectableRouteIds);
         }
 
         /**
@@ -897,9 +904,11 @@
          */
         @NonNull
         public List<MediaRoute2Info> getDeselectableRoutes() {
+            List<String> deselectableRouteIds;
             synchronized (mControllerLock) {
-                return getRoutesWithIdsLocked(mSessionInfo.getDeselectableRoutes());
+                deselectableRouteIds = mSessionInfo.getDeselectableRoutes();
             }
+            return getRoutesWithIds(deselectableRouteIds);
         }
 
         /**
@@ -1203,20 +1212,12 @@
             }
         }
 
-        // TODO: This method uses two locks (mLock outside, sLock inside).
-        //       Check if there is any possiblity of deadlock.
-        private List<MediaRoute2Info> getRoutesWithIdsLocked(List<String> routeIds) {
-            List<MediaRoute2Info> routes = new ArrayList<>();
+        private List<MediaRoute2Info> getRoutesWithIds(List<String> routeIds) {
             synchronized (sRouterLock) {
-                // TODO: Maybe able to change using Collection.stream()?
-                for (String routeId : routeIds) {
-                    MediaRoute2Info route = mRoutes.get(routeId);
-                    if (route != null) {
-                        routes.add(route);
-                    }
-                }
+                return routeIds.stream().map(mRoutes::get)
+                        .filter(Objects::nonNull)
+                        .collect(Collectors.toList());
             }
-            return Collections.unmodifiableList(routes);
         }
     }
 
diff --git a/media/java/android/media/MediaRouter2Manager.java b/media/java/android/media/MediaRouter2Manager.java
index 8a08d14..636ee92 100644
--- a/media/java/android/media/MediaRouter2Manager.java
+++ b/media/java/android/media/MediaRouter2Manager.java
@@ -453,6 +453,10 @@
             record.mExecutor.execute(() -> record.mCallback
                     .onControlCategoriesChanged(packageName, preferredFeatures));
         }
+        for (CallbackRecord record : mCallbackRecords) {
+            record.mExecutor.execute(() -> record.mCallback
+                    .onPreferredFeaturesChanged(packageName, preferredFeatures));
+        }
     }
 
     /**
@@ -760,6 +764,7 @@
          */
         public void onSessionsUpdated() {}
 
+        //TODO: remove this
         /**
          * Called when the preferred route features of an app is changed.
          *
@@ -768,6 +773,16 @@
          */
         public void onControlCategoriesChanged(@NonNull String packageName,
                 @NonNull List<String> preferredFeatures) {}
+
+        /**
+         * Called when the preferred route features of an app is changed.
+         *
+         * @param packageName the package name of the application
+         * @param preferredFeatures the list of preferred route features set by an application.
+         */
+        public void onPreferredFeaturesChanged(@NonNull String packageName,
+                @NonNull List<String> preferredFeatures) {}
+
     }
 
     final class CallbackRecord {
diff --git a/media/java/android/media/audiofx/AudioEffect.java b/media/java/android/media/audiofx/AudioEffect.java
index 6157ef4..2587350 100644
--- a/media/java/android/media/audiofx/AudioEffect.java
+++ b/media/java/android/media/audiofx/AudioEffect.java
@@ -25,7 +25,7 @@
 import android.annotation.TestApi;
 import android.app.ActivityThread;
 import android.compat.annotation.UnsupportedAppUsage;
-import android.media.AudioDevice;
+import android.media.AudioDeviceAttributes;
 import android.media.AudioDeviceInfo;
 import android.media.AudioSystem;
 import android.os.Build;
@@ -476,12 +476,12 @@
      */
     @SystemApi
     @RequiresPermission(android.Manifest.permission.MODIFY_DEFAULT_AUDIO_EFFECTS)
-    public AudioEffect(@NonNull UUID uuid, @NonNull AudioDevice device) {
+    public AudioEffect(@NonNull UUID uuid, @NonNull AudioDeviceAttributes device) {
         this(EFFECT_TYPE_NULL, Objects.requireNonNull(uuid), 0, -2, Objects.requireNonNull(device));
     }
 
     private AudioEffect(UUID type, UUID uuid, int priority,
-            int audioSession, @Nullable AudioDevice device)
+            int audioSession, @Nullable AudioDeviceAttributes device)
             throws IllegalArgumentException, UnsupportedOperationException,
             RuntimeException {
         int[] id = new int[1];
diff --git a/media/java/android/media/audiopolicy/AudioPolicy.java b/media/java/android/media/audiopolicy/AudioPolicy.java
index 32a4a4f..d3e9c7e 100644
--- a/media/java/android/media/audiopolicy/AudioPolicy.java
+++ b/media/java/android/media/audiopolicy/AudioPolicy.java
@@ -21,6 +21,7 @@
 import android.annotation.Nullable;
 import android.annotation.SystemApi;
 import android.annotation.TestApi;
+import android.annotation.UserIdInt;
 import android.app.ActivityManager;
 import android.content.Context;
 import android.content.pm.PackageManager;
@@ -481,12 +482,13 @@
      * @hide
      * Removes audio device affinity previously set by
      * {@link #setUserIdDeviceAffinity(int, java.util.List)}.
-     * @param userId userId of the application affected.
+     * @param userId userId of the application affected, as obtained via
+     * {@link UserHandle#getIdentifier}. Not to be confused with application uid.
      * @return true if the change was successful, false otherwise.
      */
     @TestApi
     @SystemApi
-    public boolean removeUserIdDeviceAffinity(int userId) {
+    public boolean removeUserIdDeviceAffinity(@UserIdInt int userId) {
         synchronized (mLock) {
             if (mStatus != POLICY_STATUS_REGISTERED) {
                 throw new IllegalStateException("Cannot use unregistered AudioPolicy");
@@ -512,13 +514,15 @@
      * multiple devices in the list doesn't imply the signals will be duplicated on the different
      * audio devices, final routing will depend on the {@link AudioAttributes} of the sounds being
      * played.
-     * @param userId Android user id to affect.
+     * @param userId userId of the application affected, as obtained via
+     * {@link UserHandle#getIdentifier}. Not to be confused with application uid.
      * @param devices list of devices to which the audio stream of the application may be routed.
      * @return true if the change was successful, false otherwise.
      */
     @TestApi
     @SystemApi
-    public boolean setUserIdDeviceAffinity(int userId, @NonNull List<AudioDeviceInfo> devices) {
+    public boolean setUserIdDeviceAffinity(@UserIdInt int userId,
+            @NonNull List<AudioDeviceInfo> devices) {
         Objects.requireNonNull(devices, "Illegal null list of audio devices");
         synchronized (mLock) {
             if (mStatus != POLICY_STATUS_REGISTERED) {
diff --git a/media/java/android/media/tv/TvInputService.java b/media/java/android/media/tv/TvInputService.java
index 62c7e51..b579144 100755
--- a/media/java/android/media/tv/TvInputService.java
+++ b/media/java/android/media/tv/TvInputService.java
@@ -111,37 +111,32 @@
     public @interface PriorityHintUseCaseType {}
 
     /**
-     * Use case of priority hint for {@link android.media.MediaCas#MediaCas(int, String , int)}:
-     * Background.
-     * TODO Link: Tuner#Tuner(Context, string, int).
+     * Use case of priority hint for {@link android.media.MediaCas#MediaCas(Context, int, String,
+     * int)}: Background. TODO Link: Tuner#Tuner(Context, string, int).
      */
     public static final int PRIORITY_HINT_USE_CASE_TYPE_BACKGROUND = 100;
 
     /**
-     * Use case of priority hint for {@link android.media.MediaCas#MediaCas(int, String , int)}:
-     * Scan.
-     * TODO Link: Tuner#Tuner(Context, string, int).
+     * Use case of priority hint for {@link android.media.MediaCas#MediaCas(Context, int, String,
+     * int)}: Scan. TODO Link: Tuner#Tuner(Context, string, int).
      */
     public static final int PRIORITY_HINT_USE_CASE_TYPE_SCAN = 200;
 
     /**
-     * Use case of priority hint for {@link android.media.MediaCas#MediaCas(int, String , int)}:
-     * Playback.
-     * TODO Link: Tuner#Tuner(Context, string, int).
+     * Use case of priority hint for {@link android.media.MediaCas#MediaCas(Context, int, String,
+     * int)}: Playback. TODO Link: Tuner#Tuner(Context, string, int).
      */
     public static final int PRIORITY_HINT_USE_CASE_TYPE_PLAYBACK = 300;
 
     /**
-     * Use case of priority hint for {@link android.media.MediaCas#MediaCas(int, String , int)}:
-     * Live.
-     * TODO Link: Tuner#Tuner(Context, string, int).
+     * Use case of priority hint for {@link android.media.MediaCas#MediaCas(Context, int, String,
+     * int)}: Live. TODO Link: Tuner#Tuner(Context, string, int).
      */
     public static final int PRIORITY_HINT_USE_CASE_TYPE_LIVE = 400;
 
     /**
-     * Use case of priority hint for {@link android.media.MediaCas#MediaCas(int, String , int)}:
-     * Record.
-     * TODO Link: Tuner#Tuner(Context, string, int).
+     * Use case of priority hint for {@link android.media.MediaCas#MediaCas(Context, int, String,
+     * int)}: Record. TODO Link: Tuner#Tuner(Context, string, int).
      */
     public static final int PRIORITY_HINT_USE_CASE_TYPE_RECORD = 500;
 
diff --git a/media/java/android/media/tv/tuner/DemuxCapabilities.java b/media/java/android/media/tv/tuner/DemuxCapabilities.java
index 364516c..0f5bf08 100644
--- a/media/java/android/media/tv/tuner/DemuxCapabilities.java
+++ b/media/java/android/media/tv/tuner/DemuxCapabilities.java
@@ -18,7 +18,7 @@
 
 import android.annotation.BytesLong;
 import android.annotation.IntDef;
-import android.annotation.Nullable;
+import android.annotation.NonNull;
 import android.annotation.Size;
 import android.annotation.SystemApi;
 import android.media.tv.tuner.filter.Filter;
@@ -159,7 +159,7 @@
      * {@link FilterConfiguration}.
      * <p>The ith element represents the filter's capability as the source for the ith type.
      */
-    @Nullable
+    @NonNull
     @Size(5)
     public int[] getLinkCapabilities() {
         return mLinkCaps;
diff --git a/media/java/android/media/tv/tuner/Descrambler.java b/media/java/android/media/tv/tuner/Descrambler.java
index f46d3ce..40add56 100644
--- a/media/java/android/media/tv/tuner/Descrambler.java
+++ b/media/java/android/media/tv/tuner/Descrambler.java
@@ -17,12 +17,15 @@
 package android.media.tv.tuner;
 
 import android.annotation.IntDef;
+import android.annotation.NonNull;
 import android.annotation.Nullable;
 import android.annotation.SystemApi;
+import android.media.tv.tuner.TunerConstants.Result;
 import android.media.tv.tuner.filter.Filter;
 
 import java.lang.annotation.Retention;
 import java.lang.annotation.RetentionPolicy;
+import java.util.Objects;
 
 /**
  * This class is used to interact with descramblers.
@@ -75,6 +78,7 @@
      * @param filter an optional filter instance to identify upper stream.
      * @return result status of the operation.
      */
+    @Result
     public int addPid(@PidType int pidType, int pid, @Nullable Filter filter) {
         return nativeAddPid(pidType, pid, filter);
     }
@@ -89,6 +93,7 @@
      * @param filter an optional filter instance to identify upper stream.
      * @return result status of the operation.
      */
+    @Result
     public int removePid(@PidType int pidType, int pid, @Nullable Filter filter) {
         return nativeRemovePid(pidType, pid, filter);
     }
@@ -102,7 +107,9 @@
      * @param keyToken the token to be used to link the key slot.
      * @return result status of the operation.
      */
-    public int setKeyToken(@Nullable byte[] keyToken) {
+    @Result
+    public int setKeyToken(@NonNull byte[] keyToken) {
+        Objects.requireNonNull(keyToken, "key token must not be null");
         return nativeSetKeyToken(keyToken);
     }
 
diff --git a/media/java/android/media/tv/tuner/Tuner.java b/media/java/android/media/tv/tuner/Tuner.java
index bd00201..012b8d6 100644
--- a/media/java/android/media/tv/tuner/Tuner.java
+++ b/media/java/android/media/tv/tuner/Tuner.java
@@ -38,6 +38,7 @@
 import android.media.tv.tuner.frontend.FrontendInfo;
 import android.media.tv.tuner.frontend.FrontendSettings;
 import android.media.tv.tuner.frontend.FrontendStatus;
+import android.media.tv.tuner.frontend.FrontendStatus.FrontendStatusType;
 import android.media.tv.tuner.frontend.OnTuneEventListener;
 import android.media.tv.tuner.frontend.ScanCallback;
 import android.os.Handler;
@@ -45,6 +46,7 @@
 import android.os.Message;
 
 import java.util.List;
+import java.util.Objects;
 import java.util.concurrent.Executor;
 
 /**
@@ -88,6 +90,10 @@
     private ScanCallback mScanCallback;
     @Nullable
     private Executor mScanCallbackExecutor;
+    @Nullable
+    private OnResourceLostListener mOnResourceLostListener;
+    @Nullable
+    private Executor mOnResourceLostListenerExecutor;
 
     /**
      * Constructs a Tuner instance.
@@ -97,14 +103,37 @@
      * @param useCase the use case of this Tuner instance.
      */
     @RequiresPermission(android.Manifest.permission.ACCESS_TV_TUNER)
-    public Tuner(@NonNull Context context, @NonNull String tvInputSessionId,
-            @TvInputService.PriorityHintUseCaseType int useCase,
-            @Nullable OnResourceLostListener listener) {
+    public Tuner(@NonNull Context context, @Nullable String tvInputSessionId,
+            @TvInputService.PriorityHintUseCaseType int useCase) {
         nativeSetup();
         mContext = context;
     }
 
     /**
+     * Sets the listener for resource lost.
+     *
+     * @param executor the executor on which the listener should be invoked.
+     * @param listener the listener that will be run.
+     */
+    @RequiresPermission(android.Manifest.permission.ACCESS_TV_TUNER)
+    public void setResourceLostListener(@NonNull @CallbackExecutor Executor executor,
+            @NonNull OnResourceLostListener listener) {
+        Objects.requireNonNull(executor, "OnResourceLostListener must not be null");
+        Objects.requireNonNull(listener, "executor must not be null");
+        mOnResourceLostListener = listener;
+        mOnResourceLostListenerExecutor = executor;
+    }
+
+    /**
+     * Removes the listener for resource lost.
+     */
+    @RequiresPermission(android.Manifest.permission.ACCESS_TV_TUNER)
+    public void clearResourceLostListener() {
+        mOnResourceLostListener = null;
+        mOnResourceLostListenerExecutor = null;
+    }
+
+    /**
      * Shares the frontend resource with another Tuner instance
      *
      * @param tuner the Tuner instance to share frontend resource with.
@@ -387,7 +416,7 @@
      */
     @RequiresPermission(android.Manifest.permission.ACCESS_TV_TUNER)
     @Result
-    public int setLna(boolean enable) {
+    public int setLnaEnabled(boolean enable) {
         TunerUtils.checkTunerPermission(mContext);
         return nativeSetLna(enable);
     }
@@ -398,10 +427,10 @@
      * <p>This retrieve the statuses of the frontend for given status types.
      *
      * @param statusTypes an array of status types which the caller requests.
-     * @return statuses which response the caller's requests.
+     * @return statuses which response the caller's requests. {@code null} if the operation failed.
      */
     @Nullable
-    public FrontendStatus getFrontendStatus(@NonNull int[] statusTypes) {
+    public FrontendStatus getFrontendStatus(@NonNull @FrontendStatusType int[] statusTypes) {
         return nativeGetFrontendStatus(statusTypes);
     }
 
@@ -482,6 +511,10 @@
 
     /**
      * Gets Demux capabilities.
+     *
+     * @param context the context of the caller.
+     * @return A {@link DemuxCapabilities} instance that represents the demux capabilities.
+     *         {@code null} if the operation failed.
      */
     @RequiresPermission(android.Manifest.permission.ACCESS_TV_TUNER)
     @Nullable
@@ -637,13 +670,15 @@
      */
     @RequiresPermission(android.Manifest.permission.ACCESS_TV_TUNER)
     @Nullable
-    public Lnb openLnb(@CallbackExecutor @Nullable Executor executor, @Nullable LnbCallback cb) {
+    public Lnb openLnb(@CallbackExecutor @NonNull Executor executor, @NonNull LnbCallback cb) {
+        Objects.requireNonNull(executor, "executor must not be null");
+        Objects.requireNonNull(cb, "LnbCallback must not be null");
         TunerUtils.checkTunerPermission(mContext);
         return openLnbByName(null, executor, cb);
     }
 
     /**
-     * Opens an LNB (low-noise block downconverter) object.
+     * Opens an LNB (low-noise block downconverter) object specified by the give name.
      *
      * @param name the LNB name.
      * @param executor the executor on which callback will be invoked. The default event handler
@@ -653,8 +688,10 @@
      */
     @RequiresPermission(android.Manifest.permission.ACCESS_TV_TUNER)
     @Nullable
-    public Lnb openLnbByName(@Nullable String name, @CallbackExecutor @Nullable Executor executor,
+    public Lnb openLnbByName(@NonNull String name, @CallbackExecutor @NonNull Executor executor,
             @NonNull LnbCallback cb) {
+        Objects.requireNonNull(executor, "executor must not be null");
+        Objects.requireNonNull(cb, "LnbCallback must not be null");
         TunerUtils.checkTunerPermission(mContext);
         // TODO: use resource manager to get LNB ID.
         return new Lnb(0);
@@ -718,8 +755,10 @@
     @Nullable
     public DvrRecorder openDvrRecorder(
             @BytesLong long bufferSize,
-            @CallbackExecutor @Nullable Executor executor,
-            @Nullable OnRecordStatusChangedListener l) {
+            @CallbackExecutor @NonNull Executor executor,
+            @NonNull OnRecordStatusChangedListener l) {
+        Objects.requireNonNull(executor, "executor must not be null");
+        Objects.requireNonNull(l, "OnRecordStatusChangedListener must not be null");
         TunerUtils.checkTunerPermission(mContext);
         DvrRecorder dvr = nativeOpenDvrRecorder(bufferSize);
         return dvr;
@@ -739,8 +778,10 @@
     @Nullable
     public DvrPlayback openDvrPlayback(
             @BytesLong long bufferSize,
-            @CallbackExecutor @Nullable Executor executor,
-            @Nullable OnPlaybackStatusChangedListener l) {
+            @CallbackExecutor @NonNull Executor executor,
+            @NonNull OnPlaybackStatusChangedListener l) {
+        Objects.requireNonNull(executor, "executor must not be null");
+        Objects.requireNonNull(l, "OnPlaybackStatusChangedListener must not be null");
         TunerUtils.checkTunerPermission(mContext);
         DvrPlayback dvr = nativeOpenDvrPlayback(bufferSize);
         return dvr;
diff --git a/media/java/android/media/tv/tuner/frontend/ScanCallback.java b/media/java/android/media/tv/tuner/frontend/ScanCallback.java
index 8105c74..63bc248 100644
--- a/media/java/android/media/tv/tuner/frontend/ScanCallback.java
+++ b/media/java/android/media/tv/tuner/frontend/ScanCallback.java
@@ -53,7 +53,7 @@
     void onInputStreamIds(@NonNull int[] inputStreamIds);
 
     /** Locked signal standard for DVBS. */
-    void onDvbsStandard(@DvbsFrontendSettings.Standard int dvbsStandandard);
+    void onDvbsStandard(@DvbsFrontendSettings.Standard int dvbsStandard);
 
     /** Locked signal standard. for DVBT */
     void onDvbtStandard(@DvbtFrontendSettings.Standard int dvbtStandard);
diff --git a/media/java/android/media/tv/tunerresourcemanager/Android.bp b/media/java/android/media/tv/tunerresourcemanager/Android.bp
new file mode 100644
index 0000000..c65d25a
--- /dev/null
+++ b/media/java/android/media/tv/tunerresourcemanager/Android.bp
@@ -0,0 +1,17 @@
+filegroup {
+    name: "framework-media-tv-tunerresourcemanager-sources",
+    srcs: [
+        "*.java",
+        "*.aidl",
+    ],
+    path: ".",
+}
+
+java_library {
+    name: "framework-media-tv-trm-sources",
+    srcs: [":framework-media-tv-tunerresourcemanager-sources"],
+    installable: true,
+    visibility: [
+        "//frameworks/base",
+    ],
+}
\ No newline at end of file
diff --git a/media/java/android/media/tv/tuner/CasSessionRequest.aidl b/media/java/android/media/tv/tunerresourcemanager/CasSessionRequest.aidl
similarity index 93%
rename from media/java/android/media/tv/tuner/CasSessionRequest.aidl
rename to media/java/android/media/tv/tunerresourcemanager/CasSessionRequest.aidl
index 3dbf3d8..c918d88 100644
--- a/media/java/android/media/tv/tuner/CasSessionRequest.aidl
+++ b/media/java/android/media/tv/tunerresourcemanager/CasSessionRequest.aidl
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package android.media.tv.tuner;
+package android.media.tv.tunerresourcemanager;
 
 /**
  * A wrapper of a cas session requests that contains all the request info of the client.
diff --git a/media/java/android/media/tv/tuner/CasSessionRequest.java b/media/java/android/media/tv/tunerresourcemanager/CasSessionRequest.java
similarity index 98%
rename from media/java/android/media/tv/tuner/CasSessionRequest.java
rename to media/java/android/media/tv/tunerresourcemanager/CasSessionRequest.java
index 0f6a885..59802ff 100644
--- a/media/java/android/media/tv/tuner/CasSessionRequest.java
+++ b/media/java/android/media/tv/tunerresourcemanager/CasSessionRequest.java
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package android.media.tv.tuner;
+package android.media.tv.tunerresourcemanager;
 
 import android.annotation.NonNull;
 import android.os.Parcel;
diff --git a/media/java/android/media/tv/tuner/ITunerResourceManagerListener.aidl b/media/java/android/media/tv/tunerresourcemanager/IResourcesReclaimListener.aidl
similarity index 82%
rename from media/java/android/media/tv/tuner/ITunerResourceManagerListener.aidl
rename to media/java/android/media/tv/tunerresourcemanager/IResourcesReclaimListener.aidl
index 557032c..1a4eb29 100644
--- a/media/java/android/media/tv/tuner/ITunerResourceManagerListener.aidl
+++ b/media/java/android/media/tv/tunerresourcemanager/IResourcesReclaimListener.aidl
@@ -14,20 +14,20 @@
  * limitations under the License.
  */
 
-package android.media.tv.tuner;
+package android.media.tv.tunerresourcemanager;
 
 /**
  * Interface to receive callbacks from ITunerResourceManager.
  *
  * @hide
  */
-oneway interface ITunerResourceManagerListener {
+oneway interface IResourcesReclaimListener {
     /*
      * TRM invokes this method when the client's resources need to be reclaimed.
      *
      * <p>This method is implemented in Tuner Framework to take the reclaiming
-     * actions. It's a synchonized call. TRM would wait on the call to finish
+     * actions. It's a synchronous call. TRM would wait on the call to finish
      * then grant the resource.
      */
-    void onResourcesReclaim();
+    void onReclaimResources();
 }
\ No newline at end of file
diff --git a/media/java/android/media/tv/tuner/ITunerResourceManager.aidl b/media/java/android/media/tv/tunerresourcemanager/ITunerResourceManager.aidl
similarity index 90%
rename from media/java/android/media/tv/tuner/ITunerResourceManager.aidl
rename to media/java/android/media/tv/tunerresourcemanager/ITunerResourceManager.aidl
index 758c689..20efaa1 100644
--- a/media/java/android/media/tv/tuner/ITunerResourceManager.aidl
+++ b/media/java/android/media/tv/tunerresourcemanager/ITunerResourceManager.aidl
@@ -14,14 +14,14 @@
  * limitations under the License.
  */
 
-package android.media.tv.tuner;
+package android.media.tv.tunerresourcemanager;
 
-import android.media.tv.tuner.CasSessionRequest;
-import android.media.tv.tuner.ITunerResourceManagerListener;
-import android.media.tv.tuner.ResourceClientProfile;
-import android.media.tv.tuner.TunerFrontendInfo;
-import android.media.tv.tuner.TunerFrontendRequest;
-import android.media.tv.tuner.TunerLnbRequest;
+import android.media.tv.tunerresourcemanager.CasSessionRequest;
+import android.media.tv.tunerresourcemanager.IResourcesReclaimListener;
+import android.media.tv.tunerresourcemanager.ResourceClientProfile;
+import android.media.tv.tunerresourcemanager.TunerFrontendInfo;
+import android.media.tv.tunerresourcemanager.TunerFrontendRequest;
+import android.media.tv.tunerresourcemanager.TunerLnbRequest;
 
 /**
  * Interface of the Tuner Resource Manager. It manages resources used by TV Tuners.
@@ -37,10 +37,10 @@
  * <ul>
  * <li>Tuner Java/MediaCas/TIF update resources of the current device with TRM.
  * <li>Client registers its profile through {@link #registerClientProfile(ResourceClientProfile,
- * ITunerResourceManagerListener, int[])}.
+ * IResourcesReclaimListener, int[])}.
  * <li>Client requests resources through request APIs.
  * <li>If the resource needs to be handed to a higher priority client from a lower priority
- * one, TRM calls ITunerResourceManagerListener registered by the lower priority client to release
+ * one, TRM calls IResourcesReclaimListener registered by the lower priority client to release
  * the resource.
  * <ul>
  *
@@ -53,13 +53,13 @@
      * <p>The profile contains information that can show the base priority score of the client.
      *
      * @param profile {@link ResourceClientProfile} profile of the current client
-     * @param listener {@link ITunerResourceManagerListener} a callback to
+     * @param listener {@link IResourcesReclaimListener} a callback to
      *                 reclaim clients' resources when needed.
      * @param clientId returns a clientId from the resource manager when the
      *                 the client registers its profile.
      */
     void registerClientProfile(in ResourceClientProfile profile,
-        ITunerResourceManagerListener listener, out int[] clientId);
+        IResourcesReclaimListener listener, out int[] clientId);
 
     /*
      * This API is used by the client to unregister their profile with the Tuner Resource manager.
@@ -119,7 +119,7 @@
      *
      * <li>If no Frontend is available but the current request info can show higher priority than
      * other uses of Frontend, the API will send
-     * {@link ITunerResourceManagerListener#onResourcesReclaim()} to the {@link Tuner}. Tuner would
+     * {@link IResourcesReclaimListener#onReclaimResources()} to the {@link Tuner}. Tuner would
      * handle the resource reclaim on the holder of lower priority and notify the holder of its
      * resource loss.
      *
@@ -157,7 +157,7 @@
      *
      * <li>If no Cas session is available but the current request info can show higher priority than
      * other uses of the sessions under the requested CAS system, the API will send
-     * {@link ITunerResourceManagerCallback#onResourcesReclaim()} to the {@link Tuner}. Tuner would
+     * {@link ITunerResourceManagerCallback#onReclaimResources()} to the {@link Tuner}. Tuner would
      * handle the resource reclaim on the holder of lower priority and notify the holder of its
      * resource loss.
      *
@@ -181,7 +181,7 @@
      * <li>If there is Lnb available, the API would send the id back.
      *
      * <li>If no Lnb is available but the current request has a higher priority than other uses of
-     * lnbs, the API will send {@link ITunerResourceManagerCallback#onResourcesReclaim()} to the
+     * lnbs, the API will send {@link ITunerResourceManagerCallback#onReclaimResources()} to the
      * {@link Tuner}. Tuner would handle the resource reclaim on the holder of lower priority and
      * notify the holder of its resource loss.
      *
diff --git a/media/java/android/media/tv/tunerresourcemanager/OWNER b/media/java/android/media/tv/tunerresourcemanager/OWNER
new file mode 100644
index 0000000..76b84d9
--- /dev/null
+++ b/media/java/android/media/tv/tunerresourcemanager/OWNER
@@ -0,0 +1,4 @@
+amyjojo@google.com
+nchalko@google.com
+quxiangfang@google.com
+shubang@google.com
\ No newline at end of file
diff --git a/media/java/android/media/tv/tuner/ResourceClientProfile.aidl b/media/java/android/media/tv/tunerresourcemanager/ResourceClientProfile.aidl
similarity index 94%
rename from media/java/android/media/tv/tuner/ResourceClientProfile.aidl
rename to media/java/android/media/tv/tunerresourcemanager/ResourceClientProfile.aidl
index da3c5c4..ed90c1d 100644
--- a/media/java/android/media/tv/tuner/ResourceClientProfile.aidl
+++ b/media/java/android/media/tv/tunerresourcemanager/ResourceClientProfile.aidl
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package android.media.tv.tuner;
+package android.media.tv.tunerresourcemanager;
 
 /**
  * A profile of a resource client. This profile is used to register the client info
diff --git a/media/java/android/media/tv/tuner/ResourceClientProfile.java b/media/java/android/media/tv/tunerresourcemanager/ResourceClientProfile.java
similarity index 98%
rename from media/java/android/media/tv/tuner/ResourceClientProfile.java
rename to media/java/android/media/tv/tunerresourcemanager/ResourceClientProfile.java
index e203135..6837244 100644
--- a/media/java/android/media/tv/tuner/ResourceClientProfile.java
+++ b/media/java/android/media/tv/tunerresourcemanager/ResourceClientProfile.java
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package android.media.tv.tuner;
+package android.media.tv.tunerresourcemanager;
 
 import android.annotation.NonNull;
 import android.os.Parcel;
diff --git a/media/java/android/media/tv/tuner/TunerFrontendInfo.aidl b/media/java/android/media/tv/tunerresourcemanager/TunerFrontendInfo.aidl
similarity index 93%
rename from media/java/android/media/tv/tuner/TunerFrontendInfo.aidl
rename to media/java/android/media/tv/tunerresourcemanager/TunerFrontendInfo.aidl
index 012e051..e649c2a 100644
--- a/media/java/android/media/tv/tuner/TunerFrontendInfo.aidl
+++ b/media/java/android/media/tv/tunerresourcemanager/TunerFrontendInfo.aidl
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package android.media.tv.tuner;
+package android.media.tv.tunerresourcemanager;
 
 /**
  * Simple container of the FrontendInfo struct defined in the TunerHAL 1.0 interface.
diff --git a/media/java/android/media/tv/tuner/TunerFrontendInfo.java b/media/java/android/media/tv/tunerresourcemanager/TunerFrontendInfo.java
similarity index 98%
rename from media/java/android/media/tv/tuner/TunerFrontendInfo.java
rename to media/java/android/media/tv/tunerresourcemanager/TunerFrontendInfo.java
index a62ecb3..8957c37 100644
--- a/media/java/android/media/tv/tuner/TunerFrontendInfo.java
+++ b/media/java/android/media/tv/tunerresourcemanager/TunerFrontendInfo.java
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package android.media.tv.tuner;
+package android.media.tv.tunerresourcemanager;
 
 import android.annotation.NonNull;
 import android.media.tv.tuner.frontend.FrontendSettings.Type;
diff --git a/media/java/android/media/tv/tuner/TunerFrontendRequest.aidl b/media/java/android/media/tv/tunerresourcemanager/TunerFrontendRequest.aidl
similarity index 93%
rename from media/java/android/media/tv/tuner/TunerFrontendRequest.aidl
rename to media/java/android/media/tv/tunerresourcemanager/TunerFrontendRequest.aidl
index 25c298f..5e48adc 100644
--- a/media/java/android/media/tv/tuner/TunerFrontendRequest.aidl
+++ b/media/java/android/media/tv/tunerresourcemanager/TunerFrontendRequest.aidl
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package android.media.tv.tuner;
+package android.media.tv.tunerresourcemanager;
 
 /**
  * Information required to request a Tuner Frontend.
diff --git a/media/java/android/media/tv/tuner/TunerFrontendRequest.java b/media/java/android/media/tv/tunerresourcemanager/TunerFrontendRequest.java
similarity index 98%
rename from media/java/android/media/tv/tuner/TunerFrontendRequest.java
rename to media/java/android/media/tv/tunerresourcemanager/TunerFrontendRequest.java
index 01a0a09..12f8032 100644
--- a/media/java/android/media/tv/tuner/TunerFrontendRequest.java
+++ b/media/java/android/media/tv/tunerresourcemanager/TunerFrontendRequest.java
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package android.media.tv.tuner;
+package android.media.tv.tunerresourcemanager;
 
 import android.annotation.NonNull;
 import android.media.tv.tuner.frontend.FrontendSettings.Type;
diff --git a/media/java/android/media/tv/tuner/TunerLnbRequest.aidl b/media/java/android/media/tv/tunerresourcemanager/TunerLnbRequest.aidl
similarity index 93%
rename from media/java/android/media/tv/tuner/TunerLnbRequest.aidl
rename to media/java/android/media/tv/tunerresourcemanager/TunerLnbRequest.aidl
index b811e39..0e6fcde 100644
--- a/media/java/android/media/tv/tuner/TunerLnbRequest.aidl
+++ b/media/java/android/media/tv/tunerresourcemanager/TunerLnbRequest.aidl
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package android.media.tv.tuner;
+package android.media.tv.tunerresourcemanager;
 
 /**
  * Information required to request a Tuner Lnb.
diff --git a/media/java/android/media/tv/tuner/TunerLnbRequest.java b/media/java/android/media/tv/tunerresourcemanager/TunerLnbRequest.java
similarity index 97%
rename from media/java/android/media/tv/tuner/TunerLnbRequest.java
rename to media/java/android/media/tv/tunerresourcemanager/TunerLnbRequest.java
index 60cd790..5ed7f3f 100644
--- a/media/java/android/media/tv/tuner/TunerLnbRequest.java
+++ b/media/java/android/media/tv/tunerresourcemanager/TunerLnbRequest.java
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package android.media.tv.tuner;
+package android.media.tv.tunerresourcemanager;
 
 import android.annotation.NonNull;
 import android.os.Parcel;
diff --git a/media/java/android/media/tv/tuner/TunerResourceManager.java b/media/java/android/media/tv/tunerresourcemanager/TunerResourceManager.java
similarity index 93%
rename from media/java/android/media/tv/tuner/TunerResourceManager.java
rename to media/java/android/media/tv/tunerresourcemanager/TunerResourceManager.java
index 68ca572..7c11ed4 100644
--- a/media/java/android/media/tv/tuner/TunerResourceManager.java
+++ b/media/java/android/media/tv/tunerresourcemanager/TunerResourceManager.java
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package android.media.tv.tuner;
+package android.media.tv.tunerresourcemanager;
 
 import android.annotation.CallbackExecutor;
 import android.annotation.NonNull;
@@ -42,10 +42,10 @@
  * <ul>
  * <li>Tuner Java/MediaCas/TIF update resources of the current device with TRM.
  * <li>Client registers its profile through {@link #registerClientProfile(ResourceClientProfile,
- * Executor, ResourceListener, int[])}.
+ * Executor, ResourcesReclaimListener, int[])}.
  * <li>Client requests resources through request APIs.
  * <li>If the resource needs to be handed to a higher priority client from a lower priority
- * one, TRM calls ITunerResourceManagerListener registered by the lower priority client to release
+ * one, TRM calls IResourcesReclaimListener registered by the lower priority client to release
  * the resource.
  * <ul>
  *
@@ -85,25 +85,26 @@
      * @param profile {@link ResourceClientProfile} profile of the current client. Undefined use
      *                case would cause IllegalArgumentException.
      * @param executor the executor on which the listener would be invoked.
-     * @param listener {@link ResourceListener} callback to reclaim clients' resources when needed.
+     * @param listener {@link ResourcesReclaimListener} callback to reclaim clients' resources when
+     *                 needed.
      * @param clientId returned a clientId from the resource manager when the
      *                 the client registeres.
      * @throws IllegalArgumentException when {@code profile} contains undefined use case.
      */
     public void registerClientProfile(@NonNull ResourceClientProfile profile,
                         @NonNull @CallbackExecutor Executor executor,
-                        @NonNull ResourceListener listener,
+                        @NonNull ResourcesReclaimListener listener,
                         @NonNull int[] clientId) {
         // TODO: throw new IllegalArgumentException("Unknown client use case")
         // when the use case is not defined.
         try {
             mService.registerClientProfile(profile,
-                    new ITunerResourceManagerListener.Stub() {
+                    new IResourcesReclaimListener.Stub() {
                     @Override
-                public void onResourcesReclaim() {
+                public void onReclaimResources() {
                         final long identity = Binder.clearCallingIdentity();
                         try {
-                            executor.execute(() -> listener.onResourcesReclaim());
+                            executor.execute(() -> listener.onReclaimResources());
                         } finally {
                             Binder.restoreCallingIdentity(identity);
                         }
@@ -214,7 +215,7 @@
      *
      * <li>If no Frontend is available but the current request info can show higher priority than
      * other uses of Frontend, the API will send
-     * {@link ITunerResourceManagerListener#onResourcesReclaim()} to the {@link Tuner}. Tuner would
+     * {@link IResourcesReclaimListener#onReclaimResources()} to the {@link Tuner}. Tuner would
      * handle the resource reclaim on the holder of lower priority and notify the holder of its
      * resource loss.
      *
@@ -267,7 +268,7 @@
      *
      * <li>If no Cas system is available but the current request info can show higher priority than
      * other uses of the cas sessions under the requested cas system, the API will send
-     * {@link ITunerResourceManagerListener#onResourcesReclaim()} to the {@link Tuner}. Tuner would
+     * {@link IResourcesReclaimListener#onReclaimResources()} to the {@link Tuner}. Tuner would
      * handle the resource reclaim on the holder of lower priority and notify the holder of its
      * resource loss.
      *
@@ -300,7 +301,7 @@
      * <li>If there is Lnb available, the API would send the id back.
      *
      * <li>If no Lnb is available but the current request has a higher priority than other uses of
-     * lnbs, the API will send {@link ITunerResourceManagerListener#onResourcesReclaim()} to the
+     * lnbs, the API will send {@link IResourcesReclaimListener#onReclaimResources()} to the
      * {@link Tuner}. Tuner would handle the resource reclaim on the holder of lower priority and
      * notify the holder of its resource loss.
      *
@@ -398,10 +399,10 @@
     /**
      * Interface used to receive events from TunerResourceManager.
      */
-    public abstract static class ResourceListener {
+    public abstract static class ResourcesReclaimListener {
         /*
          * To reclaim all the resources of the callack owner.
          */
-        public abstract void onResourcesReclaim();
+        public abstract void onReclaimResources();
     }
 }
diff --git a/media/tests/TunerTest/src/com/android/mediatunertest/TunerTest.java b/media/tests/TunerTest/src/com/android/mediatunertest/TunerTest.java
index cbfbf77..afdbce0 100644
--- a/media/tests/TunerTest/src/com/android/mediatunertest/TunerTest.java
+++ b/media/tests/TunerTest/src/com/android/mediatunertest/TunerTest.java
@@ -48,13 +48,13 @@
 
     @Test
     public void testTunerConstructor() throws Exception {
-        Tuner tuner = new Tuner(mContext, "123", 1, null);
+        Tuner tuner = new Tuner(mContext, "123", 1);
         assertNotNull(tuner);
     }
 
     @Test
     public void testOpenDescrambler() throws Exception {
-        Tuner tuner = new Tuner(mContext, "123", 1, null);
+        Tuner tuner = new Tuner(mContext, "123", 1);
         Descrambler descrambler = tuner.openDescrambler();
         assertNotNull(descrambler);
     }
diff --git a/native/android/surface_control.cpp b/native/android/surface_control.cpp
index ba793e8..0af6cbf 100644
--- a/native/android/surface_control.cpp
+++ b/native/android/surface_control.cpp
@@ -547,16 +547,11 @@
 }
 
 void ASurfaceTransaction_setFrameRate(ASurfaceTransaction* aSurfaceTransaction,
-                                      ASurfaceControl* aSurfaceControl, float frameRate) {
+                                      ASurfaceControl* aSurfaceControl, float frameRate,
+                                      int8_t compatibility) {
     CHECK_NOT_NULL(aSurfaceTransaction);
     CHECK_NOT_NULL(aSurfaceControl);
-
-    sp<SurfaceControl> surfaceControl = ASurfaceControl_to_SurfaceControl(aSurfaceControl);
-    if (frameRate < 0) {
-        ALOGE("Failed to set frame ate - invalid frame rate");
-        return;
-    }
-
     Transaction* transaction = ASurfaceTransaction_to_Transaction(aSurfaceTransaction);
-    transaction->setFrameRate(surfaceControl, frameRate);
+    sp<SurfaceControl> surfaceControl = ASurfaceControl_to_SurfaceControl(aSurfaceControl);
+    transaction->setFrameRate(surfaceControl, frameRate, compatibility);
 }
diff --git a/packages/CarSystemUI/src/com/android/systemui/CarSystemUIModule.java b/packages/CarSystemUI/src/com/android/systemui/CarSystemUIModule.java
index 585acfe..a0d5a1b 100644
--- a/packages/CarSystemUI/src/com/android/systemui/CarSystemUIModule.java
+++ b/packages/CarSystemUI/src/com/android/systemui/CarSystemUIModule.java
@@ -43,9 +43,11 @@
 import com.android.systemui.statusbar.phone.HeadsUpManagerPhone;
 import com.android.systemui.statusbar.phone.KeyguardBypassController;
 import com.android.systemui.statusbar.phone.KeyguardEnvironmentImpl;
+import com.android.systemui.statusbar.phone.NotificationGroupManager;
 import com.android.systemui.statusbar.phone.ShadeController;
 import com.android.systemui.statusbar.phone.StatusBar;
 import com.android.systemui.statusbar.phone.StatusBarKeyguardViewManager;
+import com.android.systemui.statusbar.policy.ConfigurationController;
 import com.android.systemui.statusbar.policy.DeviceProvisionedController;
 import com.android.systemui.statusbar.policy.HeadsUpManager;
 import com.android.systemui.volume.CarVolumeDialogComponent;
@@ -74,10 +76,14 @@
 
     @Singleton
     @Provides
-    static HeadsUpManagerPhone provideHeadsUpManagerPhone(Context context,
+    static HeadsUpManagerPhone provideHeadsUpManagerPhone(
+            Context context,
             StatusBarStateController statusBarStateController,
-            KeyguardBypassController bypassController) {
-        return new HeadsUpManagerPhone(context, statusBarStateController, bypassController);
+            KeyguardBypassController bypassController,
+            NotificationGroupManager groupManager,
+            ConfigurationController configurationController) {
+        return new HeadsUpManagerPhone(context, statusBarStateController, bypassController,
+                groupManager, configurationController);
     }
 
     @Binds
diff --git a/packages/CarSystemUI/src/com/android/systemui/statusbar/car/CarStatusBar.java b/packages/CarSystemUI/src/com/android/systemui/statusbar/car/CarStatusBar.java
index 5af3ad5..a4eada4 100644
--- a/packages/CarSystemUI/src/com/android/systemui/statusbar/car/CarStatusBar.java
+++ b/packages/CarSystemUI/src/com/android/systemui/statusbar/car/CarStatusBar.java
@@ -128,6 +128,7 @@
 import com.android.systemui.statusbar.phone.StatusBarIconController;
 import com.android.systemui.statusbar.phone.StatusBarKeyguardViewManager;
 import com.android.systemui.statusbar.phone.StatusBarNotificationActivityStarter;
+import com.android.systemui.statusbar.phone.StatusBarTouchableRegionManager;
 import com.android.systemui.statusbar.phone.dagger.StatusBarComponent;
 import com.android.systemui.statusbar.policy.BatteryController;
 import com.android.systemui.statusbar.policy.ConfigurationController;
@@ -324,6 +325,7 @@
             ExtensionController extensionController,
             UserInfoControllerImpl userInfoControllerImpl,
             DismissCallbackRegistry dismissCallbackRegistry,
+            StatusBarTouchableRegionManager statusBarTouchableRegionManager,
             /* Car Settings injected components. */
             CarServiceProvider carServiceProvider,
             Lazy<PowerManagerHelper> powerManagerHelperLazy,
@@ -405,7 +407,8 @@
                 keyguardDismissUtil,
                 extensionController,
                 userInfoControllerImpl,
-                dismissCallbackRegistry);
+                dismissCallbackRegistry,
+                statusBarTouchableRegionManager);
         mUserSwitcherController = userSwitcherController;
         mScrimController = scrimController;
         mLockscreenLockIconController = lockscreenLockIconController;
diff --git a/packages/CarSystemUI/src/com/android/systemui/statusbar/car/CarStatusBarModule.java b/packages/CarSystemUI/src/com/android/systemui/statusbar/car/CarStatusBarModule.java
index 7f64990..7294965 100644
--- a/packages/CarSystemUI/src/com/android/systemui/statusbar/car/CarStatusBarModule.java
+++ b/packages/CarSystemUI/src/com/android/systemui/statusbar/car/CarStatusBarModule.java
@@ -87,6 +87,7 @@
 import com.android.systemui.statusbar.phone.StatusBarIconController;
 import com.android.systemui.statusbar.phone.StatusBarKeyguardViewManager;
 import com.android.systemui.statusbar.phone.StatusBarNotificationActivityStarter;
+import com.android.systemui.statusbar.phone.StatusBarTouchableRegionManager;
 import com.android.systemui.statusbar.phone.dagger.StatusBarComponent;
 import com.android.systemui.statusbar.phone.dagger.StatusBarPhoneDependenciesModule;
 import com.android.systemui.statusbar.policy.BatteryController;
@@ -197,6 +198,7 @@
             ExtensionController extensionController,
             UserInfoControllerImpl userInfoControllerImpl,
             DismissCallbackRegistry dismissCallbackRegistry,
+            StatusBarTouchableRegionManager statusBarTouchableRegionManager,
             CarServiceProvider carServiceProvider,
             Lazy<PowerManagerHelper> powerManagerHelperLazy,
             FullscreenUserSwitcher fullscreenUserSwitcher,
@@ -277,6 +279,7 @@
                 extensionController,
                 userInfoControllerImpl,
                 dismissCallbackRegistry,
+                statusBarTouchableRegionManager,
                 carServiceProvider,
                 powerManagerHelperLazy,
                 fullscreenUserSwitcher,
diff --git a/packages/OsuLogin/AndroidManifest.xml b/packages/OsuLogin/AndroidManifest.xml
index 123559a..a428cb3 100644
--- a/packages/OsuLogin/AndroidManifest.xml
+++ b/packages/OsuLogin/AndroidManifest.xml
@@ -17,7 +17,7 @@
  */
 -->
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
-          package="com.android.hotspot2">
+          package="com.android.hotspot2.osulogin">
     <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
     <uses-permission android:name="android.permission.CHANGE_WIFI_STATE"/>
     <uses-permission android:name="android.permission.INTERNET"/>
@@ -28,7 +28,7 @@
         android:label="@string/app_name"
         android:configChanges="keyboardHidden|orientation|screenSize"
         android:supportsRtl="true">
-        <activity android:name="com.android.hotspot2.osu.OsuLoginActivity"
+        <activity android:name="com.android.hotspot2.osulogin.OsuLoginActivity"
                   android:label="@string/action_bar_label"
                   android:theme="@style/AppTheme"
                   android:configChanges="keyboardHidden|orientation|screenSize">
diff --git a/packages/OsuLogin/res/layout/osu_web_view.xml b/packages/OsuLogin/res/layout/osu_web_view.xml
index fb3c065..4436aab 100644
--- a/packages/OsuLogin/res/layout/osu_web_view.xml
+++ b/packages/OsuLogin/res/layout/osu_web_view.xml
@@ -3,7 +3,7 @@
              android:id="@+id/container"
              android:layout_width="match_parent"
              android:layout_height="match_parent"
-             tools:context="com.android.hotspot2.osu.OsuLoginActivity">
+             tools:context="com.android.hotspot2.osulogin.OsuLoginActivity">
     <LinearLayout
         android:layout_width="match_parent"
         android:layout_height="match_parent"
diff --git a/packages/OsuLogin/src/com/android/hotspot2/osu/OsuLoginActivity.java b/packages/OsuLogin/src/com/android/hotspot2/osulogin/OsuLoginActivity.java
similarity index 98%
rename from packages/OsuLogin/src/com/android/hotspot2/osu/OsuLoginActivity.java
rename to packages/OsuLogin/src/com/android/hotspot2/osulogin/OsuLoginActivity.java
index 3a994d7..d554745 100644
--- a/packages/OsuLogin/src/com/android/hotspot2/osu/OsuLoginActivity.java
+++ b/packages/OsuLogin/src/com/android/hotspot2/osulogin/OsuLoginActivity.java
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package com.android.hotspot2.osu;
+package com.android.hotspot2.osulogin;
 
 import static android.net.NetworkCapabilities.NET_CAPABILITY_TRUSTED;
 
@@ -42,8 +42,6 @@
 
 import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
 
-import com.android.hotspot2.R;
-
 import java.net.MalformedURLException;
 import java.net.URL;
 
@@ -194,7 +192,7 @@
         // Check if the key event was the Back button.
         if ((keyCode == KeyEvent.KEYCODE_BACK)) {
             // If there is a history to move back
-            if (mWebView.canGoBack()){
+            if (mWebView.canGoBack()) {
                 mWebView.goBack();
                 return true;
             }
@@ -278,6 +276,6 @@
                 mPageError = true;
                 Log.e(TAG, "onReceived Error for MainFrame: " + error.getErrorCode());
             }
-         }
+        }
     }
 }
diff --git a/packages/SettingsLib/res/values-af/strings.xml b/packages/SettingsLib/res/values-af/strings.xml
index 1a015a6..762053e 100644
--- a/packages/SettingsLib/res/values-af/strings.xml
+++ b/packages/SettingsLib/res/values-af/strings.xml
@@ -206,6 +206,33 @@
     <string name="enable_adb" msgid="8072776357237289039">"USB-ontfouting"</string>
     <string name="enable_adb_summary" msgid="3711526030096574316">"In ontfoutmodus wanneer USB gekoppel is"</string>
     <string name="clear_adb_keys" msgid="3010148733140369917">"Herroep USB-onfoutingmagtigings"</string>
+    <string name="enable_adb_wireless" msgid="6973226350963971018">"Draadlose ontfouting"</string>
+    <string name="enable_adb_wireless_summary" msgid="7344391423657093011">"Ontfoutingmodus wanneer Wi-Fi gekoppel is"</string>
+    <string name="adb_wireless_error" msgid="721958772149779856">"Fout"</string>
+    <string name="adb_wireless_settings" msgid="2295017847215680229">"Draadlose ontfouting"</string>
+    <string name="adb_wireless_list_empty_off" msgid="1713707973837255490">"Skakel draadlose ontfouting aan om beskikbare toestelle te sien en te gebruik"</string>
+    <string name="adb_pair_method_qrcode_title" msgid="6982904096137468634">"Gebruik QR-kode om toestel saam te bind"</string>
+    <string name="adb_pair_method_qrcode_summary" msgid="3729901496856458634">"Gebruik QR-kodeskandeerder om nuwe toestelle saam te bind"</string>
+    <string name="adb_pair_method_code_title" msgid="1122590300445142904">"Gebruik saambindkode om toestel saam te bind"</string>
+    <string name="adb_pair_method_code_summary" msgid="6370414511333685185">"Gebruik \'n sessyferkode om nuwe toestelle saam te bind"</string>
+    <string name="adb_paired_devices_title" msgid="5268997341526217362">"Saamgebinde toestelle"</string>
+    <string name="adb_wireless_device_connected_summary" msgid="3039660790249148713">"Tans gekoppel"</string>
+    <string name="adb_wireless_device_details_title" msgid="7129369670526565786">"Toestelbesonderhede"</string>
+    <string name="adb_device_forget" msgid="193072400783068417">"Vergeet"</string>
+    <string name="adb_device_fingerprint_title_format" msgid="291504822917843701">"Toestelvingerafdruk: <xliff:g id="FINGERPRINT_PARAM">%1$s</xliff:g>"</string>
+    <string name="adb_wireless_connection_failed_title" msgid="664211177427438438">"Kon nie koppel nie"</string>
+    <string name="adb_wireless_connection_failed_message" msgid="9213896700171602073">"Maak seker dat <xliff:g id="DEVICE_NAME">%1$s</xliff:g> aan die regte netwerk gekoppel is"</string>
+    <string name="adb_pairing_device_dialog_title" msgid="7141739231018530210">"Bind met toestel saam"</string>
+    <string name="adb_pairing_device_dialog_pairing_code_label" msgid="3639239786669722731">"Wi‑Fi-saambindkode"</string>
+    <string name="adb_pairing_device_dialog_failed_title" msgid="3426758947882091735">"Kon nie saambind nie"</string>
+    <string name="adb_pairing_device_dialog_failed_msg" msgid="6611097519661997148">"Maak seker dat die toestel aan dieselfde netwerk gekoppel is."</string>
+    <string name="adb_wireless_qrcode_summary" msgid="8051414549011801917">"Bind toestel oor Wi-Fi saam deur \'n QR-kode te skandeer"</string>
+    <string name="adb_wireless_verifying_qrcode_text" msgid="6123192424916029207">"Bind tans toestel saam …"</string>
+    <string name="adb_qrcode_pairing_device_failed_msg" msgid="6936292092592914132">"Kon nie die toestel saambind nie. Óf die QR-kode is verkeerd, óf die toestel is nie aan dieselfde netwerk gekoppel nie."</string>
+    <string name="adb_wireless_ip_addr_preference_title" msgid="8335132107715311730">"IP-adres en -poort"</string>
+    <string name="adb_wireless_qrcode_pairing_title" msgid="1906409667944674707">"Skandeer QR-kode"</string>
+    <string name="adb_wireless_qrcode_pairing_description" msgid="8578868049289910131">"Bind toestel oor Wi-Fi saam deur \'n QR-kode te skandeer"</string>
+    <string name="keywords_adb_wireless" msgid="6507505581882171240">"adb, debug, dev"</string>
     <string name="bugreport_in_power" msgid="8664089072534638709">"Kortpad na foutverslag"</string>
     <string name="bugreport_in_power_summary" msgid="1885529649381831775">"Wys \'n knoppie in die kragkieslys om \'n foutverslag te doen"</string>
     <string name="keep_screen_on" msgid="1187161672348797558">"Bly wakker"</string>
@@ -271,6 +298,8 @@
     <string name="tethering_hardware_offload_summary" msgid="7801345335142803029">"Gebruik hardewareversnelling vir verbinding indien beskikbaar"</string>
     <string name="adb_warning_title" msgid="7708653449506485728">"Laat USB-ontfouting toe?"</string>
     <string name="adb_warning_message" msgid="8145270656419669221">"USB-ontfouting is net vir ontwikkelingsdoeleindes bedoel. Gebruik dit om data te kopieer tussen jou rekenaar en jou toestel, programme op jou toestel te installeer sonder kennisgewing en om loglêerdata te lees."</string>
+    <string name="adbwifi_warning_title" msgid="727104571653031865">"Laat draadlose ontfouting toe?"</string>
+    <string name="adbwifi_warning_message" msgid="8005936574322702388">"Draadlose ontfouting is net vir ontwikkelingsdoeleindes bedoel. Gebruik dit om data te kopieer tussen jou rekenaar en jou toestel, programme op jou toestel te installeer sonder kennisgewing, en loglêerdata te lees."</string>
     <string name="adb_keys_warning_message" msgid="2968555274488101220">"Herroep toegang tot USB-ontfouting vanaf alle rekenaars wat jy voorheen gemagtig het?"</string>
     <string name="dev_settings_warning_title" msgid="8251234890169074553">"Laat ontwikkeling-instellings toe?"</string>
     <string name="dev_settings_warning_message" msgid="37741686486073668">"Hierdie instellings is bedoel net vir ontwikkelinggebruik. Dit kan jou toestel en die programme daarop breek of vreemde dinge laat doen."</string>
@@ -383,8 +412,7 @@
     <string name="daltonizer_mode_protanomaly" msgid="7805583306666608440">"Protanomalie (rooi-groen)"</string>
     <string name="daltonizer_mode_tritanomaly" msgid="7135266249220732267">"Tritanomalie (blou-geel)"</string>
     <string name="accessibility_display_daltonizer_preference_title" msgid="1810693571332381974">"Kleurregstelling"</string>
-    <!-- no translation found for accessibility_display_daltonizer_preference_subtitle (6178138727195403796) -->
-    <skip />
+    <string name="accessibility_display_daltonizer_preference_subtitle" msgid="6178138727195403796">"Kleurregstelling help mense met kleurblindheid om akkurater kleure te sien"</string>
     <string name="daltonizer_type_overridden" msgid="4509604753672535721">"Geneutraliseer deur <xliff:g id="TITLE">%1$s</xliff:g>"</string>
     <string name="power_remaining_settings_home_page" msgid="4885165789445462557">"<xliff:g id="PERCENTAGE">%1$s</xliff:g> – <xliff:g id="TIME_STRING">%2$s</xliff:g>"</string>
     <string name="power_remaining_duration_only" msgid="8264199158671531431">"Ongeveer <xliff:g id="TIME_REMAINING">%1$s</xliff:g> oor"</string>
@@ -403,21 +431,19 @@
     <string name="power_remaining_less_than_duration" msgid="1812668275239801236">"Minder as <xliff:g id="THRESHOLD">%1$s</xliff:g> oor (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_more_than_subtext" msgid="7919119719242734848">"Meer as <xliff:g id="TIME_REMAINING">%1$s</xliff:g> oor (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_only_more_than_subtext" msgid="3274496164769110480">"Meer as <xliff:g id="TIME_REMAINING">%1$s</xliff:g> oor"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="6583866940347159957">"Foon kan binnekort afgaan"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="8009177999719462724">"Tablet kan binnekort afgaan"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="8320892540455268018">"Toestel kan binnekort afgaan"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="6186572170809116621">"Foon kan binnekort afgaan (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="1338758278145563121">"Tablet kan binnekort afgaan (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="3699579688084774362">"Toestel kan binnekort afgaan (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="137330009791560774">"Foon sal dalk binnekort afgaan"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="145489081521468132">"Tablet sal dalk binnekort afgaan"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="1070562682853942350">"Toestel sal dalk binnekort afgaan"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="4429259621177089719">"Foon sal dalk binnekort afgaan (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="7703677921000858479">"Tablet sal dalk binnekort afgaan (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="4374784375644214578">"Toestel sal dalk binnekort afgaan (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
     <string name="power_charging" msgid="6727132649743436802">"<xliff:g id="LEVEL">%1$s</xliff:g> – <xliff:g id="STATE">%2$s</xliff:g>"</string>
     <string name="power_remaining_charging_duration_only" msgid="7415639699283965818">"<xliff:g id="TIME">%1$s</xliff:g> oor tot battery gelaai is"</string>
     <string name="power_charging_duration" msgid="5005740040558984057">"<xliff:g id="LEVEL">%1$s</xliff:g> – <xliff:g id="TIME">%2$s</xliff:g> tot battery gelaai is"</string>
     <string name="battery_info_status_unknown" msgid="268625384868401114">"Onbekend"</string>
     <string name="battery_info_status_charging" msgid="4279958015430387405">"Laai"</string>
-    <!-- no translation found for battery_info_status_charging_fast (8027559755902954885) -->
-    <skip />
-    <!-- no translation found for battery_info_status_charging_slow (3190803837168962319) -->
-    <skip />
+    <string name="battery_info_status_charging_fast" msgid="8027559755902954885">"Laai tans vinnig"</string>
+    <string name="battery_info_status_charging_slow" msgid="3190803837168962319">"Laai tans stadig"</string>
     <string name="battery_info_status_discharging" msgid="6962689305413556485">"Laai nie"</string>
     <string name="battery_info_status_not_charging" msgid="8330015078868707899">"Ingeprop; kan nie op die oomblik laai nie"</string>
     <string name="battery_info_status_full" msgid="4443168946046847468">"Vol"</string>
diff --git a/packages/SettingsLib/res/values-am/strings.xml b/packages/SettingsLib/res/values-am/strings.xml
index 05f0e1b..3e6886c 100644
--- a/packages/SettingsLib/res/values-am/strings.xml
+++ b/packages/SettingsLib/res/values-am/strings.xml
@@ -206,6 +206,33 @@
     <string name="enable_adb" msgid="8072776357237289039">"የUSB አራሚ"</string>
     <string name="enable_adb_summary" msgid="3711526030096574316">"USB ሲያያዝ የአርም ሁኔታ"</string>
     <string name="clear_adb_keys" msgid="3010148733140369917">"የዩ ኤስ ቢ ስህተት ማረም ፈቀዳዎችን ይሻሩ"</string>
+    <string name="enable_adb_wireless" msgid="6973226350963971018">"ገመድ-አልባ ማረም"</string>
+    <string name="enable_adb_wireless_summary" msgid="7344391423657093011">"Wi-Fi ሲገናኝ የማረም ሁነታ"</string>
+    <string name="adb_wireless_error" msgid="721958772149779856">"ስህተት"</string>
+    <string name="adb_wireless_settings" msgid="2295017847215680229">"ገመድ-አልባ ማረም"</string>
+    <string name="adb_wireless_list_empty_off" msgid="1713707973837255490">"የሚገኙ መሣሪያዎችን ለመመልከትና ለመጠቀም ገመድ-አልባ ማረምን ያብሩ"</string>
+    <string name="adb_pair_method_qrcode_title" msgid="6982904096137468634">"የQR ኮድን በመጠቀም መሣሪያን ያጣምሩ"</string>
+    <string name="adb_pair_method_qrcode_summary" msgid="3729901496856458634">"የQR ኮድ መቃኛን በመጠቀም አዲስ መሣሪያዎችን ያጣምሩ"</string>
+    <string name="adb_pair_method_code_title" msgid="1122590300445142904">"የማጣመሪያ ኮድን በመጠቀም መሣሪያን ያጣምሩ"</string>
+    <string name="adb_pair_method_code_summary" msgid="6370414511333685185">"የስድስት አኃዝ ኮድ በመጠቀም አዲስ መሣሪያዎችን ያጣምሩ"</string>
+    <string name="adb_paired_devices_title" msgid="5268997341526217362">"የተጣመሩ መሣሪያዎች"</string>
+    <string name="adb_wireless_device_connected_summary" msgid="3039660790249148713">"አሁን ላይ ተገናኝቷል"</string>
+    <string name="adb_wireless_device_details_title" msgid="7129369670526565786">"የመሣሪያ ዝርዝሮች"</string>
+    <string name="adb_device_forget" msgid="193072400783068417">"እርሳ"</string>
+    <string name="adb_device_fingerprint_title_format" msgid="291504822917843701">"የመሣሪያ አሻራ፦ <xliff:g id="FINGERPRINT_PARAM">%1$s</xliff:g>"</string>
+    <string name="adb_wireless_connection_failed_title" msgid="664211177427438438">"ግንኙነት አልተሳካም"</string>
+    <string name="adb_wireless_connection_failed_message" msgid="9213896700171602073">"<xliff:g id="DEVICE_NAME">%1$s</xliff:g> ከትክክለኛው አውታረ መረብ ጋር መገናኘቱን ያረጋግጡ"</string>
+    <string name="adb_pairing_device_dialog_title" msgid="7141739231018530210">"በመሣሪያ ያጣምሩ"</string>
+    <string name="adb_pairing_device_dialog_pairing_code_label" msgid="3639239786669722731">"የWi-Fi ማጣመሪያ ኮድ"</string>
+    <string name="adb_pairing_device_dialog_failed_title" msgid="3426758947882091735">"ማጣመር ተሳክቷል"</string>
+    <string name="adb_pairing_device_dialog_failed_msg" msgid="6611097519661997148">"መሣሪያው ከተመሳሳዩ አውታረ መረብ ጋር መገናኘቱን ያረጋግጡ።"</string>
+    <string name="adb_wireless_qrcode_summary" msgid="8051414549011801917">"የQR ኮድ በመጠቀም መሣሪያን በመቃኘት በWi-Fi ላይ ያጣምሩ"</string>
+    <string name="adb_wireless_verifying_qrcode_text" msgid="6123192424916029207">"መሣሪያን በማጣመር ላይ…"</string>
+    <string name="adb_qrcode_pairing_device_failed_msg" msgid="6936292092592914132">"መሣሪያውን ማጣመር አልተሳካም። ወይም QR ኮዱ ትክክል አልነበረም፣ ወይም መሣሪያው ከተመሳሳዩ አውታረ መረብ ጋር አልተገናኘም።"</string>
+    <string name="adb_wireless_ip_addr_preference_title" msgid="8335132107715311730">"የአይፒ አድራሻ እና ወደብ"</string>
+    <string name="adb_wireless_qrcode_pairing_title" msgid="1906409667944674707">"QR ኮድን ይቃኙ"</string>
+    <string name="adb_wireless_qrcode_pairing_description" msgid="8578868049289910131">"የQR ኮድ በመጠቀም መሣሪያን በመቃኘት በWi-Fi ላይ ያጣምሩ"</string>
+    <string name="keywords_adb_wireless" msgid="6507505581882171240">"adb፣ ማረም፣ ግንባታ"</string>
     <string name="bugreport_in_power" msgid="8664089072534638709">"የሳንካ ሪፖርት አቋራጭ"</string>
     <string name="bugreport_in_power_summary" msgid="1885529649381831775">"የሳንካ ሪፖርት ለመውሰድ በሃይል ምናሌ ውስጥ አዝራር አሳይ"</string>
     <string name="keep_screen_on" msgid="1187161672348797558">"ነቅተህ ቆይ"</string>
@@ -271,6 +298,8 @@
     <string name="tethering_hardware_offload_summary" msgid="7801345335142803029">"የሃርድዌር ማቀላጠፊያን ማስተሳሰርን የሚገኝ ከሆነ ይጠቀሙ"</string>
     <string name="adb_warning_title" msgid="7708653449506485728">"የUSB ማረሚያ ይፈቀድ?"</string>
     <string name="adb_warning_message" msgid="8145270656419669221">"የUSB አድስ ለግንባታ አላማ ብቻ የታሰበ ነው። ከኮምፒዩተርህ ወደ መሳሪያህ ውሂብ ለመገልበጥ፣ መሣሪያህ ላይ ያለ ማሳወቂያ መተግበሪያዎችን መጫን፣ እና ማስታወሻ ውሂብ ማንበብ ለመጠቀም ይቻላል።"</string>
+    <string name="adbwifi_warning_title" msgid="727104571653031865">"ገመድ-አልባ ማረም ይፈቀድ?"</string>
+    <string name="adbwifi_warning_message" msgid="8005936574322702388">"ገመድ-አልባ ማረም ለግንባታ አላማዎች ብቻ የታሰበ ነው። ውሂብን ከኮምፒዩተርዎ ወደ መሳሪያዎ ለመቅዳት፣ መሣሪያዎ ላይ ያለማሳወቂያ መተግበሪያዎችን ለመጫን እና የምዝግብ ማስታወሻ ውሂብን ለማንበብ ይጠቀሙበት።"</string>
     <string name="adb_keys_warning_message" msgid="2968555274488101220">"የዩ ኤስ ቢ ማረም መዳረሻ ከዚህ ቀደም ፍቃድ ከሰጧቸው ኮምፒውተሮች ላይ ይሻሩ?"</string>
     <string name="dev_settings_warning_title" msgid="8251234890169074553">"የግንባታ ቅንብሮችን ፍቀድ?"</string>
     <string name="dev_settings_warning_message" msgid="37741686486073668">"እነዚህ ቅንብሮች  የታሰቡት ለግንባታ አጠቃቀም ብቻ ናቸው። መሳሪያህን እና በሱ ላይ ያሉትን መተግበሪያዎች እንዲበለሹ ወይም በትክክል እንዳይሰሩ ሊያደርጉ ይችላሉ።"</string>
@@ -383,8 +412,7 @@
     <string name="daltonizer_mode_protanomaly" msgid="7805583306666608440">"ፕሮታኖማሊ (ቀይ-አረንጓዴ)"</string>
     <string name="daltonizer_mode_tritanomaly" msgid="7135266249220732267">"ትራይታኖማሊ (ሰማያዊ-ቢጫ)"</string>
     <string name="accessibility_display_daltonizer_preference_title" msgid="1810693571332381974">"የቀለም ማስተካከያ"</string>
-    <!-- no translation found for accessibility_display_daltonizer_preference_subtitle (6178138727195403796) -->
-    <skip />
+    <string name="accessibility_display_daltonizer_preference_subtitle" msgid="6178138727195403796">"ቀለም ማስተካከያ ቀለም ማየት የማይችሉ ሰዎች ተጨማሪ ትክክለኛ ቀለማትን እንዲመለከቱ ያስችላቸዋል"</string>
     <string name="daltonizer_type_overridden" msgid="4509604753672535721">"በ<xliff:g id="TITLE">%1$s</xliff:g> ተሽሯል"</string>
     <string name="power_remaining_settings_home_page" msgid="4885165789445462557">"<xliff:g id="PERCENTAGE">%1$s</xliff:g> - <xliff:g id="TIME_STRING">%2$s</xliff:g>"</string>
     <string name="power_remaining_duration_only" msgid="8264199158671531431">"<xliff:g id="TIME_REMAINING">%1$s</xliff:g> ገደማ ቀርቷል"</string>
@@ -403,21 +431,19 @@
     <string name="power_remaining_less_than_duration" msgid="1812668275239801236">"ከ<xliff:g id="THRESHOLD">%1$s</xliff:g> ያነሰ ይቀራል (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_more_than_subtext" msgid="7919119719242734848">"ከ<xliff:g id="TIME_REMAINING">%1$s</xliff:g> በላይ ይቀራል (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_only_more_than_subtext" msgid="3274496164769110480">"ከ<xliff:g id="TIME_REMAINING">%1$s</xliff:g> በላይ ይቀራል"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="6583866940347159957">"ስልኩ በቅርቡ ሊዘጋ ይችላል"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="8009177999719462724">"ጡባዊው በቅርቡ ሊዘጋ ይችላል"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="8320892540455268018">"መሣሪያው በቅርቡ ሊዘጋ ይችላል"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="6186572170809116621">"ስልኩ በቅርቡ ሊዘጋ ይችላል (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="1338758278145563121">"ጡባዊው በቅርቡ ሊዘጋ ይችላል (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="3699579688084774362">"መሣሪያው በቅርቡ ሊዘጋ ይችላል (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="137330009791560774">"ስልኩ በቅርቡ ሊዘጋ ይችላል"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="145489081521468132">"ጡባዊው በቅርቡ ሊዘጋ ይችላል"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="1070562682853942350">"መሣሪያው በቅርቡ ሊዘጋ ይችላል"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="4429259621177089719">"ስልኩ በቅርቡ ሊዘጋ ይችላል (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="7703677921000858479">"ጡባዊው በቅርቡ ሊዘጋ ይችላል (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="4374784375644214578">"መሣሪያው በቅርቡ ሊዘጋ ይችላል (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
     <string name="power_charging" msgid="6727132649743436802">"<xliff:g id="LEVEL">%1$s</xliff:g> - <xliff:g id="STATE">%2$s</xliff:g>"</string>
     <string name="power_remaining_charging_duration_only" msgid="7415639699283965818">"<xliff:g id="TIME">%1$s</xliff:g> ኃይል እስከሚሞላ ድረስ ይቀራል"</string>
     <string name="power_charging_duration" msgid="5005740040558984057">"<xliff:g id="LEVEL">%1$s</xliff:g> - <xliff:g id="TIME">%2$s</xliff:g> ኃይል እስከሚሞላ ድረስ"</string>
     <string name="battery_info_status_unknown" msgid="268625384868401114">"ያልታወቀ"</string>
     <string name="battery_info_status_charging" msgid="4279958015430387405">"ኃይል በመሙላት ላይ"</string>
-    <!-- no translation found for battery_info_status_charging_fast (8027559755902954885) -->
-    <skip />
-    <!-- no translation found for battery_info_status_charging_slow (3190803837168962319) -->
-    <skip />
+    <string name="battery_info_status_charging_fast" msgid="8027559755902954885">"ኃይል በፍጥነት በመሙላት ላይ"</string>
+    <string name="battery_info_status_charging_slow" msgid="3190803837168962319">"ኃይል በዝግታ በመሙላት ላይ"</string>
     <string name="battery_info_status_discharging" msgid="6962689305413556485">"ባትሪ እየሞላ አይደለም"</string>
     <string name="battery_info_status_not_charging" msgid="8330015078868707899">"ተሰክቷል፣ አሁን ኃይል መሙላት አይቻልም"</string>
     <string name="battery_info_status_full" msgid="4443168946046847468">"ሙሉነው"</string>
diff --git a/packages/SettingsLib/res/values-ar/strings.xml b/packages/SettingsLib/res/values-ar/strings.xml
index 07befeb..7fa6b7f 100644
--- a/packages/SettingsLib/res/values-ar/strings.xml
+++ b/packages/SettingsLib/res/values-ar/strings.xml
@@ -206,6 +206,60 @@
     <string name="enable_adb" msgid="8072776357237289039">"‏تصحيح أخطاء USB"</string>
     <string name="enable_adb_summary" msgid="3711526030096574316">"‏وضع تصحيح الأخطاء عند توصيل USB"</string>
     <string name="clear_adb_keys" msgid="3010148733140369917">"‏إلغاء عمليات تفويض تصحيح أخطاء USB"</string>
+    <!-- no translation found for enable_adb_wireless (6973226350963971018) -->
+    <skip />
+    <!-- no translation found for enable_adb_wireless_summary (7344391423657093011) -->
+    <skip />
+    <!-- no translation found for adb_wireless_error (721958772149779856) -->
+    <skip />
+    <!-- no translation found for adb_wireless_settings (2295017847215680229) -->
+    <skip />
+    <!-- no translation found for adb_wireless_list_empty_off (1713707973837255490) -->
+    <skip />
+    <!-- no translation found for adb_pair_method_qrcode_title (6982904096137468634) -->
+    <skip />
+    <!-- no translation found for adb_pair_method_qrcode_summary (3729901496856458634) -->
+    <skip />
+    <!-- no translation found for adb_pair_method_code_title (1122590300445142904) -->
+    <skip />
+    <!-- no translation found for adb_pair_method_code_summary (6370414511333685185) -->
+    <skip />
+    <!-- no translation found for adb_paired_devices_title (5268997341526217362) -->
+    <skip />
+    <!-- no translation found for adb_wireless_device_connected_summary (3039660790249148713) -->
+    <skip />
+    <!-- no translation found for adb_wireless_device_details_title (7129369670526565786) -->
+    <skip />
+    <!-- no translation found for adb_device_forget (193072400783068417) -->
+    <skip />
+    <!-- no translation found for adb_device_fingerprint_title_format (291504822917843701) -->
+    <skip />
+    <!-- no translation found for adb_wireless_connection_failed_title (664211177427438438) -->
+    <skip />
+    <!-- no translation found for adb_wireless_connection_failed_message (9213896700171602073) -->
+    <skip />
+    <!-- no translation found for adb_pairing_device_dialog_title (7141739231018530210) -->
+    <skip />
+    <!-- no translation found for adb_pairing_device_dialog_pairing_code_label (3639239786669722731) -->
+    <skip />
+    <!-- no translation found for adb_pairing_device_dialog_failed_title (3426758947882091735) -->
+    <skip />
+    <!-- no translation found for adb_pairing_device_dialog_failed_msg (6611097519661997148) -->
+    <skip />
+    <!-- no translation found for adb_wireless_qrcode_summary (8051414549011801917) -->
+    <skip />
+    <!-- no translation found for adb_wireless_verifying_qrcode_text (6123192424916029207) -->
+    <skip />
+    <!-- no translation found for adb_qrcode_pairing_device_failed_msg (6936292092592914132) -->
+    <skip />
+    <!-- no translation found for adb_wireless_ip_addr_preference_title (8335132107715311730) -->
+    <skip />
+    <!-- no translation found for adb_wireless_qrcode_pairing_title (1906409667944674707) -->
+    <skip />
+    <!-- no translation found for adb_wireless_qrcode_pairing_description (8578868049289910131) -->
+    <skip />
+    <!-- no translation found for keywords_adb_wireless (6507505581882171240) -->
+    <skip />
     <string name="bugreport_in_power" msgid="8664089072534638709">"اختصار تقرير الأخطاء"</string>
     <string name="bugreport_in_power_summary" msgid="1885529649381831775">"عرض زر في قائمة خيارات التشغيل لإعداد تقرير بالأخطاء"</string>
     <string name="keep_screen_on" msgid="1187161672348797558">"البقاء في الوضع النشط"</string>
@@ -271,6 +325,10 @@
     <string name="tethering_hardware_offload_summary" msgid="7801345335142803029">"استخدام إعداد تسريع الأجهزة للتوصيل إن كان متاحًا"</string>
     <string name="adb_warning_title" msgid="7708653449506485728">"‏هل تريد السماح بتصحيح أخطاء USB؟"</string>
     <string name="adb_warning_message" msgid="8145270656419669221">"‏تم تصميم تصحيح أخطاء USB لأغراض التطوير فقط. يمكن استخدامه لنسخ البيانات بين الكمبيوتر والجهاز، وتثبيت التطبيقات على جهازك بدون تنبيه، وقراءة بيانات السجل."</string>
+    <!-- no translation found for adbwifi_warning_title (727104571653031865) -->
+    <skip />
+    <!-- no translation found for adbwifi_warning_message (8005936574322702388) -->
+    <skip />
     <string name="adb_keys_warning_message" msgid="2968555274488101220">"‏هل تريد إلغاء إمكانية الدخول إلى تصحيح أخطاء USB من جميع أجهزة الكمبيوتر التي تم التصريح لها سابقًا؟"</string>
     <string name="dev_settings_warning_title" msgid="8251234890169074553">"هل تريد السماح لإعدادات التطوير؟"</string>
     <string name="dev_settings_warning_message" msgid="37741686486073668">"هذه الإعدادات مخصصة لاستخدام التطوير فقط. قد يتسبب هذا في حدوث أعطال أو خلل في أداء الجهاز والتطبيقات المثبتة عليه."</string>
@@ -403,12 +461,18 @@
     <string name="power_remaining_less_than_duration" msgid="1812668275239801236">"يتبقى أقل من <xliff:g id="THRESHOLD">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)."</string>
     <string name="power_remaining_more_than_subtext" msgid="7919119719242734848">"يتبقى أكثر من <xliff:g id="TIME_REMAINING">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)."</string>
     <string name="power_remaining_only_more_than_subtext" msgid="3274496164769110480">"يتبقى أكثر من <xliff:g id="TIME_REMAINING">%1$s</xliff:g>."</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="6583866940347159957">"قد يتم إغلاق الهاتف بعد قليل."</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="8009177999719462724">"قد يتم إغلاق الجهاز اللوحي بعد قليل."</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="8320892540455268018">"قد يتم إغلاق الجهاز بعد قليل."</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="6186572170809116621">"قد يتم إغلاق الهاتف بعد قليل (<xliff:g id="LEVEL">%1$s</xliff:g>)."</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="1338758278145563121">"قد يتم إغلاق الجهاز اللوحي بعد قليل (<xliff:g id="LEVEL">%1$s</xliff:g>)."</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="3699579688084774362">"قد يتم إغلاق الجهاز بعد قليل (<xliff:g id="LEVEL">%1$s</xliff:g>)."</string>
+    <!-- no translation found for power_remaining_duration_only_shutdown_imminent (137330009791560774) -->
+    <skip />
+    <!-- no translation found for power_remaining_duration_only_shutdown_imminent (145489081521468132) -->
+    <skip />
+    <!-- no translation found for power_remaining_duration_only_shutdown_imminent (1070562682853942350) -->
+    <skip />
+    <!-- no translation found for power_remaining_duration_shutdown_imminent (4429259621177089719) -->
+    <skip />
+    <!-- no translation found for power_remaining_duration_shutdown_imminent (7703677921000858479) -->
+    <skip />
+    <!-- no translation found for power_remaining_duration_shutdown_imminent (4374784375644214578) -->
+    <skip />
     <string name="power_charging" msgid="6727132649743436802">"<xliff:g id="LEVEL">%1$s</xliff:g> - <xliff:g id="STATE">%2$s</xliff:g>"</string>
     <string name="power_remaining_charging_duration_only" msgid="7415639699283965818">"<xliff:g id="TIME">%1$s</xliff:g> إلى أن يتم شحن الجهاز بالكامل"</string>
     <string name="power_charging_duration" msgid="5005740040558984057">"<xliff:g id="LEVEL">%1$s</xliff:g> - <xliff:g id="TIME">%2$s</xliff:g> إلى أن يتم شحن الجهاز بالكامل"</string>
diff --git a/packages/SettingsLib/res/values-as/strings.xml b/packages/SettingsLib/res/values-as/strings.xml
index 4d0d8cc..dc22f29 100644
--- a/packages/SettingsLib/res/values-as/strings.xml
+++ b/packages/SettingsLib/res/values-as/strings.xml
@@ -206,6 +206,33 @@
     <string name="enable_adb" msgid="8072776357237289039">"ইউএছবি ডিবাগিং"</string>
     <string name="enable_adb_summary" msgid="3711526030096574316">"ইউএছবি সংযোগ হৈ থকাৰ অৱস্থাত ডিবাগ ম\'ড"</string>
     <string name="clear_adb_keys" msgid="3010148733140369917">"ইউএছবি ডিবাগিং অনুমতিসমূহ প্ৰত্যাহাৰ কৰক"</string>
+    <string name="enable_adb_wireless" msgid="6973226350963971018">"ৱায়াৰলেছ ডিবাগিং"</string>
+    <string name="enable_adb_wireless_summary" msgid="7344391423657093011">"ৱাই-ফাই সংযোজিত হৈ থকা সময়ত ডিবাগ ম’ড"</string>
+    <string name="adb_wireless_error" msgid="721958772149779856">"আসোঁৱাহ"</string>
+    <string name="adb_wireless_settings" msgid="2295017847215680229">"ৱায়াৰলেছ ডিবাগিং"</string>
+    <string name="adb_wireless_list_empty_off" msgid="1713707973837255490">"উপলব্ধ ডিভাইচসমূহ চাবলৈ আৰু ব্যৱহাৰ কৰিবলৈ, ৱায়াৰলেছ ডিবাগিং অন কৰক"</string>
+    <string name="adb_pair_method_qrcode_title" msgid="6982904096137468634">"কিউআৰ ক’ডৰ জৰিয়তে ডিভাইচ পেয়াৰ কৰক"</string>
+    <string name="adb_pair_method_qrcode_summary" msgid="3729901496856458634">"কিউআৰ ক’ড স্কেনাৰ ব্যৱহাৰ কৰি নতুন ডিভাইচসমূহ পেয়াৰ কৰক"</string>
+    <string name="adb_pair_method_code_title" msgid="1122590300445142904">"পেয়াৰ কৰা ক’ডৰ জৰিয়তে ডিভাইচ পেয়াৰ কৰক"</string>
+    <string name="adb_pair_method_code_summary" msgid="6370414511333685185">"ছটা অংকৰ ক’ড ব্যৱহাৰ কৰি নতুন ডিভাইচসমূহ পেয়াৰ কৰক"</string>
+    <string name="adb_paired_devices_title" msgid="5268997341526217362">"পেয়াৰ কৰি থোৱা ডিভাইচসমূহ"</string>
+    <string name="adb_wireless_device_connected_summary" msgid="3039660790249148713">"সম্প্ৰতি সংযোজিত হৈ আছে"</string>
+    <string name="adb_wireless_device_details_title" msgid="7129369670526565786">"ডিভাইচটোৰ সবিশেষ"</string>
+    <string name="adb_device_forget" msgid="193072400783068417">"পাহৰক"</string>
+    <string name="adb_device_fingerprint_title_format" msgid="291504822917843701">"ডিভাইচৰ ফিংগাৰপ্ৰিণ্ট: <xliff:g id="FINGERPRINT_PARAM">%1$s</xliff:g>"</string>
+    <string name="adb_wireless_connection_failed_title" msgid="664211177427438438">"সংযোগ কৰিব পৰা নগ’ল"</string>
+    <string name="adb_wireless_connection_failed_message" msgid="9213896700171602073">"<xliff:g id="DEVICE_NAME">%1$s</xliff:g>টো শুদ্ধ নেটৱৰ্কৰ সৈতে সংযোগ কৰাটো নিশ্চিত কৰক"</string>
+    <string name="adb_pairing_device_dialog_title" msgid="7141739231018530210">"ডিভাইচৰ সৈতে পেয়াৰ কৰক"</string>
+    <string name="adb_pairing_device_dialog_pairing_code_label" msgid="3639239786669722731">"ৱাই-ফাইৰ পেয়াৰ কৰা ক’ড"</string>
+    <string name="adb_pairing_device_dialog_failed_title" msgid="3426758947882091735">"পেয়াৰ কৰিব পৰা নগ’ল"</string>
+    <string name="adb_pairing_device_dialog_failed_msg" msgid="6611097519661997148">"ডিভাইচটো একেটা নেটৱৰ্কৰ সৈতে সংযোগ কৰাটো নিশ্চিত কৰক।"</string>
+    <string name="adb_wireless_qrcode_summary" msgid="8051414549011801917">"এটা কিউআৰ ক’ড স্কেন কৰি ৱাই-ফাইৰে ডিভাইচ পেয়াৰ কৰক"</string>
+    <string name="adb_wireless_verifying_qrcode_text" msgid="6123192424916029207">"ডিভাইচ পেয়াৰ কৰি থকা হৈছে…"</string>
+    <string name="adb_qrcode_pairing_device_failed_msg" msgid="6936292092592914132">"ডিভাইচটো পেয়াৰ কৰিব পৰা নগ’ল। কিউআৰ ক’ডটো ভুল অথবা ডিভাইচটো একেটা নেটৱৰ্কৰ সৈতে সংযোগ কৰা হোৱা নাই।"</string>
+    <string name="adb_wireless_ip_addr_preference_title" msgid="8335132107715311730">"আইপি ঠিকনা &amp; প’ৰ্ট"</string>
+    <string name="adb_wireless_qrcode_pairing_title" msgid="1906409667944674707">"কিউআৰ ক’ড স্কেন কৰক"</string>
+    <string name="adb_wireless_qrcode_pairing_description" msgid="8578868049289910131">"এটা কিউআৰ ক’ড স্কেন কৰি ৱাই-ফাইৰে ডিভাইচ পেয়াৰ কৰক"</string>
+    <string name="keywords_adb_wireless" msgid="6507505581882171240">"adb, ডিবাগ, dev"</string>
     <string name="bugreport_in_power" msgid="8664089072534638709">"বাগ ৰিপৰ্টৰ শ্ৱৰ্টকাট"</string>
     <string name="bugreport_in_power_summary" msgid="1885529649381831775">"পাৱাৰ মেনুত বাগ প্ৰতিবেদন গ্ৰহণ কৰিবলৈ এটা বুটাম দেখুৱাওক"</string>
     <string name="keep_screen_on" msgid="1187161672348797558">"জাগ্ৰত কৰি ৰাখক"</string>
@@ -271,6 +298,8 @@
     <string name="tethering_hardware_offload_summary" msgid="7801345335142803029">"যদিহে উপলব্ধ হয় তেন্তে টেডাৰিং হাৰ্ডৱেৰ ত্বৰণ ব্যৱহাৰ কৰক"</string>
     <string name="adb_warning_title" msgid="7708653449506485728">"ইউএছবি ডিবাগিঙৰ অনুমতি দিয়েনে?"</string>
     <string name="adb_warning_message" msgid="8145270656419669221">"ইউএছবি ডিবাগ কৰা কাৰ্য কেৱল বিকাশৰ উদ্দেশ্যৰেহে কৰা হৈছে৷ আপোনাৰ কম্পিউটাৰ আৰু আপোনাৰ ডিভাইচৰ মাজত ডেটা প্ৰতিলিপি কৰিবলৈ এইটো ব্যৱহাৰ কৰক, কোনো জাননী নিদিয়াকৈয়ে আপোনাৰ ডিভাইচত এপ্‌সমূহ ইনষ্টল কৰক আৰু লগ ডেটা পঢ়ক৷"</string>
+    <string name="adbwifi_warning_title" msgid="727104571653031865">"ৱায়াৰলেছ ডিবাগিঙৰ অনুমতি দিবনে?"</string>
+    <string name="adbwifi_warning_message" msgid="8005936574322702388">"ৱায়াৰলেছ ডিবাগিং কেৱল বিকাশৰ উদ্দেশ্যেৰে কৰা হয়। আপোনাৰ কম্পিউটাৰ আৰু আপোনাৰ ডিভাইচৰ মাজত ডেটা প্ৰতিলিপি কৰিবলৈ, কোনো জাননী নিদিয়াকৈয়ে আপোনাৰ ডিভাইচত এপ্‌সমূহ ইনষ্টল কৰিবলৈ আৰু লগ ডেটা পঢ়িবলৈ এইটো ব্যৱহাৰ কৰক।"</string>
     <string name="adb_keys_warning_message" msgid="2968555274488101220">"আপুনি আগতে ইউএছবি ডিবাগিঙৰ বাবে প্ৰৱেশৰ অনুমতি দিয়া সকলো কম্পিউটাৰৰ পৰা সেই অনুমতি প্ৰত্যাহাৰ কৰেনে?"</string>
     <string name="dev_settings_warning_title" msgid="8251234890169074553">"বিকাশৰ কামৰ বাবে থকা ছেটিংবিলাকক অনুমতি দিবনে?"</string>
     <string name="dev_settings_warning_message" msgid="37741686486073668">"এই ছেটিংসমূহ বিকাশৰ কামত ব্যৱহাৰ কৰিবলৈ তৈয়াৰ কৰা হৈছে। সেইবিলাকে আপোনাৰ ডিভাইচ আৰু তাত থকা এপ্লিকেশ্বনসমূহক অকামিলা কৰি পেলাব পাৰে আৰু সেইবিলাকৰ কাৰণে এপ্লিকেশ্বনসমূহে অদ্ভুত আচৰণ কৰিব পাৰে।"</string>
@@ -383,8 +412,7 @@
     <string name="daltonizer_mode_protanomaly" msgid="7805583306666608440">"প্ৰ’টানোমালি (ৰঙা-সেউজীয়া)"</string>
     <string name="daltonizer_mode_tritanomaly" msgid="7135266249220732267">"ট্ৰাইটান\'মেলী (নীলা-হালধীয়া)"</string>
     <string name="accessibility_display_daltonizer_preference_title" msgid="1810693571332381974">"ৰং শুধৰণী"</string>
-    <!-- no translation found for accessibility_display_daltonizer_preference_subtitle (6178138727195403796) -->
-    <skip />
+    <string name="accessibility_display_daltonizer_preference_subtitle" msgid="6178138727195403796">"ৰং শুধৰণি কৰা কার্যই বর্ণান্ধ লোকসকলক ৰংবোৰ অধিক সঠিককৈ দেখাত সহায় কৰে"</string>
     <string name="daltonizer_type_overridden" msgid="4509604753672535721">"<xliff:g id="TITLE">%1$s</xliff:g>ৰ দ্বাৰা অগ্ৰাহ্য কৰা হৈছে"</string>
     <string name="power_remaining_settings_home_page" msgid="4885165789445462557">"<xliff:g id="PERCENTAGE">%1$s</xliff:g> - <xliff:g id="TIME_STRING">%2$s</xliff:g>"</string>
     <string name="power_remaining_duration_only" msgid="8264199158671531431">"প্রায় <xliff:g id="TIME_REMAINING">%1$s</xliff:g> বাকী আছে"</string>
@@ -403,21 +431,19 @@
     <string name="power_remaining_less_than_duration" msgid="1812668275239801236">"<xliff:g id="THRESHOLD">%1$s</xliff:g>তকৈও কম সময় বাকী আছে (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_more_than_subtext" msgid="7919119719242734848">"<xliff:g id="TIME_REMAINING">%1$s</xliff:g>তকৈও বেছি সময় বাকী আছে (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_only_more_than_subtext" msgid="3274496164769110480">"<xliff:g id="TIME_REMAINING">%1$s</xliff:g>তকৈও বেছি সময় বাকী আছে"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="6583866940347159957">"ফ\'নটো সোনকালেই বন্ধ হ\'ব পাৰে"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="8009177999719462724">"টেবলেটটো সোনকালেই বন্ধ হ\'ব পাৰে"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="8320892540455268018">"ডিভাইচটো সোনকালেই বন্ধ হ\'ব পাৰে"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="6186572170809116621">"ফ\'নটো সোনকালেই বন্ধ হ\'ব পাৰে (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="1338758278145563121">"টেবলেটটো সোনকালেই বন্ধ হ\'ব পাৰে (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="3699579688084774362">"ডিভাইচটো সোনকালেই বন্ধ হ\'ব পাৰে (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="137330009791560774">"ফ’নটো সোনকালে বন্ধ হৈ যাব পাৰে"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="145489081521468132">"টেবলেটটো সোনকালে বন্ধ হৈ যাব পাৰে"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="1070562682853942350">"ডিভাইচটো সোনকালে বন্ধ হৈ যাব পাৰে"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="4429259621177089719">"ফ’নটো সোনকালে বন্ধ হৈ যাব পাৰে (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="7703677921000858479">"টেবলেটটো সোনকালে বন্ধ হৈ যাব পাৰে (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="4374784375644214578">"ডিভাইচটো সোনকালে বন্ধ হৈ যাব পাৰে (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
     <string name="power_charging" msgid="6727132649743436802">"<xliff:g id="LEVEL">%1$s</xliff:g> - <xliff:g id="STATE">%2$s</xliff:g>"</string>
     <string name="power_remaining_charging_duration_only" msgid="7415639699283965818">"চাৰ্জ হ’বলৈ <xliff:g id="TIME">%1$s</xliff:g> বাকী আছে"</string>
     <string name="power_charging_duration" msgid="5005740040558984057">"<xliff:g id="LEVEL">%1$s</xliff:g> - <xliff:g id="TIME">%2$s</xliff:g> চাৰ্জ হ\'বলৈ"</string>
     <string name="battery_info_status_unknown" msgid="268625384868401114">"অজ্ঞাত"</string>
     <string name="battery_info_status_charging" msgid="4279958015430387405">"চাৰ্জ কৰি থকা হৈছে"</string>
-    <!-- no translation found for battery_info_status_charging_fast (8027559755902954885) -->
-    <skip />
-    <!-- no translation found for battery_info_status_charging_slow (3190803837168962319) -->
-    <skip />
+    <string name="battery_info_status_charging_fast" msgid="8027559755902954885">"দ্ৰুততাৰে চাৰ্জ হৈছে"</string>
+    <string name="battery_info_status_charging_slow" msgid="3190803837168962319">"লাহে লাহে চাৰ্জ হৈছে"</string>
     <string name="battery_info_status_discharging" msgid="6962689305413556485">"চ্চাৰ্জ কৰা নাই"</string>
     <string name="battery_info_status_not_charging" msgid="8330015078868707899">"প্লাগ কৰি থোৱা হৈছে, এই মুহূৰ্তত চ্চাৰ্জ কৰিব নোৱাৰি"</string>
     <string name="battery_info_status_full" msgid="4443168946046847468">"পূৰ্ণ"</string>
diff --git a/packages/SettingsLib/res/values-az/strings.xml b/packages/SettingsLib/res/values-az/strings.xml
index 73eb48a..9b082b6 100644
--- a/packages/SettingsLib/res/values-az/strings.xml
+++ b/packages/SettingsLib/res/values-az/strings.xml
@@ -206,6 +206,33 @@
     <string name="enable_adb" msgid="8072776357237289039">"USB debaq prosesi"</string>
     <string name="enable_adb_summary" msgid="3711526030096574316">"USB qoşulu olan zaman debaq rejimi"</string>
     <string name="clear_adb_keys" msgid="3010148733140369917">"USB debaq avtorizasiyasını ləğv edin"</string>
+    <string name="enable_adb_wireless" msgid="6973226350963971018">"Simsiz sazlama"</string>
+    <string name="enable_adb_wireless_summary" msgid="7344391423657093011">"Wi‑Fi qoşulduqda sazlama rejimi"</string>
+    <string name="adb_wireless_error" msgid="721958772149779856">"Xəta"</string>
+    <string name="adb_wireless_settings" msgid="2295017847215680229">"Simsiz sazlama"</string>
+    <string name="adb_wireless_list_empty_off" msgid="1713707973837255490">"Əlçatan cihazları görmək və onlardan istifadə etmək üçün simsiz sazlamanı yandırın"</string>
+    <string name="adb_pair_method_qrcode_title" msgid="6982904096137468634">"QR kodu ilə cihazı cütləşdirin"</string>
+    <string name="adb_pair_method_qrcode_summary" msgid="3729901496856458634">"QR kod Skanerindən istifadə etməklə yeni cihazları cütləşdirin"</string>
+    <string name="adb_pair_method_code_title" msgid="1122590300445142904">"Cütləşdirmə kodu ilə cihazı cütləşdirin"</string>
+    <string name="adb_pair_method_code_summary" msgid="6370414511333685185">"Altı rəqəmli koddan istifadə etməklə yeni cihazları cütləşdirin"</string>
+    <string name="adb_paired_devices_title" msgid="5268997341526217362">"Cütləşdirilmiş cihazlar"</string>
+    <string name="adb_wireless_device_connected_summary" msgid="3039660790249148713">"Hazırda qoşulub"</string>
+    <string name="adb_wireless_device_details_title" msgid="7129369670526565786">"Cihaz detalları"</string>
+    <string name="adb_device_forget" msgid="193072400783068417">"Unudun"</string>
+    <string name="adb_device_fingerprint_title_format" msgid="291504822917843701">"Cihaz barmaq izi: <xliff:g id="FINGERPRINT_PARAM">%1$s</xliff:g>"</string>
+    <string name="adb_wireless_connection_failed_title" msgid="664211177427438438">"Bağlantı uğursuz oldu"</string>
+    <string name="adb_wireless_connection_failed_message" msgid="9213896700171602073">"<xliff:g id="DEVICE_NAME">%1$s</xliff:g> cihazının düzgün şəbəkəyə qoşulduğundan əmin olun"</string>
+    <string name="adb_pairing_device_dialog_title" msgid="7141739231018530210">"Cihaz ilə cütləşdirin"</string>
+    <string name="adb_pairing_device_dialog_pairing_code_label" msgid="3639239786669722731">"Wi‑Fi cütləşdirmə kodu"</string>
+    <string name="adb_pairing_device_dialog_failed_title" msgid="3426758947882091735">"Cütləşdirmə uğursuz oldu"</string>
+    <string name="adb_pairing_device_dialog_failed_msg" msgid="6611097519661997148">"Cihazın eyni şəbəkəyə qoşulduğundan əmin olun."</string>
+    <string name="adb_wireless_qrcode_summary" msgid="8051414549011801917">"QR kodu skanlamaqla cihazı Wi‑Fi vasitəsilə cütləşdirin"</string>
+    <string name="adb_wireless_verifying_qrcode_text" msgid="6123192424916029207">"Cihaz cütləşdirilir…"</string>
+    <string name="adb_qrcode_pairing_device_failed_msg" msgid="6936292092592914132">"Cihazı cütləşdirmək alınmadı. Ya QR kodu yanlış idi, ya da cihaz eyni şəbəkəyə qoşulmayıb."</string>
+    <string name="adb_wireless_ip_addr_preference_title" msgid="8335132107715311730">"IP ünvanı və Port"</string>
+    <string name="adb_wireless_qrcode_pairing_title" msgid="1906409667944674707">"QR kodu skanlayın"</string>
+    <string name="adb_wireless_qrcode_pairing_description" msgid="8578868049289910131">"QR Kodu skanlamaqla cihazı Wi‑Fi vasitəsilə cütləşdirin"</string>
+    <string name="keywords_adb_wireless" msgid="6507505581882171240">"adb, debug, dev"</string>
     <string name="bugreport_in_power" msgid="8664089072534638709">"Baq raportu qısa yolu"</string>
     <string name="bugreport_in_power_summary" msgid="1885529649381831775">"Baq raportunu götürmək üçün qidalanma menyusunda düyməni göstərin"</string>
     <string name="keep_screen_on" msgid="1187161672348797558">"Oyaq qal"</string>
@@ -271,6 +298,8 @@
     <string name="tethering_hardware_offload_summary" msgid="7801345335142803029">"Əlçatan oldarsa, birləşmə üçün avadanlıq akselerasiyasından istifadə edin"</string>
     <string name="adb_warning_title" msgid="7708653449506485728">"USB debaq funksiyasına icazə verilsin?"</string>
     <string name="adb_warning_message" msgid="8145270656419669221">"USB sazlanması yalnız inkişaf məqsədlidir. Kompüteriniz və cihazınız arasında datanı kopyalamaq üçün ondan istifadə edin, bildiriş olmadan tətbiqləri cihazınıza quraşdırın və qeydiyyat datasını oxuyun."</string>
+    <string name="adbwifi_warning_title" msgid="727104571653031865">"Simsiz sazlamaya icazə verilsin?"</string>
+    <string name="adbwifi_warning_message" msgid="8005936574322702388">"Simsiz sazlama yalnız inkişaf məqsədlidir. Ondan kompüteriniz və cihazınız arasında datanı kopyalamaq, cihazınızda bildiriş olmadan tətbiqləri quraşdırmaq və qeydiyyat datasını oxumaq üçün istifadə edin."</string>
     <string name="adb_keys_warning_message" msgid="2968555274488101220">"Əvvəl icazə verdiyiniz kompüterlərdən USB debaq əməliyyatına giriş ləğv olunsun?"</string>
     <string name="dev_settings_warning_title" msgid="8251234890169074553">"İnkişaf ayarlarına icazə verilsin mi?"</string>
     <string name="dev_settings_warning_message" msgid="37741686486073668">"Bu parametrlər yalnız inkişafetdirici istifadə üçün nəzərdə tutulub. Onlar cihaz və tətbiqlərinizin sınması və ya pis işləməsinə səbəb ola bilər."</string>
@@ -383,8 +412,7 @@
     <string name="daltonizer_mode_protanomaly" msgid="7805583306666608440">"Protanomaliya (qırmızı-yaşıl)"</string>
     <string name="daltonizer_mode_tritanomaly" msgid="7135266249220732267">"Tritanomaliya (göy-sarı)"</string>
     <string name="accessibility_display_daltonizer_preference_title" msgid="1810693571332381974">"Rəng düzəlişi"</string>
-    <!-- no translation found for accessibility_display_daltonizer_preference_subtitle (6178138727195403796) -->
-    <skip />
+    <string name="accessibility_display_daltonizer_preference_subtitle" msgid="6178138727195403796">"Rəng korreksiyası rəng korluğu olan insanlara rəngləri daha dəqiq görməkdə kömək edir"</string>
     <string name="daltonizer_type_overridden" msgid="4509604753672535721">"<xliff:g id="TITLE">%1$s</xliff:g> tərəfindən qəbul edilmir"</string>
     <string name="power_remaining_settings_home_page" msgid="4885165789445462557">"<xliff:g id="PERCENTAGE">%1$s</xliff:g> - <xliff:g id="TIME_STRING">%2$s</xliff:g>"</string>
     <string name="power_remaining_duration_only" msgid="8264199158671531431">"Təxminən <xliff:g id="TIME_REMAINING">%1$s</xliff:g> qalıb"</string>
@@ -403,21 +431,19 @@
     <string name="power_remaining_less_than_duration" msgid="1812668275239801236">"Qalan vaxt <xliff:g id="THRESHOLD">%1$s</xliff:g> və daha azdır (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_more_than_subtext" msgid="7919119719242734848">"Qalan vaxt <xliff:g id="TIME_REMAINING">%1$s</xliff:g> və daha çoxdur (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_only_more_than_subtext" msgid="3274496164769110480">"Qalan vaxt <xliff:g id="TIME_REMAINING">%1$s</xliff:g> və daha çoxdur"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="6583866940347159957">"Telefon tezliklə sönə bilər"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="8009177999719462724">"Planşet tezliklə sönə bilər"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="8320892540455268018">"Cihaz tezliklə sönə bilər"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="6186572170809116621">"Telefon tezliklə sönə bilər(<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="1338758278145563121">"Planşet tezliklə sönə bilər (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="3699579688084774362">"Cihaz tezliklə sönə bilər (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="137330009791560774">"Telefon tezliklə sönə bilər"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="145489081521468132">"Planşet tezliklə sönə bilər"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="1070562682853942350">"Cihaz tezliklə sönə bilər"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="4429259621177089719">"Telefon tezliklə sönə bilər (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="7703677921000858479">"Planşet tezliklə sönə bilər (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="4374784375644214578">"Cihaz tezliklə sönə bilər (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
     <string name="power_charging" msgid="6727132649743436802">"<xliff:g id="LEVEL">%1$s</xliff:g> - <xliff:g id="STATE">%2$s</xliff:g>"</string>
     <string name="power_remaining_charging_duration_only" msgid="7415639699283965818">"Enerjinin dolmasına <xliff:g id="TIME">%1$s</xliff:g> qalıb"</string>
     <string name="power_charging_duration" msgid="5005740040558984057">"<xliff:g id="LEVEL">%1$s</xliff:g> - Enerjinin dolmasına <xliff:g id="TIME">%2$s</xliff:g> qalıb"</string>
     <string name="battery_info_status_unknown" msgid="268625384868401114">"Naməlum"</string>
     <string name="battery_info_status_charging" msgid="4279958015430387405">"Enerji doldurma"</string>
-    <!-- no translation found for battery_info_status_charging_fast (8027559755902954885) -->
-    <skip />
-    <!-- no translation found for battery_info_status_charging_slow (3190803837168962319) -->
-    <skip />
+    <string name="battery_info_status_charging_fast" msgid="8027559755902954885">"Sürətlə doldurulur"</string>
+    <string name="battery_info_status_charging_slow" msgid="3190803837168962319">"Asta doldurulur"</string>
     <string name="battery_info_status_discharging" msgid="6962689305413556485">"Doldurulmur"</string>
     <string name="battery_info_status_not_charging" msgid="8330015078868707899">"Cihaz hazırda batareya yığa bilmir"</string>
     <string name="battery_info_status_full" msgid="4443168946046847468">"Tam"</string>
diff --git a/packages/SettingsLib/res/values-b+sr+Latn/strings.xml b/packages/SettingsLib/res/values-b+sr+Latn/strings.xml
index dff657e..cc63740 100644
--- a/packages/SettingsLib/res/values-b+sr+Latn/strings.xml
+++ b/packages/SettingsLib/res/values-b+sr+Latn/strings.xml
@@ -206,6 +206,33 @@
     <string name="enable_adb" msgid="8072776357237289039">"Otklanjanje USB grešaka"</string>
     <string name="enable_adb_summary" msgid="3711526030096574316">"Režim otklanjanja grešaka kada je USB povezan"</string>
     <string name="clear_adb_keys" msgid="3010148733140369917">"Opozivanje odobrenja za uklanjanje USB grešaka"</string>
+    <string name="enable_adb_wireless" msgid="6973226350963971018">"Bežično otklanjanje grešaka"</string>
+    <string name="enable_adb_wireless_summary" msgid="7344391423657093011">"Režim za otklanjanje grešaka kada je Wi‑Fi povezan"</string>
+    <string name="adb_wireless_error" msgid="721958772149779856">"Greška"</string>
+    <string name="adb_wireless_settings" msgid="2295017847215680229">"Bežično otklanjanje grešaka"</string>
+    <string name="adb_wireless_list_empty_off" msgid="1713707973837255490">"Da biste videli i koristili dostupne uređaje, uključite bežično otklanjanje grešaka"</string>
+    <string name="adb_pair_method_qrcode_title" msgid="6982904096137468634">"Uparite uređaj pomoću QR koda"</string>
+    <string name="adb_pair_method_qrcode_summary" msgid="3729901496856458634">"Uparite nove uređaje pomoću čitača QR koda"</string>
+    <string name="adb_pair_method_code_title" msgid="1122590300445142904">"Uparite uređaj pomoću koda za uparivanje"</string>
+    <string name="adb_pair_method_code_summary" msgid="6370414511333685185">"Uparite nove uređaje pomoću šestocifrenog koda"</string>
+    <string name="adb_paired_devices_title" msgid="5268997341526217362">"Upareni uređaji"</string>
+    <string name="adb_wireless_device_connected_summary" msgid="3039660790249148713">"Trenutno je povezano"</string>
+    <string name="adb_wireless_device_details_title" msgid="7129369670526565786">"Detalji o uređaju"</string>
+    <string name="adb_device_forget" msgid="193072400783068417">"Zaboravi"</string>
+    <string name="adb_device_fingerprint_title_format" msgid="291504822917843701">"Otisak prsta na uređaju: <xliff:g id="FINGERPRINT_PARAM">%1$s</xliff:g>"</string>
+    <string name="adb_wireless_connection_failed_title" msgid="664211177427438438">"Povezivanje nije uspelo"</string>
+    <string name="adb_wireless_connection_failed_message" msgid="9213896700171602073">"Uverite se da je <xliff:g id="DEVICE_NAME">%1$s</xliff:g> povezan sa odgovarajućom mrežom"</string>
+    <string name="adb_pairing_device_dialog_title" msgid="7141739231018530210">"Uparite sa uređajem"</string>
+    <string name="adb_pairing_device_dialog_pairing_code_label" msgid="3639239786669722731">"Kôd za uparivanje preko Wi‑Fi-ja"</string>
+    <string name="adb_pairing_device_dialog_failed_title" msgid="3426758947882091735">"Uparivanje nije uspelo"</string>
+    <string name="adb_pairing_device_dialog_failed_msg" msgid="6611097519661997148">"Uverite se da je uređaj povezan na istu mrežu."</string>
+    <string name="adb_wireless_qrcode_summary" msgid="8051414549011801917">"Uparite uređaj pomoću Wi‑Fi mreže ili tako što ćete skenirati QR kôd"</string>
+    <string name="adb_wireless_verifying_qrcode_text" msgid="6123192424916029207">"Uparuje se uređaj…"</string>
+    <string name="adb_qrcode_pairing_device_failed_msg" msgid="6936292092592914132">"Uparivanje uređaja nije uspelo. QR kôd je pogrešan ili uređaj nije povezan sa istom mrežom."</string>
+    <string name="adb_wireless_ip_addr_preference_title" msgid="8335132107715311730">"IP adresa i port"</string>
+    <string name="adb_wireless_qrcode_pairing_title" msgid="1906409667944674707">"Skeniraj QR kôd"</string>
+    <string name="adb_wireless_qrcode_pairing_description" msgid="8578868049289910131">"Uparite uređaj pomoću Wi‑Fi mreže ili tako što ćete skenirati QR kôd"</string>
+    <string name="keywords_adb_wireless" msgid="6507505581882171240">"adb, otklanjanje grešaka, programer"</string>
     <string name="bugreport_in_power" msgid="8664089072534638709">"Prečica za izveštaj o greškama"</string>
     <string name="bugreport_in_power_summary" msgid="1885529649381831775">"Prikaži dugme u meniju napajanja za pravljenje izveštaja o greškama"</string>
     <string name="keep_screen_on" msgid="1187161672348797558">"Ne zaključavaj"</string>
@@ -271,6 +298,8 @@
     <string name="tethering_hardware_offload_summary" msgid="7801345335142803029">"Koristi hardversko ubrzanje privezivanja ako je dostupno"</string>
     <string name="adb_warning_title" msgid="7708653449506485728">"Dozvoli otklanjanje USB grešaka?"</string>
     <string name="adb_warning_message" msgid="8145270656419669221">"Otklanjanje USB grešaka namenjeno je samo za svrhe programiranja. Koristite ga za kopiranje podataka sa računara na uređaj i obrnuto, instaliranje aplikacija na uređaju bez obaveštenja i čitanje podataka iz evidencije."</string>
+    <string name="adbwifi_warning_title" msgid="727104571653031865">"Želite da dozvolite bežično otklanjanje grešaka?"</string>
+    <string name="adbwifi_warning_message" msgid="8005936574322702388">"Bežično otklanjanje grešaka namenjeno je samo programiranju. Koristite ga za kopiranje podataka sa računara na uređaj i obrnuto, instaliranje aplikacija na uređaju bez obaveštenja i čitanje podataka iz evidencije."</string>
     <string name="adb_keys_warning_message" msgid="2968555274488101220">"Želite li da opozovete pristup otklanjanju USB grešaka sa svih računara koje ste prethodno odobrili?"</string>
     <string name="dev_settings_warning_title" msgid="8251234890169074553">"Želite li da omogućite programerska podešavanja?"</string>
     <string name="dev_settings_warning_message" msgid="37741686486073668">"Ova podešavanja su namenjena samo za programiranje. Mogu da izazovu prestanak funkcionisanja ili neočekivano ponašanje uređaja i aplikacija na njemu."</string>
@@ -383,8 +412,7 @@
     <string name="daltonizer_mode_protanomaly" msgid="7805583306666608440">"Protanomalija (crveno-zeleno)"</string>
     <string name="daltonizer_mode_tritanomaly" msgid="7135266249220732267">"Tritanomalija (plavo-žuto)"</string>
     <string name="accessibility_display_daltonizer_preference_title" msgid="1810693571332381974">"Korekcija boja"</string>
-    <!-- no translation found for accessibility_display_daltonizer_preference_subtitle (6178138727195403796) -->
-    <skip />
+    <string name="accessibility_display_daltonizer_preference_subtitle" msgid="6178138727195403796">"Korekcija boja pomaže ljudima koji su daltonisti da preciznije vide boje"</string>
     <string name="daltonizer_type_overridden" msgid="4509604753672535721">"Zamenjuje ga <xliff:g id="TITLE">%1$s</xliff:g>"</string>
     <string name="power_remaining_settings_home_page" msgid="4885165789445462557">"<xliff:g id="PERCENTAGE">%1$s</xliff:g>–<xliff:g id="TIME_STRING">%2$s</xliff:g>"</string>
     <string name="power_remaining_duration_only" msgid="8264199158671531431">"Preostalo je oko <xliff:g id="TIME_REMAINING">%1$s</xliff:g>"</string>
@@ -403,21 +431,19 @@
     <string name="power_remaining_less_than_duration" msgid="1812668275239801236">"Preostalo je manje od <xliff:g id="THRESHOLD">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_more_than_subtext" msgid="7919119719242734848">"Preostalo je više od <xliff:g id="TIME_REMAINING">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_only_more_than_subtext" msgid="3274496164769110480">"Preostalo je više od <xliff:g id="TIME_REMAINING">%1$s</xliff:g>"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="6583866940347159957">"Telefon će se uskoro isključiti"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="8009177999719462724">"Tablet će se uskoro isključiti"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="8320892540455268018">"Uređaj će se uskoro isključiti"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="6186572170809116621">"Telefon će se uskoro isključiti (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="1338758278145563121">"Tablet će se uskoro isključiti (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="3699579688084774362">"Uređaj će se uskoro isključiti (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="137330009791560774">"Telefon će se uskoro isključiti"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="145489081521468132">"Tablet će se uskoro isključiti"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="1070562682853942350">"Uređaj će se uskoro isključiti"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="4429259621177089719">"Telefon će se uskoro isključiti (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="7703677921000858479">"Tablet će se uskoro isključiti (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="4374784375644214578">"Uređaj će se uskoro isključiti (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
     <string name="power_charging" msgid="6727132649743436802">"<xliff:g id="LEVEL">%1$s</xliff:g> – <xliff:g id="STATE">%2$s</xliff:g>"</string>
     <string name="power_remaining_charging_duration_only" msgid="7415639699283965818">"Napuniće se za <xliff:g id="TIME">%1$s</xliff:g>"</string>
     <string name="power_charging_duration" msgid="5005740040558984057">"<xliff:g id="LEVEL">%1$s</xliff:g> – napuniće se za <xliff:g id="TIME">%2$s</xliff:g>"</string>
     <string name="battery_info_status_unknown" msgid="268625384868401114">"Nepoznato"</string>
     <string name="battery_info_status_charging" msgid="4279958015430387405">"Puni se"</string>
-    <!-- no translation found for battery_info_status_charging_fast (8027559755902954885) -->
-    <skip />
-    <!-- no translation found for battery_info_status_charging_slow (3190803837168962319) -->
-    <skip />
+    <string name="battery_info_status_charging_fast" msgid="8027559755902954885">"Brzo se puni"</string>
+    <string name="battery_info_status_charging_slow" msgid="3190803837168962319">"Sporo se puni"</string>
     <string name="battery_info_status_discharging" msgid="6962689305413556485">"Ne puni se"</string>
     <string name="battery_info_status_not_charging" msgid="8330015078868707899">"Priključeno je, ali punjenje trenutno nije moguće"</string>
     <string name="battery_info_status_full" msgid="4443168946046847468">"Puna"</string>
diff --git a/packages/SettingsLib/res/values-be/strings.xml b/packages/SettingsLib/res/values-be/strings.xml
index 12c21a6..f08726e 100644
--- a/packages/SettingsLib/res/values-be/strings.xml
+++ b/packages/SettingsLib/res/values-be/strings.xml
@@ -206,6 +206,33 @@
     <string name="enable_adb" msgid="8072776357237289039">"Адладка USB"</string>
     <string name="enable_adb_summary" msgid="3711526030096574316">"Рэжым адладкі, калі USB падключаны"</string>
     <string name="clear_adb_keys" msgid="3010148733140369917">"Адклікаць дазвол USB-адладкі"</string>
+    <string name="enable_adb_wireless" msgid="6973226350963971018">"Бесправадная адладка"</string>
+    <string name="enable_adb_wireless_summary" msgid="7344391423657093011">"Рэжым адладкі з падключанай сеткай Wi‑Fi"</string>
+    <string name="adb_wireless_error" msgid="721958772149779856">"Памылка"</string>
+    <string name="adb_wireless_settings" msgid="2295017847215680229">"Бесправадная адладка"</string>
+    <string name="adb_wireless_list_empty_off" msgid="1713707973837255490">"Каб праглядаць і выкарыстоўваць даступныя прылады, уключыце бесправадную адладку"</string>
+    <string name="adb_pair_method_qrcode_title" msgid="6982904096137468634">"Спалучыць прыладу з дапамогай QR-кода"</string>
+    <string name="adb_pair_method_qrcode_summary" msgid="3729901496856458634">"Спалучаць новыя прылады з дапамогай сканера QR-кода"</string>
+    <string name="adb_pair_method_code_title" msgid="1122590300445142904">"Спалучыць прыладу з дапамогай кода спалучэння"</string>
+    <string name="adb_pair_method_code_summary" msgid="6370414511333685185">"Спалучаць новыя прылады з дапамогай шасцізначнага кода"</string>
+    <string name="adb_paired_devices_title" msgid="5268997341526217362">"Спалучаныя прылады"</string>
+    <string name="adb_wireless_device_connected_summary" msgid="3039660790249148713">"Цяпер падключана"</string>
+    <string name="adb_wireless_device_details_title" msgid="7129369670526565786">"Падрабязныя звесткі пра прыладу"</string>
+    <string name="adb_device_forget" msgid="193072400783068417">"Ігнараваць"</string>
+    <string name="adb_device_fingerprint_title_format" msgid="291504822917843701">"Лічбавы адбітак прылады: <xliff:g id="FINGERPRINT_PARAM">%1$s</xliff:g>"</string>
+    <string name="adb_wireless_connection_failed_title" msgid="664211177427438438">"Не ўдалося падключыцца"</string>
+    <string name="adb_wireless_connection_failed_message" msgid="9213896700171602073">"Пераканайцеся, што прылада \"<xliff:g id="DEVICE_NAME">%1$s</xliff:g>\" падключана да правільнай сеткі"</string>
+    <string name="adb_pairing_device_dialog_title" msgid="7141739231018530210">"Спалучыць з прыладай"</string>
+    <string name="adb_pairing_device_dialog_pairing_code_label" msgid="3639239786669722731">"Код спалучэння Wi‑Fi"</string>
+    <string name="adb_pairing_device_dialog_failed_title" msgid="3426758947882091735">"Не ўдалося спалучыць"</string>
+    <string name="adb_pairing_device_dialog_failed_msg" msgid="6611097519661997148">"Пераканайцеся, што прылада падключана да той самай сеткі."</string>
+    <string name="adb_wireless_qrcode_summary" msgid="8051414549011801917">"Спалучыць прыладу праз Wi‑Fi шляхам сканіравання QR-кода"</string>
+    <string name="adb_wireless_verifying_qrcode_text" msgid="6123192424916029207">"Прылада спалучаецца…"</string>
+    <string name="adb_qrcode_pairing_device_failed_msg" msgid="6936292092592914132">"Не ўдалося спалучыць прыладу. QR-код няправільны, ці прылада падключана не да той самай сеткі."</string>
+    <string name="adb_wireless_ip_addr_preference_title" msgid="8335132107715311730">"IP-адрас і порт"</string>
+    <string name="adb_wireless_qrcode_pairing_title" msgid="1906409667944674707">"Сканіраваць QR-код"</string>
+    <string name="adb_wireless_qrcode_pairing_description" msgid="8578868049289910131">"Спалучыць прыладу праз Wi‑Fi шляхам сканіравання QR-кода"</string>
+    <string name="keywords_adb_wireless" msgid="6507505581882171240">"adb, адладка, распрацоўшчык"</string>
     <string name="bugreport_in_power" msgid="8664089072534638709">"Ярлык для справаздачы пра памылкі"</string>
     <string name="bugreport_in_power_summary" msgid="1885529649381831775">"Паказаць кнопку для прыняцця справаздачы пра памылку ў меню сілкавання"</string>
     <string name="keep_screen_on" msgid="1187161672348797558">"Прадухіляць ад пераходу ў рэжым сну"</string>
@@ -271,6 +298,8 @@
     <string name="tethering_hardware_offload_summary" msgid="7801345335142803029">"Выкарыстоўваць апаратнае паскарэнне ў рэжыме мадэма пры наяўнасці"</string>
     <string name="adb_warning_title" msgid="7708653449506485728">"Дазволіць адладку USB?"</string>
     <string name="adb_warning_message" msgid="8145270656419669221">"Адладка USB прызначана толькі для мэтаў распрацоўкі. Яна можа выкарыстоўвацца, каб капіяваць дадзеныя паміж кампутарам і прыладай, усталёўваць прыкладанні на прыладзе без папярэдняга апавяшчэння і чытаць дадзеныя дзённiка."</string>
+    <string name="adbwifi_warning_title" msgid="727104571653031865">"Дазволіць бесправадную адладку?"</string>
+    <string name="adbwifi_warning_message" msgid="8005936574322702388">"Бесправадная адладка прызначана толькі для мэт распрацоўкі. Яна можа выкарыстоўвацца, каб капіраваць даныя паміж камп\'ютарам і прыладай, усталёўваць праграмы на прыладзе без апавяшчэння і чытаць даныя журнала."</string>
     <string name="adb_keys_warning_message" msgid="2968555274488101220">"Адклікаць доступ да адладкі USB з усіх камп\'ютараў, на якiх вы уваходзiлi ў сiстэму?"</string>
     <string name="dev_settings_warning_title" msgid="8251234890169074553">"Дазволiць налады распрацоўшчыка?"</string>
     <string name="dev_settings_warning_message" msgid="37741686486073668">"Гэтыя налады прызначаны толькi для распрацоўшыкаў. Яны могуць выклікаць збоi прылад i ўсталяваных на iх прыкладанняў, а таксама перашкаджаць iх працы."</string>
@@ -383,8 +412,7 @@
     <string name="daltonizer_mode_protanomaly" msgid="7805583306666608440">"Пратанамалія (чырвоны-зялёны)"</string>
     <string name="daltonizer_mode_tritanomaly" msgid="7135266249220732267">"Трытанамалія (сіні-жоўты)"</string>
     <string name="accessibility_display_daltonizer_preference_title" msgid="1810693571332381974">"Карэкцыя колеру"</string>
-    <!-- no translation found for accessibility_display_daltonizer_preference_subtitle (6178138727195403796) -->
-    <skip />
+    <string name="accessibility_display_daltonizer_preference_subtitle" msgid="6178138727195403796">"Карэкцыя колеру дазваляе людзям з парушэннямі колеравага зроку лепш распазнаваць выявы на экране"</string>
     <string name="daltonizer_type_overridden" msgid="4509604753672535721">"Перавызначаны <xliff:g id="TITLE">%1$s</xliff:g>"</string>
     <string name="power_remaining_settings_home_page" msgid="4885165789445462557">"<xliff:g id="PERCENTAGE">%1$s</xliff:g> – <xliff:g id="TIME_STRING">%2$s</xliff:g>"</string>
     <string name="power_remaining_duration_only" msgid="8264199158671531431">"Зараду хопіць прыблізна на <xliff:g id="TIME_REMAINING">%1$s</xliff:g>"</string>
@@ -403,21 +431,19 @@
     <string name="power_remaining_less_than_duration" msgid="1812668275239801236">"Узровень зараду батарэі: <xliff:g id="LEVEL">%2$s</xliff:g> (хопіць менш чым на <xliff:g id="THRESHOLD">%1$s</xliff:g>)"</string>
     <string name="power_remaining_more_than_subtext" msgid="7919119719242734848">"Узровень зараду батарэі: <xliff:g id="LEVEL">%2$s</xliff:g> (хопіць больш чым на <xliff:g id="TIME_REMAINING">%1$s</xliff:g>)"</string>
     <string name="power_remaining_only_more_than_subtext" msgid="3274496164769110480">"Хопіць больш чым на <xliff:g id="TIME_REMAINING">%1$s</xliff:g>"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="6583866940347159957">"Тэлефон у хуткім часе спыніць працу"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="8009177999719462724">"Планшэт у хуткім часе спыніць працу"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="8320892540455268018">"Прылада ў хуткім часе спыніць працу"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="6186572170809116621">"Узровень зараду батарэі: <xliff:g id="LEVEL">%1$s</xliff:g>. Тэлефон хутка спыніць працу."</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="1338758278145563121">"Узровень зараду батарэі: <xliff:g id="LEVEL">%1$s</xliff:g>. Планшэт хутка спыніць працу."</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="3699579688084774362">"Узровень зараду батарэі: <xliff:g id="LEVEL">%1$s</xliff:g>. Прылада хутка спыніць працу."</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="137330009791560774">"Тэлефон у хуткім часе выключыцца"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="145489081521468132">"Планшэт у хуткім часе выключыцца"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="1070562682853942350">"Прылада ў хуткім часе выключыцца"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="4429259621177089719">"Тэлефон у хуткім часе выключыцца (узровень зараду: <xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="7703677921000858479">"Планшэт у хуткім часе выключыцца (узровень зараду: <xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="4374784375644214578">"Прылада ў хуткім часе выключыцца (узровень зараду: <xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
     <string name="power_charging" msgid="6727132649743436802">"<xliff:g id="LEVEL">%1$s</xliff:g> – <xliff:g id="STATE">%2$s</xliff:g>"</string>
     <string name="power_remaining_charging_duration_only" msgid="7415639699283965818">"Засталося <xliff:g id="TIME">%1$s</xliff:g> да поўнай зарадкі"</string>
     <string name="power_charging_duration" msgid="5005740040558984057">"<xliff:g id="LEVEL">%1$s</xliff:g> – <xliff:g id="TIME">%2$s</xliff:g> да поўнай зарадкі"</string>
     <string name="battery_info_status_unknown" msgid="268625384868401114">"Невядома"</string>
     <string name="battery_info_status_charging" msgid="4279958015430387405">"Зарадка"</string>
-    <!-- no translation found for battery_info_status_charging_fast (8027559755902954885) -->
-    <skip />
-    <!-- no translation found for battery_info_status_charging_slow (3190803837168962319) -->
-    <skip />
+    <string name="battery_info_status_charging_fast" msgid="8027559755902954885">"Хуткая зарадка"</string>
+    <string name="battery_info_status_charging_slow" msgid="3190803837168962319">"Павольная зарадка"</string>
     <string name="battery_info_status_discharging" msgid="6962689305413556485">"Не зараджаецца"</string>
     <string name="battery_info_status_not_charging" msgid="8330015078868707899">"Падключана да сеткі сілкавання, зарадзіць зараз немагчыма"</string>
     <string name="battery_info_status_full" msgid="4443168946046847468">"Акумулятар зараджаны"</string>
diff --git a/packages/SettingsLib/res/values-bg/strings.xml b/packages/SettingsLib/res/values-bg/strings.xml
index 6fda5b3..78ab01a 100644
--- a/packages/SettingsLib/res/values-bg/strings.xml
+++ b/packages/SettingsLib/res/values-bg/strings.xml
@@ -206,6 +206,33 @@
     <string name="enable_adb" msgid="8072776357237289039">"През USB"</string>
     <string name="enable_adb_summary" msgid="3711526030096574316">"Режим за отстраняване на грешки, когато е свързано USB"</string>
     <string name="clear_adb_keys" msgid="3010148733140369917">"Отмяна на упълномощ. за отстр. на грешки през USB"</string>
+    <string name="enable_adb_wireless" msgid="6973226350963971018">"Безжично отстраняване на грешки"</string>
+    <string name="enable_adb_wireless_summary" msgid="7344391423657093011">"Режим за отстраняване на грешки при връзка с Wi-Fi"</string>
+    <string name="adb_wireless_error" msgid="721958772149779856">"Грешка"</string>
+    <string name="adb_wireless_settings" msgid="2295017847215680229">"Безжично отстраняване на грешки"</string>
+    <string name="adb_wireless_list_empty_off" msgid="1713707973837255490">"За да виждате и използвате наличните устройства, включете функцията за отстраняване на грешки през безжична мрежа"</string>
+    <string name="adb_pair_method_qrcode_title" msgid="6982904096137468634">"Сдвояване на устройството чрез QR код"</string>
+    <string name="adb_pair_method_qrcode_summary" msgid="3729901496856458634">"Сдвояване на новите устройства чрез скенер за QR кодове"</string>
+    <string name="adb_pair_method_code_title" msgid="1122590300445142904">"Сдвояване на устройството чрез код за сдвояване"</string>
+    <string name="adb_pair_method_code_summary" msgid="6370414511333685185">"Сдвояване на новите устройства чрез шестцифрен код"</string>
+    <string name="adb_paired_devices_title" msgid="5268997341526217362">"Сдвоени устройства"</string>
+    <string name="adb_wireless_device_connected_summary" msgid="3039660790249148713">"Понастоящем свързано"</string>
+    <string name="adb_wireless_device_details_title" msgid="7129369670526565786">"Подробности за устройството"</string>
+    <string name="adb_device_forget" msgid="193072400783068417">"Забравяне"</string>
+    <string name="adb_device_fingerprint_title_format" msgid="291504822917843701">"Сензор за отпечатъци на устройството: <xliff:g id="FINGERPRINT_PARAM">%1$s</xliff:g>"</string>
+    <string name="adb_wireless_connection_failed_title" msgid="664211177427438438">"Връзката не е успешна"</string>
+    <string name="adb_wireless_connection_failed_message" msgid="9213896700171602073">"Проверете дали устройството „<xliff:g id="DEVICE_NAME">%1$s</xliff:g>“ е свързано с правилната мрежа"</string>
+    <string name="adb_pairing_device_dialog_title" msgid="7141739231018530210">"Сдвояване с устройство"</string>
+    <string name="adb_pairing_device_dialog_pairing_code_label" msgid="3639239786669722731">"Код за сдвояване през Wi‑Fi"</string>
+    <string name="adb_pairing_device_dialog_failed_title" msgid="3426758947882091735">"Сдвояването не е успешно"</string>
+    <string name="adb_pairing_device_dialog_failed_msg" msgid="6611097519661997148">"Уверете се, че устройството е свързано със същата мрежа."</string>
+    <string name="adb_wireless_qrcode_summary" msgid="8051414549011801917">"Сдвояване на устройството през Wi‑Fi чрез сканиране на QR код"</string>
+    <string name="adb_wireless_verifying_qrcode_text" msgid="6123192424916029207">"Устройството се сдвоява…"</string>
+    <string name="adb_qrcode_pairing_device_failed_msg" msgid="6936292092592914132">"Сдвояването на устройството не бе успешно. QR кодът е неправилен или устройството не е свързано със същата мрежа."</string>
+    <string name="adb_wireless_ip_addr_preference_title" msgid="8335132107715311730">"IP адрес и порт"</string>
+    <string name="adb_wireless_qrcode_pairing_title" msgid="1906409667944674707">"Сканиране на QR код"</string>
+    <string name="adb_wireless_qrcode_pairing_description" msgid="8578868049289910131">"Сдвояване на устройството през Wi‑Fi чрез сканиране на QR код"</string>
+    <string name="keywords_adb_wireless" msgid="6507505581882171240">"adb, отстраняване на грешки, програмиране"</string>
     <string name="bugreport_in_power" msgid="8664089072534638709">"Пряк път за сигнал за програмна грешка"</string>
     <string name="bugreport_in_power_summary" msgid="1885529649381831775">"В менюто за захранване да се показва бутон за подаване на сигнал за програмна грешка"</string>
     <string name="keep_screen_on" msgid="1187161672348797558">"Да остане активен"</string>
@@ -271,6 +298,8 @@
     <string name="tethering_hardware_offload_summary" msgid="7801345335142803029">"Да се използва хардуерно ускорение на тетъринга, ако е налице"</string>
     <string name="adb_warning_title" msgid="7708653449506485728">"Разрешаване на отстраняването на грешки през USB?"</string>
     <string name="adb_warning_message" msgid="8145270656419669221">"Отстраняването на грешки през USB е предназначено само за програмни цели. Използвайте го за копиране на данни между компютъра и устройството си, за инсталиране на приложения на устройството си без известяване и за четене на регистрационни данни."</string>
+    <string name="adbwifi_warning_title" msgid="727104571653031865">"Да се разреши ли отстраняването на грешки през безжична мрежа?"</string>
+    <string name="adbwifi_warning_message" msgid="8005936574322702388">"Отстраняването на грешки през безжична мрежа е предназначено само за програмни цели. Използвайте го за копиране на данни между компютъра и устройството си, за инсталиране на приложения на устройството си без известяване и за четене на регистрационни данни."</string>
     <string name="adb_keys_warning_message" msgid="2968555274488101220">"Да се отмени ли достъпът до отстраняването на грешки през USB от всички по-рано упълномощени от вас компютри?"</string>
     <string name="dev_settings_warning_title" msgid="8251234890169074553">"Да се разрешат ли настройките за програмиране?"</string>
     <string name="dev_settings_warning_message" msgid="37741686486073668">"Тези настройки са предназначени само за програмиране. Те могат да доведат до прекъсване на работата или неправилно функциониране на устройството ви и приложенията в него."</string>
@@ -383,8 +412,7 @@
     <string name="daltonizer_mode_protanomaly" msgid="7805583306666608440">"Протаномалия (червено – зелено)"</string>
     <string name="daltonizer_mode_tritanomaly" msgid="7135266249220732267">"Тританомалия (синьо – жълто)"</string>
     <string name="accessibility_display_daltonizer_preference_title" msgid="1810693571332381974">"Корекция на цветове"</string>
-    <!-- no translation found for accessibility_display_daltonizer_preference_subtitle (6178138727195403796) -->
-    <skip />
+    <string name="accessibility_display_daltonizer_preference_subtitle" msgid="6178138727195403796">"Коригирането на цветовете помага на хората с цветна слепота да виждат по-точни цветове"</string>
     <string name="daltonizer_type_overridden" msgid="4509604753672535721">"Заменено от „<xliff:g id="TITLE">%1$s</xliff:g>“"</string>
     <string name="power_remaining_settings_home_page" msgid="4885165789445462557">"<xliff:g id="PERCENTAGE">%1$s</xliff:g> – <xliff:g id="TIME_STRING">%2$s</xliff:g>"</string>
     <string name="power_remaining_duration_only" msgid="8264199158671531431">"Още около <xliff:g id="TIME_REMAINING">%1$s</xliff:g>"</string>
@@ -403,21 +431,19 @@
     <string name="power_remaining_less_than_duration" msgid="1812668275239801236">"Остава/т по-малко от <xliff:g id="THRESHOLD">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_more_than_subtext" msgid="7919119719242734848">"Остава/т повече от <xliff:g id="TIME_REMAINING">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_only_more_than_subtext" msgid="3274496164769110480">"Остава/т повече от <xliff:g id="TIME_REMAINING">%1$s</xliff:g>"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="6583866940347159957">"Възможно е телефонът да се изключи скоро"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="8009177999719462724">"Възможно е таблетът да се изключи скоро"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="8320892540455268018">"Възможно е устройството да се изключи скоро"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="6186572170809116621">"Възможно е телефонът да се изключи скоро (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="1338758278145563121">"Възможно е таблетът да се изключи скоро (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="3699579688084774362">"Възможно е устройството да се изключи скоро (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="137330009791560774">"Възможно е телефонът да се изключи скоро"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="145489081521468132">"Възможно е таблетът да се изключи скоро"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="1070562682853942350">"Възможно е устройството да се изключи скоро"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="4429259621177089719">"Възможно е телефонът да се изключи скоро (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="7703677921000858479">"Възможно е таблетът да се изключи скоро (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="4374784375644214578">"Възможно е устройството да се изключи скоро (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
     <string name="power_charging" msgid="6727132649743436802">"<xliff:g id="LEVEL">%1$s</xliff:g> – <xliff:g id="STATE">%2$s</xliff:g>"</string>
     <string name="power_remaining_charging_duration_only" msgid="7415639699283965818">"Оставащо време до пълно зареждане: <xliff:g id="TIME">%1$s</xliff:g>"</string>
     <string name="power_charging_duration" msgid="5005740040558984057">"<xliff:g id="LEVEL">%1$s</xliff:g> – <xliff:g id="TIME">%2$s</xliff:g> до пълно зареждане"</string>
     <string name="battery_info_status_unknown" msgid="268625384868401114">"Неизвестно"</string>
     <string name="battery_info_status_charging" msgid="4279958015430387405">"Зарежда се"</string>
-    <!-- no translation found for battery_info_status_charging_fast (8027559755902954885) -->
-    <skip />
-    <!-- no translation found for battery_info_status_charging_slow (3190803837168962319) -->
-    <skip />
+    <string name="battery_info_status_charging_fast" msgid="8027559755902954885">"Зарежда се бързо"</string>
+    <string name="battery_info_status_charging_slow" msgid="3190803837168962319">"Зарежда се бавно"</string>
     <string name="battery_info_status_discharging" msgid="6962689305413556485">"Не се зарежда"</string>
     <string name="battery_info_status_not_charging" msgid="8330015078868707899">"Включена в захранването, в момента не се зарежда"</string>
     <string name="battery_info_status_full" msgid="4443168946046847468">"Пълна"</string>
diff --git a/packages/SettingsLib/res/values-bn/strings.xml b/packages/SettingsLib/res/values-bn/strings.xml
index be2d1e0..15ebfb8 100644
--- a/packages/SettingsLib/res/values-bn/strings.xml
+++ b/packages/SettingsLib/res/values-bn/strings.xml
@@ -206,6 +206,33 @@
     <string name="enable_adb" msgid="8072776357237289039">"USB ডিবাগিং"</string>
     <string name="enable_adb_summary" msgid="3711526030096574316">"USB কানেক্ট থাকাকালীন ডিবাগ মোড"</string>
     <string name="clear_adb_keys" msgid="3010148733140369917">"USB ডিবাগিং অনুমতিগুলি প্রত্যাহার করুন"</string>
+    <string name="enable_adb_wireless" msgid="6973226350963971018">"ওয়্যারলেস ডিবাগিং"</string>
+    <string name="enable_adb_wireless_summary" msgid="7344391423657093011">"ওয়াই-ফাই কানেক্ট থাকাকালীন ডিবাগ মোড"</string>
+    <string name="adb_wireless_error" msgid="721958772149779856">"সমস্যা"</string>
+    <string name="adb_wireless_settings" msgid="2295017847215680229">"ওয়্যারলেস ডিবাগিং"</string>
+    <string name="adb_wireless_list_empty_off" msgid="1713707973837255490">"কোন কোন ডিভাইস উপলভ্য আছে তা দেখে নিয়ে ব্যবহার করার জন্য, ওয়্যারলেস ডিবাগিং চালু করুন"</string>
+    <string name="adb_pair_method_qrcode_title" msgid="6982904096137468634">"QR কোড ব্যবহার করে ডিভাইস যোগ করুন"</string>
+    <string name="adb_pair_method_qrcode_summary" msgid="3729901496856458634">"QR কোড স্ক্যানার ব্যবহার করে নতুন ডিভাইস যোগ করুন"</string>
+    <string name="adb_pair_method_code_title" msgid="1122590300445142904">"যোগ করার কোড ব্যবহার করে ডিভাইস যোগ করুন"</string>
+    <string name="adb_pair_method_code_summary" msgid="6370414511333685185">"ছয় সংখ্যার কোড ব্যবহার করে নতুন ডিভাইস যোগ করুন"</string>
+    <string name="adb_paired_devices_title" msgid="5268997341526217362">"যোগ করা ডিভাইস"</string>
+    <string name="adb_wireless_device_connected_summary" msgid="3039660790249148713">"এখন কানেক্ট রয়েছে"</string>
+    <string name="adb_wireless_device_details_title" msgid="7129369670526565786">"ডিভাইসের বিবরণ"</string>
+    <string name="adb_device_forget" msgid="193072400783068417">"ভুলে যান"</string>
+    <string name="adb_device_fingerprint_title_format" msgid="291504822917843701">"ডিভাইসে আঙ্গুলের ছাপ: <xliff:g id="FINGERPRINT_PARAM">%1$s</xliff:g>"</string>
+    <string name="adb_wireless_connection_failed_title" msgid="664211177427438438">"কানেক্ট করা যায়নি"</string>
+    <string name="adb_wireless_connection_failed_message" msgid="9213896700171602073">"<xliff:g id="DEVICE_NAME">%1$s</xliff:g>টি সঠিক নেটওয়ার্কে কানেক্ট আছে কিনা দেখে নিন"</string>
+    <string name="adb_pairing_device_dialog_title" msgid="7141739231018530210">"ডিভাইসের সাথে যোগ করুন"</string>
+    <string name="adb_pairing_device_dialog_pairing_code_label" msgid="3639239786669722731">"ওয়াই-ফাই যোগ করার কোড"</string>
+    <string name="adb_pairing_device_dialog_failed_title" msgid="3426758947882091735">"যোগ করা যায়নি"</string>
+    <string name="adb_pairing_device_dialog_failed_msg" msgid="6611097519661997148">"ডিভাইসটি একই নেটওয়ার্কে কানেক্ট আছে কিনা দেখে নিন।"</string>
+    <string name="adb_wireless_qrcode_summary" msgid="8051414549011801917">"QR কোড স্ক্যান করে ওয়াই-ফাই ব্যবহার করে ডিভাইস যোগ করুন"</string>
+    <string name="adb_wireless_verifying_qrcode_text" msgid="6123192424916029207">"ডিভাইস যোগ করা হচ্ছে…"</string>
+    <string name="adb_qrcode_pairing_device_failed_msg" msgid="6936292092592914132">"ডিভাইস যোগ করা যায়নি। এটি দুটি কারণে হয়ে থাকে - QR কোডটি সঠিক নয় বা ডিভাইসটি একই নেটওয়ার্কে কানেক্ট করা নেই।"</string>
+    <string name="adb_wireless_ip_addr_preference_title" msgid="8335132107715311730">"IP অ্যাড্রেস ও পোর্ট"</string>
+    <string name="adb_wireless_qrcode_pairing_title" msgid="1906409667944674707">"QR কোড স্ক্যান করুন"</string>
+    <string name="adb_wireless_qrcode_pairing_description" msgid="8578868049289910131">"QR কোড স্ক্যান করে ওয়াই-ফাই ব্যবহার করে ডিভাইস যোগ করুন"</string>
+    <string name="keywords_adb_wireless" msgid="6507505581882171240">"adb, debug, dev"</string>
     <string name="bugreport_in_power" msgid="8664089072534638709">"ত্রুটি প্রতিবেদনের শর্টকাট"</string>
     <string name="bugreport_in_power_summary" msgid="1885529649381831775">"সমস্যার তথ্য ক্যাপচার করতে পাওয়ার মেনুতে একটি বোতাম দেখান"</string>
     <string name="keep_screen_on" msgid="1187161672348797558">"জাগিয়ে রাখুন"</string>
@@ -271,6 +298,8 @@
     <string name="tethering_hardware_offload_summary" msgid="7801345335142803029">"টিথারিং হার্ডওয়্যার অ্যাক্সিলারেশন উপলভ্য থাকলে ব্যবহার করুন"</string>
     <string name="adb_warning_title" msgid="7708653449506485728">"USB ডিবাগিং মঞ্জুর করবেন?"</string>
     <string name="adb_warning_message" msgid="8145270656419669221">"USB ডিবাগিং কেবলমাত্র বিকাশ করার উদ্দেশ্যে। আপনার কম্পিউটার এবং আপনার ডিভাইসের মধ্যে ডেটা অনুলিপি করতে এটি ব্যবহার করুন, বিজ্ঞপ্তি ছাড়া আপনার ডিভাইসে অ্যাপ্লিকেশানগুলি ইনস্টল করুন এবং ডেটা লগ পড়ুন।"</string>
+    <string name="adbwifi_warning_title" msgid="727104571653031865">"ওয়্যারলেস ডিবাগিং-এর অনুমতি দেবেন?"</string>
+    <string name="adbwifi_warning_message" msgid="8005936574322702388">"ওয়্যারলেস ডিবাগিং কেবলমাত্র বিকাশ করার উদ্দেশ্যে। আপনার কম্পিউটার এবং আপনার ডিভাইসের মধ্যে ডেটা কপি করতে এটি ব্যবহার করুন, বিজ্ঞপ্তি ছাড়া আপনার ডিভাইসে অ্যাপ ইনস্টল করুন এবং ডেটা লগ পড়ুন।"</string>
     <string name="adb_keys_warning_message" msgid="2968555274488101220">"আপনি আগে যে সব কম্পিউটার USB ডিবাগিং এর অ্যাক্সেসের অনুমতি দিয়েছিলেন তা প্রত্যাহার করবেন?"</string>
     <string name="dev_settings_warning_title" msgid="8251234890169074553">"উন্নতি সেটিংসের অনুমতি দেবেন?"</string>
     <string name="dev_settings_warning_message" msgid="37741686486073668">"এইসব সেটিংস কেবলমাত্র উন্নত করার উদ্দেশ্য। সেগুলি কারণে আপনার ডিভাইস ভেঙ্গে এবং অ্যাপ্লিকেশানগুলি ভালো ভাবে কাজ করা নাও কারতে পারে।"</string>
@@ -383,8 +412,7 @@
     <string name="daltonizer_mode_protanomaly" msgid="7805583306666608440">"প্রোটানোম্যালি (লাল-সবুজ)"</string>
     <string name="daltonizer_mode_tritanomaly" msgid="7135266249220732267">"ট্রিট্যানোম্যালি (নীল-হলুদ)"</string>
     <string name="accessibility_display_daltonizer_preference_title" msgid="1810693571332381974">"রঙ সংশোধন"</string>
-    <!-- no translation found for accessibility_display_daltonizer_preference_subtitle (6178138727195403796) -->
-    <skip />
+    <string name="accessibility_display_daltonizer_preference_subtitle" msgid="6178138727195403796">"রঙ অ্যাডজাস্ট করার সেটিংস, বর্ণান্ধতা আছে এমন ব্যক্তিদের আরও সঠিকভাবে রঙ দেখতে সাহায্য করে"</string>
     <string name="daltonizer_type_overridden" msgid="4509604753672535721">"<xliff:g id="TITLE">%1$s</xliff:g> এর দ্বারা ওভাররাইড করা হয়েছে"</string>
     <string name="power_remaining_settings_home_page" msgid="4885165789445462557">"<xliff:g id="PERCENTAGE">%1$s</xliff:g> - <xliff:g id="TIME_STRING">%2$s</xliff:g>"</string>
     <string name="power_remaining_duration_only" msgid="8264199158671531431">"আর আনুমানিক <xliff:g id="TIME_REMAINING">%1$s</xliff:g> চলবে"</string>
@@ -403,21 +431,19 @@
     <string name="power_remaining_less_than_duration" msgid="1812668275239801236">"আর <xliff:g id="THRESHOLD">%1$s</xliff:g>-এর কম চার্জ বাকি আছে (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_more_than_subtext" msgid="7919119719242734848">"আরও <xliff:g id="TIME_REMAINING">%1$s</xliff:g>-এর বেশি চলবে (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_only_more_than_subtext" msgid="3274496164769110480">"আরও <xliff:g id="TIME_REMAINING">%1$s</xliff:g>-এর বেশি চলবে"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="6583866940347159957">"ফোনটি শীঘ্রই বন্ধ হয়ে যেতে পারে"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="8009177999719462724">"ট্যাবলেটটি শীঘ্রই বন্ধ হয়ে যেতে পারে"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="8320892540455268018">"ডিভাইসটি শীঘ্রই বন্ধ হয়ে যেতে পারে"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="6186572170809116621">"ফোনটি শীঘ্রই বন্ধ হয়ে যেতে পারে (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="1338758278145563121">"ট্যাবলেটটি শীঘ্রই বন্ধ হয়ে যেতে পারে (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="3699579688084774362">"ডিভাইসটি শীঘ্রই বন্ধ হয়ে যেতে পারে (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="137330009791560774">"ফোন শীঘ্রই বন্ধ হয়ে যেতে পারে"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="145489081521468132">"ট্যাবলেটটি শীঘ্রই বন্ধ হয়ে যেতে পারে"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="1070562682853942350">"ডিভাইসটি শীঘ্রই বন্ধ হয়ে যেতে পারে"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="4429259621177089719">"ফোনটি শীঘ্রই বন্ধ হয়ে যেতে পারে (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="7703677921000858479">"ট্যাবলেটটি শীঘ্রই বন্ধ হয়ে যেতে পারে (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="4374784375644214578">"ডিভাইসটি শীঘ্রই বন্ধ হয়ে যেতে পারে (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
     <string name="power_charging" msgid="6727132649743436802">"<xliff:g id="LEVEL">%1$s</xliff:g> - <xliff:g id="STATE">%2$s</xliff:g>"</string>
     <string name="power_remaining_charging_duration_only" msgid="7415639699283965818">"সম্পূর্ণ চার্জ হতে <xliff:g id="TIME">%1$s</xliff:g> বাকি আছে"</string>
     <string name="power_charging_duration" msgid="5005740040558984057">"<xliff:g id="LEVEL">%1$s</xliff:g> - <xliff:g id="TIME">%2$s</xliff:g>-এ সম্পূর্ণ চার্জ হয়ে যাবে"</string>
     <string name="battery_info_status_unknown" msgid="268625384868401114">"অজানা"</string>
     <string name="battery_info_status_charging" msgid="4279958015430387405">"চার্জ হচ্ছে"</string>
-    <!-- no translation found for battery_info_status_charging_fast (8027559755902954885) -->
-    <skip />
-    <!-- no translation found for battery_info_status_charging_slow (3190803837168962319) -->
-    <skip />
+    <string name="battery_info_status_charging_fast" msgid="8027559755902954885">"দ্রুত চার্জ হচ্ছে"</string>
+    <string name="battery_info_status_charging_slow" msgid="3190803837168962319">"ধীরে চার্জ হচ্ছে"</string>
     <string name="battery_info_status_discharging" msgid="6962689305413556485">"চার্জ হচ্ছে না"</string>
     <string name="battery_info_status_not_charging" msgid="8330015078868707899">"প্লাগ-ইন করা হয়েছে কিন্তু এখনই চার্জ করা যাবে না"</string>
     <string name="battery_info_status_full" msgid="4443168946046847468">"পূর্ণ"</string>
diff --git a/packages/SettingsLib/res/values-bs/strings.xml b/packages/SettingsLib/res/values-bs/strings.xml
index c32df18..cb55c5d 100644
--- a/packages/SettingsLib/res/values-bs/strings.xml
+++ b/packages/SettingsLib/res/values-bs/strings.xml
@@ -206,6 +206,33 @@
     <string name="enable_adb" msgid="8072776357237289039">"Otklanjanje grešaka putem uređaja spojenog na USB"</string>
     <string name="enable_adb_summary" msgid="3711526030096574316">"Način rada za uklanjanje grešaka kada je povezan USB"</string>
     <string name="clear_adb_keys" msgid="3010148733140369917">"Ukini odobrenja otklanjanja grešaka putem uređaja spojenog na USB"</string>
+    <string name="enable_adb_wireless" msgid="6973226350963971018">"Bežično otklanjanje grešaka"</string>
+    <string name="enable_adb_wireless_summary" msgid="7344391423657093011">"Način rada otklanjanja grešaka kada je WiFi mreža povezana"</string>
+    <string name="adb_wireless_error" msgid="721958772149779856">"Greška"</string>
+    <string name="adb_wireless_settings" msgid="2295017847215680229">"Bežično otklanjanje grešaka"</string>
+    <string name="adb_wireless_list_empty_off" msgid="1713707973837255490">"Da vidite i koristite dostupne uređaje, uključite otklanjanje grešaka putem bežične veze"</string>
+    <string name="adb_pair_method_qrcode_title" msgid="6982904096137468634">"Uparite uređaj pomoću QR koda"</string>
+    <string name="adb_pair_method_qrcode_summary" msgid="3729901496856458634">"Uparite nove uređaje pomoću skenera QR koda"</string>
+    <string name="adb_pair_method_code_title" msgid="1122590300445142904">"Uparite uređaj pomoću koda za uparivanje"</string>
+    <string name="adb_pair_method_code_summary" msgid="6370414511333685185">"Uparite nove uređaje pomoću šestocifrenog koda"</string>
+    <string name="adb_paired_devices_title" msgid="5268997341526217362">"Upareni uređaji"</string>
+    <string name="adb_wireless_device_connected_summary" msgid="3039660790249148713">"Trenutno povezano"</string>
+    <string name="adb_wireless_device_details_title" msgid="7129369670526565786">"Detalji o uređaju"</string>
+    <string name="adb_device_forget" msgid="193072400783068417">"Zaboravi"</string>
+    <string name="adb_device_fingerprint_title_format" msgid="291504822917843701">"Otisak prsta uređaja: <xliff:g id="FINGERPRINT_PARAM">%1$s</xliff:g>"</string>
+    <string name="adb_wireless_connection_failed_title" msgid="664211177427438438">"Povezivanje nije uspjelo"</string>
+    <string name="adb_wireless_connection_failed_message" msgid="9213896700171602073">"Provjerite je li uređaj <xliff:g id="DEVICE_NAME">%1$s</xliff:g> povezan na odgovarajuću mrežu"</string>
+    <string name="adb_pairing_device_dialog_title" msgid="7141739231018530210">"Uparite s uređajem"</string>
+    <string name="adb_pairing_device_dialog_pairing_code_label" msgid="3639239786669722731">"Kôd za uparivanje putem WiFi-ja"</string>
+    <string name="adb_pairing_device_dialog_failed_title" msgid="3426758947882091735">"Uparivanje nije uspjelo"</string>
+    <string name="adb_pairing_device_dialog_failed_msg" msgid="6611097519661997148">"Provjerite je li uređaj povezan na istu mrežu."</string>
+    <string name="adb_wireless_qrcode_summary" msgid="8051414549011801917">"Uparite uređaj putem WiFi-ja skeniranjem QR koda"</string>
+    <string name="adb_wireless_verifying_qrcode_text" msgid="6123192424916029207">"Uparivanje uređaja…"</string>
+    <string name="adb_qrcode_pairing_device_failed_msg" msgid="6936292092592914132">"Uparivanje uređaja nije uspjelo. QR kȏd nije tačan ili uređaj nije povezan na istu mrežu."</string>
+    <string name="adb_wireless_ip_addr_preference_title" msgid="8335132107715311730">"IP adresa i priključak"</string>
+    <string name="adb_wireless_qrcode_pairing_title" msgid="1906409667944674707">"Skenirajte QR kôd"</string>
+    <string name="adb_wireless_qrcode_pairing_description" msgid="8578868049289910131">"Uparite uređaj putem WiFi-ja skeniranjem QR koda"</string>
+    <string name="keywords_adb_wireless" msgid="6507505581882171240">"adb, otklanjanje grešaka, programer"</string>
     <string name="bugreport_in_power" msgid="8664089072534638709">"Prečica za izvještaj o greškama"</string>
     <string name="bugreport_in_power_summary" msgid="1885529649381831775">"Prikaz dugmeta za prijavu grešaka u meniju napajanja"</string>
     <string name="keep_screen_on" msgid="1187161672348797558">"Ne zaključavaj ekran"</string>
@@ -271,6 +298,8 @@
     <string name="tethering_hardware_offload_summary" msgid="7801345335142803029">"Korištenje hardverskog ubrzavanja za povezivanje putem mobitela ako je dostupno"</string>
     <string name="adb_warning_title" msgid="7708653449506485728">"Omogućiti otklanjanje grešaka putem uređaja spojenog na USB?"</string>
     <string name="adb_warning_message" msgid="8145270656419669221">"Otklanjanje grešaka putem uređaja spojenog na USB je namijenjeno samo u svrhe razvoja aplikacija. Koristite ga za kopiranje podataka između računara i uređaja, instaliranje aplikacija na uređaj bez obavještenja te čitanje podataka iz zapisnika."</string>
+    <string name="adbwifi_warning_title" msgid="727104571653031865">"Omogućiti bežično otklanjanje grešaka?"</string>
+    <string name="adbwifi_warning_message" msgid="8005936574322702388">"Bežično otklanjanje grešaka je namijenjeno samo u svrhe razvoja aplikacija. Koristite ga za kopiranje podataka između računara i uređaja, instaliranje aplikacija na uređaj bez obavještenja te čitanje podataka iz zapisnika."</string>
     <string name="adb_keys_warning_message" msgid="2968555274488101220">"Opozvati pristup otklanjanju grešaka putem uređaja spojenog na USB za sve računare koje ste prethodno ovlastili?"</string>
     <string name="dev_settings_warning_title" msgid="8251234890169074553">"Dopustiti postavke za razvoj?"</string>
     <string name="dev_settings_warning_message" msgid="37741686486073668">"Ove postavke su namijenjene samo za svrhe razvoja. Mogu izazvati pogrešno ponašanje uređaja i aplikacija na njemu."</string>
@@ -383,8 +412,7 @@
     <string name="daltonizer_mode_protanomaly" msgid="7805583306666608440">"Protanomalija (crveno-zeleno)"</string>
     <string name="daltonizer_mode_tritanomaly" msgid="7135266249220732267">"Tritanomalija (plavo-žuto)"</string>
     <string name="accessibility_display_daltonizer_preference_title" msgid="1810693571332381974">"Ispravka boje"</string>
-    <!-- no translation found for accessibility_display_daltonizer_preference_subtitle (6178138727195403796) -->
-    <skip />
+    <string name="accessibility_display_daltonizer_preference_subtitle" msgid="6178138727195403796">"Ispravka boje pomaže daltonistima da preciznije vide boje"</string>
     <string name="daltonizer_type_overridden" msgid="4509604753672535721">"Zamjenjuje <xliff:g id="TITLE">%1$s</xliff:g>"</string>
     <string name="power_remaining_settings_home_page" msgid="4885165789445462557">"<xliff:g id="PERCENTAGE">%1$s</xliff:g> – <xliff:g id="TIME_STRING">%2$s</xliff:g>"</string>
     <string name="power_remaining_duration_only" msgid="8264199158671531431">"Preostalo je još oko <xliff:g id="TIME_REMAINING">%1$s</xliff:g>"</string>
@@ -403,21 +431,19 @@
     <string name="power_remaining_less_than_duration" msgid="1812668275239801236">"Preostalo je manje od <xliff:g id="THRESHOLD">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_more_than_subtext" msgid="7919119719242734848">"Preostalo je više od <xliff:g id="TIME_REMAINING">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_only_more_than_subtext" msgid="3274496164769110480">"Preostalo je više od: <xliff:g id="TIME_REMAINING">%1$s</xliff:g>"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="6583866940347159957">"Telefon će se uskoro isključiti"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="8009177999719462724">"Tablet će se uskoro isključiti"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="8320892540455268018">"Uređaj će se uskoro isključiti"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="6186572170809116621">"Telefon će se uskoro isključiti (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="1338758278145563121">"Tablet će se uskoro isključiti (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="3699579688084774362">"Uređaj će se uskoro isključiti (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="137330009791560774">"Telefon će se uskoro isključiti"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="145489081521468132">"Tablet će se uskoro isključiti"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="1070562682853942350">"Uređaj će se uskoro isključiti"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="4429259621177089719">"Telefon će se uskoro isključiti (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="7703677921000858479">"Tablet će se uskoro isključiti (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="4374784375644214578">"Uređaj će se uskoro isključiti (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
     <string name="power_charging" msgid="6727132649743436802">"<xliff:g id="LEVEL">%1$s</xliff:g> – <xliff:g id="STATE">%2$s</xliff:g>"</string>
     <string name="power_remaining_charging_duration_only" msgid="7415639699283965818">"Napunit će se za <xliff:g id="TIME">%1$s</xliff:g>"</string>
     <string name="power_charging_duration" msgid="5005740040558984057">"<xliff:g id="LEVEL">%1$s</xliff:g> – napunit će se za <xliff:g id="TIME">%2$s</xliff:g>"</string>
     <string name="battery_info_status_unknown" msgid="268625384868401114">"Nepoznato"</string>
     <string name="battery_info_status_charging" msgid="4279958015430387405">"Punjenje"</string>
-    <!-- no translation found for battery_info_status_charging_fast (8027559755902954885) -->
-    <skip />
-    <!-- no translation found for battery_info_status_charging_slow (3190803837168962319) -->
-    <skip />
+    <string name="battery_info_status_charging_fast" msgid="8027559755902954885">"Brzo punjenje"</string>
+    <string name="battery_info_status_charging_slow" msgid="3190803837168962319">"Sporo punjenje"</string>
     <string name="battery_info_status_discharging" msgid="6962689305413556485">"Ne puni se"</string>
     <string name="battery_info_status_not_charging" msgid="8330015078868707899">"Priključen, trenutno se ne može puniti"</string>
     <string name="battery_info_status_full" msgid="4443168946046847468">"Puna"</string>
diff --git a/packages/SettingsLib/res/values-ca/strings.xml b/packages/SettingsLib/res/values-ca/strings.xml
index 813fff4..7ac03aa 100644
--- a/packages/SettingsLib/res/values-ca/strings.xml
+++ b/packages/SettingsLib/res/values-ca/strings.xml
@@ -206,6 +206,33 @@
     <string name="enable_adb" msgid="8072776357237289039">"Depuració per USB"</string>
     <string name="enable_adb_summary" msgid="3711526030096574316">"Mode de depuració quan l\'USB està connectat"</string>
     <string name="clear_adb_keys" msgid="3010148733140369917">"Revoca autoritzacions de depuració per USB"</string>
+    <string name="enable_adb_wireless" msgid="6973226350963971018">"Depuració sense fil"</string>
+    <string name="enable_adb_wireless_summary" msgid="7344391423657093011">"Mode de depuració quan la Wi‑Fi està connectada"</string>
+    <string name="adb_wireless_error" msgid="721958772149779856">"Error"</string>
+    <string name="adb_wireless_settings" msgid="2295017847215680229">"Depuració sense fil"</string>
+    <string name="adb_wireless_list_empty_off" msgid="1713707973837255490">"Per veure i utilitzar els dispositius disponibles, activa la depuració sense fil"</string>
+    <string name="adb_pair_method_qrcode_title" msgid="6982904096137468634">"Vincula el dispositiu amb un codi QR"</string>
+    <string name="adb_pair_method_qrcode_summary" msgid="3729901496856458634">"Vincula dispositius nous utilitzant l\'escàner de codis QR"</string>
+    <string name="adb_pair_method_code_title" msgid="1122590300445142904">"Vincula el dispositiu amb un codi de vinculació"</string>
+    <string name="adb_pair_method_code_summary" msgid="6370414511333685185">"Vincula dispositius nous utilitzant un codi de sis dígits"</string>
+    <string name="adb_paired_devices_title" msgid="5268997341526217362">"Dispositius vinculats"</string>
+    <string name="adb_wireless_device_connected_summary" msgid="3039660790249148713">"Connectat actualment"</string>
+    <string name="adb_wireless_device_details_title" msgid="7129369670526565786">"Dades del dispositiu"</string>
+    <string name="adb_device_forget" msgid="193072400783068417">"Oblida"</string>
+    <string name="adb_device_fingerprint_title_format" msgid="291504822917843701">"Empremta digital del dispositiu: <xliff:g id="FINGERPRINT_PARAM">%1$s</xliff:g>"</string>
+    <string name="adb_wireless_connection_failed_title" msgid="664211177427438438">"No s\'ha pogut connectar"</string>
+    <string name="adb_wireless_connection_failed_message" msgid="9213896700171602073">"Assegura\'t que <xliff:g id="DEVICE_NAME">%1$s</xliff:g> estigui connectat a la xarxa correcta"</string>
+    <string name="adb_pairing_device_dialog_title" msgid="7141739231018530210">"Vincular amb el dispositiu"</string>
+    <string name="adb_pairing_device_dialog_pairing_code_label" msgid="3639239786669722731">"Codi de vinculació Wi‑Fi"</string>
+    <string name="adb_pairing_device_dialog_failed_title" msgid="3426758947882091735">"No s\'ha pogut vincular"</string>
+    <string name="adb_pairing_device_dialog_failed_msg" msgid="6611097519661997148">"Assegura\'t que el dispositiu estigui connectat a la mateixa xarxa."</string>
+    <string name="adb_wireless_qrcode_summary" msgid="8051414549011801917">"Vincula el dispositiu per Wi‑Fi escanejant un codi QR"</string>
+    <string name="adb_wireless_verifying_qrcode_text" msgid="6123192424916029207">"S\'està vinculant el dispositiu…"</string>
+    <string name="adb_qrcode_pairing_device_failed_msg" msgid="6936292092592914132">"No s\'ha pogut vincular el dispositiu. O bé el codi QR és incorrecte, o bé el dispositiu no està connectat a la mateixa xarxa."</string>
+    <string name="adb_wireless_ip_addr_preference_title" msgid="8335132107715311730">"Adreça IP i port"</string>
+    <string name="adb_wireless_qrcode_pairing_title" msgid="1906409667944674707">"Escaneja un codi QR"</string>
+    <string name="adb_wireless_qrcode_pairing_description" msgid="8578868049289910131">"Vincula el dispositiu per Wi‑Fi escanejant un codi QR"</string>
+    <string name="keywords_adb_wireless" msgid="6507505581882171240">"adb, depurar, desenvolupador"</string>
     <string name="bugreport_in_power" msgid="8664089072534638709">"Drecera per a informe d\'errors"</string>
     <string name="bugreport_in_power_summary" msgid="1885529649381831775">"Mostra un botó al menú d\'engegada per crear un informe d\'errors"</string>
     <string name="keep_screen_on" msgid="1187161672348797558">"Pantalla activa"</string>
@@ -271,6 +298,8 @@
     <string name="tethering_hardware_offload_summary" msgid="7801345335142803029">"Fes servir l\'acceleració per maquinari per a compartició de xarxa, si està disponible"</string>
     <string name="adb_warning_title" msgid="7708653449506485728">"Voleu permetre la depuració per USB?"</string>
     <string name="adb_warning_message" msgid="8145270656419669221">"La depuració per USB només està indicada per a activitats de desenvolupament. Fes-la servir intercanviar dades entre l\'ordinador i el dispositiu, per instal·lar aplicacions al dispositiu sense rebre notificacions i per llegir dades de registre."</string>
+    <string name="adbwifi_warning_title" msgid="727104571653031865">"Vols permetre la depuració sense fil?"</string>
+    <string name="adbwifi_warning_message" msgid="8005936574322702388">"La depuració sense fil només està indicada per a activitats de desenvolupament. Fes-la servir per intercanviar dades entre l\'ordinador i el dispositiu, per instal·lar aplicacions al dispositiu sense rebre notificacions i per llegir dades de registre."</string>
     <string name="adb_keys_warning_message" msgid="2968555274488101220">"Vols revocar l\'accés a la depuració per USB dels ordinadors que has autoritzat anteriorment?"</string>
     <string name="dev_settings_warning_title" msgid="8251234890169074553">"Vols permetre la conf. de desenvolupament?"</string>
     <string name="dev_settings_warning_message" msgid="37741686486073668">"Aquesta configuració només està prevista per a usos de desenvolupament. Pot fer que el dispositiu i que les aplicacions s\'interrompin o tinguin un comportament inadequat."</string>
@@ -383,8 +412,7 @@
     <string name="daltonizer_mode_protanomaly" msgid="7805583306666608440">"Protanomalia (vermell-verd)"</string>
     <string name="daltonizer_mode_tritanomaly" msgid="7135266249220732267">"Tritanomalia (blau-groc)"</string>
     <string name="accessibility_display_daltonizer_preference_title" msgid="1810693571332381974">"Correcció del color"</string>
-    <!-- no translation found for accessibility_display_daltonizer_preference_subtitle (6178138727195403796) -->
-    <skip />
+    <string name="accessibility_display_daltonizer_preference_subtitle" msgid="6178138727195403796">"La correcció del color ajuda les persones daltòniques a veure colors més precisos"</string>
     <string name="daltonizer_type_overridden" msgid="4509604753672535721">"S\'ha substituït per <xliff:g id="TITLE">%1$s</xliff:g>"</string>
     <string name="power_remaining_settings_home_page" msgid="4885165789445462557">"<xliff:g id="PERCENTAGE">%1$s</xliff:g>: <xliff:g id="TIME_STRING">%2$s</xliff:g>"</string>
     <string name="power_remaining_duration_only" msgid="8264199158671531431">"Temps restant aproximat: <xliff:g id="TIME_REMAINING">%1$s</xliff:g>"</string>
@@ -403,21 +431,19 @@
     <string name="power_remaining_less_than_duration" msgid="1812668275239801236">"Temps restant inferior a <xliff:g id="THRESHOLD">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_more_than_subtext" msgid="7919119719242734848">"Temps restant superior a <xliff:g id="TIME_REMAINING">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_only_more_than_subtext" msgid="3274496164769110480">"Temps restant superior a <xliff:g id="TIME_REMAINING">%1$s</xliff:g>"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="6583866940347159957">"És possible que el telèfon s\'apagui aviat"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="8009177999719462724">"És possible que la tauleta s\'apagui aviat"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="8320892540455268018">"És possible que el dispositiu s\'apagui aviat"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="6186572170809116621">"És possible que el telèfon s\'apagui aviat (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="1338758278145563121">"És possible que la tauleta s\'apagui aviat (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="3699579688084774362">"És possible que el dispositiu s\'apagui aviat (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="137330009791560774">"És possible que el telèfon s\'apagui aviat"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="145489081521468132">"És possible que la tauleta s\'apagui aviat"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="1070562682853942350">"És possible que el dispositiu s\'apagui aviat"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="4429259621177089719">"És possible que el telèfon s\'apagui aviat (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="7703677921000858479">"És possible que la tauleta s\'apagui aviat (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="4374784375644214578">"És possible que el dispositiu s\'apagui aviat (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
     <string name="power_charging" msgid="6727132649743436802">"<xliff:g id="LEVEL">%1$s</xliff:g>: <xliff:g id="STATE">%2$s</xliff:g>"</string>
     <string name="power_remaining_charging_duration_only" msgid="7415639699283965818">"<xliff:g id="TIME">%1$s</xliff:g> per completar la càrrega"</string>
     <string name="power_charging_duration" msgid="5005740040558984057">"<xliff:g id="LEVEL">%1$s</xliff:g>: <xliff:g id="TIME">%2$s</xliff:g> per completar la càrrega"</string>
     <string name="battery_info_status_unknown" msgid="268625384868401114">"Desconegut"</string>
     <string name="battery_info_status_charging" msgid="4279958015430387405">"S\'està carregant"</string>
-    <!-- no translation found for battery_info_status_charging_fast (8027559755902954885) -->
-    <skip />
-    <!-- no translation found for battery_info_status_charging_slow (3190803837168962319) -->
-    <skip />
+    <string name="battery_info_status_charging_fast" msgid="8027559755902954885">"Carregant ràpidament"</string>
+    <string name="battery_info_status_charging_slow" msgid="3190803837168962319">"Carregant lentament"</string>
     <string name="battery_info_status_discharging" msgid="6962689305413556485">"No s\'està carregant"</string>
     <string name="battery_info_status_not_charging" msgid="8330015078868707899">"El dispositiu està endollat però en aquests moments no es pot carregar"</string>
     <string name="battery_info_status_full" msgid="4443168946046847468">"Completa"</string>
diff --git a/packages/SettingsLib/res/values-cs/strings.xml b/packages/SettingsLib/res/values-cs/strings.xml
index f116733..932051d 100644
--- a/packages/SettingsLib/res/values-cs/strings.xml
+++ b/packages/SettingsLib/res/values-cs/strings.xml
@@ -206,6 +206,33 @@
     <string name="enable_adb" msgid="8072776357237289039">"Ladění přes USB"</string>
     <string name="enable_adb_summary" msgid="3711526030096574316">"Povolit režim ladění s připojeným zařízením USB"</string>
     <string name="clear_adb_keys" msgid="3010148733140369917">"Zrušit autorizace k ladění přes USB"</string>
+    <string name="enable_adb_wireless" msgid="6973226350963971018">"Bezdrátové ladění"</string>
+    <string name="enable_adb_wireless_summary" msgid="7344391423657093011">"Režim ladění při připojení k Wi-Fi"</string>
+    <string name="adb_wireless_error" msgid="721958772149779856">"Chyba"</string>
+    <string name="adb_wireless_settings" msgid="2295017847215680229">"Bezdrátové ladění"</string>
+    <string name="adb_wireless_list_empty_off" msgid="1713707973837255490">"Chcete-li zobrazit a použít dostupná zařízení, zapněte bezdrátové ladění"</string>
+    <string name="adb_pair_method_qrcode_title" msgid="6982904096137468634">"Párovat zařízení pomocí QR kódu"</string>
+    <string name="adb_pair_method_qrcode_summary" msgid="3729901496856458634">"Párovat nová zařízení pomocí skenování QR kódu"</string>
+    <string name="adb_pair_method_code_title" msgid="1122590300445142904">"Párovat zařízení pomocí párovacího kódu"</string>
+    <string name="adb_pair_method_code_summary" msgid="6370414511333685185">"Párovat nová zařízení pomocí šestimístného kódu"</string>
+    <string name="adb_paired_devices_title" msgid="5268997341526217362">"Spárovaná zařízení"</string>
+    <string name="adb_wireless_device_connected_summary" msgid="3039660790249148713">"Momentálně připojeno"</string>
+    <string name="adb_wireless_device_details_title" msgid="7129369670526565786">"Podrobnosti o zařízení"</string>
+    <string name="adb_device_forget" msgid="193072400783068417">"Zapomenout"</string>
+    <string name="adb_device_fingerprint_title_format" msgid="291504822917843701">"Otisk zařízení: <xliff:g id="FINGERPRINT_PARAM">%1$s</xliff:g>"</string>
+    <string name="adb_wireless_connection_failed_title" msgid="664211177427438438">"Připojení se nezdařilo"</string>
+    <string name="adb_wireless_connection_failed_message" msgid="9213896700171602073">"Zkontrolujte, zda je zařízení <xliff:g id="DEVICE_NAME">%1$s</xliff:g> připojeno ke správné síti"</string>
+    <string name="adb_pairing_device_dialog_title" msgid="7141739231018530210">"Spárování se zařízením"</string>
+    <string name="adb_pairing_device_dialog_pairing_code_label" msgid="3639239786669722731">"Párovací kód Wi‑Fi"</string>
+    <string name="adb_pairing_device_dialog_failed_title" msgid="3426758947882091735">"Spárování se nezdařilo"</string>
+    <string name="adb_pairing_device_dialog_failed_msg" msgid="6611097519661997148">"Zkontrolujte, zda je zařízení připojeno ke stejné síti."</string>
+    <string name="adb_wireless_qrcode_summary" msgid="8051414549011801917">"Párovat zařízení přes Wi-Fi naskenováním QR kódu"</string>
+    <string name="adb_wireless_verifying_qrcode_text" msgid="6123192424916029207">"Párování zařízení…"</string>
+    <string name="adb_qrcode_pairing_device_failed_msg" msgid="6936292092592914132">"Spárování zařízení se nezdařilo. Buď byl QR kód chybný, nebo zařízení není připojeno ke stejné síti."</string>
+    <string name="adb_wireless_ip_addr_preference_title" msgid="8335132107715311730">"IP adresa a port"</string>
+    <string name="adb_wireless_qrcode_pairing_title" msgid="1906409667944674707">"Naskenování QR kódu"</string>
+    <string name="adb_wireless_qrcode_pairing_description" msgid="8578868049289910131">"Párovat zařízení přes Wi-Fi naskenováním QR kódu"</string>
+    <string name="keywords_adb_wireless" msgid="6507505581882171240">"adb, ladění, vývoj"</string>
     <string name="bugreport_in_power" msgid="8664089072534638709">"Zástupce hlášení chyb"</string>
     <string name="bugreport_in_power_summary" msgid="1885529649381831775">"Zobrazit v hlavní nabídce tlačítko k vygenerování chybového hlášení"</string>
     <string name="keep_screen_on" msgid="1187161672348797558">"Nevypínat obrazovku"</string>
@@ -271,6 +298,8 @@
     <string name="tethering_hardware_offload_summary" msgid="7801345335142803029">"Pokud je k dispozici hardwarová akceleraci tetheringu, použít ji"</string>
     <string name="adb_warning_title" msgid="7708653449506485728">"Povolit ladění přes USB?"</string>
     <string name="adb_warning_message" msgid="8145270656419669221">"Ladění prostřednictvím rozhraní USB je určeno pouze pro účely vývoje. Použijte je ke kopírování dat mezi počítačem a zařízením, instalaci aplikací do zařízení bez upozornění a čtení dat protokolů."</string>
+    <string name="adbwifi_warning_title" msgid="727104571653031865">"Povolit bezdrátové ladění?"</string>
+    <string name="adbwifi_warning_message" msgid="8005936574322702388">"Bezdrátové ladění je určeno pouze pro účely vývoje. Použijte jej ke kopírování dat mezi počítačem a zařízením, instalaci aplikací do zařízení bez upozornění a čtení dat protokolů."</string>
     <string name="adb_keys_warning_message" msgid="2968555274488101220">"Zrušit přístup k ladění přes USB ze všech počítačů, které jste v minulosti autorizovali?"</string>
     <string name="dev_settings_warning_title" msgid="8251234890169074553">"Povolit nastavení pro vývojáře?"</string>
     <string name="dev_settings_warning_message" msgid="37741686486073668">"Tato nastavení jsou určena pouze pro vývojáře. Mohou způsobit rozbití nebo nesprávné fungování zařízení a nainstalovaných aplikací."</string>
@@ -383,8 +412,7 @@
     <string name="daltonizer_mode_protanomaly" msgid="7805583306666608440">"Protanomálie (červená a zelená)"</string>
     <string name="daltonizer_mode_tritanomaly" msgid="7135266249220732267">"Tritanomálie (modrá a žlutá)"</string>
     <string name="accessibility_display_daltonizer_preference_title" msgid="1810693571332381974">"Korekce barev"</string>
-    <!-- no translation found for accessibility_display_daltonizer_preference_subtitle (6178138727195403796) -->
-    <skip />
+    <string name="accessibility_display_daltonizer_preference_subtitle" msgid="6178138727195403796">"Korekce barev pomáhá barvoslepým lidem vidět přesnější barvy"</string>
     <string name="daltonizer_type_overridden" msgid="4509604753672535721">"Přepsáno nastavením <xliff:g id="TITLE">%1$s</xliff:g>"</string>
     <string name="power_remaining_settings_home_page" msgid="4885165789445462557">"<xliff:g id="PERCENTAGE">%1$s</xliff:g> – <xliff:g id="TIME_STRING">%2$s</xliff:g>"</string>
     <string name="power_remaining_duration_only" msgid="8264199158671531431">"Zbývá asi <xliff:g id="TIME_REMAINING">%1$s</xliff:g>"</string>
@@ -403,21 +431,19 @@
     <string name="power_remaining_less_than_duration" msgid="1812668275239801236">"Zbývá méně než <xliff:g id="THRESHOLD">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_more_than_subtext" msgid="7919119719242734848">"Zbývá více než <xliff:g id="TIME_REMAINING">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_only_more_than_subtext" msgid="3274496164769110480">"Zbývá více než <xliff:g id="TIME_REMAINING">%1$s</xliff:g>"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="6583866940347159957">"Telefon se brzy vypne"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="8009177999719462724">"Tablet se brzy vypne"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="8320892540455268018">"Zařízení se brzy vypne"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="6186572170809116621">"Telefon se brzy vypne (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="1338758278145563121">"Tablet se brzy vypne (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="3699579688084774362">"Zařízení se brzy vypne (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="137330009791560774">"Telefon se brzy vypne"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="145489081521468132">"Tablet se brzy vypne"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="1070562682853942350">"Zařízení se brzy vypne"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="4429259621177089719">"Telefon se brzy vypne (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="7703677921000858479">"Tablet se brzy vypne (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="4374784375644214578">"Zařízení se brzy vypne (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
     <string name="power_charging" msgid="6727132649743436802">"<xliff:g id="LEVEL">%1$s</xliff:g> – <xliff:g id="STATE">%2$s</xliff:g>"</string>
     <string name="power_remaining_charging_duration_only" msgid="7415639699283965818">"Do nabití zbývá: <xliff:g id="TIME">%1$s</xliff:g>"</string>
     <string name="power_charging_duration" msgid="5005740040558984057">"<xliff:g id="LEVEL">%1$s</xliff:g> – <xliff:g id="TIME">%2$s</xliff:g> do nabití"</string>
     <string name="battery_info_status_unknown" msgid="268625384868401114">"Neznámé"</string>
     <string name="battery_info_status_charging" msgid="4279958015430387405">"Nabíjí se"</string>
-    <!-- no translation found for battery_info_status_charging_fast (8027559755902954885) -->
-    <skip />
-    <!-- no translation found for battery_info_status_charging_slow (3190803837168962319) -->
-    <skip />
+    <string name="battery_info_status_charging_fast" msgid="8027559755902954885">"Rychlé nabíjení"</string>
+    <string name="battery_info_status_charging_slow" msgid="3190803837168962319">"Pomalé nabíjení"</string>
     <string name="battery_info_status_discharging" msgid="6962689305413556485">"Nenabíjí se"</string>
     <string name="battery_info_status_not_charging" msgid="8330015078868707899">"Zapojeno, ale nelze nabíjet"</string>
     <string name="battery_info_status_full" msgid="4443168946046847468">"Nabitá"</string>
diff --git a/packages/SettingsLib/res/values-da/strings.xml b/packages/SettingsLib/res/values-da/strings.xml
index e3b96a4..20fbf94 100644
--- a/packages/SettingsLib/res/values-da/strings.xml
+++ b/packages/SettingsLib/res/values-da/strings.xml
@@ -206,6 +206,33 @@
     <string name="enable_adb" msgid="8072776357237289039">"USB-fejlretning"</string>
     <string name="enable_adb_summary" msgid="3711526030096574316">"Fejlretningstilstand, når USB er tilsluttet"</string>
     <string name="clear_adb_keys" msgid="3010148733140369917">"Tilbagekald tilladelser for USB-fejlretning"</string>
+    <string name="enable_adb_wireless" msgid="6973226350963971018">"Trådløs fejlfinding"</string>
+    <string name="enable_adb_wireless_summary" msgid="7344391423657093011">"Fejlfindingstilstand, når der er Wi-Fi-forbindelse"</string>
+    <string name="adb_wireless_error" msgid="721958772149779856">"Fejl"</string>
+    <string name="adb_wireless_settings" msgid="2295017847215680229">"Trådløs fejlfinding"</string>
+    <string name="adb_wireless_list_empty_off" msgid="1713707973837255490">"Du kan se og bruge tilgængelige enheder ved at aktivere trådløs fejlretning"</string>
+    <string name="adb_pair_method_qrcode_title" msgid="6982904096137468634">"Dan par med en enhed ved hjælp af en QR-kode"</string>
+    <string name="adb_pair_method_qrcode_summary" msgid="3729901496856458634">"Dan par med nye enheder ved hjælp af QR-kodescanneren"</string>
+    <string name="adb_pair_method_code_title" msgid="1122590300445142904">"Dan par med en enhed ved hjælp af en parringskode"</string>
+    <string name="adb_pair_method_code_summary" msgid="6370414511333685185">"Dan par med nye enheder ved hjælp af den sekscifrede kode"</string>
+    <string name="adb_paired_devices_title" msgid="5268997341526217362">"Parrede enheder"</string>
+    <string name="adb_wireless_device_connected_summary" msgid="3039660790249148713">"Forbundet lige nu"</string>
+    <string name="adb_wireless_device_details_title" msgid="7129369670526565786">"Enhedsoplysninger"</string>
+    <string name="adb_device_forget" msgid="193072400783068417">"Glem"</string>
+    <string name="adb_device_fingerprint_title_format" msgid="291504822917843701">"Fingeraftryk for enhed: <xliff:g id="FINGERPRINT_PARAM">%1$s</xliff:g>"</string>
+    <string name="adb_wireless_connection_failed_title" msgid="664211177427438438">"Forbindelsen mislykkedes"</string>
+    <string name="adb_wireless_connection_failed_message" msgid="9213896700171602073">"Sørg for, at <xliff:g id="DEVICE_NAME">%1$s</xliff:g> har forbindelse til det rigtige netværk."</string>
+    <string name="adb_pairing_device_dialog_title" msgid="7141739231018530210">"Dan par med enhed"</string>
+    <string name="adb_pairing_device_dialog_pairing_code_label" msgid="3639239786669722731">"Parringskode til Wi-Fi"</string>
+    <string name="adb_pairing_device_dialog_failed_title" msgid="3426758947882091735">"Parringen mislykkedes"</string>
+    <string name="adb_pairing_device_dialog_failed_msg" msgid="6611097519661997148">"Sørg for, at enheden er forbundet til det samme netværk."</string>
+    <string name="adb_wireless_qrcode_summary" msgid="8051414549011801917">"Dan par med en enhed via Wi-Fi ved at scanne en QR-kode"</string>
+    <string name="adb_wireless_verifying_qrcode_text" msgid="6123192424916029207">"Parrer enhed…"</string>
+    <string name="adb_qrcode_pairing_device_failed_msg" msgid="6936292092592914132">"Enheden blev ikke parret. Det skyldes enten, at QR-koden var forkert, eller at enheden ikke er forbundet til det samme netværk."</string>
+    <string name="adb_wireless_ip_addr_preference_title" msgid="8335132107715311730">"IP-adresse og port"</string>
+    <string name="adb_wireless_qrcode_pairing_title" msgid="1906409667944674707">"Scan QR-kode"</string>
+    <string name="adb_wireless_qrcode_pairing_description" msgid="8578868049289910131">"Dan par med en enhed via Wi-Fi ved at scanne en QR-kode"</string>
+    <string name="keywords_adb_wireless" msgid="6507505581882171240">"adb, fejlfinding, dev"</string>
     <string name="bugreport_in_power" msgid="8664089072534638709">"Genvej til fejlrapportering"</string>
     <string name="bugreport_in_power_summary" msgid="1885529649381831775">"Vis en knap til oprettelse af fejlrapporter i afbrydermenuen"</string>
     <string name="keep_screen_on" msgid="1187161672348797558">"Lås ikke"</string>
@@ -271,6 +298,8 @@
     <string name="tethering_hardware_offload_summary" msgid="7801345335142803029">"Brug hardwareacceleration ved netdeling, hvis det er muligt"</string>
     <string name="adb_warning_title" msgid="7708653449506485728">"Vil du tillade USB-fejlretning?"</string>
     <string name="adb_warning_message" msgid="8145270656419669221">"USB-fejlretning er kun beregnet til udvikling og kan bruges til at kopiere data mellem din computer og enheden, installere apps på enheden uden notifikation og læse logdata."</string>
+    <string name="adbwifi_warning_title" msgid="727104571653031865">"Vil du tillade trådløs fejlfinding?"</string>
+    <string name="adbwifi_warning_message" msgid="8005936574322702388">"Trådløs fejlretning er kun beregnet til udvikling og kan bruges til at kopiere data mellem din computer og enheden, installere apps på enheden uden notifikation og læse logdata."</string>
     <string name="adb_keys_warning_message" msgid="2968555274488101220">"Vil du ophæve adgangen til USB-fejlretning for alle computere, du tidligere har godkendt?"</string>
     <string name="dev_settings_warning_title" msgid="8251234890169074553">"Vil du tillade udviklingsindstillinger?"</string>
     <string name="dev_settings_warning_message" msgid="37741686486073668">"Disse indstillinger er kun beregnet til brug i forbindelse med udvikling. De kan forårsage, at din enhed og dens apps går ned eller ikke fungerer korrekt."</string>
@@ -383,8 +412,7 @@
     <string name="daltonizer_mode_protanomaly" msgid="7805583306666608440">"Protanopi (rød-grøn)"</string>
     <string name="daltonizer_mode_tritanomaly" msgid="7135266249220732267">"Tritanopi (blå-gul)"</string>
     <string name="accessibility_display_daltonizer_preference_title" msgid="1810693571332381974">"Korriger farver"</string>
-    <!-- no translation found for accessibility_display_daltonizer_preference_subtitle (6178138727195403796) -->
-    <skip />
+    <string name="accessibility_display_daltonizer_preference_subtitle" msgid="6178138727195403796">"Farvekorrigering gør det nemmere for farveblinde at se farver mere nøjagtigt"</string>
     <string name="daltonizer_type_overridden" msgid="4509604753672535721">"Tilsidesat af <xliff:g id="TITLE">%1$s</xliff:g>"</string>
     <string name="power_remaining_settings_home_page" msgid="4885165789445462557">"<xliff:g id="PERCENTAGE">%1$s</xliff:g> – <xliff:g id="TIME_STRING">%2$s</xliff:g>"</string>
     <string name="power_remaining_duration_only" msgid="8264199158671531431">"Ca. <xliff:g id="TIME_REMAINING">%1$s</xliff:g> tilbage"</string>
@@ -403,21 +431,19 @@
     <string name="power_remaining_less_than_duration" msgid="1812668275239801236">"Der er mindre end <xliff:g id="THRESHOLD">%1$s</xliff:g> tilbage (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_more_than_subtext" msgid="7919119719242734848">"Der er mere end <xliff:g id="TIME_REMAINING">%1$s</xliff:g> tilbage (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_only_more_than_subtext" msgid="3274496164769110480">"Der er mere end <xliff:g id="TIME_REMAINING">%1$s</xliff:g> tilbage"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="6583866940347159957">"Telefonen lukker muligvis snart ned"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="8009177999719462724">"Denne tablet lukker muligvis snart ned"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="8320892540455268018">"Enheden lukker muligvis snart ned"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="6186572170809116621">"Telefonen lukker muligvis snart ned (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="1338758278145563121">"Denne tablet lukker muligvis snart ned (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="3699579688084774362">"Enheden lukker muligvis snart ned (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="137330009791560774">"Telefonen lukker muligvis snart ned"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="145489081521468132">"Denne tablet lukker muligvis snart ned"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="1070562682853942350">"Enheden lukker muligvis snart ned"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="4429259621177089719">"Telefonen lukker muligvis snart ned (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="7703677921000858479">"Tabletten lukker muligvis snart ned (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="4374784375644214578">"Enheden lukker muligvis snart ned (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
     <string name="power_charging" msgid="6727132649743436802">"<xliff:g id="LEVEL">%1$s</xliff:g> – <xliff:g id="STATE">%2$s</xliff:g>"</string>
     <string name="power_remaining_charging_duration_only" msgid="7415639699283965818">"Opladet om <xliff:g id="TIME">%1$s</xliff:g>"</string>
     <string name="power_charging_duration" msgid="5005740040558984057">"<xliff:g id="LEVEL">%1$s</xliff:g> – opladet om <xliff:g id="TIME">%2$s</xliff:g>"</string>
     <string name="battery_info_status_unknown" msgid="268625384868401114">"Ukendt"</string>
     <string name="battery_info_status_charging" msgid="4279958015430387405">"Oplader"</string>
-    <!-- no translation found for battery_info_status_charging_fast (8027559755902954885) -->
-    <skip />
-    <!-- no translation found for battery_info_status_charging_slow (3190803837168962319) -->
-    <skip />
+    <string name="battery_info_status_charging_fast" msgid="8027559755902954885">"Oplader hurtigt"</string>
+    <string name="battery_info_status_charging_slow" msgid="3190803837168962319">"Oplader langsomt"</string>
     <string name="battery_info_status_discharging" msgid="6962689305413556485">"Oplader ikke"</string>
     <string name="battery_info_status_not_charging" msgid="8330015078868707899">"Enheden er tilsluttet en strømkilde. Det er ikke muligt at oplade på nuværende tidspunkt."</string>
     <string name="battery_info_status_full" msgid="4443168946046847468">"Fuldt"</string>
diff --git a/packages/SettingsLib/res/values-de/strings.xml b/packages/SettingsLib/res/values-de/strings.xml
index 1ddabcab..3d46649 100644
--- a/packages/SettingsLib/res/values-de/strings.xml
+++ b/packages/SettingsLib/res/values-de/strings.xml
@@ -206,6 +206,33 @@
     <string name="enable_adb" msgid="8072776357237289039">"USB-Debugging"</string>
     <string name="enable_adb_summary" msgid="3711526030096574316">"Debugmodus bei Anschluss über USB"</string>
     <string name="clear_adb_keys" msgid="3010148733140369917">"USB-Debugging-Autorisierungen aufheben"</string>
+    <string name="enable_adb_wireless" msgid="6973226350963971018">"Kabelloses Debugging"</string>
+    <string name="enable_adb_wireless_summary" msgid="7344391423657093011">"Debugging-Modus, wenn eine WLAN-Verbindung besteht"</string>
+    <string name="adb_wireless_error" msgid="721958772149779856">"Fehler"</string>
+    <string name="adb_wireless_settings" msgid="2295017847215680229">"Kabelloses Debugging"</string>
+    <string name="adb_wireless_list_empty_off" msgid="1713707973837255490">"Aktiviere das kabellose Debugging, um verfügbare Geräte zu sehen und zu verwenden"</string>
+    <string name="adb_pair_method_qrcode_title" msgid="6982904096137468634">"Gerät über einen QR-Code koppeln"</string>
+    <string name="adb_pair_method_qrcode_summary" msgid="3729901496856458634">"Neue Geräte über QR-Codescanner koppeln"</string>
+    <string name="adb_pair_method_code_title" msgid="1122590300445142904">"Gerät über einen Kopplungscode koppeln"</string>
+    <string name="adb_pair_method_code_summary" msgid="6370414511333685185">"Neue Geräte mit sechsstelligem Code koppeln"</string>
+    <string name="adb_paired_devices_title" msgid="5268997341526217362">"Gekoppelte Geräte"</string>
+    <string name="adb_wireless_device_connected_summary" msgid="3039660790249148713">"Derzeit verbunden"</string>
+    <string name="adb_wireless_device_details_title" msgid="7129369670526565786">"Gerätedetails"</string>
+    <string name="adb_device_forget" msgid="193072400783068417">"Entfernen"</string>
+    <string name="adb_device_fingerprint_title_format" msgid="291504822917843701">"Fingerabdruck des Geräts: <xliff:g id="FINGERPRINT_PARAM">%1$s</xliff:g>"</string>
+    <string name="adb_wireless_connection_failed_title" msgid="664211177427438438">"Verbindung fehlgeschlagen"</string>
+    <string name="adb_wireless_connection_failed_message" msgid="9213896700171602073">"Prüfe, ob <xliff:g id="DEVICE_NAME">%1$s</xliff:g> mit dem richtigen Netzwerk verbunden ist"</string>
+    <string name="adb_pairing_device_dialog_title" msgid="7141739231018530210">"Mit einem Gerät koppeln"</string>
+    <string name="adb_pairing_device_dialog_pairing_code_label" msgid="3639239786669722731">"WLAN-Kopplungscode"</string>
+    <string name="adb_pairing_device_dialog_failed_title" msgid="3426758947882091735">"Kopplung fehlgeschlagen"</string>
+    <string name="adb_pairing_device_dialog_failed_msg" msgid="6611097519661997148">"Prüfe, ob das Gerät mit demselben Netzwerk verbunden ist."</string>
+    <string name="adb_wireless_qrcode_summary" msgid="8051414549011801917">"Scanne einen QR-Code, um ein Gerät über WLAN zu koppeln"</string>
+    <string name="adb_wireless_verifying_qrcode_text" msgid="6123192424916029207">"Gerät wird gekoppelt…"</string>
+    <string name="adb_qrcode_pairing_device_failed_msg" msgid="6936292092592914132">"Das Gerät konnte nicht gekoppelt werden. Der QR-Code war nicht korrekt oder das Gerät ist nicht mit demselben Netzwerk verbunden."</string>
+    <string name="adb_wireless_ip_addr_preference_title" msgid="8335132107715311730">"IP-Adresse &amp; Port"</string>
+    <string name="adb_wireless_qrcode_pairing_title" msgid="1906409667944674707">"QR-Code scannen"</string>
+    <string name="adb_wireless_qrcode_pairing_description" msgid="8578868049289910131">"Scanne einen QR-Code, um ein Gerät über WLAN zu koppeln"</string>
+    <string name="keywords_adb_wireless" msgid="6507505581882171240">"ADB, Debug, Dev"</string>
     <string name="bugreport_in_power" msgid="8664089072534638709">"Verknüpfung zu Fehlerbericht"</string>
     <string name="bugreport_in_power_summary" msgid="1885529649381831775">"Im Menü \"Ein/Aus\" wird eine Option zum Erstellen eines Fehlerberichts angezeigt"</string>
     <string name="keep_screen_on" msgid="1187161672348797558">"Aktiv lassen"</string>
@@ -271,6 +298,8 @@
     <string name="tethering_hardware_offload_summary" msgid="7801345335142803029">"Falls verfügbar, Hardwarebeschleunigung für Tethering verwenden"</string>
     <string name="adb_warning_title" msgid="7708653449506485728">"USB-Debugging zulassen?"</string>
     <string name="adb_warning_message" msgid="8145270656419669221">"USB-Debugging ist nur für Entwicklungszwecke vorgesehen. Damit kannst du Daten zwischen deinem Computer und deinem Gerät kopieren, Apps auf deinem Gerät ohne Benachrichtigung installieren und Protokolldaten lesen."</string>
+    <string name="adbwifi_warning_title" msgid="727104571653031865">"Kabelloses Debugging zulassen?"</string>
+    <string name="adbwifi_warning_message" msgid="8005936574322702388">"Das kabellose Debugging ist nur für Entwicklungszwecke vorgesehen. Damit kannst du Daten zwischen deinem Computer und deinem Gerät kopieren, Apps auf deinem Gerät ohne Benachrichtigung installieren und Protokolldaten lesen."</string>
     <string name="adb_keys_warning_message" msgid="2968555274488101220">"Zugriff auf USB-Debugging für alle zuvor autorisierten Computer aufheben?"</string>
     <string name="dev_settings_warning_title" msgid="8251234890169074553">"Entwicklungseinstellungen zulassen?"</string>
     <string name="dev_settings_warning_message" msgid="37741686486073668">"Diese Einstellungen sind ausschließlich für Entwicklungszwecke gedacht. Sie können dein Gerät und die darauf installierten Apps beschädigen oder zu unerwünschtem Verhalten führen."</string>
@@ -383,8 +412,7 @@
     <string name="daltonizer_mode_protanomaly" msgid="7805583306666608440">"Protanomalie (Rot-Grün-Sehschwäche)"</string>
     <string name="daltonizer_mode_tritanomaly" msgid="7135266249220732267">"Tritanomalie (Blau-Gelb-Sehschwäche)"</string>
     <string name="accessibility_display_daltonizer_preference_title" msgid="1810693571332381974">"Farbkorrektur"</string>
-    <!-- no translation found for accessibility_display_daltonizer_preference_subtitle (6178138727195403796) -->
-    <skip />
+    <string name="accessibility_display_daltonizer_preference_subtitle" msgid="6178138727195403796">"Die Farbkorrektur hilft farbenblinden Menschen, Farben besser zu erkennen"</string>
     <string name="daltonizer_type_overridden" msgid="4509604753672535721">"Außer Kraft gesetzt von \"<xliff:g id="TITLE">%1$s</xliff:g>\""</string>
     <string name="power_remaining_settings_home_page" msgid="4885165789445462557">"<xliff:g id="PERCENTAGE">%1$s</xliff:g> – <xliff:g id="TIME_STRING">%2$s</xliff:g>"</string>
     <string name="power_remaining_duration_only" msgid="8264199158671531431">"Noch etwa <xliff:g id="TIME_REMAINING">%1$s</xliff:g>"</string>
@@ -403,21 +431,19 @@
     <string name="power_remaining_less_than_duration" msgid="1812668275239801236">"Weniger als <xliff:g id="THRESHOLD">%1$s</xliff:g> verbleibend (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_more_than_subtext" msgid="7919119719242734848">"Mehr als <xliff:g id="TIME_REMAINING">%1$s</xliff:g> verbleibend (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_only_more_than_subtext" msgid="3274496164769110480">"Mehr als <xliff:g id="TIME_REMAINING">%1$s</xliff:g> verbleibend"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="6583866940347159957">"Smartphone wird eventuell bald ausgeschaltet"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="8009177999719462724">"Tablet wird eventuell bald ausgeschaltet"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="8320892540455268018">"Gerät wird eventuell bald ausgeschaltet"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="6186572170809116621">"Smartphone wird eventuell bald ausgeschaltet (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="1338758278145563121">"Tablet wird eventuell bald ausgeschaltet (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="3699579688084774362">"Gerät wird eventuell bald ausgeschaltet (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="137330009791560774">"Smartphone wird eventuell bald ausgeschaltet"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="145489081521468132">"Tablet wird eventuell bald ausgeschaltet"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="1070562682853942350">"Gerät wird eventuell bald ausgeschaltet"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="4429259621177089719">"Smartphone wird eventuell bald ausgeschaltet (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="7703677921000858479">"Tablet wird eventuell bald ausgeschaltet (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="4374784375644214578">"Gerät wird eventuell bald ausgeschaltet (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
     <string name="power_charging" msgid="6727132649743436802">"<xliff:g id="LEVEL">%1$s</xliff:g> – <xliff:g id="STATE">%2$s</xliff:g>"</string>
     <string name="power_remaining_charging_duration_only" msgid="7415639699283965818">"Noch <xliff:g id="TIME">%1$s</xliff:g> bis zur Aufladung"</string>
     <string name="power_charging_duration" msgid="5005740040558984057">"<xliff:g id="LEVEL">%1$s</xliff:g> – <xliff:g id="TIME">%2$s</xliff:g> bis zur Aufladung"</string>
     <string name="battery_info_status_unknown" msgid="268625384868401114">"Unbekannt"</string>
     <string name="battery_info_status_charging" msgid="4279958015430387405">"Wird aufgeladen"</string>
-    <!-- no translation found for battery_info_status_charging_fast (8027559755902954885) -->
-    <skip />
-    <!-- no translation found for battery_info_status_charging_slow (3190803837168962319) -->
-    <skip />
+    <string name="battery_info_status_charging_fast" msgid="8027559755902954885">"Schnelles Aufladen"</string>
+    <string name="battery_info_status_charging_slow" msgid="3190803837168962319">"Langsames Aufladen"</string>
     <string name="battery_info_status_discharging" msgid="6962689305413556485">"Wird nicht geladen"</string>
     <string name="battery_info_status_not_charging" msgid="8330015078868707899">"Angeschlossen, kann derzeit nicht geladen werden"</string>
     <string name="battery_info_status_full" msgid="4443168946046847468">"Voll"</string>
diff --git a/packages/SettingsLib/res/values-el/strings.xml b/packages/SettingsLib/res/values-el/strings.xml
index 3a97d5a..6bd8736 100644
--- a/packages/SettingsLib/res/values-el/strings.xml
+++ b/packages/SettingsLib/res/values-el/strings.xml
@@ -206,6 +206,33 @@
     <string name="enable_adb" msgid="8072776357237289039">"Εντοπισμός σφαλμάτων USB"</string>
     <string name="enable_adb_summary" msgid="3711526030096574316">"Λειτουργία εντοπισμού σφαλμάτων όταν το USB είναι συνδεδεμένο"</string>
     <string name="clear_adb_keys" msgid="3010148733140369917">"Ανάκληση εξ/σεων εντ/σμού σφ/των USB"</string>
+    <string name="enable_adb_wireless" msgid="6973226350963971018">"Εντοπισμός σφαλμ. ασύρ. σύνδεσης"</string>
+    <string name="enable_adb_wireless_summary" msgid="7344391423657093011">"Λειτουργία εντοπισμού σφαλμάτων όταν το Wi‑Fi είναι συνδεδεμένο"</string>
+    <string name="adb_wireless_error" msgid="721958772149779856">"Σφάλμα"</string>
+    <string name="adb_wireless_settings" msgid="2295017847215680229">"Εντοπισμός σφαλμ. ασύρ. σύνδεσης"</string>
+    <string name="adb_wireless_list_empty_off" msgid="1713707973837255490">"Για να δείτε και να χρησιμοποιήσετε τις διαθέσιμες συσκευές, ενεργοποιήστε τον εντοπισμό σφαλμάτων ασύρματης σύνδεσης"</string>
+    <string name="adb_pair_method_qrcode_title" msgid="6982904096137468634">"Σύζευξη συσκευής με κωδικό QR"</string>
+    <string name="adb_pair_method_qrcode_summary" msgid="3729901496856458634">"Σύζευξη νέων συσκευών με τη χρήση σαρωτή κωδικών QR"</string>
+    <string name="adb_pair_method_code_title" msgid="1122590300445142904">"Σύζευξη συσκευής με κωδικό σύζευξης"</string>
+    <string name="adb_pair_method_code_summary" msgid="6370414511333685185">"Σύζευξη νέων συσκευών με τη χρήση εξαψήφιου κωδικού"</string>
+    <string name="adb_paired_devices_title" msgid="5268997341526217362">"Συσκευές σε σύζευξη"</string>
+    <string name="adb_wireless_device_connected_summary" msgid="3039660790249148713">"Συνδεδεμένες αυτήν τη στιγμή"</string>
+    <string name="adb_wireless_device_details_title" msgid="7129369670526565786">"Λεπτομέρειες συσκευής"</string>
+    <string name="adb_device_forget" msgid="193072400783068417">"Διαγραφή"</string>
+    <string name="adb_device_fingerprint_title_format" msgid="291504822917843701">"Μοναδικό χαρακτηριστικό συσκευής: <xliff:g id="FINGERPRINT_PARAM">%1$s</xliff:g>"</string>
+    <string name="adb_wireless_connection_failed_title" msgid="664211177427438438">"Η σύνδεση δεν ήταν επιτυχής"</string>
+    <string name="adb_wireless_connection_failed_message" msgid="9213896700171602073">"Βεβαιωθείτε ότι η συσκευή <xliff:g id="DEVICE_NAME">%1$s</xliff:g> είναι συνδεδεμένη στο σωστό δίκτυο"</string>
+    <string name="adb_pairing_device_dialog_title" msgid="7141739231018530210">"Σύζευξη με συσκευή"</string>
+    <string name="adb_pairing_device_dialog_pairing_code_label" msgid="3639239786669722731">"Κωδικός σύζευξης Wi‑Fi"</string>
+    <string name="adb_pairing_device_dialog_failed_title" msgid="3426758947882091735">"Η σύζευξη δεν ήταν επιτυχής"</string>
+    <string name="adb_pairing_device_dialog_failed_msg" msgid="6611097519661997148">"Βεβαιωθείτε ότι η συσκευή είναι συνδεδεμένη στο ίδιο δίκτυο."</string>
+    <string name="adb_wireless_qrcode_summary" msgid="8051414549011801917">"Σύζευξη συσκευής μέσω Wi‑Fi με τη σάρωση ενός κωδικού QR"</string>
+    <string name="adb_wireless_verifying_qrcode_text" msgid="6123192424916029207">"Σύζευξη συσκευής…"</string>
+    <string name="adb_qrcode_pairing_device_failed_msg" msgid="6936292092592914132">"Η σύζευξη της συσκευής απέτυχε. Ο κωδικός QR ήταν λανθασμένος ή η συσκευή δεν είναι συνδεδεμένη στο ίδιο δίκτυο."</string>
+    <string name="adb_wireless_ip_addr_preference_title" msgid="8335132107715311730">"Διεύθυνση IP και θύρα"</string>
+    <string name="adb_wireless_qrcode_pairing_title" msgid="1906409667944674707">"Σάρωση κωδικού QR"</string>
+    <string name="adb_wireless_qrcode_pairing_description" msgid="8578868049289910131">"Σύζευξη συσκευής μέσω Wi‑Fi με τη σάρωση ενός κωδικού QR"</string>
+    <string name="keywords_adb_wireless" msgid="6507505581882171240">"adb, εντοπισμός σφαλμάτων, προγραμματιστής"</string>
     <string name="bugreport_in_power" msgid="8664089072534638709">"Συντόμευση αναφοράς σφαλμάτων"</string>
     <string name="bugreport_in_power_summary" msgid="1885529649381831775">"Εμφάνιση κουμπιού στο μενού ενεργοποίησης για τη λήψη αναφοράς σφαλμάτων"</string>
     <string name="keep_screen_on" msgid="1187161672348797558">"Παραμονή σε λειτουργία"</string>
@@ -271,6 +298,8 @@
     <string name="tethering_hardware_offload_summary" msgid="7801345335142803029">"Χρήση της σύνδεσης επιτάχυνσης υλικού εάν υπάρχει"</string>
     <string name="adb_warning_title" msgid="7708653449506485728">"Να επιτρέπεται ο εντοπισμός σφαλμάτων USB;"</string>
     <string name="adb_warning_message" msgid="8145270656419669221">"Ο εντοπισμός σφαλμάτων USB προορίζεται μόνο για σκοπούς προγραμματισμού. Χρησιμοποιήστε τον για αντιγραφή δεδομένων μεταξύ του υπολογιστή και της συσκευής σας, για την εγκατάσταση εφαρμογών στη συσκευή σας χωρίς προειδοποίηση και για την ανάγνωση δεδομένων καταγραφής."</string>
+    <string name="adbwifi_warning_title" msgid="727104571653031865">"Να επιτρέπεται ο εντοπισμός σφαλμάτων ασύρματης σύνδεσης;"</string>
+    <string name="adbwifi_warning_message" msgid="8005936574322702388">"Ο εντοπισμός σφαλμάτων ασύρματης σύνδεσης προορίζεται μόνο για σκοπούς προγραμματισμού. Χρησιμοποιήστε τον για αντιγραφή δεδομένων μεταξύ του υπολογιστή και της συσκευής σας, για την εγκατάσταση εφαρμογών στη συσκευή σας χωρίς ειδοποίηση και για την ανάγνωση δεδομένων καταγραφής."</string>
     <string name="adb_keys_warning_message" msgid="2968555274488101220">"Ανάκληση πρόσβασης στον εντοπισμό σφαλμάτων USB από όλους τους υπολογιστές για τους οποίους είχατε εξουσιοδότηση στο παρελθόν;"</string>
     <string name="dev_settings_warning_title" msgid="8251234890169074553">"Να επιτρέπεται η χρήση των ρυθμίσεων ανάπτυξης;"</string>
     <string name="dev_settings_warning_message" msgid="37741686486073668">"Αυτές οι ρυθμίσεις προορίζονται για χρήση κατά την ανάπτυξη. Μπορούν να προκαλέσουν προβλήματα στη λειτουργία της συσκευής και των εφαρμογών σας."</string>
@@ -383,8 +412,7 @@
     <string name="daltonizer_mode_protanomaly" msgid="7805583306666608440">"Πρωτανοπία (κόκκινο-πράσινο)"</string>
     <string name="daltonizer_mode_tritanomaly" msgid="7135266249220732267">"Τριτανοπία (μπλε-κίτρινο)"</string>
     <string name="accessibility_display_daltonizer_preference_title" msgid="1810693571332381974">"Διόρθωση χρωμάτων"</string>
-    <!-- no translation found for accessibility_display_daltonizer_preference_subtitle (6178138727195403796) -->
-    <skip />
+    <string name="accessibility_display_daltonizer_preference_subtitle" msgid="6178138727195403796">"Η διόρθωση χρωμάτων βοηθάει τα άτομα με αχρωματοψία να βλέπουν τα χρώματα με μεγαλύτερη ακρίβεια"</string>
     <string name="daltonizer_type_overridden" msgid="4509604753672535721">"Αντικαταστάθηκε από <xliff:g id="TITLE">%1$s</xliff:g>"</string>
     <string name="power_remaining_settings_home_page" msgid="4885165789445462557">"<xliff:g id="PERCENTAGE">%1$s</xliff:g> - <xliff:g id="TIME_STRING">%2$s</xliff:g>"</string>
     <string name="power_remaining_duration_only" msgid="8264199158671531431">"Απομένει/ουν περίπου <xliff:g id="TIME_REMAINING">%1$s</xliff:g>"</string>
@@ -403,21 +431,19 @@
     <string name="power_remaining_less_than_duration" msgid="1812668275239801236">"Απομένει/ουν λιγότερo/α από <xliff:g id="THRESHOLD">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_more_than_subtext" msgid="7919119719242734848">"Απομένουν περισσότερα/ες από <xliff:g id="TIME_REMAINING">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_only_more_than_subtext" msgid="3274496164769110480">"Απομένουν περισσότερα/ες από <xliff:g id="TIME_REMAINING">%1$s</xliff:g>"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="6583866940347159957">"Το τηλέφωνο μπορεί να απενεργοποιηθεί σύντομα"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="8009177999719462724">"Το tablet μπορεί να απενεργοποιηθεί σύντομα"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="8320892540455268018">"Η συσκευή μπορεί να απενεργοποιηθεί σύντομα"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="6186572170809116621">"Το τηλέφωνο μπορεί να απενεργοποιηθεί σύντομα (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="1338758278145563121">"Το tablet μπορεί να απενεργοποιηθεί σύντομα (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="3699579688084774362">"Η συσκευή μπορεί να απενεργοποιηθεί σύντομα (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="137330009791560774">"Το τηλέφωνο μπορεί να απενεργοποιηθεί σύντομα"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="145489081521468132">"Το tablet μπορεί να απενεργοποιηθεί σύντομα"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="1070562682853942350">"Η συσκευή μπορεί να απενεργοποιηθεί σύντομα"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="4429259621177089719">"Το τηλέφωνο μπορεί να απενεργοποιηθεί σύντομα (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="7703677921000858479">"Το tablet μπορεί να απενεργοποιηθεί σύντομα (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="4374784375644214578">"Η συσκευή μπορεί να απενεργοποιηθεί σύντομα (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
     <string name="power_charging" msgid="6727132649743436802">"<xliff:g id="LEVEL">%1$s</xliff:g> - <xliff:g id="STATE">%2$s</xliff:g>"</string>
     <string name="power_remaining_charging_duration_only" msgid="7415639699283965818">"Απομένουν <xliff:g id="TIME">%1$s</xliff:g> για ολοκλήρωση της φόρτισης"</string>
     <string name="power_charging_duration" msgid="5005740040558984057">"<xliff:g id="LEVEL">%1$s</xliff:g> - <xliff:g id="TIME">%2$s</xliff:g> για την ολοκλήρωση της φόρτισης"</string>
     <string name="battery_info_status_unknown" msgid="268625384868401114">"Άγνωστο"</string>
     <string name="battery_info_status_charging" msgid="4279958015430387405">"Φόρτιση"</string>
-    <!-- no translation found for battery_info_status_charging_fast (8027559755902954885) -->
-    <skip />
-    <!-- no translation found for battery_info_status_charging_slow (3190803837168962319) -->
-    <skip />
+    <string name="battery_info_status_charging_fast" msgid="8027559755902954885">"Ταχεία φόρτιση"</string>
+    <string name="battery_info_status_charging_slow" msgid="3190803837168962319">"Αργή φόρτιση"</string>
     <string name="battery_info_status_discharging" msgid="6962689305413556485">"Δεν φορτίζει"</string>
     <string name="battery_info_status_not_charging" msgid="8330015078868707899">"Συνδέθηκε, δεν είναι δυνατή η φόρτιση αυτήν τη στιγμή"</string>
     <string name="battery_info_status_full" msgid="4443168946046847468">"Πλήρης"</string>
diff --git a/packages/SettingsLib/res/values-en-rAU/strings.xml b/packages/SettingsLib/res/values-en-rAU/strings.xml
index ec0a129..810f81e 100644
--- a/packages/SettingsLib/res/values-en-rAU/strings.xml
+++ b/packages/SettingsLib/res/values-en-rAU/strings.xml
@@ -206,6 +206,33 @@
     <string name="enable_adb" msgid="8072776357237289039">"USB debugging"</string>
     <string name="enable_adb_summary" msgid="3711526030096574316">"Debug mode when USB is connected"</string>
     <string name="clear_adb_keys" msgid="3010148733140369917">"Revoke USB debugging authorisations"</string>
+    <string name="enable_adb_wireless" msgid="6973226350963971018">"Wireless debugging"</string>
+    <string name="enable_adb_wireless_summary" msgid="7344391423657093011">"Debug mode when Wi‑Fi is connected"</string>
+    <string name="adb_wireless_error" msgid="721958772149779856">"Error"</string>
+    <string name="adb_wireless_settings" msgid="2295017847215680229">"Wireless debugging"</string>
+    <string name="adb_wireless_list_empty_off" msgid="1713707973837255490">"To see and use available devices, turn on wireless debugging"</string>
+    <string name="adb_pair_method_qrcode_title" msgid="6982904096137468634">"Pair device with QR code"</string>
+    <string name="adb_pair_method_qrcode_summary" msgid="3729901496856458634">"Pair new devices using QR code scanner"</string>
+    <string name="adb_pair_method_code_title" msgid="1122590300445142904">"Pair device with pairing code"</string>
+    <string name="adb_pair_method_code_summary" msgid="6370414511333685185">"Pair new devices using six-digit code"</string>
+    <string name="adb_paired_devices_title" msgid="5268997341526217362">"Paired devices"</string>
+    <string name="adb_wireless_device_connected_summary" msgid="3039660790249148713">"Currently connected"</string>
+    <string name="adb_wireless_device_details_title" msgid="7129369670526565786">"Device details"</string>
+    <string name="adb_device_forget" msgid="193072400783068417">"Forget"</string>
+    <string name="adb_device_fingerprint_title_format" msgid="291504822917843701">"Device fingerprint: <xliff:g id="FINGERPRINT_PARAM">%1$s</xliff:g>"</string>
+    <string name="adb_wireless_connection_failed_title" msgid="664211177427438438">"Connection unsuccessful"</string>
+    <string name="adb_wireless_connection_failed_message" msgid="9213896700171602073">"Make sure that <xliff:g id="DEVICE_NAME">%1$s</xliff:g> is connected to the correct network"</string>
+    <string name="adb_pairing_device_dialog_title" msgid="7141739231018530210">"Pair with device"</string>
+    <string name="adb_pairing_device_dialog_pairing_code_label" msgid="3639239786669722731">"Wi‑Fi pairing code"</string>
+    <string name="adb_pairing_device_dialog_failed_title" msgid="3426758947882091735">"Pairing unsuccessful"</string>
+    <string name="adb_pairing_device_dialog_failed_msg" msgid="6611097519661997148">"Make sure that the device is connected to the same network."</string>
+    <string name="adb_wireless_qrcode_summary" msgid="8051414549011801917">"Pair device over Wi‑Fi by scanning a QR code"</string>
+    <string name="adb_wireless_verifying_qrcode_text" msgid="6123192424916029207">"Pairing device…"</string>
+    <string name="adb_qrcode_pairing_device_failed_msg" msgid="6936292092592914132">"Failed to pair the device. Either the QR code was incorrect, or the device is not connected to the same network."</string>
+    <string name="adb_wireless_ip_addr_preference_title" msgid="8335132107715311730">"IP address &amp; port"</string>
+    <string name="adb_wireless_qrcode_pairing_title" msgid="1906409667944674707">"Scan QR code"</string>
+    <string name="adb_wireless_qrcode_pairing_description" msgid="8578868049289910131">"Pair device over Wi‑Fi by scanning a QR code"</string>
+    <string name="keywords_adb_wireless" msgid="6507505581882171240">"adb, debug, dev"</string>
     <string name="bugreport_in_power" msgid="8664089072534638709">"Bug report shortcut"</string>
     <string name="bugreport_in_power_summary" msgid="1885529649381831775">"Show a button in the power menu for taking a bug report"</string>
     <string name="keep_screen_on" msgid="1187161672348797558">"Stay awake"</string>
@@ -271,6 +298,8 @@
     <string name="tethering_hardware_offload_summary" msgid="7801345335142803029">"Use tethering hardware acceleration if available"</string>
     <string name="adb_warning_title" msgid="7708653449506485728">"Allow USB debugging?"</string>
     <string name="adb_warning_message" msgid="8145270656419669221">"USB debugging is intended for development purposes only. Use it to copy data between your computer and your device, install apps on your device without notification and read log data."</string>
+    <string name="adbwifi_warning_title" msgid="727104571653031865">"Allow wireless debugging?"</string>
+    <string name="adbwifi_warning_message" msgid="8005936574322702388">"Wireless debugging is intended for development purposes only. Use it to copy data between your computer and your device, install apps on your device without notification, and read log data."</string>
     <string name="adb_keys_warning_message" msgid="2968555274488101220">"Revoke access to USB debugging from all computers you\'ve previously authorised?"</string>
     <string name="dev_settings_warning_title" msgid="8251234890169074553">"Allow development settings?"</string>
     <string name="dev_settings_warning_message" msgid="37741686486073668">"These settings are intended for development use only. They can cause your device and the applications on it to break or misbehave."</string>
@@ -383,8 +412,7 @@
     <string name="daltonizer_mode_protanomaly" msgid="7805583306666608440">"Protanomaly (red-green)"</string>
     <string name="daltonizer_mode_tritanomaly" msgid="7135266249220732267">"Tritanomaly (blue-yellow)"</string>
     <string name="accessibility_display_daltonizer_preference_title" msgid="1810693571332381974">"Colour correction"</string>
-    <!-- no translation found for accessibility_display_daltonizer_preference_subtitle (6178138727195403796) -->
-    <skip />
+    <string name="accessibility_display_daltonizer_preference_subtitle" msgid="6178138727195403796">"Colour correction helps people with colour blindness see more accurate colours"</string>
     <string name="daltonizer_type_overridden" msgid="4509604753672535721">"Overridden by <xliff:g id="TITLE">%1$s</xliff:g>"</string>
     <string name="power_remaining_settings_home_page" msgid="4885165789445462557">"<xliff:g id="PERCENTAGE">%1$s</xliff:g> - <xliff:g id="TIME_STRING">%2$s</xliff:g>"</string>
     <string name="power_remaining_duration_only" msgid="8264199158671531431">"About <xliff:g id="TIME_REMAINING">%1$s</xliff:g> left"</string>
@@ -403,21 +431,19 @@
     <string name="power_remaining_less_than_duration" msgid="1812668275239801236">"Less than <xliff:g id="THRESHOLD">%1$s</xliff:g> remaining (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_more_than_subtext" msgid="7919119719242734848">"More than <xliff:g id="TIME_REMAINING">%1$s</xliff:g> remaining (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_only_more_than_subtext" msgid="3274496164769110480">"More than <xliff:g id="TIME_REMAINING">%1$s</xliff:g> remaining"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="6583866940347159957">"Phone may shutdown soon"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="8009177999719462724">"Tablet may shutdown soon"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="8320892540455268018">"Device may shutdown soon"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="6186572170809116621">"Phone may shutdown soon (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="1338758278145563121">"Tablet may shutdown soon (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="3699579688084774362">"Device may shutdown soon (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="137330009791560774">"Phone may shut down soon"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="145489081521468132">"Tablet may shut down soon"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="1070562682853942350">"Device may shut down soon"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="4429259621177089719">"Phone may shut down soon (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="7703677921000858479">"Tablet may shut down soon (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="4374784375644214578">"Device may shut down soon (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
     <string name="power_charging" msgid="6727132649743436802">"<xliff:g id="LEVEL">%1$s</xliff:g> - <xliff:g id="STATE">%2$s</xliff:g>"</string>
     <string name="power_remaining_charging_duration_only" msgid="7415639699283965818">"<xliff:g id="TIME">%1$s</xliff:g> left until charged"</string>
     <string name="power_charging_duration" msgid="5005740040558984057">"<xliff:g id="LEVEL">%1$s</xliff:g> - <xliff:g id="TIME">%2$s</xliff:g> until charged"</string>
     <string name="battery_info_status_unknown" msgid="268625384868401114">"Unknown"</string>
     <string name="battery_info_status_charging" msgid="4279958015430387405">"Charging"</string>
-    <!-- no translation found for battery_info_status_charging_fast (8027559755902954885) -->
-    <skip />
-    <!-- no translation found for battery_info_status_charging_slow (3190803837168962319) -->
-    <skip />
+    <string name="battery_info_status_charging_fast" msgid="8027559755902954885">"Charging rapidly"</string>
+    <string name="battery_info_status_charging_slow" msgid="3190803837168962319">"Charging slowly"</string>
     <string name="battery_info_status_discharging" msgid="6962689305413556485">"Not charging"</string>
     <string name="battery_info_status_not_charging" msgid="8330015078868707899">"Plugged in, can\'t charge at the moment"</string>
     <string name="battery_info_status_full" msgid="4443168946046847468">"Full"</string>
diff --git a/packages/SettingsLib/res/values-en-rCA/strings.xml b/packages/SettingsLib/res/values-en-rCA/strings.xml
index ec0a129..810f81e 100644
--- a/packages/SettingsLib/res/values-en-rCA/strings.xml
+++ b/packages/SettingsLib/res/values-en-rCA/strings.xml
@@ -206,6 +206,33 @@
     <string name="enable_adb" msgid="8072776357237289039">"USB debugging"</string>
     <string name="enable_adb_summary" msgid="3711526030096574316">"Debug mode when USB is connected"</string>
     <string name="clear_adb_keys" msgid="3010148733140369917">"Revoke USB debugging authorisations"</string>
+    <string name="enable_adb_wireless" msgid="6973226350963971018">"Wireless debugging"</string>
+    <string name="enable_adb_wireless_summary" msgid="7344391423657093011">"Debug mode when Wi‑Fi is connected"</string>
+    <string name="adb_wireless_error" msgid="721958772149779856">"Error"</string>
+    <string name="adb_wireless_settings" msgid="2295017847215680229">"Wireless debugging"</string>
+    <string name="adb_wireless_list_empty_off" msgid="1713707973837255490">"To see and use available devices, turn on wireless debugging"</string>
+    <string name="adb_pair_method_qrcode_title" msgid="6982904096137468634">"Pair device with QR code"</string>
+    <string name="adb_pair_method_qrcode_summary" msgid="3729901496856458634">"Pair new devices using QR code scanner"</string>
+    <string name="adb_pair_method_code_title" msgid="1122590300445142904">"Pair device with pairing code"</string>
+    <string name="adb_pair_method_code_summary" msgid="6370414511333685185">"Pair new devices using six-digit code"</string>
+    <string name="adb_paired_devices_title" msgid="5268997341526217362">"Paired devices"</string>
+    <string name="adb_wireless_device_connected_summary" msgid="3039660790249148713">"Currently connected"</string>
+    <string name="adb_wireless_device_details_title" msgid="7129369670526565786">"Device details"</string>
+    <string name="adb_device_forget" msgid="193072400783068417">"Forget"</string>
+    <string name="adb_device_fingerprint_title_format" msgid="291504822917843701">"Device fingerprint: <xliff:g id="FINGERPRINT_PARAM">%1$s</xliff:g>"</string>
+    <string name="adb_wireless_connection_failed_title" msgid="664211177427438438">"Connection unsuccessful"</string>
+    <string name="adb_wireless_connection_failed_message" msgid="9213896700171602073">"Make sure that <xliff:g id="DEVICE_NAME">%1$s</xliff:g> is connected to the correct network"</string>
+    <string name="adb_pairing_device_dialog_title" msgid="7141739231018530210">"Pair with device"</string>
+    <string name="adb_pairing_device_dialog_pairing_code_label" msgid="3639239786669722731">"Wi‑Fi pairing code"</string>
+    <string name="adb_pairing_device_dialog_failed_title" msgid="3426758947882091735">"Pairing unsuccessful"</string>
+    <string name="adb_pairing_device_dialog_failed_msg" msgid="6611097519661997148">"Make sure that the device is connected to the same network."</string>
+    <string name="adb_wireless_qrcode_summary" msgid="8051414549011801917">"Pair device over Wi‑Fi by scanning a QR code"</string>
+    <string name="adb_wireless_verifying_qrcode_text" msgid="6123192424916029207">"Pairing device…"</string>
+    <string name="adb_qrcode_pairing_device_failed_msg" msgid="6936292092592914132">"Failed to pair the device. Either the QR code was incorrect, or the device is not connected to the same network."</string>
+    <string name="adb_wireless_ip_addr_preference_title" msgid="8335132107715311730">"IP address &amp; port"</string>
+    <string name="adb_wireless_qrcode_pairing_title" msgid="1906409667944674707">"Scan QR code"</string>
+    <string name="adb_wireless_qrcode_pairing_description" msgid="8578868049289910131">"Pair device over Wi‑Fi by scanning a QR code"</string>
+    <string name="keywords_adb_wireless" msgid="6507505581882171240">"adb, debug, dev"</string>
     <string name="bugreport_in_power" msgid="8664089072534638709">"Bug report shortcut"</string>
     <string name="bugreport_in_power_summary" msgid="1885529649381831775">"Show a button in the power menu for taking a bug report"</string>
     <string name="keep_screen_on" msgid="1187161672348797558">"Stay awake"</string>
@@ -271,6 +298,8 @@
     <string name="tethering_hardware_offload_summary" msgid="7801345335142803029">"Use tethering hardware acceleration if available"</string>
     <string name="adb_warning_title" msgid="7708653449506485728">"Allow USB debugging?"</string>
     <string name="adb_warning_message" msgid="8145270656419669221">"USB debugging is intended for development purposes only. Use it to copy data between your computer and your device, install apps on your device without notification and read log data."</string>
+    <string name="adbwifi_warning_title" msgid="727104571653031865">"Allow wireless debugging?"</string>
+    <string name="adbwifi_warning_message" msgid="8005936574322702388">"Wireless debugging is intended for development purposes only. Use it to copy data between your computer and your device, install apps on your device without notification, and read log data."</string>
     <string name="adb_keys_warning_message" msgid="2968555274488101220">"Revoke access to USB debugging from all computers you\'ve previously authorised?"</string>
     <string name="dev_settings_warning_title" msgid="8251234890169074553">"Allow development settings?"</string>
     <string name="dev_settings_warning_message" msgid="37741686486073668">"These settings are intended for development use only. They can cause your device and the applications on it to break or misbehave."</string>
@@ -383,8 +412,7 @@
     <string name="daltonizer_mode_protanomaly" msgid="7805583306666608440">"Protanomaly (red-green)"</string>
     <string name="daltonizer_mode_tritanomaly" msgid="7135266249220732267">"Tritanomaly (blue-yellow)"</string>
     <string name="accessibility_display_daltonizer_preference_title" msgid="1810693571332381974">"Colour correction"</string>
-    <!-- no translation found for accessibility_display_daltonizer_preference_subtitle (6178138727195403796) -->
-    <skip />
+    <string name="accessibility_display_daltonizer_preference_subtitle" msgid="6178138727195403796">"Colour correction helps people with colour blindness see more accurate colours"</string>
     <string name="daltonizer_type_overridden" msgid="4509604753672535721">"Overridden by <xliff:g id="TITLE">%1$s</xliff:g>"</string>
     <string name="power_remaining_settings_home_page" msgid="4885165789445462557">"<xliff:g id="PERCENTAGE">%1$s</xliff:g> - <xliff:g id="TIME_STRING">%2$s</xliff:g>"</string>
     <string name="power_remaining_duration_only" msgid="8264199158671531431">"About <xliff:g id="TIME_REMAINING">%1$s</xliff:g> left"</string>
@@ -403,21 +431,19 @@
     <string name="power_remaining_less_than_duration" msgid="1812668275239801236">"Less than <xliff:g id="THRESHOLD">%1$s</xliff:g> remaining (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_more_than_subtext" msgid="7919119719242734848">"More than <xliff:g id="TIME_REMAINING">%1$s</xliff:g> remaining (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_only_more_than_subtext" msgid="3274496164769110480">"More than <xliff:g id="TIME_REMAINING">%1$s</xliff:g> remaining"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="6583866940347159957">"Phone may shutdown soon"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="8009177999719462724">"Tablet may shutdown soon"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="8320892540455268018">"Device may shutdown soon"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="6186572170809116621">"Phone may shutdown soon (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="1338758278145563121">"Tablet may shutdown soon (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="3699579688084774362">"Device may shutdown soon (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="137330009791560774">"Phone may shut down soon"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="145489081521468132">"Tablet may shut down soon"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="1070562682853942350">"Device may shut down soon"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="4429259621177089719">"Phone may shut down soon (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="7703677921000858479">"Tablet may shut down soon (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="4374784375644214578">"Device may shut down soon (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
     <string name="power_charging" msgid="6727132649743436802">"<xliff:g id="LEVEL">%1$s</xliff:g> - <xliff:g id="STATE">%2$s</xliff:g>"</string>
     <string name="power_remaining_charging_duration_only" msgid="7415639699283965818">"<xliff:g id="TIME">%1$s</xliff:g> left until charged"</string>
     <string name="power_charging_duration" msgid="5005740040558984057">"<xliff:g id="LEVEL">%1$s</xliff:g> - <xliff:g id="TIME">%2$s</xliff:g> until charged"</string>
     <string name="battery_info_status_unknown" msgid="268625384868401114">"Unknown"</string>
     <string name="battery_info_status_charging" msgid="4279958015430387405">"Charging"</string>
-    <!-- no translation found for battery_info_status_charging_fast (8027559755902954885) -->
-    <skip />
-    <!-- no translation found for battery_info_status_charging_slow (3190803837168962319) -->
-    <skip />
+    <string name="battery_info_status_charging_fast" msgid="8027559755902954885">"Charging rapidly"</string>
+    <string name="battery_info_status_charging_slow" msgid="3190803837168962319">"Charging slowly"</string>
     <string name="battery_info_status_discharging" msgid="6962689305413556485">"Not charging"</string>
     <string name="battery_info_status_not_charging" msgid="8330015078868707899">"Plugged in, can\'t charge at the moment"</string>
     <string name="battery_info_status_full" msgid="4443168946046847468">"Full"</string>
diff --git a/packages/SettingsLib/res/values-en-rGB/strings.xml b/packages/SettingsLib/res/values-en-rGB/strings.xml
index ec0a129..810f81e 100644
--- a/packages/SettingsLib/res/values-en-rGB/strings.xml
+++ b/packages/SettingsLib/res/values-en-rGB/strings.xml
@@ -206,6 +206,33 @@
     <string name="enable_adb" msgid="8072776357237289039">"USB debugging"</string>
     <string name="enable_adb_summary" msgid="3711526030096574316">"Debug mode when USB is connected"</string>
     <string name="clear_adb_keys" msgid="3010148733140369917">"Revoke USB debugging authorisations"</string>
+    <string name="enable_adb_wireless" msgid="6973226350963971018">"Wireless debugging"</string>
+    <string name="enable_adb_wireless_summary" msgid="7344391423657093011">"Debug mode when Wi‑Fi is connected"</string>
+    <string name="adb_wireless_error" msgid="721958772149779856">"Error"</string>
+    <string name="adb_wireless_settings" msgid="2295017847215680229">"Wireless debugging"</string>
+    <string name="adb_wireless_list_empty_off" msgid="1713707973837255490">"To see and use available devices, turn on wireless debugging"</string>
+    <string name="adb_pair_method_qrcode_title" msgid="6982904096137468634">"Pair device with QR code"</string>
+    <string name="adb_pair_method_qrcode_summary" msgid="3729901496856458634">"Pair new devices using QR code scanner"</string>
+    <string name="adb_pair_method_code_title" msgid="1122590300445142904">"Pair device with pairing code"</string>
+    <string name="adb_pair_method_code_summary" msgid="6370414511333685185">"Pair new devices using six-digit code"</string>
+    <string name="adb_paired_devices_title" msgid="5268997341526217362">"Paired devices"</string>
+    <string name="adb_wireless_device_connected_summary" msgid="3039660790249148713">"Currently connected"</string>
+    <string name="adb_wireless_device_details_title" msgid="7129369670526565786">"Device details"</string>
+    <string name="adb_device_forget" msgid="193072400783068417">"Forget"</string>
+    <string name="adb_device_fingerprint_title_format" msgid="291504822917843701">"Device fingerprint: <xliff:g id="FINGERPRINT_PARAM">%1$s</xliff:g>"</string>
+    <string name="adb_wireless_connection_failed_title" msgid="664211177427438438">"Connection unsuccessful"</string>
+    <string name="adb_wireless_connection_failed_message" msgid="9213896700171602073">"Make sure that <xliff:g id="DEVICE_NAME">%1$s</xliff:g> is connected to the correct network"</string>
+    <string name="adb_pairing_device_dialog_title" msgid="7141739231018530210">"Pair with device"</string>
+    <string name="adb_pairing_device_dialog_pairing_code_label" msgid="3639239786669722731">"Wi‑Fi pairing code"</string>
+    <string name="adb_pairing_device_dialog_failed_title" msgid="3426758947882091735">"Pairing unsuccessful"</string>
+    <string name="adb_pairing_device_dialog_failed_msg" msgid="6611097519661997148">"Make sure that the device is connected to the same network."</string>
+    <string name="adb_wireless_qrcode_summary" msgid="8051414549011801917">"Pair device over Wi‑Fi by scanning a QR code"</string>
+    <string name="adb_wireless_verifying_qrcode_text" msgid="6123192424916029207">"Pairing device…"</string>
+    <string name="adb_qrcode_pairing_device_failed_msg" msgid="6936292092592914132">"Failed to pair the device. Either the QR code was incorrect, or the device is not connected to the same network."</string>
+    <string name="adb_wireless_ip_addr_preference_title" msgid="8335132107715311730">"IP address &amp; port"</string>
+    <string name="adb_wireless_qrcode_pairing_title" msgid="1906409667944674707">"Scan QR code"</string>
+    <string name="adb_wireless_qrcode_pairing_description" msgid="8578868049289910131">"Pair device over Wi‑Fi by scanning a QR code"</string>
+    <string name="keywords_adb_wireless" msgid="6507505581882171240">"adb, debug, dev"</string>
     <string name="bugreport_in_power" msgid="8664089072534638709">"Bug report shortcut"</string>
     <string name="bugreport_in_power_summary" msgid="1885529649381831775">"Show a button in the power menu for taking a bug report"</string>
     <string name="keep_screen_on" msgid="1187161672348797558">"Stay awake"</string>
@@ -271,6 +298,8 @@
     <string name="tethering_hardware_offload_summary" msgid="7801345335142803029">"Use tethering hardware acceleration if available"</string>
     <string name="adb_warning_title" msgid="7708653449506485728">"Allow USB debugging?"</string>
     <string name="adb_warning_message" msgid="8145270656419669221">"USB debugging is intended for development purposes only. Use it to copy data between your computer and your device, install apps on your device without notification and read log data."</string>
+    <string name="adbwifi_warning_title" msgid="727104571653031865">"Allow wireless debugging?"</string>
+    <string name="adbwifi_warning_message" msgid="8005936574322702388">"Wireless debugging is intended for development purposes only. Use it to copy data between your computer and your device, install apps on your device without notification, and read log data."</string>
     <string name="adb_keys_warning_message" msgid="2968555274488101220">"Revoke access to USB debugging from all computers you\'ve previously authorised?"</string>
     <string name="dev_settings_warning_title" msgid="8251234890169074553">"Allow development settings?"</string>
     <string name="dev_settings_warning_message" msgid="37741686486073668">"These settings are intended for development use only. They can cause your device and the applications on it to break or misbehave."</string>
@@ -383,8 +412,7 @@
     <string name="daltonizer_mode_protanomaly" msgid="7805583306666608440">"Protanomaly (red-green)"</string>
     <string name="daltonizer_mode_tritanomaly" msgid="7135266249220732267">"Tritanomaly (blue-yellow)"</string>
     <string name="accessibility_display_daltonizer_preference_title" msgid="1810693571332381974">"Colour correction"</string>
-    <!-- no translation found for accessibility_display_daltonizer_preference_subtitle (6178138727195403796) -->
-    <skip />
+    <string name="accessibility_display_daltonizer_preference_subtitle" msgid="6178138727195403796">"Colour correction helps people with colour blindness see more accurate colours"</string>
     <string name="daltonizer_type_overridden" msgid="4509604753672535721">"Overridden by <xliff:g id="TITLE">%1$s</xliff:g>"</string>
     <string name="power_remaining_settings_home_page" msgid="4885165789445462557">"<xliff:g id="PERCENTAGE">%1$s</xliff:g> - <xliff:g id="TIME_STRING">%2$s</xliff:g>"</string>
     <string name="power_remaining_duration_only" msgid="8264199158671531431">"About <xliff:g id="TIME_REMAINING">%1$s</xliff:g> left"</string>
@@ -403,21 +431,19 @@
     <string name="power_remaining_less_than_duration" msgid="1812668275239801236">"Less than <xliff:g id="THRESHOLD">%1$s</xliff:g> remaining (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_more_than_subtext" msgid="7919119719242734848">"More than <xliff:g id="TIME_REMAINING">%1$s</xliff:g> remaining (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_only_more_than_subtext" msgid="3274496164769110480">"More than <xliff:g id="TIME_REMAINING">%1$s</xliff:g> remaining"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="6583866940347159957">"Phone may shutdown soon"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="8009177999719462724">"Tablet may shutdown soon"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="8320892540455268018">"Device may shutdown soon"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="6186572170809116621">"Phone may shutdown soon (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="1338758278145563121">"Tablet may shutdown soon (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="3699579688084774362">"Device may shutdown soon (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="137330009791560774">"Phone may shut down soon"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="145489081521468132">"Tablet may shut down soon"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="1070562682853942350">"Device may shut down soon"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="4429259621177089719">"Phone may shut down soon (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="7703677921000858479">"Tablet may shut down soon (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="4374784375644214578">"Device may shut down soon (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
     <string name="power_charging" msgid="6727132649743436802">"<xliff:g id="LEVEL">%1$s</xliff:g> - <xliff:g id="STATE">%2$s</xliff:g>"</string>
     <string name="power_remaining_charging_duration_only" msgid="7415639699283965818">"<xliff:g id="TIME">%1$s</xliff:g> left until charged"</string>
     <string name="power_charging_duration" msgid="5005740040558984057">"<xliff:g id="LEVEL">%1$s</xliff:g> - <xliff:g id="TIME">%2$s</xliff:g> until charged"</string>
     <string name="battery_info_status_unknown" msgid="268625384868401114">"Unknown"</string>
     <string name="battery_info_status_charging" msgid="4279958015430387405">"Charging"</string>
-    <!-- no translation found for battery_info_status_charging_fast (8027559755902954885) -->
-    <skip />
-    <!-- no translation found for battery_info_status_charging_slow (3190803837168962319) -->
-    <skip />
+    <string name="battery_info_status_charging_fast" msgid="8027559755902954885">"Charging rapidly"</string>
+    <string name="battery_info_status_charging_slow" msgid="3190803837168962319">"Charging slowly"</string>
     <string name="battery_info_status_discharging" msgid="6962689305413556485">"Not charging"</string>
     <string name="battery_info_status_not_charging" msgid="8330015078868707899">"Plugged in, can\'t charge at the moment"</string>
     <string name="battery_info_status_full" msgid="4443168946046847468">"Full"</string>
diff --git a/packages/SettingsLib/res/values-en-rIN/strings.xml b/packages/SettingsLib/res/values-en-rIN/strings.xml
index ec0a129..810f81e 100644
--- a/packages/SettingsLib/res/values-en-rIN/strings.xml
+++ b/packages/SettingsLib/res/values-en-rIN/strings.xml
@@ -206,6 +206,33 @@
     <string name="enable_adb" msgid="8072776357237289039">"USB debugging"</string>
     <string name="enable_adb_summary" msgid="3711526030096574316">"Debug mode when USB is connected"</string>
     <string name="clear_adb_keys" msgid="3010148733140369917">"Revoke USB debugging authorisations"</string>
+    <string name="enable_adb_wireless" msgid="6973226350963971018">"Wireless debugging"</string>
+    <string name="enable_adb_wireless_summary" msgid="7344391423657093011">"Debug mode when Wi‑Fi is connected"</string>
+    <string name="adb_wireless_error" msgid="721958772149779856">"Error"</string>
+    <string name="adb_wireless_settings" msgid="2295017847215680229">"Wireless debugging"</string>
+    <string name="adb_wireless_list_empty_off" msgid="1713707973837255490">"To see and use available devices, turn on wireless debugging"</string>
+    <string name="adb_pair_method_qrcode_title" msgid="6982904096137468634">"Pair device with QR code"</string>
+    <string name="adb_pair_method_qrcode_summary" msgid="3729901496856458634">"Pair new devices using QR code scanner"</string>
+    <string name="adb_pair_method_code_title" msgid="1122590300445142904">"Pair device with pairing code"</string>
+    <string name="adb_pair_method_code_summary" msgid="6370414511333685185">"Pair new devices using six-digit code"</string>
+    <string name="adb_paired_devices_title" msgid="5268997341526217362">"Paired devices"</string>
+    <string name="adb_wireless_device_connected_summary" msgid="3039660790249148713">"Currently connected"</string>
+    <string name="adb_wireless_device_details_title" msgid="7129369670526565786">"Device details"</string>
+    <string name="adb_device_forget" msgid="193072400783068417">"Forget"</string>
+    <string name="adb_device_fingerprint_title_format" msgid="291504822917843701">"Device fingerprint: <xliff:g id="FINGERPRINT_PARAM">%1$s</xliff:g>"</string>
+    <string name="adb_wireless_connection_failed_title" msgid="664211177427438438">"Connection unsuccessful"</string>
+    <string name="adb_wireless_connection_failed_message" msgid="9213896700171602073">"Make sure that <xliff:g id="DEVICE_NAME">%1$s</xliff:g> is connected to the correct network"</string>
+    <string name="adb_pairing_device_dialog_title" msgid="7141739231018530210">"Pair with device"</string>
+    <string name="adb_pairing_device_dialog_pairing_code_label" msgid="3639239786669722731">"Wi‑Fi pairing code"</string>
+    <string name="adb_pairing_device_dialog_failed_title" msgid="3426758947882091735">"Pairing unsuccessful"</string>
+    <string name="adb_pairing_device_dialog_failed_msg" msgid="6611097519661997148">"Make sure that the device is connected to the same network."</string>
+    <string name="adb_wireless_qrcode_summary" msgid="8051414549011801917">"Pair device over Wi‑Fi by scanning a QR code"</string>
+    <string name="adb_wireless_verifying_qrcode_text" msgid="6123192424916029207">"Pairing device…"</string>
+    <string name="adb_qrcode_pairing_device_failed_msg" msgid="6936292092592914132">"Failed to pair the device. Either the QR code was incorrect, or the device is not connected to the same network."</string>
+    <string name="adb_wireless_ip_addr_preference_title" msgid="8335132107715311730">"IP address &amp; port"</string>
+    <string name="adb_wireless_qrcode_pairing_title" msgid="1906409667944674707">"Scan QR code"</string>
+    <string name="adb_wireless_qrcode_pairing_description" msgid="8578868049289910131">"Pair device over Wi‑Fi by scanning a QR code"</string>
+    <string name="keywords_adb_wireless" msgid="6507505581882171240">"adb, debug, dev"</string>
     <string name="bugreport_in_power" msgid="8664089072534638709">"Bug report shortcut"</string>
     <string name="bugreport_in_power_summary" msgid="1885529649381831775">"Show a button in the power menu for taking a bug report"</string>
     <string name="keep_screen_on" msgid="1187161672348797558">"Stay awake"</string>
@@ -271,6 +298,8 @@
     <string name="tethering_hardware_offload_summary" msgid="7801345335142803029">"Use tethering hardware acceleration if available"</string>
     <string name="adb_warning_title" msgid="7708653449506485728">"Allow USB debugging?"</string>
     <string name="adb_warning_message" msgid="8145270656419669221">"USB debugging is intended for development purposes only. Use it to copy data between your computer and your device, install apps on your device without notification and read log data."</string>
+    <string name="adbwifi_warning_title" msgid="727104571653031865">"Allow wireless debugging?"</string>
+    <string name="adbwifi_warning_message" msgid="8005936574322702388">"Wireless debugging is intended for development purposes only. Use it to copy data between your computer and your device, install apps on your device without notification, and read log data."</string>
     <string name="adb_keys_warning_message" msgid="2968555274488101220">"Revoke access to USB debugging from all computers you\'ve previously authorised?"</string>
     <string name="dev_settings_warning_title" msgid="8251234890169074553">"Allow development settings?"</string>
     <string name="dev_settings_warning_message" msgid="37741686486073668">"These settings are intended for development use only. They can cause your device and the applications on it to break or misbehave."</string>
@@ -383,8 +412,7 @@
     <string name="daltonizer_mode_protanomaly" msgid="7805583306666608440">"Protanomaly (red-green)"</string>
     <string name="daltonizer_mode_tritanomaly" msgid="7135266249220732267">"Tritanomaly (blue-yellow)"</string>
     <string name="accessibility_display_daltonizer_preference_title" msgid="1810693571332381974">"Colour correction"</string>
-    <!-- no translation found for accessibility_display_daltonizer_preference_subtitle (6178138727195403796) -->
-    <skip />
+    <string name="accessibility_display_daltonizer_preference_subtitle" msgid="6178138727195403796">"Colour correction helps people with colour blindness see more accurate colours"</string>
     <string name="daltonizer_type_overridden" msgid="4509604753672535721">"Overridden by <xliff:g id="TITLE">%1$s</xliff:g>"</string>
     <string name="power_remaining_settings_home_page" msgid="4885165789445462557">"<xliff:g id="PERCENTAGE">%1$s</xliff:g> - <xliff:g id="TIME_STRING">%2$s</xliff:g>"</string>
     <string name="power_remaining_duration_only" msgid="8264199158671531431">"About <xliff:g id="TIME_REMAINING">%1$s</xliff:g> left"</string>
@@ -403,21 +431,19 @@
     <string name="power_remaining_less_than_duration" msgid="1812668275239801236">"Less than <xliff:g id="THRESHOLD">%1$s</xliff:g> remaining (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_more_than_subtext" msgid="7919119719242734848">"More than <xliff:g id="TIME_REMAINING">%1$s</xliff:g> remaining (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_only_more_than_subtext" msgid="3274496164769110480">"More than <xliff:g id="TIME_REMAINING">%1$s</xliff:g> remaining"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="6583866940347159957">"Phone may shutdown soon"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="8009177999719462724">"Tablet may shutdown soon"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="8320892540455268018">"Device may shutdown soon"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="6186572170809116621">"Phone may shutdown soon (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="1338758278145563121">"Tablet may shutdown soon (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="3699579688084774362">"Device may shutdown soon (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="137330009791560774">"Phone may shut down soon"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="145489081521468132">"Tablet may shut down soon"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="1070562682853942350">"Device may shut down soon"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="4429259621177089719">"Phone may shut down soon (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="7703677921000858479">"Tablet may shut down soon (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="4374784375644214578">"Device may shut down soon (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
     <string name="power_charging" msgid="6727132649743436802">"<xliff:g id="LEVEL">%1$s</xliff:g> - <xliff:g id="STATE">%2$s</xliff:g>"</string>
     <string name="power_remaining_charging_duration_only" msgid="7415639699283965818">"<xliff:g id="TIME">%1$s</xliff:g> left until charged"</string>
     <string name="power_charging_duration" msgid="5005740040558984057">"<xliff:g id="LEVEL">%1$s</xliff:g> - <xliff:g id="TIME">%2$s</xliff:g> until charged"</string>
     <string name="battery_info_status_unknown" msgid="268625384868401114">"Unknown"</string>
     <string name="battery_info_status_charging" msgid="4279958015430387405">"Charging"</string>
-    <!-- no translation found for battery_info_status_charging_fast (8027559755902954885) -->
-    <skip />
-    <!-- no translation found for battery_info_status_charging_slow (3190803837168962319) -->
-    <skip />
+    <string name="battery_info_status_charging_fast" msgid="8027559755902954885">"Charging rapidly"</string>
+    <string name="battery_info_status_charging_slow" msgid="3190803837168962319">"Charging slowly"</string>
     <string name="battery_info_status_discharging" msgid="6962689305413556485">"Not charging"</string>
     <string name="battery_info_status_not_charging" msgid="8330015078868707899">"Plugged in, can\'t charge at the moment"</string>
     <string name="battery_info_status_full" msgid="4443168946046847468">"Full"</string>
diff --git a/packages/SettingsLib/res/values-en-rXC/strings.xml b/packages/SettingsLib/res/values-en-rXC/strings.xml
index 3b286f7..d142c0a 100644
--- a/packages/SettingsLib/res/values-en-rXC/strings.xml
+++ b/packages/SettingsLib/res/values-en-rXC/strings.xml
@@ -206,6 +206,33 @@
     <string name="enable_adb" msgid="8072776357237289039">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‏‎‏‏‏‏‏‏‏‏‏‎‎‎‎‎‎‎‎‏‎‎‎‎‏‎‎‎‎‏‏‎‏‎‏‎‎‏‏‎‏‎‏‎‏‎‎‎‏‎‎‏‏‎‎‏‏‏‏‎‎‎‎‎‏‎‎‏‏‏‏‎USB debugging‎‏‎‎‏‎"</string>
     <string name="enable_adb_summary" msgid="3711526030096574316">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‏‎‏‏‏‏‏‎‏‏‎‎‏‏‏‎‎‎‎‎‎‏‏‏‏‏‏‏‎‏‎‏‎‎‎‎‏‎‏‎‎‎‎‏‏‎‏‎‎‎‎‏‎‏‏‎‏‎‎‏‏‏‎‏‏‎‏‏‎‎‎Debug mode when USB is connected‎‏‎‎‏‎"</string>
     <string name="clear_adb_keys" msgid="3010148733140369917">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‏‎‏‏‏‏‏‎‏‎‏‎‎‏‏‏‎‎‎‏‏‎‎‎‏‏‎‎‏‎‎‏‎‏‎‎‏‏‎‎‎‎‎‏‏‏‏‏‏‎‏‏‎‎‏‎‎‎‎‎‎‏‏‏‏‏‏‏‎‏‎Revoke USB debugging authorizations‎‏‎‎‏‎"</string>
+    <string name="enable_adb_wireless" msgid="6973226350963971018">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‏‎‏‏‏‏‏‏‏‏‎‎‎‎‎‏‏‎‎‎‏‎‏‏‏‏‎‎‎‎‎‎‏‏‎‏‎‏‏‏‎‏‎‎‎‏‏‏‎‎‏‏‎‎‏‏‏‎‏‎‎‏‏‏‏‎‎‏‎‏‎‎Wireless debugging‎‏‎‎‏‎"</string>
+    <string name="enable_adb_wireless_summary" msgid="7344391423657093011">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‏‎‏‏‏‏‏‏‏‏‎‎‏‎‏‏‏‏‎‏‏‎‎‏‎‎‎‎‏‎‏‎‎‎‏‎‏‏‎‎‏‏‎‏‎‏‎‏‎‎‎‎‎‎‏‏‎‏‎‎‏‏‏‏‎‎‏‎‎‏‏‎Debug mode when Wi‑Fi is connected‎‏‎‎‏‎"</string>
+    <string name="adb_wireless_error" msgid="721958772149779856">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‏‎‏‏‏‏‎‎‏‎‏‎‎‎‎‎‎‏‎‎‏‏‏‎‏‎‎‏‏‎‏‎‏‏‎‏‏‎‎‏‏‏‎‎‎‏‏‏‎‏‏‎‏‏‏‏‏‏‎‏‏‎‎‏‎‎‎‎‎Error‎‏‎‎‏‎"</string>
+    <string name="adb_wireless_settings" msgid="2295017847215680229">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‏‎‏‏‏‏‎‏‏‏‏‏‏‏‏‎‏‏‎‎‏‏‎‎‎‏‎‏‎‏‎‎‏‎‎‏‎‏‎‎‏‎‎‎‎‎‏‏‏‏‎‎‎‏‏‏‎‏‎‏‎‏‏‏‎‎‏‎‏‎Wireless debugging‎‏‎‎‏‎"</string>
+    <string name="adb_wireless_list_empty_off" msgid="1713707973837255490">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‏‎‏‏‏‏‎‏‏‎‏‏‏‏‏‎‎‏‎‎‎‎‏‎‏‎‎‎‎‎‏‎‏‎‎‏‎‏‎‎‏‎‏‎‏‎‏‎‏‎‎‏‎‏‏‏‏‎‎‏‏‎‏‎‎‎‎‏‎‎To see and use available devices, turn on wireless debugging‎‏‎‎‏‎"</string>
+    <string name="adb_pair_method_qrcode_title" msgid="6982904096137468634">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‏‎‏‏‏‏‏‏‏‏‎‎‎‎‎‏‏‏‎‏‎‎‎‎‏‎‎‎‎‏‎‎‏‎‎‎‏‏‏‎‏‎‎‎‏‏‎‏‏‏‎‎‏‎‎‏‏‎‏‏‎‏‎‏‏‎‏‏‎‏‎‎Pair device with QR code‎‏‎‎‏‎"</string>
+    <string name="adb_pair_method_qrcode_summary" msgid="3729901496856458634">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‏‎‏‏‏‏‏‎‏‏‎‎‏‏‏‏‎‎‎‎‏‏‎‏‎‎‎‏‎‏‏‎‏‎‎‏‏‎‎‏‎‎‎‏‏‏‎‏‎‏‎‎‏‏‏‎‏‏‎‏‎‏‏‎‎‎‏‎‏‎‎Pair new devices using QR code Scanner‎‏‎‎‏‎"</string>
+    <string name="adb_pair_method_code_title" msgid="1122590300445142904">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‏‎‏‏‏‏‎‎‏‏‏‏‏‎‎‏‎‏‎‎‎‎‏‏‏‏‎‏‏‏‏‎‏‏‏‎‎‎‏‏‎‏‏‎‎‏‎‏‎‏‎‎‏‏‏‎‏‏‏‏‎‏‏‏‏‎‎‎‎Pair device with pairing code‎‏‎‎‏‎"</string>
+    <string name="adb_pair_method_code_summary" msgid="6370414511333685185">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‏‎‏‏‏‏‏‏‏‎‏‏‎‎‎‎‏‏‎‏‎‎‎‎‏‎‎‎‎‏‎‎‎‏‏‏‏‏‏‎‎‎‎‎‏‎‎‎‎‎‎‏‎‎‏‏‎‏‏‎‏‏‏‏‏‎‎‎‎‎‏‎Pair new devices using six digit code‎‏‎‎‏‎"</string>
+    <string name="adb_paired_devices_title" msgid="5268997341526217362">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‏‎‏‏‏‏‏‏‏‎‎‏‎‎‏‎‎‎‏‏‏‏‏‎‎‏‏‏‏‎‏‎‎‏‎‏‎‏‎‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‏‏‏‎‏‎‎‏‎‏‎‎‏‎‎‏‎‎Paired devices‎‏‎‎‏‎"</string>
+    <string name="adb_wireless_device_connected_summary" msgid="3039660790249148713">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‏‎‏‏‏‏‏‎‏‎‏‎‏‎‎‎‏‎‏‏‏‏‎‎‎‎‏‎‏‏‎‏‏‎‎‎‏‎‎‏‎‎‏‎‎‎‎‏‏‏‏‎‏‏‏‏‎‏‎‎‎‏‎‎‏‎‏‎‎‏‎Currently connected‎‏‎‎‏‎"</string>
+    <string name="adb_wireless_device_details_title" msgid="7129369670526565786">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‏‎‏‏‏‏‏‏‏‏‎‎‎‏‎‏‏‏‏‎‎‎‎‏‎‎‏‏‎‏‏‏‏‏‏‎‎‎‏‎‎‏‏‏‏‎‎‎‎‏‎‏‏‎‏‏‏‏‏‏‏‎‏‏‎‎‏‏‎‏‎‎Device details‎‏‎‎‏‎"</string>
+    <string name="adb_device_forget" msgid="193072400783068417">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‏‎‏‏‏‎‏‎‏‎‏‎‏‎‏‏‎‏‏‏‏‎‏‏‏‎‎‏‎‏‎‎‏‏‎‏‎‏‏‎‎‎‏‎‎‏‏‎‏‏‎‏‎‎‏‏‎‏‎‎‎‎‎‎‎‏‎Forget‎‏‎‎‏‎"</string>
+    <string name="adb_device_fingerprint_title_format" msgid="291504822917843701">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‏‎‏‏‏‎‏‏‏‎‎‎‎‎‎‏‎‏‏‏‎‏‎‎‎‏‎‎‎‎‏‎‏‏‏‏‎‎‎‏‏‎‎‎‏‎‏‎‏‎‎‏‏‎‎‏‎‏‎‏‏‏‏‎‏‎‏‎Device fingerprint: ‎‏‎‎‏‏‎<xliff:g id="FINGERPRINT_PARAM">%1$s</xliff:g>‎‏‎‎‏‏‏‎‎‏‎‎‏‎"</string>
+    <string name="adb_wireless_connection_failed_title" msgid="664211177427438438">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‏‎‏‏‏‏‎‎‏‎‎‏‎‎‏‏‎‏‏‏‏‏‎‎‎‎‎‎‏‎‎‎‏‎‏‏‏‏‏‏‎‏‏‎‎‏‏‎‏‎‎‎‎‎‎‎‏‎‏‏‎‏‏‎‎‏‏‎‎Connection unsuccessful‎‏‎‎‏‎"</string>
+    <string name="adb_wireless_connection_failed_message" msgid="9213896700171602073">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‏‎‏‏‏‏‏‏‏‏‏‏‏‏‏‏‏‎‏‏‏‏‎‎‏‎‏‎‏‏‎‎‎‏‏‏‎‏‏‎‏‎‎‎‎‏‎‏‏‎‏‏‏‏‏‎‏‎‎‏‎‎‎‏‎‎‏‏‎‎‏‎Make sure ‎‏‎‎‏‏‎<xliff:g id="DEVICE_NAME">%1$s</xliff:g>‎‏‎‎‏‏‏‎ is connected to the correct network‎‏‎‎‏‎"</string>
+    <string name="adb_pairing_device_dialog_title" msgid="7141739231018530210">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‏‎‏‏‏‏‏‏‏‏‎‎‎‏‏‎‎‎‏‏‏‎‎‏‎‎‎‏‏‎‏‏‏‏‏‏‏‎‏‏‏‏‏‎‏‏‏‎‏‎‏‎‏‎‎‏‎‏‏‎‏‎‏‏‎‏‎‎‎‏‎‎Pair with device‎‏‎‎‏‎"</string>
+    <string name="adb_pairing_device_dialog_pairing_code_label" msgid="3639239786669722731">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‏‎‏‏‏‏‏‎‏‏‎‎‏‎‏‎‎‎‎‎‎‏‎‎‏‎‏‏‎‏‎‏‎‎‏‏‎‏‏‏‏‏‎‎‎‎‏‏‏‎‏‎‏‎‏‏‎‎‏‏‎‎‎‏‏‎‏‎‏‏‎Wi‑Fi pairing code‎‏‎‎‏‎"</string>
+    <string name="adb_pairing_device_dialog_failed_title" msgid="3426758947882091735">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‏‎‏‏‏‏‏‎‏‎‏‏‏‏‏‎‎‎‏‏‏‎‎‏‎‎‏‎‏‏‎‎‎‏‏‎‏‏‎‏‏‏‏‎‏‏‎‏‏‎‎‏‏‏‎‏‎‎‎‏‎‎‏‏‎‏‎‏‏‏‎Pairing unsuccessful‎‏‎‎‏‎"</string>
+    <string name="adb_pairing_device_dialog_failed_msg" msgid="6611097519661997148">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‏‎‏‏‏‏‏‏‏‎‏‏‎‏‏‏‎‏‏‏‏‏‏‎‏‎‏‎‏‏‎‎‎‏‎‏‎‏‎‏‏‎‎‎‎‏‎‏‏‏‎‏‎‏‏‎‏‎‏‏‏‎‎‎‏‎‏‏‏‎‎‎Make sure the device is connected to the same network.‎‏‎‎‏‎"</string>
+    <string name="adb_wireless_qrcode_summary" msgid="8051414549011801917">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‏‎‏‏‏‏‏‏‏‏‎‏‏‏‏‏‎‏‏‏‏‎‎‎‏‎‏‏‏‏‎‏‏‎‏‏‏‏‏‏‏‎‎‎‏‎‏‎‏‎‎‎‎‏‎‏‎‏‎‎‏‏‏‎‎‏‏‏‏‎‏‎Pair device over Wi‑Fi by scanning a QR code‎‏‎‎‏‎"</string>
+    <string name="adb_wireless_verifying_qrcode_text" msgid="6123192424916029207">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‏‎‏‏‏‏‏‏‏‎‏‎‏‎‎‏‏‏‏‏‎‎‏‏‏‏‏‎‎‏‏‎‎‎‏‎‎‎‏‏‎‎‎‎‎‏‎‎‏‏‏‏‎‏‏‏‎‎‎‏‏‏‏‎‎‎‏‎‏‏‏‎Pairing device…‎‏‎‎‏‎"</string>
+    <string name="adb_qrcode_pairing_device_failed_msg" msgid="6936292092592914132">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‏‎‏‏‏‏‏‏‏‏‎‎‎‎‎‎‏‎‎‎‎‏‎‏‎‏‎‏‎‎‎‏‏‏‎‏‎‎‎‎‏‏‏‏‏‎‏‎‏‎‏‏‎‎‏‏‏‏‏‏‏‏‎‏‏‎‏‎‏‎‎‎Failed to pair the device. Either the QR code was incorrect, or the device is not connected to the same network.‎‏‎‎‏‎"</string>
+    <string name="adb_wireless_ip_addr_preference_title" msgid="8335132107715311730">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‏‎‏‏‏‏‏‏‏‏‏‎‎‏‏‏‎‏‎‏‏‎‎‎‏‎‏‎‏‏‎‎‏‏‏‏‏‎‏‏‎‎‏‎‏‎‎‎‏‎‏‎‎‏‎‏‏‏‏‏‎‎‎‎‏‏‏‎‎‏‎‎IP address &amp; Port‎‏‎‎‏‎"</string>
+    <string name="adb_wireless_qrcode_pairing_title" msgid="1906409667944674707">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‏‎‏‏‏‏‎‏‏‏‎‏‎‎‏‏‏‎‏‎‎‏‏‏‎‏‏‎‏‎‏‏‏‏‏‏‎‎‎‎‎‏‏‏‎‎‎‏‏‎‏‏‎‎‏‏‏‎‏‎‏‏‎‎‏‎‎‏‏‎Scan QR code‎‏‎‎‏‎"</string>
+    <string name="adb_wireless_qrcode_pairing_description" msgid="8578868049289910131">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‏‎‏‏‏‏‏‏‏‏‏‎‏‏‏‎‎‎‎‏‏‏‎‎‏‎‎‎‎‏‏‎‎‎‎‏‎‎‏‏‎‏‏‏‏‎‎‏‏‎‏‏‏‏‏‏‎‎‏‎‏‏‏‎‏‏‏‎‎‏‏‎Pair device over Wi‑Fi by scanning a QR Code‎‏‎‎‏‎"</string>
+    <string name="keywords_adb_wireless" msgid="6507505581882171240">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‏‎‏‏‏‏‏‏‏‎‏‏‎‏‎‎‏‎‎‏‏‏‏‎‏‎‎‏‏‎‏‏‏‎‏‏‎‎‏‎‎‏‏‎‏‎‏‏‏‏‏‎‏‎‏‎‏‎‏‏‏‏‏‎‏‏‎‏‎‎‎‎adb, debug, dev‎‏‎‎‏‎"</string>
     <string name="bugreport_in_power" msgid="8664089072534638709">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‏‎‏‏‏‏‏‏‏‏‏‏‎‎‎‎‎‏‏‏‏‎‏‎‎‎‎‎‏‏‏‎‎‎‏‏‎‏‏‎‏‏‎‏‏‏‎‏‏‎‎‎‏‎‏‎‏‎‏‎‎‎‎‎‏‏‏‎‏‎‏‎Bug report shortcut‎‏‎‎‏‎"</string>
     <string name="bugreport_in_power_summary" msgid="1885529649381831775">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‏‎‏‏‏‏‎‏‏‏‎‏‎‎‎‏‎‏‎‏‎‏‎‏‏‏‏‏‏‎‎‏‏‏‎‎‏‏‏‏‎‎‏‎‎‏‏‎‏‏‏‏‎‏‏‏‏‎‏‎‎‎‏‎‏‏‏‏‏‎Show a button in the power menu for taking a bug report‎‏‎‎‏‎"</string>
     <string name="keep_screen_on" msgid="1187161672348797558">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‏‎‏‏‏‏‎‏‏‎‎‎‎‎‏‏‏‏‎‎‏‏‎‏‎‎‏‎‏‎‏‎‎‎‎‎‎‎‏‎‎‏‎‏‏‎‏‎‎‏‏‏‏‎‎‎‎‏‎‏‎‎‏‏‏‎‏‏‎‎Stay awake‎‏‎‎‏‎"</string>
@@ -271,6 +298,8 @@
     <string name="tethering_hardware_offload_summary" msgid="7801345335142803029">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‏‎‏‏‏‏‏‏‏‏‎‏‏‎‎‎‏‎‎‎‎‏‏‏‏‏‏‎‎‏‎‎‎‏‏‏‏‏‏‏‎‏‏‏‏‏‏‎‏‎‏‎‏‏‎‎‏‏‎‎‏‏‎‎‏‎‏‎‏‎‏‎Use tethering hardware acceleration if available‎‏‎‎‏‎"</string>
     <string name="adb_warning_title" msgid="7708653449506485728">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‏‎‏‏‏‏‏‏‏‏‎‏‎‏‎‏‏‏‏‏‎‏‎‏‎‏‎‎‎‏‏‎‏‏‏‏‎‎‎‎‏‎‏‏‎‏‎‎‏‏‎‏‏‎‎‎‏‏‏‎‏‎‏‏‏‏‎‎‎‎‎‎Allow USB debugging?‎‏‎‎‏‎"</string>
     <string name="adb_warning_message" msgid="8145270656419669221">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‏‎‏‏‏‏‏‏‏‏‏‎‎‎‏‎‎‎‎‏‎‎‏‏‏‎‏‎‎‎‎‏‎‎‎‎‎‎‏‏‎‏‎‏‎‏‏‎‏‎‎‏‏‏‎‏‎‏‎‎‏‎‎‏‏‏‎‎‏‎‏‎USB debugging is intended for development purposes only. Use it to copy data between your computer and your device, install apps on your device without notification, and read log data.‎‏‎‎‏‎"</string>
+    <string name="adbwifi_warning_title" msgid="727104571653031865">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‏‎‏‏‏‏‎‎‏‎‏‎‎‎‎‏‎‏‏‏‎‎‏‏‎‎‎‏‏‏‎‎‎‎‎‏‎‏‏‎‏‎‏‏‏‏‏‏‎‎‎‏‎‎‎‎‎‏‏‏‏‎‏‏‏‎‎‏‎Allow wireless debugging?‎‏‎‎‏‎"</string>
+    <string name="adbwifi_warning_message" msgid="8005936574322702388">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‏‎‏‏‏‏‏‏‏‏‎‏‏‏‏‎‎‎‏‏‎‏‎‏‏‎‎‏‏‎‎‏‏‏‎‎‏‎‏‏‎‏‎‎‏‏‎‏‏‎‎‏‏‏‏‏‏‏‏‏‎‎‎‎‎‏‏‎‏‎‎‎Wireless debugging is intended for development purposes only. Use it to copy data between your computer and your device, install apps on your device without notification, and read log data.‎‏‎‎‏‎"</string>
     <string name="adb_keys_warning_message" msgid="2968555274488101220">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‏‎‏‏‏‏‏‎‏‎‏‎‎‏‎‎‏‏‎‎‏‎‎‏‏‎‏‏‎‏‎‏‎‎‏‎‏‏‎‏‎‎‎‏‏‏‏‏‏‏‏‎‎‏‏‎‏‏‏‎‎‏‎‏‏‎‎‏‎‎‎Revoke access to USB debugging from all computers you’ve previously authorized?‎‏‎‎‏‎"</string>
     <string name="dev_settings_warning_title" msgid="8251234890169074553">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‏‎‏‏‏‏‏‏‏‏‏‎‎‏‎‏‎‎‎‎‎‏‎‎‏‎‎‎‏‏‎‎‏‏‎‏‎‏‎‎‏‏‎‏‎‏‎‏‏‎‏‎‏‏‎‎‏‎‎‎‎‏‏‎‏‏‏‏‎‎‏‎Allow development settings?‎‏‎‎‏‎"</string>
     <string name="dev_settings_warning_message" msgid="37741686486073668">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‏‎‏‏‏‎‎‎‏‎‎‎‎‏‏‎‎‎‎‏‎‏‎‏‏‏‎‏‏‏‎‏‎‎‏‎‏‎‎‎‎‎‏‏‏‎‏‎‎‎‎‎‎‎‎‏‎‏‎‎‎‏‎‎‎These settings are intended for development use only. They can cause your device and the applications on it to break or misbehave.‎‏‎‎‏‎"</string>
@@ -383,8 +412,7 @@
     <string name="daltonizer_mode_protanomaly" msgid="7805583306666608440">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‏‎‏‏‏‏‏‏‏‏‎‏‏‎‎‎‏‎‏‎‎‏‏‎‎‎‎‎‎‎‎‏‎‏‎‏‎‎‏‎‏‏‎‎‎‏‎‏‎‎‏‎‏‎‏‎‎‎‎‎‏‏‏‎‎‏‏‏‎‎‎‎Protanomaly (red-green)‎‏‎‎‏‎"</string>
     <string name="daltonizer_mode_tritanomaly" msgid="7135266249220732267">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‏‎‏‏‏‏‏‏‏‏‎‎‎‏‏‎‎‎‎‎‏‎‏‏‎‎‎‏‏‏‎‏‏‎‏‏‎‎‏‎‏‏‏‎‎‏‎‏‎‏‎‎‎‏‎‏‎‏‏‎‏‎‏‎‏‏‎‏‎‏‏‎Tritanomaly (blue-yellow)‎‏‎‎‏‎"</string>
     <string name="accessibility_display_daltonizer_preference_title" msgid="1810693571332381974">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‏‎‏‏‏‏‎‏‏‏‎‎‏‎‎‏‎‎‎‎‎‏‏‏‎‎‎‎‎‎‎‏‏‎‏‎‏‏‎‏‎‏‏‎‎‎‏‎‏‏‎‎‏‏‎‎‏‏‏‎‏‎‎‎‏‎‏‏‎‎Color correction‎‏‎‎‏‎"</string>
-    <!-- no translation found for accessibility_display_daltonizer_preference_subtitle (6178138727195403796) -->
-    <skip />
+    <string name="accessibility_display_daltonizer_preference_subtitle" msgid="6178138727195403796">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‏‎‏‏‏‏‏‏‏‎‏‎‏‎‏‏‎‏‏‏‏‎‏‎‎‏‎‏‎‎‎‎‏‏‏‎‎‎‎‎‏‏‎‏‏‏‏‏‎‎‏‎‎‎‎‏‏‏‎‎‏‏‎‎‎‎‏‎‏‎‎‎Color correction helps people with colorblindness see more accurate colors‎‏‎‎‏‎"</string>
     <string name="daltonizer_type_overridden" msgid="4509604753672535721">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‏‎‏‏‏‏‏‎‏‏‏‏‏‎‏‎‎‏‎‏‎‏‎‏‎‏‎‏‎‏‏‎‏‎‎‎‎‏‎‏‏‎‏‏‎‎‎‎‎‏‎‎‎‎‎‏‏‏‏‏‏‎‏‎‏‎‏‎‎‏‎Overridden by ‎‏‎‎‏‏‎<xliff:g id="TITLE">%1$s</xliff:g>‎‏‎‎‏‏‏‎‎‏‎‎‏‎"</string>
     <string name="power_remaining_settings_home_page" msgid="4885165789445462557">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‏‎‏‏‏‏‏‏‏‎‎‎‎‏‏‏‏‎‎‏‎‏‏‏‎‎‏‏‎‎‎‎‏‏‎‎‏‏‏‎‎‎‏‏‏‎‎‏‏‎‎‏‎‎‏‏‎‎‏‏‎‏‎‎‎‎‏‏‏‎‏‎‎‏‎‎‏‏‎<xliff:g id="PERCENTAGE">%1$s</xliff:g>‎‏‎‎‏‏‏‎ - ‎‏‎‎‏‏‎<xliff:g id="TIME_STRING">%2$s</xliff:g>‎‏‎‎‏‏‏‎‎‏‎‎‏‎"</string>
     <string name="power_remaining_duration_only" msgid="8264199158671531431">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‏‎‏‏‏‏‏‏‏‏‏‎‎‏‎‏‎‏‏‎‎‎‎‎‏‎‏‎‏‎‏‎‏‎‏‏‎‎‏‎‏‏‎‎‏‎‏‏‎‏‏‎‎‏‎‏‏‎‏‏‏‎‏‏‎‏‎‎‏‏‏‎About ‎‏‎‎‏‏‎<xliff:g id="TIME_REMAINING">%1$s</xliff:g>‎‏‎‎‏‏‏‎ left‎‏‎‎‏‎"</string>
@@ -403,21 +431,19 @@
     <string name="power_remaining_less_than_duration" msgid="1812668275239801236">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‏‎‏‏‏‏‎‏‏‏‎‎‏‎‎‏‎‎‏‏‏‏‏‏‎‎‏‎‎‎‎‏‏‎‎‎‏‎‏‎‎‎‎‎‏‎‏‎‎‏‎‎‏‏‏‎‏‎‎‎‏‏‎‎‏‎‏‎‎‎Less than ‎‏‎‎‏‏‎<xliff:g id="THRESHOLD">%1$s</xliff:g>‎‏‎‎‏‏‏‎ remaining (‎‏‎‎‏‏‎<xliff:g id="LEVEL">%2$s</xliff:g>‎‏‎‎‏‏‏‎)‎‏‎‎‏‎"</string>
     <string name="power_remaining_more_than_subtext" msgid="7919119719242734848">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‏‎‏‏‏‏‏‏‏‏‎‏‏‎‏‏‏‏‎‎‏‏‎‎‏‎‏‏‏‎‏‎‏‏‎‏‏‎‏‎‏‏‎‎‏‏‏‎‏‎‎‎‎‎‏‎‎‎‏‏‏‎‏‎‎‎‎‎‎‎‎‎More than ‎‏‎‎‏‏‎<xliff:g id="TIME_REMAINING">%1$s</xliff:g>‎‏‎‎‏‏‏‎ remaining (‎‏‎‎‏‏‎<xliff:g id="LEVEL">%2$s</xliff:g>‎‏‎‎‏‏‏‎)‎‏‎‎‏‎"</string>
     <string name="power_remaining_only_more_than_subtext" msgid="3274496164769110480">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‏‎‏‏‏‏‏‎‏‎‏‏‎‏‎‏‏‏‎‎‎‏‎‏‎‏‏‎‎‎‏‏‏‎‏‎‎‏‏‎‏‎‏‏‏‏‎‏‏‏‎‎‎‏‎‎‎‏‏‎‎‏‏‏‎‏‎‎‎‎‎More than ‎‏‎‎‏‏‎<xliff:g id="TIME_REMAINING">%1$s</xliff:g>‎‏‎‎‏‏‏‎ remaining‎‏‎‎‏‎"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="6583866940347159957">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‏‎‏‏‏‏‏‏‏‎‏‏‎‏‏‎‏‎‏‏‏‏‎‏‎‎‏‏‎‎‎‎‎‎‏‏‎‎‏‎‏‏‏‎‎‏‏‏‏‎‏‎‏‎‎‏‎‎‏‎‏‎‏‏‎‎‏‎‏‎‏‎Phone may shutdown soon‎‏‎‎‏‎"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="8009177999719462724">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‏‎‏‏‏‏‏‏‏‏‎‏‏‏‏‎‎‏‎‎‏‏‎‎‏‎‏‎‎‎‎‏‏‏‏‎‏‎‎‏‏‎‏‎‎‎‎‎‎‏‎‎‏‏‎‏‏‏‏‎‏‏‏‎‏‎‎‎‏‎‎‎Tablet may shutdown soon‎‏‎‎‏‎"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="8320892540455268018">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‏‎‏‏‏‏‏‏‏‏‏‎‎‏‏‎‏‏‏‏‎‎‏‏‎‏‏‏‏‏‏‏‎‏‎‏‏‎‏‏‏‏‏‏‎‎‎‎‎‎‎‏‎‎‎‏‎‏‎‏‏‏‎‏‎‏‏‎‎‏‎‎Device may shutdown soon‎‏‎‎‏‎"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="6186572170809116621">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‏‎‏‏‏‏‏‏‏‎‏‎‏‎‏‏‏‎‏‏‎‏‏‎‎‎‏‏‏‏‎‏‎‎‏‏‏‎‎‏‎‎‎‏‎‏‎‎‏‏‎‎‏‎‏‎‎‎‎‎‏‏‏‏‏‎‎‏‏‎‏‎Phone may shutdown soon (‎‏‎‎‏‏‎<xliff:g id="LEVEL">%1$s</xliff:g>‎‏‎‎‏‏‏‎)‎‏‎‎‏‎"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="1338758278145563121">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‏‎‏‏‏‏‎‏‏‎‎‏‎‏‎‎‏‎‏‎‎‎‎‏‏‏‎‎‏‏‎‎‎‏‏‏‏‏‎‎‏‏‎‎‎‏‏‏‏‏‎‏‎‏‏‎‏‏‎‎‏‏‏‏‏‎‎‎‏‎Tablet may shutdown soon (‎‏‎‎‏‏‎<xliff:g id="LEVEL">%1$s</xliff:g>‎‏‎‎‏‏‏‎)‎‏‎‎‏‎"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="3699579688084774362">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‏‎‏‏‏‏‏‎‏‏‎‎‏‏‎‏‎‏‎‏‏‏‏‎‎‎‏‏‎‎‎‎‏‎‎‎‎‎‎‎‎‎‎‏‏‎‏‎‎‎‏‎‏‏‎‎‎‏‏‏‎‏‏‏‎‏‏‎‏‎‎Device may shutdown soon (‎‏‎‎‏‏‎<xliff:g id="LEVEL">%1$s</xliff:g>‎‏‎‎‏‏‏‎)‎‏‎‎‏‎"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="137330009791560774">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‏‎‏‏‏‎‎‏‏‏‏‏‎‎‏‏‏‏‏‏‎‎‏‎‎‏‏‏‎‏‎‏‎‏‎‎‏‎‎‏‎‏‎‏‎‎‎‎‎‎‏‏‏‏‏‎‎‎‏‎‎‎‏‏‎‎Phone may shut down soon‎‏‎‎‏‎"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="145489081521468132">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‏‎‏‏‏‎‏‎‏‎‎‎‎‎‎‏‎‎‏‏‏‎‎‎‎‏‏‎‎‎‏‏‎‎‎‏‏‏‏‏‏‎‏‏‎‎‏‎‎‎‏‏‏‏‎‎‏‎‏‏‏‎‎‏‎‎‎Tablet may shut down soon‎‏‎‎‏‎"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="1070562682853942350">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‏‎‏‏‏‏‎‎‏‏‏‎‏‏‎‏‏‎‏‏‎‏‏‎‎‏‏‏‎‎‎‏‎‏‏‎‏‎‎‎‎‏‎‏‎‏‎‎‏‏‎‎‎‏‏‎‎‏‎‎‎‏‎‎‏‏‏‎‎Device may shut down soon‎‏‎‎‏‎"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="4429259621177089719">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‏‎‏‏‏‏‏‎‏‏‏‏‎‏‎‏‏‏‎‏‏‏‏‏‏‎‎‏‎‎‎‎‏‎‏‎‎‎‏‎‎‎‎‎‏‎‎‎‏‏‏‏‎‏‏‏‎‏‏‏‏‎‏‎‏‏‎‏‏‏‎Phone may shut down soon (‎‏‎‎‏‏‎<xliff:g id="LEVEL">%1$s</xliff:g>‎‏‎‎‏‏‏‎)‎‏‎‎‏‎"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="7703677921000858479">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‏‎‏‏‏‏‏‏‏‏‎‏‎‏‎‏‏‏‎‏‎‎‎‏‏‏‏‎‏‏‎‎‏‎‎‎‎‎‎‏‏‎‏‏‎‎‏‎‏‎‎‎‏‏‎‏‎‏‎‎‎‏‏‎‏‏‎‏‏‏‏‎Tablet may shut down soon (‎‏‎‎‏‏‎<xliff:g id="LEVEL">%1$s</xliff:g>‎‏‎‎‏‏‏‎)‎‏‎‎‏‎"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="4374784375644214578">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‏‎‏‏‏‏‏‎‏‏‏‏‎‎‏‎‏‏‎‏‏‎‎‏‎‏‏‎‏‏‎‎‏‏‎‏‏‎‎‎‎‎‎‏‏‏‎‎‏‏‎‎‏‏‏‏‎‏‎‏‎‏‎‎‏‏‎‎‏‎‎Device may shut down soon (‎‏‎‎‏‏‎<xliff:g id="LEVEL">%1$s</xliff:g>‎‏‎‎‏‏‏‎)‎‏‎‎‏‎"</string>
     <string name="power_charging" msgid="6727132649743436802">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‏‎‏‏‏‏‏‏‏‎‏‏‏‎‏‎‏‎‏‏‎‏‏‏‎‎‏‎‎‏‏‏‎‎‎‎‎‎‎‏‏‎‎‏‎‎‎‏‏‏‎‎‎‏‏‏‏‎‎‏‏‎‎‎‎‎‎‎‎‏‎‎‎‏‎‎‏‏‎<xliff:g id="LEVEL">%1$s</xliff:g>‎‏‎‎‏‏‏‎ - ‎‏‎‎‏‏‎<xliff:g id="STATE">%2$s</xliff:g>‎‏‎‎‏‏‏‎‎‏‎‎‏‎"</string>
     <string name="power_remaining_charging_duration_only" msgid="7415639699283965818">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‏‎‏‏‏‏‏‏‏‏‎‎‏‏‎‏‏‏‎‏‎‎‏‏‎‏‎‎‏‎‏‎‎‎‎‎‏‎‎‎‏‎‎‏‎‏‎‎‎‎‏‏‎‏‎‏‏‏‏‎‏‏‏‎‏‏‏‏‎‏‎‎‎‏‎‎‏‏‎<xliff:g id="TIME">%1$s</xliff:g>‎‏‎‎‏‏‏‎ left until charged‎‏‎‎‏‎"</string>
     <string name="power_charging_duration" msgid="5005740040558984057">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‏‎‏‏‏‏‏‏‏‎‎‎‏‎‏‎‏‏‏‎‏‏‏‏‏‏‏‎‏‏‎‎‎‎‎‏‎‏‏‏‎‎‏‏‎‏‏‎‏‏‏‎‏‏‏‏‎‏‏‏‎‏‏‎‏‏‏‏‎‎‏‎‎‏‎‎‏‏‎<xliff:g id="LEVEL">%1$s</xliff:g>‎‏‎‎‏‏‏‎ - ‎‏‎‎‏‏‎<xliff:g id="TIME">%2$s</xliff:g>‎‏‎‎‏‏‏‎ until charged‎‏‎‎‏‎"</string>
     <string name="battery_info_status_unknown" msgid="268625384868401114">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‏‎‏‏‏‎‏‎‏‏‏‎‏‏‏‎‏‎‎‏‎‏‏‎‎‏‎‏‎‏‏‏‎‏‎‏‎‎‎‎‏‎‏‎‏‏‏‎‏‏‏‏‎‎‏‏‏‏‏‏‎‏‏‎‏‎‎Unknown‎‏‎‎‏‎"</string>
     <string name="battery_info_status_charging" msgid="4279958015430387405">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‏‎‏‏‏‏‏‎‏‏‏‎‏‏‎‏‏‎‎‏‎‏‎‏‏‏‎‏‏‏‎‎‏‎‎‎‏‏‏‎‎‎‏‎‏‏‎‏‎‏‎‎‎‎‎‏‏‎‎‏‏‎‏‏‎‎‏‏‎‏‎Charging‎‏‎‎‏‎"</string>
-    <!-- no translation found for battery_info_status_charging_fast (8027559755902954885) -->
-    <skip />
-    <!-- no translation found for battery_info_status_charging_slow (3190803837168962319) -->
-    <skip />
+    <string name="battery_info_status_charging_fast" msgid="8027559755902954885">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‏‎‏‏‏‏‏‏‏‏‎‏‏‏‏‎‏‏‎‎‏‏‏‏‎‎‏‏‏‏‏‎‎‎‏‎‎‎‎‏‏‏‎‏‏‏‏‏‏‎‏‎‎‎‏‎‎‏‎‏‏‎‏‏‎‎‎‎‏‎‏‎Charging rapidly‎‏‎‎‏‎"</string>
+    <string name="battery_info_status_charging_slow" msgid="3190803837168962319">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‏‎‏‏‏‏‏‎‏‎‏‏‎‎‎‏‎‎‏‎‎‎‎‎‎‎‎‎‏‏‎‎‏‎‏‏‏‏‎‎‏‎‏‏‏‎‎‏‏‎‏‎‎‎‏‏‎‎‏‎‏‏‎‎‎‎‏‏‏‏‎Charging slowly‎‏‎‎‏‎"</string>
     <string name="battery_info_status_discharging" msgid="6962689305413556485">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‏‎‏‏‏‏‏‏‏‏‎‎‎‎‎‏‎‏‎‎‎‎‎‎‏‏‏‎‎‎‏‎‎‎‎‏‎‎‎‏‎‎‎‏‎‏‎‏‎‎‏‎‏‏‎‎‎‎‏‏‎‎‏‎‎‎‎‎‏‎‏‎Not charging‎‏‎‎‏‎"</string>
     <string name="battery_info_status_not_charging" msgid="8330015078868707899">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‏‎‏‏‏‏‏‏‏‏‏‎‎‏‏‏‎‎‏‏‎‏‎‎‎‏‎‏‎‎‎‏‎‎‏‎‏‎‎‎‏‏‏‎‏‎‏‏‎‎‏‏‏‎‏‏‏‏‎‏‎‏‎‎‎‏‏‏‎‏‏‎Plugged in, can\'t charge right now‎‏‎‎‏‎"</string>
     <string name="battery_info_status_full" msgid="4443168946046847468">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‏‎‏‏‏‏‏‎‏‏‏‏‎‏‏‎‏‎‏‎‎‏‎‏‎‎‏‏‏‎‏‎‎‏‏‏‎‏‏‎‎‏‎‎‏‎‎‎‏‎‏‎‏‏‎‏‎‎‏‎‎‏‏‏‏‎‏‏‎‎‎Full‎‏‎‎‏‎"</string>
diff --git a/packages/SettingsLib/res/values-es-rUS/strings.xml b/packages/SettingsLib/res/values-es-rUS/strings.xml
index 966f2f2..8b99f72 100644
--- a/packages/SettingsLib/res/values-es-rUS/strings.xml
+++ b/packages/SettingsLib/res/values-es-rUS/strings.xml
@@ -66,7 +66,7 @@
     <string name="bluetooth_disconnected" msgid="7739366554710388701">"Desconectado"</string>
     <string name="bluetooth_disconnecting" msgid="7638892134401574338">"Desconectando…"</string>
     <string name="bluetooth_connecting" msgid="5871702668260192755">"Conectando…"</string>
-    <string name="bluetooth_connected" msgid="8065345572198502293">"Conectado a <xliff:g id="ACTIVE_DEVICE">%1$s</xliff:g>"</string>
+    <string name="bluetooth_connected" msgid="8065345572198502293">"Conectado<xliff:g id="ACTIVE_DEVICE">%1$s</xliff:g>"</string>
     <string name="bluetooth_pairing" msgid="4269046942588193600">"Vinculando..."</string>
     <string name="bluetooth_connected_no_headset" msgid="2224101138659967604">"Conectado (sin teléfono) a <xliff:g id="ACTIVE_DEVICE">%1$s</xliff:g>"</string>
     <string name="bluetooth_connected_no_a2dp" msgid="8566874395813947092">"Conectado (sin archivos multimedia) a <xliff:g id="ACTIVE_DEVICE">%1$s</xliff:g>"</string>
@@ -172,7 +172,7 @@
     <string name="tts_engine_network_required" msgid="8722087649733906851">"Este idioma necesita una conexión de red en funcionamiento para la salida de texto a voz."</string>
     <string name="tts_default_sample_string" msgid="6388016028292967973">"Ejemplo de síntesis de voz"</string>
     <string name="tts_status_title" msgid="8190784181389278640">"Estado del idioma predeterminado"</string>
-    <string name="tts_status_ok" msgid="8583076006537547379">"El idioma <xliff:g id="LOCALE">%1$s</xliff:g> es totalmente compatible."</string>
+    <string name="tts_status_ok" msgid="8583076006537547379">"El idioma <xliff:g id="LOCALE">%1$s</xliff:g> es totalmente compatible"</string>
     <string name="tts_status_requires_network" msgid="8327617638884678896">"El idioma <xliff:g id="LOCALE">%1$s</xliff:g> requiere una conexión de red."</string>
     <string name="tts_status_not_supported" msgid="2702997696245523743">"El idioma <xliff:g id="LOCALE">%1$s</xliff:g> no es compatible."</string>
     <string name="tts_status_checking" msgid="8026559918948285013">"Comprobando…"</string>
@@ -206,6 +206,33 @@
     <string name="enable_adb" msgid="8072776357237289039">"Depuración por USB"</string>
     <string name="enable_adb_summary" msgid="3711526030096574316">"Modo de depuración cuando se conecta el USB"</string>
     <string name="clear_adb_keys" msgid="3010148733140369917">"Revocar autorizaciones de depur. USB"</string>
+    <string name="enable_adb_wireless" msgid="6973226350963971018">"Depuración inalámbrica"</string>
+    <string name="enable_adb_wireless_summary" msgid="7344391423657093011">"Modo de depuración cuando la conexión Wi‑Fi está activada"</string>
+    <string name="adb_wireless_error" msgid="721958772149779856">"Error"</string>
+    <string name="adb_wireless_settings" msgid="2295017847215680229">"Depuración inalámbrica"</string>
+    <string name="adb_wireless_list_empty_off" msgid="1713707973837255490">"Para ver y usar los dispositivos disponibles, activa la depuración inalámbrica"</string>
+    <string name="adb_pair_method_qrcode_title" msgid="6982904096137468634">"Vincular dispositivo mediante código QR"</string>
+    <string name="adb_pair_method_qrcode_summary" msgid="3729901496856458634">"Vincular dispositivos nuevos mediante escáner de código QR"</string>
+    <string name="adb_pair_method_code_title" msgid="1122590300445142904">"Vincular dispositivo mediante código de sincroniz."</string>
+    <string name="adb_pair_method_code_summary" msgid="6370414511333685185">"Vincular dispositivos nuevos mediante código de seis dígitos"</string>
+    <string name="adb_paired_devices_title" msgid="5268997341526217362">"Dispositivos vinculados"</string>
+    <string name="adb_wireless_device_connected_summary" msgid="3039660790249148713">"Conectado actualmente"</string>
+    <string name="adb_wireless_device_details_title" msgid="7129369670526565786">"Detalles del dispositivo"</string>
+    <string name="adb_device_forget" msgid="193072400783068417">"Olvidar"</string>
+    <string name="adb_device_fingerprint_title_format" msgid="291504822917843701">"Huellas digitales del dispositivo: <xliff:g id="FINGERPRINT_PARAM">%1$s</xliff:g>"</string>
+    <string name="adb_wireless_connection_failed_title" msgid="664211177427438438">"Error de conexión"</string>
+    <string name="adb_wireless_connection_failed_message" msgid="9213896700171602073">"Asegúrate de que <xliff:g id="DEVICE_NAME">%1$s</xliff:g> esté conectado a la red correcta."</string>
+    <string name="adb_pairing_device_dialog_title" msgid="7141739231018530210">"Vincular con dispositivo"</string>
+    <string name="adb_pairing_device_dialog_pairing_code_label" msgid="3639239786669722731">"Código de sincroniz. de Wi‑Fi"</string>
+    <string name="adb_pairing_device_dialog_failed_title" msgid="3426758947882091735">"Error de sincronización"</string>
+    <string name="adb_pairing_device_dialog_failed_msg" msgid="6611097519661997148">"Asegúrate de que el dispositivo esté conectado a la misma red."</string>
+    <string name="adb_wireless_qrcode_summary" msgid="8051414549011801917">"Escanea un código QR para vincular el dispositivo mediante Wi‑Fi"</string>
+    <string name="adb_wireless_verifying_qrcode_text" msgid="6123192424916029207">"Vinculando dispositivo…"</string>
+    <string name="adb_qrcode_pairing_device_failed_msg" msgid="6936292092592914132">"Error al vincular el dispositivo. El código QR era incorrecto o el dispositivo no está conectado a la misma red."</string>
+    <string name="adb_wireless_ip_addr_preference_title" msgid="8335132107715311730">"Dirección IP y puerto"</string>
+    <string name="adb_wireless_qrcode_pairing_title" msgid="1906409667944674707">"Escanear código QR"</string>
+    <string name="adb_wireless_qrcode_pairing_description" msgid="8578868049289910131">"Escanea un código QR para vincular el dispositivo mediante Wi‑Fi"</string>
+    <string name="keywords_adb_wireless" msgid="6507505581882171240">"adb, debug, dev"</string>
     <string name="bugreport_in_power" msgid="8664089072534638709">"Acceso directo para informes de errores"</string>
     <string name="bugreport_in_power_summary" msgid="1885529649381831775">"Mostrar un botón en el menú de encendido para realizar un informe de errores"</string>
     <string name="keep_screen_on" msgid="1187161672348797558">"Permanecer activo"</string>
@@ -271,6 +298,8 @@
     <string name="tethering_hardware_offload_summary" msgid="7801345335142803029">"Usar la aceleración de hardware de conexión mediante dispositivo móvil si está disponible"</string>
     <string name="adb_warning_title" msgid="7708653449506485728">"¿Permitir depuración por USB?"</string>
     <string name="adb_warning_message" msgid="8145270656419669221">"La depuración por USB solo está indicada para actividades de programación. Úsala para copiar datos entre tu computadora y el dispositivo, para instalar aplicaciones en el dispositivo sin recibir notificaciones y para leer datos de registro."</string>
+    <string name="adbwifi_warning_title" msgid="727104571653031865">"¿Permitir la depuración inalámbrica?"</string>
+    <string name="adbwifi_warning_message" msgid="8005936574322702388">"La depuración inalámbrica solo está indicada para actividades de desarrollo. Úsala para copiar datos entre la computadora y el dispositivo, instalar apps en el dispositivo sin recibir notificaciones y leer datos de registro."</string>
     <string name="adb_keys_warning_message" msgid="2968555274488101220">"¿Quieres revocar el acceso a la depuración por USB desde todas la computadoras que autorizaste hasta ahora?"</string>
     <string name="dev_settings_warning_title" msgid="8251234890169074553">"¿Permitir configuración de desarrollo?"</string>
     <string name="dev_settings_warning_message" msgid="37741686486073668">"Estos parámetros de configuración están destinados únicamente a los programadores. Pueden hacer que el dispositivo o sus aplicaciones no funcionen correctamente."</string>
@@ -383,8 +412,7 @@
     <string name="daltonizer_mode_protanomaly" msgid="7805583306666608440">"Protanomalía (rojo-verde)"</string>
     <string name="daltonizer_mode_tritanomaly" msgid="7135266249220732267">"Tritanomalía (azul-amarillo)"</string>
     <string name="accessibility_display_daltonizer_preference_title" msgid="1810693571332381974">"Corrección de color"</string>
-    <!-- no translation found for accessibility_display_daltonizer_preference_subtitle (6178138727195403796) -->
-    <skip />
+    <string name="accessibility_display_daltonizer_preference_subtitle" msgid="6178138727195403796">"La corrección de color ayuda a las personas daltónicas a ver mejor los colores"</string>
     <string name="daltonizer_type_overridden" msgid="4509604753672535721">"Reemplazado por <xliff:g id="TITLE">%1$s</xliff:g>"</string>
     <string name="power_remaining_settings_home_page" msgid="4885165789445462557">"<xliff:g id="PERCENTAGE">%1$s</xliff:g> - <xliff:g id="TIME_STRING">%2$s</xliff:g>"</string>
     <string name="power_remaining_duration_only" msgid="8264199158671531431">"Tiempo restante: aproximadamente <xliff:g id="TIME_REMAINING">%1$s</xliff:g>"</string>
@@ -403,21 +431,19 @@
     <string name="power_remaining_less_than_duration" msgid="1812668275239801236">"Tiempo restante: menos de <xliff:g id="THRESHOLD">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_more_than_subtext" msgid="7919119719242734848">"Tiempo restante: más de <xliff:g id="TIME_REMAINING">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_only_more_than_subtext" msgid="3274496164769110480">"Tiempo restante: más de <xliff:g id="TIME_REMAINING">%1$s</xliff:g>"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="6583866940347159957">"Es posible que pronto se apague el teléfono"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="8009177999719462724">"Es posible que pronto se apague la tablet"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="8320892540455268018">"Es posible que pronto se apague el dispositivo"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="6186572170809116621">"Es posible que pronto se apague el teléfono (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="1338758278145563121">"Es posible que pronto se apague la tablet (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="3699579688084774362">"Es posible que pronto se apague el dispositivo (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="137330009791560774">"Es posible que pronto se apague el teléfono"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="145489081521468132">"Es posible que pronto se apague la tablet"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="1070562682853942350">"Es posible que pronto se apague el dispositivo"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="4429259621177089719">"Es posible que pronto se apague el teléfono (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="7703677921000858479">"Es posible que pronto se apague la tablet (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="4374784375644214578">"Es posible que pronto se apague el dispositivo (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
     <string name="power_charging" msgid="6727132649743436802">"<xliff:g id="LEVEL">%1$s</xliff:g>: <xliff:g id="STATE">%2$s</xliff:g>"</string>
     <string name="power_remaining_charging_duration_only" msgid="7415639699283965818">"<xliff:g id="TIME">%1$s</xliff:g> para completar la carga"</string>
     <string name="power_charging_duration" msgid="5005740040558984057">"<xliff:g id="LEVEL">%1$s</xliff:g> - <xliff:g id="TIME">%2$s</xliff:g> para completar la carga"</string>
     <string name="battery_info_status_unknown" msgid="268625384868401114">"Desconocido"</string>
     <string name="battery_info_status_charging" msgid="4279958015430387405">"Cargando"</string>
-    <!-- no translation found for battery_info_status_charging_fast (8027559755902954885) -->
-    <skip />
-    <!-- no translation found for battery_info_status_charging_slow (3190803837168962319) -->
-    <skip />
+    <string name="battery_info_status_charging_fast" msgid="8027559755902954885">"Carga rápida"</string>
+    <string name="battery_info_status_charging_slow" msgid="3190803837168962319">"Carga lenta"</string>
     <string name="battery_info_status_discharging" msgid="6962689305413556485">"No se está cargando."</string>
     <string name="battery_info_status_not_charging" msgid="8330015078868707899">"Conectado. No se puede cargar en este momento"</string>
     <string name="battery_info_status_full" msgid="4443168946046847468">"Cargado"</string>
diff --git a/packages/SettingsLib/res/values-es/strings.xml b/packages/SettingsLib/res/values-es/strings.xml
index 1198722..5c8efc5 100644
--- a/packages/SettingsLib/res/values-es/strings.xml
+++ b/packages/SettingsLib/res/values-es/strings.xml
@@ -190,7 +190,7 @@
     <item msgid="5664310435707146591">"Más rápida"</item>
     <item msgid="5491266922147715962">"Muy rápida"</item>
     <item msgid="7659240015901486196">"Superrápida"</item>
-    <item msgid="7147051179282410945">"Hiperrrápida"</item>
+    <item msgid="7147051179282410945">"Hiperrápida"</item>
     <item msgid="581904787661470707">"La más rápida"</item>
   </string-array>
     <string name="choose_profile" msgid="343803890897657450">"Seleccionar perfil"</string>
@@ -206,6 +206,33 @@
     <string name="enable_adb" msgid="8072776357237289039">"Depuración por USB"</string>
     <string name="enable_adb_summary" msgid="3711526030096574316">"Activar el modo de depuración cuando el dispositivo esté conectado por USB"</string>
     <string name="clear_adb_keys" msgid="3010148733140369917">"Revocar autorizaciones de depuración USB"</string>
+    <string name="enable_adb_wireless" msgid="6973226350963971018">"Depuración inalámbrica"</string>
+    <string name="enable_adb_wireless_summary" msgid="7344391423657093011">"Activar el modo Depuración cuando tenga conexión Wi‑Fi"</string>
+    <string name="adb_wireless_error" msgid="721958772149779856">"Error"</string>
+    <string name="adb_wireless_settings" msgid="2295017847215680229">"Depuración inalámbrica"</string>
+    <string name="adb_wireless_list_empty_off" msgid="1713707973837255490">"Para ver y utilizar los dispositivos disponibles, activa la depuración inalámbrica"</string>
+    <string name="adb_pair_method_qrcode_title" msgid="6982904096137468634">"Vincular dispositivo con código QR"</string>
+    <string name="adb_pair_method_qrcode_summary" msgid="3729901496856458634">"Vincula nuevos dispositivos con el escáner de códigos QR"</string>
+    <string name="adb_pair_method_code_title" msgid="1122590300445142904">"Vincular dispositivo con código de sincronización"</string>
+    <string name="adb_pair_method_code_summary" msgid="6370414511333685185">"Vincula nuevos dispositivos con un código de seis dígitos"</string>
+    <string name="adb_paired_devices_title" msgid="5268997341526217362">"Dispositivos vinculados"</string>
+    <string name="adb_wireless_device_connected_summary" msgid="3039660790249148713">"Conectados actualmente"</string>
+    <string name="adb_wireless_device_details_title" msgid="7129369670526565786">"Datos del dispositivo"</string>
+    <string name="adb_device_forget" msgid="193072400783068417">"Olvidar"</string>
+    <string name="adb_device_fingerprint_title_format" msgid="291504822917843701">"Huella digital del dispositivo: <xliff:g id="FINGERPRINT_PARAM">%1$s</xliff:g>"</string>
+    <string name="adb_wireless_connection_failed_title" msgid="664211177427438438">"No se ha podido conectar"</string>
+    <string name="adb_wireless_connection_failed_message" msgid="9213896700171602073">"Comprueba que has conectado <xliff:g id="DEVICE_NAME">%1$s</xliff:g> a la red correcta"</string>
+    <string name="adb_pairing_device_dialog_title" msgid="7141739231018530210">"Vincular con dispositivo"</string>
+    <string name="adb_pairing_device_dialog_pairing_code_label" msgid="3639239786669722731">"Código de sincronización de Wi‑Fi"</string>
+    <string name="adb_pairing_device_dialog_failed_title" msgid="3426758947882091735">"No se ha podido vincular"</string>
+    <string name="adb_pairing_device_dialog_failed_msg" msgid="6611097519661997148">"Comprueba que el dispositivo está conectado a la misma red."</string>
+    <string name="adb_wireless_qrcode_summary" msgid="8051414549011801917">"Vincula un dispositivo a través de Wi‑Fi con un código QR"</string>
+    <string name="adb_wireless_verifying_qrcode_text" msgid="6123192424916029207">"Vinculando dispositivo…"</string>
+    <string name="adb_qrcode_pairing_device_failed_msg" msgid="6936292092592914132">"No se ha podido vincular el dispositivo. El código QR no era correcto o el dispositivo no estaba conectado a la misma red."</string>
+    <string name="adb_wireless_ip_addr_preference_title" msgid="8335132107715311730">"Dirección IP y puerto"</string>
+    <string name="adb_wireless_qrcode_pairing_title" msgid="1906409667944674707">"Escanear código QR"</string>
+    <string name="adb_wireless_qrcode_pairing_description" msgid="8578868049289910131">"Vincula un dispositivo a través de Wi‑Fi con un código QR"</string>
+    <string name="keywords_adb_wireless" msgid="6507505581882171240">"adb, depuración, desarrollo"</string>
     <string name="bugreport_in_power" msgid="8664089072534638709">"Atajo a informe de errores"</string>
     <string name="bugreport_in_power_summary" msgid="1885529649381831775">"Mostrar un botón en el menú de encendido para crear un informe de errores"</string>
     <string name="keep_screen_on" msgid="1187161672348797558">"Pantalla siempre encendida al cargar"</string>
@@ -271,6 +298,8 @@
     <string name="tethering_hardware_offload_summary" msgid="7801345335142803029">"Usar la conexión compartida con aceleración por hardware si está disponible"</string>
     <string name="adb_warning_title" msgid="7708653449506485728">"¿Permitir depuración por USB?"</string>
     <string name="adb_warning_message" msgid="8145270656419669221">"La depuración por USB solo está indicada para actividades de desarrollo. Puedes utilizarla para intercambiar datos entre el ordenador y el dispositivo, para instalar aplicaciones en el dispositivo sin recibir notificaciones y para leer datos de registro."</string>
+    <string name="adbwifi_warning_title" msgid="727104571653031865">"¿Permitir la depuración inalámbrica?"</string>
+    <string name="adbwifi_warning_message" msgid="8005936574322702388">"La depuración inalámbrica solo está pensada para llevar a cabo actividades de desarrollo. Puedes utilizarla para intercambiar datos entre el ordenador y el dispositivo, para instalar aplicaciones en el dispositivo sin recibir notificaciones y para leer datos de registro."</string>
     <string name="adb_keys_warning_message" msgid="2968555274488101220">"¿Quieres revocar el acceso a la depuración por USB de todos los ordenadores que has autorizado?"</string>
     <string name="dev_settings_warning_title" msgid="8251234890169074553">"¿Permitir ajustes de desarrollo?"</string>
     <string name="dev_settings_warning_message" msgid="37741686486073668">"Estos ajustes están destinados únicamente a los desarrolladores. Pueden provocar que el dispositivo o las aplicaciones no funcionen correctamente."</string>
@@ -383,8 +412,7 @@
     <string name="daltonizer_mode_protanomaly" msgid="7805583306666608440">"Protanomalía (rojo-verde)"</string>
     <string name="daltonizer_mode_tritanomaly" msgid="7135266249220732267">"Tritanomalía (azul-amarillo)"</string>
     <string name="accessibility_display_daltonizer_preference_title" msgid="1810693571332381974">"Corrección de color"</string>
-    <!-- no translation found for accessibility_display_daltonizer_preference_subtitle (6178138727195403796) -->
-    <skip />
+    <string name="accessibility_display_daltonizer_preference_subtitle" msgid="6178138727195403796">"La corrección de color ayuda a que los usuarios con daltonismo vean colores similares a los que perciben otras personas"</string>
     <string name="daltonizer_type_overridden" msgid="4509604753672535721">"Anulado por <xliff:g id="TITLE">%1$s</xliff:g>"</string>
     <string name="power_remaining_settings_home_page" msgid="4885165789445462557">"<xliff:g id="PERCENTAGE">%1$s</xliff:g>: <xliff:g id="TIME_STRING">%2$s</xliff:g>"</string>
     <string name="power_remaining_duration_only" msgid="8264199158671531431">"Tiempo restante aproximado: <xliff:g id="TIME_REMAINING">%1$s</xliff:g>"</string>
@@ -403,21 +431,19 @@
     <string name="power_remaining_less_than_duration" msgid="1812668275239801236">"Queda menos del <xliff:g id="THRESHOLD">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_more_than_subtext" msgid="7919119719242734848">"Queda más del <xliff:g id="TIME_REMAINING">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_only_more_than_subtext" msgid="3274496164769110480">"Tiempo restante: más de <xliff:g id="TIME_REMAINING">%1$s</xliff:g>"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="6583866940347159957">"Es posible que el teléfono se apague pronto"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="8009177999719462724">"Es posible que el tablet se apague pronto"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="8320892540455268018">"Es posible que el dispositivo se apague pronto"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="6186572170809116621">"Es posible que el teléfono se apague pronto (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="1338758278145563121">"Es posible que el tablet se apague pronto (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="3699579688084774362">"Es posible que el dispositivo se apague pronto (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="137330009791560774">"Es posible que el teléfono se apague pronto"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="145489081521468132">"Es posible que el tablet se apague pronto"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="1070562682853942350">"Es posible que el dispositivo se apague pronto"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="4429259621177089719">"Es posible que el teléfono se apague pronto (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="7703677921000858479">"Es posible que el tablet se apague pronto (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="4374784375644214578">"Es posible que el dispositivo se apague pronto (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
     <string name="power_charging" msgid="6727132649743436802">"<xliff:g id="LEVEL">%1$s</xliff:g> - <xliff:g id="STATE">%2$s</xliff:g>"</string>
     <string name="power_remaining_charging_duration_only" msgid="7415639699283965818">"<xliff:g id="TIME">%1$s</xliff:g> hasta que termine de cargarse"</string>
     <string name="power_charging_duration" msgid="5005740040558984057">"<xliff:g id="LEVEL">%1$s</xliff:g> (<xliff:g id="TIME">%2$s</xliff:g> hasta que termine de cargarse)"</string>
     <string name="battery_info_status_unknown" msgid="268625384868401114">"Desconocido"</string>
     <string name="battery_info_status_charging" msgid="4279958015430387405">"Cargando"</string>
-    <!-- no translation found for battery_info_status_charging_fast (8027559755902954885) -->
-    <skip />
-    <!-- no translation found for battery_info_status_charging_slow (3190803837168962319) -->
-    <skip />
+    <string name="battery_info_status_charging_fast" msgid="8027559755902954885">"Cargando rápidamente"</string>
+    <string name="battery_info_status_charging_slow" msgid="3190803837168962319">"Cargando lentamente"</string>
     <string name="battery_info_status_discharging" msgid="6962689305413556485">"No se está cargando"</string>
     <string name="battery_info_status_not_charging" msgid="8330015078868707899">"Se ha conectado, pero no se puede cargar en este momento"</string>
     <string name="battery_info_status_full" msgid="4443168946046847468">"Completa"</string>
diff --git a/packages/SettingsLib/res/values-et/strings.xml b/packages/SettingsLib/res/values-et/strings.xml
index 9be72f9..7597476 100644
--- a/packages/SettingsLib/res/values-et/strings.xml
+++ b/packages/SettingsLib/res/values-et/strings.xml
@@ -206,6 +206,33 @@
     <string name="enable_adb" msgid="8072776357237289039">"USB silumine"</string>
     <string name="enable_adb_summary" msgid="3711526030096574316">"Silumisrežiim, kui USB on ühendatud"</string>
     <string name="clear_adb_keys" msgid="3010148733140369917">"Tühista USB silumisvolitused"</string>
+    <string name="enable_adb_wireless" msgid="6973226350963971018">"Juhtmevaba silumine"</string>
+    <string name="enable_adb_wireless_summary" msgid="7344391423657093011">"Silumisrežiim, kui WiFi-ühendus on olemas"</string>
+    <string name="adb_wireless_error" msgid="721958772149779856">"Viga"</string>
+    <string name="adb_wireless_settings" msgid="2295017847215680229">"Juhtmevaba silumine"</string>
+    <string name="adb_wireless_list_empty_off" msgid="1713707973837255490">"Saadaolevate seadmete nägemiseks ja kasutamiseks lülitage sisse juhtmevaba silumine"</string>
+    <string name="adb_pair_method_qrcode_title" msgid="6982904096137468634">"Seadme sidumine QR-koodiga"</string>
+    <string name="adb_pair_method_qrcode_summary" msgid="3729901496856458634">"Uute seadmete sidumine QR-koodi skanneriga"</string>
+    <string name="adb_pair_method_code_title" msgid="1122590300445142904">"Seadme sidumine sidumiskoodiga"</string>
+    <string name="adb_pair_method_code_summary" msgid="6370414511333685185">"Uute seadmete sidumine kuuekohalise koodiga"</string>
+    <string name="adb_paired_devices_title" msgid="5268997341526217362">"Seotud seadmed"</string>
+    <string name="adb_wireless_device_connected_summary" msgid="3039660790249148713">"Praegu ühendatud"</string>
+    <string name="adb_wireless_device_details_title" msgid="7129369670526565786">"Seadme üksikasjad"</string>
+    <string name="adb_device_forget" msgid="193072400783068417">"Unusta"</string>
+    <string name="adb_device_fingerprint_title_format" msgid="291504822917843701">"Seadme sõrmejälg: <xliff:g id="FINGERPRINT_PARAM">%1$s</xliff:g>"</string>
+    <string name="adb_wireless_connection_failed_title" msgid="664211177427438438">"Ühendamine ebaõnnestus"</string>
+    <string name="adb_wireless_connection_failed_message" msgid="9213896700171602073">"Veenduge, et seade <xliff:g id="DEVICE_NAME">%1$s</xliff:g> oleks ühendatud samasse võrku"</string>
+    <string name="adb_pairing_device_dialog_title" msgid="7141739231018530210">"Sidumine seadmega"</string>
+    <string name="adb_pairing_device_dialog_pairing_code_label" msgid="3639239786669722731">"WiFi sidumiskood"</string>
+    <string name="adb_pairing_device_dialog_failed_title" msgid="3426758947882091735">"Sidumine ei õnnestunud"</string>
+    <string name="adb_pairing_device_dialog_failed_msg" msgid="6611097519661997148">"Veenduge, et seade oleks ühendatud samasse võrku."</string>
+    <string name="adb_wireless_qrcode_summary" msgid="8051414549011801917">"Siduge seade WiFi kaudu, skannides QR-koodi"</string>
+    <string name="adb_wireless_verifying_qrcode_text" msgid="6123192424916029207">"Seadme sidumine …"</string>
+    <string name="adb_qrcode_pairing_device_failed_msg" msgid="6936292092592914132">"Seadme sidumine ebaõnnestus. QR-kood oli vale või seade ei ole ühendatud samasse võrku."</string>
+    <string name="adb_wireless_ip_addr_preference_title" msgid="8335132107715311730">"IP-aadress ja port"</string>
+    <string name="adb_wireless_qrcode_pairing_title" msgid="1906409667944674707">"QR-koodi skannimine"</string>
+    <string name="adb_wireless_qrcode_pairing_description" msgid="8578868049289910131">"Siduge seade WiFi kaudu, skannides QR-koodi"</string>
+    <string name="keywords_adb_wireless" msgid="6507505581882171240">"adb, silumine, arendus"</string>
     <string name="bugreport_in_power" msgid="8664089072534638709">"Veaaruande otsetee"</string>
     <string name="bugreport_in_power_summary" msgid="1885529649381831775">"Kuva toitemenüüs veaaruande jäädvustamise nupp"</string>
     <string name="keep_screen_on" msgid="1187161672348797558">"Jää sisselülitatuks"</string>
@@ -271,6 +298,8 @@
     <string name="tethering_hardware_offload_summary" msgid="7801345335142803029">"Kasuta võimalusel jagamise riistvaralist kiirendust"</string>
     <string name="adb_warning_title" msgid="7708653449506485728">"Luban USB silumise?"</string>
     <string name="adb_warning_message" msgid="8145270656419669221">"USB-silumine on mõeldud ainult arendamiseks. Kasutage seda andmete kopeerimiseks oma arvuti ja seadme vahel, seadmesse rakenduste installimiseks ilma teatisteta ning logiandmete lugemiseks."</string>
+    <string name="adbwifi_warning_title" msgid="727104571653031865">"Kas lubada juhtmevaba silumine?"</string>
+    <string name="adbwifi_warning_message" msgid="8005936574322702388">"Juhtmevaba silumine on mõeldud ainult arendamiseks. Kasutage seda andmete kopeerimiseks oma arvuti ja seadme vahel, seadmesse rakenduste installimiseks ilma märguandeta ning logiandmete lugemiseks."</string>
     <string name="adb_keys_warning_message" msgid="2968555274488101220">"Kas tühistada juurdepääs USB silumisele kõikides arvutites, mille olete varem volitanud?"</string>
     <string name="dev_settings_warning_title" msgid="8251234890169074553">"Kas lubada arendajaseaded?"</string>
     <string name="dev_settings_warning_message" msgid="37741686486073668">"Need seaded on mõeldud ainult arendajatele. Need võivad põhjustada seadme ja seadmes olevate rakenduste rikkeid või valesti toimimist."</string>
@@ -383,8 +412,7 @@
     <string name="daltonizer_mode_protanomaly" msgid="7805583306666608440">"Protanomaalia (punane-roheline)"</string>
     <string name="daltonizer_mode_tritanomaly" msgid="7135266249220732267">"Tritanomaalia (sinine-kollane)"</string>
     <string name="accessibility_display_daltonizer_preference_title" msgid="1810693571332381974">"Värvide korrigeerimine"</string>
-    <!-- no translation found for accessibility_display_daltonizer_preference_subtitle (6178138727195403796) -->
-    <skip />
+    <string name="accessibility_display_daltonizer_preference_subtitle" msgid="6178138727195403796">"Värviparanduse funktsioon aitab värvipimedatel värve täpsemini näha"</string>
     <string name="daltonizer_type_overridden" msgid="4509604753672535721">"Alistas <xliff:g id="TITLE">%1$s</xliff:g>"</string>
     <string name="power_remaining_settings_home_page" msgid="4885165789445462557">"<xliff:g id="PERCENTAGE">%1$s</xliff:g> – <xliff:g id="TIME_STRING">%2$s</xliff:g>"</string>
     <string name="power_remaining_duration_only" msgid="8264199158671531431">"Ligikaudu <xliff:g id="TIME_REMAINING">%1$s</xliff:g> jäänud"</string>
@@ -403,21 +431,19 @@
     <string name="power_remaining_less_than_duration" msgid="1812668275239801236">"Jäänud on alla <xliff:g id="THRESHOLD">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_more_than_subtext" msgid="7919119719242734848">"Jäänud on üle <xliff:g id="TIME_REMAINING">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_only_more_than_subtext" msgid="3274496164769110480">"Jäänud on üle <xliff:g id="TIME_REMAINING">%1$s</xliff:g>"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="6583866940347159957">"Telefon võib peagi välja lülituda"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="8009177999719462724">"Tahvelarvuti võib peagi välja lülituda"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="8320892540455268018">"Seade võib peagi välja lülituda"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="6186572170809116621">"Telefon võib peagi välja lülituda (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="1338758278145563121">"Tahvelarvuti võib peagi välja lülituda (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="3699579688084774362">"Seade võib peagi välja lülituda (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="137330009791560774">"Telefon võib peagi välja lülituda"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="145489081521468132">"Tahvelarvuti võib peagi välja lülituda"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="1070562682853942350">"Seade võib peagi välja lülituda"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="4429259621177089719">"Telefon võib peagi välja lülituda (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="7703677921000858479">"Tahvelarvuti võib peagi välja lülituda (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="4374784375644214578">"Seade võib peagi välja lülituda (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
     <string name="power_charging" msgid="6727132649743436802">"<xliff:g id="LEVEL">%1$s</xliff:g> – <xliff:g id="STATE">%2$s</xliff:g>"</string>
     <string name="power_remaining_charging_duration_only" msgid="7415639699283965818">"Täislaadimiseni on jäänud <xliff:g id="TIME">%1$s</xliff:g>"</string>
     <string name="power_charging_duration" msgid="5005740040558984057">"<xliff:g id="LEVEL">%1$s</xliff:g> – <xliff:g id="TIME">%2$s</xliff:g> täislaadimiseni"</string>
     <string name="battery_info_status_unknown" msgid="268625384868401114">"Tundmatu"</string>
     <string name="battery_info_status_charging" msgid="4279958015430387405">"Laadimine"</string>
-    <!-- no translation found for battery_info_status_charging_fast (8027559755902954885) -->
-    <skip />
-    <!-- no translation found for battery_info_status_charging_slow (3190803837168962319) -->
-    <skip />
+    <string name="battery_info_status_charging_fast" msgid="8027559755902954885">"Kiiresti laadimine"</string>
+    <string name="battery_info_status_charging_slow" msgid="3190803837168962319">"Aeglaselt laadimine"</string>
     <string name="battery_info_status_discharging" msgid="6962689305413556485">"Ei lae"</string>
     <string name="battery_info_status_not_charging" msgid="8330015078868707899">"Vooluvõrgus, praegu ei saa laadida"</string>
     <string name="battery_info_status_full" msgid="4443168946046847468">"Täis"</string>
diff --git a/packages/SettingsLib/res/values-eu/strings.xml b/packages/SettingsLib/res/values-eu/strings.xml
index d0c6c52..fd2635a 100644
--- a/packages/SettingsLib/res/values-eu/strings.xml
+++ b/packages/SettingsLib/res/values-eu/strings.xml
@@ -124,7 +124,7 @@
     <string name="bluetooth_talkback_headset" msgid="3406852564400882682">"Mikrofonodun entzungailua"</string>
     <string name="bluetooth_talkback_phone" msgid="868393783858123880">"Telefonoa"</string>
     <string name="bluetooth_talkback_imaging" msgid="8781682986822514331">"Irudietarako gailua"</string>
-    <string name="bluetooth_talkback_headphone" msgid="8613073829180337091">"Aurikularra"</string>
+    <string name="bluetooth_talkback_headphone" msgid="8613073829180337091">"Entzungailua"</string>
     <string name="bluetooth_talkback_input_peripheral" msgid="5133944817800149942">"Idazteko gailua"</string>
     <string name="bluetooth_talkback_bluetooth" msgid="1143241359781999989">"Bluetooth gailua"</string>
     <string name="bluetooth_hearingaid_left_pairing_message" msgid="8561855779703533591">"Ezkerreko audifonoa parekatzen…"</string>
@@ -206,6 +206,33 @@
     <string name="enable_adb" msgid="8072776357237289039">"USB bidezko arazketa"</string>
     <string name="enable_adb_summary" msgid="3711526030096574316">"Gaitu arazketa modua USBa konektatzean"</string>
     <string name="clear_adb_keys" msgid="3010148733140369917">"Baliogabetu USB bidezko arazketarako baimenak"</string>
+    <string name="enable_adb_wireless" msgid="6973226350963971018">"Hari gabeko arazketa"</string>
+    <string name="enable_adb_wireless_summary" msgid="7344391423657093011">"Arazketa modua wifi-konexioa aktibatuta dagoenean"</string>
+    <string name="adb_wireless_error" msgid="721958772149779856">"Errorea"</string>
+    <string name="adb_wireless_settings" msgid="2295017847215680229">"Hari gabeko arazketa"</string>
+    <string name="adb_wireless_list_empty_off" msgid="1713707973837255490">"Erabilgarri dauden gailuak ikusteko eta erabiltzeko, aktibatu hari gabeko arazketa"</string>
+    <string name="adb_pair_method_qrcode_title" msgid="6982904096137468634">"Parekatu gailua QR kodearekin"</string>
+    <string name="adb_pair_method_qrcode_summary" msgid="3729901496856458634">"Parekatu gailu berriak QR kodea eskaneatuta"</string>
+    <string name="adb_pair_method_code_title" msgid="1122590300445142904">"Parekatu gailua parekatze-kodearekin"</string>
+    <string name="adb_pair_method_code_summary" msgid="6370414511333685185">"Parekatu gailu berriak sei digituko kodearekin"</string>
+    <string name="adb_paired_devices_title" msgid="5268997341526217362">"Parekatutako gailuak"</string>
+    <string name="adb_wireless_device_connected_summary" msgid="3039660790249148713">"Konektatuta daudenak"</string>
+    <string name="adb_wireless_device_details_title" msgid="7129369670526565786">"Gailuaren xehetasunak"</string>
+    <string name="adb_device_forget" msgid="193072400783068417">"Ahaztu"</string>
+    <string name="adb_device_fingerprint_title_format" msgid="291504822917843701">"Gailuaren erreferentzia-gako digitala: <xliff:g id="FINGERPRINT_PARAM">%1$s</xliff:g>"</string>
+    <string name="adb_wireless_connection_failed_title" msgid="664211177427438438">"Ezin izan da konektatu"</string>
+    <string name="adb_wireless_connection_failed_message" msgid="9213896700171602073">"Ziurtatu <xliff:g id="DEVICE_NAME">%1$s</xliff:g> sare berera konektatuta dagoela"</string>
+    <string name="adb_pairing_device_dialog_title" msgid="7141739231018530210">"Parekatu gailuarekin"</string>
+    <string name="adb_pairing_device_dialog_pairing_code_label" msgid="3639239786669722731">"Wifi bidezko parekatze-kodea"</string>
+    <string name="adb_pairing_device_dialog_failed_title" msgid="3426758947882091735">"Ezin izan da parekatu gailua"</string>
+    <string name="adb_pairing_device_dialog_failed_msg" msgid="6611097519661997148">"Ziurtatu gailua sare berera konektatuta dagoela."</string>
+    <string name="adb_wireless_qrcode_summary" msgid="8051414549011801917">"Parekatu gailua wifi sare baten bidez QR kode bat eskaneatuta"</string>
+    <string name="adb_wireless_verifying_qrcode_text" msgid="6123192424916029207">"Gailua parekatzen…"</string>
+    <string name="adb_qrcode_pairing_device_failed_msg" msgid="6936292092592914132">"Ezin izan da parekatu gailua. QR kodea ez zen zuzena zen edo gailua ez dago sare berera konektatuta."</string>
+    <string name="adb_wireless_ip_addr_preference_title" msgid="8335132107715311730">"IP helbidea eta ataka"</string>
+    <string name="adb_wireless_qrcode_pairing_title" msgid="1906409667944674707">"Eskaneatu QR kodea"</string>
+    <string name="adb_wireless_qrcode_pairing_description" msgid="8578868049289910131">"Parekatu gailua wifi sare baten bidez QR kode bat eskaneatuta"</string>
+    <string name="keywords_adb_wireless" msgid="6507505581882171240">"adb, araztu, gailua"</string>
     <string name="bugreport_in_power" msgid="8664089072534638709">"Akatsen txostenerako lasterbidea"</string>
     <string name="bugreport_in_power_summary" msgid="1885529649381831775">"Bateriaren menuan, erakutsi akatsen txostena sortzeko botoia"</string>
     <string name="keep_screen_on" msgid="1187161672348797558">"Mantendu aktibo"</string>
@@ -271,6 +298,8 @@
     <string name="tethering_hardware_offload_summary" msgid="7801345335142803029">"Erabilgarri badago, erabili konexioa partekatzeko hardwarearen azelerazioa"</string>
     <string name="adb_warning_title" msgid="7708653449506485728">"USB bidezko arazketa onartu?"</string>
     <string name="adb_warning_message" msgid="8145270656419669221">"USB bidezko arazketa garapen-xedeetarako soilik dago diseinatuta. Erabil ezazu ordenagailuaren eta gailuaren artean datuak kopiatzeko, aplikazioak gailuan jakinarazi gabe instalatzeko eta erregistro-datuak irakurtzeko."</string>
+    <string name="adbwifi_warning_title" msgid="727104571653031865">"Hari gabeko arazketa baimendu nahi duzu?"</string>
+    <string name="adbwifi_warning_message" msgid="8005936574322702388">"Hari gabeko arazketa garapen-xedeetarako soilik dago diseinatuta. Erabil ezazu ordenagailuaren eta gailuaren artean datuak kopiatzeko, gailuan aplikazioak jakinarazi gabe instalatzeko eta erregistroko datuak irakurtzeko."</string>
     <string name="adb_keys_warning_message" msgid="2968555274488101220">"Aurretik baimendutako ordenagailu guztiei USB bidezko arazketarako sarbidea baliogabetu nahi diezu?"</string>
     <string name="dev_settings_warning_title" msgid="8251234890169074553">"Baimendu garapenerako ezarpenak?"</string>
     <string name="dev_settings_warning_message" msgid="37741686486073668">"Ezarpen hauek garapen-xedeetarako pentsatu dira soilik. Baliteke ezarpenen eraginez gailua matxuratzea edo funtzionamendu okerra izatea."</string>
@@ -383,8 +412,7 @@
     <string name="daltonizer_mode_protanomaly" msgid="7805583306666608440">"Protanopia (gorri-berdeak)"</string>
     <string name="daltonizer_mode_tritanomaly" msgid="7135266249220732267">"Tritanopia (urdin-horia)"</string>
     <string name="accessibility_display_daltonizer_preference_title" msgid="1810693571332381974">"Koloreen zuzenketa"</string>
-    <!-- no translation found for accessibility_display_daltonizer_preference_subtitle (6178138727195403796) -->
-    <skip />
+    <string name="accessibility_display_daltonizer_preference_subtitle" msgid="6178138727195403796">"Kolore-zuzenketak kolore zehatzagoak ikusten laguntzen die kolore-itsutasuna duten pertsonei"</string>
     <string name="daltonizer_type_overridden" msgid="4509604753672535721">"<xliff:g id="TITLE">%1$s</xliff:g> hobespena gainjarri zaio"</string>
     <string name="power_remaining_settings_home_page" msgid="4885165789445462557">"<xliff:g id="PERCENTAGE">%1$s</xliff:g> - <xliff:g id="TIME_STRING">%2$s</xliff:g>"</string>
     <string name="power_remaining_duration_only" msgid="8264199158671531431">"<xliff:g id="TIME_REMAINING">%1$s</xliff:g> inguru gelditzen dira"</string>
@@ -403,21 +431,19 @@
     <string name="power_remaining_less_than_duration" msgid="1812668275239801236">"<xliff:g id="THRESHOLD">%1$s</xliff:g> baino gutxiago gelditzen da (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_more_than_subtext" msgid="7919119719242734848">"<xliff:g id="TIME_REMAINING">%1$s</xliff:g> baino gehiago gelditzen da (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_only_more_than_subtext" msgid="3274496164769110480">"<xliff:g id="TIME_REMAINING">%1$s</xliff:g> baino gehiago gelditzen da"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="6583866940347159957">"Baliteke telefonoa laster itzaltzea"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="8009177999719462724">"Baliteke tableta laster itzaltzea"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="8320892540455268018">"Baliteke gailua laster itzaltzea"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="6186572170809116621">"Baliteke telefonoa laster itzaltzea (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="1338758278145563121">"Baliteke tableta laster itzaltzea (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="3699579688084774362">"Baliteke gailua laster itzaltzea (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="137330009791560774">"Baliteke telefonoa laster itzaltzea"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="145489081521468132">"Baliteke tableta laster itzaltzea"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="1070562682853942350">"Baliteke gailua laster itzaltzea"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="4429259621177089719">"Baliteke telefonoa laster itzaltzea (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="7703677921000858479">"Baliteke tableta laster itzaltzea (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="4374784375644214578">"Baliteke gailua laster itzaltzea (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
     <string name="power_charging" msgid="6727132649743436802">"<xliff:g id="LEVEL">%1$s</xliff:g> - <xliff:g id="STATE">%2$s</xliff:g>"</string>
     <string name="power_remaining_charging_duration_only" msgid="7415639699283965818">"<xliff:g id="TIME">%1$s</xliff:g> guztiz kargatu arte"</string>
     <string name="power_charging_duration" msgid="5005740040558984057">"<xliff:g id="LEVEL">%1$s</xliff:g> - <xliff:g id="TIME">%2$s</xliff:g> guztiz kargatu arte"</string>
     <string name="battery_info_status_unknown" msgid="268625384868401114">"Ezezaguna"</string>
     <string name="battery_info_status_charging" msgid="4279958015430387405">"Kargatzen"</string>
-    <!-- no translation found for battery_info_status_charging_fast (8027559755902954885) -->
-    <skip />
-    <!-- no translation found for battery_info_status_charging_slow (3190803837168962319) -->
-    <skip />
+    <string name="battery_info_status_charging_fast" msgid="8027559755902954885">"Bizkor kargatzen"</string>
+    <string name="battery_info_status_charging_slow" msgid="3190803837168962319">"Mantso kargatzen"</string>
     <string name="battery_info_status_discharging" msgid="6962689305413556485">"Ez da kargatzen ari"</string>
     <string name="battery_info_status_not_charging" msgid="8330015078868707899">"Konektatuta dago. Ezin da kargatu une honetan."</string>
     <string name="battery_info_status_full" msgid="4443168946046847468">"Beteta"</string>
diff --git a/packages/SettingsLib/res/values-fa/strings.xml b/packages/SettingsLib/res/values-fa/strings.xml
index f15174a..9d92cfe 100644
--- a/packages/SettingsLib/res/values-fa/strings.xml
+++ b/packages/SettingsLib/res/values-fa/strings.xml
@@ -206,6 +206,33 @@
     <string name="enable_adb" msgid="8072776357237289039">"‏اشکال‌زدایی USB"</string>
     <string name="enable_adb_summary" msgid="3711526030096574316">"‏با اتصال USB، حالت اشکال‌زدایی فعال شود"</string>
     <string name="clear_adb_keys" msgid="3010148733140369917">"‏لغو مجوزهای اشکال‌زدایی USB"</string>
+    <string name="enable_adb_wireless" msgid="6973226350963971018">"اشکال‌زدایی بی‌سیم"</string>
+    <string name="enable_adb_wireless_summary" msgid="7344391423657093011">"‏حالت اشکال‌زدایی کردن وقتی Wi‑Fi متصل است"</string>
+    <string name="adb_wireless_error" msgid="721958772149779856">"خطا"</string>
+    <string name="adb_wireless_settings" msgid="2295017847215680229">"اشکال‌زدایی بی‌سیم"</string>
+    <string name="adb_wireless_list_empty_off" msgid="1713707973837255490">"برای مشاهده و استفاده از دستگاه‌های در دسترس، اشکال‌زدایی بی‌سیم را روشن کنید"</string>
+    <string name="adb_pair_method_qrcode_title" msgid="6982904096137468634">"‏مرتبط کردن دستگاه با کد QR"</string>
+    <string name="adb_pair_method_qrcode_summary" msgid="3729901496856458634">"‏دستگاه‌های جدید را با استفاده از اسکنر کد QR مرتبط کنید"</string>
+    <string name="adb_pair_method_code_title" msgid="1122590300445142904">"مرتبط کردن دستگاه با کد مرتبط‌سازی"</string>
+    <string name="adb_pair_method_code_summary" msgid="6370414511333685185">"دستگاه‌های جدید را با استفاده از کد شش رقمی مرتبط کنید"</string>
+    <string name="adb_paired_devices_title" msgid="5268997341526217362">"دستگاه‌های مرتبط‌شده"</string>
+    <string name="adb_wireless_device_connected_summary" msgid="3039660790249148713">"درحال‌حاضر متصل"</string>
+    <string name="adb_wireless_device_details_title" msgid="7129369670526565786">"جزئیات دستگاه"</string>
+    <string name="adb_device_forget" msgid="193072400783068417">"فراموش شود"</string>
+    <string name="adb_device_fingerprint_title_format" msgid="291504822917843701">"اثرانگشت دستگاه: <xliff:g id="FINGERPRINT_PARAM">%1$s</xliff:g>"</string>
+    <string name="adb_wireless_connection_failed_title" msgid="664211177427438438">"اتصال ناموفق"</string>
+    <string name="adb_wireless_connection_failed_message" msgid="9213896700171602073">"مطمئن شوید که <xliff:g id="DEVICE_NAME">%1$s</xliff:g> به شبکه درستی متصل شده باشد"</string>
+    <string name="adb_pairing_device_dialog_title" msgid="7141739231018530210">"مرتبط کردن با دستگاه"</string>
+    <string name="adb_pairing_device_dialog_pairing_code_label" msgid="3639239786669722731">"‏کد مرتبط‌سازی Wi‑Fi"</string>
+    <string name="adb_pairing_device_dialog_failed_title" msgid="3426758947882091735">"مرتبط‌سازی ناموفق"</string>
+    <string name="adb_pairing_device_dialog_failed_msg" msgid="6611097519661997148">"مطمئن شوید که دستگاه به همان شبکه متصل باشد."</string>
+    <string name="adb_wireless_qrcode_summary" msgid="8051414549011801917">"‏دستگاه را ازطریق Wi‑Fi و با اسکن کردن کد QR مرتبط کنید"</string>
+    <string name="adb_wireless_verifying_qrcode_text" msgid="6123192424916029207">"مرتبط‌سازی دستگاه…"</string>
+    <string name="adb_qrcode_pairing_device_failed_msg" msgid="6936292092592914132">"‏مرتبط کردن دستگاه انجام نشد. یا کد QR اشتباه بوده است، یا دستگاه به همان شبکه متصل نیست."</string>
+    <string name="adb_wireless_ip_addr_preference_title" msgid="8335132107715311730">"‏نشانی IP و درگاه"</string>
+    <string name="adb_wireless_qrcode_pairing_title" msgid="1906409667944674707">"‏اسکن کد QR"</string>
+    <string name="adb_wireless_qrcode_pairing_description" msgid="8578868049289910131">"‏دستگاه را ازطریق Wi‑Fi و با اسکن کردن کد QR مرتبط کنید"</string>
+    <string name="keywords_adb_wireless" msgid="6507505581882171240">"‏ADB (پل اشکال‌زدایی Android)، اشکال‌زدایی کردن، برنامه‌نویس"</string>
     <string name="bugreport_in_power" msgid="8664089072534638709">"میان‌بر گزارش مشکل"</string>
     <string name="bugreport_in_power_summary" msgid="1885529649381831775">"نمایش دکمه‌ای در منوی روشن/خاموش برای گرفتن گزارش اشکال"</string>
     <string name="keep_screen_on" msgid="1187161672348797558">"بیدار ماندن"</string>
@@ -271,6 +298,8 @@
     <string name="tethering_hardware_offload_summary" msgid="7801345335142803029">"استفاده از شتاب سخت‌افزاری اشتراک‌گذاری اینترنت درصورت دردسترس بودن"</string>
     <string name="adb_warning_title" msgid="7708653449506485728">"‏اشکال‌زدایی USB انجام شود؟"</string>
     <string name="adb_warning_message" msgid="8145270656419669221">"‏اشکال‌زدایی USB فقط برای اهداف برنامه‌نویسی در نظر گرفته شده است. از آن برای رونوشت‌برداری داده بین رایانه و دستگاهتان، نصب برنامه‌ها در دستگاهتان بدون اعلان و خواندن داده‌های گزارش استفاده کنید."</string>
+    <string name="adbwifi_warning_title" msgid="727104571653031865">"اشکال‌زدایی بی‌سیم انجام شود؟"</string>
+    <string name="adbwifi_warning_message" msgid="8005936574322702388">"اشکال‌زدایی بی‌سیم فقط برای اهداف برنامه‌نویسی در نظر گرفته شده است. از آن برای کپی کردن داده بین رایانه و دستگاهتان، نصب برنامه‌ها در دستگاهتان بدون اعلان، و خواندن داده‌های گزارش استفاده کنید."</string>
     <string name="adb_keys_warning_message" msgid="2968555274488101220">"‏دسترسی به اشکال‌زدایی USB از تمام رایانه‌هایی که قبلاً مجاز دانسته‌اید لغو شود؟"</string>
     <string name="dev_settings_warning_title" msgid="8251234890169074553">"تنظیمات برنامه‌نویسی مجاز باشد؟"</string>
     <string name="dev_settings_warning_message" msgid="37741686486073668">"این تنظیمات فقط برای برنامه‌نویسی در نظر گرفته شده است. ممکن است استفاده از این تنظیمات موجب خرابی یا عملکرد نادرست دستگاه یا برنامه‌های شما شود."</string>
@@ -383,8 +412,7 @@
     <string name="daltonizer_mode_protanomaly" msgid="7805583306666608440">"قرمزدشواربینی (قرمز-سبز)"</string>
     <string name="daltonizer_mode_tritanomaly" msgid="7135266249220732267">"آبی‌دشواربینی (آبی-زرد)"</string>
     <string name="accessibility_display_daltonizer_preference_title" msgid="1810693571332381974">"تصحیح رنگ"</string>
-    <!-- no translation found for accessibility_display_daltonizer_preference_subtitle (6178138727195403796) -->
-    <skip />
+    <string name="accessibility_display_daltonizer_preference_subtitle" msgid="6178138727195403796">"تصحیح رنگ به افراد مبتلا به کوررنگی کمک می‌کند رنگ‌ها را دقیق‌تر ببینند"</string>
     <string name="daltonizer_type_overridden" msgid="4509604753672535721">"توسط <xliff:g id="TITLE">%1$s</xliff:g> لغو شد"</string>
     <string name="power_remaining_settings_home_page" msgid="4885165789445462557">"<xliff:g id="PERCENTAGE">%1$s</xliff:g> - <xliff:g id="TIME_STRING">%2$s</xliff:g>"</string>
     <string name="power_remaining_duration_only" msgid="8264199158671531431">"تقریباً <xliff:g id="TIME_REMAINING">%1$s</xliff:g> شارژ باقی مانده است"</string>
@@ -403,21 +431,19 @@
     <string name="power_remaining_less_than_duration" msgid="1812668275239801236">"کمتر از <xliff:g id="THRESHOLD">%1$s</xliff:g> شارژ باقی مانده است (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_more_than_subtext" msgid="7919119719242734848">"بیش از <xliff:g id="TIME_REMAINING">%1$s</xliff:g> شارژ باقی مانده است (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_only_more_than_subtext" msgid="3274496164769110480">"بیش از <xliff:g id="TIME_REMAINING">%1$s</xliff:g> باقی مانده است"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="6583866940347159957">"ممکن است تلفن به‌زودی خاموش شود"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="8009177999719462724">"ممکن است رایانه لوحی به‌زودی خاموش شود"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="8320892540455268018">"ممکن است دستگاه به‌زودی خاموش شود"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="6186572170809116621">"ممکن است تلفن به‌زودی خاموش شود (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="1338758278145563121">"ممکن است رایانه لوحی به‌زودی خاموش شود (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="3699579688084774362">"ممکن است دستگاه به‌زودی خاموش شود (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="137330009791560774">"ممکن است تلفن به‌زودی خاموش شود"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="145489081521468132">"ممکن است رایانه لوحی به‌زودی خاموش شود"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="1070562682853942350">"ممکن است دستگاه به‌زودی خاموش شود"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="4429259621177089719">"ممکن است تلفن به‌زودی خاموش شود (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="7703677921000858479">"ممکن است رایانه لوحی به‌زودی خاموش شود (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="4374784375644214578">"ممکن است دستگاه به‌زودی خاموش شود (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
     <string name="power_charging" msgid="6727132649743436802">"<xliff:g id="LEVEL">%1$s</xliff:g> - ‏<xliff:g id="STATE">%2$s</xliff:g>"</string>
     <string name="power_remaining_charging_duration_only" msgid="7415639699283965818">"<xliff:g id="TIME">%1$s</xliff:g> مانده تا شارژ کامل"</string>
     <string name="power_charging_duration" msgid="5005740040558984057">"<xliff:g id="LEVEL">%1$s</xliff:g> - <xliff:g id="TIME">%2$s</xliff:g> تا شارژ کامل"</string>
     <string name="battery_info_status_unknown" msgid="268625384868401114">"ناشناس"</string>
     <string name="battery_info_status_charging" msgid="4279958015430387405">"در حال شارژ شدن"</string>
-    <!-- no translation found for battery_info_status_charging_fast (8027559755902954885) -->
-    <skip />
-    <!-- no translation found for battery_info_status_charging_slow (3190803837168962319) -->
-    <skip />
+    <string name="battery_info_status_charging_fast" msgid="8027559755902954885">"درحال شارژ شدن سریع"</string>
+    <string name="battery_info_status_charging_slow" msgid="3190803837168962319">"درحال شارژ شدن آهسته"</string>
     <string name="battery_info_status_discharging" msgid="6962689305413556485">"شارژ نمی‌شود"</string>
     <string name="battery_info_status_not_charging" msgid="8330015078868707899">"به برق وصل شده‌ است، درحال‌حاضر شارژ نمی‌شود"</string>
     <string name="battery_info_status_full" msgid="4443168946046847468">"پر"</string>
diff --git a/packages/SettingsLib/res/values-fi/strings.xml b/packages/SettingsLib/res/values-fi/strings.xml
index 1232db3..6bb6d5b 100644
--- a/packages/SettingsLib/res/values-fi/strings.xml
+++ b/packages/SettingsLib/res/values-fi/strings.xml
@@ -206,6 +206,33 @@
     <string name="enable_adb" msgid="8072776357237289039">"USB-vianetsintä"</string>
     <string name="enable_adb_summary" msgid="3711526030096574316">"Vianetsintätila USB-liitännän ollessa käytössä"</string>
     <string name="clear_adb_keys" msgid="3010148733140369917">"Peruuta USB-vianetsinnän käyttöoikeudet"</string>
+    <string name="enable_adb_wireless" msgid="6973226350963971018">"Langaton virheenkorjaus"</string>
+    <string name="enable_adb_wireless_summary" msgid="7344391423657093011">"Virheenkorjaustila Wi-Fin ollessa käytössä"</string>
+    <string name="adb_wireless_error" msgid="721958772149779856">"Virhe"</string>
+    <string name="adb_wireless_settings" msgid="2295017847215680229">"Langaton virheenkorjaus"</string>
+    <string name="adb_wireless_list_empty_off" msgid="1713707973837255490">"Laita langaton virheenkorjaus päälle, niin voit nähdä saatavilla olevat laitteet ja käyttää niitä"</string>
+    <string name="adb_pair_method_qrcode_title" msgid="6982904096137468634">"Muodosta laitepari QR-koodilla"</string>
+    <string name="adb_pair_method_qrcode_summary" msgid="3729901496856458634">"Muodosta uusia laitepareja QR-koodiskannerilla"</string>
+    <string name="adb_pair_method_code_title" msgid="1122590300445142904">"Yhdistä laite laiteparikoodilla"</string>
+    <string name="adb_pair_method_code_summary" msgid="6370414511333685185">"Muodosta uusia laitepareja kuusinumeroisella koodilla"</string>
+    <string name="adb_paired_devices_title" msgid="5268997341526217362">"Laiteparit"</string>
+    <string name="adb_wireless_device_connected_summary" msgid="3039660790249148713">"Yhdistetty tällä hetkellä"</string>
+    <string name="adb_wireless_device_details_title" msgid="7129369670526565786">"Laitteen tiedot"</string>
+    <string name="adb_device_forget" msgid="193072400783068417">"Unohda"</string>
+    <string name="adb_device_fingerprint_title_format" msgid="291504822917843701">"Laitteen sormenjälki: <xliff:g id="FINGERPRINT_PARAM">%1$s</xliff:g>"</string>
+    <string name="adb_wireless_connection_failed_title" msgid="664211177427438438">"Yhteys epäonnistui"</string>
+    <string name="adb_wireless_connection_failed_message" msgid="9213896700171602073">"Varmista, että <xliff:g id="DEVICE_NAME">%1$s</xliff:g> on yhdistetty oikeaan verkkoon"</string>
+    <string name="adb_pairing_device_dialog_title" msgid="7141739231018530210">"Muodosta laitepari"</string>
+    <string name="adb_pairing_device_dialog_pairing_code_label" msgid="3639239786669722731">"Wi-Fi-laiteparikoodi"</string>
+    <string name="adb_pairing_device_dialog_failed_title" msgid="3426758947882091735">"Laiteparin muodostus ei onnistunut"</string>
+    <string name="adb_pairing_device_dialog_failed_msg" msgid="6611097519661997148">"Varmista, että laite on yhdistetty samaan verkkoon."</string>
+    <string name="adb_wireless_qrcode_summary" msgid="8051414549011801917">"Muodosta laitepari Wi-Fi-yhteyden kautta skannaamalla QR-koodi"</string>
+    <string name="adb_wireless_verifying_qrcode_text" msgid="6123192424916029207">"Muodostetaan laiteparia…"</string>
+    <string name="adb_qrcode_pairing_device_failed_msg" msgid="6936292092592914132">"Laiteparin muodostus ei onnistunut. QR-koodi oli virheellinen, tai laitetta ei ole yhdistetty samaan verkkoon."</string>
+    <string name="adb_wireless_ip_addr_preference_title" msgid="8335132107715311730">"IP-osoite &amp; portti"</string>
+    <string name="adb_wireless_qrcode_pairing_title" msgid="1906409667944674707">"Skannaa QR-koodi"</string>
+    <string name="adb_wireless_qrcode_pairing_description" msgid="8578868049289910131">"Muodosta laitepari Wi-Fi-yhteyden kautta skannaamalla QR-koodi"</string>
+    <string name="keywords_adb_wireless" msgid="6507505581882171240">"adb, virheenkorjaus, kehittäminen"</string>
     <string name="bugreport_in_power" msgid="8664089072534638709">"Virheraportin pikakuvake"</string>
     <string name="bugreport_in_power_summary" msgid="1885529649381831775">"Näytä virheraporttipainike virtavalikossa."</string>
     <string name="keep_screen_on" msgid="1187161672348797558">"Pysy käynnissä"</string>
@@ -271,6 +298,8 @@
     <string name="tethering_hardware_offload_summary" msgid="7801345335142803029">"Käytä laitteistokiihdytyksen yhteyden jakamista, jos se on käytettävissä."</string>
     <string name="adb_warning_title" msgid="7708653449506485728">"Sallitaanko USB-vianetsintä?"</string>
     <string name="adb_warning_message" msgid="8145270656419669221">"USB-vianetsintä on tarkoitettu vain kehittäjien käyttöön. Sen avulla voidaan kopioida tietoja tietokoneesi ja laitteesi välillä, asentaa laitteeseesi sovelluksia ilmoittamatta siitä sinulle ja lukea lokitietoja."</string>
+    <string name="adbwifi_warning_title" msgid="727104571653031865">"Sallitaanko langaton virheenkorjaus?"</string>
+    <string name="adbwifi_warning_message" msgid="8005936574322702388">"Langaton virheenkorjaus on tarkoitettu vain kehittäjien käyttöön. Sen avulla voidaan kopioida dataa tietokoneesi ja laitteesi välillä, asentaa laitteeseesi sovelluksia ilmoittamatta siitä sinulle ja lukea lokidataa."</string>
     <string name="adb_keys_warning_message" msgid="2968555274488101220">"Haluatko peruuttaa USB-vianetsinnän käyttöoikeuden kaikilta tietokoneilta, joille olet antanut luvan aiemmin?"</string>
     <string name="dev_settings_warning_title" msgid="8251234890169074553">"Sallitaanko kehittäjäasetukset?"</string>
     <string name="dev_settings_warning_message" msgid="37741686486073668">"Nämä asetukset on tarkoitettu vain kehityskäyttöön, ja ne voivat aiheuttaa haittaa laitteellesi tai sen sovelluksille."</string>
@@ -383,8 +412,7 @@
     <string name="daltonizer_mode_protanomaly" msgid="7805583306666608440">"Protanomalia (puna-vihersokeus)"</string>
     <string name="daltonizer_mode_tritanomaly" msgid="7135266249220732267">"Tritanomalia (sini-keltasokeus)"</string>
     <string name="accessibility_display_daltonizer_preference_title" msgid="1810693571332381974">"Värikorjaus"</string>
-    <!-- no translation found for accessibility_display_daltonizer_preference_subtitle (6178138727195403796) -->
-    <skip />
+    <string name="accessibility_display_daltonizer_preference_subtitle" msgid="6178138727195403796">"Värinkorjaus auttaa värisokeita tulkitsemaan värejä"</string>
     <string name="daltonizer_type_overridden" msgid="4509604753672535721">"Tämän ohittaa <xliff:g id="TITLE">%1$s</xliff:g>"</string>
     <string name="power_remaining_settings_home_page" msgid="4885165789445462557">"<xliff:g id="PERCENTAGE">%1$s</xliff:g> – <xliff:g id="TIME_STRING">%2$s</xliff:g>"</string>
     <string name="power_remaining_duration_only" msgid="8264199158671531431">"Noin <xliff:g id="TIME_REMAINING">%1$s</xliff:g> jäljellä"</string>
@@ -403,21 +431,19 @@
     <string name="power_remaining_less_than_duration" msgid="1812668275239801236">"Alle <xliff:g id="THRESHOLD">%1$s</xliff:g> jäljellä (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_more_than_subtext" msgid="7919119719242734848">"Yli <xliff:g id="TIME_REMAINING">%1$s</xliff:g> jäljellä (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_only_more_than_subtext" msgid="3274496164769110480">"Yli <xliff:g id="TIME_REMAINING">%1$s</xliff:g> jäljellä"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="6583866940347159957">"Puhelin voi pian sammua"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="8009177999719462724">"Tabletti voi pian sammua"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="8320892540455268018">"Laite voi pian sammua"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="6186572170809116621">"Puhelin voi pian sammua (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="1338758278145563121">"Tabletti voi pian sammua (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="3699579688084774362">"Laite voi pian sammua (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="137330009791560774">"Puhelin voi sammua pian"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="145489081521468132">"Tabletti voi sammua pian"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="1070562682853942350">"Laite voi sammua pian"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="4429259621177089719">"Puhelin voi sammua pian (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="7703677921000858479">"Tabletti voi sammua pian (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="4374784375644214578">"Laite voi sammua pian (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
     <string name="power_charging" msgid="6727132649743436802">"<xliff:g id="LEVEL">%1$s</xliff:g> – <xliff:g id="STATE">%2$s</xliff:g>"</string>
     <string name="power_remaining_charging_duration_only" msgid="7415639699283965818">"<xliff:g id="TIME">%1$s</xliff:g> jäljellä täyteen lataukseen"</string>
     <string name="power_charging_duration" msgid="5005740040558984057">"<xliff:g id="LEVEL">%1$s</xliff:g> – <xliff:g id="TIME">%2$s</xliff:g> täyteen lataukseen"</string>
     <string name="battery_info_status_unknown" msgid="268625384868401114">"Tuntematon"</string>
     <string name="battery_info_status_charging" msgid="4279958015430387405">"Ladataan"</string>
-    <!-- no translation found for battery_info_status_charging_fast (8027559755902954885) -->
-    <skip />
-    <!-- no translation found for battery_info_status_charging_slow (3190803837168962319) -->
-    <skip />
+    <string name="battery_info_status_charging_fast" msgid="8027559755902954885">"Nopea lataus"</string>
+    <string name="battery_info_status_charging_slow" msgid="3190803837168962319">"Hidas lataus"</string>
     <string name="battery_info_status_discharging" msgid="6962689305413556485">"Ei laturissa"</string>
     <string name="battery_info_status_not_charging" msgid="8330015078868707899">"Kytketty virtalähteeseen, lataaminen ei onnistu"</string>
     <string name="battery_info_status_full" msgid="4443168946046847468">"Täynnä"</string>
diff --git a/packages/SettingsLib/res/values-fr-rCA/strings.xml b/packages/SettingsLib/res/values-fr-rCA/strings.xml
index 6404df4..b040be9 100644
--- a/packages/SettingsLib/res/values-fr-rCA/strings.xml
+++ b/packages/SettingsLib/res/values-fr-rCA/strings.xml
@@ -206,6 +206,33 @@
     <string name="enable_adb" msgid="8072776357237289039">"Débogage USB"</string>
     <string name="enable_adb_summary" msgid="3711526030096574316">"Mode débogage lorsqu\'un câble USB est connecté"</string>
     <string name="clear_adb_keys" msgid="3010148733140369917">"Annuler les autorisations relatives au débogage USB"</string>
+    <string name="enable_adb_wireless" msgid="6973226350963971018">"Débogage sans fil"</string>
+    <string name="enable_adb_wireless_summary" msgid="7344391423657093011">"Mode débogage lorsque le Wi-Fi est connecté"</string>
+    <string name="adb_wireless_error" msgid="721958772149779856">"Erreur"</string>
+    <string name="adb_wireless_settings" msgid="2295017847215680229">"Débogage sans fil"</string>
+    <string name="adb_wireless_list_empty_off" msgid="1713707973837255490">"Pour afficher et utiliser les appareils à proximité, activez le débogage sans fil"</string>
+    <string name="adb_pair_method_qrcode_title" msgid="6982904096137468634">"Associer l\'appareil à l\'aide d\'un code QR"</string>
+    <string name="adb_pair_method_qrcode_summary" msgid="3729901496856458634">"Associer les nouveaux appareils à l\'aide d\'un lecteur de code QR"</string>
+    <string name="adb_pair_method_code_title" msgid="1122590300445142904">"Associer l\'appareil avec un code d\'association"</string>
+    <string name="adb_pair_method_code_summary" msgid="6370414511333685185">"Associer les nouveaux appareils à l\'aide d\'un code à six chiffres"</string>
+    <string name="adb_paired_devices_title" msgid="5268997341526217362">"Appareils associés"</string>
+    <string name="adb_wireless_device_connected_summary" msgid="3039660790249148713">"Actuellement connecté"</string>
+    <string name="adb_wireless_device_details_title" msgid="7129369670526565786">"Renseignements sur l\'appareil"</string>
+    <string name="adb_device_forget" msgid="193072400783068417">"Oublier"</string>
+    <string name="adb_device_fingerprint_title_format" msgid="291504822917843701">"Empreinte digitale d\'appareil : <xliff:g id="FINGERPRINT_PARAM">%1$s</xliff:g>"</string>
+    <string name="adb_wireless_connection_failed_title" msgid="664211177427438438">"Échec de la connexion"</string>
+    <string name="adb_wireless_connection_failed_message" msgid="9213896700171602073">"Vérifiez que <xliff:g id="DEVICE_NAME">%1$s</xliff:g> est connecté au bon réseau"</string>
+    <string name="adb_pairing_device_dialog_title" msgid="7141739231018530210">"Associer avec l\'appareil"</string>
+    <string name="adb_pairing_device_dialog_pairing_code_label" msgid="3639239786669722731">"Code d\'association Wi-Fi"</string>
+    <string name="adb_pairing_device_dialog_failed_title" msgid="3426758947882091735">"Échec de l\'association"</string>
+    <string name="adb_pairing_device_dialog_failed_msg" msgid="6611097519661997148">"Vérifier que l\'appareil est connecté au même réseau."</string>
+    <string name="adb_wireless_qrcode_summary" msgid="8051414549011801917">"Associer un appareil au Wi-Fi en numérisant un code QR"</string>
+    <string name="adb_wireless_verifying_qrcode_text" msgid="6123192424916029207">"Association de l\'appareil en cours…"</string>
+    <string name="adb_qrcode_pairing_device_failed_msg" msgid="6936292092592914132">"Échec de l\'association de l\'appareil Soit le code QR est incorrect, soit l\'appareil n\'est pas connecté au même réseau."</string>
+    <string name="adb_wireless_ip_addr_preference_title" msgid="8335132107715311730">"Adresse IP et port"</string>
+    <string name="adb_wireless_qrcode_pairing_title" msgid="1906409667944674707">"Numériser le code QR"</string>
+    <string name="adb_wireless_qrcode_pairing_description" msgid="8578868049289910131">"Associer un appareil au Wi-Fi en numérisant un code QR"</string>
+    <string name="keywords_adb_wireless" msgid="6507505581882171240">"adb, débogage, appareil"</string>
     <string name="bugreport_in_power" msgid="8664089072534638709">"Raccourci de rapport de bogue"</string>
     <string name="bugreport_in_power_summary" msgid="1885529649381831775">"Afficher un bouton permettant d\'établir un rapport de bogue dans le menu de démarrage"</string>
     <string name="keep_screen_on" msgid="1187161672348797558">"Rester activé"</string>
@@ -271,6 +298,8 @@
     <string name="tethering_hardware_offload_summary" msgid="7801345335142803029">"Utiliser l\'accélération matérielle du partage de connexion si possible"</string>
     <string name="adb_warning_title" msgid="7708653449506485728">"Autoriser le débogage USB?"</string>
     <string name="adb_warning_message" msgid="8145270656419669221">"Le débogage USB est conçu uniquement pour le développement. Utilisez-le pour copier des données entre votre ordinateur et votre appareil, installer des applications sur votre appareil sans notification et lire les données de journal."</string>
+    <string name="adbwifi_warning_title" msgid="727104571653031865">"Autoriser le débogage sans fil?"</string>
+    <string name="adbwifi_warning_message" msgid="8005936574322702388">"Le débogage sans fil est conçu uniquement aux fin de conception. Utilisez-le pour copier des données entre votre ordinateur et votre appareil, installer des applications sur votre appareil sans notification et lire les données de journal."</string>
     <string name="adb_keys_warning_message" msgid="2968555274488101220">"Voulez-vous vraiment désactiver l\'accès au débogage USB de tous les ordinateurs précédemment autorisés?"</string>
     <string name="dev_settings_warning_title" msgid="8251234890169074553">"Activer les paramètres de développement?"</string>
     <string name="dev_settings_warning_message" msgid="37741686486073668">"Ces paramètres sont en cours de développement. Ils peuvent endommager votre appareil et les applications qui s\'y trouvent, ou provoquer leur dysfonctionnement."</string>
@@ -383,8 +412,7 @@
     <string name="daltonizer_mode_protanomaly" msgid="7805583306666608440">"Protanomalie (rouge/vert)"</string>
     <string name="daltonizer_mode_tritanomaly" msgid="7135266249220732267">"Tritanomalie (bleu/jaune)"</string>
     <string name="accessibility_display_daltonizer_preference_title" msgid="1810693571332381974">"Correction des couleurs"</string>
-    <!-- no translation found for accessibility_display_daltonizer_preference_subtitle (6178138727195403796) -->
-    <skip />
+    <string name="accessibility_display_daltonizer_preference_subtitle" msgid="6178138727195403796">"La correction des couleurs aide les personnes atteintes de daltonisme à mieux percevoir les couleurs"</string>
     <string name="daltonizer_type_overridden" msgid="4509604753672535721">"Remplacé par <xliff:g id="TITLE">%1$s</xliff:g>"</string>
     <string name="power_remaining_settings_home_page" msgid="4885165789445462557">"<xliff:g id="PERCENTAGE">%1$s</xliff:g> : <xliff:g id="TIME_STRING">%2$s</xliff:g>"</string>
     <string name="power_remaining_duration_only" msgid="8264199158671531431">"Il reste environ <xliff:g id="TIME_REMAINING">%1$s</xliff:g>"</string>
@@ -403,21 +431,19 @@
     <string name="power_remaining_less_than_duration" msgid="1812668275239801236">"Il reste moins de <xliff:g id="THRESHOLD">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_more_than_subtext" msgid="7919119719242734848">"Il reste plus de <xliff:g id="TIME_REMAINING">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_only_more_than_subtext" msgid="3274496164769110480">"Il reste plus de <xliff:g id="TIME_REMAINING">%1$s</xliff:g>"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="6583866940347159957">"Il se peut que le téléphone s\'éteigne bientôt"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="8009177999719462724">"Il se peut que la tablette s\'éteigne bientôt"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="8320892540455268018">"Il se peut que l\'appareil s\'éteigne bientôt"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="6186572170809116621">"Il se peut que le téléphone s\'éteigne bientôt (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="1338758278145563121">"Il se peut que la tablette s\'éteigne bientôt (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="3699579688084774362">"Il se peut que l\'appareil s\'éteigne bientôt (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="137330009791560774">"Il se peut que le téléphone s\'éteigne bientôt"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="145489081521468132">"Il se peut que la tablette s\'éteigne bientôt"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="1070562682853942350">"Il se peut que l\'appareil s\'éteigne bientôt"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="4429259621177089719">"Il se peut que le téléphone s\'éteigne bientôt (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="7703677921000858479">"Il se peut que la tablette s\'éteigne bientôt (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="4374784375644214578">"Il se peut que l\'appareil s\'éteigne bientôt (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
     <string name="power_charging" msgid="6727132649743436802">"<xliff:g id="LEVEL">%1$s</xliff:g> - <xliff:g id="STATE">%2$s</xliff:g>"</string>
     <string name="power_remaining_charging_duration_only" msgid="7415639699283965818">"<xliff:g id="TIME">%1$s</xliff:g> jusqu\'à la charge complète"</string>
     <string name="power_charging_duration" msgid="5005740040558984057">"<xliff:g id="LEVEL">%1$s</xliff:g> : <xliff:g id="TIME">%2$s</xliff:g> jusqu\'à la charge complète"</string>
     <string name="battery_info_status_unknown" msgid="268625384868401114">"Inconnu"</string>
     <string name="battery_info_status_charging" msgid="4279958015430387405">"Charge en cours…"</string>
-    <!-- no translation found for battery_info_status_charging_fast (8027559755902954885) -->
-    <skip />
-    <!-- no translation found for battery_info_status_charging_slow (3190803837168962319) -->
-    <skip />
+    <string name="battery_info_status_charging_fast" msgid="8027559755902954885">"Recharge rapide"</string>
+    <string name="battery_info_status_charging_slow" msgid="3190803837168962319">"Charge lente"</string>
     <string name="battery_info_status_discharging" msgid="6962689305413556485">"N\'est pas en charge"</string>
     <string name="battery_info_status_not_charging" msgid="8330015078868707899">"L\'appareil est branché, mais il ne peut pas être chargé pour le moment"</string>
     <string name="battery_info_status_full" msgid="4443168946046847468">"Pleine"</string>
diff --git a/packages/SettingsLib/res/values-fr/strings.xml b/packages/SettingsLib/res/values-fr/strings.xml
index e75063b..fb70c88 100644
--- a/packages/SettingsLib/res/values-fr/strings.xml
+++ b/packages/SettingsLib/res/values-fr/strings.xml
@@ -206,6 +206,33 @@
     <string name="enable_adb" msgid="8072776357237289039">"Débogage USB"</string>
     <string name="enable_adb_summary" msgid="3711526030096574316">"Mode débogage lorsqu\'un câble USB est connecté"</string>
     <string name="clear_adb_keys" msgid="3010148733140369917">"Annuler autorisations pour débog. USB"</string>
+    <string name="enable_adb_wireless" msgid="6973226350963971018">"Débogage via Wi-Fi"</string>
+    <string name="enable_adb_wireless_summary" msgid="7344391423657093011">"Mode de débogage en connexion Wi-Fi"</string>
+    <string name="adb_wireless_error" msgid="721958772149779856">"Erreur"</string>
+    <string name="adb_wireless_settings" msgid="2295017847215680229">"Débogage via Wi-Fi"</string>
+    <string name="adb_wireless_list_empty_off" msgid="1713707973837255490">"Pour afficher et utiliser les appareils disponibles, activez le débogage sans fil"</string>
+    <string name="adb_pair_method_qrcode_title" msgid="6982904096137468634">"Associer l\'appareil avec un code QR"</string>
+    <string name="adb_pair_method_qrcode_summary" msgid="3729901496856458634">"Associer les nouveaux appareils à l\'aide d\'un lecteur de code QR"</string>
+    <string name="adb_pair_method_code_title" msgid="1122590300445142904">"Associer l\'appareil avec un code d\'association"</string>
+    <string name="adb_pair_method_code_summary" msgid="6370414511333685185">"Associer les nouveaux appareils à l\'aide d\'un code à six chiffres"</string>
+    <string name="adb_paired_devices_title" msgid="5268997341526217362">"Appareils associés"</string>
+    <string name="adb_wireless_device_connected_summary" msgid="3039660790249148713">"Actuellement connecté"</string>
+    <string name="adb_wireless_device_details_title" msgid="7129369670526565786">"Infos sur l\'appareil"</string>
+    <string name="adb_device_forget" msgid="193072400783068417">"Retirer"</string>
+    <string name="adb_device_fingerprint_title_format" msgid="291504822917843701">"Empreinte de l\'appareil : <xliff:g id="FINGERPRINT_PARAM">%1$s</xliff:g>"</string>
+    <string name="adb_wireless_connection_failed_title" msgid="664211177427438438">"Échec de la connexion"</string>
+    <string name="adb_wireless_connection_failed_message" msgid="9213896700171602073">"Vérifiez que l\'appareil <xliff:g id="DEVICE_NAME">%1$s</xliff:g> est connecté au bon réseau"</string>
+    <string name="adb_pairing_device_dialog_title" msgid="7141739231018530210">"Associer à l\'appareil"</string>
+    <string name="adb_pairing_device_dialog_pairing_code_label" msgid="3639239786669722731">"Code d\'association via le Wi-Fi"</string>
+    <string name="adb_pairing_device_dialog_failed_title" msgid="3426758947882091735">"Échec de l\'association"</string>
+    <string name="adb_pairing_device_dialog_failed_msg" msgid="6611097519661997148">"Assurez-vous que l\'appareil est connecté au même réseau."</string>
+    <string name="adb_wireless_qrcode_summary" msgid="8051414549011801917">"Associer l\'appareil via le Wi‑Fi à l\'aide d\'un code QR"</string>
+    <string name="adb_wireless_verifying_qrcode_text" msgid="6123192424916029207">"Association de l\'appareil…"</string>
+    <string name="adb_qrcode_pairing_device_failed_msg" msgid="6936292092592914132">"Échec de l\'association à l\'appareil. Le code QR est incorrect, ou l\'appareil n\'est pas connecté au même réseau."</string>
+    <string name="adb_wireless_ip_addr_preference_title" msgid="8335132107715311730">"Adresse IP et port"</string>
+    <string name="adb_wireless_qrcode_pairing_title" msgid="1906409667944674707">"Scanner un code QR"</string>
+    <string name="adb_wireless_qrcode_pairing_description" msgid="8578868049289910131">"Associer l\'appareil via le Wi‑Fi à l\'aide d\'un code QR"</string>
+    <string name="keywords_adb_wireless" msgid="6507505581882171240">"adb, débogage, dev"</string>
     <string name="bugreport_in_power" msgid="8664089072534638709">"Raccourci vers rapport de bug"</string>
     <string name="bugreport_in_power_summary" msgid="1885529649381831775">"Afficher un bouton dans le menu de démarrage permettant de créer un rapport de bug"</string>
     <string name="keep_screen_on" msgid="1187161672348797558">"Écran toujours actif"</string>
@@ -271,6 +298,8 @@
     <string name="tethering_hardware_offload_summary" msgid="7801345335142803029">"Utiliser l\'accélération matérielle pour le partage de connexion, si disponible"</string>
     <string name="adb_warning_title" msgid="7708653449506485728">"Autoriser le débogage USB ?"</string>
     <string name="adb_warning_message" msgid="8145270656419669221">"Le débogage USB est conçu uniquement pour le développement. Utilisez-le pour copier des données entre votre ordinateur et votre appareil, installer des applications sur votre appareil sans notification et lire les données de journal."</string>
+    <string name="adbwifi_warning_title" msgid="727104571653031865">"Autoriser le débogage via Wi-Fi ?"</string>
+    <string name="adbwifi_warning_message" msgid="8005936574322702388">"Le débogage via Wi-Fi est conçu uniquement pour le développement. Utilisez-le pour copier des données entre votre ordinateur et votre appareil, installer des applications sur votre appareil sans notification et lire les données des journaux."</string>
     <string name="adb_keys_warning_message" msgid="2968555274488101220">"Voulez-vous vraiment désactiver l\'accès au débogage USB de tous les ordinateurs précédemment autorisés ?"</string>
     <string name="dev_settings_warning_title" msgid="8251234890169074553">"Activer les paramètres de développement ?"</string>
     <string name="dev_settings_warning_message" msgid="37741686486073668">"Ces paramètres sont en cours de développement. Ils peuvent endommager votre appareil et les applications qui s\'y trouvent, ou provoquer leur dysfonctionnement."</string>
@@ -383,8 +412,7 @@
     <string name="daltonizer_mode_protanomaly" msgid="7805583306666608440">"Protanomalie (rouge/vert)"</string>
     <string name="daltonizer_mode_tritanomaly" msgid="7135266249220732267">"Tritanomalie (bleu-jaune)"</string>
     <string name="accessibility_display_daltonizer_preference_title" msgid="1810693571332381974">"Correction couleur"</string>
-    <!-- no translation found for accessibility_display_daltonizer_preference_subtitle (6178138727195403796) -->
-    <skip />
+    <string name="accessibility_display_daltonizer_preference_subtitle" msgid="6178138727195403796">"La correction des couleurs aide les personnes atteintes de daltonisme à mieux percevoir les couleurs"</string>
     <string name="daltonizer_type_overridden" msgid="4509604753672535721">"Remplacé par <xliff:g id="TITLE">%1$s</xliff:g>"</string>
     <string name="power_remaining_settings_home_page" msgid="4885165789445462557">"<xliff:g id="PERCENTAGE">%1$s</xliff:g> – <xliff:g id="TIME_STRING">%2$s</xliff:g>"</string>
     <string name="power_remaining_duration_only" msgid="8264199158671531431">"Temps restant : environ <xliff:g id="TIME_REMAINING">%1$s</xliff:g>"</string>
@@ -403,21 +431,19 @@
     <string name="power_remaining_less_than_duration" msgid="1812668275239801236">"Il reste moins de <xliff:g id="THRESHOLD">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_more_than_subtext" msgid="7919119719242734848">"Il reste plus de <xliff:g id="TIME_REMAINING">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_only_more_than_subtext" msgid="3274496164769110480">"Il reste plus de <xliff:g id="TIME_REMAINING">%1$s</xliff:g>"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="6583866940347159957">"Il est possible que le téléphone s\'éteigne bientôt"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="8009177999719462724">"Il est possible que la tablette s\'éteigne bientôt"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="8320892540455268018">"Il est possible que l\'appareil s\'éteigne bientôt"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="6186572170809116621">"Il est possible que le téléphone s\'éteigne bientôt (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="1338758278145563121">"Il est possible que la tablette s\'éteigne bientôt (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="3699579688084774362">"Il est possible que l\'appareil s\'éteigne bientôt (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="137330009791560774">"Le téléphone va bientôt s\'éteindre"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="145489081521468132">"La tablette va bientôt s\'éteindre"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="1070562682853942350">"L\'appareil va bientôt s\'éteindre"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="4429259621177089719">"Le téléphone va bientôt s\'éteindre (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="7703677921000858479">"La tablette va bientôt s\'éteindre (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="4374784375644214578">"L\'appareil va bientôt s\'éteindre (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
     <string name="power_charging" msgid="6727132649743436802">"<xliff:g id="LEVEL">%1$s</xliff:g> – <xliff:g id="STATE">%2$s</xliff:g>"</string>
     <string name="power_remaining_charging_duration_only" msgid="7415639699283965818">"<xliff:g id="TIME">%1$s</xliff:g> jusqu\'à ce que la batterie soit chargée"</string>
     <string name="power_charging_duration" msgid="5005740040558984057">"<xliff:g id="LEVEL">%1$s</xliff:g> - <xliff:g id="TIME">%2$s</xliff:g> jusqu\'à la charge complète"</string>
     <string name="battery_info_status_unknown" msgid="268625384868401114">"Inconnu"</string>
     <string name="battery_info_status_charging" msgid="4279958015430387405">"Batterie en charge"</string>
-    <!-- no translation found for battery_info_status_charging_fast (8027559755902954885) -->
-    <skip />
-    <!-- no translation found for battery_info_status_charging_slow (3190803837168962319) -->
-    <skip />
+    <string name="battery_info_status_charging_fast" msgid="8027559755902954885">"Charge rapide"</string>
+    <string name="battery_info_status_charging_slow" msgid="3190803837168962319">"Charge lente"</string>
     <string name="battery_info_status_discharging" msgid="6962689305413556485">"Pas en charge"</string>
     <string name="battery_info_status_not_charging" msgid="8330015078868707899">"Appareil branché, mais impossible de le charger pour le moment"</string>
     <string name="battery_info_status_full" msgid="4443168946046847468">"Pleine"</string>
diff --git a/packages/SettingsLib/res/values-gl/strings.xml b/packages/SettingsLib/res/values-gl/strings.xml
index 7fd32f9..1407a50 100644
--- a/packages/SettingsLib/res/values-gl/strings.xml
+++ b/packages/SettingsLib/res/values-gl/strings.xml
@@ -206,6 +206,33 @@
     <string name="enable_adb" msgid="8072776357237289039">"Depuración por USB"</string>
     <string name="enable_adb_summary" msgid="3711526030096574316">"Modo de depuración de erros cando o USB está conectado"</string>
     <string name="clear_adb_keys" msgid="3010148733140369917">"Revogar as autorizacións de depuración por USB"</string>
+    <string name="enable_adb_wireless" msgid="6973226350963971018">"Depuración de erros sen fíos"</string>
+    <string name="enable_adb_wireless_summary" msgid="7344391423657093011">"Modo de depuración de erros ao conectarse a wifi"</string>
+    <string name="adb_wireless_error" msgid="721958772149779856">"Produciuse un erro"</string>
+    <string name="adb_wireless_settings" msgid="2295017847215680229">"Depuración de erros sen fíos"</string>
+    <string name="adb_wireless_list_empty_off" msgid="1713707973837255490">"Para ver e usar os dispositivos dispoñibles, activa a depuración de erros sen fíos"</string>
+    <string name="adb_pair_method_qrcode_title" msgid="6982904096137468634">"Vincular o dispositivo cun código QR"</string>
+    <string name="adb_pair_method_qrcode_summary" msgid="3729901496856458634">"Vincula dispositivos novos mediante un escáner de códigos QR"</string>
+    <string name="adb_pair_method_code_title" msgid="1122590300445142904">"Vincular o dispositivo co código de sincronización"</string>
+    <string name="adb_pair_method_code_summary" msgid="6370414511333685185">"Vincula dispositivos novos mediante un código de seis díxitos"</string>
+    <string name="adb_paired_devices_title" msgid="5268997341526217362">"Dispositivos vinculados"</string>
+    <string name="adb_wireless_device_connected_summary" msgid="3039660790249148713">"Dispositivos conectados actualmente"</string>
+    <string name="adb_wireless_device_details_title" msgid="7129369670526565786">"Datos do dispositivo"</string>
+    <string name="adb_device_forget" msgid="193072400783068417">"Esquecer"</string>
+    <string name="adb_device_fingerprint_title_format" msgid="291504822917843701">"Impresión dixital do dispositivo: <xliff:g id="FINGERPRINT_PARAM">%1$s</xliff:g>"</string>
+    <string name="adb_wireless_connection_failed_title" msgid="664211177427438438">"Produciuse un erro na conexión"</string>
+    <string name="adb_wireless_connection_failed_message" msgid="9213896700171602073">"Asegúrate de que o dispositivo <xliff:g id="DEVICE_NAME">%1$s</xliff:g> estea conectado á rede correcta"</string>
+    <string name="adb_pairing_device_dialog_title" msgid="7141739231018530210">"Sincronizar co dispositivo"</string>
+    <string name="adb_pairing_device_dialog_pairing_code_label" msgid="3639239786669722731">"Código de sincronización da wifi"</string>
+    <string name="adb_pairing_device_dialog_failed_title" msgid="3426758947882091735">"Produciuse un fallo na sincronización"</string>
+    <string name="adb_pairing_device_dialog_failed_msg" msgid="6611097519661997148">"Asegúrate de que o dispositivo estea conectado á mesma rede"</string>
+    <string name="adb_wireless_qrcode_summary" msgid="8051414549011801917">"Vincula o dispositivo a través da wifi escaneando un código QR"</string>
+    <string name="adb_wireless_verifying_qrcode_text" msgid="6123192424916029207">"Sincronizando dispositivo…"</string>
+    <string name="adb_qrcode_pairing_device_failed_msg" msgid="6936292092592914132">"Produciuse un erro ao sincronizar o dispositivo. O código QR era incorrecto ou o dispositivo non está conectado á mesma rede."</string>
+    <string name="adb_wireless_ip_addr_preference_title" msgid="8335132107715311730">"Enderezo IP e porto"</string>
+    <string name="adb_wireless_qrcode_pairing_title" msgid="1906409667944674707">"Escanear o código QR"</string>
+    <string name="adb_wireless_qrcode_pairing_description" msgid="8578868049289910131">"Vincula o dispositivo a través da wifi escaneando un código QR"</string>
+    <string name="keywords_adb_wireless" msgid="6507505581882171240">"adb, depuración, programador"</string>
     <string name="bugreport_in_power" msgid="8664089072534638709">"Atallo do informe de erros"</string>
     <string name="bugreport_in_power_summary" msgid="1885529649381831775">"Mostra un botón no menú de acendido para crear un informe de erros"</string>
     <string name="keep_screen_on" msgid="1187161672348797558">"Pantalla activa"</string>
@@ -271,6 +298,8 @@
     <string name="tethering_hardware_offload_summary" msgid="7801345335142803029">"Se está dispoñible, úsase a aceleración de hardware para conexión compartida"</string>
     <string name="adb_warning_title" msgid="7708653449506485728">"Queres permitir a depuración por USB?"</string>
     <string name="adb_warning_message" msgid="8145270656419669221">"A depuración de erros USB está deseñada unicamente para fins de programación. Utilízaa para copiar datos entre o ordenador e o dispositivo, instalar aplicacións no dispositivo sen enviar notificacións e ler os datos do rexistro."</string>
+    <string name="adbwifi_warning_title" msgid="727104571653031865">"Queres permitir a depuración de erros sen fíos?"</string>
+    <string name="adbwifi_warning_message" msgid="8005936574322702388">"A depuración de erros sen fíos está deseñada unicamente para fins de programación. Utilízaa para copiar datos entre o ordenador e o dispositivo, instalar aplicacións no dispositivo sen recibir notificacións e ler os datos do rexistro."</string>
     <string name="adb_keys_warning_message" msgid="2968555274488101220">"Queres revogar o acceso á depuración por USB desde todos os ordenadores que autorizaches previamente?"</string>
     <string name="dev_settings_warning_title" msgid="8251234890169074553">"Permitir a configuración de programación?"</string>
     <string name="dev_settings_warning_message" msgid="37741686486073668">"Esta configuración só está destinada á programación. Esta pode provocar que o dispositivo e as aplicacións fallen ou se comporten incorrectamente."</string>
@@ -383,8 +412,7 @@
     <string name="daltonizer_mode_protanomaly" msgid="7805583306666608440">"Protanomalía (vermello-verde)"</string>
     <string name="daltonizer_mode_tritanomaly" msgid="7135266249220732267">"Tritanomalía (azul-amarelo)"</string>
     <string name="accessibility_display_daltonizer_preference_title" msgid="1810693571332381974">"Corrección da cor"</string>
-    <!-- no translation found for accessibility_display_daltonizer_preference_subtitle (6178138727195403796) -->
-    <skip />
+    <string name="accessibility_display_daltonizer_preference_subtitle" msgid="6178138727195403796">"A corrección da cor axuda ás persoas con daltonismo a ver as cores con maior precisión"</string>
     <string name="daltonizer_type_overridden" msgid="4509604753672535721">"Anulado por <xliff:g id="TITLE">%1$s</xliff:g>"</string>
     <string name="power_remaining_settings_home_page" msgid="4885165789445462557">"<xliff:g id="PERCENTAGE">%1$s</xliff:g> - <xliff:g id="TIME_STRING">%2$s</xliff:g>"</string>
     <string name="power_remaining_duration_only" msgid="8264199158671531431">"Tempo restante aproximado: <xliff:g id="TIME_REMAINING">%1$s</xliff:g>"</string>
@@ -403,21 +431,19 @@
     <string name="power_remaining_less_than_duration" msgid="1812668275239801236">"Tempo restante: menos de <xliff:g id="THRESHOLD">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_more_than_subtext" msgid="7919119719242734848">"Tempo restante: máis de <xliff:g id="TIME_REMAINING">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_only_more_than_subtext" msgid="3274496164769110480">"Tempo restante: máis de <xliff:g id="TIME_REMAINING">%1$s</xliff:g>"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="6583866940347159957">"É posible que o teléfono se apague en breve"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="8009177999719462724">"É posible que a tableta se apague en breve"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="8320892540455268018">"É posible que o dispositivo se apague en breve"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="6186572170809116621">"É posible que o teléfono se apague en breve (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="1338758278145563121">"É posible que a tableta se apague en breve (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="3699579688084774362">"É posible que o dispositivo se apague en breve (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="137330009791560774">"O teléfono pode apagarse en breve"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="145489081521468132">"A tableta pode apagarse en breve"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="1070562682853942350">"O dispositivo pode apagarse en breve"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="4429259621177089719">"O teléfono pode apagarse en breve (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="7703677921000858479">"A tableta pode apagarse en breve (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="4374784375644214578">"O dispositivo pode apagarse en breve (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
     <string name="power_charging" msgid="6727132649743436802">"<xliff:g id="LEVEL">%1$s</xliff:g> - <xliff:g id="STATE">%2$s</xliff:g>"</string>
     <string name="power_remaining_charging_duration_only" msgid="7415639699283965818">"<xliff:g id="TIME">%1$s</xliff:g> para completar a carga"</string>
     <string name="power_charging_duration" msgid="5005740040558984057">"<xliff:g id="LEVEL">%1$s</xliff:g>: <xliff:g id="TIME">%2$s</xliff:g> para completar a carga"</string>
     <string name="battery_info_status_unknown" msgid="268625384868401114">"Descoñecido"</string>
     <string name="battery_info_status_charging" msgid="4279958015430387405">"Cargando"</string>
-    <!-- no translation found for battery_info_status_charging_fast (8027559755902954885) -->
-    <skip />
-    <!-- no translation found for battery_info_status_charging_slow (3190803837168962319) -->
-    <skip />
+    <string name="battery_info_status_charging_fast" msgid="8027559755902954885">"Cargando rapidamente"</string>
+    <string name="battery_info_status_charging_slow" msgid="3190803837168962319">"Cargando lentamente"</string>
     <string name="battery_info_status_discharging" msgid="6962689305413556485">"Non se está cargando"</string>
     <string name="battery_info_status_not_charging" msgid="8330015078868707899">"Conectouse, pero non se pode cargar neste momento"</string>
     <string name="battery_info_status_full" msgid="4443168946046847468">"Completa"</string>
diff --git a/packages/SettingsLib/res/values-gu/strings.xml b/packages/SettingsLib/res/values-gu/strings.xml
index 1513c57..889857a 100644
--- a/packages/SettingsLib/res/values-gu/strings.xml
+++ b/packages/SettingsLib/res/values-gu/strings.xml
@@ -206,6 +206,33 @@
     <string name="enable_adb" msgid="8072776357237289039">"USB ડીબગિંગ"</string>
     <string name="enable_adb_summary" msgid="3711526030096574316">"જ્યારે USB કનેક્ટ કરેલ હોય ત્યારે ડીબગ મોડ"</string>
     <string name="clear_adb_keys" msgid="3010148733140369917">"USB ડીબગિંગ પ્રમાણીકરણોને રદબાતલ કરો"</string>
+    <string name="enable_adb_wireless" msgid="6973226350963971018">"વાયરલેસ ડિબગીંગ"</string>
+    <string name="enable_adb_wireless_summary" msgid="7344391423657093011">"વાઇ-ફાઇ કનેક્ટ કરેલું હોય ત્યારે ડિબગ મોડ"</string>
+    <string name="adb_wireless_error" msgid="721958772149779856">"ભૂલ"</string>
+    <string name="adb_wireless_settings" msgid="2295017847215680229">"વાયરલેસ ડિબગીંગ"</string>
+    <string name="adb_wireless_list_empty_off" msgid="1713707973837255490">"ઉપલબ્ધ ડિવાઇસને જોવા અને તેનો ઉપયોગ કરવા માટે, વાયરલેસ ડિબગીંગ ચાલુ કરો"</string>
+    <string name="adb_pair_method_qrcode_title" msgid="6982904096137468634">"QR કોડ વડે ડિવાઇસનું જોડાણ બનાવો"</string>
+    <string name="adb_pair_method_qrcode_summary" msgid="3729901496856458634">"QR કોડ સ્કૅનરનો ઉપયોગ કરીને નવા ડિવાઇસનું જોડાણ બનાવો"</string>
+    <string name="adb_pair_method_code_title" msgid="1122590300445142904">"જોડાણ કરવાના કોડ વડે ડિવાઇસનું જોડાણ બનાવો"</string>
+    <string name="adb_pair_method_code_summary" msgid="6370414511333685185">"છ અંકના કોડનો ઉપયોગ કરીને નવા ડિવાઇસનું જોડાણ બનાવો"</string>
+    <string name="adb_paired_devices_title" msgid="5268997341526217362">"જોડાણ કરેલા ડિવાઇસ"</string>
+    <string name="adb_wireless_device_connected_summary" msgid="3039660790249148713">"હાલમાં કનેક્ટ કરેલા"</string>
+    <string name="adb_wireless_device_details_title" msgid="7129369670526565786">"ડિવાઇસની વિગતો"</string>
+    <string name="adb_device_forget" msgid="193072400783068417">"ભૂલી જાઓ"</string>
+    <string name="adb_device_fingerprint_title_format" msgid="291504822917843701">"ડિવાઇસ ફિંગરપ્રિન્ટ: <xliff:g id="FINGERPRINT_PARAM">%1$s</xliff:g>"</string>
+    <string name="adb_wireless_connection_failed_title" msgid="664211177427438438">"કનેક્શન અસફળ"</string>
+    <string name="adb_wireless_connection_failed_message" msgid="9213896700171602073">"ખાતરી કરો કે <xliff:g id="DEVICE_NAME">%1$s</xliff:g> યોગ્ય નેટવર્ક સાથે કનેક્ટ થયેલું છે"</string>
+    <string name="adb_pairing_device_dialog_title" msgid="7141739231018530210">"ડિવાઇસ સાથે જોડાણ કરો"</string>
+    <string name="adb_pairing_device_dialog_pairing_code_label" msgid="3639239786669722731">"વાઇ-ફાઇ જોડાણ કરવાનો કોડ"</string>
+    <string name="adb_pairing_device_dialog_failed_title" msgid="3426758947882091735">"જોડાણ બનાવવું અસફળ રહ્યું"</string>
+    <string name="adb_pairing_device_dialog_failed_msg" msgid="6611097519661997148">"ખાતરી કરો કે ડિવાઇસ સમાન નેટવર્કથી કનેક્ટ કરેલું છે."</string>
+    <string name="adb_wireless_qrcode_summary" msgid="8051414549011801917">"QR કોડને સ્કૅન કરીને વાઇ-ફાઇ પર ડિવાઇસનું જોડાણ બનાવો"</string>
+    <string name="adb_wireless_verifying_qrcode_text" msgid="6123192424916029207">"ડિવાઇસનું જોડાણ બનાવી રહ્યાં છીએ…"</string>
+    <string name="adb_qrcode_pairing_device_failed_msg" msgid="6936292092592914132">"ડિવાઇસનું જોડાણ કરવામાં નિષ્ફળ રહ્યાં. કાં તો QR કોડ ખોટો હતો અથવા ડિવાઇસ સમાન નેટવર્ક સાથે કનેક્ટ કરેલું નથી."</string>
+    <string name="adb_wireless_ip_addr_preference_title" msgid="8335132107715311730">"IP ઍડ્રેસ &amp; પોર્ટ"</string>
+    <string name="adb_wireless_qrcode_pairing_title" msgid="1906409667944674707">"QR કોડ સ્કૅન કરો"</string>
+    <string name="adb_wireless_qrcode_pairing_description" msgid="8578868049289910131">"QR કોડને સ્કૅન કરીને વાઇ-ફાઇ પર ડિવાઇસનું જોડાણ બનાવો"</string>
+    <string name="keywords_adb_wireless" msgid="6507505581882171240">"adb, ડિબગ, ડેવ"</string>
     <string name="bugreport_in_power" msgid="8664089072534638709">"બગ રિપોર્ટ શોર્ટકટ"</string>
     <string name="bugreport_in_power_summary" msgid="1885529649381831775">"બગ રિપોર્ટ લેવા માટે પાવર મેનૂમાં એક બટન બતાવો"</string>
     <string name="keep_screen_on" msgid="1187161672348797558">"સક્રિય રાખો"</string>
@@ -271,6 +298,8 @@
     <string name="tethering_hardware_offload_summary" msgid="7801345335142803029">"જો ટિથરિંગ માટે હાર્ડવેર ગતિવૃદ્ધિ ઉપલબ્ધ હોય તો તેનો ઉપયોગ કરો"</string>
     <string name="adb_warning_title" msgid="7708653449506485728">"USB ડિબગિંગને મંજૂરી આપીએ?"</string>
     <string name="adb_warning_message" msgid="8145270656419669221">"USB ડિબગીંગ ફક્ત વિકાસ હેતુઓ માટે જ બનાવાયેલ છે. તેનો ઉપયોગ તમારા કમ્પ્યુટર અને તમારા ઉપકરણ વચ્ચે ડેટાને કૉપિ કરવા, નોટિફિકેશન વગર તમારા ઉપકરણ પર ઍપ્લિકેશનો ઇન્સ્ટોલ કરવા અને લૉગ ડેટા વાંચવા માટે કરો."</string>
+    <string name="adbwifi_warning_title" msgid="727104571653031865">"વાયરલેસ ડિબગીંગને મંજૂરી આપીએ?"</string>
+    <string name="adbwifi_warning_message" msgid="8005936574322702388">"વાયરલેસ ડિબગીંગ ફક્ત ડેવલપમેન્ટના હેતુઓ માટે જ બનાવાયું છે. તેનો ઉપયોગ તમારા કમ્પ્યુટર અને તમારા ડિવાઇસ વચ્ચે ડેટાને કૉપિ કરવા, નોટિફિકેશન વગર તમારા ડિવાઇસ પર ઍપને ઇન્સ્ટૉલ કરવા અને લૉગ ડેટા વાંચવા માટે કરો."</string>
     <string name="adb_keys_warning_message" msgid="2968555274488101220">"તમે અગાઉ અધિકૃત કરેલા તમામ કમ્પ્યુટર્સમાંથી USB ડિબગિંગ પરની અ‍ૅક્સેસ રદબાતલ કરીએ?"</string>
     <string name="dev_settings_warning_title" msgid="8251234890169074553">"વિકાસ સેટિંગ્સને મંજૂરી આપીએ?"</string>
     <string name="dev_settings_warning_message" msgid="37741686486073668">"આ સેટિંગ્સ ફક્ત વિકાસનાં ઉપયોગ માટે જ હેતુબદ્ધ છે. તે તમારા ઉપકરણ અને તેના પરની એપ્લિકેશન્સનાં ભંગ થવા અથવા ખરાબ વર્તનનું કારણ બની શકે છે."</string>
@@ -383,8 +412,7 @@
     <string name="daltonizer_mode_protanomaly" msgid="7805583306666608440">"પ્રોટેનોમલી (લાલ-લીલો)"</string>
     <string name="daltonizer_mode_tritanomaly" msgid="7135266249220732267">"ટ્રાઇટેનોમલી(વાદળી-પીળો)"</string>
     <string name="accessibility_display_daltonizer_preference_title" msgid="1810693571332381974">"રંગ સુધારણા"</string>
-    <!-- no translation found for accessibility_display_daltonizer_preference_subtitle (6178138727195403796) -->
-    <skip />
+    <string name="accessibility_display_daltonizer_preference_subtitle" msgid="6178138727195403796">"રંગ સુધારણા રંગ અંધત્વવાળા લોકોને વધુ સચોટ રંગો જોવામાં સહાય કરે છે"</string>
     <string name="daltonizer_type_overridden" msgid="4509604753672535721">"<xliff:g id="TITLE">%1$s</xliff:g> દ્વારા ઓવરરાઇડ થયું"</string>
     <string name="power_remaining_settings_home_page" msgid="4885165789445462557">"<xliff:g id="PERCENTAGE">%1$s</xliff:g> - <xliff:g id="TIME_STRING">%2$s</xliff:g>"</string>
     <string name="power_remaining_duration_only" msgid="8264199158671531431">"લગભગ <xliff:g id="TIME_REMAINING">%1$s</xliff:g> બાકી છે"</string>
@@ -403,21 +431,19 @@
     <string name="power_remaining_less_than_duration" msgid="1812668275239801236">"<xliff:g id="THRESHOLD">%1$s</xliff:g> કરતાં ઓછો સમય બાકી છે (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_more_than_subtext" msgid="7919119719242734848">"<xliff:g id="TIME_REMAINING">%1$s</xliff:g> કરતાં વધુ સમય બાકી છે (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_only_more_than_subtext" msgid="3274496164769110480">"<xliff:g id="TIME_REMAINING">%1$s</xliff:g> કરતાં વધુ સમય બાકી છે"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="6583866940347159957">"ફોન થોડીક જ વારમાં બંધ થઈ શકે છે"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="8009177999719462724">"ટૅબ્લેટ થોડીક જ વારમાં બંધ થઈ શકે છે"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="8320892540455268018">"ઉપકરણ થોડીક જ વારમાં બંધ થઈ શકે છે"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="6186572170809116621">"ફોન થોડીક જ વારમાં બંધ થઈ શકે છે (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="1338758278145563121">"ટૅબ્લેટ થોડીક જ વારમાં બંધ થઈ શકે છે (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="3699579688084774362">"ઉપકરણ થોડીક જ વારમાં બંધ થઈ શકે છે (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="137330009791560774">"ફોન થોડીક જ વારમાં બંધ થઈ શકે છે"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="145489081521468132">"ટૅબ્લેટ થોડીક જ વારમાં બંધ થઈ શકે છે"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="1070562682853942350">"ડિવાઇસ થોડીક જ વારમાં બંધ થઈ શકે છે"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="4429259621177089719">"ફોન થોડીક જ વારમાં બંધ થઈ શકે છે (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="7703677921000858479">"ટૅબ્લેટ થોડીક જ વારમાં બંધ થઈ શકે છે (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="4374784375644214578">"ડિવાઇસ થોડીક જ વારમાં બંધ થઈ શકે છે (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
     <string name="power_charging" msgid="6727132649743436802">"<xliff:g id="LEVEL">%1$s</xliff:g> - <xliff:g id="STATE">%2$s</xliff:g>"</string>
     <string name="power_remaining_charging_duration_only" msgid="7415639699283965818">"ચાર્જ થવામાં <xliff:g id="TIME">%1$s</xliff:g> બાકી છે"</string>
     <string name="power_charging_duration" msgid="5005740040558984057">"<xliff:g id="LEVEL">%1$s</xliff:g> - ચાર્જ થવા માટે <xliff:g id="TIME">%2$s</xliff:g>"</string>
     <string name="battery_info_status_unknown" msgid="268625384868401114">"અજાણ્યું"</string>
     <string name="battery_info_status_charging" msgid="4279958015430387405">"ચાર્જ થઈ રહ્યું છે"</string>
-    <!-- no translation found for battery_info_status_charging_fast (8027559755902954885) -->
-    <skip />
-    <!-- no translation found for battery_info_status_charging_slow (3190803837168962319) -->
-    <skip />
+    <string name="battery_info_status_charging_fast" msgid="8027559755902954885">"ઝડપથી ચાર્જ થાય છે"</string>
+    <string name="battery_info_status_charging_slow" msgid="3190803837168962319">"ધીમેથી ચાર્જ થાય છે"</string>
     <string name="battery_info_status_discharging" msgid="6962689305413556485">"ચાર્જ થઈ રહ્યું નથી"</string>
     <string name="battery_info_status_not_charging" msgid="8330015078868707899">"પ્લગ ઇન કરેલ, હમણાં ચાર્જ કરી શકતા નથી"</string>
     <string name="battery_info_status_full" msgid="4443168946046847468">"પૂર્ણ"</string>
diff --git a/packages/SettingsLib/res/values-hi/strings.xml b/packages/SettingsLib/res/values-hi/strings.xml
index c79c4a4..24153b9 100644
--- a/packages/SettingsLib/res/values-hi/strings.xml
+++ b/packages/SettingsLib/res/values-hi/strings.xml
@@ -206,6 +206,60 @@
     <string name="enable_adb" msgid="8072776357237289039">"USB डीबग करना"</string>
     <string name="enable_adb_summary" msgid="3711526030096574316">"डीबग मोड जब USB कनेक्‍ट किया गया हो"</string>
     <string name="clear_adb_keys" msgid="3010148733140369917">"USB डीबग करने की मंज़ूरी रद्द करें"</string>
+    <!-- no translation found for enable_adb_wireless (6973226350963971018) -->
+    <skip />
+    <!-- no translation found for enable_adb_wireless_summary (7344391423657093011) -->
+    <skip />
+    <!-- no translation found for adb_wireless_error (721958772149779856) -->
+    <skip />
+    <!-- no translation found for adb_wireless_settings (2295017847215680229) -->
+    <skip />
+    <!-- no translation found for adb_wireless_list_empty_off (1713707973837255490) -->
+    <skip />
+    <!-- no translation found for adb_pair_method_qrcode_title (6982904096137468634) -->
+    <skip />
+    <!-- no translation found for adb_pair_method_qrcode_summary (3729901496856458634) -->
+    <skip />
+    <!-- no translation found for adb_pair_method_code_title (1122590300445142904) -->
+    <skip />
+    <!-- no translation found for adb_pair_method_code_summary (6370414511333685185) -->
+    <skip />
+    <!-- no translation found for adb_paired_devices_title (5268997341526217362) -->
+    <skip />
+    <!-- no translation found for adb_wireless_device_connected_summary (3039660790249148713) -->
+    <skip />
+    <!-- no translation found for adb_wireless_device_details_title (7129369670526565786) -->
+    <skip />
+    <!-- no translation found for adb_device_forget (193072400783068417) -->
+    <skip />
+    <!-- no translation found for adb_device_fingerprint_title_format (291504822917843701) -->
+    <skip />
+    <!-- no translation found for adb_wireless_connection_failed_title (664211177427438438) -->
+    <skip />
+    <!-- no translation found for adb_wireless_connection_failed_message (9213896700171602073) -->
+    <skip />
+    <!-- no translation found for adb_pairing_device_dialog_title (7141739231018530210) -->
+    <skip />
+    <!-- no translation found for adb_pairing_device_dialog_pairing_code_label (3639239786669722731) -->
+    <skip />
+    <!-- no translation found for adb_pairing_device_dialog_failed_title (3426758947882091735) -->
+    <skip />
+    <!-- no translation found for adb_pairing_device_dialog_failed_msg (6611097519661997148) -->
+    <skip />
+    <!-- no translation found for adb_wireless_qrcode_summary (8051414549011801917) -->
+    <skip />
+    <!-- no translation found for adb_wireless_verifying_qrcode_text (6123192424916029207) -->
+    <skip />
+    <!-- no translation found for adb_qrcode_pairing_device_failed_msg (6936292092592914132) -->
+    <skip />
+    <!-- no translation found for adb_wireless_ip_addr_preference_title (8335132107715311730) -->
+    <skip />
+    <!-- no translation found for adb_wireless_qrcode_pairing_title (1906409667944674707) -->
+    <skip />
+    <!-- no translation found for adb_wireless_qrcode_pairing_description (8578868049289910131) -->
+    <skip />
+    <!-- no translation found for keywords_adb_wireless (6507505581882171240) -->
+    <skip />
     <string name="bugreport_in_power" msgid="8664089072534638709">"गड़बड़ी की रिपोर्ट का शॉर्टकट"</string>
     <string name="bugreport_in_power_summary" msgid="1885529649381831775">"गड़बड़ी की रिपोर्ट लेने के लिए पावर मेन्यू में कोई बटन दिखाएं"</string>
     <string name="keep_screen_on" msgid="1187161672348797558">"स्क्रीन को चालू रखें"</string>
@@ -271,6 +325,10 @@
     <string name="tethering_hardware_offload_summary" msgid="7801345335142803029">"हार्डवेयर से तेज़ी लाने के लिए टेदर करने की सुविधा मौजूद होने पर उसका इस्तेमाल करें"</string>
     <string name="adb_warning_title" msgid="7708653449506485728">"USB डीबग करने की अनुमति दें?"</string>
     <string name="adb_warning_message" msgid="8145270656419669221">"USB डीबग करने का मकसद केवल डेवेलप करना है. इसका इस्तेमाल आपके कंप्‍यूटर और आपके डिवाइस के बीच डेटा को कॉपी करने, बिना सूचना के आपके डिवाइस पर ऐप इंस्‍टॉल करने और लॉग डेटा पढ़ने के लिए करें."</string>
+    <!-- no translation found for adbwifi_warning_title (727104571653031865) -->
+    <skip />
+    <!-- no translation found for adbwifi_warning_message (8005936574322702388) -->
+    <skip />
     <string name="adb_keys_warning_message" msgid="2968555274488101220">"उन सभी कंप्यूटरों से USB डीबग करने की पहुंचर रद्द करें, जिन्हें आपने पहले इसकी मंज़ूरी दी थी?"</string>
     <string name="dev_settings_warning_title" msgid="8251234890169074553">"विकास सेटिंग की अनुमति दें?"</string>
     <string name="dev_settings_warning_message" msgid="37741686486073668">"ये सेटिंग केवल विकास संबंधी उपयोग के प्रयोजन से हैं. वे आपके डिवाइस और उस पर स्‍थित ऐप्लिकेशन  को खराब कर सकती हैं या उनके दुर्व्यवहार का कारण हो सकती हैं."</string>
@@ -403,12 +461,18 @@
     <string name="power_remaining_less_than_duration" msgid="1812668275239801236">"<xliff:g id="THRESHOLD">%1$s</xliff:g> से कम बैटरी बची है (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_more_than_subtext" msgid="7919119719242734848">"<xliff:g id="TIME_REMAINING">%1$s</xliff:g> से ज़्यादा चलने लायक बैटरी बची है (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_only_more_than_subtext" msgid="3274496164769110480">"<xliff:g id="TIME_REMAINING">%1$s</xliff:g> से ज़्यादा चलने लायक बैटरी बची है"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="6583866940347159957">"फ़ोन जल्दी ही बंद हो सकता है"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="8009177999719462724">"टैबलेट जल्दी ही बंद हो सकता है"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="8320892540455268018">"डिवाइस जल्दी ही बंद हो सकता है"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="6186572170809116621">"फ़ोन जल्दी ही बंद हो सकता है (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="1338758278145563121">"टैबलेट जल्दी ही बंद हो सकता है (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="3699579688084774362">"डिवाइस जल्दी ही बंद हो सकता है (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <!-- no translation found for power_remaining_duration_only_shutdown_imminent (137330009791560774) -->
+    <skip />
+    <!-- no translation found for power_remaining_duration_only_shutdown_imminent (145489081521468132) -->
+    <skip />
+    <!-- no translation found for power_remaining_duration_only_shutdown_imminent (1070562682853942350) -->
+    <skip />
+    <!-- no translation found for power_remaining_duration_shutdown_imminent (4429259621177089719) -->
+    <skip />
+    <!-- no translation found for power_remaining_duration_shutdown_imminent (7703677921000858479) -->
+    <skip />
+    <!-- no translation found for power_remaining_duration_shutdown_imminent (4374784375644214578) -->
+    <skip />
     <string name="power_charging" msgid="6727132649743436802">"<xliff:g id="LEVEL">%1$s</xliff:g> - <xliff:g id="STATE">%2$s</xliff:g>"</string>
     <string name="power_remaining_charging_duration_only" msgid="7415639699283965818">"चार्ज पूरा होने में <xliff:g id="TIME">%1$s</xliff:g> बचा है"</string>
     <string name="power_charging_duration" msgid="5005740040558984057">"<xliff:g id="LEVEL">%1$s</xliff:g> - <xliff:g id="TIME">%2$s</xliff:g> में पूरा चार्ज हो जाएगा"</string>
diff --git a/packages/SettingsLib/res/values-hr/strings.xml b/packages/SettingsLib/res/values-hr/strings.xml
index 3ab5678..28a8858 100644
--- a/packages/SettingsLib/res/values-hr/strings.xml
+++ b/packages/SettingsLib/res/values-hr/strings.xml
@@ -206,6 +206,33 @@
     <string name="enable_adb" msgid="8072776357237289039">"Otklanjanje pogrešaka putem USB-a"</string>
     <string name="enable_adb_summary" msgid="3711526030096574316">"Otklanjanje pogrešaka putem USB-a"</string>
     <string name="clear_adb_keys" msgid="3010148733140369917">"Opoziv autorizacija za otklanjanje pogrešaka putem USB-a"</string>
+    <string name="enable_adb_wireless" msgid="6973226350963971018">"Bežično otklanjanje pogrešaka"</string>
+    <string name="enable_adb_wireless_summary" msgid="7344391423657093011">"Način otklanjanja pogrešaka kad je Wi-Fi povezan"</string>
+    <string name="adb_wireless_error" msgid="721958772149779856">"Pogreška"</string>
+    <string name="adb_wireless_settings" msgid="2295017847215680229">"Bežično otklanjanje pogrešaka"</string>
+    <string name="adb_wireless_list_empty_off" msgid="1713707973837255490">"Da biste vidjeli dostupne uređaje i mogli se njima koristiti, uključite bežično otklanjanje pogrešaka"</string>
+    <string name="adb_pair_method_qrcode_title" msgid="6982904096137468634">"Uparivanje uređaja pomoću QR koda"</string>
+    <string name="adb_pair_method_qrcode_summary" msgid="3729901496856458634">"Uparivanje novih uređaja pomoću čitača QR koda"</string>
+    <string name="adb_pair_method_code_title" msgid="1122590300445142904">"Uparivanje uređaja pomoću koda za uparivanje"</string>
+    <string name="adb_pair_method_code_summary" msgid="6370414511333685185">"Uparivanje novih uređaja pomoću šesteroznamenkastog koda"</string>
+    <string name="adb_paired_devices_title" msgid="5268997341526217362">"Upareni uređaji"</string>
+    <string name="adb_wireless_device_connected_summary" msgid="3039660790249148713">"Trenutačno povezano"</string>
+    <string name="adb_wireless_device_details_title" msgid="7129369670526565786">"Pojedinosti o uređaju"</string>
+    <string name="adb_device_forget" msgid="193072400783068417">"Zaboravi"</string>
+    <string name="adb_device_fingerprint_title_format" msgid="291504822917843701">"Otisak prsta na uređaju: <xliff:g id="FINGERPRINT_PARAM">%1$s</xliff:g>"</string>
+    <string name="adb_wireless_connection_failed_title" msgid="664211177427438438">"Neuspješno povezivanje"</string>
+    <string name="adb_wireless_connection_failed_message" msgid="9213896700171602073">"Provjerite je li uređaj <xliff:g id="DEVICE_NAME">%1$s</xliff:g> povezan na ispravnu mrežu"</string>
+    <string name="adb_pairing_device_dialog_title" msgid="7141739231018530210">"Uparivanje s uređajem"</string>
+    <string name="adb_pairing_device_dialog_pairing_code_label" msgid="3639239786669722731">"Kôd za uparivanje putem Wi-Fija"</string>
+    <string name="adb_pairing_device_dialog_failed_title" msgid="3426758947882091735">"Uparivanje nije uspjelo"</string>
+    <string name="adb_pairing_device_dialog_failed_msg" msgid="6611097519661997148">"Provjerite je li uređaj povezan na istu mrežu."</string>
+    <string name="adb_wireless_qrcode_summary" msgid="8051414549011801917">"Uparivanje uređaja putem Wi-Fija skeniranjem QR koda"</string>
+    <string name="adb_wireless_verifying_qrcode_text" msgid="6123192424916029207">"Uparivanje uređaja…"</string>
+    <string name="adb_qrcode_pairing_device_failed_msg" msgid="6936292092592914132">"Uparivanje uređaja nije uspjelo. QR kôd je neispravan ili uređaj nije povezan na istu mrežu."</string>
+    <string name="adb_wireless_ip_addr_preference_title" msgid="8335132107715311730">"IP adresa i priključak"</string>
+    <string name="adb_wireless_qrcode_pairing_title" msgid="1906409667944674707">"Skeniraj QR kôd"</string>
+    <string name="adb_wireless_qrcode_pairing_description" msgid="8578868049289910131">"Uparivanje uređaja putem Wi-Fija skeniranjem QR koda"</string>
+    <string name="keywords_adb_wireless" msgid="6507505581882171240">"adb, otklanjanje pogrešaka, razvoj"</string>
     <string name="bugreport_in_power" msgid="8664089072534638709">"Prečac izvješća o pogreškama"</string>
     <string name="bugreport_in_power_summary" msgid="1885529649381831775">"Prikaži gumb u izborniku napajanja za izradu izvješća o programskim pogreškama"</string>
     <string name="keep_screen_on" msgid="1187161672348797558">"Ne pokreći mirovanje"</string>
@@ -271,6 +298,8 @@
     <string name="tethering_hardware_offload_summary" msgid="7801345335142803029">"Upotreba hardverskog ubrzanja za modemsko povezivanje ako je dostupno"</string>
     <string name="adb_warning_title" msgid="7708653449506485728">"Omogućiti otklanjanje pogrešaka putem USB-a?"</string>
     <string name="adb_warning_message" msgid="8145270656419669221">"Otklanjanje pogrešaka putem USB-a namijenjeno je samo u razvojne svrhe. Može se upotrijebiti za kopiranje podataka s računala na uređaj i obrnuto, instalaciju aplikacija na uređaju bez obavijesti i za čitanje dnevničkih zapisa."</string>
+    <string name="adbwifi_warning_title" msgid="727104571653031865">"Želite li omogućiti bežično otklanjanje pogrešaka?"</string>
+    <string name="adbwifi_warning_message" msgid="8005936574322702388">"Bežično otklanjanje pogrešaka namijenjeno je samo u razvojne svrhe. Može se upotrijebiti za kopiranje podataka s računala na uređaj i obrnuto, instalaciju aplikacija na uređaj bez obavijesti i za čitanje dnevničkih zapisa."</string>
     <string name="adb_keys_warning_message" msgid="2968555274488101220">"Želite li opozvati pristup uklanjanju pogrešaka putem USB-a sa svih računala koja ste prethodno autorizirali?"</string>
     <string name="dev_settings_warning_title" msgid="8251234890169074553">"Dopustiti postavke razvojnih programera?"</string>
     <string name="dev_settings_warning_message" msgid="37741686486073668">"Ove su postavke namijenjene samo razvojnim programerima. One mogu uzrokovati kvar ili neželjeno ponašanje vašeg uređaja i aplikacija na njemu."</string>
@@ -383,8 +412,7 @@
     <string name="daltonizer_mode_protanomaly" msgid="7805583306666608440">"Protanomalija (crveno – zeleno)"</string>
     <string name="daltonizer_mode_tritanomaly" msgid="7135266249220732267">"Tritanomalija (plavo – žuto)"</string>
     <string name="accessibility_display_daltonizer_preference_title" msgid="1810693571332381974">"Korekcija boje"</string>
-    <!-- no translation found for accessibility_display_daltonizer_preference_subtitle (6178138727195403796) -->
-    <skip />
+    <string name="accessibility_display_daltonizer_preference_subtitle" msgid="6178138727195403796">"Korekcija boje pomaže slijepima za boje da vide preciznije boje"</string>
     <string name="daltonizer_type_overridden" msgid="4509604753672535721">"Premošćeno postavkom <xliff:g id="TITLE">%1$s</xliff:g>"</string>
     <string name="power_remaining_settings_home_page" msgid="4885165789445462557">"<xliff:g id="PERCENTAGE">%1$s</xliff:g> – <xliff:g id="TIME_STRING">%2$s</xliff:g>"</string>
     <string name="power_remaining_duration_only" msgid="8264199158671531431">"Još otprilike <xliff:g id="TIME_REMAINING">%1$s</xliff:g>"</string>
@@ -403,21 +431,19 @@
     <string name="power_remaining_less_than_duration" msgid="1812668275239801236">"Preostalo je manje od <xliff:g id="THRESHOLD">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_more_than_subtext" msgid="7919119719242734848">"Preostalo je više od <xliff:g id="TIME_REMAINING">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_only_more_than_subtext" msgid="3274496164769110480">"Preostalo je više od <xliff:g id="TIME_REMAINING">%1$s</xliff:g>"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="6583866940347159957">"Telefon bi se uskoro mogao isključiti"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="8009177999719462724">"Tablet bi se uskoro mogao isključiti"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="8320892540455268018">"Uređaj bi se uskoro mogao isključiti"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="6186572170809116621">"Telefon bi se uskoro mogao isključiti (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="1338758278145563121">"Tablet bi se uskoro mogao isključiti (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="3699579688084774362">"Uređaj bi se uskoro mogao isključiti (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="137330009791560774">"Telefon bi se uskoro mogao isključiti"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="145489081521468132">"Tablet bi se uskoro mogao isključiti"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="1070562682853942350">"Uređaj bi se uskoro mogao isključiti"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="4429259621177089719">"Telefon bi se uskoro mogao isključiti (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="7703677921000858479">"Tablet bi se uskoro mogao isključiti (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="4374784375644214578">"Uređaj bi se uskoro mogao isključiti (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
     <string name="power_charging" msgid="6727132649743436802">"<xliff:g id="LEVEL">%1$s</xliff:g> – <xliff:g id="STATE">%2$s</xliff:g>"</string>
     <string name="power_remaining_charging_duration_only" msgid="7415639699283965818">"Napunit će se za <xliff:g id="TIME">%1$s</xliff:g>"</string>
     <string name="power_charging_duration" msgid="5005740040558984057">"<xliff:g id="LEVEL">%1$s</xliff:g> – napunit će se za <xliff:g id="TIME">%2$s</xliff:g>"</string>
     <string name="battery_info_status_unknown" msgid="268625384868401114">"Nepoznato"</string>
     <string name="battery_info_status_charging" msgid="4279958015430387405">"Punjenje"</string>
-    <!-- no translation found for battery_info_status_charging_fast (8027559755902954885) -->
-    <skip />
-    <!-- no translation found for battery_info_status_charging_slow (3190803837168962319) -->
-    <skip />
+    <string name="battery_info_status_charging_fast" msgid="8027559755902954885">"Brzo punjenje"</string>
+    <string name="battery_info_status_charging_slow" msgid="3190803837168962319">"Sporo punjenje"</string>
     <string name="battery_info_status_discharging" msgid="6962689305413556485">"Ne puni se"</string>
     <string name="battery_info_status_not_charging" msgid="8330015078868707899">"Uključen, trenutačno se ne može puniti"</string>
     <string name="battery_info_status_full" msgid="4443168946046847468">"Puna"</string>
diff --git a/packages/SettingsLib/res/values-hu/strings.xml b/packages/SettingsLib/res/values-hu/strings.xml
index 8d06f58..61433be 100644
--- a/packages/SettingsLib/res/values-hu/strings.xml
+++ b/packages/SettingsLib/res/values-hu/strings.xml
@@ -206,6 +206,33 @@
     <string name="enable_adb" msgid="8072776357237289039">"USB hibakeresés"</string>
     <string name="enable_adb_summary" msgid="3711526030096574316">"Hibakeresés mód USB csatlakoztatásakor"</string>
     <string name="clear_adb_keys" msgid="3010148733140369917">"USB-s hibakeresésre vonatkozó engedélyek visszavonása"</string>
+    <string name="enable_adb_wireless" msgid="6973226350963971018">"Vezeték nélküli hibakeresés"</string>
+    <string name="enable_adb_wireless_summary" msgid="7344391423657093011">"Hibakeresési mód, amikor van Wi-Fi-kapcsolat"</string>
+    <string name="adb_wireless_error" msgid="721958772149779856">"Hiba"</string>
+    <string name="adb_wireless_settings" msgid="2295017847215680229">"Vezeték nélküli hibakeresés"</string>
+    <string name="adb_wireless_list_empty_off" msgid="1713707973837255490">"A rendelkezésre álló eszközök megtekintéséhez és használatához kapcsolja be a vezeték nélküli hibakeresést"</string>
+    <string name="adb_pair_method_qrcode_title" msgid="6982904096137468634">"Eszköz párosítása QR-kóddal"</string>
+    <string name="adb_pair_method_qrcode_summary" msgid="3729901496856458634">"Párosítsa az új eszközöket QR-kód-szkennelő használatával"</string>
+    <string name="adb_pair_method_code_title" msgid="1122590300445142904">"Eszköz párosítása párosítókóddal"</string>
+    <string name="adb_pair_method_code_summary" msgid="6370414511333685185">"Párosítsa az új eszközöket hatjegyű kód használatával"</string>
+    <string name="adb_paired_devices_title" msgid="5268997341526217362">"Párosított eszközök"</string>
+    <string name="adb_wireless_device_connected_summary" msgid="3039660790249148713">"Csatlakoztatva"</string>
+    <string name="adb_wireless_device_details_title" msgid="7129369670526565786">"Eszközadatok"</string>
+    <string name="adb_device_forget" msgid="193072400783068417">"Elfelejtés"</string>
+    <string name="adb_device_fingerprint_title_format" msgid="291504822917843701">"Ujjlenyomat az eszközön: <xliff:g id="FINGERPRINT_PARAM">%1$s</xliff:g>"</string>
+    <string name="adb_wireless_connection_failed_title" msgid="664211177427438438">"Sikertelen kapcsolódás"</string>
+    <string name="adb_wireless_connection_failed_message" msgid="9213896700171602073">"Győződjön meg arról, hogy a(z) <xliff:g id="DEVICE_NAME">%1$s</xliff:g> a megfelelő hálózathoz csatlakozik"</string>
+    <string name="adb_pairing_device_dialog_title" msgid="7141739231018530210">"Párosítás eszközzel"</string>
+    <string name="adb_pairing_device_dialog_pairing_code_label" msgid="3639239786669722731">"Wi‑Fi-párosítókód"</string>
+    <string name="adb_pairing_device_dialog_failed_title" msgid="3426758947882091735">"Sikertelen párosítás"</string>
+    <string name="adb_pairing_device_dialog_failed_msg" msgid="6611097519661997148">"Győződjön meg arról, hogy az eszköz a megfelelő hálózathoz csatlakozik."</string>
+    <string name="adb_wireless_qrcode_summary" msgid="8051414549011801917">"Párosítsa az eszközt Wi-Fi-n keresztül QR-kód beolvasásával"</string>
+    <string name="adb_wireless_verifying_qrcode_text" msgid="6123192424916029207">"Eszköz párosítása…"</string>
+    <string name="adb_qrcode_pairing_device_failed_msg" msgid="6936292092592914132">"Nem sikerült az eszközzel való párosítás. Vagy helytelen volt a QR-kód, vagy az eszköz másik hálózathoz csatlakozott."</string>
+    <string name="adb_wireless_ip_addr_preference_title" msgid="8335132107715311730">"IP-cím és port"</string>
+    <string name="adb_wireless_qrcode_pairing_title" msgid="1906409667944674707">"QR-kód beolvasása"</string>
+    <string name="adb_wireless_qrcode_pairing_description" msgid="8578868049289910131">"Párosítsa az eszközt Wi-Fi-n keresztül QR-kód beolvasásával"</string>
+    <string name="keywords_adb_wireless" msgid="6507505581882171240">"adb, debug, dev"</string>
     <string name="bugreport_in_power" msgid="8664089072534638709">"Hibabejelentési gomb"</string>
     <string name="bugreport_in_power_summary" msgid="1885529649381831775">"Gomb megjelenítése a bekapcsolási menüben hibajelentés készítéséhez"</string>
     <string name="keep_screen_on" msgid="1187161672348797558">"Nem kapcsolódik ki"</string>
@@ -271,6 +298,8 @@
     <string name="tethering_hardware_offload_summary" msgid="7801345335142803029">"Az internetmegosztás hardveres gyorsításának használata, amikor lehetséges"</string>
     <string name="adb_warning_title" msgid="7708653449506485728">"Engedélyezi az USB hibakeresést?"</string>
     <string name="adb_warning_message" msgid="8145270656419669221">"Az USB hibakeresés fejlesztési célokat szolgál. Használhatja adatok másolására a számítógép és a készülék között, alkalmazások a készülékre való értesítés nélküli telepítésére és naplózási adatok olvasására."</string>
+    <string name="adbwifi_warning_title" msgid="727104571653031865">"Engedélyezi a vezeték nélküli hibakeresést?"</string>
+    <string name="adbwifi_warning_message" msgid="8005936574322702388">"A vezeték nélküli hibakeresés kizárólag fejlesztési célokat szolgál. Használhatja adatok másolására a számítógép és az eszköz között, alkalmazásoknak az eszközre való telepítésére (értesítés nélkül) és naplózási adatok olvasására."</string>
     <string name="adb_keys_warning_message" msgid="2968555274488101220">"Visszavonja a hozzáférést az USB-s hibakereséshez az összes számítógépről, ahol korábban engedélyezte azt?"</string>
     <string name="dev_settings_warning_title" msgid="8251234890169074553">"Engedélyezi a fejlesztői beállításokat?"</string>
     <string name="dev_settings_warning_message" msgid="37741686486073668">"Ezek a beállítások csak fejlesztői használatra szolgálnak. Használatuk esetén eszköze vagy alkalmazásai meghibásodhatnak, illetve nem várt módon viselkedhetnek."</string>
@@ -383,8 +412,7 @@
     <string name="daltonizer_mode_protanomaly" msgid="7805583306666608440">"Protanomália (piros– zöld)"</string>
     <string name="daltonizer_mode_tritanomaly" msgid="7135266249220732267">"Tritanomália (kék–sárga)"</string>
     <string name="accessibility_display_daltonizer_preference_title" msgid="1810693571332381974">"Színkorrekció"</string>
-    <!-- no translation found for accessibility_display_daltonizer_preference_subtitle (6178138727195403796) -->
-    <skip />
+    <string name="accessibility_display_daltonizer_preference_subtitle" msgid="6178138727195403796">"A színkorrekció segít a színtévesztőknek abban, hogy pontosabban lássák a színeket"</string>
     <string name="daltonizer_type_overridden" msgid="4509604753672535721">"Felülírva erre: <xliff:g id="TITLE">%1$s</xliff:g>"</string>
     <string name="power_remaining_settings_home_page" msgid="4885165789445462557">"<xliff:g id="PERCENTAGE">%1$s</xliff:g> – <xliff:g id="TIME_STRING">%2$s</xliff:g>"</string>
     <string name="power_remaining_duration_only" msgid="8264199158671531431">"Körülbelül <xliff:g id="TIME_REMAINING">%1$s</xliff:g> maradt hátra"</string>
@@ -403,21 +431,19 @@
     <string name="power_remaining_less_than_duration" msgid="1812668275239801236">"Kevesebb mint <xliff:g id="THRESHOLD">%1$s</xliff:g> van hátra (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_more_than_subtext" msgid="7919119719242734848">"Kevesebb mint <xliff:g id="TIME_REMAINING">%1$s</xliff:g> van hátra (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_only_more_than_subtext" msgid="3274496164769110480">"Több mint <xliff:g id="TIME_REMAINING">%1$s</xliff:g> van hátra"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="6583866940347159957">"Előfordulhat, hogy a telefon hamarosan leáll"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="8009177999719462724">"Előfordulhat, hogy a táblagép hamarosan leáll"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="8320892540455268018">"Előfordulhat, hogy az eszköz hamarosan leáll"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="6186572170809116621">"Előfordulhat, hogy a telefon hamarosan leáll (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="1338758278145563121">"Előfordulhat, hogy a táblagép hamarosan leáll (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="3699579688084774362">"Előfordulhat, hogy az eszköz hamarosan leáll (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="137330009791560774">"Előfordulhat, hogy a telefon hamarosan kikapcsol"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="145489081521468132">"Előfordulhat, hogy a táblagép hamarosan kikapcsol"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="1070562682853942350">"Előfordulhat, hogy az eszköz hamarosan kikapcsol"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="4429259621177089719">"Előfordulhat, hogy a telefon hamarosan kikapcsol (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="7703677921000858479">"Előfordulhat, hogy a táblagép hamarosan kikapcsol (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="4374784375644214578">"Előfordulhat, hogy az eszköz hamarosan kikapcsol (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
     <string name="power_charging" msgid="6727132649743436802">"<xliff:g id="LEVEL">%1$s</xliff:g> – <xliff:g id="STATE">%2$s</xliff:g>"</string>
     <string name="power_remaining_charging_duration_only" msgid="7415639699283965818">"<xliff:g id="TIME">%1$s</xliff:g> van hátra a feltöltésig"</string>
     <string name="power_charging_duration" msgid="5005740040558984057">"<xliff:g id="LEVEL">%1$s</xliff:g> – <xliff:g id="TIME">%2$s</xliff:g> a feltöltésig"</string>
     <string name="battery_info_status_unknown" msgid="268625384868401114">"Ismeretlen"</string>
     <string name="battery_info_status_charging" msgid="4279958015430387405">"Töltés"</string>
-    <!-- no translation found for battery_info_status_charging_fast (8027559755902954885) -->
-    <skip />
-    <!-- no translation found for battery_info_status_charging_slow (3190803837168962319) -->
-    <skip />
+    <string name="battery_info_status_charging_fast" msgid="8027559755902954885">"Gyorstöltés"</string>
+    <string name="battery_info_status_charging_slow" msgid="3190803837168962319">"Lassú töltés"</string>
     <string name="battery_info_status_discharging" msgid="6962689305413556485">"Nem tölt"</string>
     <string name="battery_info_status_not_charging" msgid="8330015078868707899">"Csatlakoztatva, jelenleg nem tölt"</string>
     <string name="battery_info_status_full" msgid="4443168946046847468">"Feltöltve"</string>
diff --git a/packages/SettingsLib/res/values-hy/strings.xml b/packages/SettingsLib/res/values-hy/strings.xml
index 99cef28..2e39f2c 100644
--- a/packages/SettingsLib/res/values-hy/strings.xml
+++ b/packages/SettingsLib/res/values-hy/strings.xml
@@ -206,6 +206,33 @@
     <string name="enable_adb" msgid="8072776357237289039">"USB-ով վրիպազերծում"</string>
     <string name="enable_adb_summary" msgid="3711526030096574316">"Միացնել վրիպազերծման ռեժիմը, երբ USB-ն միացված է"</string>
     <string name="clear_adb_keys" msgid="3010148733140369917">"Չեղարկել USB-ով վրիպազերծման թույլտվությունները"</string>
+    <string name="enable_adb_wireless" msgid="6973226350963971018">"Անլար վրիպազերծում"</string>
+    <string name="enable_adb_wireless_summary" msgid="7344391423657093011">"Ակտիվացնել վրիպազերծման ռեժիմը, երբ Wi-Fi-ը միացված է"</string>
+    <string name="adb_wireless_error" msgid="721958772149779856">"Սխալ"</string>
+    <string name="adb_wireless_settings" msgid="2295017847215680229">"Անլար վրիպազերծում"</string>
+    <string name="adb_wireless_list_empty_off" msgid="1713707973837255490">"Հասանելի սարքերը տեսնելու և օգտագործելու համար միացրեք անլար վրիպազերծումը"</string>
+    <string name="adb_pair_method_qrcode_title" msgid="6982904096137468634">"Զուգակցեք սարքը՝ օգտագործելով QR կոդը"</string>
+    <string name="adb_pair_method_qrcode_summary" msgid="3729901496856458634">"Զուգակցեք նոր սարքեր՝ օգտագործելով QR կոդերի սկաները"</string>
+    <string name="adb_pair_method_code_title" msgid="1122590300445142904">"Զուգակցեք սարքը՝ օգտագործելով զուգակցման կոդը"</string>
+    <string name="adb_pair_method_code_summary" msgid="6370414511333685185">"Զուգակցեք նոր սարքեր՝ օգտագործելով վեցանիշ կոդը"</string>
+    <string name="adb_paired_devices_title" msgid="5268997341526217362">"Զուգակցված սարքեր"</string>
+    <string name="adb_wireless_device_connected_summary" msgid="3039660790249148713">"Միացված է"</string>
+    <string name="adb_wireless_device_details_title" msgid="7129369670526565786">"Սարքի տվյալները"</string>
+    <string name="adb_device_forget" msgid="193072400783068417">"Հեռացնել"</string>
+    <string name="adb_device_fingerprint_title_format" msgid="291504822917843701">"Սարքի մատնահետք՝ <xliff:g id="FINGERPRINT_PARAM">%1$s</xliff:g>"</string>
+    <string name="adb_wireless_connection_failed_title" msgid="664211177427438438">"Չհաջողվեց միացնել"</string>
+    <string name="adb_wireless_connection_failed_message" msgid="9213896700171602073">"Համոզվեք, որ <xliff:g id="DEVICE_NAME">%1$s</xliff:g> սարքը միացված է ճիշտ ցանցին"</string>
+    <string name="adb_pairing_device_dialog_title" msgid="7141739231018530210">"Սարքի հետ զուգակցում"</string>
+    <string name="adb_pairing_device_dialog_pairing_code_label" msgid="3639239786669722731">"Wi‑Fi-ի զուգակցման կոդ"</string>
+    <string name="adb_pairing_device_dialog_failed_title" msgid="3426758947882091735">"Չհաջողվեց զուգակցել"</string>
+    <string name="adb_pairing_device_dialog_failed_msg" msgid="6611097519661997148">"Համոզվեք, որ սարքը միացված է միևնույն ցանցին։"</string>
+    <string name="adb_wireless_qrcode_summary" msgid="8051414549011801917">"Զուգակցեք սարքը՝ Wi‑Fi-ի օգնությամբ սկանավորելով QR կոդը"</string>
+    <string name="adb_wireless_verifying_qrcode_text" msgid="6123192424916029207">"Սարքը զուգակցվում է…"</string>
+    <string name="adb_qrcode_pairing_device_failed_msg" msgid="6936292092592914132">"Չհաջողվեց զուգակցել սարքի հետ։ Հնարավոր է, որ QR կոդը սխալ է, կամ սարքը միացված չէ միևնույն ցանցին։"</string>
+    <string name="adb_wireless_ip_addr_preference_title" msgid="8335132107715311730">"IP հասցե և միացք"</string>
+    <string name="adb_wireless_qrcode_pairing_title" msgid="1906409667944674707">"QR կոդի սկանավորում"</string>
+    <string name="adb_wireless_qrcode_pairing_description" msgid="8578868049289910131">"Զուգակցեք սարքը՝ Wi‑Fi-ի օգնությամբ սկանավորելով QR կոդը"</string>
+    <string name="keywords_adb_wireless" msgid="6507505581882171240">"adb, վրիպազերծում, ծրագրավորող"</string>
     <string name="bugreport_in_power" msgid="8664089072534638709">"Սխալի հաղորդման դյուրանցում"</string>
     <string name="bugreport_in_power_summary" msgid="1885529649381831775">"Գործարկման ցանկում ցույց տալ կոճակը՝ վրիպակների հաղորդման համար"</string>
     <string name="keep_screen_on" msgid="1187161672348797558">"Մնալ արթուն"</string>
@@ -271,6 +298,8 @@
     <string name="tethering_hardware_offload_summary" msgid="7801345335142803029">"Օգտագործել սարքակազմի արագացման միացումը, եթե հասանելի է"</string>
     <string name="adb_warning_title" msgid="7708653449506485728">"Թույլատրե՞լ USB-ով վրիպազերծումը:"</string>
     <string name="adb_warning_message" msgid="8145270656419669221">"USB-ով վրիպազերծումը միայն ծրագրավորման նպատակների համար է: Օգտագործեք այն ձեր համակարգչից տվյալները ձեր սարք պատճենելու համար, առանց ծանուցման ձեր սարքի վրա ծրագրեր տեղադրելու և տվյալների մատյանը ընթերցելու համար:"</string>
+    <string name="adbwifi_warning_title" msgid="727104571653031865">"Թույլատրե՞լ անլար վրիպազերծումը"</string>
+    <string name="adbwifi_warning_message" msgid="8005936574322702388">"Անլար վրիպազերծումը նախատեսված է միայն ծրագրավորման համար: Այն թույլ է տալիս համակարգչի և սարքի միջև տվյալներ պատճենել, առանց ծանուցման ձեր սարքի վրա հավելվածներ տեղադրել և մատյանի ֆայլերը ընթերցել։"</string>
     <string name="adb_keys_warning_message" msgid="2968555274488101220">"Չեղարկե՞լ USB-ով վրիպազերծման հասանելիությունը` անջատելով այն բոլոր համակարգիչներից, որտեղ նախկինում թույլատրել էիք:"</string>
     <string name="dev_settings_warning_title" msgid="8251234890169074553">"Ընդունե՞լ ծրագրավորման կարգավորումներ:"</string>
     <string name="dev_settings_warning_message" msgid="37741686486073668">"Այս կարգավորումները միայն ծրագրավորման նպատակների համար են նախատեսված: Դրանք կարող են խանգարել ձեր սարքի կամ ծրագրի աշխատանքին:"</string>
@@ -383,8 +412,7 @@
     <string name="daltonizer_mode_protanomaly" msgid="7805583306666608440">"Պրոտանոմալիա (կարմիր-կանաչ)"</string>
     <string name="daltonizer_mode_tritanomaly" msgid="7135266249220732267">"Տրիտանոմալիա (կապույտ-դեղին)"</string>
     <string name="accessibility_display_daltonizer_preference_title" msgid="1810693571332381974">"Գունաշտկում"</string>
-    <!-- no translation found for accessibility_display_daltonizer_preference_subtitle (6178138727195403796) -->
-    <skip />
+    <string name="accessibility_display_daltonizer_preference_subtitle" msgid="6178138727195403796">"Գունաշտկումն օգնում է դալթոնիզմ ունեցող մարդկանց ավելի ճշգրիտ տեսնել գույները"</string>
     <string name="daltonizer_type_overridden" msgid="4509604753672535721">"Գերազանցված է <xliff:g id="TITLE">%1$s</xliff:g>-ից"</string>
     <string name="power_remaining_settings_home_page" msgid="4885165789445462557">"<xliff:g id="PERCENTAGE">%1$s</xliff:g> – <xliff:g id="TIME_STRING">%2$s</xliff:g>"</string>
     <string name="power_remaining_duration_only" msgid="8264199158671531431">"Լիցքը կբավարարի մոտ <xliff:g id="TIME_REMAINING">%1$s</xliff:g>"</string>
@@ -403,21 +431,19 @@
     <string name="power_remaining_less_than_duration" msgid="1812668275239801236">"Մնացել է <xliff:g id="THRESHOLD">%1$s</xliff:g>-ից պակաս (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_more_than_subtext" msgid="7919119719242734848">"Մնացել է ավելի քան <xliff:g id="TIME_REMAINING">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_only_more_than_subtext" msgid="3274496164769110480">"Մնացել է ավելի քան <xliff:g id="TIME_REMAINING">%1$s</xliff:g>"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="6583866940347159957">"Հեռախոսը շուտով կանջատվի"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="8009177999719462724">"Պլանշետը շուտով կանջատվի"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="8320892540455268018">"Սարքը շուտով կանջատվի"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="6186572170809116621">"Հեռախոսը շուտով կանջատվի (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="1338758278145563121">"Պլանշետը շուտով կանջատվի (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="3699579688084774362">"Սարքը շուտով կանջատվի (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="137330009791560774">"Հեռախոսը շուտով կանջատվի"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="145489081521468132">"Պլանշետը շուտով կանջատվի"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="1070562682853942350">"Սարքը շուտով կանջատվի"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="4429259621177089719">"Հեռախոսը շուտով կանջատվի (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="7703677921000858479">"Պլանշետը շուտով կանջատվի (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="4374784375644214578">"Սարքը շուտով կանջատվի (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
     <string name="power_charging" msgid="6727132649743436802">"<xliff:g id="LEVEL">%1$s</xliff:g> - <xliff:g id="STATE">%2$s</xliff:g>"</string>
     <string name="power_remaining_charging_duration_only" msgid="7415639699283965818">"<xliff:g id="TIME">%1$s</xliff:g> մինչև լիցքավորումը"</string>
     <string name="power_charging_duration" msgid="5005740040558984057">"<xliff:g id="LEVEL">%1$s</xliff:g> – <xliff:g id="TIME">%2$s</xliff:g> մինչև լիցքավորումը"</string>
     <string name="battery_info_status_unknown" msgid="268625384868401114">"Անհայտ"</string>
     <string name="battery_info_status_charging" msgid="4279958015430387405">"Լիցքավորում"</string>
-    <!-- no translation found for battery_info_status_charging_fast (8027559755902954885) -->
-    <skip />
-    <!-- no translation found for battery_info_status_charging_slow (3190803837168962319) -->
-    <skip />
+    <string name="battery_info_status_charging_fast" msgid="8027559755902954885">"Արագ լիցքավորում"</string>
+    <string name="battery_info_status_charging_slow" msgid="3190803837168962319">"Դանդաղ լիցքավորում"</string>
     <string name="battery_info_status_discharging" msgid="6962689305413556485">"Չի լիցքավորվում"</string>
     <string name="battery_info_status_not_charging" msgid="8330015078868707899">"Միացված է հոսանքի աղբյուրին, սակայն այս պահին չի կարող լիցքավորվել"</string>
     <string name="battery_info_status_full" msgid="4443168946046847468">"Լիցքավորված է"</string>
diff --git a/packages/SettingsLib/res/values-in/strings.xml b/packages/SettingsLib/res/values-in/strings.xml
index 25de382..b75fa35 100644
--- a/packages/SettingsLib/res/values-in/strings.xml
+++ b/packages/SettingsLib/res/values-in/strings.xml
@@ -206,6 +206,33 @@
     <string name="enable_adb" msgid="8072776357237289039">"Debugging USB"</string>
     <string name="enable_adb_summary" msgid="3711526030096574316">"Mode debug ketika USB tersambung"</string>
     <string name="clear_adb_keys" msgid="3010148733140369917">"Cabut otorisasi debug USB"</string>
+    <string name="enable_adb_wireless" msgid="6973226350963971018">"Proses debug nirkabel"</string>
+    <string name="enable_adb_wireless_summary" msgid="7344391423657093011">"Mode debug saat Wi-Fi tersambung"</string>
+    <string name="adb_wireless_error" msgid="721958772149779856">"Error"</string>
+    <string name="adb_wireless_settings" msgid="2295017847215680229">"Proses debug nirkabel"</string>
+    <string name="adb_wireless_list_empty_off" msgid="1713707973837255490">"Untuk melihat dan menggunakan perangkat yang tersedia, aktifkan proses debug nirkabel"</string>
+    <string name="adb_pair_method_qrcode_title" msgid="6982904096137468634">"Sambungkan perangkat dengan kode QR"</string>
+    <string name="adb_pair_method_qrcode_summary" msgid="3729901496856458634">"Sambungkan perangkat baru menggunakan Pemindai kode QR"</string>
+    <string name="adb_pair_method_code_title" msgid="1122590300445142904">"Sambungkan perangkat dengan kode penghubung"</string>
+    <string name="adb_pair_method_code_summary" msgid="6370414511333685185">"Sambungkan perangkat baru menggunakan kode enam digit"</string>
+    <string name="adb_paired_devices_title" msgid="5268997341526217362">"Perangkat disambungkan"</string>
+    <string name="adb_wireless_device_connected_summary" msgid="3039660790249148713">"Saat ini tersambung"</string>
+    <string name="adb_wireless_device_details_title" msgid="7129369670526565786">"Detail perangkat"</string>
+    <string name="adb_device_forget" msgid="193072400783068417">"Lupakan"</string>
+    <string name="adb_device_fingerprint_title_format" msgid="291504822917843701">"Sidik jari perangkat: <xliff:g id="FINGERPRINT_PARAM">%1$s</xliff:g>"</string>
+    <string name="adb_wireless_connection_failed_title" msgid="664211177427438438">"Sambungan gagal"</string>
+    <string name="adb_wireless_connection_failed_message" msgid="9213896700171602073">"Pastikan <xliff:g id="DEVICE_NAME">%1$s</xliff:g> tersambung ke jaringan yang tepat"</string>
+    <string name="adb_pairing_device_dialog_title" msgid="7141739231018530210">"Sambungkan dengan perangkat"</string>
+    <string name="adb_pairing_device_dialog_pairing_code_label" msgid="3639239786669722731">"Kode penyambungan Wi-Fi"</string>
+    <string name="adb_pairing_device_dialog_failed_title" msgid="3426758947882091735">"Penyambungan perangkat gagal"</string>
+    <string name="adb_pairing_device_dialog_failed_msg" msgid="6611097519661997148">"Pastikan perangkat tersambung ke jaringan yang sama."</string>
+    <string name="adb_wireless_qrcode_summary" msgid="8051414549011801917">"Menyambungkan perangkat melalui Wi‑Fi dengan memindai Kode QR"</string>
+    <string name="adb_wireless_verifying_qrcode_text" msgid="6123192424916029207">"Menyambungkan perangkat…"</string>
+    <string name="adb_qrcode_pairing_device_failed_msg" msgid="6936292092592914132">"Gagal menyambungkan perangkat. Kode QR salah, atau perangkat tidak tersambung ke jaringan yang sama."</string>
+    <string name="adb_wireless_ip_addr_preference_title" msgid="8335132107715311730">"Alamat IP &amp; Port"</string>
+    <string name="adb_wireless_qrcode_pairing_title" msgid="1906409667944674707">"Memindai kode QR"</string>
+    <string name="adb_wireless_qrcode_pairing_description" msgid="8578868049289910131">"Menyambungkan perangkat melalui Wi‑Fi dengan memindai Kode QR"</string>
+    <string name="keywords_adb_wireless" msgid="6507505581882171240">"adb, debug, dev"</string>
     <string name="bugreport_in_power" msgid="8664089072534638709">"Pintasan laporan bug"</string>
     <string name="bugreport_in_power_summary" msgid="1885529649381831775">"Tampilkan tombol di menu daya untuk mengambil laporan bug"</string>
     <string name="keep_screen_on" msgid="1187161672348797558">"Tetap terjaga"</string>
@@ -271,6 +298,8 @@
     <string name="tethering_hardware_offload_summary" msgid="7801345335142803029">"Gunakan akselerasi hardware tethering jika tersedia"</string>
     <string name="adb_warning_title" msgid="7708653449506485728">"Izinkan melakukan debug USB?"</string>
     <string name="adb_warning_message" msgid="8145270656419669221">"Debugging USB dimaksudkan untuk tujuan pengembangan saja. Gunakan untuk menyalin data antara komputer dan perangkat Anda, memasang apl pada perangkat tanpa notifikasi, dan membaca data log."</string>
+    <string name="adbwifi_warning_title" msgid="727104571653031865">"Izinkan proses debug nirkabel?"</string>
+    <string name="adbwifi_warning_message" msgid="8005936574322702388">"Proses debug nirkabel dimaksudkan untuk tujuan pengembangan saja. Gunakan untuk menyalin data antara komputer dan perangkat Anda, menginstal aplikasi pada perangkat tanpa notifikasi, dan membaca data log."</string>
     <string name="adb_keys_warning_message" msgid="2968555274488101220">"Cabut akses ke debug USB dari semua komputer yang telah Anda otorisasi sebelumnya?"</string>
     <string name="dev_settings_warning_title" msgid="8251234890169074553">"Izinkan setelan pengembangan?"</string>
     <string name="dev_settings_warning_message" msgid="37741686486073668">"Setelan ini hanya dimaksudkan untuk penggunaan pengembangan. Setelan dapat menyebabkan perangkat dan aplikasi yang menerapkannya rusak atau tidak berfungsi semestinya."</string>
@@ -383,8 +412,7 @@
     <string name="daltonizer_mode_protanomaly" msgid="7805583306666608440">"Protanomali (merah-hijau)"</string>
     <string name="daltonizer_mode_tritanomaly" msgid="7135266249220732267">"Tritanomali (biru-kuning)"</string>
     <string name="accessibility_display_daltonizer_preference_title" msgid="1810693571332381974">"Koreksi warna"</string>
-    <!-- no translation found for accessibility_display_daltonizer_preference_subtitle (6178138727195403796) -->
-    <skip />
+    <string name="accessibility_display_daltonizer_preference_subtitle" msgid="6178138727195403796">"Koreksi warna membantu orang penderita buta warna melihat warna yang lebih akurat"</string>
     <string name="daltonizer_type_overridden" msgid="4509604753672535721">"Digantikan oleh <xliff:g id="TITLE">%1$s</xliff:g>"</string>
     <string name="power_remaining_settings_home_page" msgid="4885165789445462557">"<xliff:g id="PERCENTAGE">%1$s</xliff:g> - <xliff:g id="TIME_STRING">%2$s</xliff:g>"</string>
     <string name="power_remaining_duration_only" msgid="8264199158671531431">"Sekitar <xliff:g id="TIME_REMAINING">%1$s</xliff:g> lagi"</string>
@@ -403,21 +431,19 @@
     <string name="power_remaining_less_than_duration" msgid="1812668275239801236">"Tersisa kurang dari <xliff:g id="THRESHOLD">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_more_than_subtext" msgid="7919119719242734848">"Tersisa lebih dari <xliff:g id="TIME_REMAINING">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_only_more_than_subtext" msgid="3274496164769110480">"Tersisa lebih dari <xliff:g id="TIME_REMAINING">%1$s</xliff:g>"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="6583866940347159957">"Ponsel mungkin segera dimatikan"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="8009177999719462724">"Tablet mungkin segera dimatikan"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="8320892540455268018">"Perangkat mungkin segera dimatikan"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="6186572170809116621">"Ponsel mungkin segera dimatikan (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="1338758278145563121">"Tablet mungkin segera dimatikan (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="3699579688084774362">"Perangkat mungkin segera dimatikan (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="137330009791560774">"Ponsel akan segera dimatikan"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="145489081521468132">"Tablet akan segera dimatikan"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="1070562682853942350">"Perangkat akan segera dimatikan"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="4429259621177089719">"Ponsel akan segera dimatikan (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="7703677921000858479">"Tablet akan segera dimatikan (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="4374784375644214578">"Perangkat akan segera dimatikan (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
     <string name="power_charging" msgid="6727132649743436802">"<xliff:g id="LEVEL">%1$s</xliff:g> - <xliff:g id="STATE">%2$s</xliff:g>"</string>
     <string name="power_remaining_charging_duration_only" msgid="7415639699283965818">"Sisa <xliff:g id="TIME">%1$s</xliff:g> hingga terisi penuh"</string>
     <string name="power_charging_duration" msgid="5005740040558984057">"<xliff:g id="LEVEL">%1$s</xliff:g> - <xliff:g id="TIME">%2$s</xliff:g> lagi terisi penuh"</string>
     <string name="battery_info_status_unknown" msgid="268625384868401114">"Tidak diketahui"</string>
     <string name="battery_info_status_charging" msgid="4279958015430387405">"Mengisi daya"</string>
-    <!-- no translation found for battery_info_status_charging_fast (8027559755902954885) -->
-    <skip />
-    <!-- no translation found for battery_info_status_charging_slow (3190803837168962319) -->
-    <skip />
+    <string name="battery_info_status_charging_fast" msgid="8027559755902954885">"Mengisi daya cepat"</string>
+    <string name="battery_info_status_charging_slow" msgid="3190803837168962319">"Mengisi daya lambat"</string>
     <string name="battery_info_status_discharging" msgid="6962689305413556485">"Tidak mengisi daya"</string>
     <string name="battery_info_status_not_charging" msgid="8330015078868707899">"Tercolok, tidak dapat mengisi baterai sekarang"</string>
     <string name="battery_info_status_full" msgid="4443168946046847468">"Penuh"</string>
diff --git a/packages/SettingsLib/res/values-is/strings.xml b/packages/SettingsLib/res/values-is/strings.xml
index 8fe382a..c75c689 100644
--- a/packages/SettingsLib/res/values-is/strings.xml
+++ b/packages/SettingsLib/res/values-is/strings.xml
@@ -206,6 +206,33 @@
     <string name="enable_adb" msgid="8072776357237289039">"USB-villuleit"</string>
     <string name="enable_adb_summary" msgid="3711526030096574316">"Villuleitarstilling þegar USB er tengt."</string>
     <string name="clear_adb_keys" msgid="3010148733140369917">"Afturkalla USB-villuleitarheimildir"</string>
+    <string name="enable_adb_wireless" msgid="6973226350963971018">"Þráðlaus villuleit"</string>
+    <string name="enable_adb_wireless_summary" msgid="7344391423657093011">"Villuleitarstilling þegar Wi-Fi er tengt"</string>
+    <string name="adb_wireless_error" msgid="721958772149779856">"Villa"</string>
+    <string name="adb_wireless_settings" msgid="2295017847215680229">"Þráðlaus villuleit"</string>
+    <string name="adb_wireless_list_empty_off" msgid="1713707973837255490">"Til að sjá og nota tiltæk tæki skal kveikja á þráðlausri villuleit"</string>
+    <string name="adb_pair_method_qrcode_title" msgid="6982904096137468634">"Para tæki með QR-kóða"</string>
+    <string name="adb_pair_method_qrcode_summary" msgid="3729901496856458634">"Para ný tæki með QR-kóðaskanna"</string>
+    <string name="adb_pair_method_code_title" msgid="1122590300445142904">"Para tæki með pörunarkóða"</string>
+    <string name="adb_pair_method_code_summary" msgid="6370414511333685185">"Para ný tæki með sex tölustafa kóða"</string>
+    <string name="adb_paired_devices_title" msgid="5268997341526217362">"Pöruð tæki"</string>
+    <string name="adb_wireless_device_connected_summary" msgid="3039660790249148713">"Tengt"</string>
+    <string name="adb_wireless_device_details_title" msgid="7129369670526565786">"Upplýsingar um tæki"</string>
+    <string name="adb_device_forget" msgid="193072400783068417">"Gleyma"</string>
+    <string name="adb_device_fingerprint_title_format" msgid="291504822917843701">"Fingrafar tækis: <xliff:g id="FINGERPRINT_PARAM">%1$s</xliff:g>"</string>
+    <string name="adb_wireless_connection_failed_title" msgid="664211177427438438">"Tenging mistókst"</string>
+    <string name="adb_wireless_connection_failed_message" msgid="9213896700171602073">"Gakktu úr skugga um að <xliff:g id="DEVICE_NAME">%1$s</xliff:g> sé tengt réttu neti"</string>
+    <string name="adb_pairing_device_dialog_title" msgid="7141739231018530210">"Para við tæki"</string>
+    <string name="adb_pairing_device_dialog_pairing_code_label" msgid="3639239786669722731">"Wi-Fi pörunarkóði"</string>
+    <string name="adb_pairing_device_dialog_failed_title" msgid="3426758947882091735">"Pörun mistókst"</string>
+    <string name="adb_pairing_device_dialog_failed_msg" msgid="6611097519661997148">"Gakktu úr skugga um að tækið sé tengt sama neti."</string>
+    <string name="adb_wireless_qrcode_summary" msgid="8051414549011801917">"Tengja tæki með Wi-Fi með því að skanna QR-kóða"</string>
+    <string name="adb_wireless_verifying_qrcode_text" msgid="6123192424916029207">"Parar tæki…"</string>
+    <string name="adb_qrcode_pairing_device_failed_msg" msgid="6936292092592914132">"Ekki tókst að para við tækið. Annað hvort var QR-kóðinn rangur eða tækið ekki tengt sama neti."</string>
+    <string name="adb_wireless_ip_addr_preference_title" msgid="8335132107715311730">"IP-tala og gátt"</string>
+    <string name="adb_wireless_qrcode_pairing_title" msgid="1906409667944674707">"Skanna QR-kóða"</string>
+    <string name="adb_wireless_qrcode_pairing_description" msgid="8578868049289910131">"Tengja tæki með Wi-Fi með því að skanna QR-kóða"</string>
+    <string name="keywords_adb_wireless" msgid="6507505581882171240">"adb, villuleit, dev"</string>
     <string name="bugreport_in_power" msgid="8664089072534638709">"Flýtileið í villutilkynningu"</string>
     <string name="bugreport_in_power_summary" msgid="1885529649381831775">"Sýna hnapp til að skrá villutilkynningu í valmynd aflrofans"</string>
     <string name="keep_screen_on" msgid="1187161672348797558">"Vaka"</string>
@@ -271,6 +298,8 @@
     <string name="tethering_hardware_offload_summary" msgid="7801345335142803029">"Nota vélbúnaðarhröðun fyrir tjóðrun ef það býðst"</string>
     <string name="adb_warning_title" msgid="7708653449506485728">"Leyfa USB-villuleit?"</string>
     <string name="adb_warning_message" msgid="8145270656419669221">"USB-villuleit er aðeins ætluð til nota í þróunarskyni. Hana má nota til að afrita gögn á milli tölvu og tækis, setja forrit upp í tækinu án tilkynninga og lesa annálagögn."</string>
+    <string name="adbwifi_warning_title" msgid="727104571653031865">"Leyfa þráðlausa villuleit?"</string>
+    <string name="adbwifi_warning_message" msgid="8005936574322702388">"Þráðlaus villuleit er aðeins ætluð til nota í þróunarskyni. Hana má nota til að afrita gögn á milli tölvu og tækis, setja forrit upp í tækinu án tilkynninga og lesa annálagögn."</string>
     <string name="adb_keys_warning_message" msgid="2968555274488101220">"Afturkalla aðgang að USB-villuleit í öllum tölvum sem þú hefur áður veitt heimild?"</string>
     <string name="dev_settings_warning_title" msgid="8251234890169074553">"Leyfa þróunarstillingar?"</string>
     <string name="dev_settings_warning_message" msgid="37741686486073668">"Þessar stillingar eru einungis ætlaðar í þróunarskyni. Þær geta valdið því að tækið og forrit þess bili eða starfi á rangan hátt."</string>
@@ -383,8 +412,7 @@
     <string name="daltonizer_mode_protanomaly" msgid="7805583306666608440">"Litblinda (rauðgræn)"</string>
     <string name="daltonizer_mode_tritanomaly" msgid="7135266249220732267">"Litblinda (blágul)"</string>
     <string name="accessibility_display_daltonizer_preference_title" msgid="1810693571332381974">"Litaleiðrétting"</string>
-    <!-- no translation found for accessibility_display_daltonizer_preference_subtitle (6178138727195403796) -->
-    <skip />
+    <string name="accessibility_display_daltonizer_preference_subtitle" msgid="6178138727195403796">"Litaleiðrétting hjálpar fólki með litblindu að sjá réttari liti"</string>
     <string name="daltonizer_type_overridden" msgid="4509604753672535721">"Hnekkt af <xliff:g id="TITLE">%1$s</xliff:g>"</string>
     <string name="power_remaining_settings_home_page" msgid="4885165789445462557">"<xliff:g id="PERCENTAGE">%1$s</xliff:g> – <xliff:g id="TIME_STRING">%2$s</xliff:g>"</string>
     <string name="power_remaining_duration_only" msgid="8264199158671531431">"Um það bil <xliff:g id="TIME_REMAINING">%1$s</xliff:g> eftir"</string>
@@ -403,21 +431,19 @@
     <string name="power_remaining_less_than_duration" msgid="1812668275239801236">"Minna en <xliff:g id="THRESHOLD">%1$s</xliff:g> eftir (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_more_than_subtext" msgid="7919119719242734848">"Meira en <xliff:g id="TIME_REMAINING">%1$s</xliff:g> eftir (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_only_more_than_subtext" msgid="3274496164769110480">"Meira en <xliff:g id="TIME_REMAINING">%1$s</xliff:g> eftir"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="6583866940347159957">"Síminn gæti slökkt á sér fljótlega"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="8009177999719462724">"Spjaldtölvan gæti slökkt á sér fljótlega"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="8320892540455268018">"Tækið gæti slökkt á sér fljótlega"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="6186572170809116621">"Síminn gæti slökkt á sér fljótlega (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="1338758278145563121">"Spjaldtölvan gæti slökkt á sér fljótlega (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="3699579688084774362">"Tækið gæti slökkt á sér fljótlega (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="137330009791560774">"Síminn gæti slökkt á sér fljótlega"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="145489081521468132">"Spjaldtölvan gæti slökkt á sér fljótlega"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="1070562682853942350">"Tækið gæti slökkt á sér fljótlega"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="4429259621177089719">"Síminn gæti slökkt á sér fljótlega (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="7703677921000858479">"Spjaldtölvan gæti slökkt á sér fljótlega (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="4374784375644214578">"Tækið gæti slökkt á sér fljótlega (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
     <string name="power_charging" msgid="6727132649743436802">"<xliff:g id="LEVEL">%1$s</xliff:g> – <xliff:g id="STATE">%2$s</xliff:g>"</string>
     <string name="power_remaining_charging_duration_only" msgid="7415639699283965818">"<xliff:g id="TIME">%1$s</xliff:g> að fullri hleðslu"</string>
     <string name="power_charging_duration" msgid="5005740040558984057">"<xliff:g id="LEVEL">%1$s</xliff:g> - <xliff:g id="TIME">%2$s</xliff:g> að fullri hleðslu"</string>
     <string name="battery_info_status_unknown" msgid="268625384868401114">"Óþekkt"</string>
     <string name="battery_info_status_charging" msgid="4279958015430387405">"Í hleðslu"</string>
-    <!-- no translation found for battery_info_status_charging_fast (8027559755902954885) -->
-    <skip />
-    <!-- no translation found for battery_info_status_charging_slow (3190803837168962319) -->
-    <skip />
+    <string name="battery_info_status_charging_fast" msgid="8027559755902954885">"Hröð hleðsla"</string>
+    <string name="battery_info_status_charging_slow" msgid="3190803837168962319">"Hæg hleðsla"</string>
     <string name="battery_info_status_discharging" msgid="6962689305413556485">"Ekki í hleðslu"</string>
     <string name="battery_info_status_not_charging" msgid="8330015078868707899">"Í sambandi, ekki hægt að hlaða eins og er"</string>
     <string name="battery_info_status_full" msgid="4443168946046847468">"Fullhlaðin"</string>
diff --git a/packages/SettingsLib/res/values-it/strings.xml b/packages/SettingsLib/res/values-it/strings.xml
index c9abc74..f0dba68 100644
--- a/packages/SettingsLib/res/values-it/strings.xml
+++ b/packages/SettingsLib/res/values-it/strings.xml
@@ -206,6 +206,33 @@
     <string name="enable_adb" msgid="8072776357237289039">"Debug USB"</string>
     <string name="enable_adb_summary" msgid="3711526030096574316">"Modalità debug quando è connesso tramite USB"</string>
     <string name="clear_adb_keys" msgid="3010148733140369917">"Revoca autorizzazioni debug USB"</string>
+    <string name="enable_adb_wireless" msgid="6973226350963971018">"Debug wireless"</string>
+    <string name="enable_adb_wireless_summary" msgid="7344391423657093011">"Modalità Debug quando il Wi-Fi è connesso"</string>
+    <string name="adb_wireless_error" msgid="721958772149779856">"Errore"</string>
+    <string name="adb_wireless_settings" msgid="2295017847215680229">"Debug wireless"</string>
+    <string name="adb_wireless_list_empty_off" msgid="1713707973837255490">"Per trovare e utilizzare i dispositivi disponibili, attiva il debug wireless"</string>
+    <string name="adb_pair_method_qrcode_title" msgid="6982904096137468634">"Accoppia il dispositivo con il codice QR"</string>
+    <string name="adb_pair_method_qrcode_summary" msgid="3729901496856458634">"Accoppia i nuovi dispositivi utilizzando lo scanner di codici QR"</string>
+    <string name="adb_pair_method_code_title" msgid="1122590300445142904">"Accoppia dispositivo con codice di accoppiamento"</string>
+    <string name="adb_pair_method_code_summary" msgid="6370414511333685185">"Accoppia i nuovi dispositivi utilizzando un codice di sei cifre"</string>
+    <string name="adb_paired_devices_title" msgid="5268997341526217362">"Dispositivi accoppiati"</string>
+    <string name="adb_wireless_device_connected_summary" msgid="3039660790249148713">"Attualmente connesso"</string>
+    <string name="adb_wireless_device_details_title" msgid="7129369670526565786">"Dettagli dispositivo"</string>
+    <string name="adb_device_forget" msgid="193072400783068417">"Elimina"</string>
+    <string name="adb_device_fingerprint_title_format" msgid="291504822917843701">"Impronta dispositivo: <xliff:g id="FINGERPRINT_PARAM">%1$s</xliff:g>"</string>
+    <string name="adb_wireless_connection_failed_title" msgid="664211177427438438">"Connessione non riuscita"</string>
+    <string name="adb_wireless_connection_failed_message" msgid="9213896700171602073">"Assicurati che il dispositivo <xliff:g id="DEVICE_NAME">%1$s</xliff:g> sia connesso alla rete corretta"</string>
+    <string name="adb_pairing_device_dialog_title" msgid="7141739231018530210">"Accoppia con dispositivo"</string>
+    <string name="adb_pairing_device_dialog_pairing_code_label" msgid="3639239786669722731">"Codice di accoppiamento Wi-Fi"</string>
+    <string name="adb_pairing_device_dialog_failed_title" msgid="3426758947882091735">"Accoppiamento non riuscito"</string>
+    <string name="adb_pairing_device_dialog_failed_msg" msgid="6611097519661997148">"Assicurati che il dispositivo sia connesso alla stessa rete."</string>
+    <string name="adb_wireless_qrcode_summary" msgid="8051414549011801917">"Accoppia il dispositivo tramite Wi-Fi eseguendo la scansione di un codice QR"</string>
+    <string name="adb_wireless_verifying_qrcode_text" msgid="6123192424916029207">"Accoppiamento dispositivo…"</string>
+    <string name="adb_qrcode_pairing_device_failed_msg" msgid="6936292092592914132">"Impossibile accoppiare il dispositivo. Il codice QR non era corretto oppure il dispositivo non è connesso alla stessa rete."</string>
+    <string name="adb_wireless_ip_addr_preference_title" msgid="8335132107715311730">"Indirizzo IP e porta"</string>
+    <string name="adb_wireless_qrcode_pairing_title" msgid="1906409667944674707">"Scansiona codice QR"</string>
+    <string name="adb_wireless_qrcode_pairing_description" msgid="8578868049289910131">"Accoppia il dispositivo tramite Wi-Fi eseguendo la scansione di un codice QR"</string>
+    <string name="keywords_adb_wireless" msgid="6507505581882171240">"ADB, debug, sviluppatori"</string>
     <string name="bugreport_in_power" msgid="8664089072534638709">"Scorciatoia segnalazione bug"</string>
     <string name="bugreport_in_power_summary" msgid="1885529649381831775">"Mostra un pulsante per segnalare i bug nel menu di accensione"</string>
     <string name="keep_screen_on" msgid="1187161672348797558">"Rimani attivo"</string>
@@ -271,6 +298,8 @@
     <string name="tethering_hardware_offload_summary" msgid="7801345335142803029">"Utilizza l\'accelerazione hardware per il tethering se disponibile"</string>
     <string name="adb_warning_title" msgid="7708653449506485728">"Consentire debug USB?"</string>
     <string name="adb_warning_message" msgid="8145270656419669221">"Il debug USB è solo a scopo di sviluppo. Utilizzalo per copiare dati tra il computer e il dispositivo, per installare applicazioni sul tuo dispositivo senza notifica e per leggere i dati dei log."</string>
+    <string name="adbwifi_warning_title" msgid="727104571653031865">"Consentire debug wireless?"</string>
+    <string name="adbwifi_warning_message" msgid="8005936574322702388">"Il debug wireless è solo a scopo di sviluppo. Utilizzalo per copiare dati tra il computer e il dispositivo, per installare app sul tuo dispositivo senza notifica e per leggere i dati dei log."</string>
     <string name="adb_keys_warning_message" msgid="2968555274488101220">"Revocare l\'accesso al debug USB da tutti i computer precedentemente autorizzati?"</string>
     <string name="dev_settings_warning_title" msgid="8251234890169074553">"Consentire impostazioni di sviluppo?"</string>
     <string name="dev_settings_warning_message" msgid="37741686486073668">"Queste impostazioni sono utilizzabili solo a scopo di sviluppo. Possono causare l\'arresto o il comportamento anomalo del dispositivo e delle applicazioni su di esso."</string>
@@ -383,8 +412,7 @@
     <string name="daltonizer_mode_protanomaly" msgid="7805583306666608440">"Protanomalìa (rosso-verde)"</string>
     <string name="daltonizer_mode_tritanomaly" msgid="7135266249220732267">"Tritanomalìa (blu-giallo)"</string>
     <string name="accessibility_display_daltonizer_preference_title" msgid="1810693571332381974">"Correzione del colore"</string>
-    <!-- no translation found for accessibility_display_daltonizer_preference_subtitle (6178138727195403796) -->
-    <skip />
+    <string name="accessibility_display_daltonizer_preference_subtitle" msgid="6178138727195403796">"La correzione del colore consente alle persone daltoniche di vedere colori più accurati"</string>
     <string name="daltonizer_type_overridden" msgid="4509604753672535721">"Valore sostituito da <xliff:g id="TITLE">%1$s</xliff:g>"</string>
     <string name="power_remaining_settings_home_page" msgid="4885165789445462557">"<xliff:g id="PERCENTAGE">%1$s</xliff:g> - <xliff:g id="TIME_STRING">%2$s</xliff:g>"</string>
     <string name="power_remaining_duration_only" msgid="8264199158671531431">"Tempo rimanente: <xliff:g id="TIME_REMAINING">%1$s</xliff:g> circa"</string>
@@ -403,21 +431,19 @@
     <string name="power_remaining_less_than_duration" msgid="1812668275239801236">"Tempo rimanente: meno di <xliff:g id="THRESHOLD">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_more_than_subtext" msgid="7919119719242734848">"Tempo rimanente: più di <xliff:g id="TIME_REMAINING">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_only_more_than_subtext" msgid="3274496164769110480">"Tempo rimanente: più di <xliff:g id="TIME_REMAINING">%1$s</xliff:g>"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="6583866940347159957">"Il telefono potrebbe spegnersi a breve"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="8009177999719462724">"Il tablet potrebbe spegnersi a breve"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="8320892540455268018">"Il dispositivo potrebbe spegnersi a breve"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="6186572170809116621">"Il telefono potrebbe spegnersi a breve (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="1338758278145563121">"Il tablet potrebbe spegnersi a breve (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="3699579688084774362">"Il dispositivo potrebbe spegnersi a breve (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="137330009791560774">"Il telefono potrebbe spegnersi a breve"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="145489081521468132">"Il tablet potrebbe spegnersi a breve"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="1070562682853942350">"Il dispositivo potrebbe spegnersi a breve"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="4429259621177089719">"Il telefono potrebbe spegnersi a breve (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="7703677921000858479">"Il tablet potrebbe spegnersi a breve (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="4374784375644214578">"Il dispositivo potrebbe spegnersi a breve (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
     <string name="power_charging" msgid="6727132649743436802">"<xliff:g id="LEVEL">%1$s</xliff:g> - <xliff:g id="STATE">%2$s</xliff:g>"</string>
     <string name="power_remaining_charging_duration_only" msgid="7415639699283965818">"Tempo rimanente alla carica completa: <xliff:g id="TIME">%1$s</xliff:g>"</string>
     <string name="power_charging_duration" msgid="5005740040558984057">"<xliff:g id="LEVEL">%1$s</xliff:g> - <xliff:g id="TIME">%2$s</xliff:g> alla carica completa"</string>
     <string name="battery_info_status_unknown" msgid="268625384868401114">"Sconosciuta"</string>
     <string name="battery_info_status_charging" msgid="4279958015430387405">"In carica"</string>
-    <!-- no translation found for battery_info_status_charging_fast (8027559755902954885) -->
-    <skip />
-    <!-- no translation found for battery_info_status_charging_slow (3190803837168962319) -->
-    <skip />
+    <string name="battery_info_status_charging_fast" msgid="8027559755902954885">"Ricarica veloce"</string>
+    <string name="battery_info_status_charging_slow" msgid="3190803837168962319">"Ricarica lenta"</string>
     <string name="battery_info_status_discharging" msgid="6962689305413556485">"Non in carica"</string>
     <string name="battery_info_status_not_charging" msgid="8330015078868707899">"Collegato alla corrente. Impossibile caricare al momento"</string>
     <string name="battery_info_status_full" msgid="4443168946046847468">"Carica"</string>
diff --git a/packages/SettingsLib/res/values-iw/strings.xml b/packages/SettingsLib/res/values-iw/strings.xml
index 1921d03..524a87d 100644
--- a/packages/SettingsLib/res/values-iw/strings.xml
+++ b/packages/SettingsLib/res/values-iw/strings.xml
@@ -206,6 +206,33 @@
     <string name="enable_adb" msgid="8072776357237289039">"‏ניפוי באגים ב-USB"</string>
     <string name="enable_adb_summary" msgid="3711526030096574316">"‏מצב ניפוי באגים כאשר USB מחובר"</string>
     <string name="clear_adb_keys" msgid="3010148733140369917">"‏ביטול הרשאות לניפוי ב-USB"</string>
+    <string name="enable_adb_wireless" msgid="6973226350963971018">"ניפוי באגים אלחוטי"</string>
+    <string name="enable_adb_wireless_summary" msgid="7344391423657093011">"‏מצב ניפוי באגים כשיש חיבור Wi-Fi"</string>
+    <string name="adb_wireless_error" msgid="721958772149779856">"שגיאה"</string>
+    <string name="adb_wireless_settings" msgid="2295017847215680229">"ניפוי באגים אלחוטי"</string>
+    <string name="adb_wireless_list_empty_off" msgid="1713707973837255490">"כדי להציג את המכשירים הזמינים ולהשתמש בהם, יש להפעיל ניפוי באגים אלחוטי"</string>
+    <string name="adb_pair_method_qrcode_title" msgid="6982904096137468634">"‏התאמת מכשיר באמצעות קוד QR"</string>
+    <string name="adb_pair_method_qrcode_summary" msgid="3729901496856458634">"‏התאמת מכשירים חדשים באמצעות סורק של קודי QR"</string>
+    <string name="adb_pair_method_code_title" msgid="1122590300445142904">"התאמת מכשיר באמצעות קוד התאמה"</string>
+    <string name="adb_pair_method_code_summary" msgid="6370414511333685185">"התאמת מכשירים חדשים באמצעות קוד בן שש ספרות"</string>
+    <string name="adb_paired_devices_title" msgid="5268997341526217362">"מכשירים מותאמים"</string>
+    <string name="adb_wireless_device_connected_summary" msgid="3039660790249148713">"מחובר עכשיו"</string>
+    <string name="adb_wireless_device_details_title" msgid="7129369670526565786">"פרטי מכשיר"</string>
+    <string name="adb_device_forget" msgid="193072400783068417">"אפשר לשכוח"</string>
+    <string name="adb_device_fingerprint_title_format" msgid="291504822917843701">"המזהה הייחודי של המכשיר: <xliff:g id="FINGERPRINT_PARAM">%1$s</xliff:g>"</string>
+    <string name="adb_wireless_connection_failed_title" msgid="664211177427438438">"החיבור נכשל"</string>
+    <string name="adb_wireless_connection_failed_message" msgid="9213896700171602073">"עליך לוודא שהמכשיר <xliff:g id="DEVICE_NAME">%1$s</xliff:g> מחובר לרשת הנכונה"</string>
+    <string name="adb_pairing_device_dialog_title" msgid="7141739231018530210">"התאמה למכשיר"</string>
+    <string name="adb_pairing_device_dialog_pairing_code_label" msgid="3639239786669722731">"‏קוד התאמה של Wi-Fi"</string>
+    <string name="adb_pairing_device_dialog_failed_title" msgid="3426758947882091735">"ההתאמה נכשלה"</string>
+    <string name="adb_pairing_device_dialog_failed_msg" msgid="6611097519661997148">"יש לוודא שהמכשיר מחובר לאותה רשת."</string>
+    <string name="adb_wireless_qrcode_summary" msgid="8051414549011801917">"‏יש לסרוק קוד QR כדי להתאים מכשיר באמצעות Wi‑Fi"</string>
+    <string name="adb_wireless_verifying_qrcode_text" msgid="6123192424916029207">"המכשיר בתהליך התאמה…"</string>
+    <string name="adb_qrcode_pairing_device_failed_msg" msgid="6936292092592914132">"‏התאמת המכשיר נכשלה. קוד ה-QR היה שגוי או שהמכשיר לא מחובר לאותה רשת."</string>
+    <string name="adb_wireless_ip_addr_preference_title" msgid="8335132107715311730">"‏יציאה וכתובת IP"</string>
+    <string name="adb_wireless_qrcode_pairing_title" msgid="1906409667944674707">"‏סריקת קוד QR"</string>
+    <string name="adb_wireless_qrcode_pairing_description" msgid="8578868049289910131">"‏יש לסרוק קוד QR כדי להתאים מכשיר באמצעות Wi‑Fi"</string>
+    <string name="keywords_adb_wireless" msgid="6507505581882171240">"‏adb, ניפוי באגים, פיתוח"</string>
     <string name="bugreport_in_power" msgid="8664089072534638709">"קיצור של דוח באגים"</string>
     <string name="bugreport_in_power_summary" msgid="1885529649381831775">"כדי ליצור דוח באגים, הצג לחצן בתפריט לניהול צריכת החשמל"</string>
     <string name="keep_screen_on" msgid="1187161672348797558">"שיישאר פועל"</string>
@@ -271,6 +298,8 @@
     <string name="tethering_hardware_offload_summary" msgid="7801345335142803029">"אם השירות זמין, יש להשתמש בשיפור מהירות באמצעות חומרה לצורך שיתוף אינטרנט בין ניידים"</string>
     <string name="adb_warning_title" msgid="7708653449506485728">"‏לאפשר ניפוי באגים של USB?"</string>
     <string name="adb_warning_message" msgid="8145270656419669221">"‏ניפוי באגים באמצעות USB מיועד למטרות פיתוח בלבד. השתמש בו להעתקת נתונים בין המחשב והמכשיר שלך, להתקנת אפליקציות במכשיר ללא התראה ולקריאת נתוני יומן."</string>
+    <string name="adbwifi_warning_title" msgid="727104571653031865">"האם לאפשר ניפוי באגים אלחוטי?"</string>
+    <string name="adbwifi_warning_message" msgid="8005936574322702388">"ניפוי באגים אלחוטי מיועד למטרות פיתוח בלבד. יש להשתמש בו להעתקת נתונים בין המחשב והמכשיר שלך, להתקנת אפליקציות במכשיר ללא התראה ולקריאת נתוני יומן."</string>
     <string name="adb_keys_warning_message" msgid="2968555274488101220">"‏האם לבטל את הגישה לניפוי ב-USB מכל המחשבים שהענקת להם בעבר הרשאה?"</string>
     <string name="dev_settings_warning_title" msgid="8251234890169074553">"האם להתיר הגדרות פיתוח?"</string>
     <string name="dev_settings_warning_message" msgid="37741686486073668">"הגדרות אלה מיועדות לשימוש בפיתוח בלבד. הן עלולות לגרום למכשיר או לאפליקציות המותקנות בו לקרוס או לפעול באופן לא תקין."</string>
@@ -383,8 +412,7 @@
     <string name="daltonizer_mode_protanomaly" msgid="7805583306666608440">"פרוטנומליה (אדום-ירוק)"</string>
     <string name="daltonizer_mode_tritanomaly" msgid="7135266249220732267">"טריטנומליה (כחול-צהוב)"</string>
     <string name="accessibility_display_daltonizer_preference_title" msgid="1810693571332381974">"תיקון צבע"</string>
-    <!-- no translation found for accessibility_display_daltonizer_preference_subtitle (6178138727195403796) -->
-    <skip />
+    <string name="accessibility_display_daltonizer_preference_subtitle" msgid="6178138727195403796">"תיקון צבע עוזר לאנשים עם עיוורון צבעים לראות צבעים באופן מדויק יותר"</string>
     <string name="daltonizer_type_overridden" msgid="4509604753672535721">"נעקף על ידי <xliff:g id="TITLE">%1$s</xliff:g>"</string>
     <string name="power_remaining_settings_home_page" msgid="4885165789445462557">"<xliff:g id="PERCENTAGE">%1$s</xliff:g> - <xliff:g id="TIME_STRING">%2$s</xliff:g>"</string>
     <string name="power_remaining_duration_only" msgid="8264199158671531431">"הזמן הנותר: בערך <xliff:g id="TIME_REMAINING">%1$s</xliff:g>"</string>
@@ -403,21 +431,19 @@
     <string name="power_remaining_less_than_duration" msgid="1812668275239801236">"נותרו פחות מ-<xliff:g id="THRESHOLD">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_more_than_subtext" msgid="7919119719242734848">"נותרו יותר מ-<xliff:g id="TIME_REMAINING">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_only_more_than_subtext" msgid="3274496164769110480">"הזמן שנותר: יותר מ-<xliff:g id="TIME_REMAINING">%1$s</xliff:g>"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="6583866940347159957">"ייתכן שהטלפון ייכבה בקרוב"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="8009177999719462724">"ייתכן שהטאבלט ייכבה בקרוב"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="8320892540455268018">"ייתכן שהמכשיר ייכבה בקרוב"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="6186572170809116621">"ייתכן שהטלפון ייכבה בקרוב (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="1338758278145563121">"ייתכן שהטאבלט ייכבה בקרוב (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="3699579688084774362">"ייתכן שהמכשיר ייכבה בקרוב (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="137330009791560774">"הטלפון עלול להיכבות בקרוב"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="145489081521468132">"הטאבלט עלול להיכבות בקרוב"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="1070562682853942350">"המכשיר עלול להיכבות בקרוב"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="4429259621177089719">"הטלפון עלול להיכבות בקרוב (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="7703677921000858479">"הטאבלט עלול להיכבות בקרוב (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="4374784375644214578">"המכשיר עלול להיכבות בקרוב (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
     <string name="power_charging" msgid="6727132649743436802">"<xliff:g id="LEVEL">%1$s</xliff:g>‏ - <xliff:g id="STATE">%2$s</xliff:g>"</string>
     <string name="power_remaining_charging_duration_only" msgid="7415639699283965818">"נשארו <xliff:g id="TIME">%1$s</xliff:g> עד הטעינה"</string>
     <string name="power_charging_duration" msgid="5005740040558984057">"<xliff:g id="LEVEL">%1$s</xliff:g> - <xliff:g id="TIME">%2$s</xliff:g> עד הטעינה"</string>
     <string name="battery_info_status_unknown" msgid="268625384868401114">"לא ידוע"</string>
     <string name="battery_info_status_charging" msgid="4279958015430387405">"בטעינה"</string>
-    <!-- no translation found for battery_info_status_charging_fast (8027559755902954885) -->
-    <skip />
-    <!-- no translation found for battery_info_status_charging_slow (3190803837168962319) -->
-    <skip />
+    <string name="battery_info_status_charging_fast" msgid="8027559755902954885">"הסוללה נטענת מהר"</string>
+    <string name="battery_info_status_charging_slow" msgid="3190803837168962319">"הסוללה נטענת לאט"</string>
     <string name="battery_info_status_discharging" msgid="6962689305413556485">"לא בטעינה"</string>
     <string name="battery_info_status_not_charging" msgid="8330015078868707899">"המכשיר מחובר, אבל לא ניתן לטעון עכשיו"</string>
     <string name="battery_info_status_full" msgid="4443168946046847468">"מלאה"</string>
diff --git a/packages/SettingsLib/res/values-ja/strings.xml b/packages/SettingsLib/res/values-ja/strings.xml
index e4e1ab9..acefe20 100644
--- a/packages/SettingsLib/res/values-ja/strings.xml
+++ b/packages/SettingsLib/res/values-ja/strings.xml
@@ -206,6 +206,33 @@
     <string name="enable_adb" msgid="8072776357237289039">"USB デバッグ"</string>
     <string name="enable_adb_summary" msgid="3711526030096574316">"USB接続時はデバッグモードにする"</string>
     <string name="clear_adb_keys" msgid="3010148733140369917">"USBデバッグの許可の取り消し"</string>
+    <string name="enable_adb_wireless" msgid="6973226350963971018">"ワイヤレス デバッグ"</string>
+    <string name="enable_adb_wireless_summary" msgid="7344391423657093011">"Wi-Fi 接続時にデバッグモード"</string>
+    <string name="adb_wireless_error" msgid="721958772149779856">"エラー"</string>
+    <string name="adb_wireless_settings" msgid="2295017847215680229">"ワイヤレス デバッグ"</string>
+    <string name="adb_wireless_list_empty_off" msgid="1713707973837255490">"利用可能なデバイスを確認して使用するには、ワイヤレス デバッグをオンにしてください"</string>
+    <string name="adb_pair_method_qrcode_title" msgid="6982904096137468634">"QR コードによるデバイスのペア設定"</string>
+    <string name="adb_pair_method_qrcode_summary" msgid="3729901496856458634">"QR コードスキャナを使って新しいデバイスをペア設定します"</string>
+    <string name="adb_pair_method_code_title" msgid="1122590300445142904">"ペア設定コードによるデバイスのペア設定"</string>
+    <string name="adb_pair_method_code_summary" msgid="6370414511333685185">"6 桁のコードを使って新しいデバイスをペア設定します"</string>
+    <string name="adb_paired_devices_title" msgid="5268997341526217362">"ペア設定済みのデバイス"</string>
+    <string name="adb_wireless_device_connected_summary" msgid="3039660790249148713">"現在接続"</string>
+    <string name="adb_wireless_device_details_title" msgid="7129369670526565786">"デバイスの詳細"</string>
+    <string name="adb_device_forget" msgid="193072400783068417">"削除"</string>
+    <string name="adb_device_fingerprint_title_format" msgid="291504822917843701">"デバイスのフィンガープリント: <xliff:g id="FINGERPRINT_PARAM">%1$s</xliff:g>"</string>
+    <string name="adb_wireless_connection_failed_title" msgid="664211177427438438">"接続エラー"</string>
+    <string name="adb_wireless_connection_failed_message" msgid="9213896700171602073">"<xliff:g id="DEVICE_NAME">%1$s</xliff:g> が正しいネットワークに接続されていることを確認してください"</string>
+    <string name="adb_pairing_device_dialog_title" msgid="7141739231018530210">"デバイスとのペア設定"</string>
+    <string name="adb_pairing_device_dialog_pairing_code_label" msgid="3639239786669722731">"Wi-Fi ペア設定コード"</string>
+    <string name="adb_pairing_device_dialog_failed_title" msgid="3426758947882091735">"ペア設定エラー"</string>
+    <string name="adb_pairing_device_dialog_failed_msg" msgid="6611097519661997148">"デバイスが同じネットワークに接続されていることを確認してください。"</string>
+    <string name="adb_wireless_qrcode_summary" msgid="8051414549011801917">"QR コードをスキャンして Wi-Fi 経由でデバイスをペア設定します"</string>
+    <string name="adb_wireless_verifying_qrcode_text" msgid="6123192424916029207">"デバイスをペア設定しています…"</string>
+    <string name="adb_qrcode_pairing_device_failed_msg" msgid="6936292092592914132">"デバイスをペア設定できませんでした。QR コードが間違っているか、デバイスが同じネットワークに接続されていません。"</string>
+    <string name="adb_wireless_ip_addr_preference_title" msgid="8335132107715311730">"IP アドレスとポート"</string>
+    <string name="adb_wireless_qrcode_pairing_title" msgid="1906409667944674707">"QR コードのスキャン"</string>
+    <string name="adb_wireless_qrcode_pairing_description" msgid="8578868049289910131">"QR コードをスキャンして Wi-Fi 経由でデバイスをペア設定します"</string>
+    <string name="keywords_adb_wireless" msgid="6507505581882171240">"adb, デバッグ, dev"</string>
     <string name="bugreport_in_power" msgid="8664089072534638709">"バグレポートのショートカット"</string>
     <string name="bugreport_in_power_summary" msgid="1885529649381831775">"電源メニューにバグレポートを取得するボタンを表示する"</string>
     <string name="keep_screen_on" msgid="1187161672348797558">"スリープモードにしない"</string>
@@ -271,6 +298,8 @@
     <string name="tethering_hardware_offload_summary" msgid="7801345335142803029">"テザリング時にハードウェア アクセラレーションを使用します(使用可能な場合)"</string>
     <string name="adb_warning_title" msgid="7708653449506485728">"USBデバッグを許可しますか?"</string>
     <string name="adb_warning_message" msgid="8145270656419669221">"USBデバッグは開発専用に設計されています。パソコンとデバイスの間でデータをコピーする場合や、アプリを通知なしでデバイスにインストールする場合、ログデータを読み取る場合に使用できます。"</string>
+    <string name="adbwifi_warning_title" msgid="727104571653031865">"ワイヤレス デバッグを許可しますか?"</string>
+    <string name="adbwifi_warning_message" msgid="8005936574322702388">"ワイヤレス デバッグは開発専用に設計されています。パソコンとデバイスの間でデータをコピーする場合や、アプリを通知なしでデバイスにインストールする場合、ログデータを読み取る場合に使用できます。"</string>
     <string name="adb_keys_warning_message" msgid="2968555274488101220">"以前に許可したすべてのパソコンからのUSBデバッグへのアクセスを取り消しますか?"</string>
     <string name="dev_settings_warning_title" msgid="8251234890169074553">"開発用の設定を許可しますか?"</string>
     <string name="dev_settings_warning_message" msgid="37741686486073668">"これらの設定は開発専用に設計されています。そのためデバイスやデバイス上のアプリが故障したり正常に動作しなくなったりするおそれがあります。"</string>
@@ -383,8 +412,7 @@
     <string name="daltonizer_mode_protanomaly" msgid="7805583306666608440">"第一色弱(赤緑)"</string>
     <string name="daltonizer_mode_tritanomaly" msgid="7135266249220732267">"第三色弱(青黄)"</string>
     <string name="accessibility_display_daltonizer_preference_title" msgid="1810693571332381974">"色補正"</string>
-    <!-- no translation found for accessibility_display_daltonizer_preference_subtitle (6178138727195403796) -->
-    <skip />
+    <string name="accessibility_display_daltonizer_preference_subtitle" msgid="6178138727195403796">"色補正機能を利用すると、色覚障がいのある方がより正確に色を判別できるようになります"</string>
     <string name="daltonizer_type_overridden" msgid="4509604753672535721">"<xliff:g id="TITLE">%1$s</xliff:g>によって上書き済み"</string>
     <string name="power_remaining_settings_home_page" msgid="4885165789445462557">"<xliff:g id="PERCENTAGE">%1$s</xliff:g> - <xliff:g id="TIME_STRING">%2$s</xliff:g>"</string>
     <string name="power_remaining_duration_only" msgid="8264199158671531431">"残り時間: 約 <xliff:g id="TIME_REMAINING">%1$s</xliff:g>"</string>
@@ -403,21 +431,19 @@
     <string name="power_remaining_less_than_duration" msgid="1812668275239801236">"残り時間: <xliff:g id="THRESHOLD">%1$s</xliff:g>未満(<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_more_than_subtext" msgid="7919119719242734848">"残り時間: <xliff:g id="TIME_REMAINING">%1$s</xliff:g>以上(<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_only_more_than_subtext" msgid="3274496164769110480">"残り時間: <xliff:g id="TIME_REMAINING">%1$s</xliff:g>以上"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="6583866940347159957">"スマートフォンの電源がもうすぐ切れます"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="8009177999719462724">"タブレットの電源がもうすぐ切れます"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="8320892540455268018">"デバイスの電源がもうすぐ切れます"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="6186572170809116621">"スマートフォンの電源がもうすぐ切れます(<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="1338758278145563121">"タブレットの電源がもうすぐ切れます(<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="3699579688084774362">"デバイスの電源がもうすぐ切れます(<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="137330009791560774">"スマートフォンの電源がもうすぐ切れます"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="145489081521468132">"タブレットの電源がもうすぐ切れます"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="1070562682853942350">"デバイスの電源がもうすぐ切れます"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="4429259621177089719">"スマートフォンの電源がもうすぐ切れます(<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="7703677921000858479">"タブレットの電源がもうすぐ切れます(<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="4374784375644214578">"デバイスの電源がもうすぐ切れます(<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
     <string name="power_charging" msgid="6727132649743436802">"<xliff:g id="LEVEL">%1$s</xliff:g> - <xliff:g id="STATE">%2$s</xliff:g>"</string>
     <string name="power_remaining_charging_duration_only" msgid="7415639699283965818">"充電完了まであと <xliff:g id="TIME">%1$s</xliff:g>"</string>
     <string name="power_charging_duration" msgid="5005740040558984057">"<xliff:g id="LEVEL">%1$s</xliff:g> - 充電完了まで <xliff:g id="TIME">%2$s</xliff:g>"</string>
     <string name="battery_info_status_unknown" msgid="268625384868401114">"不明"</string>
     <string name="battery_info_status_charging" msgid="4279958015430387405">"充電中"</string>
-    <!-- no translation found for battery_info_status_charging_fast (8027559755902954885) -->
-    <skip />
-    <!-- no translation found for battery_info_status_charging_slow (3190803837168962319) -->
-    <skip />
+    <string name="battery_info_status_charging_fast" msgid="8027559755902954885">"急速充電中"</string>
+    <string name="battery_info_status_charging_slow" msgid="3190803837168962319">"低速充電中"</string>
     <string name="battery_info_status_discharging" msgid="6962689305413556485">"充電していません"</string>
     <string name="battery_info_status_not_charging" msgid="8330015078868707899">"接続されていますが、現在、充電できません"</string>
     <string name="battery_info_status_full" msgid="4443168946046847468">"フル"</string>
diff --git a/packages/SettingsLib/res/values-ka/strings.xml b/packages/SettingsLib/res/values-ka/strings.xml
index b2cfb17..ddc46ad 100644
--- a/packages/SettingsLib/res/values-ka/strings.xml
+++ b/packages/SettingsLib/res/values-ka/strings.xml
@@ -206,6 +206,33 @@
     <string name="enable_adb" msgid="8072776357237289039">"USB გამართვა"</string>
     <string name="enable_adb_summary" msgid="3711526030096574316">"გამართვის რეჟიმი, როდესაც USB შეერთებულია"</string>
     <string name="clear_adb_keys" msgid="3010148733140369917">"USB საშუალებით გამართვის შესაძლებლობის გამორთვა"</string>
+    <string name="enable_adb_wireless" msgid="6973226350963971018">"შეცდომების უსადენო გამართვა"</string>
+    <string name="enable_adb_wireless_summary" msgid="7344391423657093011">"შეცდომების გამართვის რეჟიმი დაკავშირებული Wi-Fi-ის დროს"</string>
+    <string name="adb_wireless_error" msgid="721958772149779856">"შეცდომა"</string>
+    <string name="adb_wireless_settings" msgid="2295017847215680229">"შეცდომების უსადენო გამართვა"</string>
+    <string name="adb_wireless_list_empty_off" msgid="1713707973837255490">"ხელმისაწვდომი მოწყობილობების სანახავად და გამოსაყენებლად ჩართეთ შეცდომების უსადენო გამართვა"</string>
+    <string name="adb_pair_method_qrcode_title" msgid="6982904096137468634">"ახალი მოწყობილობების დაწყვილება QR კოდით"</string>
+    <string name="adb_pair_method_qrcode_summary" msgid="3729901496856458634">"ახალი მოწყობილობების დაწყვილება QR კოდის სკანერის გამოყენებით"</string>
+    <string name="adb_pair_method_code_title" msgid="1122590300445142904">"მოწყობილობის დაწყვილება დაკავშირების კოდით"</string>
+    <string name="adb_pair_method_code_summary" msgid="6370414511333685185">"ახალი მოწყობილობების დაწყვილება ექვსნიშნა კოდის გამოყენებით"</string>
+    <string name="adb_paired_devices_title" msgid="5268997341526217362">"დაწყვილებული მოწყობილობები"</string>
+    <string name="adb_wireless_device_connected_summary" msgid="3039660790249148713">"ამჟამად დაკავშირებულია"</string>
+    <string name="adb_wireless_device_details_title" msgid="7129369670526565786">"მოწყობილობის დეტალები"</string>
+    <string name="adb_device_forget" msgid="193072400783068417">"დავიწყება"</string>
+    <string name="adb_device_fingerprint_title_format" msgid="291504822917843701">"მოწყობილობის თითის ანაბეჭდი: <xliff:g id="FINGERPRINT_PARAM">%1$s</xliff:g>"</string>
+    <string name="adb_wireless_connection_failed_title" msgid="664211177427438438">"დაკავშირება წარუმატებლად დასრულდა"</string>
+    <string name="adb_wireless_connection_failed_message" msgid="9213896700171602073">"გადაამოწმეთ, რომ <xliff:g id="DEVICE_NAME">%1$s</xliff:g> დაკავშირებულია საჭირო ქსელთან"</string>
+    <string name="adb_pairing_device_dialog_title" msgid="7141739231018530210">"მოწყობილობასთან დაწყვილება"</string>
+    <string name="adb_pairing_device_dialog_pairing_code_label" msgid="3639239786669722731">"Wi‑Fi დაკავშირების კოდი"</string>
+    <string name="adb_pairing_device_dialog_failed_title" msgid="3426758947882091735">"დაწყვილება წარუმატებლად დასრულდა"</string>
+    <string name="adb_pairing_device_dialog_failed_msg" msgid="6611097519661997148">"გადაამოწმეთ, რომ მოწყობილობა დაკავშირებულია იმავე ქსელთან."</string>
+    <string name="adb_wireless_qrcode_summary" msgid="8051414549011801917">"მოწყობილობის დაწყვილება Wi-Fi-ის მეშვეობით QR კოდის სკანირებით"</string>
+    <string name="adb_wireless_verifying_qrcode_text" msgid="6123192424916029207">"მიმდინარეობს მოწყობილობის დაწყვილება…"</string>
+    <string name="adb_qrcode_pairing_device_failed_msg" msgid="6936292092592914132">"მოწყობილობის დაწყვილება ვერ მოხერხდა. QR კოდი არასწორი იყო ან მოწყობილობა იმავე ქსელთან არ არის დაკავშირებული."</string>
+    <string name="adb_wireless_ip_addr_preference_title" msgid="8335132107715311730">"IP მისამართი და პორტი"</string>
+    <string name="adb_wireless_qrcode_pairing_title" msgid="1906409667944674707">"QR კოდის სკანირება"</string>
+    <string name="adb_wireless_qrcode_pairing_description" msgid="8578868049289910131">"მოწყობილობის დაწყვილება Wi-Fi-ის მეშვეობით QR კოდის სკანირებით"</string>
+    <string name="keywords_adb_wireless" msgid="6507505581882171240">"adb, შეცდომების გამართვა, დეველოპერული"</string>
     <string name="bugreport_in_power" msgid="8664089072534638709">"ხარვეზის შეტყობინების მალსახმობი"</string>
     <string name="bugreport_in_power_summary" msgid="1885529649381831775">"ელკვების პარამეტრებში ხარვეზის შეტყობინების ღილაკის ჩვენება"</string>
     <string name="keep_screen_on" msgid="1187161672348797558">"არ დაიძინო"</string>
@@ -271,6 +298,8 @@
     <string name="tethering_hardware_offload_summary" msgid="7801345335142803029">"ტეტერინგის აპარატურული აჩქარების ხელმისაწვდომობის შემთხვევაში გამოყენება"</string>
     <string name="adb_warning_title" msgid="7708653449506485728">"ჩაირთოს USB გამართვა?"</string>
     <string name="adb_warning_message" msgid="8145270656419669221">"USB გამართვა განკუთვნილია მხოლოდ დეველოპერული მიზნებისთვის. გამოიყენეთ კომპიუტერსა და თქვენ მოწყობილობას შორის მონაცემების გადასატანად, თქვენ მოწყობილობაზე აპების შეტყობინების გარეშე დასაყენებლად და ჟურნალის მონაცემების წასაკითხად."</string>
+    <string name="adbwifi_warning_title" msgid="727104571653031865">"დაუშვებთ შეცდომების უსადენო გამართვა?"</string>
+    <string name="adbwifi_warning_message" msgid="8005936574322702388">"შეცდომების უსადენო გამართვა განკუთვნილია მხოლოდ დეველოპერული მიზნებისთვის. გამოიყენეთ ის თქვენს კომპიუტერსა და თქვენს მოწყობილობას შორის მონაცემების დასაკოპირებლად, თქვენს მოწყობილობაზე აპების შეტყობინების გარეშე ინსტალაციისთვის და ჟურნალის მონაცემების წასაკითხად."</string>
     <string name="adb_keys_warning_message" msgid="2968555274488101220">"გავაუქმოთ ყველა იმ კომპიუტერიდან USB გამართვაზე წვდომა, რომლებიდანაც აქამდე განახორციელეთ შესვლა?"</string>
     <string name="dev_settings_warning_title" msgid="8251234890169074553">"გსურთ, დეველოპმენტის პარამეტრების ნების დართვა?"</string>
     <string name="dev_settings_warning_message" msgid="37741686486073668">"ამ პარამეტრების გამოყენება დასაშვებია მხოლოდ დეველოპერული მიზნებით. მათმა გამოყენებამ შეიძლება გამოიწვიოს თქვენი მოწყობილობის და მისი აპლიკაციების დაზიანება ან გაუმართავი მუშაობა."</string>
@@ -383,8 +412,7 @@
     <string name="daltonizer_mode_protanomaly" msgid="7805583306666608440">"პროტოანომალია (წითელი-მწვანე)"</string>
     <string name="daltonizer_mode_tritanomaly" msgid="7135266249220732267">"ტრიტანომალია (ლურჯი-ყვითელი)"</string>
     <string name="accessibility_display_daltonizer_preference_title" msgid="1810693571332381974">"ფერის კორექცია"</string>
-    <!-- no translation found for accessibility_display_daltonizer_preference_subtitle (6178138727195403796) -->
-    <skip />
+    <string name="accessibility_display_daltonizer_preference_subtitle" msgid="6178138727195403796">"ფერის კორექცია ეხმარება ფერითი სიბრმავის მქონე ადამიანებს, უფრო ზუსტად გაარჩიონ ფერები"</string>
     <string name="daltonizer_type_overridden" msgid="4509604753672535721">"უკუგებულია <xliff:g id="TITLE">%1$s</xliff:g>-ის მიერ"</string>
     <string name="power_remaining_settings_home_page" msgid="4885165789445462557">"<xliff:g id="PERCENTAGE">%1$s</xliff:g> - <xliff:g id="TIME_STRING">%2$s</xliff:g>"</string>
     <string name="power_remaining_duration_only" msgid="8264199158671531431">"დარჩა დაახლოებით <xliff:g id="TIME_REMAINING">%1$s</xliff:g>"</string>
@@ -403,21 +431,19 @@
     <string name="power_remaining_less_than_duration" msgid="1812668275239801236">"დარჩენილია <xliff:g id="THRESHOLD">%1$s</xliff:g>-ზე ნაკლები დრო (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_more_than_subtext" msgid="7919119719242734848">"დარჩენილია <xliff:g id="TIME_REMAINING">%1$s</xliff:g>-ზე მეტი დრო (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_only_more_than_subtext" msgid="3274496164769110480">"დარჩენილია <xliff:g id="TIME_REMAINING">%1$s</xliff:g>-ზე მეტი დრო"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="6583866940347159957">"ტელეფონი შეიძლება მალე გაითიშოს"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="8009177999719462724">"ტაბლეტი შეიძლება მალე გაითიშოს"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="8320892540455268018">"მოწყობილობა შეიძლება მალე გაითიშოს"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="6186572170809116621">"ტელეფონი შეიძლება მალე გაითიშოს (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="1338758278145563121">"ტაბლეტი შეიძლება მალე გაითიშოს (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="3699579688084774362">"მოწყობილობა შეიძლება მალე გაითიშოს (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="137330009791560774">"ტელეფონი შეიძლება მალე გათიშოს"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="145489081521468132">"ტაბლეტი შეიძლება მალე გაითიშოს"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="1070562682853942350">"მოწყობილობა შეიძლება მალე გაითიშოს"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="4429259621177089719">"ტელეფონი შეიძლება მალე გაითიშოს (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="7703677921000858479">"ტაბლეტი შეიძლება მალე გაითიშოს (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="4374784375644214578">"მოწყობილობა შეიძლება მალე გაითიშოს (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
     <string name="power_charging" msgid="6727132649743436802">"<xliff:g id="LEVEL">%1$s</xliff:g> - <xliff:g id="STATE">%2$s</xliff:g>"</string>
     <string name="power_remaining_charging_duration_only" msgid="7415639699283965818">"დატენვამდე დარჩა <xliff:g id="TIME">%1$s</xliff:g>"</string>
     <string name="power_charging_duration" msgid="5005740040558984057">"<xliff:g id="LEVEL">%1$s</xliff:g> - <xliff:g id="TIME">%2$s</xliff:g> დატენვამდე"</string>
     <string name="battery_info_status_unknown" msgid="268625384868401114">"უცნობი"</string>
     <string name="battery_info_status_charging" msgid="4279958015430387405">"იტენება"</string>
-    <!-- no translation found for battery_info_status_charging_fast (8027559755902954885) -->
-    <skip />
-    <!-- no translation found for battery_info_status_charging_slow (3190803837168962319) -->
-    <skip />
+    <string name="battery_info_status_charging_fast" msgid="8027559755902954885">"სწრაფად იტენება"</string>
+    <string name="battery_info_status_charging_slow" msgid="3190803837168962319">"ნელა იტენება"</string>
     <string name="battery_info_status_discharging" msgid="6962689305413556485">"არ იტენება"</string>
     <string name="battery_info_status_not_charging" msgid="8330015078868707899">"მიერთებულია, დატენვა ამჟამად ვერ ხერხდება"</string>
     <string name="battery_info_status_full" msgid="4443168946046847468">"ბატარეა დატენილია"</string>
diff --git a/packages/SettingsLib/res/values-kk/strings.xml b/packages/SettingsLib/res/values-kk/strings.xml
index 756bc06..47babb1 100644
--- a/packages/SettingsLib/res/values-kk/strings.xml
+++ b/packages/SettingsLib/res/values-kk/strings.xml
@@ -206,6 +206,33 @@
     <string name="enable_adb" msgid="8072776357237289039">"USB жөндеу"</string>
     <string name="enable_adb_summary" msgid="3711526030096574316">"USB жалғанғандағы жөндеу режимі"</string>
     <string name="clear_adb_keys" msgid="3010148733140369917">"USB жөндеу рұқсаттарынан бас тарту"</string>
+    <string name="enable_adb_wireless" msgid="6973226350963971018">"Сымсыз желі арқылы түзету"</string>
+    <string name="enable_adb_wireless_summary" msgid="7344391423657093011">"Wi‑Fi желісіне жалғанған кездегі түзету режимі"</string>
+    <string name="adb_wireless_error" msgid="721958772149779856">"Қате"</string>
+    <string name="adb_wireless_settings" msgid="2295017847215680229">"Сымсыз желі арқылы түзету"</string>
+    <string name="adb_wireless_list_empty_off" msgid="1713707973837255490">"Қолжетімді құрылғыларды көру және пайдалану үшін сымсыз желі арқылы түзетуді іске қосыңыз."</string>
+    <string name="adb_pair_method_qrcode_title" msgid="6982904096137468634">"Құрылғыны QR коды арқылы жұптау"</string>
+    <string name="adb_pair_method_qrcode_summary" msgid="3729901496856458634">"Жаңа құрылғыларды QR коды сканері арқылы жұптау"</string>
+    <string name="adb_pair_method_code_title" msgid="1122590300445142904">"Құрылғыны кодпен жұптау"</string>
+    <string name="adb_pair_method_code_summary" msgid="6370414511333685185">"Жаңа құрылғыларды алты цифрлық код арқылы жұптау"</string>
+    <string name="adb_paired_devices_title" msgid="5268997341526217362">"Жұпталған құрылғылар"</string>
+    <string name="adb_wireless_device_connected_summary" msgid="3039660790249148713">"Қазір жалғанып тұрғандар"</string>
+    <string name="adb_wireless_device_details_title" msgid="7129369670526565786">"Құрылғы мәліметтері"</string>
+    <string name="adb_device_forget" msgid="193072400783068417">"Ұмыту"</string>
+    <string name="adb_device_fingerprint_title_format" msgid="291504822917843701">"Құрылғыдағы саусақ ізі: <xliff:g id="FINGERPRINT_PARAM">%1$s</xliff:g>"</string>
+    <string name="adb_wireless_connection_failed_title" msgid="664211177427438438">"Байланыс орнамады"</string>
+    <string name="adb_wireless_connection_failed_message" msgid="9213896700171602073">"<xliff:g id="DEVICE_NAME">%1$s</xliff:g> құрылғысының дұрыс желіге жалғанғанын тексеріңіз."</string>
+    <string name="adb_pairing_device_dialog_title" msgid="7141739231018530210">"Құрылғымен жұптау"</string>
+    <string name="adb_pairing_device_dialog_pairing_code_label" msgid="3639239786669722731">"Wi‑Fi жұптау коды"</string>
+    <string name="adb_pairing_device_dialog_failed_title" msgid="3426758947882091735">"Жұпталмады"</string>
+    <string name="adb_pairing_device_dialog_failed_msg" msgid="6611097519661997148">"Құрылғының бір желіге жалғанғанын тексеріңіз."</string>
+    <string name="adb_wireless_qrcode_summary" msgid="8051414549011801917">"QR кодын сканерлеп, құрылғыны Wi‑Fi арқылы жұптау"</string>
+    <string name="adb_wireless_verifying_qrcode_text" msgid="6123192424916029207">"Құрылғы жұпталуда…"</string>
+    <string name="adb_qrcode_pairing_device_failed_msg" msgid="6936292092592914132">"Құрылғы жұпталмады. QR коды дұрыс емес немесе құрылғы бір желіге жалғанбаған."</string>
+    <string name="adb_wireless_ip_addr_preference_title" msgid="8335132107715311730">"IP мекенжайы және порт"</string>
+    <string name="adb_wireless_qrcode_pairing_title" msgid="1906409667944674707">"QR кодын сканерлеу"</string>
+    <string name="adb_wireless_qrcode_pairing_description" msgid="8578868049289910131">"QR кодын сканерлеп, құрылғыны Wi‑Fi арқылы жұптау"</string>
+    <string name="keywords_adb_wireless" msgid="6507505581882171240">"adb, түзету, әзірлеуші"</string>
     <string name="bugreport_in_power" msgid="8664089072534638709">"Қате туралы хабарлау"</string>
     <string name="bugreport_in_power_summary" msgid="1885529649381831775">"Қуат мәзірінде қате туралы хабарлауға арналған түймені көрсету"</string>
     <string name="keep_screen_on" msgid="1187161672348797558">"Ояу тұру"</string>
@@ -271,6 +298,8 @@
     <string name="tethering_hardware_offload_summary" msgid="7801345335142803029">"Тетеринг режиміндегі аппараттық жеделдетуді пайдалану (қолжетімді болса)"</string>
     <string name="adb_warning_title" msgid="7708653449506485728">"USB жөндеулеріне рұқсат берілсін бе?"</string>
     <string name="adb_warning_message" msgid="8145270656419669221">"USB жөндеу дамыту мақсаттарына ғана арналған. Оны компьютер және құрылғы арасында дерек көшіру, құрылғыға ескертусіз қолданба орнату және тіркелім деректерін оқу үшін қолданыңыз."</string>
+    <string name="adbwifi_warning_title" msgid="727104571653031865">"Сымсыз желі арқылы түзетуге рұқсат берілсін бе?"</string>
+    <string name="adbwifi_warning_message" msgid="8005936574322702388">"Сымсыз желі арқылы түзету функциясы дамыту мақсаттарына ғана арналған. Оны компьютер және құрылғы арасында дерек көшіру, құрылғыға ескертусіз қолданба орнату және журнал деректерін оқу үшін қолданыңыз."</string>
     <string name="adb_keys_warning_message" msgid="2968555274488101220">"Бұған дейін рұқсат берілген барлық компьютерлерде USB жөндеу функциясына тыйым салынсын ба?"</string>
     <string name="dev_settings_warning_title" msgid="8251234890169074553">"Жетілдіру параметрлеріне рұқсат берілсін бе?"</string>
     <string name="dev_settings_warning_message" msgid="37741686486073668">"Бұл параметрлер жетілдіру мақсатында ғана қолданылады. Олар құрылғыңыз бен қолданбаларыңыздың бұзылуына немесе әдеттен тыс әрекеттерге себеп болуы мүмкін."</string>
@@ -383,8 +412,7 @@
     <string name="daltonizer_mode_protanomaly" msgid="7805583306666608440">"Протаномалия (қызыл-жасыл)"</string>
     <string name="daltonizer_mode_tritanomaly" msgid="7135266249220732267">"Тританомалия (көк-сары)"</string>
     <string name="accessibility_display_daltonizer_preference_title" msgid="1810693571332381974">"Түсті түзету"</string>
-    <!-- no translation found for accessibility_display_daltonizer_preference_subtitle (6178138727195403796) -->
-    <skip />
+    <string name="accessibility_display_daltonizer_preference_subtitle" msgid="6178138727195403796">"Түсті түзету функциясы түстерді ажырата алмайтын адамдарға оларды дәлірек көруге көмектеседі"</string>
     <string name="daltonizer_type_overridden" msgid="4509604753672535721">"<xliff:g id="TITLE">%1$s</xliff:g> үстінен басқан"</string>
     <string name="power_remaining_settings_home_page" msgid="4885165789445462557">"<xliff:g id="PERCENTAGE">%1$s</xliff:g> – <xliff:g id="TIME_STRING">%2$s</xliff:g>"</string>
     <string name="power_remaining_duration_only" msgid="8264199158671531431">"Шамамен <xliff:g id="TIME_REMAINING">%1$s</xliff:g> қалды"</string>
@@ -403,21 +431,19 @@
     <string name="power_remaining_less_than_duration" msgid="1812668275239801236">"<xliff:g id="THRESHOLD">%1$s</xliff:g> шамасынан аз қалды (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_more_than_subtext" msgid="7919119719242734848">"<xliff:g id="TIME_REMAINING">%1$s</xliff:g> шамасынан көп уақыт қалды (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_only_more_than_subtext" msgid="3274496164769110480">"<xliff:g id="TIME_REMAINING">%1$s</xliff:g> шамасынан көп уақыт қалды"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="6583866940347159957">"Телефон көп ұзамай өшуі мүмкін"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="8009177999719462724">"Планшет көп ұзамай өшуі мүмкін"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="8320892540455268018">"Құрылғы көп ұзамай өшуі мүмкін"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="6186572170809116621">"Телефон көп ұзамай өшуі мүмкін (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="1338758278145563121">"Планшет көп ұзамай өшуі мүмкін (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="3699579688084774362">"Құрылғы көп ұзамай өшуі мүмкін (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="137330009791560774">"Телефон көп ұзамай өшуі мүмкін"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="145489081521468132">"Планшет көп ұзамай өшуі мүмкін"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="1070562682853942350">"Құрылғы көп ұзамай өшуі мүмкін"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="4429259621177089719">"Телефон көп ұзамай өшуі мүмкін (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="7703677921000858479">"Планшет көп ұзамай өшуі мүмкін (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="4374784375644214578">"Құрылғы көп ұзамай өшуі мүмкін (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
     <string name="power_charging" msgid="6727132649743436802">"<xliff:g id="LEVEL">%1$s</xliff:g> - <xliff:g id="STATE">%2$s</xliff:g>"</string>
     <string name="power_remaining_charging_duration_only" msgid="7415639699283965818">"Зарядталғанға дейін <xliff:g id="TIME">%1$s</xliff:g> қалды"</string>
     <string name="power_charging_duration" msgid="5005740040558984057">"<xliff:g id="LEVEL">%1$s</xliff:g> – зарядталғанға дейін <xliff:g id="TIME">%2$s</xliff:g>"</string>
     <string name="battery_info_status_unknown" msgid="268625384868401114">"Белгісіз"</string>
     <string name="battery_info_status_charging" msgid="4279958015430387405">"Зарядталуда"</string>
-    <!-- no translation found for battery_info_status_charging_fast (8027559755902954885) -->
-    <skip />
-    <!-- no translation found for battery_info_status_charging_slow (3190803837168962319) -->
-    <skip />
+    <string name="battery_info_status_charging_fast" msgid="8027559755902954885">"Жылдам зарядталуда"</string>
+    <string name="battery_info_status_charging_slow" msgid="3190803837168962319">"Баяу зарядталуда"</string>
     <string name="battery_info_status_discharging" msgid="6962689305413556485">"Зарядталу орындалып жатқан жоқ"</string>
     <string name="battery_info_status_not_charging" msgid="8330015078868707899">"Қосылған, зарядталмайды"</string>
     <string name="battery_info_status_full" msgid="4443168946046847468">"Толы"</string>
diff --git a/packages/SettingsLib/res/values-km/strings.xml b/packages/SettingsLib/res/values-km/strings.xml
index cdf92b3..f62408d 100644
--- a/packages/SettingsLib/res/values-km/strings.xml
+++ b/packages/SettingsLib/res/values-km/strings.xml
@@ -206,6 +206,33 @@
     <string name="enable_adb" msgid="8072776357237289039">"ការ​កែ​កំហុស​តាម USB"</string>
     <string name="enable_adb_summary" msgid="3711526030096574316">"មុខងារកែ​កំហុសពេល​ភ្ជាប់​ USB"</string>
     <string name="clear_adb_keys" msgid="3010148733140369917">"ដក​សិទ្ធិ​កែ​កំហុសតាម USB"</string>
+    <string name="enable_adb_wireless" msgid="6973226350963971018">"ការជួសជុល​ដោយឥតខ្សែ"</string>
+    <string name="enable_adb_wireless_summary" msgid="7344391423657093011">"មុខងារ​ជួសជុល នៅពេល​ភ្ជាប់ Wi‑Fi"</string>
+    <string name="adb_wireless_error" msgid="721958772149779856">"បញ្ហា"</string>
+    <string name="adb_wireless_settings" msgid="2295017847215680229">"ការជួសជុល​ដោយឥតខ្សែ"</string>
+    <string name="adb_wireless_list_empty_off" msgid="1713707973837255490">"ដើម្បី​មើលឃើញ និងប្រើ​ឧបករណ៍​ដែលមាន សូមបើក​ការជួសជុល​ដោយឥតខ្សែ"</string>
+    <string name="adb_pair_method_qrcode_title" msgid="6982904096137468634">"ផ្គូផ្គង​ឧបករណ៍​ដោយប្រើ​កូដ QR"</string>
+    <string name="adb_pair_method_qrcode_summary" msgid="3729901496856458634">"ផ្គូផ្គង​ឧបករណ៍​ថ្មី​ដោយប្រើ​កម្មវិធីស្កេន​កូដ QR"</string>
+    <string name="adb_pair_method_code_title" msgid="1122590300445142904">"ផ្គូផ្គង​ឧបករណ៍​ដោយប្រើ​កូដផ្គូផ្គង"</string>
+    <string name="adb_pair_method_code_summary" msgid="6370414511333685185">"ផ្គូផ្គង​ឧបករណ៍​ថ្មី​ដោយប្រើ​កូដ​ប្រាំមួយ​ខ្ទង់"</string>
+    <string name="adb_paired_devices_title" msgid="5268997341526217362">"ឧបករណ៍​ដែល​បាន​ផ្គូផ្គង"</string>
+    <string name="adb_wireless_device_connected_summary" msgid="3039660790249148713">"កំពុងភ្ជាប់​បច្ចុប្បន្ននេះ"</string>
+    <string name="adb_wireless_device_details_title" msgid="7129369670526565786">"ព័ត៌មានលម្អិត​អំពី​ឧបករណ៍"</string>
+    <string name="adb_device_forget" msgid="193072400783068417">"បំភ្លេច"</string>
+    <string name="adb_device_fingerprint_title_format" msgid="291504822917843701">"ស្នាមម្រាមដៃ​ឧបករណ៍៖ <xliff:g id="FINGERPRINT_PARAM">%1$s</xliff:g>"</string>
+    <string name="adb_wireless_connection_failed_title" msgid="664211177427438438">"ការតភ្ជាប់​មិន​ជោគជ័យ​ទេ"</string>
+    <string name="adb_wireless_connection_failed_message" msgid="9213896700171602073">"សូមប្រាកដថា​បានភ្ជាប់ <xliff:g id="DEVICE_NAME">%1$s</xliff:g> ទៅ​បណ្ដាញ​ដែលត្រឹមត្រូវ"</string>
+    <string name="adb_pairing_device_dialog_title" msgid="7141739231018530210">"ផ្គូផ្គង​ជាមួយ​ឧបករណ៍"</string>
+    <string name="adb_pairing_device_dialog_pairing_code_label" msgid="3639239786669722731">"កូដ​ផ្គូផ្គង Wi‑Fi"</string>
+    <string name="adb_pairing_device_dialog_failed_title" msgid="3426758947882091735">"ការផ្គូផ្គង​មិន​ជោគជ័យ​ទេ"</string>
+    <string name="adb_pairing_device_dialog_failed_msg" msgid="6611097519661997148">"សូម​ប្រាកដថា​បានភ្ជាប់​ឧបករណ៍​ទៅ​បណ្ដាញ​ដូចគ្នា។"</string>
+    <string name="adb_wireless_qrcode_summary" msgid="8051414549011801917">"ផ្គូផ្គង​ឧបករណ៍​តាមរយៈ Wi‑Fi ដោយស្កេន​កូដ QR"</string>
+    <string name="adb_wireless_verifying_qrcode_text" msgid="6123192424916029207">"កំពុងផ្គូផ្គង​ឧបករណ៍…"</string>
+    <string name="adb_qrcode_pairing_device_failed_msg" msgid="6936292092592914132">"មិនអាច​ផ្គូផ្គង​ឧបករណ៍​បានទេ។ កូដ QR មិនត្រឹមត្រូវ ឬមិនបានភ្ជាប់​ឧបករណ៍​ទៅ​បណ្ដាញ​ដូចគ្នា។"</string>
+    <string name="adb_wireless_ip_addr_preference_title" msgid="8335132107715311730">"អាសយដ្ឋាន IP និងច្រក"</string>
+    <string name="adb_wireless_qrcode_pairing_title" msgid="1906409667944674707">"ស្កេន​កូដ QR"</string>
+    <string name="adb_wireless_qrcode_pairing_description" msgid="8578868049289910131">"ផ្គូផ្គង​ឧបករណ៍​តាមរយៈ Wi‑Fi ដោយស្កេន​កូដ QR"</string>
+    <string name="keywords_adb_wireless" msgid="6507505581882171240">"adb, ជួសជុល, dev"</string>
     <string name="bugreport_in_power" msgid="8664089072534638709">"ផ្លូវកាត់រាយការណ៍​កំហុស"</string>
     <string name="bugreport_in_power_summary" msgid="1885529649381831775">"បង្ហាញ​​ប៊ូតុង​ក្នុង​ម៉ឺនុយ​ប៊ូតុង​ថាមពល​​​សម្រាប់​ការ​ទទួល​យក​របាយការណ៍​កំហុស"</string>
     <string name="keep_screen_on" msgid="1187161672348797558">"ទុកឲ្យបើកចោល"</string>
@@ -271,6 +298,8 @@
     <string name="tethering_hardware_offload_summary" msgid="7801345335142803029">"ប្រើការ​បង្កើនល្បឿន​ផ្នែករឹងសម្រាប់​ការភ្ជាប់​ ប្រសិន​បើអាច​ប្រើបាន"</string>
     <string name="adb_warning_title" msgid="7708653449506485728">"អនុញ្ញាត​ការ​កែ​កំហុស​តាម USB ឬ?"</string>
     <string name="adb_warning_message" msgid="8145270656419669221">"ការ​កែ​កំហុស​​យូអេសប៊ី​គឺ​សម្រាប់​តែ​ការ​អភិវឌ្ឍ​ប៉ុណ្ណោះ។ ប្រើ​វា​ដើម្បី​ចម្លង​ទិន្នន័យ​រវាង​កុំព្យូទ័រ និង​ឧបករណ៍​របស់​អ្នក ដំឡើង​កម្មវិធី​ក្នុង​ឧបករណ៍​របស់​អ្នក​ដោយ​មិន​ជូន​ដំណឹង និង​អាន​ទិន្នន័យ​កំណត់ហេតុ។"</string>
+    <string name="adbwifi_warning_title" msgid="727104571653031865">"អនុញ្ញាត​ការជួសជុល​ដោយឥតខ្សែ​ឬ?"</string>
+    <string name="adbwifi_warning_message" msgid="8005936574322702388">"ការជួសជុល​ដោយឥតខ្សែ​គឺសម្រាប់​តែ​ការ​អភិវឌ្ឍ​ប៉ុណ្ណោះ។ ប្រើ​ការជួសជុល​ដោយឥតខ្សែ ដើម្បី​ចម្លង​ទិន្នន័យ​រវាង​កុំព្យូទ័រ និង​ឧបករណ៍​របស់អ្នក ដំឡើង​កម្មវិធី​នៅលើ​ឧបករណ៍​របស់អ្នក​ដោយ​គ្មានការ​ជូន​ដំណឹង និង​អាន​ទិន្នន័យ​កំណត់ហេតុ។"</string>
     <string name="adb_keys_warning_message" msgid="2968555274488101220">"ដក​សិទ្ធិ​ចូល​ការ​កែ​កំហុស​តាម​យូអេសប៊ី​ពី​គ្រប់​កុំព្យូទ័រ​ដែល​អ្នក​បាន​ផ្ដល់​សិទ្ធិ​ពី​មុន?"</string>
     <string name="dev_settings_warning_title" msgid="8251234890169074553">"អនុញ្ញាត​កំណត់​ការ​អភិវឌ្ឍ?"</string>
     <string name="dev_settings_warning_message" msgid="37741686486073668">"ការ​កំណត់​ទាំង​នេះ​សម្រាប់​តែ​ការ​ប្រើ​ក្នុង​ការ​អភិវឌ្ឍ​ប៉ុណ្ណោះ។ ពួក​វា​អាច​ធ្វើ​ឲ្យ​ឧបករណ៍ និង​កម្មវិធី​របស់​អ្នក​ខូច ឬ​ដំណើរ​មិន​ត្រឹមត្រូវ។"</string>
@@ -383,8 +412,7 @@
     <string name="daltonizer_mode_protanomaly" msgid="7805583306666608440">"Protanomaly (ក្រហម​ពណ៌​បៃតង​)"</string>
     <string name="daltonizer_mode_tritanomaly" msgid="7135266249220732267">"Tritanomaly (ពណ៌​ខៀវ​-លឿង​)"</string>
     <string name="accessibility_display_daltonizer_preference_title" msgid="1810693571332381974">"ការ​កែ​ពណ៌"</string>
-    <!-- no translation found for accessibility_display_daltonizer_preference_subtitle (6178138727195403796) -->
-    <skip />
+    <string name="accessibility_display_daltonizer_preference_subtitle" msgid="6178138727195403796">"ការកែតម្រូវ​ពណ៌​ជួយដល់​អ្នកដែល​មិនអាច​បែងចែក​ពណ៌​ឱ្យមើលឃើញ​ពណ៌ដែលត្រឹមត្រូវ​ជាងមុន"</string>
     <string name="daltonizer_type_overridden" msgid="4509604753672535721">"បដិសេធ​ដោយ <xliff:g id="TITLE">%1$s</xliff:g>"</string>
     <string name="power_remaining_settings_home_page" msgid="4885165789445462557">"<xliff:g id="PERCENTAGE">%1$s</xliff:g> - <xliff:g id="TIME_STRING">%2$s</xliff:g>"</string>
     <string name="power_remaining_duration_only" msgid="8264199158671531431">"នៅសល់​ប្រហែល <xliff:g id="TIME_REMAINING">%1$s</xliff:g> ទៀត"</string>
@@ -403,21 +431,19 @@
     <string name="power_remaining_less_than_duration" msgid="1812668275239801236">"នៅសល់​តិចជាង <xliff:g id="THRESHOLD">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_more_than_subtext" msgid="7919119719242734848">"នៅសល់​ច្រើនជាង <xliff:g id="TIME_REMAINING">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_only_more_than_subtext" msgid="3274496164769110480">"នៅ​សល់​ច្រើន​ជាង <xliff:g id="TIME_REMAINING">%1$s</xliff:g>"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="6583866940347159957">"ទូរសព្ទ​អាចនឹង​បិទក្នុង​ពេលបន្តិច​ទៀត"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="8009177999719462724">"ថេប្លេត​អាចនឹង​បិទក្នុង​ពេលបន្តិច​ទៀត"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="8320892540455268018">"ឧបករណ៍​អាចនឹង​បិទក្នុង​ពេលបន្តិច​ទៀត"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="6186572170809116621">"ទូរសព្ទ​អាចនឹង​បិទក្នុង​ពេលបន្តិច​ទៀត (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="1338758278145563121">"ថេប្លេត​អាចនឹង​បិទក្នុង​ពេលបន្តិច​ទៀត (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="3699579688084774362">"ឧបករណ៍​អាចនឹង​បិទក្នុង​ពេលបន្តិច​ទៀត (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="137330009791560774">"ទូរសព្ទ​អាច​នឹង​បិទ​ក្នុង​ពេល​បន្តិច​ទៀត"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="145489081521468132">"ថេប្លេត​អាចនឹង​បិទក្នុង​ពេលបន្តិច​ទៀត"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="1070562682853942350">"ឧបករណ៍​អាចនឹង​បិទក្នុង​ពេលបន្តិច​ទៀត"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="4429259621177089719">"ទូរសព្ទ​អាចនឹង​បិទក្នុង​ពេលបន្តិច​ទៀត (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="7703677921000858479">"ថេប្លេត​អាចនឹង​បិទក្នុង​ពេលបន្តិច​ទៀត (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="4374784375644214578">"ឧបករណ៍​អាចនឹង​បិទក្នុង​ពេលបន្តិច​ទៀត (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
     <string name="power_charging" msgid="6727132649743436802">"<xliff:g id="LEVEL">%1$s</xliff:g> - <xliff:g id="STATE">%2$s</xliff:g>"</string>
     <string name="power_remaining_charging_duration_only" msgid="7415639699283965818">"<xliff:g id="TIME">%1$s</xliff:g> ទៀតទើប​ត្រូវសាក"</string>
     <string name="power_charging_duration" msgid="5005740040558984057">"<xliff:g id="LEVEL">%1$s</xliff:g> - <xliff:g id="TIME">%2$s</xliff:g> ទៀតទើប​ត្រូវសាក"</string>
     <string name="battery_info_status_unknown" msgid="268625384868401114">"មិន​ស្គាល់"</string>
     <string name="battery_info_status_charging" msgid="4279958015430387405">"កំពុងបញ្ចូល​ថ្ម"</string>
-    <!-- no translation found for battery_info_status_charging_fast (8027559755902954885) -->
-    <skip />
-    <!-- no translation found for battery_info_status_charging_slow (3190803837168962319) -->
-    <skip />
+    <string name="battery_info_status_charging_fast" msgid="8027559755902954885">"កំពុងសាកថ្មយ៉ាងឆាប់រហ័ស"</string>
+    <string name="battery_info_status_charging_slow" msgid="3190803837168962319">"កំពុង​សាកថ្មយឺត"</string>
     <string name="battery_info_status_discharging" msgid="6962689305413556485">"មិនកំពុង​បញ្ចូល​ថ្ម"</string>
     <string name="battery_info_status_not_charging" msgid="8330015078868707899">"ដោត​សាកថ្ម​រួចហើយ ប៉ុន្តែ​​សាកថ្ម​មិន​ចូលទេឥឡូវនេះ"</string>
     <string name="battery_info_status_full" msgid="4443168946046847468">"ពេញ"</string>
diff --git a/packages/SettingsLib/res/values-kn/strings.xml b/packages/SettingsLib/res/values-kn/strings.xml
index 4a24691..39d6069 100644
--- a/packages/SettingsLib/res/values-kn/strings.xml
+++ b/packages/SettingsLib/res/values-kn/strings.xml
@@ -206,6 +206,33 @@
     <string name="enable_adb" msgid="8072776357237289039">"USB ಡೀಬಗ್ ಮಾಡುವಿಕೆ"</string>
     <string name="enable_adb_summary" msgid="3711526030096574316">"USB ಸಂಪರ್ಕಗೊಂಡಾಗ ಡೀಬಗ್ ಮೋಡ್"</string>
     <string name="clear_adb_keys" msgid="3010148733140369917">"USB ಡೀಬಗ್‌ ಮಾಡುವಿಕೆಯ ಅಧಿಕೃತಗೊಳಿಸುವಿಕೆಗಳನ್ನು ಹಿಂತೆಗೆದುಕೊಳ್ಳಿ"</string>
+    <string name="enable_adb_wireless" msgid="6973226350963971018">"ವೈರ್‌ಲೆಸ್ ಡೀಬಗ್ ಮಾಡುವಿಕೆ"</string>
+    <string name="enable_adb_wireless_summary" msgid="7344391423657093011">"ವೈ-ಫೈ ಕನೆಕ್ಟ್ ಆದಾಗ ಡೀಬಗ್ ಮೋಡ್"</string>
+    <string name="adb_wireless_error" msgid="721958772149779856">"ದೋಷ"</string>
+    <string name="adb_wireless_settings" msgid="2295017847215680229">"ವೈರ್‌ಲೆಸ್ ಡೀಬಗ್ ಮಾಡುವಿಕೆ"</string>
+    <string name="adb_wireless_list_empty_off" msgid="1713707973837255490">"ಲಭ್ಯವಿರುವ ಸಾಧನಗಳನ್ನು ನೋಡಲು ಮತ್ತು ಬಳಸಲು, ವೈರ್‌ಲೆಸ್ ಡೀಬಗ್ ಮಾಡುವಿಕೆಯನ್ನು ಆನ್ ಮಾಡಿ"</string>
+    <string name="adb_pair_method_qrcode_title" msgid="6982904096137468634">"QR ಕೋಡ್ ಬಳಸಿ ಸಾಧನವನ್ನು ಜೋಡಿಸಿ"</string>
+    <string name="adb_pair_method_qrcode_summary" msgid="3729901496856458634">"QR ಕೋಡ್ ಸ್ಕ್ಯಾನರ್ ಬಳಸಿ ಹೊಸ ಸಾಧನಗಳನ್ನು ಜೋಡಿಸಿ"</string>
+    <string name="adb_pair_method_code_title" msgid="1122590300445142904">"ಜೋಡಿಸುವ ಕೋಡ್ ಬಳಸಿ ಸಾಧನವನ್ನು ಜೋಡಿಸಿ"</string>
+    <string name="adb_pair_method_code_summary" msgid="6370414511333685185">"ಆರು ಅಂಕಿಯ ಕೋಡ್ ಬಳಸಿ ಹೊಸ ಸಾಧನಗಳನ್ನು ಜೋಡಿಸಿ"</string>
+    <string name="adb_paired_devices_title" msgid="5268997341526217362">"ಜೋಡಿಸಲಾದ ಸಾಧನಗಳು"</string>
+    <string name="adb_wireless_device_connected_summary" msgid="3039660790249148713">"ಪ್ರಸ್ತುತ ಕನೆಕ್ಟ್ ಮಾಡಲಾಗಿದೆ"</string>
+    <string name="adb_wireless_device_details_title" msgid="7129369670526565786">"ಸಾಧನದ ವಿವರಗಳು"</string>
+    <string name="adb_device_forget" msgid="193072400783068417">"ಮರೆತುಬಿಡಿ"</string>
+    <string name="adb_device_fingerprint_title_format" msgid="291504822917843701">"ಸಾಧನದ ಫಿಂಗರ್‌ ಪ್ರಿಂಟ್: <xliff:g id="FINGERPRINT_PARAM">%1$s</xliff:g>"</string>
+    <string name="adb_wireless_connection_failed_title" msgid="664211177427438438">"ಕನೆಕ್ಷನ್ ವಿಫಲವಾಗಿದೆ"</string>
+    <string name="adb_wireless_connection_failed_message" msgid="9213896700171602073">"<xliff:g id="DEVICE_NAME">%1$s</xliff:g> ಸಾಧನವು ಸರಿಯಾದ ನೆಟ್‌ವರ್ಕ್‌ಗೆ ಕನೆಕ್ಟ್ ಆಗಿದೆಯೇ ಎಂದು ಖಚಿತಪಡಿಸಿಕೊಳ್ಳಿ"</string>
+    <string name="adb_pairing_device_dialog_title" msgid="7141739231018530210">"ಸಾಧನದ ಜೊತೆಗೆ ಜೋಡಿಸಿ"</string>
+    <string name="adb_pairing_device_dialog_pairing_code_label" msgid="3639239786669722731">"ವೈ-ಫೈ ಜೋಡಿಸುವಿಕೆ ಕೋಡ್"</string>
+    <string name="adb_pairing_device_dialog_failed_title" msgid="3426758947882091735">"ಜೋಡಿಸುವಿಕೆ ವಿಫಲವಾಗಿದೆ"</string>
+    <string name="adb_pairing_device_dialog_failed_msg" msgid="6611097519661997148">"ಸಾಧನವು ಒಂದೇ ನೆಟ್‌ವರ್ಕ್‌ಗೆ ಕನೆಕ್ಟ್ ಆಗಿದೆಯೇ ಎಂದು ಖಚಿತಪಡಿಸಿಕೊಳ್ಳಿ."</string>
+    <string name="adb_wireless_qrcode_summary" msgid="8051414549011801917">"QR ಕೋಡ್ ಅನ್ನು ಸ್ಕ್ಯಾನ್ ಮಾಡುವ ಮೂಲಕ ವೈ-ಫೈ ನೆಟ್‌ವರ್ಕ್‌ನಲ್ಲಿ ಸಾಧನವನ್ನು ಜೋಡಿಸಿ"</string>
+    <string name="adb_wireless_verifying_qrcode_text" msgid="6123192424916029207">"ಸಾಧನವನ್ನು ಜೋಡಿಸಲಾಗುತ್ತಿದೆ…"</string>
+    <string name="adb_qrcode_pairing_device_failed_msg" msgid="6936292092592914132">"ಸಾಧನವನ್ನು ಜೋಡಿಸಲು ವಿಫಲವಾಗಿದೆ. QR ಕೋಡ್ ತಪ್ಪಾಗಿದೆ ಅಥವಾ ಸಾಧನವು ಒಂದೇ ನೆಟ್‌ವರ್ಕ್‌ಗೆ ಕನೆಕ್ಟ್ ಆಗಿಲ್ಲ."</string>
+    <string name="adb_wireless_ip_addr_preference_title" msgid="8335132107715311730">"IP ವಿಳಾಸ ಮತ್ತು ಪೋರ್ಟ್"</string>
+    <string name="adb_wireless_qrcode_pairing_title" msgid="1906409667944674707">"QR ಕೋಡ್ ಸ್ಕ್ಯಾನ್ ಮಾಡಿ"</string>
+    <string name="adb_wireless_qrcode_pairing_description" msgid="8578868049289910131">"QR ಕೋಡ್ ಅನ್ನು ಸ್ಕ್ಯಾನ್ ಮಾಡುವ ಮೂಲಕ ವೈ-ಫೈ ನೆಟ್‌ವರ್ಕ್‌ನಲ್ಲಿ ಸಾಧನವನ್ನು ಜೋಡಿಸಿ"</string>
+    <string name="keywords_adb_wireless" msgid="6507505581882171240">"adb, ಡೀಬಗ್, dev"</string>
     <string name="bugreport_in_power" msgid="8664089072534638709">"ದೋಷ ವರದಿಯ ಶಾರ್ಟ್‌ಕಟ್‌‌"</string>
     <string name="bugreport_in_power_summary" msgid="1885529649381831775">"ದೋಷ ವರದಿ ಮಾಡಲು ಪವರ್ ಮೆನುನಲ್ಲಿ ಬಟನ್ ತೋರಿಸು"</string>
     <string name="keep_screen_on" msgid="1187161672348797558">"ಎಚ್ಚರವಾಗಿರು"</string>
@@ -271,6 +298,8 @@
     <string name="tethering_hardware_offload_summary" msgid="7801345335142803029">"ಹಾರ್ಡ್‌ವೇರ್‌ನ ವೇಗವರ್ಧನೆ ಟೆಥರಿಂಗ್ ಲಭ್ಯವಿದ್ದರೆ ಅದನ್ನು ಬಳಸಿ"</string>
     <string name="adb_warning_title" msgid="7708653449506485728">"USB ಡೀಬಗ್ ಮಾಡುವಿಕೆಯನ್ನು ಅನುಮತಿಸುವುದೇ?"</string>
     <string name="adb_warning_message" msgid="8145270656419669221">"USB ಡೀಬಗ್ ಮಾಡುವಿಕೆಯು ಅಭಿವೃದ್ಧಿ ಉದ್ದೇಶಗಳಿಗೆ ಮಾತ್ರ ಆಗಿದೆ. ನಿಮ್ಮ ಕಂಪ್ಯೂಟರ್ ಮತ್ತು ನಿಮ್ಮ ಸಾಧನದ ನಡುವೆ ಡೇಟಾವನ್ನು ನಕಲಿಸಲು, ಅಧಿಸೂಚನೆ ಇಲ್ಲದೆ ನಿಮ್ಮ ಸಾಧನದಲ್ಲಿ ಅಪ್ಲಿಕೇಶನ್‌ಗಳನ್ನು ಸ್ಥಾಪಿಸಲು ಮತ್ತು ಲಾಗ್ ಡೇಟಾ ಓದಲು ಅದನ್ನು ಬಳಸಿ."</string>
+    <string name="adbwifi_warning_title" msgid="727104571653031865">"ವೈರ್‌ಲೆಸ್ ಡೀಬಗ್ ಮಾಡುವಿಕೆಯನ್ನು ಅನುಮತಿಸಬೇಕೆ?"</string>
+    <string name="adbwifi_warning_message" msgid="8005936574322702388">"ವೈರ್‌ಲೆಸ್ ಡೀಬಗ್ ಮಾಡುವಿಕೆಯು ಅಭಿವೃದ್ಧಿ ಉದ್ದೇಶಗಳಿಗೆ ಮಾತ್ರ ಆಗಿದೆ. ನಿಮ್ಮ ಕಂಪ್ಯೂಟರ್ ಮತ್ತು ನಿಮ್ಮ ಸಾಧನದ ನಡುವೆ ಡೇಟಾವನ್ನು ನಕಲಿಸಲು, ಅಧಿಸೂಚನೆ ಇಲ್ಲದೆ ನಿಮ್ಮ ಸಾಧನದಲ್ಲಿ ಆ್ಯಪ್‌ಗಳನ್ನು ಇನ್‌ಸ್ಟಾಲ್ ಮಾಡಲು ಮತ್ತು ಲಾಗ್ ಡೇಟಾ ಓದಲು ಅದನ್ನು ಬಳಸಿ."</string>
     <string name="adb_keys_warning_message" msgid="2968555274488101220">"ನೀವು ಹಿಂದೆ ಅಧಿಕೃತಗೊಳಿಸಿದ ಎಲ್ಲ ಕಂಪ್ಯೂಟರ್‌ಗಳಿಂದ USB ಡೀಬಗ್‌ಗೆ ಪ್ರವೇಶವನ್ನು ರದ್ದುಗೊಳಿಸುವುದೇ?"</string>
     <string name="dev_settings_warning_title" msgid="8251234890169074553">"ಅಭಿವೃದ್ಧಿಯ ಸೆಟ್ಟಿಂಗ್‌ಗಳನ್ನು ಅನುಮತಿಸುವುದೇ?"</string>
     <string name="dev_settings_warning_message" msgid="37741686486073668">"ಈ ಸೆಟ್ಟಿಂಗ್‌ಗಳು ಅಭಿವೃದ್ಧಿಯ ಬಳಕೆಗೆ ಮಾತ್ರ. ಅವುಗಳು ನಿಮ್ಮ ಸಾಧನ ಮತ್ತು ಅಪ್ಲಿಕೇಶನ್‌‌ಗಳಿಗೆ ಧಕ್ಕೆ ಮಾಡಬಹುದು ಅಥವಾ ಅವು ಸರಿಯಾಗಿ ಕಾರ್ಯನಿರ್ವಹಿಸದಿರುವಂತೆ ಮಾಡಬಹುದು."</string>
@@ -383,8 +412,7 @@
     <string name="daltonizer_mode_protanomaly" msgid="7805583306666608440">"ಪ್ರೊಟನೋಮಲಿ (ಕೆಂಪು-ಹಸಿರು)"</string>
     <string name="daltonizer_mode_tritanomaly" msgid="7135266249220732267">"ಟ್ರಿಟನೋಮಲಿ (ನೀಲಿ-ಹಳದಿ)"</string>
     <string name="accessibility_display_daltonizer_preference_title" msgid="1810693571332381974">"ಬಣ್ಣದ ತಿದ್ದುಪಡಿ"</string>
-    <!-- no translation found for accessibility_display_daltonizer_preference_subtitle (6178138727195403796) -->
-    <skip />
+    <string name="accessibility_display_daltonizer_preference_subtitle" msgid="6178138727195403796">"ವರ್ಣ ಅಂಧತ್ವ ಹೊಂದಿರುವ ಜನರಿಗೆ ಬಣ್ಣಗಳನ್ನು ಹೆಚ್ಚು ನಿಖರವಾಗಿ ವೀಕ್ಷಿಸಲು ಬಣ್ಣ ತಿದ್ದುಪಡಿ ಸಹಾಯ ಮಾಡುತ್ತದೆ"</string>
     <string name="daltonizer_type_overridden" msgid="4509604753672535721">"<xliff:g id="TITLE">%1$s</xliff:g> ಮೂಲಕ ಅತಿಕ್ರಮಿಸುತ್ತದೆ"</string>
     <string name="power_remaining_settings_home_page" msgid="4885165789445462557">"<xliff:g id="PERCENTAGE">%1$s</xliff:g> - <xliff:g id="TIME_STRING">%2$s</xliff:g>"</string>
     <string name="power_remaining_duration_only" msgid="8264199158671531431">"<xliff:g id="TIME_REMAINING">%1$s</xliff:g> ಸಮಯ ಬಾಕಿ ಉಳಿದಿದೆ"</string>
@@ -403,21 +431,19 @@
     <string name="power_remaining_less_than_duration" msgid="1812668275239801236">"<xliff:g id="THRESHOLD">%1$s</xliff:g> ಕ್ಕಿಂತ ಕಡಿಮೆ (<xliff:g id="LEVEL">%2$s</xliff:g>) ಬಾಕಿ"</string>
     <string name="power_remaining_more_than_subtext" msgid="7919119719242734848">"<xliff:g id="TIME_REMAINING">%1$s</xliff:g> ಕ್ಕಿಂತ ಹೆಚ್ಚು (<xliff:g id="LEVEL">%2$s</xliff:g>) ಬಾಕಿ"</string>
     <string name="power_remaining_only_more_than_subtext" msgid="3274496164769110480">"<xliff:g id="TIME_REMAINING">%1$s</xliff:g> ಕ್ಕಿಂತ ಹೆಚ್ಚು ಸಮಯ ಉಳಿದಿದೆ"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="6583866940347159957">"ಫೋನ್ ಶೀಘ್ರದಲ್ಲೇ ಶಟ್ ಡೌನ್ ಆಗಬಹುದು"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="8009177999719462724">"ಟ್ಯಾಬ್ಲೆಟ್‌‌ ಶೀಘ್ರದಲ್ಲೇ ಶಟ್ ಡೌನ್ ಆಗಬಹುದು"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="8320892540455268018">"ಸಾಧನವು ಶೀಘ್ರದಲ್ಲೇ ಶಟ್ ಡೌನ್ ಆಗಬಹುದು"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="6186572170809116621">"ಫೋನ್ ಶೀಘ್ರದಲ್ಲೇ ಶಟ್ ಡೌನ್ ಆಗಬಹುದು (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="1338758278145563121">"ಟ್ಯಾಬ್ಲೆಟ್‌‌ ಶೀಘ್ರದಲ್ಲೇ ಶಟ್ ಡೌನ್ ಆಗಬಹುದು (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="3699579688084774362">"ಸಾಧನವು ಶೀಘ್ರದಲ್ಲೇ ಶಟ್ ಡೌನ್ ಆಗಬಹುದು (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="137330009791560774">"ಫೋನ್ ಶೀಘ್ರದಲ್ಲೇ ಶಟ್ ಡೌನ್ ಆಗಬಹುದು"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="145489081521468132">"ಟ್ಯಾಬ್ಲೆಟ್‌‌ ಶೀಘ್ರದಲ್ಲೇ ಶಟ್ ಡೌನ್ ಆಗಬಹುದು"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="1070562682853942350">"ಸಾಧನವು ಶೀಘ್ರದಲ್ಲೇ ಶಟ್ ಡೌನ್ ಆಗಬಹುದು"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="4429259621177089719">"ಫೋನ್ ಶೀಘ್ರದಲ್ಲೇ ಶಟ್ ಡೌನ್ ಆಗಬಹುದು (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="7703677921000858479">"ಟ್ಯಾಬ್ಲೆಟ್‌‌ ಶೀಘ್ರದಲ್ಲೇ ಶಟ್ ಡೌನ್ ಆಗಬಹುದು (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="4374784375644214578">"ಸಾಧನವು ಶೀಘ್ರದಲ್ಲೇ ಶಟ್ ಡೌನ್ ಆಗಬಹುದು (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
     <string name="power_charging" msgid="6727132649743436802">"<xliff:g id="LEVEL">%1$s</xliff:g> - <xliff:g id="STATE">%2$s</xliff:g>"</string>
     <string name="power_remaining_charging_duration_only" msgid="7415639699283965818">"ಚಾರ್ಜ್ ಆಗಲು <xliff:g id="TIME">%1$s</xliff:g> ಸಮಯ ಬಾಕಿ ಇದೆ"</string>
     <string name="power_charging_duration" msgid="5005740040558984057">"<xliff:g id="LEVEL">%1$s</xliff:g> - ಚಾರ್ಜ್ ಆಗಲು <xliff:g id="TIME">%2$s</xliff:g> ಸಮಯ ಬೇಕು"</string>
     <string name="battery_info_status_unknown" msgid="268625384868401114">"ಅಪರಿಚಿತ"</string>
     <string name="battery_info_status_charging" msgid="4279958015430387405">"ಚಾರ್ಜ್ ಆಗುತ್ತಿದೆ"</string>
-    <!-- no translation found for battery_info_status_charging_fast (8027559755902954885) -->
-    <skip />
-    <!-- no translation found for battery_info_status_charging_slow (3190803837168962319) -->
-    <skip />
+    <string name="battery_info_status_charging_fast" msgid="8027559755902954885">"ವೇಗದ ಚಾರ್ಜಿಂಗ್"</string>
+    <string name="battery_info_status_charging_slow" msgid="3190803837168962319">"ನಿಧಾನ ಗತಿಯ ಚಾರ್ಜಿಂಗ್"</string>
     <string name="battery_info_status_discharging" msgid="6962689305413556485">"ಚಾರ್ಜ್‌ ಆಗುತ್ತಿಲ್ಲ"</string>
     <string name="battery_info_status_not_charging" msgid="8330015078868707899">"ಪ್ಲಗ್ ಇನ್ ಮಾಡಲಾಗಿದೆ, ಇದೀಗ ಚಾರ್ಜ್ ಮಾಡಲು ಸಾಧ್ಯವಿಲ್ಲ"</string>
     <string name="battery_info_status_full" msgid="4443168946046847468">"ಭರ್ತಿ"</string>
diff --git a/packages/SettingsLib/res/values-ko/strings.xml b/packages/SettingsLib/res/values-ko/strings.xml
index 51896e9..1ac029c 100644
--- a/packages/SettingsLib/res/values-ko/strings.xml
+++ b/packages/SettingsLib/res/values-ko/strings.xml
@@ -190,7 +190,7 @@
     <item msgid="5664310435707146591">"더 빠르게"</item>
     <item msgid="5491266922147715962">"매우 빠르게"</item>
     <item msgid="7659240015901486196">"상당히 빠르게"</item>
-    <item msgid="7147051179282410945">"매우 빠르게"</item>
+    <item msgid="7147051179282410945">"굉장히 빠르게"</item>
     <item msgid="581904787661470707">"가장 빠르게"</item>
   </string-array>
     <string name="choose_profile" msgid="343803890897657450">"프로필 선택"</string>
@@ -206,6 +206,33 @@
     <string name="enable_adb" msgid="8072776357237289039">"USB 디버깅"</string>
     <string name="enable_adb_summary" msgid="3711526030096574316">"USB가 연결된 경우 디버그 모드 사용"</string>
     <string name="clear_adb_keys" msgid="3010148733140369917">"USB 디버깅 권한 승인 취소"</string>
+    <string name="enable_adb_wireless" msgid="6973226350963971018">"무선 디버깅"</string>
+    <string name="enable_adb_wireless_summary" msgid="7344391423657093011">"Wi‑Fi가 연결되었을 때 디버그 모드 사용"</string>
+    <string name="adb_wireless_error" msgid="721958772149779856">"오류"</string>
+    <string name="adb_wireless_settings" msgid="2295017847215680229">"무선 디버깅"</string>
+    <string name="adb_wireless_list_empty_off" msgid="1713707973837255490">"사용 가능한 기기를 보고 사용하려면 무선 디버깅을 사용 설정하세요."</string>
+    <string name="adb_pair_method_qrcode_title" msgid="6982904096137468634">"QR 코드로 기기 페어링"</string>
+    <string name="adb_pair_method_qrcode_summary" msgid="3729901496856458634">"QR 코드 스캐너를 사용하여 새 기기 페어링"</string>
+    <string name="adb_pair_method_code_title" msgid="1122590300445142904">"페어링 코드로 기기 페어링"</string>
+    <string name="adb_pair_method_code_summary" msgid="6370414511333685185">"6자리 코드를 사용하여 새 기기 페어링"</string>
+    <string name="adb_paired_devices_title" msgid="5268997341526217362">"페어링된 기기"</string>
+    <string name="adb_wireless_device_connected_summary" msgid="3039660790249148713">"현재 연결된 기기"</string>
+    <string name="adb_wireless_device_details_title" msgid="7129369670526565786">"기기 세부정보"</string>
+    <string name="adb_device_forget" msgid="193072400783068417">"저장 안함"</string>
+    <string name="adb_device_fingerprint_title_format" msgid="291504822917843701">"기기 지문: <xliff:g id="FINGERPRINT_PARAM">%1$s</xliff:g>"</string>
+    <string name="adb_wireless_connection_failed_title" msgid="664211177427438438">"연결할 수 없음"</string>
+    <string name="adb_wireless_connection_failed_message" msgid="9213896700171602073">"<xliff:g id="DEVICE_NAME">%1$s</xliff:g>이(가) 올바른 네트워크에 연결되어 있는지 확인하세요."</string>
+    <string name="adb_pairing_device_dialog_title" msgid="7141739231018530210">"기기 페어링"</string>
+    <string name="adb_pairing_device_dialog_pairing_code_label" msgid="3639239786669722731">"Wi‑Fi 페어링 코드"</string>
+    <string name="adb_pairing_device_dialog_failed_title" msgid="3426758947882091735">"페어링 실패"</string>
+    <string name="adb_pairing_device_dialog_failed_msg" msgid="6611097519661997148">"기기가 동일한 네트워크에 연결되어 있는지 확인하세요"</string>
+    <string name="adb_wireless_qrcode_summary" msgid="8051414549011801917">"QR 코드를 스캔하여 Wi‑Fi를 통해 기기 페어링"</string>
+    <string name="adb_wireless_verifying_qrcode_text" msgid="6123192424916029207">"기기 페어링 중…"</string>
+    <string name="adb_qrcode_pairing_device_failed_msg" msgid="6936292092592914132">"기기를 페어링할 수 없습니다. QR 코드가 잘못되었거나 기기가 동일한 네트워크에 연결되어 있지 않습니다."</string>
+    <string name="adb_wireless_ip_addr_preference_title" msgid="8335132107715311730">"IP 주소 및 포트"</string>
+    <string name="adb_wireless_qrcode_pairing_title" msgid="1906409667944674707">"QR 코드 스캔"</string>
+    <string name="adb_wireless_qrcode_pairing_description" msgid="8578868049289910131">"QR 코드를 스캔하여 Wi‑Fi를 통해 기기 페어링"</string>
+    <string name="keywords_adb_wireless" msgid="6507505581882171240">"adb, 디버그, 개발자"</string>
     <string name="bugreport_in_power" msgid="8664089072534638709">"버그 신고 바로가기"</string>
     <string name="bugreport_in_power_summary" msgid="1885529649381831775">"전원 메뉴에 버그 신고 버튼 표시"</string>
     <string name="keep_screen_on" msgid="1187161672348797558">"화면 켜짐 상태 유지"</string>
@@ -271,6 +298,8 @@
     <string name="tethering_hardware_offload_summary" msgid="7801345335142803029">"가능한 경우 테더링 하드웨어 가속 사용"</string>
     <string name="adb_warning_title" msgid="7708653449506485728">"USB 디버깅을 허용하시겠습니까?"</string>
     <string name="adb_warning_message" msgid="8145270656419669221">"USB 디버깅은 개발용으로만 설계되었습니다. 이 기능을 사용하면 컴퓨터와 기기 간에 데이터를 복사하고 알림 없이 기기에 앱을 설치하며 로그 데이터를 읽을 수 있습니다."</string>
+    <string name="adbwifi_warning_title" msgid="727104571653031865">"무선 디버깅을 허용하시겠습니까?"</string>
+    <string name="adbwifi_warning_message" msgid="8005936574322702388">"무선 디버깅은 개발용으로만 설계되었습니다. 이 기능을 사용하면 컴퓨터와 기기 간에 데이터를 복사하고 알림 없이 기기에 앱을 설치하며 로그 데이터를 읽을 수 있습니다."</string>
     <string name="adb_keys_warning_message" msgid="2968555274488101220">"이전에 승인한 모든 컴퓨터에서 USB 디버깅에 대한 액세스 권한을 취소하시겠습니까?"</string>
     <string name="dev_settings_warning_title" msgid="8251234890169074553">"개발자 설정을 허용하시겠습니까?"</string>
     <string name="dev_settings_warning_message" msgid="37741686486073668">"이 설정은 개발자용으로만 설계되었습니다. 이 설정을 사용하면 기기 및 애플리케이션에 예기치 않은 중단이나 오류가 발생할 수 있습니다."</string>
@@ -383,8 +412,7 @@
     <string name="daltonizer_mode_protanomaly" msgid="7805583306666608440">"적색약(적녹)"</string>
     <string name="daltonizer_mode_tritanomaly" msgid="7135266249220732267">"청색약(청황)"</string>
     <string name="accessibility_display_daltonizer_preference_title" msgid="1810693571332381974">"색보정"</string>
-    <!-- no translation found for accessibility_display_daltonizer_preference_subtitle (6178138727195403796) -->
-    <skip />
+    <string name="accessibility_display_daltonizer_preference_subtitle" msgid="6178138727195403796">"색상 보정을 사용하면 색맹인 사용자가 색상을 정확하게 구분하는 데 도움이 됩니다."</string>
     <string name="daltonizer_type_overridden" msgid="4509604753672535721">"<xliff:g id="TITLE">%1$s</xliff:g> 우선 적용됨"</string>
     <string name="power_remaining_settings_home_page" msgid="4885165789445462557">"<xliff:g id="PERCENTAGE">%1$s</xliff:g>, <xliff:g id="TIME_STRING">%2$s</xliff:g>"</string>
     <string name="power_remaining_duration_only" msgid="8264199158671531431">"남은 시간 약 <xliff:g id="TIME_REMAINING">%1$s</xliff:g>"</string>
@@ -403,21 +431,19 @@
     <string name="power_remaining_less_than_duration" msgid="1812668275239801236">"<xliff:g id="THRESHOLD">%1$s</xliff:g> 미만 남음(<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_more_than_subtext" msgid="7919119719242734848">"<xliff:g id="TIME_REMAINING">%1$s</xliff:g> 이상 남음(<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_only_more_than_subtext" msgid="3274496164769110480">"<xliff:g id="TIME_REMAINING">%1$s</xliff:g> 이상 남음"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="6583866940347159957">"휴대전화가 곧 종료될 수 있음"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="8009177999719462724">"태블릿이 곧 종료될 수 있음"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="8320892540455268018">"기기가 곧 종료될 수 있음"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="6186572170809116621">"휴대전화가 곧 종료될 수 있음(<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="1338758278145563121">"태블릿이 곧 종료될 수 있음(<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="3699579688084774362">"기기가 곧 종료될 수 있음(<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="137330009791560774">"휴대전화가 곧 종료될 수 있음"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="145489081521468132">"태블릿이 곧 종료될 수 있음"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="1070562682853942350">"기기가 곧 종료될 수 있음"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="4429259621177089719">"휴대전화가 곧 종료될 수 있음(<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="7703677921000858479">"태블릿이 곧 종료될 수 있음(<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="4374784375644214578">"기기가 곧 종료될 수 있음(<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
     <string name="power_charging" msgid="6727132649743436802">"<xliff:g id="LEVEL">%1$s</xliff:g> - <xliff:g id="STATE">%2$s</xliff:g>"</string>
     <string name="power_remaining_charging_duration_only" msgid="7415639699283965818">"충전 완료까지 <xliff:g id="TIME">%1$s</xliff:g> 남음"</string>
     <string name="power_charging_duration" msgid="5005740040558984057">"<xliff:g id="LEVEL">%1$s</xliff:g> - 충전 완료까지 <xliff:g id="TIME">%2$s</xliff:g> 남음"</string>
     <string name="battery_info_status_unknown" msgid="268625384868401114">"알 수 없음"</string>
     <string name="battery_info_status_charging" msgid="4279958015430387405">"충전 중"</string>
-    <!-- no translation found for battery_info_status_charging_fast (8027559755902954885) -->
-    <skip />
-    <!-- no translation found for battery_info_status_charging_slow (3190803837168962319) -->
-    <skip />
+    <string name="battery_info_status_charging_fast" msgid="8027559755902954885">"고속 충전 중"</string>
+    <string name="battery_info_status_charging_slow" msgid="3190803837168962319">"저속 충전 중"</string>
     <string name="battery_info_status_discharging" msgid="6962689305413556485">"충전 안함"</string>
     <string name="battery_info_status_not_charging" msgid="8330015078868707899">"전원이 연결되었지만 현재 충전할 수 없음"</string>
     <string name="battery_info_status_full" msgid="4443168946046847468">"충전 완료"</string>
diff --git a/packages/SettingsLib/res/values-ky/strings.xml b/packages/SettingsLib/res/values-ky/strings.xml
index 061f6fd..2070056 100644
--- a/packages/SettingsLib/res/values-ky/strings.xml
+++ b/packages/SettingsLib/res/values-ky/strings.xml
@@ -31,7 +31,7 @@
     <string name="wifi_disabled_password_failure" msgid="6892387079613226738">"Аутентификация маселеси бар"</string>
     <string name="wifi_cant_connect" msgid="5718417542623056783">"Туташпай жатат"</string>
     <string name="wifi_cant_connect_to_ap" msgid="3099667989279700135">"\"<xliff:g id="AP_NAME">%1$s</xliff:g>\" тармагына туташпай койду"</string>
-    <string name="wifi_check_password_try_again" msgid="8817789642851605628">"Сырсөздү текшерип, кайра аракет кылыңыз."</string>
+    <string name="wifi_check_password_try_again" msgid="8817789642851605628">"Сырсөздү текшерип, кайталап көрүңүз."</string>
     <string name="wifi_not_in_range" msgid="1541760821805777772">"Тейлөө аймагында эмес"</string>
     <string name="wifi_no_internet_no_reconnect" msgid="821591791066497347">"Автоматтык түрдө туташпайт"</string>
     <string name="wifi_no_internet" msgid="1774198889176926299">"Интернетке туташпай турат"</string>
@@ -125,7 +125,7 @@
     <string name="bluetooth_talkback_phone" msgid="868393783858123880">"Телефон"</string>
     <string name="bluetooth_talkback_imaging" msgid="8781682986822514331">"Сүрөт тартуучу түзмөк"</string>
     <string name="bluetooth_talkback_headphone" msgid="8613073829180337091">"Кулакчын"</string>
-    <string name="bluetooth_talkback_input_peripheral" msgid="5133944817800149942">"Дайындарды киргизүүчү сырткы түзмөк"</string>
+    <string name="bluetooth_talkback_input_peripheral" msgid="5133944817800149942">"Дайындарды киргизүүчү тышкы түзмөк"</string>
     <string name="bluetooth_talkback_bluetooth" msgid="1143241359781999989">"Bluetooth"</string>
     <string name="bluetooth_hearingaid_left_pairing_message" msgid="8561855779703533591">"Угуу аппаратынын сол кулагы жупташтырылууда…"</string>
     <string name="bluetooth_hearingaid_right_pairing_message" msgid="2655347721696331048">"Угуу аппаратынын оң кулагы жупташтырылууда…"</string>
@@ -206,6 +206,33 @@
     <string name="enable_adb" msgid="8072776357237289039">"USB аркылуу мүчүлүштүктөрдү оңдоо"</string>
     <string name="enable_adb_summary" msgid="3711526030096574316">"USB компьютерге сайылганда мүчүлүштүктөрдү оңдоо режими иштейт"</string>
     <string name="clear_adb_keys" msgid="3010148733140369917">"USB аркылуу мүчүлүштүктөрдү оңдоо уруксатын артка кайтаруу"</string>
+    <string name="enable_adb_wireless" msgid="6973226350963971018">"Мүчүлүштүктөрдү зымсыз оңдоо"</string>
+    <string name="enable_adb_wireless_summary" msgid="7344391423657093011">"Wi‑Fi\'га туташтырылганда мүчүлүштүктөрдү оңдоо режими"</string>
+    <string name="adb_wireless_error" msgid="721958772149779856">"Ката"</string>
+    <string name="adb_wireless_settings" msgid="2295017847215680229">"Мүчүлүштүктөрдү зымсыз оңдоо"</string>
+    <string name="adb_wireless_list_empty_off" msgid="1713707973837255490">"Жеткиликтүү түзмөктөрдү көрүү үчүн мүчүлүштүктөрдү зымсыз оңдоону күйгүзүңүз"</string>
+    <string name="adb_pair_method_qrcode_title" msgid="6982904096137468634">"QR кодун колдонуп, түзмөктү жупташтырыңыз"</string>
+    <string name="adb_pair_method_qrcode_summary" msgid="3729901496856458634">"QR кодунун сканерин колдонуп, жаңы түзмөктөрдү жупташтырыңыз"</string>
+    <string name="adb_pair_method_code_title" msgid="1122590300445142904">"Жупташтыруучу код менен түзмөктү жупташтырыңыз"</string>
+    <string name="adb_pair_method_code_summary" msgid="6370414511333685185">"Алты сандан турган кодду колдонуп, жаңы түзмөктөрдү жупташтырыңыз"</string>
+    <string name="adb_paired_devices_title" msgid="5268997341526217362">"Жупташтырылган түзмөктөр"</string>
+    <string name="adb_wireless_device_connected_summary" msgid="3039660790249148713">"Учурда туташып турган түзмөктөр"</string>
+    <string name="adb_wireless_device_details_title" msgid="7129369670526565786">"Түзмөктүн чоо-жайы"</string>
+    <string name="adb_device_forget" msgid="193072400783068417">"Унутулсун"</string>
+    <string name="adb_device_fingerprint_title_format" msgid="291504822917843701">"Түзмөктөгү манжа изи: <xliff:g id="FINGERPRINT_PARAM">%1$s</xliff:g>"</string>
+    <string name="adb_wireless_connection_failed_title" msgid="664211177427438438">"Туташкан жок"</string>
+    <string name="adb_wireless_connection_failed_message" msgid="9213896700171602073">"<xliff:g id="DEVICE_NAME">%1$s</xliff:g> туура тармакка туташып турганын текшериңиз"</string>
+    <string name="adb_pairing_device_dialog_title" msgid="7141739231018530210">"Түзмөктү жупташтыруу"</string>
+    <string name="adb_pairing_device_dialog_pairing_code_label" msgid="3639239786669722731">"Wi‑Fi жупташтыруучу коду"</string>
+    <string name="adb_pairing_device_dialog_failed_title" msgid="3426758947882091735">"Жупташтырылган жок"</string>
+    <string name="adb_pairing_device_dialog_failed_msg" msgid="6611097519661997148">"Түзмөк бир тармакка туташканын текшериңиз."</string>
+    <string name="adb_wireless_qrcode_summary" msgid="8051414549011801917">"QR кодун скандап, түзмөктү Wi‑Fi аркылуу жупташтырыңыз"</string>
+    <string name="adb_wireless_verifying_qrcode_text" msgid="6123192424916029207">"Түзмөк жупташтырылууда…"</string>
+    <string name="adb_qrcode_pairing_device_failed_msg" msgid="6936292092592914132">"Түзмөк жупташтырылган жок. QR коду туура эмес же түзмөк бир тармакка туташпай турат."</string>
+    <string name="adb_wireless_ip_addr_preference_title" msgid="8335132107715311730">"IP дареги жана Оюкча"</string>
+    <string name="adb_wireless_qrcode_pairing_title" msgid="1906409667944674707">"QR кодун скандоо"</string>
+    <string name="adb_wireless_qrcode_pairing_description" msgid="8578868049289910131">"QR кодун скандап, түзмөктү Wi‑Fi аркылуу жупташтырыңыз"</string>
+    <string name="keywords_adb_wireless" msgid="6507505581882171240">"adb, мүчүлүштүктөрдү оңдоо, иштеп чыгуу"</string>
     <string name="bugreport_in_power" msgid="8664089072534638709">"Ката жөнүндө кабарлоо"</string>
     <string name="bugreport_in_power_summary" msgid="1885529649381831775">"Менюда ката жөнүндө кабарлоо баскычы көрүнүп турат"</string>
     <string name="keep_screen_on" msgid="1187161672348797558">"Ойгоо туруу"</string>
@@ -271,6 +298,8 @@
     <string name="tethering_hardware_offload_summary" msgid="7801345335142803029">"Мүмкүнчүлүккө жараша, модем режиминде аппарат тезирээк иштей баштайт"</string>
     <string name="adb_warning_title" msgid="7708653449506485728">"USB аркылуу жөндөөгө уруксат бересизби?"</string>
     <string name="adb_warning_message" msgid="8145270656419669221">"USB-жөндөө - өндүрүү максатында гана  түзүлгөн. Аны компүтериңиз менен түзмөгүңүздүн ортосунда берилиштерди алмашуу, түзмөгүңүзгө колдонмолорду эскертүүсүз орнотуу жана лог берилиштерин окуу үчүн колдонсоңуз болот."</string>
+    <string name="adbwifi_warning_title" msgid="727104571653031865">"Мүчүлүштүктөрдү зымсыз оңдоого уруксат берилсинби?"</string>
+    <string name="adbwifi_warning_message" msgid="8005936574322702388">"Мүчүлүштүктөрдү зымсыз оңдоо – өндүрүү максатында гана түзүлгөн. Аны компьютериңиз менен түзмөгүңүздүн ортосунда маалыматты алмашуу, колдонмолорду түзмөгүңүзгө эскертүүсүз орнотуу жана маалыматтар таржымалын окуу үчүн колдонсоңуз болот."</string>
     <string name="adb_keys_warning_message" msgid="2968555274488101220">"Сиз мурун USB жөндөөлөрүнө уруксат берген бардык компүтерлердин жеткиси жокко чыгарылсынбы?"</string>
     <string name="dev_settings_warning_title" msgid="8251234890169074553">"Жөндөөлөрдү өзгөртүү"</string>
     <string name="dev_settings_warning_message" msgid="37741686486073668">"Бул орнотуулар өндүрүүчүлөр үчүн гана берилген. Булар түзмөгүңүздүн колдонмолорун бузулушуна же туура эмес иштешине алып келиши мүмкүн."</string>
@@ -368,7 +397,7 @@
     <string name="runningservices_settings_summary" msgid="1046080643262665743">"Учурда иштеп жаткан кызматтарды көрүп, көзөмөлдөп турасыз"</string>
     <string name="select_webview_provider_title" msgid="3917815648099445503">"WebView кызматы"</string>
     <string name="select_webview_provider_dialog_title" msgid="2444261109877277714">"WebView аткарылышын коюу"</string>
-    <string name="select_webview_provider_toast_text" msgid="8512254949169359848">"Тандалган нерсе жараксыз болуп калган. Кайра аракет кылыңыз."</string>
+    <string name="select_webview_provider_toast_text" msgid="8512254949169359848">"Тандалган нерсе жараксыз болуп калган. Кайталап көрүңүз."</string>
     <string name="convert_to_file_encryption" msgid="2828976934129751818">"Файлдарды шифрлөөгө өтүү"</string>
     <string name="convert_to_file_encryption_enabled" msgid="840757431284311754">"Айландыруу…"</string>
     <string name="convert_to_file_encryption_done" msgid="8965831011811180627">"Файл мурунтан эле шифрленген"</string>
@@ -383,8 +412,7 @@
     <string name="daltonizer_mode_protanomaly" msgid="7805583306666608440">"Протаномалия (кызыл-жашыл)"</string>
     <string name="daltonizer_mode_tritanomaly" msgid="7135266249220732267">"Тританомалия (көк-сары)"</string>
     <string name="accessibility_display_daltonizer_preference_title" msgid="1810693571332381974">"Түсүн тууралоо"</string>
-    <!-- no translation found for accessibility_display_daltonizer_preference_subtitle (6178138727195403796) -->
-    <skip />
+    <string name="accessibility_display_daltonizer_preference_subtitle" msgid="6178138727195403796">"Түстү тууралоо жөндөөсү түстөрдү айырмалап көрбөгөн адамдарга түстөрдү тагыраак билүүгө жардам берет"</string>
     <string name="daltonizer_type_overridden" msgid="4509604753672535721">"<xliff:g id="TITLE">%1$s</xliff:g> менен алмаштырылган"</string>
     <string name="power_remaining_settings_home_page" msgid="4885165789445462557">"<xliff:g id="PERCENTAGE">%1$s</xliff:g> – <xliff:g id="TIME_STRING">%2$s</xliff:g>"</string>
     <string name="power_remaining_duration_only" msgid="8264199158671531431">"Болжол менен <xliff:g id="TIME_REMAINING">%1$s</xliff:g> калды"</string>
@@ -403,21 +431,19 @@
     <string name="power_remaining_less_than_duration" msgid="1812668275239801236">"<xliff:g id="THRESHOLD">%1$s</xliff:g> жетпеген убакыт калды (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_more_than_subtext" msgid="7919119719242734848">"<xliff:g id="TIME_REMAINING">%1$s</xliff:g> ашыгыраак убакыт калды (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_only_more_than_subtext" msgid="3274496164769110480">"<xliff:g id="TIME_REMAINING">%1$s</xliff:g> ашыгыраак убакыт калды"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="6583866940347159957">"Телефон бир аздан кийин өчүп калышы мүмкүн"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="8009177999719462724">"Планшет бир аздан кийин өчүп калышы мүмкүн"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="8320892540455268018">"Түзмөк бир аздан кийин өчүп калышы мүмкүн"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="6186572170809116621">"Телефон бир аздан кийин өчүп калышы мүмкүн (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="1338758278145563121">"Планшет бир аздан кийин өчүп калышы мүмкүн (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="3699579688084774362">"Түзмөк бир аздан кийин өчүп калышы мүмкүн (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="137330009791560774">"Телефон бир аздан кийин өчүп калышы мүмкүн"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="145489081521468132">"Планшет бир аздан кийин өчүп калышы мүмкүн"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="1070562682853942350">"Түзмөк бир аздан кийин өчүп калышы мүмкүн"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="4429259621177089719">"Телефон бир аздан кийин өчүп калышы мүмкүн (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="7703677921000858479">"Планшет бир аздан кийин өчүп калышы мүмкүн (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="4374784375644214578">"Түзмөк бир аздан кийин өчүп калышы мүмкүн (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
     <string name="power_charging" msgid="6727132649743436802">"<xliff:g id="LEVEL">%1$s</xliff:g> - <xliff:g id="STATE">%2$s</xliff:g>"</string>
     <string name="power_remaining_charging_duration_only" msgid="7415639699283965818">"<xliff:g id="TIME">%1$s</xliff:g> кийин кубатталат"</string>
     <string name="power_charging_duration" msgid="5005740040558984057">"<xliff:g id="LEVEL">%1$s</xliff:g> - <xliff:g id="TIME">%2$s</xliff:g> кийин кубатталат"</string>
     <string name="battery_info_status_unknown" msgid="268625384868401114">"Белгисиз"</string>
     <string name="battery_info_status_charging" msgid="4279958015430387405">"Кубатталууда"</string>
-    <!-- no translation found for battery_info_status_charging_fast (8027559755902954885) -->
-    <skip />
-    <!-- no translation found for battery_info_status_charging_slow (3190803837168962319) -->
-    <skip />
+    <string name="battery_info_status_charging_fast" msgid="8027559755902954885">"Ыкчам кубатталууда"</string>
+    <string name="battery_info_status_charging_slow" msgid="3190803837168962319">"Жай кубатталууда"</string>
     <string name="battery_info_status_discharging" msgid="6962689305413556485">"Кубат алган жок"</string>
     <string name="battery_info_status_not_charging" msgid="8330015078868707899">"Сайылып турат, учурда кубаттоо мүмкүн эмес"</string>
     <string name="battery_info_status_full" msgid="4443168946046847468">"Толук"</string>
diff --git a/packages/SettingsLib/res/values-lo/strings.xml b/packages/SettingsLib/res/values-lo/strings.xml
index bfbd8a9..5d504d4 100644
--- a/packages/SettingsLib/res/values-lo/strings.xml
+++ b/packages/SettingsLib/res/values-lo/strings.xml
@@ -206,6 +206,33 @@
     <string name="enable_adb" msgid="8072776357237289039">"ການດີບັ໊ກຜ່ານ USB"</string>
     <string name="enable_adb_summary" msgid="3711526030096574316">"ເປີດໃຊ້ໂໝດດີບັ໊ກເມື່ອເຊື່ອມຕໍ່ USB"</string>
     <string name="clear_adb_keys" msgid="3010148733140369917">"ຖອດຖອນການອະນຸຍາດການດີບັ໊ກຜ່ານ USB"</string>
+    <string name="enable_adb_wireless" msgid="6973226350963971018">"ການດີບັກໄຮ້ສາຍ"</string>
+    <string name="enable_adb_wireless_summary" msgid="7344391423657093011">"ໂໝດດີບັກເມື່ອເຊື່ອມຕໍ່ Wi‑Fi"</string>
+    <string name="adb_wireless_error" msgid="721958772149779856">"ຜິດພາດ"</string>
+    <string name="adb_wireless_settings" msgid="2295017847215680229">"ການດີບັກໄຮ້ສາຍ"</string>
+    <string name="adb_wireless_list_empty_off" msgid="1713707973837255490">"ເພື່ອເບິ່ງ ແລະ ໃຊ້ອຸປະກອນທີ່ມີຢູ່, ກະລຸນາເປີດການດີບັກໄຮ້ສາຍ"</string>
+    <string name="adb_pair_method_qrcode_title" msgid="6982904096137468634">"ຈັບຄູ່ອຸປະກອນດ້ວຍລະຫັດ QR"</string>
+    <string name="adb_pair_method_qrcode_summary" msgid="3729901496856458634">"ຈັບຄູ່ອຸປະກອນໃໝ່ໂດຍໃຊ້ຕົວສະແກນລະຫັດ QR"</string>
+    <string name="adb_pair_method_code_title" msgid="1122590300445142904">"ຈັບຄູ່ອຸປະກອນໂດຍໃຊ້ລະຫັດການຈັບຄູ່"</string>
+    <string name="adb_pair_method_code_summary" msgid="6370414511333685185">"ຈັບຄູ່ອຸປະກອນໃໝ່ໂດຍໃຊ້ລະຫັດຫົກຕົວເລກ"</string>
+    <string name="adb_paired_devices_title" msgid="5268997341526217362">"ອຸປະກອນທີ່ຈັບຄູ່ແລ້ວ"</string>
+    <string name="adb_wireless_device_connected_summary" msgid="3039660790249148713">"ຕອນນີ້ເຊື່ອມຕໍ່ແລ້ວ"</string>
+    <string name="adb_wireless_device_details_title" msgid="7129369670526565786">"ລາຍລະອຽດອຸປະກອນ"</string>
+    <string name="adb_device_forget" msgid="193072400783068417">"ລືມ"</string>
+    <string name="adb_device_fingerprint_title_format" msgid="291504822917843701">"ລາຍນິ້ວມືອຸປະກອນ: <xliff:g id="FINGERPRINT_PARAM">%1$s</xliff:g>"</string>
+    <string name="adb_wireless_connection_failed_title" msgid="664211177427438438">"ການເຊື່ອມຕໍ່ບໍ່ສຳເລັດ"</string>
+    <string name="adb_wireless_connection_failed_message" msgid="9213896700171602073">"ກະລຸນາກວດສອບວ່າ <xliff:g id="DEVICE_NAME">%1$s</xliff:g> ເຊື່ອມຕໍ່ຫາເຄືອຂ່າຍດຽວກັນແລ້ວ"</string>
+    <string name="adb_pairing_device_dialog_title" msgid="7141739231018530210">"ຈັບຄູ່ອຸປະກອນໃໝ່"</string>
+    <string name="adb_pairing_device_dialog_pairing_code_label" msgid="3639239786669722731">"ລະຫັດການຈັບຄູ່ Wi‑Fi"</string>
+    <string name="adb_pairing_device_dialog_failed_title" msgid="3426758947882091735">"ການຈັບຄູ່ບໍ່ສຳເລັດ"</string>
+    <string name="adb_pairing_device_dialog_failed_msg" msgid="6611097519661997148">"ກະລຸນາກວດສອບວ່າອຸປະກອນເຊື່ອມຕໍ່ຫາເຄືອຂ່າຍດຽວກັນແລ້ວ."</string>
+    <string name="adb_wireless_qrcode_summary" msgid="8051414549011801917">"ຈັບຄູ່ອຸປະກອນຜ່ານ Wi‑Fi ໂດຍການສະແກນລະຫັດ QR"</string>
+    <string name="adb_wireless_verifying_qrcode_text" msgid="6123192424916029207">"ກຳລັງຈັບຄູ່ອຸປະກອນ…"</string>
+    <string name="adb_qrcode_pairing_device_failed_msg" msgid="6936292092592914132">"ຈັບຄູ່ອຸປະກອນບໍ່ສຳເລັດ. ລະຫັດ QR ບໍ່ຖືກຕ້ອງ ຫຼື ອຸປະກອນບໍ່ໄດ້ເຊື່ອມຕໍ່ຫາເຄືອຂ່າຍດຽວກັນ."</string>
+    <string name="adb_wireless_ip_addr_preference_title" msgid="8335132107715311730">"ທີ່ຢູ່ IP ແລະ ຜອດ"</string>
+    <string name="adb_wireless_qrcode_pairing_title" msgid="1906409667944674707">"ສະແກນລະຫັດ QR"</string>
+    <string name="adb_wireless_qrcode_pairing_description" msgid="8578868049289910131">"ຈັບຄູ່ອຸປະກອນຜ່ານ Wi‑Fi ໂດຍການສະແກນລະຫັດ QR"</string>
+    <string name="keywords_adb_wireless" msgid="6507505581882171240">"adb, debug, dev"</string>
     <string name="bugreport_in_power" msgid="8664089072534638709">"ທາງ​ລັດລ​າຍງານ​ຂໍ້​ຜິດພາດ"</string>
     <string name="bugreport_in_power_summary" msgid="1885529649381831775">"​ສະ​ແດງ​ປຸ່ມ​ໃນ​ເມ​ນູ​ປິດ​ເປີດ​ເພື່ອ​ບັນ​ທຶກ​ການ​ລາຍ​ງານ​ຂໍ້​ຜິດ​ພາດ"</string>
     <string name="keep_screen_on" msgid="1187161672348797558">"ເປີດໜ້າຈໍຕະຫຼອດ"</string>
@@ -271,6 +298,8 @@
     <string name="tethering_hardware_offload_summary" msgid="7801345335142803029">"ເປີດໃຊ້ການເລັ່ງຄວາມໄວດ້ວຍຮາດແວຫາກວ່າສາມາດໃຊ້ໄດ້"</string>
     <string name="adb_warning_title" msgid="7708653449506485728">"ອະນຸຍາດໃຫ້ດີບັ໊ກຜ່ານ USB?"</string>
     <string name="adb_warning_message" msgid="8145270656419669221">"ການດີບັ໊ກຜ່ານ USB ແມ່ນມີຈຸດປະສົງເພື່ອການພັດທະນາເທົ່ານັ້ນ. ມັນສາມາດໃຊ້ເພື່ອສຳເນົາຂໍ້ມູນລະຫວ່າງຄອມພິວເຕີ ແລະອຸປະກອນຂອງທ່ານ, ຕິດຕັ້ງແອັບຯໂດຍບໍ່ຜ່ານການແຈ້ງເຕືອນ ແລະອ່ານຂໍ້ມູນການບັນທຶກ."</string>
+    <string name="adbwifi_warning_title" msgid="727104571653031865">"ອະນຸຍາດການດີບັກໄຮ້ສາຍບໍ?"</string>
+    <string name="adbwifi_warning_message" msgid="8005936574322702388">"ການດີບັກໄຮ້ສາຍແມ່ນມີຈຸດປະສົງສຳລັບການພັດທະນາເທົ່ານັ້ນ. ມັນສາມາດໃຊ້ເພື່ອສຳເນົາຂໍ້ມູນລະຫວ່າງຄອມພິວເຕີ ແລະ ອຸປະກອນຂອງທ່ານ, ຕິດຕັ້ງແອັບໂດຍບໍ່ຜ່ານການແຈ້ງເຕືອນ ແລະ ອ່ານຂໍ້ມູນບັນທຶກ."</string>
     <string name="adb_keys_warning_message" msgid="2968555274488101220">"ຖອດຖອນການເຂົ້າເຖິງການດີບັ໊ກຜ່ານ USB ຈາກຄອມພິວເຕີທຸກເຄື່ອງ ທີ່ທ່ານເຄີຍອະນຸຍາດກ່ອນໜ້ານີ້?"</string>
     <string name="dev_settings_warning_title" msgid="8251234890169074553">"ອະນຸຍາດການຕັ້ງຄ່າສຳລັບນັກພັດທະນາ?"</string>
     <string name="dev_settings_warning_message" msgid="37741686486073668">"ການ​ຕັ້ງຄ່າ​ເຫຼົ່ານີ້​ແມ່ນ​ມີ​ຈຸດປະສົງ​ເພື່ອ​ການ​ພັດທະນາ​ເທົ່ານັ້ນ. ພວກ​ມັນ​ສາມາດ​ເຮັດ​ໃຫ້​ອຸປະກອນ ແລະ​ແອັບພລິເຄຊັນ​ຂອງ​ທ່ານ​ຢຸດ​ເຮັດ​ວຽກ ຫຼື​ເຮັດ​ວຽກ​ຜິດປົກກະຕິ​ໄດ້."</string>
@@ -383,8 +412,7 @@
     <string name="daltonizer_mode_protanomaly" msgid="7805583306666608440">"Protanomaly (ສີ​ແດງ​-ສີ​ຂຽວ​)"</string>
     <string name="daltonizer_mode_tritanomaly" msgid="7135266249220732267">"Tritanomaly (ສີ​ຟ້າ​-ສີ​ເຫຼືອງ​)"</string>
     <string name="accessibility_display_daltonizer_preference_title" msgid="1810693571332381974">"ການ​ປັບ​ແຕ່ງ​ສີ"</string>
-    <!-- no translation found for accessibility_display_daltonizer_preference_subtitle (6178138727195403796) -->
-    <skip />
+    <string name="accessibility_display_daltonizer_preference_subtitle" msgid="6178138727195403796">"ການແກ້ໄຂສີຈະຊ່ວຍໃຫ້ຄົນທີ່ຕາບອດສີສາມາດເບິ່ງເຫັນສີໄດ້ຖືກຕ້ອງຍິ່ງຂຶ້ນ"</string>
     <string name="daltonizer_type_overridden" msgid="4509604753672535721">"ຖືກແທນໂດຍ <xliff:g id="TITLE">%1$s</xliff:g>"</string>
     <string name="power_remaining_settings_home_page" msgid="4885165789445462557">"<xliff:g id="PERCENTAGE">%1$s</xliff:g> - <xliff:g id="TIME_STRING">%2$s</xliff:g>"</string>
     <string name="power_remaining_duration_only" msgid="8264199158671531431">"ເຫຼືອອີກປະມານ <xliff:g id="TIME_REMAINING">%1$s</xliff:g>"</string>
@@ -403,21 +431,19 @@
     <string name="power_remaining_less_than_duration" msgid="1812668275239801236">"ຍັງເຫຼືອໜ້ອຍກວ່າ <xliff:g id="THRESHOLD">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_more_than_subtext" msgid="7919119719242734848">"ຍັງເຫຼືອຫຼາຍກວ່າ <xliff:g id="TIME_REMAINING">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_only_more_than_subtext" msgid="3274496164769110480">"ຍັງເຫຼືອຫຼາຍກວ່າ <xliff:g id="TIME_REMAINING">%1$s</xliff:g>"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="6583866940347159957">"ໂທລະສັບອາດຈະປິດໃນໄວໆນີ້"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="8009177999719462724">"ແທັບເລັດອາດຈະປິດໃນໄວໆນີ້"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="8320892540455268018">"ອຸປະກອນອາດຈະປິດໃນໄວໆນີ້"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="6186572170809116621">"ໂທລະສັບອາດຈະປິດໃນໄວໆນີ້ (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="1338758278145563121">"ແທັບເລັດອາດຈະປິດໃນໄວໆນີ້ (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="3699579688084774362">"ອຸປະກອນອາດຈະປິດໃນໄວໆນີ້ (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="137330009791560774">"ໂທລະສັບອາດປິດໃນໄວໆນີ້"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="145489081521468132">"ແທັບເລັດອາດປິດໃນໄວໆນີ້"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="1070562682853942350">"ອຸປະກອນອາດປິດໃນໄວໆນີ້"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="4429259621177089719">"ໂທລະສັບອາດປິດໃນໄວໆນີ້ (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="7703677921000858479">"ແທັບເລັດອາດປິດໃນໄວໆນີ້ (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="4374784375644214578">"ອຸປະກອນອາດປິດໃນໄວໆນີ້ (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
     <string name="power_charging" msgid="6727132649743436802">"<xliff:g id="LEVEL">%1$s</xliff:g> - <xliff:g id="STATE">%2$s</xliff:g>"</string>
     <string name="power_remaining_charging_duration_only" msgid="7415639699283965818">"<xliff:g id="TIME">%1$s</xliff:g> ຈົນກວ່າຈະສາກເຕັມ"</string>
     <string name="power_charging_duration" msgid="5005740040558984057">"<xliff:g id="LEVEL">%1$s</xliff:g> - <xliff:g id="TIME">%2$s</xliff:g> ຈົນກວ່າຈະສາກເຕັມ"</string>
     <string name="battery_info_status_unknown" msgid="268625384868401114">"ບໍ່ຮູ້ຈັກ"</string>
     <string name="battery_info_status_charging" msgid="4279958015430387405">"ກຳລັງສາກໄຟ"</string>
-    <!-- no translation found for battery_info_status_charging_fast (8027559755902954885) -->
-    <skip />
-    <!-- no translation found for battery_info_status_charging_slow (3190803837168962319) -->
-    <skip />
+    <string name="battery_info_status_charging_fast" msgid="8027559755902954885">"ກຳລັງສາກໄຟດ່ວນ"</string>
+    <string name="battery_info_status_charging_slow" msgid="3190803837168962319">"ກຳລັງສາກໄຟຊ້າໆ"</string>
     <string name="battery_info_status_discharging" msgid="6962689305413556485">"ບໍ່ໄດ້ສາກໄຟ"</string>
     <string name="battery_info_status_not_charging" msgid="8330015078868707899">"ສຽບສາຍແລ້ວ, ບໍ່ສາມາດສາກໄດ້ໃນຕອນນີ້"</string>
     <string name="battery_info_status_full" msgid="4443168946046847468">"ເຕັມ"</string>
diff --git a/packages/SettingsLib/res/values-lt/strings.xml b/packages/SettingsLib/res/values-lt/strings.xml
index 76d06fa..6cdb547 100644
--- a/packages/SettingsLib/res/values-lt/strings.xml
+++ b/packages/SettingsLib/res/values-lt/strings.xml
@@ -206,6 +206,33 @@
     <string name="enable_adb" msgid="8072776357237289039">"USB perkrova"</string>
     <string name="enable_adb_summary" msgid="3711526030096574316">"Derinimo režimas, kai prijungtas USB"</string>
     <string name="clear_adb_keys" msgid="3010148733140369917">"Panaikinti USB derinimo prieigos teises"</string>
+    <string name="enable_adb_wireless" msgid="6973226350963971018">"Belaidžio ryšio derinimas"</string>
+    <string name="enable_adb_wireless_summary" msgid="7344391423657093011">"Derinimo režimas, kai prisijungta prie „Wi‑Fi“"</string>
+    <string name="adb_wireless_error" msgid="721958772149779856">"Klaida"</string>
+    <string name="adb_wireless_settings" msgid="2295017847215680229">"Belaidžio ryšio derinimas"</string>
+    <string name="adb_wireless_list_empty_off" msgid="1713707973837255490">"Jei norite peržiūrėti ir naudoti pasiekiamus įrenginius, įjunkite belaidžio ryšio derinimą"</string>
+    <string name="adb_pair_method_qrcode_title" msgid="6982904096137468634">"Įrenginio susiejimas naudojant QR kodą"</string>
+    <string name="adb_pair_method_qrcode_summary" msgid="3729901496856458634">"Susiekite naujus įrenginius naudodami QR kodų skaitytuvą"</string>
+    <string name="adb_pair_method_code_title" msgid="1122590300445142904">"Įrenginio susiejimas naudojant susiejimo kodą"</string>
+    <string name="adb_pair_method_code_summary" msgid="6370414511333685185">"Susiekite naujus įrenginius naudodami šešių skaitmenų kodą"</string>
+    <string name="adb_paired_devices_title" msgid="5268997341526217362">"Susieti įrenginiai"</string>
+    <string name="adb_wireless_device_connected_summary" msgid="3039660790249148713">"Šiuo metu prisijungta"</string>
+    <string name="adb_wireless_device_details_title" msgid="7129369670526565786">"Išsami įrenginio informacija"</string>
+    <string name="adb_device_forget" msgid="193072400783068417">"Pamiršti"</string>
+    <string name="adb_device_fingerprint_title_format" msgid="291504822917843701">"Įrenginio kontrolinis kodas: <xliff:g id="FINGERPRINT_PARAM">%1$s</xliff:g>"</string>
+    <string name="adb_wireless_connection_failed_title" msgid="664211177427438438">"Nepavyko užmegzti ryšio"</string>
+    <string name="adb_wireless_connection_failed_message" msgid="9213896700171602073">"Įsitikinkite, kad <xliff:g id="DEVICE_NAME">%1$s</xliff:g> prijungtas prie tinkamo tinklo"</string>
+    <string name="adb_pairing_device_dialog_title" msgid="7141739231018530210">"Susiejimas su įrenginiu"</string>
+    <string name="adb_pairing_device_dialog_pairing_code_label" msgid="3639239786669722731">"„Wi‑Fi“ susiejimo kodas"</string>
+    <string name="adb_pairing_device_dialog_failed_title" msgid="3426758947882091735">"Nepavyko susieti"</string>
+    <string name="adb_pairing_device_dialog_failed_msg" msgid="6611097519661997148">"Įsitikinkite, kad įrenginys prijungtas prie to paties tinklo."</string>
+    <string name="adb_wireless_qrcode_summary" msgid="8051414549011801917">"Susiekite įrenginį „Wi‑Fi“ ryšiu nuskaitydami QR kodą"</string>
+    <string name="adb_wireless_verifying_qrcode_text" msgid="6123192424916029207">"Susiejamas įrenginys…"</string>
+    <string name="adb_qrcode_pairing_device_failed_msg" msgid="6936292092592914132">"Nepavyko susieti įrenginio. Netinkamas QR kodas arba įrenginys neprijungtas prie to paties tinklo."</string>
+    <string name="adb_wireless_ip_addr_preference_title" msgid="8335132107715311730">"IP adresas ir prievadas"</string>
+    <string name="adb_wireless_qrcode_pairing_title" msgid="1906409667944674707">"QR kodo nuskaitymas"</string>
+    <string name="adb_wireless_qrcode_pairing_description" msgid="8578868049289910131">"Susiekite įrenginį „Wi‑Fi“ ryšiu nuskaitydami QR kodą"</string>
+    <string name="keywords_adb_wireless" msgid="6507505581882171240">"ADB, derinti, kūrėjas"</string>
     <string name="bugreport_in_power" msgid="8664089072534638709">"Pranešimo apie riktą spartusis klavišas"</string>
     <string name="bugreport_in_power_summary" msgid="1885529649381831775">"Rodyti pranešimo apie riktą mygtuką maitinimo meniu"</string>
     <string name="keep_screen_on" msgid="1187161672348797558">"Veikti"</string>
@@ -271,6 +298,8 @@
     <string name="tethering_hardware_offload_summary" msgid="7801345335142803029">"Naudoti įrenginio kaip modemo naudojimo aparatinės įrangos spartinimą, jei pasiekiama"</string>
     <string name="adb_warning_title" msgid="7708653449506485728">"Leisti USB perkrovimą?"</string>
     <string name="adb_warning_message" msgid="8145270656419669221">"USB derinimas skirtas naudoti tik kūrimo tikslais. Jis gali būti naudojamas norint kopijuoti duomenis iš kompiuterio į įrenginį ir atvirkščiai, įdiegti programas įrenginyje be pranešimo ir skaityti žurnalo duomenis."</string>
+    <string name="adbwifi_warning_title" msgid="727104571653031865">"Leisti belaidžio ryšio derinimą?"</string>
+    <string name="adbwifi_warning_message" msgid="8005936574322702388">"Belaidžio ryšio derinimas skirtas naudoti tik kūrimo tikslais. Jis gali būti naudojamas norint kopijuoti duomenis iš kompiuterio į įrenginį ir atvirkščiai, įdiegti programas įrenginyje be pranešimo ir skaityti žurnalo duomenis."</string>
     <string name="adb_keys_warning_message" msgid="2968555274488101220">"Panaikinti visų kompiuterių, kuriems anksčiau suteikėte prieigos teisę, prieigą prie USB derinimo?"</string>
     <string name="dev_settings_warning_title" msgid="8251234890169074553">"Leisti kūrėjų nustatymus?"</string>
     <string name="dev_settings_warning_message" msgid="37741686486073668">"Šie nustatymai skirti tik kūrėjams. Nustačius juos įrenginys ir jame naudojamos programos gali nustoti veikti arba veikti netinkamai."</string>
@@ -383,8 +412,7 @@
     <string name="daltonizer_mode_protanomaly" msgid="7805583306666608440">"Protanomalija (raudona, žalia)"</string>
     <string name="daltonizer_mode_tritanomaly" msgid="7135266249220732267">"Tritanomalija (mėlyna, geltona)"</string>
     <string name="accessibility_display_daltonizer_preference_title" msgid="1810693571332381974">"Spalvų taisymas"</string>
-    <!-- no translation found for accessibility_display_daltonizer_preference_subtitle (6178138727195403796) -->
-    <skip />
+    <string name="accessibility_display_daltonizer_preference_subtitle" msgid="6178138727195403796">"Naudojant spalvų taisymo funkciją daltonikai gali geriau matyti spalvas"</string>
     <string name="daltonizer_type_overridden" msgid="4509604753672535721">"Nepaisyta naudojant nuostatą „<xliff:g id="TITLE">%1$s</xliff:g>“"</string>
     <string name="power_remaining_settings_home_page" msgid="4885165789445462557">"<xliff:g id="PERCENTAGE">%1$s</xliff:g> – <xliff:g id="TIME_STRING">%2$s</xliff:g>"</string>
     <string name="power_remaining_duration_only" msgid="8264199158671531431">"Liko maždaug <xliff:g id="TIME_REMAINING">%1$s</xliff:g>"</string>
@@ -403,21 +431,19 @@
     <string name="power_remaining_less_than_duration" msgid="1812668275239801236">"Liko mažiau nei <xliff:g id="THRESHOLD">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_more_than_subtext" msgid="7919119719242734848">"Liko daugiau nei <xliff:g id="TIME_REMAINING">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_only_more_than_subtext" msgid="3274496164769110480">"Liko daugiau nei <xliff:g id="TIME_REMAINING">%1$s</xliff:g>"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="6583866940347159957">"Telefonas netrukus gali būti išjungtas"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="8009177999719462724">"Planšetinis komp. netrukus gali būti išjungtas"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="8320892540455268018">"Įrenginys netrukus gali būti išjungtas"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="6186572170809116621">"Telefonas netrukus gali būti išjungtas (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="1338758278145563121">"Planšetinis kompiuteris netrukus gali būti išjungtas (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="3699579688084774362">"Įrenginys netrukus gali būti išjungtas (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="137330009791560774">"Telefonas netrukus gali būti išjungtas"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="145489081521468132">"Planšetinis komp. netrukus gali būti išjungtas"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="1070562682853942350">"Įrenginys netrukus gali būti išjungtas"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="4429259621177089719">"Telefonas netrukus gali būti išjungtas (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="7703677921000858479">"Planšetinis komp. netrukus gali būti išjungtas (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="4374784375644214578">"Įrenginys netrukus gali būti išjungtas (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
     <string name="power_charging" msgid="6727132649743436802">"<xliff:g id="LEVEL">%1$s</xliff:g> – <xliff:g id="STATE">%2$s</xliff:g>"</string>
     <string name="power_remaining_charging_duration_only" msgid="7415639699283965818">"Iki visiškos įkrovos liko <xliff:g id="TIME">%1$s</xliff:g>"</string>
     <string name="power_charging_duration" msgid="5005740040558984057">"<xliff:g id="LEVEL">%1$s</xliff:g> – iki visiškos įkrovos liko <xliff:g id="TIME">%2$s</xliff:g>"</string>
     <string name="battery_info_status_unknown" msgid="268625384868401114">"Nežinomas"</string>
     <string name="battery_info_status_charging" msgid="4279958015430387405">"Kraunasi..."</string>
-    <!-- no translation found for battery_info_status_charging_fast (8027559755902954885) -->
-    <skip />
-    <!-- no translation found for battery_info_status_charging_slow (3190803837168962319) -->
-    <skip />
+    <string name="battery_info_status_charging_fast" msgid="8027559755902954885">"Greitai įkraunama"</string>
+    <string name="battery_info_status_charging_slow" msgid="3190803837168962319">"Lėtai įkraunama"</string>
     <string name="battery_info_status_discharging" msgid="6962689305413556485">"Nekraunama"</string>
     <string name="battery_info_status_not_charging" msgid="8330015078868707899">"Įjungta į maitinimo lizdą, bet šiuo metu įkrauti neįmanoma"</string>
     <string name="battery_info_status_full" msgid="4443168946046847468">"Visiškai įkrautas"</string>
diff --git a/packages/SettingsLib/res/values-lv/strings.xml b/packages/SettingsLib/res/values-lv/strings.xml
index e4652d1..8257d53 100644
--- a/packages/SettingsLib/res/values-lv/strings.xml
+++ b/packages/SettingsLib/res/values-lv/strings.xml
@@ -206,6 +206,33 @@
     <string name="enable_adb" msgid="8072776357237289039">"USB atkļūdošana"</string>
     <string name="enable_adb_summary" msgid="3711526030096574316">"Atkļūdošanas režīms, kad ir pievienota kopne USB"</string>
     <string name="clear_adb_keys" msgid="3010148733140369917">"Atsaukt piekļuvi USB atkļūdošanai"</string>
+    <string name="enable_adb_wireless" msgid="6973226350963971018">"Bezvadu atkļūdošana"</string>
+    <string name="enable_adb_wireless_summary" msgid="7344391423657093011">"Atkļūdošanas režīms, kad Wi-Fi savienojums ir izslēgts"</string>
+    <string name="adb_wireless_error" msgid="721958772149779856">"Kļūda"</string>
+    <string name="adb_wireless_settings" msgid="2295017847215680229">"Bezvadu atkļūdošana"</string>
+    <string name="adb_wireless_list_empty_off" msgid="1713707973837255490">"Lai skatītu un izmantotu pieejamās ierīces, ieslēdziet bezvadu atkļūdošanu."</string>
+    <string name="adb_pair_method_qrcode_title" msgid="6982904096137468634">"Ierīču savienošana pārī, izmantojot QR kodu"</string>
+    <string name="adb_pair_method_qrcode_summary" msgid="3729901496856458634">"Savienot pārī jaunas ierīces, izmantojot QR koda skeneri"</string>
+    <string name="adb_pair_method_code_title" msgid="1122590300445142904">"Ierīču savienošana pārī, izmantojot kodu"</string>
+    <string name="adb_pair_method_code_summary" msgid="6370414511333685185">"Savienojiet pārī jaunas ierīces, izmantojot sešu ciparu kodu"</string>
+    <string name="adb_paired_devices_title" msgid="5268997341526217362">"Pārī savienotās ierīces"</string>
+    <string name="adb_wireless_device_connected_summary" msgid="3039660790249148713">"Pašlaik pievienota"</string>
+    <string name="adb_wireless_device_details_title" msgid="7129369670526565786">"Ierīces dati"</string>
+    <string name="adb_device_forget" msgid="193072400783068417">"Neiegaumēt"</string>
+    <string name="adb_device_fingerprint_title_format" msgid="291504822917843701">"Ierīces ciparnospiedums: <xliff:g id="FINGERPRINT_PARAM">%1$s</xliff:g>"</string>
+    <string name="adb_wireless_connection_failed_title" msgid="664211177427438438">"Neizdevās izveidot savienojumu"</string>
+    <string name="adb_wireless_connection_failed_message" msgid="9213896700171602073">"Ierīcei <xliff:g id="DEVICE_NAME">%1$s</xliff:g> ir jābūt izveidotam savienojumam ar pareizo tīklu."</string>
+    <string name="adb_pairing_device_dialog_title" msgid="7141739231018530210">"Savienošana pārī ar ierīci"</string>
+    <string name="adb_pairing_device_dialog_pairing_code_label" msgid="3639239786669722731">"Wi‑Fi kods savienošanai pārī"</string>
+    <string name="adb_pairing_device_dialog_failed_title" msgid="3426758947882091735">"Neizdevās izveidot savienojumu pārī"</string>
+    <string name="adb_pairing_device_dialog_failed_msg" msgid="6611097519661997148">"Ierīcei ir jābūt izveidotam savienojumam ar to pašu tīklu."</string>
+    <string name="adb_wireless_qrcode_summary" msgid="8051414549011801917">"Izveidojiet savienojumu pārī ar ierīci Wi‑Fi tīklā, skenējot QR kodu."</string>
+    <string name="adb_wireless_verifying_qrcode_text" msgid="6123192424916029207">"Notiek savienošana pārī ar ierīci…"</string>
+    <string name="adb_qrcode_pairing_device_failed_msg" msgid="6936292092592914132">"Neizdevās izveidot savienojumu pārī ar ierīci. QR kods nebija pareizs, vai ierīcei nebija izveidots savienojums ar to pašu tīklu."</string>
+    <string name="adb_wireless_ip_addr_preference_title" msgid="8335132107715311730">"IP adrese un ports"</string>
+    <string name="adb_wireless_qrcode_pairing_title" msgid="1906409667944674707">"QR koda skenēšana"</string>
+    <string name="adb_wireless_qrcode_pairing_description" msgid="8578868049289910131">"Izveidojiet savienojumu pārī ar ierīci Wi‑Fi tīklā, skenējot QR kodu."</string>
+    <string name="keywords_adb_wireless" msgid="6507505581882171240">"adb, atkļūdošana, izstrādātājiem"</string>
     <string name="bugreport_in_power" msgid="8664089072534638709">"Kļūdu pārskata saīsne"</string>
     <string name="bugreport_in_power_summary" msgid="1885529649381831775">"Izslēgšanas izvēlnē rādīt kļūdu pārskata veidošanas pogu"</string>
     <string name="keep_screen_on" msgid="1187161672348797558">"Atstāt nomodā"</string>
@@ -271,6 +298,8 @@
     <string name="tethering_hardware_offload_summary" msgid="7801345335142803029">"Izmantot paātrinātu aparatūras darbību piesaistei, ja tā ir pieejama"</string>
     <string name="adb_warning_title" msgid="7708653449506485728">"Vai atļaut USB atkļūdošanu?"</string>
     <string name="adb_warning_message" msgid="8145270656419669221">"USB atkļūdošana ir paredzēta tikai ar izstrādi saistītām darbībām. Izmantojiet to datu kopēšanai no datora uz ierīci un pretēji, lietotņu instalēšanai ierīcē bez paziņojumiem un žurnāla datu lasīšanai."</string>
+    <string name="adbwifi_warning_title" msgid="727104571653031865">"Vai atļaut bezvadu atkļūdošanu?"</string>
+    <string name="adbwifi_warning_message" msgid="8005936574322702388">"Bezvadu atkļūdošana ir paredzēta tikai ar izstrādi saistītām darbībām. Izmantojiet to datu kopēšanai no datora uz ierīci un pretēji, lietotņu instalēšanai ierīcē bez paziņojumiem un žurnāla datu lasīšanai."</string>
     <string name="adb_keys_warning_message" msgid="2968555274488101220">"Vai atcelt piekļuvi USB atkļūdošanai no visiem datoriem, kuriem iepriekš piešķīrāt piekļuvi?"</string>
     <string name="dev_settings_warning_title" msgid="8251234890169074553">"Vai atļaut izstrādes iestatījumus?"</string>
     <string name="dev_settings_warning_message" msgid="37741686486073668">"Šie iestatījumi ir paredzēti tikai izstrādei. To dēļ var tikt pārtraukta vai traucēta ierīces un lietojumprogrammu darbība."</string>
@@ -383,8 +412,7 @@
     <string name="daltonizer_mode_protanomaly" msgid="7805583306666608440">"Protanomālija (sarkans/zaļš)"</string>
     <string name="daltonizer_mode_tritanomaly" msgid="7135266249220732267">"Tritanomālija (zils/dzeltens)"</string>
     <string name="accessibility_display_daltonizer_preference_title" msgid="1810693571332381974">"Krāsu korekcija"</string>
-    <!-- no translation found for accessibility_display_daltonizer_preference_subtitle (6178138727195403796) -->
-    <skip />
+    <string name="accessibility_display_daltonizer_preference_subtitle" msgid="6178138727195403796">"Krāsu korekcija palīdz lietotājiem ar krāsu aklumu redzēt precīzākas krāsas."</string>
     <string name="daltonizer_type_overridden" msgid="4509604753672535721">"Jaunā preference: <xliff:g id="TITLE">%1$s</xliff:g>"</string>
     <string name="power_remaining_settings_home_page" msgid="4885165789445462557">"<xliff:g id="PERCENTAGE">%1$s</xliff:g> — <xliff:g id="TIME_STRING">%2$s</xliff:g>"</string>
     <string name="power_remaining_duration_only" msgid="8264199158671531431">"Aptuvenais atlikušais laiks: <xliff:g id="TIME_REMAINING">%1$s</xliff:g>"</string>
@@ -403,21 +431,19 @@
     <string name="power_remaining_less_than_duration" msgid="1812668275239801236">"Atlicis mazāk nekā <xliff:g id="THRESHOLD">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_more_than_subtext" msgid="7919119719242734848">"Atlicis vairāk nekā <xliff:g id="TIME_REMAINING">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_only_more_than_subtext" msgid="3274496164769110480">"Atlicis vairāk nekā <xliff:g id="TIME_REMAINING">%1$s</xliff:g>"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="6583866940347159957">"Iespējams, tālrunis drīz izslēgsies"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="8009177999719462724">"Iespējams, planšetdators drīz izslēgsies"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="8320892540455268018">"Iespējams, ierīce drīz izslēgsies"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="6186572170809116621">"Iespējams, tālrunis drīz izslēgsies (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="1338758278145563121">"Iespējams, planšetdators drīz izslēgsies (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="3699579688084774362">"Iespējams, ierīce drīz izslēgsies (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="137330009791560774">"Tālrunis, iespējams, drīz izslēgsies."</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="145489081521468132">"Planšetdators, iespējams, drīz izslēgsies."</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="1070562682853942350">"Ierīce, iespējams, drīz izslēgsies."</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="4429259621177089719">"Tālrunis, iespējams, drīz izslēgsies (<xliff:g id="LEVEL">%1$s</xliff:g>)."</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="7703677921000858479">"Planšetdators, iespējams, drīz izslēgsies (<xliff:g id="LEVEL">%1$s</xliff:g>)."</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="4374784375644214578">"Ierīce, iespējams, drīz izslēgsies (<xliff:g id="LEVEL">%1$s</xliff:g>)."</string>
     <string name="power_charging" msgid="6727132649743436802">"<xliff:g id="LEVEL">%1$s</xliff:g> — <xliff:g id="STATE">%2$s</xliff:g>"</string>
     <string name="power_remaining_charging_duration_only" msgid="7415639699283965818">"Vēl <xliff:g id="TIME">%1$s</xliff:g> līdz pilnai uzlādei"</string>
     <string name="power_charging_duration" msgid="5005740040558984057">"<xliff:g id="LEVEL">%1$s</xliff:g> — <xliff:g id="TIME">%2$s</xliff:g> līdz pilnai uzlādei"</string>
     <string name="battery_info_status_unknown" msgid="268625384868401114">"Nezināms"</string>
     <string name="battery_info_status_charging" msgid="4279958015430387405">"Uzlāde"</string>
-    <!-- no translation found for battery_info_status_charging_fast (8027559755902954885) -->
-    <skip />
-    <!-- no translation found for battery_info_status_charging_slow (3190803837168962319) -->
-    <skip />
+    <string name="battery_info_status_charging_fast" msgid="8027559755902954885">"Notiek ātrā uzlāde"</string>
+    <string name="battery_info_status_charging_slow" msgid="3190803837168962319">"Notiek lēnā uzlāde"</string>
     <string name="battery_info_status_discharging" msgid="6962689305413556485">"Nenotiek uzlāde"</string>
     <string name="battery_info_status_not_charging" msgid="8330015078868707899">"Pievienots, taču pašlaik nevar veikt uzlādi"</string>
     <string name="battery_info_status_full" msgid="4443168946046847468">"Pilns"</string>
diff --git a/packages/SettingsLib/res/values-mk/strings.xml b/packages/SettingsLib/res/values-mk/strings.xml
index 21b2f96..ae2df9a 100644
--- a/packages/SettingsLib/res/values-mk/strings.xml
+++ b/packages/SettingsLib/res/values-mk/strings.xml
@@ -206,6 +206,33 @@
     <string name="enable_adb" msgid="8072776357237289039">"Отстранување грешки на USB"</string>
     <string name="enable_adb_summary" msgid="3711526030096574316">"Режим на отстранување грешки кога е поврзано USB"</string>
     <string name="clear_adb_keys" msgid="3010148733140369917">"Отповикај овластувања за отстранување грешки од USB"</string>
+    <string name="enable_adb_wireless" msgid="6973226350963971018">"Безжично отстранување грешки"</string>
+    <string name="enable_adb_wireless_summary" msgid="7344391423657093011">"Режим на отстранување грешки кога е поврзано Wi‑Fi"</string>
+    <string name="adb_wireless_error" msgid="721958772149779856">"Грешка"</string>
+    <string name="adb_wireless_settings" msgid="2295017847215680229">"Безжично отстранување грешки"</string>
+    <string name="adb_wireless_list_empty_off" msgid="1713707973837255490">"За да ги гледате и користите достапните уреди, вклучете го безжичното отстранување грешки"</string>
+    <string name="adb_pair_method_qrcode_title" msgid="6982904096137468634">"Спарете уред преку QR-код"</string>
+    <string name="adb_pair_method_qrcode_summary" msgid="3729901496856458634">"Спарете нови уреди преку скенер за QR-код"</string>
+    <string name="adb_pair_method_code_title" msgid="1122590300445142904">"Спарете уред преку код за спарување"</string>
+    <string name="adb_pair_method_code_summary" msgid="6370414511333685185">"Спарете нови уреди преку шестцифрен код"</string>
+    <string name="adb_paired_devices_title" msgid="5268997341526217362">"Спарени уреди"</string>
+    <string name="adb_wireless_device_connected_summary" msgid="3039660790249148713">"Моментално поврзан"</string>
+    <string name="adb_wireless_device_details_title" msgid="7129369670526565786">"Детали за уредот"</string>
+    <string name="adb_device_forget" msgid="193072400783068417">"Заборави"</string>
+    <string name="adb_device_fingerprint_title_format" msgid="291504822917843701">"Отпечаток на уредот: <xliff:g id="FINGERPRINT_PARAM">%1$s</xliff:g>"</string>
+    <string name="adb_wireless_connection_failed_title" msgid="664211177427438438">"Врската е неуспешна"</string>
+    <string name="adb_wireless_connection_failed_message" msgid="9213896700171602073">"Уверете се дека <xliff:g id="DEVICE_NAME">%1$s</xliff:g> е поврзан на точната мрежа"</string>
+    <string name="adb_pairing_device_dialog_title" msgid="7141739231018530210">"Спарете со уред"</string>
+    <string name="adb_pairing_device_dialog_pairing_code_label" msgid="3639239786669722731">"Код за спарување преку Wi‑Fi"</string>
+    <string name="adb_pairing_device_dialog_failed_title" msgid="3426758947882091735">"Спарувањето е неуспешно"</string>
+    <string name="adb_pairing_device_dialog_failed_msg" msgid="6611097519661997148">"Уверете се дека уредот е поврзан на истата мрежа."</string>
+    <string name="adb_wireless_qrcode_summary" msgid="8051414549011801917">"Спарете го уредот преку Wi‑Fi со скенирање QR-код"</string>
+    <string name="adb_wireless_verifying_qrcode_text" msgid="6123192424916029207">"Се спарува уред…"</string>
+    <string name="adb_qrcode_pairing_device_failed_msg" msgid="6936292092592914132">"Уредот не успеа да се спари. Или QR-кодот беше погрешен или уредот не е поврзан на истата мрежа."</string>
+    <string name="adb_wireless_ip_addr_preference_title" msgid="8335132107715311730">"IP-адреса и порта"</string>
+    <string name="adb_wireless_qrcode_pairing_title" msgid="1906409667944674707">"Скенирајте QR-код"</string>
+    <string name="adb_wireless_qrcode_pairing_description" msgid="8578868049289910131">"Спарете го уредот преку Wi‑Fi со скенирање QR-код"</string>
+    <string name="keywords_adb_wireless" msgid="6507505581882171240">"adb, отстранува грешка, програмер"</string>
     <string name="bugreport_in_power" msgid="8664089072534638709">"Кратенка за извештај за грешка"</string>
     <string name="bugreport_in_power_summary" msgid="1885529649381831775">"Прикажи копче во менито за вклучување за да се направи извештај за грешка"</string>
     <string name="keep_screen_on" msgid="1187161672348797558">"Остани во активен режим"</string>
@@ -271,6 +298,8 @@
     <string name="tethering_hardware_offload_summary" msgid="7801345335142803029">"Ако е достапно, користи хардверско забрзување за врзување"</string>
     <string name="adb_warning_title" msgid="7708653449506485728">"Овозможи отстранување грешки на USB?"</string>
     <string name="adb_warning_message" msgid="8145270656419669221">"Отстранувањето грешки на USB е наменето само за целите на развој. Користете го за копирање податоци меѓу вашиот компјутер и вашиот уред, за инсталирање апликации на вашиот уред без известување и за читање евиденција на податоци."</string>
+    <string name="adbwifi_warning_title" msgid="727104571653031865">"Да се дозволи безжично отстранување грешки?"</string>
+    <string name="adbwifi_warning_message" msgid="8005936574322702388">"Безжичното отстранување грешки е наменето само за развојни цели. Користете го за копирање податоци помеѓу компјутерот и уредот, за инсталирање апликации на уредот без известување и за читање податоци од евиденцијата."</string>
     <string name="adb_keys_warning_message" msgid="2968555274488101220">"Отповикај пристап кон отстранување грешка од USB од сите претходно овластени компјутери?"</string>
     <string name="dev_settings_warning_title" msgid="8251234890169074553">"Дозволи поставки за развој?"</string>
     <string name="dev_settings_warning_message" msgid="37741686486073668">"Овие поставки се наменети само за употреба за развој. Тие може да предизвикаат уредот и апликациите во него да се расипат или да се однесуваат необично."</string>
@@ -383,8 +412,7 @@
     <string name="daltonizer_mode_protanomaly" msgid="7805583306666608440">"Протаномалија (слепило за црвена и зелена)"</string>
     <string name="daltonizer_mode_tritanomaly" msgid="7135266249220732267">"Тританомалија (слепило за сина и жолта)"</string>
     <string name="accessibility_display_daltonizer_preference_title" msgid="1810693571332381974">"Корекција на бои"</string>
-    <!-- no translation found for accessibility_display_daltonizer_preference_subtitle (6178138727195403796) -->
-    <skip />
+    <string name="accessibility_display_daltonizer_preference_subtitle" msgid="6178138727195403796">"Корекцијата на бои им помага на луѓето што не ги разликуваат боите попрецизно да ги гледаат"</string>
     <string name="daltonizer_type_overridden" msgid="4509604753672535721">"Прескокнато според <xliff:g id="TITLE">%1$s</xliff:g>"</string>
     <string name="power_remaining_settings_home_page" msgid="4885165789445462557">"<xliff:g id="PERCENTAGE">%1$s</xliff:g> - <xliff:g id="TIME_STRING">%2$s</xliff:g>"</string>
     <string name="power_remaining_duration_only" msgid="8264199158671531431">"Уште околу <xliff:g id="TIME_REMAINING">%1$s</xliff:g>"</string>
@@ -403,21 +431,19 @@
     <string name="power_remaining_less_than_duration" msgid="1812668275239801236">"Уште помалку од <xliff:g id="THRESHOLD">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_more_than_subtext" msgid="7919119719242734848">"Уште повеќе од <xliff:g id="TIME_REMAINING">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_only_more_than_subtext" msgid="3274496164769110480">"Уште повеќе од <xliff:g id="TIME_REMAINING">%1$s</xliff:g>"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="6583866940347159957">"Телефон може да се исклучи наскоро"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="8009177999719462724">"Таблетот може да се исклучи наскоро"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="8320892540455268018">"Уредот може да се исклучи наскоро"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="6186572170809116621">"Телефон може да се исклучи наскоро (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="1338758278145563121">"Таблетот може да се исклучи наскоро (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="3699579688084774362">"Уредот може да се исклучи наскоро (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="137330009791560774">"Телефон може да се исклучи наскоро"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="145489081521468132">"Таблетот може да се исклучи наскоро"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="1070562682853942350">"Уредот може да се исклучи наскоро"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="4429259621177089719">"Телефон може да се исклучи наскоро (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="7703677921000858479">"Таблетот може да се исклучи наскоро (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="4374784375644214578">"Уредот може да се исклучи наскоро (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
     <string name="power_charging" msgid="6727132649743436802">"<xliff:g id="LEVEL">%1$s</xliff:g> – <xliff:g id="STATE">%2$s</xliff:g>"</string>
     <string name="power_remaining_charging_duration_only" msgid="7415639699283965818">"Уште <xliff:g id="TIME">%1$s</xliff:g> до целосно полнење"</string>
     <string name="power_charging_duration" msgid="5005740040558984057">"<xliff:g id="LEVEL">%1$s</xliff:g> - <xliff:g id="TIME">%2$s</xliff:g> до целосно полнење"</string>
     <string name="battery_info_status_unknown" msgid="268625384868401114">"Непознато"</string>
     <string name="battery_info_status_charging" msgid="4279958015430387405">"Се полни"</string>
-    <!-- no translation found for battery_info_status_charging_fast (8027559755902954885) -->
-    <skip />
-    <!-- no translation found for battery_info_status_charging_slow (3190803837168962319) -->
-    <skip />
+    <string name="battery_info_status_charging_fast" msgid="8027559755902954885">"Брзо полнење"</string>
+    <string name="battery_info_status_charging_slow" msgid="3190803837168962319">"Бавно полнење"</string>
     <string name="battery_info_status_discharging" msgid="6962689305413556485">"Не се полни"</string>
     <string name="battery_info_status_not_charging" msgid="8330015078868707899">"Приклучен е, но батеријата не може да се полни во моментов"</string>
     <string name="battery_info_status_full" msgid="4443168946046847468">"Полна"</string>
diff --git a/packages/SettingsLib/res/values-ml/strings.xml b/packages/SettingsLib/res/values-ml/strings.xml
index 85aa000..8727755 100644
--- a/packages/SettingsLib/res/values-ml/strings.xml
+++ b/packages/SettingsLib/res/values-ml/strings.xml
@@ -206,6 +206,60 @@
     <string name="enable_adb" msgid="8072776357237289039">"USB ഡീബഗ്ഗിംഗ്"</string>
     <string name="enable_adb_summary" msgid="3711526030096574316">"USB കണ‌ക്റ്റുചെയ്‌തിരിക്കുമ്പോഴുള്ള ഡീബഗ് മോഡ്"</string>
     <string name="clear_adb_keys" msgid="3010148733140369917">"USB ഡീബഗ്ഗിംഗ് അംഗീകാരം പിൻവലിക്കുക"</string>
+    <!-- no translation found for enable_adb_wireless (6973226350963971018) -->
+    <skip />
+    <!-- no translation found for enable_adb_wireless_summary (7344391423657093011) -->
+    <skip />
+    <!-- no translation found for adb_wireless_error (721958772149779856) -->
+    <skip />
+    <!-- no translation found for adb_wireless_settings (2295017847215680229) -->
+    <skip />
+    <!-- no translation found for adb_wireless_list_empty_off (1713707973837255490) -->
+    <skip />
+    <!-- no translation found for adb_pair_method_qrcode_title (6982904096137468634) -->
+    <skip />
+    <!-- no translation found for adb_pair_method_qrcode_summary (3729901496856458634) -->
+    <skip />
+    <!-- no translation found for adb_pair_method_code_title (1122590300445142904) -->
+    <skip />
+    <!-- no translation found for adb_pair_method_code_summary (6370414511333685185) -->
+    <skip />
+    <!-- no translation found for adb_paired_devices_title (5268997341526217362) -->
+    <skip />
+    <!-- no translation found for adb_wireless_device_connected_summary (3039660790249148713) -->
+    <skip />
+    <!-- no translation found for adb_wireless_device_details_title (7129369670526565786) -->
+    <skip />
+    <!-- no translation found for adb_device_forget (193072400783068417) -->
+    <skip />
+    <!-- no translation found for adb_device_fingerprint_title_format (291504822917843701) -->
+    <skip />
+    <!-- no translation found for adb_wireless_connection_failed_title (664211177427438438) -->
+    <skip />
+    <!-- no translation found for adb_wireless_connection_failed_message (9213896700171602073) -->
+    <skip />
+    <!-- no translation found for adb_pairing_device_dialog_title (7141739231018530210) -->
+    <skip />
+    <!-- no translation found for adb_pairing_device_dialog_pairing_code_label (3639239786669722731) -->
+    <skip />
+    <!-- no translation found for adb_pairing_device_dialog_failed_title (3426758947882091735) -->
+    <skip />
+    <!-- no translation found for adb_pairing_device_dialog_failed_msg (6611097519661997148) -->
+    <skip />
+    <!-- no translation found for adb_wireless_qrcode_summary (8051414549011801917) -->
+    <skip />
+    <!-- no translation found for adb_wireless_verifying_qrcode_text (6123192424916029207) -->
+    <skip />
+    <!-- no translation found for adb_qrcode_pairing_device_failed_msg (6936292092592914132) -->
+    <skip />
+    <!-- no translation found for adb_wireless_ip_addr_preference_title (8335132107715311730) -->
+    <skip />
+    <!-- no translation found for adb_wireless_qrcode_pairing_title (1906409667944674707) -->
+    <skip />
+    <!-- no translation found for adb_wireless_qrcode_pairing_description (8578868049289910131) -->
+    <skip />
+    <!-- no translation found for keywords_adb_wireless (6507505581882171240) -->
+    <skip />
     <string name="bugreport_in_power" msgid="8664089072534638709">"ബഗ് റിപ്പോർട്ട് കുറുക്കുവഴി"</string>
     <string name="bugreport_in_power_summary" msgid="1885529649381831775">"ബഗ് റിപ്പോർട്ട് എടുക്കുന്നതിന് പവർ മെനുവിൽ ഒരു ബട്ടൺ കാണിക്കുക"</string>
     <string name="keep_screen_on" msgid="1187161672348797558">"സജീവമായി തുടരുക"</string>
@@ -271,6 +325,10 @@
     <string name="tethering_hardware_offload_summary" msgid="7801345335142803029">"ലഭ്യമാണെങ്കിൽ \'ടെതറിംഗ് ഹാർഡ്‌വെയർ ത്വരിതപ്പെടുത്തൽ\' ഉപയോഗിക്കുക"</string>
     <string name="adb_warning_title" msgid="7708653449506485728">"USB ഡീബഗ്ഗുചെയ്യാൻ അനുവദിക്കണോ?"</string>
     <string name="adb_warning_message" msgid="8145270656419669221">"USB ഡീബഗ്ഗിംഗ് വികസന ആവശ്യകതകൾക്ക് മാത്രമുള്ളതാണ്. നിങ്ങളുടെ കമ്പ്യൂട്ടറിനും ഉപകരണത്തിനുമിടയിൽ ഡാറ്റ പകർത്തുന്നതിനും അറിയിപ്പില്ലാതെ തന്നെ നിങ്ങളുടെ ഉപകരണത്തിൽ അപ്ലിക്കേഷനുകൾ ഇൻസ്‌റ്റാളുചെയ്യുന്നതിനും ലോഗ് ഡാറ്റ റീഡുചെയ്യുന്നതിനും ഇത് ഉപയോഗിക്കുക."</string>
+    <!-- no translation found for adbwifi_warning_title (727104571653031865) -->
+    <skip />
+    <!-- no translation found for adbwifi_warning_message (8005936574322702388) -->
+    <skip />
     <string name="adb_keys_warning_message" msgid="2968555274488101220">"നിങ്ങൾ മുമ്പ് അംഗീകരിച്ച എല്ലാ കമ്പ്യൂട്ടറുകളിൽ നിന്നും USB ഡീബഗ്ഗുചെയ്യുന്നതിനുള്ള ആക്‌സസ്സ് പിൻവലിക്കണോ?"</string>
     <string name="dev_settings_warning_title" msgid="8251234890169074553">"വികസന ക്രമീകരണങ്ങൾ അനുവദിക്കണോ?"</string>
     <string name="dev_settings_warning_message" msgid="37741686486073668">"ഈ ക്രമീകരണങ്ങൾ വികസന ഉപയോഗത്തിന് മാത്രമായുള്ളതാണ്. അവ നിങ്ങളുടെ ഉപകരണവും അതിലെ അപ്ലിക്കേഷനുകളും തകരാറിലാക്കുന്നതിനോ തെറ്റായി പ്രവർത്തിക്കുന്നതിനോ ഇടയാക്കാം."</string>
@@ -403,12 +461,18 @@
     <string name="power_remaining_less_than_duration" msgid="1812668275239801236">"<xliff:g id="THRESHOLD">%1$s</xliff:g>-ൽ കുറവ് സമയം ശേഷിക്കുന്നു (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_more_than_subtext" msgid="7919119719242734848">"<xliff:g id="TIME_REMAINING">%1$s</xliff:g>-ൽ കൂടുതൽ സമയം ശേഷിക്കുന്നു (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_only_more_than_subtext" msgid="3274496164769110480">"<xliff:g id="TIME_REMAINING">%1$s</xliff:g>-ൽ കൂടുതൽ സമയം ശേഷിക്കുന്നു"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="6583866940347159957">"ഫോൺ ഉടൻ ഷട്ട് ഡൗൺ ആയേക്കാം"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="8009177999719462724">"ടാബ്‌ലെറ്റ് ഉടൻ ഷട്ട് ഡൗൺ ആയേക്കാം"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="8320892540455268018">"ഉപകരണം ഉടൻ ഷട്ട്ഡൗൺ ആയേക്കാം"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="6186572170809116621">"ഫോൺ ഉടൻ ഷട്ട് ഡൗൺ ആയേക്കാം (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="1338758278145563121">"ടാബ്‌ലെറ്റ് ഉടൻ ഷട്ട് ഡൗൺ ആയേക്കാം (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="3699579688084774362">"ഉപകരണം ഉടൻ ഷട്ട്ഡൗൺ ആയേക്കാം (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <!-- no translation found for power_remaining_duration_only_shutdown_imminent (137330009791560774) -->
+    <skip />
+    <!-- no translation found for power_remaining_duration_only_shutdown_imminent (145489081521468132) -->
+    <skip />
+    <!-- no translation found for power_remaining_duration_only_shutdown_imminent (1070562682853942350) -->
+    <skip />
+    <!-- no translation found for power_remaining_duration_shutdown_imminent (4429259621177089719) -->
+    <skip />
+    <!-- no translation found for power_remaining_duration_shutdown_imminent (7703677921000858479) -->
+    <skip />
+    <!-- no translation found for power_remaining_duration_shutdown_imminent (4374784375644214578) -->
+    <skip />
     <string name="power_charging" msgid="6727132649743436802">"<xliff:g id="LEVEL">%1$s</xliff:g> - <xliff:g id="STATE">%2$s</xliff:g>"</string>
     <string name="power_remaining_charging_duration_only" msgid="7415639699283965818">"പൂർണ്ണമായി ചാർജാവാൻ <xliff:g id="TIME">%1$s</xliff:g> ശേഷിക്കുന്നു"</string>
     <string name="power_charging_duration" msgid="5005740040558984057">"<xliff:g id="LEVEL">%1$s</xliff:g> - പൂർണ്ണമായി ചാർജാവാൻ <xliff:g id="TIME">%2$s</xliff:g>"</string>
diff --git a/packages/SettingsLib/res/values-mn/strings.xml b/packages/SettingsLib/res/values-mn/strings.xml
index 232148a..dc57b3b 100644
--- a/packages/SettingsLib/res/values-mn/strings.xml
+++ b/packages/SettingsLib/res/values-mn/strings.xml
@@ -206,6 +206,33 @@
     <string name="enable_adb" msgid="8072776357237289039">"USB дебаг"</string>
     <string name="enable_adb_summary" msgid="3711526030096574316">"USB холбодсон үеийн согог засах горим"</string>
     <string name="clear_adb_keys" msgid="3010148733140369917">"USB дебагын зөвшөөрлийг хураах"</string>
+    <string name="enable_adb_wireless" msgid="6973226350963971018">"Утасгүй алдаа засах"</string>
+    <string name="enable_adb_wireless_summary" msgid="7344391423657093011">"Wi-Fi холбогдсон үед дебаг хийх горим"</string>
+    <string name="adb_wireless_error" msgid="721958772149779856">"Алдаа"</string>
+    <string name="adb_wireless_settings" msgid="2295017847215680229">"Утасгүй алдаа засах"</string>
+    <string name="adb_wireless_list_empty_off" msgid="1713707973837255490">"Боломжтой төхөөрөмжүүдийг харах болох ашиглахын тулд утасгүй алдаа засахыг асаана уу"</string>
+    <string name="adb_pair_method_qrcode_title" msgid="6982904096137468634">"Хурдан хариу үйлдлийн кодоор төхөөрөмжийг хослуул"</string>
+    <string name="adb_pair_method_qrcode_summary" msgid="3729901496856458634">"Хурдан хариу үйлдлийн кодын сканнерыг ашиглан шинэ төхөөрөмжүүдийг хослуулна уу"</string>
+    <string name="adb_pair_method_code_title" msgid="1122590300445142904">"Хослуулах кодоор төхөөрөмжийг хослуулна уу"</string>
+    <string name="adb_pair_method_code_summary" msgid="6370414511333685185">"Зургаан оронтой кодыг ашиглан шинэ төхөөрөмжүүдийг хослуулна уу"</string>
+    <string name="adb_paired_devices_title" msgid="5268997341526217362">"Хослуулсан төхөөрөмжүүд"</string>
+    <string name="adb_wireless_device_connected_summary" msgid="3039660790249148713">"Одоогоор холбогдсон байна"</string>
+    <string name="adb_wireless_device_details_title" msgid="7129369670526565786">"Төхөөрөмжийн дэлгэрэнгүй"</string>
+    <string name="adb_device_forget" msgid="193072400783068417">"Мартах"</string>
+    <string name="adb_device_fingerprint_title_format" msgid="291504822917843701">"Төхөөрөмжийн хурууны хээ: <xliff:g id="FINGERPRINT_PARAM">%1$s</xliff:g>"</string>
+    <string name="adb_wireless_connection_failed_title" msgid="664211177427438438">"Холболт амжилтгүй боллоо"</string>
+    <string name="adb_wireless_connection_failed_message" msgid="9213896700171602073">"<xliff:g id="DEVICE_NAME">%1$s</xliff:g>-г зөв сүлжээнд холбосон эсэхийг шалгана уу"</string>
+    <string name="adb_pairing_device_dialog_title" msgid="7141739231018530210">"Төхөөрөмжтэй хослуулах"</string>
+    <string name="adb_pairing_device_dialog_pairing_code_label" msgid="3639239786669722731">"Wi‑Fi хослуулах код"</string>
+    <string name="adb_pairing_device_dialog_failed_title" msgid="3426758947882091735">"Хослуулалт амжилтгүй боллоо"</string>
+    <string name="adb_pairing_device_dialog_failed_msg" msgid="6611097519661997148">"Төхөөрөмжийг ижил сүлжээнд холбосон эсэхийг шалгана уу."</string>
+    <string name="adb_wireless_qrcode_summary" msgid="8051414549011801917">"Хурдан хариу үйлдлийн кодыг скан хийж Wi-Fi-р төхөөрөмжийг хослуулна уу"</string>
+    <string name="adb_wireless_verifying_qrcode_text" msgid="6123192424916029207">"Төхөөрөмжийг хослуулж байна…"</string>
+    <string name="adb_qrcode_pairing_device_failed_msg" msgid="6936292092592914132">"Төхөөрөмжийг хослуулж чадсангүй. Хурдан хариу үйлдлийн код буруу эсвэл төхөөрөмжийг ижил сүлжээнд холбоогүй байна."</string>
+    <string name="adb_wireless_ip_addr_preference_title" msgid="8335132107715311730">"IP хаяг ба порт"</string>
+    <string name="adb_wireless_qrcode_pairing_title" msgid="1906409667944674707">"Хурдан хариу үйлдлийн кодыг скан хийх"</string>
+    <string name="adb_wireless_qrcode_pairing_description" msgid="8578868049289910131">"Хурдан хариу үйлдлийн кодыг скан хийж Wi-Fi-р төхөөрөмжийг хослуулна уу"</string>
+    <string name="keywords_adb_wireless" msgid="6507505581882171240">"adb, дебаг хийх, dev"</string>
     <string name="bugreport_in_power" msgid="8664089072534638709">"Алдаа мэдээлэх товчлол"</string>
     <string name="bugreport_in_power_summary" msgid="1885529649381831775">"Цэсэнд алдааны мэдэгдэл авахад зориулсан товчийг харуулах"</string>
     <string name="keep_screen_on" msgid="1187161672348797558">"Идэвхтэй байлгах"</string>
@@ -271,6 +298,8 @@
     <string name="tethering_hardware_offload_summary" msgid="7801345335142803029">"Модем болгох техник хангамжийн хурдасгуурыг боломжтой тохиолдолд ашиглах"</string>
     <string name="adb_warning_title" msgid="7708653449506485728">"USB дебаг хийхийг зөвшөөрөх үү?"</string>
     <string name="adb_warning_message" msgid="8145270656419669221">"USB дебаг нь зөвхөн хөгжүүлэлтийн зорилготой. Үүнийг өөрийн компьютер болон төхөөрөмжийн хооронд өгөгдөл хуулах, өөрийн төхөөрөмж дээр мэдэгдэлгүйгээр аппликейшн суулгах, лог датаг унших зэрэгт ашиглаж болно."</string>
+    <string name="adbwifi_warning_title" msgid="727104571653031865">"Утасгүй алдаа засахыг зөвшөөрөх үү?"</string>
+    <string name="adbwifi_warning_message" msgid="8005936574322702388">"Утасгүй алдаа засах нь зөвхөн хөгжүүлэлтийн зориулалттай. Үүнийг компьютер болон төхөөрөмж хооронд өгөгдөл хуулах, төхөөрөмждөө мэдэгдэлгүйгээр аппууд суулгах болон лог өгөгдлийг унших зэрэгт ашиглана уу."</string>
     <string name="adb_keys_warning_message" msgid="2968555274488101220">"Таны өмнө нь зөвшөөрөл өгсөн бүх компьютерээс USB дебаг хандалтыг нь хураах уу?"</string>
     <string name="dev_settings_warning_title" msgid="8251234890169074553">"Хөгжлийн тохиргоог зөвшөөрөх үү?"</string>
     <string name="dev_settings_warning_message" msgid="37741686486073668">"Эдгээр тохиргоо нь зөвхөн хөгжүүлэлтэд ашиглах зорилготой. Эдгээр нь таны төхөөрөмж буюу түүн дээрх аппликейшнүүдийг эвдрэх, буруу ажиллах шалтгаан нь болж болно."</string>
@@ -383,8 +412,7 @@
     <string name="daltonizer_mode_protanomaly" msgid="7805583306666608440">"Протаномаль (улаан-ногоон)"</string>
     <string name="daltonizer_mode_tritanomaly" msgid="7135266249220732267">"Тританомаль (цэнхэр-шар)"</string>
     <string name="accessibility_display_daltonizer_preference_title" msgid="1810693571332381974">"Өнгө тохируулах"</string>
-    <!-- no translation found for accessibility_display_daltonizer_preference_subtitle (6178138727195403796) -->
-    <skip />
+    <string name="accessibility_display_daltonizer_preference_subtitle" msgid="6178138727195403796">"Өнгөний залруулга нь өнгө ялгадаггүй хүмүүст өнгийг илүү оновчтой харахад тусалдаг"</string>
     <string name="daltonizer_type_overridden" msgid="4509604753672535721">"Давхарласан <xliff:g id="TITLE">%1$s</xliff:g>"</string>
     <string name="power_remaining_settings_home_page" msgid="4885165789445462557">"<xliff:g id="PERCENTAGE">%1$s</xliff:g> - <xliff:g id="TIME_STRING">%2$s</xliff:g>"</string>
     <string name="power_remaining_duration_only" msgid="8264199158671531431">"Ойролцоогоор <xliff:g id="TIME_REMAINING">%1$s</xliff:g> үлдсэн"</string>
@@ -403,21 +431,19 @@
     <string name="power_remaining_less_than_duration" msgid="1812668275239801236">"<xliff:g id="THRESHOLD">%1$s</xliff:g>-с бага хугацаа үлдсэн (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_more_than_subtext" msgid="7919119719242734848">"<xliff:g id="TIME_REMAINING">%1$s</xliff:g>-с их хугацаа үлдсэн (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_only_more_than_subtext" msgid="3274496164769110480">"<xliff:g id="TIME_REMAINING">%1$s</xliff:g>-с их хугацаа үлдсэн"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="6583866940347159957">"Утас удахгүй унтарна"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="8009177999719462724">"Таблет удахгүй унтарна"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="8320892540455268018">"Төхөөрөмж удахгүй унтарна"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="6186572170809116621">"Утас удахгүй унтарна (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="1338758278145563121">"Таблет удахгүй унтарна (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="3699579688084774362">"Төхөөрөмж удахгүй унтарна (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="137330009791560774">"Утас удахгүй унтарч болзошгүй"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="145489081521468132">"Таблет удахгүй унтарч болзошгүй"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="1070562682853942350">"Төхөөрөмж удахгүй унтарч болзошгүй"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="4429259621177089719">"Утас удахгүй унтарч болзошгүй (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="7703677921000858479">"Таблет удахгүй унтарч болзошгүй (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="4374784375644214578">"Төхөөрөмж удахгүй унтарч болзошгүй (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
     <string name="power_charging" msgid="6727132649743436802">"<xliff:g id="LEVEL">%1$s</xliff:g> - <xliff:g id="STATE">%2$s</xliff:g>"</string>
     <string name="power_remaining_charging_duration_only" msgid="7415639699283965818">"Цэнэглэх хүртэл үлдсэн <xliff:g id="TIME">%1$s</xliff:g>"</string>
     <string name="power_charging_duration" msgid="5005740040558984057">"<xliff:g id="LEVEL">%1$s</xliff:g> - цэнэглэх хүртэл <xliff:g id="TIME">%2$s</xliff:g>"</string>
     <string name="battery_info_status_unknown" msgid="268625384868401114">"Тодорхойгүй"</string>
     <string name="battery_info_status_charging" msgid="4279958015430387405">"Цэнэглэж байна"</string>
-    <!-- no translation found for battery_info_status_charging_fast (8027559755902954885) -->
-    <skip />
-    <!-- no translation found for battery_info_status_charging_slow (3190803837168962319) -->
-    <skip />
+    <string name="battery_info_status_charging_fast" msgid="8027559755902954885">"Хурдан цэнэглэж байна"</string>
+    <string name="battery_info_status_charging_slow" msgid="3190803837168962319">"Удаан цэнэглэж байна"</string>
     <string name="battery_info_status_discharging" msgid="6962689305413556485">"Цэнэглэхгүй байна"</string>
     <string name="battery_info_status_not_charging" msgid="8330015078868707899">"Залгаастай тул одоо цэнэглэх боломжгүй"</string>
     <string name="battery_info_status_full" msgid="4443168946046847468">"Дүүрэн"</string>
diff --git a/packages/SettingsLib/res/values-mr/strings.xml b/packages/SettingsLib/res/values-mr/strings.xml
index 8767b4f..1240c5b 100644
--- a/packages/SettingsLib/res/values-mr/strings.xml
+++ b/packages/SettingsLib/res/values-mr/strings.xml
@@ -206,6 +206,33 @@
     <string name="enable_adb" msgid="8072776357237289039">"USB डीबग करणे"</string>
     <string name="enable_adb_summary" msgid="3711526030096574316">"USB कनेक्ट केलेले असताना डीबग मोड"</string>
     <string name="clear_adb_keys" msgid="3010148733140369917">"USB डीबग करणारी प्रमाणीकरणे रीव्होक करा"</string>
+    <string name="enable_adb_wireless" msgid="6973226350963971018">"वायरलेस डीबगिंग"</string>
+    <string name="enable_adb_wireless_summary" msgid="7344391423657093011">"वाय-फाय कनेक्ट केलेले असताना डीबग मोड"</string>
+    <string name="adb_wireless_error" msgid="721958772149779856">"एरर"</string>
+    <string name="adb_wireless_settings" msgid="2295017847215680229">"वायरलेस डीबगिंग"</string>
+    <string name="adb_wireless_list_empty_off" msgid="1713707973837255490">"उपलब्ध डिव्हाइस पाहण्यासाठी आणि वापरण्यासाठी वायरलेस डीबगिंग सुरू करा"</string>
+    <string name="adb_pair_method_qrcode_title" msgid="6982904096137468634">"QR कोडसह डिव्हाइस जोडा"</string>
+    <string name="adb_pair_method_qrcode_summary" msgid="3729901496856458634">"QR कोड स्कॅनर वापरून नवीन डिव्हाइस जोडा"</string>
+    <string name="adb_pair_method_code_title" msgid="1122590300445142904">"पेअरींग कोडसह डिव्हाइस जोडा"</string>
+    <string name="adb_pair_method_code_summary" msgid="6370414511333685185">"सहा अंकी कोड वापरून नवीन डिव्हाइस जोडा"</string>
+    <string name="adb_paired_devices_title" msgid="5268997341526217362">"पेअर केलेले डिव्हाइस"</string>
+    <string name="adb_wireless_device_connected_summary" msgid="3039660790249148713">"सध्या कनेक्ट केलेले आहे"</string>
+    <string name="adb_wireless_device_details_title" msgid="7129369670526565786">"डिव्हाइस तपशील"</string>
+    <string name="adb_device_forget" msgid="193072400783068417">"विसरा"</string>
+    <string name="adb_device_fingerprint_title_format" msgid="291504822917843701">"डिव्हाइस फिंगरप्रिंट: <xliff:g id="FINGERPRINT_PARAM">%1$s</xliff:g>"</string>
+    <string name="adb_wireless_connection_failed_title" msgid="664211177427438438">"कनेक्‍ट करता आले नाही"</string>
+    <string name="adb_wireless_connection_failed_message" msgid="9213896700171602073">"<xliff:g id="DEVICE_NAME">%1$s</xliff:g> योग्य नेटवर्कशी कनेक्ट केले असल्याची खात्री करा"</string>
+    <string name="adb_pairing_device_dialog_title" msgid="7141739231018530210">"डिव्हाइससह पेअर करा"</string>
+    <string name="adb_pairing_device_dialog_pairing_code_label" msgid="3639239786669722731">"वाय-फाय पेअरींग कोड"</string>
+    <string name="adb_pairing_device_dialog_failed_title" msgid="3426758947882091735">"पेअर करता आले नाही"</string>
+    <string name="adb_pairing_device_dialog_failed_msg" msgid="6611097519661997148">"डिव्हाइस समान नेटवर्कशी कनेक्ट केले असल्याची खात्री करा."</string>
+    <string name="adb_wireless_qrcode_summary" msgid="8051414549011801917">"QR कोड स्कॅन करून वाय-फाय वापरून डिव्हाइस पेअर करा"</string>
+    <string name="adb_wireless_verifying_qrcode_text" msgid="6123192424916029207">"डिव्हाइस पेअर करत आहे…"</string>
+    <string name="adb_qrcode_pairing_device_failed_msg" msgid="6936292092592914132">"डिव्हाइस पेअर करता आले नाही. QR कोड चुकीचा होता किंवा डिव्हाइस समान नेटवर्कशी कनेक्ट केलेले नाही."</string>
+    <string name="adb_wireless_ip_addr_preference_title" msgid="8335132107715311730">"आयपी अ‍ॅड्रेस आणि पोर्ट"</string>
+    <string name="adb_wireless_qrcode_pairing_title" msgid="1906409667944674707">"QR कोड स्कॅन करा"</string>
+    <string name="adb_wireless_qrcode_pairing_description" msgid="8578868049289910131">"QR कोड स्कॅन करून वाय-फाय वापरून डिव्हाइस पेअर करा"</string>
+    <string name="keywords_adb_wireless" msgid="6507505581882171240">"ADB, डीबग, डेव्हलपर"</string>
     <string name="bugreport_in_power" msgid="8664089072534638709">"बग रिपोर्ट शॉर्टकट"</string>
     <string name="bugreport_in_power_summary" msgid="1885529649381831775">"बग रिपोर्ट घेण्यासाठी पॉवर मेनूमध्ये एक बटण दर्शवा"</string>
     <string name="keep_screen_on" msgid="1187161672348797558">"सक्रिय रहा"</string>
@@ -271,6 +298,8 @@
     <string name="tethering_hardware_offload_summary" msgid="7801345335142803029">"उपलब्ध असल्यास टेदरिंग हार्डवेअर ॲक्सिलरेशन वापरा"</string>
     <string name="adb_warning_title" msgid="7708653449506485728">"USB डीबग करण्यास अनुमती द्यायची?"</string>
     <string name="adb_warning_message" msgid="8145270656419669221">"USB डीबग करण्याचा हेतू फक्त विकास उद्देशांसाठी आहे. याचा वापर तुमचा कॉंप्युटर आणि तुमचे डिव्हाइस यांच्या दरम्यान डेटा कॉपी करण्यासाठी करा, सूचनेशिवाय तुमच्या डिव्हाइस वर अ‍ॅप्स इंस्टॉल करा आणि लॉग डेटा वाचा."</string>
+    <string name="adbwifi_warning_title" msgid="727104571653031865">"वायरलेस डीबगिंग करण्याची अनुमती द्यायची आहे का?"</string>
+    <string name="adbwifi_warning_message" msgid="8005936574322702388">"वायरलेस डीबग करण्याचा हेतू फक्त विकास उद्देशांसाठी आहे. याचा वापर तुमचा कॉंप्युटर आणि तुमचे डिव्हाइस यांच्या दरम्यान डेटा कॉपी करण्यासाठी करा, सूचनेशिवाय तुमच्या डिव्हाइसवर अ‍ॅप्स इंस्टॉल करा आणि लॉग डेटा वाचा."</string>
     <string name="adb_keys_warning_message" msgid="2968555274488101220">"तुम्ही पूर्वी ऑथोराइझ केलेल्या सर्व संगणकांवरुन USB डीबग करण्यासाठी अ‍ॅक्सेस रीव्होक करायचा?"</string>
     <string name="dev_settings_warning_title" msgid="8251234890169074553">"विकास सेटिंग्जला अनुमती द्यायची?"</string>
     <string name="dev_settings_warning_message" msgid="37741686486073668">"या सेटिंग्जचा हेतू फक्त विकास वापरासाठी आहे. त्यामुळे तुमचे डिव्हाइस आणि त्यावरील ॲप्लिकेशन ब्रेक होऊ शकतात किंवा नेहमीपेक्षा वेगळे वर्तन करू शकतात."</string>
@@ -383,8 +412,7 @@
     <string name="daltonizer_mode_protanomaly" msgid="7805583306666608440">"क्षीण रक्तवर्णांधता (लाल-हिरवा)"</string>
     <string name="daltonizer_mode_tritanomaly" msgid="7135266249220732267">"रंग दृष्टी कमतरता (निळा-पिवळा)"</string>
     <string name="accessibility_display_daltonizer_preference_title" msgid="1810693571332381974">"रंग सुधारणा"</string>
-    <!-- no translation found for accessibility_display_daltonizer_preference_subtitle (6178138727195403796) -->
-    <skip />
+    <string name="accessibility_display_daltonizer_preference_subtitle" msgid="6178138727195403796">"रंग सुधारणा ही रंगांधळेपणा असलेल्या लोकांना रंग अधिक अचूक दिसण्यात मदत करते"</string>
     <string name="daltonizer_type_overridden" msgid="4509604753672535721">"<xliff:g id="TITLE">%1$s</xliff:g> द्वारे अधिलिखित"</string>
     <string name="power_remaining_settings_home_page" msgid="4885165789445462557">"<xliff:g id="PERCENTAGE">%1$s</xliff:g> - <xliff:g id="TIME_STRING">%2$s</xliff:g>"</string>
     <string name="power_remaining_duration_only" msgid="8264199158671531431">"अंदाजे <xliff:g id="TIME_REMAINING">%1$s</xliff:g> बाकी आहे"</string>
@@ -403,21 +431,19 @@
     <string name="power_remaining_less_than_duration" msgid="1812668275239801236">"<xliff:g id="THRESHOLD">%1$s</xliff:g> पेक्षा कमी वेळ शिल्लक आहे (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_more_than_subtext" msgid="7919119719242734848">"<xliff:g id="TIME_REMAINING">%1$s</xliff:g> पेक्षा जास्त वेळ शिल्लक आहे (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_only_more_than_subtext" msgid="3274496164769110480">"<xliff:g id="TIME_REMAINING">%1$s</xliff:g> हून जास्त वेळ शिल्लक आहे"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="6583866940347159957">"फोन लवकरच बंद होऊ शकतो"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="8009177999719462724">"टॅबलेट लवकरच बंद होऊ शकतो"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="8320892540455268018">"डिव्हाइस लवकरच बंद होऊ शकते"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="6186572170809116621">"फोन लवकरच बंद होऊ शकतो (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="1338758278145563121">"टॅबलेट लवकरच बंद होऊ शकतो (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="3699579688084774362">"डिव्हाइस लवकरच बंद पडू शकते (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="137330009791560774">"फोन लवकरच बंद होऊ शकतो"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="145489081521468132">"टॅबलेट लवकरच बंद होऊ शकतो"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="1070562682853942350">"डिव्हाइस लवकरच बंद होऊ शकते"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="4429259621177089719">"फोन लवकरच बंद होऊ शकतो (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="7703677921000858479">"टॅबलेट लवकरच बंद होऊ शकतो (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="4374784375644214578">"डिव्हाइस लवकरच बंद होऊ शकते (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
     <string name="power_charging" msgid="6727132649743436802">"<xliff:g id="LEVEL">%1$s</xliff:g> - <xliff:g id="STATE">%2$s</xliff:g>"</string>
     <string name="power_remaining_charging_duration_only" msgid="7415639699283965818">"<xliff:g id="TIME">%1$s</xliff:g> पर्यंत पूर्ण चार्ज होईल"</string>
     <string name="power_charging_duration" msgid="5005740040558984057">"<xliff:g id="LEVEL">%1$s</xliff:g> - <xliff:g id="TIME">%2$s</xliff:g> पर्यंत पूर्ण चार्ज होईल"</string>
     <string name="battery_info_status_unknown" msgid="268625384868401114">"अज्ञात"</string>
     <string name="battery_info_status_charging" msgid="4279958015430387405">"चार्ज होत आहे"</string>
-    <!-- no translation found for battery_info_status_charging_fast (8027559755902954885) -->
-    <skip />
-    <!-- no translation found for battery_info_status_charging_slow (3190803837168962319) -->
-    <skip />
+    <string name="battery_info_status_charging_fast" msgid="8027559755902954885">"वेगाने चार्ज होत आहे"</string>
+    <string name="battery_info_status_charging_slow" msgid="3190803837168962319">"हळूहळू चार्ज होत आहे"</string>
     <string name="battery_info_status_discharging" msgid="6962689305413556485">"चार्ज होत नाही"</string>
     <string name="battery_info_status_not_charging" msgid="8330015078868707899">"प्लग इन केलेले आहे, आता चार्ज करू शकत नाही"</string>
     <string name="battery_info_status_full" msgid="4443168946046847468">"पूर्ण"</string>
diff --git a/packages/SettingsLib/res/values-ms/strings.xml b/packages/SettingsLib/res/values-ms/strings.xml
index b79b801..b4c3f60 100644
--- a/packages/SettingsLib/res/values-ms/strings.xml
+++ b/packages/SettingsLib/res/values-ms/strings.xml
@@ -206,6 +206,33 @@
     <string name="enable_adb" msgid="8072776357237289039">"Penyahpepijatan USB"</string>
     <string name="enable_adb_summary" msgid="3711526030096574316">"Mod nyahpepijat apabila USB disambungkan"</string>
     <string name="clear_adb_keys" msgid="3010148733140369917">"Batalkan kebenaran penyahpepijatan USB"</string>
+    <string name="enable_adb_wireless" msgid="6973226350963971018">"Penyahpepijatan wayarles"</string>
+    <string name="enable_adb_wireless_summary" msgid="7344391423657093011">"Mod penyahpepijatan apabila Wi-Fi disambungkan"</string>
+    <string name="adb_wireless_error" msgid="721958772149779856">"Ralat"</string>
+    <string name="adb_wireless_settings" msgid="2295017847215680229">"Penyahpepijatan wayarles"</string>
+    <string name="adb_wireless_list_empty_off" msgid="1713707973837255490">"Untuk melihat dan menggunakan peranti yang tersedia, hidupkan penyahpepijatan wayarles"</string>
+    <string name="adb_pair_method_qrcode_title" msgid="6982904096137468634">"Gandingkan peranti dengan kod QR"</string>
+    <string name="adb_pair_method_qrcode_summary" msgid="3729901496856458634">"Gandingkan peranti baharu menggunakan Pengimbas kod QR"</string>
+    <string name="adb_pair_method_code_title" msgid="1122590300445142904">"Gandingkan peranti dengan kod gandingan"</string>
+    <string name="adb_pair_method_code_summary" msgid="6370414511333685185">"Gandingkan peranti baharu menggunakan kod enam digit"</string>
+    <string name="adb_paired_devices_title" msgid="5268997341526217362">"Peranti gandingan"</string>
+    <string name="adb_wireless_device_connected_summary" msgid="3039660790249148713">"Tersambung pada masa ini"</string>
+    <string name="adb_wireless_device_details_title" msgid="7129369670526565786">"Butiran peranti"</string>
+    <string name="adb_device_forget" msgid="193072400783068417">"Lupakan"</string>
+    <string name="adb_device_fingerprint_title_format" msgid="291504822917843701">"Cap jari peranti: <xliff:g id="FINGERPRINT_PARAM">%1$s</xliff:g>"</string>
+    <string name="adb_wireless_connection_failed_title" msgid="664211177427438438">"Sambungan tidak berjaya"</string>
+    <string name="adb_wireless_connection_failed_message" msgid="9213896700171602073">"Pastikan <xliff:g id="DEVICE_NAME">%1$s</xliff:g> disambungkan kepada rangkaian yang betul"</string>
+    <string name="adb_pairing_device_dialog_title" msgid="7141739231018530210">"Gandingkan dengan peranti"</string>
+    <string name="adb_pairing_device_dialog_pairing_code_label" msgid="3639239786669722731">"Kod gandingan Wi‑Fi"</string>
+    <string name="adb_pairing_device_dialog_failed_title" msgid="3426758947882091735">"Gandingan tidak berjaya"</string>
+    <string name="adb_pairing_device_dialog_failed_msg" msgid="6611097519661997148">"Pastikan peranti disambungkan kepada rangkaian yang sama."</string>
+    <string name="adb_wireless_qrcode_summary" msgid="8051414549011801917">"Gandingkan peranti melalui Wi-Fi dengan mengimbas kod QR"</string>
+    <string name="adb_wireless_verifying_qrcode_text" msgid="6123192424916029207">"Menggandingkan peranti…"</string>
+    <string name="adb_qrcode_pairing_device_failed_msg" msgid="6936292092592914132">"Gagal menggandingkan peranti. Kod QR salah atau peranti tidak disambungkan kepada rangkaian yang sama."</string>
+    <string name="adb_wireless_ip_addr_preference_title" msgid="8335132107715311730">"Alamat IP &amp; Port"</string>
+    <string name="adb_wireless_qrcode_pairing_title" msgid="1906409667944674707">"Imbas kod QR"</string>
+    <string name="adb_wireless_qrcode_pairing_description" msgid="8578868049289910131">"Gandingkan peranti melalui Wi-Fi dengan mengimbas Kod QR"</string>
+    <string name="keywords_adb_wireless" msgid="6507505581882171240">"adb, debug, dev"</string>
     <string name="bugreport_in_power" msgid="8664089072534638709">"Pintasan laporan pepijat"</string>
     <string name="bugreport_in_power_summary" msgid="1885529649381831775">"Tunjukkan butang dalam menu kuasa untuk mengambil laporan pepijat"</string>
     <string name="keep_screen_on" msgid="1187161672348797558">"Tetap berjaga"</string>
@@ -271,6 +298,8 @@
     <string name="tethering_hardware_offload_summary" msgid="7801345335142803029">"Gunakan pecutan perkakasan penambatan jika tersedia"</string>
     <string name="adb_warning_title" msgid="7708653449506485728">"Benarkan penyahpepijatan USB?"</string>
     <string name="adb_warning_message" msgid="8145270656419669221">"Penyahpepijatan USB adalah dimaksudkan untuk tujuan pembangunan sahaja. Gunakannya untuk menyalin data antara komputer dan peranti anda, memasang aplikasi pada peranti anda tanpa pemberitahuan, dan membaca data log."</string>
+    <string name="adbwifi_warning_title" msgid="727104571653031865">"Benarkan penyahpepijatan wayarles?"</string>
+    <string name="adbwifi_warning_message" msgid="8005936574322702388">"Penyahpepijatan wayarles adalah dimaksudkan untuk tujuan pembangunan sahaja. Gunakannya untuk menyalin data antara komputer dengan peranti anda, memasang apl pada peranti anda tanpa pemberitahuan dan membaca data log."</string>
     <string name="adb_keys_warning_message" msgid="2968555274488101220">"Batalkan akses ke penyahpepijatan USB dari semua komputer yang anda berikan kebenaran sebelum ini?"</string>
     <string name="dev_settings_warning_title" msgid="8251234890169074553">"Benarkan tetapan pembangunan?"</string>
     <string name="dev_settings_warning_message" msgid="37741686486073668">"Tetapan ini adalah untuk penggunaan pembangunan sahaja. Peranti dan aplikasi yang terdapat padanya boleh rosak atau tidak berfungsi dengan betul."</string>
@@ -383,8 +412,7 @@
     <string name="daltonizer_mode_protanomaly" msgid="7805583306666608440">"Protanomali (merah-hijau)"</string>
     <string name="daltonizer_mode_tritanomaly" msgid="7135266249220732267">"Tritanomali (biru-kuning)"</string>
     <string name="accessibility_display_daltonizer_preference_title" msgid="1810693571332381974">"Pembetulan warna"</string>
-    <!-- no translation found for accessibility_display_daltonizer_preference_subtitle (6178138727195403796) -->
-    <skip />
+    <string name="accessibility_display_daltonizer_preference_subtitle" msgid="6178138727195403796">"Pembetulan warna membantu orang yang mengalami kebutaan warna melihat warna yang lebih tepat"</string>
     <string name="daltonizer_type_overridden" msgid="4509604753672535721">"Diatasi oleh <xliff:g id="TITLE">%1$s</xliff:g>"</string>
     <string name="power_remaining_settings_home_page" msgid="4885165789445462557">"<xliff:g id="PERCENTAGE">%1$s</xliff:g> - <xliff:g id="TIME_STRING">%2$s</xliff:g>"</string>
     <string name="power_remaining_duration_only" msgid="8264199158671531431">"Kira-kira <xliff:g id="TIME_REMAINING">%1$s</xliff:g> lagi"</string>
@@ -403,21 +431,19 @@
     <string name="power_remaining_less_than_duration" msgid="1812668275239801236">"Kurang daripada <xliff:g id="THRESHOLD">%1$s</xliff:g> lagi (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_more_than_subtext" msgid="7919119719242734848">"Lebih daripada <xliff:g id="TIME_REMAINING">%1$s</xliff:g> lagi (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_only_more_than_subtext" msgid="3274496164769110480">"Lebih daripada <xliff:g id="TIME_REMAINING">%1$s</xliff:g> lagi"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="6583866940347159957">"Telefon mungkin ditutup tidak lama lagi"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="8009177999719462724">"Tablet mungkin ditutup tidak lama lagi"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="8320892540455268018">"Peranti mungkin ditutup tidak lama lagi"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="6186572170809116621">"Telefon mungkin ditutup tidak lama lagi (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="1338758278145563121">"Tablet mungkin ditutup tidak lama lagi (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="3699579688084774362">"Peranti mungkin ditutup tidak lama lagi (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="137330009791560774">"Telefon mungkin ditutup tidak lama lagi"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="145489081521468132">"Tablet mungkin ditutup tidak lama lagi"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="1070562682853942350">"Peranti mungkin ditutup tidak lama lagi"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="4429259621177089719">"Telefon mungkin ditutup tidak lama lagi (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="7703677921000858479">"Tablet mungkin ditutup tidak lama lagi (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="4374784375644214578">"Peranti mungkin ditutup tidak lama lagi (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
     <string name="power_charging" msgid="6727132649743436802">"<xliff:g id="LEVEL">%1$s</xliff:g> - <xliff:g id="STATE">%2$s</xliff:g>"</string>
     <string name="power_remaining_charging_duration_only" msgid="7415639699283965818">"<xliff:g id="TIME">%1$s</xliff:g> lagi sehingga dicas penuh"</string>
     <string name="power_charging_duration" msgid="5005740040558984057">"<xliff:g id="LEVEL">%1$s</xliff:g> - <xliff:g id="TIME">%2$s</xliff:g> sehingga dicas"</string>
     <string name="battery_info_status_unknown" msgid="268625384868401114">"Tidak diketahui"</string>
     <string name="battery_info_status_charging" msgid="4279958015430387405">"Mengecas"</string>
-    <!-- no translation found for battery_info_status_charging_fast (8027559755902954885) -->
-    <skip />
-    <!-- no translation found for battery_info_status_charging_slow (3190803837168962319) -->
-    <skip />
+    <string name="battery_info_status_charging_fast" msgid="8027559755902954885">"Mengecas dgn cepat"</string>
+    <string name="battery_info_status_charging_slow" msgid="3190803837168962319">"Mengecas dgn prlahan"</string>
     <string name="battery_info_status_discharging" msgid="6962689305413556485">"Tidak mengecas"</string>
     <string name="battery_info_status_not_charging" msgid="8330015078868707899">"Dipalamkan, tidak boleh mengecas sekarang"</string>
     <string name="battery_info_status_full" msgid="4443168946046847468">"Penuh"</string>
diff --git a/packages/SettingsLib/res/values-my/strings.xml b/packages/SettingsLib/res/values-my/strings.xml
index b2ad664..ae8c1b9 100644
--- a/packages/SettingsLib/res/values-my/strings.xml
+++ b/packages/SettingsLib/res/values-my/strings.xml
@@ -206,6 +206,33 @@
     <string name="enable_adb" msgid="8072776357237289039">"USB အမှားရှာခြင်း"</string>
     <string name="enable_adb_summary" msgid="3711526030096574316">"USB နှင့်ချိတ်ထားလျှင် အမှားရှာဖွေဖယ်ရှားမှုစနစ် စတင်ရန်"</string>
     <string name="clear_adb_keys" msgid="3010148733140369917">"USB အမှားရှာပြင်ဆင်ခွင့်များ ပြန်ရုပ်သိမ်းခြင်း"</string>
+    <string name="enable_adb_wireless" msgid="6973226350963971018">"ကြိုးမဲ့ အမှားရှာပြင်ခြင်း"</string>
+    <string name="enable_adb_wireless_summary" msgid="7344391423657093011">"Wi-Fi ချိတ်ဆက်ထားစဉ် အမှားရှာပြင်ပုံစံ"</string>
+    <string name="adb_wireless_error" msgid="721958772149779856">"အမှား"</string>
+    <string name="adb_wireless_settings" msgid="2295017847215680229">"ကြိုးမဲ့ အမှားရှာပြင်ခြင်း"</string>
+    <string name="adb_wireless_list_empty_off" msgid="1713707973837255490">"ရနိုင်သည့် စက်ပစ္စည်းများကို ကြည့်ပြီး အသုံးပြုနိုင်ရန် ကြိုးမဲ့ အမှားရှာပြင်ခြင်းကို ဖွင့်ပါ"</string>
+    <string name="adb_pair_method_qrcode_title" msgid="6982904096137468634">"QR ကုဒ်ဖြင့် စက်ပစ္စည်းကို အတူတွဲပါ"</string>
+    <string name="adb_pair_method_qrcode_summary" msgid="3729901496856458634">"QR ကုဒ်ဖတ်စက် သုံး၍ စက်ပစ္စည်းသစ်များကို အတူတွဲပါ"</string>
+    <string name="adb_pair_method_code_title" msgid="1122590300445142904">"တွဲချိတ်ကုဒ်ဖြင့် စက်ပစ္စည်းကို အတူတွဲပါ"</string>
+    <string name="adb_pair_method_code_summary" msgid="6370414511333685185">"ဂဏန်းခြောက်လုံးကုဒ်ဖြင့် စက်ပစ္စည်းသစ်များကို အတူတွဲပါ"</string>
+    <string name="adb_paired_devices_title" msgid="5268997341526217362">"တွဲချိတ်ပြီး စက်ပစ္စည်းများ"</string>
+    <string name="adb_wireless_device_connected_summary" msgid="3039660790249148713">"လက်ရှိ ချိတ်ဆက်ထားသည်"</string>
+    <string name="adb_wireless_device_details_title" msgid="7129369670526565786">"စက်ပစ္စည်း အသေးစိတ်"</string>
+    <string name="adb_device_forget" msgid="193072400783068417">"မေ့ပစ်ရန်"</string>
+    <string name="adb_device_fingerprint_title_format" msgid="291504822917843701">"စက်ပစ္စည်း လက်ဗွေ- <xliff:g id="FINGERPRINT_PARAM">%1$s</xliff:g>"</string>
+    <string name="adb_wireless_connection_failed_title" msgid="664211177427438438">"ချိတ်ဆက်ခြင်း မအောင်မြင်ပါ"</string>
+    <string name="adb_wireless_connection_failed_message" msgid="9213896700171602073">"<xliff:g id="DEVICE_NAME">%1$s</xliff:g> သည် မှန်ကန်သည့် ကွန်ရက်သို့ ချိတ်ဆက်ထားခြင်းရှိမရှိ စစ်ဆေးပါ"</string>
+    <string name="adb_pairing_device_dialog_title" msgid="7141739231018530210">"စက်ပစ္စည်းနှင့် အတူတွဲပါ"</string>
+    <string name="adb_pairing_device_dialog_pairing_code_label" msgid="3639239786669722731">"Wi‑Fi အတူတွဲချိတ်ရန် ကုဒ်"</string>
+    <string name="adb_pairing_device_dialog_failed_title" msgid="3426758947882091735">"တွဲချိတ်ခြင်း မအောင်မြင်ပါ"</string>
+    <string name="adb_pairing_device_dialog_failed_msg" msgid="6611097519661997148">"စက်ပစ္စည်းသည် ကွန်ရက်တစ်ခုတည်းသို့ ချိတ်ဆက်ထားခြင်းရှိမရှိ စစ်ဆေးပါ။"</string>
+    <string name="adb_wireless_qrcode_summary" msgid="8051414549011801917">"QR ကုဒ် စကင်ဖတ်ခြင်းဖြင့် Wi-Fi ပေါ်တွင် စက်ပစ္စည်းကို အတူတွဲပါ"</string>
+    <string name="adb_wireless_verifying_qrcode_text" msgid="6123192424916029207">"စက်ပစ္စည်းနှင့် တွဲချိတ်နေသည်…"</string>
+    <string name="adb_qrcode_pairing_device_failed_msg" msgid="6936292092592914132">"စက်ပစ္စည်းကို အတူတွဲ၍မရပါ။ QR ကုဒ်မမှန်ပါ သို့မဟုတ် စက်ပစ္စည်းသည် ကွန်ရက်တစ်ခုတည်းသို့ ချိတ်ဆက်မထားပါ။"</string>
+    <string name="adb_wireless_ip_addr_preference_title" msgid="8335132107715311730">"အိုင်ပီ (IP) လိပ်စာနှင့် ပို့တ်"</string>
+    <string name="adb_wireless_qrcode_pairing_title" msgid="1906409667944674707">"QR ကုဒ်ကို စကင်ဖတ်ပါ"</string>
+    <string name="adb_wireless_qrcode_pairing_description" msgid="8578868049289910131">"QR ကုဒ် စကင်ဖတ်ခြင်းဖြင့် Wi-Fi ပေါ်တွင် စက်ပစ္စည်းကို အတူတွဲပါ"</string>
+    <string name="keywords_adb_wireless" msgid="6507505581882171240">"adb, debug, dev"</string>
     <string name="bugreport_in_power" msgid="8664089072534638709">"ချွတ်ယွင်းမှု အစီရင်ခံရန် ဖြတ်လမ်း"</string>
     <string name="bugreport_in_power_summary" msgid="1885529649381831775">"ချွတ်ယွင်းမှု အစီရင်ခံစာကို တင်ရန် ပါဝါမီနူးမှ ခလုတ်ကို ပြပါ"</string>
     <string name="keep_screen_on" msgid="1187161672348797558">"ဖွင့်လျက်သား"</string>
@@ -271,6 +298,8 @@
     <string name="tethering_hardware_offload_summary" msgid="7801345335142803029">"အရှိန်မြှင့်တင်ရန် မိုဘိုင်းဖုန်းသုံး ချိတ်ဆက်မျှဝေခြင်း စက်ပစ္စည်းကို ရနိုင်လျှင် သုံးပါ"</string>
     <string name="adb_warning_title" msgid="7708653449506485728">"USB ပြသနာရှာခြင်း ခွင့်ပြုပါမလား?"</string>
     <string name="adb_warning_message" msgid="8145270656419669221">"USBအမှားရှားခြင်းမှာ ဆော့ဝဲလ်ရေးသားရန်အတွက်သာ ရည်ရွယ်ပါသည်။ သင့်ကွန်ပြုတာနှင့်သင့်စက်ကြားတွင် ဒေတာများကိုကူးယူရန်၊ အကြောင်းမကြားပဲနှင့် သင့်စက်အတွင်းသို့ အပလီကေးရှင်းများထည့်သွင်းခြင်းနှင့် ဒေတာမှတ်တမ်းများဖတ်ရန်အတွက် အသုံးပြုပါ"</string>
+    <string name="adbwifi_warning_title" msgid="727104571653031865">"ကြိုးမဲ့ အမှားရှာပြင်ခြင်းကို ခွင့်ပြုမလား။"</string>
+    <string name="adbwifi_warning_message" msgid="8005936574322702388">"ကြိုးမဲ့ အမှားရှာပြင်ခြင်းကို ဆော့ဖ်ဝဲရေးရန်အတွက်သာ ရည်ရွယ်ပါသည်။ သင့်ကွန်ပျူတာနှင့် စက်ပစ္စည်းကြားတွင် ဒေတာများကို ကူးယူရန်၊ အကြောင်းမကြားဘဲ သင့်စက်ပစ္စည်းတွင် အက်ပ်ထည့်သွင်းရန်နှင့် ဒေတာမှတ်တမ်းဖတ်ရန်အတွက် ၎င်းကို အသုံးပြုပါ။"</string>
     <string name="adb_keys_warning_message" msgid="2968555274488101220">"သင် ယခင်က ခွင့်ပြုခဲ့သော ကွန်ပျူတာအားလုံးမှ ယူအက်စ်ဘီ အမှားစစ်ခွင့်ကို ရုတ်သိမ်းမည်လား ?"</string>
     <string name="dev_settings_warning_title" msgid="8251234890169074553">"တည်ဆောက်ပြုပြင်ရန်ဆက်တင်များကို အသုံးပြုခွင့်ပေးမည်လား?"</string>
     <string name="dev_settings_warning_message" msgid="37741686486073668">"ဤဆက်တင်းများကို တည်ဆောက်ပြုပြင်ရာတွင် သုံးရန်အတွက်သာ ရည်ရွယ်သည်။ ၎င်းတို့သည် သင်၏စက်နှင့် အပလီကေးရှင်းများကို ရပ်စေခြင်း သို့ လုပ်ဆောင်ချက်မမှန်ကန်ခြင်းများ ဖြစ်ပေါ်စေနိုင်သည်။"</string>
@@ -383,8 +412,7 @@
     <string name="daltonizer_mode_protanomaly" msgid="7805583306666608440">"Protanomaly (အနီ-အစိမ်း)"</string>
     <string name="daltonizer_mode_tritanomaly" msgid="7135266249220732267">"Tritanomaly (အပြာ-အဝါ)"</string>
     <string name="accessibility_display_daltonizer_preference_title" msgid="1810693571332381974">"အရောင်ပြင်ဆင်မှု"</string>
-    <!-- no translation found for accessibility_display_daltonizer_preference_subtitle (6178138727195403796) -->
-    <skip />
+    <string name="accessibility_display_daltonizer_preference_subtitle" msgid="6178138727195403796">"အရောင်ပြင်ဆင်ခြင်းက အရောင်မကွဲသူများအတွက် ပိုမိုတိကျသော အရောင်များ ကြည့်နိုင်ရန် ကူညီပေးသည်"</string>
     <string name="daltonizer_type_overridden" msgid="4509604753672535721">"<xliff:g id="TITLE">%1$s</xliff:g> မှ ကျော်၍ လုပ်ထားသည်။"</string>
     <string name="power_remaining_settings_home_page" msgid="4885165789445462557">"<xliff:g id="PERCENTAGE">%1$s</xliff:g> - <xliff:g id="TIME_STRING">%2$s</xliff:g>"</string>
     <string name="power_remaining_duration_only" msgid="8264199158671531431">"<xliff:g id="TIME_REMAINING">%1$s</xliff:g> ခန့် ကျန်သည်"</string>
@@ -403,21 +431,19 @@
     <string name="power_remaining_less_than_duration" msgid="1812668275239801236">"<xliff:g id="THRESHOLD">%1$s</xliff:g> အောက်သာ ကျန်သည် (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_more_than_subtext" msgid="7919119719242734848">"<xliff:g id="TIME_REMAINING">%1$s</xliff:g> ကျော် ကျန်သည် (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_only_more_than_subtext" msgid="3274496164769110480">"<xliff:g id="TIME_REMAINING">%1$s</xliff:g> ကျော် ကျန်သေးသည်"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="6583866940347159957">"မကြာမီ ဖုန်းပိတ်သွားနိုင်သည်"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="8009177999719462724">"မကြာမီ တက်ဘလက်ပိတ်သွားနိုင်သည်"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="8320892540455268018">"မကြာမီ စက်ပိတ်သွားနိုင်သည်"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="6186572170809116621">"မကြာမီ ဖုန်းပိတ်သွားနိုင်သည် (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="1338758278145563121">"မကြာမီ တက်ဘလက် ပိတ်သွားနိုင်သည် (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="3699579688084774362">"မကြာမီ စက်ပိတ်သွားနိုင်သည် (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="137330009791560774">"မကြာမီ ဖုန်းပိတ်သွားနိုင်သည်"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="145489081521468132">"မကြာမီ တက်ဘလက် ပိတ်သွားနိုင်သည်"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="1070562682853942350">"မကြာမီ စက်ပိတ်သွားနိုင်သည်"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="4429259621177089719">"မကြာမီ ဖုန်းပိတ်သွားနိုင်သည် (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="7703677921000858479">"မကြာမီ တက်ဘလက် ပိတ်သွားနိုင်သည် (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="4374784375644214578">"မကြာမီ စက်ပိတ်သွားနိုင်သည် (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
     <string name="power_charging" msgid="6727132649743436802">"<xliff:g id="LEVEL">%1$s</xliff:g> - <xliff:g id="STATE">%2$s</xliff:g>"</string>
     <string name="power_remaining_charging_duration_only" msgid="7415639699283965818">"အားပြည့်ရန် <xliff:g id="TIME">%1$s</xliff:g> ကျန်သည်"</string>
     <string name="power_charging_duration" msgid="5005740040558984057">"<xliff:g id="LEVEL">%1$s</xliff:g> - အားပြည့်ရန် <xliff:g id="TIME">%2$s</xliff:g> ကျန်သည်"</string>
     <string name="battery_info_status_unknown" msgid="268625384868401114">"မသိ"</string>
     <string name="battery_info_status_charging" msgid="4279958015430387405">"အားသွင်းနေပါသည်"</string>
-    <!-- no translation found for battery_info_status_charging_fast (8027559755902954885) -->
-    <skip />
-    <!-- no translation found for battery_info_status_charging_slow (3190803837168962319) -->
-    <skip />
+    <string name="battery_info_status_charging_fast" msgid="8027559755902954885">"အမြန် အားသွင်းနေသည်"</string>
+    <string name="battery_info_status_charging_slow" msgid="3190803837168962319">"နှေးကွေးစွာ အားသွင်း"</string>
     <string name="battery_info_status_discharging" msgid="6962689305413556485">"အားသွင်းမနေပါ"</string>
     <string name="battery_info_status_not_charging" msgid="8330015078868707899">"ပလပ်ထိုးထားသောကြောင့် ယခုအားသွင်း၍ မရသေးပါ"</string>
     <string name="battery_info_status_full" msgid="4443168946046847468">"အပြည့်"</string>
diff --git a/packages/SettingsLib/res/values-nb/strings.xml b/packages/SettingsLib/res/values-nb/strings.xml
index 6a1f158..960398d 100644
--- a/packages/SettingsLib/res/values-nb/strings.xml
+++ b/packages/SettingsLib/res/values-nb/strings.xml
@@ -206,6 +206,33 @@
     <string name="enable_adb" msgid="8072776357237289039">"USB-feilsøking"</string>
     <string name="enable_adb_summary" msgid="3711526030096574316">"Feilsøkingsmodus når USB kobles til"</string>
     <string name="clear_adb_keys" msgid="3010148733140369917">"USB-feilsøking – opphev autorisasjon"</string>
+    <string name="enable_adb_wireless" msgid="6973226350963971018">"Trådløs feilsøking"</string>
+    <string name="enable_adb_wireless_summary" msgid="7344391423657093011">"Feilsøkingsmodus når Wi-Fi er tilkoblet"</string>
+    <string name="adb_wireless_error" msgid="721958772149779856">"Feil"</string>
+    <string name="adb_wireless_settings" msgid="2295017847215680229">"Trådløs feilsøking"</string>
+    <string name="adb_wireless_list_empty_off" msgid="1713707973837255490">"For å se og bruke tilgjengelige enheter, slå på trådløs feilsøking"</string>
+    <string name="adb_pair_method_qrcode_title" msgid="6982904096137468634">"Koble til enheten med en QR-kode"</string>
+    <string name="adb_pair_method_qrcode_summary" msgid="3729901496856458634">"Koble til nye enheter med en QR-kodeskanner"</string>
+    <string name="adb_pair_method_code_title" msgid="1122590300445142904">"Koble til enheten med en tilkoblingskode"</string>
+    <string name="adb_pair_method_code_summary" msgid="6370414511333685185">"Koble til nye enheter med en sekssifret kode"</string>
+    <string name="adb_paired_devices_title" msgid="5268997341526217362">"Tilkoblede enheter"</string>
+    <string name="adb_wireless_device_connected_summary" msgid="3039660790249148713">"Tilkoblet nå"</string>
+    <string name="adb_wireless_device_details_title" msgid="7129369670526565786">"Enhetsdetaljer"</string>
+    <string name="adb_device_forget" msgid="193072400783068417">"Glem"</string>
+    <string name="adb_device_fingerprint_title_format" msgid="291504822917843701">"Enhetens fingeravtrykk: <xliff:g id="FINGERPRINT_PARAM">%1$s</xliff:g>"</string>
+    <string name="adb_wireless_connection_failed_title" msgid="664211177427438438">"Tilkoblingen mislyktes"</string>
+    <string name="adb_wireless_connection_failed_message" msgid="9213896700171602073">"Sørg for at <xliff:g id="DEVICE_NAME">%1$s</xliff:g> er koblet til riktig nettverk"</string>
+    <string name="adb_pairing_device_dialog_title" msgid="7141739231018530210">"Koble til enheten"</string>
+    <string name="adb_pairing_device_dialog_pairing_code_label" msgid="3639239786669722731">"Wi‑Fi-tilkoblingskode"</string>
+    <string name="adb_pairing_device_dialog_failed_title" msgid="3426758947882091735">"Tilkoblingen mislyktes"</string>
+    <string name="adb_pairing_device_dialog_failed_msg" msgid="6611097519661997148">"Sørg for at enheten er koblet til samme nettverk."</string>
+    <string name="adb_wireless_qrcode_summary" msgid="8051414549011801917">"Koble til enheten via Wi-Fi ved å skanne en QR-kode"</string>
+    <string name="adb_wireless_verifying_qrcode_text" msgid="6123192424916029207">"Kobler til enheten …"</string>
+    <string name="adb_qrcode_pairing_device_failed_msg" msgid="6936292092592914132">"Kunne ikke koble til enheten. Enten var QR-koden feil, eller enheten er ikke koblet til samme nettverk."</string>
+    <string name="adb_wireless_ip_addr_preference_title" msgid="8335132107715311730">"IP-adresse og port"</string>
+    <string name="adb_wireless_qrcode_pairing_title" msgid="1906409667944674707">"Skann QR-koden"</string>
+    <string name="adb_wireless_qrcode_pairing_description" msgid="8578868049289910131">"Koble til enheten via Wi-Fi ved å skanne en QR-kode"</string>
+    <string name="keywords_adb_wireless" msgid="6507505581882171240">"adb, feilsøking, utvikler"</string>
     <string name="bugreport_in_power" msgid="8664089072534638709">"Snarvei til feilrapport"</string>
     <string name="bugreport_in_power_summary" msgid="1885529649381831775">"Vis en knapp for generering av feilrapport i batterimenyen"</string>
     <string name="keep_screen_on" msgid="1187161672348797558">"Forbli våken"</string>
@@ -271,6 +298,8 @@
     <string name="tethering_hardware_offload_summary" msgid="7801345335142803029">"Bruk maskinvareakselerasjon for internettdeling hvis det er tilgjengelig"</string>
     <string name="adb_warning_title" msgid="7708653449506485728">"Tillate USB-feilsøking?"</string>
     <string name="adb_warning_message" msgid="8145270656419669221">"USB-feilsøking er bare ment for utviklingsformål. Bruk det til å kopiere data mellom datamaskinen og enheten, installere apper på enheten uten varsel og lese loggdata."</string>
+    <string name="adbwifi_warning_title" msgid="727104571653031865">"Vil du tillate trådløs feilsøking?"</string>
+    <string name="adbwifi_warning_message" msgid="8005936574322702388">"Trådløs feilsøking er bare ment for utviklingsformål. Bruk det til å kopiere data mellom datamaskinen og enheten, installere apper på enheten uten varsel og lese loggdata."</string>
     <string name="adb_keys_warning_message" msgid="2968555274488101220">"Vil du oppheve tilgangen til USB-feilsøking fra alle datamaskiner du tidligere har autorisert?"</string>
     <string name="dev_settings_warning_title" msgid="8251234890169074553">"Vil du aktivere utviklingsinnstillingene?"</string>
     <string name="dev_settings_warning_message" msgid="37741686486073668">"Disse innstillingene er bare beregnet for bruk under programutvikling. De kan forårsake problemer med enheten din og tilhørende apper."</string>
@@ -383,8 +412,7 @@
     <string name="daltonizer_mode_protanomaly" msgid="7805583306666608440">"Protanomali (rød-grønn)"</string>
     <string name="daltonizer_mode_tritanomaly" msgid="7135266249220732267">"Tritanomali (blå-gul)"</string>
     <string name="accessibility_display_daltonizer_preference_title" msgid="1810693571332381974">"Fargekorrigering"</string>
-    <!-- no translation found for accessibility_display_daltonizer_preference_subtitle (6178138727195403796) -->
-    <skip />
+    <string name="accessibility_display_daltonizer_preference_subtitle" msgid="6178138727195403796">"Med fargekorrigering kan personer med fargeblindhet se mer nøyaktige farger"</string>
     <string name="daltonizer_type_overridden" msgid="4509604753672535721">"Overstyres av <xliff:g id="TITLE">%1$s</xliff:g>"</string>
     <string name="power_remaining_settings_home_page" msgid="4885165789445462557">"<xliff:g id="PERCENTAGE">%1$s</xliff:g> – <xliff:g id="TIME_STRING">%2$s</xliff:g>"</string>
     <string name="power_remaining_duration_only" msgid="8264199158671531431">"Omtrent <xliff:g id="TIME_REMAINING">%1$s</xliff:g> gjenstår"</string>
@@ -403,21 +431,19 @@
     <string name="power_remaining_less_than_duration" msgid="1812668275239801236">"Mindre enn <xliff:g id="THRESHOLD">%1$s</xliff:g> gjenstår (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_more_than_subtext" msgid="7919119719242734848">"Mer enn <xliff:g id="TIME_REMAINING">%1$s</xliff:g> gjenstår (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_only_more_than_subtext" msgid="3274496164769110480">"Mer enn <xliff:g id="TIME_REMAINING">%1$s</xliff:g> gjenstår"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="6583866940347159957">"Telefonen slås kanskje av snart"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="8009177999719462724">"Nettbrettet slås kanskje av snart"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="8320892540455268018">"Enheten slås kanskje av snart"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="6186572170809116621">"Telefonen slås kanskje av snart (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="1338758278145563121">"Nettbrettet slås kanskje av snart (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="3699579688084774362">"Enheten slås kanskje av snart (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="137330009791560774">"Telefonen slås kanskje av snart"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="145489081521468132">"Nettbrettet slås kanskje av snart"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="1070562682853942350">"Enheten slås kanskje av snart"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="4429259621177089719">"Telefonen slås kanskje av snart (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="7703677921000858479">"Nettbrettet slås kanskje av snart (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="4374784375644214578">"Enheten slås kanskje av snart (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
     <string name="power_charging" msgid="6727132649743436802">"<xliff:g id="LEVEL">%1$s</xliff:g> – <xliff:g id="STATE">%2$s</xliff:g>"</string>
     <string name="power_remaining_charging_duration_only" msgid="7415639699283965818">"<xliff:g id="TIME">%1$s</xliff:g> til batteriet er fulladet"</string>
     <string name="power_charging_duration" msgid="5005740040558984057">"<xliff:g id="LEVEL">%1$s</xliff:g> – <xliff:g id="TIME">%2$s</xliff:g> til batteriet er fulladet"</string>
     <string name="battery_info_status_unknown" msgid="268625384868401114">"Ukjent"</string>
     <string name="battery_info_status_charging" msgid="4279958015430387405">"Lader"</string>
-    <!-- no translation found for battery_info_status_charging_fast (8027559755902954885) -->
-    <skip />
-    <!-- no translation found for battery_info_status_charging_slow (3190803837168962319) -->
-    <skip />
+    <string name="battery_info_status_charging_fast" msgid="8027559755902954885">"Lader raskt"</string>
+    <string name="battery_info_status_charging_slow" msgid="3190803837168962319">"Lader sakte"</string>
     <string name="battery_info_status_discharging" msgid="6962689305413556485">"Lader ikke"</string>
     <string name="battery_info_status_not_charging" msgid="8330015078868707899">"Laderen er koblet til – kan ikke lade akkurat nå"</string>
     <string name="battery_info_status_full" msgid="4443168946046847468">"Fullt"</string>
diff --git a/packages/SettingsLib/res/values-ne/strings.xml b/packages/SettingsLib/res/values-ne/strings.xml
index 9cd5e20..e11f02d 100644
--- a/packages/SettingsLib/res/values-ne/strings.xml
+++ b/packages/SettingsLib/res/values-ne/strings.xml
@@ -206,6 +206,33 @@
     <string name="enable_adb" msgid="8072776357237289039">"USB डिबग गर्दै"</string>
     <string name="enable_adb_summary" msgid="3711526030096574316">"USB जडित हुँदा डिबग मोड"</string>
     <string name="clear_adb_keys" msgid="3010148733140369917">"USB डिबग गर्ने प्राधिकरणहरू उल्टाउनुहोस्"</string>
+    <string name="enable_adb_wireless" msgid="6973226350963971018">"वायरलेस डिबग गर्ने प्रक्रिया"</string>
+    <string name="enable_adb_wireless_summary" msgid="7344391423657093011">"Wi‑Fi मा जोडिँदा डिबग मोड सक्षम पार्ने कि नपार्ने"</string>
+    <string name="adb_wireless_error" msgid="721958772149779856">"त्रुटि"</string>
+    <string name="adb_wireless_settings" msgid="2295017847215680229">"वायरलेस डिबग गर्ने प्रक्रिया"</string>
+    <string name="adb_wireless_list_empty_off" msgid="1713707973837255490">"उपलब्ध यन्त्रहरू हेर्न र प्रयोग गर्न वायरलेस डिबग गर्ने प्रक्रिया सक्रिय गर्नुहोस्"</string>
+    <string name="adb_pair_method_qrcode_title" msgid="6982904096137468634">"QR कोडमार्फत यन्त्रको जोडा बनाउनुहोस्"</string>
+    <string name="adb_pair_method_qrcode_summary" msgid="3729901496856458634">"QR कोड स्क्यानर प्रयोग गरी नयाँ यन्त्रहरूको जोडा बनाउनुहोस्"</string>
+    <string name="adb_pair_method_code_title" msgid="1122590300445142904">"जोडा मिलाउने कोडमार्फत यन्त्रको जोडा बनाउनुहोस्"</string>
+    <string name="adb_pair_method_code_summary" msgid="6370414511333685185">"छ अङ्कको कोड प्रयोग गरी नयाँ यन्त्रहरूको जोडा बनाउनुहोस्"</string>
+    <string name="adb_paired_devices_title" msgid="5268997341526217362">"जोडा बनाइएका यन्त्रहरू"</string>
+    <string name="adb_wireless_device_connected_summary" msgid="3039660790249148713">"हाल जोडिएको छ"</string>
+    <string name="adb_wireless_device_details_title" msgid="7129369670526565786">"यन्त्रसम्बन्धी विवरणहरू"</string>
+    <string name="adb_device_forget" msgid="193072400783068417">"बिर्सनुहोस्"</string>
+    <string name="adb_device_fingerprint_title_format" msgid="291504822917843701">"यन्त्रको फिंगरप्रिन्ट: <xliff:g id="FINGERPRINT_PARAM">%1$s</xliff:g>"</string>
+    <string name="adb_wireless_connection_failed_title" msgid="664211177427438438">"वायरलेसमा जोड्न सकिएन"</string>
+    <string name="adb_wireless_connection_failed_message" msgid="9213896700171602073">"<xliff:g id="DEVICE_NAME">%1$s</xliff:g> सही नेटवर्कमा जोडिएको कुरा सुनिश्चित गर्नुहोस्"</string>
+    <string name="adb_pairing_device_dialog_title" msgid="7141739231018530210">"यन्त्रसँग जोडा बनाउनुहोस्"</string>
+    <string name="adb_pairing_device_dialog_pairing_code_label" msgid="3639239786669722731">"Wi‑Fi सँग जोडा मिलाउने कोड"</string>
+    <string name="adb_pairing_device_dialog_failed_title" msgid="3426758947882091735">"जोडा बनाउने प्रक्रिया सफल भएन"</string>
+    <string name="adb_pairing_device_dialog_failed_msg" msgid="6611097519661997148">"यन्त्र उही नेटवर्कमा जोडिएको कुरा सुनिश्चित गर्नुहोस्।"</string>
+    <string name="adb_wireless_qrcode_summary" msgid="8051414549011801917">"QR कोड स्क्यान गरेर Wi‑Fi प्रयोग गरी यन्त्रको जोडा बनाउनुहोस्"</string>
+    <string name="adb_wireless_verifying_qrcode_text" msgid="6123192424916029207">"यन्त्रसँग जोडा मिलाउँदै…"</string>
+    <string name="adb_qrcode_pairing_device_failed_msg" msgid="6936292092592914132">"यन्त्रसँग जोडा बनाउन सकिएन। कि त QR कोड गलत छ कि यन्त्र उही नेटवर्कमा जोडिएको छैन।"</string>
+    <string name="adb_wireless_ip_addr_preference_title" msgid="8335132107715311730">"IP ठेगाना र पोर्ट"</string>
+    <string name="adb_wireless_qrcode_pairing_title" msgid="1906409667944674707">"QR कोड स्क्यान गर्नुहोस्"</string>
+    <string name="adb_wireless_qrcode_pairing_description" msgid="8578868049289910131">"QR कोड स्क्यान गरेर Wi‑Fi प्रयोग गरी यन्त्रको जोडा बनाउनुहोस्"</string>
+    <string name="keywords_adb_wireless" msgid="6507505581882171240">"adb, debug, dev"</string>
     <string name="bugreport_in_power" msgid="8664089072534638709">"बग प्रतिवेदन सर्टकट"</string>
     <string name="bugreport_in_power_summary" msgid="1885529649381831775">"बग रिपोर्ट लिनका लागि पावर मेनुमा बटन देखाउनुहोस्"</string>
     <string name="keep_screen_on" msgid="1187161672348797558">"जागा रहनुहोस्"</string>
@@ -271,6 +298,8 @@
     <string name="tethering_hardware_offload_summary" msgid="7801345335142803029">"उपलब्ध भएमा टेदरिङको लागि हार्डवेयरको प्रवेग प्रयोग गर्नुहोस्"</string>
     <string name="adb_warning_title" msgid="7708653449506485728">"USB डिबग गर्न लागि अनुमति दिने हो?"</string>
     <string name="adb_warning_message" msgid="8145270656419669221">"युएसबी डिबगिङ विकास प्रयोजनका लागि मात्र निर्मित हुन्छ। यसलाई तपाईँको कम्प्युटर र तपाईँको उपकरणका बीच डेटा प्रतिलिपि गर्न, बिना सूचना तपाईँको उपकरणमा अनुप्रयोगहरू स्थापना गर्न र लग डेटा पढ्नका लागि प्रयोग गर्नुहोस्।"</string>
+    <string name="adbwifi_warning_title" msgid="727104571653031865">"वायरलेस डिबग गर्ने प्रक्रिया सक्षम पार्ने हो?"</string>
+    <string name="adbwifi_warning_message" msgid="8005936574322702388">"वायरलेस डिबग गर्ने प्रक्रिया विकास प्रयोजनका लागि मात्रै हो। यसलाई आफ्ना कम्प्युटर र उपकरणका बिच डेटा प्रतिलिपि गर्न, सूचना नदिई आफ्नो उपकरणमा अनुप्रयोगहरू स्थापना गर्न र लगसम्बन्धी डेटा रिड गर्नका लागि प्रयोग गर्नुहोस्।"</string>
     <string name="adb_keys_warning_message" msgid="2968555274488101220">"तपाईं पहिले नै अधिकृत गर्नुभएका सबै कम्प्यूटरबाट USB डिबग गर्नको लागि पहुँच रद्द गर्ने हो?"</string>
     <string name="dev_settings_warning_title" msgid="8251234890169074553">"विकास सेटिङहरू अनुमति दिने हो?"</string>
     <string name="dev_settings_warning_message" msgid="37741686486073668">"यी सेटिङहरू केवल विकास प्रयोगको लागि विचार गरिएको हो। तिनीहरूले तपाईंको उपकरण र अनुप्रयोगहरूलाई विच्छेदन गर्न वा दुर्व्यवहार गर्न सक्दछ।"</string>
@@ -383,8 +412,7 @@
     <string name="daltonizer_mode_protanomaly" msgid="7805583306666608440">"प्रोटानेमली (रातो, हरियो)"</string>
     <string name="daltonizer_mode_tritanomaly" msgid="7135266249220732267">"ट्रिटानोमेली (निलो-पंहेलो)"</string>
     <string name="accessibility_display_daltonizer_preference_title" msgid="1810693571332381974">"रङ्ग सुधार"</string>
-    <!-- no translation found for accessibility_display_daltonizer_preference_subtitle (6178138727195403796) -->
-    <skip />
+    <string name="accessibility_display_daltonizer_preference_subtitle" msgid="6178138727195403796">"रङ सुधार गर्नुले रङ छुट्याउन नसक्ने मान्छेलाई थप सटीक रूपमा रङहरू छुट्याउन मद्दत गर्दछ"</string>
     <string name="daltonizer_type_overridden" msgid="4509604753672535721">"<xliff:g id="TITLE">%1$s</xliff:g> द्वारा अधिरोहित"</string>
     <string name="power_remaining_settings_home_page" msgid="4885165789445462557">"<xliff:g id="PERCENTAGE">%1$s</xliff:g> - <xliff:g id="TIME_STRING">%2$s</xliff:g>"</string>
     <string name="power_remaining_duration_only" msgid="8264199158671531431">"लगभग <xliff:g id="TIME_REMAINING">%1$s</xliff:g> बाँकी छ"</string>
@@ -403,21 +431,19 @@
     <string name="power_remaining_less_than_duration" msgid="1812668275239801236">"<xliff:g id="THRESHOLD">%1$s</xliff:g> भन्दा कम समय बाँकी (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_more_than_subtext" msgid="7919119719242734848">"<xliff:g id="TIME_REMAINING">%1$s</xliff:g> भन्दा बढी समय बाँकी (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_only_more_than_subtext" msgid="3274496164769110480">"<xliff:g id="TIME_REMAINING">%1$s</xliff:g> भन्दा बढी समय बाँकी"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="6583866940347159957">"फोन चाँडै बन्द हुन सक्छ"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="8009177999719462724">"ट्याब्लेट चाँडै बन्द हुन सक्छ"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="8320892540455268018">"यन्त्र चाँडै बन्द हुन सक्छ"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="6186572170809116621">"फोन चाँडै बन्द हुन सक्छ (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="1338758278145563121">"ट्याब्लेट चाँडै बन्द हुन सक्छ (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="3699579688084774362">"यन्त्र चाँडै बन्द हुन सक्छ (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="137330009791560774">"फोन चाँडै बन्द हुन सक्छ"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="145489081521468132">"ट्याब्लेट चाँडै बन्द हुन सक्छ"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="1070562682853942350">"यन्त्र चाँडै बन्द हुन सक्छ"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="4429259621177089719">"फोन चाँडै बन्द हुन सक्छ (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="7703677921000858479">"ट्याब्लेट चाँडै बन्द हुन सक्छ (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="4374784375644214578">"यन्त्र चाँडै बन्द हुन सक्छ (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
     <string name="power_charging" msgid="6727132649743436802">"<xliff:g id="LEVEL">%1$s</xliff:g> - <xliff:g id="STATE">%2$s</xliff:g>"</string>
     <string name="power_remaining_charging_duration_only" msgid="7415639699283965818">"पूर्ण चार्ज हुन <xliff:g id="TIME">%1$s</xliff:g> बाँकी"</string>
     <string name="power_charging_duration" msgid="5005740040558984057">"पूर्ण चार्ज हुन <xliff:g id="LEVEL">%1$s</xliff:g> - <xliff:g id="TIME">%2$s</xliff:g> लाग्छ"</string>
     <string name="battery_info_status_unknown" msgid="268625384868401114">"अज्ञात"</string>
     <string name="battery_info_status_charging" msgid="4279958015430387405">"चार्ज हुँदै"</string>
-    <!-- no translation found for battery_info_status_charging_fast (8027559755902954885) -->
-    <skip />
-    <!-- no translation found for battery_info_status_charging_slow (3190803837168962319) -->
-    <skip />
+    <string name="battery_info_status_charging_fast" msgid="8027559755902954885">"द्रुत गतिमा चार्ज गरिँदै"</string>
+    <string name="battery_info_status_charging_slow" msgid="3190803837168962319">"बिस्तारै चार्ज गरिँदै"</string>
     <string name="battery_info_status_discharging" msgid="6962689305413556485">"चार्ज भइरहेको छैन"</string>
     <string name="battery_info_status_not_charging" msgid="8330015078868707899">"प्लगइन गरिएको छ, अहिले नै चार्ज गर्न सकिँदैन"</string>
     <string name="battery_info_status_full" msgid="4443168946046847468">"पूर्ण चार्ज भएको स्थिति"</string>
diff --git a/packages/SettingsLib/res/values-nl/strings.xml b/packages/SettingsLib/res/values-nl/strings.xml
index 8d5dea4..e79784c 100644
--- a/packages/SettingsLib/res/values-nl/strings.xml
+++ b/packages/SettingsLib/res/values-nl/strings.xml
@@ -206,6 +206,33 @@
     <string name="enable_adb" msgid="8072776357237289039">"USB-foutopsporing"</string>
     <string name="enable_adb_summary" msgid="3711526030096574316">"Foutopsporingsmodus bij USB-verbinding"</string>
     <string name="clear_adb_keys" msgid="3010148733140369917">"Autorisatie USB-foutopsporing intrekken"</string>
+    <string name="enable_adb_wireless" msgid="6973226350963971018">"Draadloze foutopsporing"</string>
+    <string name="enable_adb_wireless_summary" msgid="7344391423657093011">"Foutopsporingsmodus als wifi is verbonden"</string>
+    <string name="adb_wireless_error" msgid="721958772149779856">"Fout"</string>
+    <string name="adb_wireless_settings" msgid="2295017847215680229">"Draadloze foutopsporing"</string>
+    <string name="adb_wireless_list_empty_off" msgid="1713707973837255490">"Schakel draadloze foutopsporing in om beschikbare apparaten te bekijken en te gebruiken"</string>
+    <string name="adb_pair_method_qrcode_title" msgid="6982904096137468634">"Apparaat koppelen met QR-code"</string>
+    <string name="adb_pair_method_qrcode_summary" msgid="3729901496856458634">"Nieuwe apparaten koppelen via QR-codescanner"</string>
+    <string name="adb_pair_method_code_title" msgid="1122590300445142904">"Apparaat koppelen met koppelingscode"</string>
+    <string name="adb_pair_method_code_summary" msgid="6370414511333685185">"Nieuwe apparaten koppelen via een zescijferige code"</string>
+    <string name="adb_paired_devices_title" msgid="5268997341526217362">"Gekoppelde apparaten"</string>
+    <string name="adb_wireless_device_connected_summary" msgid="3039660790249148713">"Momenteel verbonden"</string>
+    <string name="adb_wireless_device_details_title" msgid="7129369670526565786">"Apparaatgegevens"</string>
+    <string name="adb_device_forget" msgid="193072400783068417">"Vergeten"</string>
+    <string name="adb_device_fingerprint_title_format" msgid="291504822917843701">"Vingerafdruk van apparaat: <xliff:g id="FINGERPRINT_PARAM">%1$s</xliff:g>"</string>
+    <string name="adb_wireless_connection_failed_title" msgid="664211177427438438">"Verbinding mislukt"</string>
+    <string name="adb_wireless_connection_failed_message" msgid="9213896700171602073">"Zorg dat <xliff:g id="DEVICE_NAME">%1$s</xliff:g> is verbonden met het juiste netwerk"</string>
+    <string name="adb_pairing_device_dialog_title" msgid="7141739231018530210">"Koppelen aan apparaat"</string>
+    <string name="adb_pairing_device_dialog_pairing_code_label" msgid="3639239786669722731">"Wifi-koppelingscode"</string>
+    <string name="adb_pairing_device_dialog_failed_title" msgid="3426758947882091735">"Koppeling mislukt"</string>
+    <string name="adb_pairing_device_dialog_failed_msg" msgid="6611097519661997148">"Zorg dat het apparaat is verbonden met hetzelfde netwerk."</string>
+    <string name="adb_wireless_qrcode_summary" msgid="8051414549011801917">"Apparaat koppelen via wifi door een QR-code te scannen"</string>
+    <string name="adb_wireless_verifying_qrcode_text" msgid="6123192424916029207">"Apparaat koppelen…"</string>
+    <string name="adb_qrcode_pairing_device_failed_msg" msgid="6936292092592914132">"Kan het apparaat niet koppelen. De QR-code was onjuist of het apparaat is niet verbonden met hetzelfde netwerk."</string>
+    <string name="adb_wireless_ip_addr_preference_title" msgid="8335132107715311730">"IP-adres en poort"</string>
+    <string name="adb_wireless_qrcode_pairing_title" msgid="1906409667944674707">"QR-code scannen"</string>
+    <string name="adb_wireless_qrcode_pairing_description" msgid="8578868049289910131">"Apparaat koppelen via wifi door een QR-code te scannen"</string>
+    <string name="keywords_adb_wireless" msgid="6507505581882171240">"adb, foutopsporing, ontwikkeling"</string>
     <string name="bugreport_in_power" msgid="8664089072534638709">"Snelle link naar bugrapport"</string>
     <string name="bugreport_in_power_summary" msgid="1885529649381831775">"Een knop in het voedingsmenu weergeven om een bugrapport te maken"</string>
     <string name="keep_screen_on" msgid="1187161672348797558">"Stand-by"</string>
@@ -271,6 +298,8 @@
     <string name="tethering_hardware_offload_summary" msgid="7801345335142803029">"Hardwareversnelling voor tethering gebruiken indien beschikbaar"</string>
     <string name="adb_warning_title" msgid="7708653449506485728">"USB-foutopsporing toestaan?"</string>
     <string name="adb_warning_message" msgid="8145270656419669221">"USB-foutopsporing is alleen bedoeld voor ontwikkeldoeleinden. Het kan worden gebruikt om gegevens te kopiëren tussen je computer en je apparaat, apps zonder melding op je apparaat te installeren en loggegevens te lezen."</string>
+    <string name="adbwifi_warning_title" msgid="727104571653031865">"Draadloze foutopsporing toestaan?"</string>
+    <string name="adbwifi_warning_message" msgid="8005936574322702388">"Draadloze foutopsporing is alleen bedoeld voor ontwikkeldoeleinden. Het kan worden gebruikt om gegevens te kopiëren tussen je computer en je apparaat, apps zonder melding op je apparaat te installeren en logboekgegevens te lezen."</string>
     <string name="adb_keys_warning_message" msgid="2968555274488101220">"Toegang tot USB-foutopsporing intrekken voor alle computers waarvoor je dit eerder hebt toegestaan?"</string>
     <string name="dev_settings_warning_title" msgid="8251234890169074553">"Ontwikkelingsinstellingen toestaan?"</string>
     <string name="dev_settings_warning_message" msgid="37741686486073668">"Deze instellingen zijn uitsluitend bedoeld voor ontwikkelingsgebruik. Je apparaat en apps kunnen hierdoor vastlopen of anders reageren."</string>
@@ -383,8 +412,7 @@
     <string name="daltonizer_mode_protanomaly" msgid="7805583306666608440">"Protanomalie (rood-groen)"</string>
     <string name="daltonizer_mode_tritanomaly" msgid="7135266249220732267">"Tritanomalie (blauw-geel)"</string>
     <string name="accessibility_display_daltonizer_preference_title" msgid="1810693571332381974">"Kleurcorrectie"</string>
-    <!-- no translation found for accessibility_display_daltonizer_preference_subtitle (6178138727195403796) -->
-    <skip />
+    <string name="accessibility_display_daltonizer_preference_subtitle" msgid="6178138727195403796">"Met behulp van kleurcorrectie kunnen mensen die kleurenblind zijn, nauwkeurigere kleuren te zien krijgen"</string>
     <string name="daltonizer_type_overridden" msgid="4509604753672535721">"Overschreven door <xliff:g id="TITLE">%1$s</xliff:g>"</string>
     <string name="power_remaining_settings_home_page" msgid="4885165789445462557">"<xliff:g id="PERCENTAGE">%1$s</xliff:g> - <xliff:g id="TIME_STRING">%2$s</xliff:g>"</string>
     <string name="power_remaining_duration_only" msgid="8264199158671531431">"Nog ongeveer <xliff:g id="TIME_REMAINING">%1$s</xliff:g>"</string>
@@ -403,21 +431,19 @@
     <string name="power_remaining_less_than_duration" msgid="1812668275239801236">"Nog minder dan <xliff:g id="THRESHOLD">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_more_than_subtext" msgid="7919119719242734848">"Nog meer dan <xliff:g id="TIME_REMAINING">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_only_more_than_subtext" msgid="3274496164769110480">"Nog meer dan <xliff:g id="TIME_REMAINING">%1$s</xliff:g>"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="6583866940347159957">"Telefoon wordt binnenkort mogelijk uitgeschakeld"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="8009177999719462724">"Tablet wordt binnenkort mogelijk uitgeschakeld"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="8320892540455268018">"Apparaat wordt binnenkort mogelijk uitgeschakeld"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="6186572170809116621">"Telefoon wordt binnenkort mogelijk uitgeschakeld (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="1338758278145563121">"Tablet wordt binnenkort mogelijk uitgeschakeld (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="3699579688084774362">"Apparaat wordt binnenkort mogelijk uitgeschakeld (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="137330009791560774">"Telefoon wordt binnenkort mogelijk uitgeschakeld"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="145489081521468132">"Tablet wordt binnenkort mogelijk uitgeschakeld"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="1070562682853942350">"Apparaat wordt binnenkort mogelijk uitgeschakeld"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="4429259621177089719">"Telefoon wordt binnenkort mogelijk uitgeschakeld (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="7703677921000858479">"Tablet wordt binnenkort mogelijk uitgeschakeld (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="4374784375644214578">"Apparaat wordt binnenkort mogelijk uitgeschakeld (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
     <string name="power_charging" msgid="6727132649743436802">"<xliff:g id="LEVEL">%1$s</xliff:g> - <xliff:g id="STATE">%2$s</xliff:g>"</string>
     <string name="power_remaining_charging_duration_only" msgid="7415639699283965818">"Nog <xliff:g id="TIME">%1$s</xliff:g> tot opgeladen"</string>
     <string name="power_charging_duration" msgid="5005740040558984057">"<xliff:g id="LEVEL">%1$s</xliff:g> - <xliff:g id="TIME">%2$s</xliff:g> tot opgeladen"</string>
     <string name="battery_info_status_unknown" msgid="268625384868401114">"Onbekend"</string>
     <string name="battery_info_status_charging" msgid="4279958015430387405">"Opladen"</string>
-    <!-- no translation found for battery_info_status_charging_fast (8027559755902954885) -->
-    <skip />
-    <!-- no translation found for battery_info_status_charging_slow (3190803837168962319) -->
-    <skip />
+    <string name="battery_info_status_charging_fast" msgid="8027559755902954885">"Snel opladen"</string>
+    <string name="battery_info_status_charging_slow" msgid="3190803837168962319">"Langzaam opladen"</string>
     <string name="battery_info_status_discharging" msgid="6962689305413556485">"Wordt niet opgeladen"</string>
     <string name="battery_info_status_not_charging" msgid="8330015078868707899">"Aangesloten, kan nu niet opladen"</string>
     <string name="battery_info_status_full" msgid="4443168946046847468">"Volledig"</string>
diff --git a/packages/SettingsLib/res/values-or/strings.xml b/packages/SettingsLib/res/values-or/strings.xml
index c0489c1..7e7c22d 100644
--- a/packages/SettingsLib/res/values-or/strings.xml
+++ b/packages/SettingsLib/res/values-or/strings.xml
@@ -206,6 +206,33 @@
     <string name="enable_adb" msgid="8072776357237289039">"USB ଡିବଗ୍‌ ହେଉଛି"</string>
     <string name="enable_adb_summary" msgid="3711526030096574316">"USB ସଂଯୁକ୍ତ ହେବାବେଳେ ଡିବଗ୍‌ ମୋଡ୍‌"</string>
     <string name="clear_adb_keys" msgid="3010148733140369917">"USB ଡିବଗିଙ୍ଗ ଅଧିକାରକୁ କାଢ଼ିଦିଅନ୍ତୁ"</string>
+    <string name="enable_adb_wireless" msgid="6973226350963971018">"ୱେୟାରଲେସ୍ ଡିବଗିଂ"</string>
+    <string name="enable_adb_wireless_summary" msgid="7344391423657093011">"ୱାଇ-ଫାଇ ସଂଯୁକ୍ତ ଥିବା ବେଳେ ଡିବଗ୍ ମୋଡ୍"</string>
+    <string name="adb_wireless_error" msgid="721958772149779856">"ତ୍ରୁଟି"</string>
+    <string name="adb_wireless_settings" msgid="2295017847215680229">"ୱେୟାରଲେସ୍ ଡିବଗିଂ"</string>
+    <string name="adb_wireless_list_empty_off" msgid="1713707973837255490">"ଉପଲବ୍ଧ ଡିଭାଇସଗୁଡ଼ିକୁ ଦେଖିବାକୁ ଏବଂ ବ୍ୟବହାର କରିବାକୁ ୱେୟାରଲେସ୍ ଡିବଗିଂ ଚାଲୁ କରନ୍ତୁ"</string>
+    <string name="adb_pair_method_qrcode_title" msgid="6982904096137468634">"QR କୋଡରେ ଡିଭାଇସକୁ ପେୟାର୍ କରନ୍ତୁ"</string>
+    <string name="adb_pair_method_qrcode_summary" msgid="3729901496856458634">"QR କୋଡ୍ ସ୍କାନର୍ ବ୍ୟବହାର କରି ନୂଆ ଡିଭାଇସଗୁଡ଼ିକୁ ପେୟାର୍ କରନ୍ତୁ"</string>
+    <string name="adb_pair_method_code_title" msgid="1122590300445142904">"ପେୟାରିଂ କୋଡରେ ଡିଭାଇସକୁ ପେୟାର୍ କରନ୍ତୁ"</string>
+    <string name="adb_pair_method_code_summary" msgid="6370414511333685185">"ଛଅ ଡିଜିଟ୍ କୋଡ୍ ବ୍ୟବହାର କରି ନୂଆ ଡିଭାଇସଗୁଡ଼ିକୁ ପେୟାର୍ କରନ୍ତୁ"</string>
+    <string name="adb_paired_devices_title" msgid="5268997341526217362">"ପେୟାର୍ ହୋଇଥିବା ଡିଭାଇସଗୁଡ଼ିକ"</string>
+    <string name="adb_wireless_device_connected_summary" msgid="3039660790249148713">"ବର୍ତ୍ତମାନ ସଂଯୁକ୍ତ ଅଛି"</string>
+    <string name="adb_wireless_device_details_title" msgid="7129369670526565786">"ଡିଭାଇସ୍ ବିବରଣୀ"</string>
+    <string name="adb_device_forget" msgid="193072400783068417">"ଭୁଲିଗଲେ"</string>
+    <string name="adb_device_fingerprint_title_format" msgid="291504822917843701">"ଡିଭାଇସ୍ ଫିଙ୍ଗରପ୍ରିଣ୍ଟ: <xliff:g id="FINGERPRINT_PARAM">%1$s</xliff:g>"</string>
+    <string name="adb_wireless_connection_failed_title" msgid="664211177427438438">"ସଂଯୋଗ ବିଫଳ ହେଲା"</string>
+    <string name="adb_wireless_connection_failed_message" msgid="9213896700171602073">"<xliff:g id="DEVICE_NAME">%1$s</xliff:g> ଫୋନ୍ ନେଟୱାର୍କ ସହ ସଂଯୁକ୍ତ ଥିବା ସୁନିଶ୍ଚିତ କରନ୍ତୁ"</string>
+    <string name="adb_pairing_device_dialog_title" msgid="7141739231018530210">"ଡିଭାଇସରୁ ପେୟାର୍ କରନ୍ତୁ"</string>
+    <string name="adb_pairing_device_dialog_pairing_code_label" msgid="3639239786669722731">"ୱାଇ-ଫାଇ ପେୟାରିଂ କୋଡ୍"</string>
+    <string name="adb_pairing_device_dialog_failed_title" msgid="3426758947882091735">"ପେୟାରିଂ ବିଫଳ ହେଲା"</string>
+    <string name="adb_pairing_device_dialog_failed_msg" msgid="6611097519661997148">"ଡିଭାଇସଟି ସମାନ ନେଟୱାର୍କରେ ସଂଯୋଗ ହୋଇଥିବା ସୁନିଶ୍ଚିତ କରନ୍ତୁ।"</string>
+    <string name="adb_wireless_qrcode_summary" msgid="8051414549011801917">"ଏକ QR କୋଡ୍ ସ୍କାନ୍ କରି ୱାଇ-ଫାଇରେ ଡିଭାଇସ୍ ପେୟାର୍ କରନ୍ତୁ"</string>
+    <string name="adb_wireless_verifying_qrcode_text" msgid="6123192424916029207">"ଡିଭାଇସ୍ ପେୟାର୍ କରାଯାଉଛି…"</string>
+    <string name="adb_qrcode_pairing_device_failed_msg" msgid="6936292092592914132">"ଡିଭାଇସରୁ ପେୟାର୍ ହେବାରେ ବିଫଳ ହୋଇଛି। QR କୋଡ୍ ସଠିକ୍ ନଥିଲା ବା ଡିଭାଇସ୍ ସମାନ ନେଟୱାର୍କରେ ସଂଯୋଗ ହୋଇନାହିଁ।"</string>
+    <string name="adb_wireless_ip_addr_preference_title" msgid="8335132107715311730">"IP ଠିକଣା ଓ ପୋର୍ଟ"</string>
+    <string name="adb_wireless_qrcode_pairing_title" msgid="1906409667944674707">"QR କୋଡ୍ ସ୍କାନ୍ କରନ୍ତୁ"</string>
+    <string name="adb_wireless_qrcode_pairing_description" msgid="8578868049289910131">"ଏକ QR କୋଡ୍ ସ୍କାନ୍ କରି ୱାଇ-ଫାଇରେ ଡିଭାଇସ୍ ପେୟାର୍ କରନ୍ତୁ"</string>
+    <string name="keywords_adb_wireless" msgid="6507505581882171240">"adb, ଡିବଗ୍, dev"</string>
     <string name="bugreport_in_power" msgid="8664089072534638709">"ବଗ୍ ରିପୋର୍ଟ ସର୍ଟକଟ୍‌"</string>
     <string name="bugreport_in_power_summary" msgid="1885529649381831775">"ବଗ୍ ରିପୋର୍ଟ ଦେବାପାଇଁ ପାୱାର୍‌ ମେନୁରେ ଏକ ବଟନ୍‌ ଦେଖନ୍ତୁ"</string>
     <string name="keep_screen_on" msgid="1187161672348797558">"ଜାଗ୍ରତ ରଖନ୍ତୁ"</string>
@@ -271,6 +298,8 @@
     <string name="tethering_hardware_offload_summary" msgid="7801345335142803029">"ଯଦି ଉପଲବ୍ଧ ଥାଏ, ଟିଥରିଙ୍ଗ ହାର୍ଡୱେର୍‌ ଆକ୍ସିଲିରେସନ୍ ବ୍ୟବହାର କରନ୍ତୁ"</string>
     <string name="adb_warning_title" msgid="7708653449506485728">"USB ଡିବଗିଙ୍ଗ କରିବେ?"</string>
     <string name="adb_warning_message" msgid="8145270656419669221">"USB ଡିବଗିଂ କେବଳ ଡେଭଲପମେଣ୍ଟ ଉଦ୍ଦେଶ୍ୟ ପାଇଁ ଉଦ୍ଦିଷ୍ଟ ଅଟେ। ଆପଣଙ୍କ କମ୍ପ୍ୟୁଟର ଏବଂ ଡିଭାଇସ୍‌ ମଧ୍ୟରେ ଡାଟା କପି କରିବାକୁ, ବିନା ବିଜ୍ଞପ୍ତିରେ ଆପଣଙ୍କ ଡିଭାଇସରେ ଆପସ୍‌ ସଂସ୍ଥାପନ କରିବାକୁ, ଏବଂ ଲଗ୍‌ ଡାଟା ପଢିବାକୁ ଏହା ବ୍ୟବହାର କରନ୍ତୁ।"</string>
+    <string name="adbwifi_warning_title" msgid="727104571653031865">"ୱେୟାରଲେସ୍ ଡିବଗିଂ ପାଇଁ ଅନୁମତି ଦେବେ?"</string>
+    <string name="adbwifi_warning_message" msgid="8005936574322702388">"ୱେୟାରଲେସ୍ ଡିବଗିଂ କେବଳ ଉନ୍ନତି ଉଦ୍ଦେଶ୍ୟ ପାଇଁ ଉଦ୍ଦିଷ୍ଟ ଅଟେ। ଆପଣଙ୍କ କମ୍ପ୍ୟୁଟର ଏବଂ ଡିଭାଇସ୍ ମଧ୍ୟରେ ଡାଟା କପି କରିବାକୁ, ବିନା ବିଜ୍ଞପ୍ତିରେ ଆପଣଙ୍କ ଡିଭାଇସରେ ଆପ୍ସ ଇନଷ୍ଟଲ୍ କରିବାକୁ ଏବଂ ଲଗ୍ ଡାଟା ପଢ଼ିବା ପାଇଁ ଏହାକୁ ବ୍ୟବହାର କରନ୍ତୁ।"</string>
     <string name="adb_keys_warning_message" msgid="2968555274488101220">"ଅଧିକୃତ ସମସ୍ତ କମ୍ପ୍ୟୁଟରରୁ USB ଡିବଗ୍‌ କରିବା ଆକ୍ସେସ୍‌ ପ୍ରତ୍ୟାହାର କରିବେ କି?"</string>
     <string name="dev_settings_warning_title" msgid="8251234890169074553">"ଡେଭଲପମେଣ୍ଟ ସେଟିଙ୍ଗ ଅନୁମତି ଦେବେ?"</string>
     <string name="dev_settings_warning_message" msgid="37741686486073668">"ଏହି ସେଟିଙ୍ଗଗୁଡ଼ିକ କେବଳ ବିକାଶ ବ୍ୟବହାର ପାଇଁ ଉଦ୍ଦିଷ୍ଟ। ସେଗୁଡ଼ିକ କାରଣରୁ ଆପଣଙ୍କ ଡିଭାଇସ୍‌ ଓ ଆପ୍ଲିକେଶନ୍‍‍ଗୁଡ଼ିକ ଠିକ୍‌ ଭାବେ କାମ ନକରିପାରେ।"</string>
@@ -383,8 +412,7 @@
     <string name="daltonizer_mode_protanomaly" msgid="7805583306666608440">"ପ୍ରୋଟାନୋମାଲି (ଲାଲ୍‌-ସବୁଜ)"</string>
     <string name="daltonizer_mode_tritanomaly" msgid="7135266249220732267">"Tritanomaly (ନୀଳ-ହଳଦିଆ)"</string>
     <string name="accessibility_display_daltonizer_preference_title" msgid="1810693571332381974">"ରଙ୍ଗ ସଠିକତା"</string>
-    <!-- no translation found for accessibility_display_daltonizer_preference_subtitle (6178138727195403796) -->
-    <skip />
+    <string name="accessibility_display_daltonizer_preference_subtitle" msgid="6178138727195403796">"ରଙ୍ଗ ଚିହ୍ନିବାରେ ସମସ୍ୟା ଥିବା ଲୋକମାନଙ୍କୁ କଲର୍ କରେକ୍ସନ୍ ସଠିକ୍ ରଙ୍ଗ ଦେଖିବାରେ ସାହାଯ୍ୟ କରିଥାଏ"</string>
     <string name="daltonizer_type_overridden" msgid="4509604753672535721">"<xliff:g id="TITLE">%1$s</xliff:g> ଦ୍ୱାରା ଓଭର୍‌ରାଇଡ୍‌ କରାଯାଇଛି"</string>
     <string name="power_remaining_settings_home_page" msgid="4885165789445462557">"<xliff:g id="PERCENTAGE">%1$s</xliff:g> - <xliff:g id="TIME_STRING">%2$s</xliff:g>"</string>
     <string name="power_remaining_duration_only" msgid="8264199158671531431">"ପାଖାପାଖି <xliff:g id="TIME_REMAINING">%1$s</xliff:g> ବଳକା ଅଛି"</string>
@@ -403,21 +431,19 @@
     <string name="power_remaining_less_than_duration" msgid="1812668275239801236">"<xliff:g id="THRESHOLD">%1$s</xliff:g> ରୁ କମ୍ ସମୟ ବଳକା ଅଛି (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_more_than_subtext" msgid="7919119719242734848">"<xliff:g id="TIME_REMAINING">%1$s</xliff:g>ରୁ ଅଧିକ ସମୟ ବଳକା ଅଛି(<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_only_more_than_subtext" msgid="3274496164769110480">"<xliff:g id="TIME_REMAINING">%1$s</xliff:g>ରୁ ଅଧିକ ବଳକା ଅଛି"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="6583866940347159957">"ଖୁବ୍ ଶୀଘ୍ର ଫୋନ୍‌ଟି ବନ୍ଦ ହୋଇଯାଇପାରେ"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="8009177999719462724">"ଖୁବ୍ ଶୀଘ୍ର ଟାବଲେଟ୍‌ଟି ବନ୍ଦ ହୋଇଯାଇପାରେ"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="8320892540455268018">"ଡିଭାଇସ୍ ଶୀଘ୍ର ବନ୍ଦ ହୋଇଯାଇପାରେ"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="6186572170809116621">"ଖୁବ୍ ଶୀଘ୍ର ଫୋନ୍‌ଟି ବନ୍ଦ ହୋଇଯାଇପାରେ (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="1338758278145563121">"ଖୁବ୍ ଶୀଘ୍ର ଟାବଲେଟ୍‌ଟି ବନ୍ଦ ହୋଇଯାଇପାରେ (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="3699579688084774362">"ଖୁବ୍ ଶୀଘ୍ର ଡିଭାଇସ୍‌ଟି ବନ୍ଦ ହୋଇଯାଇପାରେ(<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="137330009791560774">"ଫୋନ୍ ଶୀଘ୍ର ବନ୍ଦ ହୋଇଯାଇପାରେ"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="145489081521468132">"ଟାବଲେଟ୍ ଶୀଘ୍ର ବନ୍ଦ ହୋଇଯାଇପାରେ"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="1070562682853942350">"ଡିଭାଇସ୍ ଶୀଘ୍ର ବନ୍ଦ ହୋଇଯାଇପାରେ"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="4429259621177089719">"ଫୋନ୍ ଶୀଘ୍ର ବନ୍ଦ ହୋଇଯାଇପାରେ (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="7703677921000858479">"ଟାବଲେଟ୍ ଶୀଘ୍ର ବନ୍ଦ ହୋଇଯାଇପାରେ (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="4374784375644214578">"ଡିଭାଇସ୍ ଶୀଘ୍ର ବନ୍ଦ ହୋଇଯାଇପାରେ (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
     <string name="power_charging" msgid="6727132649743436802">"<xliff:g id="LEVEL">%1$s</xliff:g> - <xliff:g id="STATE">%2$s</xliff:g>"</string>
     <string name="power_remaining_charging_duration_only" msgid="7415639699283965818">"ଚାର୍ଜ ହେବା ପାଇଁ <xliff:g id="TIME">%1$s</xliff:g> ବାକି ଅଛି"</string>
     <string name="power_charging_duration" msgid="5005740040558984057">"<xliff:g id="LEVEL">%1$s</xliff:g> - <xliff:g id="TIME">%2$s</xliff:g> ଚାର୍ଜ ହେବା ପର୍ଯ୍ୟନ୍ତ"</string>
     <string name="battery_info_status_unknown" msgid="268625384868401114">"ଅଜ୍ଞାତ"</string>
     <string name="battery_info_status_charging" msgid="4279958015430387405">"ଚାର୍ଜ ହେଉଛି"</string>
-    <!-- no translation found for battery_info_status_charging_fast (8027559755902954885) -->
-    <skip />
-    <!-- no translation found for battery_info_status_charging_slow (3190803837168962319) -->
-    <skip />
+    <string name="battery_info_status_charging_fast" msgid="8027559755902954885">"ଶୀଘ୍ର ଚାର୍ଜ ହେଉଛି"</string>
+    <string name="battery_info_status_charging_slow" msgid="3190803837168962319">"ଧୀରେ ଚାର୍ଜ ହେଉଛି"</string>
     <string name="battery_info_status_discharging" msgid="6962689305413556485">"ଚାର୍ଜ ହେଉନାହିଁ"</string>
     <string name="battery_info_status_not_charging" msgid="8330015078868707899">"ପ୍ଲଗ୍‌ରେ ଲାଗିଛି, ହେଲେ ଏବେ ଚାର୍ଜ କରିପାରିବ ନାହିଁ"</string>
     <string name="battery_info_status_full" msgid="4443168946046847468">"ଚାର୍ଜ ସମ୍ପୂର୍ଣ୍ଣ"</string>
diff --git a/packages/SettingsLib/res/values-pa/strings.xml b/packages/SettingsLib/res/values-pa/strings.xml
index 7355418..7279f31 100644
--- a/packages/SettingsLib/res/values-pa/strings.xml
+++ b/packages/SettingsLib/res/values-pa/strings.xml
@@ -206,6 +206,33 @@
     <string name="enable_adb" msgid="8072776357237289039">"USB ਡੀਬਗਿੰਗ"</string>
     <string name="enable_adb_summary" msgid="3711526030096574316">"ਡੀਬੱਗ ਮੋਡ ਜਦੋਂ USB ਕਨੈਕਟ ਕੀਤੀ ਜਾਏ"</string>
     <string name="clear_adb_keys" msgid="3010148733140369917">"USB ਡੀਬਗਿੰਗ ਅਧਿਕਾਰ ਰੱਦ ਕਰੋ"</string>
+    <string name="enable_adb_wireless" msgid="6973226350963971018">"ਵਾਇਰਲੈੱਸ ਡੀਬੱਗਿੰਗ"</string>
+    <string name="enable_adb_wireless_summary" msgid="7344391423657093011">"ਵਾਈ-ਫਾਈ ਕਨੈਕਟ ਹੋਣ \'ਤੇ ਡੀਬੱਗ ਮੋਡ"</string>
+    <string name="adb_wireless_error" msgid="721958772149779856">"ਗੜਬੜ"</string>
+    <string name="adb_wireless_settings" msgid="2295017847215680229">"ਵਾਇਰਲੈੱਸ ਡੀਬੱਗਿੰਗ"</string>
+    <string name="adb_wireless_list_empty_off" msgid="1713707973837255490">"ਉਪਲਬਧ ਡੀਵਾਈਸਾਂ ਨੂੰ ਦੇਖਣ ਅਤੇ ਵਰਤਣ ਲਈ, ਵਾਇਰਲੈੱਸ ਡੀਬੱਗਿੰਗ ਚਾਲੂ ਕਰੋ"</string>
+    <string name="adb_pair_method_qrcode_title" msgid="6982904096137468634">"QR ਕੋਡ ਨਾਲ ਡੀਵਾਈਸ ਨੂੰ ਜੋੜਾਬੱਧ ਕਰੋ"</string>
+    <string name="adb_pair_method_qrcode_summary" msgid="3729901496856458634">"QR ਕੋਡ ਸਕੈਨਰ ਵਰਤ ਕੇ ਨਵੇਂ ਡੀਵਾਈਸਾਂ ਨੂੰ ਜੋੜਾਬੱਧ ਕਰੋ"</string>
+    <string name="adb_pair_method_code_title" msgid="1122590300445142904">"ਜੋੜਾਬੱਧਕਰਨ ਕੋਡ ਨਾਲ ਡੀਵਾਈਸ ਜੋੜਾਬੱਧ ਕਰੋ"</string>
+    <string name="adb_pair_method_code_summary" msgid="6370414511333685185">"ਛੇ ਅੰਕਾਂ ਵਾਲਾ ਕੋਡ ਵਰਤ ਕੇ ਨਵੇਂ ਡੀਵਾਈਸਾਂ ਨੂੰ ਜੋੜਾਬੱਧ ਕਰੋ"</string>
+    <string name="adb_paired_devices_title" msgid="5268997341526217362">"ਜੋੜਾਬੱਧ ਕੀਤੇ ਡੀਵਾਈਸ"</string>
+    <string name="adb_wireless_device_connected_summary" msgid="3039660790249148713">"ਇਸ ਵੇਲੇ ਕਨੈਕਟ ਹੈ"</string>
+    <string name="adb_wireless_device_details_title" msgid="7129369670526565786">"ਡੀਵਾਈਸ ਦੇ ਵੇਰਵੇ"</string>
+    <string name="adb_device_forget" msgid="193072400783068417">"ਭੁੱਲ ਜਾਓ"</string>
+    <string name="adb_device_fingerprint_title_format" msgid="291504822917843701">"ਡੀਵਾਈਸ ਫਿੰਗਰਪ੍ਰਿੰਟ: <xliff:g id="FINGERPRINT_PARAM">%1$s</xliff:g>"</string>
+    <string name="adb_wireless_connection_failed_title" msgid="664211177427438438">"ਕਨੈਕਸ਼ਨ ਅਸਫਲ"</string>
+    <string name="adb_wireless_connection_failed_message" msgid="9213896700171602073">"ਪੱਕਾ ਕਰੋ ਕਿ <xliff:g id="DEVICE_NAME">%1$s</xliff:g> ਸਹੀ ਨੈੱਟਵਰਕ ਨਾਲ ਕਨੈਕਟ ਹੈ"</string>
+    <string name="adb_pairing_device_dialog_title" msgid="7141739231018530210">"ਡੀਵਾਈਸ ਨਾਲ ਜੋੜਾਬੱਧ ਕਰੋ"</string>
+    <string name="adb_pairing_device_dialog_pairing_code_label" msgid="3639239786669722731">"ਵਾਈ-ਫਾਈ ਜੋੜਾਬੱਧਕਰਨ ਕੋਡ"</string>
+    <string name="adb_pairing_device_dialog_failed_title" msgid="3426758947882091735">"ਜੋੜਾਬੱਧ ਕਰਨਾ ਅਸਫਲ ਰਿਹਾ"</string>
+    <string name="adb_pairing_device_dialog_failed_msg" msgid="6611097519661997148">"ਪੱਕਾ ਕਰੋ ਕਿ ਡੀਵਾਈਸ ਉਸੇ ਨੈੱਟਵਰਕ ਨਾਲ ਕਨੈਕਟ ਹੈ।"</string>
+    <string name="adb_wireless_qrcode_summary" msgid="8051414549011801917">"QR ਕੋਡ ਸਕੈਨ ਕਰਕੇ ਵਾਈ-ਫਾਈ \'ਤੇ ਡੀਵਾਈਸ ਜੋੜਾਬੱਧ ਕਰੋ"</string>
+    <string name="adb_wireless_verifying_qrcode_text" msgid="6123192424916029207">"ਡੀਵਾਈਸ ਜੋੜਾਬੱਧ ਕੀਤਾ ਜਾ ਰਿਹਾ ਹੈ…"</string>
+    <string name="adb_qrcode_pairing_device_failed_msg" msgid="6936292092592914132">"ਡੀਵਾਈਸ ਨੂੰ ਜੋੜਾਬੱਧ ਕਰਨਾ ਅਸਫਲ ਰਿਹਾ। ਜਾਂ ਤਾਂ QR ਕੋਡ ਗਲਤ ਸੀ, ਜਾਂ ਡੀਵਾਈਸ ਉਸੇ ਨੈੱਟਵਰਕ ਨਾਲ ਕਨੈਕਟ ਨਹੀਂ ਹੈ।"</string>
+    <string name="adb_wireless_ip_addr_preference_title" msgid="8335132107715311730">"IP ਪਤਾ &amp; ਪੋਰਟ"</string>
+    <string name="adb_wireless_qrcode_pairing_title" msgid="1906409667944674707">"QR ਕੋਡ ਸਕੈਨ ਕਰੋ"</string>
+    <string name="adb_wireless_qrcode_pairing_description" msgid="8578868049289910131">"QR ਕੋਡ ਸਕੈਨ ਕਰਕੇ ਵਾਈ-ਫਾਈ \'ਤੇ ਡੀਵਾਈਸ ਜੋੜਾਬੱਧ ਕਰੋ"</string>
+    <string name="keywords_adb_wireless" msgid="6507505581882171240">"adb, ਡੀਬੱਗ, dev"</string>
     <string name="bugreport_in_power" msgid="8664089072534638709">"ਬੱਗ ਰਿਪੋਰਟ ਸ਼ਾਰਟਕੱਟ"</string>
     <string name="bugreport_in_power_summary" msgid="1885529649381831775">"ਇੱਕ ਬੱਗ ਰਿਪੋਰਟ ਲੈਣ ਲਈ ਪਾਵਰ ਮੀਨੂ ਵਿੱਚ ਇੱਕ ਬਟਨ ਦਿਖਾਓ"</string>
     <string name="keep_screen_on" msgid="1187161672348797558">"ਸੁਚੇਤ ਰਹੋ"</string>
@@ -271,6 +298,8 @@
     <string name="tethering_hardware_offload_summary" msgid="7801345335142803029">"ਉਪਲਬਧ ਹੋਣ \'ਤੇ ਟੈਦਰਿੰਗ ਹਾਰਡਵੇਅਰ ਐਕਸੈੱਲਰੇਸ਼ਨ ਵਰਤੋ"</string>
     <string name="adb_warning_title" msgid="7708653449506485728">"ਕੀ USB ਡੀਬਗਿੰਗ ਦੀ ਆਗਿਆ ਦੇਣੀ ਹੈ?"</string>
     <string name="adb_warning_message" msgid="8145270656419669221">"USB ਡੀਬਗਿੰਗ ਸਿਰਫ਼ ਵਿਕਾਸ ਮੰਤਵਾਂ ਲਈ ਹੁੰਦੀ ਹੈ। ਇਸਨੂੰ ਆਪਣੇ ਕੰਪਿਊਟਰ ਅਤੇ ਆਪਣੇ ਡੀਵਾਈਸ ਵਿਚਕਾਰ ਡਾਟਾ ਕਾਪੀ ਕਰਨ ਲਈ ਵਰਤੋ, ਸੂਚਨਾ ਦੇ ਬਿਨਾਂ ਆਪਣੇ ਡੀਵਾਈਸ ਤੇ ਐਪਾਂ ਸਥਾਪਤ ਕਰੋ ਅਤੇ ਲੌਗ ਡਾਟਾ ਪੜ੍ਹੋ।"</string>
+    <string name="adbwifi_warning_title" msgid="727104571653031865">"ਕੀ ਵਾਇਰਲੈੱਸ ਡੀਬੱਗਿੰਗ ਕਰਨ ਦੇਣੀ ਹੈ?"</string>
+    <string name="adbwifi_warning_message" msgid="8005936574322702388">"ਵਾਇਰਲੈੱਸ ਡੀਬੱਗਿੰਗ ਕੇਵਲ ਵਿਕਾਸ ਦੇ ਉਦੇਸ਼ਾਂ ਲਈ ਨਿਯਤ ਕੀਤੀ ਹੁੰਦੀ ਹੈ। ਇਸਨੂੰ ਆਪਣੇ ਕੰਪਿਊਟਰ ਅਤੇ ਆਪਣੇ ਡੀਵਾਈਸ ਵਿਚਕਾਰ ਡਾਟਾ ਕਾਪੀ ਕਰਨ, ਸੂਚਨਾ ਦੇ ਬਿਨਾਂ ਆਪਣੇ ਡੀਵਾਈਸ \'ਤੇ ਐਪਾਂ ਸਥਾਪਤ ਕਰਨ ਅਤੇ ਲੌਗ ਡਾਟਾ ਪੜ੍ਹਨ ਲਈ ਵਰਤੋ।"</string>
     <string name="adb_keys_warning_message" msgid="2968555274488101220">"ਕੀ ਉਹਨਾਂ ਸਾਰੇ ਕੰਪਿਊਟਰਾਂ ਤੋਂ USB ਡੀਬੱਗਿੰਗ ਤੱਕ ਪਹੁੰਚ ਰੱਦ ਕਰਨੀ ਹੈ, ਜਿਹਨਾਂ ਲਈ ਪਹਿਲਾਂ ਤੁਸੀਂ ਅਧਿਕਾਰਤ ਕੀਤਾ ਹੈ?"</string>
     <string name="dev_settings_warning_title" msgid="8251234890169074553">"ਕੀ ਵਿਕਾਸ ਸੈਟਿੰਗਾਂ ਦੀ ਆਗਿਆ ਦੇਣੀ ਹੈ?"</string>
     <string name="dev_settings_warning_message" msgid="37741686486073668">"ਇਹ ਸੈਟਿੰਗਾਂ ਕੇਵਲ ਵਿਕਾਸਕਾਰ ਦੀ ਵਰਤੋਂ ਲਈ ਹਨ। ਇਹ ਤੁਹਾਡੇ ਡੀਵਾਈਸ ਅਤੇ ਇਸਤੇ ਮੌਜੂਦ ਐਪਲੀਕੇਸ਼ਨ ਨੂੰ ਬ੍ਰੇਕ ਕਰਨ ਜਾਂ ਦੁਰਵਿਵਹਾਰ ਕਰਨ ਦਾ ਕਾਰਨ ਬਣ ਸਕਦੇ ਹਨ।"</string>
@@ -383,8 +412,7 @@
     <string name="daltonizer_mode_protanomaly" msgid="7805583306666608440">"Protanomaly (ਲਾਲ-ਹਰਾ)"</string>
     <string name="daltonizer_mode_tritanomaly" msgid="7135266249220732267">"Tritanomaly (ਨੀਲਾ-ਪੀਲਾ)"</string>
     <string name="accessibility_display_daltonizer_preference_title" msgid="1810693571332381974">"ਰੰਗ ਸੁਧਾਈ"</string>
-    <!-- no translation found for accessibility_display_daltonizer_preference_subtitle (6178138727195403796) -->
-    <skip />
+    <string name="accessibility_display_daltonizer_preference_subtitle" msgid="6178138727195403796">"ਰੰਗ ਸੁਧਾਈ ਨਾਲ ਰੰਗਾਂ ਦੇ ਅੰਨ੍ਹੇਪਣ ਦੇ ਸ਼ਿਕਾਰ ਲੋਕਾਂ ਦੀ ਵਧੇਰੇ ਸਟੀਕ ਰੰਗਾਂ ਨੂੰ ਦੇਖਣ ਵਿੱਚ ਮਦਦ ਕੀਤੀ ਜਾਂਦੀ ਹੈ"</string>
     <string name="daltonizer_type_overridden" msgid="4509604753672535721">"<xliff:g id="TITLE">%1$s</xliff:g> ਦੁਆਰਾ ਓਵਰਰਾਈਡ ਕੀਤਾ"</string>
     <string name="power_remaining_settings_home_page" msgid="4885165789445462557">"<xliff:g id="PERCENTAGE">%1$s</xliff:g> - <xliff:g id="TIME_STRING">%2$s</xliff:g>"</string>
     <string name="power_remaining_duration_only" msgid="8264199158671531431">"ਲਗਭਗ <xliff:g id="TIME_REMAINING">%1$s</xliff:g> ਬਾਕੀ"</string>
@@ -403,21 +431,19 @@
     <string name="power_remaining_less_than_duration" msgid="1812668275239801236">"<xliff:g id="THRESHOLD">%1$s</xliff:g> ਤੋਂ ਘੱਟ ਸਮਾਂ ਬਾਕੀ (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_more_than_subtext" msgid="7919119719242734848">"<xliff:g id="TIME_REMAINING">%1$s</xliff:g> ਤੋਂ ਵੱਧ ਸਮਾਂ ਬਾਕੀ (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_only_more_than_subtext" msgid="3274496164769110480">"<xliff:g id="TIME_REMAINING">%1$s</xliff:g> ਤੋਂ ਵੱਧ ਸਮਾਂ ਬਾਕੀ"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="6583866940347159957">"ਫ਼ੋਨ ਛੇਤੀ ਹੀ ਬੰਦ ਹੋ ਸਕਦਾ ਹੈ"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="8009177999719462724">"ਟੈਬਲੈੱਟ ਛੇਤੀ ਹੀ ਬੰਦ ਹੋ ਸਕਦਾ ਹੈ"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="8320892540455268018">"ਡੀਵਾਈਸ ਛੇਤੀ ਹੀ ਬੰਦ ਹੋ ਸਕਦਾ ਹੈ"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="6186572170809116621">"ਫ਼ੋਨ ਛੇਤੀ ਹੀ ਬੰਦ ਹੋ ਸਕਦਾ ਹੈ (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="1338758278145563121">"ਟੈਬਲੈੱਟ ਛੇਤੀ ਹੀ ਬੰਦ ਹੋ ਸਕਦਾ ਹੈ (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="3699579688084774362">"ਡੀਵਾਈਸ ਛੇਤੀ ਹੀ ਬੰਦ ਹੋ ਸਕਦਾ ਹੈ (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="137330009791560774">"ਫ਼ੋਨ ਛੇਤੀ ਹੀ ਬੰਦ ਹੋ ਸਕਦਾ ਹੈ"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="145489081521468132">"ਟੈਬਲੈੱਟ ਛੇਤੀ ਹੀ ਬੰਦ ਹੋ ਸਕਦਾ ਹੈ"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="1070562682853942350">"ਡੀਵਾਈਸ ਛੇਤੀ ਹੀ ਬੰਦ ਹੋ ਸਕਦਾ ਹੈ"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="4429259621177089719">"ਫ਼ੋਨ ਛੇਤੀ ਹੀ ਬੰਦ ਹੋ ਸਕਦਾ ਹੈ (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="7703677921000858479">"ਟੈਬਲੈੱਟ ਛੇਤੀ ਹੀ ਬੰਦ ਹੋ ਸਕਦਾ ਹੈ (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="4374784375644214578">"ਡੀਵਾਈਸ ਛੇਤੀ ਹੀ ਬੰਦ ਹੋ ਸਕਦਾ ਹੈ (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
     <string name="power_charging" msgid="6727132649743436802">"<xliff:g id="LEVEL">%1$s</xliff:g> - <xliff:g id="STATE">%2$s</xliff:g>"</string>
     <string name="power_remaining_charging_duration_only" msgid="7415639699283965818">"ਚਾਰਜ ਹੋਣ ਵਿੱਚ <xliff:g id="TIME">%1$s</xliff:g> ਬਾਕੀ"</string>
     <string name="power_charging_duration" msgid="5005740040558984057">"<xliff:g id="LEVEL">%1$s</xliff:g> - <xliff:g id="TIME">%2$s</xliff:g> ਤੱਕ ਚਾਰਜ ਹੋ ਜਾਵੇਗੀ"</string>
     <string name="battery_info_status_unknown" msgid="268625384868401114">"ਅਗਿਆਤ"</string>
     <string name="battery_info_status_charging" msgid="4279958015430387405">"ਚਾਰਜ ਹੋ ਰਿਹਾ ਹੈ"</string>
-    <!-- no translation found for battery_info_status_charging_fast (8027559755902954885) -->
-    <skip />
-    <!-- no translation found for battery_info_status_charging_slow (3190803837168962319) -->
-    <skip />
+    <string name="battery_info_status_charging_fast" msgid="8027559755902954885">"ਤੇਜ਼ ਚਾਰਜ ਹੋ ਰਹੀ ਹੈ"</string>
+    <string name="battery_info_status_charging_slow" msgid="3190803837168962319">"ਹੌਲੀ ਚਾਰਜ ਹੋ ਰਹੀ ਹੈ"</string>
     <string name="battery_info_status_discharging" msgid="6962689305413556485">"ਚਾਰਜ ਨਹੀਂ ਹੋ ਰਿਹਾ"</string>
     <string name="battery_info_status_not_charging" msgid="8330015078868707899">"ਪਲੱਗ ਲੱਗਾ ਹੋਇਆ ਹੈ, ਇਸ ਸਮੇਂ ਚਾਰਜ ਨਹੀਂ ਹੋ ਸਕਦੀ"</string>
     <string name="battery_info_status_full" msgid="4443168946046847468">"ਪੂਰੀ"</string>
diff --git a/packages/SettingsLib/res/values-pl/strings.xml b/packages/SettingsLib/res/values-pl/strings.xml
index a3ccb07..3b12891 100644
--- a/packages/SettingsLib/res/values-pl/strings.xml
+++ b/packages/SettingsLib/res/values-pl/strings.xml
@@ -206,6 +206,33 @@
     <string name="enable_adb" msgid="8072776357237289039">"Debugowanie USB"</string>
     <string name="enable_adb_summary" msgid="3711526030096574316">"Tryb debugowania, gdy podłączone jest USB"</string>
     <string name="clear_adb_keys" msgid="3010148733140369917">"Odwołaj dostęp do debugowania USB"</string>
+    <string name="enable_adb_wireless" msgid="6973226350963971018">"Debugowanie bezprzewodowe"</string>
+    <string name="enable_adb_wireless_summary" msgid="7344391423657093011">"Tryb debugowania przy połączeniu z Wi-Fi"</string>
+    <string name="adb_wireless_error" msgid="721958772149779856">"Błąd"</string>
+    <string name="adb_wireless_settings" msgid="2295017847215680229">"Debugowanie bezprzewodowe"</string>
+    <string name="adb_wireless_list_empty_off" msgid="1713707973837255490">"Aby wyświetlić dostępne urządzenia i ich używać, włącz debugowanie bezprzewodowe"</string>
+    <string name="adb_pair_method_qrcode_title" msgid="6982904096137468634">"Sparuj urządzenie przy pomocy kodu QR"</string>
+    <string name="adb_pair_method_qrcode_summary" msgid="3729901496856458634">"Sparuj nowe urządzenie, skanując kod QR"</string>
+    <string name="adb_pair_method_code_title" msgid="1122590300445142904">"Sparuj urządzenie przy pomocy kodu parowania"</string>
+    <string name="adb_pair_method_code_summary" msgid="6370414511333685185">"Sparuj nowe urządzenie przy pomocy 6-cyfrowego kodu"</string>
+    <string name="adb_paired_devices_title" msgid="5268997341526217362">"Sparowane urządzenia"</string>
+    <string name="adb_wireless_device_connected_summary" msgid="3039660790249148713">"Obecnie połączone"</string>
+    <string name="adb_wireless_device_details_title" msgid="7129369670526565786">"Szczegóły urządzenia"</string>
+    <string name="adb_device_forget" msgid="193072400783068417">"Zapomnij"</string>
+    <string name="adb_device_fingerprint_title_format" msgid="291504822917843701">"Odcisk cyfrowy urządzenia: <xliff:g id="FINGERPRINT_PARAM">%1$s</xliff:g>"</string>
+    <string name="adb_wireless_connection_failed_title" msgid="664211177427438438">"Nie można połączyć"</string>
+    <string name="adb_wireless_connection_failed_message" msgid="9213896700171602073">"Sprawdź, czy <xliff:g id="DEVICE_NAME">%1$s</xliff:g> jest podłączony do tej samej sieci"</string>
+    <string name="adb_pairing_device_dialog_title" msgid="7141739231018530210">"Sparuj z urządzeniem"</string>
+    <string name="adb_pairing_device_dialog_pairing_code_label" msgid="3639239786669722731">"Kod parowania Wi‑Fi"</string>
+    <string name="adb_pairing_device_dialog_failed_title" msgid="3426758947882091735">"Parowanie nie powiodło się"</string>
+    <string name="adb_pairing_device_dialog_failed_msg" msgid="6611097519661997148">"Upewnij się, że urządzenie jest podłączone do tej samej sieci."</string>
+    <string name="adb_wireless_qrcode_summary" msgid="8051414549011801917">"Sparuj urządzenia przez Wi-Fi, skanując kod QR"</string>
+    <string name="adb_wireless_verifying_qrcode_text" msgid="6123192424916029207">"Paruję urządzenie…"</string>
+    <string name="adb_qrcode_pairing_device_failed_msg" msgid="6936292092592914132">"Nie udało się sparować z urządzeniem. Kod QR jest nieprawidłowy albo urządzenie nie jest podłączone do tej samej sieci."</string>
+    <string name="adb_wireless_ip_addr_preference_title" msgid="8335132107715311730">"Adres IP i port"</string>
+    <string name="adb_wireless_qrcode_pairing_title" msgid="1906409667944674707">"Zeskanuj kod QR"</string>
+    <string name="adb_wireless_qrcode_pairing_description" msgid="8578868049289910131">"Sparuj urządzenia przez Wi-Fi, skanując kod QR"</string>
+    <string name="keywords_adb_wireless" msgid="6507505581882171240">"adb, debug, dev"</string>
     <string name="bugreport_in_power" msgid="8664089072534638709">"Skrót do zgłoszenia błędu"</string>
     <string name="bugreport_in_power_summary" msgid="1885529649381831775">"Pokaż w menu zasilania przycisk zgłaszania błędu"</string>
     <string name="keep_screen_on" msgid="1187161672348797558">"Pozostaw włączony ekran"</string>
@@ -271,6 +298,8 @@
     <string name="tethering_hardware_offload_summary" msgid="7801345335142803029">"Użyj akceleracji sprzętowej tetheringu, jeśli jest dostępna"</string>
     <string name="adb_warning_title" msgid="7708653449506485728">"Czy zezwalać na debugowanie USB?"</string>
     <string name="adb_warning_message" msgid="8145270656419669221">"Debugowanie USB jest przeznaczone wyłącznie do celów programistycznych. Może służyć do kopiowania danych między komputerem a urządzeniem, instalowania aplikacji na urządzeniu bez powiadamiania, a także odczytu danych dziennika."</string>
+    <string name="adbwifi_warning_title" msgid="727104571653031865">"Zezwalać na debugowanie bezprzewodowe?"</string>
+    <string name="adbwifi_warning_message" msgid="8005936574322702388">"Debugowanie bezprzewodowe jest przeznaczone wyłącznie do celów programistycznych. Może służyć do kopiowania danych między komputerem a urządzeniem, instalowania aplikacji na urządzeniu bez powiadamiania, a także odczytu danych dziennika."</string>
     <string name="adb_keys_warning_message" msgid="2968555274488101220">"Odwołać dostęp wszystkich poprzednio autoryzowanych komputerów do debugowania USB?"</string>
     <string name="dev_settings_warning_title" msgid="8251234890169074553">"Zezwolić na ustawienia programistyczne?"</string>
     <string name="dev_settings_warning_message" msgid="37741686486073668">"Te ustawienia są przeznaczone wyłącznie dla programistów. Ich użycie może spowodować uszkodzenie lub nieprawidłowe działanie urządzenia i zainstalowanych na nim aplikacji."</string>
@@ -383,8 +412,7 @@
     <string name="daltonizer_mode_protanomaly" msgid="7805583306666608440">"Protanomalia (czerwony-zielony)"</string>
     <string name="daltonizer_mode_tritanomaly" msgid="7135266249220732267">"Tritanomalia (niebieski-żółty)"</string>
     <string name="accessibility_display_daltonizer_preference_title" msgid="1810693571332381974">"Korekcja kolorów"</string>
-    <!-- no translation found for accessibility_display_daltonizer_preference_subtitle (6178138727195403796) -->
-    <skip />
+    <string name="accessibility_display_daltonizer_preference_subtitle" msgid="6178138727195403796">"Korekcja kolorów pomaga osobom z zaburzeniami rozpoznawania barw lepiej je widzieć"</string>
     <string name="daltonizer_type_overridden" msgid="4509604753672535721">"Nadpisana przez <xliff:g id="TITLE">%1$s</xliff:g>"</string>
     <string name="power_remaining_settings_home_page" msgid="4885165789445462557">"<xliff:g id="PERCENTAGE">%1$s</xliff:g> – <xliff:g id="TIME_STRING">%2$s</xliff:g>"</string>
     <string name="power_remaining_duration_only" msgid="8264199158671531431">"Jeszcze około <xliff:g id="TIME_REMAINING">%1$s</xliff:g>"</string>
@@ -403,21 +431,19 @@
     <string name="power_remaining_less_than_duration" msgid="1812668275239801236">"Pozostało mniej niż <xliff:g id="THRESHOLD">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_more_than_subtext" msgid="7919119719242734848">"Pozostało ponad: <xliff:g id="TIME_REMAINING">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_only_more_than_subtext" msgid="3274496164769110480">"Pozostało ponad: <xliff:g id="TIME_REMAINING">%1$s</xliff:g>"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="6583866940347159957">"Telefon może się wkrótce wyłączyć"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="8009177999719462724">"Tablet może się wkrótce wyłączyć"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="8320892540455268018">"Urządzenie może się wkrótce wyłączyć"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="6186572170809116621">"Telefon może się wkrótce wyłączyć (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="1338758278145563121">"Tablet może się wkrótce wyłączyć (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="3699579688084774362">"Urządzenie może się wkrótce wyłączyć (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="137330009791560774">"Wkrótce telefon może się wyłączyć"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="145489081521468132">"Tablet może się wkrótce wyłączyć"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="1070562682853942350">"Urządzenie może się wkrótce wyłączyć"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="4429259621177089719">"Telefon może się wkrótce wyłączyć (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="7703677921000858479">"Tablet może się wkrótce wyłączyć (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="4374784375644214578">"Urządzenie może się wkrótce wyłączyć (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
     <string name="power_charging" msgid="6727132649743436802">"<xliff:g id="LEVEL">%1$s</xliff:g> – <xliff:g id="STATE">%2$s</xliff:g>"</string>
     <string name="power_remaining_charging_duration_only" msgid="7415639699283965818">"Do naładowania <xliff:g id="TIME">%1$s</xliff:g>"</string>
     <string name="power_charging_duration" msgid="5005740040558984057">"<xliff:g id="LEVEL">%1$s</xliff:g> – do naładowania <xliff:g id="TIME">%2$s</xliff:g>"</string>
     <string name="battery_info_status_unknown" msgid="268625384868401114">"Nieznane"</string>
     <string name="battery_info_status_charging" msgid="4279958015430387405">"Ładowanie"</string>
-    <!-- no translation found for battery_info_status_charging_fast (8027559755902954885) -->
-    <skip />
-    <!-- no translation found for battery_info_status_charging_slow (3190803837168962319) -->
-    <skip />
+    <string name="battery_info_status_charging_fast" msgid="8027559755902954885">"Szybkie ładowanie"</string>
+    <string name="battery_info_status_charging_slow" msgid="3190803837168962319">"Wolne ładowanie"</string>
     <string name="battery_info_status_discharging" msgid="6962689305413556485">"Nie podłączony"</string>
     <string name="battery_info_status_not_charging" msgid="8330015078868707899">"Podłączony. Nie można teraz ładować"</string>
     <string name="battery_info_status_full" msgid="4443168946046847468">"Naładowana"</string>
diff --git a/packages/SettingsLib/res/values-pt-rBR/strings.xml b/packages/SettingsLib/res/values-pt-rBR/strings.xml
index f4182bf..5e76fe0 100644
--- a/packages/SettingsLib/res/values-pt-rBR/strings.xml
+++ b/packages/SettingsLib/res/values-pt-rBR/strings.xml
@@ -206,6 +206,33 @@
     <string name="enable_adb" msgid="8072776357237289039">"Depuração USB"</string>
     <string name="enable_adb_summary" msgid="3711526030096574316">"Modo de depuração quando o USB estiver conectado"</string>
     <string name="clear_adb_keys" msgid="3010148733140369917">"Revogar autorizações de depuração USB"</string>
+    <string name="enable_adb_wireless" msgid="6973226350963971018">"Depuração por Wi-Fi"</string>
+    <string name="enable_adb_wireless_summary" msgid="7344391423657093011">"Modo de depuração quando a rede Wi‑Fi estiver conectada"</string>
+    <string name="adb_wireless_error" msgid="721958772149779856">"Erro"</string>
+    <string name="adb_wireless_settings" msgid="2295017847215680229">"Depuração por Wi-Fi"</string>
+    <string name="adb_wireless_list_empty_off" msgid="1713707973837255490">"Para ver e usar dispositivos disponíveis, ative a depuração por Wi-Fi"</string>
+    <string name="adb_pair_method_qrcode_title" msgid="6982904096137468634">"Parear o dispositivo com um código QR"</string>
+    <string name="adb_pair_method_qrcode_summary" msgid="3729901496856458634">"Parear novos dispositivos usando um leitor de código QR"</string>
+    <string name="adb_pair_method_code_title" msgid="1122590300445142904">"Parear o dispositivo com um código de pareamento"</string>
+    <string name="adb_pair_method_code_summary" msgid="6370414511333685185">"Parear novos dispositivos usando um código de seis dígitos"</string>
+    <string name="adb_paired_devices_title" msgid="5268997341526217362">"Dispositivos pareados"</string>
+    <string name="adb_wireless_device_connected_summary" msgid="3039660790249148713">"Conectados no momento"</string>
+    <string name="adb_wireless_device_details_title" msgid="7129369670526565786">"Detalhes do dispositivo"</string>
+    <string name="adb_device_forget" msgid="193072400783068417">"Esquecer"</string>
+    <string name="adb_device_fingerprint_title_format" msgid="291504822917843701">"Impressão digital do dispositivo: <xliff:g id="FINGERPRINT_PARAM">%1$s</xliff:g>"</string>
+    <string name="adb_wireless_connection_failed_title" msgid="664211177427438438">"Falha na conexão"</string>
+    <string name="adb_wireless_connection_failed_message" msgid="9213896700171602073">"Verifique se o <xliff:g id="DEVICE_NAME">%1$s</xliff:g> está conectado à rede correta"</string>
+    <string name="adb_pairing_device_dialog_title" msgid="7141739231018530210">"Parear com o dispositivo"</string>
+    <string name="adb_pairing_device_dialog_pairing_code_label" msgid="3639239786669722731">"Código de pareamento de Wi‑Fi"</string>
+    <string name="adb_pairing_device_dialog_failed_title" msgid="3426758947882091735">"Falha no pareamento"</string>
+    <string name="adb_pairing_device_dialog_failed_msg" msgid="6611097519661997148">"Verifique se o dispositivo está conectado à mesma rede."</string>
+    <string name="adb_wireless_qrcode_summary" msgid="8051414549011801917">"Parear dispositivo na rede Wi‑Fi fazendo a leitura do código QR"</string>
+    <string name="adb_wireless_verifying_qrcode_text" msgid="6123192424916029207">"Pareando dispositivo…"</string>
+    <string name="adb_qrcode_pairing_device_failed_msg" msgid="6936292092592914132">"Falha ao parear o dispositivo. O código QR está incorreto ou o dispositivo não está conectado à mesma rede."</string>
+    <string name="adb_wireless_ip_addr_preference_title" msgid="8335132107715311730">"Endereço IP e porta"</string>
+    <string name="adb_wireless_qrcode_pairing_title" msgid="1906409667944674707">"Ler código QR"</string>
+    <string name="adb_wireless_qrcode_pairing_description" msgid="8578868049289910131">"Parear dispositivo na rede Wi‑Fi fazendo a leitura do código QR"</string>
+    <string name="keywords_adb_wireless" msgid="6507505581882171240">"adb, debug, dev"</string>
     <string name="bugreport_in_power" msgid="8664089072534638709">"Atalho para relatório de bugs"</string>
     <string name="bugreport_in_power_summary" msgid="1885529649381831775">"Mostrar um botão para gerar relatórios de bugs no menu do botão liga/desliga"</string>
     <string name="keep_screen_on" msgid="1187161672348797558">"Permanecer ativo"</string>
@@ -271,6 +298,8 @@
     <string name="tethering_hardware_offload_summary" msgid="7801345335142803029">"Usar aceleração de hardware de tethering quando disponível"</string>
     <string name="adb_warning_title" msgid="7708653449506485728">"Permitir a depuração USB?"</string>
     <string name="adb_warning_message" msgid="8145270656419669221">"A depuração USB serve apenas para fins de desenvolvimento. Use-a para copiar dados entre o computador e o dispositivo, instalar apps no seu aparelho sem notificação e ler dados de registro."</string>
+    <string name="adbwifi_warning_title" msgid="727104571653031865">"Permitir a depuração sem fio?"</string>
+    <string name="adbwifi_warning_message" msgid="8005936574322702388">"A depuração sem fio serve apenas para fins de desenvolvimento. Use-a para copiar dados entre o computador e o dispositivo, instalar apps no seu aparelho sem notificação e ler dados de registro."</string>
     <string name="adb_keys_warning_message" msgid="2968555274488101220">"Revogar o acesso à depuração USB para todos os computadores autorizados?"</string>
     <string name="dev_settings_warning_title" msgid="8251234890169074553">"Ativar as configurações de desenvolvimento?"</string>
     <string name="dev_settings_warning_message" msgid="37741686486073668">"Essas configurações são destinadas apenas para o uso de desenvolvedores. Elas podem causar a desativação ou mau funcionamento do dispositivo e dos apps contidos nele."</string>
@@ -383,8 +412,7 @@
     <string name="daltonizer_mode_protanomaly" msgid="7805583306666608440">"Protanomalia (vermelho-verde)"</string>
     <string name="daltonizer_mode_tritanomaly" msgid="7135266249220732267">"Tritanomalia (azul-amarelo)"</string>
     <string name="accessibility_display_daltonizer_preference_title" msgid="1810693571332381974">"Correção de cor"</string>
-    <!-- no translation found for accessibility_display_daltonizer_preference_subtitle (6178138727195403796) -->
-    <skip />
+    <string name="accessibility_display_daltonizer_preference_subtitle" msgid="6178138727195403796">"A correção de cores ajuda pessoas com daltonismo a ver cores de forma mais precisa"</string>
     <string name="daltonizer_type_overridden" msgid="4509604753672535721">"Substituído por <xliff:g id="TITLE">%1$s</xliff:g>"</string>
     <string name="power_remaining_settings_home_page" msgid="4885165789445462557">"<xliff:g id="PERCENTAGE">%1$s</xliff:g> - <xliff:g id="TIME_STRING">%2$s</xliff:g>"</string>
     <string name="power_remaining_duration_only" msgid="8264199158671531431">"Tempo restante aproximado: <xliff:g id="TIME_REMAINING">%1$s</xliff:g>"</string>
@@ -403,21 +431,19 @@
     <string name="power_remaining_less_than_duration" msgid="1812668275239801236">"Menos de <xliff:g id="THRESHOLD">%1$s</xliff:g> restante(s) (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_more_than_subtext" msgid="7919119719242734848">"Mais de <xliff:g id="TIME_REMAINING">%1$s</xliff:g> restante(s) (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_only_more_than_subtext" msgid="3274496164769110480">"Mais de <xliff:g id="TIME_REMAINING">%1$s</xliff:g> restante(s)"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="6583866940347159957">"O smartphone pode ser desligado em breve"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="8009177999719462724">"O tablet pode ser desligado em breve"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="8320892540455268018">"O dispositivo pode ser desligado em breve"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="6186572170809116621">"O smartphone pode ser desligado em breve (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="1338758278145563121">"O tablet pode ser desligado em breve (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="3699579688084774362">"O dispositivo pode ser desligado em breve (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="137330009791560774">"O smartphone pode ser desligado em breve"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="145489081521468132">"O tablet pode ser desligado em breve"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="1070562682853942350">"O dispositivo pode ser desligado em breve"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="4429259621177089719">"O smartphone pode ser desligado em breve (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="7703677921000858479">"O tablet pode ser desligado em breve (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="4374784375644214578">"O dispositivo pode ser desligado em breve (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
     <string name="power_charging" msgid="6727132649743436802">"<xliff:g id="LEVEL">%1$s</xliff:g> - <xliff:g id="STATE">%2$s</xliff:g>"</string>
     <string name="power_remaining_charging_duration_only" msgid="7415639699283965818">"Tempo restante até a carga completa: <xliff:g id="TIME">%1$s</xliff:g>"</string>
     <string name="power_charging_duration" msgid="5005740040558984057">"<xliff:g id="LEVEL">%1$s</xliff:g>: <xliff:g id="TIME">%2$s</xliff:g> até a carga completa"</string>
     <string name="battery_info_status_unknown" msgid="268625384868401114">"Desconhecido"</string>
     <string name="battery_info_status_charging" msgid="4279958015430387405">"Carregando"</string>
-    <!-- no translation found for battery_info_status_charging_fast (8027559755902954885) -->
-    <skip />
-    <!-- no translation found for battery_info_status_charging_slow (3190803837168962319) -->
-    <skip />
+    <string name="battery_info_status_charging_fast" msgid="8027559755902954885">"Carregando rápido"</string>
+    <string name="battery_info_status_charging_slow" msgid="3190803837168962319">"Carregando devagar"</string>
     <string name="battery_info_status_discharging" msgid="6962689305413556485">"Não está carregando"</string>
     <string name="battery_info_status_not_charging" msgid="8330015078868707899">"Conectado. Não é possível carregar no momento"</string>
     <string name="battery_info_status_full" msgid="4443168946046847468">"Carregada"</string>
diff --git a/packages/SettingsLib/res/values-pt-rPT/strings.xml b/packages/SettingsLib/res/values-pt-rPT/strings.xml
index 2f206d4..d1b29f0 100644
--- a/packages/SettingsLib/res/values-pt-rPT/strings.xml
+++ b/packages/SettingsLib/res/values-pt-rPT/strings.xml
@@ -206,6 +206,33 @@
     <string name="enable_adb" msgid="8072776357237289039">"Depuração USB"</string>
     <string name="enable_adb_summary" msgid="3711526030096574316">"Modo de depuração com USB ligado"</string>
     <string name="clear_adb_keys" msgid="3010148733140369917">"Revogar autorizações de depur. USB"</string>
+    <string name="enable_adb_wireless" msgid="6973226350963971018">"Depuração sem fios"</string>
+    <string name="enable_adb_wireless_summary" msgid="7344391423657093011">"Modo de depuração quando o Wi-Fi está ligado"</string>
+    <string name="adb_wireless_error" msgid="721958772149779856">"Erro."</string>
+    <string name="adb_wireless_settings" msgid="2295017847215680229">"Depuração sem fios"</string>
+    <string name="adb_wireless_list_empty_off" msgid="1713707973837255490">"Para ver e utilizar dispositivos disponíveis, ative a depuração sem fios."</string>
+    <string name="adb_pair_method_qrcode_title" msgid="6982904096137468634">"Sincronize o dispositivo com o código QR"</string>
+    <string name="adb_pair_method_qrcode_summary" msgid="3729901496856458634">"Sincronize novos dispositivos com o leitor de códigos QR."</string>
+    <string name="adb_pair_method_code_title" msgid="1122590300445142904">"Sincronize dispositivo com código de sincronização"</string>
+    <string name="adb_pair_method_code_summary" msgid="6370414511333685185">"Sincronize novos dispositivos através do código de seis dígitos."</string>
+    <string name="adb_paired_devices_title" msgid="5268997341526217362">"Dispositivos sincronizados"</string>
+    <string name="adb_wireless_device_connected_summary" msgid="3039660790249148713">"Atualmente ligado."</string>
+    <string name="adb_wireless_device_details_title" msgid="7129369670526565786">"Detalhes do dispositivo"</string>
+    <string name="adb_device_forget" msgid="193072400783068417">"Esquecer"</string>
+    <string name="adb_device_fingerprint_title_format" msgid="291504822917843701">"Impressão digital do dispositivo: <xliff:g id="FINGERPRINT_PARAM">%1$s</xliff:g>"</string>
+    <string name="adb_wireless_connection_failed_title" msgid="664211177427438438">"A ligação falhou"</string>
+    <string name="adb_wireless_connection_failed_message" msgid="9213896700171602073">"Certifique-se de que o dispositivo <xliff:g id="DEVICE_NAME">%1$s</xliff:g> está ligado à rede correta."</string>
+    <string name="adb_pairing_device_dialog_title" msgid="7141739231018530210">"Sincronize com o dispositivo"</string>
+    <string name="adb_pairing_device_dialog_pairing_code_label" msgid="3639239786669722731">"Código de sincronização de Wi‑Fi"</string>
+    <string name="adb_pairing_device_dialog_failed_title" msgid="3426758947882091735">"Sincronização sem êxito"</string>
+    <string name="adb_pairing_device_dialog_failed_msg" msgid="6611097519661997148">"Certifique-se de que o dispositivo está ligado à mesma rede."</string>
+    <string name="adb_wireless_qrcode_summary" msgid="8051414549011801917">"Sincronize o dispositivo através de Wi-Fi ao ler um código QR."</string>
+    <string name="adb_wireless_verifying_qrcode_text" msgid="6123192424916029207">"A sincronizar o dispositivo…"</string>
+    <string name="adb_qrcode_pairing_device_failed_msg" msgid="6936292092592914132">"Falha ao sincronizar o dispositivo. O código QR estava incorreto ou o dispositivo não está ligado à mesma rede."</string>
+    <string name="adb_wireless_ip_addr_preference_title" msgid="8335132107715311730">"Porta e endereço IP"</string>
+    <string name="adb_wireless_qrcode_pairing_title" msgid="1906409667944674707">"Leia o código QR"</string>
+    <string name="adb_wireless_qrcode_pairing_description" msgid="8578868049289910131">"Sincronize o dispositivo através de Wi-Fi ao ler um código QR."</string>
+    <string name="keywords_adb_wireless" msgid="6507505581882171240">"adb, depurar, programador"</string>
     <string name="bugreport_in_power" msgid="8664089072534638709">"Atalho para relatório de erro"</string>
     <string name="bugreport_in_power_summary" msgid="1885529649381831775">"Mostrar um botão no menu ligar/desligar para criar um relatório de erro"</string>
     <string name="keep_screen_on" msgid="1187161672348797558">"Manter ativo"</string>
@@ -271,6 +298,8 @@
     <string name="tethering_hardware_offload_summary" msgid="7801345335142803029">"Se disponível, utilizar a aceleração de hardware para ligação (à Internet) via telemóvel"</string>
     <string name="adb_warning_title" msgid="7708653449506485728">"Permitir depuração USB?"</string>
     <string name="adb_warning_message" msgid="8145270656419669221">"A depuração USB é utilizada apenas para fins de programação. Utilize-a para copiar dados entre o computador e o aparelho, instalar aplicações no aparelho sem notificação e ler dados de registo."</string>
+    <string name="adbwifi_warning_title" msgid="727104571653031865">"Pretende permitir a depuração sem fios?"</string>
+    <string name="adbwifi_warning_message" msgid="8005936574322702388">"A depuração sem fios é utilizada apenas para fins de programação. Utilize-a para copiar dados entre o computador e o dispositivo, instalar apps no dispositivo sem notificação e ler dados de registo."</string>
     <string name="adb_keys_warning_message" msgid="2968555274488101220">"Revogar acesso à depuração USB de todos os computadores anteriormente autorizados?"</string>
     <string name="dev_settings_warning_title" msgid="8251234890169074553">"Permitir definições de programação?"</string>
     <string name="dev_settings_warning_message" msgid="37741686486073668">"Estas definições destinam-se apenas a programação. Podem fazer com que o seu aparelho e as aplicações nele existentes falhem ou funcionem mal."</string>
@@ -383,8 +412,7 @@
     <string name="daltonizer_mode_protanomaly" msgid="7805583306666608440">"Protanomalia (vermelho-verde)"</string>
     <string name="daltonizer_mode_tritanomaly" msgid="7135266249220732267">"Tritanomalia (azul-amarelo)"</string>
     <string name="accessibility_display_daltonizer_preference_title" msgid="1810693571332381974">"Correção da cor"</string>
-    <!-- no translation found for accessibility_display_daltonizer_preference_subtitle (6178138727195403796) -->
-    <skip />
+    <string name="accessibility_display_daltonizer_preference_subtitle" msgid="6178138727195403796">"A correção de cor ajuda as pessoas com daltonismo a ver cores mais precisas."</string>
     <string name="daltonizer_type_overridden" msgid="4509604753672535721">"Substituído por <xliff:g id="TITLE">%1$s</xliff:g>"</string>
     <string name="power_remaining_settings_home_page" msgid="4885165789445462557">"<xliff:g id="PERCENTAGE">%1$s</xliff:g> – <xliff:g id="TIME_STRING">%2$s</xliff:g>"</string>
     <string name="power_remaining_duration_only" msgid="8264199158671531431">"Resta(m) cerca de <xliff:g id="TIME_REMAINING">%1$s</xliff:g>"</string>
@@ -403,21 +431,19 @@
     <string name="power_remaining_less_than_duration" msgid="1812668275239801236">"Resta(m) menos de <xliff:g id="THRESHOLD">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)."</string>
     <string name="power_remaining_more_than_subtext" msgid="7919119719242734848">"Resta(m) mais de <xliff:g id="TIME_REMAINING">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)."</string>
     <string name="power_remaining_only_more_than_subtext" msgid="3274496164769110480">"Resta(m) mais de <xliff:g id="TIME_REMAINING">%1$s</xliff:g>."</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="6583866940347159957">"O telemóvel poderá ser encerrado em breve."</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="8009177999719462724">"O tablet poderá ser encerrado em breve."</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="8320892540455268018">"O dispositivo poderá ser encerrado em breve."</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="6186572170809116621">"O telemóvel poderá ser encerrado em breve (<xliff:g id="LEVEL">%1$s</xliff:g>)."</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="1338758278145563121">"O tablet poderá ser encerrado em breve (<xliff:g id="LEVEL">%1$s</xliff:g>)."</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="3699579688084774362">"O dispositivo poderá ser encerrado em breve (<xliff:g id="LEVEL">%1$s</xliff:g>)."</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="137330009791560774">"O telemóvel poderá ser encerrado em breve"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="145489081521468132">"O tablet poderá ser encerrado em breve"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="1070562682853942350">"O dispositivo poderá ser encerrado em breve"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="4429259621177089719">"O telemóvel poderá ser encerrado em breve (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="7703677921000858479">"O tablet poderá ser encerrado em breve (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="4374784375644214578">"O dispositivo poderá ser encerrado em breve (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
     <string name="power_charging" msgid="6727132649743436802">"<xliff:g id="LEVEL">%1$s</xliff:g> – <xliff:g id="STATE">%2$s</xliff:g>"</string>
     <string name="power_remaining_charging_duration_only" msgid="7415639699283965818">"Falta(m) <xliff:g id="TIME">%1$s</xliff:g> até ficar carregada"</string>
     <string name="power_charging_duration" msgid="5005740040558984057">"<xliff:g id="LEVEL">%1$s</xliff:g> – <xliff:g id="TIME">%2$s</xliff:g> até ficar carregada"</string>
     <string name="battery_info_status_unknown" msgid="268625384868401114">"Desconhecido"</string>
     <string name="battery_info_status_charging" msgid="4279958015430387405">"A carregar"</string>
-    <!-- no translation found for battery_info_status_charging_fast (8027559755902954885) -->
-    <skip />
-    <!-- no translation found for battery_info_status_charging_slow (3190803837168962319) -->
-    <skip />
+    <string name="battery_info_status_charging_fast" msgid="8027559755902954885">"Carregamento rápido"</string>
+    <string name="battery_info_status_charging_slow" msgid="3190803837168962319">"Carregamento lento"</string>
     <string name="battery_info_status_discharging" msgid="6962689305413556485">"Não está a carregar"</string>
     <string name="battery_info_status_not_charging" msgid="8330015078868707899">"Ligada à corrente, não é possível carregar neste momento"</string>
     <string name="battery_info_status_full" msgid="4443168946046847468">"Completo"</string>
diff --git a/packages/SettingsLib/res/values-pt/strings.xml b/packages/SettingsLib/res/values-pt/strings.xml
index f4182bf..5e76fe0 100644
--- a/packages/SettingsLib/res/values-pt/strings.xml
+++ b/packages/SettingsLib/res/values-pt/strings.xml
@@ -206,6 +206,33 @@
     <string name="enable_adb" msgid="8072776357237289039">"Depuração USB"</string>
     <string name="enable_adb_summary" msgid="3711526030096574316">"Modo de depuração quando o USB estiver conectado"</string>
     <string name="clear_adb_keys" msgid="3010148733140369917">"Revogar autorizações de depuração USB"</string>
+    <string name="enable_adb_wireless" msgid="6973226350963971018">"Depuração por Wi-Fi"</string>
+    <string name="enable_adb_wireless_summary" msgid="7344391423657093011">"Modo de depuração quando a rede Wi‑Fi estiver conectada"</string>
+    <string name="adb_wireless_error" msgid="721958772149779856">"Erro"</string>
+    <string name="adb_wireless_settings" msgid="2295017847215680229">"Depuração por Wi-Fi"</string>
+    <string name="adb_wireless_list_empty_off" msgid="1713707973837255490">"Para ver e usar dispositivos disponíveis, ative a depuração por Wi-Fi"</string>
+    <string name="adb_pair_method_qrcode_title" msgid="6982904096137468634">"Parear o dispositivo com um código QR"</string>
+    <string name="adb_pair_method_qrcode_summary" msgid="3729901496856458634">"Parear novos dispositivos usando um leitor de código QR"</string>
+    <string name="adb_pair_method_code_title" msgid="1122590300445142904">"Parear o dispositivo com um código de pareamento"</string>
+    <string name="adb_pair_method_code_summary" msgid="6370414511333685185">"Parear novos dispositivos usando um código de seis dígitos"</string>
+    <string name="adb_paired_devices_title" msgid="5268997341526217362">"Dispositivos pareados"</string>
+    <string name="adb_wireless_device_connected_summary" msgid="3039660790249148713">"Conectados no momento"</string>
+    <string name="adb_wireless_device_details_title" msgid="7129369670526565786">"Detalhes do dispositivo"</string>
+    <string name="adb_device_forget" msgid="193072400783068417">"Esquecer"</string>
+    <string name="adb_device_fingerprint_title_format" msgid="291504822917843701">"Impressão digital do dispositivo: <xliff:g id="FINGERPRINT_PARAM">%1$s</xliff:g>"</string>
+    <string name="adb_wireless_connection_failed_title" msgid="664211177427438438">"Falha na conexão"</string>
+    <string name="adb_wireless_connection_failed_message" msgid="9213896700171602073">"Verifique se o <xliff:g id="DEVICE_NAME">%1$s</xliff:g> está conectado à rede correta"</string>
+    <string name="adb_pairing_device_dialog_title" msgid="7141739231018530210">"Parear com o dispositivo"</string>
+    <string name="adb_pairing_device_dialog_pairing_code_label" msgid="3639239786669722731">"Código de pareamento de Wi‑Fi"</string>
+    <string name="adb_pairing_device_dialog_failed_title" msgid="3426758947882091735">"Falha no pareamento"</string>
+    <string name="adb_pairing_device_dialog_failed_msg" msgid="6611097519661997148">"Verifique se o dispositivo está conectado à mesma rede."</string>
+    <string name="adb_wireless_qrcode_summary" msgid="8051414549011801917">"Parear dispositivo na rede Wi‑Fi fazendo a leitura do código QR"</string>
+    <string name="adb_wireless_verifying_qrcode_text" msgid="6123192424916029207">"Pareando dispositivo…"</string>
+    <string name="adb_qrcode_pairing_device_failed_msg" msgid="6936292092592914132">"Falha ao parear o dispositivo. O código QR está incorreto ou o dispositivo não está conectado à mesma rede."</string>
+    <string name="adb_wireless_ip_addr_preference_title" msgid="8335132107715311730">"Endereço IP e porta"</string>
+    <string name="adb_wireless_qrcode_pairing_title" msgid="1906409667944674707">"Ler código QR"</string>
+    <string name="adb_wireless_qrcode_pairing_description" msgid="8578868049289910131">"Parear dispositivo na rede Wi‑Fi fazendo a leitura do código QR"</string>
+    <string name="keywords_adb_wireless" msgid="6507505581882171240">"adb, debug, dev"</string>
     <string name="bugreport_in_power" msgid="8664089072534638709">"Atalho para relatório de bugs"</string>
     <string name="bugreport_in_power_summary" msgid="1885529649381831775">"Mostrar um botão para gerar relatórios de bugs no menu do botão liga/desliga"</string>
     <string name="keep_screen_on" msgid="1187161672348797558">"Permanecer ativo"</string>
@@ -271,6 +298,8 @@
     <string name="tethering_hardware_offload_summary" msgid="7801345335142803029">"Usar aceleração de hardware de tethering quando disponível"</string>
     <string name="adb_warning_title" msgid="7708653449506485728">"Permitir a depuração USB?"</string>
     <string name="adb_warning_message" msgid="8145270656419669221">"A depuração USB serve apenas para fins de desenvolvimento. Use-a para copiar dados entre o computador e o dispositivo, instalar apps no seu aparelho sem notificação e ler dados de registro."</string>
+    <string name="adbwifi_warning_title" msgid="727104571653031865">"Permitir a depuração sem fio?"</string>
+    <string name="adbwifi_warning_message" msgid="8005936574322702388">"A depuração sem fio serve apenas para fins de desenvolvimento. Use-a para copiar dados entre o computador e o dispositivo, instalar apps no seu aparelho sem notificação e ler dados de registro."</string>
     <string name="adb_keys_warning_message" msgid="2968555274488101220">"Revogar o acesso à depuração USB para todos os computadores autorizados?"</string>
     <string name="dev_settings_warning_title" msgid="8251234890169074553">"Ativar as configurações de desenvolvimento?"</string>
     <string name="dev_settings_warning_message" msgid="37741686486073668">"Essas configurações são destinadas apenas para o uso de desenvolvedores. Elas podem causar a desativação ou mau funcionamento do dispositivo e dos apps contidos nele."</string>
@@ -383,8 +412,7 @@
     <string name="daltonizer_mode_protanomaly" msgid="7805583306666608440">"Protanomalia (vermelho-verde)"</string>
     <string name="daltonizer_mode_tritanomaly" msgid="7135266249220732267">"Tritanomalia (azul-amarelo)"</string>
     <string name="accessibility_display_daltonizer_preference_title" msgid="1810693571332381974">"Correção de cor"</string>
-    <!-- no translation found for accessibility_display_daltonizer_preference_subtitle (6178138727195403796) -->
-    <skip />
+    <string name="accessibility_display_daltonizer_preference_subtitle" msgid="6178138727195403796">"A correção de cores ajuda pessoas com daltonismo a ver cores de forma mais precisa"</string>
     <string name="daltonizer_type_overridden" msgid="4509604753672535721">"Substituído por <xliff:g id="TITLE">%1$s</xliff:g>"</string>
     <string name="power_remaining_settings_home_page" msgid="4885165789445462557">"<xliff:g id="PERCENTAGE">%1$s</xliff:g> - <xliff:g id="TIME_STRING">%2$s</xliff:g>"</string>
     <string name="power_remaining_duration_only" msgid="8264199158671531431">"Tempo restante aproximado: <xliff:g id="TIME_REMAINING">%1$s</xliff:g>"</string>
@@ -403,21 +431,19 @@
     <string name="power_remaining_less_than_duration" msgid="1812668275239801236">"Menos de <xliff:g id="THRESHOLD">%1$s</xliff:g> restante(s) (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_more_than_subtext" msgid="7919119719242734848">"Mais de <xliff:g id="TIME_REMAINING">%1$s</xliff:g> restante(s) (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_only_more_than_subtext" msgid="3274496164769110480">"Mais de <xliff:g id="TIME_REMAINING">%1$s</xliff:g> restante(s)"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="6583866940347159957">"O smartphone pode ser desligado em breve"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="8009177999719462724">"O tablet pode ser desligado em breve"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="8320892540455268018">"O dispositivo pode ser desligado em breve"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="6186572170809116621">"O smartphone pode ser desligado em breve (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="1338758278145563121">"O tablet pode ser desligado em breve (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="3699579688084774362">"O dispositivo pode ser desligado em breve (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="137330009791560774">"O smartphone pode ser desligado em breve"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="145489081521468132">"O tablet pode ser desligado em breve"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="1070562682853942350">"O dispositivo pode ser desligado em breve"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="4429259621177089719">"O smartphone pode ser desligado em breve (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="7703677921000858479">"O tablet pode ser desligado em breve (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="4374784375644214578">"O dispositivo pode ser desligado em breve (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
     <string name="power_charging" msgid="6727132649743436802">"<xliff:g id="LEVEL">%1$s</xliff:g> - <xliff:g id="STATE">%2$s</xliff:g>"</string>
     <string name="power_remaining_charging_duration_only" msgid="7415639699283965818">"Tempo restante até a carga completa: <xliff:g id="TIME">%1$s</xliff:g>"</string>
     <string name="power_charging_duration" msgid="5005740040558984057">"<xliff:g id="LEVEL">%1$s</xliff:g>: <xliff:g id="TIME">%2$s</xliff:g> até a carga completa"</string>
     <string name="battery_info_status_unknown" msgid="268625384868401114">"Desconhecido"</string>
     <string name="battery_info_status_charging" msgid="4279958015430387405">"Carregando"</string>
-    <!-- no translation found for battery_info_status_charging_fast (8027559755902954885) -->
-    <skip />
-    <!-- no translation found for battery_info_status_charging_slow (3190803837168962319) -->
-    <skip />
+    <string name="battery_info_status_charging_fast" msgid="8027559755902954885">"Carregando rápido"</string>
+    <string name="battery_info_status_charging_slow" msgid="3190803837168962319">"Carregando devagar"</string>
     <string name="battery_info_status_discharging" msgid="6962689305413556485">"Não está carregando"</string>
     <string name="battery_info_status_not_charging" msgid="8330015078868707899">"Conectado. Não é possível carregar no momento"</string>
     <string name="battery_info_status_full" msgid="4443168946046847468">"Carregada"</string>
diff --git a/packages/SettingsLib/res/values-ro/strings.xml b/packages/SettingsLib/res/values-ro/strings.xml
index 6e8bbd1..e1aa85b 100644
--- a/packages/SettingsLib/res/values-ro/strings.xml
+++ b/packages/SettingsLib/res/values-ro/strings.xml
@@ -206,6 +206,33 @@
     <string name="enable_adb" msgid="8072776357237289039">"Remedierea erorilor prin USB"</string>
     <string name="enable_adb_summary" msgid="3711526030096574316">"Mod de depanare când este conectat USB"</string>
     <string name="clear_adb_keys" msgid="3010148733140369917">"Revoc autorizații remediere a erorilor prin USB"</string>
+    <string name="enable_adb_wireless" msgid="6973226350963971018">"Remedierea erorilor prin wireless"</string>
+    <string name="enable_adb_wireless_summary" msgid="7344391423657093011">"Modul de remediere a erorilor când rețeaua Wi-Fi este conectată"</string>
+    <string name="adb_wireless_error" msgid="721958772149779856">"Eroare"</string>
+    <string name="adb_wireless_settings" msgid="2295017847215680229">"Remedierea erorilor prin wireless"</string>
+    <string name="adb_wireless_list_empty_off" msgid="1713707973837255490">"Activați remedierea erorilor wireless pentru a vedea și a folosi dispozitivele disponibile"</string>
+    <string name="adb_pair_method_qrcode_title" msgid="6982904096137468634">"Asociați dispozitivul folosind codul QR"</string>
+    <string name="adb_pair_method_qrcode_summary" msgid="3729901496856458634">"Asociați dispozitive noi folosind scannerul de coduri QR"</string>
+    <string name="adb_pair_method_code_title" msgid="1122590300445142904">"Asociați dispozitivul folosind codul de conectare"</string>
+    <string name="adb_pair_method_code_summary" msgid="6370414511333685185">"Asociați dispozitive noi folosind codul din șase cifre"</string>
+    <string name="adb_paired_devices_title" msgid="5268997341526217362">"Dispozitive asociate"</string>
+    <string name="adb_wireless_device_connected_summary" msgid="3039660790249148713">"Conectat"</string>
+    <string name="adb_wireless_device_details_title" msgid="7129369670526565786">"Detalii despre dispozitiv"</string>
+    <string name="adb_device_forget" msgid="193072400783068417">"Ștergeți"</string>
+    <string name="adb_device_fingerprint_title_format" msgid="291504822917843701">"Amprenta pentru dispozitiv: <xliff:g id="FINGERPRINT_PARAM">%1$s</xliff:g>"</string>
+    <string name="adb_wireless_connection_failed_title" msgid="664211177427438438">"Conectare nereușită"</string>
+    <string name="adb_wireless_connection_failed_message" msgid="9213896700171602073">"Asigurați-vă că ați conectat <xliff:g id="DEVICE_NAME">%1$s</xliff:g> la rețeaua corectă"</string>
+    <string name="adb_pairing_device_dialog_title" msgid="7141739231018530210">"Asociați cu dispozitivul"</string>
+    <string name="adb_pairing_device_dialog_pairing_code_label" msgid="3639239786669722731">"Cod de conectare pentru Wi-Fi"</string>
+    <string name="adb_pairing_device_dialog_failed_title" msgid="3426758947882091735">"Asociere nereușită"</string>
+    <string name="adb_pairing_device_dialog_failed_msg" msgid="6611097519661997148">"Asigurați-vă că dispozitivul este conectat la aceeași rețea."</string>
+    <string name="adb_wireless_qrcode_summary" msgid="8051414549011801917">"Asociați dispozitivul prin Wi-Fi scanând un cod QR"</string>
+    <string name="adb_wireless_verifying_qrcode_text" msgid="6123192424916029207">"Se asociază dispozitivul…"</string>
+    <string name="adb_qrcode_pairing_device_failed_msg" msgid="6936292092592914132">"Nu s-a asociat dispozitivul. Codul QR este incorect sau dispozitivul nu este conectat la aceeași rețea."</string>
+    <string name="adb_wireless_ip_addr_preference_title" msgid="8335132107715311730">"Adresa IP și portul"</string>
+    <string name="adb_wireless_qrcode_pairing_title" msgid="1906409667944674707">"Scanați codul QR"</string>
+    <string name="adb_wireless_qrcode_pairing_description" msgid="8578868049289910131">"Asociați dispozitivul prin Wi-Fi scanând un cod QR"</string>
+    <string name="keywords_adb_wireless" msgid="6507505581882171240">"adb, remedierea erorilor, dev"</string>
     <string name="bugreport_in_power" msgid="8664089072534638709">"Comandă rapidă pentru raportul de erori"</string>
     <string name="bugreport_in_power_summary" msgid="1885529649381831775">"Afișați un buton în meniul de pornire pentru a realiza un raport de erori"</string>
     <string name="keep_screen_on" msgid="1187161672348797558">"Activ permanent"</string>
@@ -271,6 +298,8 @@
     <string name="tethering_hardware_offload_summary" msgid="7801345335142803029">"Folosiți accelerarea hardware pentru tethering, dacă este disponibilă"</string>
     <string name="adb_warning_title" msgid="7708653449506485728">"Permiteți remedierea erorilor prin USB?"</string>
     <string name="adb_warning_message" msgid="8145270656419669221">"Remedierea erorilor prin USB are exclusiv scopuri de dezvoltare. Utilizați-o pentru a copia date de pe computer pe dispozitiv, pentru a instala aplicații pe dispozitiv fără notificare și pentru a citi datele din jurnale."</string>
+    <string name="adbwifi_warning_title" msgid="727104571653031865">"Permiteți remedierea erorilor prin wireless?"</string>
+    <string name="adbwifi_warning_message" msgid="8005936574322702388">"Remedierea erorilor prin wireless are exclusiv scopuri de dezvoltare. Folosiți-o pentru a copia date de pe computer pe dispozitiv, pentru a instala aplicații pe dispozitiv fără notificare și pentru a citi datele din jurnale."</string>
     <string name="adb_keys_warning_message" msgid="2968555274488101220">"Revocați accesul la remedierea erorilor prin USB de pe toate computerele pe care le-ați autorizat anterior?"</string>
     <string name="dev_settings_warning_title" msgid="8251234890169074553">"Permiteți setările pentru dezvoltare?"</string>
     <string name="dev_settings_warning_message" msgid="37741686486073668">"Aceste setări sunt destinate exclusiv utilizării pentru dezvoltare. Din cauza lor, este posibil ca dispozitivul dvs. și aplicațiile de pe acesta să nu mai funcționeze sau să funcționeze necorespunzător."</string>
@@ -383,8 +412,7 @@
     <string name="daltonizer_mode_protanomaly" msgid="7805583306666608440">"Protanomalie (roșu-verde)"</string>
     <string name="daltonizer_mode_tritanomaly" msgid="7135266249220732267">"Tritanomalie (albastru-galben)"</string>
     <string name="accessibility_display_daltonizer_preference_title" msgid="1810693571332381974">"Corecția culorii"</string>
-    <!-- no translation found for accessibility_display_daltonizer_preference_subtitle (6178138727195403796) -->
-    <skip />
+    <string name="accessibility_display_daltonizer_preference_subtitle" msgid="6178138727195403796">"Corecția culorii ajută persoanele cu daltonism să vadă culori mai exacte"</string>
     <string name="daltonizer_type_overridden" msgid="4509604753672535721">"Valoare înlocuită de <xliff:g id="TITLE">%1$s</xliff:g>"</string>
     <string name="power_remaining_settings_home_page" msgid="4885165789445462557">"<xliff:g id="PERCENTAGE">%1$s</xliff:g> - <xliff:g id="TIME_STRING">%2$s</xliff:g>"</string>
     <string name="power_remaining_duration_only" msgid="8264199158671531431">"Timp aproximativ rămas: <xliff:g id="TIME_REMAINING">%1$s</xliff:g>"</string>
@@ -403,21 +431,19 @@
     <string name="power_remaining_less_than_duration" msgid="1812668275239801236">"A mai rămas mai puțin de <xliff:g id="THRESHOLD">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_more_than_subtext" msgid="7919119719242734848">"A mai rămas mai mult de <xliff:g id="TIME_REMAINING">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_only_more_than_subtext" msgid="3274496164769110480">"A mai rămas mai mult de <xliff:g id="TIME_REMAINING">%1$s</xliff:g>"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="6583866940347159957">"Telefonul se poate închide în curând"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="8009177999719462724">"Tableta se poate închide în curând"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="8320892540455268018">"Dispozitivul se poate închide în curând"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="6186572170809116621">"Telefonul se poate închide în curând (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="1338758278145563121">"Tableta se poate închide în curând (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="3699579688084774362">"Dispozitivul se poate închide în curând (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="137330009791560774">"Telefonul se poate închide în curând"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="145489081521468132">"Tableta se poate închide în curând"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="1070562682853942350">"Dispozitivul se poate închide în curând"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="4429259621177089719">"Telefonul se poate închide în curând (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="7703677921000858479">"Tableta se poate închide în curând (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="4374784375644214578">"Dispozitivul se poate închide în curând (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
     <string name="power_charging" msgid="6727132649743436802">"<xliff:g id="LEVEL">%1$s</xliff:g> - <xliff:g id="STATE">%2$s</xliff:g>"</string>
     <string name="power_remaining_charging_duration_only" msgid="7415639699283965818">"Au mai rămas <xliff:g id="TIME">%1$s</xliff:g> până la încărcare"</string>
     <string name="power_charging_duration" msgid="5005740040558984057">"<xliff:g id="LEVEL">%1$s</xliff:g> – <xliff:g id="TIME">%2$s</xliff:g> până la încărcare"</string>
     <string name="battery_info_status_unknown" msgid="268625384868401114">"Necunoscut"</string>
     <string name="battery_info_status_charging" msgid="4279958015430387405">"Se încarcă"</string>
-    <!-- no translation found for battery_info_status_charging_fast (8027559755902954885) -->
-    <skip />
-    <!-- no translation found for battery_info_status_charging_slow (3190803837168962319) -->
-    <skip />
+    <string name="battery_info_status_charging_fast" msgid="8027559755902954885">"Se încarcă rapid"</string>
+    <string name="battery_info_status_charging_slow" msgid="3190803837168962319">"Se încarcă lent"</string>
     <string name="battery_info_status_discharging" msgid="6962689305413556485">"Nu se încarcă"</string>
     <string name="battery_info_status_not_charging" msgid="8330015078868707899">"Conectat, nu se poate încărca chiar acum"</string>
     <string name="battery_info_status_full" msgid="4443168946046847468">"Complet"</string>
diff --git a/packages/SettingsLib/res/values-ru/strings.xml b/packages/SettingsLib/res/values-ru/strings.xml
index 87831c7..3df750d 100644
--- a/packages/SettingsLib/res/values-ru/strings.xml
+++ b/packages/SettingsLib/res/values-ru/strings.xml
@@ -112,7 +112,7 @@
     <string name="bluetooth_opp_profile_summary_use_for" msgid="461981154387015457">"Используется для передачи файлов"</string>
     <string name="bluetooth_hid_profile_summary_use_for" msgid="4289460627406490952">"Использовать для ввода"</string>
     <string name="bluetooth_hearing_aid_profile_summary_use_for" msgid="7689393730163320483">"Использовать для слухового аппарата"</string>
-    <string name="bluetooth_pairing_accept" msgid="2054232610815498004">"Добавить"</string>
+    <string name="bluetooth_pairing_accept" msgid="2054232610815498004">"Подключить"</string>
     <string name="bluetooth_pairing_accept_all_caps" msgid="2734383073450506220">"ДОБАВИТЬ"</string>
     <string name="bluetooth_pairing_decline" msgid="6483118841204885890">"Отмена"</string>
     <string name="bluetooth_pairing_will_share_phonebook" msgid="3064334458659165176">"Установление соединения обеспечивает доступ к вашим контактам и журналу звонков при подключении."</string>
@@ -206,6 +206,33 @@
     <string name="enable_adb" msgid="8072776357237289039">"Отладка по USB"</string>
     <string name="enable_adb_summary" msgid="3711526030096574316">"Включить режим отладки при подключении к компьютеру по USB"</string>
     <string name="clear_adb_keys" msgid="3010148733140369917">"Отозвать доступ для USB-отладки"</string>
+    <string name="enable_adb_wireless" msgid="6973226350963971018">"Отладка по Wi-Fi"</string>
+    <string name="enable_adb_wireless_summary" msgid="7344391423657093011">"Режим отладки при подключении к сети Wi‑Fi"</string>
+    <string name="adb_wireless_error" msgid="721958772149779856">"Ошибка"</string>
+    <string name="adb_wireless_settings" msgid="2295017847215680229">"Отладка по Wi-Fi"</string>
+    <string name="adb_wireless_list_empty_off" msgid="1713707973837255490">"Чтобы посмотреть и использовать доступные устройства, включите отладку по Wi-Fi"</string>
+    <string name="adb_pair_method_qrcode_title" msgid="6982904096137468634">"Подключить устройство с помощью QR-кода"</string>
+    <string name="adb_pair_method_qrcode_summary" msgid="3729901496856458634">"Подключение новых устройств с помощью сканера QR-кодов"</string>
+    <string name="adb_pair_method_code_title" msgid="1122590300445142904">"Подключить устройство с помощью кода подключения"</string>
+    <string name="adb_pair_method_code_summary" msgid="6370414511333685185">"Подключение новых устройств с помощью шестизначного кода"</string>
+    <string name="adb_paired_devices_title" msgid="5268997341526217362">"Подключенные устройства"</string>
+    <string name="adb_wireless_device_connected_summary" msgid="3039660790249148713">"Текущие подключения"</string>
+    <string name="adb_wireless_device_details_title" msgid="7129369670526565786">"Сведения об устройстве"</string>
+    <string name="adb_device_forget" msgid="193072400783068417">"Удалить"</string>
+    <string name="adb_device_fingerprint_title_format" msgid="291504822917843701">"Цифровой отпечаток устройства: <xliff:g id="FINGERPRINT_PARAM">%1$s</xliff:g>"</string>
+    <string name="adb_wireless_connection_failed_title" msgid="664211177427438438">"Не удалось установить подключение"</string>
+    <string name="adb_wireless_connection_failed_message" msgid="9213896700171602073">"Убедитесь, что устройство \"<xliff:g id="DEVICE_NAME">%1$s</xliff:g>\" подключено к нужной сети."</string>
+    <string name="adb_pairing_device_dialog_title" msgid="7141739231018530210">"Подключение к устройству"</string>
+    <string name="adb_pairing_device_dialog_pairing_code_label" msgid="3639239786669722731">"Код подключения к сети Wi‑Fi"</string>
+    <string name="adb_pairing_device_dialog_failed_title" msgid="3426758947882091735">"Не удалось подключить устройство"</string>
+    <string name="adb_pairing_device_dialog_failed_msg" msgid="6611097519661997148">"Устройство должно быть подключено к той же самой сети."</string>
+    <string name="adb_wireless_qrcode_summary" msgid="8051414549011801917">"Подключение устройства через Wi‑Fi с использованием QR-кода"</string>
+    <string name="adb_wireless_verifying_qrcode_text" msgid="6123192424916029207">"Подключение устройства…"</string>
+    <string name="adb_qrcode_pairing_device_failed_msg" msgid="6936292092592914132">"Не удалось подключить устройство. QR-код неверный, или устройство находится в другой сети."</string>
+    <string name="adb_wireless_ip_addr_preference_title" msgid="8335132107715311730">"IP-адрес и порт"</string>
+    <string name="adb_wireless_qrcode_pairing_title" msgid="1906409667944674707">"Сканировать QR-код"</string>
+    <string name="adb_wireless_qrcode_pairing_description" msgid="8578868049289910131">"Подключение устройства через Wi‑Fi с использованием QR-кода"</string>
+    <string name="keywords_adb_wireless" msgid="6507505581882171240">"adb, отладка, разработчик"</string>
     <string name="bugreport_in_power" msgid="8664089072534638709">"Отчет об ошибке"</string>
     <string name="bugreport_in_power_summary" msgid="1885529649381831775">"Показывать в меню кнопки питания пункт для отправки отчета об ошибке"</string>
     <string name="keep_screen_on" msgid="1187161672348797558">"Не выключать экран"</string>
@@ -271,6 +298,8 @@
     <string name="tethering_hardware_offload_summary" msgid="7801345335142803029">"Использовать аппаратное ускорение в режиме модема (если доступно)"</string>
     <string name="adb_warning_title" msgid="7708653449506485728">"Разрешить отладку по USB?"</string>
     <string name="adb_warning_message" msgid="8145270656419669221">"Отладка по USB – это режим, который позволяет использовать ваше устройство как внешний накопитель: перемещать файлы (с компьютера и на компьютер), напрямую устанавливать приложения, а также просматривать системные журналы."</string>
+    <string name="adbwifi_warning_title" msgid="727104571653031865">"Разрешить отладку по Wi-Fi?"</string>
+    <string name="adbwifi_warning_message" msgid="8005936574322702388">"Отладка по Wi-Fi – это режим, предназначенный только для разработчиков. Он позволяет перемещать файлы между устройством и компьютером, напрямую устанавливать приложения, а также просматривать системные журналы."</string>
     <string name="adb_keys_warning_message" msgid="2968555274488101220">"Запретить доступ к USB-отладке для всех компьютеров, которым он был разрешен?"</string>
     <string name="dev_settings_warning_title" msgid="8251234890169074553">"Изменение настроек"</string>
     <string name="dev_settings_warning_message" msgid="37741686486073668">"Только для разработчиков. Изменение этих настроек может привести к сбоям или неправильной работе устройства и приложений."</string>
@@ -383,8 +412,7 @@
     <string name="daltonizer_mode_protanomaly" msgid="7805583306666608440">"Протаномалия (красный/зеленый)"</string>
     <string name="daltonizer_mode_tritanomaly" msgid="7135266249220732267">"Тританомалия (синий/желтый)"</string>
     <string name="accessibility_display_daltonizer_preference_title" msgid="1810693571332381974">"Коррекция цвета"</string>
-    <!-- no translation found for accessibility_display_daltonizer_preference_subtitle (6178138727195403796) -->
-    <skip />
+    <string name="accessibility_display_daltonizer_preference_subtitle" msgid="6178138727195403796">"Коррекция цвета помогает пользователям с нарушениями цветового зрения лучше различать изображение на экране"</string>
     <string name="daltonizer_type_overridden" msgid="4509604753672535721">"Новая настройка: <xliff:g id="TITLE">%1$s</xliff:g>"</string>
     <string name="power_remaining_settings_home_page" msgid="4885165789445462557">"Уровень заряда – <xliff:g id="PERCENTAGE">%1$s</xliff:g>. <xliff:g id="TIME_STRING">%2$s</xliff:g>."</string>
     <string name="power_remaining_duration_only" msgid="8264199158671531431">"Заряда хватит примерно на <xliff:g id="TIME_REMAINING">%1$s</xliff:g>"</string>
@@ -403,21 +431,19 @@
     <string name="power_remaining_less_than_duration" msgid="1812668275239801236">"Уровень заряда батареи: <xliff:g id="LEVEL">%2$s</xliff:g> (хватит менее чем на <xliff:g id="THRESHOLD">%1$s</xliff:g>)"</string>
     <string name="power_remaining_more_than_subtext" msgid="7919119719242734848">"Уровень заряда батареи: <xliff:g id="LEVEL">%2$s</xliff:g> (хватит более чем на <xliff:g id="TIME_REMAINING">%1$s</xliff:g>)"</string>
     <string name="power_remaining_only_more_than_subtext" msgid="3274496164769110480">"Хватит более чем на <xliff:g id="TIME_REMAINING">%1$s</xliff:g>"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="6583866940347159957">"Телефон скоро завершит работу"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="8009177999719462724">"Планшет скоро завершит работу"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="8320892540455268018">"Устройство скоро завершит работу"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="6186572170809116621">"Уровень заряда батареи: <xliff:g id="LEVEL">%1$s</xliff:g>. Телефон скоро завершит работу."</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="1338758278145563121">"Уровень заряда батареи: <xliff:g id="LEVEL">%1$s</xliff:g>. Планшет скоро завершит работу."</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="3699579688084774362">"Уровень заряда батареи: <xliff:g id="LEVEL">%1$s</xliff:g>. Устройство скоро завершит работу."</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="137330009791560774">"Телефон скоро выключится"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="145489081521468132">"Планшет скоро выключится"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="1070562682853942350">"Устройство скоро выключится"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="4429259621177089719">"Телефон скоро выключится (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="7703677921000858479">"Планшет скоро выключится (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="4374784375644214578">"Устройство скоро выключится (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
     <string name="power_charging" msgid="6727132649743436802">"<xliff:g id="LEVEL">%1$s</xliff:g> – <xliff:g id="STATE">%2$s</xliff:g>"</string>
     <string name="power_remaining_charging_duration_only" msgid="7415639699283965818">"<xliff:g id="TIME">%1$s</xliff:g> до полной зарядки"</string>
     <string name="power_charging_duration" msgid="5005740040558984057">"<xliff:g id="LEVEL">%1$s</xliff:g> – <xliff:g id="TIME">%2$s</xliff:g> до полной зарядки"</string>
     <string name="battery_info_status_unknown" msgid="268625384868401114">"Неизвестно"</string>
     <string name="battery_info_status_charging" msgid="4279958015430387405">"Идет зарядка"</string>
-    <!-- no translation found for battery_info_status_charging_fast (8027559755902954885) -->
-    <skip />
-    <!-- no translation found for battery_info_status_charging_slow (3190803837168962319) -->
-    <skip />
+    <string name="battery_info_status_charging_fast" msgid="8027559755902954885">"Быстрая зарядка"</string>
+    <string name="battery_info_status_charging_slow" msgid="3190803837168962319">"Медленная зарядка"</string>
     <string name="battery_info_status_discharging" msgid="6962689305413556485">"Не заряжается"</string>
     <string name="battery_info_status_not_charging" msgid="8330015078868707899">"Подключено, не заряжается"</string>
     <string name="battery_info_status_full" msgid="4443168946046847468">"Батарея заряжена"</string>
diff --git a/packages/SettingsLib/res/values-si/strings.xml b/packages/SettingsLib/res/values-si/strings.xml
index f0a823a..c1452d2 100644
--- a/packages/SettingsLib/res/values-si/strings.xml
+++ b/packages/SettingsLib/res/values-si/strings.xml
@@ -206,6 +206,33 @@
     <string name="enable_adb" msgid="8072776357237289039">"USB නිදොස්කරණය"</string>
     <string name="enable_adb_summary" msgid="3711526030096574316">"USB සම්බන්ධ විට නිදොස් ආකාරය"</string>
     <string name="clear_adb_keys" msgid="3010148733140369917">"USB නිදොස් කිරීම් අනුමැති අහෝසි කරන්න"</string>
+    <string name="enable_adb_wireless" msgid="6973226350963971018">"නොරැහැන් දෝෂාවේක්ෂණය"</string>
+    <string name="enable_adb_wireless_summary" msgid="7344391423657093011">"Wi-Fi සම්බන්ධ විට දෝෂාවේක්ෂණ ප්‍රකාරය"</string>
+    <string name="adb_wireless_error" msgid="721958772149779856">"දෝෂයකි"</string>
+    <string name="adb_wireless_settings" msgid="2295017847215680229">"නොරැහැන් දෝෂාවේක්ෂණය"</string>
+    <string name="adb_wireless_list_empty_off" msgid="1713707973837255490">"ලබා ගත හැකි උපාංග බැලීමට, නොරැහැන් දෝෂාවේක්ෂණය ක්‍රියාත්මක කරන්න"</string>
+    <string name="adb_pair_method_qrcode_title" msgid="6982904096137468634">"QR කේතය සමගින් උපාංගය යුගල කරන්න"</string>
+    <string name="adb_pair_method_qrcode_summary" msgid="3729901496856458634">"QR කේත ස්කෑනරය භාවිතයෙන් නව උපාංග යුගල කරන්න"</string>
+    <string name="adb_pair_method_code_title" msgid="1122590300445142904">"යුගල කිරීමේ කේතය සමගින් උපාංගය යුගල කරන්න"</string>
+    <string name="adb_pair_method_code_summary" msgid="6370414511333685185">"ඉලක්කම් හයක කේතය භාවිතයෙන් නව උපාංග යුගල කරන්න"</string>
+    <string name="adb_paired_devices_title" msgid="5268997341526217362">"යුගල කළ උපාංග"</string>
+    <string name="adb_wireless_device_connected_summary" msgid="3039660790249148713">"දැනට සම්බන්ධ වී ඇත"</string>
+    <string name="adb_wireless_device_details_title" msgid="7129369670526565786">"උපාංග විස්තර"</string>
+    <string name="adb_device_forget" msgid="193072400783068417">"අමතක කරන්න"</string>
+    <string name="adb_device_fingerprint_title_format" msgid="291504822917843701">"උපාංග ඇඟිලි සලකුණ: <xliff:g id="FINGERPRINT_PARAM">%1$s</xliff:g>"</string>
+    <string name="adb_wireless_connection_failed_title" msgid="664211177427438438">"සම්බන්ධය අසාර්ථකයි"</string>
+    <string name="adb_wireless_connection_failed_message" msgid="9213896700171602073">"<xliff:g id="DEVICE_NAME">%1$s</xliff:g> නිවැරදි ජාලයට සම්බන්ධ කර ඇති බව සහතික කර ගන්න"</string>
+    <string name="adb_pairing_device_dialog_title" msgid="7141739231018530210">"උපංගය සමගින් යුගල කරන්න"</string>
+    <string name="adb_pairing_device_dialog_pairing_code_label" msgid="3639239786669722731">"Wi‑Fi යුගල කිරීමේ කේතය"</string>
+    <string name="adb_pairing_device_dialog_failed_title" msgid="3426758947882091735">"යුගල කිරීම අසාර්ථකයි"</string>
+    <string name="adb_pairing_device_dialog_failed_msg" msgid="6611097519661997148">"උපාංගය එකම ජාලයට සම්බන්ධ කර ඇති බව සහතික කර ගන්න."</string>
+    <string name="adb_wireless_qrcode_summary" msgid="8051414549011801917">"QR කේතය ස්කෑන් කිරීමෙන් Wi‑Fi හරහා උපාංගය යුගල කරන්න"</string>
+    <string name="adb_wireless_verifying_qrcode_text" msgid="6123192424916029207">"උපාංගය යුගල කරමින්…"</string>
+    <string name="adb_qrcode_pairing_device_failed_msg" msgid="6936292092592914132">"උපාංගය යුගල කිරීමට අසමත් විය. QR කේතය වැරදිය නැතහොත් එකම ජාලයට සම්බන්ධ කර නැත."</string>
+    <string name="adb_wireless_ip_addr_preference_title" msgid="8335132107715311730">"IP ලිපිනය &amp; තොට"</string>
+    <string name="adb_wireless_qrcode_pairing_title" msgid="1906409667944674707">"QR කේතය ස්කෑන් කරන්න"</string>
+    <string name="adb_wireless_qrcode_pairing_description" msgid="8578868049289910131">"QR කේතය ස්කෑන් කිරීමෙන් Wi‑Fi හරහා උපාංගය යුගල කරන්න"</string>
+    <string name="keywords_adb_wireless" msgid="6507505581882171240">"adb, දෝෂාවෙක්ෂණ, dev"</string>
     <string name="bugreport_in_power" msgid="8664089072534638709">"දෝෂය වාර්තා කිරීමේ කෙටිමඟ"</string>
     <string name="bugreport_in_power_summary" msgid="1885529649381831775">"දෝෂ වාර්තාවක් ගැනීම සඳහා බල මෙනුව තුළ බොත්තම පෙන්වන"</string>
     <string name="keep_screen_on" msgid="1187161672348797558">"අවදියෙන් සිටින්න"</string>
@@ -271,6 +298,8 @@
     <string name="tethering_hardware_offload_summary" msgid="7801345335142803029">"ලබා ගත හැකි නම්, ටෙදරින් දෘඪාංග ත්වරණය භාවිත කරන්න"</string>
     <string name="adb_warning_title" msgid="7708653449506485728">"USB දෝශාවේක්ෂණයට ඉඩ දෙන්නද?"</string>
     <string name="adb_warning_message" msgid="8145270656419669221">"USB දෝශාවේක්ෂණය සංවර්ධන කටයුතු සඳහා පමණක් යොදාගැනේ. එය ඔබගේ පරිගණකය සහ ඔබගේ උපාංගය අතර දත්ත පිටපත් කිරීමට පමණක් භාවිතා කරන්න, ඔබගේ උපාංගය මත දැනුම්දීම් රහිතව යෙදුම් ස්ථාපනය කරන්න, සහ ලොග් දත්ත කියවන්න."</string>
+    <string name="adbwifi_warning_title" msgid="727104571653031865">"නොරැහැන් දෝෂාවේක්ෂණය ඉඩ දෙන්නද?"</string>
+    <string name="adbwifi_warning_message" msgid="8005936574322702388">"නොරැහැන් දෝෂාවේක්ෂණය සංවර්ධන කටයුතු සඳහා පමණක් අදහස් කරයි. එය ඔබේ පරිගණකය සහ ඔබේ උපාංගය අතර දත්ත පිටපත් කිරීමට, දැනුම් දීමක් නොමැතිව ඔබේ උපාංගයේ යෙදුම් ස්ථාපනය කිරීමට සහ ලොග දත්ත කියවීමට පමණක් භාවිත කරන්න."</string>
     <string name="adb_keys_warning_message" msgid="2968555274488101220">"ඔබ මින්පෙර අවසර ලබාදුන් සියළුම පරිගණක වෙතින් USB නිදොස්කරණට ප්‍රවේශය අහෝසි කරන්නද?"</string>
     <string name="dev_settings_warning_title" msgid="8251234890169074553">"සංවර්ධන සැකසීම් වවලට අවසර දෙන්නද?"</string>
     <string name="dev_settings_warning_message" msgid="37741686486073668">"මෙම සැකසීම් වර්ධක භාවිතය සඳහා පමණි. ඔබගේ උපාංගයේ සහ යෙදුම්වල අක්‍රිය වීමට හෝ වැරදි ක්‍රියා කෙරුමකට ඒවා බලපෑ හැක."</string>
@@ -383,8 +412,7 @@
     <string name="daltonizer_mode_protanomaly" msgid="7805583306666608440">"වර්ණ දුර්වලතාවය (රතු-කොළ)"</string>
     <string name="daltonizer_mode_tritanomaly" msgid="7135266249220732267">"වර්ණ අන්ධතාවය (නිල්-කහ)"</string>
     <string name="accessibility_display_daltonizer_preference_title" msgid="1810693571332381974">"වර්ණ නිවැරදි කිරීම"</string>
-    <!-- no translation found for accessibility_display_daltonizer_preference_subtitle (6178138727195403796) -->
-    <skip />
+    <string name="accessibility_display_daltonizer_preference_subtitle" msgid="6178138727195403796">"වර්ණ අන්ධතාවෙන් පෙළෙන පුද්ගලයන්ට වඩාත් නිරවද්‍ය වර්ණ බැලීමට වර්ණ නිවැරදි කිරීම සහාය වේ"</string>
     <string name="daltonizer_type_overridden" msgid="4509604753672535721">"<xliff:g id="TITLE">%1$s</xliff:g> මගින් ඉක්මවන ලදී"</string>
     <string name="power_remaining_settings_home_page" msgid="4885165789445462557">"<xliff:g id="PERCENTAGE">%1$s</xliff:g> - <xliff:g id="TIME_STRING">%2$s</xliff:g>"</string>
     <string name="power_remaining_duration_only" msgid="8264199158671531431">"<xliff:g id="TIME_REMAINING">%1$s</xliff:g> ක් පමණ ඉතිරියි"</string>
@@ -403,21 +431,19 @@
     <string name="power_remaining_less_than_duration" msgid="1812668275239801236">"<xliff:g id="THRESHOLD">%1$s</xliff:g>ට වඩා අඩුවෙන් ඉතිරිය (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_more_than_subtext" msgid="7919119719242734848">"<xliff:g id="TIME_REMAINING">%1$s</xliff:g>ට වඩා වැඩියෙන් ඉතිරිය (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_only_more_than_subtext" msgid="3274496164769110480">"<xliff:g id="TIME_REMAINING">%1$s</xliff:g>කට වඩා වැඩියෙන් ඉතිරිය"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="6583866940347159957">"දුරකථනය ඉක්මනින් වැසිය හැකිය"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="8009177999719462724">"ටැබ්ලටය ඉක්මනින් වැසිය හැකිය"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="8320892540455268018">"උපාංගය ඉක්මනින් වැසිය හැකිය"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="6186572170809116621">"දුරකථනය ඉක්මනින් වැසිය හැකිය (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="1338758278145563121">"ටැබ්ලටය ඉක්මනින් වැසිය හැකිය (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="3699579688084774362">"උපාංගය ඉක්මනින් වැසිය හැකිය (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="137330009791560774">"දුරකථනය ඉක්මනින් වැසිය හැකිය"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="145489081521468132">"ටැබ්ලට් පරිගණකය ඉක්මනින් වැසිය හැකිය"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="1070562682853942350">"උපාංගය ඉක්මනින් වැසිය හැකිය"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="4429259621177089719">"දුරකථනය ඉක්මනින් වැසිය හැකිය (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="7703677921000858479">"ටැබ්ලට් පරිගණකය ඉක්මනින් වැසිය හැකිය (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="4374784375644214578">"උපාංගය ඉක්මනින් වැසිය හැකිය (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
     <string name="power_charging" msgid="6727132649743436802">"<xliff:g id="LEVEL">%1$s</xliff:g> - <xliff:g id="STATE">%2$s</xliff:g>"</string>
     <string name="power_remaining_charging_duration_only" msgid="7415639699283965818">"ආරෝපණය වන තෙක් <xliff:g id="TIME">%1$s</xliff:g> ඇත"</string>
     <string name="power_charging_duration" msgid="5005740040558984057">"<xliff:g id="LEVEL">%1$s</xliff:g> - ආරෝපණය වන තෙක් <xliff:g id="TIME">%2$s</xliff:g>"</string>
     <string name="battery_info_status_unknown" msgid="268625384868401114">"නොදනී"</string>
     <string name="battery_info_status_charging" msgid="4279958015430387405">"ආරෝපණය වෙමින්"</string>
-    <!-- no translation found for battery_info_status_charging_fast (8027559755902954885) -->
-    <skip />
-    <!-- no translation found for battery_info_status_charging_slow (3190803837168962319) -->
-    <skip />
+    <string name="battery_info_status_charging_fast" msgid="8027559755902954885">"ශීඝ්‍ර ආරෝපණය"</string>
+    <string name="battery_info_status_charging_slow" msgid="3190803837168962319">"සෙමින් ආරෝපණය"</string>
     <string name="battery_info_status_discharging" msgid="6962689305413556485">"ආරෝපණය නොවේ"</string>
     <string name="battery_info_status_not_charging" msgid="8330015078868707899">"පේනුගත කර ඇත, මේ අවස්ථාවේදී ආරෝපණය කළ නොහැකිය"</string>
     <string name="battery_info_status_full" msgid="4443168946046847468">"පූර්ණ"</string>
diff --git a/packages/SettingsLib/res/values-sk/strings.xml b/packages/SettingsLib/res/values-sk/strings.xml
index fc2ba1d..0f1fbce 100644
--- a/packages/SettingsLib/res/values-sk/strings.xml
+++ b/packages/SettingsLib/res/values-sk/strings.xml
@@ -206,6 +206,33 @@
     <string name="enable_adb" msgid="8072776357237289039">"Ladenie cez USB"</string>
     <string name="enable_adb_summary" msgid="3711526030096574316">"Povoliť režim ladenia s pripojeným zariadením USB"</string>
     <string name="clear_adb_keys" msgid="3010148733140369917">"Odvolať autorizácie na ladenie cez USB"</string>
+    <string name="enable_adb_wireless" msgid="6973226350963971018">"Bezdrôtové ladenie"</string>
+    <string name="enable_adb_wireless_summary" msgid="7344391423657093011">"Režim ladenia pri zapnutej sieti Wi-Fi"</string>
+    <string name="adb_wireless_error" msgid="721958772149779856">"Chyba"</string>
+    <string name="adb_wireless_settings" msgid="2295017847215680229">"Bezdrôtové ladenie"</string>
+    <string name="adb_wireless_list_empty_off" msgid="1713707973837255490">"Ak chcete zobraziť a používať dostupné zariadenia, zapnite bezdrôtové ladenie"</string>
+    <string name="adb_pair_method_qrcode_title" msgid="6982904096137468634">"Spárovať zariadenie pomocou QR kódu"</string>
+    <string name="adb_pair_method_qrcode_summary" msgid="3729901496856458634">"Spárujte nové zariadenia pomocou skenera QR kódov"</string>
+    <string name="adb_pair_method_code_title" msgid="1122590300445142904">"Spárovať zariadenie pomocou párovacieho kódu"</string>
+    <string name="adb_pair_method_code_summary" msgid="6370414511333685185">"Spárujte nové zariadenia pomocou šesťmiestneho kódu"</string>
+    <string name="adb_paired_devices_title" msgid="5268997341526217362">"Spárované zariadenia"</string>
+    <string name="adb_wireless_device_connected_summary" msgid="3039660790249148713">"Aktuálne pripojené"</string>
+    <string name="adb_wireless_device_details_title" msgid="7129369670526565786">"Podrobnosti o zariadení"</string>
+    <string name="adb_device_forget" msgid="193072400783068417">"Odstrániť"</string>
+    <string name="adb_device_fingerprint_title_format" msgid="291504822917843701">"Digitálny odtlačok zariadenia: <xliff:g id="FINGERPRINT_PARAM">%1$s</xliff:g>"</string>
+    <string name="adb_wireless_connection_failed_title" msgid="664211177427438438">"Pripojenie zlyhalo"</string>
+    <string name="adb_wireless_connection_failed_message" msgid="9213896700171602073">"Skontrolujte, či je zariadenie <xliff:g id="DEVICE_NAME">%1$s</xliff:g> pripojené k správnej sieti"</string>
+    <string name="adb_pairing_device_dialog_title" msgid="7141739231018530210">"Párovanie so zariadením"</string>
+    <string name="adb_pairing_device_dialog_pairing_code_label" msgid="3639239786669722731">"Párovací kód siete Wi-Fi"</string>
+    <string name="adb_pairing_device_dialog_failed_title" msgid="3426758947882091735">"Párovanie zlyhalo"</string>
+    <string name="adb_pairing_device_dialog_failed_msg" msgid="6611097519661997148">"Skontrolujte, či je zariadenie pripojené k rovnakej sieti."</string>
+    <string name="adb_wireless_qrcode_summary" msgid="8051414549011801917">"Spárujte zariadenie cez sieť Wi-Fi naskenovaním QR kódu"</string>
+    <string name="adb_wireless_verifying_qrcode_text" msgid="6123192424916029207">"Páruje sa zariadenie…"</string>
+    <string name="adb_qrcode_pairing_device_failed_msg" msgid="6936292092592914132">"Zariadenie sa nepodarilo spárovať. Buď bol QR kód nesprávny, alebo zariadenie nie je pripojené k rovnakej sieti."</string>
+    <string name="adb_wireless_ip_addr_preference_title" msgid="8335132107715311730">"Adresa IP a port"</string>
+    <string name="adb_wireless_qrcode_pairing_title" msgid="1906409667944674707">"Naskenujte QR kód"</string>
+    <string name="adb_wireless_qrcode_pairing_description" msgid="8578868049289910131">"Spárujte zariadenie cez sieť Wi-Fi naskenovaním QR kódu"</string>
+    <string name="keywords_adb_wireless" msgid="6507505581882171240">"adb, ladenie, dev"</string>
     <string name="bugreport_in_power" msgid="8664089072534638709">"Skratka hlásenia chyby"</string>
     <string name="bugreport_in_power_summary" msgid="1885529649381831775">"Zobraziť v hlavnej ponuke tlačidlo na vytvorenie hlásenia chyby"</string>
     <string name="keep_screen_on" msgid="1187161672348797558">"Nevypínať obrazovku"</string>
@@ -271,6 +298,8 @@
     <string name="tethering_hardware_offload_summary" msgid="7801345335142803029">"Ak je k dispozícii hardvérová akcelerácia tetheringu, používať ju"</string>
     <string name="adb_warning_title" msgid="7708653449506485728">"Povoliť ladenie cez USB?"</string>
     <string name="adb_warning_message" msgid="8145270656419669221">"Ladenie cez USB je určené iba na účely vývoja. Možno ho použiť na kopírovanie dát medzi počítačom a zariadením, inštaláciu aplikácií do zariadenia bez upozornenia a čítanie dát denníka."</string>
+    <string name="adbwifi_warning_title" msgid="727104571653031865">"Chcete povoliť bezdrôtové ladenie?"</string>
+    <string name="adbwifi_warning_message" msgid="8005936574322702388">"Bezdrôtové ladenie je určené iba na účely vývoja. Môžete pomocou neho kopírovať dáta medzi počítačom a zariadením, inštalovať bez upozornenia aplikácie do zariadenia a čítať dáta denníkov."</string>
     <string name="adb_keys_warning_message" msgid="2968555274488101220">"Chcete všetkým v minulosti autorizovaným počítačom odvolať prístup k ladeniu cez USB?"</string>
     <string name="dev_settings_warning_title" msgid="8251234890169074553">"Povoliť nastavenia pre vývojárov?"</string>
     <string name="dev_settings_warning_message" msgid="37741686486073668">"Tieto nastavenia sú určené len pre vývojárov. Môžu spôsobiť poruchu alebo nesprávne fungovanie zariadenia a nainštalovaných aplikácií."</string>
@@ -383,8 +412,7 @@
     <string name="daltonizer_mode_protanomaly" msgid="7805583306666608440">"Protanomália (červená a zelená)"</string>
     <string name="daltonizer_mode_tritanomaly" msgid="7135266249220732267">"Tritanomália (modrá a žltá)"</string>
     <string name="accessibility_display_daltonizer_preference_title" msgid="1810693571332381974">"Úprava farieb"</string>
-    <!-- no translation found for accessibility_display_daltonizer_preference_subtitle (6178138727195403796) -->
-    <skip />
+    <string name="accessibility_display_daltonizer_preference_subtitle" msgid="6178138727195403796">"Korekcia farieb pomáha farboslepým ľuďom vidieť presnejšie farby"</string>
     <string name="daltonizer_type_overridden" msgid="4509604753672535721">"Prekonané predvoľbou <xliff:g id="TITLE">%1$s</xliff:g>"</string>
     <string name="power_remaining_settings_home_page" msgid="4885165789445462557">"<xliff:g id="PERCENTAGE">%1$s</xliff:g> – <xliff:g id="TIME_STRING">%2$s</xliff:g>"</string>
     <string name="power_remaining_duration_only" msgid="8264199158671531431">"Zostáva približne <xliff:g id="TIME_REMAINING">%1$s</xliff:g>"</string>
@@ -403,21 +431,19 @@
     <string name="power_remaining_less_than_duration" msgid="1812668275239801236">"Zostáva menej ako <xliff:g id="THRESHOLD">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_more_than_subtext" msgid="7919119719242734848">"Zostáva viac ako <xliff:g id="TIME_REMAINING">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_only_more_than_subtext" msgid="3274496164769110480">"Zostáva viac ako <xliff:g id="TIME_REMAINING">%1$s</xliff:g>"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="6583866940347159957">"Telefón sa môže čoskoro vypnúť"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="8009177999719462724">"Tablet sa môže čoskoro vypnúť"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="8320892540455268018">"Zariadenie sa môže čoskoro vypnúť"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="6186572170809116621">"Telefón sa môže čoskoro vypnúť (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="1338758278145563121">"Tablet sa môže čoskoro vypnúť (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="3699579688084774362">"Zariadenie sa môže čoskoro vypnúť (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="137330009791560774">"Telefón sa môže čoskoro vypnúť"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="145489081521468132">"Tablet sa môže čoskoro vypnúť"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="1070562682853942350">"Zariadenie sa môže čoskoro vypnúť"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="4429259621177089719">"Telefón sa môže čoskoro vypnúť (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="7703677921000858479">"Tablet sa môže čoskoro vypnúť (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="4374784375644214578">"Zariadenie sa môže čoskoro vypnúť (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
     <string name="power_charging" msgid="6727132649743436802">"<xliff:g id="LEVEL">%1$s</xliff:g> – <xliff:g id="STATE">%2$s</xliff:g>"</string>
     <string name="power_remaining_charging_duration_only" msgid="7415639699283965818">"Zostávajúci čas do úplného nabitia: <xliff:g id="TIME">%1$s</xliff:g>"</string>
     <string name="power_charging_duration" msgid="5005740040558984057">"<xliff:g id="LEVEL">%1$s</xliff:g> – <xliff:g id="TIME">%2$s</xliff:g> do úplného nabitia"</string>
     <string name="battery_info_status_unknown" msgid="268625384868401114">"Neznáme"</string>
     <string name="battery_info_status_charging" msgid="4279958015430387405">"Nabíja sa"</string>
-    <!-- no translation found for battery_info_status_charging_fast (8027559755902954885) -->
-    <skip />
-    <!-- no translation found for battery_info_status_charging_slow (3190803837168962319) -->
-    <skip />
+    <string name="battery_info_status_charging_fast" msgid="8027559755902954885">"Rýchle nabíjanie"</string>
+    <string name="battery_info_status_charging_slow" msgid="3190803837168962319">"Pomalé nabíjanie"</string>
     <string name="battery_info_status_discharging" msgid="6962689305413556485">"Nenabíja sa"</string>
     <string name="battery_info_status_not_charging" msgid="8330015078868707899">"Pripojené, ale nie je možné nabíjať"</string>
     <string name="battery_info_status_full" msgid="4443168946046847468">"Nabitá"</string>
diff --git a/packages/SettingsLib/res/values-sl/strings.xml b/packages/SettingsLib/res/values-sl/strings.xml
index cda2e06..08a74fb 100644
--- a/packages/SettingsLib/res/values-sl/strings.xml
+++ b/packages/SettingsLib/res/values-sl/strings.xml
@@ -206,6 +206,33 @@
     <string name="enable_adb" msgid="8072776357237289039">"Odpravljanje težav prek USB-ja"</string>
     <string name="enable_adb_summary" msgid="3711526030096574316">"Način za odpravljanje težav, ko je vzpostavljena povezava USB"</string>
     <string name="clear_adb_keys" msgid="3010148733140369917">"Preklic dovoljenj za odpravljanje težav prek povezave USB"</string>
+    <string name="enable_adb_wireless" msgid="6973226350963971018">"Brezžično odpravljanje napak"</string>
+    <string name="enable_adb_wireless_summary" msgid="7344391423657093011">"Način za odpravljanje napak pri vzpostavljeni povezavi Wi‑Fi"</string>
+    <string name="adb_wireless_error" msgid="721958772149779856">"Napaka"</string>
+    <string name="adb_wireless_settings" msgid="2295017847215680229">"Brezžično odpravljanje napak"</string>
+    <string name="adb_wireless_list_empty_off" msgid="1713707973837255490">"Če si želite ogledati in uporabljati razpoložljive naprave, vklopite brezžično odpravljanje napak"</string>
+    <string name="adb_pair_method_qrcode_title" msgid="6982904096137468634">"Seznanjanje naprave s kodo QR"</string>
+    <string name="adb_pair_method_qrcode_summary" msgid="3729901496856458634">"Seznanjanje novih naprav z optičnim bralnikom kod QR"</string>
+    <string name="adb_pair_method_code_title" msgid="1122590300445142904">"Seznanjanje naprave s kodo za seznanjanje"</string>
+    <string name="adb_pair_method_code_summary" msgid="6370414511333685185">"Seznanjanje novih naprav s šestmestno kodo"</string>
+    <string name="adb_paired_devices_title" msgid="5268997341526217362">"Seznanjene naprave"</string>
+    <string name="adb_wireless_device_connected_summary" msgid="3039660790249148713">"Trenutno povezano"</string>
+    <string name="adb_wireless_device_details_title" msgid="7129369670526565786">"Podrobnosti o napravi"</string>
+    <string name="adb_device_forget" msgid="193072400783068417">"Pozabi"</string>
+    <string name="adb_device_fingerprint_title_format" msgid="291504822917843701">"Prstni odtis naprave: <xliff:g id="FINGERPRINT_PARAM">%1$s</xliff:g>"</string>
+    <string name="adb_wireless_connection_failed_title" msgid="664211177427438438">"Povezava neuspešna"</string>
+    <string name="adb_wireless_connection_failed_message" msgid="9213896700171602073">"Preverite, ali je naprava <xliff:g id="DEVICE_NAME">%1$s</xliff:g> povezana v ustrezno omrežje"</string>
+    <string name="adb_pairing_device_dialog_title" msgid="7141739231018530210">"Seznanitev z napravo"</string>
+    <string name="adb_pairing_device_dialog_pairing_code_label" msgid="3639239786669722731">"Koda za seznanjanje po Wi‑Fi-ju"</string>
+    <string name="adb_pairing_device_dialog_failed_title" msgid="3426758947882091735">"Seznanjanje neuspešno"</string>
+    <string name="adb_pairing_device_dialog_failed_msg" msgid="6611097519661997148">"Preverite, ali je naprava povezana v isto omrežje."</string>
+    <string name="adb_wireless_qrcode_summary" msgid="8051414549011801917">"Seznanitev naprave prek Wi‑Fi-ja z optičnim branjem kode QR"</string>
+    <string name="adb_wireless_verifying_qrcode_text" msgid="6123192424916029207">"Seznanjanje naprave …"</string>
+    <string name="adb_qrcode_pairing_device_failed_msg" msgid="6936292092592914132">"Seznanitev naprave ni uspela. Koda QR je nepravilna ali pa naprava ni povezana v isto omrežje."</string>
+    <string name="adb_wireless_ip_addr_preference_title" msgid="8335132107715311730">"Naslov IP in vrata"</string>
+    <string name="adb_wireless_qrcode_pairing_title" msgid="1906409667944674707">"Optično branje kode QR"</string>
+    <string name="adb_wireless_qrcode_pairing_description" msgid="8578868049289910131">"Seznanitev naprave prek Wi‑Fi-ja z optičnim branjem kode QR"</string>
+    <string name="keywords_adb_wireless" msgid="6507505581882171240">"adb, odpravljanje napak, razvoj"</string>
     <string name="bugreport_in_power" msgid="8664089072534638709">"Bližnjica za poročanje o napakah"</string>
     <string name="bugreport_in_power_summary" msgid="1885529649381831775">"Prikaz gumba za ustvarjanje poročila o napakah v meniju za vklop/izklop"</string>
     <string name="keep_screen_on" msgid="1187161672348797558">"Brez izklopa zaslona"</string>
@@ -271,6 +298,8 @@
     <string name="tethering_hardware_offload_summary" msgid="7801345335142803029">"Uporabi strojno pospeševanje za internetno povezavo prek mobilnega telefona, če je na voljo"</string>
     <string name="adb_warning_title" msgid="7708653449506485728">"Ali dovolite odpravljanje težav s povezavo USB?"</string>
     <string name="adb_warning_message" msgid="8145270656419669221">"Odpravljanje težav s povezavo USB je namenjeno samo za razvoj. Lahko ga uporabljate za kopiranje podatkov med računalnikom in napravo, nameščanje aplikacij v napravo brez obveščanja in branje podatkov v dnevniku."</string>
+    <string name="adbwifi_warning_title" msgid="727104571653031865">"Ali dovolite brezžično odpravljanje napak?"</string>
+    <string name="adbwifi_warning_message" msgid="8005936574322702388">"Brezžično odpravljanje napak je namenjeno samo za razvoj. Lahko ga uporabljate za kopiranje podatkov med računalnikom in napravo, nameščanje aplikacij v napravo brez obveščanja in branje podatkov v dnevniku."</string>
     <string name="adb_keys_warning_message" msgid="2968555274488101220">"Ali želite preklicati dostop do odpravljanja težav prek povezave USB iz vseh računalnikov, ki ste jih pooblastili?"</string>
     <string name="dev_settings_warning_title" msgid="8251234890169074553">"Ali želite omogočiti nastavitve za razvijanje?"</string>
     <string name="dev_settings_warning_message" msgid="37741686486073668">"Te nastavitve so namenjene samo za razvijanje in lahko povzročijo prekinitev ali napačno delovanje naprave in aplikacij v njej."</string>
@@ -383,8 +412,7 @@
     <string name="daltonizer_mode_protanomaly" msgid="7805583306666608440">"Protanomalija (rdeča – zelena)"</string>
     <string name="daltonizer_mode_tritanomaly" msgid="7135266249220732267">"Tritanomalija (modra – rumena)"</string>
     <string name="accessibility_display_daltonizer_preference_title" msgid="1810693571332381974">"Popravljanje barv"</string>
-    <!-- no translation found for accessibility_display_daltonizer_preference_subtitle (6178138727195403796) -->
-    <skip />
+    <string name="accessibility_display_daltonizer_preference_subtitle" msgid="6178138727195403796">"Popravljanje barv osebam z barvno slepoto pomaga, da vidijo razločnejše barve"</string>
     <string name="daltonizer_type_overridden" msgid="4509604753672535721">"Preglasila nastavitev: <xliff:g id="TITLE">%1$s</xliff:g>"</string>
     <string name="power_remaining_settings_home_page" msgid="4885165789445462557">"<xliff:g id="PERCENTAGE">%1$s</xliff:g> – <xliff:g id="TIME_STRING">%2$s</xliff:g>"</string>
     <string name="power_remaining_duration_only" msgid="8264199158671531431">"Še približno <xliff:g id="TIME_REMAINING">%1$s</xliff:g>"</string>
@@ -403,21 +431,19 @@
     <string name="power_remaining_less_than_duration" msgid="1812668275239801236">"Preostanek: manj kot <xliff:g id="THRESHOLD">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_more_than_subtext" msgid="7919119719242734848">"Preostali čas delovanja: manj kot <xliff:g id="TIME_REMAINING">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_only_more_than_subtext" msgid="3274496164769110480">"Preostali čas delovanja: več kot <xliff:g id="TIME_REMAINING">%1$s</xliff:g>"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="6583866940347159957">"Telefon se bo morda kmalu zaustavil"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="8009177999719462724">"Tablični računalnik se bo morda kmalu zaustavil"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="8320892540455268018">"Naprava se bo morda kmalu zaustavila"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="6186572170809116621">"Telefon se bo morda kmalu zaustavil (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="1338758278145563121">"Tablični računalnik se bo morda kmalu zaustavil (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="3699579688084774362">"Naprava se bo morda kmalu zaustavila (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="137330009791560774">"Telefon se bo morda kmalu zaustavil"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="145489081521468132">"Tablični računalnik se bo morda kmalu zaustavil"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="1070562682853942350">"Naprava se bo morda kmalu zaustavila"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="4429259621177089719">"Telefon se bo morda kmalu zaustavil (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="7703677921000858479">"Tablični računalnik se bo morda kmalu zaustavil (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="4374784375644214578">"Naprava se bo morda kmalu zaustavila (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
     <string name="power_charging" msgid="6727132649743436802">"<xliff:g id="LEVEL">%1$s</xliff:g> – <xliff:g id="STATE">%2$s</xliff:g>"</string>
     <string name="power_remaining_charging_duration_only" msgid="7415639699283965818">"Še <xliff:g id="TIME">%1$s</xliff:g> do polne napolnjenosti"</string>
     <string name="power_charging_duration" msgid="5005740040558984057">"<xliff:g id="LEVEL">%1$s</xliff:g> – <xliff:g id="TIME">%2$s</xliff:g> do polne napolnjenosti"</string>
     <string name="battery_info_status_unknown" msgid="268625384868401114">"Neznano"</string>
     <string name="battery_info_status_charging" msgid="4279958015430387405">"Polnjenje"</string>
-    <!-- no translation found for battery_info_status_charging_fast (8027559755902954885) -->
-    <skip />
-    <!-- no translation found for battery_info_status_charging_slow (3190803837168962319) -->
-    <skip />
+    <string name="battery_info_status_charging_fast" msgid="8027559755902954885">"Hitro polnjenje"</string>
+    <string name="battery_info_status_charging_slow" msgid="3190803837168962319">"Počasno polnjenje"</string>
     <string name="battery_info_status_discharging" msgid="6962689305413556485">"Se ne polni"</string>
     <string name="battery_info_status_not_charging" msgid="8330015078868707899">"Priključeno, trenutno ni mogoče polniti"</string>
     <string name="battery_info_status_full" msgid="4443168946046847468">"Poln"</string>
diff --git a/packages/SettingsLib/res/values-sq/strings.xml b/packages/SettingsLib/res/values-sq/strings.xml
index 9854017..1bd9424 100644
--- a/packages/SettingsLib/res/values-sq/strings.xml
+++ b/packages/SettingsLib/res/values-sq/strings.xml
@@ -206,6 +206,33 @@
     <string name="enable_adb" msgid="8072776357237289039">"Korrigjimi i USB-së"</string>
     <string name="enable_adb_summary" msgid="3711526030096574316">"Korrigjo gabimet e modalitetit kur UBS-ja është e lidhur"</string>
     <string name="clear_adb_keys" msgid="3010148733140369917">"Anulo autorizimet e korrigjimeve të gabimeve të USB-së"</string>
+    <string name="enable_adb_wireless" msgid="6973226350963971018">"Korrigjimi me valë"</string>
+    <string name="enable_adb_wireless_summary" msgid="7344391423657093011">"Regjimi i korrigjimit kur Wi‑Fi është i lidhur"</string>
+    <string name="adb_wireless_error" msgid="721958772149779856">"Gabim"</string>
+    <string name="adb_wireless_settings" msgid="2295017847215680229">"Korrigjimi me valë"</string>
+    <string name="adb_wireless_list_empty_off" msgid="1713707973837255490">"Për të parë dhe përdorur pajisjet e disponueshme, aktivizo korrigjimin me valë"</string>
+    <string name="adb_pair_method_qrcode_title" msgid="6982904096137468634">"Çifto pajisjen me kod QR"</string>
+    <string name="adb_pair_method_qrcode_summary" msgid="3729901496856458634">"Çifto pajisjet e reja duke përdorur skanerin e kodeve QR"</string>
+    <string name="adb_pair_method_code_title" msgid="1122590300445142904">"Çifto pajisjen me kodin e çiftimit"</string>
+    <string name="adb_pair_method_code_summary" msgid="6370414511333685185">"Çifto pajisjet e reja duke përdorur kodin me gjashtë shifra"</string>
+    <string name="adb_paired_devices_title" msgid="5268997341526217362">"Pajisjet e çiftuara"</string>
+    <string name="adb_wireless_device_connected_summary" msgid="3039660790249148713">"Të lidhur aktualisht"</string>
+    <string name="adb_wireless_device_details_title" msgid="7129369670526565786">"Detajet e pajisjes"</string>
+    <string name="adb_device_forget" msgid="193072400783068417">"Harro"</string>
+    <string name="adb_device_fingerprint_title_format" msgid="291504822917843701">"Gjurma e gishtit e pajisjes: <xliff:g id="FINGERPRINT_PARAM">%1$s</xliff:g>"</string>
+    <string name="adb_wireless_connection_failed_title" msgid="664211177427438438">"Lidhja ishte e pasuksesshme"</string>
+    <string name="adb_wireless_connection_failed_message" msgid="9213896700171602073">"Sigurohu që <xliff:g id="DEVICE_NAME">%1$s</xliff:g> të jetë e lidhur me rrjetin e duhur"</string>
+    <string name="adb_pairing_device_dialog_title" msgid="7141739231018530210">"Çifto me pajisjen"</string>
+    <string name="adb_pairing_device_dialog_pairing_code_label" msgid="3639239786669722731">"Kodi i çiftimit të Wi‑Fi"</string>
+    <string name="adb_pairing_device_dialog_failed_title" msgid="3426758947882091735">"Çiftimi ishte i pasuksesshëm"</string>
+    <string name="adb_pairing_device_dialog_failed_msg" msgid="6611097519661997148">"Sigurohu që pajisja të jetë e lidhur me të njëjtin rrjet"</string>
+    <string name="adb_wireless_qrcode_summary" msgid="8051414549011801917">"Çifto pajisjen përmes Wi‑Fi duke skanuar një kod QR"</string>
+    <string name="adb_wireless_verifying_qrcode_text" msgid="6123192424916029207">"Po çifton pajisjen…"</string>
+    <string name="adb_qrcode_pairing_device_failed_msg" msgid="6936292092592914132">"Çiftimi i pajisjes dështoi. Ose kodi QR nuk ishte i saktë, ose pajisja nuk është e lidhur me të njëjtin rrjet."</string>
+    <string name="adb_wireless_ip_addr_preference_title" msgid="8335132107715311730">"Adresa e IP-së dhe porta"</string>
+    <string name="adb_wireless_qrcode_pairing_title" msgid="1906409667944674707">"Skano kodin QR"</string>
+    <string name="adb_wireless_qrcode_pairing_description" msgid="8578868049289910131">"Çifto pajisjen përmes Wi‑Fi duke skanuar një kod QR"</string>
+    <string name="keywords_adb_wireless" msgid="6507505581882171240">"adb, korrigjimi, zhvilluesi"</string>
     <string name="bugreport_in_power" msgid="8664089072534638709">"Shkurtorja e raportit të defektit në kod"</string>
     <string name="bugreport_in_power_summary" msgid="1885529649381831775">"Shfaq një buton në menynë e fikjes për marrjen e raportit të defekteve"</string>
     <string name="keep_screen_on" msgid="1187161672348797558">"Qëndro zgjuar"</string>
@@ -271,6 +298,8 @@
     <string name="tethering_hardware_offload_summary" msgid="7801345335142803029">"Përdor përshpejtimin e harduerit për ndarjen e lidhjes (internet) nëse është i disponueshëm"</string>
     <string name="adb_warning_title" msgid="7708653449506485728">"Të lejohet korrigjimi i USB-së?"</string>
     <string name="adb_warning_message" msgid="8145270656419669221">"Korrigjuesi i USB-së është vetëm për qëllime zhvillimore. Përdore për të kopjuar të dhëna mes kompjuterit dhe pajisjes tënde, për të instaluar aplikacione në pajisjen tënde pa asnjë njoftim si dhe për të lexuar të dhënat e ditarit."</string>
+    <string name="adbwifi_warning_title" msgid="727104571653031865">"Të lejohet korrigjimi me valë?"</string>
+    <string name="adbwifi_warning_message" msgid="8005936574322702388">"Korrigjimi me valë është vetëm për qëllime zhvillimore. Përdore për të kopjuar të dhëna mes kompjuterit dhe pajisjes sate, për të instaluar aplikacione në pajisjen tënde pa asnjë njoftim si dhe për të lexuar të dhënat e regjistrit."</string>
     <string name="adb_keys_warning_message" msgid="2968555274488101220">"Të bllokohet qasja për korrigjim të USB-së nga të gjithë kompjuterët që ke autorizuar më parë?"</string>
     <string name="dev_settings_warning_title" msgid="8251234890169074553">"Të lejohen cilësimet e zhvillimit?"</string>
     <string name="dev_settings_warning_message" msgid="37741686486073668">"Këto cilësime janë të projektuara vetëm për përdorim në programim. Ato mund të shkaktojnë që pajisja dhe aplikacionet në të, të mos punojnë ose të veprojnë në mënyrë të gabuar."</string>
@@ -383,8 +412,7 @@
     <string name="daltonizer_mode_protanomaly" msgid="7805583306666608440">"Protanomali (e kuqe - e gjelbër)"</string>
     <string name="daltonizer_mode_tritanomaly" msgid="7135266249220732267">"Tritanomali (e kaltër - e verdhë)"</string>
     <string name="accessibility_display_daltonizer_preference_title" msgid="1810693571332381974">"Korrigjimi i ngjyrës"</string>
-    <!-- no translation found for accessibility_display_daltonizer_preference_subtitle (6178138727195403796) -->
-    <skip />
+    <string name="accessibility_display_daltonizer_preference_subtitle" msgid="6178138727195403796">"Korrigjimi i ngjyrës i ndihmon njerëzit me daltonizëm të shohin ngjyra më të sakta"</string>
     <string name="daltonizer_type_overridden" msgid="4509604753672535721">"Mbivendosur nga <xliff:g id="TITLE">%1$s</xliff:g>"</string>
     <string name="power_remaining_settings_home_page" msgid="4885165789445462557">"<xliff:g id="PERCENTAGE">%1$s</xliff:g> - <xliff:g id="TIME_STRING">%2$s</xliff:g>"</string>
     <string name="power_remaining_duration_only" msgid="8264199158671531431">"Rreth <xliff:g id="TIME_REMAINING">%1$s</xliff:g> të mbetura"</string>
@@ -403,21 +431,19 @@
     <string name="power_remaining_less_than_duration" msgid="1812668275239801236">"Mbeten më pak se <xliff:g id="THRESHOLD">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_more_than_subtext" msgid="7919119719242734848">"Mbeten më shumë se <xliff:g id="TIME_REMAINING">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_only_more_than_subtext" msgid="3274496164769110480">"Mbeten më shumë se <xliff:g id="TIME_REMAINING">%1$s</xliff:g>"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="6583866940347159957">"Telefoni mund të fiket së shpejti"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="8009177999719462724">"Tableti mund të fiket së shpejti"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="8320892540455268018">"Pajisja mund të fiket së shpejti"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="6186572170809116621">"Telefoni mund të fiket së shpejti (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="1338758278145563121">"Tableti mund të fiket së shpejti (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="3699579688084774362">"Pajisja mund të fiket së shpejti (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="137330009791560774">"Telefoni mund të fiket së shpejti"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="145489081521468132">"Tableti mund të fiket së shpejti"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="1070562682853942350">"Pajisja mund të fiket së shpejti"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="4429259621177089719">"Telefoni mund të fiket së shpejti (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="7703677921000858479">"Tableti mund të fiket së shpejti (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="4374784375644214578">"Pajisja mund të fiket së shpejti (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
     <string name="power_charging" msgid="6727132649743436802">"<xliff:g id="LEVEL">%1$s</xliff:g> - <xliff:g id="STATE">%2$s</xliff:g>"</string>
     <string name="power_remaining_charging_duration_only" msgid="7415639699283965818">"<xliff:g id="TIME">%1$s</xliff:g> të mbetura për karikimin"</string>
     <string name="power_charging_duration" msgid="5005740040558984057">"<xliff:g id="LEVEL">%1$s</xliff:g> - <xliff:g id="TIME">%2$s</xliff:g> deri sa të karikohen"</string>
     <string name="battery_info_status_unknown" msgid="268625384868401114">"I panjohur"</string>
     <string name="battery_info_status_charging" msgid="4279958015430387405">"Po karikohet"</string>
-    <!-- no translation found for battery_info_status_charging_fast (8027559755902954885) -->
-    <skip />
-    <!-- no translation found for battery_info_status_charging_slow (3190803837168962319) -->
-    <skip />
+    <string name="battery_info_status_charging_fast" msgid="8027559755902954885">"Po ngarkon me shpejtësi"</string>
+    <string name="battery_info_status_charging_slow" msgid="3190803837168962319">"Po karikohet ngadalë"</string>
     <string name="battery_info_status_discharging" msgid="6962689305413556485">"Nuk po karikohet"</string>
     <string name="battery_info_status_not_charging" msgid="8330015078868707899">"Në prizë, por nuk mund të ngarkohet për momentin"</string>
     <string name="battery_info_status_full" msgid="4443168946046847468">"E mbushur"</string>
diff --git a/packages/SettingsLib/res/values-sr/strings.xml b/packages/SettingsLib/res/values-sr/strings.xml
index b59a568..3355c57 100644
--- a/packages/SettingsLib/res/values-sr/strings.xml
+++ b/packages/SettingsLib/res/values-sr/strings.xml
@@ -206,6 +206,33 @@
     <string name="enable_adb" msgid="8072776357237289039">"Отклањање USB грешака"</string>
     <string name="enable_adb_summary" msgid="3711526030096574316">"Режим отклањања грешака када је USB повезан"</string>
     <string name="clear_adb_keys" msgid="3010148733140369917">"Опозивање одобрења за уклањање USB грешака"</string>
+    <string name="enable_adb_wireless" msgid="6973226350963971018">"Бежично отклањање грешака"</string>
+    <string name="enable_adb_wireless_summary" msgid="7344391423657093011">"Режим за отклањање грешака када је Wi‑Fi повезан"</string>
+    <string name="adb_wireless_error" msgid="721958772149779856">"Грешка"</string>
+    <string name="adb_wireless_settings" msgid="2295017847215680229">"Бежично отклањање грешака"</string>
+    <string name="adb_wireless_list_empty_off" msgid="1713707973837255490">"Да бисте видели и користили доступне уређаје, укључите бежично отклањање грешака"</string>
+    <string name="adb_pair_method_qrcode_title" msgid="6982904096137468634">"Упарите уређај помоћу QR кода"</string>
+    <string name="adb_pair_method_qrcode_summary" msgid="3729901496856458634">"Упарите нове уређаје помоћу читача QR кода"</string>
+    <string name="adb_pair_method_code_title" msgid="1122590300445142904">"Упарите уређај помоћу кода за упаривање"</string>
+    <string name="adb_pair_method_code_summary" msgid="6370414511333685185">"Упарите нове уређаје помоћу шестоцифреног кода"</string>
+    <string name="adb_paired_devices_title" msgid="5268997341526217362">"Упарени уређаји"</string>
+    <string name="adb_wireless_device_connected_summary" msgid="3039660790249148713">"Тренутно је повезано"</string>
+    <string name="adb_wireless_device_details_title" msgid="7129369670526565786">"Детаљи о уређају"</string>
+    <string name="adb_device_forget" msgid="193072400783068417">"Заборави"</string>
+    <string name="adb_device_fingerprint_title_format" msgid="291504822917843701">"Отисак прста на уређају: <xliff:g id="FINGERPRINT_PARAM">%1$s</xliff:g>"</string>
+    <string name="adb_wireless_connection_failed_title" msgid="664211177427438438">"Повезивање није успело"</string>
+    <string name="adb_wireless_connection_failed_message" msgid="9213896700171602073">"Уверите се да је <xliff:g id="DEVICE_NAME">%1$s</xliff:g> повезан са одговарајућом мрежом"</string>
+    <string name="adb_pairing_device_dialog_title" msgid="7141739231018530210">"Упарите са уређајем"</string>
+    <string name="adb_pairing_device_dialog_pairing_code_label" msgid="3639239786669722731">"Кôд за упаривање преко Wi‑Fi-ја"</string>
+    <string name="adb_pairing_device_dialog_failed_title" msgid="3426758947882091735">"Упаривање није успело"</string>
+    <string name="adb_pairing_device_dialog_failed_msg" msgid="6611097519661997148">"Уверите се да је уређај повезан на исту мрежу."</string>
+    <string name="adb_wireless_qrcode_summary" msgid="8051414549011801917">"Упарите уређај помоћу Wi‑Fi мреже или тако што ћете скенирати QR кôд"</string>
+    <string name="adb_wireless_verifying_qrcode_text" msgid="6123192424916029207">"Упарује се уређај…"</string>
+    <string name="adb_qrcode_pairing_device_failed_msg" msgid="6936292092592914132">"Упаривање уређаја није успело. QR кôд је погрешан или уређај није повезан са истом мрежом."</string>
+    <string name="adb_wireless_ip_addr_preference_title" msgid="8335132107715311730">"IP адреса и порт"</string>
+    <string name="adb_wireless_qrcode_pairing_title" msgid="1906409667944674707">"Скенирај QR кôд"</string>
+    <string name="adb_wireless_qrcode_pairing_description" msgid="8578868049289910131">"Упарите уређај помоћу Wi‑Fi мреже или тако што ћете скенирати QR кôд"</string>
+    <string name="keywords_adb_wireless" msgid="6507505581882171240">"adb, отклањање грешака, програмер"</string>
     <string name="bugreport_in_power" msgid="8664089072534638709">"Пречица за извештај о грешкама"</string>
     <string name="bugreport_in_power_summary" msgid="1885529649381831775">"Прикажи дугме у менију напајања за прављење извештаја о грешкама"</string>
     <string name="keep_screen_on" msgid="1187161672348797558">"Не закључавај"</string>
@@ -271,6 +298,8 @@
     <string name="tethering_hardware_offload_summary" msgid="7801345335142803029">"Користи хардверско убрзање привезивања ако је доступно"</string>
     <string name="adb_warning_title" msgid="7708653449506485728">"Дозволи отклањање USB грешака?"</string>
     <string name="adb_warning_message" msgid="8145270656419669221">"Отклањање USB грешака намењено је само за сврхе програмирања. Користите га за копирање података са рачунара на уређај и обрнуто, инсталирање апликација на уређају без обавештења и читање података из евиденције."</string>
+    <string name="adbwifi_warning_title" msgid="727104571653031865">"Желите да дозволите бежично отклањање грешака?"</string>
+    <string name="adbwifi_warning_message" msgid="8005936574322702388">"Бежично отклањање грешака намењено је само програмирању. Користите га за копирање података са рачунара на уређај и обрнуто, инсталирање апликација на уређају без обавештења и читање података из евиденције."</string>
     <string name="adb_keys_warning_message" msgid="2968555274488101220">"Желите ли да опозовете приступ отклањању USB грешака са свих рачунара које сте претходно одобрили?"</string>
     <string name="dev_settings_warning_title" msgid="8251234890169074553">"Желите ли да омогућите програмерска подешавања?"</string>
     <string name="dev_settings_warning_message" msgid="37741686486073668">"Ова подешавања су намењена само за програмирање. Могу да изазову престанак функционисања или неочекивано понашање уређаја и апликација на њему."</string>
@@ -383,8 +412,7 @@
     <string name="daltonizer_mode_protanomaly" msgid="7805583306666608440">"Протаномалија (црвено-зелено)"</string>
     <string name="daltonizer_mode_tritanomaly" msgid="7135266249220732267">"Тританомалија (плаво-жуто)"</string>
     <string name="accessibility_display_daltonizer_preference_title" msgid="1810693571332381974">"Корекција боја"</string>
-    <!-- no translation found for accessibility_display_daltonizer_preference_subtitle (6178138727195403796) -->
-    <skip />
+    <string name="accessibility_display_daltonizer_preference_subtitle" msgid="6178138727195403796">"Корекција боја помаже људима који су далтонисти да прецизније виде боје"</string>
     <string name="daltonizer_type_overridden" msgid="4509604753672535721">"Замењује га <xliff:g id="TITLE">%1$s</xliff:g>"</string>
     <string name="power_remaining_settings_home_page" msgid="4885165789445462557">"<xliff:g id="PERCENTAGE">%1$s</xliff:g>–<xliff:g id="TIME_STRING">%2$s</xliff:g>"</string>
     <string name="power_remaining_duration_only" msgid="8264199158671531431">"Преостало је око <xliff:g id="TIME_REMAINING">%1$s</xliff:g>"</string>
@@ -403,21 +431,19 @@
     <string name="power_remaining_less_than_duration" msgid="1812668275239801236">"Преостало је мање од <xliff:g id="THRESHOLD">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_more_than_subtext" msgid="7919119719242734848">"Преостало је више од <xliff:g id="TIME_REMAINING">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_only_more_than_subtext" msgid="3274496164769110480">"Преостало је више од <xliff:g id="TIME_REMAINING">%1$s</xliff:g>"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="6583866940347159957">"Телефон ће се ускоро искључити"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="8009177999719462724">"Таблет ће се ускоро искључити"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="8320892540455268018">"Уређај ће се ускоро искључити"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="6186572170809116621">"Телефон ће се ускоро искључити (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="1338758278145563121">"Таблет ће се ускоро искључити (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="3699579688084774362">"Уређај ће се ускоро искључити (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="137330009791560774">"Телефон ће се ускоро искључити"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="145489081521468132">"Таблет ће се ускоро искључити"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="1070562682853942350">"Уређај ће се ускоро искључити"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="4429259621177089719">"Телефон ће се ускоро искључити (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="7703677921000858479">"Таблет ће се ускоро искључити (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="4374784375644214578">"Уређај ће се ускоро искључити (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
     <string name="power_charging" msgid="6727132649743436802">"<xliff:g id="LEVEL">%1$s</xliff:g> – <xliff:g id="STATE">%2$s</xliff:g>"</string>
     <string name="power_remaining_charging_duration_only" msgid="7415639699283965818">"Напуниће се за <xliff:g id="TIME">%1$s</xliff:g>"</string>
     <string name="power_charging_duration" msgid="5005740040558984057">"<xliff:g id="LEVEL">%1$s</xliff:g> – напуниће се за <xliff:g id="TIME">%2$s</xliff:g>"</string>
     <string name="battery_info_status_unknown" msgid="268625384868401114">"Непознато"</string>
     <string name="battery_info_status_charging" msgid="4279958015430387405">"Пуни се"</string>
-    <!-- no translation found for battery_info_status_charging_fast (8027559755902954885) -->
-    <skip />
-    <!-- no translation found for battery_info_status_charging_slow (3190803837168962319) -->
-    <skip />
+    <string name="battery_info_status_charging_fast" msgid="8027559755902954885">"Брзо се пуни"</string>
+    <string name="battery_info_status_charging_slow" msgid="3190803837168962319">"Споро се пуни"</string>
     <string name="battery_info_status_discharging" msgid="6962689305413556485">"Не пуни се"</string>
     <string name="battery_info_status_not_charging" msgid="8330015078868707899">"Прикључено је, али пуњење тренутно није могуће"</string>
     <string name="battery_info_status_full" msgid="4443168946046847468">"Пуна"</string>
diff --git a/packages/SettingsLib/res/values-sv/strings.xml b/packages/SettingsLib/res/values-sv/strings.xml
index f9ed6d4..fce23af 100644
--- a/packages/SettingsLib/res/values-sv/strings.xml
+++ b/packages/SettingsLib/res/values-sv/strings.xml
@@ -206,6 +206,33 @@
     <string name="enable_adb" msgid="8072776357237289039">"USB-felsökning"</string>
     <string name="enable_adb_summary" msgid="3711526030096574316">"Felsökningsläge när USB har anslutits"</string>
     <string name="clear_adb_keys" msgid="3010148733140369917">"Återkalla åtkomst till USB-felsökning"</string>
+    <string name="enable_adb_wireless" msgid="6973226350963971018">"Trådlös felsökning"</string>
+    <string name="enable_adb_wireless_summary" msgid="7344391423657093011">"Felsökningsläge vid Wi-Fi-anslutning"</string>
+    <string name="adb_wireless_error" msgid="721958772149779856">"Fel"</string>
+    <string name="adb_wireless_settings" msgid="2295017847215680229">"Trådlös felsökning"</string>
+    <string name="adb_wireless_list_empty_off" msgid="1713707973837255490">"Aktivera trådlös felsökning om du vill se tillgängliga enheter"</string>
+    <string name="adb_pair_method_qrcode_title" msgid="6982904096137468634">"Parkoppla enheten med en QR-kod"</string>
+    <string name="adb_pair_method_qrcode_summary" msgid="3729901496856458634">"Koppla nya enheter med QR-kodsläsare"</string>
+    <string name="adb_pair_method_code_title" msgid="1122590300445142904">"Koppla enheten med en kopplingskod"</string>
+    <string name="adb_pair_method_code_summary" msgid="6370414511333685185">"Koppla nya enheter med en sexsiffrig kod"</string>
+    <string name="adb_paired_devices_title" msgid="5268997341526217362">"Kopplade enheter"</string>
+    <string name="adb_wireless_device_connected_summary" msgid="3039660790249148713">"Anslutna just nu"</string>
+    <string name="adb_wireless_device_details_title" msgid="7129369670526565786">"Enhetsinformation"</string>
+    <string name="adb_device_forget" msgid="193072400783068417">"Glöm"</string>
+    <string name="adb_device_fingerprint_title_format" msgid="291504822917843701">"Enhetens signatur: <xliff:g id="FINGERPRINT_PARAM">%1$s</xliff:g>"</string>
+    <string name="adb_wireless_connection_failed_title" msgid="664211177427438438">"Det gick inte att ansluta"</string>
+    <string name="adb_wireless_connection_failed_message" msgid="9213896700171602073">"Kontrollera att <xliff:g id="DEVICE_NAME">%1$s</xliff:g> är ansluten till rätt nätverk"</string>
+    <string name="adb_pairing_device_dialog_title" msgid="7141739231018530210">"Parkoppla med enheten"</string>
+    <string name="adb_pairing_device_dialog_pairing_code_label" msgid="3639239786669722731">"Wi-Fi-kopplingskod"</string>
+    <string name="adb_pairing_device_dialog_failed_title" msgid="3426758947882091735">"Det gick inte att parkoppla"</string>
+    <string name="adb_pairing_device_dialog_failed_msg" msgid="6611097519661997148">"Kontrollera att enheten är ansluten till samma nätverk."</string>
+    <string name="adb_wireless_qrcode_summary" msgid="8051414549011801917">"Parkoppla enheten via Wi-Fi genom att skanna en QR-kod"</string>
+    <string name="adb_wireless_verifying_qrcode_text" msgid="6123192424916029207">"Enheten parkopplas …"</string>
+    <string name="adb_qrcode_pairing_device_failed_msg" msgid="6936292092592914132">"Det gick inte att parkoppla enheten. Antingen var det fel QR-kod eller är enheten inte ansluten till samma nätverk."</string>
+    <string name="adb_wireless_ip_addr_preference_title" msgid="8335132107715311730">"IP-adress och port"</string>
+    <string name="adb_wireless_qrcode_pairing_title" msgid="1906409667944674707">"Skanna QR-kod"</string>
+    <string name="adb_wireless_qrcode_pairing_description" msgid="8578868049289910131">"Parkoppla enheten via Wi-Fi genom att skanna en QR-kod"</string>
+    <string name="keywords_adb_wireless" msgid="6507505581882171240">"adb, debug, dev, felsöka, felsökning"</string>
     <string name="bugreport_in_power" msgid="8664089072534638709">"Genväg till felrapport"</string>
     <string name="bugreport_in_power_summary" msgid="1885529649381831775">"Visa en knapp för felrapportering i extramenyn"</string>
     <string name="keep_screen_on" msgid="1187161672348797558">"Håll aktiverad"</string>
@@ -271,6 +298,8 @@
     <string name="tethering_hardware_offload_summary" msgid="7801345335142803029">"Använd maskinvaruacceleration för internetdelning om tillgängligt"</string>
     <string name="adb_warning_title" msgid="7708653449506485728">"Ska USB-felsökning tillåtas?"</string>
     <string name="adb_warning_message" msgid="8145270656419669221">"USB-felsökning ska endast användas i utvecklingssyfte. Använd den för att kopiera data mellan datorn och enheten, installera appar på enheten utan meddelanden och läsa loggdata."</string>
+    <string name="adbwifi_warning_title" msgid="727104571653031865">"Vill du tillåta trådlös felsökning?"</string>
+    <string name="adbwifi_warning_message" msgid="8005936574322702388">"Trådlös felsökning ska endast användas i utvecklingssyfte. Använd den för att kopiera data mellan datorn och enheten, installera appar på enheten utan meddelanden och läsa loggdata."</string>
     <string name="adb_keys_warning_message" msgid="2968555274488101220">"Vill du återkalla åtkomst till USB-felsökning för alla datorer som du tidigare har godkänt?"</string>
     <string name="dev_settings_warning_title" msgid="8251234890169074553">"Tillåt utvecklarinställningar?"</string>
     <string name="dev_settings_warning_message" msgid="37741686486073668">"Inställningarna är endast avsedda att användas för utvecklingsändamål. De kan orsaka problem med enheten eller apparna som finns installerade på den."</string>
@@ -383,8 +412,7 @@
     <string name="daltonizer_mode_protanomaly" msgid="7805583306666608440">"Protanomali (rött-grönt)"</string>
     <string name="daltonizer_mode_tritanomaly" msgid="7135266249220732267">"Tritanomali (blått-gult)"</string>
     <string name="accessibility_display_daltonizer_preference_title" msgid="1810693571332381974">"Färgkorrigering"</string>
-    <!-- no translation found for accessibility_display_daltonizer_preference_subtitle (6178138727195403796) -->
-    <skip />
+    <string name="accessibility_display_daltonizer_preference_subtitle" msgid="6178138727195403796">"Med färgkorrigering kan färgblinda personer se mer korrekta färger"</string>
     <string name="daltonizer_type_overridden" msgid="4509604753672535721">"Har åsidosatts av <xliff:g id="TITLE">%1$s</xliff:g>"</string>
     <string name="power_remaining_settings_home_page" msgid="4885165789445462557">"<xliff:g id="PERCENTAGE">%1$s</xliff:g> – <xliff:g id="TIME_STRING">%2$s</xliff:g>"</string>
     <string name="power_remaining_duration_only" msgid="8264199158671531431">"Cirka <xliff:g id="TIME_REMAINING">%1$s</xliff:g> kvar"</string>
@@ -403,21 +431,19 @@
     <string name="power_remaining_less_than_duration" msgid="1812668275239801236">"Mindre än <xliff:g id="THRESHOLD">%1$s</xliff:g> återstår (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_more_than_subtext" msgid="7919119719242734848">"Mer än <xliff:g id="TIME_REMAINING">%1$s</xliff:g> återstår (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_only_more_than_subtext" msgid="3274496164769110480">"Mer än <xliff:g id="TIME_REMAINING">%1$s</xliff:g> återstår"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="6583866940347159957">"Mobilen kan stängas av snart"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="8009177999719462724">"Surfplattan kan stängas av snart"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="8320892540455268018">"Enheten kan stängas av snart"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="6186572170809116621">"Mobilen kan stängas av snart (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="1338758278145563121">"Surfplattan kan stängas av snart (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="3699579688084774362">"Enheten kan stängas av snart (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="137330009791560774">"Telefonen kanske stängs av snart"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="145489081521468132">"Surfplattan kanske stängs av snart"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="1070562682853942350">"Enheten kanske stängs av snart"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="4429259621177089719">"Telefonen kanske stängs av snart (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="7703677921000858479">"Surfplattan kanske stängs av snart (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="4374784375644214578">"Enheten kanske stängs av snart (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
     <string name="power_charging" msgid="6727132649743436802">"<xliff:g id="LEVEL">%1$s</xliff:g> – <xliff:g id="STATE">%2$s</xliff:g>"</string>
     <string name="power_remaining_charging_duration_only" msgid="7415639699283965818">"<xliff:g id="TIME">%1$s</xliff:g> kvar till full laddning"</string>
     <string name="power_charging_duration" msgid="5005740040558984057">"<xliff:g id="LEVEL">%1$s</xliff:g> – <xliff:g id="TIME">%2$s</xliff:g> till full laddning"</string>
     <string name="battery_info_status_unknown" msgid="268625384868401114">"Okänd"</string>
     <string name="battery_info_status_charging" msgid="4279958015430387405">"Laddar"</string>
-    <!-- no translation found for battery_info_status_charging_fast (8027559755902954885) -->
-    <skip />
-    <!-- no translation found for battery_info_status_charging_slow (3190803837168962319) -->
-    <skip />
+    <string name="battery_info_status_charging_fast" msgid="8027559755902954885">"Laddas snabbt"</string>
+    <string name="battery_info_status_charging_slow" msgid="3190803837168962319">"Laddas långsamt"</string>
     <string name="battery_info_status_discharging" msgid="6962689305413556485">"Laddar inte"</string>
     <string name="battery_info_status_not_charging" msgid="8330015078868707899">"Inkopplad, kan inte laddas just nu"</string>
     <string name="battery_info_status_full" msgid="4443168946046847468">"Fullt"</string>
diff --git a/packages/SettingsLib/res/values-sw/strings.xml b/packages/SettingsLib/res/values-sw/strings.xml
index 40e025a..3ca705f 100644
--- a/packages/SettingsLib/res/values-sw/strings.xml
+++ b/packages/SettingsLib/res/values-sw/strings.xml
@@ -206,6 +206,33 @@
     <string name="enable_adb" msgid="8072776357237289039">"Utatuzi wa USB"</string>
     <string name="enable_adb_summary" msgid="3711526030096574316">"Muundo wa kurekebisha wakati USB imeunganishwa"</string>
     <string name="clear_adb_keys" msgid="3010148733140369917">"Batilisha idhini za kurekebisha USB"</string>
+    <string name="enable_adb_wireless" msgid="6973226350963971018">"Utatuzi usiotumia waya"</string>
+    <string name="enable_adb_wireless_summary" msgid="7344391423657093011">"Hali ya utatuzi wakati Wi-Fi imeunganishwa"</string>
+    <string name="adb_wireless_error" msgid="721958772149779856">"Hitilafu"</string>
+    <string name="adb_wireless_settings" msgid="2295017847215680229">"Utatuzi usiotumia waya"</string>
+    <string name="adb_wireless_list_empty_off" msgid="1713707973837255490">"Ili kungalia na kutumia vifaa vinavyopatikana, washa utatuzi usiotumia waya"</string>
+    <string name="adb_pair_method_qrcode_title" msgid="6982904096137468634">"Oanisha kifaa ukitumia msimbo wa QR"</string>
+    <string name="adb_pair_method_qrcode_summary" msgid="3729901496856458634">"Oanisha vifaa vipya ukitumia Kichanganuzi cha Msimbo wa QR"</string>
+    <string name="adb_pair_method_code_title" msgid="1122590300445142904">"Oanisha kifaa ukitumia msimbo wa kuoanisha"</string>
+    <string name="adb_pair_method_code_summary" msgid="6370414511333685185">"Oanisha vifaa vipya ukitumia msimbo wa tarakimu sita"</string>
+    <string name="adb_paired_devices_title" msgid="5268997341526217362">"Vifaa vilivyooanishwa"</string>
+    <string name="adb_wireless_device_connected_summary" msgid="3039660790249148713">"Vilivyounganishwa kwa sasa"</string>
+    <string name="adb_wireless_device_details_title" msgid="7129369670526565786">"Maelezo ya kifaa"</string>
+    <string name="adb_device_forget" msgid="193072400783068417">"Sahau"</string>
+    <string name="adb_device_fingerprint_title_format" msgid="291504822917843701">"Alama bainifu ya kifaa: <xliff:g id="FINGERPRINT_PARAM">%1$s</xliff:g>"</string>
+    <string name="adb_wireless_connection_failed_title" msgid="664211177427438438">"Imeshindwa kuunganisha"</string>
+    <string name="adb_wireless_connection_failed_message" msgid="9213896700171602073">"Hakikisha kuwa <xliff:g id="DEVICE_NAME">%1$s</xliff:g> kimeunganishwa kwenye mtandao sahihi"</string>
+    <string name="adb_pairing_device_dialog_title" msgid="7141739231018530210">"Oanisha na kifaa"</string>
+    <string name="adb_pairing_device_dialog_pairing_code_label" msgid="3639239786669722731">"Msimbo wa kuoanisha wa Wi-Fi"</string>
+    <string name="adb_pairing_device_dialog_failed_title" msgid="3426758947882091735">"Imeshindwa kuunganisha"</string>
+    <string name="adb_pairing_device_dialog_failed_msg" msgid="6611097519661997148">"Hakikisha kuwa kifaa kimeunganishwa kwenye mtandao mmoja."</string>
+    <string name="adb_wireless_qrcode_summary" msgid="8051414549011801917">"Oanisha kifaa kupitia Wi-Fi kwa kuchanganua msimbo wa QR"</string>
+    <string name="adb_wireless_verifying_qrcode_text" msgid="6123192424916029207">"Inaoanisha kifaa…"</string>
+    <string name="adb_qrcode_pairing_device_failed_msg" msgid="6936292092592914132">"Imeshindwa kuoanisha kifaa. Huenda msimbo wa QR haukuwa sahihi au kifaa hakijaunganishwa kwenye mtandao mmoja."</string>
+    <string name="adb_wireless_ip_addr_preference_title" msgid="8335132107715311730">"Anwani ya IP na Mlango"</string>
+    <string name="adb_wireless_qrcode_pairing_title" msgid="1906409667944674707">"Changanua msimbo wa QR"</string>
+    <string name="adb_wireless_qrcode_pairing_description" msgid="8578868049289910131">"Oanisha kifaa kupitia Wi-Fi kwa kuchanganua Msimbo wa QR"</string>
+    <string name="keywords_adb_wireless" msgid="6507505581882171240">"adb, tatua, dev"</string>
     <string name="bugreport_in_power" msgid="8664089072534638709">"Njia ya mkato ya kuripoti hitilafu"</string>
     <string name="bugreport_in_power_summary" msgid="1885529649381831775">"Onyesha kitufe cha kuripoti hitilafu katika menyu ya kuzima/kuwasha kifaa"</string>
     <string name="keep_screen_on" msgid="1187161672348797558">"Weka skrini ikiwa imewashwa"</string>
@@ -271,6 +298,8 @@
     <string name="tethering_hardware_offload_summary" msgid="7801345335142803029">"Tumia huduma ya kuongeza kasi kwa kutumia maunzi ili kusambaza mtandao ikiwa inapatikana"</string>
     <string name="adb_warning_title" msgid="7708653449506485728">"Ruhusu utatuaji USB?"</string>
     <string name="adb_warning_message" msgid="8145270656419669221">"Ueuaji wa USB umekusudiwa kwa malengo ya utengenezaji tu. Itumi kunakili data kati ya kompyuta yako na kifaa chako, kusanidi programu kwa kifaa chako bila arifa, na kusoma data ya rajisi."</string>
+    <string name="adbwifi_warning_title" msgid="727104571653031865">"Ungependa kuruhusu utatuzi usiotumia waya?"</string>
+    <string name="adbwifi_warning_message" msgid="8005936574322702388">"Utatuzi usiotumia waya umekusudiwa kwa malengo ya usanidi tu. Utumie kunakili data kati ya kompyuta yako na kifaa chako, kusakinisha programu kwenye kifaa chako bila arifa na kusoma data ya kumbukumbu."</string>
     <string name="adb_keys_warning_message" msgid="2968555274488101220">"Unataka kubatilisha ufikiaji wa urekebishaji wa USB kutoka kwenye kompyuta zote ulizotangulia kuidhinisha?"</string>
     <string name="dev_settings_warning_title" msgid="8251234890169074553">"Ruhusu mipangilio ya usanidi?"</string>
     <string name="dev_settings_warning_message" msgid="37741686486073668">"Mipangilio hii imekusudiwa kwa matumizi ya usanidi tu. Inaweza kusababisha kifaa chako na programu zilizoko kuvunjika au kutofanya kazi vizuri."</string>
@@ -383,8 +412,7 @@
     <string name="daltonizer_mode_protanomaly" msgid="7805583306666608440">"Protanomaly (nyekundu-kijani)"</string>
     <string name="daltonizer_mode_tritanomaly" msgid="7135266249220732267">"Tritanomaly (samawati-manjano)"</string>
     <string name="accessibility_display_daltonizer_preference_title" msgid="1810693571332381974">"Usahihishaji wa rangi"</string>
-    <!-- no translation found for accessibility_display_daltonizer_preference_subtitle (6178138727195403796) -->
-    <skip />
+    <string name="accessibility_display_daltonizer_preference_subtitle" msgid="6178138727195403796">"Urekebishaji wa rangi huwasaidia watu wenye matatizo ya kutofautisha rangi ili waone rangi nyingi sahihi"</string>
     <string name="daltonizer_type_overridden" msgid="4509604753672535721">"Imetanguliwa na <xliff:g id="TITLE">%1$s</xliff:g>"</string>
     <string name="power_remaining_settings_home_page" msgid="4885165789445462557">"<xliff:g id="PERCENTAGE">%1$s</xliff:g> - <xliff:g id="TIME_STRING">%2$s</xliff:g>"</string>
     <string name="power_remaining_duration_only" msgid="8264199158671531431">"Zimesalia takribani <xliff:g id="TIME_REMAINING">%1$s</xliff:g>"</string>
@@ -403,21 +431,19 @@
     <string name="power_remaining_less_than_duration" msgid="1812668275239801236">"Zimesalia chini ya <xliff:g id="THRESHOLD">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_more_than_subtext" msgid="7919119719242734848">"Zimesalia zaidi ya <xliff:g id="TIME_REMAINING">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_only_more_than_subtext" msgid="3274496164769110480">"Zimesalia zaidi ya <xliff:g id="TIME_REMAINING">%1$s</xliff:g>"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="6583866940347159957">"Simu inakaribia kuzimika"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="8009177999719462724">"Kompyuta kibao inakaribia kuzimika"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="8320892540455268018">"Kifaa kinakaribia kuzimika"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="6186572170809116621">"Simu inakaribia kuzimika (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="1338758278145563121">"Kompyuta kibao inakaribia kuzimika (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="3699579688084774362">"Kifaa kinakaribia kuzimika (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="137330009791560774">"Huenda simu ikazima hivi karibuni"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="145489081521468132">"Huenda kompyuta yako kibao ikazima hivi karibuni"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="1070562682853942350">"Huenda kifaa kikazima hivi karibuni"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="4429259621177089719">"Huenda simu ikazima hivi karibuni (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="7703677921000858479">"Huenda kompyuta kibao ikazima hivi karibuni (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="4374784375644214578">"Huenda kifaa kikazima hivi karibuni (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
     <string name="power_charging" msgid="6727132649743436802">"<xliff:g id="LEVEL">%1$s</xliff:g> - <xliff:g id="STATE">%2$s</xliff:g>"</string>
     <string name="power_remaining_charging_duration_only" msgid="7415639699283965818">"Zimesalia <xliff:g id="TIME">%1$s</xliff:g> hadi ijae chaji"</string>
     <string name="power_charging_duration" msgid="5005740040558984057">"<xliff:g id="LEVEL">%1$s</xliff:g> - <xliff:g id="TIME">%2$s</xliff:g> hadi ijae chaji"</string>
     <string name="battery_info_status_unknown" msgid="268625384868401114">"Haijulikani"</string>
     <string name="battery_info_status_charging" msgid="4279958015430387405">"Inachaji"</string>
-    <!-- no translation found for battery_info_status_charging_fast (8027559755902954885) -->
-    <skip />
-    <!-- no translation found for battery_info_status_charging_slow (3190803837168962319) -->
-    <skip />
+    <string name="battery_info_status_charging_fast" msgid="8027559755902954885">"Inachaji kwa kasi"</string>
+    <string name="battery_info_status_charging_slow" msgid="3190803837168962319">"Inachaji pole pole"</string>
     <string name="battery_info_status_discharging" msgid="6962689305413556485">"Haichaji"</string>
     <string name="battery_info_status_not_charging" msgid="8330015078868707899">"Haiwezi kuchaji kwa sasa"</string>
     <string name="battery_info_status_full" msgid="4443168946046847468">"Imejaa"</string>
diff --git a/packages/SettingsLib/res/values-ta/strings.xml b/packages/SettingsLib/res/values-ta/strings.xml
index 36a92ed..4f0b779 100644
--- a/packages/SettingsLib/res/values-ta/strings.xml
+++ b/packages/SettingsLib/res/values-ta/strings.xml
@@ -149,7 +149,7 @@
     <string name="tether_settings_title_usb_bluetooth" msgid="1727111807207577322">"டெதெரிங்"</string>
     <string name="tether_settings_title_all" msgid="8910259483383010470">"டெதெரிங் &amp; போர்டபிள் ஹாட்ஸ்பாட்"</string>
     <string name="managed_user_title" msgid="449081789742645723">"எல்லா பணிப் பயன்பாடுகளும்"</string>
-    <string name="user_guest" msgid="6939192779649870792">"வேறொருவர்"</string>
+    <string name="user_guest" msgid="6939192779649870792">"கெஸ்ட்"</string>
     <string name="unknown" msgid="3544487229740637809">"அறியப்படாத"</string>
     <string name="running_process_item_user_label" msgid="3988506293099805796">"பயனர்: <xliff:g id="USER_NAME">%1$s</xliff:g>"</string>
     <string name="launch_defaults_some" msgid="3631650616557252926">"சில இயல்புநிலைகள் அமைக்கப்பட்டன"</string>
@@ -206,6 +206,60 @@
     <string name="enable_adb" msgid="8072776357237289039">"USB பிழைதிருத்தம்"</string>
     <string name="enable_adb_summary" msgid="3711526030096574316">"USB இணைக்கப்பட்டிருக்கும்போது பிழைத்திருத்தப் பயன்முறையை அமை"</string>
     <string name="clear_adb_keys" msgid="3010148733140369917">"USB பிழைத்திருத்த அங்கீகரிப்புகளை நிராகரி"</string>
+    <!-- no translation found for enable_adb_wireless (6973226350963971018) -->
+    <skip />
+    <!-- no translation found for enable_adb_wireless_summary (7344391423657093011) -->
+    <skip />
+    <!-- no translation found for adb_wireless_error (721958772149779856) -->
+    <skip />
+    <!-- no translation found for adb_wireless_settings (2295017847215680229) -->
+    <skip />
+    <!-- no translation found for adb_wireless_list_empty_off (1713707973837255490) -->
+    <skip />
+    <!-- no translation found for adb_pair_method_qrcode_title (6982904096137468634) -->
+    <skip />
+    <!-- no translation found for adb_pair_method_qrcode_summary (3729901496856458634) -->
+    <skip />
+    <!-- no translation found for adb_pair_method_code_title (1122590300445142904) -->
+    <skip />
+    <!-- no translation found for adb_pair_method_code_summary (6370414511333685185) -->
+    <skip />
+    <!-- no translation found for adb_paired_devices_title (5268997341526217362) -->
+    <skip />
+    <!-- no translation found for adb_wireless_device_connected_summary (3039660790249148713) -->
+    <skip />
+    <!-- no translation found for adb_wireless_device_details_title (7129369670526565786) -->
+    <skip />
+    <!-- no translation found for adb_device_forget (193072400783068417) -->
+    <skip />
+    <!-- no translation found for adb_device_fingerprint_title_format (291504822917843701) -->
+    <skip />
+    <!-- no translation found for adb_wireless_connection_failed_title (664211177427438438) -->
+    <skip />
+    <!-- no translation found for adb_wireless_connection_failed_message (9213896700171602073) -->
+    <skip />
+    <!-- no translation found for adb_pairing_device_dialog_title (7141739231018530210) -->
+    <skip />
+    <!-- no translation found for adb_pairing_device_dialog_pairing_code_label (3639239786669722731) -->
+    <skip />
+    <!-- no translation found for adb_pairing_device_dialog_failed_title (3426758947882091735) -->
+    <skip />
+    <!-- no translation found for adb_pairing_device_dialog_failed_msg (6611097519661997148) -->
+    <skip />
+    <!-- no translation found for adb_wireless_qrcode_summary (8051414549011801917) -->
+    <skip />
+    <!-- no translation found for adb_wireless_verifying_qrcode_text (6123192424916029207) -->
+    <skip />
+    <!-- no translation found for adb_qrcode_pairing_device_failed_msg (6936292092592914132) -->
+    <skip />
+    <!-- no translation found for adb_wireless_ip_addr_preference_title (8335132107715311730) -->
+    <skip />
+    <!-- no translation found for adb_wireless_qrcode_pairing_title (1906409667944674707) -->
+    <skip />
+    <!-- no translation found for adb_wireless_qrcode_pairing_description (8578868049289910131) -->
+    <skip />
+    <!-- no translation found for keywords_adb_wireless (6507505581882171240) -->
+    <skip />
     <string name="bugreport_in_power" msgid="8664089072534638709">"பிழைப் புகாருக்கான ஷார்ட்கட்"</string>
     <string name="bugreport_in_power_summary" msgid="1885529649381831775">"பிழை அறிக்கையைப் பெற பவர் மெனுவில் விருப்பத்தைக் காட்டு"</string>
     <string name="keep_screen_on" msgid="1187161672348797558">"செயலில் வைத்திரு"</string>
@@ -271,6 +325,10 @@
     <string name="tethering_hardware_offload_summary" msgid="7801345335142803029">"வன்பொருள் விரைவுப்படுத்துதல் இணைப்பு முறை கிடைக்கும் போது, அதைப் பயன்படுத்தும்"</string>
     <string name="adb_warning_title" msgid="7708653449506485728">"USB பிழைதிருத்தத்தை அனுமதிக்கவா?"</string>
     <string name="adb_warning_message" msgid="8145270656419669221">"USB பிழைதிருத்தம் மேம்படுத்தல் நோக்கங்களுக்காக மட்டுமே. அதை உங்கள் கணினி மற்றும் சாதனத்திற்கு இடையில் தரவை நகலெடுக்கவும், அறிவிப்பு இல்லாமல் உங்கள் சாதனத்தில் ஆப்ஸை நிறுவவும், பதிவு தரவைப் படிக்கவும் பயன்படுத்தவும்."</string>
+    <!-- no translation found for adbwifi_warning_title (727104571653031865) -->
+    <skip />
+    <!-- no translation found for adbwifi_warning_message (8005936574322702388) -->
+    <skip />
     <string name="adb_keys_warning_message" msgid="2968555274488101220">"நீங்கள் ஏற்கனவே அனுமதித்த எல்லா கணினிகளிலிருந்தும் USB பிழைத்திருத்தத்திற்கான அணுகலைத் திரும்பப்பெற வேண்டுமா?"</string>
     <string name="dev_settings_warning_title" msgid="8251234890169074553">"மேம்பட்ட அமைப்புகளை அனுமதிக்கவா?"</string>
     <string name="dev_settings_warning_message" msgid="37741686486073668">"இந்த அமைப்பு மேம்பட்டப் பயன்பாட்டிற்காக மட்டுமே. உங்கள் சாதனம் மற்றும் அதில் உள்ள பயன்பாடுகளைச் சிதைக்கும் அல்லது தவறாகச் செயல்படும் வகையில் பாதிப்பை ஏற்படுத்தும்."</string>
@@ -403,12 +461,18 @@
     <string name="power_remaining_less_than_duration" msgid="1812668275239801236">"<xliff:g id="THRESHOLD">%1$s</xliff:g>க்கும் குறைவாகவே பயன்படுத்த முடியும் (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_more_than_subtext" msgid="7919119719242734848">"<xliff:g id="TIME_REMAINING">%1$s</xliff:g>க்கும் மேல் பயன்படுத்த முடியும் (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_only_more_than_subtext" msgid="3274496164769110480">"<xliff:g id="TIME_REMAINING">%1$s</xliff:g>க்கும் மேல் பயன்படுத்த முடியும்"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="6583866940347159957">"மொபைல் விரைவில் ஆஃப் ஆகக்கூடும்"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="8009177999719462724">"டேப்லெட் விரைவில் ஆஃப் ஆகக்கூடும்"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="8320892540455268018">"சாதனம் விரைவில் ஆஃப் ஆகக்கூடும்"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="6186572170809116621">"மொபைல் விரைவில் ஆஃப் ஆகக்கூடும் (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="1338758278145563121">"டேப்லெட் விரைவில் ஆஃப் ஆகக்கூடும் (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="3699579688084774362">"சாதனம் விரைவில் ஆஃப் ஆகக்கூடும் (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <!-- no translation found for power_remaining_duration_only_shutdown_imminent (137330009791560774) -->
+    <skip />
+    <!-- no translation found for power_remaining_duration_only_shutdown_imminent (145489081521468132) -->
+    <skip />
+    <!-- no translation found for power_remaining_duration_only_shutdown_imminent (1070562682853942350) -->
+    <skip />
+    <!-- no translation found for power_remaining_duration_shutdown_imminent (4429259621177089719) -->
+    <skip />
+    <!-- no translation found for power_remaining_duration_shutdown_imminent (7703677921000858479) -->
+    <skip />
+    <!-- no translation found for power_remaining_duration_shutdown_imminent (4374784375644214578) -->
+    <skip />
     <string name="power_charging" msgid="6727132649743436802">"<xliff:g id="LEVEL">%1$s</xliff:g> - <xliff:g id="STATE">%2$s</xliff:g>"</string>
     <string name="power_remaining_charging_duration_only" msgid="7415639699283965818">"முழு சார்ஜாக <xliff:g id="TIME">%1$s</xliff:g> ஆகும்"</string>
     <string name="power_charging_duration" msgid="5005740040558984057">"<xliff:g id="LEVEL">%1$s</xliff:g> - முழு சார்ஜாக <xliff:g id="TIME">%2$s</xliff:g> ஆகும்"</string>
@@ -439,7 +503,7 @@
     <string name="screen_zoom_summary_large" msgid="4706951482598978984">"பெரியது"</string>
     <string name="screen_zoom_summary_very_large" msgid="7317423942896999029">"கொஞ்சம் பெரியது"</string>
     <string name="screen_zoom_summary_extremely_large" msgid="1438045624562358554">"மிகப் பெரியது"</string>
-    <string name="screen_zoom_summary_custom" msgid="3468154096832912210">"தனிப்பயன் (<xliff:g id="DENSITYDPI">%d</xliff:g>)"</string>
+    <string name="screen_zoom_summary_custom" msgid="3468154096832912210">"பிரத்தியேக (<xliff:g id="DENSITYDPI">%d</xliff:g>)"</string>
     <string name="content_description_menu_button" msgid="6254844309171779931">"மெனு"</string>
     <string name="retail_demo_reset_message" msgid="5392824901108195463">"டெமோ பயன்முறையில் ஆரம்பநிலை மீட்டமைவைச் செயல்படுத்த, கடவுச்சொல்லை உள்ளிடவும்"</string>
     <string name="retail_demo_reset_next" msgid="3688129033843885362">"அடுத்து"</string>
diff --git a/packages/SettingsLib/res/values-te/strings.xml b/packages/SettingsLib/res/values-te/strings.xml
index 5ea380c..3a354e0 100644
--- a/packages/SettingsLib/res/values-te/strings.xml
+++ b/packages/SettingsLib/res/values-te/strings.xml
@@ -206,6 +206,33 @@
     <string name="enable_adb" msgid="8072776357237289039">"USB డీబగ్గింగ్"</string>
     <string name="enable_adb_summary" msgid="3711526030096574316">"USB కనెక్ట్ చేయబడినప్పుడు డీబగ్ మోడ్"</string>
     <string name="clear_adb_keys" msgid="3010148733140369917">"USB డీబగ్ ప్రామాణీకరణలను ఉపసంహరించు"</string>
+    <string name="enable_adb_wireless" msgid="6973226350963971018">"వైర్‌లెస్ డీబగ్గింగ్"</string>
+    <string name="enable_adb_wireless_summary" msgid="7344391423657093011">"Wi-Fi కనెక్ట్ అయి ఉన్నప్పుడు, డీబగ్ మోడ్‌లో ఉంచు"</string>
+    <string name="adb_wireless_error" msgid="721958772149779856">"ఎర్రర్"</string>
+    <string name="adb_wireless_settings" msgid="2295017847215680229">"వైర్‌లెస్ డీబగ్గింగ్"</string>
+    <string name="adb_wireless_list_empty_off" msgid="1713707973837255490">"అందుబాటులో వున్న పరికరాలను చూడటానికి, ఉపయోగించడానికి, వైర్‌లెస్ డీబగ్గింగ్‌ను ఆన్ చేయండి"</string>
+    <string name="adb_pair_method_qrcode_title" msgid="6982904096137468634">"QR కోడ్‌తో పరికరాన్ని పెయిర్ చేయండి"</string>
+    <string name="adb_pair_method_qrcode_summary" msgid="3729901496856458634">"QR కోడ్ స్కానర్‌ను ఉపయోగించి కొత్త పరికరాలను పెయిర్ చేయండి"</string>
+    <string name="adb_pair_method_code_title" msgid="1122590300445142904">"పెయిరింగ్ కోడ్‌తో పరికరాన్ని పెయిర్ చేయండి"</string>
+    <string name="adb_pair_method_code_summary" msgid="6370414511333685185">"ఆరు అంకెల కోడ్‌ను ఉపయోగించి కొత్త పరికరాలను పెయిర్ చేయండి"</string>
+    <string name="adb_paired_devices_title" msgid="5268997341526217362">"పెయిర్ చేయబడిన పరికరాలు"</string>
+    <string name="adb_wireless_device_connected_summary" msgid="3039660790249148713">"ప్రస్తుతం కనెక్ట్ చేయబడింది"</string>
+    <string name="adb_wireless_device_details_title" msgid="7129369670526565786">"పరికర వివరాలు"</string>
+    <string name="adb_device_forget" msgid="193072400783068417">"విస్మరించు"</string>
+    <string name="adb_device_fingerprint_title_format" msgid="291504822917843701">"పరికరం వేలిముద్ర: <xliff:g id="FINGERPRINT_PARAM">%1$s</xliff:g>"</string>
+    <string name="adb_wireless_connection_failed_title" msgid="664211177427438438">"కనెక్షన్ విఫలమైంది"</string>
+    <string name="adb_wireless_connection_failed_message" msgid="9213896700171602073">"<xliff:g id="DEVICE_NAME">%1$s</xliff:g> సరైన నెట్‌వర్క్‌కు కనెక్ట్ అయ్యేలా చూడండి."</string>
+    <string name="adb_pairing_device_dialog_title" msgid="7141739231018530210">"పరికరంతో పెయిర్ చేయండి"</string>
+    <string name="adb_pairing_device_dialog_pairing_code_label" msgid="3639239786669722731">"Wi‑Fi పెయిరింగ్ కోడ్"</string>
+    <string name="adb_pairing_device_dialog_failed_title" msgid="3426758947882091735">"పెయిరింగ్ విఫలమైంది"</string>
+    <string name="adb_pairing_device_dialog_failed_msg" msgid="6611097519661997148">"పరికరం అదే నెట్‌వర్క్‌కు కనెక్ట్ అయి వుందో లేదో సరి చూసుకోండి."</string>
+    <string name="adb_wireless_qrcode_summary" msgid="8051414549011801917">"QR కోడ్‌ను స్కాన్ చేయడం ద్వారా Wi-Fiని ఉపయోగించి పరికరాన్ని పెయిర్ చెయ్యండి"</string>
+    <string name="adb_wireless_verifying_qrcode_text" msgid="6123192424916029207">"పరికరం పెయిర్ చేయబడుతోంది…"</string>
+    <string name="adb_qrcode_pairing_device_failed_msg" msgid="6936292092592914132">"పరికరాన్ని పెయిర్ చేయడం విఫలమైంది. QR కోడ్ తప్పుగా ఉండడం గాని, లేదా పరికరం అదే నెట్‌వర్క్‌కు కనెక్ట్ అయి లేకపోవడం గాని జరిగింది."</string>
+    <string name="adb_wireless_ip_addr_preference_title" msgid="8335132107715311730">"IP చిరునామా &amp; పోర్ట్"</string>
+    <string name="adb_wireless_qrcode_pairing_title" msgid="1906409667944674707">"QR కోడ్‌ను స్కాన్ చేయండి"</string>
+    <string name="adb_wireless_qrcode_pairing_description" msgid="8578868049289910131">"పరికరాన్ని Wi-Fi ద్వారా పెయిర్ చేయడానికి QR కోడ్‌ను స్కాన్ చేయండి"</string>
+    <string name="keywords_adb_wireless" msgid="6507505581882171240">"adb, డీబగ్, dev"</string>
     <string name="bugreport_in_power" msgid="8664089072534638709">"బగ్ నివేదిక షార్ట్‌కట్"</string>
     <string name="bugreport_in_power_summary" msgid="1885529649381831775">"బగ్ నివేదికను తీసుకోవడానికి పవర్ మెనూలో బటన్‌ను చూపు"</string>
     <string name="keep_screen_on" msgid="1187161672348797558">"యాక్టివ్‌గా ఉంచు"</string>
@@ -271,6 +298,8 @@
     <string name="tethering_hardware_offload_summary" msgid="7801345335142803029">"అందుబాటులో ఉంటే టెథెరింగ్ హార్డ్‌వేర్ వేగవృద్ధిని ఉపయోగించండి"</string>
     <string name="adb_warning_title" msgid="7708653449506485728">"USB డీబగ్గింగ్‌ను అనుమతించాలా?"</string>
     <string name="adb_warning_message" msgid="8145270656419669221">"USB డీబగ్గింగ్ అనేది అభివృద్ధి ప్రయోజనాల కోసం మాత్రమే ఉద్దేశించబడింది. మీ కంప్యూటర్ మరియు మీ పరికరం మధ్య డేటాను కాపీ చేయడానికి, నోటిఫికేషన్ లేకుండా మీ పరికరంలో అనువర్తనాలను ఇన్‌స్టాల్ చేయడానికి మరియు లాగ్ డేటాను చదవడానికి దీన్ని ఉపయోగించండి."</string>
+    <string name="adbwifi_warning_title" msgid="727104571653031865">"వైర్‌లెస్ డీబగ్గింగ్‌ను అనుమతించాలా?"</string>
+    <string name="adbwifi_warning_message" msgid="8005936574322702388">"వైర్‌లెస్ డీబగ్గింగ్ అనేది అభివృద్ధి ప్రయోజనాల కోసం మాత్రమే ఉద్దేశించబడింది. మీ కంప్యూటర్, పరికరాల మధ్య డేటాను కాపీ చేయడానికి, నోటిఫికేషన్ లేకుండా మీ పరికరంలో యాప్‌లను ఇన్‌స్టాల్ చేయడానికి, లాగ్ డేటాను చదవడానికి దీన్ని ఉపయోగించండి."</string>
     <string name="adb_keys_warning_message" msgid="2968555274488101220">"మీరు గతంలో ప్రామాణీకరించిన అన్ని కంప్యూటర్‌ల నుండి USB డీబగ్గింగ్‌కు ప్రాప్యతను ఉపసంహరించాలా?"</string>
     <string name="dev_settings_warning_title" msgid="8251234890169074553">"అభివృద్ధి సెట్టింగ్‌లను అనుమతించాలా?"</string>
     <string name="dev_settings_warning_message" msgid="37741686486073668">"ఈ సెట్టింగ్‌లు అభివృద్ధి వినియోగం కోసం మాత్రమే ఉద్దేశించబడినవి. వీటి వలన మీ పరికరం మరియు దీనిలోని యాప్‌లు విచ్ఛిన్నం కావచ్చు లేదా తప్పుగా ప్రవర్తించవచ్చు."</string>
@@ -383,8 +412,7 @@
     <string name="daltonizer_mode_protanomaly" msgid="7805583306666608440">"ప్రొటానోమలీ (ఎరుపు-ఆకుపచ్చ రంగు)"</string>
     <string name="daltonizer_mode_tritanomaly" msgid="7135266249220732267">"ట్రైటనోమలీ (నీలం-పసుపు రంగు)"</string>
     <string name="accessibility_display_daltonizer_preference_title" msgid="1810693571332381974">"రంగు సవరణ"</string>
-    <!-- no translation found for accessibility_display_daltonizer_preference_subtitle (6178138727195403796) -->
-    <skip />
+    <string name="accessibility_display_daltonizer_preference_subtitle" msgid="6178138727195403796">"రంగులను సరి చేయడం వల్ల, కలర్ బ్లైండ్‌నెస్ ఉన్నవారు మరింత ఖచ్చితమైన రంగులను చూడగలుగుతారు"</string>
     <string name="daltonizer_type_overridden" msgid="4509604753672535721">"<xliff:g id="TITLE">%1$s</xliff:g> ద్వారా భర్తీ చేయబడింది"</string>
     <string name="power_remaining_settings_home_page" msgid="4885165789445462557">"<xliff:g id="PERCENTAGE">%1$s</xliff:g> - <xliff:g id="TIME_STRING">%2$s</xliff:g>"</string>
     <string name="power_remaining_duration_only" msgid="8264199158671531431">"<xliff:g id="TIME_REMAINING">%1$s</xliff:g> సమయం మిగిలి ఉంది"</string>
@@ -403,21 +431,19 @@
     <string name="power_remaining_less_than_duration" msgid="1812668275239801236">"<xliff:g id="THRESHOLD">%1$s</xliff:g> కంటే తక్కువ సమయం మిగిలి ఉంది (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_more_than_subtext" msgid="7919119719242734848">"<xliff:g id="TIME_REMAINING">%1$s</xliff:g> కంటే ఎక్కువ సమయం మిగిలి ఉంది (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_only_more_than_subtext" msgid="3274496164769110480">"<xliff:g id="TIME_REMAINING">%1$s</xliff:g> కంటే ఎక్కువ సమయం మిగిలి ఉంది"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="6583866940347159957">"ఫోన్ త్వరలో షట్‌డౌన్ కావచ్చు"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="8009177999719462724">"టాబ్లెట్ త్వరలో షట్‌డౌన్ కావచ్చు"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="8320892540455268018">"పరికరం త్వరలో షట్‌డౌన్ కావచ్చు"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="6186572170809116621">"ఫోన్ షట్‌డౌన్ కావచ్చు (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="1338758278145563121">"టాబ్లెట్ షట్‌డౌన్ కావచ్చు (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="3699579688084774362">"పరికరం త్వరలో షట్‌డౌన్ కావచ్చు (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="137330009791560774">"ఫోన్ త్వరలో షట్‌డౌన్ కావచ్చు"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="145489081521468132">"టాబ్లెట్ త్వరలో షట్‌డౌన్ కావచ్చు"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="1070562682853942350">"పరికరం త్వరలో షట్‌డౌన్ కావచ్చు"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="4429259621177089719">"ఫోన్ త్వరలో షట్‌డౌన్ కావచ్చు (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="7703677921000858479">"టాబ్లెట్ త్వరలో షట్‌డౌన్ కావచ్చు (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="4374784375644214578">"పరికరం త్వరలో షట్‌డౌన్ కావచ్చు (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
     <string name="power_charging" msgid="6727132649743436802">"<xliff:g id="LEVEL">%1$s</xliff:g> - <xliff:g id="STATE">%2$s</xliff:g>"</string>
     <string name="power_remaining_charging_duration_only" msgid="7415639699283965818">"ఛార్జ్ అవ్వడానికి <xliff:g id="TIME">%1$s</xliff:g> సమయం మిగిలి ఉంది"</string>
     <string name="power_charging_duration" msgid="5005740040558984057">"<xliff:g id="LEVEL">%1$s</xliff:g> - ఛార్జ్ అవ్వడానికి <xliff:g id="TIME">%2$s</xliff:g> పడుతుంది"</string>
     <string name="battery_info_status_unknown" msgid="268625384868401114">"తెలియదు"</string>
     <string name="battery_info_status_charging" msgid="4279958015430387405">"ఛార్జ్ అవుతోంది"</string>
-    <!-- no translation found for battery_info_status_charging_fast (8027559755902954885) -->
-    <skip />
-    <!-- no translation found for battery_info_status_charging_slow (3190803837168962319) -->
-    <skip />
+    <string name="battery_info_status_charging_fast" msgid="8027559755902954885">"వేగవంతమైన ఛార్జింగ్"</string>
+    <string name="battery_info_status_charging_slow" msgid="3190803837168962319">"నెమ్మదిగా ఛార్జింగ్"</string>
     <string name="battery_info_status_discharging" msgid="6962689305413556485">"ఛార్జ్ కావడం లేదు"</string>
     <string name="battery_info_status_not_charging" msgid="8330015078868707899">"ప్లగ్ ఇన్ చేయబడింది, ప్రస్తుతం ఛార్జ్ చేయడం సాధ్యం కాదు"</string>
     <string name="battery_info_status_full" msgid="4443168946046847468">"నిండింది"</string>
diff --git a/packages/SettingsLib/res/values-th/strings.xml b/packages/SettingsLib/res/values-th/strings.xml
index 15e74ae..e34c548 100644
--- a/packages/SettingsLib/res/values-th/strings.xml
+++ b/packages/SettingsLib/res/values-th/strings.xml
@@ -206,6 +206,33 @@
     <string name="enable_adb" msgid="8072776357237289039">"การแก้ไขข้อบกพร่อง USB"</string>
     <string name="enable_adb_summary" msgid="3711526030096574316">"โหมดแก้ไขข้อบกพร่องเมื่อเชื่อมต่อ USB"</string>
     <string name="clear_adb_keys" msgid="3010148733140369917">"ยกเลิกการให้สิทธิ์การแก้ปัญหา USB"</string>
+    <string name="enable_adb_wireless" msgid="6973226350963971018">"การแก้ไขข้อบกพร่องผ่าน Wi-Fi"</string>
+    <string name="enable_adb_wireless_summary" msgid="7344391423657093011">"โหมดแก้ไขข้อบกพร่องเมื่อเชื่อมต่อ Wi-Fi"</string>
+    <string name="adb_wireless_error" msgid="721958772149779856">"ข้อผิดพลาด"</string>
+    <string name="adb_wireless_settings" msgid="2295017847215680229">"การแก้ไขข้อบกพร่องผ่าน Wi-Fi"</string>
+    <string name="adb_wireless_list_empty_off" msgid="1713707973837255490">"หากต้องการดูและใช้อุปกรณ์ที่มีอยู่ ให้เปิดการแก้ไขข้อบกพร่องผ่าน Wi-Fi"</string>
+    <string name="adb_pair_method_qrcode_title" msgid="6982904096137468634">"จับคู่อุปกรณ์ด้วยคิวอาร์โค้ด"</string>
+    <string name="adb_pair_method_qrcode_summary" msgid="3729901496856458634">"จับคู่อุปกรณ์เครื่องใหม่โดยใช้เครื่องมือสแกนคิวอาร์โค้ด"</string>
+    <string name="adb_pair_method_code_title" msgid="1122590300445142904">"จับคู่อุปกรณ์ด้วยรหัสการจับคู่"</string>
+    <string name="adb_pair_method_code_summary" msgid="6370414511333685185">"จับคู่อุปกรณ์เครื่องใหม่โดยใช้รหัสตัวเลข 6 หลัก"</string>
+    <string name="adb_paired_devices_title" msgid="5268997341526217362">"อุปกรณ์ที่จับคู่"</string>
+    <string name="adb_wireless_device_connected_summary" msgid="3039660790249148713">"เชื่อมต่ออยู่"</string>
+    <string name="adb_wireless_device_details_title" msgid="7129369670526565786">"รายละเอียดอุปกรณ์"</string>
+    <string name="adb_device_forget" msgid="193072400783068417">"ไม่จำ"</string>
+    <string name="adb_device_fingerprint_title_format" msgid="291504822917843701">"ลายนิ้วมือของอุปกรณ์: <xliff:g id="FINGERPRINT_PARAM">%1$s</xliff:g>"</string>
+    <string name="adb_wireless_connection_failed_title" msgid="664211177427438438">"การเชื่อมต่อไม่สำเร็จ"</string>
+    <string name="adb_wireless_connection_failed_message" msgid="9213896700171602073">"ตรวจสอบว่า <xliff:g id="DEVICE_NAME">%1$s</xliff:g> เชื่อมต่อกับเครือข่ายที่ถูกต้อง"</string>
+    <string name="adb_pairing_device_dialog_title" msgid="7141739231018530210">"จับคู่กับอุปกรณ์"</string>
+    <string name="adb_pairing_device_dialog_pairing_code_label" msgid="3639239786669722731">"รหัสการจับคู่ Wi‑Fi"</string>
+    <string name="adb_pairing_device_dialog_failed_title" msgid="3426758947882091735">"การจับคู่ไม่สำเร็จ"</string>
+    <string name="adb_pairing_device_dialog_failed_msg" msgid="6611097519661997148">"ตรวจสอบว่าอุปกรณ์เชื่อมต่อกับเครือข่ายเดียวกัน"</string>
+    <string name="adb_wireless_qrcode_summary" msgid="8051414549011801917">"จับคู่อุปกรณ์ผ่าน Wi‑Fi ด้วยการสแกนคิวอาร์โค้ด"</string>
+    <string name="adb_wireless_verifying_qrcode_text" msgid="6123192424916029207">"กำลังจับคู่อุปกรณ์…"</string>
+    <string name="adb_qrcode_pairing_device_failed_msg" msgid="6936292092592914132">"จับคู่อุปกรณ์ไม่สำเร็จ คิวอาร์โค้ดไม่ถูกต้อง หรืออุปกรณ์ไม่ได้เชื่อมต่อกับเครือข่ายเดียวกัน"</string>
+    <string name="adb_wireless_ip_addr_preference_title" msgid="8335132107715311730">"ที่อยู่ IP และพอร์ต"</string>
+    <string name="adb_wireless_qrcode_pairing_title" msgid="1906409667944674707">"สแกนคิวอาร์โค้ด"</string>
+    <string name="adb_wireless_qrcode_pairing_description" msgid="8578868049289910131">"จับคู่อุปกรณ์ผ่าน Wi‑Fi ด้วยการสแกนคิวอาร์โค้ด"</string>
+    <string name="keywords_adb_wireless" msgid="6507505581882171240">"adb, แก้ไขข้อบกพร่อง, พัฒนา"</string>
     <string name="bugreport_in_power" msgid="8664089072534638709">"ทางลัดรายงานข้อบกพร่อง"</string>
     <string name="bugreport_in_power_summary" msgid="1885529649381831775">"แสดงปุ่มในเมนูเปิด/ปิดสำหรับการใช้รายงานข้อบกพร่อง"</string>
     <string name="keep_screen_on" msgid="1187161672348797558">"เปิดหน้าจอค้าง"</string>
@@ -271,6 +298,8 @@
     <string name="tethering_hardware_offload_summary" msgid="7801345335142803029">"ใช้การเร่งฮาร์ดแวร์การเชื่อมต่ออินเทอร์เน็ตผ่านมือถือ หากมี"</string>
     <string name="adb_warning_title" msgid="7708653449506485728">"อนุญาตให้แก้ไขข้อบกพร่อง USB หรือไม่"</string>
     <string name="adb_warning_message" msgid="8145270656419669221">"การแก้ไขข้อบกพร่อง USB มีไว้เพื่อการพัฒนาเท่านั้น ให้ใช้การแก้ไขนี้เพื่อคัดลอกข้อมูลระหว่างคอมพิวเตอร์และอุปกรณ์ ติดตั้งแอปพลิเคชันบนอุปกรณ์โดยไม่มีการแจ้งเตือน และอ่านข้อมูลบันทึก"</string>
+    <string name="adbwifi_warning_title" msgid="727104571653031865">"อนุญาตให้แก้ไขข้อบกพร่องผ่าน Wi-Fi ไหม"</string>
+    <string name="adbwifi_warning_message" msgid="8005936574322702388">"การแก้ไขข้อบกพร่องผ่าน Wi-Fi มีไว้เพื่อการพัฒนาเท่านั้น ให้ใช้การแก้ไขนี้เพื่อคัดลอกข้อมูลระหว่างคอมพิวเตอร์และอุปกรณ์ ติดตั้งแอปในอุปกรณ์โดยไม่มีการแจ้งเตือน และอ่านข้อมูลบันทึก"</string>
     <string name="adb_keys_warning_message" msgid="2968555274488101220">"ยกเลิกการเข้าถึงเพื่อแก้ปัญหาผ่าน USB จากคอมพิวเตอร์ทุกเครื่องที่คุณได้ให้สิทธิ์ก่อนหน้านี้ไหม"</string>
     <string name="dev_settings_warning_title" msgid="8251234890169074553">"อนุญาตการตั้งค่าสำหรับการพัฒนาหรือไม่"</string>
     <string name="dev_settings_warning_message" msgid="37741686486073668">"การตั้งค่านี้มีไว้เพื่อการพัฒนาเท่านั้น จึงอาจทำให้อุปกรณ์และแอปพลิเคชันที่มีอยู่เสียหายหรือทำงานผิดพลาดได้"</string>
@@ -383,8 +412,7 @@
     <string name="daltonizer_mode_protanomaly" msgid="7805583306666608440">"ตาบอดจางสีแดง (สีแดง/เขียว)"</string>
     <string name="daltonizer_mode_tritanomaly" msgid="7135266249220732267">"ตาบอดจางสีน้ำเงิน (สีน้ำเงิน/เหลือง)"</string>
     <string name="accessibility_display_daltonizer_preference_title" msgid="1810693571332381974">"การแก้สี"</string>
-    <!-- no translation found for accessibility_display_daltonizer_preference_subtitle (6178138727195403796) -->
-    <skip />
+    <string name="accessibility_display_daltonizer_preference_subtitle" msgid="6178138727195403796">"การแก้ไขสีช่วยให้ผู้ที่มีอาการตาบอดสีเห็นสีต่างๆ ได้ตรงตามจริงยิ่งขึ้น"</string>
     <string name="daltonizer_type_overridden" msgid="4509604753672535721">"แทนที่โดย <xliff:g id="TITLE">%1$s</xliff:g>"</string>
     <string name="power_remaining_settings_home_page" msgid="4885165789445462557">"<xliff:g id="PERCENTAGE">%1$s</xliff:g> - <xliff:g id="TIME_STRING">%2$s</xliff:g>"</string>
     <string name="power_remaining_duration_only" msgid="8264199158671531431">"เหลืออีกประมาณ <xliff:g id="TIME_REMAINING">%1$s</xliff:g>"</string>
@@ -403,21 +431,19 @@
     <string name="power_remaining_less_than_duration" msgid="1812668275239801236">"เหลือเวลาอีกไม่ถึง <xliff:g id="THRESHOLD">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_more_than_subtext" msgid="7919119719242734848">"เหลือเวลามากกว่า <xliff:g id="TIME_REMAINING">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_only_more_than_subtext" msgid="3274496164769110480">"เหลือเวลามากกว่า <xliff:g id="TIME_REMAINING">%1$s</xliff:g>"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="6583866940347159957">"โทรศัพท์อาจปิดเครื่องในไม่ช้า"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="8009177999719462724">"แท็บเล็ตอาจปิดเครื่องในไม่ช้า"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="8320892540455268018">"อุปกรณ์อาจปิดเครื่องในไม่ช้า"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="6186572170809116621">"โทรศัพท์อาจปิดเครื่องในไม่ช้า (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="1338758278145563121">"แท็บเล็ตอาจปิดเครื่องในไม่ช้า (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="3699579688084774362">"อุปกรณ์อาจปิดเครื่องในไม่ช้า (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="137330009791560774">"โทรศัพท์อาจปิดเครื่องในไม่ช้า"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="145489081521468132">"แท็บเล็ตอาจปิดเครื่องในไม่ช้า"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="1070562682853942350">"อุปกรณ์อาจปิดเครื่องในไม่ช้า"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="4429259621177089719">"โทรศัพท์อาจปิดเครื่องในไม่ช้า (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="7703677921000858479">"แท็บเล็ตอาจปิดเครื่องในไม่ช้า (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="4374784375644214578">"อุปกรณ์อาจปิดเครื่องในไม่ช้า (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
     <string name="power_charging" msgid="6727132649743436802">"<xliff:g id="LEVEL">%1$s</xliff:g> - <xliff:g id="STATE">%2$s</xliff:g>"</string>
     <string name="power_remaining_charging_duration_only" msgid="7415639699283965818">"เหลือ <xliff:g id="TIME">%1$s</xliff:g> จนกว่าจะชาร์จ"</string>
     <string name="power_charging_duration" msgid="5005740040558984057">"<xliff:g id="LEVEL">%1$s</xliff:g> - <xliff:g id="TIME">%2$s</xliff:g> จนกว่าจะชาร์จ"</string>
     <string name="battery_info_status_unknown" msgid="268625384868401114">"ไม่ทราบ"</string>
     <string name="battery_info_status_charging" msgid="4279958015430387405">"กำลังชาร์จ"</string>
-    <!-- no translation found for battery_info_status_charging_fast (8027559755902954885) -->
-    <skip />
-    <!-- no translation found for battery_info_status_charging_slow (3190803837168962319) -->
-    <skip />
+    <string name="battery_info_status_charging_fast" msgid="8027559755902954885">"กำลังชาร์จเร็ว"</string>
+    <string name="battery_info_status_charging_slow" msgid="3190803837168962319">"กำลังชาร์จอย่างช้าๆ"</string>
     <string name="battery_info_status_discharging" msgid="6962689305413556485">"ไม่ได้ชาร์จ"</string>
     <string name="battery_info_status_not_charging" msgid="8330015078868707899">"เสียบอยู่ ไม่สามารถชาร์จได้ในขณะนี้"</string>
     <string name="battery_info_status_full" msgid="4443168946046847468">"เต็ม"</string>
diff --git a/packages/SettingsLib/res/values-tl/strings.xml b/packages/SettingsLib/res/values-tl/strings.xml
index 8012244..ee04288 100644
--- a/packages/SettingsLib/res/values-tl/strings.xml
+++ b/packages/SettingsLib/res/values-tl/strings.xml
@@ -206,6 +206,33 @@
     <string name="enable_adb" msgid="8072776357237289039">"Pag-debug ng USB"</string>
     <string name="enable_adb_summary" msgid="3711526030096574316">"Debug mode kapag nakakonekta ang USB"</string>
     <string name="clear_adb_keys" msgid="3010148733140369917">"Bawiin ang mga pahintulot sa pag-debug ng USB"</string>
+    <string name="enable_adb_wireless" msgid="6973226350963971018">"Wireless na pag-debug"</string>
+    <string name="enable_adb_wireless_summary" msgid="7344391423657093011">"Debug mode kapag nakakonekta sa Wi‑Fi"</string>
+    <string name="adb_wireless_error" msgid="721958772149779856">"Error"</string>
+    <string name="adb_wireless_settings" msgid="2295017847215680229">"Wireless na pag-debug"</string>
+    <string name="adb_wireless_list_empty_off" msgid="1713707973837255490">"Para makita at magamit ang mga available na device, i-on ang wireless na pag-debug"</string>
+    <string name="adb_pair_method_qrcode_title" msgid="6982904096137468634">"Magpares ng device gamit ang QR code"</string>
+    <string name="adb_pair_method_qrcode_summary" msgid="3729901496856458634">"Magpares ng mga bagong device gamit ang QR code Scanner"</string>
+    <string name="adb_pair_method_code_title" msgid="1122590300445142904">"Pinapares ang device gamit ang code ng pagpapares"</string>
+    <string name="adb_pair_method_code_summary" msgid="6370414511333685185">"Magpares ng mga bagong device gamit ang six digit na code"</string>
+    <string name="adb_paired_devices_title" msgid="5268997341526217362">"Mga nakapares na device"</string>
+    <string name="adb_wireless_device_connected_summary" msgid="3039660790249148713">"Kasalukuyang nakakonekta"</string>
+    <string name="adb_wireless_device_details_title" msgid="7129369670526565786">"Mga detalye ng device"</string>
+    <string name="adb_device_forget" msgid="193072400783068417">"Kalimutan"</string>
+    <string name="adb_device_fingerprint_title_format" msgid="291504822917843701">"Fingerprint ng device: <xliff:g id="FINGERPRINT_PARAM">%1$s</xliff:g>"</string>
+    <string name="adb_wireless_connection_failed_title" msgid="664211177427438438">"Hindi nagawang kumonekta"</string>
+    <string name="adb_wireless_connection_failed_message" msgid="9213896700171602073">"Tiyaking tama ang network kung saan nakakonekta ang <xliff:g id="DEVICE_NAME">%1$s</xliff:g>"</string>
+    <string name="adb_pairing_device_dialog_title" msgid="7141739231018530210">"Ipares sa device"</string>
+    <string name="adb_pairing_device_dialog_pairing_code_label" msgid="3639239786669722731">"Code ng pagpapares sa Wi-Fi"</string>
+    <string name="adb_pairing_device_dialog_failed_title" msgid="3426758947882091735">"Hindi nagawa ang pagpapares"</string>
+    <string name="adb_pairing_device_dialog_failed_msg" msgid="6611097519661997148">"Tiyaking nakakonekta ang device sa parehong network."</string>
+    <string name="adb_wireless_qrcode_summary" msgid="8051414549011801917">"Ipares ang device gamit ang Wi‑Fi sa pamamagitan ng pag-scan ng isang QR code"</string>
+    <string name="adb_wireless_verifying_qrcode_text" msgid="6123192424916029207">"Ipinapares ang device…"</string>
+    <string name="adb_qrcode_pairing_device_failed_msg" msgid="6936292092592914132">"Hindi nagawang ipares ang device. Hindi tama ang QR code, o hindi nakakonekta ang device sa parehong network."</string>
+    <string name="adb_wireless_ip_addr_preference_title" msgid="8335132107715311730">"IP address at Port"</string>
+    <string name="adb_wireless_qrcode_pairing_title" msgid="1906409667944674707">"I-scan ang QR code"</string>
+    <string name="adb_wireless_qrcode_pairing_description" msgid="8578868049289910131">"Ipares ang device gamit ang Wi‑Fi sa pamamagitan ng pag-scan ng isang QR Code"</string>
+    <string name="keywords_adb_wireless" msgid="6507505581882171240">"adb, debug, dev"</string>
     <string name="bugreport_in_power" msgid="8664089072534638709">"Shortcut ng ulat sa bug"</string>
     <string name="bugreport_in_power_summary" msgid="1885529649381831775">"Magpakita ng button sa power menu sa pagkuha ng ulat sa bug"</string>
     <string name="keep_screen_on" msgid="1187161672348797558">"Manatiling gumagana"</string>
@@ -271,6 +298,8 @@
     <string name="tethering_hardware_offload_summary" msgid="7801345335142803029">"Gamitin ang hardware acceleration para sa pag-tether kung available"</string>
     <string name="adb_warning_title" msgid="7708653449506485728">"Payagan ang pag-debug ng USB?"</string>
     <string name="adb_warning_message" msgid="8145270656419669221">"Ang pag-debug ng USB ay para lang sa mga layuning pag-develop. Gamitin ito upang kumopya ng data sa pagitan ng iyong computer at iyong device, mag-install ng mga app sa iyong device nang walang notification, at magbasa ng data ng log."</string>
+    <string name="adbwifi_warning_title" msgid="727104571653031865">"Pahintulutan ang wireless na pag-debug?"</string>
+    <string name="adbwifi_warning_message" msgid="8005936574322702388">"Ang wireless na pag-debug ay para lang sa layunin ng pag-develop. Gamitin ito para kumopya ng data sa iyong computer at device mo, mag-install ng mga app sa iyong device nang walang notification, at magbasa ng data ng log."</string>
     <string name="adb_keys_warning_message" msgid="2968555274488101220">"Bawiin ang access sa pag-debug ng USB mula sa lahat ng computer na dati mong pinahintulutan?"</string>
     <string name="dev_settings_warning_title" msgid="8251234890169074553">"Payagan ang mga setting ng pag-develop?"</string>
     <string name="dev_settings_warning_message" msgid="37741686486073668">"Nilalayon ang mga setting na ito para sa paggamit sa pag-develop lamang. Maaaring magsanhi ang mga ito ng pagkasira o hindi paggana nang maayos ng iyong device at mga application na nandito."</string>
@@ -383,8 +412,7 @@
     <string name="daltonizer_mode_protanomaly" msgid="7805583306666608440">"Protanomaly (pula-berde)"</string>
     <string name="daltonizer_mode_tritanomaly" msgid="7135266249220732267">"Tritanomaly (asul-dilaw)"</string>
     <string name="accessibility_display_daltonizer_preference_title" msgid="1810693571332381974">"Pagtatama ng kulay"</string>
-    <!-- no translation found for accessibility_display_daltonizer_preference_subtitle (6178138727195403796) -->
-    <skip />
+    <string name="accessibility_display_daltonizer_preference_subtitle" msgid="6178138727195403796">"Tinutulungan ng color correction ang mga taong colorblind na makakita ng mas tumpak na kulay"</string>
     <string name="daltonizer_type_overridden" msgid="4509604753672535721">"Na-override ng <xliff:g id="TITLE">%1$s</xliff:g>"</string>
     <string name="power_remaining_settings_home_page" msgid="4885165789445462557">"<xliff:g id="PERCENTAGE">%1$s</xliff:g> - <xliff:g id="TIME_STRING">%2$s</xliff:g>"</string>
     <string name="power_remaining_duration_only" msgid="8264199158671531431">"Humigit-kumulang <xliff:g id="TIME_REMAINING">%1$s</xliff:g> ang natitira"</string>
@@ -403,21 +431,19 @@
     <string name="power_remaining_less_than_duration" msgid="1812668275239801236">"Wala nang <xliff:g id="THRESHOLD">%1$s</xliff:g> ang natitira (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_more_than_subtext" msgid="7919119719242734848">"Mahigit <xliff:g id="TIME_REMAINING">%1$s</xliff:g> pa ang natitira (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_only_more_than_subtext" msgid="3274496164769110480">"Mahigit <xliff:g id="TIME_REMAINING">%1$s</xliff:g> pa ang natitira"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="6583866940347159957">"Malapit nang mag-shut down ang telepono"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="8009177999719462724">"Malapit nang mag-shut down ang tablet"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="8320892540455268018">"Malapit nang mag-shut down ang device"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="6186572170809116621">"Malapit nang mag-shut down ang telepono (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="1338758278145563121">"Malapit nang mag-shutdown ang tablet (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="3699579688084774362">"Malapit nang mag-shut down ang device (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="137330009791560774">"Baka mag-shut down na ang telepono"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="145489081521468132">"Baka mag-shut down na ang tablet"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="1070562682853942350">"Baka mag-shut down na ang device"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="4429259621177089719">"Baka mag-shut down na ang telepono (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="7703677921000858479">"Baka mag-shut down na ang tablet (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="4374784375644214578">"Baka mag-shut down na ang device (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
     <string name="power_charging" msgid="6727132649743436802">"<xliff:g id="LEVEL">%1$s</xliff:g> - <xliff:g id="STATE">%2$s</xliff:g>"</string>
     <string name="power_remaining_charging_duration_only" msgid="7415639699283965818">"<xliff:g id="TIME">%1$s</xliff:g> ang natitira bago matapos mag-charge"</string>
     <string name="power_charging_duration" msgid="5005740040558984057">"<xliff:g id="LEVEL">%1$s</xliff:g> - <xliff:g id="TIME">%2$s</xliff:g> hanggang matapos mag-charge"</string>
     <string name="battery_info_status_unknown" msgid="268625384868401114">"Hindi Kilala"</string>
     <string name="battery_info_status_charging" msgid="4279958015430387405">"Nagcha-charge"</string>
-    <!-- no translation found for battery_info_status_charging_fast (8027559755902954885) -->
-    <skip />
-    <!-- no translation found for battery_info_status_charging_slow (3190803837168962319) -->
-    <skip />
+    <string name="battery_info_status_charging_fast" msgid="8027559755902954885">"Mabilis na charge"</string>
+    <string name="battery_info_status_charging_slow" msgid="3190803837168962319">"Mabagal na charge"</string>
     <string name="battery_info_status_discharging" msgid="6962689305413556485">"Hindi nagcha-charge"</string>
     <string name="battery_info_status_not_charging" msgid="8330015078868707899">"Nakasaksak, hindi makapag-charge sa ngayon"</string>
     <string name="battery_info_status_full" msgid="4443168946046847468">"Puno"</string>
diff --git a/packages/SettingsLib/res/values-tr/strings.xml b/packages/SettingsLib/res/values-tr/strings.xml
index b83ffcb..5015e38 100644
--- a/packages/SettingsLib/res/values-tr/strings.xml
+++ b/packages/SettingsLib/res/values-tr/strings.xml
@@ -206,6 +206,33 @@
     <string name="enable_adb" msgid="8072776357237289039">"USB hata ayıklaması"</string>
     <string name="enable_adb_summary" msgid="3711526030096574316">"USB bağlandığında hata ayıklama modu"</string>
     <string name="clear_adb_keys" msgid="3010148733140369917">"USB hata ayıklama yetkilerini kaldır"</string>
+    <string name="enable_adb_wireless" msgid="6973226350963971018">"Kablosuz hata ayıklama"</string>
+    <string name="enable_adb_wireless_summary" msgid="7344391423657093011">"Kablosuz bağlandığında hata ayıklama modu"</string>
+    <string name="adb_wireless_error" msgid="721958772149779856">"Hata"</string>
+    <string name="adb_wireless_settings" msgid="2295017847215680229">"Kablosuz hata ayıklama"</string>
+    <string name="adb_wireless_list_empty_off" msgid="1713707973837255490">"Mevcut cihazları görmek ve kullanmak için kablosuz hata ayıklamayı açın"</string>
+    <string name="adb_pair_method_qrcode_title" msgid="6982904096137468634">"Cihazı QR kodu ile eşle"</string>
+    <string name="adb_pair_method_qrcode_summary" msgid="3729901496856458634">"Yeni cihazları QR kodu Tarayıcıyı kullanarak eşleyin"</string>
+    <string name="adb_pair_method_code_title" msgid="1122590300445142904">"Eşleme kodu ile cihaz eşleme"</string>
+    <string name="adb_pair_method_code_summary" msgid="6370414511333685185">"Yeni cihazları altı basamaklı kodu kullanarak eşleyin"</string>
+    <string name="adb_paired_devices_title" msgid="5268997341526217362">"Eşlenen cihazlar"</string>
+    <string name="adb_wireless_device_connected_summary" msgid="3039660790249148713">"Şu anda bağlı"</string>
+    <string name="adb_wireless_device_details_title" msgid="7129369670526565786">"Cihaz ayrıntıları"</string>
+    <string name="adb_device_forget" msgid="193072400783068417">"Unut"</string>
+    <string name="adb_device_fingerprint_title_format" msgid="291504822917843701">"Cihaz parmak izi: <xliff:g id="FINGERPRINT_PARAM">%1$s</xliff:g>"</string>
+    <string name="adb_wireless_connection_failed_title" msgid="664211177427438438">"Bağlantı başarısız oldu"</string>
+    <string name="adb_wireless_connection_failed_message" msgid="9213896700171602073">"<xliff:g id="DEVICE_NAME">%1$s</xliff:g> cihazının aynı ağa bağlı olduğundan emin olun"</string>
+    <string name="adb_pairing_device_dialog_title" msgid="7141739231018530210">"Cihazla eşle"</string>
+    <string name="adb_pairing_device_dialog_pairing_code_label" msgid="3639239786669722731">"Kablosuz eşleme kodu"</string>
+    <string name="adb_pairing_device_dialog_failed_title" msgid="3426758947882091735">"Eşleme başarısız oldu"</string>
+    <string name="adb_pairing_device_dialog_failed_msg" msgid="6611097519661997148">"Cihazın aynı ağa bağlı olduğundan emin olun."</string>
+    <string name="adb_wireless_qrcode_summary" msgid="8051414549011801917">"QR kodu tarayarak kablosuz ağ üzerinden cihaz eşleyin"</string>
+    <string name="adb_wireless_verifying_qrcode_text" msgid="6123192424916029207">"Cihaz eşleniyor…"</string>
+    <string name="adb_qrcode_pairing_device_failed_msg" msgid="6936292092592914132">"Cihaz eşlenemedi. QR kodu hatalı ya da cihaz aynı ağa bağlı değil."</string>
+    <string name="adb_wireless_ip_addr_preference_title" msgid="8335132107715311730">"IP adresi ve Bağlantı noktası"</string>
+    <string name="adb_wireless_qrcode_pairing_title" msgid="1906409667944674707">"QR kodunu tara"</string>
+    <string name="adb_wireless_qrcode_pairing_description" msgid="8578868049289910131">"QR kodu tarayarak kablosuz ağ üzerinden cihaz eşleyin"</string>
+    <string name="keywords_adb_wireless" msgid="6507505581882171240">"adb, hata ayıklama, dev"</string>
     <string name="bugreport_in_power" msgid="8664089072534638709">"Hata raporu kısayolu"</string>
     <string name="bugreport_in_power_summary" msgid="1885529649381831775">"Hata raporu almak için güç menüsünde bir düğme göster"</string>
     <string name="keep_screen_on" msgid="1187161672348797558">"Uyanık kal"</string>
@@ -271,6 +298,8 @@
     <string name="tethering_hardware_offload_summary" msgid="7801345335142803029">"Mevcutsa, tethering donanım hızlandırıcısını kullan"</string>
     <string name="adb_warning_title" msgid="7708653449506485728">"USB hata ayıklamasına izin verilsin mi?"</string>
     <string name="adb_warning_message" msgid="8145270656419669221">"USB hata ayıklaması yalnızca geliştirme amaçlıdır. Verileri bilgisayarınızla cihazınız arasında kopyalamak, bildirim göndermeksizin uygulamaları cihazınıza yüklemek ve günlük verilerini okumak için kullanın."</string>
+    <string name="adbwifi_warning_title" msgid="727104571653031865">"Kablosuz hata ayıklamaya izin verilsin mi?"</string>
+    <string name="adbwifi_warning_message" msgid="8005936574322702388">"Kablosuz hata ayıklama işlevi yalnızca geliştirme amaçlıdır. Verileri bilgisayarınızla cihazınız arasında kopyalamak, bildirim göndermeksizin uygulamaları cihazınıza yüklemek ve günlük verilerini okumak için kullanın."</string>
     <string name="adb_keys_warning_message" msgid="2968555274488101220">"Daha önce yetki verdiğiniz tüm bilgisayarların USB hata ayıklama erişimini iptal etmek istiyor musunuz?"</string>
     <string name="dev_settings_warning_title" msgid="8251234890169074553">"Geliştirme amaçlı ayarlara izin verilsin mi?"</string>
     <string name="dev_settings_warning_message" msgid="37741686486073668">"Bu ayarlar yalnızca geliştirme amaçlıdır. Cihazınızın veya cihazdaki uygulamaların bozulmasına veya hatalı çalışmasına neden olabilir."</string>
@@ -383,8 +412,7 @@
     <string name="daltonizer_mode_protanomaly" msgid="7805583306666608440">"Kırmızı renk körlüğü (kırmızı-yeşil)"</string>
     <string name="daltonizer_mode_tritanomaly" msgid="7135266249220732267">"Mavi renk körlüğü (mavi-sarı)"</string>
     <string name="accessibility_display_daltonizer_preference_title" msgid="1810693571332381974">"Renk düzeltme"</string>
-    <!-- no translation found for accessibility_display_daltonizer_preference_subtitle (6178138727195403796) -->
-    <skip />
+    <string name="accessibility_display_daltonizer_preference_subtitle" msgid="6178138727195403796">"Renk düzeltme, renk körlüğü olan kişilerin daha doğru renkler görmelerine yardımcı olur"</string>
     <string name="daltonizer_type_overridden" msgid="4509604753672535721">"<xliff:g id="TITLE">%1$s</xliff:g> tarafından geçersiz kılındı"</string>
     <string name="power_remaining_settings_home_page" msgid="4885165789445462557">"<xliff:g id="PERCENTAGE">%1$s</xliff:g> - <xliff:g id="TIME_STRING">%2$s</xliff:g>"</string>
     <string name="power_remaining_duration_only" msgid="8264199158671531431">"Yaklaşık <xliff:g id="TIME_REMAINING">%1$s</xliff:g> kaldı"</string>
@@ -403,21 +431,19 @@
     <string name="power_remaining_less_than_duration" msgid="1812668275239801236">"En çok <xliff:g id="THRESHOLD">%1$s</xliff:g> kaldı (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_more_than_subtext" msgid="7919119719242734848">"En az <xliff:g id="TIME_REMAINING">%1$s</xliff:g> kaldı (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_only_more_than_subtext" msgid="3274496164769110480">"En az <xliff:g id="TIME_REMAINING">%1$s</xliff:g> kaldı"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="6583866940347159957">"Telefon kısa süre içinde kapanabilir"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="8009177999719462724">"Tablet kısa süre içinde kapanabilir"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="8320892540455268018">"Cihaz kısa süre içinde kapanabilir"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="6186572170809116621">"Telefon kısa süre içinde kapanabilir (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="1338758278145563121">"Tablet kısa süre içinde kapanabilir (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="3699579688084774362">"Cihaz kısa süre içinde kapanabilir (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="137330009791560774">"Telefon kısa süre içinde kapanabilir"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="145489081521468132">"Tablet kısa süre içinde kapanabilir"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="1070562682853942350">"Cihaz kısa süre içinde kapanabilir"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="4429259621177089719">"Telefon kısa süre içinde kapanabilir(<xliff:g id="LEVEL">%1$s</xliff:g>"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="7703677921000858479">"Tablet kısa süre içinde kapanabilir(<xliff:g id="LEVEL">%1$s</xliff:g>"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="4374784375644214578">"Cihaz kısa süre içinde kapanabilir (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
     <string name="power_charging" msgid="6727132649743436802">"<xliff:g id="LEVEL">%1$s</xliff:g> - <xliff:g id="STATE">%2$s</xliff:g>"</string>
     <string name="power_remaining_charging_duration_only" msgid="7415639699283965818">"Şarj olmaya <xliff:g id="TIME">%1$s</xliff:g> kaldı"</string>
     <string name="power_charging_duration" msgid="5005740040558984057">"<xliff:g id="LEVEL">%1$s</xliff:g> - şarj olmaya <xliff:g id="TIME">%2$s</xliff:g> kaldı"</string>
     <string name="battery_info_status_unknown" msgid="268625384868401114">"Bilinmiyor"</string>
     <string name="battery_info_status_charging" msgid="4279958015430387405">"Şarj oluyor"</string>
-    <!-- no translation found for battery_info_status_charging_fast (8027559755902954885) -->
-    <skip />
-    <!-- no translation found for battery_info_status_charging_slow (3190803837168962319) -->
-    <skip />
+    <string name="battery_info_status_charging_fast" msgid="8027559755902954885">"Hızlı şarj oluyor"</string>
+    <string name="battery_info_status_charging_slow" msgid="3190803837168962319">"Yavaş şarj oluyor"</string>
     <string name="battery_info_status_discharging" msgid="6962689305413556485">"Şarj olmuyor"</string>
     <string name="battery_info_status_not_charging" msgid="8330015078868707899">"Prize takıldı, şu anda şarj olamıyor"</string>
     <string name="battery_info_status_full" msgid="4443168946046847468">"Dolu"</string>
diff --git a/packages/SettingsLib/res/values-uk/strings.xml b/packages/SettingsLib/res/values-uk/strings.xml
index 5fb46f8..3c8f481 100644
--- a/packages/SettingsLib/res/values-uk/strings.xml
+++ b/packages/SettingsLib/res/values-uk/strings.xml
@@ -206,6 +206,33 @@
     <string name="enable_adb" msgid="8072776357237289039">"Налагодження USB"</string>
     <string name="enable_adb_summary" msgid="3711526030096574316">"Вмикати налагодження, коли телефон підключено через USB"</string>
     <string name="clear_adb_keys" msgid="3010148733140369917">"Скасувати доступ до налагодження USB"</string>
+    <string name="enable_adb_wireless" msgid="6973226350963971018">"Бездротове налагодження"</string>
+    <string name="enable_adb_wireless_summary" msgid="7344391423657093011">"Вмикати режим налагодження, коли пристрій підключено до мережі Wi-Fi"</string>
+    <string name="adb_wireless_error" msgid="721958772149779856">"Помилка"</string>
+    <string name="adb_wireless_settings" msgid="2295017847215680229">"Бездротове налагодження"</string>
+    <string name="adb_wireless_list_empty_off" msgid="1713707973837255490">"Щоб переглядати та використовувати доступні пристрої, увімкніть бездротове налагодження"</string>
+    <string name="adb_pair_method_qrcode_title" msgid="6982904096137468634">"Підключати пристрій за допомогою QR-коду"</string>
+    <string name="adb_pair_method_qrcode_summary" msgid="3729901496856458634">"Підключати нові пристрої за допомогою сканера QR-кодів"</string>
+    <string name="adb_pair_method_code_title" msgid="1122590300445142904">"Підключати пристрій за допомогою коду підключення"</string>
+    <string name="adb_pair_method_code_summary" msgid="6370414511333685185">"Підключати нові пристрої за допомогою шестизначного коду"</string>
+    <string name="adb_paired_devices_title" msgid="5268997341526217362">"Підключені пристрої"</string>
+    <string name="adb_wireless_device_connected_summary" msgid="3039660790249148713">"Поточні підключення"</string>
+    <string name="adb_wireless_device_details_title" msgid="7129369670526565786">"Про пристрій"</string>
+    <string name="adb_device_forget" msgid="193072400783068417">"Забути"</string>
+    <string name="adb_device_fingerprint_title_format" msgid="291504822917843701">"Відбиток пристрою: <xliff:g id="FINGERPRINT_PARAM">%1$s</xliff:g>"</string>
+    <string name="adb_wireless_connection_failed_title" msgid="664211177427438438">"Помилка з\'єднання"</string>
+    <string name="adb_wireless_connection_failed_message" msgid="9213896700171602073">"Переконайтеся, що пристрій \"<xliff:g id="DEVICE_NAME">%1$s</xliff:g>\" підключено до правильної мережі"</string>
+    <string name="adb_pairing_device_dialog_title" msgid="7141739231018530210">"Підключитися до пристрою"</string>
+    <string name="adb_pairing_device_dialog_pairing_code_label" msgid="3639239786669722731">"Код підключення Wi‑Fi"</string>
+    <string name="adb_pairing_device_dialog_failed_title" msgid="3426758947882091735">"Помилка підключення"</string>
+    <string name="adb_pairing_device_dialog_failed_msg" msgid="6611097519661997148">"Переконайтеся, що пристрій підключено до тієї ж мережі."</string>
+    <string name="adb_wireless_qrcode_summary" msgid="8051414549011801917">"Підключати пристрій через Wi‑Fi за допомогою QR-коду"</string>
+    <string name="adb_wireless_verifying_qrcode_text" msgid="6123192424916029207">"Підключення пристрою…"</string>
+    <string name="adb_qrcode_pairing_device_failed_msg" msgid="6936292092592914132">"Не вдалося підключитися до пристрою. Надано неправильний QR-код або пристрій не підключено до тієї ж мережі."</string>
+    <string name="adb_wireless_ip_addr_preference_title" msgid="8335132107715311730">"IP-адреса та порт"</string>
+    <string name="adb_wireless_qrcode_pairing_title" msgid="1906409667944674707">"Сканувати QR-код"</string>
+    <string name="adb_wireless_qrcode_pairing_description" msgid="8578868049289910131">"Підключати пристрій через Wi‑Fi за допомогою QR-коду"</string>
+    <string name="keywords_adb_wireless" msgid="6507505581882171240">"adb, налагодження, розробка"</string>
     <string name="bugreport_in_power" msgid="8664089072534638709">"Ярлик звіту про помилки"</string>
     <string name="bugreport_in_power_summary" msgid="1885529649381831775">"Показувати в меню живлення кнопку створення звіту про помилки"</string>
     <string name="keep_screen_on" msgid="1187161672348797558">"Залишати активним"</string>
@@ -271,6 +298,8 @@
     <string name="tethering_hardware_offload_summary" msgid="7801345335142803029">"Якщо доступно, вмикати апаратне прискорення під час використання телефона в режимі модема"</string>
     <string name="adb_warning_title" msgid="7708653449506485728">"Дозвол. налагодж. USB?"</string>
     <string name="adb_warning_message" msgid="8145270656419669221">"Налагодження USB застосовується лише з метою розробки. Його можна використовувати для копіювання даних між комп’ютером і пристроєм, встановлення програм на вашому пристрої без сповіщення та читання даних журналу."</string>
+    <string name="adbwifi_warning_title" msgid="727104571653031865">"Дозволити бездротове налагодження?"</string>
+    <string name="adbwifi_warning_message" msgid="8005936574322702388">"Бездротове налагодження застосовується лише з метою розробки. Його можна використовувати, щоб копіювати дані між комп\'ютером і пристроєм, встановлювати додатки на пристрої без сповіщення та переглядати дані журналу."</string>
     <string name="adb_keys_warning_message" msgid="2968555274488101220">"Скасувати доступ до налагодження USB для всіх комп’ютерів, які раніше отримали таке право?"</string>
     <string name="dev_settings_warning_title" msgid="8251234890169074553">"Дозволити налаштування розробки?"</string>
     <string name="dev_settings_warning_message" msgid="37741686486073668">"Ці налаштування застосовуються лише з метою розробки. Вони можуть спричиняти вихід з ладу або неправильне функціонування вашого пристрою чи програм у ньому."</string>
@@ -383,8 +412,7 @@
     <string name="daltonizer_mode_protanomaly" msgid="7805583306666608440">"Протаномалія (червоний – зелений)"</string>
     <string name="daltonizer_mode_tritanomaly" msgid="7135266249220732267">"Тританомалія (синій – жовтий)"</string>
     <string name="accessibility_display_daltonizer_preference_title" msgid="1810693571332381974">"Корекція кольору"</string>
-    <!-- no translation found for accessibility_display_daltonizer_preference_subtitle (6178138727195403796) -->
-    <skip />
+    <string name="accessibility_display_daltonizer_preference_subtitle" msgid="6178138727195403796">"Корекція кольору допомагає людям із дальтонізмом бачити точніші кольори"</string>
     <string name="daltonizer_type_overridden" msgid="4509604753672535721">"Замінено на <xliff:g id="TITLE">%1$s</xliff:g>"</string>
     <string name="power_remaining_settings_home_page" msgid="4885165789445462557">"<xliff:g id="PERCENTAGE">%1$s</xliff:g> – <xliff:g id="TIME_STRING">%2$s</xliff:g>"</string>
     <string name="power_remaining_duration_only" msgid="8264199158671531431">"Залишилося приблизно <xliff:g id="TIME_REMAINING">%1$s</xliff:g>"</string>
@@ -403,21 +431,19 @@
     <string name="power_remaining_less_than_duration" msgid="1812668275239801236">"Залишилося менше ніж <xliff:g id="THRESHOLD">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_more_than_subtext" msgid="7919119719242734848">"Залишилося понад <xliff:g id="TIME_REMAINING">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_only_more_than_subtext" msgid="3274496164769110480">"Залишилося понад <xliff:g id="TIME_REMAINING">%1$s</xliff:g>"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="6583866940347159957">"Телефон може невдовзі вимкнутися"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="8009177999719462724">"Планшет може невдовзі вимкнутися"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="8320892540455268018">"Пристрій може невдовзі вимкнутися"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="6186572170809116621">"Телефон може невдовзі вимкнутися (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="1338758278145563121">"Планшет може невдовзі вимкнутися (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="3699579688084774362">"Пристрій може невдовзі вимкнутися (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="137330009791560774">"Телефон може невдовзі вимкнутися"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="145489081521468132">"Планшет може невдовзі вимкнутися"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="1070562682853942350">"Пристрій може невдовзі вимкнутися"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="4429259621177089719">"Телефон може невдовзі вимкнутися (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="7703677921000858479">"Планшет може невдовзі вимкнутися (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="4374784375644214578">"Пристрій може невдовзі вимкнутися (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
     <string name="power_charging" msgid="6727132649743436802">"<xliff:g id="LEVEL">%1$s</xliff:g> – <xliff:g id="STATE">%2$s</xliff:g>"</string>
     <string name="power_remaining_charging_duration_only" msgid="7415639699283965818">"<xliff:g id="TIME">%1$s</xliff:g> до повного заряду"</string>
     <string name="power_charging_duration" msgid="5005740040558984057">"<xliff:g id="LEVEL">%1$s</xliff:g> – <xliff:g id="TIME">%2$s</xliff:g> до повного заряду"</string>
     <string name="battery_info_status_unknown" msgid="268625384868401114">"Невідомо"</string>
     <string name="battery_info_status_charging" msgid="4279958015430387405">"Заряджається"</string>
-    <!-- no translation found for battery_info_status_charging_fast (8027559755902954885) -->
-    <skip />
-    <!-- no translation found for battery_info_status_charging_slow (3190803837168962319) -->
-    <skip />
+    <string name="battery_info_status_charging_fast" msgid="8027559755902954885">"Швидке заряджання"</string>
+    <string name="battery_info_status_charging_slow" msgid="3190803837168962319">"Повільне заряджання"</string>
     <string name="battery_info_status_discharging" msgid="6962689305413556485">"Не заряджається"</string>
     <string name="battery_info_status_not_charging" msgid="8330015078868707899">"Підключено. Не вдається зарядити"</string>
     <string name="battery_info_status_full" msgid="4443168946046847468">"Акумулятор заряджено"</string>
diff --git a/packages/SettingsLib/res/values-ur/strings.xml b/packages/SettingsLib/res/values-ur/strings.xml
index c6c10f0..27e5b20 100644
--- a/packages/SettingsLib/res/values-ur/strings.xml
+++ b/packages/SettingsLib/res/values-ur/strings.xml
@@ -206,6 +206,33 @@
     <string name="enable_adb" msgid="8072776357237289039">"‏USB ڈیبگ کرنا"</string>
     <string name="enable_adb_summary" msgid="3711526030096574316">"‏USB مربوط ہونے پر ڈيبگ کرنے کی وضع"</string>
     <string name="clear_adb_keys" msgid="3010148733140369917">"‏USB ڈیبگ کرنے کی اجازت دہندگیوں کو منسوخ کریں"</string>
+    <string name="enable_adb_wireless" msgid="6973226350963971018">"وائرلیس ڈیبگنگ"</string>
+    <string name="enable_adb_wireless_summary" msgid="7344391423657093011">"‏Wi-Fi سے منسلک ہونے پر ڈیبگ موڈ"</string>
+    <string name="adb_wireless_error" msgid="721958772149779856">"خرابی"</string>
+    <string name="adb_wireless_settings" msgid="2295017847215680229">"وائرلیس ڈیبگنگ"</string>
+    <string name="adb_wireless_list_empty_off" msgid="1713707973837255490">"دستیاب آلات کو دیکھنے اور استعمال کرنے کے لیے، وائرلیس ڈیبگنگ آن کریں"</string>
+    <string name="adb_pair_method_qrcode_title" msgid="6982904096137468634">"‏QR کوڈ کے ذریعے آلہ کا جوڑا بنائیں"</string>
+    <string name="adb_pair_method_qrcode_summary" msgid="3729901496856458634">"‏QR کوڈ اسکینر کا استعمال کر کے نئے آلہ کا جوڑا بنائیں"</string>
+    <string name="adb_pair_method_code_title" msgid="1122590300445142904">"جوڑا بنانے کے کوڈ کے ذریعے آلہ کا جوڑا بنائیں"</string>
+    <string name="adb_pair_method_code_summary" msgid="6370414511333685185">"چھ ہندسوں کا کوڈ استعمال کر کے نئے آلات کا جوڑا بنائیں"</string>
+    <string name="adb_paired_devices_title" msgid="5268997341526217362">"جوڑا بنائے گئے آلات"</string>
+    <string name="adb_wireless_device_connected_summary" msgid="3039660790249148713">"فی الحال منسلک ہے"</string>
+    <string name="adb_wireless_device_details_title" msgid="7129369670526565786">"آلہ کی تفصیلات"</string>
+    <string name="adb_device_forget" msgid="193072400783068417">"بھول جائیں"</string>
+    <string name="adb_device_fingerprint_title_format" msgid="291504822917843701">"آلہ کا فنگر پرنٹ: <xliff:g id="FINGERPRINT_PARAM">%1$s</xliff:g>"</string>
+    <string name="adb_wireless_connection_failed_title" msgid="664211177427438438">"کنکشن ناکام ہو گیا"</string>
+    <string name="adb_wireless_connection_failed_message" msgid="9213896700171602073">"یقینی بنائیں کہ <xliff:g id="DEVICE_NAME">%1$s</xliff:g> درست نیٹ ورک سے منسلک ہے"</string>
+    <string name="adb_pairing_device_dialog_title" msgid="7141739231018530210">"آلہ کے ساتھ جوڑا بنائیں"</string>
+    <string name="adb_pairing_device_dialog_pairing_code_label" msgid="3639239786669722731">"‏Wi-Fi سے جوڑا بنانے کا کوڈ"</string>
+    <string name="adb_pairing_device_dialog_failed_title" msgid="3426758947882091735">"جوڑا بنانے میں ناکام"</string>
+    <string name="adb_pairing_device_dialog_failed_msg" msgid="6611097519661997148">"یقینی بنائیں کہ آلہ اسی نیٹ ورک سے منسلک ہے۔"</string>
+    <string name="adb_wireless_qrcode_summary" msgid="8051414549011801917">"‏QR کوڈ اسکین کر کے Wi-Fi پر آلہ کا جوڑا بنائیں"</string>
+    <string name="adb_wireless_verifying_qrcode_text" msgid="6123192424916029207">"آلہ کا جوڑا بنایا جا رہا ہے…"</string>
+    <string name="adb_qrcode_pairing_device_failed_msg" msgid="6936292092592914132">"‏آلہ کا جوڑا بنانے میں ناکام۔ یا تو QR کوڈ غلط تھا، یا آلہ اسی نیٹ ورک سے منسلک نہیں ہے۔"</string>
+    <string name="adb_wireless_ip_addr_preference_title" msgid="8335132107715311730">"‏IP پتہ اور پورٹ"</string>
+    <string name="adb_wireless_qrcode_pairing_title" msgid="1906409667944674707">"‏QR کوڈ اسکین کریں"</string>
+    <string name="adb_wireless_qrcode_pairing_description" msgid="8578868049289910131">"‏QR کوڈ اسکین کر کے Wi-Fi پر آلہ کا جوڑا بنائیں"</string>
+    <string name="keywords_adb_wireless" msgid="6507505581882171240">"‏adb، ڈیبگ، dev"</string>
     <string name="bugreport_in_power" msgid="8664089072534638709">"بگ رپورٹ کا شارٹ کٹ"</string>
     <string name="bugreport_in_power_summary" msgid="1885529649381831775">"بگ رپورٹ لینے کیلئے پاور مینو میں ایک بٹن دکھائیں"</string>
     <string name="keep_screen_on" msgid="1187161672348797558">"بیدار رکھیں"</string>
@@ -271,6 +298,8 @@
     <string name="tethering_hardware_offload_summary" msgid="7801345335142803029">"اگر دستیاب ہو تو ٹیدرنگ ہارڈویئر سرعت کاری کا استعمال کریں"</string>
     <string name="adb_warning_title" msgid="7708653449506485728">"‏USB ڈیبگ کرنے کی اجازت دیں؟"</string>
     <string name="adb_warning_message" msgid="8145270656419669221">"‏USB ڈیبگ کرنا صرف ڈیولپمنٹ کے مقاصد کیلئے ہے۔ اپنے کمپیوٹر اور اپنے آلہ کے درمیان ڈیٹا کاپی کرنے کیلئے اسے استعمال کریں، بغیر اطلاع کے اپنے آلہ پر ایپس انسٹال کریں اور لاگ ڈیٹا پڑھیں۔"</string>
+    <string name="adbwifi_warning_title" msgid="727104571653031865">"وائرلیس ڈیبگ کرنے کی اجازت دیں؟"</string>
+    <string name="adbwifi_warning_message" msgid="8005936574322702388">"وائرلیس ڈیبگ کرنا صرف ڈیولپمنٹ کے مقاصد کے لیے ہے۔ اپنے کمپیوٹر اور اپنے آلہ کے درمیان ڈیٹا کاپی کرنے کے لیے اسے استعمال کریں، بغیر اطلاع کے اپنے آلہ پر ایپس انسٹال کریں اور لاگ ڈیٹا پڑھیں۔"</string>
     <string name="adb_keys_warning_message" msgid="2968555274488101220">"‏اپنے ذریعہ پہلے سے اجازت یافتہ سبھی کمپیوٹرز سے USB ڈیبگ کرنے کی رسائی کو کالعدم کریں؟"</string>
     <string name="dev_settings_warning_title" msgid="8251234890169074553">"ڈویلپمنٹ ترتیبات کی اجازت دیں؟"</string>
     <string name="dev_settings_warning_message" msgid="37741686486073668">"یہ ترتیبات صرف ڈویلپمنٹ استعمال کے ارادے سے ہیں۔ ان سے آپ کا آلہ اور اس پر موجود ایپلیکیشنز بریک ہو سکتی یا غلط برتاؤ کر سکتی ہیں۔"</string>
@@ -383,8 +412,7 @@
     <string name="daltonizer_mode_protanomaly" msgid="7805583306666608440">"‏Protanomaly (سرخ سبز)"</string>
     <string name="daltonizer_mode_tritanomaly" msgid="7135266249220732267">"‏Tritanomaly (نیلا پیلا)"</string>
     <string name="accessibility_display_daltonizer_preference_title" msgid="1810693571332381974">"رنگ کی اصلاح"</string>
-    <!-- no translation found for accessibility_display_daltonizer_preference_subtitle (6178138727195403796) -->
-    <skip />
+    <string name="accessibility_display_daltonizer_preference_subtitle" msgid="6178138727195403796">"رنگ کی درستگی رنگ نہ دکھائی دینے والے لوگوں کی رنگوں کو مزید درست طریقے سے دیکھنے میں مدد کرتی ہے"</string>
     <string name="daltonizer_type_overridden" msgid="4509604753672535721">"<xliff:g id="TITLE">%1$s</xliff:g> کے ذریعہ منسوخ کردیا گیا"</string>
     <string name="power_remaining_settings_home_page" msgid="4885165789445462557">"<xliff:g id="PERCENTAGE">%1$s</xliff:g> - <xliff:g id="TIME_STRING">%2$s</xliff:g>"</string>
     <string name="power_remaining_duration_only" msgid="8264199158671531431">"تقریباً <xliff:g id="TIME_REMAINING">%1$s</xliff:g> باقی ہے"</string>
@@ -403,21 +431,19 @@
     <string name="power_remaining_less_than_duration" msgid="1812668275239801236">"<xliff:g id="THRESHOLD">%1$s</xliff:g> سے کم باقی ہے (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_more_than_subtext" msgid="7919119719242734848">"<xliff:g id="TIME_REMAINING">%1$s</xliff:g> سے زیادہ باقی ہے (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_only_more_than_subtext" msgid="3274496164769110480">"<xliff:g id="TIME_REMAINING">%1$s</xliff:g> سے زیادہ باقی ہے"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="6583866940347159957">"فون جلد ہی بند ہو سکتا ہے"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="8009177999719462724">"ٹیبلیٹ جلد ہی بند ہو سکتا ہے"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="8320892540455268018">"آلہ جلد ہی بند ہو سکتا ہے"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="6186572170809116621">"فون جلد ہی بند ہو سکتا ہے (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="1338758278145563121">"ٹیبلیٹ جلد ہی بند ہو سکتا ہے (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="3699579688084774362">"آلہ جلد ہی بند ہو سکتا ہے (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="137330009791560774">"فون جلد ہی بند ہو سکتا ہے"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="145489081521468132">"ٹیبلیٹ جلد ہی بند ہو سکتا ہے"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="1070562682853942350">"آلہ جلد ہی بند ہو سکتا ہے"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="4429259621177089719">"فون جلد ہی بند ہو سکتا ہے (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="7703677921000858479">"ٹیبلیٹ جلد ہی بند ہو سکتا ہے (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="4374784375644214578">"آلہ جلد ہی بند ہو سکتا ہے (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
     <string name="power_charging" msgid="6727132649743436802">"‎<xliff:g id="LEVEL">%1$s</xliff:g> - <xliff:g id="STATE">%2$s</xliff:g>‎"</string>
     <string name="power_remaining_charging_duration_only" msgid="7415639699283965818">"چارج ہونے میں <xliff:g id="TIME">%1$s</xliff:g> باقی"</string>
     <string name="power_charging_duration" msgid="5005740040558984057">"<xliff:g id="LEVEL">%1$s</xliff:g> - <xliff:g id="TIME">%2$s</xliff:g> چارج ہونے تک"</string>
     <string name="battery_info_status_unknown" msgid="268625384868401114">"نامعلوم"</string>
     <string name="battery_info_status_charging" msgid="4279958015430387405">"چارج ہو رہا ہے"</string>
-    <!-- no translation found for battery_info_status_charging_fast (8027559755902954885) -->
-    <skip />
-    <!-- no translation found for battery_info_status_charging_slow (3190803837168962319) -->
-    <skip />
+    <string name="battery_info_status_charging_fast" msgid="8027559755902954885">"تیزی سے چارج ہو رہا ہے"</string>
+    <string name="battery_info_status_charging_slow" msgid="3190803837168962319">"آہستہ چارج ہو رہا ہے"</string>
     <string name="battery_info_status_discharging" msgid="6962689305413556485">"چارج نہیں ہو رہا ہے"</string>
     <string name="battery_info_status_not_charging" msgid="8330015078868707899">"پلگ ان ہے، ابھی چارج نہیں کر سکتے"</string>
     <string name="battery_info_status_full" msgid="4443168946046847468">"مکمل"</string>
diff --git a/packages/SettingsLib/res/values-uz/strings.xml b/packages/SettingsLib/res/values-uz/strings.xml
index 07a6249..ee78795 100644
--- a/packages/SettingsLib/res/values-uz/strings.xml
+++ b/packages/SettingsLib/res/values-uz/strings.xml
@@ -206,6 +206,33 @@
     <string name="enable_adb" msgid="8072776357237289039">"USB orqali nosozliklarni aniqlash"</string>
     <string name="enable_adb_summary" msgid="3711526030096574316">"USB orqali kompyuterga ulanganda tuzatish rejimi yoqilsin"</string>
     <string name="clear_adb_keys" msgid="3010148733140369917">"USB orqali nosozliklarni tuzatishni taqiqlash"</string>
+    <string name="enable_adb_wireless" msgid="6973226350963971018">"Simsiz nosozliklarni aniqlash"</string>
+    <string name="enable_adb_wireless_summary" msgid="7344391423657093011">"Wi‑Fi tarmoqqa ulanganda nosozliklarni aniqlash rejimi"</string>
+    <string name="adb_wireless_error" msgid="721958772149779856">"Xato"</string>
+    <string name="adb_wireless_settings" msgid="2295017847215680229">"Simsiz nosozliklarni aniqlash"</string>
+    <string name="adb_wireless_list_empty_off" msgid="1713707973837255490">"Mavjud qurilmalarni koʻrish va ulardan foydalanish uchun simsiz nosozliklarni aniqlash funksiyasini yoqing"</string>
+    <string name="adb_pair_method_qrcode_title" msgid="6982904096137468634">"QR kod yordamida qurilmani ulang"</string>
+    <string name="adb_pair_method_qrcode_summary" msgid="3729901496856458634">"QR kod skaneri yordamida yangi qurilmalarni ulash mumkin"</string>
+    <string name="adb_pair_method_code_title" msgid="1122590300445142904">"Ulanish kodi yordamida qurilmani ulang"</string>
+    <string name="adb_pair_method_code_summary" msgid="6370414511333685185">"Olti xonali kod yordamida yangi qurilmalarni ulash mumkin"</string>
+    <string name="adb_paired_devices_title" msgid="5268997341526217362">"Ulangan qurilmalar"</string>
+    <string name="adb_wireless_device_connected_summary" msgid="3039660790249148713">"Hozirda ulangan"</string>
+    <string name="adb_wireless_device_details_title" msgid="7129369670526565786">"Qurilma tafsilotlari"</string>
+    <string name="adb_device_forget" msgid="193072400783068417">"Olib tashlash"</string>
+    <string name="adb_device_fingerprint_title_format" msgid="291504822917843701">"Qurilmadagi barmoq izi: <xliff:g id="FINGERPRINT_PARAM">%1$s</xliff:g>"</string>
+    <string name="adb_wireless_connection_failed_title" msgid="664211177427438438">"Ulanmadi"</string>
+    <string name="adb_wireless_connection_failed_message" msgid="9213896700171602073">"<xliff:g id="DEVICE_NAME">%1$s</xliff:g> kerakli tarmoqqa ulanganini tekshiring"</string>
+    <string name="adb_pairing_device_dialog_title" msgid="7141739231018530210">"Qurilma bilan ulanish"</string>
+    <string name="adb_pairing_device_dialog_pairing_code_label" msgid="3639239786669722731">"Wi‑Fi ulanish kodi"</string>
+    <string name="adb_pairing_device_dialog_failed_title" msgid="3426758947882091735">"Ulanmadi"</string>
+    <string name="adb_pairing_device_dialog_failed_msg" msgid="6611097519661997148">"Qurilma bir xil tarmoqqa ulanganini tekshiring."</string>
+    <string name="adb_wireless_qrcode_summary" msgid="8051414549011801917">"QR kodni skanerlab, Wi-Fi orqali qurilmani ulang"</string>
+    <string name="adb_wireless_verifying_qrcode_text" msgid="6123192424916029207">"Qurilma ulanmoqda…"</string>
+    <string name="adb_qrcode_pairing_device_failed_msg" msgid="6936292092592914132">"Qurilma ulanmadi. QR kod xato yoki qurilma bir xil tarmoqqa ulanmagan."</string>
+    <string name="adb_wireless_ip_addr_preference_title" msgid="8335132107715311730">"IP manzil va port"</string>
+    <string name="adb_wireless_qrcode_pairing_title" msgid="1906409667944674707">"QR kodni skanerlash"</string>
+    <string name="adb_wireless_qrcode_pairing_description" msgid="8578868049289910131">"QR kodni skanerlab, Wi-Fi orqali qurilmani ulang"</string>
+    <string name="keywords_adb_wireless" msgid="6507505581882171240">"adb, debag, dev"</string>
     <string name="bugreport_in_power" msgid="8664089072534638709">"Xatoliklar hisoboti"</string>
     <string name="bugreport_in_power_summary" msgid="1885529649381831775">"Menyuda xatoliklar hisobotini yuborish tugmasi ko‘rsatilsin"</string>
     <string name="keep_screen_on" msgid="1187161672348797558">"Ekranning yoniq turishi"</string>
@@ -271,6 +298,8 @@
     <string name="tethering_hardware_offload_summary" msgid="7801345335142803029">"Modem rejimida apparatli tezlashtirishdan foydalanish (agar mavjud bo‘lsa)"</string>
     <string name="adb_warning_title" msgid="7708653449506485728">"USB orqali nosozliklarni tuzatishga ruxsat berilsinmi?"</string>
     <string name="adb_warning_message" msgid="8145270656419669221">"USB orqali nosozliklarni aniqlash faqat dasturlash maqsadlarida yoqiladi. Undan maʼlumotlarni qurilmangiz va kompyuter o‘rtasida ko‘chirish, ilovalarni xabarnomasiz o‘rnatish va jurnal maʼlumotlarini o‘qish uchun foydalaniladi."</string>
+    <string name="adbwifi_warning_title" msgid="727104571653031865">"Simsiz nosozliklarni aniqlashga ruxsat berilsinmi?"</string>
+    <string name="adbwifi_warning_message" msgid="8005936574322702388">"Simsiz nosozliklarni aniqlash faqat dasturlash maqsadlarida yoqiladi. Undan maʼlumotlarni qurilmangiz va kompyuter oʻrtasida koʻchirish, ilovalarni bildirishnomasiz oʻrnatish va jurnal maʼlumotlarini oʻqish uchun foydalaniladi."</string>
     <string name="adb_keys_warning_message" msgid="2968555274488101220">"USB orqali nosozliklarni tuzatishga berilgan ruxsat siz hisobingizga kirgan barcha kompyuterlar uchun bekor qilinsinmi?"</string>
     <string name="dev_settings_warning_title" msgid="8251234890169074553">"Dasturlash sozlamalariga ruxsat berilsinmi?"</string>
     <string name="dev_settings_warning_message" msgid="37741686486073668">"Bu sozlamalar faqat dasturlash maqsadlariga mo‘ljallangan. Shuning uchun, ular qurilmangizga va undagi ilovalariga shikast yetkazib, noto‘g‘ri ishlashiga sabab bo‘lishi mumkin."</string>
@@ -383,8 +412,7 @@
     <string name="daltonizer_mode_protanomaly" msgid="7805583306666608440">"Protanomaliya (qizil/yashil)"</string>
     <string name="daltonizer_mode_tritanomaly" msgid="7135266249220732267">"Tritanomaliya (ko‘k/sariq)"</string>
     <string name="accessibility_display_daltonizer_preference_title" msgid="1810693571332381974">"Rangni tuzatish"</string>
-    <!-- no translation found for accessibility_display_daltonizer_preference_subtitle (6178138727195403796) -->
-    <skip />
+    <string name="accessibility_display_daltonizer_preference_subtitle" msgid="6178138727195403796">"Ranglarni sozlash ranglarni farqlashda muammosi bor insonlarga (masalan, daltoniklarga) aniq koʻrishda yordam beradi"</string>
     <string name="daltonizer_type_overridden" msgid="4509604753672535721">"<xliff:g id="TITLE">%1$s</xliff:g> bilan almashtirildi"</string>
     <string name="power_remaining_settings_home_page" msgid="4885165789445462557">"<xliff:g id="PERCENTAGE">%1$s</xliff:g> – <xliff:g id="TIME_STRING">%2$s</xliff:g>"</string>
     <string name="power_remaining_duration_only" msgid="8264199158671531431">"Taxminan <xliff:g id="TIME_REMAINING">%1$s</xliff:g> qoldi"</string>
@@ -403,21 +431,19 @@
     <string name="power_remaining_less_than_duration" msgid="1812668275239801236">"<xliff:g id="THRESHOLD">%1$s</xliff:g>dan kamroq vaqt qoldi (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_more_than_subtext" msgid="7919119719242734848">"<xliff:g id="TIME_REMAINING">%1$s</xliff:g>dan ko‘proq vaqt qoldi (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_only_more_than_subtext" msgid="3274496164769110480">"<xliff:g id="TIME_REMAINING">%1$s</xliff:g>dan ko‘proq vaqt qoldi"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="6583866940347159957">"Telefon tez orada o‘chib qolishi mumkin"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="8009177999719462724">"Planshet tez orada o‘chib qolishi mumkin"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="8320892540455268018">"Qurilma tez orada o‘chib qolishi mumkin"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="6186572170809116621">"Telefon tez orada o‘chib qolishi mumkin (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="1338758278145563121">"Planshet tez orada o‘chib qolishi mumkin (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="3699579688084774362">"Qurilma tez orada o‘chib qolishi mumkin (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="137330009791560774">"Telefon tez orada oʻchib qolishi mumkin"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="145489081521468132">"Planshet tez orada oʻchib qolishi mumkin"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="1070562682853942350">"Qurilma tez orada oʻchib qolishi mumkin"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="4429259621177089719">"Telefon tez orada oʻchib qolishi mumkin (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="7703677921000858479">"Planshet tez orada oʻchib qolishi mumkin (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="4374784375644214578">"Qurilma tez orada oʻchib qolishi mumkin (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
     <string name="power_charging" msgid="6727132649743436802">"<xliff:g id="LEVEL">%1$s</xliff:g> – <xliff:g id="STATE">%2$s</xliff:g>"</string>
     <string name="power_remaining_charging_duration_only" msgid="7415639699283965818">"<xliff:g id="TIME">%1$s</xliff:g> ichida toʻliq quvvat oladi"</string>
     <string name="power_charging_duration" msgid="5005740040558984057">"<xliff:g id="LEVEL">%1$s</xliff:g> – <xliff:g id="TIME">%2$s</xliff:g> ichida toʻliq quvvat oladi"</string>
     <string name="battery_info_status_unknown" msgid="268625384868401114">"Noma’lum"</string>
     <string name="battery_info_status_charging" msgid="4279958015430387405">"Quvvat olmoqda"</string>
-    <!-- no translation found for battery_info_status_charging_fast (8027559755902954885) -->
-    <skip />
-    <!-- no translation found for battery_info_status_charging_slow (3190803837168962319) -->
-    <skip />
+    <string name="battery_info_status_charging_fast" msgid="8027559755902954885">"Tezkor quvvat olmoqda"</string>
+    <string name="battery_info_status_charging_slow" msgid="3190803837168962319">"Sekin quvvat olmoqda"</string>
     <string name="battery_info_status_discharging" msgid="6962689305413556485">"Quvvat olmayapti"</string>
     <string name="battery_info_status_not_charging" msgid="8330015078868707899">"Ulangan, lekin quvvat olmayapti"</string>
     <string name="battery_info_status_full" msgid="4443168946046847468">"To‘la"</string>
diff --git a/packages/SettingsLib/res/values-vi/strings.xml b/packages/SettingsLib/res/values-vi/strings.xml
index 7e3944c..6d76962 100644
--- a/packages/SettingsLib/res/values-vi/strings.xml
+++ b/packages/SettingsLib/res/values-vi/strings.xml
@@ -206,6 +206,33 @@
     <string name="enable_adb" msgid="8072776357237289039">"Gỡ lỗi qua USB"</string>
     <string name="enable_adb_summary" msgid="3711526030096574316">"Bật chế độ gỡ lỗi khi kết nối USB"</string>
     <string name="clear_adb_keys" msgid="3010148733140369917">"Thu hồi ủy quyền gỡ lỗi USB"</string>
+    <string name="enable_adb_wireless" msgid="6973226350963971018">"Gỡ lỗi không dây"</string>
+    <string name="enable_adb_wireless_summary" msgid="7344391423657093011">"Chế độ gỡ lỗi khi có kết nối Wi-Fi"</string>
+    <string name="adb_wireless_error" msgid="721958772149779856">"Lỗi"</string>
+    <string name="adb_wireless_settings" msgid="2295017847215680229">"Gỡ lỗi không dây"</string>
+    <string name="adb_wireless_list_empty_off" msgid="1713707973837255490">"Để xem và sử dụng các thiết bị có sẵn, hãy bật tính năng gỡ lỗi không dây"</string>
+    <string name="adb_pair_method_qrcode_title" msgid="6982904096137468634">"Ghép nối thiết bị bằng mã QR"</string>
+    <string name="adb_pair_method_qrcode_summary" msgid="3729901496856458634">"Ghép nối các thiết bị mới bằng Trình quét mã QR"</string>
+    <string name="adb_pair_method_code_title" msgid="1122590300445142904">"Ghép nối thiết bị bằng mã ghép nối"</string>
+    <string name="adb_pair_method_code_summary" msgid="6370414511333685185">"Ghép nối các thiết bị mới bằng mã gồm 6 chữ số"</string>
+    <string name="adb_paired_devices_title" msgid="5268997341526217362">"Thiết bị được ghép nối"</string>
+    <string name="adb_wireless_device_connected_summary" msgid="3039660790249148713">"Hiện đang kết nối"</string>
+    <string name="adb_wireless_device_details_title" msgid="7129369670526565786">"Thông tin chi tiết về thiết bị"</string>
+    <string name="adb_device_forget" msgid="193072400783068417">"Xóa"</string>
+    <string name="adb_device_fingerprint_title_format" msgid="291504822917843701">"Vân tay trên thiết bị: <xliff:g id="FINGERPRINT_PARAM">%1$s</xliff:g>"</string>
+    <string name="adb_wireless_connection_failed_title" msgid="664211177427438438">"Kết nối không thành công"</string>
+    <string name="adb_wireless_connection_failed_message" msgid="9213896700171602073">"Đảm bảo bạn kết nối <xliff:g id="DEVICE_NAME">%1$s</xliff:g> với đúng mạng"</string>
+    <string name="adb_pairing_device_dialog_title" msgid="7141739231018530210">"Ghép nối với thiết bị"</string>
+    <string name="adb_pairing_device_dialog_pairing_code_label" msgid="3639239786669722731">"Mã ghép nối Wi-Fi"</string>
+    <string name="adb_pairing_device_dialog_failed_title" msgid="3426758947882091735">"Ghép nối không thành công"</string>
+    <string name="adb_pairing_device_dialog_failed_msg" msgid="6611097519661997148">"Đảm bảo bạn kết nối thiết bị với cùng một mạng."</string>
+    <string name="adb_wireless_qrcode_summary" msgid="8051414549011801917">"Ghép nối thiết bị qua Wi-Fi bằng cách quét mã QR"</string>
+    <string name="adb_wireless_verifying_qrcode_text" msgid="6123192424916029207">"Đang ghép nối thiết bị…"</string>
+    <string name="adb_qrcode_pairing_device_failed_msg" msgid="6936292092592914132">"Không ghép nối được thiết bị. Mã QR không chính xác hoặc bạn không kết nối thiết bị với cùng một mạng."</string>
+    <string name="adb_wireless_ip_addr_preference_title" msgid="8335132107715311730">"Địa chỉ IP và cổng"</string>
+    <string name="adb_wireless_qrcode_pairing_title" msgid="1906409667944674707">"Quét mã QR"</string>
+    <string name="adb_wireless_qrcode_pairing_description" msgid="8578868049289910131">"Ghép nối thiết bị qua Wi-Fi bằng cách quét mã QR"</string>
+    <string name="keywords_adb_wireless" msgid="6507505581882171240">"adb, gỡ lỗi, nhà phát triển"</string>
     <string name="bugreport_in_power" msgid="8664089072534638709">"Phím tắt báo cáo lỗi"</string>
     <string name="bugreport_in_power_summary" msgid="1885529649381831775">"Hiển thị một nút trong menu nguồn để báo cáo lỗi"</string>
     <string name="keep_screen_on" msgid="1187161672348797558">"Không khóa màn hình"</string>
@@ -271,6 +298,8 @@
     <string name="tethering_hardware_offload_summary" msgid="7801345335142803029">"Sử dụng tính năng tăng tốc phần cứng khi chia sẻ kết nối nếu có"</string>
     <string name="adb_warning_title" msgid="7708653449506485728">"Cho phép gỡ lỗi qua USB?"</string>
     <string name="adb_warning_message" msgid="8145270656419669221">"Gỡ lỗi USB chỉ dành cho mục đích phát triển. Hãy sử dụng tính năng này để sao chép dữ liệu giữa máy tính và thiết bị của bạn, cài đặt ứng dụng trên thiết bị của bạn mà không thông báo và đọc dữ liệu nhật ký."</string>
+    <string name="adbwifi_warning_title" msgid="727104571653031865">"Bật tính năng gỡ lỗi không dây?"</string>
+    <string name="adbwifi_warning_message" msgid="8005936574322702388">"Tính năng gỡ lỗi không dây chỉ dành cho mục đích phát triển. Hãy sử dụng tính năng này để sao chép dữ liệu giữa máy tính và thiết bị của bạn, cài đặt ứng dụng trên thiết bị mà không thông báo và đọc dữ liệu nhật ký."</string>
     <string name="adb_keys_warning_message" msgid="2968555274488101220">"Thu hồi quyền truy cập gỡ lỗi USB từ tất cả máy tính mà bạn đã ủy quyền trước đó?"</string>
     <string name="dev_settings_warning_title" msgid="8251234890169074553">"Cho phép cài đặt phát triển?"</string>
     <string name="dev_settings_warning_message" msgid="37741686486073668">"Những cài đặt này chỉ dành cho mục đích phát triển. Chúng có thể làm cho thiết bị và ứng dụng trên thiết bị của bạn bị lỗi và hoạt động sai."</string>
@@ -383,8 +412,7 @@
     <string name="daltonizer_mode_protanomaly" msgid="7805583306666608440">"Mù màu đỏ không hoàn toàn (đỏ-xanh lục)"</string>
     <string name="daltonizer_mode_tritanomaly" msgid="7135266249220732267">"Mù màu (xanh lam-vàng)"</string>
     <string name="accessibility_display_daltonizer_preference_title" msgid="1810693571332381974">"Sửa màu"</string>
-    <!-- no translation found for accessibility_display_daltonizer_preference_subtitle (6178138727195403796) -->
-    <skip />
+    <string name="accessibility_display_daltonizer_preference_subtitle" msgid="6178138727195403796">"Tính năng hiệu chỉnh màu sắc giúp những người bị mù màu thấy màu sắc chính xác hơn"</string>
     <string name="daltonizer_type_overridden" msgid="4509604753672535721">"Bị ghi đè bởi <xliff:g id="TITLE">%1$s</xliff:g>"</string>
     <string name="power_remaining_settings_home_page" msgid="4885165789445462557">"<xliff:g id="PERCENTAGE">%1$s</xliff:g> - <xliff:g id="TIME_STRING">%2$s</xliff:g>"</string>
     <string name="power_remaining_duration_only" msgid="8264199158671531431">"Còn khoảng <xliff:g id="TIME_REMAINING">%1$s</xliff:g>"</string>
@@ -403,21 +431,19 @@
     <string name="power_remaining_less_than_duration" msgid="1812668275239801236">"Còn lại không đến <xliff:g id="THRESHOLD">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_more_than_subtext" msgid="7919119719242734848">"Còn lại hơn <xliff:g id="TIME_REMAINING">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_only_more_than_subtext" msgid="3274496164769110480">"Còn lại hơn <xliff:g id="TIME_REMAINING">%1$s</xliff:g>"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="6583866940347159957">"Điện thoại có thể sắp tắt"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="8009177999719462724">"Máy tính bảng có thể sắp tắt"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="8320892540455268018">"Thiết bị có thể sắp tắt"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="6186572170809116621">"Điện thoại có thể sắp tắt (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="1338758278145563121">"Máy tính bảng có thể sắp tắt (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="3699579688084774362">"Thiết bị có thể sắp tắt (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="137330009791560774">"Điện thoại có thể sắp tắt"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="145489081521468132">"Máy tính bảng có thể sắp tắt"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="1070562682853942350">"Thiết bị có thể sắp tắt"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="4429259621177089719">"Điện thoại có thể sắp tắt (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="7703677921000858479">"Máy tính bảng có thể sắp tắt (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="4374784375644214578">"Thiết bị có thể sắp tắt (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
     <string name="power_charging" msgid="6727132649743436802">"<xliff:g id="LEVEL">%1$s</xliff:g> - <xliff:g id="STATE">%2$s</xliff:g>"</string>
     <string name="power_remaining_charging_duration_only" msgid="7415639699283965818">"Còn <xliff:g id="TIME">%1$s</xliff:g> nữa là sạc xong"</string>
     <string name="power_charging_duration" msgid="5005740040558984057">"<xliff:g id="LEVEL">%1$s</xliff:g> – <xliff:g id="TIME">%2$s</xliff:g> nữa là sạc xong"</string>
     <string name="battery_info_status_unknown" msgid="268625384868401114">"Không xác định"</string>
     <string name="battery_info_status_charging" msgid="4279958015430387405">"Đang sạc"</string>
-    <!-- no translation found for battery_info_status_charging_fast (8027559755902954885) -->
-    <skip />
-    <!-- no translation found for battery_info_status_charging_slow (3190803837168962319) -->
-    <skip />
+    <string name="battery_info_status_charging_fast" msgid="8027559755902954885">"Đang sạc nhanh"</string>
+    <string name="battery_info_status_charging_slow" msgid="3190803837168962319">"Đang sạc chậm"</string>
     <string name="battery_info_status_discharging" msgid="6962689305413556485">"Hiện không sạc"</string>
     <string name="battery_info_status_not_charging" msgid="8330015078868707899">"Đã cắm nhưng không thể sạc ngay"</string>
     <string name="battery_info_status_full" msgid="4443168946046847468">"Đầy"</string>
diff --git a/packages/SettingsLib/res/values-zh-rCN/strings.xml b/packages/SettingsLib/res/values-zh-rCN/strings.xml
index 3edbb4d..fbb30ca 100644
--- a/packages/SettingsLib/res/values-zh-rCN/strings.xml
+++ b/packages/SettingsLib/res/values-zh-rCN/strings.xml
@@ -206,6 +206,33 @@
     <string name="enable_adb" msgid="8072776357237289039">"USB 调试"</string>
     <string name="enable_adb_summary" msgid="3711526030096574316">"连接 USB 后启用调试模式"</string>
     <string name="clear_adb_keys" msgid="3010148733140369917">"撤消 USB 调试授权"</string>
+    <string name="enable_adb_wireless" msgid="6973226350963971018">"无线调试"</string>
+    <string name="enable_adb_wireless_summary" msgid="7344391423657093011">"连接到 WLAN 后启用调试模式"</string>
+    <string name="adb_wireless_error" msgid="721958772149779856">"错误"</string>
+    <string name="adb_wireless_settings" msgid="2295017847215680229">"无线调试"</string>
+    <string name="adb_wireless_list_empty_off" msgid="1713707973837255490">"要查看和使用可用的设备,请开启无线调试"</string>
+    <string name="adb_pair_method_qrcode_title" msgid="6982904096137468634">"使用二维码配对设备"</string>
+    <string name="adb_pair_method_qrcode_summary" msgid="3729901496856458634">"使用二维码扫描器配对新设备"</string>
+    <string name="adb_pair_method_code_title" msgid="1122590300445142904">"使用配对码配对设备"</string>
+    <string name="adb_pair_method_code_summary" msgid="6370414511333685185">"使用六位数验证码配对新设备"</string>
+    <string name="adb_paired_devices_title" msgid="5268997341526217362">"已配对的设备"</string>
+    <string name="adb_wireless_device_connected_summary" msgid="3039660790249148713">"当前已连接"</string>
+    <string name="adb_wireless_device_details_title" msgid="7129369670526565786">"设备详细信息"</string>
+    <string name="adb_device_forget" msgid="193072400783068417">"取消保存"</string>
+    <string name="adb_device_fingerprint_title_format" msgid="291504822917843701">"设备指纹:<xliff:g id="FINGERPRINT_PARAM">%1$s</xliff:g>"</string>
+    <string name="adb_wireless_connection_failed_title" msgid="664211177427438438">"连接失败"</string>
+    <string name="adb_wireless_connection_failed_message" msgid="9213896700171602073">"确保<xliff:g id="DEVICE_NAME">%1$s</xliff:g>已连接到正确的网络"</string>
+    <string name="adb_pairing_device_dialog_title" msgid="7141739231018530210">"与设备配对"</string>
+    <string name="adb_pairing_device_dialog_pairing_code_label" msgid="3639239786669722731">"WLAN 配对码"</string>
+    <string name="adb_pairing_device_dialog_failed_title" msgid="3426758947882091735">"配对失败"</string>
+    <string name="adb_pairing_device_dialog_failed_msg" msgid="6611097519661997148">"确保设备已连接到同一网络。"</string>
+    <string name="adb_wireless_qrcode_summary" msgid="8051414549011801917">"扫描二维码即可通过 WLAN 配对设备"</string>
+    <string name="adb_wireless_verifying_qrcode_text" msgid="6123192424916029207">"正在配对设备…"</string>
+    <string name="adb_qrcode_pairing_device_failed_msg" msgid="6936292092592914132">"无法配对设备。可能是因为二维码不正确,或者设备未连接到同一网络。"</string>
+    <string name="adb_wireless_ip_addr_preference_title" msgid="8335132107715311730">"IP 地址和端口"</string>
+    <string name="adb_wireless_qrcode_pairing_title" msgid="1906409667944674707">"扫描二维码"</string>
+    <string name="adb_wireless_qrcode_pairing_description" msgid="8578868049289910131">"扫描二维码即可通过 WLAN 配对设备"</string>
+    <string name="keywords_adb_wireless" msgid="6507505581882171240">"adb, 调试, debug, 开发, dev"</string>
     <string name="bugreport_in_power" msgid="8664089072534638709">"错误报告快捷方式"</string>
     <string name="bugreport_in_power_summary" msgid="1885529649381831775">"在电源菜单中显示用于提交错误报告的按钮"</string>
     <string name="keep_screen_on" msgid="1187161672348797558">"不锁定屏幕"</string>
@@ -271,6 +298,8 @@
     <string name="tethering_hardware_offload_summary" msgid="7801345335142803029">"使用网络共享硬件加速功能(如果可用)"</string>
     <string name="adb_warning_title" msgid="7708653449506485728">"是否允许 USB 调试?"</string>
     <string name="adb_warning_message" msgid="8145270656419669221">"USB 调试仅用于开发目的。该功能可用于在您的计算机和设备之间复制数据、在您的设备上安装应用(事先不发通知)以及读取日志数据。"</string>
+    <string name="adbwifi_warning_title" msgid="727104571653031865">"要允许无线调试吗?"</string>
+    <string name="adbwifi_warning_message" msgid="8005936574322702388">"无线调试仅用于开发目的。该功能可用于在您的计算机和设备之间复制数据、在您的设备上安装应用(事先不发通知)以及读取日志数据。"</string>
     <string name="adb_keys_warning_message" msgid="2968555274488101220">"是否针对您之前授权的所有计算机撤消 USB 调试的访问权限?"</string>
     <string name="dev_settings_warning_title" msgid="8251234890169074553">"允许开发设置?"</string>
     <string name="dev_settings_warning_message" msgid="37741686486073668">"这些设置仅适用于开发工作。一旦启用,会导致您的设备以及设备上的应用崩溃或出现异常。"</string>
@@ -383,8 +412,7 @@
     <string name="daltonizer_mode_protanomaly" msgid="7805583306666608440">"红色弱视(红绿不分)"</string>
     <string name="daltonizer_mode_tritanomaly" msgid="7135266249220732267">"蓝色弱视(蓝黄不分)"</string>
     <string name="accessibility_display_daltonizer_preference_title" msgid="1810693571332381974">"色彩校正"</string>
-    <!-- no translation found for accessibility_display_daltonizer_preference_subtitle (6178138727195403796) -->
-    <skip />
+    <string name="accessibility_display_daltonizer_preference_subtitle" msgid="6178138727195403796">"颜色校正功能有助于色盲用户看到更准确的颜色"</string>
     <string name="daltonizer_type_overridden" msgid="4509604753672535721">"已被“<xliff:g id="TITLE">%1$s</xliff:g>”覆盖"</string>
     <string name="power_remaining_settings_home_page" msgid="4885165789445462557">"<xliff:g id="PERCENTAGE">%1$s</xliff:g> - <xliff:g id="TIME_STRING">%2$s</xliff:g>"</string>
     <string name="power_remaining_duration_only" msgid="8264199158671531431">"大约还可使用 <xliff:g id="TIME_REMAINING">%1$s</xliff:g>"</string>
@@ -403,21 +431,19 @@
     <string name="power_remaining_less_than_duration" msgid="1812668275239801236">"电量剩余使用时间不到 <xliff:g id="THRESHOLD">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_more_than_subtext" msgid="7919119719242734848">"电量剩余使用时间超过 <xliff:g id="TIME_REMAINING">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_only_more_than_subtext" msgid="3274496164769110480">"电量剩余使用时间超过 <xliff:g id="TIME_REMAINING">%1$s</xliff:g>"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="6583866940347159957">"手机可能即将关机"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="8009177999719462724">"平板电脑可能即将关机"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="8320892540455268018">"设备可能即将关机"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="6186572170809116621">"手机可能即将关机 (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="1338758278145563121">"平板电脑可能即将关机 (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="3699579688084774362">"设备可能即将关机 (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="137330009791560774">"手机可能即将关机"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="145489081521468132">"平板电脑可能即将关机"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="1070562682853942350">"设备可能即将关机"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="4429259621177089719">"手机可能即将关机 (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="7703677921000858479">"平板电脑可能即将关机 (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="4374784375644214578">"设备可能即将关机 (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
     <string name="power_charging" msgid="6727132649743436802">"<xliff:g id="LEVEL">%1$s</xliff:g> - <xliff:g id="STATE">%2$s</xliff:g>"</string>
     <string name="power_remaining_charging_duration_only" msgid="7415639699283965818">"还剩 <xliff:g id="TIME">%1$s</xliff:g>充满电"</string>
     <string name="power_charging_duration" msgid="5005740040558984057">"<xliff:g id="LEVEL">%1$s</xliff:g> - <xliff:g id="TIME">%2$s</xliff:g>后充满电"</string>
     <string name="battery_info_status_unknown" msgid="268625384868401114">"未知"</string>
     <string name="battery_info_status_charging" msgid="4279958015430387405">"正在充电"</string>
-    <!-- no translation found for battery_info_status_charging_fast (8027559755902954885) -->
-    <skip />
-    <!-- no translation found for battery_info_status_charging_slow (3190803837168962319) -->
-    <skip />
+    <string name="battery_info_status_charging_fast" msgid="8027559755902954885">"正在快速充电"</string>
+    <string name="battery_info_status_charging_slow" msgid="3190803837168962319">"正在慢速充电"</string>
     <string name="battery_info_status_discharging" msgid="6962689305413556485">"未在充电"</string>
     <string name="battery_info_status_not_charging" msgid="8330015078868707899">"已插入电源,但是现在无法充电"</string>
     <string name="battery_info_status_full" msgid="4443168946046847468">"电量充足"</string>
diff --git a/packages/SettingsLib/res/values-zh-rHK/strings.xml b/packages/SettingsLib/res/values-zh-rHK/strings.xml
index 6174fe9..0b4ee7a 100644
--- a/packages/SettingsLib/res/values-zh-rHK/strings.xml
+++ b/packages/SettingsLib/res/values-zh-rHK/strings.xml
@@ -206,6 +206,33 @@
     <string name="enable_adb" msgid="8072776357237289039">"USB 偵錯"</string>
     <string name="enable_adb_summary" msgid="3711526030096574316">"連接 USB 時進入偵錯模式"</string>
     <string name="clear_adb_keys" msgid="3010148733140369917">"撤銷 USB 偵錯授權"</string>
+    <string name="enable_adb_wireless" msgid="6973226350963971018">"無線偵錯"</string>
+    <string name="enable_adb_wireless_summary" msgid="7344391423657093011">"連線至 Wi-Fi 時啟用偵錯模式"</string>
+    <string name="adb_wireless_error" msgid="721958772149779856">"錯誤"</string>
+    <string name="adb_wireless_settings" msgid="2295017847215680229">"無線偵錯"</string>
+    <string name="adb_wireless_list_empty_off" msgid="1713707973837255490">"如要查看並使用可用的裝置,請開啟無線偵錯"</string>
+    <string name="adb_pair_method_qrcode_title" msgid="6982904096137468634">"使用二維條碼配對裝置"</string>
+    <string name="adb_pair_method_qrcode_summary" msgid="3729901496856458634">"使用二維條碼掃瞄器配對新裝置"</string>
+    <string name="adb_pair_method_code_title" msgid="1122590300445142904">"使用配對碼配對裝置"</string>
+    <string name="adb_pair_method_code_summary" msgid="6370414511333685185">"使用六位數的配對碼配對新裝置"</string>
+    <string name="adb_paired_devices_title" msgid="5268997341526217362">"已配對的裝置"</string>
+    <string name="adb_wireless_device_connected_summary" msgid="3039660790249148713">"目前已連接的裝置"</string>
+    <string name="adb_wireless_device_details_title" msgid="7129369670526565786">"裝置詳情"</string>
+    <string name="adb_device_forget" msgid="193072400783068417">"移除裝置"</string>
+    <string name="adb_device_fingerprint_title_format" msgid="291504822917843701">"裝置指紋:<xliff:g id="FINGERPRINT_PARAM">%1$s</xliff:g>"</string>
+    <string name="adb_wireless_connection_failed_title" msgid="664211177427438438">"連線失敗"</string>
+    <string name="adb_wireless_connection_failed_message" msgid="9213896700171602073">"請確認<xliff:g id="DEVICE_NAME">%1$s</xliff:g> 已連線至相同的網絡。"</string>
+    <string name="adb_pairing_device_dialog_title" msgid="7141739231018530210">"與裝置配對"</string>
+    <string name="adb_pairing_device_dialog_pairing_code_label" msgid="3639239786669722731">"Wi-Fi 配對碼"</string>
+    <string name="adb_pairing_device_dialog_failed_title" msgid="3426758947882091735">"配對失敗"</string>
+    <string name="adb_pairing_device_dialog_failed_msg" msgid="6611097519661997148">"請確認裝置已連線至相同的網絡。"</string>
+    <string name="adb_wireless_qrcode_summary" msgid="8051414549011801917">"掃瞄二維條碼即可透過 Wi-Fi 配對裝置"</string>
+    <string name="adb_wireless_verifying_qrcode_text" msgid="6123192424916029207">"正在配對裝置…"</string>
+    <string name="adb_qrcode_pairing_device_failed_msg" msgid="6936292092592914132">"無法配對裝置,可能是二維條碼錯誤,或裝置未連線至相同的網絡。"</string>
+    <string name="adb_wireless_ip_addr_preference_title" msgid="8335132107715311730">"IP 位址和連接埠"</string>
+    <string name="adb_wireless_qrcode_pairing_title" msgid="1906409667944674707">"掃瞄二維條碼"</string>
+    <string name="adb_wireless_qrcode_pairing_description" msgid="8578868049289910131">"掃瞄二維條碼即可透過 Wi-Fi 配對裝置"</string>
+    <string name="keywords_adb_wireless" msgid="6507505581882171240">"ADB, 偵錯, 開發"</string>
     <string name="bugreport_in_power" msgid="8664089072534638709">"錯誤舉報捷徑"</string>
     <string name="bugreport_in_power_summary" msgid="1885529649381831775">"在電源選單中顯示提交錯誤舉報的按鈕"</string>
     <string name="keep_screen_on" msgid="1187161672348797558">"保持啟用"</string>
@@ -271,6 +298,8 @@
     <string name="tethering_hardware_offload_summary" msgid="7801345335142803029">"使用網絡共享硬件加速功能 (如果可用)"</string>
     <string name="adb_warning_title" msgid="7708653449506485728">"允許 USB 偵錯嗎?"</string>
     <string name="adb_warning_message" msgid="8145270656419669221">"USB 偵錯是針對應用程式開發而設計的功能,可讓您在電腦與裝置間複製資料、不用通知即可在裝置上安裝應用程式,以及讀取記錄資料。"</string>
+    <string name="adbwifi_warning_title" msgid="727104571653031865">"要啟用無線偵錯嗎?"</string>
+    <string name="adbwifi_warning_message" msgid="8005936574322702388">"無線偵錯僅適用於開發用途,可讓您在電腦和裝置之間複製資料、為裝置安裝應用程式而不提出通知,以及讀取記錄資料。"</string>
     <string name="adb_keys_warning_message" msgid="2968555274488101220">"要針對先前授權的所有電腦撤銷 USB 偵錯存取權嗎?"</string>
     <string name="dev_settings_warning_title" msgid="8251234890169074553">"允許開發設定?"</string>
     <string name="dev_settings_warning_message" msgid="37741686486073668">"這些設定僅供開發用途,可能會導致您的裝置及應用程式損毀或運作不正常。"</string>
@@ -383,8 +412,7 @@
     <string name="daltonizer_mode_protanomaly" msgid="7805583306666608440">"紅色弱視 (紅綠)"</string>
     <string name="daltonizer_mode_tritanomaly" msgid="7135266249220732267">"藍色弱視 (藍黃)"</string>
     <string name="accessibility_display_daltonizer_preference_title" msgid="1810693571332381974">"色彩校正"</string>
-    <!-- no translation found for accessibility_display_daltonizer_preference_subtitle (6178138727195403796) -->
-    <skip />
+    <string name="accessibility_display_daltonizer_preference_subtitle" msgid="6178138727195403796">"色彩校正可以協助色盲人士睇到更加準確嘅顏色"</string>
     <string name="daltonizer_type_overridden" msgid="4509604753672535721">"已由「<xliff:g id="TITLE">%1$s</xliff:g>」覆寫"</string>
     <string name="power_remaining_settings_home_page" msgid="4885165789445462557">"<xliff:g id="PERCENTAGE">%1$s</xliff:g> - <xliff:g id="TIME_STRING">%2$s</xliff:g>"</string>
     <string name="power_remaining_duration_only" msgid="8264199158671531431">"還有大約 <xliff:g id="TIME_REMAINING">%1$s</xliff:g>"</string>
@@ -403,21 +431,19 @@
     <string name="power_remaining_less_than_duration" msgid="1812668275239801236">"還有少於 <xliff:g id="THRESHOLD">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_more_than_subtext" msgid="7919119719242734848">"還有超過 <xliff:g id="TIME_REMAINING">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_only_more_than_subtext" msgid="3274496164769110480">"還有超過 <xliff:g id="TIME_REMAINING">%1$s</xliff:g>"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="6583866940347159957">"手機可能即將關機"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="8009177999719462724">"平板電腦可能即將關機"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="8320892540455268018">"裝置可能即將關機"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="6186572170809116621">"手機可能即將關機 (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="1338758278145563121">"平板電腦可能即將關機 (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="3699579688084774362">"裝置可能即將關機 (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="137330009791560774">"手機可能即將關閉"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="145489081521468132">"平板電腦可能即將關機"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="1070562682853942350">"裝置可能即將關機"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="4429259621177089719">"手機可能即將關機 (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="7703677921000858479">"平板電腦可能即將關機 (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="4374784375644214578">"裝置可能即將關機 (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
     <string name="power_charging" msgid="6727132649743436802">"<xliff:g id="LEVEL">%1$s</xliff:g> - <xliff:g id="STATE">%2$s</xliff:g>"</string>
     <string name="power_remaining_charging_duration_only" msgid="7415639699283965818">"還需 <xliff:g id="TIME">%1$s</xliff:g>才能充滿電"</string>
     <string name="power_charging_duration" msgid="5005740040558984057">"<xliff:g id="LEVEL">%1$s</xliff:g> - 還需 <xliff:g id="TIME">%2$s</xliff:g>才能充滿電"</string>
     <string name="battery_info_status_unknown" msgid="268625384868401114">"未知"</string>
     <string name="battery_info_status_charging" msgid="4279958015430387405">"充電中"</string>
-    <!-- no translation found for battery_info_status_charging_fast (8027559755902954885) -->
-    <skip />
-    <!-- no translation found for battery_info_status_charging_slow (3190803837168962319) -->
-    <skip />
+    <string name="battery_info_status_charging_fast" msgid="8027559755902954885">"正在快速充電"</string>
+    <string name="battery_info_status_charging_slow" msgid="3190803837168962319">"正在慢速充電"</string>
     <string name="battery_info_status_discharging" msgid="6962689305413556485">"非充電中"</string>
     <string name="battery_info_status_not_charging" msgid="8330015078868707899">"已插入電源插座,但目前無法充電"</string>
     <string name="battery_info_status_full" msgid="4443168946046847468">"電量已滿"</string>
diff --git a/packages/SettingsLib/res/values-zh-rTW/strings.xml b/packages/SettingsLib/res/values-zh-rTW/strings.xml
index a150d16..487c33d 100644
--- a/packages/SettingsLib/res/values-zh-rTW/strings.xml
+++ b/packages/SettingsLib/res/values-zh-rTW/strings.xml
@@ -206,6 +206,33 @@
     <string name="enable_adb" msgid="8072776357237289039">"USB 偵錯"</string>
     <string name="enable_adb_summary" msgid="3711526030096574316">"連接 USB 時進入偵錯模式"</string>
     <string name="clear_adb_keys" msgid="3010148733140369917">"撤銷 USB 偵錯授權"</string>
+    <string name="enable_adb_wireless" msgid="6973226350963971018">"無線偵錯"</string>
+    <string name="enable_adb_wireless_summary" msgid="7344391423657093011">"連上 Wi-Fi 時啟用偵錯模式"</string>
+    <string name="adb_wireless_error" msgid="721958772149779856">"錯誤"</string>
+    <string name="adb_wireless_settings" msgid="2295017847215680229">"無線偵錯"</string>
+    <string name="adb_wireless_list_empty_off" msgid="1713707973837255490">"如要查看並使用可用的裝置,請開啟無線偵錯"</string>
+    <string name="adb_pair_method_qrcode_title" msgid="6982904096137468634">"使用 QR 圖碼配對裝置"</string>
+    <string name="adb_pair_method_qrcode_summary" msgid="3729901496856458634">"使用 QR 圖碼掃描器配對新裝置"</string>
+    <string name="adb_pair_method_code_title" msgid="1122590300445142904">"使用配對碼配對裝置"</string>
+    <string name="adb_pair_method_code_summary" msgid="6370414511333685185">"使用六位數的配對碼配對新裝置"</string>
+    <string name="adb_paired_devices_title" msgid="5268997341526217362">"已配對的裝置"</string>
+    <string name="adb_wireless_device_connected_summary" msgid="3039660790249148713">"目前已連線的裝置"</string>
+    <string name="adb_wireless_device_details_title" msgid="7129369670526565786">"裝置詳細資料"</string>
+    <string name="adb_device_forget" msgid="193072400783068417">"移除裝置"</string>
+    <string name="adb_device_fingerprint_title_format" msgid="291504822917843701">"裝置指紋:<xliff:g id="FINGERPRINT_PARAM">%1$s</xliff:g>"</string>
+    <string name="adb_wireless_connection_failed_title" msgid="664211177427438438">"連線失敗"</string>
+    <string name="adb_wireless_connection_failed_message" msgid="9213896700171602073">"請確認「<xliff:g id="DEVICE_NAME">%1$s</xliff:g>」已連上正確的網路"</string>
+    <string name="adb_pairing_device_dialog_title" msgid="7141739231018530210">"與裝置配對"</string>
+    <string name="adb_pairing_device_dialog_pairing_code_label" msgid="3639239786669722731">"Wi‑Fi 配對碼"</string>
+    <string name="adb_pairing_device_dialog_failed_title" msgid="3426758947882091735">"配對失敗"</string>
+    <string name="adb_pairing_device_dialog_failed_msg" msgid="6611097519661997148">"請確認裝置已連上相同的網路。"</string>
+    <string name="adb_wireless_qrcode_summary" msgid="8051414549011801917">"掃描 QR 圖碼即可透過 Wi-Fi 配對裝置"</string>
+    <string name="adb_wireless_verifying_qrcode_text" msgid="6123192424916029207">"正在配對裝置…"</string>
+    <string name="adb_qrcode_pairing_device_failed_msg" msgid="6936292092592914132">"無法配對裝置。可能是QR 圖碼錯誤,或是裝置未連上相同的網路。"</string>
+    <string name="adb_wireless_ip_addr_preference_title" msgid="8335132107715311730">"IP 位址和通訊埠"</string>
+    <string name="adb_wireless_qrcode_pairing_title" msgid="1906409667944674707">"掃描 QR 圖碼"</string>
+    <string name="adb_wireless_qrcode_pairing_description" msgid="8578868049289910131">"掃描 QR 圖碼即可透過 Wi-Fi 配對裝置"</string>
+    <string name="keywords_adb_wireless" msgid="6507505581882171240">"ADB, 偵錯, 開發"</string>
     <string name="bugreport_in_power" msgid="8664089072534638709">"錯誤回報捷徑"</string>
     <string name="bugreport_in_power_summary" msgid="1885529649381831775">"在電源選單中顯示取得錯誤報告的按鈕"</string>
     <string name="keep_screen_on" msgid="1187161672348797558">"螢幕不休眠"</string>
@@ -271,6 +298,8 @@
     <string name="tethering_hardware_offload_summary" msgid="7801345335142803029">"使用數據連線硬體加速功能 (如果可用的話)"</string>
     <string name="adb_warning_title" msgid="7708653449506485728">"允許 USB 偵錯嗎?"</string>
     <string name="adb_warning_message" msgid="8145270656419669221">"USB 偵錯是針對應用程式開發而設計的功能,可讓你複製電腦和裝置中的資料、不需經由通知即可在裝置上安裝應用程式,以及讀取記錄資料。"</string>
+    <string name="adbwifi_warning_title" msgid="727104571653031865">"要啟用無線偵錯嗎?"</string>
+    <string name="adbwifi_warning_message" msgid="8005936574322702388">"無線偵錯是針對應用程式開發而設計的功能,可讓你複製電腦和裝置中的資料、不必經由通知即可在裝置上安裝應用程式,以及讀取記錄資料。"</string>
     <string name="adb_keys_warning_message" msgid="2968555274488101220">"要針對先前授權的所有電腦撤銷 USB 偵錯權限嗎?"</string>
     <string name="dev_settings_warning_title" msgid="8251234890169074553">"允許開發設定?"</string>
     <string name="dev_settings_warning_message" msgid="37741686486073668">"這些設定僅供開發之用,可能導致你的裝置及裝置中的應用程式毀損或運作異常。"</string>
@@ -383,8 +412,7 @@
     <string name="daltonizer_mode_protanomaly" msgid="7805583306666608440">"紅色弱視 (紅-綠)"</string>
     <string name="daltonizer_mode_tritanomaly" msgid="7135266249220732267">"藍色弱視 (藍-黃)"</string>
     <string name="accessibility_display_daltonizer_preference_title" msgid="1810693571332381974">"色彩校正"</string>
-    <!-- no translation found for accessibility_display_daltonizer_preference_subtitle (6178138727195403796) -->
-    <skip />
+    <string name="accessibility_display_daltonizer_preference_subtitle" msgid="6178138727195403796">"色彩校正可協助色盲使用者看見較準確的色彩"</string>
     <string name="daltonizer_type_overridden" msgid="4509604753672535721">"已改為<xliff:g id="TITLE">%1$s</xliff:g>"</string>
     <string name="power_remaining_settings_home_page" msgid="4885165789445462557">"<xliff:g id="PERCENTAGE">%1$s</xliff:g> - <xliff:g id="TIME_STRING">%2$s</xliff:g>"</string>
     <string name="power_remaining_duration_only" msgid="8264199158671531431">"還能使用約 <xliff:g id="TIME_REMAINING">%1$s</xliff:g>"</string>
@@ -403,21 +431,19 @@
     <string name="power_remaining_less_than_duration" msgid="1812668275239801236">"電池可用時間不到 <xliff:g id="THRESHOLD">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_more_than_subtext" msgid="7919119719242734848">"電池可用時間超過 <xliff:g id="TIME_REMAINING">%1$s</xliff:g> (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_only_more_than_subtext" msgid="3274496164769110480">"電池可用時間超過 <xliff:g id="TIME_REMAINING">%1$s</xliff:g>"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="6583866940347159957">"手機可能即將關機"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="8009177999719462724">"平板電腦可能即將關機"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="8320892540455268018">"裝置可能即將關機"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="6186572170809116621">"手機可能即將關機 (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="1338758278145563121">"平板電腦可能即將關機 (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="3699579688084774362">"裝置可能即將關機 (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="137330009791560774">"手機可能即將關機"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="145489081521468132">"平板電腦可能即將關機"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="1070562682853942350">"裝置可能即將關機"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="4429259621177089719">"手機可能即將關機 (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="7703677921000858479">"平板電腦可能即將關機 (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="4374784375644214578">"裝置可能即將關機 (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
     <string name="power_charging" msgid="6727132649743436802">"<xliff:g id="LEVEL">%1$s</xliff:g> - <xliff:g id="STATE">%2$s</xliff:g>"</string>
     <string name="power_remaining_charging_duration_only" msgid="7415639699283965818">"<xliff:g id="TIME">%1$s</xliff:g>後充飽電"</string>
     <string name="power_charging_duration" msgid="5005740040558984057">"<xliff:g id="LEVEL">%1$s</xliff:g> - <xliff:g id="TIME">%2$s</xliff:g>後充飽電"</string>
     <string name="battery_info_status_unknown" msgid="268625384868401114">"不明"</string>
     <string name="battery_info_status_charging" msgid="4279958015430387405">"充電中"</string>
-    <!-- no translation found for battery_info_status_charging_fast (8027559755902954885) -->
-    <skip />
-    <!-- no translation found for battery_info_status_charging_slow (3190803837168962319) -->
-    <skip />
+    <string name="battery_info_status_charging_fast" msgid="8027559755902954885">"快速充電中"</string>
+    <string name="battery_info_status_charging_slow" msgid="3190803837168962319">"慢速充電中"</string>
     <string name="battery_info_status_discharging" msgid="6962689305413556485">"非充電中"</string>
     <string name="battery_info_status_not_charging" msgid="8330015078868707899">"已接上電源,但現在無法充電"</string>
     <string name="battery_info_status_full" msgid="4443168946046847468">"電力充足"</string>
diff --git a/packages/SettingsLib/res/values-zu/strings.xml b/packages/SettingsLib/res/values-zu/strings.xml
index 003dda3..684c100 100644
--- a/packages/SettingsLib/res/values-zu/strings.xml
+++ b/packages/SettingsLib/res/values-zu/strings.xml
@@ -206,6 +206,33 @@
     <string name="enable_adb" msgid="8072776357237289039">"Ukulungisa iphutha le-USB"</string>
     <string name="enable_adb_summary" msgid="3711526030096574316">"Lungisa iphutha lemodi lapho i-USB ixhunyiwe"</string>
     <string name="clear_adb_keys" msgid="3010148733140369917">"Buyisa ukugunyaza kokususa iphutha le-USB"</string>
+    <string name="enable_adb_wireless" msgid="6973226350963971018">"Ukulungisa amaphutha okungenantambo"</string>
+    <string name="enable_adb_wireless_summary" msgid="7344391423657093011">"Imodi yokususa iphutha lapho i-Wi-Fi ixhunyiwe"</string>
+    <string name="adb_wireless_error" msgid="721958772149779856">"Iphutha"</string>
+    <string name="adb_wireless_settings" msgid="2295017847215680229">"Ukulungisa amaphutha okungenantambo"</string>
+    <string name="adb_wireless_list_empty_off" msgid="1713707973837255490">"Ukubona futhi usebenzise amadivayisi atholakalayo, vula ukulungisa amaphutha okungenantambo"</string>
+    <string name="adb_pair_method_qrcode_title" msgid="6982904096137468634">"Bhangqa idivayisi ngekhodi ye-QR"</string>
+    <string name="adb_pair_method_qrcode_summary" msgid="3729901496856458634">"Bhangqa amadivayisi amasha usebenzisa iskena sekhodi ye-QR"</string>
+    <string name="adb_pair_method_code_title" msgid="1122590300445142904">"Bhangqa idivayisi ngekhodi yokumatanisa"</string>
+    <string name="adb_pair_method_code_summary" msgid="6370414511333685185">"Bhangqa amadivayisi amasha usebenzisa ikhodi yamadijithi ayisithupha"</string>
+    <string name="adb_paired_devices_title" msgid="5268997341526217362">"Amadivaysi abhangqene"</string>
+    <string name="adb_wireless_device_connected_summary" msgid="3039660790249148713">"Kuxhunyiwe manje"</string>
+    <string name="adb_wireless_device_details_title" msgid="7129369670526565786">"Imininingwane yedivayisi"</string>
+    <string name="adb_device_forget" msgid="193072400783068417">"Khohlwa"</string>
+    <string name="adb_device_fingerprint_title_format" msgid="291504822917843701">"Izigxivizo zeminwe zedivayisi: <xliff:g id="FINGERPRINT_PARAM">%1$s</xliff:g>"</string>
+    <string name="adb_wireless_connection_failed_title" msgid="664211177427438438">"Ukuxhuma akuphumelelanga"</string>
+    <string name="adb_wireless_connection_failed_message" msgid="9213896700171602073">"Qiniseka ukuthi i-<xliff:g id="DEVICE_NAME">%1$s</xliff:g>ixhunywe kunethiwekhi efanele"</string>
+    <string name="adb_pairing_device_dialog_title" msgid="7141739231018530210">"Bhangqa nedivayisi"</string>
+    <string name="adb_pairing_device_dialog_pairing_code_label" msgid="3639239786669722731">"Ikhodi yokubhangqa ye-Wi-Fi"</string>
+    <string name="adb_pairing_device_dialog_failed_title" msgid="3426758947882091735">"Ukubhangqa akuphumelelanga"</string>
+    <string name="adb_pairing_device_dialog_failed_msg" msgid="6611097519661997148">"Qiniseka ukuthi idivayisi ixhunywe kunethiwekhi efanayo."</string>
+    <string name="adb_wireless_qrcode_summary" msgid="8051414549011801917">"Bhangqa idivayisi nge-Wi‑Fi ngokuskena ikhodi ye-QR"</string>
+    <string name="adb_wireless_verifying_qrcode_text" msgid="6123192424916029207">"Ibhangqa idivayisi…"</string>
+    <string name="adb_qrcode_pairing_device_failed_msg" msgid="6936292092592914132">"Yehlulekile ukubhangqa idivayisi. Kungenzeka ukuthi ikhodi ye-QR kade ingalungile, noma idivayisi ayixhunyiwe kunethiwekhi efanayo."</string>
+    <string name="adb_wireless_ip_addr_preference_title" msgid="8335132107715311730">"Ikheli le-IP nembobo"</string>
+    <string name="adb_wireless_qrcode_pairing_title" msgid="1906409667944674707">"Skena ikhodi ye-QR"</string>
+    <string name="adb_wireless_qrcode_pairing_description" msgid="8578868049289910131">"Bhangqa idivayisi nge-Wi‑Fi ngokuskena ikhodi ye-QR"</string>
+    <string name="keywords_adb_wireless" msgid="6507505581882171240">"i-adb, ukulungisa amaphutha, i-dev"</string>
     <string name="bugreport_in_power" msgid="8664089072534638709">"Isinqamuleli sombiko wesiphazamisi"</string>
     <string name="bugreport_in_power_summary" msgid="1885529649381831775">"Bonisa inkinobho kwimenyu yamandla ngokuthatha umbiko wesiphazamiso"</string>
     <string name="keep_screen_on" msgid="1187161672348797558">"Hlala uphapheme"</string>
@@ -271,6 +298,8 @@
     <string name="tethering_hardware_offload_summary" msgid="7801345335142803029">"Sebenzisa i-tethering hardware acceleration uma itholakala"</string>
     <string name="adb_warning_title" msgid="7708653449506485728">"Vumela ukulungisa iphutha le-USB?"</string>
     <string name="adb_warning_message" msgid="8145270656419669221">"Ukulungisa iphutha le-USB kuhloselwe izinjongo zokuthuthukisa kuphela. Ingasebenziselwa ukukopisha idatha phakathi kwekhompyutha yakho nedivaysi yakho, faka izinhlelo zokusebenza kwidivaysi yakho ngaphandle kwesaziso, bese ufunda idatha yefayela lokungena."</string>
+    <string name="adbwifi_warning_title" msgid="727104571653031865">"Vumela ukulungisa amaphutha okungenantambo?"</string>
+    <string name="adbwifi_warning_message" msgid="8005936574322702388">"Ukulungisa iphutha okungenantambo kuhloselwe izinjongo zokuthuthukisa kuphela. Kusebenzisele ukukopisha idatha phakathi kwekhompuyutha yakho nedivaysi yakho, faka izinhlelo zokusebenza kwidivaysi yakho ngaphandle kwesaziso, bese ufunda idatha yelogu."</string>
     <string name="adb_keys_warning_message" msgid="2968555274488101220">"Buyisa ukufinyelela ekususeni iphutha le-USB kusuka kuwo wonke amakhompyutha owagunyaze ngaphambilini?"</string>
     <string name="dev_settings_warning_title" msgid="8251234890169074553">"Vumele izilungiselelo zokuthuthukisa?"</string>
     <string name="dev_settings_warning_message" msgid="37741686486073668">"Lezi zilungiselelo zenzelwe ukusetshenziswa ukuthuthukisa kuphela. Zingadala ukuthi idivayisi yakho kanye nensiza ekuyona ukuthi iphuke noma iziphathe kabi."</string>
@@ -383,8 +412,7 @@
     <string name="daltonizer_mode_protanomaly" msgid="7805583306666608440">"I-Protanomaly (bomvu-luhlaza)"</string>
     <string name="daltonizer_mode_tritanomaly" msgid="7135266249220732267">"I-Tritanomaly (luhlaza okwesibhakabhaka-phuzi)"</string>
     <string name="accessibility_display_daltonizer_preference_title" msgid="1810693571332381974">"Ukulungiswa kombala"</string>
-    <!-- no translation found for accessibility_display_daltonizer_preference_subtitle (6178138727195403796) -->
-    <skip />
+    <string name="accessibility_display_daltonizer_preference_subtitle" msgid="6178138727195403796">"Ukulungisa umbala kusiza abantu abangaboni imibala bobone imibala enembe kakhulu"</string>
     <string name="daltonizer_type_overridden" msgid="4509604753672535721">"Igitshezwe ngaphezulu yi-<xliff:g id="TITLE">%1$s</xliff:g>"</string>
     <string name="power_remaining_settings_home_page" msgid="4885165789445462557">"<xliff:g id="PERCENTAGE">%1$s</xliff:g> - <xliff:g id="TIME_STRING">%2$s</xliff:g>"</string>
     <string name="power_remaining_duration_only" msgid="8264199158671531431">"Cishe u-<xliff:g id="TIME_REMAINING">%1$s</xliff:g> osele"</string>
@@ -403,21 +431,19 @@
     <string name="power_remaining_less_than_duration" msgid="1812668275239801236">"Ngaphansi kuka-<xliff:g id="THRESHOLD">%1$s</xliff:g> osele (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_more_than_subtext" msgid="7919119719242734848">"Ngaphezu kuka-<xliff:g id="TIME_REMAINING">%1$s</xliff:g> osele (<xliff:g id="LEVEL">%2$s</xliff:g>)"</string>
     <string name="power_remaining_only_more_than_subtext" msgid="3274496164769110480">"Ngaphezulu kokungu-<xliff:g id="TIME_REMAINING">%1$s</xliff:g> okusele"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="6583866940347159957">"Ifoni ingacisha maduze"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="8009177999719462724">"Ithebulethi ingacisha maduze"</string>
-    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="8320892540455268018">"Idivayisi ingacisha maduze"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="6186572170809116621">"Ifoni ingacisha maduze (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="1338758278145563121">"Ithebhulethi ingacisha maduze (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
-    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="3699579688084774362">"Idivayisi ingacisha maduze (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="default" msgid="137330009791560774">"Ifoni ingacisha maduze"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="tablet" msgid="145489081521468132">"Ithebulethi ingacisha maduze"</string>
+    <string name="power_remaining_duration_only_shutdown_imminent" product="device" msgid="1070562682853942350">"Idivayisi ingacisha maduze"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="default" msgid="4429259621177089719">"Ifoni ingacisha maduze (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="tablet" msgid="7703677921000858479">"Ithebulethi ingacisha maduze (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
+    <string name="power_remaining_duration_shutdown_imminent" product="device" msgid="4374784375644214578">"Idivayisi ingacisha maduze (<xliff:g id="LEVEL">%1$s</xliff:g>)"</string>
     <string name="power_charging" msgid="6727132649743436802">"<xliff:g id="LEVEL">%1$s</xliff:g> - <xliff:g id="STATE">%2$s</xliff:g>"</string>
     <string name="power_remaining_charging_duration_only" msgid="7415639699283965818">"<xliff:g id="TIME">%1$s</xliff:g> esele ize ishaje"</string>
     <string name="power_charging_duration" msgid="5005740040558984057">"<xliff:g id="LEVEL">%1$s</xliff:g> - <xliff:g id="TIME">%2$s</xliff:g> ize igcwale"</string>
     <string name="battery_info_status_unknown" msgid="268625384868401114">"Akwaziwa"</string>
     <string name="battery_info_status_charging" msgid="4279958015430387405">"Iyashaja"</string>
-    <!-- no translation found for battery_info_status_charging_fast (8027559755902954885) -->
-    <skip />
-    <!-- no translation found for battery_info_status_charging_slow (3190803837168962319) -->
-    <skip />
+    <string name="battery_info_status_charging_fast" msgid="8027559755902954885">"Ishaja ngokushesha"</string>
+    <string name="battery_info_status_charging_slow" msgid="3190803837168962319">"Ishaja kancane"</string>
     <string name="battery_info_status_discharging" msgid="6962689305413556485">"Ayishaji"</string>
     <string name="battery_info_status_not_charging" msgid="8330015078868707899">"Kuxhunyiwe, ayikwazi ukushaja khona manje"</string>
     <string name="battery_info_status_full" msgid="4443168946046847468">"Kugcwele"</string>
diff --git a/packages/SettingsProvider/res/values-af/strings.xml b/packages/SettingsProvider/res/values-af/strings.xml
index 8c2f8b3..24efbb6 100644
--- a/packages/SettingsProvider/res/values-af/strings.xml
+++ b/packages/SettingsProvider/res/values-af/strings.xml
@@ -20,7 +20,6 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="4567566098528588863">"Instellingsberging"</string>
-    <string name="wifi_softap_config_change" msgid="5338670993556993667">"Veranderings aan jou warmkolinstellings"</string>
-    <string name="wifi_softap_config_change_summary" msgid="7600005249167787750">"Jou warmkolband het verander."</string>
-    <string name="wifi_softap_config_change_detailed" msgid="2504664754843959730">"Hierdie toestel steun nie jou voorkeur vir net 5 GHz nie. Hierdie toestel sal pleks daarvan die 5 GHz-band gebruik wanneer dit beskikbaar is."</string>
+    <string name="wifi_softap_config_change" msgid="5688373762357941645">"Warmkolinstellings het verander"</string>
+    <string name="wifi_softap_config_change_summary" msgid="8946397286141531087">"Tik om besonderhede te sien"</string>
 </resources>
diff --git a/packages/SettingsProvider/res/values-am/strings.xml b/packages/SettingsProvider/res/values-am/strings.xml
index 640301a..48fb705 100644
--- a/packages/SettingsProvider/res/values-am/strings.xml
+++ b/packages/SettingsProvider/res/values-am/strings.xml
@@ -20,7 +20,6 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="4567566098528588863">"የቅንብሮች ማከማቻ"</string>
-    <string name="wifi_softap_config_change" msgid="5338670993556993667">"በእርስዎ ሆትስፖት ቅንብሮች ላይ ለውጦች"</string>
-    <string name="wifi_softap_config_change_summary" msgid="7600005249167787750">"የእርስዎ ሆትስፖት ባንድ ተለውጧል።"</string>
-    <string name="wifi_softap_config_change_detailed" msgid="2504664754843959730">"ይህ መሣሪያ የእርስዎን ምርጫ ለ5GHz ብቻ አይደግፍም። በምትኩ፣ ይህ መሣሪያ ሲገኝ 5GHz ባንድ ይጠቀማል።"</string>
+    <string name="wifi_softap_config_change" msgid="5688373762357941645">"የመገናኛ ነጥብ ቅንብሮች ተለውጠዋል"</string>
+    <string name="wifi_softap_config_change_summary" msgid="8946397286141531087">"ዝርዝሮችን ለማየት መታ ያድርጉ"</string>
 </resources>
diff --git a/packages/SettingsProvider/res/values-ar/strings.xml b/packages/SettingsProvider/res/values-ar/strings.xml
index 2675839..6371f2c 100644
--- a/packages/SettingsProvider/res/values-ar/strings.xml
+++ b/packages/SettingsProvider/res/values-ar/strings.xml
@@ -20,7 +20,6 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="4567566098528588863">"تخزين الإعدادات"</string>
-    <string name="wifi_softap_config_change" msgid="5338670993556993667">"التغييرات التي طرأت على إعدادات نقطة الاتصال"</string>
-    <string name="wifi_softap_config_change_summary" msgid="7600005249167787750">"تمّ تغيير نطاق نقطة الاتصال الخاصة بك."</string>
-    <string name="wifi_softap_config_change_detailed" msgid="2504664754843959730">"لا يتوافق هذا الجهاز مع إعدادك المفضّل الخاص باستخدام النطاق 5 غيغاهرتز فقط. وسيستخدم الجهاز بدلاً من ذلك النطاق 5 غيغاهرتز عندما يكون متاحًا."</string>
+    <string name="wifi_softap_config_change" msgid="5688373762357941645">"تم تغيير إعدادات نقطة الاتصال."</string>
+    <string name="wifi_softap_config_change_summary" msgid="8946397286141531087">"انقر للاطّلاع على التفاصيل."</string>
 </resources>
diff --git a/packages/SettingsProvider/res/values-as/strings.xml b/packages/SettingsProvider/res/values-as/strings.xml
index b70146a..5235e3c 100644
--- a/packages/SettingsProvider/res/values-as/strings.xml
+++ b/packages/SettingsProvider/res/values-as/strings.xml
@@ -20,7 +20,8 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="4567566098528588863">"ছেটিংছসমূহৰ সঞ্চয়াগাৰ"</string>
-    <string name="wifi_softap_config_change" msgid="5338670993556993667">"আপোনাৰ হটস্পট ছেটিংসমূহত হোৱা সালসলনিসমূহ"</string>
-    <string name="wifi_softap_config_change_summary" msgid="7600005249167787750">"আপোনাৰ হটস্পটৰ বেণ্ড সলনি কৰা হৈছে।"</string>
-    <string name="wifi_softap_config_change_detailed" msgid="2504664754843959730">"আপোনাৰ কেৱল ৫ গিগাহাৰ্টজৰ প্ৰতি অগ্ৰাধিকাৰ এই ডিভাচইচটোৱে সমৰ্থন নকৰে। ইয়াৰ পৰিৱৰ্তে, ডিভাচইচটোৱে যেতিয়া ৫ গিগাহাৰ্টজ বেণ্ড উপলব্ধ হ’ব তেতিয়া তাক ব্যৱহাৰ কৰিব।"</string>
+    <!-- no translation found for wifi_softap_config_change (5688373762357941645) -->
+    <skip />
+    <!-- no translation found for wifi_softap_config_change_summary (8946397286141531087) -->
+    <skip />
 </resources>
diff --git a/packages/SettingsProvider/res/values-az/strings.xml b/packages/SettingsProvider/res/values-az/strings.xml
index 8b4f75b..b0e8642 100644
--- a/packages/SettingsProvider/res/values-az/strings.xml
+++ b/packages/SettingsProvider/res/values-az/strings.xml
@@ -20,7 +20,6 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="4567566098528588863">"Ayarlar Deposu"</string>
-    <string name="wifi_softap_config_change" msgid="5338670993556993667">"Hotspot ayarlarınızda dəyişiklik"</string>
-    <string name="wifi_softap_config_change_summary" msgid="7600005249167787750">"Hotspot diapazonu dəyişib."</string>
-    <string name="wifi_softap_config_change_detailed" msgid="2504664754843959730">"Bu cihaz yalnız 5GHz üçün tərcihinizi dəstəkləmir. Əvəzində, əlçatan olduqda bu cihaz 5GHz diapazonundan istifadə edəcək."</string>
+    <string name="wifi_softap_config_change" msgid="5688373762357941645">"Hotspot ayarları dəyişib"</string>
+    <string name="wifi_softap_config_change_summary" msgid="8946397286141531087">"Detalları görmək üçün toxunun"</string>
 </resources>
diff --git a/packages/SettingsProvider/res/values-b+sr+Latn/strings.xml b/packages/SettingsProvider/res/values-b+sr+Latn/strings.xml
index 9c3a00e..def4b68 100644
--- a/packages/SettingsProvider/res/values-b+sr+Latn/strings.xml
+++ b/packages/SettingsProvider/res/values-b+sr+Latn/strings.xml
@@ -20,7 +20,6 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="4567566098528588863">"Podešavanja skladišta"</string>
-    <string name="wifi_softap_config_change" msgid="5338670993556993667">"Promene podešavanja za hotspot"</string>
-    <string name="wifi_softap_config_change_summary" msgid="7600005249167787750">"Opseg hotspota je promenjen."</string>
-    <string name="wifi_softap_config_change_detailed" msgid="2504664754843959730">"Ovaj uređaj ne podržava podešavanje samo za 5 GHz. Uređaj će koristiti opseg od 5 GHz kada bude dostupan."</string>
+    <string name="wifi_softap_config_change" msgid="5688373762357941645">"Podešavanja hotspota su promenjena"</string>
+    <string name="wifi_softap_config_change_summary" msgid="8946397286141531087">"Dodirnite da biste videli detalje"</string>
 </resources>
diff --git a/packages/SettingsProvider/res/values-be/strings.xml b/packages/SettingsProvider/res/values-be/strings.xml
index 0e098e7..709178e 100644
--- a/packages/SettingsProvider/res/values-be/strings.xml
+++ b/packages/SettingsProvider/res/values-be/strings.xml
@@ -20,7 +20,6 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="4567566098528588863">"Сховішча налад"</string>
-    <string name="wifi_softap_config_change" msgid="5338670993556993667">"Змяненні ў наладах хот-спота"</string>
-    <string name="wifi_softap_config_change_summary" msgid="7600005249167787750">"Частата хот-спота змянілася."</string>
-    <string name="wifi_softap_config_change_detailed" msgid="2504664754843959730">"Прылада не можа працаваць толькі на частаце 5 ГГц. Гэта частата будзе выкарыстоўвацца, калі гэта магчыма."</string>
+    <string name="wifi_softap_config_change" msgid="5688373762357941645">"Налады хот-спота змяніліся"</string>
+    <string name="wifi_softap_config_change_summary" msgid="8946397286141531087">"Дакраніцеся, каб убачыць падрабязныя звесткі"</string>
 </resources>
diff --git a/packages/SettingsProvider/res/values-bg/strings.xml b/packages/SettingsProvider/res/values-bg/strings.xml
index 30526f2..b2eae73 100644
--- a/packages/SettingsProvider/res/values-bg/strings.xml
+++ b/packages/SettingsProvider/res/values-bg/strings.xml
@@ -20,7 +20,6 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="4567566098528588863">"Настройки за хранилище"</string>
-    <string name="wifi_softap_config_change" msgid="5338670993556993667">"Промени в настройките ви за точка за достъп"</string>
-    <string name="wifi_softap_config_change_summary" msgid="7600005249167787750">"Честотната лента на точката ви за достъп е променена."</string>
-    <string name="wifi_softap_config_change_detailed" msgid="2504664754843959730">"Това устройство не поддържа предпочитанието ви за използване само на честотната лента от 5 ГХц. Вместо това то ще я ползва, когато е възможно."</string>
+    <string name="wifi_softap_config_change" msgid="5688373762357941645">"Настройките за точката за достъп са променени"</string>
+    <string name="wifi_softap_config_change_summary" msgid="8946397286141531087">"Докоснете, за да видите подробности"</string>
 </resources>
diff --git a/packages/SettingsProvider/res/values-bn/strings.xml b/packages/SettingsProvider/res/values-bn/strings.xml
index 8fc6bbb..c785cd8 100644
--- a/packages/SettingsProvider/res/values-bn/strings.xml
+++ b/packages/SettingsProvider/res/values-bn/strings.xml
@@ -20,7 +20,8 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="4567566098528588863">"সেটিংস স্টোরেজ"</string>
-    <string name="wifi_softap_config_change" msgid="5338670993556993667">"আপনার হটস্পট সেটিংসে করা পরিবর্তনগুলি"</string>
-    <string name="wifi_softap_config_change_summary" msgid="7600005249167787750">"আপনার হটস্পট ব্যান্ড পরিবর্তন করা হয়েছে।"</string>
-    <string name="wifi_softap_config_change_detailed" msgid="2504664754843959730">"এই ডিভাইসটি শুধুমাত্র 5GHz এর জন্য আপনার পছন্দ সমর্থন করে না। পরিবর্তে, এই ডিভাইসটি 5GHz ব্যান্ড ব্যবহার করবে।"</string>
+    <!-- no translation found for wifi_softap_config_change (5688373762357941645) -->
+    <skip />
+    <!-- no translation found for wifi_softap_config_change_summary (8946397286141531087) -->
+    <skip />
 </resources>
diff --git a/packages/SettingsProvider/res/values-bs/strings.xml b/packages/SettingsProvider/res/values-bs/strings.xml
index ddacb32..506fea2 100644
--- a/packages/SettingsProvider/res/values-bs/strings.xml
+++ b/packages/SettingsProvider/res/values-bs/strings.xml
@@ -20,7 +20,6 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="4567566098528588863">"Postavke za pohranu podataka"</string>
-    <string name="wifi_softap_config_change" msgid="5338670993556993667">"Promjene postavki pristupne tačke"</string>
-    <string name="wifi_softap_config_change_summary" msgid="7600005249167787750">"Opseg pristupne tačke je promijenjen."</string>
-    <string name="wifi_softap_config_change_detailed" msgid="2504664754843959730">"Ovaj uređaj ne podržava vašu postavku za mreže od isključivo 5 GHz. Uređaj će koristiti opseg of 5 GHz kada bude dostupan."</string>
+    <string name="wifi_softap_config_change" msgid="5688373762357941645">"Postavke pristupne tačke su promijenjene"</string>
+    <string name="wifi_softap_config_change_summary" msgid="8946397286141531087">"Dodirnite da vidite detalje"</string>
 </resources>
diff --git a/packages/SettingsProvider/res/values-ca/strings.xml b/packages/SettingsProvider/res/values-ca/strings.xml
index 0c2ad73..58d3572e 100644
--- a/packages/SettingsProvider/res/values-ca/strings.xml
+++ b/packages/SettingsProvider/res/values-ca/strings.xml
@@ -20,7 +20,6 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="4567566098528588863">"Configuració de l\'emmagatzematge"</string>
-    <string name="wifi_softap_config_change" msgid="5338670993556993667">"Canvis en la configuració del punt d\'accés Wi‑Fi"</string>
-    <string name="wifi_softap_config_change_summary" msgid="7600005249167787750">"Ha canviat la teva banda del punt d\'accés Wi‑Fi."</string>
-    <string name="wifi_softap_config_change_detailed" msgid="2504664754843959730">"Aquest dispositiu no admet utilitzar exclusivament una banda de 5 GHz. El dispositiu utilitzarà una banda de 5 GHz quan estigui disponible."</string>
+    <string name="wifi_softap_config_change" msgid="5688373762357941645">"La configuració del punt d\'accés Wi‑Fi ha canviat"</string>
+    <string name="wifi_softap_config_change_summary" msgid="8946397286141531087">"Toca per veure\'n els detalls"</string>
 </resources>
diff --git a/packages/SettingsProvider/res/values-cs/strings.xml b/packages/SettingsProvider/res/values-cs/strings.xml
index ab474b1..449c632 100644
--- a/packages/SettingsProvider/res/values-cs/strings.xml
+++ b/packages/SettingsProvider/res/values-cs/strings.xml
@@ -20,7 +20,6 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="4567566098528588863">"Paměť pro nastavení"</string>
-    <string name="wifi_softap_config_change" msgid="5338670993556993667">"Změny nastavení hotspotu"</string>
-    <string name="wifi_softap_config_change_summary" msgid="7600005249167787750">"Pásmo hotspotu se změnilo."</string>
-    <string name="wifi_softap_config_change_detailed" msgid="2504664754843959730">"Toto zařízení nepodporuje vaše nastavení jen 5GHz pásma. Zařízení použije pásmo 5 GHz, jen když bude dostupné."</string>
+    <string name="wifi_softap_config_change" msgid="5688373762357941645">"Nastavení hotspotu se změnilo"</string>
+    <string name="wifi_softap_config_change_summary" msgid="8946397286141531087">"Klepnutím zobrazíte podrobnosti"</string>
 </resources>
diff --git a/packages/SettingsProvider/res/values-da/strings.xml b/packages/SettingsProvider/res/values-da/strings.xml
index 719614c..278d978 100644
--- a/packages/SettingsProvider/res/values-da/strings.xml
+++ b/packages/SettingsProvider/res/values-da/strings.xml
@@ -20,7 +20,6 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="4567566098528588863">"Lagring af indstillinger"</string>
-    <string name="wifi_softap_config_change" msgid="5338670993556993667">"Ændringer af dine indstillinger for hotspot"</string>
-    <string name="wifi_softap_config_change_summary" msgid="7600005249167787750">"Dit hotspotbånd er ændret."</string>
-    <string name="wifi_softap_config_change_detailed" msgid="2504664754843959730">"Denne enhed understøtter ikke din præference om kun 5 GHz. Denne enhed vil i stedet bruge 5 GHz-båndet, når det er muligt."</string>
+    <string name="wifi_softap_config_change" msgid="5688373762357941645">"Indstillingerne for hotspots har ændret sig"</string>
+    <string name="wifi_softap_config_change_summary" msgid="8946397286141531087">"Tryk for at se flere oplysninger"</string>
 </resources>
diff --git a/packages/SettingsProvider/res/values-de/strings.xml b/packages/SettingsProvider/res/values-de/strings.xml
index 6e253e0..a469936 100644
--- a/packages/SettingsProvider/res/values-de/strings.xml
+++ b/packages/SettingsProvider/res/values-de/strings.xml
@@ -20,7 +20,8 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="4567566098528588863">"Einstellungsspeicher"</string>
-    <string name="wifi_softap_config_change" msgid="5338670993556993667">"Änderungen an deinen Hotspot-Einstellungen"</string>
-    <string name="wifi_softap_config_change_summary" msgid="7600005249167787750">"Dein Hotspot-Band hat sich geändert."</string>
-    <string name="wifi_softap_config_change_detailed" msgid="2504664754843959730">"Dieses Gerät unterstützt die ausschließliche Nutzung von 5 GHz nicht. Es greift aber immer auf das 5-GHz-Band zurück, wenn dieses verfügbar ist."</string>
+    <!-- no translation found for wifi_softap_config_change (5688373762357941645) -->
+    <skip />
+    <!-- no translation found for wifi_softap_config_change_summary (8946397286141531087) -->
+    <skip />
 </resources>
diff --git a/packages/SettingsProvider/res/values-el/strings.xml b/packages/SettingsProvider/res/values-el/strings.xml
index c47fea2..1bfbf27 100644
--- a/packages/SettingsProvider/res/values-el/strings.xml
+++ b/packages/SettingsProvider/res/values-el/strings.xml
@@ -20,7 +20,6 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="4567566098528588863">"Αποθηκευτικός χώρος ρυθμίσεων"</string>
-    <string name="wifi_softap_config_change" msgid="5338670993556993667">"Αλλαγές στις ρυθμίσεις σημείου πρόσβασης Wi-Fi"</string>
-    <string name="wifi_softap_config_change_summary" msgid="7600005249167787750">"Το εύρος σημείου πρόσβασης Wi-Fi άλλαξε."</string>
-    <string name="wifi_softap_config_change_detailed" msgid="2504664754843959730">"Αυτή η συσκευή δεν υποστηρίζει την προτίμησή σας για αποκλειστική χρήση του εύρους 5 GHz. Αντ\' αυτού, αυτή η συσκευή θα χρησιμοποιεί το εύρος 5 GHz όταν είναι διαθέσιμο."</string>
+    <string name="wifi_softap_config_change" msgid="5688373762357941645">"Οι ρυθμίσεις σημείου πρόσβασης Wi-Fi έχουν αλλάξει"</string>
+    <string name="wifi_softap_config_change_summary" msgid="8946397286141531087">"Πατήστε για προβολή λεπτομερειών."</string>
 </resources>
diff --git a/packages/SettingsProvider/res/values-en-rAU/strings.xml b/packages/SettingsProvider/res/values-en-rAU/strings.xml
index fac51d83..4e90cad 100644
--- a/packages/SettingsProvider/res/values-en-rAU/strings.xml
+++ b/packages/SettingsProvider/res/values-en-rAU/strings.xml
@@ -20,7 +20,6 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="4567566098528588863">"Settings Storage"</string>
-    <string name="wifi_softap_config_change" msgid="5338670993556993667">"Changes to your hotspot settings"</string>
-    <string name="wifi_softap_config_change_summary" msgid="7600005249167787750">"Your hotspot band has changed."</string>
-    <string name="wifi_softap_config_change_detailed" msgid="2504664754843959730">"This device doesn’t support your preference for 5 GHz only. Instead, this device will use the 5 GHz band when available."</string>
+    <string name="wifi_softap_config_change" msgid="5688373762357941645">"Hotspot settings have changed"</string>
+    <string name="wifi_softap_config_change_summary" msgid="8946397286141531087">"Tap to see details"</string>
 </resources>
diff --git a/packages/SettingsProvider/res/values-en-rCA/strings.xml b/packages/SettingsProvider/res/values-en-rCA/strings.xml
index fac51d83..4e90cad 100644
--- a/packages/SettingsProvider/res/values-en-rCA/strings.xml
+++ b/packages/SettingsProvider/res/values-en-rCA/strings.xml
@@ -20,7 +20,6 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="4567566098528588863">"Settings Storage"</string>
-    <string name="wifi_softap_config_change" msgid="5338670993556993667">"Changes to your hotspot settings"</string>
-    <string name="wifi_softap_config_change_summary" msgid="7600005249167787750">"Your hotspot band has changed."</string>
-    <string name="wifi_softap_config_change_detailed" msgid="2504664754843959730">"This device doesn’t support your preference for 5 GHz only. Instead, this device will use the 5 GHz band when available."</string>
+    <string name="wifi_softap_config_change" msgid="5688373762357941645">"Hotspot settings have changed"</string>
+    <string name="wifi_softap_config_change_summary" msgid="8946397286141531087">"Tap to see details"</string>
 </resources>
diff --git a/packages/SettingsProvider/res/values-en-rGB/strings.xml b/packages/SettingsProvider/res/values-en-rGB/strings.xml
index fac51d83..4e90cad 100644
--- a/packages/SettingsProvider/res/values-en-rGB/strings.xml
+++ b/packages/SettingsProvider/res/values-en-rGB/strings.xml
@@ -20,7 +20,6 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="4567566098528588863">"Settings Storage"</string>
-    <string name="wifi_softap_config_change" msgid="5338670993556993667">"Changes to your hotspot settings"</string>
-    <string name="wifi_softap_config_change_summary" msgid="7600005249167787750">"Your hotspot band has changed."</string>
-    <string name="wifi_softap_config_change_detailed" msgid="2504664754843959730">"This device doesn’t support your preference for 5 GHz only. Instead, this device will use the 5 GHz band when available."</string>
+    <string name="wifi_softap_config_change" msgid="5688373762357941645">"Hotspot settings have changed"</string>
+    <string name="wifi_softap_config_change_summary" msgid="8946397286141531087">"Tap to see details"</string>
 </resources>
diff --git a/packages/SettingsProvider/res/values-en-rIN/strings.xml b/packages/SettingsProvider/res/values-en-rIN/strings.xml
index fac51d83..4e90cad 100644
--- a/packages/SettingsProvider/res/values-en-rIN/strings.xml
+++ b/packages/SettingsProvider/res/values-en-rIN/strings.xml
@@ -20,7 +20,6 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="4567566098528588863">"Settings Storage"</string>
-    <string name="wifi_softap_config_change" msgid="5338670993556993667">"Changes to your hotspot settings"</string>
-    <string name="wifi_softap_config_change_summary" msgid="7600005249167787750">"Your hotspot band has changed."</string>
-    <string name="wifi_softap_config_change_detailed" msgid="2504664754843959730">"This device doesn’t support your preference for 5 GHz only. Instead, this device will use the 5 GHz band when available."</string>
+    <string name="wifi_softap_config_change" msgid="5688373762357941645">"Hotspot settings have changed"</string>
+    <string name="wifi_softap_config_change_summary" msgid="8946397286141531087">"Tap to see details"</string>
 </resources>
diff --git a/packages/SettingsProvider/res/values-en-rXC/strings.xml b/packages/SettingsProvider/res/values-en-rXC/strings.xml
index fbc348b..4ea5c57 100644
--- a/packages/SettingsProvider/res/values-en-rXC/strings.xml
+++ b/packages/SettingsProvider/res/values-en-rXC/strings.xml
@@ -20,7 +20,6 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="4567566098528588863">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‏‎‏‏‏‏‏‎‏‏‏‏‏‏‎‏‏‎‎‎‏‏‎‏‎‎‎‎‎‏‎‎‏‎‏‎‏‎‏‎‏‎‎‏‏‎‏‏‏‎‏‎‎‏‏‏‎‏‎‏‎‎‎‎‏‏‏‏‏‏‎Settings Storage‎‏‎‎‏‎"</string>
-    <string name="wifi_softap_config_change" msgid="5338670993556993667">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‏‎‏‏‏‏‏‏‏‎‎‏‎‏‎‎‎‎‏‎‏‏‎‏‏‎‎‎‏‎‎‏‏‏‏‏‎‏‏‏‎‏‎‏‏‏‏‏‎‏‎‎‏‎‏‎‏‏‏‎‏‏‎‏‎‎‎‎‎‏‏‎Changes to your hotspot settings‎‏‎‎‏‎"</string>
-    <string name="wifi_softap_config_change_summary" msgid="7600005249167787750">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‏‎‏‏‏‏‏‏‏‏‎‏‎‎‏‎‏‏‏‏‎‎‎‏‎‏‎‎‏‎‎‏‎‎‎‎‎‎‏‏‏‏‎‏‏‏‏‏‏‎‎‎‎‎‎‎‎‎‎‎‏‏‎‏‏‏‎‎‏‏‎‎Your hotspot band has changed.‎‏‎‎‏‎"</string>
-    <string name="wifi_softap_config_change_detailed" msgid="2504664754843959730">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‏‎‏‏‏‏‏‎‏‎‎‎‏‎‏‏‎‎‎‎‏‎‎‏‎‏‏‎‏‏‎‏‎‏‎‎‏‏‎‎‎‎‎‎‎‏‏‏‏‎‏‎‏‎‎‏‎‎‎‎‎‏‏‎‏‏‎‎‏‎‎This device doesn’t support your preference for 5GHz only. Instead, this device will use the 5GHz band when available.‎‏‎‎‏‎"</string>
+    <string name="wifi_softap_config_change" msgid="5688373762357941645">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‏‎‏‏‏‏‏‏‏‎‎‏‏‏‎‏‏‏‏‎‎‎‏‎‎‏‎‏‎‎‏‏‏‎‎‏‏‎‎‎‏‏‎‏‏‏‎‏‏‏‏‏‏‏‏‎‏‎‏‎‏‎‏‏‎‎‎‏‏‎‏‎Hotspot settings have changed‎‏‎‎‏‎"</string>
+    <string name="wifi_softap_config_change_summary" msgid="8946397286141531087">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‎‏‎‎‏‎‎‎‏‎‏‏‏‏‏‏‏‏‏‏‏‎‎‎‎‏‎‎‏‏‏‏‏‏‏‏‏‎‎‏‏‏‎‏‏‏‎‏‎‎‎‎‎‏‏‏‏‏‏‏‏‎‎‎‎‎‏‎‎‏‏‏‏‎‎‏‏‏‏‎Tap to see details‎‏‎‎‏‎"</string>
 </resources>
diff --git a/packages/SettingsProvider/res/values-es-rUS/strings.xml b/packages/SettingsProvider/res/values-es-rUS/strings.xml
index af90257..4345b7a 100644
--- a/packages/SettingsProvider/res/values-es-rUS/strings.xml
+++ b/packages/SettingsProvider/res/values-es-rUS/strings.xml
@@ -20,7 +20,6 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="4567566098528588863">"Almacenamiento de configuración"</string>
-    <string name="wifi_softap_config_change" msgid="5338670993556993667">"Cambios en la configuración de tu hotspot"</string>
-    <string name="wifi_softap_config_change_summary" msgid="7600005249167787750">"Cambió la banda de tu hotspot."</string>
-    <string name="wifi_softap_config_change_detailed" msgid="2504664754843959730">"Si bien este dispositivo no admite la opción para conectarse exclusivamente a bandas de 5 GHz, las usará cuando estén disponibles."</string>
+    <string name="wifi_softap_config_change" msgid="5688373762357941645">"Se modificó la configuración de hotspot"</string>
+    <string name="wifi_softap_config_change_summary" msgid="8946397286141531087">"Presiona para obtener más información"</string>
 </resources>
diff --git a/packages/SettingsProvider/res/values-es/strings.xml b/packages/SettingsProvider/res/values-es/strings.xml
index ff4ee38..3f1fa61 100644
--- a/packages/SettingsProvider/res/values-es/strings.xml
+++ b/packages/SettingsProvider/res/values-es/strings.xml
@@ -20,7 +20,8 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="4567566098528588863">"Almacenamiento de configuración"</string>
-    <string name="wifi_softap_config_change" msgid="5338670993556993667">"Cambios en los ajustes del punto de acceso"</string>
-    <string name="wifi_softap_config_change_summary" msgid="7600005249167787750">"La banda de tu punto de acceso ha cambiado."</string>
-    <string name="wifi_softap_config_change_detailed" msgid="2504664754843959730">"Este dispositivo no admite la opción de conectarse únicamente a bandas de 5 GHz, pero las usará cuando estén disponibles."</string>
+    <!-- no translation found for wifi_softap_config_change (5688373762357941645) -->
+    <skip />
+    <!-- no translation found for wifi_softap_config_change_summary (8946397286141531087) -->
+    <skip />
 </resources>
diff --git a/packages/SettingsProvider/res/values-et/strings.xml b/packages/SettingsProvider/res/values-et/strings.xml
index a0ec593..856ccf1 100644
--- a/packages/SettingsProvider/res/values-et/strings.xml
+++ b/packages/SettingsProvider/res/values-et/strings.xml
@@ -20,7 +20,6 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="4567566098528588863">"Seadete talletusruum"</string>
-    <string name="wifi_softap_config_change" msgid="5338670993556993667">"Muudatused teie kuumkoha seadetes"</string>
-    <string name="wifi_softap_config_change_summary" msgid="7600005249167787750">"Teie kuumkoha sagedusriba on muutunud."</string>
-    <string name="wifi_softap_config_change_detailed" msgid="2504664754843959730">"See seade ei toeta teie eelistatud ainult 5 GHz riba. Seade kasutab 5 GHz riba ainult siis, kui see on saadaval."</string>
+    <string name="wifi_softap_config_change" msgid="5688373762357941645">"Kuumkoha seaded on muutunud"</string>
+    <string name="wifi_softap_config_change_summary" msgid="8946397286141531087">"Puudutage üksikasjade vaatamiseks"</string>
 </resources>
diff --git a/packages/SettingsProvider/res/values-eu/strings.xml b/packages/SettingsProvider/res/values-eu/strings.xml
index 220b486..7ca91d8 100644
--- a/packages/SettingsProvider/res/values-eu/strings.xml
+++ b/packages/SettingsProvider/res/values-eu/strings.xml
@@ -20,7 +20,6 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="4567566098528588863">"Ezarpenen biltegia"</string>
-    <string name="wifi_softap_config_change" msgid="5338670993556993667">"Aldaketak egin dira sare publikoaren ezarpenetan"</string>
-    <string name="wifi_softap_config_change_summary" msgid="7600005249167787750">"Aldatu da sare publikoaren banda."</string>
-    <string name="wifi_softap_config_change_detailed" msgid="2504664754843959730">"Gailuak ez du onartzen 5 GHz-ko banda soilik erabiltzeko hobespena. Horren ordez, erabilgarri dagoen bakoitzean erabiliko da 5 GHz-ko banda."</string>
+    <string name="wifi_softap_config_change" msgid="5688373762357941645">"Sare publikoaren ezarpenak aldatu dira"</string>
+    <string name="wifi_softap_config_change_summary" msgid="8946397286141531087">"Sakatu hau xehetasunak ikusteko"</string>
 </resources>
diff --git a/packages/SettingsProvider/res/values-fa/strings.xml b/packages/SettingsProvider/res/values-fa/strings.xml
index 6819d2f..cc0b557 100644
--- a/packages/SettingsProvider/res/values-fa/strings.xml
+++ b/packages/SettingsProvider/res/values-fa/strings.xml
@@ -20,7 +20,6 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="4567566098528588863">"تنظیم محل ذخیره"</string>
-    <string name="wifi_softap_config_change" msgid="5338670993556993667">"تغییرات در تنظیمات نقطه اتصال"</string>
-    <string name="wifi_softap_config_change_summary" msgid="7600005249167787750">"نوار نقطه اتصال شما تغییر کرد."</string>
-    <string name="wifi_softap_config_change_detailed" msgid="2504664754843959730">"این دستگاه از اولویت فقط ۵ گیگاهرتز شما پشتیبانی نمی‌کند. هرزمان نوار ۵ گیگاهرتزی دردسترس باشد، این دستگاه از آن استفاده خواهد کرد."</string>
+    <string name="wifi_softap_config_change" msgid="5688373762357941645">"تنظیمات نقطه اتصال تغییر کرده است"</string>
+    <string name="wifi_softap_config_change_summary" msgid="8946397286141531087">"برای مشاهده جزئیات ضربه بزنید"</string>
 </resources>
diff --git a/packages/SettingsProvider/res/values-fi/strings.xml b/packages/SettingsProvider/res/values-fi/strings.xml
index 9ad01eb..829bb3b 100644
--- a/packages/SettingsProvider/res/values-fi/strings.xml
+++ b/packages/SettingsProvider/res/values-fi/strings.xml
@@ -20,7 +20,6 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="4567566098528588863">"Asetuksien tallennus"</string>
-    <string name="wifi_softap_config_change" msgid="5338670993556993667">"Hotspot-asetustesi muutokset"</string>
-    <string name="wifi_softap_config_change_summary" msgid="7600005249167787750">"Hotspot-taajuutesi on muuttunut."</string>
-    <string name="wifi_softap_config_change_detailed" msgid="2504664754843959730">"Tämä laite ei tue asetustasi (vain 5 GHz). Sen sijaan laite käyttää 5 GHz:n taajuutta sen ollessa käytettävissä."</string>
+    <string name="wifi_softap_config_change" msgid="5688373762357941645">"Hotspot-asetuksia on muutettu"</string>
+    <string name="wifi_softap_config_change_summary" msgid="8946397286141531087">"Katso lisätiedot napauttamalla"</string>
 </resources>
diff --git a/packages/SettingsProvider/res/values-fr-rCA/strings.xml b/packages/SettingsProvider/res/values-fr-rCA/strings.xml
index 62951bd..d640845 100644
--- a/packages/SettingsProvider/res/values-fr-rCA/strings.xml
+++ b/packages/SettingsProvider/res/values-fr-rCA/strings.xml
@@ -20,7 +20,6 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="4567566098528588863">"Stockage des paramètres"</string>
-    <string name="wifi_softap_config_change" msgid="5338670993556993667">"Modifications apportées à vos paramètres de point d\'accès"</string>
-    <string name="wifi_softap_config_change_summary" msgid="7600005249167787750">"La bande de votre point d\'accès a changé."</string>
-    <string name="wifi_softap_config_change_detailed" msgid="2504664754843959730">"Cet appareil ne prend pas en charge votre préférence pour la bande de 5 GHz seulement. Au lieu de cela, cet appareil utilisera la bande de 5 GHz lorsqu\'elle sera disponible."</string>
+    <string name="wifi_softap_config_change" msgid="5688373762357941645">"Les paramètres de point d\'accès ont changé"</string>
+    <string name="wifi_softap_config_change_summary" msgid="8946397286141531087">"Touchez pour afficher les renseignements"</string>
 </resources>
diff --git a/packages/SettingsProvider/res/values-fr/strings.xml b/packages/SettingsProvider/res/values-fr/strings.xml
index 56bc65b..ba6ec0b 100644
--- a/packages/SettingsProvider/res/values-fr/strings.xml
+++ b/packages/SettingsProvider/res/values-fr/strings.xml
@@ -20,7 +20,6 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="4567566098528588863">"Stockage des paramètres"</string>
-    <string name="wifi_softap_config_change" msgid="5338670993556993667">"Modifications apportées à vos paramètres de point d\'accès"</string>
-    <string name="wifi_softap_config_change_summary" msgid="7600005249167787750">"La bande utilisée par votre point d\'accès a été modifiée."</string>
-    <string name="wifi_softap_config_change_detailed" msgid="2504664754843959730">"Cet appareil n\'est pas conçu pour utiliser exclusivement la bande 5 GHz, mais il l\'utilisera chaque fois que disponible."</string>
+    <string name="wifi_softap_config_change" msgid="5688373762357941645">"Les paramètres de point d\'accès ont changé"</string>
+    <string name="wifi_softap_config_change_summary" msgid="8946397286141531087">"Appuyer ici pour plus d\'infos"</string>
 </resources>
diff --git a/packages/SettingsProvider/res/values-gl/strings.xml b/packages/SettingsProvider/res/values-gl/strings.xml
index 771fade..1be162e 100644
--- a/packages/SettingsProvider/res/values-gl/strings.xml
+++ b/packages/SettingsProvider/res/values-gl/strings.xml
@@ -20,7 +20,6 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="4567566098528588863">"Almacenamento da configuración"</string>
-    <string name="wifi_softap_config_change" msgid="5338670993556993667">"Cambios na configuración da zona wifi"</string>
-    <string name="wifi_softap_config_change_summary" msgid="7600005249167787750">"Modificouse a banda da zona wifi."</string>
-    <string name="wifi_softap_config_change_detailed" msgid="2504664754843959730">"Este dispositivo non admite a opción de conectarse só a bandas de 5 GHz, pero usaraas se están dispoñibles."</string>
+    <string name="wifi_softap_config_change" msgid="5688373762357941645">"A configuración da zona wifi cambiou"</string>
+    <string name="wifi_softap_config_change_summary" msgid="8946397286141531087">"Toca a notificación para ver os detalles"</string>
 </resources>
diff --git a/packages/SettingsProvider/res/values-gu/strings.xml b/packages/SettingsProvider/res/values-gu/strings.xml
index a561924..074675f 100644
--- a/packages/SettingsProvider/res/values-gu/strings.xml
+++ b/packages/SettingsProvider/res/values-gu/strings.xml
@@ -20,7 +20,8 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="4567566098528588863">"સેટિંગ્સ સંગ્રહ"</string>
-    <string name="wifi_softap_config_change" msgid="5338670993556993667">"તમારા હૉટસ્પૉટ સેટિંગને બદલે છે"</string>
-    <string name="wifi_softap_config_change_summary" msgid="7600005249167787750">"તમારું હૉટસ્પૉટ બૅન્ડ બદલાઈ ગયું છે."</string>
-    <string name="wifi_softap_config_change_detailed" msgid="2504664754843959730">"આ ડિવાઇસ તમારી ફક્ત 5GHz માટેની પસંદગીને સપોર્ટ કરતું નથી. તેના બદલે, જ્યારે 5GHz બૅન્ડ ઉપલબ્ધ હશે ત્યારે આ ડિવાઇસ તેનો ઉપયોગ કરશે."</string>
+    <!-- no translation found for wifi_softap_config_change (5688373762357941645) -->
+    <skip />
+    <!-- no translation found for wifi_softap_config_change_summary (8946397286141531087) -->
+    <skip />
 </resources>
diff --git a/packages/SettingsProvider/res/values-hi/strings.xml b/packages/SettingsProvider/res/values-hi/strings.xml
index 199a546..9441a59 100644
--- a/packages/SettingsProvider/res/values-hi/strings.xml
+++ b/packages/SettingsProvider/res/values-hi/strings.xml
@@ -20,7 +20,6 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="4567566098528588863">"सेटिंग मेमोरी"</string>
-    <string name="wifi_softap_config_change" msgid="5338670993556993667">"आपकी हॉटस्पॉट की सेटिंग में किए गए बदलाव"</string>
-    <string name="wifi_softap_config_change_summary" msgid="7600005249167787750">"आपका हॉटस्पॉट का बैंड बदल दिया गया है."</string>
-    <string name="wifi_softap_config_change_detailed" msgid="2504664754843959730">"इस डिवाइस पर आप \'सिर्फ़ 5 गीगाहर्ट्ज़\' वाला विकल्प नहीं चुन सकते. इसके बजाय, 5 गीगाहर्ट्ज़ बैंड उपलब्ध होने पर यह डिवाइस उसका इस्तेमाल करेगा."</string>
+    <string name="wifi_softap_config_change" msgid="5688373762357941645">"हॉटस्पॉट की सेटिंग बदल गई हैं"</string>
+    <string name="wifi_softap_config_change_summary" msgid="8946397286141531087">"जानकारी देखने के लिए टैप करें"</string>
 </resources>
diff --git a/packages/SettingsProvider/res/values-hr/strings.xml b/packages/SettingsProvider/res/values-hr/strings.xml
index 9129a04..206f50f 100644
--- a/packages/SettingsProvider/res/values-hr/strings.xml
+++ b/packages/SettingsProvider/res/values-hr/strings.xml
@@ -20,7 +20,6 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="4567566098528588863">"Postavke pohrane"</string>
-    <string name="wifi_softap_config_change" msgid="5338670993556993667">"Promjene postavki vaše žarišne točke"</string>
-    <string name="wifi_softap_config_change_summary" msgid="7600005249167787750">"Promijenila se frekvencija vaše žarišne točke."</string>
-    <string name="wifi_softap_config_change_detailed" msgid="2504664754843959730">"Ovaj uređaj ne podržava vašu postavku za upotrebu samo 5 GHz. Upotrebljavat će frekvenciju od 5 GHz kada je dostupna."</string>
+    <string name="wifi_softap_config_change" msgid="5688373762357941645">"Promijenile su se postavke žarišne točke"</string>
+    <string name="wifi_softap_config_change_summary" msgid="8946397286141531087">"Dodirnite da biste vidjeli pojedinosti"</string>
 </resources>
diff --git a/packages/SettingsProvider/res/values-hu/strings.xml b/packages/SettingsProvider/res/values-hu/strings.xml
index a1ed494..a7ca0d2 100644
--- a/packages/SettingsProvider/res/values-hu/strings.xml
+++ b/packages/SettingsProvider/res/values-hu/strings.xml
@@ -20,7 +20,6 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="4567566098528588863">"Beállítástároló"</string>
-    <string name="wifi_softap_config_change" msgid="5338670993556993667">"A hotspot beállításainak módosítása"</string>
-    <string name="wifi_softap_config_change_summary" msgid="7600005249167787750">"A hotspot sávja megváltozott."</string>
-    <string name="wifi_softap_config_change_detailed" msgid="2504664754843959730">"Ez az eszköz nem támogatja a csak 5 GHz-es sávra vonatkozó beállítást. Az eszköz akkor használ 5 GHz-es sávot, ha a sáv rendelkezésre áll."</string>
+    <string name="wifi_softap_config_change" msgid="5688373762357941645">"A hotspot beállításai módosultak"</string>
+    <string name="wifi_softap_config_change_summary" msgid="8946397286141531087">"Koppintson a részletek megtekintéséhez"</string>
 </resources>
diff --git a/packages/SettingsProvider/res/values-hy/strings.xml b/packages/SettingsProvider/res/values-hy/strings.xml
index 6d716f8..4fdb880 100644
--- a/packages/SettingsProvider/res/values-hy/strings.xml
+++ b/packages/SettingsProvider/res/values-hy/strings.xml
@@ -20,7 +20,6 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="4567566098528588863">"Կարգավորումների պահուստ"</string>
-    <string name="wifi_softap_config_change" msgid="5338670993556993667">"Փոփոխություններ թեժ կետի կարգավորումներում"</string>
-    <string name="wifi_softap_config_change_summary" msgid="7600005249167787750">"Ձեր թեժ կետի հաճախականությունը փոխվել է։"</string>
-    <string name="wifi_softap_config_change_detailed" msgid="2504664754843959730">"Սարքը չի կարող աշխատել միայն 5 ԳՀց հաճախականությամբ։ Այդ հաճախականությունը կօգտագործվի հնարավորության դեպքում։"</string>
+    <string name="wifi_softap_config_change" msgid="5688373762357941645">"Թեժ կետի կարգավորումները փոխվել են"</string>
+    <string name="wifi_softap_config_change_summary" msgid="8946397286141531087">"Հպեք՝ ավելին իմանալու համար"</string>
 </resources>
diff --git a/packages/SettingsProvider/res/values-in/strings.xml b/packages/SettingsProvider/res/values-in/strings.xml
index 8b1b1f4..911892b 100644
--- a/packages/SettingsProvider/res/values-in/strings.xml
+++ b/packages/SettingsProvider/res/values-in/strings.xml
@@ -20,7 +20,6 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="4567566098528588863">"Setelan Penyimpanan"</string>
-    <string name="wifi_softap_config_change" msgid="5338670993556993667">"Perubahan pada setelan hotspot Anda"</string>
-    <string name="wifi_softap_config_change_summary" msgid="7600005249167787750">"Band hotspot Anda telah berubah."</string>
-    <string name="wifi_softap_config_change_detailed" msgid="2504664754843959730">"Perangkat ini tidak mendukung preferensi Anda, yaitu hanya 5GHz. Sebagai gantinya, perangkat ini akan menggunakan band 5GHz jika tersedia."</string>
+    <string name="wifi_softap_config_change" msgid="5688373762357941645">"Setelan hotspot telah berubah"</string>
+    <string name="wifi_softap_config_change_summary" msgid="8946397286141531087">"Ketuk untuk melihat detail"</string>
 </resources>
diff --git a/packages/SettingsProvider/res/values-is/strings.xml b/packages/SettingsProvider/res/values-is/strings.xml
index 150c084..c72442e 100644
--- a/packages/SettingsProvider/res/values-is/strings.xml
+++ b/packages/SettingsProvider/res/values-is/strings.xml
@@ -20,7 +20,6 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="4567566098528588863">"Stillingageymsla"</string>
-    <string name="wifi_softap_config_change" msgid="5338670993556993667">"Breytingar á stillingum heits reits"</string>
-    <string name="wifi_softap_config_change_summary" msgid="7600005249167787750">"Tíðnisvið heita reitsins hefur breyst."</string>
-    <string name="wifi_softap_config_change_detailed" msgid="2504664754843959730">"Þetta tæki styður ekki val þitt fyrir aðeins 5 GHz. Í staðinn mun þetta tæki nota 5 GHz tíðnisvið þegar það er í boði."</string>
+    <string name="wifi_softap_config_change" msgid="5688373762357941645">"Stillingum heits reits hefur verið breytt"</string>
+    <string name="wifi_softap_config_change_summary" msgid="8946397286141531087">"Ýttu til að sjá upplýsingar"</string>
 </resources>
diff --git a/packages/SettingsProvider/res/values-it/strings.xml b/packages/SettingsProvider/res/values-it/strings.xml
index 6715c3c..0e11d06 100644
--- a/packages/SettingsProvider/res/values-it/strings.xml
+++ b/packages/SettingsProvider/res/values-it/strings.xml
@@ -20,7 +20,6 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="4567566098528588863">"Memoria impostazioni"</string>
-    <string name="wifi_softap_config_change" msgid="5338670993556993667">"Modifiche alle tue impostazioni dell\'hotspot"</string>
-    <string name="wifi_softap_config_change_summary" msgid="7600005249167787750">"La banda dell\'hotspot è cambiata."</string>
-    <string name="wifi_softap_config_change_detailed" msgid="2504664754843959730">"Questo dispositivo non supporta la tua preferenza esclusiva per 5 GHz. Utilizzerà la banda a 5 GHz solo quando è disponibile."</string>
+    <string name="wifi_softap_config_change" msgid="5688373762357941645">"Le impostazioni di hotspot sono state modificate"</string>
+    <string name="wifi_softap_config_change_summary" msgid="8946397286141531087">"Tocca per vedere i dettagli"</string>
 </resources>
diff --git a/packages/SettingsProvider/res/values-iw/strings.xml b/packages/SettingsProvider/res/values-iw/strings.xml
index dd44329..8d8594d 100644
--- a/packages/SettingsProvider/res/values-iw/strings.xml
+++ b/packages/SettingsProvider/res/values-iw/strings.xml
@@ -20,7 +20,6 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="4567566098528588863">"אחסון הגדרות"</string>
-    <string name="wifi_softap_config_change" msgid="5338670993556993667">"שינויים להגדרות של הנקודה לשיתוף אינטרנט"</string>
-    <string name="wifi_softap_config_change_summary" msgid="7600005249167787750">"התדר של הנקודה לשיתוף אינטרנט השתנה."</string>
-    <string name="wifi_softap_config_change_detailed" msgid="2504664754843959730">"‏מכשיר זה לא תומך בהעדפות שלך ל-5GHz בלבד. במקום זאת, מכשיר זה ישתמש בתדר 5GHz כשיהיה זמין."</string>
+    <string name="wifi_softap_config_change" msgid="5688373762357941645">"ההגדרות של הנקודה לשיתוף אינטרנט השתנו"</string>
+    <string name="wifi_softap_config_change_summary" msgid="8946397286141531087">"יש להקיש להצגת פרטים"</string>
 </resources>
diff --git a/packages/SettingsProvider/res/values-ja/strings.xml b/packages/SettingsProvider/res/values-ja/strings.xml
index 7bbcd46..5b91b2d 100644
--- a/packages/SettingsProvider/res/values-ja/strings.xml
+++ b/packages/SettingsProvider/res/values-ja/strings.xml
@@ -20,7 +20,6 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="4567566098528588863">"ストレージの設定"</string>
-    <string name="wifi_softap_config_change" msgid="5338670993556993667">"アクセス ポイントの設定の変更"</string>
-    <string name="wifi_softap_config_change_summary" msgid="7600005249167787750">"アクセス ポイントの帯域幅が変更されました。"</string>
-    <string name="wifi_softap_config_change_detailed" msgid="2504664754843959730">"このデバイスは 5 GHz のみという設定に対応していません。ただし、5 GHz 周波数帯が利用できるときには利用します。"</string>
+    <string name="wifi_softap_config_change" msgid="5688373762357941645">"アクセス ポイントの設定が変更されました"</string>
+    <string name="wifi_softap_config_change_summary" msgid="8946397286141531087">"タップして詳細を確認してください"</string>
 </resources>
diff --git a/packages/SettingsProvider/res/values-ka/strings.xml b/packages/SettingsProvider/res/values-ka/strings.xml
index 86db4f3..70845ac 100644
--- a/packages/SettingsProvider/res/values-ka/strings.xml
+++ b/packages/SettingsProvider/res/values-ka/strings.xml
@@ -20,7 +20,6 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="4567566098528588863">"პარამეტრების საცავი"</string>
-    <string name="wifi_softap_config_change" msgid="5338670993556993667">"თქვენი უსადენო ქსელის პარამეტრების ცვლილება"</string>
-    <string name="wifi_softap_config_change_summary" msgid="7600005249167787750">"თქვენი უსადენო ქსელის დიაპაზონი შეიცვალა."</string>
-    <string name="wifi_softap_config_change_detailed" msgid="2504664754843959730">"ამ მოწყობილობას არ შეუძლია მხოლოდ 5 გჰც სიხშირეზე მუშაობა. აღნიშნული სიხშირის გამოყენება მოხდება მაშინ, როცა ეს შესაძლებელია."</string>
+    <string name="wifi_softap_config_change" msgid="5688373762357941645">"უსადენო ქსელის პარამეტრები შეიცვალა"</string>
+    <string name="wifi_softap_config_change_summary" msgid="8946397286141531087">"შეეხეთ დეტალების სანახავად"</string>
 </resources>
diff --git a/packages/SettingsProvider/res/values-kk/strings.xml b/packages/SettingsProvider/res/values-kk/strings.xml
index a093d08..2823e4e 100644
--- a/packages/SettingsProvider/res/values-kk/strings.xml
+++ b/packages/SettingsProvider/res/values-kk/strings.xml
@@ -20,7 +20,6 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="4567566098528588863">"Параметрлер жады"</string>
-    <string name="wifi_softap_config_change" msgid="5338670993556993667">"Хотспот параметрлеріне өзгерістер енгізілді"</string>
-    <string name="wifi_softap_config_change_summary" msgid="7600005249167787750">"Хотспот жолағы өзгертілді."</string>
-    <string name="wifi_softap_config_change_detailed" msgid="2504664754843959730">"Бұл құрылғы тек 5 ГГц жиілікте жұмыс істей алмайды. Бұл жиілік мүмкін болған жағдайда ғана қолданылады."</string>
+    <string name="wifi_softap_config_change" msgid="5688373762357941645">"Хотспот параметрлері өзгертілді"</string>
+    <string name="wifi_softap_config_change_summary" msgid="8946397286141531087">"Мәліметтерді көру үшін түртіңіз."</string>
 </resources>
diff --git a/packages/SettingsProvider/res/values-km/strings.xml b/packages/SettingsProvider/res/values-km/strings.xml
index f0a2712..cdae410 100644
--- a/packages/SettingsProvider/res/values-km/strings.xml
+++ b/packages/SettingsProvider/res/values-km/strings.xml
@@ -20,7 +20,6 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="4567566098528588863">"កំណត់​ការ​ផ្ទុក"</string>
-    <string name="wifi_softap_config_change" msgid="5338670993556993667">"ប្ដូរ​ទៅ​ការ​កំណត់​ហតស្ប៉ត​របស់អ្នក"</string>
-    <string name="wifi_softap_config_change_summary" msgid="7600005249167787750">"កម្រិតបញ្ជូន​ហតស្ប៉ត​របស់​អ្នកបាន​ផ្លាស់ប្ដូរ។"</string>
-    <string name="wifi_softap_config_change_detailed" msgid="2504664754843959730">"ឧបករណ៍នេះ​មិនស្គាល់​ចំណូលចិត្ត​របស់អ្នក​សម្រាប់តែ 5GHz ប៉ុណ្ណោះ។ ផ្ទុយមកវិញ ឧបករណ៍នេះ​នឹងប្រើ​កម្រិតបញ្ជូន 5GHz នៅពេល​ដែលអាច​ប្រើបាន។"</string>
+    <string name="wifi_softap_config_change" msgid="5688373762357941645">"បាន​ប្ដូរ​ការកំណត់​ហតស្ប៉ត"</string>
+    <string name="wifi_softap_config_change_summary" msgid="8946397286141531087">"ចុច​ដើម្បី​មើល​ព័ត៌មានលម្អិត"</string>
 </resources>
diff --git a/packages/SettingsProvider/res/values-kn/strings.xml b/packages/SettingsProvider/res/values-kn/strings.xml
index f2c1d5e..0b0000d 100644
--- a/packages/SettingsProvider/res/values-kn/strings.xml
+++ b/packages/SettingsProvider/res/values-kn/strings.xml
@@ -20,7 +20,8 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="4567566098528588863">"ಸೆಟ್ಟಿಂಗ್‌ಗಳ ಸಂಗ್ರಹಣೆ"</string>
-    <string name="wifi_softap_config_change" msgid="5338670993556993667">"ನಿಮ್ಮ ಹಾಟ್‌ಸ್ಪಾಟ್‌ ಸೆಟ್ಟಿಂಗ್‌ಗಳಲ್ಲಿನ ಬದಲಾವಣೆಗಳು"</string>
-    <string name="wifi_softap_config_change_summary" msgid="7600005249167787750">"ನಿಮ್ಮ ಹಾಟ್‌ಸ್ಪಾಟ್‌ ಬ್ಯಾಂಡ್ ಬದಲಾಗಿದೆ."</string>
-    <string name="wifi_softap_config_change_detailed" msgid="2504664754843959730">"ಈ ಸಾಧನವು 5GHz ಗೆ ಮಾತ್ರ ನಿಮ್ಮ ಆದ್ಯತೆಯನ್ನು ಬೆಂಬಲಿಸುವುದಿಲ್ಲ. ಬದಲಿಗೆ, ಈ ಸಾಧನವು 5GHz ಬ್ಯಾಂಡ್ ಅನ್ನು ಲಭ್ಯವಿರುವಾಗ ಬಳಸುತ್ತದೆ."</string>
+    <!-- no translation found for wifi_softap_config_change (5688373762357941645) -->
+    <skip />
+    <!-- no translation found for wifi_softap_config_change_summary (8946397286141531087) -->
+    <skip />
 </resources>
diff --git a/packages/SettingsProvider/res/values-ko/strings.xml b/packages/SettingsProvider/res/values-ko/strings.xml
index 841832d..d76b766 100644
--- a/packages/SettingsProvider/res/values-ko/strings.xml
+++ b/packages/SettingsProvider/res/values-ko/strings.xml
@@ -20,7 +20,6 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="4567566098528588863">"설정 저장소"</string>
-    <string name="wifi_softap_config_change" msgid="5338670993556993667">"핫스팟 설정 변경"</string>
-    <string name="wifi_softap_config_change_summary" msgid="7600005249167787750">"핫스팟 대역이 변경되었습니다."</string>
-    <string name="wifi_softap_config_change_detailed" msgid="2504664754843959730">"이 기기에서는 5GHz 전용 환경설정이 지원되지 않습니다. 대신 가능할 때만 기기에서 5GHz 대역이 사용됩니다."</string>
+    <string name="wifi_softap_config_change" msgid="5688373762357941645">"핫스팟 설정 변경됨"</string>
+    <string name="wifi_softap_config_change_summary" msgid="8946397286141531087">"세부정보를 보려면 탭하세요."</string>
 </resources>
diff --git a/packages/SettingsProvider/res/values-ky/strings.xml b/packages/SettingsProvider/res/values-ky/strings.xml
index 014c66c..e5b82c6 100644
--- a/packages/SettingsProvider/res/values-ky/strings.xml
+++ b/packages/SettingsProvider/res/values-ky/strings.xml
@@ -20,7 +20,6 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="4567566098528588863">"Жөндөөлөрдү сактоо"</string>
-    <string name="wifi_softap_config_change" msgid="5338670993556993667">"Байланыш түйүнүңүздүн жөндөөлөрү өзгөрүлдү"</string>
-    <string name="wifi_softap_config_change_summary" msgid="7600005249167787750">"Байланыш түйүнүңүздүн жыштыгы өзгөрдү."</string>
-    <string name="wifi_softap_config_change_detailed" msgid="2504664754843959730">"Бул түзмөк 5ГГцти гана колдонуу жөндөөсүн колдоого албайт. Анын ордуна, бул түзмөк 5ГГц жыштыгын ал жеткиликтүү болгондо колдонот."</string>
+    <string name="wifi_softap_config_change" msgid="5688373762357941645">"Хотспот жөндөөлөрү өзгөрдү"</string>
+    <string name="wifi_softap_config_change_summary" msgid="8946397286141531087">"Чоо-жайын билүү үчүн басыңыз"</string>
 </resources>
diff --git a/packages/SettingsProvider/res/values-lo/strings.xml b/packages/SettingsProvider/res/values-lo/strings.xml
index 9d60ba1..c2b5df7 100644
--- a/packages/SettingsProvider/res/values-lo/strings.xml
+++ b/packages/SettingsProvider/res/values-lo/strings.xml
@@ -20,7 +20,6 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="4567566098528588863">"ບ່ອນເກັບຂໍ້ມູນການຕັ້ງຄ່າ"</string>
-    <string name="wifi_softap_config_change" msgid="5338670993556993667">"ການປ່ຽນແປງການຕັ້ງຄ່າຮັອດສະປອດຂອງທ່ານ"</string>
-    <string name="wifi_softap_config_change_summary" msgid="7600005249167787750">"ຄື້ນຄວາມຖີ່ຮັອດສະປອດຂອງທ່ານປ່ຽນແປງແລ້ວ."</string>
-    <string name="wifi_softap_config_change_detailed" msgid="2504664754843959730">"ອຸປະກອນນີ້ບໍ່ຮອງຮັບການຕັ້ງຄ່າຂອງທ່ານສຳລັບ 5GHz ເທົ່ານັ້ນ. ແຕ່ວ່າອຸປະກອນນີ້ຈະໃຊ້ຄື້ນຄວາມຖີ່ 5GHz ເມື່ອສາມາດໃຊ້ໄດ້."</string>
+    <string name="wifi_softap_config_change" msgid="5688373762357941645">"ບັນທຶກການຕັ້ງຄ່າຮັອດສະປອດແລ້ວ"</string>
+    <string name="wifi_softap_config_change_summary" msgid="8946397286141531087">"ແຕະເພື່ອເບິ່ງລາຍລະອຽດ"</string>
 </resources>
diff --git a/packages/SettingsProvider/res/values-lt/strings.xml b/packages/SettingsProvider/res/values-lt/strings.xml
index 775d3b9..64f429b 100644
--- a/packages/SettingsProvider/res/values-lt/strings.xml
+++ b/packages/SettingsProvider/res/values-lt/strings.xml
@@ -20,7 +20,6 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="4567566098528588863">"Nustatymų saugykla"</string>
-    <string name="wifi_softap_config_change" msgid="5338670993556993667">"Viešosios interneto prieigos taško nustatymų pakeitimai"</string>
-    <string name="wifi_softap_config_change_summary" msgid="7600005249167787750">"Viešosios prieigos taško dažnio juosta pasikeitė."</string>
-    <string name="wifi_softap_config_change_detailed" msgid="2504664754843959730">"Šiame įrenginyje nepalaikoma tik 5 GHz nuostata. Vietoj to šiame įrenginyje bus naudojama 5 GHz dažnio juosta, kai bus pasiekiama."</string>
+    <string name="wifi_softap_config_change" msgid="5688373762357941645">"Buvo pakeisti viešosios interneto prieigos taško nustatymai"</string>
+    <string name="wifi_softap_config_change_summary" msgid="8946397286141531087">"Palieskite ir peržiūrėkite išsamią informaciją"</string>
 </resources>
diff --git a/packages/SettingsProvider/res/values-lv/strings.xml b/packages/SettingsProvider/res/values-lv/strings.xml
index f7f3117..e5af8f7 100644
--- a/packages/SettingsProvider/res/values-lv/strings.xml
+++ b/packages/SettingsProvider/res/values-lv/strings.xml
@@ -20,7 +20,6 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="4567566098528588863">"Iestatījumu krātuve"</string>
-    <string name="wifi_softap_config_change" msgid="5338670993556993667">"Izmaiņas tīklāja iestatījumos"</string>
-    <string name="wifi_softap_config_change_summary" msgid="7600005249167787750">"Ir mainīts tīklāja joslas platums."</string>
-    <string name="wifi_softap_config_change_detailed" msgid="2504664754843959730">"Šajā ierīcē netiek atbalstīta jūsu preference par tikai 5 GHz joslu. 5 GHz josla ierīcē tiks izmantota, kad tā būs pieejama."</string>
+    <string name="wifi_softap_config_change" msgid="5688373762357941645">"Ir mainīti tīklāja iestatījumi"</string>
+    <string name="wifi_softap_config_change_summary" msgid="8946397286141531087">"Pieskarieties, lai skatītu detalizētāku informāciju."</string>
 </resources>
diff --git a/packages/SettingsProvider/res/values-mk/strings.xml b/packages/SettingsProvider/res/values-mk/strings.xml
index a245e5f..13ff8a2 100644
--- a/packages/SettingsProvider/res/values-mk/strings.xml
+++ b/packages/SettingsProvider/res/values-mk/strings.xml
@@ -20,7 +20,6 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="4567566098528588863">"Поставки за меморија"</string>
-    <string name="wifi_softap_config_change" msgid="5338670993556993667">"Промени на поставките за точка на пристап"</string>
-    <string name="wifi_softap_config_change_summary" msgid="7600005249167787750">"Опсегот за точка на пристап е променет."</string>
-    <string name="wifi_softap_config_change_detailed" msgid="2504664754843959730">"Уредов не ги поддржува вашите поставки за само 5 GHz. Наместо тоа, ќе го користи опсегот од 5 GHz кога е достапен."</string>
+    <string name="wifi_softap_config_change" msgid="5688373762357941645">"Поставките за точка на пристап се променија"</string>
+    <string name="wifi_softap_config_change_summary" msgid="8946397286141531087">"Допрете за да видите детали"</string>
 </resources>
diff --git a/packages/SettingsProvider/res/values-ml/strings.xml b/packages/SettingsProvider/res/values-ml/strings.xml
index b63f20e..54a05fb 100644
--- a/packages/SettingsProvider/res/values-ml/strings.xml
+++ b/packages/SettingsProvider/res/values-ml/strings.xml
@@ -20,7 +20,8 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="4567566098528588863">"സംഭരണ ക്രമീകരണം"</string>
-    <string name="wifi_softap_config_change" msgid="5338670993556993667">"നിങ്ങളുടെ ഹോട്ട്‌സ്‌പോട്ട് ക്രമീകരണത്തിൽ വരുത്തിയ മാറ്റങ്ങൾ"</string>
-    <string name="wifi_softap_config_change_summary" msgid="7600005249167787750">"നിങ്ങളുടെ ഹോട്ട്‌സ്‌പോട്ട് ബാൻഡ് മാറിയിരിക്കുന്നു."</string>
-    <string name="wifi_softap_config_change_detailed" msgid="2504664754843959730">"നിങ്ങളുടെ മുൻഗണനയനുസരിച്ചുള്ള, 5GHz മാത്രം എന്നത് ഈ ഉപകരണം പിന്തുണയ്ക്കുന്നില്ല. പകരം, 5GHz ബാൻഡ് ലഭ്യമാകുമ്പോൾ അത് ഉപയോഗിക്കും."</string>
+    <!-- no translation found for wifi_softap_config_change (5688373762357941645) -->
+    <skip />
+    <!-- no translation found for wifi_softap_config_change_summary (8946397286141531087) -->
+    <skip />
 </resources>
diff --git a/packages/SettingsProvider/res/values-mn/strings.xml b/packages/SettingsProvider/res/values-mn/strings.xml
index c839177..a9c2e8c 100644
--- a/packages/SettingsProvider/res/values-mn/strings.xml
+++ b/packages/SettingsProvider/res/values-mn/strings.xml
@@ -20,7 +20,6 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="4567566098528588863">"Тохиргооны Сан"</string>
-    <string name="wifi_softap_config_change" msgid="5338670993556993667">"Таны сүлжээний цэгийн тохиргооны өөрчлөлт"</string>
-    <string name="wifi_softap_config_change_summary" msgid="7600005249167787750">"Таны сүлжээний цэгийн хязгаарыг өөрчилсөн."</string>
-    <string name="wifi_softap_config_change_detailed" msgid="2504664754843959730">"Энэ төхөөрөмж нь зөвхөн 5Гц гэсэн таны сонголтыг дэмждэггүй. Оронд нь энэ төхөөрөмж 5Гц-н хязгаарыг боломжтой үед нь ашиглах болно."</string>
+    <string name="wifi_softap_config_change" msgid="5688373762357941645">"Сүлжээний цэгийн тохиргоог өөрчиллөө"</string>
+    <string name="wifi_softap_config_change_summary" msgid="8946397286141531087">"Дэлгэрэнгүй мэдээлэл харахын тулд товшино уу"</string>
 </resources>
diff --git a/packages/SettingsProvider/res/values-mr/strings.xml b/packages/SettingsProvider/res/values-mr/strings.xml
index 0c7041e..0e80f70 100644
--- a/packages/SettingsProvider/res/values-mr/strings.xml
+++ b/packages/SettingsProvider/res/values-mr/strings.xml
@@ -20,7 +20,8 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="4567566098528588863">"सेटिंग्ज संचयन"</string>
-    <string name="wifi_softap_config_change" msgid="5338670993556993667">"तुमच्या हॉटस्पॉट सेटिंग्जमधील बदल"</string>
-    <string name="wifi_softap_config_change_summary" msgid="7600005249167787750">"तुमचा हॉटस्पॉट बँड बदलला गेला आहे."</string>
-    <string name="wifi_softap_config_change_detailed" msgid="2504664754843959730">"हे डिव्हाइस फक्त ५GHz च्या तुमच्या प्राधान्याला सपोर्ट करत नाही. त्याऐवजी, उपलब्ध असेल तेव्हा हे डिव्हाइस ५GHz बँड वापरेल."</string>
+    <!-- no translation found for wifi_softap_config_change (5688373762357941645) -->
+    <skip />
+    <!-- no translation found for wifi_softap_config_change_summary (8946397286141531087) -->
+    <skip />
 </resources>
diff --git a/packages/SettingsProvider/res/values-ms/strings.xml b/packages/SettingsProvider/res/values-ms/strings.xml
index a1574df..51a8f2b 100644
--- a/packages/SettingsProvider/res/values-ms/strings.xml
+++ b/packages/SettingsProvider/res/values-ms/strings.xml
@@ -20,7 +20,6 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="4567566098528588863">"Storan Tetapan"</string>
-    <string name="wifi_softap_config_change" msgid="5338670993556993667">"Perubahan kepada tetapan tempat liputan anda"</string>
-    <string name="wifi_softap_config_change_summary" msgid="7600005249167787750">"Jalur tempat liputan anda telah berubah."</string>
-    <string name="wifi_softap_config_change_detailed" msgid="2504664754843959730">"Peranti ini tidak menyokong pilihan anda untuk 5GHz sahaja. Sebaliknya, peranti ini akan menggunakan jalur 5GHz apabila tersedia."</string>
+    <string name="wifi_softap_config_change" msgid="5688373762357941645">"Tetapan tempat liputan telah berubah"</string>
+    <string name="wifi_softap_config_change_summary" msgid="8946397286141531087">"Ketik untuk melihat butiran"</string>
 </resources>
diff --git a/packages/SettingsProvider/res/values-my/strings.xml b/packages/SettingsProvider/res/values-my/strings.xml
index 48d4dba..dc9f531 100644
--- a/packages/SettingsProvider/res/values-my/strings.xml
+++ b/packages/SettingsProvider/res/values-my/strings.xml
@@ -20,7 +20,6 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="4567566098528588863">"သိုလှောင်မှုဆက်တင်များ"</string>
-    <string name="wifi_softap_config_change" msgid="5338670993556993667">"သင်၏ဟော့စပေါ့ ဆက်တင်များ ပြောင်းလဲမှု"</string>
-    <string name="wifi_softap_config_change_summary" msgid="7600005249167787750">"သင်၏ ဟော့စပေါ့လိုင်း ပြောင်းသွားပါပြီ။"</string>
-    <string name="wifi_softap_config_change_detailed" msgid="2504664754843959730">"ဤစက်ပစ္စည်းသည် သင်၏ 5GHz သီးသန့်ရွေးချယ်မှုအတွက် ပံ့ပိုးမထားပါ။ ၎င်းအစား ဤစက်ပစ္စည်းသည် ရနိုင်သည့်အခါ 5GHz လိုင်းကို သုံးသွားပါမည်။"</string>
+    <string name="wifi_softap_config_change" msgid="5688373762357941645">"ဟော့စပေါ့ ဆက်တင်များ ပြောင်းသွားပြီ"</string>
+    <string name="wifi_softap_config_change_summary" msgid="8946397286141531087">"အသေးစိတ်ကြည့်ရန် တို့ပါ"</string>
 </resources>
diff --git a/packages/SettingsProvider/res/values-nb/strings.xml b/packages/SettingsProvider/res/values-nb/strings.xml
index e0cbd7e..3bdaf83 100644
--- a/packages/SettingsProvider/res/values-nb/strings.xml
+++ b/packages/SettingsProvider/res/values-nb/strings.xml
@@ -20,7 +20,6 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="4567566098528588863">"Lagring av innstillinger"</string>
-    <string name="wifi_softap_config_change" msgid="5338670993556993667">"Endres til innstillingene dine for Wi-Fi-soner"</string>
-    <string name="wifi_softap_config_change_summary" msgid="7600005249167787750">"Båndet ditt for Wi-Fi-sone er endret."</string>
-    <string name="wifi_softap_config_change_detailed" msgid="2504664754843959730">"Denne enheten støtter ikke innstillingen din for bare 5 GHz. I stedet bruker enheten 5 GHz-båndet når det er tilgjengelig."</string>
+    <string name="wifi_softap_config_change" msgid="5688373762357941645">"Innstillingene for Wi-Fi-sone er endret"</string>
+    <string name="wifi_softap_config_change_summary" msgid="8946397286141531087">"Trykk for å se detaljer"</string>
 </resources>
diff --git a/packages/SettingsProvider/res/values-ne/strings.xml b/packages/SettingsProvider/res/values-ne/strings.xml
index 2fd9b00..bb04b6ba 100644
--- a/packages/SettingsProvider/res/values-ne/strings.xml
+++ b/packages/SettingsProvider/res/values-ne/strings.xml
@@ -20,7 +20,8 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="4567566098528588863">"सेटिङहरू भण्डारण"</string>
-    <string name="wifi_softap_config_change" msgid="5338670993556993667">"तपाईंका हटस्पट सेटिङहरूमा गरिएका परिवर्तनहरू"</string>
-    <string name="wifi_softap_config_change_summary" msgid="7600005249167787750">"तपाईंको हटस्पट ब्यान्ड परिवर्तन भएको छ।"</string>
-    <string name="wifi_softap_config_change_detailed" msgid="2504664754843959730">"यो यन्त्रले तपाईंको 5GHz मात्रको प्राथमिकतालाई समर्थन गर्दैन। बरु, उपलब्ध भएको खण्डमा यो यन्त्रले 5GHz ब्यान्ड प्रयोग गर्ने छ।"</string>
+    <!-- no translation found for wifi_softap_config_change (5688373762357941645) -->
+    <skip />
+    <!-- no translation found for wifi_softap_config_change_summary (8946397286141531087) -->
+    <skip />
 </resources>
diff --git a/packages/SettingsProvider/res/values-nl/strings.xml b/packages/SettingsProvider/res/values-nl/strings.xml
index 0b843ae..91b8542 100644
--- a/packages/SettingsProvider/res/values-nl/strings.xml
+++ b/packages/SettingsProvider/res/values-nl/strings.xml
@@ -20,7 +20,6 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="4567566098528588863">"Opslagruimte voor instellingen"</string>
-    <string name="wifi_softap_config_change" msgid="5338670993556993667">"Wijzigingen in je hotspot-instellingen"</string>
-    <string name="wifi_softap_config_change_summary" msgid="7600005249167787750">"Je hotspot-band is gewijzigd."</string>
-    <string name="wifi_softap_config_change_detailed" msgid="2504664754843959730">"Dit apparaat biedt geen ondersteuning voor je voorkeur voor alleen 5 GHz. In plaats daarvan gebruikt dit apparaat de 5-GHz-band wanneer deze beschikbaar is."</string>
+    <string name="wifi_softap_config_change" msgid="5688373762357941645">"Hotspot-instellingen zijn gewijzigd"</string>
+    <string name="wifi_softap_config_change_summary" msgid="8946397286141531087">"Tik voor meer informatie"</string>
 </resources>
diff --git a/packages/SettingsProvider/res/values-or/strings.xml b/packages/SettingsProvider/res/values-or/strings.xml
index 53f6104..4b73a55 100644
--- a/packages/SettingsProvider/res/values-or/strings.xml
+++ b/packages/SettingsProvider/res/values-or/strings.xml
@@ -20,7 +20,8 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="4567566098528588863">"ସେଟିଙ୍ଗ ଷ୍ଟୋରେଜ୍‌"</string>
-    <string name="wifi_softap_config_change" msgid="5338670993556993667">"ଆପଣଙ୍କର ହଟ୍‌ସ୍ପଟ୍ ସେଟିଂସ୍‌କୁ ବଦଳାଇଥାଏ"</string>
-    <string name="wifi_softap_config_change_summary" msgid="7600005249167787750">"ଆପଣଙ୍କର ହଟ୍‌ସ୍ପଟ୍ ପରିବର୍ତ୍ତନ କରାଯାଇଛି।"</string>
-    <string name="wifi_softap_config_change_detailed" msgid="2504664754843959730">"କେବଳ 5GHz ପାଇଁ, ଏହି ଡିଭାଇସ୍ ଆପଣଙ୍କର ପସନ୍ଦକୁ ସମର୍ଥନ କରେ ନାହିଁ। ଏହା ପରିବର୍ତ୍ତେ, ଉପଲବ୍ଧ ହେଲେ ଏହି ଡିଭାଇସ୍ 5GHz ବ୍ୟାଣ୍ଡ ବ୍ୟବହାର କରିବ।"</string>
+    <!-- no translation found for wifi_softap_config_change (5688373762357941645) -->
+    <skip />
+    <!-- no translation found for wifi_softap_config_change_summary (8946397286141531087) -->
+    <skip />
 </resources>
diff --git a/packages/SettingsProvider/res/values-pa/strings.xml b/packages/SettingsProvider/res/values-pa/strings.xml
index 9a41e36..5af8d6a 100644
--- a/packages/SettingsProvider/res/values-pa/strings.xml
+++ b/packages/SettingsProvider/res/values-pa/strings.xml
@@ -20,7 +20,8 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="4567566098528588863">"ਸੈਟਿੰਗਾਂ ਸਟੋਰੇਜ"</string>
-    <string name="wifi_softap_config_change" msgid="5338670993556993667">"ਤੁਹਾਡੀਆਂ ਹੌਟਸਪੌਟ ਸੈਟਿੰਗਾਂ ਵਿੱਚ ਬਦਲਾਅ"</string>
-    <string name="wifi_softap_config_change_summary" msgid="7600005249167787750">"ਤੁਹਾਡਾ ਹੌਟਸਪੌਟ ਬੈਂਡ ਬਦਲ ਗਿਆ ਹੈ।"</string>
-    <string name="wifi_softap_config_change_detailed" msgid="2504664754843959730">"ਇਹ ਡੀਵਾਈਸ ਸਿਰਫ਼ 5GHz ਦੀ ਤੁਹਾਡੀ ਤਰਜੀਹ ਦਾ ਸਮਰਥਨ ਨਹੀਂ ਕਰਦਾ ਹੈ। ਇਸਦੀ ਬਜਾਏ, ਇਹ ਡੀਵਾਈਸ ਉਪਲਬਧ ਹੋਣ \'ਤੇ 5GHz ਬੈਂਡ ਵਰਤੇਗਾ।"</string>
+    <!-- no translation found for wifi_softap_config_change (5688373762357941645) -->
+    <skip />
+    <!-- no translation found for wifi_softap_config_change_summary (8946397286141531087) -->
+    <skip />
 </resources>
diff --git a/packages/SettingsProvider/res/values-pl/strings.xml b/packages/SettingsProvider/res/values-pl/strings.xml
index 7fd2b13..d86fc4d 100644
--- a/packages/SettingsProvider/res/values-pl/strings.xml
+++ b/packages/SettingsProvider/res/values-pl/strings.xml
@@ -20,7 +20,6 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="4567566098528588863">"Pamięć ustawień"</string>
-    <string name="wifi_softap_config_change" msgid="5338670993556993667">"Zmieniono ustawienia hotspotu"</string>
-    <string name="wifi_softap_config_change_summary" msgid="7600005249167787750">"Zmieniono pasmo hotspotu."</string>
-    <string name="wifi_softap_config_change_detailed" msgid="2504664754843959730">"To urządzenie nie może korzystać tylko z częstotliwości 5 GHz. Będzie korzystać z tego pasma, jeśli będzie ono dostępne."</string>
+    <string name="wifi_softap_config_change" msgid="5688373762357941645">"Ustawienia hotspotu zostały zmienione"</string>
+    <string name="wifi_softap_config_change_summary" msgid="8946397286141531087">"Kliknij, by zobaczyć szczegóły"</string>
 </resources>
diff --git a/packages/SettingsProvider/res/values-pt-rBR/strings.xml b/packages/SettingsProvider/res/values-pt-rBR/strings.xml
index 18db8f6..a860018 100644
--- a/packages/SettingsProvider/res/values-pt-rBR/strings.xml
+++ b/packages/SettingsProvider/res/values-pt-rBR/strings.xml
@@ -20,7 +20,6 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="4567566098528588863">"Armazenamento de configurações"</string>
-    <string name="wifi_softap_config_change" msgid="5338670993556993667">"Mudanças nas suas configurações de ponto de acesso"</string>
-    <string name="wifi_softap_config_change_summary" msgid="7600005249167787750">"Sua banda de ponto de acesso foi modificada."</string>
-    <string name="wifi_softap_config_change_detailed" msgid="2504664754843959730">"Este dispositivo não é compatível com sua preferência apenas por 5 GHz. Em vez disso, o dispositivo usará a banda de 5 GHz quando ela estiver disponível."</string>
+    <string name="wifi_softap_config_change" msgid="5688373762357941645">"As configurações de ponto de acesso mudaram"</string>
+    <string name="wifi_softap_config_change_summary" msgid="8946397286141531087">"Toque para ver os detalhes"</string>
 </resources>
diff --git a/packages/SettingsProvider/res/values-pt-rPT/strings.xml b/packages/SettingsProvider/res/values-pt-rPT/strings.xml
index be88cce..a8a8e07 100644
--- a/packages/SettingsProvider/res/values-pt-rPT/strings.xml
+++ b/packages/SettingsProvider/res/values-pt-rPT/strings.xml
@@ -20,7 +20,6 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="4567566098528588863">"Armazenamento de definições"</string>
-    <string name="wifi_softap_config_change" msgid="5338670993556993667">"Alterações às definições de zona Wi-Fi"</string>
-    <string name="wifi_softap_config_change_summary" msgid="7600005249167787750">"A banda da sua zona Wi-Fi foi alterada."</string>
-    <string name="wifi_softap_config_change_detailed" msgid="2504664754843959730">"Este dispositivo não suporta a sua preferência apenas para 5 GHz. Em alternativa, este dispositivo vai utilizar a banda de 5 GHz quando estiver disponível."</string>
+    <string name="wifi_softap_config_change" msgid="5688373762357941645">"As definições da zona Wi-Fi foram alteradas"</string>
+    <string name="wifi_softap_config_change_summary" msgid="8946397286141531087">"Toque para ver os detalhes."</string>
 </resources>
diff --git a/packages/SettingsProvider/res/values-pt/strings.xml b/packages/SettingsProvider/res/values-pt/strings.xml
index 18db8f6..a860018 100644
--- a/packages/SettingsProvider/res/values-pt/strings.xml
+++ b/packages/SettingsProvider/res/values-pt/strings.xml
@@ -20,7 +20,6 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="4567566098528588863">"Armazenamento de configurações"</string>
-    <string name="wifi_softap_config_change" msgid="5338670993556993667">"Mudanças nas suas configurações de ponto de acesso"</string>
-    <string name="wifi_softap_config_change_summary" msgid="7600005249167787750">"Sua banda de ponto de acesso foi modificada."</string>
-    <string name="wifi_softap_config_change_detailed" msgid="2504664754843959730">"Este dispositivo não é compatível com sua preferência apenas por 5 GHz. Em vez disso, o dispositivo usará a banda de 5 GHz quando ela estiver disponível."</string>
+    <string name="wifi_softap_config_change" msgid="5688373762357941645">"As configurações de ponto de acesso mudaram"</string>
+    <string name="wifi_softap_config_change_summary" msgid="8946397286141531087">"Toque para ver os detalhes"</string>
 </resources>
diff --git a/packages/SettingsProvider/res/values-ro/strings.xml b/packages/SettingsProvider/res/values-ro/strings.xml
index 3a234e1..561a213 100644
--- a/packages/SettingsProvider/res/values-ro/strings.xml
+++ b/packages/SettingsProvider/res/values-ro/strings.xml
@@ -20,7 +20,6 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="4567566098528588863">"Stocare setări"</string>
-    <string name="wifi_softap_config_change" msgid="5338670993556993667">"Modificări aduse setărilor pentru hotspot"</string>
-    <string name="wifi_softap_config_change_summary" msgid="7600005249167787750">"S-a schimbat banda de frecvență a hotspotului."</string>
-    <string name="wifi_softap_config_change_detailed" msgid="2504664754843959730">"Dispozitivul nu acceptă doar preferința pentru 5 GHz. Dispozitivul va folosi banda de 5 GHz când este disponibilă."</string>
+    <string name="wifi_softap_config_change" msgid="5688373762357941645">"Setările hotspotului s-au modificat"</string>
+    <string name="wifi_softap_config_change_summary" msgid="8946397286141531087">"Atingeți pentru detalii"</string>
 </resources>
diff --git a/packages/SettingsProvider/res/values-ru/strings.xml b/packages/SettingsProvider/res/values-ru/strings.xml
index 184afdd..331fae1 100644
--- a/packages/SettingsProvider/res/values-ru/strings.xml
+++ b/packages/SettingsProvider/res/values-ru/strings.xml
@@ -20,7 +20,6 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="4567566098528588863">"Хранилище настроек"</string>
-    <string name="wifi_softap_config_change" msgid="5338670993556993667">"Изменения в настройках точки доступа"</string>
-    <string name="wifi_softap_config_change_summary" msgid="7600005249167787750">"Частота точки доступа изменена."</string>
-    <string name="wifi_softap_config_change_detailed" msgid="2504664754843959730">"Устройство не может работать только на частоте 5 ГГц. Эта частота будет использоваться, когда это возможно."</string>
+    <string name="wifi_softap_config_change" msgid="5688373762357941645">"Настройки точки доступа изменены"</string>
+    <string name="wifi_softap_config_change_summary" msgid="8946397286141531087">"Нажмите, чтобы узнать больше."</string>
 </resources>
diff --git a/packages/SettingsProvider/res/values-si/strings.xml b/packages/SettingsProvider/res/values-si/strings.xml
index 69e04f1..a9c4d0b 100644
--- a/packages/SettingsProvider/res/values-si/strings.xml
+++ b/packages/SettingsProvider/res/values-si/strings.xml
@@ -20,7 +20,6 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="4567566098528588863">"සැකසීම් ගබඩාව"</string>
-    <string name="wifi_softap_config_change" msgid="5338670993556993667">"ඔබගේ හොට්ස්පොට් සැකසීම්වලට වෙනස් කිරීම්"</string>
-    <string name="wifi_softap_config_change_summary" msgid="7600005249167787750">"ඔබගේ හොට්ස්පොට් කලාපය වෙනස් වී ඇත."</string>
-    <string name="wifi_softap_config_change_detailed" msgid="2504664754843959730">"මෙම උපාංගය 5GHz සඳහා ඔබේ මනාපවලට සහාය නොදක්වයි. ඒ වෙනුවට, මෙම උපාංගය ලබා ගත හැකි විට 5GHz කලාපය භාවිතා කරනු ඇත."</string>
+    <string name="wifi_softap_config_change" msgid="5688373762357941645">"හොට්ස්පොට් සැකසීම් වෙනස් කර ඇත"</string>
+    <string name="wifi_softap_config_change_summary" msgid="8946397286141531087">"විස්තර බැලීමට තට්ටු කරන්න"</string>
 </resources>
diff --git a/packages/SettingsProvider/res/values-sk/strings.xml b/packages/SettingsProvider/res/values-sk/strings.xml
index a53178d..5712d05 100644
--- a/packages/SettingsProvider/res/values-sk/strings.xml
+++ b/packages/SettingsProvider/res/values-sk/strings.xml
@@ -20,7 +20,6 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="4567566098528588863">"Ukladací priestor nastavení"</string>
-    <string name="wifi_softap_config_change" msgid="5338670993556993667">"Zmeny nastavení hotspotu"</string>
-    <string name="wifi_softap_config_change_summary" msgid="7600005249167787750">"Pásmo vášho hotspotu sa zmenilo."</string>
-    <string name="wifi_softap_config_change_detailed" msgid="2504664754843959730">"Toto zariadenie nepodporuje vašu predvoľbu používať iba 5 GHz. Namiesto toho bude pásmo 5 GHz používať vtedy, keď bude k dispozícii."</string>
+    <string name="wifi_softap_config_change" msgid="5688373762357941645">"Nastavenia hotspotu boli zmenené"</string>
+    <string name="wifi_softap_config_change_summary" msgid="8946397286141531087">"Klepnutím zobrazíte podrobnosti"</string>
 </resources>
diff --git a/packages/SettingsProvider/res/values-sl/strings.xml b/packages/SettingsProvider/res/values-sl/strings.xml
index ea697fe..4e265fb 100644
--- a/packages/SettingsProvider/res/values-sl/strings.xml
+++ b/packages/SettingsProvider/res/values-sl/strings.xml
@@ -20,7 +20,6 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="4567566098528588863">"Shramba nastavitev"</string>
-    <string name="wifi_softap_config_change" msgid="5338670993556993667">"Spremembe nastavitev dostopne točke"</string>
-    <string name="wifi_softap_config_change_summary" msgid="7600005249167787750">"Pas dostopne točke je spremenjen."</string>
-    <string name="wifi_softap_config_change_detailed" msgid="2504664754843959730">"Ta naprava ne podpira prednostne nastavitve samo za 5-GHz pas. Namesto tega bo ta naprava uporabljala 5-GHz pas, ko bo na voljo."</string>
+    <string name="wifi_softap_config_change" msgid="5688373762357941645">"Nastavitve dostopne ročke so spremenjene"</string>
+    <string name="wifi_softap_config_change_summary" msgid="8946397286141531087">"Dotaknite se za ogled podrobnosti"</string>
 </resources>
diff --git a/packages/SettingsProvider/res/values-sq/strings.xml b/packages/SettingsProvider/res/values-sq/strings.xml
index a111576..8bbe2e7 100644
--- a/packages/SettingsProvider/res/values-sq/strings.xml
+++ b/packages/SettingsProvider/res/values-sq/strings.xml
@@ -20,7 +20,6 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="4567566098528588863">"Hapësira ruajtëse e \"Cilësimeve\""</string>
-    <string name="wifi_softap_config_change" msgid="5338670993556993667">"Ndryshimet në cilësimet e zonës së qasjes për internet"</string>
-    <string name="wifi_softap_config_change_summary" msgid="7600005249167787750">"Brezi yt i zonës së qasjes për internet ka ndryshuar."</string>
-    <string name="wifi_softap_config_change_detailed" msgid="2504664754843959730">"Kjo pajisje nuk e mbështet preferencën për vetëm 5 GHz. Përkundrazi, pajisja do të përdorë brezin 5 GHz nëse ka."</string>
+    <string name="wifi_softap_config_change" msgid="5688373762357941645">"Cilësimet e zonës së qasjes për internet kanë ndryshuar"</string>
+    <string name="wifi_softap_config_change_summary" msgid="8946397286141531087">"Trokit për të parë detajet"</string>
 </resources>
diff --git a/packages/SettingsProvider/res/values-sr/strings.xml b/packages/SettingsProvider/res/values-sr/strings.xml
index d473102..4d05762 100644
--- a/packages/SettingsProvider/res/values-sr/strings.xml
+++ b/packages/SettingsProvider/res/values-sr/strings.xml
@@ -20,7 +20,6 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="4567566098528588863">"Подешавања складишта"</string>
-    <string name="wifi_softap_config_change" msgid="5338670993556993667">"Промене подешавања за хотспот"</string>
-    <string name="wifi_softap_config_change_summary" msgid="7600005249167787750">"Опсег хотспота је промењен."</string>
-    <string name="wifi_softap_config_change_detailed" msgid="2504664754843959730">"Овај уређај не подржава подешавање само за 5 GHz. Уређај ће користити опсег од 5 GHz када буде доступан."</string>
+    <string name="wifi_softap_config_change" msgid="5688373762357941645">"Подешавања хотспота су промењена"</string>
+    <string name="wifi_softap_config_change_summary" msgid="8946397286141531087">"Додирните да бисте видели детаље"</string>
 </resources>
diff --git a/packages/SettingsProvider/res/values-sv/strings.xml b/packages/SettingsProvider/res/values-sv/strings.xml
index fea3e5e..5ee4703 100644
--- a/packages/SettingsProvider/res/values-sv/strings.xml
+++ b/packages/SettingsProvider/res/values-sv/strings.xml
@@ -20,7 +20,6 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="4567566098528588863">"Lagring av inställningar"</string>
-    <string name="wifi_softap_config_change" msgid="5338670993556993667">"Ändringar i inställningarna för surfzon"</string>
-    <string name="wifi_softap_config_change_summary" msgid="7600005249167787750">"Frekvensbandet för surfzonen har ändrats."</string>
-    <string name="wifi_softap_config_change_detailed" msgid="2504664754843959730">"Den här enheten har inte stöd för inställningen för att endast använda 5 GHz. I stället används 5 GHz när det är möjligt."</string>
+    <string name="wifi_softap_config_change" msgid="5688373762357941645">"Inställningarna för surfzon har ändrats"</string>
+    <string name="wifi_softap_config_change_summary" msgid="8946397286141531087">"Tryck här för mer information"</string>
 </resources>
diff --git a/packages/SettingsProvider/res/values-sw/strings.xml b/packages/SettingsProvider/res/values-sw/strings.xml
index 4d05817..59f82a9 100644
--- a/packages/SettingsProvider/res/values-sw/strings.xml
+++ b/packages/SettingsProvider/res/values-sw/strings.xml
@@ -20,7 +20,6 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="4567566098528588863">"Hifadhi ya Mipangilio"</string>
-    <string name="wifi_softap_config_change" msgid="5338670993556993667">"Mabadiliko kwenye mipangilio ya mtandaopepe"</string>
-    <string name="wifi_softap_config_change_summary" msgid="7600005249167787750">"Bendi ya mtandaopepe wako imebadilika."</string>
-    <string name="wifi_softap_config_change_detailed" msgid="2504664754843959730">"Kifaa hiki hakitumii mapendeleo yako ya GHz 5 pekee. Badala yake, kifaa hiki kitatumia bendi ya GHz 5 itakapopatikana."</string>
+    <string name="wifi_softap_config_change" msgid="5688373762357941645">"Mipangilio ya mtandaopepe imebadilika"</string>
+    <string name="wifi_softap_config_change_summary" msgid="8946397286141531087">"Gusa ili uangalie maelezo"</string>
 </resources>
diff --git a/packages/SettingsProvider/res/values-ta/strings.xml b/packages/SettingsProvider/res/values-ta/strings.xml
index f518a78..fa6b8cd 100644
--- a/packages/SettingsProvider/res/values-ta/strings.xml
+++ b/packages/SettingsProvider/res/values-ta/strings.xml
@@ -20,7 +20,8 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="4567566098528588863">"அமைப்புகளின் சேமிப்பிடம்"</string>
-    <string name="wifi_softap_config_change" msgid="5338670993556993667">"உங்கள் ஹாட்ஸ்பாட் அமைப்புகளில் செய்யப்பட்டுள்ள மாற்றங்கள்"</string>
-    <string name="wifi_softap_config_change_summary" msgid="7600005249167787750">"உங்கள் ஹாட்ஸ்பாட்டின் அலைவரிசை வரம்பு மாறிவிட்டது."</string>
-    <string name="wifi_softap_config_change_detailed" msgid="2504664754843959730">"இந்தச் சாதனத்தில், ’5GHz மட்டும்’ எனும் முன்னுரிமைத் தேர்வு ஆதரிக்கப்படவில்லை. எனினும் 5GHz அலைவரிசை வரம்பிற்குள் இருக்கும்போது சாதனம் அதைப் பயன்படுத்திக்கொள்ளும்."</string>
+    <!-- no translation found for wifi_softap_config_change (5688373762357941645) -->
+    <skip />
+    <!-- no translation found for wifi_softap_config_change_summary (8946397286141531087) -->
+    <skip />
 </resources>
diff --git a/packages/SettingsProvider/res/values-te/strings.xml b/packages/SettingsProvider/res/values-te/strings.xml
index 6c59223..b1955ed 100644
--- a/packages/SettingsProvider/res/values-te/strings.xml
+++ b/packages/SettingsProvider/res/values-te/strings.xml
@@ -20,7 +20,8 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="4567566098528588863">"సెట్టింగ్‌ల నిల్వ"</string>
-    <string name="wifi_softap_config_change" msgid="5338670993556993667">"మీ హాట్‌స్పాట్ సెట్టింగ్‌లకు మార్పులు"</string>
-    <string name="wifi_softap_config_change_summary" msgid="7600005249167787750">"మీ హాట్‌స్పాట్ బ్యాండ్ మార్చబడింది."</string>
-    <string name="wifi_softap_config_change_detailed" msgid="2504664754843959730">"ఈ పరికరం 5GHz కోసం మాత్రమే మీ ప్రాధాన్యతకు మద్దతు ఇవ్వదు. బదులుగా, ఈ పరికరం అందుబాటులో ఉన్నప్పుడు 5GHz బ్యాండ్‌ను ఉపయోగిస్తుంది."</string>
+    <!-- no translation found for wifi_softap_config_change (5688373762357941645) -->
+    <skip />
+    <!-- no translation found for wifi_softap_config_change_summary (8946397286141531087) -->
+    <skip />
 </resources>
diff --git a/packages/SettingsProvider/res/values-th/strings.xml b/packages/SettingsProvider/res/values-th/strings.xml
index 4bf148f..ed63174 100644
--- a/packages/SettingsProvider/res/values-th/strings.xml
+++ b/packages/SettingsProvider/res/values-th/strings.xml
@@ -20,7 +20,6 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="4567566098528588863">"ที่เก็บข้อมูลการตั้งค่า"</string>
-    <string name="wifi_softap_config_change" msgid="5338670993556993667">"มีการเปลี่ยนแปลงการตั้งค่าฮอตสปอต"</string>
-    <string name="wifi_softap_config_change_summary" msgid="7600005249167787750">"ย่านความถี่ฮอตสปอตมีการเปลี่ยนแปลง"</string>
-    <string name="wifi_softap_config_change_detailed" msgid="2504664754843959730">"อุปกรณ์นี้ไม่รองรับค่ากำหนดของคุณเฉพาะสำหรับ 5 GHz เท่านั้น และจะใช้ย่านความถี่ 5 GHz แทน เมื่อใช้ได้"</string>
+    <string name="wifi_softap_config_change" msgid="5688373762357941645">"การตั้งค่าฮอตสปอตมีการเปลี่ยนแปลง"</string>
+    <string name="wifi_softap_config_change_summary" msgid="8946397286141531087">"แตะเพื่อดูรายละเอียด"</string>
 </resources>
diff --git a/packages/SettingsProvider/res/values-tl/strings.xml b/packages/SettingsProvider/res/values-tl/strings.xml
index 2a36d58..3d6be40 100644
--- a/packages/SettingsProvider/res/values-tl/strings.xml
+++ b/packages/SettingsProvider/res/values-tl/strings.xml
@@ -20,7 +20,6 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="4567566098528588863">"Storage ng Mga Setting"</string>
-    <string name="wifi_softap_config_change" msgid="5338670993556993667">"Mga pagbabago sa mga setting ng iyong hotspot"</string>
-    <string name="wifi_softap_config_change_summary" msgid="7600005249167787750">"Nagbago ang band ng iyong hotspot."</string>
-    <string name="wifi_softap_config_change_detailed" msgid="2504664754843959730">"Hindi sinusuportahan ng device na ito ang kagustuhan mong gumamit lang ng 5GHz. Sa halip, gagamitin ng device na ito ang 5GHz na band kapag available."</string>
+    <string name="wifi_softap_config_change" msgid="5688373762357941645">"Nabago ang mga setting ng hotspot"</string>
+    <string name="wifi_softap_config_change_summary" msgid="8946397286141531087">"I-tap para makita ang mga detalye"</string>
 </resources>
diff --git a/packages/SettingsProvider/res/values-tr/strings.xml b/packages/SettingsProvider/res/values-tr/strings.xml
index add1fdb..75e908f 100644
--- a/packages/SettingsProvider/res/values-tr/strings.xml
+++ b/packages/SettingsProvider/res/values-tr/strings.xml
@@ -20,7 +20,6 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="4567566098528588863">"Ayarlar Deposu"</string>
-    <string name="wifi_softap_config_change" msgid="5338670993556993667">"Hotspot ayarlarınız değişti"</string>
-    <string name="wifi_softap_config_change_summary" msgid="7600005249167787750">"Hotspot bandınız değişti."</string>
-    <string name="wifi_softap_config_change_detailed" msgid="2504664754843959730">"Bu cihaz yalnızca 5 GHz bandının kullanılmasına yönelik tercihinizi desteklemiyor. Bunun yerine, bu cihaz 5 GHz bandını mevcut olduğunda kullanacak."</string>
+    <string name="wifi_softap_config_change" msgid="5688373762357941645">"Hotspot ayarları değişti"</string>
+    <string name="wifi_softap_config_change_summary" msgid="8946397286141531087">"Ayrıntıları görmek için dokunun"</string>
 </resources>
diff --git a/packages/SettingsProvider/res/values-uk/strings.xml b/packages/SettingsProvider/res/values-uk/strings.xml
index cd678bc..2dbb360 100644
--- a/packages/SettingsProvider/res/values-uk/strings.xml
+++ b/packages/SettingsProvider/res/values-uk/strings.xml
@@ -20,7 +20,6 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="4567566098528588863">"Сховище налаштувань"</string>
-    <string name="wifi_softap_config_change" msgid="5338670993556993667">"Зміни в налаштуваннях точки доступу"</string>
-    <string name="wifi_softap_config_change_summary" msgid="7600005249167787750">"Діапазон частот точки доступу змінено."</string>
-    <string name="wifi_softap_config_change_detailed" msgid="2504664754843959730">"На цьому пристрої не підтримується налаштування \"Лише 5 ГГц\". Натомість буде використано діапазон частот 5 ГГц (якщо доступно)."</string>
+    <string name="wifi_softap_config_change" msgid="5688373762357941645">"Налаштування точки доступу змінились"</string>
+    <string name="wifi_softap_config_change_summary" msgid="8946397286141531087">"Торкніться, щоб переглянути докладні відомості"</string>
 </resources>
diff --git a/packages/SettingsProvider/res/values-ur/strings.xml b/packages/SettingsProvider/res/values-ur/strings.xml
index 2241ce9..2ce44b1 100644
--- a/packages/SettingsProvider/res/values-ur/strings.xml
+++ b/packages/SettingsProvider/res/values-ur/strings.xml
@@ -20,7 +20,8 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="4567566098528588863">"ترتیبات کا اسٹوریج"</string>
-    <string name="wifi_softap_config_change" msgid="5338670993556993667">"اپنے ہاٹ اسپاٹ کی ترتیبات میں تبدیلیاں"</string>
-    <string name="wifi_softap_config_change_summary" msgid="7600005249167787750">"آپ کا ہاٹ اسپات بینڈ تبدیل ہو گیا ہے۔"</string>
-    <string name="wifi_softap_config_change_detailed" msgid="2504664754843959730">"‏یہ آلہ صرف 5GHz کے لیے آپ کی ترجیح کو سپورٹ نہیں کرے گا۔ بلکہ 5GHz بینڈ کے دستیاب ہونے پر اس کا استعمال کرے گا۔"</string>
+    <!-- no translation found for wifi_softap_config_change (5688373762357941645) -->
+    <skip />
+    <!-- no translation found for wifi_softap_config_change_summary (8946397286141531087) -->
+    <skip />
 </resources>
diff --git a/packages/SettingsProvider/res/values-uz/strings.xml b/packages/SettingsProvider/res/values-uz/strings.xml
index a266bf0..bb6e22e 100644
--- a/packages/SettingsProvider/res/values-uz/strings.xml
+++ b/packages/SettingsProvider/res/values-uz/strings.xml
@@ -20,7 +20,6 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="4567566098528588863">"Sozlamalar xotirasi"</string>
-    <string name="wifi_softap_config_change" msgid="5338670993556993667">"Hotspot sozlamalari o‘zgartirildi"</string>
-    <string name="wifi_softap_config_change_summary" msgid="7600005249167787750">"Hotspot chastotasi oʻzgartirildi."</string>
-    <string name="wifi_softap_config_change_detailed" msgid="2504664754843959730">"Qurilma faqat 5 GGs chastotada ishlay olmaydi. Bu chastotadan imkoniyatga qarab foydalaniladi."</string>
+    <string name="wifi_softap_config_change" msgid="5688373762357941645">"Hotspot sozlamalari oʻzgardi"</string>
+    <string name="wifi_softap_config_change_summary" msgid="8946397286141531087">"Tafsilotlar uchun bosing"</string>
 </resources>
diff --git a/packages/SettingsProvider/res/values-vi/strings.xml b/packages/SettingsProvider/res/values-vi/strings.xml
index 74f93b2..4608983 100644
--- a/packages/SettingsProvider/res/values-vi/strings.xml
+++ b/packages/SettingsProvider/res/values-vi/strings.xml
@@ -20,7 +20,6 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="4567566098528588863">"Lưu trữ bộ nhớ"</string>
-    <string name="wifi_softap_config_change" msgid="5338670993556993667">"Những thay đổi trong mục cài đặt điểm phát sóng của bạn"</string>
-    <string name="wifi_softap_config_change_summary" msgid="7600005249167787750">"Bằng tần của điểm phát sóng đã thay đổi."</string>
-    <string name="wifi_softap_config_change_detailed" msgid="2504664754843959730">"Thiết bị này không hỗ trợ tùy chọn chỉ sử dụng băng tần 5 GHz. Thay vào đó, thiết bị này sẽ sử dụng băng tần 5 GHz khi có thể."</string>
+    <string name="wifi_softap_config_change" msgid="5688373762357941645">"Đã thay đổi các tùy chọn cài đặt điểm phát sóng"</string>
+    <string name="wifi_softap_config_change_summary" msgid="8946397286141531087">"Nhấn để xem chi tiết"</string>
 </resources>
diff --git a/packages/SettingsProvider/res/values-zh-rCN/strings.xml b/packages/SettingsProvider/res/values-zh-rCN/strings.xml
index 95b15e0..a08afc8 100644
--- a/packages/SettingsProvider/res/values-zh-rCN/strings.xml
+++ b/packages/SettingsProvider/res/values-zh-rCN/strings.xml
@@ -20,7 +20,6 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="4567566098528588863">"设置存储"</string>
-    <string name="wifi_softap_config_change" msgid="5338670993556993667">"您的热点设置已变更"</string>
-    <string name="wifi_softap_config_change_summary" msgid="7600005249167787750">"您的热点频段已变更。"</string>
-    <string name="wifi_softap_config_change_detailed" msgid="2504664754843959730">"此设备不支持您的偏好设置(仅限 5GHz),而且会在 5GHz 频段可用时使用该频段。"</string>
+    <string name="wifi_softap_config_change" msgid="5688373762357941645">"热点设置已更改"</string>
+    <string name="wifi_softap_config_change_summary" msgid="8946397286141531087">"点按即可查看详细信息"</string>
 </resources>
diff --git a/packages/SettingsProvider/res/values-zh-rHK/strings.xml b/packages/SettingsProvider/res/values-zh-rHK/strings.xml
index 41ebe27..fb91dbb 100644
--- a/packages/SettingsProvider/res/values-zh-rHK/strings.xml
+++ b/packages/SettingsProvider/res/values-zh-rHK/strings.xml
@@ -20,7 +20,6 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="4567566098528588863">"設定儲存空間"</string>
-    <string name="wifi_softap_config_change" msgid="5338670993556993667">"您的熱點設定變更"</string>
-    <string name="wifi_softap_config_change_summary" msgid="7600005249167787750">"您的熱點頻段已變更。"</string>
-    <string name="wifi_softap_config_change_detailed" msgid="2504664754843959730">"此裝置不支援只限 5 GHz 的偏好設定,但會在 5 GHz 頻段可用時採用。"</string>
+    <string name="wifi_softap_config_change" msgid="5688373762357941645">"熱點設定已變更"</string>
+    <string name="wifi_softap_config_change_summary" msgid="8946397286141531087">"輕按以查看詳情"</string>
 </resources>
diff --git a/packages/SettingsProvider/res/values-zh-rTW/strings.xml b/packages/SettingsProvider/res/values-zh-rTW/strings.xml
index d0a30f5..1b8fcb2 100644
--- a/packages/SettingsProvider/res/values-zh-rTW/strings.xml
+++ b/packages/SettingsProvider/res/values-zh-rTW/strings.xml
@@ -20,7 +20,6 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="4567566098528588863">"設定儲存空間"</string>
-    <string name="wifi_softap_config_change" msgid="5338670993556993667">"無線基地台設定變更"</string>
-    <string name="wifi_softap_config_change_summary" msgid="7600005249167787750">"你的無線基地台頻帶已變更。"</string>
-    <string name="wifi_softap_config_change_detailed" msgid="2504664754843959730">"這部裝置不支援你的偏好設定 (僅限 5GHz),而是會在 5GHz 可用時使用該頻帶。"</string>
+    <string name="wifi_softap_config_change" msgid="5688373762357941645">"無線基地台設定有所變更"</string>
+    <string name="wifi_softap_config_change_summary" msgid="8946397286141531087">"輕觸即可查看詳細資料"</string>
 </resources>
diff --git a/packages/SettingsProvider/res/values-zu/strings.xml b/packages/SettingsProvider/res/values-zu/strings.xml
index 0440b3b..dad24b4 100644
--- a/packages/SettingsProvider/res/values-zu/strings.xml
+++ b/packages/SettingsProvider/res/values-zu/strings.xml
@@ -20,7 +20,6 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="4567566098528588863">"Izilungiselelo zesitoreji"</string>
-    <string name="wifi_softap_config_change" msgid="5338670993556993667">"Ushintsho kuzilungiselelo zakho ze-hotspot"</string>
-    <string name="wifi_softap_config_change_summary" msgid="7600005249167787750">"Ibhendi yakho ye-hotspot ishintshile."</string>
-    <string name="wifi_softap_config_change_detailed" msgid="2504664754843959730">"Le divayisi ayisekeli okuncamelayo kwe-5GHz kuphela. Kunalokho, le divayisi izosebenzisa ibhendi ye-5GHz uma itholakala."</string>
+    <string name="wifi_softap_config_change" msgid="5688373762357941645">"Izilungiselelo ze-Hotspot zishintshile"</string>
+    <string name="wifi_softap_config_change_summary" msgid="8946397286141531087">"Thepha ukuze ubone imininingwane"</string>
 </resources>
diff --git a/packages/SettingsProvider/test/src/android/provider/SettingsBackupTest.java b/packages/SettingsProvider/test/src/android/provider/SettingsBackupTest.java
index bf817b1..4dc372a 100644
--- a/packages/SettingsProvider/test/src/android/provider/SettingsBackupTest.java
+++ b/packages/SettingsProvider/test/src/android/provider/SettingsBackupTest.java
@@ -579,7 +579,8 @@
                     Settings.Global.MODEM_STACK_ENABLED_FOR_SLOT,
                     Settings.Global.POWER_BUTTON_LONG_PRESS,
                     Settings.Global.POWER_BUTTON_VERY_LONG_PRESS,
-                    Settings.Global.INTEGRITY_CHECK_INCLUDES_RULE_PROVIDER);
+                    Settings.Global.INTEGRITY_CHECK_INCLUDES_RULE_PROVIDER,
+                    Settings.Global.ADVANCED_BATTERY_USAGE_AMOUNT);
 
     private static final Set<String> BACKUP_BLACKLISTED_SECURE_SETTINGS =
              newHashSet(
diff --git a/packages/SystemUI/res/layout/qs_carrier.xml b/packages/SystemUI/res/layout/qs_carrier.xml
index 28b2d21..a5b8cfa 100644
--- a/packages/SystemUI/res/layout/qs_carrier.xml
+++ b/packages/SystemUI/res/layout/qs_carrier.xml
@@ -14,7 +14,7 @@
   ~ limitations under the License
   -->
 
-<com.android.systemui.qs.QSCarrier
+<com.android.systemui.qs.carrier.QSCarrier
     xmlns:android="http://schemas.android.com/apk/res/android"
     android:id="@+id/linear_carrier"
     android:layout_width="wrap_content"
@@ -46,4 +46,4 @@
         android:singleLine="true"
         android:maxEms="7"/>
 
-</com.android.systemui.qs.QSCarrier>
\ No newline at end of file
+</com.android.systemui.qs.carrier.QSCarrier>
\ No newline at end of file
diff --git a/packages/SystemUI/res/layout/qs_carrier_group.xml b/packages/SystemUI/res/layout/qs_carrier_group.xml
index f2b0606..fd53a8b 100644
--- a/packages/SystemUI/res/layout/qs_carrier_group.xml
+++ b/packages/SystemUI/res/layout/qs_carrier_group.xml
@@ -15,7 +15,7 @@
   -->
 
 <!-- Extends LinearLayout -->
-<com.android.systemui.qs.QSCarrierGroup
+<com.android.systemui.qs.carrier.QSCarrierGroup
     xmlns:android="http://schemas.android.com/apk/res/android"
     android:id="@+id/qs_mobile"
     android:layout_width="0dp"
@@ -71,4 +71,4 @@
         android:layout_weight="1"
         android:visibility="gone"/>
 
-</com.android.systemui.qs.QSCarrierGroup>
\ No newline at end of file
+</com.android.systemui.qs.carrier.QSCarrierGroup>
\ No newline at end of file
diff --git a/packages/SystemUI/res/values/strings.xml b/packages/SystemUI/res/values/strings.xml
index ef9e705..5e9feff 100644
--- a/packages/SystemUI/res/values/strings.xml
+++ b/packages/SystemUI/res/values/strings.xml
@@ -1784,7 +1784,7 @@
     <string name="bubble_overflow_empty_title">No recent bubbles</string>
 
     <!-- [CHAR LIMIT=NONE] Empty overflow subtitle -->
-    <string name="bubble_overflow_empty_subtitle">Recently dismissed bubbles will appear here for easy retrieval.</string>
+    <string name="bubble_overflow_empty_subtitle">Recent bubbles and dismissed bubbles will appear here.</string>
 
     <!-- Notification: Control panel: Label that displays when the app's notifications cannot be blocked. -->
     <string name="notification_unblockable_desc">These notifications can\'t be modified.</string>
diff --git a/packages/SystemUI/shared/src/com/android/systemui/shared/recents/ISystemUiProxy.aidl b/packages/SystemUI/shared/src/com/android/systemui/shared/recents/ISystemUiProxy.aidl
index 2d288ff..b1d39f5 100644
--- a/packages/SystemUI/shared/src/com/android/systemui/shared/recents/ISystemUiProxy.aidl
+++ b/packages/SystemUI/shared/src/com/android/systemui/shared/recents/ISystemUiProxy.aidl
@@ -123,4 +123,9 @@
      */
      void handleImageAsScreenshot(in Bitmap screenImage, in Rect locationInScreen,
               in Insets visibleInsets, int taskId) = 21;
+
+    /**
+     * Sets the split-screen divider minimized state
+     */
+    void setSplitScreenMinimized(boolean minimized) = 22;
 }
diff --git a/packages/SystemUI/shared/src/com/android/systemui/shared/system/SyncRtSurfaceTransactionApplierCompat.java b/packages/SystemUI/shared/src/com/android/systemui/shared/system/SyncRtSurfaceTransactionApplierCompat.java
index e80b437..7dcf4b0 100644
--- a/packages/SystemUI/shared/src/com/android/systemui/shared/system/SyncRtSurfaceTransactionApplierCompat.java
+++ b/packages/SystemUI/shared/src/com/android/systemui/shared/system/SyncRtSurfaceTransactionApplierCompat.java
@@ -24,6 +24,7 @@
 import android.os.Message;
 import android.os.Trace;
 import android.view.Surface;
+import android.view.SurfaceControl;
 import android.view.View;
 import android.view.ViewRootImpl;
 
@@ -39,7 +40,7 @@
 
     private static final int MSG_UPDATE_SEQUENCE_NUMBER = 0;
 
-    private final Surface mTargetSurface;
+    private final SurfaceControl mBarrierSurfaceControl;
     private final ViewRootImpl mTargetViewRootImpl;
     private final Handler mApplyHandler;
 
@@ -52,7 +53,8 @@
      */
     public SyncRtSurfaceTransactionApplierCompat(View targetView) {
         mTargetViewRootImpl = targetView != null ? targetView.getViewRootImpl() : null;
-        mTargetSurface = mTargetViewRootImpl != null ? mTargetViewRootImpl.mSurface : null;
+        mBarrierSurfaceControl = mTargetViewRootImpl != null
+            ? mTargetViewRootImpl.getRenderSurfaceControl() : null;
 
         mApplyHandler = new Handler(new Callback() {
             @Override
@@ -91,7 +93,7 @@
         mTargetViewRootImpl.registerRtFrameCallback(new HardwareRenderer.FrameDrawingCallback() {
             @Override
             public void onFrameDraw(long frame) {
-                if (mTargetSurface == null || !mTargetSurface.isValid()) {
+                if (mBarrierSurfaceControl == null || !mBarrierSurfaceControl.isValid()) {
                     Message.obtain(mApplyHandler, MSG_UPDATE_SEQUENCE_NUMBER, toApplySeqNo, 0)
                             .sendToTarget();
                     return;
@@ -102,7 +104,7 @@
                     SyncRtSurfaceTransactionApplierCompat.SurfaceParams surfaceParams =
                             params[i];
                     SurfaceControlCompat surface = surfaceParams.surface;
-                    t.deferTransactionUntil(surface, mTargetSurface, frame);
+                    t.deferTransactionUntil(surface, mBarrierSurfaceControl, frame);
                     applyParams(t, surfaceParams);
                 }
                 t.setEarlyWakeup();
diff --git a/packages/SystemUI/shared/src/com/android/systemui/shared/system/TransactionCompat.java b/packages/SystemUI/shared/src/com/android/systemui/shared/system/TransactionCompat.java
index 073688b..8f4926f 100644
--- a/packages/SystemUI/shared/src/com/android/systemui/shared/system/TransactionCompat.java
+++ b/packages/SystemUI/shared/src/com/android/systemui/shared/system/TransactionCompat.java
@@ -20,6 +20,7 @@
 import android.graphics.Rect;
 import android.view.Surface;
 import android.view.SurfaceControl.Transaction;
+import android.view.SurfaceControl;
 
 public class TransactionCompat {
 
@@ -87,8 +88,8 @@
     }
 
     public TransactionCompat deferTransactionUntil(SurfaceControlCompat surfaceControl,
-            Surface barrier, long frameNumber) {
-        mTransaction.deferTransactionUntilSurface(surfaceControl.mSurfaceControl, barrier,
+            SurfaceControl barrier, long frameNumber) {
+        mTransaction.deferTransactionUntil(surfaceControl.mSurfaceControl, barrier,
                 frameNumber);
         return this;
     }
@@ -102,4 +103,4 @@
         mTransaction.setColor(surfaceControl.mSurfaceControl, color);
         return this;
     }
-}
\ No newline at end of file
+}
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java b/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java
index e5f6d3c..9ba3860 100644
--- a/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java
+++ b/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java
@@ -95,6 +95,7 @@
 import com.android.systemui.shared.system.ActivityManagerWrapper;
 import com.android.systemui.shared.system.TaskStackChangeListener;
 import com.android.systemui.statusbar.phone.KeyguardBypassController;
+import com.android.systemui.util.Assert;
 
 import com.google.android.collect.Lists;
 
@@ -341,7 +342,7 @@
 
     @Override
     public void onTrustChanged(boolean enabled, int userId, int flags) {
-        checkIsHandlerThread();
+        Assert.isMainThread();
         mUserHasTrust.put(userId, enabled);
         for (int i = 0; i < mCallbacks.size(); i++) {
             KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get();
@@ -360,7 +361,7 @@
     }
 
     private void handleSimSubscriptionInfoChanged() {
-        checkIsHandlerThread();
+        Assert.isMainThread();
         if (DEBUG_SIM_STATES) {
             Log.v(TAG, "onSubscriptionInfoChanged()");
             List<SubscriptionInfo> sil = mSubscriptionManager
@@ -403,7 +404,7 @@
     }
 
     private void callbacksRefreshCarrierInfo() {
-        checkIsHandlerThread();
+        Assert.isMainThread();
         for (int i = 0; i < mCallbacks.size(); i++) {
             KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get();
             if (cb != null) {
@@ -466,7 +467,7 @@
 
     @Override
     public void onTrustManagedChanged(boolean managed, int userId) {
-        checkIsHandlerThread();
+        Assert.isMainThread();
         mUserTrustIsManaged.put(userId, managed);
         mUserTrustIsUsuallyManaged.put(userId, mTrustManager.isTrustUsuallyManaged(userId));
         for (int i = 0; i < mCallbacks.size(); i++) {
@@ -523,7 +524,7 @@
 
     @VisibleForTesting
     protected void onFingerprintAuthenticated(int userId) {
-        checkIsHandlerThread();
+        Assert.isMainThread();
         Trace.beginSection("KeyGuardUpdateMonitor#onFingerPrintAuthenticated");
         mUserFingerprintAuthenticated.put(userId, true);
         // Update/refresh trust state only if user can skip bouncer
@@ -549,7 +550,7 @@
     }
 
     private void handleFingerprintAuthFailed() {
-        checkIsHandlerThread();
+        Assert.isMainThread();
         for (int i = 0; i < mCallbacks.size(); i++) {
             KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get();
             if (cb != null) {
@@ -561,7 +562,7 @@
     }
 
     private void handleFingerprintAcquired(int acquireInfo) {
-        checkIsHandlerThread();
+        Assert.isMainThread();
         if (acquireInfo != FingerprintManager.FINGERPRINT_ACQUIRED_GOOD) {
             return;
         }
@@ -599,7 +600,7 @@
     }
 
     private void handleFingerprintHelp(int msgId, String helpString) {
-        checkIsHandlerThread();
+        Assert.isMainThread();
         for (int i = 0; i < mCallbacks.size(); i++) {
             KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get();
             if (cb != null) {
@@ -618,7 +619,7 @@
     };
 
     private void handleFingerprintError(int msgId, String errString) {
-        checkIsHandlerThread();
+        Assert.isMainThread();
         if (msgId == FingerprintManager.FINGERPRINT_ERROR_CANCELED && mHandler.hasCallbacks(
                 mCancelNotReceived)) {
             mHandler.removeCallbacks(mCancelNotReceived);
@@ -671,7 +672,7 @@
     }
 
     private void notifyFingerprintRunningStateChanged() {
-        checkIsHandlerThread();
+        Assert.isMainThread();
         for (int i = 0; i < mCallbacks.size(); i++) {
             KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get();
             if (cb != null) {
@@ -684,7 +685,7 @@
     @VisibleForTesting
     protected void onFaceAuthenticated(int userId) {
         Trace.beginSection("KeyGuardUpdateMonitor#onFaceAuthenticated");
-        checkIsHandlerThread();
+        Assert.isMainThread();
         mUserFaceAuthenticated.put(userId, true);
         // Update/refresh trust state only if user can skip bouncer
         if (getUserCanSkipBouncer(userId)) {
@@ -710,7 +711,7 @@
     }
 
     private void handleFaceAuthFailed() {
-        checkIsHandlerThread();
+        Assert.isMainThread();
         setFaceRunningState(BIOMETRIC_STATE_STOPPED);
         for (int i = 0; i < mCallbacks.size(); i++) {
             KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get();
@@ -723,7 +724,7 @@
     }
 
     private void handleFaceAcquired(int acquireInfo) {
-        checkIsHandlerThread();
+        Assert.isMainThread();
         if (acquireInfo != FaceManager.FACE_ACQUIRED_GOOD) {
             return;
         }
@@ -767,7 +768,7 @@
     }
 
     private void handleFaceHelp(int msgId, String helpString) {
-        checkIsHandlerThread();
+        Assert.isMainThread();
         if (DEBUG_FACE) Log.d(TAG, "Face help received: " + helpString);
         for (int i = 0; i < mCallbacks.size(); i++) {
             KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get();
@@ -787,7 +788,7 @@
     };
 
     private void handleFaceError(int msgId, String errString) {
-        checkIsHandlerThread();
+        Assert.isMainThread();
         if (DEBUG_FACE) Log.d(TAG, "Face error received: " + errString);
         if (msgId == FaceManager.FACE_ERROR_CANCELED && mHandler.hasCallbacks(mCancelNotReceived)) {
             mHandler.removeCallbacks(mCancelNotReceived);
@@ -842,7 +843,7 @@
     }
 
     private void notifyFaceRunningStateChanged() {
-        checkIsHandlerThread();
+        Assert.isMainThread();
         for (int i = 0; i < mCallbacks.size(); i++) {
             KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get();
             if (cb != null) {
@@ -853,7 +854,7 @@
     }
 
     private void handleFaceUnlockStateChanged(boolean running, int userId) {
-        checkIsHandlerThread();
+        Assert.isMainThread();
         mUserFaceUnlockRunning.put(userId, running);
         for (int i = 0; i < mCallbacks.size(); i++) {
             KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get();
@@ -965,7 +966,7 @@
      * Cached version of {@link TrustManager#isTrustUsuallyManaged(int)}.
      */
     public boolean isTrustUsuallyManaged(int userId) {
-        checkIsHandlerThread();
+        Assert.isMainThread();
         return mUserTrustIsUsuallyManaged.get(userId);
     }
 
@@ -996,7 +997,7 @@
     }
 
     private void notifyStrongAuthStateChanged(int userId) {
-        checkIsHandlerThread();
+        Assert.isMainThread();
         for (int i = 0; i < mCallbacks.size(); i++) {
             KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get();
             if (cb != null) {
@@ -1010,7 +1011,7 @@
     }
 
     private void dispatchErrorMessage(CharSequence message) {
-        checkIsHandlerThread();
+        Assert.isMainThread();
         for (int i = 0; i < mCallbacks.size(); i++) {
             KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get();
             if (cb != null) {
@@ -1323,7 +1324,7 @@
 
     protected void handleStartedWakingUp() {
         Trace.beginSection("KeyguardUpdateMonitor#handleStartedWakingUp");
-        checkIsHandlerThread();
+        Assert.isMainThread();
         updateBiometricListeningState();
         for (int i = 0; i < mCallbacks.size(); i++) {
             KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get();
@@ -1335,7 +1336,7 @@
     }
 
     protected void handleStartedGoingToSleep(int arg1) {
-        checkIsHandlerThread();
+        Assert.isMainThread();
         mLockIconPressed = false;
         clearBiometricRecognized();
         for (int i = 0; i < mCallbacks.size(); i++) {
@@ -1349,7 +1350,7 @@
     }
 
     protected void handleFinishedGoingToSleep(int arg1) {
-        checkIsHandlerThread();
+        Assert.isMainThread();
         mGoingToSleep = false;
         for (int i = 0; i < mCallbacks.size(); i++) {
             KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get();
@@ -1361,7 +1362,7 @@
     }
 
     private void handleScreenTurnedOn() {
-        checkIsHandlerThread();
+        Assert.isMainThread();
         for (int i = 0; i < mCallbacks.size(); i++) {
             KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get();
             if (cb != null) {
@@ -1373,7 +1374,7 @@
     private void handleScreenTurnedOff() {
         final String tag = "KeyguardUpdateMonitor#handleScreenTurnedOff";
         DejankUtils.startDetectingBlockingIpcs(tag);
-        checkIsHandlerThread();
+        Assert.isMainThread();
         mHardwareFingerprintUnavailableRetryCount = 0;
         mHardwareFaceUnavailableRetryCount = 0;
         for (int i = 0; i < mCallbacks.size(); i++) {
@@ -1386,7 +1387,7 @@
     }
 
     private void handleDreamingStateChanged(int dreamStart) {
-        checkIsHandlerThread();
+        Assert.isMainThread();
         mIsDreaming = dreamStart == 1;
         for (int i = 0; i < mCallbacks.size(); i++) {
             KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get();
@@ -1398,7 +1399,7 @@
     }
 
     private void handleUserInfoChanged(int userId) {
-        checkIsHandlerThread();
+        Assert.isMainThread();
         for (int i = 0; i < mCallbacks.size(); i++) {
             KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get();
             if (cb != null) {
@@ -1408,7 +1409,7 @@
     }
 
     private void handleUserUnlocked(int userId) {
-        checkIsHandlerThread();
+        Assert.isMainThread();
         mUserIsUnlocked.put(userId, true);
         mNeedsSlowUnlockTransition = resolveNeedsSlowUnlockTransition();
         for (int i = 0; i < mCallbacks.size(); i++) {
@@ -1420,20 +1421,22 @@
     }
 
     private void handleUserStopped(int userId) {
-        checkIsHandlerThread();
+        Assert.isMainThread();
         mUserIsUnlocked.put(userId, mUserManager.isUserUnlocked(userId));
     }
 
     @VisibleForTesting
     void handleUserRemoved(int userId) {
-        checkIsHandlerThread();
+        Assert.isMainThread();
         mUserIsUnlocked.delete(userId);
         mUserTrustIsUsuallyManaged.delete(userId);
     }
 
     @VisibleForTesting
     @Inject
-    protected KeyguardUpdateMonitor(Context context, @Main Looper mainLooper,
+    protected KeyguardUpdateMonitor(
+            Context context,
+            @Main Looper mainLooper,
             BroadcastDispatcher broadcastDispatcher,
             DumpController dumpController) {
         mContext = context;
@@ -1962,7 +1965,7 @@
      * @param hasLockscreenWallpaper Whether Keyguard has a lockscreen wallpaper.
      */
     public void setHasLockscreenWallpaper(boolean hasLockscreenWallpaper) {
-        checkIsHandlerThread();
+        Assert.isMainThread();
         if (hasLockscreenWallpaper != mHasLockscreenWallpaper) {
             mHasLockscreenWallpaper = hasLockscreenWallpaper;
             for (int i = 0; i < mCallbacks.size(); i++) {
@@ -1985,7 +1988,7 @@
      * Handle {@link #MSG_DPM_STATE_CHANGED}
      */
     private void handleDevicePolicyManagerStateChanged(int userId) {
-        checkIsHandlerThread();
+        Assert.isMainThread();
         updateFingerprintListeningState();
         updateSecondaryLockscreenRequirement(userId);
         for (int i = 0; i < mCallbacks.size(); i++) {
@@ -2000,7 +2003,7 @@
      * Handle {@link #MSG_USER_SWITCHING}
      */
     private void handleUserSwitching(int userId, IRemoteCallback reply) {
-        checkIsHandlerThread();
+        Assert.isMainThread();
         mUserTrustIsUsuallyManaged.put(userId, mTrustManager.isTrustUsuallyManaged(userId));
         for (int i = 0; i < mCallbacks.size(); i++) {
             KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get();
@@ -2018,7 +2021,7 @@
      * Handle {@link #MSG_USER_SWITCH_COMPLETE}
      */
     private void handleUserSwitchComplete(int userId) {
-        checkIsHandlerThread();
+        Assert.isMainThread();
         for (int i = 0; i < mCallbacks.size(); i++) {
             KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get();
             if (cb != null) {
@@ -2031,7 +2034,7 @@
      * Handle {@link #MSG_DEVICE_PROVISIONED}
      */
     private void handleDeviceProvisioned() {
-        checkIsHandlerThread();
+        Assert.isMainThread();
         for (int i = 0; i < mCallbacks.size(); i++) {
             KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get();
             if (cb != null) {
@@ -2049,7 +2052,7 @@
      * Handle {@link #MSG_PHONE_STATE_CHANGED}
      */
     private void handlePhoneStateChanged(String newState) {
-        checkIsHandlerThread();
+        Assert.isMainThread();
         if (DEBUG) Log.d(TAG, "handlePhoneStateChanged(" + newState + ")");
         if (TelephonyManager.EXTRA_STATE_IDLE.equals(newState)) {
             mPhoneState = TelephonyManager.CALL_STATE_IDLE;
@@ -2070,7 +2073,7 @@
      * Handle {@link #MSG_RINGER_MODE_CHANGED}
      */
     private void handleRingerModeChange(int mode) {
-        checkIsHandlerThread();
+        Assert.isMainThread();
         if (DEBUG) Log.d(TAG, "handleRingerModeChange(" + mode + ")");
         mRingMode = mode;
         for (int i = 0; i < mCallbacks.size(); i++) {
@@ -2085,7 +2088,7 @@
      * Handle {@link #MSG_TIME_UPDATE}
      */
     private void handleTimeUpdate() {
-        checkIsHandlerThread();
+        Assert.isMainThread();
         if (DEBUG) Log.d(TAG, "handleTimeUpdate");
         for (int i = 0; i < mCallbacks.size(); i++) {
             KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get();
@@ -2099,7 +2102,7 @@
      * Handle (@line #MSG_TIMEZONE_UPDATE}
      */
     private void handleTimeZoneUpdate(String timeZone) {
-        checkIsHandlerThread();
+        Assert.isMainThread();
         if (DEBUG) Log.d(TAG, "handleTimeZoneUpdate");
         for (int i = 0; i < mCallbacks.size(); i++) {
             KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get();
@@ -2115,7 +2118,7 @@
      * Handle {@link #MSG_BATTERY_UPDATE}
      */
     private void handleBatteryUpdate(BatteryStatus status) {
-        checkIsHandlerThread();
+        Assert.isMainThread();
         if (DEBUG) Log.d(TAG, "handleBatteryUpdate");
         final boolean batteryUpdateInteresting = isBatteryUpdateInteresting(mBatteryStatus, status);
         mBatteryStatus = status;
@@ -2134,7 +2137,7 @@
      */
     @VisibleForTesting
     void updateTelephonyCapable(boolean capable) {
-        checkIsHandlerThread();
+        Assert.isMainThread();
         if (capable == mTelephonyCapable) {
             return;
         }
@@ -2152,7 +2155,7 @@
      */
     @VisibleForTesting
     void handleSimStateChange(int subId, int slotId, int state) {
-        checkIsHandlerThread();
+        Assert.isMainThread();
         if (DEBUG_SIM_STATES) {
             Log.d(TAG, "handleSimStateChange(subId=" + subId + ", slotId="
                     + slotId + ", state=" + state + ")");
@@ -2236,7 +2239,7 @@
      * <p>Needs to be called from the main thread.
      */
     public void onKeyguardVisibilityChanged(boolean showing) {
-        checkIsHandlerThread();
+        Assert.isMainThread();
         Log.d(TAG, "onKeyguardVisibilityChanged(" + showing + ")");
         mKeyguardIsVisible = showing;
 
@@ -2279,7 +2282,7 @@
      * @see #sendKeyguardBouncerChanged(boolean)
      */
     private void handleKeyguardBouncerChanged(int bouncer) {
-        checkIsHandlerThread();
+        Assert.isMainThread();
         if (DEBUG) Log.d(TAG, "handleKeyguardBouncerChanged(" + bouncer + ")");
         boolean isBouncer = (bouncer == 1);
         mBouncer = isBouncer;
@@ -2305,7 +2308,7 @@
      * Handle {@link #MSG_REPORT_EMERGENCY_CALL_ACTION}
      */
     private void handleReportEmergencyCallAction() {
-        checkIsHandlerThread();
+        Assert.isMainThread();
         for (int i = 0; i < mCallbacks.size(); i++) {
             KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get();
             if (cb != null) {
@@ -2344,7 +2347,7 @@
      * @param callback The callback to remove
      */
     public void removeCallback(KeyguardUpdateMonitorCallback callback) {
-        checkIsHandlerThread();
+        Assert.isMainThread();
         if (DEBUG) {
             Log.v(TAG, "*** unregister callback for " + callback);
         }
@@ -2359,7 +2362,7 @@
      * @param callback The callback to register
      */
     public void registerCallback(KeyguardUpdateMonitorCallback callback) {
-        checkIsHandlerThread();
+        Assert.isMainThread();
         if (DEBUG) Log.v(TAG, "*** register callback for " + callback);
         // Prevent adding duplicate callbacks
 
@@ -2448,7 +2451,7 @@
         if (!bypassHandler) {
             mHandler.obtainMessage(MSG_REPORT_EMERGENCY_CALL_ACTION).sendToTarget();
         } else {
-            checkIsHandlerThread();
+            Assert.isMainThread();
             handleReportEmergencyCallAction();
         }
     }
@@ -2466,7 +2469,7 @@
     }
 
     public void clearBiometricRecognized() {
-        checkIsHandlerThread();
+        Assert.isMainThread();
         mUserFingerprintAuthenticated.clear();
         mUserFaceAuthenticated.clear();
         mTrustManager.clearAllBiometricRecognized(BiometricSourceType.FINGERPRINT);
@@ -2653,7 +2656,7 @@
     }
 
     private void updateLogoutEnabled() {
-        checkIsHandlerThread();
+        Assert.isMainThread();
         boolean logoutEnabled = mDevicePolicyManager.isLogoutEnabled();
         if (mLogoutEnabled != logoutEnabled) {
             mLogoutEnabled = logoutEnabled;
@@ -2667,13 +2670,6 @@
         }
     }
 
-    private void checkIsHandlerThread() {
-        if (!mHandler.getLooper().isCurrentThread()) {
-            Log.wtfStack(TAG, "must call on mHandler's thread "
-                    + mHandler.getLooper().getThread() + ", not " + Thread.currentThread());
-        }
-    }
-
     @Override
     public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
         pw.println("KeyguardUpdateMonitor state:");
diff --git a/packages/SystemUI/src/com/android/systemui/Dependency.java b/packages/SystemUI/src/com/android/systemui/Dependency.java
index d317b7e..69bc259 100644
--- a/packages/SystemUI/src/com/android/systemui/Dependency.java
+++ b/packages/SystemUI/src/com/android/systemui/Dependency.java
@@ -60,6 +60,7 @@
 import com.android.systemui.shared.system.ActivityManagerWrapper;
 import com.android.systemui.shared.system.DevicePolicyManagerWrapper;
 import com.android.systemui.shared.system.PackageManagerWrapper;
+import com.android.systemui.stackdivider.Divider;
 import com.android.systemui.statusbar.CommandQueue;
 import com.android.systemui.statusbar.NavigationBarController;
 import com.android.systemui.statusbar.NotificationListener;
@@ -327,6 +328,7 @@
     @Inject Lazy<DisplayImeController> mDisplayImeController;
     @Inject Lazy<RecordingController> mRecordingController;
     @Inject Lazy<ProtoTracer> mProtoTracer;
+    @Inject Lazy<Divider> mDivider;
 
     @Inject
     public Dependency() {
@@ -527,6 +529,7 @@
         mProviders.put(AutoHideController.class, mAutoHideController::get);
 
         mProviders.put(RecordingController.class, mRecordingController::get);
+        mProviders.put(Divider.class, mDivider::get);
 
         sDependency = this;
     }
diff --git a/packages/SystemUI/src/com/android/systemui/DockedStackExistsListener.java b/packages/SystemUI/src/com/android/systemui/DockedStackExistsListener.java
deleted file mode 100644
index 5c0df17..0000000
--- a/packages/SystemUI/src/com/android/systemui/DockedStackExistsListener.java
+++ /dev/null
@@ -1,92 +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.
- */
-
-package com.android.systemui;
-
-import android.os.RemoteException;
-import android.util.Log;
-import android.view.IDockedStackListener;
-import android.view.WindowManagerGlobal;
-
-import java.lang.ref.WeakReference;
-import java.util.ArrayList;
-import java.util.function.Consumer;
-
-/**
- * Utility wrapper to listen for whether or not a docked stack exists, to be
- * used for things like the different overview icon in that mode.
- */
-public class DockedStackExistsListener {
-
-    private static final String TAG = "DockedStackExistsListener";
-
-    private static ArrayList<WeakReference<Consumer<Boolean>>> sCallbacks = new ArrayList<>();
-    private static boolean mLastExists;
-
-    static {
-        try {
-            WindowManagerGlobal.getWindowManagerService().registerDockedStackListener(
-                    new IDockedStackListener.Stub() {
-                        @Override
-                        public void onDividerVisibilityChanged(boolean b) throws RemoteException {
-
-                        }
-
-                        @Override
-                        public void onDockedStackExistsChanged(boolean exists)
-                                throws RemoteException {
-                            DockedStackExistsListener.onDockedStackExistsChanged(exists);
-                        }
-
-                        @Override
-                        public void onDockedStackMinimizedChanged(boolean b, long l, boolean b1)
-                                throws RemoteException {
-
-                        }
-
-                        @Override
-                        public void onAdjustedForImeChanged(boolean b, long l)
-                                throws RemoteException {
-
-                        }
-
-                        @Override
-                        public void onDockSideChanged(int i) throws RemoteException {
-
-                        }
-                    });
-        } catch (RemoteException e) {
-            Log.e(TAG, "Failed registering docked stack exists listener", e);
-        }
-    }
-
-
-    private static void onDockedStackExistsChanged(boolean exists) {
-        mLastExists = exists;
-        synchronized (sCallbacks) {
-            sCallbacks.removeIf(wf -> {
-                Consumer<Boolean> l = wf.get();
-                if (l != null) l.accept(exists);
-                return l == null;
-            });
-        }
-    }
-
-    public static void register(Consumer<Boolean> callback) {
-        callback.accept(mLastExists);
-        synchronized (sCallbacks) {
-            sCallbacks.add(new WeakReference<>(callback));
-        }
-    }
-}
diff --git a/packages/SystemUI/src/com/android/systemui/ImageWallpaper.java b/packages/SystemUI/src/com/android/systemui/ImageWallpaper.java
index 03bc738..4473b01 100644
--- a/packages/SystemUI/src/com/android/systemui/ImageWallpaper.java
+++ b/packages/SystemUI/src/com/android/systemui/ImageWallpaper.java
@@ -168,12 +168,13 @@
         @Override
         public void onOffsetsChanged(float xOffset, float yOffset, float xOffsetStep,
                 float yOffsetStep, int xPixelOffset, int yPixelOffset) {
+            if (mWorker == null) return;
             mWorker.getThreadHandler().post(() -> mRenderer.updateOffsets(xOffset, yOffset));
         }
 
         @Override
         public void onAmbientModeChanged(boolean inAmbientMode, long animationDuration) {
-            if (!mNeedTransition) return;
+            if (mWorker == null || !mNeedTransition) return;
             final long duration = mShouldStopTransition ? 0 : animationDuration;
             if (DEBUG) {
                 Log.d(TAG, "onAmbientModeChanged: inAmbient=" + inAmbientMode
@@ -223,6 +224,7 @@
         @Override
         public void onSurfaceCreated(SurfaceHolder holder) {
             mShouldStopTransition = checkIfShouldStopTransition();
+            if (mWorker == null) return;
             mWorker.getThreadHandler().post(() -> {
                 mEglHelper.init(holder, needSupportWideColorGamut());
                 mRenderer.onSurfaceCreated();
@@ -231,6 +233,7 @@
 
         @Override
         public void onSurfaceChanged(SurfaceHolder holder, int format, int width, int height) {
+            if (mWorker == null) return;
             mWorker.getThreadHandler().post(() -> {
                 mRenderer.onSurfaceChanged(width, height);
                 mNeedRedraw = true;
@@ -239,6 +242,7 @@
 
         @Override
         public void onSurfaceRedrawNeeded(SurfaceHolder holder) {
+            if (mWorker == null) return;
             if (DEBUG) {
                 Log.d(TAG, "onSurfaceRedrawNeeded: mNeedRedraw=" + mNeedRedraw);
             }
@@ -267,7 +271,7 @@
         @Override
         public void onStatePostChange() {
             // When back to home, we try to release EGL, which is preserved in lock screen or aod.
-            if (mController.getState() == StatusBarState.SHADE) {
+            if (mWorker != null && mController.getState() == StatusBarState.SHADE) {
                 mWorker.getThreadHandler().post(this::scheduleFinishRendering);
             }
         }
@@ -356,10 +360,12 @@
         }
 
         private void cancelFinishRenderingTask() {
+            if (mWorker == null) return;
             mWorker.getThreadHandler().removeCallbacks(mFinishRenderingTask);
         }
 
         private void scheduleFinishRendering() {
+            if (mWorker == null) return;
             cancelFinishRenderingTask();
             mWorker.getThreadHandler().postDelayed(mFinishRenderingTask, DELAY_FINISH_RENDERING);
         }
diff --git a/packages/SystemUI/src/com/android/systemui/TransactionPool.java b/packages/SystemUI/src/com/android/systemui/TransactionPool.java
new file mode 100644
index 0000000..801cf8a
--- /dev/null
+++ b/packages/SystemUI/src/com/android/systemui/TransactionPool.java
@@ -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.
+ */
+
+package com.android.systemui;
+
+import android.util.Pools;
+import android.view.SurfaceControl;
+
+import javax.inject.Inject;
+import javax.inject.Singleton;
+
+/**
+ * Provides a synchronized pool of {@link SurfaceControl.Transaction}s to minimize allocations.
+ */
+@Singleton
+public class TransactionPool {
+    private final Pools.SynchronizedPool<SurfaceControl.Transaction> mTransactionPool =
+            new Pools.SynchronizedPool<>(4);
+
+    @Inject
+    TransactionPool() {
+    }
+
+    /** Gets a transaction from the pool. */
+    public SurfaceControl.Transaction acquire() {
+        SurfaceControl.Transaction t = mTransactionPool.acquire();
+        if (t == null) {
+            return new SurfaceControl.Transaction();
+        }
+        return t;
+    }
+
+    /**
+     * Return a transaction to the pool. DO NOT call {@link SurfaceControl.Transaction#close()} if
+     * returning to pool.
+     */
+    public void release(SurfaceControl.Transaction t) {
+        if (!mTransactionPool.release(t)) {
+            t.close();
+        }
+    }
+}
diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java
index 1f94dbd..de707b9 100644
--- a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java
+++ b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java
@@ -94,6 +94,7 @@
 import com.android.systemui.statusbar.phone.StatusBar;
 import com.android.systemui.statusbar.policy.ConfigurationController;
 import com.android.systemui.statusbar.policy.ZenModeController;
+import com.android.systemui.util.FloatingContentCoordinator;
 
 import java.io.FileDescriptor;
 import java.io.PrintWriter;
@@ -140,6 +141,7 @@
     @Nullable private BubbleStackView.SurfaceSynchronizer mSurfaceSynchronizer;
     private final NotificationGroupManager mNotificationGroupManager;
     private final ShadeController mShadeController;
+    private final FloatingContentCoordinator mFloatingContentCoordinator;
 
     private BubbleData mBubbleData;
     @Nullable private BubbleStackView mStackView;
@@ -284,11 +286,12 @@
             NotificationEntryManager entryManager,
             NotifPipeline notifPipeline,
             FeatureFlags featureFlags,
-            DumpController dumpController) {
+            DumpController dumpController,
+            FloatingContentCoordinator floatingContentCoordinator) {
         this(context, notificationShadeWindowController, statusBarStateController, shadeController,
                 data, null /* synchronizer */, configurationController, interruptionStateProvider,
                 zenModeController, notifUserManager, groupManager, entryManager,
-                notifPipeline, featureFlags, dumpController);
+                notifPipeline, featureFlags, dumpController, floatingContentCoordinator);
     }
 
     /**
@@ -308,13 +311,15 @@
             NotificationEntryManager entryManager,
             NotifPipeline notifPipeline,
             FeatureFlags featureFlags,
-            DumpController dumpController) {
+            DumpController dumpController,
+            FloatingContentCoordinator floatingContentCoordinator) {
         dumpController.registerDumpable(TAG, this);
         mContext = context;
         mShadeController = shadeController;
         mNotificationInterruptionStateProvider = interruptionStateProvider;
         mNotifUserManager = notifUserManager;
         mZenModeController = zenModeController;
+        mFloatingContentCoordinator = floatingContentCoordinator;
         mZenModeController.addCallback(new ZenModeController.Callback() {
             @Override
             public void onZenChanged(int zen) {
@@ -584,7 +589,8 @@
      */
     private void ensureStackViewCreated() {
         if (mStackView == null) {
-            mStackView = new BubbleStackView(mContext, mBubbleData, mSurfaceSynchronizer);
+            mStackView = new BubbleStackView(
+                    mContext, mBubbleData, mSurfaceSynchronizer, mFloatingContentCoordinator);
             ViewGroup nsv = mNotificationShadeWindowController.getNotificationShadeView();
             int bubbleScrimIndex = nsv.indexOfChild(nsv.findViewById(R.id.scrim_for_bubble));
             int stackIndex = bubbleScrimIndex + 1;  // Show stack above bubble scrim.
diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleData.java b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleData.java
index 8a5aad8..cf5a4d3 100644
--- a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleData.java
+++ b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleData.java
@@ -443,20 +443,7 @@
             mStateChange.orderChanged |= repackAll();
         }
 
-        if (reason == BubbleController.DISMISS_AGED) {
-            if (DEBUG_BUBBLE_DATA) {
-                Log.d(TAG, "overflowing bubble: " + bubbleToRemove);
-            }
-            mOverflowBubbles.add(0, bubbleToRemove);
-            if (mOverflowBubbles.size() == mMaxOverflowBubbles + 1) {
-                // Remove oldest bubble.
-                if (DEBUG_BUBBLE_DATA) {
-                    Log.d(TAG, "Overflow full. Remove bubble: " + mOverflowBubbles.get(
-                            mOverflowBubbles.size() - 1));
-                }
-                mOverflowBubbles.remove(mOverflowBubbles.size() - 1);
-            }
-        }
+        overflowBubble(reason, bubbleToRemove);
 
         // Note: If mBubbles.isEmpty(), then mSelectedBubble is now null.
         if (Objects.equals(mSelectedBubble, bubbleToRemove)) {
@@ -468,6 +455,25 @@
         maybeSendDeleteIntent(reason, bubbleToRemove.getEntry());
     }
 
+    void overflowBubble(@DismissReason int reason, Bubble bubble) {
+        if (reason == BubbleController.DISMISS_AGED
+                || reason == BubbleController.DISMISS_USER_GESTURE) {
+            if (DEBUG_BUBBLE_DATA) {
+                Log.d(TAG, "overflowing bubble: " + bubble);
+            }
+            mOverflowBubbles.add(0, bubble);
+
+            if (mOverflowBubbles.size() == mMaxOverflowBubbles + 1) {
+                // Remove oldest bubble.
+                if (DEBUG_BUBBLE_DATA) {
+                    Log.d(TAG, "Overflow full. Remove bubble: " + mOverflowBubbles.get(
+                            mOverflowBubbles.size() - 1));
+                }
+                mOverflowBubbles.remove(mOverflowBubbles.size() - 1);
+            }
+        }
+    }
+
     public void dismissAll(@DismissReason int reason) {
         if (DEBUG_BUBBLE_DATA) {
             Log.d(TAG, "dismissAll: reason=" + reason);
@@ -478,9 +484,7 @@
         setExpandedInternal(false);
         setSelectedBubbleInternal(null);
         while (!mBubbles.isEmpty()) {
-            Bubble bubble = mBubbles.remove(0);
-            maybeSendDeleteIntent(reason, bubble.getEntry());
-            mStateChange.bubbleRemoved(bubble, reason);
+            doRemove(mBubbles.get(0).getKey(), reason);
         }
         dispatchPendingChanges();
     }
diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleOverflowActivity.java b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleOverflowActivity.java
index 756c598..eb836b1 100644
--- a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleOverflowActivity.java
+++ b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleOverflowActivity.java
@@ -55,7 +55,6 @@
     private BubbleOverflowAdapter mAdapter;
     private RecyclerView mRecyclerView;
     private List<Bubble> mOverflowBubbles = new ArrayList<>();
-    private int mMaxBubbles;
 
     @Inject
     public BubbleOverflowActivity(BubbleController controller) {
@@ -68,7 +67,6 @@
         setContentView(R.layout.bubble_overflow_activity);
         setBackgroundColor();
 
-        mMaxBubbles = getResources().getInteger(R.integer.bubbles_max_rendered);
         mEmptyState = findViewById(R.id.bubble_overflow_empty_state);
         mRecyclerView = findViewById(R.id.bubble_overflow_recycler);
         mRecyclerView.setLayoutManager(
@@ -95,11 +93,7 @@
 
     void onDataChanged(List<Bubble> bubbles) {
         mOverflowBubbles.clear();
-        if (bubbles.size() > mMaxBubbles) {
-            mOverflowBubbles.addAll(bubbles.subList(mMaxBubbles, bubbles.size()));
-        } else {
-            mOverflowBubbles.addAll(bubbles);
-        }
+        mOverflowBubbles.addAll(bubbles);
         mAdapter.notifyDataSetChanged();
 
         if (mOverflowBubbles.isEmpty()) {
diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java
index 9a6295a..955edcf 100644
--- a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java
+++ b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java
@@ -72,6 +72,7 @@
 import com.android.systemui.bubbles.animation.PhysicsAnimationLayout;
 import com.android.systemui.bubbles.animation.StackAnimationController;
 import com.android.systemui.shared.system.SysUiStatsLog;
+import com.android.systemui.util.FloatingContentCoordinator;
 
 import java.io.FileDescriptor;
 import java.io.PrintWriter;
@@ -319,7 +320,8 @@
     private BubbleOverflow mBubbleOverflow;
 
     public BubbleStackView(Context context, BubbleData data,
-            @Nullable SurfaceSynchronizer synchronizer) {
+            @Nullable SurfaceSynchronizer synchronizer,
+            FloatingContentCoordinator floatingContentCoordinator) {
         super(context);
 
         mBubbleData = data;
@@ -353,7 +355,7 @@
         mExpandedViewPadding = res.getDimensionPixelSize(R.dimen.bubble_expanded_view_padding);
         int elevation = res.getDimensionPixelSize(R.dimen.bubble_elevation);
 
-        mStackAnimationController = new StackAnimationController();
+        mStackAnimationController = new StackAnimationController(floatingContentCoordinator);
 
         mExpandedAnimationController = new ExpandedAnimationController(
                 mDisplaySize, mExpandedViewPadding, res.getConfiguration().orientation);
@@ -620,16 +622,16 @@
             mBubbleData.setExpanded(true);
             return true;
         } else if (action == R.id.action_move_top_left) {
-            mStackAnimationController.springStack(stackBounds.left, stackBounds.top);
+            mStackAnimationController.springStackAfterFling(stackBounds.left, stackBounds.top);
             return true;
         } else if (action == R.id.action_move_top_right) {
-            mStackAnimationController.springStack(stackBounds.right, stackBounds.top);
+            mStackAnimationController.springStackAfterFling(stackBounds.right, stackBounds.top);
             return true;
         } else if (action == R.id.action_move_bottom_left) {
-            mStackAnimationController.springStack(stackBounds.left, stackBounds.bottom);
+            mStackAnimationController.springStackAfterFling(stackBounds.left, stackBounds.bottom);
             return true;
         } else if (action == R.id.action_move_bottom_right) {
-            mStackAnimationController.springStack(stackBounds.right, stackBounds.bottom);
+            mStackAnimationController.springStackAfterFling(stackBounds.right, stackBounds.bottom);
             return true;
         }
         return false;
@@ -646,7 +648,7 @@
         String appName = topBubble.getAppName();
         Notification notification = topBubble.getEntry().getSbn().getNotification();
         CharSequence titleCharSeq = notification.extras.getCharSequence(Notification.EXTRA_TITLE);
-        String titleStr = getResources().getString(R.string.stream_notification);
+        String titleStr = getResources().getString(R.string.notification_bubble_title);
         if (titleCharSeq != null) {
             titleStr = titleCharSeq.toString();
         }
diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/animation/StackAnimationController.java b/packages/SystemUI/src/com/android/systemui/bubbles/animation/StackAnimationController.java
index 793f8b9..60c8c4e 100644
--- a/packages/SystemUI/src/com/android/systemui/bubbles/animation/StackAnimationController.java
+++ b/packages/SystemUI/src/com/android/systemui/bubbles/animation/StackAnimationController.java
@@ -16,8 +16,10 @@
 
 package com.android.systemui.bubbles.animation;
 
+import android.annotation.NonNull;
 import android.content.res.Resources;
 import android.graphics.PointF;
+import android.graphics.Rect;
 import android.graphics.RectF;
 import android.util.Log;
 import android.view.View;
@@ -31,6 +33,8 @@
 import androidx.dynamicanimation.animation.SpringForce;
 
 import com.android.systemui.R;
+import com.android.systemui.util.FloatingContentCoordinator;
+import com.android.systemui.util.animation.PhysicsAnimator;
 
 import com.google.android.collect.Sets;
 
@@ -95,6 +99,12 @@
      */
     private PointF mStackPosition = new PointF(-1, -1);
 
+    /**
+     * The area that Bubbles will occupy after all animations end. This is used to move other
+     * floating content out of the way proactively.
+     */
+    private Rect mAnimatingToBounds = new Rect();
+
     /** Whether or not the stack's start position has been set. */
     private boolean mStackMovedToStartPosition = false;
 
@@ -163,11 +173,70 @@
     /** Height of the status bar. */
     private float mStatusBarHeight;
 
+    /** FloatingContentCoordinator instance for resolving floating content conflicts. */
+    private FloatingContentCoordinator mFloatingContentCoordinator;
+
+    /**
+     * FloatingContent instance that returns the stack's location on the screen, and moves it when
+     * requested.
+     */
+    private final FloatingContentCoordinator.FloatingContent mStackFloatingContent =
+            new FloatingContentCoordinator.FloatingContent() {
+
+        private final Rect mFloatingBoundsOnScreen = new Rect();
+
+        @Override
+        public void moveToBounds(@NonNull Rect bounds) {
+            springStack(bounds.left, bounds.top, SpringForce.STIFFNESS_LOW);
+        }
+
+        @NonNull
+        @Override
+        public Rect getAllowedFloatingBoundsRegion() {
+            final Rect floatingBounds = getFloatingBoundsOnScreen();
+            final Rect allowableStackArea = new Rect();
+            getAllowableStackPositionRegion().roundOut(allowableStackArea);
+            allowableStackArea.right += floatingBounds.width();
+            allowableStackArea.bottom += floatingBounds.height();
+            return allowableStackArea;
+        }
+
+        @NonNull
+        @Override
+        public Rect getFloatingBoundsOnScreen() {
+            if (!mAnimatingToBounds.isEmpty()) {
+                return mAnimatingToBounds;
+            }
+
+            if (mLayout.getChildCount() > 0) {
+                // Calculate the bounds using stack position + bubble size so that we don't need to
+                // wait for the bubble views to lay out.
+                mFloatingBoundsOnScreen.set(
+                        (int) mStackPosition.x,
+                        (int) mStackPosition.y,
+                        (int) mStackPosition.x + mBubbleSize,
+                        (int) mStackPosition.y + mBubbleSize + mBubblePaddingTop);
+            } else {
+                mFloatingBoundsOnScreen.setEmpty();
+            }
+
+            return mFloatingBoundsOnScreen;
+        }
+    };
+
+    public StackAnimationController(
+            FloatingContentCoordinator floatingContentCoordinator) {
+        mFloatingContentCoordinator = floatingContentCoordinator;
+    }
+
     /**
      * Instantly move the first bubble to the given point, and animate the rest of the stack behind
      * it with the 'following' effect.
      */
     public void moveFirstBubbleWithStackFollowing(float x, float y) {
+        // If we're moving the bubble around, we're not animating to any bounds.
+        mAnimatingToBounds.setEmpty();
+
         // If we manually move the bubbles with the IME open, clear the return point since we don't
         // want the stack to snap away from the new position.
         mPreImeY = Float.MIN_VALUE;
@@ -204,23 +273,33 @@
      * Note that we need new SpringForce instances per animation despite identical configs because
      * SpringAnimation uses SpringForce's internal (changing) velocity while the animation runs.
      */
-    public void springStack(float destinationX, float destinationY) {
+    public void springStack(float destinationX, float destinationY, float stiffness) {
+        notifyFloatingCoordinatorStackAnimatingTo(destinationX, destinationY);
+
         springFirstBubbleWithStackFollowing(DynamicAnimation.TRANSLATION_X,
                 new SpringForce()
-                        .setStiffness(SPRING_AFTER_FLING_STIFFNESS)
+                        .setStiffness(stiffness)
                         .setDampingRatio(SPRING_AFTER_FLING_DAMPING_RATIO),
                 0 /* startXVelocity */,
                 destinationX);
 
         springFirstBubbleWithStackFollowing(DynamicAnimation.TRANSLATION_Y,
                 new SpringForce()
-                        .setStiffness(SPRING_AFTER_FLING_STIFFNESS)
+                        .setStiffness(stiffness)
                         .setDampingRatio(SPRING_AFTER_FLING_DAMPING_RATIO),
                 0 /* startYVelocity */,
                 destinationY);
     }
 
     /**
+     * Springs the stack to the specified x/y coordinates, with the stiffness used for springs after
+     * flings.
+     */
+    public void springStackAfterFling(float destinationX, float destinationY) {
+        springStack(destinationX, destinationY, SPRING_AFTER_FLING_STIFFNESS);
+    }
+
+    /**
      * Flings the stack starting with the given velocities, springing it to the nearest edge
      * afterward.
      *
@@ -253,6 +332,13 @@
         final float minimumVelocityToReachEdge =
                 (destinationRelativeX - x) * (FLING_FRICTION_X * 4.2f);
 
+        final float estimatedY = PhysicsAnimator.estimateFlingEndValue(
+                mStackPosition.y, velY,
+                new PhysicsAnimator.FlingConfig(
+                        FLING_FRICTION_Y, stackBounds.top, stackBounds.bottom));
+
+        notifyFloatingCoordinatorStackAnimatingTo(destinationRelativeX, estimatedY);
+
         // Use the touch event's velocity if it's sufficient, otherwise use the minimum velocity so
         // that it'll make it all the way to the side of the screen.
         final float startXVelocity = stackShouldFlingLeft
@@ -426,14 +512,28 @@
                             .setStiffness(SpringForce.STIFFNESS_LOW),
                     /* startVel */ 0f,
                     destinationY);
+
+            notifyFloatingCoordinatorStackAnimatingTo(mStackPosition.x, destinationY);
         }
     }
 
     /**
-     * Returns the region within which the stack is allowed to rest. This goes slightly off the left
+     * Notifies the floating coordinator that we're moving, and sets {@link #mAnimatingToBounds} so
+     * we return these bounds from
+     * {@link FloatingContentCoordinator.FloatingContent#getFloatingBoundsOnScreen()}.
+     */
+    private void notifyFloatingCoordinatorStackAnimatingTo(float x, float y) {
+        final Rect floatingBounds = mStackFloatingContent.getFloatingBoundsOnScreen();
+        floatingBounds.offsetTo((int) x, (int) y);
+        mAnimatingToBounds = floatingBounds;
+        mFloatingContentCoordinator.onContentMoved(mStackFloatingContent);
+    }
+
+    /**
+     * Returns the region that the stack position must stay within. This goes slightly off the left
      * and right sides of the screen, below the status bar/cutout and above the navigation bar.
-     * While the stack is not allowed to rest outside of these bounds, it can temporarily be
-     * animated or dragged beyond them.
+     * While the stack position is not allowed to rest outside of these bounds, it can temporarily
+     * be animated or dragged beyond them.
      */
     public RectF getAllowableStackPositionRegion() {
         final WindowInsets insets = mLayout.getRootWindowInsets();
@@ -690,6 +790,10 @@
             setStackPosition(mRestingStackPosition == null
                     ? getDefaultStartPosition()
                     : mRestingStackPosition);
+
+            // Remove the stack from the coordinator since we don't have any bubbles and aren't
+            // visible.
+            mFloatingContentCoordinator.onContentRemoved(mStackFloatingContent);
         }
     }
 
@@ -741,6 +845,10 @@
 
             // Animate in the top bubble now that we're visible.
             if (mLayout.getChildCount() > 0) {
+                // Add the stack to the floating content coordinator now that we have a bubble and
+                // are visible.
+                mFloatingContentCoordinator.onContentAdded(mStackFloatingContent);
+
                 animateInBubble(mLayout.getChildAt(0), 0 /* index */);
             }
         });
diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/dagger/BubbleModule.java b/packages/SystemUI/src/com/android/systemui/bubbles/dagger/BubbleModule.java
index 0337ee3..f057d0b 100644
--- a/packages/SystemUI/src/com/android/systemui/bubbles/dagger/BubbleModule.java
+++ b/packages/SystemUI/src/com/android/systemui/bubbles/dagger/BubbleModule.java
@@ -32,6 +32,7 @@
 import com.android.systemui.statusbar.phone.ShadeController;
 import com.android.systemui.statusbar.policy.ConfigurationController;
 import com.android.systemui.statusbar.policy.ZenModeController;
+import com.android.systemui.util.FloatingContentCoordinator;
 
 import javax.inject.Singleton;
 
@@ -60,7 +61,8 @@
             NotificationEntryManager entryManager,
             NotifPipeline notifPipeline,
             FeatureFlags featureFlags,
-            DumpController dumpController) {
+            DumpController dumpController,
+            FloatingContentCoordinator floatingContentCoordinator) {
         return new BubbleController(
                 context,
                 notificationShadeWindowController,
@@ -76,6 +78,7 @@
                 entryManager,
                 notifPipeline,
                 featureFlags,
-                dumpController);
+                dumpController,
+                floatingContentCoordinator);
     }
 }
diff --git a/packages/SystemUI/src/com/android/systemui/classifier/brightline/DistanceClassifier.java b/packages/SystemUI/src/com/android/systemui/classifier/brightline/DistanceClassifier.java
index 7f45cc8..0329183 100644
--- a/packages/SystemUI/src/com/android/systemui/classifier/brightline/DistanceClassifier.java
+++ b/packages/SystemUI/src/com/android/systemui/classifier/brightline/DistanceClassifier.java
@@ -38,10 +38,10 @@
 class DistanceClassifier extends FalsingClassifier {
 
     private static final float HORIZONTAL_FLING_THRESHOLD_DISTANCE_IN = 1;
-    private static final float VERTICAL_FLING_THRESHOLD_DISTANCE_IN = 1;
+    private static final float VERTICAL_FLING_THRESHOLD_DISTANCE_IN = 1.5f;
     private static final float HORIZONTAL_SWIPE_THRESHOLD_DISTANCE_IN = 3;
     private static final float VERTICAL_SWIPE_THRESHOLD_DISTANCE_IN = 3;
-    private static final float VELOCITY_TO_DISTANCE = 80f;
+    private static final float VELOCITY_TO_DISTANCE = 30f;
     private static final float SCREEN_FRACTION_MAX_DISTANCE = 0.8f;
 
     private final float mVerticalFlingThresholdPx;
diff --git a/packages/SystemUI/src/com/android/systemui/classifier/brightline/ZigZagClassifier.java b/packages/SystemUI/src/com/android/systemui/classifier/brightline/ZigZagClassifier.java
index 957ea8d..a796f3c 100644
--- a/packages/SystemUI/src/com/android/systemui/classifier/brightline/ZigZagClassifier.java
+++ b/packages/SystemUI/src/com/android/systemui/classifier/brightline/ZigZagClassifier.java
@@ -42,8 +42,8 @@
     // most swipes will follow somewhat of a 'C' or 'S' shape, we allow more deviance along the
     // `SECONDARY` axis.
     private static final float MAX_X_PRIMARY_DEVIANCE = .05f;
-    private static final float MAX_Y_PRIMARY_DEVIANCE = .1f;
-    private static final float MAX_X_SECONDARY_DEVIANCE = .6f;
+    private static final float MAX_Y_PRIMARY_DEVIANCE = .15f;
+    private static final float MAX_X_SECONDARY_DEVIANCE = .4f;
     private static final float MAX_Y_SECONDARY_DEVIANCE = .3f;
 
     private final float mMaxXPrimaryDeviance;
diff --git a/packages/SystemUI/src/com/android/systemui/controls/controller/ControlsBindingControllerImpl.kt b/packages/SystemUI/src/com/android/systemui/controls/controller/ControlsBindingControllerImpl.kt
index 87bdfa8..6ff1bbc 100644
--- a/packages/SystemUI/src/com/android/systemui/controls/controller/ControlsBindingControllerImpl.kt
+++ b/packages/SystemUI/src/com/android/systemui/controls/controller/ControlsBindingControllerImpl.kt
@@ -22,7 +22,6 @@
 import android.os.UserHandle
 import android.service.controls.Control
 import android.service.controls.IControlsActionCallback
-import android.service.controls.IControlsLoadCallback
 import android.service.controls.IControlsSubscriber
 import android.service.controls.IControlsSubscription
 import android.service.controls.actions.ControlAction
@@ -63,12 +62,6 @@
     private val componentMap: MutableMap<Key, ControlsProviderLifecycleManager> =
             ArrayMap<Key, ControlsProviderLifecycleManager>()
 
-    private val loadCallbackService = object : IControlsLoadCallback.Stub() {
-        override fun accept(token: IBinder, controls: MutableList<Control>) {
-            backgroundExecutor.execute(OnLoadRunnable(token, controls))
-        }
-    }
-
     private val actionCallbackService = object : IControlsActionCallback.Stub() {
         override fun accept(
             token: IBinder,
@@ -106,7 +99,6 @@
         return ControlsProviderLifecycleManager(
                 context,
                 backgroundExecutor,
-                loadCallbackService,
                 actionCallbackService,
                 subscriberService,
                 currentUser,
@@ -130,7 +122,7 @@
         callback: ControlsBindingController.LoadCallback
     ) {
         val provider = retrieveLifecycleManager(component)
-        provider.maybeBindAndLoad(callback)
+        provider.maybeBindAndLoad(LoadSubscriber(callback))
     }
 
     override fun subscribe(controls: List<ControlInfo>) {
@@ -216,7 +208,8 @@
 
     private inner class OnLoadRunnable(
         token: IBinder,
-        val list: List<Control>
+        val list: List<Control>,
+        val callback: ControlsBindingController.LoadCallback
     ) : CallbackRunnable(token) {
         override fun run() {
             if (provider == null) {
@@ -233,9 +226,7 @@
                     return
                 }
             }
-            provider.lastLoadCallback?.accept(list) ?: run {
-                Log.w(TAG, "Null callback")
-            }
+            callback.accept(list)
             provider.unbindService()
         }
     }
@@ -277,7 +268,7 @@
     ) : CallbackRunnable(token) {
         override fun run() {
             provider?.let {
-                Log.i(TAG, "onComplete receive from '${provider.componentName}'")
+                Log.i(TAG, "onComplete receive from '${it.componentName}'")
             }
         }
     }
@@ -288,7 +279,7 @@
     ) : CallbackRunnable(token) {
         override fun run() {
             provider?.let {
-                Log.e(TAG, "onError receive from '${provider.componentName}': $error")
+                Log.e(TAG, "onError receive from '${it.componentName}': $error")
             }
         }
     }
@@ -308,6 +299,44 @@
             }
         }
     }
+
+    private inner class OnLoadErrorRunnable(
+        token: IBinder,
+        val error: String,
+        val callback: ControlsBindingController.LoadCallback
+    ) : CallbackRunnable(token) {
+        override fun run() {
+            callback.error(error)
+            provider?.let {
+                Log.e(TAG, "onError receive from '${it.componentName}': $error")
+            }
+        }
+    }
+
+    private inner class LoadSubscriber(
+        val callback: ControlsBindingController.LoadCallback
+    ) : IControlsSubscriber.Stub() {
+        val loadedControls = ArrayList<Control>()
+        var hasError = false
+
+        override fun onSubscribe(token: IBinder, subs: IControlsSubscription) {
+            backgroundExecutor.execute(OnSubscribeRunnable(token, subs))
+        }
+
+        override fun onNext(token: IBinder, c: Control) {
+            backgroundExecutor.execute { loadedControls.add(c) }
+        }
+        override fun onError(token: IBinder, s: String) {
+            hasError = true
+            backgroundExecutor.execute(OnLoadErrorRunnable(token, s, callback))
+        }
+
+        override fun onComplete(token: IBinder) {
+            if (!hasError) {
+                backgroundExecutor.execute(OnLoadRunnable(token, loadedControls, callback))
+            }
+        }
+    }
 }
 
-private data class Key(val component: ComponentName, val user: UserHandle)
\ No newline at end of file
+private data class Key(val component: ComponentName, val user: UserHandle)
diff --git a/packages/SystemUI/src/com/android/systemui/controls/controller/ControlsFavoritePersistenceWrapper.kt b/packages/SystemUI/src/com/android/systemui/controls/controller/ControlsFavoritePersistenceWrapper.kt
index d7f3c73..883f8a9 100644
--- a/packages/SystemUI/src/com/android/systemui/controls/controller/ControlsFavoritePersistenceWrapper.kt
+++ b/packages/SystemUI/src/com/android/systemui/controls/controller/ControlsFavoritePersistenceWrapper.kt
@@ -135,7 +135,7 @@
     }
 
     private fun parseXml(parser: XmlPullParser): List<ControlInfo> {
-        var type = 0
+        var type: Int
         val infos = mutableListOf<ControlInfo>()
         while (parser.next().also { type = it } != XmlPullParser.END_DOCUMENT) {
             if (type == XmlPullParser.END_TAG || type == XmlPullParser.TEXT) {
diff --git a/packages/SystemUI/src/com/android/systemui/controls/controller/ControlsProviderLifecycleManager.kt b/packages/SystemUI/src/com/android/systemui/controls/controller/ControlsProviderLifecycleManager.kt
index 9ec71c7..a53fcd4 100644
--- a/packages/SystemUI/src/com/android/systemui/controls/controller/ControlsProviderLifecycleManager.kt
+++ b/packages/SystemUI/src/com/android/systemui/controls/controller/ControlsProviderLifecycleManager.kt
@@ -29,7 +29,6 @@
 import android.service.controls.ControlsProviderService.CALLBACK_BUNDLE
 import android.service.controls.ControlsProviderService.CALLBACK_TOKEN
 import android.service.controls.IControlsActionCallback
-import android.service.controls.IControlsLoadCallback
 import android.service.controls.IControlsProvider
 import android.service.controls.IControlsSubscriber
 import android.service.controls.IControlsSubscription
@@ -48,8 +47,6 @@
  *
  * @property context A SystemUI context for binding to the services
  * @property executor A delayable executor for posting timeouts
- * @property loadCallbackService a callback interface to hand the remote service for loading
- *                               controls
  * @property actionCallbackService a callback interface to hand the remote service for sending
  *                                 action responses
  * @property subscriberService an "subscriber" interface for requesting and accepting updates for
@@ -60,15 +57,12 @@
 class ControlsProviderLifecycleManager(
     private val context: Context,
     private val executor: DelayableExecutor,
-    private val loadCallbackService: IControlsLoadCallback.Stub,
     private val actionCallbackService: IControlsActionCallback.Stub,
     private val subscriberService: IControlsSubscriber.Stub,
     val user: UserHandle,
     val componentName: ComponentName
 ) : IBinder.DeathRecipient {
 
-    var lastLoadCallback: ControlsBindingController.LoadCallback? = null
-        private set
     val token: IBinder = Binder()
     @GuardedBy("subscriptions")
     private val subscriptions = mutableListOf<IControlsSubscription>()
@@ -156,9 +150,12 @@
             bindService(false)
             return
         }
-        if (Message.Load in queue) {
-            load()
+
+        queue.filter { it is Message.Load }.forEach {
+            val msg = it as Message.Load
+            load(msg.subscriber)
         }
+
         queue.filter { it is Message.Subscribe }.flatMap { (it as Message.Subscribe).list }.run {
             if (this.isNotEmpty()) {
                 subscribe(this)
@@ -193,12 +190,12 @@
         }
     }
 
-    private fun load() {
+    private fun load(subscriber: IControlsSubscriber.Stub) {
         if (DEBUG) {
             Log.d(TAG, "load $componentName")
         }
-        if (!(wrapper?.load(loadCallbackService) ?: false)) {
-            queueMessage(Message.Load)
+        if (!(wrapper?.load(subscriber) ?: false)) {
+            queueMessage(Message.Load(subscriber))
             binderDied()
         }
     }
@@ -213,27 +210,23 @@
     }
 
     /**
-     * Request a call to [ControlsProviderService.loadAvailableControls].
+     * Request a call to [IControlsProvider.load].
      *
      * If the service is not bound, the call will be queued and the service will be bound first.
-     * The service will be bound after the controls are returned or the call times out.
+     * The service will be unbound after the controls are returned or the call times out.
      *
-     * @param callback a callback in which to return the result back. If the call times out
-     *                 [ControlsBindingController.LoadCallback.error] will be called instead.
+     * @param subscriber the subscriber that manages coordination for loading controls
      */
-    fun maybeBindAndLoad(callback: ControlsBindingController.LoadCallback) {
+    fun maybeBindAndLoad(subscriber: IControlsSubscriber.Stub) {
         unqueueMessage(Message.Unbind)
-        lastLoadCallback = callback
         onLoadCanceller = executor.executeDelayed({
             // Didn't receive a response in time, log and send back error
             Log.d(TAG, "Timeout waiting onLoad for $componentName")
-            callback.error("Timeout waiting onLoad")
-            // Don't accept load callbacks after this
-            lastLoadCallback = null
+            subscriber.onError(token, "Timeout waiting onLoad")
             unbindService()
         }, LOAD_TIMEOUT_SECONDS, TimeUnit.SECONDS)
 
-        invokeOrQueue(::load, Message.Load)
+        invokeOrQueue({ load(subscriber) }, Message.Load(subscriber))
     }
 
     /**
@@ -324,7 +317,6 @@
      * Request unbind from the service.
      */
     fun unbindService() {
-        lastLoadCallback = null
         onLoadCanceller?.run()
         onLoadCanceller = null
 
@@ -344,7 +336,7 @@
      */
     sealed class Message {
         abstract val type: Int
-        object Load : Message() {
+        class Load(val subscriber: IControlsSubscriber.Stub) : Message() {
             override val type = MSG_LOAD
         }
         object Unbind : Message() {
diff --git a/packages/SystemUI/src/com/android/systemui/controls/controller/ServiceWrapper.kt b/packages/SystemUI/src/com/android/systemui/controls/controller/ServiceWrapper.kt
index b90f892..b2afd3c 100644
--- a/packages/SystemUI/src/com/android/systemui/controls/controller/ServiceWrapper.kt
+++ b/packages/SystemUI/src/com/android/systemui/controls/controller/ServiceWrapper.kt
@@ -18,7 +18,6 @@
 
 import android.service.controls.actions.ControlAction
 import android.service.controls.IControlsActionCallback
-import android.service.controls.IControlsLoadCallback
 import android.service.controls.IControlsProvider
 import android.service.controls.IControlsSubscriber
 import android.service.controls.IControlsSubscription
@@ -45,9 +44,9 @@
         }
     }
 
-    fun load(cb: IControlsLoadCallback): Boolean {
+    fun load(subscriber: IControlsSubscriber): Boolean {
         return callThroughService {
-            service.load(cb)
+            service.load(subscriber)
         }
     }
 
diff --git a/packages/SystemUI/src/com/android/systemui/controls/management/AppAdapter.kt b/packages/SystemUI/src/com/android/systemui/controls/management/AppAdapter.kt
index 89caace..ac5e089 100644
--- a/packages/SystemUI/src/com/android/systemui/controls/management/AppAdapter.kt
+++ b/packages/SystemUI/src/com/android/systemui/controls/management/AppAdapter.kt
@@ -58,13 +58,13 @@
     private var listOfServices = emptyList<CandidateInfo>()
 
     private val callback = object : ControlsListingController.ControlsListingCallback {
-        override fun onServicesUpdated(list: List<CandidateInfo>) {
+        override fun onServicesUpdated(candidates: List<CandidateInfo>) {
             backgroundExecutor.execute {
-                val collator = Collator.getInstance(resources.getConfiguration().locale)
+                val collator = Collator.getInstance(resources.configuration.locales[0])
                 val localeComparator = compareBy<CandidateInfo, CharSequence>(collator) {
                     it.loadLabel()
                 }
-                listOfServices = list.sortedWith(localeComparator)
+                listOfServices = candidates.sortedWith(localeComparator)
                 uiExecutor.execute(::notifyDataSetChanged)
             }
         }
diff --git a/packages/SystemUI/src/com/android/systemui/controls/management/ControlsFavoritingActivity.kt b/packages/SystemUI/src/com/android/systemui/controls/management/ControlsFavoritingActivity.kt
index 9952b97..af4a977 100644
--- a/packages/SystemUI/src/com/android/systemui/controls/management/ControlsFavoritingActivity.kt
+++ b/packages/SystemUI/src/com/android/systemui/controls/management/ControlsFavoritingActivity.kt
@@ -70,7 +70,7 @@
             target: RecyclerView.ViewHolder
         ): Boolean {
             return currentModel?.onMoveItem(
-                    viewHolder.adapterPosition, target.adapterPosition) != null
+                    viewHolder.layoutPosition, target.layoutPosition) != null
         }
 
         override fun onSwiped(viewHolder: RecyclerView.ViewHolder, direction: Int) {}
diff --git a/packages/SystemUI/src/com/android/systemui/controls/management/ControlsListingController.kt b/packages/SystemUI/src/com/android/systemui/controls/management/ControlsListingController.kt
index d893caa..8e47f64 100644
--- a/packages/SystemUI/src/com/android/systemui/controls/management/ControlsListingController.kt
+++ b/packages/SystemUI/src/com/android/systemui/controls/management/ControlsListingController.kt
@@ -45,6 +45,6 @@
 
     @FunctionalInterface
     interface ControlsListingCallback {
-        fun onServicesUpdated(list: List<CandidateInfo>)
+        fun onServicesUpdated(candidates: List<CandidateInfo>)
     }
 }
diff --git a/packages/SystemUI/src/com/android/systemui/controls/ui/ControlsUiControllerImpl.kt b/packages/SystemUI/src/com/android/systemui/controls/ui/ControlsUiControllerImpl.kt
index 98cdf28..f4fd375 100644
--- a/packages/SystemUI/src/com/android/systemui/controls/ui/ControlsUiControllerImpl.kt
+++ b/packages/SystemUI/src/com/android/systemui/controls/ui/ControlsUiControllerImpl.kt
@@ -130,8 +130,7 @@
     private val listingCallback = object : ControlsListingController.ControlsListingCallback {
         override fun onServicesUpdated(candidates: List<CandidateInfo>) {
             bgExecutor.execute {
-                val collator = Collator.getInstance(context.getResources()
-                        .getConfiguration().locale)
+                val collator = Collator.getInstance(context.resources.configuration.locales[0])
                 val localeComparator = compareBy<CandidateInfo, CharSequence>(collator) {
                     it.loadLabel()
                 }
diff --git a/packages/SystemUI/src/com/android/systemui/controls/ui/DetailDialog.kt b/packages/SystemUI/src/com/android/systemui/controls/ui/DetailDialog.kt
index 071198b..d3d4287 100644
--- a/packages/SystemUI/src/com/android/systemui/controls/ui/DetailDialog.kt
+++ b/packages/SystemUI/src/com/android/systemui/controls/ui/DetailDialog.kt
@@ -42,7 +42,7 @@
     val intent: PendingIntent
 ) : Dialog(parentContext) {
 
-    lateinit var activityView: ActivityView
+    var activityView: ActivityView
 
     val stateCallback: ActivityView.StateCallback = object : ActivityView.StateCallback() {
         override fun onActivityViewReady(view: ActivityView) {
@@ -61,24 +61,28 @@
         override fun onTaskRemovalStarted(taskId: Int) {}
     }
 
-    init {
-        val window = getWindow()
-        window.requestFeature(Window.FEATURE_NO_TITLE)
+    @Suppress("DEPRECATION")
+    private fun Window.setWindowParams() {
+        requestFeature(Window.FEATURE_NO_TITLE)
 
         // Inflate the decor view, so the attributes below are not overwritten by the theme.
-        window.getDecorView()
-        window.getAttributes().systemUiVisibility =
-            (window.getAttributes().systemUiVisibility
-                or View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
-                or View.SYSTEM_UI_FLAG_LAYOUT_STABLE)
+        decorView
+        attributes.systemUiVisibility =
+                (attributes.systemUiVisibility
+                        or View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
+                        or View.SYSTEM_UI_FLAG_LAYOUT_STABLE)
 
-        window.setLayout(MATCH_PARENT, MATCH_PARENT)
-        window.clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND)
-        window.addFlags(WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN
-            or WindowManager.LayoutParams.FLAG_LAYOUT_INSET_DECOR
-            or WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED)
-        window.setType(WindowManager.LayoutParams.TYPE_VOLUME_OVERLAY)
-        window.getAttributes().setFitInsetsTypes(0 /* types */)
+        setLayout(MATCH_PARENT, MATCH_PARENT)
+        clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND)
+        addFlags(WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN
+                or WindowManager.LayoutParams.FLAG_LAYOUT_INSET_DECOR
+                or WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED)
+        setType(WindowManager.LayoutParams.TYPE_VOLUME_OVERLAY)
+        getAttributes().setFitInsetsTypes(0 /* types */)
+    }
+
+    init {
+        getWindow()?.setWindowParams()
 
         setContentView(R.layout.controls_detail_dialog)
 
@@ -89,9 +93,9 @@
     }
 
     override fun show() {
-        val attrs = getWindow().getAttributes()
-        attrs.layoutInDisplayCutoutMode = LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS
-        getWindow().setAttributes(attrs)
+        val attrs = getWindow()?.attributes
+        attrs?.layoutInDisplayCutoutMode = LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS
+        getWindow()?.attributes = attrs
 
         activityView.setCallback(stateCallback)
 
diff --git a/packages/SystemUI/src/com/android/systemui/controls/ui/ToggleRangeBehavior.kt b/packages/SystemUI/src/com/android/systemui/controls/ui/ToggleRangeBehavior.kt
index 45d7397..cca56c2 100644
--- a/packages/SystemUI/src/com/android/systemui/controls/ui/ToggleRangeBehavior.kt
+++ b/packages/SystemUI/src/com/android/systemui/controls/ui/ToggleRangeBehavior.kt
@@ -60,7 +60,7 @@
 
         val gestureListener = ToggleRangeGestureListener(cvh.layout)
         val gestureDetector = GestureDetector(context, gestureListener)
-        cvh.layout.setOnTouchListener({ v: View, e: MotionEvent ->
+        cvh.layout.setOnTouchListener { _: View, e: MotionEvent ->
             if (gestureDetector.onTouchEvent(e)) {
                 return@setOnTouchListener true
             }
@@ -72,7 +72,7 @@
             }
 
             return@setOnTouchListener false
-        })
+        }
     }
 
     override fun bind(cws: ControlWithState) {
diff --git a/packages/SystemUI/src/com/android/systemui/dagger/SystemUIDefaultModule.java b/packages/SystemUI/src/com/android/systemui/dagger/SystemUIDefaultModule.java
index a57ec5b..3e257b6 100644
--- a/packages/SystemUI/src/com/android/systemui/dagger/SystemUIDefaultModule.java
+++ b/packages/SystemUI/src/com/android/systemui/dagger/SystemUIDefaultModule.java
@@ -38,8 +38,10 @@
 import com.android.systemui.statusbar.phone.HeadsUpManagerPhone;
 import com.android.systemui.statusbar.phone.KeyguardBypassController;
 import com.android.systemui.statusbar.phone.KeyguardEnvironmentImpl;
+import com.android.systemui.statusbar.phone.NotificationGroupManager;
 import com.android.systemui.statusbar.phone.ShadeController;
 import com.android.systemui.statusbar.phone.ShadeControllerImpl;
+import com.android.systemui.statusbar.policy.ConfigurationController;
 import com.android.systemui.statusbar.policy.DeviceProvisionedController;
 import com.android.systemui.statusbar.policy.DeviceProvisionedControllerImpl;
 import com.android.systemui.statusbar.policy.HeadsUpManager;
@@ -92,10 +94,14 @@
 
     @Singleton
     @Provides
-    static HeadsUpManagerPhone provideHeadsUpManagerPhone(Context context,
+    static HeadsUpManagerPhone provideHeadsUpManagerPhone(
+            Context context,
             StatusBarStateController statusBarStateController,
-            KeyguardBypassController bypassController) {
-        return new HeadsUpManagerPhone(context, statusBarStateController, bypassController);
+            KeyguardBypassController bypassController,
+            NotificationGroupManager groupManager,
+            ConfigurationController configurationController) {
+        return new HeadsUpManagerPhone(context, statusBarStateController, bypassController,
+                groupManager, configurationController);
     }
 
     @Binds
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java
index b1db7df..374153c 100644
--- a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java
+++ b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java
@@ -80,7 +80,8 @@
 import com.android.keyguard.KeyguardUpdateMonitor;
 import com.android.keyguard.KeyguardUpdateMonitorCallback;
 import com.android.keyguard.ViewMediatorCallback;
-import com.android.systemui.Dependency;
+import com.android.systemui.DumpController;
+import com.android.systemui.Dumpable;
 import com.android.systemui.R;
 import com.android.systemui.SystemUI;
 import com.android.systemui.SystemUIFactory;
@@ -144,7 +145,7 @@
  * directly to the keyguard UI is posted to a {@link android.os.Handler} to ensure it is taken on the UI
  * thread of the keyguard.
  */
-public class KeyguardViewMediator extends SystemUI {
+public class KeyguardViewMediator extends SystemUI implements Dumpable {
     private static final int KEYGUARD_DISPLAY_TIMEOUT_DELAY_DEFAULT = 30000;
     private static final long KEYGUARD_DONE_PENDING_TIMEOUT_MS = 3000;
 
@@ -222,10 +223,10 @@
     private final FalsingManager mFalsingManager;
 
     /** High level access to the power manager for WakeLocks */
-    private PowerManager mPM;
+    private final PowerManager mPM;
 
     /** TrustManager for letting it know when we change visibility */
-    private TrustManager mTrustManager;
+    private final TrustManager mTrustManager;
 
     /**
      * Used to keep the device awake while to ensure the keyguard finishes opening before
@@ -283,7 +284,7 @@
 
     // the properties of the keyguard
 
-    private KeyguardUpdateMonitor mUpdateMonitor;
+    private final KeyguardUpdateMonitor mUpdateMonitor;
 
     /**
      * Last SIM state reported by the telephony system.
@@ -610,6 +611,7 @@
         @Override
         public void keyguardGone() {
             Trace.beginSection("KeyguardViewMediator.mViewMediatorCallback#keyguardGone");
+            mNotificationShadeWindowController.setKeyguardGoingAway(false);
             mKeyguardDisplayManager.hide();
             Trace.endSection();
         }
@@ -696,7 +698,9 @@
             NotificationShadeWindowController notificationShadeWindowController,
             Lazy<StatusBarKeyguardViewManager> statusBarKeyguardViewManagerLazy,
             DismissCallbackRegistry dismissCallbackRegistry,
-            @UiBackground Executor uiBgExecutor) {
+            KeyguardUpdateMonitor keyguardUpdateMonitor, DumpController dumpController,
+            @UiBackground Executor uiBgExecutor, PowerManager powerManager,
+            TrustManager trustManager) {
         super(context);
         mFalsingManager = falsingManager;
         mLockPatternUtils = lockPatternUtils;
@@ -705,6 +709,10 @@
         mStatusBarKeyguardViewManagerLazy = statusBarKeyguardViewManagerLazy;
         mDismissCallbackRegistry = dismissCallbackRegistry;
         mUiBgExecutor = uiBgExecutor;
+        mUpdateMonitor = keyguardUpdateMonitor;
+        mPM = powerManager;
+        mTrustManager = trustManager;
+        dumpController.registerDumpable(this);
         mShowHomeOverLockscreen = DeviceConfig.getBoolean(
                 DeviceConfig.NAMESPACE_SYSTEMUI,
                 NAV_BAR_HANDLE_SHOW_OVER_LOCKSCREEN,
@@ -731,9 +739,6 @@
     }
 
     private void setupLocked() {
-        mPM = (PowerManager) mContext.getSystemService(Context.POWER_SERVICE);
-        mTrustManager = mContext.getSystemService(TrustManager.class);
-
         mShowKeyguardWakeLock = mPM.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "show keyguard");
         mShowKeyguardWakeLock.setReferenceCounted(false);
 
@@ -754,8 +759,6 @@
 
         mAlarmManager = (AlarmManager) mContext.getSystemService(Context.ALARM_SERVICE);
 
-        mUpdateMonitor = Dependency.get(KeyguardUpdateMonitor.class);
-
         KeyguardUpdateMonitor.setCurrentUser(ActivityManager.getCurrentUser());
 
         // Assume keyguard is showing (unless it's disabled) until we know for sure, unless Keyguard
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/dagger/KeyguardModule.java b/packages/SystemUI/src/com/android/systemui/keyguard/dagger/KeyguardModule.java
index 2c023ca..2ba0315 100644
--- a/packages/SystemUI/src/com/android/systemui/keyguard/dagger/KeyguardModule.java
+++ b/packages/SystemUI/src/com/android/systemui/keyguard/dagger/KeyguardModule.java
@@ -16,9 +16,13 @@
 
 package com.android.systemui.keyguard.dagger;
 
+import android.app.trust.TrustManager;
 import android.content.Context;
+import android.os.PowerManager;
 
 import com.android.internal.widget.LockPatternUtils;
+import com.android.keyguard.KeyguardUpdateMonitor;
+import com.android.systemui.DumpController;
 import com.android.systemui.broadcast.BroadcastDispatcher;
 import com.android.systemui.dagger.qualifiers.UiBackground;
 import com.android.systemui.keyguard.DismissCallbackRegistry;
@@ -54,6 +58,10 @@
             NotificationShadeWindowController notificationShadeWindowController,
             Lazy<StatusBarKeyguardViewManager> statusBarKeyguardViewManagerLazy,
             DismissCallbackRegistry dismissCallbackRegistry,
+            KeyguardUpdateMonitor updateMonitor,
+            DumpController dumpController,
+            PowerManager powerManager,
+            TrustManager trustManager,
             @UiBackground Executor uiBgExecutor) {
         return new KeyguardViewMediator(
                 context,
@@ -63,6 +71,10 @@
                 notificationShadeWindowController,
                 statusBarKeyguardViewManagerLazy,
                 dismissCallbackRegistry,
-                uiBgExecutor);
+                updateMonitor,
+                dumpController,
+                uiBgExecutor,
+                powerManager,
+                trustManager);
     }
 }
diff --git a/packages/SystemUI/src/com/android/systemui/pip/BasePipManager.java b/packages/SystemUI/src/com/android/systemui/pip/BasePipManager.java
index 383d459..adee7f2 100644
--- a/packages/SystemUI/src/com/android/systemui/pip/BasePipManager.java
+++ b/packages/SystemUI/src/com/android/systemui/pip/BasePipManager.java
@@ -20,6 +20,7 @@
 
 import java.io.PrintWriter;
 
+
 public interface BasePipManager {
     void showPictureInPictureMenu();
     default void expandPip() {}
diff --git a/packages/SystemUI/src/com/android/systemui/pip/phone/PipManager.java b/packages/SystemUI/src/com/android/systemui/pip/phone/PipManager.java
index b5c8d66..cb94e28 100644
--- a/packages/SystemUI/src/com/android/systemui/pip/phone/PipManager.java
+++ b/packages/SystemUI/src/com/android/systemui/pip/phone/PipManager.java
@@ -46,6 +46,7 @@
 import com.android.systemui.shared.system.PinnedStackListenerForwarder.PinnedStackListener;
 import com.android.systemui.shared.system.TaskStackChangeListener;
 import com.android.systemui.shared.system.WindowManagerWrapper;
+import com.android.systemui.util.FloatingContentCoordinator;
 import com.android.systemui.wm.DisplayChangeController;
 import com.android.systemui.wm.DisplayController;
 
@@ -229,7 +230,8 @@
 
     @Inject
     public PipManager(Context context, BroadcastDispatcher broadcastDispatcher,
-            DisplayController displayController) {
+            DisplayController displayController,
+            FloatingContentCoordinator floatingContentCoordinator) {
         mContext = context;
         mActivityManager = ActivityManager.getService();
         mActivityTaskManager = ActivityTaskManager.getService();
@@ -247,7 +249,8 @@
         mMenuController = new PipMenuActivityController(context, mActivityManager, mMediaController,
                 mInputConsumerController);
         mTouchHandler = new PipTouchHandler(context, mActivityManager, mActivityTaskManager,
-                mMenuController, mInputConsumerController, mPipBoundsHandler);
+                mMenuController, mInputConsumerController, mPipBoundsHandler,
+                floatingContentCoordinator);
         mAppOpsListener = new PipAppOpsListener(context, mActivityManager,
                 mTouchHandler.getMotionHelper());
         displayController.addDisplayChangingController(mRotationController);
diff --git a/packages/SystemUI/src/com/android/systemui/pip/phone/PipMotionHelper.java b/packages/SystemUI/src/com/android/systemui/pip/phone/PipMotionHelper.java
index 3ae627d..c6e2852 100644
--- a/packages/SystemUI/src/com/android/systemui/pip/phone/PipMotionHelper.java
+++ b/packages/SystemUI/src/com/android/systemui/pip/phone/PipMotionHelper.java
@@ -19,6 +19,7 @@
 import static android.app.WindowConfiguration.ACTIVITY_TYPE_UNDEFINED;
 import static android.app.WindowConfiguration.WINDOWING_MODE_PINNED;
 
+import android.annotation.NonNull;
 import android.annotation.Nullable;
 import android.app.ActivityManager.StackInfo;
 import android.app.IActivityManager;
@@ -41,6 +42,7 @@
 import com.android.systemui.pip.PipSnapAlgorithm;
 import com.android.systemui.shared.system.WindowManagerWrapper;
 import com.android.systemui.statusbar.FlingAnimationUtils;
+import com.android.systemui.util.FloatingContentCoordinator;
 import com.android.systemui.util.animation.FloatProperties;
 import com.android.systemui.util.animation.PhysicsAnimator;
 
@@ -49,7 +51,8 @@
 /**
  * A helper to animate and manipulate the PiP.
  */
-public class PipMotionHelper implements Handler.Callback, PipAppOpsListener.Callback {
+public class PipMotionHelper implements Handler.Callback, PipAppOpsListener.Callback,
+        FloatingContentCoordinator.FloatingContent {
 
     private static final String TAG = "PipMotionHelper";
     private static final boolean DEBUG = false;
@@ -85,6 +88,12 @@
     /** PIP's current bounds on the screen. */
     private final Rect mBounds = new Rect();
 
+    /** The bounds within which PIP's top-left coordinate is allowed to move. */
+    private Rect mMovementBounds = new Rect();
+
+    /** The region that all of PIP must stay within. */
+    private Rect mFloatingAllowedArea = new Rect();
+
     private final SfVsyncFrameCallbackProvider mSfVsyncFrameProvider =
             new SfVsyncFrameCallbackProvider();
 
@@ -93,6 +102,12 @@
      */
     private final Rect mAnimatedBounds = new Rect();
 
+    /** The destination bounds to which PIP is animating. */
+    private Rect mAnimatingToBounds = new Rect();
+
+    /** Coordinator instance for resolving conflicts with other floating content. */
+    private FloatingContentCoordinator mFloatingContentCoordinator;
+
     /**
      * PhysicsAnimator instance for animating {@link #mAnimatedBounds} using physics animations.
      */
@@ -119,9 +134,15 @@
             new PhysicsAnimator.SpringConfig(
                     SpringForce.STIFFNESS_MEDIUM, SpringForce.DAMPING_RATIO_LOW_BOUNCY);
 
+    /** SpringConfig to use for springing PIP away from conflicting floating content. */
+    private final PhysicsAnimator.SpringConfig mConflictResolutionSpringConfig =
+                new PhysicsAnimator.SpringConfig(
+                        SpringForce.STIFFNESS_LOW, SpringForce.DAMPING_RATIO_LOW_BOUNCY);
+
     public PipMotionHelper(Context context, IActivityManager activityManager,
             IActivityTaskManager activityTaskManager, PipMenuActivityController menuController,
-            PipSnapAlgorithm snapAlgorithm, FlingAnimationUtils flingAnimationUtils) {
+            PipSnapAlgorithm snapAlgorithm, FlingAnimationUtils flingAnimationUtils,
+            FloatingContentCoordinator floatingContentCoordinator) {
         mContext = context;
         mHandler = new Handler(ForegroundThread.get().getLooper(), this);
         mActivityManager = activityManager;
@@ -129,9 +150,27 @@
         mMenuController = menuController;
         mSnapAlgorithm = snapAlgorithm;
         mFlingAnimationUtils = flingAnimationUtils;
+        mFloatingContentCoordinator = floatingContentCoordinator;
         onConfigurationChanged();
     }
 
+    @NonNull
+    @Override
+    public Rect getFloatingBoundsOnScreen() {
+        return !mAnimatingToBounds.isEmpty() ? mAnimatingToBounds : mBounds;
+    }
+
+    @NonNull
+    @Override
+    public Rect getAllowedFloatingBoundsRegion() {
+        return mFloatingAllowedArea;
+    }
+
+    @Override
+    public void moveToBounds(@NonNull Rect bounds) {
+        animateToBounds(bounds, mConflictResolutionSpringConfig);
+    }
+
     /**
      * Updates whenever the configuration changes.
      */
@@ -157,9 +196,24 @@
     }
 
     /**
-     * Tries to the move the pinned stack to the given {@param bounds}.
+     * Tries to move the pinned stack to the given {@param bounds}.
      */
     void movePip(Rect toBounds) {
+        movePip(toBounds, false /* isDragging */);
+    }
+
+    /**
+     * Tries to move the pinned stack to the given {@param bounds}.
+     *
+     * @param isDragging Whether this movement is the result of a drag touch gesture. If so, we
+     *                   won't notify the floating content coordinator of this move, since that will
+     *                   happen when the gesture ends.
+     */
+    void movePip(Rect toBounds, boolean isDragging) {
+        if (!isDragging) {
+            mFloatingContentCoordinator.onContentMoved(this);
+        }
+
         cancelAnimations();
         resizePipUnchecked(toBounds);
         mBounds.set(toBounds);
@@ -211,6 +265,18 @@
         });
     }
 
+    /** Sets the movement bounds to use to constrain PIP position animations. */
+    void setCurrentMovementBounds(Rect movementBounds) {
+        mMovementBounds.set(movementBounds);
+        rebuildFlingConfigs();
+
+        // The movement bounds represent the area within which we can move PIP's top-left position.
+        // The allowed area for all of PIP is those bounds plus PIP's width and height.
+        mFloatingAllowedArea.set(mMovementBounds);
+        mFloatingAllowedArea.right += mBounds.width();
+        mFloatingAllowedArea.bottom += mBounds.height();
+    }
+
     /**
      * @return the PiP bounds.
      */
@@ -221,11 +287,11 @@
     /**
      * @return the closest minimized PiP bounds.
      */
-    Rect getClosestMinimizedBounds(Rect stackBounds, Rect movementBounds) {
+    Rect getClosestMinimizedBounds(Rect stackBounds) {
         Point displaySize = new Point();
         mContext.getDisplay().getRealSize(displaySize);
-        Rect toBounds = mSnapAlgorithm.findClosestSnapBounds(movementBounds, stackBounds);
-        mSnapAlgorithm.applyMinimizedOffset(toBounds, movementBounds, displaySize, mStableInsets);
+        Rect toBounds = mSnapAlgorithm.findClosestSnapBounds(mMovementBounds, stackBounds);
+        mSnapAlgorithm.applyMinimizedOffset(toBounds, mMovementBounds, displaySize, mStableInsets);
         return toBounds;
     }
 
@@ -264,11 +330,10 @@
     /**
      * Animates the PiP to the minimized state, slightly offscreen.
      */
-    void animateToClosestMinimizedState(Rect movementBounds, @Nullable Runnable updateAction) {
-        final Rect toBounds = getClosestMinimizedBounds(mBounds, movementBounds);
+    void animateToClosestMinimizedState(@Nullable Runnable updateAction) {
+        final Rect toBounds = getClosestMinimizedBounds(mBounds);
 
-        prepareForBoundsAnimation(movementBounds);
-
+        mAnimatedBounds.set(mBounds);
         mAnimatedBoundsPhysicsAnimator
                 .spring(FloatProperties.RECT_X, toBounds.left, mSpringConfig)
                 .spring(FloatProperties.RECT_Y, toBounds.top, mSpringConfig);
@@ -285,10 +350,8 @@
      * Flings the PiP to the closest snap target.
      */
     void flingToSnapTarget(
-            float velocityX, float velocityY, Rect movementBounds, Runnable updateAction,
-            @Nullable Runnable endAction) {
-        prepareForBoundsAnimation(movementBounds);
-
+            float velocityX, float velocityY, Runnable updateAction, @Nullable Runnable endAction) {
+        mAnimatedBounds.set(mBounds);
         mAnimatedBoundsPhysicsAnimator
                 .flingThenSpring(
                         FloatProperties.RECT_X, velocityX, mFlingConfigX, mSpringConfig,
@@ -298,21 +361,39 @@
                 .addUpdateListener((target, values) -> updateAction.run())
                 .withEndActions(endAction);
 
+        final float xEndValue = velocityX < 0 ? mMovementBounds.left : mMovementBounds.right;
+        final float estimatedFlingYEndValue =
+                PhysicsAnimator.estimateFlingEndValue(mBounds.top, velocityY, mFlingConfigY);
+
+        setAnimatingToBounds(new Rect(
+                (int) xEndValue,
+                (int) estimatedFlingYEndValue,
+                (int) xEndValue + mBounds.width(),
+                (int) estimatedFlingYEndValue + mBounds.height()));
+
         startBoundsAnimation();
     }
 
     /**
      * Animates the PiP to the closest snap target.
      */
-    void animateToClosestSnapTarget(Rect movementBounds) {
-        prepareForBoundsAnimation(movementBounds);
+    void animateToClosestSnapTarget() {
+        final Rect newBounds = mSnapAlgorithm.findClosestSnapBounds(mMovementBounds, mBounds);
+        animateToBounds(newBounds, mSpringConfig);
+    }
 
-        final Rect toBounds = mSnapAlgorithm.findClosestSnapBounds(movementBounds, mBounds);
+    /**
+     * Animates PIP to the provided bounds, using physics animations and the given spring
+     * configuration
+     */
+    void animateToBounds(Rect bounds, PhysicsAnimator.SpringConfig springConfig) {
+        mAnimatedBounds.set(mBounds);
         mAnimatedBoundsPhysicsAnimator
-                .spring(FloatProperties.RECT_X, toBounds.left, mSpringConfig)
-                .spring(FloatProperties.RECT_Y, toBounds.top, mSpringConfig);
-
+                .spring(FloatProperties.RECT_X, bounds.left, springConfig)
+                .spring(FloatProperties.RECT_Y, bounds.top, springConfig);
         startBoundsAnimation();
+
+        setAnimatingToBounds(bounds);
     }
 
     /**
@@ -323,9 +404,6 @@
         final boolean isFling = velocity > mFlingAnimationUtils.getMinVelocityPxPerSecond();
         final Point dismissEndPoint = getDismissEndPoint(mBounds, velocityX, velocityY, isFling);
 
-        // Set the animated bounds to start at the current bounds. We don't need to rebuild the
-        // fling configs here via prepareForBoundsAnimation, since animateDismiss isn't provided
-        // with new movement bounds.
         mAnimatedBounds.set(mBounds);
 
         // Animate to the dismiss end point, and then dismiss PIP.
@@ -366,9 +444,11 @@
                     currentMovementBounds);
         }
         mSnapAlgorithm.applySnapFraction(normalBounds, normalMovementBounds, savedSnapFraction);
+
         if (minimized) {
-            normalBounds = getClosestMinimizedBounds(normalBounds, normalMovementBounds);
+            normalBounds = getClosestMinimizedBounds(normalBounds);
         }
+
         if (immediate) {
             movePip(normalBounds);
         } else {
@@ -400,19 +480,15 @@
      */
     private void cancelAnimations() {
         mAnimatedBoundsPhysicsAnimator.cancel();
+        mAnimatingToBounds.setEmpty();
     }
 
-    /**
-     * Set new fling configs whose min/max values respect the given movement bounds, and set the
-     * animated bounds to PIP's current 'real' bounds.
-     */
-    private void prepareForBoundsAnimation(Rect movementBounds) {
+    /** Set new fling configs whose min/max values respect the given movement bounds. */
+    private void rebuildFlingConfigs() {
         mFlingConfigX = new PhysicsAnimator.FlingConfig(
-                DEFAULT_FRICTION, movementBounds.left, movementBounds.right);
+                DEFAULT_FRICTION, mMovementBounds.left, mMovementBounds.right);
         mFlingConfigY = new PhysicsAnimator.FlingConfig(
-                DEFAULT_FRICTION, movementBounds.top, movementBounds.bottom);
-
-        mAnimatedBounds.set(mBounds);
+                DEFAULT_FRICTION, mMovementBounds.top, mMovementBounds.bottom);
     }
 
     /**
@@ -432,6 +508,16 @@
     }
 
     /**
+     * Notifies the floating coordinator that we're moving, and sets {@link #mAnimatingToBounds} so
+     * we return these bounds from
+     * {@link FloatingContentCoordinator.FloatingContent#getFloatingBoundsOnScreen()}.
+     */
+    private void setAnimatingToBounds(Rect bounds) {
+        mAnimatingToBounds = bounds;
+        mFloatingContentCoordinator.onContentMoved(this);
+    }
+
+    /**
      * Directly resizes the PiP to the given {@param bounds}.
      */
     private void resizePipUnchecked(Rect toBounds) {
@@ -459,6 +545,7 @@
             args.arg1 = toBounds;
             args.argi1 = duration;
             mHandler.sendMessage(mHandler.obtainMessage(MSG_RESIZE_ANIMATE, args));
+            setAnimatingToBounds(toBounds);
         }
     }
 
diff --git a/packages/SystemUI/src/com/android/systemui/pip/phone/PipTouchHandler.java b/packages/SystemUI/src/com/android/systemui/pip/phone/PipTouchHandler.java
index 924edb6..8e588e6 100644
--- a/packages/SystemUI/src/com/android/systemui/pip/phone/PipTouchHandler.java
+++ b/packages/SystemUI/src/com/android/systemui/pip/phone/PipTouchHandler.java
@@ -47,6 +47,7 @@
 import com.android.systemui.pip.PipSnapAlgorithm;
 import com.android.systemui.shared.system.InputConsumerController;
 import com.android.systemui.statusbar.FlingAnimationUtils;
+import com.android.systemui.util.FloatingContentCoordinator;
 
 import java.io.PrintWriter;
 
@@ -127,6 +128,7 @@
     // Touch state
     private final PipTouchState mTouchState;
     private final FlingAnimationUtils mFlingAnimationUtils;
+    private final FloatingContentCoordinator mFloatingContentCoordinator;
     private final PipMotionHelper mMotionHelper;
     private PipTouchGesture mGesture;
 
@@ -152,7 +154,7 @@
         @Override
         public void onPipMinimize() {
             setMinimizedStateInternal(true);
-            mMotionHelper.animateToClosestMinimizedState(mMovementBounds, null /* updateAction */);
+            mMotionHelper.animateToClosestMinimizedState(null /* updateAction */);
         }
 
         @Override
@@ -172,7 +174,8 @@
     public PipTouchHandler(Context context, IActivityManager activityManager,
             IActivityTaskManager activityTaskManager, PipMenuActivityController menuController,
             InputConsumerController inputConsumerController,
-            PipBoundsHandler pipBoundsHandler) {
+            PipBoundsHandler pipBoundsHandler,
+            FloatingContentCoordinator floatingContentCoordinator) {
 
         // Initialize the Pip input consumer
         mContext = context;
@@ -188,7 +191,7 @@
                 2.5f);
         mGesture = new DefaultPipTouchGesture();
         mMotionHelper = new PipMotionHelper(mContext, mActivityManager, mActivityTaskManager,
-                mMenuController, mSnapAlgorithm, mFlingAnimationUtils);
+                mMenuController, mSnapAlgorithm, mFlingAnimationUtils, floatingContentCoordinator);
         mPipResizeGestureHandler =
                 new PipResizeGestureHandler(context, pipBoundsHandler, this, mMotionHelper);
         mTouchState = new PipTouchState(mViewConfig, mHandler,
@@ -207,6 +210,7 @@
         inputConsumerController.setRegistrationListener(this::onRegistrationChanged);
 
         mPipBoundsHandler = pipBoundsHandler;
+        mFloatingContentCoordinator = floatingContentCoordinator;
         mConnection = new PipAccessibilityInteractionConnection(mMotionHelper,
                 this::onAccessibilityShowMenu, mHandler);
     }
@@ -228,15 +232,18 @@
     }
 
     public void onActivityPinned() {
-        cleanUp();
+        cleanUpDismissTarget();
         mShowPipMenuOnAnimationEnd = true;
         mPipResizeGestureHandler.onActivityPinned();
+        mFloatingContentCoordinator.onContentAdded(mMotionHelper);
     }
 
     public void onActivityUnpinned(ComponentName topPipActivity) {
         if (topPipActivity == null) {
             // Clean up state after the last PiP activity is removed
-            cleanUp();
+            cleanUpDismissTarget();
+
+            mFloatingContentCoordinator.onContentRemoved(mMotionHelper);
         }
         mPipResizeGestureHandler.onActivityUnpinned();
     }
@@ -501,8 +508,7 @@
         if (fromController) {
             if (isMinimized) {
                 // Move the PiP to the new bounds immediately if minimized
-                mMotionHelper.movePip(mMotionHelper.getClosestMinimizedBounds(mNormalBounds,
-                        mMovementBounds));
+                mMotionHelper.movePip(mMotionHelper.getClosestMinimizedBounds(mNormalBounds));
             }
         } else if (mPinnedStackController != null) {
             try {
@@ -654,7 +660,7 @@
 
                 mTmpBounds.set(mMotionHelper.getBounds());
                 mTmpBounds.offsetTo((int) left, (int) top);
-                mMotionHelper.movePip(mTmpBounds);
+                mMotionHelper.movePip(mTmpBounds, true /* isDragging */);
 
                 if (mEnableDimissDragToEdge) {
                     updateDismissFraction();
@@ -724,7 +730,6 @@
                         mMenuController.hideMenu();
                     } else {
                         mMotionHelper.animateToClosestMinimizedState(
-                                mMovementBounds,
                                 PipTouchHandler.this::updateDismissFraction /* updateAction */);
                     }
                     return true;
@@ -748,16 +753,15 @@
                 }
 
                 if (isFling) {
-                    mMotionHelper.flingToSnapTarget(
-                            vel.x, vel.y, mMovementBounds,
+                    mMotionHelper.flingToSnapTarget(vel.x, vel.y,
                             PipTouchHandler.this::updateDismissFraction /* updateAction */,
                             endAction /* endAction */);
                 } else {
-                    mMotionHelper.animateToClosestSnapTarget(mMovementBounds);
+                    mMotionHelper.animateToClosestSnapTarget();
                 }
             } else if (mIsMinimized) {
                 // This was a tap, so no longer minimized
-                mMotionHelper.animateToClosestSnapTarget(mMovementBounds);
+                mMotionHelper.animateToClosestSnapTarget();
                 setMinimizedStateInternal(false);
             } else if (mTouchState.isDoubleTap()) {
                 // Expand to fullscreen if this is a double tap
@@ -789,6 +793,7 @@
                 : mNormalMovementBounds;
         mPipBoundsHandler.setMinEdgeSize(
                 isMenuExpanded ? mExpandedShortestEdgeSize : 0);
+        mMotionHelper.setCurrentMovementBounds(mMovementBounds);
     }
 
     /**
@@ -800,16 +805,6 @@
     }
 
     /**
-     * Resets some states related to the touch handling.
-     */
-    private void cleanUp() {
-        if (mIsMinimized) {
-            setMinimizedStateInternal(false);
-        }
-        cleanUpDismissTarget();
-    }
-
-    /**
      * @return whether the menu will resize as a part of showing the full menu.
      */
     private boolean willResizeMenu() {
diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSDetail.java b/packages/SystemUI/src/com/android/systemui/qs/QSDetail.java
index 019cb14..17aaff1 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/QSDetail.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/QSDetail.java
@@ -25,10 +25,13 @@
 import android.content.res.Configuration;
 import android.graphics.drawable.Animatable;
 import android.util.AttributeSet;
+import android.util.Pair;
 import android.util.SparseArray;
+import android.view.DisplayCutout;
 import android.view.View;
 import android.view.ViewGroup;
 import android.view.ViewStub;
+import android.view.WindowInsets;
 import android.view.accessibility.AccessibilityEvent;
 import android.widget.ImageView;
 import android.widget.LinearLayout;
@@ -42,6 +45,7 @@
 import com.android.systemui.plugins.ActivityStarter;
 import com.android.systemui.plugins.qs.DetailAdapter;
 import com.android.systemui.statusbar.CommandQueue;
+import com.android.systemui.statusbar.phone.StatusBarWindowView;
 
 public class QSDetail extends LinearLayout {
 
@@ -274,6 +278,32 @@
         }
     }
 
+    @Override
+    public WindowInsets onApplyWindowInsets(WindowInsets insets) {
+        DisplayCutout cutout = insets.getDisplayCutout();
+
+        Pair<Integer, Integer> padding = StatusBarWindowView.cornerCutoutMargins(
+                cutout, getDisplay());
+
+        if (padding == null) {
+            mQsDetailHeader.setPaddingRelative(
+                    getResources().getDimensionPixelSize(R.dimen.qs_detail_header_padding),
+                    getPaddingTop(),
+                    getResources().getDimensionPixelSize(R.dimen.qs_detail_header_padding),
+                    getPaddingBottom()
+            );
+        } else {
+            mQsDetailHeader.setPadding(
+                    padding.first,
+                    getPaddingTop(),
+                    padding.second,
+                    getPaddingBottom()
+            );
+        }
+
+        return super.onApplyWindowInsets(insets);
+    }
+
     private void handleToggleStateChanged(boolean state, boolean toggleEnabled) {
         mSwitchState = state;
         if (mAnimatingOpen) {
diff --git a/packages/SystemUI/src/com/android/systemui/qs/QuickStatusBarHeader.java b/packages/SystemUI/src/com/android/systemui/qs/QuickStatusBarHeader.java
index 8cd70cf..d422dd7 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/QuickStatusBarHeader.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/QuickStatusBarHeader.java
@@ -60,6 +60,7 @@
 import com.android.systemui.plugins.DarkIconDispatcher;
 import com.android.systemui.plugins.DarkIconDispatcher.DarkReceiver;
 import com.android.systemui.qs.QSDetail.Callback;
+import com.android.systemui.qs.carrier.QSCarrierGroup;
 import com.android.systemui.statusbar.CommandQueue;
 import com.android.systemui.statusbar.phone.StatusBarIconController;
 import com.android.systemui.statusbar.phone.StatusBarIconController.TintedIconManager;
@@ -435,23 +436,22 @@
 
     @Override
     public WindowInsets onApplyWindowInsets(WindowInsets insets) {
+        // Handle padding of SystemIconsView
         DisplayCutout cutout = insets.getDisplayCutout();
-
-        // Handle padding of QuickStatusBarHeader
         Pair<Integer, Integer> cornerCutoutPadding = StatusBarWindowView.cornerCutoutMargins(
                 cutout, getDisplay());
         Pair<Integer, Integer> padding =
                 StatusBarWindowView.paddingNeededForCutoutAndRoundedCorner(
                         cutout, cornerCutoutPadding, mRoundedCornerPadding);
-        setPadding(padding.first, 0, padding.second, getPaddingBottom());
-
-        // Handle padding of SystemIconsView
         final int waterfallTopInset = cutout == null ? 0 : cutout.getWaterfallInsets().top;
-        mSystemIconsView.setPaddingRelative(
-                getResources().getDimensionPixelSize(R.dimen.status_bar_padding_start),
-                waterfallTopInset,
-                getResources().getDimensionPixelSize(R.dimen.status_bar_padding_end),
-                0);
+        int statusBarPaddingLeft = isLayoutRtl()
+                ? getResources().getDimensionPixelSize(R.dimen.status_bar_padding_end)
+                : getResources().getDimensionPixelSize(R.dimen.status_bar_padding_start);
+        int statusBarPaddingRight = isLayoutRtl()
+                ? getResources().getDimensionPixelSize(R.dimen.status_bar_padding_start)
+                : getResources().getDimensionPixelSize(R.dimen.status_bar_padding_end);
+        mSystemIconsView.setPadding(padding.first + statusBarPaddingLeft, waterfallTopInset,
+                padding.second + statusBarPaddingRight, 0);
 
         return super.onApplyWindowInsets(insets);
     }
diff --git a/packages/SystemUI/src/com/android/systemui/qs/QuickStatusBarHeaderController.java b/packages/SystemUI/src/com/android/systemui/qs/QuickStatusBarHeaderController.java
index 867677a..d899acb 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/QuickStatusBarHeaderController.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/QuickStatusBarHeaderController.java
@@ -17,6 +17,7 @@
 package com.android.systemui.qs;
 
 import com.android.systemui.R;
+import com.android.systemui.qs.carrier.QSCarrierGroupController;
 
 import javax.inject.Inject;
 
diff --git a/packages/SystemUI/src/com/android/systemui/qs/carrier/CellSignalState.kt b/packages/SystemUI/src/com/android/systemui/qs/carrier/CellSignalState.kt
new file mode 100644
index 0000000..663f3f0
--- /dev/null
+++ b/packages/SystemUI/src/com/android/systemui/qs/carrier/CellSignalState.kt
@@ -0,0 +1,43 @@
+/*
+ * 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.systemui.qs.carrier
+
+/**
+ * Represents the state of cell signal for a particular slot.
+ *
+ * To be used between [QSCarrierGroupController] and [QSCarrier].
+ */
+data class CellSignalState(
+    @JvmField val visible: Boolean = false,
+    @JvmField val mobileSignalIconId: Int = 0,
+    @JvmField val contentDescription: String? = null,
+    @JvmField val typeContentDescription: String? = null,
+    @JvmField val roaming: Boolean = false
+) {
+    /**
+     * Changes the visibility of this state by returning a copy with the visibility changed.
+     *
+     * If the visibility would not change, the same state is returned.
+     *
+     * @param visible the new visibility state
+     * @return `this` if `this.visible == visible`. Else, a new copy with the visibility changed.
+     */
+    fun changeVisibility(visible: Boolean): CellSignalState {
+        if (this.visible == visible) return this
+        else return copy(visible = visible)
+    }
+}
\ No newline at end of file
diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSCarrier.java b/packages/SystemUI/src/com/android/systemui/qs/carrier/QSCarrier.java
similarity index 89%
rename from packages/SystemUI/src/com/android/systemui/qs/QSCarrier.java
rename to packages/SystemUI/src/com/android/systemui/qs/carrier/QSCarrier.java
index 5a9c360..ad275f1 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/QSCarrier.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/carrier/QSCarrier.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2019 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,7 +14,7 @@
  * limitations under the License.
  */
 
-package com.android.systemui.qs;
+package com.android.systemui.qs.carrier;
 
 import android.content.Context;
 import android.content.res.ColorStateList;
@@ -29,6 +29,7 @@
 import com.android.settingslib.graph.SignalDrawable;
 import com.android.systemui.DualToneHandler;
 import com.android.systemui.R;
+import com.android.systemui.qs.QuickStatusBarHeader;
 
 import java.util.Objects;
 
@@ -41,7 +42,7 @@
     private DualToneHandler mDualToneHandler;
     private ColorStateList mColorForegroundStateList;
     private float mColorForegroundIntensity;
-    private QSCarrierGroupController.CellSignalState mLastSignalState;
+    private CellSignalState mLastSignalState;
 
     public QSCarrier(Context context) {
         super(context);
@@ -76,8 +77,13 @@
         mColorForegroundIntensity = QuickStatusBarHeader.getColorIntensity(colorForeground);
     }
 
-    public void updateState(QSCarrierGroupController.CellSignalState state) {
-        if (Objects.equals(state, mLastSignalState)) return;
+    /**
+     * Update the state of this view
+     * @param state the current state of the signal for this view
+     * @return true if the state was actually changed
+     */
+    public boolean updateState(CellSignalState state) {
+        if (Objects.equals(state, mLastSignalState)) return false;
         mLastSignalState = state;
         mMobileGroup.setVisibility(state.visible ? View.VISIBLE : View.GONE);
         if (state.visible) {
@@ -103,6 +109,7 @@
             }
             mMobileSignal.setContentDescription(contentDescription);
         }
+        return true;
     }
 
     private boolean hasValidTypeContentDescription(String typeContentDescription) {
diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSCarrierGroup.java b/packages/SystemUI/src/com/android/systemui/qs/carrier/QSCarrierGroup.java
similarity index 93%
rename from packages/SystemUI/src/com/android/systemui/qs/QSCarrierGroup.java
rename to packages/SystemUI/src/com/android/systemui/qs/carrier/QSCarrierGroup.java
index 346c75d..d03563f 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/QSCarrierGroup.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/carrier/QSCarrierGroup.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2019 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,7 +14,7 @@
  * limitations under the License.
  */
 
-package com.android.systemui.qs;
+package com.android.systemui.qs.carrier;
 
 import android.content.Context;
 import android.util.AttributeSet;
diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSCarrierGroupController.java b/packages/SystemUI/src/com/android/systemui/qs/carrier/QSCarrierGroupController.java
similarity index 86%
rename from packages/SystemUI/src/com/android/systemui/qs/QSCarrierGroupController.java
rename to packages/SystemUI/src/com/android/systemui/qs/carrier/QSCarrierGroupController.java
index eb5b4cc..f9b1473 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/QSCarrierGroupController.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/carrier/QSCarrierGroupController.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2019 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,7 +14,7 @@
  * limitations under the License.
  */
 
-package com.android.systemui.qs;
+package com.android.systemui.qs.carrier;
 
 import static android.view.View.IMPORTANT_FOR_ACCESSIBILITY_YES;
 
@@ -29,7 +29,6 @@
 import android.view.View;
 import android.widget.TextView;
 
-import androidx.annotation.Nullable;
 import androidx.annotation.VisibleForTesting;
 
 import com.android.keyguard.CarrierTextController;
@@ -38,7 +37,6 @@
 import com.android.systemui.plugins.ActivityStarter;
 import com.android.systemui.statusbar.policy.NetworkController;
 
-import java.util.Objects;
 import java.util.function.Consumer;
 
 import javax.inject.Inject;
@@ -82,11 +80,13 @@
                         Log.e(TAG, "Invalid SIM slot index for subscription: " + subId);
                         return;
                     }
-                    mInfos[slotIndex].visible = statusIcon.visible;
-                    mInfos[slotIndex].mobileSignalIconId = statusIcon.icon;
-                    mInfos[slotIndex].contentDescription = statusIcon.contentDescription;
-                    mInfos[slotIndex].typeContentDescription = typeContentDescription.toString();
-                    mInfos[slotIndex].roaming = roaming;
+                    mInfos[slotIndex] = new CellSignalState(
+                            statusIcon.visible,
+                            statusIcon.icon,
+                            statusIcon.contentDescription,
+                            typeContentDescription.toString(),
+                            roaming
+                    );
                     mMainHandler.obtainMessage(H.MSG_UPDATE_STATE).sendToTarget();
                 }
 
@@ -94,7 +94,7 @@
                 public void setNoSims(boolean hasNoSims, boolean simDetected) {
                     if (hasNoSims) {
                         for (int i = 0; i < SIM_SLOTS; i++) {
-                            mInfos[i].visible = false;
+                            mInfos[i] = mInfos[i].changeVisibility(false);
                         }
                     }
                     mMainHandler.obtainMessage(H.MSG_UPDATE_STATE).sendToTarget();
@@ -236,7 +236,7 @@
                                         + info.subscriptionIds[i]);
                         continue;
                     }
-                    mInfos[slot].visible = true;
+                    mInfos[slot] = mInfos[slot].changeVisibility(true);
                     slotSeen[slot] = true;
                     mCarrierGroups[slot].setCarrierText(
                             info.listOfCarriers[i].toString().trim());
@@ -244,7 +244,7 @@
                 }
                 for (int i = 0; i < SIM_SLOTS; i++) {
                     if (!slotSeen[i]) {
-                        mInfos[i].visible = false;
+                        mInfos[i] = mInfos[i].changeVisibility(false);
                         mCarrierGroups[i].setVisibility(View.GONE);
                     }
                 }
@@ -255,7 +255,7 @@
             // No sims or airplane mode (but not WFC). Do not show QSCarrierGroup, instead just show
             // info.carrierText in a different view.
             for (int i = 0; i < SIM_SLOTS; i++) {
-                mInfos[i].visible = false;
+                mInfos[i] = mInfos[i].changeVisibility(false);
                 mCarrierGroups[i].setCarrierText("");
                 mCarrierGroups[i].setVisibility(View.GONE);
             }
@@ -295,35 +295,6 @@
         }
     }
 
-    static final class CellSignalState {
-        boolean visible;
-        int mobileSignalIconId;
-        String contentDescription;
-        String typeContentDescription;
-        boolean roaming;
-
-        @Override
-        public boolean equals(@Nullable Object obj) {
-            if (this == obj) return true;
-            if (!(obj instanceof CellSignalState)) return false;
-            CellSignalState other = (CellSignalState) obj;
-            return this.visible == other.visible
-                    && this.mobileSignalIconId == other.mobileSignalIconId
-                    && Objects.equals(this.contentDescription, other.contentDescription)
-                    && Objects.equals(this.typeContentDescription, other.typeContentDescription)
-                    && this.roaming == other.roaming;
-        }
-
-        @Override
-        public int hashCode() {
-            return Objects.hash(visible,
-                    mobileSignalIconId,
-                    contentDescription,
-                    typeContentDescription,
-                    roaming);
-        }
-    }
-
     public static class Builder {
         private QSCarrierGroup mView;
         private final ActivityStarter mActivityStarter;
@@ -343,7 +314,7 @@
             mCarrierTextControllerBuilder = carrierTextControllerBuilder;
         }
 
-        Builder setQSCarrierGroup(QSCarrierGroup view) {
+        public Builder setQSCarrierGroup(QSCarrierGroup view) {
             mView = view;
             return this;
         }
diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/HotspotTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/HotspotTile.java
index 0c86157..1ab77f3 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/tiles/HotspotTile.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/HotspotTile.java
@@ -17,9 +17,9 @@
 package com.android.systemui.qs.tiles;
 
 import android.annotation.Nullable;
-import android.content.ComponentName;
 import android.content.Intent;
 import android.os.UserManager;
+import android.provider.Settings;
 import android.service.quicksettings.Tile;
 import android.util.Log;
 import android.widget.Switch;
@@ -36,9 +36,6 @@
 
 /** Quick settings tile: Hotspot **/
 public class HotspotTile extends QSTileImpl<BooleanState> {
-    private static final Intent TETHER_SETTINGS = new Intent().setComponent(new ComponentName(
-            "com.android.settings", "com.android.settings.TetherSettings"));
-
     private final Icon mEnabledStatic = ResourceIcon.get(R.drawable.ic_hotspot);
 
     private final HotspotController mHotspotController;
@@ -79,7 +76,7 @@
 
     @Override
     public Intent getLongClickIntent() {
-        return new Intent(TETHER_SETTINGS);
+        return new Intent(Settings.ACTION_TETHER_SETTINGS);
     }
 
     @Override
diff --git a/packages/SystemUI/src/com/android/systemui/recents/OverviewProxyService.java b/packages/SystemUI/src/com/android/systemui/recents/OverviewProxyService.java
index ad49364..34cad51 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/OverviewProxyService.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/OverviewProxyService.java
@@ -380,6 +380,14 @@
                     taskId, mHandler, null);
         }
 
+        @Override
+        public void setSplitScreenMinimized(boolean minimized) {
+            Divider divider = mDividerOptional.get();
+            if (divider != null) {
+                divider.setMinimized(minimized);
+            }
+        }
+
         private boolean verifyCaller(String reason) {
             final int callerId = Binder.getCallingUserHandle().getIdentifier();
             if (callerId != mCurrentBoundedUserId) {
diff --git a/packages/SystemUI/src/com/android/systemui/shortcut/ShortcutKeyDispatcher.java b/packages/SystemUI/src/com/android/systemui/shortcut/ShortcutKeyDispatcher.java
index 5ae0954..4f20492 100644
--- a/packages/SystemUI/src/com/android/systemui/shortcut/ShortcutKeyDispatcher.java
+++ b/packages/SystemUI/src/com/android/systemui/shortcut/ShortcutKeyDispatcher.java
@@ -22,10 +22,8 @@
 import android.content.Context;
 import android.content.res.Configuration;
 import android.os.RemoteException;
-import android.util.Log;
 import android.view.IWindowManager;
 import android.view.KeyEvent;
-import android.view.WindowManager;
 import android.view.WindowManagerGlobal;
 
 import com.android.internal.policy.DividerSnapAlgorithm;
@@ -94,29 +92,24 @@
     }
 
     private void handleDockKey(long shortcutCode) {
-        try {
-            int dockSide = mWindowManagerService.getDockedStackSide();
-            if (dockSide == WindowManager.DOCKED_INVALID) {
-                // Split the screen
-                mRecents.splitPrimaryTask((shortcutCode == SC_DOCK_LEFT)
-                        ? SPLIT_SCREEN_CREATE_MODE_TOP_OR_LEFT
-                        : SPLIT_SCREEN_CREATE_MODE_BOTTOM_OR_RIGHT, null, -1);
-            } else {
-                // If there is already a docked window, we respond by resizing the docking pane.
-                DividerView dividerView = mDivider.getView();
-                DividerSnapAlgorithm snapAlgorithm = dividerView.getSnapAlgorithm();
-                int dividerPosition = dividerView.getCurrentPosition();
-                DividerSnapAlgorithm.SnapTarget currentTarget =
-                        snapAlgorithm.calculateNonDismissingSnapTarget(dividerPosition);
-                DividerSnapAlgorithm.SnapTarget target = (shortcutCode == SC_DOCK_LEFT)
-                        ? snapAlgorithm.getPreviousTarget(currentTarget)
-                        : snapAlgorithm.getNextTarget(currentTarget);
-                dividerView.startDragging(true /* animate */, false /* touching */);
-                dividerView.stopDragging(target.position, 0f, false /* avoidDismissStart */,
-                        true /* logMetrics */);
-            }
-        } catch (RemoteException e) {
-            Log.e(TAG, "handleDockKey() failed.");
+        if (mDivider == null || !mDivider.inSplitMode()) {
+            // Split the screen
+            mRecents.splitPrimaryTask((shortcutCode == SC_DOCK_LEFT)
+                    ? SPLIT_SCREEN_CREATE_MODE_TOP_OR_LEFT
+                    : SPLIT_SCREEN_CREATE_MODE_BOTTOM_OR_RIGHT, null, -1);
+        } else {
+            // If there is already a docked window, we respond by resizing the docking pane.
+            DividerView dividerView = mDivider.getView();
+            DividerSnapAlgorithm snapAlgorithm = dividerView.getSnapAlgorithm();
+            int dividerPosition = dividerView.getCurrentPosition();
+            DividerSnapAlgorithm.SnapTarget currentTarget =
+                    snapAlgorithm.calculateNonDismissingSnapTarget(dividerPosition);
+            DividerSnapAlgorithm.SnapTarget target = (shortcutCode == SC_DOCK_LEFT)
+                    ? snapAlgorithm.getPreviousTarget(currentTarget)
+                    : snapAlgorithm.getNextTarget(currentTarget);
+            dividerView.startDragging(true /* animate */, false /* touching */);
+            dividerView.stopDragging(target.position, 0f, false /* avoidDismissStart */,
+                    true /* logMetrics */);
         }
     }
 }
diff --git a/packages/SystemUI/src/com/android/systemui/stackdivider/Divider.java b/packages/SystemUI/src/com/android/systemui/stackdivider/Divider.java
index 90cc0e57..2daefbd 100644
--- a/packages/SystemUI/src/com/android/systemui/stackdivider/Divider.java
+++ b/packages/SystemUI/src/com/android/systemui/stackdivider/Divider.java
@@ -17,69 +17,283 @@
 package com.android.systemui.stackdivider;
 
 import static android.content.res.Configuration.ORIENTATION_LANDSCAPE;
-import static android.view.ViewGroup.LayoutParams.MATCH_PARENT;
+import static android.view.Display.DEFAULT_DISPLAY;
 
+import android.app.ActivityTaskManager;
 import android.content.Context;
 import android.content.res.Configuration;
+import android.graphics.Rect;
+import android.os.Handler;
 import android.os.RemoteException;
+import android.provider.Settings;
 import android.util.Log;
-import android.view.IDockedStackListener;
+import android.util.Slog;
+import android.view.IWindowContainer;
 import android.view.LayoutInflater;
+import android.view.SurfaceControl;
+import android.view.SurfaceSession;
 import android.view.View;
-import android.view.WindowManagerGlobal;
+import android.view.WindowContainerTransaction;
 
+import com.android.internal.policy.DividerSnapAlgorithm;
 import com.android.systemui.R;
 import com.android.systemui.SystemUI;
+import com.android.systemui.TransactionPool;
 import com.android.systemui.recents.Recents;
+import com.android.systemui.statusbar.policy.KeyguardStateController;
+import com.android.systemui.wm.DisplayChangeController;
+import com.android.systemui.wm.DisplayController;
+import com.android.systemui.wm.DisplayImeController;
+import com.android.systemui.wm.DisplayLayout;
+import com.android.systemui.wm.SystemWindows;
 
 import java.io.FileDescriptor;
 import java.io.PrintWriter;
+import java.lang.ref.WeakReference;
+import java.util.ArrayList;
 import java.util.Optional;
+import java.util.function.Consumer;
+
+import javax.inject.Singleton;
 
 import dagger.Lazy;
 
 /**
  * Controls the docked stack divider.
  */
-public class Divider extends SystemUI implements DividerView.DividerCallbacks {
+@Singleton
+public class Divider extends SystemUI implements DividerView.DividerCallbacks,
+        DisplayController.OnDisplaysChangedListener {
     private static final String TAG = "Divider";
+
+    static final boolean DEBUG = true;
+
+    static final int DEFAULT_APP_TRANSITION_DURATION = 336;
+
     private final Optional<Lazy<Recents>> mRecentsOptionalLazy;
 
     private DividerWindowManager mWindowManager;
     private DividerView mView;
     private final DividerState mDividerState = new DividerState();
-    private DockDividerVisibilityListener mDockDividerVisibilityListener;
     private boolean mVisible = false;
     private boolean mMinimized = false;
     private boolean mAdjustedForIme = false;
     private boolean mHomeStackResizable = false;
     private ForcedResizableInfoActivityController mForcedResizableController;
+    private SystemWindows mSystemWindows;
+    final SurfaceSession mSurfaceSession = new SurfaceSession();
+    private DisplayController mDisplayController;
+    private DisplayImeController mImeController;
+    final TransactionPool mTransactionPool;
 
-    public Divider(Context context, Optional<Lazy<Recents>> recentsOptionalLazy) {
+    // Keeps track of real-time split geometry including snap positions and ime adjustments
+    private SplitDisplayLayout mSplitLayout;
+
+    // Transient: this contains the layout calculated for a new rotation requested by WM. This is
+    // kept around so that we can wait for a matching configuration change and then use the exact
+    // layout that we sent back to WM.
+    private SplitDisplayLayout mRotateSplitLayout;
+
+    private Handler mHandler;
+    private KeyguardStateController mKeyguardStateController;
+
+    private final ArrayList<WeakReference<Consumer<Boolean>>> mDockedStackExistsListeners =
+            new ArrayList<>();
+
+    private SplitScreenTaskOrganizer mSplits = new SplitScreenTaskOrganizer(this);
+
+    private DisplayChangeController.OnDisplayChangingListener mRotationController =
+            (display, fromRotation, toRotation, t) -> {
+                DisplayLayout displayLayout =
+                        new DisplayLayout(mDisplayController.getDisplayLayout(display));
+                SplitDisplayLayout sdl = new SplitDisplayLayout(mContext, displayLayout, mSplits);
+                sdl.rotateTo(toRotation);
+                mRotateSplitLayout = sdl;
+                int position = mMinimized ? mView.mSnapTargetBeforeMinimized.position
+                        : mView.getCurrentPosition();
+                DividerSnapAlgorithm snap = sdl.getSnapAlgorithm();
+                final DividerSnapAlgorithm.SnapTarget target =
+                        snap.calculateNonDismissingSnapTarget(position);
+                sdl.resizeSplits(target.position, t);
+
+                if (inSplitMode()) {
+                    WindowManagerProxy.applyHomeTasksMinimized(sdl, mSplits.mSecondary.token, t);
+                }
+            };
+
+    private IWindowContainer mLastImeTarget = null;
+    private boolean mShouldAdjustForIme = false;
+
+    private DisplayImeController.ImePositionProcessor mImePositionProcessor =
+            new DisplayImeController.ImePositionProcessor() {
+                private int mStartTop = 0;
+                private int mFinalTop = 0;
+                @Override
+                public void onImeStartPositioning(int displayId, int imeTop, int finalImeTop,
+                        boolean showing, SurfaceControl.Transaction t) {
+                    mStartTop = imeTop;
+                    mFinalTop = finalImeTop;
+                    if (showing) {
+                        try {
+                            mLastImeTarget = ActivityTaskManager.getTaskOrganizerController()
+                                    .getImeTarget(displayId);
+                            mShouldAdjustForIme = !mSplitLayout.mDisplayLayout.isLandscape()
+                                    && (mLastImeTarget.asBinder()
+                                    == mSplits.mSecondary.token.asBinder());
+                        } catch (RemoteException e) {
+                            Slog.w(TAG, "Failed to get IME target", e);
+                        }
+                    }
+                    if (!mShouldAdjustForIme) {
+                        setAdjustedForIme(false);
+                        return;
+                    }
+                    mView.setAdjustedForIme(showing, showing
+                            ? DisplayImeController.ANIMATION_DURATION_SHOW_MS
+                            : DisplayImeController.ANIMATION_DURATION_HIDE_MS);
+                    // Reposition the server's secondary split position so that it evaluates
+                    // insets properly.
+                    WindowContainerTransaction wct = new WindowContainerTransaction();
+                    if (showing) {
+                        mSplitLayout.updateAdjustedBounds(finalImeTop, imeTop, finalImeTop);
+                        wct.setBounds(mSplits.mSecondary.token, mSplitLayout.mAdjustedSecondary);
+                    } else {
+                        wct.setBounds(mSplits.mSecondary.token, mSplitLayout.mSecondary);
+                    }
+                    try {
+                        ActivityTaskManager.getTaskOrganizerController()
+                                .applyContainerTransaction(wct, null /* organizer */);
+                    } catch (RemoteException e) {
+                    }
+                    setAdjustedForIme(showing);
+                }
+
+                @Override
+                public void onImePositionChanged(int displayId, int imeTop,
+                        SurfaceControl.Transaction t) {
+                    if (!mShouldAdjustForIme) {
+                        return;
+                    }
+                    mSplitLayout.updateAdjustedBounds(imeTop, mStartTop, mFinalTop);
+                    mView.resizeSplitSurfaces(t, mSplitLayout.mAdjustedPrimary,
+                            mSplitLayout.mAdjustedSecondary);
+                    final boolean showing = mFinalTop < mStartTop;
+                    final float progress = ((float) (imeTop - mStartTop)) / (mFinalTop - mStartTop);
+                    final float fraction = showing ? progress : 1.f - progress;
+                    mView.setResizeDimLayer(t, true /* primary */, fraction * 0.3f);
+                }
+
+                @Override
+                public void onImeEndPositioning(int displayId, int imeTop,
+                        boolean showing, SurfaceControl.Transaction t) {
+                    if (!mShouldAdjustForIme) {
+                        return;
+                    }
+                    mSplitLayout.updateAdjustedBounds(imeTop, mStartTop, mFinalTop);
+                    mView.resizeSplitSurfaces(t, mSplitLayout.mAdjustedPrimary,
+                            mSplitLayout.mAdjustedSecondary);
+                    mView.setResizeDimLayer(t, true /* primary */, showing ? 0.3f : 0.f);
+                }
+            };
+
+    public Divider(Context context, Optional<Lazy<Recents>> recentsOptionalLazy,
+            DisplayController displayController, SystemWindows systemWindows,
+            DisplayImeController imeController, Handler handler,
+            KeyguardStateController keyguardStateController, TransactionPool transactionPool) {
         super(context);
+        mDisplayController = displayController;
+        mSystemWindows = systemWindows;
+        mImeController = imeController;
+        mHandler = handler;
+        mKeyguardStateController = keyguardStateController;
         mRecentsOptionalLazy = recentsOptionalLazy;
+        mForcedResizableController = new ForcedResizableInfoActivityController(context, this);
+        mTransactionPool = transactionPool;
     }
 
     @Override
     public void start() {
-        mWindowManager = new DividerWindowManager(mContext);
-        update(mContext.getResources().getConfiguration());
-        mDockDividerVisibilityListener = new DockDividerVisibilityListener();
-        try {
-            WindowManagerGlobal.getWindowManagerService().registerDockedStackListener(
-                    mDockDividerVisibilityListener);
-        } catch (Exception e) {
-            Log.e(TAG, "Failed to register docked stack listener", e);
-        }
-        mForcedResizableController = new ForcedResizableInfoActivityController(mContext);
+        mWindowManager = new DividerWindowManager(mSystemWindows);
+        mDisplayController.addDisplayWindowListener(this);
+        // Hide the divider when keyguard is showing. Even though keyguard/statusbar is above
+        // everything, it is actually transparent except for notifications, so we still need to
+        // hide any surfaces that are below it.
+        // TODO(b/148906453): Figure out keyguard dismiss animation for divider view.
+        mKeyguardStateController.addCallback(new KeyguardStateController.Callback() {
+            @Override
+            public void onUnlockedChanged() {
+
+            }
+
+            @Override
+            public void onKeyguardShowingChanged() {
+                if (!inSplitMode() || mView == null) {
+                    return;
+                }
+                mView.setHidden(mKeyguardStateController.isShowing());
+            }
+
+            @Override
+            public void onKeyguardFadingAwayChanged() {
+
+            }
+        });
+        // Don't initialize the divider or anything until we get the default display.
     }
 
     @Override
-    protected void onConfigurationChanged(Configuration newConfig) {
-        super.onConfigurationChanged(newConfig);
+    public void onDisplayAdded(int displayId) {
+        if (displayId != DEFAULT_DISPLAY) {
+            return;
+        }
+        mSplitLayout = new SplitDisplayLayout(mDisplayController.getDisplayContext(displayId),
+                mDisplayController.getDisplayLayout(displayId), mSplits);
+        mImeController.addPositionProcessor(mImePositionProcessor);
+        mDisplayController.addDisplayChangingController(mRotationController);
+        try {
+            mSplits.init(ActivityTaskManager.getTaskOrganizerController(), mSurfaceSession);
+            // Set starting tile bounds based on middle target
+            final WindowContainerTransaction tct = new WindowContainerTransaction();
+            int midPos = mSplitLayout.getSnapAlgorithm().getMiddleTarget().position;
+            mSplitLayout.resizeSplits(midPos, tct);
+            ActivityTaskManager.getTaskOrganizerController().applyContainerTransaction(tct,
+                    null /* organizer */);
+        } catch (Exception e) {
+            Slog.e(TAG, "Failed to register docked stack listener", e);
+        }
+        update(mDisplayController.getDisplayContext(displayId).getResources().getConfiguration());
+    }
+
+    @Override
+    public void onDisplayConfigurationChanged(int displayId, Configuration newConfig) {
+        if (displayId != DEFAULT_DISPLAY) {
+            return;
+        }
+        mSplitLayout = new SplitDisplayLayout(mDisplayController.getDisplayContext(displayId),
+                mDisplayController.getDisplayLayout(displayId), mSplits);
+        if (mRotateSplitLayout == null) {
+            int midPos = mSplitLayout.getSnapAlgorithm().getMiddleTarget().position;
+            final WindowContainerTransaction tct = new WindowContainerTransaction();
+            mSplitLayout.resizeSplits(midPos, tct);
+            try {
+                ActivityTaskManager.getTaskOrganizerController().applyContainerTransaction(tct,
+                        null /* organizer */);
+            } catch (RemoteException e) {
+            }
+        } else if (mRotateSplitLayout != null
+                && mSplitLayout.mDisplayLayout.rotation()
+                        == mRotateSplitLayout.mDisplayLayout.rotation()) {
+            mSplitLayout.mPrimary = new Rect(mRotateSplitLayout.mPrimary);
+            mSplitLayout.mSecondary = new Rect(mRotateSplitLayout.mSecondary);
+            mRotateSplitLayout = null;
+        }
         update(newConfig);
     }
 
+    Handler getHandler() {
+        return mHandler;
+    }
+
     public DividerView getView() {
         return mView;
     }
@@ -92,18 +306,25 @@
         return mHomeStackResizable;
     }
 
+    /** {@code true} if this is visible */
+    public boolean inSplitMode() {
+        return mView != null && mView.getVisibility() == View.VISIBLE;
+    }
+
     private void addDivider(Configuration configuration) {
+        Context dctx = mDisplayController.getDisplayContext(mContext.getDisplayId());
         mView = (DividerView)
-                LayoutInflater.from(mContext).inflate(R.layout.docked_stack_divider, null);
-        mView.injectDependencies(mWindowManager, mDividerState, this);
+                LayoutInflater.from(dctx).inflate(R.layout.docked_stack_divider, null);
+        DisplayLayout displayLayout = mDisplayController.getDisplayLayout(mContext.getDisplayId());
+        mView.injectDependencies(mWindowManager, mDividerState, this, mSplits, mSplitLayout);
         mView.setVisibility(mVisible ? View.VISIBLE : View.INVISIBLE);
         mView.setMinimizedDockStack(mMinimized, mHomeStackResizable);
-        final int size = mContext.getResources().getDimensionPixelSize(
+        final int size = dctx.getResources().getDimensionPixelSize(
                 com.android.internal.R.dimen.docked_stack_divider_thickness);
         final boolean landscape = configuration.orientation == ORIENTATION_LANDSCAPE;
-        final int width = landscape ? size : MATCH_PARENT;
-        final int height = landscape ? MATCH_PARENT : size;
-        mWindowManager.add(mView, width, height);
+        final int width = landscape ? size : displayLayout.width();
+        final int height = landscape ? displayLayout.height() : size;
+        mWindowManager.add(mView, width, height, mContext.getDisplayId());
     }
 
     private void removeDivider() {
@@ -116,65 +337,86 @@
     private void update(Configuration configuration) {
         removeDivider();
         addDivider(configuration);
-        if (mMinimized) {
+        if (mMinimized && mView != null) {
             mView.setMinimizedDockStack(true, mHomeStackResizable);
             updateTouchable();
         }
     }
 
-    private void updateVisibility(final boolean visible) {
-        mView.post(new Runnable() {
-            @Override
-            public void run() {
-                if (mVisible != visible) {
-                    mVisible = visible;
-                    mView.setVisibility(visible ? View.VISIBLE : View.INVISIBLE);
+    void updateVisibility(final boolean visible) {
+        if (mVisible != visible) {
+            mVisible = visible;
+            mView.setVisibility(visible ? View.VISIBLE : View.INVISIBLE);
 
-                    // Update state because animations won't finish.
-                    mView.setMinimizedDockStack(mMinimized, mHomeStackResizable);
-                }
+            if (visible) {
+                mView.enterSplitMode(mHomeStackResizable);
+                // Update state because animations won't finish.
+                mView.setMinimizedDockStack(mMinimized, mHomeStackResizable);
+            } else {
+                mView.exitSplitMode();
+                // un-minimize so that next entry triggers minimize anim.
+                mView.setMinimizedDockStack(false /* minimized */, mHomeStackResizable);
             }
-        });
+            // Notify existence listeners
+            synchronized (mDockedStackExistsListeners) {
+                mDockedStackExistsListeners.removeIf(wf -> {
+                    Consumer<Boolean> l = wf.get();
+                    if (l != null) l.accept(visible);
+                    return l == null;
+                });
+            }
+        }
+    }
+
+    private void setHomeStackResizable(boolean resizable) {
+        if (mHomeStackResizable == resizable) {
+            return;
+        }
+        mHomeStackResizable = resizable;
+        if (!inSplitMode()) {
+            return;
+        }
+        WindowManagerProxy.applyHomeTasksMinimized(mSplitLayout, mSplits.mSecondary.token);
     }
 
     private void updateMinimizedDockedStack(final boolean minimized, final long animDuration,
             final boolean isHomeStackResizable) {
-        mView.post(new Runnable() {
-            @Override
-            public void run() {
-                mHomeStackResizable = isHomeStackResizable;
-                if (mMinimized != minimized) {
-                    mMinimized = minimized;
-                    updateTouchable();
-                    if (animDuration > 0) {
-                        mView.setMinimizedDockStack(minimized, animDuration, isHomeStackResizable);
-                    } else {
-                        mView.setMinimizedDockStack(minimized, isHomeStackResizable);
-                    }
-                }
+        setHomeStackResizable(isHomeStackResizable);
+        if (animDuration > 0) {
+            mView.setMinimizedDockStack(minimized, animDuration, isHomeStackResizable);
+        } else {
+            mView.setMinimizedDockStack(minimized, isHomeStackResizable);
+        }
+        updateTouchable();
+    }
+
+    /** Switch to minimized state if appropriate */
+    public void setMinimized(final boolean minimized) {
+        mHandler.post(() -> {
+            if (!inSplitMode()) {
+                return;
             }
+            if (mMinimized == minimized) {
+                return;
+            }
+            mMinimized = minimized;
+            mView.setMinimizedDockStack(minimized, getAnimDuration(), mHomeStackResizable);
+            updateTouchable();
         });
     }
 
-    private void notifyDockedStackExistsChanged(final boolean exists) {
-        mView.post(new Runnable() {
-            @Override
-            public void run() {
-                mForcedResizableController.notifyDockedStackExistsChanged(exists);
-            }
-        });
+    void setAdjustedForIme(boolean adjustedForIme) {
+        if (mAdjustedForIme == adjustedForIme) {
+            return;
+        }
+        mAdjustedForIme = adjustedForIme;
+        updateTouchable();
     }
 
     private void updateTouchable() {
         mWindowManager.setTouchable((mHomeStackResizable || !mMinimized) && !mAdjustedForIme);
     }
 
-    public void onRecentsActivityStarting() {
-        if (mView != null) {
-            mView.onRecentsActivityStarting();
-        }
-    }
-
     /**
      * Workaround for b/62528361, at the time recents has drawn, it may happen before a
      * configuration change to the Divider, and internally, the event will be posted to the
@@ -206,6 +448,9 @@
     }
 
     public void onAppTransitionFinished() {
+        if (mView == null) {
+            return;
+        }
         mForcedResizableController.onAppTransitionFinished();
     }
 
@@ -231,46 +476,66 @@
         pw.print("  mAdjustedForIme="); pw.println(mAdjustedForIme);
     }
 
-    class DockDividerVisibilityListener extends IDockedStackListener.Stub {
+    long getAnimDuration() {
+        float transitionScale = Settings.Global.getFloat(mContext.getContentResolver(),
+                Settings.Global.TRANSITION_ANIMATION_SCALE,
+                mContext.getResources().getFloat(
+                        com.android.internal.R.dimen
+                                .config_appTransitionAnimationDurationScaleDefault));
+        final long transitionDuration = DEFAULT_APP_TRANSITION_DURATION;
+        return (long) (transitionDuration * transitionScale);
+    }
 
-        @Override
-        public void onDividerVisibilityChanged(boolean visible) throws RemoteException {
-            updateVisibility(visible);
+    /** Register a listener that gets called whenever the existence of the divider changes */
+    public void registerInSplitScreenListener(Consumer<Boolean> listener) {
+        listener.accept(inSplitMode());
+        synchronized (mDockedStackExistsListeners) {
+            mDockedStackExistsListeners.add(new WeakReference<>(listener));
         }
+    }
 
-        @Override
-        public void onDockedStackExistsChanged(boolean exists) throws RemoteException {
-            notifyDockedStackExistsChanged(exists);
+    void startEnterSplit() {
+        // Set resizable directly here because applyEnterSplit already resizes home stack.
+        mHomeStackResizable = WindowManagerProxy.applyEnterSplit(mSplits, mSplitLayout);
+    }
+
+    void ensureMinimizedSplit() {
+        final boolean wasMinimized = mMinimized;
+        mMinimized = true;
+        setHomeStackResizable(mSplits.mSecondary.isResizable());
+        if (!inSplitMode()) {
+            // Wasn't in split-mode yet, so enter now.
+            if (DEBUG) {
+                Log.d(TAG, " entering split mode with minimized=true");
+            }
+            updateVisibility(true /* visible */);
+        } else if (!wasMinimized) {
+            if (DEBUG) {
+                Log.d(TAG, " in split mode, but minimizing ");
+            }
+            // Was already in split-mode, update just minimized state.
+            updateMinimizedDockedStack(mMinimized, getAnimDuration(),
+                    mHomeStackResizable);
         }
+    }
 
-        @Override
-        public void onDockedStackMinimizedChanged(boolean minimized, long animDuration,
-                boolean isHomeStackResizable) throws RemoteException {
-            mHomeStackResizable = isHomeStackResizable;
-            updateMinimizedDockedStack(minimized, animDuration, isHomeStackResizable);
+    void ensureNormalSplit() {
+        if (!inSplitMode()) {
+            // Wasn't in split-mode, so enter now.
+            if (DEBUG) {
+                Log.d(TAG, " enter split mode unminimized ");
+            }
+            mMinimized = false;
+            updateVisibility(true /* visible */);
         }
-
-        @Override
-        public void onAdjustedForImeChanged(boolean adjustedForIme, long animDuration)
-                throws RemoteException {
-            mView.post(() -> {
-                if (mAdjustedForIme != adjustedForIme) {
-                    mAdjustedForIme = adjustedForIme;
-                    updateTouchable();
-                    if (!mMinimized) {
-                        if (animDuration > 0) {
-                            mView.setAdjustedForIme(adjustedForIme, animDuration);
-                        } else {
-                            mView.setAdjustedForIme(adjustedForIme);
-                        }
-                    }
-                }
-            });
-        }
-
-        @Override
-        public void onDockSideChanged(final int newDockSide) throws RemoteException {
-            mView.post(() -> mView.notifyDockSideChanged(newDockSide));
+        if (mMinimized) {
+            // Was in minimized state, so leave that.
+            if (DEBUG) {
+                Log.d(TAG, " in split mode already, but unminimizing ");
+            }
+            mMinimized = false;
+            updateMinimizedDockedStack(mMinimized, getAnimDuration(),
+                    mHomeStackResizable);
         }
     }
 }
diff --git a/packages/SystemUI/src/com/android/systemui/stackdivider/DividerModule.java b/packages/SystemUI/src/com/android/systemui/stackdivider/DividerModule.java
index 49f4d5e..3b7f315 100644
--- a/packages/SystemUI/src/com/android/systemui/stackdivider/DividerModule.java
+++ b/packages/SystemUI/src/com/android/systemui/stackdivider/DividerModule.java
@@ -17,8 +17,15 @@
 package com.android.systemui.stackdivider;
 
 import android.content.Context;
+import android.os.Handler;
 
+import com.android.systemui.TransactionPool;
+import com.android.systemui.dagger.qualifiers.Main;
 import com.android.systemui.recents.Recents;
+import com.android.systemui.statusbar.policy.KeyguardStateController;
+import com.android.systemui.wm.DisplayController;
+import com.android.systemui.wm.DisplayImeController;
+import com.android.systemui.wm.SystemWindows;
 
 import java.util.Optional;
 
@@ -35,7 +42,11 @@
 public class DividerModule {
     @Singleton
     @Provides
-    static Divider provideDivider(Context context, Optional<Lazy<Recents>> recentsOptionalLazy) {
-        return new Divider(context, recentsOptionalLazy);
+    static Divider provideDivider(Context context, Optional<Lazy<Recents>> recentsOptionalLazy,
+            DisplayController displayController, SystemWindows systemWindows,
+            DisplayImeController imeController, @Main Handler handler,
+            KeyguardStateController keyguardStateController, TransactionPool transactionPool) {
+        return new Divider(context, recentsOptionalLazy, displayController, systemWindows,
+                imeController, handler, keyguardStateController, transactionPool);
     }
 }
diff --git a/packages/SystemUI/src/com/android/systemui/stackdivider/DividerView.java b/packages/SystemUI/src/com/android/systemui/stackdivider/DividerView.java
index 9fe6e84..375d9bb 100644
--- a/packages/SystemUI/src/com/android/systemui/stackdivider/DividerView.java
+++ b/packages/SystemUI/src/com/android/systemui/stackdivider/DividerView.java
@@ -16,12 +16,8 @@
 
 package com.android.systemui.stackdivider;
 
-import static android.app.WindowConfiguration.WINDOWING_MODE_SPLIT_SCREEN_PRIMARY;
-import static android.app.WindowConfiguration.WINDOWING_MODE_SPLIT_SCREEN_SECONDARY;
-import static android.app.WindowConfiguration.WINDOWING_MODE_UNDEFINED;
 import static android.view.PointerIcon.TYPE_HORIZONTAL_DOUBLE_ARROW;
 import static android.view.PointerIcon.TYPE_VERTICAL_DOUBLE_ARROW;
-import static android.view.WindowManager.DOCKED_LEFT;
 import static android.view.WindowManager.DOCKED_RIGHT;
 import static android.view.WindowManager.LayoutParams.SOFT_INPUT_ADJUST_NOTHING;
 
@@ -40,10 +36,11 @@
 import android.util.AttributeSet;
 import android.view.Choreographer;
 import android.view.Display;
-import android.view.DisplayInfo;
 import android.view.InsetsState;
 import android.view.MotionEvent;
 import android.view.PointerIcon;
+import android.view.SurfaceControl;
+import android.view.SurfaceControl.Transaction;
 import android.view.VelocityTracker;
 import android.view.View;
 import android.view.View.OnTouchListener;
@@ -75,6 +72,7 @@
  */
 public class DividerView extends FrameLayout implements OnTouchListener,
         OnComputeInternalInsetsListener {
+    private static final String TAG = "DividerView";
 
     public interface DividerCallbacks {
         void onDraggingStart();
@@ -123,14 +121,11 @@
     private int mTouchSlop;
     private boolean mBackgroundLifted;
     private boolean mIsInMinimizeInteraction;
-    private SnapTarget mSnapTargetBeforeMinimized;
+    SnapTarget mSnapTargetBeforeMinimized;
 
     private int mDividerInsets;
     private final Display mDefaultDisplay;
-    private int mDisplayWidth;
-    private int mDisplayHeight;
-    private int mDisplayRotation;
-    private int mDividerWindowWidth;
+
     private int mDividerSize;
     private int mTouchElevation;
     private int mLongPressEntraceAnimDuration;
@@ -147,8 +142,7 @@
     private DividerWindowManager mWindowManager;
     private VelocityTracker mVelocityTracker;
     private FlingAnimationUtils mFlingAnimationUtils;
-    private DividerSnapAlgorithm mSnapAlgorithm;
-    private DividerSnapAlgorithm mMinimizedSnapAlgorithm;
+    private SplitDisplayLayout mSplitLayout;
     private DividerCallbacks mCallback;
     private final Rect mStableInsets = new Rect();
 
@@ -163,6 +157,10 @@
     private DividerState mState;
     private final SurfaceFlingerVsyncChoreographer mSfChoreographer;
 
+    private SplitScreenTaskOrganizer mTiles;
+    boolean mFirstLayout = true;
+    int mDividerPositionX;
+    int mDividerPositionY;
 
     // The view is removed or in the process of been removed from the system.
     private boolean mRemoved;
@@ -172,7 +170,7 @@
         public void handleMessage(Message msg) {
             switch (msg.what) {
                 case MSG_RESIZE_STACK:
-                    resizeStack(msg.arg1, msg.arg2, (SnapTarget) msg.obj);
+                    resizeStackSurfaces(msg.arg1, msg.arg2, (SnapTarget) msg.obj);
                     break;
                 default:
                     super.handleMessage(msg);
@@ -228,16 +226,17 @@
         public boolean performAccessibilityAction(View host, int action, Bundle args) {
             int currentPosition = getCurrentPosition();
             SnapTarget nextTarget = null;
+            DividerSnapAlgorithm snapAlgorithm = mSplitLayout.getSnapAlgorithm();
             if (action == R.id.action_move_tl_full) {
-                nextTarget = mSnapAlgorithm.getDismissEndTarget();
+                nextTarget = snapAlgorithm.getDismissEndTarget();
             } else if (action == R.id.action_move_tl_70) {
-                nextTarget = mSnapAlgorithm.getLastSplitTarget();
+                nextTarget = snapAlgorithm.getLastSplitTarget();
             } else if (action == R.id.action_move_tl_50) {
-                nextTarget = mSnapAlgorithm.getMiddleTarget();
+                nextTarget = snapAlgorithm.getMiddleTarget();
             } else if (action == R.id.action_move_tl_30) {
-                nextTarget = mSnapAlgorithm.getFirstSplitTarget();
+                nextTarget = snapAlgorithm.getFirstSplitTarget();
             } else if (action == R.id.action_move_rb_full) {
-                nextTarget = mSnapAlgorithm.getDismissStartTarget();
+                nextTarget = snapAlgorithm.getDismissStartTarget();
             }
             if (nextTarget != null) {
                 startDragging(true /* animate */, false /* touching */);
@@ -284,11 +283,11 @@
         mBackground = findViewById(R.id.docked_divider_background);
         mMinimizedShadow = findViewById(R.id.minimized_dock_shadow);
         mHandle.setOnTouchListener(this);
-        mDividerWindowWidth = getResources().getDimensionPixelSize(
+        final int dividerWindowWidth = getResources().getDimensionPixelSize(
                 com.android.internal.R.dimen.docked_stack_divider_thickness);
         mDividerInsets = getResources().getDimensionPixelSize(
                 com.android.internal.R.dimen.docked_stack_divider_insets);
-        mDividerSize = mDividerWindowWidth - 2 * mDividerInsets;
+        mDividerSize = dividerWindowWidth - 2 * mDividerInsets;
         mTouchElevation = getResources().getDimensionPixelSize(
                 R.dimen.docked_stack_divider_lift_elevation);
         mLongPressEntraceAnimDuration = getResources().getInteger(
@@ -296,7 +295,6 @@
         mGrowRecents = getResources().getBoolean(R.bool.recents_grow_in_multiwindow);
         mTouchSlop = ViewConfiguration.get(mContext).getScaledTouchSlop();
         mFlingAnimationUtils = new FlingAnimationUtils(getResources().getDisplayMetrics(), 0.3f);
-        updateDisplayInfo();
         boolean landscape = getResources().getConfiguration().orientation
                 == Configuration.ORIENTATION_LANDSCAPE;
         mHandle.setPointerIcon(PointerIcon.getSystemIcon(getContext(),
@@ -314,6 +312,7 @@
                 && !mIsInMinimizeInteraction) {
             saveSnapTargetBeforeMinimized(mSnapTargetBeforeMinimized);
         }
+        mFirstLayout = true;
     }
 
     void onDividerRemoved() {
@@ -341,17 +340,17 @@
                 || mStableInsets.bottom != insets.getStableInsetBottom()) {
             mStableInsets.set(insets.getStableInsetLeft(), insets.getStableInsetTop(),
                     insets.getStableInsetRight(), insets.getStableInsetBottom());
-            if (mSnapAlgorithm != null || mMinimizedSnapAlgorithm != null) {
-                mSnapAlgorithm = null;
-                mMinimizedSnapAlgorithm = null;
-                initializeSnapAlgorithm();
-            }
         }
         return super.onApplyWindowInsets(insets);
     }
 
     @Override
     protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
+        if (mFirstLayout) {
+            // Wait for first layout so that the ViewRootImpl surface has been created.
+            initializeSurfaceState();
+            mFirstLayout = false;
+        }
         super.onLayout(changed, left, top, right, bottom);
         int minimizeLeft = 0;
         int minimizeTop = 0;
@@ -372,19 +371,16 @@
     }
 
     public void injectDependencies(DividerWindowManager windowManager, DividerState dividerState,
-            DividerCallbacks callback) {
+            DividerCallbacks callback, SplitScreenTaskOrganizer tiles, SplitDisplayLayout sdl) {
         mWindowManager = windowManager;
         mState = dividerState;
         mCallback = callback;
-
-        // Set the previous position ratio before minimized state after attaching this divider
-        if (mStableInsets.isEmpty()) {
-            WindowManagerWrapper.getInstance().getStableInsets(mStableInsets);
-        }
+        mTiles = tiles;
+        mSplitLayout = sdl;
 
         if (mState.mRatioPositionBeforeMinimized == 0) {
             // Set the middle target as the initial state
-            mSnapTargetBeforeMinimized = mSnapAlgorithm.getMiddleTarget();
+            mSnapTargetBeforeMinimized = mSplitLayout.getSnapAlgorithm().getMiddleTarget();
         } else {
             repositionSnapTargetBeforeMinimized();
         }
@@ -411,18 +407,35 @@
         return mOtherTaskRect;
     }
 
+    private boolean inSplitMode() {
+        return getVisibility() == VISIBLE;
+    }
+
+    /** Unlike setVisible, this directly hides the surface without changing view visibility. */
+    void setHidden(boolean hidden) {
+        post(() -> {
+            final SurfaceControl sc = getWindowSurfaceControl();
+            if (sc == null) {
+                return;
+            }
+            Transaction t = mTiles.getTransaction();
+            if (hidden) {
+                t.hide(sc);
+            } else {
+                t.show(sc);
+            }
+            t.apply();
+            mTiles.releaseTransaction(t);
+        });
+    }
+
     public boolean startDragging(boolean animate, boolean touching) {
         cancelFlingAnimation();
         if (touching) {
             mHandle.setTouching(true, animate);
         }
-        mDockSide = mWindowManagerProxy.getDockSide();
+        mDockSide = mSplitLayout.getPrimarySplitSide();
 
-        // Update snap algorithm if rotation has occurred
-        if (mDisplayRotation != mDefaultDisplay.getRotation()) {
-            updateDisplayInfo();
-        }
-        initializeSnapAlgorithm();
         mWindowManagerProxy.setResizing(true);
         if (touching) {
             mWindowManager.setSlippery(false);
@@ -431,7 +444,7 @@
         if (mCallback != null) {
             mCallback.onDraggingStart();
         }
-        return mDockSide != WindowManager.DOCKED_INVALID;
+        return inSplitMode();
     }
 
     public void stopDragging(int position, float velocity, boolean avoidDismissStart,
@@ -467,38 +480,22 @@
     }
 
     private void updateDockSide() {
-        mDockSide = mWindowManagerProxy.getDockSide();
+        mDockSide = mSplitLayout.getPrimarySplitSide();
         mMinimizedShadow.setDockSide(mDockSide);
     }
 
-    private void initializeSnapAlgorithm() {
-        if (mSnapAlgorithm == null) {
-            mSnapAlgorithm = new DividerSnapAlgorithm(getContext().getResources(), mDisplayWidth,
-                    mDisplayHeight, mDividerSize, isHorizontalDivision(), mStableInsets, mDockSide);
-            if (mSnapTargetBeforeMinimized != null && mSnapTargetBeforeMinimized.isMiddleTarget) {
-                mSnapTargetBeforeMinimized = mSnapAlgorithm.getMiddleTarget();
-            }
-        }
-        if (mMinimizedSnapAlgorithm == null) {
-            mMinimizedSnapAlgorithm = new DividerSnapAlgorithm(getContext().getResources(),
-                    mDisplayWidth, mDisplayHeight, mDividerSize, isHorizontalDivision(),
-                    mStableInsets, mDockSide, mDockedStackMinimized && mHomeStackResizable);
-        }
-    }
-
     public DividerSnapAlgorithm getSnapAlgorithm() {
-        initializeSnapAlgorithm();
-        return mDockedStackMinimized && mHomeStackResizable ? mMinimizedSnapAlgorithm :
-                mSnapAlgorithm;
+        return mDockedStackMinimized
+                && mHomeStackResizable ? mSplitLayout.getMinimizedSnapAlgorithm()
+                        : mSplitLayout.getSnapAlgorithm();
     }
 
     public int getCurrentPosition() {
-        getLocationOnScreen(mTempInt2);
-        if (isHorizontalDivision()) {
-            return mTempInt2[1] + mDividerInsets;
-        } else {
-            return mTempInt2[0] + mDividerInsets;
-        }
+        return isHorizontalDivision() ? mDividerPositionY : mDividerPositionX;
+    }
+
+    public boolean isMinimized() {
+        return mDockedStackMinimized;
     }
 
     @Override
@@ -557,25 +554,25 @@
     }
 
     private void logResizeEvent(SnapTarget snapTarget) {
-        if (snapTarget == mSnapAlgorithm.getDismissStartTarget()) {
+        if (snapTarget == mSplitLayout.getSnapAlgorithm().getDismissStartTarget()) {
             MetricsLogger.action(
                     mContext, MetricsEvent.ACTION_WINDOW_UNDOCK_MAX, dockSideTopLeft(mDockSide)
                             ? LOG_VALUE_UNDOCK_MAX_OTHER
                             : LOG_VALUE_UNDOCK_MAX_DOCKED);
-        } else if (snapTarget == mSnapAlgorithm.getDismissEndTarget()) {
+        } else if (snapTarget == mSplitLayout.getSnapAlgorithm().getDismissEndTarget()) {
             MetricsLogger.action(
                     mContext, MetricsEvent.ACTION_WINDOW_UNDOCK_MAX, dockSideBottomRight(mDockSide)
                             ? LOG_VALUE_UNDOCK_MAX_OTHER
                             : LOG_VALUE_UNDOCK_MAX_DOCKED);
-        } else if (snapTarget == mSnapAlgorithm.getMiddleTarget()) {
+        } else if (snapTarget == mSplitLayout.getSnapAlgorithm().getMiddleTarget()) {
             MetricsLogger.action(mContext, MetricsEvent.ACTION_WINDOW_DOCK_RESIZE,
                     LOG_VALUE_RESIZE_50_50);
-        } else if (snapTarget == mSnapAlgorithm.getFirstSplitTarget()) {
+        } else if (snapTarget == mSplitLayout.getSnapAlgorithm().getFirstSplitTarget()) {
             MetricsLogger.action(mContext, MetricsEvent.ACTION_WINDOW_DOCK_RESIZE,
                     dockSideTopLeft(mDockSide)
                             ? LOG_VALUE_RESIZE_DOCKED_SMALLER
                             : LOG_VALUE_RESIZE_DOCKED_LARGER);
-        } else if (snapTarget == mSnapAlgorithm.getLastSplitTarget()) {
+        } else if (snapTarget == mSplitLayout.getSnapAlgorithm().getLastSplitTarget()) {
             MetricsLogger.action(mContext, MetricsEvent.ACTION_WINDOW_DOCK_RESIZE,
                     dockSideTopLeft(mDockSide)
                             ? LOG_VALUE_RESIZE_DOCKED_LARGER
@@ -625,12 +622,16 @@
                         : snapTarget.taskPosition,
                 snapTarget));
         Runnable endAction = () -> {
-            commitSnapFlags(snapTarget);
+            boolean dismissed = commitSnapFlags(snapTarget);
             mWindowManagerProxy.setResizing(false);
             updateDockSide();
             mCurrentAnimator = null;
             mEntranceAnimationRunning = false;
             mExitAnimationRunning = false;
+            if (!dismissed) {
+                WindowManagerProxy.applyResizeSplits((mIsInMinimizeInteraction
+                        ? mSnapTargetBeforeMinimized : snapTarget).position, mSplitLayout);
+            }
             if (mCallback != null) {
                 mCallback.onDraggingEnd();
             }
@@ -642,12 +643,13 @@
                 // position isn't negative.
                 final SnapTarget saveTarget;
                 if (snapTarget.position < 0) {
-                    saveTarget = mSnapAlgorithm.getMiddleTarget();
+                    saveTarget = mSplitLayout.getSnapAlgorithm().getMiddleTarget();
                 } else {
                     saveTarget = snapTarget;
                 }
-                if (saveTarget.position != mSnapAlgorithm.getDismissEndTarget().position
-                        && saveTarget.position != mSnapAlgorithm.getDismissStartTarget().position) {
+                final DividerSnapAlgorithm snapAlgo = mSplitLayout.getSnapAlgorithm();
+                if (saveTarget.position != snapAlgo.getDismissEndTarget().position
+                        && saveTarget.position != snapAlgo.getDismissStartTarget().position) {
                     saveSnapTargetBeforeMinimized(saveTarget);
                 }
             }
@@ -701,11 +703,11 @@
         }
     }
 
-    private void commitSnapFlags(SnapTarget target) {
+    private boolean commitSnapFlags(SnapTarget target) {
         if (target.flag == SnapTarget.FLAG_NONE) {
-            return;
+            return false;
         }
-        boolean dismissOrMaximize;
+        final boolean dismissOrMaximize;
         if (target.flag == SnapTarget.FLAG_DISMISS_START) {
             dismissOrMaximize = mDockSide == WindowManager.DOCKED_LEFT
                     || mDockSide == WindowManager.DOCKED_TOP;
@@ -713,12 +715,13 @@
             dismissOrMaximize = mDockSide == WindowManager.DOCKED_RIGHT
                     || mDockSide == WindowManager.DOCKED_BOTTOM;
         }
-        if (dismissOrMaximize) {
-            mWindowManagerProxy.dismissDockedStack();
-        } else {
-            mWindowManagerProxy.maximizeDockedStack();
-        }
-        mWindowManagerProxy.setResizeDimLayer(false, WINDOWING_MODE_UNDEFINED, 0f);
+        mWindowManagerProxy.dismissOrMaximizeDocked(mTiles, dismissOrMaximize);
+        Transaction t = mTiles.getTransaction();
+        setResizeDimLayer(t, true /* primary */, 0f);
+        setResizeDimLayer(t, false /* primary */, 0f);
+        t.apply();
+        mTiles.releaseTransaction(t);
+        return true;
     }
 
     private void liftBackground() {
@@ -765,6 +768,28 @@
         mBackgroundLifted = false;
     }
 
+    private void initializeSurfaceState() {
+        int midPos = mSplitLayout.getSnapAlgorithm().getMiddleTarget().position;
+        // Recalculate the split-layout's internal tile bounds
+        mSplitLayout.resizeSplits(midPos);
+        Transaction t = mTiles.getTransaction();
+        if (mDockedStackMinimized) {
+            int position = mSplitLayout.getMinimizedSnapAlgorithm().getMiddleTarget().position;
+            calculateBoundsForPosition(position, mDockSide, mDockedRect);
+            calculateBoundsForPosition(position, DockedDividerUtils.invertDockSide(mDockSide),
+                    mOtherRect);
+            mDividerPositionX = mDividerPositionY = position;
+            resizeSplitSurfaces(t, mDockedRect, mSplitLayout.mPrimary,
+                    mOtherRect, mSplitLayout.mSecondary);
+        } else {
+            resizeSplitSurfaces(t, mSplitLayout.mPrimary, null,
+                    mSplitLayout.mSecondary, null);
+        }
+        setResizeDimLayer(t, true /* primary */, 0.f /* alpha */);
+        setResizeDimLayer(t, false /* secondary */, 0.f /* alpha */);
+        t.apply();
+        mTiles.releaseTransaction(t);
+    }
 
     public void setMinimizedDockStack(boolean minimized, boolean isHomeStackResizable) {
         mHomeStackResizable = isHomeStackResizable;
@@ -789,15 +814,11 @@
             mDockedStackMinimized = minimized;
         } else if (mDockedStackMinimized != minimized) {
             mDockedStackMinimized = minimized;
-            if (mDisplayRotation != mDefaultDisplay.getRotation()) {
+            if (mSplitLayout.mDisplayLayout.rotation() != mDefaultDisplay.getRotation()) {
                 // Splitscreen to minimize is about to starts after rotating landscape to seascape,
                 // update insets, display info and snap algorithm targets
                 WindowManagerWrapper.getInstance().getStableInsets(mStableInsets);
                 repositionSnapTargetBeforeMinimized();
-                updateDisplayInfo();
-            } else {
-                mMinimizedSnapAlgorithm = null;
-                initializeSnapAlgorithm();
             }
             if (mIsInMinimizeInteraction != minimized || mCurrentAnimator != null) {
                 cancelFlingAnimation();
@@ -805,15 +826,64 @@
                     // Relayout to recalculate the divider shadow when minimizing
                     requestLayout();
                     mIsInMinimizeInteraction = true;
-                    resizeStack(mMinimizedSnapAlgorithm.getMiddleTarget());
+                    resizeStackSurfaces(mSplitLayout.getMinimizedSnapAlgorithm().getMiddleTarget());
                 } else {
-                    resizeStack(mSnapTargetBeforeMinimized);
+                    resizeStackSurfaces(mSnapTargetBeforeMinimized);
                     mIsInMinimizeInteraction = false;
                 }
             }
         }
     }
 
+    void enterSplitMode(boolean isHomeStackResizable) {
+        post(() -> {
+            final SurfaceControl sc = getWindowSurfaceControl();
+            if (sc == null) {
+                return;
+            }
+            Transaction t = mTiles.getTransaction();
+            t.show(sc).apply();
+            mTiles.releaseTransaction(t);
+        });
+        if (isHomeStackResizable) {
+            SnapTarget miniMid = mSplitLayout.getMinimizedSnapAlgorithm().getMiddleTarget();
+            if (mDockedStackMinimized) {
+                mDividerPositionY = mDividerPositionX = miniMid.position;
+            }
+        }
+    }
+
+    /**
+     * Tries to grab a surface control from ViewRootImpl. If this isn't available for some reason
+     * (ie. the window isn't ready yet), it will get the surfacecontrol that the WindowlessWM has
+     * assigned to it.
+     */
+    private SurfaceControl getWindowSurfaceControl() {
+        if (getViewRootImpl() == null) {
+            return null;
+        }
+        SurfaceControl out = getViewRootImpl().getSurfaceControl();
+        if (out != null && out.isValid()) {
+            return out;
+        }
+        return mWindowManager.mSystemWindows.getViewSurface(this);
+    }
+
+    void exitSplitMode() {
+        // Reset tile bounds
+        post(() -> {
+            final SurfaceControl sc = getWindowSurfaceControl();
+            if (sc == null) {
+                return;
+            }
+            Transaction t = mTiles.getTransaction();
+            t.hide(sc).apply();
+            mTiles.releaseTransaction(t);
+        });
+        int midPos = mSplitLayout.getSnapAlgorithm().getMiddleTarget().position;
+        WindowManagerProxy.applyResizeSplits(midPos, mSplitLayout);
+    }
+
     public void setMinimizedDockStack(boolean minimized, long animDuration,
             boolean isHomeStackResizable) {
         mHomeStackResizable = isHomeStackResizable;
@@ -844,14 +914,12 @@
             mDockedStackMinimized = minimized;
         } else if (mDockedStackMinimized != minimized) {
             mIsInMinimizeInteraction = true;
-            mMinimizedSnapAlgorithm = null;
             mDockedStackMinimized = minimized;
-            initializeSnapAlgorithm();
             stopDragging(minimized
                             ? mSnapTargetBeforeMinimized.position
                             : getCurrentPosition(),
                     minimized
-                            ? mMinimizedSnapAlgorithm.getMiddleTarget()
+                            ? mSplitLayout.getMinimizedSnapAlgorithm().getMiddleTarget()
                             : mSnapTargetBeforeMinimized,
                     animDuration, Interpolators.FAST_OUT_SLOW_IN, 0);
             setAdjustedForIme(false, animDuration);
@@ -865,18 +933,6 @@
                 .start();
     }
 
-    public void setAdjustedForIme(boolean adjustedForIme) {
-        updateDockSide();
-        mHandle.setAlpha(adjustedForIme ? 0f : 1f);
-        if (!adjustedForIme) {
-            resetBackground();
-        } else if (mDockSide == WindowManager.DOCKED_TOP) {
-            mBackground.setPivotY(0);
-            mBackground.setScaleY(ADJUSTED_FOR_IME_SCALE);
-        }
-        mAdjustedForIme = adjustedForIme;
-    }
-
     public void setAdjustedForIme(boolean adjustedForIme, long animDuration) {
         updateDockSide();
         mHandle.animate()
@@ -902,7 +958,8 @@
     private void saveSnapTargetBeforeMinimized(SnapTarget target) {
         mSnapTargetBeforeMinimized = target;
         mState.mRatioPositionBeforeMinimized = (float) target.position /
-                (isHorizontalDivision() ? mDisplayHeight : mDisplayWidth);
+                (isHorizontalDivision() ? mSplitLayout.mDisplayLayout.height()
+                        : mSplitLayout.mDisplayLayout.width());
     }
 
     private void resetBackground() {
@@ -916,51 +973,17 @@
     @Override
     protected void onConfigurationChanged(Configuration newConfig) {
         super.onConfigurationChanged(newConfig);
-        updateDisplayInfo();
-    }
-
-    public void notifyDockSideChanged(int newDockSide) {
-        int oldDockSide = mDockSide;
-        mDockSide = newDockSide;
-        mMinimizedShadow.setDockSide(mDockSide);
-        requestLayout();
-
-        // Update the snap position to the new docked side with correct insets
-        WindowManagerWrapper.getInstance().getStableInsets(mStableInsets);
-        mMinimizedSnapAlgorithm = null;
-        initializeSnapAlgorithm();
-
-        if (oldDockSide == DOCKED_LEFT && mDockSide == DOCKED_RIGHT
-                || oldDockSide == DOCKED_RIGHT && mDockSide == DOCKED_LEFT) {
-            repositionSnapTargetBeforeMinimized();
-        }
-
-        // Landscape to seascape rotation requires minimized to resize docked app correctly
-        if (mHomeStackResizable && mDockedStackMinimized) {
-            resizeStack(mMinimizedSnapAlgorithm.getMiddleTarget());
-        }
     }
 
     private void repositionSnapTargetBeforeMinimized() {
         int position = (int) (mState.mRatioPositionBeforeMinimized *
-                (isHorizontalDivision() ? mDisplayHeight : mDisplayWidth));
-        mSnapAlgorithm = null;
-        initializeSnapAlgorithm();
+                (isHorizontalDivision() ? mSplitLayout.mDisplayLayout.height()
+                        : mSplitLayout.mDisplayLayout.width()));
 
         // Set the snap target before minimized but do not save until divider is attached and not
         // minimized because it does not know its minimized state yet.
-        mSnapTargetBeforeMinimized = mSnapAlgorithm.calculateNonDismissingSnapTarget(position);
-    }
-
-    private void updateDisplayInfo() {
-        mDisplayRotation = mDefaultDisplay.getRotation();
-        final DisplayInfo info = new DisplayInfo();
-        mDefaultDisplay.getDisplayInfo(info);
-        mDisplayWidth = info.logicalWidth;
-        mDisplayHeight = info.logicalHeight;
-        mSnapAlgorithm = null;
-        mMinimizedSnapAlgorithm = null;
-        initializeSnapAlgorithm();
+        mSnapTargetBeforeMinimized =
+                mSplitLayout.getSnapAlgorithm().calculateNonDismissingSnapTarget(position);
     }
 
     private int calculatePosition(int touchX, int touchY) {
@@ -994,8 +1017,9 @@
     }
 
     public void calculateBoundsForPosition(int position, int dockSide, Rect outRect) {
-        DockedDividerUtils.calculateBoundsForPosition(position, dockSide, outRect, mDisplayWidth,
-                mDisplayHeight, mDividerSize);
+        DockedDividerUtils.calculateBoundsForPosition(position, dockSide, outRect,
+                mSplitLayout.mDisplayLayout.width(), mSplitLayout.mDisplayLayout.height(),
+                mDividerSize);
     }
 
     public void resizeStackDelayed(int position, int taskPosition, SnapTarget taskSnapTarget) {
@@ -1005,16 +1029,60 @@
         mSfChoreographer.scheduleAtSfVsync(mHandler, message);
     }
 
-    private void resizeStack(SnapTarget taskSnapTarget) {
-        resizeStack(taskSnapTarget.position, taskSnapTarget.position, taskSnapTarget);
+    private void resizeStackSurfaces(SnapTarget taskSnapTarget) {
+        resizeStackSurfaces(taskSnapTarget.position, taskSnapTarget.position, taskSnapTarget);
     }
 
-    public void resizeStack(int position, int taskPosition, SnapTarget taskSnapTarget) {
+    void resizeSplitSurfaces(Transaction t, Rect dockedRect, Rect otherRect) {
+        resizeSplitSurfaces(t, dockedRect, null, otherRect, null);
+    }
+
+    private void resizeSplitSurfaces(Transaction t, Rect dockedRect, Rect dockedTaskRect,
+            Rect otherRect, Rect otherTaskRect) {
+        dockedTaskRect = dockedTaskRect == null ? dockedRect : dockedTaskRect;
+        otherTaskRect = otherTaskRect == null ? otherRect : otherTaskRect;
+
+        mDividerPositionX = dockedRect.right;
+        mDividerPositionY = dockedRect.bottom;
+
+        t.setPosition(mTiles.mPrimarySurface, dockedTaskRect.left, dockedTaskRect.top);
+        Rect crop = new Rect(dockedRect);
+        crop.offsetTo(-Math.min(dockedTaskRect.left - dockedRect.left, 0),
+                -Math.min(dockedTaskRect.top - dockedRect.top, 0));
+        t.setWindowCrop(mTiles.mPrimarySurface, crop);
+        t.setPosition(mTiles.mSecondarySurface, otherTaskRect.left, otherTaskRect.top);
+        crop.set(otherRect);
+        crop.offsetTo(-(otherTaskRect.left - otherRect.left),
+                -(otherTaskRect.top - otherRect.top));
+        t.setWindowCrop(mTiles.mSecondarySurface, crop);
+        final SurfaceControl dividerCtrl = getWindowSurfaceControl();
+        if (dividerCtrl != null) {
+            if (isHorizontalDivision()) {
+                t.setPosition(dividerCtrl, 0, mDividerPositionY - mDividerInsets);
+            } else {
+                t.setPosition(dividerCtrl, mDividerPositionX - mDividerInsets, 0);
+            }
+        }
+    }
+
+    void setResizeDimLayer(Transaction t, boolean primary, float alpha) {
+        SurfaceControl dim = primary ? mTiles.mPrimaryDim : mTiles.mSecondaryDim;
+        if (alpha <= 0.f) {
+            t.hide(dim);
+        } else {
+            t.setAlpha(dim, alpha);
+            t.show(dim);
+        }
+    }
+
+    void resizeStackSurfaces(int position, int taskPosition, SnapTarget taskSnapTarget) {
         if (mRemoved) {
             // This divider view has been removed so shouldn't have any additional influence.
             return;
         }
         calculateBoundsForPosition(position, mDockSide, mDockedRect);
+        calculateBoundsForPosition(position, DockedDividerUtils.invertDockSide(mDockSide),
+                mOtherRect);
 
         if (mDockedRect.equals(mLastResizeRect) && !mEntranceAnimationRunning) {
             return;
@@ -1025,6 +1093,7 @@
             mBackground.invalidate();
         }
 
+        Transaction t = mTiles.getTransaction();
         mLastResizeRect.set(mDockedRect);
         if (mHomeStackResizable && mIsInMinimizeInteraction) {
             calculateBoundsForPosition(mSnapTargetBeforeMinimized.position, mDockSide,
@@ -1037,8 +1106,10 @@
                 mDockedTaskRect.offset(Math.max(position, mStableInsets.left - mDividerSize)
                         - mDockedTaskRect.left + mDividerSize, 0);
             }
-            mWindowManagerProxy.resizeDockedStack(mDockedRect, mDockedTaskRect, mDockedTaskRect,
-                    mOtherTaskRect, null);
+            resizeSplitSurfaces(t, mDockedRect, mDockedTaskRect, mOtherRect,
+                    mOtherTaskRect);
+            t.apply();
+            mTiles.releaseTransaction(t);
             return;
         }
 
@@ -1052,8 +1123,7 @@
             }
             calculateBoundsForPosition(taskPosition, DockedDividerUtils.invertDockSide(mDockSide),
                     mOtherTaskRect);
-            mWindowManagerProxy.resizeDockedStack(mDockedRect, mDockedTaskRect, null,
-                    mOtherTaskRect, null);
+            resizeSplitSurfaces(t, mDockedRect, mDockedTaskRect, mOtherRect, mOtherTaskRect);
         } else if (mExitAnimationRunning && taskPosition != TASK_POSITION_SAME) {
             calculateBoundsForPosition(taskPosition, mDockSide, mDockedTaskRect);
             mDockedInsetRect.set(mDockedTaskRect);
@@ -1066,8 +1136,7 @@
             if (mDockSide == DOCKED_RIGHT) {
                 mDockedTaskRect.offset(position - mStableInsets.left + mDividerSize, 0);
             }
-            mWindowManagerProxy.resizeDockedStack(mDockedRect, mDockedTaskRect, mDockedInsetRect,
-                    mOtherTaskRect, mOtherInsetRect);
+            resizeSplitSurfaces(t, mDockedRect, mDockedTaskRect, mOtherRect, mOtherTaskRect);
         } else if (taskPosition != TASK_POSITION_SAME) {
             calculateBoundsForPosition(position, DockedDividerUtils.invertDockSide(mDockSide),
                     mOtherRect);
@@ -1078,7 +1147,8 @@
                     restrictDismissingTaskPosition(taskPosition, dockSideInverted, taskSnapTarget);
             calculateBoundsForPosition(taskPositionDocked, mDockSide, mDockedTaskRect);
             calculateBoundsForPosition(taskPositionOther, dockSideInverted, mOtherTaskRect);
-            mTmpRect.set(0, 0, mDisplayWidth, mDisplayHeight);
+            mTmpRect.set(0, 0, mSplitLayout.mDisplayLayout.width(),
+                    mSplitLayout.mDisplayLayout.height());
             alignTopLeft(mDockedRect, mDockedTaskRect);
             alignTopLeft(mOtherRect, mOtherTaskRect);
             mDockedInsetRect.set(mDockedTaskRect);
@@ -1094,15 +1164,15 @@
                     taskPositionDocked);
             applyDismissingParallax(mOtherTaskRect, dockSideInverted, taskSnapTarget, position,
                     taskPositionOther);
-            mWindowManagerProxy.resizeDockedStack(mDockedRect, mDockedTaskRect, mDockedInsetRect,
-                    mOtherTaskRect, mOtherInsetRect);
+            resizeSplitSurfaces(t, mDockedRect, mDockedTaskRect, mOtherRect, mOtherTaskRect);
         } else {
-            mWindowManagerProxy.resizeDockedStack(mDockedRect, null, null, null, null);
+            resizeSplitSurfaces(t, mDockedRect, null, mOtherRect, null);
         }
         SnapTarget closestDismissTarget = getSnapAlgorithm().getClosestDismissTarget(position);
         float dimFraction = getDimFraction(position, closestDismissTarget);
-        mWindowManagerProxy.setResizeDimLayer(dimFraction != 0f,
-                getWindowingModeForDismissTarget(closestDismissTarget), dimFraction);
+        setResizeDimLayer(t, isDismissTargetPrimary(closestDismissTarget), dimFraction);
+        t.apply();
+        mTiles.releaseTransaction(t);
     }
 
     private void applyExitAnimationParallax(Rect taskRect, int position) {
@@ -1156,10 +1226,12 @@
     private int restrictDismissingTaskPosition(int taskPosition, int dockSide,
             SnapTarget snapTarget) {
         if (snapTarget.flag == SnapTarget.FLAG_DISMISS_START && dockSideTopLeft(dockSide)) {
-            return Math.max(mSnapAlgorithm.getFirstSplitTarget().position, mStartPosition);
+            return Math.max(mSplitLayout.getSnapAlgorithm().getFirstSplitTarget().position,
+                    mStartPosition);
         } else if (snapTarget.flag == SnapTarget.FLAG_DISMISS_END
                 && dockSideBottomRight(dockSide)) {
-            return Math.min(mSnapAlgorithm.getLastSplitTarget().position, mStartPosition);
+            return Math.min(mSplitLayout.getSnapAlgorithm().getLastSplitTarget().position,
+                    mStartPosition);
         } else {
             return taskPosition;
         }
@@ -1171,19 +1243,19 @@
     private void applyDismissingParallax(Rect taskRect, int dockSide, SnapTarget snapTarget,
             int position, int taskPosition) {
         float fraction = Math.min(1, Math.max(0,
-                mSnapAlgorithm.calculateDismissingFraction(position)));
+                mSplitLayout.getSnapAlgorithm().calculateDismissingFraction(position)));
         SnapTarget dismissTarget = null;
         SnapTarget splitTarget = null;
         int start = 0;
-        if (position <= mSnapAlgorithm.getLastSplitTarget().position
+        if (position <= mSplitLayout.getSnapAlgorithm().getLastSplitTarget().position
                 && dockSideTopLeft(dockSide)) {
-            dismissTarget = mSnapAlgorithm.getDismissStartTarget();
-            splitTarget = mSnapAlgorithm.getFirstSplitTarget();
+            dismissTarget = mSplitLayout.getSnapAlgorithm().getDismissStartTarget();
+            splitTarget = mSplitLayout.getSnapAlgorithm().getFirstSplitTarget();
             start = taskPosition;
-        } else if (position >= mSnapAlgorithm.getLastSplitTarget().position
+        } else if (position >= mSplitLayout.getSnapAlgorithm().getLastSplitTarget().position
                 && dockSideBottomRight(dockSide)) {
-            dismissTarget = mSnapAlgorithm.getDismissEndTarget();
-            splitTarget = mSnapAlgorithm.getLastSplitTarget();
+            dismissTarget = mSplitLayout.getSnapAlgorithm().getDismissEndTarget();
+            splitTarget = mSplitLayout.getSnapAlgorithm().getLastSplitTarget();
             start = splitTarget.position;
         }
         if (dismissTarget != null && fraction > 0f
@@ -1236,14 +1308,10 @@
         }
     }
 
-    private int getWindowingModeForDismissTarget(SnapTarget dismissTarget) {
-        if ((dismissTarget.flag == SnapTarget.FLAG_DISMISS_START && dockSideTopLeft(mDockSide))
+    private boolean isDismissTargetPrimary(SnapTarget dismissTarget) {
+        return (dismissTarget.flag == SnapTarget.FLAG_DISMISS_START && dockSideTopLeft(mDockSide))
                 || (dismissTarget.flag == SnapTarget.FLAG_DISMISS_END
-                        && dockSideBottomRight(mDockSide))) {
-            return WINDOWING_MODE_SPLIT_SCREEN_PRIMARY;
-        } else {
-            return WINDOWING_MODE_SPLIT_SCREEN_SECONDARY;
-        }
+                        && dockSideBottomRight(mDockSide));
     }
 
     /**
@@ -1297,7 +1365,7 @@
     }
 
     void onDockedFirstAnimationFrame() {
-        saveSnapTargetBeforeMinimized(mSnapAlgorithm.getMiddleTarget());
+        saveSnapTargetBeforeMinimized(mSplitLayout.getSnapAlgorithm().getMiddleTarget());
     }
 
     void onDockedTopTask() {
@@ -1307,8 +1375,9 @@
         updateDockSide();
         mEntranceAnimationRunning = true;
 
-        resizeStack(calculatePositionForInsetBounds(), mSnapAlgorithm.getMiddleTarget().position,
-                mSnapAlgorithm.getMiddleTarget());
+        resizeStackSurfaces(calculatePositionForInsetBounds(),
+                mSplitLayout.getSnapAlgorithm().getMiddleTarget().position,
+                mSplitLayout.getSnapAlgorithm().getMiddleTarget());
     }
 
     void onRecentsDrawn() {
@@ -1337,13 +1406,12 @@
     }
 
     void onUndockingTask() {
-        int dockSide = mWindowManagerProxy.getDockSide();
-        if (dockSide != WindowManager.DOCKED_INVALID && (mHomeStackResizable
-                || !mDockedStackMinimized)) {
+        int dockSide = mSplitLayout.getPrimarySplitSide();
+        if (inSplitMode() && (mHomeStackResizable || !mDockedStackMinimized)) {
             startDragging(false /* animate */, false /* touching */);
             SnapTarget target = dockSideTopLeft(dockSide)
-                    ? mSnapAlgorithm.getDismissEndTarget()
-                    : mSnapAlgorithm.getDismissStartTarget();
+                    ? mSplitLayout.getSnapAlgorithm().getDismissEndTarget()
+                    : mSplitLayout.getSnapAlgorithm().getDismissStartTarget();
 
             // Don't start immediately - give a little bit time to settle the drag resize change.
             mExitAnimationRunning = true;
@@ -1354,8 +1422,7 @@
     }
 
     private int calculatePositionForInsetBounds() {
-        mTmpRect.set(0, 0, mDisplayWidth, mDisplayHeight);
-        mTmpRect.inset(mStableInsets);
+        mSplitLayout.mDisplayLayout.getStableBounds(mTmpRect);
         return DockedDividerUtils.calculatePositionForBounds(mTmpRect, mDockSide, mDividerSize);
     }
 }
diff --git a/packages/SystemUI/src/com/android/systemui/stackdivider/DividerWindowManager.java b/packages/SystemUI/src/com/android/systemui/stackdivider/DividerWindowManager.java
index 2486d653..3020a25 100644
--- a/packages/SystemUI/src/com/android/systemui/stackdivider/DividerWindowManager.java
+++ b/packages/SystemUI/src/com/android/systemui/stackdivider/DividerWindowManager.java
@@ -26,12 +26,13 @@
 import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_NO_MOVE_ANIMATION;
 import static android.view.WindowManager.LayoutParams.TYPE_DOCK_DIVIDER;
 
-import android.content.Context;
 import android.graphics.PixelFormat;
 import android.os.Binder;
 import android.view.View;
 import android.view.WindowManager;
 
+import com.android.systemui.wm.SystemWindows;
+
 /**
  * Manages the window parameters of the docked stack divider.
  */
@@ -39,15 +40,16 @@
 
     private static final String WINDOW_TITLE = "DockedStackDivider";
 
-    private final WindowManager mWindowManager;
+    final SystemWindows mSystemWindows;
     private WindowManager.LayoutParams mLp;
     private View mView;
 
-    public DividerWindowManager(Context ctx) {
-        mWindowManager = ctx.getSystemService(WindowManager.class);
+    public DividerWindowManager(SystemWindows systemWindows) {
+        mSystemWindows = systemWindows;
     }
 
-    public void add(View view, int width, int height) {
+    /** Add a divider view */
+    public void add(View view, int width, int height, int displayId) {
         mLp = new WindowManager.LayoutParams(
                 width, height, TYPE_DOCK_DIVIDER,
                 FLAG_NOT_FOCUSABLE | FLAG_NOT_TOUCH_MODAL
@@ -60,13 +62,13 @@
         view.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
                 | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
                 | View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
-        mWindowManager.addView(view, mLp);
+        mSystemWindows.addView(view, mLp, displayId, TYPE_DOCK_DIVIDER);
         mView = view;
     }
 
     public void remove() {
         if (mView != null) {
-            mWindowManager.removeView(mView);
+            mSystemWindows.removeView(mView);
         }
         mView = null;
     }
@@ -81,7 +83,7 @@
             changed = true;
         }
         if (changed) {
-            mWindowManager.updateViewLayout(mView, mLp);
+            mSystemWindows.updateViewLayout(mView, mLp);
         }
     }
 
@@ -95,7 +97,7 @@
             changed = true;
         }
         if (changed) {
-            mWindowManager.updateViewLayout(mView, mLp);
+            mSystemWindows.updateViewLayout(mView, mLp);
         }
     }
 }
diff --git a/packages/SystemUI/src/com/android/systemui/stackdivider/ForcedResizableInfoActivityController.java b/packages/SystemUI/src/com/android/systemui/stackdivider/ForcedResizableInfoActivityController.java
index c6ac309..db7996e 100644
--- a/packages/SystemUI/src/com/android/systemui/stackdivider/ForcedResizableInfoActivityController.java
+++ b/packages/SystemUI/src/com/android/systemui/stackdivider/ForcedResizableInfoActivityController.java
@@ -31,6 +31,8 @@
 import com.android.systemui.shared.system.ActivityManagerWrapper;
 import com.android.systemui.shared.system.TaskStackChangeListener;
 
+import java.util.function.Consumer;
+
 /**
  * Controller that decides when to show the {@link ForcedResizableInfoActivity}.
  */
@@ -52,6 +54,12 @@
         }
     };
 
+    private final Consumer<Boolean> mDockedStackExistsListener = exists -> {
+        if (!exists) {
+            mPackagesShownInSession.clear();
+        }
+    };
+
     /** Record of force resized task that's pending to be handled. */
     private class PendingTaskRecord {
         int taskId;
@@ -67,7 +75,7 @@
         }
     }
 
-    public ForcedResizableInfoActivityController(Context context) {
+    public ForcedResizableInfoActivityController(Context context, Divider divider) {
         mContext = context;
         ActivityManagerWrapper.getInstance().registerTaskStackListener(
                 new TaskStackChangeListener() {
@@ -87,12 +95,7 @@
                         activityLaunchOnSecondaryDisplayFailed();
                     }
                 });
-    }
-
-    public void notifyDockedStackExistsChanged(boolean exists) {
-        if (!exists) {
-            mPackagesShownInSession.clear();
-        }
+        divider.registerInSplitScreenListener(mDockedStackExistsListener);
     }
 
     public void onAppTransitionFinished() {
diff --git a/packages/SystemUI/src/com/android/systemui/stackdivider/SplitDisplayLayout.java b/packages/SystemUI/src/com/android/systemui/stackdivider/SplitDisplayLayout.java
new file mode 100644
index 0000000..b19f560
--- /dev/null
+++ b/packages/SystemUI/src/com/android/systemui/stackdivider/SplitDisplayLayout.java
@@ -0,0 +1,310 @@
+/*
+ * 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.systemui.stackdivider;
+
+import static android.app.WindowConfiguration.ACTIVITY_TYPE_HOME;
+import static android.app.WindowConfiguration.ACTIVITY_TYPE_RECENTS;
+import static android.content.res.Configuration.ORIENTATION_LANDSCAPE;
+import static android.content.res.Configuration.ORIENTATION_PORTRAIT;
+import static android.view.WindowManager.DOCKED_BOTTOM;
+import static android.view.WindowManager.DOCKED_INVALID;
+import static android.view.WindowManager.DOCKED_LEFT;
+import static android.view.WindowManager.DOCKED_RIGHT;
+import static android.view.WindowManager.DOCKED_TOP;
+
+import android.annotation.NonNull;
+import android.content.Context;
+import android.content.res.Configuration;
+import android.content.res.Resources;
+import android.graphics.Rect;
+import android.util.TypedValue;
+import android.view.WindowContainerTransaction;
+
+import com.android.internal.policy.DividerSnapAlgorithm;
+import com.android.internal.policy.DockedDividerUtils;
+import com.android.systemui.wm.DisplayLayout;
+
+/**
+ * Handles split-screen related internal display layout. In general, this represents the
+ * WM-facing understanding of the splits.
+ */
+public class SplitDisplayLayout {
+    /** Minimum size of an adjusted stack bounds relative to original stack bounds. Used to
+     * restrict IME adjustment so that a min portion of top stack remains visible.*/
+    private static final float ADJUSTED_STACK_FRACTION_MIN = 0.3f;
+
+    private static final int DIVIDER_WIDTH_INACTIVE_DP = 4;
+
+    SplitScreenTaskOrganizer mTiles;
+    DisplayLayout mDisplayLayout;
+    Context mContext;
+
+    // Lazy stuff
+    boolean mResourcesValid = false;
+    int mDividerSize;
+    int mDividerSizeInactive;
+    private DividerSnapAlgorithm mSnapAlgorithm = null;
+    private DividerSnapAlgorithm mMinimizedSnapAlgorithm = null;
+    Rect mPrimary = null;
+    Rect mSecondary = null;
+    Rect mAdjustedPrimary = null;
+    Rect mAdjustedSecondary = null;
+
+    public SplitDisplayLayout(Context ctx, DisplayLayout dl, SplitScreenTaskOrganizer taskTiles) {
+        mTiles = taskTiles;
+        mDisplayLayout = dl;
+        mContext = ctx;
+    }
+
+    void rotateTo(int newRotation) {
+        mDisplayLayout.rotateTo(mContext.getResources(), newRotation);
+        final Configuration config = new Configuration();
+        config.unset();
+        config.orientation = mDisplayLayout.getOrientation();
+        Rect tmpRect = new Rect(0, 0, mDisplayLayout.width(), mDisplayLayout.height());
+        tmpRect.inset(mDisplayLayout.nonDecorInsets());
+        config.windowConfiguration.setAppBounds(tmpRect);
+        tmpRect.set(0, 0, mDisplayLayout.width(), mDisplayLayout.height());
+        tmpRect.inset(mDisplayLayout.stableInsets());
+        config.screenWidthDp = (int) (tmpRect.width() / mDisplayLayout.density());
+        config.screenHeightDp = (int) (tmpRect.height() / mDisplayLayout.density());
+        mContext = mContext.createConfigurationContext(config);
+        mSnapAlgorithm = null;
+        mMinimizedSnapAlgorithm = null;
+        mResourcesValid = false;
+    }
+
+    private void updateResources() {
+        if (mResourcesValid) {
+            return;
+        }
+        mResourcesValid = true;
+        Resources res = mContext.getResources();
+        mDividerSize = DockedDividerUtils.getDividerSize(res,
+                DockedDividerUtils.getDividerInsets(res));
+        mDividerSizeInactive = (int) TypedValue.applyDimension(
+                TypedValue.COMPLEX_UNIT_DIP, DIVIDER_WIDTH_INACTIVE_DP, res.getDisplayMetrics());
+    }
+
+    int getPrimarySplitSide() {
+        return mDisplayLayout.isLandscape() ? DOCKED_LEFT : DOCKED_TOP;
+    }
+
+    boolean isMinimized() {
+        return mTiles.mSecondary.topActivityType == ACTIVITY_TYPE_HOME
+                || mTiles.mSecondary.topActivityType == ACTIVITY_TYPE_RECENTS;
+    }
+
+    DividerSnapAlgorithm getSnapAlgorithm() {
+        if (mSnapAlgorithm == null) {
+            updateResources();
+            boolean isHorizontalDivision = !mDisplayLayout.isLandscape();
+            mSnapAlgorithm = new DividerSnapAlgorithm(mContext.getResources(),
+                    mDisplayLayout.width(), mDisplayLayout.height(), mDividerSize,
+                    isHorizontalDivision, mDisplayLayout.stableInsets(), getPrimarySplitSide());
+        }
+        return mSnapAlgorithm;
+    }
+
+    DividerSnapAlgorithm getMinimizedSnapAlgorithm() {
+        if (mMinimizedSnapAlgorithm == null) {
+            updateResources();
+            boolean isHorizontalDivision = !mDisplayLayout.isLandscape();
+            mMinimizedSnapAlgorithm = new DividerSnapAlgorithm(mContext.getResources(),
+                    mDisplayLayout.width(), mDisplayLayout.height(), mDividerSize,
+                    isHorizontalDivision, mDisplayLayout.stableInsets(), getPrimarySplitSide(),
+                    true /* isMinimized */);
+        }
+        return mMinimizedSnapAlgorithm;
+    }
+
+    void resizeSplits(int position) {
+        mPrimary = mPrimary == null ? new Rect() : mPrimary;
+        mSecondary = mSecondary == null ? new Rect() : mSecondary;
+        calcSplitBounds(position, mPrimary, mSecondary);
+    }
+
+    void resizeSplits(int position, WindowContainerTransaction t) {
+        resizeSplits(position);
+        t.setBounds(mTiles.mPrimary.token, mPrimary);
+        t.setBounds(mTiles.mSecondary.token, mSecondary);
+
+        t.setSmallestScreenWidthDp(mTiles.mPrimary.token,
+                getSmallestWidthDpForBounds(mContext, mDisplayLayout, mPrimary));
+        t.setSmallestScreenWidthDp(mTiles.mSecondary.token,
+                getSmallestWidthDpForBounds(mContext, mDisplayLayout, mSecondary));
+    }
+
+    void calcSplitBounds(int position, @NonNull Rect outPrimary, @NonNull Rect outSecondary) {
+        int dockSide = getPrimarySplitSide();
+        DockedDividerUtils.calculateBoundsForPosition(position, dockSide, outPrimary,
+                mDisplayLayout.width(), mDisplayLayout.height(), mDividerSize);
+
+        DockedDividerUtils.calculateBoundsForPosition(position,
+                DockedDividerUtils.invertDockSide(dockSide), outSecondary, mDisplayLayout.width(),
+                mDisplayLayout.height(), mDividerSize);
+    }
+
+    Rect calcMinimizedHomeStackBounds() {
+        DividerSnapAlgorithm.SnapTarget miniMid = getMinimizedSnapAlgorithm().getMiddleTarget();
+        Rect homeBounds = new Rect();
+        DockedDividerUtils.calculateBoundsForPosition(miniMid.position,
+                DockedDividerUtils.invertDockSide(getPrimarySplitSide()), homeBounds,
+                mDisplayLayout.width(), mDisplayLayout.height(), mDividerSize);
+        return homeBounds;
+    }
+
+    /**
+     * Updates the adjustment depending on it's current state.
+     */
+    void updateAdjustedBounds(int currImeTop, int startTop, int finalTop) {
+        updateAdjustedBounds(mDisplayLayout, currImeTop, startTop, finalTop, mDividerSize,
+                mDividerSizeInactive, mPrimary, mSecondary);
+    }
+
+    /**
+     * Updates the adjustment depending on it's current state.
+     */
+    private void updateAdjustedBounds(DisplayLayout dl, int currImeTop, int startTop, int finalTop,
+            int dividerWidth, int dividerWidthInactive, Rect primaryBounds, Rect secondaryBounds) {
+        adjustForIME(dl, currImeTop, startTop, finalTop, dividerWidth, dividerWidthInactive,
+                primaryBounds, secondaryBounds);
+    }
+
+    /** Assumes top/bottom split. Splits are not adjusted for left/right splits. */
+    private void adjustForIME(DisplayLayout dl, int currImeTop, int startTop, int finalTop,
+            int dividerWidth, int dividerWidthInactive, Rect primaryBounds, Rect secondaryBounds) {
+        if (mAdjustedPrimary == null) {
+            mAdjustedPrimary = new Rect();
+            mAdjustedSecondary = new Rect();
+        }
+
+        final Rect displayStableRect = new Rect();
+        dl.getStableBounds(displayStableRect);
+
+        final boolean showing = finalTop < startTop;
+        final float progress = ((float) (currImeTop - startTop)) / (finalTop - startTop);
+        final float dividerSquish = showing ? progress : 1.f - progress;
+        final int currDividerWidth =
+                (int) (dividerWidthInactive * dividerSquish + dividerWidth * (1.f - dividerSquish));
+
+        final int minTopStackBottom = displayStableRect.top
+                + (int) ((mPrimary.bottom - displayStableRect.top) * ADJUSTED_STACK_FRACTION_MIN);
+        final int minImeTop = minTopStackBottom + currDividerWidth;
+
+        // Calculate an offset which shifts the stacks up by the height of the IME, but still
+        // leaves at least 30% of the top stack visible.
+        final int yOffset = Math.max(0, dl.height() - Math.max(currImeTop, minImeTop));
+
+        // TOP
+        // Reduce the offset by an additional small amount to squish the divider bar.
+        mAdjustedPrimary.set(primaryBounds);
+        mAdjustedPrimary.offset(0, -yOffset + (dividerWidth - currDividerWidth));
+
+        // BOTTOM
+        mAdjustedSecondary.set(secondaryBounds);
+        mAdjustedSecondary.offset(0, -yOffset);
+    }
+
+    static int getSmallestWidthDpForBounds(@NonNull Context context, DisplayLayout dl,
+            Rect bounds) {
+        int dividerSize = DockedDividerUtils.getDividerSize(context.getResources(),
+                DockedDividerUtils.getDividerInsets(context.getResources()));
+
+        int minWidth = Integer.MAX_VALUE;
+
+        // Go through all screen orientations and find the orientation in which the task has the
+        // smallest width.
+        Rect tmpRect = new Rect();
+        Rect rotatedDisplayRect = new Rect();
+        Rect displayRect = new Rect(0, 0, dl.width(), dl.height());
+
+        DisplayLayout tmpDL = new DisplayLayout();
+        for (int rotation = 0; rotation < 4; rotation++) {
+            tmpDL.set(dl);
+            tmpDL.rotateTo(context.getResources(), rotation);
+            DividerSnapAlgorithm snap = initSnapAlgorithmForRotation(context, tmpDL, dividerSize);
+
+            tmpRect.set(bounds);
+            DisplayLayout.rotateBounds(tmpRect, displayRect, rotation - dl.rotation());
+            rotatedDisplayRect.set(0, 0, tmpDL.width(), tmpDL.height());
+            final int dockSide = getPrimarySplitSide(tmpRect, rotatedDisplayRect,
+                    tmpDL.getOrientation());
+            final int position = DockedDividerUtils.calculatePositionForBounds(tmpRect, dockSide,
+                    dividerSize);
+
+            final int snappedPosition =
+                    snap.calculateNonDismissingSnapTarget(position).position;
+            DockedDividerUtils.calculateBoundsForPosition(snappedPosition, dockSide, tmpRect,
+                    tmpDL.width(), tmpDL.height(), dividerSize);
+            Rect insettedDisplay = new Rect(rotatedDisplayRect);
+            insettedDisplay.inset(tmpDL.stableInsets());
+            tmpRect.intersect(insettedDisplay);
+            minWidth = Math.min(tmpRect.width(), minWidth);
+        }
+        return (int) (minWidth / dl.density());
+    }
+
+    static DividerSnapAlgorithm initSnapAlgorithmForRotation(Context context, DisplayLayout dl,
+            int dividerSize) {
+        final Configuration config = new Configuration();
+        config.unset();
+        config.orientation = dl.getOrientation();
+        Rect tmpRect = new Rect(0, 0, dl.width(), dl.height());
+        tmpRect.inset(dl.nonDecorInsets());
+        config.windowConfiguration.setAppBounds(tmpRect);
+        tmpRect.set(0, 0, dl.width(), dl.height());
+        tmpRect.inset(dl.stableInsets());
+        config.screenWidthDp = (int) (tmpRect.width() / dl.density());
+        config.screenHeightDp = (int) (tmpRect.height() / dl.density());
+        final Context rotationContext = context.createConfigurationContext(config);
+        return new DividerSnapAlgorithm(
+                rotationContext.getResources(), dl.width(), dl.height(), dividerSize,
+                config.orientation == ORIENTATION_PORTRAIT, dl.stableInsets());
+    }
+
+    /**
+     * Get the current primary-split side. Determined by its location of {@param bounds} within
+     * {@param displayRect} but if both are the same, it will try to dock to each side and determine
+     * if allowed in its respected {@param orientation}.
+     *
+     * @param bounds bounds of the primary split task to get which side is docked
+     * @param displayRect bounds of the display that contains the primary split task
+     * @param orientation the origination of device
+     * @return current primary-split side
+     */
+    static int getPrimarySplitSide(Rect bounds, Rect displayRect, int orientation) {
+        if (orientation == ORIENTATION_PORTRAIT) {
+            // Portrait mode, docked either at the top or the bottom.
+            final int diff = (displayRect.bottom - bounds.bottom) - (bounds.top - displayRect.top);
+            if (diff < 0) {
+                return DOCKED_BOTTOM;
+            } else {
+                // Top is default
+                return DOCKED_TOP;
+            }
+        } else if (orientation == ORIENTATION_LANDSCAPE) {
+            // Landscape mode, docked either on the left or on the right.
+            final int diff = (displayRect.right - bounds.right) - (bounds.left - displayRect.left);
+            if (diff < 0) {
+                return DOCKED_RIGHT;
+            }
+            return DOCKED_LEFT;
+        }
+        return DOCKED_INVALID;
+    }
+}
diff --git a/packages/SystemUI/src/com/android/systemui/stackdivider/SplitScreenTaskOrganizer.java b/packages/SystemUI/src/com/android/systemui/stackdivider/SplitScreenTaskOrganizer.java
new file mode 100644
index 0000000..5cc8799
--- /dev/null
+++ b/packages/SystemUI/src/com/android/systemui/stackdivider/SplitScreenTaskOrganizer.java
@@ -0,0 +1,159 @@
+/*
+ * 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.systemui.stackdivider;
+
+import static android.app.WindowConfiguration.ACTIVITY_TYPE_HOME;
+import static android.app.WindowConfiguration.ACTIVITY_TYPE_RECENTS;
+import static android.app.WindowConfiguration.ACTIVITY_TYPE_UNDEFINED;
+import static android.app.WindowConfiguration.WINDOWING_MODE_SPLIT_SCREEN_PRIMARY;
+import static android.app.WindowConfiguration.WINDOWING_MODE_SPLIT_SCREEN_SECONDARY;
+import static android.view.Display.DEFAULT_DISPLAY;
+
+import android.app.ActivityManager.RunningTaskInfo;
+import android.app.ITaskOrganizerController;
+import android.app.WindowConfiguration;
+import android.os.RemoteException;
+import android.util.Log;
+import android.view.Display;
+import android.view.ITaskOrganizer;
+import android.view.IWindowContainer;
+import android.view.SurfaceControl;
+import android.view.SurfaceSession;
+
+class SplitScreenTaskOrganizer extends ITaskOrganizer.Stub {
+    private static final String TAG = "SplitScreenTaskOrganizer";
+    private static final boolean DEBUG = Divider.DEBUG;
+
+    RunningTaskInfo mPrimary;
+    RunningTaskInfo mSecondary;
+    SurfaceControl mPrimarySurface;
+    SurfaceControl mSecondarySurface;
+    SurfaceControl mPrimaryDim;
+    SurfaceControl mSecondaryDim;
+    final Divider mDivider;
+
+    SplitScreenTaskOrganizer(Divider divider) {
+        mDivider = divider;
+    }
+
+    void init(ITaskOrganizerController organizerController, SurfaceSession session)
+            throws RemoteException {
+        organizerController.registerTaskOrganizer(this, WINDOWING_MODE_SPLIT_SCREEN_PRIMARY);
+        organizerController.registerTaskOrganizer(this, WINDOWING_MODE_SPLIT_SCREEN_SECONDARY);
+        mPrimary = organizerController.createRootTask(Display.DEFAULT_DISPLAY,
+                WindowConfiguration.WINDOWING_MODE_SPLIT_SCREEN_PRIMARY);
+        mSecondary = organizerController.createRootTask(Display.DEFAULT_DISPLAY,
+                WindowConfiguration.WINDOWING_MODE_SPLIT_SCREEN_SECONDARY);
+        mPrimarySurface = mPrimary.token.getLeash();
+        mSecondarySurface = mSecondary.token.getLeash();
+
+        // Initialize dim surfaces:
+        mPrimaryDim = new SurfaceControl.Builder(session).setParent(mPrimarySurface)
+                .setColorLayer().setName("Primary Divider Dim").build();
+        mSecondaryDim = new SurfaceControl.Builder(session).setParent(mSecondarySurface)
+                .setColorLayer().setName("Secondary Divider Dim").build();
+        SurfaceControl.Transaction t = getTransaction();
+        t.setLayer(mPrimaryDim, Integer.MAX_VALUE);
+        t.setColor(mPrimaryDim, new float[]{0f, 0f, 0f});
+        t.setLayer(mSecondaryDim, Integer.MAX_VALUE);
+        t.setColor(mSecondaryDim, new float[]{0f, 0f, 0f});
+        t.apply();
+        releaseTransaction(t);
+    }
+
+    SurfaceControl.Transaction getTransaction() {
+        return mDivider.mTransactionPool.acquire();
+    }
+
+    void releaseTransaction(SurfaceControl.Transaction t) {
+        mDivider.mTransactionPool.release(t);
+    }
+
+    @Override
+    public void taskAppeared(RunningTaskInfo taskInfo) {
+    }
+
+    @Override
+    public void taskVanished(IWindowContainer container) {
+    }
+
+    @Override
+    public void transactionReady(int id, SurfaceControl.Transaction t) {
+    }
+
+    @Override
+    public void onTaskInfoChanged(RunningTaskInfo taskInfo) {
+        if (taskInfo.displayId != DEFAULT_DISPLAY) {
+            return;
+        }
+        mDivider.getHandler().post(() -> handleTaskInfoChanged(taskInfo));
+    }
+
+    /**
+     * This is effectively a finite state machine which moves between the various split-screen
+     * presentations based on the contents of the split regions.
+     */
+    private void handleTaskInfoChanged(RunningTaskInfo info) {
+        final boolean primaryWasEmpty = mPrimary.topActivityType == ACTIVITY_TYPE_UNDEFINED;
+        final boolean secondaryWasEmpty = mSecondary.topActivityType == ACTIVITY_TYPE_UNDEFINED;
+        if (info.token.asBinder() == mPrimary.token.asBinder()) {
+            mPrimary = info;
+        } else if (info.token.asBinder() == mSecondary.token.asBinder()) {
+            mSecondary = info;
+        }
+        final boolean primaryIsEmpty = mPrimary.topActivityType == ACTIVITY_TYPE_UNDEFINED;
+        final boolean secondaryIsEmpty = mSecondary.topActivityType == ACTIVITY_TYPE_UNDEFINED;
+        if (DEBUG) {
+            Log.d(TAG, "onTaskInfoChanged " + mPrimary + "  " + mSecondary);
+        }
+        if (primaryIsEmpty || secondaryIsEmpty) {
+            // At-least one of the splits is empty which means we are currently transitioning
+            // into or out-of split-screen mode.
+            if (DEBUG) {
+                Log.d(TAG, " at-least one split empty " + mPrimary.topActivityType
+                        + "  " + mSecondary.topActivityType);
+            }
+            if (mDivider.inSplitMode()) {
+                // Was in split-mode, which means we are leaving split, so continue that.
+                // This happens when the stack in the primary-split is dismissed.
+                if (DEBUG) {
+                    Log.d(TAG, "    was in split, so this means leave it "
+                            + mPrimary.topActivityType + "  " + mSecondary.topActivityType);
+                }
+                WindowManagerProxy.applyDismissSplit(this, true /* dismissOrMaximize */);
+                mDivider.updateVisibility(false /* visible */);
+            } else if (!primaryIsEmpty && primaryWasEmpty && secondaryWasEmpty) {
+                // Wasn't in split-mode (both were empty), but now that the primary split is
+                // populated, we should fully enter split by moving everything else into secondary.
+                // This just tells window-manager to reparent things, the UI will respond
+                // when it gets new task info for the secondary split.
+                if (DEBUG) {
+                    Log.d(TAG, "   was not in split, but primary is populated, so enter it");
+                }
+                mDivider.startEnterSplit();
+            }
+        } else if (mSecondary.topActivityType == ACTIVITY_TYPE_HOME
+                || mSecondary.topActivityType == ACTIVITY_TYPE_RECENTS) {
+            // Both splits are populated but the secondary split has a home/recents stack on top,
+            // so enter minimized mode.
+            mDivider.ensureMinimizedSplit();
+        } else {
+            // Both splits are populated by normal activities, so make sure we aren't minimized.
+            mDivider.ensureNormalSplit();
+        }
+    }
+}
diff --git a/packages/SystemUI/src/com/android/systemui/stackdivider/WindowManagerProxy.java b/packages/SystemUI/src/com/android/systemui/stackdivider/WindowManagerProxy.java
index 228aab5..7685733 100644
--- a/packages/SystemUI/src/com/android/systemui/stackdivider/WindowManagerProxy.java
+++ b/packages/SystemUI/src/com/android/systemui/stackdivider/WindowManagerProxy.java
@@ -16,16 +16,25 @@
 
 package com.android.systemui.stackdivider;
 
-import static android.view.WindowManager.DOCKED_INVALID;
+import static android.app.WindowConfiguration.ACTIVITY_TYPE_HOME;
+import static android.app.WindowConfiguration.ACTIVITY_TYPE_RECENTS;
+import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN;
+import static android.view.Display.DEFAULT_DISPLAY;
 
+import android.app.ActivityManager;
 import android.app.ActivityTaskManager;
 import android.graphics.Rect;
 import android.os.RemoteException;
 import android.util.Log;
+import android.view.Display;
+import android.view.IWindowContainer;
+import android.view.WindowContainerTransaction;
 import android.view.WindowManagerGlobal;
 
 import com.android.internal.annotations.GuardedBy;
 
+import java.util.ArrayList;
+import java.util.List;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
 
@@ -35,88 +44,20 @@
 public class WindowManagerProxy {
 
     private static final String TAG = "WindowManagerProxy";
+    private static final int[] HOME_AND_RECENTS = {ACTIVITY_TYPE_HOME, ACTIVITY_TYPE_RECENTS};
 
     private static final WindowManagerProxy sInstance = new WindowManagerProxy();
 
     @GuardedBy("mDockedRect")
     private final Rect mDockedRect = new Rect();
-    private final Rect mTempDockedTaskRect = new Rect();
-    private final Rect mTempDockedInsetRect = new Rect();
-    private final Rect mTempOtherTaskRect = new Rect();
-    private final Rect mTempOtherInsetRect = new Rect();
 
     private final Rect mTmpRect1 = new Rect();
-    private final Rect mTmpRect2 = new Rect();
-    private final Rect mTmpRect3 = new Rect();
-    private final Rect mTmpRect4 = new Rect();
-    private final Rect mTmpRect5 = new Rect();
 
     @GuardedBy("mDockedRect")
     private final Rect mTouchableRegion = new Rect();
 
-    private boolean mDimLayerVisible;
-    private int mDimLayerTargetWindowingMode;
-    private float mDimLayerAlpha;
-
     private final ExecutorService mExecutor = Executors.newSingleThreadExecutor();
 
-    private final Runnable mResizeRunnable = new Runnable() {
-        @Override
-        public void run() {
-            synchronized (mDockedRect) {
-                mTmpRect1.set(mDockedRect);
-                mTmpRect2.set(mTempDockedTaskRect);
-                mTmpRect3.set(mTempDockedInsetRect);
-                mTmpRect4.set(mTempOtherTaskRect);
-                mTmpRect5.set(mTempOtherInsetRect);
-            }
-            try {
-                ActivityTaskManager.getService()
-                        .resizeDockedStack(mTmpRect1,
-                                mTmpRect2.isEmpty() ? null : mTmpRect2,
-                                mTmpRect3.isEmpty() ? null : mTmpRect3,
-                                mTmpRect4.isEmpty() ? null : mTmpRect4,
-                                mTmpRect5.isEmpty() ? null : mTmpRect5);
-            } catch (RemoteException e) {
-                Log.w(TAG, "Failed to resize stack: " + e);
-            }
-        }
-    };
-
-    private final Runnable mDismissRunnable = new Runnable() {
-        @Override
-        public void run() {
-            try {
-                ActivityTaskManager.getService().dismissSplitScreenMode(false /* onTop */);
-            } catch (RemoteException e) {
-                Log.w(TAG, "Failed to remove stack: " + e);
-            }
-        }
-    };
-
-    private final Runnable mMaximizeRunnable = new Runnable() {
-        @Override
-        public void run() {
-            try {
-                ActivityTaskManager.getService().dismissSplitScreenMode(true /* onTop */);
-            } catch (RemoteException e) {
-                Log.w(TAG, "Failed to resize stack: " + e);
-            }
-        }
-    };
-
-    private final Runnable mDimLayerRunnable = new Runnable() {
-        @Override
-        public void run() {
-            try {
-                WindowManagerGlobal.getWindowManagerService().setResizeDimLayer(mDimLayerVisible,
-                        mDimLayerTargetWindowingMode, mDimLayerAlpha);
-            } catch (RemoteException e) {
-                Log.w(TAG, "Failed to resize stack: " + e);
-            }
-        }
-    };
-
     private final Runnable mSetTouchableRegionRunnable = new Runnable() {
         @Override
         public void run() {
@@ -139,40 +80,9 @@
         return sInstance;
     }
 
-    public void resizeDockedStack(Rect docked, Rect tempDockedTaskRect, Rect tempDockedInsetRect,
-            Rect tempOtherTaskRect, Rect tempOtherInsetRect) {
-        synchronized (mDockedRect) {
-            mDockedRect.set(docked);
-            if (tempDockedTaskRect != null) {
-                mTempDockedTaskRect.set(tempDockedTaskRect);
-            } else {
-                mTempDockedTaskRect.setEmpty();
-            }
-            if (tempDockedInsetRect != null) {
-                mTempDockedInsetRect.set(tempDockedInsetRect);
-            } else {
-                mTempDockedInsetRect.setEmpty();
-            }
-            if (tempOtherTaskRect != null) {
-                mTempOtherTaskRect.set(tempOtherTaskRect);
-            } else {
-                mTempOtherTaskRect.setEmpty();
-            }
-            if (tempOtherInsetRect != null) {
-                mTempOtherInsetRect.set(tempOtherInsetRect);
-            } else {
-                mTempOtherInsetRect.setEmpty();
-            }
-        }
-        mExecutor.execute(mResizeRunnable);
-    }
-
-    public void dismissDockedStack() {
-        mExecutor.execute(mDismissRunnable);
-    }
-
-    public void maximizeDockedStack() {
-        mExecutor.execute(mMaximizeRunnable);
+    void dismissOrMaximizeDocked(
+            final SplitScreenTaskOrganizer tiles, final boolean dismissOrMaximize) {
+        mExecutor.execute(() -> applyDismissSplit(tiles, dismissOrMaximize));
     }
 
     public void setResizing(final boolean resizing) {
@@ -188,26 +98,204 @@
         });
     }
 
-    public int getDockSide() {
-        try {
-            return WindowManagerGlobal.getWindowManagerService().getDockedStackSide();
-        } catch (RemoteException e) {
-            Log.w(TAG, "Failed to get dock side: " + e);
-        }
-        return DOCKED_INVALID;
-    }
-
-    public void setResizeDimLayer(boolean visible, int targetWindowingMode, float alpha) {
-        mDimLayerVisible = visible;
-        mDimLayerTargetWindowingMode = targetWindowingMode;
-        mDimLayerAlpha = alpha;
-        mExecutor.execute(mDimLayerRunnable);
-    }
-
+    /** Sets a touch region */
     public void setTouchRegion(Rect region) {
         synchronized (mDockedRect) {
             mTouchableRegion.set(region);
         }
         mExecutor.execute(mSetTouchableRegionRunnable);
     }
+
+    static void applyResizeSplits(int position, SplitDisplayLayout splitLayout) {
+        WindowContainerTransaction t = new WindowContainerTransaction();
+        splitLayout.resizeSplits(position, t);
+        try {
+            ActivityTaskManager.getTaskOrganizerController().applyContainerTransaction(t,
+                    null /* organizer */);
+        } catch (RemoteException e) {
+        }
+    }
+
+    private static boolean getHomeAndRecentsTasks(List<IWindowContainer> out,
+            IWindowContainer parent) {
+        boolean resizable = false;
+        try {
+            List<ActivityManager.RunningTaskInfo> rootTasks = parent == null
+                    ? ActivityTaskManager.getTaskOrganizerController().getRootTasks(
+                            Display.DEFAULT_DISPLAY, HOME_AND_RECENTS)
+                    : ActivityTaskManager.getTaskOrganizerController().getChildTasks(parent,
+                            HOME_AND_RECENTS);
+            for (int i = 0, n = rootTasks.size(); i < n; ++i) {
+                final ActivityManager.RunningTaskInfo ti = rootTasks.get(i);
+                out.add(ti.token);
+                if (ti.topActivityType == ACTIVITY_TYPE_HOME) {
+                    resizable = ti.isResizable();
+                }
+            }
+        } catch (RemoteException e) {
+        }
+        return resizable;
+    }
+
+    static void applyHomeTasksMinimized(SplitDisplayLayout layout, IWindowContainer parent) {
+        applyHomeTasksMinimized(layout, parent, null /* transaction */);
+    }
+
+    /**
+     * Assign a fixed override-bounds to home tasks that reflect their geometry while the primary
+     * split is minimized. This actually "sticks out" of the secondary split area, but when in
+     * minimized mode, the secondary split gets a 'negative' crop to expose it.
+     */
+    static boolean applyHomeTasksMinimized(SplitDisplayLayout layout, IWindowContainer parent,
+            WindowContainerTransaction t) {
+        // Resize the home/recents stacks to the larger minimized-state size
+        final Rect homeBounds;
+        final ArrayList<IWindowContainer> homeStacks = new ArrayList<>();
+        boolean isHomeResizable = getHomeAndRecentsTasks(homeStacks, parent);
+        if (isHomeResizable) {
+            homeBounds = layout.calcMinimizedHomeStackBounds();
+        } else {
+            homeBounds = new Rect(0, 0, layout.mDisplayLayout.width(),
+                    layout.mDisplayLayout.height());
+        }
+        WindowContainerTransaction wct = t != null ? t : new WindowContainerTransaction();
+        for (int i = homeStacks.size() - 1; i >= 0; --i) {
+            wct.setBounds(homeStacks.get(i), homeBounds);
+        }
+        if (t != null) {
+            return isHomeResizable;
+        }
+        try {
+            ActivityTaskManager.getTaskOrganizerController().applyContainerTransaction(wct,
+                    null /* organizer */);
+        } catch (RemoteException e) {
+            Log.e(TAG, "Failed to resize home stacks ", e);
+        }
+        return isHomeResizable;
+    }
+
+    /**
+     * Finishes entering split-screen by reparenting all FULLSCREEN tasks into the secondary split.
+     * This assumes there is already something in the primary split since that is usually what
+     * triggers a call to this. In the same transaction, this overrides the home task bounds via
+     * {@link #applyHomeTasksMinimized}.
+     *
+     * @return whether the home stack is resizable
+     */
+    static boolean applyEnterSplit(SplitScreenTaskOrganizer tiles, SplitDisplayLayout layout) {
+        try {
+            // Set launchtile first so that any stack created after
+            // getAllStackInfos and before reparent (even if unlikely) are placed
+            // correctly.
+            ActivityTaskManager.getTaskOrganizerController().setLaunchRoot(
+                    DEFAULT_DISPLAY, tiles.mSecondary.token);
+            List<ActivityManager.RunningTaskInfo> rootTasks =
+                    ActivityTaskManager.getTaskOrganizerController().getRootTasks(DEFAULT_DISPLAY,
+                            null /* activityTypes */);
+            WindowContainerTransaction wct = new WindowContainerTransaction();
+            if (rootTasks.isEmpty()) {
+                return false;
+            }
+            for (int i = rootTasks.size() - 1; i >= 0; --i) {
+                if (rootTasks.get(i).configuration.windowConfiguration.getWindowingMode()
+                        != WINDOWING_MODE_FULLSCREEN) {
+                    continue;
+                }
+                wct.reparent(rootTasks.get(i).token, tiles.mSecondary.token,
+                        true /* onTop */);
+            }
+            boolean isHomeResizable = applyHomeTasksMinimized(layout, null /* parent */, wct);
+            ActivityTaskManager.getTaskOrganizerController()
+                    .applyContainerTransaction(wct, null /* organizer */);
+            return isHomeResizable;
+        } catch (RemoteException e) {
+            Log.w(TAG, "Error moving fullscreen tasks to secondary split: " + e);
+        }
+        return false;
+    }
+
+    private static boolean isHomeOrRecentTask(ActivityManager.RunningTaskInfo ti) {
+        final int atype = ti.configuration.windowConfiguration.getActivityType();
+        return atype == ACTIVITY_TYPE_HOME || atype == ACTIVITY_TYPE_RECENTS;
+    }
+
+    /**
+     * Reparents all tile members back to their display and resets home task override bounds.
+     * @param dismissOrMaximize When {@code true} this resolves the split by closing the primary
+     *                          split (thus resulting in the top of the secondary split becoming
+     *                          fullscreen. {@code false} resolves the other way.
+     */
+    static void applyDismissSplit(SplitScreenTaskOrganizer tiles, boolean dismissOrMaximize) {
+        try {
+            // Set launch root first so that any task created after getChildContainers and
+            // before reparent (pretty unlikely) are put into fullscreen.
+            ActivityTaskManager.getTaskOrganizerController().setLaunchRoot(Display.DEFAULT_DISPLAY,
+                    null);
+            // TODO(task-org): Once task-org is more complete, consider using Appeared/Vanished
+            //                 plus specific APIs to clean this up.
+            List<ActivityManager.RunningTaskInfo> primaryChildren =
+                    ActivityTaskManager.getTaskOrganizerController().getChildTasks(
+                            tiles.mPrimary.token, null /* activityTypes */);
+            List<ActivityManager.RunningTaskInfo> secondaryChildren =
+                    ActivityTaskManager.getTaskOrganizerController().getChildTasks(
+                            tiles.mSecondary.token, null /* activityTypes */);
+            // In some cases (eg. non-resizable is launched), system-server will leave split-screen.
+            // as a result, the above will not capture any tasks; yet, we need to clean-up the
+            // home task bounds.
+            List<ActivityManager.RunningTaskInfo> freeHomeAndRecents =
+                    ActivityTaskManager.getTaskOrganizerController().getRootTasks(
+                            Display.DEFAULT_DISPLAY, HOME_AND_RECENTS);
+            if (primaryChildren.isEmpty() && secondaryChildren.isEmpty()
+                    && freeHomeAndRecents.isEmpty()) {
+                return;
+            }
+            WindowContainerTransaction wct = new WindowContainerTransaction();
+            if (dismissOrMaximize) {
+                // Dismissing, so move all primary split tasks first
+                for (int i = primaryChildren.size() - 1; i >= 0; --i) {
+                    wct.reparent(primaryChildren.get(i).token, null /* parent */,
+                            true /* onTop */);
+                }
+                // Don't need to worry about home tasks because they are already in the "proper"
+                // order within the secondary split.
+                for (int i = secondaryChildren.size() - 1; i >= 0; --i) {
+                    final ActivityManager.RunningTaskInfo ti = secondaryChildren.get(i);
+                    wct.reparent(ti.token, null /* parent */, true /* onTop */);
+                    if (isHomeOrRecentTask(ti)) {
+                        wct.setBounds(ti.token, null);
+                    }
+                }
+            } else {
+                // Maximize, so move non-home secondary split first
+                for (int i = secondaryChildren.size() - 1; i >= 0; --i) {
+                    if (isHomeOrRecentTask(secondaryChildren.get(i))) {
+                        continue;
+                    }
+                    wct.reparent(secondaryChildren.get(i).token, null /* parent */,
+                            true /* onTop */);
+                }
+                // Find and place home tasks in-between. This simulates the fact that there was
+                // nothing behind the primary split's tasks.
+                for (int i = secondaryChildren.size() - 1; i >= 0; --i) {
+                    final ActivityManager.RunningTaskInfo ti = secondaryChildren.get(i);
+                    if (isHomeOrRecentTask(ti)) {
+                        wct.reparent(ti.token, null /* parent */, true /* onTop */);
+                        // reset bounds too
+                        wct.setBounds(ti.token, null);
+                    }
+                }
+                for (int i = primaryChildren.size() - 1; i >= 0; --i) {
+                    wct.reparent(primaryChildren.get(i).token, null /* parent */,
+                            true /* onTop */);
+                }
+            }
+            for (int i = freeHomeAndRecents.size() - 1; i >= 0; --i) {
+                wct.setBounds(freeHomeAndRecents.get(i).token, null);
+            }
+            ActivityTaskManager.getTaskOrganizerController().applyContainerTransaction(wct,
+                    null /* organizer */);
+        } catch (RemoteException e) {
+            Log.w(TAG, "Failed to remove stack: " + e);
+        }
+    }
 }
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/MediaArtworkProcessor.kt b/packages/SystemUI/src/com/android/systemui/statusbar/MediaArtworkProcessor.kt
index aaf4849..711d6a6d 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/MediaArtworkProcessor.kt
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/MediaArtworkProcessor.kt
@@ -19,7 +19,6 @@
 import android.content.Context
 import android.graphics.Bitmap
 import android.graphics.Canvas
-import android.graphics.Point
 import android.graphics.Rect
 import android.renderscript.Allocation
 import android.renderscript.Element
@@ -27,9 +26,11 @@
 import android.renderscript.ScriptIntrinsicBlur
 import android.util.Log
 import android.util.MathUtils
+import android.util.Size
+import android.view.WindowManager
+import com.android.internal.annotations.VisibleForTesting
 import com.android.internal.graphics.ColorUtils
 import com.android.systemui.statusbar.notification.MediaNotificationProcessor
-
 import javax.inject.Inject
 import javax.inject.Singleton
 
@@ -41,10 +42,9 @@
 @Singleton
 class MediaArtworkProcessor @Inject constructor() {
 
-    private val mTmpSize = Point()
     private var mArtworkCache: Bitmap? = null
 
-    fun processArtwork(context: Context, artwork: Bitmap): Bitmap? {
+    fun processArtwork(context: Context, artwork: Bitmap, windowType: Int): Bitmap? {
         if (mArtworkCache != null) {
             return mArtworkCache
         }
@@ -54,9 +54,9 @@
         var output: Allocation? = null
         var inBitmap: Bitmap? = null
         try {
-            context.display.getSize(mTmpSize)
+            val size = getWindowSize(context, windowType)
             val rect = Rect(0, 0, artwork.width, artwork.height)
-            MathUtils.fitRect(rect, Math.max(mTmpSize.x / DOWNSAMPLE, mTmpSize.y / DOWNSAMPLE))
+            MathUtils.fitRect(rect, Math.max(size.width / DOWNSAMPLE, size.height / DOWNSAMPLE))
             inBitmap = Bitmap.createScaledBitmap(artwork, rect.width(), rect.height(),
                     true /* filter */)
             // Render script blurs only support ARGB_8888, we need a conversion if we got a
@@ -98,4 +98,15 @@
         mArtworkCache?.recycle()
         mArtworkCache = null
     }
+
+    @VisibleForTesting
+    internal fun getWindowSize(context: Context, windowType: Int): Size {
+        val windowContext = context.display?.let {
+            context.createDisplayContext(it)
+                    .createWindowContext(windowType, null)
+        } ?: run { throw NullPointerException("Display is null") }
+        val windowManager = windowContext.getSystemService(WindowManager::class.java)
+                ?: run { throw NullPointerException("Null window manager") }
+        return windowManager.currentWindowMetrics.size
+    }
 }
\ No newline at end of file
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationMediaManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationMediaManager.java
index d0af106..f8db922 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationMediaManager.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationMediaManager.java
@@ -15,7 +15,6 @@
  */
 package com.android.systemui.statusbar;
 
-import static com.android.systemui.Dependency.MAIN_HANDLER;
 import static com.android.systemui.statusbar.StatusBarState.KEYGUARD;
 import static com.android.systemui.statusbar.phone.StatusBar.DEBUG_MEDIA_FAKE_ARTWORK;
 import static com.android.systemui.statusbar.phone.StatusBar.ENABLE_LOCKSCREEN_WALLPAPER;
@@ -36,7 +35,6 @@
 import android.media.session.MediaSessionManager;
 import android.media.session.PlaybackState;
 import android.os.AsyncTask;
-import android.os.Handler;
 import android.os.Trace;
 import android.os.UserHandle;
 import android.provider.DeviceConfig;
@@ -44,6 +42,7 @@
 import android.util.ArraySet;
 import android.util.Log;
 import android.view.View;
+import android.view.WindowManager;
 import android.widget.ImageView;
 
 import com.android.internal.config.sysui.SystemUiDeviceConfigFlags;
@@ -52,6 +51,7 @@
 import com.android.systemui.Dumpable;
 import com.android.systemui.Interpolators;
 import com.android.systemui.colorextraction.SysuiColorExtractor;
+import com.android.systemui.dagger.qualifiers.Main;
 import com.android.systemui.plugins.statusbar.StatusBarStateController;
 import com.android.systemui.statusbar.dagger.StatusBarModule;
 import com.android.systemui.statusbar.notification.NotificationEntryListener;
@@ -73,6 +73,7 @@
 import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
+import java.util.concurrent.Executor;
 
 import dagger.Lazy;
 
@@ -110,7 +111,7 @@
     @Nullable
     private LockscreenWallpaper mLockscreenWallpaper;
 
-    private final Handler mHandler = Dependency.get(MAIN_HANDLER);
+    private final Executor mMainExecutor;
 
     private final Context mContext;
     private final MediaSessionManager mMediaSessionManager;
@@ -181,7 +182,8 @@
             Lazy<NotificationShadeWindowController> notificationShadeWindowController,
             NotificationEntryManager notificationEntryManager,
             MediaArtworkProcessor mediaArtworkProcessor,
-            KeyguardBypassController keyguardBypassController) {
+            KeyguardBypassController keyguardBypassController,
+            @Main Executor mainExecutor) {
         mContext = context;
         mMediaArtworkProcessor = mediaArtworkProcessor;
         mKeyguardBypassController = keyguardBypassController;
@@ -194,6 +196,7 @@
         mStatusBarLazy = statusBarLazy;
         mNotificationShadeWindowController = notificationShadeWindowController;
         mEntryManager = notificationEntryManager;
+        mMainExecutor = mainExecutor;
         notificationEntryManager.addNotificationEntryListener(new NotificationEntryListener() {
             @Override
             public void onPendingEntryAdded(NotificationEntry entry) {
@@ -623,7 +626,7 @@
                                 mBackdrop.setVisibility(View.GONE);
                                 mBackdropFront.animate().cancel();
                                 mBackdropBack.setImageDrawable(null);
-                                mHandler.post(mHideBackdropFront);
+                                mMainExecutor.execute(mHideBackdropFront);
                             });
                     if (mKeyguardStateController.isKeyguardFadingAway()) {
                         mBackdrop.animate()
@@ -668,7 +671,8 @@
     };
 
     private Bitmap processArtwork(Bitmap artwork) {
-        return mMediaArtworkProcessor.processArtwork(mContext, artwork);
+        return mMediaArtworkProcessor.processArtwork(mContext, artwork,
+                WindowManager.LayoutParams.TYPE_NOTIFICATION_SHADE);
     }
 
     @MainThread
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/dagger/StatusBarDependenciesModule.java b/packages/SystemUI/src/com/android/systemui/statusbar/dagger/StatusBarDependenciesModule.java
index 0b37c22..cd5bb77 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/dagger/StatusBarDependenciesModule.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/dagger/StatusBarDependenciesModule.java
@@ -43,6 +43,8 @@
 import com.android.systemui.statusbar.policy.RemoteInputUriController;
 import com.android.systemui.tracing.ProtoTracer;
 
+import java.util.concurrent.Executor;
+
 import javax.inject.Singleton;
 
 import dagger.Lazy;
@@ -88,14 +90,16 @@
             Lazy<NotificationShadeWindowController> notificationShadeWindowController,
             NotificationEntryManager notificationEntryManager,
             MediaArtworkProcessor mediaArtworkProcessor,
-            KeyguardBypassController keyguardBypassController) {
+            KeyguardBypassController keyguardBypassController,
+            @Main Executor mainExecutor) {
         return new NotificationMediaManager(
                 context,
                 statusBarLazy,
                 notificationShadeWindowController,
                 notificationEntryManager,
                 mediaArtworkProcessor,
-                keyguardBypassController);
+                keyguardBypassController,
+                mainExecutor);
     }
 
     /** */
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/InstantAppNotifier.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/InstantAppNotifier.java
index 93f5805..55a20fa 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/InstantAppNotifier.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/InstantAppNotifier.java
@@ -51,10 +51,10 @@
 import com.android.internal.messages.nano.SystemMessageProto;
 import com.android.internal.messages.nano.SystemMessageProto.SystemMessage;
 import com.android.systemui.Dependency;
-import com.android.systemui.DockedStackExistsListener;
 import com.android.systemui.R;
 import com.android.systemui.SystemUI;
 import com.android.systemui.dagger.qualifiers.UiBackground;
+import com.android.systemui.stackdivider.Divider;
 import com.android.systemui.statusbar.CommandQueue;
 import com.android.systemui.statusbar.policy.KeyguardStateController;
 import com.android.systemui.util.NotificationChannels;
@@ -80,11 +80,13 @@
     private final CommandQueue mCommandQueue;
     private boolean mDockedStackExists;
     private KeyguardStateController mKeyguardStateController;
+    private final Divider mDivider;
 
     @Inject
     public InstantAppNotifier(Context context, CommandQueue commandQueue,
-            @UiBackground Executor uiBgExecutor) {
+            @UiBackground Executor uiBgExecutor, Divider divider) {
         super(context);
+        mDivider = divider;
         mCommandQueue = commandQueue;
         mUiBgExecutor = uiBgExecutor;
     }
@@ -103,7 +105,7 @@
         mCommandQueue.addCallback(this);
         mKeyguardStateController.addCallback(this);
 
-        DockedStackExistsListener.register(
+        mDivider.registerInSplitScreenListener(
                 exists -> {
                     mDockedStackExists = exists;
                     updateForegroundInstantApps();
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationAlertingManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationAlertingManager.java
index 72a7e11..07cf9d9 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationAlertingManager.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationAlertingManager.java
@@ -53,12 +53,14 @@
             VisualStabilityManager visualStabilityManager,
             StatusBarStateController statusBarStateController,
             NotificationInterruptionStateProvider notificationInterruptionStateProvider,
-            NotificationListener notificationListener) {
+            NotificationListener notificationListener,
+            HeadsUpManager headsUpManager) {
         mRemoteInputManager = remoteInputManager;
         mVisualStabilityManager = visualStabilityManager;
         mStatusBarStateController = statusBarStateController;
         mNotificationInterruptionStateProvider = notificationInterruptionStateProvider;
         mNotificationListener = notificationListener;
+        mHeadsUpManager = headsUpManager;
 
         notificationEntryManager.addNotificationEntryListener(new NotificationEntryListener() {
             @Override
@@ -81,10 +83,6 @@
         });
     }
 
-    public void setHeadsUpManager(HeadsUpManager headsUpManager) {
-        mHeadsUpManager = headsUpManager;
-    }
-
     /**
      * Adds the entry to the respective alerting manager if the content view was inflated and
      * the entry should still alert.
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationEntryManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationEntryManager.java
index 4f55e02..5ebd368 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationEntryManager.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationEntryManager.java
@@ -49,9 +49,7 @@
 import com.android.systemui.statusbar.notification.collection.notifcollection.NotifCollectionListener;
 import com.android.systemui.statusbar.notification.dagger.NotificationsModule;
 import com.android.systemui.statusbar.notification.logging.NotificationLogger;
-import com.android.systemui.statusbar.notification.stack.NotificationListContainer;
 import com.android.systemui.statusbar.phone.NotificationGroupManager;
-import com.android.systemui.statusbar.policy.HeadsUpManager;
 import com.android.systemui.util.Assert;
 import com.android.systemui.util.leak.LeakDetector;
 
@@ -230,9 +228,7 @@
         mRemoveInterceptors.remove(interceptor);
     }
 
-    public void setUpWithPresenter(NotificationPresenter presenter,
-            NotificationListContainer listContainer,
-            HeadsUpManager headsUpManager) {
+    public void setUpWithPresenter(NotificationPresenter presenter) {
         mPresenter = presenter;
     }
 
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/VisualStabilityManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/VisualStabilityManager.java
index 616c110..fabe3a7 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/VisualStabilityManager.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/VisualStabilityManager.java
@@ -61,7 +61,8 @@
      * Injected constructor. See {@link NotificationsModule}.
      */
     public VisualStabilityManager(
-            NotificationEntryManager notificationEntryManager, @Main Handler handler) {
+            NotificationEntryManager notificationEntryManager,
+            @Main Handler handler) {
 
         mHandler = handler;
 
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotificationRankingManager.kt b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotificationRankingManager.kt
index 2981252..e612c07 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotificationRankingManager.kt
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotificationRankingManager.kt
@@ -33,6 +33,7 @@
 import com.android.systemui.statusbar.phone.NotificationGroupManager
 import com.android.systemui.statusbar.policy.HeadsUpManager
 import dagger.Lazy
+import java.util.Comparator
 import java.util.Objects
 import javax.inject.Inject
 
@@ -73,6 +74,9 @@
         val aIsPeople = a.isPeopleNotification()
         val bIsPeople = b.isPeopleNotification()
 
+        val aIsImportantPeople = a.isImportantPeopleNotification()
+        val bIsImportantPeople = b.isImportantPeopleNotification()
+
         val aMedia = isImportantMedia(a)
         val bMedia = isImportantMedia(b)
 
@@ -87,6 +91,8 @@
 
         when {
             usePeopleFiltering && aIsPeople != bIsPeople -> if (aIsPeople) -1 else 1
+            usePeopleFiltering && aIsImportantPeople != bIsImportantPeople ->
+                if (aIsImportantPeople) -1 else 1
             aHeadsUp != bHeadsUp -> if (aHeadsUp) -1 else 1
             // Provide consistent ranking with headsUpManager
             aHeadsUp -> headsUpManager.compare(a, b)
@@ -192,6 +198,9 @@
     private fun NotificationEntry.isPeopleNotification() =
             peopleNotificationIdentifier.isPeopleNotification(sbn, ranking)
 
+    private fun NotificationEntry.isImportantPeopleNotification() =
+            peopleNotificationIdentifier.isImportantPeopleNotification(sbn, ranking)
+
     private fun NotificationEntry.isHighPriority() =
             highPriorityProvider.isHighPriority(this)
 }
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/dagger/NotificationsModule.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/dagger/NotificationsModule.java
index 8f8f742..d0b553d 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/dagger/NotificationsModule.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/dagger/NotificationsModule.java
@@ -47,6 +47,7 @@
 import com.android.systemui.statusbar.notification.row.NotificationGutsManager;
 import com.android.systemui.statusbar.phone.NotificationGroupManager;
 import com.android.systemui.statusbar.phone.StatusBar;
+import com.android.systemui.statusbar.policy.HeadsUpManager;
 import com.android.systemui.util.leak.LeakDetector;
 
 import java.util.concurrent.Executor;
@@ -123,14 +124,16 @@
             VisualStabilityManager visualStabilityManager,
             StatusBarStateController statusBarStateController,
             NotificationInterruptionStateProvider notificationInterruptionStateProvider,
-            NotificationListener notificationListener) {
+            NotificationListener notificationListener,
+            HeadsUpManager headsUpManager) {
         return new NotificationAlertingManager(
                 notificationEntryManager,
                 remoteInputManager,
                 visualStabilityManager,
                 statusBarStateController,
                 notificationInterruptionStateProvider,
-                notificationListener);
+                notificationListener,
+                headsUpManager);
     }
 
     /** Provides an instance of {@link NotificationLogger} */
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/people/PeopleNotificationIdentifier.kt b/packages/SystemUI/src/com/android/systemui/statusbar/notification/people/PeopleNotificationIdentifier.kt
index 4672de0..e15fa2e 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/people/PeopleNotificationIdentifier.kt
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/people/PeopleNotificationIdentifier.kt
@@ -23,6 +23,7 @@
 
 interface PeopleNotificationIdentifier {
     fun isPeopleNotification(sbn: StatusBarNotification, ranking: Ranking): Boolean
+    fun isImportantPeopleNotification(sbn: StatusBarNotification, ranking: Ranking): Boolean
 }
 
 @Singleton
@@ -32,4 +33,7 @@
 
     override fun isPeopleNotification(sbn: StatusBarNotification, ranking: Ranking) =
             ranking.isConversation || personExtractor.isPersonNotification(sbn)
+
+    override fun isImportantPeopleNotification(sbn: StatusBarNotification, ranking: Ranking) =
+            isPeopleNotification(sbn, ranking) && ranking.channel.isImportantConversation
 }
\ No newline at end of file
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ActivatableNotificationView.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ActivatableNotificationView.java
index 3eac229..b03ba3c 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ActivatableNotificationView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ActivatableNotificationView.java
@@ -336,6 +336,10 @@
         return false;
     }
 
+    boolean superPerformClick() {
+        return super.performClick();
+    }
+
     /**
      * Cancels the hotspot and makes the notification inactive.
      */
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ActivatableNotificationViewController.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ActivatableNotificationViewController.java
index 8465658..2643ec9 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ActivatableNotificationViewController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ActivatableNotificationViewController.java
@@ -72,7 +72,8 @@
             } else {
                 mView.makeInactive(true /* animate */);
             }
-        }, mView::performClick, mView::handleSlideBack, mFalsingManager::onNotificationDoubleTap);
+        }, mView::superPerformClick, mView::handleSlideBack,
+                mFalsingManager::onNotificationDoubleTap);
         mView.setOnTouchListener(mTouchHandler);
         mView.setTouchHandler(mTouchHandler);
         mView.setOnDimmedListener(dimmed -> {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRow.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRow.java
index 55173182..234ab93 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRow.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRow.java
@@ -1197,6 +1197,9 @@
         if (mMenuRow != null && mMenuRow.getMenuView() != null) {
             mMenuRow.onConfigurationChanged();
         }
+        if (mImageResolver != null) {
+            mImageResolver.updateMaxImageSizes();
+        }
     }
 
     public void onUiModeChanged() {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationConversationInfo.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationConversationInfo.java
index 923c348..60eda06 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationConversationInfo.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationConversationInfo.java
@@ -22,6 +22,7 @@
 import static android.app.NotificationManager.IMPORTANCE_UNSPECIFIED;
 import static android.content.pm.LauncherApps.ShortcutQuery.FLAG_MATCH_DYNAMIC;
 import static android.content.pm.LauncherApps.ShortcutQuery.FLAG_MATCH_PINNED;
+import static android.provider.Settings.Secure.BUBBLE_IMPORTANT_CONVERSATIONS;
 
 import static java.lang.annotation.RetentionPolicy.SOURCE;
 
@@ -112,7 +113,8 @@
     boolean mSkipPost = false;
 
     @Retention(SOURCE)
-    @IntDef({ACTION_BUBBLE, ACTION_HOME, ACTION_FAVORITE, ACTION_SNOOZE, ACTION_MUTE})
+    @IntDef({ACTION_BUBBLE, ACTION_HOME, ACTION_FAVORITE, ACTION_SNOOZE, ACTION_MUTE,
+            ACTION_UNBUBBLE, ACTION_SETTINGS})
     private @interface Action {}
     static final int ACTION_BUBBLE = 0;
     static final int ACTION_HOME = 1;
@@ -128,8 +130,6 @@
             mBubbleController.onUserDemotedBubbleFromNotification(mEntry);
         } else {
             mBubbleController.onUserCreatedBubbleFromNotification(mEntry);
-            Settings.Global.putInt(
-                    mContext.getContentResolver(), Settings.Global.NOTIFICATION_BUBBLES, 1);
         }
         closeControls(v, true);
     };
@@ -225,7 +225,9 @@
             mShortcutInfo = shortcuts.get(0);
         }
 
-        mIsBubbleable = mEntry.getBubbleMetadata() != null;
+        mIsBubbleable = mEntry.getBubbleMetadata() != null
+            && Settings.Global.getInt(mContext.getContentResolver(),
+                Settings.Global.NOTIFICATION_BUBBLES, 0) == 1;
         mStartedAsBubble = mEntry.isBubble();
 
         createConversationChannelIfNeeded();
@@ -382,6 +384,11 @@
         ((TextView) findViewById(R.id.pkg_name)).setText(mAppName);
     }
 
+    private boolean bubbleImportantConversations() {
+        return Settings.Secure.getInt(mContext.getContentResolver(),
+                BUBBLE_IMPORTANT_CONVERSATIONS, 1) == 1;
+    }
+
     private void bindDelegate() {
         TextView delegateView = findViewById(R.id.delegate_name);
 
@@ -513,7 +520,11 @@
 
     @Override
     public boolean shouldBeSaved() {
-        return mSelectedAction > -1;
+        // Toggle actions are already saved by the time the guts are closed; save for any other
+        // taps
+        return mSelectedAction > -1
+                && mSelectedAction != ACTION_FAVORITE
+                && mSelectedAction != ACTION_MUTE;
     }
 
     @Override
@@ -575,6 +586,10 @@
                     case ACTION_FAVORITE:
                         mChannelToUpdate.setImportantConversation(
                                 !mChannelToUpdate.isImportantConversation());
+                        if (mChannelToUpdate.isImportantConversation()
+                                && bubbleImportantConversations()) {
+                            mChannelToUpdate.setAllowBubbles(true);
+                        }
                         break;
                     case ACTION_MUTE:
                         if (mChannelToUpdate.getImportance() == IMPORTANCE_UNSPECIFIED
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationInlineImageResolver.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationInlineImageResolver.java
index fa4bc2a..52f7c2c 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationInlineImageResolver.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationInlineImageResolver.java
@@ -19,12 +19,17 @@
 import android.app.ActivityManager;
 import android.app.Notification;
 import android.content.Context;
+import android.graphics.Bitmap;
+import android.graphics.drawable.BitmapDrawable;
 import android.graphics.drawable.Drawable;
+import android.graphics.drawable.Icon;
 import android.net.Uri;
 import android.os.Bundle;
 import android.os.Parcelable;
 import android.util.Log;
 
+import com.android.internal.R;
+import com.android.internal.annotations.VisibleForTesting;
 import com.android.internal.widget.ImageResolver;
 import com.android.internal.widget.LocalImageResolver;
 import com.android.internal.widget.MessagingMessage;
@@ -36,6 +41,10 @@
 
 /**
  * Custom resolver with built-in image cache for image messages.
+ *
+ * If the URL points to a bitmap that's larger than the maximum width or height, the bitmap
+ * will be resized down to that maximum size before being cached. See {@link #getMaxImageWidth()},
+ * {@link #getMaxImageHeight()}, and {@link #resolveImage(Uri)} for the downscaling implementation.
  */
 public class NotificationInlineImageResolver implements ImageResolver {
     private static final String TAG = NotificationInlineImageResolver.class.getSimpleName();
@@ -44,6 +53,13 @@
     private final ImageCache mImageCache;
     private Set<Uri> mWantedUriSet;
 
+    // max allowed bitmap width, in pixels
+    @VisibleForTesting
+    protected int mMaxImageWidth;
+    // max allowed bitmap height, in pixels
+    @VisibleForTesting
+    protected int mMaxImageHeight;
+
     /**
      * Constructor.
      * @param context    Context.
@@ -56,6 +72,8 @@
         if (mImageCache != null) {
             mImageCache.setImageResolver(this);
         }
+
+        updateMaxImageSizes();
     }
 
     /**
@@ -66,14 +84,49 @@
         return mImageCache != null && !ActivityManager.isLowRamDeviceStatic();
     }
 
+    private boolean isLowRam() {
+        return ActivityManager.isLowRamDeviceStatic();
+    }
+
     /**
-     * To resolve image from specified uri directly.
+     * Update the maximum width and height allowed for bitmaps, ex. after a configuration change.
+     */
+    public void updateMaxImageSizes() {
+        mMaxImageWidth = getMaxImageWidth();
+        mMaxImageHeight = getMaxImageHeight();
+    }
+
+    @VisibleForTesting
+    protected int getMaxImageWidth() {
+        return mContext.getResources().getDimensionPixelSize(isLowRam()
+                ? R.dimen.notification_custom_view_max_image_width_low_ram
+                : R.dimen.notification_custom_view_max_image_width);
+    }
+
+    @VisibleForTesting
+    protected int getMaxImageHeight() {
+        return mContext.getResources().getDimensionPixelSize(isLowRam()
+                ? R.dimen.notification_custom_view_max_image_height_low_ram
+                : R.dimen.notification_custom_view_max_image_height);
+    }
+
+    @VisibleForTesting
+    protected BitmapDrawable resolveImageInternal(Uri uri) throws IOException {
+        return (BitmapDrawable) LocalImageResolver.resolveImage(uri, mContext);
+    }
+
+    /**
+     * To resolve image from specified uri directly. If the resulting image is larger than the
+     * maximum allowed size, scale it down.
      * @param uri Uri of the image.
      * @return Drawable of the image.
      * @throws IOException Throws if failed at resolving the image.
      */
     Drawable resolveImage(Uri uri) throws IOException {
-        return LocalImageResolver.resolveImage(uri, mContext);
+        BitmapDrawable image = resolveImageInternal(uri);
+        Bitmap bitmap = image.getBitmap();
+        image.setBitmap(Icon.scaleDownIfNecessary(bitmap, mMaxImageWidth, mMaxImageHeight));
+        return image;
     }
 
     @Override
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/HeadsUpManagerPhone.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/HeadsUpManagerPhone.java
index c6e3fde..63fe700 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/HeadsUpManagerPhone.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/HeadsUpManagerPhone.java
@@ -19,24 +19,15 @@
 import android.annotation.NonNull;
 import android.annotation.Nullable;
 import android.content.Context;
-import android.content.res.Configuration;
 import android.content.res.Resources;
-import android.graphics.Rect;
 import android.graphics.Region;
-import android.util.Log;
 import android.util.Pools;
-import android.view.DisplayCutout;
-import android.view.Gravity;
-import android.view.View;
-import android.view.ViewTreeObserver;
-import android.view.WindowInsets;
 
 import androidx.collection.ArraySet;
 
 import com.android.internal.annotations.VisibleForTesting;
 import com.android.systemui.Dumpable;
 import com.android.systemui.R;
-import com.android.systemui.ScreenDecorations;
 import com.android.systemui.plugins.statusbar.StatusBarStateController;
 import com.android.systemui.plugins.statusbar.StatusBarStateController.StateListener;
 import com.android.systemui.statusbar.StatusBarState;
@@ -49,31 +40,27 @@
 
 import java.io.FileDescriptor;
 import java.io.PrintWriter;
+import java.util.ArrayList;
 import java.util.HashSet;
+import java.util.List;
 import java.util.Stack;
 
 /**
  * A implementation of HeadsUpManager for phone and car.
  */
 public class HeadsUpManagerPhone extends HeadsUpManager implements Dumpable,
-        VisualStabilityManager.Callback, OnHeadsUpChangedListener,
-        ConfigurationController.ConfigurationListener, StateListener {
+        VisualStabilityManager.Callback, OnHeadsUpChangedListener {
     private static final String TAG = "HeadsUpManagerPhone";
 
     @VisibleForTesting
     final int mExtensionTime;
-    private final StatusBarStateController mStatusBarStateController;
     private final KeyguardBypassController mBypassController;
+    private final NotificationGroupManager mGroupManager;
+    private final List<OnHeadsUpPhoneListenerChange> mHeadsUpPhoneListeners = new ArrayList<>();
     private final int mAutoHeadsUpNotificationDecay;
-    private View mNotificationShadeWindowView;
-    private NotificationGroupManager mGroupManager;
     private VisualStabilityManager mVisualStabilityManager;
-    private StatusBarTouchableRegionManager mStatusBarTouchableRegionManager;
     private boolean mReleaseOnExpandFinish;
 
-    private int mStatusBarHeight;
-    private int mHeadsUpInset;
-    private int mDisplayCutoutTouchableRegionSize;
     private boolean mTrackingHeadsUp;
     private HashSet<String> mSwipedOutKeys = new HashSet<>();
     private HashSet<NotificationEntry> mEntriesToRemoveAfterExpand = new HashSet<>();
@@ -81,12 +68,13 @@
     private ArraySet<NotificationEntry> mEntriesToRemoveWhenReorderingAllowed
             = new ArraySet<>();
     private boolean mIsExpanded;
-    private int[] mTmpTwoArray = new int[2];
     private boolean mHeadsUpGoingAway;
     private int mStatusBarState;
-    private Region mTouchableRegion = new Region();
-
     private AnimationStateHandler mAnimationStateHandler;
+    private int mHeadsUpInset;
+
+    // Used for determining the region for touch interaction
+    private final Region mTouchableRegion = new Region();
 
     private final Pools.Pool<HeadsUpEntryPhone> mEntryPool = new Pools.Pool<HeadsUpEntryPhone>() {
         private Stack<HeadsUpEntryPhone> mPoolObjects = new Stack<>();
@@ -111,76 +99,96 @@
 
     public HeadsUpManagerPhone(@NonNull final Context context,
             StatusBarStateController statusBarStateController,
-            KeyguardBypassController bypassController) {
+            KeyguardBypassController bypassController,
+            NotificationGroupManager groupManager,
+            ConfigurationController configurationController) {
         super(context);
         Resources resources = mContext.getResources();
         mExtensionTime = resources.getInteger(R.integer.ambient_notification_extension_time);
         mAutoHeadsUpNotificationDecay = resources.getInteger(
                 R.integer.auto_heads_up_notification_decay);
-        mStatusBarStateController = statusBarStateController;
-        mStatusBarStateController.addCallback(this);
+        statusBarStateController.addCallback(mStatusBarStateListener);
         mBypassController = bypassController;
-
-        initResources();
-    }
-
-    public void setUp(@NonNull View notificationShadeWindowView,
-            @NonNull NotificationGroupManager groupManager,
-            @NonNull StatusBar bar,
-            @NonNull VisualStabilityManager visualStabilityManager) {
-        mNotificationShadeWindowView = notificationShadeWindowView;
-        mStatusBarTouchableRegionManager = new StatusBarTouchableRegionManager(this, bar,
-                notificationShadeWindowView);
         mGroupManager = groupManager;
-        mVisualStabilityManager = visualStabilityManager;
 
-        addListener(new OnHeadsUpChangedListener() {
+        updateResources();
+        configurationController.addCallback(new ConfigurationController.ConfigurationListener() {
             @Override
-            public void onHeadsUpPinnedModeChanged(boolean hasPinnedNotification) {
-                if (Log.isLoggable(TAG, Log.WARN)) {
-                    Log.w(TAG, "onHeadsUpPinnedModeChanged");
-                }
-                mStatusBarTouchableRegionManager.updateTouchableRegion();
+            public void onDensityOrFontScaleChanged() {
+                updateResources();
+            }
+
+            @Override
+            public void onOverlayChanged() {
+                updateResources();
             }
         });
     }
 
+    void setup(VisualStabilityManager visualStabilityManager) {
+        mVisualStabilityManager = visualStabilityManager;
+    }
+
     public void setAnimationStateHandler(AnimationStateHandler handler) {
         mAnimationStateHandler = handler;
     }
 
-    private void initResources() {
+    private void updateResources() {
         Resources resources = mContext.getResources();
-        mStatusBarHeight = resources.getDimensionPixelSize(
-                com.android.internal.R.dimen.status_bar_height);
-        mHeadsUpInset = mStatusBarHeight + resources.getDimensionPixelSize(
-                R.dimen.heads_up_status_bar_padding);
-        mDisplayCutoutTouchableRegionSize = resources.getDimensionPixelSize(
-                com.android.internal.R.dimen.display_cutout_touchable_region_size);
-    }
-
-    @Override
-    public void onDensityOrFontScaleChanged() {
-        super.onDensityOrFontScaleChanged();
-        initResources();
-    }
-
-    @Override
-    public void onOverlayChanged() {
-        initResources();
+        mHeadsUpInset =
+                resources.getDimensionPixelSize(com.android.internal.R.dimen.status_bar_height)
+                        + resources.getDimensionPixelSize(R.dimen.heads_up_status_bar_padding);
     }
 
     ///////////////////////////////////////////////////////////////////////////////////////////////
     //  Public methods:
 
     /**
+     * Add a listener to receive callbacks onHeadsUpGoingAway
+     */
+    void addHeadsUpPhoneListener(OnHeadsUpPhoneListenerChange listener) {
+        mHeadsUpPhoneListeners.add(listener);
+    }
+
+    /**
+     * Gets the touchable region needed for heads up notifications. Returns null if no touchable
+     * region is required (ie: no heads up notification currently exists).
+     */
+    @Nullable Region getTouchableRegion() {
+        NotificationEntry topEntry = getTopEntry();
+
+        // This call could be made in an inconsistent state while the pinnedMode hasn't been
+        // updated yet, but callbacks leading out of the headsUp manager, querying it. Let's
+        // therefore also check if the topEntry is null.
+        if (!hasPinnedHeadsUp() || topEntry == null) {
+            return null;
+        } else {
+            if (topEntry.isChildInGroup()) {
+                final NotificationEntry groupSummary =
+                        mGroupManager.getGroupSummary(topEntry.getSbn());
+                if (groupSummary != null) {
+                    topEntry = groupSummary;
+                }
+            }
+            ExpandableNotificationRow topRow = topEntry.getRow();
+            int[] tmpArray = new int[2];
+            topRow.getLocationOnScreen(tmpArray);
+            int minX = tmpArray[0];
+            int maxX = tmpArray[0] + topRow.getWidth();
+            int height = topRow.getIntrinsicHeight();
+            mTouchableRegion.set(minX, 0, maxX, mHeadsUpInset + height);
+            return mTouchableRegion;
+        }
+    }
+
+    /**
      * Decides whether a click is invalid for a notification, i.e it has not been shown long enough
      * that a user might have consciously clicked on it.
      *
      * @param key the key of the touched notification
      * @return whether the touch is invalid and should be discarded
      */
-    public boolean shouldSwallowClick(@NonNull String key) {
+    boolean shouldSwallowClick(@NonNull String key) {
         HeadsUpManager.HeadsUpEntry entry = getHeadsUpEntry(key);
         return entry != null && mClock.currentTimeMillis() < entry.mPostTime;
     }
@@ -213,39 +221,12 @@
      *
      * @param isExpanded True to notify expanded, false to notify collapsed.
      */
-    public void setIsPanelExpanded(boolean isExpanded) {
+    void setIsPanelExpanded(boolean isExpanded) {
         if (isExpanded != mIsExpanded) {
             mIsExpanded = isExpanded;
             if (isExpanded) {
                 mHeadsUpGoingAway = false;
             }
-            mStatusBarTouchableRegionManager.setIsStatusBarExpanded(isExpanded);
-            mStatusBarTouchableRegionManager.updateTouchableRegion();
-        }
-    }
-
-    @Override
-    public void onStateChanged(int newState) {
-        boolean wasKeyguard = mStatusBarState == StatusBarState.KEYGUARD;
-        boolean isKeyguard = newState == StatusBarState.KEYGUARD;
-        mStatusBarState = newState;
-        if (wasKeyguard && !isKeyguard && mKeysToRemoveWhenLeavingKeyguard.size() != 0) {
-            String[] keys = mKeysToRemoveWhenLeavingKeyguard.toArray(new String[0]);
-            for (String key : keys) {
-                removeAlertEntry(key);
-            }
-            mKeysToRemoveWhenLeavingKeyguard.clear();
-        }
-    }
-
-    @Override
-    public void onDozingChanged(boolean isDozing) {
-        if (!isDozing) {
-            // Let's make sure all huns we got while dozing time out within the normal timeout
-            // duration. Otherwise they could get stuck for a very long time
-            for (AlertEntry entry : mAlertEntries.values()) {
-                entry.updateEntry(true /* updatePostTime */);
-            }
         }
     }
 
@@ -262,18 +243,16 @@
      * Set that we are exiting the headsUp pinned mode, but some notifications might still be
      * animating out. This is used to keep the touchable regions in a sane state.
      */
-    public void setHeadsUpGoingAway(boolean headsUpGoingAway) {
+    void setHeadsUpGoingAway(boolean headsUpGoingAway) {
         if (headsUpGoingAway != mHeadsUpGoingAway) {
             mHeadsUpGoingAway = headsUpGoingAway;
-            if (!headsUpGoingAway) {
-                mStatusBarTouchableRegionManager.updateTouchableRegionAfterLayout();
-            } else {
-                mStatusBarTouchableRegionManager.updateTouchableRegion();
+            for (OnHeadsUpPhoneListenerChange listener : mHeadsUpPhoneListeners) {
+                listener.onHeadsUpGoingAwayStateChanged(headsUpGoingAway);
             }
         }
     }
 
-    public boolean isHeadsUpGoingAway() {
+    boolean isHeadsUpGoingAway() {
         return mHeadsUpGoingAway;
     }
 
@@ -346,63 +325,6 @@
         dumpInternal(fd, pw, args);
     }
 
-    /**
-     * Update touch insets to include any area needed for touching a heads up notification.
-     *
-     * @param info Insets that will include heads up notification touch area after execution.
-     */
-    @Nullable
-    public void updateTouchableRegion(ViewTreeObserver.InternalInsetsInfo info) {
-        info.setTouchableInsets(ViewTreeObserver.InternalInsetsInfo.TOUCHABLE_INSETS_REGION);
-        info.touchableRegion.set(calculateTouchableRegion());
-    }
-
-    public Region calculateTouchableRegion() {
-        NotificationEntry topEntry = getTopEntry();
-        // This call could be made in an inconsistent state while the pinnedMode hasn't been
-        // updated yet, but callbacks leading out of the headsUp manager, querying it. Let's
-        // therefore also check if the topEntry is null.
-        if (!hasPinnedHeadsUp() || topEntry == null) {
-            mTouchableRegion.set(0, 0, mNotificationShadeWindowView.getWidth(), mStatusBarHeight);
-            updateRegionForNotch(mTouchableRegion);
-
-        } else {
-            if (topEntry.isChildInGroup()) {
-                final NotificationEntry groupSummary =
-                        mGroupManager.getGroupSummary(topEntry.getSbn());
-                if (groupSummary != null) {
-                    topEntry = groupSummary;
-                }
-            }
-            ExpandableNotificationRow topRow = topEntry.getRow();
-            topRow.getLocationOnScreen(mTmpTwoArray);
-            int minX = mTmpTwoArray[0];
-            int maxX = mTmpTwoArray[0] + topRow.getWidth();
-            int height = topRow.getIntrinsicHeight();
-            mTouchableRegion.set(minX, 0, maxX, mHeadsUpInset + height);
-        }
-        return mTouchableRegion;
-    }
-
-    private void updateRegionForNotch(Region region) {
-        WindowInsets windowInsets = mNotificationShadeWindowView.getRootWindowInsets();
-        if (windowInsets == null) {
-            Log.w(TAG, "StatusBarWindowView is not attached.");
-            return;
-        }
-        DisplayCutout cutout = windowInsets.getDisplayCutout();
-        if (cutout == null) {
-            return;
-        }
-
-        // Expand touchable region such that we also catch touches that just start below the notch
-        // area.
-        Rect bounds = new Rect();
-        ScreenDecorations.DisplayCutoutView.boundsFromDirection(cutout, Gravity.TOP, bounds);
-        bounds.offset(0, mDisplayCutoutTouchableRegionSize);
-        region.union(bounds);
-    }
-
     @Override
     public boolean shouldExtendLifetime(NotificationEntry entry) {
         // We should not defer the removal if reordering isn't allowed since otherwise
@@ -411,11 +333,6 @@
         return mVisualStabilityManager.isReorderingAllowed() && super.shouldExtendLifetime(entry);
     }
 
-    @Override
-    public void onConfigChanged(Configuration newConfig) {
-        initResources();
-    }
-
     ///////////////////////////////////////////////////////////////////////////////////////////////
     //  VisualStabilityManager.Callback overrides:
 
@@ -522,8 +439,7 @@
                         // time out anyway
                         && !entry.showingPulsing()) {
                     mEntriesToRemoveWhenReorderingAllowed.add(entry);
-                    mVisualStabilityManager.addReorderingAllowedCallback(
-                            HeadsUpManagerPhone.this);
+                    mVisualStabilityManager.addReorderingAllowedCallback(HeadsUpManagerPhone.this);
                 } else if (mTrackingHeadsUp) {
                     mEntriesToRemoveAfterExpand.add(entry);
                 } else if (mIsAutoHeadsUp && mStatusBarState == StatusBarState.KEYGUARD) {
@@ -626,4 +542,42 @@
     public interface AnimationStateHandler {
         void setHeadsUpGoingAwayAnimationsAllowed(boolean allowed);
     }
+
+    /**
+     * Listener to register for HeadsUpNotification Phone changes.
+     */
+    public interface OnHeadsUpPhoneListenerChange {
+        /**
+         * Called when a heads up notification is 'going away' or no longer 'going away'.
+         * See {@link HeadsUpManagerPhone#setHeadsUpGoingAway}.
+         */
+        void onHeadsUpGoingAwayStateChanged(boolean headsUpGoingAway);
+    }
+
+    private final StateListener mStatusBarStateListener = new StateListener() {
+        @Override
+        public void onStateChanged(int newState) {
+            boolean wasKeyguard = mStatusBarState == StatusBarState.KEYGUARD;
+            boolean isKeyguard = newState == StatusBarState.KEYGUARD;
+            mStatusBarState = newState;
+            if (wasKeyguard && !isKeyguard && mKeysToRemoveWhenLeavingKeyguard.size() != 0) {
+                String[] keys = mKeysToRemoveWhenLeavingKeyguard.toArray(new String[0]);
+                for (String key : keys) {
+                    removeAlertEntry(key);
+                }
+                mKeysToRemoveWhenLeavingKeyguard.clear();
+            }
+        }
+
+        @Override
+        public void onDozingChanged(boolean isDozing) {
+            if (!isDozing) {
+                // Let's make sure all huns we got while dozing time out within the normal timeout
+                // duration. Otherwise they could get stuck for a very long time
+                for (AlertEntry entry : mAlertEntries.values()) {
+                    entry.updateEntry(true /* updatePostTime */);
+                }
+            }
+        }
+    };
 }
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java
index d790cbc..84aecd4 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java
@@ -63,7 +63,6 @@
 
 import com.android.internal.annotations.VisibleForTesting;
 import com.android.systemui.Dependency;
-import com.android.systemui.DockedStackExistsListener;
 import com.android.systemui.Interpolators;
 import com.android.systemui.R;
 import com.android.systemui.assist.AssistHandleViewController;
@@ -75,6 +74,7 @@
 import com.android.systemui.shared.system.ActivityManagerWrapper;
 import com.android.systemui.shared.system.QuickStepContract;
 import com.android.systemui.shared.system.WindowManagerWrapper;
+import com.android.systemui.stackdivider.Divider;
 import com.android.systemui.statusbar.CommandQueue;
 import com.android.systemui.statusbar.NavigationBarController;
 import com.android.systemui.statusbar.policy.DeadZone;
@@ -869,7 +869,8 @@
 
         getImeSwitchButton().setOnClickListener(mImeSwitcherClickListener);
 
-        DockedStackExistsListener.register(mDockedListener);
+        Divider divider = Dependency.get(Divider.class);
+        divider.registerInSplitScreenListener(mDockedListener);
         updateOrientationViews();
         reloadNavIcons();
     }
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java
index d2186f9..fb7976f 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java
@@ -453,10 +453,11 @@
             KeyguardUpdateMonitor keyguardUpdateMonitor, MetricsLogger metricsLogger,
             ActivityManager activityManager, ZenModeController zenModeController,
             ConfigurationController configurationController,
-            FlingAnimationUtils.Builder flingAnimationUtilsBuilder) {
+            FlingAnimationUtils.Builder flingAnimationUtilsBuilder,
+            StatusBarTouchableRegionManager statusBarTouchableRegionManager) {
         super(view, falsingManager, dozeLog, keyguardStateController,
                 (SysuiStatusBarStateController) statusBarStateController, vibratorHelper,
-                latencyTracker, flingAnimationUtilsBuilder);
+                latencyTracker, flingAnimationUtilsBuilder, statusBarTouchableRegionManager);
         mView = view;
         mMetricsLogger = metricsLogger;
         mActivityManager = activityManager;
@@ -704,9 +705,9 @@
 
     private Rect calculateGestureExclusionRect() {
         Rect exclusionRect = null;
-        Region touchableRegion = mHeadsUpManager.calculateTouchableRegion();
+        Region touchableRegion = mStatusBarTouchableRegionManager.calculateTouchableRegion();
         if (isFullyCollapsed() && touchableRegion != null) {
-            // Note: The heads up manager also calculates the non-pinned touchable region
+            // Note: The manager also calculates the non-pinned touchable region
             exclusionRect = touchableRegion.getBounds();
         }
         return exclusionRect != null ? exclusionRect : EMPTY_RECT;
@@ -1914,6 +1915,7 @@
         boolean isExpanded = !isFullyCollapsed() || mExpectingSynthesizedDown;
         if (mPanelExpanded != isExpanded) {
             mHeadsUpManager.setIsPanelExpanded(isExpanded);
+            mStatusBarTouchableRegionManager.setPanelExpanded(isExpanded);
             mStatusBar.setPanelExpanded(isExpanded);
             mPanelExpanded = isExpanded;
         }
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationShadeWindowController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationShadeWindowController.java
index d016217..2dd42c2 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationShadeWindowController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationShadeWindowController.java
@@ -40,6 +40,7 @@
 import android.view.WindowManager;
 import android.view.WindowManager.LayoutParams;
 
+import com.android.systemui.DumpController;
 import com.android.systemui.Dumpable;
 import com.android.systemui.R;
 import com.android.systemui.colorextraction.SysuiColorExtractor;
@@ -101,7 +102,8 @@
             IActivityManager activityManager, DozeParameters dozeParameters,
             StatusBarStateController statusBarStateController,
             ConfigurationController configurationController,
-            KeyguardBypassController keyguardBypassController, SysuiColorExtractor colorExtractor) {
+            KeyguardBypassController keyguardBypassController, SysuiColorExtractor colorExtractor,
+            DumpController dumpController) {
         mContext = context;
         mWindowManager = windowManager;
         mActivityManager = activityManager;
@@ -111,6 +113,7 @@
         mLpChanged = new LayoutParams();
         mKeyguardBypassController = keyguardBypassController;
         mColorExtractor = colorExtractor;
+        dumpController.registerDumpable(this);
 
         mLockScreenDisplayTimeout = context.getResources()
                 .getInteger(R.integer.config_lockScreenDisplayTimeout);
@@ -594,7 +597,7 @@
     }
 
     public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
-        pw.println("StatusBarWindowController:");
+        pw.println(TAG + ":");
         pw.println("  mKeyguardDisplayMode=" + mKeyguardDisplayMode);
         pw.println(mCurrentState);
     }
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelViewController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelViewController.java
index af46f7b..30367ed 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelViewController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelViewController.java
@@ -73,6 +73,7 @@
 
     protected StatusBar mStatusBar;
     protected HeadsUpManagerPhone mHeadsUpManager;
+    protected final StatusBarTouchableRegionManager mStatusBarTouchableRegionManager;
 
     private float mPeekHeight;
     private float mHintDistance;
@@ -206,7 +207,9 @@
             FalsingManager falsingManager, DozeLog dozeLog,
             KeyguardStateController keyguardStateController,
             SysuiStatusBarStateController statusBarStateController, VibratorHelper vibratorHelper,
-            LatencyTracker latencyTracker, FlingAnimationUtils.Builder flingAnimationUtilsBuilder) {
+            LatencyTracker latencyTracker,
+            FlingAnimationUtils.Builder flingAnimationUtilsBuilder,
+            StatusBarTouchableRegionManager statusBarTouchableRegionManager) {
         mView = view;
         mView.addOnAttachStateChangeListener(new View.OnAttachStateChangeListener() {
             @Override
@@ -251,6 +254,7 @@
                 R.bool.config_enableNotificationShadeDrag);
         mVibratorHelper = vibratorHelper;
         mVibrateOnOpening = mResources.getBoolean(R.bool.config_vibrateOnIconAnimation);
+        mStatusBarTouchableRegionManager = statusBarTouchableRegionManager;
     }
 
     protected void loadDimens() {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
index 301eac2..0d3b09a 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
@@ -163,7 +163,6 @@
 import com.android.systemui.shared.plugins.PluginManager;
 import com.android.systemui.shared.system.WindowManagerWrapper;
 import com.android.systemui.stackdivider.Divider;
-import com.android.systemui.stackdivider.WindowManagerProxy;
 import com.android.systemui.statusbar.BackDropView;
 import com.android.systemui.statusbar.CommandQueue;
 import com.android.systemui.statusbar.CrossFadeHelper;
@@ -356,6 +355,7 @@
     private final KeyguardBypassController mKeyguardBypassController;
     private final KeyguardStateController mKeyguardStateController;
     private final HeadsUpManagerPhone mHeadsUpManager;
+    private final StatusBarTouchableRegionManager mStatusBarTouchableRegionManager;
     private final DynamicPrivacyController mDynamicPrivacyController;
     private final BypassHeadsUpNotifier mBypassHeadsUpNotifier;
     private final FalsingManager mFalsingManager;
@@ -676,7 +676,8 @@
             KeyguardDismissUtil keyguardDismissUtil,
             ExtensionController extensionController,
             UserInfoControllerImpl userInfoControllerImpl,
-            DismissCallbackRegistry dismissCallbackRegistry) {
+            DismissCallbackRegistry dismissCallbackRegistry,
+            StatusBarTouchableRegionManager statusBarTouchableRegionManager) {
         super(context);
         mNotificationsController = notificationsController;
         mLightBarController = lightBarController;
@@ -688,6 +689,7 @@
         mKeyguardBypassController = keyguardBypassController;
         mKeyguardStateController = keyguardStateController;
         mHeadsUpManager = headsUpManagerPhone;
+        mStatusBarTouchableRegionManager = statusBarTouchableRegionManager;
         mDynamicPrivacyController = dynamicPrivacyController;
         mBypassHeadsUpNotifier = bypassHeadsUpNotifier;
         mFalsingManager = falsingManager;
@@ -1031,9 +1033,8 @@
                         CollapsedStatusBarFragment.TAG)
                 .commit();
 
-        mHeadsUpManager.setUp(mNotificationShadeWindowView, mGroupManager, this,
-                mVisualStabilityManager);
-        mConfigurationController.addCallback(mHeadsUpManager);
+        mHeadsUpManager.setup(mVisualStabilityManager);
+        mStatusBarTouchableRegionManager.setup(this, mNotificationShadeWindowView);
         mHeadsUpManager.addListener(this);
         mHeadsUpManager.addListener(mNotificationPanelViewController.getOnHeadsUpChangedListener());
         mHeadsUpManager.addListener(mVisualStabilityManager);
@@ -1410,8 +1411,11 @@
         if (!mRecentsOptional.isPresent()) {
             return false;
         }
-        int dockSide = WindowManagerProxy.getInstance().getDockSide();
-        if (dockSide == WindowManager.DOCKED_INVALID) {
+        Divider divider = null;
+        if (mDividerOptional.isPresent()) {
+            divider = mDividerOptional.get();
+        }
+        if (divider == null || !divider.inSplitMode()) {
             final int navbarPos = WindowManagerWrapper.getInstance().getNavBarPosition(mDisplayId);
             if (navbarPos == NAV_BAR_POS_INVALID) {
                 return false;
@@ -1421,16 +1425,13 @@
                     : SPLIT_SCREEN_CREATE_MODE_TOP_OR_LEFT;
             return mRecentsOptional.get().splitPrimaryTask(createMode, null, metricsDockAction);
         } else {
-            if (mDividerOptional.isPresent()) {
-                Divider divider = mDividerOptional.get();
-                if (divider.isMinimized() && !divider.isHomeStackResizable()) {
-                    // Undocking from the minimized state is not supported
-                    return false;
-                } else {
-                    divider.onUndockingTask();
-                    if (metricsUndockAction != -1) {
-                        mMetricsLogger.action(metricsUndockAction);
-                    }
+            if (divider.isMinimized() && !divider.isHomeStackResizable()) {
+                // Undocking from the minimized state is not supported
+                return false;
+            } else {
+                divider.onUndockingTask();
+                if (metricsUndockAction != -1) {
+                    mMetricsLogger.action(metricsUndockAction);
                 }
             }
         }
@@ -2468,6 +2469,12 @@
             pw.println("  mHeadsUpManager: null");
         }
 
+        if (mStatusBarTouchableRegionManager != null) {
+            mStatusBarTouchableRegionManager.dump(fd, pw, args);
+        } else {
+            pw.println("  mStatusBarTouchableRegionManager: null");
+        }
+
         if (mLightBarController != null) {
             mLightBarController.dump(fd, pw, args);
         }
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarNotificationPresenter.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarNotificationPresenter.java
index 2485513..693cdd2 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarNotificationPresenter.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarNotificationPresenter.java
@@ -209,7 +209,7 @@
             };
 
             mViewHierarchyManager.setUpWithPresenter(this, notifListContainer);
-            mEntryManager.setUpWithPresenter(this, notifListContainer, mHeadsUpManager);
+            mEntryManager.setUpWithPresenter(this);
             mEntryManager.addNotificationEntryListener(notificationEntryListener);
             mEntryManager.addNotificationLifetimeExtender(mHeadsUpManager);
             mEntryManager.addNotificationLifetimeExtender(mGutsManager);
@@ -230,8 +230,6 @@
             onUserSwitched(mLockscreenUserManager.getCurrentUserId());
         });
         Dependency.get(ConfigurationController.class).addCallback(this);
-
-        notificationAlertingManager.setHeadsUpManager(mHeadsUpManager);
     }
 
     @Override
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarTouchableRegionManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarTouchableRegionManager.java
index b8fb6d3..5bab867 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarTouchableRegionManager.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarTouchableRegionManager.java
@@ -17,66 +17,187 @@
 package com.android.systemui.statusbar.phone;
 
 import android.annotation.NonNull;
+import android.content.Context;
+import android.content.res.Resources;
 import android.graphics.Rect;
+import android.graphics.Region;
+import android.util.Log;
+import android.view.DisplayCutout;
+import android.view.Gravity;
 import android.view.View;
 import android.view.ViewTreeObserver;
 import android.view.ViewTreeObserver.OnComputeInternalInsetsListener;
+import android.view.WindowInsets;
 
-import com.android.systemui.Dependency;
+import com.android.systemui.Dumpable;
 import com.android.systemui.R;
+import com.android.systemui.ScreenDecorations;
 import com.android.systemui.bubbles.BubbleController;
 import com.android.systemui.statusbar.policy.ConfigurationController;
 import com.android.systemui.statusbar.policy.ConfigurationController.ConfigurationListener;
+import com.android.systemui.statusbar.policy.OnHeadsUpChangedListener;
+
+import java.io.FileDescriptor;
+import java.io.PrintWriter;
+
+import javax.inject.Inject;
+import javax.inject.Singleton;
 
 /**
- * Manages what parts of the status bar are touchable. Clients are primarily UI that displays in the
- * status bar even though the UI doesn't look like part of the status bar.
+ * Manages what parts of the status bar are touchable. Clients are primarily UI that display in the
+ * status bar even though the UI doesn't look like part of the status bar. Currently this
+ * includes HeadsUpNotifications and Bubbles.
  */
-public final class StatusBarTouchableRegionManager implements
-        OnComputeInternalInsetsListener, ConfigurationListener {
+@Singleton
+public final class StatusBarTouchableRegionManager implements Dumpable {
+    private static final String TAG = "TouchableRegionManager";
 
-    private final BubbleController mBubbleController = Dependency.get(BubbleController.class);
+    private final Context mContext;
     private final HeadsUpManagerPhone mHeadsUpManager;
+    private final NotificationShadeWindowController mNotificationShadeWindowController;
+    private final BubbleController mBubbleController;
+
     private boolean mIsStatusBarExpanded = false;
     private boolean mShouldAdjustInsets = false;
-    private final StatusBar mStatusBar;
-    private final View mNotificationShadeWindowView;
+    private StatusBar mStatusBar;
+    private View mNotificationShadeWindowView;
     private View mNotificationPanelView;
     private boolean mForceCollapsedUntilLayout = false;
-    private final NotificationShadeWindowController mNotificationShadeWindowController;
 
-    public StatusBarTouchableRegionManager(HeadsUpManagerPhone headsUpManager,
-                                           @NonNull StatusBar statusBar,
-                                           @NonNull View notificationShadeWindowView) {
-        mHeadsUpManager = headsUpManager;
-        mStatusBar = statusBar;
-        mNotificationShadeWindowView = notificationShadeWindowView;
-        mNotificationShadeWindowController =
-                Dependency.get(NotificationShadeWindowController.class);
+    private Region mTouchableRegion = new Region();
+    private int mDisplayCutoutTouchableRegionSize;
+    private int mStatusBarHeight;
 
-        mBubbleController.setBubbleStateChangeListener((hasBubbles) -> {
-            updateTouchableRegion();
+    @Inject
+    public StatusBarTouchableRegionManager(
+            Context context,
+            NotificationShadeWindowController notificationShadeWindowController,
+            ConfigurationController configurationController,
+            HeadsUpManagerPhone headsUpManager,
+            BubbleController bubbleController
+    ) {
+        mContext = context;
+        initResources();
+        configurationController.addCallback(new ConfigurationListener() {
+            @Override
+            public void onDensityOrFontScaleChanged() {
+                initResources();
+            }
+
+            @Override
+            public void onOverlayChanged() {
+                initResources();
+            }
         });
 
+        mHeadsUpManager = headsUpManager;
+        mHeadsUpManager.addListener(
+                new OnHeadsUpChangedListener() {
+                    @Override
+                    public void onHeadsUpPinnedModeChanged(boolean hasPinnedNotification) {
+                        if (Log.isLoggable(TAG, Log.WARN)) {
+                            Log.w(TAG, "onHeadsUpPinnedModeChanged");
+                        }
+                        updateTouchableRegion();
+                    }
+                });
+        mHeadsUpManager.addHeadsUpPhoneListener(
+                new HeadsUpManagerPhone.OnHeadsUpPhoneListenerChange() {
+                    @Override
+                    public void onHeadsUpGoingAwayStateChanged(boolean headsUpGoingAway) {
+                        if (!headsUpGoingAway) {
+                            updateTouchableRegionAfterLayout();
+                        } else {
+                            updateTouchableRegion();
+                        }
+                    }
+                });
+
+        mNotificationShadeWindowController = notificationShadeWindowController;
         mNotificationShadeWindowController.setForcePluginOpenListener((forceOpen) -> {
             updateTouchableRegion();
         });
-        Dependency.get(ConfigurationController.class).addCallback(this);
-        if (mNotificationShadeWindowView != null) {
-            mNotificationPanelView = mNotificationShadeWindowView.findViewById(
-                    R.id.notification_panel);
+
+        mBubbleController = bubbleController;
+        mBubbleController.setBubbleStateChangeListener((hasBubbles) -> {
+            updateTouchableRegion();
+        });
+    }
+
+    protected void setup(
+            @NonNull StatusBar statusBar,
+            @NonNull View notificationShadeWindowView) {
+        mStatusBar = statusBar;
+        mNotificationShadeWindowView = notificationShadeWindowView;
+        mNotificationPanelView = mNotificationShadeWindowView.findViewById(R.id.notification_panel);
+    }
+
+    @Override
+    public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
+        pw.println("StatusBarTouchableRegionManager state:");
+        pw.print("  mTouchableRegion=");
+        pw.println(mTouchableRegion);
+    }
+
+    /**
+     * Notify that the status bar panel gets expanded or collapsed.
+     *
+     * @param isExpanded True to notify expanded, false to notify collapsed.
+     */
+    void setPanelExpanded(boolean isExpanded) {
+        if (isExpanded != mIsStatusBarExpanded) {
+            mIsStatusBarExpanded = isExpanded;
+            if (isExpanded) {
+                // make sure our state is sane
+                mForceCollapsedUntilLayout = false;
+            }
+            updateTouchableRegion();
         }
     }
 
     /**
+     * Calculates the touch region needed for heads up notifications, taking into consideration
+     * any existing display cutouts (notch)
+     * @return the heads up notification touch area
+     */
+    Region calculateTouchableRegion() {
+        // Update touchable region for HeadsUp notifications
+        final Region headsUpTouchableRegion = mHeadsUpManager.getTouchableRegion();
+        if (headsUpTouchableRegion != null) {
+            mTouchableRegion.set(headsUpTouchableRegion);
+        } else {
+            // If there aren't any HUNs, update the touch region to the status bar
+            // width/height, potentially adjusting for a display cutout (notch)
+            mTouchableRegion.set(0, 0, mNotificationShadeWindowView.getWidth(),
+                    mStatusBarHeight);
+            updateRegionForNotch(mTouchableRegion);
+        }
+
+        // Update touchable region for bubbles
+        Rect bubbleRect = mBubbleController.getTouchableRegion();
+        if (bubbleRect != null) {
+            mTouchableRegion.union(bubbleRect);
+        }
+        return mTouchableRegion;
+    }
+
+    private void initResources() {
+        Resources resources = mContext.getResources();
+        mDisplayCutoutTouchableRegionSize = resources.getDimensionPixelSize(
+                com.android.internal.R.dimen.display_cutout_touchable_region_size);
+        mStatusBarHeight =
+                resources.getDimensionPixelSize(com.android.internal.R.dimen.status_bar_height);
+    }
+
+    /**
      * Set the touchable portion of the status bar based on what elements are visible.
      */
-    public void updateTouchableRegion() {
+    private void updateTouchableRegion() {
         boolean hasCutoutInset = (mNotificationShadeWindowView != null)
                 && (mNotificationShadeWindowView.getRootWindowInsets() != null)
                 && (mNotificationShadeWindowView.getRootWindowInsets().getDisplayCutout() != null);
-        boolean shouldObserve =
-                mHeadsUpManager.hasPinnedHeadsUp() || mHeadsUpManager.isHeadsUpGoingAway()
+        boolean shouldObserve = mHeadsUpManager.hasPinnedHeadsUp()
+                        || mHeadsUpManager.isHeadsUpGoingAway()
                         || mBubbleController.hasBubbles()
                         || mForceCollapsedUntilLayout
                         || hasCutoutInset
@@ -87,11 +208,11 @@
 
         if (shouldObserve) {
             mNotificationShadeWindowView.getViewTreeObserver()
-                    .addOnComputeInternalInsetsListener(this);
+                    .addOnComputeInternalInsetsListener(mOnComputeInternalInsetsListener);
             mNotificationShadeWindowView.requestLayout();
         } else {
             mNotificationShadeWindowView.getViewTreeObserver()
-                    .removeOnComputeInternalInsetsListener(this);
+                    .removeOnComputeInternalInsetsListener(mOnComputeInternalInsetsListener);
         }
         mShouldAdjustInsets = shouldObserve;
     }
@@ -99,7 +220,7 @@
     /**
      * Calls {@code updateTouchableRegion()} after a layout pass completes.
      */
-    public void updateTouchableRegionAfterLayout() {
+    private void updateTouchableRegionAfterLayout() {
         if (mNotificationPanelView != null) {
             mForceCollapsedUntilLayout = true;
             mNotificationPanelView.addOnLayoutChangeListener(new View.OnLayoutChangeListener() {
@@ -116,34 +237,38 @@
         }
     }
 
-    /**
-     * Notify that the status bar panel gets expanded or collapsed.
-     *
-     * @param isExpanded True to notify expanded, false to notify collapsed.
-     */
-    public void setIsStatusBarExpanded(boolean isExpanded) {
-        if (isExpanded != mIsStatusBarExpanded) {
-            mIsStatusBarExpanded = isExpanded;
-            if (isExpanded) {
-                // make sure our state is sane
-                mForceCollapsedUntilLayout = false;
-            }
-            updateTouchableRegion();
+    private void updateRegionForNotch(Region touchableRegion) {
+        WindowInsets windowInsets = mNotificationShadeWindowView.getRootWindowInsets();
+        if (windowInsets == null) {
+            Log.w(TAG, "StatusBarWindowView is not attached.");
+            return;
         }
-    }
-
-    @Override
-    public void onComputeInternalInsets(ViewTreeObserver.InternalInsetsInfo info) {
-        if (mIsStatusBarExpanded || mStatusBar.isBouncerShowing()) {
-            // The touchable region is always the full area when expanded
+        DisplayCutout cutout = windowInsets.getDisplayCutout();
+        if (cutout == null) {
             return;
         }
 
-        mHeadsUpManager.updateTouchableRegion(info);
-
-        Rect bubbleRect = mBubbleController.getTouchableRegion();
-        if (bubbleRect != null) {
-            info.touchableRegion.union(bubbleRect);
-        }
+        // Expand touchable region such that we also catch touches that just start below the notch
+        // area.
+        Rect bounds = new Rect();
+        ScreenDecorations.DisplayCutoutView.boundsFromDirection(cutout, Gravity.TOP, bounds);
+        bounds.offset(0, mDisplayCutoutTouchableRegionSize);
+        touchableRegion.union(bounds);
     }
+
+    private final OnComputeInternalInsetsListener mOnComputeInternalInsetsListener =
+            new OnComputeInternalInsetsListener() {
+        @Override
+        public void onComputeInternalInsets(ViewTreeObserver.InternalInsetsInfo info) {
+            if (mIsStatusBarExpanded || mStatusBar.isBouncerShowing()) {
+                // The touchable region is always the full area when expanded
+                return;
+            }
+
+            // Update touch insets to include any area needed for touching features that live in
+            // the status bar (ie: heads up notifications or bubbles)
+            info.setTouchableInsets(ViewTreeObserver.InternalInsetsInfo.TOUCHABLE_INSETS_REGION);
+            info.touchableRegion.set(calculateTouchableRegion());
+        }
+    };
 }
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/dagger/StatusBarPhoneModule.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/dagger/StatusBarPhoneModule.java
index 26459a9..e64f821 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/dagger/StatusBarPhoneModule.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/dagger/StatusBarPhoneModule.java
@@ -85,6 +85,7 @@
 import com.android.systemui.statusbar.phone.StatusBarIconController;
 import com.android.systemui.statusbar.phone.StatusBarKeyguardViewManager;
 import com.android.systemui.statusbar.phone.StatusBarNotificationActivityStarter;
+import com.android.systemui.statusbar.phone.StatusBarTouchableRegionManager;
 import com.android.systemui.statusbar.policy.BatteryController;
 import com.android.systemui.statusbar.policy.ConfigurationController;
 import com.android.systemui.statusbar.policy.DeviceProvisionedController;
@@ -192,7 +193,8 @@
             KeyguardDismissUtil keyguardDismissUtil,
             ExtensionController extensionController,
             UserInfoControllerImpl userInfoControllerImpl,
-            DismissCallbackRegistry dismissCallbackRegistry) {
+            DismissCallbackRegistry dismissCallbackRegistry,
+            StatusBarTouchableRegionManager statusBarTouchableRegionManager) {
         return new StatusBar(
                 context,
                 notificationsController,
@@ -267,6 +269,7 @@
                 keyguardDismissUtil,
                 extensionController,
                 userInfoControllerImpl,
-                dismissCallbackRegistry);
+                dismissCallbackRegistry,
+                statusBarTouchableRegionManager);
     }
 }
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/MobileSignalController.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/MobileSignalController.java
index f6e1681..cebcf76 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/MobileSignalController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/MobileSignalController.java
@@ -15,24 +15,18 @@
  */
 package com.android.systemui.statusbar.policy;
 
-import static android.telephony.AccessNetworkConstants.TRANSPORT_TYPE_WWAN;
-import static android.telephony.NetworkRegistrationInfo.DOMAIN_PS;
-
 import android.content.Context;
 import android.content.Intent;
 import android.database.ContentObserver;
 import android.net.NetworkCapabilities;
 import android.os.Handler;
 import android.os.Looper;
-import android.os.Message;
 import android.provider.Settings.Global;
-import android.telephony.AccessNetworkConstants;
 import android.telephony.Annotation;
 import android.telephony.CdmaEriInformation;
 import android.telephony.CellSignalStrength;
 import android.telephony.CellSignalStrengthCdma;
-import android.telephony.DataSpecificRegistrationInfo;
-import android.telephony.NetworkRegistrationInfo;
+import android.telephony.DisplayInfo;
 import android.telephony.PhoneStateListener;
 import android.telephony.ServiceState;
 import android.telephony.SignalStrength;
@@ -60,16 +54,10 @@
 import java.util.Map;
 import java.util.Objects;
 import java.util.concurrent.Executor;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
 
 
 public class MobileSignalController extends SignalController<
         MobileSignalController.MobileState, MobileSignalController.MobileIconGroup> {
-
-    // The message to display Nr5G icon gracfully by CarrierConfig timeout
-    private static final int MSG_DISPLAY_GRACE = 1;
-
     private final TelephonyManager mPhone;
     private final SubscriptionDefaults mDefaults;
     private final String mNetworkNameDefault;
@@ -86,19 +74,15 @@
     // Since some pieces of the phone state are interdependent we store it locally,
     // this could potentially become part of MobileState for simplification/complication
     // of code.
-    private int mDataNetType = TelephonyManager.NETWORK_TYPE_UNKNOWN;
-    private boolean mCA = false;
-    private boolean mCAPlus = false;
     private int mDataState = TelephonyManager.DATA_DISCONNECTED;
+    private DisplayInfo mDisplayInfo = new DisplayInfo(TelephonyManager.NETWORK_TYPE_UNKNOWN,
+            DisplayInfo.OVERRIDE_NETWORK_TYPE_NONE);
     private ServiceState mServiceState;
     private SignalStrength mSignalStrength;
     private MobileIconGroup mDefaultIcons;
     private Config mConfig;
-    private final Handler mDisplayGraceHandler;
     @VisibleForTesting
     boolean mInflateSignalStrengths = false;
-    @VisibleForTesting
-    boolean mIsShowingIconGracefully = false;
 
     // TODO: Reduce number of vars passed in, if we have the NetworkController, probably don't
     // need listener lists anymore.
@@ -136,16 +120,6 @@
                 updateTelephony();
             }
         };
-
-        mDisplayGraceHandler = new Handler(receiverLooper) {
-            @Override
-            public void handleMessage(Message msg) {
-                if (msg.what == MSG_DISPLAY_GRACE) {
-                    mIsShowingIconGracefully = false;
-                    updateTelephony();
-                }
-            }
-        };
     }
 
     public void setConfiguration(Config config) {
@@ -190,7 +164,8 @@
                         | PhoneStateListener.LISTEN_DATA_CONNECTION_STATE
                         | PhoneStateListener.LISTEN_DATA_ACTIVITY
                         | PhoneStateListener.LISTEN_CARRIER_NETWORK_CHANGE
-                        | PhoneStateListener.LISTEN_ACTIVE_DATA_SUBSCRIPTION_ID_CHANGE);
+                        | PhoneStateListener.LISTEN_ACTIVE_DATA_SUBSCRIPTION_ID_CHANGE
+                        | PhoneStateListener.LISTEN_DISPLAY_INFO_CHANGED);
         mContext.getContentResolver().registerContentObserver(Global.getUriFor(Global.MOBILE_DATA),
                 true, mObserver);
         mContext.getContentResolver().registerContentObserver(Global.getUriFor(
@@ -268,52 +243,60 @@
             mNetworkToIconLookup.put(toIconKey(TelephonyManager.NETWORK_TYPE_LTE),
                     TelephonyIcons.FOUR_G);
             if (mConfig.hideLtePlus) {
-                mNetworkToIconLookup.put(toIconKeyCA(TelephonyManager.NETWORK_TYPE_LTE),
-                        TelephonyIcons.FOUR_G);
+                mNetworkToIconLookup.put(toDisplayIconKey(
+                        DisplayInfo.OVERRIDE_NETWORK_TYPE_LTE_CA), TelephonyIcons.FOUR_G);
             } else {
-                mNetworkToIconLookup.put(toIconKeyCA(TelephonyManager.NETWORK_TYPE_LTE),
-                        TelephonyIcons.FOUR_G_PLUS);
+                mNetworkToIconLookup.put(toDisplayIconKey(
+                        DisplayInfo.OVERRIDE_NETWORK_TYPE_LTE_CA), TelephonyIcons.FOUR_G_PLUS);
             }
         } else {
             mNetworkToIconLookup.put(toIconKey(TelephonyManager.NETWORK_TYPE_LTE),
                     TelephonyIcons.LTE);
             if (mConfig.hideLtePlus) {
-                mNetworkToIconLookup.put(toIconKeyCA(TelephonyManager.NETWORK_TYPE_LTE),
-                        TelephonyIcons.LTE);
+                mNetworkToIconLookup.put(toDisplayIconKey(
+                        DisplayInfo.OVERRIDE_NETWORK_TYPE_LTE_CA), TelephonyIcons.LTE);
             } else {
-                mNetworkToIconLookup.put(toIconKeyCA(TelephonyManager.NETWORK_TYPE_LTE),
-                        TelephonyIcons.LTE_PLUS);
+                mNetworkToIconLookup.put(toDisplayIconKey(
+                        DisplayInfo.OVERRIDE_NETWORK_TYPE_LTE_CA), TelephonyIcons.LTE_PLUS);
             }
         }
-        mNetworkToIconLookup.put(toIconKeyCAPlus(TelephonyManager.NETWORK_TYPE_LTE),
-                TelephonyIcons.LTE_CA_5G_E);
         mNetworkToIconLookup.put(toIconKey(TelephonyManager.NETWORK_TYPE_IWLAN),
                 TelephonyIcons.WFC);
+        mNetworkToIconLookup.put(toDisplayIconKey(
+                DisplayInfo.OVERRIDE_NETWORK_TYPE_LTE_ADVANCED_PRO), TelephonyIcons.LTE_CA_5G_E);
+        mNetworkToIconLookup.put(toDisplayIconKey(
+                DisplayInfo.OVERRIDE_NETWORK_TYPE_NR_NSA), TelephonyIcons.NR_5G);
+        mNetworkToIconLookup.put(toDisplayIconKey(
+                DisplayInfo.OVERRIDE_NETWORK_TYPE_NR_NSA_MMWAVE), TelephonyIcons.NR_5G_PLUS);
     }
 
     private String getIconKey() {
-        if (mCA) {
-            return toIconKeyCA(mDataNetType);
-        } else if (mCAPlus) {
-            return toIconKeyCAPlus(mDataNetType);
+        if (mDisplayInfo.getOverrideNetworkType() == DisplayInfo.OVERRIDE_NETWORK_TYPE_NONE) {
+            return toIconKey(mDisplayInfo.getNetworkType());
         } else {
-            return toIconKey(mDataNetType);
+            return toDisplayIconKey(mDisplayInfo.getOverrideNetworkType());
         }
     }
 
-    // Some specific carriers have 5GE network which is special CA network.
-    private String toIconKeyCAPlus(@Annotation.NetworkType int networkType) {
-        return toIconKeyCA(networkType) + "_Plus";
-    }
-
-    private String toIconKeyCA(@Annotation.NetworkType int networkType) {
-        return toIconKey(networkType) + "_CA";
-    }
-
     private String toIconKey(@Annotation.NetworkType int networkType) {
         return Integer.toString(networkType);
     }
 
+    private String toDisplayIconKey(@Annotation.OverrideNetworkType int displayNetworkType) {
+        switch (displayNetworkType) {
+            case DisplayInfo.OVERRIDE_NETWORK_TYPE_LTE_CA:
+                return toIconKey(TelephonyManager.NETWORK_TYPE_LTE) + "_CA";
+            case DisplayInfo.OVERRIDE_NETWORK_TYPE_LTE_ADVANCED_PRO:
+                return toIconKey(TelephonyManager.NETWORK_TYPE_LTE) + "_CA_Plus";
+            case DisplayInfo.OVERRIDE_NETWORK_TYPE_NR_NSA:
+                return "5G";
+            case DisplayInfo.OVERRIDE_NETWORK_TYPE_NR_NSA_MMWAVE:
+                return "5G_Plus";
+            default:
+                return "unsupported";
+        }
+    }
+
     private void updateInflateSignalStrength() {
         mInflateSignalStrengths = SignalStrengthUtil.shouldInflateSignalStrength(mContext,
                 mSubscriptionInfo.getSubscriptionId());
@@ -465,26 +448,6 @@
         }
     }
 
-    private boolean isCarrierSpecificDataIcon() {
-        if (mConfig.patternOfCarrierSpecificDataIcon == null
-                || mConfig.patternOfCarrierSpecificDataIcon.length() == 0) {
-            return false;
-        }
-
-        Pattern stringPattern = Pattern.compile(mConfig.patternOfCarrierSpecificDataIcon);
-        String[] operatorNames = new String[]{mServiceState.getOperatorAlphaLongRaw(),
-                mServiceState.getOperatorAlphaShortRaw()};
-        for (String opName : operatorNames) {
-            if (!TextUtils.isEmpty(opName)) {
-                Matcher matcher = stringPattern.matcher(opName);
-                if (matcher.find()) {
-                    return true;
-                }
-            }
-        }
-        return false;
-    }
-
     /**
      * Updates the network's name based on incoming spn and plmn.
      */
@@ -538,18 +501,18 @@
     }
 
     /**
-     * Updates the current state based on mServiceState, mSignalStrength, mDataNetType,
-     * mDataState, and mSimState.  It should be called any time one of these is updated.
+     * Updates the current state based on mServiceState, mSignalStrength, mDataState,
+     * mDisplayInfo, and mSimState.  It should be called any time one of these is updated.
      * This will call listeners if necessary.
      */
     private final void updateTelephony() {
         if (DEBUG) {
             Log.d(mTag, "updateTelephonySignalStrength: hasService=" +
-                    Utils.isInService(mServiceState) + " ss=" + mSignalStrength);
+                    Utils.isInService(mServiceState) + " ss=" + mSignalStrength
+                    + " displayInfo=" + mDisplayInfo);
         }
         checkDefaultData();
-        mCurrentState.connected = Utils.isInService(mServiceState)
-                && mSignalStrength != null;
+        mCurrentState.connected = Utils.isInService(mServiceState) && mSignalStrength != null;
         if (mCurrentState.connected) {
             if (!mSignalStrength.isGsm() && mConfig.alwaysShowCdmaRssi) {
                 mCurrentState.level = getCdmaLevel();
@@ -558,17 +521,8 @@
             }
         }
 
-        // When the device is camped on a 5G Non-Standalone network, the data network type is still
-        // LTE. In this case, we first check which 5G icon should be shown.
-        MobileIconGroup nr5GIconGroup = getNr5GIconGroup();
-        if (mConfig.nrIconDisplayGracePeriodMs > 0) {
-            nr5GIconGroup = adjustNr5GIconGroupByDisplayGraceTime(nr5GIconGroup);
-        }
-
         String iconKey = getIconKey();
-        if (nr5GIconGroup != null) {
-            mCurrentState.iconGroup = nr5GIconGroup;
-        } else if (mNetworkToIconLookup.get(iconKey) != null) {
+        if (mNetworkToIconLookup.get(iconKey) != null) {
             mCurrentState.iconGroup = mNetworkToIconLookup.get(iconKey);
         } else {
             mCurrentState.iconGroup = mDefaultIcons;
@@ -580,8 +534,7 @@
         if (isCarrierNetworkChangeActive()) {
             mCurrentState.iconGroup = TelephonyIcons.CARRIER_NETWORK_CHANGE;
         } else if (isDataDisabled() && !mConfig.alwaysShowDataRatIcon) {
-            if (mSubscriptionInfo.getSubscriptionId()
-                    != mDefaults.getDefaultDataSubId()) {
+            if (mSubscriptionInfo.getSubscriptionId() != mDefaults.getDefaultDataSubId()) {
                 mCurrentState.iconGroup = TelephonyIcons.NOT_DEFAULT_DATA;
             } else {
                 mCurrentState.iconGroup = TelephonyIcons.DATA_DISABLED;
@@ -623,91 +576,6 @@
         notifyListenersIfNecessary();
     }
 
-    private int getNrState(ServiceState serviceState) {
-        NetworkRegistrationInfo nri = serviceState.getNetworkRegistrationInfo(
-                NetworkRegistrationInfo.DOMAIN_PS, AccessNetworkConstants.TRANSPORT_TYPE_WWAN);
-        if (nri != null) {
-            return nri.getNrState();
-        }
-        return NetworkRegistrationInfo.NR_STATE_NONE;
-    }
-
-    private MobileIconGroup getNr5GIconGroup() {
-        if (mServiceState == null) return null;
-
-        int nrState = getNrState(mServiceState);
-        if (nrState == NetworkRegistrationInfo.NR_STATE_CONNECTED) {
-            // Check if the NR 5G is using millimeter wave and the icon is config.
-            if (mServiceState.getNrFrequencyRange() == ServiceState.FREQUENCY_RANGE_MMWAVE) {
-                if (mConfig.nr5GIconMap.containsKey(Config.NR_CONNECTED_MMWAVE)) {
-                    return mConfig.nr5GIconMap.get(Config.NR_CONNECTED_MMWAVE);
-                }
-            }
-
-            // If NR 5G is not using millimeter wave or there is no icon for millimeter wave, we
-            // check the normal 5G icon.
-            if (mConfig.nr5GIconMap.containsKey(Config.NR_CONNECTED)) {
-                return mConfig.nr5GIconMap.get(Config.NR_CONNECTED);
-            }
-        } else if (nrState == NetworkRegistrationInfo.NR_STATE_NOT_RESTRICTED) {
-            if (mCurrentState.activityDormant) {
-                if (mConfig.nr5GIconMap.containsKey(Config.NR_NOT_RESTRICTED_RRC_IDLE)) {
-                    return mConfig.nr5GIconMap.get(Config.NR_NOT_RESTRICTED_RRC_IDLE);
-                }
-            } else {
-                if (mConfig.nr5GIconMap.containsKey(Config.NR_NOT_RESTRICTED_RRC_CON)) {
-                    return mConfig.nr5GIconMap.get(Config.NR_NOT_RESTRICTED_RRC_CON);
-                }
-            }
-        } else if (nrState == NetworkRegistrationInfo.NR_STATE_RESTRICTED) {
-            if (mConfig.nr5GIconMap.containsKey(Config.NR_RESTRICTED)) {
-                return mConfig.nr5GIconMap.get(Config.NR_RESTRICTED);
-            }
-        }
-
-        return null;
-    }
-
-    /**
-     * The function to adjust MobileIconGroup depend on CarrierConfig's time
-     * nextIconGroup == null imply next state could be 2G/3G/4G/4G+
-     * nextIconGroup != null imply next state will be 5G/5G+
-     * Flag : mIsShowingIconGracefully
-     * ---------------------------------------------------------------------------------
-     * |   Last state   |  Current state  | Flag |       Action                        |
-     * ---------------------------------------------------------------------------------
-     * |     5G/5G+     | 2G/3G/4G/4G+    | true | return previous IconGroup           |
-     * |     5G/5G+     |     5G/5G+      | true | Bypass                              |
-     * |  2G/3G/4G/4G+  |     5G/5G+      | true | Bypass                              |
-     * |  2G/3G/4G/4G+  | 2G/3G/4G/4G+    | true | Bypass                              |
-     * |  SS.connected  | SS.disconnect   |  T|F | Reset timer                         |
-     * |NETWORK_TYPE_LTE|!NETWORK_TYPE_LTE|  T|F | Reset timer                         |
-     * |     5G/5G+     | 2G/3G/4G/4G+    | false| Bypass                              |
-     * |     5G/5G+     |     5G/5G+      | false| Bypass                              |
-     * |  2G/3G/4G/4G+  |     5G/5G+      | false| SendMessageDelay(time), flag->true  |
-     * |  2G/3G/4G/4G+  | 2G/3G/4G/4G+    | false| Bypass                              |
-     * ---------------------------------------------------------------------------------
-     */
-    private MobileIconGroup adjustNr5GIconGroupByDisplayGraceTime(
-            MobileIconGroup candidateIconGroup) {
-        if (mIsShowingIconGracefully && candidateIconGroup == null) {
-            candidateIconGroup = (MobileIconGroup) mCurrentState.iconGroup;
-        } else if (!mIsShowingIconGracefully && candidateIconGroup != null
-                && mLastState.iconGroup != candidateIconGroup) {
-            mDisplayGraceHandler.sendMessageDelayed(
-                    mDisplayGraceHandler.obtainMessage(MSG_DISPLAY_GRACE),
-                    mConfig.nrIconDisplayGracePeriodMs);
-            mIsShowingIconGracefully = true;
-        } else if (!mCurrentState.connected || mDataState == TelephonyManager.DATA_DISCONNECTED
-                || candidateIconGroup == null) {
-            mDisplayGraceHandler.removeMessages(MSG_DISPLAY_GRACE);
-            mIsShowingIconGracefully = false;
-            candidateIconGroup = null;
-        }
-
-        return candidateIconGroup;
-    }
-
     boolean isDataDisabled() {
         return !mPhone.isDataConnectionEnabled();
     }
@@ -718,8 +586,6 @@
                 || activity == TelephonyManager.DATA_ACTIVITY_IN;
         mCurrentState.activityOut = activity == TelephonyManager.DATA_ACTIVITY_INOUT
                 || activity == TelephonyManager.DATA_ACTIVITY_OUT;
-        mCurrentState.activityDormant = activity == TelephonyManager.DATA_ACTIVITY_DORMANT;
-
         notifyListenersIfNecessary();
     }
 
@@ -729,13 +595,10 @@
         pw.println("  mSubscription=" + mSubscriptionInfo + ",");
         pw.println("  mServiceState=" + mServiceState + ",");
         pw.println("  mSignalStrength=" + mSignalStrength + ",");
+        pw.println("  mDisplayInfo=" + mDisplayInfo + ",");
         pw.println("  mDataState=" + mDataState + ",");
-        pw.println("  mDataNetType=" + mDataNetType + ",");
-        pw.println("  mCA=" + mCA + ",");
-        pw.println("  mCAPlus=" + mCAPlus + ",");
         pw.println("  mInflateSignalStrengths=" + mInflateSignalStrengths + ",");
         pw.println("  isDataDisabled=" + isDataDisabled() + ",");
-        pw.println("  mIsShowingIconGracefully=" + mIsShowingIconGracefully + ",");
     }
 
     class MobilePhoneStateListener extends PhoneStateListener {
@@ -760,14 +623,8 @@
                         + " dataState=" + state.getDataRegistrationState());
             }
             mServiceState = state;
-            if (mServiceState != null) {
-                NetworkRegistrationInfo regInfo = mServiceState.getNetworkRegistrationInfo(
-                        DOMAIN_PS, TRANSPORT_TYPE_WWAN);
-                if (regInfo != null) {
-                    updateDataNetType(regInfo.getAccessNetworkTechnology());
-                }
-            }
-            updateTelephony();
+            // onDisplayInfoChanged is invoked directly after onServiceStateChanged, so not calling
+            // updateTelephony() to prevent icon flickering in case of overrides.
         }
 
         @Override
@@ -777,35 +634,12 @@
                         + " type=" + networkType);
             }
             mDataState = state;
-            updateDataNetType(networkType);
+            if (networkType != mDisplayInfo.getNetworkType()) {
+                mDisplayInfo = new DisplayInfo(networkType, DisplayInfo.OVERRIDE_NETWORK_TYPE_NONE);
+            }
             updateTelephony();
         }
 
-        private void updateDataNetType(int networkType) {
-            mDataNetType = networkType;
-            mCA = false;
-            mCAPlus = false;
-            if (mDataNetType == TelephonyManager.NETWORK_TYPE_LTE) {
-                if (isCarrierSpecificDataIcon()) {
-                    mCAPlus = true;
-                } else if (mServiceState != null && isUsingCarrierAggregation(mServiceState)) {
-                    mCA = true;
-                }
-            }
-        }
-
-        private boolean isUsingCarrierAggregation(ServiceState serviceState) {
-            NetworkRegistrationInfo nri = serviceState.getNetworkRegistrationInfo(
-                    NetworkRegistrationInfo.DOMAIN_PS, AccessNetworkConstants.TRANSPORT_TYPE_WWAN);
-            if (nri != null) {
-                DataSpecificRegistrationInfo dsri = nri.getDataSpecificInfo();
-                if (dsri != null) {
-                    return dsri.isUsingCarrierAggregation();
-                }
-            }
-            return false;
-        }
-
         @Override
         public void onDataActivity(int direction) {
             if (DEBUG) {
@@ -820,7 +654,6 @@
                 Log.d(mTag, "onCarrierNetworkChange: active=" + active);
             }
             mCurrentState.carrierNetworkChangeMode = active;
-
             updateTelephony();
         }
 
@@ -830,7 +663,16 @@
             updateDataSim();
             updateTelephony();
         }
-    };
+
+        @Override
+        public void onDisplayInfoChanged(DisplayInfo displayInfo) {
+            if (DEBUG) {
+                Log.d(mTag, "onDisplayInfoChanged: displayInfo=" + displayInfo);
+            }
+            mDisplayInfo = displayInfo;
+            updateTelephony();
+        }
+    }
 
     static class MobileIconGroup extends SignalController.IconGroup {
         final int mDataContentDescription; // mContentDescriptionDataType
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 4f382e7..9003de1 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java
@@ -49,7 +49,6 @@
 import android.telephony.SubscriptionManager.OnSubscriptionsChangedListener;
 import android.telephony.TelephonyManager;
 import android.text.TextUtils;
-import android.text.format.DateUtils;
 import android.util.Log;
 import android.util.MathUtils;
 import android.util.SparseArray;
@@ -64,7 +63,6 @@
 import com.android.systemui.dagger.qualifiers.Background;
 import com.android.systemui.settings.CurrentUserTracker;
 import com.android.systemui.statusbar.policy.DeviceProvisionedController.DeviceProvisionedListener;
-import com.android.systemui.statusbar.policy.MobileSignalController.MobileIconGroup;
 
 import java.io.FileDescriptor;
 import java.io.PrintWriter;
@@ -72,10 +70,8 @@
 import java.util.BitSet;
 import java.util.Collections;
 import java.util.Comparator;
-import java.util.HashMap;
 import java.util.List;
 import java.util.Locale;
-import java.util.Map;
 
 import javax.inject.Inject;
 import javax.inject.Singleton;
@@ -846,12 +842,6 @@
         pw.println(emergencyToString(mEmergencySource));
 
         pw.println("  - config ------");
-        pw.print("  patternOfCarrierSpecificDataIcon=");
-        pw.println(mConfig.patternOfCarrierSpecificDataIcon);
-        pw.print("  nr5GIconMap=");
-        pw.println(mConfig.nr5GIconMap.toString());
-        pw.print("  nrIconDisplayGracePeriodMs=");
-        pw.println(mConfig.nrIconDisplayGracePeriodMs);
         for (int i = 0; i < mMobileSignalControllers.size(); i++) {
             MobileSignalController mobileSignalController = mMobileSignalControllers.valueAt(i);
             mobileSignalController.dump(pw);
@@ -1132,14 +1122,6 @@
 
     @VisibleForTesting
     static class Config {
-        static final int NR_CONNECTED_MMWAVE = 1;
-        static final int NR_CONNECTED = 2;
-        static final int NR_NOT_RESTRICTED_RRC_IDLE = 3;
-        static final int NR_NOT_RESTRICTED_RRC_CON = 4;
-        static final int NR_RESTRICTED = 5;
-
-        Map<Integer, MobileIconGroup> nr5GIconMap = new HashMap<>();
-
         boolean showAtLeast3G = false;
         boolean show4gFor3g = false;
         boolean alwaysShowCdmaRssi = false;
@@ -1148,22 +1130,6 @@
         boolean hspaDataDistinguishable;
         boolean inflateSignalStrengths = false;
         boolean alwaysShowDataRatIcon = false;
-        public String patternOfCarrierSpecificDataIcon = "";
-        public long nrIconDisplayGracePeriodMs;
-
-        /**
-         * Mapping from NR 5G status string to an integer. The NR 5G status string should match
-         * those in carrier config.
-         */
-        private static final Map<String, Integer> NR_STATUS_STRING_TO_INDEX;
-        static {
-            NR_STATUS_STRING_TO_INDEX = new HashMap<>(5);
-            NR_STATUS_STRING_TO_INDEX.put("connected_mmwave", NR_CONNECTED_MMWAVE);
-            NR_STATUS_STRING_TO_INDEX.put("connected", NR_CONNECTED);
-            NR_STATUS_STRING_TO_INDEX.put("not_restricted_rrc_idle", NR_NOT_RESTRICTED_RRC_IDLE);
-            NR_STATUS_STRING_TO_INDEX.put("not_restricted_rrc_con", NR_NOT_RESTRICTED_RRC_CON);
-            NR_STATUS_STRING_TO_INDEX.put("restricted", NR_RESTRICTED);
-        }
 
         static Config readConfig(Context context) {
             Config config = new Config();
@@ -1192,64 +1158,9 @@
                         CarrierConfigManager.KEY_SHOW_4G_FOR_3G_DATA_ICON_BOOL);
                 config.hideLtePlus = b.getBoolean(
                         CarrierConfigManager.KEY_HIDE_LTE_PLUS_DATA_ICON_BOOL);
-                config.patternOfCarrierSpecificDataIcon = b.getString(
-                        CarrierConfigManager.KEY_SHOW_CARRIER_DATA_ICON_PATTERN_STRING);
-                String nr5GIconConfiguration =
-                        b.getString(CarrierConfigManager.KEY_5G_ICON_CONFIGURATION_STRING);
-                if (!TextUtils.isEmpty(nr5GIconConfiguration)) {
-                    String[] nr5GIconConfigPairs = nr5GIconConfiguration.trim().split(",");
-                    for (String pair : nr5GIconConfigPairs) {
-                        add5GIconMapping(pair, config);
-                    }
-                }
-                setDisplayGraceTime(
-                        b.getInt(CarrierConfigManager.KEY_5G_ICON_DISPLAY_GRACE_PERIOD_SEC_INT),
-                        config);
             }
 
             return config;
         }
-
-        /**
-         * Add a mapping from NR 5G status to the 5G icon. All the icon resources come from
-         * {@link TelephonyIcons}.
-         *
-         * @param keyValuePair the NR 5G status and icon name separated by a colon.
-         * @param config container that used to store the parsed configs.
-         */
-        @VisibleForTesting
-        static void add5GIconMapping(String keyValuePair, Config config) {
-            String[] kv = (keyValuePair.trim().toLowerCase()).split(":");
-
-            if (kv.length != 2) {
-                if (DEBUG) Log.e(TAG, "Invalid 5G icon configuration, config = " + keyValuePair);
-                return;
-            }
-
-            String key = kv[0], value = kv[1];
-
-            // There is no icon config for the specific 5G status.
-            if (value.equals("none")) return;
-
-            if (NR_STATUS_STRING_TO_INDEX.containsKey(key)
-                    && TelephonyIcons.ICON_NAME_TO_ICON.containsKey(value)) {
-                config.nr5GIconMap.put(
-                        NR_STATUS_STRING_TO_INDEX.get(key),
-                        TelephonyIcons.ICON_NAME_TO_ICON.get(value));
-            }
-        }
-
-        /**
-         * Set display gracefully period time(MS) depend on carrierConfig KEY
-         * KEY_5G_ICON_DISPLAY_GRACE_PERIOD_SEC_INT, and this function will convert to ms.
-         * {@link CarrierConfigManager}.
-         *
-         * @param time   showing 5G icon gracefully in the period of the time(SECOND)
-         * @param config container that used to store the parsed configs.
-         */
-        @VisibleForTesting
-        static void setDisplayGraceTime(int time, Config config) {
-            config.nrIconDisplayGracePeriodMs = time * DateUtils.SECOND_IN_MILLIS;
-        }
     }
 }
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/SignalController.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/SignalController.java
index 749b56c..3a45691 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/SignalController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/SignalController.java
@@ -261,7 +261,6 @@
         boolean enabled;
         boolean activityIn;
         boolean activityOut;
-        public boolean activityDormant;
         int level;
         IconGroup iconGroup;
         int inetCondition;
@@ -278,7 +277,6 @@
             inetCondition = state.inetCondition;
             activityIn = state.activityIn;
             activityOut = state.activityOut;
-            activityDormant = state.activityDormant;
             rssi = state.rssi;
             time = state.time;
         }
@@ -302,7 +300,6 @@
                     .append("iconGroup=").append(iconGroup).append(',')
                     .append("activityIn=").append(activityIn).append(',')
                     .append("activityOut=").append(activityOut).append(',')
-                    .append("activityDormant=").append(activityDormant).append(',')
                     .append("rssi=").append(rssi).append(',')
                     .append("lastModified=").append(sSDF.format(time));
         }
@@ -320,7 +317,6 @@
                     && other.iconGroup == iconGroup
                     && other.activityIn == activityIn
                     && other.activityOut == activityOut
-                    && other.activityDormant == activityDormant
                     && other.rssi == rssi;
         }
     }
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/tv/TvStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/tv/TvStatusBar.java
index 39de0f3..241d978 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/tv/TvStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/tv/TvStatusBar.java
@@ -17,8 +17,12 @@
 package com.android.systemui.statusbar.tv;
 
 import android.content.Context;
+import android.content.Intent;
+import android.content.pm.PackageManager;
+import android.content.pm.ResolveInfo;
 import android.os.RemoteException;
 import android.os.ServiceManager;
+import android.os.UserHandle;
 
 import com.android.internal.statusbar.IStatusBarService;
 import com.android.systemui.SystemUI;
@@ -40,6 +44,9 @@
 @Singleton
 public class TvStatusBar extends SystemUI implements CommandQueue.Callbacks {
 
+    private static final String ACTION_OPEN_TV_NOTIFICATIONS_PANEL =
+            "com.android.tv.action.OPEN_NOTIFICATIONS_PANEL";
+
     private final CommandQueue mCommandQueue;
 
     @Inject
@@ -61,4 +68,23 @@
 
         new AudioRecordingDisclosureBar(mContext).start();
     }
+
+    @Override
+    public void animateExpandNotificationsPanel() {
+        startSystemActivity(new Intent(ACTION_OPEN_TV_NOTIFICATIONS_PANEL));
+    }
+
+    @Override
+    public void animateCollapsePanels(int flags, boolean force) {
+        startSystemActivity(new Intent(Intent.ACTION_MAIN).addCategory(Intent.CATEGORY_HOME));
+    }
+
+    private void startSystemActivity(Intent intent) {
+        PackageManager pm = mContext.getPackageManager();
+        ResolveInfo ri = pm.resolveActivity(intent, PackageManager.MATCH_SYSTEM_ONLY);
+        if (ri != null && ri.activityInfo != null) {
+            intent.setPackage(ri.activityInfo.packageName);
+            mContext.startActivityAsUser(intent, UserHandle.CURRENT);
+        }
+    }
 }
diff --git a/packages/SystemUI/src/com/android/systemui/usb/UsbResolverActivity.java b/packages/SystemUI/src/com/android/systemui/usb/UsbResolverActivity.java
index 2e30d32..0aa965b 100644
--- a/packages/SystemUI/src/com/android/systemui/usb/UsbResolverActivity.java
+++ b/packages/SystemUI/src/com/android/systemui/usb/UsbResolverActivity.java
@@ -190,4 +190,9 @@
         }
         return true;
     }
+
+    @Override
+    protected boolean shouldShowTabs() {
+        return false;
+    }
 }
diff --git a/packages/SystemUI/src/com/android/systemui/util/Assert.java b/packages/SystemUI/src/com/android/systemui/util/Assert.java
index f6e921e..3f05657 100644
--- a/packages/SystemUI/src/com/android/systemui/util/Assert.java
+++ b/packages/SystemUI/src/com/android/systemui/util/Assert.java
@@ -24,12 +24,17 @@
  * Helper providing common assertions.
  */
 public class Assert {
+    private static final Looper sMainLooper = Looper.getMainLooper();
+    private static Looper sTestLooper = null;
 
     @VisibleForTesting
-    public static Looper sMainLooper = Looper.getMainLooper();
+    public static void setTestableLooper(Looper testLooper) {
+        sTestLooper = testLooper;
+    }
 
     public static void isMainThread() {
-        if (!sMainLooper.isCurrentThread()) {
+        if (!sMainLooper.isCurrentThread()
+                && (sTestLooper == null || !sTestLooper.isCurrentThread())) {
             throw new IllegalStateException("should be called from the main thread."
                     + " sMainLooper.threadName=" + sMainLooper.getThread().getName()
                     + " Thread.currentThread()=" + Thread.currentThread().getName());
@@ -37,7 +42,8 @@
     }
 
     public static void isNotMainThread() {
-        if (sMainLooper.isCurrentThread()) {
+        if (sMainLooper.isCurrentThread()
+                && (sTestLooper == null || sTestLooper.isCurrentThread())) {
             throw new IllegalStateException("should not be called from the main thread.");
         }
     }
diff --git a/packages/SystemUI/src/com/android/systemui/util/FloatingContentCoordinator.kt b/packages/SystemUI/src/com/android/systemui/util/FloatingContentCoordinator.kt
index 0487ce6..ca4b67d 100644
--- a/packages/SystemUI/src/com/android/systemui/util/FloatingContentCoordinator.kt
+++ b/packages/SystemUI/src/com/android/systemui/util/FloatingContentCoordinator.kt
@@ -132,7 +132,6 @@
      *
      * @param content The content that has moved.
      */
-    @JvmOverloads
     fun onContentMoved(content: FloatingContent) {
 
         // Ignore calls when we are currently resolving conflicts, since those calls are from
diff --git a/packages/SystemUI/src/com/android/systemui/wm/DisplayController.java b/packages/SystemUI/src/com/android/systemui/wm/DisplayController.java
index bc24ad0..c66f07d 100644
--- a/packages/SystemUI/src/com/android/systemui/wm/DisplayController.java
+++ b/packages/SystemUI/src/com/android/systemui/wm/DisplayController.java
@@ -101,6 +101,11 @@
                                 return;
                             }
                             Display display = getDisplay(displayId);
+                            if (display == null) {
+                                Slog.w(TAG, "Skipping Display Configuration change on invalid"
+                                        + " display. It may have been removed.");
+                                return;
+                            }
                             Context perDisplayContext = mContext;
                             if (displayId != Display.DEFAULT_DISPLAY) {
                                 perDisplayContext = mContext.createDisplayContext(display);
diff --git a/packages/SystemUI/src/com/android/systemui/wm/DisplayImeController.java b/packages/SystemUI/src/com/android/systemui/wm/DisplayImeController.java
index 7dad05d..1b62cbf 100644
--- a/packages/SystemUI/src/com/android/systemui/wm/DisplayImeController.java
+++ b/packages/SystemUI/src/com/android/systemui/wm/DisplayImeController.java
@@ -34,6 +34,7 @@
 import android.view.animation.Interpolator;
 import android.view.animation.PathInterpolator;
 
+import com.android.systemui.TransactionPool;
 import com.android.systemui.dagger.qualifiers.Main;
 
 import java.util.ArrayList;
@@ -48,8 +49,8 @@
 public class DisplayImeController implements DisplayController.OnDisplaysChangedListener {
     private static final String TAG = "DisplayImeController";
 
-    static final int ANIMATION_DURATION_SHOW_MS = 275;
-    static final int ANIMATION_DURATION_HIDE_MS = 340;
+    public static final int ANIMATION_DURATION_SHOW_MS = 275;
+    public static final int ANIMATION_DURATION_HIDE_MS = 340;
     static final Interpolator INTERPOLATOR = new PathInterpolator(0.4f, 0f, 0.2f, 1f);
     private static final int DIRECTION_NONE = 0;
     private static final int DIRECTION_SHOW = 1;
@@ -57,6 +58,7 @@
 
     SystemWindows mSystemWindows;
     final Handler mHandler;
+    final TransactionPool mTransactionPool;
 
     final SparseArray<PerDisplay> mImePerDisplay = new SparseArray<>();
 
@@ -64,9 +66,10 @@
 
     @Inject
     public DisplayImeController(SystemWindows syswin, DisplayController displayController,
-            @Main Handler mainHandler) {
+            @Main Handler mainHandler, TransactionPool transactionPool) {
         mHandler = mainHandler;
         mSystemWindows = syswin;
+        mTransactionPool = transactionPool;
         displayController.addDisplayWindowListener(this);
     }
 
@@ -255,18 +258,18 @@
                         show ? ANIMATION_DURATION_SHOW_MS : ANIMATION_DURATION_HIDE_MS);
 
                 mAnimation.addUpdateListener(animation -> {
-                    SurfaceControl.Transaction t = new SurfaceControl.Transaction();
+                    SurfaceControl.Transaction t = mTransactionPool.acquire();
                     float value = (float) animation.getAnimatedValue();
                     t.setPosition(mImeSourceControl.getLeash(), x, value);
                     dispatchPositionChanged(mDisplayId, imeTop(imeSource, value), t);
                     t.apply();
-                    t.close();
+                    mTransactionPool.release(t);
                 });
                 mAnimation.setInterpolator(INTERPOLATOR);
                 mAnimation.addListener(new AnimatorListenerAdapter() {
                     @Override
                     public void onAnimationStart(Animator animation) {
-                        SurfaceControl.Transaction t = new SurfaceControl.Transaction();
+                        SurfaceControl.Transaction t = mTransactionPool.acquire();
                         t.setPosition(mImeSourceControl.getLeash(), x, startY);
                         dispatchStartPositioning(mDisplayId, imeTop(imeSource, startY),
                                 imeTop(imeSource, endY), mAnimationDirection == DIRECTION_SHOW,
@@ -275,11 +278,11 @@
                             t.show(mImeSourceControl.getLeash());
                         }
                         t.apply();
-                        t.close();
+                        mTransactionPool.release(t);
                     }
                     @Override
                     public void onAnimationEnd(Animator animation) {
-                        SurfaceControl.Transaction t = new SurfaceControl.Transaction();
+                        SurfaceControl.Transaction t = mTransactionPool.acquire();
                         t.setPosition(mImeSourceControl.getLeash(), x, endY);
                         dispatchEndPositioning(mDisplayId, imeTop(imeSource, endY),
                                 mAnimationDirection == DIRECTION_SHOW, t);
@@ -287,7 +290,7 @@
                             t.hide(mImeSourceControl.getLeash());
                         }
                         t.apply();
-                        t.close();
+                        mTransactionPool.release(t);
 
                         mAnimationDirection = DIRECTION_NONE;
                         mAnimation = null;
diff --git a/packages/SystemUI/src/com/android/systemui/wm/DisplayLayout.java b/packages/SystemUI/src/com/android/systemui/wm/DisplayLayout.java
index 64b0b66..4652abf 100644
--- a/packages/SystemUI/src/com/android/systemui/wm/DisplayLayout.java
+++ b/packages/SystemUI/src/com/android/systemui/wm/DisplayLayout.java
@@ -35,6 +35,7 @@
 import android.graphics.Rect;
 import android.os.SystemProperties;
 import android.provider.Settings;
+import android.util.DisplayMetrics;
 import android.util.RotationUtils;
 import android.util.Size;
 import android.view.Display;
@@ -191,6 +192,11 @@
         return mDensityDpi;
     }
 
+    /** Get the density scale for the display. */
+    public float density() {
+        return mDensityDpi * DisplayMetrics.DENSITY_DEFAULT_SCALE;
+    }
+
     /** Get whether this layout is landscape. */
     public boolean isLandscape() {
         return mWidth > mHeight;
diff --git a/packages/SystemUI/src/com/android/systemui/wm/SystemWindows.java b/packages/SystemUI/src/com/android/systemui/wm/SystemWindows.java
index 044a2a6..23df991 100644
--- a/packages/SystemUI/src/com/android/systemui/wm/SystemWindows.java
+++ b/packages/SystemUI/src/com/android/systemui/wm/SystemWindows.java
@@ -162,6 +162,23 @@
         return pd.getWindow(windowType);
     }
 
+    /**
+     * Gets the SurfaceControl associated with a root view. This is the same surface that backs the
+     * ViewRootImpl.
+     */
+    public SurfaceControl getViewSurface(View rootView) {
+        for (int i = 0; i < mPerDisplay.size(); ++i) {
+            for (int iWm = 0; iWm < mPerDisplay.valueAt(i).mWwms.size(); ++iWm) {
+                SurfaceControl out =
+                        mPerDisplay.valueAt(i).mWwms.get(iWm).getSurfaceControlForWindow(rootView);
+                if (out != null) {
+                    return out;
+                }
+            }
+        }
+        return null;
+    }
+
     private class PerDisplay {
         final int mDisplayId;
         private final SparseArray<SysUiWindowManager> mWwms = new SparseArray<>();
@@ -256,6 +273,10 @@
         void updateConfiguration(Configuration configuration) {
             setConfiguration(configuration);
         }
+
+        SurfaceControl getSurfaceControlForWindow(View rootView) {
+            return getSurfaceControl(rootView);
+        }
     }
 
     class ContainerWindow extends IWindow.Stub {
diff --git a/packages/SystemUI/tests/src/com/android/keyguard/KeyguardPresentationTest.java b/packages/SystemUI/tests/src/com/android/keyguard/KeyguardPresentationTest.java
index 082782d..b6ca8d8e 100644
--- a/packages/SystemUI/tests/src/com/android/keyguard/KeyguardPresentationTest.java
+++ b/packages/SystemUI/tests/src/com/android/keyguard/KeyguardPresentationTest.java
@@ -37,7 +37,7 @@
     @Test
     public void testInflation_doesntCrash() {
         mDependency.injectMockDependency(KeyguardUpdateMonitor.class);
-        com.android.systemui.util.Assert.sMainLooper = TestableLooper.get(this).getLooper();
+        allowTestableLooperAsMainThread();
         InjectionInflationController inflationController = new InjectionInflationController(
                 SystemUIFactory.getInstance().getRootComponent());
         Context context = getContext();
diff --git a/packages/SystemUI/tests/src/com/android/keyguard/KeyguardSliceViewTest.java b/packages/SystemUI/tests/src/com/android/keyguard/KeyguardSliceViewTest.java
index 116f8fc..462b042 100644
--- a/packages/SystemUI/tests/src/com/android/keyguard/KeyguardSliceViewTest.java
+++ b/packages/SystemUI/tests/src/com/android/keyguard/KeyguardSliceViewTest.java
@@ -19,7 +19,6 @@
 import android.net.Uri;
 import android.test.suitebuilder.annotation.SmallTest;
 import android.testing.AndroidTestingRunner;
-import android.testing.TestableLooper;
 import android.testing.TestableLooper.RunWithLooper;
 import android.view.LayoutInflater;
 
@@ -51,7 +50,7 @@
 
     @Before
     public void setUp() throws Exception {
-        com.android.systemui.util.Assert.sMainLooper = TestableLooper.get(this).getLooper();
+        allowTestableLooperAsMainThread();
         InjectionInflationController inflationController = new InjectionInflationController(
                 SystemUIFactory.getInstance().getRootComponent());
         LayoutInflater layoutInflater = inflationController
diff --git a/packages/SystemUI/tests/src/com/android/keyguard/KeyguardStatusViewTest.java b/packages/SystemUI/tests/src/com/android/keyguard/KeyguardStatusViewTest.java
index e4b83cc..bc3c3d9 100644
--- a/packages/SystemUI/tests/src/com/android/keyguard/KeyguardStatusViewTest.java
+++ b/packages/SystemUI/tests/src/com/android/keyguard/KeyguardStatusViewTest.java
@@ -20,14 +20,12 @@
 
 import android.test.suitebuilder.annotation.SmallTest;
 import android.testing.AndroidTestingRunner;
-import android.testing.TestableLooper;
 import android.testing.TestableLooper.RunWithLooper;
 import android.view.LayoutInflater;
 
 import com.android.systemui.R;
 import com.android.systemui.SystemUIFactory;
 import com.android.systemui.SysuiTestCase;
-import com.android.systemui.util.Assert;
 import com.android.systemui.util.InjectionInflationController;
 
 import org.junit.Before;
@@ -50,7 +48,7 @@
 
     @Before
     public void setUp() {
-        Assert.sMainLooper = TestableLooper.get(this).getLooper();
+        allowTestableLooperAsMainThread();
         mDependency.injectMockDependency(KeyguardUpdateMonitor.class);
         InjectionInflationController inflationController = new InjectionInflationController(
                 SystemUIFactory.getInstance().getRootComponent());
diff --git a/packages/SystemUI/tests/src/com/android/keyguard/KeyguardUpdateMonitorTest.java b/packages/SystemUI/tests/src/com/android/keyguard/KeyguardUpdateMonitorTest.java
index 7e4ba92..befe3e1 100644
--- a/packages/SystemUI/tests/src/com/android/keyguard/KeyguardUpdateMonitorTest.java
+++ b/packages/SystemUI/tests/src/com/android/keyguard/KeyguardUpdateMonitorTest.java
@@ -147,6 +147,7 @@
         context.addMockSystemService(SubscriptionManager.class, mSubscriptionManager);
 
         mTestableLooper = TestableLooper.get(this);
+        allowTestableLooperAsMainThread();
         mKeyguardUpdateMonitor = new TestableKeyguardUpdateMonitor(context);
     }
 
diff --git a/packages/SystemUI/tests/src/com/android/systemui/ExpandHelperTest.java b/packages/SystemUI/tests/src/com/android/systemui/ExpandHelperTest.java
index ffe8c28..471149c 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/ExpandHelperTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/ExpandHelperTest.java
@@ -23,7 +23,6 @@
 import android.animation.ObjectAnimator;
 import android.content.Context;
 import android.testing.AndroidTestingRunner;
-import android.testing.TestableLooper;
 import android.testing.TestableLooper.RunWithLooper;
 
 import androidx.test.annotation.UiThreadTest;
@@ -33,7 +32,6 @@
 import com.android.systemui.statusbar.NotificationMediaManager;
 import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow;
 import com.android.systemui.statusbar.notification.row.NotificationTestHelper;
-import com.android.systemui.util.Assert;
 
 import org.junit.Before;
 import org.junit.Test;
@@ -52,7 +50,7 @@
     public void setUp() throws Exception {
         mDependency.injectMockDependency(KeyguardUpdateMonitor.class);
         mDependency.injectMockDependency(NotificationMediaManager.class);
-        Assert.sMainLooper = TestableLooper.get(this).getLooper();
+        allowTestableLooperAsMainThread();
         Context context = getContext();
         mRow = new NotificationTestHelper(context, mDependency).createRow();
         mCallback = mock(ExpandHelper.Callback.class);
diff --git a/packages/SystemUI/tests/src/com/android/systemui/ForegroundServiceControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/ForegroundServiceControllerTest.java
index 8d11b54..c912b67 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/ForegroundServiceControllerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/ForegroundServiceControllerTest.java
@@ -35,7 +35,6 @@
 import android.app.NotificationManager;
 import android.os.Bundle;
 import android.os.Handler;
-import android.os.Looper;
 import android.os.UserHandle;
 import android.service.notification.StatusBarNotification;
 import android.testing.AndroidTestingRunner;
@@ -75,8 +74,8 @@
 
     @Before
     public void setUp() throws Exception {
-        // assume the TestLooper is the main looper for these tests
-        com.android.systemui.util.Assert.sMainLooper = TestableLooper.get(this).getLooper();
+        // allow the TestLooper to be asserted as the main thread these tests
+        allowTestableLooperAsMainThread();
 
         MockitoAnnotations.initMocks(this);
         mFsc = new ForegroundServiceController(mEntryManager, mAppOpsController, mMainHandler);
@@ -93,7 +92,7 @@
     public void testAppOpsChangedCalledFromBgThread() {
         try {
             // WHEN onAppOpChanged is called from a different thread than the MainLooper
-            com.android.systemui.util.Assert.sMainLooper = Looper.getMainLooper();
+            disallowTestableLooperAsMainThread();
             NotificationEntry entry = createFgEntry();
             mFsc.onAppOpChanged(
                     AppOpsManager.OP_CAMERA,
diff --git a/packages/SystemUI/tests/src/com/android/systemui/ImageWallpaperTest.java b/packages/SystemUI/tests/src/com/android/systemui/ImageWallpaperTest.java
index fc331d6..689eed9 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/ImageWallpaperTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/ImageWallpaperTest.java
@@ -77,7 +77,7 @@
 
     @Before
     public void setUp() throws Exception {
-        com.android.systemui.util.Assert.sMainLooper = TestableLooper.get(this).getLooper();
+        allowTestableLooperAsMainThread();
         MockitoAnnotations.initMocks(this);
         mEventCountdown = new CountDownLatch(1);
 
diff --git a/packages/SystemUI/tests/src/com/android/systemui/SysuiTestCase.java b/packages/SystemUI/tests/src/com/android/systemui/SysuiTestCase.java
index c85d600..7ac5443 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/SysuiTestCase.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/SysuiTestCase.java
@@ -25,6 +25,7 @@
 import android.os.ParcelFileDescriptor;
 import android.testing.DexmakerShareClassLoaderRule;
 import android.testing.LeakCheck;
+import android.testing.TestableLooper;
 import android.util.Log;
 
 import androidx.test.InstrumentationRegistry;
@@ -32,7 +33,6 @@
 import com.android.keyguard.KeyguardUpdateMonitor;
 import com.android.systemui.classifier.FalsingManagerFake;
 import com.android.systemui.plugins.FalsingManager;
-import com.android.systemui.util.Assert;
 
 import org.junit.After;
 import org.junit.Before;
@@ -86,11 +86,24 @@
     public void SysuiTeardown() {
         InstrumentationRegistry.registerInstance(mRealInstrumentation,
                 InstrumentationRegistry.getArguments());
-        // Reset the assert's main looper.
-        Assert.sMainLooper = Looper.getMainLooper();
+        // Reset the assert's testable looper to null.
+        disallowTestableLooperAsMainThread();
         SystemUIFactory.cleanup();
     }
 
+    /**
+     * Tests are run on the TestableLooper; however, there are parts of SystemUI that assert that
+     * the code is run from the main looper. Therefore, we allow the TestableLooper to pass these
+     * assertions since in a test, the TestableLooper is essentially the MainLooper.
+     */
+    protected void allowTestableLooperAsMainThread() {
+        com.android.systemui.util.Assert.setTestableLooper(TestableLooper.get(this).getLooper());
+    }
+
+    protected void disallowTestableLooperAsMainThread() {
+        com.android.systemui.util.Assert.setTestableLooper(null);
+    }
+
     protected LeakCheck getLeakCheck() {
         return null;
     }
diff --git a/packages/SystemUI/tests/src/com/android/systemui/bubbles/BubbleControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/bubbles/BubbleControllerTest.java
index fc79fcb..5e4f971 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/bubbles/BubbleControllerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/bubbles/BubbleControllerTest.java
@@ -84,6 +84,7 @@
 import com.android.systemui.statusbar.policy.ConfigurationController;
 import com.android.systemui.statusbar.policy.HeadsUpManager;
 import com.android.systemui.statusbar.policy.ZenModeController;
+import com.android.systemui.util.FloatingContentCoordinator;
 import com.android.systemui.util.InjectionInflationController;
 
 import org.junit.Before;
@@ -129,6 +130,8 @@
     private SysuiStatusBarStateController mStatusBarStateController;
     @Mock
     private KeyguardBypassController mKeyguardBypassController;
+    @Mock
+    private FloatingContentCoordinator mFloatingContentCoordinator;
 
     @Captor
     private ArgumentCaptor<NotificationEntryListener> mEntryListenerCaptor;
@@ -200,7 +203,8 @@
         // Bubbles get added to status bar window view
         mNotificationShadeWindowController = new NotificationShadeWindowController(mContext,
                 mWindowManager, mActivityManager, mDozeParameters, mStatusBarStateController,
-                mConfigurationController, mKeyguardBypassController, mColorExtractor);
+                mConfigurationController, mKeyguardBypassController, mColorExtractor,
+                mDumpController);
         mNotificationShadeWindowController.setNotificationShadeView(
                 mSuperStatusBarViewFactory.getNotificationShadeWindowView());
         mNotificationShadeWindowController.attach();
@@ -243,7 +247,8 @@
                 mNotificationEntryManager,
                 mNotifPipeline,
                 mFeatureFlagsOldPipeline,
-                mDumpController);
+                mDumpController,
+                mFloatingContentCoordinator);
         mBubbleController.setBubbleStateChangeListener(mBubbleStateChangeListener);
         mBubbleController.setExpandListener(mBubbleExpandListener);
 
diff --git a/packages/SystemUI/tests/src/com/android/systemui/bubbles/NewNotifPipelineBubbleControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/bubbles/NewNotifPipelineBubbleControllerTest.java
index 24f8a7b..6677b80 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/bubbles/NewNotifPipelineBubbleControllerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/bubbles/NewNotifPipelineBubbleControllerTest.java
@@ -79,6 +79,7 @@
 import com.android.systemui.statusbar.policy.ConfigurationController;
 import com.android.systemui.statusbar.policy.HeadsUpManager;
 import com.android.systemui.statusbar.policy.ZenModeController;
+import com.android.systemui.util.FloatingContentCoordinator;
 import com.android.systemui.util.InjectionInflationController;
 
 import org.junit.Before;
@@ -126,6 +127,8 @@
     private SysuiStatusBarStateController mStatusBarStateController;
     @Mock
     private KeyguardBypassController mKeyguardBypassController;
+    @Mock
+    private FloatingContentCoordinator mFloatingContentCoordinator;
 
     @Captor
     private ArgumentCaptor<NotifCollectionListener> mNotifListenerCaptor;
@@ -194,7 +197,8 @@
         // Bubbles get added to status bar window view
         mNotificationShadeWindowController = new NotificationShadeWindowController(mContext,
                 mWindowManager, mActivityManager, mDozeParameters, mStatusBarStateController,
-                mConfigurationController, mKeyguardBypassController, mColorExtractor);
+                mConfigurationController, mKeyguardBypassController, mColorExtractor,
+                mDumpController);
         mNotificationShadeWindowController.setNotificationShadeView(
                 mSuperStatusBarViewFactory.getNotificationShadeWindowView());
         mNotificationShadeWindowController.attach();
@@ -232,7 +236,8 @@
                 mNotificationEntryManager,
                 mNotifPipeline,
                 mFeatureFlagsNewPipeline,
-                mDumpController);
+                mDumpController,
+                mFloatingContentCoordinator);
         mBubbleController.addNotifCallback(mNotifCallback);
         mBubbleController.setBubbleStateChangeListener(mBubbleStateChangeListener);
         mBubbleController.setExpandListener(mBubbleExpandListener);
diff --git a/packages/SystemUI/tests/src/com/android/systemui/bubbles/TestableBubbleController.java b/packages/SystemUI/tests/src/com/android/systemui/bubbles/TestableBubbleController.java
index 338abf5..f9849f4 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/bubbles/TestableBubbleController.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/bubbles/TestableBubbleController.java
@@ -30,6 +30,7 @@
 import com.android.systemui.statusbar.phone.ShadeController;
 import com.android.systemui.statusbar.policy.ConfigurationController;
 import com.android.systemui.statusbar.policy.ZenModeController;
+import com.android.systemui.util.FloatingContentCoordinator;
 
 /**
  * Testable BubbleController subclass that immediately synchronizes surfaces.
@@ -50,12 +51,13 @@
             NotificationEntryManager entryManager,
             NotifPipeline notifPipeline,
             FeatureFlags featureFlags,
-            DumpController dumpController) {
+            DumpController dumpController,
+            FloatingContentCoordinator floatingContentCoordinator) {
         super(context,
                 notificationShadeWindowController, statusBarStateController, shadeController,
                 data, Runnable::run, configurationController, interruptionStateProvider,
                 zenModeController, lockscreenUserManager, groupManager, entryManager,
-                notifPipeline, featureFlags, dumpController);
+                notifPipeline, featureFlags, dumpController, floatingContentCoordinator);
         setInflateSynchronously(true);
     }
 }
diff --git a/packages/SystemUI/tests/src/com/android/systemui/bubbles/animation/StackAnimationControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/bubbles/animation/StackAnimationControllerTest.java
index d79128c..9cc0349 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/bubbles/animation/StackAnimationControllerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/bubbles/animation/StackAnimationControllerTest.java
@@ -18,6 +18,10 @@
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotEquals;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.never;
+import static org.mockito.Mockito.spy;
+import static org.mockito.Mockito.times;
 import static org.mockito.Mockito.verify;
 
 import android.graphics.PointF;
@@ -30,13 +34,14 @@
 import androidx.test.filters.SmallTest;
 
 import com.android.systemui.R;
+import com.android.systemui.util.FloatingContentCoordinator;
 
 import org.junit.Before;
 import org.junit.Ignore;
 import org.junit.Test;
 import org.junit.runner.RunWith;
+import org.mockito.Mock;
 import org.mockito.Mockito;
-import org.mockito.Spy;
 
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.TimeUnit;
@@ -45,8 +50,10 @@
 @RunWith(AndroidTestingRunner.class)
 public class StackAnimationControllerTest extends PhysicsAnimationLayoutTestCase {
 
-    @Spy
-    private TestableStackController mStackController = new TestableStackController();
+    @Mock
+    private FloatingContentCoordinator mFloatingContentCoordinator;
+
+    private TestableStackController mStackController;
 
     private int mStackOffset;
     private Runnable mCheckStartPosSet;
@@ -54,6 +61,7 @@
     @Before
     public void setUp() throws Exception {
         super.setUp();
+        mStackController = spy(new TestableStackController(mFloatingContentCoordinator));
         mLayout.setActiveController(mStackController);
         addOneMoreThanBubbleLimitBubbles();
         mStackOffset = mLayout.getResources().getDimensionPixelSize(R.dimen.bubble_stack_offset);
@@ -288,6 +296,21 @@
         assertEquals(30, mStackController.getStackPosition().y, 1f);
     }
 
+    @Test
+    public void testFloatingCoordinator() {
+        // We should have called onContentAdded only once while adding all of the bubbles in
+        // setup().
+        verify(mFloatingContentCoordinator, times(1)).onContentAdded(any());
+        verify(mFloatingContentCoordinator, never()).onContentRemoved(any());
+
+        // Remove all views and verify that we called onContentRemoved only once.
+        while (mLayout.getChildCount() > 0) {
+            mLayout.removeView(mLayout.getChildAt(0));
+        }
+
+        verify(mFloatingContentCoordinator, times(1)).onContentRemoved(any());
+    }
+
     /**
      * Checks every child view to make sure it's stacked at the given coordinates, off to the left
      * or right side depending on offset multiplier.
@@ -328,6 +351,11 @@
      * Testable version of the stack controller that dispatches its animations on the main thread.
      */
     private class TestableStackController extends StackAnimationController {
+        TestableStackController(
+                FloatingContentCoordinator floatingContentCoordinator) {
+            super(floatingContentCoordinator);
+        }
+
         @Override
         protected void flingThenSpringFirstBubbleWithStackFollowing(
                 DynamicAnimation.ViewProperty property, float vel, float friction,
diff --git a/packages/SystemUI/tests/src/com/android/systemui/classifier/brightline/DistanceClassifierTest.java b/packages/SystemUI/tests/src/com/android/systemui/classifier/brightline/DistanceClassifierTest.java
index 44454d9..e5ab9be 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/classifier/brightline/DistanceClassifierTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/classifier/brightline/DistanceClassifierTest.java
@@ -60,10 +60,10 @@
         mClassifier.onTouchEvent(appendDownEvent(1, 1));
         assertThat(mClassifier.isFalseTouch(), is(true));
 
-        mClassifier.onTouchEvent(appendMoveEvent(1, 2));
+        mClassifier.onTouchEvent(appendMoveEvent(1, 40));
         assertThat(mClassifier.isFalseTouch(), is(true));
 
-        mClassifier.onTouchEvent(appendUpEvent(1, 40));
+        mClassifier.onTouchEvent(appendUpEvent(1, 80));
         assertThat(mClassifier.isFalseTouch(), is(false));
     }
 
diff --git a/packages/SystemUI/tests/src/com/android/systemui/controls/controller/ControlsBindingControllerImplTest.kt b/packages/SystemUI/tests/src/com/android/systemui/controls/controller/ControlsBindingControllerImplTest.kt
index 40075c8..02bfc19e 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/controls/controller/ControlsBindingControllerImplTest.kt
+++ b/packages/SystemUI/tests/src/com/android/systemui/controls/controller/ControlsBindingControllerImplTest.kt
@@ -45,7 +45,7 @@
 
 @SmallTest
 @RunWith(AndroidTestingRunner::class)
-class ControlsBindingControllerTest : SysuiTestCase() {
+class ControlsBindingControllerImplTest : SysuiTestCase() {
 
     companion object {
         fun <T> any(): T = Mockito.any<T>()
@@ -95,7 +95,7 @@
 
         assertEquals(1, providers.size)
         val provider = providers.first()
-        verify(provider).maybeBindAndLoad(callback)
+        verify(provider).maybeBindAndLoad(any())
     }
 
     @Test
diff --git a/packages/SystemUI/tests/src/com/android/systemui/controls/controller/ControlsProviderLifecycleManagerTest.kt b/packages/SystemUI/tests/src/com/android/systemui/controls/controller/ControlsProviderLifecycleManagerTest.kt
index ddd6b12..a3e59e5 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/controls/controller/ControlsProviderLifecycleManagerTest.kt
+++ b/packages/SystemUI/tests/src/com/android/systemui/controls/controller/ControlsProviderLifecycleManagerTest.kt
@@ -19,7 +19,6 @@
 import android.content.ComponentName
 import android.os.UserHandle
 import android.service.controls.IControlsActionCallback
-import android.service.controls.IControlsLoadCallback
 import android.service.controls.IControlsProvider
 import android.service.controls.IControlsSubscriber
 import android.service.controls.actions.ControlAction
@@ -32,13 +31,13 @@
 import org.junit.After
 import org.junit.Assert.assertEquals
 import org.junit.Assert.assertFalse
-import org.junit.Assert.assertNull
 import org.junit.Assert.assertTrue
 import org.junit.Before
 import org.junit.Test
 import org.junit.runner.RunWith
 import org.mockito.ArgumentCaptor
 import org.mockito.ArgumentMatchers
+import org.mockito.ArgumentMatchers.any
 import org.mockito.ArgumentMatchers.anyString
 import org.mockito.ArgumentMatchers.eq
 import org.mockito.Captor
@@ -54,8 +53,6 @@
     @Mock
     private lateinit var actionCallbackService: IControlsActionCallback.Stub
     @Mock
-    private lateinit var loadCallbackService: IControlsLoadCallback.Stub
-    @Mock
     private lateinit var subscriberService: IControlsSubscriber.Stub
     @Mock
     private lateinit var service: IControlsProvider.Stub
@@ -85,7 +82,6 @@
         manager = ControlsProviderLifecycleManager(
                 context,
                 executor,
-                loadCallbackService,
                 actionCallbackService,
                 subscriberService,
                 UserHandle.of(0),
@@ -113,31 +109,29 @@
 
     @Test
     fun testMaybeBindAndLoad() {
-        manager.maybeBindAndLoad(loadCallback)
+        manager.maybeBindAndLoad(subscriberService)
 
-        verify(service).load(loadCallbackService)
+        verify(service).load(subscriberService)
 
         assertTrue(mContext.isBound(componentName))
-        assertEquals(loadCallback, manager.lastLoadCallback)
     }
 
     @Test
     fun testMaybeUnbind_bindingAndCallback() {
-        manager.maybeBindAndLoad(loadCallback)
+        manager.maybeBindAndLoad(subscriberService)
 
         manager.unbindService()
         assertFalse(mContext.isBound(componentName))
-        assertNull(manager.lastLoadCallback)
     }
 
     @Test
     fun testMaybeBindAndLoad_timeout() {
-        manager.maybeBindAndLoad(loadCallback)
+        manager.maybeBindAndLoad(subscriberService)
 
         executor.advanceClockToLast()
         executor.runAllReady()
 
-        verify(loadCallback).error(anyString())
+        verify(subscriberService).onError(any(), anyString())
     }
 
     @Test
@@ -160,4 +154,4 @@
                 eq(actionCallbackService))
         assertEquals(action, wrapperCaptor.getValue().getWrappedAction())
     }
-}
\ No newline at end of file
+}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/controls/controller/ServiceWrapperTest.kt b/packages/SystemUI/tests/src/com/android/systemui/controls/controller/ServiceWrapperTest.kt
index 9e7ce06..cd82844 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/controls/controller/ServiceWrapperTest.kt
+++ b/packages/SystemUI/tests/src/com/android/systemui/controls/controller/ServiceWrapperTest.kt
@@ -18,7 +18,6 @@
 
 import android.os.RemoteException
 import android.service.controls.IControlsActionCallback
-import android.service.controls.IControlsLoadCallback
 import android.service.controls.IControlsProvider
 import android.service.controls.IControlsSubscriber
 import android.service.controls.IControlsSubscription
@@ -56,9 +55,6 @@
     private lateinit var subscriber: IControlsSubscriber
 
     @Mock
-    private lateinit var loadCallback: IControlsLoadCallback
-
-    @Mock
     private lateinit var actionCallback: IControlsActionCallback
 
     @Captor
@@ -81,16 +77,16 @@
 
     @Test
     fun testLoad_happyPath() {
-        val result = wrapper.load(loadCallback)
+        val result = wrapper.load(subscriber)
 
         assertTrue(result)
-        verify(service).load(loadCallback)
+        verify(service).load(subscriber)
     }
 
     @Test
     fun testLoad_error() {
         `when`(service.load(any())).thenThrow(exception)
-        val result = wrapper.load(loadCallback)
+        val result = wrapper.load(subscriber)
 
         assertFalse(result)
     }
diff --git a/packages/SystemUI/tests/src/com/android/systemui/keyguard/KeyguardViewMediatorTest.java b/packages/SystemUI/tests/src/com/android/systemui/keyguard/KeyguardViewMediatorTest.java
index acc30d9..9a707caa 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/keyguard/KeyguardViewMediatorTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/keyguard/KeyguardViewMediatorTest.java
@@ -18,24 +18,30 @@
 
 import static android.view.WindowManagerPolicyConstants.OFF_BECAUSE_OF_USER;
 
+import static org.mockito.ArgumentMatchers.any;
 import static org.mockito.ArgumentMatchers.anyBoolean;
+import static org.mockito.ArgumentMatchers.anyInt;
+import static org.mockito.Mockito.eq;
+import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.never;
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
 
 import android.app.admin.DevicePolicyManager;
+import android.app.trust.TrustManager;
+import android.os.PowerManager;
+import android.os.PowerManager.WakeLock;
 import android.testing.AndroidTestingRunner;
-import android.testing.TestableLooper;
 import android.testing.TestableLooper.RunWithLooper;
 
 import androidx.test.filters.SmallTest;
 
 import com.android.internal.widget.LockPatternUtils;
 import com.android.keyguard.KeyguardUpdateMonitor;
+import com.android.systemui.DumpController;
 import com.android.systemui.SysuiTestCase;
 import com.android.systemui.broadcast.BroadcastDispatcher;
 import com.android.systemui.classifier.FalsingManagerFake;
-import com.android.systemui.plugins.FalsingManager;
 import com.android.systemui.statusbar.phone.NotificationShadeWindowController;
 import com.android.systemui.statusbar.phone.StatusBarKeyguardViewManager;
 import com.android.systemui.util.concurrency.FakeExecutor;
@@ -60,6 +66,9 @@
     private @Mock NotificationShadeWindowController mNotificationShadeWindowController;
     private @Mock BroadcastDispatcher mBroadcastDispatcher;
     private @Mock DismissCallbackRegistry mDismissCallbackRegistry;
+    private @Mock DumpController mDumpController;
+    private @Mock PowerManager mPowerManager;
+    private @Mock TrustManager mTrustManager;
     private FakeExecutor mUiBgExecutor = new FakeExecutor(new FakeSystemClock());
 
     private FalsingManagerFake mFalsingManager;
@@ -69,24 +78,33 @@
         MockitoAnnotations.initMocks(this);
         mFalsingManager = new FalsingManagerFake();
 
-        mDependency.injectTestDependency(FalsingManager.class, mFalsingManager);
-        mDependency.injectTestDependency(KeyguardUpdateMonitor.class, mUpdateMonitor);
-
         when(mLockPatternUtils.getDevicePolicyManager()).thenReturn(mDevicePolicyManager);
+        when(mPowerManager.newWakeLock(anyInt(), any())).thenReturn(mock(WakeLock.class));
 
-        TestableLooper.get(this).runWithLooper(() -> {
-            mViewMediator = new KeyguardViewMediator(
-                    mContext, mFalsingManager, mLockPatternUtils, mBroadcastDispatcher,
-                    mNotificationShadeWindowController, () -> mStatusBarKeyguardViewManager,
-                    mDismissCallbackRegistry, mUiBgExecutor);
-        });
+        mViewMediator = new KeyguardViewMediator(
+                mContext, mFalsingManager, mLockPatternUtils, mBroadcastDispatcher,
+                mNotificationShadeWindowController, () -> mStatusBarKeyguardViewManager,
+                mDismissCallbackRegistry, mUpdateMonitor, mDumpController, mUiBgExecutor,
+                mPowerManager, mTrustManager);
+        mViewMediator.start();
     }
 
     @Test
     public void testOnGoingToSleep_UpdatesKeyguardGoingAway() {
-        mViewMediator.start();
         mViewMediator.onStartedGoingToSleep(OFF_BECAUSE_OF_USER);
         verify(mUpdateMonitor).setKeyguardGoingAway(false);
         verify(mNotificationShadeWindowController, never()).setKeyguardGoingAway(anyBoolean());
     }
+
+    @Test
+    public void testRegisterDumpable() {
+        verify(mDumpController).registerDumpable(eq(mViewMediator));
+        verify(mNotificationShadeWindowController, never()).setKeyguardGoingAway(anyBoolean());
+    }
+
+    @Test
+    public void testKeyguardGone_notGoingaway() {
+        mViewMediator.mViewMediatorCallback.keyguardGone();
+        verify(mNotificationShadeWindowController).setKeyguardGoingAway(eq(false));
+    }
 }
diff --git a/packages/SystemUI/tests/src/com/android/systemui/qs/carrier/CellSignalStateTest.kt b/packages/SystemUI/tests/src/com/android/systemui/qs/carrier/CellSignalStateTest.kt
new file mode 100644
index 0000000..75be74b
--- /dev/null
+++ b/packages/SystemUI/tests/src/com/android/systemui/qs/carrier/CellSignalStateTest.kt
@@ -0,0 +1,48 @@
+/*
+ * 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.systemui.qs.carrier
+
+import android.testing.AndroidTestingRunner
+import androidx.test.filters.SmallTest
+import com.android.systemui.SysuiTestCase
+import org.junit.Assert.assertNotSame
+import org.junit.Assert.assertSame
+import org.junit.Test
+import org.junit.runner.RunWith
+
+@RunWith(AndroidTestingRunner::class)
+@SmallTest
+class CellSignalStateTest : SysuiTestCase() {
+
+    @Test
+    fun testChangeVisibility_sameObject() {
+        val c = CellSignalState()
+
+        val other = c.changeVisibility(c.visible)
+
+        assertSame(c, other)
+    }
+
+    @Test
+    fun testChangeVisibility_otherObject() {
+        val c = CellSignalState()
+
+        val other = c.changeVisibility(!c.visible)
+
+        assertNotSame(c, other)
+    }
+}
\ No newline at end of file
diff --git a/packages/SystemUI/tests/src/com/android/systemui/qs/QSCarrierGroupControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/qs/carrier/QSCarrierGroupControllerTest.java
similarity index 98%
rename from packages/SystemUI/tests/src/com/android/systemui/qs/QSCarrierGroupControllerTest.java
rename to packages/SystemUI/tests/src/com/android/systemui/qs/carrier/QSCarrierGroupControllerTest.java
index 715087d..fa02231 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/qs/QSCarrierGroupControllerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/qs/carrier/QSCarrierGroupControllerTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2019 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,7 +14,7 @@
  * limitations under the License.
  */
 
-package com.android.systemui.qs;
+package com.android.systemui.qs.carrier;
 
 import static org.mockito.ArgumentMatchers.any;
 import static org.mockito.ArgumentMatchers.anyBoolean;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/qs/carrier/QSCarrierTest.java b/packages/SystemUI/tests/src/com/android/systemui/qs/carrier/QSCarrierTest.java
new file mode 100644
index 0000000..022dc84
--- /dev/null
+++ b/packages/SystemUI/tests/src/com/android/systemui/qs/carrier/QSCarrierTest.java
@@ -0,0 +1,76 @@
+/*
+ * 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.systemui.qs.carrier;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import android.testing.AndroidTestingRunner;
+import android.testing.TestableLooper;
+import android.view.LayoutInflater;
+
+import androidx.test.filters.SmallTest;
+
+import com.android.systemui.R;
+import com.android.systemui.SysuiTestCase;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+@RunWith(AndroidTestingRunner.class)
+@TestableLooper.RunWithLooper
+@SmallTest
+public class QSCarrierTest extends SysuiTestCase {
+
+    private QSCarrier mQSCarrier;
+    private TestableLooper mTestableLooper;
+
+    @Before
+    public void setUp() throws Exception {
+        mTestableLooper = TestableLooper.get(this);
+        LayoutInflater inflater = LayoutInflater.from(mContext);
+        mTestableLooper.runWithLooper(() ->
+                mQSCarrier = (QSCarrier) inflater.inflate(R.layout.qs_carrier, null));
+    }
+
+    @Test
+    public void testUpdateState_first() {
+        CellSignalState c = new CellSignalState(true, 0, "", "", false);
+
+        assertTrue(mQSCarrier.updateState(c));
+    }
+
+    @Test
+    public void testUpdateState_same() {
+        CellSignalState c = new CellSignalState(true, 0, "", "", false);
+
+        assertTrue(mQSCarrier.updateState(c));
+        assertFalse(mQSCarrier.updateState(c));
+    }
+
+    @Test
+    public void testUpdateState_changed() {
+        CellSignalState c = new CellSignalState(true, 0, "", "", false);
+
+        assertTrue(mQSCarrier.updateState(c));
+
+        CellSignalState other = c.changeVisibility(false);
+
+        assertTrue(mQSCarrier.updateState(other));
+    }
+}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/MediaArtworkProcessorTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/MediaArtworkProcessorTest.kt
index 72e6df2..a27c085 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/MediaArtworkProcessorTest.kt
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/MediaArtworkProcessorTest.kt
@@ -16,15 +16,14 @@
 
 package com.android.systemui.statusbar
 
-import com.google.common.truth.Truth.assertThat
-
 import android.graphics.Bitmap
 import android.graphics.Canvas
 import android.graphics.Color
-import android.graphics.Point
 import android.testing.AndroidTestingRunner
+import android.view.WindowManager.LayoutParams.TYPE_NOTIFICATION_SHADE
 import androidx.test.filters.SmallTest
 import com.android.systemui.SysuiTestCase
+import com.google.common.truth.Truth.assertThat
 import org.junit.After
 import org.junit.Before
 import org.junit.Test
@@ -32,6 +31,7 @@
 
 private const val WIDTH = 200
 private const val HEIGHT = 200
+private const val WINDOW_TYPE = TYPE_NOTIFICATION_SHADE
 
 @RunWith(AndroidTestingRunner::class)
 @SmallTest
@@ -46,10 +46,10 @@
     fun setUp() {
         processor = MediaArtworkProcessor()
 
-        val point = Point()
-        context.display.getSize(point)
-        screenWidth = point.x
-        screenHeight = point.y
+        val size = processor.getWindowSize(context, WINDOW_TYPE)
+
+        screenWidth = size.width
+        screenHeight = size.height
     }
 
     @After
@@ -63,7 +63,7 @@
         val artwork = Bitmap.createBitmap(WIDTH, HEIGHT, Bitmap.Config.ARGB_8888)
         Canvas(artwork).drawColor(Color.BLUE)
         // WHEN the background is created from the artwork
-        val background = processor.processArtwork(context, artwork)!!
+        val background = processor.processArtwork(context, artwork, WINDOW_TYPE)!!
         // THEN the background has the size of the screen that has been downsamples
         assertThat(background.height).isLessThan(screenHeight)
         assertThat(background.width).isLessThan(screenWidth)
@@ -76,8 +76,8 @@
         val artwork = Bitmap.createBitmap(WIDTH, HEIGHT, Bitmap.Config.ARGB_8888)
         Canvas(artwork).drawColor(Color.BLUE)
         // WHEN the background is processed twice
-        val background1 = processor.processArtwork(context, artwork)!!
-        val background2 = processor.processArtwork(context, artwork)!!
+        val background1 = processor.processArtwork(context, artwork, WINDOW_TYPE)!!
+        val background2 = processor.processArtwork(context, artwork, WINDOW_TYPE)!!
         // THEN the two bitmaps are the same
         // Note: This is currently broken and trying to use caching causes issues
         assertThat(background1).isNotSameAs(background2)
@@ -89,7 +89,7 @@
         val artwork = Bitmap.createBitmap(WIDTH, HEIGHT, Bitmap.Config.ALPHA_8)
         Canvas(artwork).drawColor(Color.BLUE)
         // WHEN the background is created from the artwork
-        val background = processor.processArtwork(context, artwork)!!
+        val background = processor.processArtwork(context, artwork, WINDOW_TYPE)!!
         // THEN the background has Config ARGB_8888
         assertThat(background.config).isEqualTo(Bitmap.Config.ARGB_8888)
     }
@@ -102,7 +102,7 @@
         // AND the artwork is recycled
         artwork.recycle()
         // WHEN the background is created from the artwork
-        val background = processor.processArtwork(context, artwork)
+        val background = processor.processArtwork(context, artwork, WINDOW_TYPE)
         // THEN the processed bitmap is null
         assertThat(background).isNull()
     }
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/NonPhoneDependencyTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/NonPhoneDependencyTest.java
index 6d83ac3..644ed3d 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/NonPhoneDependencyTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/NonPhoneDependencyTest.java
@@ -85,7 +85,7 @@
                 Dependency.get(NotificationLockscreenUserManager.class);
         NotificationViewHierarchyManager viewHierarchyManager =
                 Dependency.get(NotificationViewHierarchyManager.class);
-        entryManager.setUpWithPresenter(mPresenter, mListContainer, mHeadsUpManager);
+        entryManager.setUpWithPresenter(mPresenter);
         entryManager.addNotificationEntryListener(mEntryListener);
         gutsManager.setUpWithPresenter(mPresenter, mListContainer,
                 mCheckSaveListener, mOnSettingsClickListener);
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationViewHierarchyManagerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationViewHierarchyManagerTest.java
index 60163f2..8e87e0a 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationViewHierarchyManagerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationViewHierarchyManagerTest.java
@@ -54,7 +54,6 @@
 import com.android.systemui.statusbar.notification.stack.NotificationListContainer;
 import com.android.systemui.statusbar.phone.KeyguardBypassController;
 import com.android.systemui.statusbar.phone.NotificationGroupManager;
-import com.android.systemui.util.Assert;
 
 import com.google.android.collect.Lists;
 
@@ -90,7 +89,7 @@
     public void setUp() {
         MockitoAnnotations.initMocks(this);
         mTestableLooper = TestableLooper.get(this);
-        Assert.sMainLooper = mTestableLooper.getLooper();
+        allowTestableLooperAsMainThread();
         mHandler = Handler.createAsync(mTestableLooper.getLooper());
 
         mDependency.injectTestDependency(NotificationEntryManager.class, mEntryManager);
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/AboveShelfObserverTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/AboveShelfObserverTest.java
index 9d667a9..0a38f16 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/AboveShelfObserverTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/AboveShelfObserverTest.java
@@ -21,7 +21,6 @@
 
 import android.test.suitebuilder.annotation.SmallTest;
 import android.testing.AndroidTestingRunner;
-import android.testing.TestableLooper;
 import android.testing.TestableLooper.RunWithLooper;
 import android.widget.FrameLayout;
 
@@ -46,7 +45,7 @@
 
     @Before
     public void setUp() throws Exception {
-        com.android.systemui.util.Assert.sMainLooper = TestableLooper.get(this).getLooper();
+        allowTestableLooperAsMainThread();
         mNotificationTestHelper = new NotificationTestHelper(getContext(), mDependency);
         mHostLayout = new FrameLayout(getContext());
         mObserver = new AboveShelfObserver(mHostLayout);
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/NotificationEntryManagerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/NotificationEntryManagerTest.java
index f1fba79..6a6e5c8 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/NotificationEntryManagerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/NotificationEntryManagerTest.java
@@ -98,7 +98,6 @@
 import com.android.systemui.statusbar.phone.NotificationGroupManager;
 import com.android.systemui.statusbar.policy.DeviceProvisionedController;
 import com.android.systemui.statusbar.policy.HeadsUpManager;
-import com.android.systemui.util.Assert;
 import com.android.systemui.util.leak.LeakDetector;
 import com.android.systemui.util.time.FakeSystemClock;
 
@@ -205,7 +204,7 @@
 
         mCountDownLatch = new CountDownLatch(1);
 
-        Assert.sMainLooper = TestableLooper.get(this).getLooper();
+        allowTestableLooperAsMainThread();
         mDependency.injectTestDependency(Dependency.MAIN_HANDLER,
                 Handler.createAsync(TestableLooper.get(this).getLooper()));
         when(mRemoteInputManager.getController()).thenReturn(mRemoteInputController);
@@ -256,7 +255,7 @@
                 mLeakDetector,
                 mock(ForegroundServiceDismissalFeatureController.class)
         );
-        mEntryManager.setUpWithPresenter(mPresenter, mListContainer, mHeadsUpManager);
+        mEntryManager.setUpWithPresenter(mPresenter);
         mEntryManager.addNotificationEntryListener(mEntryListener);
         mEntryManager.addNotificationRemoveInterceptor(mRemoveInterceptor);
 
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/NotificationFilterTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/NotificationFilterTest.java
index 1116a33..97e0a31 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/NotificationFilterTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/NotificationFilterTest.java
@@ -32,7 +32,6 @@
 import android.os.Bundle;
 import android.service.notification.StatusBarNotification;
 import android.testing.AndroidTestingRunner;
-import android.testing.TestableLooper;
 import android.testing.TestableLooper.RunWithLooper;
 
 import androidx.test.annotation.UiThreadTest;
@@ -79,7 +78,7 @@
 
     @Before
     public void setUp() throws Exception {
-        com.android.systemui.util.Assert.sMainLooper = TestableLooper.get(this).getLooper();
+        allowTestableLooperAsMainThread();
         MockitoAnnotations.initMocks(this);
         when(mMockStatusBarNotification.getUid()).thenReturn(UID_NORMAL);
 
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/TestableNotificationEntryManager.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/TestableNotificationEntryManager.kt
index 0e730e5..d522f90 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/TestableNotificationEntryManager.kt
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/TestableNotificationEntryManager.kt
@@ -22,11 +22,8 @@
 import com.android.systemui.statusbar.notification.collection.NotificationEntry
 import com.android.systemui.statusbar.notification.collection.NotificationRankingManager
 import com.android.systemui.statusbar.notification.collection.inflation.NotificationRowBinder
-import com.android.systemui.statusbar.notification.stack.NotificationListContainer
-import com.android.systemui.statusbar.phone.HeadsUpManagerPhone
 import com.android.systemui.statusbar.phone.NotificationGroupManager
 import com.android.systemui.util.leak.LeakDetector
-
 import java.util.concurrent.CountDownLatch
 
 /**
@@ -53,11 +50,9 @@
     }
 
     fun setUpForTest(
-        presenter: NotificationPresenter?,
-        listContainer: NotificationListContainer?,
-        headsUpManager: HeadsUpManagerPhone?
+        presenter: NotificationPresenter?
     ) {
-        super.setUpWithPresenter(presenter, listContainer, headsUpManager)
+        super.setUpWithPresenter(presenter)
     }
 
     fun setActiveNotificationList(activeList: List<NotificationEntry>) {
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/NotifCollectionTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/NotifCollectionTest.java
index 12e9d31..605b59e 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/NotifCollectionTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/NotifCollectionTest.java
@@ -77,7 +77,6 @@
 import com.android.systemui.statusbar.notification.collection.notifcollection.NotifCollectionLogger;
 import com.android.systemui.statusbar.notification.collection.notifcollection.NotifDismissInterceptor;
 import com.android.systemui.statusbar.notification.collection.notifcollection.NotifLifetimeExtender;
-import com.android.systemui.util.Assert;
 
 import org.junit.Before;
 import org.junit.Test;
@@ -129,7 +128,7 @@
     @Before
     public void setUp() {
         MockitoAnnotations.initMocks(this);
-        Assert.sMainLooper = TestableLooper.get(this).getLooper();
+        allowTestableLooperAsMainThread();
 
         when(mFeatureFlags.isNewNotifPipelineRenderingEnabled()).thenReturn(true);
         when(mFeatureFlags.isNewNotifPipelineEnabled()).thenReturn(true);
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/NotificationRankingManagerTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/NotificationRankingManagerTest.kt
index c6b496d..8e330c6 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/NotificationRankingManagerTest.kt
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/NotificationRankingManagerTest.kt
@@ -145,6 +145,47 @@
     }
 
     @Test
+    fun testSort_importantPeople() {
+        val aN = Notification.Builder(mContext, "test")
+                .setStyle(Notification.MessagingStyle(""))
+                .build()
+        val aC = NotificationChannel("test", "", IMPORTANCE_DEFAULT)
+        aC.setConversationId("parent", "convo")
+        val a = NotificationEntryBuilder()
+                .setImportance(IMPORTANCE_HIGH)
+                .setPkg("pkg")
+                .setOpPkg("pkg")
+                .setTag("tag")
+                .setNotification(aN)
+                .setChannel(aC)
+                .setUser(mContext.getUser())
+                .setOverrideGroupKey("")
+                .build()
+
+        val bN = Notification.Builder(mContext, "test")
+                .setStyle(Notification.MessagingStyle(""))
+                .build()
+        val bC = NotificationChannel("test", "", IMPORTANCE_DEFAULT)
+        bC.setConversationId("parent", "convo")
+        bC.setImportantConversation(true)
+        val b = NotificationEntryBuilder()
+                .setImportance(IMPORTANCE_HIGH)
+                .setPkg("pkg2")
+                .setOpPkg("pkg2")
+                .setTag("tag")
+                .setNotification(bN)
+                .setChannel(bC)
+                .setUser(mContext.getUser())
+                .setOverrideGroupKey("")
+                .build()
+
+
+        assertEquals(
+                listOf(b, a),
+                rankingManager.updateRanking(null, listOf(a, b), "test"))
+    }
+
+    @Test
     fun testSort_properlySetsAlertingBucket() {
         val notif = Notification.Builder(mContext, "test") .build()
 
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/ShadeListBuilderTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/ShadeListBuilderTest.java
index 27ca18c..e570ab8 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/ShadeListBuilderTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/ShadeListBuilderTest.java
@@ -51,7 +51,6 @@
 import com.android.systemui.statusbar.notification.collection.listbuilder.pluggable.NotifPromoter;
 import com.android.systemui.statusbar.notification.collection.listbuilder.pluggable.NotifSection;
 import com.android.systemui.statusbar.notification.collection.notifcollection.CollectionReadyForBuildListener;
-import com.android.systemui.util.Assert;
 import com.android.systemui.util.time.FakeSystemClock;
 
 import org.junit.Before;
@@ -101,7 +100,7 @@
     @Before
     public void setUp() {
         MockitoAnnotations.initMocks(this);
-        Assert.sMainLooper = TestableLooper.get(this).getLooper();
+        allowTestableLooperAsMainThread();
 
         mListBuilder = new ShadeListBuilder(mSystemClock, mLogger, mock(DumpController.class));
         mListBuilder.setOnRenderListListener(mOnRenderListListener);
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/coordinator/ForegroundCoordinatorTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/coordinator/ForegroundCoordinatorTest.java
index eb1af7c..67b1aad 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/coordinator/ForegroundCoordinatorTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/coordinator/ForegroundCoordinatorTest.java
@@ -44,7 +44,6 @@
 import com.android.systemui.statusbar.notification.collection.NotificationEntryBuilder;
 import com.android.systemui.statusbar.notification.collection.listbuilder.pluggable.NotifFilter;
 import com.android.systemui.statusbar.notification.collection.notifcollection.NotifLifetimeExtender;
-import com.android.systemui.util.Assert;
 import com.android.systemui.util.concurrency.FakeExecutor;
 import com.android.systemui.util.time.FakeSystemClock;
 
@@ -84,7 +83,7 @@
     @Before
     public void setup() {
         MockitoAnnotations.initMocks(this);
-        Assert.sMainLooper = TestableLooper.get(this).getLooper();
+        allowTestableLooperAsMainThread();
 
         mForegroundCoordinator =
                 new ForegroundCoordinator(
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRowTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRowTest.java
index a891810..e960185 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRowTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRowTest.java
@@ -39,7 +39,6 @@
 import android.app.AppOpsManager;
 import android.app.NotificationChannel;
 import android.testing.AndroidTestingRunner;
-import android.testing.TestableLooper;
 import android.testing.TestableLooper.RunWithLooper;
 import android.util.ArraySet;
 import android.view.NotificationHeaderView;
@@ -79,7 +78,7 @@
 
     @Before
     public void setUp() throws Exception {
-        com.android.systemui.util.Assert.sMainLooper = TestableLooper.get(this).getLooper();
+        allowTestableLooperAsMainThread();
         mNotificationTestHelper = new NotificationTestHelper(mContext, mDependency);
         mGroupRow = mNotificationTestHelper.createGroup();
         mGroupRow.setHeadsUpAnimatingAwayListener(
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationBlockingHelperManagerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationBlockingHelperManagerTest.java
index a8c438a..481bac2 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationBlockingHelperManagerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationBlockingHelperManagerTest.java
@@ -49,7 +49,6 @@
 import com.android.systemui.bubbles.BubbleController;
 import com.android.systemui.plugins.statusbar.NotificationMenuRowPlugin;
 import com.android.systemui.statusbar.notification.NotificationEntryManager;
-import com.android.systemui.util.Assert;
 
 import org.junit.Before;
 import org.junit.Test;
@@ -75,7 +74,7 @@
 
     @Before
     public void setUp() {
-        Assert.sMainLooper = TestableLooper.get(this).getLooper();
+        allowTestableLooperAsMainThread();
         MockitoAnnotations.initMocks(this);
         mDependency.injectMockDependency(BubbleController.class);
         when(mGutsManager.openGuts(
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationConversationInfoTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationConversationInfoTest.java
index 27b263f..138ea39 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationConversationInfoTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationConversationInfoTest.java
@@ -21,6 +21,8 @@
 import static android.app.NotificationManager.IMPORTANCE_HIGH;
 import static android.app.NotificationManager.IMPORTANCE_LOW;
 import static android.print.PrintManager.PRINT_SPOOLER_PACKAGE_NAME;
+import static android.provider.Settings.Global.NOTIFICATION_BUBBLES;
+import static android.provider.Settings.Secure.BUBBLE_IMPORTANT_CONVERSATIONS;
 import static android.view.View.GONE;
 import static android.view.View.VISIBLE;
 
@@ -55,6 +57,7 @@
 import android.graphics.drawable.BitmapDrawable;
 import android.graphics.drawable.Icon;
 import android.os.UserHandle;
+import android.provider.Settings;
 import android.service.notification.StatusBarNotification;
 import android.test.suitebuilder.annotation.SmallTest;
 import android.testing.AndroidTestingRunner;
@@ -449,6 +452,7 @@
 
     @Test
     public void testBindNotification_bubbleActionVisibleWhenCanBubble()  {
+        Settings.Global.putInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES, 1);
         mNotificationInfo.bindNotification(
                 mShortcutManager,
                 mLauncherApps,
@@ -469,7 +473,8 @@
     }
 
     @Test
-    public void testBindNotification_bubbleActionVisibleWhenCannotBubble()  {
+    public void testBindNotification_bubbleAction_noBubbleMetadata()  {
+        Settings.Global.putInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES, 1);
         mNotificationInfo.bindNotification(
                 mShortcutManager,
                 mLauncherApps,
@@ -490,6 +495,28 @@
     }
 
     @Test
+    public void testBindNotification_bubbleActionGloballyOff()  {
+        Settings.Global.putInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES, 0);
+        mNotificationInfo.bindNotification(
+                mShortcutManager,
+                mLauncherApps,
+                mMockPackageManager,
+                mMockINotificationManager,
+                mVisualStabilityManager,
+                TEST_PACKAGE_NAME,
+                mNotificationChannel,
+                mBubbleEntry,
+                null,
+                null,
+                null,
+                mIconFactory,
+                true);
+
+        View bubbleView = mNotificationInfo.findViewById(R.id.bubble);
+        assertEquals(View.GONE, bubbleView.getVisibility());
+    }
+
+    @Test
     public void testAddToHome() throws Exception {
         when(mShortcutManager.isRequestPinShortcutSupported()).thenReturn(true);
 
@@ -550,6 +577,7 @@
 
     @Test
     public void testBubble_promotesBubble() throws Exception {
+        Settings.Global.putInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES, 1);
         mNotificationChannel.setAllowBubbles(false);
         mConversationChannel.setAllowBubbles(false);
 
@@ -584,6 +612,7 @@
 
     @Test
     public void testBubble_demotesBubble() throws Exception {
+        Settings.Global.putInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES, 1);
         mBubbleEntry.getSbn().getNotification().flags |= FLAG_BUBBLE;
 
         mNotificationInfo.bindNotification(
@@ -617,6 +646,7 @@
 
     @Test
     public void testBubble_noChannelChange() throws Exception {
+        Settings.Global.putInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES, 1);
         mNotificationInfo.bindNotification(
                 mShortcutManager,
                 mLauncherApps,
@@ -645,7 +675,11 @@
     }
 
     @Test
-    public void testFavorite_favorite() throws Exception {
+    public void testFavorite_favorite_noBubble() throws Exception {
+        Settings.Secure.putInt(mContext.getContentResolver(),
+                BUBBLE_IMPORTANT_CONVERSATIONS, 0);
+        mNotificationChannel.setAllowBubbles(false);
+        mConversationChannel.setAllowBubbles(false);
         mNotificationInfo.bindNotification(
                 mShortcutManager,
                 mLauncherApps,
@@ -673,6 +707,44 @@
         verify(mMockINotificationManager, times(1)).updateNotificationChannelForPackage(
                 anyString(), anyInt(), captor.capture());
         assertTrue(captor.getValue().isImportantConversation());
+        assertFalse(captor.getValue().canBubble());
+        verify(mBubbleController, never()).onUserCreatedBubbleFromNotification(mEntry);
+    }
+
+    @Test
+    public void testFavorite_favorite_bubble() throws Exception {
+        Settings.Secure.putInt(mContext.getContentResolver(),
+                BUBBLE_IMPORTANT_CONVERSATIONS, 1);
+        mNotificationChannel.setAllowBubbles(false);
+        mConversationChannel.setAllowBubbles(false);
+        mNotificationInfo.bindNotification(
+                mShortcutManager,
+                mLauncherApps,
+                mMockPackageManager,
+                mMockINotificationManager,
+                mVisualStabilityManager,
+                TEST_PACKAGE_NAME,
+                mNotificationChannel,
+                mEntry,
+                null,
+                null,
+                null,
+                mIconFactory,
+                true);
+
+        ImageButton fave = mNotificationInfo.findViewById(R.id.fave);
+        assertEquals(mContext.getString(R.string.notification_conversation_unfavorite),
+                fave.getContentDescription().toString());
+
+        fave.performClick();
+        mTestableLooper.processAllMessages();
+
+        ArgumentCaptor<NotificationChannel> captor =
+                ArgumentCaptor.forClass(NotificationChannel.class);
+        verify(mMockINotificationManager, times(1)).updateNotificationChannelForPackage(
+                anyString(), anyInt(), captor.capture());
+        assertTrue(captor.getValue().isImportantConversation());
+        assertTrue(captor.getValue().canBubble());
     }
 
     @Test
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationGutsManagerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationGutsManagerTest.java
index bbb6723..54c0bde 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationGutsManagerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationGutsManagerTest.java
@@ -74,7 +74,6 @@
 import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayout;
 import com.android.systemui.statusbar.phone.StatusBar;
 import com.android.systemui.statusbar.policy.DeviceProvisionedController;
-import com.android.systemui.util.Assert;
 
 import org.junit.Before;
 import org.junit.Ignore;
@@ -118,7 +117,7 @@
     @Before
     public void setUp() {
         mTestableLooper = TestableLooper.get(this);
-        Assert.sMainLooper = TestableLooper.get(this).getLooper();
+        allowTestableLooperAsMainThread();
         mDependency.injectTestDependency(DeviceProvisionedController.class,
                 mDeviceProvisionedController);
         mDependency.injectTestDependency(MetricsLogger.class, mMetricsLogger);
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationInlineImageResolverTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationInlineImageResolverTest.java
new file mode 100644
index 0000000..7f48cd1
--- /dev/null
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationInlineImageResolverTest.java
@@ -0,0 +1,100 @@
+/*
+ * 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.systemui.statusbar.notification.row;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotEquals;
+import static org.junit.Assert.assertNotSame;
+import static org.junit.Assert.assertSame;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.spy;
+
+import android.graphics.Bitmap;
+import android.graphics.drawable.BitmapDrawable;
+import android.net.Uri;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
+import com.android.systemui.SysuiTestCase;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import java.io.IOException;
+
+@SmallTest
+@RunWith(AndroidJUnit4.class)
+public class NotificationInlineImageResolverTest extends SysuiTestCase {
+
+    NotificationInlineImageResolver mResolver;
+    Bitmap mBitmap;
+    BitmapDrawable mBitmapDrawable;
+    Uri mUri;
+
+    @Before
+    public void setup() {
+        mResolver = spy(new NotificationInlineImageResolver(mContext, null));
+        mBitmap = Bitmap.createBitmap(10, 10, Bitmap.Config.ARGB_8888);
+        mBitmapDrawable = new BitmapDrawable(mContext.getResources(), mBitmap);
+        mUri = mock(Uri.class);
+    }
+
+    @Test
+    public void refreshMaxImageSizes() {
+        assertNotEquals("Starts different height", mResolver.mMaxImageHeight, 20);
+        assertNotEquals("Starts different width", mResolver.mMaxImageWidth, 15);
+
+        doReturn(20).when(mResolver).getMaxImageHeight();
+        doReturn(15).when(mResolver).getMaxImageWidth();
+
+        mResolver.updateMaxImageSizes();
+
+        assertEquals("Height matches new config", mResolver.mMaxImageHeight, 20);
+        assertEquals("Width matches new config", mResolver.mMaxImageWidth, 15);
+    }
+
+    @Test
+    public void resolveImage_sizeTooBig() throws IOException {
+        doReturn(mBitmapDrawable).when(mResolver).resolveImageInternal(mUri);
+        mResolver.mMaxImageHeight = 5;
+        mResolver.mMaxImageWidth = 5;
+
+        // original bitmap size is 10x10
+        BitmapDrawable resolved = (BitmapDrawable) mResolver.resolveImage(mUri);
+        Bitmap resolvedBitmap = resolved.getBitmap();
+        assertEquals("Bitmap width reduced", 5, resolvedBitmap.getWidth());
+        assertEquals("Bitmap height reduced", 5, resolvedBitmap.getHeight());
+        assertNotSame("Bitmap replaced", resolvedBitmap, mBitmap);
+    }
+
+    @Test
+    public void resolveImage_sizeOK() throws IOException {
+        doReturn(mBitmapDrawable).when(mResolver).resolveImageInternal(mUri);
+        mResolver.mMaxImageWidth = 15;
+        mResolver.mMaxImageHeight = 15;
+
+        // original bitmap size is 10x10
+        BitmapDrawable resolved = (BitmapDrawable) mResolver.resolveImage(mUri);
+        Bitmap resolvedBitmap = resolved.getBitmap();
+        assertEquals("Bitmap width unchanged", 10, resolvedBitmap.getWidth());
+        assertEquals("Bitmap height unchanged", 10, resolvedBitmap.getHeight());
+        assertSame("Bitmap not replaced", resolvedBitmap, mBitmap);
+    }
+}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationTestHelper.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationTestHelper.java
index 9a52ee8..5a89fc4 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationTestHelper.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationTestHelper.java
@@ -56,6 +56,7 @@
 import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow.ExpansionLogger;
 import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow.OnExpandClickListener;
 import com.android.systemui.statusbar.notification.row.NotificationRowContentBinder.InflationFlag;
+import com.android.systemui.statusbar.phone.ConfigurationControllerImpl;
 import com.android.systemui.statusbar.phone.HeadsUpManagerPhone;
 import com.android.systemui.statusbar.phone.KeyguardBypassController;
 import com.android.systemui.statusbar.phone.NotificationGroupManager;
@@ -102,8 +103,8 @@
         mStatusBarStateController = mock(StatusBarStateController.class);
         mGroupManager = new NotificationGroupManager(mStatusBarStateController);
         mHeadsUpManager = new HeadsUpManagerPhone(mContext, mStatusBarStateController,
-                mock(KeyguardBypassController.class));
-        mHeadsUpManager.setUp(null, mGroupManager, null, null);
+                mock(KeyguardBypassController.class), mock(NotificationGroupManager.class),
+                mock(ConfigurationControllerImpl.class));
         mGroupManager.setHeadsUpManager(mHeadsUpManager);
 
         NotificationContentInflater contentBinder = new NotificationContentInflater(
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/wrapper/NotificationCustomViewWrapperTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/wrapper/NotificationCustomViewWrapperTest.java
index 0790cb7..b661b28 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/wrapper/NotificationCustomViewWrapperTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/wrapper/NotificationCustomViewWrapperTest.java
@@ -17,7 +17,6 @@
 package com.android.systemui.statusbar.notification.row.wrapper;
 
 import android.testing.AndroidTestingRunner;
-import android.testing.TestableLooper;
 import android.testing.TestableLooper.RunWithLooper;
 import android.view.View;
 import android.widget.RemoteViews;
@@ -43,7 +42,7 @@
 
     @Before
     public void setUp() throws Exception {
-        com.android.systemui.util.Assert.sMainLooper = TestableLooper.get(this).getLooper();
+        allowTestableLooperAsMainThread();
         mRow = new NotificationTestHelper(mContext, mDependency).createRow();
     }
 
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/wrapper/NotificationMediaTemplateViewWrapperTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/wrapper/NotificationMediaTemplateViewWrapperTest.java
index 038eff7..69e4f22 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/wrapper/NotificationMediaTemplateViewWrapperTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/wrapper/NotificationMediaTemplateViewWrapperTest.java
@@ -26,7 +26,6 @@
 import android.media.session.MediaSession;
 import android.media.session.PlaybackState;
 import android.testing.AndroidTestingRunner;
-import android.testing.TestableLooper;
 import android.testing.TestableLooper.RunWithLooper;
 import android.view.View;
 import android.widget.RemoteViews;
@@ -64,7 +63,7 @@
     @Before
     public void setUp() {
         MockitoAnnotations.initMocks(this);
-        com.android.systemui.util.Assert.sMainLooper = TestableLooper.get(this).getLooper();
+        allowTestableLooperAsMainThread();
 
         mDependency.injectTestDependency(MetricsLogger.class, mMetricsLogger);
     }
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/wrapper/NotificationViewWrapperTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/wrapper/NotificationViewWrapperTest.java
index 9567f33..830e8d9 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/wrapper/NotificationViewWrapperTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/wrapper/NotificationViewWrapperTest.java
@@ -20,7 +20,6 @@
 
 import android.content.Context;
 import android.testing.AndroidTestingRunner;
-import android.testing.TestableLooper;
 import android.testing.TestableLooper.RunWithLooper;
 import android.view.View;
 import android.widget.LinearLayout;
@@ -31,7 +30,6 @@
 import com.android.systemui.SysuiTestCase;
 import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow;
 import com.android.systemui.statusbar.notification.row.NotificationTestHelper;
-import com.android.systemui.util.Assert;
 
 import org.junit.Before;
 import org.junit.Test;
@@ -48,7 +46,7 @@
 
     @Before
     public void setup() throws Exception {
-        Assert.sMainLooper = TestableLooper.get(this).getLooper();
+        allowTestableLooperAsMainThread();
         mView = mock(View.class);
         mRow = new NotificationTestHelper(getContext(), mDependency).createRow();
         mNotificationViewWrapper = new TestableNotificationViewWrapper(mContext, mView, mRow);
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationChildrenContainerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationChildrenContainerTest.java
index 1773175..a2029c7 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationChildrenContainerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationChildrenContainerTest.java
@@ -17,7 +17,6 @@
 package com.android.systemui.statusbar.notification.stack;
 
 import android.testing.AndroidTestingRunner;
-import android.testing.TestableLooper;
 import android.testing.TestableLooper.RunWithLooper;
 import android.view.NotificationHeaderView;
 import android.view.View;
@@ -44,7 +43,7 @@
 
     @Before
     public void setUp() throws Exception {
-        com.android.systemui.util.Assert.sMainLooper = TestableLooper.get(this).getLooper();
+        allowTestableLooperAsMainThread();
         mNotificationTestHelper = new NotificationTestHelper(mContext, mDependency);
         mGroup = mNotificationTestHelper.createGroup();
         mChildrenContainer = mGroup.getChildrenContainer();
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationRoundnessManagerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationRoundnessManagerTest.java
index 2d1bc78..ba2b946 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationRoundnessManagerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationRoundnessManagerTest.java
@@ -24,7 +24,6 @@
 import static org.mockito.Mockito.when;
 
 import android.testing.AndroidTestingRunner;
-import android.testing.TestableLooper;
 import android.testing.TestableLooper.RunWithLooper;
 
 import androidx.test.filters.SmallTest;
@@ -66,7 +65,7 @@
         mRoundnessManager = new NotificationRoundnessManager(
                 mBypassController,
                 new NotificationSectionsFeatureManager(new DeviceConfigProxy(), mContext));
-        com.android.systemui.util.Assert.sMainLooper = TestableLooper.get(this).getLooper();
+        allowTestableLooperAsMainThread();
         NotificationTestHelper testHelper = new NotificationTestHelper(getContext(), mDependency);
         mFirst = testHelper.createRow();
         mFirst.setHeadsUpAnimatingAwayListener(animatingAway
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutTest.java
index 9ccee75..0cb6585 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutTest.java
@@ -144,7 +144,7 @@
     @Before
     @UiThreadTest
     public void setUp() throws Exception {
-        com.android.systemui.util.Assert.sMainLooper = TestableLooper.get(this).getLooper();
+        allowTestableLooperAsMainThread();
 
         mOriginalInterruptionModelSetting = Settings.Secure.getInt(mContext.getContentResolver(),
                 NOTIFICATION_NEW_INTERRUPTION_MODEL, 0);
@@ -185,7 +185,7 @@
                 mock(LeakDetector.class),
                 mock(ForegroundServiceDismissalFeatureController.class)
         );
-        mEntryManager.setUpForTest(mock(NotificationPresenter.class), null, mHeadsUpManager);
+        mEntryManager.setUpForTest(mock(NotificationPresenter.class));
         when(mFeatureFlags.isNewNotifPipelineRenderingEnabled()).thenReturn(false);
 
         NotificationShelf notificationShelf = mock(NotificationShelf.class);
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/HeadsUpAppearanceControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/HeadsUpAppearanceControllerTest.java
index f71d0fc..a74657e 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/HeadsUpAppearanceControllerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/HeadsUpAppearanceControllerTest.java
@@ -23,7 +23,6 @@
 import static org.mockito.Mockito.when;
 
 import android.testing.AndroidTestingRunner;
-import android.testing.TestableLooper;
 import android.testing.TestableLooper.RunWithLooper;
 import android.view.View;
 import android.widget.TextView;
@@ -69,7 +68,7 @@
 
     @Before
     public void setUp() throws Exception {
-        com.android.systemui.util.Assert.sMainLooper = TestableLooper.get(this).getLooper();
+        allowTestableLooperAsMainThread();
         NotificationTestHelper testHelper = new NotificationTestHelper(getContext(), mDependency);
         mFirst = testHelper.createRow();
         mDependency.injectTestDependency(DarkIconDispatcher.class, mDarkIconDispatcher);
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/HeadsUpManagerPhoneTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/HeadsUpManagerPhoneTest.java
index 50d8bf0b0..6d642ec 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/HeadsUpManagerPhoneTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/HeadsUpManagerPhoneTest.java
@@ -62,16 +62,21 @@
     @Mock private StatusBar mBar;
     @Mock private StatusBarStateController mStatusBarStateController;
     @Mock private KeyguardBypassController mBypassController;
+    @Mock private ConfigurationControllerImpl mConfigurationController;
     private boolean mLivesPastNormalTime;
 
     private final class TestableHeadsUpManagerPhone extends HeadsUpManagerPhone {
-        TestableHeadsUpManagerPhone(Context context, View notificationShadeWindowView,
-                NotificationGroupManager groupManager, StatusBar bar,
+        TestableHeadsUpManagerPhone(
+                Context context,
+                NotificationGroupManager groupManager,
                 VisualStabilityManager vsManager,
                 StatusBarStateController statusBarStateController,
-                KeyguardBypassController keyguardBypassController) {
-            super(context, statusBarStateController, keyguardBypassController);
-            setUp(notificationShadeWindowView, groupManager, bar, vsManager);
+                KeyguardBypassController keyguardBypassController,
+                ConfigurationController configurationController
+        ) {
+            super(context, statusBarStateController, keyguardBypassController,
+                    groupManager, configurationController);
+            setup(vsManager);
             mMinimumDisplayTime = TEST_MINIMUM_DISPLAY_TIME;
             mAutoDismissNotificationDecay = TEST_AUTO_DISMISS_TIME;
         }
@@ -91,8 +96,8 @@
         mDependency.injectMockDependency(BubbleController.class);
         mDependency.injectMockDependency(NotificationShadeWindowController.class);
         mDependency.injectMockDependency(ConfigurationController.class);
-        mHeadsUpManager = new TestableHeadsUpManagerPhone(mContext, mNotificationShadeWindowView,
-                mGroupManager, mBar, mVSManager, mStatusBarStateController, mBypassController);
+        mHeadsUpManager = new TestableHeadsUpManagerPhone(mContext, mGroupManager, mVSManager,
+                mStatusBarStateController, mBypassController, mConfigurationController);
         super.setUp();
         mHeadsUpManager.mHandler = mTestHandler;
     }
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardBouncerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardBouncerTest.java
index 67b8e07..35971bd 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardBouncerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardBouncerTest.java
@@ -96,7 +96,7 @@
 
     @Before
     public void setup() {
-        com.android.systemui.util.Assert.sMainLooper = TestableLooper.get(this).getLooper();
+        allowTestableLooperAsMainThread();
         MockitoAnnotations.initMocks(this);
         mDependency.injectTestDependency(KeyguardUpdateMonitor.class, mKeyguardUpdateMonitor);
         mDependency.injectTestDependency(KeyguardSecurityModel.class, mKeyguardSecurityModel);
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationPanelViewTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationPanelViewTest.java
index 5fb7159..13bf38c 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationPanelViewTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationPanelViewTest.java
@@ -138,6 +138,8 @@
     @Mock
     private NotificationEntryManager mNotificationEntryManager;
     @Mock
+    private StatusBarTouchableRegionManager mStatusBarTouchableRegionManager;
+    @Mock
     private KeyguardStateController mKeyguardStateController;
     @Mock
     private DozeLog mDozeLog;
@@ -221,7 +223,7 @@
                 mDozeParameters, mCommandQueue, mVibratorHelper,
                 mLatencyTracker, mPowerManager, mAccessibilityManager, 0, mUpdateMonitor,
                 mMetricsLogger, mActivityManager, mZenModeController, mConfigurationController,
-                mFlingAnimationUtilsBuilder);
+                mFlingAnimationUtilsBuilder, mStatusBarTouchableRegionManager);
         mNotificationPanelViewController.initDependencies(mStatusBar, mGroupManager,
                 mNotificationShelf, mNotificationAreaController, mScrimController);
         mNotificationPanelViewController.setHeadsUpManager(mHeadsUpManager);
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationShadeWindowControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationShadeWindowControllerTest.java
index 7d52df7..2782f3d 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationShadeWindowControllerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationShadeWindowControllerTest.java
@@ -32,6 +32,7 @@
 import androidx.test.filters.SmallTest;
 
 import com.android.internal.colorextraction.ColorExtractor;
+import com.android.systemui.DumpController;
 import com.android.systemui.SysuiTestCase;
 import com.android.systemui.colorextraction.SysuiColorExtractor;
 import com.android.systemui.statusbar.SysuiStatusBarStateController;
@@ -58,6 +59,7 @@
     @Mock private KeyguardBypassController mKeyguardBypassController;
     @Mock private SysuiColorExtractor mColorExtractor;
     @Mock ColorExtractor.GradientColors mGradientColors;
+    @Mock private DumpController mDumpController;
 
     private NotificationShadeWindowController mNotificationShadeWindowController;
 
@@ -69,7 +71,8 @@
 
         mNotificationShadeWindowController = new NotificationShadeWindowController(mContext,
                 mWindowManager, mActivityManager, mDozeParameters, mStatusBarStateController,
-                mConfigurationController, mKeyguardBypassController, mColorExtractor);
+                mConfigurationController, mKeyguardBypassController, mColorExtractor,
+                mDumpController);
         mNotificationShadeWindowController.setNotificationShadeView(mNotificationShadeWindowView);
 
         mNotificationShadeWindowController.attach();
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarTest.java
index db17a6e..d81b8c2 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarTest.java
@@ -50,6 +50,7 @@
 import android.os.Binder;
 import android.os.Handler;
 import android.os.IPowerManager;
+import android.os.IThermalService;
 import android.os.Looper;
 import android.os.PowerManager;
 import android.os.RemoteException;
@@ -236,6 +237,7 @@
     @Mock private LightsOutNotifController mLightsOutNotifController;
     @Mock private ViewMediatorCallback mViewMediatorCallback;
     @Mock private DismissCallbackRegistry mDismissCallbackRegistry;
+    @Mock private StatusBarTouchableRegionManager mStatusBarTouchableRegionManager;
     @Mock private ScreenPinningRequest mScreenPinningRequest;
     @Mock private LockscreenLockIconController mLockscreenLockIconController;
     @Mock private StatusBarNotificationActivityStarter.Builder
@@ -255,7 +257,8 @@
         mDependency.injectTestDependency(NotificationFilter.class, mNotificationFilter);
 
         IPowerManager powerManagerService = mock(IPowerManager.class);
-        mPowerManager = new PowerManager(mContext, powerManagerService,
+        IThermalService thermalService = mock(IThermalService.class);
+        mPowerManager = new PowerManager(mContext, powerManagerService, thermalService,
                 Handler.createAsync(Looper.myLooper()));
 
         mNotificationInterruptionStateProvider =
@@ -397,7 +400,8 @@
                 mKeyguardDismissUtil,
                 mExtensionController,
                 mUserInfoControllerImpl,
-                mDismissCallbackRegistry);
+                mDismissCallbackRegistry,
+                mStatusBarTouchableRegionManager);
 
         when(mNotificationShadeWindowView.findViewById(R.id.lock_icon_container)).thenReturn(
                 mLockIconContainer);
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerBaseTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerBaseTest.java
index 9a0e97a..a0d551c 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerBaseTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerBaseTest.java
@@ -45,6 +45,7 @@
 import android.provider.Settings.Global;
 import android.telephony.CdmaEriInformation;
 import android.telephony.CellSignalStrength;
+import android.telephony.DisplayInfo;
 import android.telephony.NetworkRegistrationInfo;
 import android.telephony.PhoneStateListener;
 import android.telephony.ServiceState;
@@ -96,6 +97,7 @@
     protected PhoneStateListener mPhoneStateListener;
     protected SignalStrength mSignalStrength;
     protected ServiceState mServiceState;
+    protected DisplayInfo mDisplayInfo;
     protected NetworkRegistrationInfo mFakeRegInfo;
     protected ConnectivityManager mMockCm;
     protected WifiManager mMockWm;
@@ -159,6 +161,7 @@
 
         mSignalStrength = mock(SignalStrength.class);
         mServiceState = mock(ServiceState.class);
+        mDisplayInfo = mock(DisplayInfo.class);
 
         mFakeRegInfo = new NetworkRegistrationInfo.Builder()
                 .setTransportType(TRANSPORT_TYPE_WWAN)
@@ -167,6 +170,9 @@
                 .build();
         doReturn(mFakeRegInfo).when(mServiceState)
                 .getNetworkRegistrationInfo(DOMAIN_PS, TRANSPORT_TYPE_WWAN);
+        doReturn(TelephonyManager.NETWORK_TYPE_LTE).when(mDisplayInfo).getNetworkType();
+        doReturn(DisplayInfo.OVERRIDE_NETWORK_TYPE_NONE).when(mDisplayInfo)
+                .getOverrideNetworkType();
 
         mEriInformation = new CdmaEriInformation(CdmaEriInformation.ERI_OFF,
                 CdmaEriInformation.ERI_ICON_MODE_NORMAL);
@@ -260,33 +266,6 @@
             NetworkCapabilities.TRANSPORT_CELLULAR, true, true);
     }
 
-    public void setupDefaultNr5GIconConfiguration() {
-        NetworkControllerImpl.Config.add5GIconMapping("connected_mmwave:5g_plus", mConfig);
-        NetworkControllerImpl.Config.add5GIconMapping("connected:5g", mConfig);
-    }
-
-    public void setupNr5GIconConfigurationForNotRestrictedRrcCon() {
-        NetworkControllerImpl.Config.add5GIconMapping("connected_mmwave:5g_plus", mConfig);
-        NetworkControllerImpl.Config.add5GIconMapping("connected:5g_plus", mConfig);
-        NetworkControllerImpl.Config.add5GIconMapping("not_restricted_rrc_con:5g", mConfig);
-    }
-
-    public void setupNr5GIconConfigurationForNotRestrictedRrcIdle() {
-        NetworkControllerImpl.Config.add5GIconMapping("connected_mmwave:5g_plus", mConfig);
-        NetworkControllerImpl.Config.add5GIconMapping("connected:5g_plus", mConfig);
-        NetworkControllerImpl.Config.add5GIconMapping("not_restricted_rrc_idle:5g", mConfig);
-    }
-
-    public void setupDefaultNr5GIconDisplayGracePeriodTime_enableThirtySeconds() {
-        final int enableDisplayGraceTimeSec = 30;
-        NetworkControllerImpl.Config.setDisplayGraceTime(enableDisplayGraceTimeSec, mConfig);
-    }
-
-    public void setupDefaultNr5GIconDisplayGracePeriodTime_disabled() {
-        final int disableDisplayGraceTimeSec = 0;
-        NetworkControllerImpl.Config.setDisplayGraceTime(disableDisplayGraceTimeSec, mConfig);
-    }
-
     public void setConnectivityViaBroadcast(
         int networkType, boolean validated, boolean isConnected) {
         setConnectivityCommon(networkType, validated, isConnected);
@@ -369,6 +348,7 @@
     protected void updateServiceState() {
         Log.d(TAG, "Sending Service State: " + mServiceState);
         mPhoneStateListener.onServiceStateChanged(mServiceState);
+        mPhoneStateListener.onDisplayInfoChanged(mDisplayInfo);
     }
 
     public void updateCallState(int state) {
@@ -384,6 +364,7 @@
                 .build();
         when(mServiceState.getNetworkRegistrationInfo(DOMAIN_PS, TRANSPORT_TYPE_WWAN))
                 .thenReturn(fakeRegInfo);
+        when(mDisplayInfo.getNetworkType()).thenReturn(dataNetType);
         mPhoneStateListener.onDataConnectionStateChanged(dataState, dataNetType);
     }
 
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerDataTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerDataTest.java
index a906d9f..3eb0c44 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerDataTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerDataTest.java
@@ -3,17 +3,13 @@
 import static android.telephony.AccessNetworkConstants.TRANSPORT_TYPE_WWAN;
 import static android.telephony.NetworkRegistrationInfo.DOMAIN_PS;
 
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
 import static org.mockito.Matchers.anyInt;
-import static org.mockito.Mockito.doReturn;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
 
 import android.net.NetworkCapabilities;
 import android.os.Looper;
 import android.telephony.NetworkRegistrationInfo;
-import android.telephony.ServiceState;
 import android.telephony.TelephonyManager;
 import android.test.suitebuilder.annotation.SmallTest;
 import android.testing.AndroidTestingRunner;
@@ -24,7 +20,6 @@
 
 import org.junit.Test;
 import org.junit.runner.RunWith;
-import org.mockito.Mockito;
 
 @SmallTest
 @RunWith(AndroidTestingRunner.class)
@@ -180,254 +175,6 @@
     }
 
     @Test
-    public void testNr5GIcon_NrNotRestrictedRrcCon_show5GIcon() {
-        setupNr5GIconConfigurationForNotRestrictedRrcCon();
-        setupDefaultSignal();
-        updateDataConnectionState(TelephonyManager.DATA_CONNECTED,
-                TelephonyManager.NETWORK_TYPE_LTE);
-        updateDataActivity(TelephonyManager.DATA_ACTIVITY_INOUT);
-        ServiceState ss = Mockito.mock(ServiceState.class);
-        setNrState(ss, NetworkRegistrationInfo.NR_STATE_NOT_RESTRICTED);
-        mPhoneStateListener.onServiceStateChanged(ss);
-
-        verifyLastMobileDataIndicators(true, DEFAULT_SIGNAL_STRENGTH, TelephonyIcons.ICON_5G,
-                true, DEFAULT_QS_SIGNAL_STRENGTH, TelephonyIcons.ICON_5G, true, true);
-    }
-
-    @Test
-    public void testNr5GIcon_NrNotRestrictedRrcIdle_show5GIcon() {
-        setupNr5GIconConfigurationForNotRestrictedRrcIdle();
-        setupDefaultSignal();
-        updateDataConnectionState(TelephonyManager.DATA_CONNECTED,
-                TelephonyManager.NETWORK_TYPE_LTE);
-        updateDataActivity(TelephonyManager.DATA_ACTIVITY_DORMANT);
-        ServiceState ss = Mockito.mock(ServiceState.class);
-        setNrState(ss, NetworkRegistrationInfo.NR_STATE_NOT_RESTRICTED);
-        mPhoneStateListener.onServiceStateChanged(ss);
-
-        verifyDataIndicators(TelephonyIcons.ICON_5G);
-    }
-
-    @Test
-    public void testNr5GIcon_NrConnectedWithoutMMWave_show5GIcon() {
-        setupDefaultNr5GIconConfiguration();
-        setupDefaultSignal();
-        updateDataConnectionState(TelephonyManager.DATA_CONNECTED,
-                TelephonyManager.NETWORK_TYPE_LTE);
-        ServiceState ss = Mockito.mock(ServiceState.class);
-        setNrState(ss, NetworkRegistrationInfo.NR_STATE_CONNECTED);
-        doReturn(ServiceState.FREQUENCY_RANGE_HIGH).when(ss).getNrFrequencyRange();
-        mPhoneStateListener.onServiceStateChanged(ss);
-
-        verifyDataIndicators(TelephonyIcons.ICON_5G);
-    }
-
-    @Test
-    public void testNr5GIcon_NrConnectedWithMMWave_show5GPlusIcon() {
-        setupDefaultNr5GIconConfiguration();
-        setupDefaultSignal();
-        updateDataConnectionState(TelephonyManager.DATA_CONNECTED,
-                TelephonyManager.NETWORK_TYPE_LTE);
-        ServiceState ss = Mockito.mock(ServiceState.class);
-        setNrState(ss, NetworkRegistrationInfo.NR_STATE_CONNECTED);
-        doReturn(ServiceState.FREQUENCY_RANGE_MMWAVE).when(ss).getNrFrequencyRange();
-        mPhoneStateListener.onServiceStateChanged(ss);
-
-        verifyDataIndicators(TelephonyIcons.ICON_5G_PLUS);
-    }
-
-    @Test
-    public void testNr5GIcon_NrRestricted_showLteIcon() {
-        setupDefaultNr5GIconConfiguration();
-        setupDefaultSignal();
-        updateDataConnectionState(TelephonyManager.DATA_CONNECTED,
-                TelephonyManager.NETWORK_TYPE_LTE);
-        ServiceState ss = Mockito.mock(ServiceState.class);
-        setNrState(ss, NetworkRegistrationInfo.NR_STATE_RESTRICTED);
-        mPhoneStateListener.onServiceStateChanged(mServiceState);
-
-        verifyDataIndicators(TelephonyIcons.ICON_LTE);
-    }
-
-    @Test
-    public void testNr5GIcon_displayGracePeriodTime_enabled() {
-        setupDefaultNr5GIconConfiguration();
-        setupDefaultNr5GIconDisplayGracePeriodTime_enableThirtySeconds();
-        setupDefaultSignal();
-        mNetworkController.handleConfigurationChanged();
-        mPhoneStateListener.onServiceStateChanged(mServiceState);
-
-        ServiceState ss = Mockito.mock(ServiceState.class);
-        // While nrIconDisplayGracePeriodMs > 0 & is Nr5G, mIsShowingIconGracefully should be true
-        setNrState(ss, NetworkRegistrationInfo.NR_STATE_CONNECTED);
-        doReturn(ServiceState.FREQUENCY_RANGE_HIGH).when(ss).getNrFrequencyRange();
-        mPhoneStateListener.onDataConnectionStateChanged(TelephonyManager.DATA_CONNECTED,
-                TelephonyManager.NETWORK_TYPE_LTE);
-        mPhoneStateListener.onServiceStateChanged(ss);
-
-        assertTrue(mConfig.nrIconDisplayGracePeriodMs > 0);
-        assertTrue(mMobileSignalController.mIsShowingIconGracefully);
-    }
-
-    @Test
-    public void testNr5GIcon_displayGracePeriodTime_disabled() {
-        setupDefaultNr5GIconConfiguration();
-        setupDefaultNr5GIconDisplayGracePeriodTime_disabled();
-        setupDefaultSignal();
-
-        assertTrue(mConfig.nrIconDisplayGracePeriodMs == 0);
-
-        // While nrIconDisplayGracePeriodMs <= 0, mIsShowingIconGracefully should be false
-        setNrState(mServiceState, NetworkRegistrationInfo.NR_STATE_CONNECTED);
-        doReturn(ServiceState.FREQUENCY_RANGE_HIGH).when(mServiceState).getNrFrequencyRange();
-        mPhoneStateListener.onDataConnectionStateChanged(TelephonyManager.DATA_CONNECTED,
-                TelephonyManager.NETWORK_TYPE_LTE);
-
-        assertFalse(mMobileSignalController.mIsShowingIconGracefully);
-    }
-
-    @Test
-    public void testNr5GIcon_enableDisplayGracePeriodTime_showIconGracefully() {
-        setupDefaultNr5GIconConfiguration();
-        setupDefaultNr5GIconDisplayGracePeriodTime_enableThirtySeconds();
-        setupDefaultSignal();
-        mNetworkController.handleConfigurationChanged();
-        mPhoneStateListener.onServiceStateChanged(mServiceState);
-
-        ServiceState ss = Mockito.mock(ServiceState.class);
-        setNrState(ss, NetworkRegistrationInfo.NR_STATE_CONNECTED);
-        doReturn(ServiceState.FREQUENCY_RANGE_HIGH).when(ss).getNrFrequencyRange();
-        mPhoneStateListener.onDataConnectionStateChanged(TelephonyManager.DATA_CONNECTED,
-                TelephonyManager.NETWORK_TYPE_LTE);
-        mPhoneStateListener.onServiceStateChanged(ss);
-
-        verifyDataIndicators(TelephonyIcons.ICON_5G);
-
-        // Enabled timer Nr5G switch to None Nr5G, showing 5G icon gracefully
-        ServiceState ssLte = Mockito.mock(ServiceState.class);
-        setNrState(ssLte, NetworkRegistrationInfo.NR_STATE_NONE);
-        doReturn(ServiceState.FREQUENCY_RANGE_UNKNOWN).when(ssLte).getNrFrequencyRange();
-        mPhoneStateListener.onDataConnectionStateChanged(TelephonyManager.DATA_CONNECTED,
-                TelephonyManager.NETWORK_TYPE_LTE);
-        mPhoneStateListener.onServiceStateChanged(ssLte);
-
-        verifyDataIndicators(TelephonyIcons.ICON_5G);
-    }
-
-    @Test
-    public void testNr5GIcon_disableDisplayGracePeriodTime_showLatestIconImmediately() {
-        setupDefaultNr5GIconConfiguration();
-        setupDefaultNr5GIconDisplayGracePeriodTime_disabled();
-        setupDefaultSignal();
-        mNetworkController.handleConfigurationChanged();
-
-        setNrState(mServiceState, NetworkRegistrationInfo.NR_STATE_CONNECTED);
-        doReturn(ServiceState.FREQUENCY_RANGE_HIGH).when(mServiceState).getNrFrequencyRange();
-        mPhoneStateListener.onDataConnectionStateChanged(TelephonyManager.DATA_CONNECTED,
-                TelephonyManager.NETWORK_TYPE_LTE);
-
-        verifyDataIndicators(TelephonyIcons.ICON_5G);
-
-        setNrState(mServiceState, NetworkRegistrationInfo.NR_STATE_NONE);
-        doReturn(ServiceState.FREQUENCY_RANGE_UNKNOWN).when(mServiceState).getNrFrequencyRange();
-        mPhoneStateListener.onDataConnectionStateChanged(TelephonyManager.DATA_CONNECTED,
-                TelephonyManager.NETWORK_TYPE_LTE);
-
-        verifyDataIndicators(TelephonyIcons.ICON_LTE);
-    }
-
-    @Test
-    public void testNr5GIcon_resetDisplayGracePeriodTime_whenDataDisconnected() {
-        setupDefaultNr5GIconConfiguration();
-        setupDefaultNr5GIconDisplayGracePeriodTime_enableThirtySeconds();
-        setupDefaultSignal();
-        mNetworkController.handleConfigurationChanged();
-        setNrState(mServiceState, NetworkRegistrationInfo.NR_STATE_CONNECTED);
-        doReturn(ServiceState.FREQUENCY_RANGE_HIGH).when(mServiceState).getNrFrequencyRange();
-        mPhoneStateListener.onDataConnectionStateChanged(TelephonyManager.DATA_CONNECTED,
-                TelephonyManager.NETWORK_TYPE_LTE);
-
-        verifyDataIndicators(TelephonyIcons.ICON_5G);
-
-        // Disabled timer, when out of service, reset timer to display latest state
-        updateDataConnectionState(TelephonyManager.DATA_CONNECTED,
-                TelephonyManager.NETWORK_TYPE_LTE);
-        setNrState(mServiceState, NetworkRegistrationInfo.NR_STATE_NONE);
-        doReturn(ServiceState.FREQUENCY_RANGE_UNKNOWN).when(mServiceState).getNrFrequencyRange();
-        mPhoneStateListener.onDataConnectionStateChanged(TelephonyManager.DATA_DISCONNECTED,
-                TelephonyManager.NETWORK_TYPE_UMTS);
-
-        verifyDataIndicators(0);
-    }
-
-    @Test
-    public void testNr5GIcon_enableDisplayGracePeriodTime_show5G_switching_5GPlus() {
-        setupDefaultNr5GIconConfiguration();
-        setupDefaultNr5GIconDisplayGracePeriodTime_enableThirtySeconds();
-        setupDefaultSignal();
-        mNetworkController.handleConfigurationChanged();
-        mPhoneStateListener.onServiceStateChanged(mServiceState);
-
-        ServiceState ss5G = Mockito.mock(ServiceState.class);
-        setNrState(ss5G, NetworkRegistrationInfo.NR_STATE_CONNECTED);
-        doReturn(ServiceState.FREQUENCY_RANGE_HIGH).when(ss5G).getNrFrequencyRange();
-        mPhoneStateListener.onDataConnectionStateChanged(TelephonyManager.DATA_CONNECTED,
-                TelephonyManager.NETWORK_TYPE_LTE);
-        mPhoneStateListener.onServiceStateChanged(ss5G);
-
-        verifyDataIndicators(TelephonyIcons.ICON_5G);
-
-        // When timeout enabled, 5G/5G+ switching should be updated immediately
-        ServiceState ss5GPlus = Mockito.mock(ServiceState.class);
-        setNrState(ss5GPlus, NetworkRegistrationInfo.NR_STATE_CONNECTED);
-        doReturn(ServiceState.FREQUENCY_RANGE_MMWAVE).when(ss5GPlus).getNrFrequencyRange();
-        mPhoneStateListener.onDataConnectionStateChanged(TelephonyManager.DATA_CONNECTED,
-                TelephonyManager.NETWORK_TYPE_LTE);
-        mPhoneStateListener.onServiceStateChanged(ss5GPlus);
-
-        verifyDataIndicators(TelephonyIcons.ICON_5G_PLUS);
-    }
-
-    @Test
-    public void testNr5GIcon_carrierDisabledDisplayGracePeriodTime_shouldUpdateIconImmediately() {
-        setupDefaultNr5GIconConfiguration();
-        setupDefaultNr5GIconDisplayGracePeriodTime_enableThirtySeconds();
-        setupDefaultSignal();
-        mNetworkController.handleConfigurationChanged();
-        mPhoneStateListener.onServiceStateChanged(mServiceState);
-
-        ServiceState ss = Mockito.mock(ServiceState.class);
-        setNrState(ss, NetworkRegistrationInfo.NR_STATE_CONNECTED);
-        doReturn(ServiceState.FREQUENCY_RANGE_HIGH).when(ss).getNrFrequencyRange();
-        mPhoneStateListener.onDataConnectionStateChanged(TelephonyManager.DATA_CONNECTED,
-                TelephonyManager.NETWORK_TYPE_LTE);
-        mPhoneStateListener.onServiceStateChanged(ss);
-
-        verifyDataIndicators(TelephonyIcons.ICON_5G);
-
-        // State from NR_5G to NONE NR_5G with timeout, should show previous 5G icon
-        setNrState(ss, NetworkRegistrationInfo.NR_STATE_NONE);
-        doReturn(ServiceState.FREQUENCY_RANGE_UNKNOWN).when(ss).getNrFrequencyRange();
-        mPhoneStateListener.onDataConnectionStateChanged(TelephonyManager.DATA_CONNECTED,
-                TelephonyManager.NETWORK_TYPE_LTE);
-        mPhoneStateListener.onServiceStateChanged(ss);
-
-        verifyDataIndicators(TelephonyIcons.ICON_5G);
-
-        // Update nrIconDisplayGracePeriodMs to 0
-        setupDefaultNr5GIconDisplayGracePeriodTime_disabled();
-        mNetworkController.handleConfigurationChanged();
-
-        // State from NR_5G to NONE NR_STATE_RESTRICTED, showing corresponding icon
-        setNrState(ss, NetworkRegistrationInfo.NR_STATE_RESTRICTED);
-        mPhoneStateListener.onDataConnectionStateChanged(TelephonyManager.DATA_CONNECTED,
-                TelephonyManager.NETWORK_TYPE_LTE);
-
-        assertTrue(mConfig.nrIconDisplayGracePeriodMs == 0);
-        verifyDataIndicators(TelephonyIcons.ICON_LTE);
-    }
-
-    @Test
     public void testDataDisabledIcon_UserNotSetup() {
         setupNetworkController();
         when(mMockTm.isDataConnectionEnabled()).thenReturn(false);
@@ -488,6 +235,7 @@
                 .build();
         when(mServiceState.getNetworkRegistrationInfo(DOMAIN_PS, TRANSPORT_TYPE_WWAN))
                 .thenReturn(fakeRegInfo);
+        when(mDisplayInfo.getNetworkType()).thenReturn(TelephonyManager.NETWORK_TYPE_HSPA);
         updateServiceState();
         verifyDataIndicators(TelephonyIcons.ICON_H);
     }
@@ -523,10 +271,4 @@
                 true, DEFAULT_QS_SIGNAL_STRENGTH, dataIcon, false,
                 false);
     }
-
-    private void setNrState(ServiceState ss, int nrState) {
-        mFakeRegInfo.setNrState(nrState);
-        doReturn(mFakeRegInfo).when(ss)
-                .getNetworkRegistrationInfo(DOMAIN_PS, TRANSPORT_TYPE_WWAN);
-    }
 }
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/RemoteInputViewTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/RemoteInputViewTest.java
index df62254..86add98 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/RemoteInputViewTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/RemoteInputViewTest.java
@@ -43,7 +43,6 @@
 import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow;
 import com.android.systemui.statusbar.notification.row.NotificationTestHelper;
 import com.android.systemui.statusbar.phone.LightBarController;
-import com.android.systemui.util.Assert;
 
 import org.junit.After;
 import org.junit.Before;
@@ -74,7 +73,7 @@
 
     @Before
     public void setUp() throws Exception {
-        Assert.sMainLooper = TestableLooper.get(this).getLooper();
+        allowTestableLooperAsMainThread();
         MockitoAnnotations.initMocks(this);
 
         mDependency.injectTestDependency(RemoteInputQuickSettingsDisabler.class,
diff --git a/packages/SystemUI/tests/src/com/android/systemui/util/wakelock/KeepAwakeAnimationListenerTest.java b/packages/SystemUI/tests/src/com/android/systemui/util/wakelock/KeepAwakeAnimationListenerTest.java
index 20dcbb7..1ff9548 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/util/wakelock/KeepAwakeAnimationListenerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/util/wakelock/KeepAwakeAnimationListenerTest.java
@@ -21,14 +21,12 @@
 import static org.mockito.Mockito.verify;
 
 import android.animation.Animator;
-import android.os.Looper;
 import android.testing.AndroidTestingRunner;
 import android.testing.TestableLooper;
 
 import androidx.test.filters.SmallTest;
 
 import com.android.systemui.SysuiTestCase;
-import com.android.systemui.util.Assert;
 
 import org.junit.Before;
 import org.junit.Test;
@@ -45,7 +43,7 @@
 
     @Before
     public void setup() {
-        Assert.sMainLooper = TestableLooper.get(this).getLooper();
+        allowTestableLooperAsMainThread();
         MockitoAnnotations.initMocks(this);
         KeepAwakeAnimationListener.sWakeLock = mWakeLock;
         mKeepAwakeAnimationListener = new KeepAwakeAnimationListener(getContext());
@@ -63,7 +61,10 @@
 
     @Test(expected = IllegalStateException.class)
     public void initThrows_onNonMainThread() {
-        Assert.sMainLooper = Looper.getMainLooper();
+        disallowTestableLooperAsMainThread();
+
+        // we are creating the KeepAwakeAnimationListener from the TestableLooper, not the main
+        // looper, so we expect an IllegalStateException:
         new KeepAwakeAnimationListener(getContext());
     }
 }
diff --git a/packages/Tethering/common/TetheringLib/src/android/net/TetheringManager.java b/packages/Tethering/common/TetheringLib/src/android/net/TetheringManager.java
index bfa962a..fd9f713 100644
--- a/packages/Tethering/common/TetheringLib/src/android/net/TetheringManager.java
+++ b/packages/Tethering/common/TetheringLib/src/android/net/TetheringManager.java
@@ -212,7 +212,7 @@
         new Thread(() -> {
             while (true) {
                 try {
-                    Thread.sleep(200);
+                    Thread.sleep(CONNECTOR_POLL_INTERVAL_MILLIS);
                 } catch (InterruptedException e) {
                     // Not much to do here, the system needs to wait for the connector
                 }
diff --git a/services/Android.bp b/services/Android.bp
index 416f448..c77e75d 100644
--- a/services/Android.bp
+++ b/services/Android.bp
@@ -127,6 +127,16 @@
             api_file: "api/current.txt",
             removed_api_file: "api/removed.txt",
         },
+        last_released: {
+            api_file: ":last-released-system-server-api",
+            removed_api_file: "api/removed.txt",
+            baseline_file: ":system-server-api-incompatibilities-with-last-released"
+        },
+        api_lint: {
+            enabled: true,
+            new_since: ":last-released-system-server-api",
+            baseline_file: "api/lint-baseline.txt",
+        },
     },
 }
 
diff --git a/services/accessibility/java/com/android/server/accessibility/AbstractAccessibilityServiceConnection.java b/services/accessibility/java/com/android/server/accessibility/AbstractAccessibilityServiceConnection.java
index 6c8aaf4..0a527d4 100644
--- a/services/accessibility/java/com/android/server/accessibility/AbstractAccessibilityServiceConnection.java
+++ b/services/accessibility/java/com/android/server/accessibility/AbstractAccessibilityServiceConnection.java
@@ -230,6 +230,10 @@
         /* This is exactly PendingIntent.getActivity, separated out for testability */
         PendingIntent getPendingIntentActivity(Context context, int requestCode, Intent intent,
                 int flags);
+
+        void setGestureDetectionPassthroughRegion(int displayId, Region region);
+
+        void setTouchExplorationPassthroughRegion(int displayId, Region region);
     }
 
     public AbstractAccessibilityServiceConnection(Context context, ComponentName componentName,
@@ -1736,4 +1740,14 @@
     public boolean isMultiFingerGesturesEnabled() {
         return mRequestMultiFingerGestures;
     }
+
+    @Override
+    public void setGestureDetectionPassthroughRegion(int displayId, Region region) {
+        mSystemSupport.setGestureDetectionPassthroughRegion(displayId, region);
+    }
+
+    @Override
+    public void setTouchExplorationPassthroughRegion(int displayId, Region region) {
+        mSystemSupport.setTouchExplorationPassthroughRegion(displayId, region);
+    }
 }
diff --git a/services/accessibility/java/com/android/server/accessibility/AccessibilityInputFilter.java b/services/accessibility/java/com/android/server/accessibility/AccessibilityInputFilter.java
index efddd86..020f225 100644
--- a/services/accessibility/java/com/android/server/accessibility/AccessibilityInputFilter.java
+++ b/services/accessibility/java/com/android/server/accessibility/AccessibilityInputFilter.java
@@ -17,6 +17,7 @@
 package com.android.server.accessibility;
 
 import android.content.Context;
+import android.graphics.Region;
 import android.os.PowerManager;
 import android.util.Slog;
 import android.util.SparseArray;
@@ -726,4 +727,16 @@
             return shouldProcess;
         }
     }
+
+    public void setGestureDetectionPassthroughRegion(int displayId, Region region) {
+        if (region != null && mTouchExplorer.contains(displayId)) {
+            mTouchExplorer.get(displayId).setGestureDetectionPassthroughRegion(region);
+        }
+    }
+
+    public void setTouchExplorationPassthroughRegion(int displayId, Region region) {
+        if (region != null && mTouchExplorer.contains(displayId)) {
+            mTouchExplorer.get(displayId).setTouchExplorationPassthroughRegion(region);
+        }
+    }
 }
diff --git a/services/accessibility/java/com/android/server/accessibility/AccessibilityManagerService.java b/services/accessibility/java/com/android/server/accessibility/AccessibilityManagerService.java
index 055bb4c..60c3d78 100644
--- a/services/accessibility/java/com/android/server/accessibility/AccessibilityManagerService.java
+++ b/services/accessibility/java/com/android/server/accessibility/AccessibilityManagerService.java
@@ -2879,11 +2879,8 @@
         @Override
         public void onDisplayRemoved(int displayId) {
             synchronized (mLock) {
-                for (int i = 0; i < mDisplaysList.size(); i++) {
-                    if (mDisplaysList.get(i).getDisplayId() == displayId) {
-                        mDisplaysList.remove(i);
-                        break;
-                    }
+                if (!removeDisplayFromList(displayId)) {
+                    return;
                 }
                 if (mInputFilter != null) {
                     mInputFilter.onDisplayChanged();
@@ -2903,6 +2900,17 @@
             mA11yWindowManager.stopTrackingWindows(displayId);
         }
 
+        @GuardedBy("mLock")
+        private boolean removeDisplayFromList(int displayId) {
+            for (int i = 0; i < mDisplaysList.size(); i++) {
+                if (mDisplaysList.get(i).getDisplayId() == displayId) {
+                    mDisplaysList.remove(i);
+                    return true;
+                }
+            }
+            return false;
+        }
+
         @Override
         public void onDisplayChanged(int displayId) {
             /* do nothing */
@@ -2914,8 +2922,8 @@
             }
             // Private virtual displays are created by the ap and is not allowed to access by other
             // aps. We assume we could ignore them.
-            if ((display.getType() == Display.TYPE_VIRTUAL
-                    && (display.getFlags() & Display.FLAG_PRIVATE) != 0)) {
+            if (display.getType() == Display.TYPE_VIRTUAL
+                    && (display.getFlags() & Display.FLAG_PRIVATE) != 0) {
                 return false;
             }
             return true;
@@ -3058,4 +3066,40 @@
             }
         }
     }
+
+    @Override
+    public void setGestureDetectionPassthroughRegion(int displayId, Region region) {
+        mMainHandler.sendMessage(
+                obtainMessage(
+                        AccessibilityManagerService::setGestureDetectionPassthroughRegionInternal,
+                        this,
+                        displayId,
+                        region));
+    }
+
+    @Override
+    public void setTouchExplorationPassthroughRegion(int displayId, Region region) {
+        mMainHandler.sendMessage(
+                obtainMessage(
+                        AccessibilityManagerService::setTouchExplorationPassthroughRegionInternal,
+                        this,
+                        displayId,
+                        region));
+    }
+
+    private void setTouchExplorationPassthroughRegionInternal(int displayId, Region region) {
+        synchronized (mLock) {
+            if (mHasInputFilter && mInputFilter != null) {
+                mInputFilter.setTouchExplorationPassthroughRegion(displayId, region);
+            }
+        }
+    }
+
+    private void setGestureDetectionPassthroughRegionInternal(int displayId, Region region) {
+        synchronized (mLock) {
+            if (mHasInputFilter && mInputFilter != null) {
+                mInputFilter.setGestureDetectionPassthroughRegion(displayId, region);
+            }
+        }
+    }
 }
diff --git a/services/accessibility/java/com/android/server/accessibility/AccessibilityWindowManager.java b/services/accessibility/java/com/android/server/accessibility/AccessibilityWindowManager.java
index 8c00581..446e882 100644
--- a/services/accessibility/java/com/android/server/accessibility/AccessibilityWindowManager.java
+++ b/services/accessibility/java/com/android/server/accessibility/AccessibilityWindowManager.java
@@ -43,6 +43,7 @@
 import android.view.accessibility.AccessibilityWindowInfo;
 import android.view.accessibility.IAccessibilityInteractionConnection;
 
+import com.android.internal.annotations.VisibleForTesting;
 import com.android.server.accessibility.AccessibilitySecurityPolicy.AccessibilityUserManager;
 import com.android.server.wm.WindowManagerInternal;
 
@@ -781,7 +782,9 @@
     /**
      * Wrapper of accessibility interaction connection for window.
      */
-    final class RemoteAccessibilityConnection implements IBinder.DeathRecipient {
+    // In order to avoid using DexmakerShareClassLoaderRule, make this class visible for testing.
+    @VisibleForTesting(visibility = VisibleForTesting.Visibility.PACKAGE)
+    public final class RemoteAccessibilityConnection implements IBinder.DeathRecipient {
         private final int mUid;
         private final String mPackageName;
         private final int mWindowId;
diff --git a/services/accessibility/java/com/android/server/accessibility/SystemActionPerformer.java b/services/accessibility/java/com/android/server/accessibility/SystemActionPerformer.java
index 11dcfef..ef8d524 100644
--- a/services/accessibility/java/com/android/server/accessibility/SystemActionPerformer.java
+++ b/services/accessibility/java/com/android/server/accessibility/SystemActionPerformer.java
@@ -193,7 +193,8 @@
     /**
      * This method returns the list of available system actions.
      */
-    List<AccessibilityAction> getSystemActions() {
+    @VisibleForTesting(visibility = VisibleForTesting.Visibility.PACKAGE)
+    public List<AccessibilityAction> getSystemActions() {
         List<AccessibilityAction> systemActions = new ArrayList<>();
         synchronized (mSystemActionLock) {
             for (Map.Entry<Integer, RemoteAction> entry : mRegisteredSystemActions.entrySet()) {
diff --git a/services/accessibility/java/com/android/server/accessibility/gestures/TouchExplorer.java b/services/accessibility/java/com/android/server/accessibility/gestures/TouchExplorer.java
index 2cc11c5..61c6ef5 100644
--- a/services/accessibility/java/com/android/server/accessibility/gestures/TouchExplorer.java
+++ b/services/accessibility/java/com/android/server/accessibility/gestures/TouchExplorer.java
@@ -23,6 +23,7 @@
 import android.accessibilityservice.AccessibilityGestureEvent;
 import android.content.Context;
 import android.graphics.Point;
+import android.graphics.Region;
 import android.os.Handler;
 import android.util.Slog;
 import android.view.InputDevice;
@@ -120,6 +121,8 @@
     // Context in which this explorer operates.
     private final Context mContext;
 
+    private Region mGestureDetectionPassthroughRegion;
+    private Region mTouchExplorationPassthroughRegion;
 
 /**
      * Creates a new instance.
@@ -165,6 +168,8 @@
         } else {
             mGestureDetector = detector;
         }
+        mGestureDetectionPassthroughRegion = new Region();
+        mTouchExplorationPassthroughRegion = new Region();
     }
 
     @Override
@@ -230,10 +235,11 @@
         }
 
         mState.onReceivedMotionEvent(rawEvent);
-
-        if (mGestureDetector.onMotionEvent(event, rawEvent, policyFlags)) {
-            // Event was handled by the gesture detector.
-            return;
+        if (shouldPerformGestureDetection(event)) {
+            if (mGestureDetector.onMotionEvent(event, rawEvent, policyFlags)) {
+                // Event was handled by the gesture detector.
+                return;
+            }
         }
 
         if (event.getActionMasked() == MotionEvent.ACTION_CANCEL) {
@@ -418,6 +424,21 @@
             mSendTouchExplorationEndDelayed.forceSendAndRemove();
             mSendTouchInteractionEndDelayed.forceSendAndRemove();
             mDispatcher.sendAccessibilityEvent(AccessibilityEvent.TYPE_TOUCH_INTERACTION_START);
+            if (mTouchExplorationPassthroughRegion.contains(
+                    (int) event.getX(), (int) event.getY())) {
+                // The touch exploration passthrough overrides the gesture detection passthrough in
+                // the event they overlap.
+                // Pass this entire gesture through to the system as-is.
+                mState.startDelegating();
+                event = MotionEvent.obtainNoHistory(event);
+                mDispatcher.sendMotionEvent(
+                        event, event.getAction(), rawEvent, ALL_POINTER_ID_BITS, policyFlags);
+                mSendHoverEnterAndMoveDelayed.cancel();
+            } else if (mGestureDetectionPassthroughRegion.contains(
+                    (int) event.getX(), (int) event.getY())) {
+                // Jump straight to touch exploration.
+                mSendHoverEnterAndMoveDelayed.forceSendAndRemove();
+            }
         } else {
             // Avoid duplicated TYPE_TOUCH_INTERACTION_START event when 2nd tap of double tap.
             mSendTouchInteractionEndDelayed.cancel();
@@ -909,6 +930,29 @@
         mGestureDetector.setMultiFingerGesturesEnabled(enabled);
     }
 
+    public void setGestureDetectionPassthroughRegion(Region region) {
+        mGestureDetectionPassthroughRegion = region;
+    }
+
+    public void setTouchExplorationPassthroughRegion(Region region) {
+        mTouchExplorationPassthroughRegion = region;
+    }
+
+    private boolean shouldPerformGestureDetection(MotionEvent event) {
+        if (mState.isDelegating()) {
+            return false;
+        }
+        if (event.getActionMasked() == MotionEvent.ACTION_DOWN) {
+            final int x = (int) event.getX();
+            final int y = (int) event.getY();
+            if (mTouchExplorationPassthroughRegion.contains(x, y)
+                    || mGestureDetectionPassthroughRegion.contains(x, y)) {
+                return false;
+            }
+        }
+        return true;
+    }
+
     /**
      * Class for delayed exiting from gesture detecting mode.
      */
@@ -1135,5 +1179,4 @@
                 + ", mTempPoint: " + mTempPoint
                 + " }";
     }
-
 }
diff --git a/services/api/lint-baseline.txt b/services/api/lint-baseline.txt
new file mode 100644
index 0000000..0b8658c
--- /dev/null
+++ b/services/api/lint-baseline.txt
@@ -0,0 +1,35 @@
+// Baseline format: 1.0
+InternalClasses: com.android.permission.persistence.RuntimePermissionsPersistence:
+    Internal classes must not be exposed
+InternalClasses: com.android.permission.persistence.RuntimePermissionsState:
+    Internal classes must not be exposed
+InternalClasses: com.android.permission.persistence.RuntimePermissionsState.PermissionState:
+    Internal classes must not be exposed
+InternalClasses: com.android.role.persistence.RolesPersistence:
+    Internal classes must not be exposed
+InternalClasses: com.android.role.persistence.RolesState:
+    Internal classes must not be exposed
+InternalClasses: com.android.server.SystemService:
+    Internal classes must not be exposed
+InternalClasses: com.android.server.SystemService.TargetUser:
+    Internal classes must not be exposed
+
+
+ProtectedMember: com.android.server.SystemService#publishBinderService(String, android.os.IBinder):
+    Protected methods not allowed; must be public: method com.android.server.SystemService.publishBinderService(String,android.os.IBinder)}
+ProtectedMember: com.android.server.SystemService#publishBinderService(String, android.os.IBinder, boolean):
+    Protected methods not allowed; must be public: method com.android.server.SystemService.publishBinderService(String,android.os.IBinder,boolean)}
+
+
+UserHandleName: com.android.permission.persistence.RuntimePermissionsPersistence#delete(android.os.UserHandle):
+    Method taking UserHandle should be named `doFooAsUser` or `queryFooForUser`, was `delete`
+UserHandleName: com.android.permission.persistence.RuntimePermissionsPersistence#read(android.os.UserHandle):
+    Method taking UserHandle should be named `doFooAsUser` or `queryFooForUser`, was `read`
+UserHandleName: com.android.permission.persistence.RuntimePermissionsPersistence#write(com.android.permission.persistence.RuntimePermissionsState, android.os.UserHandle):
+    Method taking UserHandle should be named `doFooAsUser` or `queryFooForUser`, was `write`
+UserHandleName: com.android.role.persistence.RolesPersistence#delete(android.os.UserHandle):
+    Method taking UserHandle should be named `doFooAsUser` or `queryFooForUser`, was `delete`
+UserHandleName: com.android.role.persistence.RolesPersistence#read(android.os.UserHandle):
+    Method taking UserHandle should be named `doFooAsUser` or `queryFooForUser`, was `read`
+UserHandleName: com.android.role.persistence.RolesPersistence#write(com.android.role.persistence.RolesState, android.os.UserHandle):
+    Method taking UserHandle should be named `doFooAsUser` or `queryFooForUser`, was `write`
diff --git a/services/autofill/java/com/android/server/autofill/Session.java b/services/autofill/java/com/android/server/autofill/Session.java
index 697e5d7..f544517 100644
--- a/services/autofill/java/com/android/server/autofill/Session.java
+++ b/services/autofill/java/com/android/server/autofill/Session.java
@@ -2624,6 +2624,8 @@
                 mService.getServicePackageName(), mComponentName,
                 serviceLabel, serviceIcon, this, id, mCompatMode);
 
+        mService.logDatasetShown(id, mClientState);
+
         synchronized (mLock) {
             if (mUiShownTime == 0) {
                 // Log first time UI is shown.
diff --git a/services/core/java/android/content/pm/PackageManagerInternal.java b/services/core/java/android/content/pm/PackageManagerInternal.java
index 63d0924..76f6ef6 100644
--- a/services/core/java/android/content/pm/PackageManagerInternal.java
+++ b/services/core/java/android/content/pm/PackageManagerInternal.java
@@ -69,6 +69,25 @@
     public static final int PACKAGE_COMPANION = 14;
     public static final int PACKAGE_RETAIL_DEMO = 15;
 
+    @IntDef(flag = true, prefix = "RESOLVE_", value = {
+            RESOLVE_NON_BROWSER_ONLY,
+            RESOLVE_NON_RESOLVER_ONLY
+    })
+    @Retention(RetentionPolicy.SOURCE)
+    public @interface PrivateResolveFlags {}
+
+    /**
+     * Internal {@link #resolveIntent(Intent, String, int, int, int, boolean, int)} flag:
+     * only match components that contain a generic web intent filter.
+     */
+    public static final int RESOLVE_NON_BROWSER_ONLY = 0x00000001;
+
+    /**
+     * Internal {@link #resolveIntent(Intent, String, int, int, int, boolean, int)} flag: do not
+     * match to the resolver.
+     */
+    public static final int RESOLVE_NON_RESOLVER_ONLY = 0x00000002;
+
     @IntDef(value = {
             INTEGRITY_VERIFICATION_ALLOW,
             INTEGRITY_VERIFICATION_REJECT,
@@ -507,7 +526,8 @@
      * Resolves an activity intent, allowing instant apps to be resolved.
      */
     public abstract ResolveInfo resolveIntent(Intent intent, String resolvedType,
-            int flags, int userId, boolean resolveForStart, int filterCallingUid);
+            int flags, @PrivateResolveFlags int privateResolveFlags, int userId,
+            boolean resolveForStart, int filterCallingUid);
 
     /**
     * Resolves a service intent, allowing instant apps to be resolved.
@@ -925,4 +945,9 @@
      */
     public abstract void setIntegrityVerificationResult(int verificationId,
             @IntegrityVerificationResult int verificationResult);
+
+    /**
+     * Returns MIME types contained in {@code mimeGroup} from {@code packageName} package
+     */
+    public abstract List<String> getMimeGroup(String packageName, String mimeGroup);
 }
diff --git a/services/core/java/com/android/server/ConnectivityService.java b/services/core/java/com/android/server/ConnectivityService.java
index 0f36260..f7eabac 100644
--- a/services/core/java/com/android/server/ConnectivityService.java
+++ b/services/core/java/com/android/server/ConnectivityService.java
@@ -3430,16 +3430,16 @@
             // there is hope for it to become one if it validated, then it is needed.
             ensureRunningOnConnectivityServiceThread();
             if (nri.request.isRequest() && nai.satisfies(nri.request) &&
-                    (nai.isSatisfyingRequest(nri.request.requestId) ||
-                    // Note that this catches two important cases:
-                    // 1. Unvalidated cellular will not be reaped when unvalidated WiFi
-                    //    is currently satisfying the request.  This is desirable when
-                    //    cellular ends up validating but WiFi does not.
-                    // 2. Unvalidated WiFi will not be reaped when validated cellular
-                    //    is currently satisfying the request.  This is desirable when
-                    //    WiFi ends up validating and out scoring cellular.
-                    nri.mSatisfier.getCurrentScore()
-                            < nai.getCurrentScoreAsValidated())) {
+                    (nai.isSatisfyingRequest(nri.request.requestId)
+                    // Note that canPossiblyBeat catches two important cases:
+                    // 1. Unvalidated slow networks will not be reaped when an unvalidated fast
+                    // network is currently satisfying the request. This is desirable for example
+                    // when cellular ends up validating but WiFi/Ethernet does not.
+                    // 2. Fast networks will not be reaped when a validated slow network is
+                    // currently satisfying the request. This is desirable for example when
+                    // Ethernet ends up validating and out scoring WiFi, or WiFi/Ethernet ends
+                    // up validating and out scoring cellular.
+                            || nai.canPossiblyBeat(nri.mSatisfier))) {
                 return false;
             }
         }
@@ -4791,7 +4791,7 @@
                 return false;
             }
 
-            return vpn.startAlwaysOnVpn();
+            return vpn.startAlwaysOnVpn(mKeyStore);
         }
     }
 
@@ -4806,7 +4806,7 @@
                 Slog.w(TAG, "User " + userId + " has no Vpn configuration");
                 return false;
             }
-            return vpn.isAlwaysOnPackageSupported(packageName);
+            return vpn.isAlwaysOnPackageSupported(packageName, mKeyStore);
         }
     }
 
@@ -4827,11 +4827,11 @@
                 Slog.w(TAG, "User " + userId + " has no Vpn configuration");
                 return false;
             }
-            if (!vpn.setAlwaysOnPackage(packageName, lockdown, lockdownWhitelist)) {
+            if (!vpn.setAlwaysOnPackage(packageName, lockdown, lockdownWhitelist, mKeyStore)) {
                 return false;
             }
             if (!startAlwaysOnVpn(userId)) {
-                vpn.setAlwaysOnPackage(null, false, null);
+                vpn.setAlwaysOnPackage(null, false, null, mKeyStore);
                 return false;
             }
         }
@@ -5017,7 +5017,7 @@
                 loge("Starting user already has a VPN");
                 return;
             }
-            userVpn = new Vpn(mHandler.getLooper(), mContext, mNMS, userId);
+            userVpn = new Vpn(mHandler.getLooper(), mContext, mNMS, userId, mKeyStore);
             mVpns.put(userId, userVpn);
             if (mUserManager.getUserInfo(userId).isPrimary() && LockdownVpnTracker.isEnabled()) {
                 updateLockdownVpn();
@@ -5088,7 +5088,7 @@
             if (TextUtils.equals(vpn.getAlwaysOnPackage(), packageName)) {
                 Slog.d(TAG, "Restarting always-on VPN package " + packageName + " for user "
                         + userId);
-                vpn.startAlwaysOnVpn();
+                vpn.startAlwaysOnVpn(mKeyStore);
             }
         }
     }
@@ -5110,7 +5110,7 @@
             if (TextUtils.equals(vpn.getAlwaysOnPackage(), packageName) && !isReplacing) {
                 Slog.d(TAG, "Removing always-on VPN package " + packageName + " for user "
                         + userId);
-                vpn.setAlwaysOnPackage(null, false, null);
+                vpn.setAlwaysOnPackage(null, false, null, mKeyStore);
             }
         }
     }
diff --git a/services/core/java/com/android/server/IntentResolver.java b/services/core/java/com/android/server/IntentResolver.java
index deb94bd..05820d2 100644
--- a/services/core/java/com/android/server/IntentResolver.java
+++ b/services/core/java/com/android/server/IntentResolver.java
@@ -194,7 +194,7 @@
         mFilters.remove(f);
     }
 
-    void removeFilterInternal(F f) {
+    protected void removeFilterInternal(F f) {
         if (localLOGV) {
             Slog.v(TAG, "Removing filter: " + f);
             f.dump(new LogPrinter(Log.VERBOSE, TAG, Log.LOG_ID_SYSTEM), "      ");
@@ -651,7 +651,7 @@
         return num;
     }
 
-    private final int register_intent_filter(F filter, Iterator<String> i,
+    protected final int register_intent_filter(F filter, Iterator<String> i,
             ArrayMap<String, F[]> dest, String prefix) {
         if (i == null) {
             return 0;
@@ -667,7 +667,7 @@
         return num;
     }
 
-    private final int unregister_intent_filter(F filter, Iterator<String> i,
+    protected final int unregister_intent_filter(F filter, Iterator<String> i,
             ArrayMap<String, F[]> dest, String prefix) {
         if (i == null) {
             return 0;
@@ -836,7 +836,7 @@
     /**
      * All filters that have been registered.
      */
-    private final ArraySet<F> mFilters = new ArraySet<F>();
+    protected final ArraySet<F> mFilters = new ArraySet<F>();
 
     /**
      * All of the MIME types that have been registered, such as "image/jpeg",
diff --git a/services/core/java/com/android/server/LocationManagerService.java b/services/core/java/com/android/server/LocationManagerService.java
index 7aa4661..5db5115 100644
--- a/services/core/java/com/android/server/LocationManagerService.java
+++ b/services/core/java/com/android/server/LocationManagerService.java
@@ -213,11 +213,6 @@
     private PackageManager mPackageManager;
     private PowerManager mPowerManager;
 
-    // TODO: sharing a location fudger with mock providers can leak information as the mock provider
-    //   can be used to retrieve offset information. the fudger should likely be reset whenever mock
-    //   providers are added or removed
-    private LocationFudger mLocationFudger;
-
     private GeofenceManager mGeofenceManager;
     private GeocoderProxy mGeocodeProvider;
 
@@ -285,8 +280,6 @@
             mPackageManager = mContext.getPackageManager();
             mAppOps = mContext.getSystemService(AppOpsManager.class);
             mPowerManager = mContext.getSystemService(PowerManager.class);
-
-            mLocationFudger = new LocationFudger(mSettingsHelper.getCoarseLocationAccuracyM());
             mGeofenceManager = new GeofenceManager(mContext, mSettingsHelper);
 
             PowerManagerInternal localPowerManager =
@@ -663,6 +656,8 @@
 
         private final String mName;
 
+        private final LocationFudger mLocationFudger;
+
         // if the provider is enabled for a given user id - null or not present means unknown
         @GuardedBy("mLock")
         private final SparseArray<Boolean> mEnabled;
@@ -680,6 +675,7 @@
 
         private LocationProviderManager(String name) {
             mName = name;
+            mLocationFudger = new LocationFudger(mSettingsHelper.getCoarseLocationAccuracyM());
             mEnabled = new SparseArray<>(2);
             mLastLocation = new SparseArray<>(2);
             mLastCoarseLocation = new SparseArray<>(2);
@@ -704,7 +700,9 @@
             synchronized (mLock) {
                 mProvider.setMockProvider(provider);
 
-                // when removing a mock provider, also clear any mock last locations
+                // when removing a mock provider, also clear any mock last locations and reset the
+                // location fudger. the mock provider could have been used to infer the current
+                // location fudger offsets.
                 if (provider == null) {
                     for (int i = 0; i < mLastLocation.size(); i++) {
                         Location lastLocation = mLastLocation.valueAt(i);
@@ -719,6 +717,8 @@
                             mLastCoarseLocation.setValueAt(i, null);
                         }
                     }
+
+                    mLocationFudger.resetOffsets();
                 }
             }
         }
@@ -1452,7 +1452,7 @@
         }
 
         throw new SecurityException("uid " + Binder.getCallingUid() + " does not have "
-            + ACCESS_COARSE_LOCATION + " or " + ACCESS_FINE_LOCATION + ".");
+                + ACCESS_COARSE_LOCATION + " or " + ACCESS_FINE_LOCATION + ".");
     }
 
     private void enforceCallingOrSelfPackageName(String packageName) {
@@ -1830,8 +1830,8 @@
 
             // Update statistics for historical location requests by package/provider
             mRequestStatistics.startRequesting(
-                    mReceiver.mCallerIdentity.mPackageName, provider, request.getInterval(),
-                    mIsForegroundUid);
+                    mReceiver.mCallerIdentity.mPackageName, mReceiver.mCallerIdentity.mFeatureId,
+                    provider, request.getInterval(), mIsForegroundUid);
         }
 
         /**
@@ -1840,7 +1840,8 @@
         private void updateForeground(boolean isForeground) {
             mIsForegroundUid = isForeground;
             mRequestStatistics.updateForeground(
-                    mReceiver.mCallerIdentity.mPackageName, mProvider, isForeground);
+                    mReceiver.mCallerIdentity.mPackageName, mReceiver.mCallerIdentity.mFeatureId,
+                    mProvider, isForeground);
         }
 
         /**
@@ -1848,7 +1849,8 @@
          */
         private void disposeLocked(boolean removeReceiver) {
             String packageName = mReceiver.mCallerIdentity.mPackageName;
-            mRequestStatistics.stopRequesting(packageName, mProvider);
+            mRequestStatistics.stopRequesting(packageName, mReceiver.mCallerIdentity.mFeatureId,
+                    mProvider);
 
             mLocationUsageLogger.logLocationApiUsage(
                     LocationStatsEnums.USAGE_ENDED,
@@ -1883,6 +1885,10 @@
             StringBuilder b = new StringBuilder("UpdateRecord[");
             b.append(mProvider).append(" ");
             b.append(mReceiver.mCallerIdentity.mPackageName);
+            String featureId = mReceiver.mCallerIdentity.mFeatureId;
+            if (featureId != null) {
+                b.append(" ").append(featureId).append(" ");
+            }
             b.append("(").append(mReceiver.mCallerIdentity.mUid);
             if (mIsForegroundUid) {
                 b.append(" foreground");
@@ -2886,7 +2892,7 @@
             for (Map.Entry<PackageProviderKey, PackageStatistics> entry
                     : sorted.entrySet()) {
                 PackageProviderKey key = entry.getKey();
-                ipw.println(key.providerName + ": " + key.packageName + ": " + entry.getValue());
+                ipw.println(key.mPackageName + ": " + key.mProviderName + ": " + entry.getValue());
             }
             ipw.decreaseIndent();
 
diff --git a/services/core/java/com/android/server/StorageManagerService.java b/services/core/java/com/android/server/StorageManagerService.java
index 53dbb93..d86b223 100644
--- a/services/core/java/com/android/server/StorageManagerService.java
+++ b/services/core/java/com/android/server/StorageManagerService.java
@@ -2120,8 +2120,6 @@
 
     private void unmount(VolumeInfo vol) {
         try {
-            mVold.unmount(vol.id);
-            mStorageSessionController.onVolumeUnmount(vol);
             try {
                 if (vol.type == VolumeInfo.TYPE_PRIVATE) {
                     mInstaller.onPrivateVolumeRemoved(vol.getFsUuid());
@@ -2129,6 +2127,8 @@
             } catch (Installer.InstallerException e) {
                 Slog.e(TAG, "Failed unmount mirror data", e);
             }
+            mVold.unmount(vol.id);
+            mStorageSessionController.onVolumeUnmount(vol);
         } catch (Exception e) {
             Slog.wtf(TAG, e);
         }
@@ -4346,6 +4346,42 @@
             mPolicies.add(policy);
         }
 
+        /**
+         * Check if fuse is running in target user, if it's running then setup its obb directories.
+         * TODO: System server should store a list of active pids that obb is not mounted and use it.
+         */
+        @Override
+        public void prepareObbDirs(int userId, Set<String> packageList, String processName) {
+            String fuseRunningUsersList = SystemProperties.get("vold.fuse_running_users", "");
+            String[] fuseRunningUsers = fuseRunningUsersList.split(",");
+            boolean fuseReady = false;
+            String targetUserId = String.valueOf(userId);
+            for (String user : fuseRunningUsers) {
+                if (targetUserId.equals(user)) {
+                    fuseReady = true;
+                }
+            }
+            if (fuseReady) {
+                try {
+                    final IVold vold = IVold.Stub.asInterface(
+                            ServiceManager.getServiceOrThrow("vold"));
+                    for (String pkg : packageList) {
+                        final String obbDir =
+                                String.format("/storage/emulated/%d/Android/obb", userId);
+                        final String packageObbDir = String.format("%s/%s/", obbDir, pkg);
+
+                        // Create package obb dir if it doesn't exist.
+                        File file = new File(packageObbDir);
+                        if (!file.exists()) {
+                            vold.setupAppDir(packageObbDir, mPmInternal.getPackage(pkg).getUid());
+                        }
+                    }
+                } catch (ServiceManager.ServiceNotFoundException | RemoteException e) {
+                    Slog.e(TAG, "Unable to create obb directories for " + processName, e);
+                }
+            }
+        }
+
         @Override
         public void onExternalStoragePolicyChanged(int uid, String packageName) {
             final int mountMode = getExternalStorageMountMode(uid, packageName);
@@ -4409,6 +4445,25 @@
             }
         }
 
+        @Override
+        public void prepareAppDataAfterInstall(String packageName, int uid) {
+            int userId = UserHandle.getUserId(uid);
+            final Environment.UserEnvironment userEnv = new Environment.UserEnvironment(userId);
+
+            // The installer may have downloaded OBBs for this newly installed application;
+            // make sure the OBB dir for the application is setup correctly, if it exists.
+            File[] packageObbDirs = userEnv.buildExternalStorageAppObbDirs(packageName);
+            for (File packageObbDir : packageObbDirs) {
+                try {
+                    mVold.fixupAppDir(packageObbDir.getCanonicalPath() + "/", uid);
+                } catch (IOException e) {
+                    Log.e(TAG, "Failed to get canonical path for " + packageName);
+                } catch (RemoteException e) {
+                    Log.e(TAG, "Failed to fixup app dir for " + packageName);
+                }
+            }
+        }
+
         public boolean hasExternalStorage(int uid, String packageName) {
             // No need to check for system uid. This avoids a deadlock between
             // PackageManagerService and AppOpsService.
diff --git a/services/core/java/com/android/server/am/ActiveServices.java b/services/core/java/com/android/server/am/ActiveServices.java
index 97b5eaa..50f43b5 100644
--- a/services/core/java/com/android/server/am/ActiveServices.java
+++ b/services/core/java/com/android/server/am/ActiveServices.java
@@ -49,6 +49,7 @@
 import android.app.PendingIntent;
 import android.app.Service;
 import android.app.ServiceStartArgs;
+import android.app.admin.DevicePolicyEventLogger;
 import android.appwidget.AppWidgetManagerInternal;
 import android.content.ComponentName;
 import android.content.ComponentName.WithComponentName;
@@ -79,6 +80,8 @@
 import android.os.TransactionTooLargeException;
 import android.os.UserHandle;
 import android.provider.Settings;
+import android.stats.devicepolicy.DevicePolicyEnums;
+import android.text.TextUtils;
 import android.util.ArrayMap;
 import android.util.ArraySet;
 import android.util.EventLog;
@@ -187,6 +190,9 @@
 
     AppWidgetManagerInternal mAppWidgetManagerInternal;
 
+    // white listed packageName.
+    ArraySet<String> mWhiteListAllowWhileInUsePermissionInFgs = new ArraySet<>();
+
     final Runnable mLastAnrDumpClearer = new Runnable() {
         @Override public void run() {
             synchronized (mAm) {
@@ -389,6 +395,20 @@
         AppStateTracker ast = LocalServices.getService(AppStateTracker.class);
         ast.addListener(new ForcedStandbyListener());
         mAppWidgetManagerInternal = LocalServices.getService(AppWidgetManagerInternal.class);
+        setWhiteListAllowWhileInUsePermissionInFgs();
+    }
+
+    private void setWhiteListAllowWhileInUsePermissionInFgs() {
+        final String attentionServicePackageName =
+                mAm.mContext.getPackageManager().getAttentionServicePackageName();
+        if (!TextUtils.isEmpty(attentionServicePackageName)) {
+            mWhiteListAllowWhileInUsePermissionInFgs.add(attentionServicePackageName);
+        }
+        final String systemCaptionsServicePackageName =
+                mAm.mContext.getPackageManager().getSystemCaptionsServicePackageName();
+        if (!TextUtils.isEmpty(systemCaptionsServicePackageName)) {
+            mWhiteListAllowWhileInUsePermissionInFgs.add(systemCaptionsServicePackageName);
+        }
     }
 
     ServiceRecord getServiceByNameLocked(ComponentName name, int callingUser) {
@@ -1894,6 +1914,8 @@
                 requestServiceBindingLocked(s, b.intent, callerFg, false);
             }
 
+            maybeLogBindCrossProfileService(userId, callingPackage, callerApp.info.uid);
+
             getServiceMapLocked(s.userId).ensureNotStartingBackgroundLocked(s);
 
         } finally {
@@ -1903,6 +1925,21 @@
         return 1;
     }
 
+    private void maybeLogBindCrossProfileService(
+            int userId, String callingPackage, int callingUid) {
+        if (UserHandle.isCore(callingUid)) {
+            return;
+        }
+        final int callingUserId = UserHandle.getCallingUserId();
+        if (callingUserId == userId
+                || !mAm.mUserController.isSameProfileGroup(callingUserId, userId)) {
+            return;
+        }
+        DevicePolicyEventLogger.createEvent(DevicePolicyEnums.BIND_CROSS_PROFILE_SERVICE)
+                .setStrings(callingPackage)
+                .write();
+    }
+
     void publishServiceLocked(ServiceRecord r, Intent intent, IBinder service) {
         final long origId = Binder.clearCallingIdentity();
         try {
@@ -4634,6 +4671,12 @@
             return true;
         }
 
+        final boolean isWhiteListedPackage =
+                mWhiteListAllowWhileInUsePermissionInFgs.contains(callingPackage);
+        if (isWhiteListedPackage) {
+            return true;
+        }
+
         r.mInfoDenyWhileInUsePermissionInFgs =
                 "Background FGS start while-in-use permission restriction [callingPackage: "
                 + callingPackage
diff --git a/services/core/java/com/android/server/am/ActivityManagerConstants.java b/services/core/java/com/android/server/am/ActivityManagerConstants.java
index fabe92db..8fbe923 100644
--- a/services/core/java/com/android/server/am/ActivityManagerConstants.java
+++ b/services/core/java/com/android/server/am/ActivityManagerConstants.java
@@ -19,12 +19,16 @@
 import static com.android.server.am.ActivityManagerDebugConfig.DEBUG_POWER_QUICK;
 
 import android.app.ActivityThread;
+import android.content.ComponentName;
 import android.content.ContentResolver;
 import android.content.Context;
+import android.content.pm.UserInfo;
 import android.database.ContentObserver;
 import android.net.Uri;
 import android.os.Build;
 import android.os.Handler;
+import android.os.UserHandle;
+import android.os.UserManager;
 import android.provider.DeviceConfig;
 import android.provider.DeviceConfig.OnPropertiesChangedListener;
 import android.provider.DeviceConfig.Properties;
@@ -33,6 +37,7 @@
 import android.util.ArraySet;
 import android.util.KeyValueListParser;
 import android.util.Slog;
+import android.util.SparseArray;
 
 import java.io.PrintWriter;
 import java.util.Arrays;
@@ -289,6 +294,12 @@
     // started, the restriction is on while-in-use permissions.)
     volatile boolean mFlagBackgroundFgsStartRestrictionEnabled = true;
 
+    /**
+     * UserId to Assistant ComponentName mapping.
+     * Per user Assistant ComponentName is from {@link android.provider.Settings.Secure#ASSISTANT}
+     */
+    SparseArray<ComponentName> mAssistants = new SparseArray<>();
+
     private final ActivityManagerService mService;
     private ContentResolver mResolver;
     private final KeyValueListParser mParser = new KeyValueListParser(',');
@@ -364,6 +375,8 @@
                 Settings.Global.getUriFor(
                         Settings.Global.FOREGROUND_SERVICE_STARTS_LOGGING_ENABLED);
 
+    private static final Uri ASSISTANT_URI = Settings.Secure.getUriFor(Settings.Secure.ASSISTANT);
+
     private static final Uri ENABLE_AUTOMATIC_SYSTEM_SERVER_HEAP_DUMPS_URI =
             Settings.Global.getUriFor(Settings.Global.ENABLE_AUTOMATIC_SYSTEM_SERVER_HEAP_DUMPS);
 
@@ -430,6 +443,8 @@
         mResolver.registerContentObserver(ACTIVITY_STARTS_LOGGING_ENABLED_URI, false, this);
         mResolver.registerContentObserver(FOREGROUND_SERVICE_STARTS_LOGGING_ENABLED_URI,
                 false, this);
+        mResolver.registerContentObserver(ASSISTANT_URI, false, this,
+                UserHandle.USER_ALL);
         if (mSystemServerAutomaticHeapDumpEnabled) {
             mResolver.registerContentObserver(ENABLE_AUTOMATIC_SYSTEM_SERVER_HEAP_DUMPS_URI,
                     false, this);
@@ -445,6 +460,7 @@
         // The following read from Settings.
         updateActivityStartsLoggingEnabled();
         updateForegroundServiceStartsLoggingEnabled();
+        updateAssistant();
     }
 
     private void loadDeviceConfigConstants() {
@@ -476,6 +492,8 @@
             updateForegroundServiceStartsLoggingEnabled();
         } else if (ENABLE_AUTOMATIC_SYSTEM_SERVER_HEAP_DUMPS_URI.equals(uri)) {
             updateEnableAutomaticSystemServerHeapDumps();
+        } else if (ASSISTANT_URI.equals(uri)) {
+            updateAssistant();
         }
     }
 
@@ -573,6 +591,31 @@
                 Settings.Global.FOREGROUND_SERVICE_STARTS_LOGGING_ENABLED, 1) == 1;
     }
 
+    private void updateAssistant() {
+        final List<UserInfo> users =
+                mService.mContext.getSystemService(UserManager.class).getUsers();
+        SparseArray<ComponentName> componentNames = new SparseArray<>();
+        for (int i = 0; i < users.size(); i++) {
+            final int userId = users.get(i).id;
+            final String str = Settings.Secure.getStringForUser(mResolver,
+                    Settings.Secure.ASSISTANT, userId);
+            if (!TextUtils.isEmpty(str)) {
+                componentNames.put(userId, ComponentName.unflattenFromString(str));
+            }
+        }
+        synchronized (mService) {
+            for (int i = 0; i < mAssistants.size(); i++) {
+                mService.mServices.mWhiteListAllowWhileInUsePermissionInFgs.remove(
+                        mAssistants.valueAt(i).getPackageName());
+            }
+            mAssistants = componentNames;
+            for (int i = 0; i < mAssistants.size(); i++) {
+                mService.mServices.mWhiteListAllowWhileInUsePermissionInFgs.add(
+                        mAssistants.valueAt(i).getPackageName());
+            }
+        }
+    }
+
     private void updateBackgroundFgsStartsRestriction() {
         mFlagBackgroundFgsStartRestrictionEnabled = DeviceConfig.getBoolean(
                 DeviceConfig.NAMESPACE_ACTIVITY_MANAGER,
@@ -581,9 +624,6 @@
     }
 
     private void updateOomAdjUpdatePolicy() {
-
-
-
         OOMADJ_UPDATE_QUICK = DeviceConfig.getInt(
                 DeviceConfig.NAMESPACE_ACTIVITY_MANAGER,
                 KEY_OOMADJ_UPDATE_POLICY,
diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java
index 5df3e1f..9082807 100644
--- a/services/core/java/com/android/server/am/ActivityManagerService.java
+++ b/services/core/java/com/android/server/am/ActivityManagerService.java
@@ -468,18 +468,9 @@
     // How long we wait for a launched process to attach to the activity manager
     // before we decide it's never going to come up for real.
     static final int PROC_START_TIMEOUT = 10*1000;
-    // How long we wait for an attached process to publish its content providers
-    // before we decide it must be hung.
-    static final int CONTENT_PROVIDER_PUBLISH_TIMEOUT = 10*1000;
-
     // How long we wait to kill an application zygote, after the last process using
     // it has gone away.
     static final int KILL_APP_ZYGOTE_DELAY_MS = 5 * 1000;
-    /**
-     * How long we wait for an provider to be published. Should be longer than
-     * {@link #CONTENT_PROVIDER_PUBLISH_TIMEOUT}.
-     */
-    static final int CONTENT_PROVIDER_WAIT_TIMEOUT = 20 * 1000;
 
     // How long we wait for a launched process to attach to the activity manager
     // before we decide it's never going to come up for real, when the process was
@@ -4984,7 +4975,8 @@
         if (providers != null && checkAppInLaunchingProvidersLocked(app)) {
             Message msg = mHandler.obtainMessage(CONTENT_PROVIDER_PUBLISH_TIMEOUT_MSG);
             msg.obj = app;
-            mHandler.sendMessageDelayed(msg, CONTENT_PROVIDER_PUBLISH_TIMEOUT);
+            mHandler.sendMessageDelayed(msg,
+                    ContentResolver.CONTENT_PROVIDER_PUBLISH_TIMEOUT_MILLIS);
         }
 
         checkTime(startTime, "attachApplicationLocked: before bindApplication");
@@ -7273,7 +7265,8 @@
         }
 
         // Wait for the provider to be published...
-        final long timeout = SystemClock.uptimeMillis() + CONTENT_PROVIDER_WAIT_TIMEOUT;
+        final long timeout =
+                SystemClock.uptimeMillis() + ContentResolver.CONTENT_PROVIDER_WAIT_TIMEOUT_MILLIS;
         boolean timedOut = false;
         synchronized (cpr) {
             while (cpr.provider == null) {
@@ -7310,12 +7303,14 @@
             }
         }
         if (timedOut) {
-            // Note we do it afer releasing the lock.
+            // Note we do it after releasing the lock.
             String callerName = "unknown";
-            synchronized (this) {
-                final ProcessRecord record = mProcessList.getLRURecordForAppLocked(caller);
-                if (record != null) {
-                    callerName = record.processName;
+            if (caller != null) {
+                synchronized (this) {
+                    final ProcessRecord record = mProcessList.getLRURecordForAppLocked(caller);
+                    if (record != null) {
+                        callerName = record.processName;
+                    }
                 }
             }
 
@@ -7949,6 +7944,8 @@
                     }
                     resultCallback.sendResult(result);
                 }));
+            } else {
+                resultCallback.sendResult(Bundle.EMPTY);
             }
         } catch (RemoteException e) {
             Log.w(TAG, "Content provider dead retrieving " + uri, e);
diff --git a/services/core/java/com/android/server/am/OomAdjuster.java b/services/core/java/com/android/server/am/OomAdjuster.java
index a651d9d..a2ae678 100644
--- a/services/core/java/com/android/server/am/OomAdjuster.java
+++ b/services/core/java/com/android/server/am/OomAdjuster.java
@@ -1994,12 +1994,11 @@
         if (app.hasForegroundServices()) {
             capability |= capabilityFromFGS;
         } else if (!ActivityManager.isProcStateBackground(procState)) {
-            // procState higher than PROCESS_STATE_TRANSIENT_BACKGROUND implicitly has
+            // procState higher than PROCESS_STATE_BOUND_FOREGROUND_SERVICE implicitly has
             // camera/microphone capability
             if (procState == PROCESS_STATE_FOREGROUND_SERVICE && procStateFromFGSClient) {
                 // if the FGS state is passed down from client, do not grant implicit capabilities.
             } else {
-                //TODO: remove this line when enforcing the feature.
                 capability |= PROCESS_CAPABILITY_ALL_IMPLICIT;
             }
         }
diff --git a/services/core/java/com/android/server/am/ProcessList.java b/services/core/java/com/android/server/am/ProcessList.java
index ffa7d92..0dc44f7 100644
--- a/services/core/java/com/android/server/am/ProcessList.java
+++ b/services/core/java/com/android/server/am/ProcessList.java
@@ -80,11 +80,13 @@
 import android.os.DropBoxManager;
 import android.os.Handler;
 import android.os.IBinder;
+import android.os.IVold;
 import android.os.Looper;
 import android.os.Message;
 import android.os.PowerManager;
 import android.os.Process;
 import android.os.RemoteException;
+import android.os.ServiceManager;
 import android.os.StrictMode;
 import android.os.SystemClock;
 import android.os.SystemProperties;
@@ -142,10 +144,14 @@
 public final class ProcessList {
     static final String TAG = TAG_WITH_CLASS_NAME ? "ProcessList" : TAG_AM;
 
-    // A device config to control the minimum target SDK to enable app data isolation
+    // A system property to control if app data isolation is enabled.
     static final String ANDROID_APP_DATA_ISOLATION_ENABLED_PROPERTY =
             "persist.zygote.app_data_isolation";
 
+    // A system property to control if obb app data isolation is enabled in vold.
+    static final String ANDROID_VOLD_APP_DATA_ISOLATION_ENABLED_PROPERTY =
+            "persist.sys.vold_app_data_isolation_enabled";
+
     // A device config to control the minimum target SDK to enable app data isolation
     static final String ANDROID_APP_DATA_ISOLATION_MIN_SDK = "android_app_data_isolation_min_sdk";
 
@@ -379,6 +385,8 @@
 
     private boolean mAppDataIsolationEnabled = false;
 
+    private boolean mVoldAppDataIsolationEnabled = false;
+
     private ArrayList<String> mAppDataIsolationWhitelistedApps;
 
     /**
@@ -691,6 +699,8 @@
         // want some apps enabled while some apps disabled
         mAppDataIsolationEnabled =
                 SystemProperties.getBoolean(ANDROID_APP_DATA_ISOLATION_ENABLED_PROPERTY, true);
+        mVoldAppDataIsolationEnabled = SystemProperties.getBoolean(
+                ANDROID_VOLD_APP_DATA_ISOLATION_ENABLED_PROPERTY, false);
         mAppDataIsolationWhitelistedApps = new ArrayList<>(
                 SystemConfig.getInstance().getAppDataIsolationWhitelistedApps());
 
@@ -2113,6 +2123,13 @@
                         app.info.packageName, app.userId);
                 pkgDataInfoMap = getPackageAppDataInfoMap(pmInt, sharedPackages.length == 0
                         ? new String[]{app.info.packageName} : sharedPackages, uid);
+
+                if (mVoldAppDataIsolationEnabled) {
+                    StorageManagerInternal storageManagerInternal = LocalServices.getService(
+                                StorageManagerInternal.class);
+                    storageManagerInternal.prepareObbDirs(UserHandle.getUserId(uid),
+                            pkgDataInfoMap.keySet(), app.processName);
+                }
             } else {
                 pkgDataInfoMap = null;
             }
diff --git a/services/core/java/com/android/server/appop/AppOpsService.java b/services/core/java/com/android/server/appop/AppOpsService.java
index 5e1582c..40acfe1 100644
--- a/services/core/java/com/android/server/appop/AppOpsService.java
+++ b/services/core/java/com/android/server/appop/AppOpsService.java
@@ -536,9 +536,8 @@
                                 // The FGS has the location capability, but due to FGS BG start
                                 // restriction it lost the capability, use temp location capability
                                 // to mark this case.
-                                // TODO change to MODE_IGNORED when enforcing the feature.
                                 maybeShowWhileInUseDebugToast(op, mode);
-                                return AppOpsManager.MODE_ALLOWED;
+                                return AppOpsManager.MODE_IGNORED;
                             } else {
                                 return AppOpsManager.MODE_IGNORED;
                             }
@@ -546,17 +545,15 @@
                             if ((capability & PROCESS_CAPABILITY_FOREGROUND_CAMERA) != 0) {
                                 return AppOpsManager.MODE_ALLOWED;
                             } else {
-                                //TODO change to MODE_IGNORED when enforcing the feature.
                                 maybeShowWhileInUseDebugToast(op, mode);
-                                return AppOpsManager.MODE_ALLOWED;
+                                return AppOpsManager.MODE_IGNORED;
                             }
                         case OP_RECORD_AUDIO:
                             if ((capability & PROCESS_CAPABILITY_FOREGROUND_MICROPHONE) != 0) {
                                 return AppOpsManager.MODE_ALLOWED;
                             } else {
-                                //TODO change to MODE_IGNORED when enforcing the feature.
                                 maybeShowWhileInUseDebugToast(op, mode);
-                                return AppOpsManager.MODE_ALLOWED;
+                                return AppOpsManager.MODE_IGNORED;
                             }
                         default:
                             return AppOpsManager.MODE_ALLOWED;
@@ -571,17 +568,15 @@
                         if ((capability & PROCESS_CAPABILITY_FOREGROUND_CAMERA) != 0) {
                             return AppOpsManager.MODE_ALLOWED;
                         } else {
-                            //TODO change to MODE_IGNORED when enforcing the feature.
                             maybeShowWhileInUseDebugToast(op, mode);
-                            return AppOpsManager.MODE_ALLOWED;
+                            return AppOpsManager.MODE_IGNORED;
                         }
                     case OP_RECORD_AUDIO:
                         if ((capability & PROCESS_CAPABILITY_FOREGROUND_MICROPHONE) != 0) {
                             return AppOpsManager.MODE_ALLOWED;
                         } else {
-                            //TODO change to MODE_IGNORED when enforcing the feature.
                             maybeShowWhileInUseDebugToast(op, mode);
-                            return AppOpsManager.MODE_ALLOWED;
+                            return AppOpsManager.MODE_IGNORED;
                         }
                     default:
                         return MODE_ALLOWED;
@@ -2087,7 +2082,7 @@
     }
 
     private void setUidMode(int code, int uid, int mode,
-            @Nullable IAppOpsCallback callbackToIgnore) {
+            @Nullable IAppOpsCallback permissionPolicyCallback) {
         if (DEBUG) {
             Slog.i(TAG, "uid " + uid + " OP_" + opToName(code) + " := " + modeToName(mode)
                     + " by uid " + Binder.getCallingUid());
@@ -2097,7 +2092,9 @@
         verifyIncomingOp(code);
         code = AppOpsManager.opToSwitch(code);
 
-        updatePermissionRevokedCompat(uid, code, mode);
+        if (permissionPolicyCallback == null) {
+            updatePermissionRevokedCompat(uid, code, mode);
+        }
 
         synchronized (this) {
             final int defaultMode = AppOpsManager.opToDefaultMode(code);
@@ -2135,7 +2132,7 @@
             uidState.evalForegroundOps(mOpModeWatchers);
         }
 
-        notifyOpChangedForAllPkgsInUid(code, uid, false, callbackToIgnore);
+        notifyOpChangedForAllPkgsInUid(code, uid, false, permissionPolicyCallback);
         notifyOpChangedSync(code, uid, null, mode);
     }
 
@@ -2337,7 +2334,7 @@
     }
 
     private void setMode(int code, int uid, @NonNull String packageName, int mode,
-            @Nullable IAppOpsCallback callbackToIgnore) {
+            @Nullable IAppOpsCallback permissionPolicyCallback) {
         enforceManageAppOpsModes(Binder.getCallingPid(), Binder.getCallingUid(), uid);
         verifyIncomingOp(code);
         ArraySet<ModeCallback> repCbs = null;
@@ -2381,8 +2378,8 @@
                         }
                         repCbs.addAll(cbs);
                     }
-                    if (repCbs != null && callbackToIgnore != null) {
-                        repCbs.remove(mModeWatchers.get(callbackToIgnore.asBinder()));
+                    if (repCbs != null && permissionPolicyCallback != null) {
+                        repCbs.remove(mModeWatchers.get(permissionPolicyCallback.asBinder()));
                     }
                     if (mode == AppOpsManager.opToDefaultMode(op.op)) {
                         // If going into the default mode, prune this op
@@ -6036,15 +6033,15 @@
         }
 
         @Override
-        public void setUidModeIgnoringCallback(int code, int uid, int mode,
-                @Nullable IAppOpsCallback callbackToIgnore) {
-            setUidMode(code, uid, mode, callbackToIgnore);
+        public void setUidModeFromPermissionPolicy(int code, int uid, int mode,
+                @Nullable IAppOpsCallback callback) {
+            setUidMode(code, uid, mode, callback);
         }
 
         @Override
-        public void setModeIgnoringCallback(int code, int uid, @NonNull String packageName,
-                int mode, @Nullable IAppOpsCallback callbackToIgnore) {
-            setMode(code, uid, packageName, mode, callbackToIgnore);
+        public void setModeFromPermissionPolicy(int code, int uid, @NonNull String packageName,
+                int mode, @Nullable IAppOpsCallback callback) {
+            setMode(code, uid, packageName, mode, callback);
         }
     }
 }
diff --git a/services/core/java/com/android/server/audio/AudioDeviceBroker.java b/services/core/java/com/android/server/audio/AudioDeviceBroker.java
index 566b72d..b546120 100644
--- a/services/core/java/com/android/server/audio/AudioDeviceBroker.java
+++ b/services/core/java/com/android/server/audio/AudioDeviceBroker.java
@@ -24,7 +24,7 @@
 import android.content.ContentResolver;
 import android.content.Context;
 import android.content.Intent;
-import android.media.AudioDevice;
+import android.media.AudioDeviceAttributes;
 import android.media.AudioManager;
 import android.media.AudioRoutesInfo;
 import android.media.AudioSystem;
@@ -403,7 +403,7 @@
     }
 
     /*package*/ int setPreferredDeviceForStrategySync(int strategy,
-                                                      @NonNull AudioDevice device) {
+                                                      @NonNull AudioDeviceAttributes device) {
         return mDeviceInventory.setPreferredDeviceForStrategySync(strategy, device);
     }
 
@@ -554,7 +554,8 @@
         sendLMsgNoDelay(MSG_L_SCOCLIENT_DIED, SENDMSG_QUEUE, obj);
     }
 
-    /*package*/ void postSaveSetPreferredDeviceForStrategy(int strategy, AudioDevice device)
+    /*package*/ void postSaveSetPreferredDeviceForStrategy(int strategy,
+                                                           AudioDeviceAttributes device)
     {
         sendILMsgNoDelay(MSG_IL_SAVE_PREF_DEVICE_FOR_STRATEGY, SENDMSG_QUEUE, strategy, device);
     }
@@ -915,7 +916,7 @@
                 } break;
                 case MSG_IL_SAVE_PREF_DEVICE_FOR_STRATEGY: {
                     final int strategy = msg.arg1;
-                    final AudioDevice device = (AudioDevice) msg.obj;
+                    final AudioDeviceAttributes device = (AudioDeviceAttributes) msg.obj;
                     mDeviceInventory.onSaveSetPreferredDevice(strategy, device);
                 } break;
                 case MSG_I_SAVE_REMOVE_PREF_DEVICE_FOR_STRATEGY: {
diff --git a/services/core/java/com/android/server/audio/AudioDeviceInventory.java b/services/core/java/com/android/server/audio/AudioDeviceInventory.java
index e170db0..c17ed3e 100644
--- a/services/core/java/com/android/server/audio/AudioDeviceInventory.java
+++ b/services/core/java/com/android/server/audio/AudioDeviceInventory.java
@@ -24,7 +24,7 @@
 import android.bluetooth.BluetoothHearingAid;
 import android.bluetooth.BluetoothProfile;
 import android.content.Intent;
-import android.media.AudioDevice;
+import android.media.AudioDeviceAttributes;
 import android.media.AudioDevicePort;
 import android.media.AudioFormat;
 import android.media.AudioManager;
@@ -77,7 +77,7 @@
     private final ArrayMap<Integer, String> mApmConnectedDevices = new ArrayMap<>();
 
     // List of preferred devices for strategies
-    private final ArrayMap<Integer, AudioDevice> mPreferredDevices = new ArrayMap<>();
+    private final ArrayMap<Integer, AudioDeviceAttributes> mPreferredDevices = new ArrayMap<>();
 
     // the wrapper for AudioSystem static methods, allows us to spy AudioSystem
     private final @NonNull AudioSystemAdapter mAudioSystem;
@@ -474,7 +474,7 @@
         }
     }
 
-    /*package*/ void onSaveSetPreferredDevice(int strategy, @NonNull AudioDevice device) {
+    /*package*/ void onSaveSetPreferredDevice(int strategy, @NonNull AudioDeviceAttributes device) {
         mPreferredDevices.put(strategy, device);
         dispatchPreferredDevice(strategy, device);
     }
@@ -488,7 +488,7 @@
     //
 
     /*package*/ int setPreferredDeviceForStrategySync(int strategy,
-                                                      @NonNull AudioDevice device) {
+                                                      @NonNull AudioDeviceAttributes device) {
         final long identity = Binder.clearCallingIdentity();
         final int status = mAudioSystem.setPreferredDeviceForStrategy(strategy, device);
         Binder.restoreCallingIdentity(identity);
@@ -1112,7 +1112,7 @@
         }
     }
 
-    private void dispatchPreferredDevice(int strategy, @Nullable AudioDevice device) {
+    private void dispatchPreferredDevice(int strategy, @Nullable AudioDeviceAttributes device) {
         final int nbDispatchers = mPrefDevDispatchers.beginBroadcast();
         for (int i = 0; i < nbDispatchers; i++) {
             try {
diff --git a/services/core/java/com/android/server/audio/AudioService.java b/services/core/java/com/android/server/audio/AudioService.java
index 4be74b5..f3d42ad 100644
--- a/services/core/java/com/android/server/audio/AudioService.java
+++ b/services/core/java/com/android/server/audio/AudioService.java
@@ -65,7 +65,7 @@
 import android.hidl.manager.V1_0.IServiceManager;
 import android.media.AudioAttributes;
 import android.media.AudioAttributes.AttributeSystemUsage;
-import android.media.AudioDevice;
+import android.media.AudioDeviceAttributes;
 import android.media.AudioDeviceInfo;
 import android.media.AudioFocusInfo;
 import android.media.AudioFocusRequest;
@@ -1734,7 +1734,7 @@
     // IPC methods
     ///////////////////////////////////////////////////////////////////////////
     /** @see AudioManager#setPreferredDeviceForStrategy(AudioProductStrategy, AudioDeviceInfo) */
-    public int setPreferredDeviceForStrategy(int strategy, AudioDevice device) {
+    public int setPreferredDeviceForStrategy(int strategy, AudioDeviceAttributes device) {
         if (device == null) {
             return AudioSystem.ERROR;
         }
@@ -1743,7 +1743,7 @@
                 "setPreferredDeviceForStrategy u/pid:%d/%d strat:%d dev:%s",
                 Binder.getCallingUid(), Binder.getCallingPid(), strategy, device.toString());
         sDeviceLogger.log(new AudioEventLogger.StringEvent(logString).printLog(TAG));
-        if (device.getRole() == AudioDevice.ROLE_INPUT) {
+        if (device.getRole() == AudioDeviceAttributes.ROLE_INPUT) {
             Log.e(TAG, "Unsupported input routing in " + logString);
             return AudioSystem.ERROR;
         }
@@ -1771,9 +1771,9 @@
     }
 
     /** @see AudioManager#getPreferredDeviceForStrategy(AudioProductStrategy) */
-    public AudioDevice getPreferredDeviceForStrategy(int strategy) {
+    public AudioDeviceAttributes getPreferredDeviceForStrategy(int strategy) {
         enforceModifyAudioRoutingPermission();
-        AudioDevice[] devices = new AudioDevice[1];
+        AudioDeviceAttributes[] devices = new AudioDeviceAttributes[1];
         final long identity = Binder.clearCallingIdentity();
         final int status = AudioSystem.getPreferredDeviceForStrategy(strategy, devices);
         Binder.restoreCallingIdentity(identity);
@@ -1807,7 +1807,7 @@
     }
 
     /** @see AudioManager#getDevicesForAttributes(AudioAttributes) */
-    public @NonNull ArrayList<AudioDevice> getDevicesForAttributes(
+    public @NonNull ArrayList<AudioDeviceAttributes> getDevicesForAttributes(
             @NonNull AudioAttributes attributes) {
         Objects.requireNonNull(attributes);
         enforceModifyAudioRoutingPermission();
diff --git a/services/core/java/com/android/server/audio/AudioSystemAdapter.java b/services/core/java/com/android/server/audio/AudioSystemAdapter.java
index a3086c0..9f8f9f8 100644
--- a/services/core/java/com/android/server/audio/AudioSystemAdapter.java
+++ b/services/core/java/com/android/server/audio/AudioSystemAdapter.java
@@ -17,7 +17,7 @@
 package com.android.server.audio;
 
 import android.annotation.NonNull;
-import android.media.AudioDevice;
+import android.media.AudioDeviceAttributes;
 import android.media.AudioSystem;
 import android.util.Log;
 
@@ -86,12 +86,12 @@
     }
 
     /**
-     * Same as {@link AudioSystem#setPreferredDeviceForStrategy(int, AudioDevice)}
+     * Same as {@link AudioSystem#setPreferredDeviceForStrategy(int, AudioDeviceAttributes)}
      * @param strategy
      * @param device
      * @return
      */
-    public int setPreferredDeviceForStrategy(int strategy, @NonNull AudioDevice device) {
+    public int setPreferredDeviceForStrategy(int strategy, @NonNull AudioDeviceAttributes device) {
         return AudioSystem.setPreferredDeviceForStrategy(strategy, device);
     }
 
@@ -138,7 +138,8 @@
         }
 
         @Override
-        public int setPreferredDeviceForStrategy(int strategy, @NonNull AudioDevice device) {
+        public int setPreferredDeviceForStrategy(int strategy,
+                                                 @NonNull AudioDeviceAttributes device) {
             return AudioSystem.AUDIO_STATUS_OK;
         }
 
diff --git a/services/core/java/com/android/server/compat/CompatConfig.java b/services/core/java/com/android/server/compat/CompatConfig.java
index 7f7c9c4..3f03e09 100644
--- a/services/core/java/com/android/server/compat/CompatConfig.java
+++ b/services/core/java/com/android/server/compat/CompatConfig.java
@@ -16,6 +16,7 @@
 
 package com.android.server.compat;
 
+import android.app.compat.ChangeIdStateCache;
 import android.compat.Compatibility.ChangeConfig;
 import android.content.Context;
 import android.content.pm.ApplicationInfo;
@@ -80,6 +81,7 @@
     void addChange(CompatChange change) {
         synchronized (mChanges) {
             mChanges.put(change.getId(), change);
+            invalidateCache();
         }
     }
 
@@ -172,6 +174,7 @@
                 addChange(c);
             }
             c.addPackageOverride(packageName, enabled);
+            invalidateCache();
         }
         return alreadyKnown;
     }
@@ -228,6 +231,7 @@
                 // Should never occur, since validator is in the same process.
                 throw new RuntimeException("Unable to call override validator!", e);
             }
+            invalidateCache();
         }
         return overrideExists;
     }
@@ -250,6 +254,7 @@
                 addOverride(changeId, packageName, false);
 
             }
+            invalidateCache();
         }
     }
 
@@ -279,6 +284,7 @@
                     throw new RuntimeException("Unable to call override validator!", e);
                 }
             }
+            invalidateCache();
         }
     }
 
@@ -406,4 +412,8 @@
     IOverrideValidator getOverrideValidator() {
         return mOverrideValidator;
     }
+
+    private void invalidateCache() {
+        ChangeIdStateCache.invalidate();
+    }
 }
diff --git a/services/core/java/com/android/server/connectivity/NetworkAgentInfo.java b/services/core/java/com/android/server/connectivity/NetworkAgentInfo.java
index 4612cfd..3860904 100644
--- a/services/core/java/com/android/server/connectivity/NetworkAgentInfo.java
+++ b/services/core/java/com/android/server/connectivity/NetworkAgentInfo.java
@@ -16,6 +16,8 @@
 
 package com.android.server.connectivity;
 
+import static android.net.NetworkCapabilities.NET_CAPABILITY_NOT_METERED;
+import static android.net.NetworkCapabilities.NET_CAPABILITY_VALIDATED;
 import static android.net.NetworkCapabilities.transportNamesOf;
 
 import android.annotation.NonNull;
@@ -475,24 +477,16 @@
         return networkCapabilities.hasTransport(NetworkCapabilities.TRANSPORT_VPN);
     }
 
-    private int getCurrentScore(boolean pretendValidated) {
-        // TODO: We may want to refactor this into a NetworkScore class that takes a base score from
-        // the NetworkAgent and signals from the NetworkAgent and uses those signals to modify the
-        // score.  The NetworkScore class would provide a nice place to centralize score constants
-        // so they are not scattered about the transports.
-
+    /** Gets the current score */
+    public int getCurrentScore() {
         // If this network is explicitly selected and the user has decided to use it even if it's
-        // unvalidated, give it the maximum score. Also give it the maximum score if it's explicitly
-        // selected and we're trying to see what its score could be. This ensures that we don't tear
-        // down an explicitly selected network before the user gets a chance to prefer it when
-        // a higher-scoring network (e.g., Ethernet) is available.
-        if (networkAgentConfig.explicitlySelected
-                && (networkAgentConfig.acceptUnvalidated || pretendValidated)) {
+        // unvalidated, give it the maximum score.
+        if (networkAgentConfig.explicitlySelected && networkAgentConfig.acceptUnvalidated) {
             return ConnectivityConstants.EXPLICITLY_SELECTED_NETWORK_SCORE;
         }
 
         int score = mNetworkScore.getLegacyScore();
-        if (!lastValidated && !pretendValidated && !ignoreWifiUnvalidationPenalty() && !isVPN()) {
+        if (!lastValidated && !ignoreWifiUnvalidationPenalty() && !isVPN()) {
             score -= ConnectivityConstants.UNVALIDATED_SCORE_PENALTY;
         }
         if (score < 0) score = 0;
@@ -508,18 +502,6 @@
         return isWifi && !avoidBadWifi && everValidated;
     }
 
-    // Get the current score for this Network.  This may be modified from what the
-    // NetworkAgent sent, as it has modifiers applied to it.
-    public int getCurrentScore() {
-        return getCurrentScore(false);
-    }
-
-    // Get the current score for this Network as if it was validated.  This may be modified from
-    // what the NetworkAgent sent, as it has modifiers applied to it.
-    public int getCurrentScoreAsValidated() {
-        return getCurrentScore(true);
-    }
-
     public void setNetworkScore(@NonNull NetworkScore ns) {
         mNetworkScore = ns;
     }
@@ -629,6 +611,41 @@
         mLingering = false;
     }
 
+    /**
+     * Returns whether this NAI has any chance of ever beating this other agent.
+     *
+     * The chief use case of this is the decision to tear down this network. ConnectivityService
+     * tears down networks that don't satisfy any request, unless they have a chance to beat any
+     * existing satisfier.
+     *
+     * @param other the agent to beat
+     * @return whether this should be given more time to try and beat the other agent
+     * TODO : remove this and migrate to a ranker-based approach
+     */
+    public boolean canPossiblyBeat(@NonNull final NetworkAgentInfo other) {
+        // Any explicitly selected network should be held on.
+        if (networkAgentConfig.explicitlySelected) return true;
+        // An outscored exiting network should be torn down.
+        if (mNetworkScore.isExiting()) return false;
+        // If this network is validated it can be torn down as it can't hope to be better than
+        // it already is.
+        if (networkCapabilities.hasCapability(NET_CAPABILITY_VALIDATED)) return false;
+        // If neither network is validated, keep both until at least one does.
+        if (!other.networkCapabilities.hasCapability(NET_CAPABILITY_VALIDATED)) return true;
+        // If this network is not metered but the other is, it should be preferable if it validates.
+        if (networkCapabilities.hasCapability(NET_CAPABILITY_NOT_METERED)
+                && !other.networkCapabilities.hasCapability(NET_CAPABILITY_NOT_METERED)) {
+            return true;
+        }
+
+        // If the control comes here :
+        // • This network is neither exiting or explicitly selected
+        // • This network is not validated, but the other is
+        // • This network is metered, or both networks are unmetered
+        // Keep it if it's expected to be faster than the other., should it validate.
+        return mNetworkScore.probablyFasterThan(other.mNetworkScore);
+    }
+
     public void dumpLingerTimers(PrintWriter pw) {
         for (LingerTimer timer : mLingerTimers) { pw.println(timer); }
     }
diff --git a/services/core/java/com/android/server/connectivity/NetworkRanker.java b/services/core/java/com/android/server/connectivity/NetworkRanker.java
index c536ab2..80d46e0 100644
--- a/services/core/java/com/android/server/connectivity/NetworkRanker.java
+++ b/services/core/java/com/android/server/connectivity/NetworkRanker.java
@@ -16,6 +16,9 @@
 
 package com.android.server.connectivity;
 
+import static android.net.NetworkCapabilities.NET_CAPABILITY_INTERNET;
+import static android.net.NetworkCapabilities.NET_CAPABILITY_VALIDATED;
+import static android.net.NetworkCapabilities.TRANSPORT_VPN;
 import static android.net.NetworkScore.POLICY_IGNORE_ON_WIFI;
 
 import static com.android.internal.util.FunctionalUtils.findFirst;
@@ -42,13 +45,20 @@
             @NonNull final Collection<NetworkAgentInfo> nais) {
         final ArrayList<NetworkAgentInfo> candidates = new ArrayList<>(nais);
         candidates.removeIf(nai -> !nai.satisfies(request));
-        // Enforce policy.
-        filterBadWifiAvoidancePolicy(candidates);
+
+        // Enforce policy. The order in which the policy is computed is essential, because each
+        // step may remove some of the candidates. For example, filterValidated drops non-validated
+        // networks in presence of validated networks for INTERNET requests, but the bad wifi
+        // avoidance policy takes priority over this, so it must be done before.
+        filterVpn(candidates);
+        filterExplicitlySelected(candidates);
+        filterBadWifiAvoidance(candidates);
+        filterValidated(request, candidates);
 
         NetworkAgentInfo bestNetwork = null;
         int bestScore = Integer.MIN_VALUE;
         for (final NetworkAgentInfo nai : candidates) {
-            final int score = nai.getCurrentScore();
+            final int score = nai.getNetworkScore().getLegacyScore();
             if (score > bestScore) {
                 bestNetwork = nai;
                 bestScore = score;
@@ -57,9 +67,27 @@
         return bestNetwork;
     }
 
-    // If some network with wifi transport is present, drop all networks with POLICY_IGNORE_ON_WIFI.
-    private void filterBadWifiAvoidancePolicy(
+    // If a network is a VPN it has priority.
+    private void filterVpn(@NonNull final ArrayList<NetworkAgentInfo> candidates) {
+        final NetworkAgentInfo vpn = findFirst(candidates,
+                nai -> nai.networkCapabilities.hasTransport(TRANSPORT_VPN));
+        if (null == vpn) return; // No VPN : this policy doesn't apply.
+        candidates.removeIf(nai -> !nai.networkCapabilities.hasTransport(TRANSPORT_VPN));
+    }
+
+    // If some network is explicitly selected and set to accept unvalidated connectivity, then
+    // drop all networks that are not explicitly selected.
+    private void filterExplicitlySelected(
             @NonNull final ArrayList<NetworkAgentInfo> candidates) {
+        final NetworkAgentInfo explicitlySelected = findFirst(candidates,
+                nai -> nai.networkAgentConfig.explicitlySelected
+                        && nai.networkAgentConfig.acceptUnvalidated);
+        if (null == explicitlySelected) return; // No explicitly selected network accepting unvalid
+        candidates.removeIf(nai -> !nai.networkAgentConfig.explicitlySelected);
+    }
+
+    // If some network with wifi transport is present, drop all networks with POLICY_IGNORE_ON_WIFI.
+    private void filterBadWifiAvoidance(@NonNull final ArrayList<NetworkAgentInfo> candidates) {
         final NetworkAgentInfo wifi = findFirst(candidates,
                 nai -> nai.networkCapabilities.hasTransport(NetworkCapabilities.TRANSPORT_WIFI)
                         && nai.everValidated
@@ -71,4 +99,16 @@
         if (null == wifi) return; // No wifi : this policy doesn't apply
         candidates.removeIf(nai -> nai.getNetworkScore().hasPolicy(POLICY_IGNORE_ON_WIFI));
     }
+
+    // If some network is validated and the request asks for INTERNET, drop all networks that are
+    // not validated.
+    private void filterValidated(@NonNull final NetworkRequest request,
+            @NonNull final ArrayList<NetworkAgentInfo> candidates) {
+        if (!request.hasCapability(NET_CAPABILITY_INTERNET)) return;
+        final NetworkAgentInfo validated = findFirst(candidates,
+                nai -> nai.networkCapabilities.hasCapability(NET_CAPABILITY_VALIDATED));
+        if (null == validated) return; // No validated network
+        candidates.removeIf(nai ->
+                !nai.networkCapabilities.hasCapability(NET_CAPABILITY_VALIDATED));
+    }
 }
diff --git a/services/core/java/com/android/server/connectivity/Vpn.java b/services/core/java/com/android/server/connectivity/Vpn.java
index 77f4093..3138639 100644
--- a/services/core/java/com/android/server/connectivity/Vpn.java
+++ b/services/core/java/com/android/server/connectivity/Vpn.java
@@ -216,14 +216,14 @@
      * Whether to keep the connection active after rebooting, or upgrading or reinstalling. This
      * only applies to {@link VpnService} connections.
      */
-    private boolean mAlwaysOn = false;
+    @VisibleForTesting protected boolean mAlwaysOn = false;
 
     /**
      * Whether to disable traffic outside of this VPN even when the VPN is not connected. System
      * apps can still bypass by choosing explicit networks. Has no effect if {@link mAlwaysOn} is
-     * not set.
+     * not set. Applies to all types of VPNs.
      */
-    private boolean mLockdown = false;
+    @VisibleForTesting protected boolean mLockdown = false;
 
     /**
      * Set of packages in addition to the VPN app itself that can access the network directly when
@@ -252,14 +252,14 @@
     private final int mUserHandle;
 
     public Vpn(Looper looper, Context context, INetworkManagementService netService,
-            @UserIdInt int userHandle) {
-        this(looper, context, netService, userHandle,
+            @UserIdInt int userHandle, @NonNull KeyStore keyStore) {
+        this(looper, context, netService, userHandle, keyStore,
                 new SystemServices(context), new Ikev2SessionCreator());
     }
 
     @VisibleForTesting
     protected Vpn(Looper looper, Context context, INetworkManagementService netService,
-            int userHandle, SystemServices systemServices,
+            int userHandle, @NonNull KeyStore keyStore, SystemServices systemServices,
             Ikev2SessionCreator ikev2SessionCreator) {
         mContext = context;
         mNetd = netService;
@@ -285,7 +285,7 @@
         mNetworkCapabilities.removeCapability(NetworkCapabilities.NET_CAPABILITY_NOT_VPN);
         updateCapabilities(null /* defaultNetwork */);
 
-        loadAlwaysOnPackage();
+        loadAlwaysOnPackage(keyStore);
     }
 
     /**
@@ -437,23 +437,36 @@
     /**
      * Checks if a VPN app supports always-on mode.
      *
-     * In order to support the always-on feature, an app has to
+     * <p>In order to support the always-on feature, an app has to either have an installed
+     * PlatformVpnProfile, or:
+     *
      * <ul>
-     *     <li>target {@link VERSION_CODES#N API 24} or above, and
-     *     <li>not opt out through the {@link VpnService#SERVICE_META_DATA_SUPPORTS_ALWAYS_ON}
-     *         meta-data field.
+     *   <li>target {@link VERSION_CODES#N API 24} or above, and
+     *   <li>not opt out through the {@link VpnService#SERVICE_META_DATA_SUPPORTS_ALWAYS_ON}
+     *       meta-data field.
      * </ul>
      *
      * @param packageName the canonical package name of the VPN app
+     * @param keyStore the keystore instance to use for checking if the app has a Platform VPN
+     *     profile installed.
      * @return {@code true} if and only if the VPN app exists and supports always-on mode
      */
-    public boolean isAlwaysOnPackageSupported(String packageName) {
+    public boolean isAlwaysOnPackageSupported(String packageName, @NonNull KeyStore keyStore) {
         enforceSettingsPermission();
 
         if (packageName == null) {
             return false;
         }
 
+        final long oldId = Binder.clearCallingIdentity();
+        try {
+            if (getVpnProfilePrivileged(packageName, keyStore) != null) {
+                return true;
+            }
+        } finally {
+            Binder.restoreCallingIdentity(oldId);
+        }
+
         PackageManager pm = mContext.getPackageManager();
         ApplicationInfo appInfo = null;
         try {
@@ -485,27 +498,31 @@
     }
 
     /**
-     * Configures an always-on VPN connection through a specific application.
-     * This connection is automatically granted and persisted after a reboot.
+     * Configures an always-on VPN connection through a specific application. This connection is
+     * automatically granted and persisted after a reboot.
      *
-     * <p>The designated package should exist and declare a {@link VpnService} in its
-     *    manifest guarded by {@link android.Manifest.permission.BIND_VPN_SERVICE},
-     *    otherwise the call will fail.
+     * <p>The designated package should either have a PlatformVpnProfile installed, or declare a
+     * {@link VpnService} in its manifest guarded by {@link
+     * android.Manifest.permission.BIND_VPN_SERVICE}, otherwise the call will fail.
      *
      * <p>Note that this method does not check if the VPN app supports always-on mode. The check is
-     *    delayed to {@link #startAlwaysOnVpn()}, which is always called immediately after this
-     *    method in {@link android.net.IConnectivityManager#setAlwaysOnVpnPackage}.
+     * delayed to {@link #startAlwaysOnVpn()}, which is always called immediately after this method
+     * in {@link android.net.IConnectivityManager#setAlwaysOnVpnPackage}.
      *
      * @param packageName the package to designate as always-on VPN supplier.
      * @param lockdown whether to prevent traffic outside of a VPN, for example while connecting.
      * @param lockdownWhitelist packages to be whitelisted from lockdown.
+     * @param keyStore the Keystore instance to use for checking of PlatformVpnProfile(s)
      * @return {@code true} if the package has been set as always-on, {@code false} otherwise.
      */
     public synchronized boolean setAlwaysOnPackage(
-            String packageName, boolean lockdown, List<String> lockdownWhitelist) {
+            @Nullable String packageName,
+            boolean lockdown,
+            @Nullable List<String> lockdownWhitelist,
+            @NonNull KeyStore keyStore) {
         enforceControlPermissionOrInternalCaller();
 
-        if (setAlwaysOnPackageInternal(packageName, lockdown, lockdownWhitelist)) {
+        if (setAlwaysOnPackageInternal(packageName, lockdown, lockdownWhitelist, keyStore)) {
             saveAlwaysOnPackage();
             return true;
         }
@@ -513,20 +530,22 @@
     }
 
     /**
-     * Configures an always-on VPN connection through a specific application, the same as
-     * {@link #setAlwaysOnPackage}.
+     * Configures an always-on VPN connection through a specific application, the same as {@link
+     * #setAlwaysOnPackage}.
      *
-     * Does not perform permission checks. Does not persist any of the changes to storage.
+     * <p>Does not perform permission checks. Does not persist any of the changes to storage.
      *
      * @param packageName the package to designate as always-on VPN supplier.
      * @param lockdown whether to prevent traffic outside of a VPN, for example while connecting.
      * @param lockdownWhitelist packages to be whitelisted from lockdown. This is only used if
-     *        {@code lockdown} is {@code true}. Packages must not contain commas.
+     *     {@code lockdown} is {@code true}. Packages must not contain commas.
+     * @param keyStore the system keystore instance to check for profiles
      * @return {@code true} if the package has been set as always-on, {@code false} otherwise.
      */
     @GuardedBy("this")
     private boolean setAlwaysOnPackageInternal(
-            String packageName, boolean lockdown, List<String> lockdownWhitelist) {
+            @Nullable String packageName, boolean lockdown,
+            @Nullable List<String> lockdownWhitelist, @NonNull KeyStore keyStore) {
         if (VpnConfig.LEGACY_VPN.equals(packageName)) {
             Log.w(TAG, "Not setting legacy VPN \"" + packageName + "\" as always-on.");
             return false;
@@ -542,11 +561,18 @@
         }
 
         if (packageName != null) {
-            // TODO: Give the minimum permission possible; if there is a Platform VPN profile, only
-            // grant ACTIVATE_PLATFORM_VPN.
-            // Pre-authorize new always-on VPN package. Grant the full ACTIVATE_VPN appop, allowing
-            // both VpnService and Platform VPNs.
-            if (!setPackageAuthorization(packageName, VpnManager.TYPE_VPN_SERVICE)) {
+            final VpnProfile profile;
+            final long oldId = Binder.clearCallingIdentity();
+            try {
+                profile = getVpnProfilePrivileged(packageName, keyStore);
+            } finally {
+                Binder.restoreCallingIdentity(oldId);
+            }
+
+            // Pre-authorize new always-on VPN package.
+            final int grantType =
+                    (profile == null) ? VpnManager.TYPE_VPN_SERVICE : VpnManager.TYPE_VPN_PLATFORM;
+            if (!setPackageAuthorization(packageName, grantType)) {
                 return false;
             }
             mAlwaysOn = true;
@@ -611,11 +637,9 @@
         }
     }
 
-    /**
-     * Load the always-on package and lockdown config from Settings.Secure
-     */
+    /** Load the always-on package and lockdown config from Settings. */
     @GuardedBy("this")
-    private void loadAlwaysOnPackage() {
+    private void loadAlwaysOnPackage(@NonNull KeyStore keyStore) {
         final long token = Binder.clearCallingIdentity();
         try {
             final String alwaysOnPackage = mSystemServices.settingsSecureGetStringForUser(
@@ -626,17 +650,21 @@
                     Settings.Secure.ALWAYS_ON_VPN_LOCKDOWN_WHITELIST, mUserHandle);
             final List<String> whitelistedPackages = TextUtils.isEmpty(whitelistString)
                     ? Collections.emptyList() : Arrays.asList(whitelistString.split(","));
-            setAlwaysOnPackageInternal(alwaysOnPackage, alwaysOnLockdown, whitelistedPackages);
+            setAlwaysOnPackageInternal(
+                    alwaysOnPackage, alwaysOnLockdown, whitelistedPackages, keyStore);
         } finally {
             Binder.restoreCallingIdentity(token);
         }
     }
 
     /**
+     * Starts the currently selected always-on VPN
+     *
+     * @param keyStore the keyStore instance for looking up PlatformVpnProfile(s)
      * @return {@code true} if the service was started, the service was already connected, or there
-     *         was no always-on VPN to start. {@code false} otherwise.
+     *     was no always-on VPN to start. {@code false} otherwise.
      */
-    public boolean startAlwaysOnVpn() {
+    public boolean startAlwaysOnVpn(@NonNull KeyStore keyStore) {
         final String alwaysOnPackage;
         synchronized (this) {
             alwaysOnPackage = getAlwaysOnPackage();
@@ -645,8 +673,8 @@
                 return true;
             }
             // Remove always-on VPN if it's not supported.
-            if (!isAlwaysOnPackageSupported(alwaysOnPackage)) {
-                setAlwaysOnPackage(null, false, null);
+            if (!isAlwaysOnPackageSupported(alwaysOnPackage, keyStore)) {
+                setAlwaysOnPackage(null, false, null, keyStore);
                 return false;
             }
             // Skip if the service is already established. This isn't bulletproof: it's not bound
@@ -657,10 +685,24 @@
             }
         }
 
-        // Tell the OS that background services in this app need to be allowed for
-        // a short time, so we can bootstrap the VPN service.
         final long oldId = Binder.clearCallingIdentity();
         try {
+            // Prefer VPN profiles, if any exist.
+            VpnProfile profile = getVpnProfilePrivileged(alwaysOnPackage, keyStore);
+            if (profile != null) {
+                startVpnProfilePrivileged(profile, alwaysOnPackage);
+
+                // If the above startVpnProfilePrivileged() call returns, the Ikev2VpnProfile was
+                // correctly parsed, and the VPN has started running in a different thread. The only
+                // other possibility is that the above call threw an exception, which will be
+                // caught below, and returns false (clearing the always-on VPN). Once started, the
+                // Platform VPN cannot permanantly fail, and is resiliant to temporary failures. It
+                // will continue retrying until shut down by the user, or always-on is toggled off.
+                return true;
+            }
+
+            // Tell the OS that background services in this app need to be allowed for
+            // a short time, so we can bootstrap the VPN service.
             DeviceIdleInternal idleController =
                     LocalServices.getService(DeviceIdleInternal.class);
             idleController.addPowerSaveTempWhitelistApp(Process.myUid(), alwaysOnPackage,
@@ -675,6 +717,9 @@
                 Log.e(TAG, "VpnService " + serviceIntent + " failed to start", e);
                 return false;
             }
+        } catch (Exception e) {
+            Log.e(TAG, "Error starting always-on VPN", e);
+            return false;
         } finally {
             Binder.restoreCallingIdentity(oldId);
         }
@@ -2820,6 +2865,10 @@
         return isVpnProfilePreConsented(mContext, packageName);
     }
 
+    private boolean isCurrentIkev2VpnLocked(@NonNull String packageName) {
+        return isCurrentPreparedPackage(packageName) && mVpnRunner instanceof IkeV2VpnRunner;
+    }
+
     /**
      * Deletes an app-provisioned VPN profile.
      *
@@ -2836,6 +2885,17 @@
 
         Binder.withCleanCallingIdentity(
                 () -> {
+                    // If this profile is providing the current VPN, turn it off, disabling
+                    // always-on as well if enabled.
+                    if (isCurrentIkev2VpnLocked(packageName)) {
+                        if (mAlwaysOn) {
+                            // Will transitively call prepareInternal(VpnConfig.LEGACY_VPN).
+                            setAlwaysOnPackage(null, false, null, keyStore);
+                        } else {
+                            prepareInternal(VpnConfig.LEGACY_VPN);
+                        }
+                    }
+
                     keyStore.delete(getProfileNameForPackage(packageName), Process.SYSTEM_UID);
                 });
     }
@@ -2946,11 +3006,9 @@
 
         // To stop the VPN profile, the caller must be the current prepared package and must be
         // running an Ikev2VpnProfile.
-        if (!isCurrentPreparedPackage(packageName) && mVpnRunner instanceof IkeV2VpnRunner) {
-            return;
+        if (isCurrentIkev2VpnLocked(packageName)) {
+            prepareInternal(VpnConfig.LEGACY_VPN);
         }
-
-        prepareInternal(VpnConfig.LEGACY_VPN);
     }
 
     /**
diff --git a/services/core/java/com/android/server/content/SyncManager.java b/services/core/java/com/android/server/content/SyncManager.java
index 6d130d9..4a1afb2 100644
--- a/services/core/java/com/android/server/content/SyncManager.java
+++ b/services/core/java/com/android/server/content/SyncManager.java
@@ -1216,7 +1216,7 @@
         for (SyncOperation op: ops) {
             if (op.isPeriodic && op.target.matchesSpec(target)) {
                 periodicSyncs.add(new PeriodicSync(op.target.account, op.target.provider,
-                        op.extras, op.periodMillis / 1000, op.flexMillis / 1000));
+                        op.getClonedExtras(), op.periodMillis / 1000, op.flexMillis / 1000));
             }
         }
 
@@ -1478,7 +1478,7 @@
             Slog.e(TAG, "Can't schedule null sync operation.");
             return;
         }
-        if (!syncOperation.ignoreBackoff()) {
+        if (!syncOperation.hasIgnoreBackoff()) {
             Pair<Long, Long> backoff = mSyncStorageEngine.getBackoff(syncOperation.target);
             if (backoff == null) {
                 Slog.e(TAG, "Couldn't find backoff values for "
@@ -1631,7 +1631,7 @@
             getSyncStorageEngine().markPending(syncOperation.target, true);
         }
 
-        if (syncOperation.extras.getBoolean(ContentResolver.SYNC_EXTRAS_REQUIRE_CHARGING)) {
+        if (syncOperation.hasRequireCharging()) {
             b.setRequiresCharging(true);
         }
 
@@ -1686,7 +1686,7 @@
         List<SyncOperation> ops = getAllPendingSyncs();
         for (SyncOperation op: ops) {
             if (!op.isPeriodic && op.target.matchesSpec(info)
-                    && syncExtrasEquals(extras, op.extras, false)) {
+                    && op.areExtrasEqual(extras, /*includeSyncSettings=*/ false)) {
                 cancelJob(op, "cancelScheduledSyncOperation");
             }
         }
@@ -1704,15 +1704,9 @@
             Log.d(TAG, "encountered error(s) during the sync: " + syncResult + ", " + operation);
         }
 
-        // The SYNC_EXTRAS_IGNORE_BACKOFF only applies to the first attempt to sync a given
-        // request. Retries of the request will always honor the backoff, so clear the
-        // flag in case we retry this request.
-        if (operation.extras.getBoolean(ContentResolver.SYNC_EXTRAS_IGNORE_BACKOFF, false)) {
-            operation.extras.remove(ContentResolver.SYNC_EXTRAS_IGNORE_BACKOFF);
-        }
+        operation.enableBackoff();
 
-        if (operation.extras.getBoolean(ContentResolver.SYNC_EXTRAS_DO_NOT_RETRY, false)
-                && !syncResult.syncAlreadyInProgress) {
+        if (operation.hasDoNotRetry() && !syncResult.syncAlreadyInProgress) {
             // syncAlreadyInProgress flag is set by AbstractThreadedSyncAdapter. The sync adapter
             // has no way of knowing that a sync error occured. So we DO retry if the error is
             // syncAlreadyInProgress.
@@ -1720,10 +1714,9 @@
                 Log.d(TAG, "not retrying sync operation because SYNC_EXTRAS_DO_NOT_RETRY was specified "
                         + operation);
             }
-        } else if (operation.extras.getBoolean(ContentResolver.SYNC_EXTRAS_UPLOAD, false)
-                && !syncResult.syncAlreadyInProgress) {
+        } else if (operation.isUpload() && !syncResult.syncAlreadyInProgress) {
             // If this was an upward sync then schedule a two-way sync immediately.
-            operation.extras.remove(ContentResolver.SYNC_EXTRAS_UPLOAD);
+            operation.enableTwoWaySync();
             if (isLoggable) {
                 Log.d(TAG, "retrying sync operation as a two-way sync because an upload-only sync "
                         + "encountered an error: " + operation);
@@ -3326,7 +3319,7 @@
             List<SyncOperation> ops = getAllPendingSyncs();
             for (SyncOperation op: ops) {
                 if (op.isPeriodic && op.target.matchesSpec(target)
-                        && syncExtrasEquals(op.extras, extras, true /* includeSyncSettings */)) {
+                        && op.areExtrasEqual(extras, /*includeSyncSettings=*/ true)) {
                     maybeUpdateSyncPeriodH(op, pollFrequencyMillis, flexMillis);
                     return;
                 }
@@ -3408,7 +3401,7 @@
             List<SyncOperation> ops = getAllPendingSyncs();
             for (SyncOperation op: ops) {
                 if (op.isPeriodic && op.target.matchesSpec(target)
-                        && syncExtrasEquals(op.extras, extras, true /* includeSyncSettings */)) {
+                        && op.areExtrasEqual(extras, /*includeSyncSettings=*/ true)) {
                     removePeriodicSyncInternalH(op, why);
                 }
             }
@@ -3559,16 +3552,18 @@
                 activeSyncContext.mIsLinkedToDeath = true;
                 syncAdapter.linkToDeath(activeSyncContext, 0);
 
-                mLogger.log("Sync start: account=" + syncOperation.target.account,
-                        " authority=", syncOperation.target.provider,
-                        " reason=", SyncOperation.reasonToString(null, syncOperation.reason),
-                        " extras=", SyncOperation.extrasToString(syncOperation.extras),
-                        " adapter=", activeSyncContext.mSyncAdapter);
+                if (mLogger.enabled()) {
+                    mLogger.log("Sync start: account=" + syncOperation.target.account,
+                            " authority=", syncOperation.target.provider,
+                            " reason=", SyncOperation.reasonToString(null, syncOperation.reason),
+                            " extras=", syncOperation.getExtrasAsString(),
+                            " adapter=", activeSyncContext.mSyncAdapter);
+                }
 
                 activeSyncContext.mSyncAdapter = ISyncAdapter.Stub.asInterface(syncAdapter);
                 activeSyncContext.mSyncAdapter
                         .startSync(activeSyncContext, syncOperation.target.provider,
-                                syncOperation.target.account, syncOperation.extras);
+                                syncOperation.target.account, syncOperation.getClonedExtras());
 
                 mLogger.log("Sync is running now...");
             } catch (RemoteException remoteExc) {
@@ -3602,9 +3597,8 @@
                         continue;
                     }
                     if (extras != null &&
-                            !syncExtrasEquals(activeSyncContext.mSyncOperation.extras,
-                                    extras,
-                                    false /* no config settings */)) {
+                            !activeSyncContext.mSyncOperation.areExtrasEqual(extras,
+                                    /*includeSyncSettings=*/ false)) {
                         continue;
                     }
                     SyncJobService.callJobFinished(activeSyncContext.mSyncOperation.jobId, false,
diff --git a/services/core/java/com/android/server/content/SyncOperation.java b/services/core/java/com/android/server/content/SyncOperation.java
index 2abc2e6..09b7828 100644
--- a/services/core/java/com/android/server/content/SyncOperation.java
+++ b/services/core/java/com/android/server/content/SyncOperation.java
@@ -74,7 +74,14 @@
     /** Where this sync was initiated. */
     public final int syncSource;
     public final boolean allowParallelSyncs;
-    public final Bundle extras;
+
+    /**
+     * Sync extras. Note, DO NOT modify this bundle directly. When changing the content, always
+     * create a copy, update it, set it in this field. This is to avoid concurrent modifications
+     * when other threads are reading it.
+     */
+    private volatile Bundle mImmutableExtras;
+
     public final boolean isPeriodic;
     /** jobId of the periodic SyncOperation that initiated this one */
     public final int sourcePeriodicId;
@@ -118,20 +125,21 @@
 
     public SyncOperation(SyncOperation op, long periodMillis, long flexMillis) {
         this(op.target, op.owningUid, op.owningPackage, op.reason, op.syncSource,
-                new Bundle(op.extras), op.allowParallelSyncs, op.isPeriodic, op.sourcePeriodicId,
+                op.mImmutableExtras, op.allowParallelSyncs, op.isPeriodic, op.sourcePeriodicId,
                 periodMillis, flexMillis, ContentResolver.SYNC_EXEMPTION_NONE);
     }
 
     public SyncOperation(SyncStorageEngine.EndPoint info, int owningUid, String owningPackage,
-                         int reason, int source, Bundle extras, boolean allowParallelSyncs,
-                         boolean isPeriodic, int sourcePeriodicId, long periodMillis,
-                         long flexMillis, @SyncExemption int syncExemptionFlag) {
+            int reason, int source, Bundle extras,
+            boolean allowParallelSyncs,
+            boolean isPeriodic, int sourcePeriodicId, long periodMillis,
+            long flexMillis, @SyncExemption int syncExemptionFlag) {
         this.target = info;
         this.owningUid = owningUid;
         this.owningPackage = owningPackage;
         this.reason = reason;
         this.syncSource = source;
-        this.extras = new Bundle(extras);
+        this.mImmutableExtras = new Bundle(extras);
         this.allowParallelSyncs = allowParallelSyncs;
         this.isPeriodic = isPeriodic;
         this.sourcePeriodicId = sourcePeriodicId;
@@ -148,7 +156,7 @@
             return null;
         }
         SyncOperation op = new SyncOperation(target, owningUid, owningPackage, reason, syncSource,
-                new Bundle(extras), allowParallelSyncs, false, jobId /* sourcePeriodicId */,
+                mImmutableExtras, allowParallelSyncs, false, jobId /* sourcePeriodicId */,
                 periodMillis, flexMillis, ContentResolver.SYNC_EXEMPTION_NONE);
         return op;
     }
@@ -160,7 +168,10 @@
         reason = other.reason;
         syncSource = other.syncSource;
         allowParallelSyncs = other.allowParallelSyncs;
-        extras = new Bundle(other.extras);
+
+        // Since we treat this field as immutable, it's okay to use a shallow copy here.
+        // No need to create a copy.
+        mImmutableExtras = other.mImmutableExtras;
         wakeLockName = other.wakeLockName();
         isPeriodic = other.isPeriodic;
         sourcePeriodicId = other.sourcePeriodicId;
@@ -173,7 +184,8 @@
     /**
      * All fields are stored in a corresponding key in the persistable bundle.
      *
-     * {@link #extras} is a Bundle and can contain parcelable objects. But only the type Account
+     * {@link #mImmutableExtras} is a Bundle and can contain parcelable objects.
+     * But only the type Account
      * is allowed {@link ContentResolver#validateSyncExtrasBundle(Bundle)} that can't be stored in
      * a PersistableBundle. For every value of type Account with key 'key', we store a
      * PersistableBundle containing account information at key 'ACCOUNT:key'. The Account object
@@ -188,7 +200,9 @@
         PersistableBundle jobInfoExtras = new PersistableBundle();
 
         PersistableBundle syncExtrasBundle = new PersistableBundle();
-        for (String key: extras.keySet()) {
+
+        final Bundle extras = mImmutableExtras;
+        for (String key : extras.keySet()) {
             Object value = extras.get(key);
             if (value instanceof Account) {
                 Account account = (Account) value;
@@ -327,7 +341,7 @@
 
     boolean matchesPeriodicOperation(SyncOperation other) {
         return target.matchesSpec(other.target)
-                && SyncManager.syncExtrasEquals(extras, other.extras, true)
+                && SyncManager.syncExtrasEquals(mImmutableExtras, other.mImmutableExtras, true)
                 && periodMillis == other.periodMillis && flexMillis == other.flexMillis;
     }
 
@@ -345,6 +359,7 @@
     }
 
     private String toKey() {
+        final Bundle extras = mImmutableExtras;
         StringBuilder sb = new StringBuilder();
         sb.append("provider: ").append(target.provider);
         sb.append(" account {name=" + target.account.name
@@ -372,6 +387,7 @@
 
     String dump(PackageManager pm, boolean shorter, SyncAdapterStateFetcher appStates,
             boolean logSafe) {
+        final Bundle extras = mImmutableExtras;
         StringBuilder sb = new StringBuilder();
         sb.append("JobId=").append(jobId)
                 .append(" ")
@@ -468,33 +484,67 @@
     }
 
     boolean isInitialization() {
-        return extras.getBoolean(ContentResolver.SYNC_EXTRAS_INITIALIZE, false);
+        return mImmutableExtras.getBoolean(ContentResolver.SYNC_EXTRAS_INITIALIZE, false);
     }
 
     boolean isExpedited() {
-        return extras.getBoolean(ContentResolver.SYNC_EXTRAS_EXPEDITED, false);
+        return mImmutableExtras.getBoolean(ContentResolver.SYNC_EXTRAS_EXPEDITED, false);
     }
 
-    boolean ignoreBackoff() {
-        return extras.getBoolean(ContentResolver.SYNC_EXTRAS_IGNORE_BACKOFF, false);
+    boolean isUpload() {
+        return mImmutableExtras.getBoolean(ContentResolver.SYNC_EXTRAS_UPLOAD, false);
+    }
+
+    /**
+     * Disable SYNC_EXTRAS_UPLOAD, so it will be a two-way (normal) sync.
+     */
+    void enableTwoWaySync() {
+        removeExtra(ContentResolver.SYNC_EXTRAS_UPLOAD);
+    }
+
+    boolean hasIgnoreBackoff() {
+        return mImmutableExtras.getBoolean(ContentResolver.SYNC_EXTRAS_IGNORE_BACKOFF, false);
+    }
+
+    /**
+     * Disable SYNC_EXTRAS_IGNORE_BACKOFF.
+     *
+     * The SYNC_EXTRAS_IGNORE_BACKOFF only applies to the first attempt to sync a given
+     * request. Retries of the request will always honor the backoff, so clear the
+     * flag in case we retry this request.
+     */
+    void enableBackoff() {
+        removeExtra(ContentResolver.SYNC_EXTRAS_IGNORE_BACKOFF);
+    }
+
+    boolean hasDoNotRetry() {
+        return mImmutableExtras.getBoolean(ContentResolver.SYNC_EXTRAS_DO_NOT_RETRY, false);
     }
 
     boolean isNotAllowedOnMetered() {
-        return extras.getBoolean(ContentResolver.SYNC_EXTRAS_DISALLOW_METERED, false);
+        return mImmutableExtras.getBoolean(ContentResolver.SYNC_EXTRAS_DISALLOW_METERED, false);
     }
 
     boolean isManual() {
-        return extras.getBoolean(ContentResolver.SYNC_EXTRAS_MANUAL, false);
+        return mImmutableExtras.getBoolean(ContentResolver.SYNC_EXTRAS_MANUAL, false);
     }
 
     boolean isIgnoreSettings() {
-        return extras.getBoolean(ContentResolver.SYNC_EXTRAS_IGNORE_SETTINGS, false);
+        return mImmutableExtras.getBoolean(ContentResolver.SYNC_EXTRAS_IGNORE_SETTINGS, false);
+    }
+
+    boolean hasRequireCharging() {
+        return mImmutableExtras.getBoolean(ContentResolver.SYNC_EXTRAS_REQUIRE_CHARGING, false);
     }
 
     boolean isAppStandbyExempted() {
         return syncExemptionFlag != ContentResolver.SYNC_EXEMPTION_NONE;
     }
 
+    boolean areExtrasEqual(Bundle other, boolean includeSyncSettings) {
+        return SyncManager.syncExtrasEquals(mImmutableExtras, other, includeSyncSettings);
+    }
+
     static void extrasToStringBuilder(Bundle bundle, StringBuilder sb) {
         if (bundle == null) {
             sb.append("null");
@@ -507,7 +557,7 @@
         sb.append("]");
     }
 
-    static String extrasToString(Bundle bundle) {
+    private static String extrasToString(Bundle bundle) {
         final StringBuilder sb = new StringBuilder();
         extrasToStringBuilder(bundle, sb);
         return sb.toString();
@@ -531,4 +581,25 @@
         logArray[3] = target.account.name.hashCode();
         return logArray;
     }
+
+    /**
+     * Removes a sync extra. Note do not call it from multiple threads simultaneously.
+     */
+    private void removeExtra(String key) {
+        final Bundle b = mImmutableExtras;
+        if (!b.containsKey(key)) {
+            return;
+        }
+        final Bundle clone = new Bundle(b);
+        clone.remove(key);
+        mImmutableExtras = clone;
+    }
+
+    public Bundle getClonedExtras() {
+        return new Bundle(mImmutableExtras);
+    }
+
+    public String getExtrasAsString() {
+        return extrasToString(mImmutableExtras);
+    }
 }
diff --git a/services/core/java/com/android/server/content/SyncStorageEngine.java b/services/core/java/com/android/server/content/SyncStorageEngine.java
index afdcda9..8c510b7 100644
--- a/services/core/java/com/android/server/content/SyncStorageEngine.java
+++ b/services/core/java/com/android/server/content/SyncStorageEngine.java
@@ -137,7 +137,7 @@
     /**
      * String names for the sync source types.
      *
-     * KEEP THIS AND {@link SyncStatusInfo#SOURCE_COUNT} IN SYNC.
+     * KEEP THIS AND {@link SyncStatusInfo}.SOURCE_COUNT IN SYNC.
      */
     public static final String[] SOURCES = {
             "OTHER",
@@ -1117,7 +1117,7 @@
                 Slog.v(TAG, "setActiveSync: account="
                         + " auth=" + activeSyncContext.mSyncOperation.target
                         + " src=" + activeSyncContext.mSyncOperation.syncSource
-                        + " extras=" + activeSyncContext.mSyncOperation.extras);
+                        + " extras=" + activeSyncContext.mSyncOperation.getExtrasAsString());
             }
             final EndPoint info = activeSyncContext.mSyncOperation.target;
             AuthorityInfo authorityInfo = getOrCreateAuthorityLocked(
@@ -1179,7 +1179,7 @@
             item.eventTime = now;
             item.source = op.syncSource;
             item.reason = op.reason;
-            item.extras = op.extras;
+            item.extras = op.getClonedExtras();
             item.event = EVENT_START;
             item.syncExemptionFlag = op.syncExemptionFlag;
             mSyncHistory.add(0, item);
diff --git a/services/core/java/com/android/server/display/DisplayDeviceInfo.java b/services/core/java/com/android/server/display/DisplayDeviceInfo.java
index ac41434..18adc0b 100644
--- a/services/core/java/com/android/server/display/DisplayDeviceInfo.java
+++ b/services/core/java/com/android/server/display/DisplayDeviceInfo.java
@@ -16,6 +16,7 @@
 
 package com.android.server.display;
 
+import android.hardware.display.DeviceProductInfo;
 import android.hardware.display.DisplayViewport;
 import android.util.DisplayMetrics;
 import android.view.Display;
@@ -288,6 +289,13 @@
     public DisplayAddress address;
 
     /**
+     * Product-specific information about the display or the directly connected device on the
+     * display chain. For example, if the display is transitively connected, this field may contain
+     * product information about the intermediate device.
+     */
+    public DeviceProductInfo deviceProductInfo;
+
+    /**
      * Display state.
      */
     public int state = Display.STATE_ON;
@@ -360,6 +368,7 @@
                 || rotation != other.rotation
                 || type != other.type
                 || !Objects.equals(address, other.address)
+                || !Objects.equals(deviceProductInfo, other.deviceProductInfo)
                 || ownerUid != other.ownerUid
                 || !Objects.equals(ownerPackageName, other.ownerPackageName)) {
             diff |= DIFF_OTHER;
@@ -396,6 +405,7 @@
         rotation = other.rotation;
         type = other.type;
         address = other.address;
+        deviceProductInfo = other.deviceProductInfo;
         state = other.state;
         ownerUid = other.ownerUid;
         ownerPackageName = other.ownerPackageName;
@@ -429,6 +439,7 @@
         if (address != null) {
             sb.append(", address ").append(address);
         }
+        sb.append(", deviceProductInfo ").append(deviceProductInfo);
         sb.append(", state ").append(Display.stateToString(state));
         if (ownerUid != 0 || ownerPackageName != null) {
             sb.append(", owner ").append(ownerPackageName);
diff --git a/services/core/java/com/android/server/display/LocalDisplayAdapter.java b/services/core/java/com/android/server/display/LocalDisplayAdapter.java
index 4ebbdda..e578ac1 100644
--- a/services/core/java/com/android/server/display/LocalDisplayAdapter.java
+++ b/services/core/java/com/android/server/display/LocalDisplayAdapter.java
@@ -513,6 +513,7 @@
                 mInfo.densityDpi = (int) (mDisplayInfo.density * 160 + 0.5f);
                 mInfo.xDpi = config.xDpi;
                 mInfo.yDpi = config.yDpi;
+                mInfo.deviceProductInfo = mDisplayInfo.deviceProductInfo;
 
                 // Assume that all built-in displays that have secure output (eg. HDCP) also
                 // support compositing from gralloc protected buffers.
@@ -891,8 +892,8 @@
             pw.println("mBacklight=" + mBacklight);
             pw.println("mAllmSupported=" + mAllmSupported);
             pw.println("mAllmRequested=" + mAllmRequested);
-            pw.println("mGameContentTypeSupported" + mGameContentTypeSupported);
-            pw.println("mGameContentTypeRequested" + mGameContentTypeRequested);
+            pw.println("mGameContentTypeSupported=" + mGameContentTypeSupported);
+            pw.println("mGameContentTypeRequested=" + mGameContentTypeRequested);
             pw.println("mDisplayInfo=" + mDisplayInfo);
             pw.println("mDisplayConfigs=");
             for (int i = 0; i < mDisplayConfigs.length; i++) {
@@ -902,14 +903,7 @@
             for (int i = 0; i < mSupportedModes.size(); i++) {
                 pw.println("  " + mSupportedModes.valueAt(i));
             }
-            pw.print("mSupportedColorModes=[");
-            for (int i = 0; i < mSupportedColorModes.size(); i++) {
-                if (i != 0) {
-                    pw.print(", ");
-                }
-                pw.print(mSupportedColorModes.get(i));
-            }
-            pw.println("]");
+            pw.print("mSupportedColorModes=" + mSupportedColorModes.toString());
         }
 
         private int findDisplayConfigIdLocked(int modeId) {
diff --git a/services/core/java/com/android/server/display/LogicalDisplay.java b/services/core/java/com/android/server/display/LogicalDisplay.java
index 0c9445a..ac81a6c 100644
--- a/services/core/java/com/android/server/display/LogicalDisplay.java
+++ b/services/core/java/com/android/server/display/LogicalDisplay.java
@@ -269,6 +269,7 @@
 
             mBaseDisplayInfo.type = deviceInfo.type;
             mBaseDisplayInfo.address = deviceInfo.address;
+            mBaseDisplayInfo.deviceProductInfo = deviceInfo.deviceProductInfo;
             mBaseDisplayInfo.name = deviceInfo.name;
             mBaseDisplayInfo.uniqueId = deviceInfo.uniqueId;
             mBaseDisplayInfo.appWidth = maskedWidth;
diff --git a/services/core/java/com/android/server/hdmi/HdmiCecController.java b/services/core/java/com/android/server/hdmi/HdmiCecController.java
index 6174e54..b84d322 100644
--- a/services/core/java/com/android/server/hdmi/HdmiCecController.java
+++ b/services/core/java/com/android/server/hdmi/HdmiCecController.java
@@ -77,7 +77,7 @@
 
     private static final int NUM_LOGICAL_ADDRESS = 16;
 
-    private static final int MAX_CEC_MESSAGE_HISTORY = 200;
+    private static final int MAX_HDMI_MESSAGE_HISTORY = 250;
 
     // Predicate for whether the given logical address is remote device's one or not.
     private final Predicate<Integer> mRemoteDeviceAddressPredicate = new Predicate<Integer>() {
@@ -111,9 +111,9 @@
     // Stores the local CEC devices in the system. Device type is used for key.
     private final SparseArray<HdmiCecLocalDevice> mLocalDevices = new SparseArray<>();
 
-    // Stores recent CEC messages history for debugging purpose.
-    private final ArrayBlockingQueue<MessageHistoryRecord> mMessageHistory =
-            new ArrayBlockingQueue<>(MAX_CEC_MESSAGE_HISTORY);
+    // Stores recent CEC messages and HDMI Hotplug event history for debugging purpose.
+    private final ArrayBlockingQueue<Dumpable> mMessageHistory =
+            new ArrayBlockingQueue<>(MAX_HDMI_MESSAGE_HISTORY);
 
     private final NativeWrapper mNativeWrapperImpl;
 
@@ -618,7 +618,7 @@
     void sendCommand(final HdmiCecMessage cecMessage,
             final HdmiControlService.SendMessageCallback callback) {
         assertRunOnServiceThread();
-        addMessageToHistory(false /* isReceived */, cecMessage);
+        addCecMessageToHistory(false /* isReceived */, cecMessage);
         runOnIoThread(new Runnable() {
             @Override
             public void run() {
@@ -658,7 +658,7 @@
         assertRunOnServiceThread();
         HdmiCecMessage command = HdmiCecMessageBuilder.of(srcAddress, dstAddress, body);
         HdmiLogger.debug("[R]:" + command);
-        addMessageToHistory(true /* isReceived */, command);
+        addCecMessageToHistory(true /* isReceived */, command);
         onReceiveCommand(command);
     }
 
@@ -669,16 +669,26 @@
     private void handleHotplug(int port, boolean connected) {
         assertRunOnServiceThread();
         HdmiLogger.debug("Hotplug event:[port:%d, connected:%b]", port, connected);
+        addHotplugEventToHistory(port, connected);
         mService.onHotplug(port, connected);
     }
 
     @ServiceThreadOnly
-    private void addMessageToHistory(boolean isReceived, HdmiCecMessage message) {
+    private void addHotplugEventToHistory(int port, boolean connected) {
         assertRunOnServiceThread();
-        MessageHistoryRecord record = new MessageHistoryRecord(isReceived, message);
-        if (!mMessageHistory.offer(record)) {
+        addEventToHistory(new HotplugHistoryRecord(port, connected));
+    }
+
+    @ServiceThreadOnly
+    private void addCecMessageToHistory(boolean isReceived, HdmiCecMessage message) {
+        assertRunOnServiceThread();
+        addEventToHistory(new MessageHistoryRecord(isReceived, message));
+    }
+
+    private void addEventToHistory(Dumpable event) {
+        if (!mMessageHistory.offer(event)) {
             mMessageHistory.poll();
-            mMessageHistory.offer(record);
+            mMessageHistory.offer(event);
         }
     }
 
@@ -689,10 +699,11 @@
             mLocalDevices.valueAt(i).dump(pw);
             pw.decreaseIndent();
         }
+
         pw.println("CEC message history:");
         pw.increaseIndent();
         final SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
-        for (MessageHistoryRecord record : mMessageHistory) {
+        for (Dumpable record : mMessageHistory) {
             record.dump(pw, sdf);
         }
         pw.decreaseIndent();
@@ -792,17 +803,27 @@
         }
     }
 
-    private final class MessageHistoryRecord {
-        private final long mTime;
+    private abstract static class Dumpable {
+        protected final long mTime;
+
+        Dumpable() {
+            mTime = System.currentTimeMillis();
+        }
+
+        abstract void dump(IndentingPrintWriter pw, SimpleDateFormat sdf);
+    }
+
+    private static final class MessageHistoryRecord extends Dumpable {
         private final boolean mIsReceived; // true if received message and false if sent message
         private final HdmiCecMessage mMessage;
 
-        public MessageHistoryRecord(boolean isReceived, HdmiCecMessage message) {
-            mTime = System.currentTimeMillis();
+        MessageHistoryRecord(boolean isReceived, HdmiCecMessage message) {
+            super();
             mIsReceived = isReceived;
             mMessage = message;
         }
 
+        @Override
         void dump(final IndentingPrintWriter pw, SimpleDateFormat sdf) {
             pw.print(mIsReceived ? "[R]" : "[S]");
             pw.print(" time=");
@@ -811,4 +832,26 @@
             pw.println(mMessage);
         }
     }
+
+    private static final class HotplugHistoryRecord extends Dumpable {
+        private final int mPort;
+        private final boolean mConnected;
+
+        HotplugHistoryRecord(int port, boolean connected) {
+            super();
+            mPort = port;
+            mConnected = connected;
+        }
+
+        @Override
+        void dump(final IndentingPrintWriter pw, SimpleDateFormat sdf) {
+            pw.print("[H]");
+            pw.print(" time=");
+            pw.print(sdf.format(new Date(mTime)));
+            pw.print(" hotplug port=");
+            pw.print(mPort);
+            pw.print(" connected=");
+            pw.println(mConnected);
+        }
+    }
 }
diff --git a/services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceAudioSystem.java b/services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceAudioSystem.java
index dde873b..e5a08d3 100644
--- a/services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceAudioSystem.java
+++ b/services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceAudioSystem.java
@@ -70,6 +70,9 @@
 
     private static final String TAG = "HdmiCecLocalDeviceAudioSystem";
 
+    private static final boolean WAKE_ON_HOTPLUG =
+            SystemProperties.getBoolean(Constants.PROPERTY_WAKE_ON_HOTPLUG, false);
+
     // Whether the System Audio Control feature is enabled or not. True by default.
     @GuardedBy("mLock")
     private boolean mSystemAudioControlFeatureEnabled;
@@ -318,7 +321,7 @@
     @ServiceThreadOnly
     void onHotplug(int portId, boolean connected) {
         assertRunOnServiceThread();
-        if (connected) {
+        if (WAKE_ON_HOTPLUG && connected) {
             mService.wakeUp();
         }
         if (mService.getPortInfo(portId).getType() == HdmiPortInfo.PORT_OUTPUT) {
diff --git a/services/core/java/com/android/server/location/ContextHubService.java b/services/core/java/com/android/server/location/ContextHubService.java
index e79eddf..48b2270 100644
--- a/services/core/java/com/android/server/location/ContextHubService.java
+++ b/services/core/java/com/android/server/location/ContextHubService.java
@@ -18,14 +18,16 @@
 
 import android.app.PendingIntent;
 import android.content.Context;
+import android.database.ContentObserver;
 import android.hardware.contexthub.V1_0.AsyncEventType;
 import android.hardware.contexthub.V1_0.ContextHub;
 import android.hardware.contexthub.V1_0.ContextHubMsg;
 import android.hardware.contexthub.V1_0.HubAppInfo;
-import android.hardware.contexthub.V1_0.IContexthub;
 import android.hardware.contexthub.V1_0.IContexthubCallback;
 import android.hardware.contexthub.V1_0.Result;
 import android.hardware.contexthub.V1_0.TransactionResult;
+import android.hardware.contexthub.V1_1.Setting;
+import android.hardware.contexthub.V1_1.SettingValue;
 import android.hardware.location.ContextHubInfo;
 import android.hardware.location.ContextHubMessage;
 import android.hardware.location.ContextHubTransaction;
@@ -40,8 +42,11 @@
 import android.hardware.location.NanoAppInstanceInfo;
 import android.hardware.location.NanoAppMessage;
 import android.hardware.location.NanoAppState;
+import android.location.LocationManager;
 import android.os.RemoteCallbackList;
 import android.os.RemoteException;
+import android.os.UserHandle;
+import android.provider.Settings;
 import android.util.Log;
 import android.util.proto.ProtoOutputStream;
 
@@ -56,7 +61,6 @@
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
-import java.util.NoSuchElementException;
 
 /**
  * @hide
@@ -92,7 +96,7 @@
             new RemoteCallbackList<>();
 
     // Proxy object to communicate with the Context Hub HAL
-    private final IContexthub mContextHubProxy;
+    private final IContextHubWrapper mContextHubWrapper;
 
     // The manager for transaction queue
     private final ContextHubTransactionManager mTransactionManager;
@@ -145,8 +149,8 @@
     public ContextHubService(Context context) {
         mContext = context;
 
-        mContextHubProxy = getContextHubProxy();
-        if (mContextHubProxy == null) {
+        mContextHubWrapper = getContextHubWrapper();
+        if (mContextHubWrapper == null) {
             mTransactionManager = null;
             mClientManager = null;
             mDefaultClientMap = Collections.emptyMap();
@@ -155,13 +159,13 @@
             return;
         }
 
-        mClientManager = new ContextHubClientManager(mContext, mContextHubProxy);
+        mClientManager = new ContextHubClientManager(mContext, mContextHubWrapper.getHub());
         mTransactionManager = new ContextHubTransactionManager(
-                mContextHubProxy, mClientManager, mNanoAppStateManager);
+                mContextHubWrapper.getHub(), mClientManager, mNanoAppStateManager);
 
         List<ContextHub> hubList;
         try {
-            hubList = mContextHubProxy.getHubs();
+            hubList = mContextHubWrapper.getHub().getHubs();
         } catch (RemoteException e) {
             Log.e(TAG, "RemoteException while getting Context Hub info", e);
             hubList = Collections.emptyList();
@@ -178,7 +182,7 @@
             defaultClientMap.put(contextHubId, client);
 
             try {
-                mContextHubProxy.registerCallback(
+                mContextHubWrapper.getHub().registerCallback(
                         contextHubId, new ContextHubServiceCallback(contextHubId));
             } catch (RemoteException e) {
                 Log.e(TAG, "RemoteException while registering service callback for hub (ID = "
@@ -190,6 +194,19 @@
             queryNanoAppsInternal(contextHubId);
         }
         mDefaultClientMap = Collections.unmodifiableMap(defaultClientMap);
+
+        if (mContextHubWrapper.supportsSettingNotifications()) {
+            sendLocationSettingUpdate();
+            mContext.getContentResolver().registerContentObserver(
+                    Settings.Secure.getUriFor(Settings.Secure.LOCATION_MODE),
+                    true /* notifyForDescendants */,
+                    new ContentObserver(null /* handler */) {
+                        @Override
+                        public void onChange(boolean selfChange) {
+                            sendLocationSettingUpdate();
+                        }
+                    }, UserHandle.USER_ALL);
+        }
     }
 
     /**
@@ -239,19 +256,15 @@
     }
 
     /**
-     * @return the IContexthub proxy interface
+     * @return the IContextHubWrapper interface
      */
-    private IContexthub getContextHubProxy() {
-        IContexthub proxy = null;
-        try {
-            proxy = IContexthub.getService(true /* retry */);
-        } catch (RemoteException e) {
-            Log.e(TAG, "RemoteException while attaching to Context Hub HAL proxy", e);
-        } catch (NoSuchElementException e) {
-            Log.i(TAG, "Context Hub HAL service not found");
+    private IContextHubWrapper getContextHubWrapper() {
+        IContextHubWrapper wrapper = IContextHubWrapper.maybeConnectTo1_1();
+        if (wrapper == null) {
+            wrapper = IContextHubWrapper.maybeConnectTo1_0();
         }
 
-        return proxy;
+        return wrapper;
     }
 
     @Override
@@ -355,7 +368,7 @@
     @Override
     public int loadNanoApp(int contextHubHandle, NanoApp nanoApp) throws RemoteException {
         checkPermissions();
-        if (mContextHubProxy == null) {
+        if (mContextHubWrapper == null) {
             return -1;
         }
         if (!isValidContextHubId(contextHubHandle)) {
@@ -382,7 +395,7 @@
     @Override
     public int unloadNanoApp(int nanoAppHandle) throws RemoteException {
         checkPermissions();
-        if (mContextHubProxy == null) {
+        if (mContextHubWrapper == null) {
             return -1;
         }
 
@@ -444,7 +457,7 @@
      * @throws IllegalStateException if the transaction queue is full
      */
     private int queryNanoAppsInternal(int contextHubId) {
-        if (mContextHubProxy == null) {
+        if (mContextHubWrapper == null) {
             return Result.UNKNOWN_FAILURE;
         }
 
@@ -461,7 +474,7 @@
     public int sendMessage(int contextHubHandle, int nanoAppHandle, ContextHubMessage msg)
             throws RemoteException {
         checkPermissions();
-        if (mContextHubProxy == null) {
+        if (mContextHubWrapper == null) {
             return -1;
         }
         if (msg == null) {
@@ -563,6 +576,8 @@
      */
     private void handleHubEventCallback(int contextHubId, int eventType) {
         if (eventType == AsyncEventType.RESTARTED) {
+            sendLocationSettingUpdate();
+
             mTransactionManager.onHubReset();
             queryNanoAppsInternal(contextHubId);
 
@@ -870,12 +885,12 @@
      * @param callback        the client transaction callback interface
      * @param transactionType the type of the transaction
      *
-     * @return {@code true} if mContextHubProxy and contextHubId is valid, {@code false} otherwise
+     * @return {@code true} if mContextHubWrapper and contextHubId is valid, {@code false} otherwise
      */
     private boolean checkHalProxyAndContextHubId(
             int contextHubId, IContextHubTransactionCallback callback,
             @ContextHubTransaction.Type int transactionType) {
-        if (mContextHubProxy == null) {
+        if (mContextHubWrapper == null) {
             try {
                 callback.onTransactionComplete(
                         ContextHubTransaction.RESULT_FAILED_HAL_UNAVAILABLE);
@@ -898,4 +913,15 @@
 
         return true;
     }
+
+    /**
+     * Obtains the latest location setting value and notifies the Contexthub.
+     */
+    private void sendLocationSettingUpdate() {
+        boolean enabled = mContext.getSystemService(LocationManager.class)
+                .isLocationEnabledForUser(UserHandle.CURRENT);
+
+        mContextHubWrapper.onSettingChanged(Setting.LOCATION,
+                enabled ? SettingValue.ENABLED : SettingValue.DISABLED);
+    }
 }
diff --git a/services/core/java/com/android/server/location/GnssAntennaInfoProvider.java b/services/core/java/com/android/server/location/GnssAntennaInfoProvider.java
index 09af655..bc50ebc 100644
--- a/services/core/java/com/android/server/location/GnssAntennaInfoProvider.java
+++ b/services/core/java/com/android/server/location/GnssAntennaInfoProvider.java
@@ -20,7 +20,6 @@
 import android.location.GnssAntennaInfo;
 import android.location.IGnssAntennaInfoListener;
 import android.os.Handler;
-import android.os.RemoteException;
 import android.util.Log;
 
 import com.android.internal.annotations.VisibleForTesting;
@@ -100,41 +99,10 @@
 
     @Override
     protected ListenerOperation<IGnssAntennaInfoListener> getHandlerOperation(int result) {
-        int status;
-        switch (result) {
-            case RESULT_SUCCESS:
-                status = GnssAntennaInfo.Callback.STATUS_READY;
-                break;
-            case RESULT_NOT_AVAILABLE:
-            case RESULT_NOT_SUPPORTED:
-            case RESULT_INTERNAL_ERROR:
-                status = GnssAntennaInfo.Callback.STATUS_NOT_SUPPORTED;
-                break;
-            case RESULT_GPS_LOCATION_DISABLED:
-                status = GnssAntennaInfo.Callback.STATUS_LOCATION_DISABLED;
-                break;
-            case RESULT_UNKNOWN:
-                return null;
-            default:
-                Log.v(TAG, "Unhandled addListener result: " + result);
-                return null;
-        }
-        return new StatusChangedOperation(status);
-    }
-
-    private static class StatusChangedOperation
-            implements ListenerOperation<IGnssAntennaInfoListener> {
-        private final int mStatus;
-
-        StatusChangedOperation(int status) {
-            mStatus = status;
-        }
-
-        @Override
-        public void execute(IGnssAntennaInfoListener listener,
-                CallerIdentity callerIdentity) throws RemoteException {
-            listener.onStatusChanged(mStatus);
-        }
+        return (IGnssAntennaInfoListener listener,
+                CallerIdentity callerIdentity) -> {
+                // Do nothing, as GnssAntennaInfo.Callback does not have an onStatusChanged method.
+        };
     }
 
     /** Handle Gnss Antenna Info report. */
diff --git a/services/core/java/com/android/server/location/GnssLocationProvider.java b/services/core/java/com/android/server/location/GnssLocationProvider.java
index 36136f4..5f44e04 100644
--- a/services/core/java/com/android/server/location/GnssLocationProvider.java
+++ b/services/core/java/com/android/server/location/GnssLocationProvider.java
@@ -2244,6 +2244,7 @@
         if (hasCapability(GPS_CAPABILITY_MEASUREMENT_CORRECTIONS)) {
             s.append("MEASUREMENT_CORRECTIONS ");
         }
+        if (hasCapability(GPS_CAPABILITY_ANTENNA_INFO)) s.append("ANTENNA_INFO ");
         s.append(")\n");
         if (hasCapability(GPS_CAPABILITY_MEASUREMENT_CORRECTIONS)) {
             s.append("SubHal=MEASUREMENT_CORRECTIONS[");
diff --git a/services/core/java/com/android/server/location/IContextHubWrapper.java b/services/core/java/com/android/server/location/IContextHubWrapper.java
new file mode 100644
index 0000000..79fa5c7
--- /dev/null
+++ b/services/core/java/com/android/server/location/IContextHubWrapper.java
@@ -0,0 +1,141 @@
+/*
+ * 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.server.location;
+
+import android.annotation.Nullable;
+import android.hardware.contexthub.V1_1.Setting;
+import android.hardware.contexthub.V1_1.SettingValue;
+import android.os.RemoteException;
+import android.util.Log;
+
+import java.util.NoSuchElementException;
+
+/**
+ * @hide
+ */
+public abstract class IContextHubWrapper {
+    private static final String TAG = "IContextHubWrapper";
+
+    /**
+     * Attempts to connect to the Contexthub HAL 1.0 service, if it exists.
+     *
+     * @return A valid IContextHubWrapper if the connection was successful, null otherwise.
+     */
+    @Nullable
+    public static IContextHubWrapper maybeConnectTo1_0() {
+        android.hardware.contexthub.V1_0.IContexthub proxy = null;
+        try {
+            proxy = android.hardware.contexthub.V1_0.IContexthub.getService(true /* retry */);
+        } catch (RemoteException e) {
+            Log.e(TAG, "RemoteException while attaching to Context Hub HAL proxy", e);
+        } catch (NoSuchElementException e) {
+            Log.i(TAG, "Context Hub HAL service not found");
+        }
+
+        ContextHubWrapperV1_0 wrapper = null;
+        if (proxy != null) {
+            wrapper = new ContextHubWrapperV1_0(proxy);
+        }
+
+        return wrapper;
+    }
+
+    /**
+     * Attempts to connect to the Contexthub HAL 1.1 service, if it exists.
+     *
+     * @return A valid IContextHubWrapper if the connection was successful, null otherwise.
+     */
+    @Nullable
+    public static IContextHubWrapper maybeConnectTo1_1() {
+        android.hardware.contexthub.V1_1.IContexthub proxy = null;
+        try {
+            proxy = android.hardware.contexthub.V1_1.IContexthub.getService(true /* retry */);
+        } catch (RemoteException e) {
+            Log.e(TAG, "RemoteException while attaching to Context Hub HAL proxy", e);
+        } catch (NoSuchElementException e) {
+            Log.i(TAG, "Context Hub HAL service not found");
+        }
+
+        ContextHubWrapperV1_1 wrapper = null;
+        if (proxy != null) {
+            wrapper = new ContextHubWrapperV1_1(proxy);
+        }
+
+        return wrapper;
+    }
+
+    /**
+     * @return A valid instance of Contexthub HAL 1.0.
+     */
+    public abstract android.hardware.contexthub.V1_0.IContexthub getHub();
+
+    /**
+     * @return True if this version of the Contexthub HAL supports setting notifications.
+     */
+    public abstract boolean supportsSettingNotifications();
+
+    /**
+     * Notifies the Contexthub implementation of a user setting change.
+     *
+     * @param setting The user setting that has changed. MUST be one of the values from the
+     *     {@link Setting} enum
+     * @param newValue The value of the user setting that changed. MUST be one of the values
+     *     from the {@link SettingValue} enum.
+     */
+    public abstract void onSettingChanged(byte setting, byte newValue);
+
+    private static class ContextHubWrapperV1_0 extends IContextHubWrapper {
+        private android.hardware.contexthub.V1_0.IContexthub mHub;
+
+        ContextHubWrapperV1_0(android.hardware.contexthub.V1_0.IContexthub hub) {
+            mHub = hub;
+        }
+
+        public android.hardware.contexthub.V1_0.IContexthub getHub() {
+            return mHub;
+        }
+
+        public boolean supportsSettingNotifications() {
+            return false;
+        }
+
+        public void onSettingChanged(byte setting, byte newValue) {}
+    }
+
+    private static class ContextHubWrapperV1_1 extends IContextHubWrapper {
+        private android.hardware.contexthub.V1_1.IContexthub mHub;
+
+        ContextHubWrapperV1_1(android.hardware.contexthub.V1_1.IContexthub hub) {
+            mHub = hub;
+        }
+
+        public android.hardware.contexthub.V1_0.IContexthub getHub() {
+            return mHub;
+        }
+
+        public boolean supportsSettingNotifications() {
+            return true;
+        }
+
+        public void onSettingChanged(byte setting, byte newValue) {
+            try {
+                mHub.onSettingChanged(setting, newValue);
+            } catch  (RemoteException e) {
+                Log.e(TAG, "Failed to send setting change to Contexthub", e);
+            }
+        }
+    }
+}
diff --git a/services/core/java/com/android/server/location/LocationFudger.java b/services/core/java/com/android/server/location/LocationFudger.java
index a069e7a..1f458ed 100644
--- a/services/core/java/com/android/server/location/LocationFudger.java
+++ b/services/core/java/com/android/server/location/LocationFudger.java
@@ -87,6 +87,13 @@
         mRandom = random;
         mAccuracyM = Math.max(accuracyM, MIN_ACCURACY_M);
 
+        resetOffsets();
+    }
+
+    /**
+     * Resets the random offsets completely.
+     */
+    public void resetOffsets() {
         mLatitudeOffsetM = nextRandomOffset();
         mLongitudeOffsetM = nextRandomOffset();
         mNextUpdateRealtimeMs = mClock.millis() + OFFSET_UPDATE_INTERVAL_MS;
diff --git a/services/core/java/com/android/server/location/LocationRequestStatistics.java b/services/core/java/com/android/server/location/LocationRequestStatistics.java
index b1913389..dcdf48b 100644
--- a/services/core/java/com/android/server/location/LocationRequestStatistics.java
+++ b/services/core/java/com/android/server/location/LocationRequestStatistics.java
@@ -16,6 +16,7 @@
 
 package com.android.server.location;
 
+import android.annotation.Nullable;
 import android.os.SystemClock;
 import android.util.Log;
 import android.util.TimeUtils;
@@ -25,6 +26,7 @@
 
 import java.util.ArrayList;
 import java.util.HashMap;
+import java.util.Objects;
 
 /**
  * Holds statistics for location requests (active requests by provider).
@@ -43,13 +45,14 @@
     /**
      * Signals that a package has started requesting locations.
      *
-     * @param packageName Name of package that has requested locations.
+     * @param packageName  Name of package that has requested locations.
+     * @param featureId    Feature id associated with the request.
      * @param providerName Name of provider that is requested (e.g. "gps").
-     * @param intervalMs The interval that is requested in ms.
+     * @param intervalMs   The interval that is requested in ms.
      */
-    public void startRequesting(String packageName, String providerName, long intervalMs,
-            boolean isForeground) {
-        PackageProviderKey key = new PackageProviderKey(packageName, providerName);
+    public void startRequesting(String packageName, @Nullable String featureId, String providerName,
+            long intervalMs, boolean isForeground) {
+        PackageProviderKey key = new PackageProviderKey(packageName, featureId, providerName);
         PackageStatistics stats = statistics.get(key);
         if (stats == null) {
             stats = new PackageStatistics();
@@ -57,32 +60,36 @@
         }
         stats.startRequesting(intervalMs);
         stats.updateForeground(isForeground);
-        history.addRequest(packageName, providerName, intervalMs);
+        history.addRequest(packageName, featureId, providerName, intervalMs);
     }
 
     /**
      * Signals that a package has stopped requesting locations.
      *
-     * @param packageName Name of package that has stopped requesting locations.
+     * @param packageName  Name of package that has stopped requesting locations.
+     * @param featureId    Feature id associated with the request.
      * @param providerName Provider that is no longer being requested.
      */
-    public void stopRequesting(String packageName, String providerName) {
-        PackageProviderKey key = new PackageProviderKey(packageName, providerName);
+    public void stopRequesting(String packageName, @Nullable String featureId,
+            String providerName) {
+        PackageProviderKey key = new PackageProviderKey(packageName, featureId, providerName);
         PackageStatistics stats = statistics.get(key);
         if (stats != null) {
             stats.stopRequesting();
         }
-        history.removeRequest(packageName, providerName);
+        history.removeRequest(packageName, featureId, providerName);
     }
 
     /**
      * Signals that a package possibly switched background/foreground.
      *
-     * @param packageName Name of package that has stopped requesting locations.
+     * @param packageName  Name of package that has stopped requesting locations.
+     * @param featureId    Feature id associated with the request.
      * @param providerName Provider that is no longer being requested.
      */
-    public void updateForeground(String packageName, String providerName, boolean isForeground) {
-        PackageProviderKey key = new PackageProviderKey(packageName, providerName);
+    public void updateForeground(String packageName, @Nullable String featureId,
+            String providerName, boolean isForeground) {
+        PackageProviderKey key = new PackageProviderKey(packageName, featureId, providerName);
         PackageStatistics stats = statistics.get(key);
         if (stats != null) {
             stats.updateForeground(isForeground);
@@ -90,30 +97,37 @@
     }
 
     /**
-     * A key that holds both package and provider names.
+     * A key that holds package, feature id, and provider names.
      */
     public static class PackageProviderKey implements Comparable<PackageProviderKey> {
         /**
          * Name of package requesting location.
          */
-        public final String packageName;
+        public final String mPackageName;
+        /**
+         * Feature id associated with the request, which can be used to attribute location access to
+         * different parts of the application.
+         */
+        @Nullable
+        public final String mFeatureId;
         /**
          * Name of provider being requested (e.g. "gps").
          */
-        public final String providerName;
+        public final String mProviderName;
 
-        PackageProviderKey(String packageName, String providerName) {
-            this.packageName = packageName;
-            this.providerName = providerName;
+        PackageProviderKey(String packageName, @Nullable String featureId, String providerName) {
+            this.mPackageName = packageName;
+            this.mFeatureId = featureId;
+            this.mProviderName = providerName;
         }
 
         @Override
         public int compareTo(PackageProviderKey other) {
-            final int providerCompare = providerName.compareTo(other.providerName);
+            final int providerCompare = mProviderName.compareTo(other.mProviderName);
             if (providerCompare != 0) {
                 return providerCompare;
             } else {
-                return packageName.compareTo(other.packageName);
+                return mProviderName.compareTo(other.mProviderName);
             }
         }
 
@@ -124,13 +138,18 @@
             }
 
             PackageProviderKey otherKey = (PackageProviderKey) other;
-            return packageName.equals(otherKey.packageName)
-                    && providerName.equals(otherKey.providerName);
+            return mPackageName.equals(otherKey.mPackageName)
+                    && mProviderName.equals(otherKey.mProviderName)
+                    && Objects.equals(mFeatureId, otherKey.mFeatureId);
         }
 
         @Override
         public int hashCode() {
-            return packageName.hashCode() + 31 * providerName.hashCode();
+            int hash = mPackageName.hashCode() + 31 * mProviderName.hashCode();
+            if (mFeatureId != null) {
+                hash += mFeatureId.hashCode() + 31 * hash;
+            }
+            return hash;
         }
     }
 
@@ -147,17 +166,18 @@
          * Append an added location request to the history
          */
         @VisibleForTesting
-        void addRequest(String packageName, String providerName, long intervalMs) {
-            addRequestSummary(new RequestSummary(packageName, providerName, intervalMs));
+        void addRequest(String packageName, @Nullable String featureId, String providerName,
+                long intervalMs) {
+            addRequestSummary(new RequestSummary(packageName, featureId, providerName, intervalMs));
         }
 
         /**
          * Append a removed location request to the history
          */
         @VisibleForTesting
-        void removeRequest(String packageName, String providerName) {
+        void removeRequest(String packageName, @Nullable String featureId, String providerName) {
             addRequestSummary(new RequestSummary(
-                    packageName, providerName, RequestSummary.REQUEST_ENDED_INTERVAL));
+                    packageName, featureId, providerName, RequestSummary.REQUEST_ENDED_INTERVAL));
         }
 
         private void addRequestSummary(RequestSummary summary) {
@@ -193,6 +213,12 @@
          * Name of package requesting location.
          */
         private final String mPackageName;
+
+        /**
+         * Feature id associated with the request for identifying subsystem of an application.
+         */
+        @Nullable
+        private final String mFeatureId;
         /**
          * Name of provider being requested (e.g. "gps").
          */
@@ -211,8 +237,10 @@
          */
         static final long REQUEST_ENDED_INTERVAL = -1;
 
-        RequestSummary(String packageName, String providerName, long intervalMillis) {
+        RequestSummary(String packageName, @Nullable String featureId, String providerName,
+                long intervalMillis) {
             this.mPackageName = packageName;
+            this.mFeatureId = featureId;
             this.mProviderName = providerName;
             this.mIntervalMillis = intervalMillis;
             this.mElapsedRealtimeMillis = SystemClock.elapsedRealtime();
@@ -225,6 +253,9 @@
                     .append(mIntervalMillis == REQUEST_ENDED_INTERVAL ? "- " : "+ ")
                     .append(String.format("%7s", mProviderName)).append(" request from ")
                     .append(mPackageName);
+            if (mFeatureId != null) {
+                s.append(" with feature ").append(mFeatureId);
+            }
             if (mIntervalMillis != REQUEST_ENDED_INTERVAL) {
                 s.append(" at interval ").append(mIntervalMillis / 1000).append(" seconds");
             }
@@ -246,14 +277,15 @@
         private long mFastestIntervalMs;
         // The slowest interval this package has ever requested.
         private long mSlowestIntervalMs;
-        // The total time this app has requested location (not including currently running requests).
+        // The total time this app has requested location (not including currently running
+        // requests).
         private long mTotalDurationMs;
 
         // Time when this package most recently went to foreground, requesting location. 0 means
         // not currently in foreground.
         private long mLastForegroundElapsedTimeMs;
-        // The time this app has requested location (not including currently running requests), while
-        // in foreground.
+        // The time this app has requested location (not including currently running requests),
+        // while in foreground.
         private long mForegroundDurationMs;
 
         // Time when package last went dormant (stopped requesting location)
@@ -328,7 +360,7 @@
          */
         public long getForegroundDurationMs() {
             long currentDurationMs = mForegroundDurationMs;
-            if (mLastForegroundElapsedTimeMs != 0 ) {
+            if (mLastForegroundElapsedTimeMs != 0) {
                 currentDurationMs
                         += SystemClock.elapsedRealtime() - mLastForegroundElapsedTimeMs;
             }
diff --git a/services/core/java/com/android/server/location/gnss/GnssManagerService.java b/services/core/java/com/android/server/location/gnss/GnssManagerService.java
index 1039cf6..b57c261 100644
--- a/services/core/java/com/android/server/location/gnss/GnssManagerService.java
+++ b/services/core/java/com/android/server/location/gnss/GnssManagerService.java
@@ -216,9 +216,6 @@
      * {@link android.location.GnssCapabilities}.
      */
     public long getGnssCapabilities(String packageName) {
-        mContext.enforceCallingPermission(Manifest.permission.LOCATION_HARDWARE, null);
-        mContext.enforceCallingPermission(Manifest.permission.ACCESS_FINE_LOCATION, null);
-
         if (!checkLocationAppOp(packageName)) {
             return GnssCapabilities.INVALID_CAPABILITIES;
         }
diff --git a/services/core/java/com/android/server/media/SystemMediaRoute2Provider.java b/services/core/java/com/android/server/media/SystemMediaRoute2Provider.java
index 05867ba..f7e1398 100644
--- a/services/core/java/com/android/server/media/SystemMediaRoute2Provider.java
+++ b/services/core/java/com/android/server/media/SystemMediaRoute2Provider.java
@@ -214,6 +214,8 @@
      * Updates the mSessionInfo. Returns true if the session info is changed.
      */
     boolean updateSessionInfosIfNeededLocked() {
+        // Prevent to execute this method before mBtRouteProvider is created.
+        if (mBtRouteProvider == null) return false;
         RoutingSessionInfo oldSessionInfo = mSessionInfos.isEmpty() ? null : mSessionInfos.get(0);
 
         RoutingSessionInfo.Builder builder = new RoutingSessionInfo.Builder(
diff --git a/services/core/java/com/android/server/notification/NotificationManagerService.java b/services/core/java/com/android/server/notification/NotificationManagerService.java
index ad4e81b..0d402e5 100755
--- a/services/core/java/com/android/server/notification/NotificationManagerService.java
+++ b/services/core/java/com/android/server/notification/NotificationManagerService.java
@@ -3440,6 +3440,27 @@
         }
 
         @Override
+        public ParceledListSlice<ConversationChannelWrapper> getConversations(
+                boolean onlyImportant) {
+            enforceSystemOrSystemUI("getConversations");
+            ArrayList<ConversationChannelWrapper> conversations =
+                    mPreferencesHelper.getConversations(onlyImportant);
+            for (ConversationChannelWrapper conversation : conversations) {
+                LauncherApps.ShortcutQuery query = new LauncherApps.ShortcutQuery()
+                        .setPackage(conversation.getPkg())
+                        .setQueryFlags(FLAG_MATCH_DYNAMIC | FLAG_MATCH_PINNED)
+                        .setShortcutIds(Arrays.asList(
+                                conversation.getNotificationChannel().getConversationId()));
+                List<ShortcutInfo> shortcuts = mLauncherAppsService.getShortcuts(
+                        query, UserHandle.of(UserHandle.getUserId(conversation.getUid())));
+                if (shortcuts != null && !shortcuts.isEmpty()) {
+                    conversation.setShortcutInfo(shortcuts.get(0));
+                }
+            }
+            return new ParceledListSlice<>(conversations);
+        }
+
+        @Override
         public ParceledListSlice<NotificationChannelGroup> getNotificationChannelGroupsForPackage(
                 String pkg, int uid, boolean includeDeleted) {
             enforceSystemOrSystemUI("getNotificationChannelGroupsForPackage");
@@ -8609,21 +8630,11 @@
 
     @VisibleForTesting
     boolean canUseManagedServices(String pkg, Integer userId, String requiredPermission) {
-        boolean canUseManagedServices = !mActivityManager.isLowRamDevice()
-                || mPackageManagerClient.hasSystemFeature(PackageManager.FEATURE_WATCH);
-
-        for (String whitelisted : getContext().getResources().getStringArray(
-                R.array.config_allowedManagedServicesOnLowRamDevices)) {
-            if (whitelisted.equals(pkg)) {
-                canUseManagedServices = true;
-                break;
-            }
-        }
-
+        boolean canUseManagedServices = true;
         if (requiredPermission != null) {
             try {
                 if (mPackageManager.checkPermission(requiredPermission, pkg, userId)
-                    != PackageManager.PERMISSION_GRANTED) {
+                        != PackageManager.PERMISSION_GRANTED) {
                     canUseManagedServices = false;
                 }
             } catch (RemoteException e) {
diff --git a/services/core/java/com/android/server/notification/PreferencesHelper.java b/services/core/java/com/android/server/notification/PreferencesHelper.java
index 20c8625..b8186ed 100644
--- a/services/core/java/com/android/server/notification/PreferencesHelper.java
+++ b/services/core/java/com/android/server/notification/PreferencesHelper.java
@@ -1186,6 +1186,44 @@
         return groups;
     }
 
+    public ArrayList<ConversationChannelWrapper> getConversations(boolean onlyImportant) {
+        synchronized (mPackagePreferences) {
+            ArrayList<ConversationChannelWrapper> conversations = new ArrayList<>();
+
+            for (PackagePreferences p : mPackagePreferences.values()) {
+                int N = p.channels.size();
+                for (int i = 0; i < N; i++) {
+                    final NotificationChannel nc = p.channels.valueAt(i);
+                    if (!TextUtils.isEmpty(nc.getConversationId()) && !nc.isDeleted()
+                            && (nc.isImportantConversation() || !onlyImportant)) {
+                        ConversationChannelWrapper conversation = new ConversationChannelWrapper();
+                        conversation.setPkg(p.pkg);
+                        conversation.setUid(p.uid);
+                        conversation.setNotificationChannel(nc);
+                        conversation.setParentChannelLabel(
+                                p.channels.get(nc.getParentChannelId()).getName());
+                        boolean blockedByGroup = false;
+                        if (nc.getGroup() != null) {
+                            NotificationChannelGroup group = p.groups.get(nc.getGroup());
+                            if (group != null) {
+                                if (group.isBlocked()) {
+                                    blockedByGroup = true;
+                                } else {
+                                    conversation.setGroupLabel(group.getName());
+                                }
+                            }
+                        }
+                        if (!blockedByGroup) {
+                            conversations.add(conversation);
+                        }
+                    }
+                }
+            }
+
+            return conversations;
+        }
+    }
+
     public ArrayList<ConversationChannelWrapper> getConversations(String pkg, int uid) {
         Objects.requireNonNull(pkg);
         synchronized (mPackagePreferences) {
@@ -1199,6 +1237,8 @@
                 final NotificationChannel nc = r.channels.valueAt(i);
                 if (!TextUtils.isEmpty(nc.getConversationId()) && !nc.isDeleted()) {
                     ConversationChannelWrapper conversation = new ConversationChannelWrapper();
+                    conversation.setPkg(r.pkg);
+                    conversation.setUid(r.uid);
                     conversation.setNotificationChannel(nc);
                     conversation.setParentChannelLabel(
                             r.channels.get(nc.getParentChannelId()).getName());
diff --git a/services/core/java/com/android/server/om/OverlayManagerService.java b/services/core/java/com/android/server/om/OverlayManagerService.java
index d75eb6d..f221285 100644
--- a/services/core/java/com/android/server/om/OverlayManagerService.java
+++ b/services/core/java/com/android/server/om/OverlayManagerService.java
@@ -62,6 +62,7 @@
 import android.util.Slog;
 import android.util.SparseArray;
 
+import com.android.internal.content.om.OverlayConfig;
 import com.android.server.FgThread;
 import com.android.server.IoThread;
 import com.android.server.LocalServices;
@@ -248,7 +249,8 @@
             IdmapManager im = new IdmapManager(mPackageManager);
             mSettings = new OverlayManagerSettings();
             mImpl = new OverlayManagerServiceImpl(mPackageManager, im, mSettings,
-                    getDefaultOverlayPackages(), new OverlayChangeListener());
+                    OverlayConfig.getSystemInstance(), getDefaultOverlayPackages(),
+                    new OverlayChangeListener());
             mActorEnforcer = new OverlayActorEnforcer(mPackageManager);
 
             final IntentFilter packageFilter = new IntentFilter();
@@ -835,7 +837,7 @@
                     case "basecodepath":
                     case "state":
                     case "isenabled":
-                    case "isstatic":
+                    case "ismutable":
                     case "priority":
                     case "category":
                         dumpState.setField(arg);
diff --git a/services/core/java/com/android/server/om/OverlayManagerServiceImpl.java b/services/core/java/com/android/server/om/OverlayManagerServiceImpl.java
index 9623542..2493057 100644
--- a/services/core/java/com/android/server/om/OverlayManagerServiceImpl.java
+++ b/services/core/java/com/android/server/om/OverlayManagerServiceImpl.java
@@ -18,7 +18,7 @@
 
 import static android.content.om.OverlayInfo.STATE_DISABLED;
 import static android.content.om.OverlayInfo.STATE_ENABLED;
-import static android.content.om.OverlayInfo.STATE_ENABLED_STATIC;
+import static android.content.om.OverlayInfo.STATE_ENABLED_IMMUTABLE;
 import static android.content.om.OverlayInfo.STATE_MISSING_TARGET;
 import static android.content.om.OverlayInfo.STATE_NO_IDMAP;
 import static android.content.om.OverlayInfo.STATE_OVERLAY_IS_BEING_REPLACED;
@@ -37,6 +37,7 @@
 import android.util.ArraySet;
 import android.util.Slog;
 
+import com.android.internal.content.om.OverlayConfig;
 import com.android.internal.util.ArrayUtils;
 
 import java.io.PrintWriter;
@@ -69,6 +70,7 @@
     private final PackageManagerHelper mPackageManager;
     private final IdmapManager mIdmapManager;
     private final OverlayManagerSettings mSettings;
+    private final OverlayConfig mOverlayConfig;
     private final String[] mDefaultOverlays;
     private final OverlayChangeListener mListener;
 
@@ -83,7 +85,7 @@
      * should either scrap the overlay manager's previous settings or merge the old
      * settings with the new.
      */
-    private static boolean mustReinitializeOverlay(@NonNull final PackageInfo theTruth,
+    private boolean mustReinitializeOverlay(@NonNull final PackageInfo theTruth,
             @Nullable final OverlayInfo oldSettings) {
         if (oldSettings == null) {
             return true;
@@ -94,27 +96,35 @@
         if (!Objects.equals(theTruth.targetOverlayableName, oldSettings.targetOverlayableName)) {
             return true;
         }
-        if (theTruth.isStaticOverlayPackage() != oldSettings.isStatic) {
+
+        boolean isMutable = isPackageConfiguredMutable(theTruth.packageName);
+        if (isMutable != oldSettings.isMutable) {
             return true;
         }
-        // a change in priority is only relevant for static RROs: specifically,
-        // a regular RRO should not have its state reset only because a change
-        // in priority
-        if (theTruth.isStaticOverlayPackage()
-                && theTruth.overlayPriority != oldSettings.priority) {
+
+        if (getPackageConfiguredPriority(theTruth.packageName) != oldSettings.priority) {
             return true;
         }
+
+        // If an immutable overlay changes its configured enabled state, reinitialize the overlay.
+        if (!isMutable && isPackageConfiguredEnabled(theTruth.packageName)
+                != oldSettings.isEnabled()) {
+            return true;
+        }
+
         return false;
     }
 
     OverlayManagerServiceImpl(@NonNull final PackageManagerHelper packageManager,
             @NonNull final IdmapManager idmapManager,
             @NonNull final OverlayManagerSettings settings,
+            @NonNull final OverlayConfig overlayConfig,
             @NonNull final String[] defaultOverlays,
             @NonNull final OverlayChangeListener listener) {
         mPackageManager = packageManager;
         mIdmapManager = idmapManager;
         mSettings = settings;
+        mOverlayConfig = overlayConfig;
         mDefaultOverlays = defaultOverlays;
         mListener = listener;
     }
@@ -162,8 +172,9 @@
                         overlayPackage.overlayTarget,
                         overlayPackage.targetOverlayableName,
                         overlayPackage.applicationInfo.getBaseCodePath(),
-                        overlayPackage.isStaticOverlayPackage(),
-                        overlayPackage.overlayPriority,
+                        isPackageConfiguredMutable(overlayPackage.packageName),
+                        isPackageConfiguredEnabled(overlayPackage.packageName),
+                        getPackageConfiguredPriority(overlayPackage.packageName),
                         overlayPackage.overlayCategory);
             }
 
@@ -374,7 +385,9 @@
         mSettings.init(packageName, userId, overlayPackage.overlayTarget,
                 overlayPackage.targetOverlayableName,
                 overlayPackage.applicationInfo.getBaseCodePath(),
-                overlayPackage.isStaticOverlayPackage(), overlayPackage.overlayPriority,
+                isPackageConfiguredMutable(overlayPackage.packageName),
+                isPackageConfiguredEnabled(overlayPackage.packageName),
+                getPackageConfiguredPriority(overlayPackage.packageName),
                 overlayPackage.overlayCategory);
         try {
             if (updateState(overlayPackage.overlayTarget, packageName, userId, 0)) {
@@ -439,8 +452,10 @@
                     mListener.onOverlaysChanged(pkg.overlayTarget, userId);
                 }
                 mSettings.init(packageName, userId, pkg.overlayTarget, pkg.targetOverlayableName,
-                        pkg.applicationInfo.getBaseCodePath(), pkg.isStaticOverlayPackage(),
-                        pkg.overlayPriority, pkg.overlayCategory);
+                        pkg.applicationInfo.getBaseCodePath(),
+                        isPackageConfiguredMutable(pkg.packageName),
+                        isPackageConfiguredEnabled(pkg.packageName),
+                        getPackageConfiguredPriority(pkg.packageName), pkg.overlayCategory);
             }
 
             if (updateState(pkg.overlayTarget, packageName, userId, 0)) {
@@ -492,13 +507,13 @@
             return false;
         }
 
-        // Ignore static overlays.
-        if (overlayPackage.isStaticOverlayPackage()) {
-            return false;
-        }
-
         try {
             final OverlayInfo oi = mSettings.getOverlayInfo(packageName, userId);
+            if (!oi.isMutable) {
+                // Ignore immutable overlays.
+                return false;
+            }
+
             boolean modified = mSettings.setEnabled(packageName, userId, enable);
             modified |= updateState(oi.targetPackageName, oi.packageName, userId, 0);
 
@@ -534,7 +549,8 @@
             // Disable all other overlays.
             allOverlays.remove(oi);
             for (int i = 0; i < allOverlays.size(); i++) {
-                final String disabledOverlayPackageName = allOverlays.get(i).packageName;
+                final OverlayInfo disabledInfo = allOverlays.get(i);
+                final String disabledOverlayPackageName = disabledInfo.packageName;
                 final PackageInfo disabledOverlayPackageInfo = mPackageManager.getPackageInfo(
                         disabledOverlayPackageName, userId);
                 if (disabledOverlayPackageInfo == null) {
@@ -542,8 +558,8 @@
                     continue;
                 }
 
-                if (disabledOverlayPackageInfo.isStaticOverlayPackage()) {
-                    // Don't touch static overlays.
+                if (!disabledInfo.isMutable) {
+                    // Don't touch immutable overlays.
                     continue;
                 }
                 if (withinCategory && !Objects.equals(disabledOverlayPackageInfo.overlayCategory,
@@ -570,12 +586,16 @@
         }
     }
 
-    private boolean isPackageUpdatableOverlay(@NonNull final String packageName, final int userId) {
-        final PackageInfo overlayPackage = mPackageManager.getPackageInfo(packageName, userId);
-        if (overlayPackage == null || overlayPackage.isStaticOverlayPackage()) {
-            return false;
-        }
-        return true;
+    private boolean isPackageConfiguredMutable(@NonNull final String packageName) {
+        return mOverlayConfig.isMutable(packageName);
+    }
+
+    private int getPackageConfiguredPriority(@NonNull final String packageName) {
+        return mOverlayConfig.getPriority(packageName);
+    }
+
+    private boolean isPackageConfiguredEnabled(@NonNull final String packageName) {
+        return mOverlayConfig.isEnabled(packageName);
     }
 
     boolean setPriority(@NonNull final String packageName,
@@ -585,7 +605,7 @@
                     + newParentPackageName + " userId=" + userId);
         }
 
-        if (!isPackageUpdatableOverlay(packageName, userId)) {
+        if (!isPackageConfiguredMutable(packageName)) {
             return false;
         }
 
@@ -605,7 +625,7 @@
             Slog.d(TAG, "setHighestPriority packageName=" + packageName + " userId=" + userId);
         }
 
-        if (!isPackageUpdatableOverlay(packageName, userId)) {
+        if (!isPackageConfiguredMutable(packageName)) {
             return false;
         }
 
@@ -625,7 +645,7 @@
             Slog.d(TAG, "setLowestPriority packageName=" + packageName + " userId=" + userId);
         }
 
-        if (!isPackageUpdatableOverlay(packageName, userId)) {
+        if (!isPackageConfiguredMutable(packageName)) {
             return false;
         }
 
@@ -682,10 +702,10 @@
         final PackageInfo overlayPackage = mPackageManager.getPackageInfo(overlayPackageName,
                 userId);
 
-        // Static RROs targeting to "android", ie framework-res.apk, are handled by native layers.
+        // Immutable RROs targeting to "android", ie framework-res.apk, are handled by native layers.
         if (targetPackage != null && overlayPackage != null
                 && !("android".equals(targetPackageName)
-                    && overlayPackage.isStaticOverlayPackage())) {
+                    && !isPackageConfiguredMutable(overlayPackageName))) {
             mIdmapManager.createIdmap(targetPackage, overlayPackage, userId);
         }
 
@@ -737,10 +757,6 @@
             return STATE_NO_IDMAP;
         }
 
-        if (overlayPackage.isStaticOverlayPackage()) {
-            return STATE_ENABLED_STATIC;
-        }
-
         final boolean enabled = mSettings.getEnabled(overlayPackage.packageName, userId);
         return enabled ? STATE_ENABLED : STATE_DISABLED;
     }
diff --git a/services/core/java/com/android/server/om/OverlayManagerSettings.java b/services/core/java/com/android/server/om/OverlayManagerSettings.java
index b7346d4..6bccdfc 100644
--- a/services/core/java/com/android/server/om/OverlayManagerSettings.java
+++ b/services/core/java/com/android/server/om/OverlayManagerSettings.java
@@ -67,32 +67,27 @@
     private final ArrayList<SettingsItem> mItems = new ArrayList<>();
 
     void init(@NonNull final String packageName, final int userId,
-            @NonNull final String targetPackageName,  @Nullable final String targetOverlayableName,
-            @NonNull final String baseCodePath, boolean isStatic, int priority,
+            @NonNull final String targetPackageName, @Nullable final String targetOverlayableName,
+            @NonNull final String baseCodePath, boolean isMutable, boolean isEnabled, int priority,
             @Nullable String overlayCategory) {
         remove(packageName, userId);
         final SettingsItem item =
                 new SettingsItem(packageName, userId, targetPackageName, targetOverlayableName,
-                        baseCodePath, isStatic, priority, overlayCategory);
-        if (isStatic) {
-            // All static overlays are always enabled.
-            item.setEnabled(true);
+                        baseCodePath, OverlayInfo.STATE_UNKNOWN, isEnabled, isMutable, priority,
+                        overlayCategory);
 
-            int i;
-            for (i = mItems.size() - 1; i >= 0; i--) {
-                SettingsItem parentItem = mItems.get(i);
-                if (parentItem.mIsStatic && parentItem.mPriority <= priority) {
-                    break;
-                }
+        int i;
+        for (i = mItems.size() - 1; i >= 0; i--) {
+            SettingsItem parentItem = mItems.get(i);
+            if (parentItem.mPriority <= priority) {
+                break;
             }
-            int pos = i + 1;
-            if (pos == mItems.size()) {
-                mItems.add(item);
-            } else {
-                mItems.add(pos, item);
-            }
-        } else {
+        }
+        int pos = i + 1;
+        if (pos == mItems.size()) {
             mItems.add(item);
+        } else {
+            mItems.add(pos, item);
         }
     }
 
@@ -182,19 +177,19 @@
 
     List<OverlayInfo> getOverlaysForTarget(@NonNull final String targetPackageName,
             final int userId) {
-        // Static RROs targeting "android" are loaded from AssetManager, and so they should be
+        // Immutable RROs targeting "android" are loaded from AssetManager, and so they should be
         // ignored in OverlayManagerService.
         return selectWhereTarget(targetPackageName, userId)
-                .filter((i) -> !(i.isStatic() && "android".equals(i.getTargetPackageName())))
+                .filter((i) -> i.isMutable() || !"android".equals(i.getTargetPackageName()))
                 .map(SettingsItem::getOverlayInfo)
                 .collect(Collectors.toList());
     }
 
     ArrayMap<String, List<OverlayInfo>> getOverlaysForUser(final int userId) {
-        // Static RROs targeting "android" are loaded from AssetManager, and so they should be
+        // Immutable RROs targeting "android" are loaded from AssetManager, and so they should be
         // ignored in OverlayManagerService.
         return selectWhereUser(userId)
-                .filter((i) -> !(i.isStatic() && "android".equals(i.getTargetPackageName())))
+                .filter((i) -> i.isMutable() || !"android".equals(i.getTargetPackageName()))
                 .map(SettingsItem::getOverlayInfo)
                 .collect(Collectors.groupingBy(info -> info.targetPackageName, ArrayMap::new,
                         Collectors.toList()));
@@ -320,7 +315,7 @@
         pw.println("mBaseCodePath..........: " + item.getBaseCodePath());
         pw.println("mState.................: " + OverlayInfo.stateToString(item.getState()));
         pw.println("mIsEnabled.............: " + item.isEnabled());
-        pw.println("mIsStatic..............: " + item.isStatic());
+        pw.println("mIsMutable.............: " + item.isMutable());
         pw.println("mPriority..............: " + item.mPriority);
         pw.println("mCategory..............: " + item.mCategory);
 
@@ -352,8 +347,8 @@
             case "isenabled":
                 pw.println(item.mIsEnabled);
                 break;
-            case "isstatic":
-                pw.println(item.mIsStatic);
+            case "ismutable":
+                pw.println(item.mIsMutable);
                 break;
             case "priority":
                 pw.println(item.mPriority);
@@ -446,7 +441,7 @@
             final String category = XmlUtils.readStringAttribute(parser, ATTR_CATEGORY);
 
             return new SettingsItem(packageName, userId, targetPackageName, targetOverlayableName,
-                    baseCodePath, state, isEnabled, isStatic, priority, category);
+                    baseCodePath, state, isEnabled, !isStatic, priority, category);
         }
 
         public static void persist(@NonNull final ArrayList<SettingsItem> table,
@@ -478,7 +473,7 @@
             XmlUtils.writeStringAttribute(xml, ATTR_BASE_CODE_PATH, item.mBaseCodePath);
             XmlUtils.writeIntAttribute(xml, ATTR_STATE, item.mState);
             XmlUtils.writeBooleanAttribute(xml, ATTR_IS_ENABLED, item.mIsEnabled);
-            XmlUtils.writeBooleanAttribute(xml, ATTR_IS_STATIC, item.mIsStatic);
+            XmlUtils.writeBooleanAttribute(xml, ATTR_IS_STATIC, !item.mIsMutable);
             XmlUtils.writeIntAttribute(xml, ATTR_PRIORITY, item.mPriority);
             XmlUtils.writeStringAttribute(xml, ATTR_CATEGORY, item.mCategory);
             xml.endTag(null, TAG_ITEM);
@@ -494,36 +489,28 @@
         private @OverlayInfo.State int mState;
         private boolean mIsEnabled;
         private OverlayInfo mCache;
-        private boolean mIsStatic;
+        private boolean mIsMutable;
         private int mPriority;
         private String mCategory;
 
         SettingsItem(@NonNull final String packageName, final int userId,
                 @NonNull final String targetPackageName,
                 @Nullable final String targetOverlayableName, @NonNull final String baseCodePath,
-                final @OverlayInfo.State int state, final boolean isEnabled, final boolean isStatic,
-                final int priority,  @Nullable String category) {
+                final @OverlayInfo.State int state, final boolean isEnabled,
+                final boolean isMutable, final int priority,  @Nullable String category) {
             mPackageName = packageName;
             mUserId = userId;
             mTargetPackageName = targetPackageName;
             mTargetOverlayableName = targetOverlayableName;
             mBaseCodePath = baseCodePath;
             mState = state;
-            mIsEnabled = isEnabled || isStatic;
+            mIsEnabled = isEnabled;
             mCategory = category;
             mCache = null;
-            mIsStatic = isStatic;
+            mIsMutable = isMutable;
             mPriority = priority;
         }
 
-        SettingsItem(@NonNull final String packageName, final int userId,
-                @NonNull final String targetPackageName,
-                @Nullable final String targetOverlayableName, @NonNull final String baseCodePath,
-                final boolean isStatic, final int priority, @Nullable String category) {
-            this(packageName, userId, targetPackageName, targetOverlayableName, baseCodePath,
-                    OverlayInfo.STATE_UNKNOWN, false, isStatic, priority, category);
-        }
-
         private String getTargetPackageName() {
             return mTargetPackageName;
         }
@@ -567,7 +554,7 @@
         }
 
         private boolean setEnabled(boolean enable) {
-            if (mIsStatic) {
+            if (!mIsMutable) {
                 return false;
             }
 
@@ -591,7 +578,7 @@
         private OverlayInfo getOverlayInfo() {
             if (mCache == null) {
                 mCache = new OverlayInfo(mPackageName, mTargetPackageName, mTargetOverlayableName,
-                        mCategory, mBaseCodePath, mState, mUserId, mPriority, mIsStatic);
+                        mCategory, mBaseCodePath, mState, mUserId, mPriority, mIsMutable);
             }
             return mCache;
         }
@@ -600,8 +587,8 @@
             mCache = null;
         }
 
-        private boolean isStatic() {
-            return mIsStatic;
+        private boolean isMutable() {
+            return mIsMutable;
         }
 
         private int getPriority() {
diff --git a/services/core/java/com/android/server/om/OverlayManagerShellCommand.java b/services/core/java/com/android/server/om/OverlayManagerShellCommand.java
index eb43275..bf99bd6 100644
--- a/services/core/java/com/android/server/om/OverlayManagerShellCommand.java
+++ b/services/core/java/com/android/server/om/OverlayManagerShellCommand.java
@@ -181,7 +181,7 @@
     private void printListOverlay(PrintWriter out, OverlayInfo oi) {
         String status;
         switch (oi.state) {
-            case OverlayInfo.STATE_ENABLED_STATIC:
+            case OverlayInfo.STATE_ENABLED_IMMUTABLE:
             case OverlayInfo.STATE_ENABLED:
                 status = "[x]";
                 break;
diff --git a/services/core/java/com/android/server/pm/AppsFilter.java b/services/core/java/com/android/server/pm/AppsFilter.java
index 0fb889c..a1250cb 100644
--- a/services/core/java/com/android/server/pm/AppsFilter.java
+++ b/services/core/java/com/android/server/pm/AppsFilter.java
@@ -69,7 +69,6 @@
     // Logs all filtering instead of enforcing
     private static final boolean DEBUG_ALLOW_ALL = false;
     private static final boolean DEBUG_LOGGING = false;
-    private static final boolean FEATURE_ENABLED_BY_DEFAULT = true;
 
     /**
      * This contains a list of app UIDs that are implicitly queryable because another app explicitly
@@ -135,7 +134,8 @@
     private static class FeatureConfigImpl implements FeatureConfig {
         private static final String FILTERING_ENABLED_NAME = "package_query_filtering_enabled";
         private final PackageManagerService.Injector mInjector;
-        private volatile boolean mFeatureEnabled = FEATURE_ENABLED_BY_DEFAULT;
+        private volatile boolean mFeatureEnabled =
+                PackageManager.APP_ENUMERATION_ENABLED_BY_DEFAULT;
 
         private FeatureConfigImpl(PackageManagerService.Injector injector) {
             mInjector = injector;
@@ -145,14 +145,14 @@
         public void onSystemReady() {
             mFeatureEnabled = DeviceConfig.getBoolean(
                     NAMESPACE_PACKAGE_MANAGER_SERVICE, FILTERING_ENABLED_NAME,
-                    FEATURE_ENABLED_BY_DEFAULT);
+                    PackageManager.APP_ENUMERATION_ENABLED_BY_DEFAULT);
             DeviceConfig.addOnPropertiesChangedListener(
                     NAMESPACE_PACKAGE_MANAGER_SERVICE, FgThread.getExecutor(),
                     properties -> {
                         if (properties.getKeyset().contains(FILTERING_ENABLED_NAME)) {
                             synchronized (FeatureConfigImpl.this) {
                                 mFeatureEnabled = properties.getBoolean(FILTERING_ENABLED_NAME,
-                                        FEATURE_ENABLED_BY_DEFAULT);
+                                        PackageManager.APP_ENUMERATION_ENABLED_BY_DEFAULT);
                             }
                         }
                     });
diff --git a/services/core/java/com/android/server/pm/ComponentResolver.java b/services/core/java/com/android/server/pm/ComponentResolver.java
index 13bd7e5..0dacadc 100644
--- a/services/core/java/com/android/server/pm/ComponentResolver.java
+++ b/services/core/java/com/android/server/pm/ComponentResolver.java
@@ -32,6 +32,7 @@
 import android.content.pm.InstantAppResolveInfo;
 import android.content.pm.PackageManager;
 import android.content.pm.PackageManagerInternal;
+import android.content.pm.PackageManagerInternal.PrivateResolveFlags;
 import android.content.pm.PackageUserState;
 import android.content.pm.ProviderInfo;
 import android.content.pm.ResolveInfo;
@@ -39,6 +40,7 @@
 import android.content.pm.parsing.AndroidPackage;
 import android.content.pm.parsing.ComponentParseUtils.ParsedActivity;
 import android.content.pm.parsing.ComponentParseUtils.ParsedActivityIntentInfo;
+import android.content.pm.parsing.ComponentParseUtils.ParsedIntentInfo;
 import android.content.pm.parsing.ComponentParseUtils.ParsedProvider;
 import android.content.pm.parsing.ComponentParseUtils.ParsedProviderIntentInfo;
 import android.content.pm.parsing.ComponentParseUtils.ParsedService;
@@ -229,9 +231,11 @@
     }
 
     @Nullable
-    List<ResolveInfo> queryActivities(Intent intent, String resolvedType, int flags, int userId) {
+    List<ResolveInfo> queryActivities(Intent intent, String resolvedType, int flags,
+            @PrivateResolveFlags int privateResolveFlags, int userId) {
         synchronized (mLock) {
-            return mActivities.queryIntent(intent, resolvedType, flags, userId);
+            return mActivities.queryIntent(
+                    intent, resolvedType, flags, privateResolveFlags, userId);
         }
     }
 
@@ -368,7 +372,7 @@
     @Nullable
     List<ResolveInfo> queryReceivers(Intent intent, String resolvedType, int flags, int userId) {
         synchronized (mLock) {
-            return mReceivers.queryIntent(intent, resolvedType, flags, userId);
+            return mReceivers.queryIntent(intent, resolvedType, flags, 0, userId);
         }
     }
 
@@ -1142,8 +1146,105 @@
         }
     }
 
+    private abstract static class MimeGroupsAwareIntentResolver<F extends ParsedIntentInfo, R>
+            extends IntentResolver<F, R> {
+        private ArrayMap<String, F[]> mMimeGroupToFilter = new ArrayMap<>();
+        private boolean mIsUpdatingMimeGroup = false;
+
+        @Override
+        public void addFilter(F f) {
+            applyMimeGroups(f);
+            super.addFilter(f);
+
+            if (!mIsUpdatingMimeGroup) {
+                register_intent_filter(f, f.mimeGroupsIterator(), mMimeGroupToFilter,
+                        "      MimeGroup: ");
+            }
+        }
+
+        @Override
+        protected void removeFilterInternal(F f) {
+            if (!mIsUpdatingMimeGroup) {
+                unregister_intent_filter(f, f.mimeGroupsIterator(), mMimeGroupToFilter,
+                        "      MimeGroup: ");
+            }
+
+            super.removeFilterInternal(f);
+            f.clearDynamicDataTypes();
+        }
+
+        /**
+         * Updates MIME group by applying changes to all IntentFilters
+         * that contain the group and repopulating m*ToFilter maps accordingly
+         *
+         * @param packageName package to which MIME group belongs
+         * @param mimeGroup MIME group to update
+         * @return true, if any intent filters were changed due to this update
+         */
+        public boolean updateMimeGroup(String packageName, String mimeGroup) {
+            F[] filters = mMimeGroupToFilter.get(mimeGroup);
+            int n = filters != null ? filters.length : 0;
+
+            mIsUpdatingMimeGroup = true;
+            boolean hasChanges = false;
+            F filter;
+            for (int i = 0; i < n && (filter = filters[i]) != null; i++) {
+                if (isPackageForFilter(packageName, filter)) {
+                    hasChanges |= updateFilter(filter);
+                }
+            }
+            mIsUpdatingMimeGroup = false;
+            return hasChanges;
+        }
+
+        private boolean updateFilter(F filter) {
+            List<String> oldTypes = filter.dataTypes();
+            removeFilter(filter);
+            addFilter(filter);
+            List<String> newTypes = filter.dataTypes();
+            return !equalLists(oldTypes, newTypes);
+        }
+
+        private boolean equalLists(List<String> first, List<String> second) {
+            if (first == null) {
+                return second == null;
+            } else if (second == null) {
+                return false;
+            }
+
+            if (first.size() != second.size()) {
+                return false;
+            }
+
+            Collections.sort(first);
+            Collections.sort(second);
+            return first.equals(second);
+        }
+
+        private void applyMimeGroups(F filter) {
+            String packageName = filter.getPackageName();
+
+            for (int i = filter.countMimeGroups() - 1; i >= 0; i--) {
+                List<String> mimeTypes = sPackageManagerInternal.getMimeGroup(packageName,
+                        filter.getMimeGroup(i));
+
+                for (int typeIndex = mimeTypes.size() - 1; typeIndex >= 0; typeIndex--) {
+                    String mimeType = mimeTypes.get(typeIndex);
+
+                    try {
+                        filter.addDynamicDataType(mimeType);
+                    } catch (IntentFilter.MalformedMimeTypeException e) {
+                        if (DEBUG) {
+                            Slog.w(TAG, "Malformed mime type: " + mimeType, e);
+                        }
+                    }
+                }
+            }
+        }
+    }
+
     private static class ActivityIntentResolver
-            extends IntentResolver<ParsedActivityIntentInfo, ResolveInfo> {
+            extends MimeGroupsAwareIntentResolver<ParsedActivityIntentInfo, ResolveInfo> {
 
         @Override
         public List<ResolveInfo> queryIntent(Intent intent, String resolvedType,
@@ -1154,11 +1255,12 @@
         }
 
         List<ResolveInfo> queryIntent(Intent intent, String resolvedType, int flags,
-                int userId) {
+                int privateResolveFlags, int userId) {
             if (!sUserManager.exists(userId)) {
                 return null;
             }
             mFlags = flags;
+            mPrivateResolveFlags = privateResolveFlags;
             return super.queryIntent(intent, resolvedType,
                     (flags & PackageManager.MATCH_DEFAULT_ONLY) != 0,
                     userId);
@@ -1388,6 +1490,11 @@
                 }
                 return null;
             }
+            final boolean matchNonBrowserOnly =
+                    (mPrivateResolveFlags & PackageManagerInternal.RESOLVE_NON_BROWSER_ONLY) != 0;
+            if (matchNonBrowserOnly && info.handleAllWebDataURI()) {
+                return null;
+            }
             final ResolveInfo res = new ResolveInfo();
             res.activityInfo = ai;
             if ((mFlags & PackageManager.GET_RESOLVED_FILTER) != 0) {
@@ -1465,6 +1572,7 @@
         private final ArrayMap<ComponentName, ParsedActivity> mActivities =
                 new ArrayMap<>();
         private int mFlags;
+        private int mPrivateResolveFlags;
     }
 
     // Both receivers and activities share a class, but point to different get methods
@@ -1477,7 +1585,7 @@
     }
 
     private static final class ProviderIntentResolver
-            extends IntentResolver<ParsedProviderIntentInfo, ResolveInfo> {
+            extends MimeGroupsAwareIntentResolver<ParsedProviderIntentInfo, ResolveInfo> {
         @Override
         public List<ResolveInfo> queryIntent(Intent intent, String resolvedType,
                 boolean defaultOnly, int userId) {
@@ -1743,7 +1851,7 @@
     }
 
     private static final class ServiceIntentResolver
-            extends IntentResolver<ParsedServiceIntentInfo, ResolveInfo> {
+            extends MimeGroupsAwareIntentResolver<ParsedServiceIntentInfo, ResolveInfo> {
         @Override
         public List<ResolveInfo> queryIntent(Intent intent, String resolvedType,
                 boolean defaultOnly, int userId) {
@@ -2115,4 +2223,17 @@
             return info.authoritiesIterator();
         }
     }
+
+    /**
+     * Removes MIME type from the group, by delegating to IntentResolvers
+     * @return true if any intent filters were changed due to this update
+     */
+    boolean updateMimeGroup(String packageName, String group) {
+        boolean hasChanges = mActivities.updateMimeGroup(packageName, group);
+        hasChanges |= mProviders.updateMimeGroup(packageName, group);
+        hasChanges |= mReceivers.updateMimeGroup(packageName, group);
+        hasChanges |= mServices.updateMimeGroup(packageName, group);
+
+        return hasChanges;
+    }
 }
diff --git a/services/core/java/com/android/server/pm/CrossProfileAppsService.java b/services/core/java/com/android/server/pm/CrossProfileAppsService.java
index 027a302..486282a 100644
--- a/services/core/java/com/android/server/pm/CrossProfileAppsService.java
+++ b/services/core/java/com/android/server/pm/CrossProfileAppsService.java
@@ -16,6 +16,7 @@
 package com.android.server.pm;
 
 import android.content.Context;
+import android.content.pm.CrossProfileAppsInternal;
 
 import com.android.server.SystemService;
 
@@ -30,5 +31,6 @@
     @Override
     public void onStart() {
         publishBinderService(Context.CROSS_PROFILE_APPS_SERVICE, mServiceImpl);
+        publishLocalService(CrossProfileAppsInternal.class, mServiceImpl.getLocalService());
     }
 }
diff --git a/services/core/java/com/android/server/pm/CrossProfileAppsServiceImpl.java b/services/core/java/com/android/server/pm/CrossProfileAppsServiceImpl.java
index 3939f26..ec9b37d 100644
--- a/services/core/java/com/android/server/pm/CrossProfileAppsServiceImpl.java
+++ b/services/core/java/com/android/server/pm/CrossProfileAppsServiceImpl.java
@@ -45,6 +45,7 @@
 import android.content.pm.PackageManagerInternal;
 import android.content.pm.ResolveInfo;
 import android.os.Binder;
+import android.os.IBinder;
 import android.os.RemoteException;
 import android.os.UserHandle;
 import android.os.UserManager;
@@ -66,6 +67,8 @@
 public class CrossProfileAppsServiceImpl extends ICrossProfileApps.Stub {
     private static final String TAG = "CrossProfileAppsService";
 
+    private final LocalService mLocalService = new LocalService();
+
     private Context mContext;
     private Injector mInjector;
 
@@ -77,8 +80,6 @@
     CrossProfileAppsServiceImpl(Context context, Injector injector) {
         mContext = context;
         mInjector = injector;
-
-        LocalServices.addService(CrossProfileAppsInternal.class, new LocalService());
     }
 
     @Override
@@ -167,6 +168,8 @@
         launchIntent.setComponent(component);
         mInjector.getActivityTaskManagerInternal().startActivityAsUser(
                 caller, callingPackage, callingFeatureId, launchIntent,
+                /* resultTo= */ null,
+                Intent.FLAG_ACTIVITY_NEW_TASK,
                 launchMainActivity
                         ? ActivityOptions.makeOpenCrossProfileAppsAnimation().toBundle()
                         : null,
@@ -179,7 +182,8 @@
             String callingPackage,
             String callingFeatureId,
             Intent intent,
-            @UserIdInt int userId) throws RemoteException {
+            @UserIdInt int userId,
+            IBinder callingActivity) throws RemoteException {
         Objects.requireNonNull(callingPackage);
         Objects.requireNonNull(intent);
         Objects.requireNonNull(intent.getComponent(), "The intent must have a Component set");
@@ -205,7 +209,7 @@
         }
 
         if (callerUserId != userId) {
-            if (!hasInteractAcrossProfilesPermission(callingPackage)) {
+            if (!hasCallerGotInteractAcrossProfilesPermission(callingPackage)) {
                 throw new SecurityException("Attempt to launch activity without required "
                         + android.Manifest.permission.INTERACT_ACROSS_PROFILES + " permission"
                         + " or target user is not in the same profile group.");
@@ -214,8 +218,16 @@
 
         verifyActivityCanHandleIntent(launchIntent, callingUid, userId);
 
-        mInjector.getActivityTaskManagerInternal().startActivityAsUser(caller, callingPackage,
-                callingFeatureId, launchIntent, /* options= */ null, userId);
+        mInjector.getActivityTaskManagerInternal()
+                .startActivityAsUser(
+                        caller,
+                        callingPackage,
+                        callingFeatureId,
+                        launchIntent,
+                        callingActivity,
+                        /* startFlags= */ 0,
+                        /* options= */ null,
+                        userId);
         logStartActivityByIntent(callingPackage);
     }
 
@@ -268,20 +280,12 @@
         if (targetUserProfiles.isEmpty()) {
             return false;
         }
-        return hasInteractAcrossProfilesPermission(callingPackage);
+        return hasCallerGotInteractAcrossProfilesPermission(callingPackage);
     }
 
-    private boolean hasInteractAcrossProfilesPermission(String callingPackage) {
-        final int callingUid = mInjector.getCallingUid();
-        final int callingPid = mInjector.getCallingPid();
-        return isPermissionGranted(Manifest.permission.INTERACT_ACROSS_USERS_FULL, callingUid)
-                || isPermissionGranted(Manifest.permission.INTERACT_ACROSS_USERS, callingUid)
-                || PermissionChecker.checkPermissionForPreflight(
-                        mContext,
-                        Manifest.permission.INTERACT_ACROSS_PROFILES,
-                        callingPid,
-                        callingUid,
-                        callingPackage) == PermissionChecker.PERMISSION_GRANTED;
+    private boolean hasCallerGotInteractAcrossProfilesPermission(String callingPackage) {
+        return hasInteractAcrossProfilesPermission(
+                callingPackage, mInjector.getCallingUid(), mInjector.getCallingPid());
     }
 
     private boolean isCrossProfilePackageWhitelisted(String packageName) {
@@ -563,6 +567,10 @@
         setInteractAcrossProfilesAppOp(packageName, AppOpsManager.opToDefaultMode(op));
     }
 
+    CrossProfileAppsInternal getLocalService() {
+        return mLocalService;
+    }
+
     private boolean isSameProfileGroup(@UserIdInt int callerUserId, @UserIdInt int userId) {
         return mInjector.withCleanCallingIdentity(() ->
                 mInjector.getUserManager().isSameProfileGroup(callerUserId, userId));
@@ -589,6 +597,20 @@
                 -> mContext.getSystemService(UserManager.class).isManagedProfile(userId));
     }
 
+    private boolean hasInteractAcrossProfilesPermission(String packageName, int uid, int pid) {
+        if (isPermissionGranted(Manifest.permission.INTERACT_ACROSS_USERS_FULL, uid)
+                || isPermissionGranted(Manifest.permission.INTERACT_ACROSS_USERS, uid)) {
+            return true;
+        }
+        return PermissionChecker.PERMISSION_GRANTED
+                == PermissionChecker.checkPermissionForPreflight(
+                        mContext,
+                        Manifest.permission.INTERACT_ACROSS_PROFILES,
+                        pid,
+                        uid,
+                        packageName);
+    }
+
     private static class InjectorImpl implements Injector {
         private Context mContext;
 
@@ -728,9 +750,11 @@
     }
 
     class LocalService extends CrossProfileAppsInternal {
+
         @Override
-        public boolean verifyPackageHasInteractAcrossProfilePermission(String packageName,
-                @UserIdInt int userId) throws PackageManager.NameNotFoundException {
+        public boolean verifyPackageHasInteractAcrossProfilePermission(
+                String packageName, @UserIdInt int userId)
+                throws PackageManager.NameNotFoundException {
             final int uid = Objects.requireNonNull(
                     mInjector.getPackageManager().getApplicationInfoAsUser(
                             Objects.requireNonNull(packageName), /* flags= */ 0, userId)).uid;
@@ -740,16 +764,13 @@
         @Override
         public boolean verifyUidHasInteractAcrossProfilePermission(String packageName, int uid) {
             Objects.requireNonNull(packageName);
+            return hasInteractAcrossProfilesPermission(
+                    packageName, uid, PermissionChecker.PID_UNKNOWN);
+        }
 
-            return isPermissionGranted(Manifest.permission.INTERACT_ACROSS_USERS_FULL, uid)
-                    || isPermissionGranted(Manifest.permission.INTERACT_ACROSS_USERS, uid)
-                    || isPermissionGranted(Manifest.permission.INTERACT_ACROSS_PROFILES, uid)
-                    || PermissionChecker.checkPermissionForPreflight(
-                            mContext,
-                            Manifest.permission.INTERACT_ACROSS_PROFILES,
-                            PermissionChecker.PID_UNKNOWN,
-                            uid,
-                            packageName) == PermissionChecker.PERMISSION_GRANTED;
+        @Override
+        public List<UserHandle> getTargetUserProfiles(String packageName, int userId) {
+            return getTargetUserProfilesUnchecked(packageName, userId);
         }
     }
 }
diff --git a/services/core/java/com/android/server/pm/LauncherAppsService.java b/services/core/java/com/android/server/pm/LauncherAppsService.java
index f93c663..09e3feb 100644
--- a/services/core/java/com/android/server/pm/LauncherAppsService.java
+++ b/services/core/java/com/android/server/pm/LauncherAppsService.java
@@ -16,7 +16,6 @@
 
 package com.android.server.pm;
 
-import android.Manifest.permission;
 import android.annotation.NonNull;
 import android.annotation.Nullable;
 import android.annotation.UserIdInt;
@@ -307,8 +306,8 @@
             final int callingUserId = injectCallingUserId();
 
             if (targetUserId == callingUserId) return true;
-            if (mContext.checkCallingOrSelfPermission(permission.INTERACT_ACROSS_USERS_FULL)
-                    == PackageManager.PERMISSION_GRANTED) {
+            if (injectHasInteractAcrossUsersFullPermission(injectBinderCallingPid(),
+                    injectBinderCallingUid())) {
                 return true;
             }
 
@@ -684,6 +683,15 @@
                     callingPid, callingUid) == PackageManager.PERMISSION_GRANTED;
         }
 
+        /**
+         * Returns true if the caller has the "INTERACT_ACROSS_USERS_FULL" permission.
+         */
+        @VisibleForTesting
+        boolean injectHasInteractAcrossUsersFullPermission(int callingPid, int callingUid) {
+            return mContext.checkPermission(android.Manifest.permission.INTERACT_ACROSS_USERS_FULL,
+                    callingPid, callingUid) == PackageManager.PERMISSION_GRANTED;
+        }
+
         @Override
         public ParceledListSlice getShortcuts(String callingPackage, long changedSince,
                 String packageName, List shortcutIds, List<LocusId> locusIds,
@@ -896,7 +904,8 @@
             i.setSourceBounds(sourceBounds);
 
             mActivityTaskManagerInternal.startActivityAsUser(caller, callingPackage,
-                    callingFeatureId, i, opts, userId);
+                    callingFeatureId, i, /* resultTo= */ null, Intent.FLAG_ACTIVITY_NEW_TASK, opts,
+                    userId);
         }
 
         @Override
@@ -955,7 +964,8 @@
                 Binder.restoreCallingIdentity(ident);
             }
             mActivityTaskManagerInternal.startActivityAsUser(caller, callingPackage,
-                    callingFeatureId, launchIntent, opts, user.getIdentifier());
+                    callingFeatureId, launchIntent, /* resultTo= */ null,
+                    Intent.FLAG_ACTIVITY_NEW_TASK, opts, user.getIdentifier());
         }
 
         @Override
@@ -978,7 +988,8 @@
                 Binder.restoreCallingIdentity(ident);
             }
             mActivityTaskManagerInternal.startActivityAsUser(caller, callingPackage,
-                    callingFeatureId, intent, opts, user.getIdentifier());
+                    callingFeatureId, intent, /* resultTo= */ null, Intent.FLAG_ACTIVITY_NEW_TASK,
+                    opts, user.getIdentifier());
         }
 
         /** Checks if user is a profile of or same as listeningUser.
diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java
index ad70345..2a3f7ed 100644
--- a/services/core/java/com/android/server/pm/PackageManagerService.java
+++ b/services/core/java/com/android/server/pm/PackageManagerService.java
@@ -179,12 +179,15 @@
 import android.content.pm.PackageManager.ModuleInfoFlags;
 import android.content.pm.PackageManagerInternal;
 import android.content.pm.PackageManagerInternal.PackageListObserver;
+import android.content.pm.PackageManagerInternal.PrivateResolveFlags;
 import android.content.pm.PackageParser;
 import android.content.pm.PackageParser.PackageLite;
 import android.content.pm.PackageParser.PackageParserException;
 import android.content.pm.PackageParser.ParseFlags;
 import android.content.pm.PackageParser.SigningDetails;
 import android.content.pm.PackageParser.SigningDetails.SignatureSchemeVersion;
+import android.content.pm.PackagePartitions;
+import android.content.pm.PackagePartitions.SystemPartition;
 import android.content.pm.PackageStats;
 import android.content.pm.PackageUserState;
 import android.content.pm.ParceledListSlice;
@@ -305,6 +308,7 @@
 import com.android.internal.app.ResolverActivity;
 import com.android.internal.content.NativeLibraryHelper;
 import com.android.internal.content.PackageHelper;
+import com.android.internal.content.om.OverlayConfig;
 import com.android.internal.logging.MetricsLogger;
 import com.android.internal.os.SomeArgs;
 import com.android.internal.os.Zygote;
@@ -792,22 +796,12 @@
      * specificity (the more generic, the earlier in the list a partition appears).
      */
     @VisibleForTesting(visibility = Visibility.PRIVATE)
-    public static final List<SystemPartition> SYSTEM_PARTITIONS = Collections.unmodifiableList(
-            Arrays.asList(
-                    new SystemPartition(Environment.getRootDirectory(), 0 /* scanFlag */,
-                            false /* hasOverlays */),
-                    new SystemPartition(Environment.getVendorDirectory(), SCAN_AS_VENDOR,
-                            true /* hasOverlays */),
-                    new SystemPartition(Environment.getOdmDirectory(), SCAN_AS_ODM,
-                            true /* hasOverlays */),
-                    new SystemPartition(Environment.getOemDirectory(), SCAN_AS_OEM,
-                            true /* hasOverlays */),
-                    new SystemPartition(Environment.getProductDirectory(), SCAN_AS_PRODUCT,
-                            true /* hasOverlays */),
-                    new SystemPartition(Environment.getSystemExtDirectory(), SCAN_AS_SYSTEM_EXT,
-                            true /* hasOverlays */)));
+    public static final List<ScanPartition> SYSTEM_PARTITIONS = Collections.unmodifiableList(
+            PackagePartitions.getOrderedPartitions(ScanPartition::new));
 
-    private final List<SystemPartition> mDirsToScanAsSystem;
+    private final List<ScanPartition> mDirsToScanAsSystem;
+
+    private final OverlayConfig mOverlayConfig;
 
     /**
      * Unit tests will instantiate, extend and/or mock to mock dependencies / behaviors.
@@ -2588,66 +2582,44 @@
         }
     }
 
-    @VisibleForTesting(visibility = Visibility.PRIVATE)
-    public static class SystemPartition {
-        public final File folder;
+    @VisibleForTesting
+    public static class ScanPartition extends SystemPartition {
+        @ScanFlags
         public final int scanFlag;
-        public final File appFolder;
-        @Nullable
-        public final File privAppFolder;
-        @Nullable
-        public final File overlayFolder;
 
-
-        private static boolean shouldScanPrivApps(@ScanFlags int scanFlags) {
-            if ((scanFlags & SCAN_AS_OEM) != 0) {
-                return false;
-            }
-            if (scanFlags == 0) {  // /system partition
-                return true;
-            }
-            if ((scanFlags
-                    & (SCAN_AS_VENDOR | SCAN_AS_ODM | SCAN_AS_PRODUCT | SCAN_AS_SYSTEM_EXT)) != 0) {
-                return true;
-            }
-            if ((scanFlags & SCAN_AS_APK_IN_APEX) != 0) {
-                return true;
-            }
-            return false;
+        public ScanPartition(@NonNull SystemPartition partition) {
+            super(partition);
+            scanFlag = scanFlagForPartition(partition);
         }
 
-        private SystemPartition(File folder, int scanFlag, boolean hasOverlays) {
-            this.folder = folder;
-            this.scanFlag = scanFlag;
-            this.appFolder = toCanonical(new File(folder, "app"));
-            this.privAppFolder = shouldScanPrivApps(scanFlag)
-                    ? toCanonical(new File(folder, "priv-app"))
-                    : null;
-            this.overlayFolder = hasOverlays ? toCanonical(new File(folder, "overlay")) : null;
+        /**
+         * Creates a partition containing the same folders as the original partition but with a
+         * different root folder. The new partition will include the scan flags of the original
+         * partition along with any specified additional scan flags.
+         */
+        public ScanPartition(@NonNull File folder, @NonNull ScanPartition original,
+                @ScanFlags int additionalScanFlag) {
+            super(folder, original);
+            this.scanFlag = original.scanFlag | additionalScanFlag;
         }
 
-        public boolean containsPrivApp(File scanFile) {
-            return FileUtils.contains(privAppFolder, scanFile);
-        }
-
-        public boolean containsApp(File scanFile) {
-            return FileUtils.contains(appFolder, scanFile);
-        }
-
-        public boolean containsPath(String path) {
-            return path.startsWith(folder.getPath() + "/");
-        }
-
-        public boolean containsPrivPath(String path) {
-            return privAppFolder != null && path.startsWith(privAppFolder.getPath() + "/");
-        }
-
-        private static File toCanonical(File dir) {
-            try {
-                return dir.getCanonicalFile();
-            } catch (IOException e) {
-                // failed to look up canonical path, continue with original one
-                return dir;
+        private static int scanFlagForPartition(PackagePartitions.SystemPartition partition) {
+            switch (partition.type) {
+                case PackagePartitions.PARTITION_SYSTEM:
+                    return 0;
+                case PackagePartitions.PARTITION_VENDOR:
+                    return SCAN_AS_VENDOR;
+                case PackagePartitions.PARTITION_ODM:
+                    return SCAN_AS_ODM;
+                case PackagePartitions.PARTITION_OEM:
+                    return SCAN_AS_OEM;
+                case PackagePartitions.PARTITION_PRODUCT:
+                    return SCAN_AS_PRODUCT;
+                case PackagePartitions.PARTITION_SYSTEM_EXT:
+                    return SCAN_AS_SYSTEM_EXT;
+                default:
+                    throw new IllegalStateException("Unable to determine scan flag for "
+                            + partition.folder);
             }
         }
     }
@@ -2751,7 +2723,7 @@
         mDirsToScanAsSystem = new ArrayList<>();
         mDirsToScanAsSystem.addAll(SYSTEM_PARTITIONS);
         mDirsToScanAsSystem.addAll(mApexManager.getActiveApexInfos().stream()
-                .map(ai -> resolveApexToSystemPartition(ai))
+                .map(PackageManagerService::resolveApexToScanPartition)
                 .filter(Objects::nonNull).collect(Collectors.toList()));
         Slog.d(TAG,
                 "Directories scanned as system partitions: [" + mDirsToScanAsSystem.stream().map(
@@ -2900,11 +2872,11 @@
             // For security and version matching reason, only consider overlay packages if they
             // reside in the right directory.
             for (int i = mDirsToScanAsSystem.size() - 1; i >= 0; i--) {
-                final SystemPartition partition = mDirsToScanAsSystem.get(i);
-                if (partition.overlayFolder == null) {
+                final ScanPartition partition = mDirsToScanAsSystem.get(i);
+                if (partition.getOverlayFolder() == null) {
                     continue;
                 }
-                scanDirTracedLI(partition.overlayFolder, systemParseFlags,
+                scanDirTracedLI(partition.getOverlayFolder(), systemParseFlags,
                         systemScanFlags | partition.scanFlag, 0,
                         packageParser, executorService);
             }
@@ -2917,17 +2889,20 @@
                         "Failed to load frameworks package; check log for warnings");
             }
             for (int i = 0, size = mDirsToScanAsSystem.size(); i < size; i++) {
-                final SystemPartition partition = mDirsToScanAsSystem.get(i);
-                if (partition.privAppFolder != null) {
-                    scanDirTracedLI(partition.privAppFolder, systemParseFlags,
+                final ScanPartition partition = mDirsToScanAsSystem.get(i);
+                if (partition.getPrivAppFolder() != null) {
+                    scanDirTracedLI(partition.getPrivAppFolder(), systemParseFlags,
                             systemScanFlags | SCAN_AS_PRIVILEGED | partition.scanFlag, 0,
                             packageParser, executorService);
                 }
-                scanDirTracedLI(partition.appFolder, systemParseFlags,
+                scanDirTracedLI(partition.getAppFolder(), systemParseFlags,
                         systemScanFlags | partition.scanFlag, 0,
                         packageParser, executorService);
             }
 
+            // Parse overlay configuration files to set default enable state, mutability, and
+            // priority of system overlays.
+            mOverlayConfig = OverlayConfig.initializeSystemInstance(mPmInternal::forEachPackage);
 
             // Prune any system packages that no longer exist.
             final List<String> possiblyDeletedUpdatedSystemApps = new ArrayList<>();
@@ -3105,7 +3080,7 @@
                         @ParseFlags int reparseFlags = 0;
                         @ScanFlags int rescanFlags = 0;
                         for (int i1 = 0, size = mDirsToScanAsSystem.size(); i1 < size; i1++) {
-                            SystemPartition partition = mDirsToScanAsSystem.get(i1);
+                            final ScanPartition partition = mDirsToScanAsSystem.get(i1);
                             if (partition.containsPrivApp(scanFile)) {
                                 reparseFlags = systemParseFlags;
                                 rescanFlags = systemScanFlags | SCAN_AS_PRIVILEGED
@@ -6128,8 +6103,8 @@
     @Override
     public ResolveInfo resolveIntent(Intent intent, String resolvedType,
             int flags, int userId) {
-        return resolveIntentInternal(intent, resolvedType, flags, userId, false,
-                Binder.getCallingUid());
+        return resolveIntentInternal(intent, resolvedType, flags, 0 /*privateResolveFlags*/,
+                userId, false, Binder.getCallingUid());
     }
 
     /**
@@ -6137,8 +6112,9 @@
      * However, if {@code resolveForStart} is {@code true}, all instant apps are visible
      * since we need to allow the system to start any installed application.
      */
-    private ResolveInfo resolveIntentInternal(Intent intent, String resolvedType,
-            int flags, int userId, boolean resolveForStart, int filterCallingUid) {
+    private ResolveInfo resolveIntentInternal(Intent intent, String resolvedType, int flags,
+            @PrivateResolveFlags int privateResolveFlags, int userId, boolean resolveForStart,
+            int filterCallingUid) {
         try {
             Trace.traceBegin(TRACE_TAG_PACKAGE_MANAGER, "resolveIntent");
 
@@ -6150,11 +6126,13 @@
 
             Trace.traceBegin(TRACE_TAG_PACKAGE_MANAGER, "queryIntentActivities");
             final List<ResolveInfo> query = queryIntentActivitiesInternal(intent, resolvedType,
-                    flags, filterCallingUid, userId, resolveForStart, true /*allowDynamicSplits*/);
+                    flags, privateResolveFlags, filterCallingUid, userId, resolveForStart,
+                    true /*allowDynamicSplits*/);
             Trace.traceEnd(TRACE_TAG_PACKAGE_MANAGER);
 
             final ResolveInfo bestChoice =
-                    chooseBestActivity(intent, resolvedType, flags, query, userId);
+                    chooseBestActivity(
+                            intent, resolvedType, flags, privateResolveFlags, query, userId);
             return bestChoice;
         } finally {
             Trace.traceEnd(TRACE_TAG_PACKAGE_MANAGER);
@@ -6312,7 +6290,7 @@
     }
 
     private ResolveInfo chooseBestActivity(Intent intent, String resolvedType,
-            int flags, List<ResolveInfo> query, int userId) {
+            int flags, int privateResolveFlags, List<ResolveInfo> query, int userId) {
         if (query != null) {
             final int N = query.size();
             if (N == 1) {
@@ -6354,6 +6332,10 @@
                         }
                     }
                 }
+                if ((privateResolveFlags
+                        & PackageManagerInternal.RESOLVE_NON_RESOLVER_ONLY) != 0) {
+                    return null;
+                }
                 ri = new ResolveInfo(mResolveInfo);
                 ri.activityInfo = new ActivityInfo(ri.activityInfo);
                 ri.activityInfo.labelRes = ResolverActivity.getLabelRes(intent.getAction());
@@ -6767,13 +6749,13 @@
     private @NonNull List<ResolveInfo> queryIntentActivitiesInternal(Intent intent,
             String resolvedType, int flags, int userId) {
         return queryIntentActivitiesInternal(
-                intent, resolvedType, flags, Binder.getCallingUid(), userId,
-                false /*resolveForStart*/, true /*allowDynamicSplits*/);
+                intent, resolvedType, flags, 0 /*privateResolveFlags*/, Binder.getCallingUid(),
+                userId, false /*resolveForStart*/, true /*allowDynamicSplits*/);
     }
 
     private @NonNull List<ResolveInfo> queryIntentActivitiesInternal(Intent intent,
-            String resolvedType, int flags, int filterCallingUid, int userId,
-            boolean resolveForStart, boolean allowDynamicSplits) {
+            String resolvedType, int flags, @PrivateResolveFlags int privateResolveFlags,
+            int filterCallingUid, int userId, boolean resolveForStart, boolean allowDynamicSplits) {
         if (!mUserManager.exists(userId)) return Collections.emptyList();
         final String instantAppPkgName = getInstantAppPackageName(filterCallingUid);
         mPermissionManager.enforceCrossUserPermission(Binder.getCallingUid(), userId,
@@ -6858,7 +6840,7 @@
 
                 // Check for results in the current profile.
                 result = filterIfNotSystemUser(mComponentResolver.queryActivities(
-                        intent, resolvedType, flags, userId), userId);
+                        intent, resolvedType, flags, privateResolveFlags, userId), userId);
                 addInstant = isInstantAppResolutionAllowed(intent, result, userId,
                         false /*skipPackageCheck*/);
                 // Check for cross profile results.
@@ -6957,7 +6939,7 @@
                         | PackageManager.GET_RESOLVED_FILTER
                         | PackageManager.MATCH_INSTANT
                         | PackageManager.MATCH_VISIBLE_TO_INSTANT_APP_ONLY,
-                    userId);
+                    0, userId);
             for (int i = instantApps.size() - 1; i >= 0; --i) {
                 final ResolveInfo info = instantApps.get(i);
                 final String packageName = info.activityInfo.packageName;
@@ -7061,7 +7043,7 @@
             return null;
         }
         List<ResolveInfo> resultTargetUser = mComponentResolver.queryActivities(intent,
-                resolvedType, flags, parentUserId);
+                resolvedType, flags, 0, parentUserId);
 
         if (resultTargetUser == null || resultTargetUser.isEmpty()) {
             return null;
@@ -7246,8 +7228,9 @@
         failureActivityIntent.setPackage(packageName);
         // IMPORTANT: disallow dynamic splits to avoid an infinite loop
         final List<ResolveInfo> result = queryIntentActivitiesInternal(
-                failureActivityIntent, null /*resolvedType*/, 0 /*flags*/, filterCallingUid, userId,
-                false /*resolveForStart*/, false /*allowDynamicSplits*/);
+                failureActivityIntent, null /*resolvedType*/, 0 /*flags*/,
+                0 /*privateResolveFlags*/, filterCallingUid, userId, false /*resolveForStart*/,
+                false /*allowDynamicSplits*/);
         final int NR = result.size();
         if (NR > 0) {
             for (int i = 0; i < NR; i++) {
@@ -7502,7 +7485,7 @@
             String resolvedType, int flags, int sourceUserId) {
         int targetUserId = filter.getTargetUserId();
         List<ResolveInfo> resultTargetUser = mComponentResolver.queryActivities(intent,
-                resolvedType, flags, targetUserId);
+                resolvedType, flags, 0, targetUserId);
         if (resultTargetUser != null && isUserEnabled(targetUserId)) {
             // If all the matches in the target profile are suspended, return null.
             for (int i = resultTargetUser.size() - 1; i >= 0; i--) {
@@ -10911,7 +10894,7 @@
                     parsedPackage.getVersionCode(), parsedPackage.getFlags(),
                     parsedPackage.getPrivateFlags(), user, true /*allowInstall*/, instantApp,
                     virtualPreload, UserManagerService.getInstance(), usesStaticLibraries,
-                    parsedPackage.getUsesStaticLibrariesVersions());
+                    parsedPackage.getUsesStaticLibrariesVersions(), parsedPackage.getMimeGroups());
         } else {
             // make a deep copy to avoid modifying any existing system state.
             pkgSetting = new PackageSetting(pkgSetting);
@@ -10928,7 +10911,8 @@
                     parsedPackage.getPrimaryCpuAbi(), parsedPackage.getSecondaryCpuAbi(),
                     parsedPackage.getFlags(), parsedPackage.getPrivateFlags(),
                     UserManagerService.getInstance(),
-                    usesStaticLibraries, parsedPackage.getUsesStaticLibrariesVersions());
+                    usesStaticLibraries, parsedPackage.getUsesStaticLibrariesVersions(),
+                    parsedPackage.getMimeGroups());
         }
         if (createNewPackage && originalPkgSetting != null) {
             // This is the initial transition from the original package, so,
@@ -11570,50 +11554,17 @@
                     // We are scanning a system overlay. This can be the first scan of the
                     // system/vendor/oem partition, or an update to the system overlay.
                     if ((parseFlags & PackageParser.PARSE_IS_SYSTEM_DIR) == 0) {
-                        // This must be an update to a system overlay.
-                        final PackageSetting previousPkg = assertNotNull(
-                                mSettings.getPackageLPr(pkg.getPackageName()),
-                                "previous package state not present");
-
-                        // previousPkg.pkg may be null: the package will be not be scanned if the
-                        // package manager knows there is a newer version on /data.
-                        // TODO[b/79435695]: Find a better way to keep track of the "static"
-                        // property for RROs instead of having to parse packages on /system
-                        AndroidPackage ppkg = previousPkg.pkg;
-                        if (ppkg == null) {
-                            try {
-                                final PackageParser pp = new PackageParser();
-                                // TODO(b/135203078): Do we really need to parse here? Maybe use
-                                //  a shortened path?
-                                ppkg = pp.parseParsedPackage(previousPkg.codePath,
-                                        parseFlags | PackageParser.PARSE_IS_SYSTEM_DIR,
-                                        false)
-                                        .hideAsFinal();
-                            } catch (PackageParserException e) {
-                                Slog.w(TAG, "failed to parse " + previousPkg.codePath, e);
-                            }
-                        }
-
-                        // Static overlays cannot be updated.
-                        if (ppkg != null && ppkg.isOverlayIsStatic()) {
+                        // This must be an update to a system overlay. Immutable overlays cannot be
+                        // upgraded.
+                        Objects.requireNonNull(mOverlayConfig,
+                                "Parsing non-system dir before overlay configs are initialized");
+                        if (!mOverlayConfig.isMutable(pkg.getPackageName())) {
                             throw new PackageManagerException("Overlay "
                                     + pkg.getPackageName()
                                     + " is static and cannot be upgraded.");
-                        // Non-static overlays cannot be converted to static overlays.
-                        } else if (pkg.isOverlayIsStatic()) {
-                            throw new PackageManagerException("Overlay "
-                                    + pkg.getPackageName()
-                                    + " cannot be upgraded into a static overlay.");
                         }
                     }
                 } else {
-                    // The overlay is a non-system overlay. Non-system overlays cannot be static.
-                    if (pkg.isOverlayIsStatic()) {
-                        throw new PackageManagerException("Overlay "
-                                + pkg.getPackageName()
-                                + " is static but not pre-installed.");
-                    }
-
                     // A non-preloaded overlay packages must have targetSdkVersion >= Q, or be
                     // signed with the platform certificate. Check this in increasing order of
                     // computational cost.
@@ -15207,10 +15158,13 @@
 
                 // We purposefully exclude FLAG_STORAGE_EXTERNAL here, since
                 // this task was only focused on moving data on internal storage.
+                // We don't want ART profiles cleared, because they don't move,
+                // so we would be deleting the only copy (b/149200535).
+                final int flags = FLAG_STORAGE_DE | FLAG_STORAGE_CE
+                        | Installer.FLAG_CLEAR_APP_DATA_KEEP_ART_PROFILES;
                 for (int userId : userIds) {
                     try {
-                        mInstaller.destroyAppData(volumeUuid, move.packageName, userId,
-                                StorageManager.FLAG_STORAGE_DE | StorageManager.FLAG_STORAGE_CE, 0);
+                        mInstaller.destroyAppData(volumeUuid, move.packageName, userId, flags, 0);
                     } catch (InstallerException e) {
                         Slog.w(TAG, String.valueOf(e));
                     }
@@ -17971,14 +17925,13 @@
         }
     }
 
-    private static @Nullable SystemPartition resolveApexToSystemPartition(
+    private static @Nullable ScanPartition resolveApexToScanPartition(
             ApexManager.ActiveApexInfo apexInfo) {
         for (int i = 0, size = SYSTEM_PARTITIONS.size(); i < size; i++) {
-            SystemPartition sp = SYSTEM_PARTITIONS.get(i);
+            ScanPartition sp = SYSTEM_PARTITIONS.get(i);
             if (apexInfo.preInstalledApexPath.getAbsolutePath().startsWith(
                     sp.folder.getAbsolutePath())) {
-                return new SystemPartition(apexInfo.apexDirectory,
-                        sp.scanFlag | SCAN_AS_APK_IN_APEX, false /* hasOverlays */);
+                return new ScanPartition(apexInfo.apexDirectory, sp, SCAN_AS_APK_IN_APEX);
             }
         }
         return null;
@@ -18079,7 +18032,7 @@
                 | PackageParser.PARSE_IS_SYSTEM_DIR;
         @ScanFlags int scanFlags = SCAN_AS_SYSTEM;
         for (int i = 0, size = mDirsToScanAsSystem.size(); i < size; i++) {
-            SystemPartition partition = mDirsToScanAsSystem.get(i);
+            ScanPartition partition = mDirsToScanAsSystem.get(i);
             if (partition.containsPath(codePathString)) {
                 scanFlags |= partition.scanFlag;
                 if (partition.containsPrivPath(codePathString)) {
@@ -18429,15 +18382,7 @@
                     FLAG_STORAGE_DE | FLAG_STORAGE_CE | FLAG_STORAGE_EXTERNAL);
             clearDefaultBrowserIfNeededForUser(ps.name, nextUserId);
             removeKeystoreDataIfNeeded(mInjector.getUserManagerInternal(), nextUserId, ps.appId);
-            final SparseBooleanArray changedUsers = new SparseBooleanArray();
-            clearPackagePreferredActivitiesLPw(ps.name, changedUsers, nextUserId);
-            if (changedUsers.size() > 0) {
-                updateDefaultHomeNotLocked(changedUsers);
-                postPreferredActivityChangedBroadcast(nextUserId);
-                synchronized (mLock) {
-                    scheduleWritePackageRestrictionsLocked(nextUserId);
-                }
-            }
+            clearPackagePreferredActivities(ps.name, nextUserId);
             mPermissionManager.resetRuntimePermissions(pkg, nextUserId);
         }
 
@@ -18926,13 +18871,19 @@
             }
         }
         int callingUserId = UserHandle.getCallingUserId();
+        clearPackagePreferredActivities(packageName, callingUserId);
+    }
+
+    /** This method takes a specific user id as well as UserHandle.USER_ALL. */
+    private void clearPackagePreferredActivities(String packageName, int userId) {
         final SparseBooleanArray changedUsers = new SparseBooleanArray();
-        clearPackagePreferredActivitiesLPw(packageName, changedUsers, callingUserId);
+
+        clearPackagePreferredActivitiesLPw(packageName, changedUsers, userId);
         if (changedUsers.size() > 0) {
             updateDefaultHomeNotLocked(changedUsers);
-            postPreferredActivityChangedBroadcast(callingUserId);
+            postPreferredActivityChangedBroadcast(userId);
             synchronized (mLock) {
-                scheduleWritePackageRestrictionsLocked(callingUserId);
+                scheduleWritePackageRestrictionsLocked(userId);
             }
         }
     }
@@ -21785,6 +21736,7 @@
         }
 
         UserManagerInternal umInternal = mInjector.getUserManagerInternal();
+        StorageManagerInternal smInternal = mInjector.getStorageManagerInternal();
         for (UserInfo user : mUserManager.getUsers(false /*excludeDying*/)) {
             final int flags;
             if (umInternal.isUserUnlockingOrUnlocked(user.id)) {
@@ -21798,6 +21750,13 @@
             if (ps.getInstalled(user.id)) {
                 // TODO: when user data is locked, mark that we're still dirty
                 prepareAppDataLIF(pkg, user.id, flags);
+
+                if (umInternal.isUserUnlockingOrUnlocked(user.id)) {
+                    // Prepare app data on external storage; currently this is used to
+                    // setup any OBB dirs that were created by the installer correctly.
+                    int uid = UserHandle.getUid(user.id, UserHandle.getAppId(pkg.getUid()));
+                    smInternal.prepareAppDataAfterInstall(pkg.getPackageName(), uid);
+                }
             }
         }
     }
@@ -23324,7 +23283,7 @@
         public List<ResolveInfo> queryIntentActivities(
                 Intent intent, String resolvedType, int flags, int filterCallingUid, int userId) {
             return PackageManagerService.this
-                    .queryIntentActivitiesInternal(intent, resolvedType, flags, filterCallingUid,
+                    .queryIntentActivitiesInternal(intent, resolvedType, flags, 0, filterCallingUid,
                             userId, false /*resolveForStart*/, true /*allowDynamicSplits*/);
         }
 
@@ -23610,9 +23569,11 @@
 
         @Override
         public ResolveInfo resolveIntent(Intent intent, String resolvedType,
-                int flags, int userId, boolean resolveForStart, int filterCallingUid) {
+                int flags, int privateResolveFlags, int userId, boolean resolveForStart,
+                int filterCallingUid) {
             return resolveIntentInternal(
-                    intent, resolvedType, flags, userId, resolveForStart, filterCallingUid);
+                    intent, resolvedType, flags, privateResolveFlags, userId, resolveForStart,
+                    filterCallingUid);
         }
 
         @Override
@@ -23932,6 +23893,11 @@
             msg.obj = verificationResult;
             mHandler.sendMessage(msg);
         }
+
+        @Override
+        public List<String> getMimeGroup(String packageName, String mimeGroup) {
+            return PackageManagerService.this.getMimeGroup(packageName, mimeGroup);
+        }
     }
 
     @GuardedBy("mLock")
@@ -24367,6 +24333,38 @@
         }
     }
 
+    private void applyMimeGroupChanges(String packageName, String mimeGroup) {
+        if (mComponentResolver.updateMimeGroup(packageName, mimeGroup)) {
+            clearPackagePreferredActivities(packageName, UserHandle.USER_ALL);
+        }
+
+        mPmInternal.writeSettings(false);
+    }
+
+    @Override
+    public void setMimeGroup(String packageName, String mimeGroup, List<String> mimeTypes) {
+        boolean changed = mSettings.mPackages.get(packageName)
+                .setMimeGroup(mimeGroup, mimeTypes);
+
+        if (changed) {
+            applyMimeGroupChanges(packageName, mimeGroup);
+        }
+    }
+
+    @Override
+    public void clearMimeGroup(String packageName, String mimeGroup) {
+        boolean changed = mSettings.mPackages.get(packageName).clearMimeGroup(mimeGroup);
+
+        if (changed) {
+            applyMimeGroupChanges(packageName, mimeGroup);
+        }
+    }
+
+    @Override
+    public List<String> getMimeGroup(String packageName, String mimeGroup) {
+        return mSettings.mPackages.get(packageName).getMimeGroup(mimeGroup);
+    }
+
     static class ActiveInstallSession {
         private final String mPackageName;
         private final File mStagedDir;
diff --git a/services/core/java/com/android/server/pm/PackageSetting.java b/services/core/java/com/android/server/pm/PackageSetting.java
index bbc0dc9..d83e6f4 100644
--- a/services/core/java/com/android/server/pm/PackageSetting.java
+++ b/services/core/java/com/android/server/pm/PackageSetting.java
@@ -16,18 +16,25 @@
 
 package com.android.server.pm;
 
+import android.annotation.Nullable;
 import android.content.pm.ApplicationInfo;
 import android.content.pm.PackageManager;
 import android.content.pm.UserInfo;
 import android.content.pm.parsing.AndroidPackage;
 import android.content.pm.parsing.ParsedPackage;
 import android.service.pm.PackageProto;
+import android.util.ArrayMap;
+import android.util.ArraySet;
 import android.util.proto.ProtoOutputStream;
 
 import com.android.server.pm.permission.PermissionsState;
 
 import java.io.File;
+import java.util.ArrayList;
+import java.util.Collections;
 import java.util.List;
+import java.util.Map;
+import java.util.Set;
 
 /**
  * Settings data for a particular package we know about.
@@ -50,17 +57,26 @@
      */
     private int sharedUserId;
 
+    /**
+     *  Maps mime group name to the set of Mime types in a group. Mime groups declared
+     *  by app are populated with empty sets at construction.
+     *  Mime groups can not be created/removed at runtime, thus keys in this map should not change
+     */
+    @Nullable
+    Map<String, ArraySet<String>> mimeGroups;
+
     PackageSetting(String name, String realName, File codePath, File resourcePath,
             String legacyNativeLibraryPathString, String primaryCpuAbiString,
             String secondaryCpuAbiString, String cpuAbiOverrideString,
             long pVersionCode, int pkgFlags, int privateFlags,
             int sharedUserId, String[] usesStaticLibraries,
-            long[] usesStaticLibrariesVersions) {
+            long[] usesStaticLibrariesVersions, Map<String, ArraySet<String>> mimeGroups) {
         super(name, realName, codePath, resourcePath, legacyNativeLibraryPathString,
                 primaryCpuAbiString, secondaryCpuAbiString, cpuAbiOverrideString,
                 pVersionCode, pkgFlags, privateFlags,
                 usesStaticLibraries, usesStaticLibrariesVersions);
         this.sharedUserId = sharedUserId;
+        copyMimeGroups(mimeGroups);
     }
 
     /**
@@ -110,6 +126,53 @@
         pkg = orig.pkg;
         sharedUser = orig.sharedUser;
         sharedUserId = orig.sharedUserId;
+        copyMimeGroups(orig.mimeGroups);
+    }
+
+    private void copyMimeGroups(@Nullable Map<String, ArraySet<String>> newMimeGroups) {
+        if (newMimeGroups == null) {
+            mimeGroups = null;
+            return;
+        }
+
+        mimeGroups = new ArrayMap<>(newMimeGroups.size());
+        for (String mimeGroup : newMimeGroups.keySet()) {
+            ArraySet<String> mimeTypes = newMimeGroups.get(mimeGroup);
+
+            if (mimeTypes != null) {
+                mimeGroups.put(mimeGroup, new ArraySet<>(mimeTypes));
+            } else {
+                mimeGroups.put(mimeGroup, new ArraySet<>());
+            }
+        }
+    }
+
+    /**
+     * Updates declared MIME groups, removing no longer declared groups
+     * and keeping previous state of MIME groups
+     */
+    void updateMimeGroups(@Nullable Set<String> newMimeGroupNames) {
+        if (newMimeGroupNames == null) {
+            mimeGroups = null;
+            return;
+        }
+
+        if (mimeGroups == null) {
+            // set mimeGroups to empty map to avoid repeated null-checks in the next loop
+            mimeGroups = Collections.emptyMap();
+        }
+
+        ArrayMap<String, ArraySet<String>> updatedMimeGroups =
+                new ArrayMap<>(newMimeGroupNames.size());
+
+        for (String mimeGroup : newMimeGroupNames) {
+            if (mimeGroups.containsKey(mimeGroup)) {
+                updatedMimeGroups.put(mimeGroup, mimeGroups.get(mimeGroup));
+            } else {
+                updatedMimeGroups.put(mimeGroup, new ArraySet<>());
+            }
+        }
+        mimeGroups = updatedMimeGroups;
     }
 
     @Override
@@ -176,6 +239,41 @@
         return true;
     }
 
+    public boolean setMimeGroup(String mimeGroup, List<String> mimeTypes) {
+        ArraySet<String> oldMimeTypes = getMimeGroupInternal(mimeGroup);
+        if (oldMimeTypes == null) {
+            return false;
+        }
+
+        ArraySet<String> newMimeTypes = new ArraySet<>(mimeTypes);
+        boolean hasChanges = !newMimeTypes.equals(oldMimeTypes);
+        mimeGroups.put(mimeGroup, newMimeTypes);
+        return hasChanges;
+    }
+
+    public boolean clearMimeGroup(String mimeGroup) {
+        ArraySet<String> mimeTypes = getMimeGroupInternal(mimeGroup);
+
+        if (mimeTypes == null || mimeTypes.isEmpty()) {
+            return false;
+        }
+
+        mimeTypes.clear();
+        return true;
+    }
+
+    public List<String> getMimeGroup(String mimeGroup) {
+        ArraySet<String> mimeTypes = getMimeGroupInternal(mimeGroup);
+        if (mimeTypes == null) {
+            return null;
+        }
+        return new ArrayList<>(mimeTypes);
+    }
+
+    private ArraySet<String> getMimeGroupInternal(String mimeGroup) {
+        return mimeGroups != null ? mimeGroups.get(mimeGroup) : null;
+    }
+
     public void dumpDebug(ProtoOutputStream proto, long fieldId, List<UserInfo> users) {
         final long packageToken = proto.start(fieldId);
         proto.write(PackageProto.NAME, (realName != null ? realName : name));
@@ -221,6 +319,9 @@
         pkg = other.pkg;
         sharedUserId = other.sharedUserId;
         sharedUser = other.sharedUser;
+
+        Set<String> mimeGroupNames = other.mimeGroups != null ? other.mimeGroups.keySet() : null;
+        updateMimeGroups(mimeGroupNames);
     }
 
     // TODO(b/135203078): Move to constructor
diff --git a/services/core/java/com/android/server/pm/Settings.java b/services/core/java/com/android/server/pm/Settings.java
index d451152..60c8b94 100644
--- a/services/core/java/com/android/server/pm/Settings.java
+++ b/services/core/java/com/android/server/pm/Settings.java
@@ -226,6 +226,8 @@
     @Deprecated
     private static final String TAG_SUSPENDED_LAUNCHER_EXTRAS = "suspended-launcher-extras";
     private static final String TAG_SUSPEND_PARAMS = "suspend-params";
+    private static final String TAG_MIME_GROUP = "mime-group";
+    private static final String TAG_MIME_TYPE = "mime-type";
 
     public static final String ATTR_NAME = "name";
     public static final String ATTR_PACKAGE = "package";
@@ -266,6 +268,7 @@
     private static final String ATTR_VOLUME_UUID = "volumeUuid";
     private static final String ATTR_SDK_VERSION = "sdkVersion";
     private static final String ATTR_DATABASE_VERSION = "databaseVersion";
+    private static final String ATTR_VALUE = "value";
 
     private final Object mLock;
 
@@ -511,8 +514,7 @@
                 p.legacyNativeLibraryPathString, p.primaryCpuAbiString,
                 p.secondaryCpuAbiString, p.cpuAbiOverrideString,
                 p.appId, p.versionCode, p.pkgFlags, p.pkgPrivateFlags,
-                p.usesStaticLibraries,
-                p.usesStaticLibrariesVersions);
+                p.usesStaticLibraries, p.usesStaticLibrariesVersions, p.mimeGroups);
         mDisabledSysPackages.remove(name);
         return ret;
     }
@@ -529,7 +531,7 @@
             String legacyNativeLibraryPathString, String primaryCpuAbiString,
             String secondaryCpuAbiString, String cpuAbiOverrideString, int uid, long vc, int
             pkgFlags, int pkgPrivateFlags, String[] usesStaticLibraries,
-            long[] usesStaticLibraryNames) {
+            long[] usesStaticLibraryNames, Map<String, ArraySet<String>> mimeGroups) {
         PackageSetting p = mPackages.get(name);
         if (p != null) {
             if (p.appId == uid) {
@@ -542,7 +544,8 @@
         p = new PackageSetting(name, realName, codePath, resourcePath,
                 legacyNativeLibraryPathString, primaryCpuAbiString, secondaryCpuAbiString,
                 cpuAbiOverrideString, vc, pkgFlags, pkgPrivateFlags,
-                0 /*userId*/, usesStaticLibraries, usesStaticLibraryNames);
+                0 /*userId*/, usesStaticLibraries, usesStaticLibraryNames,
+                mimeGroups);
         p.appId = uid;
         if (registerExistingAppIdLPw(uid, p, name)) {
             mPackages.put(name, p);
@@ -605,7 +608,8 @@
             String secondaryCpuAbi, long versionCode, int pkgFlags, int pkgPrivateFlags,
             UserHandle installUser, boolean allowInstall, boolean instantApp,
             boolean virtualPreload, UserManagerService userManager,
-            String[] usesStaticLibraries, long[] usesStaticLibrariesVersions) {
+            String[] usesStaticLibraries, long[] usesStaticLibrariesVersions,
+            Set<String> mimeGroupNames) {
         final PackageSetting pkgSetting;
         if (originalPkg != null) {
             if (PackageManagerService.DEBUG_UPGRADE) Log.v(PackageManagerService.TAG, "Package "
@@ -631,7 +635,7 @@
                     legacyNativeLibraryPath, primaryCpuAbi, secondaryCpuAbi,
                     null /*cpuAbiOverrideString*/, versionCode, pkgFlags, pkgPrivateFlags,
                     0 /*sharedUserId*/, usesStaticLibraries,
-                    usesStaticLibrariesVersions);
+                    usesStaticLibrariesVersions, createMimeGroups(mimeGroupNames));
             pkgSetting.setTimeStamp(codePath.lastModified());
             pkgSetting.sharedUser = sharedUser;
             // If this is not a system app, it starts out stopped.
@@ -704,6 +708,14 @@
         return pkgSetting;
     }
 
+    private static Map<String, ArraySet<String>> createMimeGroups(Set<String> mimeGroupNames) {
+        if (mimeGroupNames == null) {
+            return null;
+        }
+
+        return new KeySetToValueMap<>(mimeGroupNames, new ArraySet<>());
+    }
+
     /**
      * Updates the given package setting using the provided information.
      * <p>
@@ -715,7 +727,8 @@
             @Nullable String legacyNativeLibraryPath, @Nullable String primaryCpuAbi,
             @Nullable String secondaryCpuAbi, int pkgFlags, int pkgPrivateFlags,
             @NonNull UserManagerService userManager,
-            @Nullable String[] usesStaticLibraries, @Nullable long[] usesStaticLibrariesVersions)
+            @Nullable String[] usesStaticLibraries, @Nullable long[] usesStaticLibrariesVersions,
+            @Nullable Set<String> mimeGroupNames)
                     throws PackageManagerException {
         final String pkgName = pkgSetting.name;
         if (pkgSetting.sharedUser != sharedUser) {
@@ -801,6 +814,7 @@
             pkgSetting.usesStaticLibraries = null;
             pkgSetting.usesStaticLibrariesVersions = null;
         }
+        pkgSetting.updateMimeGroups(mimeGroupNames);
     }
 
     /**
@@ -2855,6 +2869,7 @@
         writeUpgradeKeySetsLPr(serializer, pkg.keySetData);
         writeKeySetAliasesLPr(serializer, pkg.keySetData);
         writeDomainVerificationsLPr(serializer, pkg.verificationInfo);
+        writeMimeGroupLPr(serializer, pkg.mimeGroups);
 
         serializer.endTag(null, "package");
     }
@@ -3506,7 +3521,7 @@
         PackageSetting ps = new PackageSetting(name, realName, new File(codePathStr),
                 new File(resourcePathStr), legacyNativeLibraryPathStr, primaryCpuAbiStr,
                 secondaryCpuAbiStr, cpuAbiOverrideStr, versionCode, pkgFlags, pkgPrivateFlags,
-                0 /*sharedUserId*/, null, null);
+                0 /*sharedUserId*/, null, null, null);
         String timeStampStr = parser.getAttributeValue(null, "ft");
         if (timeStampStr != null) {
             try {
@@ -3745,8 +3760,8 @@
                 packageSetting = addPackageLPw(name.intern(), realName, new File(codePathStr),
                         new File(resourcePathStr), legacyNativeLibraryPathStr, primaryCpuAbiString,
                         secondaryCpuAbiString, cpuAbiOverrideString, userId, versionCode, pkgFlags,
-                        pkgPrivateFlags,
-                        null /*usesStaticLibraries*/, null /*usesStaticLibraryVersions*/);
+                        pkgPrivateFlags, null /*usesStaticLibraries*/,
+                        null /*usesStaticLibraryVersions*/, null /*mimeGroups*/);
                 if (PackageManagerService.DEBUG_SETTINGS)
                     Log.i(PackageManagerService.TAG, "Reading package " + name + ": userId="
                             + userId + " pkg=" + packageSetting);
@@ -3764,9 +3779,10 @@
                     packageSetting = new PackageSetting(name.intern(), realName, new File(
                             codePathStr), new File(resourcePathStr), legacyNativeLibraryPathStr,
                             primaryCpuAbiString, secondaryCpuAbiString, cpuAbiOverrideString,
-                            versionCode, pkgFlags, pkgPrivateFlags,
-                            sharedUserId,
-                            null /*usesStaticLibraries*/, null /*usesStaticLibraryVersions*/);
+                            versionCode, pkgFlags, pkgPrivateFlags, sharedUserId,
+                            null /*usesStaticLibraries*/,
+                            null /*usesStaticLibraryVersions*/,
+                            null /*mimeGroups*/);
                     packageSetting.setTimeStamp(timeStamp);
                     packageSetting.firstInstallTime = firstInstallTime;
                     packageSetting.lastUpdateTime = lastUpdateTime;
@@ -3880,6 +3896,8 @@
                             packageSetting.installSource.setInitiatingPackageSignatures(signatures);
                 } else if (tagName.equals(TAG_DOMAIN_VERIFICATION)) {
                     readDomainVerificationLPw(parser, packageSetting);
+                } else if (tagName.equals(TAG_MIME_GROUP)) {
+                    packageSetting.mimeGroups = readMimeGroupLPw(parser, packageSetting.mimeGroups);
                 } else {
                     PackageManagerService.reportSettingsProblem(Log.WARN,
                             "Unknown element under <package>: " + parser.getName());
@@ -3903,6 +3921,67 @@
         }
     }
 
+    private Map<String, ArraySet<String>> readMimeGroupLPw(XmlPullParser parser,
+            Map<String, ArraySet<String>> mimeGroups) throws XmlPullParserException, IOException {
+        String groupName = parser.getAttributeValue(null, ATTR_NAME);
+        if (groupName == null) {
+            XmlUtils.skipCurrentTag(parser);
+            return mimeGroups;
+        }
+
+        if (mimeGroups == null) {
+            mimeGroups = new ArrayMap<>();
+        }
+
+        ArraySet<String> mimeTypes = mimeGroups.get(groupName);
+        if (mimeTypes == null) {
+            mimeTypes = new ArraySet<>();
+            mimeGroups.put(groupName, mimeTypes);
+        }
+        int outerDepth = parser.getDepth();
+        int type;
+        while ((type = parser.next()) != XmlPullParser.END_DOCUMENT
+                && (type != XmlPullParser.END_TAG || parser.getDepth() > outerDepth)) {
+            if (type == XmlPullParser.END_TAG || type == XmlPullParser.TEXT) {
+                continue;
+            }
+
+            String tagName = parser.getName();
+            if (tagName.equals(TAG_MIME_TYPE)) {
+                String typeName = parser.getAttributeValue(null, ATTR_VALUE);
+                if (typeName != null) {
+                    mimeTypes.add(typeName);
+                }
+            } else {
+                PackageManagerService.reportSettingsProblem(Log.WARN,
+                        "Unknown element under <mime-group>: " + parser.getName());
+                XmlUtils.skipCurrentTag(parser);
+            }
+        }
+
+        return mimeGroups;
+    }
+
+    private void writeMimeGroupLPr(XmlSerializer serializer,
+            Map<String, ArraySet<String>> mimeGroups) throws IOException {
+        if (mimeGroups == null) {
+            return;
+        }
+
+        for (String mimeGroup: mimeGroups.keySet()) {
+            serializer.startTag(null, TAG_MIME_GROUP);
+            serializer.attribute(null, ATTR_NAME, mimeGroup);
+
+            for (String mimeType: mimeGroups.get(mimeGroup)) {
+                serializer.startTag(null, TAG_MIME_TYPE);
+                serializer.attribute(null, ATTR_VALUE, mimeType);
+                serializer.endTag(null, TAG_MIME_TYPE);
+            }
+
+            serializer.endTag(null, TAG_MIME_GROUP);
+        }
+    }
+
     private void readDisabledComponentsLPw(PackageSettingBase packageSetting, XmlPullParser parser,
             int userId) throws IOException, XmlPullParserException {
         int outerDepth = parser.getDepth();
@@ -5116,6 +5195,77 @@
         }
     }
 
+    private static class KeySetToValueMap<K, V> implements Map<K, V> {
+        @NonNull
+        private final Set<K> mKeySet;
+        private final V mValue;
+
+        KeySetToValueMap(@NonNull Set<K> keySet, V value) {
+            mKeySet = keySet;
+            mValue = value;
+        }
+
+        @Override
+        public int size() {
+            return mKeySet.size();
+        }
+
+        @Override
+        public boolean isEmpty() {
+            return mKeySet.isEmpty();
+        }
+
+        @Override
+        public boolean containsKey(Object key) {
+            return mKeySet.contains(key);
+        }
+
+        @Override
+        public boolean containsValue(Object value) {
+            return mValue == value;
+        }
+
+        @Override
+        public V get(Object key) {
+            return mValue;
+        }
+
+        @Override
+        public V put(K key, V value) {
+            throw new UnsupportedOperationException();
+        }
+
+        @Override
+        public V remove(Object key) {
+            throw new UnsupportedOperationException();
+        }
+
+        @Override
+        public void putAll(Map<? extends K, ? extends V> m) {
+            throw new UnsupportedOperationException();
+        }
+
+        @Override
+        public void clear() {
+            throw new UnsupportedOperationException();
+        }
+
+        @Override
+        public Set<K> keySet() {
+            return mKeySet;
+        }
+
+        @Override
+        public Collection<V> values() {
+            throw new UnsupportedOperationException();
+        }
+
+        @Override
+        public Set<Entry<K, V>> entrySet() {
+            throw new UnsupportedOperationException();
+        }
+    }
+
     private final class RuntimePermissionPersistence {
         private static final long WRITE_PERMISSIONS_DELAY_MILLIS = 200;
         private static final long MAX_WRITE_PERMISSIONS_DELAY_MILLIS = 2000;
diff --git a/services/core/java/com/android/server/pm/ShortcutService.java b/services/core/java/com/android/server/pm/ShortcutService.java
index 377fd16..12f7d5c 100644
--- a/services/core/java/com/android/server/pm/ShortcutService.java
+++ b/services/core/java/com/android/server/pm/ShortcutService.java
@@ -2773,6 +2773,13 @@
                     userId, /* doCache= */ false);
         }
 
+        @Override
+        public List<ShortcutManager.ShareShortcutInfo> getShareTargets(
+                @NonNull String callingPackage, @NonNull IntentFilter intentFilter, int userId) {
+            return ShortcutService.this.getShareTargets(
+                    callingPackage, intentFilter, userId).getList();
+        }
+
         private void updateCachedShortcutsInternal(int launcherUserId,
                 @NonNull String callingPackage, @NonNull String packageName,
                 @NonNull List<String> shortcutIds, int userId, boolean doCache) {
diff --git a/services/core/java/com/android/server/pm/TEST_MAPPING b/services/core/java/com/android/server/pm/TEST_MAPPING
index 81c7471..97f9548 100644
--- a/services/core/java/com/android/server/pm/TEST_MAPPING
+++ b/services/core/java/com/android/server/pm/TEST_MAPPING
@@ -13,6 +13,9 @@
       "name": "AppEnumerationTests"
     },
     {
+      "name": "CtsMatchFlagTestCases"
+    },
+    {
       "name": "FrameworksServicesTests",
       "options": [
         {
diff --git a/services/core/java/com/android/server/pm/UserManagerService.java b/services/core/java/com/android/server/pm/UserManagerService.java
index cb755f9..df3c83a 100644
--- a/services/core/java/com/android/server/pm/UserManagerService.java
+++ b/services/core/java/com/android/server/pm/UserManagerService.java
@@ -437,7 +437,7 @@
     /**
      * Start an {@link IntentSender} when user is unlocked after disabling quiet mode.
      *
-     * @see {@link #requestQuietModeEnabled(String, boolean, int, IntentSender)}
+     * @see #requestQuietModeEnabled(String, boolean, int, IntentSender, int)
      */
     private class DisableQuietModeUserUnlockedCallback extends IProgressListener.Stub {
         private final IntentSender mTarget;
@@ -967,7 +967,16 @@
                     "target should only be specified when we are disabling quiet mode.");
         }
 
-        ensureCanModifyQuietMode(callingPackage, Binder.getCallingUid(), userId, target != null);
+        final boolean dontAskCredential =
+                (flags & UserManager.QUIET_MODE_DISABLE_DONT_ASK_CREDENTIAL) != 0;
+        final boolean onlyIfCredentialNotRequired =
+                (flags & UserManager.QUIET_MODE_DISABLE_ONLY_IF_CREDENTIAL_NOT_REQUIRED) != 0;
+        if (dontAskCredential && onlyIfCredentialNotRequired) {
+            throw new IllegalArgumentException("invalid flags: " + flags);
+        }
+
+        ensureCanModifyQuietMode(
+                callingPackage, Binder.getCallingUid(), userId, target != null, dontAskCredential);
         final long identity = Binder.clearCallingIdentity();
         try {
             if (enableQuietMode) {
@@ -976,11 +985,11 @@
                 return true;
             }
             mLockPatternUtils.tryUnlockWithCachedUnifiedChallenge(userId);
-            boolean needToShowConfirmCredential =
-                    mLockPatternUtils.isSecure(userId)
-                            && !StorageManager.isUserKeyUnlocked(userId);
+            final boolean needToShowConfirmCredential = !dontAskCredential
+                    && mLockPatternUtils.isSecure(userId)
+                    && !StorageManager.isUserKeyUnlocked(userId);
             if (needToShowConfirmCredential) {
-                if ((flags & UserManager.QUIET_MODE_DISABLE_ONLY_IF_CREDENTIAL_NOT_REQUIRED) != 0) {
+                if (onlyIfCredentialNotRequired) {
                     return false;
                 }
                 showConfirmCredentialToDisableQuietMode(userId, target);
@@ -1007,7 +1016,7 @@
      * {@link Manifest.permission#MANAGE_USERS}.
      */
     private void ensureCanModifyQuietMode(String callingPackage, int callingUid,
-            @UserIdInt int targetUserId, boolean startIntent) {
+            @UserIdInt int targetUserId, boolean startIntent, boolean dontAskCredential) {
         if (hasManageUsersPermission()) {
             return;
         }
@@ -1015,6 +1024,10 @@
             throw new SecurityException("MANAGE_USERS permission is required to start intent "
                     + "after disabling quiet mode.");
         }
+        if (dontAskCredential) {
+            throw new SecurityException("MANAGE_USERS permission is required to disable quiet "
+                    + "mode without credentials.");
+        }
         if (!isSameProfileGroupNoChecks(UserHandle.getUserId(callingUid), targetUserId)) {
             throw new SecurityException("MANAGE_USERS permission is required to modify quiet mode "
                     + "for a different profile group.");
diff --git a/services/core/java/com/android/server/pm/permission/DefaultPermissionGrantPolicy.java b/services/core/java/com/android/server/pm/permission/DefaultPermissionGrantPolicy.java
index e6eaf21..9c945d5 100644
--- a/services/core/java/com/android/server/pm/permission/DefaultPermissionGrantPolicy.java
+++ b/services/core/java/com/android/server/pm/permission/DefaultPermissionGrantPolicy.java
@@ -150,6 +150,12 @@
         ALWAYS_LOCATION_PERMISSIONS.add(Manifest.permission.ACCESS_BACKGROUND_LOCATION);
     }
 
+    private static final Set<String> FOREGROUND_LOCATION_PERMISSIONS = new ArraySet<>();
+    static {
+        ALWAYS_LOCATION_PERMISSIONS.add(Manifest.permission.ACCESS_FINE_LOCATION);
+        ALWAYS_LOCATION_PERMISSIONS.add(Manifest.permission.ACCESS_COARSE_LOCATION);
+    }
+
     private static final Set<String> COARSE_BACKGROUND_LOCATION_PERMISSIONS = new ArraySet<>();
     static {
         COARSE_BACKGROUND_LOCATION_PERMISSIONS.add(Manifest.permission.ACCESS_COARSE_LOCATION);
@@ -587,11 +593,6 @@
                         DevicePolicyManager.ACTION_PROVISION_MANAGED_DEVICE, userId),
                 userId, CONTACTS_PERMISSIONS);
 
-        // Maps
-        grantPermissionsToSystemPackage(
-                getDefaultSystemHandlerActivityPackageForCategory(Intent.CATEGORY_APP_MAPS, userId),
-                userId, ALWAYS_LOCATION_PERMISSIONS);
-
         // Email
         grantPermissionsToSystemPackage(
                 getDefaultSystemHandlerActivityPackageForCategory(
@@ -609,7 +610,7 @@
             }
         }
         grantPermissionsToPackage(browserPackage, userId, false /* ignoreSystemPackage */,
-                true /*whitelistRestrictedPermissions*/, ALWAYS_LOCATION_PERMISSIONS);
+                true /*whitelistRestrictedPermissions*/, FOREGROUND_LOCATION_PERMISSIONS);
 
         // Voice interaction
         if (voiceInteractPackageNames != null) {
diff --git a/services/core/java/com/android/server/policy/PermissionPolicyService.java b/services/core/java/com/android/server/policy/PermissionPolicyService.java
index 43d4596..ec8e1a0 100644
--- a/services/core/java/com/android/server/policy/PermissionPolicyService.java
+++ b/services/core/java/com/android/server/policy/PermissionPolicyService.java
@@ -39,7 +39,9 @@
 import android.content.pm.PackageManagerInternal;
 import android.content.pm.PackageManagerInternal.PackageListObserver;
 import android.content.pm.PermissionInfo;
+import android.content.pm.parsing.AndroidPackage;
 import android.os.Build;
+import android.os.Process;
 import android.os.RemoteException;
 import android.os.ServiceManager;
 import android.os.UserHandle;
@@ -50,15 +52,14 @@
 import android.util.ArrayMap;
 import android.util.ArraySet;
 import android.util.LongSparseLongArray;
+import android.util.Pair;
 import android.util.Slog;
-import android.util.SparseArray;
 import android.util.SparseBooleanArray;
 
 import com.android.internal.annotations.GuardedBy;
 import com.android.internal.app.IAppOpsCallback;
 import com.android.internal.app.IAppOpsService;
 import com.android.internal.infra.AndroidFuture;
-import com.android.internal.util.ArrayUtils;
 import com.android.internal.util.IntPair;
 import com.android.internal.util.function.pooled.PooledLambda;
 import com.android.server.FgThread;
@@ -69,7 +70,6 @@
 
 import java.util.ArrayList;
 import java.util.List;
-import java.util.Objects;
 import java.util.concurrent.ExecutionException;
 
 /**
@@ -100,7 +100,7 @@
      * scheduled for a package/user.
      */
     @GuardedBy("mLock")
-    private final ArraySet<Integer> mIsPackageSyncsScheduled = new ArraySet<>();
+    private final ArraySet<Pair<String, Integer>> mIsPackageSyncsScheduled = new ArraySet<>();
 
     public PermissionPolicyService(@NonNull Context context) {
         super(context);
@@ -125,8 +125,10 @@
 
             @Override
             public void onPackageChanged(String packageName, int uid) {
-                if (isStarted(UserHandle.getUserId(uid))) {
-                    synchronizePackagePermissionsAndAppOpsForUser(uid);
+                final int userId = UserHandle.getUserId(uid);
+
+                if (isStarted(userId)) {
+                    synchronizePackagePermissionsAndAppOpsForUser(packageName, userId);
                 }
             }
 
@@ -137,21 +139,12 @@
         });
 
         permManagerInternal.addOnRuntimePermissionStateChangedListener(
-                (packageName, userId) -> {
-                    int uid;
-                    try {
-                        uid = getContext().getPackageManager().getPackageUidAsUser(packageName, 0,
-                                userId);
-                    } catch (NameNotFoundException e) {
-                        Slog.e(LOG_TAG, "Cannot synchronize changed package " + packageName, e);
-                        return;
-                    }
-                    synchronizeUidPermissionsAndAppOpsAsync(uid);
-                });
+                this::synchronizePackagePermissionsAndAppOpsAsyncForUser);
 
         mAppOpsCallback = new IAppOpsCallback.Stub() {
             public void opChanged(int op, int uid, String packageName) {
-                synchronizeUidPermissionsAndAppOpsAsync(uid);
+                synchronizePackagePermissionsAndAppOpsAsyncForUser(packageName,
+                        UserHandle.getUserId(uid));
             }
         };
 
@@ -201,17 +194,19 @@
         return AppOpsManager.opToSwitch(op);
     }
 
-    private void synchronizeUidPermissionsAndAppOpsAsync(int uid) {
-        if (isStarted(UserHandle.getUserId(uid))) {
+    private void synchronizePackagePermissionsAndAppOpsAsyncForUser(@NonNull String packageName,
+            @UserIdInt int changedUserId) {
+        if (isStarted(changedUserId)) {
             synchronized (mLock) {
-                if (mIsPackageSyncsScheduled.add(uid)) {
+                if (mIsPackageSyncsScheduled.add(new Pair<>(packageName, changedUserId))) {
                     FgThread.getHandler().sendMessage(PooledLambda.obtainMessage(
                             PermissionPolicyService
                                     ::synchronizePackagePermissionsAndAppOpsForUser,
-                            this, uid));
+                            this, packageName, changedUserId));
                 } else {
                     if (DEBUG) {
-                        Slog.v(LOG_TAG, "sync for " + uid + " already scheduled");
+                        Slog.v(LOG_TAG, "sync for " + packageName + "/" + changedUserId
+                                + " already scheduled");
                     }
                 }
             }
@@ -340,20 +335,39 @@
     /**
      * Synchronize a single package.
      */
-    private void synchronizePackagePermissionsAndAppOpsForUser(int uid) {
+    private void synchronizePackagePermissionsAndAppOpsForUser(@NonNull String packageName,
+            @UserIdInt int userId) {
         synchronized (mLock) {
-            mIsPackageSyncsScheduled.remove(uid);
+            mIsPackageSyncsScheduled.remove(new Pair<>(packageName, userId));
         }
 
         if (DEBUG) {
             Slog.v(LOG_TAG,
-                    "synchronizePackagePermissionsAndAppOpsForUser(" + uid + ")");
+                    "synchronizePackagePermissionsAndAppOpsForUser(" + packageName + ", "
+                            + userId + ")");
         }
 
+        final PackageManagerInternal packageManagerInternal = LocalServices.getService(
+                PackageManagerInternal.class);
+        final PackageInfo pkg = packageManagerInternal.getPackageInfo(packageName, 0,
+                Process.SYSTEM_UID, userId);
+        if (pkg == null) {
+            return;
+        }
         final PermissionToOpSynchroniser synchroniser = new PermissionToOpSynchroniser(
-                getUserContext(getContext(), UserHandle.getUserHandleForUid(uid)));
-        synchroniser.addUid(uid);
-        synchroniser.syncUids();
+                getUserContext(getContext(), UserHandle.of(userId)));
+        synchroniser.addPackage(pkg.packageName);
+        final String[] sharedPkgNames = packageManagerInternal.getSharedUserPackagesForPackage(
+                pkg.packageName, userId);
+
+        for (String sharedPkgName : sharedPkgNames) {
+            final AndroidPackage sharedPkg = packageManagerInternal
+                    .getPackage(sharedPkgName);
+            if (sharedPkg != null) {
+                synchroniser.addPackage(sharedPkg.getPackageName());
+            }
+        }
+        synchroniser.syncPackages();
     }
 
     /**
@@ -367,8 +381,8 @@
         final PermissionToOpSynchroniser synchronizer = new PermissionToOpSynchroniser(
                 getUserContext(getContext(), UserHandle.of(userId)));
         packageManagerInternal.forEachPackage(
-                (pkg) -> synchronizer.addUid(pkg.getUid()));
-        synchronizer.syncUids();
+                (pkg) -> synchronizer.addPackage(pkg.getPackageName()));
+        synchronizer.syncPackages();
     }
 
     /**
@@ -383,51 +397,37 @@
 
         private final @NonNull ArrayMap<String, PermissionInfo> mRuntimePermissionInfos;
 
-        // Cache uid -> packageNames
-        private SparseArray<String[]> mUidToPkg = new SparseArray<>();
-
         /**
          * All ops that need to be flipped to allow.
          *
-         * @see #syncUids
+         * @see #syncPackages
          */
-        private final @NonNull ArraySet<OpToChange> mOpsToAllow = new ArraySet<>();
+        private final @NonNull ArrayList<OpToChange> mOpsToAllow = new ArrayList<>();
 
         /**
          * All ops that need to be flipped to ignore.
          *
-         * @see #syncUids
+         * @see #syncPackages
          */
-        private final @NonNull ArraySet<OpToChange> mOpsToIgnore = new ArraySet<>();
+        private final @NonNull ArrayList<OpToChange> mOpsToIgnore = new ArrayList<>();
 
         /**
          * All ops that need to be flipped to ignore if not allowed.
          *
          * Currently, only used by soft restricted permissions logic.
          *
-         * @see #syncUids
+         * @see #syncPackages
          */
-        private final @NonNull ArraySet<OpToChange> mOpsToIgnoreIfNotAllowed = new ArraySet<>();
+        private final @NonNull ArrayList<OpToChange> mOpsToIgnoreIfNotAllowed = new ArrayList<>();
 
         /**
          * All ops that need to be flipped to foreground.
          *
          * Currently, only used by the foreground/background permissions logic.
          *
-         * @see #syncUids
+         * @see #syncPackages
          */
-        private final @NonNull ArraySet<OpToChange> mOpsToForeground = new ArraySet<>();
-
-        private @Nullable String[] getPackageNamesForUid(int uid) {
-            String[] pkgs = mUidToPkg.get(uid);
-            if (pkgs != null) {
-                return pkgs;
-            }
-
-            pkgs = mPackageManager.getPackagesForUid(uid);
-            mUidToPkg.put(uid, pkgs);
-            return pkgs;
-        }
+        private final @NonNull ArrayList<OpToChange> mOpsToForeground = new ArrayList<>();
 
         PermissionToOpSynchroniser(@NonNull Context context) {
             mContext = context;
@@ -449,11 +449,11 @@
         }
 
         /**
-         * Set app ops that were added in {@link #addUid}.
+         * Set app ops that were added in {@link #addPackage}.
          *
          * <p>This processes ops previously added by {@link #addAppOps(PackageInfo, String)}
          */
-        private void syncUids() {
+        private void syncPackages() {
             // Remember which ops were already set. This makes sure that we always set the most
             // permissive mode if two OpChanges are scheduled. This can e.g. happen if two
             // permissions change the same op. See {@link #getSwitchOp}.
@@ -461,42 +461,42 @@
 
             final int allowCount = mOpsToAllow.size();
             for (int i = 0; i < allowCount; i++) {
-                final OpToChange op = mOpsToAllow.valueAt(i);
+                final OpToChange op = mOpsToAllow.get(i);
 
-                setUidModeAllowed(op.code, op.uid);
+                setUidModeAllowed(op.code, op.uid, op.packageName);
                 alreadySetAppOps.put(IntPair.of(op.uid, op.code), 1);
             }
 
             final int foregroundCount = mOpsToForeground.size();
             for (int i = 0; i < foregroundCount; i++) {
-                final OpToChange op = mOpsToForeground.valueAt(i);
+                final OpToChange op = mOpsToForeground.get(i);
                 if (alreadySetAppOps.indexOfKey(IntPair.of(op.uid, op.code)) >= 0) {
                     continue;
                 }
 
-                setUidModeForeground(op.code, op.uid);
+                setUidModeForeground(op.code, op.uid, op.packageName);
                 alreadySetAppOps.put(IntPair.of(op.uid, op.code), 1);
             }
 
             final int ignoreCount = mOpsToIgnore.size();
             for (int i = 0; i < ignoreCount; i++) {
-                final OpToChange op = mOpsToIgnore.valueAt(i);
+                final OpToChange op = mOpsToIgnore.get(i);
                 if (alreadySetAppOps.indexOfKey(IntPair.of(op.uid, op.code)) >= 0) {
                     continue;
                 }
 
-                setUidModeIgnored(op.code, op.uid);
+                setUidModeIgnored(op.code, op.uid, op.packageName);
                 alreadySetAppOps.put(IntPair.of(op.uid, op.code), 1);
             }
 
             final int ignoreIfNotAllowedCount = mOpsToIgnoreIfNotAllowed.size();
             for (int i = 0; i < ignoreIfNotAllowedCount; i++) {
-                final OpToChange op = mOpsToIgnoreIfNotAllowed.valueAt(i);
+                final OpToChange op = mOpsToIgnoreIfNotAllowed.get(i);
                 if (alreadySetAppOps.indexOfKey(IntPair.of(op.uid, op.code)) >= 0) {
                     continue;
                 }
 
-                boolean wasSet = setUidModeIgnoredIfNotAllowed(op.code, op.uid);
+                boolean wasSet = setUidModeIgnoredIfNotAllowed(op.code, op.uid, op.packageName);
                 if (wasSet) {
                     alreadySetAppOps.put(IntPair.of(op.uid, op.code), 1);
                 }
@@ -555,7 +555,7 @@
             }
 
             int uid = packageInfo.applicationInfo.uid;
-            OpToChange opToChange = new OpToChange(uid, appOpCode);
+            OpToChange opToChange = new OpToChange(uid, packageName, appOpCode);
             switch (appOpMode) {
                 case MODE_ALLOWED:
                     mOpsToAllow.add(opToChange);
@@ -618,7 +618,8 @@
             }
 
             int uid = packageInfo.applicationInfo.uid;
-            OpToChange extraOpToChange = new OpToChange(uid, extraOpCode);
+            String packageName = packageInfo.packageName;
+            OpToChange extraOpToChange = new OpToChange(uid, packageName, extraOpCode);
             if (policy.mayAllowExtraAppOp()) {
                 mOpsToAllow.add(extraOpToChange);
             } else {
@@ -631,59 +632,48 @@
         }
 
         /**
-         * Add a Uid for {@link #syncUids() processing} later.
+         * Add a package for {@link #syncPackages() processing} later.
          *
          * <p>Note: Called with the package lock held. Do <u>not</u> call into app-op manager.
          *
-         * @param uid The uid to add for later processing.
+         * @param pkgName The package to add for later processing.
          */
-        void addUid(int uid) {
-            String[] pkgNames = getPackageNamesForUid(uid);
-            if (pkgNames == null) {
+        void addPackage(@NonNull String pkgName) {
+            final PackageInfo pkg;
+            try {
+                pkg = mPackageManager.getPackageInfo(pkgName, GET_PERMISSIONS);
+            } catch (NameNotFoundException e) {
                 return;
             }
 
-            for (String pkgName : pkgNames) {
-                final PackageInfo pkg;
-                try {
-                    pkg = mPackageManager.getPackageInfo(pkgName, GET_PERMISSIONS);
-                } catch (NameNotFoundException e) {
-                    continue;
-                }
+            if (pkg.requestedPermissions == null) {
+                return;
+            }
 
-                if (pkg.requestedPermissions == null) {
-                    continue;
-                }
-
-                for (String permission : pkg.requestedPermissions) {
-                    addAppOps(pkg, permission);
-                }
+            for (String permission : pkg.requestedPermissions) {
+                addAppOps(pkg, permission);
             }
         }
 
-        private void setUidModeAllowed(int opCode, int uid) {
-            setUidMode(opCode, uid, MODE_ALLOWED);
+        private void setUidModeAllowed(int opCode, int uid, @NonNull String packageName) {
+            setUidMode(opCode, uid, MODE_ALLOWED, packageName);
         }
 
-        private void setUidModeForeground(int opCode, int uid) {
-            setUidMode(opCode, uid, MODE_FOREGROUND);
+        private void setUidModeForeground(int opCode, int uid, @NonNull String packageName) {
+            setUidMode(opCode, uid, MODE_FOREGROUND, packageName);
         }
 
-        private void setUidModeIgnored(int opCode, int uid) {
-            setUidMode(opCode, uid, MODE_IGNORED);
+        private void setUidModeIgnored(int opCode, int uid, @NonNull String packageName) {
+            setUidMode(opCode, uid, MODE_IGNORED, packageName);
         }
 
-        private boolean setUidModeIgnoredIfNotAllowed(int opCode, int uid) {
-            String[] pkgsOfUid = getPackageNamesForUid(uid);
-            if (ArrayUtils.isEmpty(pkgsOfUid)) {
-                return false;
-            }
-
+        private boolean setUidModeIgnoredIfNotAllowed(int opCode, int uid,
+                @NonNull String packageName) {
             final int currentMode = mAppOpsManager.unsafeCheckOpRaw(AppOpsManager.opToPublicName(
-                    opCode), uid, pkgsOfUid[0]);
+                    opCode), uid, packageName);
             if (currentMode != MODE_ALLOWED) {
                 if (currentMode != MODE_IGNORED) {
-                    mAppOpsManagerInternal.setUidModeIgnoringCallback(opCode, uid, MODE_IGNORED,
+                    mAppOpsManagerInternal.setUidModeFromPermissionPolicy(opCode, uid, MODE_IGNORED,
                             mAppOpsCallback);
                 }
                 return true;
@@ -691,24 +681,20 @@
             return false;
         }
 
-        private void setUidMode(int opCode, int uid, int mode) {
-            String[] pkgsOfUid = getPackageNamesForUid(uid);
-            if (ArrayUtils.isEmpty(pkgsOfUid)) {
-                return;
-            }
-
+        private void setUidMode(int opCode, int uid, int mode,
+                @NonNull String packageName) {
             final int oldMode = mAppOpsManager.unsafeCheckOpRaw(AppOpsManager.opToPublicName(
-                    opCode), uid, pkgsOfUid[0]);
+                    opCode), uid, packageName);
             if (oldMode != mode) {
-                mAppOpsManagerInternal.setUidModeIgnoringCallback(opCode, uid, mode,
+                mAppOpsManagerInternal.setUidModeFromPermissionPolicy(opCode, uid, mode,
                         mAppOpsCallback);
                 final int newMode = mAppOpsManager.unsafeCheckOpRaw(AppOpsManager.opToPublicName(
-                        opCode), uid, pkgsOfUid[0]);
+                        opCode), uid, packageName);
                 if (newMode != mode) {
                     // Work around incorrectly-set package mode. It never makes sense for app ops
                     // related to runtime permissions, but can get in the way and we have to reset
                     // it.
-                    mAppOpsManagerInternal.setModeIgnoringCallback(opCode, uid, pkgsOfUid[0],
+                    mAppOpsManagerInternal.setModeFromPermissionPolicy(opCode, uid, packageName,
                             AppOpsManager.opToDefaultMode(opCode), mAppOpsCallback);
                 }
             }
@@ -716,30 +702,14 @@
 
         private class OpToChange {
             final int uid;
+            final @NonNull String packageName;
             final int code;
 
-            OpToChange(int uid, int code) {
+            OpToChange(int uid, @NonNull String packageName, int code) {
                 this.uid = uid;
+                this.packageName = packageName;
                 this.code = code;
             }
-
-            @Override
-            public boolean equals(Object o) {
-                if (this == o) {
-                    return true;
-                }
-                if (o == null || getClass() != o.getClass()) {
-                    return false;
-                }
-
-                OpToChange other = (OpToChange) o;
-                return uid == other.uid && code == other.code;
-            }
-
-            @Override
-            public int hashCode() {
-                return Objects.hash(uid, code);
-            }
         }
     }
 
diff --git a/services/core/java/com/android/server/power/PowerManagerService.java b/services/core/java/com/android/server/power/PowerManagerService.java
index a7b0d84..8483c77 100644
--- a/services/core/java/com/android/server/power/PowerManagerService.java
+++ b/services/core/java/com/android/server/power/PowerManagerService.java
@@ -242,8 +242,8 @@
     private final ServiceThread mHandlerThread;
     private final PowerManagerHandler mHandler;
     private final AmbientDisplayConfiguration mAmbientDisplayConfiguration;
-    private final BatterySaverPolicy mBatterySaverPolicy;
     private final BatterySaverController mBatterySaverController;
+    private final BatterySaverPolicy mBatterySaverPolicy;
     private final BatterySaverStateMachine mBatterySaverStateMachine;
     private final BatterySavingStats mBatterySavingStats;
     private final AttentionDetector mAttentionDetector;
@@ -275,7 +275,8 @@
 
     // Indicates whether the device is awake or asleep or somewhere in between.
     // This is distinct from the screen power state, which is managed separately.
-    private int mWakefulness;
+    // Do not access directly; always use {@link #setWakefulness} and {@link getWakefulness}.
+    private int mWakefulnessRaw;
     private boolean mWakefulnessChanging;
 
     // True if the sandman has just been summoned for the first time since entering the
@@ -764,6 +765,13 @@
             return new BatterySaverPolicy(lock, context, batterySavingStats);
         }
 
+        BatterySaverController createBatterySaverController(
+                Object lock, Context context, BatterySaverPolicy batterySaverPolicy,
+                BatterySavingStats batterySavingStats) {
+            return new BatterySaverController(lock, context, BackgroundThread.get().getLooper(),
+                    batterySaverPolicy, batterySavingStats);
+        }
+
         NativeWrapper createNativeWrapper() {
             return new NativeWrapper();
         }
@@ -794,6 +802,10 @@
                 }
             };
         }
+
+        void invalidateIsInteractiveCaches() {
+            PowerManager.invalidateIsInteractiveCaches();
+        }
     }
 
     final Constants mConstants;
@@ -833,9 +845,8 @@
         mBatterySavingStats = new BatterySavingStats(mLock);
         mBatterySaverPolicy =
                 mInjector.createBatterySaverPolicy(mLock, mContext, mBatterySavingStats);
-        mBatterySaverController = new BatterySaverController(mLock, mContext,
-                BackgroundThread.get().getLooper(), mBatterySaverPolicy,
-                mBatterySavingStats);
+        mBatterySaverController = mInjector.createBatterySaverController(mLock, mContext,
+                mBatterySaverPolicy, mBatterySavingStats);
         mBatterySaverStateMachine = new BatterySaverStateMachine(
                 mLock, mContext, mBatterySaverController);
 
@@ -939,13 +950,14 @@
             mHalAutoSuspendModeEnabled = false;
             mHalInteractiveModeEnabled = true;
 
-            mWakefulness = WAKEFULNESS_AWAKE;
+            mWakefulnessRaw = WAKEFULNESS_AWAKE;
             sQuiescent = mSystemProperties.get(SYSTEM_PROPERTY_QUIESCENT, "0").equals("1");
 
             mNativeWrapper.nativeInit(this);
             mNativeWrapper.nativeSetAutoSuspend(false);
             mNativeWrapper.nativeSetInteractive(true);
             mNativeWrapper.nativeSetFeature(POWER_FEATURE_DOUBLE_TAP_TO_WAKE, 0);
+            mInjector.invalidateIsInteractiveCaches();
         }
     }
 
@@ -1567,8 +1579,8 @@
                 mOverriddenTimeout = -1;
             }
 
-            if (mWakefulness == WAKEFULNESS_ASLEEP
-                    || mWakefulness == WAKEFULNESS_DOZING
+            if (getWakefulnessLocked() == WAKEFULNESS_ASLEEP
+                    || getWakefulnessLocked() == WAKEFULNESS_DOZING
                     || (flags & PowerManager.USER_ACTIVITY_FLAG_INDIRECT) != 0) {
                 return false;
             }
@@ -1624,7 +1636,7 @@
             Slog.d(TAG, "wakeUpNoUpdateLocked: eventTime=" + eventTime + ", uid=" + reasonUid);
         }
 
-        if (eventTime < mLastSleepTime || mWakefulness == WAKEFULNESS_AWAKE
+        if (eventTime < mLastSleepTime || getWakefulnessLocked() == WAKEFULNESS_AWAKE
                 || mForceSuspendActive || !mSystemReady) {
             return false;
         }
@@ -1634,7 +1646,7 @@
         Trace.traceBegin(Trace.TRACE_TAG_POWER, "wakeUp");
         try {
             Slog.i(TAG, "Waking up from "
-                    + PowerManagerInternal.wakefulnessToString(mWakefulness)
+                    + PowerManagerInternal.wakefulnessToString(getWakefulnessLocked())
                     + " (uid=" + reasonUid
                     + ", reason=" + PowerManager.wakeReasonToString(reason)
                     + ", details=" + details
@@ -1680,8 +1692,8 @@
         }
 
         if (eventTime < mLastWakeTime
-                || mWakefulness == WAKEFULNESS_ASLEEP
-                || mWakefulness == WAKEFULNESS_DOZING
+                || getWakefulnessLocked() == WAKEFULNESS_ASLEEP
+                || getWakefulnessLocked() == WAKEFULNESS_DOZING
                 || !mSystemReady
                 || !mBootCompleted) {
             return false;
@@ -1738,7 +1750,7 @@
             Slog.d(TAG, "napNoUpdateLocked: eventTime=" + eventTime + ", uid=" + uid);
         }
 
-        if (eventTime < mLastWakeTime || mWakefulness != WAKEFULNESS_AWAKE
+        if (eventTime < mLastWakeTime || getWakefulnessLocked() != WAKEFULNESS_AWAKE
                 || !mBootCompleted || !mSystemReady) {
             return false;
         }
@@ -1762,7 +1774,7 @@
                     + ", uid=" + uid);
         }
 
-        if (eventTime < mLastWakeTime || mWakefulness == WAKEFULNESS_ASLEEP
+        if (eventTime < mLastWakeTime || getWakefulnessLocked() == WAKEFULNESS_ASLEEP
                 || !mBootCompleted || !mSystemReady) {
             return false;
         }
@@ -1781,13 +1793,15 @@
 
     @VisibleForTesting
     void setWakefulnessLocked(int wakefulness, int reason, long eventTime) {
-        if (mWakefulness != wakefulness) {
-            mWakefulness = wakefulness;
+        if (getWakefulnessLocked() != wakefulness) {
+            // Under lock, invalidate before set ensures caches won't return stale values.
+            mInjector.invalidateIsInteractiveCaches();
+            mWakefulnessRaw = wakefulness;
             mWakefulnessChanging = true;
             mDirty |= DIRTY_WAKEFULNESS;
 
             // This is only valid while we are in wakefulness dozing. Set to false otherwise.
-            mDozeStartInProgress &= (mWakefulness == WAKEFULNESS_DOZING);
+            mDozeStartInProgress &= (getWakefulnessLocked() == WAKEFULNESS_DOZING);
 
             if (mNotifier != null) {
                 mNotifier.onWakefulnessChangeStarted(wakefulness, reason, eventTime);
@@ -1797,8 +1811,8 @@
     }
 
     @VisibleForTesting
-    int getWakefulness() {
-        return mWakefulness;
+    int getWakefulnessLocked() {
+        return mWakefulnessRaw;
     }
 
     /**
@@ -1816,17 +1830,18 @@
 
     private void finishWakefulnessChangeIfNeededLocked() {
         if (mWakefulnessChanging && mDisplayReady) {
-            if (mWakefulness == WAKEFULNESS_DOZING
+            if (getWakefulnessLocked() == WAKEFULNESS_DOZING
                     && (mWakeLockSummary & WAKE_LOCK_DOZE) == 0) {
                 return; // wait until dream has enabled dozing
             } else {
                 // Doze wakelock acquired (doze started) or device is no longer dozing.
                 mDozeStartInProgress = false;
             }
-            if (mWakefulness == WAKEFULNESS_DOZING || mWakefulness == WAKEFULNESS_ASLEEP) {
+            if (getWakefulnessLocked() == WAKEFULNESS_DOZING
+                    || getWakefulnessLocked() == WAKEFULNESS_ASLEEP) {
                 logSleepTimeoutRecapturedLocked();
             }
-            if (mWakefulness == WAKEFULNESS_AWAKE) {
+            if (getWakefulnessLocked() == WAKEFULNESS_AWAKE) {
                 Trace.asyncTraceEnd(Trace.TRACE_TAG_POWER, TRACE_SCREEN_ON, 0);
                 final int latencyMs = (int) (SystemClock.uptimeMillis() - mLastWakeTime);
                 if (latencyMs >= SCREEN_ON_LATENCY_WARNING_MS) {
@@ -2006,7 +2021,7 @@
         }
 
         // If already dreaming and becoming powered, then don't wake.
-        if (mIsPowered && mWakefulness == WAKEFULNESS_DREAMING) {
+        if (mIsPowered && getWakefulnessLocked() == WAKEFULNESS_DREAMING) {
             return false;
         }
 
@@ -2016,7 +2031,7 @@
         }
 
         // On Always On Display, SystemUI shows the charging indicator
-        if (mAlwaysOnEnabled && mWakefulness == WAKEFULNESS_DOZING) {
+        if (mAlwaysOnEnabled && getWakefulnessLocked() == WAKEFULNESS_DOZING) {
             return false;
         }
 
@@ -2081,7 +2096,7 @@
 
             if (DEBUG_SPEW) {
                 Slog.d(TAG, "updateWakeLockSummaryLocked: mWakefulness="
-                        + PowerManagerInternal.wakefulnessToString(mWakefulness)
+                        + PowerManagerInternal.wakefulnessToString(getWakefulnessLocked())
                         + ", mWakeLockSummary=0x" + Integer.toHexString(mWakeLockSummary));
             }
         }
@@ -2089,23 +2104,23 @@
 
     private int adjustWakeLockSummaryLocked(int wakeLockSummary) {
         // Cancel wake locks that make no sense based on the current state.
-        if (mWakefulness != WAKEFULNESS_DOZING) {
+        if (getWakefulnessLocked() != WAKEFULNESS_DOZING) {
             wakeLockSummary &= ~(WAKE_LOCK_DOZE | WAKE_LOCK_DRAW);
         }
-        if (mWakefulness == WAKEFULNESS_ASLEEP
+        if (getWakefulnessLocked() == WAKEFULNESS_ASLEEP
                 || (wakeLockSummary & WAKE_LOCK_DOZE) != 0) {
             wakeLockSummary &= ~(WAKE_LOCK_SCREEN_BRIGHT | WAKE_LOCK_SCREEN_DIM
                     | WAKE_LOCK_BUTTON_BRIGHT);
-            if (mWakefulness == WAKEFULNESS_ASLEEP) {
+            if (getWakefulnessLocked() == WAKEFULNESS_ASLEEP) {
                 wakeLockSummary &= ~WAKE_LOCK_PROXIMITY_SCREEN_OFF;
             }
         }
 
         // Infer implied wake locks where necessary based on the current state.
         if ((wakeLockSummary & (WAKE_LOCK_SCREEN_BRIGHT | WAKE_LOCK_SCREEN_DIM)) != 0) {
-            if (mWakefulness == WAKEFULNESS_AWAKE) {
+            if (getWakefulnessLocked() == WAKEFULNESS_AWAKE) {
                 wakeLockSummary |= WAKE_LOCK_CPU | WAKE_LOCK_STAY_AWAKE;
-            } else if (mWakefulness == WAKEFULNESS_DREAMING) {
+            } else if (getWakefulnessLocked() == WAKEFULNESS_DREAMING) {
                 wakeLockSummary |= WAKE_LOCK_CPU;
             }
         }
@@ -2213,9 +2228,9 @@
             mHandler.removeMessages(MSG_USER_ACTIVITY_TIMEOUT);
 
             long nextTimeout = 0;
-            if (mWakefulness == WAKEFULNESS_AWAKE
-                    || mWakefulness == WAKEFULNESS_DREAMING
-                    || mWakefulness == WAKEFULNESS_DOZING) {
+            if (getWakefulnessLocked() == WAKEFULNESS_AWAKE
+                    || getWakefulnessLocked() == WAKEFULNESS_DREAMING
+                    || getWakefulnessLocked() == WAKEFULNESS_DOZING) {
                 final long attentiveTimeout = getAttentiveTimeoutLocked();
                 final long sleepTimeout = getSleepTimeoutLocked(attentiveTimeout);
                 final long screenOffTimeout = getScreenOffTimeoutLocked(sleepTimeout,
@@ -2299,7 +2314,7 @@
 
             if (DEBUG_SPEW) {
                 Slog.d(TAG, "updateUserActivitySummaryLocked: mWakefulness="
-                        + PowerManagerInternal.wakefulnessToString(mWakefulness)
+                        + PowerManagerInternal.wakefulnessToString(getWakefulnessLocked())
                         + ", mUserActivitySummary=0x" + Integer.toHexString(mUserActivitySummary)
                         + ", nextTimeout=" + TimeUtils.formatUptime(nextTimeout));
             }
@@ -2368,7 +2383,7 @@
                 mInattentiveSleepWarningOverlayController.show();
                 nextTimeout = goToSleepTime;
             } else {
-                if (DEBUG && mWakefulness != WAKEFULNESS_ASLEEP) {
+                if (DEBUG && getWakefulnessLocked() != WAKEFULNESS_ASLEEP) {
                     Slog.i(TAG, "Going to sleep now due to long user inactivity");
                 }
             }
@@ -2386,7 +2401,7 @@
             return false;
         }
 
-        if (mWakefulness != WAKEFULNESS_AWAKE) {
+        if (getWakefulnessLocked() != WAKEFULNESS_AWAKE) {
             mInattentiveSleepWarningOverlayController.dismiss(false);
             return true;
         } else if (attentiveTimeout < 0 || isBeingKeptFromShowingInattentiveSleepWarningLocked()
@@ -2490,7 +2505,7 @@
                 | DIRTY_WAKEFULNESS | DIRTY_STAY_ON | DIRTY_PROXIMITY_POSITIVE
                 | DIRTY_DOCK_STATE | DIRTY_ATTENTIVE | DIRTY_SETTINGS
                 | DIRTY_SCREEN_BRIGHTNESS_BOOST)) != 0) {
-            if (mWakefulness == WAKEFULNESS_AWAKE && isItBedTimeYetLocked()) {
+            if (getWakefulnessLocked() == WAKEFULNESS_AWAKE && isItBedTimeYetLocked()) {
                 if (DEBUG_SPEW) {
                     Slog.d(TAG, "updateWakefulnessLocked: Bed time...");
                 }
@@ -2613,7 +2628,7 @@
         final int wakefulness;
         synchronized (mLock) {
             mSandmanScheduled = false;
-            wakefulness = mWakefulness;
+            wakefulness = getWakefulnessLocked();
             if (mSandmanSummoned && mDisplayReady) {
                 startDreaming = canDreamLocked() || canDozeLocked();
                 mSandmanSummoned = false;
@@ -2655,7 +2670,7 @@
 
             // If preconditions changed, wait for the next iteration to determine
             // whether the dream should continue (or be restarted).
-            if (mSandmanSummoned || mWakefulness != wakefulness) {
+            if (mSandmanSummoned || getWakefulnessLocked() != wakefulness) {
                 return; // wait for next cycle
             }
 
@@ -2717,7 +2732,7 @@
      * Returns true if the device is allowed to dream in its current state.
      */
     private boolean canDreamLocked() {
-        if (mWakefulness != WAKEFULNESS_DREAMING
+        if (getWakefulnessLocked() != WAKEFULNESS_DREAMING
                 || !mDreamsSupportedConfig
                 || !mDreamsEnabledSetting
                 || !mDisplayPowerRequest.isBrightOrDim()
@@ -2749,7 +2764,7 @@
      * Returns true if the device is allowed to doze in its current state.
      */
     private boolean canDozeLocked() {
-        return mWakefulness == WAKEFULNESS_DOZING;
+        return getWakefulnessLocked() == WAKEFULNESS_DOZING;
     }
 
     /**
@@ -2825,7 +2840,7 @@
             if (DEBUG_SPEW) {
                 Slog.d(TAG, "updateDisplayPowerStateLocked: mDisplayReady=" + mDisplayReady
                         + ", policy=" + mDisplayPowerRequest.policy
-                        + ", mWakefulness=" + mWakefulness
+                        + ", mWakefulness=" + getWakefulnessLocked()
                         + ", mWakeLockSummary=0x" + Integer.toHexString(mWakeLockSummary)
                         + ", mUserActivitySummary=0x" + Integer.toHexString(mUserActivitySummary)
                         + ", mBootCompleted=" + mBootCompleted
@@ -2871,11 +2886,11 @@
 
     @VisibleForTesting
     int getDesiredScreenPolicyLocked() {
-        if (mWakefulness == WAKEFULNESS_ASLEEP || sQuiescent) {
+        if (getWakefulnessLocked() == WAKEFULNESS_ASLEEP || sQuiescent) {
             return DisplayPowerRequest.POLICY_OFF;
         }
 
-        if (mWakefulness == WAKEFULNESS_DOZING) {
+        if (getWakefulnessLocked() == WAKEFULNESS_DOZING) {
             if ((mWakeLockSummary & WAKE_LOCK_DOZE) != 0) {
                 return DisplayPowerRequest.POLICY_DOZE;
             }
@@ -3079,7 +3094,7 @@
         // Here we wait for mWakefulnessChanging to become false since the wakefulness
         // transition to DOZING isn't considered "changed" until the doze wake lock is
         // acquired.
-        if (mWakefulness == WAKEFULNESS_DOZING && mDozeStartInProgress) {
+        if (getWakefulnessLocked() == WAKEFULNESS_DOZING && mDozeStartInProgress) {
             return true;
         }
 
@@ -3119,7 +3134,7 @@
 
     private boolean isInteractiveInternal() {
         synchronized (mLock) {
-            return PowerManagerInternal.isInteractive(mWakefulness);
+            return PowerManagerInternal.isInteractive(getWakefulnessLocked());
         }
     }
 
@@ -3495,7 +3510,7 @@
 
     private void boostScreenBrightnessInternal(long eventTime, int uid) {
         synchronized (mLock) {
-            if (!mSystemReady || mWakefulness == WAKEFULNESS_ASLEEP
+            if (!mSystemReady || getWakefulnessLocked() == WAKEFULNESS_ASLEEP
                     || eventTime < mLastScreenBrightnessBoostTime) {
                 return;
             }
@@ -3725,7 +3740,8 @@
             pw.println("Power Manager State:");
             mConstants.dump(pw);
             pw.println("  mDirty=0x" + Integer.toHexString(mDirty));
-            pw.println("  mWakefulness=" + PowerManagerInternal.wakefulnessToString(mWakefulness));
+            pw.println("  mWakefulness="
+                    + PowerManagerInternal.wakefulnessToString(getWakefulnessLocked()));
             pw.println("  mWakefulnessChanging=" + mWakefulnessChanging);
             pw.println("  mIsPowered=" + mIsPowered);
             pw.println("  mPlugType=" + mPlugType);
@@ -3936,7 +3952,7 @@
         synchronized (mLock) {
             mConstants.dumpProto(proto);
             proto.write(PowerManagerServiceDumpProto.DIRTY, mDirty);
-            proto.write(PowerManagerServiceDumpProto.WAKEFULNESS, mWakefulness);
+            proto.write(PowerManagerServiceDumpProto.WAKEFULNESS, getWakefulnessLocked());
             proto.write(PowerManagerServiceDumpProto.IS_WAKEFULNESS_CHANGING, mWakefulnessChanging);
             proto.write(PowerManagerServiceDumpProto.IS_POWERED, mIsPowered);
             proto.write(PowerManagerServiceDumpProto.PLUG_TYPE, mPlugType);
diff --git a/services/core/java/com/android/server/power/ThermalManagerService.java b/services/core/java/com/android/server/power/ThermalManagerService.java
index 491c5ab..da3cbf9 100644
--- a/services/core/java/com/android/server/power/ThermalManagerService.java
+++ b/services/core/java/com/android/server/power/ThermalManagerService.java
@@ -16,15 +16,18 @@
 
 package com.android.server.power;
 
+import android.annotation.NonNull;
 import android.annotation.Nullable;
 import android.content.Context;
 import android.hardware.thermal.V1_0.ThermalStatus;
 import android.hardware.thermal.V1_0.ThermalStatusCode;
 import android.hardware.thermal.V1_1.IThermalCallback;
 import android.hardware.thermal.V2_0.IThermalChangedCallback;
+import android.hardware.thermal.V2_0.TemperatureThreshold;
 import android.hardware.thermal.V2_0.ThrottlingSeverity;
 import android.os.Binder;
 import android.os.CoolingDevice;
+import android.os.Handler;
 import android.os.HwBinder;
 import android.os.IThermalEventListener;
 import android.os.IThermalService;
@@ -36,6 +39,7 @@
 import android.os.ResultReceiver;
 import android.os.ShellCallback;
 import android.os.ShellCommand;
+import android.os.SystemClock;
 import android.os.Temperature;
 import android.util.ArrayMap;
 import android.util.EventLog;
@@ -43,6 +47,7 @@
 
 import com.android.internal.annotations.GuardedBy;
 import com.android.internal.annotations.VisibleForTesting;
+import com.android.internal.os.BackgroundThread;
 import com.android.internal.util.DumpUtils;
 import com.android.server.EventLogTags;
 import com.android.server.FgThread;
@@ -54,6 +59,7 @@
 import java.util.Collection;
 import java.util.Iterator;
 import java.util.List;
+import java.util.Map;
 import java.util.NoSuchElementException;
 import java.util.concurrent.atomic.AtomicBoolean;
 
@@ -100,6 +106,9 @@
     /** Hal ready. */
     private final AtomicBoolean mHalReady = new AtomicBoolean();
 
+    /** Watches temperatures to forecast when throttling will occur */
+    private final TemperatureWatcher mTemperatureWatcher = new TemperatureWatcher();
+
     /** Invalid throttling status */
     private static final int INVALID_THROTTLING = Integer.MIN_VALUE;
 
@@ -154,6 +163,7 @@
                 onTemperatureChanged(temperatures.get(i), false);
             }
             onTemperatureMapChangedLocked();
+            mTemperatureWatcher.updateSevereThresholds();
             mHalReady.set(true);
         }
     }
@@ -462,6 +472,15 @@
             }
         }
 
+        @Override
+        public float getThermalHeadroom(int forecastSeconds) {
+            if (!mHalReady.get()) {
+                return Float.NaN;
+            }
+
+            return mTemperatureWatcher.getForecast(forecastSeconds);
+        }
+
         private void dumpItemsLocked(PrintWriter pw, String prefix,
                 Collection<?> items) {
             for (Iterator iterator = items.iterator(); iterator.hasNext();) {
@@ -616,6 +635,10 @@
         protected abstract List<CoolingDevice> getCurrentCoolingDevices(boolean shouldFilter,
                 int type);
 
+        @NonNull
+        protected abstract List<TemperatureThreshold> getTemperatureThresholds(boolean shouldFilter,
+                int type);
+
         protected abstract boolean connectToHal();
 
         protected abstract void dump(PrintWriter pw, String prefix);
@@ -728,6 +751,12 @@
         }
 
         @Override
+        protected List<TemperatureThreshold> getTemperatureThresholds(boolean shouldFilter,
+                int type) {
+            return new ArrayList<>();
+        }
+
+        @Override
         protected boolean connectToHal() {
             synchronized (mHalLock) {
                 try {
@@ -857,6 +886,12 @@
         }
 
         @Override
+        protected List<TemperatureThreshold> getTemperatureThresholds(boolean shouldFilter,
+                int type) {
+            return new ArrayList<>();
+        }
+
+        @Override
         protected boolean connectToHal() {
             synchronized (mHalLock) {
                 try {
@@ -975,6 +1010,32 @@
         }
 
         @Override
+        protected List<TemperatureThreshold> getTemperatureThresholds(boolean shouldFilter,
+                int type) {
+            synchronized (mHalLock) {
+                List<TemperatureThreshold> ret = new ArrayList<>();
+                if (mThermalHal20 == null) {
+                    return ret;
+                }
+                try {
+                    mThermalHal20.getTemperatureThresholds(shouldFilter, type,
+                            (status, thresholds) -> {
+                                if (ThermalStatusCode.SUCCESS == status.code) {
+                                    ret.addAll(thresholds);
+                                } else {
+                                    Slog.e(TAG,
+                                            "Couldn't get temperature thresholds because of HAL "
+                                                    + "error: " + status.debugMessage);
+                                }
+                            });
+                } catch (RemoteException e) {
+                    Slog.e(TAG, "Couldn't getTemperatureThresholds, reconnecting...", e);
+                }
+                return ret;
+            }
+        }
+
+        @Override
         protected boolean connectToHal() {
             synchronized (mHalLock) {
                 try {
@@ -1001,4 +1062,190 @@
         }
     }
 
+    private class TemperatureWatcher {
+        private final Handler mHandler = BackgroundThread.getHandler();
+
+        /** Map of skin temperature sensor name to a corresponding list of samples */
+        @GuardedBy("mSamples")
+        private final ArrayMap<String, ArrayList<Sample>> mSamples = new ArrayMap<>();
+
+        /** Map of skin temperature sensor name to the corresponding SEVERE temperature threshold */
+        @GuardedBy("mSamples")
+        private ArrayMap<String, Float> mSevereThresholds = new ArrayMap<>();
+
+        @GuardedBy("mSamples")
+        private long mLastForecastCallTimeMillis = 0;
+
+        void updateSevereThresholds() {
+            synchronized (mSamples) {
+                List<TemperatureThreshold> thresholds =
+                        mHalWrapper.getTemperatureThresholds(true, Temperature.TYPE_SKIN);
+                for (int t = 0; t < thresholds.size(); ++t) {
+                    TemperatureThreshold threshold = thresholds.get(t);
+                    if (threshold.hotThrottlingThresholds.length <= ThrottlingSeverity.SEVERE) {
+                        continue;
+                    }
+                    float temperature =
+                            threshold.hotThrottlingThresholds[ThrottlingSeverity.SEVERE];
+                    if (!Float.isNaN(temperature)) {
+                        mSevereThresholds.put(threshold.name,
+                                threshold.hotThrottlingThresholds[ThrottlingSeverity.SEVERE]);
+                    }
+                }
+            }
+        }
+
+        private static final int INACTIVITY_THRESHOLD_MILLIS = 10000;
+        private static final int RING_BUFFER_SIZE = 30;
+
+        private void updateTemperature() {
+            synchronized (mSamples) {
+                if (SystemClock.elapsedRealtime() - mLastForecastCallTimeMillis
+                        < INACTIVITY_THRESHOLD_MILLIS) {
+                    // Trigger this again after a second as long as forecast has been called more
+                    // recently than the inactivity timeout
+                    mHandler.postDelayed(this::updateTemperature, 1000);
+                } else {
+                    // Otherwise, we've been idle for at least 10 seconds, so we should
+                    // shut down
+                    mSamples.clear();
+                    return;
+                }
+
+                long now = SystemClock.elapsedRealtime();
+                List<Temperature> temperatures = mHalWrapper.getCurrentTemperatures(true,
+                        Temperature.TYPE_SKIN);
+
+                for (int t = 0; t < temperatures.size(); ++t) {
+                    Temperature temperature = temperatures.get(t);
+
+                    // Filter out invalid temperatures. If this results in no values being stored at
+                    // all, the mSamples.empty() check in getForecast() will catch it.
+                    if (Float.isNaN(temperature.getValue())) {
+                        continue;
+                    }
+
+                    ArrayList<Sample> samples = mSamples.computeIfAbsent(temperature.getName(),
+                            k -> new ArrayList<>(RING_BUFFER_SIZE));
+                    if (samples.size() == RING_BUFFER_SIZE) {
+                        samples.remove(0);
+                    }
+                    samples.add(new Sample(now, temperature.getValue()));
+                }
+            }
+        }
+
+        /**
+         * Calculates the trend using a linear regression. As the samples are degrees Celsius with
+         * associated timestamps in milliseconds, the slope is in degrees Celsius per millisecond.
+         */
+        private float getSlopeOf(List<Sample> samples) {
+            long sumTimes = 0L;
+            float sumTemperatures = 0.0f;
+            for (int s = 0; s < samples.size(); ++s) {
+                Sample sample = samples.get(s);
+                sumTimes += sample.time;
+                sumTemperatures += sample.temperature;
+            }
+            long meanTime = sumTimes / samples.size();
+            float meanTemperature = sumTemperatures / samples.size();
+
+            long sampleVariance = 0L;
+            float sampleCovariance = 0.0f;
+            for (int s = 0; s < samples.size(); ++s) {
+                Sample sample = samples.get(s);
+                long timeDelta = sample.time - meanTime;
+                float temperatureDelta = sample.temperature - meanTemperature;
+                sampleVariance += timeDelta * timeDelta;
+                sampleCovariance += timeDelta * temperatureDelta;
+            }
+
+            return sampleCovariance / sampleVariance;
+        }
+
+        /**
+         * Used to determine the temperature corresponding to 0.0. Given that 1.0 is pinned at the
+         * temperature corresponding to the SEVERE threshold, we set 0.0 to be that temperature
+         * minus DEGREES_BETWEEN_ZERO_AND_ONE.
+         */
+        private static final float DEGREES_BETWEEN_ZERO_AND_ONE = 30.0f;
+
+        private float normalizeTemperature(float temperature, float severeThreshold) {
+            synchronized (mSamples) {
+                float zeroNormalized = severeThreshold - DEGREES_BETWEEN_ZERO_AND_ONE;
+                if (temperature <= zeroNormalized) {
+                    return 0.0f;
+                }
+                float delta = temperature - zeroNormalized;
+                return delta / DEGREES_BETWEEN_ZERO_AND_ONE;
+            }
+        }
+
+        private static final int MINIMUM_SAMPLE_COUNT = 3;
+
+        float getForecast(int forecastSeconds) {
+            synchronized (mSamples) {
+                mLastForecastCallTimeMillis = System.currentTimeMillis();
+                if (mSamples.isEmpty()) {
+                    updateTemperature();
+                }
+
+                // If somehow things take much longer than expected or there are no temperatures
+                // to sample, return early
+                if (mSamples.isEmpty()) {
+                    Slog.e(TAG, "No temperature samples found");
+                    return Float.NaN;
+                }
+
+                // If we don't have any thresholds, we can't normalize the temperatures,
+                // so return early
+                if (mSevereThresholds.isEmpty()) {
+                    Slog.e(TAG, "No temperature thresholds found");
+                    return Float.NaN;
+                }
+
+                float maxNormalized = Float.NaN;
+                for (Map.Entry<String, ArrayList<Sample>> entry : mSamples.entrySet()) {
+                    String name = entry.getKey();
+                    ArrayList<Sample> samples = entry.getValue();
+
+                    Float threshold = mSevereThresholds.get(name);
+                    if (threshold == null) {
+                        Slog.e(TAG, "No threshold found for " + name);
+                        continue;
+                    }
+
+                    float currentTemperature = samples.get(0).temperature;
+
+                    if (samples.size() < MINIMUM_SAMPLE_COUNT) {
+                        // Don't try to forecast, just use the latest one we have
+                        float normalized = normalizeTemperature(currentTemperature, threshold);
+                        if (Float.isNaN(maxNormalized) || normalized > maxNormalized) {
+                            maxNormalized = normalized;
+                        }
+                        continue;
+                    }
+
+                    float slope = getSlopeOf(samples);
+                    float normalized = normalizeTemperature(
+                            currentTemperature + slope * forecastSeconds * 1000, threshold);
+                    if (Float.isNaN(maxNormalized) || normalized > maxNormalized) {
+                        maxNormalized = normalized;
+                    }
+                }
+
+                return maxNormalized;
+            }
+        }
+
+        private class Sample {
+            public long time;
+            public float temperature;
+
+            Sample(long time, float temperature) {
+                this.time = time;
+                this.temperature = temperature;
+            }
+        }
+    }
 }
diff --git a/services/core/java/com/android/server/power/batterysaver/BatterySaverController.java b/services/core/java/com/android/server/power/batterysaver/BatterySaverController.java
index 4142e6f..beba106 100644
--- a/services/core/java/com/android/server/power/batterysaver/BatterySaverController.java
+++ b/services/core/java/com/android/server/power/batterysaver/BatterySaverController.java
@@ -38,7 +38,6 @@
 import com.android.internal.annotations.GuardedBy;
 import com.android.internal.annotations.VisibleForTesting;
 import com.android.internal.util.ArrayUtils;
-import com.android.internal.util.Preconditions;
 import com.android.server.EventLogTags;
 import com.android.server.LocalServices;
 import com.android.server.power.PowerManagerService;
@@ -76,11 +75,19 @@
     @GuardedBy("mLock")
     private final ArrayList<LowPowerModeListener> mListeners = new ArrayList<>();
 
+    /**
+     * Do not access directly; always use {@link #setFullEnabledLocked}
+     * and {@link #getFullEnabledLocked}
+     */
     @GuardedBy("mLock")
-    private boolean mFullEnabled;
+    private boolean mFullEnabledRaw;
 
+    /**
+     * Do not access directly; always use {@link #setAdaptiveEnabledLocked} and
+     * {@link #getAdaptiveEnabledLocked}.
+     */
     @GuardedBy("mLock")
-    private boolean mAdaptiveEnabled;
+    private boolean mAdaptiveEnabledRaw;
 
     @GuardedBy("mLock")
     private boolean mIsPluggedIn;
@@ -208,6 +215,7 @@
         mPlugins = new Plugin[] {
                 new BatterySaverLocationPlugin(mContext)
         };
+        PowerManager.invalidatePowerSaveModeCaches();
     }
 
     /**
@@ -294,10 +302,10 @@
     @VisibleForTesting
     public void enableBatterySaver(boolean enable, int reason) {
         synchronized (mLock) {
-            if (mFullEnabled == enable) {
+            if (getFullEnabledLocked() == enable) {
                 return;
             }
-            mFullEnabled = enable;
+            setFullEnabledLocked(enable);
 
             if (updatePolicyLevelLocked()) {
                 mHandler.postStateChanged(/*sendBroadcast=*/ true, reason);
@@ -306,9 +314,9 @@
     }
 
     private boolean updatePolicyLevelLocked() {
-        if (mFullEnabled) {
+        if (getFullEnabledLocked()) {
             return mBatterySaverPolicy.setPolicyLevel(BatterySaverPolicy.POLICY_LEVEL_FULL);
-        } else if (mAdaptiveEnabled) {
+        } else if (getAdaptiveEnabledLocked()) {
             return mBatterySaverPolicy.setPolicyLevel(BatterySaverPolicy.POLICY_LEVEL_ADAPTIVE);
         } else {
             return mBatterySaverPolicy.setPolicyLevel(BatterySaverPolicy.POLICY_LEVEL_OFF);
@@ -321,8 +329,8 @@
      */
     public boolean isEnabled() {
         synchronized (mLock) {
-            return mFullEnabled
-                    || (mAdaptiveEnabled && mBatterySaverPolicy.shouldAdvertiseIsEnabled());
+            return getFullEnabledLocked() || (getAdaptiveEnabledLocked()
+                    && mBatterySaverPolicy.shouldAdvertiseIsEnabled());
         }
     }
 
@@ -332,19 +340,19 @@
      */
     private boolean isPolicyEnabled() {
         synchronized (mLock) {
-            return mFullEnabled || mAdaptiveEnabled;
+            return getFullEnabledLocked() || getAdaptiveEnabledLocked();
         }
     }
 
     boolean isFullEnabled() {
         synchronized (mLock) {
-            return mFullEnabled;
+            return getFullEnabledLocked();
         }
     }
 
     boolean isAdaptiveEnabled() {
         synchronized (mLock) {
-            return mAdaptiveEnabled;
+            return getAdaptiveEnabledLocked();
         }
     }
 
@@ -375,10 +383,10 @@
     }
 
     boolean setAdaptivePolicyEnabledLocked(boolean enabled, int reason) {
-        if (mAdaptiveEnabled == enabled) {
+        if (getAdaptiveEnabledLocked() == enabled) {
             return false;
         }
-        mAdaptiveEnabled = enabled;
+        setAdaptiveEnabledLocked(enabled);
         if (updatePolicyLevelLocked()) {
             mHandler.postStateChanged(/*sendBroadcast=*/ true, reason);
             return true;
@@ -427,19 +435,19 @@
         final ArrayMap<String, String> fileValues;
 
         synchronized (mLock) {
-            enabled = mFullEnabled || mAdaptiveEnabled;
+            enabled = getFullEnabledLocked() || getAdaptiveEnabledLocked();
 
             EventLogTags.writeBatterySaverMode(
                     mFullPreviouslyEnabled ? 1 : 0, // Previously off or on.
                     mAdaptivePreviouslyEnabled ? 1 : 0, // Previously off or on.
-                    mFullEnabled ? 1 : 0, // Now off or on.
-                    mAdaptiveEnabled ? 1 : 0, // Now off or on.
+                    getFullEnabledLocked() ? 1 : 0, // Now off or on.
+                    getAdaptiveEnabledLocked() ? 1 : 0, // Now off or on.
                     isInteractive ?  1 : 0, // Device interactive state.
                     enabled ? mBatterySaverPolicy.toEventLogString() : "",
                     reason);
 
-            mFullPreviouslyEnabled = mFullEnabled;
-            mAdaptivePreviouslyEnabled = mAdaptiveEnabled;
+            mFullPreviouslyEnabled = getFullEnabledLocked();
+            mAdaptivePreviouslyEnabled = getAdaptiveEnabledLocked();
 
             listeners = mListeners.toArray(new LowPowerModeListener[0]);
 
@@ -518,10 +526,40 @@
                 return;
             }
             mBatterySavingStats.transitionState(
-                    mFullEnabled ? BatterySaverState.ON :
-                            (mAdaptiveEnabled ? BatterySaverState.ADAPTIVE : BatterySaverState.OFF),
-                    isInteractive ? InteractiveState.INTERACTIVE : InteractiveState.NON_INTERACTIVE,
-                    dozeMode);
+                    getFullEnabledLocked() ? BatterySaverState.ON :
+                            (getAdaptiveEnabledLocked() ? BatterySaverState.ADAPTIVE :
+                            BatterySaverState.OFF),
+                            isInteractive ? InteractiveState.INTERACTIVE :
+                            InteractiveState.NON_INTERACTIVE,
+                            dozeMode);
         }
     }
+
+    @GuardedBy("mLock")
+    private void setFullEnabledLocked(boolean value) {
+        if (mFullEnabledRaw == value) {
+            return;
+        }
+        PowerManager.invalidatePowerSaveModeCaches();
+        mFullEnabledRaw = value;
+    }
+
+    /** Non-blocking getter exists as a reminder not to directly modify the cached field */
+    private boolean getFullEnabledLocked() {
+        return mFullEnabledRaw;
+    }
+
+    @GuardedBy("mLock")
+    private void setAdaptiveEnabledLocked(boolean value) {
+        if (mAdaptiveEnabledRaw == value) {
+            return;
+        }
+        PowerManager.invalidatePowerSaveModeCaches();
+        mAdaptiveEnabledRaw = value;
+    }
+
+    /** Non-blocking getter exists as a reminder not to directly modify the cached field */
+    private boolean getAdaptiveEnabledLocked() {
+        return mAdaptiveEnabledRaw;
+    }
 }
diff --git a/services/core/java/com/android/server/power/batterysaver/BatterySaverPolicy.java b/services/core/java/com/android/server/power/batterysaver/BatterySaverPolicy.java
index 38bdc62..233417d 100644
--- a/services/core/java/com/android/server/power/batterysaver/BatterySaverPolicy.java
+++ b/services/core/java/com/android/server/power/batterysaver/BatterySaverPolicy.java
@@ -219,8 +219,12 @@
     static final int POLICY_LEVEL_ADAPTIVE = 1;
     static final int POLICY_LEVEL_FULL = 2;
 
+    /**
+     * Do not access directly; always use {@link #setPolicyLevel}
+     * and {@link #getPolicyLevelLocked}
+     */
     @GuardedBy("mLock")
-    private int mPolicyLevel = POLICY_LEVEL_OFF;
+    private int mPolicyLevelRaw = POLICY_LEVEL_OFF;
 
     private final Context mContext;
     private final ContentResolver mContentResolver;
@@ -290,6 +294,11 @@
         return R.string.config_batterySaverDeviceSpecificConfig;
     }
 
+    @VisibleForTesting
+    void invalidatePowerSaveModeCaches() {
+        PowerManager.invalidatePowerSaveModeCaches();
+    }
+
     @Override
     public void onChange(boolean selfChange, Uri uri) {
         refreshSettings();
@@ -373,14 +382,14 @@
         boolean changed = false;
         Policy newFullPolicy = Policy.fromSettings(setting, deviceSpecificSetting,
                 DEFAULT_FULL_POLICY);
-        if (mPolicyLevel == POLICY_LEVEL_FULL && !mFullPolicy.equals(newFullPolicy)) {
+        if (getPolicyLevelLocked() == POLICY_LEVEL_FULL && !mFullPolicy.equals(newFullPolicy)) {
             changed = true;
         }
         mFullPolicy = newFullPolicy;
 
         mDefaultAdaptivePolicy = Policy.fromSettings(adaptiveSetting, adaptiveDeviceSpecificSetting,
                 DEFAULT_ADAPTIVE_POLICY);
-        if (mPolicyLevel == POLICY_LEVEL_ADAPTIVE
+        if (getPolicyLevelLocked() == POLICY_LEVEL_ADAPTIVE
                 && !mAdaptivePolicy.equals(mDefaultAdaptivePolicy)) {
             changed = true;
         }
@@ -882,14 +891,14 @@
      */
     boolean setPolicyLevel(@PolicyLevel int level) {
         synchronized (mLock) {
-            if (mPolicyLevel == level) {
+            if (getPolicyLevelLocked() == level) {
                 return false;
             }
             switch (level) {
                 case POLICY_LEVEL_FULL:
                 case POLICY_LEVEL_ADAPTIVE:
                 case POLICY_LEVEL_OFF:
-                    mPolicyLevel = level;
+                    setPolicyLevelLocked(level);
                     break;
                 default:
                     Slog.wtf(TAG, "setPolicyLevel invalid level given: " + level);
@@ -911,7 +920,7 @@
         }
 
         mAdaptivePolicy = p;
-        if (mPolicyLevel == POLICY_LEVEL_ADAPTIVE) {
+        if (getPolicyLevelLocked() == POLICY_LEVEL_ADAPTIVE) {
             updatePolicyDependenciesLocked();
             return true;
         }
@@ -924,7 +933,7 @@
     }
 
     private Policy getCurrentPolicyLocked() {
-        switch (mPolicyLevel) {
+        switch (getPolicyLevelLocked()) {
             case POLICY_LEVEL_FULL:
                 return mFullPolicy;
             case POLICY_LEVEL_ADAPTIVE:
@@ -985,7 +994,7 @@
             pw.println("    value: " + mAdaptiveDeviceSpecificSettings);
 
             pw.println("  mAccessibilityEnabled=" + mAccessibilityEnabled);
-            pw.println("  mPolicyLevel=" + mPolicyLevel);
+            pw.println("  mPolicyLevel=" + getPolicyLevelLocked());
 
             dumpPolicyLocked(pw, "  ", "full", mFullPolicy);
             dumpPolicyLocked(pw, "  ", "default adaptive", mDefaultAdaptivePolicy);
@@ -1067,4 +1076,20 @@
             updatePolicyDependenciesLocked();
         }
     }
+
+    /** Non-blocking getter exists as a reminder not to modify cached fields directly */
+    @GuardedBy("mLock")
+    private int getPolicyLevelLocked() {
+        return mPolicyLevelRaw;
+    }
+
+    @GuardedBy("mLock")
+    private void setPolicyLevelLocked(int level) {
+        if (mPolicyLevelRaw == level) {
+            return;
+        }
+        // Under lock, invalidate before set ensures caches won't return stale values.
+        invalidatePowerSaveModeCaches();
+        mPolicyLevelRaw = level;
+    }
 }
diff --git a/services/core/java/com/android/server/power/batterysaver/BatterySaverStateMachine.java b/services/core/java/com/android/server/power/batterysaver/BatterySaverStateMachine.java
index 4b3746b..42aaec9 100644
--- a/services/core/java/com/android/server/power/batterysaver/BatterySaverStateMachine.java
+++ b/services/core/java/com/android/server/power/batterysaver/BatterySaverStateMachine.java
@@ -176,8 +176,10 @@
     @GuardedBy("mLock")
     private int mSettingBatterySaverStickyAutoDisableThreshold;
 
-    /** Config flag to track default disable threshold for Dynamic Power Savings enabled battery
-     * saver. */
+    /**
+     * Config flag to track default disable threshold for Dynamic Power Savings enabled battery
+     * saver.
+     */
     @GuardedBy("mLock")
     private final int mDynamicPowerSavingsDefaultDisableThreshold;
 
@@ -192,8 +194,9 @@
     @GuardedBy("mLock")
     private int mSettingAutomaticBatterySaver;
 
-    /** When to disable battery saver again if it was enabled due to an external suggestion.
-     *  Corresponds to Settings.Global.DYNAMIC_POWER_SAVINGS_DISABLE_THRESHOLD.
+    /**
+     * When to disable battery saver again if it was enabled due to an external suggestion.
+     * Corresponds to Settings.Global.DYNAMIC_POWER_SAVINGS_DISABLE_THRESHOLD.
      */
     @GuardedBy("mLock")
     private int mDynamicPowerSavingsDisableThreshold;
@@ -203,7 +206,7 @@
      * Updates when Settings.Global.DYNAMIC_POWER_SAVINGS_ENABLED changes.
      */
     @GuardedBy("mLock")
-    private boolean mDynamicPowerSavingsBatterySaver;
+    private boolean mDynamicPowerSavingsEnableBatterySaver;
 
     /**
      * Last reason passed to {@link #enableBatterySaverLocked}.
@@ -265,7 +268,7 @@
     /** @return true if the dynamic mode should be used */
     private boolean isDynamicModeActiveLocked() {
         return mSettingAutomaticBatterySaver == PowerManager.POWER_SAVE_MODE_TRIGGER_DYNAMIC
-                && mDynamicPowerSavingsBatterySaver;
+                && mDynamicPowerSavingsEnableBatterySaver;
     }
 
     /**
@@ -428,7 +431,7 @@
         final boolean dynamicPowerSavingsThresholdChanged =
                 mDynamicPowerSavingsDisableThreshold != dynamicPowerSavingsDisableThreshold;
         final boolean dynamicPowerSavingsBatterySaverChanged =
-                mDynamicPowerSavingsBatterySaver != dynamicPowerSavingsBatterySaver;
+                mDynamicPowerSavingsEnableBatterySaver != dynamicPowerSavingsBatterySaver;
 
         if (!(enabledChanged || stickyChanged || thresholdChanged || automaticModeChanged
                 || stickyAutoDisableEnabledChanged || stickyAutoDisableThresholdChanged
@@ -443,7 +446,7 @@
         mSettingBatterySaverStickyAutoDisableThreshold = stickyAutoDisableThreshold;
         mSettingAutomaticBatterySaver = automaticBatterySaver;
         mDynamicPowerSavingsDisableThreshold = dynamicPowerSavingsDisableThreshold;
-        mDynamicPowerSavingsBatterySaver = dynamicPowerSavingsBatterySaver;
+        mDynamicPowerSavingsEnableBatterySaver = dynamicPowerSavingsBatterySaver;
 
         if (thresholdChanged) {
             // To avoid spamming the event log, we throttle logging here.
@@ -923,6 +926,8 @@
             pw.print("  mIsBatteryLevelLow=");
             pw.println(mIsBatteryLevelLow);
 
+            pw.print("  mSettingAutomaticBatterySaver=");
+            pw.println(mSettingAutomaticBatterySaver);
             pw.print("  mSettingBatterySaverEnabled=");
             pw.println(mSettingBatterySaverEnabled);
             pw.print("  mSettingBatterySaverEnabledSticky=");
@@ -936,6 +941,13 @@
             pw.print("  mBatterySaverStickyBehaviourDisabled=");
             pw.println(mBatterySaverStickyBehaviourDisabled);
 
+            pw.print("  mDynamicPowerSavingsDefaultDisableThreshold=");
+            pw.println(mDynamicPowerSavingsDefaultDisableThreshold);
+            pw.print("  mDynamicPowerSavingsDisableThreshold=");
+            pw.println(mDynamicPowerSavingsDisableThreshold);
+            pw.print("  mDynamicPowerSavingsEnableBatterySaver=");
+            pw.println(mDynamicPowerSavingsEnableBatterySaver);
+
             pw.print("  mLastAdaptiveBatterySaverChangedExternallyElapsed=");
             pw.println(mLastAdaptiveBatterySaverChangedExternallyElapsed);
         }
@@ -964,6 +976,8 @@
             proto.write(BatterySaverStateMachineProto.BATTERY_LEVEL, mBatteryLevel);
             proto.write(BatterySaverStateMachineProto.IS_BATTERY_LEVEL_LOW, mIsBatteryLevelLow);
 
+            proto.write(BatterySaverStateMachineProto.SETTING_AUTOMATIC_TRIGGER,
+                    mSettingAutomaticBatterySaver);
             proto.write(BatterySaverStateMachineProto.SETTING_BATTERY_SAVER_ENABLED,
                     mSettingBatterySaverEnabled);
             proto.write(BatterySaverStateMachineProto.SETTING_BATTERY_SAVER_ENABLED_STICKY,
@@ -979,6 +993,16 @@
                     mSettingBatterySaverStickyAutoDisableThreshold);
 
             proto.write(
+                    BatterySaverStateMachineProto.DEFAULT_DYNAMIC_DISABLE_THRESHOLD,
+                    mDynamicPowerSavingsDefaultDisableThreshold);
+            proto.write(
+                    BatterySaverStateMachineProto.DYNAMIC_DISABLE_THRESHOLD,
+                    mDynamicPowerSavingsDisableThreshold);
+            proto.write(
+                    BatterySaverStateMachineProto.DYNAMIC_BATTERY_SAVER_ENABLED,
+                    mDynamicPowerSavingsEnableBatterySaver);
+
+            proto.write(
                     BatterySaverStateMachineProto
                             .LAST_ADAPTIVE_BATTERY_SAVER_CHANGED_EXTERNALLY_ELAPSED,
                     mLastAdaptiveBatterySaverChangedExternallyElapsed);
diff --git a/services/core/java/com/android/server/stats/pull/StatsPullAtomService.java b/services/core/java/com/android/server/stats/pull/StatsPullAtomService.java
index 5c79f6e..47a26f5 100644
--- a/services/core/java/com/android/server/stats/pull/StatsPullAtomService.java
+++ b/services/core/java/com/android/server/stats/pull/StatsPullAtomService.java
@@ -16,7 +16,8 @@
 
 package com.android.server.stats.pull;
 
-import static android.app.AppOpsManager.OP_FLAGS_ALL_TRUSTED;
+import static android.app.AppOpsManager.OP_FLAG_SELF;
+import static android.app.AppOpsManager.OP_FLAG_TRUSTED_PROXIED;
 import static android.content.pm.PackageInfo.REQUESTED_PERMISSION_GRANTED;
 import static android.content.pm.PermissionInfo.PROTECTION_DANGEROUS;
 import static android.os.Debug.getIonHeapsSizeKb;
@@ -184,6 +185,7 @@
 
     private static final int MAX_BATTERY_STATS_HELPER_FREQUENCY_MS = 1000;
     private static final int CPU_TIME_PER_THREAD_FREQ_MAX_NUM_FREQUENCIES = 8;
+    private static final int OP_FLAGS_PULLED = OP_FLAG_SELF | OP_FLAG_TRUSTED_PROXIED;
 
     private final Object mNetworkStatsLock = new Object();
     @GuardedBy("mNetworkStatsLock")
@@ -2838,8 +2840,8 @@
             AppOpsManager appOps = mContext.getSystemService(AppOpsManager.class);
 
             CompletableFuture<HistoricalOps> ops = new CompletableFuture<>();
-            HistoricalOpsRequest histOpsRequest =
-                    new HistoricalOpsRequest.Builder(0, Long.MAX_VALUE).build();
+            HistoricalOpsRequest histOpsRequest = new HistoricalOpsRequest.Builder(0,
+                    Long.MAX_VALUE).setFlags(OP_FLAGS_PULLED).build();
             appOps.getHistoricalOps(histOpsRequest, mContext.getMainExecutor(), ops::complete);
 
             HistoricalOps histOps = ops.get(EXTERNAL_STATS_SYNC_TIMEOUT_MILLIS,
@@ -2851,19 +2853,19 @@
                 for (int pkgIdx = 0; pkgIdx < uidOps.getPackageCount(); pkgIdx++) {
                     final HistoricalPackageOps packageOps = uidOps.getPackageOpsAt(pkgIdx);
                     for (int opIdx = 0; opIdx < packageOps.getOpCount(); opIdx++) {
-                        final AppOpsManager.HistoricalOp op  = packageOps.getOpAt(opIdx);
+                        final AppOpsManager.HistoricalOp op = packageOps.getOpAt(opIdx);
 
                         StatsEvent.Builder e = StatsEvent.newBuilder();
                         e.setAtomId(atomTag);
                         e.writeInt(uid);
                         e.writeString(packageOps.getPackageName());
                         e.writeInt(op.getOpCode());
-                        e.writeLong(op.getForegroundAccessCount(OP_FLAGS_ALL_TRUSTED));
-                        e.writeLong(op.getBackgroundAccessCount(OP_FLAGS_ALL_TRUSTED));
-                        e.writeLong(op.getForegroundRejectCount(OP_FLAGS_ALL_TRUSTED));
-                        e.writeLong(op.getBackgroundRejectCount(OP_FLAGS_ALL_TRUSTED));
-                        e.writeLong(op.getForegroundAccessDuration(OP_FLAGS_ALL_TRUSTED));
-                        e.writeLong(op.getBackgroundAccessDuration(OP_FLAGS_ALL_TRUSTED));
+                        e.writeLong(op.getForegroundAccessCount(OP_FLAGS_PULLED));
+                        e.writeLong(op.getBackgroundAccessCount(OP_FLAGS_PULLED));
+                        e.writeLong(op.getForegroundRejectCount(OP_FLAGS_PULLED));
+                        e.writeLong(op.getBackgroundRejectCount(OP_FLAGS_PULLED));
+                        e.writeLong(op.getForegroundAccessDuration(OP_FLAGS_PULLED));
+                        e.writeLong(op.getBackgroundAccessDuration(OP_FLAGS_PULLED));
 
                         String perm = AppOpsManager.opToPermission(op.getOpCode());
                         if (perm == null) {
diff --git a/services/core/java/com/android/server/tv/tuner/ClientProfile.java b/services/core/java/com/android/server/tv/tunerresourcemanager/ClientProfile.java
similarity index 97%
rename from services/core/java/com/android/server/tv/tuner/ClientProfile.java
rename to services/core/java/com/android/server/tv/tunerresourcemanager/ClientProfile.java
index 3845195..bad2b78 100644
--- a/services/core/java/com/android/server/tv/tuner/ClientProfile.java
+++ b/services/core/java/com/android/server/tv/tunerresourcemanager/ClientProfile.java
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package com.android.server.tv.tuner;
+package com.android.server.tv.tunerresourcemanager;
 
 /**
   * A client profile object used by the Tuner Resource Manager to record the registered clients'
@@ -122,6 +122,9 @@
                 + this.mUseCase + ", " + this.mProcessId;
     }
 
+    /**
+    * Builder class for {@link ClientProfile}.
+    */
     public static class ClientProfileBuilder {
         private final int mClientId;
         private String mTvInputSessionId;
diff --git a/services/core/java/com/android/server/tv/tuner/TunerResourceManagerService.java b/services/core/java/com/android/server/tv/tunerresourcemanager/TunerResourceManagerService.java
similarity index 91%
rename from services/core/java/com/android/server/tv/tuner/TunerResourceManagerService.java
rename to services/core/java/com/android/server/tv/tunerresourcemanager/TunerResourceManagerService.java
index e876421..49a7045 100644
--- a/services/core/java/com/android/server/tv/tuner/TunerResourceManagerService.java
+++ b/services/core/java/com/android/server/tv/tunerresourcemanager/TunerResourceManagerService.java
@@ -14,20 +14,20 @@
  * limitations under the License.
  */
 
-package com.android.server.tv.tuner;
+package com.android.server.tv.tunerresourcemanager;
 
 import android.annotation.NonNull;
 import android.annotation.Nullable;
 import android.content.Context;
 import android.media.tv.TvInputManager;
-import android.media.tv.tuner.CasSessionRequest;
-import android.media.tv.tuner.ITunerResourceManager;
-import android.media.tv.tuner.ITunerResourceManagerListener;
-import android.media.tv.tuner.ResourceClientProfile;
-import android.media.tv.tuner.TunerFrontendInfo;
-import android.media.tv.tuner.TunerFrontendRequest;
-import android.media.tv.tuner.TunerLnbRequest;
-import android.media.tv.tuner.TunerResourceManager;
+import android.media.tv.tunerresourcemanager.CasSessionRequest;
+import android.media.tv.tunerresourcemanager.IResourcesReclaimListener;
+import android.media.tv.tunerresourcemanager.ITunerResourceManager;
+import android.media.tv.tunerresourcemanager.ResourceClientProfile;
+import android.media.tv.tunerresourcemanager.TunerFrontendInfo;
+import android.media.tv.tunerresourcemanager.TunerFrontendRequest;
+import android.media.tv.tunerresourcemanager.TunerLnbRequest;
+import android.media.tv.tunerresourcemanager.TunerResourceManager;
 import android.os.RemoteException;
 import android.util.Log;
 import android.util.Slog;
@@ -48,7 +48,7 @@
     private static final boolean DEBUG = Log.isLoggable(TAG, Log.DEBUG);
 
     private SparseArray<ClientProfile> mClientProfiles = new SparseArray<>();
-    private SparseArray<ITunerResourceManagerListener> mListeners = new SparseArray<>();
+    private SparseArray<IResourcesReclaimListener> mListeners = new SparseArray<>();
     private int mNextUnusedFrontendId = 0;
     private List<Integer> mReleasedClientId = new ArrayList<Integer>();
     private List<Integer> mAvailableFrontendIds = new ArrayList<Integer>();
@@ -69,7 +69,7 @@
     private final class BinderService extends ITunerResourceManager.Stub {
         @Override
         public void registerClientProfile(@NonNull ResourceClientProfile profile,
-                            @NonNull ITunerResourceManagerListener listener,
+                            @NonNull IResourcesReclaimListener listener,
                             @NonNull int[] clientId) {
             if (DEBUG) {
                 Slog.d(TAG, "registerClientProfile(clientProfile=" + profile + ")");
diff --git a/services/core/java/com/android/server/wm/ActivityRecord.java b/services/core/java/com/android/server/wm/ActivityRecord.java
index b61a2ce..4cc4851 100644
--- a/services/core/java/com/android/server/wm/ActivityRecord.java
+++ b/services/core/java/com/android/server/wm/ActivityRecord.java
@@ -1723,10 +1723,9 @@
                 // The snapshot of home is only used once because it won't be updated while screen
                 // is on (see {@link TaskSnapshotController#screenTurningOff}).
                 mWmService.mTaskSnapshotController.removeSnapshotCache(task.mTaskId);
-                // TODO(b/9684093): Use more general condition to specify the case.
-                if (mDisplayContent.mAppTransition
-                        .getAppTransition() != WindowManager.TRANSIT_KEYGUARD_GOING_AWAY) {
-                    // Only use snapshot of home as starting window when unlocking.
+                if ((mDisplayContent.mAppTransition.getTransitFlags()
+                        & WindowManager.TRANSIT_FLAG_KEYGUARD_GOING_AWAY_NO_ANIMATION) == 0) {
+                    // Only use snapshot of home as starting window when unlocking directly.
                     return false;
                 }
             }
diff --git a/services/core/java/com/android/server/wm/ActivityStack.java b/services/core/java/com/android/server/wm/ActivityStack.java
index 46596e3..688f474 100644
--- a/services/core/java/com/android/server/wm/ActivityStack.java
+++ b/services/core/java/com/android/server/wm/ActivityStack.java
@@ -111,6 +111,7 @@
 import static com.android.server.wm.TaskProto.ADJUST_IME_AMOUNT;
 import static com.android.server.wm.TaskProto.ANIMATING_BOUNDS;
 import static com.android.server.wm.TaskProto.BOUNDS;
+import static com.android.server.wm.TaskProto.CREATED_BY_ORGANIZER;
 import static com.android.server.wm.TaskProto.DEFER_REMOVAL;
 import static com.android.server.wm.TaskProto.DISPLAYED_BOUNDS;
 import static com.android.server.wm.TaskProto.DISPLAY_ID;
@@ -731,53 +732,14 @@
                         newBounds);
                 hasNewOverrideBounds = true;
             }
-
-            // Use override windowing mode to prevent extra bounds changes if inheriting the mode.
-            if (overrideWindowingMode == WINDOWING_MODE_SPLIT_SCREEN_PRIMARY
-                    || overrideWindowingMode == WINDOWING_MODE_SPLIT_SCREEN_SECONDARY) {
-                // If entering split screen or if something about the available split area changes,
-                // recalculate the split windows to match the new configuration.
-                if (rotationChanged || windowingModeChanged
-                        || prevDensity != getConfiguration().densityDpi
-                        || prevScreenW != getConfiguration().screenWidthDp
-                        || prevScreenH != getConfiguration().screenHeightDp) {
-                    calculateDockedBoundsForConfigChange(newParentConfig, newBounds);
-                    hasNewOverrideBounds = true;
-                }
-            }
         }
 
         if (windowingModeChanged) {
-            // Use override windowing mode to prevent extra bounds changes if inheriting the mode.
-            if (overrideWindowingMode == WINDOWING_MODE_SPLIT_SCREEN_PRIMARY) {
-                getStackDockedModeBounds(null /* dockedBounds */, null /* currentTempTaskBounds */,
-                        newBounds /* outStackBounds */, mTmpRect2 /* outTempTaskBounds */);
-                // immediately resize so docked bounds are available in onSplitScreenModeActivated
-                setTaskDisplayedBounds(null);
-                setTaskBounds(newBounds);
-                setBounds(newBounds);
-                newBounds.set(newBounds);
-            } else if (overrideWindowingMode == WINDOWING_MODE_SPLIT_SCREEN_SECONDARY) {
-                Rect dockedBounds = display.getRootSplitScreenPrimaryTask().getBounds();
-                final boolean isMinimizedDock =
-                        display.mDisplayContent.getDockedDividerController().isMinimizedDock();
-                if (isMinimizedDock) {
-                    Task topTask = display.getRootSplitScreenPrimaryTask().getTopMostTask();
-                    if (topTask != null) {
-                        dockedBounds = topTask.getBounds();
-                    }
-                }
-                getStackDockedModeBounds(dockedBounds, null /* currentTempTaskBounds */,
-                        newBounds /* outStackBounds */, mTmpRect2 /* outTempTaskBounds */);
-                hasNewOverrideBounds = true;
-            }
+            display.onStackWindowingModeChanged(this);
         }
         if (hasNewOverrideBounds) {
-            if (inSplitScreenPrimaryWindowingMode()) {
-                mStackSupervisor.resizeDockedStackLocked(new Rect(newBounds),
-                        null /* tempTaskBounds */, null /* tempTaskInsetBounds */,
-                        null /* tempOtherTaskBounds */, null /* tempOtherTaskInsetBounds */,
-                        PRESERVE_WINDOWS, true /* deferResume */);
+            if (inSplitScreenWindowingMode()) {
+                setBounds(newBounds);
             } else if (overrideWindowingMode != WINDOWING_MODE_PINNED) {
                 // For pinned stack, resize is now part of the {@link WindowContainerTransaction}
                 resize(new Rect(newBounds), null /* tempTaskBounds */,
@@ -920,11 +882,7 @@
                 // warning toast about it.
                 mAtmService.getTaskChangeNotificationController()
                         .notifyActivityDismissingDockedStack();
-                final ActivityStack primarySplitStack = display.getRootSplitScreenPrimaryTask();
-                primarySplitStack.setWindowingModeInSurfaceTransaction(WINDOWING_MODE_UNDEFINED,
-                        false /* animate */, false /* showRecents */,
-                        false /* enteringSplitScreenMode */, true /* deferEnsuringVisibility */,
-                        primarySplitStack == this ? creating : false);
+                display.onSplitScreenModeDismissed();
             }
         }
 
@@ -1218,7 +1176,7 @@
                     display.getTopStackInWindowingMode(WINDOWING_MODE_FULLSCREEN);
             if (topFullScreenStack != null) {
                 final ActivityStack primarySplitScreenStack = display.getRootSplitScreenPrimaryTask();
-                if (display.getIndexOf(topFullScreenStack)
+                if (primarySplitScreenStack != null && display.getIndexOf(topFullScreenStack)
                         > display.getIndexOf(primarySplitScreenStack)) {
                     primarySplitScreenStack.moveToFront(reason + " splitScreenToTop");
                 }
@@ -3999,17 +3957,6 @@
                 ? ((WindowContainer) oldParent).getDisplayContent() : null;
         super.onParentChanged(newParent, oldParent);
 
-        if (display != null && inSplitScreenPrimaryWindowingMode()
-                // only do this for the base stack
-                && !newParent.inSplitScreenPrimaryWindowingMode()) {
-            // If we created a docked stack we want to resize it so it resizes all other stacks
-            // in the system.
-            getStackDockedModeBounds(null /* dockedBounds */, null /* currentTempTaskBounds */,
-                    mTmpRect /* outStackBounds */, mTmpRect2 /* outTempTaskBounds */);
-            mStackSupervisor.resizeDockedStackLocked(getRequestedOverrideBounds(), mTmpRect,
-                    mTmpRect2, null, null, PRESERVE_WINDOWS);
-        }
-
         // Resume next focusable stack after reparenting to another display if we aren't removing
         // the prevous display.
         if (oldDisplay != null && oldDisplay.isRemoving()) {
@@ -4955,6 +4902,12 @@
     }
 
     @Override
+    public SurfaceControl getParentSurfaceControl() {
+        // Tile is a "virtual" parent, so we need to intercept the parent surface here
+        return mTile != null ? mTile.getSurfaceControl() : super.getParentSurfaceControl();
+    }
+
+    @Override
     void removeImmediately() {
         // TODO(task-hierarchy): remove this override when tiles are in hierarchy
         if (mTile != null) {
@@ -5007,6 +4960,10 @@
         if (!matchParentBounds()) {
             final Rect bounds = getRequestedOverrideBounds();
             bounds.dumpDebug(proto, BOUNDS);
+        } else if (getStack().getTile() != null) {
+            // use tile's bounds here for cts.
+            final Rect bounds = getStack().getTile().getRequestedOverrideBounds();
+            bounds.dumpDebug(proto, BOUNDS);
         }
         getOverrideDisplayedBounds().dumpDebug(proto, DISPLAYED_BOUNDS);
         mAdjustedBounds.dumpDebug(proto, ADJUSTED_BOUNDS);
@@ -5026,6 +4983,8 @@
             proto.write(SURFACE_HEIGHT, mSurfaceControl.getHeight());
         }
 
+        proto.write(CREATED_BY_ORGANIZER, this instanceof TaskTile);
+
         proto.end(token);
     }
 }
diff --git a/services/core/java/com/android/server/wm/ActivityStackSupervisor.java b/services/core/java/com/android/server/wm/ActivityStackSupervisor.java
index a582f21..70cd01b 100644
--- a/services/core/java/com/android/server/wm/ActivityStackSupervisor.java
+++ b/services/core/java/com/android/server/wm/ActivityStackSupervisor.java
@@ -108,6 +108,7 @@
 import android.content.pm.ApplicationInfo;
 import android.content.pm.PackageInfo;
 import android.content.pm.PackageManager;
+import android.content.pm.PackageManagerInternal;
 import android.content.pm.ResolveInfo;
 import android.content.pm.UserInfo;
 import android.content.res.Configuration;
@@ -755,6 +756,14 @@
                         || (intent.getFlags() & Intent.FLAG_ACTIVITY_MATCH_EXTERNAL) != 0) {
                 modifiedFlags |= PackageManager.MATCH_INSTANT;
             }
+            int privateResolveFlags  = 0;
+            if (intent.isWebIntent()
+                        && (intent.getFlags() & Intent.FLAG_ACTIVITY_REQUIRE_NON_BROWSER) != 0) {
+                privateResolveFlags |= PackageManagerInternal.RESOLVE_NON_BROWSER_ONLY;
+            }
+            if ((intent.getFlags() & Intent.FLAG_ACTIVITY_REQUIRE_DEFAULT) != 0) {
+                privateResolveFlags |= PackageManagerInternal.RESOLVE_NON_RESOLVER_ONLY;
+            }
 
             // In order to allow cross-profile lookup, we clear the calling identity here.
             // Note the binder identity won't affect the result, but filterCallingUid will.
@@ -764,7 +773,8 @@
             final long token = Binder.clearCallingIdentity();
             try {
                 return mService.getPackageManagerInternalLocked().resolveIntent(
-                        intent, resolvedType, modifiedFlags, userId, true, filterCallingUid);
+                        intent, resolvedType, modifiedFlags, privateResolveFlags, userId, true,
+                        filterCallingUid);
             } finally {
                 Binder.restoreCallingIdentity(token);
             }
@@ -2447,7 +2457,9 @@
                 // split-screen in split-screen.
                 mService.getTaskChangeNotificationController()
                         .notifyActivityDismissingDockedStack();
-                moveTasksToFullscreenStackLocked(dockedStack, actualStack == dockedStack);
+                dockedStack.getDisplay().onSplitScreenModeDismissed();
+                dockedStack.getDisplay().ensureActivitiesVisible(null, 0, PRESERVE_WINDOWS,
+                        true /* notifyClients */);
             }
             return;
         }
@@ -2809,7 +2821,7 @@
                 final DisplayContent display = task.getStack().getDisplay();
                 final ActivityStack topSecondaryStack =
                         display.getTopStackInWindowingMode(WINDOWING_MODE_SPLIT_SCREEN_SECONDARY);
-                if (topSecondaryStack.isActivityTypeHome()) {
+                if (topSecondaryStack != null && topSecondaryStack.isActivityTypeHome()) {
                     // If the home activity is the top split-screen secondary stack, then the
                     // primary split-screen stack is in the minimized mode which means it can't
                     // receive input keys, so we should move the focused app to the home app so that
diff --git a/services/core/java/com/android/server/wm/ActivityTaskManagerInternal.java b/services/core/java/com/android/server/wm/ActivityTaskManagerInternal.java
index 7302e52..6522294 100644
--- a/services/core/java/com/android/server/wm/ActivityTaskManagerInternal.java
+++ b/services/core/java/com/android/server/wm/ActivityTaskManagerInternal.java
@@ -231,7 +231,8 @@
      * @return error codes used by {@link IActivityManager#startActivity} and its siblings.
      */
     public abstract int startActivityAsUser(IApplicationThread caller, String callingPackage,
-            @Nullable String callingFeatureId, Intent intent, @Nullable Bundle options, int userId);
+            @Nullable String callingFeatureId, Intent intent, @Nullable IBinder resultTo,
+            int startFlags, @Nullable Bundle options, int userId);
 
     /**
      * Called when Keyguard flags might have changed.
diff --git a/services/core/java/com/android/server/wm/ActivityTaskManagerService.java b/services/core/java/com/android/server/wm/ActivityTaskManagerService.java
index f2917c5..882d5c7 100644
--- a/services/core/java/com/android/server/wm/ActivityTaskManagerService.java
+++ b/services/core/java/com/android/server/wm/ActivityTaskManagerService.java
@@ -37,7 +37,6 @@
 import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN;
 import static android.app.WindowConfiguration.WINDOWING_MODE_PINNED;
 import static android.app.WindowConfiguration.WINDOWING_MODE_SPLIT_SCREEN_PRIMARY;
-import static android.app.WindowConfiguration.WINDOWING_MODE_SPLIT_SCREEN_SECONDARY;
 import static android.app.WindowConfiguration.WINDOWING_MODE_UNDEFINED;
 import static android.content.Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS;
 import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK;
@@ -229,6 +228,7 @@
 import android.view.IRecentsAnimationRunner;
 import android.view.RemoteAnimationAdapter;
 import android.view.RemoteAnimationDefinition;
+import android.view.WindowContainerTransaction;
 import android.view.WindowManager;
 
 import com.android.internal.R;
@@ -2269,6 +2269,9 @@
         synchronized (mGlobalLock) {
             final long ident = Binder.clearCallingIdentity();
             try {
+                if (WindowConfiguration.isSplitScreenWindowingMode(windowingMode)) {
+                    return setTaskWindowingModeSplitScreen(taskId, windowingMode, toTop);
+                }
                 final Task task = mRootWindowContainer.anyTaskForId(taskId,
                         MATCH_TASK_IN_STACKS_ONLY);
                 if (task == null) {
@@ -2286,10 +2289,16 @@
                 }
 
                 final ActivityStack stack = task.getStack();
+                // Convert some windowing-mode changes into root-task reparents for split-screen.
+                if (stack.getTile() != null) {
+                    stack.getDisplay().onSplitScreenModeDismissed();
+                }
                 if (toTop) {
                     stack.moveToFront("setTaskWindowingMode", task);
                 }
                 stack.setWindowingMode(windowingMode);
+                stack.getDisplay().ensureActivitiesVisible(null, 0, PRESERVE_WINDOWS,
+                        true /* notifyClients */);
                 return true;
             } finally {
                 Binder.restoreCallingIdentity(ident);
@@ -2719,36 +2728,8 @@
         synchronized (mGlobalLock) {
             final long ident = Binder.clearCallingIdentity();
             try {
-                if (isInLockTaskMode()) {
-                    Slog.w(TAG, "setTaskWindowingModeSplitScreenPrimary: Is in lock task mode="
-                            + getLockTaskModeState());
-                    return false;
-                }
-
-                final Task task = mRootWindowContainer.anyTaskForId(taskId,
-                        MATCH_TASK_IN_STACKS_ONLY);
-                if (task == null) {
-                    Slog.w(TAG, "setTaskWindowingModeSplitScreenPrimary: No task for id=" + taskId);
-                    return false;
-                }
-                if (!task.isActivityTypeStandardOrUndefined()) {
-                    throw new IllegalArgumentException("setTaskWindowingMode: Attempt to move"
-                            + " non-standard task " + taskId + " to split-screen windowing mode");
-                }
-
-                if (DEBUG_STACK) Slog.d(TAG_STACK,
-                        "setTaskWindowingModeSplitScreenPrimary: moving task=" + taskId
-                                + " to createMode=" + createMode + " toTop=" + toTop);
-                mWindowManager.setDockedStackCreateStateLocked(createMode, initialBounds);
-                final int windowingMode = task.getWindowingMode();
-                final ActivityStack stack = task.getStack();
-                if (toTop) {
-                    stack.moveToFront("setTaskWindowingModeSplitScreenPrimary", task);
-                }
-                stack.setWindowingMode(WINDOWING_MODE_SPLIT_SCREEN_PRIMARY, animate, showRecents,
-                        false /* enteringSplitScreenMode */, false /* deferEnsuringVisibility */,
-                        false /* creating */);
-                return windowingMode != task.getWindowingMode();
+                return setTaskWindowingModeSplitScreen(taskId, WINDOWING_MODE_SPLIT_SCREEN_PRIMARY,
+                        toTop);
             } finally {
                 Binder.restoreCallingIdentity(ident);
             }
@@ -2756,6 +2737,49 @@
     }
 
     /**
+     * Moves the specified task into a split-screen tile.
+     */
+    private boolean setTaskWindowingModeSplitScreen(int taskId, int windowingMode, boolean toTop) {
+        if (!WindowConfiguration.isSplitScreenWindowingMode(windowingMode)) {
+            throw new IllegalArgumentException("Calling setTaskWindowingModeSplitScreen with non"
+                    + "split-screen mode: " + windowingMode);
+        }
+        if (isInLockTaskMode()) {
+            Slog.w(TAG, "setTaskWindowingModeSplitScreen: Is in lock task mode="
+                    + getLockTaskModeState());
+            return false;
+        }
+
+        final Task task = mRootWindowContainer.anyTaskForId(taskId,
+                MATCH_TASK_IN_STACKS_ONLY);
+        if (task == null) {
+            Slog.w(TAG, "setTaskWindowingModeSplitScreenPrimary: No task for id=" + taskId);
+            return false;
+        }
+        if (!task.isActivityTypeStandardOrUndefined()) {
+            throw new IllegalArgumentException("setTaskWindowingMode: Attempt to move"
+                    + " non-standard task " + taskId + " to split-screen windowing mode");
+        }
+
+        final int prevMode = task.getWindowingMode();
+        final ActivityStack stack = task.getStack();
+        TaskTile tile = null;
+        for (int i = stack.getDisplay().getStackCount() - 1; i >= 0; --i) {
+            tile = stack.getDisplay().getStackAt(i).asTile();
+            if (tile != null && tile.getWindowingMode() == WINDOWING_MODE_SPLIT_SCREEN_PRIMARY) {
+                break;
+            }
+        }
+        if (tile == null) {
+            throw new IllegalStateException("Can't enter split without associated tile");
+        }
+        WindowContainerTransaction wct = new WindowContainerTransaction();
+        wct.reparent(stack.mRemoteToken, tile.mRemoteToken, toTop);
+        mTaskOrganizerController.applyContainerTransaction(wct, null);
+        return prevMode != task.getWindowingMode();
+    }
+
+    /**
      * Removes stacks in the input windowing modes from the system if they are of activity type
      * ACTIVITY_TYPE_STANDARD or ACTIVITY_TYPE_UNDEFINED
      */
@@ -3963,46 +3987,6 @@
     }
 
     /**
-     * Dismisses split-screen multi-window mode.
-     * @param toTop If true the current primary split-screen stack will be placed or left on top.
-     */
-    @Override
-    public void dismissSplitScreenMode(boolean toTop) {
-        enforceCallerIsRecentsOrHasPermission(
-                MANAGE_ACTIVITY_STACKS, "dismissSplitScreenMode()");
-        final long ident = Binder.clearCallingIdentity();
-        try {
-            synchronized (mGlobalLock) {
-                final ActivityStack stack =
-                        mRootWindowContainer.getDefaultDisplay().getRootSplitScreenPrimaryTask();
-                if (stack == null) {
-                    Slog.w(TAG, "dismissSplitScreenMode: primary split-screen stack not found.");
-                    return;
-                }
-
-                if (toTop) {
-                    // Caller wants the current split-screen primary stack to be the top stack after
-                    // it goes fullscreen, so move it to the front.
-                    stack.moveToFront("dismissSplitScreenMode");
-                } else {
-                    // In this case the current split-screen primary stack shouldn't be the top
-                    // stack after it goes fullscreen, so we move the focus to the top-most
-                    // split-screen secondary stack next to it.
-                    final ActivityStack otherStack = stack.getDisplay().getTopStackInWindowingMode(
-                            WINDOWING_MODE_SPLIT_SCREEN_SECONDARY);
-                    if (otherStack != null) {
-                        otherStack.moveToFront("dismissSplitScreenMode_other");
-                    }
-                }
-
-                stack.setWindowingMode(WINDOWING_MODE_UNDEFINED);
-            }
-        } finally {
-            Binder.restoreCallingIdentity(ident);
-        }
-    }
-
-    /**
      * Dismisses Pip
      * @param animate True if the dismissal should be animated.
      * @param animationDuration The duration of the resize animation in milliseconds or -1 if the
@@ -6270,11 +6254,12 @@
 
         @Override
         public int startActivityAsUser(IApplicationThread caller, String callerPackage,
-                @Nullable String callerFeatureId, Intent intent, Bundle options, int userId) {
+                @Nullable String callerFeatureId, Intent intent, @Nullable IBinder resultTo,
+                int startFlags, Bundle options, int userId) {
             return ActivityTaskManagerService.this.startActivityAsUser(
                     caller, callerPackage, callerFeatureId, intent,
                     intent.resolveTypeIfNeeded(mContext.getContentResolver()),
-                    null, null, 0, Intent.FLAG_ACTIVITY_NEW_TASK, null, options, userId,
+                    resultTo, null, 0, startFlags, null, options, userId,
                     false /*validateIncomingUser*/);
         }
 
diff --git a/services/core/java/com/android/server/wm/DisplayContent.java b/services/core/java/com/android/server/wm/DisplayContent.java
index 840abb1..e60ab3f 100644
--- a/services/core/java/com/android/server/wm/DisplayContent.java
+++ b/services/core/java/com/android/server/wm/DisplayContent.java
@@ -16,9 +16,7 @@
 
 package com.android.server.wm;
 
-import static android.app.ActivityTaskManager.INVALID_STACK_ID;
 import static android.app.ActivityTaskManager.INVALID_TASK_ID;
-import static android.app.ActivityTaskManager.SPLIT_SCREEN_CREATE_MODE_TOP_OR_LEFT;
 import static android.app.WindowConfiguration.ACTIVITY_TYPE_HOME;
 import static android.app.WindowConfiguration.ACTIVITY_TYPE_RECENTS;
 import static android.app.WindowConfiguration.ACTIVITY_TYPE_STANDARD;
@@ -32,6 +30,7 @@
 import static android.app.WindowConfiguration.WINDOWING_MODE_SPLIT_SCREEN_PRIMARY;
 import static android.app.WindowConfiguration.WINDOWING_MODE_SPLIT_SCREEN_SECONDARY;
 import static android.app.WindowConfiguration.WINDOWING_MODE_UNDEFINED;
+import static android.app.WindowConfiguration.isSplitScreenWindowingMode;
 import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_BEHIND;
 import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_UNSET;
 import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED;
@@ -56,9 +55,6 @@
 import static android.view.View.GONE;
 import static android.view.View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;
 import static android.view.View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
-import static android.view.WindowManager.DOCKED_BOTTOM;
-import static android.view.WindowManager.DOCKED_INVALID;
-import static android.view.WindowManager.DOCKED_TOP;
 import static android.view.WindowManager.LayoutParams.FIRST_APPLICATION_WINDOW;
 import static android.view.WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE;
 import static android.view.WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE;
@@ -84,9 +80,6 @@
 import static android.view.WindowManager.TRANSIT_TASK_OPEN;
 import static android.view.WindowManager.TRANSIT_TASK_TO_FRONT;
 
-import static com.android.server.wm.DisplayContentProto.FOCUSED_ROOT_TASK_ID;
-import static com.android.server.wm.DisplayContentProto.RESUMED_ACTIVITY;
-import static com.android.server.wm.DisplayContentProto.SINGLE_TASK_INSTANCE;
 import static com.android.server.policy.WindowManagerPolicy.FINISH_LAYOUT_REDO_ANIM;
 import static com.android.server.policy.WindowManagerPolicy.FINISH_LAYOUT_REDO_CONFIG;
 import static com.android.server.policy.WindowManagerPolicy.FINISH_LAYOUT_REDO_LAYOUT;
@@ -105,12 +98,15 @@
 import static com.android.server.wm.DisplayContentProto.DOCKED_STACK_DIVIDER_CONTROLLER;
 import static com.android.server.wm.DisplayContentProto.DPI;
 import static com.android.server.wm.DisplayContentProto.FOCUSED_APP;
+import static com.android.server.wm.DisplayContentProto.FOCUSED_ROOT_TASK_ID;
 import static com.android.server.wm.DisplayContentProto.ID;
 import static com.android.server.wm.DisplayContentProto.OPENING_APPS;
 import static com.android.server.wm.DisplayContentProto.OVERLAY_WINDOWS;
+import static com.android.server.wm.DisplayContentProto.RESUMED_ACTIVITY;
 import static com.android.server.wm.DisplayContentProto.ROOT_DISPLAY_AREA;
 import static com.android.server.wm.DisplayContentProto.ROTATION;
 import static com.android.server.wm.DisplayContentProto.SCREEN_ROTATION_ANIMATION;
+import static com.android.server.wm.DisplayContentProto.SINGLE_TASK_INSTANCE;
 import static com.android.server.wm.DisplayContentProto.TASKS;
 import static com.android.server.wm.DisplayContentProto.WINDOW_CONTAINER;
 import static com.android.server.wm.ProtoLogGroup.WM_DEBUG_ADD_REMOVE;
@@ -1553,6 +1549,20 @@
     }
 
     /**
+     * If the provided {@link ActivityRecord} can be displayed in an orientation different from the
+     * display's, it will be rotated to match its requested orientation.
+     *
+     * @see #rotationForActivityInDifferentOrientation(ActivityRecord).
+     * @see WindowToken#applyFixedRotationTransform(DisplayInfo, DisplayFrames, Configuration)
+     */
+    void rotateInDifferentOrientationIfNeeded(ActivityRecord activityRecord) {
+        int rotation = rotationForActivityInDifferentOrientation(activityRecord);
+        if (rotation != NO_ROTATION) {
+            startFixedRotationTransform(activityRecord, rotation);
+        }
+    }
+
+    /**
      * Update rotation of the display.
      *
      * @return {@code true} if the rotation has been changed.  In this case YOU MUST CALL
@@ -2794,54 +2804,9 @@
 
     void adjustForImeIfNeeded() {
         final WindowState imeWin = mInputMethodWindow;
-        final boolean imeVisible = imeWin != null && imeWin.isVisibleLw() && imeWin.isDisplayedLw()
-                && !mDividerControllerLocked.isImeHideRequested();
-        final ActivityStack dockedStack = getRootSplitScreenPrimaryTask();
-        final boolean dockVisible = dockedStack != null;
-        final Task topDockedTask = dockVisible ? dockedStack.getTask((t) -> true): null;
-        final ActivityStack imeTargetStack = mWmService.getImeFocusStackLocked();
-        final int imeDockSide = (dockVisible && imeTargetStack != null) ?
-                imeTargetStack.getDockSide() : DOCKED_INVALID;
-        final boolean imeOnTop = (imeDockSide == DOCKED_TOP);
-        final boolean imeOnBottom = (imeDockSide == DOCKED_BOTTOM);
+        final boolean imeVisible = imeWin != null && imeWin.isVisibleLw()
+                && imeWin.isDisplayedLw();
         final int imeHeight = mDisplayFrames.getInputMethodWindowVisibleHeight();
-        final boolean imeHeightChanged = imeVisible &&
-                imeHeight != mDividerControllerLocked.getImeHeightAdjustedFor();
-
-        // This includes a case where the docked stack is unminimizing and IME is visible for the
-        // bottom side stack. The condition prevents adjusting the override task bounds for IME to
-        // the minimized docked stack bounds.
-        final boolean dockMinimized = mDividerControllerLocked.isMinimizedDock()
-                || (topDockedTask != null && imeOnBottom && !dockedStack.isAdjustedForIme()
-                && dockedStack.getBounds().height() < topDockedTask.getBounds().height());
-
-        // The divider could be adjusted for IME position, or be thinner than usual,
-        // or both. There are three possible cases:
-        // - If IME is visible, and focus is on top, divider is not moved for IME but thinner.
-        // - If IME is visible, and focus is on bottom, divider is moved for IME and thinner.
-        // - If IME is not visible, divider is not moved and is normal width.
-
-        if (imeVisible && dockVisible && (imeOnTop || imeOnBottom) && !dockMinimized) {
-            for (int i = mTaskContainers.getChildCount() - 1; i >= 0; --i) {
-                final ActivityStack stack = mTaskContainers.getChildAt(i);
-                final boolean isDockedOnBottom = stack.getDockSide() == DOCKED_BOTTOM;
-                if (stack.isVisible() && (imeOnBottom || isDockedOnBottom)
-                        && stack.inSplitScreenWindowingMode()) {
-                    stack.setAdjustedForIme(imeWin, imeOnBottom && imeHeightChanged);
-                } else {
-                    stack.resetAdjustedForIme(false);
-                }
-            }
-            mDividerControllerLocked.setAdjustedForIme(
-                    imeOnBottom /*ime*/, true /*divider*/, true /*animate*/, imeWin, imeHeight);
-        } else {
-            for (int i = mTaskContainers.getChildCount() - 1; i >= 0; --i) {
-                final ActivityStack stack = mTaskContainers.getChildAt(i);
-                stack.resetAdjustedForIme(!dockVisible);
-            }
-            mDividerControllerLocked.setAdjustedForIme(
-                    false /*ime*/, false /*divider*/, dockVisible /*animate*/, imeWin, imeHeight);
-        }
         mPinnedStackControllerLocked.setAdjustedForIme(imeVisible, imeHeight);
     }
 
@@ -3625,20 +3590,25 @@
         mInputMethodTarget = target;
         mInputMethodTargetWaitingAnim = targetWaitingAnim;
         assignWindowLayers(false /* setLayoutNeeded */);
-        mInputMethodControlTarget = computeImeControlTarget();
-        mInsetsStateController.onImeControlTargetChanged(mInputMethodControlTarget);
+        updateImeControlTarget(mInputMethodTarget);
         updateImeParent();
     }
 
     /**
      * IME control target is the window that controls the IME visibility and animation.
      * This window is same as the window on which startInput is called.
-     * @param target the window that receives IME control.
+     * @param target the window that receives IME control. This is ignored if we aren't attaching
+     *               the IME to an app (eg. when in multi-window mode).
      *
      * @see #getImeControlTarget()
      */
-    void updateImeControlTarget(WindowState target) {
-        mInputMethodControlTarget = target;
+    void updateImeControlTarget(InsetsControlTarget target) {
+        if (!isImeAttachedToApp() && mRemoteInsetsControlTarget != null) {
+            mInputMethodControlTarget = mRemoteInsetsControlTarget;
+        } else {
+            // Otherwise, we just use the ime target
+            mInputMethodControlTarget = target;
+        }
         mInsetsStateController.onImeControlTargetChanged(mInputMethodControlTarget);
     }
 
@@ -3671,19 +3641,6 @@
         return mWindowContainers.getSurfaceControl();
     }
 
-    /**
-     * Computes which control-target the IME should be attached to.
-     */
-    @VisibleForTesting
-    InsetsControlTarget computeImeControlTarget() {
-        if (!isImeAttachedToApp() && mRemoteInsetsControlTarget != null) {
-            return mRemoteInsetsControlTarget;
-        }
-
-        // Otherwise, we just use the ime target
-        return mInputMethodTarget;
-    }
-
     void setLayoutNeeded() {
         if (DEBUG_LAYOUT) Slog.w(TAG_WM, "setLayoutNeeded: callers=" + Debug.getCallers(3));
         mLayoutNeeded = true;
@@ -4069,7 +4026,7 @@
         }
     }
 
-    /** @returns the orientation of the display when it's rotation is ROTATION_0. */
+    /** @return the orientation of the display when it's rotation is ROTATION_0. */
     int getNaturalOrientation() {
         return mBaseDisplayWidth < mBaseDisplayHeight
                 ? ORIENTATION_PORTRAIT : ORIENTATION_LANDSCAPE;
@@ -4510,8 +4467,6 @@
                     }
                 } else {
                     mRootSplitScreenPrimaryTask = stack;
-                    mDisplayContent.onSplitScreenModeActivated();
-                    mDividerControllerLocked.notifyDockedStackExistsChanged(true);
                 }
             }
         }
@@ -4523,11 +4478,6 @@
                 mRootPinnedTask = null;
             } else if (stack == mRootSplitScreenPrimaryTask) {
                 mRootSplitScreenPrimaryTask = null;
-                mDisplayContent.onSplitScreenModeDismissed();
-                // Re-set the split-screen create mode whenever the split-screen stack is removed.
-                mWmService.setDockedStackCreateStateLocked(
-                        SPLIT_SCREEN_CREATE_MODE_TOP_OR_LEFT, null /* initialBounds */);
-                mDividerControllerLocked.notifyDockedStackExistsChanged(false);
             }
         }
 
@@ -5943,6 +5893,33 @@
         return createStackUnchecked(windowingMode, activityType, stackId, onTop, info, intent);
     }
 
+    /** @return the tile to create the next stack in. */
+    private TaskTile updateLaunchTile(int windowingMode) {
+        if (!isSplitScreenWindowingMode(windowingMode)) {
+            // Only split-screen windowing modes interact with tiles.
+            return null;
+        }
+        for (int i = getStackCount() - 1; i >= 0; --i) {
+            final TaskTile t = getStackAt(i).asTile();
+            if (t == null || t.getRequestedOverrideWindowingMode() != windowingMode) {
+                continue;
+            }
+            // If not already set, pick a launch tile which is not the one we are launching
+            // into.
+            if (mLaunchTile == null) {
+                for (int j = 0, n = getStackCount(); j < n; ++j) {
+                    TaskTile tt = getStackAt(j).asTile();
+                    if (tt != t) {
+                        mLaunchTile = tt;
+                        break;
+                    }
+                }
+            }
+            return t;
+        }
+        return mLaunchTile;
+    }
+
     @VisibleForTesting
     ActivityStack createStackUnchecked(int windowingMode, int activityType,
             int stackId, boolean onTop, ActivityInfo info, Intent intent) {
@@ -5955,13 +5932,20 @@
             info.applicationInfo = new ApplicationInfo();
         }
 
+        TaskTile tile = updateLaunchTile(windowingMode);
+        if (tile != null) {
+            // Since this stack will be put into a tile, its windowingMode will be inherited.
+            windowingMode = WINDOWING_MODE_UNDEFINED;
+        }
         final ActivityStack stack = new ActivityStack(this, stackId,
                 mRootWindowContainer.mStackSupervisor, activityType, info, intent);
         addStack(stack, onTop ? POSITION_TOP : POSITION_BOTTOM);
         stack.setWindowingMode(windowingMode, false /* animate */, false /* showRecents */,
                 false /* enteringSplitScreenMode */, false /* deferEnsuringVisibility */,
                 true /* creating */);
-
+        if (tile != null) {
+            tile.addChild(stack, 0 /* index */);
+        }
         return stack;
     }
 
@@ -6181,16 +6165,15 @@
     void onSplitScreenModeDismissed() {
         mAtmService.deferWindowLayout();
         try {
-            // Adjust the windowing mode of any stack in secondary split-screen to fullscreen.
+            mLaunchTile = null;
             for (int i = getStackCount() - 1; i >= 0; --i) {
-                final ActivityStack otherStack = getStackAt(i);
-                if (!otherStack.inSplitScreenSecondaryWindowingMode()) {
-                    continue;
+                final TaskTile t = getStackAt(i).asTile();
+                if (t != null) {
+                    t.removeAllChildren();
                 }
-                otherStack.setWindowingMode(WINDOWING_MODE_UNDEFINED, false /* animate */,
-                        false /* showRecents */, false /* enteringSplitScreenMode */,
-                        true /* deferEnsuringVisibility */, false /* creating */);
             }
+            mDividerControllerLocked.setMinimizedDockedStack(false /* minimized */,
+                    false /* animate */);
         } finally {
             final ActivityStack topFullscreenStack =
                     getTopStackInWindowingMode(WINDOWING_MODE_FULLSCREEN);
@@ -6208,27 +6191,6 @@
         }
     }
 
-    void onSplitScreenModeActivated() {
-        mAtmService.deferWindowLayout();
-        try {
-            // Adjust the windowing mode of any affected by split-screen to split-screen secondary.
-            final ActivityStack splitScreenPrimaryStack = getRootSplitScreenPrimaryTask();
-            for (int i = getStackCount() - 1; i >= 0; --i) {
-                final ActivityStack otherStack = getStackAt(i);
-                if (otherStack == splitScreenPrimaryStack
-                        || !otherStack.affectedBySplitScreenResize()) {
-                    continue;
-                }
-                otherStack.setWindowingMode(WINDOWING_MODE_SPLIT_SCREEN_SECONDARY,
-                        false /* animate */, false /* showRecents */,
-                        true /* enteringSplitScreenMode */, true /* deferEnsuringVisibility */,
-                        false /* creating */);
-            }
-        } finally {
-            mAtmService.continueWindowLayout();
-        }
-    }
-
     /**
      * Returns true if the {@param windowingMode} is supported based on other parameters passed in.
      * @param windowingMode The windowing mode we are checking support for.
diff --git a/services/core/java/com/android/server/wm/DisplayPolicy.java b/services/core/java/com/android/server/wm/DisplayPolicy.java
index a96e3a61..e443fe4 100644
--- a/services/core/java/com/android/server/wm/DisplayPolicy.java
+++ b/services/core/java/com/android/server/wm/DisplayPolicy.java
@@ -1183,6 +1183,11 @@
 
         if (transit == TRANSIT_PREVIEW_DONE) {
             if (win.hasAppShownWindows()) {
+                if (win.isActivityTypeHome()) {
+                    // Dismiss the starting window as soon as possible to avoid the crossfade out
+                    // with old content because home is easier to have different UI states.
+                    return ANIMATION_NONE;
+                }
                 if (DEBUG_ANIM) Slog.i(TAG, "**** STARTING EXIT");
                 return R.anim.app_starting_exit;
             }
diff --git a/services/core/java/com/android/server/wm/DisplayRotation.java b/services/core/java/com/android/server/wm/DisplayRotation.java
index 1a0dcb9..64c5faa 100644
--- a/services/core/java/com/android/server/wm/DisplayRotation.java
+++ b/services/core/java/com/android/server/wm/DisplayRotation.java
@@ -527,9 +527,15 @@
             }
             mService.mH.removeCallbacks(mDisplayRotationHandlerTimeout);
             mIsWaitingForRemoteRotation = false;
-            mDisplayContent.sendNewConfiguration();
-            if (t != null) {
-                mService.mAtmService.mTaskOrganizerController.applyContainerTransaction(t, null);
+            mService.mAtmService.deferWindowLayout();
+            try {
+                mDisplayContent.sendNewConfiguration();
+                if (t != null) {
+                    mService.mAtmService.mTaskOrganizerController.applyContainerTransaction(t,
+                            null /* organizer */);
+                }
+            } finally {
+                mService.mAtmService.continueWindowLayout();
             }
         }
     }
diff --git a/services/core/java/com/android/server/wm/DockedStackDividerController.java b/services/core/java/com/android/server/wm/DockedStackDividerController.java
index 872379e..6431e11 100644
--- a/services/core/java/com/android/server/wm/DockedStackDividerController.java
+++ b/services/core/java/com/android/server/wm/DockedStackDividerController.java
@@ -745,7 +745,7 @@
      * @param minimizedDock Whether the docked stack is currently minimized.
      * @param animate Whether to animate the change.
      */
-    private void setMinimizedDockedStack(boolean minimizedDock, boolean animate) {
+    void setMinimizedDockedStack(boolean minimizedDock, boolean animate) {
         final boolean wasMinimized = mMinimizedDock;
         mMinimizedDock = minimizedDock;
         if (minimizedDock == wasMinimized) {
diff --git a/services/core/java/com/android/server/wm/KeyguardController.java b/services/core/java/com/android/server/wm/KeyguardController.java
index 00947d7..44034ed 100644
--- a/services/core/java/com/android/server/wm/KeyguardController.java
+++ b/services/core/java/com/android/server/wm/KeyguardController.java
@@ -31,14 +31,14 @@
 import static android.view.WindowManagerPolicyConstants.KEYGUARD_GOING_AWAY_FLAG_TO_SHADE;
 import static android.view.WindowManagerPolicyConstants.KEYGUARD_GOING_AWAY_FLAG_WITH_WALLPAPER;
 
+import static com.android.server.wm.ActivityStackSupervisor.PRESERVE_WINDOWS;
+import static com.android.server.wm.ActivityTaskManagerDebugConfig.TAG_ATM;
+import static com.android.server.wm.ActivityTaskManagerDebugConfig.TAG_WITH_CLASS_NAME;
 import static com.android.server.wm.KeyguardControllerProto.AOD_SHOWING;
 import static com.android.server.wm.KeyguardControllerProto.KEYGUARD_OCCLUDED_STATES;
 import static com.android.server.wm.KeyguardControllerProto.KEYGUARD_SHOWING;
 import static com.android.server.wm.KeyguardOccludedProto.DISPLAY_ID;
 import static com.android.server.wm.KeyguardOccludedProto.KEYGUARD_OCCLUDED;
-import static com.android.server.wm.ActivityStackSupervisor.PRESERVE_WINDOWS;
-import static com.android.server.wm.ActivityTaskManagerDebugConfig.TAG_ATM;
-import static com.android.server.wm.ActivityTaskManagerDebugConfig.TAG_WITH_CLASS_NAME;
 
 import android.os.IBinder;
 import android.os.RemoteException;
@@ -411,8 +411,7 @@
             if (stack == null) {
                 return;
             }
-            mStackSupervisor.moveTasksToFullscreenStackLocked(stack,
-                    stack.isFocusedStackOnDisplay());
+            mRootWindowContainer.getDefaultDisplay().onSplitScreenModeDismissed();
         }
     }
 
diff --git a/services/core/java/com/android/server/wm/RecentsAnimationController.java b/services/core/java/com/android/server/wm/RecentsAnimationController.java
index 251d0f1..e923e64 100644
--- a/services/core/java/com/android/server/wm/RecentsAnimationController.java
+++ b/services/core/java/com/android/server/wm/RecentsAnimationController.java
@@ -20,7 +20,6 @@
 import static android.app.WindowConfiguration.WINDOWING_MODE_UNDEFINED;
 import static android.view.RemoteAnimationTarget.MODE_CLOSING;
 import static android.view.RemoteAnimationTarget.MODE_OPENING;
-import static android.view.WindowManager.DOCKED_INVALID;
 import static android.view.WindowManager.INPUT_CONSUMER_RECENTS_ANIMATION;
 import static android.view.WindowManager.LayoutParams.TYPE_BASE_APPLICATION;
 
@@ -34,6 +33,7 @@
 import static com.android.server.wm.WindowManagerInternal.AppTransitionListener;
 
 import android.annotation.IntDef;
+import android.annotation.NonNull;
 import android.app.ActivityManager.TaskSnapshot;
 import android.app.WindowConfiguration;
 import android.graphics.Point;
@@ -414,15 +414,15 @@
         }
 
         // Save the minimized home height
-        final ActivityStack dockedStack =
-                mDisplayContent.getRootSplitScreenPrimaryTask();
-        mDisplayContent.getDockedDividerController().getHomeStackBoundsInDockedMode(
-                mDisplayContent.getConfiguration(),
-                dockedStack == null ? DOCKED_INVALID : dockedStack.getDockSide(),
-                mMinimizedHomeBounds);
+        mMinimizedHomeBounds = mDisplayContent.getRootHomeTask().getBounds();
 
         mService.mWindowPlacerLocked.performSurfacePlacement();
 
+        // If the target activity has a fixed orientation which is different from the current top
+        // activity, it will be rotated before being shown so we avoid a screen rotation
+        // animation when showing the Recents view.
+        mDisplayContent.rotateInDifferentOrientationIfNeeded(mTargetActivityRecord);
+
         // Notify that the animation has started
         if (mStatusBar != null) {
             mStatusBar.onRecentsAnimationStateChanged(true /* running */);
@@ -695,6 +695,9 @@
                 mDisplayContent.mAppTransition.notifyAppTransitionFinishedLocked(
                         mTargetActivityRecord.token);
             }
+            if (mTargetActivityRecord.hasFixedRotationTransform()) {
+                mTargetActivityRecord.clearFixedRotationTransform();
+            }
         }
 
         // Notify that the animation has ended
@@ -828,6 +831,19 @@
         return task != null && isAnimatingTask(task) && !isTargetApp(windowState.mActivityRecord);
     }
 
+    /**
+     * If the animation target ActivityRecord has a fixed rotation ({@link
+     * WindowToken#hasFixedRotationTransform()}, the provided wallpaper will be rotated accordingly.
+     *
+     * This avoids any screen rotation animation when animating to the Recents view.
+     */
+    void applyFixedRotationTransformIfNeeded(@NonNull WindowToken wallpaper) {
+        if (mTargetActivityRecord == null) {
+            return;
+        }
+        wallpaper.applyFixedRotationTransform(mTargetActivityRecord);
+    }
+
     @VisibleForTesting
     class TaskAnimationAdapter implements AnimationAdapter {
 
@@ -844,8 +860,8 @@
             mTask = task;
             mIsRecentTaskInvisible = isRecentTaskInvisible;
             final WindowContainer container = mTask.getParent();
-            container.getRelativeDisplayedPosition(mPosition);
             mBounds.set(container.getDisplayedBounds());
+            mPosition.set(mBounds.left, mBounds.top);
         }
 
         RemoteAnimationTarget createRemoteAnimationTarget() {
diff --git a/services/core/java/com/android/server/wm/Task.java b/services/core/java/com/android/server/wm/Task.java
index 34b5c11..c7f2cc7 100644
--- a/services/core/java/com/android/server/wm/Task.java
+++ b/services/core/java/com/android/server/wm/Task.java
@@ -2145,12 +2145,6 @@
                     // For floating tasks, calculate the smallest width from the bounds of the task
                     inOutConfig.smallestScreenWidthDp = (int) (
                             Math.min(mTmpFullBounds.width(), mTmpFullBounds.height()) / density);
-                } else if (WindowConfiguration.isSplitScreenWindowingMode(windowingMode)) {
-                    // Iterating across all screen orientations, and return the minimum of the task
-                    // width taking into account that the bounds might change because the snap
-                    // algorithm snaps to a different value
-                    inOutConfig.smallestScreenWidthDp =
-                            getSmallestScreenWidthDpForDockedBounds(mTmpFullBounds);
                 }
                 // otherwise, it will just inherit
             }
@@ -3257,6 +3251,10 @@
         return this;
     }
 
+    TaskTile asTile() {
+        return null;
+    }
+
     // TODO(task-merge): Figure-out how this should work with hierarchy tasks.
     boolean shouldBeVisible(ActivityRecord starting) {
         return true;
diff --git a/services/core/java/com/android/server/wm/TaskOrganizerController.java b/services/core/java/com/android/server/wm/TaskOrganizerController.java
index 4b13a0c..4d5621c 100644
--- a/services/core/java/com/android/server/wm/TaskOrganizerController.java
+++ b/services/core/java/com/android/server/wm/TaskOrganizerController.java
@@ -492,6 +492,10 @@
         if (!(container instanceof Task)) {
             throw new IllegalArgumentException("Invalid container in hierarchy op");
         }
+        if (container.getDisplayContent() == null) {
+            Slog.w(TAG, "Container is no longer attached: " + container);
+            return 0;
+        }
         if (hop.isReparent()) {
             // special case for tiles since they are "virtual" parents
             if (container instanceof ActivityStack && ((ActivityStack) container).isRootTask()) {
diff --git a/services/core/java/com/android/server/wm/TaskSnapshotController.java b/services/core/java/com/android/server/wm/TaskSnapshotController.java
index 10d6823..d8091ed 100644
--- a/services/core/java/com/android/server/wm/TaskSnapshotController.java
+++ b/services/core/java/com/android/server/wm/TaskSnapshotController.java
@@ -559,8 +559,10 @@
                         }
                     });
                     // Allow taking snapshot of home when turning screen off to reduce the delay of
-                    // unlocking/waking to home.
-                    snapshotTasks(mTmpTasks, true /* allowSnapshotHome */);
+                    // waking from secure lock to home.
+                    final boolean allowSnapshotHome =
+                            mService.mPolicy.isKeyguardSecure(mService.mCurrentUserId);
+                    snapshotTasks(mTmpTasks, allowSnapshotHome);
                 }
             } finally {
                 listener.onScreenOff();
diff --git a/services/core/java/com/android/server/wm/TaskTile.java b/services/core/java/com/android/server/wm/TaskTile.java
index 369db05..74d5c33 100644
--- a/services/core/java/com/android/server/wm/TaskTile.java
+++ b/services/core/java/com/android/server/wm/TaskTile.java
@@ -31,7 +31,6 @@
 import android.graphics.Rect;
 import android.os.IBinder;
 import android.util.Slog;
-import android.view.SurfaceControl;
 
 import java.util.ArrayList;
 import java.util.Comparator;
@@ -78,30 +77,9 @@
         // Virtual parent, so don't notify children.
     }
 
-    /**
-     * If there is a disconnection, this will clean up any vestigial surfaces left on the tile
-     * leash by moving known children to a new surfacecontrol and then removing the old one.
-     */
-    void cleanupSurfaces() {
-        if (mSurfaceControl == null) {
-            return;
-        }
-        SurfaceControl oldSurface = mSurfaceControl;
-        WindowContainer parentWin = getParent();
-        if (parentWin == null) {
-            return;
-        }
-        mSurfaceControl = parentWin.makeChildSurface(null).setName("TaskTile " + mTaskId + " - "
-                    + getRequestedOverrideWindowingMode()).setContainerLayer().build();
-        SurfaceControl.Transaction t = parentWin.getPendingTransaction();
-        t.show(mSurfaceControl);
-        for (int i = 0; i < mChildren.size(); ++i) {
-            if (mChildren.get(i).getSurfaceControl() == null) {
-                continue;
-            }
-            mChildren.get(i).reparentSurfaceControl(t, mSurfaceControl);
-        }
-        t.remove(oldSurface);
+    @Override
+    TaskTile asTile() {
+        return this;
     }
 
     @Override
@@ -215,6 +193,12 @@
         super.removeImmediately();
     }
 
+    @Override
+    void taskOrganizerDied() {
+        super.taskOrganizerDied();
+        removeImmediately();
+    }
+
     static TaskTile forToken(IBinder token) {
         try {
             return (TaskTile) ((TaskToken) token).getContainer();
diff --git a/services/core/java/com/android/server/wm/WallpaperWindowToken.java b/services/core/java/com/android/server/wm/WallpaperWindowToken.java
index d23bf97..1e22141 100644
--- a/services/core/java/com/android/server/wm/WallpaperWindowToken.java
+++ b/services/core/java/com/android/server/wm/WallpaperWindowToken.java
@@ -122,10 +122,37 @@
             mDisplayContent.setLayoutNeeded();
         }
 
-        final DisplayInfo displayInfo = mDisplayContent.getDisplayInfo();
+        final WallpaperController wallpaperController = mDisplayContent.mWallpaperController;
+
+        if (visible) {
+            final WindowState wallpaperTarget = wallpaperController.getWallpaperTarget();
+            final RecentsAnimationController recentsAnimationController =
+                    mWmService.getRecentsAnimationController();
+            if (wallpaperTarget != null
+                    && recentsAnimationController != null
+                    && recentsAnimationController.isAnimatingTask(wallpaperTarget.getTask())) {
+                // If the Recents animation is running, and the wallpaper target is the animating
+                // task we want the wallpaper to be rotated in the same orientation as the
+                // RecentsAnimation's target (e.g the launcher)
+                recentsAnimationController.applyFixedRotationTransformIfNeeded(this);
+            } else if (wallpaperTarget != null
+                    && wallpaperTarget.mToken.hasFixedRotationTransform()) {
+                // If the wallpaper target has a fixed rotation, we want the wallpaper to follow its
+                // rotation
+                applyFixedRotationTransform(wallpaperTarget.mToken);
+            } else if (hasFixedRotationTransform()) {
+                clearFixedRotationTransform();
+            }
+        }
+
+        DisplayInfo displayInfo = getFixedRotationTransformDisplayInfo();
+        if (displayInfo == null) {
+            displayInfo = mDisplayContent.getDisplayInfo();
+        }
+
         final int dw = displayInfo.logicalWidth;
         final int dh = displayInfo.logicalHeight;
-        final WallpaperController wallpaperController = mDisplayContent.mWallpaperController;
+
         for (int wallpaperNdx = mChildren.size() - 1; wallpaperNdx >= 0; wallpaperNdx--) {
             final WindowState wallpaper = mChildren.get(wallpaperNdx);
 
diff --git a/services/core/java/com/android/server/wm/WindowManagerService.java b/services/core/java/com/android/server/wm/WindowManagerService.java
index e1f713e..68b8348 100644
--- a/services/core/java/com/android/server/wm/WindowManagerService.java
+++ b/services/core/java/com/android/server/wm/WindowManagerService.java
@@ -912,7 +912,7 @@
 
     private void setShadowRenderer() {
         mRenderShadowsInCompositor = Settings.Global.getInt(mContext.getContentResolver(),
-                DEVELOPMENT_RENDER_SHADOWS_IN_COMPOSITOR, 0) != 0;
+                DEVELOPMENT_RENDER_SHADOWS_IN_COMPOSITOR, 1) != 0;
     }
 
     PowerManager mPowerManager;
@@ -1169,9 +1169,10 @@
         mAnimator = new WindowAnimator(this);
         mRoot = new RootWindowContainer(this);
 
-        mUseBLAST = DeviceConfig.getBoolean(
+        mUseBLAST = SystemProperties.getBoolean(
+                    String.join(".", "persist.device_config",
                     DeviceConfig.NAMESPACE_WINDOW_MANAGER_NATIVE_BOOT,
-                    WM_USE_BLAST_ADAPTER_FLAG, false);
+                    WM_USE_BLAST_ADAPTER_FLAG), false);
 
         mWindowPlacerLocked = new WindowSurfacePlacer(this);
         mTaskSnapshotController = new TaskSnapshotController(this);
@@ -7491,15 +7492,14 @@
             synchronized (mGlobalLock) {
                 final DisplayContent dc = mRoot.getDisplayContent(displayId);
                 if (dc != null) {
-                    WindowState imeTarget = dc.getImeControlTarget();
-                    if (imeTarget == null) {
+                    InsetsControlTarget imeControlTarget = dc.mInputMethodControlTarget;
+                    if (imeControlTarget == null) {
                         return;
                     }
                     // If there was a pending IME show(), reset it as IME has been
                     // requested to be hidden.
-                    imeTarget.getDisplayContent().getInsetsStateController().getImeSourceProvider()
-                            .abortShowImePostLayout();
-                    imeTarget.hideInsets(WindowInsets.Type.ime(), true /* fromIme */);
+                    dc.getInsetsStateController().getImeSourceProvider().abortShowImePostLayout();
+                    imeControlTarget.hideInsets(WindowInsets.Type.ime(), true /* fromIme */);
                 }
             }
         }
diff --git a/services/core/java/com/android/server/wm/WindowState.java b/services/core/java/com/android/server/wm/WindowState.java
index 78d6b9631..b250083 100644
--- a/services/core/java/com/android/server/wm/WindowState.java
+++ b/services/core/java/com/android/server/wm/WindowState.java
@@ -1513,8 +1513,7 @@
         // Some system windows (e.g. "Power off" dialog) don't have a task, but we would still
         // associate them with some stack to enable dimming.
         final DisplayContent dc = getDisplayContent();
-        return mAttrs.type >= FIRST_SYSTEM_WINDOW && dc != null
-                ? dc.getOrCreateRootHomeTask() : null;
+        return mAttrs.type >= FIRST_SYSTEM_WINDOW && dc != null ? dc.getRootHomeTask() : null;
     }
 
     /**
@@ -2687,18 +2686,6 @@
                             mWmService.mTaskSnapshotController.onAppDied(win.mActivityRecord);
                         }
                         win.removeIfPossible(shouldKeepVisibleDeadAppWindow());
-                        if (win.mAttrs.type == TYPE_DOCK_DIVIDER) {
-                            // The owner of the docked divider died :( We reset the docked stack,
-                            // just in case they have the divider at an unstable position. Better
-                            // also reset drag resizing state, because the owner can't do it
-                            // anymore.
-                            final ActivityStack stack =
-                                    dc.getRootSplitScreenPrimaryTask();
-                            if (stack != null) {
-                                stack.resetDockedStackToMiddle();
-                            }
-                            resetSplitScreenResizing = true;
-                        }
                     } else if (mHasSurface) {
                         Slog.e(TAG, "!!! LEAK !!! Window removed but surface still valid.");
                         WindowState.this.removeIfPossible();
diff --git a/services/core/java/com/android/server/wm/WindowToken.java b/services/core/java/com/android/server/wm/WindowToken.java
index 1180566..48c7812 100644
--- a/services/core/java/com/android/server/wm/WindowToken.java
+++ b/services/core/java/com/android/server/wm/WindowToken.java
@@ -377,6 +377,19 @@
         onConfigurationChanged(getParent().getConfiguration());
     }
 
+    /**
+     * Copies the {@link FixedRotationTransformState} (if any) from the other WindowToken to this
+     * one.
+     */
+    void applyFixedRotationTransform(WindowToken other) {
+        final FixedRotationTransformState fixedRotationState = other.mFixedRotationTransformState;
+        if (fixedRotationState != null) {
+            applyFixedRotationTransform(fixedRotationState.mDisplayInfo,
+                    fixedRotationState.mDisplayFrames,
+                    fixedRotationState.mRotatedOverrideConfiguration);
+        }
+    }
+
     /** Clears the transformation and continue updating the orientation change of display. */
     void clearFixedRotationTransform() {
         if (mFixedRotationTransformState == null) {
diff --git a/services/core/jni/com_android_server_location_GnssLocationProvider.cpp b/services/core/jni/com_android_server_location_GnssLocationProvider.cpp
index e1615af..36ed9a5 100644
--- a/services/core/jni/com_android_server_location_GnssLocationProvider.cpp
+++ b/services/core/jni/com_android_server_location_GnssLocationProvider.cpp
@@ -55,10 +55,9 @@
 static jclass class_gnssNavigationMessage;
 static jclass class_gnssClock;
 static jclass class_gnssConfiguration_halInterfaceVersion;
-static jclass class_gnssAntennaInfo;
-static jclass class_phaseCenterOffsetCoordinates;
-static jclass class_phaseCenterVariationCorrections;
-static jclass class_signalGainCorrections;
+static jclass class_gnssAntennaInfoBuilder;
+static jclass class_phaseCenterOffset;
+static jclass class_sphericalCorrections;
 static jclass class_arrayList;
 static jclass class_doubleArray;
 
@@ -122,12 +121,16 @@
 static jmethodID method_gnssClockCtor;
 static jmethodID method_gnssMeasurementCtor;
 static jmethodID method_halInterfaceVersionCtor;
-static jmethodID method_gnssAntennaInfoCtor;
-static jmethodID method_phaseCenterOffsetCoordinatesCtor;
-static jmethodID method_phaseCenterVariationCorrectionsCtor;
-static jmethodID method_signalGainCorrectionsCtor;
+static jmethodID method_gnssAntennaInfoBuilderCtor;
+static jmethodID method_phaseCenterOffsetCtor;
+static jmethodID method_sphericalCorrectionsCtor;
 static jmethodID method_arrayListCtor;
 static jmethodID method_arrayListAdd;
+static jmethodID method_gnssAntennaInfoBuilderSetCarrierFrequencyMHz;
+static jmethodID method_gnssAntennaInfoBuilderSetPhaseCenterOffset;
+static jmethodID method_gnssAntennaInfoBuilderSetPhaseCenterVariationCorrections;
+static jmethodID method_gnssAntennaInfoBuilderSetSignalGainCorrections;
+static jmethodID method_gnssAntennaInfoBuilderBuild;
 
 /*
  * Save a pointer to JavaVm to attach/detach threads executing
@@ -1088,7 +1091,7 @@
             const hidl_vec<IGnssAntennaInfoCallback::GnssAntennaInfo>& gnssAntennaInfos);
     jobject translateSingleGnssAntennaInfo(
             JNIEnv* env, const IGnssAntennaInfoCallback::GnssAntennaInfo& gnssAntennaInfo);
-    jobject translatePhaseCenterOffsetCoordinates(
+    jobject translatePhaseCenterOffset(
             JNIEnv* env, const IGnssAntennaInfoCallback::GnssAntennaInfo& gnssAntennaInfo);
     jobject translatePhaseCenterVariationCorrections(
             JNIEnv* env, const IGnssAntennaInfoCallback::GnssAntennaInfo& gnssAntennaInfo);
@@ -1150,11 +1153,10 @@
     return arrayList;
 }
 
-jobject GnssAntennaInfoCallback::translatePhaseCenterOffsetCoordinates(
+jobject GnssAntennaInfoCallback::translatePhaseCenterOffset(
         JNIEnv* env, const IGnssAntennaInfoCallback::GnssAntennaInfo& gnssAntennaInfo) {
-    jobject phaseCenterOffsetCoordinates =
-            env->NewObject(class_phaseCenterOffsetCoordinates,
-                           method_phaseCenterOffsetCoordinatesCtor,
+    jobject phaseCenterOffset =
+            env->NewObject(class_phaseCenterOffset, method_phaseCenterOffsetCtor,
                            gnssAntennaInfo.phaseCenterOffsetCoordinateMillimeters.x,
                            gnssAntennaInfo.phaseCenterOffsetCoordinateMillimeters.xUncertainty,
                            gnssAntennaInfo.phaseCenterOffsetCoordinateMillimeters.y,
@@ -1162,7 +1164,7 @@
                            gnssAntennaInfo.phaseCenterOffsetCoordinateMillimeters.z,
                            gnssAntennaInfo.phaseCenterOffsetCoordinateMillimeters.zUncertainty);
 
-    return phaseCenterOffsetCoordinates;
+    return phaseCenterOffset;
 }
 
 jobject GnssAntennaInfoCallback::translatePhaseCenterVariationCorrections(
@@ -1185,8 +1187,7 @@
     }
 
     jobject phaseCenterVariationCorrections =
-            env->NewObject(class_phaseCenterVariationCorrections,
-                           method_phaseCenterVariationCorrectionsCtor,
+            env->NewObject(class_sphericalCorrections, method_sphericalCorrectionsCtor,
                            phaseCenterVariationCorrectionsArray,
                            phaseCenterVariationCorrectionsUncertaintiesArray);
 
@@ -1212,7 +1213,7 @@
     }
 
     jobject signalGainCorrections =
-            env->NewObject(class_signalGainCorrections, method_signalGainCorrectionsCtor,
+            env->NewObject(class_sphericalCorrections, method_sphericalCorrectionsCtor,
                            signalGainCorrectionsArray, signalGainCorrectionsUncertaintiesArray);
 
     env->DeleteLocalRef(signalGainCorrectionsArray);
@@ -1223,8 +1224,7 @@
 
 jobject GnssAntennaInfoCallback::translateSingleGnssAntennaInfo(
         JNIEnv* env, const IGnssAntennaInfoCallback::GnssAntennaInfo& gnssAntennaInfo) {
-    jobject phaseCenterOffsetCoordinates =
-            translatePhaseCenterOffsetCoordinates(env, gnssAntennaInfo);
+    jobject phaseCenterOffset = translatePhaseCenterOffset(env, gnssAntennaInfo);
 
     // Nullable
     jobject phaseCenterVariationCorrections =
@@ -1233,13 +1233,29 @@
     // Nullable
     jobject signalGainCorrections = translateSignalGainCorrections(env, gnssAntennaInfo);
 
+    // Get builder
+    jobject gnssAntennaInfoBuilderObject =
+            env->NewObject(class_gnssAntennaInfoBuilder, method_gnssAntennaInfoBuilderCtor);
+
+    // Set fields
+    env->CallObjectMethod(gnssAntennaInfoBuilderObject,
+                          method_gnssAntennaInfoBuilderSetCarrierFrequencyMHz,
+                          gnssAntennaInfo.carrierFrequencyMHz);
+    env->CallObjectMethod(gnssAntennaInfoBuilderObject,
+                          method_gnssAntennaInfoBuilderSetPhaseCenterOffset, phaseCenterOffset);
+    env->CallObjectMethod(gnssAntennaInfoBuilderObject,
+                          method_gnssAntennaInfoBuilderSetPhaseCenterVariationCorrections,
+                          phaseCenterVariationCorrections);
+    env->CallObjectMethod(gnssAntennaInfoBuilderObject,
+                          method_gnssAntennaInfoBuilderSetSignalGainCorrections,
+                          signalGainCorrections);
+
+    // build
     jobject gnssAntennaInfoObject =
-            env->NewObject(class_gnssAntennaInfo, method_gnssAntennaInfoCtor,
-                           gnssAntennaInfo.carrierFrequencyMHz, phaseCenterOffsetCoordinates,
-                           phaseCenterVariationCorrections, signalGainCorrections);
+            env->CallObjectMethod(gnssAntennaInfoBuilderObject, method_gnssAntennaInfoBuilderBuild);
 
     // Delete Local Refs
-    env->DeleteLocalRef(phaseCenterOffsetCoordinates);
+    env->DeleteLocalRef(phaseCenterOffset);
     env->DeleteLocalRef(phaseCenterVariationCorrections);
     env->DeleteLocalRef(signalGainCorrections);
 
@@ -2004,35 +2020,38 @@
     class_gnssMeasurement = (jclass) env->NewGlobalRef(gnssMeasurementClass);
     method_gnssMeasurementCtor = env->GetMethodID(class_gnssMeasurement, "<init>", "()V");
 
-    jclass gnssAntennaInfoClass = env->FindClass("android/location/GnssAntennaInfo");
-    class_gnssAntennaInfo = (jclass)env->NewGlobalRef(gnssAntennaInfoClass);
-    method_gnssAntennaInfoCtor =
-            env->GetMethodID(class_gnssAntennaInfo, "<init>",
-                             "(D"
-                             "Landroid/location/GnssAntennaInfo$PhaseCenterOffsetCoordinates;"
-                             "Landroid/location/GnssAntennaInfo$PhaseCenterVariationCorrections;"
-                             "Landroid/location/GnssAntennaInfo$SignalGainCorrections;"
-                             ")V");
+    jclass gnssAntennaInfoBuilder = env->FindClass("android/location/GnssAntennaInfo$Builder");
+    class_gnssAntennaInfoBuilder = (jclass)env->NewGlobalRef(gnssAntennaInfoBuilder);
+    method_gnssAntennaInfoBuilderCtor =
+            env->GetMethodID(class_gnssAntennaInfoBuilder, "<init>", "()V");
+    method_gnssAntennaInfoBuilderSetCarrierFrequencyMHz =
+            env->GetMethodID(class_gnssAntennaInfoBuilder, "setCarrierFrequencyMHz",
+                             "(D)Landroid/location/GnssAntennaInfo$Builder;");
+    method_gnssAntennaInfoBuilderSetPhaseCenterOffset =
+            env->GetMethodID(class_gnssAntennaInfoBuilder, "setPhaseCenterOffset",
+                             "(Landroid/location/GnssAntennaInfo$PhaseCenterOffset;)"
+                             "Landroid/location/GnssAntennaInfo$Builder;");
+    method_gnssAntennaInfoBuilderSetPhaseCenterVariationCorrections =
+            env->GetMethodID(class_gnssAntennaInfoBuilder, "setPhaseCenterVariationCorrections",
+                             "(Landroid/location/GnssAntennaInfo$SphericalCorrections;)"
+                             "Landroid/location/GnssAntennaInfo$Builder;");
+    method_gnssAntennaInfoBuilderSetSignalGainCorrections =
+            env->GetMethodID(class_gnssAntennaInfoBuilder, "setSignalGainCorrections",
+                             "(Landroid/location/GnssAntennaInfo$SphericalCorrections;)"
+                             "Landroid/location/GnssAntennaInfo$Builder;");
+    method_gnssAntennaInfoBuilderBuild = env->GetMethodID(class_gnssAntennaInfoBuilder, "build",
+                                                          "()Landroid/location/GnssAntennaInfo;");
 
-    jclass phaseCenterOffsetCoordinatesClass =
-            env->FindClass("android/location/GnssAntennaInfo$PhaseCenterOffsetCoordinates");
-    class_phaseCenterOffsetCoordinates =
-            (jclass)env->NewGlobalRef(phaseCenterOffsetCoordinatesClass);
-    method_phaseCenterOffsetCoordinatesCtor =
-            env->GetMethodID(class_phaseCenterOffsetCoordinates, "<init>", "(DDDDDD)V");
+    jclass phaseCenterOffsetClass =
+            env->FindClass("android/location/GnssAntennaInfo$PhaseCenterOffset");
+    class_phaseCenterOffset = (jclass)env->NewGlobalRef(phaseCenterOffsetClass);
+    method_phaseCenterOffsetCtor = env->GetMethodID(class_phaseCenterOffset, "<init>", "(DDDDDD)V");
 
-    jclass phaseCenterVariationCorrectionsClass =
-            env->FindClass("android/location/GnssAntennaInfo$PhaseCenterVariationCorrections");
-    class_phaseCenterVariationCorrections =
-            (jclass)env->NewGlobalRef(phaseCenterVariationCorrectionsClass);
-    method_phaseCenterVariationCorrectionsCtor =
-            env->GetMethodID(class_phaseCenterVariationCorrections, "<init>", "([[D[[D)V");
-
-    jclass signalGainCorrectionsClass =
-            env->FindClass("android/location/GnssAntennaInfo$SignalGainCorrections");
-    class_signalGainCorrections = (jclass)env->NewGlobalRef(signalGainCorrectionsClass);
-    method_signalGainCorrectionsCtor =
-            env->GetMethodID(class_signalGainCorrections, "<init>", "([[D[[D)V");
+    jclass sphericalCorrectionsClass =
+            env->FindClass("android/location/GnssAntennaInfo$SphericalCorrections");
+    class_sphericalCorrections = (jclass)env->NewGlobalRef(sphericalCorrectionsClass);
+    method_sphericalCorrectionsCtor =
+            env->GetMethodID(class_sphericalCorrections, "<init>", "([[D[[D)V");
 
     jclass locationClass = env->FindClass("android/location/Location");
     class_location = (jclass) env->NewGlobalRef(locationClass);
diff --git a/services/devicepolicy/java/com/android/server/devicepolicy/BaseIDevicePolicyManager.java b/services/devicepolicy/java/com/android/server/devicepolicy/BaseIDevicePolicyManager.java
index 9b85a7b..eff222a 100644
--- a/services/devicepolicy/java/com/android/server/devicepolicy/BaseIDevicePolicyManager.java
+++ b/services/devicepolicy/java/com/android/server/devicepolicy/BaseIDevicePolicyManager.java
@@ -82,4 +82,8 @@
     public long getManagedProfileMaximumTimeOff(ComponentName admin) {
         return 0;
     }
+
+    public boolean canProfileOwnerResetPasswordWhenLocked(int userId) {
+        return false;
+    }
 }
diff --git a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
index 731cd1e..b239b684 100644
--- a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
+++ b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
@@ -48,6 +48,7 @@
 import static android.app.admin.DevicePolicyManager.DELEGATION_NETWORK_LOGGING;
 import static android.app.admin.DevicePolicyManager.DELEGATION_PACKAGE_ACCESS;
 import static android.app.admin.DevicePolicyManager.DELEGATION_PERMISSION_GRANT;
+import static android.app.admin.DevicePolicyManager.ENCRYPTION_STATUS_ACTIVE_PER_USER;
 import static android.app.admin.DevicePolicyManager.ID_TYPE_BASE_INFO;
 import static android.app.admin.DevicePolicyManager.ID_TYPE_IMEI;
 import static android.app.admin.DevicePolicyManager.ID_TYPE_INDIVIDUAL_ATTESTATION;
@@ -2290,6 +2291,11 @@
                     context, requestCode, intent, flags, options, user);
         }
 
+        PendingIntent pendingIntentGetBroadcast(
+                Context context, int requestCode, Intent intent, int flags) {
+            return PendingIntent.getBroadcast(context, requestCode, intent, flags);
+        }
+
         void registerContentObserver(Uri uri, boolean notifyForDescendents,
                 ContentObserver observer, int userHandle) {
             mContext.getContentResolver().registerContentObserver(uri, notifyForDescendents,
@@ -7036,9 +7042,13 @@
             saveSettingsLocked(userId);
         }
 
-        mInjector.binderWithCleanCallingIdentity(() -> mContext.sendBroadcastAsUser(
-                new Intent(DevicePolicyManager.ACTION_RESET_PROTECTION_POLICY_CHANGED),
-                UserHandle.getUserHandleForUid(frpManagementAgentUid)));
+        final Intent intent = new Intent(
+                DevicePolicyManager.ACTION_RESET_PROTECTION_POLICY_CHANGED).addFlags(
+                Intent.FLAG_RECEIVER_INCLUDE_BACKGROUND | Intent.FLAG_RECEIVER_FOREGROUND);
+
+        mInjector.binderWithCleanCallingIdentity(() -> mContext.sendBroadcastAsUser(intent,
+                UserHandle.getUserHandleForUid(frpManagementAgentUid),
+                android.Manifest.permission.MANAGE_FACTORY_RESET_PROTECTION));
 
         DevicePolicyEventLogger
                 .createEvent(DevicePolicyEnums.SET_FACTORY_RESET_PROTECTION)
@@ -10036,35 +10046,6 @@
         }
     }
 
-    private boolean checkCallerIsCurrentUserOrProfile() {
-        final int callingUserId = UserHandle.getCallingUserId();
-        final long token = mInjector.binderClearCallingIdentity();
-        try {
-            UserInfo currentUser;
-            UserInfo callingUser = getUserInfo(callingUserId);
-            try {
-                currentUser = mInjector.getIActivityManager().getCurrentUser();
-            } catch (RemoteException e) {
-                Slog.e(LOG_TAG, "Failed to talk to activity managed.", e);
-                return false;
-            }
-
-            if (callingUser.isManagedProfile() && callingUser.profileGroupId != currentUser.id) {
-                Slog.e(LOG_TAG, "Cannot set permitted input methods for managed profile "
-                        + "of a user that isn't the foreground user.");
-                return false;
-            }
-            if (!callingUser.isManagedProfile() && callingUserId != currentUser.id ) {
-                Slog.e(LOG_TAG, "Cannot set permitted input methods "
-                        + "of a user that isn't the foreground user.");
-                return false;
-            }
-        } finally {
-            mInjector.binderRestoreCallingIdentity(token);
-        }
-        return true;
-    }
-
     @Override
     public boolean setPermittedInputMethods(ComponentName who, List packageList) {
         if (!mHasFeature) {
@@ -14513,12 +14494,15 @@
             final int userHandle = mInjector.userHandleGetCallingUserId();
             getActiveAdminForCallerLocked(admin, DeviceAdminInfo.USES_POLICY_PROFILE_OWNER);
 
-            DevicePolicyData policy = getUserData(userHandle);
-            if (policy.mPasswordTokenHandle != 0) {
-                return mInjector.binderWithCleanCallingIdentity(
-                        () -> mLockPatternUtils.isEscrowTokenActive(policy.mPasswordTokenHandle,
-                                userHandle));
-            }
+            return isResetPasswordTokenActiveForUserLocked(userHandle);
+        }
+    }
+
+    private boolean isResetPasswordTokenActiveForUserLocked(int userHandle) {
+        DevicePolicyData policy = getUserData(userHandle);
+        if (policy.mPasswordTokenHandle != 0) {
+            return mInjector.binderWithCleanCallingIdentity(() ->
+                    mLockPatternUtils.isEscrowTokenActive(policy.mPasswordTokenHandle, userHandle));
         }
         return false;
     }
@@ -15666,8 +15650,8 @@
 
     private void updateProfileOffAlarm(long profileOffDeadline) {
         final AlarmManager am = mInjector.getAlarmManager();
-        final PendingIntent pi = PendingIntent.getBroadcast(mContext, REQUEST_PROFILE_OFF_DEADLINE,
-                new Intent(ACTION_PROFILE_OFF_DEADLINE),
+        final PendingIntent pi = mInjector.pendingIntentGetBroadcast(
+                mContext, REQUEST_PROFILE_OFF_DEADLINE, new Intent(ACTION_PROFILE_OFF_DEADLINE),
                 PendingIntent.FLAG_ONE_SHOT | PendingIntent.FLAG_UPDATE_CURRENT);
         am.cancel(pi);
         if (profileOffDeadline != 0) {
@@ -15802,4 +15786,34 @@
             return admin.mProfileMaximumTimeOff;
         }
     }
+
+    @Override
+    public boolean canProfileOwnerResetPasswordWhenLocked(int userId) {
+        enforceSystemCaller("call canProfileOwnerResetPasswordWhenLocked");
+        synchronized (getLockObject()) {
+            final ActiveAdmin poAdmin = getProfileOwnerAdminLocked(userId);
+            if (poAdmin == null
+                    || getEncryptionStatus() != ENCRYPTION_STATUS_ACTIVE_PER_USER
+                    || !isResetPasswordTokenActiveForUserLocked(userId)) {
+                return false;
+            }
+            final ApplicationInfo poAppInfo;
+            try {
+                poAppInfo = mIPackageManager.getApplicationInfo(
+                        poAdmin.info.getPackageName(), 0 /* flags */, userId);
+            } catch (RemoteException e) {
+                Slog.e(LOG_TAG, "Failed to query PO app info", e);
+                return false;
+            }
+            if (poAppInfo == null) {
+                Slog.wtf(LOG_TAG, "Cannot find AppInfo for profile owner");
+                return false;
+            }
+            if (!poAppInfo.isEncryptionAware()) {
+                return false;
+            }
+            Slog.d(LOG_TAG, "PO should be able to reset password from direct boot");
+            return true;
+        }
+    }
 }
diff --git a/services/java/com/android/server/SystemServer.java b/services/java/com/android/server/SystemServer.java
index 1936f13..569986c 100644
--- a/services/java/com/android/server/SystemServer.java
+++ b/services/java/com/android/server/SystemServer.java
@@ -162,7 +162,7 @@
 import com.android.server.trust.TrustManagerService;
 import com.android.server.tv.TvInputManagerService;
 import com.android.server.tv.TvRemoteService;
-import com.android.server.tv.tuner.TunerResourceManagerService;
+import com.android.server.tv.tunerresourcemanager.TunerResourceManagerService;
 import com.android.server.twilight.TwilightService;
 import com.android.server.uri.UriGrantsManagerService;
 import com.android.server.usage.UsageStatsService;
diff --git a/services/people/java/com/android/server/people/PeopleService.java b/services/people/java/com/android/server/people/PeopleService.java
index 663bf4f..2499614 100644
--- a/services/people/java/com/android/server/people/PeopleService.java
+++ b/services/people/java/com/android/server/people/PeopleService.java
@@ -88,7 +88,7 @@
         @Override
         public void onCreatePredictionSession(AppPredictionContext context,
                 AppPredictionSessionId sessionId) {
-            mSessions.put(sessionId, new SessionInfo(context, mDataManager));
+            mSessions.put(sessionId, new SessionInfo(context, mDataManager, sessionId.getUserId()));
         }
 
         @Override
diff --git a/services/people/java/com/android/server/people/SessionInfo.java b/services/people/java/com/android/server/people/SessionInfo.java
index eaa0781..28612f1 100644
--- a/services/people/java/com/android/server/people/SessionInfo.java
+++ b/services/people/java/com/android/server/people/SessionInfo.java
@@ -16,6 +16,7 @@
 
 package com.android.server.people;
 
+import android.annotation.UserIdInt;
 import android.app.prediction.AppPredictionContext;
 import android.app.prediction.AppTarget;
 import android.app.prediction.IPredictionCallback;
@@ -38,9 +39,10 @@
     private final RemoteCallbackList<IPredictionCallback> mCallbacks =
             new RemoteCallbackList<>();
 
-    SessionInfo(AppPredictionContext predictionContext, DataManager dataManager) {
+    SessionInfo(AppPredictionContext predictionContext, DataManager dataManager,
+            @UserIdInt int callingUserId) {
         mAppTargetPredictor = AppTargetPredictor.create(predictionContext,
-                this::updatePredictions, dataManager);
+                this::updatePredictions, dataManager, callingUserId);
     }
 
     void addCallback(IPredictionCallback callback) {
diff --git a/services/people/java/com/android/server/people/data/DataManager.java b/services/people/java/com/android/server/people/data/DataManager.java
index dd9cbd0..6b97c98 100644
--- a/services/people/java/com/android/server/people/data/DataManager.java
+++ b/services/people/java/com/android/server/people/data/DataManager.java
@@ -34,13 +34,11 @@
 import android.content.pm.LauncherApps.ShortcutQuery;
 import android.content.pm.PackageManagerInternal;
 import android.content.pm.ShortcutInfo;
-import android.content.pm.ShortcutManager;
 import android.content.pm.ShortcutManager.ShareShortcutInfo;
 import android.content.pm.ShortcutServiceInternal;
 import android.content.pm.UserInfo;
 import android.database.ContentObserver;
 import android.net.Uri;
-import android.os.Binder;
 import android.os.CancellationSignal;
 import android.os.Handler;
 import android.os.Process;
@@ -83,7 +81,6 @@
  */
 public class DataManager {
 
-    private static final String PLATFORM_PACKAGE_NAME = "android";
     private static final int MY_UID = Process.myUid();
     private static final int MY_PID = Process.myPid();
     private static final long QUERY_EVENTS_MAX_AGE_MS = DateUtils.DAY_IN_MILLIS;
@@ -106,7 +103,6 @@
 
     private ShortcutServiceInternal mShortcutServiceInternal;
     private PackageManagerInternal mPackageManagerInternal;
-    private ShortcutManager mShortcutManager;
     private UserManager mUserManager;
 
     public DataManager(Context context) {
@@ -125,7 +121,6 @@
     public void initialize() {
         mShortcutServiceInternal = LocalServices.getService(ShortcutServiceInternal.class);
         mPackageManagerInternal = LocalServices.getService(PackageManagerInternal.class);
-        mShortcutManager = mContext.getSystemService(ShortcutManager.class);
         mUserManager = mContext.getSystemService(UserManager.class);
 
         mShortcutServiceInternal.addListener(new ShortcutServiceListener());
@@ -171,8 +166,7 @@
         mNotificationListeners.put(userId, notificationListener);
         try {
             notificationListener.registerAsSystemService(mContext,
-                    new ComponentName(PLATFORM_PACKAGE_NAME, getClass().getCanonicalName()),
-                    userId);
+                    new ComponentName(mContext, getClass()), userId);
         } catch (RemoteException e) {
             // Should never occur for local calls.
         }
@@ -242,8 +236,8 @@
      * Iterates through all the {@link PackageData}s owned by the unlocked users who are in the
      * same profile group as the calling user.
      */
-    public void forAllPackages(Consumer<PackageData> consumer) {
-        List<UserInfo> users = mUserManager.getEnabledProfiles(mInjector.getCallingUserId());
+    void forPackagesInProfile(@UserIdInt int callingUserId, Consumer<PackageData> consumer) {
+        List<UserInfo> users = mUserManager.getEnabledProfiles(callingUserId);
         for (UserInfo userInfo : users) {
             UserData userData = getUnlockedUserData(userInfo.id);
             if (userData != null) {
@@ -275,8 +269,10 @@
      * Gets the {@link ShareShortcutInfo}s from all packages owned by the calling user that match
      * the specified {@link IntentFilter}.
      */
-    public List<ShareShortcutInfo> getShareShortcuts(@NonNull IntentFilter intentFilter) {
-        return mShortcutManager.getShareTargets(intentFilter);
+    public List<ShareShortcutInfo> getShareShortcuts(@NonNull IntentFilter intentFilter,
+            @UserIdInt int callingUserId) {
+        return mShortcutServiceInternal.getShareTargets(
+                mContext.getPackageName(), intentFilter, callingUserId);
     }
 
     /** Reports the {@link AppTargetEvent} from App Prediction Manager. */
@@ -361,7 +357,7 @@
         @ShortcutQuery.QueryFlags int queryFlags = ShortcutQuery.FLAG_MATCH_DYNAMIC
                 | ShortcutQuery.FLAG_MATCH_PINNED | ShortcutQuery.FLAG_MATCH_PINNED_BY_ANY_LAUNCHER;
         return mShortcutServiceInternal.getShortcuts(
-                mInjector.getCallingUserId(), /*callingPackage=*/ PLATFORM_PACKAGE_NAME,
+                UserHandle.USER_SYSTEM, mContext.getPackageName(),
                 /*changedSince=*/ 0, packageName, shortcutIds, /*locusIds=*/ null,
                 /*componentName=*/ null, queryFlags, userId, MY_PID, MY_UID);
     }
@@ -775,7 +771,7 @@
 
         @Override
         public void onReceive(Context context, Intent intent) {
-            forAllPackages(PackageData::saveToDisk);
+            forAllUnlockedUsers(userData -> userData.forAllPackages(PackageData::saveToDisk));
         }
     }
 
@@ -809,9 +805,5 @@
                 Function<String, PackageData> packageDataGetter) {
             return new UsageStatsQueryHelper(userId, packageDataGetter);
         }
-
-        int getCallingUserId() {
-            return Binder.getCallingUserHandle().getIdentifier();
-        }
     }
 }
diff --git a/services/people/java/com/android/server/people/prediction/AppTargetPredictor.java b/services/people/java/com/android/server/people/prediction/AppTargetPredictor.java
index 44f3e35..19cf8af 100644
--- a/services/people/java/com/android/server/people/prediction/AppTargetPredictor.java
+++ b/services/people/java/com/android/server/people/prediction/AppTargetPredictor.java
@@ -18,6 +18,7 @@
 
 import android.annotation.MainThread;
 import android.annotation.NonNull;
+import android.annotation.UserIdInt;
 import android.annotation.WorkerThread;
 import android.app.prediction.AppPredictionContext;
 import android.app.prediction.AppTarget;
@@ -42,25 +43,28 @@
     /** Creates a {@link AppTargetPredictor} instance based on the prediction context. */
     public static AppTargetPredictor create(@NonNull AppPredictionContext predictionContext,
             @NonNull Consumer<List<AppTarget>> updatePredictionsMethod,
-            @NonNull DataManager dataManager) {
+            @NonNull DataManager dataManager, @UserIdInt int callingUserId) {
         if (UI_SURFACE_SHARE.equals(predictionContext.getUiSurface())) {
             return new ShareTargetPredictor(
-                    predictionContext, updatePredictionsMethod, dataManager);
+                    predictionContext, updatePredictionsMethod, dataManager, callingUserId);
         }
-        return new AppTargetPredictor(predictionContext, updatePredictionsMethod, dataManager);
+        return new AppTargetPredictor(
+                predictionContext, updatePredictionsMethod, dataManager, callingUserId);
     }
 
     private final AppPredictionContext mPredictionContext;
     private final Consumer<List<AppTarget>> mUpdatePredictionsMethod;
     private final DataManager mDataManager;
+    final int mCallingUserId;
     private final ExecutorService mCallbackExecutor;
 
     AppTargetPredictor(@NonNull AppPredictionContext predictionContext,
             @NonNull Consumer<List<AppTarget>> updatePredictionsMethod,
-            @NonNull DataManager dataManager) {
+            @NonNull DataManager dataManager, @UserIdInt int callingUserId) {
         mPredictionContext = predictionContext;
         mUpdatePredictionsMethod = updatePredictionsMethod;
         mDataManager = dataManager;
+        mCallingUserId = callingUserId;
         mCallbackExecutor = Executors.newSingleThreadExecutor();
     }
 
diff --git a/services/people/java/com/android/server/people/prediction/ShareTargetPredictor.java b/services/people/java/com/android/server/people/prediction/ShareTargetPredictor.java
index 280ced3..90d8216 100644
--- a/services/people/java/com/android/server/people/prediction/ShareTargetPredictor.java
+++ b/services/people/java/com/android/server/people/prediction/ShareTargetPredictor.java
@@ -19,6 +19,7 @@
 import android.annotation.MainThread;
 import android.annotation.NonNull;
 import android.annotation.Nullable;
+import android.annotation.UserIdInt;
 import android.annotation.WorkerThread;
 import android.app.prediction.AppPredictionContext;
 import android.app.prediction.AppTarget;
@@ -45,8 +46,8 @@
 
     ShareTargetPredictor(@NonNull AppPredictionContext predictionContext,
             @NonNull Consumer<List<AppTarget>> updatePredictionsMethod,
-            @NonNull DataManager dataManager) {
-        super(predictionContext, updatePredictionsMethod, dataManager);
+            @NonNull DataManager dataManager, @UserIdInt int callingUserId) {
+        super(predictionContext, updatePredictionsMethod, dataManager, callingUserId);
         mIntentFilter = predictionContext.getExtras().getParcelable(
                 ChooserActivity.APP_PREDICTION_INTENT_FILTER_KEY);
     }
@@ -84,7 +85,7 @@
     List<ShareTarget> getShareTargets() {
         List<ShareTarget> shareTargets = new ArrayList<>();
         List<ShareShortcutInfo> shareShortcuts =
-                getDataManager().getShareShortcuts(mIntentFilter);
+                getDataManager().getShareShortcuts(mIntentFilter, mCallingUserId);
 
         for (ShareShortcutInfo shareShortcut : shareShortcuts) {
             ShortcutInfo shortcutInfo = shareShortcut.getShortcutInfo();
diff --git a/services/robotests/src/com/android/server/location/LocationRequestStatisticsTest.java b/services/robotests/src/com/android/server/location/LocationRequestStatisticsTest.java
index 4cbdbd17..2d0fe58 100644
--- a/services/robotests/src/com/android/server/location/LocationRequestStatisticsTest.java
+++ b/services/robotests/src/com/android/server/location/LocationRequestStatisticsTest.java
@@ -35,6 +35,7 @@
 @RunWith(RobolectricTestRunner.class)
 @Presubmit
 public class LocationRequestStatisticsTest {
+    private static final String FEATURE_ID = "featureId";
 
     /**
      * Check adding and removing requests & strings
@@ -43,17 +44,18 @@
     public void testRequestSummary() {
         LocationRequestStatistics.RequestSummary summary =
                 new LocationRequestStatistics.RequestSummary(
-                "com.example", "gps", 1000);
+                        "com.example", FEATURE_ID, "gps", 1000);
         StringWriter stringWriter = new StringWriter();
         summary.dump(new IndentingPrintWriter(new PrintWriter(stringWriter), "  "), 1234);
         assertThat(stringWriter.toString()).startsWith("At");
 
         StringWriter stringWriterRemove = new StringWriter();
         summary = new LocationRequestStatistics.RequestSummary(
-                "com.example", "gps",
+                "com.example", "gps", FEATURE_ID,
                 LocationRequestStatistics.RequestSummary.REQUEST_ENDED_INTERVAL);
         summary.dump(new IndentingPrintWriter(new PrintWriter(stringWriterRemove), "  "), 2345);
         assertThat(stringWriterRemove.toString()).contains("-");
+        assertThat(stringWriterRemove.toString()).contains(FEATURE_ID);
     }
 
     /**
@@ -62,11 +64,11 @@
     @Test
     public void testSummaryList() {
         LocationRequestStatistics statistics = new LocationRequestStatistics();
-        statistics.history.addRequest("com.example", "gps", 1000);
+        statistics.history.addRequest("com.example", FEATURE_ID, "gps", 1000);
         assertThat(statistics.history.mList.size()).isEqualTo(1);
         // Try (not) to overflow
         for (int i = 0; i < LocationRequestStatistics.RequestSummaryLimitedHistory.MAX_SIZE; i++) {
-            statistics.history.addRequest("com.example", "gps", 1000);
+            statistics.history.addRequest("com.example", FEATURE_ID, "gps", 1000);
         }
         assertThat(statistics.history.mList.size()).isEqualTo(
                 LocationRequestStatistics.RequestSummaryLimitedHistory.MAX_SIZE);
diff --git a/services/tests/servicestests/src/com/android/server/CachedDeviceStateServiceTest.java b/services/tests/servicestests/src/com/android/server/CachedDeviceStateServiceTest.java
index 2a78b6f..2c84f26 100644
--- a/services/tests/servicestests/src/com/android/server/CachedDeviceStateServiceTest.java
+++ b/services/tests/servicestests/src/com/android/server/CachedDeviceStateServiceTest.java
@@ -26,6 +26,7 @@
 import android.os.BatteryManager;
 import android.os.BatteryManagerInternal;
 import android.os.IPowerManager;
+import android.os.IThermalService;
 import android.os.OsProtoEnums;
 import android.os.PowerManager;
 import android.os.RemoteException;
@@ -52,13 +53,14 @@
 public class CachedDeviceStateServiceTest {
     @Mock private BatteryManagerInternal mBatteryManager;
     @Mock private IPowerManager mPowerManager;
+    @Mock private IThermalService mThermalService;
     private BroadcastInterceptingContext mContext;
 
     @Before
     public void setUp() throws RemoteException {
         MockitoAnnotations.initMocks(this);
         Context context = InstrumentationRegistry.getContext();
-        PowerManager powerManager = new PowerManager(context, mPowerManager, null);
+        PowerManager powerManager = new PowerManager(context, mPowerManager, mThermalService, null);
         mContext = new BroadcastInterceptingContext(context) {
             @Override
             public Object getSystemService(String name) {
diff --git a/services/tests/servicestests/src/com/android/server/accessibility/AbstractAccessibilityServiceConnectionTest.java b/services/tests/servicestests/src/com/android/server/accessibility/AbstractAccessibilityServiceConnectionTest.java
index dfe950e..ae8d554 100644
--- a/services/tests/servicestests/src/com/android/server/accessibility/AbstractAccessibilityServiceConnectionTest.java
+++ b/services/tests/servicestests/src/com/android/server/accessibility/AbstractAccessibilityServiceConnectionTest.java
@@ -74,11 +74,11 @@
 import android.os.Handler;
 import android.os.IBinder;
 import android.os.IPowerManager;
+import android.os.IThermalService;
 import android.os.PowerManager;
 import android.os.Process;
 import android.os.RemoteCallback;
 import android.os.RemoteException;
-import android.testing.DexmakerShareClassLoaderRule;
 import android.view.Display;
 import android.view.KeyEvent;
 import android.view.accessibility.AccessibilityNodeInfo;
@@ -91,7 +91,6 @@
 import com.android.server.wm.WindowManagerInternal;
 
 import org.junit.Before;
-import org.junit.Rule;
 import org.junit.Test;
 import org.mockito.ArgumentCaptor;
 import org.mockito.Mock;
@@ -147,12 +146,9 @@
     private ArrayList<Integer> mDisplayList = new ArrayList<>(Arrays.asList(
             Display.DEFAULT_DISPLAY, SECONDARY_DISPLAY_ID));
 
-    // To mock package-private class.
-    @Rule public final DexmakerShareClassLoaderRule mDexmakerShareClassLoaderRule =
-            new DexmakerShareClassLoaderRule();
-
     @Mock private Context mMockContext;
     @Mock private IPowerManager mMockIPowerManager;
+    @Mock private IThermalService mMockIThermalService;
     @Mock private PackageManager mMockPackageManager;
     @Spy  private AccessibilityServiceInfo mSpyServiceInfo = new AccessibilityServiceInfo();
     @Mock private AccessibilitySecurityPolicy mMockSecurityPolicy;
@@ -180,7 +176,7 @@
                 .thenReturn(mMockMagnificationController);
 
         PowerManager powerManager =
-                new PowerManager(mMockContext, mMockIPowerManager, mHandler);
+                new PowerManager(mMockContext, mMockIPowerManager, mMockIThermalService, mHandler);
         when(mMockContext.getSystemService(Context.POWER_SERVICE)).thenReturn(powerManager);
         when(mMockContext.getPackageManager()).thenReturn(mMockPackageManager);
         when(mMockPackageManager.hasSystemFeature(FEATURE_FINGERPRINT)).thenReturn(true);
diff --git a/services/tests/servicestests/src/com/android/server/accessibility/KeyEventDispatcherTest.java b/services/tests/servicestests/src/com/android/server/accessibility/KeyEventDispatcherTest.java
index 4123556..85b8fcb 100644
--- a/services/tests/servicestests/src/com/android/server/accessibility/KeyEventDispatcherTest.java
+++ b/services/tests/servicestests/src/com/android/server/accessibility/KeyEventDispatcherTest.java
@@ -34,6 +34,7 @@
 import android.content.Context;
 import android.os.Handler;
 import android.os.IPowerManager;
+import android.os.IThermalService;
 import android.os.Looper;
 import android.os.Message;
 import android.os.PowerManager;
@@ -73,6 +74,7 @@
     private KeyEventFilter mKeyEventFilter1;
     private KeyEventFilter mKeyEventFilter2;
     private IPowerManager mMockPowerManagerService;
+    private IThermalService mMockThermalService;
     private MessageCapturingHandler mMessageCapturingHandler;
     private ArgumentCaptor<Integer> mFilter1SequenceCaptor = ArgumentCaptor.forClass(Integer.class);
     private ArgumentCaptor<Integer> mFilter2SequenceCaptor = ArgumentCaptor.forClass(Integer.class);
@@ -82,10 +84,12 @@
         Looper looper = InstrumentationRegistry.getContext().getMainLooper();
         mInputEventsHandler = new MessageCapturingHandler(looper, null);
         mMockPowerManagerService = mock(IPowerManager.class);
+        mMockThermalService = mock(IThermalService.class);
         // TODO: It would be better to mock PowerManager rather than its binder, but the class is
         // final.
         PowerManager powerManager =
-                new PowerManager(mock(Context.class), mMockPowerManagerService, new Handler(looper));
+                new PowerManager(mock(Context.class), mMockPowerManagerService, mMockThermalService,
+                        new Handler(looper));
         mMessageCapturingHandler = new MessageCapturingHandler(looper, null);
         mKeyEventDispatcher = new KeyEventDispatcher(mInputEventsHandler, SEND_FRAMEWORK_KEY_EVENT,
                 mLock, powerManager, mMessageCapturingHandler);
diff --git a/services/tests/servicestests/src/com/android/server/attention/AttentionManagerServiceTest.java b/services/tests/servicestests/src/com/android/server/attention/AttentionManagerServiceTest.java
index e90cb46..ac0cac1 100644
--- a/services/tests/servicestests/src/com/android/server/attention/AttentionManagerServiceTest.java
+++ b/services/tests/servicestests/src/com/android/server/attention/AttentionManagerServiceTest.java
@@ -37,6 +37,7 @@
 import android.content.Context;
 import android.os.IBinder;
 import android.os.IPowerManager;
+import android.os.IThermalService;
 import android.os.PowerManager;
 import android.os.RemoteException;
 import android.provider.DeviceConfig;
@@ -74,6 +75,8 @@
     @Mock
     private IPowerManager mMockIPowerManager;
     @Mock
+    private IThermalService mMockIThermalService;
+    @Mock
     Context mContext;
 
     @Before
@@ -84,7 +87,7 @@
         // setup power manager mock
         PowerManager mPowerManager;
         doReturn(true).when(mMockIPowerManager).isInteractive();
-        mPowerManager = new PowerManager(mContext, mMockIPowerManager, null);
+        mPowerManager = new PowerManager(mContext, mMockIPowerManager, mMockIThermalService, null);
 
         Object mLock = new Object();
         // setup a spy on attention manager
diff --git a/services/tests/servicestests/src/com/android/server/compat/CompatConfigTest.java b/services/tests/servicestests/src/com/android/server/compat/CompatConfigTest.java
index 407f67e..44f4ccf 100644
--- a/services/tests/servicestests/src/com/android/server/compat/CompatConfigTest.java
+++ b/services/tests/servicestests/src/com/android/server/compat/CompatConfigTest.java
@@ -24,6 +24,7 @@
 import static org.mockito.Mockito.when;
 import static org.testng.Assert.assertThrows;
 
+import android.app.compat.ChangeIdStateCache;
 import android.content.Context;
 import android.content.pm.ApplicationInfo;
 import android.content.pm.PackageManager;
@@ -74,6 +75,7 @@
         // Assume userdebug/eng non-final build
         when(mBuildClassifier.isDebuggableBuild()).thenReturn(true);
         when(mBuildClassifier.isFinalBuild()).thenReturn(false);
+        ChangeIdStateCache.disable();
     }
 
     @Test
diff --git a/services/tests/servicestests/src/com/android/server/compat/PlatformCompatTest.java b/services/tests/servicestests/src/com/android/server/compat/PlatformCompatTest.java
index 4a686ee..53b90f2 100644
--- a/services/tests/servicestests/src/com/android/server/compat/PlatformCompatTest.java
+++ b/services/tests/servicestests/src/com/android/server/compat/PlatformCompatTest.java
@@ -62,6 +62,7 @@
     @Before
     public void setUp() throws Exception {
         MockitoAnnotations.initMocks(this);
+        android.app.compat.ChangeIdStateCache.disable();
         when(mContext.getPackageManager()).thenReturn(mPackageManager);
         when(mPackageManager.getPackageUid(eq(PACKAGE_NAME), eq(0))).thenThrow(
                 new PackageManager.NameNotFoundException());
diff --git a/services/tests/servicestests/src/com/android/server/content/SyncOperationTest.java b/services/tests/servicestests/src/com/android/server/content/SyncOperationTest.java
index e37ed79..2cbc3f3 100644
--- a/services/tests/servicestests/src/com/android/server/content/SyncOperationTest.java
+++ b/services/tests/servicestests/src/com/android/server/content/SyncOperationTest.java
@@ -124,8 +124,9 @@
         SyncOperation op2 = SyncOperation.maybeCreateFromJobExtras(pb);
 
         assertTrue("Account fields in extras not persisted.",
-                account1.equals(op2.extras.get("acc")));
-        assertTrue("Fields in extras not persisted", "String".equals(op2.extras.getString("str")));
+                account1.equals(op2.getClonedExtras().get("acc")));
+        assertTrue("Fields in extras not persisted", "String".equals(
+                op2.getClonedExtras().getString("str")));
     }
 
     @SmallTest
diff --git a/services/tests/servicestests/src/com/android/server/devicepolicy/DevicePolicyManagerServiceMigrationTest.java b/services/tests/servicestests/src/com/android/server/devicepolicy/DevicePolicyManagerServiceMigrationTest.java
index 9574a08..40b0e71 100644
--- a/services/tests/servicestests/src/com/android/server/devicepolicy/DevicePolicyManagerServiceMigrationTest.java
+++ b/services/tests/servicestests/src/com/android/server/devicepolicy/DevicePolicyManagerServiceMigrationTest.java
@@ -31,8 +31,11 @@
 import android.os.Bundle;
 import android.os.UserHandle;
 import android.os.UserManager;
+import android.platform.test.annotations.Presubmit;
 import android.provider.Settings;
 
+import androidx.test.filters.SmallTest;
+
 import com.android.frameworks.servicestests.R;
 import com.android.server.LocalServices;
 import com.android.server.SystemService;
@@ -43,7 +46,7 @@
 import java.util.Map;
 import java.util.Set;
 
-// TODO (b/143516163): Fix old test cases and put into presubmit.
+// TODO (b/149818286): Fix old test cases and put the whole test into presubmit.
 public class DevicePolicyManagerServiceMigrationTest extends DpmTestBase {
 
     private static final String USER_TYPE_EMPTY = "";
@@ -343,6 +346,8 @@
         assertTrue(alreadySet.contains(UserManager.DISALLOW_BLUETOOTH_SHARING));
     }
 
+    @Presubmit
+    @SmallTest
     public void testCompMigrationUnAffiliated_skipped() throws Exception {
         prepareAdmin1AsDo();
         prepareAdminAnotherPackageAsPo(COPE_PROFILE_USER_ID);
@@ -354,6 +359,8 @@
         assertTrue(dpms.mOwners.hasDeviceOwner());
     }
 
+    @Presubmit
+    @SmallTest
     public void testCompMigrationAffiliated() throws Exception {
         prepareAdmin1AsDo();
         prepareAdmin1AsPo(COPE_PROFILE_USER_ID);
diff --git a/services/tests/servicestests/src/com/android/server/devicepolicy/DevicePolicyManagerServiceTestable.java b/services/tests/servicestests/src/com/android/server/devicepolicy/DevicePolicyManagerServiceTestable.java
index 3a8258b..853151f 100644
--- a/services/tests/servicestests/src/com/android/server/devicepolicy/DevicePolicyManagerServiceTestable.java
+++ b/services/tests/servicestests/src/com/android/server/devicepolicy/DevicePolicyManagerServiceTestable.java
@@ -369,6 +369,12 @@
         }
 
         @Override
+        PendingIntent pendingIntentGetBroadcast(Context context, int requestCode,
+                Intent intent, int flags) {
+            return null;
+        }
+
+        @Override
         void registerContentObserver(Uri uri, boolean notifyForDescendents,
                 ContentObserver observer, int userHandle) {
             mContentObservers.put(new Pair<Uri, Integer>(uri, userHandle), observer);
diff --git a/services/tests/servicestests/src/com/android/server/devicepolicy/DevicePolicyManagerTest.java b/services/tests/servicestests/src/com/android/server/devicepolicy/DevicePolicyManagerTest.java
index 37ce510..dbf2f14 100644
--- a/services/tests/servicestests/src/com/android/server/devicepolicy/DevicePolicyManagerTest.java
+++ b/services/tests/servicestests/src/com/android/server/devicepolicy/DevicePolicyManagerTest.java
@@ -26,6 +26,7 @@
 import static android.app.admin.DevicePolicyManager.PASSWORD_COMPLEXITY_NONE;
 import static android.app.admin.DevicePolicyManager.WIPE_EUICC;
 import static android.app.admin.PasswordMetrics.computeForPassword;
+import static android.content.pm.ApplicationInfo.PRIVATE_FLAG_DIRECT_BOOT_AWARE;
 
 import static com.android.internal.widget.LockPatternUtils.CREDENTIAL_TYPE_NONE;
 import static com.android.internal.widget.LockPatternUtils.EscrowTokenStateChangeCallback;
@@ -2097,7 +2098,8 @@
         verify(mContext.spiedContext).sendBroadcastAsUser(
                 MockUtils.checkIntentAction(
                         DevicePolicyManager.ACTION_RESET_PROTECTION_POLICY_CHANGED),
-                MockUtils.checkUserHandle(DpmMockContext.CALLER_USER_HANDLE));
+                MockUtils.checkUserHandle(DpmMockContext.CALLER_USER_HANDLE),
+                eq(android.Manifest.permission.MANAGE_FACTORY_RESET_PROTECTION));
     }
 
     public void testSetFactoryResetProtectionPolicyFailWithPO() throws Exception {
@@ -2144,7 +2146,8 @@
         verify(mContext.spiedContext).sendBroadcastAsUser(
                 MockUtils.checkIntentAction(
                         DevicePolicyManager.ACTION_RESET_PROTECTION_POLICY_CHANGED),
-                MockUtils.checkUserHandle(DpmMockContext.CALLER_USER_HANDLE));
+                MockUtils.checkUserHandle(DpmMockContext.CALLER_USER_HANDLE),
+                eq(android.Manifest.permission.MANAGE_FACTORY_RESET_PROTECTION));
     }
 
     public void testGetFactoryResetProtectionPolicyWithFrpManagementAgent()
@@ -2171,7 +2174,8 @@
         verify(mContext.spiedContext).sendBroadcastAsUser(
                 MockUtils.checkIntentAction(
                         DevicePolicyManager.ACTION_RESET_PROTECTION_POLICY_CHANGED),
-                MockUtils.checkUserHandle(DpmMockContext.CALLER_USER_HANDLE));
+                MockUtils.checkUserHandle(DpmMockContext.CALLER_USER_HANDLE),
+                eq(android.Manifest.permission.MANAGE_FACTORY_RESET_PROTECTION));
     }
 
     private void assertPoliciesAreEqual(FactoryResetProtectionPolicy expectedPolicy,
@@ -6045,6 +6049,86 @@
         assertTrue(dpm.isCommonCriteriaModeEnabled(admin1));
     }
 
+    public void testCanProfileOwnerResetPasswordWhenLocked_nonDirectBootAwarePo()
+            throws Exception {
+        setDeviceEncryptionPerUser();
+        setupProfileOwner();
+        setupPasswordResetToken();
+
+        mContext.binder.callingUid = DpmMockContext.SYSTEM_UID;
+        assertFalse("po is not direct boot aware",
+                dpm.canProfileOwnerResetPasswordWhenLocked(DpmMockContext.CALLER_USER_HANDLE));
+    }
+
+    public void testCanProfileOwnerResetPasswordWhenLocked_noActiveToken() throws Exception {
+        setDeviceEncryptionPerUser();
+        setupProfileOwner();
+        makeAdmin1DirectBootAware();
+
+        mContext.binder.callingUid = DpmMockContext.SYSTEM_UID;
+        assertFalse("po doesn't have an active password reset token",
+                dpm.canProfileOwnerResetPasswordWhenLocked(DpmMockContext.CALLER_USER_HANDLE));
+    }
+
+    public void testCanProfileOwnerResetPasswordWhenLocked_nonFbeDevice() throws Exception {
+        setupProfileOwner();
+        makeAdmin1DirectBootAware();
+        setupPasswordResetToken();
+
+        mContext.binder.callingUid = DpmMockContext.SYSTEM_UID;
+        assertFalse("device is not FBE",
+                dpm.canProfileOwnerResetPasswordWhenLocked(DpmMockContext.CALLER_USER_HANDLE));
+    }
+
+    public void testCanProfileOwnerResetPasswordWhenLocked() throws Exception {
+        setDeviceEncryptionPerUser();
+        setupProfileOwner();
+        makeAdmin1DirectBootAware();
+        setupPasswordResetToken();
+
+        mContext.binder.callingUid = DpmMockContext.SYSTEM_UID;
+        assertTrue("direct boot aware po with active password reset token",
+                dpm.canProfileOwnerResetPasswordWhenLocked(DpmMockContext.CALLER_USER_HANDLE));
+    }
+
+    private void setupPasswordResetToken() {
+        final byte[] token = new byte[32];
+        final long handle = 123456;
+
+        when(getServices().lockPatternUtils
+                .addEscrowToken(eq(token), eq(DpmMockContext.CALLER_USER_HANDLE),
+                        nullable(EscrowTokenStateChangeCallback.class)))
+                .thenReturn(handle);
+
+        dpm.setResetPasswordToken(admin1, token);
+
+        when(getServices().lockPatternUtils
+                .isEscrowTokenActive(eq(handle), eq(DpmMockContext.CALLER_USER_HANDLE)))
+                .thenReturn(true);
+
+        assertTrue("failed to activate token", dpm.isResetPasswordTokenActive(admin1));
+    }
+
+    private void makeAdmin1DirectBootAware()
+            throws PackageManager.NameNotFoundException, android.os.RemoteException {
+        Mockito.reset(getServices().ipackageManager);
+
+        final ApplicationInfo ai = DpmTestUtils.cloneParcelable(
+                mRealTestContext.getPackageManager().getApplicationInfo(
+                        admin1.getPackageName(),
+                        PackageManager.GET_DISABLED_UNTIL_USED_COMPONENTS));
+        ai.privateFlags = PRIVATE_FLAG_DIRECT_BOOT_AWARE;
+
+        doReturn(ai).when(getServices().ipackageManager).getApplicationInfo(
+                eq(admin1.getPackageName()),
+                anyInt(),
+                eq(DpmMockContext.CALLER_USER_HANDLE));
+    }
+
+    private void setDeviceEncryptionPerUser() {
+        when(getServices().storageManager.isFileBasedEncryptionEnabled()).thenReturn(true);
+    }
+
     private void setCrossProfileAppsList(String... packages) {
         when(mContext.getResources()
                 .getStringArray(eq(R.array.cross_profile_apps)))
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 50ed975..0551f2e 100644
--- a/services/tests/servicestests/src/com/android/server/hdmi/HdmiCecLocalDeviceAudioSystemTest.java
+++ b/services/tests/servicestests/src/com/android/server/hdmi/HdmiCecLocalDeviceAudioSystemTest.java
@@ -76,6 +76,7 @@
     private boolean mMutingEnabled;
     private boolean mArcSupport;
     private HdmiPortInfo[] mHdmiPortInfo;
+    private boolean mWokenUp;
 
     @Before
     public void setUp() {
@@ -138,7 +139,9 @@
                 }
 
                 @Override
-                void wakeUp() {}
+                void wakeUp() {
+                    mWokenUp = true;
+                }
 
                 @Override
                 void invokeDeviceEventListeners(HdmiDeviceInfo device, int status) {
@@ -698,4 +701,18 @@
             .getCecDeviceInfo(differentDevice.getLogicalAddress())).isEqualTo(differentDevice);
         assertThat(mInvokeDeviceEventState).isEqualTo(DEVICE_EVENT_ADD_DEVICE);
     }
+
+    @Test
+    public void doNotWakeUpOnHotPlug_PlugIn() {
+        mWokenUp = false;
+        mHdmiCecLocalDeviceAudioSystem.onHotplug(0, true);
+        assertThat(mWokenUp).isFalse();
+    }
+
+    @Test
+    public void doNotWakeUpOnHotPlug_PlugOut() {
+        mWokenUp = false;
+        mHdmiCecLocalDeviceAudioSystem.onHotplug(0, false);
+        assertThat(mWokenUp).isFalse();
+    }
 }
diff --git a/services/tests/servicestests/src/com/android/server/hdmi/HdmiCecLocalDevicePlaybackTest.java b/services/tests/servicestests/src/com/android/server/hdmi/HdmiCecLocalDevicePlaybackTest.java
index 0062a17..4a1af51 100644
--- a/services/tests/servicestests/src/com/android/server/hdmi/HdmiCecLocalDevicePlaybackTest.java
+++ b/services/tests/servicestests/src/com/android/server/hdmi/HdmiCecLocalDevicePlaybackTest.java
@@ -47,6 +47,7 @@
     private TestLooper mTestLooper = new TestLooper();
     private ArrayList<HdmiCecLocalDevice> mLocalDevices = new ArrayList<>();
     private int mPlaybackPhysicalAddress;
+    private boolean mWokenUp;
 
     @Before
     public void setUp() {
@@ -54,6 +55,7 @@
             new HdmiControlService(InstrumentationRegistry.getTargetContext()) {
                 @Override
                 void wakeUp() {
+                    mWokenUp = true;
                 }
 
                 @Override
@@ -135,4 +137,18 @@
         assertThat(mHdmiCecLocalDevicePlayback.handleSystemAudioModeStatus(message)).isTrue();
         assertThat(mHdmiCecLocalDevicePlayback.mService.isSystemAudioActivated()).isTrue();
     }
+
+    @Test
+    public void doNotWakeUpOnHotPlug_PlugIn() {
+        mWokenUp = false;
+        mHdmiCecLocalDevicePlayback.onHotplug(0, true);
+        assertThat(mWokenUp).isFalse();
+    }
+
+    @Test
+    public void doNotWakeUpOnHotPlug_PlugOut() {
+        mWokenUp = false;
+        mHdmiCecLocalDevicePlayback.onHotplug(0, false);
+        assertThat(mWokenUp).isFalse();
+    }
 }
diff --git a/services/tests/servicestests/src/com/android/server/hdmi/HdmiControlServiceTest.java b/services/tests/servicestests/src/com/android/server/hdmi/HdmiControlServiceTest.java
index 9e98427..fa19814 100644
--- a/services/tests/servicestests/src/com/android/server/hdmi/HdmiControlServiceTest.java
+++ b/services/tests/servicestests/src/com/android/server/hdmi/HdmiControlServiceTest.java
@@ -34,6 +34,7 @@
 import android.hardware.hdmi.HdmiControlManager;
 import android.hardware.hdmi.HdmiPortInfo;
 import android.os.IPowerManager;
+import android.os.IThermalService;
 import android.os.Looper;
 import android.os.PowerManager;
 import android.os.RemoteException;
@@ -123,6 +124,7 @@
     private HdmiPortInfo[] mHdmiPortInfo;
 
     @Mock private IPowerManager mIPowerManagerMock;
+    @Mock private IThermalService mIThermalServiceMock;
 
     @Before
     public void setUp() throws Exception {
@@ -130,7 +132,8 @@
 
         mContextSpy = spy(new ContextWrapper(InstrumentationRegistry.getTargetContext()));
 
-        PowerManager powerManager = new PowerManager(mContextSpy, mIPowerManagerMock, null);
+        PowerManager powerManager = new PowerManager(mContextSpy, mIPowerManagerMock,
+                mIThermalServiceMock, null);
         when(mContextSpy.getSystemService(Context.POWER_SERVICE)).thenReturn(powerManager);
         when(mIPowerManagerMock.isInteractive()).thenReturn(true);
 
diff --git a/services/tests/servicestests/src/com/android/server/location/LocationRequestStatisticsTest.java b/services/tests/servicestests/src/com/android/server/location/LocationRequestStatisticsTest.java
index c45820e6..b6b8b82 100644
--- a/services/tests/servicestests/src/com/android/server/location/LocationRequestStatisticsTest.java
+++ b/services/tests/servicestests/src/com/android/server/location/LocationRequestStatisticsTest.java
@@ -1,17 +1,18 @@
 package com.android.server.location;
 
-import com.android.server.location.LocationRequestStatistics.PackageProviderKey;
-import com.android.server.location.LocationRequestStatistics.PackageStatistics;
-
 import android.os.SystemClock;
 import android.test.AndroidTestCase;
 
+import com.android.server.location.LocationRequestStatistics.PackageProviderKey;
+import com.android.server.location.LocationRequestStatistics.PackageStatistics;
+
 /**
  * Unit tests for {@link LocationRequestStatistics}.
  */
 public class LocationRequestStatisticsTest extends AndroidTestCase {
     private static final String PACKAGE1 = "package1";
     private static final String PACKAGE2 = "package2";
+    private static final String FEATURE_ID = "featureId";
     private static final String PROVIDER1 = "provider1";
     private static final String PROVIDER2 = "provider2";
     private static final long INTERVAL1 = 5000;
@@ -30,12 +31,13 @@
      * Tests that adding a single package works correctly.
      */
     public void testSinglePackage() {
-        mStatistics.startRequesting(PACKAGE1, PROVIDER1, INTERVAL1, true);
+        mStatistics.startRequesting(PACKAGE1, FEATURE_ID, PROVIDER1, INTERVAL1, true);
 
         assertEquals(1, mStatistics.statistics.size());
         PackageProviderKey key = mStatistics.statistics.keySet().iterator().next();
-        assertEquals(PACKAGE1, key.packageName);
-        assertEquals(PROVIDER1, key.providerName);
+        assertEquals(PACKAGE1, key.mPackageName);
+        assertEquals(PROVIDER1, key.mProviderName);
+        assertEquals(FEATURE_ID, key.mFeatureId);
         PackageStatistics stats = mStatistics.statistics.values().iterator().next();
         verifyStatisticsTimes(stats);
         assertEquals(INTERVAL1, stats.getFastestIntervalMs());
@@ -47,21 +49,22 @@
      * Tests that adding a single package works correctly when it is stopped and restarted.
      */
     public void testSinglePackage_stopAndRestart() {
-        mStatistics.startRequesting(PACKAGE1, PROVIDER1, INTERVAL1, true);
-        mStatistics.stopRequesting(PACKAGE1, PROVIDER1);
-        mStatistics.startRequesting(PACKAGE1, PROVIDER1, INTERVAL1, true);
+        mStatistics.startRequesting(PACKAGE1, FEATURE_ID, PROVIDER1, INTERVAL1, true);
+        mStatistics.stopRequesting(PACKAGE1, FEATURE_ID, PROVIDER1);
+        mStatistics.startRequesting(PACKAGE1, FEATURE_ID, PROVIDER1, INTERVAL1, true);
 
         assertEquals(1, mStatistics.statistics.size());
         PackageProviderKey key = mStatistics.statistics.keySet().iterator().next();
-        assertEquals(PACKAGE1, key.packageName);
-        assertEquals(PROVIDER1, key.providerName);
+        assertEquals(PACKAGE1, key.mPackageName);
+        assertEquals(FEATURE_ID, key.mFeatureId);
+        assertEquals(PROVIDER1, key.mProviderName);
         PackageStatistics stats = mStatistics.statistics.values().iterator().next();
         verifyStatisticsTimes(stats);
         assertEquals(INTERVAL1, stats.getFastestIntervalMs());
         assertEquals(INTERVAL1, stats.getSlowestIntervalMs());
         assertTrue(stats.isActive());
 
-        mStatistics.stopRequesting(PACKAGE1, PROVIDER1);
+        mStatistics.stopRequesting(PACKAGE1, FEATURE_ID, PROVIDER1);
         assertFalse(stats.isActive());
     }
 
@@ -69,21 +72,22 @@
      * Tests that adding a single package works correctly when multiple intervals are used.
      */
     public void testSinglePackage_multipleIntervals() {
-        mStatistics.startRequesting(PACKAGE1, PROVIDER1, INTERVAL1, true);
-        mStatistics.startRequesting(PACKAGE1, PROVIDER1, INTERVAL2, true);
+        mStatistics.startRequesting(PACKAGE1, FEATURE_ID, PROVIDER1, INTERVAL1, true);
+        mStatistics.startRequesting(PACKAGE1, FEATURE_ID, PROVIDER1, INTERVAL2, true);
 
         assertEquals(1, mStatistics.statistics.size());
         PackageProviderKey key = mStatistics.statistics.keySet().iterator().next();
-        assertEquals(PACKAGE1, key.packageName);
-        assertEquals(PROVIDER1, key.providerName);
+        assertEquals(PACKAGE1, key.mPackageName);
+        assertEquals(PROVIDER1, key.mProviderName);
+        assertEquals(FEATURE_ID, key.mFeatureId);
         PackageStatistics stats = mStatistics.statistics.values().iterator().next();
         verifyStatisticsTimes(stats);
         assertEquals(INTERVAL1, stats.getFastestIntervalMs());
         assertTrue(stats.isActive());
 
-        mStatistics.stopRequesting(PACKAGE1, PROVIDER1);
+        mStatistics.stopRequesting(PACKAGE1, FEATURE_ID, PROVIDER1);
         assertTrue(stats.isActive());
-        mStatistics.stopRequesting(PACKAGE1, PROVIDER1);
+        mStatistics.stopRequesting(PACKAGE1, FEATURE_ID, PROVIDER1);
         assertFalse(stats.isActive());
     }
 
@@ -91,27 +95,27 @@
      * Tests that adding a single package works correctly when multiple providers are used.
      */
     public void testSinglePackage_multipleProviders() {
-        mStatistics.startRequesting(PACKAGE1, PROVIDER1, INTERVAL1, true);
-        mStatistics.startRequesting(PACKAGE1, PROVIDER2, INTERVAL2, true);
+        mStatistics.startRequesting(PACKAGE1, FEATURE_ID, PROVIDER1, INTERVAL1, true);
+        mStatistics.startRequesting(PACKAGE1, FEATURE_ID, PROVIDER2, INTERVAL2, true);
 
         assertEquals(2, mStatistics.statistics.size());
-        PackageProviderKey key1 = new PackageProviderKey(PACKAGE1, PROVIDER1);
+        PackageProviderKey key1 = new PackageProviderKey(PACKAGE1, FEATURE_ID, PROVIDER1);
         PackageStatistics stats1 = mStatistics.statistics.get(key1);
         verifyStatisticsTimes(stats1);
         assertEquals(INTERVAL1, stats1.getSlowestIntervalMs());
         assertEquals(INTERVAL1, stats1.getFastestIntervalMs());
         assertTrue(stats1.isActive());
-        PackageProviderKey key2 = new PackageProviderKey(PACKAGE1, PROVIDER2);
+        PackageProviderKey key2 = new PackageProviderKey(PACKAGE1, FEATURE_ID, PROVIDER2);
         PackageStatistics stats2 = mStatistics.statistics.get(key2);
         verifyStatisticsTimes(stats2);
         assertEquals(INTERVAL2, stats2.getSlowestIntervalMs());
         assertEquals(INTERVAL2, stats2.getFastestIntervalMs());
         assertTrue(stats2.isActive());
 
-        mStatistics.stopRequesting(PACKAGE1, PROVIDER1);
+        mStatistics.stopRequesting(PACKAGE1, FEATURE_ID, PROVIDER1);
         assertFalse(stats1.isActive());
         assertTrue(stats2.isActive());
-        mStatistics.stopRequesting(PACKAGE1, PROVIDER2);
+        mStatistics.stopRequesting(PACKAGE1, FEATURE_ID, PROVIDER2);
         assertFalse(stats1.isActive());
         assertFalse(stats2.isActive());
     }
@@ -120,46 +124,46 @@
      * Tests that adding multiple packages works correctly.
      */
     public void testMultiplePackages() {
-        mStatistics.startRequesting(PACKAGE1, PROVIDER1, INTERVAL1, true);
-        mStatistics.startRequesting(PACKAGE1, PROVIDER2, INTERVAL1, true);
-        mStatistics.startRequesting(PACKAGE1, PROVIDER2, INTERVAL2, true);
-        mStatistics.startRequesting(PACKAGE2, PROVIDER1, INTERVAL1, true);
+        mStatistics.startRequesting(PACKAGE1, FEATURE_ID, PROVIDER1, INTERVAL1, true);
+        mStatistics.startRequesting(PACKAGE1, FEATURE_ID, PROVIDER2, INTERVAL1, true);
+        mStatistics.startRequesting(PACKAGE1, FEATURE_ID, PROVIDER2, INTERVAL2, true);
+        mStatistics.startRequesting(PACKAGE2, FEATURE_ID, PROVIDER1, INTERVAL1, true);
 
         assertEquals(3, mStatistics.statistics.size());
-        PackageProviderKey key1 = new PackageProviderKey(PACKAGE1, PROVIDER1);
+        PackageProviderKey key1 = new PackageProviderKey(PACKAGE1, FEATURE_ID, PROVIDER1);
         PackageStatistics stats1 = mStatistics.statistics.get(key1);
         verifyStatisticsTimes(stats1);
         assertEquals(INTERVAL1, stats1.getSlowestIntervalMs());
         assertEquals(INTERVAL1, stats1.getFastestIntervalMs());
         assertTrue(stats1.isActive());
 
-        PackageProviderKey key2 = new PackageProviderKey(PACKAGE1, PROVIDER2);
+        PackageProviderKey key2 = new PackageProviderKey(PACKAGE1, FEATURE_ID, PROVIDER2);
         PackageStatistics stats2 = mStatistics.statistics.get(key2);
         verifyStatisticsTimes(stats2);
         assertEquals(INTERVAL2, stats2.getSlowestIntervalMs());
         assertEquals(INTERVAL1, stats2.getFastestIntervalMs());
         assertTrue(stats2.isActive());
 
-        PackageProviderKey key3 = new PackageProviderKey(PACKAGE2, PROVIDER1);
+        PackageProviderKey key3 = new PackageProviderKey(PACKAGE2, FEATURE_ID, PROVIDER1);
         PackageStatistics stats3 = mStatistics.statistics.get(key3);
         verifyStatisticsTimes(stats3);
         assertEquals(INTERVAL1, stats3.getSlowestIntervalMs());
         assertEquals(INTERVAL1, stats3.getFastestIntervalMs());
         assertTrue(stats3.isActive());
 
-        mStatistics.stopRequesting(PACKAGE1, PROVIDER1);
+        mStatistics.stopRequesting(PACKAGE1, FEATURE_ID, PROVIDER1);
         assertFalse(stats1.isActive());
         assertTrue(stats2.isActive());
         assertTrue(stats3.isActive());
 
-        mStatistics.stopRequesting(PACKAGE1, PROVIDER2);
+        mStatistics.stopRequesting(PACKAGE1, FEATURE_ID, PROVIDER2);
         assertFalse(stats1.isActive());
         assertTrue(stats2.isActive());
         assertTrue(stats3.isActive());
-        mStatistics.stopRequesting(PACKAGE1, PROVIDER2);
+        mStatistics.stopRequesting(PACKAGE1, FEATURE_ID, PROVIDER2);
         assertFalse(stats2.isActive());
 
-        mStatistics.stopRequesting(PACKAGE2, PROVIDER1);
+        mStatistics.stopRequesting(PACKAGE2, FEATURE_ID, PROVIDER1);
         assertFalse(stats1.isActive());
         assertFalse(stats2.isActive());
         assertFalse(stats3.isActive());
@@ -169,14 +173,14 @@
      * Tests that switching foreground & background states accmulates time reasonably.
      */
     public void testForegroundBackground() {
-        mStatistics.startRequesting(PACKAGE1, PROVIDER1, INTERVAL1, true);
-        mStatistics.startRequesting(PACKAGE1, PROVIDER2, INTERVAL1, true);
-        mStatistics.startRequesting(PACKAGE2, PROVIDER1, INTERVAL1, false);
+        mStatistics.startRequesting(PACKAGE1, FEATURE_ID, PROVIDER1, INTERVAL1, true);
+        mStatistics.startRequesting(PACKAGE1, FEATURE_ID, PROVIDER2, INTERVAL1, true);
+        mStatistics.startRequesting(PACKAGE2, FEATURE_ID, PROVIDER1, INTERVAL1, false);
 
-        mStatistics.updateForeground(PACKAGE1, PROVIDER2, false);
-        mStatistics.updateForeground(PACKAGE2, PROVIDER1, true);
+        mStatistics.updateForeground(PACKAGE1, FEATURE_ID, PROVIDER2, false);
+        mStatistics.updateForeground(PACKAGE2, FEATURE_ID, PROVIDER1, true);
 
-        mStatistics.stopRequesting(PACKAGE1, PROVIDER1);
+        mStatistics.stopRequesting(PACKAGE1, FEATURE_ID, PROVIDER1);
 
         for (PackageStatistics stats : mStatistics.statistics.values()) {
             verifyStatisticsTimes(stats);
diff --git a/services/tests/servicestests/src/com/android/server/location/gnss/GnssManagerServiceTest.java b/services/tests/servicestests/src/com/android/server/location/gnss/GnssManagerServiceTest.java
index 4d0ad96..a99c982 100644
--- a/services/tests/servicestests/src/com/android/server/location/gnss/GnssManagerServiceTest.java
+++ b/services/tests/servicestests/src/com/android/server/location/gnss/GnssManagerServiceTest.java
@@ -16,6 +16,8 @@
 
 package com.android.server.location.gnss;
 
+import static android.location.LocationManager.GPS_PROVIDER;
+
 import static com.google.common.truth.Truth.assertThat;
 
 import static org.mockito.ArgumentMatchers.any;
@@ -36,6 +38,7 @@
 import android.content.Context;
 import android.content.pm.PackageManager;
 import android.location.GnssAntennaInfo;
+import android.location.GnssAntennaInfo.SphericalCorrections;
 import android.location.GnssClock;
 import android.location.GnssMeasurementCorrections;
 import android.location.GnssMeasurementsEvent;
@@ -243,8 +246,8 @@
     private static List<GnssAntennaInfo> createDummyGnssAntennaInfos() {
         double carrierFrequencyMHz = 13758.0;
 
-        GnssAntennaInfo.PhaseCenterOffsetCoordinates phaseCenterOffsetCoordinates = new
-                GnssAntennaInfo.PhaseCenterOffsetCoordinates(
+        GnssAntennaInfo.PhaseCenterOffset phaseCenterOffset = new
+                GnssAntennaInfo.PhaseCenterOffset(
                 4.3d,
                 1.4d,
                 2.10d,
@@ -254,22 +257,26 @@
 
         double[][] phaseCenterVariationCorrectionsMillimeters = new double[10][10];
         double[][] phaseCenterVariationCorrectionsUncertaintyMillimeters = new double[10][10];
-        GnssAntennaInfo.PhaseCenterVariationCorrections
+        SphericalCorrections
                 phaseCenterVariationCorrections =
-                new GnssAntennaInfo.PhaseCenterVariationCorrections(
+                new SphericalCorrections(
                         phaseCenterVariationCorrectionsMillimeters,
                         phaseCenterVariationCorrectionsUncertaintyMillimeters);
 
         double[][] signalGainCorrectionsDbi = new double[10][10];
         double[][] signalGainCorrectionsUncertaintyDbi = new double[10][10];
-        GnssAntennaInfo.SignalGainCorrections signalGainCorrections = new
-                GnssAntennaInfo.SignalGainCorrections(
+        SphericalCorrections signalGainCorrections = new
+                SphericalCorrections(
                 signalGainCorrectionsDbi,
                 signalGainCorrectionsUncertaintyDbi);
 
         List<GnssAntennaInfo> gnssAntennaInfos = new ArrayList();
-        gnssAntennaInfos.add(new GnssAntennaInfo(carrierFrequencyMHz, phaseCenterOffsetCoordinates,
-                phaseCenterVariationCorrections, signalGainCorrections));
+        gnssAntennaInfos.add(new GnssAntennaInfo.Builder()
+                .setCarrierFrequencyMHz(carrierFrequencyMHz)
+                .setPhaseCenterOffset(phaseCenterOffset)
+                .setPhaseCenterVariationCorrections(phaseCenterVariationCorrections)
+                .setSignalGainCorrections(signalGainCorrections)
+                .build());
         return gnssAntennaInfos;
     }
 
@@ -293,6 +300,9 @@
                     }
                     return AppOpsManager.MODE_ERRORED;
                 });
+
+        when(mLocationManagerInternal.isProviderEnabledForUser(eq(GPS_PROVIDER), anyInt()))
+                .thenReturn(true);
     }
 
     private void disableLocationPermissions() {
@@ -303,6 +313,9 @@
 
         when(mAppOpsManager.checkOp(anyInt(), anyInt(),
                 anyString())).thenReturn(AppOpsManager.MODE_ERRORED);
+
+        when(mLocationManagerInternal.isProviderEnabledForUser(eq(GPS_PROVIDER), anyInt()))
+                .thenReturn(false);
     }
 
     private GnssStatusListenerHelper createGnssStatusListenerHelper(Context context,
@@ -380,14 +393,6 @@
     }
 
     @Test
-    public void getGnssCapabilitiesWithoutPermissionsTest() {
-        disableLocationPermissions();
-
-        assertThrows(SecurityException.class,
-                () -> mGnssManagerService.getGnssCapabilities("com.android.server"));
-    }
-
-    @Test
     public void getGnssCapabilitiesWithPermissionsTest() {
         final long mGnssCapabilities = 23132L;
         when(mMockGnssCapabilitiesProvider.getGnssCapabilities()).thenReturn(mGnssCapabilities);
@@ -527,6 +532,7 @@
         assertThrows(SecurityException.class,
                 () -> mGnssManagerService.removeGnssBatchingCallback());
 
+        enableLocationPermissions();
         mGnssManagerService.onReportLocation(mockLocationList);
 
         verify(mockBatchedLocationCallback, times(1)).onLocationBatch(mockLocationList);
diff --git a/services/tests/servicestests/src/com/android/server/om/OverlayManagerServiceImplRebootTests.java b/services/tests/servicestests/src/com/android/server/om/OverlayManagerServiceImplRebootTests.java
new file mode 100644
index 0000000..c4fea77
--- /dev/null
+++ b/services/tests/servicestests/src/com/android/server/om/OverlayManagerServiceImplRebootTests.java
@@ -0,0 +1,188 @@
+/*
+ * 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.server.om;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import android.content.om.OverlayInfo;
+
+import androidx.test.runner.AndroidJUnit4;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import java.util.Arrays;
+import java.util.List;
+
+@RunWith(AndroidJUnit4.class)
+public class OverlayManagerServiceImplRebootTests extends OverlayManagerServiceImplTestsBase {
+
+    private static final String OVERLAY = "com.dummy.overlay";
+    private static final String TARGET = "com.dummy.target";
+    private static final int USER = 0;
+
+    private static final String OVERLAY2 = OVERLAY + "2";
+
+    @Test
+    public void testUpdateOverlaysForUser() {
+        final OverlayManagerServiceImpl impl = getImpl();
+        installTargetPackage(TARGET, USER);
+        installTargetPackage("some.other.target", USER);
+        installOverlayPackage(OVERLAY, TARGET, USER);
+
+        // do nothing, expect no change
+        final List<String> a = impl.updateOverlaysForUser(USER);
+        assertEquals(1, a.size());
+        assertTrue(a.contains(TARGET));
+
+        // upgrade overlay, keep target
+        beginUpgradeOverlayPackage(OVERLAY, USER);
+        endUpgradeOverlayPackage(OVERLAY, TARGET, USER);
+
+        final List<String> b = impl.updateOverlaysForUser(USER);
+        assertEquals(1, b.size());
+        assertTrue(b.contains(TARGET));
+
+        // do nothing, expect no change
+        final List<String> c = impl.updateOverlaysForUser(USER);
+        assertEquals(1, c.size());
+        assertTrue(c.contains(TARGET));
+
+        // upgrade overlay, switch to new target
+        addOverlayPackage(OVERLAY, "some.other.target", USER, true, false, 0);
+        final List<String> d = impl.updateOverlaysForUser(USER);
+        assertEquals(2, d.size());
+        assertTrue(d.containsAll(Arrays.asList(TARGET, "some.other.target")));
+
+        // do nothing, expect no change
+        final List<String> f = impl.updateOverlaysForUser(USER);
+        assertEquals(1, f.size());
+        assertTrue(f.contains("some.other.target"));
+    }
+
+    @Test
+    public void testImmutableEnabledChange() {
+        final OverlayManagerServiceImpl impl = getImpl();
+        installTargetPackage(TARGET, USER);
+
+        addOverlayPackage(OVERLAY, TARGET, USER, false, false, 0);
+        impl.updateOverlaysForUser(USER);
+        final OverlayInfo o1 = impl.getOverlayInfo(OVERLAY, USER);
+        assertNotNull(o1);
+        assertFalse(o1.isEnabled());
+        assertFalse(o1.isMutable);
+
+        addOverlayPackage(OVERLAY, TARGET, USER, false, true, 0);
+        impl.updateOverlaysForUser(USER);
+        final OverlayInfo o2 = impl.getOverlayInfo(OVERLAY, USER);
+        assertNotNull(o2);
+        assertTrue(o2.isEnabled());
+        assertFalse(o2.isMutable);
+
+        addOverlayPackage(OVERLAY, TARGET, USER, false, false, 0);
+        impl.updateOverlaysForUser(USER);
+        final OverlayInfo o3 = impl.getOverlayInfo(OVERLAY, USER);
+        assertNotNull(o3);
+        assertFalse(o3.isEnabled());
+        assertFalse(o3.isMutable);
+    }
+
+    @Test
+    public void testMutableEnabledChangeHasNoEffect() {
+        final OverlayManagerServiceImpl impl = getImpl();
+        installTargetPackage(TARGET, USER);
+
+        addOverlayPackage(OVERLAY, TARGET, USER, true, false, 0);
+        impl.updateOverlaysForUser(USER);
+        final OverlayInfo o1 = impl.getOverlayInfo(OVERLAY, USER);
+        assertNotNull(o1);
+        assertFalse(o1.isEnabled());
+        assertTrue(o1.isMutable);
+
+        addOverlayPackage(OVERLAY, TARGET, USER, true, true, 0);
+        impl.updateOverlaysForUser(USER);
+        final OverlayInfo o2 = impl.getOverlayInfo(OVERLAY, USER);
+        assertNotNull(o2);
+        assertFalse(o2.isEnabled());
+        assertTrue(o2.isMutable);
+
+        addOverlayPackage(OVERLAY, TARGET, USER, true, false, 0);
+        impl.updateOverlaysForUser(USER);
+        final OverlayInfo o3 = impl.getOverlayInfo(OVERLAY, USER);
+        assertNotNull(o3);
+        assertFalse(o3.isEnabled());
+        assertTrue(o3.isMutable);
+    }
+
+    @Test
+    public void testMutabilityChange() {
+        final OverlayManagerServiceImpl impl = getImpl();
+        installTargetPackage(TARGET, USER);
+
+        addOverlayPackage(OVERLAY, TARGET, USER, false, true, 0);
+        impl.updateOverlaysForUser(USER);
+        final OverlayInfo o1 = impl.getOverlayInfo(OVERLAY, USER);
+        assertNotNull(o1);
+        assertTrue(o1.isEnabled());
+        assertFalse(o1.isMutable);
+
+        addOverlayPackage(OVERLAY, TARGET, USER, true, false, 0);
+        impl.updateOverlaysForUser(USER);
+        final OverlayInfo o2 = impl.getOverlayInfo(OVERLAY, USER);
+        assertNotNull(o2);
+        assertFalse(o2.isEnabled());
+        assertTrue(o2.isMutable);
+
+        addOverlayPackage(OVERLAY, TARGET, USER, false, false, 0);
+        impl.updateOverlaysForUser(USER);
+        final OverlayInfo o3 = impl.getOverlayInfo(OVERLAY, USER);
+        assertNotNull(o3);
+        assertFalse(o3.isEnabled());
+        assertFalse(o3.isMutable);
+    }
+
+    @Test
+    public void testPriorityChange() {
+        final OverlayManagerServiceImpl impl = getImpl();
+        installTargetPackage(TARGET, USER);
+
+        addOverlayPackage(OVERLAY, TARGET, USER, false, true, 0);
+        addOverlayPackage(OVERLAY2, TARGET, USER, false, true, 1);
+        impl.updateOverlaysForUser(USER);
+
+        final OverlayInfo o1 = impl.getOverlayInfo(OVERLAY, USER);
+        final OverlayInfo o2 = impl.getOverlayInfo(OVERLAY2, USER);
+        assertNotNull(o1);
+        assertNotNull(o2);
+        assertEquals(0, o1.priority);
+        assertEquals(1, o2.priority);
+
+        addOverlayPackage(OVERLAY, TARGET, USER, false, true, 1);
+        addOverlayPackage(OVERLAY2, TARGET, USER, false, true, 0);
+        impl.updateOverlaysForUser(USER);
+
+        final OverlayInfo o3 = impl.getOverlayInfo(OVERLAY, USER);
+        final OverlayInfo o4 = impl.getOverlayInfo(OVERLAY2, USER);
+        assertNotNull(o3);
+        assertNotNull(o4);
+        assertEquals(1, o3.priority);
+        assertEquals(0, o4.priority);
+    }
+}
diff --git a/services/tests/servicestests/src/com/android/server/om/OverlayManagerServiceImplTests.java b/services/tests/servicestests/src/com/android/server/om/OverlayManagerServiceImplTests.java
index c566dfc..a428a97 100644
--- a/services/tests/servicestests/src/com/android/server/om/OverlayManagerServiceImplTests.java
+++ b/services/tests/servicestests/src/com/android/server/om/OverlayManagerServiceImplTests.java
@@ -24,6 +24,9 @@
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
 
 import android.annotation.NonNull;
 import android.content.om.OverlayInfo;
@@ -33,6 +36,8 @@
 
 import androidx.test.runner.AndroidJUnit4;
 
+import com.android.internal.content.om.OverlayConfig;
+
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -45,10 +50,7 @@
 import java.util.Set;
 
 @RunWith(AndroidJUnit4.class)
-public class OverlayManagerServiceImplTests {
-    private OverlayManagerServiceImpl mImpl;
-    private DummyDeviceState mState;
-    private DummyListener mListener;
+public class OverlayManagerServiceImplTests extends OverlayManagerServiceImplTestsBase {
 
     private static final String OVERLAY = "com.dummy.overlay";
     private static final String TARGET = "com.dummy.target";
@@ -61,25 +63,14 @@
     private static final String OVERLAY3 = OVERLAY + "3";
     private static final int USER3 = USER2 + 1;
 
-
-    @Before
-    public void setUp() throws Exception {
-        mState = new DummyDeviceState();
-        mListener = new DummyListener();
-        DummyPackageManagerHelper pmh = new DummyPackageManagerHelper(mState);
-        mImpl = new OverlayManagerServiceImpl(pmh,
-                new DummyIdmapManager(mState, pmh),
-                new OverlayManagerSettings(),
-                new String[0],
-                mListener);
-    }
-
     // tests: basics
 
     @Test
     public void testGetOverlayInfo() throws Exception {
-        installOverlayPackage(OVERLAY, TARGET, USER, false);
-        final OverlayInfo oi = mImpl.getOverlayInfo(OVERLAY, USER);
+        installOverlayPackage(OVERLAY, TARGET, USER);
+
+        final OverlayManagerServiceImpl impl = getImpl();
+        final OverlayInfo oi = impl.getOverlayInfo(OVERLAY, USER);
         assertNotNull(oi);
         assertEquals(oi.packageName, OVERLAY);
         assertEquals(oi.targetPackageName, TARGET);
@@ -88,87 +79,91 @@
 
     @Test
     public void testGetOverlayInfosForTarget() throws Exception {
-        installOverlayPackage(OVERLAY, TARGET, USER, false);
-        installOverlayPackage(OVERLAY2, TARGET, USER, false);
+        installOverlayPackage(OVERLAY, TARGET, USER);
+        installOverlayPackage(OVERLAY2, TARGET, USER);
+        installOverlayPackage(OVERLAY3, TARGET, USER2);
 
-        installOverlayPackage(OVERLAY3, TARGET, USER2, false);
-
-        final List<OverlayInfo> ois = mImpl.getOverlayInfosForTarget(TARGET, USER);
+        final OverlayManagerServiceImpl impl = getImpl();
+        final List<OverlayInfo> ois = impl.getOverlayInfosForTarget(TARGET, USER);
         assertEquals(ois.size(), 2);
-        assertTrue(ois.contains(mImpl.getOverlayInfo(OVERLAY, USER)));
-        assertTrue(ois.contains(mImpl.getOverlayInfo(OVERLAY2, USER)));
+        assertTrue(ois.contains(impl.getOverlayInfo(OVERLAY, USER)));
+        assertTrue(ois.contains(impl.getOverlayInfo(OVERLAY2, USER)));
 
-        final List<OverlayInfo> ois2 = mImpl.getOverlayInfosForTarget(TARGET, USER2);
+        final List<OverlayInfo> ois2 = impl.getOverlayInfosForTarget(TARGET, USER2);
         assertEquals(ois2.size(), 1);
-        assertTrue(ois2.contains(mImpl.getOverlayInfo(OVERLAY3, USER2)));
+        assertTrue(ois2.contains(impl.getOverlayInfo(OVERLAY3, USER2)));
 
-        final List<OverlayInfo> ois3 = mImpl.getOverlayInfosForTarget(TARGET, USER3);
+        final List<OverlayInfo> ois3 = impl.getOverlayInfosForTarget(TARGET, USER3);
         assertNotNull(ois3);
         assertEquals(ois3.size(), 0);
 
-        final List<OverlayInfo> ois4 = mImpl.getOverlayInfosForTarget("no.such.overlay", USER);
+        final List<OverlayInfo> ois4 = impl.getOverlayInfosForTarget("no.such.overlay", USER);
         assertNotNull(ois4);
         assertEquals(ois4.size(), 0);
     }
 
     @Test
     public void testGetOverlayInfosForUser() throws Exception {
-        installOverlayPackage(OVERLAY, TARGET, USER, false);
-        installOverlayPackage(OVERLAY2, TARGET, USER, false);
-        installOverlayPackage(OVERLAY3, TARGET2, USER, false);
+        installTargetPackage(TARGET, USER);
+        installOverlayPackage(OVERLAY, TARGET, USER);
+        installOverlayPackage(OVERLAY2, TARGET, USER);
+        installOverlayPackage(OVERLAY3, TARGET2, USER);
 
-        final Map<String, List<OverlayInfo>> everything = mImpl.getOverlaysForUser(USER);
+        final OverlayManagerServiceImpl impl = getImpl();
+        final Map<String, List<OverlayInfo>> everything = impl.getOverlaysForUser(USER);
         assertEquals(everything.size(), 2);
 
         final List<OverlayInfo> ois = everything.get(TARGET);
         assertNotNull(ois);
         assertEquals(ois.size(), 2);
-        assertTrue(ois.contains(mImpl.getOverlayInfo(OVERLAY, USER)));
-        assertTrue(ois.contains(mImpl.getOverlayInfo(OVERLAY2, USER)));
+        assertTrue(ois.contains(impl.getOverlayInfo(OVERLAY, USER)));
+        assertTrue(ois.contains(impl.getOverlayInfo(OVERLAY2, USER)));
 
         final List<OverlayInfo> ois2 = everything.get(TARGET2);
         assertNotNull(ois2);
         assertEquals(ois2.size(), 1);
-        assertTrue(ois2.contains(mImpl.getOverlayInfo(OVERLAY3, USER)));
+        assertTrue(ois2.contains(impl.getOverlayInfo(OVERLAY3, USER)));
 
-        final Map<String, List<OverlayInfo>> everything2 = mImpl.getOverlaysForUser(USER2);
+        final Map<String, List<OverlayInfo>> everything2 = impl.getOverlaysForUser(USER2);
         assertNotNull(everything2);
         assertEquals(everything2.size(), 0);
     }
 
     @Test
     public void testPriority() throws Exception {
-        installOverlayPackage(OVERLAY, TARGET, USER, false);
-        installOverlayPackage(OVERLAY2, TARGET, USER, false);
-        installOverlayPackage(OVERLAY3, TARGET, USER, false);
+        installOverlayPackage(OVERLAY, TARGET, USER);
+        installOverlayPackage(OVERLAY2, TARGET, USER);
+        installOverlayPackage(OVERLAY3, TARGET, USER);
 
-        final OverlayInfo o1 = mImpl.getOverlayInfo(OVERLAY, USER);
-        final OverlayInfo o2 = mImpl.getOverlayInfo(OVERLAY2, USER);
-        final OverlayInfo o3 = mImpl.getOverlayInfo(OVERLAY3, USER);
+        final OverlayManagerServiceImpl impl = getImpl();
+        final OverlayInfo o1 = impl.getOverlayInfo(OVERLAY, USER);
+        final OverlayInfo o2 = impl.getOverlayInfo(OVERLAY2, USER);
+        final OverlayInfo o3 = impl.getOverlayInfo(OVERLAY3, USER);
 
         assertOverlayInfoList(TARGET, USER, o1, o2, o3);
 
-        assertTrue(mImpl.setLowestPriority(OVERLAY3, USER));
+        assertTrue(impl.setLowestPriority(OVERLAY3, USER));
         assertOverlayInfoList(TARGET, USER, o3, o1, o2);
 
-        assertTrue(mImpl.setHighestPriority(OVERLAY3, USER));
+        assertTrue(impl.setHighestPriority(OVERLAY3, USER));
         assertOverlayInfoList(TARGET, USER, o1, o2, o3);
 
-        assertTrue(mImpl.setPriority(OVERLAY, OVERLAY2, USER));
+        assertTrue(impl.setPriority(OVERLAY, OVERLAY2, USER));
         assertOverlayInfoList(TARGET, USER, o2, o1, o3);
     }
 
     @Test
     public void testOverlayInfoStateTransitions() throws Exception {
-        assertNull(mImpl.getOverlayInfo(OVERLAY, USER));
+        final OverlayManagerServiceImpl impl = getImpl();
+        assertNull(impl.getOverlayInfo(OVERLAY, USER));
 
-        installOverlayPackage(OVERLAY, TARGET, USER, true);
+        installOverlayPackage(OVERLAY, TARGET, USER);
         assertState(STATE_MISSING_TARGET, OVERLAY, USER);
 
         installTargetPackage(TARGET, USER);
         assertState(STATE_DISABLED, OVERLAY, USER);
 
-        mImpl.setEnabled(OVERLAY, true, USER);
+        impl.setEnabled(OVERLAY, true, USER);
         assertState(STATE_ENABLED, OVERLAY, USER);
 
         // target upgrades do not change the state of the overlay
@@ -186,319 +181,48 @@
     }
 
     @Test
-    public void testUpdateOverlaysForUser() throws Exception {
-        installTargetPackage(TARGET, USER);
-        installTargetPackage("some.other.target", USER);
-        installOverlayPackage(OVERLAY, TARGET, USER, true);
-
-        // do nothing, expect no change
-        List<String> a = mImpl.updateOverlaysForUser(USER);
-        assertEquals(1, a.size());
-        assertTrue(a.contains(TARGET));
-
-        // upgrade overlay, keep target
-        upgradeOverlayPackage(OVERLAY, TARGET, USER, true);
-        List<String> b = mImpl.updateOverlaysForUser(USER);
-        assertEquals(1, b.size());
-        assertTrue(b.contains(TARGET));
-
-        // do nothing, expect no change
-        List<String> c = mImpl.updateOverlaysForUser(USER);
-        assertEquals(1, c.size());
-        assertTrue(c.contains(TARGET));
-
-        // upgrade overlay, switch to new target
-        upgradeOverlayPackage(OVERLAY, "some.other.target", USER, true);
-        List<String> d = mImpl.updateOverlaysForUser(USER);
-        assertEquals(2, d.size());
-        assertTrue(d.containsAll(Arrays.asList(TARGET, "some.other.target")));
-
-        // do nothing, expect no change
-        List<String> e = mImpl.updateOverlaysForUser(USER);
-        assertEquals(1, e.size());
-        assertTrue(e.contains("some.other.target"));
-    }
-
-    @Test
     public void testOnOverlayPackageUpgraded() throws Exception {
+        final OverlayManagerServiceImpl impl = getImpl();
+        final DummyListener listener = getListener();
         installTargetPackage(TARGET, USER);
-        installOverlayPackage(OVERLAY, TARGET, USER, true);
-        mImpl.onOverlayPackageReplacing(OVERLAY, USER);
-        mListener.count = 0;
-        mImpl.onOverlayPackageReplaced(OVERLAY, USER);
-        assertEquals(1, mListener.count);
+        installOverlayPackage(OVERLAY, TARGET, USER);
+        impl.onOverlayPackageReplacing(OVERLAY, USER);
+        listener.count = 0;
+        impl.onOverlayPackageReplaced(OVERLAY, USER);
+        assertEquals(1, listener.count);
 
         // upgrade to a version where the overlay has changed its target
-        upgradeOverlayPackage(OVERLAY, "some.other.target", USER, true);
-        mImpl.onOverlayPackageReplacing(OVERLAY, USER);
-        mListener.count = 0;
-        mImpl.onOverlayPackageReplaced(OVERLAY, USER);
+        beginUpgradeOverlayPackage(OVERLAY, USER);
+        listener.count = 0;
+        endUpgradeOverlayPackage(OVERLAY, "some.other.target", USER);
         // expect once for the old target package, once for the new target package
-        assertEquals(2, mListener.count);
+        assertEquals(2, listener.count);
 
-        upgradeOverlayPackage(OVERLAY, "some.other.target", USER, true);
-        mImpl.onOverlayPackageReplacing(OVERLAY, USER);
-        mListener.count = 0;
-        mImpl.onOverlayPackageReplaced(OVERLAY, USER);
-        assertEquals(1, mListener.count);
+        beginUpgradeOverlayPackage(OVERLAY, USER);
+        listener.count = 0;
+        endUpgradeOverlayPackage(OVERLAY, "some.other.target", USER);
+        assertEquals(1, listener.count);
     }
 
     // tests: listener interface
 
     @Test
     public void testListener() throws Exception {
-        installOverlayPackage(OVERLAY, TARGET, USER, true);
-        assertEquals(1, mListener.count);
-        mListener.count = 0;
+        final OverlayManagerServiceImpl impl = getImpl();
+        final DummyListener listener = getListener();
+        installOverlayPackage(OVERLAY, TARGET, USER);
+        assertEquals(1, listener.count);
+        listener.count = 0;
 
         installTargetPackage(TARGET, USER);
-        assertEquals(1, mListener.count);
-        mListener.count = 0;
+        assertEquals(1, listener.count);
+        listener.count = 0;
 
-        mImpl.setEnabled(OVERLAY, true, USER);
-        assertEquals(1, mListener.count);
-        mListener.count = 0;
+        impl.setEnabled(OVERLAY, true, USER);
+        assertEquals(1, listener.count);
+        listener.count = 0;
 
-        mImpl.setEnabled(OVERLAY, true, USER);
-        assertEquals(0, mListener.count);
-    }
-
-    // helper methods
-
-    private void assertState(int expected, final String overlayPackageName, int userId) {
-        int actual = mImpl.getOverlayInfo(OVERLAY, USER).state;
-        String msg = String.format("expected %s but was %s:",
-                OverlayInfo.stateToString(expected), OverlayInfo.stateToString(actual));
-        assertEquals(msg, expected, actual);
-    }
-
-    private void assertOverlayInfoList(final String targetPackageName, int userId,
-            OverlayInfo... overlayInfos) {
-        final List<OverlayInfo> expected =
-                mImpl.getOverlayInfosForTarget(targetPackageName, userId);
-        final List<OverlayInfo> actual = Arrays.asList(overlayInfos);
-        assertEquals(expected, actual);
-    }
-
-    private void installTargetPackage(String packageName, int userId) {
-        if (mState.select(packageName, userId) != null) {
-            throw new IllegalStateException("package already installed");
-        }
-        mState.add(packageName, null, userId, false);
-        mImpl.onTargetPackageAdded(packageName, userId);
-    }
-
-    private void beginUpgradeTargetPackage(String packageName, int userId) {
-        if (mState.select(packageName, userId) == null) {
-            throw new IllegalStateException("package not installed");
-        }
-        mState.add(packageName, null, userId, false);
-        mImpl.onTargetPackageReplacing(packageName, userId);
-    }
-
-    private void endUpgradeTargetPackage(String packageName, int userId) {
-        if (mState.select(packageName, userId) == null) {
-            throw new IllegalStateException("package not installed");
-        }
-        mState.add(packageName, null, userId, false);
-        mImpl.onTargetPackageReplaced(packageName, userId);
-    }
-
-    private void uninstallTargetPackage(String packageName, int userId) {
-        if (mState.select(packageName, userId) == null) {
-            throw new IllegalStateException("package not installed");
-        }
-        mState.remove(packageName, userId);
-        mImpl.onTargetPackageRemoved(packageName, userId);
-    }
-
-    private void installOverlayPackage(String packageName, String targetPackageName, int userId,
-            boolean canCreateIdmap) {
-        if (mState.select(packageName, userId) != null) {
-            throw new IllegalStateException("package already installed");
-        }
-        mState.add(packageName, targetPackageName, userId, canCreateIdmap);
-        mImpl.onOverlayPackageAdded(packageName, userId);
-    }
-
-    private void upgradeOverlayPackage(String packageName, String targetPackageName, int userId,
-            boolean canCreateIdmap) {
-        DummyDeviceState.Package pkg = mState.select(packageName, userId);
-        if (pkg == null) {
-            throw new IllegalStateException("package not installed, cannot upgrade");
-        }
-        pkg.targetPackageName = targetPackageName;
-        pkg.canCreateIdmap = canCreateIdmap;
-    }
-
-    private void uninstallOverlayPackage(String packageName, int userId) {
-        // implement this when adding support for downloadable overlays
-        throw new IllegalArgumentException("not implemented");
-    }
-
-    private static final class DummyDeviceState {
-        private List<Package> mPackages = new ArrayList<>();
-
-        public void add(String packageName, String targetPackageName, int userId,
-                boolean canCreateIdmap) {
-            remove(packageName, userId);
-            Package pkg = new Package();
-            pkg.packageName = packageName;
-            pkg.targetPackageName = targetPackageName;
-            pkg.userId = userId;
-            pkg.canCreateIdmap = canCreateIdmap;
-            mPackages.add(pkg);
-        }
-
-        public void remove(String packageName, int userId) {
-            final Iterator<Package> iter = mPackages.iterator();
-            while (iter.hasNext()) {
-                final Package pkg = iter.next();
-                if (pkg.packageName.equals(packageName) && pkg.userId == userId) {
-                    iter.remove();
-                    return;
-                }
-            }
-        }
-
-        public List<Package> select(int userId) {
-            List<Package> out = new ArrayList<>();
-            final int packageCount = mPackages.size();
-            for (int i = 0; i < packageCount; i++) {
-                final Package pkg = mPackages.get(i);
-                if (pkg.userId == userId) {
-                    out.add(pkg);
-                }
-            }
-            return out;
-        }
-
-        public Package select(String packageName, int userId) {
-            final int packageCount = mPackages.size();
-            for (int i = 0; i < packageCount; i++) {
-                final Package pkg = mPackages.get(i);
-                if (pkg.packageName.equals(packageName) && pkg.userId == userId) {
-                    return pkg;
-                }
-            }
-            return null;
-        }
-
-        private static final class Package {
-            public String packageName;
-            public int userId;
-            public String targetPackageName;
-            public boolean canCreateIdmap;
-        }
-    }
-
-    private static final class DummyPackageManagerHelper implements
-            OverlayManagerServiceImpl.PackageManagerHelper {
-        private final DummyDeviceState mState;
-
-        DummyPackageManagerHelper(DummyDeviceState state) {
-            mState = state;
-        }
-
-        @Override
-        public PackageInfo getPackageInfo(@NonNull String packageName, int userId) {
-            final DummyDeviceState.Package pkg = mState.select(packageName, userId);
-            if (pkg == null) {
-                return null;
-            }
-            ApplicationInfo ai = new ApplicationInfo();
-            ai.sourceDir = String.format("%s/%s/base.apk",
-                    pkg.targetPackageName == null ? "/system/app/" : "/vendor/overlay/",
-                    pkg.packageName);
-            PackageInfo pi = new PackageInfo();
-            pi.applicationInfo = ai;
-            pi.packageName = pkg.packageName;
-            pi.overlayTarget = pkg.targetPackageName;
-            pi.overlayCategory = "dummy-category-" + pkg.targetPackageName;
-            return pi;
-        }
-
-        @Override
-        public boolean signaturesMatching(@NonNull String packageName1,
-                @NonNull String packageName2, int userId) {
-            return false;
-        }
-
-        @Override
-        public List<PackageInfo> getOverlayPackages(int userId) {
-            List<PackageInfo> out = new ArrayList<>();
-            final List<DummyDeviceState.Package> packages = mState.select(userId);
-            final int packageCount = packages.size();
-            for (int i = 0; i < packageCount; i++) {
-                final DummyDeviceState.Package pkg = packages.get(i);
-                if (pkg.targetPackageName != null) {
-                    out.add(getPackageInfo(pkg.packageName, pkg.userId));
-                }
-            }
-            return out;
-        }
-    }
-
-    private static class DummyIdmapManager extends IdmapManager {
-        private final DummyDeviceState mState;
-        private Set<String> mIdmapFiles = new ArraySet<>();
-
-        DummyIdmapManager(DummyDeviceState state, DummyPackageManagerHelper packageManagerHelper) {
-            super(packageManagerHelper);
-            mState = state;
-        }
-
-        @Override
-        boolean createIdmap(@NonNull final PackageInfo targetPackage,
-                @NonNull final PackageInfo overlayPackage, int userId) {
-            final DummyDeviceState.Package t = mState.select(targetPackage.packageName, userId);
-            if (t == null) {
-                return false;
-            }
-            final DummyDeviceState.Package o = mState.select(overlayPackage.packageName, userId);
-            if (o == null) {
-                return false;
-            }
-            if (!o.canCreateIdmap) {
-                return false;
-            }
-            final String key = createKey(overlayPackage.packageName, userId);
-            mIdmapFiles.add(key);
-            return true;
-        }
-
-        @Override
-        boolean removeIdmap(@NonNull final OverlayInfo oi, final int userId) {
-            final String key = createKey(oi.packageName, oi.userId);
-            if (!mIdmapFiles.contains(key)) {
-                return false;
-            }
-            mIdmapFiles.remove(key);
-            return true;
-        }
-
-        @Override
-        boolean idmapExists(@NonNull final OverlayInfo oi) {
-            final String key = createKey(oi.packageName, oi.userId);
-            return mIdmapFiles.contains(key);
-        }
-
-        @Override
-        boolean idmapExists(@NonNull final PackageInfo overlayPackage, final int userId) {
-            final String key = createKey(overlayPackage.packageName, userId);
-            return mIdmapFiles.contains(key);
-        }
-
-        private String createKey(@NonNull final String packageName, final int userId) {
-            return String.format("%s:%d", packageName, userId);
-        }
-    }
-
-    private static class DummyListener implements OverlayManagerServiceImpl.OverlayChangeListener {
-        public int count;
-
-        public void onOverlaysChanged(@NonNull String targetPackage, int userId) {
-            count++;
-        }
+        impl.setEnabled(OVERLAY, true, USER);
+        assertEquals(0, listener.count);
     }
 }
diff --git a/services/tests/servicestests/src/com/android/server/om/OverlayManagerServiceImplTestsBase.java b/services/tests/servicestests/src/com/android/server/om/OverlayManagerServiceImplTestsBase.java
new file mode 100644
index 0000000..a753aac
--- /dev/null
+++ b/services/tests/servicestests/src/com/android/server/om/OverlayManagerServiceImplTestsBase.java
@@ -0,0 +1,385 @@
+/*
+ * 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.server.om;
+
+import static org.junit.Assert.assertEquals;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import android.annotation.NonNull;
+import android.content.om.OverlayInfo;
+import android.content.om.OverlayInfo.State;
+import android.content.pm.ApplicationInfo;
+import android.content.pm.PackageInfo;
+import android.util.ArraySet;
+
+import com.android.internal.content.om.OverlayConfig;
+
+import org.junit.Before;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+import java.util.stream.Collectors;
+
+/** Base class for creating {@link OverlayManagerServiceImplTests} tests. */
+class OverlayManagerServiceImplTestsBase {
+    private OverlayManagerServiceImpl mImpl;
+    private DummyDeviceState mState;
+    private DummyListener mListener;
+
+    @Before
+    public void setUp() {
+        mState = new DummyDeviceState();
+        mListener = new DummyListener();
+        final DummyPackageManagerHelper pmh = new DummyPackageManagerHelper(mState);
+
+        mImpl = new OverlayManagerServiceImpl(pmh,
+                new DummyIdmapManager(mState, pmh),
+                new OverlayManagerSettings(),
+                mState.mOverlayConfig,
+                new String[0],
+                mListener);
+    }
+
+    public OverlayManagerServiceImpl getImpl() {
+        return mImpl;
+    }
+
+    public DummyListener getListener() {
+        return mListener;
+    }
+
+    void assertState(@State int expected, final String overlayPackageName, int userId) {
+        final OverlayInfo info = mImpl.getOverlayInfo(overlayPackageName, userId);
+        if (info == null) {
+            throw new IllegalStateException("package not installed");
+        }
+
+        final String msg = String.format("expected %s but was %s:",
+                OverlayInfo.stateToString(expected), OverlayInfo.stateToString(info.state));
+        assertEquals(msg, expected, info.state);
+    }
+
+    void assertOverlayInfoList(final String targetPackageName, int userId,
+            OverlayInfo... overlayInfos) {
+        final List<OverlayInfo> expected =
+                mImpl.getOverlayInfosForTarget(targetPackageName, userId);
+        final List<OverlayInfo> actual = Arrays.asList(overlayInfos);
+        assertEquals(expected, actual);
+    }
+
+    /**
+     * Creates an overlay configured through {@link OverlayConfig}.
+     *
+     * @throws IllegalStateException if the package is already installed
+     */
+    void addOverlayPackage(String packageName, String targetPackageName, int userId,
+            boolean mutable, boolean enabled, int priority) {
+        mState.addOverlay(packageName, targetPackageName, userId, mutable, enabled, priority);
+    }
+
+    /**
+     * Adds the target package to the device.
+     *
+     * This corresponds to when the OMS receives the
+     * {@link android.content.Intent#ACTION_PACKAGE_ADDED} broadcast.
+     *
+     * @throws IllegalStateException if the package is not currently installed
+     */
+    void installTargetPackage(String packageName, int userId) {
+        if (mState.select(packageName, userId) != null) {
+            throw new IllegalStateException("package already installed");
+        }
+        mState.addTarget(packageName, userId);
+        mImpl.onTargetPackageAdded(packageName, userId);
+    }
+
+    /**
+     * Begins upgrading the target package.
+     *
+     * This corresponds to when the OMS receives the
+     * {@link android.content.Intent#ACTION_PACKAGE_REMOVED} broadcast with the
+     * {@link android.content.Intent#EXTRA_REPLACING} extra.
+     *
+     * @throws IllegalStateException if the package is not currently installed
+     */
+    void beginUpgradeTargetPackage(String packageName, int userId) {
+        if (mState.select(packageName, userId) == null) {
+            throw new IllegalStateException("package not installed");
+        }
+        mImpl.onTargetPackageReplacing(packageName, userId);
+    }
+
+    /**
+     * Ends upgrading the target package.
+     *
+     * This corresponds to when the OMS receives the
+     * {@link android.content.Intent#ACTION_PACKAGE_ADDED} broadcast with the
+     * {@link android.content.Intent#EXTRA_REPLACING} extra.
+     *
+     * @throws IllegalStateException if the package is not currently installed
+     */
+    void endUpgradeTargetPackage(String packageName, int userId) {
+        if (mState.select(packageName, userId) == null) {
+            throw new IllegalStateException("package not installed");
+        }
+        mState.addTarget(packageName, userId);
+        mImpl.onTargetPackageReplaced(packageName, userId);
+    }
+
+    /**
+     * Removes the target package from the device.
+     *
+     * This corresponds to when the OMS receives the
+     * {@link android.content.Intent#ACTION_PACKAGE_REMOVED} broadcast.
+     *
+     * @throws IllegalStateException if the package is not currently installed
+     */
+    void uninstallTargetPackage(String packageName, int userId) {
+        if (mState.select(packageName, userId) == null) {
+            throw new IllegalStateException("package not installed");
+        }
+        mState.remove(packageName, userId);
+        mImpl.onTargetPackageRemoved(packageName, userId);
+    }
+
+    /**
+     * Adds the overlay package to the device.
+     *
+     * This corresponds to when the OMS receives the
+     * {@link android.content.Intent#ACTION_PACKAGE_ADDED} broadcast.
+     *
+     * @throws IllegalStateException if the package is already installed
+     */
+    void installOverlayPackage(String packageName, String targetPackageName, int userId) {
+        if (mState.select(packageName, userId) != null) {
+            throw new IllegalStateException("package already installed");
+        }
+        mState.addOverlay(packageName, targetPackageName, userId);
+        mImpl.onOverlayPackageAdded(packageName, userId);
+    }
+
+    /**
+     * Begins upgrading the overlay package.
+     *
+     * This corresponds to when the OMS receives the
+     * {@link android.content.Intent#ACTION_PACKAGE_REMOVED} broadcast with the
+     * {@link android.content.Intent#EXTRA_REPLACING} extra.
+     *
+     * @throws IllegalStateException if the package is not currently installed
+     */
+    void beginUpgradeOverlayPackage(String packageName, int userId) {
+        if (mState.select(packageName, userId) == null) {
+            throw new IllegalStateException("package not installed, cannot upgrade");
+        }
+
+        mImpl.onOverlayPackageReplacing(packageName, userId);
+    }
+
+    /**
+     * Ends upgrading the overlay package, potentially changing its target package.
+     *
+     * This corresponds to when the OMS receives the
+     * {@link android.content.Intent#ACTION_PACKAGE_ADDED} broadcast with the
+     * {@link android.content.Intent#EXTRA_REPLACING} extra.
+     *
+     * @throws IllegalStateException if the package is not currently installed
+     */
+    void endUpgradeOverlayPackage(String packageName, String targetPackageName, int userId) {
+        if (mState.select(packageName, userId) == null) {
+            throw new IllegalStateException("package not installed, cannot upgrade");
+        }
+
+        mState.addOverlay(packageName, targetPackageName, userId);
+        mImpl.onOverlayPackageReplaced(packageName, userId);
+    }
+
+    private static final class DummyDeviceState {
+        private List<Package> mPackages = new ArrayList<>();
+        private OverlayConfig mOverlayConfig = mock(OverlayConfig.class);
+
+        /** Adds a non-overlay to the device. */
+        public void addTarget(String packageName, int userId) {
+            remove(packageName, userId);
+            mPackages.add(new Package(packageName, userId, null, false, false, 0));
+        }
+
+        /** Adds an overlay to the device. */
+        public void addOverlay(String packageName, String targetPackageName, int userId) {
+            addOverlay(packageName, targetPackageName, userId, true, false, OverlayConfig.DEFAULT_PRIORITY);
+        }
+
+        /** Adds a configured overlay to the device. */
+        public void addOverlay(String packageName, String targetPackageName, int userId,
+                boolean mutable, boolean enabled, int priority) {
+            remove(packageName, userId);
+            mPackages.add(new Package(packageName, userId, targetPackageName, mutable, enabled,
+                    priority));
+            when(mOverlayConfig.getPriority(packageName)).thenReturn(priority);
+            when(mOverlayConfig.isEnabled(packageName)).thenReturn(enabled);
+            when(mOverlayConfig.isMutable(packageName)).thenReturn(mutable);
+        }
+
+        /** Remove a package from the device. */
+        public void remove(String packageName, int userId) {
+            final Iterator<Package> iter = mPackages.iterator();
+            while (iter.hasNext()) {
+                final Package pkg = iter.next();
+                if (pkg.packageName.equals(packageName) && pkg.userId == userId) {
+                    iter.remove();
+                    return;
+                }
+            }
+        }
+
+        /** Retrieves all packages on device for a particular user. */
+        public List<Package> select(int userId) {
+            return mPackages.stream().filter(p -> p.userId == userId).collect(Collectors.toList());
+        }
+
+        /** Retrieves the package with the specified package name for a particular user. */
+        public Package select(String packageName, int userId) {
+            return mPackages.stream().filter(
+                    p -> p.packageName.equals(packageName) && p.userId == userId)
+                    .findFirst().orElse(null);
+        }
+
+        private static final class Package {
+            public final String packageName;
+            public final int userId;
+            public final String targetPackageName;
+            public final boolean mutable;
+            public final boolean enabled;
+            public final int priority;
+
+            private Package(String packageName, int userId, String targetPackageName,
+                    boolean mutable, boolean enabled, int priority) {
+                this.packageName = packageName;
+                this.userId = userId;
+                this.targetPackageName = targetPackageName;
+                this.mutable = mutable;
+                this.enabled = enabled;
+                this.priority = priority;
+            }
+        }
+    }
+
+    static final class DummyPackageManagerHelper implements
+            OverlayManagerServiceImpl.PackageManagerHelper {
+        private final DummyDeviceState mState;
+
+        private DummyPackageManagerHelper(DummyDeviceState state) {
+            mState = state;
+        }
+
+        @Override
+        public PackageInfo getPackageInfo(@NonNull String packageName, int userId) {
+            final DummyDeviceState.Package pkg = mState.select(packageName, userId);
+            if (pkg == null) {
+                return null;
+            }
+            final ApplicationInfo ai = new ApplicationInfo();
+            ai.sourceDir = String.format("%s/%s/base.apk",
+                    pkg.targetPackageName == null ? "/system/app/" : "/vendor/overlay/",
+                    pkg.packageName);
+            PackageInfo pi = new PackageInfo();
+            pi.applicationInfo = ai;
+            pi.packageName = pkg.packageName;
+            pi.overlayTarget = pkg.targetPackageName;
+            pi.overlayCategory = "dummy-category-" + pkg.targetPackageName;
+            return pi;
+        }
+
+        @Override
+        public boolean signaturesMatching(@NonNull String packageName1,
+                @NonNull String packageName2, int userId) {
+            return false;
+        }
+
+        @Override
+        public List<PackageInfo> getOverlayPackages(int userId) {
+            return mState.select(userId).stream()
+                    .filter(p -> p.targetPackageName != null)
+                    .map(p -> getPackageInfo(p.packageName, p.userId))
+                    .collect(Collectors.toList());
+        }
+    }
+
+    static class DummyIdmapManager extends IdmapManager {
+        private final DummyDeviceState mState;
+        private Set<String> mIdmapFiles = new ArraySet<>();
+
+        private DummyIdmapManager(DummyDeviceState state,
+                DummyPackageManagerHelper packageManagerHelper) {
+            super(packageManagerHelper);
+            mState = state;
+        }
+
+        @Override
+        boolean createIdmap(@NonNull final PackageInfo targetPackage,
+                @NonNull final PackageInfo overlayPackage, int userId) {
+            final DummyDeviceState.Package t = mState.select(targetPackage.packageName, userId);
+            if (t == null) {
+                return false;
+            }
+            final DummyDeviceState.Package o = mState.select(overlayPackage.packageName, userId);
+            if (o == null) {
+                return false;
+            }
+            final String key = createKey(overlayPackage.packageName, userId);
+            mIdmapFiles.add(key);
+            return true;
+        }
+
+        @Override
+        boolean removeIdmap(@NonNull final OverlayInfo oi, final int userId) {
+            final String key = createKey(oi.packageName, oi.userId);
+            if (!mIdmapFiles.contains(key)) {
+                return false;
+            }
+            mIdmapFiles.remove(key);
+            return true;
+        }
+
+        @Override
+        boolean idmapExists(@NonNull final OverlayInfo oi) {
+            final String key = createKey(oi.packageName, oi.userId);
+            return mIdmapFiles.contains(key);
+        }
+
+        @Override
+        boolean idmapExists(@NonNull final PackageInfo overlayPackage, final int userId) {
+            final String key = createKey(overlayPackage.packageName, userId);
+            return mIdmapFiles.contains(key);
+        }
+
+        private String createKey(@NonNull final String packageName, final int userId) {
+            return String.format("%s:%d", packageName, userId);
+        }
+    }
+
+    static class DummyListener implements OverlayManagerServiceImpl.OverlayChangeListener {
+        public int count;
+
+        public void onOverlaysChanged(@NonNull String targetPackage, int userId) {
+            count++;
+        }
+    }
+}
diff --git a/services/tests/servicestests/src/com/android/server/om/OverlayManagerSettingsTests.java b/services/tests/servicestests/src/com/android/server/om/OverlayManagerSettingsTests.java
index 8ff8b6e..146f60a 100644
--- a/services/tests/servicestests/src/com/android/server/om/OverlayManagerSettingsTests.java
+++ b/services/tests/servicestests/src/com/android/server/om/OverlayManagerSettingsTests.java
@@ -58,7 +58,7 @@
             STATE_DISABLED,
             0,
             0,
-            false);
+            true);
 
     private static final OverlayInfo OVERLAY_B0 = new OverlayInfo(
             "com.dummy.overlay_b",
@@ -69,7 +69,7 @@
             STATE_DISABLED,
             0,
             0,
-            false);
+            true);
 
     private static final OverlayInfo OVERLAY_C0 = new OverlayInfo(
             "com.dummy.overlay_c",
@@ -80,7 +80,7 @@
             STATE_DISABLED,
             0,
             0,
-            false);
+            true);
 
     private static final OverlayInfo OVERLAY_A1 = new OverlayInfo(
             "com.dummy.overlay_a",
@@ -91,7 +91,7 @@
             STATE_DISABLED,
             1,
             0,
-            false);
+            true);
 
     private static final OverlayInfo OVERLAY_B1 = new OverlayInfo(
             "com.dummy.overlay_b",
@@ -102,7 +102,7 @@
             STATE_DISABLED,
             1,
             0,
-            false);
+            true);
 
     @Before
     public void setUp() throws Exception {
@@ -238,7 +238,7 @@
                 STATE_DISABLED,
                 0,
                 0,
-                false);
+                true);
         insert(otherTarget);
         changed = mSettings.setPriority(OVERLAY_A0.packageName, otherTarget.packageName,
                 OVERLAY_A0.userId);
@@ -435,7 +435,7 @@
 
     private void insert(OverlayInfo oi) throws Exception {
         mSettings.init(oi.packageName, oi.userId, oi.targetPackageName, null, oi.baseCodePath,
-                false, 0, oi.category);
+                true, false,0, oi.category);
         mSettings.setState(oi.packageName, oi.userId, oi.state);
         mSettings.setEnabled(oi.packageName, oi.userId, false);
     }
diff --git a/services/tests/servicestests/src/com/android/server/people/data/DataManagerTest.java b/services/tests/servicestests/src/com/android/server/people/data/DataManagerTest.java
index 3ecd319..5e104a5 100644
--- a/services/tests/servicestests/src/com/android/server/people/data/DataManagerTest.java
+++ b/services/tests/servicestests/src/com/android/server/people/data/DataManagerTest.java
@@ -54,7 +54,6 @@
 import android.content.IntentFilter;
 import android.content.pm.PackageManagerInternal;
 import android.content.pm.ShortcutInfo;
-import android.content.pm.ShortcutManager;
 import android.content.pm.ShortcutServiceInternal;
 import android.content.pm.UserInfo;
 import android.content.pm.parsing.AndroidPackage;
@@ -87,6 +86,7 @@
 import java.util.Arrays;
 import java.util.Collections;
 import java.util.List;
+import java.util.Set;
 import java.util.concurrent.ScheduledExecutorService;
 import java.util.concurrent.ScheduledFuture;
 import java.util.concurrent.TimeUnit;
@@ -110,7 +110,6 @@
     @Mock private ShortcutServiceInternal mShortcutServiceInternal;
     @Mock private UsageStatsManagerInternal mUsageStatsManagerInternal;
     @Mock private PackageManagerInternal mPackageManagerInternal;
-    @Mock private ShortcutManager mShortcutManager;
     @Mock private UserManager mUserManager;
     @Mock private TelephonyManager mTelephonyManager;
     @Mock private TelecomManager mTelecomManager;
@@ -123,7 +122,6 @@
 
     private NotificationChannel mNotificationChannel;
     private DataManager mDataManager;
-    private int mCallingUserId;
     private CancellationSignal mCancellationSignal;
     private TestInjector mInjector;
 
@@ -145,14 +143,11 @@
         }).when(mPackageManagerInternal).forEachInstalledPackage(any(Consumer.class), anyInt());
 
         when(mContext.getMainLooper()).thenReturn(Looper.getMainLooper());
+        when(mContext.getPackageName()).thenReturn("android");
 
         Context originalContext = getInstrumentation().getTargetContext();
         when(mContext.getApplicationInfo()).thenReturn(originalContext.getApplicationInfo());
 
-        when(mContext.getSystemService(Context.SHORTCUT_SERVICE)).thenReturn(mShortcutManager);
-        when(mContext.getSystemServiceName(ShortcutManager.class)).thenReturn(
-                Context.SHORTCUT_SERVICE);
-
         when(mContext.getSystemService(Context.USER_SERVICE)).thenReturn(mUserManager);
         when(mContext.getSystemServiceName(UserManager.class)).thenReturn(
                 Context.USER_SERVICE);
@@ -191,8 +186,6 @@
                 NOTIFICATION_CHANNEL_ID, "test channel", NotificationManager.IMPORTANCE_DEFAULT);
         mNotificationChannel.setConversationId("test", TEST_SHORTCUT_ID);
 
-        mCallingUserId = USER_ID_PRIMARY;
-
         mCancellationSignal = new CancellationSignal();
 
         mInjector = new TestInjector();
@@ -222,9 +215,7 @@
         mDataManager.onShortcutAddedOrUpdated(
                 buildShortcutInfo("pkg_3", USER_ID_SECONDARY, "sc_3", buildPerson()));
 
-        List<ConversationInfo> conversations = new ArrayList<>();
-        mDataManager.forAllPackages(
-                packageData -> packageData.forAllConversations(conversations::add));
+        List<ConversationInfo> conversations = getConversationsInPrimary();
 
         // USER_ID_SECONDARY is not in the same profile group as USER_ID_PRIMARY.
         assertEquals(2, conversations.size());
@@ -250,18 +241,14 @@
         mDataManager.onShortcutAddedOrUpdated(
                 buildShortcutInfo("pkg_2", USER_ID_PRIMARY_MANAGED, "sc_2", buildPerson()));
 
-        List<ConversationInfo> conversations = new ArrayList<>();
-        mDataManager.forAllPackages(
-                packageData -> packageData.forAllConversations(conversations::add));
+        List<ConversationInfo> conversations = getConversationsInPrimary();
 
         // USER_ID_PRIMARY_MANAGED is not locked, so only USER_ID_PRIMARY's conversation is stored.
         assertEquals(1, conversations.size());
         assertEquals("sc_1", conversations.get(0).getShortcutId());
 
         mDataManager.onUserStopped(USER_ID_PRIMARY);
-        conversations.clear();
-        mDataManager.forAllPackages(
-                packageData -> packageData.forAllConversations(conversations::add));
+        conversations = getConversationsInPrimary();
         assertTrue(conversations.isEmpty());
     }
 
@@ -289,12 +276,8 @@
         IntentFilter intentFilter = new IntentFilter(Intent.ACTION_SEND, "image/jpg");
         mDataManager.reportAppTargetEvent(appTargetEvent, intentFilter);
 
-        List<Range<Long>> activeShareTimeSlots = new ArrayList<>();
-        mDataManager.forAllPackages(packageData ->
-                activeShareTimeSlots.addAll(
-                        packageData.getEventHistory(TEST_SHORTCUT_ID)
-                                .getEventIndex(Event.TYPE_SHARE_IMAGE)
-                                .getActiveTimeSlots()));
+        List<Range<Long>> activeShareTimeSlots = getActiveSlotsForTestShortcut(
+                Event.SHARE_EVENT_TYPES);
         assertEquals(1, activeShareTimeSlots.size());
     }
 
@@ -315,9 +298,7 @@
                 USER_ID_PRIMARY);
         contentObserver.onChange(false, ContactsContract.Contacts.CONTENT_URI, USER_ID_PRIMARY);
 
-        List<ConversationInfo> conversations = new ArrayList<>();
-        mDataManager.forAllPackages(
-                packageData -> packageData.forAllConversations(conversations::add));
+        List<ConversationInfo> conversations = getConversationsInPrimary();
         assertEquals(1, conversations.size());
 
         assertEquals(TEST_SHORTCUT_ID, conversations.get(0).getShortcutId());
@@ -338,12 +319,8 @@
 
         listenerService.onNotificationPosted(mStatusBarNotification);
 
-        List<Range<Long>> activeNotificationOpenTimeSlots = new ArrayList<>();
-        mDataManager.forAllPackages(packageData ->
-                activeNotificationOpenTimeSlots.addAll(
-                        packageData.getEventHistory(TEST_SHORTCUT_ID)
-                                .getEventIndex(Event.TYPE_NOTIFICATION_POSTED)
-                                .getActiveTimeSlots()));
+        List<Range<Long>> activeNotificationOpenTimeSlots = getActiveSlotsForTestShortcut(
+                Event.NOTIFICATION_EVENT_TYPES);
         assertEquals(1, activeNotificationOpenTimeSlots.size());
     }
 
@@ -361,12 +338,8 @@
         listenerService.onNotificationRemoved(mStatusBarNotification, null,
                 NotificationListenerService.REASON_CLICK);
 
-        List<Range<Long>> activeNotificationOpenTimeSlots = new ArrayList<>();
-        mDataManager.forAllPackages(packageData ->
-                activeNotificationOpenTimeSlots.addAll(
-                        packageData.getEventHistory(TEST_SHORTCUT_ID)
-                                .getEventIndex(Event.TYPE_NOTIFICATION_OPENED)
-                                .getActiveTimeSlots()));
+        List<Range<Long>> activeNotificationOpenTimeSlots = getActiveSlotsForTestShortcut(
+                Event.NOTIFICATION_EVENT_TYPES);
         assertEquals(1, activeNotificationOpenTimeSlots.size());
     }
 
@@ -469,12 +442,7 @@
         mInjector.mCallLogQueryHelper.mEventConsumer.accept(PHONE_NUMBER,
                 new Event(currentTimestamp - MILLIS_PER_MINUTE * 5L, Event.TYPE_CALL_MISSED));
 
-        List<Range<Long>> activeTimeSlots = new ArrayList<>();
-        mDataManager.forAllPackages(packageData ->
-                activeTimeSlots.addAll(
-                        packageData.getEventHistory(TEST_SHORTCUT_ID)
-                                .getEventIndex(Event.CALL_EVENT_TYPES)
-                                .getActiveTimeSlots()));
+        List<Range<Long>> activeTimeSlots = getActiveSlotsForTestShortcut(Event.CALL_EVENT_TYPES);
         assertEquals(3, activeTimeSlots.size());
     }
 
@@ -498,12 +466,7 @@
         mInjector.mMmsQueryHelper.mEventConsumer.accept(PHONE_NUMBER, outgoingSmsEvent);
         mInjector.mSmsQueryHelper.mEventConsumer.accept(PHONE_NUMBER, incomingSmsEvent);
 
-        List<Range<Long>> activeTimeSlots = new ArrayList<>();
-        mDataManager.forAllPackages(packageData ->
-                activeTimeSlots.addAll(
-                        packageData.getEventHistory(TEST_SHORTCUT_ID)
-                                .getEventIndex(Event.SMS_EVENT_TYPES)
-                                .getActiveTimeSlots()));
+        List<Range<Long>> activeTimeSlots = getActiveSlotsForTestShortcut(Event.SMS_EVENT_TYPES);
         assertEquals(2, activeTimeSlots.size());
     }
 
@@ -551,22 +514,12 @@
         mInjector.mCallLogQueryHelper.mEventConsumer.accept(PHONE_NUMBER,
                 new Event(currentTimestamp - MILLIS_PER_MINUTE, Event.TYPE_CALL_OUTGOING));
 
-        List<Range<Long>> activeTimeSlots = new ArrayList<>();
-        mDataManager.forAllPackages(packageData ->
-                activeTimeSlots.addAll(
-                        packageData.getEventHistory(TEST_SHORTCUT_ID)
-                                .getEventIndex(Event.CALL_EVENT_TYPES)
-                                .getActiveTimeSlots()));
+        List<Range<Long>> activeTimeSlots = getActiveSlotsForTestShortcut(Event.CALL_EVENT_TYPES);
         assertEquals(1, activeTimeSlots.size());
 
         mDataManager.getUserDataForTesting(USER_ID_PRIMARY).setDefaultDialer(null);
         mDataManager.pruneDataForUser(USER_ID_PRIMARY, mCancellationSignal);
-        activeTimeSlots.clear();
-        mDataManager.forAllPackages(packageData ->
-                activeTimeSlots.addAll(
-                        packageData.getEventHistory(TEST_SHORTCUT_ID)
-                                .getEventIndex(Event.CALL_EVENT_TYPES)
-                                .getActiveTimeSlots()));
+        activeTimeSlots = getActiveSlotsForTestShortcut(Event.CALL_EVENT_TYPES);
         assertTrue(activeTimeSlots.isEmpty());
     }
 
@@ -583,22 +536,12 @@
         mInjector.mMmsQueryHelper.mEventConsumer.accept(PHONE_NUMBER,
                 new Event(currentTimestamp - MILLIS_PER_MINUTE, Event.TYPE_SMS_OUTGOING));
 
-        List<Range<Long>> activeTimeSlots = new ArrayList<>();
-        mDataManager.forAllPackages(packageData ->
-                activeTimeSlots.addAll(
-                        packageData.getEventHistory(TEST_SHORTCUT_ID)
-                                .getEventIndex(Event.SMS_EVENT_TYPES)
-                                .getActiveTimeSlots()));
+        List<Range<Long>> activeTimeSlots = getActiveSlotsForTestShortcut(Event.SMS_EVENT_TYPES);
         assertEquals(1, activeTimeSlots.size());
 
         mDataManager.getUserDataForTesting(USER_ID_PRIMARY).setDefaultSmsApp(null);
         mDataManager.pruneDataForUser(USER_ID_PRIMARY, mCancellationSignal);
-        activeTimeSlots.clear();
-        mDataManager.forAllPackages(packageData ->
-                activeTimeSlots.addAll(
-                        packageData.getEventHistory(TEST_SHORTCUT_ID)
-                                .getEventIndex(Event.SMS_EVENT_TYPES)
-                                .getActiveTimeSlots()));
+        activeTimeSlots = getActiveSlotsForTestShortcut(Event.SMS_EVENT_TYPES);
         assertTrue(activeTimeSlots.isEmpty());
     }
 
@@ -607,6 +550,24 @@
         LocalServices.addService(clazz, mock);
     }
 
+    private List<ConversationInfo> getConversationsInPrimary() {
+        List<ConversationInfo> conversations = new ArrayList<>();
+        mDataManager.forPackagesInProfile(USER_ID_PRIMARY,
+                packageData -> packageData.forAllConversations(conversations::add));
+        return conversations;
+    }
+
+    private List<Range<Long>> getActiveSlotsForTestShortcut(
+            Set<Integer> eventTypes) {
+        List<Range<Long>> activeSlots = new ArrayList<>();
+        mDataManager.forPackagesInProfile(USER_ID_PRIMARY, packageData ->
+                activeSlots.addAll(
+                        packageData.getEventHistory(TEST_SHORTCUT_ID)
+                                .getEventIndex(eventTypes)
+                                .getActiveTimeSlots()));
+        return activeSlots;
+    }
+
     private ShortcutInfo buildShortcutInfo(String packageName, int userId, String id,
             @Nullable Person person) {
         Context mockContext = mock(Context.class);
@@ -778,10 +739,5 @@
             mSmsQueryHelper = new TestSmsQueryHelper(context, eventConsumer);
             return mSmsQueryHelper;
         }
-
-        @Override
-        int getCallingUserId() {
-            return mCallingUserId;
-        }
     }
 }
diff --git a/services/tests/servicestests/src/com/android/server/people/prediction/ShareTargetPredictorTest.java b/services/tests/servicestests/src/com/android/server/people/prediction/ShareTargetPredictorTest.java
index 808906e..f498a94 100644
--- a/services/tests/servicestests/src/com/android/server/people/prediction/ShareTargetPredictorTest.java
+++ b/services/tests/servicestests/src/com/android/server/people/prediction/ShareTargetPredictorTest.java
@@ -20,6 +20,7 @@
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNull;
 import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.anyInt;
 import static org.mockito.ArgumentMatchers.anyString;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
@@ -73,7 +74,7 @@
     public void setUp() {
         MockitoAnnotations.initMocks(this);
 
-        when(mDataManager.getShareShortcuts(any())).thenReturn(mShareShortcuts);
+        when(mDataManager.getShareShortcuts(any(), anyInt())).thenReturn(mShareShortcuts);
         when(mDataManager.getPackage(PACKAGE_1, USER_ID)).thenReturn(mPackageData1);
         when(mDataManager.getPackage(PACKAGE_2, USER_ID)).thenReturn(mPackageData2);
 
@@ -82,7 +83,8 @@
                 .setPredictedTargetCount(NUM_PREDICTED_TARGETS)
                 .setExtras(new Bundle())
                 .build();
-        mPredictor = new ShareTargetPredictor(predictionContext, targets -> { }, mDataManager);
+        mPredictor = new ShareTargetPredictor(
+                predictionContext, targets -> { }, mDataManager, USER_ID);
     }
 
     @Test
diff --git a/services/tests/servicestests/src/com/android/server/pm/BaseShortcutManagerTest.java b/services/tests/servicestests/src/com/android/server/pm/BaseShortcutManagerTest.java
index df2b3ef..6c769485 100644
--- a/services/tests/servicestests/src/com/android/server/pm/BaseShortcutManagerTest.java
+++ b/services/tests/servicestests/src/com/android/server/pm/BaseShortcutManagerTest.java
@@ -562,6 +562,11 @@
         boolean injectHasAccessShortcutsPermission(int callingPid, int callingUid) {
             return true;
         }
+
+        @Override
+        boolean injectHasInteractAcrossUsersFullPermission(int callingPid, int callingUid) {
+            return false;
+        }
     }
 
     protected class LauncherAppsTestable extends LauncherApps {
diff --git a/services/tests/servicestests/src/com/android/server/pm/CrossProfileAppsServiceImplTest.java b/services/tests/servicestests/src/com/android/server/pm/CrossProfileAppsServiceImplTest.java
index 3708571..e79b5af 100644
--- a/services/tests/servicestests/src/com/android/server/pm/CrossProfileAppsServiceImplTest.java
+++ b/services/tests/servicestests/src/com/android/server/pm/CrossProfileAppsServiceImplTest.java
@@ -31,6 +31,7 @@
 import android.content.pm.PermissionInfo;
 import android.content.pm.ResolveInfo;
 import android.os.Bundle;
+import android.os.IBinder;
 import android.os.UserHandle;
 import android.os.UserManager;
 import android.platform.test.annotations.Presubmit;
@@ -237,6 +238,8 @@
                         anyString(),
                         nullable(String.class),
                         any(Intent.class),
+                        nullable(IBinder.class),
+                        anyInt(),
                         nullable(Bundle.class),
                         anyInt());
     }
@@ -260,6 +263,8 @@
                         anyString(),
                         nullable(String.class),
                         any(Intent.class),
+                        nullable(IBinder.class),
+                        anyInt(),
                         nullable(Bundle.class),
                         anyInt());
     }
@@ -285,6 +290,8 @@
                         anyString(),
                         nullable(String.class),
                         any(Intent.class),
+                        nullable(IBinder.class),
+                        anyInt(),
                         nullable(Bundle.class),
                         anyInt());
     }
@@ -310,6 +317,8 @@
                         anyString(),
                         nullable(String.class),
                         any(Intent.class),
+                        nullable(IBinder.class),
+                        anyInt(),
                         nullable(Bundle.class),
                         anyInt());
     }
@@ -333,6 +342,8 @@
                         anyString(),
                         nullable(String.class),
                         any(Intent.class),
+                        nullable(IBinder.class),
+                        anyInt(),
                         nullable(Bundle.class),
                         anyInt());
     }
@@ -356,6 +367,8 @@
                         anyString(),
                         nullable(String.class),
                         any(Intent.class),
+                        nullable(IBinder.class),
+                        anyInt(),
                         nullable(Bundle.class),
                         anyInt());
     }
@@ -381,6 +394,8 @@
                         anyString(),
                         nullable(String.class),
                         any(Intent.class),
+                        nullable(IBinder.class),
+                        anyInt(),
                         nullable(Bundle.class),
                         anyInt());
     }
@@ -411,6 +426,8 @@
                         anyString(),
                         nullable(String.class),
                         any(Intent.class),
+                        nullable(IBinder.class),
+                        anyInt(),
                         nullable(Bundle.class),
                         anyInt());
     }
@@ -434,6 +451,8 @@
                         anyString(),
                         nullable(String.class),
                         any(Intent.class),
+                        nullable(IBinder.class),
+                        anyInt(),
                         nullable(Bundle.class),
                         anyInt());
     }
@@ -457,6 +476,8 @@
                         anyString(),
                         nullable(String.class),
                         any(Intent.class),
+                        nullable(IBinder.class),
+                        anyInt(),
                         nullable(Bundle.class),
                         anyInt());
     }
@@ -480,6 +501,8 @@
                         anyString(),
                         nullable(String.class),
                         any(Intent.class),
+                        nullable(IBinder.class),
+                        anyInt(),
                         nullable(Bundle.class),
                         anyInt());
     }
@@ -503,6 +526,8 @@
                         anyString(),
                         nullable(String.class),
                         any(Intent.class),
+                        nullable(IBinder.class),
+                        anyInt(),
                         nullable(Bundle.class),
                         anyInt());
     }
@@ -525,6 +550,8 @@
                         eq(PACKAGE_ONE),
                         eq(FEATURE_ID),
                         any(Intent.class),
+                        nullable(IBinder.class),
+                        anyInt(),
                         nullable(Bundle.class),
                         eq(PRIMARY_USER));
     }
diff --git a/services/tests/servicestests/src/com/android/server/pm/KeySetManagerServiceTest.java b/services/tests/servicestests/src/com/android/server/pm/KeySetManagerServiceTest.java
index 0273a1c..164bd72 100644
--- a/services/tests/servicestests/src/com/android/server/pm/KeySetManagerServiceTest.java
+++ b/services/tests/servicestests/src/com/android/server/pm/KeySetManagerServiceTest.java
@@ -40,7 +40,7 @@
         return new PackageSetting(name, name, new File(mContext.getCacheDir(), "fakeCodePath"),
                 new File(mContext.getCacheDir(), "fakeResPath"), "", "", "",
                 "", 1, 0, 0, 0 /*sharedUserId*/, null /*usesStaticLibraries*/,
-                null /*usesStaticLibrariesVersions*/);
+                null /*usesStaticLibrariesVersions*/, null /*mimeGroups*/);
     }
 
     @Override
diff --git a/services/tests/servicestests/src/com/android/server/pm/PackageManagerServiceTest.java b/services/tests/servicestests/src/com/android/server/pm/PackageManagerServiceTest.java
index 85840e1..9cf6702 100644
--- a/services/tests/servicestests/src/com/android/server/pm/PackageManagerServiceTest.java
+++ b/services/tests/servicestests/src/com/android/server/pm/PackageManagerServiceTest.java
@@ -88,7 +88,7 @@
                 new File("resourcePath"), "legacyNativeLibraryPathString",
                 "primaryCpuAbiString", "secondaryCpuAbiString",
                 "cpuAbiOverrideString", 0, 0, 0, 0,
-                null, null);
+                null, null, null);
         pri.populateUsers(new int[] {
                 1, 2, 3, 4, 5
         }, setting);
@@ -118,15 +118,15 @@
         String[] partitions = { "system", "vendor", "odm", "oem", "product", "system_ext" };
         String[] appdir = { "app", "priv-app" };
         for (int i = 0; i < partitions.length; i++) {
-            final PackageManagerService.SystemPartition systemPartition =
+            final PackageManagerService.ScanPartition scanPartition =
                     PackageManagerService.SYSTEM_PARTITIONS.get(i);
             for (int j = 0; j < appdir.length; j++) {
                 String canonical = new File("/" + partitions[i]).getCanonicalPath();
                 String path = String.format("%s/%s/A.apk", canonical, appdir[j]);
 
-                Assert.assertEquals(j == 1 && i != 3, systemPartition.containsPrivPath(path));
+                Assert.assertEquals(j == 1 && i != 3, scanPartition.containsPrivPath(path));
 
-                final int scanFlag = systemPartition.scanFlag;
+                final int scanFlag = scanPartition.scanFlag;
                 Assert.assertEquals(i == 1, scanFlag == PackageManagerService.SCAN_AS_VENDOR);
                 Assert.assertEquals(i == 2, scanFlag == PackageManagerService.SCAN_AS_ODM);
                 Assert.assertEquals(i == 3, scanFlag == PackageManagerService.SCAN_AS_OEM);
diff --git a/services/tests/servicestests/src/com/android/server/pm/PackageManagerSettingsTests.java b/services/tests/servicestests/src/com/android/server/pm/PackageManagerSettingsTests.java
index cf51fa3..acfe71a 100644
--- a/services/tests/servicestests/src/com/android/server/pm/PackageManagerSettingsTests.java
+++ b/services/tests/servicestests/src/com/android/server/pm/PackageManagerSettingsTests.java
@@ -431,7 +431,8 @@
                 ApplicationInfo.PRIVATE_FLAG_PRIVILEGED|ApplicationInfo.PRIVATE_FLAG_HIDDEN,
                 0,
                 null /*usesStaticLibraries*/,
-                null /*usesStaticLibrariesVersions*/);
+                null /*usesStaticLibrariesVersions*/,
+                null /*mimeGroups*/);
         final PackageSetting testPkgSetting01 = new PackageSetting(origPkgSetting01);
         verifySettingCopy(origPkgSetting01, testPkgSetting01);
     }
@@ -452,7 +453,8 @@
                 ApplicationInfo.PRIVATE_FLAG_PRIVILEGED|ApplicationInfo.PRIVATE_FLAG_HIDDEN,
                 0,
                 null /*usesStaticLibraries*/,
-                null /*usesStaticLibrariesVersions*/);
+                null /*usesStaticLibrariesVersions*/,
+                null /*mimeGroups*/);
         final PackageSetting testPkgSetting01 = new PackageSetting(
                 PACKAGE_NAME /*pkgName*/,
                 REAL_PACKAGE_NAME /*realPkgName*/,
@@ -467,7 +469,8 @@
                 0 /*pkgPrivateFlags*/,
                 0,
                 null /*usesStaticLibraries*/,
-                null /*usesStaticLibrariesVersions*/);
+                null /*usesStaticLibrariesVersions*/,
+                null /*mimeGroups*/);
         testPkgSetting01.copyFrom(origPkgSetting01);
         verifySettingCopy(origPkgSetting01, testPkgSetting01);
     }
@@ -494,7 +497,8 @@
                 0 /*pkgPrivateFlags*/,
                 UserManagerService.getInstance(),
                 null /*usesStaticLibraries*/,
-                null /*usesStaticLibrariesVersions*/);
+                null /*usesStaticLibrariesVersions*/,
+                null /*mimeGroups*/);
         assertThat(testPkgSetting01.primaryCpuAbiString, is("arm64-v8a"));
         assertThat(testPkgSetting01.secondaryCpuAbiString, is("armeabi"));
         assertThat(testPkgSetting01.pkgFlags, is(0));
@@ -527,7 +531,8 @@
                 ApplicationInfo.PRIVATE_FLAG_PRIVILEGED /*pkgPrivateFlags*/,
                 UserManagerService.getInstance(),
                 null /*usesStaticLibraries*/,
-                null /*usesStaticLibrariesVersions*/);
+                null /*usesStaticLibrariesVersions*/,
+                null /*mimeGroups*/);
         assertThat(testPkgSetting01.primaryCpuAbiString, is("arm64-v8a"));
         assertThat(testPkgSetting01.secondaryCpuAbiString, is("armeabi"));
         assertThat(testPkgSetting01.pkgFlags, is(ApplicationInfo.FLAG_SYSTEM));
@@ -566,7 +571,8 @@
                     0 /*pkgPrivateFlags*/,
                     UserManagerService.getInstance(),
                     null /*usesStaticLibraries*/,
-                    null /*usesStaticLibrariesVersions*/);
+                    null /*usesStaticLibrariesVersions*/,
+                    null /*mimeGroups*/);
             fail("Expected a PackageManagerException");
         } catch (PackageManagerException expected) {
         }
@@ -598,7 +604,8 @@
                 false /*virtualPreload*/,
                 UserManagerService.getInstance(),
                 null /*usesStaticLibraries*/,
-                null /*usesStaticLibrariesVersions*/);
+                null /*usesStaticLibrariesVersions*/,
+                null /*mimeGroups*/);
         assertThat(testPkgSetting01.codePath, is(UPDATED_CODE_PATH));
         assertThat(testPkgSetting01.name, is(PACKAGE_NAME));
         assertThat(testPkgSetting01.pkgFlags, is(ApplicationInfo.FLAG_SYSTEM));
@@ -637,7 +644,8 @@
                 false /*virtualPreload*/,
                 UserManagerService.getInstance(),
                 null /*usesStaticLibraries*/,
-                null /*usesStaticLibrariesVersions*/);
+                null /*usesStaticLibrariesVersions*/,
+                null /*mimeGroups*/);
         assertThat(testPkgSetting01.appId, is(0));
         assertThat(testPkgSetting01.codePath, is(INITIAL_CODE_PATH));
         assertThat(testPkgSetting01.name, is(PACKAGE_NAME));
@@ -682,7 +690,8 @@
                 false /*virtualPreload*/,
                 UserManagerService.getInstance(),
                 null /*usesStaticLibraries*/,
-                null /*usesStaticLibrariesVersions*/);
+                null /*usesStaticLibrariesVersions*/,
+                null /*mimeGroups*/);
         assertThat(testPkgSetting01.appId, is(10064));
         assertThat(testPkgSetting01.codePath, is(INITIAL_CODE_PATH));
         assertThat(testPkgSetting01.name, is(PACKAGE_NAME));
@@ -724,7 +733,8 @@
                 false /*virtualPreload*/,
                 UserManagerService.getInstance(),
                 null /*usesStaticLibraries*/,
-                null /*usesStaticLibrariesVersions*/);
+                null /*usesStaticLibrariesVersions*/,
+                null /*mimeGroups*/);
         assertThat(testPkgSetting01.appId, is(10064));
         assertThat(testPkgSetting01.codePath, is(UPDATED_CODE_PATH));
         assertThat(testPkgSetting01.name, is(PACKAGE_NAME));
@@ -795,6 +805,8 @@
                 testPkgSetting.legacyNativeLibraryPathString);
         assertThat(origPkgSetting.legacyNativeLibraryPathString,
                 is(testPkgSetting.legacyNativeLibraryPathString));
+        assertNotSame(origPkgSetting.mimeGroups, testPkgSetting.mimeGroups);
+        assertThat(origPkgSetting.mimeGroups, is(testPkgSetting.mimeGroups));
         assertNotSame(origPkgSetting.mPermissionsState, testPkgSetting.mPermissionsState);
         assertThat(origPkgSetting.mPermissionsState, is(testPkgSetting.mPermissionsState));
         assertThat(origPkgSetting.name, is(testPkgSetting.name));
@@ -854,7 +866,8 @@
                 0 /*privateFlags*/,
                 sharedUserId,
                 null /*usesStaticLibraries*/,
-                null /*usesStaticLibrariesVersions*/);
+                null /*usesStaticLibrariesVersions*/,
+                null /*mimeGroups*/);
     }
 
     private PackageSetting createPackageSetting(String packageName) {
@@ -872,7 +885,8 @@
                 0 /*privateFlags*/,
                 0,
                 null /*usesStaticLibraries*/,
-                null /*usesStaticLibrariesVersions*/);
+                null /*usesStaticLibrariesVersions*/,
+                null /*mimeGroups*/);
     }
 
     private @NonNull List<UserInfo> createFakeUsers() {
diff --git a/services/tests/servicestests/src/com/android/server/pm/PackageSettingBuilder.java b/services/tests/servicestests/src/com/android/server/pm/PackageSettingBuilder.java
index 338d5fa..841cea2 100644
--- a/services/tests/servicestests/src/com/android/server/pm/PackageSettingBuilder.java
+++ b/services/tests/servicestests/src/com/android/server/pm/PackageSettingBuilder.java
@@ -19,9 +19,11 @@
 import android.content.pm.PackageParser;
 import android.content.pm.PackageUserState;
 import android.content.pm.parsing.AndroidPackage;
+import android.util.ArraySet;
 import android.util.SparseArray;
 
 import java.io.File;
+import java.util.Map;
 
 public class PackageSettingBuilder {
     private String mName;
@@ -38,6 +40,7 @@
     private int mSharedUserId;
     private String[] mUsesStaticLibraries;
     private long[] mUsesStaticLibrariesVersions;
+    private Map<String, ArraySet<String>> mMimeGroups;
     private String mVolumeUuid;
     private SparseArray<PackageUserState> mUserStates = new SparseArray<>();
     private AndroidPackage mPkg;
@@ -127,6 +130,11 @@
         return this;
     }
 
+    public PackageSettingBuilder setMimeGroups(Map<String, ArraySet<String>> mimeGroups) {
+        this.mMimeGroups = mimeGroups;
+        return this;
+    }
+
     public PackageSettingBuilder setVolumeUuid(String volumeUuid) {
         this.mVolumeUuid = volumeUuid;
         return this;
@@ -156,7 +164,7 @@
                 new File(mCodePath), new File(mResourcePath),
                 mLegacyNativeLibraryPathString, mPrimaryCpuAbiString, mSecondaryCpuAbiString,
                 mCpuAbiOverrideString, mPVersionCode, mPkgFlags, mPrivateFlags, mSharedUserId,
-                mUsesStaticLibraries, mUsesStaticLibrariesVersions);
+                mUsesStaticLibraries, mUsesStaticLibrariesVersions, mMimeGroups);
         packageSetting.signatures = mSigningDetails != null
                 ? new PackageSignatures(mSigningDetails)
                 : new PackageSignatures();
diff --git a/services/tests/servicestests/src/com/android/server/pm/PackageSignaturesTest.java b/services/tests/servicestests/src/com/android/server/pm/PackageSignaturesTest.java
index 04e769d..55bc681 100644
--- a/services/tests/servicestests/src/com/android/server/pm/PackageSignaturesTest.java
+++ b/services/tests/servicestests/src/com/android/server/pm/PackageSignaturesTest.java
@@ -467,7 +467,7 @@
         File appPath = new File("/data/app/app");
         PackageSetting result = new PackageSetting("test.app", null, appPath, appPath,
                 "/data/app/app", null, null, null,
-                1, 940097092, 0, 0 /*userId*/, null, null);
+                1, 940097092, 0, 0 /*userId*/, null, null, null /*mimeGroups*/);
         return result;
     }
 }
diff --git a/services/tests/servicestests/src/com/android/server/power/NotifierTest.java b/services/tests/servicestests/src/com/android/server/power/NotifierTest.java
index 7666ab9..1c2d8e8 100644
--- a/services/tests/servicestests/src/com/android/server/power/NotifierTest.java
+++ b/services/tests/servicestests/src/com/android/server/power/NotifierTest.java
@@ -45,6 +45,7 @@
 import com.android.internal.os.BatteryStatsImpl;
 import com.android.server.LocalServices;
 import com.android.server.policy.WindowManagerPolicy;
+import com.android.server.power.batterysaver.BatterySaverController;
 import com.android.server.power.batterysaver.BatterySaverPolicy;
 import com.android.server.power.batterysaver.BatterySavingStats;
 import com.android.server.statusbar.StatusBarManagerInternal;
@@ -61,6 +62,7 @@
     private static final String SYSTEM_PROPERTY_QUIESCENT = "ro.boot.quiescent";
     private static final int USER_ID = 0;
 
+    @Mock private BatterySaverController mBatterySaverControllerMock;
     @Mock private BatterySaverPolicy mBatterySaverPolicyMock;
     @Mock private PowerManagerService.NativeWrapper mNativeWrapperMock;
     @Mock private Notifier mNotifierMock;
@@ -223,6 +225,13 @@
         }
 
         @Override
+        BatterySaverController createBatterySaverController(
+                Object lock, Context context, BatterySaverPolicy batterySaverPolicy,
+                BatterySavingStats batterySavingStats) {
+            return mBatterySaverControllerMock;
+        }
+
+        @Override
         PowerManagerService.NativeWrapper createNativeWrapper() {
             return mNativeWrapperMock;
         }
@@ -247,6 +256,11 @@
         public SystemPropertiesWrapper createSystemPropertiesWrapper() {
             return mSystemPropertiesMock;
         }
+
+        @Override
+        void invalidateIsInteractiveCaches() {
+            // Avoids an SELinux denial.
+        }
     };
 
     private void enableChargingFeedback(boolean chargingFeedbackEnabled, boolean dndOn) {
diff --git a/services/tests/servicestests/src/com/android/server/power/PowerManagerServiceTest.java b/services/tests/servicestests/src/com/android/server/power/PowerManagerServiceTest.java
index 811089a..0ee2f55 100644
--- a/services/tests/servicestests/src/com/android/server/power/PowerManagerServiceTest.java
+++ b/services/tests/servicestests/src/com/android/server/power/PowerManagerServiceTest.java
@@ -81,6 +81,7 @@
 import com.android.server.power.PowerManagerService.Injector;
 import com.android.server.power.PowerManagerService.NativeWrapper;
 import com.android.server.power.PowerManagerService.UserSwitchedReceiver;
+import com.android.server.power.batterysaver.BatterySaverController;
 import com.android.server.power.batterysaver.BatterySaverPolicy;
 import com.android.server.power.batterysaver.BatterySavingStats;
 
@@ -106,6 +107,7 @@
     private static final float BRIGHTNESS_FACTOR = 0.7f;
     private static final boolean BATTERY_SAVER_ENABLED = true;
 
+    @Mock private BatterySaverController mBatterySaverControllerMock;
     @Mock private BatterySaverPolicy mBatterySaverPolicyMock;
     @Mock private LightsManager mLightsManagerMock;
     @Mock private DisplayManagerInternal mDisplayManagerInternalMock;
@@ -207,6 +209,13 @@
             }
 
             @Override
+            BatterySaverController createBatterySaverController(
+                    Object lock, Context context, BatterySaverPolicy batterySaverPolicy,
+                    BatterySavingStats batterySavingStats) {
+                return mBatterySaverControllerMock;
+            }
+
+            @Override
             NativeWrapper createNativeWrapper() {
                 return mNativeWrapperMock;
             }
@@ -231,6 +240,11 @@
             public SystemPropertiesWrapper createSystemPropertiesWrapper() {
                 return mSystemPropertiesMock;
             }
+
+            @Override
+            void invalidateIsInteractiveCaches() {
+                // Avoids an SELinux failure.
+            }
         });
         return mService;
     }
@@ -369,7 +383,7 @@
     @Test
     public void testWakefulnessAwake_InitialValue() throws Exception {
         createService();
-        assertThat(mService.getWakefulness()).isEqualTo(WAKEFULNESS_AWAKE);
+        assertThat(mService.getWakefulnessLocked()).isEqualTo(WAKEFULNESS_AWAKE);
     }
 
     @Test
@@ -377,12 +391,12 @@
         createService();
         // Start with AWAKE state
         startSystem();
-        assertThat(mService.getWakefulness()).isEqualTo(WAKEFULNESS_AWAKE);
+        assertThat(mService.getWakefulnessLocked()).isEqualTo(WAKEFULNESS_AWAKE);
 
         // Take a nap and verify.
         mService.getBinderServiceInstance().goToSleep(SystemClock.uptimeMillis(),
                 PowerManager.GO_TO_SLEEP_REASON_APPLICATION, PowerManager.GO_TO_SLEEP_FLAG_NO_DOZE);
-        assertThat(mService.getWakefulness()).isEqualTo(WAKEFULNESS_ASLEEP);
+        assertThat(mService.getWakefulnessLocked()).isEqualTo(WAKEFULNESS_ASLEEP);
     }
 
     @Test
@@ -399,21 +413,21 @@
         int flags = PowerManager.FULL_WAKE_LOCK;
         mService.getBinderServiceInstance().acquireWakeLock(token, flags, tag, packageName,
                 null /* workSource */, null /* historyTag */);
-        assertThat(mService.getWakefulness()).isEqualTo(WAKEFULNESS_ASLEEP);
+        assertThat(mService.getWakefulnessLocked()).isEqualTo(WAKEFULNESS_ASLEEP);
         mService.getBinderServiceInstance().releaseWakeLock(token, 0 /* flags */);
 
         // Ensure that the flag does *NOT* work with a partial wake lock.
         flags = PowerManager.PARTIAL_WAKE_LOCK | PowerManager.ACQUIRE_CAUSES_WAKEUP;
         mService.getBinderServiceInstance().acquireWakeLock(token, flags, tag, packageName,
                 null /* workSource */, null /* historyTag */);
-        assertThat(mService.getWakefulness()).isEqualTo(WAKEFULNESS_ASLEEP);
+        assertThat(mService.getWakefulnessLocked()).isEqualTo(WAKEFULNESS_ASLEEP);
         mService.getBinderServiceInstance().releaseWakeLock(token, 0 /* flags */);
 
         // Verify that flag forces a wakeup when paired to a FULL_WAKE_LOCK
         flags = PowerManager.FULL_WAKE_LOCK | PowerManager.ACQUIRE_CAUSES_WAKEUP;
         mService.getBinderServiceInstance().acquireWakeLock(token, flags, tag, packageName,
                 null /* workSource */, null /* historyTag */);
-        assertThat(mService.getWakefulness()).isEqualTo(WAKEFULNESS_AWAKE);
+        assertThat(mService.getWakefulnessLocked()).isEqualTo(WAKEFULNESS_AWAKE);
         mService.getBinderServiceInstance().releaseWakeLock(token, 0 /* flags */);
     }
 
@@ -424,7 +438,7 @@
         forceSleep();
         mService.getBinderServiceInstance().wakeUp(SystemClock.uptimeMillis(),
                 PowerManager.WAKE_REASON_UNKNOWN, "testing IPowerManager.wakeUp()", "pkg.name");
-        assertThat(mService.getWakefulness()).isEqualTo(WAKEFULNESS_AWAKE);
+        assertThat(mService.getWakefulnessLocked()).isEqualTo(WAKEFULNESS_AWAKE);
     }
 
     /**
@@ -445,7 +459,7 @@
                 .thenReturn(false);
         mService.readConfigurationLocked();
         setPluggedIn(true);
-        assertThat(mService.getWakefulness()).isEqualTo(WAKEFULNESS_ASLEEP);
+        assertThat(mService.getWakefulnessLocked()).isEqualTo(WAKEFULNESS_ASLEEP);
         when(mResourcesSpy.getBoolean(com.android.internal.R.bool.config_unplugTurnsOnScreen))
                 .thenReturn(true);
         mService.readConfigurationLocked();
@@ -460,20 +474,20 @@
         when(mWirelessChargerDetectorMock.update(true /* isPowered */,
                 BatteryManager.BATTERY_PLUGGED_WIRELESS)).thenReturn(false);
         setPluggedIn(true);
-        assertThat(mService.getWakefulness()).isEqualTo(WAKEFULNESS_ASLEEP);
+        assertThat(mService.getWakefulnessLocked()).isEqualTo(WAKEFULNESS_ASLEEP);
 
         // Test 3:
         // Do not wake up if the phone is being REMOVED from a wireless charger
         when(mBatteryManagerInternalMock.getPlugType()).thenReturn(0);
         setPluggedIn(false);
-        assertThat(mService.getWakefulness()).isEqualTo(WAKEFULNESS_ASLEEP);
+        assertThat(mService.getWakefulnessLocked()).isEqualTo(WAKEFULNESS_ASLEEP);
 
         // Test 4:
         // Do not wake if we are dreaming.
         forceAwake();  // Needs to be awake first before it can dream.
         forceDream();
         setPluggedIn(true);
-        assertThat(mService.getWakefulness()).isEqualTo(WAKEFULNESS_DREAMING);
+        assertThat(mService.getWakefulnessLocked()).isEqualTo(WAKEFULNESS_DREAMING);
         forceSleep();
 
         // Test 5:
@@ -486,7 +500,7 @@
                 com.android.internal.R.bool.config_allowTheaterModeWakeFromUnplug))
                 .thenReturn(false);
         setPluggedIn(false);
-        assertThat(mService.getWakefulness()).isEqualTo(WAKEFULNESS_ASLEEP);
+        assertThat(mService.getWakefulnessLocked()).isEqualTo(WAKEFULNESS_ASLEEP);
         Settings.Global.putInt(
                 mContextSpy.getContentResolver(), Settings.Global.THEATER_MODE_ON, 0);
         mUserSwitchedReceiver.onReceive(mContextSpy, new Intent(Intent.ACTION_USER_SWITCHED));
@@ -499,14 +513,14 @@
         forceAwake();
         forceDozing();
         setPluggedIn(true);
-        assertThat(mService.getWakefulness()).isEqualTo(WAKEFULNESS_DOZING);
+        assertThat(mService.getWakefulnessLocked()).isEqualTo(WAKEFULNESS_DOZING);
 
         // Test 7:
         // Finally, take away all the factors above and ensure the device wakes up!
         forceAwake();
         forceSleep();
         setPluggedIn(false);
-        assertThat(mService.getWakefulness()).isEqualTo(WAKEFULNESS_AWAKE);
+        assertThat(mService.getWakefulnessLocked()).isEqualTo(WAKEFULNESS_AWAKE);
     }
 
     @Test
@@ -514,12 +528,12 @@
         createService();
         // Start with AWAKE state
         startSystem();
-        assertThat(mService.getWakefulness()).isEqualTo(WAKEFULNESS_AWAKE);
+        assertThat(mService.getWakefulnessLocked()).isEqualTo(WAKEFULNESS_AWAKE);
 
         // Take a nap and verify.
         mService.getBinderServiceInstance().goToSleep(SystemClock.uptimeMillis(),
                 PowerManager.GO_TO_SLEEP_REASON_APPLICATION, 0);
-        assertThat(mService.getWakefulness()).isEqualTo(WAKEFULNESS_DOZING);
+        assertThat(mService.getWakefulnessLocked()).isEqualTo(WAKEFULNESS_DOZING);
     }
 
     @Test
@@ -546,12 +560,12 @@
         mService.onBootPhase(SystemService.PHASE_BOOT_COMPLETED);
 
         // Verify that we start awake
-        assertThat(mService.getWakefulness()).isEqualTo(WAKEFULNESS_AWAKE);
+        assertThat(mService.getWakefulnessLocked()).isEqualTo(WAKEFULNESS_AWAKE);
 
         // Grab the wakefulness value when PowerManager finally calls into the
         // native component to actually perform the suspend.
         when(mNativeWrapperMock.nativeForceSuspend()).then(inv -> {
-            assertThat(mService.getWakefulness()).isEqualTo(WAKEFULNESS_ASLEEP);
+            assertThat(mService.getWakefulnessLocked()).isEqualTo(WAKEFULNESS_ASLEEP);
             return true;
         });
 
@@ -559,7 +573,7 @@
         assertThat(retval).isTrue();
 
         // Still asleep when the function returns.
-        assertThat(mService.getWakefulness()).isEqualTo(WAKEFULNESS_ASLEEP);
+        assertThat(mService.getWakefulnessLocked()).isEqualTo(WAKEFULNESS_ASLEEP);
     }
 
     @Test
@@ -592,7 +606,7 @@
         mService.onBootPhase(SystemService.PHASE_BOOT_COMPLETED);
 
         // Verify that we start awake
-        assertThat(mService.getWakefulness()).isEqualTo(WAKEFULNESS_AWAKE);
+        assertThat(mService.getWakefulnessLocked()).isEqualTo(WAKEFULNESS_AWAKE);
 
         // Create a wakelock
         mService.getBinderServiceInstance().acquireWakeLock(new Binder(), flags, tag, pkg,
@@ -647,7 +661,7 @@
 
         // Start with AWAKE state
         startSystem();
-        assertThat(mService.getWakefulness()).isEqualTo(WAKEFULNESS_AWAKE);
+        assertThat(mService.getWakefulnessLocked()).isEqualTo(WAKEFULNESS_AWAKE);
         assertTrue(isAcquired[0]);
 
         // Take a nap and verify we no longer hold the blocker
@@ -657,7 +671,7 @@
         when(mDreamManagerInternalMock.isDreaming()).thenReturn(true);
         mService.getBinderServiceInstance().goToSleep(SystemClock.uptimeMillis(),
                 PowerManager.GO_TO_SLEEP_REASON_APPLICATION, 0);
-        assertThat(mService.getWakefulness()).isEqualTo(WAKEFULNESS_DOZING);
+        assertThat(mService.getWakefulnessLocked()).isEqualTo(WAKEFULNESS_DOZING);
         assertFalse(isAcquired[0]);
 
         // Override the display state by DreamManager and verify is reacquires the blocker.
@@ -737,7 +751,7 @@
         createService();
         startSystem();
         SystemClock.sleep(20);
-        assertThat(mService.getWakefulness()).isEqualTo(WAKEFULNESS_ASLEEP);
+        assertThat(mService.getWakefulnessLocked()).isEqualTo(WAKEFULNESS_ASLEEP);
     }
 
     @FlakyTest
@@ -757,7 +771,7 @@
                 null /* workSource */, null /* historyTag */);
 
         SystemClock.sleep(11);
-        assertThat(mService.getWakefulness()).isEqualTo(WAKEFULNESS_ASLEEP);
+        assertThat(mService.getWakefulnessLocked()).isEqualTo(WAKEFULNESS_ASLEEP);
     }
 
     @Test
@@ -765,7 +779,7 @@
         createService();
         startSystem();
 
-        assertThat(mService.getWakefulness()).isEqualTo(WAKEFULNESS_AWAKE);
+        assertThat(mService.getWakefulnessLocked()).isEqualTo(WAKEFULNESS_AWAKE);
         verify(mNotifierMock, never()).onWakefulnessChangeStarted(anyInt(), anyInt(), anyLong());
     }
 
@@ -784,7 +798,7 @@
         createService();
         startSystem();
 
-        assertThat(mService.getWakefulness()).isEqualTo(WAKEFULNESS_ASLEEP);
+        assertThat(mService.getWakefulnessLocked()).isEqualTo(WAKEFULNESS_ASLEEP);
         verify(mNotifierMock).onWakefulnessChangeStarted(eq(WAKEFULNESS_ASLEEP), anyInt(),
                 anyLong());
     }
diff --git a/services/tests/servicestests/src/com/android/server/power/ThermalManagerServiceTest.java b/services/tests/servicestests/src/com/android/server/power/ThermalManagerServiceTest.java
index ccf7ca9..624cb83 100644
--- a/services/tests/servicestests/src/com/android/server/power/ThermalManagerServiceTest.java
+++ b/services/tests/servicestests/src/com/android/server/power/ThermalManagerServiceTest.java
@@ -28,10 +28,12 @@
 import static org.mockito.Mockito.when;
 
 import android.content.Context;
+import android.hardware.thermal.V2_0.TemperatureThreshold;
 import android.os.CoolingDevice;
 import android.os.IBinder;
 import android.os.IPowerManager;
 import android.os.IThermalEventListener;
+import android.os.IThermalService;
 import android.os.IThermalStatusListener;
 import android.os.PowerManager;
 import android.os.RemoteException;
@@ -72,6 +74,8 @@
     @Mock
     private IPowerManager mIPowerManagerMock;
     @Mock
+    private IThermalService mIThermalServiceMock;
+    @Mock
     private IThermalEventListener mEventListener1;
     @Mock
     private IThermalEventListener mEventListener2;
@@ -133,6 +137,12 @@
         }
 
         @Override
+        protected List<TemperatureThreshold> getTemperatureThresholds(boolean shouldFilter,
+                int type) {
+            return new ArrayList<>();
+        }
+
+        @Override
         protected boolean connectToHal() {
             return true;
         }
@@ -153,7 +163,7 @@
     public void setUp() throws RemoteException {
         MockitoAnnotations.initMocks(this);
         mFakeHal = new ThermalHalFake();
-        mPowerManager = new PowerManager(mContext, mIPowerManagerMock, null);
+        mPowerManager = new PowerManager(mContext, mIPowerManagerMock, mIThermalServiceMock, null);
         when(mContext.getSystemServiceName(PowerManager.class)).thenReturn(Context.POWER_SERVICE);
         when(mContext.getSystemService(PowerManager.class)).thenReturn(mPowerManager);
         resetListenerMock();
diff --git a/services/tests/servicestests/src/com/android/server/power/batterysaver/BatterySaverPolicyTest.java b/services/tests/servicestests/src/com/android/server/power/batterysaver/BatterySaverPolicyTest.java
index 98cfc41..30ab9cd 100644
--- a/services/tests/servicestests/src/com/android/server/power/batterysaver/BatterySaverPolicyTest.java
+++ b/services/tests/servicestests/src/com/android/server/power/batterysaver/BatterySaverPolicyTest.java
@@ -78,6 +78,11 @@
             return mDeviceSpecificConfigResId;
         }
 
+        @Override
+        void invalidatePowerSaveModeCaches() {
+            // Avoids an SELinux denial.
+        }
+
         @VisibleForTesting
         void onChange() {
             onChange(true, null);
diff --git a/services/tests/servicestests/src/com/android/server/recoverysystem/RecoverySystemServiceTest.java b/services/tests/servicestests/src/com/android/server/recoverysystem/RecoverySystemServiceTest.java
index d5cdbeb..035a2f1 100644
--- a/services/tests/servicestests/src/com/android/server/recoverysystem/RecoverySystemServiceTest.java
+++ b/services/tests/servicestests/src/com/android/server/recoverysystem/RecoverySystemServiceTest.java
@@ -36,6 +36,7 @@
 import android.os.Handler;
 import android.os.IPowerManager;
 import android.os.IRecoverySystemProgressListener;
+import android.os.IThermalService;
 import android.os.Looper;
 import android.os.PowerManager;
 
@@ -62,6 +63,7 @@
     private RecoverySystemService.UncryptSocket mUncryptSocket;
     private Context mContext;
     private IPowerManager mIPowerManager;
+    private IThermalService mIThermalService;
     private FileWriter mUncryptUpdateFileWriter;
     private LockSettingsInternal mLockSettingsInternal;
 
@@ -77,8 +79,9 @@
 
         Looper looper = InstrumentationRegistry.getContext().getMainLooper();
         mIPowerManager = mock(IPowerManager.class);
+        mIThermalService = mock(IThermalService.class);
         PowerManager powerManager = new PowerManager(mock(Context.class), mIPowerManager,
-                new Handler(looper));
+                mIThermalService, new Handler(looper));
 
         mRecoverySystemService = new RecoverySystemServiceTestable(mContext, mSystemProperties,
                 powerManager, mUncryptUpdateFileWriter, mUncryptSocket, mLockSettingsInternal);
diff --git a/services/tests/uiservicestests/src/com/android/server/notification/NotificationManagerServiceTest.java b/services/tests/uiservicestests/src/com/android/server/notification/NotificationManagerServiceTest.java
index e5ffb4d..ccce043 100755
--- a/services/tests/uiservicestests/src/com/android/server/notification/NotificationManagerServiceTest.java
+++ b/services/tests/uiservicestests/src/com/android/server/notification/NotificationManagerServiceTest.java
@@ -359,8 +359,12 @@
 
     @Before
     public void setUp() throws Exception {
+        // Shell permisssions will override permissions of our app, so add all necessary permissions
+        // fo this test here:
         InstrumentationRegistry.getInstrumentation().getUiAutomation().adoptShellPermissionIdentity(
-                "android.permission.WRITE_DEVICE_CONFIG", "android.permission.READ_DEVICE_CONFIG");
+                "android.permission.WRITE_DEVICE_CONFIG",
+                "android.permission.READ_DEVICE_CONFIG",
+                "android.permission.READ_CONTACTS");
 
         MockitoAnnotations.initMocks(this);
 
@@ -2902,21 +2906,21 @@
     }
 
     @Test
-    public void testSetListenerAccess_doesNothingOnLowRam() throws Exception {
+    public void testSetListenerAccess_onLowRam() throws Exception {
         when(mActivityManager.isLowRamDevice()).thenReturn(true);
         ComponentName c = ComponentName.unflattenFromString("package/Component");
         mBinderService.setNotificationListenerAccessGranted(c, true);
 
-        verify(mListeners, never()).setPackageOrComponentEnabled(
+        verify(mListeners).setPackageOrComponentEnabled(
                 anyString(), anyInt(), anyBoolean(), anyBoolean());
-        verify(mConditionProviders, never()).setPackageOrComponentEnabled(
+        verify(mConditionProviders).setPackageOrComponentEnabled(
                 anyString(), anyInt(), anyBoolean(), anyBoolean());
-        verify(mAssistants, never()).setPackageOrComponentEnabled(
-                any(), anyInt(), anyBoolean(), anyBoolean());
+        verify(mAssistants).migrateToXml();
+        verify(mAssistants).resetDefaultAssistantsIfNecessary();
     }
 
     @Test
-    public void testSetAssistantAccess_doesNothingOnLowRam() throws Exception {
+    public void testSetAssistantAccess_onLowRam() throws Exception {
         when(mActivityManager.isLowRamDevice()).thenReturn(true);
         ComponentName c = ComponentName.unflattenFromString("package/Component");
         List<UserInfo> uis = new ArrayList<>();
@@ -2927,26 +2931,28 @@
 
         mBinderService.setNotificationAssistantAccessGranted(c, true);
 
-        verify(mListeners, never()).setPackageOrComponentEnabled(
+        verify(mListeners).migrateToXml();
+        verify(mListeners).notifyNotificationChannelChanged(anyString(), any(), any(),
+                anyInt());
+        verify(mConditionProviders).setPackageOrComponentEnabled(
                 anyString(), anyInt(), anyBoolean(), anyBoolean());
-        verify(mConditionProviders, never()).setPackageOrComponentEnabled(
-                anyString(), anyInt(), anyBoolean(), anyBoolean());
-        verify(mAssistants, never()).setPackageOrComponentEnabled(
-                any(), anyInt(), anyBoolean(), anyBoolean());
+        verify(mAssistants).migrateToXml();
+        verify(mAssistants).resetDefaultAssistantsIfNecessary();
     }
 
     @Test
-    public void testSetDndAccess_doesNothingOnLowRam() throws Exception {
+    public void testSetDndAccess_onLowRam() throws Exception {
         when(mActivityManager.isLowRamDevice()).thenReturn(true);
         ComponentName c = ComponentName.unflattenFromString("package/Component");
         mBinderService.setNotificationPolicyAccessGranted(c.getPackageName(), true);
 
-        verify(mListeners, never()).setPackageOrComponentEnabled(
+        verify(mListeners).migrateToXml();
+        verify(mListeners).notifyNotificationChannelChanged(anyString(), any(), any(),
+                anyInt());
+        verify(mConditionProviders).setPackageOrComponentEnabled(
                 anyString(), anyInt(), anyBoolean(), anyBoolean());
-        verify(mConditionProviders, never()).setPackageOrComponentEnabled(
-                anyString(), anyInt(), anyBoolean(), anyBoolean());
-        verify(mAssistants, never()).setPackageOrComponentEnabled(
-                any(), anyInt(), anyBoolean(), anyBoolean());
+        verify(mAssistants).migrateToXml();
+        verify(mAssistants).resetDefaultAssistantsIfNecessary();
     }
 
     @Test
@@ -4288,68 +4294,13 @@
     }
 
     @Test
-    public void testCanUseManagedServicesLowRamNoWatchNullPkg() {
-        when(mPackageManagerClient.hasSystemFeature(FEATURE_WATCH)).thenReturn(false);
-        when(mActivityManager.isLowRamDevice()).thenReturn(true);
-        when(mResources.getStringArray(R.array.config_allowedManagedServicesOnLowRamDevices))
-                .thenReturn(new String[] {"a", "b", "c"});
-        when(mContext.getResources()).thenReturn(mResources);
-
-        assertEquals(false, mService.canUseManagedServices(null, 0, null));
+    public void testCanUseManagedServicesNullPkg() {
+        assertEquals(true, mService.canUseManagedServices(null, 0, null));
     }
 
-    @Test
-    public void testCanUseManagedServicesLowRamNoWatchValidPkg() {
-        when(mPackageManagerClient.hasSystemFeature(FEATURE_WATCH)).thenReturn(false);
-        when(mActivityManager.isLowRamDevice()).thenReturn(true);
-        when(mResources.getStringArray(R.array.config_allowedManagedServicesOnLowRamDevices))
-                .thenReturn(new String[] {"a", "b", "c"});
-        when(mContext.getResources()).thenReturn(mResources);
-
-        assertEquals(true, mService.canUseManagedServices("b", 0, null));
-    }
 
     @Test
-    public void testCanUseManagedServicesLowRamNoWatchNoValidPkg() {
-        when(mPackageManagerClient.hasSystemFeature(FEATURE_WATCH)).thenReturn(false);
-        when(mActivityManager.isLowRamDevice()).thenReturn(true);
-        when(mResources.getStringArray(R.array.config_allowedManagedServicesOnLowRamDevices))
-                .thenReturn(new String[] {"a", "b", "c"});
-        when(mContext.getResources()).thenReturn(mResources);
-
-        assertEquals(false, mService.canUseManagedServices("d", 0, null));
-    }
-
-    @Test
-    public void testCanUseManagedServicesLowRamWatchNoValidPkg() {
-        when(mPackageManagerClient.hasSystemFeature(FEATURE_WATCH)).thenReturn(true);
-        when(mActivityManager.isLowRamDevice()).thenReturn(true);
-        when(mResources.getStringArray(R.array.config_allowedManagedServicesOnLowRamDevices))
-                .thenReturn(new String[] {"a", "b", "c"});
-        when(mContext.getResources()).thenReturn(mResources);
-
-        assertEquals(true, mService.canUseManagedServices("d", 0, null));
-    }
-
-    @Test
-    public void testCanUseManagedServicesNoLowRamNoWatchValidPkg() {
-        when(mPackageManagerClient.hasSystemFeature(FEATURE_WATCH)).thenReturn(false);
-        when(mActivityManager.isLowRamDevice()).thenReturn(false);
-        when(mResources.getStringArray(R.array.config_allowedManagedServicesOnLowRamDevices))
-                .thenReturn(new String[] {"a", "b", "c"});
-        when(mContext.getResources()).thenReturn(mResources);
-
-        assertEquals(true, mService.canUseManagedServices("d", 0 , null));
-    }
-
-    @Test
-    public void testCanUseManagedServicesNoLowRamWatchValidPkg() {
-        when(mPackageManagerClient.hasSystemFeature(FEATURE_WATCH)).thenReturn(true);
-        when(mActivityManager.isLowRamDevice()).thenReturn(false);
-        when(mResources.getStringArray(R.array.config_allowedManagedServicesOnLowRamDevices))
-                .thenReturn(new String[] {"a", "b", "c"});
-        when(mContext.getResources()).thenReturn(mResources);
-
+    public void testCanUseManagedServicesNoValidPkg() {
         assertEquals(true, mService.canUseManagedServices("d", 0, null));
     }
 
diff --git a/services/tests/uiservicestests/src/com/android/server/notification/NotificationTest.java b/services/tests/uiservicestests/src/com/android/server/notification/NotificationTest.java
index 0ea53fa..d765042 100644
--- a/services/tests/uiservicestests/src/com/android/server/notification/NotificationTest.java
+++ b/services/tests/uiservicestests/src/com/android/server/notification/NotificationTest.java
@@ -22,9 +22,7 @@
 
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
-import static org.mockito.Matchers.anyInt;
 import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.spy;
 import static org.mockito.Mockito.when;
 
 import android.app.ActivityManager;
@@ -32,15 +30,12 @@
 import android.app.PendingIntent;
 import android.app.Person;
 import android.app.RemoteInput;
-import android.content.Context;
-import android.content.pm.ApplicationInfo;
 import android.content.res.Resources;
 import android.graphics.Bitmap;
 import android.graphics.Color;
 import android.graphics.Typeface;
 import android.graphics.drawable.Icon;
 import android.net.Uri;
-import android.os.Build;
 import android.text.SpannableStringBuilder;
 import android.text.Spanned;
 import android.text.style.StyleSpan;
@@ -74,91 +69,13 @@
     }
 
     @Test
-    public void testStripsExtendersInLowRamModeNoWhitelistNoTv() {
+    public void testDoesNotStripsExtenders() {
         Notification.Builder nb = new Notification.Builder(mContext, "channel");
         nb.extend(new Notification.CarExtender().setColor(Color.RED));
         nb.extend(new Notification.TvExtender().setChannelId("different channel"));
         nb.extend(new Notification.WearableExtender().setDismissalId("dismiss"));
         Notification before = nb.build();
-
-        // No whitelist
-        Context context = spy(getContext());
-        when(context.getResources()).thenReturn(mResources);
-        when(mResources.getStringArray(anyInt())).thenReturn(new String[0]);
-
-        Notification after = Notification.Builder.maybeCloneStrippedForDelivery(before, true,
-                context);
-
-        assertEquals("different channel", new Notification.TvExtender(before).getChannelId());
-        assertNull(new Notification.TvExtender(after).getChannelId());
-
-        assertEquals(Color.RED, new Notification.CarExtender(before).getColor());
-        assertEquals(Notification.COLOR_DEFAULT, new Notification.CarExtender(after).getColor());
-
-        assertEquals("dismiss", new Notification.WearableExtender(before).getDismissalId());
-        assertNull(new Notification.WearableExtender(after).getDismissalId());
-    }
-
-    @Test
-    public void testStripsExtendersInLowRamModeHasWhitelist() {
-        Notification.Builder nb = new Notification.Builder(mContext, "channel");
-        nb.extend(new Notification.CarExtender().setColor(Color.RED));
-        nb.extend(new Notification.TvExtender().setChannelId("different channel"));
-        nb.extend(new Notification.WearableExtender().setDismissalId("dismiss"));
-        Notification before = nb.build();
-
-        // Has whitelist
-        Context context = spy(mContext);
-        when(context.getResources()).thenReturn(mResources);
-        when(mResources.getStringArray(anyInt())).thenReturn(new String[1]);
-
-        Notification after = Notification.Builder.maybeCloneStrippedForDelivery(before, true,
-                context);
-
-        assertEquals("different channel", new Notification.TvExtender(before).getChannelId());
-        assertEquals("different channel", new Notification.TvExtender(after).getChannelId());
-
-        assertEquals(Color.RED, new Notification.CarExtender(before).getColor());
-        assertEquals(Color.RED, new Notification.CarExtender(after).getColor());
-
-        assertEquals("dismiss", new Notification.WearableExtender(before).getDismissalId());
-        assertEquals("dismiss", new Notification.WearableExtender(after).getDismissalId());
-    }
-
-    @Test
-    public void testStripsRemoteViewsInLowRamMode() {
-        Context context = spy(mContext);
-        ApplicationInfo ai = new ApplicationInfo();
-        ai.targetSdkVersion = Build.VERSION_CODES.M;
-        when(context.getApplicationInfo()).thenReturn(ai);
-
-        final Notification.BigTextStyle style = new Notification.BigTextStyle()
-                .bigText("hello")
-                .setSummaryText("And the summary");
-        Notification before = new Notification.Builder(context, "channel")
-                .setContentText("hi")
-                .setStyle(style)
-                .build();
-
-        Notification after = Notification.Builder.maybeCloneStrippedForDelivery(before, true,
-                mContext);
-        assertNotNull(before.contentView);
-        assertNotNull(before.bigContentView);
-        assertNotNull(before.headsUpContentView);
-        assertNull(after.contentView);
-        assertNull(after.bigContentView);
-        assertNull(after.headsUpContentView);
-    }
-
-    @Test
-    public void testDoesNotStripsExtendersInNormalRamMode() {
-        Notification.Builder nb = new Notification.Builder(mContext, "channel");
-        nb.extend(new Notification.CarExtender().setColor(Color.RED));
-        nb.extend(new Notification.TvExtender().setChannelId("different channel"));
-        nb.extend(new Notification.WearableExtender().setDismissalId("dismiss"));
-        Notification before = nb.build();
-        Notification after = Notification.Builder.maybeCloneStrippedForDelivery(before, false,
-                mContext);
+        Notification after = Notification.Builder.maybeCloneStrippedForDelivery(before);
 
         assertTrue(before == after);
 
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 0adf15c..7f9732b 100644
--- a/services/tests/uiservicestests/src/com/android/server/notification/PreferencesHelperTest.java
+++ b/services/tests/uiservicestests/src/com/android/server/notification/PreferencesHelperTest.java
@@ -108,6 +108,7 @@
     private static final int UID_N_MR1 = 0;
     private static final UserHandle USER = UserHandle.of(0);
     private static final int UID_O = 1111;
+    private static final int UID_P = 2222;
     private static final String SYSTEM_PKG = "android";
     private static final int SYSTEM_UID = 1000;
     private static final UserHandle USER2 = UserHandle.of(10);
@@ -141,9 +142,11 @@
         upgrade.targetSdkVersion = Build.VERSION_CODES.O;
         when(mPm.getApplicationInfoAsUser(eq(PKG_N_MR1), anyInt(), anyInt())).thenReturn(legacy);
         when(mPm.getApplicationInfoAsUser(eq(PKG_O), anyInt(), anyInt())).thenReturn(upgrade);
+        when(mPm.getApplicationInfoAsUser(eq(PKG_P), anyInt(), anyInt())).thenReturn(upgrade);
         when(mPm.getApplicationInfoAsUser(eq(SYSTEM_PKG), anyInt(), anyInt())).thenReturn(upgrade);
         when(mPm.getPackageUidAsUser(eq(PKG_N_MR1), anyInt())).thenReturn(UID_N_MR1);
         when(mPm.getPackageUidAsUser(eq(PKG_O), anyInt())).thenReturn(UID_O);
+        when(mPm.getPackageUidAsUser(eq(PKG_P), anyInt())).thenReturn(UID_P);
         when(mPm.getPackageUidAsUser(eq(SYSTEM_PKG), anyInt())).thenReturn(SYSTEM_UID);
         PackageInfo info = mock(PackageInfo.class);
         info.signatures = new Signature[] {mock(Signature.class)};
@@ -2945,6 +2948,92 @@
     }
 
     @Test
+    public void testGetConversations_all() {
+        String convoId = "convo";
+        NotificationChannel messages =
+                new NotificationChannel("messages", "Messages", IMPORTANCE_DEFAULT);
+        mHelper.createNotificationChannel(PKG_O, UID_O, messages, true, false);
+        NotificationChannel calls =
+                new NotificationChannel("calls", "Calls", IMPORTANCE_DEFAULT);
+        mHelper.createNotificationChannel(PKG_O, UID_O, calls, true, false);
+        NotificationChannel p =
+                new NotificationChannel("p calls", "Calls", IMPORTANCE_DEFAULT);
+        mHelper.createNotificationChannel(PKG_P, UID_P, p, true, false);
+
+        NotificationChannel channel =
+                new NotificationChannel("A person msgs", "messages from A", IMPORTANCE_DEFAULT);
+        channel.setConversationId(messages.getId(), convoId);
+        mHelper.createNotificationChannel(PKG_O, UID_O, channel, true, false);
+
+        NotificationChannel diffConvo =
+                new NotificationChannel("B person msgs", "messages from B", IMPORTANCE_DEFAULT);
+        diffConvo.setConversationId(p.getId(), "different convo");
+        mHelper.createNotificationChannel(PKG_P, UID_P, diffConvo, true, false);
+
+        NotificationChannel channel2 =
+                new NotificationChannel("A person calls", "calls from A", IMPORTANCE_DEFAULT);
+        channel2.setConversationId(calls.getId(), convoId);
+        channel2.setImportantConversation(true);
+        mHelper.createNotificationChannel(PKG_O, UID_O, channel2, true, false);
+
+        List<ConversationChannelWrapper> convos = mHelper.getConversations(false);
+
+        assertEquals(3, convos.size());
+        assertTrue(conversationWrapperContainsChannel(convos, channel));
+        assertTrue(conversationWrapperContainsChannel(convos, diffConvo));
+        assertTrue(conversationWrapperContainsChannel(convos, channel2));
+    }
+
+    @Test
+    public void testGetConversations_onlyImportant() {
+        String convoId = "convo";
+        NotificationChannel messages =
+                new NotificationChannel("messages", "Messages", IMPORTANCE_DEFAULT);
+        mHelper.createNotificationChannel(PKG_O, UID_O, messages, true, false);
+        NotificationChannel calls =
+                new NotificationChannel("calls", "Calls", IMPORTANCE_DEFAULT);
+        mHelper.createNotificationChannel(PKG_O, UID_O, calls, true, false);
+        NotificationChannel p =
+                new NotificationChannel("p calls", "Calls", IMPORTANCE_DEFAULT);
+        mHelper.createNotificationChannel(PKG_P, UID_P, p, true, false);
+
+        NotificationChannel channel =
+                new NotificationChannel("A person msgs", "messages from A", IMPORTANCE_DEFAULT);
+        channel.setConversationId(messages.getId(), convoId);
+        channel.setImportantConversation(true);
+        mHelper.createNotificationChannel(PKG_O, UID_O, channel, true, false);
+
+        NotificationChannel diffConvo =
+                new NotificationChannel("B person msgs", "messages from B", IMPORTANCE_DEFAULT);
+        diffConvo.setConversationId(p.getId(), "different convo");
+        diffConvo.setImportantConversation(true);
+        mHelper.createNotificationChannel(PKG_P, UID_P, diffConvo, true, false);
+
+        NotificationChannel channel2 =
+                new NotificationChannel("A person calls", "calls from A", IMPORTANCE_DEFAULT);
+        channel2.setConversationId(calls.getId(), convoId);
+        mHelper.createNotificationChannel(PKG_O, UID_O, channel2, true, false);
+
+        List<ConversationChannelWrapper> convos = mHelper.getConversations(true);
+
+        assertEquals(2, convos.size());
+        assertTrue(conversationWrapperContainsChannel(convos, channel));
+        assertTrue(conversationWrapperContainsChannel(convos, diffConvo));
+        assertFalse(conversationWrapperContainsChannel(convos, channel2));
+    }
+
+    private boolean conversationWrapperContainsChannel(List<ConversationChannelWrapper> list,
+            NotificationChannel expected) {
+        for (ConversationChannelWrapper ccw : list) {
+            if (ccw.getNotificationChannel().equals(expected)) {
+                return true;
+            }
+        }
+
+        return false;
+    }
+
+    @Test
     public void testGetConversations_invalidPkg() {
         assertThat(mHelper.getConversations("bad", 1)).isEmpty();
     }
diff --git a/services/tests/wmtests/src/com/android/server/wm/ActivityStarterTests.java b/services/tests/wmtests/src/com/android/server/wm/ActivityStarterTests.java
index fa182d6..b917e1b 100644
--- a/services/tests/wmtests/src/com/android/server/wm/ActivityStarterTests.java
+++ b/services/tests/wmtests/src/com/android/server/wm/ActivityStarterTests.java
@@ -29,6 +29,7 @@
 import static android.app.ActivityManager.START_SWITCHES_CANCELED;
 import static android.app.ActivityManager.START_TASK_TO_FRONT;
 import static android.app.WindowConfiguration.ACTIVITY_TYPE_STANDARD;
+import static android.app.WindowConfiguration.ACTIVITY_TYPE_UNDEFINED;
 import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN;
 import static android.app.WindowConfiguration.WINDOWING_MODE_PINNED;
 import static android.app.WindowConfiguration.WINDOWING_MODE_SPLIT_SCREEN_PRIMARY;
@@ -64,8 +65,10 @@
 import static org.mockito.ArgumentMatchers.anyString;
 import static org.mockito.ArgumentMatchers.eq;
 
+import android.app.ActivityManager;
 import android.app.ActivityOptions;
 import android.app.IApplicationThread;
+import android.app.WindowConfiguration;
 import android.content.ComponentName;
 import android.content.Intent;
 import android.content.pm.ActivityInfo;
@@ -80,6 +83,9 @@
 import android.platform.test.annotations.Presubmit;
 import android.service.voice.IVoiceInteractionSession;
 import android.view.Gravity;
+import android.view.ITaskOrganizer;
+import android.view.IWindowContainer;
+import android.view.SurfaceControl;
 
 import androidx.test.filters.SmallTest;
 
@@ -372,7 +378,7 @@
         doReturn(mMockPackageManager).when(mService).getPackageManagerInternalLocked();
         doReturn(false).when(mMockPackageManager).isInstantAppInstallerComponent(any());
         doReturn(null).when(mMockPackageManager).resolveIntent(any(), any(), anyInt(), anyInt(),
-                anyBoolean(), anyInt());
+                anyInt(), anyBoolean(), anyInt());
 
         // Never review permissions
         doReturn(false).when(mMockPackageManager).isPermissionsReviewRequired(any(), anyInt());
@@ -999,7 +1005,8 @@
         assertThat(outActivity[0].inSplitScreenWindowingMode()).isFalse();
 
         // Move activity to split-screen-primary stack and make sure it has the focus.
-        top.getRootTask().setWindowingMode(WINDOWING_MODE_SPLIT_SCREEN_PRIMARY);
+        TestSplitOrganizer splitOrg = new TestSplitOrganizer(mService, top.getDisplayId());
+        splitOrg.mPrimary.addChild(top.getRootTask(), 0 /* index */);
         top.getRootTask().moveToFront("testWindowingModeOptionsLaunchAdjacent");
 
         // Activity must landed on split-screen-secondary when launch adjacent.
@@ -1022,4 +1029,58 @@
 
         verify(recentTasks, times(1)).add(any());
     }
+
+    static class TestSplitOrganizer extends ITaskOrganizer.Stub {
+        final ActivityTaskManagerService mService;
+        TaskTile mPrimary;
+        TaskTile mSecondary;
+        boolean mInSplit = false;
+        int mDisplayId;
+        TestSplitOrganizer(ActivityTaskManagerService service, int displayId) {
+            mService = service;
+            mDisplayId = displayId;
+            mService.mTaskOrganizerController.registerTaskOrganizer(this,
+                    WINDOWING_MODE_SPLIT_SCREEN_PRIMARY);
+            mService.mTaskOrganizerController.registerTaskOrganizer(this,
+                    WINDOWING_MODE_SPLIT_SCREEN_SECONDARY);
+            IWindowContainer primary = mService.mTaskOrganizerController.createRootTask(
+                    displayId, WINDOWING_MODE_SPLIT_SCREEN_PRIMARY).token;
+            mPrimary = TaskTile.forToken(primary.asBinder());
+            IWindowContainer secondary = mService.mTaskOrganizerController.createRootTask(
+                    displayId, WINDOWING_MODE_SPLIT_SCREEN_SECONDARY).token;
+            mSecondary = TaskTile.forToken(secondary.asBinder());
+        }
+        @Override
+        public void taskAppeared(ActivityManager.RunningTaskInfo info) {
+        }
+        @Override
+        public void taskVanished(IWindowContainer wc) {
+        }
+        @Override
+        public void transactionReady(int id, SurfaceControl.Transaction t) {
+        }
+        @Override
+        public void onTaskInfoChanged(ActivityManager.RunningTaskInfo info) {
+            if (mInSplit) {
+                return;
+            }
+            if (info.topActivityType != ACTIVITY_TYPE_UNDEFINED) {
+                if (info.configuration.windowConfiguration.getWindowingMode()
+                        == WINDOWING_MODE_SPLIT_SCREEN_PRIMARY) {
+                    mInSplit = true;
+                    mService.mTaskOrganizerController.setLaunchRoot(mDisplayId,
+                            mSecondary.mRemoteToken);
+                    // move everything to secondary because test expects this but usually sysui
+                    // does it.
+                    DisplayContent dc = mService.mRootWindowContainer.getDisplayContent(mDisplayId);
+                    for (int i = dc.getStackCount() - 1; i >= 0; --i) {
+                        if (!WindowConfiguration.isSplitScreenWindowingMode(
+                                dc.getStackAt(i).getWindowingMode())) {
+                            mSecondary.addChild(dc.getStackAt(i), 0);
+                        }
+                    }
+                }
+            }
+        }
+    };
 }
diff --git a/services/tests/wmtests/src/com/android/server/wm/AppWindowTokenTests.java b/services/tests/wmtests/src/com/android/server/wm/AppWindowTokenTests.java
index 70e5ee7..683fca4 100644
--- a/services/tests/wmtests/src/com/android/server/wm/AppWindowTokenTests.java
+++ b/services/tests/wmtests/src/com/android/server/wm/AppWindowTokenTests.java
@@ -209,6 +209,7 @@
     }
 
     @Test
+    @FlakyTest(bugId = 149760957)
     public void testSizeCompatBounds() {
         // Disable the real configuration resolving because we only simulate partial flow.
         // TODO: Have test use full flow.
diff --git a/services/tests/wmtests/src/com/android/server/wm/DisplayAreaPolicyBuilderTest.java b/services/tests/wmtests/src/com/android/server/wm/DisplayAreaPolicyBuilderTest.java
index 8ac1d24..cc9173a 100644
--- a/services/tests/wmtests/src/com/android/server/wm/DisplayAreaPolicyBuilderTest.java
+++ b/services/tests/wmtests/src/com/android/server/wm/DisplayAreaPolicyBuilderTest.java
@@ -40,6 +40,8 @@
 import android.platform.test.annotations.Presubmit;
 import android.view.SurfaceControl;
 
+import androidx.test.filters.FlakyTest;
+
 import org.hamcrest.CustomTypeSafeMatcher;
 import org.hamcrest.Description;
 import org.hamcrest.Matcher;
@@ -65,6 +67,7 @@
     private TestWindowManagerPolicy mPolicy = new TestWindowManagerPolicy(null, null);
 
     @Test
+    @FlakyTest(bugId = 149760939)
     public void testBuilder() {
         WindowManagerService wms = mSystemServices.getWindowManagerService();
         DisplayArea.Root root = new SurfacelessDisplayAreaRoot(wms);
diff --git a/services/tests/wmtests/src/com/android/server/wm/DisplayPolicyLayoutTests.java b/services/tests/wmtests/src/com/android/server/wm/DisplayPolicyLayoutTests.java
index c19312d..ba57745 100644
--- a/services/tests/wmtests/src/com/android/server/wm/DisplayPolicyLayoutTests.java
+++ b/services/tests/wmtests/src/com/android/server/wm/DisplayPolicyLayoutTests.java
@@ -599,6 +599,7 @@
     }
 
     @Test
+    @FlakyTest(bugId = 149760800)
     public void layoutWindowLw_withLongEdgeDisplayCutout() {
         addLongEdgeDisplayCutout();
 
@@ -618,6 +619,7 @@
     }
 
     @Test
+    @FlakyTest(bugId = 149760800)
     public void layoutWindowLw_withLongEdgeDisplayCutout_never() {
         addLongEdgeDisplayCutout();
 
diff --git a/services/tests/wmtests/src/com/android/server/wm/RecentTasksTest.java b/services/tests/wmtests/src/com/android/server/wm/RecentTasksTest.java
index a672a95..4449069 100644
--- a/services/tests/wmtests/src/com/android/server/wm/RecentTasksTest.java
+++ b/services/tests/wmtests/src/com/android/server/wm/RecentTasksTest.java
@@ -1098,7 +1098,6 @@
         assertSecurityException(expectCallable,
                 () -> mService.setTaskWindowingModeSplitScreenPrimary(0,
                         SPLIT_SCREEN_CREATE_MODE_TOP_OR_LEFT, true, true, new Rect(), true));
-        assertSecurityException(expectCallable, () -> mService.dismissSplitScreenMode(true));
         assertSecurityException(expectCallable, () -> mService.dismissPip(true, 0));
         assertSecurityException(expectCallable,
                 () -> mService.moveTopActivityToPinnedStack(INVALID_STACK_ID, new Rect()));
diff --git a/services/tests/wmtests/src/com/android/server/wm/RecentsAnimationControllerTest.java b/services/tests/wmtests/src/com/android/server/wm/RecentsAnimationControllerTest.java
index 7753a32..6a8917c 100644
--- a/services/tests/wmtests/src/com/android/server/wm/RecentsAnimationControllerTest.java
+++ b/services/tests/wmtests/src/com/android/server/wm/RecentsAnimationControllerTest.java
@@ -20,7 +20,9 @@
 import static android.app.WindowConfiguration.ACTIVITY_TYPE_STANDARD;
 import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN;
 import static android.view.Display.DEFAULT_DISPLAY;
+import static android.view.WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER;
 import static android.view.WindowManager.LayoutParams.TYPE_BASE_APPLICATION;
+import static android.view.WindowManager.LayoutParams.TYPE_WALLPAPER;
 import static android.view.WindowManager.TRANSIT_ACTIVITY_CLOSE;
 
 import static com.android.dx.mockito.inline.extended.ExtendedMockito.atLeast;
@@ -53,6 +55,8 @@
 import static org.mockito.Mockito.never;
 
 import android.app.ActivityManager.TaskSnapshot;
+import android.content.pm.ActivityInfo;
+import android.content.res.Configuration;
 import android.os.Binder;
 import android.os.IBinder;
 import android.os.IInterface;
@@ -65,12 +69,16 @@
 
 import com.android.server.wm.SurfaceAnimator.OnAnimationFinishedCallback;
 
+import com.google.common.truth.Truth;
+
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.mockito.Mock;
 import org.mockito.MockitoAnnotations;
 
+import java.util.ArrayList;
+
 /**
  * Build/Install/Run:
  *  atest WmTests:RecentsAnimationControllerTest
@@ -330,6 +338,107 @@
         assertTrue(activity.shouldAnimate(TRANSIT_ACTIVITY_CLOSE));
     }
 
+    @Test
+    public void testRecentViewInFixedPortraitWhenTopAppInLandscape() {
+        mWm.mIsFixedRotationTransformEnabled = true;
+        mWm.setRecentsAnimationController(mController);
+
+        final ActivityStack homeStack = mDisplayContent.getOrCreateStack(
+                WINDOWING_MODE_FULLSCREEN, ACTIVITY_TYPE_HOME, ON_TOP);
+        final ActivityRecord homeAppWindow =
+                new ActivityTestsBase.ActivityBuilder(mWm.mAtmService)
+                        .setStack(homeStack)
+                        .setCreateTask(true)
+                        .build();
+        final ActivityRecord appWindow = createActivityRecord(mDisplayContent,
+                WINDOWING_MODE_FULLSCREEN, ACTIVITY_TYPE_STANDARD);
+        final WindowState win0 = createWindow(null, TYPE_BASE_APPLICATION, appWindow, "win1");
+        appWindow.addWindow(win0);
+
+        final ActivityRecord landActivity = createActivityRecord(mDisplayContent,
+                WINDOWING_MODE_FULLSCREEN, ACTIVITY_TYPE_STANDARD);
+        landActivity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
+        final WindowState win1 = createWindow(null, TYPE_BASE_APPLICATION, landActivity, "win1");
+        landActivity.addWindow(win1);
+
+        assertEquals(landActivity.getTask().getTopVisibleActivity(), landActivity);
+        assertEquals(landActivity.findMainWindow(), win1);
+
+        // Ensure that the display is in Landscape
+        landActivity.onDescendantOrientationChanged(landActivity.token, landActivity);
+        assertEquals(Configuration.ORIENTATION_LANDSCAPE,
+                mDisplayContent.getConfiguration().orientation);
+
+        mController.initialize(ACTIVITY_TYPE_HOME, new SparseBooleanArray(), homeAppWindow);
+
+        // Check that the home app is in portrait
+        assertEquals(Configuration.ORIENTATION_PORTRAIT,
+                homeAppWindow.getConfiguration().orientation);
+    }
+
+    @Test
+    public void testWallpaperHasFixedRotationApplied() {
+        mWm.mIsFixedRotationTransformEnabled = true;
+        mWm.setRecentsAnimationController(mController);
+
+        // Create a portrait home stack, a wallpaper and a landscape application displayed on top.
+
+        // Home stack
+        final ActivityStack homeStack = mDisplayContent.getOrCreateStack(
+                WINDOWING_MODE_FULLSCREEN, ACTIVITY_TYPE_HOME, ON_TOP);
+        final ActivityRecord homeActivity =
+                new ActivityTestsBase.ActivityBuilder(mWm.mAtmService)
+                        .setStack(homeStack)
+                        .setCreateTask(true)
+                        .build();
+        homeActivity.setOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
+
+        final WindowState homeWindow = createWindow(null, TYPE_BASE_APPLICATION, homeActivity,
+                "homeWindow");
+        homeActivity.addWindow(homeWindow);
+        homeWindow.getAttrs().flags |= FLAG_SHOW_WALLPAPER;
+
+        // Landscape application
+        final ActivityRecord activity = createActivityRecord(mDisplayContent,
+                WINDOWING_MODE_FULLSCREEN, ACTIVITY_TYPE_STANDARD);
+        final WindowState applicationWindow = createWindow(null, TYPE_BASE_APPLICATION, activity,
+                "applicationWindow");
+        activity.addWindow(applicationWindow);
+        activity.setOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
+
+        // Wallpaper
+        final WallpaperWindowToken wallpaperWindowToken = new WallpaperWindowToken(mWm,
+                mock(IBinder.class), true, mDisplayContent, true /* ownerCanManageAppTokens */);
+        final WindowState wallpaperWindow = createWindow(null, TYPE_WALLPAPER, wallpaperWindowToken,
+                "wallpaperWindow");
+
+        // Make sure the landscape activity is on top and the display is in landscape
+        activity.moveFocusableActivityToTop("test");
+        mDisplayContent.getConfiguration().windowConfiguration.setRotation(
+                mDisplayContent.getRotation());
+
+
+        spyOn(mDisplayContent.mWallpaperController);
+        doReturn(true).when(mDisplayContent.mWallpaperController).isWallpaperVisible();
+
+        // Start the recents animation
+        mController
+                .initialize(ACTIVITY_TYPE_HOME, new SparseBooleanArray(), homeActivity);
+
+        mDisplayContent.mWallpaperController.adjustWallpaperWindows();
+
+        // Check preconditions
+        ArrayList<WallpaperWindowToken> wallpapers = new ArrayList<>(1);
+        mDisplayContent.forAllWallpaperWindows(wallpapers::add);
+
+        Truth.assertThat(wallpapers).hasSize(1);
+        Truth.assertThat(wallpapers.get(0).getTopChild()).isEqualTo(wallpaperWindow);
+
+        // Actual check
+        assertEquals(Configuration.ORIENTATION_PORTRAIT,
+                wallpapers.get(0).getConfiguration().orientation);
+    }
+
     private static void verifyNoMoreInteractionsExceptAsBinder(IInterface binder) {
         verify(binder, atLeast(0)).asBinder();
         verifyNoMoreInteractions(binder);
diff --git a/services/tests/wmtests/src/com/android/server/wm/StubTransaction.java b/services/tests/wmtests/src/com/android/server/wm/StubTransaction.java
index eda1fb8..851b052 100644
--- a/services/tests/wmtests/src/com/android/server/wm/StubTransaction.java
+++ b/services/tests/wmtests/src/com/android/server/wm/StubTransaction.java
@@ -255,4 +255,14 @@
             int priority) {
         return this;
     }
+
+    @Override
+    public SurfaceControl.Transaction unsetColor(SurfaceControl sc) {
+        return this;
+    }
+
+    @Override
+    public SurfaceControl.Transaction setShadowRadius(SurfaceControl sc, float shadowRadius) {
+        return this;
+    }
 }
diff --git a/services/tests/wmtests/src/com/android/server/wm/SystemServicesTestRule.java b/services/tests/wmtests/src/com/android/server/wm/SystemServicesTestRule.java
index 8ad7505..55d12db 100644
--- a/services/tests/wmtests/src/com/android/server/wm/SystemServicesTestRule.java
+++ b/services/tests/wmtests/src/com/android/server/wm/SystemServicesTestRule.java
@@ -137,6 +137,7 @@
                         }
                         throw t;
                     }
+                    if (throwable != null) throw throwable;
                 }
             }
         };
diff --git a/services/tests/wmtests/src/com/android/server/wm/SystemServicesTestRuleTest.java b/services/tests/wmtests/src/com/android/server/wm/SystemServicesTestRuleTest.java
new file mode 100644
index 0000000..4056c71
--- /dev/null
+++ b/services/tests/wmtests/src/com/android/server/wm/SystemServicesTestRuleTest.java
@@ -0,0 +1,74 @@
+/*
+ * 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.server.wm;
+
+import static junit.framework.Assert.assertTrue;
+
+import android.platform.test.annotations.Presubmit;
+
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.junit.runners.model.Statement;
+
+import java.io.IOException;
+
+@Presubmit
+public class SystemServicesTestRuleTest {
+    @Rule
+    public ExpectedException mExpectedException = ExpectedException.none();
+
+    @Test
+    public void testRule_rethrows_unchecked_exceptions() throws Throwable {
+        final SystemServicesTestRule mWmsRule = new SystemServicesTestRule();
+        Statement statement = new Statement() {
+            @Override
+            public void evaluate() throws Throwable {
+                throw new RuntimeException("A failing test!");
+            }
+        };
+        mExpectedException.expect(RuntimeException.class);
+        mWmsRule.apply(statement, null /* Description*/).evaluate();
+    }
+
+    @Test
+    public void testRule_rethrows_checked_exceptions() throws Throwable {
+        final SystemServicesTestRule mWmsRule = new SystemServicesTestRule();
+        Statement statement = new Statement() {
+            @Override
+            public void evaluate() throws Throwable {
+                throw new IOException("A failing test!");
+            }
+        };
+        mExpectedException.expect(IOException.class);
+        mWmsRule.apply(statement, null /* Description*/).evaluate();
+    }
+
+    @Test
+    public void testRule_ranSuccessfully() throws Throwable {
+        final boolean[] testRan = {false};
+        final SystemServicesTestRule mWmsRule = new SystemServicesTestRule();
+        Statement statement = new Statement() {
+            @Override
+            public void evaluate() throws Throwable {
+                testRan[0] = true;
+            }
+        };
+        mWmsRule.apply(statement, null /* Description*/).evaluate();
+        assertTrue(testRan[0]);
+    }
+}
diff --git a/services/tests/wmtests/src/com/android/server/wm/TaskOrganizerTests.java b/services/tests/wmtests/src/com/android/server/wm/TaskOrganizerTests.java
index 0312df6..cd53ece 100644
--- a/services/tests/wmtests/src/com/android/server/wm/TaskOrganizerTests.java
+++ b/services/tests/wmtests/src/com/android/server/wm/TaskOrganizerTests.java
@@ -28,19 +28,17 @@
 import static android.app.WindowConfiguration.WINDOWING_MODE_UNDEFINED;
 import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION;
 
+import static com.android.dx.mockito.inline.extended.ExtendedMockito.doReturn;
 import static com.android.dx.mockito.inline.extended.ExtendedMockito.mock;
 import static com.android.dx.mockito.inline.extended.ExtendedMockito.never;
+import static com.android.dx.mockito.inline.extended.ExtendedMockito.spyOn;
 import static com.android.dx.mockito.inline.extended.ExtendedMockito.times;
 import static com.android.dx.mockito.inline.extended.ExtendedMockito.verify;
 import static com.android.dx.mockito.inline.extended.ExtendedMockito.when;
 
-import static com.android.dx.mockito.inline.extended.ExtendedMockito.never;
-import static com.android.dx.mockito.inline.extended.ExtendedMockito.spyOn;
-import static com.android.dx.mockito.inline.extended.ExtendedMockito.doReturn;
-
 import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
 import static org.mockito.ArgumentMatchers.any;
 import static org.mockito.ArgumentMatchers.anyBoolean;
@@ -49,6 +47,7 @@
 import android.app.ActivityManager.RunningTaskInfo;
 import android.app.ActivityManager.StackInfo;
 import android.app.PictureInPictureParams;
+import android.content.pm.ActivityInfo;
 import android.content.res.Configuration;
 import android.graphics.Rect;
 import android.os.Binder;
@@ -56,7 +55,6 @@
 import android.os.RemoteException;
 import android.platform.test.annotations.Presubmit;
 import android.util.ArrayMap;
-import android.content.pm.ActivityInfo;
 import android.util.Rational;
 import android.view.Display;
 import android.view.ITaskOrganizer;
@@ -458,9 +456,9 @@
     private List<TaskTile> getTaskTiles(DisplayContent dc) {
         ArrayList<TaskTile> out = new ArrayList<>();
         for (int i = dc.getStackCount() - 1; i >= 0; --i) {
-            final Task t = dc.getStackAt(i);
-            if (t instanceof TaskTile) {
-                out.add((TaskTile) t);
+            final TaskTile t = dc.getStackAt(i).asTile();
+            if (t != null) {
+                out.add(t);
             }
         }
         return out;
diff --git a/services/usage/java/com/android/server/usage/UsageStatsService.java b/services/usage/java/com/android/server/usage/UsageStatsService.java
index df5b311..0d1b352 100644
--- a/services/usage/java/com/android/server/usage/UsageStatsService.java
+++ b/services/usage/java/com/android/server/usage/UsageStatsService.java
@@ -86,6 +86,7 @@
 
 import com.android.internal.content.PackageMonitor;
 import com.android.internal.os.BackgroundThread;
+import com.android.internal.util.CollectionUtils;
 import com.android.internal.util.DumpUtils;
 import com.android.internal.util.IndentingPrintWriter;
 import com.android.server.LocalServices;
@@ -104,6 +105,7 @@
 import java.io.PrintWriter;
 import java.nio.file.Files;
 import java.nio.file.StandardCopyOption;
+import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.HashMap;
 import java.util.LinkedList;
@@ -1121,7 +1123,7 @@
 
             boolean checkin = false;
             boolean compact = false;
-            String pkg = null;
+            final ArrayList<String> pkgs = new ArrayList<>();
 
             if (args != null) {
                 for (int i = 0; i < args.length; i++) {
@@ -1214,8 +1216,7 @@
                         return;
                     } else if (arg != null && !arg.startsWith("-")) {
                         // Anything else that doesn't start with '-' is a pkg to filter
-                        pkg = arg;
-                        break;
+                        pkgs.add(arg);
                     }
                 }
             }
@@ -1230,15 +1231,15 @@
                     if (checkin) {
                         mUserState.valueAt(i).checkin(idpw);
                     } else {
-                        mUserState.valueAt(i).dump(idpw, pkg, compact);
+                        mUserState.valueAt(i).dump(idpw, pkgs, compact);
                         idpw.println();
                     }
                 }
-                mAppStandby.dumpUser(idpw, userId, pkg);
+                mAppStandby.dumpUser(idpw, userId, pkgs);
                 idpw.decreaseIndent();
             }
 
-            if (pkg == null) {
+            if (CollectionUtils.isEmpty(pkgs)) {
                 pw.println();
                 mAppStandby.dumpState(args, pw);
             }
diff --git a/services/usage/java/com/android/server/usage/UserUsageStatsService.java b/services/usage/java/com/android/server/usage/UserUsageStatsService.java
index db26d88..b7779fd 100644
--- a/services/usage/java/com/android/server/usage/UserUsageStatsService.java
+++ b/services/usage/java/com/android/server/usage/UserUsageStatsService.java
@@ -48,6 +48,7 @@
 import android.util.SparseIntArray;
 
 import com.android.internal.util.ArrayUtils;
+import com.android.internal.util.CollectionUtils;
 import com.android.internal.util.IndentingPrintWriter;
 import com.android.server.usage.UsageStatsDatabase.StatCombiner;
 
@@ -753,18 +754,21 @@
         });
     }
 
-    void dump(IndentingPrintWriter pw, String pkg) {
-        dump(pw, pkg, false);
+    void dump(IndentingPrintWriter pw, List<String> pkgs) {
+        dump(pw, pkgs, false);
     }
-    void dump(IndentingPrintWriter pw, String pkg, boolean compact) {
-        printLast24HrEvents(pw, !compact, pkg);
+
+    void dump(IndentingPrintWriter pw, List<String> pkgs, boolean compact) {
+        printLast24HrEvents(pw, !compact, pkgs);
         for (int interval = 0; interval < mCurrentStats.length; interval++) {
             pw.print("In-memory ");
             pw.print(intervalToString(interval));
             pw.println(" stats");
-            printIntervalStats(pw, mCurrentStats[interval], !compact, true, pkg);
+            printIntervalStats(pw, mCurrentStats[interval], !compact, true, pkgs);
         }
-        mDatabase.dump(pw, compact);
+        if (CollectionUtils.isEmpty(pkgs)) {
+            mDatabase.dump(pw, compact);
+        }
     }
 
     void dumpDatabaseInfo(IndentingPrintWriter ipw) {
@@ -894,7 +898,8 @@
         pw.println();
     }
 
-    void printLast24HrEvents(IndentingPrintWriter pw, boolean prettyDates, final String pkg) {
+    void printLast24HrEvents(IndentingPrintWriter pw, boolean prettyDates,
+            final List<String> pkgs) {
         final long endTime = System.currentTimeMillis();
         UnixCalendar yesterday = new UnixCalendar(endTime);
         yesterday.addDays(-1);
@@ -914,7 +919,7 @@
                             }
 
                             Event event = stats.events.get(i);
-                            if (pkg != null && !pkg.equals(event.mPackage)) {
+                            if (!CollectionUtils.isEmpty(pkgs) && !pkgs.contains(event.mPackage)) {
                                 continue;
                             }
                             accumulatedResult.add(event);
@@ -958,7 +963,7 @@
     }
 
     void printIntervalStats(IndentingPrintWriter pw, IntervalStats stats,
-            boolean prettyDates, boolean skipEvents, String pkg) {
+            boolean prettyDates, boolean skipEvents, List<String> pkgs) {
         if (prettyDates) {
             pw.printPair("timeRange", "\"" + DateUtils.formatDateRange(mContext,
                     stats.beginTime, stats.endTime, sDateFormatFlags) + "\"");
@@ -974,7 +979,7 @@
         final int pkgCount = pkgStats.size();
         for (int i = 0; i < pkgCount; i++) {
             final UsageStats usageStats = pkgStats.valueAt(i);
-            if (pkg != null && !pkg.equals(usageStats.mPackageName)) {
+            if (!CollectionUtils.isEmpty(pkgs) && !pkgs.contains(usageStats.mPackageName)) {
                 continue;
             }
             pw.printPair("package", usageStats.mPackageName);
@@ -998,7 +1003,7 @@
         pw.println("ChooserCounts");
         pw.increaseIndent();
         for (UsageStats usageStats : pkgStats.values()) {
-            if (pkg != null && !pkg.equals(usageStats.mPackageName)) {
+            if (!CollectionUtils.isEmpty(pkgs) && !pkgs.contains(usageStats.mPackageName)) {
                 continue;
             }
             pw.printPair("package", usageStats.mPackageName);
@@ -1023,7 +1028,7 @@
         }
         pw.decreaseIndent();
 
-        if (pkg == null) {
+        if (CollectionUtils.isEmpty(pkgs)) {
             pw.println("configurations");
             pw.increaseIndent();
             final ArrayMap<Configuration, ConfigurationStats> configStats = stats.configurations;
@@ -1060,7 +1065,7 @@
             final int eventCount = events != null ? events.size() : 0;
             for (int i = 0; i < eventCount; i++) {
                 final Event event = events.get(i);
-                if (pkg != null && !pkg.equals(event.mPackage)) {
+                if (!CollectionUtils.isEmpty(pkgs) && !pkgs.contains(event.mPackage)) {
                     continue;
                 }
                 printEvent(pw, event, prettyDates);
diff --git a/telephony/java/android/service/carrier/CarrierService.java b/telephony/java/android/service/carrier/CarrierService.java
index eefc1b7..d06ec11 100644
--- a/telephony/java/android/service/carrier/CarrierService.java
+++ b/telephony/java/android/service/carrier/CarrierService.java
@@ -25,6 +25,9 @@
 import android.telephony.TelephonyRegistryManager;
 import android.util.Log;
 
+import java.io.FileDescriptor;
+import java.io.PrintWriter;
+
 /**
  * A service that exposes carrier-specific functionality to the system.
  * <p>
@@ -156,5 +159,10 @@
                 result.send(RESULT_ERROR, null);
             }
         }
+
+        @Override
+        protected void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
+            CarrierService.this.dump(fd, pw, args);
+        }
     }
 }
diff --git a/telephony/java/android/telephony/CarrierConfigManager.java b/telephony/java/android/telephony/CarrierConfigManager.java
index c51a852..9924839c 100755
--- a/telephony/java/android/telephony/CarrierConfigManager.java
+++ b/telephony/java/android/telephony/CarrierConfigManager.java
@@ -17,7 +17,6 @@
 package android.telephony;
 
 import android.Manifest;
-import android.annotation.IntDef;
 import android.annotation.NonNull;
 import android.annotation.Nullable;
 import android.annotation.RequiresPermission;
@@ -28,7 +27,6 @@
 import android.compat.annotation.UnsupportedAppUsage;
 import android.content.ComponentName;
 import android.content.Context;
-import android.net.ipsec.ike.SaProposal;
 import android.os.PersistableBundle;
 import android.os.RemoteException;
 import android.service.carrier.CarrierService;
@@ -3391,6 +3389,25 @@
             "subscription_group_uuid_string";
 
     /**
+     * Data switch validation minimal gap time, in milliseconds.
+     *
+     * Which means, if the same subscription on the same network (based on MCC+MNC+TAC+subId)
+     * was recently validated (within this time gap), and Telephony receives a request to switch to
+     * it again, Telephony will skip the validation part and switch to it as soon as connection
+     * is setup, as if it's already validated.
+     *
+     * If the network was validated within the gap but the latest validation result is false, the
+     * validation will not be skipped.
+     *
+     * If not set or set to 0, validation will never be skipped.
+     * The max acceptable value of this config is 24 hours.
+     *
+     * @hide
+     */
+    public static final String KEY_DATA_SWITCH_VALIDATION_MIN_GAP_LONG =
+            "data_switch_validation_min_gap_LONG";
+
+    /**
     * A boolean property indicating whether this subscription should be managed as an opportunistic
     * subscription.
     *
@@ -3480,369 +3497,6 @@
     public static final String KEY_SHOW_FORWARDED_NUMBER_BOOL =
             "show_forwarded_number_bool";
 
-    /**
-     * Configs used for epdg tunnel bring up.
-     *
-     * @see <a href="https://tools.ietf.org/html/rfc7296">RFC 7296, Internet Key Exchange
-     *        Protocol Version 2 (IKEv2)</a>
-     */
-    public static final class Iwlan {
-        /** Prefix of all Epdg.KEY_* constants. */
-        public static final String KEY_PREFIX = "iwlan.";
-
-        /**
-         * Time in seconds after which the child security association session is terminated if
-         * rekey procedure is not successful. If not set or set to <= 0, the default value is
-         * 3600 seconds.
-         */
-        public static final String KEY_CHILD_SA_REKEY_HARD_TIMER_SEC_INT =
-                KEY_PREFIX + "child_sa_rekey_hard_timer_sec_int";
-
-        /**
-         * Time in seconds after which the child session rekey procedure is started. If not set or
-         * set to <= 0, default value is 3000 seconds.
-         */
-        public static final String KEY_CHILD_SA_REKEY_SOFT_TIMER_SEC_INT =
-                KEY_PREFIX + "child_sa_rekey_soft_timer_sec_int";
-
-        /** Supported DH groups for IKE negotiation.
-         * Possible values are {@link #DH_GROUP_NONE}, {@link #DH_GROUP_1024_BIT_MODP},
-         * {@link #DH_GROUP_2048_BIT_MODP}
-         */
-        public static final String KEY_DIFFIE_HELLMAN_GROUPS_INT_ARRAY =
-                KEY_PREFIX + "diffie_hellman_groups_int_array";
-
-        /**
-         * Time in seconds after which a dead peer detection (DPD) request is sent.
-         * If not set or set to <= 0, default value is 120 seconds.
-         */
-        public static final String KEY_DPD_TIMER_SEC_INT = KEY_PREFIX + "dpd_timer_sec_int";
-
-        /**
-         * Method used to authenticate epdg server.
-         * Possible values are {@link #AUTHENTICATION_METHOD_EAP_ONLY},
-         * {@link #AUTHENTICATION_METHOD_CERT}
-         */
-        public static final String KEY_EPDG_AUTHENTICATION_METHOD_INT =
-                KEY_PREFIX + "epdg_authentication_method_int";
-
-        /**
-         * A priority list of ePDG addresses to be used.
-         * Possible values are {@link #EPDG_ADDRESS_STATIC}, {@link #EPDG_ADDRESS_PLMN},
-         * {@link #EPDG_ADDRESS_PCO}
-         */
-        public static final String KEY_EPDG_ADDRESS_PRIORITY_INT_ARRAY =
-                KEY_PREFIX + "epdg_address_priority_int_array";
-
-        /** Epdg static IP address or FQDN */
-        public static final String KEY_EPDG_STATIC_ADDRESS_STRING =
-                KEY_PREFIX + "epdg_static_address_string";
-
-        /** Epdg static IP address or FQDN for roaming */
-        public static final String KEY_EPDG_STATIC_ADDRESS_ROAMING_STRING =
-                KEY_PREFIX + "epdg_static_address_roaming_string";
-
-        /**
-         * List of supported key sizes for AES Cipher Block Chaining (CBC) encryption mode of child
-         * session.
-         * Possible values are {@link #KEY_LEN_UNUSED}, {@link #KEY_LEN_AES_128},
-         * {@link #KEY_LEN_AES_192}, {@link #KEY_LEN_AES_256}
-         */
-        public static final String KEY_CHILD_SESSION_AES_CBC_KEY_SIZE_INT_ARRAY =
-                KEY_PREFIX + "child_session_aes_cbc_key_size_int_array";
-
-        /**
-         * List of supported key sizes for AES counter (CTR) encryption mode of child session.
-         * Possible values are {@link #KEY_LEN_UNUSED}, {@link #KEY_LEN_AES_128},
-         * {@link #KEY_LEN_AES_192}, {@link #KEY_LEN_AES_256}
-         */
-        public static final String KEY_CHILD_SESSION_AES_CTR_KEY_SIZE_INT_ARRAY =
-                KEY_PREFIX + "child_encryption_aes_ctr_key_size_int_array";
-
-        /**
-         * List of supported encryption algorithms for child session.
-         * Possible values are {@link #ENCRYPTION_ALGORITHM_3DES},
-         * {@link #ENCRYPTION_ALGORITHM_AES_CBC}, {@link #ENCRYPTION_ALGORITHM_AES_GCM_8},
-         * {@link #ENCRYPTION_ALGORITHM_AES_GCM_12}, {@link #ENCRYPTION_ALGORITHM_AES_GCM_16}
-         */
-        public static final String KEY_SUPPORTED_CHILD_SESSION_ENCRYPTION_ALGORITHMS_INT_ARRAY =
-                KEY_PREFIX + "supported_child_session_encryption_algorithms_int_array";
-
-        /** Controls if IKE message fragmentation is enabled. */
-        public static final String KEY_IKE_FRAGMENTATION_ENABLED_BOOL =
-                KEY_PREFIX + "ike_fragmentation_enabled_bool";
-
-        /**
-         * Time in seconds after which the IKE session is terminated if rekey procedure is not
-         * successful. If not set or set to <= 0, default value is 3600 seconds.
-         */
-        public static final String KEY_IKE_REKEY_HARD_TIMER_SEC_INT =
-                KEY_PREFIX + "ike_rekey_hard_timer_in_sec";
-
-        /**
-         * Time in seconds after which the IKE session rekey procedure is started. If not set or
-         * set to <= 0, default value is 3000 seconds.
-         */
-        public static final String KEY_IKE_REKEY_SOFT_TIMER_SEC_INT =
-                KEY_PREFIX + "ike_rekey_soft_timer_sec_int";
-
-        /**
-         * List of supported key sizes for AES Cipher Block Chaining (CBC) encryption mode of IKE
-         * session.
-         * Possible values - {@link #KEY_LEN_UNUSED}, {@link #KEY_LEN_AES_128},
-         *         {@link #KEY_LEN_AES_192}, {@link #KEY_LEN_AES_256}
-         */
-        public static final String KEY_IKE_SESSION_AES_CBC_KEY_SIZE_INT_ARRAY =
-                KEY_PREFIX + "ike_session_encryption_aes_cbc_key_size_int_array";
-
-        /**
-         * List of supported key sizes for AES counter (CTR) encryption mode of IKE session.
-         * Possible values - {@link #KEY_LEN_UNUSED}, {@link #KEY_LEN_AES_128},
-         *         {@link #KEY_LEN_AES_192}, {@link #KEY_LEN_AES_256}
-         */
-        public static final String KEY_IKE_SESSION_AES_CTR_KEY_SIZE_INT_ARRAY =
-                KEY_PREFIX + "ike_session_aes_ctr_key_size_int_array";
-
-        /**
-        * List of supported encryption algorithms for IKE session.
-        * Possible values are {@link #ENCRYPTION_ALGORITHM_3DES},
-         * {@link #ENCRYPTION_ALGORITHM_AES_CBC}, {@link #ENCRYPTION_ALGORITHM_AES_GCM_8},
-         * {@link #ENCRYPTION_ALGORITHM_AES_GCM_12}, {@link #ENCRYPTION_ALGORITHM_AES_GCM_16}
-        */
-        public static final String KEY_SUPPORTED_IKE_SESSION_ENCRYPTION_ALGORITHMS_INT_ARRAY =
-                KEY_PREFIX + "supported_ike_session_encryption_algorithms_int_array";
-
-        /**
-         * List of supported integrity algorithms for IKE session
-         * Possible values are {@link #INTEGRITY_ALGORITHM_NONE},
-         * {@link #INTEGRITY_ALGORITHM_HMAC_SHA1_96}, {@link #INTEGRITY_ALGORITHM_AES_XCBC_96},
-         * {@link #INTEGRITY_ALGORITHM_HMAC_SHA2_256_128},
-         * {@link #INTEGRITY_ALGORITHM_HMAC_SHA2_384_192},
-         * {@link #INTEGRITY_ALGORITHM_HMAC_SHA2_512_256}
-         */
-        public static final String KEY_SUPPORTED_INTEGRITY_ALGORITHMS_INT_ARRAY =
-                KEY_PREFIX + "supported_integrity_algorithms_int_array";
-
-        /** Maximum number of retries for tunnel establishment. */
-        public static final String KEY_MAX_RETRIES_INT = KEY_PREFIX + "max_retries_int";
-
-        /** Controls if nat traversal should be enabled. */
-        public static final String KEY_NATT_ENABLED_BOOL = KEY_PREFIX + "natt_enabled_bool";
-
-        /**
-         * Time in seconds after which a NATT keep alive message is sent. If not set or set to <= 0,
-         * default value is 20 seconds.
-         */
-        public static final String KEY_NATT_KEEP_ALIVE_TIMER_SEC_INT =
-                KEY_PREFIX + "natt_keep_alive_timer_sec_int";
-
-        /** List of comma separated MCC/MNCs used to create ePDG FQDN as per 3GPP TS 23.003 */
-        public static final String KEY_MCC_MNCS_STRING_ARRAY = KEY_PREFIX + "mcc_mncs_string_array";
-
-        /**
-         * List of supported pseudo random function algorithms for IKE session
-         * Possible values are {@link #PSEUDORANDOM_FUNCTION_HMAC_SHA1},
-         * {@link #PSEUDORANDOM_FUNCTION_AES128_XCBC}
-         */
-        public static final String KEY_SUPPORTED_PRF_ALGORITHMS_INT_ARRAY = KEY_PREFIX +
-                "supported_prf_algorithms_int_array";
-
-        /**
-         * Time in seconds after which IKE message is retransmitted. If not set or set to <= 0,
-         * default value is 2 seconds.
-         */
-        public static final String KEY_RETRANSMIT_TIMER_SEC_INT =
-                KEY_PREFIX + "retransmit_timer_sec_int";
-
-        /** @hide */
-        @IntDef({
-                AUTHENTICATION_METHOD_EAP_ONLY,
-                AUTHENTICATION_METHOD_CERT
-        })
-        public @interface AuthenticationMethodType {}
-
-        /**
-         * Certificate sent from the server is ignored. Only Extensible Authentication Protocol
-         * (EAP) is used to authenticate the server.
-         * EAP_ONLY_AUTH payload is added to IKE_AUTH request if supported.
-         * @see <a href="https://tools.ietf.org/html/rfc5998">RFC 5998</a>
-         */
-        public static final int AUTHENTICATION_METHOD_EAP_ONLY = 0;
-        /** Server is authenticated using its certificate. */
-        public static final int AUTHENTICATION_METHOD_CERT = 1;
-
-        /** @hide */
-        @IntDef({
-                EPDG_ADDRESS_STATIC,
-                EPDG_ADDRESS_PLMN,
-                EPDG_ADDRESS_PCO
-        })
-        public @interface EpdgAddressType {}
-
-        /** Use static epdg address. */
-        public static final int EPDG_ADDRESS_STATIC = 0;
-        /** Construct the epdg address using plmn. */
-        public static final int EPDG_ADDRESS_PLMN = 1;
-        /**
-         * Use the epdg address received in protocol configuration options (PCO) from the
-         * network.
-         */
-        public static final int EPDG_ADDRESS_PCO = 2;
-
-        /** @hide */
-        @IntDef({
-                KEY_LEN_UNUSED,
-                KEY_LEN_AES_128,
-                KEY_LEN_AES_192,
-                KEY_LEN_AES_256
-        })
-        public @interface EncrpytionKeyLengthType {}
-
-        public static final int KEY_LEN_UNUSED = SaProposal.KEY_LEN_UNUSED;
-        /** AES Encryption/Ciphering Algorithm key length 128 bits. */
-        public static final int KEY_LEN_AES_128 = SaProposal.KEY_LEN_AES_128;
-        /** AES Encryption/Ciphering Algorithm key length 192 bits. */
-        public static final int KEY_LEN_AES_192 = SaProposal.KEY_LEN_AES_192;
-        /** AES Encryption/Ciphering Algorithm key length 256 bits. */
-        public static final int KEY_LEN_AES_256 = SaProposal.KEY_LEN_AES_256;
-
-        /** @hide */
-        @IntDef({
-                DH_GROUP_NONE,
-                DH_GROUP_1024_BIT_MODP,
-                DH_GROUP_2048_BIT_MODP
-        })
-        public @interface DhGroup {}
-
-        /** None Diffie-Hellman Group. */
-        public static final int DH_GROUP_NONE = SaProposal.DH_GROUP_NONE;
-        /** 1024-bit MODP Diffie-Hellman Group. */
-        public static final int DH_GROUP_1024_BIT_MODP = SaProposal.DH_GROUP_1024_BIT_MODP;
-        /** 2048-bit MODP Diffie-Hellman Group. */
-        public static final int DH_GROUP_2048_BIT_MODP = SaProposal.DH_GROUP_2048_BIT_MODP;
-
-        /** @hide */
-        @IntDef({
-                ENCRYPTION_ALGORITHM_3DES,
-                ENCRYPTION_ALGORITHM_AES_CBC,
-                ENCRYPTION_ALGORITHM_AES_GCM_8,
-                ENCRYPTION_ALGORITHM_AES_GCM_12,
-                ENCRYPTION_ALGORITHM_AES_GCM_16
-        })
-        public @interface EncryptionAlgorithm {}
-
-        /** 3DES Encryption/Ciphering Algorithm. */
-        public static final int ENCRYPTION_ALGORITHM_3DES = SaProposal.ENCRYPTION_ALGORITHM_3DES;
-        /** AES-CBC Encryption/Ciphering Algorithm. */
-        public static final int ENCRYPTION_ALGORITHM_AES_CBC =
-                SaProposal.ENCRYPTION_ALGORITHM_AES_CBC;
-
-        /**
-         * AES-GCM Authentication/Integrity + Encryption/Ciphering Algorithm with 8-octet ICV
-         * (truncation).
-         */
-        public static final int ENCRYPTION_ALGORITHM_AES_GCM_8 =
-                SaProposal.ENCRYPTION_ALGORITHM_AES_GCM_8;
-        /**
-         * AES-GCM Authentication/Integrity + Encryption/Ciphering Algorithm with 12-octet ICV
-         * (truncation).
-         */
-        public static final int ENCRYPTION_ALGORITHM_AES_GCM_12 =
-                SaProposal.ENCRYPTION_ALGORITHM_AES_GCM_12;
-        /**
-         * AES-GCM Authentication/Integrity + Encryption/Ciphering Algorithm with 16-octet ICV
-         * (truncation).
-         */
-        public static final int ENCRYPTION_ALGORITHM_AES_GCM_16 =
-                SaProposal.ENCRYPTION_ALGORITHM_AES_GCM_16;
-
-        /** @hide */
-        @IntDef({
-                INTEGRITY_ALGORITHM_NONE,
-                INTEGRITY_ALGORITHM_HMAC_SHA1_96,
-                INTEGRITY_ALGORITHM_AES_XCBC_96,
-                INTEGRITY_ALGORITHM_HMAC_SHA2_256_128,
-                INTEGRITY_ALGORITHM_HMAC_SHA2_384_192,
-                INTEGRITY_ALGORITHM_HMAC_SHA2_512_256
-        })
-        public @interface IntegrityAlgorithm {}
-
-        /** None Authentication/Integrity Algorithm. */
-        public static final int INTEGRITY_ALGORITHM_NONE = SaProposal.INTEGRITY_ALGORITHM_NONE;
-        /** HMAC-SHA1 Authentication/Integrity Algorithm. */
-        public static final int INTEGRITY_ALGORITHM_HMAC_SHA1_96 =
-                SaProposal.INTEGRITY_ALGORITHM_HMAC_SHA1_96;
-        /** AES-XCBC-96 Authentication/Integrity Algorithm. */
-        public static final int INTEGRITY_ALGORITHM_AES_XCBC_96 =
-                SaProposal.INTEGRITY_ALGORITHM_AES_XCBC_96;
-        /** HMAC-SHA256 Authentication/Integrity Algorithm with 128-bit truncation. */
-        public static final int INTEGRITY_ALGORITHM_HMAC_SHA2_256_128 =
-                SaProposal.INTEGRITY_ALGORITHM_HMAC_SHA2_256_128;
-        /** HMAC-SHA384 Authentication/Integrity Algorithm with 192-bit truncation. */
-        public static final int INTEGRITY_ALGORITHM_HMAC_SHA2_384_192 =
-                SaProposal.INTEGRITY_ALGORITHM_HMAC_SHA2_384_192;
-        /** HMAC-SHA512 Authentication/Integrity Algorithm with 256-bit truncation. */
-        public static final int INTEGRITY_ALGORITHM_HMAC_SHA2_512_256 =
-                SaProposal.INTEGRITY_ALGORITHM_HMAC_SHA2_512_256;
-
-        /** @hide */
-        @IntDef({
-                PSEUDORANDOM_FUNCTION_HMAC_SHA1,
-                PSEUDORANDOM_FUNCTION_AES128_XCBC
-        })
-        public @interface PseudorandomFunction {}
-
-        /** HMAC-SHA1 Pseudorandom Function. */
-        public static final int PSEUDORANDOM_FUNCTION_HMAC_SHA1 =
-                SaProposal.PSEUDORANDOM_FUNCTION_HMAC_SHA1;
-        /** AES128-XCBC Pseudorandom Function. */
-        public static final int PSEUDORANDOM_FUNCTION_AES128_XCBC =
-                SaProposal.PSEUDORANDOM_FUNCTION_AES128_XCBC;
-
-        private Iwlan() {}
-
-        private static PersistableBundle getDefaults() {
-            PersistableBundle defaults = new PersistableBundle();
-            defaults.putInt(KEY_IKE_REKEY_SOFT_TIMER_SEC_INT, 3000);
-            defaults.putInt(KEY_IKE_REKEY_HARD_TIMER_SEC_INT, 3600);
-            defaults.putInt(KEY_CHILD_SA_REKEY_SOFT_TIMER_SEC_INT, 3000);
-            defaults.putInt(KEY_CHILD_SA_REKEY_HARD_TIMER_SEC_INT, 3600);
-            defaults.putInt(KEY_RETRANSMIT_TIMER_SEC_INT, 2);
-            defaults.putInt(KEY_DPD_TIMER_SEC_INT, 120);
-            defaults.putInt(KEY_MAX_RETRIES_INT, 3);
-            defaults.putIntArray(KEY_DIFFIE_HELLMAN_GROUPS_INT_ARRAY,
-                    new int[]{DH_GROUP_1024_BIT_MODP, DH_GROUP_2048_BIT_MODP});
-            defaults.putIntArray(KEY_SUPPORTED_IKE_SESSION_ENCRYPTION_ALGORITHMS_INT_ARRAY,
-                    new int[]{ENCRYPTION_ALGORITHM_3DES, ENCRYPTION_ALGORITHM_AES_CBC});
-            defaults.putIntArray(KEY_SUPPORTED_CHILD_SESSION_ENCRYPTION_ALGORITHMS_INT_ARRAY,
-                    new int[]{ENCRYPTION_ALGORITHM_3DES, ENCRYPTION_ALGORITHM_AES_CBC});
-            defaults.putIntArray(KEY_SUPPORTED_INTEGRITY_ALGORITHMS_INT_ARRAY,
-                    new int[]{INTEGRITY_ALGORITHM_AES_XCBC_96, INTEGRITY_ALGORITHM_HMAC_SHA1_96,
-                            INTEGRITY_ALGORITHM_HMAC_SHA2_256_128});
-            defaults.putIntArray(KEY_SUPPORTED_PRF_ALGORITHMS_INT_ARRAY,
-                    new int[]{PSEUDORANDOM_FUNCTION_HMAC_SHA1, PSEUDORANDOM_FUNCTION_AES128_XCBC});
-            defaults.putBoolean(KEY_NATT_ENABLED_BOOL, true);
-            defaults.putInt(KEY_EPDG_AUTHENTICATION_METHOD_INT, AUTHENTICATION_METHOD_CERT);
-            defaults.putString(KEY_EPDG_STATIC_ADDRESS_STRING, "");
-            defaults.putString(KEY_EPDG_STATIC_ADDRESS_ROAMING_STRING, "");
-            defaults.putInt(KEY_NATT_KEEP_ALIVE_TIMER_SEC_INT, 20);
-            defaults.putIntArray(KEY_IKE_SESSION_AES_CBC_KEY_SIZE_INT_ARRAY,
-                    new int[]{KEY_LEN_AES_128, KEY_LEN_AES_256});
-            defaults.putIntArray(KEY_IKE_SESSION_AES_CTR_KEY_SIZE_INT_ARRAY,
-                    new int[]{KEY_LEN_AES_128});
-            defaults.putIntArray(KEY_CHILD_SESSION_AES_CBC_KEY_SIZE_INT_ARRAY,
-                    new int[]{KEY_LEN_AES_128, KEY_LEN_AES_256});
-            defaults.putIntArray(KEY_CHILD_SESSION_AES_CTR_KEY_SIZE_INT_ARRAY,
-                    new int[]{KEY_LEN_AES_128});
-            defaults.putBoolean(KEY_IKE_FRAGMENTATION_ENABLED_BOOL, false);
-            defaults.putIntArray(KEY_EPDG_ADDRESS_PRIORITY_INT_ARRAY, new int[]{EPDG_ADDRESS_PLMN,
-                    EPDG_ADDRESS_STATIC});
-            defaults.putStringArray(KEY_MCC_MNCS_STRING_ARRAY, new String[]{});
-
-            return defaults;
-        }
-    }
-
     /** The default value for every variable. */
     private final static PersistableBundle sDefaults;
 
@@ -4339,7 +3993,7 @@
         sDefaults.putAll(Wifi.getDefaults());
         sDefaults.putBoolean(ENABLE_EAP_METHOD_PREFIX_BOOL, false);
         sDefaults.putBoolean(KEY_SHOW_FORWARDED_NUMBER_BOOL, false);
-        sDefaults.putAll(Iwlan.getDefaults());
+        sDefaults.putLong(KEY_DATA_SWITCH_VALIDATION_MIN_GAP_LONG, 0);
     }
 
     /**
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 6dc1e0e..c074e6e 100644
--- a/telephony/java/com/android/internal/telephony/cdma/sms/BearerData.java
+++ b/telephony/java/com/android/internal/telephony/cdma/sms/BearerData.java
@@ -248,10 +248,10 @@
         public int hour;
         public int monthDay;
 
-        /** Month [0-11] */
-        public int month;
+        /** Month in the range 1(Jan) - 12(Dec). */
+        public int monthOrdinal;
 
-        /** Full year. For example, 1970. */
+        /** Full year in the range 1996 - 2095. */
         public int year;
 
         private ZoneId mZoneId;
@@ -269,7 +269,7 @@
             ts.year = year >= 96 ? year + 1900 : year + 2000;
             int month = IccUtils.cdmaBcdByteToInt(data[1]);
             if (month < 1 || month > 12) return null;
-            ts.month = month - 1;
+            ts.monthOrdinal = month;
             int day = IccUtils.cdmaBcdByteToInt(data[2]);
             if (day < 1 || day > 31) return null;
             ts.monthDay = day;
@@ -292,7 +292,7 @@
             int year = localDateTime.getYear();
             if (year < 1996 || year > 2095) return null;
             ts.year = year;
-            ts.month = localDateTime.getMonthValue();
+            ts.monthOrdinal = localDateTime.getMonthValue();
             ts.monthDay = localDateTime.getDayOfMonth();
             ts.hour = localDateTime.getHour();
             ts.minute = localDateTime.getMinute();
@@ -304,7 +304,7 @@
             int year = this.year % 100; // 00 - 99
             ByteArrayOutputStream outStream = new ByteArrayOutputStream(6);
             outStream.write((((year / 10) & 0x0F) << 4) | ((year % 10) & 0x0F));
-            outStream.write((((month / 10) << 4) & 0xF0) | ((month % 10) & 0x0F));
+            outStream.write((((monthOrdinal / 10) << 4) & 0xF0) | ((monthOrdinal % 10) & 0x0F));
             outStream.write((((monthDay / 10) << 4) & 0xF0) | ((monthDay % 10) & 0x0F));
             outStream.write((((hour / 10) << 4) & 0xF0) | ((hour % 10) & 0x0F));
             outStream.write((((minute / 10) << 4) & 0xF0) | ((minute % 10) & 0x0F));
@@ -314,7 +314,7 @@
 
         public long toMillis() {
             LocalDateTime localDateTime =
-                    LocalDateTime.of(year, month + 1, monthDay, hour, minute, second);
+                    LocalDateTime.of(year, monthOrdinal, monthDay, hour, minute, second);
             Instant instant = localDateTime.toInstant(mZoneId.getRules().getOffset(localDateTime));
             return instant.toEpochMilli();
         }
@@ -325,7 +325,7 @@
             StringBuilder builder = new StringBuilder();
             builder.append("TimeStamp ");
             builder.append("{ year=" + year);
-            builder.append(", month=" + month);
+            builder.append(", month=" + monthOrdinal);
             builder.append(", day=" + monthDay);
             builder.append(", hour=" + hour);
             builder.append(", minute=" + minute);
diff --git a/tests/net/java/com/android/server/ConnectivityServiceTest.java b/tests/net/java/com/android/server/ConnectivityServiceTest.java
index 957683e..220cdce 100644
--- a/tests/net/java/com/android/server/ConnectivityServiceTest.java
+++ b/tests/net/java/com/android/server/ConnectivityServiceTest.java
@@ -204,6 +204,7 @@
 import android.os.UserHandle;
 import android.os.UserManager;
 import android.provider.Settings;
+import android.security.KeyStore;
 import android.system.Os;
 import android.test.mock.MockContentResolver;
 import android.text.TextUtils;
@@ -1019,7 +1020,7 @@
 
         public MockVpn(int userId) {
             super(startHandlerThreadAndReturnLooper(), mServiceContext, mNetworkManagementService,
-                    userId);
+                    userId, mock(KeyStore.class));
         }
 
         public void setNetworkAgent(TestNetworkAgentWrapper agent) {
@@ -2053,14 +2054,15 @@
         assertEquals(mCellNetworkAgent.getNetwork(), mCm.getActiveNetwork());
         assertEquals(defaultCallback.getLastAvailableNetwork(), mCm.getActiveNetwork());
 
-        // Bring up wifi with a score of 70.
+        // Bring up validated wifi.
         // Cell is lingered because it would not satisfy any request, even if it validated.
         mWiFiNetworkAgent = new TestNetworkAgentWrapper(TRANSPORT_WIFI);
-        mWiFiNetworkAgent.adjustScore(50);
-        mWiFiNetworkAgent.connect(false);   // Score: 70
+        mWiFiNetworkAgent.connect(true);   // Score: 60
         callback.expectAvailableCallbacksUnvalidated(mWiFiNetworkAgent);
+        // TODO: Investigate sending validated before losing.
         callback.expectCallback(CallbackEntry.LOSING, mCellNetworkAgent);
-        defaultCallback.expectAvailableCallbacksUnvalidated(mWiFiNetworkAgent);
+        callback.expectCapabilitiesWith(NET_CAPABILITY_VALIDATED, mWiFiNetworkAgent);
+        defaultCallback.expectAvailableThenValidatedCallbacks(mWiFiNetworkAgent);
         assertEquals(mWiFiNetworkAgent.getNetwork(), mCm.getActiveNetwork());
         assertEquals(defaultCallback.getLastAvailableNetwork(), mCm.getActiveNetwork());
 
@@ -5844,7 +5846,7 @@
 
         mWiFiNetworkAgent = new TestNetworkAgentWrapper(TRANSPORT_WIFI);
         mWiFiNetworkAgent.connect(true);
-        trustedCallback.expectAvailableDoubleValidatedCallbacks(mWiFiNetworkAgent);
+        trustedCallback.expectAvailableThenValidatedCallbacks(mWiFiNetworkAgent);
         verify(mNetworkManagementService).setDefaultNetId(eq(mWiFiNetworkAgent.getNetwork().netId));
         reset(mNetworkManagementService);
 
diff --git a/tests/net/java/com/android/server/connectivity/NetworkRankerTest.kt b/tests/net/java/com/android/server/connectivity/NetworkRankerTest.kt
index a6b371a..d2532c2 100644
--- a/tests/net/java/com/android/server/connectivity/NetworkRankerTest.kt
+++ b/tests/net/java/com/android/server/connectivity/NetworkRankerTest.kt
@@ -16,14 +16,18 @@
 
 package com.android.server.connectivity
 
+import android.net.ConnectivityManager.TYPE_WIFI
+import android.net.LinkProperties
+import android.net.Network
+import android.net.NetworkAgentConfig
 import android.net.NetworkCapabilities
+import android.net.NetworkInfo
 import android.net.NetworkRequest
+import android.net.NetworkScore
 import androidx.test.filters.SmallTest
 import androidx.test.runner.AndroidJUnit4
 import org.junit.Test
 import org.junit.runner.RunWith
-import org.mockito.ArgumentMatchers.any
-import org.mockito.Mockito.doReturn
 import org.mockito.Mockito.mock
 import kotlin.test.assertEquals
 import kotlin.test.assertNull
@@ -33,10 +37,24 @@
 class NetworkRankerTest {
     private val ranker = NetworkRanker()
 
-    private fun makeNai(satisfy: Boolean, score: Int) = mock(NetworkAgentInfo::class.java).also {
-        doReturn(satisfy).`when`(it).satisfies(any())
-        doReturn(score).`when`(it).currentScore
-        it.networkCapabilities = NetworkCapabilities()
+    private fun makeNai(satisfy: Boolean, score: Int) = object : NetworkAgentInfo(
+            null /* messenger */,
+            null /* asyncChannel*/,
+            Network(100),
+            NetworkInfo(TYPE_WIFI, 0 /* subtype */, "" /* typename */, "" /* subtypename */),
+            LinkProperties(),
+            NetworkCapabilities(),
+            NetworkScore.Builder().setLegacyScore(score).build(),
+            null /* context */,
+            null /* handler */,
+            NetworkAgentConfig(),
+            null /* connectivityService */,
+            null /* netd */,
+            null /* dnsResolver */,
+            null /* networkManagementService */,
+            0 /* factorySerialNumber */) {
+        override fun satisfies(request: NetworkRequest?): Boolean = satisfy
+        override fun getCurrentScore(): Int = score
     }
 
     @Test
diff --git a/tests/net/java/com/android/server/connectivity/VpnTest.java b/tests/net/java/com/android/server/connectivity/VpnTest.java
index ac1c518..0e3b797 100644
--- a/tests/net/java/com/android/server/connectivity/VpnTest.java
+++ b/tests/net/java/com/android/server/connectivity/VpnTest.java
@@ -72,6 +72,7 @@
 import android.os.Process;
 import android.os.UserHandle;
 import android.os.UserManager;
+import android.provider.Settings;
 import android.security.Credentials;
 import android.security.KeyStore;
 import android.util.ArrayMap;
@@ -260,17 +261,17 @@
         assertFalse(vpn.getLockdown());
 
         // Set always-on without lockdown.
-        assertTrue(vpn.setAlwaysOnPackage(PKGS[1], false, Collections.emptyList()));
+        assertTrue(vpn.setAlwaysOnPackage(PKGS[1], false, Collections.emptyList(), mKeyStore));
         assertTrue(vpn.getAlwaysOn());
         assertFalse(vpn.getLockdown());
 
         // Set always-on with lockdown.
-        assertTrue(vpn.setAlwaysOnPackage(PKGS[1], true, Collections.emptyList()));
+        assertTrue(vpn.setAlwaysOnPackage(PKGS[1], true, Collections.emptyList(), mKeyStore));
         assertTrue(vpn.getAlwaysOn());
         assertTrue(vpn.getLockdown());
 
         // Remove always-on configuration.
-        assertTrue(vpn.setAlwaysOnPackage(null, false, Collections.emptyList()));
+        assertTrue(vpn.setAlwaysOnPackage(null, false, Collections.emptyList(), mKeyStore));
         assertFalse(vpn.getAlwaysOn());
         assertFalse(vpn.getLockdown());
     }
@@ -284,11 +285,11 @@
         assertUnblocked(vpn, user.start + PKG_UIDS[0], user.start + PKG_UIDS[1], user.start + PKG_UIDS[2], user.start + PKG_UIDS[3]);
 
         // Set always-on without lockdown.
-        assertTrue(vpn.setAlwaysOnPackage(PKGS[1], false, null));
+        assertTrue(vpn.setAlwaysOnPackage(PKGS[1], false, null, mKeyStore));
         assertUnblocked(vpn, user.start + PKG_UIDS[0], user.start + PKG_UIDS[1], user.start + PKG_UIDS[2], user.start + PKG_UIDS[3]);
 
         // Set always-on with lockdown.
-        assertTrue(vpn.setAlwaysOnPackage(PKGS[1], true, null));
+        assertTrue(vpn.setAlwaysOnPackage(PKGS[1], true, null, mKeyStore));
         verify(mNetService).setAllowOnlyVpnForUids(eq(true), aryEq(new UidRange[] {
             new UidRange(user.start, user.start + PKG_UIDS[1] - 1),
             new UidRange(user.start + PKG_UIDS[1] + 1, user.stop)
@@ -297,7 +298,7 @@
         assertUnblocked(vpn, user.start + PKG_UIDS[1]);
 
         // Switch to another app.
-        assertTrue(vpn.setAlwaysOnPackage(PKGS[3], true, null));
+        assertTrue(vpn.setAlwaysOnPackage(PKGS[3], true, null, mKeyStore));
         verify(mNetService).setAllowOnlyVpnForUids(eq(false), aryEq(new UidRange[] {
             new UidRange(user.start, user.start + PKG_UIDS[1] - 1),
             new UidRange(user.start + PKG_UIDS[1] + 1, user.stop)
@@ -316,7 +317,8 @@
         final UidRange user = UidRange.createForUser(primaryUser.id);
 
         // Set always-on with lockdown and whitelist app PKGS[2] from lockdown.
-        assertTrue(vpn.setAlwaysOnPackage(PKGS[1], true, Collections.singletonList(PKGS[2])));
+        assertTrue(vpn.setAlwaysOnPackage(
+                PKGS[1], true, Collections.singletonList(PKGS[2]), mKeyStore));
         verify(mNetService).setAllowOnlyVpnForUids(eq(true), aryEq(new UidRange[] {
                 new UidRange(user.start, user.start + PKG_UIDS[1] - 1),
                 new UidRange(user.start + PKG_UIDS[2] + 1, user.stop)
@@ -325,7 +327,8 @@
         assertUnblocked(vpn, user.start + PKG_UIDS[1], user.start + PKG_UIDS[2]);
 
         // Change whitelisted app to PKGS[3].
-        assertTrue(vpn.setAlwaysOnPackage(PKGS[1], true, Collections.singletonList(PKGS[3])));
+        assertTrue(vpn.setAlwaysOnPackage(
+                PKGS[1], true, Collections.singletonList(PKGS[3]), mKeyStore));
         verify(mNetService).setAllowOnlyVpnForUids(eq(false), aryEq(new UidRange[] {
                 new UidRange(user.start + PKG_UIDS[2] + 1, user.stop)
         }));
@@ -337,7 +340,8 @@
         assertUnblocked(vpn, user.start + PKG_UIDS[1], user.start + PKG_UIDS[3]);
 
         // Change the VPN app.
-        assertTrue(vpn.setAlwaysOnPackage(PKGS[0], true, Collections.singletonList(PKGS[3])));
+        assertTrue(vpn.setAlwaysOnPackage(
+                PKGS[0], true, Collections.singletonList(PKGS[3]), mKeyStore));
         verify(mNetService).setAllowOnlyVpnForUids(eq(false), aryEq(new UidRange[] {
                 new UidRange(user.start, user.start + PKG_UIDS[1] - 1),
                 new UidRange(user.start + PKG_UIDS[1] + 1, user.start + PKG_UIDS[3] - 1)
@@ -350,7 +354,7 @@
         assertUnblocked(vpn, user.start + PKG_UIDS[0], user.start + PKG_UIDS[3]);
 
         // Remove the whitelist.
-        assertTrue(vpn.setAlwaysOnPackage(PKGS[0], true, null));
+        assertTrue(vpn.setAlwaysOnPackage(PKGS[0], true, null, mKeyStore));
         verify(mNetService).setAllowOnlyVpnForUids(eq(false), aryEq(new UidRange[] {
                 new UidRange(user.start + PKG_UIDS[0] + 1, user.start + PKG_UIDS[3] - 1),
                 new UidRange(user.start + PKG_UIDS[3] + 1, user.stop)
@@ -363,7 +367,8 @@
         assertUnblocked(vpn, user.start + PKG_UIDS[0]);
 
         // Add the whitelist.
-        assertTrue(vpn.setAlwaysOnPackage(PKGS[0], true, Collections.singletonList(PKGS[1])));
+        assertTrue(vpn.setAlwaysOnPackage(
+                PKGS[0], true, Collections.singletonList(PKGS[1]), mKeyStore));
         verify(mNetService).setAllowOnlyVpnForUids(eq(false), aryEq(new UidRange[] {
                 new UidRange(user.start + PKG_UIDS[0] + 1, user.stop)
         }));
@@ -375,12 +380,13 @@
         assertUnblocked(vpn, user.start + PKG_UIDS[0], user.start + PKG_UIDS[1]);
 
         // Try whitelisting a package with a comma, should be rejected.
-        assertFalse(vpn.setAlwaysOnPackage(PKGS[0], true, Collections.singletonList("a.b,c.d")));
+        assertFalse(vpn.setAlwaysOnPackage(
+                PKGS[0], true, Collections.singletonList("a.b,c.d"), mKeyStore));
 
         // Pass a non-existent packages in the whitelist, they (and only they) should be ignored.
         // Whitelisted package should change from PGKS[1] to PKGS[2].
-        assertTrue(vpn.setAlwaysOnPackage(PKGS[0], true,
-                Arrays.asList("com.foo.app", PKGS[2], "com.bar.app")));
+        assertTrue(vpn.setAlwaysOnPackage(
+                PKGS[0], true, Arrays.asList("com.foo.app", PKGS[2], "com.bar.app"), mKeyStore));
         verify(mNetService).setAllowOnlyVpnForUids(eq(false), aryEq(new UidRange[]{
                 new UidRange(user.start + PKG_UIDS[0] + 1, user.start + PKG_UIDS[1] - 1),
                 new UidRange(user.start + PKG_UIDS[1] + 1, user.stop)
@@ -405,7 +411,7 @@
         final UidRange profile = UidRange.createForUser(tempProfile.id);
 
         // Set lockdown.
-        assertTrue(vpn.setAlwaysOnPackage(PKGS[3], true, null));
+        assertTrue(vpn.setAlwaysOnPackage(PKGS[3], true, null, mKeyStore));
         verify(mNetService).setAllowOnlyVpnForUids(eq(true), aryEq(new UidRange[] {
             new UidRange(user.start, user.start + PKG_UIDS[3] - 1),
             new UidRange(user.start + PKG_UIDS[3] + 1, user.stop)
@@ -499,22 +505,22 @@
                 .thenReturn(Collections.singletonList(resInfo));
 
         // null package name should return false
-        assertFalse(vpn.isAlwaysOnPackageSupported(null));
+        assertFalse(vpn.isAlwaysOnPackageSupported(null, mKeyStore));
 
         // Pre-N apps are not supported
         appInfo.targetSdkVersion = VERSION_CODES.M;
-        assertFalse(vpn.isAlwaysOnPackageSupported(PKGS[0]));
+        assertFalse(vpn.isAlwaysOnPackageSupported(PKGS[0], mKeyStore));
 
         // N+ apps are supported by default
         appInfo.targetSdkVersion = VERSION_CODES.N;
-        assertTrue(vpn.isAlwaysOnPackageSupported(PKGS[0]));
+        assertTrue(vpn.isAlwaysOnPackageSupported(PKGS[0], mKeyStore));
 
         // Apps that opt out explicitly are not supported
         appInfo.targetSdkVersion = VERSION_CODES.CUR_DEVELOPMENT;
         Bundle metaData = new Bundle();
         metaData.putBoolean(VpnService.SERVICE_META_DATA_SUPPORTS_ALWAYS_ON, false);
         svcInfo.metaData = metaData;
-        assertFalse(vpn.isAlwaysOnPackageSupported(PKGS[0]));
+        assertFalse(vpn.isAlwaysOnPackageSupported(PKGS[0], mKeyStore));
     }
 
     @Test
@@ -531,7 +537,7 @@
                 .cancelAsUser(anyString(), anyInt(), eq(userHandle));
 
         // Start showing a notification for disconnected once always-on.
-        vpn.setAlwaysOnPackage(PKGS[0], false, null);
+        vpn.setAlwaysOnPackage(PKGS[0], false, null, mKeyStore);
         order.verify(mNotificationManager)
                 .notifyAsUser(anyString(), anyInt(), any(), eq(userHandle));
 
@@ -545,7 +551,7 @@
                 .notifyAsUser(anyString(), anyInt(), any(), eq(userHandle));
 
         // Notification should be cleared after unsetting always-on package.
-        vpn.setAlwaysOnPackage(null, false, null);
+        vpn.setAlwaysOnPackage(null, false, null, mKeyStore);
         order.verify(mNotificationManager).cancelAsUser(anyString(), anyInt(), eq(userHandle));
     }
 
@@ -920,12 +926,48 @@
                         eq(AppOpsManager.MODE_IGNORED));
     }
 
+    private void setAndVerifyAlwaysOnPackage(Vpn vpn, int uid, boolean lockdownEnabled) {
+        assertTrue(vpn.setAlwaysOnPackage(TEST_VPN_PKG, lockdownEnabled, null, mKeyStore));
+
+        verify(mKeyStore).get(eq(vpn.getProfileNameForPackage(TEST_VPN_PKG)));
+        verify(mAppOps).setMode(
+                eq(AppOpsManager.OP_ACTIVATE_PLATFORM_VPN), eq(uid), eq(TEST_VPN_PKG),
+                eq(AppOpsManager.MODE_ALLOWED));
+
+        verify(mSystemServices).settingsSecurePutStringForUser(
+                eq(Settings.Secure.ALWAYS_ON_VPN_APP), eq(TEST_VPN_PKG), eq(primaryUser.id));
+        verify(mSystemServices).settingsSecurePutIntForUser(
+                eq(Settings.Secure.ALWAYS_ON_VPN_LOCKDOWN), eq(lockdownEnabled ? 1 : 0),
+                eq(primaryUser.id));
+        verify(mSystemServices).settingsSecurePutStringForUser(
+                eq(Settings.Secure.ALWAYS_ON_VPN_LOCKDOWN_WHITELIST), eq(""), eq(primaryUser.id));
+    }
+
+    @Test
+    public void testSetAndStartAlwaysOnVpn() throws Exception {
+        final Vpn vpn = createVpn(primaryUser.id);
+        setMockedUsers(primaryUser);
+
+        // UID checks must return a different UID; otherwise it'll be treated as already prepared.
+        final int uid = Process.myUid() + 1;
+        when(mPackageManager.getPackageUidAsUser(eq(TEST_VPN_PKG), anyInt()))
+                .thenReturn(uid);
+        when(mKeyStore.get(vpn.getProfileNameForPackage(TEST_VPN_PKG)))
+                .thenReturn(mVpnProfile.encode());
+
+        setAndVerifyAlwaysOnPackage(vpn, uid, false);
+        assertTrue(vpn.startAlwaysOnVpn(mKeyStore));
+
+        // TODO: Test the Ikev2VpnRunner started up properly. Relies on utility methods added in
+        // a subsequent CL.
+    }
+
     /**
      * Mock some methods of vpn object.
      */
     private Vpn createVpn(@UserIdInt int userId) {
         return new Vpn(Looper.myLooper(), mContext, mNetService,
-                userId, mSystemServices, mIkev2SessionCreator);
+                userId, mKeyStore, mSystemServices, mIkev2SessionCreator);
     }
 
     private static void assertBlocked(Vpn vpn, int... uids) {
diff --git a/tools/stats_log_api_gen/Android.bp b/tools/stats_log_api_gen/Android.bp
index a251c05..d5031d7 100644
--- a/tools/stats_log_api_gen/Android.bp
+++ b/tools/stats_log_api_gen/Android.bp
@@ -121,7 +121,13 @@
     shared_libs: [
         "liblog",
         "libcutils",
+        "libstatssocket",
     ],
-    static_libs: ["libstatssocket"],
+    apex_available: [
+        "//apex_available:platform",
+        //TODO(b/149781190): Remove this once statsd no longer depends on libstatslog
+        "com.android.os.statsd",
+        "test_com.android.os.statsd",
+    ],
 }
 
diff --git a/wifi/Android.bp b/wifi/Android.bp
index 9f26203..5c9fb4e 100644
--- a/wifi/Android.bp
+++ b/wifi/Android.bp
@@ -86,7 +86,6 @@
         // TODO(b/146757305): should be unnecessary once
         // sdk_version="module_lib_current"
         "android_system_stubs_current",
-        "framework_mediaprovider_annotation", // for android.annotation.CurrentTimeMillisLong
     ],
     srcs: [
         ":framework-wifi-updatable-sources",
diff --git a/wifi/java/android/net/wifi/IWifiManager.aidl b/wifi/java/android/net/wifi/IWifiManager.aidl
index 1c330e2..3025caf 100644
--- a/wifi/java/android/net/wifi/IWifiManager.aidl
+++ b/wifi/java/android/net/wifi/IWifiManager.aidl
@@ -125,6 +125,8 @@
 
     DhcpInfo getDhcpInfo();
 
+    void setScanAlwaysAvailable(boolean isAvailable);
+
     boolean isScanAlwaysAvailable();
 
     boolean acquireWifiLock(IBinder lock, int lockType, String tag, in WorkSource ws);
diff --git a/wifi/java/android/net/wifi/SoftApConfiguration.java b/wifi/java/android/net/wifi/SoftApConfiguration.java
index 0db3313..ae5bf7d 100644
--- a/wifi/java/android/net/wifi/SoftApConfiguration.java
+++ b/wifi/java/android/net/wifi/SoftApConfiguration.java
@@ -17,6 +17,7 @@
 package android.net.wifi;
 
 import android.annotation.IntDef;
+import android.annotation.IntRange;
 import android.annotation.NonNull;
 import android.annotation.Nullable;
 import android.annotation.SystemApi;
@@ -202,6 +203,11 @@
     private final List<MacAddress> mAllowedClientList;
 
     /**
+     * Whether auto shutdown of soft AP is enabled or not.
+     */
+    private final boolean mAutoShutdownEnabled;
+
+    /**
      * Delay in milliseconds before shutting down soft AP when
      * there are no connected devices.
      */
@@ -240,9 +246,9 @@
     /** Private constructor for Builder and Parcelable implementation. */
     private SoftApConfiguration(@Nullable String ssid, @Nullable MacAddress bssid,
             @Nullable String passphrase, boolean hiddenSsid, @BandType int band, int channel,
-            @SecurityType int securityType, int maxNumberOfClients, int shutdownTimeoutMillis,
-            boolean clientControlByUser, @NonNull List<MacAddress> blockedList,
-            @NonNull List<MacAddress> allowedList) {
+            @SecurityType int securityType, int maxNumberOfClients, boolean shutdownTimeoutEnabled,
+            int shutdownTimeoutMillis, boolean clientControlByUser,
+            @NonNull List<MacAddress> blockedList, @NonNull List<MacAddress> allowedList) {
         mSsid = ssid;
         mBssid = bssid;
         mPassphrase = passphrase;
@@ -251,6 +257,7 @@
         mChannel = channel;
         mSecurityType = securityType;
         mMaxNumberOfClients = maxNumberOfClients;
+        mAutoShutdownEnabled = shutdownTimeoutEnabled;
         mShutdownTimeoutMillis = shutdownTimeoutMillis;
         mClientControlByUser = clientControlByUser;
         mBlockedClientList = new ArrayList<>(blockedList);
@@ -274,6 +281,7 @@
                 && mChannel == other.mChannel
                 && mSecurityType == other.mSecurityType
                 && mMaxNumberOfClients == other.mMaxNumberOfClients
+                && mAutoShutdownEnabled == other.mAutoShutdownEnabled
                 && mShutdownTimeoutMillis == other.mShutdownTimeoutMillis
                 && mClientControlByUser == other.mClientControlByUser
                 && Objects.equals(mBlockedClientList, other.mBlockedClientList)
@@ -283,8 +291,9 @@
     @Override
     public int hashCode() {
         return Objects.hash(mSsid, mBssid, mPassphrase, mHiddenSsid,
-                mBand, mChannel, mSecurityType, mMaxNumberOfClients, mShutdownTimeoutMillis,
-                mClientControlByUser, mBlockedClientList, mAllowedClientList);
+                mBand, mChannel, mSecurityType, mMaxNumberOfClients, mAutoShutdownEnabled,
+                mShutdownTimeoutMillis, mClientControlByUser, mBlockedClientList,
+                mAllowedClientList);
     }
 
     @Override
@@ -299,6 +308,7 @@
         sbuf.append(" \n Channel =").append(mChannel);
         sbuf.append(" \n SecurityType=").append(getSecurityType());
         sbuf.append(" \n MaxClient=").append(mMaxNumberOfClients);
+        sbuf.append(" \n AutoShutdownEnabled=").append(mAutoShutdownEnabled);
         sbuf.append(" \n ShutdownTimeoutMillis=").append(mShutdownTimeoutMillis);
         sbuf.append(" \n ClientControlByUser=").append(mClientControlByUser);
         sbuf.append(" \n BlockedClientList=").append(mBlockedClientList);
@@ -316,6 +326,7 @@
         dest.writeInt(mChannel);
         dest.writeInt(mSecurityType);
         dest.writeInt(mMaxNumberOfClients);
+        dest.writeBoolean(mAutoShutdownEnabled);
         dest.writeInt(mShutdownTimeoutMillis);
         dest.writeBoolean(mClientControlByUser);
         dest.writeTypedList(mBlockedClientList);
@@ -335,7 +346,7 @@
                     in.readString(),
                     in.readParcelable(MacAddress.class.getClassLoader()),
                     in.readString(), in.readBoolean(), in.readInt(), in.readInt(), in.readInt(),
-                    in.readInt(), in.readInt(), in.readBoolean(),
+                    in.readInt(), in.readBoolean(), in.readInt(), in.readBoolean(),
                     in.createTypedArrayList(MacAddress.CREATOR),
                     in.createTypedArrayList(MacAddress.CREATOR));
         }
@@ -429,6 +440,18 @@
     }
 
     /**
+     * Returns whether auto shutdown is enabled or not.
+     * The Soft AP will shutdown when there are no devices associated to it for
+     * the timeout duration. See {@link Builder#setAutoShutdownEnabled(boolean)}.
+     *
+     * @hide
+     */
+    @SystemApi
+    public boolean isAutoShutdownEnabled() {
+        return mAutoShutdownEnabled;
+    }
+
+    /**
      * Returns the shutdown timeout in milliseconds.
      * The Soft AP will shutdown when there are no devices associated to it for
      * the timeout duration. See {@link Builder#setShutdownTimeoutMillis(int)}.
@@ -551,6 +574,7 @@
         private int mChannel;
         private int mMaxNumberOfClients;
         private int mSecurityType;
+        private boolean mAutoShutdownEnabled;
         private int mShutdownTimeoutMillis;
         private boolean mClientControlByUser;
         private List<MacAddress> mBlockedClientList;
@@ -568,6 +592,7 @@
             mChannel = 0;
             mMaxNumberOfClients = 0;
             mSecurityType = SECURITY_TYPE_OPEN;
+            mAutoShutdownEnabled = true; // enabled by default.
             mShutdownTimeoutMillis = 0;
             mClientControlByUser = false;
             mBlockedClientList = new ArrayList<>();
@@ -588,6 +613,7 @@
             mChannel = other.mChannel;
             mMaxNumberOfClients = other.mMaxNumberOfClients;
             mSecurityType = other.mSecurityType;
+            mAutoShutdownEnabled = other.mAutoShutdownEnabled;
             mShutdownTimeoutMillis = other.mShutdownTimeoutMillis;
             mClientControlByUser = other.mClientControlByUser;
             mBlockedClientList = new ArrayList<>(other.mBlockedClientList);
@@ -603,8 +629,8 @@
         public SoftApConfiguration build() {
             return new SoftApConfiguration(mSsid, mBssid, mPassphrase,
                     mHiddenSsid, mBand, mChannel, mSecurityType, mMaxNumberOfClients,
-                    mShutdownTimeoutMillis, mClientControlByUser, mBlockedClientList,
-                    mAllowedClientList);
+                    mAutoShutdownEnabled, mShutdownTimeoutMillis, mClientControlByUser,
+                    mBlockedClientList, mAllowedClientList);
         }
 
         /**
@@ -789,7 +815,7 @@
          * @return Builder for chaining.
          */
         @NonNull
-        public Builder setMaxNumberOfClients(int maxNumberOfClients) {
+        public Builder setMaxNumberOfClients(@IntRange(from = 0) int maxNumberOfClients) {
             if (maxNumberOfClients < 0) {
                 throw new IllegalArgumentException("maxNumberOfClients should be not negative");
             }
@@ -798,6 +824,25 @@
         }
 
         /**
+         * Specifies whether auto shutdown is enabled or not.
+         * The Soft AP will shut down when there are no devices connected to it for
+         * the timeout duration.
+         *
+         * <p>
+         * <li>If not set, defaults to true</li>
+         *
+         * @param enable true to enable, false to disable.
+         * @return Builder for chaining.
+         *
+         * @see #setShutdownTimeoutMillis(int)
+         */
+        @NonNull
+        public Builder setAutoShutdownEnabled(boolean enable) {
+            mAutoShutdownEnabled = enable;
+            return this;
+        }
+
+        /**
          * Specifies the shutdown timeout in milliseconds.
          * The Soft AP will shut down when there are no devices connected to it for
          * the timeout duration.
@@ -807,14 +852,16 @@
          *
          * <p>
          * <li>If not set, defaults to 0</li>
-         * <li>The shut down timout will apply when
-         * {@link Settings.Global.SOFT_AP_TIMEOUT_ENABLED} is true</li>
+         * <li>The shut down timeout will apply when {@link #setAutoShutdownEnabled(boolean)} is
+         * set to true</li>
          *
          * @param timeoutMillis milliseconds of the timeout delay.
          * @return Builder for chaining.
+         *
+         * @see #setAutoShutdownEnabled(boolean)
          */
         @NonNull
-        public Builder setShutdownTimeoutMillis(int timeoutMillis) {
+        public Builder setShutdownTimeoutMillis(@IntRange(from = 0) int timeoutMillis) {
             if (timeoutMillis < 0) {
                 throw new IllegalArgumentException("Invalid timeout value");
             }
diff --git a/wifi/java/android/net/wifi/WifiManager.java b/wifi/java/android/net/wifi/WifiManager.java
index f693315..af2f246 100644
--- a/wifi/java/android/net/wifi/WifiManager.java
+++ b/wifi/java/android/net/wifi/WifiManager.java
@@ -2755,6 +2755,26 @@
     }
 
     /**
+     * Set if scanning is always available.
+     *
+     * If set to {@code true}, apps can issue {@link #startScan} and fetch scan results
+     * even when Wi-Fi is turned off.
+     *
+     * @param isAvailable true to enable, false to disable.
+     * @hide
+     * @see #isScanAlwaysAvailable()
+     */
+    @SystemApi
+    @RequiresPermission(android.Manifest.permission.NETWORK_SETTINGS)
+    public void setScanAlwaysAvailable(boolean isAvailable) {
+        try {
+            mService.setScanAlwaysAvailable(isAvailable);
+        } catch (RemoteException e) {
+            throw e.rethrowFromSystemServer();
+        }
+    }
+
+    /**
      * Check if scanning is always available.
      *
      * If this return {@code true}, apps can issue {@link #startScan} and fetch scan results
diff --git a/wifi/java/android/net/wifi/WifiOemMigrationHook.java b/wifi/java/android/net/wifi/WifiOemMigrationHook.java
index 22d7786..44dbb98 100755
--- a/wifi/java/android/net/wifi/WifiOemMigrationHook.java
+++ b/wifi/java/android/net/wifi/WifiOemMigrationHook.java
@@ -21,8 +21,10 @@
 import android.annotation.NonNull;
 import android.annotation.Nullable;
 import android.annotation.SystemApi;
+import android.content.Context;
 import android.os.Parcel;
 import android.os.Parcelable;
+import android.provider.Settings;
 
 import java.util.List;
 
@@ -33,6 +35,9 @@
  */
 @SystemApi
 public final class WifiOemMigrationHook {
+
+    private WifiOemMigrationHook() { }
+
     /**
      * Container for all the wifi config data to migrate.
      */
@@ -152,8 +157,6 @@
         }
     }
 
-    private WifiOemMigrationHook() { }
-
     /**
      * Load data from OEM's config store.
      * <p>
@@ -178,4 +181,263 @@
         // Note: OEM's should add code to parse data from their config store format here!
         return null;
     }
+
+    /**
+     * Container for all the wifi settings data to migrate.
+     */
+    public static final class SettingsMigrationData implements Parcelable {
+        private final boolean mScanAlwaysAvailable;
+        private final boolean mP2pFactoryResetPending;
+        private final String mP2pDeviceName;
+        private final boolean mSoftApTimeoutEnabled;
+        private final boolean mWakeupEnabled;
+        private final boolean mScanThrottleEnabled;
+        private final boolean mVerboseLoggingEnabled;
+
+        private SettingsMigrationData(boolean scanAlwaysAvailable, boolean p2pFactoryResetPending,
+                @Nullable String p2pDeviceName, boolean softApTimeoutEnabled, boolean wakeupEnabled,
+                boolean scanThrottleEnabled, boolean verboseLoggingEnabled) {
+            mScanAlwaysAvailable = scanAlwaysAvailable;
+            mP2pFactoryResetPending = p2pFactoryResetPending;
+            mP2pDeviceName = p2pDeviceName;
+            mSoftApTimeoutEnabled = softApTimeoutEnabled;
+            mWakeupEnabled = wakeupEnabled;
+            mScanThrottleEnabled = scanThrottleEnabled;
+            mVerboseLoggingEnabled = verboseLoggingEnabled;
+        }
+
+        public static final @NonNull Parcelable.Creator<SettingsMigrationData> CREATOR =
+                new Parcelable.Creator<SettingsMigrationData>() {
+                    @Override
+                    public SettingsMigrationData createFromParcel(Parcel in) {
+                        boolean scanAlwaysAvailable = in.readBoolean();
+                        boolean p2pFactoryResetPending = in.readBoolean();
+                        String p2pDeviceName = in.readString();
+                        boolean softApTimeoutEnabled = in.readBoolean();
+                        boolean wakeupEnabled = in.readBoolean();
+                        boolean scanThrottleEnabled = in.readBoolean();
+                        boolean verboseLoggingEnabled = in.readBoolean();
+                        return new SettingsMigrationData(
+                                scanAlwaysAvailable, p2pFactoryResetPending,
+                                p2pDeviceName, softApTimeoutEnabled, wakeupEnabled,
+                                scanThrottleEnabled, verboseLoggingEnabled);
+                    }
+
+                    @Override
+                    public SettingsMigrationData[] newArray(int size) {
+                        return new SettingsMigrationData[size];
+                    }
+                };
+
+        @Override
+        public int describeContents() {
+            return 0;
+        }
+
+        @Override
+        public void writeToParcel(@NonNull Parcel dest, int flags) {
+            dest.writeBoolean(mScanAlwaysAvailable);
+            dest.writeBoolean(mP2pFactoryResetPending);
+            dest.writeString(mP2pDeviceName);
+            dest.writeBoolean(mSoftApTimeoutEnabled);
+            dest.writeBoolean(mWakeupEnabled);
+            dest.writeBoolean(mScanThrottleEnabled);
+            dest.writeBoolean(mVerboseLoggingEnabled);
+        }
+
+        /**
+         * @return True if scans are allowed even when wifi is toggled off, false otherwise.
+         */
+        public boolean isScanAlwaysAvailable() {
+            return mScanAlwaysAvailable;
+        }
+
+        /**
+         * @return indicate whether factory reset request is pending.
+         */
+        public boolean isP2pFactoryResetPending() {
+            return mP2pFactoryResetPending;
+        }
+
+        /**
+         * @return the Wi-Fi peer-to-peer device name
+         */
+        public @Nullable String getP2pDeviceName() {
+            return mP2pDeviceName;
+        }
+
+        /**
+         * @return Whether soft AP will shut down after a timeout period when no devices are
+         * connected.
+         */
+        public boolean isSoftApTimeoutEnabled() {
+            return mSoftApTimeoutEnabled;
+        }
+
+        /**
+         * @return whether Wi-Fi Wakeup feature is enabled.
+         */
+        public boolean isWakeUpEnabled() {
+            return mWakeupEnabled;
+        }
+
+        /**
+         * @return Whether wifi scan throttle is enabled or not.
+         */
+        public boolean isScanThrottleEnabled() {
+            return mScanThrottleEnabled;
+        }
+
+        /**
+         * @return Whether to enable verbose logging in Wi-Fi.
+         */
+        public boolean isVerboseLoggingEnabled() {
+            return mVerboseLoggingEnabled;
+        }
+
+        /**
+         * Builder to create instance of {@link SettingsMigrationData}.
+         */
+        public static final class Builder {
+            private boolean mScanAlwaysAvailable;
+            private boolean mP2pFactoryResetPending;
+            private String mP2pDeviceName;
+            private boolean mSoftApTimeoutEnabled;
+            private boolean mWakeupEnabled;
+            private boolean mScanThrottleEnabled;
+            private boolean mVerboseLoggingEnabled;
+
+            public Builder() {
+            }
+
+            /**
+             * Setting to allow scans even when wifi is toggled off.
+             *
+             * @param available true if available, false otherwise.
+             * @return Instance of {@link Builder} to enable chaining of the builder method.
+             */
+            public @NonNull Builder setScanAlwaysAvailable(boolean available) {
+                mScanAlwaysAvailable = available;
+                return this;
+            }
+
+            /**
+             * Indicate whether factory reset request is pending.
+             *
+             * @param pending true if pending, false otherwise.
+             * @return Instance of {@link Builder} to enable chaining of the builder method.
+             */
+            public @NonNull Builder setP2pFactoryResetPending(boolean pending) {
+                mP2pFactoryResetPending = pending;
+                return this;
+            }
+
+            /**
+             * The Wi-Fi peer-to-peer device name
+             *
+             * @param name Name if set, null otherwise.
+             * @return Instance of {@link Builder} to enable chaining of the builder method.
+             */
+            public @NonNull Builder setP2pDeviceName(@Nullable String name) {
+                mP2pDeviceName = name;
+                return this;
+            }
+
+            /**
+             * Whether soft AP will shut down after a timeout period when no devices are connected.
+             *
+             * @param enabled true if enabled, false otherwise.
+             * @return Instance of {@link Builder} to enable chaining of the builder method.
+             */
+            public @NonNull Builder setSoftApTimeoutEnabled(boolean enabled) {
+                mSoftApTimeoutEnabled = enabled;
+                return this;
+            }
+
+            /**
+             * Value to specify if Wi-Fi Wakeup feature is enabled.
+             *
+             * @param enabled true if enabled, false otherwise.
+             * @return Instance of {@link Builder} to enable chaining of the builder method.
+             */
+            public @NonNull Builder setWakeUpEnabled(boolean enabled) {
+                mWakeupEnabled = enabled;
+                return this;
+            }
+
+            /**
+             * Whether wifi scan throttle is enabled or not.
+             *
+             * @param enabled true if enabled, false otherwise.
+             * @return Instance of {@link Builder} to enable chaining of the builder method.
+             */
+            public @NonNull Builder setScanThrottleEnabled(boolean enabled) {
+                mScanThrottleEnabled = enabled;
+                return this;
+            }
+
+            /**
+             * Setting to enable verbose logging in Wi-Fi.
+             *
+             * @param enabled true if enabled, false otherwise.
+             * @return Instance of {@link Builder} to enable chaining of the builder method.
+             */
+            public @NonNull Builder setVerboseLoggingEnabled(boolean enabled) {
+                mVerboseLoggingEnabled = enabled;
+                return this;
+            }
+
+            /**
+             * Build an instance of {@link SettingsMigrationData}.
+             *
+             * @return Instance of {@link SettingsMigrationData}.
+             */
+            public @NonNull SettingsMigrationData build() {
+                return new SettingsMigrationData(mScanAlwaysAvailable, mP2pFactoryResetPending,
+                        mP2pDeviceName, mSoftApTimeoutEnabled, mWakeupEnabled, mScanThrottleEnabled,
+                        mVerboseLoggingEnabled);
+            }
+        }
+    }
+
+    /**
+     * Load data from Settings.Global values.
+     *
+     * <p>
+     * Note:
+     * <li> This is method is invoked once on the first bootup. OEM can safely delete these settings
+     * once the migration is complete. The first & only relevant invocation of
+     * {@link #loadFromSettings(Context)} ()} occurs when a previously released
+     * device upgrades to the wifi mainline module from an OEM implementation of the wifi stack.
+     * </li>
+     *
+     * @param context Context to use for loading the settings provider.
+     * @return Instance of {@link SettingsMigrationData} for migrating data.
+     */
+    @NonNull
+    public static SettingsMigrationData loadFromSettings(@NonNull Context context) {
+        return new SettingsMigrationData.Builder()
+                .setScanAlwaysAvailable(
+                        Settings.Global.getInt(context.getContentResolver(),
+                                Settings.Global.WIFI_SCAN_ALWAYS_AVAILABLE, 0) == 1)
+                .setP2pFactoryResetPending(
+                        Settings.Global.getInt(context.getContentResolver(),
+                                Settings.Global.WIFI_P2P_PENDING_FACTORY_RESET, 0) == 1)
+                .setP2pDeviceName(
+                        Settings.Global.getString(context.getContentResolver(),
+                                Settings.Global.WIFI_P2P_DEVICE_NAME))
+                .setSoftApTimeoutEnabled(
+                        Settings.Global.getInt(context.getContentResolver(),
+                                Settings.Global.SOFT_AP_TIMEOUT_ENABLED, 1) == 1)
+                .setWakeUpEnabled(
+                        Settings.Global.getInt(context.getContentResolver(),
+                                Settings.Global.WIFI_WAKEUP_ENABLED, 0) == 1)
+                .setScanThrottleEnabled(
+                        Settings.Global.getInt(context.getContentResolver(),
+                                Settings.Global.WIFI_SCAN_THROTTLE_ENABLED, 1) == 1)
+                .setVerboseLoggingEnabled(
+                        Settings.Global.getInt(context.getContentResolver(),
+                                Settings.Global.WIFI_VERBOSE_LOGGING_ENABLED, 1) == 1)
+                .build();
+    }
 }
diff --git a/wifi/java/android/net/wifi/hotspot2/PasspointConfiguration.java b/wifi/java/android/net/wifi/hotspot2/PasspointConfiguration.java
index 7d9bdba..4507cc2 100644
--- a/wifi/java/android/net/wifi/hotspot2/PasspointConfiguration.java
+++ b/wifi/java/android/net/wifi/hotspot2/PasspointConfiguration.java
@@ -900,12 +900,15 @@
     }
 
     /**
-     * Get a unique identifier for a PasspointConfiguration object.
+     * Get a unique identifier for a PasspointConfiguration object. The identifier depends on the
+     * configuration that identify the service provider under the HomeSp subtree, and on the
+     * credential configuration under the Credential subtree.
+     * The method throws an {@link IllegalStateException} if the configuration under HomeSp subtree
+     * or the configuration under Credential subtree are not initialized.
      *
      * @return A unique identifier
-     * @throws IllegalStateException if Credential or HomeSP nodes are not initialized
      */
-    public @NonNull String getUniqueId() throws IllegalStateException {
+    public @NonNull String getUniqueId() {
         if (mCredential == null || mHomeSp == null || TextUtils.isEmpty(mHomeSp.getFqdn())) {
             throw new IllegalStateException("Credential or HomeSP are not initialized");
         }
diff --git a/wifi/tests/src/android/net/wifi/SoftApConfigurationTest.java b/wifi/tests/src/android/net/wifi/SoftApConfigurationTest.java
index d958488..060ddf0 100644
--- a/wifi/tests/src/android/net/wifi/SoftApConfigurationTest.java
+++ b/wifi/tests/src/android/net/wifi/SoftApConfigurationTest.java
@@ -125,6 +125,7 @@
                 .setChannel(149, SoftApConfiguration.BAND_5GHZ)
                 .setHiddenSsid(true)
                 .setMaxNumberOfClients(10)
+                .setAutoShutdownEnabled(true)
                 .setShutdownTimeoutMillis(500000)
                 .enableClientControlByUser(true)
                 .setClientList(testBlockedClientList, testAllowedClientList)
@@ -136,6 +137,7 @@
         assertThat(original.getChannel()).isEqualTo(149);
         assertThat(original.isHiddenSsid()).isEqualTo(true);
         assertThat(original.getMaxNumberOfClients()).isEqualTo(10);
+        assertThat(original.isAutoShutdownEnabled()).isEqualTo(true);
         assertThat(original.getShutdownTimeoutMillis()).isEqualTo(500000);
         assertThat(original.isClientControlByUserEnabled()).isEqualTo(true);
         assertThat(original.getBlockedClientList()).isEqualTo(testBlockedClientList);
diff --git a/wifi/tests/src/android/net/wifi/WifiManagerTest.java b/wifi/tests/src/android/net/wifi/WifiManagerTest.java
index 853212a..234d929 100644
--- a/wifi/tests/src/android/net/wifi/WifiManagerTest.java
+++ b/wifi/tests/src/android/net/wifi/WifiManagerTest.java
@@ -2401,4 +2401,15 @@
         assertFalse(mWifiManager.isAutoWakeupEnabled());
         verify(mWifiService).isAutoWakeupEnabled();
     }
+
+
+    @Test
+    public void testScanAvailable() throws Exception {
+        mWifiManager.setScanAlwaysAvailable(true);
+        verify(mWifiService).setScanAlwaysAvailable(true);
+
+        when(mWifiService.isScanAlwaysAvailable()).thenReturn(false);
+        assertFalse(mWifiManager.isScanAlwaysAvailable());
+        verify(mWifiService).isScanAlwaysAvailable();
+    }
 }
diff --git a/wifi/tests/src/android/net/wifi/hotspot2/PasspointConfigurationTest.java b/wifi/tests/src/android/net/wifi/hotspot2/PasspointConfigurationTest.java
index 8f6beb1..638efb9 100644
--- a/wifi/tests/src/android/net/wifi/hotspot2/PasspointConfigurationTest.java
+++ b/wifi/tests/src/android/net/wifi/hotspot2/PasspointConfigurationTest.java
@@ -426,17 +426,11 @@
      *
      * @throws Exception
      */
-    @Test
+    @Test (expected = IllegalStateException.class)
     public void validateUniqueIdExceptionWithEmptyHomeSp() throws Exception {
         PasspointConfiguration config = PasspointTestUtils.createConfig();
         config.setHomeSp(null);
-        boolean exceptionCaught = false;
-        try {
-            String uniqueId = config.getUniqueId();
-        } catch (IllegalStateException e) {
-            exceptionCaught = true;
-        }
-        assertTrue(exceptionCaught);
+        String uniqueId = config.getUniqueId();
     }
 
     /**
@@ -445,16 +439,10 @@
      *
      * @throws Exception
      */
-    @Test
+    @Test (expected = IllegalStateException.class)
     public void validateUniqueIdExceptionWithEmptyCredential() throws Exception {
         PasspointConfiguration config = PasspointTestUtils.createConfig();
         config.setCredential(null);
-        boolean exceptionCaught = false;
-        try {
-            String uniqueId = config.getUniqueId();
-        } catch (IllegalStateException e) {
-            exceptionCaught = true;
-        }
-        assertTrue(exceptionCaught);
+        String uniqueId = config.getUniqueId();
     }
 }