Fix flag check for preserve settings feature

getApplicationContext() returns null when calling to get Context object
to pass to FeatureFlagUtils.isEnabled(). Replace with getBaseContext()

Test: Verify the context is not null through logs
Change-Id: I0c27c5bc09e3fc84abeafb0a4ead3357cacc3d2a
This commit is contained in:
Ruslan Tkhakokhov
2020-02-03 23:44:34 +00:00
parent 2b1f4315b0
commit efd9c181eb

View File

@@ -626,7 +626,7 @@ public class SettingsBackupAgent extends BackupAgentHelper {
* Get names of the settings for which the current value should be preserved during restore.
*/
private Set<String> getSettingsToPreserveInRestore(Uri settingsUri) {
if (!FeatureFlagUtils.isEnabled(getApplicationContext(),
if (!FeatureFlagUtils.isEnabled(getBaseContext(),
FeatureFlagUtils.SETTINGS_DO_NOT_RESTORE_PRESERVED)) {
return Collections.emptySet();
}