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

Commit 966e304a authored by Biswarup Pal's avatar Biswarup Pal
Browse files

Fallback to default device settings if not found for virtual device

Add a deviceId check so that we perform the fallback only when
the original request was for a virtual device.

Test: atest SettingsProviderTest
Bug: 371801645
Flag: android.companion.virtualdevice.flags.device_aware_settings_override
Change-Id: Id35eef0fe155a0efbfa6e26943877df8a8db3b6d
parent ca9279ee
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -459,7 +459,8 @@ public class SettingsProvider extends ContentProvider {
                Setting setting = getSecureSetting(name, requestingUserId, callingDeviceId);
                // If any overridden setting is not available for a virtual device, return the
                // setting corresponding to the default device.
                if (setting == null || setting.isNull()) {
                if (callingDeviceId != Context.DEVICE_ID_DEFAULT
                        && (setting == null || setting.isNull())) {
                    setting = getSecureSetting(name, requestingUserId, Context.DEVICE_ID_DEFAULT);
                }
                return packageValueForCallResult(SETTINGS_TYPE_SECURE, name, requestingUserId,
@@ -469,7 +470,8 @@ public class SettingsProvider extends ContentProvider {
                Setting setting = getSystemSetting(name, requestingUserId, callingDeviceId);
                // If any overridden setting is not available for a virtual device, return the
                // setting corresponding to the default device.
                if (setting == null || setting.isNull()) {
                if (callingDeviceId != Context.DEVICE_ID_DEFAULT
                        && (setting == null || setting.isNull())) {
                    setting = getSystemSetting(name, requestingUserId, Context.DEVICE_ID_DEFAULT);
                }
                return packageValueForCallResult(SETTINGS_TYPE_SYSTEM, name, requestingUserId,