summaryrefslogtreecommitdiffstats
path: root/libs
diff options
context:
space:
mode:
authorAlan Viverette <alanv@google.com>2014-10-31 00:15:01 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2014-10-31 00:15:01 +0000
commit9a77c8a279bfe3293295ed77c775ea29b88b2916 (patch)
treeb34b617ab6869b38151d8e8e6d1eebb0ab7db4d9 /libs
parent370403dbdec3a1d769c31aca66e5fcbd6617c897 (diff)
parent3c5cc234eeef4a08ad7b00b4e869a1e47cf14ab3 (diff)
downloadframeworks_base-9a77c8a279bfe3293295ed77c775ea29b88b2916.zip
frameworks_base-9a77c8a279bfe3293295ed77c775ea29b88b2916.tar.gz
frameworks_base-9a77c8a279bfe3293295ed77c775ea29b88b2916.tar.bz2
am 3c5cc234: am 674a3a21: Merge "Distinguish unspecified and explicit null values in resources" into lmp-mr1-dev
* commit '3c5cc234eeef4a08ad7b00b4e869a1e47cf14ab3': Distinguish unspecified and explicit null values in resources
Diffstat (limited to 'libs')
-rw-r--r--libs/androidfw/ResourceTypes.cpp16
1 files changed, 15 insertions, 1 deletions
diff --git a/libs/androidfw/ResourceTypes.cpp b/libs/androidfw/ResourceTypes.cpp
index 825071a..644ecde 100644
--- a/libs/androidfw/ResourceTypes.cpp
+++ b/libs/androidfw/ResourceTypes.cpp
@@ -4639,8 +4639,15 @@ bool ResTable::stringToValue(Res_value* outValue, String16* outString,
// It's a reference!
if (len == 5 && s[1]=='n' && s[2]=='u' && s[3]=='l' && s[4]=='l') {
+ // Special case @null as undefined. This will be converted by
+ // AssetManager to TYPE_NULL with data DATA_NULL_UNDEFINED.
outValue->data = 0;
return true;
+ } else if (len == 6 && s[1]=='e' && s[2]=='m' && s[3]=='p' && s[4]=='t' && s[5]=='y') {
+ // Special case @empty as explicitly defined empty value.
+ outValue->dataType = Res_value::TYPE_NULL;
+ outValue->data = Res_value::DATA_NULL_EMPTY;
+ return true;
} else {
bool createIfNotFound = false;
const char16_t* resourceRefName;
@@ -6251,7 +6258,14 @@ String8 ResTable::normalizeForOutput( const char *input )
void ResTable::print_value(const Package* pkg, const Res_value& value) const
{
if (value.dataType == Res_value::TYPE_NULL) {
- printf("(null)\n");
+ if (value.data == Res_value::DATA_NULL_UNDEFINED) {
+ printf("(null)\n");
+ } else if (value.data == Res_value::DATA_NULL_EMPTY) {
+ printf("(null empty)\n");
+ } else {
+ // This should never happen.
+ printf("(null) 0x%08x\n", value.data);
+ }
} else if (value.dataType == Res_value::TYPE_REFERENCE) {
printf("(reference) 0x%08x\n", value.data);
} else if (value.dataType == Res_value::TYPE_DYNAMIC_REFERENCE) {