Skip to content

Commit 145a66d

Browse files
author
WindySha
committed
add permisson:QUERY_ALL_PACKAGES
1 parent f9cda11 commit 145a66d

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

xpatch/src/main/java/com/storm/wind/xpatch/MainCommand.java

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -240,35 +240,30 @@ protected void doCommandLine() {
240240

241241
private void modifyManifestFile(String filePath, String dstFilePath, String originalApplicationName) {
242242
ModificationProperty property = new ModificationProperty();
243-
boolean modifyEnabled = false;
244243
if (isNotEmpty(newPackageName)) {
245-
modifyEnabled = true;
246244
property.addManifestAttribute(new AttributeItem(NodeValue.Manifest.PACKAGE, newPackageName).setNamespace(null));
247245
}
248246

249247
if (versionCode > 0) {
250-
modifyEnabled = true;
251248
property.addManifestAttribute(new AttributeItem(NodeValue.Manifest.VERSION_CODE, versionCode));
252249
}
253250

254251
if (isNotEmpty(versionName)) {
255-
modifyEnabled = true;
256252
property.addManifestAttribute(new AttributeItem(NodeValue.Manifest.VERSION_NAME, versionName));
257253
}
258254

259255
if (debuggable >= 0) {
260-
modifyEnabled = true;
261256
property.addApplicationAttribute(new AttributeItem(NodeValue.Application.DEBUGGABLE, debuggable != 0));
262257
}
263258

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

269-
if (modifyEnabled) {
270-
FileProcesser.processManifestFile(filePath, dstFilePath, property);
271-
}
263+
// Android 11, needs this permission
264+
property.addUsesPermission("android.permission.QUERY_ALL_PACKAGES");
265+
266+
FileProcesser.processManifestFile(filePath, dstFilePath, property);
272267
}
273268

274269
private int findDexFileCount(String unzipApkFilePath) {

0 commit comments

Comments
 (0)