Update summary for Connected devices->Printing.

The summary text now shows the number of enabled print services. Update
the flag to only select enabled service from PrintManager.

Bug: 36234108
Test: make RunSettingsRoboTests
Change-Id: I81e1584182edd1f290faa941c7d3ee711a9d67b8
This commit is contained in:
Doris Ling
2017-04-03 13:38:06 -07:00
parent 9b271041a9
commit c5f4120484
2 changed files with 4 additions and 3 deletions

View File

@@ -529,7 +529,7 @@ public class PrintSettingsFragment extends ProfileSettingsPreferenceFragment
if (mPrintManager != null) {
if (isListening) {
List<PrintServiceInfo> services =
mPrintManager.getPrintServices(PrintManager.ALL_SERVICES);
mPrintManager.getPrintServices(PrintManager.ENABLED_SERVICES);
if (services == null || services.isEmpty()) {
mSummaryLoader.setSummary(this,
mContext.getString(R.string.print_settings_summary_no_service));

View File

@@ -68,14 +68,15 @@ public class PrintSettingsFragmentTest {
when(printServices.isEmpty()).thenReturn(false);
when(printServices.size()).thenReturn(2);
// 2 services
when(mPrintManager.getPrintServices(PrintManager.ALL_SERVICES)).thenReturn(printServices);
when(mPrintManager.getPrintServices(PrintManager.ENABLED_SERVICES))
.thenReturn(printServices);
mSummaryProvider.setListening(true);
verify(mRes).getQuantityString(R.plurals.print_settings_summary, 2, 2);
// No service
when(mPrintManager.getPrintServices(PrintManager.ALL_SERVICES)).thenReturn(null);
when(mPrintManager.getPrintServices(PrintManager.ENABLED_SERVICES)).thenReturn(null);
mSummaryProvider.setListening(true);