Skip to content

Commit

Permalink
Fix su time limits
Browse files Browse the repository at this point in the history
  • Loading branch information
topjohnwu committed Dec 21, 2017
1 parent f0e4aec commit 0d95279
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -222,11 +222,11 @@ private void createTables(SQLiteDatabase db) {
"(key TEXT, value INT, PRIMARY KEY(key))");
}

private void cleanup() {
public void cleanup() {
// Clear outdated policies
mDb.delete(POLICY_TABLE, Utils.fmt("until > 0 AND until < ?", System.currentTimeMillis() / 1000), null);
mDb.delete(POLICY_TABLE, Utils.fmt("until > 0 AND until < %d", System.currentTimeMillis() / 1000), null);
// Clear outdated logs
mDb.delete(LOG_TABLE, Utils.fmt("time < ?", System.currentTimeMillis() - MagiskManager.get().suLogTimeout * 86400000), null);
mDb.delete(LOG_TABLE, Utils.fmt("time < %d", System.currentTimeMillis() - MagiskManager.get().suLogTimeout * 86400000), null);
}

public void deletePolicy(Policy policy) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ protected void onCreate(Bundle savedInstanceState) {

pm = getPackageManager();
mm = Utils.getMagiskManager(this);
mm.suDB.cleanup();

Intent intent = getIntent();
socketPath = intent.getStringExtra("socket");
Expand Down

0 comments on commit 0d95279

Please sign in to comment.