diff options
Diffstat (limited to 'core/java')
| -rw-r--r-- | core/java/android/app/ResourcesManager.java | 20 | ||||
| -rw-r--r-- | core/java/android/content/om/IOverlayManager.aidl | 6 | ||||
| -rw-r--r-- | core/java/android/content/om/OverlayManager.java | 25 | ||||
| -rw-r--r-- | core/java/android/content/res/ApkAssets.java | 2 | ||||
| -rw-r--r-- | core/java/android/content/res/StringBlock.java | 2 |
5 files changed, 53 insertions, 2 deletions
diff --git a/core/java/android/app/ResourcesManager.java b/core/java/android/app/ResourcesManager.java index 40cb29fc80ab..cb9ebac728ec 100644 --- a/core/java/android/app/ResourcesManager.java +++ b/core/java/android/app/ResourcesManager.java @@ -20,6 +20,7 @@ import static android.app.ActivityThread.DEBUG_CONFIGURATION; import android.annotation.NonNull; import android.annotation.Nullable; +import android.annotation.TestApi; import android.annotation.UnsupportedAppUsage; import android.content.pm.ActivityInfo; import android.content.pm.ApplicationInfo; @@ -191,6 +192,17 @@ public class ResourcesManager { } } Log.i(TAG, "Invalidated " + count + " asset managers that referenced " + path); + + for (int i = mCachedApkAssets.size() - 1; i >= 0; i--) { + final ApkKey key = mCachedApkAssets.keyAt(i); + if (key.path.equals(path)) { + WeakReference<ApkAssets> apkAssetsRef = mCachedApkAssets.remove(key); + if (apkAssetsRef != null && apkAssetsRef.get() != null) { + apkAssetsRef.get().close(); + } + mCachedApkAssets.remove(key); + } + } } } @@ -1000,6 +1012,14 @@ public class ResourcesManager { } } + @TestApi + public final boolean applyConfigurationToResources(@NonNull Configuration config, + @Nullable CompatibilityInfo compat) { + synchronized(this) { + return applyConfigurationToResourcesLocked(config, compat); + } + } + public final boolean applyConfigurationToResourcesLocked(@NonNull Configuration config, @Nullable CompatibilityInfo compat) { try { diff --git a/core/java/android/content/om/IOverlayManager.aidl b/core/java/android/content/om/IOverlayManager.aidl index 43a4fe5bc414..3d7e3befd9f1 100644 --- a/core/java/android/content/om/IOverlayManager.aidl +++ b/core/java/android/content/om/IOverlayManager.aidl @@ -157,4 +157,10 @@ interface IOverlayManager { * Returns the list of default overlay packages, or an empty array if there are none. */ String[] getDefaultOverlayPackages(); + + /** + * Invalidates and removes the idmap for an overlay, + * @param packageName The name of the overlay package whose idmap should be deleted. + */ + void invalidateCachesForOverlay(in String packageName, in int userIs); } diff --git a/core/java/android/content/om/OverlayManager.java b/core/java/android/content/om/OverlayManager.java index f2716fedc186..853e8189ea8a 100644 --- a/core/java/android/content/om/OverlayManager.java +++ b/core/java/android/content/om/OverlayManager.java @@ -21,6 +21,7 @@ import android.annotation.Nullable; import android.annotation.RequiresPermission; import android.annotation.SystemApi; import android.annotation.SystemService; +import android.annotation.TestApi; import android.content.Context; import android.os.RemoteException; import android.os.ServiceManager; @@ -163,4 +164,28 @@ public class OverlayManager { throw e.rethrowFromSystemServer(); } } + + /** + * Returns information about all overlays for the given target package for + * the specified user. The returned list is ordered according to the + * overlay priority with the highest priority at the end of the list. + * + * @param targetPackageName The name of the target package. + * @param user The user to get the OverlayInfos for. + * + * @hide + */ + @TestApi + @RequiresPermission(anyOf = { + "android.permission.INTERACT_ACROSS_USERS", + }) + @NonNull + public void invalidateCachesForOverlay(@NonNull final String targetPackageName, + @NonNull UserHandle user) { + try { + mService.invalidateCachesForOverlay(targetPackageName, user.getIdentifier()); + } catch (RemoteException e) { + throw e.rethrowFromSystemServer(); + } + } } diff --git a/core/java/android/content/res/ApkAssets.java b/core/java/android/content/res/ApkAssets.java index 69462ab99483..a35ad567ed81 100644 --- a/core/java/android/content/res/ApkAssets.java +++ b/core/java/android/content/res/ApkAssets.java @@ -188,7 +188,7 @@ public final class ApkAssets { /** * Closes this class and the contained {@link #mStringBlock}. */ - public void close() throws Throwable { + public void close() { synchronized (this) { if (mOpen) { mOpen = false; diff --git a/core/java/android/content/res/StringBlock.java b/core/java/android/content/res/StringBlock.java index b7bc8229fa45..2ae1932c3437 100644 --- a/core/java/android/content/res/StringBlock.java +++ b/core/java/android/content/res/StringBlock.java @@ -175,7 +175,7 @@ final class StringBlock { } } - public void close() throws Throwable { + public void close() { synchronized (this) { if (mOpen) { mOpen = false; |
