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

Commit 419f4eeb authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Add overlayPaths to ApplicationInfo" into sc-dev

parents fd20e236 da9ee140
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -77,7 +77,7 @@ public class ResourcesManagerPerfTest {
    }

    private void getResourcesForPath(String path) {
        ResourcesManager.getInstance().getResources(null, path, null, null, null,
        ResourcesManager.getInstance().getResources(null, path, null, null, null, null,
                Display.DEFAULT_DISPLAY, null, sContext.getResources().getCompatibilityInfo(),
                null, null);
    }
+3 −2
Original line number Diff line number Diff line
@@ -95,8 +95,9 @@ public class ResourcesThemePerfTest {
                ? Configuration.ORIENTATION_LANDSCAPE : Configuration.ORIENTATION_PORTRAIT;

        Resources destResources = resourcesManager.getResources(null, ai.sourceDir,
                ai.splitSourceDirs, ai.resourceDirs, ai.sharedLibraryFiles, Display.DEFAULT_DISPLAY,
                c, mContext.getResources().getCompatibilityInfo(), null, null);
                ai.splitSourceDirs, ai.resourceDirs, ai.overlayPaths, ai.sharedLibraryFiles,
                Display.DEFAULT_DISPLAY, c, mContext.getResources().getCompatibilityInfo(),
                null, null);
        Assert.assertNotEquals(destResources.getAssets(), mContext.getAssets());

        Resources.Theme destTheme = destResources.newTheme();
+13 −9
Original line number Diff line number Diff line
@@ -2289,11 +2289,12 @@ public final class ActivityThread extends ClientTransactionHandler {
     * Creates the top level resources for the given package. Will return an existing
     * Resources if one has already been created.
     */
    Resources getTopLevelResources(String resDir, String[] splitResDirs, String[] overlayDirs,
            String[] libDirs, LoadedApk pkgInfo, Configuration overrideConfig) {
        return mResourcesManager.getResources(null, resDir, splitResDirs, overlayDirs, libDirs,
                null, overrideConfig, pkgInfo.getCompatibilityInfo(), pkgInfo.getClassLoader(),
                null);
    Resources getTopLevelResources(String resDir, String[] splitResDirs, String[] legacyOverlayDirs,
                    String[] overlayPaths, String[] libDirs, LoadedApk pkgInfo,
                    Configuration overrideConfig) {
        return mResourcesManager.getResources(null, resDir, splitResDirs, legacyOverlayDirs,
                overlayPaths, libDirs, null, overrideConfig, pkgInfo.getCompatibilityInfo(),
                pkgInfo.getClassLoader(), null);
    }

    @UnsupportedAppUsage
@@ -2462,12 +2463,15 @@ public final class ActivityThread extends ClientTransactionHandler {
    private static boolean isLoadedApkResourceDirsUpToDate(LoadedApk loadedApk,
            ApplicationInfo appInfo) {
        Resources packageResources = loadedApk.mResources;
        String[] overlayDirs = ArrayUtils.defeatNullable(loadedApk.getOverlayDirs());
        String[] resourceDirs = ArrayUtils.defeatNullable(appInfo.resourceDirs);
        boolean resourceDirsUpToDate = Arrays.equals(
                ArrayUtils.defeatNullable(appInfo.resourceDirs),
                ArrayUtils.defeatNullable(loadedApk.getOverlayDirs()));
        boolean overlayPathsUpToDate = Arrays.equals(
                ArrayUtils.defeatNullable(appInfo.overlayPaths),
                ArrayUtils.defeatNullable(loadedApk.getOverlayPaths()));

        return (packageResources == null || packageResources.getAssets().isUpToDate())
                && overlayDirs.length == resourceDirs.length
                && ArrayUtils.containsAll(overlayDirs, resourceDirs);
                && resourceDirsUpToDate && overlayPathsUpToDate;
    }

    @UnsupportedAppUsage
+1 −1
Original line number Diff line number Diff line
@@ -1728,7 +1728,7 @@ public class ApplicationPackageManager extends PackageManager {
        final Resources r = mContext.mMainThread.getTopLevelResources(
                sameUid ? app.sourceDir : app.publicSourceDir,
                sameUid ? app.splitSourceDirs : app.splitPublicSourceDirs,
                app.resourceDirs, app.sharedLibraryFiles,
                app.resourceDirs, app.overlayPaths, app.sharedLibraryFiles,
                mContext.mPackageInfo, configuration);
        if (r != null) {
            return r;
+6 −2
Original line number Diff line number Diff line
@@ -2345,6 +2345,7 @@ class ContextImpl extends Context {
                pi.getResDir(),
                splitResDirs,
                pi.getOverlayDirs(),
                pi.getOverlayPaths(),
                pi.getApplicationInfo().sharedLibraryFiles,
                overrideDisplayId,
                overrideConfig,
@@ -2442,6 +2443,7 @@ class ContextImpl extends Context {
                mPackageInfo.getResDir(),
                paths,
                mPackageInfo.getOverlayDirs(),
                mPackageInfo.getOverlayPaths(),
                mPackageInfo.getApplicationInfo().sharedLibraryFiles,
                mForceDisplayOverrideInResources ? getDisplayId() : null,
                null,
@@ -2558,7 +2560,8 @@ class ContextImpl extends Context {
    Resources createWindowContextResources() {
        final String resDir = mPackageInfo.getResDir();
        final String[] splitResDirs = mPackageInfo.getSplitResDirs();
        final String[] overlayDirs = mPackageInfo.getOverlayDirs();
        final String[] legacyOverlayDirs = mPackageInfo.getOverlayDirs();
        final String[] overlayPaths = mPackageInfo.getOverlayPaths();
        final String[] libDirs = mPackageInfo.getApplicationInfo().sharedLibraryFiles;
        final int displayId = getDisplayId();
        final CompatibilityInfo compatInfo = (displayId == Display.DEFAULT_DISPLAY)
@@ -2567,7 +2570,7 @@ class ContextImpl extends Context {
        final List<ResourcesLoader> loaders = mResources.getLoaders();

        return mResourcesManager.createBaseTokenResources(mToken, resDir, splitResDirs,
                overlayDirs, libDirs, displayId, null /* overrideConfig */,
                legacyOverlayDirs, overlayPaths, libDirs, displayId, null /* overrideConfig */,
                compatInfo, mClassLoader, loaders);
    }

@@ -2855,6 +2858,7 @@ class ContextImpl extends Context {
                packageInfo.getResDir(),
                splitDirs,
                packageInfo.getOverlayDirs(),
                packageInfo.getOverlayPaths(),
                packageInfo.getApplicationInfo().sharedLibraryFiles,
                displayId,
                overrideConfiguration,
Loading