From 8730f46ae5ba9021a0e01c068ffc6b552b6c4510 Mon Sep 17 00:00:00 2001 From: Xavier Ducrohet Date: Fri, 12 Apr 2013 16:00:49 -0700 Subject: Make --non-constant-id generates non final IDs for styleable. This was already done for all other types of resources, but not for styleable (or the constants for the styleable array indices). This fixes this. This only affects the SDK as this is used by the SDK toolchain only. Change-Id: Idfc2f7915be2b0e88590f38fd660610ffc7e160c --- tools/aapt/Resource.cpp | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'tools') diff --git a/tools/aapt/Resource.cpp b/tools/aapt/Resource.cpp index 77168f9..44aaa43 100644 --- a/tools/aapt/Resource.cpp +++ b/tools/aapt/Resource.cpp @@ -1597,7 +1597,7 @@ static String16 getAttributeComment(const sp& assets, static status_t writeLayoutClasses( FILE* fp, const sp& assets, - const sp& symbols, int indent, bool includePrivate) + const sp& symbols, int indent, bool includePrivate, bool nonConstantId) { const char* indentStr = getIndentSpace(indent); if (!includePrivate) { @@ -1612,6 +1612,14 @@ static status_t writeLayoutClasses( indentStr = getIndentSpace(indent); bool hasErrors = false; + const char * id_array_format = nonConstantId ? + "%spublic static int[] %s = {\n%s" : + "%spublic static final int[] %s = {\n%s"; + + const char * id_array_index_format = nonConstantId ? + "%spublic static int %s_%s = %d;\n" : + "%spublic static final int %s_%s = %d;\n"; + size_t i; size_t N = symbols->getNestedSymbols().size(); for (i=0; i