Backup device information

Adding the device information to the backup will allow us to restore
data which is device specific if it's appropriate to do so (e.g. device
density)

The device specific settings which will be backed up are;

Settings.Secure.DISPLAY_DENSITY_FORCED

Test: atest SettingsProviderTest SettingsBackupTest
Test: Manual - Density changes during SUW when setting is restored
Fixes: 28437818
Change-Id: Ibc3595cdece3f1ccb4fccaff8212c1c3cb5c9756
diff --git a/core/tests/coretests/src/android/provider/SettingsBackupTest.java b/core/tests/coretests/src/android/provider/SettingsBackupTest.java
index 89ba3df..bdbf368 100644
--- a/core/tests/coretests/src/android/provider/SettingsBackupTest.java
+++ b/core/tests/coretests/src/android/provider/SettingsBackupTest.java
@@ -35,6 +35,7 @@
 import org.junit.runner.RunWith;
 
 import java.lang.reflect.Field;
+import java.util.Collections;
 import java.util.HashSet;
 import java.util.Set;
 
@@ -625,7 +626,6 @@
                  Settings.Secure.DIALER_DEFAULT_APPLICATION,
                  Settings.Secure.DISABLED_PRINT_SERVICES,
                  Settings.Secure.DISABLED_SYSTEM_INPUT_METHODS,
-                 Settings.Secure.DISPLAY_DENSITY_FORCED,
                  Settings.Secure.DOCKED_CLOCK_FACE,
                  Settings.Secure.DOZE_PULSE_ON_LONG_PRESS,
                  Settings.Secure.EMERGENCY_ASSISTANCE_APPLICATION,
@@ -742,9 +742,12 @@
 
     @Test
     public void secureSettingsBackedUpOrBlacklisted() {
+        HashSet<String> keys = new HashSet<String>();
+        Collections.addAll(keys, Settings.Secure.SETTINGS_TO_BACKUP);
+        Collections.addAll(keys, Settings.Secure.DEVICE_SPECIFIC_SETTINGS_TO_BACKUP);
         checkSettingsBackedUpOrBlacklisted(
                 getCandidateSettings(Settings.Secure.class),
-                newHashSet(Settings.Secure.SETTINGS_TO_BACKUP),
+                keys,
             BACKUP_BLACKLISTED_SECURE_SETTINGS);
     }
 
@@ -758,9 +761,9 @@
                 is(empty()));
 
         assertThat(
-            "blacklisted settings backed up",
-            intersect(settingsToBackup, blacklist),
-            is(empty()));
+                "blacklisted settings backed up",
+                intersect(settingsToBackup, blacklist),
+                is(empty()));
     }
 
     private static Set<String> getCandidateSettings(Class<? extends Settings.NameValueTable> clazz) {