Search in sources :

Example 6 with DefaultSmsPreferenceController

use of com.android.settings.applications.defaultapps.DefaultSmsPreferenceController in project android_packages_apps_Settings by LineageOS.

the class DefaultAppSettings method buildPreferenceControllers.

private static List<AbstractPreferenceController> buildPreferenceControllers(Context context) {
    final List<AbstractPreferenceController> controllers = new ArrayList<>();
    controllers.add(new DefaultAssistPreferenceController(context, KEY_ASSIST_VOICE_INPUT, false));
    controllers.add(new DefaultBrowserPreferenceController(context));
    controllers.add(new DefaultWorkBrowserPreferenceController(context));
    controllers.add(new DefaultPhonePreferenceController(context));
    controllers.add(new DefaultWorkPhonePreferenceController(context));
    controllers.add(new DefaultSmsPreferenceController(context));
    controllers.add(new DefaultEmergencyPreferenceController(context));
    controllers.add(new DefaultHomePreferenceController(context));
    controllers.add(new DefaultPaymentSettingsPreferenceController(context));
    return controllers;
}
Also used : DefaultWorkPhonePreferenceController(com.android.settings.applications.defaultapps.DefaultWorkPhonePreferenceController) DefaultPhonePreferenceController(com.android.settings.applications.defaultapps.DefaultPhonePreferenceController) DefaultBrowserPreferenceController(com.android.settings.applications.defaultapps.DefaultBrowserPreferenceController) AbstractPreferenceController(com.android.settingslib.core.AbstractPreferenceController) DefaultHomePreferenceController(com.android.settings.applications.defaultapps.DefaultHomePreferenceController) DefaultPaymentSettingsPreferenceController(com.android.settings.applications.defaultapps.DefaultPaymentSettingsPreferenceController) ArrayList(java.util.ArrayList) DefaultWorkBrowserPreferenceController(com.android.settings.applications.defaultapps.DefaultWorkBrowserPreferenceController) DefaultEmergencyPreferenceController(com.android.settings.applications.defaultapps.DefaultEmergencyPreferenceController) DefaultAssistPreferenceController(com.android.settings.applications.assist.DefaultAssistPreferenceController) DefaultSmsPreferenceController(com.android.settings.applications.defaultapps.DefaultSmsPreferenceController)

Example 7 with DefaultSmsPreferenceController

use of com.android.settings.applications.defaultapps.DefaultSmsPreferenceController in project android_packages_apps_Settings by LineageOS.

the class DefaultAppSettingsTest method setListening_shouldUpdateSummary.

@Test
public void setListening_shouldUpdateSummary() {
    final SummaryLoader summaryLoader = mock(SummaryLoader.class);
    final DefaultAppSettings.SummaryProvider summaryProvider = new DefaultAppSettings.SummaryProvider(mContext, summaryLoader);
    final DefaultSmsPreferenceController defaultSms = mock(DefaultSmsPreferenceController.class);
    final DefaultBrowserPreferenceController defaultBrowser = mock(DefaultBrowserPreferenceController.class);
    final DefaultPhonePreferenceController defaultPhone = mock(DefaultPhonePreferenceController.class);
    ReflectionHelpers.setField(summaryProvider, "mDefaultSmsPreferenceController", defaultSms);
    ReflectionHelpers.setField(summaryProvider, "mDefaultBrowserPreferenceController", defaultBrowser);
    ReflectionHelpers.setField(summaryProvider, "mDefaultPhonePreferenceController", defaultPhone);
    // all available
    when(defaultSms.getDefaultAppLabel()).thenReturn("Sms1");
    when(defaultBrowser.getDefaultAppLabel()).thenReturn("Browser1");
    when(defaultPhone.getDefaultAppLabel()).thenReturn("Phone1");
    summaryProvider.setListening(true);
    verify(summaryLoader).setSummary(summaryProvider, "Sms1, Browser1, Phone1");
    // 2 available
    when(defaultSms.getDefaultAppLabel()).thenReturn(null);
    when(defaultBrowser.getDefaultAppLabel()).thenReturn("Browser1");
    when(defaultPhone.getDefaultAppLabel()).thenReturn("Phone1");
    summaryProvider.setListening(true);
    verify(summaryLoader).setSummary(summaryProvider, "Browser1, Phone1");
    when(defaultSms.getDefaultAppLabel()).thenReturn("Sms1");
    when(defaultBrowser.getDefaultAppLabel()).thenReturn(null);
    when(defaultPhone.getDefaultAppLabel()).thenReturn("Phone1");
    summaryProvider.setListening(true);
    verify(summaryLoader).setSummary(summaryProvider, "Sms1, Phone1");
    when(defaultSms.getDefaultAppLabel()).thenReturn("Sms1");
    when(defaultBrowser.getDefaultAppLabel()).thenReturn("Browser1");
    when(defaultPhone.getDefaultAppLabel()).thenReturn(null);
    summaryProvider.setListening(true);
    verify(summaryLoader).setSummary(summaryProvider, "Sms1, Browser1");
    // 1 available
    when(defaultSms.getDefaultAppLabel()).thenReturn(null);
    when(defaultBrowser.getDefaultAppLabel()).thenReturn("Browser1");
    when(defaultPhone.getDefaultAppLabel()).thenReturn(null);
    summaryProvider.setListening(true);
    verify(summaryLoader).setSummary(summaryProvider, "Browser1");
    when(defaultSms.getDefaultAppLabel()).thenReturn("Sms1");
    when(defaultBrowser.getDefaultAppLabel()).thenReturn(null);
    when(defaultPhone.getDefaultAppLabel()).thenReturn(null);
    summaryProvider.setListening(true);
    verify(summaryLoader).setSummary(summaryProvider, "Sms1");
    when(defaultSms.getDefaultAppLabel()).thenReturn(null);
    when(defaultBrowser.getDefaultAppLabel()).thenReturn(null);
    when(defaultPhone.getDefaultAppLabel()).thenReturn("Phone1");
    summaryProvider.setListening(true);
    verify(summaryLoader).setSummary(summaryProvider, "Phone1");
    // None available
    when(defaultSms.getDefaultAppLabel()).thenReturn(null);
    when(defaultBrowser.getDefaultAppLabel()).thenReturn(null);
    when(defaultPhone.getDefaultAppLabel()).thenReturn(null);
    summaryProvider.setListening(true);
    verify(summaryLoader, never()).setSummary(summaryProvider, eq(anyString()));
}
Also used : DefaultPhonePreferenceController(com.android.settings.applications.defaultapps.DefaultPhonePreferenceController) DefaultBrowserPreferenceController(com.android.settings.applications.defaultapps.DefaultBrowserPreferenceController) SummaryLoader(com.android.settings.dashboard.SummaryLoader) DefaultSmsPreferenceController(com.android.settings.applications.defaultapps.DefaultSmsPreferenceController) Test(org.junit.Test)

Example 8 with DefaultSmsPreferenceController

use of com.android.settings.applications.defaultapps.DefaultSmsPreferenceController in project android_packages_apps_Settings by DirtyUnicorns.

the class DefaultAppSettingsTest method setListening_shouldUpdateSummary.

@Test
public void setListening_shouldUpdateSummary() {
    final SummaryLoader summaryLoader = mock(SummaryLoader.class);
    final DefaultAppSettings.SummaryProvider summaryProvider = new DefaultAppSettings.SummaryProvider(mContext, summaryLoader);
    final DefaultSmsPreferenceController defaultSms = mock(DefaultSmsPreferenceController.class);
    final DefaultBrowserPreferenceController defaultBrowser = mock(DefaultBrowserPreferenceController.class);
    final DefaultPhonePreferenceController defaultPhone = mock(DefaultPhonePreferenceController.class);
    ReflectionHelpers.setField(summaryProvider, "mDefaultSmsPreferenceController", defaultSms);
    ReflectionHelpers.setField(summaryProvider, "mDefaultBrowserPreferenceController", defaultBrowser);
    ReflectionHelpers.setField(summaryProvider, "mDefaultPhonePreferenceController", defaultPhone);
    // all available
    when(defaultSms.getDefaultAppLabel()).thenReturn("Sms1");
    when(defaultBrowser.getDefaultAppLabel()).thenReturn("Browser1");
    when(defaultPhone.getDefaultAppLabel()).thenReturn("Phone1");
    summaryProvider.setListening(true);
    verify(summaryLoader).setSummary(summaryProvider, "Sms1, Browser1, Phone1");
    // 2 available
    when(defaultSms.getDefaultAppLabel()).thenReturn(null);
    when(defaultBrowser.getDefaultAppLabel()).thenReturn("Browser1");
    when(defaultPhone.getDefaultAppLabel()).thenReturn("Phone1");
    summaryProvider.setListening(true);
    verify(summaryLoader).setSummary(summaryProvider, "Browser1, Phone1");
    when(defaultSms.getDefaultAppLabel()).thenReturn("Sms1");
    when(defaultBrowser.getDefaultAppLabel()).thenReturn(null);
    when(defaultPhone.getDefaultAppLabel()).thenReturn("Phone1");
    summaryProvider.setListening(true);
    verify(summaryLoader).setSummary(summaryProvider, "Sms1, Phone1");
    when(defaultSms.getDefaultAppLabel()).thenReturn("Sms1");
    when(defaultBrowser.getDefaultAppLabel()).thenReturn("Browser1");
    when(defaultPhone.getDefaultAppLabel()).thenReturn(null);
    summaryProvider.setListening(true);
    verify(summaryLoader).setSummary(summaryProvider, "Sms1, Browser1");
    // 1 available
    when(defaultSms.getDefaultAppLabel()).thenReturn(null);
    when(defaultBrowser.getDefaultAppLabel()).thenReturn("Browser1");
    when(defaultPhone.getDefaultAppLabel()).thenReturn(null);
    summaryProvider.setListening(true);
    verify(summaryLoader).setSummary(summaryProvider, "Browser1");
    when(defaultSms.getDefaultAppLabel()).thenReturn("Sms1");
    when(defaultBrowser.getDefaultAppLabel()).thenReturn(null);
    when(defaultPhone.getDefaultAppLabel()).thenReturn(null);
    summaryProvider.setListening(true);
    verify(summaryLoader).setSummary(summaryProvider, "Sms1");
    when(defaultSms.getDefaultAppLabel()).thenReturn(null);
    when(defaultBrowser.getDefaultAppLabel()).thenReturn(null);
    when(defaultPhone.getDefaultAppLabel()).thenReturn("Phone1");
    summaryProvider.setListening(true);
    verify(summaryLoader).setSummary(summaryProvider, "Phone1");
    // None available
    when(defaultSms.getDefaultAppLabel()).thenReturn(null);
    when(defaultBrowser.getDefaultAppLabel()).thenReturn(null);
    when(defaultPhone.getDefaultAppLabel()).thenReturn(null);
    summaryProvider.setListening(true);
    verify(summaryLoader, never()).setSummary(summaryProvider, eq(anyString()));
}
Also used : DefaultPhonePreferenceController(com.android.settings.applications.defaultapps.DefaultPhonePreferenceController) DefaultBrowserPreferenceController(com.android.settings.applications.defaultapps.DefaultBrowserPreferenceController) SummaryLoader(com.android.settings.dashboard.SummaryLoader) DefaultSmsPreferenceController(com.android.settings.applications.defaultapps.DefaultSmsPreferenceController) Test(org.junit.Test)

Example 9 with DefaultSmsPreferenceController

use of com.android.settings.applications.defaultapps.DefaultSmsPreferenceController in project android_packages_apps_Settings by crdroidandroid.

the class DefaultAppSettings method buildPreferenceControllers.

private static List<AbstractPreferenceController> buildPreferenceControllers(Context context) {
    final List<AbstractPreferenceController> controllers = new ArrayList<>();
    controllers.add(new DefaultAssistPreferenceController(context, KEY_ASSIST_VOICE_INPUT, false));
    controllers.add(new DefaultBrowserPreferenceController(context));
    controllers.add(new DefaultWorkBrowserPreferenceController(context));
    controllers.add(new DefaultPhonePreferenceController(context));
    controllers.add(new DefaultWorkPhonePreferenceController(context));
    controllers.add(new DefaultSmsPreferenceController(context));
    controllers.add(new DefaultEmergencyPreferenceController(context));
    controllers.add(new DefaultHomePreferenceController(context));
    controllers.add(new DefaultPaymentSettingsPreferenceController(context));
    return controllers;
}
Also used : DefaultWorkPhonePreferenceController(com.android.settings.applications.defaultapps.DefaultWorkPhonePreferenceController) DefaultPhonePreferenceController(com.android.settings.applications.defaultapps.DefaultPhonePreferenceController) DefaultBrowserPreferenceController(com.android.settings.applications.defaultapps.DefaultBrowserPreferenceController) AbstractPreferenceController(com.android.settingslib.core.AbstractPreferenceController) DefaultHomePreferenceController(com.android.settings.applications.defaultapps.DefaultHomePreferenceController) DefaultPaymentSettingsPreferenceController(com.android.settings.applications.defaultapps.DefaultPaymentSettingsPreferenceController) ArrayList(java.util.ArrayList) DefaultWorkBrowserPreferenceController(com.android.settings.applications.defaultapps.DefaultWorkBrowserPreferenceController) DefaultEmergencyPreferenceController(com.android.settings.applications.defaultapps.DefaultEmergencyPreferenceController) DefaultAssistPreferenceController(com.android.settings.applications.assist.DefaultAssistPreferenceController) DefaultSmsPreferenceController(com.android.settings.applications.defaultapps.DefaultSmsPreferenceController)

Example 10 with DefaultSmsPreferenceController

use of com.android.settings.applications.defaultapps.DefaultSmsPreferenceController in project android_packages_apps_Settings by crdroidandroid.

the class DefaultAppSettingsTest method setListening_shouldUpdateSummary.

@Test
public void setListening_shouldUpdateSummary() {
    final SummaryLoader summaryLoader = mock(SummaryLoader.class);
    final DefaultAppSettings.SummaryProvider summaryProvider = new DefaultAppSettings.SummaryProvider(mContext, summaryLoader);
    final DefaultSmsPreferenceController defaultSms = mock(DefaultSmsPreferenceController.class);
    final DefaultBrowserPreferenceController defaultBrowser = mock(DefaultBrowserPreferenceController.class);
    final DefaultPhonePreferenceController defaultPhone = mock(DefaultPhonePreferenceController.class);
    ReflectionHelpers.setField(summaryProvider, "mDefaultSmsPreferenceController", defaultSms);
    ReflectionHelpers.setField(summaryProvider, "mDefaultBrowserPreferenceController", defaultBrowser);
    ReflectionHelpers.setField(summaryProvider, "mDefaultPhonePreferenceController", defaultPhone);
    // all available
    when(defaultSms.getDefaultAppLabel()).thenReturn("Sms1");
    when(defaultBrowser.getDefaultAppLabel()).thenReturn("Browser1");
    when(defaultPhone.getDefaultAppLabel()).thenReturn("Phone1");
    summaryProvider.setListening(true);
    verify(summaryLoader).setSummary(summaryProvider, "Sms1, Browser1, Phone1");
    // 2 available
    when(defaultSms.getDefaultAppLabel()).thenReturn(null);
    when(defaultBrowser.getDefaultAppLabel()).thenReturn("Browser1");
    when(defaultPhone.getDefaultAppLabel()).thenReturn("Phone1");
    summaryProvider.setListening(true);
    verify(summaryLoader).setSummary(summaryProvider, "Browser1, Phone1");
    when(defaultSms.getDefaultAppLabel()).thenReturn("Sms1");
    when(defaultBrowser.getDefaultAppLabel()).thenReturn(null);
    when(defaultPhone.getDefaultAppLabel()).thenReturn("Phone1");
    summaryProvider.setListening(true);
    verify(summaryLoader).setSummary(summaryProvider, "Sms1, Phone1");
    when(defaultSms.getDefaultAppLabel()).thenReturn("Sms1");
    when(defaultBrowser.getDefaultAppLabel()).thenReturn("Browser1");
    when(defaultPhone.getDefaultAppLabel()).thenReturn(null);
    summaryProvider.setListening(true);
    verify(summaryLoader).setSummary(summaryProvider, "Sms1, Browser1");
    // 1 available
    when(defaultSms.getDefaultAppLabel()).thenReturn(null);
    when(defaultBrowser.getDefaultAppLabel()).thenReturn("Browser1");
    when(defaultPhone.getDefaultAppLabel()).thenReturn(null);
    summaryProvider.setListening(true);
    verify(summaryLoader).setSummary(summaryProvider, "Browser1");
    when(defaultSms.getDefaultAppLabel()).thenReturn("Sms1");
    when(defaultBrowser.getDefaultAppLabel()).thenReturn(null);
    when(defaultPhone.getDefaultAppLabel()).thenReturn(null);
    summaryProvider.setListening(true);
    verify(summaryLoader).setSummary(summaryProvider, "Sms1");
    when(defaultSms.getDefaultAppLabel()).thenReturn(null);
    when(defaultBrowser.getDefaultAppLabel()).thenReturn(null);
    when(defaultPhone.getDefaultAppLabel()).thenReturn("Phone1");
    summaryProvider.setListening(true);
    verify(summaryLoader).setSummary(summaryProvider, "Phone1");
    // None available
    when(defaultSms.getDefaultAppLabel()).thenReturn(null);
    when(defaultBrowser.getDefaultAppLabel()).thenReturn(null);
    when(defaultPhone.getDefaultAppLabel()).thenReturn(null);
    summaryProvider.setListening(true);
    verify(summaryLoader, never()).setSummary(summaryProvider, eq(anyString()));
}
Also used : DefaultPhonePreferenceController(com.android.settings.applications.defaultapps.DefaultPhonePreferenceController) DefaultBrowserPreferenceController(com.android.settings.applications.defaultapps.DefaultBrowserPreferenceController) SummaryLoader(com.android.settings.dashboard.SummaryLoader) DefaultSmsPreferenceController(com.android.settings.applications.defaultapps.DefaultSmsPreferenceController) Test(org.junit.Test)

Aggregations

DefaultBrowserPreferenceController (com.android.settings.applications.defaultapps.DefaultBrowserPreferenceController)12 DefaultPhonePreferenceController (com.android.settings.applications.defaultapps.DefaultPhonePreferenceController)12 DefaultSmsPreferenceController (com.android.settings.applications.defaultapps.DefaultSmsPreferenceController)12 DefaultAssistPreferenceController (com.android.settings.applications.assist.DefaultAssistPreferenceController)6 DefaultEmergencyPreferenceController (com.android.settings.applications.defaultapps.DefaultEmergencyPreferenceController)6 DefaultHomePreferenceController (com.android.settings.applications.defaultapps.DefaultHomePreferenceController)6 DefaultPaymentSettingsPreferenceController (com.android.settings.applications.defaultapps.DefaultPaymentSettingsPreferenceController)6 DefaultWorkBrowserPreferenceController (com.android.settings.applications.defaultapps.DefaultWorkBrowserPreferenceController)6 DefaultWorkPhonePreferenceController (com.android.settings.applications.defaultapps.DefaultWorkPhonePreferenceController)6 SummaryLoader (com.android.settings.dashboard.SummaryLoader)6 AbstractPreferenceController (com.android.settingslib.core.AbstractPreferenceController)6 ArrayList (java.util.ArrayList)6 Test (org.junit.Test)6