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
a2544768
Commit
a2544768
authored
Aug 01, 2018
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove boilderplate
parent
8574a14e
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
20 additions
and
49 deletions
+20
-49
MagiskFragment.java
app/src/full/java/com/topjohnwu/magisk/MagiskFragment.java
+0
-4
MainActivity.java
app/src/full/java/com/topjohnwu/magisk/MainActivity.java
+0
-4
ModulesFragment.java
app/src/full/java/com/topjohnwu/magisk/ModulesFragment.java
+1
-1
ReposFragment.java
app/src/full/java/com/topjohnwu/magisk/ReposFragment.java
+0
-2
SettingsActivity.java
app/src/full/java/com/topjohnwu/magisk/SettingsActivity.java
+3
-3
SplashActivity.java
app/src/full/java/com/topjohnwu/magisk/SplashActivity.java
+0
-1
SuLogFragment.java
app/src/full/java/com/topjohnwu/magisk/SuLogFragment.java
+0
-2
SuperuserFragment.java
...src/full/java/com/topjohnwu/magisk/SuperuserFragment.java
+1
-3
FlavorActivity.java
.../java/com/topjohnwu/magisk/components/FlavorActivity.java
+2
-4
Fragment.java
...c/full/java/com/topjohnwu/magisk/components/Fragment.java
+5
-3
InstallMethodDialog.java
.../com/topjohnwu/magisk/components/InstallMethodDialog.java
+0
-2
MagiskInstallDialog.java
.../com/topjohnwu/magisk/components/MagiskInstallDialog.java
+1
-1
ManagerInstallDialog.java
...com/topjohnwu/magisk/components/ManagerInstallDialog.java
+1
-1
UninstallDialog.java
...java/com/topjohnwu/magisk/components/UninstallDialog.java
+1
-2
RepoDatabaseHelper.java
...ava/com/topjohnwu/magisk/database/RepoDatabaseHelper.java
+1
-2
PackageReceiver.java
.../java/com/topjohnwu/magisk/receivers/PackageReceiver.java
+2
-2
ShortcutReceiver.java
...java/com/topjohnwu/magisk/receivers/ShortcutReceiver.java
+1
-2
RequestActivity.java
.../java/com/topjohnwu/magisk/superuser/RequestActivity.java
+0
-4
Utils.java
app/src/full/java/com/topjohnwu/magisk/utils/Utils.java
+1
-6
No files found.
app/src/full/java/com/topjohnwu/magisk/MagiskFragment.java
View file @
a2544768
...
...
@@ -45,8 +45,6 @@ public class MagiskFragment extends Fragment
implements
SwipeRefreshLayout
.
OnRefreshListener
,
ExpandableView
,
Topic
.
Subscriber
{
private
Container
expandableContainer
=
new
Container
();
private
MagiskManager
mm
;
private
Unbinder
unbinder
;
private
static
boolean
shownDialog
=
false
;
...
...
@@ -140,8 +138,6 @@ public class MagiskFragment extends Fragment
unbinder
=
ButterKnife
.
bind
(
this
,
v
);
requireActivity
().
setTitle
(
R
.
string
.
magisk
);
mm
=
getApplication
();
expandableContainer
.
expandLayout
=
expandLayout
;
setupExpandable
();
...
...
app/src/full/java/com/topjohnwu/magisk/MainActivity.java
View file @
a2544768
...
...
@@ -42,9 +42,6 @@ public class MainActivity extends Activity
@Override
protected
void
onCreate
(
final
Bundle
savedInstanceState
)
{
MagiskManager
mm
=
getMagiskManager
();
if
(!
mm
.
hasInit
)
{
Intent
intent
=
new
Intent
(
this
,
SplashActivity
.
class
);
String
section
=
getIntent
().
getStringExtra
(
Const
.
Key
.
OPEN_SECTION
);
...
...
@@ -121,7 +118,6 @@ public class MainActivity extends Activity
}
public
void
checkHideSection
()
{
MagiskManager
mm
=
getMagiskManager
();
Menu
menu
=
navigationView
.
getMenu
();
menu
.
findItem
(
R
.
id
.
magiskhide
).
setVisible
(
Shell
.
rootAccess
()
&&
Data
.
magiskVersionCode
>=
Const
.
MAGISK_VER
.
UNIFIED
...
...
app/src/full/java/com/topjohnwu/magisk/ModulesFragment.java
View file @
a2544768
...
...
@@ -130,7 +130,7 @@ public class ModulesFragment extends Fragment implements Topic.Subscriber {
private
void
updateUI
()
{
listModules
.
clear
();
listModules
.
addAll
(
getApplication
()
.
moduleMap
.
values
());
listModules
.
addAll
(
mm
.
moduleMap
.
values
());
if
(
listModules
.
size
()
==
0
)
{
emptyRv
.
setVisibility
(
View
.
VISIBLE
);
recyclerView
.
setVisibility
(
View
.
GONE
);
...
...
app/src/full/java/com/topjohnwu/magisk/ReposFragment.java
View file @
a2544768
...
...
@@ -26,7 +26,6 @@ import butterknife.Unbinder;
public
class
ReposFragment
extends
Fragment
implements
Topic
.
Subscriber
{
private
Unbinder
unbinder
;
private
MagiskManager
mm
;
@BindView
(
R
.
id
.
recyclerView
)
RecyclerView
recyclerView
;
@BindView
(
R
.
id
.
empty_rv
)
TextView
emptyRv
;
@BindView
(
R
.
id
.
swipeRefreshLayout
)
SwipeRefreshLayout
mSwipeRefreshLayout
;
...
...
@@ -44,7 +43,6 @@ public class ReposFragment extends Fragment implements Topic.Subscriber {
public
View
onCreateView
(
LayoutInflater
inflater
,
@Nullable
ViewGroup
container
,
@Nullable
Bundle
savedInstanceState
)
{
View
view
=
inflater
.
inflate
(
R
.
layout
.
fragment_repos
,
container
,
false
);
unbinder
=
ButterKnife
.
bind
(
this
,
view
);
mm
=
getApplication
();
mSwipeRefreshLayout
.
setRefreshing
(
true
);
...
...
app/src/full/java/com/topjohnwu/magisk/SettingsActivity.java
View file @
a2544768
...
...
@@ -97,7 +97,7 @@ public class SettingsActivity extends Activity implements Topic.Subscriber {
@Override
public
void
onCreatePreferences
(
Bundle
savedInstanceState
,
String
rootKey
)
{
setPreferencesFromResource
(
R
.
xml
.
app_settings
,
rootKey
);
mm
=
Utils
.
getMagiskManager
(
getActivity
()
);
mm
=
Data
.
MM
(
);
prefs
=
mm
.
prefs
;
prefScreen
=
getPreferenceScreen
();
...
...
@@ -126,10 +126,10 @@ public class SettingsActivity extends Activity implements Topic.Subscriber {
updateChannel
.
setOnPreferenceChangeListener
((
pref
,
o
)
->
{
Data
.
updateChannel
=
Integer
.
parseInt
((
String
)
o
);
if
(
Data
.
updateChannel
==
Const
.
Value
.
CUSTOM_CHANNEL
)
{
View
v
=
LayoutInflater
.
from
(
get
Activity
()).
inflate
(
R
.
layout
.
custom_channel_dialog
,
null
);
View
v
=
LayoutInflater
.
from
(
require
Activity
()).
inflate
(
R
.
layout
.
custom_channel_dialog
,
null
);
EditText
url
=
v
.
findViewById
(
R
.
id
.
custom_url
);
url
.
setText
(
mm
.
prefs
.
getString
(
Const
.
Key
.
CUSTOM_CHANNEL
,
""
));
new
AlertDialog
.
Builder
(
get
Activity
())
new
AlertDialog
.
Builder
(
require
Activity
())
.
setTitle
(
R
.
string
.
settings_update_custom
)
.
setView
(
v
)
.
setPositiveButton
(
R
.
string
.
ok
,
(
d
,
i
)
->
...
...
app/src/full/java/com/topjohnwu/magisk/SplashActivity.java
View file @
a2544768
...
...
@@ -23,7 +23,6 @@ public class SplashActivity extends Activity {
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
MagiskManager
mm
=
getMagiskManager
();
// Force create a shell if not created yet
boolean
root
=
Shell
.
rootAccess
();
...
...
app/src/full/java/com/topjohnwu/magisk/SuLogFragment.java
View file @
a2544768
...
...
@@ -24,7 +24,6 @@ public class SuLogFragment extends Fragment {
@BindView
(
R
.
id
.
recyclerView
)
RecyclerView
recyclerView
;
private
Unbinder
unbinder
;
private
MagiskManager
mm
;
private
SuLogAdapter
adapter
;
@Override
...
...
@@ -45,7 +44,6 @@ public class SuLogFragment extends Fragment {
// Inflate the layout for this fragment
View
v
=
inflater
.
inflate
(
R
.
layout
.
fragment_su_log
,
container
,
false
);
unbinder
=
ButterKnife
.
bind
(
this
,
v
);
mm
=
getApplication
();
adapter
=
new
SuLogAdapter
(
mm
.
mDB
);
recyclerView
.
setAdapter
(
adapter
);
...
...
app/src/full/java/com/topjohnwu/magisk/SuperuserFragment.java
View file @
a2544768
...
...
@@ -23,7 +23,6 @@ public class SuperuserFragment extends Fragment {
private
Unbinder
unbinder
;
private
PackageManager
pm
;
private
MagiskManager
mm
;
@BindView
(
R
.
id
.
recyclerView
)
RecyclerView
recyclerView
;
@BindView
(
R
.
id
.
empty_rv
)
TextView
emptyRv
;
...
...
@@ -34,14 +33,13 @@ public class SuperuserFragment extends Fragment {
unbinder
=
ButterKnife
.
bind
(
this
,
view
);
pm
=
getActivity
().
getPackageManager
();
mm
=
getApplication
();
return
view
;
}
@Override
public
void
onStart
()
{
super
.
onStart
();
get
Activity
().
setTitle
(
getString
(
R
.
string
.
superuser
));
require
Activity
().
setTitle
(
getString
(
R
.
string
.
superuser
));
}
@Override
...
...
app/src/full/java/com/topjohnwu/magisk/components/FlavorActivity.java
View file @
a2544768
...
...
@@ -19,6 +19,7 @@ public abstract class FlavorActivity extends AppCompatActivity implements Topic.
private
ActivityResultListener
activityResultListener
;
static
int
[]
EMPTY_INT_ARRAY
=
new
int
[
0
];
public
MagiskManager
mm
;
@Override
protected
void
attachBaseContext
(
Context
base
)
{
...
...
@@ -26,6 +27,7 @@ public abstract class FlavorActivity extends AppCompatActivity implements Topic.
Configuration
config
=
base
.
getResources
().
getConfiguration
();
config
.
setLocale
(
LocaleManager
.
locale
);
applyOverrideConfiguration
(
config
);
mm
=
Data
.
MM
();
}
@Override
...
...
@@ -38,10 +40,6 @@ public abstract class FlavorActivity extends AppCompatActivity implements Topic.
return
-
1
;
}
public
MagiskManager
getMagiskManager
()
{
return
(
MagiskManager
)
super
.
getApplication
();
}
@Override
protected
void
onCreate
(
@Nullable
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
...
...
app/src/full/java/com/topjohnwu/magisk/components/Fragment.java
View file @
a2544768
...
...
@@ -2,14 +2,16 @@ package com.topjohnwu.magisk.components;
import
android.content.Intent
;
import
com.topjohnwu.magisk.Data
;
import
com.topjohnwu.magisk.MagiskManager
;
import
com.topjohnwu.magisk.utils.Topic
;
import
com.topjohnwu.magisk.utils.Utils
;
public
class
Fragment
extends
android
.
support
.
v4
.
app
.
Fragment
implements
Topic
.
AutoSubscriber
{
public
MagiskManager
getApplication
()
{
return
Utils
.
getMagiskManager
(
getActivity
());
public
MagiskManager
mm
;
public
Fragment
()
{
mm
=
Data
.
MM
();
}
@Override
...
...
app/src/full/java/com/topjohnwu/magisk/components/InstallMethodDialog.java
View file @
a2544768
...
...
@@ -10,7 +10,6 @@ import android.widget.Toast;
import
com.topjohnwu.magisk.Const
;
import
com.topjohnwu.magisk.Data
;
import
com.topjohnwu.magisk.FlashActivity
;
import
com.topjohnwu.magisk.MagiskManager
;
import
com.topjohnwu.magisk.R
;
import
com.topjohnwu.magisk.receivers.DownloadReceiver
;
import
com.topjohnwu.magisk.utils.Download
;
...
...
@@ -22,7 +21,6 @@ class InstallMethodDialog extends AlertDialog.Builder {
InstallMethodDialog
(
Activity
activity
,
List
<
String
>
options
,
String
filename
)
{
super
(
activity
);
MagiskManager
mm
=
Utils
.
getMagiskManager
(
activity
);
setTitle
(
R
.
string
.
select_method
);
setItems
(
options
.
toArray
(
new
String
[
0
]),
(
dialog
,
idx
)
->
{
Intent
intent
;
...
...
app/src/full/java/com/topjohnwu/magisk/components/MagiskInstallDialog.java
View file @
a2544768
...
...
@@ -18,7 +18,7 @@ import java.util.List;
public
class
MagiskInstallDialog
extends
CustomAlertDialog
{
public
MagiskInstallDialog
(
Activity
activity
)
{
super
(
activity
);
MagiskManager
mm
=
Utils
.
getMagiskManager
(
activity
);
MagiskManager
mm
=
Data
.
MM
(
);
String
filename
=
Utils
.
fmt
(
"Magisk-v%s(%d).zip"
,
Data
.
remoteMagiskVersionString
,
Data
.
remoteMagiskVersionCode
);
setTitle
(
mm
.
getString
(
R
.
string
.
repo_install_title
,
mm
.
getString
(
R
.
string
.
magisk
)));
...
...
app/src/full/java/com/topjohnwu/magisk/components/ManagerInstallDialog.java
View file @
a2544768
...
...
@@ -17,7 +17,7 @@ public class ManagerInstallDialog extends CustomAlertDialog {
public
ManagerInstallDialog
(
@NonNull
Activity
activity
)
{
super
(
activity
);
MagiskManager
mm
=
Utils
.
getMagiskManager
(
activity
);
MagiskManager
mm
=
Data
.
MM
(
);
String
filename
=
Utils
.
fmt
(
"MagiskManager-v%s(%d).apk"
,
Data
.
remoteManagerVersionString
,
Data
.
remoteManagerVersionCode
);
setTitle
(
mm
.
getString
(
R
.
string
.
repo_install_title
,
mm
.
getString
(
R
.
string
.
app_name
)));
...
...
app/src/full/java/com/topjohnwu/magisk/components/UninstallDialog.java
View file @
a2544768
...
...
@@ -15,13 +15,12 @@ import com.topjohnwu.magisk.R;
import
com.topjohnwu.magisk.asyncs.RestoreImages
;
import
com.topjohnwu.magisk.receivers.DownloadReceiver
;
import
com.topjohnwu.magisk.utils.Download
;
import
com.topjohnwu.magisk.utils.Utils
;
public
class
UninstallDialog
extends
CustomAlertDialog
{
public
UninstallDialog
(
@NonNull
Activity
activity
)
{
super
(
activity
);
MagiskManager
mm
=
Utils
.
getMagiskManager
(
activity
);
MagiskManager
mm
=
Data
.
MM
(
);
setTitle
(
R
.
string
.
uninstall_magisk_title
);
setMessage
(
R
.
string
.
uninstall_magisk_msg
);
setNeutralButton
(
R
.
string
.
restore_img
,
(
d
,
i
)
->
new
RestoreImages
(
activity
).
exec
());
...
...
app/src/full/java/com/topjohnwu/magisk/database/RepoDatabaseHelper.java
View file @
a2544768
...
...
@@ -9,7 +9,6 @@ import com.topjohnwu.magisk.Const;
import
com.topjohnwu.magisk.Data
;
import
com.topjohnwu.magisk.MagiskManager
;
import
com.topjohnwu.magisk.container.Repo
;
import
com.topjohnwu.magisk.utils.Utils
;
import
java.util.HashSet
;
import
java.util.Set
;
...
...
@@ -24,7 +23,7 @@ public class RepoDatabaseHelper extends SQLiteOpenHelper {
public
RepoDatabaseHelper
(
Context
context
)
{
super
(
context
,
"repo.db"
,
null
,
DATABASE_VER
);
mm
=
Utils
.
getMagiskManager
(
context
);
mm
=
Data
.
MM
(
);
mDb
=
getWritableDatabase
();
// Remove outdated repos
...
...
app/src/full/java/com/topjohnwu/magisk/receivers/PackageReceiver.java
View file @
a2544768
...
...
@@ -5,14 +5,14 @@ import android.content.Context;
import
android.content.Intent
;
import
com.topjohnwu.magisk.Const
;
import
com.topjohnwu.magisk.Data
;
import
com.topjohnwu.magisk.MagiskManager
;
import
com.topjohnwu.magisk.utils.Utils
;
import
com.topjohnwu.superuser.Shell
;
public
class
PackageReceiver
extends
BroadcastReceiver
{
@Override
public
void
onReceive
(
Context
context
,
Intent
intent
)
{
MagiskManager
mm
=
Utils
.
getMagiskManager
(
context
);
MagiskManager
mm
=
Data
.
MM
(
);
String
pkg
=
intent
.
getData
().
getEncodedSchemeSpecificPart
();
...
...
app/src/full/java/com/topjohnwu/magisk/receivers/ShortcutReceiver.java
View file @
a2544768
...
...
@@ -14,7 +14,6 @@ import com.topjohnwu.magisk.Data;
import
com.topjohnwu.magisk.MagiskManager
;
import
com.topjohnwu.magisk.R
;
import
com.topjohnwu.magisk.SplashActivity
;
import
com.topjohnwu.magisk.utils.Utils
;
import
com.topjohnwu.superuser.Shell
;
import
java.util.ArrayList
;
...
...
@@ -23,7 +22,7 @@ public class ShortcutReceiver extends BroadcastReceiver {
@Override
public
void
onReceive
(
Context
context
,
Intent
intent
)
{
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
N_MR1
)
{
MagiskManager
mm
=
Utils
.
getMagiskManager
(
context
);
MagiskManager
mm
=
Data
.
MM
(
);
ShortcutManager
manager
=
context
.
getSystemService
(
ShortcutManager
.
class
);
manager
.
setDynamicShortcuts
(
getShortCuts
(
mm
));
}
...
...
app/src/full/java/com/topjohnwu/magisk/superuser/RequestActivity.java
View file @
a2544768
...
...
@@ -21,13 +21,11 @@ import android.widget.TextView;
import
com.topjohnwu.magisk.Const
;
import
com.topjohnwu.magisk.Data
;
import
com.topjohnwu.magisk.MagiskManager
;
import
com.topjohnwu.magisk.R
;
import
com.topjohnwu.magisk.asyncs.ParallelTask
;
import
com.topjohnwu.magisk.components.Activity
;
import
com.topjohnwu.magisk.container.Policy
;
import
com.topjohnwu.magisk.utils.FingerprintHelper
;
import
com.topjohnwu.magisk.utils.Utils
;
import
java.io.DataInputStream
;
import
java.io.IOException
;
...
...
@@ -50,7 +48,6 @@ public class RequestActivity extends Activity {
private
String
socketPath
;
private
LocalSocket
socket
;
private
PackageManager
pm
;
private
MagiskManager
mm
;
private
boolean
hasTimeout
;
private
Policy
policy
;
...
...
@@ -68,7 +65,6 @@ public class RequestActivity extends Activity {
supportRequestWindowFeature
(
Window
.
FEATURE_NO_TITLE
);
pm
=
getPackageManager
();
mm
=
Utils
.
getMagiskManager
(
this
);
mm
.
mDB
.
clearOutdated
();
Intent
intent
=
getIntent
();
...
...
app/src/full/java/com/topjohnwu/magisk/utils/Utils.java
View file @
a2544768
...
...
@@ -27,10 +27,6 @@ public class Utils {
return
getPrefsInt
(
prefs
,
key
,
0
);
}
public
static
MagiskManager
getMagiskManager
(
Context
context
)
{
return
(
MagiskManager
)
context
.
getApplicationContext
();
}
public
static
String
getNameFromUri
(
Context
context
,
Uri
uri
)
{
String
name
=
null
;
try
(
Cursor
c
=
context
.
getContentResolver
().
query
(
uri
,
null
,
null
,
null
,
null
))
{
...
...
@@ -50,8 +46,7 @@ public class Utils {
}
public
static
int
dpInPx
(
int
dp
)
{
Context
context
=
Data
.
MM
();
float
scale
=
context
.
getResources
().
getDisplayMetrics
().
density
;
float
scale
=
Data
.
MM
().
getResources
().
getDisplayMetrics
().
density
;
return
(
int
)
(
dp
*
scale
+
0.5
);
}
...
...
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