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
dfa36fb2
Commit
dfa36fb2
authored
May 23, 2022
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move things around
parent
c8492b0c
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
10 additions
and
12 deletions
+10
-12
ClassLoaders.java
stub/src/main/java/com/topjohnwu/magisk/ClassLoaders.java
+1
-4
DelegateComponentFactory.java
...n/java/com/topjohnwu/magisk/DelegateComponentFactory.java
+5
-5
DownloadActivity.java
.../src/main/java/com/topjohnwu/magisk/DownloadActivity.java
+1
-1
DynLoad.java
stub/src/main/java/com/topjohnwu/magisk/DynLoad.java
+3
-2
No files found.
stub/src/main/java/com/topjohnwu/magisk/ClassLoaders.java
View file @
dfa36fb2
...
...
@@ -130,15 +130,12 @@ class StubClassLoader extends ClassLoader {
class
DelegateClassLoader
extends
ClassLoader
{
// The active classloader
static
ClassLoader
cl
=
DelegateClassLoader
.
class
.
getClassLoader
();
DelegateClassLoader
()
{
super
(
null
);
}
@Override
protected
Class
<?>
loadClass
(
String
name
,
boolean
resolve
)
throws
ClassNotFoundException
{
return
cl
.
loadClass
(
name
);
return
DynLoad
.
activeClassLoader
.
loadClass
(
name
);
}
}
stub/src/main/java/com/topjohnwu/magisk/DelegateComponentFactory.java
View file @
dfa36fb2
...
...
@@ -37,7 +37,7 @@ public class DelegateComponentFactory extends AppComponentFactory {
public
Activity
instantiateActivity
(
ClassLoader
cl
,
String
className
,
Intent
intent
)
throws
ClassNotFoundException
,
IllegalAccessException
,
InstantiationException
{
if
(
receiver
!=
null
)
return
receiver
.
instantiateActivity
(
D
elegateClassLoader
.
cl
,
className
,
intent
);
return
receiver
.
instantiateActivity
(
D
ynLoad
.
activeClassLoader
,
className
,
intent
);
return
create
(
className
,
DownloadActivity
.
class
);
}
...
...
@@ -45,7 +45,7 @@ public class DelegateComponentFactory extends AppComponentFactory {
public
BroadcastReceiver
instantiateReceiver
(
ClassLoader
cl
,
String
className
,
Intent
intent
)
throws
ClassNotFoundException
,
IllegalAccessException
,
InstantiationException
{
if
(
receiver
!=
null
)
return
receiver
.
instantiateReceiver
(
D
elegateClassLoader
.
cl
,
className
,
intent
);
return
receiver
.
instantiateReceiver
(
D
ynLoad
.
activeClassLoader
,
className
,
intent
);
return
create
(
className
,
DummyReceiver
.
class
);
}
...
...
@@ -53,7 +53,7 @@ public class DelegateComponentFactory extends AppComponentFactory {
public
Service
instantiateService
(
ClassLoader
cl
,
String
className
,
Intent
intent
)
throws
ClassNotFoundException
,
IllegalAccessException
,
InstantiationException
{
if
(
receiver
!=
null
)
return
receiver
.
instantiateService
(
D
elegateClassLoader
.
cl
,
className
,
intent
);
return
receiver
.
instantiateService
(
D
ynLoad
.
activeClassLoader
,
className
,
intent
);
return
create
(
className
,
DummyService
.
class
);
}
...
...
@@ -61,7 +61,7 @@ public class DelegateComponentFactory extends AppComponentFactory {
public
ContentProvider
instantiateProvider
(
ClassLoader
cl
,
String
className
)
throws
ClassNotFoundException
,
IllegalAccessException
,
InstantiationException
{
if
(
receiver
!=
null
)
return
receiver
.
instantiateProvider
(
D
elegateClassLoader
.
cl
,
className
);
return
receiver
.
instantiateProvider
(
D
ynLoad
.
activeClassLoader
,
className
);
return
create
(
className
,
DummyProvider
.
class
);
}
...
...
@@ -69,7 +69,7 @@ public class DelegateComponentFactory extends AppComponentFactory {
throws
IllegalAccessException
,
InstantiationException
{
try
{
// noinspection unchecked
return
(
T
)
D
elegateClassLoader
.
cl
.
loadClass
(
name
).
newInstance
();
return
(
T
)
D
ynLoad
.
activeClassLoader
.
loadClass
(
name
).
newInstance
();
}
catch
(
ClassNotFoundException
e
)
{
return
fallback
.
newInstance
();
}
...
...
stub/src/main/java/com/topjohnwu/magisk/DownloadActivity.java
View file @
dfa36fb2
...
...
@@ -59,7 +59,7 @@ public class DownloadActivity extends Activity {
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
if
(
D
elegateClassLoader
.
cl
instanceof
AppClassLoader
)
{
if
(
D
ynLoad
.
activeClassLoader
instanceof
AppClassLoader
)
{
// For some reason activity is created before Application.attach(),
// relaunch the activity using the same intent
finishAffinity
();
...
...
stub/src/main/java/com/topjohnwu/magisk/DynLoad.java
View file @
dfa36fb2
...
...
@@ -28,6 +28,7 @@ import io.michaelrocks.paranoid.Obfuscate;
public
class
DynLoad
{
static
Object
componentFactory
;
static
ClassLoader
activeClassLoader
=
DynLoad
.
class
.
getClassLoader
();
static
StubApk
.
Data
createApkData
()
{
var
data
=
new
StubApk
.
Data
();
...
...
@@ -150,7 +151,7 @@ public class DynLoad {
delegate
.
receiver
=
(
AppComponentFactory
)
factory
;
}
DelegateClassLoader
.
cl
=
cl
;
activeClassLoader
=
cl
;
// Send real application to attachBaseContext
attachContext
(
app
,
context
);
...
...
@@ -161,7 +162,7 @@ public class DynLoad {
apk
.
delete
();
}
DelegateClassLoader
.
cl
=
new
StubClassLoader
(
info
);
activeClassLoader
=
new
StubClassLoader
(
info
);
return
null
;
}
...
...
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