Commit Graph

986 Commits

Author SHA1 Message Date
TreeHugger Robot
a76a6cc3bc Merge "Dump theme inheritance information in UnsupportedOperationException" 2021-12-14 05:45:31 +00:00
TreeHugger Robot
9014bfd74d Merge "add libandroidfw_tests back to TEST_MAPPING" 2021-12-14 04:37:30 +00:00
Felka Chang
00964e9aea Dump theme inheritance information in UnsupportedOperationException
It isn't enough to only dump the theme id and name because there is
no whole theme inheritance map. Developers need the map to figure out
why the attribute value is so strange.

A theme is a kind of style. This patch creates an API to retrieve the
parent id for any style.  And, it dumps the whole inheritance between
themes until it can't find the parent style.

Test: manual test described in b/209708201#comment5
Bug: 209708201

Change-Id: I9de0e6e9aaeff7cb9fc89dc9b8a04925e84f975c
2021-12-14 11:42:30 +08:00
Victor Chang
6fa65b01b0 Merge changes from topic "icu70" am: da0880a0fe am: 4bd88f5cd6 am: fd779286da am: 14682b1f76
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1914692

Change-Id: I0fc0a3a2afb0f3ec796cdcc686a8796daa194a16
2021-12-09 11:40:59 +00:00
Victor Chang
14682b1f76 Merge changes from topic "icu70" am: da0880a0fe am: 4bd88f5cd6 am: fd779286da
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1914692

Change-Id: Ic1df8684bec29041368790400232c42599b11188
2021-12-09 11:11:30 +00:00
Victor Chang
fd779286da Merge changes from topic "icu70" am: da0880a0fe am: 4bd88f5cd6
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1914692

Change-Id: Ie7aaa680ad81f065d9d3d2d38928092e9ee3aa38
2021-12-09 10:44:14 +00:00
Victor Chang
4bd88f5cd6 Merge changes from topic "icu70" am: da0880a0fe
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1914692

Change-Id: Ibbdc18a918397f831eac512394bd31e9f1038c18
2021-12-09 10:20:52 +00:00
TreeHugger Robot
1c376943ee Merge "Add missing size check when parsing staged aliases" into sc-qpr1-dev am: 81e1e9b53b
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/16371979

Change-Id: I04bc0f2026f7780fc27bd3e4c9250edea898673f
2021-12-07 20:06:53 +00:00
TreeHugger Robot
5b0a126114 Merge "Add missing size check when parsing staged aliases" into sc-v2-dev am: 067e59bbf6
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/16371987

Change-Id: I3b6895218f9b6b0d2a83a4bf94881cd1fb588758
2021-12-07 20:06:12 +00:00
TreeHugger Robot
067e59bbf6 Merge "Add missing size check when parsing staged aliases" into sc-v2-dev 2021-12-07 19:45:44 +00:00
TreeHugger Robot
9bd21329dd Merge "Fix segfault with sparse encoding" into sc-v2-dev am: 829f7d5ebf
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/16378785

Change-Id: Ia19e4bc608b97718bb61c474b091103412788545
2021-12-03 21:39:38 +00:00
Jason O'Brien
74f78adb63 Fix segfault with sparse encoding
The native code that underlies `Resources#getIdentifier()` did not take
sparse encoding into account when calculating offsets, resulting in
either garbage or SEGV_MAPERR whenever a resource is first encountered
in a sparsely encoded configuration.

Bug: 197976367
Test: atest libandroidfw_tests --host
Change-Id: Ib7550fe2e05005550f59129a06be5712b74bc9c8
(cherry picked from commit 984e897303)
2021-12-02 14:59:52 +00:00
TreeHugger Robot
32cb668a40 Merge "Fix segfault with sparse encoding" 2021-12-02 11:01:15 +00:00
Yurii Zubrytskyi
85b3e879f8 Add missing size check when parsing staged aliases
Need to have the same kind of data size check as in other
types parsing

Bug: 203938029
Test: manual
Change-Id: I9f5d2851ff59da90163ead6c0416f0bba3868cc4
Merged-In: I9f5d2851ff59da90163ead6c0416f0bba3868cc4
(cherry picked from commit 8002034e6b)
2021-12-01 17:18:08 +00:00
Yurii Zubrytskyi
abdf5a518d Add missing size check when parsing staged aliases
Need to have the same kind of data size check as in other
types parsing

Bug: 203938029
Test: manual
Change-Id: I9f5d2851ff59da90163ead6c0416f0bba3868cc4
Merged-In: I9f5d2851ff59da90163ead6c0416f0bba3868cc4
(cherry picked from commit 8002034e6b)
2021-12-01 17:17:07 +00:00
Yurii Zubrytskyi
7274246272 Cleanup the resources parsing a bit
Bug: 203938029
Test: manual
Change-Id: Ib4d87bc7ee3fbea9be65302ad8ca7a8759b20d62
2021-11-30 00:19:48 -08:00
Yurii Zubrytskyi
8002034e6b Add missing size check when parsing staged aliases
Need to have the same kind of data size check as in other
types parsing

Bug: 203938029
Test: manual
Change-Id: I9f5d2851ff59da90163ead6c0416f0bba3868cc4
2021-11-29 23:55:24 -08:00
Victor Chang
074f226a06 Regenerate LocaleDataTables.cpp due to ICU 70 upgrade
The command:
./tools/localedata/extract_icu_data.py $ANDROID_BUILD_TOP > libs/androidfw/LocaleDataTables.cpp

Bug: 63753963
Bug: 202948901
Test: m droid
Change-Id: Ib464dce7b4489853cb95c2104792d95f36d38249
2021-11-19 17:00:28 +00:00
Xin Li
10d9972786 Merge sc-qpr1-dev-plus-aosp-without-vendor@7810918
Bug: 205056467
Merged-In: I13199bc39e9445929195f3d15579cbffe94e92b0
Change-Id: I35fa3c6c2abf679c51033f1395a08d511ed8739f
2021-11-18 17:00:37 +00:00
Jeremy Meyer
8746f7797c Merge "Always select the next higher density bucket when picking resources" 2021-11-10 00:58:56 +00:00
Jeremy Meyer
3a619c86ee Always select the next higher density bucket when picking resources
This reverts commit 30715f3afc.

Reason for revert: roll forward with fix

Change-Id: I6d63e6fa508501f2d029eeb4647d4d70c152ceb3
Test: ran all previously failing tests locally
Fixes: 183136881
2021-11-09 22:00:17 +00:00
Treehugger Robot
b14671ef58 Merge "Update the resources owner files" am: 70d5485b28 am: bbf64f041e am: 2512fc7380 am: 187863655c am: 2999ac25fb
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1884705

Change-Id: Ib8678bba4656240da3298446d8c8b7359536d7ff
2021-11-09 18:32:23 +00:00
Yurii Zubrytskyi
4c87aec35f Update the resources owner files
Bug: 205633893
Test: n/a

Change-Id: Ib9cf70c9acb200e8019a6522cb6a85f85b760651
2021-11-08 16:25:33 -08:00
Jeremy Meyer
30715f3afc Revert "Revert "Revert "Always select the next higher density bu..."
Revert "Update getDrawableForDensity test to allow either of the..."

Revert submission 16132603-183136881

Reason for revert: causes post submit failures
Reverted Changes:
I42ff7cdee:Revert "Revert "Always select the next higher dens...
Id4a93f857:Update getDrawableForDensity test to allow either ...

Change-Id: Idcc4c7b909256c65bc0f4e7815bb2d9093e66830
2021-11-05 21:38:00 +00:00
Felka Chang
cc7c4597c2 add libandroidfw_tests back to TEST_MAPPING
libandroidfw_test is not triggered when ag/15987448 modify
libandroidfw.  After the experiments in b/180720568,
`cc_test { support_host: true}` should add back to TEST_MAPPING.

Test: atest --dry-run -p frameworks/base/libs/androidfw

Bug: 180720568
Bug: 178646865
Change-Id: I5c97c860670d57504f97ef10ad296fb57176fd5c
2021-11-03 15:39:06 +08:00
Jeremy Meyer
5ac5c9bc09 Revert "Revert "Always select the next higher density bucket when picking resources""
This reverts commit 932970c696.

Reason for revert: roll forward with fix

Change-Id: I42ff7cdee2ed84b55b25fbbaa68525fed43ebd9b
Test: updated and ran the failing test locally to confirm fix
Fixes: 183136881
2021-10-28 19:06:53 +00:00
Chuck Liao
6adeab2b5c Merge "Revert "Always select the next higher density bucket when picking resources"" 2021-10-21 04:56:31 +00:00
Chuck Liao
932970c696 Revert "Always select the next higher density bucket when picking resources"
This reverts commit 4924387749.

Reason for revert: DroidMonitor-triggered revert due to breakage https://android-build.googleplex.com/builds/tests/hub?tab=clusterView&clusterId=7006296665623803063, bug b/203718917

Change-Id: I4ac8d8fb9b4b39fe677fb3b2eac809f3443ed0fa
2021-10-21 04:41:51 +00:00
Jackal Guo
fc294d47aa Merge "Improve the debug info from overlay lookup" 2021-10-21 01:08:39 +00:00
Jeremy Meyer
d9dfc03096 Merge "Always select the next higher density bucket when picking resources" 2021-10-20 16:51:01 +00:00
Jeremy Meyer
4924387749 Always select the next higher density bucket when picking resources
Test: ran and updated Config_test.cpp
Fix: 183136881
Change-Id: Ife1575caedb2cf3fbc2d3659c34a52e1207575c6
2021-10-19 21:41:52 +00:00
Jackal Guo
4385785b74 Fix broken tests in libandroidfw_tests
Due to the output format changes, revise the PosixUtils_test to fix
the failures.

Fix: 203494455
Test: atest libandroidfw_tests
Change-Id: I6e84f8011031162f9e46aa89ddf8d3f3b9863251
2021-10-19 07:28:15 +00:00
Jackal Guo
552b45de1d Improve the debug info from overlay lookup
Print the best matching configuration from the given resource while
looking up for better understanding why an overlay isn't taken.

Bug: 193701453
Test: atest AssetManager2Test libandroidfw_tests
Test: manually install a target package has values and values-en,
      and an overlay package only has values. Then, use overlay
      lookup command to check if the output shows related info.
Change-Id: I0cb415b9e932e1d4bfd0be2e1768adeb78e7b7d0
2021-10-19 15:07:53 +08:00
Jason O'Brien
984e897303 Fix segfault with sparse encoding
The native code that underlies `Resources#getIdentifier()` did not take
sparse encoding into account when calculating offsets, resulting in
either garbage or SEGV_MAPERR whenever a resource is first encountered
in a sparsely encoded configuration.

Bug: 197976367
Test: atest libandroidfw_tests --host
Change-Id: Ib7550fe2e05005550f59129a06be5712b74bc9c8
2021-08-27 19:12:25 +00:00
vichang
adf183e252 Merge "Regenerate LocaleDataTables.cpp due to ICU 69 upgrade" am: 0c58210d59
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1802436

Change-Id: Iea1d86508410a7b2a06bd560ce71c53055673f33
2021-08-26 09:22:21 +00:00
vichang
0c58210d59 Merge "Regenerate LocaleDataTables.cpp due to ICU 69 upgrade" 2021-08-26 09:07:27 +00:00
Victor Chang
480f33c187 Regenerate LocaleDataTables.cpp due to ICU 69 upgrade
The command:
./tools/localedata/extract_icu_data.py $ANDROID_BUILD_TOP > libs/androidfw/LocaleDataTables.cpp

Bug: 195953235
Test: atest CtsIcu4cTestCases CtsIcuTestCases CtsLibcoreTestCases CtsLibcoreOjTestCases CtsBionicTestCases CtsTextTestCases
Change-Id: Idd4329a83a27bd550185e815dc5c92e3f2882d12
2021-08-19 15:04:14 +01:00
Colin Cross
304793a811 Rename ProcResult stdout and stderr fields
stdout and stderr are macros in musl, which causes build failures
when they are used as field names.  Rename the fields to stdout_str
and stderr_str.

Test: builds
Merged-In: I04770d2d6e82ca8393308ab12a304838a80f0ae5
Change-Id: I04770d2d6e82ca8393308ab12a304838a80f0ae5
2021-08-18 23:01:24 +00:00
Colin Cross
faa5e27652 Rename ProcResult stdout and stderr fields
stdout and stderr are macros in musl, which causes build failures
when they are used as field names.  Rename the fields to stdout_str
and stderr_str.

Test: builds
Change-Id: I04770d2d6e82ca8393308ab12a304838a80f0ae5
2021-08-17 15:01:14 -07:00
Kevin Jeon
9fd251e7cb Remove unnecessary log in CursorWindow.create
This change removes an unneeded debug log in CursorWindow that uses
0.37% of gms.persistent CPU.

Test: Build and flash
Bug: 184541591
Change-Id: I95683af27904db8d5ec61761dfda6d6d53ddbbef
2021-07-07 21:58:47 +00:00
Ryan Mitchell
015bca79f4 Merge changes I2710cfea,I03fb31ee,Iec512b31 into sc-dev
* changes:
  ResourcesImpl.ThemeImpl NativeAllocationRegistry
  Rebase ThemeImpl rather than reallocate memory
  Sparse native theme representation
2021-06-09 16:35:35 +00:00
Ryan Mitchell
767e34fb17 Rebase ThemeImpl rather than reallocate memory
Memory churn is high when swapping the ResourcesImpl of a Resources
object. Each time Resources#setImpl is invoked, all themes based on
that Resources object are assigned new ThemeImpl objects that are
created using the new ResourcesImpl.

ThemeImpls can only belong to one Theme object, so the old
implementation is discarded and the theme takes ownership of the new
ThemeImp.

This creates performance problems when framework overlays are toggled.
Toggling overlays targeting the framework causes all themes across all
processes to recreate and reallocate all of their themes. By rebasing
the ThemeImpl on the new ResourcesImpl without deallocating the native
theme memory, we reduce churn and produce less garbage that needs to
be garbage collected.

Bug: 141198925
Test: atest libandroidfw_tests
Test: atest ResourcesPerfWorkloads
Change-Id: I03fb31ee09c9cfdbd3c41bcf0b605607dab54ed7
2021-06-08 14:25:18 -07:00
Ryan Mitchell
3c6480c8d8 Sparse native theme representation
Themes are represented in the native layer using an array where the
entry id of resource ids are used to index into the array. This causes
native allocation size of a theme to correlate with the largest
attribute resource id in the styles applied to the theme.

From manual testing, I determined that on average in 1P apps and
system_server only 10-20% of the space allocated for themes actually
hold theme attribute values and the rest is empty/unused space.

Using std::vector and std::lower_bound to create a sparse array
representation will reduce amount of memory allocated by themes while
having a minimal impact on the performance of querying the attributes
defined in a theme.

From testing with ResourcesPerfWorkloads, this increased time spent in
the resources synthetic benchmarks by ~1%.

Bug: 141198925
Test: atest libandroidfw_tests
Test: atest ResourcesPerfWorkloads
Change-Id: Iec512b31b0545b0898ff248cd23f074a20fff45d
2021-06-08 09:12:32 -07:00
Dan Shi
4463194107 Remove ResourcesHardeningTest from Test Mapping
ResourcesHardeningTest is not a test module name.
This is a partial revert of ag/14505818

Bug: 189953380
Test: none
Change-Id: Iebf50714918d64eb52183c1f140ac8dba38b2ae5
2021-06-02 18:36:09 +00:00
Ryan Mitchell
488522c9c5 Merge changes from topic "inc-dis" into sc-dev
* changes:
  Disable incremental hardening on own resources
  StringBlock incremental hardening default values
2021-05-27 21:31:04 +00:00
Ryan Mitchell
cfb916e53e Verify presence of _FileAsset::getBuffer data
Rather than attempt to remove all users of Asset::getBuffer (which
includes AssetManager(1), aapt(1), and other places) and migrate  them
to use Asset::getIncFsBuffer, verify the presence of all the data in
the buffer before returning a raw pointer to the buffer data to
guarantee callers will not unexpectedly get a SIGBUS due to incremental
installation.

Bug: 179254882
Test: builds
Change-Id: I24fd9036bc53a8c23166b5471862ee542630fb56
2021-05-27 12:41:36 -07:00
Ryan Mitchell
c0416698db Disable incremental hardening on own resources
When an application is incrementally installed, and a resources
operation fails due to the resources not being fully present,
the app should crash instead of swallowing the error and
returning default values to not alter the experience of
using the application.

Disable IncFsFileMap protections on ApkAssets that are a part of the
application that is running (base and splits).

Bug: 187220960
Test: atest ResourcesHardeningTest
Change-Id: Ibc67aca688720f983c7c656f404593285a54999b
2021-05-27 09:50:36 -07:00
Patrick Baumann
43628ca24c Updates OWNERS files
Bug: 186864416
Test: Builds
Change-Id: I04dfc5c2c7143825334ebc62742e335b8c889492
2021-05-21 14:13:18 -07:00
Patrick Baumann
e6c0a4f8ce Updates OWNERS files
Bug: 186864416
Test: Builds
Change-Id: I04dfc5c2c7143825334ebc62742e335b8c889492
2021-05-14 15:45:42 +00:00
Ryan Mitchell
47fb18bed8 Merge "Set ApkAssets path for fabricated rros" into sc-dev 2021-05-13 22:33:17 +00:00