summaryrefslogtreecommitdiff
path: root/tools/layoutlib/bridge/src/android/util
AgeCommit message (Collapse)Author
2017-05-10Removing layout from frameworks/baseDiego Perez
The directory is being moved to its own project in frameworks/layoutlib Bug: 36889565 Test: Built manually Change-Id: I69a1a826d0bac8ede1f9a337c9c1d930bbcd04f3
2017-03-30Make layoutlib more lenient with recoverable errorsDiego Perez
In many cases, throwing an exception will stop the inflation or rendering of a layout. Sometimes, we could recover from some of the failures and render a layout that is "usable". I've done a first pass trying to follow the following rules: - Try simple recoveries by choosing sensible defaults. Not trying complex recoveries. - Only recover if the exception is not part of the class behaviour. Avoided removing declared exceptions or exceptions that are expected by the framework. - I've kept assertions in place so, in most cases, the behaviour will be almost identical to the previous one with assertions enabled. Test: Checked with existing tests Change-Id: I0001fdd3c808cf405c4eb8d734b9bbe63493e05c
2017-02-07Fix support for enum attributes in BridgeContextDiego Perez
Test: Updated BridgeXmlPullAttributesTest Bug: http://b.android.com/231347 Change-Id: I5fd8b46155ccea6c9b65787f311a0887fa4b4806
2016-04-12Fix broken delegates for FontFamily and PathParserDiego Perez
The theme editor is throwing an exception with the last embedded layoutlib because a missing method. Added also another missing method in FontFamily. Change-Id: I710ba7618df6444a3185b581cdc5dc8400f7c604
2016-03-02Implement native methods in VectorDrawableDiego Perez
Most of the VectorDrawable implementation has been moved to native code. This CL implements most of the required functionality that existed in Marshmallow. Change-Id: I009bcd5c166f2bfa0795d2718fabab4a549eba9f
2016-02-18LayoutLib fixes for NDeepanshu Gupta
Moves LayoutLib to Java 8 - YAY! Fix delegates Change-Id: I098996e43e330e995d33f12df1c16355bbc02f0f
2015-05-13Remove kxml dependency.Deepanshu Gupta
Create XmlPullParser using callback provided by the client. This enables clients to choose which XmlPullParser implementation they want. Change-Id: I9ad97a4777820cdbe5c8fc3716f74ddec9065c70
2015-04-16am 1f3c7f3f: am f18ceefc: am cd6e00c6: Merge changes from topic ↵Deepanshu Gupta
\'layoutlib-api-15\' into lmp-mr1-dev * commit '1f3c7f3f500bdbfd790c20872961d84ef617f066': Update golden image for tests. Update to using LayoutlibCallback. Remove implementation of deprecated method. Add @empty support.
2015-04-15Update to using LayoutlibCallback.Deepanshu Gupta
Change-Id: Ia89d418b0d40ca8efef8968a4a2a635616b945ac
2014-10-02resolved conflicts for merge of ee665151 to lmp-mr1-dev-plus-aospNeil Fuller
Change-Id: I2588c65b7a9fa43f968151a206924a804f0595a7
2014-10-01Switch from FloatMath -> Math and Math.hypot where possibleNeil Fuller
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
2014-08-12Resolve color xml attributes properly.Deepanshu Gupta
Color attributes were not being converted to int properly. The conversion to int was a simple string to int using base 16. This change resolves the colors as per #RGB, #ARGB, #RRGGBB or #AARRGGBB format depending on the length of the attribute. All values that begin with '#' are treated as colors. Bug: http://b.android.com/73845 Change-Id: I8ad089b821af1e290b9b95771b50213fe2fdd784
2014-05-22Layoutlib fixes for LDeepanshu Gupta
This adds the new delegates that were missing. This starts the work on changes related to Minikin Fonts. There are some changes related to TypedArray that still need to be fixed. Change-Id: Ic2397b64aa3f1f48926e849b14689c47d9ee7f8c
2014-01-27Revert "Move frameworks/base/tools/ to frameworks/tools/"Adam Lesinski
This reverts commit 9f6a119c8aa276432ece4fe2118bd8a3c9b1067e.
2013-08-28Move frameworks/base/tools/ to frameworks/tools/Mike Lockwood
Change-Id: I3ffafdab27cc4aca256c3a5806b630795b75d5c8
2012-11-07am 768d9e1a: Merge "Correct executable bit for source files"Kenny Root
* commit '768d9e1a72ceee7d4a5f608776b87b62d6ce4a04': Correct executable bit for source files
2012-11-07Correct executable bit for source filesKenny Root
Many media files and source code files were marked as executable in Git. Remove those. Also a shell script and python script were not marked as executable. Change-Id: Ieb51bafb46c895a21d2e83696f5a901ba752b2c5
2012-09-04Add some new native deletage to layoutlib.Xavier Ducrohet
Change-Id: Ib53df6c944ecd9680bf929afe03b08bcaa61ad70
2012-07-10Replace LruCache implementation for layoutlib. do not merge.Xavier Ducrohet
The android version depends on a custom version of LinkedHashMap which is not present on desktop VMs. This new implementation is done in a way that minimizes the difference between the two. Also some minor fixes. (cherry picked from commit 01b6c755dbcf24e71192dc44757e2eea2a426091) Change-Id: Idc7bca820e472e281a3024a5b610fd55606cf428
2012-07-10Replace LruCache implementation for layoutlib.Xavier Ducrohet
The android version depends on a custom version of LinkedHashMap which is not present on desktop VMs. This new implementation is done in a way that minimizes the difference between the two. Also some minor fixes. Change-Id: Ib27b0419f9d0e6ba4d4abb26b2ccd968af59eba8
2012-02-21Make sure resource references are resolved.Xavier Ducrohet
XmlPullAttribute can query for attributes and return them in a given format. We need to make sure they are first resolved before trying to convert them to int/float/boolean/... Change-Id: I2aaced022a0382e501978c396e49d6191d53bdc8
2011-08-11Make some methods/fields package private so that layoutlib can access them.Xavier Ducrohet
Change-Id: I4aeadfbaf8a4f6a459fa19937c21ac23d9e5fb64
2011-08-09Implement native println_native in android.util.Log for LayoutLibPhilip Milne
Change-Id: I2ab83a131468490cf789bf17f9c12b6360e953a4
2011-02-09LayoutLib: Annotate the custom delegate methods.Xavier Ducrohet
Every method implementing a delegate needed by the layoutlib_create bytecode modification must now be annotated with LayoutlibDelegate. The methods in the original source code that are delegated are already automatically annotated. Now with the implementations being annotated we can do bi-directional tests and find not only missing implementations but also dead obsolete code. This will be useful when backporting to earlier versions of Android, or when native (non public) method disappear. In fact, the new test detected one such method in Shader. Change-Id: I491708b68ac2736ca5669aa86cd5e930a00f9db3
2010-11-11Layoutlib: New bridge implementation using the new API 5.Xavier Ducrohet
Since the new API prepare for stateful layoutlib, major reorganization of the code. New "android" sub-package for all extended android classes. Also moved BridgeInflater in here so that all extended classes are in this package. Only delegates and classes replacing renamed classes are in their original android.* packages. Also created full file for the empty implementations of IWindow and IWindowSession. New "impl" for the dirty work implementation. Main package contains the basic implementation of the API. Most of the code that was in Bridge is now in .impl.LayoutSceneImpl, with the main init/inflate/render code split into the contrustrutor, inflate() and render(). Change-Id: Ie15b15e5a1b2388cd6ef82e518345b1fc02ec981
2010-11-03Layoutlib native delegate: FloatMath.Xavier Ducrohet
While the difference is pretty minor since it's a small class, the point is that the unit test will ensure that we detect new methods added to FloatMath more easily. Change-Id: Ia8bfee231cc4ae0cfeb18692be86d02649c187d5
2009-03-03auto import from //depot/cupcake/@135843The Android Open Source Project
2009-03-03auto import from //depot/cupcake/@135843The Android Open Source Project
2008-10-21Initial ContributionThe Android Open Source Project