Fix crash when launching Activities in 'android' package
The LoadedApk for the 'android' package doesn't have a resource directory set. This is fine since the AssetManager loads the 'android' package's resources by default. This is a regression caused by https://googleplex-android-review.googlesource.com/#/c/525840/ Bug:17104110 Change-Id: I8a2158a75b4ff0e941837c11a2cb77a7aad09270
This commit is contained in:
@@ -178,8 +178,13 @@ public class ResourcesManager {
|
||||
//}
|
||||
|
||||
AssetManager assets = new AssetManager();
|
||||
if (assets.addAssetPath(resDir) == 0) {
|
||||
return null;
|
||||
// resDir can be null if the 'android' package is creating a new Resources object.
|
||||
// This is fine, since each AssetManager automatically loads the 'android' package
|
||||
// already.
|
||||
if (resDir != null) {
|
||||
if (assets.addAssetPath(resDir) == 0) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
if (splitResDirs != null) {
|
||||
|
||||
@@ -62,8 +62,12 @@ public final class ResourcesKey {
|
||||
return false;
|
||||
}
|
||||
ResourcesKey peer = (ResourcesKey) obj;
|
||||
if (!mResDir.equals(peer.mResDir)) {
|
||||
return false;
|
||||
if (mResDir != peer.mResDir) {
|
||||
if (mResDir == null || peer.mResDir == null) {
|
||||
return false;
|
||||
} else if (!mResDir.equals(peer.mResDir)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (mDisplayId != peer.mDisplayId) {
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user