Update wallet setting availability

For devices that don't support wallet, don't even show the setting in
a disabled state, which can cause confusion and lead the user to
believe they can enable it somehow.

Fixes: 251089510
Test: WalletPrivacyPreferenceControllerTest
Change-Id: I5d60957f24712bb4d75e72fa5f64cab35b6d6a5f
This commit is contained in:
Matt Pietal
2023-01-04 21:39:43 +00:00
parent cb8c1c6c85
commit c617ae851d
2 changed files with 25 additions and 4 deletions

View File

@@ -64,15 +64,18 @@ public class WalletPrivacyPreferenceController extends TogglePreferenceControlle
public int getAvailabilityStatus() {
if (CustomizableLockScreenUtils.isFeatureEnabled(mContext)) {
return UNSUPPORTED_ON_DEVICE;
} else if (!isEnabled()) {
return UNSUPPORTED_ON_DEVICE;
} else if (!isSecure()) {
return DISABLED_DEPENDENT_SETTING;
}
return isEnabled() && isSecure() ? AVAILABLE : DISABLED_DEPENDENT_SETTING;
return AVAILABLE;
}
@Override
public void updateState(Preference preference) {
super.updateState(preference);
preference.setEnabled(getAvailabilityStatus() != DISABLED_DEPENDENT_SETTING);
preference.setEnabled(getAvailabilityStatus() == AVAILABLE);
refreshSummary(preference);
}