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
53c5ca59
Commit
53c5ca59
authored
Apr 10, 2019
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleanup SuLogger
parent
679db972
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
20 deletions
+12
-20
GeneralReceiver.java
...java/com/topjohnwu/magisk/components/GeneralReceiver.java
+2
-12
SuLogger.java
app/src/main/java/com/topjohnwu/magisk/utils/SuLogger.java
+10
-8
No files found.
app/src/main/java/com/topjohnwu/magisk/components/GeneralReceiver.java
View file @
53c5ca59
...
...
@@ -8,9 +8,7 @@ import com.topjohnwu.magisk.App;
import
com.topjohnwu.magisk.ClassMap
;
import
com.topjohnwu.magisk.Config
;
import
com.topjohnwu.magisk.Const
;
import
com.topjohnwu.magisk.R
;
import
com.topjohnwu.magisk.SuRequestActivity
;
import
com.topjohnwu.magisk.container.Policy
;
import
com.topjohnwu.magisk.uicomponents.Notifications
;
import
com.topjohnwu.magisk.uicomponents.Shortcuts
;
import
com.topjohnwu.magisk.utils.DownloadApp
;
...
...
@@ -19,14 +17,6 @@ import com.topjohnwu.superuser.Shell;
public
class
GeneralReceiver
extends
BroadcastReceiver
{
private
static
SuLogger
SU_LOGGER
=
new
SuLogger
()
{
@Override
public
String
getMessage
(
Policy
policy
)
{
return
App
.
self
.
getString
(
policy
.
policy
==
Policy
.
ALLOW
?
R
.
string
.
su_allow_toast
:
R
.
string
.
su_deny_toast
,
policy
.
appName
);
}
};
private
String
getPkg
(
Intent
i
)
{
return
i
.
getData
()
==
null
?
""
:
i
.
getData
().
getEncodedSchemeSpecificPart
();
}
...
...
@@ -54,10 +44,10 @@ public class GeneralReceiver extends BroadcastReceiver {
app
.
startActivity
(
i
);
break
;
case
"log"
:
S
U_LOGGER
.
handleLogs
(
intent
);
S
uLogger
.
handleLogs
(
intent
);
break
;
case
"notify"
:
S
U_LOGGER
.
handleNotify
(
intent
);
S
uLogger
.
handleNotify
(
intent
);
break
;
case
"boot_complete"
:
default
:
...
...
app/src/main/java/com/topjohnwu/magisk/utils/SuLogger.java
View file @
53c5ca59
...
...
@@ -8,14 +8,15 @@ import android.widget.Toast;
import
com.topjohnwu.magisk.App
;
import
com.topjohnwu.magisk.Config
;
import
com.topjohnwu.magisk.R
;
import
com.topjohnwu.magisk.container.Policy
;
import
com.topjohnwu.magisk.container.SuLogEntry
;
import
java.util.Date
;
public
abstract
class
SuLogger
{
public
class
SuLogger
{
public
void
handleLogs
(
Intent
intent
)
{
public
static
void
handleLogs
(
Intent
intent
)
{
int
fromUid
=
intent
.
getIntExtra
(
"from.uid"
,
-
1
);
if
(
fromUid
<
0
)
return
;
...
...
@@ -64,13 +65,16 @@ public abstract class SuLogger {
app
.
mDB
.
addLog
(
log
);
}
private
void
handleNotify
(
Policy
policy
)
{
private
static
void
handleNotify
(
Policy
policy
)
{
if
(
policy
.
notification
&&
(
int
)
Config
.
get
(
Config
.
Key
.
SU_NOTIFICATION
)
==
Config
.
Value
.
NOTIFICATION_TOAST
)
Utils
.
toast
(
getMessage
(
policy
),
Toast
.
LENGTH_SHORT
);
(
int
)
Config
.
get
(
Config
.
Key
.
SU_NOTIFICATION
)
==
Config
.
Value
.
NOTIFICATION_TOAST
)
{
Utils
.
toast
(
App
.
self
.
getString
(
policy
.
policy
==
Policy
.
ALLOW
?
R
.
string
.
su_allow_toast
:
R
.
string
.
su_deny_toast
,
policy
.
appName
),
Toast
.
LENGTH_SHORT
);
}
}
public
void
handleNotify
(
Intent
intent
)
{
public
static
void
handleNotify
(
Intent
intent
)
{
int
fromUid
=
intent
.
getIntExtra
(
"from.uid"
,
-
1
);
if
(
fromUid
<
0
)
return
;
if
(
fromUid
==
Process
.
myUid
())
return
;
...
...
@@ -81,6 +85,4 @@ public abstract class SuLogger {
handleNotify
(
policy
);
}
catch
(
PackageManager
.
NameNotFoundException
ignored
)
{}
}
public
abstract
String
getMessage
(
Policy
policy
);
}
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