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

Commit a7e50de0 authored by Lais Andrade's avatar Lais Andrade Committed by Android (Google) Code Review
Browse files

Merge "Introduce IVibratorManager.aidl"

parents f6e8bf96 80b1861b
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -534,6 +534,13 @@
            <instance>default</instance>
        </interface>
    </hal>
    <hal format="aidl" optional="true">
        <name>android.hardware.vibrator</name>
        <interface>
            <name>IVibratorManager</name>
            <instance>default</instance>
        </interface>
    </hal>
    <hal format="hidl" optional="true">
        <name>android.hardware.vr</name>
        <version>1.0</version>
+2 −2
Original line number Diff line number Diff line
@@ -19,7 +19,7 @@ cc_binary {
    shared_libs: [
        "libbase",
        "libbinder_ndk",
        "android.hardware.vibrator-ndk_platform",
        "android.hardware.tests.extension.vibrator-ndk_platform",
        "android.hardware.vibrator-unstable-ndk_platform",
        "android.hardware.tests.extension.vibrator-unstable-ndk_platform",
    ],
}
+3 −0
Original line number Diff line number Diff line
@@ -2,6 +2,9 @@
  "presubmit": [
    {
      "name": "VtsHalVibratorTargetTest"
    },
    {
      "name": "VtsHalVibratorManagerTargetTest"
    }
  ]
}
+35 −0
Original line number Diff line number Diff line
///////////////////////////////////////////////////////////////////////////////
// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE.                          //
///////////////////////////////////////////////////////////////////////////////

// This file is a snapshot of an AIDL interface (or parcelable). Do not try to
// edit this file. It looks like you are doing that because you have modified
// an AIDL interface in a backward-incompatible way, e.g., deleting a function
// from an interface or a field from a parcelable and it broke the build. That
// breakage is intended.
//
// You must not make a backward incompatible changes to the AIDL files built
// with the aidl_interface module type with versions property set. The module
// type is used to build AIDL files in a way that they can be used across
// independently updatable components of the system. If a device is shipped
// with such a backward incompatible change, it has a high risk of breaking
// later when a module using the interface is updated, e.g., Mainline modules.

package android.hardware.vibrator;
@VintfStability
interface IVibratorManager {
  int getCapabilities();
  int[] getVibratorIds();
  android.hardware.vibrator.IVibrator getVibrator(in int vibratorId);
  void prepareSynced(in int[] vibratorIds);
  void triggerSynced(in android.hardware.vibrator.IVibratorCallback callback);
  void cancelSynced();
  const int CAP_SYNC = 1;
  const int CAP_PREPARE_ON = 2;
  const int CAP_PREPARE_PERFORM = 4;
  const int CAP_PREPARE_COMPOSE = 8;
  const int CAP_MIXED_TRIGGER_ON = 16;
  const int CAP_MIXED_TRIGGER_PERFORM = 32;
  const int CAP_MIXED_TRIGGER_COMPOSE = 64;
  const int CAP_TRIGGER_CALLBACK = 128;
}
+102 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2020 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;

import android.hardware.vibrator.IVibrator;
import android.hardware.vibrator.IVibratorCallback;

@VintfStability
interface IVibratorManager {
    /**
     * Whether prepare/trigger synced are supported.
     */
    const int CAP_SYNC = 1 << 0;
    /**
     * Whether IVibrator 'on' can be used with 'prepareSynced' function.
     */
    const int CAP_PREPARE_ON = 1 << 1;
    /**
     * Whether IVibrator 'perform' can be used with 'prepareSynced' function.
     */
    const int CAP_PREPARE_PERFORM = 1 << 2;
    /**
     * Whether IVibrator 'compose' can be used with 'prepareSynced' function.
     */
    const int CAP_PREPARE_COMPOSE = 1 << 3;
    /**
     * Whether IVibrator 'on' can be triggered with other functions in sync with 'triggerSynced'.
     */
    const int CAP_MIXED_TRIGGER_ON = 1 << 4;
    /**
     * Whether IVibrator 'perform' can be triggered with other functions in sync with 'triggerSynced'.
     */
    const int CAP_MIXED_TRIGGER_PERFORM = 1 << 5;
    /**
     * Whether IVibrator 'compose' can be triggered with other functions in sync with 'triggerSynced'.
     */
    const int CAP_MIXED_TRIGGER_COMPOSE = 1 << 6;
    /**
     * Whether on w/ IVibratorCallback can be used w/ 'trigerSynced' function.
     */
    const int CAP_TRIGGER_CALLBACK = 1 << 7;

    /**
     * Determine capabilities of the vibrator manager HAL (CAP_* mask)
     */
    int getCapabilities();

    /**
     * List the id of available vibrators. This result should be static and not change.
     */
    int[] getVibratorIds();

    /**
     * Return an available vibrator identified with given id.
     */
    IVibrator getVibrator(in int vibratorId);

    /**
     * Start preparation for a synced vibration
     *
     * This function must only be called after the previous synced vibration was triggered or
     * canceled (through cancelSynced()).
     *
     * Doing this operation while any of the specified vibrators is already on is undefined behavior.
     * Clients should explicitly call off in each vibrator.
     *
     * @param vibratorIds ids of the vibrators to play vibrations in sync.
     */
    void prepareSynced(in int[] vibratorIds);

    /**
     * Trigger a prepared synced vibration
     *
     * Trigger a previously-started preparation for synced vibration, if any.
     * A callback is only expected to be supported when getCapabilities CAP_TRIGGER_CALLBACK
     * is specified.
     *
     * @param callback A callback used to inform Frameworks of state change, if supported.
     */
    void triggerSynced(in IVibratorCallback callback);

    /**
     * Cancel preparation of synced vibration
     *
     * Cancel a previously-started preparation for synced vibration, if any.
     */
    void cancelSynced();
}
Loading