Hide "Changes made by your organization's admin" when empty

The admin of a manged device can take a number actions that will be
listed in the "Changes made by your organization's admin" section of
Settings. If the admin has not taken any such actions, the section
will be empty and should be hidden. This is accomplished by having a
PreferenceController for the section that observes the state of the
PreferenceControllers inside it.

Bug: 35912953
Test: m RunSettingsRoboTests

Merged-in: Ia95754493ee6c5a19b4aa9731fd56fd558e61849

Change-Id: I82ca00b757001390f9a517b0c07057bdc49dab20
This commit is contained in:
Bartosz Fabianowski
2017-05-18 11:46:38 +02:00
parent 92f78354f9
commit 493495452a
28 changed files with 669 additions and 51 deletions

View File

@@ -1,3 +1,4 @@
/*
* Copyright (C) 2017 The Android Open Source Project
*
@@ -48,7 +49,9 @@ public class EnterpriseSetDefaultAppsPreferenceController
@Override
public boolean isAvailable() {
return getNumberOfEnterpriseSetDefaultApps() > 0;
final boolean available = getNumberOfEnterpriseSetDefaultApps() > 0;
notifyOnAvailabilityUpdate(available);
return available;
}
@Override