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
6c4d082f
Commit
6c4d082f
authored
Jan 30, 2019
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove unnecessary BroadcastReceiver
parent
26218504
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
29 additions
and
40 deletions
+29
-40
AndroidManifest.xml
app/src/full/AndroidManifest.xml
+1
-5
i.java
app/src/full/java/a/i.java
+0
-7
ClassMap.java
app/src/full/java/com/topjohnwu/magisk/ClassMap.java
+0
-2
SplashActivity.java
app/src/full/java/com/topjohnwu/magisk/SplashActivity.java
+2
-2
Shortcuts.java
.../full/java/com/topjohnwu/magisk/components/Shortcuts.java
+22
-24
GeneralReceiver.java
.../java/com/topjohnwu/magisk/receivers/GeneralReceiver.java
+4
-0
No files found.
app/src/full/AndroidManifest.xml
View file @
6c4d082f
...
...
@@ -53,6 +53,7 @@
<receiver
android:name=
"a.h"
>
<intent-filter>
<action
android:name=
"android.intent.action.BOOT_COMPLETED"
/>
<action
android:name=
"android.intent.action.LOCALE_CHANGED"
/>
</intent-filter>
<intent-filter>
<action
android:name=
"android.intent.action.PACKAGE_REPLACED"
/>
...
...
@@ -60,11 +61,6 @@
<data
android:scheme=
"package"
/>
</intent-filter>
</receiver>
<receiver
android:name=
"a.i"
>
<intent-filter>
<action
android:name=
"android.intent.action.LOCALE_CHANGED"
/>
</intent-filter>
</receiver>
<!-- Service -->
...
...
app/src/full/java/a/i.java
deleted
100644 → 0
View file @
26218504
package
a
;
import
com.topjohnwu.magisk.receivers.ShortcutReceiver
;
public
class
i
extends
ShortcutReceiver
{
/* stub */
}
app/src/full/java/com/topjohnwu/magisk/ClassMap.java
View file @
6c4d082f
...
...
@@ -2,7 +2,6 @@ package com.topjohnwu.magisk;
import
com.topjohnwu.magisk.components.AboutCardRow
;
import
com.topjohnwu.magisk.receivers.GeneralReceiver
;
import
com.topjohnwu.magisk.receivers.ShortcutReceiver
;
import
com.topjohnwu.magisk.services.DownloadModuleService
;
import
com.topjohnwu.magisk.services.UpdateCheckService
;
...
...
@@ -20,7 +19,6 @@ public class ClassMap {
classMap
.
put
(
FlashActivity
.
class
,
a
.
f
.
class
);
classMap
.
put
(
UpdateCheckService
.
class
,
a
.
g
.
class
);
classMap
.
put
(
GeneralReceiver
.
class
,
a
.
h
.
class
);
classMap
.
put
(
ShortcutReceiver
.
class
,
a
.
i
.
class
);
classMap
.
put
(
DownloadModuleService
.
class
,
a
.
j
.
class
);
classMap
.
put
(
AboutCardRow
.
class
,
a
.
l
.
class
);
classMap
.
put
(
SuRequestActivity
.
class
,
a
.
m
.
class
);
...
...
app/src/full/java/com/topjohnwu/magisk/SplashActivity.java
View file @
6c4d082f
...
...
@@ -7,7 +7,7 @@ import android.text.TextUtils;
import
com.topjohnwu.magisk.components.BaseActivity
;
import
com.topjohnwu.magisk.components.Notifications
;
import
com.topjohnwu.magisk.
receivers.ShortcutReceiver
;
import
com.topjohnwu.magisk.
components.Shortcuts
;
import
com.topjohnwu.magisk.tasks.CheckUpdates
;
import
com.topjohnwu.magisk.tasks.UpdateRepos
;
import
com.topjohnwu.magisk.utils.AppUtils
;
...
...
@@ -54,7 +54,7 @@ public class SplashActivity extends BaseActivity {
AppUtils
.
scheduleUpdateCheck
();
// Setup shortcuts
sendBroadcast
(
new
Intent
(
this
,
ClassMap
.
get
(
ShortcutReceiver
.
class
))
);
Shortcuts
.
setup
(
this
);
if
(
Networking
.
checkNetworkStatus
(
this
))
{
// Fire update check
...
...
app/src/full/java/com/topjohnwu/magisk/
receivers/ShortcutReceiver
.java
→
app/src/full/java/com/topjohnwu/magisk/
components/Shortcuts
.java
View file @
6c4d082f
package
com
.
topjohnwu
.
magisk
.
receiver
s
;
package
com
.
topjohnwu
.
magisk
.
component
s
;
import
android.content.BroadcastReceiver
;
import
android.content.Context
;
import
android.content.Intent
;
import
android.content.pm.ShortcutInfo
;
...
...
@@ -8,7 +7,6 @@ import android.content.pm.ShortcutManager;
import
android.graphics.drawable.Icon
;
import
android.os.Build
;
import
com.topjohnwu.magisk.App
;
import
com.topjohnwu.magisk.ClassMap
;
import
com.topjohnwu.magisk.Config
;
import
com.topjohnwu.magisk.Const
;
...
...
@@ -21,58 +19,58 @@ import java.util.ArrayList;
import
androidx.annotation.RequiresApi
;
public
class
Shortcut
Receiver
extends
BroadcastReceiver
{
@Override
public
void
onReceive
(
Context
context
,
Intent
inten
t
)
{
public
class
Shortcut
s
{
public
static
void
setup
(
Context
contex
t
)
{
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
N_MR1
)
{
ShortcutManager
manager
=
context
.
getSystemService
(
ShortcutManager
.
class
);
manager
.
setDynamicShortcuts
(
getShortCuts
(
App
.
self
));
manager
.
setDynamicShortcuts
(
getShortCuts
(
context
));
}
}
@RequiresApi
(
api
=
Build
.
VERSION_CODES
.
N_MR1
)
private
ArrayList
<
ShortcutInfo
>
getShortCuts
(
App
app
)
{
private
static
ArrayList
<
ShortcutInfo
>
getShortCuts
(
Context
context
)
{
ArrayList
<
ShortcutInfo
>
shortCuts
=
new
ArrayList
<>();
boolean
root
=
Shell
.
rootAccess
();
if
(
Utils
.
showSuperUser
())
{
shortCuts
.
add
(
new
ShortcutInfo
.
Builder
(
app
,
"superuser"
)
.
setShortLabel
(
app
.
getString
(
R
.
string
.
superuser
))
.
setIntent
(
new
Intent
(
app
,
ClassMap
.
get
(
SplashActivity
.
class
))
shortCuts
.
add
(
new
ShortcutInfo
.
Builder
(
context
,
"superuser"
)
.
setShortLabel
(
context
.
getString
(
R
.
string
.
superuser
))
.
setIntent
(
new
Intent
(
context
,
ClassMap
.
get
(
SplashActivity
.
class
))
.
putExtra
(
Const
.
Key
.
OPEN_SECTION
,
"superuser"
)
.
setAction
(
Intent
.
ACTION_VIEW
)
.
addFlags
(
Intent
.
FLAG_ACTIVITY_CLEAR_TASK
))
.
setIcon
(
Icon
.
createWithResource
(
app
,
R
.
drawable
.
sc_superuser
))
.
setIcon
(
Icon
.
createWithResource
(
context
,
R
.
drawable
.
sc_superuser
))
.
setRank
(
0
)
.
build
());
}
if
(
root
&&
(
boolean
)
Config
.
get
(
Config
.
Key
.
MAGISKHIDE
))
{
shortCuts
.
add
(
new
ShortcutInfo
.
Builder
(
app
,
"magiskhide"
)
.
setShortLabel
(
app
.
getString
(
R
.
string
.
magiskhide
))
.
setIntent
(
new
Intent
(
app
,
ClassMap
.
get
(
SplashActivity
.
class
))
shortCuts
.
add
(
new
ShortcutInfo
.
Builder
(
context
,
"magiskhide"
)
.
setShortLabel
(
context
.
getString
(
R
.
string
.
magiskhide
))
.
setIntent
(
new
Intent
(
context
,
ClassMap
.
get
(
SplashActivity
.
class
))
.
putExtra
(
Const
.
Key
.
OPEN_SECTION
,
"magiskhide"
)
.
setAction
(
Intent
.
ACTION_VIEW
)
.
addFlags
(
Intent
.
FLAG_ACTIVITY_CLEAR_TASK
))
.
setIcon
(
Icon
.
createWithResource
(
app
,
R
.
drawable
.
sc_magiskhide
))
.
setIcon
(
Icon
.
createWithResource
(
context
,
R
.
drawable
.
sc_magiskhide
))
.
setRank
(
1
)
.
build
());
}
if
(!(
boolean
)
Config
.
get
(
Config
.
Key
.
COREONLY
)
&&
root
&&
Config
.
magiskVersionCode
>=
0
)
{
shortCuts
.
add
(
new
ShortcutInfo
.
Builder
(
app
,
"modules"
)
.
setShortLabel
(
app
.
getString
(
R
.
string
.
modules
))
.
setIntent
(
new
Intent
(
app
,
ClassMap
.
get
(
SplashActivity
.
class
))
shortCuts
.
add
(
new
ShortcutInfo
.
Builder
(
context
,
"modules"
)
.
setShortLabel
(
context
.
getString
(
R
.
string
.
modules
))
.
setIntent
(
new
Intent
(
context
,
ClassMap
.
get
(
SplashActivity
.
class
))
.
putExtra
(
Const
.
Key
.
OPEN_SECTION
,
"modules"
)
.
setAction
(
Intent
.
ACTION_VIEW
)
.
addFlags
(
Intent
.
FLAG_ACTIVITY_CLEAR_TASK
))
.
setIcon
(
Icon
.
createWithResource
(
app
,
R
.
drawable
.
sc_extension
))
.
setIcon
(
Icon
.
createWithResource
(
context
,
R
.
drawable
.
sc_extension
))
.
setRank
(
3
)
.
build
());
shortCuts
.
add
(
new
ShortcutInfo
.
Builder
(
app
,
"downloads"
)
.
setShortLabel
(
app
.
getString
(
R
.
string
.
downloads
))
.
setIntent
(
new
Intent
(
app
,
ClassMap
.
get
(
SplashActivity
.
class
))
shortCuts
.
add
(
new
ShortcutInfo
.
Builder
(
context
,
"downloads"
)
.
setShortLabel
(
context
.
getString
(
R
.
string
.
downloads
))
.
setIntent
(
new
Intent
(
context
,
ClassMap
.
get
(
SplashActivity
.
class
))
.
putExtra
(
Const
.
Key
.
OPEN_SECTION
,
"downloads"
)
.
setAction
(
Intent
.
ACTION_VIEW
)
.
addFlags
(
Intent
.
FLAG_ACTIVITY_CLEAR_TASK
))
.
setIcon
(
Icon
.
createWithResource
(
app
,
R
.
drawable
.
sc_cloud_download
))
.
setIcon
(
Icon
.
createWithResource
(
context
,
R
.
drawable
.
sc_cloud_download
))
.
setRank
(
2
)
.
build
());
}
...
...
app/src/full/java/com/topjohnwu/magisk/receivers/GeneralReceiver.java
View file @
6c4d082f
...
...
@@ -11,6 +11,7 @@ import com.topjohnwu.magisk.Config;
import
com.topjohnwu.magisk.Const
;
import
com.topjohnwu.magisk.SuRequestActivity
;
import
com.topjohnwu.magisk.components.Notifications
;
import
com.topjohnwu.magisk.components.Shortcuts
;
import
com.topjohnwu.magisk.utils.DownloadApp
;
import
com.topjohnwu.magisk.utils.SuConnector
;
import
com.topjohnwu.superuser.Shell
;
...
...
@@ -75,6 +76,9 @@ public class GeneralReceiver extends BroadcastReceiver {
app
.
mDB
.
deletePolicy
(
pkg
);
Shell
.
su
(
"magiskhide --rm "
+
pkg
).
submit
();
break
;
case
Intent
.
ACTION_LOCALE_CHANGED
:
Shortcuts
.
setup
(
context
);
break
;
case
Const
.
Key
.
BROADCAST_MANAGER_UPDATE
:
Config
.
managerLink
=
intent
.
getStringExtra
(
Const
.
Key
.
INTENT_SET_LINK
);
DownloadApp
.
upgrade
(
intent
.
getStringExtra
(
Const
.
Key
.
INTENT_SET_NAME
));
...
...
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