X-Git-Url: https://git.saurik.com/android/aapt.git/blobdiff_plain/d81652a8a555152c6524211dd1c34ea59d5d9181..7a7c29caf280ea038fb29377a75586bc5b527857:/Command.cpp diff --git a/Command.cpp b/Command.cpp index 607056a..198fce4 100644 --- a/Command.cpp +++ b/Command.cpp @@ -636,6 +636,9 @@ int doDump(Bundle* bundle) bool hasWriteExternalStoragePermission = false; bool hasReadPhoneStatePermission = false; + // If an app requests write storage, they will also get read storage. + bool hasReadExternalStoragePermission = false; + // This next group of variables is used to implement a group of // backward-compatibility heuristics necessitated by the addition of // some new uses-feature constants in 2.1 and 2.2. In most cases, the @@ -999,6 +1002,8 @@ int doDump(Bundle* bundle) hasTelephonyPermission = true; } else if (name == "android.permission.WRITE_EXTERNAL_STORAGE") { hasWriteExternalStoragePermission = true; + } else if (name == "android.permission.READ_EXTERNAL_STORAGE") { + hasReadExternalStoragePermission = true; } else if (name == "android.permission.READ_PHONE_STATE") { hasReadPhoneStatePermission = true; } @@ -1163,12 +1168,19 @@ int doDump(Bundle* bundle) if (targetSdk < 4) { if (!hasWriteExternalStoragePermission) { printf("uses-permission:'android.permission.WRITE_EXTERNAL_STORAGE'\n"); + hasWriteExternalStoragePermission = true; } if (!hasReadPhoneStatePermission) { printf("uses-permission:'android.permission.READ_PHONE_STATE'\n"); } } + // If the application has requested WRITE_EXTERNAL_STORAGE, we will + // force them to always take READ_EXTERNAL_STORAGE as well. + if (!hasReadExternalStoragePermission && hasWriteExternalStoragePermission) { + printf("uses-permission:'android.permission.READ_EXTERNAL_STORAGE'\n"); + } + /* The following blocks handle printing "inferred" uses-features, based * on whether related features or permissions are used by the app. * Note that the various spec*Feature variables denote whether the @@ -1617,6 +1629,12 @@ int doPackage(Bundle* bundle) goto bail; } + // Update symbols with information about which ones are needed as Java symbols. + assets->applyJavaSymbols(); + if (SourcePos::hasErrors()) { + goto bail; + } + // If we've been asked to generate a dependency file, do that here if (bundle->getGenDependencies()) { // If this is the packaging step, generate the dependency file next to @@ -1638,7 +1656,7 @@ int doPackage(Bundle* bundle) } // Write out R.java constants - if (assets->getPackage() == assets->getSymbolsPrivatePackage()) { + if (!assets->havePrivateSymbols()) { if (bundle->getCustomPackage() == NULL) { // Write the R.java file into the appropriate class directory // e.g. gen/com/foo/app/R.java