Commit Graph

1050 Commits

Author SHA1 Message Date
Ryan Mitchell
98b076b85d Merge "Do not rename R.java package" into rvc-dev am: 5c8dd641ba
Change-Id: I4a15555cf1df7c81a4d4eea2c77ec0d71df5c44f
2020-05-08 17:46:11 +00:00
Ryan Mitchell
5c8dd641ba Merge "Do not rename R.java package" into rvc-dev 2020-05-08 17:37:46 +00:00
Ryan Mitchell
2b7e847ac9 Do not rename R.java package
When the --rename-resources-package flag is used, only rename the
package name within the resources.arsc. Generate the R.java under
the package name defined by the manifest unless --custom-package is
used.

Bug: 147434671
Test: manual
Change-Id: Id9d10e16f32533da1b67ab72ac846791526e7a76
2020-05-06 11:26:48 -07:00
Svet Ganov
38cd221d81 Updating platform SDK version for R
* Finalize resources
  * Update appt/aapt2 constants
  * Update R and SDK constants
  * Fix a crashloop bug

Test: build + boot

bug:150281259

Change-Id: Ie56e12336cd1fcf347ac7164f6988b0c2da77c7d
Merged-In: Ie56e12336cd1fcf347ac7164f6988b0c2da77c7d
2020-05-03 09:58:54 -07:00
Svet Ganov
87ccbfaa46 Updating platform SDK version for R
* Finalize resources
  * Update appt/aapt2 constants
  * Update R and SDK constants
  * Fix a crashloop bug

Test: build + boot

bug:150281259

Exempt-From-Owner-Approval: merge conflict resolution

Change-Id: Ie56e12336cd1fcf347ac7164f6988b0c2da77c7d
Merged-In: Ie56e12336cd1fcf347ac7164f6988b0c2da77c7d
2020-05-02 14:26:57 -07:00
Ryan Mitchell
0e360fad3b Merge "Treat non-integer target SDK as version 10000" into rvc-dev am: 7adb6a1c58
Change-Id: I67f066baf0b850817fda00c68a21ace85f6bfb3d
2020-04-30 20:29:11 +00:00
Ryan Mitchell
7adb6a1c58 Merge "Treat non-integer target SDK as version 10000" into rvc-dev 2020-04-30 20:19:49 +00:00
Ryan Mitchell
95f024289b Treat non-integer target SDK as version 10000
Currently aapt2 treats non-integer target SDK values as SDK level 0.
This resulted in incorrect implied permission dumps. This change
causes aapt2 to treat non-integer SDK values as version 10000.

Bug: 155391001
Test: aapt2 dump badging CtsSkQPTestCases.apk
Change-Id: Ie4312a827974a7a10b40b12f8f23d264d1b1999a
2020-04-30 10:31:14 -07:00
TreeHugger Robot
136b08c06f Merge "aapt2: Add command to rename overlay "targetPackage" attribute" into rvc-dev am: 6839fc74b6
Change-Id: I3aa0d0ec7107cb20f026e03fc0bf3ad3805c0cba
2020-04-27 22:55:31 +00:00
Roshan Pius
ae12ce4119 aapt2: Add command to rename overlay "targetPackage" attribute
Bug: 154960712
Test: atest ManifestFixerTest
Change-Id: I556fc11e271337de40c70d4ed56a0381a2f79712
2020-04-27 21:49:23 +00:00
Orion Hodson
18f7afccb6 Merge "Add explicit dependencies on jni_headers" am: c0fe0ae29f am: 6963d8e1c8
Change-Id: I2fdf3826653466d65e3d63fa896d1ec23c5716cd
2020-04-16 10:58:50 +00:00
Orion Hodson
63f06b738d Add explicit dependencies on jni_headers
Preparation for removing implicit include paths for jni.h from soong.

Also remove unnecessary jni.h includes from PathParser.{h,cpp}.

Bug: 152482542
Test: lunch aosp_x86_64 && m checkbuild
Change-Id: Ib18afa3d2c93ed3ce69204286d5177991100fd7e
Exempt-From-Owner-Approval: build refactoring
2020-04-16 08:26:14 +00:00
Dan Willemsen
0985ac8982 Master is now S
Bug: 150754986
Test: treehugger
Change-Id: I44d1b5a0fea74e2bb9e332dcb8486fd30fbd2f07
Merged-In: I44d1b5a0fea74e2bb9e332dcb8486fd30fbd2f07
2020-04-10 05:18:32 +00:00
Dan Willemsen
c7a1109a1f Master is now S
Bug: 150754986
Test: treehugger
Change-Id: I44d1b5a0fea74e2bb9e332dcb8486fd30fbd2f07
2020-04-08 15:46:40 -07:00
Narayan Kamath
45f8d1cf43 Merge "aapt2: Preserve annotation parameters for SystemApi." into rvc-dev am: 924069c2aa
Change-Id: Ieb278c96432a0a23d65752a2c89365b02ed936f4
2020-03-30 13:22:15 +00:00
Narayan Kamath
1c1544ff96 aapt2: Preserve annotation parameters for SystemApi.
SystemAPI can now be parameterized. Note that this change preserves
the content of the annotation params without attempting to interpret
them in any way. This means that references to types outside of
java.lang must be fully qualified.

Test: atest aapt2_tests
Bug: 147581540
Change-Id: I0630fb1c7c7a7f5918ff2dca32fb8e078b367751
2020-03-26 11:47:59 +00:00
Philip P. Moltmann
12ac3f406f Rename featureId -> attributionTag
In the core functionality this changes everything including aidl's and
field names:
- Context
- ContentProvider
- AppOps*
- Package parsing

For the rest, this is a shallow change to only change to the changed
APIs. This keeps the change small-ish

Exempt-From-Owner-Approval: Rename
Fixes: 148792795
Test: TH
Change-Id: I2a2245fe76e09e62cb13d5785d2efb4a304ba54a
Merged-In: I2a2245fe76e09e62cb13d5785d2efb4a304ba54a
2020-03-12 19:26:10 +00:00
Philip P. Moltmann
aea50fc06a Rename featureId -> attributionTag
In the core functionality this changes everything including aidl's and
field names:
- Context
- ContentProvider
- AppOps*
- Package parsing

For the rest, this is a shallow change to only change to the changed
APIs. This keeps the change small-ish

Exempt-From-Owner-Approval: Rename
Fixes: 148792795
Test: TH
Change-Id: I2a2245fe76e09e62cb13d5785d2efb4a304ba54a
Merged-In: I2a2245fe76e09e62cb13d5785d2efb4a304ba54a
2020-03-12 11:47:51 -07:00
Automerger Merge Worker
578f3a9037 Merge "Suppress bugprone-use-after-move warnings" am: 100a6f64e5 am: a4f123ba5f
Change-Id: Iabb0a0570f64d39844758d4313d009b380aba356
2020-03-09 03:28:19 +00:00
Chih-Hung Hsieh
7a616f65d6 Suppress bugprone-use-after-move warnings
Bug: 150783499
Test: WITH_TIDY=1 make
Change-Id: Ifdd5d89d2207caba765e8f74e8a86f6b6b4ff609
2020-03-06 10:04:30 -08:00
Automerger Merge Worker
dc5de7b23b Merge "Generate "keep" rules for android:name and class attributes" am: a13d7fc861 am: 4da226a984
Change-Id: I4443b84896684ac3249108316487035319b4f52e
2020-03-06 00:56:33 +00:00
Jeremy Woods
4bdc698d9f Generate "keep" rules for android:name and class attributes
We should keep classes that are in the android:name or class xml
attributes.

Test: m -j aapt2_tests
Bug: 142601969
Change-Id: Ia67365bd702bae75d38b9572d68e9930e856e0f8
2020-03-05 13:06:26 -08:00
Winson Chiu
b0c5105b2d Merge changes from topic "actor-signature-policy-rvc-dev" into rvc-dev
* changes:
  Actor signature overlayable policy
  Refactor overlayable policy
2020-02-27 18:27:53 +00:00
Winson
f56ade365a Actor signature overlayable policy
There are cases where an app can ship overlays for itself,
but the "signature" policy as described would open up
a vulnerability by allowing the system actor to create
and sign any arbitrary overlay that will apply to the target.

To prevent this, redefine "signature" as target package only,
and introduce "actor" for checking against the actor signature.
Any app that wishes to use both can include both policies.

Bug: 130563563

Test: m aapt2_tests idmapt2_tests and run from host test output
Test: atest libandroidfw_tests

Change-Id: I1c583a5b37f4abbeb18fc6a35c502377d8977a41
2020-02-26 15:59:44 -08:00
Winson
62ac8b56a9 Refactor overlayable policy
To make it easier to add the actor policy in a follow up CL,
move most of the policy handling to a central location.

The strings and transformation between strings and flags is
now handled in libidmap2policies, with libandroidfw
containing the single source of policy flags.

This also extracts all the test resource IDs into an R.h
so they can be swapped without having to edit a dozen files
each time.

Bug: 130563563

Test: m aapt2_tests idmapt2_tests and run from host test output
Test: atest libandroidfw_tests

Change-Id: Ie533c9cebf938215df7586f00c38763ae467e606
2020-02-26 15:59:43 -08:00
Ryan Mitchell
60b74fb42f Add --rename-resources-package to aapt2
There is currently no way to change the package name encoded in the
resources table. This change adds a flag that controls rewriting the
package name encoded into the resources table. This flag does not
rewrite the package name in the manifest xml.

Bug: 147434671
Test: manual
Change-Id: I435ba07e29df0522c3a44cc5f2c460004a02d71c
2020-02-26 21:35:47 +00:00
Automerger Merge Worker
0b49886dca Merge "Fix clang-tidy performance-faster-string-find warnings" am: 57fb318ca3 am: 7c0f0d3cec am: 40ef6319ca
Change-Id: Id9d31a0c5cf41a0bb4a58326faa79511a1d8cc4a
2020-02-12 00:53:37 +00:00
Chih-Hung Hsieh
f2ef6579f2 Fix clang-tidy performance-faster-string-find warnings
Bug: 30411878
Test: build with WITH_TIDY=1
Change-Id: I7fd815aa401fbcaff97b772f3ba5d6f1d2034011
2020-02-11 14:27:11 -08:00
Patrick Baumann
9918123bac Adds queries->provider tag
This change adds support for the <provider> tag inside of the <queries>
tag to support more succinct declaration that an app would like to see
the provider of a given authority.

Test: atest AppEnumerationTests AppsFilterTest
Bug: 136675067
Change-Id: Ie0f73213fae7a3a0619238e44063d4e5be157201
2020-02-07 17:08:30 -08:00
Dianne Hackborn
fc0839ae30 Work on issue #143085640: Per-process network access control
Fix some issues when apps start declaring processes, add validation
that apps don't use processes they haven't declared (if they
declared some).  Also add package dump output for the processes it
has declared.

Bug: 143085640
Test: atest CtsAppSecurityHostTestCases:UseProcessTest
Change-Id: If1d13bf402d2b0aea06f0c2c02d5e392c774c812
2020-02-02 13:39:32 -08:00
Treehugger Robot
7b56a5075d Merge "Add option to avoid clobbering visibility of <declare-styleable>" 2020-01-17 18:21:24 +00:00
Clark Duvall
ba06b58f51 Merge "Reorder style items in shared libraries" 2020-01-16 23:03:45 +00:00
Clark DuVall
18b15bb3a6 Reorder style items in shared libraries
AssetManager2.cpp expects style attribute IDs to be in sorted order when
applying a style (see AssetManager2::GetBag). Shared libraries have a
package ID of 0x00, which will mean any attribute defined in a shared
library will be put before all other attributes. Once the attribute ID
is looked up in the dynamic ref table, the package ID is no longer 0x00,
which means this ID is no longer in sorted order. This messes up the
logic in AssetManager2::GetBag, and results in some style attributes
getting dropped from shared libraries.

This change modifies how aapt2 sorts the style entries, sorting entries
with dynamic IDs after entries with the android framework ID. This means
the entries will still be in sorted order when the IDs are looked up.

Bug: 147674078
Test: TableFlattenerTest.FlattenSharedLibraryWithStyle
Change-Id: Ic4f4004b6d9cecde9325dcdb37f71138857f8236
2020-01-16 12:37:36 -08:00
Anton Hansson
b2f709db1d Add <extension-sdk> manifest tag inside <uses-sdk>
This allows apps to specify the minimum versions they need
of extension sdks, and fails install if they aren't met.

There is additional work required to prevent local rollbacks
from triggering a downgrade of SDK versions after an install.

Bug: 137191822
Test: atest PackageParserTest
Exempt-From-Owner-Approval: PS4 was approved
Change-Id: If61ae6c67ceb752bec6876006a29e52b996901e7
2020-01-16 11:59:52 +00:00
Clark Duvall
e2bb499531 Merge "Fix serializing dynamic references to proto" 2020-01-13 23:10:50 +00:00
Clark DuVall
e9fedbe223 Fix serializing dynamic references to proto
The is_dynamic bit on references was getting lost when converting to
proto and back. This was preventing bundles from being used as shared
libraries, since layout inflation would fail when it hit a dynamic
reference.

Bug: 146491000
Test: Build a shared library with a layout that has a dynamic reference,
      and attempt to inflate that layout.

Change-Id: Ia0e615670d2ac52f9266e3eec8813af7687d3323
2020-01-13 09:55:53 -08:00
Ryan Mitchell
ee4a564d4f Allow for overlaying dynamic shared libraries
Overlays targeting shared libraries should be loaded into the
resources of every target that depends on the shared library.

Static shared libraries are currently not supported because overlays
should override all versions of static shared libraries and there is
not currently support for an overlay targeting multiple APKs.

Also created a test instrumentation and host test suite for testing
overlays and packages on the system image.

Bug: 140790224
Test: atest OverlayRemountedTest
Change-Id: I20a217b6368d6cf92b2b9f46908fd58012933f72
2020-01-10 23:20:19 +00:00
Donald Chai
f80d0ae89b Add option to avoid clobbering visibility of <declare-styleable>
"aapt2 compile" marks styleables as public instead of preserving
information from <public/> or --visibility options.  This behavior can
now be disabled via --preserve-visibility-of-styleables.

Bug: 146649511
Change-Id: Ifb8ab396573d1393df737a59625e79e9cf2494a7
Tested: aapt2_tests
2020-01-07 21:17:59 -08:00
TreeHugger Robot
916c97b796 Merge "Add option to avoid clobbering visibility of <declare-styleable>" 2020-01-07 22:40:18 +00:00
Donald Chai
94e4a01dec Add option to avoid clobbering visibility of <declare-styleable>
"aapt2 compile" marks styleables as public instead of preserving
information from <public/> or --visibility options.  This behavior can
now be disabled via --preserve-visibility-of-styleables.

Bug: 146649511
Change-Id: Ifb8ab396573d1393df737a59625e79e9cf2494a7
Tested: aapt2_tests
2020-01-07 12:55:52 -08:00
Philip P. Moltmann
9046d82b8f Allow apps to define featureIds in the manifest
Test: CtsAppOpsTestCases (with newly added test for featureIds declared
      in manifest)
Bug: 144997947
Change-Id: I5563ae6861318e4cc1d196e3f6aea378a4dcf748
2020-01-03 10:08:03 -08:00
Ryan Mitchell
cd78febeac Recognize dynamic res ids as valid
Shared libraries are assigned package id 0. Resource ids that start
with 0x00 are not invalid. This change changes is_valid to accept
dynamic resource ids and adds an is_valid_static method for when
an id must have a non-zero package id.

This also fixes an issue that made layouts in shared libraries that
use internal attributes exclude compiled resource ids from the binay
xml output.

Bug: 146491000
Test: Build a shared library with a layout that uses app attributes
      as well as android attribute and verify that all attributes
      have assigned resource ids using `aapt2 dump xmltree`

Change-Id: Ibc0407c610ffc98d7aaf233c37c065912ab0d516
2019-12-19 18:22:45 +00:00
Donald Chai
4abc82859d Fix deserialization of @id aliases
I didn't realize that this was actually a thing, but:

  <resources>
    <item name="id1" type="id"></item>
    <item name="id2" type="id">@id/id1</item>
  </resources>

leads to a resource table which 'aapt dump resources' will render as:

    resource 0x7f030000 com.pkg:id/id1: t=0x03 d=0x00000001 (s=0x0008 r=0x00)
    resource 0x7f030001 com.pkg:id/id2: t=0x01 d=0x7f030000 (s=0x0008 r=0x00)

while 'aapt2 dump resources' printed:

  type id id=03 entryCount=2
    resource 0x7f030000 id/id1
      () (id)
    resource 0x7f030001 id/id2
      () (id)

After this change, it prints:

  type id id=03 entryCount=2
    resource 0x7f030000 id/id1
      () (id)
    resource 0x7f030001 id/id2
      () @id/id1

Bug: 69445910
Change-Id: I0001ff09345434577ac4c1d32f96a781f4190d8d
Tested: manual, see above
2019-12-14 07:29:01 +00:00
TreeHugger Robot
d5cbd092ab Merge "Generate "keep" rules for actionProviderClass and actionViewClass" 2019-12-12 04:36:35 +00:00
TreeHugger Robot
995fbdb659 Merge "Fix aapt2 JavaClassGenerator Maybe#value() call before check" 2019-12-09 19:47:59 +00:00
Ryan Mitchell
4e19c48a6e Fix aapt2 JavaClassGenerator Maybe#value() call before check
Previous refactor accidentally assumed all attributes would have
resolvable symbols when generating the R class. Restore previous
behavior of calling SkipSymbol before retrieving the attribute
comment.

Bug: 145685954
Test: m TeleService
Change-Id: Ie8e1092556bc0b6a764462ffa0b99a876bcbd70e
2019-12-06 13:05:44 -08:00
Jean-Luc Coelho
181cbfde80 Add "no-proguard-location-reference" flag to aapt2
This fixes relocatability issues with the code shrinkers.

Bug: 144529940
Test: None
Change-Id: I65e08e850193e67dcdf4c533d9e66332714f0c8c
2019-12-02 21:11:08 +00:00
Izabela Orlowska
5b89b2d320 Use case-sensitive regular expressions in --no-compress-regex
On some windows versions (plus wine) std::regex has issues with the
icase flag (making regex case insensitive). Put the responsibility of
the case sensitivity on the caller.

Fixes: 127793905
Test: wine aapt2_tests.exe -> Util_test
Change-Id: I6775514d3ef43c2c47465bf39ceaf2c195909724
2019-11-27 18:37:09 +00:00
Donald Chai
d520db5355 Factor out repeated shift instructions to reduce code size
R8 has some O(n^3) analysis somewhere, so this should speed up analysis
of "onResourcesLoaded" by 1.5^3=3.3x.

Bug: 145052564
Change-Id: Ib6ab111511d6bd3afae0c29cd00f743e7128768a
Tested: aapt2_tests
2019-11-26 23:22:34 +00:00
Ryan Mitchell
e5981c075a Disable test broken on windows
RegularExperssions is broken on Windows, disable this test while a
fix is being worked on.

Bug: 127793905
Test: wine aapt2.exe
Change-Id: Ic78a7f12b004d2e8dbf5d79c5b52f00ca0ceb9e9
2019-11-26 18:28:01 +00:00