summaryrefslogtreecommitdiff
path: root/core/java/android/util/MathUtils.java
Commit message (Collapse)AuthorAgeFilesLines
* Split ActivityLaunchAnimator (1/2)Jordan Demeulenaere2021-09-231-0/+4
| | | | | | | | | | | | | | | This CL splits ActivityLaunchAnimator by extracting common logic into LaunchAnimator. The goal of this CL is to be able to reuse the LaunchAnimator logic for dialog launches. This CL also improves GhostedViewLaunchAnimator such that it also works with: * launch containers that are not located at (0, 0). * ghosted views that move. Test: atest ActivityLaunchAnimatorTest Bug: 193634619 Change-Id: Ic05603600d4a7d4e27182c79bef54286087d00d0
* Use new UnsupportedAppUsage annotation.Artur Satayev2020-01-071-1/+1
| | | | | | | | Existing annotations in libcore/ and frameworks/ will deleted after the migration. This also means that any java library that compiles @UnsupportedAppUsage requires a direct dependency on "unsupportedappusage" java_library. Bug: 145132366 Test: m && diff unsupportedappusage_index.csv Change-Id: I288969b0c22fa3a63bc2e71bb5009fe4a927e154
* Adds lerpInv, saturate, lerpInvSat and constrainedMap to MathUtils.Zak Cohen2019-02-111-0/+46
| | | | | Change-Id: I525c9c691cb8f3eb61022e98b45997981c067018 Test: part of bigger change.
* Remove obsolete lock screen UILucas Dupin2018-10-291-0/+15
| | | | | | | | | | Removes obsolete KeyguardSliceView title area and adds doze callbacks necessary to support new lock screen design. Bug: 111405682 Test: manual Test: atest KeyguardSliceViewTest Change-Id: I07e96dbde68d4e5e38e1371526bedf59fc925b86
* Add @UnsupportedAppUsage annotationsMathew Inwood2018-08-141-0/+7
| | | | | | | | | | | | | | | | | | | For packages: android.util.proto android.util.jar android.util.apk android.util This is an automatically generated CL. See go/UnsupportedAppUsage for more details. Exempted-From-Owner-Approval: Mechanical changes to the codebase which have been approved by Android API council and announced on android-eng@ Bug: 110868826 Test: m Change-Id: Ia0f48c244b0fbe33d40d797702a82303648196ed
* Dark Notification ShadeLucas Dupin2018-07-121-0/+15
| | | | | | | Test: adb shell service call uimode 4 i32 1 # day Test: adb shell service call uimode 4 i32 2 # night Bug: 110758454 Change-Id: Ib6fce91d1aeff7e1fbfe8a7a528095487fbdb3f8
* Convert the BrightnessController to a log scale control.Michael Wright2018-04-161-0/+4
| | | | | | | | | | | | Currently, the BrightnessController's UI is a linear scale control on top of a linear backlight control, but humans perceive brightness on a roughly logarithmic scale. By moving to a non-linear control, we both give users more fine-grained control over the brightness of the display as well as a UI that works more intuitively. Test: manual Bug: 73810208 Change-Id: I67090ad7c4ced0420314458473c9124cb9c61906
* MathUtils.map fixLucas Dupin2017-05-241-3/+1
| | | | | | Test: runtest -x cts/tests/tests/util/src/android/util/cts/MathUtilsTest.java Bug: 62068907 Change-Id: I26613407a2f477580cbe17160651f1f8972a75d8
* MathUtils: Remove static Random field.Narayan Kamath2017-03-081-23/+0
| | | | | | | | | | | | | This is unsafe because the random will be seeded in the zygote, which means all processes on the system generate the same sequence of random numbers. Fortunately, this code is only used in tests, so get rid of it. Note that the Random that backs Math.random() is reseeded after every fork to avoid a similar issue. Bug: 35918685 Test: HwAccelerationTest Change-Id: Ice79aa25bb9017f7a0b91659afe04112850cb74b
* Animate radial time picker selector during hour/minute transitionAlan Viverette2015-10-021-0/+21
| | | | | | | | | Also propagates XML attrs from time picker to radial view during construction, which allows the hour colors & etc. to be changed inline without needing to set the timePickerStyle theme attribute. Bug: 20333885 Change-Id: Ib42b9f5b93b5d6ce1dcbaa05f99cef40c9f9a9d3
* Fix security issues when using Parcel.setDataPosition() with untrusted inputAdam Lesinski2015-10-011-0/+20
| | | | | | | | When seeking forward in the Parcel, adding the extracted size to the Parcel.dataPosition() can result in an overflow. Guard against this. Bug:23909429 Change-Id: If37cdebbf05a92810300363d1a6ecd8b42b6da26
* Add group scaling factor into stroke width.ztenghui2015-04-021-6/+14
| | | | | | | | | Originally, stroke width is independent of group scaling. But that is a bug and causing animation trouble. b/19501782 Change-Id: I33d5e44f2f8b2a82fee1a5a326223a39aaffa86c
* Switch from FloatMath -> Math and Math.hypot where possibleNeil Fuller2014-10-011-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The motivation is an API change: FloatMath is going to be deprecated and/or removed. Performance is not the goal of this change. That said... Math is faster than FloatMath with AOT compilation. While making the change, occurances of: {Float}Math.sqrt(x * x + y * y) and {Float}Math.sqrt({Float}Math.pow(x, 2) + {Float}Math.pow(y, 2)) have been replaced with: {(float)} Math.hypot(x, y) Right now there is no runtime intrinsic for hypot so is not faster in all cases for AOT compilation: Math.sqrt(x * x + y * y) is faster than Math.hypot(x, y) with AOT, but all other combinations of FloatMath, use of pow() etc. are slower than hypot(). hypot() has the advantage of being self documenting and could be optimized in future. None of the behavior differences around NaN and rounding appear to be important for the cases looked at: they all assume results and arguments are in range and usually the results are cast to float. Different implementations measured on hammerhead / L: AOT compiled: [FloatMath.hypot(x, y)] benchmark=Hypot_FloatMathHypot} 633.85 ns; σ=0.32 ns @ 3 trials [FloatMath.sqrt(x*x + y*y)] benchmark=Hypot_FloatMathSqrtMult} 684.17 ns; σ=4.83 ns @ 3 trials [FloatMath.sqrt(FloatMath.pow(x, 2) + FloatMath.pow(y, 2))] benchmark=Hypot_FloatMathSqrtPow} 1270.65 ns; σ=12.20 ns @ 6 trials [(float) Math.hypot(x, y)] benchmark=Hypot_MathHypot} 96.80 ns; σ=0.05 ns @ 3 trials [(float) Math.sqrt(x*x + y*y)] benchmark=Hypot_MathSqrtMult} 23.97 ns; σ=0.01 ns @ 3 trials [(float) Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2))] benchmark=Hypot_MathSqrtPow} 156.19 ns; σ=0.12 ns @ 3 trials Interpreter: benchmark=Hypot_FloatMathHypot} 1180.54 ns; σ=5.13 ns @ 3 trials benchmark=Hypot_FloatMathSqrtMult} 1121.05 ns; σ=3.80 ns @ 3 trials benchmark=Hypot_FloatMathSqrtPow} 3327.14 ns; σ=7.33 ns @ 3 trials benchmark=Hypot_MathHypot} 856.57 ns; σ=1.41 ns @ 3 trials benchmark=Hypot_MathSqrtMult} 1028.92 ns; σ=9.11 ns @ 3 trials benchmark=Hypot_MathSqrtPow} 2539.47 ns; σ=24.44 ns @ 3 trials Bug: https://code.google.com/p/android/issues/detail?id=36199 Change-Id: I06c91f682095e627cb547d60d936ef87941be692
* Reduce persist threshold for lower warning/limit.Jeff Sharkey2012-05-031-0/+4
| | | | | | | | | | Default is 2MB persist threshold, but even that can be substantial for devices on 100MB/month plans. This change gradually reduces the persist threshold up to 8x lower (256kb outstanding) based on lowest active policy. Bug: 5382676 Change-Id: Ief4e8cdb169bfb151a3d1b45722a8eaa01926508
* Add norm() and map() to MathUtils.Romain Guy2009-08-121-0/+8
|
* Make the laves follow the ripplesRomain Guy2009-08-091-1/+1
|
* Add new utility methods to rsScriptC_Lib, android.util.MathUtil and ↵Romain Guy2009-07-311-0/+168
android.graphics.Color. Fixes RS compilation.