Commit Graph

670 Commits

Author SHA1 Message Date
Mårten Kongstad
e0930d324c libandroidfw: add FALLTHROUGH_INTENDED to silence warnings
Add FALLTHROUGH_INTENDED to silence compiler warnings such as the
following:

-------- 8< --------
[ 42% 27/63] //frameworks/base/libs/androidfw:libandroidfw clang++
Locale.cpp
frameworks/base/libs/androidfw/Locale.cpp:166:7: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
      case 5:
      ^
frameworks/base/libs/androidfw/Locale.cpp:166:7: note: insert 'FALLTHROUGH_INTENDED;' to silence this warning
      case 5:
      ^
      FALLTHROUGH_INTENDED;
frameworks/base/libs/androidfw/Locale.cpp:166:7: note: insert 'break;' to avoid fall-through
      case 5:
      ^
      break;
1 warning generated.
-------- >8 --------

Test: 'make libandroidfw' builds with no compiler warnings
Change-Id: I6bc67f2c072f88c9f1a92b7378a6f1a460db70b4
2018-11-12 13:07:08 -08:00
Ryan Mitchell
45ac8e4002 Merge "Fix flaky idmap test" 2018-11-08 19:09:47 +00:00
Ryan Mitchell
c2b0782c37 Fix flaky idmap test
The entry pool is encoded in UTF-8 not UTF-16. This would cause stringAt
to return a pointer to a cache that holds the UTF-8 string converted to
UTF-16. If the cache becomes invalidated, the UTF-16 pointer is no
longer valid and causes seg faults when looked up.

Test: libandroidfw_tests
Change-Id: I0f13dbeadd0d148de2805efd6cadb8e220368e3b
2018-11-07 10:28:56 -08:00
Ryan Mitchell
5db396d5cc Only resolve non-dynamic resource references
Only resolve non-dynamic references and attributes if the package is
loaded as a library or if a shared library is attempting to retrieve
its own resources.

Bug: 116486668
Bug: 116620612
Test: libandroidfw_tests & manual test of broken apps
      & atest FieldsClassificationTest#testGetAlgorith

Change-Id: Icb827796a65072a39452dbe577d5e18f085ea4e2
2018-11-07 01:28:53 +00:00
Ryan Mitchell
3064067908 Merge "Copy common resources between styles" 2018-11-05 23:56:39 +00:00
Ryan Mitchell
b3ae42e976 Copy common resources between styles
The docuemntation of setTo states that the resources two styles from
different AssetManagers have in common will be set in the destination
theme. This change adds this functionality. The package ids of the
attributes, the package ids of reference values, and the cookie of
attribute values have to be rewritten to match the destination
AssetManager. This change can later be made more generic if rewriting
references between packages is needed elsewhere.

Bug: 115897657
Test: libandroidfw_tests and manual test of app specified in the bug
Change-Id: Iee999ea2cc8473168cac11aaf3c34e14c958e5ae
2018-11-01 17:01:28 -07:00
Chih-hung Hsieh
51025d638d Merge "Allow implicit-fallthrough warnings locally." am: 36afe11a64 am: 9c5738238d
am: 469705cca4

Change-Id: I4bc5f389495ed535762438632e65ccd6c66f3739
2018-10-25 17:58:17 -07:00
Chih-Hung Hsieh
e8abd06776 Allow implicit-fallthrough warnings locally.
It will be a global error by default.

Test: make checkbuild
Bug: 112564944
Change-Id: I26616fd50ccf3639fa7c01d850a14d079273ede7
Exempt-From-Owner-Approval: do not block on new warnings
2018-10-22 09:56:12 -07:00
Ryan Prichard
559dbd88c7 Merge "Change ZipArchiveHandle from void* to ZipArchive*" am: f79542efd3 am: a34a1e0c97
am: 498357670e

Change-Id: I4fe5a70c750328bb67cdc02a08e4f9eeb97ac20d
2018-10-15 22:05:59 -07:00
Ryan Prichard
a34a1e0c97 Merge "Change ZipArchiveHandle from void* to ZipArchive*"
am: f79542efd3

Change-Id: Iebca19f2757ae77c07eca46a721c6966621fea14
2018-10-15 19:06:02 -07:00
Ryan Prichard
3addcd3965 Change ZipArchiveHandle from void* to ZipArchive*
Bug: none
Test: m checkbuild
Exempt-From-Owner-Approval: owner is OOO for another week,
  it's a fairly minor change to this repository
Change-Id: If4cf57619034ab98b06115ca60beb2fb26c4cd19
2018-10-15 23:22:47 +00:00
Mårten Kongstad
62f3415ea6 Merge "libandroidfw: introduce ExecuteBinary (POSIX only)" am: 120b7fba93 am: 2a656b455d
am: dcef167772

Change-Id: I751a22f6610a103a32bbbb6925e12e5db6e4ca60
2018-10-10 19:12:19 -07:00
Todd Kennedy
c611199baf Merge commit 'c5e694e9549da3911392abd01bae125444f56294' into manual_merge_c5e694e9549da3911392abd01bae125444f56294
Change-Id: Ia48491cbcef8c3696c24619db2c3b7229f5bccc6
2018-10-10 12:48:14 -07:00
Mårten Kongstad
2a656b455d Merge "libandroidfw: introduce ExecuteBinary (POSIX only)"
am: 120b7fba93

Change-Id: I6e0b320e8887e32b8ea3fd1cfcf0804714fe1eb3
2018-10-09 16:08:34 -07:00
Mårten Kongstad
b7c0800fa0 Merge "libandroidfw: move ConfigDescription from aapt2 to libandroidfw"
am: b14c887974

Change-Id: I14be80a2d2c3620919a78da5a42ed56ec1d1737f
2018-10-09 16:04:34 -07:00
Mårten Kongstad
7672daf8e5 Merge changes from topic "idmap2-prerequisites"
am: 62a5d4249f

Change-Id: I8db3f5ba0de6510c3327273c56e9fcc75c836694
2018-10-09 16:00:31 -07:00
Treehugger Robot
120b7fba93 Merge "libandroidfw: introduce ExecuteBinary (POSIX only)" 2018-10-09 21:43:38 +00:00
Treehugger Robot
b14c887974 Merge "libandroidfw: move ConfigDescription from aapt2 to libandroidfw" 2018-10-09 21:43:38 +00:00
Treehugger Robot
62a5d4249f Merge changes from topic "idmap2-prerequisites"
* changes:
  AssetManager2: optionally keep non-matching configs
  AAPT2: optionally keep resources without default value
  libandroidfw: add resource ID iterator
2018-10-09 21:43:38 +00:00
Mårten Kongstad
668ec5bd3b AssetManager2: optionally keep non-matching configs
AssetManager2 maintains a set of configurations [as specified in the
resource blob] compatible with the currently set configuration [as
specified via SetConfiguration]. This helps optimize future resource
lookups by limiting the set of configurations to iterate over.

However, when creating idmaps, all configurations must be considered,
including those not compatible with the currently set configuration. Add
an optional flag to SetApkAssets to disable the optimization described
above.

Test: manual (will be tested by upcoming idmap2 implementation)
Change-Id: I7526a323ddf90e2f2f49c36e8c110a2cec25357e
2018-10-09 20:15:01 +00:00
Mårten Kongstad
5c541f6e36 libandroidfw: move ConfigDescription from aapt2 to libandroidfw
This is to allow idmap2 to access ConfigDescription.

Test: libandroidfw_tests
Test: aapt2_tests
Change-Id: I54210bbbd8dad5903cb7100807df977efa394ad5
Merged-In: I54210bbbd8dad5903cb7100807df977efa394ad5
2018-10-08 09:56:09 -07:00
Mårten Kongstad
24c9aa6541 libandroidfw: move ConfigDescription from aapt2 to libandroidfw
This is to allow idmap2 to access ConfigDescription.

Test: libandroidfw_tests
Test: aapt2_tests
Change-Id: I54210bbbd8dad5903cb7100807df977efa394ad5
2018-10-08 06:50:22 -07:00
Mårten Kongstad
2503a49b96 libandroidfw: introduce ExecuteBinary (POSIX only)
Introduce a wrapper around fork and exec.

Test: make libandroidfw_tests
Change-Id: Iff0de5319bb6bb101a3fbef6413dfb4e77198f11
2018-10-04 03:45:32 +00:00
Chih-hung Hsieh
3b761c6b3b Merge "Add noexcept to move constructors and assignment operators." am: 9166e89374 am: 15dcc77fee
am: 07a7250da3

Change-Id: I74a6b6e53ba4f22b79b855e146aa260b2eaddb27
2018-10-01 18:59:22 -07:00
Chih-hung Hsieh
15dcc77fee Merge "Add noexcept to move constructors and assignment operators."
am: 9166e89374

Change-Id: I079060ef610c2d90c57140f001225c163a3dd21a
2018-10-01 18:09:38 -07:00
Chih-Hung Hsieh
fc81626ba6 Add noexcept to move constructors and assignment operators.
Bug: 116614593
Test: build with WITH_TIDY=1
Change-Id: Ic3993d88eb3066aef402d74c4d543c56a1dfd5c3
2018-10-01 20:23:02 +00:00
Mårten Kongstad
3f1f4fc11d libandroidfw: add resource ID iterator
Add an iterator to LoadedPackage which allows the caller to iterate over
the resource IDs in the package. This will be used by idmap when
constructing the idmap file.

Bug: 78815803
Test: make libandroidfw_tests
Change-Id: Ia47daa21390d67ea2ef3665e88eb407837c4764f
2018-09-28 09:40:20 +02:00
Mårten Kongstad
2bb42051f0 Merge "ByteBucketArray.h: fix typo" am: b848ce8e20 am: 0bb76346f5
am: 50bec961b3

Change-Id: I1ff25b8a7ff8385646ef128ae41e9794b6313cf8
2018-09-12 17:41:10 -07:00
Mårten Kongstad
0bb76346f5 Merge "ByteBucketArray.h: fix typo"
am: b848ce8e20

Change-Id: I81aff763f5572b6c72e1a845fda518179cf95e15
2018-09-12 16:57:17 -07:00
Mårten Kongstad
cb54cd2dac ByteBucketArray.h: fix typo
Bug: 78815803
Test: builds, boots
Change-Id: I93d7ce5255911797d6afdb05caf0cf7dbfdc22b9
2018-09-11 14:24:40 +02:00
Chia-I Wu
0d8acf5a96 Fix widecg and hdr ordering in Configuration
Wide Gamut qualifier should be before the HDR one.

Bug: 78136980
Test: am get-config
Change-Id: If0f09ddb750d586d29b4cedcbab3d5981f393b92
2018-08-31 17:18:36 +00:00
Ryan Mitchell
b9b540baf1 AFW: Lookup shared library resource ids
Shared libraries were failing to retrieve correct resource ids from the
values of attributes in xml files. The packages of the shared ids were
not changed from 0 to their runtime assigned package ids.

Bug: 112776204
Test: atest FieldsClassificationTest#testGetAlgorithm
Change-Id: I509bc7632f5ec3e9b644e590934e6cf569a4d938
2018-08-24 10:11:01 -07:00
Dario Freni
4ce4679309 androidfw changes to support /product-services.
See CL I7a6a30bf8e8db9f2738594d187bb9148f138b8da for a more detailed
description of the change.

Test: see CL I7a6a30bf8e8db9f2738594d187bb9148f138b8da description
Bug: 80741439
Change-Id: I6cc9d713c07c319fc2ee1c531af41243bd1d4aee
2018-08-17 16:34:18 +00:00
Todd Kennedy
c7d7611719 Merge "Loosen resource file verification" into pi-dev am: cf0b127110
am: 60413d0697

Change-Id: I95400ba3a885605bc52df10968ef2b4adf7f90a6
2018-07-16 14:31:10 -07:00
Todd Kennedy
60413d0697 Merge "Loosen resource file verification" into pi-dev
am: cf0b127110

Change-Id: I0b4012085579aa172a1a3f5a83325f0827523af5
2018-07-16 14:15:09 -07:00
Todd Kennedy
28e663cbed Loosen resource file verification
Bug: 77808145
Test: Tried to install corrupt APK prior to the change, install failed
Test: Tried to install corrupt APK after the change, install succeeded
Test: atest CtsAppSecurityHostTestCases:CorruptApkTests
Change-Id: I19a69e52a17c1080beaf2cc575c32f564b1033a3
2018-07-16 20:52:55 +00:00
Ryan Mitchell
426f8d2db8 Merge "Fix DynamicRefTable::load security bug" into oc-mr1-dev am: 2b6805fedc am: 5ae85666ac
am: 6899839e07

Change-Id: I3920ae30c0fdd5ef5b1176476d769abb269d5844
2018-06-06 16:43:03 -07:00
Ryan Mitchell
6899839e07 Merge "Fix DynamicRefTable::load security bug" into oc-mr1-dev am: 2b6805fedc
am: 5ae85666ac

Change-Id: I64521a290482adb5ade95b641ce9c0c27031a814
2018-06-06 16:09:35 -07:00
Ryan Mitchell
5ae85666ac Merge "Fix DynamicRefTable::load security bug" into oc-mr1-dev
am: 2b6805fedc

Change-Id: I5ef0a789b16dc8aa0936d8fcca3917ce2f884d74
2018-06-06 15:50:57 -07:00
Ryan Mitchell
18a6ada4aa Fix DynamicRefTable::load security bug
DynamicRefTables parsed from apks are missing bounds checks that prevent
buffer overflows. This changes verifies the bounds of the header before
attempting to preform operations on the chunk.

Bug: 79488511
Test: run cts -m CtsAppSecurityHostTestCases \
        -t android.appsecurity.cts.CorruptApkTests

Change-Id: I02c8ad957da244fce777ac68a482e4e8fa70f846
Merged-In: I02c8ad957da244fce777ac68a482e4e8fa70f846
2018-06-05 22:05:11 +00:00
Ryan Mitchell
65bed52d7d Merge "ResStringPool: Prevenet boot loop from se fix" into pi-dev am: 8dd9ef190b
am: 9964297b44

Change-Id: Ib041932219d47504743fe82dc4a7f77ac1d9f630
2018-05-22 14:27:58 -07:00
Ryan Mitchell
9964297b44 Merge "ResStringPool: Prevenet boot loop from se fix" into pi-dev
am: 8dd9ef190b

Change-Id: I0000c4a3f06e002804aa7172505e07bb57c550c6
2018-05-22 14:16:13 -07:00
Ryan Mitchell
f05f47b2c1 ResStringPool: Prevenet boot loop from se fix
Changes the logs adding in a previous security fix to warnings so
devices with malformed APKs currently on them will not undergo DOS when
they are upgraded to P.

Bug: 79724567
Test: run cts -m CtsAppSecurityHostTestCases \
          -t android.appsecurity.cts.CorruptApkTests

Change-Id: Ied54e4bb14abdaf79da562022c7ea6075187c1f8
2018-05-21 13:59:23 -07:00
Ryan Mitchell
d692b8665e Merge "ResXMLTree: Clone DynamicRefTable on creation" into pi-dev am: fd37ec90b8
am: b3da3a9673

Change-Id: Ic715bc6db56328c47da4a30a3e46ea92bbf10f92
2018-05-21 12:06:13 -07:00
Ryan Mitchell
b3da3a9673 Merge "ResXMLTree: Clone DynamicRefTable on creation" into pi-dev
am: fd37ec90b8

Change-Id: I3030d62104142b33dfb9844faa2fcb9840d8ee61
2018-05-21 11:53:56 -07:00
Dan Willemsen
f97d380ca7 Merge "Convert to Soong" am: acbd94d76f am: b1005a8a2a
am: d00c851e55

Change-Id: I889b5d31535d927b3aa9cf5ad6af955ca0678356
2018-05-15 15:52:51 -07:00
Ryan Mitchell
a41e66af58 ResXMLTree: Clone DynamicRefTable on creation
XmlBlocks are cached in ResourcesImpl::loadXmlResourceParser(...) and
when asset manager invalidates itself, the references to the dynamic
reference tables point to garbage. Now, the reference table is cloned
when the XmlBlock is created so invalidation will not affect the
XmlTree.

Bug: 74240254
Test: Tested GoogleMaps on 9.75.7 and saw crashes stop
Change-Id: I932db7a85fddc640c4d6ec327f534b5a1ad6d0b1
2018-05-15 15:08:58 -07:00
Dan Willemsen
d00c851e55 Merge "Convert to Soong" am: acbd94d76f
am: b1005a8a2a

Change-Id: If5cb26e0669f79240d8fee1d40aaa2162d8e611f
2018-05-15 15:06:19 -07:00
Dan Willemsen
4888b1f6f0 Convert to Soong
See build/soong/README.md for more information.

Test: m libframeworks_coretests_jni
Test: m FrameworkCoreTests_install
Test: m libshim_jni
Test: m CtsShimPrivUpgrade
Test: m libfilterfw
Test: m PMTest_Java_dual
Test: m libdefcontainer_jni
Test: m libperftestscore_jni
Test: m libpmtest32 libpmtest64
Test: m libprintspooler_jni
Test: m libsmartcamera_jni
Test: m idmap
Test: m libdrmframework_jni
Test: m libdvr_loader com.google.vr.platform com.google.vr.platform.xml
Test: m libfilterpack_imageproc libfilterpack_base
Test: m libwebviewchromium_loader
Test: m shared_mem_test
Test: m test-touchlag
Change-Id: I868561dd237fa28647896d59049ab9260373ada1
2018-05-14 16:47:02 -07:00
Ryan Mitchell
96930e4faa Merge "AAPT: Fixed split resource dumping" into pi-dev am: fb07d82086
am: d94160943d

Change-Id: Idfef5422bbe3a3e46ceb1951e6393d2c80852930
2018-05-08 11:01:37 -07:00