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
cec017b7
Commit
cec017b7
authored
Jun 07, 2019
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More MagidkDB fixes
parent
3123cc10
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
35 deletions
+10
-35
MagiskQueryBuilder.kt
...topjohnwu/magisk/data/database/base/MagiskQueryBuilder.kt
+5
-1
MagiskLog.kt
.../main/java/com/topjohnwu/magisk/model/entity/MagiskLog.kt
+2
-3
MagiskPolicy.kt
...in/java/com/topjohnwu/magisk/model/entity/MagiskPolicy.kt
+3
-31
No files found.
app/src/main/java/com/topjohnwu/magisk/data/database/base/MagiskQueryBuilder.kt
View file @
cec017b7
...
@@ -75,7 +75,11 @@ open class Insert : MagiskQueryBuilder {
...
@@ -75,7 +75,11 @@ open class Insert : MagiskQueryBuilder {
private
val
keys
get
()
=
_values
.
keys
.
joinToString
(
","
)
private
val
keys
get
()
=
_values
.
keys
.
joinToString
(
","
)
private
val
values
get
()
=
_values
.
values
.
joinToString
(
","
)
{
private
val
values
get
()
=
_values
.
values
.
joinToString
(
","
)
{
if
(
it
is
String
)
"\"$it\""
else
it
.
toString
()
when
(
it
)
{
is
Boolean
->
if
(
it
)
"1"
else
"0"
is
Number
->
it
.
toString
()
else
->
"\"$it\""
}
}
}
private
var
_values
:
Map
<
String
,
Any
>
=
mapOf
()
private
var
_values
:
Map
<
String
,
Any
>
=
mapOf
()
...
...
app/src/main/java/com/topjohnwu/magisk/model/entity/MagiskLog.kt
View file @
cec017b7
...
@@ -38,7 +38,6 @@ fun Map<String, String>.toLog(): MagiskLog {
...
@@ -38,7 +38,6 @@ fun Map<String, String>.toLog(): MagiskLog {
fun
Long
.
toDate
()
=
Date
(
this
)
fun
Long
.
toDate
()
=
Date
(
this
)
fun
MagiskLog
.
toMap
()
=
mapOf
(
fun
MagiskLog
.
toMap
()
=
mapOf
(
"from_uid"
to
fromUid
,
"from_uid"
to
fromUid
,
"to_uid"
to
toUid
,
"to_uid"
to
toUid
,
...
@@ -47,8 +46,8 @@ fun MagiskLog.toMap() = mapOf(
...
@@ -47,8 +46,8 @@ fun MagiskLog.toMap() = mapOf(
"app_name"
to
appName
,
"app_name"
to
appName
,
"command"
to
command
,
"command"
to
command
,
"action"
to
action
,
"action"
to
action
,
"time"
to
date
"time"
to
date
.
time
)
.
mapValues
{
it
.
toString
()
}
)
fun
MagiskPolicy
.
toLog
(
fun
MagiskPolicy
.
toLog
(
toUid
:
Int
,
toUid
:
Int
,
...
...
app/src/main/java/com/topjohnwu/magisk/model/entity/MagiskPolicy.kt
View file @
cec017b7
...
@@ -24,42 +24,14 @@ data class MagiskPolicy(
...
@@ -24,42 +24,14 @@ data class MagiskPolicy(
}
}
/*@Throws(PackageManager.NameNotFoundException::class)
fun ContentValues.toPolicy(pm: PackageManager): MagiskPolicy {
val uid = getAsInteger("uid")
val packageName = getAsString("package_name")
val info = pm.getApplicationInfo(packageName, 0)
if (info.uid != uid)
throw PackageManager.NameNotFoundException()
return MagiskPolicy(
uid = uid,
packageName = packageName,
policy = getAsInteger("policy"),
until = getAsInteger("until").toLong(),
logging = getAsInteger("logging") != 0,
notification = getAsInteger("notification") != 0,
applicationInfo = info,
appName = info.loadLabel(pm).toString()
)
}
fun MagiskPolicy.toContentValues() = ContentValues().apply {
put("uid", uid)
put("uid", uid)
put("package_name", packageName)
put("policy", policy)
put("until", until)
put("logging", if (logging) 1 else 0)
put("notification", if (notification) 1 else 0)
}*/
fun
MagiskPolicy
.
toMap
()
=
mapOf
(
fun
MagiskPolicy
.
toMap
()
=
mapOf
(
"uid"
to
uid
,
"uid"
to
uid
,
"package_name"
to
packageName
,
"package_name"
to
packageName
,
"policy"
to
policy
,
"policy"
to
policy
,
"until"
to
until
,
"until"
to
until
,
"logging"
to
if
(
logging
)
1
else
0
,
"logging"
to
logging
,
"notification"
to
if
(
notification
)
1
else
0
"notification"
to
notification
)
.
mapValues
{
it
.
value
.
toString
()
}
)
@Throws
(
PackageManager
.
NameNotFoundException
::
class
)
@Throws
(
PackageManager
.
NameNotFoundException
::
class
)
fun
Map
<
String
,
String
>.
toPolicy
(
pm
:
PackageManager
):
MagiskPolicy
{
fun
Map
<
String
,
String
>.
toPolicy
(
pm
:
PackageManager
):
MagiskPolicy
{
...
...
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