Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4f33878f authored by Christopher Tate's avatar Christopher Tate
Browse files

Add backup password setting UI

Bug 4901637

Change-Id: I515f1475d3675285a830b4b5ddd1f011f1b56e3a
parent 95ce1898
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -639,6 +639,11 @@
                android:resource="@id/privacy_settings" />
        </activity>

        <activity android:name="SetFullBackupPassword"
                android:theme="@android:style/Theme.Holo.DialogWhenLarge"
                android:exported="false">
        </activity>

        <activity android:name="CredentialStorage"
                android:theme="@style/Transparent"
                android:configChanges="orientation|keyboardHidden|screenSize">
+83 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2011 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.
-->

<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:padding="16dip"
    >

    <TextView
            android:id="@+id/prompt1"
            android:text="@string/current_backup_pw_prompt"
            android:layout_height="wrap_content"
            android:layout_width="wrap_content" />

    <EditText
            android:id="@+id/current_backup_pw"
            android:layout_below="@id/prompt1"
            android:layout_height="wrap_content"
            android:layout_width="match_parent"
            android:singleLine="true"
            android:password="true" />

    <TextView
            android:id="@+id/prompt2"
            android:layout_below="@id/current_backup_pw"
            android:text="@string/new_backup_pw_prompt"
            android:layout_height="wrap_content"
            android:layout_width="wrap_content" />

    <EditText
            android:id="@+id/new_backup_pw"
            android:layout_below="@id/prompt2"
            android:layout_height="wrap_content"
            android:layout_width="match_parent"
            android:singleLine="true"
            android:password="true" />

    <TextView
            android:id="@+id/prompt3"
            android:layout_below="@id/new_backup_pw"
            android:text="@string/confirm_new_backup_pw_prompt"
            android:layout_height="wrap_content"
            android:layout_width="wrap_content" />

    <EditText
            android:id="@+id/confirm_new_backup_pw"
            android:layout_below="@id/prompt3"
            android:layout_height="wrap_content"
            android:layout_width="match_parent"
            android:singleLine="true"
            android:password="true" />

    <Button
            android:id="@+id/backup_pw_cancel_button"
            android:layout_below="@id/confirm_new_backup_pw"
            android:text="@string/backup_pw_cancel_button_text"
            android:layout_height="wrap_content"
            android:layout_width="wrap_content" />

    <Button
            android:id="@+id/backup_pw_set_button"
            android:layout_below="@id/confirm_new_backup_pw"
            android:layout_toRightOf="@id/backup_pw_cancel_button"
            android:text="@string/backup_pw_set_button_text"
            android:layout_height="wrap_content"
            android:layout_width="wrap_content" />

</RelativeLayout>
+21 −0
Original line number Diff line number Diff line
@@ -3080,6 +3080,14 @@ found in the list of installed applications.</string>
    <string name="auto_restore_title">Automatic restore</string>
    <!-- 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>

    <!-- Local backup password menu title [CHAR LIMIT=25] -->
    <string name="local_backup_password_title">Local backup password</string>
    <!-- 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>
    <!-- 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>

    <!-- Dialog title for confirmation to erase backup data from server -->
    <string name="backup_erase_dialog_title">Backup</string>
    <!-- Dialog title for confirmation to erase backup data from server -->
@@ -3593,4 +3601,17 @@ found in the list of installed applications.</string>

    <!--  Title for spelling correction settings -->
    <string name="spellcheckers_settings_title">Spelling correction</string>

    <!-- Prompt for the user to enter their current full-backup password -->
    <string name="current_backup_pw_prompt">Enter your current full backup password here</string>
    <!-- Prompt for the user to enter a new full-backup password -->
    <string name="new_backup_pw_prompt">Enter a new password for full backups here</string>
    <!-- Prompt for the user to confirm the new full-backup password by re-entering it -->
    <string name="confirm_new_backup_pw_prompt">Please re-enter your new full backup password here</string>

    <!-- Button label for setting the user's new full-backup password -->
    <string name="backup_pw_set_button_text">Set backup password</string>
    <!-- Button label for cancelling the new-password operation and retaining the user's previous full-backup password -->
    <string name="backup_pw_cancel_button_text">Cancel</string>

</resources>
+11 −1
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2009 The Android Open Source Project
<!-- Copyright (C) 2009-2011 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.
@@ -38,6 +38,16 @@
                android:title="@string/auto_restore_title"
                android:summary="@string/auto_restore_summary"
                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
+18 −1
Original line number Diff line number Diff line
@@ -43,11 +43,13 @@ public class PrivacySettings extends SettingsPreferenceFragment implements
    private static final String BACKUP_DATA = "backup_data";
    private static final String AUTO_RESTORE = "auto_restore";
    private static final String CONFIGURE_ACCOUNT = "configure_account";
    private static final String LOCAL_BACKUP_PASSWORD = "local_backup_password";
    private IBackupManager mBackupManager;
    private CheckBoxPreference mBackup;
    private CheckBoxPreference mAutoRestore;
    private Dialog mConfirmDialog;
    private PreferenceScreen mConfigure;
    private PreferenceScreen mPassword;

    private static final int DIALOG_ERASE_BACKUP = 2;
    private int mDialogType;
@@ -64,6 +66,7 @@ public class PrivacySettings extends SettingsPreferenceFragment implements
        mBackup = (CheckBoxPreference) screen.findPreference(BACKUP_DATA);
        mAutoRestore = (CheckBoxPreference) screen.findPreference(AUTO_RESTORE);
        mConfigure = (PreferenceScreen) screen.findPreference(CONFIGURE_ACCOUNT);
        mPassword = (PreferenceScreen) screen.findPreference(LOCAL_BACKUP_PASSWORD);

        // Vendor specific
        if (getActivity().getPackageManager().
@@ -158,6 +161,8 @@ public class PrivacySettings extends SettingsPreferenceFragment implements
        mConfigure.setEnabled(configureEnabled);
        mConfigure.setIntent(configIntent);
        setConfigureSummary(configSummary);

        updatePasswordSummary();
}

    private void setConfigureSummary(String summary) {
@@ -178,6 +183,18 @@ 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) {
        if (which == DialogInterface.BUTTON_POSITIVE) {
            //updateProviders();
Loading