Merge "Add 5.1.2, 5.1.4, 7.1.2, 7.1.4 output channel masks" into pi-dev
diff --git a/automotive/vehicle/2.0/Android.bp b/automotive/vehicle/2.0/Android.bp
index bdc44ef..902a4e8 100644
--- a/automotive/vehicle/2.0/Android.bp
+++ b/automotive/vehicle/2.0/Android.bp
@@ -48,6 +48,7 @@
         "VehicleHvacFanDirection",
         "VehicleHwKeyInputAction",
         "VehicleIgnitionState",
+        "VehicleOilLevel",
         "VehiclePropConfig",
         "VehiclePropValue",
         "VehicleProperty",
diff --git a/automotive/vehicle/2.0/default/common/src/VehiclePropertyStore.cpp b/automotive/vehicle/2.0/default/common/src/VehiclePropertyStore.cpp
index 2c3ebfc..f2aa421 100644
--- a/automotive/vehicle/2.0/default/common/src/VehiclePropertyStore.cpp
+++ b/automotive/vehicle/2.0/default/common/src/VehiclePropertyStore.cpp
@@ -52,6 +52,7 @@
     } else {
         valueToUpdate->timestamp = propValue.timestamp;
         valueToUpdate->value = propValue.value;
+        valueToUpdate->status = propValue.status;
     }
     return true;
 }
diff --git a/automotive/vehicle/2.0/default/impl/vhal_v2_0/EmulatedVehicleHal.cpp b/automotive/vehicle/2.0/default/impl/vhal_v2_0/EmulatedVehicleHal.cpp
index 764bebd..dc34a50 100644
--- a/automotive/vehicle/2.0/default/impl/vhal_v2_0/EmulatedVehicleHal.cpp
+++ b/automotive/vehicle/2.0/default/impl/vhal_v2_0/EmulatedVehicleHal.cpp
@@ -138,6 +138,7 @@
             return status;
         }
     } else if (mHvacPowerProps.count(propValue.prop)) {
+        // TODO(75328113): this should be handled by property status
         auto hvacPowerOn = mPropStore->readValueOrNull(
             toInt(VehicleProperty::HVAC_POWER_ON),
             (VehicleAreaZone::ROW_1_LEFT | VehicleAreaZone::ROW_1_RIGHT));
@@ -165,6 +166,22 @@
         }
     }
 
+    if (propValue.status != VehiclePropertyStatus::AVAILABLE) {
+        // Android side cannot set property status - this value is the
+        // purview of the HAL implementation to reflect the state of
+        // its underlying hardware
+        return StatusCode::INVALID_ARG;
+    }
+    auto currentPropValue = mPropStore->readValueOrNull(propValue);
+
+    if (currentPropValue == nullptr) {
+        return StatusCode::INVALID_ARG;
+    }
+    if (currentPropValue->status != VehiclePropertyStatus::AVAILABLE) {
+        // do not allow Android side to set() a disabled/error property
+        return StatusCode::NOT_AVAILABLE;
+    }
+
     if (!mPropStore->writeValue(propValue)) {
         return StatusCode::INVALID_ARG;
     }
diff --git a/camera/common/1.0/default/Exif.cpp b/camera/common/1.0/default/Exif.cpp
index 3e894f9..6054999 100644
--- a/camera/common/1.0/default/Exif.cpp
+++ b/camera/common/1.0/default/Exif.cpp
@@ -983,15 +983,15 @@
     camera_metadata_ro_entry entry = metadata.find(ANDROID_LENS_FOCAL_LENGTH);
     if (entry.count) {
         focal_length = entry.data.f[0];
+
+        if (!setFocalLength(
+                        static_cast<uint32_t>(focal_length * kRationalPrecision),
+                        kRationalPrecision)) {
+            ALOGE("%s: setting focal length failed.", __FUNCTION__);
+            return false;
+        }
     } else {
-        ALOGE("%s: Cannot find focal length in metadata.", __FUNCTION__);
-        return false;
-    }
-    if (!setFocalLength(
-                    static_cast<uint32_t>(focal_length * kRationalPrecision),
-                    kRationalPrecision)) {
-        ALOGE("%s: setting focal length failed.", __FUNCTION__);
-        return false;
+        ALOGV("%s: Cannot find focal length in metadata.", __FUNCTION__);
     }
 
     if (metadata.exists(ANDROID_JPEG_GPS_COORDINATES)) {
diff --git a/camera/device/3.4/Android.bp b/camera/device/3.4/Android.bp
index 87acd25..2c649ba 100644
--- a/camera/device/3.4/Android.bp
+++ b/camera/device/3.4/Android.bp
@@ -25,7 +25,6 @@
         "HalStreamConfiguration",
         "PhysicalCameraMetadata",
         "PhysicalCameraSetting",
-        "RequestTemplate",
         "Stream",
         "StreamConfiguration",
     ],
diff --git a/camera/device/3.4/default/ExternalCameraDevice.cpp b/camera/device/3.4/default/ExternalCameraDevice.cpp
index 9a02ce8..6b05d4a 100644
--- a/camera/device/3.4/default/ExternalCameraDevice.cpp
+++ b/camera/device/3.4/default/ExternalCameraDevice.cpp
@@ -284,13 +284,6 @@
     const int32_t jpegMaxSize = mCfg.maxJpegBufSize;
     UPDATE(ANDROID_JPEG_MAX_SIZE, &jpegMaxSize, 1);
 
-    const uint8_t jpegQuality = 90;
-    UPDATE(ANDROID_JPEG_QUALITY, &jpegQuality, 1);
-    UPDATE(ANDROID_JPEG_THUMBNAIL_QUALITY, &jpegQuality, 1);
-
-    const int32_t jpegOrientation = 0;
-    UPDATE(ANDROID_JPEG_ORIENTATION, &jpegOrientation, 1);
-
     // android.lens
     const uint8_t focusDistanceCalibration =
             ANDROID_LENS_INFO_FOCUS_DISTANCE_CALIBRATION_UNCALIBRATED;
@@ -322,7 +315,6 @@
     // This means pipeline latency of X frame intervals. The maximum number is 4.
     const uint8_t requestPipelineMaxDepth = 4;
     UPDATE(ANDROID_REQUEST_PIPELINE_MAX_DEPTH, &requestPipelineMaxDepth, 1);
-    UPDATE(ANDROID_REQUEST_PIPELINE_DEPTH, &requestPipelineMaxDepth, 1);
 
     // Three numbers represent the maximum numbers of different types of output
     // streams simultaneously. The types are raw sensor, processed (but not
@@ -355,7 +347,6 @@
         ANDROID_SENSOR_TEST_PATTERN_MODE_OFF};
     UPDATE(ANDROID_SENSOR_AVAILABLE_TEST_PATTERN_MODES, testPatternModes,
            ARRAY_SIZE(testPatternModes));
-    UPDATE(ANDROID_SENSOR_TEST_PATTERN_MODE, &testPatternModes[0], 1);
 
     const uint8_t timestampSource = ANDROID_SENSOR_INFO_TIMESTAMP_SOURCE_UNKNOWN;
     UPDATE(ANDROID_SENSOR_INFO_TIMESTAMP_SOURCE, &timestampSource, 1);
@@ -576,7 +567,6 @@
     std::vector<int32_t> streamConfigurations;
     std::vector<int64_t> minFrameDurations;
     std::vector<int64_t> stallDurations;
-    int64_t maxFrameDuration = 0;
     int32_t maxFps = std::numeric_limits<int32_t>::min();
     int32_t minFps = std::numeric_limits<int32_t>::max();
     std::set<int32_t> framerates;
@@ -604,9 +594,6 @@
             if (frameDuration < minFrameDuration) {
                 minFrameDuration = frameDuration;
             }
-            if (frameDuration > maxFrameDuration) {
-                maxFrameDuration = frameDuration;
-            }
             int32_t frameRateInt = static_cast<int32_t>(fr.getDouble());
             if (minFps > frameRateInt) {
                 minFps = frameRateInt;
@@ -639,14 +626,15 @@
     }
 
     std::vector<int32_t> fpsRanges;
-    // Variable range
-    fpsRanges.push_back(minFps);
-    fpsRanges.push_back(maxFps);
-    // Fixed ranges
+    // FPS ranges
     for (const auto& framerate : framerates) {
-        fpsRanges.push_back(framerate);
+        // Empirical: webcams often have close to 2x fps error and cannot support fixed fps range
+        fpsRanges.push_back(framerate / 2);
         fpsRanges.push_back(framerate);
     }
+    minFps /= 2;
+    int64_t maxFrameDuration = 1000000000LL / minFps;
+
     UPDATE(ANDROID_CONTROL_AE_AVAILABLE_TARGET_FPS_RANGES, fpsRanges.data(),
            fpsRanges.size());
 
diff --git a/camera/device/3.4/default/ExternalCameraDeviceSession.cpp b/camera/device/3.4/default/ExternalCameraDeviceSession.cpp
index 5569439..7015bcb 100644
--- a/camera/device/3.4/default/ExternalCameraDeviceSession.cpp
+++ b/camera/device/3.4/default/ExternalCameraDeviceSession.cpp
@@ -47,6 +47,9 @@
 const int kBadFramesAfterStreamOn = 1; // drop x frames after streamOn to get rid of some initial
                                        // bad frames. TODO: develop a better bad frame detection
                                        // method
+constexpr int MAX_RETRY = 15; // Allow retry some ioctl failures a few times to account for some
+                             // webcam showing temporarily ioctl failures.
+constexpr int IOCTL_RETRY_SLEEP_US = 33000; // 33ms * MAX_RETRY = 5 seconds
 
 bool tryLock(Mutex& mutex)
 {
@@ -1480,6 +1483,7 @@
 
     int jpegQuality, thumbQuality;
     Size thumbSize;
+    bool outputThumbnail = true;
 
     if (req->setting.exists(ANDROID_JPEG_QUALITY)) {
         camera_metadata_entry entry =
@@ -1505,6 +1509,9 @@
         thumbSize = Size { static_cast<uint32_t>(entry.data.i32[0]),
                            static_cast<uint32_t>(entry.data.i32[1])
         };
+        if (thumbSize.width == 0 && thumbSize.height == 0) {
+            outputThumbnail = false;
+        }
     } else {
         return lfail(
             "%s: ANDROID_JPEG_THUMBNAIL_SIZE not set", __FUNCTION__);
@@ -1532,14 +1539,16 @@
     /* Hold actual thumbnail and main image code sizes */
     size_t thumbCodeSize = 0, jpegCodeSize = 0;
     /* Temporary thumbnail code buffer */
-    std::vector<uint8_t> thumbCode(maxThumbCodeSize);
+    std::vector<uint8_t> thumbCode(outputThumbnail ? maxThumbCodeSize : 0);
 
     YCbCrLayout yu12Thumb;
-    ret = cropAndScaleThumbLocked(mYu12Frame, thumbSize, &yu12Thumb);
+    if (outputThumbnail) {
+        ret = cropAndScaleThumbLocked(mYu12Frame, thumbSize, &yu12Thumb);
 
-    if (ret != 0) {
-        return lfail(
-            "%s: crop and scale thumbnail failed!", __FUNCTION__);
+        if (ret != 0) {
+            return lfail(
+                "%s: crop and scale thumbnail failed!", __FUNCTION__);
+        }
     }
 
     /* Scale and crop main jpeg */
@@ -1550,12 +1559,14 @@
     }
 
     /* Encode the thumbnail image */
-    ret = encodeJpegYU12(thumbSize, yu12Thumb,
-            thumbQuality, 0, 0,
-            &thumbCode[0], maxThumbCodeSize, thumbCodeSize);
+    if (outputThumbnail) {
+        ret = encodeJpegYU12(thumbSize, yu12Thumb,
+                thumbQuality, 0, 0,
+                &thumbCode[0], maxThumbCodeSize, thumbCodeSize);
 
-    if (ret != 0) {
-        return lfail("%s: encodeJpegYU12 failed with %d",__FUNCTION__, ret);
+        if (ret != 0) {
+            return lfail("%s: thumbnail encodeJpegYU12 failed with %d",__FUNCTION__, ret);
+        }
     }
 
     /* Combine camera characteristics with request settings to form EXIF
@@ -1570,11 +1581,7 @@
 
     utils->setFromMetadata(meta, jpegSize.width, jpegSize.height);
 
-    /* Check if we made a non-zero-sized thumbnail. Currently not possible
-     * that we got this far and the code is size 0, but if this code moves
-     * around it might become relevant again */
-
-    ret = utils->generateApp1(thumbCodeSize ? &thumbCode[0] : 0, thumbCodeSize);
+    ret = utils->generateApp1(outputThumbnail ? &thumbCode[0] : 0, thumbCodeSize);
 
     if (!ret) {
         return lfail("%s: generating APP1 failed", __FUNCTION__);
@@ -2109,8 +2116,20 @@
     fmt.fmt.pix.pixelformat = v4l2Fmt.fourcc;
     ret = TEMP_FAILURE_RETRY(ioctl(mV4l2Fd.get(), VIDIOC_S_FMT, &fmt));
     if (ret < 0) {
-        ALOGE("%s: S_FMT ioctl failed: %s", __FUNCTION__, strerror(errno));
-        return -errno;
+        int numAttempt = 0;
+        while (ret < 0) {
+            ALOGW("%s: VIDIOC_S_FMT failed, wait 33ms and try again", __FUNCTION__);
+            usleep(IOCTL_RETRY_SLEEP_US); // sleep 100 ms and try again
+            ret = TEMP_FAILURE_RETRY(ioctl(mV4l2Fd.get(), VIDIOC_S_FMT, &fmt));
+            if (numAttempt == MAX_RETRY) {
+                break;
+            }
+            numAttempt++;
+        }
+        if (ret < 0) {
+            ALOGE("%s: S_FMT ioctl failed: %s", __FUNCTION__, strerror(errno));
+            return -errno;
+        }
     }
 
     if (v4l2Fmt.width != fmt.fmt.pix.width || v4l2Fmt.height != fmt.fmt.pix.height ||
@@ -2199,9 +2218,22 @@
 
     // VIDIOC_STREAMON: start streaming
     v4l2_buf_type capture_type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
-    if (TEMP_FAILURE_RETRY(ioctl(mV4l2Fd.get(), VIDIOC_STREAMON, &capture_type)) < 0) {
-        ALOGE("%s: VIDIOC_STREAMON failed: %s", __FUNCTION__, strerror(errno));
-        return -errno;
+    ret = TEMP_FAILURE_RETRY(ioctl(mV4l2Fd.get(), VIDIOC_STREAMON, &capture_type));
+    if (ret < 0) {
+        int numAttempt = 0;
+        while (ret < 0) {
+            ALOGW("%s: VIDIOC_STREAMON failed, wait 33ms and try again", __FUNCTION__);
+            usleep(IOCTL_RETRY_SLEEP_US); // sleep 100 ms and try again
+            ret = TEMP_FAILURE_RETRY(ioctl(mV4l2Fd.get(), VIDIOC_STREAMON, &capture_type));
+            if (numAttempt == MAX_RETRY) {
+                break;
+            }
+            numAttempt++;
+        }
+        if (ret < 0) {
+            ALOGE("%s: VIDIOC_STREAMON ioctl failed: %s", __FUNCTION__, strerror(errno));
+            return -errno;
+        }
     }
 
     // Swallow first few frames after streamOn to account for bad frames from some devices
@@ -2220,6 +2252,8 @@
         }
     }
 
+    ALOGI("%s: start V4L2 streaming %dx%d@%ffps",
+                __FUNCTION__, v4l2Fmt.width, v4l2Fmt.height, fps);
     mV4l2StreamingFmt = v4l2Fmt;
     mV4l2Streaming = true;
     return OK;
@@ -2388,6 +2422,7 @@
     uint32_t maxDim = 0;
     for (const auto& stream : config.streams) {
         float aspectRatio = ASPECT_RATIO(stream);
+        ALOGI("%s: request stream %dx%d", __FUNCTION__, stream.width, stream.height);
         if ((mCroppingType == VERTICAL && aspectRatio < desiredAr) ||
                 (mCroppingType == HORIZONTAL && aspectRatio > desiredAr)) {
             desiredAr = aspectRatio;
@@ -2572,6 +2607,9 @@
     const uint8_t nrMode = ANDROID_NOISE_REDUCTION_MODE_OFF;
     UPDATE(md, ANDROID_NOISE_REDUCTION_MODE, &nrMode, 1);
 
+    const int32_t testPatternModes = ANDROID_SENSOR_TEST_PATTERN_MODE_OFF;
+    UPDATE(md, ANDROID_SENSOR_TEST_PATTERN_MODE, &testPatternModes, 1);
+
     const uint8_t fdMode = ANDROID_STATISTICS_FACE_DETECT_MODE_OFF;
     UPDATE(md, ANDROID_STATISTICS_FACE_DETECT_MODE, &fdMode, 1);
 
@@ -2596,7 +2634,7 @@
         }
     }
     int32_t defaultFramerate = support30Fps ? 30 : maxFps;
-    int32_t defaultFpsRange[] = {defaultFramerate, defaultFramerate};
+    int32_t defaultFpsRange[] = {defaultFramerate / 2, defaultFramerate};
     UPDATE(md, ANDROID_CONTROL_AE_TARGET_FPS_RANGE, defaultFpsRange, ARRAY_SIZE(defaultFpsRange));
 
     uint8_t antibandingMode = ANDROID_CONTROL_AE_ANTIBANDING_MODE_AUTO;
@@ -2691,6 +2729,10 @@
     const uint8_t flashState = ANDROID_FLASH_STATE_UNAVAILABLE;
     UPDATE(md, ANDROID_FLASH_STATE, &flashState, 1);
 
+    // This means pipeline latency of X frame intervals. The maximum number is 4.
+    const uint8_t requestPipelineMaxDepth = 4;
+    UPDATE(md, ANDROID_REQUEST_PIPELINE_DEPTH, &requestPipelineMaxDepth, 1);
+
     // android.scaler
     const int32_t crop_region[] = {
           active_array_size.data.i32[0], active_array_size.data.i32[1],
diff --git a/camera/device/3.4/default/ExternalCameraUtils.cpp b/camera/device/3.4/default/ExternalCameraUtils.cpp
index d28a4dd..2e2f73b 100644
--- a/camera/device/3.4/default/ExternalCameraUtils.cpp
+++ b/camera/device/3.4/default/ExternalCameraUtils.cpp
@@ -283,9 +283,8 @@
         numVideoBuffers(kDefaultNumVideoBuffer),
         numStillBuffers(kDefaultNumStillBuffer) {
     fpsLimits.push_back({/*Size*/{ 640,  480}, /*FPS upper bound*/30.0});
-    fpsLimits.push_back({/*Size*/{1280,  720}, /*FPS upper bound*/15.0});
-    fpsLimits.push_back({/*Size*/{1920, 1080}, /*FPS upper bound*/10.0});
-    fpsLimits.push_back({/*Size*/{4096, 3072}, /*FPS upper bound*/5.0});
+    fpsLimits.push_back({/*Size*/{1280,  720}, /*FPS upper bound*/7.5});
+    fpsLimits.push_back({/*Size*/{1920, 1080}, /*FPS upper bound*/5.0});
 }
 
 
diff --git a/camera/provider/2.4/ICameraProvider.hal b/camera/provider/2.4/ICameraProvider.hal
index abb6366..8773bc0 100644
--- a/camera/provider/2.4/ICameraProvider.hal
+++ b/camera/provider/2.4/ICameraProvider.hal
@@ -35,7 +35,8 @@
  * where
  *   - <major>/<minor> is the provider HAL HIDL version,
  *   - <type> is the type of devices this provider knows about, such as
- *     "internal", "legacy", "external", or "remote"
+ *     "internal", "legacy", "external", "remote" etc. The camera framework
+ *     must not differentiate or chage its behavior based on the specific type.
  *   - <instance> is a non-negative integer starting from 0 to disambiguate
  *     between multiple HALs of the same type.
  *
diff --git a/compatibility_matrices/compatibility_matrix.current.xml b/compatibility_matrices/compatibility_matrix.current.xml
index dd8d92d..b500ed4 100644
--- a/compatibility_matrices/compatibility_matrix.current.xml
+++ b/compatibility_matrices/compatibility_matrix.current.xml
@@ -182,7 +182,7 @@
         <interface>
             <name>IKeymasterDevice</name>
             <instance>default</instance>
-	    <!-- TODO: strongbox here? -->
+            <instance>strongbox</instance>
         </interface>
     </hal>
     <hal format="hidl" optional="true">
@@ -214,6 +214,15 @@
         </interface>
     </hal>
     <hal format="hidl" optional="true">
+        <name>android.hardware.neuralnetworks</name>
+        <version>1.0</version>
+        <interface>
+            <name>IDevice</name>
+            <!-- TODO(b/73738616): This should be * (match any) -->
+            <instance>hvx</instance>
+        </interface>
+    </hal>
+    <hal format="hidl" optional="true">
         <name>android.hardware.nfc</name>
         <version>1.0</version>
         <interface>
@@ -275,7 +284,7 @@
     </hal>
     <hal format="hidl" optional="true">
         <name>android.hardware.soundtrigger</name>
-        <version>2.0</version>
+        <version>2.0-1</version>
         <interface>
             <name>ISoundTriggerHw</name>
             <instance>default</instance>
@@ -330,8 +339,16 @@
         </interface>
     </hal>
     <hal format="hidl" optional="true">
+        <name>android.hardware.usb.gadget</name>
+        <version>1.0</version>
+        <interface>
+            <name>IUsbGadget</name>
+            <instance>default</instance>
+        </interface>
+    </hal>
+    <hal format="hidl" optional="true">
         <name>android.hardware.vibrator</name>
-        <version>1.0-1</version>
+        <version>1.0-2</version>
         <interface>
             <name>IVibrator</name>
             <instance>default</instance>
@@ -355,13 +372,21 @@
     </hal>
     <hal format="hidl" optional="true">
         <name>android.hardware.wifi</name>
-        <version>1.0-1</version>
+        <version>1.0-2</version>
         <interface>
             <name>IWifi</name>
             <instance>default</instance>
         </interface>
     </hal>
     <hal format="hidl" optional="true">
+        <name>android.hardware.wifi.hostapd</name>
+        <version>1.0</version>
+        <interface>
+            <name>IHostapd</name>
+            <instance>default</instance>
+        </interface>
+    </hal>
+    <hal format="hidl" optional="true">
         <name>android.hardware.wifi.offload</name>
         <version>1.0</version>
         <interface>
@@ -371,7 +396,7 @@
     </hal>
     <hal format="hidl" optional="true">
         <name>android.hardware.wifi.supplicant</name>
-        <version>1.0</version>
+        <version>1.0-1</version>
         <interface>
             <name>ISupplicant</name>
             <instance>default</instance>
diff --git a/current.txt b/current.txt
index e696a81..1dd0973 100644
--- a/current.txt
+++ b/current.txt
@@ -251,7 +251,7 @@
 
 # ABI preserving changes to HALs during Android P
 cf72ff5a52bfa4d08e9e1000cf3ab5952a2d280c7f13cdad5ab7905c08050766 android.hardware.camera.metadata@3.2::types
-7b4723305354193b889a24153e1292fec62d5a5127bdfba08a5a27440f092de9 android.hardware.camera.provider@2.4::ICameraProvider
+3902efc42097cba55f0655aa389e052ea70164e99ced1a6d1ef53dafc13f7650 android.hardware.camera.provider@2.4::ICameraProvider
 6fa9804a17a8bb7923a56bd10493a5483c20007e4c9026fd04287bee7c945a8c android.hardware.gnss@1.0::IGnssCallback
 fb92e2b40f8e9d494e8fd3b4ac18499a3216342e7cff160714c3bbf3660b6e79 android.hardware.gnss@1.0::IGnssConfiguration
 251594ea9b27447bfa005ebd806e58fb0ae4aad84a69938129c9800ec0c64eda android.hardware.gnss@1.0::IGnssMeasurementCallback
diff --git a/drm/1.1/Android.bp b/drm/1.1/Android.bp
index ed8196e..dba3e42 100644
--- a/drm/1.1/Android.bp
+++ b/drm/1.1/Android.bp
@@ -17,8 +17,10 @@
         "android.hidl.base@1.0",
     ],
     types: [
+        "DrmMetricGroup",
         "HdcpLevel",
         "KeyRequestType",
+        "SecureStopRelease",
         "SecurityLevel",
     ],
     gen_java: false,
diff --git a/graphics/mapper/2.1/Android.bp b/graphics/mapper/2.1/Android.bp
index d917e59..8527d3d 100644
--- a/graphics/mapper/2.1/Android.bp
+++ b/graphics/mapper/2.1/Android.bp
@@ -11,6 +11,7 @@
         "IMapper.hal",
     ],
     interfaces: [
+        "android.hardware.graphics.common@1.0",
         "android.hardware.graphics.common@1.1",
         "android.hardware.graphics.mapper@2.0",
         "android.hidl.base@1.0",
diff --git a/light/2.0/default/android.hardware.light@2.0-service.rc b/light/2.0/default/android.hardware.light@2.0-service.rc
index 68f74c4..b54ca95 100644
--- a/light/2.0/default/android.hardware.light@2.0-service.rc
+++ b/light/2.0/default/android.hardware.light@2.0-service.rc
@@ -3,3 +3,5 @@
     class hal
     user system
     group system
+    # shutting off lights while powering-off
+    shutdown critical
diff --git a/light/utils/main.cpp b/light/utils/main.cpp
index 1f9cb9c..d07e799 100644
--- a/light/utils/main.cpp
+++ b/light/utils/main.cpp
@@ -26,6 +26,7 @@
 }
 
 int main() {
+    using ::android::hardware::hidl_vec;
     using ::android::hardware::light::V2_0::Brightness;
     using ::android::hardware::light::V2_0::Flash;
     using ::android::hardware::light::V2_0::ILight;
@@ -44,9 +45,15 @@
         .color = 0u, .flashMode = Flash::NONE, .brightnessMode = Brightness::USER,
     };
 
-    Status ret = service->setLight(Type::BACKLIGHT, off).withDefault(Status::UNKNOWN);
-    if (ret != Status::SUCCESS) {
-        error("Failed to shut off screen");
-    }
+    service->getSupportedTypes([&](const hidl_vec<Type>& types) {
+        for (Type type : types) {
+            Status ret = service->setLight(type, off);
+            if (ret != Status::SUCCESS) {
+                error("Failed to shut off screen for type " +
+                      std::to_string(static_cast<int>(type)));
+            }
+        }
+    });
+
     return 0;
 }
diff --git a/neuralnetworks/1.1/Android.bp b/neuralnetworks/1.1/Android.bp
index 9365d4e..81bcef3 100644
--- a/neuralnetworks/1.1/Android.bp
+++ b/neuralnetworks/1.1/Android.bp
@@ -15,6 +15,7 @@
         "android.hidl.base@1.0",
     ],
     types: [
+        "Capabilities",
         "Model",
         "Operation",
         "OperationType",