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
a173179b
Commit
a173179b
authored
Sep 27, 2016
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Final fix for flash zip
parent
e73497e4
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
75 additions
and
60 deletions
+75
-60
AboutActivity.java
app/src/main/java/com/topjohnwu/magisk/AboutActivity.java
+1
-1
AutoRootFragment.java
app/src/main/java/com/topjohnwu/magisk/AutoRootFragment.java
+3
-3
LogFragment.java
app/src/main/java/com/topjohnwu/magisk/LogFragment.java
+2
-2
MainActivity.java
app/src/main/java/com/topjohnwu/magisk/MainActivity.java
+5
-5
ModulesFragment.java
app/src/main/java/com/topjohnwu/magisk/ModulesFragment.java
+1
-4
ReposFragment.java
app/src/main/java/com/topjohnwu/magisk/ReposFragment.java
+2
-3
RootFragment.java
app/src/main/java/com/topjohnwu/magisk/RootFragment.java
+1
-1
SettingsFragment.java
app/src/main/java/com/topjohnwu/magisk/SettingsFragment.java
+2
-2
SplashActivity.java
app/src/main/java/com/topjohnwu/magisk/SplashActivity.java
+1
-3
Module.java
app/src/main/java/com/topjohnwu/magisk/module/Module.java
+1
-1
MonitorService.java
...in/java/com/topjohnwu/magisk/services/MonitorService.java
+3
-3
TileServiceNewApi.java
...java/com/topjohnwu/magisk/services/TileServiceNewApi.java
+7
-7
Async.java
app/src/main/java/com/topjohnwu/magisk/utils/Async.java
+22
-11
Logger.java
app/src/main/java/com/topjohnwu/magisk/utils/Logger.java
+14
-2
Utils.java
app/src/main/java/com/topjohnwu/magisk/utils/Utils.java
+9
-9
WebRequest.java
app/src/main/java/com/topjohnwu/magisk/utils/WebRequest.java
+1
-3
No files found.
app/src/main/java/com/topjohnwu/magisk/AboutActivity.java
View file @
a173179b
...
@@ -44,7 +44,7 @@ public class AboutActivity extends AppCompatActivity {
...
@@ -44,7 +44,7 @@ public class AboutActivity extends AppCompatActivity {
protected
void
onCreate
(
@Nullable
Bundle
savedInstanceState
)
{
protected
void
onCreate
(
@Nullable
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
super
.
onCreate
(
savedInstanceState
);
String
theme
=
PreferenceManager
.
getDefaultSharedPreferences
(
getApplicationContext
()).
getString
(
"theme"
,
""
);
String
theme
=
PreferenceManager
.
getDefaultSharedPreferences
(
getApplicationContext
()).
getString
(
"theme"
,
""
);
Logger
.
d
h
(
"AboutActivity: Theme is "
+
theme
);
Logger
.
d
ev
(
"AboutActivity: Theme is "
+
theme
);
if
(
theme
.
equals
(
"Dark"
))
{
if
(
theme
.
equals
(
"Dark"
))
{
setTheme
(
R
.
style
.
AppTheme_dh
);
setTheme
(
R
.
style
.
AppTheme_dh
);
}
}
...
...
app/src/main/java/com/topjohnwu/magisk/AutoRootFragment.java
View file @
a173179b
...
@@ -76,7 +76,7 @@ public class AutoRootFragment extends ListFragment {
...
@@ -76,7 +76,7 @@ public class AutoRootFragment extends ListFragment {
@Override
@Override
public
void
onListItemClick
(
ListView
l
,
View
v
,
int
position
,
long
id
)
{
public
void
onListItemClick
(
ListView
l
,
View
v
,
int
position
,
long
id
)
{
Logger
.
d
h
(
"Click"
);
Logger
.
d
ev
(
"Click"
);
super
.
onListItemClick
(
l
,
v
,
position
,
id
);
super
.
onListItemClick
(
l
,
v
,
position
,
id
);
ApplicationInfo
app
=
applist
.
get
(
position
);
ApplicationInfo
app
=
applist
.
get
(
position
);
ToggleApp
(
app
.
packageName
,
position
,
v
);
ToggleApp
(
app
.
packageName
,
position
,
v
);
...
@@ -84,7 +84,7 @@ public class AutoRootFragment extends ListFragment {
...
@@ -84,7 +84,7 @@ public class AutoRootFragment extends ListFragment {
}
}
private
void
ToggleApp
(
String
appToCheck
,
int
position
,
View
v
)
{
private
void
ToggleApp
(
String
appToCheck
,
int
position
,
View
v
)
{
Logger
.
d
h
(
"Magisk"
,
"AutoRootFragment: ToggleApp called for "
+
appToCheck
);
Logger
.
d
ev
(
"Magisk"
,
"AutoRootFragment: ToggleApp called for "
+
appToCheck
);
Set
<
String
>
blackListSet
=
prefs
.
getStringSet
(
"auto_blacklist"
,
null
);
Set
<
String
>
blackListSet
=
prefs
.
getStringSet
(
"auto_blacklist"
,
null
);
assert
blackListSet
!=
null
;
assert
blackListSet
!=
null
;
arrayBlackList
=
new
ArrayList
<>(
blackListSet
);
arrayBlackList
=
new
ArrayList
<>(
blackListSet
);
...
@@ -100,7 +100,7 @@ public class AutoRootFragment extends ListFragment {
...
@@ -100,7 +100,7 @@ public class AutoRootFragment extends ListFragment {
}
}
}
}
Logger
.
d
h
(
"Committing set, value is: "
+
arrayBlackList
.
toString
());
Logger
.
d
ev
(
"Committing set, value is: "
+
arrayBlackList
.
toString
());
SharedPreferences
.
Editor
editor
=
prefs
.
edit
();
SharedPreferences
.
Editor
editor
=
prefs
.
edit
();
editor
.
putStringSet
(
"auto_blacklist"
,
new
HashSet
<>(
arrayBlackList
));
editor
.
putStringSet
(
"auto_blacklist"
,
new
HashSet
<>(
arrayBlackList
));
editor
.
apply
();
editor
.
apply
();
...
...
app/src/main/java/com/topjohnwu/magisk/LogFragment.java
View file @
a173179b
...
@@ -40,7 +40,7 @@ import butterknife.ButterKnife;
...
@@ -40,7 +40,7 @@ import butterknife.ButterKnife;
public
class
LogFragment
extends
Fragment
{
public
class
LogFragment
extends
Fragment
{
private
static
final
String
MAGISK_LOG
=
"/cache/magisk.
log
"
;
private
static
final
String
MAGISK_LOG
=
"/cache/magisk.
dev
"
;
@BindView
(
R
.
id
.
txtLog
)
TextView
txtLog
;
@BindView
(
R
.
id
.
txtLog
)
TextView
txtLog
;
@BindView
(
R
.
id
.
svLog
)
ScrollView
svLog
;
@BindView
(
R
.
id
.
svLog
)
ScrollView
svLog
;
...
@@ -154,7 +154,7 @@ public class LogFragment extends Fragment {
...
@@ -154,7 +154,7 @@ public class LogFragment extends Fragment {
Calendar
now
=
Calendar
.
getInstance
();
Calendar
now
=
Calendar
.
getInstance
();
String
filename
=
String
.
format
(
String
filename
=
String
.
format
(
"magisk_%s_%04d%02d%02d_%02d%02d%02d.
log
"
,
"error"
,
"magisk_%s_%04d%02d%02d_%02d%02d%02d.
dev
"
,
"error"
,
now
.
get
(
Calendar
.
YEAR
),
now
.
get
(
Calendar
.
MONTH
)
+
1
,
now
.
get
(
Calendar
.
YEAR
),
now
.
get
(
Calendar
.
MONTH
)
+
1
,
now
.
get
(
Calendar
.
DAY_OF_MONTH
),
now
.
get
(
Calendar
.
HOUR_OF_DAY
),
now
.
get
(
Calendar
.
DAY_OF_MONTH
),
now
.
get
(
Calendar
.
HOUR_OF_DAY
),
now
.
get
(
Calendar
.
MINUTE
),
now
.
get
(
Calendar
.
SECOND
));
now
.
get
(
Calendar
.
MINUTE
),
now
.
get
(
Calendar
.
SECOND
));
...
...
app/src/main/java/com/topjohnwu/magisk/MainActivity.java
View file @
a173179b
...
@@ -49,7 +49,7 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
...
@@ -49,7 +49,7 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
protected
void
onCreate
(
final
Bundle
savedInstanceState
)
{
protected
void
onCreate
(
final
Bundle
savedInstanceState
)
{
String
theme
=
PreferenceManager
.
getDefaultSharedPreferences
(
getApplicationContext
()).
getString
(
"theme"
,
""
);
String
theme
=
PreferenceManager
.
getDefaultSharedPreferences
(
getApplicationContext
()).
getString
(
"theme"
,
""
);
Logger
.
d
h
(
"MainActivity: Theme is "
+
theme
);
Logger
.
d
ev
(
"MainActivity: Theme is "
+
theme
);
if
(
theme
.
equals
(
"Dark"
))
{
if
(
theme
.
equals
(
"Dark"
))
{
setTheme
(
R
.
style
.
AppTheme_dh
);
setTheme
(
R
.
style
.
AppTheme_dh
);
}
}
...
@@ -98,7 +98,7 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
...
@@ -98,7 +98,7 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
navigationView
.
setCheckedItem
(
R
.
id
.
downloads
);
navigationView
.
setCheckedItem
(
R
.
id
.
downloads
);
}
}
}
}
hm
=
getFragmentManager
().
findFragmentByTag
(
"
log
"
);
hm
=
getFragmentManager
().
findFragmentByTag
(
"
dev
"
);
if
(
hm
!=
null
)
{
if
(
hm
!=
null
)
{
if
(
hm
.
isVisible
())
{
if
(
hm
.
isVisible
())
{
navigationView
.
setCheckedItem
(
R
.
id
.
log
);
navigationView
.
setCheckedItem
(
R
.
id
.
log
);
...
@@ -143,7 +143,7 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
...
@@ -143,7 +143,7 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
String
toLaunch
=
""
;
String
toLaunch
=
""
;
toLaunch
=
getIntent
().
getExtras
().
getString
(
"Relaunch"
);
toLaunch
=
getIntent
().
getExtras
().
getString
(
"Relaunch"
);
if
(
toLaunch
.
equals
(
"Settings"
))
{
if
(
toLaunch
.
equals
(
"Settings"
))
{
Logger
.
d
h
(
"MainActivity: Intent has extras "
+
getIntent
().
getExtras
().
getString
(
"Relaunch"
));
Logger
.
d
ev
(
"MainActivity: Intent has extras "
+
getIntent
().
getExtras
().
getString
(
"Relaunch"
));
mSelectedId
=
R
.
id
.
settings
;
mSelectedId
=
R
.
id
.
settings
;
}
}
...
@@ -170,7 +170,7 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
...
@@ -170,7 +170,7 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
drawer
.
closeDrawer
(
GravityCompat
.
START
);
drawer
.
closeDrawer
(
GravityCompat
.
START
);
}
else
{
}
else
{
int
backStackEntryCount
=
getFragmentManager
().
getBackStackEntryCount
();
int
backStackEntryCount
=
getFragmentManager
().
getBackStackEntryCount
();
Logger
.
d
h
(
"Welcomeactivity: Entrycount is "
+
backStackEntryCount
);
Logger
.
d
ev
(
"Welcomeactivity: Entrycount is "
+
backStackEntryCount
);
if
(
backStackEntryCount
>=
2
)
{
if
(
backStackEntryCount
>=
2
)
{
super
.
onBackPressed
();
super
.
onBackPressed
();
}
else
{
}
else
{
...
@@ -227,7 +227,7 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
...
@@ -227,7 +227,7 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
break
;
break
;
case
R
.
id
.
log
:
case
R
.
id
.
log
:
setTitle
(
R
.
string
.
log
);
setTitle
(
R
.
string
.
log
);
tag
=
"
log
"
;
tag
=
"
dev
"
;
navFragment
=
new
LogFragment
();
navFragment
=
new
LogFragment
();
break
;
break
;
case
R
.
id
.
settings
:
case
R
.
id
.
settings
:
...
...
app/src/main/java/com/topjohnwu/magisk/ModulesFragment.java
View file @
a173179b
...
@@ -9,20 +9,17 @@ import android.os.Bundle;
...
@@ -9,20 +9,17 @@ import android.os.Bundle;
import
android.preference.PreferenceManager
;
import
android.preference.PreferenceManager
;
import
android.support.annotation.Nullable
;
import
android.support.annotation.Nullable
;
import
android.support.design.widget.FloatingActionButton
;
import
android.support.design.widget.FloatingActionButton
;
import
android.support.design.widget.Snackbar
;
import
android.support.v4.widget.SwipeRefreshLayout
;
import
android.support.v4.widget.SwipeRefreshLayout
;
import
android.support.v7.widget.RecyclerView
;
import
android.support.v7.widget.RecyclerView
;
import
android.view.LayoutInflater
;
import
android.view.LayoutInflater
;
import
android.view.View
;
import
android.view.View
;
import
android.view.ViewGroup
;
import
android.view.ViewGroup
;
import
android.widget.CheckBox
;
import
android.widget.TextView
;
import
android.widget.TextView
;
import
com.ipaulpro.afilechooser.utils.FileUtils
;
import
com.ipaulpro.afilechooser.utils.FileUtils
;
import
com.topjohnwu.magisk.module.Module
;
import
com.topjohnwu.magisk.module.Module
;
import
com.topjohnwu.magisk.utils.Async
;
import
com.topjohnwu.magisk.utils.Async
;
import
com.topjohnwu.magisk.utils.Logger
;
import
com.topjohnwu.magisk.utils.Logger
;
import
com.topjohnwu.magisk.utils.Utils
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.List
;
...
@@ -73,7 +70,7 @@ public class ModulesFragment extends Fragment {
...
@@ -73,7 +70,7 @@ public class ModulesFragment extends Fragment {
listener
=
(
pref
,
s
)
->
{
listener
=
(
pref
,
s
)
->
{
if
(
s
.
equals
(
"module_done"
))
{
if
(
s
.
equals
(
"module_done"
))
{
if
(
pref
.
getBoolean
(
s
,
false
))
{
if
(
pref
.
getBoolean
(
s
,
false
))
{
Logger
.
d
h
(
"ModulesFragment: UI refresh triggered"
);
Logger
.
d
ev
(
"ModulesFragment: UI refresh triggered"
);
updateUI
();
updateUI
();
}
}
}
}
...
...
app/src/main/java/com/topjohnwu/magisk/ReposFragment.java
View file @
a173179b
...
@@ -9,7 +9,6 @@ import android.support.annotation.Nullable;
...
@@ -9,7 +9,6 @@ import android.support.annotation.Nullable;
import
android.support.v4.widget.SwipeRefreshLayout
;
import
android.support.v4.widget.SwipeRefreshLayout
;
import
android.support.v7.app.AlertDialog
;
import
android.support.v7.app.AlertDialog
;
import
android.support.v7.widget.RecyclerView
;
import
android.support.v7.widget.RecyclerView
;
import
android.util.Log
;
import
android.view.LayoutInflater
;
import
android.view.LayoutInflater
;
import
android.view.View
;
import
android.view.View
;
import
android.view.ViewGroup
;
import
android.view.ViewGroup
;
...
@@ -66,7 +65,7 @@ public class ReposFragment extends Fragment {
...
@@ -66,7 +65,7 @@ public class ReposFragment extends Fragment {
listener
=
(
pref
,
s
)
->
{
listener
=
(
pref
,
s
)
->
{
if
(
s
.
equals
(
"repo_done"
))
{
if
(
s
.
equals
(
"repo_done"
))
{
if
(
pref
.
getBoolean
(
s
,
false
))
{
if
(
pref
.
getBoolean
(
s
,
false
))
{
Logger
.
d
h
(
"ReposFragment: UI refresh triggered"
);
Logger
.
d
ev
(
"ReposFragment: UI refresh triggered"
);
updateUI
();
updateUI
();
}
}
}
}
...
@@ -146,7 +145,7 @@ public class ReposFragment extends Fragment {
...
@@ -146,7 +145,7 @@ public class ReposFragment extends Fragment {
// };
// };
//
//
// String theme = PreferenceManager.getDefaultSharedPreferences(getActivity()).getString("theme", "");
// String theme = PreferenceManager.getDefaultSharedPreferences(getActivity()).getString("theme", "");
// Logger.d
h
("ReposFragment: Theme is " + theme);
// Logger.d
ev
("ReposFragment: Theme is " + theme);
// if (theme.equals("Dark")) {
// if (theme.equals("Dark")) {
// builder = new AlertDialog.Builder(getActivity(),R.style.AlertDialog_dh);
// builder = new AlertDialog.Builder(getActivity(),R.style.AlertDialog_dh);
// } else {
// } else {
...
...
app/src/main/java/com/topjohnwu/magisk/RootFragment.java
View file @
a173179b
...
@@ -174,7 +174,7 @@ public class RootFragment extends Fragment {
...
@@ -174,7 +174,7 @@ public class RootFragment extends Fragment {
listener
=
(
prefs1
,
key
)
->
{
listener
=
(
prefs1
,
key
)
->
{
if
((
key
.
contains
(
"autoRootEnable"
))
|
(
key
.
equals
(
"root"
)))
{
if
((
key
.
contains
(
"autoRootEnable"
))
|
(
key
.
equals
(
"root"
)))
{
Logger
.
d
h
(
"RootFragmnet, keychange detected for "
+
key
);
Logger
.
d
ev
(
"RootFragmnet, keychange detected for "
+
key
);
new
updateUI
().
execute
();
new
updateUI
().
execute
();
}
}
...
...
app/src/main/java/com/topjohnwu/magisk/SettingsFragment.java
View file @
a173179b
...
@@ -100,7 +100,7 @@ public class SettingsFragment extends PreferenceFragment implements SharedPrefer
...
@@ -100,7 +100,7 @@ public class SettingsFragment extends PreferenceFragment implements SharedPrefer
@Override
@Override
public
void
onSharedPreferenceChanged
(
SharedPreferences
sharedPreferences
,
String
key
)
{
public
void
onSharedPreferenceChanged
(
SharedPreferences
sharedPreferences
,
String
key
)
{
Logger
.
d
h
(
"Settings: NewValue is "
+
key
);
Logger
.
d
ev
(
"Settings: NewValue is "
+
key
);
if
(
key
.
equals
(
"theme"
))
{
if
(
key
.
equals
(
"theme"
))
{
String
pref
=
sharedPreferences
.
getString
(
key
,
""
);
String
pref
=
sharedPreferences
.
getString
(
key
,
""
);
...
@@ -117,7 +117,7 @@ public class SettingsFragment extends PreferenceFragment implements SharedPrefer
...
@@ -117,7 +117,7 @@ public class SettingsFragment extends PreferenceFragment implements SharedPrefer
intent
.
putExtra
(
"Relaunch"
,
"Settings"
);
intent
.
putExtra
(
"Relaunch"
,
"Settings"
);
startActivity
(
intent
);
startActivity
(
intent
);
Logger
.
d
h
(
"SettingsFragment: theme is "
+
pref
);
Logger
.
d
ev
(
"SettingsFragment: theme is "
+
pref
);
}
}
...
...
app/src/main/java/com/topjohnwu/magisk/SplashActivity.java
View file @
a173179b
...
@@ -10,10 +10,8 @@ import android.support.v7.app.AppCompatActivity;
...
@@ -10,10 +10,8 @@ import android.support.v7.app.AppCompatActivity;
import
com.topjohnwu.magisk.services.MonitorService
;
import
com.topjohnwu.magisk.services.MonitorService
;
import
com.topjohnwu.magisk.utils.Async
;
import
com.topjohnwu.magisk.utils.Async
;
import
com.topjohnwu.magisk.utils.Logger
;
import
com.topjohnwu.magisk.utils.Logger
;
import
com.topjohnwu.magisk.utils.Shell
;
import
com.topjohnwu.magisk.utils.Utils
;
import
com.topjohnwu.magisk.utils.Utils
;
import
java.io.File
;
import
java.util.HashSet
;
import
java.util.HashSet
;
import
java.util.Set
;
import
java.util.Set
;
...
@@ -34,7 +32,7 @@ public class SplashActivity extends AppCompatActivity {
...
@@ -34,7 +32,7 @@ public class SplashActivity extends AppCompatActivity {
if
(!
defaultPrefs
.
contains
(
"auto_blacklist"
))
{
if
(!
defaultPrefs
.
contains
(
"auto_blacklist"
))
{
Logger
.
d
h
(
"SplashActivity: Setting default preferences for application"
);
Logger
.
d
ev
(
"SplashActivity: Setting default preferences for application"
);
SharedPreferences
.
Editor
editor
=
defaultPrefs
.
edit
();
SharedPreferences
.
Editor
editor
=
defaultPrefs
.
edit
();
Set
<
String
>
set
=
new
HashSet
<>();
Set
<
String
>
set
=
new
HashSet
<>();
set
.
add
(
"com.google.android.apps.walletnfcrel"
);
set
.
add
(
"com.google.android.apps.walletnfcrel"
);
...
...
app/src/main/java/com/topjohnwu/magisk/module/Module.java
View file @
a173179b
...
@@ -25,7 +25,7 @@ public class Module extends BaseModule {
...
@@ -25,7 +25,7 @@ public class Module extends BaseModule {
if
(
mName
==
null
)
if
(
mName
==
null
)
mName
=
mId
;
mName
=
mId
;
Logger
.
d
h
(
"Creating Module, id: "
+
mId
);
Logger
.
d
ev
(
"Creating Module, id: "
+
mId
);
mEnable
=
!
Utils
.
itemExist
(
mDisableFile
);
mEnable
=
!
Utils
.
itemExist
(
mDisableFile
);
mRemove
=
Utils
.
itemExist
(
mRemoveFile
);
mRemove
=
Utils
.
itemExist
(
mRemoveFile
);
...
...
app/src/main/java/com/topjohnwu/magisk/services/MonitorService.java
View file @
a173179b
...
@@ -65,7 +65,7 @@ public class MonitorService extends AccessibilityService {
...
@@ -65,7 +65,7 @@ public class MonitorService extends AccessibilityService {
ActivityInfo
activityInfo
=
tryGetActivity
(
componentName
);
ActivityInfo
activityInfo
=
tryGetActivity
(
componentName
);
boolean
isActivity
=
activityInfo
!=
null
;
boolean
isActivity
=
activityInfo
!=
null
;
if
(
isActivity
)
{
if
(
isActivity
)
{
Logger
.
d
h
(
"MonitorService: CurrentActivity: "
+
event
.
getPackageName
());
Logger
.
d
ev
(
"MonitorService: CurrentActivity: "
+
event
.
getPackageName
());
String
mPackage
=
componentName
.
getPackageName
();
String
mPackage
=
componentName
.
getPackageName
();
SharedPreferences
prefs
=
PreferenceManager
.
getDefaultSharedPreferences
(
getApplicationContext
());
SharedPreferences
prefs
=
PreferenceManager
.
getDefaultSharedPreferences
(
getApplicationContext
());
...
@@ -108,11 +108,11 @@ public class MonitorService extends AccessibilityService {
...
@@ -108,11 +108,11 @@ public class MonitorService extends AccessibilityService {
String
rootString
=
rootToggle
?
"on"
:
"off"
;
String
rootString
=
rootToggle
?
"on"
:
"off"
;
if
(
Utils
.
rootEnabled
()
!=
rootToggle
)
{
if
(
Utils
.
rootEnabled
()
!=
rootToggle
)
{
Logger
.
d
h
(
"MonitorService: toggling root "
+
rootString
);
Logger
.
d
ev
(
"MonitorService: toggling root "
+
rootString
);
Utils
.
toggleRoot
(
rootToggle
,
getApplicationContext
());
Utils
.
toggleRoot
(
rootToggle
,
getApplicationContext
());
if
(
Utils
.
rootEnabled
()
!=
rootToggle
)
{
if
(
Utils
.
rootEnabled
()
!=
rootToggle
)
{
Utils
.
toggleRoot
(
rootToggle
,
getApplicationContext
());
Utils
.
toggleRoot
(
rootToggle
,
getApplicationContext
());
Logger
.
d
h
(
"MonitorService: FORCING to "
+
rootString
);
Logger
.
d
ev
(
"MonitorService: FORCING to "
+
rootString
);
}
}
}
}
...
...
app/src/main/java/com/topjohnwu/magisk/services/TileServiceNewApi.java
View file @
a173179b
...
@@ -19,7 +19,7 @@ public class TileServiceNewApi extends android.service.quicksettings.TileService
...
@@ -19,7 +19,7 @@ public class TileServiceNewApi extends android.service.quicksettings.TileService
@Override
@Override
public
int
onStartCommand
(
Intent
intent
,
int
flags
,
int
startId
)
{
public
int
onStartCommand
(
Intent
intent
,
int
flags
,
int
startId
)
{
Logger
.
d
h
(
"QST (New): Service start"
);
Logger
.
d
ev
(
"QST (New): Service start"
);
return
super
.
onStartCommand
(
intent
,
flags
,
startId
);
return
super
.
onStartCommand
(
intent
,
flags
,
startId
);
}
}
...
@@ -27,7 +27,7 @@ public class TileServiceNewApi extends android.service.quicksettings.TileService
...
@@ -27,7 +27,7 @@ public class TileServiceNewApi extends android.service.quicksettings.TileService
@Override
@Override
public
void
onTileAdded
()
{
public
void
onTileAdded
()
{
super
.
onTileAdded
();
super
.
onTileAdded
();
Logger
.
d
h
(
"QST (New): Tile added"
);
Logger
.
d
ev
(
"QST (New): Tile added"
);
setupState
();
setupState
();
this
.
getQsTile
().
updateTile
();
this
.
getQsTile
().
updateTile
();
}
}
...
@@ -36,7 +36,7 @@ public class TileServiceNewApi extends android.service.quicksettings.TileService
...
@@ -36,7 +36,7 @@ public class TileServiceNewApi extends android.service.quicksettings.TileService
public
void
onClick
()
{
public
void
onClick
()
{
mRootsState
=
Utils
.
CheckRootsState
(
getApplicationContext
());
mRootsState
=
Utils
.
CheckRootsState
(
getApplicationContext
());
switchState
(
mRootsState
);
switchState
(
mRootsState
);
Logger
.
d
h
(
"QST (New): Tile clicked"
);
Logger
.
d
ev
(
"QST (New): Tile clicked"
);
}
}
...
@@ -44,13 +44,13 @@ public class TileServiceNewApi extends android.service.quicksettings.TileService
...
@@ -44,13 +44,13 @@ public class TileServiceNewApi extends android.service.quicksettings.TileService
public
void
onStartListening
()
{
public
void
onStartListening
()
{
super
.
onStartListening
();
super
.
onStartListening
();
setupState
();
setupState
();
Logger
.
d
h
(
"QST (New): Tile is listening"
);
Logger
.
d
ev
(
"QST (New): Tile is listening"
);
}
}
@Override
@Override
public
void
onStopListening
()
{
public
void
onStopListening
()
{
super
.
onStopListening
();
super
.
onStopListening
();
Logger
.
d
h
(
"QST (New): Tile stopped listening"
);
Logger
.
d
ev
(
"QST (New): Tile stopped listening"
);
}
}
private
void
setupState
()
{
private
void
setupState
()
{
...
@@ -58,11 +58,11 @@ public class TileServiceNewApi extends android.service.quicksettings.TileService
...
@@ -58,11 +58,11 @@ public class TileServiceNewApi extends android.service.quicksettings.TileService
PreferenceManager
.
getDefaultSharedPreferences
(
getApplicationContext
()).
edit
().
putBoolean
(
"autoRootEnable"
,
false
).
apply
();
PreferenceManager
.
getDefaultSharedPreferences
(
getApplicationContext
()).
edit
().
putBoolean
(
"autoRootEnable"
,
false
).
apply
();
}
}
mRootsState
=
Utils
.
CheckRootsState
(
getApplicationContext
());
mRootsState
=
Utils
.
CheckRootsState
(
getApplicationContext
());
Logger
.
d
h
(
"QST (New): SetupState"
);
Logger
.
d
ev
(
"QST (New): SetupState"
);
Icon
iconRoot
=
Icon
.
createWithResource
(
getApplicationContext
(),
R
.
drawable
.
root
);
Icon
iconRoot
=
Icon
.
createWithResource
(
getApplicationContext
(),
R
.
drawable
.
root
);
Icon
iconAuto
=
Icon
.
createWithResource
(
getApplicationContext
(),
R
.
drawable
.
ic_autoroot
);
Icon
iconAuto
=
Icon
.
createWithResource
(
getApplicationContext
(),
R
.
drawable
.
ic_autoroot
);
Tile
tile
=
getQsTile
();
Tile
tile
=
getQsTile
();
Logger
.
d
h
(
"QST: State is "
+
mRootsState
);
Logger
.
d
ev
(
"QST: State is "
+
mRootsState
);
switch
(
mRootsState
)
{
switch
(
mRootsState
)
{
case
2
:
case
2
:
...
...
app/src/main/java/com/topjohnwu/magisk/utils/Async.java
View file @
a173179b
...
@@ -3,10 +3,12 @@ package com.topjohnwu.magisk.utils;
...
@@ -3,10 +3,12 @@ package com.topjohnwu.magisk.utils;
import
android.app.ProgressDialog
;
import
android.app.ProgressDialog
;
import
android.content.Context
;
import
android.content.Context
;
import
android.content.SharedPreferences
;
import
android.content.SharedPreferences
;
import
android.database.Cursor
;
import
android.net.Uri
;
import
android.net.Uri
;
import
android.os.AsyncTask
;
import
android.os.AsyncTask
;
import
android.os.Environment
;
import
android.os.Environment
;
import
android.preference.PreferenceManager
;
import
android.preference.PreferenceManager
;
import
android.provider.OpenableColumns
;
import
android.support.v7.app.AlertDialog
;
import
android.support.v7.app.AlertDialog
;
import
android.util.Log
;
import
android.util.Log
;
import
android.widget.Toast
;
import
android.widget.Toast
;
...
@@ -124,17 +126,17 @@ public class Async {
...
@@ -124,17 +126,17 @@ public class Async {
@Override
@Override
protected
Void
doInBackground
(
Void
...
voids
)
{
protected
Void
doInBackground
(
Void
...
voids
)
{
ModulesFragment
.
listModules
.
clear
();
ModulesFragment
.
listModules
.
clear
();
Logger
.
d
h
(
"Loading modules"
);
Logger
.
d
ev
(
"Loading modules"
);
List
<
String
>
magisk
=
Utils
.
getModList
(
Utils
.
MAGISK_PATH
);
List
<
String
>
magisk
=
Utils
.
getModList
(
Utils
.
MAGISK_PATH
);
List
<
String
>
magiskCache
=
Utils
.
getModList
(
Utils
.
MAGISK_CACHE_PATH
);
List
<
String
>
magiskCache
=
Utils
.
getModList
(
Utils
.
MAGISK_CACHE_PATH
);
for
(
String
mod
:
magisk
)
{
for
(
String
mod
:
magisk
)
{
Logger
.
d
h
(
"Adding modules from "
+
mod
);
Logger
.
d
ev
(
"Adding modules from "
+
mod
);
ModulesFragment
.
listModules
.
add
(
new
Module
(
mod
));
ModulesFragment
.
listModules
.
add
(
new
Module
(
mod
));
}
}
for
(
String
mod
:
magiskCache
)
{
for
(
String
mod
:
magiskCache
)
{
Logger
.
d
h
(
"Adding cache modules from "
+
mod
);
Logger
.
d
ev
(
"Adding cache modules from "
+
mod
);
Module
cacheMod
=
new
Module
(
mod
);
Module
cacheMod
=
new
Module
(
mod
);
// Prevent people forgot to change module.prop
// Prevent people forgot to change module.prop
cacheMod
.
setCache
();
cacheMod
.
setCache
();
...
@@ -143,7 +145,7 @@ public class Async {
...
@@ -143,7 +145,7 @@ public class Async {
Collections
.
sort
(
ModulesFragment
.
listModules
,
new
Utils
.
ModuleComparator
());
Collections
.
sort
(
ModulesFragment
.
listModules
,
new
Utils
.
ModuleComparator
());
Logger
.
d
h
(
"Module load done"
);
Logger
.
d
ev
(
"Module load done"
);
return
null
;
return
null
;
}
}
...
@@ -199,7 +201,11 @@ public class Async {
...
@@ -199,7 +201,11 @@ public class Async {
public
FlashZIP
(
Context
context
,
Uri
uri
)
{
public
FlashZIP
(
Context
context
,
Uri
uri
)
{
mContext
=
context
;
mContext
=
context
;
mUri
=
uri
;
mUri
=
uri
;
mName
=
uri
.
getLastPathSegment
();
Cursor
c
=
mContext
.
getContentResolver
().
query
(
uri
,
null
,
null
,
null
,
null
);
int
nameIndex
=
c
.
getColumnIndex
(
OpenableColumns
.
DISPLAY_NAME
);
c
.
moveToFirst
();
mName
=
c
.
getString
(
nameIndex
);
c
.
close
();
copyToSD
=
false
;
copyToSD
=
false
;
}
}
...
@@ -217,7 +223,7 @@ public class Async {
...
@@ -217,7 +223,7 @@ public class Async {
}
}
outputStream
.
close
();
outputStream
.
close
();
Logger
.
d
h
(
"FlashZip: File created successfully - "
+
f
.
getPath
());
Logger
.
d
ev
(
"FlashZip: File created successfully - "
+
f
.
getPath
());
}
}
@Override
@Override
...
@@ -228,7 +234,7 @@ public class Async {
...
@@ -228,7 +234,7 @@ public class Async {
@Override
@Override
protected
Boolean
doInBackground
(
Void
...
voids
)
{
protected
Boolean
doInBackground
(
Void
...
voids
)
{
Logger
.
d
h
(
"FlashZip Running... "
+
mName
);
Logger
.
d
ev
(
"FlashZip Running... "
+
mName
);
InputStream
in
;
InputStream
in
;
try
{
try
{
try
{
try
{
...
@@ -248,13 +254,18 @@ public class Async {
...
@@ -248,13 +254,18 @@ public class Async {
e
.
printStackTrace
();
e
.
printStackTrace
();
return
false
;
return
false
;
}
}
Logger
.
dev
(
mName
+
"; "
+
mFile
.
getPath
());
// return false;
if
(
Shell
.
rootAccess
())
{
if
(
Shell
.
rootAccess
())
{
ret
=
Shell
.
su
(
ret
=
Shell
.
su
(
"unzip -o "
+
mFile
.
getPath
()
+
" META-INF/com/google/android/* -d "
+
mFile
.
getParent
(),
"unzip -o "
+
mFile
.
getPath
()
+
" META-INF/com/google/android/* -d "
+
mFile
.
getParent
(),
"BOOTMODE=true sh "
+
mFile
.
getParent
()
+
"/META-INF/com/google/android/update-binary dummy 1 "
+
mFile
.
getPath
(),
"BOOTMODE=true sh "
+
mFile
.
getParent
()
+
"/META-INF/com/google/android/update-binary dummy 1 "
+
mFile
.
getPath
(),
"if [ $? -eq 0 ]; then echo true; else echo false; fi"
"if [ $? -eq 0 ]; then echo true; else echo false; fi"
);
);
Logger
.
dh
(
"FlashZip: Console log:\n"
+
ret
);
Logger
.
dev
(
"FlashZip: Console log:"
);
for
(
String
line
:
ret
)
{
Logger
.
dev
(
line
);
}
}
}
// Copy the file to sdcard
// Copy the file to sdcard
if
(
copyToSD
)
{
if
(
copyToSD
)
{
...
@@ -272,7 +283,7 @@ public class Async {
...
@@ -272,7 +283,7 @@ public class Async {
}
}
}
}
mFile
.
delete
();
mFile
.
delete
();
return
ret
==
null
||
!
Boolean
.
parseBoolean
(
ret
.
get
(
ret
.
size
()
-
1
));
return
ret
!=
null
&&
Boolean
.
parseBoolean
(
ret
.
get
(
ret
.
size
()
-
1
));
}
}
@Override
@Override
...
@@ -285,9 +296,9 @@ public class Async {
...
@@ -285,9 +296,9 @@ public class Async {
}
else
{
}
else
{
Toast
.
makeText
(
mContext
,
mContext
.
getString
(
R
.
string
.
manual_install
,
mFile
.
getAbsolutePath
()),
Toast
.
LENGTH_LONG
).
show
();
Toast
.
makeText
(
mContext
,
mContext
.
getString
(
R
.
string
.
manual_install
,
mFile
.
getAbsolutePath
()),
Toast
.
LENGTH_LONG
).
show
();
}
}
return
;
}
else
{
done
();
}
}
done
();
}
}
protected
void
done
()
{
protected
void
done
()
{
...
...
app/src/main/java/com/topjohnwu/magisk/utils/Logger.java
View file @
a173179b
...
@@ -7,9 +7,9 @@ import android.util.Log;
...
@@ -7,9 +7,9 @@ import android.util.Log;
public
class
Logger
{
public
class
Logger
{
private
static
final
String
LOG_TAG
=
"Magisk: D
H
"
;
private
static
final
String
LOG_TAG
=
"Magisk: D
EV
"
;
public
static
void
d
h
(
String
msg
,
Object
...
args
)
{
public
static
void
d
ev
(
String
msg
,
Object
...
args
)
{
Context
context
=
null
;
Context
context
=
null
;
try
{
try
{
context
=
getApplicationUsingReflection
();
context
=
getApplicationUsingReflection
();
...
@@ -25,6 +25,18 @@ public class Logger {
...
@@ -25,6 +25,18 @@ public class Logger {
}
}
}
}
public
static
void
dev
(
String
msg
)
{
Context
context
=
null
;
try
{
context
=
getApplicationUsingReflection
();
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
if
(
PreferenceManager
.
getDefaultSharedPreferences
(
context
).
getBoolean
(
"developer_logging"
,
false
))
{
Log
.
d
(
LOG_TAG
,
msg
);
}
}
private
static
Application
getApplicationUsingReflection
()
throws
Exception
{
private
static
Application
getApplicationUsingReflection
()
throws
Exception
{
return
(
Application
)
Class
.
forName
(
"android.app.AppGlobals"
)
return
(
Application
)
Class
.
forName
(
"android.app.AppGlobals"
)
.
getMethod
(
"getInitialApplication"
).
invoke
(
null
,
(
Object
[])
null
);
.
getMethod
(
"getInitialApplication"
).
invoke
(
null
,
(
Object
[])
null
);
...
...
app/src/main/java/com/topjohnwu/magisk/utils/Utils.java
View file @
a173179b
...
@@ -92,7 +92,7 @@ public class Utils {
...
@@ -92,7 +92,7 @@ public class Utils {
public
static
boolean
autoToggleEnabled
(
Context
context
)
{
public
static
boolean
autoToggleEnabled
(
Context
context
)
{
SharedPreferences
preferences
=
PreferenceManager
.
getDefaultSharedPreferences
(
context
);
SharedPreferences
preferences
=
PreferenceManager
.
getDefaultSharedPreferences
(
context
);
Logger
.
d
h
(
"Utils: AutoRootEnableCheck is "
+
preferences
.
getBoolean
(
"autoRootEnable"
,
false
));
Logger
.
d
ev
(
"Utils: AutoRootEnableCheck is "
+
preferences
.
getBoolean
(
"autoRootEnable"
,
false
));
return
PreferenceManager
.
getDefaultSharedPreferences
(
context
).
getBoolean
(
"autoRootEnable"
,
false
);
return
PreferenceManager
.
getDefaultSharedPreferences
(
context
).
getBoolean
(
"autoRootEnable"
,
false
);
}
}
...
@@ -137,7 +137,7 @@ public class Utils {
...
@@ -137,7 +137,7 @@ public class Utils {
}
}
public
static
void
toggleAutoRoot
(
Boolean
b
,
Context
context
)
{
public
static
void
toggleAutoRoot
(
Boolean
b
,
Context
context
)
{
Logger
.
d
h
(
"Utils: toggleAutocalled for "
+
b
);
Logger
.
d
ev
(
"Utils: toggleAutocalled for "
+
b
);
if
(
Utils
.
magiskVersion
!=
-
1
)
{
if
(
Utils
.
magiskVersion
!=
-
1
)
{
if
(!
Utils
.
hasServicePermission
(
context
))
{
if
(!
Utils
.
hasServicePermission
(
context
))
{
Intent
intent
=
new
Intent
(
android
.
provider
.
Settings
.
ACTION_ACCESSIBILITY_SETTINGS
);
Intent
intent
=
new
Intent
(
android
.
provider
.
Settings
.
ACTION_ACCESSIBILITY_SETTINGS
);
...
@@ -145,7 +145,7 @@ public class Utils {
...
@@ -145,7 +145,7 @@ public class Utils {
intent
.
setFlags
(
Intent
.
FLAG_ACTIVITY_NEW_TASK
);
intent
.
setFlags
(
Intent
.
FLAG_ACTIVITY_NEW_TASK
);
context
.
startActivity
(
intent
);
context
.
startActivity
(
intent
);
}
else
{
}
else
{
Logger
.
d
h
(
"Utils: toggleAuto checks passed, setting"
+
b
);
Logger
.
d
ev
(
"Utils: toggleAuto checks passed, setting"
+
b
);
PreferenceManager
.
getDefaultSharedPreferences
(
context
).
edit
().
putBoolean
(
"autoRootEnable"
,
b
).
apply
();
PreferenceManager
.
getDefaultSharedPreferences
(
context
).
edit
().
putBoolean
(
"autoRootEnable"
,
b
).
apply
();
Intent
myServiceIntent
=
new
Intent
(
context
,
MonitorService
.
class
);
Intent
myServiceIntent
=
new
Intent
(
context
,
MonitorService
.
class
);
myServiceIntent
.
setFlags
(
Intent
.
FLAG_ACTIVITY_NEW_TASK
);
myServiceIntent
.
setFlags
(
Intent
.
FLAG_ACTIVITY_NEW_TASK
);
...
@@ -236,21 +236,21 @@ public class Utils {
...
@@ -236,21 +236,21 @@ public class Utils {
}
}
public
static
void
SetupQuickSettingsTile
(
Context
mContext
)
{
public
static
void
SetupQuickSettingsTile
(
Context
mContext
)
{
Logger
.
d
h
(
"Utils: SetupQuickSettings called"
);
Logger
.
d
ev
(
"Utils: SetupQuickSettings called"
);
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
N
)
{
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
N
)
{
Logger
.
d
h
(
"Utils: Starting N quick settings service"
);
Logger
.
d
ev
(
"Utils: Starting N quick settings service"
);
Intent
serviceIntent
=
new
Intent
(
mContext
,
TileServiceNewApi
.
class
);
Intent
serviceIntent
=
new
Intent
(
mContext
,
TileServiceNewApi
.
class
);
mContext
.
startService
(
serviceIntent
);
mContext
.
startService
(
serviceIntent
);
}
}
if
(
Build
.
VERSION
.
SDK_INT
==
Build
.
VERSION_CODES
.
M
)
{
if
(
Build
.
VERSION
.
SDK_INT
==
Build
.
VERSION_CODES
.
M
)
{
Logger
.
d
h
(
"Utils: Marshmallow build detected"
);
Logger
.
d
ev
(
"Utils: Marshmallow build detected"
);
String
mLabelString
;
String
mLabelString
;
int
mRootIcon
=
R
.
drawable
.
root_white
;
int
mRootIcon
=
R
.
drawable
.
root_white
;
int
mAutoRootIcon
=
R
.
drawable
.
ic_autoroot_white
;
int
mAutoRootIcon
=
R
.
drawable
.
ic_autoroot_white
;
int
mRootDisabled
=
R
.
drawable
.
root_grey
;
int
mRootDisabled
=
R
.
drawable
.
root_grey
;
int
mRootsState
=
CheckRootsState
(
mContext
);
int
mRootsState
=
CheckRootsState
(
mContext
);
Logger
.
d
h
(
"Utils: Root State returned as "
+
mRootsState
);
Logger
.
d
ev
(
"Utils: Root State returned as "
+
mRootsState
);
final
Intent
enableBroadcast
=
new
Intent
(
PrivateBroadcastReceiver
.
ACTION_ENABLEROOT
);
final
Intent
enableBroadcast
=
new
Intent
(
PrivateBroadcastReceiver
.
ACTION_ENABLEROOT
);
final
Intent
disableBroadcast
=
new
Intent
(
PrivateBroadcastReceiver
.
ACTION_DISABLEROOT
);
final
Intent
disableBroadcast
=
new
Intent
(
PrivateBroadcastReceiver
.
ACTION_DISABLEROOT
);
final
Intent
autoBroadcast
=
new
Intent
(
PrivateBroadcastReceiver
.
ACTION_AUTOROOT
);
final
Intent
autoBroadcast
=
new
Intent
(
PrivateBroadcastReceiver
.
ACTION_AUTOROOT
);
...
@@ -304,7 +304,7 @@ public class Utils {
...
@@ -304,7 +304,7 @@ public class Utils {
List
<
String
>
lines
=
Shell
.
su
(
"settings get secure sysui_qs_tiles"
);
List
<
String
>
lines
=
Shell
.
su
(
"settings get secure sysui_qs_tiles"
);
if
(
lines
!=
null
&&
lines
.
size
()
==
1
)
{
if
(
lines
!=
null
&&
lines
.
size
()
==
1
)
{
List
<
String
>
tiles
=
new
LinkedList
<>(
Arrays
.
asList
(
lines
.
get
(
0
).
split
(
","
)));
List
<
String
>
tiles
=
new
LinkedList
<>(
Arrays
.
asList
(
lines
.
get
(
0
).
split
(
","
)));
Logger
.
d
h
(
"Utils: Current Tile String is "
+
tiles
);
Logger
.
d
ev
(
"Utils: Current Tile String is "
+
tiles
);
if
(
tiles
.
size
()
>
1
)
{
if
(
tiles
.
size
()
>
1
)
{
for
(
String
tile
:
tiles
)
{
for
(
String
tile
:
tiles
)
{
if
(
tile
.
equals
(
qsTileId
))
{
if
(
tile
.
equals
(
qsTileId
))
{
...
@@ -315,7 +315,7 @@ public class Utils {
...
@@ -315,7 +315,7 @@ public class Utils {
tiles
.
add
(
Math
.
round
(
tiles
.
size
()
/
2
),
qsTileId
);
tiles
.
add
(
Math
.
round
(
tiles
.
size
()
/
2
),
qsTileId
);
String
newTiles
=
TextUtils
.
join
(
","
,
tiles
);
String
newTiles
=
TextUtils
.
join
(
","
,
tiles
);
Logger
.
d
h
(
"Utils: NewtilesString is "
+
newTiles
);
Logger
.
d
ev
(
"Utils: NewtilesString is "
+
newTiles
);
Shell
.
su
(
"settings put secure sysui_qs_tiles \""
+
newTiles
+
"\""
);
Shell
.
su
(
"settings put secure sysui_qs_tiles \""
+
newTiles
+
"\""
);
Toast
.
makeText
(
context
,
"Tile installed"
,
Toast
.
LENGTH_SHORT
).
show
();
Toast
.
makeText
(
context
,
"Tile installed"
,
Toast
.
LENGTH_SHORT
).
show
();
if
(
Build
.
VERSION
.
SDK_INT
==
Build
.
VERSION_CODES
.
M
)
{
if
(
Build
.
VERSION
.
SDK_INT
==
Build
.
VERSION_CODES
.
M
)
{
...
...
app/src/main/java/com/topjohnwu/magisk/utils/WebRequest.java
View file @
a173179b
package
com
.
topjohnwu
.
magisk
.
utils
;
package
com
.
topjohnwu
.
magisk
.
utils
;
import
android.util.Log
;
import
java.io.BufferedReader
;
import
java.io.BufferedReader
;
import
java.io.BufferedWriter
;
import
java.io.BufferedWriter
;
import
java.io.InputStreamReader
;
import
java.io.InputStreamReader
;
...
@@ -52,7 +50,7 @@ public class WebRequest {
...
@@ -52,7 +50,7 @@ public class WebRequest {
*/
*/
public
static
String
makeWebServiceCall
(
String
urladdress
,
int
requestmethod
,
public
static
String
makeWebServiceCall
(
String
urladdress
,
int
requestmethod
,
HashMap
<
String
,
String
>
params
,
boolean
addNewLines
)
{
HashMap
<
String
,
String
>
params
,
boolean
addNewLines
)
{
Logger
.
d
h
(
"WebRequest: Service call "
+
urladdress
);
Logger
.
d
ev
(
"WebRequest: Service call "
+
urladdress
);
URL
url
;
URL
url
;
String
response
=
""
;
String
response
=
""
;
try
{
try
{
...
...
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