Loading core/api/current.txt +1 −1 Original line number Diff line number Diff line Loading @@ -14422,7 +14422,7 @@ package android.content.res { method public android.content.res.AssetFileDescriptor openRawResourceFd(@RawRes int) throws android.content.res.Resources.NotFoundException; method public void parseBundleExtra(String, android.util.AttributeSet, android.os.Bundle) throws org.xmlpull.v1.XmlPullParserException; method public void parseBundleExtras(android.content.res.XmlResourceParser, android.os.Bundle) throws java.io.IOException, org.xmlpull.v1.XmlPullParserException; method @FlaggedApi("android.content.res.register_resource_paths") public static void registerResourcePaths(@NonNull String, @NonNull android.content.pm.ApplicationInfo); method public static void registerResourcePaths(@NonNull String, @NonNull android.content.pm.ApplicationInfo); method public void removeLoaders(@NonNull android.content.res.loader.ResourcesLoader...); method @Deprecated public void updateConfiguration(android.content.res.Configuration, android.util.DisplayMetrics); field @AnyRes public static final int ID_NULL = 0; // 0x0 core/java/android/app/ResourcesManager.java +5 −16 Original line number Diff line number Diff line Loading @@ -30,7 +30,6 @@ import android.content.res.AssetManager; import android.content.res.CompatResources; import android.content.res.CompatibilityInfo; import android.content.res.Configuration; import android.content.res.Flags; import android.content.res.Resources; import android.content.res.ResourcesImpl; import android.content.res.ResourcesKey; Loading Loading @@ -148,12 +147,8 @@ public class ResourcesManager { * This will collect the package resources' paths from its ApplicationInfo and add them to all * existing and future contexts while the application is running. */ @RavenwoodThrow(reason = "FLAG_REGISTER_RESOURCE_PATHS is unsupported") @RavenwoodThrow(reason = "registerResourcePaths is unsupported") public void registerResourcePaths(@NonNull String uniqueId, @NonNull ApplicationInfo appInfo) { if (!Flags.registerResourcePaths()) { return; } final var application = ActivityThread.currentActivityThread().getApplication(); final var currentAppInfo = application != null ? application.getApplicationInfo() : null; final var sharedLibAssets = new SharedLibraryAssets(appInfo, currentAppInfo); Loading @@ -178,10 +173,6 @@ public class ResourcesManager { */ public @NonNull Pair<AssetManager, Integer> updateResourceImplAssetsWithRegisteredLibs( @NonNull AssetManager assets, boolean reuseAssets) { if (!Flags.registerResourcePaths()) { return new Pair<>(assets, 0); } final int size; final PathCollector collector; Loading Loading @@ -2046,7 +2037,6 @@ public class ResourcesManager { * asset paths. This is invoked in Resources constructor to include all Resources instances. */ public void registerAllResourcesReference(@NonNull Resources resources) { if (android.content.res.Flags.registerResourcePaths()) { synchronized (mLock) { cleanupReferences(mAllResourceReferences, mAllResourceReferencesQueue); mAllResourceReferences.add( Loading @@ -2054,4 +2044,3 @@ public class ResourcesManager { } } } } core/java/android/content/res/Resources.java +2 −9 Original line number Diff line number Diff line Loading @@ -29,7 +29,6 @@ import android.annotation.ColorRes; import android.annotation.DimenRes; import android.annotation.Discouraged; import android.annotation.DrawableRes; import android.annotation.FlaggedApi; import android.annotation.FontRes; import android.annotation.FractionRes; import android.annotation.IntegerRes; Loading Loading @@ -2892,15 +2891,9 @@ public class Resources { * API calls. * @param appInfo The ApplicationInfo that contains resources paths of the package. */ @FlaggedApi(android.content.res.Flags.FLAG_REGISTER_RESOURCE_PATHS) @RavenwoodThrow(reason = "FLAG_REGISTER_RESOURCE_PATHS is unsupported") @RavenwoodThrow(reason = "registerResourcePaths is unsupported") public static void registerResourcePaths(@NonNull String uniqueId, @NonNull ApplicationInfo appInfo) { if (Flags.registerResourcePaths()) { ResourcesManager.getInstance().registerResourcePaths(uniqueId, appInfo); } else { throw new UnsupportedOperationException("Flag " + Flags.FLAG_REGISTER_RESOURCE_PATHS + " is disabled."); } } } core/java/android/webkit/WebViewDelegate.java +2 −37 Original line number Diff line number Diff line Loading @@ -21,10 +21,8 @@ import android.annotation.Nullable; import android.annotation.SystemApi; import android.app.ActivityThread; import android.app.Application; import android.app.ResourcesManager; import android.compat.annotation.UnsupportedAppUsage; import android.content.Context; import android.content.pm.ApplicationInfo; import android.content.res.Resources; import android.graphics.Canvas; import android.graphics.RecordingCanvas; Loading @@ -34,8 +32,6 @@ import android.util.SparseArray; import android.view.View; import android.view.ViewRootImpl; import com.android.internal.util.ArrayUtils; /** * Delegate used by the WebView provider implementation to access * the required framework functionality needed to implement a {@link WebView}. Loading Loading @@ -177,40 +173,9 @@ public final class WebViewDelegate { } /** * Adds the WebView asset path to {@link android.content.res.AssetManager}. * If {@link android.content.res.Flags#FLAG_REGISTER_RESOURCE_PATHS} is enabled, this function * will be a no-op because the asset paths appending work will only be handled by * {@link android.content.res.Resources#registerResourcePaths(String, ApplicationInfo)}, * otherwise it behaves the old way. * No-op. */ public void addWebViewAssetPath(Context context) { if (android.content.res.Flags.registerResourcePaths()) { return; } final String[] newAssetPaths = WebViewFactory.getLoadedPackageInfo().applicationInfo.getAllApkPaths(); final ApplicationInfo appInfo = context.getApplicationInfo(); // Build the new library asset path list. String[] newLibAssets = appInfo.sharedLibraryFiles; for (String newAssetPath : newAssetPaths) { newLibAssets = ArrayUtils.appendElement(String.class, newLibAssets, newAssetPath); } if (newLibAssets != appInfo.sharedLibraryFiles) { // Update the ApplicationInfo object with the new list. // We know this will persist and future Resources created via ResourcesManager // will include the shared library because this ApplicationInfo comes from the // underlying LoadedApk in ContextImpl, which does not change during the life of the // application. appInfo.sharedLibraryFiles = newLibAssets; // Update existing Resources with the WebView library. ResourcesManager.getInstance().appendLibAssetsForMainAssetPath( appInfo.getBaseResourcePath(), newAssetPaths); } } public void addWebViewAssetPath(Context context) {} /** * Returns whether WebView should run in multiprocess mode. Loading core/java/android/webkit/WebViewFactory.java +2 −9 Original line number Diff line number Diff line Loading @@ -541,15 +541,8 @@ public final class WebViewFactory { Trace.traceBegin(Trace.TRACE_TAG_WEBVIEW, "WebViewFactory.getChromiumProviderClass()"); try { sTimestamps.mAddAssetsStart = SystemClock.uptimeMillis(); if (android.content.res.Flags.registerResourcePaths()) { Resources.registerResourcePaths(webViewContext.getPackageName(), webViewContext.getApplicationInfo()); } else { for (String newAssetPath : webViewContext.getApplicationInfo() .getAllApkPaths()) { initialApplication.getAssets().addAssetPathAsSharedLibrary(newAssetPath); } } sTimestamps.mAddAssetsEnd = sTimestamps.mGetClassLoaderStart = SystemClock.uptimeMillis(); ClassLoader clazzLoader = webViewContext.getClassLoader(); Loading Loading
core/api/current.txt +1 −1 Original line number Diff line number Diff line Loading @@ -14422,7 +14422,7 @@ package android.content.res { method public android.content.res.AssetFileDescriptor openRawResourceFd(@RawRes int) throws android.content.res.Resources.NotFoundException; method public void parseBundleExtra(String, android.util.AttributeSet, android.os.Bundle) throws org.xmlpull.v1.XmlPullParserException; method public void parseBundleExtras(android.content.res.XmlResourceParser, android.os.Bundle) throws java.io.IOException, org.xmlpull.v1.XmlPullParserException; method @FlaggedApi("android.content.res.register_resource_paths") public static void registerResourcePaths(@NonNull String, @NonNull android.content.pm.ApplicationInfo); method public static void registerResourcePaths(@NonNull String, @NonNull android.content.pm.ApplicationInfo); method public void removeLoaders(@NonNull android.content.res.loader.ResourcesLoader...); method @Deprecated public void updateConfiguration(android.content.res.Configuration, android.util.DisplayMetrics); field @AnyRes public static final int ID_NULL = 0; // 0x0
core/java/android/app/ResourcesManager.java +5 −16 Original line number Diff line number Diff line Loading @@ -30,7 +30,6 @@ import android.content.res.AssetManager; import android.content.res.CompatResources; import android.content.res.CompatibilityInfo; import android.content.res.Configuration; import android.content.res.Flags; import android.content.res.Resources; import android.content.res.ResourcesImpl; import android.content.res.ResourcesKey; Loading Loading @@ -148,12 +147,8 @@ public class ResourcesManager { * This will collect the package resources' paths from its ApplicationInfo and add them to all * existing and future contexts while the application is running. */ @RavenwoodThrow(reason = "FLAG_REGISTER_RESOURCE_PATHS is unsupported") @RavenwoodThrow(reason = "registerResourcePaths is unsupported") public void registerResourcePaths(@NonNull String uniqueId, @NonNull ApplicationInfo appInfo) { if (!Flags.registerResourcePaths()) { return; } final var application = ActivityThread.currentActivityThread().getApplication(); final var currentAppInfo = application != null ? application.getApplicationInfo() : null; final var sharedLibAssets = new SharedLibraryAssets(appInfo, currentAppInfo); Loading @@ -178,10 +173,6 @@ public class ResourcesManager { */ public @NonNull Pair<AssetManager, Integer> updateResourceImplAssetsWithRegisteredLibs( @NonNull AssetManager assets, boolean reuseAssets) { if (!Flags.registerResourcePaths()) { return new Pair<>(assets, 0); } final int size; final PathCollector collector; Loading Loading @@ -2046,7 +2037,6 @@ public class ResourcesManager { * asset paths. This is invoked in Resources constructor to include all Resources instances. */ public void registerAllResourcesReference(@NonNull Resources resources) { if (android.content.res.Flags.registerResourcePaths()) { synchronized (mLock) { cleanupReferences(mAllResourceReferences, mAllResourceReferencesQueue); mAllResourceReferences.add( Loading @@ -2054,4 +2044,3 @@ public class ResourcesManager { } } } }
core/java/android/content/res/Resources.java +2 −9 Original line number Diff line number Diff line Loading @@ -29,7 +29,6 @@ import android.annotation.ColorRes; import android.annotation.DimenRes; import android.annotation.Discouraged; import android.annotation.DrawableRes; import android.annotation.FlaggedApi; import android.annotation.FontRes; import android.annotation.FractionRes; import android.annotation.IntegerRes; Loading Loading @@ -2892,15 +2891,9 @@ public class Resources { * API calls. * @param appInfo The ApplicationInfo that contains resources paths of the package. */ @FlaggedApi(android.content.res.Flags.FLAG_REGISTER_RESOURCE_PATHS) @RavenwoodThrow(reason = "FLAG_REGISTER_RESOURCE_PATHS is unsupported") @RavenwoodThrow(reason = "registerResourcePaths is unsupported") public static void registerResourcePaths(@NonNull String uniqueId, @NonNull ApplicationInfo appInfo) { if (Flags.registerResourcePaths()) { ResourcesManager.getInstance().registerResourcePaths(uniqueId, appInfo); } else { throw new UnsupportedOperationException("Flag " + Flags.FLAG_REGISTER_RESOURCE_PATHS + " is disabled."); } } }
core/java/android/webkit/WebViewDelegate.java +2 −37 Original line number Diff line number Diff line Loading @@ -21,10 +21,8 @@ import android.annotation.Nullable; import android.annotation.SystemApi; import android.app.ActivityThread; import android.app.Application; import android.app.ResourcesManager; import android.compat.annotation.UnsupportedAppUsage; import android.content.Context; import android.content.pm.ApplicationInfo; import android.content.res.Resources; import android.graphics.Canvas; import android.graphics.RecordingCanvas; Loading @@ -34,8 +32,6 @@ import android.util.SparseArray; import android.view.View; import android.view.ViewRootImpl; import com.android.internal.util.ArrayUtils; /** * Delegate used by the WebView provider implementation to access * the required framework functionality needed to implement a {@link WebView}. Loading Loading @@ -177,40 +173,9 @@ public final class WebViewDelegate { } /** * Adds the WebView asset path to {@link android.content.res.AssetManager}. * If {@link android.content.res.Flags#FLAG_REGISTER_RESOURCE_PATHS} is enabled, this function * will be a no-op because the asset paths appending work will only be handled by * {@link android.content.res.Resources#registerResourcePaths(String, ApplicationInfo)}, * otherwise it behaves the old way. * No-op. */ public void addWebViewAssetPath(Context context) { if (android.content.res.Flags.registerResourcePaths()) { return; } final String[] newAssetPaths = WebViewFactory.getLoadedPackageInfo().applicationInfo.getAllApkPaths(); final ApplicationInfo appInfo = context.getApplicationInfo(); // Build the new library asset path list. String[] newLibAssets = appInfo.sharedLibraryFiles; for (String newAssetPath : newAssetPaths) { newLibAssets = ArrayUtils.appendElement(String.class, newLibAssets, newAssetPath); } if (newLibAssets != appInfo.sharedLibraryFiles) { // Update the ApplicationInfo object with the new list. // We know this will persist and future Resources created via ResourcesManager // will include the shared library because this ApplicationInfo comes from the // underlying LoadedApk in ContextImpl, which does not change during the life of the // application. appInfo.sharedLibraryFiles = newLibAssets; // Update existing Resources with the WebView library. ResourcesManager.getInstance().appendLibAssetsForMainAssetPath( appInfo.getBaseResourcePath(), newAssetPaths); } } public void addWebViewAssetPath(Context context) {} /** * Returns whether WebView should run in multiprocess mode. Loading
core/java/android/webkit/WebViewFactory.java +2 −9 Original line number Diff line number Diff line Loading @@ -541,15 +541,8 @@ public final class WebViewFactory { Trace.traceBegin(Trace.TRACE_TAG_WEBVIEW, "WebViewFactory.getChromiumProviderClass()"); try { sTimestamps.mAddAssetsStart = SystemClock.uptimeMillis(); if (android.content.res.Flags.registerResourcePaths()) { Resources.registerResourcePaths(webViewContext.getPackageName(), webViewContext.getApplicationInfo()); } else { for (String newAssetPath : webViewContext.getApplicationInfo() .getAllApkPaths()) { initialApplication.getAssets().addAssetPathAsSharedLibrary(newAssetPath); } } sTimestamps.mAddAssetsEnd = sTimestamps.mGetClassLoaderStart = SystemClock.uptimeMillis(); ClassLoader clazzLoader = webViewContext.getClassLoader(); Loading