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
ab199d88
Commit
ab199d88
authored
Jul 23, 2017
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change su logs time granularity
parent
356065d1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
5 deletions
+9
-5
SuDatabaseHelper.java
.../java/com/topjohnwu/magisk/database/SuDatabaseHelper.java
+7
-3
SuLogEntry.java
.../main/java/com/topjohnwu/magisk/superuser/SuLogEntry.java
+2
-2
No files found.
app/src/main/java/com/topjohnwu/magisk/database/SuDatabaseHelper.java
View file @
ab199d88
...
...
@@ -27,7 +27,7 @@ public class SuDatabaseHelper extends SQLiteOpenHelper {
public
static
final
String
MULTIUSER_MODE
=
"multiuser_mode"
;
public
static
final
String
MNT_NS
=
"mnt_ns"
;
private
static
final
int
DATABASE_VER
=
2
;
private
static
final
int
DATABASE_VER
=
3
;
private
static
final
String
POLICY_TABLE
=
"policies"
;
private
static
final
String
LOG_TABLE
=
"logs"
;
private
static
final
String
SETTINGS_TABLE
=
"settings"
;
...
...
@@ -76,6 +76,10 @@ public class SuDatabaseHelper extends SQLiteOpenHelper {
}
++
oldVersion
;
}
if
(
oldVersion
==
2
)
{
db
.
execSQL
(
"UPDATE "
+
LOG_TABLE
+
" SET time=time*1000"
);
++
oldVersion
;
}
}
private
void
createTables
(
SQLiteDatabase
db
)
{
...
...
@@ -104,7 +108,7 @@ public class SuDatabaseHelper extends SQLiteOpenHelper {
new
String
[]
{
String
.
valueOf
(
System
.
currentTimeMillis
()
/
1000
)
});
// Clear outdated logs
mDb
.
delete
(
LOG_TABLE
,
"time < ?"
,
new
String
[]
{
String
.
valueOf
(
System
.
currentTimeMillis
()
/
1000
-
magiskManager
.
suLogTimeout
*
864
00
)
});
System
.
currentTimeMillis
()
-
magiskManager
.
suLogTimeout
*
864000
00
)
});
}
public
void
deletePolicy
(
Policy
policy
)
{
...
...
@@ -189,7 +193,7 @@ public class SuDatabaseHelper extends SQLiteOpenHelper {
List
<
Integer
>
list
=
null
;
String
dateString
=
null
,
newString
;
while
(
c
.
moveToNext
())
{
Date
date
=
new
Date
(
c
.
getLong
(
c
.
getColumnIndex
(
"time"
))
*
1000
);
Date
date
=
new
Date
(
c
.
getLong
(
c
.
getColumnIndex
(
"time"
)));
newString
=
DateFormat
.
getDateInstance
(
DateFormat
.
MEDIUM
,
MagiskManager
.
locale
).
format
(
date
);
if
(!
TextUtils
.
equals
(
dateString
,
newString
))
{
dateString
=
newString
;
...
...
app/src/main/java/com/topjohnwu/magisk/superuser/SuLogEntry.java
View file @
ab199d88
...
...
@@ -30,7 +30,7 @@ public class SuLogEntry {
appName
=
c
.
getString
(
c
.
getColumnIndex
(
"app_name"
));
command
=
c
.
getString
(
c
.
getColumnIndex
(
"command"
));
action
=
c
.
getInt
(
c
.
getColumnIndex
(
"action"
))
!=
0
;
date
=
new
Date
(
c
.
getLong
(
c
.
getColumnIndex
(
"time"
))
*
1000
);
date
=
new
Date
(
c
.
getLong
(
c
.
getColumnIndex
(
"time"
)));
}
public
ContentValues
getContentValues
()
{
...
...
@@ -42,7 +42,7 @@ public class SuLogEntry {
values
.
put
(
"command"
,
command
);
values
.
put
(
"to_uid"
,
toUid
);
values
.
put
(
"action"
,
action
?
1
:
0
);
values
.
put
(
"time"
,
date
.
getTime
()
/
1000
);
values
.
put
(
"time"
,
date
.
getTime
());
return
values
;
}
...
...
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