Merge "Give users and devices control over sdcardfs." into nyc-dev
am: 7d66e83
* commit '7d66e8313958e8225ea6c3df2ca6696dbc6d3d79':
Give users and devices control over sdcardfs.
Change-Id: Ie2861a3268768fd6ed55e20bc8a746bb3bc61fff
This commit is contained in:
@@ -74,6 +74,8 @@ public final class Sm {
|
||||
runGetPrimaryStorageUuid();
|
||||
} else if ("set-force-adoptable".equals(op)) {
|
||||
runSetForceAdoptable();
|
||||
} else if ("set-sdcardfs".equals(op)) {
|
||||
runSetSdcardfs();
|
||||
} else if ("partition".equals(op)) {
|
||||
runPartition();
|
||||
} else if ("mount".equals(op)) {
|
||||
@@ -141,6 +143,22 @@ public final class Sm {
|
||||
StorageManager.DEBUG_FORCE_ADOPTABLE);
|
||||
}
|
||||
|
||||
public void runSetSdcardfs() throws RemoteException {
|
||||
final int mask = StorageManager.DEBUG_SDCARDFS_FORCE_ON
|
||||
| StorageManager.DEBUG_SDCARDFS_FORCE_OFF;
|
||||
switch (nextArg()) {
|
||||
case "on":
|
||||
mSm.setDebugFlags(StorageManager.DEBUG_SDCARDFS_FORCE_ON, mask);
|
||||
break;
|
||||
case "off":
|
||||
mSm.setDebugFlags(StorageManager.DEBUG_SDCARDFS_FORCE_OFF, mask);
|
||||
break;
|
||||
case "default":
|
||||
mSm.setDebugFlags(0, mask);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void runSetEmulateFbe() throws RemoteException {
|
||||
final boolean emulateFbe = Boolean.parseBoolean(nextArg());
|
||||
mSm.setDebugFlags(emulateFbe ? StorageManager.DEBUG_EMULATE_FBE : 0,
|
||||
|
||||
@@ -83,6 +83,8 @@ public class StorageManager {
|
||||
public static final String PROP_FORCE_ADOPTABLE = "persist.fw.force_adoptable";
|
||||
/** {@hide} */
|
||||
public static final String PROP_EMULATE_FBE = "persist.sys.emulate_fbe";
|
||||
/** {@hide} */
|
||||
public static final String PROP_SDCARDFS = "persist.sys.sdcardfs";
|
||||
|
||||
/** {@hide} */
|
||||
public static final String UUID_PRIVATE_INTERNAL = null;
|
||||
@@ -93,6 +95,10 @@ public class StorageManager {
|
||||
public static final int DEBUG_FORCE_ADOPTABLE = 1 << 0;
|
||||
/** {@hide} */
|
||||
public static final int DEBUG_EMULATE_FBE = 1 << 1;
|
||||
/** {@hide} */
|
||||
public static final int DEBUG_SDCARDFS_FORCE_ON = 1 << 2;
|
||||
/** {@hide} */
|
||||
public static final int DEBUG_SDCARDFS_FORCE_OFF = 1 << 3;
|
||||
|
||||
// NOTE: keep in sync with installd
|
||||
/** {@hide} */
|
||||
|
||||
@@ -1984,6 +1984,28 @@ class MountService extends IMountService.Stub
|
||||
mHandler.obtainMessage(H_RESET).sendToTarget();
|
||||
}
|
||||
}
|
||||
|
||||
if ((mask & (StorageManager.DEBUG_SDCARDFS_FORCE_ON
|
||||
| StorageManager.DEBUG_SDCARDFS_FORCE_OFF)) != 0) {
|
||||
final String value;
|
||||
if ((flags & StorageManager.DEBUG_SDCARDFS_FORCE_ON) != 0) {
|
||||
value = "force_on";
|
||||
} else if ((flags & StorageManager.DEBUG_SDCARDFS_FORCE_OFF) != 0) {
|
||||
value = "force_off";
|
||||
} else {
|
||||
value = "";
|
||||
}
|
||||
|
||||
final long token = Binder.clearCallingIdentity();
|
||||
try {
|
||||
SystemProperties.set(StorageManager.PROP_SDCARDFS, value);
|
||||
|
||||
// Reset storage to kick new setting into place
|
||||
mHandler.obtainMessage(H_RESET).sendToTarget();
|
||||
} finally {
|
||||
Binder.restoreCallingIdentity(token);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user