Version LoadedApk cache using base code path
When a context is requested through Context#createApplicationContext, the underlying LoadedApk cached in ActivityThread#mResourcePackages is updated using the ApplicationInfo passed in. This creates unexpected problems when using APIs that expect to be able to read resources from a previous version of a package after that package has been updated. With this change, contexts requested through Context#createPackageContext and Context#createApplicationContext will will have an underlying LoadedAPK that is tied to the version of the package represented by the ApplicationInfo. If createPackageContext is invoked before a package updates and then after a package updates, the two contexts will have different underlying LoaddApks. The ActivityThread#mPackages and ActivityThread#mResourcePackages now only hold LoadedAPKs of that were created using ApplicationInfos that were sent to this process from system_server in order to run the application. Whenever a newer version of an ApplicationInfo is delivered from system_server for one of these packages, the previously cached LoadedAPK will be updated using the new ApplicationInfo. This will usually be because of an overlay change or "don't kill" package upgrade. Bug: 188059515 Test: atest FrameworksCoreTests:ContextTest Change-Id: Iea54abf38449c9d8ab9dae16d36d95cbb4d7d8b0
Loading
Please register or sign in to comment