Move the desktop backup pw from "Backup and reset" to "Developer" settings

Addresses bug 5136161

Change-Id: Ia26258e0c8b0378184e4bac32a5da47de5da686f
This commit is contained in:
Christopher Tate
2011-08-12 17:22:41 -07:00
parent d57df23021
commit fac0ea781f
5 changed files with 41 additions and 41 deletions

View File

@@ -3065,12 +3065,12 @@ found in the list of installed applications.</string>
<!-- Summary text of the "automatic restore" setting --> <!-- Summary text of the "automatic restore" setting -->
<string name="auto_restore_summary">If I reinstall an application, restore backed up settings or other data</string> <string name="auto_restore_summary">If I reinstall an application, restore backed up settings or other data</string>
<!-- Local backup password menu title [CHAR LIMIT=25] --> <!-- Local (desktop) backup password menu title [CHAR LIMIT=25] -->
<string name="local_backup_password_title">Local backup password</string> <string name="local_backup_password_title">Desktop backup password</string>
<!-- Summary text of the "local backup password" setting when the user has not supplied a password --> <!-- Summary text of the "local backup password" setting when the user has not supplied a password -->
<string name="local_backup_password_summary_none">Local full backups are not currently protected.</string> <string name="local_backup_password_summary_none">Desktop full backups are not currently protected.</string>
<!-- Summary text of the "local backup password" setting when the user has already supplied a password --> <!-- Summary text of the "local backup password" setting when the user has already supplied a password -->
<string name="local_backup_password_summary_change">Select to change or remove the password for local full backups</string> <string name="local_backup_password_summary_change">Select to change or remove the password for desktop full backups</string>
<!-- Dialog title for confirmation to erase backup data from server --> <!-- Dialog title for confirmation to erase backup data from server -->
<string name="backup_erase_dialog_title">Backup</string> <string name="backup_erase_dialog_title">Backup</string>

View File

@@ -39,6 +39,17 @@
android:entries="@array/hdcp_checking_titles" android:entries="@array/hdcp_checking_titles"
android:entryValues="@array/hdcp_checking_values" /> android:entryValues="@array/hdcp_checking_values" />
<PreferenceScreen
android:key="local_backup_password"
android:title="@string/local_backup_password_title"
android:summary="@string/local_backup_password_summary_none"
android:persistent="false" >
<intent
android:action="android.settings.privacy.SET_FULL_BACKUP_PASSWORD"
android:targetPackage="com.android.settings"
android:targetClass="com.android.settings.SetFullBackupPassword" />
</PreferenceScreen>
<PreferenceCategory android:key="debug_ui_category" <PreferenceCategory android:key="debug_ui_category"
android:title="@string/debug_ui_category"> android:title="@string/debug_ui_category">

View File

@@ -38,16 +38,6 @@
android:title="@string/auto_restore_title" android:title="@string/auto_restore_title"
android:summary="@string/auto_restore_summary" android:summary="@string/auto_restore_summary"
android:persistent="false" /> android:persistent="false" />
<PreferenceScreen
android:key="local_backup_password"
android:title="@string/local_backup_password_title"
android:summary="@string/local_backup_password_summary_none"
android:persistent="false" >
<intent
android:action="android.settings.privacy.SET_FULL_BACKUP_PASSWORD"
android:targetPackage="com.android.settings"
android:targetClass="com.android.settings.SetFullBackupPassword" />
</PreferenceScreen>
</PreferenceCategory> </PreferenceCategory>
<PreferenceCategory <PreferenceCategory

View File

@@ -19,7 +19,9 @@ package com.android.settings;
import android.app.ActivityManagerNative; import android.app.ActivityManagerNative;
import android.app.AlertDialog; import android.app.AlertDialog;
import android.app.Dialog; import android.app.Dialog;
import android.app.backup.IBackupManager;
import android.content.ContentResolver; import android.content.ContentResolver;
import android.content.Context;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.content.Intent; import android.content.Intent;
import android.os.BatteryManager; import android.os.BatteryManager;
@@ -53,6 +55,7 @@ public class DevelopmentSettings extends PreferenceFragment
private static final String ALLOW_MOCK_LOCATION = "allow_mock_location"; private static final String ALLOW_MOCK_LOCATION = "allow_mock_location";
private static final String HDCP_CHECKING_KEY = "hdcp_checking"; private static final String HDCP_CHECKING_KEY = "hdcp_checking";
private static final String HDCP_CHECKING_PROPERTY = "persist.sys.hdcp_checking"; private static final String HDCP_CHECKING_PROPERTY = "persist.sys.hdcp_checking";
private static final String LOCAL_BACKUP_PASSWORD = "local_backup_password";
private static final String STRICT_MODE_KEY = "strict_mode"; private static final String STRICT_MODE_KEY = "strict_mode";
private static final String POINTER_LOCATION_KEY = "pointer_location"; private static final String POINTER_LOCATION_KEY = "pointer_location";
@@ -68,10 +71,12 @@ public class DevelopmentSettings extends PreferenceFragment
private static final String SHOW_ALL_ANRS_KEY = "show_all_anrs"; private static final String SHOW_ALL_ANRS_KEY = "show_all_anrs";
private IWindowManager mWindowManager; private IWindowManager mWindowManager;
private IBackupManager mBackupManager;
private CheckBoxPreference mEnableAdb; private CheckBoxPreference mEnableAdb;
private CheckBoxPreference mKeepScreenOn; private CheckBoxPreference mKeepScreenOn;
private CheckBoxPreference mAllowMockLocation; private CheckBoxPreference mAllowMockLocation;
private PreferenceScreen mPassword;
private CheckBoxPreference mStrictMode; private CheckBoxPreference mStrictMode;
private CheckBoxPreference mPointerLocation; private CheckBoxPreference mPointerLocation;
@@ -95,12 +100,15 @@ public class DevelopmentSettings extends PreferenceFragment
super.onCreate(icicle); super.onCreate(icicle);
mWindowManager = IWindowManager.Stub.asInterface(ServiceManager.getService("window")); mWindowManager = IWindowManager.Stub.asInterface(ServiceManager.getService("window"));
mBackupManager = IBackupManager.Stub.asInterface(
ServiceManager.getService(Context.BACKUP_SERVICE));
addPreferencesFromResource(R.xml.development_prefs); addPreferencesFromResource(R.xml.development_prefs);
mEnableAdb = (CheckBoxPreference) findPreference(ENABLE_ADB); mEnableAdb = (CheckBoxPreference) findPreference(ENABLE_ADB);
mKeepScreenOn = (CheckBoxPreference) findPreference(KEEP_SCREEN_ON); mKeepScreenOn = (CheckBoxPreference) findPreference(KEEP_SCREEN_ON);
mAllowMockLocation = (CheckBoxPreference) findPreference(ALLOW_MOCK_LOCATION); mAllowMockLocation = (CheckBoxPreference) findPreference(ALLOW_MOCK_LOCATION);
mPassword = (PreferenceScreen) findPreference(LOCAL_BACKUP_PASSWORD);
mStrictMode = (CheckBoxPreference) findPreference(STRICT_MODE_KEY); mStrictMode = (CheckBoxPreference) findPreference(STRICT_MODE_KEY);
mPointerLocation = (CheckBoxPreference) findPreference(POINTER_LOCATION_KEY); mPointerLocation = (CheckBoxPreference) findPreference(POINTER_LOCATION_KEY);
@@ -144,6 +152,7 @@ public class DevelopmentSettings extends PreferenceFragment
mAllowMockLocation.setChecked(Settings.Secure.getInt(cr, mAllowMockLocation.setChecked(Settings.Secure.getInt(cr,
Settings.Secure.ALLOW_MOCK_LOCATION, 0) != 0); Settings.Secure.ALLOW_MOCK_LOCATION, 0) != 0);
updateHdcpValues(); updateHdcpValues();
updatePasswordSummary();
updateStrictModeVisualOptions(); updateStrictModeVisualOptions();
updatePointerLocationOptions(); updatePointerLocationOptions();
updateFlingerOptions(); updateFlingerOptions();
@@ -173,6 +182,18 @@ public class DevelopmentSettings extends PreferenceFragment
} }
} }
private void updatePasswordSummary() {
try {
if (mBackupManager.hasBackupPassword()) {
mPassword.setSummary(R.string.local_backup_password_summary_change);
} else {
mPassword.setSummary(R.string.local_backup_password_summary_none);
}
} catch (RemoteException e) {
// Not much we can do here
}
}
// Returns the current state of the system property that controls // Returns the current state of the system property that controls
// strictmode flashes. One of: // strictmode flashes. One of:
// 0: not explicitly set one way or another // 0: not explicitly set one way or another

View File

@@ -43,13 +43,11 @@ public class PrivacySettings extends SettingsPreferenceFragment implements
private static final String BACKUP_DATA = "backup_data"; private static final String BACKUP_DATA = "backup_data";
private static final String AUTO_RESTORE = "auto_restore"; private static final String AUTO_RESTORE = "auto_restore";
private static final String CONFIGURE_ACCOUNT = "configure_account"; private static final String CONFIGURE_ACCOUNT = "configure_account";
private static final String LOCAL_BACKUP_PASSWORD = "local_backup_password";
private IBackupManager mBackupManager; private IBackupManager mBackupManager;
private CheckBoxPreference mBackup; private CheckBoxPreference mBackup;
private CheckBoxPreference mAutoRestore; private CheckBoxPreference mAutoRestore;
private Dialog mConfirmDialog; private Dialog mConfirmDialog;
private PreferenceScreen mConfigure; private PreferenceScreen mConfigure;
private PreferenceScreen mPassword;
private static final int DIALOG_ERASE_BACKUP = 2; private static final int DIALOG_ERASE_BACKUP = 2;
private int mDialogType; private int mDialogType;
@@ -66,7 +64,6 @@ public class PrivacySettings extends SettingsPreferenceFragment implements
mBackup = (CheckBoxPreference) screen.findPreference(BACKUP_DATA); mBackup = (CheckBoxPreference) screen.findPreference(BACKUP_DATA);
mAutoRestore = (CheckBoxPreference) screen.findPreference(AUTO_RESTORE); mAutoRestore = (CheckBoxPreference) screen.findPreference(AUTO_RESTORE);
mConfigure = (PreferenceScreen) screen.findPreference(CONFIGURE_ACCOUNT); mConfigure = (PreferenceScreen) screen.findPreference(CONFIGURE_ACCOUNT);
mPassword = (PreferenceScreen) screen.findPreference(LOCAL_BACKUP_PASSWORD);
// Vendor specific // Vendor specific
if (getActivity().getPackageManager(). if (getActivity().getPackageManager().
@@ -104,16 +101,11 @@ public class PrivacySettings extends SettingsPreferenceFragment implements
setBackupEnabled(true); setBackupEnabled(true);
} }
} else if (preference == mAutoRestore) { } else if (preference == mAutoRestore) {
IBackupManager bm = IBackupManager.Stub.asInterface( boolean curState = mAutoRestore.isChecked();
ServiceManager.getService(Context.BACKUP_SERVICE)); try {
if (bm != null) { mBackupManager.setAutoRestore(curState);
// TODO: disable via the backup manager interface } catch (RemoteException e) {
boolean curState = mAutoRestore.isChecked(); mAutoRestore.setChecked(!curState);
try {
bm.setAutoRestore(curState);
} catch (RemoteException e) {
mAutoRestore.setChecked(!curState);
}
} }
} }
return super.onPreferenceTreeClick(preferenceScreen, preference); return super.onPreferenceTreeClick(preferenceScreen, preference);
@@ -161,8 +153,6 @@ public class PrivacySettings extends SettingsPreferenceFragment implements
mConfigure.setEnabled(configureEnabled); mConfigure.setEnabled(configureEnabled);
mConfigure.setIntent(configIntent); mConfigure.setIntent(configIntent);
setConfigureSummary(configSummary); setConfigureSummary(configSummary);
updatePasswordSummary();
} }
private void setConfigureSummary(String summary) { private void setConfigureSummary(String summary) {
@@ -183,18 +173,6 @@ public class PrivacySettings extends SettingsPreferenceFragment implements
} }
} }
private void updatePasswordSummary() {
try {
if (mBackupManager.hasBackupPassword()) {
mPassword.setSummary(R.string.local_backup_password_summary_change);
} else {
mPassword.setSummary(R.string.local_backup_password_summary_none);
}
} catch (RemoteException e) {
// Not much we can do here
}
}
public void onClick(DialogInterface dialog, int which) { public void onClick(DialogInterface dialog, int which) {
if (which == DialogInterface.BUTTON_POSITIVE) { if (which == DialogInterface.BUTTON_POSITIVE) {
//updateProviders(); //updateProviders();