1 /* 2 * Copyright (C) 2015 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #ifndef ANDROID_EXTERNAL_VIBRATION_H 18 #define ANDROID_EXTERNAL_VIBRATION_H 19 20 #include <android/os/IExternalVibrationController.h> 21 #include <binder/Binder.h> 22 #include <binder/IBinder.h> 23 #include <binder/Parcelable.h> 24 #include <system/audio.h> 25 #include <utils/RefBase.h> 26 27 namespace android { 28 namespace os { 29 30 class ExternalVibration : public Parcelable, public virtual RefBase { 31 public : 32 ExternalVibration() = default; 33 ExternalVibration(int32_t uid, std::string pkg, const audio_attributes_t& attrs, 34 sp<IExternalVibrationController> controller); 35 virtual ~ExternalVibration() = default; 36 ExternalVibration(const ExternalVibration&) = default; 37 38 bool operator==(const ExternalVibration&) const; 39 40 status_t writeToParcel(Parcel* parcel) const override; 41 status_t readFromParcel(const Parcel* parcel) override; 42 getUid()43 int32_t getUid() const { return mUid; } getPackage()44 std::string getPackage() const { return mPkg; } getAudioAttributes()45 audio_attributes_t getAudioAttributes() const { return mAttrs; } getController()46 sp<IExternalVibrationController> getController() { return mController; } 47 48 49 private: 50 int32_t mUid; 51 std::string mPkg; 52 audio_attributes_t mAttrs; 53 sp<IExternalVibrationController> mController; 54 sp<IBinder> mToken = new BBinder(); 55 }; 56 57 } // namespace android 58 } // namespace os 59 60 #endif // ANDROID_EXTERNAL_VIBRATION_H 61