summaryrefslogtreecommitdiffstats
path: root/core/java
diff options
context:
space:
mode:
authorFilip Gruszczynski <gruszczy@google.com>2015-08-04 23:02:19 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2015-08-04 23:02:19 +0000
commit52d3312abeafd988ecb2288896b74ba72c3e70c0 (patch)
tree224ba41c5cda3a2e46ed659626294d2b92a1ce4e /core/java
parent385dfd349ff773c499859ee44552995e9c25759c (diff)
parenta01f48681cdaf34e0943609683d0bbb26e761a58 (diff)
downloadframeworks_base-52d3312abeafd988ecb2288896b74ba72c3e70c0.zip
frameworks_base-52d3312abeafd988ecb2288896b74ba72c3e70c0.tar.gz
frameworks_base-52d3312abeafd988ecb2288896b74ba72c3e70c0.tar.bz2
Merge "Make ResourceKey always use non-null configuration override." into mnc-dev
Diffstat (limited to 'core/java')
-rw-r--r--core/java/android/content/res/ResourcesKey.java21
1 files changed, 9 insertions, 12 deletions
diff --git a/core/java/android/content/res/ResourcesKey.java b/core/java/android/content/res/ResourcesKey.java
index 9548d49..2620571 100644
--- a/core/java/android/content/res/ResourcesKey.java
+++ b/core/java/android/content/res/ResourcesKey.java
@@ -16,6 +16,8 @@
package android.content.res;
+import android.annotation.NonNull;
+
import java.util.Objects;
/** @hide */
@@ -25,27 +27,27 @@ public final class ResourcesKey {
private final int mHash;
public final int mDisplayId;
+ @NonNull
public final Configuration mOverrideConfiguration;
public ResourcesKey(String resDir, int displayId, Configuration overrideConfiguration,
float scale) {
mResDir = resDir;
mDisplayId = displayId;
- mOverrideConfiguration = overrideConfiguration;
+ mOverrideConfiguration = overrideConfiguration != null
+ ? overrideConfiguration : Configuration.EMPTY;
mScale = scale;
int hash = 17;
hash = 31 * hash + (mResDir == null ? 0 : mResDir.hashCode());
hash = 31 * hash + mDisplayId;
- hash = 31 * hash + (mOverrideConfiguration != null
- ? mOverrideConfiguration.hashCode() : 0);
+ hash = 31 * hash + mOverrideConfiguration.hashCode();
hash = 31 * hash + Float.floatToIntBits(mScale);
mHash = hash;
}
public boolean hasOverrideConfiguration() {
- return mOverrideConfiguration != null
- && !Configuration.EMPTY.equals(mOverrideConfiguration);
+ return !Configuration.EMPTY.equals(mOverrideConfiguration);
}
@Override
@@ -66,13 +68,8 @@ public final class ResourcesKey {
if (mDisplayId != peer.mDisplayId) {
return false;
}
- if (mOverrideConfiguration != peer.mOverrideConfiguration) {
- if (mOverrideConfiguration == null || peer.mOverrideConfiguration == null) {
- return false;
- }
- if (!mOverrideConfiguration.equals(peer.mOverrideConfiguration)) {
- return false;
- }
+ if (!mOverrideConfiguration.equals(peer.mOverrideConfiguration)) {
+ return false;
}
if (mScale != peer.mScale) {
return false;