Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4c13e4e7 authored by android-build-team Robot's avatar android-build-team Robot
Browse files

Snap for 4447680 from 446e97af to pi-release

Change-Id: I27425e94fcbbb8cb4ecf95f131ffb9d77927fd82
parents 5ee4bfbd 446e97af
Loading
Loading
Loading
Loading
+100 −23
Original line number Diff line number Diff line
@@ -76,6 +76,38 @@ struct ConfigDeclaration {
};

const ConfigDeclaration kVehicleProperties[]{
    {.config =
         {
             .prop = toInt(VehicleProperty::INFO_FUEL_CAPACITY),
             .access = VehiclePropertyAccess::READ,
             .changeMode = VehiclePropertyChangeMode::STATIC,
         },
     .initialValue = {.floatValues = {15000}}},

    {.config =
         {
             .prop = toInt(VehicleProperty::INFO_FUEL_TYPE),
             .access = VehiclePropertyAccess::READ,
             .changeMode = VehiclePropertyChangeMode::STATIC,
         },
     .initialValue = {.int32Values = {1}}},

    {.config =
         {
             .prop = toInt(VehicleProperty::INFO_EV_BATTERY_CAPACITY),
             .access = VehiclePropertyAccess::READ,
             .changeMode = VehiclePropertyChangeMode::STATIC,
         },
     .initialValue = {.floatValues = {150000}}},

    {.config =
         {
             .prop = toInt(VehicleProperty::INFO_EV_CONNECTOR_TYPE),
             .access = VehiclePropertyAccess::READ,
             .changeMode = VehiclePropertyChangeMode::STATIC,
         },
     .initialValue = {.int32Values = {1}}},

    {.config =
         {
             .prop = toInt(VehicleProperty::INFO_MAKE),
@@ -89,7 +121,7 @@ const ConfigDeclaration kVehicleProperties[]{
             .access = VehiclePropertyAccess::READ,
             .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
             .minSampleRate = 1.0f,
             .maxSampleRate = 1000.0f,
             .maxSampleRate = 10.0f,
         },
     .initialValue = {.floatValues = {0.0f}}},

@@ -101,6 +133,14 @@ const ConfigDeclaration kVehicleProperties[]{
         },
     .initialValue = {.floatValues = {0.0f}}},

    {.config =
         {
             .prop = toInt(VehicleProperty::ENGINE_ON),
             .access = VehiclePropertyAccess::READ,
             .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
         },
     .initialValue = {.int32Values = {0}}},

    {
        .config =
            {
@@ -108,11 +148,59 @@ const ConfigDeclaration kVehicleProperties[]{
                .access = VehiclePropertyAccess::READ,
                .changeMode = VehiclePropertyChangeMode::CONTINUOUS,
                .minSampleRate = 1.0f,
                .maxSampleRate = 1000.0f,
                .maxSampleRate = 10.0f,
            },
        .initialValue = {.floatValues = {0.0f}},
    },

    {.config =
         {
             .prop = toInt(VehicleProperty::FUEL_LEVEL),
             .access = VehiclePropertyAccess::READ,
             .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
         },
     .initialValue = {.floatValues = {15000}}},

    {.config =
         {
             .prop = toInt(VehicleProperty::FUEL_DOOR_OPEN),
             .access = VehiclePropertyAccess::READ,
             .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
         },
     .initialValue = {.int32Values = {0}}},

    {.config =
         {
             .prop = toInt(VehicleProperty::EV_BATTERY_LEVEL),
             .access = VehiclePropertyAccess::READ,
             .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
         },
     .initialValue = {.floatValues = {150000}}},

    {.config =
         {
             .prop = toInt(VehicleProperty::EV_CHARGE_PORT_OPEN),
             .access = VehiclePropertyAccess::READ,
             .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
         },
     .initialValue = {.int32Values = {0}}},

    {.config =
         {
             .prop = toInt(VehicleProperty::EV_CHARGE_PORT_CONNECTED),
             .access = VehiclePropertyAccess::READ,
             .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
         },
     .initialValue = {.int32Values = {0}}},

    {.config =
         {
             .prop = toInt(VehicleProperty::EV_BATTERY_INSTANTANEOUS_CHARGE_RATE),
             .access = VehiclePropertyAccess::READ,
             .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
         },
     .initialValue = {.floatValues = {0}}},

    {.config =
         {
             .prop = toInt(VehicleProperty::CURRENT_GEAR),
@@ -246,16 +334,6 @@ const ConfigDeclaration kVehicleProperties[]{
         },
     .initialValue = {.int32Values = {toInt(VehicleGear::GEAR_PARK)}}},

    {
        .config =
            {
                .prop = toInt(VehicleProperty::INFO_FUEL_CAPACITY),
                .access = VehiclePropertyAccess::READ,
                .changeMode = VehiclePropertyChangeMode::STATIC,
            },
        .initialValue = {.floatValues = {123000.0f}}  // In Milliliters
    },

    {.config = {.prop = toInt(VehicleProperty::DISPLAY_BRIGHTNESS),
                .access = VehiclePropertyAccess::READ_WRITE,
                .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
@@ -297,17 +375,16 @@ const ConfigDeclaration kVehicleProperties[]{
         },
     .initialValue = {.int32Values = {1}}},

    {
        .config =
    {.config =
         {
             .prop = WHEEL_TICK,
             .access = VehiclePropertyAccess::READ,
             .changeMode = VehiclePropertyChangeMode::CONTINUOUS,
             .configArray = {ALL_WHEELS, 50000, 50000, 50000, 50000},
             .minSampleRate = 1.0f,
                .maxSampleRate = 100.0f,
            },
             .maxSampleRate = 10.0f,
         },
     .initialValue = {.int64Values = {0, 100000, 200000, 300000, 400000}}},

    {
        .config =
+208 −19
Original line number Diff line number Diff line
@@ -148,7 +148,7 @@ enum VehicleProperty: int32_t {
        | VehicleArea:GLOBAL),

    /**
     * Fuel capacity of the vehicle
     * Fuel capacity of the vehicle in milliliters
     *
     * @change_mode VehiclePropertyChangeMode:STATIC
     * @access VehiclePropertyAccess:READ
@@ -160,6 +160,45 @@ enum VehicleProperty: int32_t {
        | VehiclePropertyType:FLOAT
        | VehicleArea:GLOBAL),

    /**
     * List of fuels the vehicle may use.  Uses enum FuelType
     *
     * @change_mode VehiclePropertyChangeMode:STATIC
     * @access VehiclePropertyAccess:READ
     * @unit VehicleUnit:MILLILITERS
     */
    INFO_FUEL_TYPE = (
        0x0105
        | VehiclePropertyGroup:SYSTEM
        | VehiclePropertyType:INT32_VEC
        | VehicleArea:GLOBAL),

    /**
     * Battery capacity of the vehicle, if EV or hybrid.  This is the nominal
     * battery capacity when the vehicle is new.
     *
     * @change_mode VehiclePropertyChangeMode:STATIC
     * @access VehiclePropertyAccess:READ
     * @unit VehicleUnit:WH
     */
    INFO_EV_BATTERY_CAPACITY = (
        0x0106
        | VehiclePropertyGroup:SYSTEM
        | VehiclePropertyType:FLOAT
        | VehicleArea:GLOBAL),

    /**
     * List of connectors this EV may use.  Uses enum EvConnectorType
     *
     * @change_mode VehiclePropertyChangeMode:STATIC
     * @access VehiclePropertyAccess:READ
     */
    INFO_EV_CONNECTOR_TYPE = (
        0x0107
        | VehiclePropertyGroup:SYSTEM
        | VehiclePropertyType:INT32_VEC
        | VehicleArea:GLOBAL),

    /**
     * Current odometer value of the vehicle
     *
@@ -186,6 +225,19 @@ enum VehicleProperty: int32_t {
        | VehiclePropertyType:FLOAT
        | VehicleArea:GLOBAL),

    /**
     * Engine on
     *
     * @change_mode VehiclePropertyChangeMode:STATIC
     * @access VehiclePropertyAccess:READ
     */
    ENGINE_ON = (
        0x0300
        | VehiclePropertyGroup:SYSTEM
        | VehiclePropertyType:BOOLEAN
        | VehicleArea:GLOBAL),


    /**
     * Temperature of engine coolant
     *
@@ -259,8 +311,6 @@ enum VehicleProperty: int32_t {
     *
     * @change_mode VehiclePropertyChangeMode:CONTINUOUS
     * @access VehiclePropertyAccess:READ
     *
     * @since o.mr1
     */
    WHEEL_TICK = (
      0x0306
@@ -269,6 +319,88 @@ enum VehicleProperty: int32_t {
      | VehicleArea:GLOBAL),


    /**
     * Fuel remaining in the the vehicle, in milliliters
     *
     * Value may not exceed INFO_FUEL_CAPACITY
     *
     * @change_mode VehiclePropertyChangeMode:STATIC
     * @access VehiclePropertyAccess:READ
     * @unit VehicleUnit:MILLILITER
     */
    FUEL_LEVEL = (
        0x0307
        | VehiclePropertyGroup:SYSTEM
        | VehiclePropertyType:FLOAT
        | VehicleArea:GLOBAL),

    /**
     * Fuel door open
     *
     * @change_mode VehiclePropertyChangeMode:STATIC
     * @access VehiclePropertyAccess:READ
     */
    FUEL_DOOR_OPEN = (
        0x0308
        | VehiclePropertyGroup:SYSTEM
        | VehiclePropertyType:BOOLEAN
        | VehicleArea:GLOBAL),

    /**
     * EV battery level in WH, if EV or hybrid
     *
     * Value may not exceed INFO_EV_BATTERY_CAPACITY
     *
     * @change_mode VehiclePropertyChangeMode:STATIC
     * @access VehiclePropertyAccess:READ
     * @unit VehicleUnit:WH
     */
    EV_BATTERY_LEVEL = (
        0x0309
        | VehiclePropertyGroup:SYSTEM
        | VehiclePropertyType:FLOAT
        | VehicleArea:GLOBAL),

    /**
     * EV charge port open
     *
     * @change_mode VehiclePropertyChangeMode:STATIC
     * @access VehiclePropertyAccess:READ
     */
    EV_CHARGE_PORT_OPEN = (
        0x030A
        | VehiclePropertyGroup:SYSTEM
        | VehiclePropertyType:BOOLEAN
        | VehicleArea:GLOBAL),

    /**
     * EV charge port connected
     *
     * @change_mode VehiclePropertyChangeMode:STATIC
     * @access VehiclePropertyAccess:READ
     */
    EV_CHARGE_PORT_CONNECTED = (
        0x030B
        | VehiclePropertyGroup:SYSTEM
        | VehiclePropertyType:BOOLEAN
        | VehicleArea:GLOBAL),

    /**
     * EV instantaneous charge rate in milliwatts
     *
     * Positive value indicates battery is being charged.
     * Negative value indicates battery being discharged.
     *
     * @change_mode VehiclePropertyChangeMode:STATIC
     * @access VehiclePropertyAccess:READ
     * @unit VehicleUnit:MW
     */
    EV_BATTERY_INSTANTANEOUS_CHARGE_RATE = (
        0x030C
        | VehiclePropertyGroup:SYSTEM
        | VehiclePropertyType:FLOAT
        | VehicleArea:GLOBAL),

    /**
     * Currently selected gear
     *
@@ -376,8 +508,6 @@ enum VehicleProperty: int32_t {
     *
     * @change_mode VehiclePropertyChangeMode:ON_CHANGE
     * @access VehiclePropertyAccess:READ
     *
     * @since o.mr1
     */
    ABS_ACTIVE = (
        0x040A
@@ -390,8 +520,6 @@ enum VehicleProperty: int32_t {
     *
     * @change_mode VehiclePropertyChangeMode:ON_CHANGE
     * @access VehiclePropertyAccess:READ
     *
     * @since o.mr1
     */
    TRACTION_CONTROL_ACTIVE = (
        0x040B
@@ -720,8 +848,6 @@ enum VehicleProperty: int32_t {
     *
     * @change_mode VehiclePropertyChangeMode:ON_CHANGE
     * @access VehiclePropertyAccess:READ_WRITE
     *
     * @since o.mr1
     */
    HVAC_AUTO_RECIRC_ON = (
        0x0512
@@ -1899,8 +2025,6 @@ enum VehicleProperty: int32_t {
     *
     * @change_mode VehiclePropertyChangeMode:ON_CHANGE
     * @access VehiclePropertyAccess:READ_WRITE
     *
     * @since o.mr1
     */
    VEHICLE_MAP_SERVICE = (
        0x0C00
@@ -1948,8 +2072,6 @@ enum VehicleProperty: int32_t {
     *
     * @change_mode VehiclePropertyChangeMode:ON_CHANGE
     * @access VehiclePropertyAccess:READ
     *
     * @since o.mr1
     */
    OBD2_LIVE_FRAME = (
      0x0D00
@@ -1980,8 +2102,6 @@ enum VehicleProperty: int32_t {
     *
     * @change_mode VehiclePropertyChangeMode:ON_CHANGE
     * @access VehiclePropertyAccess:READ
     *
     * @since o.mr1
     */
    OBD2_FREEZE_FRAME = (
      0x0D01
@@ -2003,8 +2123,6 @@ enum VehicleProperty: int32_t {
     *
     * @change_mode VehiclePropertyChangeMode:ON_CHANGE
     * @access VehiclePropertyAccess:READ
     *
     * @since o.mr1
     */
    OBD2_FREEZE_FRAME_INFO = (
      0x0D02
@@ -2031,8 +2149,6 @@ enum VehicleProperty: int32_t {
     *
     * @change_mode VehiclePropertyChangeMode:ON_CHANGE
     * @access VehiclePropertyAccess:WRITE
     *
     * @since o.mr1
     */
    OBD2_FREEZE_FRAME_CLEAR = (
      0x0D03
@@ -2041,6 +2157,73 @@ enum VehicleProperty: int32_t {
      | VehicleArea:GLOBAL),
};

/**
 * Used by INFO_EV_CONNECTOR_TYPE to enumerate the type of connectors
 * available to charge the vehicle.  Consistent with projection protocol.
 */
enum EvConnectorType : int32_t {
    /**
     * Default type if the vehicle does not know or report the EV connector
     * type.
     */
    EV_CONNECTOR_TYPE_UNKNOWN = 0,
    EV_CONNECTOR_TYPE_J1772 = 1,
    EV_CONNECTOR_TYPE_MENNEKES = 2,
    EV_CONNECTOR_TYPE_CHADEMO = 3,
    EV_CONNECTOR_TYPE_COMBO_1 = 4,
    EV_CONNECTOR_TYPE_COMBO_2 = 5,
    EV_CONNECTOR_TYPE_TESLA_ROADSTER = 6,
    EV_CONNECTOR_TYPE_TESLA_HPWC = 7,
    EV_CONNECTOR_TYPE_TESLA_SUPERCHARGER = 8,
    EV_CONNECTOR_TYPE_GBT = 9,

    /**
     * Connector type to use when no other types apply. Before using this
     * value, work with Google to see if the EvConnectorType enum can be
     * extended with an appropriate value.
     */
    EV_CONNECTOR_TYPE_OTHER = 101,
};

/**
 * Used by INFO_FUEL_TYPE to enumerate the type of fuels this vehicle uses.
 * Consistent with projection protocol.
 */
enum FuelType : int32_t {
    /**
     * Fuel type to use if the HU does not know on which types of fuel the vehicle
     * runs. The use of this value is generally discouraged outside of aftermarket units.
     */
    FUEL_TYPE_UNKNOWN = 0,
    /** Unleaded gasoline */
    FUEL_TYPE_UNLEADED = 1,
    /** Leaded gasoline */
    FUEL_TYPE_LEADED = 2,
    /** Diesel #1 */
    FUEL_TYPE_DIESEL_1 = 3,
    /** Diesel #2 */
    FUEL_TYPE_DIESEL_2 = 4,
    /** Biodiesel */
    FUEL_TYPE_BIODIESEL = 5,
    /** 85% ethanol/gasoline blend */
    FUEL_TYPE_E85 = 6,
    /** Liquified petroleum gas */
    FUEL_TYPE_LPG = 7,
    /** Compressed natural gas */
    FUEL_TYPE_CNG = 8,
    /** Liquified natural gas */
    FUEL_TYPE_LNG = 9,
    /** Electric */
    FUEL_TYPE_ELECTRIC = 10,
    /** Hydrogen fuel cell */
    FUEL_TYPE_HYDROGEN = 11,
    /**
     * Fuel type to use when no other types apply. Before using this value, work with
     * Google to see if the FuelType enum can be extended with an appropriate value.
     */
    FUEL_TYPE_OTHER = 12,
};

/**
 * Bit flags for fan direction
 */
@@ -2511,6 +2694,12 @@ enum VehicleUnit : int32_t {
    NANO_SECS      = 0x50,
    SECS           = 0x53,
    YEAR           = 0x59,

    // Electrical Units
    WATT_HOUR      = 0x60,
    MILLIAMPERE    = 0x61,
    MILLIVOLT      = 0x62,
    MILLIWATTS     = 0x63,
};

  /**
+52 −1
Original line number Diff line number Diff line
@@ -18,8 +18,9 @@
#define LOG_TAG "android.hardware.cas@1.0-DescramblerImpl"

#include <hidlmemory/mapping.h>
#include <media/hardware/CryptoAPI.h>
#include <media/cas/DescramblerAPI.h>
#include <media/hardware/CryptoAPI.h>
#include <media/stagefright/foundation/AUtils.h>
#include <utils/Log.h>

#include "DescramblerImpl.h"
@@ -70,6 +71,11 @@ Return<bool> DescramblerImpl::requiresSecureDecoderComponent(
    return mPlugin->requiresSecureDecoderComponent(String8(mime.c_str()));
}

static inline bool validateRangeForSize(
        uint64_t offset, uint64_t length, uint64_t size) {
    return isInRange<uint64_t, uint64_t>(0, size, offset, length);
}

Return<void> DescramblerImpl::descramble(
        ScramblingControl scramblingControl,
        const hidl_vec<SubSample>& subSamples,
@@ -81,12 +87,57 @@ Return<void> DescramblerImpl::descramble(
    ALOGV("%s", __FUNCTION__);

    sp<IMemory> srcMem = mapMemory(srcBuffer.heapBase);

    // Validate if the offset and size in the SharedBuffer is consistent with the
    // mapped ashmem, since the offset and size is controlled by client.
    if (srcMem == NULL) {
        ALOGE("Failed to map src buffer.");
        _hidl_cb(toStatus(BAD_VALUE), 0, NULL);
        return Void();
    }
    if (!validateRangeForSize(
            srcBuffer.offset, srcBuffer.size, (uint64_t)srcMem->getSize())) {
        ALOGE("Invalid src buffer range: offset %llu, size %llu, srcMem size %llu",
                srcBuffer.offset, srcBuffer.size, (uint64_t)srcMem->getSize());
        android_errorWriteLog(0x534e4554, "67962232");
        _hidl_cb(toStatus(BAD_VALUE), 0, NULL);
        return Void();
    }

    // use 64-bit here to catch bad subsample size that might be overflowing.
    uint64_t totalBytesInSubSamples = 0;
    for (size_t i = 0; i < subSamples.size(); i++) {
        totalBytesInSubSamples += (uint64_t)subSamples[i].numBytesOfClearData +
                subSamples[i].numBytesOfEncryptedData;
    }
    // Further validate if the specified srcOffset and requested total subsample size
    // is consistent with the source shared buffer size.
    if (!validateRangeForSize(srcOffset, totalBytesInSubSamples, srcBuffer.size)) {
        ALOGE("Invalid srcOffset and subsample size: "
                "srcOffset %llu, totalBytesInSubSamples %llu, srcBuffer size %llu",
                srcOffset, totalBytesInSubSamples, srcBuffer.size);
        android_errorWriteLog(0x534e4554, "67962232");
        _hidl_cb(toStatus(BAD_VALUE), 0, NULL);
        return Void();
    }

    void *srcPtr = (uint8_t *)(void *)srcMem->getPointer() + srcBuffer.offset;
    void *dstPtr = NULL;
    if (dstBuffer.type == BufferType::SHARED_MEMORY) {
        // When using shared memory, src buffer is also used as dst,
        // we don't map it again here.
        dstPtr = srcPtr;

        // In this case the dst and src would be the same buffer, need to validate
        // dstOffset against the buffer size too.
        if (!validateRangeForSize(dstOffset, totalBytesInSubSamples, srcBuffer.size)) {
            ALOGE("Invalid dstOffset and subsample size: "
                    "dstOffset %llu, totalBytesInSubSamples %llu, srcBuffer size %llu",
                    dstOffset, totalBytesInSubSamples, srcBuffer.size);
            android_errorWriteLog(0x534e4554, "67962232");
            _hidl_cb(toStatus(BAD_VALUE), 0, NULL);
            return Void();
        }
    } else {
        native_handle_t *handle = const_cast<native_handle_t *>(
                dstBuffer.secureMemory.getNativeHandle());
+6 −0
Original line number Diff line number Diff line
@@ -155,6 +155,12 @@ Return<Result> Contexthub::sendMessageToHub(uint32_t hubId,
        .message = static_cast<const uint8_t *>(msg.msg.data()),
    };

    // Use a dummy to prevent send_message with empty message from failing prematurely
    static uint8_t dummy;
    if (txMsg.message_len == 0 && txMsg.message == nullptr) {
        txMsg.message = &dummy;
    }

    ALOGI("Sending msg of type %" PRIu32 ", size %" PRIu32 " to app 0x%" PRIx64,
          txMsg.message_type,
          txMsg.message_len,
+1 −0
Original line number Diff line number Diff line
@@ -259,3 +259,4 @@ c8bc853546dd55584611def2a9fa1d99f657e3366c976d2f60fe6b8aa6d2cb87 android.hardwar

# ABI preserving changes to HALs during Android P
fb92e2b40f8e9d494e8fd3b4ac18499a3216342e7cff160714c3bbf3660b6e79 android.hardware.gnss@1.0::IGnssConfiguration
d4c10cb28318dba8efb22231a8c23e86ad8853f85775187c40b42a878a5ef4d5 android.hardware.automotive.vehicle@2.0::types
Loading