summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Mattias Petersson <mattias.petersson@sonyericsson.com> 2011-10-07 09:33:52 +0200
committer Johan Redestig <johan.redestig@sonymobile.com> 2013-07-26 18:42:34 +0000
commit1d766b53217f9e45472a01e84d2f1b02af36dec7 (patch)
tree5408fa90569c4d35467ab508f7f58fd41eb832cb
parentd547bcec5634f99195a2b12522b6977f61c40d55 (diff)
Add support for MNC=00
This adds support for operators with MNC (Mobile Network Code) zero to add customized resources. For example, it makes it possible to add a folder called "/res/values-mnc00/" in an application. This will cause resources in that folder to be used when MNC is zero. (There is a total of 14 countries that have an operator with MNC zero.) Without this fix, the resource framework gets confused, because MNC 0 is normally used when the MNC is undefined (not set). Bug: 7170488 Change-Id: Icfd39fd0c739216e89446252ea0e7ceba6f002c6
-rw-r--r--api/current.txt1
-rw-r--r--core/java/android/content/res/Configuration.java11
-rw-r--r--tools/aapt/AaptAssets.cpp3
3 files changed, 13 insertions, 2 deletions
diff --git a/api/current.txt b/api/current.txt
index 962b332e85a7..6f0bbcecff8e 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -7255,6 +7255,7 @@ package android.content.res {
field public static final int KEYBOARD_NOKEYS = 1; // 0x1
field public static final int KEYBOARD_QWERTY = 2; // 0x2
field public static final int KEYBOARD_UNDEFINED = 0; // 0x0
+ field public static final int MNC_ZERO = 65535; // 0xffff
field public static final int NAVIGATIONHIDDEN_NO = 1; // 0x1
field public static final int NAVIGATIONHIDDEN_UNDEFINED = 0; // 0x0
field public static final int NAVIGATIONHIDDEN_YES = 2; // 0x2
diff --git a/core/java/android/content/res/Configuration.java b/core/java/android/content/res/Configuration.java
index 68db33a2e630..6318e3893767 100644
--- a/core/java/android/content/res/Configuration.java
+++ b/core/java/android/content/res/Configuration.java
@@ -54,10 +54,17 @@ public final class Configuration implements Parcelable, Comparable<Configuration
/**
* IMSI MNC (Mobile Network Code), corresponding to
* <a href="{@docRoot}guide/topics/resources/providing-resources.html#MccQualifier">mnc</a>
- * resource qualifier. 0 if undefined.
+ * resource qualifier. 0 if undefined. Note that the actual MNC may be 0; in order to check
+ * for this use the {@link #MNC_ZERO} symbol.
*/
public int mnc;
-
+
+ /**
+ * Constant used to to represent MNC (Mobile Network Code) zero.
+ * 0 cannot be used, since it is used to represent an undefined MNC.
+ */
+ public static final int MNC_ZERO = 0xffff;
+
/**
* Current user preference for the locale, corresponding to
* <a href="{@docRoot}guide/topics/resources/providing-resources.html#LocaleQualifier">locale</a>
diff --git a/tools/aapt/AaptAssets.cpp b/tools/aapt/AaptAssets.cpp
index 2149190b10be..3797b49cc32d 100644
--- a/tools/aapt/AaptAssets.cpp
+++ b/tools/aapt/AaptAssets.cpp
@@ -934,6 +934,9 @@ bool AaptGroupEntry::getMncName(const char* name,
if (out) {
out->mnc = atoi(val);
+ if (out->mnc == 0) {
+ out->mnc = ACONFIGURATION_MNC_ZERO;
+ }
}
return true;