From 1bcc3d691fd1cb68abced62caf3024e2bb228561 Mon Sep 17 00:00:00 2001 From: Nick Kralevich Date: Wed, 3 Apr 2013 09:00:02 -0700 Subject: aapt: add support for optional uses-permission Applications can request a permission with android:required="false". For example: Make aapt understand such permissions. Bug: 8522021 Change-Id: I7d3af64e7c3eca608316d5bea19c4ea639dd2b7a --- tools/aapt/Command.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'tools/aapt/Command.cpp') diff --git a/tools/aapt/Command.cpp b/tools/aapt/Command.cpp index 84f5a5ca60d7..cadac02f1e04 100644 --- a/tools/aapt/Command.cpp +++ b/tools/aapt/Command.cpp @@ -592,6 +592,10 @@ int doDump(Bundle* bundle) goto bail; } printf("uses-permission: %s\n", name.string()); + int req = getIntegerAttribute(tree, REQUIRED_ATTR, NULL, 1); + if (!req) { + printf("optional-permission: %s\n", name.string()); + } } } } else if (strcmp("badging", option) == 0) { @@ -1033,6 +1037,10 @@ int doDump(Bundle* bundle) hasWriteCallLogPermission = true; } printf("uses-permission:'%s'\n", name.string()); + int req = getIntegerAttribute(tree, REQUIRED_ATTR, NULL, 1); + if (!req) { + printf("optional-permission:'%s'\n", name.string()); + } } else { fprintf(stderr, "ERROR getting 'android:name' attribute: %s\n", error.string()); -- cgit v1.2.3-59-g8ed1b