History log of /frameworks/base/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/ResourceHelper.java
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
d88c717b4e124e435e54bf1542774aa100773c3e 29-Mar-2017 Diego Perez <diegoperez@google.com> Make layoutlib more lenient with recoverable errors

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
/frameworks/base/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/ResourceHelper.java
ac873c9f25d2a687c9195226b9d680f51c91fa30 08-Mar-2017 Seigo Nonaka <nona@google.com> Clean up public FontConfig APIs

This CL contains following clean up:

- Hide unnecessary constructors.
- Change List<XX> to XX[] since actually all fields are immutable.
- Change font's variant type from String to int.
- Decouple resource related members to FontResourcesParser.
- Add NonNull/Nullable to all fields.

Test: ran android.content.res.FontResourcesParserTest

Change-Id: If456266ffff86d41342572a19662cc8f3cd13181
/frameworks/base/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/ResourceHelper.java
bc9d2a13f0bbeae4ebf04da5a0b0d2f7814b40e4 21-Nov-2016 Diego Perez <diegoperez@google.com> Add support for aapt:attr attributes

Test: Tested from the studio side
Change-Id: Id506801f53cfc976c7352bd7f9632804862668b7
/frameworks/base/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/ResourceHelper.java
789c4b4b14880621f05e7750f594b24bc93fcff9 13-Feb-2017 Diego Perez <diegoperez@google.com> Add dynamic font support

This CL allows loading fonts from resources.

Test: Added new fonts test
Change-Id: Ic82239121cc3f78f2a22b22de42e54575c1f2d98
/frameworks/base/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/ResourceHelper.java
fb175664469f1eb1bc598f54a7f86ff008e88b0e 27-May-2016 Diego Perez <diegoperez@google.com> Add support for AppCompat widgets

This allows previews to use appcompat attributes like
app:backgroundTint.

Bug: http://b.android.com/211349
Change-Id: Iaa5f1612c58a6a27d3948bfe1bc0373098c57720
(cherry picked from commit 2ddddbc86314fa16c51d0e5f0d6e55e0a6676d26)
/frameworks/base/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/ResourceHelper.java
cd6e47e4455cec8daa4570ac8073d93bd567d139 21-Mar-2016 Deepanshu Gupta <deepanshu@google.com> Add guard around getXmlFileParser() call

Prevents the need to update the LayoutLib API level.

Bug: http://b.android.com/202942
Change-Id: I507239148ab8d6d45406624dba569c8b7197f979
/frameworks/base/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/ResourceHelper.java
566b303365078fac9a454f1595add19e02631db3 01-Mar-2016 Diego Perez <diegoperez@google.com> Add support for GradientColor in layoutlib

Change-Id: Ia9a55a9e00d7ddb5263f3dbe46b5da8dde457526
/frameworks/base/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/ResourceHelper.java
fc8f4aad7395eca11f6d9b82eb266b1f4ee5041b 23-Jul-2015 Deepanshu Gupta <deepanshu@google.com> LayoutLib: translucent sys ui bars

Change-Id: I9c294329fc78418c505a5115bc9c07da29595af2
/frameworks/base/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/ResourceHelper.java
476e582d2ffdf25102d4c55f8c242baa3d21d37f 22-May-2015 Deepanshu Gupta <deepanshu@google.com> LayoutLib: Change nullity annotations.

Switch from using tools nullity annotations (com.android.annotations)
to android framework annotations (android.annotation).

A new sdk-common prebuilt is required for LayoutLib tests. The new
sdk-common requires an updated tools-common. The updated tools-common
doesn't have nullity annotations. So, instead of adding the annotation
dependency, just reuse the platform ones. This also paves the way to
include other platform annotations like IdRes etc.

Change-Id: I87b8f767d3681d914abe7d1329e26a87f49f50a7
/frameworks/base/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/ResourceHelper.java
5f1bf496948fb6383ae17e5467a26a00489d7564 18-May-2015 Deepanshu Gupta <deepanshu@google.com> Show better error message for color attr not found.

Change-Id: I1ca32989522d30fec336eb607ee81f9e5cb5f48f
/frameworks/base/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/ResourceHelper.java
4a605c6fa0027ee116beb29fbc9625721f0441f0 28-Oct-2014 Deepanshu Gupta <deepanshu@google.com> Use right theme for drawable inflation.

The theme information was lost when inflating drawables. As a result,
drawables inflated in the ActionBar did not have the right tint.

Change-Id: I13d5c78039e35085ed4902289fcb735bb15d972e
/frameworks/base/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/ResourceHelper.java
171804201dd556f8ce7ee7618661a5c8ee71507a 29-Sep-2014 Deepanshu Gupta <deepanshu@google.com> Always resolve enum when resolving resources.

Enums were resolved only for integers and dimensions. This change
resolves enums for all resource types. Well, almost all. For color and
colorStateList, enums are still not referenced.

Bug: http://b.android.com/76091
Change-Id: Ie43bd1b54fb9877655d31773bdf71d9a6a65c473
/frameworks/base/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/ResourceHelper.java
1a12b805698c7cba9c2daa78c76c055afbdfa9fc 27-Aug-2014 Deepanshu Gupta <deepanshu@google.com> LayoutLib: Fix warnings in ResourceHelper.

Fix intelliJ warnings in ResourceHelper. Most of them just change
boolean checks "x == false" with "!x".

Change-Id: I278645e2807affd8b3183a4a6f5e4fa2ab7b3d21
/frameworks/base/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/ResourceHelper.java
458f2a7bbbcc45d12b575fe9f3b2f8e1a20f9b1c 27-Aug-2014 Deepanshu Gupta <deepanshu@google.com> LayoutLib: Allow '+' in float attributes.

Earlier change to fix the invalid conditional check inadvertedly
disallowed '+'.

Change-Id: I75a37926681fe3a496482d6fb75161ac75326109
/frameworks/base/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/ResourceHelper.java
ca22ba9eafe4193d213c5897f9303d02062effb4 27-Aug-2014 Deepanshu Gupta <deepanshu@google.com> Fix invalid conditional check.

The check was always false. This wasn't really a problem since the regex
check later took care of it. But it's just wrong to leave such mistakes
in the code once they are noticed.

Change-Id: I84270a96141428bf15949ce8c881d2e4a2aa95f6
/frameworks/base/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/ResourceHelper.java
14bf0cef7eeed572a67c29a328581afac4decc20 12-Dec-2013 Deepanshu Gupta <deepanshu@google.com> Action bar rendering in layoutlib

This also makes a couple of changes to the framework:
1. ShareActionProvider - Use edit mode to execute activity chooser code.
2. WindowDecorActionBar - add a new constructor for use by layoutlib.

This also relies on some changes to the plugin to pass the correct params.

Change-Id: Ia30fef816afd91ec1e439734d56b59b1323bfee2
/frameworks/base/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/ResourceHelper.java
282e181b58cf72b6ca770dc7ca5f91f135444502 24-Jan-2014 Adam Lesinski <adamlesinski@google.com> Revert "Move frameworks/base/tools/ to frameworks/tools/"

This reverts commit 9f6a119c8aa276432ece4fe2118bd8a3c9b1067e.
/frameworks/base/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/ResourceHelper.java
9f6a119c8aa276432ece4fe2118bd8a3c9b1067e 28-Aug-2013 Mike Lockwood <lockwood@google.com> Move frameworks/base/tools/ to frameworks/tools/

Change-Id: I3ffafdab27cc4aca256c3a5806b630795b75d5c8
/frameworks/base/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/ResourceHelper.java
04ce81113107d2bfa0b8248b13145b4cf24cb943 10-Jun-2011 Xavier Ducrohet <xav@android.com> Bring in more layout lib changes from hc-mr1.

fe051bb2 : Change the way the layoutlib instantiate its XmlPullParser.

A lot of the init code was duplicated so I made a ParserFactory class.

Also created an extension of the KXmlPullParser to override toString().
This allows easier debugging when dealing with multiple parsers (which
is always the case).

Also added some (disabled) debugging printf to deal with parser stack
as it can be tricky figuring out which parsers are in the stack at
which point.

8969147c : Fix case where the int[] attrs doesn't directly match a styleable.

In the case of the FastScroller the int[] is a custom mix of attr
instead of a int[] that exists as R.styleable.foo.

This makes our reflection based mechanism used to find the styleable
fail, so instead we search for each attribute separately (like
we probably should have done from the beginning).

0c264b35: Fix various cases of getDimension to report error if unit is missing.

if getDimention###() is called for a string that has no unit,
then an error is output through LayoutLog, but the rendering keeps
going by using dp as a default.

0beb7eea: Make (Bridge)TypedArray.getInteger() call out to getInt()

Only getInt() resolved attribute flags/enum and I'm not sure why
there's two to begin with.
/frameworks/base/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/ResourceHelper.java
fb93ce9684120a36862b5b5e67b1865a652907e9 04-Jun-2011 Xavier Ducrohet <xav@android.com> Import the Layoutlib from hc-mr1.

This is squash commit of all the missing patches.

Change-Id: Ie081c46a173290646deddbde503a720d50c4400f
/frameworks/base/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/ResourceHelper.java
2fae858db55fc6984ef923a6226b9408c37c72cb 29-Mar-2011 Xavier Ducrohet <xav@android.com> LayoutLib: implement data binding for most AdapterView

Change-Id: I27be96ed2c37573eb22cfbb391d96b6137b3df8c
/frameworks/base/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/ResourceHelper.java
6f2fb570642189ec2b6068632c25f02391007bb5 08-Mar-2011 Xavier Ducrohet <xav@android.com> LayoutLib: Fix dimension parsing to handle negative value.

Also make TypedArray.getDimensionPixelSize properly
handle negative values (which are not allowed).

Change-Id: I960fc1c9e8ad97852d4a14e4f0f71a2c2034b4e7
/frameworks/base/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/ResourceHelper.java
02d2b5a4031c80bfe1012ce2f4f7b3695762abd9 14-Feb-2011 Xavier Ducrohet <xav@android.com> LayoutLib: When possible ensure parsers are popped from the stack.

Some parser consumers (seems to be mostly resource inflation)
don't use the pull parser up to the END_DOCUMENT tag, making
the parser not pop itself from the parser stack automatically.

This is likely due to the XML resources being very shallow (1-2 levels
max), and the inflater just reading the content that it expects instead
of parsing till the document is done.

This ensures that *some* parsers are pop'ed from the stack when
used. Some other parsers we don't really control and hope the
user will parse till END_DOCUMENT.

Change-Id: Ie1f5762983fed2b2ae97b896218ae12b493e7ad9
/frameworks/base/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/ResourceHelper.java
13bdc3355c781dc2614f2810a42d3a9e73f5bed9 06-Feb-2011 Xavier Ducrohet <xav@android.com> LayoutLib: improved rendering for system/title/action bars.

Change-Id: I926531e9ad4a7b98e04e23cac3837794f7c89449
/frameworks/base/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/ResourceHelper.java
bbbb8326020368958a3f1d248878329e9d6b10c0 28-Jan-2011 Xavier Ducrohet <xav@android.com> LayoutLib: render system/title/action bars.

Also a few generic fixes in the layoutlib itself to support
this.

Change-Id: Ie3f24c9056bd3cc72f39f8a4f2c0861be15bff55
/frameworks/base/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/ResourceHelper.java
b353495192ba1acce94b8ab8aeeffe3c9a3bcfac 28-Jan-2011 Xavier Ducrohet <xav@android.com> LayoutLib: update with Pair API.

Change-Id: Iba945153f7544872ea84e3311584223aea740e2e
/frameworks/base/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/ResourceHelper.java
35ea7cd4c0c89122fda0b57af20061645082ffb9 28-Jan-2011 Xavier Ducrohet <xav@android.com> LayoutLib: Update with the new resource map APIs.

Change-Id: I30d83c2bb4569513f4f5e22670cffe938706f105
/frameworks/base/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/ResourceHelper.java
16584225125acba18b74920b902c798dfead0328 28-Jan-2011 Xavier Ducrohet <xav@android.com> LayoutLib: Properly compute available space to layouts.

Also display placeholders for status/title/action bars depending
on if the app is a tablet and its theme.

Change-Id: I651c1a2e5cfde165e004c11b236e6df056853dec
/frameworks/base/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/ResourceHelper.java
51a7e5447de94791c464cda5cc6ebbf616d73c80 15-Jan-2011 Xavier Ducrohet <xav@android.com> LayoutLib: update logs to use new data bundle

Also change some resource.resolve tags to resource.format

Change-Id: I3f0b0d2eb69a5ec98375e4014a3bb1bfceb8c855
/frameworks/base/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/ResourceHelper.java
918aaa5717fce6081557c82ce1c439b6922737d5 13-Jan-2011 Xavier Ducrohet <xav@android.com> LayoutLib: Use the new log tag constants from LayoutLog

Change-Id: I29dd578ae16405358d3673caf13528be393f0967
/frameworks/base/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/ResourceHelper.java
56222cfbe9973c518f7e8c9113c614de80b5a4b2 13-Jan-2011 Xavier Ducrohet <xav@android.com> LayoutLib: use tags in logs.

Change-Id: Ib85272249d285ecef409bf063903bcd91514a424
/frameworks/base/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/ResourceHelper.java
6c740cf71e5ce5ba7c8493c545c3a57c57ac7024 11-Jan-2011 Xavier Ducrohet <xav@android.com> LayoutLib: Improve error reporting.

Change-Id: I37cad7e2efb959202960c57b271c55c759867139
/frameworks/base/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/ResourceHelper.java
19a021038f2f4683dddef651543d7298f5bd7218 16-Dec-2010 Xavier Ducrohet <xav@android.com> LayoutLib: Update layoutlib with revised API.

Change-Id: I78929df621f48e85d9cbefe1f5590f9ce99bbaff
/frameworks/base/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/ResourceHelper.java
90c6b7e639921e264ac65699439578bcbdbf583a 14-Dec-2010 Xavier Ducrohet <xav@android.com> LayoutLib: Use the new ninepatch API to suppor density.

LayoutLib now compiles against a prebuilt of ninepatch.

Change-Id: I0a1ca60af90933c171ab3aa456b47f0329df2f55
/frameworks/base/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/ResourceHelper.java
ffb42f6c5043de226f02318a1311669d35a90711 10-Dec-2010 Xavier Ducrohet <xav@android.com> LayoutLib: Adapt to new LayoutLib

API now uses ResourceValue instead of IResourceValue
Capabilities renamed Capability

Change-Id: Ia5d2b6c8d536e020a1f5496fb2285f67fc4346c4
/frameworks/base/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/ResourceHelper.java
168677c9e2f8438ec5687e3c6b0e41b986c5b230 06-Dec-2010 Xavier Ducrohet <xav@android.com> LayoutLib: Fix logging.

- Use the new logging API
- remove log object reference everywhere but in Bridge
- all logging code accesses Bridge.getLog()
- prepareScene sets the current scene log object in Bridge.

Change-Id: Ib0517ccd6454c4baf218b6baa978a126f91671e7
/frameworks/base/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/ResourceHelper.java
2d56b273ef6e2984a4e8914fb67772b173d0a154 23-Nov-2010 Xavier Ducrohet <xav@android.com> Layoutlib: use default nine patch classes.

Move away from using our own implementation of NinePatchDrawable.
Now use native delegate for a few methods of NinePatch.

The byte[] used to describe the 9-patch chunk is entirely controlled
by the delegate. Therefore, while the default version (JNI) use the
array as a representation of a C struct, this version uses the array
as a serialized version of NinePatchChunk.

A cache mechanism using SoftReferences allows us to not deserialize
the array every time rendering needs to access the chunk itself.

The Bridge-level cache mechanism for bitmaps and nine-patches as
changed. Since the new nine-patches doesn't hold the bitmap
data anymore (it's stored in a normal Android bitmap which
is cached itself through the cache), then the nine-patch cache
has been changed to only contain the nine patch chunk.

Also initialize the canvas with the display metrics to prepare
for correct scaling when density of the assets don't match the target
density.

Still to come: actual density support in the 9-patch drawing code.

Change-Id: Ibefcccf4432e1986e8436e0c41a0107741593536
/frameworks/base/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/ResourceHelper.java
c2e9651bf386a1f7bf7fc706cf5424950570470c 10-Nov-2010 Xavier Ducrohet <xav@android.com> Layoutlib: New bridge implementation using the new API 5.

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
/frameworks/base/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/ResourceHelper.java