Commit Graph

7498 Commits

Author SHA1 Message Date
Ryan Mitchell
6c905696b9 Merge "AAPT: Only print last uses-sdk tag" into sc-dev 2021-05-03 23:00:16 +00:00
Ryan Mitchell
1966e1f236 AAPT2: Only print last uses-sdk tag
When an APK defines multiple "uses-sdk" tags, the Android runtime only
uses the minSdkVersion and targetSdkVersion values from the last
occurrence of the "uses-sdk" tag.

For example an application with the following tags:
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="29"/>
<uses-sdk android:maxSdkVersion="28"/>

Will have the following version codes at runtime:
minSdk=1 targetSdk=1

Another example:
<uses-sdk android:minSdkVersion="5" android:targetSdkVersion="28"/>
<uses-sdk android:minSdkVersion="5" android:targetSdkVersion="19"/>

Will have the following version codes at runtime:
minSdk=5 targetSdk=19

AAPT2 must print the version data from only the last tag, skipping other
occurrences of the tag.

Bug: 175789289
Test: manual
Change-Id: If0fece7de1d96046221c89d1b12515bc5c15c301
2021-05-03 13:54:55 -07:00
Ryan Mitchell
424db431be AAPT: Only print last uses-sdk tag
When an APK defines multiple "uses-sdk" tags, the Android runtime only
uses the minSdkVersion and targetSdkVersion values from the last
occurrence of the "uses-sdk" tag.

For example an application with the following tags:
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="29"/>
<uses-sdk android:maxSdkVersion="28"/>

Will have the following version codes at runtime:
minSdk=1 targetSdk=1

Another example:
<uses-sdk android:minSdkVersion="5" android:targetSdkVersion="28"/>
<uses-sdk android:minSdkVersion="5" android:targetSdkVersion="19"/>

Will have the following version codes at runtime:
minSdk=5 targetSdk=19

AAPT must print the version data from only the last tag, skipping other
occurrences of the tag.

Bug: 175789289
Test: manual
Change-Id: Ic855ff920d0b7abedd250d977bfa55189f4c8946
2021-05-03 12:20:22 -07:00
Ryan Mitchell
326e35ffaf Add <macro> tag to aapt2
AAPT2 Macros are compile-time resources definitions that are expanded
when referenced during the link phase.

A macro must be defined in the res/values.xml directory. A macro
definition for a macro named "foo" looks like the following:
 <macro name="foo">contents</macro>

When "@macro/foo" is used in the res/values directory or in a compiled
XML file, the contents of the macro replace the macro reference and
then the substituted contents are compiled and linked. If the macro
contents reference xml namespaces from its original definition, the
namespaces of the original macro definition will be used to determine
which package is being referenced.

Macros can be used anywhere resources can be referenced using the
@package:type/entry syntax.

Macros are not included in the final resource table or the R.java since
they are not actual resources.

Bug: 175616308
Test: aapt2_tests
Change-Id: I48b29ab6564357b32b4b4e32bff7ef06036382bc
2021-04-28 14:58:23 -07:00
Bob Badour
1cdaca9f84 [LSC] Add LOCAL_LICENSE_KINDS to frameworks/base
Added SPDX-license-identifier-Apache-2.0 to:
  core/tests/hosttests/test-apps/DownloadManagerTestApp/Android.mk
  core/tests/hosttests/test-apps/MultiDexLegacyAndException/Android.mk
  core/tests/hosttests/test-apps/MultiDexLegacyTestApp/Android.mk
  core/tests/hosttests/test-apps/MultiDexLegacyTestAppTests/Android.mk
  core/tests/hosttests/test-apps/MultiDexLegacyTestAppTests2/Android.mk
  core/tests/hosttests/test-apps/MultiDexLegacyTestAppWithCorruptedDex/Android.mk
  core/tests/hosttests/test-apps/MultiDexLegacyTestServices/Android.mk
  core/tests/hosttests/test-apps/MultiDexLegacyTestServicesTests2/Android.mk
  core/tests/hosttests/test-apps/MultiDexLegacyVersionedTestApp_v1/Android.mk
  core/tests/hosttests/test-apps/MultiDexLegacyVersionedTestApp_v2/Android.mk
  core/tests/hosttests/test-apps/MultiDexLegacyVersionedTestApp_v3/Android.mk
  core/tests/overlaytests/host/test-apps/SignatureOverlay/Android.mk
  core/tests/overlaytests/host/test-apps/UpdateOverlay/Android.mk
  packages/Android.bp
  packages/SystemUI/tests/Android.mk
  services/tests/servicestests/test-apps/PackageParsingTestManifests/Android.bp
  tests/Camera2Tests/CameraToo/Android.mk
  tests/Camera2Tests/CameraToo/tests/Android.mk
  tests/Camera2Tests/SmartCamera/SimpleCamera/Android.mk
  tests/Camera2Tests/SmartCamera/SimpleCamera/tests/Android.mk
  tests/CanvasCompare/Android.mk
  tests/FlickerTests/test-apps/Android.bp
  tests/LockTaskTests/Android.mk
  tests/SoundTriggerTests/Android.mk
  tools/aapt2/integration-tests/MergeOnlyTest/App/Android.mk
  tools/aapt2/integration-tests/NamespaceTest/App/Android.mk
  tools/aapt2/integration-tests/NamespaceTest/Split/Android.mk
  tools/fonts/Android.bp

Bug: 68860345
Bug: 151177513
Bug: 151953481

Test: m all

Exempt-From-Owner-Approval: janitorial work
Change-Id: Ic480b653df5da840f5e65b818af3de5c8417ab4a
2021-04-21 14:42:18 -07:00
Bob Badour
268090cd09 DO NOT MERGE Add LOCAL_LICENSE_KINDS to frameworks/base
Added SPDX-license-identifier-Apache-2.0 to:
  core/tests/hosttests/test-apps/DownloadManagerTestApp/Android.mk
  core/tests/hosttests/test-apps/MultiDexLegacyAndException/Android.mk
  core/tests/hosttests/test-apps/MultiDexLegacyTestApp/Android.mk
  core/tests/hosttests/test-apps/MultiDexLegacyTestAppTests/Android.mk
  core/tests/hosttests/test-apps/MultiDexLegacyTestAppTests2/Android.mk
  core/tests/hosttests/test-apps/MultiDexLegacyTestAppWithCorruptedDex/Android.mk
  core/tests/hosttests/test-apps/MultiDexLegacyTestServices/Android.mk
  core/tests/hosttests/test-apps/MultiDexLegacyTestServicesTests2/Android.mk
  core/tests/hosttests/test-apps/MultiDexLegacyVersionedTestApp_v1/Android.mk
  core/tests/hosttests/test-apps/MultiDexLegacyVersionedTestApp_v2/Android.mk
  core/tests/hosttests/test-apps/MultiDexLegacyVersionedTestApp_v3/Android.mk
  core/tests/overlaytests/host/test-apps/SignatureOverlay/Android.mk
  core/tests/overlaytests/host/test-apps/UpdateOverlay/Android.mk
  location/tests/Android.bp
  packages/CarSystemUI/tests/Android.mk
  packages/SystemUI/tests/Android.mk
  packages/overlays/AccentColorAmethystOverlay/Android.mk
  packages/overlays/AccentColorAquamarineOverlay/Android.mk
  packages/overlays/AccentColorBlackOverlay/Android.mk
  packages/overlays/AccentColorCarbonOverlay/Android.mk
  packages/overlays/AccentColorCinnamonOverlay/Android.mk
  packages/overlays/AccentColorGreenOverlay/Android.mk
  packages/overlays/AccentColorOceanOverlay/Android.mk
  packages/overlays/AccentColorOrchidOverlay/Android.mk
  packages/overlays/AccentColorPaletteOverlay/Android.mk
  packages/overlays/AccentColorPurpleOverlay/Android.mk
  packages/overlays/AccentColorSandOverlay/Android.mk
  packages/overlays/AccentColorSpaceOverlay/Android.mk
  packages/overlays/AccentColorTangerineOverlay/Android.mk
  packages/overlays/DisplayCutoutEmulationCornerOverlay/Android.mk
  packages/overlays/DisplayCutoutEmulationDoubleOverlay/Android.mk
  packages/overlays/DisplayCutoutEmulationHoleOverlay/Android.mk
  packages/overlays/DisplayCutoutEmulationNarrowOverlay/Android.mk
  packages/overlays/DisplayCutoutEmulationTallOverlay/Android.mk
  packages/overlays/DisplayCutoutEmulationWaterfallOverlay/Android.mk
  packages/overlays/DisplayCutoutEmulationWideOverlay/Android.mk
  packages/overlays/FontNotoSerifSourceOverlay/Android.mk
  packages/overlays/IconPackCircularAndroidOverlay/Android.mk
  packages/overlays/IconPackCircularLauncherOverlay/Android.mk
  packages/overlays/IconPackCircularSettingsOverlay/Android.mk
  packages/overlays/IconPackCircularSystemUIOverlay/Android.mk
  packages/overlays/IconPackCircularThemePickerOverlay/Android.mk
  packages/overlays/IconPackFilledAndroidOverlay/Android.mk
  packages/overlays/IconPackFilledLauncherOverlay/Android.mk
  packages/overlays/IconPackFilledSettingsOverlay/Android.mk
  packages/overlays/IconPackFilledSystemUIOverlay/Android.mk
  packages/overlays/IconPackFilledThemePickerOverlay/Android.mk
  packages/overlays/IconPackKaiAndroidOverlay/Android.mk
  packages/overlays/IconPackKaiLauncherOverlay/Android.mk
  packages/overlays/IconPackKaiSettingsOverlay/Android.mk
  packages/overlays/IconPackKaiSystemUIOverlay/Android.mk
  packages/overlays/IconPackKaiThemePickerOverlay/Android.mk
  packages/overlays/IconPackRoundedAndroidOverlay/Android.mk
  packages/overlays/IconPackRoundedLauncherOverlay/Android.mk
  packages/overlays/IconPackRoundedSettingsOverlay/Android.mk
  packages/overlays/IconPackRoundedSystemUIOverlay/Android.mk
  packages/overlays/IconPackRoundedThemePickerOverlay/Android.mk
  packages/overlays/IconPackSamAndroidOverlay/Android.mk
  packages/overlays/IconPackSamLauncherOverlay/Android.mk
  packages/overlays/IconPackSamSettingsOverlay/Android.mk
  packages/overlays/IconPackSamSystemUIOverlay/Android.mk
  packages/overlays/IconPackSamThemePickerOverlay/Android.mk
  packages/overlays/IconPackVictorAndroidOverlay/Android.mk
  packages/overlays/IconPackVictorLauncherOverlay/Android.mk
  packages/overlays/IconPackVictorSettingsOverlay/Android.mk
  packages/overlays/IconPackVictorSystemUIOverlay/Android.mk
  packages/overlays/IconPackVictorThemePickerOverlay/Android.mk
  packages/overlays/IconShapeHeartOverlay/Android.mk
  packages/overlays/IconShapePebbleOverlay/Android.mk
  packages/overlays/IconShapeRoundedRectOverlay/Android.mk
  packages/overlays/IconShapeSquareOverlay/Android.mk
  packages/overlays/IconShapeSquircleOverlay/Android.mk
  packages/overlays/IconShapeTaperedRectOverlay/Android.mk
  packages/overlays/IconShapeTeardropOverlay/Android.mk
  packages/overlays/IconShapeVesselOverlay/Android.mk
  packages/overlays/NavigationBarMode2ButtonOverlay/Android.mk
  packages/overlays/NavigationBarMode3ButtonOverlay/Android.mk
  packages/overlays/NavigationBarModeGesturalOverlay/Android.mk
  packages/overlays/NavigationBarModeGesturalOverlayExtraWideBack/Android.mk
  packages/overlays/NavigationBarModeGesturalOverlayNarrowBack/Android.mk
  packages/overlays/NavigationBarModeGesturalOverlayWideBack/Android.mk
  services/tests/servicestests/test-apps/PackageParsingTestManifests/Android.bp
  tests/Camera2Tests/CameraToo/Android.mk
  tests/Camera2Tests/CameraToo/tests/Android.mk
  tests/Camera2Tests/SmartCamera/SimpleCamera/Android.mk
  tests/Camera2Tests/SmartCamera/SimpleCamera/tests/Android.mk
  tests/CanvasCompare/Android.mk
  tests/FlickerTests/test-apps/Android.bp
  tests/LockTaskTests/Android.mk
  tests/SoundTriggerTests/Android.mk
  tools/aapt2/integration-tests/MergeOnlyTest/App/Android.mk
  tools/aapt2/integration-tests/NamespaceTest/App/Android.mk
  tools/aapt2/integration-tests/NamespaceTest/Split/Android.mk
  tools/fonts/Android.bp

Bug: 68860345
Bug: 151177513
Bug: 151953481

Test: m all

Exempt-From-Owner-Approval: janitorial work
Change-Id: I90231075f135176668586b903f2c85ec350fd527
2021-04-21 20:55:12 +00:00
Ryan Mitchell
31031a91f1 Merge "Aapt2 ValueTransformer" into sc-dev 2021-04-21 17:44:55 +00:00
Ryan Mitchell
efcdb95fa7 Aapt2 ValueTransformer
For future macro support, aapt2 must be able to convert Reference
values into other Value types. Currently a DescendingValueVisitor is
used to visit all of the References in a ResourceTable or a compiled
XML file to set their resource ids during the link phase. This was fine
since we were only mutating the resource id of the visited Reference.

A macro may reference a String, BinaryPrimitive, or any other Item
type. During the link phase, we will need to transform references to
macros into the values of the macros.

The only parameter in the methods of the ValueVisitor interface is a
raw pointer to the type being visited. The visitor interface does not
support reassigning the visited type to a different type.

ValueTransformer is a new interface for consuming a Value type and
transforming it into a compatible Value type. This change refactors
Value::Clone to use this interface.

Bug: 175616308
Test: aapt2_tests
Change-Id: Ic1b9d718b932c208764114cd9c74d880e189ccb0
2021-04-21 08:32:30 -07:00
TreeHugger Robot
0566ee964d Merge "Add FontConfig.Font.getPostScriptName API" into sc-dev 2021-04-17 22:34:51 +00:00
Seigo Nonaka
5681124abb Add FontConfig.Font.getPostScriptName API
Bug: 184003133
Bug: 185508395
Test: atest FontManagerTest#fontManager_PostScriptName
Change-Id: Ie44e0d500c61b37035a0b39039891da13cd6a5ce
2021-04-17 00:46:04 -07:00
Paul Duffin
444c535a46 Merge "Move hiddenapi sort preupload tools to tools/platform-compat" am: b82853357b am: 89aedd6cb8 am: af77c134d9
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1675867

Change-Id: I35b678f40dbc8643224aec26ba1808da893bb80f
2021-04-16 16:15:32 +00:00
Paul Duffin
738f919418 Move hiddenapi sort preupload tools to tools/platform-compat
Bug: 179354495
Test: try and upload changes to hiddenapi flag files
Change-Id: Iedc21893bbc62adaaca4de353d022e77fc70ace2
2021-04-15 10:45:39 +01:00
Paul Duffin
b5a78c6a97 Merge "Generalize tools/hiddenapi/checksorted_sha.sh" am: a48ee296ee am: 44b2f6cebd am: 272bf95507
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1675866

Change-Id: Ifde8b21834c3dac0cba363a667f7d94e820e18a2
2021-04-14 18:34:43 +00:00
Paul Duffin
6dac0c69af Merge "Remove com.android.i18n.phonenumbers from libcore packages" am: 0d80c5c432 am: da8ead7229 am: 03559adae9
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1675524

Change-Id: I9e03d5ed5be3f68535276bf58b29c871fa153b80
2021-04-14 18:33:45 +00:00
Paul Duffin
11972fd431 Generalize tools/hiddenapi/checksorted_sha.sh
Stops it being specific to frameworks/base. This change works because
$2 is $(REPO_ROOT) and $(REPO_ROOT)/frameworks/base is the same as $PWD
when this script is used in the frameworks/base repo.

Also removes boot/ from the path that identifies hidden API flag files.
This keeps the directory structure needed in the repositories into
which hidden API flag files will be moved simple by removing the need
to have a boot/ directory. The hiddenapi/ directory is required as the
files need their own separate OWNERS file.

A follow up change will move this file into tools/platform-compat to
allow it to be used by other repos.

Bug: 177892522
Test: try and upload changes to hiddenapi flag files
Change-Id: Ifb3690e7c596249fda84eff82f5a53f0b1b6f991
2021-04-14 14:42:15 +01:00
Paul Duffin
08c30bae75 Remove com.android.i18n.phonenumbers from libcore packages
The com.android.i18n.phonenumbers is not used by any libcore code and
is no longer managed by the libcore team.

Bug: 177892522
Test: n/a
Change-Id: Ib445e652746a8b9b42c6bee7d27a062d6b62a4ec
2021-04-14 13:30:27 +01:00
Anton Hansson
9f9f90b260 Move font tool build rules to subdir
The top-level Android.bp file is very large, so move modules that can be
in subdirs.

Also rename the vague "base_defaults" module to something more suitable.

Bug: 185128417
Test: m
Change-Id: I5f3106b74edb91ac9db5b3e66cc61566d0f16e9b
2021-04-12 18:08:45 +01:00
Anton Hansson
702aa95096 Move font tool build rules to subdir
The top-level Android.bp file is very large, so move modules that can be
in subdirs.

Also rename the vague "base_defaults" module to something more suitable.

Bug: 185128417
Test: m
Merged-In: I5f3106b74edb91ac9db5b3e66cc61566d0f16e9b
Change-Id: I5f3106b74edb91ac9db5b3e66cc61566d0f16e9b
2021-04-12 17:57:51 +01:00
Paul Duffin
35e8681954 Merge "Update hiddenapi preupload checks to handle new location" am: ca0501d1b8 am: 0c71f7c0a4 am: 48c3dadc6a
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1668445

Change-Id: I5f2682d437286c1d320475c5381693c96f4db667
2021-04-08 22:59:20 +00:00
Paul Duffin
f998f8b427 Update hiddenapi preupload checks to handle new location
The config/hiddenapi-*.txt files have moved so this change updates the
preupload scripts to match their new location.

Test: Modify the boot/hiddenapi/hiddenapi-*.txt files in various ways
      to verify the scripts fail.
Change-Id: I725458e809d9871b2c21bc4e18f62441aaa775a9
2021-04-07 22:17:36 +01:00
Paul Duffin
f9ea5ff1b2 Merge "Improve hiddenapi exclude.sh script" am: b1becf7cfb am: 8637b71f39 am: a220ff9b2d
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1660362

Change-Id: I4432d589a73377cb97b0e9779439e226357640c3
2021-04-07 17:05:24 +00:00
Paul Duffin
d5de5c1b3a Merge "Add OWNERS file to tools/hiddenapi" am: 36cd81b3d2 am: be4f683e96 am: af0df716a8
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1667284

Change-Id: Ic4f6c749e8fdb3b27a351457e5f8ae3c3c09cc34
2021-04-07 14:13:29 +00:00
Paul Duffin
ad7bf81d40 Improve hiddenapi exclude.sh script
Changes:
* Adds a missing package for libcore.
* Splits the android.icu package out into a new I18N team.
* Corrects and splits the conscrypt package out into a new CONSCRYPT
  team.
* Fixes some issues that arose due to multiple teams.
* Reports multiple issues instead of stopping at the first one.
* Only reports issues with additions/changes not removals.

Bug: 177892522
Test: tools/hiddenapi/exclude.sh <SHA>
      Ran it on a number of different commits with different
      changes.
Change-Id: I44740a28a56a26ee7fba3ed691d9da34f4effa8a
2021-04-07 10:49:32 +01:00
Paul Duffin
7ca2087a38 Add OWNERS file to tools/hiddenapi
Bug: 179354495
Test: m nothing
Change-Id: I54159f3c32fc8a0a094243178315ca0d249b64cf
2021-04-07 10:49:02 +01:00
Ryan Mitchell
d4f0220d29 Merge "Use staging-public-group in framework SDK" into sc-dev 2021-04-01 18:36:33 +00:00
Yury Khmel
72dad8a9d1 Fix presubmit for hidden api.
grep returns 1 for if nothing was found. This fails presubmit hook due
to bash handling "set -e" Looks like grep not found is valid case.
This fixes this issue by bypassing grep exit code.

Test: Locally
Bug: 161351699
Merged-In: I39e926a348a0fb8f4040f86034affdb4204faac5
Change-Id: I39e926a348a0fb8f4040f86034affdb4204faac5
(cherry picked from commit e6a5253f12)
2021-04-01 13:17:00 +01:00
Ryan Mitchell
ca3b4f7633 Use staging-public-group in framework SDK
To make S finalization easier, this changes the framework SDK so that
apps linking against it will be able to continue working as expected
after the first phase of SDK finalization.

During the first phase of SDK finalization, the resource ids of
resources that have not been removed are finalized.
staging-public-group tags are converted to staging-public-group-final
tags in order to encode into the framework what the staged resource id
of a finalized resource was. When an app recompiles, it will use the
finalized resource id. Then after all apps recompile, phase 2 of
finalization begins, in which the staging-public-group-final tags are
removed so apps can no longer use the staged resource ids.

Apps that link against the SDK (provided they are using a recent
version of aapt) will encode references to staged resources as
TYPE_DYNAMIC_REFERENCE and TYPE_DYNAMIC_ATTRIBUTE. The values of R
fields for staged resources are defined out-of-line to prevent them
from being inlined into apps linking agsint the SDK. This allows the
resource ids to change during phase 1 of API finalization.

Bug: 183413192
Test: `aapt2 diff` and resource ids stayed the same
Test: `aapt2 dump` of framework-res.apk and observe staged resources
Change-Id: Ie2275c608297a5f63dde8b1cf795415112cbcc24
2021-03-31 23:04:57 -07:00
Ryan Mitchell
87d30ddcc0 Fix aapt2 feature split package name generation
Before flattening the resource table of a feature split, if the package
name of the feature split is the same as the base package name, the
split name is appended to the end of the feature's package name.

A bug was causing the rewritten package name to not be applied to the
feature package which resulted in the feature split being flattened
under the same package name as the base.

Bug: 184034454
Test: `m CtsSplitAppFeatureWarm_v23` && `aapt2 dump resources`
      to observe that package name is correct
Change-Id: I0a0ac57764f599c4dd05326a222056a3c52a4ae3
2021-03-31 22:09:04 +00:00
Treehugger Robot
8b0cfd1550 Merge "Revert "Rename the font file with PostScript name based file name"" 2021-03-31 21:49:21 +00:00
Seigo Nonaka
e95ec27dd6 Revert "Rename the font file with PostScript name based file name"
Revert "Update ImageGenerator to match the latest font names."

Revert "Rename font file with PostScript based names"

Revert submission 1606485-rename_fonts

Reason for revert: font file name requirement was removed.

Reverted Changes:
Iab8b9d65a:Update ImageGenerator to match the latest font nam...
Ifbe99d68c:Rename the font file with PostScript name based fi...
I307c21531:Rename font file with PostScript based names

Change-Id: I95a52403590127f1762c7551edff9805096daf79
Merged-In: I6bd807ce0df6cd81e44bf89918ac4b7b01c27ae1
2021-03-31 20:38:40 +00:00
Seigo Nonaka
a1245b1c7c Revert font file rename.
This reverts commit f31ac94a03.
This reverts commit 2f0674a7fa.

Bug: 184003133
Test: N/A
Change-Id: I6bd807ce0df6cd81e44bf89918ac4b7b01c27ae1
2021-03-30 23:34:28 -07:00
Ryan Mitchell
1499f504e4 Update iterators during aapt2 diff
A recent change broke aapt2 diff. We need to update the iterators when
an package, type, or entry is not missing from either APK.

Bug: 184066458
Test: `aapt2 diff` with framework before and after staging changes
Change-Id: I9138b9bd80aec24488feca6e06be1d7cf5775290
2021-03-30 14:13:07 -07:00
Ryan Mitchell
56a9d29cc0 Merge "Add staging-public-group to aapt2" into sc-dev 2021-03-30 15:36:58 +00:00
Ryan Mitchell
2e9bec1154 Add staging-public-group to aapt2
staging-public-group is a tag for putting resources that have been
added during platform development, but have not yet been finalized,
into a separate resource id namespace.

R.java fields of staged resources are non-final, so when the SDK is
finalized, applications using the android R.java will automatically
use the new finalized resource id without having to recompile.

Staged resources can exist either in the same type id as the type's
non-staged counterpart or in a separate type id. Multiple
staging-public-group tags each with a different type id can exist
simultaneously, which allows for multiple versions of the platform
to be developed at once.

Bug: 183411093
Test: aapt2_tests

Change-Id: Ibb6c84c3626751e33c6097f35a03e306bb85616a
2021-03-29 16:33:16 -07:00
Ryan Mitchell
0f97905040 Merge changes I851f9fb9,I60dbcb24 into sc-dev
* changes:
  Refactor aapt2 tests ResourceTable changes
  Prepare aapt2 for multiple ids per type
2021-03-29 20:04:00 +00:00
Ryan Mitchell
1d008d1d2a Refactor aapt2 tests ResourceTable changes
This changes refactors tests to use the NewResourceBuilder class
that makes it easier to construct resource entries.

Bug: 183102797
Test: aapt2_tests
Change-Id: I851f9fb99a003769f8df8c1876997eee0864822a
2021-03-29 10:22:10 -07:00
Ryan Mitchell
9634efb6f4 Prepare aapt2 for multiple ids per type
For the SDK finalization changes, aapt2 must be able to handle
resources of the same type having different type ids. The
ResourceTable data structure currently stores package ids and type ids
on ResourceTablePackage and ResourceTableType respectively. This
prevents resource entries of the same type from having different type
ids without having to create another ResourceTableType structure.

JavaClassGenerator assumes each type only appears once in the
ResourceTable and it would need to dedupe the types to ensure one class
containing all the resource types ids is generated. TableFlattener on
the other hand needs a separate ResourceTableType for each type/id
combination so that the types are flattened into separate
ResTable_types.

This change simplifies aapt2's ResourceTable data structure:
- Resource ids are stored exclusively on ResourceEntry structures
  meaning multiple entries can have different type ids while being
  stored in the same ResourceTableType. Classes like JavaClassGenerator
  can simply iterate over a type to see all the resources of the type
  regardless of what their type id is.

- ResourceTable::GetPartitionedView() retrieves a list of resources
  sorted and partitioned by package id, type id, and entry id. Classes
  like TableFlattener can use this view to get separate
  ResourceTavleTypes for each different type id that a type has.

These changes will also make it easy to have a resource span multiple
type ids if it exhausts all of the entry ids in one type id.

The new NewResourcesBuilder replaces the numerous setter methods on
ResourceTable.

Bug: 183102797
Test: aapt2_tests
Change-Id: I60dbcb24143bb958333899cafa7d41faa226d203
2021-03-29 10:22:08 -07:00
Jeff Sharkey
abcddfd12b Emit "usesPermissionFlags" in "dump badging".
Since developers can declare the "neverForLocation" flag in their
manifest as public API, we should also offer a way to inspect the
value that we parsed from the manifest.

Bug: 183816684
Test: aapt2 dump badging \
        CtsAppThatRequestsBluetoothPermissionNeverForLocation31.apk
Change-Id: I93c0371d6fb1a0ca928aa26265074acee2bee879
2021-03-29 10:05:23 -06:00
Eugene Susla
1f37e7a831 Fix IBinder parcelling
Fixes: 183547536
Test: . frameworks/base/tests/Codegen/runTest.sh

Change-Id: Ifffac8c560a8e2e9e0543d523738ad529af633e9
2021-03-23 16:20:22 -07:00
Treehugger Robot
bff3cb288c Merge "Remove unused errorMessage" am: 78a488cd10 am: fd426e18cd am: 2f5ce95057
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1616687

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I06708ad8febc8df30eb7dcc657f2b791e97a03e2
2021-03-04 08:03:50 +00:00
Haibo Huang
1c9baa3191 Remove unused errorMessage
Change-Id: If799737a69545bf6789213ce3f4dd6c724352213
2021-03-03 16:43:48 -08:00
Haibo Huang
f154eead04 Merge "[bit] Use new jsoncpp API" am: c8379556c0 am: 14fff93b3f am: 45b069f015
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1607474

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I3ff7e266c20f35a37bda1469dded280d443d3518
2021-03-04 00:17:27 +00:00
Haibo Huang
39f4db5ea0 [bit] Use new jsoncpp API
Reader / StyledWriter are deprecated upstream

Bug: 170642246
Change-Id: Ia2dcd3a817209e6821ecdd7c7f8094ec74bae44a
2021-03-03 22:17:10 +00:00
Ryan Mitchell
51ee3d1944 Merge "Use R field directly for shared lib styleable attrs" into sc-dev 2021-03-02 20:02:24 +00:00
Seigo Nonaka
444dc3366b Merge "Rename DancingScript and CutiveMono" into sc-dev 2021-03-02 02:45:01 +00:00
Julien Desprez
90d2dee043 Merge "attempt to run protologtool-tests as unit tests" am: f9e2a9c55a am: 8ae5fd7f1c am: 3043de8cdd
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1601194

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I27f9ad3c9fa9d2aa0fb1d38f04d953fa87278df8
2021-03-01 08:17:35 +00:00
Julien Desprez
f9e2a9c55a Merge "attempt to run protologtool-tests as unit tests" 2021-02-27 00:41:48 +00:00
Seigo Nonaka
f31ac94a03 Rename DancingScript and CutiveMono
Bug: 179952916
Test: atest CtsTextTestCases CtsGraphicsTestCases
Test: atest SystemFontsCanonicalNameTest
Change-Id: Ia976e2182e5635d8431a84653908483de1c26ca3
2021-02-25 18:29:31 -08:00
Seigo Nonaka
2a0135d19c Rename the font file with PostScript name based file name
This CL also adds lint rules for matching the file name and PostScript
name.

Bug: 179952916
Test: m fontchain_lint
Merged-In: I829840299b5d138cfec8924ce8f77e1371524a70
Change-Id: Ifbe99d68c40605f004c88f63000b092cb68cafd6
2021-02-25 01:43:32 +00:00
Ryan Mitchell
5855de7ed6 Use R field directly for shared lib styleable attrs
If a shared library exposes an attribute and a client uses the
attribute in its own styleable, the value of the lib attribute
resource id in the client styleable must be fixed with the correct
package id at runtime. Since the client will not have an
onResourcesLoaded to call, the client should directly reference the
attribute resource field in its styleable.

Bug: 147674078
Test: aapt2_tests
Change-Id: I8e64bb2d3165a7072e2604fe1730b248545978f4
2021-02-24 15:57:34 -08:00