Merge "Add developer option to convert from FDE to FBE"
This commit is contained in:
committed by
Android (Google) Code Review
commit
ee3e51f1f1
46
res/layout/convert_fbe.xml
Normal file
46
res/layout/convert_fbe.xml
Normal file
@@ -0,0 +1,46 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (C) 2015 The Android Open Source Project
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:layout_marginBottom="12dp" >
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="12dp"
|
||||
android:layout_marginEnd="12dp"
|
||||
android:layout_marginTop="12dp"
|
||||
android:textSize="18sp"
|
||||
android:text="@string/convert_to_fbe_warning" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_gravity="center"
|
||||
android:orientation="horizontal">
|
||||
<Button
|
||||
android:id="@+id/button_convert_fbe"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom"
|
||||
android:layout_marginBottom="12dp"
|
||||
android:text="@string/button_convert_fbe" />
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
@@ -2006,6 +2006,18 @@
|
||||
<string name="night_mode_yes">Always on</string>
|
||||
<!-- Sound & display settings screen, theme setting value to automatically switch between a light- or dark-colored user interface [CHAR LIMIT=30] -->
|
||||
<string name="night_mode_auto">Automatic</string>
|
||||
|
||||
<!-- Option to convert userdata to file encryption on Nexus M devices -->
|
||||
<string name="convert_to_file_encryption">Convert to file encryption</string>
|
||||
<string name="convert_to_file_encryption_enabled">Convert ...</string>
|
||||
<string name="convert_to_file_encryption_done">Already file encrypted</string>
|
||||
<string name="convert_to_fbe_warning">
|
||||
Convert data partition to file based encryption.\n
|
||||
!!Warning!! This will erase all your data.\n
|
||||
This feature is alpha, and may not work correctly.\n
|
||||
Press \'Wipe and convert...\' to continue.</string>
|
||||
<string name="button_convert_fbe">Wipe and convert...</string>
|
||||
|
||||
<!-- Sound & display settings screen, setting option name to change screen timeout -->
|
||||
<string name="screen_timeout">Sleep</string>
|
||||
<!-- Sound & display settings screen, setting option name to change screen timeout [CHAR LIMIT=30] -->
|
||||
|
@@ -67,6 +67,12 @@
|
||||
android:entries="@array/night_mode_entries"
|
||||
android:entryValues="@array/night_mode_values" />
|
||||
|
||||
<PreferenceScreen
|
||||
android:key="convert_to_file_encryption"
|
||||
android:title="@string/convert_to_file_encryption"
|
||||
android:summary="@string/convert_to_file_encryption_enabled"
|
||||
android:fragment="com.android.settings.applications.ConvertToFBE" />
|
||||
|
||||
<com.android.settings.ColorModePreference
|
||||
android:key="color_mode"
|
||||
android:title="@string/picture_color_mode"
|
||||
|
@@ -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);
|
||||
|
45
src/com/android/settings/applications/ConvertToFBE.java
Normal file
45
src/com/android/settings/applications/ConvertToFBE.java
Normal file
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
* Copyright (C) 2015 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.android.settings.applications;
|
||||
|
||||
import android.app.Fragment;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Button;
|
||||
|
||||
import com.android.settings.R;
|
||||
|
||||
/* Class to prompt for conversion of userdata to file based encryption
|
||||
*/
|
||||
public class ConvertToFBE extends Fragment {
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
View rootView = inflater.inflate(R.layout.convert_fbe, null);
|
||||
|
||||
final Button button = (Button) rootView.findViewById(R.id.button_convert_fbe);
|
||||
button.setOnClickListener(new View.OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
// Perform action on click
|
||||
}
|
||||
});
|
||||
|
||||
return rootView;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user