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
a2ddf362
Commit
a2ddf362
authored
Nov 09, 2019
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make a.a not extend AppComponentFactory
Fix #2053
parent
65eca316
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
13 additions
and
18 deletions
+13
-18
AndroidManifest.xml
app/src/main/AndroidManifest.xml
+1
-3
a.java
app/src/main/java/a/a.java
+1
-3
Hacks.kt
app/src/main/java/com/topjohnwu/magisk/Hacks.kt
+2
-2
DynAPK.java
shared/src/main/java/com/topjohnwu/magisk/DynAPK.java
+4
-4
DelegateApplication.java
...c/main/java/com/topjohnwu/magisk/DelegateApplication.java
+4
-4
Mapping.java
...src/main/java/com/topjohnwu/magisk/obfuscate/Mapping.java
+1
-2
No files found.
app/src/main/AndroidManifest.xml
View file @
a2ddf362
...
@@ -11,10 +11,8 @@
...
@@ -11,10 +11,8 @@
<application
<application
android:name=
"a.e"
android:name=
"a.e"
android:appComponentFactory=
"a.a"
android:allowBackup=
"true"
android:allowBackup=
"true"
tools:ignore=
"UnusedAttribute,GoogleAppIndexingWarning"
tools:ignore=
"UnusedAttribute,GoogleAppIndexingWarning"
>
tools:replace=
"android:appComponentFactory"
>
<!-- Splash -->
<!-- Splash -->
<activity
<activity
...
...
app/src/main/java/a/a.java
View file @
a2ddf362
package
a
;
package
a
;
import
androidx.core.app.AppComponentFactory
;
import
com.topjohnwu.magisk.utils.PatchAPK
;
import
com.topjohnwu.magisk.utils.PatchAPK
;
import
com.topjohnwu.signing.BootSigner
;
import
com.topjohnwu.signing.BootSigner
;
public
class
a
extends
AppComponentFactory
{
public
class
a
{
@Deprecated
@Deprecated
public
static
boolean
patchAPK
(
String
in
,
String
out
,
String
pkg
)
{
public
static
boolean
patchAPK
(
String
in
,
String
out
,
String
pkg
)
{
...
...
app/src/main/java/com/topjohnwu/magisk/Hacks.kt
View file @
a2ddf362
...
@@ -50,7 +50,7 @@ fun Context.wrapJob(): Context = object : GlobalResContext(this) {
...
@@ -50,7 +50,7 @@ fun Context.wrapJob(): Context = object : GlobalResContext(this) {
fun
Class
<*>.
cmp
(
pkg
:
String
):
ComponentName
{
fun
Class
<*>.
cmp
(
pkg
:
String
):
ComponentName
{
val
name
=
ClassMap
[
this
].
name
val
name
=
ClassMap
[
this
].
name
return
ComponentName
(
pkg
,
Info
.
stub
?.
c
omponentMap
?.
get
(
name
)
?:
name
)
return
ComponentName
(
pkg
,
Info
.
stub
?.
c
lassToComponent
?.
get
(
name
)
?:
name
)
}
}
inline
fun
<
reified
T
>
Context
.
intent
()
=
Intent
().
setComponent
(
T
::
class
.
java
.
cmp
(
packageName
))
inline
fun
<
reified
T
>
Context
.
intent
()
=
Intent
().
setComponent
(
T
::
class
.
java
.
cmp
(
packageName
))
...
@@ -131,7 +131,7 @@ private class JobSchedulerWrapper(private val base: JobScheduler) : JobScheduler
...
@@ -131,7 +131,7 @@ private class JobSchedulerWrapper(private val base: JobScheduler) : JobScheduler
val
name
=
service
.
className
val
name
=
service
.
className
val
component
=
ComponentName
(
val
component
=
ComponentName
(
service
.
packageName
,
service
.
packageName
,
Info
.
stub
!!
.
c
omponentMap
[
name
]
?:
name
)
Info
.
stub
!!
.
c
lassToComponent
[
name
]
?:
name
)
// Clone the JobInfo except component
// Clone the JobInfo except component
val
builder
=
JobInfo
.
Builder
(
id
,
component
)
val
builder
=
JobInfo
.
Builder
(
id
,
component
)
...
...
shared/src/main/java/com/topjohnwu/magisk/DynAPK.java
View file @
a2ddf362
...
@@ -15,7 +15,7 @@ public class DynAPK {
...
@@ -15,7 +15,7 @@ public class DynAPK {
// Indices of the object array
// Indices of the object array
private
static
final
int
STUB_VERSION_ENTRY
=
0
;
private
static
final
int
STUB_VERSION_ENTRY
=
0
;
private
static
final
int
COMPONENT_MAP
=
1
;
private
static
final
int
C
LASS_C
OMPONENT_MAP
=
1
;
private
static
File
dynDir
;
private
static
File
dynDir
;
private
static
Method
addAssetPath
;
private
static
Method
addAssetPath
;
...
@@ -44,14 +44,14 @@ public class DynAPK {
...
@@ -44,14 +44,14 @@ public class DynAPK {
Object
[]
arr
=
(
Object
[])
o
;
Object
[]
arr
=
(
Object
[])
o
;
Data
data
=
new
Data
();
Data
data
=
new
Data
();
data
.
version
=
(
int
)
arr
[
STUB_VERSION_ENTRY
];
data
.
version
=
(
int
)
arr
[
STUB_VERSION_ENTRY
];
data
.
c
omponentMap
=
(
Map
<
String
,
String
>)
arr
[
COMPONENT_MAP
];
data
.
c
lassToComponent
=
(
Map
<
String
,
String
>)
arr
[
CLASS_
COMPONENT_MAP
];
return
data
;
return
data
;
}
}
public
static
Object
pack
(
Data
data
)
{
public
static
Object
pack
(
Data
data
)
{
Object
[]
arr
=
new
Object
[
2
];
Object
[]
arr
=
new
Object
[
2
];
arr
[
STUB_VERSION_ENTRY
]
=
data
.
version
;
arr
[
STUB_VERSION_ENTRY
]
=
data
.
version
;
arr
[
C
OMPONENT_MAP
]
=
data
.
componentMap
;
arr
[
C
LASS_COMPONENT_MAP
]
=
data
.
classToComponent
;
return
arr
;
return
arr
;
}
}
...
@@ -65,6 +65,6 @@ public class DynAPK {
...
@@ -65,6 +65,6 @@ public class DynAPK {
public
static
class
Data
{
public
static
class
Data
{
public
int
version
=
STUB_VERSION
;
public
int
version
=
STUB_VERSION
;
public
Map
<
String
,
String
>
c
omponentMap
;
public
Map
<
String
,
String
>
c
lassToComponent
;
}
}
}
}
stub/src/main/java/com/topjohnwu/magisk/DelegateApplication.java
View file @
a2ddf362
...
@@ -19,12 +19,12 @@ public class DelegateApplication extends Application {
...
@@ -19,12 +19,12 @@ public class DelegateApplication extends Application {
static
File
MANAGER_APK
;
static
File
MANAGER_APK
;
private
Object
factory
;
private
DelegateComponentFactory
factory
;
private
Application
delegate
;
private
Application
delegate
;
public
DelegateApplication
()
{}
public
DelegateApplication
()
{}
public
DelegateApplication
(
Object
o
)
{
public
DelegateApplication
(
DelegateComponentFactory
o
)
{
factory
=
o
;
factory
=
o
;
}
}
...
@@ -46,7 +46,6 @@ public class DelegateApplication extends Application {
...
@@ -46,7 +46,6 @@ public class DelegateApplication extends Application {
@SuppressLint
(
"NewApi"
)
@SuppressLint
(
"NewApi"
)
private
void
setUpDynAPK
()
{
private
void
setUpDynAPK
()
{
DelegateComponentFactory
factory
=
(
DelegateComponentFactory
)
this
.
factory
;
MANAGER_APK
=
DynAPK
.
current
(
this
);
MANAGER_APK
=
DynAPK
.
current
(
this
);
File
update
=
DynAPK
.
update
(
this
);
File
update
=
DynAPK
.
update
(
this
);
if
(
update
.
exists
())
if
(
update
.
exists
())
...
@@ -55,7 +54,8 @@ public class DelegateApplication extends Application {
...
@@ -55,7 +54,8 @@ public class DelegateApplication extends Application {
ClassLoader
cl
=
new
DynamicClassLoader
(
MANAGER_APK
,
factory
.
loader
);
ClassLoader
cl
=
new
DynamicClassLoader
(
MANAGER_APK
,
factory
.
loader
);
try
{
try
{
// Create the delegate AppComponentFactory
// Create the delegate AppComponentFactory
AppComponentFactory
df
=
(
AppComponentFactory
)
cl
.
loadClass
(
"a.a"
).
newInstance
();
AppComponentFactory
df
=
(
AppComponentFactory
)
cl
.
loadClass
(
"androidx.core.app.CoreComponentFactory"
).
newInstance
();
// Create the delegate Application
// Create the delegate Application
delegate
=
(
Application
)
cl
.
loadClass
(
"a.e"
).
getConstructor
(
Object
.
class
)
delegate
=
(
Application
)
cl
.
loadClass
(
"a.e"
).
getConstructor
(
Object
.
class
)
...
...
stub/src/main/java/com/topjohnwu/magisk/obfuscate/Mapping.java
View file @
a2ddf362
...
@@ -29,8 +29,7 @@ public class Mapping {
...
@@ -29,8 +29,7 @@ public class Mapping {
public
static
Data
data
()
{
public
static
Data
data
()
{
Data
data
=
new
Data
();
Data
data
=
new
Data
();
data
.
c
omponentMap
=
inverseMap
;
data
.
c
lassToComponent
=
inverseMap
;
return
data
;
return
data
;
}
}
}
}
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