diff options
| author | Alan Viverette <alanv@google.com> | 2014-10-30 00:45:56 +0000 |
|---|---|---|
| committer | Android Git Automerger <android-git-automerger@android.com> | 2014-10-30 00:45:56 +0000 |
| commit | 3c5cc234eeef4a08ad7b00b4e869a1e47cf14ab3 (patch) | |
| tree | 0b137803f64dd5555d708312711605fc6f88061f /libs | |
| parent | 07a08010a87daec2091b643a8fcf2f7a27588098 (diff) | |
| parent | 674a3a21cba94c129b322b05bbaaf9b1fc8afbd8 (diff) | |
| download | frameworks_base-3c5cc234eeef4a08ad7b00b4e869a1e47cf14ab3.zip frameworks_base-3c5cc234eeef4a08ad7b00b4e869a1e47cf14ab3.tar.gz frameworks_base-3c5cc234eeef4a08ad7b00b4e869a1e47cf14ab3.tar.bz2 | |
am 674a3a21: Merge "Distinguish unspecified and explicit null values in resources" into lmp-mr1-dev
* commit '674a3a21cba94c129b322b05bbaaf9b1fc8afbd8':
Distinguish unspecified and explicit null values in resources
Diffstat (limited to 'libs')
| -rw-r--r-- | libs/androidfw/ResourceTypes.cpp | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/libs/androidfw/ResourceTypes.cpp b/libs/androidfw/ResourceTypes.cpp index b5d2885..3bbca1a 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) { |
