mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-12-25 11:57:39 +00:00
Add mount namespace options
This commit is contained in:
parent
bc576a9659
commit
343161b195
@ -77,6 +77,7 @@ public class MagiskManager extends Application {
|
||||
public int multiuserMode;
|
||||
public int suResponseType;
|
||||
public int suNotificationType;
|
||||
public int suNamespaceMode;
|
||||
|
||||
// Global resources
|
||||
public SharedPreferences prefs;
|
||||
@ -137,6 +138,7 @@ public class MagiskManager extends Application {
|
||||
.putString("su_notification", String.valueOf(suNotificationType))
|
||||
.putString("su_access", String.valueOf(suAccessState))
|
||||
.putString("multiuser_mode", String.valueOf(multiuserMode))
|
||||
.putString("mnt_ns", String.valueOf(suNamespaceMode))
|
||||
.putString("busybox_version", BUSYBOX_VERSION)
|
||||
.apply();
|
||||
// Add busybox to PATH
|
||||
@ -164,6 +166,7 @@ public class MagiskManager extends Application {
|
||||
if (isSuClient) {
|
||||
suAccessState = suDB.getSettings(SuDatabaseHelper.ROOT_ACCESS, 3);
|
||||
multiuserMode = suDB.getSettings(SuDatabaseHelper.MULTIUSER_MODE, 0);
|
||||
suNamespaceMode = suDB.getSettings(SuDatabaseHelper.MNT_NS, 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -60,7 +60,7 @@ public class SettingsActivity extends Activity {
|
||||
private SharedPreferences prefs;
|
||||
private PreferenceScreen prefScreen;
|
||||
|
||||
private ListPreference suAccess, autoRes, suNotification, requestTimeout, multiuserMode;
|
||||
private ListPreference suAccess, autoRes, suNotification, requestTimeout, multiuserMode, namespaceMode;
|
||||
private MagiskManager magiskManager;
|
||||
|
||||
@Override
|
||||
@ -80,6 +80,7 @@ public class SettingsActivity extends Activity {
|
||||
requestTimeout = (ListPreference) findPreference("su_request_timeout");
|
||||
suNotification = (ListPreference) findPreference("su_notification");
|
||||
multiuserMode = (ListPreference) findPreference("multiuser_mode");
|
||||
namespaceMode = (ListPreference) findPreference("mnt_ns");
|
||||
|
||||
setSummary();
|
||||
|
||||
@ -182,6 +183,11 @@ public class SettingsActivity extends Activity {
|
||||
case "multiuser_mode":
|
||||
magiskManager.multiuserMode = Utils.getPrefsInt(prefs, "multiuser_mode", 0);
|
||||
magiskManager.suDB.setSettings(SuDatabaseHelper.MULTIUSER_MODE, magiskManager.multiuserMode);
|
||||
break;
|
||||
case "mnt_ns":
|
||||
magiskManager.suNamespaceMode = Utils.getPrefsInt(prefs, "mnt_ns", 1);
|
||||
magiskManager.suDB.setSettings(SuDatabaseHelper.MNT_NS, magiskManager.suNamespaceMode);
|
||||
break;
|
||||
case "su_request_timeout":
|
||||
magiskManager.suRequestTimeout = Utils.getPrefsInt(prefs, "su_request_timeout", 10);
|
||||
break;
|
||||
@ -212,6 +218,8 @@ public class SettingsActivity extends Activity {
|
||||
getString(R.string.request_timeout_summary, prefs.getString("su_request_timeout", "10")));
|
||||
multiuserMode.setSummary(getResources()
|
||||
.getStringArray(R.array.multiuser_summary)[magiskManager.multiuserMode]);
|
||||
namespaceMode.setSummary(getResources()
|
||||
.getStringArray(R.array.namespace_summary)[magiskManager.suNamespaceMode]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -21,6 +21,7 @@ public class SuDatabaseHelper extends SQLiteOpenHelper {
|
||||
|
||||
public static final String ROOT_ACCESS = "root_access";
|
||||
public static final String MULTIUSER_MODE = "multiuser_mode";
|
||||
public static final String MNT_NS = "mnt_ns";
|
||||
|
||||
private static final int DATABASE_VER = 2;
|
||||
private static final String POLICY_TABLE = "policies";
|
||||
|
@ -61,4 +61,16 @@
|
||||
<item>@string/user_indepenent_summary</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="namespace">
|
||||
<item>@string/settings_ns_global</item>
|
||||
<item>@string/settings_ns_requester</item>
|
||||
<item>@string/settings_ns_isolate</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="namespace_summary">
|
||||
<item>@string/global_summary</item>
|
||||
<item>@string/requester_summary</item>
|
||||
<item>@string/isolate_summary</item>
|
||||
</string-array>
|
||||
|
||||
</resources>
|
@ -175,6 +175,14 @@
|
||||
<string name="user_indepenent_summary">Each user has its own separate root rules</string>
|
||||
<string name="multiuser_hint_owner_request">A request has been sent to the device owner. Please switch to the owner and grant the permission</string>
|
||||
|
||||
<string name="mount_namespace_mode">Mount Namespace Mode</string>
|
||||
<string name="settings_ns_global">Global Namespace</string>
|
||||
<string name="settings_ns_requester">Requester Namespace</string>
|
||||
<string name="settings_ns_isolate">Isolated Namespace</string>
|
||||
<string name="global_summary">All root sessions use the global mount namespace</string>
|
||||
<string name="requester_summary">Root sessions will use its requester\'s namespace</string>
|
||||
<string name="isolate_summary">Each root session will have its own isolated namespace</string>
|
||||
|
||||
<string name="settings_development_category">App Development</string>
|
||||
<string name="settings_developer_logging_title">Enable advanced debug logging</string>
|
||||
<string name="settings_developer_logging_summary">Check this to enable verbose logging</string>
|
||||
|
@ -58,6 +58,12 @@
|
||||
android:entries="@array/multiuser_mode"
|
||||
android:entryValues="@array/value_array" />
|
||||
|
||||
<ListPreference
|
||||
android:key="mnt_ns"
|
||||
android:title="@string/mount_namespace_mode"
|
||||
android:entries="@array/namespace"
|
||||
android:entryValues="@array/value_array" />
|
||||
|
||||
<ListPreference
|
||||
android:key="su_auto_response"
|
||||
android:title="@string/auto_response"
|
||||
|
Loading…
x
Reference in New Issue
Block a user