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

Commit 891aab86 authored by Joël Stemmer's avatar Joël Stemmer Committed by Android (Google) Code Review
Browse files

Merge "Re-enable secureSettingsBackedUpOrDenied test"

parents 4a3a49cc 2a83cc99
Loading
Loading
Loading
Loading
+56 −7
Original line number Diff line number Diff line
@@ -31,7 +31,6 @@ import android.provider.settings.backup.SecureSettings;
import android.provider.settings.backup.SystemSettings;

import androidx.test.filters.SmallTest;
import androidx.test.filters.Suppress;
import androidx.test.runner.AndroidJUnit4;

import org.junit.Test;
@@ -709,7 +708,6 @@ public class SettingsBackupTest {
                 Settings.Secure.DOCKED_CLOCK_FACE,
                 Settings.Secure.DOZE_PULSE_ON_LONG_PRESS,
                 Settings.Secure.EMERGENCY_ASSISTANCE_APPLICATION,
                 Settings.Secure.ENABLED_ACCESSIBILITY_AUDIO_DESCRIPTION_BY_DEFAULT,
                 Settings.Secure.ENABLED_INPUT_METHODS,  // Intentionally removed in P
                 Settings.Secure.ENABLED_NOTIFICATION_ASSISTANT,
                 Settings.Secure.ENABLED_NOTIFICATION_LISTENERS,
@@ -837,15 +835,66 @@ public class SettingsBackupTest {
    }

    @Test
    @Suppress //("b/148236308")
    public void secureSettingsBackedUpOrDenied() {
        // List of settings that were not added to either SETTINGS_TO_BACKUP or
        // BACKUP_DENY_LIST_SECURE_SETTINGS while this test was suppressed in
        // the last two years. Settings in this list are temporarily allowed to
        // not be explicitly listed as backed up or denied so we can re-enable
        // this test.
        //
        // DO NOT ADD NEW SETTINGS TO THIS LIST!
        Set<String> settingsNotBackedUpOrDeniedTemporaryAllowList =
                newHashSet(
                        Settings.Secure.ACCESSIBILITY_ALLOW_DIAGONAL_SCROLLING,
                        Settings.Secure.AMBIENT_CONTEXT_CONSENT_COMPONENT,
                        Settings.Secure.AMBIENT_CONTEXT_EVENT_ARRAY_EXTRA_KEY,
                        Settings.Secure.AMBIENT_CONTEXT_PACKAGE_NAME_EXTRA_KEY,
                        Settings.Secure.ASSIST_LONG_PRESS_HOME_ENABLED,
                        Settings.Secure.ASSIST_TOUCH_GESTURE_ENABLED,
                        Settings.Secure.AUTO_REVOKE_DISABLED,
                        Settings.Secure.BIOMETRIC_APP_ENABLED,
                        Settings.Secure.BIOMETRIC_KEYGUARD_ENABLED,
                        Settings.Secure.BIOMETRIC_VIRTUAL_ENABLED,
                        Settings.Secure.BLUETOOTH_ADDR_VALID,
                        Settings.Secure.BLUETOOTH_ADDRESS,
                        Settings.Secure.BLUETOOTH_NAME,
                        Settings.Secure.BUBBLE_IMPORTANT_CONVERSATIONS,
                        Settings.Secure.CLIPBOARD_SHOW_ACCESS_NOTIFICATIONS,
                        Settings.Secure.COMMUNAL_MODE_ENABLED,
                        Settings.Secure.COMMUNAL_MODE_TRUSTED_NETWORKS,
                        Settings.Secure.DEFAULT_VOICE_INPUT_METHOD,
                        Settings.Secure.DOCK_SETUP_STATE,
                        Settings.Secure.EXTRA_AUTOMATIC_POWER_SAVE_MODE,
                        Settings.Secure.GAME_DASHBOARD_ALWAYS_ON,
                        Settings.Secure.HDMI_CEC_SET_MENU_LANGUAGE_DENYLIST,
                        Settings.Secure.LAUNCHER_TASKBAR_EDUCATION_SHOWING,
                        Settings.Secure.LOCATION_COARSE_ACCURACY_M,
                        Settings.Secure.LOCATION_SHOW_SYSTEM_OPS,
                        Settings.Secure.NAS_SETTINGS_UPDATED,
                        Settings.Secure.NAV_BAR_FORCE_VISIBLE,
                        Settings.Secure.NAV_BAR_KIDS_MODE,
                        Settings.Secure.NEARBY_FAST_PAIR_SETTINGS_DEVICES_COMPONENT,
                        Settings.Secure.NEARBY_SHARING_SLICE_URI,
                        Settings.Secure.NOTIFIED_NON_ACCESSIBILITY_CATEGORY_SERVICES,
                        Settings.Secure.ONE_HANDED_TUTORIAL_SHOW_COUNT,
                        Settings.Secure.RELEASE_COMPRESS_BLOCKS_ON_INSTALL,
                        Settings.Secure.SCREENSAVER_COMPLICATIONS_ENABLED,
                        Settings.Secure.SHOW_QR_CODE_SCANNER_SETTING,
                        Settings.Secure.SKIP_ACCESSIBILITY_SHORTCUT_DIALOG_TIMEOUT_RESTRICTION,
                        Settings.Secure.SPATIAL_AUDIO_ENABLED,
                        Settings.Secure.TIMEOUT_TO_USER_ZERO,
                        Settings.Secure.UI_NIGHT_MODE_LAST_COMPUTED,
                        Settings.Secure.UI_NIGHT_MODE_OVERRIDE_OFF,
                        Settings.Secure.UI_NIGHT_MODE_OVERRIDE_ON);

        HashSet<String> keys = new HashSet<String>();
        Collections.addAll(keys, SecureSettings.SETTINGS_TO_BACKUP);
        Collections.addAll(keys, DEVICE_SPECIFIC_SETTINGS_TO_BACKUP);
        checkSettingsBackedUpOrDenied(
                getCandidateSettings(Settings.Secure.class),
                keys,
                BACKUP_DENY_LIST_SECURE_SETTINGS);

        Set<String> allSettings = getCandidateSettings(Settings.Secure.class);
        allSettings.removeAll(settingsNotBackedUpOrDeniedTemporaryAllowList);

        checkSettingsBackedUpOrDenied(allSettings, keys, BACKUP_DENY_LIST_SECURE_SETTINGS);
    }

    private static void checkSettingsBackedUpOrDenied(