}
// If the application has requested WRITE_EXTERNAL_STORAGE, we will
- // force them to always take READ_EXTERNAL_STORAGE as well.
+ // force them to always take READ_EXTERNAL_STORAGE as well. We always
+ // do this (regardless of target API version) because we can't have
+ // an app with write permission but not read permission.
if (!hasReadExternalStoragePermission && hasWriteExternalStoragePermission) {
printf("uses-permission:'android.permission.READ_EXTERNAL_STORAGE'\n");
printf("uses-implied-permission:'android.permission.READ_EXTERNAL_STORAGE'," \
// Write the R.java file into the appropriate class directory
// e.g. gen/com/foo/app/R.java
err = writeResourceSymbols(bundle, assets, assets->getPackage(), true);
- // If we have library files, we're going to write our R.java file into
- // the appropriate class directory for those libraries as well.
- // e.g. gen/com/foo/app/lib/R.java
- if (bundle->getExtraPackages() != NULL) {
- // Split on colon
- String8 libs(bundle->getExtraPackages());
- char* packageString = strtok(libs.lockBuffer(libs.length()), ":");
- while (packageString != NULL) {
- // Write the R.java file out with the correct package name
- err = writeResourceSymbols(bundle, assets, String8(packageString), true);
- packageString = strtok(NULL, ":");
- }
- libs.unlockBuffer();
- }
} else {
const String8 customPkg(bundle->getCustomPackage());
err = writeResourceSymbols(bundle, assets, customPkg, true);
if (err < 0) {
goto bail;
}
+ // If we have library files, we're going to write our R.java file into
+ // the appropriate class directory for those libraries as well.
+ // e.g. gen/com/foo/app/lib/R.java
+ if (bundle->getExtraPackages() != NULL) {
+ // Split on colon
+ String8 libs(bundle->getExtraPackages());
+ char* packageString = strtok(libs.lockBuffer(libs.length()), ":");
+ while (packageString != NULL) {
+ // Write the R.java file out with the correct package name
+ err = writeResourceSymbols(bundle, assets, String8(packageString), true);
+ if (err < 0) {
+ goto bail;
+ }
+ packageString = strtok(NULL, ":");
+ }
+ libs.unlockBuffer();
+ }
} else {
err = writeResourceSymbols(bundle, assets, assets->getPackage(), false);
if (err < 0) {