Merge "Support cuttlefish with an emulated 2GB SD"
This commit is contained in:
@@ -28,6 +28,7 @@ import android.os.ServiceManager;
|
|||||||
import android.os.SystemProperties;
|
import android.os.SystemProperties;
|
||||||
import android.os.UserHandle;
|
import android.os.UserHandle;
|
||||||
import android.os.image.IDynamicSystemService;
|
import android.os.image.IDynamicSystemService;
|
||||||
|
import android.os.storage.DiskInfo;
|
||||||
import android.os.storage.StorageManager;
|
import android.os.storage.StorageManager;
|
||||||
import android.os.storage.VolumeInfo;
|
import android.os.storage.VolumeInfo;
|
||||||
import android.util.Slog;
|
import android.util.Slog;
|
||||||
@@ -40,6 +41,7 @@ import java.io.File;
|
|||||||
*/
|
*/
|
||||||
public class DynamicSystemService extends IDynamicSystemService.Stub {
|
public class DynamicSystemService extends IDynamicSystemService.Stub {
|
||||||
private static final String TAG = "DynamicSystemService";
|
private static final String TAG = "DynamicSystemService";
|
||||||
|
private static final long MINIMUM_SD_MB = (30L << 10);
|
||||||
private static final int GSID_ROUGH_TIMEOUT_MS = 8192;
|
private static final int GSID_ROUGH_TIMEOUT_MS = 8192;
|
||||||
private static final String PATH_DEFAULT = "/data/gsi/";
|
private static final String PATH_DEFAULT = "/data/gsi/";
|
||||||
private Context mContext;
|
private Context mContext;
|
||||||
@@ -95,6 +97,13 @@ public class DynamicSystemService extends IDynamicSystemService.Stub {
|
|||||||
if (!volume.isMountedWritable()) {
|
if (!volume.isMountedWritable()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
DiskInfo disk = volume.getDisk();
|
||||||
|
long mega = disk.size >> 20;
|
||||||
|
Slog.i(TAG, volume.getPath() + ": " + mega + " MB");
|
||||||
|
if (mega < MINIMUM_SD_MB) {
|
||||||
|
Slog.i(TAG, volume.getPath() + ": insufficient storage");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
File sd_internal = volume.getInternalPathForUser(userId);
|
File sd_internal = volume.getInternalPathForUser(userId);
|
||||||
if (sd_internal != null) {
|
if (sd_internal != null) {
|
||||||
path = new File(sd_internal, dsuSlot).getPath();
|
path = new File(sd_internal, dsuSlot).getPath();
|
||||||
|
|||||||
Reference in New Issue
Block a user