Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f18e649e authored by Yurii Zubrytskyi's avatar Yurii Zubrytskyi Committed by Android (Google) Code Review
Browse files

Merge "[res] Fix ResourcesManagerTest" into main

parents 73b38b49 2317ac18
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -159,7 +159,8 @@ public class ResourcesManager {
     * Loads {@link ApkAssets} and caches them to prevent their garbage collection while the
     * instance is alive and reachable.
     */
    private class ApkAssetsSupplier {
    @VisibleForTesting
    protected class ApkAssetsSupplier {
        final ArrayMap<ApkKey, ApkAssets> mLocalCache = new ArrayMap<>();

        /**
@@ -544,7 +545,10 @@ public class ResourcesManager {
     * from an {@link ApkAssetsSupplier} if non-null; otherwise ApkAssets are loaded using
     * {@link #loadApkAssets(ApkKey)}.
     */
    private @Nullable AssetManager createAssetManager(@NonNull final ResourcesKey key,

    @VisibleForTesting
    @UnsupportedAppUsage
    protected @Nullable AssetManager createAssetManager(@NonNull final ResourcesKey key,
            @Nullable ApkAssetsSupplier apkSupplier) {
        final AssetManager.Builder builder = new AssetManager.Builder();

+7 −1
Original line number Diff line number Diff line
@@ -82,6 +82,12 @@ public class ResourcesManagerTest extends TestCase {
                return new AssetManager();
            }

            @Override
            protected AssetManager createAssetManager(@NonNull final ResourcesKey key,
                    ResourcesManager.ApkAssetsSupplier apkSupplier) {
                return createAssetManager(key);
            }

            @Override
            protected DisplayMetrics getDisplayMetrics(int displayId, DisplayAdjustments daj) {
                return mDisplayMetricsMap.get(displayId);
@@ -100,7 +106,7 @@ public class ResourcesManagerTest extends TestCase {
                null, APP_ONE_RES_DIR, null, null, null, null, null, null,
                CompatibilityInfo.DEFAULT_COMPATIBILITY_INFO, null, null);
        assertNotNull(newResources);
        assertSame(resources, newResources);
        assertSame(resources.getImpl(), newResources.getImpl());
    }

    @SmallTest