Commit Graph

73 Commits

Author SHA1 Message Date
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
Ryan Mitchell
47fb18bed8 Merge "Set ApkAssets path for fabricated rros" into sc-dev 2021-05-13 22:33:17 +00:00
Ryan Mitchell
bdc0ae1247 Set ApkAssets path for fabricated rros
Fabricated RROs do not provide assets but are stored on disk. Ensure
that the path to the frro is returned when querying for the ApkAssets
path (which is mostly for debug purposes).

Bug: 181338216
Test: enable frro, use cmd overlay lookup to see path in resolution
Change-Id: Ibf9b1bf0a995325affbf084c71b1e87c5682e734
2021-05-13 13:41:26 -07:00
Ryan Mitchell
2ec8e1b71f Add <staging-public-group-final> to aapt2 (2/2)
Fixes BinaryResourceParser loading of alias chunk and makes changes
that did not get committed in 2fedba9a32.

Bug: 183411356
Test: aapt2_test
Change-Id: Ieff9166100019f38ddcfe900014709b15db24e43
2021-05-11 08:28:00 -07:00
Ryan Mitchell
2fedba9a32 Add <staging-public-group-final> to aapt2
To allow apps that compiled against a pre-release SDK to continue
working for a period of time after API finalization, a new tag,
<staging-public-group-final>, has been added to aapt2.

When finalizing the framework resource API, converting
<staging-public-group> tags to <staging-public-group-final> will
cause aapt2 to generate the resource table so that there is a resource
entry for the old non-finalized (staged) resource ID and another entry
for the finalized resource ID of newly finalized resources. This allows
an application that compiled against the pre-release SDK to continue
resolving resources using pre-release resource IDs.

All references to pre-release resource IDs will be rewritten to their
finalized resource IDs through the information stored in the new staged
alias chunk. This allows applications compiled against
<staging-public-group> resources to use the newly finalized
resource ID without re-compilation.

When an application is re-compiled against the SDK with
<staging-public-group-final> tags, the application will use the
finalized resource IDs.

This change limits the use of the alias chunk to the framework for S.

Bug: 183411356
Test: aapt2_test
Change-Id: Iba1c3033c3c2f32de8e4a19b58d3921c971092c4
2021-05-10 17:22:33 -07:00
Ryan Mitchell
0ae49d300d Prevent Theme#dump from restricting minimum severity
After Theme#dump is used, all logs with a lower severity than "info"
were not being shown. Removing base::ScopedLogSeverity fixes this
issue. ScopedLogSeverity does not have any purpose in these code blocks
since the dump command is doing the theme logging at a fixed severity.

Bug: 175070283
Test: use debugger to invoke dump and verify that it does not limit
      minimum severity
Change-Id: I4564d119b3672398c6b1d11cd946080cca458218
2021-03-10 13:29:43 -08:00
Ryan Mitchell
ef53843630 Don't use ApkAssets::GetPath for equality checks
With the introduction of ResourcesProviders, not all ApkAssets have
paths on disk. Theme::SetTo and various AssetManager methods use the
path to perform equality checking on ApkAssets. This equality check
will be performed on the debug string of an ApkAssets if it does not
have a path on disk. This causes ApkAssets with the same debug name
(like "<empty>") to be seen as the same ApkAssets. Rather than using
path, the pointer to the ApkAssets should be used for equality checking
since ResourcesManager caches and reuses ApkAssets when multiple
AssetManagers request the same assets.

Bug: 177101983
Test: atest CtsResourcesLoaderTests
Change-Id: I11f6a2a3a7cc8febe3f976236792f78e41cf07e6
2021-03-02 18:06:49 +00:00
Ryan Mitchell
2ed8bfa7fd Add fabricated RRO generation to libidmap2
Fabricated Runtime Resource Overlays are overlays that are generated
at runtime and are stored in the data/ partition.

The system can fabricate RROs at runtime to dynamically theme the
device. Idmaps can now be created from APK RROs and fabricated RROs.

Rather than operating on ApkAssets, libidmap2 now operates on abstract
resource "containers" that supply resource values. Target resource
containers implement methods needed to query overlayable and target
overlay information. Currently only APKs can be loaded as target
resource containers. Overlay resource containers implement methods to
supply the mapping of target resource to overlay value and other
overlay information.

The format of a fabricated RRO is as follows:
0x00 - 0x04 : fabricated overlay magic (always FRRO)
0x04 - 0x08 : file format version
0x08 - 0x0c : crc of version + proto data
0x0c - EOF  : proto fabricated overlay data

The magic is used to quickly detect if the file is a fabricated overlay.
The version is incremented whenever backwards incompatible changes are
made to the proto file format. Idmap must always be able to upgrade
fabricated overlays from previous versions to new versions, so all
previous versions must be checked into the tree.

Bug: 172471315
Test: libidmap2_tests && libandroidfw_tests
Change-Id: I4c9f29da278672e5695fb57d131a44c11a835180
2021-02-09 20:13:50 -08:00
Ryan Mitchell
14e8ade9a9 Optimize FilterApkAssets by caching config
ResTable_config of every ResTable_type is read from device every time
AssetManager::RebuildFilterList is invoked. For large APKs (like
framework-res.apk), this causes a large number of page faults
when accessing the config from disk. The configs are also used in the
slow path of AssetManager::FindEntryInternal, which makes it even
slower. Instead cache the config on the TypeSpec of its ApkAsset.

Bug: 177247024
Test: libandroidfw_tests
Change-Id: I66d507c4eeb2399f7558f3d9dfc53c157129ada0
2021-01-13 21:14:31 -08:00
Ryan Mitchell
0699f1de6a Remove idmap path 256 length limit
Overlay and target package paths can be longer than 256 characters.
Currently, the idmap will fail to be generated if either path
is longer than 256 characters.

This change removes the 256 character limit and makes parsing variable
length strings easier in libandroidfw.

Bug: 174676094
Test: idmap2_tests && libandroidfw_tests
Change-Id: Ic240cdb8700566b2ac2ade08da58bea852e4ae0c
2021-01-06 16:19:50 -08:00
Bernie Innocenti
58cf8e3ffa Add explicit Result::ok() checks where needed
Test: m checkbuild continuous_instrumentation_tests continuous_instrumentation_tests_api_coverage continuous_native_tests device-tests platform_tests
Exempt-From-Owner-Approval: mechanical mass refactoring
Change-Id: I3117833c51cdb333cccdfd159d1582f2adef77db
2020-12-21 15:50:57 +00:00
Ryan Mitchell
a45506e6f6 Revert^2 "Cache resolved theme values"
6ca48473e5

Change-Id: Icb295186b85e1edcdcebc1d746f7ff0d6ef66829
Merged-In: Icb295186b85e1edcdcebc1d746f7ff0d6ef66829
2020-12-08 16:59:06 +00:00
Ryan Mitchell
e7ab62723a Set resource id correctly when resolve fails
If for some reason the resource id cannot be resolved to a value
(there is no configuration that matches the AssetManager configuration
or some error occurs), set the resource id of the SelectedValue to the
resource id that could not be resolved. This was the behavior before
the AssetManager IncFs hardening refactor.

Bug: 173203252
Test: atest com.google.android.config.pts.PreinstalledAppsTestCase
Test: Chrome icon appears on launcher
Change-Id: Iad1760c0e246da1a4bf64d1c2ec60bb08da32d06
Merged-In: Iad1760c0e246da1a4bf64d1c2ec60bb08da32d06
2020-12-08 16:58:42 +00:00
Ryan Mitchell
80094e39f9 Revert^2 "libandroidfw hardening for IncFs"
55ef6167a2

Change-Id: I02d4890d181655dfd0a14c188468db512559d27b
Merged-In: I02d4890d181655dfd0a14c188468db512559d27b
2020-12-08 16:58:12 +00:00
Ryan Mitchell
bf1f45b071 Remove malloc/free for inline overlay values
Remove malloc/free of android::ResTable_entry for inline overlay
values.

Add `target_entry_inline` to the idmap format to encode inline overlay
values separate from direct mapping of target resource to overlay
resource. This reduces the number of bytes needed to represent a direct
mapping of target resource to overlay resource from 9 bytes to 8 bytes
per entry.

Fixed all idmap alignment issues that required the framework to use
"#pragma pack(push, 1)" when loading idmaps.

Bug: 170341022
Test: idmap2_tests and libandroidfw_tests
Change-Id: Iab4d3902508f02773464724913e0ee966e3689e4
2020-10-14 14:52:52 -07:00
Ryan Mitchell
192400cf33 Fail install when resources.arsc is compressed
If an application targets R+, prevent the application from being
installed if the app has a compressed resources.arsc or if the
resources.arsc is not aligned on a 4-byte boundary. Resources tables
that cannot be memory mapped have to be read into a buffer in RAM
and exert unnecessary memory pressure on the system.

Bug: 132742131
Test: manual (adding CTS tests)
Change-Id: Ieef764c87643863de24531fac12cc520fe6d90d0
2020-04-09 11:01:54 -07:00
Ryan Mitchell
824cc490c5 Assigned package ids to overlays last
Before overlays could reference internal resources, overlays were
added to AssetManagers before shared libraries. Overlays are now
loaded as shared libraries so they must be assigned package ids
after non-overlay shared libraries so enabling and disabling
overlays does not affect the package ids of the non-overlay shared
libraries.

Since overlays are added to the end of the AssetManager by
ResourcesManager, enabling and disabling overlays will not change
the assets cookie of shared libraries loaded through ResourcesManager,
but it will change the apk assets cookie or overlays added through
AssetManager#addAssetPathAsSharedLibrary.

The package ids of shared libraries added through
AssetManager#addAssetPathAsSharedLibrary will not be affected by
overlays since overlay package ids are assigned last.

Bug: 146685730
Test: CtsHostsideWebViewTests
Change-Id: If7ea17d51b18769bf2465e29af3ae6a71004d06c
2020-03-23 18:14:11 -07:00
Ryan Mitchell
b894c274d0 Revert "Assign shared libraries stable package ids"
This change must be reverted because it broke packages with the same
package name but different package ids loaded at once.

Bug: 146685730
Test: MultiSplitInstallTest
This reverts commit fe50d739f7.

Change-Id: If6364fd660c76284452f77e7d4f09a3df9dede1d
2020-03-23 18:05:40 -07:00
Ryan Mitchell
c07aa70270 Add ResourcesProvider.loadFromDirectory
This API allows a directory to be loaded as if it was a zipped APK.
This is a substitute for the DirectoryAssetProvider API that
currently does not work in the native layer.

Bug: 142716192
Test: atest FrameworksResourceLoaderTests
Change-Id: Ia13e15653e75b421423dd56f9fe89e183ab4cb9a
2020-03-19 18:33:55 -07:00
Ryan Mitchell
155d539634 Sort bag by attribute key when using libs
When shared libraries are assigned package ids in a different order
than compile order, bag resources that use attributes from both
multiple libraries will not be sorted in ascending attribute id order.
This change detects when the attribute ids are not in order and sorts
the bag entries accordingly.

The change is designed to be less invasive. Deduping the GetBag logic
should probably be spun off in a separate bug.

Bug: 147674078
Test: libandroidfw_tests
Change-Id: Id8ce8e9c7ef294fcc312b77468136067d392dbd0
2020-02-10 14:12:00 -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
Ryan Mitchell
fe50d739f7 Assign shared libraries stable package ids
When a shared library package is loaded into an AssetManager, the
shared library will be assigned a unique package id. Subsequent
AssetManaagers that load a shared library of the same package name
as the original shared library will use previously assigned package
name. Shared libraries will have stable package ids throughout the
lifetime of application.

Bug: 140790224
Bug: 128496033
Test: libandroidfw_tests
Test: third-party app no longer crashes on open
Test: atest CtsHostsideWebViewTests
Change-Id: Idc0315be21ea00b74d1a918b7083ad655104c008
2020-01-10 23:15:06 +00:00
Ryan Mitchell
8a891d86ab Allow for RRO internal referencing
This change allows RROs to reference their own internal resources as
expected.

Overlays are loaded as shared libraries so they can have their own
resource id space that does not conflict with the resource id space of
the target or other overlays.

References to overlay resources that override target resources now
appear as references to the target resources.

Overlay values that are inlined into the xml file specified using
android:overlayResources are now able to be used at runtime.

See go/rro-references for more information.

Bug: 135943783
Test: idmap2_tests
Test: libandroidfw_tests
Change-Id: Ie349c56d7fd3f7d94b7d595ed6d01dc6b59b6178
2019-10-17 13:09:33 -07:00
Winson
9947f1e4fa Add ResourceLoader API with .apk and .arsc support
ResourceLoaders allow inserting another .apk/.arsc into AssetManager's
resource resolution search. The effect is similar to overlays,
where a entry of >= config later in the path list will return that
ApkAsset's resource value instead.

Because loading from an .arsc is supported, which doesn't contain
any actual files, ResourceLoader exposes loadDrawable and
loadXmlResourceParser to allow an application load those files from
anywhere or create them in code.

The data being loaded is either pushed into an .apk or .arsc that
mocks itself as the package being "overlaid" and is passed in
through ResourcesProvider, an interface with static methods that
supports loading from a readable path on disk or a FileDescriptor.

The APIs are accessed through a Context's getResources(), which
has been changed to be unique per "Context-scope", which is usually
the lifetime of the Java object. The exception is that Activities
who get their Resources object persisted across recreations
maintain that logic for persisting ResourceLoaders.

Bug: 135270223

Test: atest FrameworksResourceLoaderTests

Change-Id: I6929f0828629ad39a21fa155e7fec73bd75eec7d
2019-10-10 15:41:03 -07:00
Ryan Mitchell
2e3942246d Enable CTS verification of overlayable API
Allows retrieval of a string representation of overlayable resources
that can be compared during CTS testing to verify that the overlayable
resources on device match the expected overlayable API.

Bug: 135052616
Test: libandroidfw_tests
Test: atest OverlayHostTest
Change-Id: I613f28c202a0904a917577f932d072111c1aa7bd
2019-09-26 17:53:20 +00:00
Ryan Mitchell
31b1105762 Suppress compressed rersources.arsc on host
Do not print warnings when an APK loaded into aapt2's symbol table has a
compressed resources.arsc. This log is helpful at runtime since
compressed arscs take longer uncompress.

Bug: 130617130
Test: manual
Change-Id: I52847663ad8f46ba00d3dd1ebb2292ab54737680
2019-06-13 13:47:26 -07:00
Eric Holk
3509b624fe Remove obtainStyledAttribute and AssetManager2::GetBag tracing
These traces are small and noisy, so they hurt performance more than they help.

This reverts commit c37457799b.

Test: m
Bug: 132721345
Change-Id: I9ef719f54f2bc8a54f23e88f46d74e35417a6519
2019-05-20 15:27:28 -07:00
Ryan Mitchell
93bca97e7c Allow non-references to be copied between AssetManagers
Hard-coded values in styles can be copied between AssetManagers even if
the source package is not present in the destination AssetManager. Only
references and strings should be prevented from being copied over
because they would be invalid in the destination AssetManager.

Bug:126400561
Test: manual
Change-Id: I970a3e961763b2c003c15b950d864a9a0b615022
2019-04-05 12:44:51 -07:00
Mårten Kongstad
dbf343becb RRO: remove ability to overlay assets
Target packages use <overlayable> to opt-in to RRO. While this works for
resources, it does not support assets. For security reasons, remove the
ability to overlay assets via RRO for now: a future change may extend
<overlayable> to include assets.

Test: atest OverlayDeviceTests
Bug: 120867881
Change-Id: Ie0b6897f0586ea8b9d75f357e216904e25d4dc7b
2019-03-19 15:40:55 -07:00
Ryan Mitchell
2c4d874d72 Invalidate style stack resids
Style resid stacks should also be invalidated when invalidating
AssetManager caches.

Bug:117176857
Test: manual
Change-Id: I28224597adf4b0af8326bd788eab289e4ba60418
2019-03-04 17:50:11 +00:00
Ryan Mitchell
2fe2347e1e Add ANDROID_LOG to supress android specific logs
AAPT2 uses AssetManager2 as the implmentation of its symbol table.
When generating the the R.java, AAPT2 adds information about styleables
in the comments. If the first symbol table checked by the delegate is an
AssetManager2 symbol table and it does not contain the styleable
attribute being searched for, a bogus error is printed and the resource
is found in a later symbol table.

Bug: 126596328
Test: m -j Settings && diffed generated java files
Change-Id: If86a9d62fd72317525dffa862be1267621f93afd
2019-02-27 15:08:53 -08:00
Ryan Mitchell
a55dc2ed6b Fix long paths on Windows
util::mkdirs iteratively creates each directory of a specified path. For
windows, Calling mkdir on only the drive letter or on the extended path
prefix (\?\\) will result in an error. Start after the long path prefix
and the drive letter.

This also changes AAPT2 to use AssetMaanager2 to retrieve symbols from
the symbol table. AssetManager2's zip library uses _wopen to open
windows files.

Bug:123251200
Test: aapt2_tests.exe
Change-Id: I26169d83b22d441485de3c49d63a6c4ed710e292
2019-02-20 09:46:00 -08:00
Mårten Kongstad
c92c4dd6c6 Surface <overlayable> info in Java AssetManager
Add a new, hidden method to AssetManager to extract a mapping
overlayable name -> overlayable actor for all <overlayable> blocks in a
package. [This will eventually be used to check if the caller of the OMS
AIDL API is the registered actor for a given overlay.]

Also, teach AssetManager2 to not accept packages that re-use the same
overlayable name. [Such packages have always been ill-formed.]

Bug: 123894537
Test: make libandroidfw_tests
Change-Id: I1117fd3503f04fe4c73eb7114901e022508f4d9e
2019-02-07 14:32:16 -08:00
Aurimas Liutikas
8f004c85a0 Add helper methods for View attribute debugging
Adding abilities to debug:
- Attribute resolution stack (which resources are looked
  at when resolving an attribute)
- Attribute value source (where did each attribute value
  get defined)
- Get explicit style id (if a view had it set via style="...")

This feature will be behind Settings.Global flag that Android
Studio will set to the debugged application package ID.

Bug: 111439551
Test: atest CtsViewTestCases:android.view.cts.ViewStyleTest
Change-Id: Ib6f9fc81000bb867b5b94a68953c99b0bc802d6c
2019-02-06 14:46:17 -08:00
Ryan Mitchell
741e96ff07 Fix GetResourceName for shared libraries
GetResourceName used GetPAckageById which only works when the compile
time package id is eqal to the runtime package id. This change resolves
resource names correctly using the ruuntime package id.

Bug: 79666085
Test: libandroidfw_tests
Change-Id: Ic60cb2416329c5cb34e925991cd689ca7574b483
2019-01-24 15:45:43 -08:00
Winson
2f3669b767 Add function to return path for last resolved resource
After an AssetManager.FindEntry call is made, either directly or from any of the resource entry calls, a stack of the steps taken to resolve the resource is saved. Those steps can be retrieved as a log later on by calling AssetManager.GetLastResourceResolution, which returns a formatted string of the resource ID/name and path taken, including the configs and package names of each step.

Logging and the saving of the steps to memory can be enabled/disabled with the @hide .setResourceResolutionLoggingEnabled() method on AssetManager.

Bug: 122374289

Test: cases for single and multi ApkAssets loaded
Test: case for no resolution made
Test: made test app to display log on device
Test: added debugging call to source and ran through on-device apps

Change-Id: I6a32b8d4020c3f8510032ff7f431510089fff43f
2019-01-14 14:52:00 -08:00
Ryan Mitchell
449a54fb6b Do not include system overlay data when excluded
Do not include configurations or locales from overlays overriding system
resources when exclude_system is specified in GetResourceConfigurations
or GetResourceLocales.

Bug: 120083032
Test: run cts -m CtsContentTestCases -t
  android.content.res.cts.AssetManagerTest#testGetNonSystemLocales

Change-Id: I4ba3b07d3bb9ac72b196ff7ed4d1e853b51f7eea
2018-12-04 00:58:14 +00:00
Ryan Mitchell
0d5a91b137 Merge "Fix copying null reference across themes" 2018-11-20 01:00:45 +00:00
Ryan Mitchell
b85d9b2a32 Fix copying null reference across themes
When themes have two different AssetManagers, we only copy attributes
that exist in both the themes. If the value of the attribute or
reference is equal to 0 (a null reference but not using the TYPE_NULL
type), do not attempt to fix the package id of that null reference.

Bug: 119522708
Test: manual test of broken app
Change-Id: Id615d5a47b7f121b08bbba885d106b9cd3f54afc
2018-11-19 14:09:14 -08:00
Aurimas Liutikas
d42a670ee5 Add style value to ResolvedBag in AssetManager2.
Bug: 117176857
Test: updated AssetManager2Test.MergesStylesWithParentFromSingleApkAssets
Change-Id: I2b79eea8e43431a932756b267b91eb4423c968a5
2018-11-16 10:50:34 -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
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
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
y
57cd195c43 AAPT2: GetBag infinite recursion fix
Style resources with circular parental dependencies caused infinite
recursion when calling AssetManager2::GetBag. This fix allows recursion
to cease when a circular dependency is found.

Bug: 77928512
Change-Id: Ib900c36ab1aef5da5b03234a9484c4dad3b63c02
Test: Manual test of b/77928512 and duplicates of 74493983
2018-04-13 08:50:09 -07:00
Ryan Mitchell
6759955c95 Fixed resource bag retrieval infinite recursion.
An app was crashing because in an attempt to retrieve layout
attribute/style data, the app infinitely recursed because its parent was
set to itself. This change checks if the resource bag parent and child
have the same ids, and if so, attempts to find the resource in this bag
alone rather than attempting to also look in parent bags.

Bug: 74493983
Test: Manual testing of Fitbit app
Change-Id: Iea37533a0676bd51b72c9bb235adec9bd04f2ccc
(cherry picked from commit ac04095ba9)
2018-04-04 15:55:34 +00:00
Adam Lesinski
bebfcc46a2 Refactor AssetManager
Bug: 64071469
Test: atest CtsContentTestCases
Change-Id: Ia6856157e8813856268fba003e1e591d690cb26e
2018-02-28 19:06:48 -08:00
Adam Lesinski
bde1df21ad Revert "Replace AssetManager with AssetManager2 implementation"
This reverts commit 1187590da3.

Bug: 73134570
Change-Id: I59b4d714e447478ea124f086356f127f42251fb7
2018-02-09 12:43:24 -08:00
Adam Lesinski
2a447172a5 Revert "libandroidfw: Make sure to set the 'app as lib' flag"
This reverts commit 9ad287c828.

Bug: 73134570
Change-Id: If930d3a7c17fc2f7ffaebd31281ad5a5d120144f
2018-02-09 12:43:17 -08:00
Adam Lesinski
b8b3a26194 Revert "libandroidfw: Improve performance of AssetManager2"
This reverts commit 88c9959e5b.

Bug: 73134570
Change-Id: I012643d2b4212cef5aef68feb4146add34f9ecfc
2018-02-09 12:43:10 -08:00