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
58ae596b
Commit
58ae596b
authored
Sep 29, 2018
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Require fp auth when toggling su permission if required
Close #656
parent
f1ca2167
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
15 deletions
+30
-15
PolicyAdapter.java
...ull/java/com/topjohnwu/magisk/adapters/PolicyAdapter.java
+30
-11
FingerprintHelper.java
...ll/java/com/topjohnwu/magisk/utils/FingerprintHelper.java
+0
-4
No files found.
app/src/full/java/com/topjohnwu/magisk/adapters/PolicyAdapter.java
View file @
58ae596b
...
...
@@ -10,6 +10,7 @@ import android.widget.Switch;
import
android.widget.TextView
;
import
com.google.android.material.snackbar.Snackbar
;
import
com.topjohnwu.magisk.Data
;
import
com.topjohnwu.magisk.R
;
import
com.topjohnwu.magisk.ViewBinder
;
import
com.topjohnwu.magisk.components.CustomAlertDialog
;
...
...
@@ -17,6 +18,7 @@ import com.topjohnwu.magisk.components.ExpandableView;
import
com.topjohnwu.magisk.components.SnackbarMaker
;
import
com.topjohnwu.magisk.container.Policy
;
import
com.topjohnwu.magisk.database.MagiskDatabaseHelper
;
import
com.topjohnwu.magisk.utils.FingerprintHelper
;
import
java.util.HashSet
;
import
java.util.List
;
...
...
@@ -62,14 +64,34 @@ public class PolicyAdapter extends RecyclerView.Adapter<PolicyAdapter.ViewHolder
holder
.
appName
.
setText
(
policy
.
appName
);
holder
.
packageName
.
setText
(
policy
.
packageName
);
holder
.
appIcon
.
setImageDrawable
(
policy
.
info
.
loadIcon
(
pm
));
holder
.
masterSwitch
.
setOnCheckedChangeListener
((
v
,
isChecked
)
->
{
if
((
isChecked
&&
policy
.
policy
==
Policy
.
DENY
)
||
(!
isChecked
&&
policy
.
policy
==
Policy
.
ALLOW
))
{
policy
.
policy
=
isChecked
?
Policy
.
ALLOW
:
Policy
.
DENY
;
String
message
=
v
.
getContext
().
getString
(
isChecked
?
R
.
string
.
su_snack_grant
:
R
.
string
.
su_snack_deny
,
policy
.
appName
);
SnackbarMaker
.
make
(
holder
.
itemView
,
message
,
Snackbar
.
LENGTH_SHORT
).
show
();
dbHelper
.
updatePolicy
(
policy
);
holder
.
notificationSwitch
.
setOnCheckedChangeListener
(
null
);
holder
.
loggingSwitch
.
setOnCheckedChangeListener
(
null
);
holder
.
masterSwitch
.
setChecked
(
policy
.
policy
==
Policy
.
ALLOW
);
holder
.
notificationSwitch
.
setChecked
(
policy
.
notification
);
holder
.
loggingSwitch
.
setChecked
(
policy
.
logging
);
holder
.
masterSwitch
.
setOnClickListener
(
v
->
{
boolean
isChecked
=
holder
.
masterSwitch
.
isChecked
();
Runnable
r
=
()
->
{
if
((
isChecked
&&
policy
.
policy
==
Policy
.
DENY
)
||
(!
isChecked
&&
policy
.
policy
==
Policy
.
ALLOW
))
{
policy
.
policy
=
isChecked
?
Policy
.
ALLOW
:
Policy
.
DENY
;
String
message
=
v
.
getContext
().
getString
(
isChecked
?
R
.
string
.
su_snack_grant
:
R
.
string
.
su_snack_deny
,
policy
.
appName
);
SnackbarMaker
.
make
(
holder
.
itemView
,
message
,
Snackbar
.
LENGTH_SHORT
).
show
();
dbHelper
.
updatePolicy
(
policy
);
}
};
if
(
Data
.
suFingerprint
)
{
holder
.
masterSwitch
.
setChecked
(!
isChecked
);
FingerprintHelper
.
showAuthDialog
((
Activity
)
v
.
getContext
(),
()
->
{
holder
.
masterSwitch
.
setChecked
(
isChecked
);
r
.
run
();
});
}
else
{
r
.
run
();
}
});
holder
.
notificationSwitch
.
setOnCheckedChangeListener
((
v
,
isChecked
)
->
{
...
...
@@ -106,9 +128,6 @@ public class PolicyAdapter extends RecyclerView.Adapter<PolicyAdapter.ViewHolder
.
setNegativeButton
(
R
.
string
.
no_thanks
,
null
)
.
setCancelable
(
true
)
.
show
());
holder
.
masterSwitch
.
setChecked
(
policy
.
policy
==
Policy
.
ALLOW
);
holder
.
notificationSwitch
.
setChecked
(
policy
.
notification
);
holder
.
loggingSwitch
.
setChecked
(
policy
.
logging
);
// Hide for now
holder
.
moreInfo
.
setVisibility
(
View
.
GONE
);
...
...
app/src/full/java/com/topjohnwu/magisk/utils/FingerprintHelper.java
View file @
58ae596b
...
...
@@ -2,9 +2,7 @@ package com.topjohnwu.magisk.utils;
import
android.annotation.TargetApi
;
import
android.app.Activity
;
import
android.app.Dialog
;
import
android.app.KeyguardManager
;
import
android.content.Context
;
import
android.content.res.Resources
;
import
android.content.res.TypedArray
;
import
android.graphics.Color
;
...
...
@@ -30,8 +28,6 @@ import javax.crypto.Cipher;
import
javax.crypto.KeyGenerator
;
import
javax.crypto.SecretKey
;
import
androidx.preference.SwitchPreference
;
@TargetApi
(
Build
.
VERSION_CODES
.
M
)
public
abstract
class
FingerprintHelper
{
...
...
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