Loading core/java/android/content/pm/PackageParser.java +3 −3 Original line number Diff line number Diff line Loading @@ -1457,7 +1457,7 @@ public class PackageParser { private static AssetManager newConfiguredAssetManager() { AssetManager assetManager = new AssetManager(); assetManager.setConfiguration(0, 0, null, null, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, Build.VERSION.RESOURCES_SDK_INT_FULL); 0, 0, 0, Build.VERSION.RESOURCES_SDK_INT); return assetManager; } Loading Loading @@ -9017,7 +9017,7 @@ public class PackageParser { AssetManager assets = new AssetManager(); assets.setConfiguration(0, 0, null, null, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, Build.VERSION.RESOURCES_SDK_INT_FULL); 0, 0, 0, Build.VERSION.RESOURCES_SDK_INT); assets.setApkAssets(apkAssets, false /*invalidateCaches*/); mCachedAssetManager = assets; Loading Loading @@ -9092,7 +9092,7 @@ public class PackageParser { private static AssetManager createAssetManagerWithAssets(ApkAssets[] apkAssets) { final AssetManager assets = new AssetManager(); assets.setConfiguration(0, 0, null, null, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, Build.VERSION.RESOURCES_SDK_INT_FULL); 0, 0, 0, Build.VERSION.RESOURCES_SDK_INT); assets.setApkAssets(apkAssets, false /*invalidateCaches*/); return assets; } Loading core/java/android/content/res/AssetManager.java +28 −10 Original line number Diff line number Diff line Loading @@ -17,7 +17,6 @@ package android.content.res; import static android.app.ResourcesManager.ApkKey; import static android.content.res.Flags.resourcesMinorVersionSupport; import static android.content.res.Resources.ID_NULL; import android.annotation.AnyRes; Loading @@ -34,7 +33,6 @@ import android.content.pm.ActivityInfo; import android.content.res.Configuration.NativeConfig; import android.content.res.loader.ResourcesLoader; import android.os.Build; import android.os.Build.SdkIntFull; import android.os.ParcelFileDescriptor; import android.ravenwood.annotation.RavenwoodKeepWholeClass; import android.ravenwood.annotation.RavenwoodReplace; Loading Loading @@ -1588,15 +1586,38 @@ public final class AssetManager implements AutoCloseable { * @hide */ @UnsupportedAppUsage public void setConfiguration(int mcc, int mnc, @Nullable String locale, int orientation, int touchscreen, int density, int keyboard, int keyboardHidden, int navigation, int screenWidth, int screenHeight, int smallestScreenWidthDp, int screenWidthDp, int screenHeightDp, int screenLayout, int uiMode, int colorMode, int grammaticalGender, int majorVersion) { if (locale != null) { setConfiguration(mcc, mnc, null, new String[]{locale}, orientation, touchscreen, density, keyboard, keyboardHidden, navigation, screenWidth, screenHeight, smallestScreenWidthDp, screenWidthDp, screenHeightDp, screenLayout, uiMode, colorMode, grammaticalGender, majorVersion); } else { setConfiguration(mcc, mnc, null, null, orientation, touchscreen, density, keyboard, keyboardHidden, navigation, screenWidth, screenHeight, smallestScreenWidthDp, screenWidthDp, screenHeightDp, screenLayout, uiMode, colorMode, grammaticalGender, majorVersion); } } /** * Change the configuration used when retrieving resources. Not for use by * applications. * @hide */ public void setConfiguration(int mcc, int mnc, String defaultLocale, String[] locales, int orientation, int touchscreen, int density, int keyboard, int keyboardHidden, int navigation, int screenWidth, int screenHeight, int smallestScreenWidthDp, int screenWidthDp, int screenHeightDp, int screenLayout, int uiMode, int colorMode, int grammaticalGender, @SdkIntFull int sdkVersionFull) { int grammaticalGender, int majorVersion) { setConfigurationInternal(mcc, mnc, defaultLocale, locales, orientation, touchscreen, density, keyboard, keyboardHidden, navigation, screenWidth, screenHeight, smallestScreenWidthDp, screenWidthDp, screenHeightDp, screenLayout, uiMode, colorMode, grammaticalGender, sdkVersionFull, false); screenLayout, uiMode, colorMode, grammaticalGender, majorVersion, false); } /** Loading @@ -1608,16 +1629,13 @@ public final class AssetManager implements AutoCloseable { int orientation, int touchscreen, int density, int keyboard, int keyboardHidden, int navigation, int screenWidth, int screenHeight, int smallestScreenWidthDp, int screenWidthDp, int screenHeightDp, int screenLayout, int uiMode, int colorMode, int grammaticalGender, @SdkIntFull int sdkVersionFull, boolean forceRefresh) { int grammaticalGender, int majorVersion, boolean forceRefresh) { synchronized (this) { ensureValidLocked(); final int majorVersion = Build.getMajorSdkVersion(sdkVersionFull); final int minorVersion = resourcesMinorVersionSupport() ? Build.getMinorSdkVersion(sdkVersionFull) : 0; nativeSetConfiguration(mObject, mcc, mnc, defaultLocale, locales, orientation, touchscreen, density, keyboard, keyboardHidden, navigation, screenWidth, screenHeight, smallestScreenWidthDp, screenWidthDp, screenHeightDp, screenLayout, uiMode, colorMode, grammaticalGender, majorVersion, minorVersion, screenLayout, uiMode, colorMode, grammaticalGender, majorVersion, forceRefresh); } } Loading Loading @@ -1731,7 +1749,7 @@ public final class AssetManager implements AutoCloseable { int touchscreen, int density, int keyboard, int keyboardHidden, int navigation, int screenWidth, int screenHeight, int smallestScreenWidthDp, int screenWidthDp, int screenHeightDp, int screenLayout, int uiMode, int colorMode, int grammaticalGender, int majorVersion, int minorVersion, boolean forceRefresh); int majorVersion, boolean forceRefresh); private static native void nativeSetOverlayConstraints(long ptr, int displayId, int deviceId); private static native @NonNull SparseArray<String> nativeGetAssignedPackageIdentifiers( long ptr, boolean includeOverlays, boolean includeLoaders); Loading core/java/android/content/res/ResourcesImpl.java +4 −19 Original line number Diff line number Diff line Loading @@ -229,8 +229,7 @@ public class ResourcesImpl { mMetrics.setToDefaults(); mDisplayAdjustments = displayAdjustments; mConfiguration.setToDefaults(); updateConfigurationImpl(config, metrics, displayAdjustments.getCompatibilityInfo(), true, Build.VERSION.RESOURCES_SDK_INT_FULL); updateConfigurationImpl(config, metrics, displayAdjustments.getCompatibilityInfo(), true); } /** Loading Loading @@ -452,27 +451,13 @@ public class ResourcesImpl { return mStateListAnimatorCache; } /** * Set the SDK version used for resource lookup. Not for use outside of tests. * * @param sdkVersionFull The SDK version, with minor version encoded */ @VisibleForTesting public void updateResourcesSdkVersion(int sdkVersionFull) { Configuration config = new Configuration(); config.setTo(mConfiguration); updateConfigurationImpl(config, null, null, true, sdkVersionFull); } public void updateConfiguration(Configuration config, DisplayMetrics metrics, CompatibilityInfo compat) { updateConfigurationImpl(config, metrics, compat, false, Build.VERSION.RESOURCES_SDK_INT_FULL); updateConfigurationImpl(config, metrics, compat, false); } private void updateConfigurationImpl(Configuration config, DisplayMetrics metrics, CompatibilityInfo compat, boolean forceAssetsRefresh, int sdkVersionFull) { CompatibilityInfo compat, boolean forceAssetsRefresh) { Trace.traceBegin(Trace.TRACE_TAG_RESOURCES, "ResourcesImpl#updateConfiguration"); try { synchronized (mAccessLock) { Loading Loading @@ -613,7 +598,7 @@ public class ResourcesImpl { mConfiguration.screenWidthDp, mConfiguration.screenHeightDp, mConfiguration.screenLayout, mConfiguration.uiMode, mConfiguration.colorMode, mConfiguration.getGrammaticalGender(), sdkVersionFull, forceAssetsRefresh); Build.VERSION.RESOURCES_SDK_INT, forceAssetsRefresh); if (DEBUG_CONFIG) { Slog.i(TAG, "**** Updating config of " + this + ": final config is " Loading core/java/android/os/Build.java +0 −9 Original line number Diff line number Diff line Loading @@ -533,15 +533,6 @@ public class Build { @TestApi public static final int RESOURCES_SDK_INT = SDK_INT + ACTIVE_CODENAMES.length; /** * The SDK version to use when accessing resources, with minor version encoded. * Use the current SDK version code. For every active development codename * we are operating under, we bump the assumed resource platform major version by 1. * @hide */ public static final int RESOURCES_SDK_INT_FULL = SDK_INT_FULL + (ACTIVE_CODENAMES.length * VERSION_CODES_FULL.SDK_INT_MULTIPLIER); /** * The current lowest supported value of app target SDK. Applications targeting * lower values may not function on devices running this SDK version. Its possible Loading core/java/com/android/internal/pm/split/DefaultSplitAssetLoader.java +1 −1 Original line number Diff line number Diff line Loading @@ -83,7 +83,7 @@ public class DefaultSplitAssetLoader implements SplitAssetLoader { AssetManager assets = new AssetManager(); assets.setConfiguration(0, 0, null, new String[0], 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, Build.VERSION.RESOURCES_SDK_INT_FULL); 0, 0, Build.VERSION.RESOURCES_SDK_INT); assets.setApkAssets(apkAssets, false /*invalidateCaches*/); mCachedAssetManager = assets; Loading Loading
core/java/android/content/pm/PackageParser.java +3 −3 Original line number Diff line number Diff line Loading @@ -1457,7 +1457,7 @@ public class PackageParser { private static AssetManager newConfiguredAssetManager() { AssetManager assetManager = new AssetManager(); assetManager.setConfiguration(0, 0, null, null, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, Build.VERSION.RESOURCES_SDK_INT_FULL); 0, 0, 0, Build.VERSION.RESOURCES_SDK_INT); return assetManager; } Loading Loading @@ -9017,7 +9017,7 @@ public class PackageParser { AssetManager assets = new AssetManager(); assets.setConfiguration(0, 0, null, null, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, Build.VERSION.RESOURCES_SDK_INT_FULL); 0, 0, 0, Build.VERSION.RESOURCES_SDK_INT); assets.setApkAssets(apkAssets, false /*invalidateCaches*/); mCachedAssetManager = assets; Loading Loading @@ -9092,7 +9092,7 @@ public class PackageParser { private static AssetManager createAssetManagerWithAssets(ApkAssets[] apkAssets) { final AssetManager assets = new AssetManager(); assets.setConfiguration(0, 0, null, null, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, Build.VERSION.RESOURCES_SDK_INT_FULL); 0, 0, 0, Build.VERSION.RESOURCES_SDK_INT); assets.setApkAssets(apkAssets, false /*invalidateCaches*/); return assets; } Loading
core/java/android/content/res/AssetManager.java +28 −10 Original line number Diff line number Diff line Loading @@ -17,7 +17,6 @@ package android.content.res; import static android.app.ResourcesManager.ApkKey; import static android.content.res.Flags.resourcesMinorVersionSupport; import static android.content.res.Resources.ID_NULL; import android.annotation.AnyRes; Loading @@ -34,7 +33,6 @@ import android.content.pm.ActivityInfo; import android.content.res.Configuration.NativeConfig; import android.content.res.loader.ResourcesLoader; import android.os.Build; import android.os.Build.SdkIntFull; import android.os.ParcelFileDescriptor; import android.ravenwood.annotation.RavenwoodKeepWholeClass; import android.ravenwood.annotation.RavenwoodReplace; Loading Loading @@ -1588,15 +1586,38 @@ public final class AssetManager implements AutoCloseable { * @hide */ @UnsupportedAppUsage public void setConfiguration(int mcc, int mnc, @Nullable String locale, int orientation, int touchscreen, int density, int keyboard, int keyboardHidden, int navigation, int screenWidth, int screenHeight, int smallestScreenWidthDp, int screenWidthDp, int screenHeightDp, int screenLayout, int uiMode, int colorMode, int grammaticalGender, int majorVersion) { if (locale != null) { setConfiguration(mcc, mnc, null, new String[]{locale}, orientation, touchscreen, density, keyboard, keyboardHidden, navigation, screenWidth, screenHeight, smallestScreenWidthDp, screenWidthDp, screenHeightDp, screenLayout, uiMode, colorMode, grammaticalGender, majorVersion); } else { setConfiguration(mcc, mnc, null, null, orientation, touchscreen, density, keyboard, keyboardHidden, navigation, screenWidth, screenHeight, smallestScreenWidthDp, screenWidthDp, screenHeightDp, screenLayout, uiMode, colorMode, grammaticalGender, majorVersion); } } /** * Change the configuration used when retrieving resources. Not for use by * applications. * @hide */ public void setConfiguration(int mcc, int mnc, String defaultLocale, String[] locales, int orientation, int touchscreen, int density, int keyboard, int keyboardHidden, int navigation, int screenWidth, int screenHeight, int smallestScreenWidthDp, int screenWidthDp, int screenHeightDp, int screenLayout, int uiMode, int colorMode, int grammaticalGender, @SdkIntFull int sdkVersionFull) { int grammaticalGender, int majorVersion) { setConfigurationInternal(mcc, mnc, defaultLocale, locales, orientation, touchscreen, density, keyboard, keyboardHidden, navigation, screenWidth, screenHeight, smallestScreenWidthDp, screenWidthDp, screenHeightDp, screenLayout, uiMode, colorMode, grammaticalGender, sdkVersionFull, false); screenLayout, uiMode, colorMode, grammaticalGender, majorVersion, false); } /** Loading @@ -1608,16 +1629,13 @@ public final class AssetManager implements AutoCloseable { int orientation, int touchscreen, int density, int keyboard, int keyboardHidden, int navigation, int screenWidth, int screenHeight, int smallestScreenWidthDp, int screenWidthDp, int screenHeightDp, int screenLayout, int uiMode, int colorMode, int grammaticalGender, @SdkIntFull int sdkVersionFull, boolean forceRefresh) { int grammaticalGender, int majorVersion, boolean forceRefresh) { synchronized (this) { ensureValidLocked(); final int majorVersion = Build.getMajorSdkVersion(sdkVersionFull); final int minorVersion = resourcesMinorVersionSupport() ? Build.getMinorSdkVersion(sdkVersionFull) : 0; nativeSetConfiguration(mObject, mcc, mnc, defaultLocale, locales, orientation, touchscreen, density, keyboard, keyboardHidden, navigation, screenWidth, screenHeight, smallestScreenWidthDp, screenWidthDp, screenHeightDp, screenLayout, uiMode, colorMode, grammaticalGender, majorVersion, minorVersion, screenLayout, uiMode, colorMode, grammaticalGender, majorVersion, forceRefresh); } } Loading Loading @@ -1731,7 +1749,7 @@ public final class AssetManager implements AutoCloseable { int touchscreen, int density, int keyboard, int keyboardHidden, int navigation, int screenWidth, int screenHeight, int smallestScreenWidthDp, int screenWidthDp, int screenHeightDp, int screenLayout, int uiMode, int colorMode, int grammaticalGender, int majorVersion, int minorVersion, boolean forceRefresh); int majorVersion, boolean forceRefresh); private static native void nativeSetOverlayConstraints(long ptr, int displayId, int deviceId); private static native @NonNull SparseArray<String> nativeGetAssignedPackageIdentifiers( long ptr, boolean includeOverlays, boolean includeLoaders); Loading
core/java/android/content/res/ResourcesImpl.java +4 −19 Original line number Diff line number Diff line Loading @@ -229,8 +229,7 @@ public class ResourcesImpl { mMetrics.setToDefaults(); mDisplayAdjustments = displayAdjustments; mConfiguration.setToDefaults(); updateConfigurationImpl(config, metrics, displayAdjustments.getCompatibilityInfo(), true, Build.VERSION.RESOURCES_SDK_INT_FULL); updateConfigurationImpl(config, metrics, displayAdjustments.getCompatibilityInfo(), true); } /** Loading Loading @@ -452,27 +451,13 @@ public class ResourcesImpl { return mStateListAnimatorCache; } /** * Set the SDK version used for resource lookup. Not for use outside of tests. * * @param sdkVersionFull The SDK version, with minor version encoded */ @VisibleForTesting public void updateResourcesSdkVersion(int sdkVersionFull) { Configuration config = new Configuration(); config.setTo(mConfiguration); updateConfigurationImpl(config, null, null, true, sdkVersionFull); } public void updateConfiguration(Configuration config, DisplayMetrics metrics, CompatibilityInfo compat) { updateConfigurationImpl(config, metrics, compat, false, Build.VERSION.RESOURCES_SDK_INT_FULL); updateConfigurationImpl(config, metrics, compat, false); } private void updateConfigurationImpl(Configuration config, DisplayMetrics metrics, CompatibilityInfo compat, boolean forceAssetsRefresh, int sdkVersionFull) { CompatibilityInfo compat, boolean forceAssetsRefresh) { Trace.traceBegin(Trace.TRACE_TAG_RESOURCES, "ResourcesImpl#updateConfiguration"); try { synchronized (mAccessLock) { Loading Loading @@ -613,7 +598,7 @@ public class ResourcesImpl { mConfiguration.screenWidthDp, mConfiguration.screenHeightDp, mConfiguration.screenLayout, mConfiguration.uiMode, mConfiguration.colorMode, mConfiguration.getGrammaticalGender(), sdkVersionFull, forceAssetsRefresh); Build.VERSION.RESOURCES_SDK_INT, forceAssetsRefresh); if (DEBUG_CONFIG) { Slog.i(TAG, "**** Updating config of " + this + ": final config is " Loading
core/java/android/os/Build.java +0 −9 Original line number Diff line number Diff line Loading @@ -533,15 +533,6 @@ public class Build { @TestApi public static final int RESOURCES_SDK_INT = SDK_INT + ACTIVE_CODENAMES.length; /** * The SDK version to use when accessing resources, with minor version encoded. * Use the current SDK version code. For every active development codename * we are operating under, we bump the assumed resource platform major version by 1. * @hide */ public static final int RESOURCES_SDK_INT_FULL = SDK_INT_FULL + (ACTIVE_CODENAMES.length * VERSION_CODES_FULL.SDK_INT_MULTIPLIER); /** * The current lowest supported value of app target SDK. Applications targeting * lower values may not function on devices running this SDK version. Its possible Loading
core/java/com/android/internal/pm/split/DefaultSplitAssetLoader.java +1 −1 Original line number Diff line number Diff line Loading @@ -83,7 +83,7 @@ public class DefaultSplitAssetLoader implements SplitAssetLoader { AssetManager assets = new AssetManager(); assets.setConfiguration(0, 0, null, new String[0], 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, Build.VERSION.RESOURCES_SDK_INT_FULL); 0, 0, Build.VERSION.RESOURCES_SDK_INT); assets.setApkAssets(apkAssets, false /*invalidateCaches*/); mCachedAssetManager = assets; Loading