mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-11-24 02:25:28 +00:00
Add DirectBoot support to receivers and SuRequestActivity
Close #1032, courtesy of @vvb2060
This commit is contained in:
parent
f620ac769f
commit
81a0cddb9e
@ -5,6 +5,7 @@ import android.content.Context;
|
|||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.content.res.Configuration;
|
import android.content.res.Configuration;
|
||||||
import android.os.AsyncTask;
|
import android.os.AsyncTask;
|
||||||
|
import android.os.Build;
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
|
|
||||||
import com.topjohnwu.magisk.core.BuildConfig;
|
import com.topjohnwu.magisk.core.BuildConfig;
|
||||||
@ -40,9 +41,13 @@ public class App extends Application {
|
|||||||
super.attachBaseContext(base);
|
super.attachBaseContext(base);
|
||||||
self = this;
|
self = this;
|
||||||
|
|
||||||
prefs = PreferenceManager.getDefaultSharedPreferences(this);
|
Context de = this;
|
||||||
|
if (Build.VERSION.SDK_INT >= 24) {
|
||||||
|
de = createDeviceProtectedStorageContext();
|
||||||
|
de.moveSharedPreferencesFrom(this, PreferenceManager.getDefaultSharedPreferencesName(base));
|
||||||
|
}
|
||||||
|
prefs = PreferenceManager.getDefaultSharedPreferences(de);
|
||||||
mDB = new MagiskDB(this);
|
mDB = new MagiskDB(this);
|
||||||
repoDB = new RepoDatabaseHelper(this);
|
|
||||||
|
|
||||||
Networking.init(this);
|
Networking.init(this);
|
||||||
LocaleManager.setLocale(this);
|
LocaleManager.setLocale(this);
|
||||||
|
@ -8,7 +8,6 @@ import com.topjohnwu.magisk.App;
|
|||||||
import com.topjohnwu.magisk.Config;
|
import com.topjohnwu.magisk.Config;
|
||||||
import com.topjohnwu.magisk.Const;
|
import com.topjohnwu.magisk.Const;
|
||||||
import com.topjohnwu.magisk.container.TarEntry;
|
import com.topjohnwu.magisk.container.TarEntry;
|
||||||
import com.topjohnwu.magisk.core.R;
|
|
||||||
import com.topjohnwu.magisk.utils.Utils;
|
import com.topjohnwu.magisk.utils.Utils;
|
||||||
import com.topjohnwu.net.DownloadProgressListener;
|
import com.topjohnwu.net.DownloadProgressListener;
|
||||||
import com.topjohnwu.net.Networking;
|
import com.topjohnwu.net.Networking;
|
||||||
|
@ -5,13 +5,12 @@
|
|||||||
|
|
||||||
<uses-permission android:name="android.permission.VIBRATE" />
|
<uses-permission android:name="android.permission.VIBRATE" />
|
||||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
|
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
|
||||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
|
|
||||||
|
|
||||||
<application
|
<application
|
||||||
android:name="a.e"
|
android:name="a.e"
|
||||||
android:theme="@style/AppTheme"
|
android:theme="@style/AppTheme"
|
||||||
android:usesCleartextTraffic="true"
|
android:usesCleartextTraffic="true"
|
||||||
tools:ignore="GoogleAppIndexingWarning">
|
tools:ignore="UnusedAttribute,GoogleAppIndexingWarning">
|
||||||
|
|
||||||
<!-- Activities -->
|
<!-- Activities -->
|
||||||
|
|
||||||
@ -39,14 +38,17 @@
|
|||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:name="a.m"
|
android:name="a.m"
|
||||||
|
android:directBootAware="true"
|
||||||
android:excludeFromRecents="true"
|
android:excludeFromRecents="true"
|
||||||
android:launchMode="singleTask"
|
android:launchMode="singleTask"
|
||||||
android:taskAffinity="internal.superuser"
|
android:taskAffinity="a.m"
|
||||||
android:theme="@style/SuRequest" />
|
android:theme="@style/SuRequest" />
|
||||||
|
|
||||||
<!-- Receiver -->
|
<!-- Receiver -->
|
||||||
|
|
||||||
<receiver android:name="a.h">
|
<receiver
|
||||||
|
android:name="a.h"
|
||||||
|
android:directBootAware="true">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.BOOT_COMPLETED" />
|
<action android:name="android.intent.action.BOOT_COMPLETED" />
|
||||||
<action android:name="android.intent.action.LOCALE_CHANGED" />
|
<action android:name="android.intent.action.LOCALE_CHANGED" />
|
||||||
@ -54,13 +56,14 @@
|
|||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.PACKAGE_REPLACED" />
|
<action android:name="android.intent.action.PACKAGE_REPLACED" />
|
||||||
<action android:name="android.intent.action.PACKAGE_FULLY_REMOVED" />
|
<action android:name="android.intent.action.PACKAGE_FULLY_REMOVED" />
|
||||||
|
|
||||||
<data android:scheme="package" />
|
<data android:scheme="package" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</receiver>
|
</receiver>
|
||||||
|
|
||||||
<!-- Service -->
|
<!-- Service -->
|
||||||
|
|
||||||
<service android:name="a.j"/>
|
<service android:name="a.j" />
|
||||||
|
|
||||||
<!-- Hardcode GMS version -->
|
<!-- Hardcode GMS version -->
|
||||||
<meta-data
|
<meta-data
|
||||||
|
@ -6,6 +6,7 @@ import android.os.Bundle;
|
|||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
|
|
||||||
import com.topjohnwu.magisk.components.BaseActivity;
|
import com.topjohnwu.magisk.components.BaseActivity;
|
||||||
|
import com.topjohnwu.magisk.database.RepoDatabaseHelper;
|
||||||
import com.topjohnwu.magisk.tasks.UpdateRepos;
|
import com.topjohnwu.magisk.tasks.UpdateRepos;
|
||||||
import com.topjohnwu.magisk.uicomponents.Notifications;
|
import com.topjohnwu.magisk.uicomponents.Notifications;
|
||||||
import com.topjohnwu.magisk.uicomponents.Shortcuts;
|
import com.topjohnwu.magisk.uicomponents.Shortcuts;
|
||||||
@ -67,6 +68,9 @@ public class SplashActivity extends BaseActivity {
|
|||||||
// Setup shortcuts
|
// Setup shortcuts
|
||||||
Shortcuts.setup(this);
|
Shortcuts.setup(this);
|
||||||
|
|
||||||
|
// Create repo database
|
||||||
|
app.repoDB = new RepoDatabaseHelper(this);
|
||||||
|
|
||||||
// Magisk working as expected
|
// Magisk working as expected
|
||||||
if (Shell.rootAccess() && Config.magiskVersionCode > 0) {
|
if (Shell.rootAccess() && Config.magiskVersionCode > 0) {
|
||||||
// Load modules
|
// Load modules
|
||||||
|
@ -21,6 +21,7 @@ import com.topjohnwu.magisk.components.BaseActivity;
|
|||||||
import com.topjohnwu.magisk.container.Policy;
|
import com.topjohnwu.magisk.container.Policy;
|
||||||
import com.topjohnwu.magisk.utils.FingerprintHelper;
|
import com.topjohnwu.magisk.utils.FingerprintHelper;
|
||||||
import com.topjohnwu.magisk.utils.SuConnector;
|
import com.topjohnwu.magisk.utils.SuConnector;
|
||||||
|
import com.topjohnwu.magisk.utils.Utils;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
@ -75,7 +76,7 @@ public class SuRequestActivity extends BaseActivity {
|
|||||||
|
|
||||||
PackageManager pm = getPackageManager();
|
PackageManager pm = getPackageManager();
|
||||||
app.mDB.clearOutdated();
|
app.mDB.clearOutdated();
|
||||||
timeoutPrefs = getSharedPreferences("su_timeout", 0);
|
timeoutPrefs = Utils.getDEContext().getSharedPreferences("su_timeout", 0);
|
||||||
|
|
||||||
// Get policy
|
// Get policy
|
||||||
Intent intent = getIntent();
|
Intent intent = getIntent();
|
||||||
|
@ -8,10 +8,9 @@
|
|||||||
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
|
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
|
||||||
|
|
||||||
<application
|
<application
|
||||||
android:installLocation="internalOnly"
|
|
||||||
android:allowBackup="true"
|
android:allowBackup="true"
|
||||||
android:directBootAware="true"
|
|
||||||
android:icon="@drawable/ic_launcher"
|
android:icon="@drawable/ic_launcher"
|
||||||
|
android:installLocation="internalOnly"
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
android:supportsRtl="true"
|
android:supportsRtl="true"
|
||||||
tools:ignore="GoogleAppIndexingWarning,UnusedAttribute">
|
tools:ignore="GoogleAppIndexingWarning,UnusedAttribute">
|
||||||
|
Loading…
Reference in New Issue
Block a user