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
36c57502
Commit
36c57502
authored
Aug 22, 2016
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove unnecessary root calls
parent
7eadc74f
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
44 additions
and
13 deletions
+44
-13
AndroidManifest.xml
app/src/main/AndroidManifest.xml
+6
-6
WelcomeActivity.java
app/src/main/java/com/topjohnwu/magisk/WelcomeActivity.java
+4
-0
LogFragment.java
app/src/main/java/com/topjohnwu/magisk/ui/LogFragment.java
+8
-2
ModulesFragment.java
...rc/main/java/com/topjohnwu/magisk/ui/ModulesFragment.java
+8
-2
Utils.java
app/src/main/java/com/topjohnwu/magisk/ui/utils/Utils.java
+18
-3
No files found.
app/src/main/AndroidManifest.xml
View file @
36c57502
...
...
@@ -12,13 +12,13 @@
android:supportsRtl=
"true"
android:theme=
"@style/AppTheme"
tools:ignore=
"AllowBackup,GoogleAppIndexingWarning"
>
<
activity
android:name=
".ui.MainActivity"
>
<
intent-filter
>
<
action
android:name=
"android.intent.action.MAIN"
/
>
<
!--<activity android:name=".ui.MainActivity">--
>
<
!--<intent-filter>--
>
<
!--<action android:name="android.intent.action.MAIN"/>--
>
<
category
android:name=
"android.intent.category.LAUNCHER"
/
>
<
/intent-filter
>
<
/activity
>
<
!--<category android:name="android.intent.category.LAUNCHER"/>--
>
<
!--</intent-filter>--
>
<
!--</activity>--
>
<activity
android:name=
".WelcomeActivity"
android:configChanges=
"orientation|screenSize"
>
...
...
app/src/main/java/com/topjohnwu/magisk/WelcomeActivity.java
View file @
36c57502
...
...
@@ -19,6 +19,7 @@ import android.view.View;
import
com.topjohnwu.magisk.ui.LogFragment
;
import
com.topjohnwu.magisk.ui.ModulesFragment
;
import
com.topjohnwu.magisk.ui.RootFragment
;
import
com.topjohnwu.magisk.ui.utils.Utils
;
import
butterknife.BindView
;
import
butterknife.ButterKnife
;
...
...
@@ -44,6 +45,9 @@ public class WelcomeActivity extends AppCompatActivity implements NavigationView
getWindow
().
getDecorView
().
setSystemUiVisibility
(
View
.
SYSTEM_UI_FLAG_LIGHT_STATUS_BAR
);
}
Utils
.
initialize
.
execute
();
setSupportActionBar
(
toolbar
);
ActionBarDrawerToggle
toggle
=
new
ActionBarDrawerToggle
(
this
,
drawer
,
toolbar
,
R
.
string
.
navigation_drawer_open
,
R
.
string
.
navigation_drawer_close
)
{
...
...
app/src/main/java/com/topjohnwu/magisk/ui/LogFragment.java
View file @
36c57502
...
...
@@ -35,6 +35,7 @@ import java.io.FileOutputStream;
import
java.io.FileReader
;
import
java.io.IOException
;
import
java.util.Calendar
;
import
java.util.concurrent.ExecutionException
;
import
butterknife.BindView
;
import
butterknife.ButterKnife
;
...
...
@@ -226,13 +227,18 @@ public class LogFragment extends Fragment {
@Override
protected
void
onPreExecute
()
{
Utils
.
su
(
"chmod 755 /cache"
);
Utils
.
su
(
"chmod 644 /cache/magisk.log"
);
txtLog
.
setText
(
""
);
}
@Override
protected
String
doInBackground
(
File
...
log
)
{
// Ensure initialize is done
try
{
Utils
.
initialize
.
get
();
}
catch
(
InterruptedException
|
ExecutionException
e
)
{
e
.
printStackTrace
();
}
Thread
.
currentThread
().
setPriority
(
Thread
.
NORM_PRIORITY
+
2
);
StringBuilder
llog
=
new
StringBuilder
(
15
*
10
*
1024
);
...
...
app/src/main/java/com/topjohnwu/magisk/ui/ModulesFragment.java
View file @
36c57502
...
...
@@ -21,6 +21,7 @@ import java.io.File;
import
java.io.FileFilter
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.concurrent.ExecutionException
;
import
butterknife.BindView
;
import
butterknife.ButterKnife
;
...
...
@@ -81,6 +82,13 @@ public class ModulesFragment extends Fragment {
@Override
protected
Boolean
doInBackground
(
Void
...
voids
)
{
// Ensure initialize is done
try
{
Utils
.
initialize
.
get
();
}
catch
(
InterruptedException
|
ExecutionException
e
)
{
e
.
printStackTrace
();
}
File
[]
magisk
=
new
File
(
MAGISK_PATH
).
listFiles
(
new
FileFilter
()
{
@Override
public
boolean
accept
(
File
file
)
{
...
...
@@ -88,8 +96,6 @@ public class ModulesFragment extends Fragment {
}
});
Utils
.
su
(
"chmod 755 /cache"
);
File
[]
magiskCache
=
new
File
(
MAGISK_CACHE_PATH
).
listFiles
(
new
FileFilter
()
{
@Override
public
boolean
accept
(
File
file
)
{
...
...
app/src/main/java/com/topjohnwu/magisk/ui/utils/Utils.java
View file @
36c57502
package
com
.
topjohnwu
.
magisk
.
ui
.
utils
;
import
android.os.AsyncTask
;
import
java.util.List
;
import
eu.chainfire.libsuperuser.Shell
;
...
...
@@ -7,7 +9,22 @@ import eu.chainfire.libsuperuser.Shell;
public
class
Utils
{
public
static
final
String
suPath
=
sh
(
"getprop magisk.supath"
);
public
static
final
boolean
rootAccess
=
isRoot
();
public
static
boolean
rootAccess
=
false
;
public
static
Init
initialize
=
new
Init
();
public
static
class
Init
extends
AsyncTask
<
Void
,
Integer
,
Void
>
{
@Override
protected
Void
doInBackground
(
Void
...
voids
)
{
// Check root access
rootAccess
=
isRoot
();
// Permission for java code to read /cache files
if
(
rootAccess
)
{
su
(
"chmod 755 /cache"
,
"chmod 644 /cache/magisk.log"
);
}
return
null
;
}
}
public
static
String
sh
(
String
...
commands
)
{
List
<
String
>
result
=
Shell
.
SH
.
run
(
commands
);
...
...
@@ -28,8 +45,6 @@ public class Utils {
builder
.
append
(
s
);
}
Shell
.
SU
.
available
();
return
builder
.
toString
();
}
...
...
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