From 4f78297330f15048e9aa7de162cab427b7607d81 Mon Sep 17 00:00:00 2001 From: Ryan Mitchell Date: Mon, 28 Jan 2019 16:07:19 -0800 Subject: [PATCH] RRO CTS Test APIs Added TestAPIs for CTS tests of overlays. Bug: 116512274 Test: OverlayableTest Change-Id: I0dda4f09c06f384bbfe790cb4aaf4140c43533e9 --- api/test-current.txt | 5 +++++ core/java/android/content/res/AssetManager.java | 18 ++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/api/test-current.txt b/api/test-current.txt index 6f8f310f6a2c..1ec16caebd90 100644 --- a/api/test-current.txt +++ b/api/test-current.txt @@ -713,6 +713,11 @@ package android.content.pm { package android.content.res { + public final class AssetManager implements java.lang.AutoCloseable { + method @NonNull public String[] getApkPaths(); + method @Nullable public java.util.Map getOverlayableMap(String); + } + public final class Configuration implements java.lang.Comparable android.os.Parcelable { field public int assetsSeq; field public final android.app.WindowConfiguration windowConfiguration; diff --git a/core/java/android/content/res/AssetManager.java b/core/java/android/content/res/AssetManager.java index 49b4cb01c6a6..604750d247c0 100644 --- a/core/java/android/content/res/AssetManager.java +++ b/core/java/android/content/res/AssetManager.java @@ -23,6 +23,7 @@ import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.StringRes; import android.annotation.StyleRes; +import android.annotation.TestApi; import android.annotation.UnsupportedAppUsage; import android.content.pm.ActivityInfo; import android.content.res.Configuration.NativeConfig; @@ -357,6 +358,22 @@ public final class AssetManager implements AutoCloseable { return sEmptyApkAssets; } + /** @hide */ + @TestApi + public @NonNull String[] getApkPaths() { + synchronized (this) { + if (mOpen) { + String[] paths = new String[mApkAssets.length]; + final int count = mApkAssets.length; + for (int i = 0; i < count; i++) { + paths[i] = mApkAssets[i].getAssetPath(); + } + return paths; + } + } + return new String[0]; + } + /** * Returns a cookie for use with the other APIs of AssetManager. * @return 0 if the path was not found, otherwise a positive integer cookie representing @@ -1349,6 +1366,7 @@ public final class AssetManager implements AutoCloseable { /** * @hide */ + @TestApi @GuardedBy("this") public @Nullable Map getOverlayableMap(String packageName) { synchronized (this) { -- 2.11.0