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

Commit fac0ea78 authored by Christopher Tate's avatar Christopher Tate
Browse files

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

Addresses bug 5136161

Change-Id: Ia26258e0c8b0378184e4bac32a5da47de5da686f
parent d57df230
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -3065,12 +3065,12 @@ found in the list of installed applications.</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>
    <!-- Local (desktop) backup password menu title [CHAR LIMIT=25] -->
    <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 -->
    <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 -->
    <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 -->
    <string name="backup_erase_dialog_title">Backup</string>
+11 −0
Original line number Diff line number Diff line
@@ -39,6 +39,17 @@
        android:entries="@array/hdcp_checking_titles"
        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"
            android:title="@string/debug_ui_category">

+0 −10
Original line number Diff line number Diff line
@@ -38,16 +38,6 @@
                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
+21 −0
Original line number Diff line number Diff line
@@ -19,7 +19,9 @@ package com.android.settings;
import android.app.ActivityManagerNative;
import android.app.AlertDialog;
import android.app.Dialog;
import android.app.backup.IBackupManager;
import android.content.ContentResolver;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
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 HDCP_CHECKING_KEY = "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 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 IWindowManager mWindowManager;
    private IBackupManager mBackupManager;

    private CheckBoxPreference mEnableAdb;
    private CheckBoxPreference mKeepScreenOn;
    private CheckBoxPreference mAllowMockLocation;
    private PreferenceScreen mPassword;

    private CheckBoxPreference mStrictMode;
    private CheckBoxPreference mPointerLocation;
@@ -95,12 +100,15 @@ public class DevelopmentSettings extends PreferenceFragment
        super.onCreate(icicle);

        mWindowManager = IWindowManager.Stub.asInterface(ServiceManager.getService("window"));
        mBackupManager = IBackupManager.Stub.asInterface(
                ServiceManager.getService(Context.BACKUP_SERVICE));

        addPreferencesFromResource(R.xml.development_prefs);

        mEnableAdb = (CheckBoxPreference) findPreference(ENABLE_ADB);
        mKeepScreenOn = (CheckBoxPreference) findPreference(KEEP_SCREEN_ON);
        mAllowMockLocation = (CheckBoxPreference) findPreference(ALLOW_MOCK_LOCATION);
        mPassword = (PreferenceScreen) findPreference(LOCAL_BACKUP_PASSWORD);

        mStrictMode = (CheckBoxPreference) findPreference(STRICT_MODE_KEY);
        mPointerLocation = (CheckBoxPreference) findPreference(POINTER_LOCATION_KEY);
@@ -144,6 +152,7 @@ public class DevelopmentSettings extends PreferenceFragment
        mAllowMockLocation.setChecked(Settings.Secure.getInt(cr,
                Settings.Secure.ALLOW_MOCK_LOCATION, 0) != 0);
        updateHdcpValues();
        updatePasswordSummary();
        updateStrictModeVisualOptions();
        updatePointerLocationOptions();
        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
    // strictmode flashes.  One of:
    //    0: not explicitly set one way or another
+5 −27
Original line number Diff line number Diff line
@@ -43,13 +43,11 @@ 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;
@@ -66,7 +64,6 @@ 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().
@@ -104,18 +101,13 @@ public class PrivacySettings extends SettingsPreferenceFragment implements
                setBackupEnabled(true);
            }
        } else if (preference == mAutoRestore) {
            IBackupManager bm = IBackupManager.Stub.asInterface(
                    ServiceManager.getService(Context.BACKUP_SERVICE));
            if (bm != null) {
                // TODO: disable via the backup manager interface
            boolean curState = mAutoRestore.isChecked();
            try {
                    bm.setAutoRestore(curState);
                mBackupManager.setAutoRestore(curState);
            } catch (RemoteException e) {
                mAutoRestore.setChecked(!curState);
            }
        }
        }
        return super.onPreferenceTreeClick(preferenceScreen, preference);
    }

@@ -161,8 +153,6 @@ public class PrivacySettings extends SettingsPreferenceFragment implements
        mConfigure.setEnabled(configureEnabled);
        mConfigure.setIntent(configIntent);
        setConfigureSummary(configSummary);

        updatePasswordSummary();
}

    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) {
        if (which == DialogInterface.BUTTON_POSITIVE) {
            //updateProviders();