mirror of
https://github.com/M66B/NetGuard.git
synced 2025-02-24 07:10:50 +00:00
parent
c36ff9e420
commit
207ccecd99
3 changed files with 8 additions and 3 deletions
|
@ -612,7 +612,7 @@ public class AdapterRule extends RecyclerView.Adapter<AdapterRule.ViewHolder> im
|
|||
Util.areYouSure(view.getContext(), R.string.msg_reset_access, new Util.DoubtListener() {
|
||||
@Override
|
||||
public void onSure() {
|
||||
DatabaseHelper.getInstance(context).clearAccess(rule.info.applicationInfo.uid);
|
||||
DatabaseHelper.getInstance(context).clearAccess(rule.info.applicationInfo.uid, true);
|
||||
if (rv != null)
|
||||
rv.scrollToPosition(position);
|
||||
}
|
||||
|
|
|
@ -619,7 +619,7 @@ public class DatabaseHelper extends SQLiteOpenHelper {
|
|||
notifyAccessChanged();
|
||||
}
|
||||
|
||||
public void clearAccess(int uid) {
|
||||
public void clearAccess(int uid, boolean keeprules) {
|
||||
mLock.writeLock().lock();
|
||||
try {
|
||||
SQLiteDatabase db = this.getWritableDatabase();
|
||||
|
@ -627,7 +627,10 @@ public class DatabaseHelper extends SQLiteOpenHelper {
|
|||
try {
|
||||
// There is a segmented index on uid
|
||||
// There is an index on block
|
||||
db.delete("access", "uid = ? AND block < 0", new String[]{Integer.toString(uid)});
|
||||
if (keeprules)
|
||||
db.delete("access", "uid = ? AND block < 0", new String[]{Integer.toString(uid)});
|
||||
else
|
||||
db.delete("access", "uid = ?", new String[]{Integer.toString(uid)});
|
||||
|
||||
db.setTransactionSuccessful();
|
||||
} finally {
|
||||
|
|
|
@ -74,6 +74,8 @@ public class Receiver extends BroadcastReceiver {
|
|||
|
||||
int uid = intent.getIntExtra(Intent.EXTRA_UID, 0);
|
||||
if (uid > 0) {
|
||||
DatabaseHelper.getInstance(context).clearAccess(uid, false);
|
||||
|
||||
NotificationManagerCompat.from(context).cancel(uid); // installed notification
|
||||
NotificationManagerCompat.from(context).cancel(uid + 10000); // access notification
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue