Convert location settings to DashboardFragment.

- change LocationMode, LocationSettings, and ScanningSettings to be
DashboardFragment.
- remove LocationSettingsBase and moved base logics into base
controller.
- add controllers for the preferences under the 3 location settings
pages.

Fixes: 68719207
Test: make RunSettingsRoboTests
Change-Id: Icedf691c2a9f7989faebee39ea9da672209b7957
This commit is contained in:
Doris Ling
2017-11-02 16:42:45 -07:00
parent bbdc72c95a
commit 9ed29a2e57
35 changed files with 2657 additions and 626 deletions

View File

@@ -30,6 +30,7 @@ import android.graphics.drawable.Drawable;
import android.location.SettingInjectorService;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.os.Messenger;
import android.os.SystemClock;
@@ -252,6 +253,28 @@ class SettingsInjector {
return prefs;
}
/**
* Checks wheteher there is any preference that other apps have injected.
*
* @param profileId Identifier of the user/profile to obtain the injected settings for or
* UserHandle.USER_CURRENT for all profiles associated with current user.
*/
public boolean hasInjectedSettings(final int profileId) {
final UserManager um = (UserManager) mContext.getSystemService(Context.USER_SERVICE);
final List<UserHandle> profiles = um.getUserProfiles();
final int profileCount = profiles.size();
for (int i = 0; i < profileCount; ++i) {
final UserHandle userHandle = profiles.get(i);
if (profileId == UserHandle.USER_CURRENT || profileId == userHandle.getIdentifier()) {
Iterable<InjectedSetting> settings = getSettings(userHandle);
for (InjectedSetting setting : settings) {
return true;
}
}
}
return false;
}
/**
* Reloads the status messages for all the preference items.
*/
@@ -338,6 +361,9 @@ class SettingsInjector {
private boolean mReloadRequested;
private StatusLoadingHandler() {
super(Looper.getMainLooper());
}
@Override
public void handleMessage(Message msg) {
if (Log.isLoggable(TAG, Log.DEBUG)) {