Merge "Register VmsPublisherService with VmsClientManager on construction time." into qt-dev am: 2bf78744d3
am: f653d45ebc
Change-Id: I7872c21c140fc313b113f833907608a823ac3ad2
diff --git a/service/src/com/android/car/VmsPublisherService.java b/service/src/com/android/car/VmsPublisherService.java
index 3384e3a..647b102 100644
--- a/service/src/com/android/car/VmsPublisherService.java
+++ b/service/src/com/android/car/VmsPublisherService.java
@@ -119,16 +119,14 @@
mContext = context;
mClientManager = clientManager;
mBrokerService = brokerService;
- }
-
- @Override
- public void init() {
mClientManager.registerConnectionListener(this);
}
@Override
+ public void init() {}
+
+ @Override
public void release() {
- mClientManager.unregisterConnectionListener(this);
mPublisherProxies.values().forEach(PublisherProxy::unregister);
mPublisherProxies.clear();
}
diff --git a/tests/carservice_unit_test/src/com/android/car/VmsPublisherServiceTest.java b/tests/carservice_unit_test/src/com/android/car/VmsPublisherServiceTest.java
index 2c63ef5..d65bc12 100644
--- a/tests/carservice_unit_test/src/com/android/car/VmsPublisherServiceTest.java
+++ b/tests/carservice_unit_test/src/com/android/car/VmsPublisherServiceTest.java
@@ -108,6 +108,8 @@
@Before
public void setUp() {
mPublisherService = new VmsPublisherService(mContext, mBrokerService, mClientManager);
+ verify(mClientManager).registerConnectionListener(mPublisherService);
+
mPublisherClient = new MockPublisherClient();
mPublisherClient2 = new MockPublisherClient();
when(mBrokerService.getSubscribersForLayerFromPublisher(LAYER, PUBLISHER_ID))
@@ -118,7 +120,6 @@
@Test
public void testInit() {
mPublisherService.init();
- verify(mClientManager).registerConnectionListener(mPublisherService);
}
@Test
@@ -637,7 +638,6 @@
@Test
public void testRelease() {
mPublisherService.release();
- verify(mClientManager).unregisterConnectionListener(mPublisherService);
}
private class MockPublisherClient extends IVmsPublisherClient.Stub {