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
31681c9c
Commit
31681c9c
authored
Aug 23, 2020
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove ProcessPhoenix
parent
0e5a32b4
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
22 additions
and
96 deletions
+22
-96
AndroidManifest.xml
app/shared/src/main/AndroidManifest.xml
+0
-3
ProcessPhoenix.java
...ed/src/main/java/com/topjohnwu/magisk/ProcessPhoenix.java
+0
-71
AndroidManifest.xml
app/src/main/AndroidManifest.xml
+3
-5
stubs.kt
app/src/main/java/a/stubs.kt
+1
-4
Hacks.kt
app/src/main/java/com/topjohnwu/magisk/core/Hacks.kt
+1
-3
ManagerUpgrade.kt
...java/com/topjohnwu/magisk/core/download/ManagerUpgrade.kt
+2
-3
XSU.kt
app/src/main/java/com/topjohnwu/magisk/ktx/XSU.kt
+10
-0
manager.sh
app/src/main/res/raw/manager.sh
+4
-0
AndroidManifest.xml
stub/src/main/AndroidManifest.xml
+1
-7
No files found.
app/shared/src/main/AndroidManifest.xml
View file @
31681c9c
...
...
@@ -4,9 +4,6 @@
<uses-permission
android:name=
"android.permission.ACCESS_NETWORK_STATE"
/>
<uses-permission
android:name=
"android.permission.REQUEST_INSTALL_PACKAGES"
/>
<uses-permission
android:name=
"android.permission.WRITE_EXTERNAL_STORAGE"
android:maxSdkVersion=
"28"
/>
<application
android:label=
"Magisk Manager"
...
...
app/shared/src/main/java/com/topjohnwu/magisk/ProcessPhoenix.java
deleted
100644 → 0
View file @
0e5a32b4
/*
* Copyright (C) 2014 Jake Wharton
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
com
.
topjohnwu
.
magisk
;
import
android.app.Activity
;
import
android.content.Context
;
import
android.content.Intent
;
import
android.os.Bundle
;
import
java.util.ArrayList
;
import
static
android
.
content
.
Intent
.
FLAG_ACTIVITY_CLEAR_TASK
;
import
static
android
.
content
.
Intent
.
FLAG_ACTIVITY_NEW_TASK
;
/**
* Modified from JakeWharton/ProcessPhoenix
*
* Process Phoenix facilitates restarting your application process. This should only be used for
* things like fundamental state changes in your debug builds (e.g., changing from staging to
* production).
* <p>
* Trigger process recreation by calling {@link #triggerRebirth} with a {@link Context} instance.
*/
public
class
ProcessPhoenix
extends
Activity
{
private
static
final
String
KEY_RESTART_INTENT
=
"phoenix_restart_intent"
;
public
static
void
triggerRebirth
(
Context
context
,
Intent
intent
)
{
intent
.
addFlags
(
FLAG_ACTIVITY_NEW_TASK
);
// In case we are called with non-Activity context.
intent
.
putExtra
(
KEY_RESTART_INTENT
,
getRestartIntent
(
context
));
context
.
startActivity
(
intent
);
if
(
context
instanceof
Activity
)
{
((
Activity
)
context
).
finish
();
}
Runtime
.
getRuntime
().
exit
(
0
);
}
private
static
Intent
getRestartIntent
(
Context
context
)
{
String
packageName
=
context
.
getPackageName
();
Intent
defaultIntent
=
context
.
getPackageManager
().
getLaunchIntentForPackage
(
packageName
);
if
(
defaultIntent
!=
null
)
{
defaultIntent
.
addFlags
(
FLAG_ACTIVITY_NEW_TASK
|
FLAG_ACTIVITY_CLEAR_TASK
);
return
defaultIntent
;
}
throw
new
IllegalStateException
();
}
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
Intent
intent
=
getIntent
().
getParcelableExtra
(
KEY_RESTART_INTENT
);
startActivity
(
intent
);
finish
();
Runtime
.
getRuntime
().
exit
(
0
);
}
}
app/src/main/AndroidManifest.xml
View file @
31681c9c
...
...
@@ -7,6 +7,9 @@
<uses-permission
android:name=
"android.permission.VIBRATE"
/>
<uses-permission
android:name=
"android.permission.FOREGROUND_SERVICE"
/>
<uses-permission
android:name=
"com.android.launcher.permission.INSTALL_SHORTCUT"
/>
<uses-permission
android:name=
"android.permission.WRITE_EXTERNAL_STORAGE"
android:maxSdkVersion=
"28"
/>
<application
android:icon=
"@drawable/ic_launcher"
...
...
@@ -44,11 +47,6 @@
</intent-filter>
</activity>
<!-- ProcessPhoenix -->
<activity
android:name=
"a.r"
android:process=
":remote"
/>
<!-- Receiver -->
<receiver
android:name=
"a.h"
...
...
app/src/main/java/a/stubs.kt
View file @
31681c9c
@file
:
JvmName
(
"a"
)
package
a
import
com.topjohnwu.magisk.ProcessPhoenix
import
com.topjohnwu.magisk.core.App
import
com.topjohnwu.magisk.core.GeneralReceiver
import
com.topjohnwu.magisk.core.SplashActivity
import
com.topjohnwu.magisk.core.download.DownloadService
import
com.topjohnwu.magisk.ui.surequest.SuRequestActivity
import
com.topjohnwu.magisk.ui.MainActivity
import
com.topjohnwu.magisk.ui.surequest.SuRequestActivity
import
com.topjohnwu.signing.BootSigner
fun
main
(
args
:
Array
<
String
>)
{
...
...
@@ -28,5 +27,3 @@ class h : GeneralReceiver()
class
j
:
DownloadService
()
class
m
:
SuRequestActivity
()
class
r
:
ProcessPhoenix
()
app/src/main/java/com/topjohnwu/magisk/core/Hacks.kt
View file @
31681c9c
...
...
@@ -16,7 +16,6 @@ import android.content.res.Configuration
import
android.content.res.Resources
import
androidx.annotation.RequiresApi
import
com.topjohnwu.magisk.DynAPK
import
com.topjohnwu.magisk.ProcessPhoenix
import
com.topjohnwu.magisk.R
import
com.topjohnwu.magisk.core.download.DownloadService
import
com.topjohnwu.magisk.core.utils.refreshLocale
...
...
@@ -152,8 +151,7 @@ private object ClassMap {
SplashActivity
::
class
.
java
to
a
.
c
::
class
.
java
,
GeneralReceiver
::
class
.
java
to
a
.
h
::
class
.
java
,
DownloadService
::
class
.
java
to
a
.
j
::
class
.
java
,
SuRequestActivity
::
class
.
java
to
a
.
m
::
class
.
java
,
ProcessPhoenix
::
class
.
java
to
a
.
r
::
class
.
java
SuRequestActivity
::
class
.
java
to
a
.
m
::
class
.
java
)
operator
fun
get
(
c
:
Class
<
*
>)
=
map
.
getOrElse
(
c
)
{
c
}
...
...
app/src/main/java/com/topjohnwu/magisk/core/download/ManagerUpgrade.kt
View file @
31681c9c
...
...
@@ -3,15 +3,14 @@ package com.topjohnwu.magisk.core.download
import
androidx.core.net.toFile
import
com.topjohnwu.magisk.BuildConfig
import
com.topjohnwu.magisk.DynAPK
import
com.topjohnwu.magisk.ProcessPhoenix
import
com.topjohnwu.magisk.R
import
com.topjohnwu.magisk.core.Config
import
com.topjohnwu.magisk.core.Info
import
com.topjohnwu.magisk.core.download.Action.APK.Restore
import
com.topjohnwu.magisk.core.download.Action.APK.Upgrade
import
com.topjohnwu.magisk.core.intent
import
com.topjohnwu.magisk.core.isRunningAsStub
import
com.topjohnwu.magisk.core.utils.PatchAPK
import
com.topjohnwu.magisk.ktx.relaunchApp
import
com.topjohnwu.magisk.ktx.writeTo
import
com.topjohnwu.magisk.utils.APKInstall
import
com.topjohnwu.superuser.Shell
...
...
@@ -46,7 +45,7 @@ private suspend fun DownloadService.upgrade(apk: File, id: Int) {
patch
(
apk
,
id
)
}
else
{
// Simply relaunch the app
ProcessPhoenix
.
triggerRebirth
(
this
,
intent
<
ProcessPhoenix
>()
)
relaunchApp
(
this
)
}
}
else
{
patch
(
apk
,
id
)
...
...
app/src/main/java/com/topjohnwu/magisk/ktx/XSU.kt
View file @
31681c9c
package
com.topjohnwu.magisk.ktx
import
android.content.Context
import
com.topjohnwu.magisk.core.Const
import
com.topjohnwu.magisk.core.Info
import
com.topjohnwu.superuser.Shell
import
kotlinx.coroutines.Dispatchers
...
...
@@ -9,4 +11,12 @@ fun reboot(reason: String = if (Info.recovery) "recovery" else "") {
Shell
.
su
(
"/system/bin/svc power reboot $reason || /system/bin/reboot $reason"
).
submit
()
}
fun
relaunchApp
(
context
:
Context
)
{
val
intent
=
context
.
packageManager
.
getLaunchIntentForPackage
(
context
.
packageName
)
?:
return
val
args
=
mutableListOf
(
"am"
,
"start"
,
"--user"
,
Const
.
USER_ID
.
toString
())
val
cmd
=
intent
.
toCommand
(
args
).
joinToString
(
separator
=
" "
)
Shell
.
su
(
"run_delay 1 \"$cmd\""
).
exec
()
Runtime
.
getRuntime
().
exit
(
0
)
}
suspend
fun
Shell
.
Job
.
await
()
=
withContext
(
Dispatchers
.
IO
)
{
exec
()
}
app/src/main/res/raw/manager.sh
View file @
31681c9c
...
...
@@ -2,6 +2,10 @@
# Magisk Manager internal scripts
##################################
run_delay
()
{
(
sleep
$1
;
$2
)
&
}
env_check
()
{
for
file
in
busybox magisk magiskboot magiskinit util_functions.sh boot_patch.sh
;
do
[
-f
$MAGISKBIN
/
$file
]
||
return
1
...
...
stub/src/main/AndroidManifest.xml
View file @
31681c9c
...
...
@@ -10,19 +10,13 @@
android:allowBackup=
"true"
tools:ignore=
"AllowBackup"
>
<activity
android:name=
"a.a"
android:theme=
"@android:style/Theme.Translucent.NoTitleBar"
>
<activity
android:name=
"a.a"
>
<intent-filter>
<action
android:name=
"android.intent.action.MAIN"
/>
<category
android:name=
"android.intent.category.LAUNCHER"
/>
</intent-filter>
</activity>
<activity
android:name=
"a.r"
tools:node=
"remove"
/>
</application>
</manifest>
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