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
3706b53e
Commit
3706b53e
authored
Sep 22, 2016
by
d8ahazard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
WIP sync
parent
8a8aaf32
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
60 additions
and
32 deletions
+60
-32
AndroidManifest.xml
app/src/main/AndroidManifest.xml
+27
-25
RootFragment.java
app/src/main/java/com/topjohnwu/magisk/RootFragment.java
+2
-0
MonitorService.java
...in/java/com/topjohnwu/magisk/services/MonitorService.java
+1
-1
TileServiceCompat.java
...java/com/topjohnwu/magisk/services/TileServiceCompat.java
+3
-3
Utils.java
app/src/main/java/com/topjohnwu/magisk/utils/Utils.java
+27
-3
No files found.
app/src/main/AndroidManifest.xml
View file @
3706b53e
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:tools=
"http://schemas.android.com/tools"
package=
"com.topjohnwu.magisk"
>
<uses-sdk
tools:overrideLibrary=
"com.kcoppock.broadcatsttilesupport"
/>
<uses-permission
android:name=
"android.permission.WRITE_EXTERNAL_STORAGE"
/>
<uses-permission
android:name=
"android.permission.INTERNET"
/>
<uses-permission
android:name=
"android.permission.ACCESS_NETWORK_STATE"
/>
<uses-permission
android:name=
"android.permission.RECEIVE_BOOT_COMPLETED"
/>
xmlns:tools=
"http://schemas.android.com/tools"
package=
"com.topjohnwu.magisk"
>
<uses-sdk
tools:overrideLibrary=
"com.kcoppock.broadcatsttilesupport"
/>
<uses-permission
android:name=
"android.permission.WRITE_EXTERNAL_STORAGE"
/>
<uses-permission
android:name=
"android.permission.INTERNET"
/>
<uses-permission
android:name=
"android.permission.ACCESS_NETWORK_STATE"
/>
<uses-permission
android:name=
"android.permission.RECEIVE_BOOT_COMPLETED"
/>
<uses-permission
android:name=
"android.permission.PACKAGE_USAGE_STATS"
tools:ignore=
"ProtectedPermissions"
/>
tools:ignore=
"ProtectedPermissions"
/>
<application
...
...
@@ -25,11 +27,11 @@
android:label=
"@string/accessibility_service_name"
android:permission=
"android.permission.BIND_ACCESSIBILITY_SERVICE"
>
<intent-filter>
<action
android:name=
"android.accessibilityservice.AccessibilityService"
/>
<action
android:name=
"android.accessibilityservice.AccessibilityService"
/>
</intent-filter>
<meta-data
android:name=
"android.accessibilityservice"
android:resource=
"@xml/accessibilityservice"
/>
android:resource=
"@xml/accessibilityservice"
/>
</service>
<service
android:name=
".services.TileServiceNewApi"
...
...
@@ -37,7 +39,7 @@
android:label=
"@string/app_name"
android:permission=
"android.permission.BIND_QUICK_SETTINGS_TILE"
>
<intent-filter>
<action
android:name=
"android.service.quicksettings.action.QS_TILE"
/>
<action
android:name=
"android.service.quicksettings.action.QS_TILE"
/>
</intent-filter>
</service>
...
...
@@ -46,9 +48,9 @@
android:enabled=
"true"
android:exported=
"true"
>
<intent-filter>
<action
android:name=
"com.topjohnwu.magisk.CUSTOMTILE_ACTION_AUTOROOT"
/>
<action
android:name=
"com.topjohnwu.magisk.CUSTOMTILE_ACTION_DISABLEROOT"
/>
<action
android:name=
"com.topjohnwu.magisk.CUSTOMTILE_ACTION_ENABLEROOT"
/>
<action
android:name=
"com.topjohnwu.magisk.CUSTOMTILE_ACTION_AUTOROOT"
/>
<action
android:name=
"com.topjohnwu.magisk.CUSTOMTILE_ACTION_DISABLEROOT"
/>
<action
android:name=
"com.topjohnwu.magisk.CUSTOMTILE_ACTION_ENABLEROOT"
/>
</intent-filter>
</receiver>
...
...
@@ -57,9 +59,9 @@
android:configChanges=
"orientation|screenSize"
android:exported=
"true"
>
<intent-filter>
<action
android:name=
"android.intent.action.MAIN"
/>
<action
android:name=
"android.intent.action.MAIN"
/>
<category
android:name=
"android.intent.category.LAUNCHER"
/>
<category
android:name=
"android.intent.category.LAUNCHER"
/>
</intent-filter>
</activity>
<activity
...
...
@@ -69,12 +71,12 @@
android:icon=
"@drawable/ic_chooser"
android:label=
"@string/choose_file"
>
<intent-filter>
<action
android:name=
"android.intent.action.GET_CONTENT"
/>
<action
android:name=
"android.intent.action.GET_CONTENT"
/>
<category
android:name=
"android.intent.category.DEFAULT"
/>
<category
android:name=
"android.intent.category.OPENABLE"
/>
<category
android:name=
"android.intent.category.DEFAULT"
/>
<category
android:name=
"android.intent.category.OPENABLE"
/>
<data
android:mimeType=
"*/*"
/>
<data
android:mimeType=
"*/*"
/>
</intent-filter>
</activity>
...
...
@@ -86,12 +88,12 @@
android:grantUriPermissions=
"true"
android:permission=
"android.permission.MANAGE_DOCUMENTS"
>
<intent-filter>
<action
android:name=
"android.content.action.DOCUMENTS_PROVIDER"
/>
<action
android:name=
"android.content.action.DOCUMENTS_PROVIDER"
/>
</intent-filter>
</provider>
<activity
android:name=
".AboutActivity"
android:theme=
"@style/AppTheme.Transparent"
/>
android:theme=
"@style/AppTheme.Transparent"
/>
<provider
android:name=
"android.support.v4.content.FileProvider"
...
...
@@ -100,11 +102,11 @@
android:grantUriPermissions=
"true"
>
<meta-data
android:name=
"android.support.FILE_PROVIDER_PATHS"
android:resource=
"@xml/file_paths"
/>
android:resource=
"@xml/file_paths"
/>
</provider>
<receiver
android:name=
".receivers.AutoStartReceiver"
>
<intent-filter>
<action
android:name=
"android.intent.action.BOOT_COMPLETED"
/>
<action
android:name=
"android.intent.action.BOOT_COMPLETED"
/>
</intent-filter>
</receiver>
...
...
app/src/main/java/com/topjohnwu/magisk/RootFragment.java
View file @
3706b53e
...
...
@@ -19,6 +19,7 @@ import android.widget.ImageView;
import
android.widget.ProgressBar
;
import
android.widget.Switch
;
import
android.widget.TextView
;
import
android.widget.Toast
;
import
com.topjohnwu.magisk.receivers.Receiver
;
import
com.topjohnwu.magisk.services.MonitorService
;
...
...
@@ -113,6 +114,7 @@ public class RootFragment extends Fragment implements Receiver {
autoRootToggle
.
setOnClickListener
(
toggle
->
{
if
(!
Utils
.
hasServicePermission
(
getActivity
()))
{
Intent
intent
=
new
Intent
(
android
.
provider
.
Settings
.
ACTION_ACCESSIBILITY_SETTINGS
);
Toast
.
makeText
(
getActivity
(),
"Please enable accessibility access for Magisk's auto-toggle feature to work."
,
Toast
.
LENGTH_LONG
).
show
();
startActivityForResult
(
intent
,
100
);
}
else
{
ToggleAutoRoot
(
autoRootToggle
.
isChecked
());
...
...
app/src/main/java/com/topjohnwu/magisk/services/MonitorService.java
View file @
3706b53e
...
...
@@ -68,7 +68,7 @@ public class MonitorService extends AccessibilityService {
ActivityInfo
activityInfo
=
tryGetActivity
(
componentName
);
boolean
isActivity
=
activityInfo
!=
null
;
if
(
isActivity
)
{
Log
.
i
(
"Magisk"
,
"
CurrentActivity: "
+
componentName
.
getPackageName
());
Log
ger
.
dh
(
"MonitorService:
CurrentActivity: "
+
componentName
.
getPackageName
());
String
mPackage
=
componentName
.
getPackageName
();
SharedPreferences
prefs
=
PreferenceManager
.
getDefaultSharedPreferences
(
getApplicationContext
());
...
...
app/src/main/java/com/topjohnwu/magisk/services/TileServiceCompat.java
View file @
3706b53e
...
...
@@ -21,9 +21,9 @@ public class TileServiceCompat extends Service {
private
static
boolean
root
,
autoRoot
;
public
static
final
String
TILE_ID
=
"
com.shovelgrill.magiskmmtile.TILE
"
;
public
static
final
String
ACTION_TILE_CLICK
=
"
com.shovelgrill.magiskmmtile
.ACTION_TILE_CLICK"
;
public
static
final
String
EXTRA_CLICK_TYPE
=
"
com.shovelgrill.magiskmmtile
.EXTRA_CLICK_TYPE"
;
public
static
final
String
TILE_ID
=
"
Magisk
"
;
public
static
final
String
ACTION_TILE_CLICK
=
"
magisk
.ACTION_TILE_CLICK"
;
public
static
final
String
EXTRA_CLICK_TYPE
=
"
magisk
.EXTRA_CLICK_TYPE"
;
public
static
final
int
CLICK_TYPE_UNKNOWN
=
-
1
;
public
static
final
int
CLICK_TYPE_SIMPLE
=
0
;
public
static
final
int
CLICK_TYPE_LONG
=
1
;
...
...
app/src/main/java/com/topjohnwu/magisk/utils/Utils.java
View file @
3706b53e
...
...
@@ -266,11 +266,19 @@ public class Utils {
}
public
static
void
installTile
(
Context
context
)
{
String
qsTileId
;
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
N
)
{
qsTileId
=
"custom(com.topjohnwu.magisk/.services.TileServiceNewApi)"
;
}
else
{
qsTileId
=
"intent(Magisk)"
;
}
String
qsTileId
=
"intent("
+
TileServiceCompat
.
TILE_ID
+
")"
;
List
<
String
>
lines
=
Shell
.
su
(
"settings get secure sysui_qs_tiles"
);
if
(
lines
!=
null
&&
lines
.
size
()
==
1
)
{
List
<
String
>
tiles
=
new
LinkedList
<
String
>(
Arrays
.
asList
(
lines
.
get
(
0
).
split
(
","
)));
List
<
String
>
tiles2
;
int
tileSpace
=
Math
.
round
(
tiles
.
size
()/
2
);
Logger
.
dh
(
"Utils: Current Tile String is "
+
tiles
);
if
(
tiles
.
size
()
>
1
)
{
for
(
String
tile
:
tiles
)
{
if
(
tile
.
equals
(
qsTileId
))
{
...
...
@@ -278,9 +286,15 @@ public class Utils {
return
;
}
}
tiles
.
add
(
tiles
.
size
()
+
1
,
qsTileId
);
String
newTiles
=
TextUtils
.
join
(
","
,
tiles
);
Logger
.
dh
(
"Utils: NewtilesString is "
+
newTiles
);
Shell
.
su
(
"settings put secure sysui_qs_tiles \""
+
newTiles
+
"\""
);
Toast
.
makeText
(
context
,
"Tile installed"
,
Toast
.
LENGTH_SHORT
).
show
();
if
(
Build
.
VERSION
.
SDK_INT
==
Build
.
VERSION_CODES
.
M
)
{
Utils
.
refreshService
(
context
);
}
return
;
}
}
...
...
@@ -290,7 +304,12 @@ public class Utils {
public
static
void
uninstallTile
(
Context
context
)
{
String
qsTileId
=
"intent("
+
TileServiceCompat
.
TILE_ID
+
")"
;
String
qsTileId
;
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
N
)
{
qsTileId
=
"custom(com.topjohnwu.magisk/.services.TileServiceNewApi)"
;
}
else
{
qsTileId
=
"intent(Magisk)"
;
}
List
<
String
>
lines
=
Shell
.
su
(
"settings get secure sysui_qs_tiles"
);
if
(
lines
!=
null
&&
lines
.
size
()
==
1
)
{
List
<
String
>
tiles
=
new
LinkedList
<
String
>(
Arrays
.
asList
(
lines
.
get
(
0
).
split
(
","
)));
...
...
@@ -307,6 +326,9 @@ public class Utils {
String
newTiles
=
TextUtils
.
join
(
","
,
tiles
);
Shell
.
su
(
"settings put secure sysui_qs_tiles \""
+
newTiles
+
"\""
);
Toast
.
makeText
(
context
,
"Tile uninstalled"
,
Toast
.
LENGTH_SHORT
).
show
();
if
(
Build
.
VERSION
.
SDK_INT
==
Build
.
VERSION_CODES
.
M
)
{
Utils
.
refreshService
(
context
);
}
return
;
}
Toast
.
makeText
(
context
,
"Tile already uninstalled"
,
Toast
.
LENGTH_SHORT
).
show
();
...
...
@@ -318,7 +340,9 @@ public class Utils {
}
private
void
refreshService
(
Context
context
)
{
private
static
void
refreshService
(
Context
context
)
{
context
.
startService
(
new
Intent
(
context
,
TileServiceCompat
.
class
));
}
...
...
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