summaryrefslogtreecommitdiffstats
path: root/core/java/android
diff options
context:
space:
mode:
authord34d <clark@cyngn.com>2015-01-24 11:05:40 -0800
committerClark Scheff <clark@cyngn.com>2015-10-27 10:39:22 -0700
commitb28503eb9a5d5aaba8798f2c45f277b476f0de10 (patch)
tree5143721d920d57b2e4b93b0aba66be88686364f1 /core/java/android
parentc26aa7cf406401e4e90fd8e8a3f4ad1e9284d5d5 (diff)
downloadframeworks_base-b28503eb9a5d5aaba8798f2c45f277b476f0de10.zip
frameworks_base-b28503eb9a5d5aaba8798f2c45f277b476f0de10.tar.gz
frameworks_base-b28503eb9a5d5aaba8798f2c45f277b476f0de10.tar.bz2
Themes: Check common resource paths at java layer
This solves two problems: 1. It won't try to attach common resources that do not exist 2. Avoids call down to the native layer if they don't exist Change-Id: I7b58b3f8a2540b6f62bd54feb21a3e33320c8e47
Diffstat (limited to 'core/java/android')
-rw-r--r--core/java/android/content/res/AssetManager.java7
1 files changed, 6 insertions, 1 deletions
diff --git a/core/java/android/content/res/AssetManager.java b/core/java/android/content/res/AssetManager.java
index 421701a..ebbfd09 100644
--- a/core/java/android/content/res/AssetManager.java
+++ b/core/java/android/content/res/AssetManager.java
@@ -21,6 +21,7 @@ import android.util.Log;
import android.util.SparseArray;
import android.util.TypedValue;
+import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
@@ -670,7 +671,11 @@ public final class AssetManager implements AutoCloseable {
public final int addCommonOverlayPath(String themeApkPath,
String resApkPath, String prefixPath) {
synchronized (this) {
- return addCommonOverlayPathNative(themeApkPath, resApkPath, prefixPath);
+ if ((new File(themeApkPath).exists()) && (new File(resApkPath).exists())) {
+ return addCommonOverlayPathNative(themeApkPath, resApkPath, prefixPath);
+ }
+
+ return 0;
}
}