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
84f0ff2f
Commit
84f0ff2f
authored
Aug 12, 2019
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix manager package name database management
parent
e6561e5f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
16 deletions
+19
-16
DBConfig.kt
...ain/java/com/topjohnwu/magisk/data/repository/DBConfig.kt
+18
-13
SplashActivity.kt
app/src/main/java/com/topjohnwu/magisk/ui/SplashActivity.kt
+1
-3
No files found.
app/src/main/java/com/topjohnwu/magisk/data/repository/DBConfig.kt
View file @
84f0ff2f
...
@@ -2,7 +2,6 @@ package com.topjohnwu.magisk.data.repository
...
@@ -2,7 +2,6 @@ package com.topjohnwu.magisk.data.repository
import
com.topjohnwu.magisk.data.database.SettingsDao
import
com.topjohnwu.magisk.data.database.SettingsDao
import
com.topjohnwu.magisk.data.database.StringDao
import
com.topjohnwu.magisk.data.database.StringDao
import
com.topjohnwu.magisk.extensions.trimEmptyToNull
import
io.reactivex.schedulers.Schedulers
import
io.reactivex.schedulers.Schedulers
import
kotlin.properties.ReadWriteProperty
import
kotlin.properties.ReadWriteProperty
import
kotlin.reflect.KProperty
import
kotlin.reflect.KProperty
...
@@ -36,12 +35,10 @@ class DBSettingsValue(
...
@@ -36,12 +35,10 @@ class DBSettingsValue(
private
var
value
:
Int
?
=
null
private
var
value
:
Int
?
=
null
private
fun
getKey
(
property
:
KProperty
<
*
>)
=
name
.
trimEmptyToNull
()
?:
property
.
name
@Synchronized
@Synchronized
override
fun
getValue
(
thisRef
:
DBConfig
,
property
:
KProperty
<
*
>):
Int
{
override
fun
getValue
(
thisRef
:
DBConfig
,
property
:
KProperty
<
*
>):
Int
{
if
(
value
==
null
)
if
(
value
==
null
)
value
=
thisRef
.
settingsDao
.
fetch
(
getKey
(
property
)
,
default
).
blockingGet
()
value
=
thisRef
.
settingsDao
.
fetch
(
name
,
default
).
blockingGet
()
return
value
!!
return
value
!!
}
}
...
@@ -49,7 +46,7 @@ class DBSettingsValue(
...
@@ -49,7 +46,7 @@ class DBSettingsValue(
synchronized
(
this
)
{
synchronized
(
this
)
{
this
.
value
=
value
this
.
value
=
value
}
}
thisRef
.
settingsDao
.
put
(
getKey
(
property
)
,
value
)
thisRef
.
settingsDao
.
put
(
name
,
value
)
.
subscribeOn
(
Schedulers
.
io
())
.
subscribeOn
(
Schedulers
.
io
())
.
subscribe
()
.
subscribe
()
}
}
...
@@ -77,12 +74,10 @@ class DBStringsValue(
...
@@ -77,12 +74,10 @@ class DBStringsValue(
private
var
value
:
String
?
=
null
private
var
value
:
String
?
=
null
private
fun
getKey
(
property
:
KProperty
<
*
>)
=
name
.
trimEmptyToNull
()
?:
property
.
name
@Synchronized
@Synchronized
override
fun
getValue
(
thisRef
:
DBConfig
,
property
:
KProperty
<
*
>):
String
{
override
fun
getValue
(
thisRef
:
DBConfig
,
property
:
KProperty
<
*
>):
String
{
if
(
value
==
null
)
if
(
value
==
null
)
value
=
thisRef
.
stringDao
.
fetch
(
getKey
(
property
)
,
default
).
blockingGet
()
value
=
thisRef
.
stringDao
.
fetch
(
name
,
default
).
blockingGet
()
return
value
!!
return
value
!!
}
}
...
@@ -90,12 +85,22 @@ class DBStringsValue(
...
@@ -90,12 +85,22 @@ class DBStringsValue(
synchronized
(
this
)
{
synchronized
(
this
)
{
this
.
value
=
value
this
.
value
=
value
}
}
if
(
sync
)
{
if
(
value
.
isEmpty
())
{
thisRef
.
stringDao
.
put
(
getKey
(
property
),
value
).
blockingAwait
()
if
(
sync
)
{
thisRef
.
stringDao
.
delete
(
name
).
blockingAwait
()
}
else
{
thisRef
.
stringDao
.
delete
(
name
)
.
subscribeOn
(
Schedulers
.
io
())
.
subscribe
()
}
}
else
{
}
else
{
thisRef
.
stringDao
.
put
(
getKey
(
property
),
value
)
if
(
sync
)
{
.
subscribeOn
(
Schedulers
.
io
())
thisRef
.
stringDao
.
put
(
name
,
value
).
blockingAwait
()
.
subscribe
()
}
else
{
thisRef
.
stringDao
.
put
(
name
,
value
)
.
subscribeOn
(
Schedulers
.
io
())
.
subscribe
()
}
}
}
}
}
}
}
app/src/main/java/com/topjohnwu/magisk/ui/SplashActivity.kt
View file @
84f0ff2f
...
@@ -6,12 +6,10 @@ import android.text.TextUtils
...
@@ -6,12 +6,10 @@ import android.text.TextUtils
import
androidx.appcompat.app.AlertDialog
import
androidx.appcompat.app.AlertDialog
import
androidx.appcompat.app.AppCompatActivity
import
androidx.appcompat.app.AppCompatActivity
import
com.topjohnwu.magisk.*
import
com.topjohnwu.magisk.*
import
com.topjohnwu.magisk.data.database.SettingsDao
import
com.topjohnwu.magisk.utils.Utils
import
com.topjohnwu.magisk.utils.Utils
import
com.topjohnwu.magisk.view.Notifications
import
com.topjohnwu.magisk.view.Notifications
import
com.topjohnwu.magisk.view.Shortcuts
import
com.topjohnwu.magisk.view.Shortcuts
import
com.topjohnwu.superuser.Shell
import
com.topjohnwu.superuser.Shell
import
org.koin.android.ext.android.get
open
class
SplashActivity
:
AppCompatActivity
()
{
open
class
SplashActivity
:
AppCompatActivity
()
{
...
@@ -35,7 +33,7 @@ open class SplashActivity : AppCompatActivity() {
...
@@ -35,7 +33,7 @@ open class SplashActivity : AppCompatActivity() {
private
fun
initAndStart
()
{
private
fun
initAndStart
()
{
val
pkg
=
Config
.
suManager
val
pkg
=
Config
.
suManager
if
(
Config
.
suManager
.
isNotEmpty
()
&&
packageName
==
BuildConfig
.
APPLICATION_ID
)
{
if
(
Config
.
suManager
.
isNotEmpty
()
&&
packageName
==
BuildConfig
.
APPLICATION_ID
)
{
get
<
SettingsDao
>().
delete
(
Config
.
Key
.
SU_MANAGER
)
Config
.
suManager
=
""
Shell
.
su
(
"pm uninstall $pkg"
).
submit
()
Shell
.
su
(
"pm uninstall $pkg"
).
submit
()
}
}
if
(
TextUtils
.
equals
(
pkg
,
packageName
))
{
if
(
TextUtils
.
equals
(
pkg
,
packageName
))
{
...
...
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