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
714feeb9
Commit
714feeb9
authored
Sep 07, 2021
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support building on case insensitive filesystems
Fix #4643, close #4641
parent
ca99808f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
11 deletions
+17
-11
Codegen.kt
buildSrc/src/main/java/Codegen.kt
+13
-7
DownloadActivity.java
.../src/main/java/com/topjohnwu/magisk/DownloadActivity.java
+4
-4
No files found.
buildSrc/src/main/java/Codegen.kt
View file @
714feeb9
...
@@ -10,10 +10,12 @@ import javax.crypto.Cipher
...
@@ -10,10 +10,12 @@ import javax.crypto.Cipher
import
javax.crypto.CipherOutputStream
import
javax.crypto.CipherOutputStream
import
javax.crypto.spec.IvParameterSpec
import
javax.crypto.spec.IvParameterSpec
import
javax.crypto.spec.SecretKeySpec
import
javax.crypto.spec.SecretKeySpec
import
kotlin.random.asKotlinRandom
// Set non-zero value here to fix the random seed
to create
reproducible builds
// Set non-zero value here to fix the random seed
for
reproducible builds
const
val
RAND_SEED
=
0
const
val
RAND_SEED
=
0
private
lateinit
var
RANDOM
:
Random
private
lateinit
var
RANDOM
:
Random
private
val
kRANDOM
get
()
=
RANDOM
.
asKotlinRandom
()
private
val
c1
=
mutableListOf
<
String
>()
private
val
c1
=
mutableListOf
<
String
>()
private
val
c2
=
mutableListOf
<
String
>()
private
val
c2
=
mutableListOf
<
String
>()
...
@@ -195,15 +197,19 @@ fun genStubManifest(srcDir: File, outDir: File): String {
...
@@ -195,15 +197,19 @@ fun genStubManifest(srcDir: File, outDir: File): String {
names
.
addAll
(
c3
.
subList
(
0
,
10
))
names
.
addAll
(
c3
.
subList
(
0
,
10
))
names
.
shuffle
(
RANDOM
)
names
.
shuffle
(
RANDOM
)
// Decapitalize as older Android versions do not allow capitalized package names
// Distinct by lower case to support case insensitive file systems
val
pkgNames
=
names
.
map
{
it
.
decapitalize
(
Locale
.
ROOT
)
}
.
distinctBy
{
it
.
toLowerCase
(
Locale
.
ROOT
)
}
var
idx
=
0
var
idx
=
0
fun
genCmpName
():
String
{
fun
genCmpName
()
=
"${pkgNames[idx++]}.${names.random(kRANDOM)}"
val
name
=
"${names[idx++]}.${names[idx++]}"
return
name
[
0
].
toLowerCase
()
+
name
.
substring
(
1
)
}
fun
genClass
(
clzName
:
String
,
type
:
String
)
{
fun
genClass
(
clzName
:
String
,
type
:
String
)
{
val
(
pkg
,
name
)
=
clzName
.
split
(
'.'
)
val
(
pkg
,
name
)
=
clzName
.
split
(
'.'
)
PrintStream
(
File
(
mainPkgDir
,
"$name.java"
)).
use
{
val
pkgDir
=
File
(
outDir
,
pkg
)
pkgDir
.
mkdir
()
PrintStream
(
File
(
pkgDir
,
"$name.java"
)).
use
{
it
.
println
(
"package $pkg;"
)
it
.
println
(
"package $pkg;"
)
it
.
println
(
"public class $name extends com.topjohnwu.magisk.$type {}"
)
it
.
println
(
"public class $name extends com.topjohnwu.magisk.$type {}"
)
}
}
...
@@ -254,7 +260,7 @@ fun genEncryptedResources(res: File, outDir: File) {
...
@@ -254,7 +260,7 @@ fun genEncryptedResources(res: File, outDir: File) {
it
.
delete
()
it
.
delete
()
txt
txt
}
}
File
(
mainPkgDir
,
"
A.java"
).
writeText
(
r
.
replace
(
"class R"
,
"class A
"
))
File
(
mainPkgDir
,
"
R2.java"
).
writeText
(
r
.
replace
(
"class R"
,
"class R2
"
))
// Generate iv and key
// Generate iv and key
val
iv
=
ByteArray
(
16
)
val
iv
=
ByteArray
(
16
)
...
...
stub/src/main/java/com/topjohnwu/magisk/DownloadActivity.java
View file @
714feeb9
...
@@ -4,10 +4,10 @@ import static android.R.string.no;
...
@@ -4,10 +4,10 @@ import static android.R.string.no;
import
static
android
.
R
.
string
.
ok
;
import
static
android
.
R
.
string
.
ok
;
import
static
android
.
R
.
string
.
yes
;
import
static
android
.
R
.
string
.
yes
;
import
static
com
.
topjohnwu
.
magisk
.
DelegateApplication
.
dynLoad
;
import
static
com
.
topjohnwu
.
magisk
.
DelegateApplication
.
dynLoad
;
import
static
com
.
topjohnwu
.
magisk
.
A
.
string
.
dling
;
import
static
com
.
topjohnwu
.
magisk
.
R2
.
string
.
dling
;
import
static
com
.
topjohnwu
.
magisk
.
A
.
string
.
no_internet_msg
;
import
static
com
.
topjohnwu
.
magisk
.
R2
.
string
.
no_internet_msg
;
import
static
com
.
topjohnwu
.
magisk
.
A
.
string
.
relaunch_app
;
import
static
com
.
topjohnwu
.
magisk
.
R2
.
string
.
relaunch_app
;
import
static
com
.
topjohnwu
.
magisk
.
A
.
string
.
upgrade_msg
;
import
static
com
.
topjohnwu
.
magisk
.
R2
.
string
.
upgrade_msg
;
import
android.app.Activity
;
import
android.app.Activity
;
import
android.app.AlertDialog
;
import
android.app.AlertDialog
;
...
...
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