Remove ROOT_MOUNT_MASTER status

This commit is contained in:
vvb2060 2023-07-09 02:30:15 +08:00 committed by John Wu
parent ec2d4d5cd2
commit f32602748a
2 changed files with 4 additions and 16 deletions

View File

@ -77,15 +77,15 @@ public abstract class Shell implements Closeable {
*/
public static final int ROOT_SHELL = 1;
/**
* Shell status: Root shell with mount master enabled.
* One possible result of {@link #getStatus()}.
* @deprecated Not used anymore.
* <p>
* Constant value {@value}.
*/
@Deprecated
public static final int ROOT_MOUNT_MASTER = 2;
@Retention(SOURCE)
@IntDef({UNKNOWN, NON_ROOT_SHELL, ROOT_SHELL, ROOT_MOUNT_MASTER})
@IntDef({UNKNOWN, NON_ROOT_SHELL, ROOT_SHELL})
@interface Status {}
/**
@ -304,8 +304,7 @@ public abstract class Shell implements Closeable {
/**
* Get the status of the shell.
* @return the status of the shell.
* Value is either {@link #UNKNOWN}, {@link #NON_ROOT_SHELL}, {@link #ROOT_SHELL}, or
* {@link #ROOT_MOUNT_MASTER}
* Value is either {@link #UNKNOWN}, {@link #NON_ROOT_SHELL}, or {@link #ROOT_SHELL}
*/
@Status
public abstract int getStatus();

View File

@ -156,17 +156,6 @@ class ShellImpl extends Shell {
STDIN.write(("cd " + cwd + "\n").getBytes(UTF_8));
STDIN.flush();
}
if (status == ROOT_SHELL) {
STDIN.write(("readlink /proc/self/ns/mnt\n").getBytes(UTF_8));
STDIN.flush();
s = br.readLine();
STDIN.write(("readlink /proc/1/ns/mnt\n").getBytes(UTF_8));
STDIN.flush();
String s2 = br.readLine();
if (!TextUtils.isEmpty(s) && !TextUtils.isEmpty(s2) && TextUtils.equals(s, s2))
status = ROOT_MOUNT_MASTER;
}
}
return status;
}