In two places, Settings uses getProfileIdsWithDisabled intending to
restrict itself to *managed* profiles, but actually allows for any type
of profile.
Since the declared intent is to only deal with managed profiles, we
update the code to only consider managed profiles.
On devices that only have managed profiles (currently almost all
devices), this cl is a no-op.
Bug: 230495929
Bug: 230534572
Bug: 170249807
Test: com.android.settings.UtilsTest
Test: make RunSettingsRoboTests -j
Change-Id: Id04d45839ef61080b00ca2f91525718cb3a85120
Controller generates the injection location settings
in updateState() which happens in onResume.
That's the primary reason why we observed the shifting issue.
In a good practice, we generate preference in displayPreference(),
and then update the setting state in updateState().
In this cl, we create a base controller class to encapsulate
most implementation, and developer need to inject location
services in child class.
Test: Add work profile, and see correct services list.
Bug: 183169265
Change-Id: I5735ba974da87ad83b56791abd8a8637c2317571