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
ed11e0bf
Commit
ed11e0bf
authored
Mar 11, 2019
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix repackage manager settings migration
parent
51110866
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
13 additions
and
18 deletions
+13
-18
App.java
app/src/main/java/com/topjohnwu/magisk/App.java
+8
-6
Config.java
app/src/main/java/com/topjohnwu/magisk/Config.java
+3
-3
SuRequestActivity.java
...src/main/java/com/topjohnwu/magisk/SuRequestActivity.java
+1
-2
MagiskInstaller.java
...main/java/com/topjohnwu/magisk/tasks/MagiskInstaller.java
+1
-1
Utils.java
app/src/main/java/com/topjohnwu/magisk/utils/Utils.java
+0
-6
No files found.
app/src/main/java/com/topjohnwu/magisk/App.java
View file @
ed11e0bf
...
...
@@ -20,6 +20,7 @@ import java.util.concurrent.ThreadPoolExecutor;
public
class
App
extends
Application
{
public
static
App
self
;
public
static
Context
deContext
;
public
static
ThreadPoolExecutor
THREAD_POOL
;
// Global resources
...
...
@@ -39,16 +40,17 @@ public class App extends Application {
protected
void
attachBaseContext
(
Context
base
)
{
super
.
attachBaseContext
(
base
);
self
=
this
;
deContext
=
base
;
Context
de
=
this
;
if
(
Build
.
VERSION
.
SDK_INT
>=
24
)
{
de
=
createDeviceProtectedStorageContext
();
de
.
moveSharedPreferencesFrom
(
this
,
PreferenceManager
.
getDefaultSharedPreferencesName
(
base
));
deContext
=
base
.
createDeviceProtectedStorageContext
();
deContext
.
moveSharedPreferencesFrom
(
base
,
PreferenceManager
.
getDefaultSharedPreferencesName
(
base
));
}
prefs
=
PreferenceManager
.
getDefaultSharedPreferences
(
de
);
mDB
=
new
MagiskDB
(
this
);
prefs
=
PreferenceManager
.
getDefaultSharedPreferences
(
de
Context
);
mDB
=
new
MagiskDB
(
base
);
Networking
.
init
(
this
);
Networking
.
init
(
base
);
LocaleManager
.
setLocale
(
this
);
}
...
...
app/src/main/java/com/topjohnwu/magisk/Config.java
View file @
ed11e0bf
...
...
@@ -147,15 +147,15 @@ public class Config {
// Flush prefs to disk
App
app
=
App
.
self
;
app
.
prefs
.
edit
().
commit
();
File
xml
=
new
File
(
app
.
getFilesDir
().
getParent
()
+
"/shared_prefs"
,
File
xml
=
new
File
(
App
.
deContext
.
getFilesDir
().
getParent
()
+
"/shared_prefs"
,
app
.
getPackageName
()
+
"_preferences.xml"
);
Shell
.
su
(
Utils
.
fmt
(
"cat %s > /data/
user/0
/%s"
,
xml
,
Const
.
MANAGER_CONFIGS
)).
exec
();
Shell
.
su
(
Utils
.
fmt
(
"cat %s > /data/
adb
/%s"
,
xml
,
Const
.
MANAGER_CONFIGS
)).
exec
();
}
public
static
void
initialize
()
{
SharedPreferences
pref
=
App
.
self
.
prefs
;
SharedPreferences
.
Editor
editor
=
pref
.
edit
();
SuFile
config
=
new
SuFile
(
"/data/
user/0
/"
+
Const
.
MANAGER_CONFIGS
);
SuFile
config
=
new
SuFile
(
"/data/
adb
/"
+
Const
.
MANAGER_CONFIGS
);
if
(
config
.
exists
())
{
try
{
SuFileInputStream
is
=
new
SuFileInputStream
(
config
);
...
...
app/src/main/java/com/topjohnwu/magisk/SuRequestActivity.java
View file @
ed11e0bf
...
...
@@ -23,7 +23,6 @@ import com.topjohnwu.magisk.components.BaseActivity;
import
com.topjohnwu.magisk.container.Policy
;
import
com.topjohnwu.magisk.utils.FingerprintHelper
;
import
com.topjohnwu.magisk.utils.SuConnector
;
import
com.topjohnwu.magisk.utils.Utils
;
import
java.io.IOException
;
...
...
@@ -76,7 +75,7 @@ public class SuRequestActivity extends BaseActivity {
PackageManager
pm
=
getPackageManager
();
app
.
mDB
.
clearOutdated
();
timeoutPrefs
=
Utils
.
getDEContext
()
.
getSharedPreferences
(
"su_timeout"
,
0
);
timeoutPrefs
=
App
.
deContext
.
getSharedPreferences
(
"su_timeout"
,
0
);
// Get policy
Intent
intent
=
getIntent
();
...
...
app/src/main/java/com/topjohnwu/magisk/tasks/MagiskInstaller.java
View file @
ed11e0bf
...
...
@@ -73,7 +73,7 @@ public abstract class MagiskInstaller {
public
MagiskInstaller
(
List
<
String
>
out
,
List
<
String
>
err
)
{
console
=
out
;
logs
=
err
;
installDir
=
new
File
(
Utils
.
getDEContext
()
.
getFilesDir
().
getParent
(),
"install"
);
installDir
=
new
File
(
App
.
deContext
.
getFilesDir
().
getParent
(),
"install"
);
Shell
.
sh
(
"rm -rf "
+
installDir
).
exec
();
installDir
.
mkdirs
();
}
...
...
app/src/main/java/com/topjohnwu/magisk/utils/Utils.java
View file @
ed11e0bf
...
...
@@ -8,7 +8,6 @@ import android.content.res.Configuration;
import
android.content.res.Resources
;
import
android.database.Cursor
;
import
android.net.Uri
;
import
android.os.Build
;
import
android.provider.OpenableColumns
;
import
android.widget.Toast
;
...
...
@@ -116,11 +115,6 @@ public class Utils {
Config
.
Value
.
MULTIUSER_MODE_OWNER_MANAGED
);
}
public
static
Context
getDEContext
()
{
return
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
N
?
App
.
self
.
createDeviceProtectedStorageContext
()
:
App
.
self
;
}
public
static
void
reboot
()
{
Shell
.
su
(
"/system/bin/reboot"
+
(
Config
.
recovery
?
" recovery"
:
""
)).
submit
();
}
...
...
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