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
0be158af
Commit
0be158af
authored
Dec 28, 2018
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Official KitKat support
parent
e6942e01
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
22 additions
and
13 deletions
+22
-13
PolicyAdapter.java
...ull/java/com/topjohnwu/magisk/adapters/PolicyAdapter.java
+4
-4
list_item_policy.xml
app/src/full/res/layout/list_item_policy.xml
+3
-3
connect.cpp
native/jni/su/connect.cpp
+14
-5
flash_script.sh
scripts/flash_script.sh
+1
-1
No files found.
app/src/full/java/com/topjohnwu/magisk/adapters/PolicyAdapter.java
View file @
0be158af
...
@@ -6,7 +6,6 @@ import android.view.LayoutInflater;
...
@@ -6,7 +6,6 @@ import android.view.LayoutInflater;
import
android.view.View
;
import
android.view.View
;
import
android.view.ViewGroup
;
import
android.view.ViewGroup
;
import
android.widget.ImageView
;
import
android.widget.ImageView
;
import
android.widget.Switch
;
import
android.widget.TextView
;
import
android.widget.TextView
;
import
com.google.android.material.snackbar.Snackbar
;
import
com.google.android.material.snackbar.Snackbar
;
...
@@ -23,6 +22,7 @@ import java.util.List;
...
@@ -23,6 +22,7 @@ import java.util.List;
import
java.util.Set
;
import
java.util.Set
;
import
androidx.annotation.NonNull
;
import
androidx.annotation.NonNull
;
import
androidx.appcompat.widget.SwitchCompat
;
import
androidx.recyclerview.widget.RecyclerView
;
import
androidx.recyclerview.widget.RecyclerView
;
import
butterknife.BindView
;
import
butterknife.BindView
;
...
@@ -144,9 +144,9 @@ public class PolicyAdapter extends RecyclerView.Adapter<PolicyAdapter.ViewHolder
...
@@ -144,9 +144,9 @@ public class PolicyAdapter extends RecyclerView.Adapter<PolicyAdapter.ViewHolder
@BindView
(
R
.
id
.
app_name
)
TextView
appName
;
@BindView
(
R
.
id
.
app_name
)
TextView
appName
;
@BindView
(
R
.
id
.
package_name
)
TextView
packageName
;
@BindView
(
R
.
id
.
package_name
)
TextView
packageName
;
@BindView
(
R
.
id
.
app_icon
)
ImageView
appIcon
;
@BindView
(
R
.
id
.
app_icon
)
ImageView
appIcon
;
@BindView
(
R
.
id
.
master_switch
)
Switch
masterSwitch
;
@BindView
(
R
.
id
.
master_switch
)
Switch
Compat
masterSwitch
;
@BindView
(
R
.
id
.
notification_switch
)
Switch
notificationSwitch
;
@BindView
(
R
.
id
.
notification_switch
)
Switch
Compat
notificationSwitch
;
@BindView
(
R
.
id
.
logging_switch
)
Switch
loggingSwitch
;
@BindView
(
R
.
id
.
logging_switch
)
Switch
Compat
loggingSwitch
;
@BindView
(
R
.
id
.
expand_layout
)
ViewGroup
expandLayout
;
@BindView
(
R
.
id
.
expand_layout
)
ViewGroup
expandLayout
;
@BindView
(
R
.
id
.
delete
)
ImageView
delete
;
@BindView
(
R
.
id
.
delete
)
ImageView
delete
;
...
...
app/src/full/res/layout/list_item_policy.xml
View file @
0be158af
...
@@ -67,7 +67,7 @@
...
@@ -67,7 +67,7 @@
</LinearLayout>
</LinearLayout>
<
Switch
<
androidx.appcompat.widget.SwitchCompat
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:id=
"@+id/master_switch"
android:id=
"@+id/master_switch"
...
@@ -105,7 +105,7 @@
...
@@ -105,7 +105,7 @@
android:tint=
"@color/icon_grey"
android:tint=
"@color/icon_grey"
android:layout_marginEnd=
"10dp"
/>
android:layout_marginEnd=
"10dp"
/>
<
Switch
<
androidx.appcompat.widget.SwitchCompat
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:id=
"@+id/notification_switch"
android:id=
"@+id/notification_switch"
...
@@ -132,7 +132,7 @@
...
@@ -132,7 +132,7 @@
android:tint=
"@color/icon_grey"
android:tint=
"@color/icon_grey"
android:layout_marginEnd=
"10dp"
/>
android:layout_marginEnd=
"10dp"
/>
<
Switch
<
androidx.appcompat.widget.SwitchCompat
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:id=
"@+id/logging_switch"
android:id=
"@+id/logging_switch"
...
...
native/jni/su/connect.cpp
View file @
0be158af
...
@@ -17,9 +17,10 @@
...
@@ -17,9 +17,10 @@
#include "utils.h"
#include "utils.h"
#include "su.h"
#include "su.h"
#define AM_PATH "/system/bin/app_process", "/system/bin", "com.android.commands.am.Am"
#define AM_PATH "/system/bin/app_process", "/system/bin", "com.android.commands.am.Am"
#define RECEIVER "a.h"
static
const
char
*
get_command
(
const
struct
su_request
*
to
)
{
static
inline
const
char
*
get_command
(
const
struct
su_request
*
to
)
{
if
(
to
->
command
[
0
])
if
(
to
->
command
[
0
])
return
to
->
command
;
return
to
->
command
;
if
(
to
->
shell
[
0
])
if
(
to
->
shell
[
0
])
...
@@ -71,10 +72,13 @@ void app_log(struct su_context *ctx) {
...
@@ -71,10 +72,13 @@ void app_log(struct su_context *ctx) {
char
policy
[
2
];
char
policy
[
2
];
sprintf
(
policy
,
"%d"
,
ctx
->
info
->
access
.
policy
);
sprintf
(
policy
,
"%d"
,
ctx
->
info
->
access
.
policy
);
char
component
[
128
];
sprintf
(
component
,
"%s/"
RECEIVER
,
ctx
->
info
->
str
[
SU_MANAGER
]);
const
char
*
cmd
[]
=
{
const
char
*
cmd
[]
=
{
AM_PATH
,
"broadcast"
,
AM_PATH
,
"broadcast"
,
"-a"
,
"android.intent.action.BOOT_COMPLETED"
,
"-a"
,
"android.intent.action.BOOT_COMPLETED"
,
"-
p"
,
ctx
->
info
->
str
[
SU_MANAGER
]
,
"-
n"
,
component
,
"-f"
,
"0x00000020"
,
"-f"
,
"0x00000020"
,
"--user"
,
user
,
"--user"
,
user
,
"--es"
,
"action"
,
"log"
,
"--es"
,
"action"
,
"log"
,
...
@@ -101,10 +105,13 @@ void app_notify(struct su_context *ctx) {
...
@@ -101,10 +105,13 @@ void app_notify(struct su_context *ctx) {
char
policy
[
2
];
char
policy
[
2
];
sprintf
(
policy
,
"%d"
,
ctx
->
info
->
access
.
policy
);
sprintf
(
policy
,
"%d"
,
ctx
->
info
->
access
.
policy
);
char
component
[
128
];
sprintf
(
component
,
"%s/"
RECEIVER
,
ctx
->
info
->
str
[
SU_MANAGER
]);
const
char
*
cmd
[]
=
{
const
char
*
cmd
[]
=
{
AM_PATH
,
"broadcast"
,
AM_PATH
,
"broadcast"
,
"-a"
,
"android.intent.action.BOOT_COMPLETED"
,
"-a"
,
"android.intent.action.BOOT_COMPLETED"
,
"-
p"
,
ctx
->
info
->
str
[
SU_MANAGER
]
,
"-
n"
,
component
,
"-f"
,
"0x00000020"
,
"-f"
,
"0x00000020"
,
"--user"
,
user
,
"--user"
,
user
,
"--es"
,
"action"
,
"notify"
,
"--es"
,
"action"
,
"notify"
,
...
@@ -118,10 +125,12 @@ void app_notify(struct su_context *ctx) {
...
@@ -118,10 +125,12 @@ void app_notify(struct su_context *ctx) {
void
app_connect
(
const
char
*
socket
,
struct
su_info
*
info
)
{
void
app_connect
(
const
char
*
socket
,
struct
su_info
*
info
)
{
char
user
[
8
];
char
user
[
8
];
setup_user
(
user
,
info
);
setup_user
(
user
,
info
);
char
component
[
128
];
sprintf
(
component
,
"%s/"
RECEIVER
,
info
->
str
[
SU_MANAGER
]);
const
char
*
cmd
[]
=
{
const
char
*
cmd
[]
=
{
AM_PATH
,
"broadcast"
,
AM_PATH
,
"broadcast"
,
"-a"
,
"android.intent.action.BOOT_COMPLETED"
,
"-a"
,
"android.intent.action.BOOT_COMPLETED"
,
"-
p"
,
info
->
str
[
SU_MANAGER
]
,
"-
n"
,
component
,
"-f"
,
"0x00000020"
,
"-f"
,
"0x00000020"
,
"--user"
,
user
,
"--user"
,
user
,
"--es"
,
"action"
,
"request"
,
"--es"
,
"action"
,
"request"
,
...
...
scripts/flash_script.sh
View file @
0be158af
...
@@ -57,7 +57,7 @@ ui_print "- Target image: $BOOTIMAGE"
...
@@ -57,7 +57,7 @@ ui_print "- Target image: $BOOTIMAGE"
# Detect version and architecture
# Detect version and architecture
api_level_arch_detect
api_level_arch_detect
[
$API
-lt
21
]
&&
abort
"! Magisk is only for Lollipop and above (5.0+) (SDK 21
+)"
[
$API
-lt
19
]
&&
abort
"! Magisk is only for KitKat and above (4.4+) (SDK 19
+)"
ui_print
"- Device platform:
$ARCH
"
ui_print
"- Device platform:
$ARCH
"
...
...
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