Merge "DO NOT MERGE: Fix issue #129936402: Runtime restart occurs when suspending an app..." into qt-dev
diff --git a/Android.bp b/Android.bp
index 7cc2f30..21054dd 100644
--- a/Android.bp
+++ b/Android.bp
@@ -319,6 +319,7 @@
         "core/java/android/service/vr/IVrManager.aidl",
         "core/java/android/service/vr/IVrStateCallbacks.aidl",
         "core/java/android/service/watchdog/IExplicitHealthCheckService.aidl",
+        "core/java/android/service/watchdog/PackageInfo.aidl",
         "core/java/android/print/ILayoutResultCallback.aidl",
         "core/java/android/print/IPrinterDiscoveryObserver.aidl",
         "core/java/android/print/IPrintDocumentAdapter.aidl",
@@ -1049,6 +1050,35 @@
     },
 }
 
+// This library is meant for vendor code that needs to output protobuf. It links
+// against the static version of libprotobuf-cpp-lite, for which we can not guarantee
+// binary compatibility.
+cc_library {
+    name: "libplatformprotos-static",
+    defaults: ["libplatformprotos-defaults"],
+    host_supported: false,
+
+    // This is okay because this library is only built as a static library.  The C++
+    // API is not guaranteed. The proto API is guaranteed to be stable via Metrics Council,
+    // but is not authorized to be used outside of debugging.
+    vendor_available: true,
+
+    target: {
+        android: {
+            proto: {
+                type: "lite",
+            },
+            static_libs: [
+                "libprotobuf-cpp-lite",
+            ],
+            shared: {
+                enabled: false,
+            },
+        },
+    },
+}
+
+
 // This is the full proto version of libplatformprotos. It may only
 // be used by test code that is not shipped on the device.
 cc_library {
diff --git a/api/system-current.txt b/api/system-current.txt
index 3f74596..6458909 100644
--- a/api/system-current.txt
+++ b/api/system-current.txt
@@ -6895,12 +6895,21 @@
     method @NonNull public final android.os.IBinder onBind(@NonNull android.content.Intent);
     method public abstract void onCancelHealthCheck(@NonNull String);
     method @NonNull public abstract java.util.List<java.lang.String> onGetRequestedPackages();
-    method @NonNull public abstract java.util.List<java.lang.String> onGetSupportedPackages();
+    method @NonNull public abstract java.util.List<android.service.watchdog.PackageInfo> onGetSupportedPackages();
     method public abstract void onRequestHealthCheck(@NonNull String);
     field public static final String BIND_PERMISSION = "android.permission.BIND_EXPLICIT_HEALTH_CHECK_SERVICE";
     field public static final String SERVICE_INTERFACE = "android.service.watchdog.ExplicitHealthCheckService";
   }
 
+  public final class PackageInfo implements android.os.Parcelable {
+    ctor public PackageInfo(@NonNull String, long);
+    method public int describeContents();
+    method public long getHealthCheckTimeoutMillis();
+    method @NonNull public String getPackageName();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.service.watchdog.PackageInfo> CREATOR;
+  }
+
 }
 
 package android.telecom {
diff --git a/core/java/android/provider/DeviceConfig.java b/core/java/android/provider/DeviceConfig.java
index 5631282..9ec7723 100644
--- a/core/java/android/provider/DeviceConfig.java
+++ b/core/java/android/provider/DeviceConfig.java
@@ -260,6 +260,13 @@
     public static final String NAMESPACE_TEXTCLASSIFIER = "textclassifier";
 
     /**
+     * Namespace for contacts provider related features.
+     *
+     * @hide
+     */
+    public static final String NAMESPACE_CONTACTS_PROVIDER = "contacts_provider";
+
+    /**
      * List of namespaces which can be read without READ_DEVICE_CONFIG permission
      *
      * @hide
diff --git a/core/java/android/service/watchdog/ExplicitHealthCheckService.java b/core/java/android/service/watchdog/ExplicitHealthCheckService.java
index 015fba1..682b872 100644
--- a/core/java/android/service/watchdog/ExplicitHealthCheckService.java
+++ b/core/java/android/service/watchdog/ExplicitHealthCheckService.java
@@ -61,7 +61,7 @@
     private static final String TAG = "ExplicitHealthCheckService";
 
     /**
-     * {@link Bundle} key for a {@link List} of {@link String} value.
+     * {@link Bundle} key for a {@link List} of {@link PackageInfo} value.
      *
      * {@hide}
      */
@@ -130,7 +130,7 @@
      *
      * @return all packages supporting explicit health checks
      */
-    @NonNull public abstract List<String> onGetSupportedPackages();
+    @NonNull public abstract List<PackageInfo> onGetSupportedPackages();
 
     /**
      * Called when the system requests for all the packages that it has currently requested
@@ -187,22 +187,26 @@
 
         @Override
         public void getSupportedPackages(RemoteCallback callback) throws RemoteException {
-            mHandler.post(() -> sendPackages(callback, EXTRA_SUPPORTED_PACKAGES,
-                    ExplicitHealthCheckService.this.onGetSupportedPackages()));
+            mHandler.post(() -> {
+                List<PackageInfo> packages =
+                        ExplicitHealthCheckService.this.onGetSupportedPackages();
+                Objects.requireNonNull(packages, "Supported package list must be non-null");
+                Bundle bundle = new Bundle();
+                bundle.putParcelableArrayList(EXTRA_SUPPORTED_PACKAGES, new ArrayList<>(packages));
+                callback.sendResult(bundle);
+            });
         }
 
         @Override
         public void getRequestedPackages(RemoteCallback callback) throws RemoteException {
-            mHandler.post(() -> sendPackages(callback, EXTRA_REQUESTED_PACKAGES,
-                    ExplicitHealthCheckService.this.onGetRequestedPackages()));
-        }
-
-        private void sendPackages(RemoteCallback callback, String key, List<String> packages) {
-            Objects.requireNonNull(packages,
-                    "Supported and requested package list must be non-null");
-            Bundle bundle = new Bundle();
-            bundle.putStringArrayList(key, new ArrayList<>(packages));
-            callback.sendResult(bundle);
+            mHandler.post(() -> {
+                List<String> packages =
+                        ExplicitHealthCheckService.this.onGetRequestedPackages();
+                Objects.requireNonNull(packages, "Requested  package list must be non-null");
+                Bundle bundle = new Bundle();
+                bundle.putStringArrayList(EXTRA_REQUESTED_PACKAGES, new ArrayList<>(packages));
+                callback.sendResult(bundle);
+            });
         }
     }
 }
diff --git a/core/java/android/service/watchdog/PackageInfo.aidl b/core/java/android/service/watchdog/PackageInfo.aidl
new file mode 100644
index 0000000..5605aec
--- /dev/null
+++ b/core/java/android/service/watchdog/PackageInfo.aidl
@@ -0,0 +1,22 @@
+/*
+ * 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.watchdog;
+
+/**
+ * @hide
+ */
+parcelable PackageInfo;
diff --git a/core/java/android/service/watchdog/PackageInfo.java b/core/java/android/service/watchdog/PackageInfo.java
new file mode 100644
index 0000000..cee9b6d
--- /dev/null
+++ b/core/java/android/service/watchdog/PackageInfo.java
@@ -0,0 +1,130 @@
+/*
+ * 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.watchdog;
+
+import android.annotation.NonNull;
+import android.annotation.SystemApi;
+import android.os.Parcel;
+import android.os.Parcelable;
+
+import com.android.internal.util.Preconditions;
+
+import java.util.Objects;
+import java.util.concurrent.TimeUnit;
+
+/**
+ * A PackageInfo contains a package supporting explicit health checks and the
+ * timeout in {@link System#uptimeMillis} across reboots after which health
+ * check requests from clients are failed.
+ *
+ * @hide
+ */
+@SystemApi
+public final class PackageInfo implements Parcelable {
+    // TODO: Receive from DeviceConfig flag
+    private static final long DEFAULT_HEALTH_CHECK_TIMEOUT_MILLIS = TimeUnit.HOURS.toMillis(1);
+
+    private final String mPackageName;
+    private final long mHealthCheckTimeoutMillis;
+
+    /**
+     * Creates a new instance.
+     *
+     * @param packageName the package name
+     * @param durationMillis the duration in milliseconds, must be greater than or
+     * equal to 0. If it is 0, it will use a system default value.
+     */
+    public PackageInfo(@NonNull String packageName, long healthCheckTimeoutMillis) {
+        mPackageName = Preconditions.checkNotNull(packageName);
+        if (healthCheckTimeoutMillis == 0) {
+            mHealthCheckTimeoutMillis = DEFAULT_HEALTH_CHECK_TIMEOUT_MILLIS;
+        } else {
+            mHealthCheckTimeoutMillis = Preconditions.checkArgumentNonnegative(
+                    healthCheckTimeoutMillis);
+        }
+    }
+
+    private PackageInfo(Parcel parcel) {
+        mPackageName = parcel.readString();
+        mHealthCheckTimeoutMillis = parcel.readLong();
+    }
+
+    /**
+     * Gets the package name.
+     *
+     * @return the package name
+     */
+    public @NonNull String getPackageName() {
+        return mPackageName;
+    }
+
+    /**
+     * Gets the timeout in milliseconds to evaluate an explicit health check result after a request.
+     *
+     * @return the duration in {@link System#uptimeMillis} across reboots
+     */
+    public long getHealthCheckTimeoutMillis() {
+        return mHealthCheckTimeoutMillis;
+    }
+
+    @Override
+    public String toString() {
+        return "PackageInfo{" + mPackageName + ", " + mHealthCheckTimeoutMillis + "}";
+    }
+
+    @Override
+    public boolean equals(Object other) {
+        if (other == this) {
+            return true;
+        }
+        if (!(other instanceof PackageInfo)) {
+            return false;
+        }
+
+        PackageInfo otherInfo = (PackageInfo) other;
+        return Objects.equals(otherInfo.getHealthCheckTimeoutMillis(), mHealthCheckTimeoutMillis)
+                && Objects.equals(otherInfo.getPackageName(), mPackageName);
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(mPackageName, mHealthCheckTimeoutMillis);
+    }
+
+    @Override
+    public int describeContents() {
+        return 0;
+    }
+
+    @Override
+    public void writeToParcel(Parcel parcel, int flags) {
+        parcel.writeString(mPackageName);
+        parcel.writeLong(mHealthCheckTimeoutMillis);
+    }
+
+    public static final @NonNull Creator<PackageInfo> CREATOR = new Creator<PackageInfo>() {
+            @Override
+            public PackageInfo createFromParcel(Parcel source) {
+                return new PackageInfo(source);
+            }
+
+            @Override
+            public PackageInfo[] newArray(int size) {
+                return new PackageInfo[size];
+            }
+        };
+}
diff --git a/core/java/android/view/SurfaceControl.java b/core/java/android/view/SurfaceControl.java
index ad2f65a..ec62e19 100644
--- a/core/java/android/view/SurfaceControl.java
+++ b/core/java/android/view/SurfaceControl.java
@@ -92,7 +92,7 @@
             Rect sourceCrop, int width, int height, boolean useIdentityTransform, int rotation,
             boolean captureSecureLayers);
     private static native ScreenshotGraphicBuffer nativeCaptureLayers(IBinder layerHandleToken,
-            Rect sourceCrop, float frameScale);
+            Rect sourceCrop, float frameScale, IBinder[] excludeLayers);
 
     private static native long nativeCreateTransaction();
     private static native long nativeGetNativeTransactionFinalizer();
@@ -1991,7 +1991,16 @@
      */
     public static ScreenshotGraphicBuffer captureLayers(IBinder layerHandleToken, Rect sourceCrop,
             float frameScale) {
-        return nativeCaptureLayers(layerHandleToken, sourceCrop, frameScale);
+        return nativeCaptureLayers(layerHandleToken, sourceCrop, frameScale, null);
+    }
+
+    /**
+     * Like {@link captureLayers} but with an array of layer handles to exclude.
+     * @hide
+     */
+    public static ScreenshotGraphicBuffer captureLayersExcluding(IBinder layerHandleToken,
+            Rect sourceCrop, float frameScale, IBinder[] exclude) {
+        return nativeCaptureLayers(layerHandleToken, sourceCrop, frameScale, exclude);
     }
 
     /**
diff --git a/core/java/com/android/internal/app/ChooserActivity.java b/core/java/com/android/internal/app/ChooserActivity.java
index afa6a6a..94be25f 100644
--- a/core/java/com/android/internal/app/ChooserActivity.java
+++ b/core/java/com/android/internal/app/ChooserActivity.java
@@ -788,7 +788,7 @@
         } else {
             ImageView fileIconView = parent.findViewById(R.id.content_preview_file_icon);
             fileIconView.setVisibility(View.VISIBLE);
-            fileIconView.setImageResource(R.drawable.ic_doc_generic);
+            fileIconView.setImageResource(R.drawable.chooser_file_generic);
         }
     }
 
@@ -837,12 +837,14 @@
             }
 
             for (Uri uri : uris) {
-                if (findPreferredContentPreview(uri, resolver) == CONTENT_PREVIEW_IMAGE) {
-                    return CONTENT_PREVIEW_IMAGE;
+                // Defaulting to file preview when there are mixed image/file types is
+                // preferable, as it shows the user the correct number of items being shared
+                if (findPreferredContentPreview(uri, resolver) == CONTENT_PREVIEW_FILE) {
+                    return CONTENT_PREVIEW_FILE;
                 }
             }
 
-            return CONTENT_PREVIEW_FILE;
+            return CONTENT_PREVIEW_IMAGE;
         }
 
         return CONTENT_PREVIEW_TEXT;
diff --git a/core/jni/android_view_SurfaceControl.cpp b/core/jni/android_view_SurfaceControl.cpp
index eb64fc4..c254266 100644
--- a/core/jni/android_view_SurfaceControl.cpp
+++ b/core/jni/android_view_SurfaceControl.cpp
@@ -270,7 +270,7 @@
 }
 
 static jobject nativeCaptureLayers(JNIEnv* env, jclass clazz, jobject layerHandleToken,
-        jobject sourceCropObj, jfloat frameScale) {
+        jobject sourceCropObj, jfloat frameScale, jobjectArray excludeArray) {
 
     sp<IBinder> layerHandle = ibinderForJavaObject(env, layerHandleToken);
     if (layerHandle == NULL) {
@@ -282,11 +282,27 @@
         sourceCrop = rectFromObj(env, sourceCropObj);
     }
 
+    std::unordered_set<sp<IBinder>,ISurfaceComposer::SpHash<IBinder>> excludeHandles;
+    if (excludeArray != NULL) {
+        const jsize len = env->GetArrayLength(excludeArray);
+        excludeHandles.reserve(len);
+
+        for (jsize i = 0; i < len; i++) {
+            jobject obj = env->GetObjectArrayElement(excludeArray, i);
+            if (obj == nullptr) {
+                jniThrowNullPointerException(env, "Exclude layer is null");
+                return NULL;
+            }
+            sp<IBinder> excludeHandle = ibinderForJavaObject(env, obj);
+            excludeHandles.emplace(excludeHandle);
+        }
+    }
+
     sp<GraphicBuffer> buffer;
     const ui::Dataspace dataspace = ui::Dataspace::V0_SRGB;
     status_t res = ScreenshotClient::captureChildLayers(layerHandle, dataspace,
                                                         ui::PixelFormat::RGBA_8888, sourceCrop,
-                                                        frameScale, &buffer);
+                                                        excludeHandles, frameScale, &buffer);
     if (res != NO_ERROR) {
         return NULL;
     }
@@ -1354,7 +1370,7 @@
             "Landroid/view/SurfaceControl$ScreenshotGraphicBuffer;",
             (void*)nativeScreenshot },
     {"nativeCaptureLayers",
-            "(Landroid/os/IBinder;Landroid/graphics/Rect;F)"
+            "(Landroid/os/IBinder;Landroid/graphics/Rect;F[Landroid/os/IBinder;)"
             "Landroid/view/SurfaceControl$ScreenshotGraphicBuffer;",
             (void*)nativeCaptureLayers },
     {"nativeSetInputWindowInfo", "(JJLandroid/view/InputWindowHandle;)V",
diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml
index fb92fbf..de526ef 100644
--- a/core/res/AndroidManifest.xml
+++ b/core/res/AndroidManifest.xml
@@ -618,6 +618,7 @@
 
     <!-- Added in Q -->
     <protected-broadcast android:name="android.content.pm.action.SESSION_UPDATED" />
+    <protected-broadcast android:name="android.settings.action.GRAYSCALE_CHANGED" />
 
     <!-- For CarIdlenessTracker -->
     <protected-broadcast android:name="com.android.server.jobscheduler.GARAGE_MODE_ON" />
diff --git a/core/res/res/drawable/chooser_file_generic.xml b/core/res/res/drawable/chooser_file_generic.xml
new file mode 100644
index 0000000..006dfba
--- /dev/null
+++ b/core/res/res/drawable/chooser_file_generic.xml
@@ -0,0 +1,24 @@
+<!--
+Copyright (C) 2015 The Android Open Source Project
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+    you may not use this file except in compliance with the License.
+    You may obtain a copy of the License at
+
+         http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+-->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+        android:width="24dp"
+        android:height="24dp"
+        android:viewportWidth="24.0"
+        android:viewportHeight="24.0">
+    <path
+        android:fillColor="#FF737373"
+        android:pathData="M6 2c-1.1 0,-1.99.9,-1.99 2L4 20c0 1.1.89 2 1.99 2H18c1.1 0 2,-.9 2,-2V8l-6,-6H6zm7 7V3.5L18.5 9H13z"/>
+</vector>
diff --git a/core/res/res/layout/chooser_grid_preview_text.xml b/core/res/res/layout/chooser_grid_preview_text.xml
index 7cfbb1b..6abf57a 100644
--- a/core/res/res/layout/chooser_grid_preview_text.xml
+++ b/core/res/res/layout/chooser_grid_preview_text.xml
@@ -51,7 +51,9 @@
         android:layout_height="24dp"
         android:gravity="center"
         android:layout_gravity="center_vertical"
-        android:background="@drawable/ic_content_copy_gm2"/>
+        android:foreground="@drawable/ic_content_copy_gm2"
+        android:clickable="true"
+        android:background="?attr/selectableItemBackgroundBorderless"/>
   </LinearLayout>
 
   <!-- Required sub-layout so we can get the nice rounded corners-->
diff --git a/core/res/res/values/styles_device_defaults.xml b/core/res/res/values/styles_device_defaults.xml
index 3c7b36d..d253f00 100644
--- a/core/res/res/values/styles_device_defaults.xml
+++ b/core/res/res/values/styles_device_defaults.xml
@@ -98,7 +98,11 @@
     <style name="Widget.DeviceDefault.ActionBar.TabView" parent="Widget.Material.ActionBar.TabView"/>
     <style name="Widget.DeviceDefault.ActionBar.TabText" parent="Widget.Material.ActionBar.TabText"/>
     <style name="Widget.DeviceDefault.ActionBar.TabBar" parent="Widget.Material.ActionBar.TabBar"/>
-    <style name="Widget.DeviceDefault.ActionBar.Solid" parent="Widget.Material.ActionBar.Solid"/>
+    <style name="Widget.DeviceDefault.ActionBar.Solid" parent="Widget.Material.ActionBar.Solid">
+        <item name="background">?attr/colorPrimaryDark</item>
+        <item name="backgroundStacked">?attr/colorPrimaryDark</item>
+        <item name="backgroundSplit">?attr/colorPrimaryDark</item>
+    </style>
     <style name="Widget.DeviceDefault.Button.Borderless.Small" parent="Widget.Material.Button.Borderless.Small"/>
     <style name="Widget.DeviceDefault.AbsListView" parent="Widget.Material.AbsListView"/>
     <style name="Widget.DeviceDefault.Spinner.DropDown.ActionBar" parent="Widget.Material.Spinner.DropDown.ActionBar"/>
diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml
index fb7be77..a6841d4 100644
--- a/core/res/res/values/symbols.xml
+++ b/core/res/res/values/symbols.xml
@@ -3477,6 +3477,7 @@
   <java-symbol type="layout" name="shutdown_dialog" />
   <java-symbol type="dimen" name="chooser_service_spacing" />
   <java-symbol type="bool" name="config_showSysuiShutdown" />
+  <java-symbol type="drawable" name="chooser_file_generic" />
 
   <java-symbol type="layout" name="notification_template_messaging_text_message" />
   <java-symbol type="layout" name="notification_template_messaging_image_message" />
diff --git a/libs/androidfw/AssetManager2.cpp b/libs/androidfw/AssetManager2.cpp
index 9519704..1b515ad 100644
--- a/libs/androidfw/AssetManager2.cpp
+++ b/libs/androidfw/AssetManager2.cpp
@@ -1319,7 +1319,7 @@
     typedef std::map<int, int> SourceToDestinationRuntimePackageMap;
     std::map<ApkAssetsCookie, SourceToDestinationRuntimePackageMap> src_asset_cookie_id_map;
 
-    // Determine which ApkAssets are loaded in both theme AssetManagers
+    // Determine which ApkAssets are loaded in both theme AssetManagers.
     std::vector<const ApkAssets*> src_assets = o.asset_manager_->GetApkAssets();
     for (size_t i = 0; i < src_assets.size(); i++) {
       const ApkAssets* src_asset = src_assets[i];
@@ -1328,7 +1328,7 @@
       for (size_t j = 0; j < dest_assets.size(); j++) {
         const ApkAssets* dest_asset = dest_assets[j];
 
-        // Map the runtime package of the source apk asset to the destination apk asset
+        // Map the runtime package of the source apk asset to the destination apk asset.
         if (src_asset->GetPath() == dest_asset->GetPath()) {
           const std::vector<std::unique_ptr<const LoadedPackage>>& src_packages =
               src_asset->GetLoadedArsc()->GetPackages();
@@ -1353,15 +1353,14 @@
             package_map[src_package_id] = dest_package_id;
           }
 
-          src_to_dest_asset_cookies.insert(std::pair<ApkAssetsCookie, ApkAssetsCookie>(i, j));
-          src_asset_cookie_id_map.insert(
-              std::pair<ApkAssetsCookie, SourceToDestinationRuntimePackageMap>(i, package_map));
+          src_to_dest_asset_cookies.insert(std::make_pair(i, j));
+          src_asset_cookie_id_map.insert(std::make_pair(i, package_map));
           break;
         }
       }
     }
 
-    // Reset the data in the destination theme
+    // Reset the data in the destination theme.
     for (size_t p = 0; p < packages_.size(); p++) {
       if (packages_[p] != nullptr) {
         packages_[p].reset();
@@ -1387,16 +1386,17 @@
             continue;
           }
 
-          // If the attribute value represents an attribute or reference, the package id of the
-          // value needs to be rewritten to the package id of the value in the destination
-          uint32_t attribue_data = entry.value.data;
-          if ((entry.value.dataType == Res_value::TYPE_ATTRIBUTE
-              || entry.value.dataType == Res_value::TYPE_REFERENCE
-              || entry.value.dataType == Res_value::TYPE_DYNAMIC_ATTRIBUTE
-              || entry.value.dataType == Res_value::TYPE_DYNAMIC_REFERENCE)
-              && attribue_data != 0x0) {
+          bool is_reference = (entry.value.dataType == Res_value::TYPE_ATTRIBUTE
+                               || entry.value.dataType == Res_value::TYPE_REFERENCE
+                               || entry.value.dataType == Res_value::TYPE_DYNAMIC_ATTRIBUTE
+                               || entry.value.dataType == Res_value::TYPE_DYNAMIC_REFERENCE)
+                              && entry.value.data != 0x0;
 
-            // Determine the package id of the reference in the destination AssetManager
+          // If the attribute value represents an attribute or reference, the package id of the
+          // value needs to be rewritten to the package id of the value in the destination.
+          uint32_t attribute_data = entry.value.data;
+          if (is_reference) {
+            // Determine the package id of the reference in the destination AssetManager.
             auto value_package_map = src_asset_cookie_id_map.find(entry.cookie);
             if (value_package_map == src_asset_cookie_id_map.end()) {
               continue;
@@ -1408,14 +1408,28 @@
               continue;
             }
 
-            attribue_data = fix_package_id(entry.value.data, value_dest_package->second);
+            attribute_data = fix_package_id(entry.value.data, value_dest_package->second);
+          }
+
+          // Find the cookie of the value in the destination. If the source apk is not loaded in the
+          // destination, only copy resources that do not reference resources in the source.
+          ApkAssetsCookie data_dest_cookie;
+          auto value_dest_cookie = src_to_dest_asset_cookies.find(entry.cookie);
+          if (value_dest_cookie != src_to_dest_asset_cookies.end()) {
+            data_dest_cookie = value_dest_cookie->second;
+          } else {
+            if (is_reference || entry.value.dataType == Res_value::TYPE_STRING) {
+              continue;
+            } else {
+              data_dest_cookie = 0x0;
+            }
           }
 
           // The package id of the attribute needs to be rewritten to the package id of the
-          // attribute in the destination
+          // attribute in the destination.
           int attribute_dest_package_id = p;
           if (attribute_dest_package_id != 0x01) {
-            // Find the cookie of the attribute resource id
+            // Find the cookie of the attribute resource id in the source AssetManager
             FindEntryResult attribute_entry_result;
             ApkAssetsCookie attribute_cookie =
                 o.asset_manager_->FindEntry(make_resid(p, t, e), 0 /* density_override */ ,
@@ -1423,7 +1437,7 @@
                                             true /* ignore_configuration */,
                                             &attribute_entry_result);
 
-            // Determine the package id of the attribute in the destination AssetManager
+            // Determine the package id of the attribute in the destination AssetManager.
             auto attribute_package_map = src_asset_cookie_id_map.find(attribute_cookie);
             if (attribute_package_map == src_asset_cookie_id_map.end()) {
               continue;
@@ -1436,13 +1450,13 @@
             attribute_dest_package_id = attribute_dest_package->second;
           }
 
-          // Lazily instantiate the destination package
+          // Lazily instantiate the destination package.
           std::unique_ptr<Package>& dest_package = packages_[attribute_dest_package_id];
           if (dest_package == nullptr) {
             dest_package.reset(new Package());
           }
 
-          // Lazily instantiate and resize the destination type
+          // Lazily instantiate and resize the destination type.
           util::unique_cptr<ThemeType>& dest_type = dest_package->types[t];
           if (dest_type == nullptr || dest_type->entry_count < type->entry_count) {
             const size_t type_alloc_size = sizeof(ThemeType)
@@ -1450,7 +1464,7 @@
             void* dest_data = malloc(type_alloc_size);
             memset(dest_data, 0, type->entry_count * sizeof(ThemeEntry));
 
-            // Copy the existing destination type values if the type is resized
+            // Copy the existing destination type values if the type is resized.
             if (dest_type != nullptr) {
               memcpy(dest_data, type, sizeof(ThemeType)
                                       + (dest_type->entry_count * sizeof(ThemeEntry)));
@@ -1460,15 +1474,9 @@
             dest_type->entry_count = type->entry_count;
           }
 
-          // Find the cookie of the value in the destination
-          auto value_dest_cookie = src_to_dest_asset_cookies.find(entry.cookie);
-          if (value_dest_cookie == src_to_dest_asset_cookies.end()) {
-            continue;
-          }
-
-          dest_type->entries[e].cookie = value_dest_cookie->second;
+          dest_type->entries[e].cookie = data_dest_cookie;
           dest_type->entries[e].value.dataType = entry.value.dataType;
-          dest_type->entries[e].value.data = attribue_data;
+          dest_type->entries[e].value.data = attribute_data;
           dest_type->entries[e].type_spec_flags = entry.type_spec_flags;
         }
       }
diff --git a/libs/androidfw/tests/Theme_test.cpp b/libs/androidfw/tests/Theme_test.cpp
index 2c39cee..be5ecd9 100644
--- a/libs/androidfw/tests/Theme_test.cpp
+++ b/libs/androidfw/tests/Theme_test.cpp
@@ -282,48 +282,81 @@
 }
 
 TEST_F(ThemeTest, OnlyCopySameAssetsThemeWhenAssetManagersDiffer) {
-  AssetManager2 assetmanager_one;
-  assetmanager_one.SetApkAssets({system_assets_.get(), lib_one_assets_.get(), style_assets_.get(),
+  AssetManager2 assetmanager_dst;
+  assetmanager_dst.SetApkAssets({system_assets_.get(), lib_one_assets_.get(), style_assets_.get(),
                                  libclient_assets_.get()});
 
-  AssetManager2 assetmanager_two;
-  assetmanager_two.SetApkAssets({system_assets_.get(), lib_two_assets_.get(), lib_one_assets_.get(),
+  AssetManager2 assetmanager_src;
+  assetmanager_src.SetApkAssets({system_assets_.get(), lib_two_assets_.get(), lib_one_assets_.get(),
                                  style_assets_.get()});
 
-  auto theme_one = assetmanager_one.NewTheme();
-  ASSERT_TRUE(theme_one->ApplyStyle(app::R::style::StyleOne));
+  auto theme_dst = assetmanager_dst.NewTheme();
+  ASSERT_TRUE(theme_dst->ApplyStyle(app::R::style::StyleOne));
 
-  auto theme_two = assetmanager_two.NewTheme();
-  ASSERT_TRUE(theme_two->ApplyStyle(R::style::Theme_One));
-  ASSERT_TRUE(theme_two->ApplyStyle(app::R::style::StyleTwo));
-  ASSERT_TRUE(theme_two->ApplyStyle(fix_package_id(lib_one::R::style::Theme, 0x03),
+  auto theme_src = assetmanager_src.NewTheme();
+  ASSERT_TRUE(theme_src->ApplyStyle(R::style::Theme_One));
+  ASSERT_TRUE(theme_src->ApplyStyle(app::R::style::StyleTwo));
+  ASSERT_TRUE(theme_src->ApplyStyle(fix_package_id(lib_one::R::style::Theme, 0x03),
                                     false /*force*/));
-  ASSERT_TRUE(theme_two->ApplyStyle(fix_package_id(lib_two::R::style::Theme, 0x02),
+  ASSERT_TRUE(theme_src->ApplyStyle(fix_package_id(lib_two::R::style::Theme, 0x02),
                                     false /*force*/));
 
-  theme_one->SetTo(*theme_two);
+  theme_dst->SetTo(*theme_src);
 
   Res_value value;
   uint32_t flags;
 
-  // System resources (present in destination asset manager)
-  EXPECT_EQ(0, theme_one->GetAttribute(R::attr::foreground, &value, &flags));
+  // System resources (present in destination asset manager).
+  EXPECT_EQ(0, theme_dst->GetAttribute(R::attr::foreground, &value, &flags));
 
   // The cookie of the style asset is 3 in the source and 2 in the destination.
-  // Check that the cookie has been rewritten to the destination values
-  EXPECT_EQ(2, theme_one->GetAttribute(app::R::attr::attr_one, &value, &flags));
+  // Check that the cookie has been rewritten to the destination values.
+  EXPECT_EQ(2, theme_dst->GetAttribute(app::R::attr::attr_one, &value, &flags));
 
   // The cookie of the lib_one asset is 2 in the source and 1 in the destination.
   // The package id of the lib_one package is 0x03 in the source and 0x02 in the destination
-  // Check that the cookie and packages have been rewritten to the destination values
-  EXPECT_EQ(1, theme_one->GetAttribute(fix_package_id(lib_one::R::attr::attr1, 0x02), &value,
+  // Check that the cookie and packages have been rewritten to the destination values.
+  EXPECT_EQ(1, theme_dst->GetAttribute(fix_package_id(lib_one::R::attr::attr1, 0x02), &value,
                                        &flags));
-  EXPECT_EQ(1, theme_one->GetAttribute(fix_package_id(lib_one::R::attr::attr2, 0x02), &value,
+  EXPECT_EQ(1, theme_dst->GetAttribute(fix_package_id(lib_one::R::attr::attr2, 0x02), &value,
                                        &flags));
 
   // attr2 references an attribute in lib_one. Check that the resolution of the attribute value is
-  // correct after the value of attr2 had its package id rewritten to the destination package id
+  // correct after the value of attr2 had its package id rewritten to the destination package id.
   EXPECT_EQ(700, value.data);
 }
 
+TEST_F(ThemeTest, CopyNonReferencesWhenPackagesDiffer) {
+  AssetManager2 assetmanager_dst;
+  assetmanager_dst.SetApkAssets({system_assets_.get()});
+
+  AssetManager2 assetmanager_src;
+  assetmanager_src.SetApkAssets({system_assets_.get(), style_assets_.get()});
+
+  auto theme_dst = assetmanager_dst.NewTheme();
+  auto theme_src = assetmanager_src.NewTheme();
+  ASSERT_TRUE(theme_src->ApplyStyle(app::R::style::StyleSeven));
+  theme_dst->SetTo(*theme_src);
+
+  Res_value value;
+  uint32_t flags;
+
+  // Allow inline resource values to be copied even if the source apk asset is not present in the
+  // destination.
+  EXPECT_EQ(0, theme_dst->GetAttribute(0x0101021b /* android:versionCode */, &value, &flags));
+
+  // Do not copy strings since the data is an index into the values string pool of the source apk
+  // asset.
+  EXPECT_EQ(-1, theme_dst->GetAttribute(0x01010001 /* android:label */, &value, &flags));
+
+  // Do not copy values that reference another resource if the resource is not present in the
+  // destination.
+  EXPECT_EQ(-1, theme_dst->GetAttribute(0x01010002 /* android:icon */, &value, &flags));
+  EXPECT_EQ(-1, theme_dst->GetAttribute(0x010100d1 /* android:tag */, &value, &flags));
+
+  // Allow @empty to and @null to be copied.
+  EXPECT_EQ(0, theme_dst->GetAttribute(0x010100d0 /* android:id */, &value, &flags));
+  EXPECT_EQ(0, theme_dst->GetAttribute(0x01010000 /* android:theme */, &value, &flags));
+}
+
 }  // namespace android
diff --git a/libs/androidfw/tests/data/styles/R.h b/libs/androidfw/tests/data/styles/R.h
index 538a847..f11486f 100644
--- a/libs/androidfw/tests/data/styles/R.h
+++ b/libs/androidfw/tests/data/styles/R.h
@@ -51,6 +51,7 @@
       StyleFour = 0x7f020003u,
       StyleFive = 0x7f020004u,
       StyleSix = 0x7f020005u,
+      StyleSeven = 0x7f020006u,
     };
   };
 };
diff --git a/libs/androidfw/tests/data/styles/build b/libs/androidfw/tests/data/styles/build
index 1ef8e6e..7b7c1f7 100755
--- a/libs/androidfw/tests/data/styles/build
+++ b/libs/androidfw/tests/data/styles/build
@@ -2,5 +2,7 @@
 
 set -e
 
+PATH_TO_FRAMEWORK_RES=${ANDROID_BUILD_TOP}/prebuilts/sdk/current/public/android.jar
+
 aapt2 compile -o compiled.flata --dir res
-aapt2 link -o styles.apk --manifest AndroidManifest.xml compiled.flata
+aapt2 link -o styles.apk --manifest AndroidManifest.xml -I $PATH_TO_FRAMEWORK_RES compiled.flata
diff --git a/libs/androidfw/tests/data/styles/res/values/styles.xml b/libs/androidfw/tests/data/styles/res/values/styles.xml
index 1a23176..06774a8 100644
--- a/libs/androidfw/tests/data/styles/res/values/styles.xml
+++ b/libs/androidfw/tests/data/styles/res/values/styles.xml
@@ -79,4 +79,14 @@
         <item name="attr_three">3</item>
     </style>
 
+    <public type="style" name="StyleSeven" id="0x7f020006" />
+    <style name="StyleSeven" >
+        <item name="android:versionCode">3</item>
+        <item name="android:label">"string"</item>
+        <item name="android:icon">?attr/attr_one</item>
+        <item name="android:tag">@string/string_one</item>
+        <item name="android:id">@null</item>
+        <item name="android:theme">@empty</item>
+    </style>
+
 </resources>
diff --git a/libs/androidfw/tests/data/styles/styles.apk b/libs/androidfw/tests/data/styles/styles.apk
index cd5c7a1..92e9bf9 100644
--- a/libs/androidfw/tests/data/styles/styles.apk
+++ b/libs/androidfw/tests/data/styles/styles.apk
Binary files differ
diff --git a/libs/protoutil/src/ProtoFileReader.cpp b/libs/protoutil/src/ProtoFileReader.cpp
index 074170a..4017979 100644
--- a/libs/protoutil/src/ProtoFileReader.cpp
+++ b/libs/protoutil/src/ProtoFileReader.cpp
@@ -55,6 +55,7 @@
          mSize(get_file_size(fd)),
          mPos(0),
          mOffset(0),
+         mMaxOffset(0),
          mChunkSize(sizeof(mBuffer)) {
 }
 
diff --git a/packages/CarSystemUI/src/com/android/systemui/volume/CarVolumeDialogImpl.java b/packages/CarSystemUI/src/com/android/systemui/volume/CarVolumeDialogImpl.java
index 512210b..267d9f5 100644
--- a/packages/CarSystemUI/src/com/android/systemui/volume/CarVolumeDialogImpl.java
+++ b/packages/CarSystemUI/src/com/android/systemui/volume/CarVolumeDialogImpl.java
@@ -112,17 +112,22 @@
                     // zoneId
                     VolumeItem volumeItem = mAvailableVolumeItems.get(groupId);
                     int value = getSeekbarValue(mCarAudioManager, groupId);
+                    // find if the group id for which the volume changed is currently being
+                    // displayed.
+                    boolean isShowing = mCarVolumeLineItems.stream().anyMatch(
+                            item -> item.getGroupId() == groupId);
                     // Do not update the progress if it is the same as before. When car audio
                     // manager sets
                     // its group volume caused by the seekbar progress changed, it also triggers
                     // this
                     // callback. Updating the seekbar at the same time could block the continuous
                     // seeking.
-                    if (value != volumeItem.progress) {
+                    if (value != volumeItem.progress && isShowing) {
                         volumeItem.carVolumeItem.setProgress(value);
                         volumeItem.progress = value;
                     }
                     if ((flags & AudioManager.FLAG_SHOW_UI) != 0) {
+                        mCurrentlyDisplayingGroupId = groupId;
                         mHandler.obtainMessage(H.SHOW,
                                 Events.SHOW_REASON_VOLUME_CHANGED).sendToTarget();
                     }
@@ -134,10 +139,10 @@
                 }
             };
     private boolean mHovering;
+    private int mCurrentlyDisplayingGroupId;
     private boolean mShowing;
     private boolean mExpanded;
     private View mExpandIcon;
-    private VolumeItem mDefaultVolumeItem;
     private final ServiceConnection mServiceConnection = new ServiceConnection() {
         @Override
         public void onServiceConnected(ComponentName name, IBinder service) {
@@ -152,8 +157,7 @@
                     mAvailableVolumeItems.add(volumeItem);
                     // The first one is the default item.
                     if (groupId == 0) {
-                        mDefaultVolumeItem = volumeItem;
-                        setupDefaultCarVolumeItem();
+                        setuptListItem(0);
                     }
                 }
 
@@ -177,9 +181,11 @@
         }
     };
 
-    private void setupDefaultCarVolumeItem() {
-        mDefaultVolumeItem.defaultItem = true;
-        addCarVolumeListItem(mDefaultVolumeItem, /* volumeGroupId = */0,
+    private void setuptListItem(int groupId) {
+        mCarVolumeLineItems.clear();
+        VolumeItem volumeItem = mAvailableVolumeItems.get(groupId);
+        volumeItem.defaultItem = true;
+        addCarVolumeListItem(volumeItem, /* volumeGroupId = */ groupId,
                 R.drawable.car_ic_keyboard_arrow_down, new ExpandIconListener()
         );
     }
@@ -299,9 +305,7 @@
             return;
         }
         mShowing = true;
-        if (mCarVolumeLineItems.isEmpty()) {
-            setupDefaultCarVolumeItem();
-        }
+        setuptListItem(mCurrentlyDisplayingGroupId);
         mDialog.show();
         Events.writeEvent(mContext, Events.EVENT_SHOW_DIALOG, reason, mKeyguard.isKeyguardLocked());
     }
@@ -437,7 +441,7 @@
             carVolumeItem.setSupplementalIcon(/* drawable= */ null,
                     /* showSupplementalIconDivider= */ false);
         }
-
+        carVolumeItem.setGroupId(volumeGroupId);
         mCarVolumeLineItems.add(carVolumeItem);
         volumeItem.carVolumeItem = carVolumeItem;
         volumeItem.progress = progress;
@@ -545,11 +549,8 @@
         Animator inAnimator;
         if (mExpanded) {
             for (int groupId = 0; groupId < mAvailableVolumeItems.size(); ++groupId) {
-                // Adding the items which are not coming from the default item.
-                VolumeItem volumeItem = mAvailableVolumeItems.get(groupId);
-                if (volumeItem.defaultItem) {
-                    updateDefaultVolumeItem(volumeItem.carVolumeItem);
-                } else {
+                if (groupId != mCurrentlyDisplayingGroupId) {
+                    VolumeItem volumeItem = mAvailableVolumeItems.get(groupId);
                     addCarVolumeListItem(volumeItem, groupId, 0, null);
                 }
             }
@@ -561,11 +562,8 @@
             Iterator itr = mCarVolumeLineItems.iterator();
             while (itr.hasNext()) {
                 CarVolumeItem carVolumeItem = (CarVolumeItem) itr.next();
-                VolumeItem volumeItem = findVolumeItem(carVolumeItem);
-                if (!volumeItem.defaultItem) {
+                if (carVolumeItem.getGroupId() != mCurrentlyDisplayingGroupId) {
                     itr.remove();
-                } else {
-                    updateDefaultVolumeItem(carVolumeItem);
                 }
             }
             inAnimator = AnimatorInflater.loadAnimator(
@@ -587,21 +585,6 @@
         mVolumeItemsAdapter.notifyDataSetChanged();
     }
 
-    private void updateDefaultVolumeItem(CarVolumeItem carVolumeItem) {
-        VolumeItem volumeItem = findVolumeItem(carVolumeItem);
-
-        // When volume dialog is expanded or collapsed the default list item is never
-        // reset. Whereas all other list items are removed when the dialog is collapsed and then
-        // added when the dialog is expanded using {@link CarVolumeDialogImpl#addCarVolumeListItem}.
-        // This sets the progressbar and the tint color of icons for all items other than default
-        // if they were changed. For default list item it should be done manually here.
-        int color = mContext.getResources().getColor(R.color.car_volume_dialog_tint);
-        Drawable primaryIcon = mContext.getResources().getDrawable(volumeItem.icon);
-        primaryIcon.mutate().setTint(color);
-        volumeItem.carVolumeItem.setPrimaryIcon(primaryIcon);
-        volumeItem.carVolumeItem.setProgress(volumeItem.progress);
-    }
-
     private final class VolumeSeekBarChangeListener implements OnSeekBarChangeListener {
 
         private final int mVolumeGroupId;
diff --git a/packages/CarSystemUI/src/com/android/systemui/volume/CarVolumeItem.java b/packages/CarSystemUI/src/com/android/systemui/volume/CarVolumeItem.java
index 9613de1..e1ea6f6 100644
--- a/packages/CarSystemUI/src/com/android/systemui/volume/CarVolumeItem.java
+++ b/packages/CarSystemUI/src/com/android/systemui/volume/CarVolumeItem.java
@@ -35,6 +35,7 @@
     private Drawable mSupplementalIcon;
     private View.OnClickListener mSupplementalIconOnClickListener;
     private boolean mShowSupplementalIconDivider;
+    private int mGroupId;
 
     private int mMax;
     private int mProgress;
@@ -85,6 +86,20 @@
         mIsDirty = true;
     }
 
+    /**
+     * Gets the group id associated.
+     */
+    public int getGroupId() {
+        return mGroupId;
+    }
+
+    /**
+     * Sets the group id associated.
+     */
+    public void setGroupId(int groupId) {
+        this.mGroupId = groupId;
+    }
+
     /** Sets {@code OnClickListener} for the supplemental icon. */
     public void setSupplementalIconListener(View.OnClickListener listener) {
         mSupplementalIconOnClickListener = listener;
diff --git a/packages/ExtServices/src/android/ext/services/watchdog/ExplicitHealthCheckServiceImpl.java b/packages/ExtServices/src/android/ext/services/watchdog/ExplicitHealthCheckServiceImpl.java
index 040e2ab..52e54f9 100644
--- a/packages/ExtServices/src/android/ext/services/watchdog/ExplicitHealthCheckServiceImpl.java
+++ b/packages/ExtServices/src/android/ext/services/watchdog/ExplicitHealthCheckServiceImpl.java
@@ -19,6 +19,7 @@
 import android.content.ComponentName;
 import android.content.Intent;
 import android.service.watchdog.ExplicitHealthCheckService;
+import android.service.watchdog.PackageInfo;
 import android.util.Log;
 
 import java.util.ArrayList;
@@ -67,8 +68,12 @@
     }
 
     @Override
-    public List<String> onGetSupportedPackages() {
-        return new ArrayList<>(mSupportedCheckers.keySet());
+    public List<PackageInfo> onGetSupportedPackages() {
+        List<PackageInfo> packages = new ArrayList<>();
+        for (ExplicitHealthChecker checker : mSupportedCheckers.values()) {
+            packages.add(checker.getSupportedPackage());
+        }
+        return packages;
     }
 
     @Override
@@ -82,7 +87,7 @@
         while (it.hasNext()) {
             ExplicitHealthChecker checker = it.next();
             if (checker.isPending()) {
-                packages.add(checker.getPackageName());
+                packages.add(checker.getSupportedPackage().getPackageName());
             }
         }
         return packages;
diff --git a/packages/ExtServices/src/android/ext/services/watchdog/ExplicitHealthChecker.java b/packages/ExtServices/src/android/ext/services/watchdog/ExplicitHealthChecker.java
index 650878e..c51be88 100644
--- a/packages/ExtServices/src/android/ext/services/watchdog/ExplicitHealthChecker.java
+++ b/packages/ExtServices/src/android/ext/services/watchdog/ExplicitHealthChecker.java
@@ -16,6 +16,8 @@
 
 package android.ext.services.watchdog;
 
+import android.service.watchdog.PackageInfo;
+
 /**
  * A type of explicit health check that can be performed on a device, e.g network health check
  */
@@ -38,7 +40,7 @@
     boolean isPending();
 
     /**
-     * Returns the package name this checker can make requests for.
+     * Returns the {@link PackageInfo} object this checker can make requests for.
      */
-    String getPackageName();
+    PackageInfo getSupportedPackage();
 }
diff --git a/packages/ExtServices/src/android/ext/services/watchdog/NetworkChecker.java b/packages/ExtServices/src/android/ext/services/watchdog/NetworkChecker.java
index 32375e6..09b319e 100644
--- a/packages/ExtServices/src/android/ext/services/watchdog/NetworkChecker.java
+++ b/packages/ExtServices/src/android/ext/services/watchdog/NetworkChecker.java
@@ -21,6 +21,7 @@
 import android.net.NetworkCapabilities;
 import android.net.NetworkRequest;
 import android.service.watchdog.ExplicitHealthCheckService;
+import android.service.watchdog.PackageInfo;
 
 import com.android.internal.annotations.GuardedBy;
 
@@ -34,6 +35,8 @@
     private final Object mLock = new Object();
     private final ExplicitHealthCheckService mService;
     private final String mPackageName;
+    // TODO: Receive from DeviceConfig flag
+    private final long mRequestDurationMillis = 0;
     @GuardedBy("mLock")
     private boolean mIsPending;
 
@@ -73,8 +76,8 @@
     }
 
     @Override
-    public String getPackageName() {
-        return mPackageName;
+    public PackageInfo getSupportedPackage() {
+        return new PackageInfo(mPackageName, mRequestDurationMillis);
     }
 
     // TODO(b/120598832): Also monitor NetworkCallback#onAvailable to see if we have any
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
index cff3855..0e9264b 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
@@ -477,6 +477,15 @@
         }
         mThemeResId = themeResId;
 
+        reInflateViews();
+    }
+
+    @Override
+    public void onOverlayChanged() {
+        reInflateViews();
+    }
+
+    private void reInflateViews() {
         updateShowEmptyShadeView();
 
         // Re-inflate the status view group.
@@ -484,9 +493,9 @@
         removeView(mKeyguardStatusView);
         mKeyguardStatusView = (KeyguardStatusView) mInjectionInflationController
                 .injectable(LayoutInflater.from(mContext)).inflate(
-                    R.layout.keyguard_status_view,
-                    this,
-                    false);
+                        R.layout.keyguard_status_view,
+                        this,
+                        false);
         addView(mKeyguardStatusView, index);
 
         // Re-associate the clock container with the keyguard clock switch.
@@ -500,9 +509,9 @@
         KeyguardBottomAreaView oldBottomArea = mKeyguardBottomArea;
         mKeyguardBottomArea = (KeyguardBottomAreaView) mInjectionInflationController
                 .injectable(LayoutInflater.from(mContext)).inflate(
-                    R.layout.keyguard_bottom_area,
-                    this,
-                    false);
+                        R.layout.keyguard_bottom_area,
+                        this,
+                        false);
         mKeyguardBottomArea.initFrom(oldBottomArea);
         addView(mKeyguardBottomArea, index);
         initBottomArea();
diff --git a/packages/overlays/AccentColorBlackOverlay/res/values/colors_device_defaults.xml b/packages/overlays/AccentColorBlackOverlay/res/values/colors_device_defaults.xml
index 5648f91..c73cbba 100644
--- a/packages/overlays/AccentColorBlackOverlay/res/values/colors_device_defaults.xml
+++ b/packages/overlays/AccentColorBlackOverlay/res/values/colors_device_defaults.xml
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
 /**
- * Copyright (c) 2018, 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.
@@ -18,5 +18,5 @@
 -->
 <resources>
     <color name="accent_device_default_light">#202020</color>
-    <color name="accent_device_default_dark">#FFFFFF</color>
+    <color name="accent_device_default_dark">#D7DEE6</color>
 </resources>
diff --git a/packages/overlays/AccentColorCinnamonOverlay/Android.mk b/packages/overlays/AccentColorCinnamonOverlay/Android.mk
new file mode 100644
index 0000000..d53c114
--- /dev/null
+++ b/packages/overlays/AccentColorCinnamonOverlay/Android.mk
@@ -0,0 +1,31 @@
+#
+#  Copyright 2019, The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+LOCAL_PATH:= $(call my-dir)
+include $(CLEAR_VARS)
+
+LOCAL_RRO_THEME := AccentColorCinnamon
+LOCAL_CERTIFICATE := platform
+LOCAL_PRODUCT_MODULE := true
+
+LOCAL_SRC_FILES := $(call all-subdir-java-files)
+
+LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
+
+LOCAL_PACKAGE_NAME := AccentColorCinnamonOverlay
+LOCAL_SDK_VERSION := current
+
+include $(BUILD_RRO_PACKAGE)
diff --git a/packages/overlays/AccentColorCinnamonOverlay/AndroidManifest.xml b/packages/overlays/AccentColorCinnamonOverlay/AndroidManifest.xml
new file mode 100644
index 0000000..bcb6c4f
--- /dev/null
+++ b/packages/overlays/AccentColorCinnamonOverlay/AndroidManifest.xml
@@ -0,0 +1,25 @@
+<!--
+/**
+ * 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.theme.color.cinnamon"
+    android:versionCode="1"
+    android:versionName="1.0">
+    <overlay android:targetPackage="android" android:category="android.theme.customization.accent_color" android:priority="1"/>
+
+    <application android:label="@string/accent_color_cinnamon_overlay" android:hasCode="false"/>
+</manifest>
diff --git a/packages/overlays/AccentColorCinnamonOverlay/res/values/colors_device_defaults.xml b/packages/overlays/AccentColorCinnamonOverlay/res/values/colors_device_defaults.xml
new file mode 100644
index 0000000..c420ab6
--- /dev/null
+++ b/packages/overlays/AccentColorCinnamonOverlay/res/values/colors_device_defaults.xml
@@ -0,0 +1,22 @@
+<?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.
+ */
+-->
+<resources>
+    <color name="accent_device_default_light">#AF6050</color>
+    <color name="accent_device_default_dark">#9D6962</color>
+</resources>
diff --git a/packages/overlays/AccentColorCinnamonOverlay/res/values/strings.xml b/packages/overlays/AccentColorCinnamonOverlay/res/values/strings.xml
new file mode 100644
index 0000000..ac8ca7d
--- /dev/null
+++ b/packages/overlays/AccentColorCinnamonOverlay/res/values/strings.xml
@@ -0,0 +1,23 @@
+<?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.
+ */
+-->
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+    <!-- Cinnamon accent color name application label. [CHAR LIMIT=50] -->
+    <string name="accent_color_cinnamon_overlay" translatable="false">Cinnamon</string>
+</resources>
+
diff --git a/packages/overlays/AccentColorOceanOverlay/Android.mk b/packages/overlays/AccentColorOceanOverlay/Android.mk
new file mode 100644
index 0000000..a28fc72
--- /dev/null
+++ b/packages/overlays/AccentColorOceanOverlay/Android.mk
@@ -0,0 +1,31 @@
+#
+#  Copyright 2019, The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+LOCAL_PATH:= $(call my-dir)
+include $(CLEAR_VARS)
+
+LOCAL_RRO_THEME := AccentColorOcean
+LOCAL_CERTIFICATE := platform
+LOCAL_PRODUCT_MODULE := true
+
+LOCAL_SRC_FILES := $(call all-subdir-java-files)
+
+LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
+
+LOCAL_PACKAGE_NAME := AccentColorOceanOverlay
+LOCAL_SDK_VERSION := current
+
+include $(BUILD_RRO_PACKAGE)
diff --git a/packages/overlays/AccentColorOceanOverlay/AndroidManifest.xml b/packages/overlays/AccentColorOceanOverlay/AndroidManifest.xml
new file mode 100644
index 0000000..bbee10d
--- /dev/null
+++ b/packages/overlays/AccentColorOceanOverlay/AndroidManifest.xml
@@ -0,0 +1,25 @@
+<!--
+/**
+ * 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.theme.color.ocean"
+    android:versionCode="1"
+    android:versionName="1.0">
+    <overlay android:targetPackage="android" android:category="android.theme.customization.accent_color" android:priority="1"/>
+
+    <application android:label="@string/accent_color_ocean_overlay" android:hasCode="false"/>
+</manifest>
diff --git a/packages/overlays/AccentColorOceanOverlay/res/values/colors_device_defaults.xml b/packages/overlays/AccentColorOceanOverlay/res/values/colors_device_defaults.xml
new file mode 100644
index 0000000..6aec805
--- /dev/null
+++ b/packages/overlays/AccentColorOceanOverlay/res/values/colors_device_defaults.xml
@@ -0,0 +1,22 @@
+<?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.
+ */
+-->
+<resources>
+    <color name="accent_device_default_light">#0C80A7</color>
+    <color name="accent_device_default_dark">#347D98</color>
+</resources>
diff --git a/packages/overlays/AccentColorOceanOverlay/res/values/strings.xml b/packages/overlays/AccentColorOceanOverlay/res/values/strings.xml
new file mode 100644
index 0000000..9342d48
--- /dev/null
+++ b/packages/overlays/AccentColorOceanOverlay/res/values/strings.xml
@@ -0,0 +1,23 @@
+<?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.
+ */
+-->
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+    <!-- Ocean accent color name application label. [CHAR LIMIT=50] -->
+    <string name="accent_color_ocean_overlay" translatable="false">Ocean</string>
+</resources>
+
diff --git a/packages/overlays/AccentColorOrchidOverlay/Android.mk b/packages/overlays/AccentColorOrchidOverlay/Android.mk
new file mode 100644
index 0000000..c635890
--- /dev/null
+++ b/packages/overlays/AccentColorOrchidOverlay/Android.mk
@@ -0,0 +1,31 @@
+#
+#  Copyright 2019, The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+LOCAL_PATH:= $(call my-dir)
+include $(CLEAR_VARS)
+
+LOCAL_RRO_THEME := AccentColorOrchid
+LOCAL_CERTIFICATE := platform
+LOCAL_PRODUCT_MODULE := true
+
+LOCAL_SRC_FILES := $(call all-subdir-java-files)
+
+LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
+
+LOCAL_PACKAGE_NAME := AccentColorOrchidOverlay
+LOCAL_SDK_VERSION := current
+
+include $(BUILD_RRO_PACKAGE)
diff --git a/packages/overlays/AccentColorOrchidOverlay/AndroidManifest.xml b/packages/overlays/AccentColorOrchidOverlay/AndroidManifest.xml
new file mode 100644
index 0000000..0290b68
--- /dev/null
+++ b/packages/overlays/AccentColorOrchidOverlay/AndroidManifest.xml
@@ -0,0 +1,25 @@
+<!--
+/**
+ * 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.theme.color.orchid"
+    android:versionCode="1"
+    android:versionName="1.0">
+    <overlay android:targetPackage="android" android:category="android.theme.customization.accent_color" android:priority="1"/>
+
+    <application android:label="@string/accent_color_orchid_overlay" android:hasCode="false"/>
+</manifest>
diff --git a/packages/overlays/AccentColorOrchidOverlay/res/values/colors_device_defaults.xml b/packages/overlays/AccentColorOrchidOverlay/res/values/colors_device_defaults.xml
new file mode 100644
index 0000000..049f8b8
--- /dev/null
+++ b/packages/overlays/AccentColorOrchidOverlay/res/values/colors_device_defaults.xml
@@ -0,0 +1,22 @@
+<?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.
+ */
+-->
+<resources>
+    <color name="accent_device_default_light">#C42CC9</color>
+    <color name="accent_device_default_dark">#C42CC9</color>
+</resources>
diff --git a/packages/overlays/AccentColorOrchidOverlay/res/values/strings.xml b/packages/overlays/AccentColorOrchidOverlay/res/values/strings.xml
new file mode 100644
index 0000000..4e7ec48
--- /dev/null
+++ b/packages/overlays/AccentColorOrchidOverlay/res/values/strings.xml
@@ -0,0 +1,23 @@
+<?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.
+ */
+-->
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+    <!-- Orchid accent color name application label. [CHAR LIMIT=50] -->
+    <string name="accent_color_orchid_overlay" translatable="false">Orchid</string>
+</resources>
+
diff --git a/packages/overlays/AccentColorSpaceOverlay/Android.mk b/packages/overlays/AccentColorSpaceOverlay/Android.mk
new file mode 100644
index 0000000..a0edb96
--- /dev/null
+++ b/packages/overlays/AccentColorSpaceOverlay/Android.mk
@@ -0,0 +1,31 @@
+#
+#  Copyright 2019, The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+LOCAL_PATH:= $(call my-dir)
+include $(CLEAR_VARS)
+
+LOCAL_RRO_THEME := AccentColorSpace
+LOCAL_CERTIFICATE := platform
+LOCAL_PRODUCT_MODULE := true
+
+LOCAL_SRC_FILES := $(call all-subdir-java-files)
+
+LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
+
+LOCAL_PACKAGE_NAME := AccentColorSpaceOverlay
+LOCAL_SDK_VERSION := current
+
+include $(BUILD_RRO_PACKAGE)
diff --git a/packages/overlays/AccentColorSpaceOverlay/AndroidManifest.xml b/packages/overlays/AccentColorSpaceOverlay/AndroidManifest.xml
new file mode 100644
index 0000000..b9f1fa9
--- /dev/null
+++ b/packages/overlays/AccentColorSpaceOverlay/AndroidManifest.xml
@@ -0,0 +1,25 @@
+<!--
+/**
+ * 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.theme.color.space"
+    android:versionCode="1"
+    android:versionName="1.0">
+    <overlay android:targetPackage="android" android:category="android.theme.customization.accent_color" android:priority="1"/>
+
+    <application android:label="@string/accent_color_space_overlay" android:hasCode="false"/>
+</manifest>
diff --git a/packages/overlays/AccentColorSpaceOverlay/res/values/colors_device_defaults.xml b/packages/overlays/AccentColorSpaceOverlay/res/values/colors_device_defaults.xml
new file mode 100644
index 0000000..b6f757c
--- /dev/null
+++ b/packages/overlays/AccentColorSpaceOverlay/res/values/colors_device_defaults.xml
@@ -0,0 +1,22 @@
+<?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.
+ */
+-->
+<resources>
+    <color name="accent_device_default_light">#47618A</color>
+    <color name="accent_device_default_dark">#5D7A92</color>
+</resources>
diff --git a/packages/overlays/AccentColorSpaceOverlay/res/values/strings.xml b/packages/overlays/AccentColorSpaceOverlay/res/values/strings.xml
new file mode 100644
index 0000000..55cd5ae
--- /dev/null
+++ b/packages/overlays/AccentColorSpaceOverlay/res/values/strings.xml
@@ -0,0 +1,23 @@
+<?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.
+ */
+-->
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+    <!-- Space accent color name application label. [CHAR LIMIT=50] -->
+    <string name="accent_color_space_overlay" translatable="false">Space</string>
+</resources>
+
diff --git a/packages/overlays/IconShapeSquareOverlay/res/values/config.xml b/packages/overlays/IconShapeSquareOverlay/res/values/config.xml
index 54623f5..7b65555 100644
--- a/packages/overlays/IconShapeSquareOverlay/res/values/config.xml
+++ b/packages/overlays/IconShapeSquareOverlay/res/values/config.xml
@@ -21,6 +21,8 @@
     <string name="config_icon_mask" translatable="false">"M50,0L100,0 100,100 0,100 0,0z"</string>
     <!-- Flag indicating whether round icons should be parsed from the application manifest. -->
     <bool name="config_useRoundIcon">false</bool>
+    <!-- Corner radius of system dialogs -->
+    <dimen name="config_dialogCornerRadius">0dp</dimen>
 
 </resources>
 
diff --git a/services/core/java/com/android/server/AlarmManagerService.java b/services/core/java/com/android/server/AlarmManagerService.java
index 0f39029..47c85683 100644
--- a/services/core/java/com/android/server/AlarmManagerService.java
+++ b/services/core/java/com/android/server/AlarmManagerService.java
@@ -1697,6 +1697,8 @@
             return;
         }
 
+        type = fixTypeIfAuto(type);
+
         // Sanity check the window length.  This will catch people mistakenly
         // trying to pass an end-of-window timestamp rather than a duration.
         if (windowLength > AlarmManager.INTERVAL_HALF_DAY) {
@@ -1812,6 +1814,21 @@
     }
 
     /**
+     * In case of cars, we need to avoid scheduling wakeup alarms, since we don't want the system
+     * to wake up from suspend arbitrarily to perform app work.
+     */
+    private int fixTypeIfAuto(int type) {
+        if (mInjector.isAutomotive()) {
+            if (type == AlarmManager.ELAPSED_REALTIME_WAKEUP) {
+                type = AlarmManager.ELAPSED_REALTIME;
+            } else if (type == AlarmManager.RTC_WAKEUP) {
+                type = AlarmManager.RTC;
+            }
+        }
+        return type;
+    }
+
+    /**
      * Return the minimum time that should elapse before an app in the specified bucket
      * can receive alarms again
      */
@@ -2214,6 +2231,7 @@
             pw.print("  mLastTickSet="); pw.println(sdf.format(new Date(mLastTickSet)));
             pw.print("  mLastTickAdded="); pw.println(sdf.format(new Date(mLastTickAdded)));
             pw.print("  mLastTickRemoved="); pw.println(sdf.format(new Date(mLastTickRemoved)));
+            pw.print("  mIsAutomotive="); pw.println(mInjector.isAutomotive());
 
             if (RECORD_ALARMS_IN_HISTORY) {
                 pw.println();
@@ -3838,9 +3856,12 @@
     static class Injector {
         private long mNativeData;
         private Context mContext;
+        private final boolean mIsAutomotive;
 
         Injector(Context context) {
             mContext = context;
+            mIsAutomotive = context.getPackageManager().hasSystemFeature(
+                PackageManager.FEATURE_AUTOMOTIVE);
         }
 
         void init() {
@@ -3929,6 +3950,10 @@
         ClockReceiver getClockReceiver(AlarmManagerService service) {
             return service.new ClockReceiver();
         }
+
+        boolean isAutomotive() {
+            return mIsAutomotive;
+        }
     }
 
     private class AlarmThread extends Thread
diff --git a/services/core/java/com/android/server/StorageManagerService.java b/services/core/java/com/android/server/StorageManagerService.java
index 3079192..0786b18 100644
--- a/services/core/java/com/android/server/StorageManagerService.java
+++ b/services/core/java/com/android/server/StorageManagerService.java
@@ -929,20 +929,13 @@
     private void initIfBootedAndConnected() {
         Slog.d(TAG, "Thinking about init, mBootCompleted=" + mBootCompleted
                 + ", mDaemonConnected=" + mDaemonConnected);
-        if (mBootCompleted && mDaemonConnected) {
-            // Tell vold to lock or unlock the user directories based on the
-            // current file-based encryption status.
-            final boolean initLocked;
-            if (StorageManager.isFileEncryptedNativeOrEmulated()) {
-                // For native FBE this is a no-op after reboot, but this is
-                // still needed in case of framework restarts.
-                Slog.d(TAG, "FBE is enabled; ensuring all user directories are locked.");
-                initLocked = true;
-            } else {
-                // This is in case FBE emulation was turned off.
-                Slog.d(TAG, "FBE is disabled; ensuring the FBE emulation state is cleared.");
-                initLocked = false;
-            }
+        if (mBootCompleted && mDaemonConnected
+                && !StorageManager.isFileEncryptedNativeOnly()) {
+            // When booting a device without native support, make sure that our
+            // user directories are locked or unlocked based on the current
+            // emulation status.
+            final boolean initLocked = StorageManager.isFileEncryptedEmulatedOnly();
+            Slog.d(TAG, "Setting up emulation state, initlocked=" + initLocked);
             final List<UserInfo> users = mContext.getSystemService(UserManager.class).getUsers();
             for (UserInfo user : users) {
                 try {
diff --git a/services/core/java/com/android/server/biometrics/face/FaceService.java b/services/core/java/com/android/server/biometrics/face/FaceService.java
index d67853a..aa52621 100644
--- a/services/core/java/com/android/server/biometrics/face/FaceService.java
+++ b/services/core/java/com/android/server/biometrics/face/FaceService.java
@@ -44,6 +44,7 @@
 import android.os.IBinder;
 import android.os.RemoteException;
 import android.os.SELinux;
+import android.os.SystemProperties;
 import android.os.UserHandle;
 import android.os.UserManager;
 import android.service.restricted_image.RestrictedImageProto;
@@ -1091,6 +1092,13 @@
             return;
         }
 
+        // Additionally, this flag allows turning off face for a device
+        // (either permanently through the build or on an individual device).
+        if (SystemProperties.getBoolean("ro.face.disable_debug_data", false)
+                || SystemProperties.getBoolean("persist.face.disable_debug_data", false)) {
+            return;
+        }
+
         final ProtoOutputStream proto = new ProtoOutputStream(fd);
 
         final long setToken = proto.start(RestrictedImagesDumpProto.SETS);
diff --git a/services/core/java/com/android/server/job/controllers/JobStatus.java b/services/core/java/com/android/server/job/controllers/JobStatus.java
index 06db8b8..48f21e4 100644
--- a/services/core/java/com/android/server/job/controllers/JobStatus.java
+++ b/services/core/java/com/android/server/job/controllers/JobStatus.java
@@ -104,6 +104,9 @@
             | CONSTRAINT_TIMING_DELAY
             | CONSTRAINT_WITHIN_QUOTA;
 
+    // TODO(b/129954980)
+    private static final boolean STATS_LOG_ENABLED = false;
+
     // Soft override: ignore constraints like time that don't affect API availability
     public static final int OVERRIDE_SOFT = 1;
     // Full override: ignore all constraints including API-affecting like connectivity
@@ -1000,7 +1003,7 @@
         }
         satisfiedConstraints = (satisfiedConstraints&~constraint) | (state ? constraint : 0);
         mSatisfiedConstraintsOfInterest = satisfiedConstraints & CONSTRAINTS_OF_INTEREST;
-        if ((STATSD_CONSTRAINTS_TO_LOG & constraint) != 0) {
+        if (STATS_LOG_ENABLED && (STATSD_CONSTRAINTS_TO_LOG & constraint) != 0) {
             StatsLog.write_non_chained(StatsLog.SCHEDULED_JOB_CONSTRAINT_CHANGED,
                     sourceUid, null, getBatteryName(), getProtoConstraint(constraint),
                     state ? StatsLog.SCHEDULED_JOB_CONSTRAINT_CHANGED__STATE__SATISFIED
diff --git a/services/core/java/com/android/server/role/RoleManagerService.java b/services/core/java/com/android/server/role/RoleManagerService.java
index f4e10ed..6d9e097 100644
--- a/services/core/java/com/android/server/role/RoleManagerService.java
+++ b/services/core/java/com/android/server/role/RoleManagerService.java
@@ -41,6 +41,7 @@
 import android.database.ContentObserver;
 import android.database.CursorWindow;
 import android.net.Uri;
+import android.os.AsyncTask;
 import android.os.Binder;
 import android.os.Bundle;
 import android.os.Handler;
@@ -195,7 +196,13 @@
                     Slog.i(LOG_TAG, "Packages changed - re-running initial grants for user "
                             + userId);
                 }
-                performInitialGrantsIfNecessary(userId);
+                if (Intent.ACTION_PACKAGE_REMOVED.equals(intent.getAction())
+                        && intent.getBooleanExtra(Intent.EXTRA_REPLACING, false)) {
+                    // Package is being upgraded - we're about to get ACTION_PACKAGE_ADDED
+                    return;
+                }
+                AsyncTask.THREAD_POOL_EXECUTOR.execute(
+                        () -> performInitialGrantsIfNecessaryAsync(userId));
             }
         }, UserHandle.ALL, intentFilter, null, null);
 
@@ -222,8 +229,7 @@
         performInitialGrantsIfNecessary(userId);
     }
 
-    @MainThread
-    private void performInitialGrantsIfNecessary(@UserIdInt int userId) {
+    private CompletableFuture<Void> performInitialGrantsIfNecessaryAsync(@UserIdInt int userId) {
         RoleUserState userState;
         userState = getOrCreateUserState(userId);
 
@@ -247,20 +253,27 @@
             getOrCreateControllerService(userId).grantDefaultRoles(FgThread.getExecutor(),
                     successful -> {
                         if (successful) {
+                            userState.setPackagesHash(packagesHash);
                             result.complete(null);
                         } else {
                             result.completeExceptionally(new RuntimeException());
                         }
                     });
-            try {
-                result.get(30, TimeUnit.SECONDS);
-                userState.setPackagesHash(packagesHash);
-            } catch (InterruptedException | ExecutionException | TimeoutException e) {
-                Slog.e(LOG_TAG, "Failed to grant defaults for user " + userId, e);
-            }
+            return result;
         } else if (DEBUG) {
             Slog.i(LOG_TAG, "Already ran grants for package state " + packagesHash);
         }
+        return CompletableFuture.completedFuture(null);
+    }
+
+    @MainThread
+    private void performInitialGrantsIfNecessary(@UserIdInt int userId) {
+        CompletableFuture<Void> result = performInitialGrantsIfNecessaryAsync(userId);
+        try {
+            result.get(30, TimeUnit.SECONDS);
+        } catch (InterruptedException | ExecutionException | TimeoutException e) {
+            Slog.e(LOG_TAG, "Failed to grant defaults for user " + userId, e);
+        }
     }
 
     private void migrateRoleIfNecessary(String role, @UserIdInt int userId) {
diff --git a/services/tests/mockingservicestests/src/com/android/server/AlarmManagerServiceTest.java b/services/tests/mockingservicestests/src/com/android/server/AlarmManagerServiceTest.java
index 7a40e44..7a68e92 100644
--- a/services/tests/mockingservicestests/src/com/android/server/AlarmManagerServiceTest.java
+++ b/services/tests/mockingservicestests/src/com/android/server/AlarmManagerServiceTest.java
@@ -66,6 +66,7 @@
 import android.content.ContentResolver;
 import android.content.Context;
 import android.content.Intent;
+import android.content.pm.PackageManager;
 import android.os.Handler;
 import android.os.Looper;
 import android.os.Message;
@@ -118,6 +119,8 @@
     private AlarmManagerService.ClockReceiver mClockReceiver;
     @Mock
     private PowerManager.WakeLock mWakeLock;
+    @Mock
+    private PackageManager mMockPackageManager;
 
     private MockitoSession mMockingSession;
     private Injector mInjector;
@@ -128,15 +131,21 @@
     static class TestTimer {
         private long mElapsed;
         boolean mExpired;
+        int mType;
 
         synchronized long getElapsed() {
             return mElapsed;
         }
 
-        synchronized void set(long millisElapsed) {
+        synchronized void set(int type, long millisElapsed) {
+            mType = type;
             mElapsed = millisElapsed;
         }
 
+        synchronized int getType() {
+            return mType;
+        }
+
         synchronized void expire() throws InterruptedException {
             mExpired = true;
             notifyAll();
@@ -146,6 +155,8 @@
     }
 
     public class Injector extends AlarmManagerService.Injector {
+        boolean mIsAutomotiveOverride;
+
         Injector(Context context) {
             super(context);
         }
@@ -179,7 +190,7 @@
 
         @Override
         void setAlarm(int type, long millis) {
-            mTestTimer.set(millis);
+            mTestTimer.set(type, millis);
         }
 
         @Override
@@ -211,6 +222,11 @@
         PowerManager.WakeLock getAlarmWakeLock() {
             return mWakeLock;
         }
+
+        @Override
+        boolean isAutomotive() {
+            return mIsAutomotiveOverride;
+        }
     }
 
     @Before
@@ -237,6 +253,8 @@
         when(mMockContext.getContentResolver()).thenReturn(mMockResolver);
         doReturn("min_futurity=0,min_interval=0").when(() ->
                 Settings.Global.getString(mMockResolver, Settings.Global.ALARM_MANAGER_CONSTANTS));
+        when(mMockContext.getPackageManager()).thenReturn(mMockPackageManager);
+
         mInjector = new Injector(mMockContext);
         mService = new AlarmManagerService(mMockContext, mInjector);
         spyOn(mService);
@@ -933,6 +951,37 @@
     }
 
     @Test
+    public void alarmTypes() throws Exception {
+        final int[] typesToSet = {ELAPSED_REALTIME_WAKEUP, ELAPSED_REALTIME, RTC_WAKEUP, RTC};
+        final int[] typesExpected = {ELAPSED_REALTIME_WAKEUP, ELAPSED_REALTIME,
+                ELAPSED_REALTIME_WAKEUP, ELAPSED_REALTIME};
+        assertAlarmTypeConversion(typesToSet, typesExpected);
+    }
+
+    /**
+     * Confirm that wakeup alarms are never set for automotive.
+     */
+    @Test
+    public void alarmTypesForAuto() throws Exception {
+        mInjector.mIsAutomotiveOverride = true;
+        final int[] typesToSet = {ELAPSED_REALTIME_WAKEUP, ELAPSED_REALTIME, RTC_WAKEUP, RTC};
+        final int[] typesExpected = {ELAPSED_REALTIME, ELAPSED_REALTIME, ELAPSED_REALTIME,
+                ELAPSED_REALTIME};
+        assertAlarmTypeConversion(typesToSet, typesExpected);
+    }
+
+    private void assertAlarmTypeConversion(int[] typesToSet, int[] typesExpected) throws Exception {
+        for (int i = 0; i < typesToSet.length; i++) {
+            setTestAlarm(typesToSet[i], 1234, getNewMockPendingIntent());
+            final int typeSet = mTestTimer.getType();
+            assertEquals("Alarm of type " + typesToSet[i] + " was set to type " + typeSet,
+                    typesExpected[i], typeSet);
+            mNowElapsedTest = mTestTimer.getElapsed();
+            mTestTimer.expire();
+        }
+    }
+
+    @Test
     public void alarmCountOnInvalidSet() {
         setTestAlarm(ELAPSED_REALTIME, mNowElapsedTest + 12345, null);
         assertEquals(-1, mService.mAlarmsPerUid.get(TEST_CALLING_UID, -1));
diff --git a/telecomm/java/android/telecom/CallRedirectionService.java b/telecomm/java/android/telecom/CallRedirectionService.java
index d01c889..37fab09 100644
--- a/telecomm/java/android/telecom/CallRedirectionService.java
+++ b/telecomm/java/android/telecom/CallRedirectionService.java
@@ -121,8 +121,6 @@
      *
      * @param handle the new phone number to dial
      * @param targetPhoneAccount the {@link PhoneAccountHandle} to use when placing the call.
-     *                           If {@code null}, no change will be made to the
-     *                           {@link PhoneAccountHandle} used to place the call.
      * @param confirmFirst Telecom will ask users to confirm the redirection via a yes/no dialog
      *                     if the confirmFirst is true, and if the redirection request of this
      *                     response was sent with a true flag of allowInteractiveResponse via