6.3.1 - 新增发布通知权限 / WS 实例创建; 修复 floaty 模块异常 / 安卓 7.x 异常; UI 模式增强; 迁移至 View Binding

This commit is contained in:
SuperMonster003
2023-05-26 20:58:38 +08:00
parent 31ebd5b854
commit 1755ae3271
511 changed files with 12567 additions and 11063 deletions

View File

@@ -1,12 +1,12 @@
/*
* Copyright (c) 2009-2013 Panxiaobo
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -15,6 +15,12 @@
*/
package pxb.android;
import androidx.annotation.NonNull;
import org.autojs.autojs.pref.Language;
import java.util.Objects;
public class StringItem {
public String data;
public int dataOffset;
@@ -31,27 +37,7 @@ public class StringItem {
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
StringItem other = (StringItem) obj;
if (data == null) {
if (other.data != null)
return false;
} else if (!data.equals(other.data)) {
return false;
}
return true;
return this == obj || obj != null && getClass() == obj.getClass() && Objects.equals(data, ((StringItem) obj).data);
}
@Override
@@ -62,7 +48,8 @@ public class StringItem {
return result;
}
@NonNull
public String toString() {
return String.format("S%04d %s", index, data);
return String.format(Language.getPrefLanguage().getLocale(), "S%04d %s", index, data);
}
}

View File

@@ -32,16 +32,16 @@ public class ArscDumper {
for (int x = 0; x < pkgs.size(); x++) {
Pkg pkg = pkgs.get(x);
System.out.println(String.format(" Package %d id=%d name=%s typeCount=%d", x, pkg.id, pkg.name,
pkg.types.size()));
System.out.printf(" Package %d id=%d name=%s typeCount=%d%n", x, pkg.id, pkg.name,
pkg.types.size());
for (Type type : pkg.types.values()) {
System.out.println(String.format(" type %d %s", type.id - 1, type.name));
System.out.printf(" type %d %s%n", type.id - 1, type.name);
int resPrefix = pkg.id << 24 | type.id << 16;
for (int i = 0; i < type.specs.length; i++) {
ResSpec spec = type.getSpec(i);
System.out.println(String.format(" spec 0x%08x 0x%08x %s", resPrefix | spec.id, spec.flags,
spec.name));
System.out.printf(" spec 0x%08x 0x%08x %s%n", resPrefix | spec.id, spec.flags,
spec.name);
}
for (int i = 0; i < type.configs.size(); i++) {
Config config = type.configs.get(i);
@@ -50,8 +50,8 @@ public class ArscDumper {
List<ResEntry> entries = new ArrayList<ResEntry>(config.resources.values());
for (int j = 0; j < entries.size(); j++) {
ResEntry entry = entries.get(j);
System.out.println(String.format(" resource 0x%08x %-20s: %s",
resPrefix | entry.spec.id, entry.spec.name, entry.value));
System.out.printf(" resource 0x%08x %-20s: %s%n",
resPrefix | entry.spec.id, entry.spec.name, entry.value);
}
}
}

View File

@@ -89,7 +89,7 @@ public class ArscParser implements ResConst {
private static void D(String fmt, Object... args) {
if (DEBUG) {
System.out.println(String.format(fmt, args));
System.out.printf(fmt + "%n", args);
}
}

View File

@@ -15,14 +15,15 @@
*/
package pxb.android.arsc;
import androidx.annotation.NonNull;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
public class BagValue {
public final int parent;
public List<Entry<Integer, Value>> map = new ArrayList<Entry<Integer, Value>>();
public List<Entry<Integer, Value>> map = new ArrayList<>();
public BagValue(int parent) {
this.parent = parent;
@@ -42,9 +43,7 @@ public class BagValue {
return false;
} else if (!map.equals(other.map))
return false;
if (parent != other.parent)
return false;
return true;
return parent == other.parent;
}
@Override
@@ -56,6 +55,7 @@ public class BagValue {
return result;
}
@NonNull
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(String.format("{bag%08x", parent));

View File

@@ -15,6 +15,8 @@
*/
package pxb.android.arsc;
import androidx.annotation.NonNull;
public class Value {
public final int data;
public final int type;
@@ -27,6 +29,7 @@ public class Value {
this.raw = raw;
}
@NonNull
public String toString() {
if (type == 0x03) {
return raw;

View File

@@ -25,6 +25,8 @@ import java.util.*;
import static pxb.android.axml.AxmlParser.*;
import org.autojs.autojs.pref.Language;
/**
* a class to write android axml
*
@@ -102,7 +104,7 @@ public class AxmlWriter extends AxmlVisitor {
e.setValue(ns);
}
if (ns.prefix == null) {
ns.prefix = new StringItem(String.format("axml_auto_%02d", a++));
ns.prefix = new StringItem(String.format(Language.getPrefLanguage().getLocale(), "axml_auto_%02d", a++));
}
ns.prefix = update(ns.prefix);
ns.uri = update(ns.uri);

View File

@@ -47,23 +47,22 @@ public class DumpAdapter extends AxmlVisitor {
System.out.print(" ");
}
if (ns != null) {
System.out.print(String.format("%s:", getPrefix(ns)));
System.out.printf("%s:", getPrefix(ns));
}
System.out.print(name);
if (resourceId != -1) {
System.out.print(String.format("(%08x)", resourceId));
System.out.printf("(%08x)", resourceId);
}
if (obj instanceof String) {
System.out.print(String.format("=[%08x]\"%s\"", type, obj));
System.out.printf("=[%08x]\"%s\"", type, obj);
} else if (obj instanceof Boolean) {
System.out.print(String.format("=[%08x]\"%b\"", type, obj));
} else if (obj instanceof ValueWrapper) {
ValueWrapper w = (ValueWrapper) obj;
System.out.print(String.format("=[%08x]@%08x, raw: \"%s\"", type, w.ref, w.raw));
System.out.printf("=[%08x]\"%b\"", type, obj);
} else if (obj instanceof ValueWrapper w) {
System.out.printf("=[%08x]@%08x, raw: \"%s\"", type, w.ref, w.raw);
} else if (type == TYPE_REFERENCE) {
System.out.print(String.format("=[%08x]@%08x", type, obj));
System.out.printf("=[%08x]@%08x", type, obj);
} else {
System.out.print(String.format("=[%08x]%08x", type, obj));
System.out.printf("=[%08x]%08x", type, obj);
}
System.out.println();
super.attr(ns, name, resourceId, type, obj);