Expand isAvailable to include DISABLED_DEPENDENT

isAvailable will now return true when getAvailabilityStatus
returns DISABLED_DEPENDENT_SETTING. This is because the setting
should be displayed in the Fragment even if it has a dependent setting,
which matches existing behaviour. Slices will still display the warning
slice without inline content, where the main action brings you to the
setting page. For now, we have to assume the user will be able to figure
out how to enable the setting. In Q, we would like to build a more
intelligent flow so that we can prompt or even help the user fix the
dependency (we just ran out of time in P).

The only setting that had previously used DISABLE_DEPENDENT_SETTING
was a developer option.

Change-Id: I1f774a2e09cb60de01388cf6c35785c8b5dea176
Fixes: 77334915
Test: robotests
This commit is contained in:
Matthew Fritze
2018-03-30 13:54:08 -07:00
parent e35e00712c
commit 8c48defb52
5 changed files with 139 additions and 24 deletions

View File

@@ -43,7 +43,7 @@ public class PreferenceCategoryController extends BasePreferenceController {
@Override
public int getAvailabilityStatus() {
if (mChildren == null || mChildren.isEmpty()) {
return DISABLED_DEPENDENT_SETTING;
return DISABLED_UNSUPPORTED;
}
// Category is available if any child is available
for (AbstractPreferenceController controller : mChildren) {
@@ -51,7 +51,7 @@ public class PreferenceCategoryController extends BasePreferenceController {
return AVAILABLE;
}
}
return DISABLED_DEPENDENT_SETTING;
return DISABLED_UNSUPPORTED;
}
@Override