Progress towards dynamic storage support.
Storage devices are no longer hard-coded, and instead bubble up from whatever Disk and VolumeBase that vold uncovered, turning into sibling Java objects in MountService. We now treat vold events as the source-of-truth for state, and synchronize our state by asking vold to "reset" whenever we reconnect. We've now moved to a model where all storage devices are mounted in the root mount namespace (user boundaries protected with GIDs), so we no longer need app-to-vold path translation. This also means that zygote only needs to bind mount the user-specific /mnt/user/n/ path onto /storage/self/ to make legacy paths like /sdcard work. This grealy simplifies a lot of system code. Many parts of the platform depend on a primary storage device always being present, so we hack together a stub StorageVolume when vold doesn't have a volume ready yet. StorageVolume isn't really a volume anymore; it's the user-specific view onto a volume, so MountService now filters and builds them based on the calling user. StorageVolume is now immutable, making it easier to reason about. Environment now builds all of its paths dynamically based on active volumes. Adds utility methods to turn int types and flags into user-readable strings for debugging purposes. Remove UMS sharing support for now, since no current devices support it; MTP is the recommended solution going forward because it offers better multi-user support. Simplify unmount logic, since vold will now gladly trigger EJECTING broadcast and kill stubborn processes. Bug: 19993667 Change-Id: I9842280e61974c91bae15d764e386969aedcd338
This commit is contained in:
@@ -51,6 +51,8 @@ public class TrafficStats {
|
|||||||
public static final long MB_IN_BYTES = KB_IN_BYTES * 1024;
|
public static final long MB_IN_BYTES = KB_IN_BYTES * 1024;
|
||||||
/** @hide */
|
/** @hide */
|
||||||
public static final long GB_IN_BYTES = MB_IN_BYTES * 1024;
|
public static final long GB_IN_BYTES = MB_IN_BYTES * 1024;
|
||||||
|
/** @hide */
|
||||||
|
public static final long TB_IN_BYTES = GB_IN_BYTES * 1024;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Special UID value used when collecting {@link NetworkStatsHistory} for
|
* Special UID value used when collecting {@link NetworkStatsHistory} for
|
||||||
|
|||||||
@@ -48,8 +48,6 @@ import java.util.LinkedList;
|
|||||||
* {@code libsysutils} FrameworkListener protocol.
|
* {@code libsysutils} FrameworkListener protocol.
|
||||||
*/
|
*/
|
||||||
final class NativeDaemonConnector implements Runnable, Handler.Callback, Watchdog.Monitor {
|
final class NativeDaemonConnector implements Runnable, Handler.Callback, Watchdog.Monitor {
|
||||||
private static final boolean LOGD = false;
|
|
||||||
|
|
||||||
private final static boolean VDBG = false;
|
private final static boolean VDBG = false;
|
||||||
|
|
||||||
private final String TAG;
|
private final String TAG;
|
||||||
@@ -58,6 +56,8 @@ final class NativeDaemonConnector implements Runnable, Handler.Callback, Watchdo
|
|||||||
private OutputStream mOutputStream;
|
private OutputStream mOutputStream;
|
||||||
private LocalLog mLocalLog;
|
private LocalLog mLocalLog;
|
||||||
|
|
||||||
|
private volatile boolean mDebug = false;
|
||||||
|
|
||||||
private final ResponseQueue mResponseQueue;
|
private final ResponseQueue mResponseQueue;
|
||||||
|
|
||||||
private final PowerManager.WakeLock mWakeLock;
|
private final PowerManager.WakeLock mWakeLock;
|
||||||
@@ -99,6 +99,14 @@ final class NativeDaemonConnector implements Runnable, Handler.Callback, Watchdo
|
|||||||
mLocalLog = new LocalLog(maxLogSize);
|
mLocalLog = new LocalLog(maxLogSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enable Set debugging mode, which causes messages to also be written to both
|
||||||
|
* {@link Slog} in addition to internal log.
|
||||||
|
*/
|
||||||
|
public void setDebug(boolean debug) {
|
||||||
|
mDebug = debug;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
mCallbackHandler = new Handler(mLooper, this);
|
mCallbackHandler = new Handler(mLooper, this);
|
||||||
@@ -513,7 +521,7 @@ final class NativeDaemonConnector implements Runnable, Handler.Callback, Watchdo
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void log(String logstring) {
|
private void log(String logstring) {
|
||||||
if (LOGD) Slog.d(TAG, logstring);
|
if (mDebug) Slog.d(TAG, logstring);
|
||||||
mLocalLog.log(logstring);
|
mLocalLog.log(logstring);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user