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
48395ba8
Commit
48395ba8
authored
Aug 08, 2019
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove unused files
parent
5ba5f5f9
Hide whitespace changes
Inline
Side-by-side
Showing
22 changed files
with
29 additions
and
269 deletions
+29
-269
proguard-rules.pro
app/proguard-rules.pro
+0
-3
ApplicationModule.kt
...rc/main/java/com/topjohnwu/magisk/di/ApplicationModule.kt
+4
-0
MiscModule.kt
app/src/main/java/com/topjohnwu/magisk/di/MiscModule.kt
+0
-10
Modules.kt
app/src/main/java/com/topjohnwu/magisk/di/Modules.kt
+1
-2
NamedInjection.kt
app/src/main/java/com/topjohnwu/magisk/di/NamedInjection.kt
+0
-6
Policy.java
...c/main/java/com/topjohnwu/magisk/model/entity/Policy.java
+0
-61
PolicyRvItem.kt
...om/topjohnwu/magisk/model/entity/recycler/PolicyRvItem.kt
+2
-3
ViewEvents.kt
...main/java/com/topjohnwu/magisk/model/events/ViewEvents.kt
+0
-2
InstallerHelper.kt
...c/main/java/com/topjohnwu/magisk/tasks/InstallerHelper.kt
+0
-18
HomeViewModel.kt
...c/main/java/com/topjohnwu/magisk/ui/home/HomeViewModel.kt
+11
-0
MagiskItem.kt
app/src/main/java/com/topjohnwu/magisk/ui/home/MagiskItem.kt
+0
-6
MagiskState.kt
...src/main/java/com/topjohnwu/magisk/ui/home/MagiskState.kt
+0
-6
SafetyNetState.kt
.../main/java/com/topjohnwu/magisk/ui/home/SafetyNetState.kt
+0
-5
SuperuserViewModel.kt
...a/com/topjohnwu/magisk/ui/superuser/SuperuserViewModel.kt
+1
-2
SuRequestActivity.kt
...va/com/topjohnwu/magisk/ui/surequest/SuRequestActivity.kt
+2
-2
SuRequestViewModel.kt
...a/com/topjohnwu/magisk/ui/surequest/SuRequestViewModel.kt
+7
-8
Logger.java
app/src/main/java/com/topjohnwu/magisk/utils/Logger.java
+0
-26
RootUtils.kt
app/src/main/java/com/topjohnwu/magisk/utils/RootUtils.kt
+0
-1
SuLogger.kt
app/src/main/java/com/topjohnwu/magisk/utils/SuLogger.kt
+1
-3
ValueSortedMap.java
.../main/java/com/topjohnwu/magisk/utils/ValueSortedMap.java
+0
-43
Annotations.kt
...in/java/com/topjohnwu/magisk/utils/feature/Annotations.kt
+0
-16
SnackbarMaker.kt
app/src/main/java/com/topjohnwu/magisk/view/SnackbarMaker.kt
+0
-46
No files found.
app/proguard-rules.pro
View file @
48395ba8
...
@@ -36,9 +36,6 @@
...
@@ -36,9 +36,6 @@
# Strip logging
# Strip logging
-
assumenosideeffects
class
timber
.
log
.
Timber
.
Tree
{
*
;
}
-
assumenosideeffects
class
timber
.
log
.
Timber
.
Tree
{
*
;
}
-
assumenosideeffects
class
com
.
topjohnwu
.
magisk
.
utils
.
Logger
{
public
***
debug
(...);
}
# Excessive obfuscation
# Excessive obfuscation
-
repackageclasses
'a'
-
repackageclasses
'a'
...
...
app/src/main/java/com/topjohnwu/magisk/di/ApplicationModule.kt
View file @
48395ba8
...
@@ -8,8 +8,12 @@ import android.os.Bundle
...
@@ -8,8 +8,12 @@ import android.os.Bundle
import
androidx.preference.PreferenceManager
import
androidx.preference.PreferenceManager
import
com.skoumal.teanity.rxbus.RxBus
import
com.skoumal.teanity.rxbus.RxBus
import
com.topjohnwu.magisk.App
import
com.topjohnwu.magisk.App
import
org.koin.core.qualifier.named
import
org.koin.dsl.module
import
org.koin.dsl.module
val
SUTimeout
=
named
(
"su_timeout"
)
val
Protected
=
named
(
"protected"
)
val
applicationModule
=
module
{
val
applicationModule
=
module
{
single
{
RxBus
()
}
single
{
RxBus
()
}
factory
{
get
<
Context
>().
resources
}
factory
{
get
<
Context
>().
resources
}
...
...
app/src/main/java/com/topjohnwu/magisk/di/MiscModule.kt
deleted
100644 → 0
View file @
5ba5f5f9
package
com.topjohnwu.magisk.di
import
org.koin.dsl.module
val
miscModule
=
module
{
// define miscs here
}
app/src/main/java/com/topjohnwu/magisk/di/Modules.kt
View file @
48395ba8
...
@@ -5,6 +5,5 @@ val koinModules = listOf(
...
@@ -5,6 +5,5 @@ val koinModules = listOf(
networkingModule
,
networkingModule
,
databaseModule
,
databaseModule
,
repositoryModule
,
repositoryModule
,
viewModelModules
,
viewModelModules
miscModule
)
)
app/src/main/java/com/topjohnwu/magisk/di/NamedInjection.kt
deleted
100644 → 0
View file @
5ba5f5f9
package
com.topjohnwu.magisk.di
import
org.koin.core.qualifier.named
val
SUTimeout
=
named
(
"su_timeout"
)
val
Protected
=
named
(
"protected"
)
\ No newline at end of file
app/src/main/java/com/topjohnwu/magisk/model/entity/Policy.java
deleted
100644 → 0
View file @
5ba5f5f9
package
com
.
topjohnwu
.
magisk
.
model
.
entity
;
import
android.content.ContentValues
;
import
android.content.pm.ApplicationInfo
;
import
android.content.pm.PackageManager
;
import
androidx.annotation.NonNull
;
import
com.topjohnwu.magisk.utils.Utils
;
public
class
Policy
implements
Comparable
<
Policy
>{
public
static
final
int
INTERACTIVE
=
0
;
public
static
final
int
DENY
=
1
;
public
static
final
int
ALLOW
=
2
;
public
int
uid
,
policy
=
INTERACTIVE
;
public
long
until
;
public
boolean
logging
=
true
,
notification
=
true
;
public
String
packageName
,
appName
;
public
ApplicationInfo
info
;
public
Policy
(
int
uid
,
PackageManager
pm
)
throws
PackageManager
.
NameNotFoundException
{
String
[]
pkgs
=
pm
.
getPackagesForUid
(
uid
);
if
(
pkgs
==
null
||
pkgs
.
length
==
0
)
throw
new
PackageManager
.
NameNotFoundException
();
this
.
uid
=
uid
;
packageName
=
pkgs
[
0
];
info
=
pm
.
getApplicationInfo
(
packageName
,
0
);
appName
=
Utils
.
INSTANCE
.
getAppLabel
(
info
,
pm
);
}
public
Policy
(
ContentValues
values
,
PackageManager
pm
)
throws
PackageManager
.
NameNotFoundException
{
uid
=
values
.
getAsInteger
(
"uid"
);
packageName
=
values
.
getAsString
(
"package_name"
);
policy
=
values
.
getAsInteger
(
"policy"
);
until
=
values
.
getAsInteger
(
"until"
);
logging
=
values
.
getAsInteger
(
"logging"
)
!=
0
;
notification
=
values
.
getAsInteger
(
"notification"
)
!=
0
;
info
=
pm
.
getApplicationInfo
(
packageName
,
0
);
if
(
info
.
uid
!=
uid
)
throw
new
PackageManager
.
NameNotFoundException
();
appName
=
info
.
loadLabel
(
pm
).
toString
();
}
public
ContentValues
getContentValues
()
{
ContentValues
values
=
new
ContentValues
();
values
.
put
(
"uid"
,
uid
);
values
.
put
(
"package_name"
,
packageName
);
values
.
put
(
"policy"
,
policy
);
values
.
put
(
"until"
,
until
);
values
.
put
(
"logging"
,
logging
?
1
:
0
);
values
.
put
(
"notification"
,
notification
?
1
:
0
);
return
values
;
}
@Override
public
int
compareTo
(
@NonNull
Policy
policy
)
{
return
appName
.
toLowerCase
().
compareTo
(
policy
.
appName
.
toLowerCase
());
}
}
app/src/main/java/com/topjohnwu/magisk/model/entity/recycler/PolicyRvItem.kt
View file @
48395ba8
...
@@ -9,7 +9,6 @@ import com.topjohnwu.magisk.R
...
@@ -9,7 +9,6 @@ import com.topjohnwu.magisk.R
import
com.topjohnwu.magisk.extensions.inject
import
com.topjohnwu.magisk.extensions.inject
import
com.topjohnwu.magisk.extensions.toggle
import
com.topjohnwu.magisk.extensions.toggle
import
com.topjohnwu.magisk.model.entity.MagiskPolicy
import
com.topjohnwu.magisk.model.entity.MagiskPolicy
import
com.topjohnwu.magisk.model.entity.Policy
import
com.topjohnwu.magisk.model.events.PolicyEnableEvent
import
com.topjohnwu.magisk.model.events.PolicyEnableEvent
import
com.topjohnwu.magisk.model.events.PolicyUpdateEvent
import
com.topjohnwu.magisk.model.events.PolicyUpdateEvent
...
@@ -18,7 +17,7 @@ class PolicyRvItem(val item: MagiskPolicy, val icon: Drawable) : ComparableRvIte
...
@@ -18,7 +17,7 @@ class PolicyRvItem(val item: MagiskPolicy, val icon: Drawable) : ComparableRvIte
override
val
layoutRes
:
Int
=
R
.
layout
.
item_policy
override
val
layoutRes
:
Int
=
R
.
layout
.
item_policy
val
isExpanded
=
KObservableField
(
false
)
val
isExpanded
=
KObservableField
(
false
)
val
isEnabled
=
KObservableField
(
item
.
policy
==
Policy
.
ALLOW
)
val
isEnabled
=
KObservableField
(
item
.
policy
==
Magisk
Policy
.
ALLOW
)
val
shouldNotify
=
KObservableField
(
item
.
notification
)
val
shouldNotify
=
KObservableField
(
item
.
notification
)
val
shouldLog
=
KObservableField
(
item
.
logging
)
val
shouldLog
=
KObservableField
(
item
.
logging
)
...
@@ -28,7 +27,7 @@ class PolicyRvItem(val item: MagiskPolicy, val icon: Drawable) : ComparableRvIte
...
@@ -28,7 +27,7 @@ class PolicyRvItem(val item: MagiskPolicy, val icon: Drawable) : ComparableRvIte
private
val
currentStateItem
private
val
currentStateItem
get
()
=
item
.
copy
(
get
()
=
item
.
copy
(
policy
=
if
(
isEnabled
.
value
)
Policy
.
ALLOW
else
Policy
.
DENY
,
policy
=
if
(
isEnabled
.
value
)
MagiskPolicy
.
ALLOW
else
Magisk
Policy
.
DENY
,
notification
=
shouldNotify
.
value
,
notification
=
shouldNotify
.
value
,
logging
=
shouldLog
.
value
logging
=
shouldLog
.
value
)
)
...
...
app/src/main/java/com/topjohnwu/magisk/model/events/ViewEvents.kt
View file @
48395ba8
...
@@ -2,7 +2,6 @@ package com.topjohnwu.magisk.model.events
...
@@ -2,7 +2,6 @@ package com.topjohnwu.magisk.model.events
import
android.app.Activity
import
android.app.Activity
import
com.skoumal.teanity.viewevents.ViewEvent
import
com.skoumal.teanity.viewevents.ViewEvent
import
com.topjohnwu.magisk.model.entity.Policy
import
com.topjohnwu.magisk.model.entity.module.Repo
import
com.topjohnwu.magisk.model.entity.module.Repo
import
io.reactivex.subjects.PublishSubject
import
io.reactivex.subjects.PublishSubject
...
@@ -36,5 +35,4 @@ class PermissionEvent(
...
@@ -36,5 +35,4 @@ class PermissionEvent(
class
BackPressEvent
:
ViewEvent
()
class
BackPressEvent
:
ViewEvent
()
class
SuDialogEvent
(
val
policy
:
Policy
)
:
ViewEvent
()
class
DieEvent
:
ViewEvent
()
class
DieEvent
:
ViewEvent
()
\ No newline at end of file
app/src/main/java/com/topjohnwu/magisk/tasks/InstallerHelper.kt
deleted
100644 → 0
View file @
5ba5f5f9
package
com.topjohnwu.magisk.tasks
import
android.content.Context
import
android.net.Uri
import
com.topjohnwu.magisk.extensions.get
import
com.topjohnwu.magisk.extensions.readUri
import
java.io.File
object
InstallerHelper
{
@JvmStatic
fun
copyFileTo
(
uri
:
Uri
,
zip
:
File
)
{
zip
.
deleteRecursively
()
get
<
Context
>().
readUri
(
uri
).
use
{
input
->
zip
.
outputStream
().
use
{
out
->
input
.
copyTo
(
out
)
}
}
}
}
\ No newline at end of file
app/src/main/java/com/topjohnwu/magisk/ui/home/HomeViewModel.kt
View file @
48395ba8
...
@@ -15,6 +15,17 @@ import com.topjohnwu.magisk.ui.base.MagiskViewModel
...
@@ -15,6 +15,17 @@ import com.topjohnwu.magisk.ui.base.MagiskViewModel
import
com.topjohnwu.magisk.utils.ISafetyNetHelper
import
com.topjohnwu.magisk.utils.ISafetyNetHelper
import
com.topjohnwu.superuser.Shell
import
com.topjohnwu.superuser.Shell
enum
class
SafetyNetState
{
LOADING
,
PASS
,
FAILED
,
IDLE
}
enum
class
MagiskState
{
NO_ROOT
,
NOT_INSTALLED
,
UP_TO_DATE
,
OBSOLETE
,
LOADING
}
enum
class
MagiskItem
{
MANAGER
,
MAGISK
}
class
HomeViewModel
(
class
HomeViewModel
(
private
val
magiskRepo
:
MagiskRepository
private
val
magiskRepo
:
MagiskRepository
...
...
app/src/main/java/com/topjohnwu/magisk/ui/home/MagiskItem.kt
deleted
100644 → 0
View file @
5ba5f5f9
package
com.topjohnwu.magisk.ui.home
enum
class
MagiskItem
{
MANAGER
,
MAGISK
}
app/src/main/java/com/topjohnwu/magisk/ui/home/MagiskState.kt
deleted
100644 → 0
View file @
5ba5f5f9
package
com.topjohnwu.magisk.ui.home
enum
class
MagiskState
{
NO_ROOT
,
NOT_INSTALLED
,
UP_TO_DATE
,
OBSOLETE
,
LOADING
}
\ No newline at end of file
app/src/main/java/com/topjohnwu/magisk/ui/home/SafetyNetState.kt
deleted
100644 → 0
View file @
5ba5f5f9
package
com.topjohnwu.magisk.ui.home
enum
class
SafetyNetState
{
LOADING
,
PASS
,
FAILED
,
IDLE
}
\ No newline at end of file
app/src/main/java/com/topjohnwu/magisk/ui/superuser/SuperuserViewModel.kt
View file @
48395ba8
...
@@ -13,7 +13,6 @@ import com.topjohnwu.magisk.R
...
@@ -13,7 +13,6 @@ import com.topjohnwu.magisk.R
import
com.topjohnwu.magisk.data.database.PolicyDao
import
com.topjohnwu.magisk.data.database.PolicyDao
import
com.topjohnwu.magisk.extensions.toggle
import
com.topjohnwu.magisk.extensions.toggle
import
com.topjohnwu.magisk.model.entity.MagiskPolicy
import
com.topjohnwu.magisk.model.entity.MagiskPolicy
import
com.topjohnwu.magisk.model.entity.Policy
import
com.topjohnwu.magisk.model.entity.recycler.PolicyRvItem
import
com.topjohnwu.magisk.model.entity.recycler.PolicyRvItem
import
com.topjohnwu.magisk.model.events.PolicyEnableEvent
import
com.topjohnwu.magisk.model.events.PolicyEnableEvent
import
com.topjohnwu.magisk.model.events.PolicyUpdateEvent
import
com.topjohnwu.magisk.model.events.PolicyUpdateEvent
...
@@ -118,7 +117,7 @@ class SuperuserViewModel(
...
@@ -118,7 +117,7 @@ class SuperuserViewModel(
val
app
=
item
.
item
.
copy
(
policy
=
if
(
enable
)
MagiskPolicy
.
ALLOW
else
MagiskPolicy
.
DENY
)
val
app
=
item
.
item
.
copy
(
policy
=
if
(
enable
)
MagiskPolicy
.
ALLOW
else
MagiskPolicy
.
DENY
)
updatePolicy
(
app
)
updatePolicy
(
app
)
.
map
{
it
.
policy
==
Policy
.
ALLOW
}
.
map
{
it
.
policy
==
Magisk
Policy
.
ALLOW
}
.
subscribeK
{
.
subscribeK
{
val
textId
=
if
(
it
)
R
.
string
.
su_snack_grant
else
R
.
string
.
su_snack_deny
val
textId
=
if
(
it
)
R
.
string
.
su_snack_grant
else
R
.
string
.
su_snack_deny
val
text
=
resources
.
getString
(
textId
).
format
(
item
.
item
.
appName
)
val
text
=
resources
.
getString
(
textId
).
format
(
item
.
item
.
appName
)
...
...
app/src/main/java/com/topjohnwu/magisk/ui/surequest/SuRequestActivity.kt
View file @
48395ba8
...
@@ -8,7 +8,7 @@ import android.view.Window
...
@@ -8,7 +8,7 @@ import android.view.Window
import
com.skoumal.teanity.viewevents.ViewEvent
import
com.skoumal.teanity.viewevents.ViewEvent
import
com.topjohnwu.magisk.R
import
com.topjohnwu.magisk.R
import
com.topjohnwu.magisk.databinding.ActivityRequestBinding
import
com.topjohnwu.magisk.databinding.ActivityRequestBinding
import
com.topjohnwu.magisk.model.entity.Policy
import
com.topjohnwu.magisk.model.entity.
Magisk
Policy
import
com.topjohnwu.magisk.model.events.DieEvent
import
com.topjohnwu.magisk.model.events.DieEvent
import
com.topjohnwu.magisk.model.receiver.GeneralReceiver
import
com.topjohnwu.magisk.model.receiver.GeneralReceiver
import
com.topjohnwu.magisk.ui.base.MagiskActivity
import
com.topjohnwu.magisk.ui.base.MagiskActivity
...
@@ -21,7 +21,7 @@ open class SuRequestActivity : MagiskActivity<SuRequestViewModel, ActivityReques
...
@@ -21,7 +21,7 @@ open class SuRequestActivity : MagiskActivity<SuRequestViewModel, ActivityReques
override
val
viewModel
:
SuRequestViewModel
by
viewModel
()
override
val
viewModel
:
SuRequestViewModel
by
viewModel
()
override
fun
onBackPressed
()
{
override
fun
onBackPressed
()
{
viewModel
.
handler
?.
handleAction
(
Policy
.
DENY
,
-
1
)
viewModel
.
handler
?.
handleAction
(
Magisk
Policy
.
DENY
,
-
1
)
}
}
override
fun
onCreate
(
savedInstanceState
:
Bundle
?)
{
override
fun
onCreate
(
savedInstanceState
:
Bundle
?)
{
...
...
app/src/main/java/com/topjohnwu/magisk/ui/surequest/SuRequestViewModel.kt
View file @
48395ba8
...
@@ -19,7 +19,6 @@ import com.topjohnwu.magisk.R
...
@@ -19,7 +19,6 @@ import com.topjohnwu.magisk.R
import
com.topjohnwu.magisk.data.database.PolicyDao
import
com.topjohnwu.magisk.data.database.PolicyDao
import
com.topjohnwu.magisk.extensions.now
import
com.topjohnwu.magisk.extensions.now
import
com.topjohnwu.magisk.model.entity.MagiskPolicy
import
com.topjohnwu.magisk.model.entity.MagiskPolicy
import
com.topjohnwu.magisk.model.entity.Policy
import
com.topjohnwu.magisk.model.entity.recycler.SpinnerRvItem
import
com.topjohnwu.magisk.model.entity.recycler.SpinnerRvItem
import
com.topjohnwu.magisk.model.entity.toPolicy
import
com.topjohnwu.magisk.model.entity.toPolicy
import
com.topjohnwu.magisk.model.events.DieEvent
import
com.topjohnwu.magisk.model.events.DieEvent
...
@@ -94,12 +93,12 @@ class SuRequestViewModel(
...
@@ -94,12 +93,12 @@ class SuRequestViewModel(
}
}
fun
grantPressed
()
{
fun
grantPressed
()
{
handler
?.
handleAction
(
Policy
.
ALLOW
)
handler
?.
handleAction
(
Magisk
Policy
.
ALLOW
)
timer
?.
cancel
()
timer
?.
cancel
()
}
}
fun
denyPressed
()
{
fun
denyPressed
()
{
handler
?.
handleAction
(
Policy
.
DENY
)
handler
?.
handleAction
(
Magisk
Policy
.
DENY
)
timer
?.
cancel
()
timer
?.
cancel
()
}
}
...
@@ -168,18 +167,18 @@ class SuRequestViewModel(
...
@@ -168,18 +167,18 @@ class SuRequestViewModel(
return
false
return
false
// If not interactive, response directly
// If not interactive, response directly
if
(
policy
?.
policy
!=
Policy
.
INTERACTIVE
)
{
if
(
policy
?.
policy
!=
Magisk
Policy
.
INTERACTIVE
)
{
handler
?.
handleAction
()
handler
?.
handleAction
()
return
true
return
true
}
}
when
(
Config
.
suAutoReponse
)
{
when
(
Config
.
suAutoReponse
)
{
Config
.
Value
.
SU_AUTO_DENY
->
{
Config
.
Value
.
SU_AUTO_DENY
->
{
handler
?.
handleAction
(
Policy
.
DENY
,
0
)
handler
?.
handleAction
(
Magisk
Policy
.
DENY
,
0
)
return
true
return
true
}
}
Config
.
Value
.
SU_AUTO_ALLOW
->
{
Config
.
Value
.
SU_AUTO_ALLOW
->
{
handler
?.
handleAction
(
Policy
.
ALLOW
,
0
)
handler
?.
handleAction
(
Magisk
Policy
.
ALLOW
,
0
)
return
true
return
true
}
}
}
}
...
@@ -199,7 +198,7 @@ class SuRequestViewModel(
...
@@ -199,7 +198,7 @@ class SuRequestViewModel(
override
fun
onFinish
()
{
override
fun
onFinish
()
{
denyText
.
value
=
resources
.
getString
(
R
.
string
.
deny
)
denyText
.
value
=
resources
.
getString
(
R
.
string
.
deny
)
handler
?.
handleAction
(
Policy
.
DENY
)
handler
?.
handleAction
(
Magisk
Policy
.
DENY
)
}
}
}
}
timer
?.
start
()
timer
?.
start
()
...
@@ -229,7 +228,7 @@ class SuRequestViewModel(
...
@@ -229,7 +228,7 @@ class SuRequestViewModel(
}
}
override
fun
onAuthenticationSucceeded
(
result
:
FingerprintManager
.
AuthenticationResult
)
{
override
fun
onAuthenticationSucceeded
(
result
:
FingerprintManager
.
AuthenticationResult
)
{
handler
?.
handleAction
(
Policy
.
ALLOW
)
handler
?.
handleAction
(
Magisk
Policy
.
ALLOW
)
}
}
override
fun
onAuthenticationFailed
()
{
override
fun
onAuthenticationFailed
()
{
...
...
app/src/main/java/com/topjohnwu/magisk/utils/Logger.java
deleted
100644 → 0
View file @
5ba5f5f9
package
com
.
topjohnwu
.
magisk
.
utils
;
import
android.util.Log
;
import
com.topjohnwu.magisk.BuildConfig
;
import
com.topjohnwu.magisk.Const
;
public
class
Logger
{
public
static
void
debug
(
String
line
)
{
if
(
BuildConfig
.
DEBUG
)
Log
.
d
(
Const
.
DEBUG_TAG
,
"DEBUG: "
+
line
);
}
public
static
void
debug
(
String
fmt
,
Object
...
args
)
{
debug
(
Utils
.
INSTANCE
.
fmt
(
fmt
,
args
));
}
public
static
void
error
(
String
line
)
{
Log
.
e
(
Const
.
DEBUG_TAG
,
"ERROR: "
+
line
);
}
public
static
void
error
(
String
fmt
,
Object
...
args
)
{
error
(
Utils
.
INSTANCE
.
fmt
(
fmt
,
args
));
}
}
app/src/main/java/com/topjohnwu/magisk/utils/RootUtils.kt
View file @
48395ba8
...
@@ -153,7 +153,6 @@ class RootUtils : Shell.Initializer() {
...
@@ -153,7 +153,6 @@ class RootUtils : Shell.Initializer() {
companion
object
{
companion
object
{
@JvmStatic
fun
rmAndLaunch
(
rm
:
String
,
component
:
ComponentName
)
{
fun
rmAndLaunch
(
rm
:
String
,
component
:
ComponentName
)
{
Shell
.
su
(
"(rm_launch $rm ${component.flattenToString()})"
).
exec
()
Shell
.
su
(
"(rm_launch $rm ${component.flattenToString()})"
).
exec
()
}
}
...
...
app/src/main/java/com/topjohnwu/magisk/utils/SuLogger.kt
View file @
48395ba8
...
@@ -11,7 +11,6 @@ import com.topjohnwu.magisk.data.database.PolicyDao
...
@@ -11,7 +11,6 @@ import com.topjohnwu.magisk.data.database.PolicyDao
import
com.topjohnwu.magisk.data.repository.LogRepository
import
com.topjohnwu.magisk.data.repository.LogRepository
import
com.topjohnwu.magisk.extensions.inject
import
com.topjohnwu.magisk.extensions.inject
import
com.topjohnwu.magisk.model.entity.MagiskPolicy
import
com.topjohnwu.magisk.model.entity.MagiskPolicy
import
com.topjohnwu.magisk.model.entity.Policy
import
com.topjohnwu.magisk.model.entity.toLog
import
com.topjohnwu.magisk.model.entity.toLog
import
com.topjohnwu.magisk.model.entity.toPolicy
import
com.topjohnwu.magisk.model.entity.toPolicy
import
java.util.*
import
java.util.*
...
@@ -20,7 +19,6 @@ object SuLogger {
...
@@ -20,7 +19,6 @@ object SuLogger {
private
val
context
:
Context
by
inject
()
private
val
context
:
Context
by
inject
()
@JvmStatic
fun
handleLogs
(
intent
:
Intent
)
{
fun
handleLogs
(
intent
:
Intent
)
{
val
fromUid
=
intent
.
getIntExtra
(
"from.uid"
,
-
1
)
val
fromUid
=
intent
.
getIntExtra
(
"from.uid"
,
-
1
)
...
@@ -72,7 +70,7 @@ object SuLogger {
...
@@ -72,7 +70,7 @@ object SuLogger {
if
(
policy
.
notification
&&
Config
.
suNotification
==
Config
.
Value
.
NOTIFICATION_TOAST
)
{
if
(
policy
.
notification
&&
Config
.
suNotification
==
Config
.
Value
.
NOTIFICATION_TOAST
)
{
Utils
.
toast
(
Utils
.
toast
(
context
.
getString
(
context
.
getString
(
if
(
policy
.
policy
==
Policy
.
ALLOW
)
if
(
policy
.
policy
==
Magisk
Policy
.
ALLOW
)
R
.
string
.
su_allow_toast
R
.
string
.
su_allow_toast
else
else
R
.
string
.
su_deny_toast
,
policy
.
appName
R
.
string
.
su_deny_toast
,
policy
.
appName
...
...
app/src/main/java/com/topjohnwu/magisk/utils/ValueSortedMap.java
deleted
100644 → 0
View file @
5ba5f5f9
package
com
.
topjohnwu
.
magisk
.
utils
;
import
androidx.annotation.NonNull
;
import
java.util.ArrayList
;
import
java.util.Collection
;
import
java.util.Collections
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
public
class
ValueSortedMap
<
K
,
V
extends
Comparable
<?
super
V
>>
extends
HashMap
<
K
,
V
>
{
private
List
<
V
>
sorted
=
new
ArrayList
<>();
@NonNull
@Override
public
Collection
<
V
>
values
()
{
if
(
sorted
.
isEmpty
())
{
sorted
.
addAll
(
super
.
values
());
Collections
.
sort
(
sorted
);
}
return
sorted
;
}
@Override
public
V
put
(
K
key
,
V
value
)
{
sorted
.
clear
();
return
super
.
put
(
key
,
value
);
}
@Override
public
void
putAll
(
Map
<?
extends
K
,
?
extends
V
>
m
)
{
sorted
.
clear
();
super
.
putAll
(
m
);
}
@Override
public
V
remove
(
Object
key
)
{
sorted
.
clear
();
return
super
.
remove
(
key
);
}
}
app/src/main/java/com/topjohnwu/magisk/utils/feature/Annotations.kt
deleted
100644 → 0
View file @
5ba5f5f9
package
com.topjohnwu.magisk.utils.feature
@Retention
(
AnnotationRetention
.
SOURCE
)
annotation
class
WIP
@Retention
(
AnnotationRetention
.
SOURCE
)
annotation
class
Beta
@Retention
(
AnnotationRetention
.
SOURCE
)
annotation
class
Alpha
@Retention
(
AnnotationRetention
.
SOURCE
)
annotation
class
Unstable
\ No newline at end of file
app/src/main/java/com/topjohnwu/magisk/view/SnackbarMaker.kt
deleted
100644 → 0
View file @
5ba5f5f9
package
com.topjohnwu.magisk.view
import
android.app.Activity
import
android.net.Uri
import
android.view.View
import
android.widget.TextView
import
androidx.annotation.StringRes
import
com.google.android.material.snackbar.Snackbar
import
com.topjohnwu.magisk.R
import
com.topjohnwu.magisk.extensions.fileName
object
SnackbarMaker
{
fun
make
(
activity
:
Activity
,
text
:
CharSequence
,
duration
:
Int
):
Snackbar
{
val
view
=
activity
.
findViewById
<
View
>(
android
.
R
.
id
.
content
)
return
make
(
view
,
text
,
duration
)
}
fun
make
(
activity
:
Activity
,
@StringRes
resId
:
Int
,
duration
:
Int
):
Snackbar
{
return
make
(
activity
,
activity
.
getString
(
resId
),
duration
)
}
fun
make
(
view
:
View
,
text
:
CharSequence
,
duration
:
Int
):
Snackbar
{
val
snack
=
Snackbar
.
make
(
view
,
text
,
duration
)
setup
(
snack
)
return
snack
}
fun
make
(
view
:
View
,
@StringRes
resId
:
Int
,
duration
:
Int
):
Snackbar
{
val
snack
=
Snackbar
.
make
(
view
,
resId
,
duration
)
setup
(
snack
)
return
snack
}
private
fun
setup
(
snack
:
Snackbar
)
{
val
text
=
snack
.
view
.
findViewById
<
TextView
>(
com
.
google
.
android
.
material
.
R
.
id
.
snackbar_text
)
text
.
maxLines
=
Integer
.
MAX_VALUE
}
fun
showUri
(
activity
:
Activity
,
uri
:
Uri
)
{
make
(
activity
,
activity
.
getString
(
R
.
string
.
internal_storage
,
"/Download/"
+
uri
.
fileName
),
Snackbar
.
LENGTH_LONG
)
.
setAction
(
R
.
string
.
ok
)
{
}.
show
()
}
}
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