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
789fef34
Commit
789fef34
authored
Jul 01, 2017
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix crash on Android O
parent
1daf5a61
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
51 additions
and
21 deletions
+51
-21
AndroidManifest.xml
app/src/main/AndroidManifest.xml
+1
-1
BootReceiver.java
...ain/java/com/topjohnwu/magisk/receivers/BootReceiver.java
+16
-2
BootupIntentService.java
...va/com/topjohnwu/magisk/services/BootupIntentService.java
+0
-18
OnBootIntentService.java
...va/com/topjohnwu/magisk/services/OnBootIntentService.java
+34
-0
No files found.
app/src/main/AndroidManifest.xml
View file @
789fef34
...
...
@@ -70,7 +70,7 @@
<receiver
android:name=
".receivers.ManagerUpdate"
/>
<service
android:name=
".services.
Bootup
IntentService"
/>
<service
android:name=
".services.
OnBoot
IntentService"
/>
<service
android:name=
".services.UpdateCheckService"
...
...
app/src/main/java/com/topjohnwu/magisk/receivers/BootReceiver.java
View file @
789fef34
...
...
@@ -3,14 +3,28 @@ package com.topjohnwu.magisk.receivers;
import
android.content.BroadcastReceiver
;
import
android.content.Context
;
import
android.content.Intent
;
import
android.os.Build
;
import
com.topjohnwu.magisk.services.BootupIntentService
;
import
com.topjohnwu.magisk.services.OnBootIntentService
;
import
com.topjohnwu.magisk.utils.Utils
;
public
class
BootReceiver
extends
BroadcastReceiver
{
private
void
startIntentService
(
Context
context
)
{
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
O
)
{
context
.
startForegroundService
(
new
Intent
(
context
,
OnBootIntentService
.
class
));
}
else
{
context
.
startService
(
new
Intent
(
context
,
OnBootIntentService
.
class
));
}
}
@Override
public
void
onReceive
(
Context
context
,
Intent
intent
)
{
context
.
startService
(
new
Intent
(
context
,
BootupIntentService
.
class
));
if
(
intent
.
getAction
().
equals
(
Intent
.
ACTION_BOOT_COMPLETED
))
{
Utils
.
getMagiskManager
(
context
).
initSU
();
// There is currently no need to start an IntentService onBoot
// startIntentService(context);
}
}
}
app/src/main/java/com/topjohnwu/magisk/services/BootupIntentService.java
deleted
100644 → 0
View file @
1daf5a61
package
com
.
topjohnwu
.
magisk
.
services
;
import
android.app.IntentService
;
import
android.content.Intent
;
import
com.topjohnwu.magisk.MagiskManager
;
public
class
BootupIntentService
extends
IntentService
{
public
BootupIntentService
()
{
super
(
"BootupIntentService"
);
}
@Override
protected
void
onHandleIntent
(
Intent
intent
)
{
((
MagiskManager
)
getApplication
()).
initSU
();
}
}
app/src/main/java/com/topjohnwu/magisk/services/OnBootIntentService.java
0 → 100644
View file @
789fef34
package
com
.
topjohnwu
.
magisk
.
services
;
import
android.app.IntentService
;
import
android.content.Intent
;
import
android.os.Build
;
import
android.support.v7.app.NotificationCompat
;
import
com.topjohnwu.magisk.R
;
public
class
OnBootIntentService
extends
IntentService
{
private
static
final
int
ONBOOT_NOTIFICATION_ID
=
3
;
public
OnBootIntentService
()
{
super
(
"OnBootIntentService"
);
}
@Override
public
void
onCreate
()
{
super
.
onCreate
();
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
O
)
{
NotificationCompat
.
Builder
builder
=
new
NotificationCompat
.
Builder
(
this
);
builder
.
setSmallIcon
(
R
.
drawable
.
ic_magisk
)
.
setContentTitle
(
"onBoot"
)
.
setContentText
(
"Running onBoot operations..."
);
startForeground
(
ONBOOT_NOTIFICATION_ID
,
builder
.
build
());
}
}
@Override
protected
void
onHandleIntent
(
Intent
intent
)
{
// Currently nothing to do
}
}
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