1 #pragma once 2 3 #ifndef ANDROID_OS_VIBRATOR 4 #define ANDROID_OS_VIBRATOR(FLAG) ANDROID_OS_VIBRATOR_##FLAG 5 #endif 6 7 #ifndef ANDROID_OS_VIBRATOR_CANCEL_BY_APPOPS 8 #define ANDROID_OS_VIBRATOR_CANCEL_BY_APPOPS true 9 #endif 10 #ifndef ANDROID_OS_VIBRATOR_HAPTIC_FEEDBACK_INPUT_SOURCE_CUSTOMIZATION_ENABLED 11 #define ANDROID_OS_VIBRATOR_HAPTIC_FEEDBACK_INPUT_SOURCE_CUSTOMIZATION_ENABLED false 12 #endif 13 #ifndef ANDROID_OS_VIBRATOR_HAPTIC_FEEDBACK_VIBRATION_OEM_CUSTOMIZATION_ENABLED 14 #define ANDROID_OS_VIBRATOR_HAPTIC_FEEDBACK_VIBRATION_OEM_CUSTOMIZATION_ENABLED true 15 #endif 16 #ifndef ANDROID_OS_VIBRATOR_LOAD_HAPTIC_FEEDBACK_VIBRATION_CUSTOMIZATION_FROM_RESOURCES 17 #define ANDROID_OS_VIBRATOR_LOAD_HAPTIC_FEEDBACK_VIBRATION_CUSTOMIZATION_FROM_RESOURCES false 18 #endif 19 20 #ifdef __cplusplus 21 22 #include <memory> 23 24 namespace android::os::vibrator { 25 26 class flag_provider_interface { 27 public: 28 virtual ~flag_provider_interface() = default; 29 virtual bool adaptive_haptics_enabled() = 0; 30 virtual bool cancel_by_appops() = 0; 31 virtual bool fix_audio_coupled_haptics_scaling() = 0; 32 virtual bool haptic_feedback_input_source_customization_enabled() = 0; 33 virtual bool haptic_feedback_vibration_oem_customization_enabled() = 0; 34 virtual bool haptics_scale_v2_enabled() = 0; 35 virtual bool load_haptic_feedback_vibration_customization_from_resources() = 0; 36 virtual bool normalized_pwle_effects() = 0; 37 virtual bool primitive_composition_absolute_delay() = 0; 38 virtual bool throttle_vibration_params_requests() = 0; 39 virtual bool vendor_vibration_effects() = 0; 40 virtual bool vibration_attribute_ime_usage_api() = 0; 41 virtual bool vibration_pipeline_enabled() = 0; 42 virtual bool vibration_xml_apis() = 0; 43 }; 44 45 extern std::unique_ptr<flag_provider_interface> provider_; 46 47 adaptive_haptics_enabled()48inline bool adaptive_haptics_enabled() { 49 return true; 50 } cancel_by_appops()51inline bool cancel_by_appops() { 52 return ANDROID_OS_VIBRATOR_CANCEL_BY_APPOPS; 53 } fix_audio_coupled_haptics_scaling()54inline bool fix_audio_coupled_haptics_scaling() { 55 return false; 56 } haptic_feedback_input_source_customization_enabled()57inline bool haptic_feedback_input_source_customization_enabled() { 58 return ANDROID_OS_VIBRATOR_HAPTIC_FEEDBACK_INPUT_SOURCE_CUSTOMIZATION_ENABLED; 59 } haptic_feedback_vibration_oem_customization_enabled()60inline bool haptic_feedback_vibration_oem_customization_enabled() { 61 return ANDROID_OS_VIBRATOR_HAPTIC_FEEDBACK_VIBRATION_OEM_CUSTOMIZATION_ENABLED; 62 } haptics_scale_v2_enabled()63inline bool haptics_scale_v2_enabled() { 64 return false; 65 } load_haptic_feedback_vibration_customization_from_resources()66inline bool load_haptic_feedback_vibration_customization_from_resources() { 67 return ANDROID_OS_VIBRATOR_LOAD_HAPTIC_FEEDBACK_VIBRATION_CUSTOMIZATION_FROM_RESOURCES; 68 } normalized_pwle_effects()69inline bool normalized_pwle_effects() { 70 return false; 71 } primitive_composition_absolute_delay()72inline bool primitive_composition_absolute_delay() { 73 return false; 74 } throttle_vibration_params_requests()75inline bool throttle_vibration_params_requests() { 76 return true; 77 } vendor_vibration_effects()78inline bool vendor_vibration_effects() { 79 return false; 80 } vibration_attribute_ime_usage_api()81inline bool vibration_attribute_ime_usage_api() { 82 return false; 83 } vibration_pipeline_enabled()84inline bool vibration_pipeline_enabled() { 85 return false; 86 } vibration_xml_apis()87inline bool vibration_xml_apis() { 88 return false; 89 } 90 91 } 92 93 extern "C" { 94 #endif // __cplusplus 95 96 97 bool android_os_vibrator_adaptive_haptics_enabled(); 98 bool android_os_vibrator_cancel_by_appops(); 99 bool android_os_vibrator_fix_audio_coupled_haptics_scaling(); 100 bool android_os_vibrator_haptic_feedback_input_source_customization_enabled(); 101 bool android_os_vibrator_haptic_feedback_vibration_oem_customization_enabled(); 102 bool android_os_vibrator_haptics_scale_v2_enabled(); 103 bool android_os_vibrator_load_haptic_feedback_vibration_customization_from_resources(); 104 bool android_os_vibrator_normalized_pwle_effects(); 105 bool android_os_vibrator_primitive_composition_absolute_delay(); 106 bool android_os_vibrator_throttle_vibration_params_requests(); 107 bool android_os_vibrator_vendor_vibration_effects(); 108 bool android_os_vibrator_vibration_attribute_ime_usage_api(); 109 bool android_os_vibrator_vibration_pipeline_enabled(); 110 bool android_os_vibrator_vibration_xml_apis(); 111 112 #ifdef __cplusplus 113 } // extern "C" 114 #endif 115 116