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
70dd2d48
Commit
70dd2d48
authored
Jul 31, 2018
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More moving
parent
914b7ee0
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
174 additions
and
167 deletions
+174
-167
Global.java
app/src/full/java/com/topjohnwu/magisk/Global.java
+132
-0
LogFragment.java
app/src/full/java/com/topjohnwu/magisk/LogFragment.java
+1
-1
MagiskManager.java
app/src/full/java/com/topjohnwu/magisk/MagiskManager.java
+4
-131
MainActivity.java
app/src/full/java/com/topjohnwu/magisk/MainActivity.java
+1
-1
ReposFragment.java
app/src/full/java/com/topjohnwu/magisk/ReposFragment.java
+3
-3
SettingsActivity.java
app/src/full/java/com/topjohnwu/magisk/SettingsActivity.java
+12
-12
SplashActivity.java
app/src/full/java/com/topjohnwu/magisk/SplashActivity.java
+2
-2
CheckUpdates.java
...c/full/java/com/topjohnwu/magisk/asyncs/CheckUpdates.java
+1
-1
HideManager.java
...rc/full/java/com/topjohnwu/magisk/asyncs/HideManager.java
+1
-1
InstallMagisk.java
.../full/java/com/topjohnwu/magisk/asyncs/InstallMagisk.java
+3
-3
MarkDownWindow.java
...full/java/com/topjohnwu/magisk/asyncs/MarkDownWindow.java
+3
-3
FlavorActivity.java
.../java/com/topjohnwu/magisk/components/FlavorActivity.java
+2
-1
InstallMethodDialog.java
.../com/topjohnwu/magisk/components/InstallMethodDialog.java
+1
-1
UninstallDialog.java
...java/com/topjohnwu/magisk/components/UninstallDialog.java
+1
-1
MagiskDatabaseHelper.java
...a/com/topjohnwu/magisk/database/MagiskDatabaseHelper.java
+1
-1
RepoDatabaseHelper.java
...ava/com/topjohnwu/magisk/database/RepoDatabaseHelper.java
+1
-1
ShortcutReceiver.java
...java/com/topjohnwu/magisk/receivers/ShortcutReceiver.java
+1
-1
RequestActivity.java
.../java/com/topjohnwu/magisk/superuser/RequestActivity.java
+3
-2
SuReceiver.java
.../full/java/com/topjohnwu/magisk/superuser/SuReceiver.java
+1
-1
No files found.
app/src/full/java/com/topjohnwu/magisk/Global.java
View file @
70dd2d48
package
com
.
topjohnwu
.
magisk
;
package
com
.
topjohnwu
.
magisk
;
import
android.content.SharedPreferences
;
import
android.os.Handler
;
import
android.os.Handler
;
import
android.os.Looper
;
import
android.os.Looper
;
import
android.util.Xml
;
import
android.widget.Toast
;
import
android.widget.Toast
;
import
com.topjohnwu.magisk.utils.Const
;
import
com.topjohnwu.magisk.utils.Const
;
import
com.topjohnwu.magisk.utils.Utils
;
import
com.topjohnwu.superuser.Shell
;
import
com.topjohnwu.superuser.ShellUtils
;
import
com.topjohnwu.superuser.ShellUtils
;
import
com.topjohnwu.superuser.io.SuFile
;
import
com.topjohnwu.superuser.io.SuFileInputStream
;
import
org.xmlpull.v1.XmlPullParser
;
import
org.xmlpull.v1.XmlPullParserException
;
import
java.io.File
;
import
java.io.IOException
;
import
java.lang.ref.WeakReference
;
import
java.lang.ref.WeakReference
;
public
class
Global
{
public
class
Global
{
...
@@ -34,6 +45,20 @@ public class Global {
...
@@ -34,6 +45,20 @@ public class Global {
public
static
boolean
keepVerity
=
false
;
public
static
boolean
keepVerity
=
false
;
public
static
boolean
keepEnc
=
false
;
public
static
boolean
keepEnc
=
false
;
// Configs
public
static
boolean
isDarkTheme
;
public
static
int
suRequestTimeout
;
public
static
int
suLogTimeout
=
14
;
public
static
int
suAccessState
;
public
static
int
multiuserMode
;
public
static
int
suResponseType
;
public
static
int
suNotificationType
;
public
static
int
suNamespaceMode
;
public
static
String
localeConfig
;
public
static
int
updateChannel
;
public
static
String
bootFormat
;
public
static
int
repoOrder
;
public
static
void
loadMagiskInfo
()
{
public
static
void
loadMagiskInfo
()
{
try
{
try
{
magiskVersionString
=
ShellUtils
.
fastCmd
(
"magisk -v"
).
split
(
":"
)[
0
];
magiskVersionString
=
ShellUtils
.
fastCmd
(
"magisk -v"
).
split
(
":"
)[
0
];
...
@@ -55,4 +80,111 @@ public class Global {
...
@@ -55,4 +80,111 @@ public class Global {
public
static
void
toast
(
int
resId
,
int
duration
)
{
public
static
void
toast
(
int
resId
,
int
duration
)
{
mainHandler
.
post
(()
->
Toast
.
makeText
(
MM
(),
resId
,
duration
).
show
());
mainHandler
.
post
(()
->
Toast
.
makeText
(
MM
(),
resId
,
duration
).
show
());
}
}
public
static
void
exportPrefs
()
{
// Flush prefs to disk
MagiskManager
mm
=
MM
();
mm
.
prefs
.
edit
().
commit
();
File
xml
=
new
File
(
mm
.
getFilesDir
().
getParent
()
+
"/shared_prefs"
,
mm
.
getPackageName
()
+
"_preferences.xml"
);
Shell
.
su
(
Utils
.
fmt
(
"for usr in /data/user/*; do cat %s > ${usr}/%s; done"
,
xml
,
Const
.
MANAGER_CONFIGS
)).
exec
();
}
public
static
void
importPrefs
()
{
MagiskManager
mm
=
MM
();
SuFile
config
=
new
SuFile
(
Utils
.
fmt
(
"/data/user/%d/%s"
,
Const
.
USER_ID
,
Const
.
MANAGER_CONFIGS
));
if
(
config
.
exists
())
{
SharedPreferences
.
Editor
editor
=
mm
.
prefs
.
edit
();
try
{
SuFileInputStream
is
=
new
SuFileInputStream
(
config
);
XmlPullParser
parser
=
Xml
.
newPullParser
();
parser
.
setFeature
(
XmlPullParser
.
FEATURE_PROCESS_NAMESPACES
,
false
);
parser
.
setInput
(
is
,
"UTF-8"
);
parser
.
nextTag
();
parser
.
require
(
XmlPullParser
.
START_TAG
,
null
,
"map"
);
while
(
parser
.
next
()
!=
XmlPullParser
.
END_TAG
)
{
if
(
parser
.
getEventType
()
!=
XmlPullParser
.
START_TAG
)
continue
;
String
key
=
parser
.
getAttributeValue
(
null
,
"name"
);
String
value
=
parser
.
getAttributeValue
(
null
,
"value"
);
switch
(
parser
.
getName
())
{
case
"string"
:
parser
.
require
(
XmlPullParser
.
START_TAG
,
null
,
"string"
);
editor
.
putString
(
key
,
parser
.
nextText
());
parser
.
require
(
XmlPullParser
.
END_TAG
,
null
,
"string"
);
break
;
case
"boolean"
:
parser
.
require
(
XmlPullParser
.
START_TAG
,
null
,
"boolean"
);
editor
.
putBoolean
(
key
,
Boolean
.
parseBoolean
(
value
));
parser
.
nextTag
();
parser
.
require
(
XmlPullParser
.
END_TAG
,
null
,
"boolean"
);
break
;
case
"int"
:
parser
.
require
(
XmlPullParser
.
START_TAG
,
null
,
"int"
);
editor
.
putInt
(
key
,
Integer
.
parseInt
(
value
));
parser
.
nextTag
();
parser
.
require
(
XmlPullParser
.
END_TAG
,
null
,
"int"
);
break
;
case
"long"
:
parser
.
require
(
XmlPullParser
.
START_TAG
,
null
,
"long"
);
editor
.
putLong
(
key
,
Long
.
parseLong
(
value
));
parser
.
nextTag
();
parser
.
require
(
XmlPullParser
.
END_TAG
,
null
,
"long"
);
break
;
case
"float"
:
parser
.
require
(
XmlPullParser
.
START_TAG
,
null
,
"int"
);
editor
.
putFloat
(
key
,
Float
.
parseFloat
(
value
));
parser
.
nextTag
();
parser
.
require
(
XmlPullParser
.
END_TAG
,
null
,
"int"
);
break
;
default
:
parser
.
next
();
}
}
}
catch
(
IOException
|
XmlPullParserException
e
)
{
e
.
printStackTrace
();
}
editor
.
remove
(
Const
.
Key
.
ETAG_KEY
);
editor
.
apply
();
loadConfig
();
config
.
delete
();
}
}
public
static
void
loadConfig
()
{
MagiskManager
mm
=
MM
();
// su
suRequestTimeout
=
Utils
.
getPrefsInt
(
mm
.
prefs
,
Const
.
Key
.
SU_REQUEST_TIMEOUT
,
Const
.
Value
.
timeoutList
[
2
]);
suResponseType
=
Utils
.
getPrefsInt
(
mm
.
prefs
,
Const
.
Key
.
SU_AUTO_RESPONSE
,
Const
.
Value
.
SU_PROMPT
);
suNotificationType
=
Utils
.
getPrefsInt
(
mm
.
prefs
,
Const
.
Key
.
SU_NOTIFICATION
,
Const
.
Value
.
NOTIFICATION_TOAST
);
suAccessState
=
mm
.
mDB
.
getSettings
(
Const
.
Key
.
ROOT_ACCESS
,
Const
.
Value
.
ROOT_ACCESS_APPS_AND_ADB
);
multiuserMode
=
mm
.
mDB
.
getSettings
(
Const
.
Key
.
SU_MULTIUSER_MODE
,
Const
.
Value
.
MULTIUSER_MODE_OWNER_ONLY
);
suNamespaceMode
=
mm
.
mDB
.
getSettings
(
Const
.
Key
.
SU_MNT_NS
,
Const
.
Value
.
NAMESPACE_MODE_REQUESTER
);
// config
isDarkTheme
=
mm
.
prefs
.
getBoolean
(
Const
.
Key
.
DARK_THEME
,
false
);
updateChannel
=
Utils
.
getPrefsInt
(
mm
.
prefs
,
Const
.
Key
.
UPDATE_CHANNEL
,
Const
.
Value
.
STABLE_CHANNEL
);
bootFormat
=
mm
.
prefs
.
getString
(
Const
.
Key
.
BOOT_FORMAT
,
".img"
);
repoOrder
=
mm
.
prefs
.
getInt
(
Const
.
Key
.
REPO_ORDER
,
Const
.
Value
.
ORDER_NAME
);
}
public
static
void
writeConfig
()
{
MM
().
prefs
.
edit
()
.
putBoolean
(
Const
.
Key
.
DARK_THEME
,
isDarkTheme
)
.
putBoolean
(
Const
.
Key
.
MAGISKHIDE
,
magiskHide
)
.
putBoolean
(
Const
.
Key
.
HOSTS
,
Const
.
MAGISK_HOST_FILE
.
exists
())
.
putBoolean
(
Const
.
Key
.
COREONLY
,
Const
.
MAGISK_DISABLE_FILE
.
exists
())
.
putString
(
Const
.
Key
.
SU_REQUEST_TIMEOUT
,
String
.
valueOf
(
suRequestTimeout
))
.
putString
(
Const
.
Key
.
SU_AUTO_RESPONSE
,
String
.
valueOf
(
suResponseType
))
.
putString
(
Const
.
Key
.
SU_NOTIFICATION
,
String
.
valueOf
(
suNotificationType
))
.
putString
(
Const
.
Key
.
ROOT_ACCESS
,
String
.
valueOf
(
suAccessState
))
.
putString
(
Const
.
Key
.
SU_MULTIUSER_MODE
,
String
.
valueOf
(
multiuserMode
))
.
putString
(
Const
.
Key
.
SU_MNT_NS
,
String
.
valueOf
(
suNamespaceMode
))
.
putString
(
Const
.
Key
.
UPDATE_CHANNEL
,
String
.
valueOf
(
updateChannel
))
.
putString
(
Const
.
Key
.
LOCALE
,
localeConfig
)
.
putString
(
Const
.
Key
.
BOOT_FORMAT
,
bootFormat
)
.
putInt
(
Const
.
Key
.
UPDATE_SERVICE_VER
,
Const
.
UPDATE_SERVICE_VER
)
.
putInt
(
Const
.
Key
.
REPO_ORDER
,
repoOrder
)
.
apply
();
}
}
}
app/src/full/java/com/topjohnwu/magisk/LogFragment.java
View file @
70dd2d48
...
@@ -34,7 +34,7 @@ public class LogFragment extends Fragment {
...
@@ -34,7 +34,7 @@ public class LogFragment extends Fragment {
TabFragmentAdapter
adapter
=
new
TabFragmentAdapter
(
getChildFragmentManager
());
TabFragmentAdapter
adapter
=
new
TabFragmentAdapter
(
getChildFragmentManager
());
if
(!(
Const
.
USER_ID
>
0
&&
getApplication
()
.
multiuserMode
==
Const
.
Value
.
MULTIUSER_MODE_OWNER_MANAGED
))
{
if
(!(
Const
.
USER_ID
>
0
&&
Global
.
multiuserMode
==
Const
.
Value
.
MULTIUSER_MODE_OWNER_MANAGED
))
{
adapter
.
addTab
(
new
SuLogFragment
(),
getString
(
R
.
string
.
superuser
));
adapter
.
addTab
(
new
SuLogFragment
(),
getString
(
R
.
string
.
superuser
));
}
}
adapter
.
addTab
(
new
MagiskLogFragment
(),
getString
(
R
.
string
.
magisk
));
adapter
.
addTab
(
new
MagiskLogFragment
(),
getString
(
R
.
string
.
magisk
));
...
...
app/src/full/java/com/topjohnwu/magisk/MagiskManager.java
View file @
70dd2d48
...
@@ -4,11 +4,8 @@ import android.content.SharedPreferences;
...
@@ -4,11 +4,8 @@ import android.content.SharedPreferences;
import
android.content.pm.PackageManager
;
import
android.content.pm.PackageManager
;
import
android.content.res.Configuration
;
import
android.content.res.Configuration
;
import
android.content.res.Resources
;
import
android.content.res.Resources
;
import
android.os.Handler
;
import
android.preference.PreferenceManager
;
import
android.preference.PreferenceManager
;
import
android.text.TextUtils
;
import
android.text.TextUtils
;
import
android.util.Xml
;
import
android.widget.Toast
;
import
com.topjohnwu.magisk.container.Module
;
import
com.topjohnwu.magisk.container.Module
;
import
com.topjohnwu.magisk.database.MagiskDatabaseHelper
;
import
com.topjohnwu.magisk.database.MagiskDatabaseHelper
;
...
@@ -16,17 +13,9 @@ import com.topjohnwu.magisk.database.RepoDatabaseHelper;
...
@@ -16,17 +13,9 @@ import com.topjohnwu.magisk.database.RepoDatabaseHelper;
import
com.topjohnwu.magisk.utils.Const
;
import
com.topjohnwu.magisk.utils.Const
;
import
com.topjohnwu.magisk.utils.RootUtils
;
import
com.topjohnwu.magisk.utils.RootUtils
;
import
com.topjohnwu.magisk.utils.Topic
;
import
com.topjohnwu.magisk.utils.Topic
;
import
com.topjohnwu.magisk.utils.Utils
;
import
com.topjohnwu.superuser.ContainerApp
;
import
com.topjohnwu.superuser.ContainerApp
;
import
com.topjohnwu.superuser.Shell
;
import
com.topjohnwu.superuser.Shell
;
import
com.topjohnwu.superuser.io.SuFile
;
import
com.topjohnwu.superuser.io.SuFileInputStream
;
import
org.xmlpull.v1.XmlPullParser
;
import
org.xmlpull.v1.XmlPullParserException
;
import
java.io.File
;
import
java.io.IOException
;
import
java.lang.ref.WeakReference
;
import
java.lang.ref.WeakReference
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Locale
;
import
java.util.Locale
;
...
@@ -53,19 +42,6 @@ public class MagiskManager extends ContainerApp {
...
@@ -53,19 +42,6 @@ public class MagiskManager extends ContainerApp {
public
Map
<
String
,
Module
>
moduleMap
;
public
Map
<
String
,
Module
>
moduleMap
;
public
List
<
Locale
>
locales
;
public
List
<
Locale
>
locales
;
public
boolean
isDarkTheme
;
public
int
suRequestTimeout
;
public
int
suLogTimeout
=
14
;
public
int
suAccessState
;
public
int
multiuserMode
;
public
int
suResponseType
;
public
int
suNotificationType
;
public
int
suNamespaceMode
;
public
String
localeConfig
;
public
int
updateChannel
;
public
String
bootFormat
;
public
int
repoOrder
;
// Global resources
// Global resources
public
SharedPreferences
prefs
;
public
SharedPreferences
prefs
;
public
MagiskDatabaseHelper
mDB
;
public
MagiskDatabaseHelper
mDB
;
...
@@ -101,15 +77,15 @@ public class MagiskManager extends ContainerApp {
...
@@ -101,15 +77,15 @@ public class MagiskManager extends ContainerApp {
}
}
setLocale
();
setLocale
();
loadConfig
();
Global
.
loadConfig
();
}
}
public
void
setLocale
()
{
public
void
setLocale
()
{
localeConfig
=
prefs
.
getString
(
Const
.
Key
.
LOCALE
,
""
);
Global
.
localeConfig
=
prefs
.
getString
(
Const
.
Key
.
LOCALE
,
""
);
if
(
localeConfig
.
isEmpty
())
{
if
(
Global
.
localeConfig
.
isEmpty
())
{
locale
=
defaultLocale
;
locale
=
defaultLocale
;
}
else
{
}
else
{
locale
=
Locale
.
forLanguageTag
(
localeConfig
);
locale
=
Locale
.
forLanguageTag
(
Global
.
localeConfig
);
}
}
Resources
res
=
getBaseContext
().
getResources
();
Resources
res
=
getBaseContext
().
getResources
();
Configuration
config
=
new
Configuration
(
res
.
getConfiguration
());
Configuration
config
=
new
Configuration
(
res
.
getConfiguration
());
...
@@ -117,107 +93,4 @@ public class MagiskManager extends ContainerApp {
...
@@ -117,107 +93,4 @@ public class MagiskManager extends ContainerApp {
res
.
updateConfiguration
(
config
,
res
.
getDisplayMetrics
());
res
.
updateConfiguration
(
config
,
res
.
getDisplayMetrics
());
}
}
public
void
loadConfig
()
{
// su
suRequestTimeout
=
Utils
.
getPrefsInt
(
prefs
,
Const
.
Key
.
SU_REQUEST_TIMEOUT
,
Const
.
Value
.
timeoutList
[
2
]);
suResponseType
=
Utils
.
getPrefsInt
(
prefs
,
Const
.
Key
.
SU_AUTO_RESPONSE
,
Const
.
Value
.
SU_PROMPT
);
suNotificationType
=
Utils
.
getPrefsInt
(
prefs
,
Const
.
Key
.
SU_NOTIFICATION
,
Const
.
Value
.
NOTIFICATION_TOAST
);
suAccessState
=
mDB
.
getSettings
(
Const
.
Key
.
ROOT_ACCESS
,
Const
.
Value
.
ROOT_ACCESS_APPS_AND_ADB
);
multiuserMode
=
mDB
.
getSettings
(
Const
.
Key
.
SU_MULTIUSER_MODE
,
Const
.
Value
.
MULTIUSER_MODE_OWNER_ONLY
);
suNamespaceMode
=
mDB
.
getSettings
(
Const
.
Key
.
SU_MNT_NS
,
Const
.
Value
.
NAMESPACE_MODE_REQUESTER
);
// config
isDarkTheme
=
prefs
.
getBoolean
(
Const
.
Key
.
DARK_THEME
,
false
);
updateChannel
=
Utils
.
getPrefsInt
(
prefs
,
Const
.
Key
.
UPDATE_CHANNEL
,
Const
.
Value
.
STABLE_CHANNEL
);
bootFormat
=
prefs
.
getString
(
Const
.
Key
.
BOOT_FORMAT
,
".img"
);
repoOrder
=
prefs
.
getInt
(
Const
.
Key
.
REPO_ORDER
,
Const
.
Value
.
ORDER_NAME
);
}
public
void
writeConfig
()
{
prefs
.
edit
()
.
putBoolean
(
Const
.
Key
.
DARK_THEME
,
isDarkTheme
)
.
putBoolean
(
Const
.
Key
.
MAGISKHIDE
,
Global
.
magiskHide
)
.
putBoolean
(
Const
.
Key
.
HOSTS
,
Const
.
MAGISK_HOST_FILE
.
exists
())
.
putBoolean
(
Const
.
Key
.
COREONLY
,
Const
.
MAGISK_DISABLE_FILE
.
exists
())
.
putString
(
Const
.
Key
.
SU_REQUEST_TIMEOUT
,
String
.
valueOf
(
suRequestTimeout
))
.
putString
(
Const
.
Key
.
SU_AUTO_RESPONSE
,
String
.
valueOf
(
suResponseType
))
.
putString
(
Const
.
Key
.
SU_NOTIFICATION
,
String
.
valueOf
(
suNotificationType
))
.
putString
(
Const
.
Key
.
ROOT_ACCESS
,
String
.
valueOf
(
suAccessState
))
.
putString
(
Const
.
Key
.
SU_MULTIUSER_MODE
,
String
.
valueOf
(
multiuserMode
))
.
putString
(
Const
.
Key
.
SU_MNT_NS
,
String
.
valueOf
(
suNamespaceMode
))
.
putString
(
Const
.
Key
.
UPDATE_CHANNEL
,
String
.
valueOf
(
updateChannel
))
.
putString
(
Const
.
Key
.
LOCALE
,
localeConfig
)
.
putString
(
Const
.
Key
.
BOOT_FORMAT
,
bootFormat
)
.
putInt
(
Const
.
Key
.
UPDATE_SERVICE_VER
,
Const
.
UPDATE_SERVICE_VER
)
.
putInt
(
Const
.
Key
.
REPO_ORDER
,
repoOrder
)
.
apply
();
}
public
void
dumpPrefs
()
{
// Flush prefs to disk
prefs
.
edit
().
commit
();
File
xml
=
new
File
(
getFilesDir
().
getParent
()
+
"/shared_prefs"
,
getPackageName
()
+
"_preferences.xml"
);
Shell
.
su
(
Utils
.
fmt
(
"for usr in /data/user/*; do cat %s > ${usr}/%s; done"
,
xml
,
Const
.
MANAGER_CONFIGS
)).
exec
();
}
public
void
loadPrefs
()
{
SuFile
config
=
new
SuFile
(
Utils
.
fmt
(
"/data/user/%d/%s"
,
Const
.
USER_ID
,
Const
.
MANAGER_CONFIGS
));
if
(
config
.
exists
())
{
SharedPreferences
.
Editor
editor
=
prefs
.
edit
();
try
{
SuFileInputStream
is
=
new
SuFileInputStream
(
config
);
XmlPullParser
parser
=
Xml
.
newPullParser
();
parser
.
setFeature
(
XmlPullParser
.
FEATURE_PROCESS_NAMESPACES
,
false
);
parser
.
setInput
(
is
,
"UTF-8"
);
parser
.
nextTag
();
parser
.
require
(
XmlPullParser
.
START_TAG
,
null
,
"map"
);
while
(
parser
.
next
()
!=
XmlPullParser
.
END_TAG
)
{
if
(
parser
.
getEventType
()
!=
XmlPullParser
.
START_TAG
)
continue
;
String
key
=
parser
.
getAttributeValue
(
null
,
"name"
);
String
value
=
parser
.
getAttributeValue
(
null
,
"value"
);
switch
(
parser
.
getName
())
{
case
"string"
:
parser
.
require
(
XmlPullParser
.
START_TAG
,
null
,
"string"
);
editor
.
putString
(
key
,
parser
.
nextText
());
parser
.
require
(
XmlPullParser
.
END_TAG
,
null
,
"string"
);
break
;
case
"boolean"
:
parser
.
require
(
XmlPullParser
.
START_TAG
,
null
,
"boolean"
);
editor
.
putBoolean
(
key
,
Boolean
.
parseBoolean
(
value
));
parser
.
nextTag
();
parser
.
require
(
XmlPullParser
.
END_TAG
,
null
,
"boolean"
);
break
;
case
"int"
:
parser
.
require
(
XmlPullParser
.
START_TAG
,
null
,
"int"
);
editor
.
putInt
(
key
,
Integer
.
parseInt
(
value
));
parser
.
nextTag
();
parser
.
require
(
XmlPullParser
.
END_TAG
,
null
,
"int"
);
break
;
case
"long"
:
parser
.
require
(
XmlPullParser
.
START_TAG
,
null
,
"long"
);
editor
.
putLong
(
key
,
Long
.
parseLong
(
value
));
parser
.
nextTag
();
parser
.
require
(
XmlPullParser
.
END_TAG
,
null
,
"long"
);
break
;
case
"float"
:
parser
.
require
(
XmlPullParser
.
START_TAG
,
null
,
"int"
);
editor
.
putFloat
(
key
,
Float
.
parseFloat
(
value
));
parser
.
nextTag
();
parser
.
require
(
XmlPullParser
.
END_TAG
,
null
,
"int"
);
break
;
default
:
parser
.
next
();
}
}
}
catch
(
IOException
|
XmlPullParserException
e
)
{
e
.
printStackTrace
();
}
editor
.
remove
(
Const
.
Key
.
ETAG_KEY
);
editor
.
apply
();
loadConfig
();
config
.
delete
();
}
}
}
}
app/src/full/java/com/topjohnwu/magisk/MainActivity.java
View file @
70dd2d48
...
@@ -133,7 +133,7 @@ public class MainActivity extends Activity
...
@@ -133,7 +133,7 @@ public class MainActivity extends Activity
&&
Download
.
checkNetworkStatus
(
this
)
&&
Shell
.
rootAccess
()
&&
Global
.
magiskVersionCode
>=
0
);
&&
Download
.
checkNetworkStatus
(
this
)
&&
Shell
.
rootAccess
()
&&
Global
.
magiskVersionCode
>=
0
);
menu
.
findItem
(
R
.
id
.
log
).
setVisible
(
Shell
.
rootAccess
());
menu
.
findItem
(
R
.
id
.
log
).
setVisible
(
Shell
.
rootAccess
());
menu
.
findItem
(
R
.
id
.
superuser
).
setVisible
(
Shell
.
rootAccess
()
&&
menu
.
findItem
(
R
.
id
.
superuser
).
setVisible
(
Shell
.
rootAccess
()
&&
!(
Const
.
USER_ID
>
0
&&
mm
.
multiuserMode
==
Const
.
Value
.
MULTIUSER_MODE_OWNER_MANAGED
));
!(
Const
.
USER_ID
>
0
&&
Global
.
multiuserMode
==
Const
.
Value
.
MULTIUSER_MODE_OWNER_MANAGED
));
}
}
public
void
navigate
(
String
item
)
{
public
void
navigate
(
String
item
)
{
...
...
app/src/full/java/com/topjohnwu/magisk/ReposFragment.java
View file @
70dd2d48
...
@@ -108,9 +108,9 @@ public class ReposFragment extends Fragment implements Topic.Subscriber {
...
@@ -108,9 +108,9 @@ public class ReposFragment extends Fragment implements Topic.Subscriber {
if
(
item
.
getItemId
()
==
R
.
id
.
repo_sort
)
{
if
(
item
.
getItemId
()
==
R
.
id
.
repo_sort
)
{
new
AlertDialog
.
Builder
(
getActivity
())
new
AlertDialog
.
Builder
(
getActivity
())
.
setTitle
(
R
.
string
.
sorting_order
)
.
setTitle
(
R
.
string
.
sorting_order
)
.
setSingleChoiceItems
(
R
.
array
.
sorting_orders
,
mm
.
repoOrder
,
(
d
,
which
)
->
{
.
setSingleChoiceItems
(
R
.
array
.
sorting_orders
,
Global
.
repoOrder
,
(
d
,
which
)
->
{
mm
.
repoOrder
=
which
;
Global
.
repoOrder
=
which
;
mm
.
prefs
.
edit
().
putInt
(
Const
.
Key
.
REPO_ORDER
,
mm
.
repoOrder
).
apply
();
mm
.
prefs
.
edit
().
putInt
(
Const
.
Key
.
REPO_ORDER
,
Global
.
repoOrder
).
apply
();
adapter
.
notifyDBChanged
();
adapter
.
notifyDBChanged
();
d
.
dismiss
();
d
.
dismiss
();
}).
show
();
}).
show
();
...
...
app/src/full/java/com/topjohnwu/magisk/SettingsActivity.java
View file @
70dd2d48
...
@@ -123,8 +123,8 @@ public class SettingsActivity extends Activity implements Topic.Subscriber {
...
@@ -123,8 +123,8 @@ public class SettingsActivity extends Activity implements Topic.Subscriber {
SwitchPreference
fingerprint
=
(
SwitchPreference
)
findPreference
(
Const
.
Key
.
SU_FINGERPRINT
);
SwitchPreference
fingerprint
=
(
SwitchPreference
)
findPreference
(
Const
.
Key
.
SU_FINGERPRINT
);
updateChannel
.
setOnPreferenceChangeListener
((
pref
,
o
)
->
{
updateChannel
.
setOnPreferenceChangeListener
((
pref
,
o
)
->
{
mm
.
updateChannel
=
Integer
.
parseInt
((
String
)
o
);
Global
.
updateChannel
=
Integer
.
parseInt
((
String
)
o
);
if
(
mm
.
updateChannel
==
Const
.
Value
.
CUSTOM_CHANNEL
)
{
if
(
Global
.
updateChannel
==
Const
.
Value
.
CUSTOM_CHANNEL
)
{
View
v
=
LayoutInflater
.
from
(
getActivity
()).
inflate
(
R
.
layout
.
custom_channel_dialog
,
null
);
View
v
=
LayoutInflater
.
from
(
getActivity
()).
inflate
(
R
.
layout
.
custom_channel_dialog
,
null
);
EditText
url
=
v
.
findViewById
(
R
.
id
.
custom_url
);
EditText
url
=
v
.
findViewById
(
R
.
id
.
custom_url
);
url
.
setText
(
mm
.
prefs
.
getString
(
Const
.
Key
.
CUSTOM_CHANNEL
,
""
));
url
.
setText
(
mm
.
prefs
.
getString
(
Const
.
Key
.
CUSTOM_CHANNEL
,
""
));
...
@@ -173,7 +173,7 @@ public class SettingsActivity extends Activity implements Topic.Subscriber {
...
@@ -173,7 +173,7 @@ public class SettingsActivity extends Activity implements Topic.Subscriber {
getActivity
(),
new
DownloadReceiver
()
{
getActivity
(),
new
DownloadReceiver
()
{
@Override
@Override
public
void
onDownloadDone
(
Context
context
,
Uri
uri
)
{
public
void
onDownloadDone
(
Context
context
,
Uri
uri
)
{
mm
.
dump
Prefs
();
Global
.
export
Prefs
();
Shell
.
su
(
"cp "
+
uri
.
getPath
()
+
" /data/local/tmp/manager.apk"
).
exec
();
Shell
.
su
(
"cp "
+
uri
.
getPath
()
+
" /data/local/tmp/manager.apk"
).
exec
();
if
(
ShellUtils
.
fastCmdResult
(
"pm install /data/local/tmp/manager.apk"
))
{
if
(
ShellUtils
.
fastCmdResult
(
"pm install /data/local/tmp/manager.apk"
))
{
Shell
.
su
(
"rm -f /data/local/tmp/manager.apk"
).
exec
();
Shell
.
su
(
"rm -f /data/local/tmp/manager.apk"
).
exec
();
...
@@ -199,7 +199,7 @@ public class SettingsActivity extends Activity implements Topic.Subscriber {
...
@@ -199,7 +199,7 @@ public class SettingsActivity extends Activity implements Topic.Subscriber {
}
}
if
(!
Shell
.
rootAccess
()
||
(
Const
.
USER_ID
>
0
&&
if
(!
Shell
.
rootAccess
()
||
(
Const
.
USER_ID
>
0
&&
mm
.
multiuserMode
==
Const
.
Value
.
MULTIUSER_MODE_OWNER_MANAGED
))
{
Global
.
multiuserMode
==
Const
.
Value
.
MULTIUSER_MODE_OWNER_MANAGED
))
{
prefScreen
.
removePreference
(
suCategory
);
prefScreen
.
removePreference
(
suCategory
);
}
}
...
@@ -245,7 +245,7 @@ public class SettingsActivity extends Activity implements Topic.Subscriber {
...
@@ -245,7 +245,7 @@ public class SettingsActivity extends Activity implements Topic.Subscriber {
switch
(
key
)
{
switch
(
key
)
{
case
Const
.
Key
.
DARK_THEME
:
case
Const
.
Key
.
DARK_THEME
:
mm
.
isDarkTheme
=
prefs
.
getBoolean
(
key
,
false
);
Global
.
isDarkTheme
=
prefs
.
getBoolean
(
key
,
false
);
mm
.
reloadActivity
.
publish
(
false
);
mm
.
reloadActivity
.
publish
(
false
);
return
;
return
;
case
Const
.
Key
.
COREONLY
:
case
Const
.
Key
.
COREONLY
:
...
@@ -292,25 +292,25 @@ public class SettingsActivity extends Activity implements Topic.Subscriber {
...
@@ -292,25 +292,25 @@ public class SettingsActivity extends Activity implements Topic.Subscriber {
Utils
.
setupUpdateCheck
();
Utils
.
setupUpdateCheck
();
break
;
break
;
}
}
mm
.
loadConfig
();
Global
.
loadConfig
();
setSummary
();
setSummary
();
}
}
private
void
setSummary
()
{
private
void
setSummary
()
{
updateChannel
.
setSummary
(
getResources
()
updateChannel
.
setSummary
(
getResources
()
.
getStringArray
(
R
.
array
.
update_channel
)[
mm
.
updateChannel
]);
.
getStringArray
(
R
.
array
.
update_channel
)[
Global
.
updateChannel
]);
suAccess
.
setSummary
(
getResources
()
suAccess
.
setSummary
(
getResources
()
.
getStringArray
(
R
.
array
.
su_access
)[
mm
.
suAccessState
]);
.
getStringArray
(
R
.
array
.
su_access
)[
Global
.
suAccessState
]);
autoRes
.
setSummary
(
getResources
()
autoRes
.
setSummary
(
getResources
()
.
getStringArray
(
R
.
array
.
auto_response
)[
mm
.
suResponseType
]);
.
getStringArray
(
R
.
array
.
auto_response
)[
Global
.
suResponseType
]);
suNotification
.
setSummary
(
getResources
()
suNotification
.
setSummary
(
getResources
()
.
getStringArray
(
R
.
array
.
su_notification
)[
mm
.
suNotificationType
]);
.
getStringArray
(
R
.
array
.
su_notification
)[
Global
.
suNotificationType
]);
requestTimeout
.
setSummary
(
requestTimeout
.
setSummary
(
getString
(
R
.
string
.
request_timeout_summary
,
prefs
.
getString
(
Const
.
Key
.
SU_REQUEST_TIMEOUT
,
"10"
)));
getString
(
R
.
string
.
request_timeout_summary
,
prefs
.
getString
(
Const
.
Key
.
SU_REQUEST_TIMEOUT
,
"10"
)));
multiuserMode
.
setSummary
(
getResources
()
multiuserMode
.
setSummary
(
getResources
()
.
getStringArray
(
R
.
array
.
multiuser_summary
)[
mm
.
multiuserMode
]);
.
getStringArray
(
R
.
array
.
multiuser_summary
)[
Global
.
multiuserMode
]);
namespaceMode
.
setSummary
(
getResources
()
namespaceMode
.
setSummary
(
getResources
()
.
getStringArray
(
R
.
array
.
namespace_summary
)[
mm
.
suNamespaceMode
]);
.
getStringArray
(
R
.
array
.
namespace_summary
)[
Global
.
suNamespaceMode
]);
}
}
@Override
@Override
...
...
app/src/full/java/com/topjohnwu/magisk/SplashActivity.java
View file @
70dd2d48
...
@@ -29,7 +29,7 @@ public class SplashActivity extends Activity {
...
@@ -29,7 +29,7 @@ public class SplashActivity extends Activity {
boolean
root
=
Shell
.
rootAccess
();
boolean
root
=
Shell
.
rootAccess
();
mm
.
repoDB
=
new
RepoDatabaseHelper
(
this
);
mm
.
repoDB
=
new
RepoDatabaseHelper
(
this
);
mm
.
load
Prefs
();
Global
.
import
Prefs
();
// Dynamic detect all locales
// Dynamic detect all locales
new
LoadLocale
().
exec
();
new
LoadLocale
().
exec
();
...
@@ -62,7 +62,7 @@ public class SplashActivity extends Activity {
...
@@ -62,7 +62,7 @@ public class SplashActivity extends Activity {
}
}
// Write back default values
// Write back default values
mm
.
writeConfig
();
Global
.
writeConfig
();
mm
.
hasInit
=
true
;
mm
.
hasInit
=
true
;
...
...
app/src/full/java/com/topjohnwu/magisk/asyncs/CheckUpdates.java
View file @
70dd2d48
...
@@ -54,7 +54,7 @@ public class CheckUpdates extends ParallelTask<Void, Void, Void> {
...
@@ -54,7 +54,7 @@ public class CheckUpdates extends ParallelTask<Void, Void, Void> {
protected
Void
doInBackground
(
Void
...
voids
)
{
protected
Void
doInBackground
(
Void
...
voids
)
{
MagiskManager
mm
=
Global
.
MM
();
MagiskManager
mm
=
Global
.
MM
();
String
jsonStr
=
""
;
String
jsonStr
=
""
;
switch
(
mm
.
updateChannel
)
{
switch
(
Global
.
updateChannel
)
{
case
Const
.
Value
.
STABLE_CHANNEL
:
case
Const
.
Value
.
STABLE_CHANNEL
:
jsonStr
=
WebService
.
getString
(
Const
.
Url
.
STABLE_URL
);
jsonStr
=
WebService
.
getString
(
Const
.
Url
.
STABLE_URL
);
break
;
break
;
...
...
app/src/full/java/com/topjohnwu/magisk/asyncs/HideManager.java
View file @
70dd2d48
...
@@ -79,7 +79,7 @@ public class HideManager extends ParallelTask<Void, Void, Boolean> {
...
@@ -79,7 +79,7 @@ public class HideManager extends ParallelTask<Void, Void, Boolean> {
repack
.
delete
();
repack
.
delete
();
mm
.
mDB
.
setStrings
(
Const
.
Key
.
SU_MANAGER
,
pkg
);
mm
.
mDB
.
setStrings
(
Const
.
Key
.
SU_MANAGER
,
pkg
);
mm
.
dump
Prefs
();
Global
.
export
Prefs
();
RootUtils
.
uninstallPkg
(
Const
.
ORIG_PKG_NAME
);
RootUtils
.
uninstallPkg
(
Const
.
ORIG_PKG_NAME
);
return
true
;
return
true
;
...
...
app/src/full/java/com/topjohnwu/magisk/asyncs/InstallMagisk.java
View file @
70dd2d48
...
@@ -9,8 +9,8 @@ import android.text.TextUtils;
...
@@ -9,8 +9,8 @@ import android.text.TextUtils;
import
android.view.View
;
import
android.view.View
;
import
android.widget.Toast
;
import
android.widget.Toast
;
import
com.topjohnwu.magisk.Global
;
import
com.topjohnwu.magisk.FlashActivity
;
import
com.topjohnwu.magisk.FlashActivity
;
import
com.topjohnwu.magisk.Global
;
import
com.topjohnwu.magisk.MagiskManager
;
import
com.topjohnwu.magisk.MagiskManager
;
import
com.topjohnwu.magisk.R
;
import
com.topjohnwu.magisk.R
;
import
com.topjohnwu.magisk.container.TarEntry
;
import
com.topjohnwu.magisk.container.TarEntry
;
...
@@ -231,10 +231,10 @@ public class InstallMagisk extends ParallelTask<Void, Void, Boolean> {
...
@@ -231,10 +231,10 @@ public class InstallMagisk extends ParallelTask<Void, Void, Boolean> {
private
void
outputBoot
(
File
patched
)
throws
IOException
{
private
void
outputBoot
(
File
patched
)
throws
IOException
{
switch
(
mode
)
{
switch
(
mode
)
{
case
PATCH_MODE:
case
PATCH_MODE:
File
dest
=
new
File
(
Download
.
EXTERNAL_PATH
,
"patched_boot"
+
mm
.
bootFormat
);
File
dest
=
new
File
(
Download
.
EXTERNAL_PATH
,
"patched_boot"
+
Global
.
bootFormat
);
dest
.
getParentFile
().
mkdirs
();
dest
.
getParentFile
().
mkdirs
();
OutputStream
out
;
OutputStream
out
;
switch
(
mm
.
bootFormat
)
{
switch
(
Global
.
bootFormat
)
{
case
".img.tar"
:
case
".img.tar"
:
out
=
new
TarOutputStream
(
new
BufferedOutputStream
(
new
FileOutputStream
(
dest
)));
out
=
new
TarOutputStream
(
new
BufferedOutputStream
(
new
FileOutputStream
(
dest
)));
((
TarOutputStream
)
out
).
putNextEntry
(
new
TarEntry
(
patched
,
"boot.img"
));
((
TarOutputStream
)
out
).
putNextEntry
(
new
TarEntry
(
patched
,
"boot.img"
));
...
...
app/src/full/java/com/topjohnwu/magisk/asyncs/MarkDownWindow.java
View file @
70dd2d48
...
@@ -55,9 +55,9 @@ public class MarkDownWindow extends ParallelTask<Void, Void, String> {
...
@@ -55,9 +55,9 @@ public class MarkDownWindow extends ParallelTask<Void, Void, String> {
}
}
String
css
;
String
css
;
try
(
try
(
InputStream
in
=
mm
.
getResources
().
openRawResource
(
InputStream
in
=
mm
.
getResources
().
openRawResource
(
mm
.
isDarkTheme
?
R
.
raw
.
dark
:
R
.
raw
.
light
);
Global
.
isDarkTheme
?
R
.
raw
.
dark
:
R
.
raw
.
light
);
ByteArrayOutputStream
out
=
new
ByteArrayOutputStream
()
ByteArrayOutputStream
out
=
new
ByteArrayOutputStream
()
)
{
)
{
ShellUtils
.
pump
(
in
,
out
);
ShellUtils
.
pump
(
in
,
out
);
css
=
out
.
toString
();
css
=
out
.
toString
();
...
...
app/src/full/java/com/topjohnwu/magisk/components/FlavorActivity.java
View file @
70dd2d48
...
@@ -8,6 +8,7 @@ import android.support.annotation.StyleRes;
...
@@ -8,6 +8,7 @@ import android.support.annotation.StyleRes;
import
android.support.v7.app.AppCompatActivity
;
import
android.support.v7.app.AppCompatActivity
;
import
android.view.WindowManager
;
import
android.view.WindowManager
;
import
com.topjohnwu.magisk.Global
;
import
com.topjohnwu.magisk.MagiskManager
;
import
com.topjohnwu.magisk.MagiskManager
;
import
com.topjohnwu.magisk.R
;
import
com.topjohnwu.magisk.R
;
import
com.topjohnwu.magisk.utils.Topic
;
import
com.topjohnwu.magisk.utils.Topic
;
...
@@ -38,7 +39,7 @@ public abstract class FlavorActivity extends AppCompatActivity {
...
@@ -38,7 +39,7 @@ public abstract class FlavorActivity extends AppCompatActivity {
if
(
this
instanceof
Topic
.
Subscriber
)
{
if
(
this
instanceof
Topic
.
Subscriber
)
{
((
Topic
.
Subscriber
)
this
).
subscribeTopics
();
((
Topic
.
Subscriber
)
this
).
subscribeTopics
();
}
}
if
(
getMagiskManager
()
.
isDarkTheme
&&
getDarkTheme
()
!=
-
1
)
{
if
(
Global
.
isDarkTheme
&&
getDarkTheme
()
!=
-
1
)
{
setTheme
(
getDarkTheme
());
setTheme
(
getDarkTheme
());
}
}
}
}
...
...
app/src/full/java/com/topjohnwu/magisk/components/InstallMethodDialog.java
View file @
70dd2d48
...
@@ -7,8 +7,8 @@ import android.support.design.widget.Snackbar;
...
@@ -7,8 +7,8 @@ import android.support.design.widget.Snackbar;
import
android.support.v7.app.AlertDialog
;
import
android.support.v7.app.AlertDialog
;
import
android.widget.Toast
;
import
android.widget.Toast
;
import
com.topjohnwu.magisk.Global
;
import
com.topjohnwu.magisk.FlashActivity
;
import
com.topjohnwu.magisk.FlashActivity
;
import
com.topjohnwu.magisk.Global
;
import
com.topjohnwu.magisk.MagiskManager
;
import
com.topjohnwu.magisk.MagiskManager
;
import
com.topjohnwu.magisk.R
;
import
com.topjohnwu.magisk.R
;
import
com.topjohnwu.magisk.receivers.DownloadReceiver
;
import
com.topjohnwu.magisk.receivers.DownloadReceiver
;
...
...
app/src/full/java/com/topjohnwu/magisk/components/UninstallDialog.java
View file @
70dd2d48
...
@@ -7,8 +7,8 @@ import android.net.Uri;
...
@@ -7,8 +7,8 @@ import android.net.Uri;
import
android.support.annotation.NonNull
;
import
android.support.annotation.NonNull
;
import
android.text.TextUtils
;
import
android.text.TextUtils
;
import
com.topjohnwu.magisk.Global
;
import
com.topjohnwu.magisk.FlashActivity
;
import
com.topjohnwu.magisk.FlashActivity
;
import
com.topjohnwu.magisk.Global
;
import
com.topjohnwu.magisk.MagiskManager
;
import
com.topjohnwu.magisk.MagiskManager
;
import
com.topjohnwu.magisk.R
;
import
com.topjohnwu.magisk.R
;
import
com.topjohnwu.magisk.asyncs.RestoreImages
;
import
com.topjohnwu.magisk.asyncs.RestoreImages
;
...
...
app/src/full/java/com/topjohnwu/magisk/database/MagiskDatabaseHelper.java
View file @
70dd2d48
...
@@ -174,7 +174,7 @@ public class MagiskDatabaseHelper {
...
@@ -174,7 +174,7 @@ public class MagiskDatabaseHelper {
// Clear outdated policies
// Clear outdated policies
db
.
delete
(
POLICY_TABLE
,
Utils
.
fmt
(
"until > 0 AND until < %d"
,
System
.
currentTimeMillis
()
/
1000
),
null
);
db
.
delete
(
POLICY_TABLE
,
Utils
.
fmt
(
"until > 0 AND until < %d"
,
System
.
currentTimeMillis
()
/
1000
),
null
);
// Clear outdated logs
// Clear outdated logs
db
.
delete
(
LOG_TABLE
,
Utils
.
fmt
(
"time < %d"
,
System
.
currentTimeMillis
()
-
Global
.
MM
().
suLogTimeout
*
86400000
),
null
);
db
.
delete
(
LOG_TABLE
,
Utils
.
fmt
(
"time < %d"
,
System
.
currentTimeMillis
()
-
Global
.
suLogTimeout
*
86400000
),
null
);
}
}
public
void
deletePolicy
(
Policy
policy
)
{
public
void
deletePolicy
(
Policy
policy
)
{
...
...
app/src/full/java/com/topjohnwu/magisk/database/RepoDatabaseHelper.java
View file @
70dd2d48
...
@@ -101,7 +101,7 @@ public class RepoDatabaseHelper extends SQLiteOpenHelper {
...
@@ -101,7 +101,7 @@ public class RepoDatabaseHelper extends SQLiteOpenHelper {
public
Cursor
getRepoCursor
()
{
public
Cursor
getRepoCursor
()
{
String
orderBy
=
null
;
String
orderBy
=
null
;
switch
(
mm
.
repoOrder
)
{
switch
(
Global
.
repoOrder
)
{
case
Const
.
Value
.
ORDER_NAME
:
case
Const
.
Value
.
ORDER_NAME
:
orderBy
=
"name COLLATE NOCASE"
;
orderBy
=
"name COLLATE NOCASE"
;
break
;
break
;
...
...
app/src/full/java/com/topjohnwu/magisk/receivers/ShortcutReceiver.java
View file @
70dd2d48
...
@@ -34,7 +34,7 @@ public class ShortcutReceiver extends BroadcastReceiver {
...
@@ -34,7 +34,7 @@ public class ShortcutReceiver extends BroadcastReceiver {
ArrayList
<
ShortcutInfo
>
shortCuts
=
new
ArrayList
<>();
ArrayList
<
ShortcutInfo
>
shortCuts
=
new
ArrayList
<>();
boolean
root
=
Shell
.
rootAccess
();
boolean
root
=
Shell
.
rootAccess
();
if
(
root
&&
!(
Const
.
USER_ID
>
0
&&
if
(
root
&&
!(
Const
.
USER_ID
>
0
&&
mm
.
multiuserMode
==
Const
.
Value
.
MULTIUSER_MODE_OWNER_MANAGED
))
{
Global
.
multiuserMode
==
Const
.
Value
.
MULTIUSER_MODE_OWNER_MANAGED
))
{
shortCuts
.
add
(
new
ShortcutInfo
.
Builder
(
mm
,
"superuser"
)
shortCuts
.
add
(
new
ShortcutInfo
.
Builder
(
mm
,
"superuser"
)
.
setShortLabel
(
mm
.
getString
(
R
.
string
.
superuser
))
.
setShortLabel
(
mm
.
getString
(
R
.
string
.
superuser
))
.
setIntent
(
new
Intent
(
mm
,
SplashActivity
.
class
)
.
setIntent
(
new
Intent
(
mm
,
SplashActivity
.
class
)
...
...
app/src/full/java/com/topjohnwu/magisk/superuser/RequestActivity.java
View file @
70dd2d48
...
@@ -19,6 +19,7 @@ import android.widget.LinearLayout;
...
@@ -19,6 +19,7 @@ import android.widget.LinearLayout;
import
android.widget.Spinner
;
import
android.widget.Spinner
;
import
android.widget.TextView
;
import
android.widget.TextView
;
import
com.topjohnwu.magisk.Global
;
import
com.topjohnwu.magisk.MagiskManager
;
import
com.topjohnwu.magisk.MagiskManager
;
import
com.topjohnwu.magisk.R
;
import
com.topjohnwu.magisk.R
;
import
com.topjohnwu.magisk.asyncs.ParallelTask
;
import
com.topjohnwu.magisk.asyncs.ParallelTask
;
...
@@ -102,7 +103,7 @@ public class RequestActivity extends Activity {
...
@@ -102,7 +103,7 @@ public class RequestActivity extends Activity {
}
}
private
void
showRequest
()
{
private
void
showRequest
()
{
switch
(
mm
.
suResponseType
)
{
switch
(
Global
.
suResponseType
)
{
case
Const
.
Value
.
SU_AUTO_DENY
:
case
Const
.
Value
.
SU_AUTO_DENY
:
handleAction
(
Policy
.
DENY
,
0
);
handleAction
(
Policy
.
DENY
,
0
);
return
;
return
;
...
@@ -131,7 +132,7 @@ public class RequestActivity extends Activity {
...
@@ -131,7 +132,7 @@ public class RequestActivity extends Activity {
adapter
.
setDropDownViewResource
(
android
.
R
.
layout
.
simple_spinner_dropdown_item
);
adapter
.
setDropDownViewResource
(
android
.
R
.
layout
.
simple_spinner_dropdown_item
);
timeout
.
setAdapter
(
adapter
);
timeout
.
setAdapter
(
adapter
);
timer
=
new
CountDownTimer
(
mm
.
suRequestTimeout
*
1000
,
1000
)
{
timer
=
new
CountDownTimer
(
Global
.
suRequestTimeout
*
1000
,
1000
)
{
@Override
@Override
public
void
onTick
(
long
millisUntilFinished
)
{
public
void
onTick
(
long
millisUntilFinished
)
{
deny_btn
.
setText
(
getString
(
R
.
string
.
deny_with_str
,
"("
+
millisUntilFinished
/
1000
+
")"
));
deny_btn
.
setText
(
getString
(
R
.
string
.
deny_with_str
,
"("
+
millisUntilFinished
/
1000
+
")"
));
...
...
app/src/full/java/com/topjohnwu/magisk/superuser/SuReceiver.java
View file @
70dd2d48
...
@@ -70,7 +70,7 @@ public class SuReceiver extends BroadcastReceiver {
...
@@ -70,7 +70,7 @@ public class SuReceiver extends BroadcastReceiver {
return
;
return
;
}
}
if
(
policy
.
notification
&&
mm
.
suNotificationType
==
Const
.
Value
.
NOTIFICATION_TOAST
)
{
if
(
policy
.
notification
&&
Global
.
suNotificationType
==
Const
.
Value
.
NOTIFICATION_TOAST
)
{
Global
.
toast
(
message
,
Toast
.
LENGTH_SHORT
);
Global
.
toast
(
message
,
Toast
.
LENGTH_SHORT
);
}
}
...
...
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