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
c6b3f06b
Commit
c6b3f06b
authored
Feb 22, 2020
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleanup stuffs
parent
581419b6
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
33 additions
and
84 deletions
+33
-84
build.gradle
app/build.gradle
+1
-1
proguard-kotlin.pro
app/proguard-kotlin.pro
+0
-20
proguard-rules.pro
app/proguard-rules.pro
+9
-0
g.java
app/src/main/java/a/g.java
+0
-15
stubs.kt
app/src/main/java/a/stubs.kt
+0
-29
Hacks.kt
app/src/main/java/com/topjohnwu/magisk/core/Hacks.kt
+0
-1
UpdateCheckService.kt
...main/java/com/topjohnwu/magisk/core/UpdateCheckService.kt
+8
-6
Utils.kt
app/src/main/java/com/topjohnwu/magisk/core/utils/Utils.kt
+15
-12
No files found.
app/build.gradle
View file @
c6b3f06b
...
...
@@ -32,7 +32,7 @@ android {
minifyEnabled
true
shrinkResources
true
proguardFiles
getDefaultProguardFile
(
'proguard-android-optimize.txt'
),
'proguard-rules.pro'
,
'proguard-kotlin.pro'
'proguard-rules.pro'
}
}
...
...
app/proguard-kotlin.pro
deleted
100644 → 0
View file @
581419b6
## So every class is case insensitive to avoid some bizare problems
-
dontusemixedcaseclassnames
## If reflection issues come up uncomment this, that should temporarily fix it
#-keep class kotlin.** { *; }
#-keep class kotlin.Metadata { *; }
#-keepclassmembers class kotlin.Metadata {
# public <methods>;
#}
## Never warn about Kotlin, it should work as-is
-
dontwarn
kotlin
.
**
## Removes runtime null checks - doesn't really matter if it crashes on kotlin or java NPE
-
assumenosideeffects
class
kotlin
.
jvm
.
internal
.
Intrinsics
{
static
void
checkParameterIsNotNull
(
java
.
lang
.
Object
,
java
.
lang
.
String
);
}
## Useless option for dex
-
dontpreverify
\ No newline at end of file
app/proguard-rules.pro
View file @
c6b3f06b
...
...
@@ -16,6 +16,15 @@
# public *;
#}
# Kotlin
-
assumenosideeffects
class
kotlin
.
jvm
.
internal
.
Intrinsics
{
public
static
void
checkExpressionValueIsNotNull
(...);
public
static
void
checkNotNullExpressionValue
(...);
public
static
void
checkReturnedValueIsNotNull
(...);
public
static
void
checkFieldIsNotNull
(...);
public
static
void
checkParameterIsNotNull
(...);
}
# Stubs
-
keep
class
a
.
*
{
*
;
}
...
...
app/src/main/java/a/g.java
deleted
100644 → 0
View file @
581419b6
package
a
;
import
android.content.Context
;
import
androidx.annotation.NonNull
;
import
androidx.work.WorkerParameters
;
import
com.topjohnwu.magisk.core.UpdateCheckService
;
public
class
g
extends
w
<
UpdateCheckService
>
{
/* Stub */
public
g
(
@NonNull
Context
context
,
@NonNull
WorkerParameters
workerParams
)
{
super
(
context
,
workerParams
);
}
}
app/src/main/java/a/stubs.kt
View file @
c6b3f06b
package
a
import
android.content.Context
import
androidx.work.Worker
import
androidx.work.WorkerParameters
import
com.topjohnwu.magisk.core.App
import
com.topjohnwu.magisk.core.GeneralReceiver
import
com.topjohnwu.magisk.core.SplashActivity
import
com.topjohnwu.magisk.core.base.BaseWorkerWrapper
import
com.topjohnwu.magisk.core.download.DownloadService
import
com.topjohnwu.magisk.legacy.flash.FlashActivity
import
com.topjohnwu.magisk.legacy.surequest.SuRequestActivity
import
com.topjohnwu.magisk.ui.MainActivity
import
java.lang.reflect.ParameterizedType
class
b
:
MainActivity
()
...
...
@@ -29,27 +24,3 @@ class h : GeneralReceiver()
class
j
:
DownloadService
()
class
m
:
SuRequestActivity
()
/**
* Wrapper class to workaround Proguard rule :
* -keep class * extends Worker
* */
abstract
class
w
<
T
:
BaseWorkerWrapper
>(
context
:
Context
,
workerParams
:
WorkerParameters
)
:
Worker
(
context
,
workerParams
)
{
private
var
base
:
T
?
=
null
override
fun
doWork
()
=
base
?.
doWork
()
?:
Result
.
failure
()
override
fun
onStopped
()
=
base
?.
onStopped
()
?:
Unit
init
{
try
{
base
=
((
javaClass
.
genericSuperclass
as
ParameterizedType
)
.
actualTypeArguments
[
0
]
as
Class
<
T
>).
newInstance
()
base
?.
attachWorker
(
this
)
}
catch
(
e
:
java
.
lang
.
Exception
)
{}
}
}
app/src/main/java/com/topjohnwu/magisk/core/Hacks.kt
View file @
c6b3f06b
...
...
@@ -147,7 +147,6 @@ object ClassMap {
MainActivity
::
class
.
java
to
a
.
b
::
class
.
java
,
SplashActivity
::
class
.
java
to
a
.
c
::
class
.
java
,
FlashActivity
::
class
.
java
to
a
.
f
::
class
.
java
,
UpdateCheckService
::
class
.
java
to
a
.
g
::
class
.
java
,
GeneralReceiver
::
class
.
java
to
a
.
h
::
class
.
java
,
DownloadService
::
class
.
java
to
a
.
j
::
class
.
java
,
SuRequestActivity
::
class
.
java
to
a
.
m
::
class
.
java
,
...
...
app/src/main/java/com/topjohnwu/magisk/core/UpdateCheckService.kt
View file @
c6b3f06b
package
com.topjohnwu.magisk.core
import
androidx.work.ListenableWorker
import
android.content.Context
import
androidx.work.Worker
import
androidx.work.WorkerParameters
import
com.topjohnwu.magisk.BuildConfig
import
com.topjohnwu.magisk.core.base.BaseWorkerWrapper
import
com.topjohnwu.magisk.core.view.Notifications
import
com.topjohnwu.magisk.data.repository.MagiskRepository
import
com.topjohnwu.magisk.extensions.inject
import
com.topjohnwu.superuser.Shell
class
UpdateCheckService
:
BaseWorkerWrapper
()
{
class
UpdateCheckService
(
context
:
Context
,
workerParams
:
WorkerParameters
)
:
Worker
(
context
,
workerParams
)
{
private
val
magiskRepo
:
MagiskRepository
by
inject
()
override
fun
doWork
():
ListenableWorker
.
Result
{
override
fun
doWork
():
Result
{
// Make sure shell initializer was ran
Shell
.
getShell
()
return
runCatching
{
...
...
@@ -21,9 +23,9 @@ class UpdateCheckService : BaseWorkerWrapper() {
Notifications
.
managerUpdate
(
applicationContext
)
else
if
(
Info
.
env
.
magiskVersionCode
<
Info
.
remote
.
magisk
.
versionCode
)
Notifications
.
magiskUpdate
(
applicationContext
)
ListenableWorker
.
Result
.
success
()
Result
.
success
()
}.
getOrElse
{
ListenableWorker
.
Result
.
failure
()
Result
.
failure
()
}
}
}
app/src/main/java/com/topjohnwu/magisk/core/utils/Utils.kt
View file @
c6b3f06b
...
...
@@ -7,9 +7,11 @@ import android.net.Uri
import
android.os.Environment
import
android.widget.Toast
import
androidx.work.*
import
com.topjohnwu.magisk.BuildConfig
import
com.topjohnwu.magisk.R
import
com.topjohnwu.magisk.core.*
import
com.topjohnwu.magisk.core.Config
import
com.topjohnwu.magisk.core.Const
import
com.topjohnwu.magisk.core.Info
import
com.topjohnwu.magisk.core.UpdateCheckService
import
com.topjohnwu.magisk.extensions.get
import
com.topjohnwu.superuser.internal.UiThreadHandler
import
java.io.File
...
...
@@ -42,12 +44,13 @@ object Utils {
.
setRequiresDeviceIdle
(
true
)
.
build
()
val
request
=
PeriodicWorkRequest
.
Builder
(
ClassMap
[
UpdateCheckService
::
class
.
java
]
as
Class
<
Worker
>
,
12
,
TimeUnit
.
HOURS
)
.
Builder
(
UpdateCheckService
::
class
.
java
,
12
,
TimeUnit
.
HOURS
)
.
setConstraints
(
constraints
)
.
build
()
WorkManager
.
getInstance
(
context
).
enqueueUniquePeriodicWork
(
Const
.
ID
.
CHECK_MAGISK_UPDATE_WORKER_ID
,
ExistingPeriodicWorkPolicy
.
REPLACE
,
request
)
ExistingPeriodicWorkPolicy
.
REPLACE
,
request
)
}
else
{
WorkManager
.
getInstance
(
context
)
.
cancelUniqueWork
(
Const
.
ID
.
CHECK_MAGISK_UPDATE_WORKER_ID
)
...
...
@@ -67,7 +70,7 @@ object Utils {
}
}
fun
ensureDownloadPath
(
path
:
String
)
=
fun
ensureDownloadPath
(
path
:
String
)
=
File
(
Environment
.
getExternalStorageDirectory
(),
path
).
run
{
if
((
exists
()
&&
isDirectory
)
||
mkdirs
())
this
else
null
}
...
...
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