diff options
author | Xin Li <delphij@google.com> | 2024-03-06 09:29:58 -0800 |
---|---|---|
committer | Xin Li <delphij@google.com> | 2024-03-06 09:29:58 -0800 |
commit | ed81dc3397156f4ddb062c28c23d2cb2078ec534 (patch) | |
tree | 3e85a121894fafd6d14e28709f4c23be964816a7 | |
parent | c4bd68e183b89fa925b9f209d972161d8d2a6589 (diff) | |
parent | 32b730ab4ef4b4aa5fd6895bb49d6e5e344d9202 (diff) | |
download | interfaces-ed81dc3397156f4ddb062c28c23d2cb2078ec534.tar.gz |
Merge Android 14 QPR2 to AOSP main
Bug: 319669529
Merged-In: I9803472518a67ffb9b858da3736eb50d452f8b65
Change-Id: I06fa2a2106f9742830e94717568404d9a13379a3
25 files changed, 662 insertions, 10 deletions
diff --git a/automotive/powerpolicy/OWNERS b/automotive/powerpolicy/OWNERS deleted file mode 100644 index a2f1610..0000000 --- a/automotive/powerpolicy/OWNERS +++ /dev/null @@ -1,2 +0,0 @@ -keunyoung@google.com -ericjeong@google.com diff --git a/automotive/powerpolicy/aidl/Android.bp b/automotive/powerpolicy/aidl/Android.bp index 6fbe047..37e94df 100644 --- a/automotive/powerpolicy/aidl/Android.bp +++ b/automotive/powerpolicy/aidl/Android.bp @@ -49,7 +49,7 @@ aidl_interface { }, ], - frozen: true, + frozen: false, } aidl_interface { @@ -77,5 +77,4 @@ aidl_interface { imports: [], }, ], - } diff --git a/automotive/powerpolicy/aidl/aidl_api/android.frameworks.automotive.powerpolicy.internal/current/android/frameworks/automotive/powerpolicy/internal/ICarPowerPolicySystemNotification.aidl b/automotive/powerpolicy/aidl/aidl_api/android.frameworks.automotive.powerpolicy.internal/current/android/frameworks/automotive/powerpolicy/internal/ICarPowerPolicySystemNotification.aidl index 9bc054a..8fdde40 100644 --- a/automotive/powerpolicy/aidl/aidl_api/android.frameworks.automotive.powerpolicy.internal/current/android/frameworks/automotive/powerpolicy/internal/ICarPowerPolicySystemNotification.aidl +++ b/automotive/powerpolicy/aidl/aidl_api/android.frameworks.automotive.powerpolicy.internal/current/android/frameworks/automotive/powerpolicy/internal/ICarPowerPolicySystemNotification.aidl @@ -32,7 +32,10 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.frameworks.automotive.powerpolicy.internal; -/* @hide */ +/** + * @hide + * @deprecated {@link android.automotive.powerpolicy.internal.ICarPowerPolicyDelegate} replaces this interface. + */ @VintfStability interface ICarPowerPolicySystemNotification { android.frameworks.automotive.powerpolicy.internal.PolicyState notifyCarServiceReady(); diff --git a/automotive/powerpolicy/aidl/aidl_api/android.frameworks.automotive.powerpolicy.internal/current/android/frameworks/automotive/powerpolicy/internal/PolicyState.aidl b/automotive/powerpolicy/aidl/aidl_api/android.frameworks.automotive.powerpolicy.internal/current/android/frameworks/automotive/powerpolicy/internal/PolicyState.aidl index eb929e7..7e5e0d2 100644 --- a/automotive/powerpolicy/aidl/aidl_api/android.frameworks.automotive.powerpolicy.internal/current/android/frameworks/automotive/powerpolicy/internal/PolicyState.aidl +++ b/automotive/powerpolicy/aidl/aidl_api/android.frameworks.automotive.powerpolicy.internal/current/android/frameworks/automotive/powerpolicy/internal/PolicyState.aidl @@ -32,6 +32,9 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.frameworks.automotive.powerpolicy.internal; +/** + * @deprecated This is not used any more. + */ @VintfStability parcelable PolicyState { @utf8InCpp String policyId; diff --git a/automotive/powerpolicy/aidl/aidl_api/android.frameworks.automotive.powerpolicy/current/android/frameworks/automotive/powerpolicy/ICarPowerPolicyServer.aidl b/automotive/powerpolicy/aidl/aidl_api/android.frameworks.automotive.powerpolicy/current/android/frameworks/automotive/powerpolicy/ICarPowerPolicyServer.aidl index 6372fa3..3a87ee8 100644 --- a/automotive/powerpolicy/aidl/aidl_api/android.frameworks.automotive.powerpolicy/current/android/frameworks/automotive/powerpolicy/ICarPowerPolicyServer.aidl +++ b/automotive/powerpolicy/aidl/aidl_api/android.frameworks.automotive.powerpolicy/current/android/frameworks/automotive/powerpolicy/ICarPowerPolicyServer.aidl @@ -38,4 +38,6 @@ interface ICarPowerPolicyServer { boolean getPowerComponentState(in android.frameworks.automotive.powerpolicy.PowerComponent componentId); void registerPowerPolicyChangeCallback(in android.frameworks.automotive.powerpolicy.ICarPowerPolicyChangeCallback callback, in android.frameworks.automotive.powerpolicy.CarPowerPolicyFilter filter); void unregisterPowerPolicyChangeCallback(in android.frameworks.automotive.powerpolicy.ICarPowerPolicyChangeCallback callback); + void applyPowerPolicy(in @utf8InCpp String policyId); + void setPowerPolicyGroup(in @utf8InCpp String policyGroupId); } diff --git a/automotive/powerpolicy/aidl/android/frameworks/automotive/powerpolicy/ICarPowerPolicyServer.aidl b/automotive/powerpolicy/aidl/android/frameworks/automotive/powerpolicy/ICarPowerPolicyServer.aidl index 27b18f7..b6b2aac 100644 --- a/automotive/powerpolicy/aidl/android/frameworks/automotive/powerpolicy/ICarPowerPolicyServer.aidl +++ b/automotive/powerpolicy/aidl/android/frameworks/automotive/powerpolicy/ICarPowerPolicyServer.aidl @@ -65,4 +65,26 @@ interface ICarPowerPolicyServer { * @throws IllegalArgumentException if the callback is not registered. */ void unregisterPowerPolicyChangeCallback(in ICarPowerPolicyChangeCallback callback); + + /** + * Applies the power policy. + * + * <p>{@code policyId} should be one of power policy IDs defined in + * {@code /vendor/etc/automotive/power_policy.xml} or predefined system power policies. + * + * @param policyId ID of power policy. + * @throws IllegalArgumentException if {@code policyId} is invalid. + */ + void applyPowerPolicy(in @utf8InCpp String policyId); + + /** + * Sets the current power policy group. + * + * <p>{@code policyGroupId} should be one of power policy group IDs defined in + * {@code /vendor/etc/automotive/power_policy.xml}. + * + * @param policyGroupId ID of power policy group. + * @throws IllegalArgumentException if {@code policyGroupId} is invalid. + */ + void setPowerPolicyGroup(in @utf8InCpp String policyGroupId); } diff --git a/automotive/powerpolicy/aidl/android/frameworks/automotive/powerpolicy/internal/ICarPowerPolicySystemNotification.aidl b/automotive/powerpolicy/aidl/android/frameworks/automotive/powerpolicy/internal/ICarPowerPolicySystemNotification.aidl index fc99be9..1900690 100644 --- a/automotive/powerpolicy/aidl/android/frameworks/automotive/powerpolicy/internal/ICarPowerPolicySystemNotification.aidl +++ b/automotive/powerpolicy/aidl/android/frameworks/automotive/powerpolicy/internal/ICarPowerPolicySystemNotification.aidl @@ -24,6 +24,9 @@ import android.frameworks.automotive.powerpolicy.internal.PolicyState; * subscribers. When subscribing to policy changes, a filter can be specified so that the registered * callbacks can listen only to a specific power component's change. * + * @deprecated {@link android.automotive.powerpolicy.internal.ICarPowerPolicyDelegate} replaces + * this interface. + * * @hide */ @VintfStability diff --git a/automotive/powerpolicy/aidl/android/frameworks/automotive/powerpolicy/internal/PolicyState.aidl b/automotive/powerpolicy/aidl/android/frameworks/automotive/powerpolicy/internal/PolicyState.aidl index 3db1efd..4d489af 100644 --- a/automotive/powerpolicy/aidl/android/frameworks/automotive/powerpolicy/internal/PolicyState.aidl +++ b/automotive/powerpolicy/aidl/android/frameworks/automotive/powerpolicy/internal/PolicyState.aidl @@ -18,6 +18,8 @@ package android.frameworks.automotive.powerpolicy.internal; /** * Structure to store the current policy state. + * + * @deprecated This is not used any more. */ @VintfStability parcelable PolicyState { diff --git a/cameraservice/device/aidl/Android.bp b/cameraservice/device/aidl/Android.bp index f22ad83..4691b8f 100644 --- a/cameraservice/device/aidl/Android.bp +++ b/cameraservice/device/aidl/Android.bp @@ -12,21 +12,30 @@ aidl_interface { "android.hardware.common.fmq-V1", "android.hardware.common-V2", ], - frozen: true, + include_dirs: [ + "frameworks/native/aidl/gui", + ], + frozen: false, backend: { cpp: { enabled: false, }, + rust: { + enabled: false, + }, java: { enabled: false, }, ndk: { + additional_shared_libraries: [ + "libnativewindow", + ], vndk: { enabled: true, }, }, }, - vndk_use_version: "1", + vndk_use_version: "2", versions_with_info: [ { version: "1", diff --git a/cameraservice/device/aidl/aidl_api/android.frameworks.cameraservice.device/current/android/frameworks/cameraservice/device/OutputConfiguration.aidl b/cameraservice/device/aidl/aidl_api/android.frameworks.cameraservice.device/current/android/frameworks/cameraservice/device/OutputConfiguration.aidl index 8943815..9546948 100644 --- a/cameraservice/device/aidl/aidl_api/android.frameworks.cameraservice.device/current/android/frameworks/cameraservice/device/OutputConfiguration.aidl +++ b/cameraservice/device/aidl/aidl_api/android.frameworks.cameraservice.device/current/android/frameworks/cameraservice/device/OutputConfiguration.aidl @@ -34,6 +34,9 @@ package android.frameworks.cameraservice.device; @VintfStability parcelable OutputConfiguration { + /** + * @deprecated Use surfaces instead. + */ android.hardware.common.NativeHandle[] windowHandles; android.frameworks.cameraservice.device.OutputConfiguration.Rotation rotation; int windowGroupId; @@ -41,6 +44,7 @@ parcelable OutputConfiguration { int width; int height; boolean isDeferred; + android.view.Surface[] surfaces = {}; @Backing(type="int") @VintfStability enum Rotation { R0 = 0, diff --git a/cameraservice/device/aidl/android/frameworks/cameraservice/device/OutputConfiguration.aidl b/cameraservice/device/aidl/android/frameworks/cameraservice/device/OutputConfiguration.aidl index 449b80d..1057f78 100644 --- a/cameraservice/device/aidl/android/frameworks/cameraservice/device/OutputConfiguration.aidl +++ b/cameraservice/device/aidl/android/frameworks/cameraservice/device/OutputConfiguration.aidl @@ -17,6 +17,7 @@ package android.frameworks.cameraservice.device; import android.hardware.common.NativeHandle; +import android.view.Surface; /** * This describes camera output. It has configurations specific to a @@ -54,6 +55,8 @@ parcelable OutputConfiguration { * modify their input data. If such cases exist, client must have additional * mechanisms to synchronize read and write accesses between consumers. * [1]: Ref : frameworks/av/camera/ndk/include/camera/NdkCameraDevice.h + * + * @deprecated Use surfaces instead. */ NativeHandle[] windowHandles; /** @@ -97,4 +100,20 @@ parcelable OutputConfiguration { * Ref:frameworks/base/core/java/android/hardware/camera2/params/OutputConfiguration.java */ boolean isDeferred; + /** + * These must be Surfaces owned by AImageReader, acquired using AImageReader_getWindow()[1]. + * + * When this vector has more than one entry, surface sharing is enabled. Clients may take + * advantage of this in advanced use cases when they would require create more streams + * than the limits the camera device imposes [2]. In this case, more than one window + * must be attached to an OutputConfiguration so that they map to one camera stream. + * The outputs will share memory buffers whenever possible. Due to buffer + * sharing, client should be careful while adding Surface outputs that + * modify their input data. If such cases exist, client must have additional + * mechanisms to synchronize read and write accesses between consumers. + * + * [1]: Ref: frameworks/av/media/ndk/include/media/NdkImageReader.h + * [2]: Ref: frameworks/av/camera/ndk/include/camera/NdkCameraDevice.h + */ + Surface[] surfaces = {}; } diff --git a/cameraservice/service/aidl/Android.bp b/cameraservice/service/aidl/Android.bp index 7b9cb3c..501cc11 100644 --- a/cameraservice/service/aidl/Android.bp +++ b/cameraservice/service/aidl/Android.bp @@ -9,23 +9,29 @@ aidl_interface { stability: "vintf", imports: [ "android.frameworks.cameraservice.common-V1", - "android.frameworks.cameraservice.device-V1", + "android.frameworks.cameraservice.device-V2", ], - frozen: true, + frozen: false, backend: { cpp: { enabled: false, }, + rust: { + enabled: false, + }, java: { enabled: false, }, ndk: { + additional_shared_libraries: [ + "libnativewindow", + ], vndk: { enabled: true, }, }, }, - vndk_use_version: "1", + vndk_use_version: "2", versions_with_info: [ { version: "1", diff --git a/vibrator/OWNERS b/vibrator/OWNERS new file mode 100644 index 0000000..c4de58a --- /dev/null +++ b/vibrator/OWNERS @@ -0,0 +1,2 @@ +# Bug component: 345036 +include platform/frameworks/base:/services/core/java/com/android/server/vibrator/OWNERS diff --git a/vibrator/aidl/Android.bp b/vibrator/aidl/Android.bp new file mode 100644 index 0000000..6df996f --- /dev/null +++ b/vibrator/aidl/Android.bp @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2023 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 { + default_applicable_licenses: ["Android-Apache-2.0"], +} + +aidl_interface { + name: "android.frameworks.vibrator", + srcs: ["android/frameworks/vibrator/*.aidl"], + vendor_available: true, + host_supported: true, + stability: "vintf", + backend: { + java: { + platform_apis: true, + }, + ndk: { + enabled: true, + }, + cpp: { + enabled: false, + }, + }, + frozen: false, + +} diff --git a/vibrator/aidl/TEST_MAPPING b/vibrator/aidl/TEST_MAPPING new file mode 100644 index 0000000..f7f7b11 --- /dev/null +++ b/vibrator/aidl/TEST_MAPPING @@ -0,0 +1,7 @@ +{ + "postsubmit": [ + { + "name": "VtsHalVibratorControlServiceTargetTest" + } + ] +} diff --git a/vibrator/aidl/aidl_api/android.frameworks.vibrator/current/android/frameworks/vibrator/IVibratorControlService.aidl b/vibrator/aidl/aidl_api/android.frameworks.vibrator/current/android/frameworks/vibrator/IVibratorControlService.aidl new file mode 100644 index 0000000..5f5fbcb --- /dev/null +++ b/vibrator/aidl/aidl_api/android.frameworks.vibrator/current/android/frameworks/vibrator/IVibratorControlService.aidl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2023 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // +/////////////////////////////////////////////////////////////////////////////// + +// This file is a snapshot of an AIDL file. Do not edit it manually. There are +// two cases: +// 1). this is a frozen version file - do not edit this in any case. +// 2). this is a 'current' file. If you make a backwards compatible change to +// the interface (from the latest frozen version), the build system will +// prompt you to update this file with `m <name>-update-api`. +// +// You must not make a backward incompatible change to any AIDL file 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.frameworks.vibrator; +/* @hide */ +@VintfStability +interface IVibratorControlService { + oneway void registerVibratorController(in android.frameworks.vibrator.IVibratorController controller); + oneway void unregisterVibratorController(in android.frameworks.vibrator.IVibratorController controller); + oneway void setVibrationParams(in android.frameworks.vibrator.VibrationParam[] params, in android.frameworks.vibrator.IVibratorController token); + oneway void clearVibrationParams(in int typesMask, in android.frameworks.vibrator.IVibratorController token); + oneway void onRequestVibrationParamsComplete(in IBinder requestToken, in android.frameworks.vibrator.VibrationParam[] result); +} diff --git a/vibrator/aidl/aidl_api/android.frameworks.vibrator/current/android/frameworks/vibrator/IVibratorController.aidl b/vibrator/aidl/aidl_api/android.frameworks.vibrator/current/android/frameworks/vibrator/IVibratorController.aidl new file mode 100644 index 0000000..cd9e6cd --- /dev/null +++ b/vibrator/aidl/aidl_api/android.frameworks.vibrator/current/android/frameworks/vibrator/IVibratorController.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2023 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // +/////////////////////////////////////////////////////////////////////////////// + +// This file is a snapshot of an AIDL file. Do not edit it manually. There are +// two cases: +// 1). this is a frozen version file - do not edit this in any case. +// 2). this is a 'current' file. If you make a backwards compatible change to +// the interface (from the latest frozen version), the build system will +// prompt you to update this file with `m <name>-update-api`. +// +// You must not make a backward incompatible change to any AIDL file 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.frameworks.vibrator; +/* @hide */ +@VintfStability +interface IVibratorController { + oneway void requestVibrationParams(in int typesMask, in long deadlineElapsedRealtimeMillis, in IBinder requestToken); +} diff --git a/vibrator/aidl/aidl_api/android.frameworks.vibrator/current/android/frameworks/vibrator/ScaleParam.aidl b/vibrator/aidl/aidl_api/android.frameworks.vibrator/current/android/frameworks/vibrator/ScaleParam.aidl new file mode 100644 index 0000000..0e3bcdf --- /dev/null +++ b/vibrator/aidl/aidl_api/android.frameworks.vibrator/current/android/frameworks/vibrator/ScaleParam.aidl @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2023 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // +/////////////////////////////////////////////////////////////////////////////// + +// This file is a snapshot of an AIDL file. Do not edit it manually. There are +// two cases: +// 1). this is a frozen version file - do not edit this in any case. +// 2). this is a 'current' file. If you make a backwards compatible change to +// the interface (from the latest frozen version), the build system will +// prompt you to update this file with `m <name>-update-api`. +// +// You must not make a backward incompatible change to any AIDL file 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.frameworks.vibrator; +@VintfStability +parcelable ScaleParam { + int typesMask; + float scale; + const int TYPE_ALARM = (1 << 0) /* 1 */; + const int TYPE_NOTIFICATION = (1 << 1) /* 2 */; + const int TYPE_RINGTONE = (1 << 2) /* 4 */; + const int TYPE_INTERACTIVE = (1 << 3) /* 8 */; + const int TYPE_MEDIA = (1 << 4) /* 16 */; +} diff --git a/vibrator/aidl/aidl_api/android.frameworks.vibrator/current/android/frameworks/vibrator/VibrationParam.aidl b/vibrator/aidl/aidl_api/android.frameworks.vibrator/current/android/frameworks/vibrator/VibrationParam.aidl new file mode 100644 index 0000000..ddf7d05 --- /dev/null +++ b/vibrator/aidl/aidl_api/android.frameworks.vibrator/current/android/frameworks/vibrator/VibrationParam.aidl @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2023 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // +/////////////////////////////////////////////////////////////////////////////// + +// This file is a snapshot of an AIDL file. Do not edit it manually. There are +// two cases: +// 1). this is a frozen version file - do not edit this in any case. +// 2). this is a 'current' file. If you make a backwards compatible change to +// the interface (from the latest frozen version), the build system will +// prompt you to update this file with `m <name>-update-api`. +// +// You must not make a backward incompatible change to any AIDL file 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.frameworks.vibrator; +@VintfStability +union VibrationParam { + android.frameworks.vibrator.ScaleParam scale; +} diff --git a/vibrator/aidl/android/frameworks/vibrator/IVibratorControlService.aidl b/vibrator/aidl/android/frameworks/vibrator/IVibratorControlService.aidl new file mode 100644 index 0000000..3fe1586 --- /dev/null +++ b/vibrator/aidl/android/frameworks/vibrator/IVibratorControlService.aidl @@ -0,0 +1,77 @@ +/* + * Copyright (C) 2023 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.frameworks.vibrator; + +import android.frameworks.vibrator.IVibratorController; +import android.frameworks.vibrator.VibrationParam; + +/** + * IVibratorControlService is a service that allows clients to register IVibratorControllers to + * receive VibrationParams. It also allows the client to set and clear VibrationParams. + * @hide + */ +@VintfStability +interface IVibratorControlService { + /** + * Registers an IVibratorController to allow pushing VibrationParams. These params will be used + * to modify vibration characteristics, such as scaling. + * <p>Only one controller should be registered at the same time. Registering a new controller + * must unregister the old controller before registering the new one. + * + * @param controller The vibrator controller used for pulling requests. + */ + oneway void registerVibratorController(in IVibratorController controller); + + /** + * Unregisters an IVibratorController. + * <p>If the provided controller is not the registered one, the request must be ignored. + * + * @param controller The vibrator controller to be removed. + */ + oneway void unregisterVibratorController(in IVibratorController controller); + + /** + * Sets VibrationParams which will be used to modify some vibration characteristics, such as + * scaling. + * <p>If the provided controller is not the registered one, the request must be ignored. + * + * @param params The vibration params to be applied to new vibrations. + * @param token The token to register a death recipient to expire these params. + */ + oneway void setVibrationParams(in VibrationParam[] params, in IVibratorController token); + + /** + * Clears any set VibrationParams and reverts the vibration characteristics to their default + * settings. + * <p>If the provided controller is not the registered one, the request must be ignored. + * + * @param typesMask The combined bitfield of vibration types to be cleared + * @param token The token to register a death recipient to expire these params + */ + oneway void clearVibrationParams(in int typesMask, in IVibratorController token); + + /** + * Notifies the VibrationControlService of new VibrationParams. + * <p>This method must be called by the IVibratorController after processing a + * 'requestVibrationParams()' call by the service. + * + * @param requestToken The token used for this request + * @param result The request result + */ + oneway void onRequestVibrationParamsComplete( + in IBinder requestToken, in VibrationParam[] result); +}
\ No newline at end of file diff --git a/vibrator/aidl/android/frameworks/vibrator/IVibratorController.aidl b/vibrator/aidl/android/frameworks/vibrator/IVibratorController.aidl new file mode 100644 index 0000000..a1c8f79 --- /dev/null +++ b/vibrator/aidl/android/frameworks/vibrator/IVibratorController.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2023 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.frameworks.vibrator; + +/** + * IVibratorController is an interface that allows clients to request the VibrationParams for the + * specified vibration types. If the request is longer than the specified deadline, the result will + * be ignored by the caller. + * @hide + */ +@VintfStability +interface IVibratorController { + /** + * Triggers a request to receive VibrationParams for the specified vibration types. The + * received params are used to modify vibration characteristics, such as scaling. + * <p> If the request takes longer than the specified deadline, the request must be ignored by + * the caller. + * + * @param typesMask The combined bitfield of vibration types queried + * @param deadlineElapsedRealtimeMillis The request deadline, result ignored after this + * @param requestToken The token for the async result, used by the service + */ + oneway void requestVibrationParams(in int typesMask, + in long deadlineElapsedRealtimeMillis, in IBinder requestToken); +}
\ No newline at end of file diff --git a/vibrator/aidl/android/frameworks/vibrator/ScaleParam.aidl b/vibrator/aidl/android/frameworks/vibrator/ScaleParam.aidl new file mode 100644 index 0000000..c0170cb --- /dev/null +++ b/vibrator/aidl/android/frameworks/vibrator/ScaleParam.aidl @@ -0,0 +1,33 @@ +/* + * Copyright (C) 2023 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.frameworks.vibrator; + +/** + * Vibration scale for one or more vibration types + */ +@VintfStability +parcelable ScaleParam { + const int TYPE_ALARM = 1 << 0; // Alarm usage + const int TYPE_NOTIFICATION = 1 << 1; // Notification and communication request usages + const int TYPE_RINGTONE = 1 << 2; // Ringtone usage + const int TYPE_INTERACTIVE = 1 << 3; // Touch and hardware feedback usages + const int TYPE_MEDIA = 1 << 4; // Media and unknown usages + + // combined bitfield of ScaleParam::TYPE* values + int typesMask; + float scale; +}
\ No newline at end of file diff --git a/vibrator/aidl/android/frameworks/vibrator/VibrationParam.aidl b/vibrator/aidl/android/frameworks/vibrator/VibrationParam.aidl new file mode 100644 index 0000000..e9bde2a --- /dev/null +++ b/vibrator/aidl/android/frameworks/vibrator/VibrationParam.aidl @@ -0,0 +1,27 @@ +/* + * Copyright (C) 2023 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.frameworks.vibrator; + +import android.frameworks.vibrator.ScaleParam; + +/** + * Consolidated representation of all vibration parameters + */ +@VintfStability +union VibrationParam { + ScaleParam scale; +}
\ No newline at end of file diff --git a/vibrator/aidl/vts/functional/Android.bp b/vibrator/aidl/vts/functional/Android.bp new file mode 100644 index 0000000..e95eb01 --- /dev/null +++ b/vibrator/aidl/vts/functional/Android.bp @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2023 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 { + default_applicable_licenses: ["Android-Apache-2.0"], +} + +cc_test { + name: "VtsHalVibratorControlServiceTargetTest", + defaults: [ + "VtsHalTargetTestDefaults", + "use_libaidlvintf_gtest_helper_static", + ], + tidy_timeout_srcs: [ + "VtsHalVibratorControlServiceTargetTest.cpp", + ], + srcs: [ + "VtsHalVibratorControlServiceTargetTest.cpp", + ], + static_libs: [ + "android.frameworks.vibrator-V1-ndk", + "libgmock", + ], + shared_libs: [ + "libbinder_ndk", + ], + test_suites: [ + "general-tests", + "vts", + ], +} diff --git a/vibrator/aidl/vts/functional/VtsHalVibratorControlServiceTargetTest.cpp b/vibrator/aidl/vts/functional/VtsHalVibratorControlServiceTargetTest.cpp new file mode 100644 index 0000000..9987440 --- /dev/null +++ b/vibrator/aidl/vts/functional/VtsHalVibratorControlServiceTargetTest.cpp @@ -0,0 +1,149 @@ +/* + * Copyright (C) 2023 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. + */ + +#include <aidl/Gtest.h> +#include <aidl/Vintf.h> +#include <aidl/android/frameworks/vibrator/BnVibratorControlService.h> +#include <aidl/android/frameworks/vibrator/BnVibratorController.h> +#include <aidl/android/frameworks/vibrator/IVibratorControlService.h> +#include <aidl/android/frameworks/vibrator/IVibratorController.h> +#include <aidl/android/frameworks/vibrator/ScaleParam.h> +#include <android-base/logging.h> +#include <android/binder_auto_utils.h> +#include <android/binder_manager.h> +#include <android/binder_process.h> +#include <utils/Condition.h> +#include <utils/Mutex.h> + +namespace android { + +using ::aidl::android::frameworks::vibrator::BnVibratorController; +using ::aidl::android::frameworks::vibrator::BnVibratorControlService; +using ::aidl::android::frameworks::vibrator::IVibratorController; +using ::aidl::android::frameworks::vibrator::IVibratorControlService; +using ::aidl::android::frameworks::vibrator::ScaleParam; +using ::aidl::android::frameworks::vibrator::VibrationParam; +using ::android::getAidlHalInstanceNames; +using ::android::PrintInstanceNameToString; +using ndk::SpAIBinder; +using ::testing::Eq; +using ::testing::InitGoogleTest; +using ::testing::TestWithParam; +using ::testing::ValuesIn; + +std::vector<VibrationParam> generateVibrationParams(int in_typesMask, float scale) { + ScaleParam scaleParam = ScaleParam(); + scaleParam.typesMask = in_typesMask; + scaleParam.scale = scale; + VibrationParam vibrationParam = VibrationParam(scaleParam); + std::vector<VibrationParam> vibrationParams = {vibrationParam}; + return vibrationParams; +} + +class VibratorController : public BnVibratorController { + public: + ~VibratorController() override = default; + + ndk::ScopedAStatus requestVibrationParams(int in_typesMask, + int64_t in_deadlineElapsedRealtimeMillis, + const ::ndk::SpAIBinder& in_requestToken) override { + if (in_requestToken == nullptr) { + LOG(INFO) << "Vibrator controller failed to process a request for vibration params"; + return ndk::ScopedAStatus(AStatus_fromExceptionCode(EX_ILLEGAL_ARGUMENT)); + } + + LOG(INFO) << "Vibrator controller received a request for vibration params for type: " + << in_typesMask << ", with a timeout of: " << in_deadlineElapsedRealtimeMillis; + + std::shared_ptr<IVibratorControlService> service = + IVibratorControlService::fromBinder(in_requestToken); + + EXPECT_TRUE(service + ->onRequestVibrationParamsComplete( + in_requestToken, generateVibrationParams(in_typesMask, /* scale= */ 1)) + .isOk()); + + return ndk::ScopedAStatus::ok(); + } +}; + +class VibratorControlServiceTest : public ::testing::TestWithParam<std::string> { + public: + void SetUp() override { + SpAIBinder binder(AServiceManager_waitForService(GetParam().c_str())); + service = IVibratorControlService::fromBinder(binder); + ASSERT_NE(service, nullptr); + } + + std::shared_ptr<IVibratorControlService> service; +}; + +TEST_P(VibratorControlServiceTest, RegisterVibrationControllerTest) { + std::shared_ptr<IVibratorController> vibratorController = + ::ndk::SharedRefBase::make<VibratorController>(); + + EXPECT_TRUE(service->registerVibratorController(vibratorController).isOk()); + + EXPECT_TRUE(service->unregisterVibratorController(vibratorController).isOk()); +} + +TEST_P(VibratorControlServiceTest, RequestVibrationParamsTest) { + std::shared_ptr<IVibratorController> vibratorController = + ::ndk::SharedRefBase::make<VibratorController>(); + + EXPECT_TRUE(service->registerVibratorController(vibratorController).isOk()); + + EXPECT_TRUE(vibratorController + ->requestVibrationParams(ScaleParam::TYPE_ALARM, + /* deadlineElapsedRealtimeMillis= */ 50, + service->asBinder()) + .isOk()); + EXPECT_TRUE(service->unregisterVibratorController(vibratorController).isOk()); +} + +TEST_P(VibratorControlServiceTest, SetAndClearVibrationParamsTest) { + std::shared_ptr<IVibratorController> vibratorController = + ::ndk::SharedRefBase::make<VibratorController>(); + + EXPECT_TRUE(service->registerVibratorController(vibratorController).isOk()); + + EXPECT_TRUE( + service + ->setVibrationParams(generateVibrationParams(ScaleParam::TYPE_ALARM, /* scale= */ 1), + vibratorController->getDefaultImpl()) + .isOk()); + + EXPECT_TRUE( + service->clearVibrationParams(ScaleParam::TYPE_ALARM, vibratorController->getDefaultImpl()) + .isOk()); + + EXPECT_TRUE(service->unregisterVibratorController(vibratorController).isOk()); +} + +GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(VibratorControlServiceTest); + +INSTANTIATE_TEST_SUITE_P( + PerInstance, VibratorControlServiceTest, + testing::ValuesIn(getAidlHalInstanceNames(IVibratorControlService::descriptor)), + PrintInstanceNameToString); + +int main(int argc, char** argv) { + InitGoogleTest(&argc, argv); + ABinderProcess_setThreadPoolMaxThreadCount(/* numThreads= */ 1); + ABinderProcess_startThreadPool(); + return RUN_ALL_TESTS(); +} +} // namespace android |