Merge "Fixing settings crash when no default home app is set" into pi-dev
am: ee2ac81999
Change-Id: Ie74613b09179d9c518139cfc597ad62479d9d7c5
This commit is contained in:
@@ -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();
|
||||
|
@@ -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();
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user