X-Git-Url: https://git.saurik.com/android/aapt.git/blobdiff_plain/3648aeafd19e6850bd58e5d6c930dbe90a9b4194..e3c6837d5afb19f648acbd2e5e3ac0b885a1bf6a:/Command.cpp diff --git a/Command.cpp b/Command.cpp index 1a536d6..537ae5e 100644 --- a/Command.cpp +++ b/Command.cpp @@ -401,7 +401,7 @@ int doDump(Bundle* bundle) ResXMLTree tree; asset = assets.openNonAsset(resname, Asset::ACCESS_BUFFER); if (asset == NULL) { - fprintf(stderr, "ERROR: dump failed because resource %p found\n", resname); + fprintf(stderr, "ERROR: dump failed because resource %s found\n", resname); goto bail; } @@ -412,6 +412,7 @@ int doDump(Bundle* bundle) } tree.restart(); printXMLBlock(&tree); + tree.uninit(); delete asset; asset = NULL; } @@ -427,7 +428,7 @@ int doDump(Bundle* bundle) ResXMLTree tree; asset = assets.openNonAsset(resname, Asset::ACCESS_BUFFER); if (asset == NULL) { - fprintf(stderr, "ERROR: dump failed because resource %p found\n", resname); + fprintf(stderr, "ERROR: dump failed because resource %s found\n", resname); goto bail; } @@ -524,6 +525,8 @@ int doDump(Bundle* bundle) bool actWallpaperService = false; bool specCameraFeature = false; bool hasCameraPermission = false; + bool specGpsFeature = false; + bool hasGpsPermission = false; int targetSdk = 0; int smallScreen = 1; int normalScreen = 1; @@ -678,7 +681,7 @@ int doDump(Bundle* bundle) REQ_NAVIGATION_ATTR, NULL, 0); int32_t reqFiveWayNav = getIntegerAttribute(tree, REQ_FIVE_WAY_NAV_ATTR, NULL, 0); - printf("uses-configuation:"); + printf("uses-configuration:"); if (reqTouchScreen != 0) { printf(" reqTouchScreen='%d'", reqTouchScreen); } @@ -718,6 +721,8 @@ int doDump(Bundle* bundle) REQUIRED_ATTR, NULL, 1); if (name == "android.hardware.camera") { specCameraFeature = true; + } else if (name == "android.hardware.location.gps") { + specGpsFeature = true; } printf("uses-feature%s:'%s'\n", req ? "" : "-not-required", name.string()); @@ -733,6 +738,8 @@ int doDump(Bundle* bundle) if (name != "" && error == "") { if (name == "android.permission.CAMERA") { hasCameraPermission = true; + } else if (name == "android.permission.ACCESS_FINE_LOCATION") { + hasGpsPermission = true; } printf("uses-permission:'%s'\n", name.string()); } else { @@ -740,6 +747,15 @@ int doDump(Bundle* bundle) error.string()); goto bail; } + } else if (tag == "original-package") { + String8 name = getAttribute(tree, NAME_ATTR, &error); + if (name != "" && error == "") { + printf("original-package:'%s'\n", name.string()); + } else { + fprintf(stderr, "ERROR getting 'android:name' attribute: %s\n", + error.string()); + goto bail; + } } } else if (depth == 3 && withinApplication) { withinActivity = false; @@ -849,6 +865,14 @@ int doDump(Bundle* bundle) printf("uses-feature:'android.hardware.camera.autofocus'\n"); } + if (!specGpsFeature && hasGpsPermission) { + // For applications that have not explicitly stated their + // GPS feature requirements, but have requested the "fine" (GPS) + // permission, we are going to give them compatibility treatment + // of requiring the equivalent to original android devices. + printf("uses-feature:'android.hardware.location.gps'\n"); + } + if (hasMainActivity) { printf("main\n"); } @@ -1151,7 +1175,12 @@ int doPackage(Bundle* bundle) // Write out R.java constants if (assets->getPackage() == assets->getSymbolsPrivatePackage()) { - err = writeResourceSymbols(bundle, assets, assets->getPackage(), true); + if (bundle->getCustomPackage() == NULL) { + err = writeResourceSymbols(bundle, assets, assets->getPackage(), true); + } else { + const String8 customPkg(bundle->getCustomPackage()); + err = writeResourceSymbols(bundle, assets, customPkg, true); + } if (err < 0) { goto bail; }