summaryrefslogtreecommitdiff
path: root/vibrator/aidl/default/Vibrator.cpp
diff options
context:
space:
mode:
authorHarpreet \"Eli\" Sangha <eliptus@google.com>2019-09-09 11:04:54 +0900
committerHarpreet \"Eli\" Sangha <eliptus@google.com>2019-12-12 11:09:06 +0900
commit63624099e39b0493b678b016afe3d28047e7a0be (patch)
treec95b369060a93686e1ec45ce054ce16c1bd0d5d9 /vibrator/aidl/default/Vibrator.cpp
parente82bfc646fa9a2eb8d7bf09454556cc0ffb06577 (diff)
vibrator: Support Always-On Effects
Bug: 138909021 Test: Verify always-on haptics are configured on boot and settings change. Change-Id: I11ce5f2b974267c6e84b1843a750847492a7de15 Signed-off-by: Harpreet \"Eli\" Sangha <eliptus@google.com>
Diffstat (limited to 'vibrator/aidl/default/Vibrator.cpp')
-rw-r--r--vibrator/aidl/default/Vibrator.cpp25
1 files changed, 24 insertions, 1 deletions
diff --git a/vibrator/aidl/default/Vibrator.cpp b/vibrator/aidl/default/Vibrator.cpp
index befdeab08a..cedd9cb89c 100644
--- a/vibrator/aidl/default/Vibrator.cpp
+++ b/vibrator/aidl/default/Vibrator.cpp
@@ -31,7 +31,8 @@ ndk::ScopedAStatus Vibrator::getCapabilities(int32_t* _aidl_return) {
LOG(INFO) << "Vibrator reporting capabilities";
*_aidl_return = IVibrator::CAP_ON_CALLBACK | IVibrator::CAP_PERFORM_CALLBACK |
IVibrator::CAP_AMPLITUDE_CONTROL | IVibrator::CAP_EXTERNAL_CONTROL |
- IVibrator::CAP_EXTERNAL_AMPLITUDE_CONTROL | IVibrator::CAP_COMPOSE_EFFECTS;
+ IVibrator::CAP_EXTERNAL_AMPLITUDE_CONTROL | IVibrator::CAP_COMPOSE_EFFECTS |
+ IVibrator::CAP_ALWAYS_ON_CONTROL;
return ndk::ScopedAStatus::ok();
}
@@ -151,6 +152,28 @@ ndk::ScopedAStatus Vibrator::compose(const std::vector<CompositeEffect>& composi
return ndk::ScopedAStatus::ok();
}
+ndk::ScopedAStatus Vibrator::getSupportedAlwaysOnEffects(std::vector<Effect>* _aidl_return) {
+ return getSupportedEffects(_aidl_return);
+}
+
+ndk::ScopedAStatus Vibrator::alwaysOnEnable(int32_t id, Effect effect, EffectStrength strength) {
+ std::vector<Effect> effects;
+ getSupportedAlwaysOnEffects(&effects);
+
+ if (std::find(effects.begin(), effects.end(), effect) == effects.end()) {
+ return ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION);
+ } else {
+ LOG(INFO) << "Enabling always-on ID " << id << " with " << toString(effect) << "/"
+ << toString(strength);
+ return ndk::ScopedAStatus::ok();
+ }
+}
+
+ndk::ScopedAStatus Vibrator::alwaysOnDisable(int32_t id) {
+ LOG(INFO) << "Disabling always-on ID " << id;
+ return ndk::ScopedAStatus::ok();
+}
+
} // namespace vibrator
} // namespace hardware
} // namespace android