aboutsummaryrefslogtreecommitdiff
path: root/resources
AgeCommit message (Collapse)Author
13 hoursMerge branch 'upstream-google' into some_mergeAng Li
Bug: 339459903 Test: mma Merged-In: I7ee2de434aac767aa009bb0367580618690cb786 Change-Id: I7ee2de434aac767aa009bb0367580618690cb786
15 hoursHandle the `NullPointerException` when looking up resource value of a ↵Googler
`DynamicRefTable` when the data type is invalid. When the data type is invalid, it would make sense to return the corresponding bad code instead of throw an exception. PiperOrigin-RevId: 631864822
9 daysMerge branch 'upstream-google' into merge_upstreamAng Li
Bug: 330075029 Test: mma Change-Id: I12d2ce1a7889d3b6e20496639391e205eeddff06
13 daysMore unsupported SDK code cleanup.Brett Chabot
Perform more cleanup related to the move to a minimum supported SDK of lollipop (21) missed in last commit (c577257599dc30cf283f8961c286d4ef65e799cb): - Remove methods with a maxSdk of JELLY_BEAN* - Remove RuntimeEnvironment.castNativePtr and associated Number to long conversions - Set default manifest minSdkVersion and targetSdkVersion to 21 - Remove if checks for apiLevel that are now redundant - Remove redundant Config(minSdk = LOLLIPOP) statements PiperOrigin-RevId: 628203572
2024-04-18Merge branch 'upstream-google' into attempt_merge_upstreamAng Li
Change-Id: Ic6cfe2bf398c32bb4ce8750dbec7f95bd2645f44
2024-04-17Small fixes on potential null pointers since ARSC loading support.Googler
With the support of ARSC loading, some pointers potentially become null. This CL fixes this. PiperOrigin-RevId: 625839793
2024-04-03Merge remote-tracking branch 'aosp/upstream-google' into mergeRex Hoffman
Change-Id: If1ded0da6c081dd2c72e2ec28169255b23388103
2024-03-22Merge branch 'google' into 'master'Michael Hoisie
2024-03-18Fixing all missed deltas (bad merges) between upstream robolectric google ↵Rex Hoffman
branch and android Test: CI Bug: 329927152 Change-Id: I73a9832b68fa96feb728488cd42ae12779537c3f
2024-03-13Merge branch 'upstream-google' into roboUpdateKevin Liu
Pulling updates from Github to Android Bug: 323922587 Test: mma && atest CtesqueRoboTests Change-Id: I09cbfb2246c40f333819959e5faf6de3b0567bdd
2024-03-11Fix documentation for methods in `AndroidManifest`Gaëtan Muller
The `getMinSdkVersion()` and `getTargetSdkVersion()` were outdated, saying that the default value is Jelly Bean, instead of KitKat
2024-03-06Support loading arbitrary ARSC resources from a file descriptor.Googler
This serves one step of supporting Material You Colors on Robolectric, since the device version of Material You Colors loads a bespoke ARSC file. PiperOrigin-RevId: 613340893
2024-02-18Fix UnnecessaryParentheses for resources moduleutzcoz
See https://errorprone.info/bugpattern/UnnecessaryParentheses. Signed-off-by: utzcoz <utzcoz@outlook.com>
2024-02-12Deprecate the rest of RoboSettingsMichael Hoisie
The global scheduler is broken and will be removed soon. PiperOrigin-RevId: 606482645
2024-02-12Improve the performance of RebuildFilterList by 6xMichael Hoisie
In the main loop of CppAssetManager2.RebuildFilterList, each ResTable_config object was cloned before the match function, which was unnecessary if the ResTable_config was not a match. During the filter process, the majority of entries are not matches (only around 100 out of ~4000 are matches). This caused allocation of ~4000 ResTable_config objects each time, even though only a small fraction matched. Update the logic to only make a copy if the match is successful. This makes RebuildFilterList around 6x faster. In the added benchmark, the time of the benchmark went from around 6s -> 1s. PiperOrigin-RevId: 606294716
2024-02-07Add perf stat for RebuildFilterListMichael Hoisie
There is some concern this method is a bottleneck in certain types of test classes, such as parameterized tests that generate a lot of test methods. RebuildFilterList iterates over all resource table entries and determines if they match a particular configuration. The time complexity of RebuildFilterList os O(# of system resource config entries + # of app resource config entries). At a minimum it will iterate over ~4k+ resource table config entries for SDK 34. It currently is invoked at least 9 times per test method that initializes am Application, and more if RuntimeEnvironment.setQualifiers is called. PiperOrigin-RevId: 605110482
2024-01-08Merge branch 'google' into 'master'Michael Hoisie
2023-11-29Merge branch 'upstream-google' into convert_iso_keyboardAng Li
Change-Id: I3b461f268555bfd37fe8bb135e097b967d70ad17
2023-11-28Bump default minSdk to 19 of AndroidManifestutzcoz
Signed-off-by: utzcoz <utzcoz@outlook.com>
2023-11-27Remove obsolete targetSdkVersion=O handling.Brett Chabot
Robolectric's AndroidManifest parser has now long obsolete logic that interpret targetSdkVersion=O as 26. This commit removes that logic. PiperOrigin-RevId: 585739314
2023-11-27Add warning message when AndroidManifest cannot be found.Brett Chabot
Users using the Android Gradle Plugin currently need to specify testOptions.unitTests.includeAndroidResources = true for Robolectric to have access to AndroidManifest and other Android resources. Without this config setting, users may see cryptic errors at runtime like "Unable to resolve activity for Intent " when launching an Activity. This commit adds an additional console message when AndroidManifest cannot be found, to instruct that AGP users may want to add the includeAndroidResources config option. PiperOrigin-RevId: 585734701
2023-11-03Merge branch 'upstream-google' into to_main_againAng Li
Change-Id: I35ea66f33f8f625f4f7758935dfc39aaee07b386
2023-10-31Fix AttributeSetBuilder lookups with sparse resource table encodingMichael Hoisie
There were two issues when using AttributeSetBuilder with sparse resource table encoding. The first was that the offset to the sparse table index was not taking the header size into account. The second issue was that when a matching sparse entry was located, it was returning the entry number, not the entry index, which requires a lookup in the sparse entry index. Fixes #8578 PiperOrigin-RevId: 578082446
2023-10-19Merge branch 'upstream-google' into merge_shadow_change3Ang Li
Test: (Both tested in `main`) atest -c SystemUIGoogleRoboRNGTests atest -c CtesqueRoboTests Change-Id: I823a9cbac4fdcb9ccba8f07bf452e1e4375ff96c
2023-10-17Increment targetSdk and compileSdk from 33 to 34 for integration tests.Brett Chabot
Now that Robolectric supports SDK 34, increment existing integration tests to target and compile against it. Also update targetSdkVersion in manifests from 16 to 19. This also required a couple additional changes: - use native graphics mode for androidx_test. With targetSdk 34, legacy graphics mode resulted in 0 width views - Specify an intent filter for androidx_test Activity. Otherwise IntentsTest will fail with 'No activities found', because the AppsFilter will block access to other apps. PiperOrigin-RevId: 574287184
2023-10-13Default to binary resources mode.Brett Chabot
Currently Robolectric will select binary resources mode if and only if there is a binary resources file present. Legacy resources mode is not supported on Android SDKs greater than P. Thus if a test setup doesn't have a binary resources file, and is executed on a SDK > P, Robolectric will skip executing the test. This commit changes Robolectric behavior so that: - binary resources mode is preferred by default. - Support no resources in binary resources mode by defaulting manifest values, similar to the legacy resource logic. - Fail a test if legacy resource mode is selected when running on SDKs > P. A future change, at a TBD date, will remove legacy resources mode support entirely. Fixes #7249 PiperOrigin-RevId: 573243275
2023-10-12Fix issue using AttributeSetBuilder with compact resource table entriesMichael Hoisie
AttributeSetBuilder uses CppAssetManager, which did not support compact resource table entries. PiperOrigin-RevId: 573103527
2023-10-03Clean up obsolete aliases for Truth.Krzysztof Kosiński
Bug: 255714762 Test: presubmit Change-Id: Ib9c467d448309f1d0fce3f86289a2e85bea15b3b
2023-09-29Upstream some of useful logging and ShadowDateIntervalFormat update to GithubGoogler
Update ShadowDateIntervalFormat due to DataIntervalFormat class moved to a diff package PiperOrigin-RevId: 569516571
2023-09-13Merge branch 'upstream-google' into roboUpdateKevin Liu
First update after robolectic is sync through AOSP Bug: 283664894 Test: mma && atest MyRoboTests Change-Id: Id719d7f3e74a8df514d58df8c84177421bf96d64
2023-08-31Use a global cache for ApkAssetsMichael Hoisie
Previously there was a per-sandbox cache for ApkAssets objects that was stored redundantly in both ShadowArscApkAssets9 and ShadowArscAssetManager{9,10}. However, with the proliferation of sandbox parameters (looper modes, graphics modes, instrumentation configuration), and the increase in size of system resource tables, system resource blobs began to dominate the memory consumption of test processes. This problem was especially salient in large multi-sdk test processes common in Gradle environments. Switch to using a global cache for system resources. This will reduce overall memory consumption for tests that initialize a lot of sandboxes. It also makes it possible for ApkAssets objects to be collected (though the underlying CppApkAssets will not be collected). If necessary, there could be logic to clear this cache when sandboxes of a certain SDK level are evicted from the SandboxManager cache. For #7359 For #8432 PiperOrigin-RevId: 561711131
2023-08-25Merge branch 'upstream-google' into roboLibSyncKevin Liu
Included most recent Robolectric updates and code that can be compiled for different SDK versions Bug: 293573045 Test: mma Change-Id: Icc3cc550589b47266a87e64ba27040fa1ebb1032
2023-05-26Support sparse encoding in AttributeSetBuilder.Brett Chabot
This is necessary to support android U, where framework resources use sparse encoding. PiperOrigin-RevId: 535691220
2023-05-24Merge branch 'upstream-google' into rng_importRam Peri
Test: atest -c MyRoboTests Bug: 284193357 Change-Id: I493c1e89a6b0d179477e9be4427235aa789d5051
2023-05-24Support sparse encoding in FindEntryByName.Brett Chabot
This commit updates Robolectric support with the transliterated latest logic from [AOSP](https://cs.android.com/android/platform/superproject/+/master:frameworks/base/libs/androidfw/LoadedArsc.cpp;drc=18c66d8fee0e0dd8681182a59b59119a21e09c0c;l=357) This is needed because android U uses sparse encoding for framework resources. Fixes ResourcesTest#getIdentifier_material on U. PiperOrigin-RevId: 534882855
2023-05-23Merge branch 'upstream-google' into tm_syncRam Peri
Test: atest -c MyRoboTests Bug: 281899632 Change-Id: Ic205da6e976c3c7cb1b91c332ddfd22d906ffe51
2023-05-08Enable version catalogsYOUNG HO CHA
Fix #7196
2023-04-09Merge branch 'google' into 'master'Michael Hoisie
2023-04-08Support partial AppComponentFactory in Robolectricutzcoz
Support to use AppComponentFactory in Robolectric from SDK 28. This CL only supports BroadcastReceiver with custom AppComponentFactory. In Robolectric, developers use Robolectric#setupService or Robolectric#buildService to initialize Service instance, and these methods are static, so it's difficult to leverage custom AppComponentFactory to initialize Service instance with custom constructor. And I don't find proper usage scenarios to use custom AppComponentFactory to initialize ContentProvider, Application, Activity and ClassLoader. So I leave them as not implemented state. Signed-off-by: utzcoz <utzcoz@outlook.com>
2023-04-07Merge branch 'upstream-google' into third_upstream_to_masterAng Li
Test: Presubmit. Bug: 266743146 Change-Id: I7a583eb7b025a1ac75733eebd273de3582d1fa02
2023-04-06Add support for ARSC resource table compact encodingRex Hoffman
Add support for a ResTable type chunk encoded using FLAG_OFFSET16 and a ResTable entry type chunk encoded using FLAG_COMPACT. Test: atest BackupFrameworksServicesRoboTests Test: atest ClockworkSettingsRoboTests Test: atest PixelSetupWizardRoboTests Bug: 275572186 Merged-In: I4e3e6139c76f016dcdec645fa1d1dabd095bde14 Merged-In: I80ab246501e72bcf5a07724dba6bf22d7b94d1a2 Change-Id: I80ab246501e72bcf5a07724dba6bf22d7b94d1a2
2023-04-04Add support for ARSC resource table compact encodingMichael Hoisie
This is to support a preliminary option in AAPT2 to enable more compact resource tables. Add support for a ResTable type chunk encoded using FLAG_OFFSET16 and a ResTable entry type chunk encoded using FLAG_COMPACT. PiperOrigin-RevId: 521855080
2023-03-16Fix line length issue in LoadedArscMichael Hoisie
2023-03-16Fix some Java Lint naming errorsMichael Hoisie
This is a pure naming change made by find/replace in bash. The current binary resources system is transliterated from C++ code, and changes often trigger Lint errors. Long-term the naming and spacing should be updated to follow Java conventions.
2023-02-01Support ResTable staged alias typeJoshua Selbo
2023-01-03Merge branch 'upstream-google' into rng7Ram Peri
Bug: 263483214 Test: atest -c MyRoboTests Change-Id: Idf85ceeb3e0b4b18dfc2eb36e10f22b254fca400
2023-01-02Bump compile-testing from 0.19 to 0.21.0dependabot[bot]
Bumps [compile-testing](https://github.com/google/compile-testing) from 0.19 to 0.21.0. - [Release notes](https://github.com/google/compile-testing/releases) - [Commits](https://github.com/google/compile-testing/compare/compile-testing-0.19...v0.21.0) --- updated-dependencies: - dependency-name: com.google.testing.compile:compile-testing dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com>
2022-12-14Merge branch 'upstream-google' into upgradeRex Hoffman
Bug: 261732603 Test: mma in /external/robolectric Change-Id: I83798f09a58fccd3cd654606b72e4603c64c9f75
2022-12-02Merge branch 'google' into 'master'Michael Hoisie
2022-12-02Support zip files where EOCD's offset to central dir is -1Michael Hoisie
When zip files contain more than 2**16 entries, the regular EOCD is not sufficient to describe the number of files in the archive, and a Zip64 EOCD needs to be written. When a Zip64 EOCD is written, some zip libraries write -1 for many of the fields in the regular EOCD, including the offset to central dir: From APPNOTE.TXT §4.4.1.4 If one of the fields in the end of central directory record is too small to hold required data, the field SHOULD be set to -1 (0xFFFF or 0xFFFFFFFF) and the ZIP64 format record SHOULD be created. Previously FileMap assumed that the regular EOCD contained a valid offset to central dir field. This broke recently when an experimental Android SDK had more than 64k entries in the zip file and -1 for the offset to the central dir. Add support for reading the offset to the central from the Zip64 EOCD. Also add a test case that generates a problematic zip file. PiperOrigin-RevId: 492538213