Skip to content

Commit

Permalink
add permisson:QUERY_ALL_PACKAGES
Browse files Browse the repository at this point in the history
  • Loading branch information
WindySha committed Sep 1, 2021
1 parent f9cda11 commit 145a66d
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions xpatch/src/main/java/com/storm/wind/xpatch/MainCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -240,35 +240,30 @@ protected void doCommandLine() {

private void modifyManifestFile(String filePath, String dstFilePath, String originalApplicationName) {
ModificationProperty property = new ModificationProperty();
boolean modifyEnabled = false;
if (isNotEmpty(newPackageName)) {
modifyEnabled = true;
property.addManifestAttribute(new AttributeItem(NodeValue.Manifest.PACKAGE, newPackageName).setNamespace(null));
}

if (versionCode > 0) {
modifyEnabled = true;
property.addManifestAttribute(new AttributeItem(NodeValue.Manifest.VERSION_CODE, versionCode));
}

if (isNotEmpty(versionName)) {
modifyEnabled = true;
property.addManifestAttribute(new AttributeItem(NodeValue.Manifest.VERSION_NAME, versionName));
}

if (debuggable >= 0) {
modifyEnabled = true;
property.addApplicationAttribute(new AttributeItem(NodeValue.Application.DEBUGGABLE, debuggable != 0));
}

if (!dexModificationMode || !isNotEmpty(originalApplicationName)) {
modifyEnabled = true;
property.addApplicationAttribute(new AttributeItem(NodeValue.Application.NAME, PROXY_APPLICATION_NAME));
}

if (modifyEnabled) {
FileProcesser.processManifestFile(filePath, dstFilePath, property);
}
// Android 11, needs this permission
property.addUsesPermission("android.permission.QUERY_ALL_PACKAGES");

FileProcesser.processManifestFile(filePath, dstFilePath, property);
}

private int findDexFileCount(String unzipApkFilePath) {
Expand Down

0 comments on commit 145a66d

Please sign in to comment.