Fix su time limits

This commit is contained in:
topjohnwu 2017-12-22 06:43:55 +08:00
parent f0e4aec0af
commit 0d9527921a
2 changed files with 4 additions and 3 deletions

View File

@ -222,11 +222,11 @@ public class SuDatabaseHelper extends SQLiteOpenHelper {
"(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) {

View File

@ -62,6 +62,7 @@ public class RequestActivity extends Activity {
pm = getPackageManager();
mm = Utils.getMagiskManager(this);
mm.suDB.cleanup();
Intent intent = getIntent();
socketPath = intent.getStringExtra("socket");