mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-12-25 08:57:39 +00:00
Patch app label when repackaging
This commit is contained in:
parent
07bfdf3e4d
commit
7b04386162
@ -21,7 +21,6 @@
|
|||||||
android:exported="true" />
|
android:exported="true" />
|
||||||
<activity
|
<activity
|
||||||
android:name="a.c"
|
android:name="a.c"
|
||||||
android:label="@string/app_name"
|
|
||||||
android:configChanges="orientation|screenSize"
|
android:configChanges="orientation|screenSize"
|
||||||
android:exported="true"
|
android:exported="true"
|
||||||
android:theme="@style/SplashTheme">
|
android:theme="@style/SplashTheme">
|
||||||
|
@ -20,6 +20,7 @@ import com.topjohnwu.utils.SignAPK;
|
|||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
import java.nio.ByteOrder;
|
import java.nio.ByteOrder;
|
||||||
import java.nio.CharBuffer;
|
import java.nio.CharBuffer;
|
||||||
|
import java.nio.IntBuffer;
|
||||||
import java.security.SecureRandom;
|
import java.security.SecureRandom;
|
||||||
import java.util.jar.JarEntry;
|
import java.util.jar.JarEntry;
|
||||||
|
|
||||||
@ -80,6 +81,18 @@ public class PatchAPK {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static boolean findAndPatch(byte xml[], int a, int b) {
|
||||||
|
IntBuffer buf = ByteBuffer.wrap(xml).order(ByteOrder.LITTLE_ENDIAN).asIntBuffer();
|
||||||
|
int len = xml.length / 4;
|
||||||
|
for (int i = 0; i < len; ++i) {
|
||||||
|
if (buf.get(i) == a) {
|
||||||
|
buf.put(i, b);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
private static boolean patchAndHide() {
|
private static boolean patchAndHide() {
|
||||||
MagiskManager mm = Data.MM();
|
MagiskManager mm = Data.MM();
|
||||||
|
|
||||||
@ -115,7 +128,8 @@ public class PatchAPK {
|
|||||||
byte xml[] = apk.getRawData(je);
|
byte xml[] = apk.getRawData(je);
|
||||||
|
|
||||||
if (!findAndPatch(xml, from, to) ||
|
if (!findAndPatch(xml, from, to) ||
|
||||||
!findAndPatch(xml, from + ".provider", to + ".provider"))
|
!findAndPatch(xml, from + ".provider", to + ".provider") ||
|
||||||
|
!findAndPatch(xml, R.string.app_name, R.string.re_app_name))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Write in changes
|
// Write in changes
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
android:allowBackup="false"
|
android:allowBackup="false"
|
||||||
android:directBootAware="true"
|
android:directBootAware="true"
|
||||||
android:icon="@drawable/ic_launcher"
|
android:icon="@drawable/ic_launcher"
|
||||||
android:label="@string/re_app_name"
|
android:label="@string/app_name"
|
||||||
android:supportsRtl="true"
|
android:supportsRtl="true"
|
||||||
tools:ignore="GoogleAppIndexingWarning,UnusedAttribute">
|
tools:ignore="GoogleAppIndexingWarning,UnusedAttribute">
|
||||||
|
|
||||||
|
@ -6,7 +6,6 @@
|
|||||||
<application
|
<application
|
||||||
tools:ignore="GoogleAppIndexingWarning">
|
tools:ignore="GoogleAppIndexingWarning">
|
||||||
<activity
|
<activity
|
||||||
android:label="@string/app_name"
|
|
||||||
android:name=".MainActivity"
|
android:name=".MainActivity"
|
||||||
android:theme="@android:style/Theme.Translucent.NoTitleBar">
|
android:theme="@android:style/Theme.Translucent.NoTitleBar">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user