mirror of
https://github.com/topjohnwu/Magisk.git
synced 2025-06-12 05:07:45 +02:00
@ -11,7 +11,6 @@ public class Policy {
|
||||
public static final int DENY = 1;
|
||||
public static final int ALLOW = 2;
|
||||
|
||||
|
||||
public int uid, policy;
|
||||
public long until;
|
||||
public boolean logging = true, notification = true;
|
||||
@ -22,6 +21,7 @@ public class Policy {
|
||||
String[] pkgs = pm.getPackagesForUid(uid);
|
||||
if (pkgs != null && pkgs.length > 0) {
|
||||
info = pm.getPackageInfo(pkgs[0], 0);
|
||||
this.uid = uid;
|
||||
packageName = pkgs[0];
|
||||
appName = info.applicationInfo.loadLabel(pm).toString();
|
||||
} else throw new PackageManager.NameNotFoundException();
|
||||
|
@ -87,11 +87,10 @@ public class SuRequestActivity extends AppCompatActivity implements CallbackHand
|
||||
|
||||
switch (Global.Configs.suResponseType) {
|
||||
case AUTO_DENY:
|
||||
event.trigger();
|
||||
handleAction(Policy.DENY, 0);
|
||||
return;
|
||||
case AUTO_ALLOW:
|
||||
policy.policy = Policy.ALLOW;
|
||||
event.trigger(policy);
|
||||
handleAction(Policy.ALLOW, 0);
|
||||
return;
|
||||
case PROMPT:
|
||||
default:
|
||||
@ -157,9 +156,12 @@ public class SuRequestActivity extends AppCompatActivity implements CallbackHand
|
||||
}
|
||||
|
||||
void handleAction(int action) {
|
||||
handleAction(action, timeoutList[timeout.getSelectedItemPosition()]);
|
||||
}
|
||||
|
||||
void handleAction(int action, int time) {
|
||||
policy.policy = action;
|
||||
event.trigger(policy);
|
||||
int time = timeoutList[timeout.getSelectedItemPosition()];
|
||||
if (time >= 0) {
|
||||
policy.until = time == 0 ? 0 : (System.currentTimeMillis() / 1000 + time * 60);
|
||||
new SuDatabaseHelper(this).addPolicy(policy);
|
||||
|
Reference in New Issue
Block a user