summaryrefslogtreecommitdiff
path: root/core/java/android/os/VibrationAttributes.java
Commit message (Collapse)AuthorAgeFilesLines
* Add flag to refresh of user vibration settings before vibratingLais Andrade2022-03-211-3/+34
| | | | | | | | | | | | | | | | | | | | | | | Add hidden flag to VibrationAttributes that enforces the service to refresh the cached user settings values before vibrating with the given effect. This allows user settings to apply this to vibratins played as preview of new intensities set by the slider. This solution still requires the Settings to update the user intensity before playing the preview, but it doesn't bypass any user settings or policies in order to play the preview, avoiding a shortcut that could be used to enforce vibrations without user control. This setting is also applied to external vibrations, which could be used to preview haptics instead if a prebaked effect. It also applies to ringer mode, that is now cached by the service instead of queried on each vibrate call. Fix: 219693646 Fix: 219695212 Fix: 157533521 Test: VibrationSettingsTest & VibratorManagerServiceTest Change-Id: I605ccd2a4a3b89f1ba5bc86d8f3f64dd6d2714eb
* Update vibrator javadoc formatting.Simon Bowden2022-02-151-2/+2
| | | | | | | | | | After reviewing rendered docs, adding missing paragraph markers and some small typos, as well as fixing code snippets to be inside a <pre> block. At the moment, trailing newlines get picked up so it's also necessary to terminate the code and pre blocks on the actual last line of code. Test: built docs and manually reviewed site Change-Id: I327b146eaae20fa3a2e8cf066e211e14cb165c51
* Merge "Improve javadoc for some vibration functions."TreeHugger Robot2022-01-311-16/+14
|\
| * Improve javadoc for some vibration functions.Simon Bowden2022-01-271-17/+14
| | | | | | | | | | | | | | | | | | This is only clarifying existing behavior. Focused on clarifying what it means to not support an effect, as well as ambiguity in descriptions of VibrationAttributes. Test: presubmits, comments only Change-Id: I7ab5d488d72a386aa2786fdaeb93fef55aaed71d
* | Include the new USAGE_CLASS_MEDIA in the UsageClass IntDef.Simon Bowden2022-01-271-1/+1
|/ | | | | | Bug: 207477604 Test: presubmit Change-Id: I860a5ce3e3978c1936dd0cfad7f25dcc40aebaa1
* Deprecate boolean settings for haptic feedback and vibrate when ringingLais Andrade2022-01-181-1/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Deprecate HAPTIC_FEEDBACK_ENABLED in favor or HAPTIC_FEEDBACK_INTENSITY, and VIBRATE_WHEN_RINGING in favor or RING_VIBRATION_INTENSITY. Introduce hidden flag VibrationAttributes.FLAG_BYPASS_USER_VIBRATION_INTENSITY_OFF to represent HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING in the vibrator service. This is applied by: - PhoneWindowManager, that converts HapticFeedbackConstants into (VibrationEffect, VibrationAttributes). - CellBroadcastAlertAudio, that triggers alerts using AudioAttributes with flags FLAG_BYPASS_INTERRUPTION_POLICY (that translates to same flag in VibratorManager, to bypass DnD) and FLAG_BYPASS_MUTE (that translates to this new flag, to bypass the new alarm intensity settings). The new flag is erased from request that are not from privileged apps, similar to the other bypass flag. The public HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING has also been deprecated in T with a documentation explaining the removal of platform support. Remove SysUI dependencies on the deprecated settings, it should use the USAGE_TOUCH attribute and rely on the vibrator service to apply the user settings. Keep other SysUI dependencies that needs to run in older Android versions (like Launcher3). Bug: 185351540 Test: VibrationSettingsTest + manual Change-Id: I0372e4db19e09523795d7e79b9f7a15ae48a8cd9
* Introduce media and alarm vibration intensity settingsLais Andrade2022-01-101-12/+10
| | | | | | | | | | | | | | | | Introduce new setting keys for media and alarm vibration intensity. Merge all default vibration intensity getters into a helper class that receives the VibrationAttributes usage int and applies the default logic to all usages. Also update the usage of boolean settings for haptic feedback and ringtone to disable vibrations in VibrationSettings. Bug: 198346559 Bug: 207477604 Test: VibratorTest & VibrationSettingsTest Change-Id: I69ba05a8bc35657637b1f351f4c19d2d96efc9e3
* Enable hardware feedback in background and disable touch feedback in silent modeLais Andrade2021-12-021-6/+11
| | | | | | | | | | | Move method that validates all settings applied to a incoming vibration into VibrationSettings. Modify battery-saver mode and backgound process validation to use allowlist of usage filters. Fix: 207362379 Fix: 165478128 Test: VibrationSettingsTest Change-Id: I8e80c29a872aa000986ed5dbdd169d5550978b66
* Update VibrationEffect haptic feedback heuristicLais Andrade2021-11-301-67/+0
| | | | | | | | | | | | | | | | | | Update VibrationAttributes removing the logic to classify VibrationEffect instances as haptic feedback. Introduce isHapticFeedbackCandidate method to VibrationEffect, CombinedVibration and the effect segments, to be used by the VibratorManagerService to classify unknown vibration effects as having TOUCH_USAGE. Update haptic feedback limit to 1s, and also add limits to composition size for identifying candidate effects. Bug: 185351540 Test: VibrationAttributesTest VibratorManagerServiceTest Change-Id: I6f840f7ac7ab27da99949eb5dc2122451886cb30
* Introduce media and accessibility vibration usages.Lais Andrade2021-11-291-3/+37
| | | | | | | | | Also update mappings to add new communication request values from AudioAttributes. Bug: 207477604 Test: VibrationAttributesTest Change-Id: I0b7f49c5c8770c039546fb15e89be5db43708b78
* Add public vibrate method with VibrationAttributesLais Andrade2021-11-171-3/+25
| | | | | | | | | | | | | | | Deprecate Vibrator.vibrate method that takes AudioAttributes and introduce a new one that takes VibrationAttributes instead. Update setAlwaysOnEffect to also take VibrationAttributes. Introduce new public constructor for VibrationAttributes.Builder that takes AudioAttributes, to be used in scenarios where the vibration is meant to accompany an audio, and have similar attributes. Bug: 163119475 Test: VibratorTest Change-Id: I2721e3638aeb1aa4df3d515c3c0465923457dcc0
* Fix typo in VibrationAttributesLais Andrade2021-09-211-1/+1
| | | | | | Change-Id: I1437522ff8e99c87fc0c93f29bf16282cb776804 Fix: 200616610 Test: N/A
* Fix usage filter over UNKNOWN vibrationLais Andrade2021-06-171-0/+5
| | | | | | | | | | The usageFilter parameter added to Vibrator.cancel is always cancelling UNKNOWN vibrations (usage = 0). The filter should only cancel them if the value is the same usage, or if all usages are being cancelled. Fix: 182440404 Test: VibratorManagerServiceTest Change-Id: Ibf33fe24e5253501e751b027cbf4b68564d82929
* Introduce VibrationEffectSegmentLais Andrade2021-03-181-3/+19
| | | | | | | | | | | | | | Create a new parcelable VibrationEffectSegment in the new package android.os.vibrator, together with three concrete implementations for the segment types: step, prebaked and primitive. Remove all implementations of VibrationEffect to allow composition of any effects, represented now by the concrete type VibrationEffect that holds a list of segments. Bug: 167947076 Test: VibrationEffectTest Change-Id: I79c99e29f436ed77558af764f55633bb4636e034
* Implement dump and vibrate cmds for Vibrator ManagerLais Andrade2021-02-021-1/+1
| | | | | | | | | | | | Keep previous vibrations to be reported in the dump method, similar to VibratorService. Implement some vibrate commands to test VibratorManager in the adb shell. Bug: 167946816 Test: VibratorManagerTest Change-Id: Ie7dd89b0e3b2747454b32fe3cc2d8751daae9e19
* Add @Nullable annotation to the parameter of Object.equals() methods.Roman Kalukiewicz2020-10-151-1/+1
| | | | | | | | | | | | | | | | | | Those annotations could be inferred by some tools (like Kotlin), but the https://checkerframework.org/ doesn't check inherited annotations complaining about all equals() invocations that get nullable argument. The change was generated by running find . -name \*.java | xargs sed -i 's/public boolean equals(Object /public boolean equals(@Nullable Object /' in the frameworks/base directory and by automatically adding and formatting required imports if needed. No manual edits. Bug: 170883422 Test: Annotation change only. Should have not impact. Exempt-From-Owner-Approval: Mechanical change not specific to any component. Change-Id: I5eedb571c9d78862115dfdc5dae1cf2a35343580
* Remove deprecated VibrationAttributes.getAudioAttrs methodLais Andrade2020-10-011-22/+37
| | | | | | | | | | | | | | | | | Removing the deprecated AudioAttributes field from VibrationAttributes in favor of a usage mapping to be used with AppOpsManager.checkAudioOp. The mapping ensures the heuristic applied in VibrationAttributes.Builder is taken into account by the VibratorManager. This also adds a hidden method to Vibrator to allow forwarding a VibrationAttributes to input device vibrators instead of relying on the original AudioAttributes. Bug: 163119475 Test: atest FrameworksServicesTests:VibratorServiceTest atest FrameworksCoreTests:VibratorTest Change-Id: I83dbe079865b453c4cf42a6fd7e71f822acc39ea
* Merge "Propagate AudioAttributes flags to VibrationAttributes" into rvc-dev ↵TreeHugger Robot2020-07-251-0/+7
|\ | | | | | | | | | | | | | | am: 863c82fa76 am: 61e32caa0b am: 38570d081d am: f06368ec86 Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/12218307 Change-Id: Ibf79adc0effaaa074fdd0634b0773cda5752d3e1
| * Propagate AudioAttributes flags to VibrationAttributesLais Andrade2020-07-231-0/+7
| | | | | | | | | | | | | | | | | | Set supported flags from AudioAttributes into VibrationAttributes on the builder constructor. Fix: b/161761418 Test: manual Change-Id: I4a8e1db278843b2f9f19aba43b0b8f264cb696bd
* | Remove android.os.VibrationAttributes.Builder replaceFlags method.Chris Ye2020-04-081-12/+8
|/ | | | | | | | | Remove android.os.VibrationAttributes.Builder replaceFlags method. Use setFlags method instead. Bug: 148669160 Test: atest VibratorTest Change-Id: Iefdddc2c57c96a080718296d4c3a7359565e8947
* Change VibrationAttributes.Builder.replaceFlags() to @hide.Chris Ye2020-01-291-0/+12
| | | | | | | | | Remove VibrationAttributes.Builder.replaceFlags() from public API. Add VibrationAttributes.Builder.setFlags() as public API. Bug: 148286757 Test: atest VibrationAttributesTest Change-Id: I573268d75f70b36552bd1ecd547906a4b50b77cb
* Add VibrationAttributesAlexey Kuzmin2020-01-061-0/+401
Added a class for attributes of vibrations, to gradually replace usage of AudioAttributes in haptics context. Refactored VibrationService and related classes to use VibrationAttributes, converting AudioAttributes to VibrationAttributes and back as necessary Test: manual. Since it's a refacroring, everything should work as before Bug: 136810264 Change-Id: I82c04bc6f6fb723ee390e3b86a4a371564ab28d4