Merge "Add smartspace complication even when targets empty." into tm-qpr-dev am: 8e4783d34e
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/19759403 Change-Id: I05a533e4e0d97c5a6cd6734b73cf0d23d0eefca8 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -70,11 +70,7 @@ public class SmartSpaceComplication implements Complication {
|
|||||||
new BcSmartspaceDataPlugin.SmartspaceTargetListener() {
|
new BcSmartspaceDataPlugin.SmartspaceTargetListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onSmartspaceTargetsUpdated(List<? extends Parcelable> targets) {
|
public void onSmartspaceTargetsUpdated(List<? extends Parcelable> targets) {
|
||||||
if (!targets.isEmpty()) {
|
mDreamOverlayStateController.addComplication(mComplication);
|
||||||
mDreamOverlayStateController.addComplication(mComplication);
|
|
||||||
} else {
|
|
||||||
mDreamOverlayStateController.removeComplication(mComplication);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ import org.mockito.Mock;
|
|||||||
import org.mockito.Mockito;
|
import org.mockito.Mockito;
|
||||||
import org.mockito.MockitoAnnotations;
|
import org.mockito.MockitoAnnotations;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Collections;
|
||||||
|
|
||||||
@SmallTest
|
@SmallTest
|
||||||
@RunWith(AndroidTestingRunner.class)
|
@RunWith(AndroidTestingRunner.class)
|
||||||
@@ -60,9 +60,6 @@ public class SmartSpaceComplicationTest extends SysuiTestCase {
|
|||||||
@Mock
|
@Mock
|
||||||
private SmartSpaceComplication mComplication;
|
private SmartSpaceComplication mComplication;
|
||||||
|
|
||||||
@Mock
|
|
||||||
private ComplicationViewModel mComplicationViewModel;
|
|
||||||
|
|
||||||
@Mock
|
@Mock
|
||||||
private View mBcSmartspaceView;
|
private View mBcSmartspaceView;
|
||||||
|
|
||||||
@@ -125,12 +122,12 @@ public class SmartSpaceComplicationTest extends SysuiTestCase {
|
|||||||
|
|
||||||
// Test
|
// Test
|
||||||
final SmartspaceTarget target = Mockito.mock(SmartspaceTarget.class);
|
final SmartspaceTarget target = Mockito.mock(SmartspaceTarget.class);
|
||||||
listenerCaptor.getValue().onSmartspaceTargetsUpdated(Arrays.asList(target));
|
listenerCaptor.getValue().onSmartspaceTargetsUpdated(Collections.singletonList(target));
|
||||||
verify(mDreamOverlayStateController).addComplication(eq(mComplication));
|
verify(mDreamOverlayStateController).addComplication(eq(mComplication));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testOverlayActive_targetsEmpty_removesComplication() {
|
public void testOverlayActive_targetsEmpty_addsComplication() {
|
||||||
final SmartSpaceComplication.Registrant registrant = getRegistrant();
|
final SmartSpaceComplication.Registrant registrant = getRegistrant();
|
||||||
registrant.start();
|
registrant.start();
|
||||||
|
|
||||||
@@ -145,13 +142,9 @@ public class SmartSpaceComplicationTest extends SysuiTestCase {
|
|||||||
ArgumentCaptor.forClass(BcSmartspaceDataPlugin.SmartspaceTargetListener.class);
|
ArgumentCaptor.forClass(BcSmartspaceDataPlugin.SmartspaceTargetListener.class);
|
||||||
verify(mSmartspaceController).addListener(listenerCaptor.capture());
|
verify(mSmartspaceController).addListener(listenerCaptor.capture());
|
||||||
|
|
||||||
final SmartspaceTarget target = Mockito.mock(SmartspaceTarget.class);
|
|
||||||
listenerCaptor.getValue().onSmartspaceTargetsUpdated(Arrays.asList(target));
|
|
||||||
verify(mDreamOverlayStateController).addComplication(eq(mComplication));
|
|
||||||
|
|
||||||
// Test
|
// Test
|
||||||
listenerCaptor.getValue().onSmartspaceTargetsUpdated(Arrays.asList());
|
listenerCaptor.getValue().onSmartspaceTargetsUpdated(Collections.emptyList());
|
||||||
verify(mDreamOverlayStateController).removeComplication(eq(mComplication));
|
verify(mDreamOverlayStateController).addComplication(eq(mComplication));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -170,8 +163,7 @@ public class SmartSpaceComplicationTest extends SysuiTestCase {
|
|||||||
ArgumentCaptor.forClass(BcSmartspaceDataPlugin.SmartspaceTargetListener.class);
|
ArgumentCaptor.forClass(BcSmartspaceDataPlugin.SmartspaceTargetListener.class);
|
||||||
verify(mSmartspaceController).addListener(listenerCaptor.capture());
|
verify(mSmartspaceController).addListener(listenerCaptor.capture());
|
||||||
|
|
||||||
final SmartspaceTarget target = Mockito.mock(SmartspaceTarget.class);
|
listenerCaptor.getValue().onSmartspaceTargetsUpdated(Collections.emptyList());
|
||||||
listenerCaptor.getValue().onSmartspaceTargetsUpdated(Arrays.asList(target));
|
|
||||||
verify(mDreamOverlayStateController).addComplication(eq(mComplication));
|
verify(mDreamOverlayStateController).addComplication(eq(mComplication));
|
||||||
|
|
||||||
// Test
|
// Test
|
||||||
|
|||||||
Reference in New Issue
Block a user