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

Commit 36a78590 authored by Michael Wright's avatar Michael Wright
Browse files

Add TICK constant to vibrator HAL.

Because we're extending an existing enum, we need to bump the minor
version of the HAL as well.

Bug: 38417655
Test: vts
Change-Id: I4d402efa8bf29517452cc3e259c2ddee146b15c7
parent abefabdb
Loading
Loading
Loading
Loading
+64 −0
Original line number Diff line number Diff line
// This file is autogenerated by hidl-gen. Do not edit manually.

filegroup {
    name: "android.hardware.vibrator@1.1_hal",
    srcs: [
        "types.hal",
        "IVibrator.hal",
    ],
}

genrule {
    name: "android.hardware.vibrator@1.1_genc++",
    tools: ["hidl-gen"],
    cmd: "$(location hidl-gen) -o $(genDir) -Lc++-sources -randroid.hardware:hardware/interfaces -randroid.hidl:system/libhidl/transport android.hardware.vibrator@1.1",
    srcs: [
        ":android.hardware.vibrator@1.1_hal",
    ],
    out: [
        "android/hardware/vibrator/1.1/types.cpp",
        "android/hardware/vibrator/1.1/VibratorAll.cpp",
    ],
}

genrule {
    name: "android.hardware.vibrator@1.1_genc++_headers",
    tools: ["hidl-gen"],
    cmd: "$(location hidl-gen) -o $(genDir) -Lc++-headers -randroid.hardware:hardware/interfaces -randroid.hidl:system/libhidl/transport android.hardware.vibrator@1.1",
    srcs: [
        ":android.hardware.vibrator@1.1_hal",
    ],
    out: [
        "android/hardware/vibrator/1.1/types.h",
        "android/hardware/vibrator/1.1/hwtypes.h",
        "android/hardware/vibrator/1.1/IVibrator.h",
        "android/hardware/vibrator/1.1/IHwVibrator.h",
        "android/hardware/vibrator/1.1/BnHwVibrator.h",
        "android/hardware/vibrator/1.1/BpHwVibrator.h",
        "android/hardware/vibrator/1.1/BsVibrator.h",
    ],
}

cc_library_shared {
    name: "android.hardware.vibrator@1.1",
    generated_sources: ["android.hardware.vibrator@1.1_genc++"],
    generated_headers: ["android.hardware.vibrator@1.1_genc++_headers"],
    export_generated_headers: ["android.hardware.vibrator@1.1_genc++_headers"],
    vendor_available: true,
    shared_libs: [
        "libhidlbase",
        "libhidltransport",
        "libhwbinder",
        "liblog",
        "libutils",
        "libcutils",
        "android.hardware.vibrator@1.0",
    ],
    export_shared_lib_headers: [
        "libhidlbase",
        "libhidltransport",
        "libhwbinder",
        "libutils",
        "android.hardware.vibrator@1.0",
    ],
}
+154 −0
Original line number Diff line number Diff line
# This file is autogenerated by hidl-gen. Do not edit manually.

LOCAL_PATH := $(call my-dir)

################################################################################

include $(CLEAR_VARS)
LOCAL_MODULE := android.hardware.vibrator-V1.1-java
LOCAL_MODULE_CLASS := JAVA_LIBRARIES

intermediates := $(call local-generated-sources-dir, COMMON)

HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX)

LOCAL_JAVA_LIBRARIES := \
    android.hardware.vibrator-V1.0-java \
    android.hidl.base-V1.0-java \


#
# Build types.hal (Effect_1_1)
#
GEN := $(intermediates)/android/hardware/vibrator/V1_1/Effect_1_1.java
$(GEN): $(HIDL)
$(GEN): PRIVATE_HIDL := $(HIDL)
$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
$(GEN): PRIVATE_CUSTOM_TOOL = \
        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
        -Ljava \
        -randroid.hardware:hardware/interfaces \
        -randroid.hidl:system/libhidl/transport \
        android.hardware.vibrator@1.1::types.Effect_1_1

$(GEN): $(LOCAL_PATH)/types.hal
	$(transform-generated-source)
LOCAL_GENERATED_SOURCES += $(GEN)

#
# Build IVibrator.hal
#
GEN := $(intermediates)/android/hardware/vibrator/V1_1/IVibrator.java
$(GEN): $(HIDL)
$(GEN): PRIVATE_HIDL := $(HIDL)
$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IVibrator.hal
$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/types.hal
$(GEN): $(LOCAL_PATH)/types.hal
$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
$(GEN): PRIVATE_CUSTOM_TOOL = \
        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
        -Ljava \
        -randroid.hardware:hardware/interfaces \
        -randroid.hidl:system/libhidl/transport \
        android.hardware.vibrator@1.1::IVibrator

$(GEN): $(LOCAL_PATH)/IVibrator.hal
	$(transform-generated-source)
LOCAL_GENERATED_SOURCES += $(GEN)
include $(BUILD_JAVA_LIBRARY)


################################################################################

include $(CLEAR_VARS)
LOCAL_MODULE := android.hardware.vibrator-V1.1-java-static
LOCAL_MODULE_CLASS := JAVA_LIBRARIES

intermediates := $(call local-generated-sources-dir, COMMON)

HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX)

LOCAL_STATIC_JAVA_LIBRARIES := \
    android.hardware.vibrator-V1.0-java-static \
    android.hidl.base-V1.0-java-static \


#
# Build types.hal (Effect_1_1)
#
GEN := $(intermediates)/android/hardware/vibrator/V1_1/Effect_1_1.java
$(GEN): $(HIDL)
$(GEN): PRIVATE_HIDL := $(HIDL)
$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
$(GEN): PRIVATE_CUSTOM_TOOL = \
        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
        -Ljava \
        -randroid.hardware:hardware/interfaces \
        -randroid.hidl:system/libhidl/transport \
        android.hardware.vibrator@1.1::types.Effect_1_1

$(GEN): $(LOCAL_PATH)/types.hal
	$(transform-generated-source)
LOCAL_GENERATED_SOURCES += $(GEN)

#
# Build IVibrator.hal
#
GEN := $(intermediates)/android/hardware/vibrator/V1_1/IVibrator.java
$(GEN): $(HIDL)
$(GEN): PRIVATE_HIDL := $(HIDL)
$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IVibrator.hal
$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/types.hal
$(GEN): $(LOCAL_PATH)/types.hal
$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
$(GEN): PRIVATE_CUSTOM_TOOL = \
        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
        -Ljava \
        -randroid.hardware:hardware/interfaces \
        -randroid.hidl:system/libhidl/transport \
        android.hardware.vibrator@1.1::IVibrator

$(GEN): $(LOCAL_PATH)/IVibrator.hal
	$(transform-generated-source)
LOCAL_GENERATED_SOURCES += $(GEN)
include $(BUILD_STATIC_JAVA_LIBRARY)


################################################################################

include $(CLEAR_VARS)
LOCAL_MODULE := android.hardware.vibrator-V1.1-java-constants
LOCAL_MODULE_CLASS := JAVA_LIBRARIES

intermediates := $(call local-generated-sources-dir, COMMON)

HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX)
#
GEN := $(intermediates)/android/hardware/vibrator/V1_1/Constants.java
$(GEN): $(HIDL)
$(GEN): $(LOCAL_PATH)/types.hal
$(GEN): $(LOCAL_PATH)/IVibrator.hal

$(GEN): PRIVATE_HIDL := $(HIDL)
$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
$(GEN): PRIVATE_CUSTOM_TOOL = \
        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
        -Ljava-constants \
        -randroid.hardware:hardware/interfaces \
        -randroid.hidl:system/libhidl/transport \
        android.hardware.vibrator@1.1

$(GEN):
	$(transform-generated-source)
LOCAL_GENERATED_SOURCES += $(GEN)
# Avoid dependency cycle of framework.jar -> this-library -> framework.jar
LOCAL_NO_STANDARD_LIBRARIES := true
LOCAL_JAVA_LIBRARIES := core-oj

include $(BUILD_STATIC_JAVA_LIBRARY)



include $(call all-makefiles-under,$(LOCAL_PATH))
+39 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2017 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package android.hardware.vibrator@1.1;

import @1.0::EffectStrength;
import @1.0::IVibrator;
import @1.0::Status;

interface IVibrator extends @1.0::IVibrator {
  /**
   * Fire off a predefined haptic event.
   *
   * @param event The type of haptic event to trigger.
   * @return status Whether the effect was successfully performed or not. Must
   *                return Status::UNSUPPORTED_OPERATION is the effect is not
   *                supported.
   * @return lengthMs The length of time the event is expected to take in
   *                  milliseconds. This doesn't need to be perfectly accurate,
   *                  but should be a reasonable approximation. Should be a
   *                  positive, non-zero value if the returned status is
   *                  Status::OK, and set to 0 otherwise.
   */
  perform_1_1(Effect_1_1 effect, EffectStrength strength)
          generates (Status status, uint32_t lengthMs);
};

vibrator/1.1/types.hal

0 → 100644
+29 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2017 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package android.hardware.vibrator@1.1;

import @1.0::Effect;

@export
enum Effect_1_1 : @1.0::Effect {
    /**
     * A tick effect.
     *
     * This effect should produce a soft, short sensation, like the tick of a clock.
     */
    TICK
};
+34 −0
Original line number Diff line number Diff line
//
// Copyright (C) 2017 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//

cc_test {
    name: "VtsHalVibratorV1_1TargetTest",
    defaults: ["hidl_defaults"],
    srcs: ["VtsHalVibratorV1_1TargetTest.cpp"],
    shared_libs: [
        "libbase",
        "libhidlbase",
        "liblog",
        "libutils",
        "android.hardware.vibrator@1.1",
    ],
    static_libs: ["VtsHalHidlTargetTestBase"],
    cflags: [
        "-O0",
        "-g",
    ],
}
Loading