Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e89345ac authored by Sunny Goyal's avatar Sunny Goyal Committed by android-build-merger
Browse files

Merge "Fixing settings crash when no default home app is set" into pi-dev am: ee2ac819

am: 472037fd

Change-Id: I529c019f5109297f5ec3064128367d3c66ac931e
parents 7fc5f884 472037fd
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -91,6 +91,9 @@ public class DefaultHomePreferenceController extends DefaultAppPreferenceControl

    @Override
    protected Intent getSettingIntent(DefaultAppInfo info) {
        if (info == null) {
            return null;
        }
        final String packageName;
        if (info.componentName != null) {
            packageName = info.componentName.getPackageName();
+14 −0
Original line number Diff line number Diff line
@@ -88,6 +88,13 @@ public class DefaultHomePreferenceControllerTest {
        verify(mPackageManager).getHomeActivities(anyList());
    }

    @Test
    public void getDefaultApp_noDefaultHome_shouldReturnNull() {
        when(mPackageManager.getHomeActivities(anyList())).thenReturn(null);

        assertThat(mController.getDefaultAppInfo()).isNull();
    }

    @Test
    public void updateState_noDefaultApp_shouldAskPackageManagerForOnlyApp() {
        when(mPackageManager.getHomeActivities(anyList())).thenReturn(null);
@@ -152,4 +159,11 @@ public class DefaultHomePreferenceControllerTest {
            .thenReturn(Arrays.asList(mock(ResolveInfo.class), mock(ResolveInfo.class)));
        assertThat(mController.getSettingIntent(mController.getDefaultAppInfo())).isNull();
    }

    @Test
    public void testGetSettingIntent_noDefauldHome_shouldReturnNull() {
        when(mPackageManager.getHomeActivities(anyList())).thenReturn(null);
        assertThat(mController.getSettingIntent(mController.getDefaultAppInfo())).isNull();
    }

}