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

Commit 2988f3a1 authored by Steven Moreland's avatar Steven Moreland
Browse files

example vibrator for createBinder

We don't have a good place to document how to deal
with AIDL-generated code yet. Adding an example here
so we have one visible on AOSP.

Bug: 235448283
Test: builds
Change-Id: I719cc06a890402204f476a01180ce4120c60a22c
parent 6645a15a
Loading
Loading
Loading
Loading
+8 −0
Original line number Original line Diff line number Diff line
@@ -57,4 +57,12 @@ ndk::ScopedAStatus CustomVibrator::perform(VendorEffect effect,
    return ndk::ScopedAStatus::ok();
    return ndk::ScopedAStatus::ok();
}
}


ndk::SpAIBinder CustomVibrator::createBinder() {
    auto binder = BnCustomVibrator::createBinder();
    // e.g. AIBinder_setInheritRt(binder.get(), true);
    // e.g. AIBinder_setMinSchedulerPolicy(binder.get(), SCHED_NORMAL, 20);
    // e.g. AIBinder_setRequestingSid(binder.get(), true);
    return binder;
}

}  // namespace aidl::android::hardware::tests::extension::vibrator
}  // namespace aidl::android::hardware::tests::extension::vibrator
+6 −0
Original line number Original line Diff line number Diff line
@@ -29,6 +29,12 @@ class CustomVibrator : public BnCustomVibrator {
    ndk::ScopedAStatus perform(VendorEffect effect,
    ndk::ScopedAStatus perform(VendorEffect effect,
                               const std::shared_ptr<IVibratorCallback>& callback,
                               const std::shared_ptr<IVibratorCallback>& callback,
                               int32_t* _aidl_return) override;
                               int32_t* _aidl_return) override;

  private:
    // override for AIBinder_setInheritRt, AIBinder_setMinSchedulerPolicy, or
    // AIBinder_setRequestingSid calling this in the constructor or elsewhere, the binder would
    // immediately be destroyed.
    ndk::SpAIBinder createBinder() override;
};
};


}  // namespace aidl::android::hardware::tests::extension::vibrator
}  // namespace aidl::android::hardware::tests::extension::vibrator