7 Commits

Author SHA1 Message Date
Adam Lesinski
32e7501a27 Fix support for @empty in style resolution
If @empty is encountered in XML, do not fallback
to searching through the theme.

Bug: 36891052
Test: make aapt2_tests
Test: bit CtsContentTestCases:android.content.res.cts.TypedArrayTest
Change-Id: Ie3bf7b70af9c7913513a1092afd95d26bec5e635
2017-05-11 11:28:29 -07:00
Mark Salyzyn
6f773a0d87 Replace cutils/log.h and android/log.h with log/log.h
Test: compile
Bug: 34250038
Change-Id: I42185a879beaa9bb244f53a968800392b854ac45
2017-01-12 20:29:11 +00:00
Adam Lesinski
06d3e8fec7 libandroidfw: Revert null check in ApplyStyle
The out parameter `out_indices` is expected to be non-null
and so the extra null check adds a cost to performance
and opens the door to misusing the API by not supplying
`out_indices`.

Test: make libandroidfw_tests
Change-Id: Ie66fd837c5e24ec2838156e7b67f54c15cd27933
2017-01-06 16:51:48 -08:00
Adam Lesinski
4c67a475a3 Make tests use APKs instead of exploded APKs
Tests would expect parts of the APK to be unzipped and
maintained. Instead, we now decompress the required files
from the test APKs on test setup. This simplifies
test maintenance substantially.

Test: make libandroidfw_tests && libandroidfw_tests --testdata=frameworks/base/libs/androidfw/tests/data
Change-Id: I3d2100af22df913e02401dedcf9842cdb32b2a3b
2016-12-05 19:03:47 -08:00
John Reck
f32adf4475 Clean up ApplyStyle JNI
Bug: 32573798

Mark input uint32_t[] as const. Use Read-only JNI
array access for input as it's faster than critical access.

Use non-movable arrays for TypedArray so that the address can
be resolved and stored, avoiding the need to do JNI array
access for the output.

Indicies is always non-null, so remove the optional checks.

Eliminate unused return value.

Benchmark results:
twelveKeyInflate 4963us -> 4713us
simpleViewInflate 73us -> 60us

Test: Device boots, benchmarks show faster

Change-Id: Ic3bde5aee31407d8903913f97f2218daf074499a
2016-12-02 12:49:20 -08:00
Adam Lesinski
7a37b74d37 Add tests for attribute resolution
- Adds unit tests for attribute resolution. These include
  some test data resource tables and compiled XML files.
- Convert touched files to Google style guide.

Test: make libandroidfw_tests
Change-Id: Ib3a36061dc874de5f6a266b4e82c0a12ef435f23
2016-10-17 18:33:42 -07:00
Adam Lesinski
4452e137ff Move attribute resolution from core/jni to libandroidfw
Without the entire JNI environment, testing the attribute
resolution code will be much easier and enable safer
refactoring.

Change-Id: I2815cc1e10a694a3b01bc37e191a0d5e9d0e6735
Test: Existing CTS tests pass
2016-10-12 07:47:28 -07:00