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

Commit f4601205 authored by Jeremy Meyer's avatar Jeremy Meyer Committed by Android (Google) Code Review
Browse files

Merge "Add logging when asset paths change" into main

parents dec168c9 da72ad3c
Loading
Loading
Loading
Loading
+27 −0
Original line number Original line Diff line number Diff line
@@ -101,6 +101,7 @@ import android.content.res.AssetManager;
import android.content.res.CompatibilityInfo;
import android.content.res.CompatibilityInfo;
import android.content.res.Configuration;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.content.res.Resources;
import android.content.res.ResourcesImpl;
import android.content.res.loader.ResourcesLoader;
import android.content.res.loader.ResourcesLoader;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteDebug;
import android.database.sqlite.SQLiteDebug;
@@ -297,6 +298,7 @@ public final class ActivityThread extends ClientTransactionHandler
    public static final boolean DEBUG_MEMORY_TRIM = false;
    public static final boolean DEBUG_MEMORY_TRIM = false;
    private static final boolean DEBUG_PROVIDER = false;
    private static final boolean DEBUG_PROVIDER = false;
    public static final boolean DEBUG_ORDER = false;
    public static final boolean DEBUG_ORDER = false;
    private static final boolean DEBUG_APP_INFO = true;
    private static final long MIN_TIME_BETWEEN_GCS = 5*1000;
    private static final long MIN_TIME_BETWEEN_GCS = 5*1000;
    /**
    /**
     * The delay to release the provider when it has no more references. It reduces the number of
     * The delay to release the provider when it has no more references. It reduces the number of
@@ -6473,10 +6475,35 @@ public final class ActivityThread extends ClientTransactionHandler
            resApk.updateApplicationInfo(ai, oldPaths);
            resApk.updateApplicationInfo(ai, oldPaths);
        }
        }


        ResourcesImpl beforeImpl = getApplication().getResources().getImpl();

        synchronized (mResourcesManager) {
        synchronized (mResourcesManager) {
            // Update all affected Resources objects to use new ResourcesImpl
            // Update all affected Resources objects to use new ResourcesImpl
            mResourcesManager.applyAllPendingAppInfoUpdates();
            mResourcesManager.applyAllPendingAppInfoUpdates();
        }
        }

        ResourcesImpl afterImpl = getApplication().getResources().getImpl();

        if ((beforeImpl != afterImpl) && !Arrays.equals(beforeImpl.getAssets().getApkAssets(),
                afterImpl.getAssets().getApkAssets())) {
            List<String> beforeAssets = Arrays.asList(beforeImpl.getAssets().getApkPaths());
            List<String> afterAssets = Arrays.asList(afterImpl.getAssets().getApkPaths());

            List<String> onlyBefore = new ArrayList<>(beforeAssets);
            onlyBefore.removeAll(afterAssets);
            List<String> onlyAfter = new ArrayList<>(afterAssets);
            onlyAfter.removeAll(beforeAssets);

            Slog.i(TAG, "ApplicationInfo updating for " + ai.packageName + ", new timestamp: "
                    + ai.createTimestamp + "\nassets removed: " + onlyBefore + "\nassets added: "
                    + onlyAfter);

            if (DEBUG_APP_INFO) {
                Slog.v(TAG, "ApplicationInfo updating for " + ai.packageName
                        + ", assets before change: " + beforeAssets + "\n assets after change: "
                        + afterAssets);
            }
        }
    }
    }


    /**
    /**