summaryrefslogtreecommitdiff
path: root/core/java/android/app/ResourcesManager.java
Commit message (Collapse)AuthorAgeFilesLines
* Round screen size of configurationRiddle Hsu2022-05-121-2/+2
| | | | | | | | | | | | | To avoid precision problem of float, such as (int)(960/1.2f)=799 (int)(960/1.2f+0.5f)=800 (int)(540/1.2f)=449 (int)(540/1.2f+0.5f)=450 Bug: 204481252 Test: DisplayContentTests#testCreateTestDisplayContentFromDimensions Change-Id: I8f78d9bd14b7fb9d12a20a662ad4ec04f82ce7f2
* Merge "Move fixed-rotation-related display information into config"Evan Rosky2022-01-271-48/+20
|\
| * Move fixed-rotation-related display information into configEvan Rosky2022-01-261-48/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Augment the "apparent" display information in configuration from just the display bounds (maxBounds) to also include the display rotation and cutout. Like maxBounds, these will be expected to always be set as basically "the display that this configuration was built against". This heavily simplifies fixed-rotation since now we don't need to deal with the "are we overriding?" question and also don't need extra activity servertransactions. The configuration is also in sync (since it is the source of truth used by resources). Additionally, this means that even the current legacy fixed-rotation model should work with in any mixed-rotation situtaion, not just fullscreen. Bug: 202201326 Test: atest DisplayTest Change-Id: I6232f74c74324b70b1b0c9f46448c509c2694310
| * Merge "Apply pending AppInfo on Activity override change" into sc-dev am: ↵TreeHugger Robot2021-07-131-0/+6
| |\ | | | | | | | | | | | | | | | | | | | | | d2dd630204 am: 0e619ec793 Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15260966 Change-Id: I085da96a4690d57e4ca2247fb6c39b6825f40be2
| * \ Merge "Do not update RM config with previous sequence" into sc-dev am: ↵TreeHugger Robot2021-07-021-65/+73
| |\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | 9b1891b428 am: 4623229372 Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15190447 Change-Id: Iee37c892298affca673011d53657f54cbf0ea504
| * \ \ Merge changes from topic "revert-15058002-SNQUARIDWJ" into sc-dev am: ↵Ryan Mitchell2021-07-011-5/+38
| |\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | b3659d36b0 am: 30d3f5c8cc Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15156470 Change-Id: Iaccb9ef10405114fa3cc3456404759a8d49678ed
| * \ \ \ Merge changes from topic "revert-15058002-SNQUARIDWJ" into sc-dev am: ↵Paul Hobbs2021-06-291-38/+5
| |\ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 8d440c0566 am: 30c6c3da16 Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15144638 Change-Id: I480ec5d23f070c8383ea121432a9dd6c563a9188
| * \ \ \ \ Merge changes Icf81845d,Iea54abf3,I98656314 into sc-dev am: 5a532f6eed am: ↵Ryan Mitchell2021-06-271-5/+38
| |\ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | f55b43b332 Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15058002 Change-Id: Ifd34e72963e196376f408eac4f195142575a4402
| * \ \ \ \ \ Merge "Obtain DisplayMetrics from DisplaymanagerGlobal directly" into sc-dev ↵Charles Chen2021-06-251-54/+7
| |\ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | am: 7850ca8527 am: 5aa91533f4 Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15079490 Change-Id: I6750a747e8c686392de45483770d28bdd78e52d1
* | \ \ \ \ \ \ Merge "Prefer WeakReference.refersTo() to get()" am: 63e3c2c709 am: ↵Hans Boehm2022-01-271-3/+2
|\ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | aca7bb4b9f am: a2e1dc8b9a Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1956816 Change-Id: I449eec7c2bc21bfa5c7909a4508fbf899a59040d
| * | | | | | | | Prefer WeakReference.refersTo() to get()Hans Boehm2022-01-201-3/+2
| | |_|_|_|_|_|/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is an initial pass over frameworks/core to avoid WeakReference get(), since that can cause the referent to be unnecessarily retained. Most of these were found by searching for "get() == null". Bug: 215259836 Test: Treehugger Change-Id: I5227b05ca22e83b886ccf6713989961076df3f8c
* | | | | | | | Merge "Apply pending AppInfo on Activity override change" into sc-dev am: ↵TreeHugger Robot2021-07-131-0/+6
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | d2dd630204 am: dfd3c926ab Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15260966 Change-Id: Ifb5de96582f8f9abf7c1eabc32f49c59682b9e7a
| * | | | | | | Apply pending AppInfo on Activity override changeRyan Mitchell2021-07-121-0/+6
| | |_|_|_|_|/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When the activity override configuration changes, we need to apply any pending application info changes so that when the activity is recreated, it will have updated overlays. Bug: 193256671 Test: change live wallpaper and observe launcher colors Change-Id: I6b8c25a6e6756f612a0f57c921625bc58ac1ecf6
* | | | | | | Merge "Do not update RM config with previous sequence" into sc-dev am: ↵TreeHugger Robot2021-07-021-65/+73
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 9b1891b428 am: 34502e3deb Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15190447 Change-Id: Ia00c1d45ce2f2fb2da57396d119544382c37c9a2
| * | | | | | Do not update RM config with previous sequenceRyan Mitchell2021-07-021-65/+73
| | |_|_|_|/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If an application info update is pending and RM#applyConfigurationToResourcesLocked is called with a config with an older sequence that RM's current global config, the application info update should not be applied, nor should the global config be updated with the older config. Similarly, when an application is updated and there is a pending application info change for the previous version of the package, clear the currently pending application info updates for that package to prevent the old overlays from being applied on top of the newly updated application. Bug: 189100984 Bug: 192449747 Test: toggle wallpaper and observe QS has correct colors Change-Id: I4bab55960febdae16df7150ccac44e06245e8333
* | | | | | Merge changes from topic "revert-15058002-SNQUARIDWJ" into sc-dev am: b3659d36b0Ryan Mitchell2021-06-301-5/+38
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15156470 Change-Id: I41522622f93d74d94041a9a1286fc6f0e6632d9a
| * | | | | Merge changes from topic "revert-15058002-SNQUARIDWJ" into sc-devRyan Mitchell2021-06-301-5/+38
| |\ \ \ \ \ | | |_|_|_|/ | |/| | | | | | | | | | | | | | | | | | | | | | * changes: Revert^2 "Apply overlay changes with config change" Revert^3 "Deprecate Context#createApplicationContext"
| | * | | | Revert^2 "Apply overlay changes with config change"Ryan Mitchell2021-06-301-5/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit fa5ab2d27bbf7520b31b4a188d91294b7d71e4f8. Reason for revert: Was not the cause of the test failure Fixes: 189100984 Test: toggle wallpaper and observe QS has correct colors Test: launch an app, navigate away from the app, change wallpapers, and observe app is relaunched and has correct colors when resumed Change-Id: Ib3930c06b53f71749ec31784ebe6e8a735a1046d
* | | | | | Merge changes from topic "revert-15058002-SNQUARIDWJ" into sc-dev am: 8d440c0566Paul Hobbs2021-06-291-38/+5
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15144638 Change-Id: I21fe746dbce7f404018377204ec7bb2a43456791
| * | | | | Merge changes from topic "revert-15058002-SNQUARIDWJ" into sc-devPaul Hobbs2021-06-291-38/+5
| |\| | | | | | |_|_|/ | |/| | | | | | | | | | | | | | | | | | | | | | | * changes: Revert^2 "Deprecate Context#createApplicationContext" Revert "Version LoadedApk cache using base code path" Revert "Apply overlay changes with config change"
| | * | | Revert "Apply overlay changes with config change"Paul Hobbs2021-06-291-38/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Revert submission 15058002 Reason for revert: Causes crash in com.android.cts.splitapp, breaks android.appsecurity.cts.SplitTests#testFeatureWithoutRestart_full. Bug: 192242649 Reverted Changes: Icf81845da:Apply overlay changes with config change Iea54abf38:Version LoadedApk cache using base code path I986563142:Revert "Deprecate Context#createApplicationContext... Change-Id: Ifb30daa85d9de4587bc39e074341ebdefaf26f84
* | | | | Merge changes Icf81845d,Iea54abf3,I98656314 into sc-dev am: 5a532f6eedRyan Mitchell2021-06-271-5/+38
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15058002 Change-Id: If4acdbd45591f6def9eb3b6cb5da204efb8f6fe5
| * | | | Merge changes Icf81845d,Iea54abf3,I98656314 into sc-devRyan Mitchell2021-06-271-5/+38
| |\| | | | | |_|/ | |/| | | | | | | | | | | | | | | | | | * changes: Apply overlay changes with config change Version LoadedApk cache using base code path Revert "Deprecate Context#createApplicationContext"
| | * | Apply overlay changes with config changeRyan Mitchell2021-06-241-5/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In R, when overlay changes a configuration change event is triggered within the app process affected by the overlay change immediately after updating the overlay paths of resources objects. All activities would be relaunched after the configuration changed occurred resulting in activity life-cycle events occurring for activities running in the background. Apps may assume that onResume is invoked while they are in the foreground so we made a fix that triggered the activities to be relaunched when they are brought to the foreground. The fix involved storing the asset sequence in the AMS and triggering a configuration change from the AMS for each process affected by the overlay change. This created problems where the app may receive a configuration from the AMS with an updated asset sequence before the event to handle the application info changing actually updated resources objects. This resulted in reinflating views with the updated configuration before the overlays were updated in the underlying resources objects. This change allows allows RM to apply changes to application infos when it sees the asset sequence increase during a configuration change, rather than having to wait for handleApplicationInfoChanged to run. Bug: 189100984 Test: toggle wallpaper and observe QS has correct colors Test: launch an app, navigate away from the app, change wallpapers, and observe app is relaunched and has correct colors when resumed Change-Id: Icf81845da9890cda0fb38cf6fe51d1d66e5ea840
* | | | Merge "Obtain DisplayMetrics from DisplaymanagerGlobal directly" into sc-dev ↵Charles Chen2021-06-251-54/+7
|\| | | | |_|/ |/| | | | | | | | | | | | | | | | | am: 7850ca8527 Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15079490 Change-Id: I34c11960e417eb8888952b755edff84d5e1b4746
| * | Obtain DisplayMetrics from DisplaymanagerGlobal directlyCharles Chen2021-06-241-54/+7
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously we use cache to store value returned from DisplayManagerGlobal#getAdjustedDisplay(int, DisplayAdjustments) in RM#getAdjustedDisplay(int, DisplayAdjustments). Since RM#getAdjustedDisplay(int, DisplayAdjustments) is just used in RM#getDisplayMetrics(int, DisplayAdjustments), we can furthur call getDisplayInfo(int) from DisplayManagerGlobal and call DisplayInfo#getAppMetrics to obtain DisplayMetrics directly. Also, #getDisplayInfo has binder cache, so we don't need another cache to store returned DisplayMetrics value from DisplayManagerGlobal. Before this CL [1/1] android.app.ResourcesManagerPerfTest#getDisplayMetrics: PASSED (10.844s) getDisplayMetrics_median: 1840 perfetto_file_path: /sdcard/test_results/android.app.ResourcesManagerPerfTest_getDisplayMetrics/PerfettoListener/perfetto_android.app.ResourcesManagerPerfTest_getDisplayMetrics-1.pb getDisplayMetrics_mean: 1857 getDisplayMetrics_min: 1817 getDisplayMetrics_standardDeviation: 35 After this CL, com.android.perftests.core (1 Test) [1/1] android.app.ResourcesManagerPerfTest#getDisplayMetrics: PASSED (11.185s) getDisplayMetrics_median: 733 perfetto_file_path: /sdcard/test_results/android.app.ResourcesManagerPerfTest_getDisplayMetrics/PerfettoListener/perfetto_android.app.ResourcesManagerPerfTest_getDisplayMetrics-1.pb getDisplayMetrics_mean: 733 getDisplayMetrics_min: 725 getDisplayMetrics_standardDeviation: 5 Test: atest android.app.ResourcesManagerPerfTest#getDisplayMetrics fixes: 191662456 Change-Id: I934ecae19431800a9a4e0f3e3821e80ef4b5d8cf
* / Handle WindowProviderService#onConfigurationChangedCharles Chen2021-06-181-1/+1
|/ | | | | | | | | | | This CL makes WindowProviderService receive onConfigurationChanged callback when there's a config update from WM side. Test: atest WindowContextTests Test: atest ActivityThreadTest ActivityClientTest ConfigurationHelperTest fixes: 185766946 Change-Id: I922d52c1c38aecc1a948c79039cc03354adc646f
* Disable incremental hardening on own resourcesRyan Mitchell2021-05-271-5/+46
| | | | | | | | | | | | | | | When an application is incrementally installed, and a resources operation fails due to the resources not being fully present, the app should crash instead of swallowing the error and returning default values to not alter the experience of using the application. Disable IncFsFileMap protections on ApkAssets that are a part of the application that is running (base and splits). Bug: 187220960 Test: atest ResourcesHardeningTest Change-Id: Ibc67aca688720f983c7c656f404593285a54999b
* Use internal lock for ResourcesManagerPatrik Torstensson2021-05-051-112/+118
| | | | | | | | | | | - Create a new package private method for applyNewResourceDirs that takes the lock internally in the resources manager class - Move all locking to use the internal lock object Bug: 186411938 Test: on device and local build Change-Id: Idb49c76ceca51ed656fd47b82fad0afca1b2740b
* Move WindowContext module to window packageCharles Chen2021-03-241-3/+2
| | | | | | | | | | | In this way, we can clarify the owners and it is easier to maintain. Also refactor to move WindowContext creation logic to ContextImpl. Test: atest WindowContext WindowContextTests WindowContextPolicyTests Bug: 159767464 Bug: 152193787 Change-Id: I78432aa18aa97e001f5a9a04321109e456fd137b
* Add overlayPaths to ApplicationInfoRyan Mitchell2021-02-081-17/+58
| | | | | | | | | | | | | | | RROs have historically been APK packages. We now have the ability to generate RROs on-the-fly. These "fabricated" RROs are not APKs. ApplicationInfo#resourceDirs documentation states that it only contains paths to packages. To prevent changing the behavior of resourceDirs until we can deprecate and remove it, a new overlayPaths field has been added to ApplicationInfo. This new field contains APK overlay paths as well as non-APK overlay paths. Bug: 172471315 Test: boot enable/disable overlays and examine overlays working as well as package manager dumpsys Change-Id: I78c5eeef73b7d8bada61edc0f64a12a3cdc1ce16
* Fix WindowMetrics not get updated when moving a freeform activityCharles Chen2020-12-021-0/+2
| | | | | | | | | | | | | | | | Previously, we only applied the config changes to Resources if a public fields are updated. After WM#getCurrent(Maximum)WindowMetrics were released, we should also update WindowConfiguration changes to the Resources because WindowMetrics#getBounds is provided by WindowConfiguration fields. This CL updates the window configuration to Resources if there are differences between current & updated window configuration. Bug: 169687278 Test: atest WindowMetricsOnActivityTests Change-Id: I822204dab226d0acae2a0966b8ea05cf8f578b49
* Add @Nullable annotation to the parameter of Object.equals() methods.Roman Kalukiewicz2020-10-151-1/+1
| | | | | | | | | | | | | | | | | | Those annotations could be inferred by some tools (like Kotlin), but the https://checkerframework.org/ doesn't check inherited annotations complaining about all equals() invocations that get nullable argument. The change was generated by running find . -name \*.java | xargs sed -i 's/public boolean equals(Object /public boolean equals(@Nullable Object /' in the frameworks/base directory and by automatically adding and formatting required imports if needed. No manual edits. Bug: 170883422 Test: Annotation change only. Should have not impact. Exempt-From-Owner-Approval: Mechanical change not specific to any component. Change-Id: I5eedb571c9d78862115dfdc5dae1cf2a35343580
* Make process level rotated config and display metrics consistentRiddle Hsu2020-09-211-2/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The application may get Resources instance from Resources.getSystem() and context.getApplicationContext().getResources(). Since fixed rotation is introduced that allows an activity to start in a different rotation than the current display, when using getConfiguration() and getDisplayMetrics() of these Resources instances, the orientation and metrics need to be the same as current display is rotated. Otherwise the app may show unexpected UI layout. Although it is not recommended to use global resources/config for activity. One of the goal of fixed rotation transform is to simulate the app is started in a rotated environment, so this CL makes the configuration and display metrics of system resources are consistent with application and activity for compatibility. About WindowProcessController and ActivityStackSupervisor: The process configuration passed to LaunchActivityItem may be associated from activity. if the sequence number of configuration is overridden by activity, the configuration may be ignored when launching the activity because the sequence number isn't larger than the previous process configuration. Although there will be a ConfigurationChangeItem later to update correct state, the app may get the intermediate state with old configuration and metrics. About ResourcesManager and DisplayAdjustments: There are 2 new fields appWidth and appHeight added to DisplayAdjustments#FixedRotationAdjustments because the display metrics from Resources.getSystem() is independent from activity configuration. Only window manager knows the rotated size, so the values need to send to client and then ResourcesManager takes the adjustment to change the global display metrics. About WindowToken: When fixed rotation is applied on the token, send the FixedRotationAdjustmentsItem first so the later configuration change can pick the adjustment at ActivityThread. And because the registration of activity configuration only occurs on add/remove activity, if it is only switching to another existing activity in different orientation, the process configuration still needs to be updated. About ActivityThread: The code flow for a rotated activity (DA = display adjustments): - Launch new activity handleLaunchActivity: override app DA handleConfigurationChanged: adjust global display metrics by DA performLaunchActivity createBaseContextForActivity: override activity DA - Resume existing activity handleFixedRotationAdjustments: override app and activity DA handleConfigurationChanged: adjust global display metrics by DA handleResumeActivity Also some minor corrections: - Set missing rotated max bounds. - Fix wrong display metrics adjustment that xdpi and ydpi should not be swapped because they are physical attributes. Bug: 167564038 Test: atest DisplayAdjustmentsTests AppConfigurationTests#testRotatedInfoWithFixedRotationTransform WindowProcessControllerTests#testProcessLevelConfiguration DisplayContenTests#testApplyTopFixedRotationTransform Change-Id: I60bedc7e09f54683d5e857ccc51402d5d144cd9e
* Fix lock contention in ResourcesManagerCharles Chen2020-08-241-16/+20
| | | | | | | | | | | | | | | | | | | | | | 1. Scope dowm synchronized block to mAdjustedDisplays put and get 2. Use SoftReference instead of WeakReference because display's weak reference is cleared after getAdjustedDisplay returned and the cache didn't take effects previously. fixes: 162445376 Test: ResourcesManagerPerfTest Before: getDisplayMetrics_median: 3413 getDisplayMetrics_mean: 3439 getDisplayMetrics_min: 3364 getDisplayMetrics_standardDeviation: 107 After: getDisplayMetrics_median: 3048 getDisplayMetrics_mean: 3096 getDisplayMetrics_min: 2999 getDisplayMetrics_standardDeviation: 134 Change-Id: I8a5c3ba960c8231aee78b0e7fb958bf6845d5bb5
* Merge "Don't override config of display contexts with activity display."Darryl Johnson2020-08-201-131/+303
|\
| * Don't override config of display contexts with activity display.Darryl L Johnson2020-08-201-131/+303
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change migrates the previous usages of ResourcesManager#getResources() from using the display id of expected resources to an override display ID which will override the display properties from the parent token resources. This ensures that all contexts derived from a display context keep the overrides for their intended display. This also changes the meaning of ResourcesKey#mOverrideConfiguration and ResourcesKey#mDisplayId. Previously mDisplayId was used as both the current display of the ResourcesKey and used to apply overrides to mOverrideConfiguration. This made it unclear whether a particular key should keep its display override when an activity changes display or whether it should inherit the new display from the activity. Now the display IDs and overrides are managed by the ActivityResources struct and the ResourcesKey is expected to only contain the final display ID expected for the resources in 'mDisplayId' and the final configuration that should be applied to the global configuration in 'mOverrideConfiguration'. Fixes: 153866583 Fixes: 156758475 Fixes: 163813210 Fixes: 163812902 Fixes: 163813227 Test: ActivityThreadTest Test: ResourcesManagerTest Test: AppConfigurationTests#testActivityContextDerivedDisplayContextOrientationWhenRotating Change-Id: If93f98f93ee15b27d8c7292a2f830c2cc0f49277
* | Remove ResourcesManager Slog.wtfRyan Mitchell2020-08-181-2/+2
|/ | | | | | | | | | LoadedApk.updateApplicationInfo can call getResources while holding the ResourcesManager lock. Remove the wtf and replace it wuth a debug warning. Bug: 165367316 Change-Id: I734688edd4e1d218fd0e2438b47ee05e477aa79f Test: presubmit
* Merge "Make resources APIs visible for synthetic bench"Ryan Mitchell2020-08-071-1/+2
|\
| * Make resources APIs visible for synthetic benchRyan Mitchell2020-08-041-1/+2
| | | | | | | | | | | | Bug: 162347228 Test: atest ResourcesPerfWorkloads Change-Id: I02ce8dfbd3569311bb1b716d6129e6d9605a1869
* | Reduce RM createResources lock contentionRyan Mitchell2020-08-071-122/+151
|/ | | | | | | | | | | | | | | | Reduce lock contention for processes that use ResourcesManager#createResources on background threads by preloading the apk assets into a temporary cache while the RM lock is not held. As a result, multiple threads may be performing I/O opening the same apk assets since multiple threads could be preloading the same apk at once. Bug: 111966000 Test: observe significantly less monitor contention with owner bg threads calling android.app.ResourcesManager.createResources Change-Id: Iccf383cb8e1a358af4f71ac242e2216dc5a19ff2
* Remove unnecessarily @System/TestApi annotationsMakoto Onuki2020-06-231-2/+0
| | | | | | | | | | We can't expose APIs if the enclosing class is hidden, so these annotations are redundant. We need to remove them so that we can enable the check. Bug: 159121253 Test: treehugger (i.e. this shouldn't trigger "API has changed" error.) Change-Id: Ie1841a670bdf6c6f4b25a1fc5deed8ec2d18cda2
* Use a ReferenceQueue to prune weak referencesRyan Mitchell2020-06-041-28/+25
| | | | | | | | | | | | | | | | | | | | | | | Currently ResourcesManager iterates over all of its weak references to Resources objects and calls Reference#get to determine if the object has been garbage collected. This method of pruning WeakReferences causes reference locks to be acquired in the native layer and causes lock contention when "references are being processed" by the garbage collector. This change uses a ReferenceQueue to determine if a reference has been garbage collected which should improve performance of ResourcesManager#getResources when the system is under memory pressure. By only removing garbage collected references when creating new Resources objects, the lists grow larger and are periodically pruned rather than attempting to prune entries from the list every getResources invocation. Bug: 157575833 Test: used debugger to observe pruning happening correctly hange-Id: I3277e80edfa441d24de165e738d33c4fac6b4121 Change-Id: I3277e80edfa441d24de165e738d33c4fac6b4121
* Add support to override display adjustments by tokenRiddle Hsu2020-05-111-0/+30
| | | | | | | | | | | | | This is the bridge to link customized adjustments to an activity or window token. The DisplayAdjustments in ResourcesImpl is associated with ResourcesKey. The new usage requires to associate with token. That is why the new field is added in Resources. Bug: 147213487 Test: atest ResourcesManagerTest#testOverrideDisplayAdjustments Change-Id: Ie79c331654d564aee7af8c6ce98a4c72dd3132b1
* Don't override activity display adjustments with app configDarryl L Johnson2020-04-301-6/+18
| | | | | | | | | | | | | | | | | | | When process configuration was applied on the client side it accidentally applied an override to display adjustments in resources for all ResourceImpl objects. This resulted in resources of activities having incorrect display adjustments and reporting incorrect display size. This change fixes the issue by applying the activity's override configuration on top of the app config before updating the display adjustments. Note: This is a slight revert/rework of Ib3ee007bc Fixes: 148639826 Test: ActivityThreadTest#testHandleConfigurationChanged_DoesntOverrideActivityConfig Change-Id: I08a5bc29443fbdefbca791240aeaff8f138b8756
* Revert "Try to reland Ib3ee007bc"Darryl Johnson2020-04-241-6/+9
| | | | | | | | | | | This reverts commit b6415618f1c5e72c44bf342cf4bd8667ebb8abff. Reason for revert: Caused regression of b/149213586 Bug: 148639826 Bug: 149213586 Change-Id: I5248e03b42e3f24a6e2abb134d0bf339e77f484b
* Try to reland Ib3ee007bcwilsonshih2020-04-171-9/+6
| | | | | | | | | | Don't let process configuration change application configuration, but allow to update non-default display configuration while initialize since the context is focus on different display. Bug: 148639826 Test: atest PresentationTest ActivityThreadTest AppConfigurationTests Change-Id: I16ba4eee64406d097b7ff0b7ff5c45175623663a
* Merge changes from topic "invalidate_idmap" into rvc-devRyan Mitchell2020-04-101-2/+2
|\ | | | | | | | | | | | | * changes: Fix InstallOverlayTests fail to install overlay Test that upgrading target apk invalidates idmap Invalidate idmap when target updates
| * Invalidate idmap when target updatesRyan Mitchell2020-04-071-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | When the target package update, check if the idmap file must change. If so, propagate the idmap changes to the targets overlay paths, and invalidate cached overlay ApkAssets in ResourcesManager. Bug: 147794117 Bug: 150877400 Test: OverlayRemountedTest Test: libandroidfw_tests Change-Id: I6115c30bae3672b188a5ff270720a0eea15b43b5
* | Merge "Temporal fix of the Android Auto orientation chaniging on phone's ↵Darryl Johnson2020-04-101-1/+3
|\ \ | |/ |/| | | orientation change." into rvc-dev