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

Commit bb90e848 authored by The Android Open Source Project's avatar The Android Open Source Project Committed by Xin Li
Browse files

Merge ab/7633965

Bug: 169893837
Merged-In: I07cf1825c23e2467852d5cd93436eb9dee23b408
Change-Id: Ie9a09f85d7b24b031cb6869429a33ff1eeb84687
parents 9faa583b b2239ad4
Loading
Loading
Loading
Loading
+10 −7
Original line number Diff line number Diff line
@@ -332,18 +332,21 @@ TEST_P(AudioPrimaryHidlTest, setMode) {
#endif

    for (int mode : {-2, -1, maxMode + 1}) {
        ASSERT_RESULT(Result::INVALID_ARGUMENTS, getDevice()->setMode(AudioMode(mode)))
        EXPECT_RESULT(Result::INVALID_ARGUMENTS, getDevice()->setMode(AudioMode(mode)))
                << "mode=" << mode;
    }
    // Test valid values
    for (AudioMode mode : {AudioMode::IN_CALL, AudioMode::IN_COMMUNICATION, AudioMode::RINGTONE,
                           AudioMode::NORMAL /* Make sure to leave the test in normal mode */}) {
        ASSERT_OK(getDevice()->setMode(mode)) << "mode=" << toString(mode);
    }

    // AudioMode::CALL_SCREEN as support is optional
#if MAJOR_VERSION >= 6
    ASSERT_RESULT(okOrNotSupportedOrInvalidArgs, getDevice()->setMode(AudioMode::CALL_SCREEN));
    EXPECT_RESULT(okOrNotSupportedOrInvalidArgs, getDevice()->setMode(AudioMode::CALL_SCREEN));
#endif
    // Test valid values
    for (AudioMode mode : {AudioMode::IN_CALL, AudioMode::IN_COMMUNICATION, AudioMode::RINGTONE,
                           AudioMode::NORMAL}) {
        EXPECT_OK(getDevice()->setMode(mode)) << "mode=" << toString(mode);
    }
    // Make sure to leave the test in normal mode
    getDevice()->setMode(AudioMode::NORMAL);
}

TEST_P(AudioPrimaryHidlTest, setBtHfpSampleRate) {
+70 −45
Original line number Diff line number Diff line
@@ -2269,12 +2269,41 @@ TEST_P(EvsHidlTest, CameraStreamExternalBuffering) {

    // Acquire the graphics buffer allocator
    android::GraphicBufferAllocator& alloc(android::GraphicBufferAllocator::get());
    const auto usage = GRALLOC_USAGE_HW_TEXTURE |
                       GRALLOC_USAGE_SW_READ_RARELY |
                       GRALLOC_USAGE_SW_WRITE_OFTEN;
    const auto usage =
            GRALLOC_USAGE_HW_TEXTURE | GRALLOC_USAGE_SW_READ_RARELY | GRALLOC_USAGE_SW_WRITE_OFTEN;
    const auto format = HAL_PIXEL_FORMAT_RGBA_8888;
    const auto width = 640;
    const auto height = 360;
    uint32_t width = 640;
    uint32_t height = 360;
    camera_metadata_entry_t streamCfgs;

    // Test each reported camera
    for (auto&& cam : cameraInfo) {
        bool foundCfg = false;
        if (!find_camera_metadata_entry(reinterpret_cast<camera_metadata_t*>(cam.metadata.data()),
                                        ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS,
                                        &streamCfgs)) {
            // Stream configurations are found in metadata
            RawStreamConfig* ptr = reinterpret_cast<RawStreamConfig*>(streamCfgs.data.i32);

            LOG(DEBUG) << __LINE__ << " start searching " << streamCfgs.count;
            for (unsigned idx = 0; idx < streamCfgs.count; idx++) {
                LOG(DEBUG) << "ptr->direction= " << ptr->direction
                           << " ptr->format= " << ptr->format;
                if (ptr->direction == ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_OUTPUT &&
                    ptr->format == HAL_PIXEL_FORMAT_RGBA_8888) {
                    width = ptr->width;
                    height = ptr->height;
                    foundCfg = true;
                    // Always use the 1st available configuration
                    break;
                }
                ++ptr;
            }
        }

        if (!foundCfg) {
            LOG(INFO) << "No configuration found. Use default stream configurations.";
        }

        // Allocate buffers to use
        hidl_vec<BufferDesc> buffers;
@@ -2282,17 +2311,16 @@ TEST_P(EvsHidlTest, CameraStreamExternalBuffering) {
        for (auto i = 0; i < kBuffersToHold; ++i) {
            unsigned pixelsPerLine;
            buffer_handle_t memHandle = nullptr;
        android::status_t result = alloc.allocate(width,
                                                  height,
                                                  format,
                                                  1,
                                                  usage,
                                                  &memHandle,
                                                  &pixelsPerLine,
                                                  0,
                                                  "EvsApp");
            android::status_t result =
                    alloc.allocate(width, height, format, 1, usage, &memHandle, &pixelsPerLine, 0,
                                   "CameraStreamExternalBufferingTest");
            if (result != android::NO_ERROR) {
                LOG(ERROR) << __FUNCTION__ << " failed to allocate memory.";
                // Release previous allocated buffers
                for (auto j = 0; j < i; j++) {
                    alloc.free(buffers[i].buffer.nativeHandle);
                }
                return;
            } else {
                BufferDesc buf;
                AHardwareBuffer_Desc* pDesc =
@@ -2309,8 +2337,6 @@ TEST_P(EvsHidlTest, CameraStreamExternalBuffering) {
            }
        }

    // Test each reported camera
    for (auto&& cam: cameraInfo) {
        bool isLogicalCam = false;
        getPhysicalCameraIds(cam.v1.cameraId, isLogicalCam);

@@ -2374,14 +2400,13 @@ TEST_P(EvsHidlTest, CameraStreamExternalBuffering) {
        // Explicitly release the camera
        pEnumerator->closeCamera(pCam);
        activeCameras.clear();
    }

        // Release buffers
        for (auto& b : buffers) {
            alloc.free(b.buffer.nativeHandle);
        }
        buffers.resize(0);
    }
}


/*
+16 −11
Original line number Diff line number Diff line
@@ -124,7 +124,7 @@ const ConfigDeclaration kVehicleProperties[]{
                         .access = VehiclePropertyAccess::READ,
                         .changeMode = VehiclePropertyChangeMode::STATIC,
                 },
         .initialValue = {.floatValues = {1776, 4950, 2008, 2140, 2984, 1665, 1667, 11800}}},
         .initialValue = {.int32Values = {1776, 4950, 2008, 2140, 2984, 1665, 1667, 11800}}},
        {.config =
                 {
                         .prop = toInt(VehicleProperty::PERF_VEHICLE_SPEED),
@@ -174,7 +174,7 @@ const ConfigDeclaration kVehicleProperties[]{
                         .prop = toInt(VehicleProperty::PERF_ODOMETER),
                         .access = VehiclePropertyAccess::READ,
                         .changeMode = VehiclePropertyChangeMode::CONTINUOUS,
                         .minSampleRate = 0.0f,
                         .minSampleRate = 1.0f,
                         .maxSampleRate = 10.0f,
                 },
         .initialValue = {.floatValues = {0.0f}}},
@@ -183,7 +183,7 @@ const ConfigDeclaration kVehicleProperties[]{
                         .prop = toInt(VehicleProperty::PERF_STEERING_ANGLE),
                         .access = VehiclePropertyAccess::READ,
                         .changeMode = VehiclePropertyChangeMode::CONTINUOUS,
                         .minSampleRate = 0.0f,
                         .minSampleRate = 1.0f,
                         .maxSampleRate = 10.0f,
                 },
         .initialValue = {.floatValues = {0.0f}}},
@@ -192,7 +192,7 @@ const ConfigDeclaration kVehicleProperties[]{
                         .prop = toInt(VehicleProperty::PERF_REAR_STEERING_ANGLE),
                         .access = VehiclePropertyAccess::READ,
                         .changeMode = VehiclePropertyChangeMode::CONTINUOUS,
                         .minSampleRate = 0.0f,
                         .minSampleRate = 1.0f,
                         .maxSampleRate = 10.0f,
                 },
         .initialValue = {.floatValues = {0.0f}}},
@@ -213,7 +213,7 @@ const ConfigDeclaration kVehicleProperties[]{
                         .prop = toInt(VehicleProperty::FUEL_LEVEL),
                         .access = VehiclePropertyAccess::READ,
                         .changeMode = VehiclePropertyChangeMode::CONTINUOUS,
                         .minSampleRate = 0.0f,
                         .minSampleRate = 1.0f,
                         .maxSampleRate = 100.0f,
                 },
         .initialValue = {.floatValues = {15000.0f}}},
@@ -231,7 +231,7 @@ const ConfigDeclaration kVehicleProperties[]{
                         .prop = toInt(VehicleProperty::EV_BATTERY_LEVEL),
                         .access = VehiclePropertyAccess::READ,
                         .changeMode = VehiclePropertyChangeMode::CONTINUOUS,
                         .minSampleRate = 0.0f,
                         .minSampleRate = 1.0f,
                         .maxSampleRate = 100.0f,
                 },
         .initialValue = {.floatValues = {150000.0f}}},
@@ -328,6 +328,11 @@ const ConfigDeclaration kVehicleProperties[]{
                         .prop = toInt(VehicleProperty::CURRENT_GEAR),
                         .access = VehiclePropertyAccess::READ,
                         .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
                         .configArray = {(int)VehicleGear::GEAR_PARK,
                                         (int)VehicleGear::GEAR_NEUTRAL,
                                         (int)VehicleGear::GEAR_REVERSE, (int)VehicleGear::GEAR_1,
                                         (int)VehicleGear::GEAR_2, (int)VehicleGear::GEAR_3,
                                         (int)VehicleGear::GEAR_4, (int)VehicleGear::GEAR_5},
                 },
         .initialValue = {.int32Values = {toInt(VehicleGear::GEAR_PARK)}}},

@@ -1072,8 +1077,8 @@ const ConfigDeclaration kVehicleProperties[]{
                                .access = VehiclePropertyAccess::READ,
                                .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
                        },
                .initialValue = {.int32Values = {0 /* Off */, -1, -1, -1, -1 /* Bounds */,
                                                 -1, -1, -1, -1 /* Insets */}},
                .initialValue = {.int32Values = {0 /* Off */, -1, -1, -1, -1 /* Bounds */, -1, -1,
                                                 -1, -1 /* Insets */}},
        },
        {
                .config =
@@ -1126,9 +1131,9 @@ const ConfigDeclaration kVehicleProperties[]{
                                .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
                                .configArray = {0, 0, 0, 11, 0, 0, 0, 0, 16},
                        },
                .initialValue = {.int32Values = {0 /* Off */, -1, -1, -1, -1 /* Bounds */,
                                                 -1, -1, -1, -1 /* Insets */,
                                                 0 /* ClusterHome */, -1 /* ClusterNone */}},
                .initialValue = {.int32Values = {0 /* Off */, -1, -1, -1, -1 /* Bounds */, -1, -1,
                                                 -1, -1 /* Insets */, 0 /* ClusterHome */,
                                                 -1 /* ClusterNone */}},
        },
        {
                .config =
+1 −1
Original line number Diff line number Diff line
945de3635b7f5a09244820eef56035c92fdbd324
3b10f5094c5af9fe551093597fab007d1e148256
+1 −1
Original line number Diff line number Diff line
@@ -37,7 +37,7 @@ interface ISession {
  void generateChallenge();
  void revokeChallenge(in long challenge);
  android.hardware.biometrics.face.EnrollmentStageConfig[] getEnrollmentConfig(in android.hardware.biometrics.face.EnrollmentType enrollmentType);
  android.hardware.biometrics.common.ICancellationSignal enroll(in android.hardware.keymaster.HardwareAuthToken hat, in android.hardware.biometrics.face.EnrollmentType type, in android.hardware.biometrics.face.Feature[] features, in android.hardware.common.NativeHandle previewSurface);
  android.hardware.biometrics.common.ICancellationSignal enroll(in android.hardware.keymaster.HardwareAuthToken hat, in android.hardware.biometrics.face.EnrollmentType type, in android.hardware.biometrics.face.Feature[] features, in @nullable android.hardware.common.NativeHandle previewSurface);
  android.hardware.biometrics.common.ICancellationSignal authenticate(in long operationId);
  android.hardware.biometrics.common.ICancellationSignal detectInteraction();
  void enumerateEnrollments();
Loading