Add developer option to convert from FDE to FBE

This set of changes adds the screen that offers this conversion,
and the plumbing so the option is only available on suitable
devices.

It does not implement the conversion mechanism.

Change-Id: I3c84dd40dfcb0e00dadbab54ba0e56e1ccb11ed8
This commit is contained in:
Paul Lawrence
2015-11-02 12:42:42 -08:00
parent 77c69c5a22
commit acbac8cdfe
5 changed files with 121 additions and 0 deletions

View File

@@ -53,6 +53,7 @@ import android.os.ServiceManager;
import android.os.StrictMode;
import android.os.SystemProperties;
import android.os.UserManager;
import android.os.storage.IMountService;
import android.provider.SearchIndexableResource;
import android.provider.Settings;
import android.provider.Settings.Global;
@@ -175,6 +176,7 @@ public class DevelopmentSettings extends SettingsPreferenceFragment
private static final String TERMINAL_APP_PACKAGE = "com.android.terminal";
private static final String KEY_NIGHT_MODE = "night_mode";
private static final String KEY_CONVERT_FBE = "convert_to_file_encryption";
private static final int RESULT_DEBUG_APP = 1000;
private static final int RESULT_MOCK_LOCATION_APP = 1001;
@@ -407,6 +409,16 @@ public class DevelopmentSettings extends SettingsPreferenceFragment
removePreferenceForProduction(hdcpChecking);
}
try {
IBinder service = ServiceManager.getService("mount");
IMountService mountService = IMountService.Stub.asInterface(service);
if (!mountService.isConvertibleToFBE()) {
removePreference(KEY_CONVERT_FBE);
}
} catch(RemoteException e) {
removePreference(KEY_CONVERT_FBE);
}
mNightModePreference = (DropDownPreference) findPreference(KEY_NIGHT_MODE);
final UiModeManager uiManager = (UiModeManager) getSystemService(
Context.UI_MODE_SERVICE);