Fix issue #8176917: Stabillity : Native Crash :
/system/lib/libandroidfw.so
Change-Id: I235470fac7ad0f5a5d3432006f4dfa69620e30d8
diff --git a/core/java/android/content/res/Resources.java b/core/java/android/content/res/Resources.java
index 7775293..24a0bb5 100644
--- a/core/java/android/content/res/Resources.java
+++ b/core/java/android/content/res/Resources.java
@@ -792,6 +792,7 @@
"Resource ID #0x" + Integer.toHexString(id) + " type #0x"
+ Integer.toHexString(value.type) + " is not valid");
}
+ mTmpValue = null;
}
ColorStateList csl = loadColorStateList(value, id);
synchronized (mAccessLock) {
@@ -2227,6 +2228,9 @@
throws NotFoundException {
synchronized (mAccessLock) {
TypedValue value = mTmpValue;
+ if (value == null) {
+ mTmpValue = value = new TypedValue();
+ }
getValue(id, value, true);
if (value.type == TypedValue.TYPE_STRING) {
return loadXmlResourceParser(value.string.toString(), id,
diff --git a/core/jni/android_util_AssetManager.cpp b/core/jni/android_util_AssetManager.cpp
index d422951..8a8b15f 100644
--- a/core/jni/android_util_AssetManager.cpp
+++ b/core/jni/android_util_AssetManager.cpp
@@ -685,6 +685,10 @@
jobject outValue,
jboolean resolve)
{
+ if (outValue == null) {
+ jniThrowNullPointerException(env, "outValue");
+ return null;
+ }
AssetManager* am = assetManagerForJavaObject(env, clazz);
if (am == NULL) {
return 0;