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
171ddab3
Commit
171ddab3
authored
Nov 12, 2019
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reorganize code handling su requests
parent
2aee0b0b
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
81 additions
and
146 deletions
+81
-146
MagiskPolicy.kt
...in/java/com/topjohnwu/magisk/model/entity/MagiskPolicy.kt
+2
-2
SuRequestActivity.kt
...va/com/topjohnwu/magisk/ui/surequest/SuRequestActivity.kt
+1
-2
SuRequestViewModel.kt
...a/com/topjohnwu/magisk/ui/surequest/SuRequestViewModel.kt
+71
-132
SuConnector.kt
app/src/main/java/com/topjohnwu/magisk/utils/SuConnector.kt
+7
-10
No files found.
app/src/main/java/com/topjohnwu/magisk/model/entity/MagiskPolicy.kt
View file @
171ddab3
...
@@ -10,8 +10,8 @@ data class MagiskPolicy(
...
@@ -10,8 +10,8 @@ data class MagiskPolicy(
val
uid
:
Int
,
val
uid
:
Int
,
val
packageName
:
String
,
val
packageName
:
String
,
val
appName
:
String
,
val
appName
:
String
,
va
l
policy
:
Int
=
INTERACTIVE
,
va
r
policy
:
Int
=
INTERACTIVE
,
va
l
until
:
Long
=
-
1L
,
va
r
until
:
Long
=
-
1L
,
val
logging
:
Boolean
=
true
,
val
logging
:
Boolean
=
true
,
val
notification
:
Boolean
=
true
,
val
notification
:
Boolean
=
true
,
val
applicationInfo
:
ApplicationInfo
val
applicationInfo
:
ApplicationInfo
...
...
app/src/main/java/com/topjohnwu/magisk/ui/surequest/SuRequestActivity.kt
View file @
171ddab3
...
@@ -8,7 +8,6 @@ import android.view.Window
...
@@ -8,7 +8,6 @@ import android.view.Window
import
com.topjohnwu.magisk.R
import
com.topjohnwu.magisk.R
import
com.topjohnwu.magisk.base.BaseActivity
import
com.topjohnwu.magisk.base.BaseActivity
import
com.topjohnwu.magisk.databinding.ActivityRequestBinding
import
com.topjohnwu.magisk.databinding.ActivityRequestBinding
import
com.topjohnwu.magisk.model.entity.MagiskPolicy
import
com.topjohnwu.magisk.model.events.DieEvent
import
com.topjohnwu.magisk.model.events.DieEvent
import
com.topjohnwu.magisk.model.events.ViewEvent
import
com.topjohnwu.magisk.model.events.ViewEvent
import
com.topjohnwu.magisk.utils.SuHandler
import
com.topjohnwu.magisk.utils.SuHandler
...
@@ -22,7 +21,7 @@ open class SuRequestActivity : BaseActivity<SuRequestViewModel, ActivityRequestB
...
@@ -22,7 +21,7 @@ open class SuRequestActivity : BaseActivity<SuRequestViewModel, ActivityRequestB
override
val
viewModel
:
SuRequestViewModel
by
viewModel
()
override
val
viewModel
:
SuRequestViewModel
by
viewModel
()
override
fun
onBackPressed
()
{
override
fun
onBackPressed
()
{
viewModel
.
handler
?.
handleAction
(
MagiskPolicy
.
DENY
,
-
1
)
viewModel
.
denyPressed
(
)
}
}
override
fun
onCreate
(
savedInstanceState
:
Bundle
?)
{
override
fun
onCreate
(
savedInstanceState
:
Bundle
?)
{
...
...
app/src/main/java/com/topjohnwu/magisk/ui/surequest/SuRequestViewModel.kt
View file @
171ddab3
This diff is collapsed.
Click to expand it.
app/src/main/java/com/topjohnwu/magisk/utils/SuConnector.kt
View file @
171ddab3
...
@@ -2,11 +2,9 @@ package com.topjohnwu.magisk.utils
...
@@ -2,11 +2,9 @@ package com.topjohnwu.magisk.utils
import
android.net.LocalSocket
import
android.net.LocalSocket
import
android.net.LocalSocketAddress
import
android.net.LocalSocketAddress
import
android.os.Bundle
import
androidx.collection.ArrayMap
import
android.text.TextUtils
import
timber.log.Timber
import
timber.log.Timber
import
java.io.*
import
java.io.*
import
java.nio.charset.Charset
abstract
class
SuConnector
@Throws
(
IOException
::
class
)
abstract
class
SuConnector
@Throws
(
IOException
::
class
)
protected
constructor
(
name
:
String
)
{
protected
constructor
(
name
:
String
)
{
...
@@ -21,24 +19,23 @@ protected constructor(name: String) {
...
@@ -21,24 +19,23 @@ protected constructor(name: String) {
input
=
DataInputStream
(
BufferedInputStream
(
socket
.
inputStream
))
input
=
DataInputStream
(
BufferedInputStream
(
socket
.
inputStream
))
}
}
@Throws
(
IOException
::
class
)
private
fun
readString
():
String
{
private
fun
readString
():
String
{
val
len
=
input
.
readInt
()
val
len
=
input
.
readInt
()
val
buf
=
ByteArray
(
len
)
val
buf
=
ByteArray
(
len
)
input
.
readFully
(
buf
)
input
.
readFully
(
buf
)
return
String
(
buf
,
Charset
.
forName
(
"UTF-8"
)
)
return
String
(
buf
,
Charset
s
.
UTF_8
)
}
}
@Throws
(
IOException
::
class
)
@Throws
(
IOException
::
class
)
fun
read
SocketInput
():
Bundle
{
fun
read
Request
():
Map
<
String
,
String
>
{
val
bundle
=
Bundle
()
val
ret
=
ArrayMap
<
String
,
String
>
()
while
(
true
)
{
while
(
true
)
{
val
name
=
readString
()
val
name
=
readString
()
if
(
TextUtils
.
equals
(
name
,
"eof"
)
)
if
(
name
==
"eof"
)
break
break
bundle
.
putString
(
name
,
readString
()
)
ret
[
name
]
=
readString
(
)
}
}
return
bundle
return
ret
}
}
fun
response
()
{
fun
response
()
{
...
...
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