Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
M
Magisk
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Magisk
Commits
02bf7dca
Commit
02bf7dca
authored
Feb 15, 2022
by
vvb2060
Committed by
John Wu
Feb 17, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Check apk before patch
parent
8cc76b1d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
2 deletions
+3
-2
HideAPK.kt
app/src/main/java/com/topjohnwu/magisk/core/tasks/HideAPK.kt
+3
-2
No files found.
app/src/main/java/com/topjohnwu/magisk/core/tasks/HideAPK.kt
View file @
02bf7dca
...
@@ -33,7 +33,6 @@ object HideAPK {
...
@@ -33,7 +33,6 @@ object HideAPK {
private
const
val
ALPHA
=
"abcdefghijklmnopqrstuvwxyz"
private
const
val
ALPHA
=
"abcdefghijklmnopqrstuvwxyz"
private
const
val
ALPHADOTS
=
"$ALPHA....."
private
const
val
ALPHADOTS
=
"$ALPHA....."
private
const
val
APP_NAME
=
"Magisk"
private
const
val
ANDROID_MANIFEST
=
"AndroidManifest.xml"
private
const
val
ANDROID_MANIFEST
=
"AndroidManifest.xml"
// Some arbitrary limit
// Some arbitrary limit
...
@@ -69,12 +68,14 @@ object HideAPK {
...
@@ -69,12 +68,14 @@ object HideAPK {
apk
:
File
,
out
:
File
,
apk
:
File
,
out
:
File
,
pkg
:
String
,
label
:
CharSequence
pkg
:
String
,
label
:
CharSequence
):
Boolean
{
):
Boolean
{
val
info
=
context
.
packageManager
.
getPackageArchiveInfo
(
apk
.
path
,
0
)
?:
return
false
val
name
=
info
.
applicationInfo
.
nonLocalizedLabel
.
toString
()
try
{
try
{
val
jar
=
JarMap
.
open
(
apk
,
true
)
val
jar
=
JarMap
.
open
(
apk
,
true
)
val
je
=
jar
.
getJarEntry
(
ANDROID_MANIFEST
)
val
je
=
jar
.
getJarEntry
(
ANDROID_MANIFEST
)
val
xml
=
AXML
(
jar
.
getRawData
(
je
))
val
xml
=
AXML
(
jar
.
getRawData
(
je
))
if
(!
xml
.
findAndPatch
(
APPLICATION_ID
to
pkg
,
APP_NAME
to
label
.
toString
()))
if
(!
xml
.
findAndPatch
(
APPLICATION_ID
to
pkg
,
name
to
label
.
toString
()))
return
false
return
false
// Write apk changes
// Write apk changes
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment