Add subtext to Default apps.

Retrieve the default Sms app, default Browser app, and default Phone app
and append the label together to form the summary text for Default apps
settings.

Bug: 36376411
Test: make RunSettingsRoboTests
Change-Id: I8ccf71dde43bba04c4bc4a900c9a181513e7710b
This commit is contained in:
Doris Ling
2017-04-05 16:03:02 -07:00
parent b52a341914
commit d007ff9395
4 changed files with 167 additions and 16 deletions

View File

@@ -49,10 +49,7 @@ public abstract class DefaultAppPreferenceController extends PreferenceControlle
@Override
public void updateState(Preference preference) {
final DefaultAppInfo app = getDefaultAppInfo();
CharSequence defaultAppLabel = null;
if (app != null) {
defaultAppLabel = app.loadLabel();
}
CharSequence defaultAppLabel = getDefaultAppLabel();
if (!TextUtils.isEmpty(defaultAppLabel)) {
preference.setSummary(defaultAppLabel);
} else {
@@ -84,4 +81,15 @@ public abstract class DefaultAppPreferenceController extends PreferenceControlle
//By default return null. It's up to subclasses to provide logic.
return null;
}
public CharSequence getDefaultAppLabel() {
if (!isAvailable()) {
return null;
}
final DefaultAppInfo app = getDefaultAppInfo();
if (app != null) {
return app.loadLabel();
}
return null;
}
}