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
c553312f
Commit
c553312f
authored
Sep 26, 2016
by
d8ahazard
Committed by
topjohnwu
Sep 27, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Re-add activity check
Causes false disables otherwise.
parent
3adc7ca2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
12 deletions
+25
-12
MonitorService.java
...in/java/com/topjohnwu/magisk/services/MonitorService.java
+25
-12
No files found.
app/src/main/java/com/topjohnwu/magisk/services/MonitorService.java
View file @
c553312f
...
...
@@ -7,6 +7,7 @@ import android.app.PendingIntent;
import
android.content.ComponentName
;
import
android.content.Intent
;
import
android.content.SharedPreferences
;
import
android.content.pm.ActivityInfo
;
import
android.content.pm.ApplicationInfo
;
import
android.content.pm.PackageManager
;
import
android.os.Build
;
...
...
@@ -61,23 +62,35 @@ public class MonitorService extends AccessibilityService {
event
.
getPackageName
().
toString
(),
event
.
getClassName
().
toString
()
);
Logger
.
dh
(
"MonitorService: CurrentActivity: "
+
event
.
getPackageName
());
String
mPackage
=
componentName
.
getPackageName
();
SharedPreferences
prefs
=
PreferenceManager
.
getDefaultSharedPreferences
(
getApplicationContext
());
if
(
Utils
.
autoToggleEnabled
(
getApplicationContext
()))
{
Set
<
String
>
setBlackList
=
prefs
.
getStringSet
(
"auto_blacklist"
,
null
);
if
(
setBlackList
!=
null
)
{
disableroot
=
setBlackList
.
contains
(
mPackage
);
ForceRoot
(!
disableroot
);
String
appFriendly
=
getAppName
(
mPackage
);
ShowNotification
(
disableroot
,
appFriendly
);
ActivityInfo
activityInfo
=
tryGetActivity
(
componentName
);
boolean
isActivity
=
activityInfo
!=
null
;
if
(
isActivity
)
{
Logger
.
dh
(
"MonitorService: CurrentActivity: "
+
event
.
getPackageName
());
String
mPackage
=
componentName
.
getPackageName
();
SharedPreferences
prefs
=
PreferenceManager
.
getDefaultSharedPreferences
(
getApplicationContext
());
if
(
Utils
.
autoToggleEnabled
(
getApplicationContext
()))
{
Set
<
String
>
setBlackList
=
prefs
.
getStringSet
(
"auto_blacklist"
,
null
);
if
(
setBlackList
!=
null
)
{
disableroot
=
setBlackList
.
contains
(
mPackage
);
ForceRoot
(!
disableroot
);
String
appFriendly
=
getAppName
(
mPackage
);
ShowNotification
(
disableroot
,
appFriendly
);
}
}
}
}
}
private
ActivityInfo
tryGetActivity
(
ComponentName
componentName
)
{
try
{
return
getPackageManager
().
getActivityInfo
(
componentName
,
0
);
}
catch
(
PackageManager
.
NameNotFoundException
e
)
{
return
null
;
}
}
private
String
getAppName
(
String
packageName
)
{
PackageManager
pkManager
=
getPackageManager
();
ApplicationInfo
appInfo
;
...
...
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