diff options
| -rw-r--r-- | core/api/current.txt | 1 | ||||
| -rw-r--r-- | core/java/android/content/res/Resources.java | 20 | ||||
| -rw-r--r-- | core/java/android/content/res/flags.aconfig | 9 | 
3 files changed, 30 insertions, 0 deletions
| diff --git a/core/api/current.txt b/core/api/current.txt index 04f907a59535..f4a9bd11fa48 100644 --- a/core/api/current.txt +++ b/core/api/current.txt @@ -13841,6 +13841,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 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 diff --git a/core/java/android/content/res/Resources.java b/core/java/android/content/res/Resources.java index 1b37092f77b6..36719805b9c3 100644 --- a/core/java/android/content/res/Resources.java +++ b/core/java/android/content/res/Resources.java @@ -29,6 +29,7 @@ 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; @@ -46,6 +47,7 @@ import android.compat.annotation.UnsupportedAppUsage;  import android.content.Context;  import android.content.pm.ActivityInfo;  import android.content.pm.ActivityInfo.Config; +import android.content.pm.ApplicationInfo;  import android.content.res.loader.ResourcesLoader;  import android.graphics.Movie;  import android.graphics.Typeface; @@ -2825,4 +2827,22 @@ public class Resources {              }          }      } + +    /** +     * Register the resources paths of a package (e.g. a shared library). This will collect the +     * package resources' paths from its ApplicationInfo and add them to all existing and future +     * contexts while the application is running. +     * A second call with the same uniqueId is a no-op. +     * The paths are not persisted during application restarts. The application is responsible for +     * calling the API again if this happens. +     * +     * @param uniqueId The unique id for the ApplicationInfo object, to detect and ignore repeated +     *                 API calls. +     * @param appInfo The ApplicationInfo that contains resources paths of the package. +     */ +    @FlaggedApi(android.content.res.Flags.FLAG_REGISTER_RESOURCE_PATHS) +    public static void registerResourcePaths(@NonNull String uniqueId, +            @NonNull ApplicationInfo appInfo) { +        throw new UnsupportedOperationException("The implementation has not been done yet."); +    }  } diff --git a/core/java/android/content/res/flags.aconfig b/core/java/android/content/res/flags.aconfig index db81e847d6bd..f660770d2fc8 100644 --- a/core/java/android/content/res/flags.aconfig +++ b/core/java/android/content/res/flags.aconfig @@ -40,3 +40,12 @@ flag {      description: "Feature flag for creating an frro from a 9-patch"      bug: "309232726"  } + +flag { +    name: "register_resource_paths" +    namespace: "resource_manager" +    description: "Feature flag for register resource paths for shared library" +    bug: "306202569" +    # This flag is read in ResourcesImpl at boot time. +    is_fixed_read_only: true +} |