Fix VMS public API based on API review (ag/2593725).

Test: All tests were adjusted and pass.
Bug: 65115457
Change-Id: Id271170d2d67706d243817c556e294faad672631
diff --git a/car-lib/src/android/car/vms/IVmsPublisherService.aidl b/car-lib/src/android/car/vms/IVmsPublisherService.aidl
index 17775f1..3c26a1b 100644
--- a/car-lib/src/android/car/vms/IVmsPublisherService.aidl
+++ b/car-lib/src/android/car/vms/IVmsPublisherService.aidl
@@ -43,8 +43,8 @@
 
     /**
      * The first time a publisher calls this API it will store the publisher info and assigns the
-     * publisher a static ID. Between reboots, subsequent calls with the same publisher info will
-      * return the same ID so that a restarting process can obtain the same ID as it had before.
+     * publisher an ID. Between reboots, subsequent calls with the same publisher info will
+     * return the same ID so that a restarting process can obtain the same ID as it had before.
      */
-    int getPublisherStaticId(in byte[] publisherInfo) = 3;
+    int getPublisherId(in byte[] publisherInfo) = 3;
 }
diff --git a/car-lib/src/android/car/vms/IVmsSubscriberClient.aidl b/car-lib/src/android/car/vms/IVmsSubscriberClient.aidl
index 05edfaa..d5b5606 100644
--- a/car-lib/src/android/car/vms/IVmsSubscriberClient.aidl
+++ b/car-lib/src/android/car/vms/IVmsSubscriberClient.aidl
@@ -28,5 +28,5 @@
      */
     void onVmsMessageReceived(in VmsLayer layer, in byte[] payload) = 0;
 
-    void onLayersAvailabilityChange(in List<VmsAssociatedLayer> availableLayers) = 1;
+    void onLayersAvailabilityChanged(in List<VmsAssociatedLayer> availableLayers) = 1;
 }
diff --git a/car-lib/src/android/car/vms/VmsAssociatedLayer.java b/car-lib/src/android/car/vms/VmsAssociatedLayer.java
index dcd0d98..023fd9c 100644
--- a/car-lib/src/android/car/vms/VmsAssociatedLayer.java
+++ b/car-lib/src/android/car/vms/VmsAssociatedLayer.java
@@ -45,7 +45,7 @@
         return mLayer;
     }
 
-    public Collection<Integer> getPublisherIds() {
+    public Set<Integer> getPublisherIds() {
         return mPublisherIds;
     }
 
diff --git a/car-lib/src/android/car/vms/VmsLayer.java b/car-lib/src/android/car/vms/VmsLayer.java
index ee29e71..9125796 100644
--- a/car-lib/src/android/car/vms/VmsLayer.java
+++ b/car-lib/src/android/car/vms/VmsLayer.java
@@ -24,42 +24,39 @@
 
 /**
  * A VMS Layer which can be subscribed to by VMS clients.
- * Consists of the layer ID and the layer major version.
  *
- * This class does not contain the minor version since all minor version are backward and forward
- * compatible and should not be used for routing messages.
  * @hide
  */
 @FutureFeature
 public final class VmsLayer implements Parcelable {
 
-    // The layer ID.
-    private int mId;
+    // The layer Type.
+    private int mType;
+
+    // The layer Subtype.
+    private int mSubtype;
 
     // The layer version.
     private int mVersion;
 
-    // The layer type.
-    private int mSubType;
-
-    public VmsLayer(int id, int version, int subType) {
-        mId = id;
+    public VmsLayer(int type, int subtype, int version) {
+        mType = type;
+        mSubtype = subtype;
         mVersion = version;
-        mSubType = subType;
     }
 
-    public int getId() {
-        return mId;
+    public int getType() {
+        return mType;
+    }
+
+    public int getSubtype() {
+        return mSubtype;
     }
 
     public int getVersion() {
         return mVersion;
     }
 
-    public int getSubType() {
-        return mSubType;
-    }
-
     /**
      * Checks the two objects for equality by comparing their IDs and Versions.
      *
@@ -72,9 +69,9 @@
             return false;
         }
         VmsLayer p = (VmsLayer) o;
-        return Objects.equals(p.mId, mId) &&
-            Objects.equals(p.mVersion, mVersion) &&
-            Objects.equals(p.mSubType, mSubType);
+        return Objects.equals(p.mType, mType) &&
+            Objects.equals(p.mSubtype, mSubtype) &&
+            Objects.equals(p.mVersion, mVersion);
     }
 
     /**
@@ -84,12 +81,12 @@
      */
     @Override
     public int hashCode() {
-        return Objects.hash(mId, mVersion, mSubType);
+        return Objects.hash(mType, mSubtype, mVersion);
     }
 
     @Override
     public String toString() {
-        return "VmsLayer{ ID: " + mId + ", Version: " + mVersion + ", Sub type: " + mSubType + "}";
+        return "VmsLayer{ Type: " + mType + ", Sub type: " + mSubtype + ", Version: " + mVersion + "}";
     }
 
 
@@ -107,8 +104,8 @@
 
     @Override
     public void writeToParcel(Parcel out, int flags) {
-        out.writeInt(mId);
-        out.writeInt(mSubType);
+        out.writeInt(mType);
+        out.writeInt(mSubtype);
         out.writeInt(mVersion);
     }
 
@@ -122,8 +119,8 @@
     }
 
     private void readFromParcel(Parcel in) {
-        mId = in.readInt();
-        mSubType = in.readInt();
+        mType = in.readInt();
+        mSubtype = in.readInt();
         mVersion = in.readInt();
     }
 }
\ No newline at end of file
diff --git a/car-lib/src/android/car/vms/VmsLayerDependency.java b/car-lib/src/android/car/vms/VmsLayerDependency.java
index e14c7ec..3b82775 100644
--- a/car-lib/src/android/car/vms/VmsLayerDependency.java
+++ b/car-lib/src/android/car/vms/VmsLayerDependency.java
@@ -52,13 +52,6 @@
         mDependency = Collections.emptySet();
     }
 
-    /**
-     * Checks if a layer has a dependency.
-     */
-    public boolean hasDependencies() {
-        return (!mDependency.isEmpty());
-    }
-
     public VmsLayer getLayer() {
         return mLayer;
     }
diff --git a/car-lib/src/android/car/vms/VmsLayersOffering.java b/car-lib/src/android/car/vms/VmsLayersOffering.java
index 925affc..6abffc6 100644
--- a/car-lib/src/android/car/vms/VmsLayersOffering.java
+++ b/car-lib/src/android/car/vms/VmsLayersOffering.java
@@ -21,7 +21,9 @@
 import android.os.Parcelable;
 import java.util.ArrayList;
 import java.util.Collections;
+import java.util.HashSet;
 import java.util.List;
+import java.util.Set;
 
 /**
  * The state of dependencies for a single publisher.
@@ -31,24 +33,24 @@
 @FutureFeature
 public final class VmsLayersOffering implements Parcelable {
 
-    private final List<VmsLayerDependency> mDependencies;
+    private final Set<VmsLayerDependency> mDependencies;
 
-    private final int mPublisherStaticId;
+    private final int mPublisherId;
 
-    public VmsLayersOffering(List<VmsLayerDependency> dependencies, int publisherStaticId) {
-        mDependencies = Collections.unmodifiableList(dependencies);
-        mPublisherStaticId = publisherStaticId;
+    public VmsLayersOffering(Set<VmsLayerDependency> dependencies, int publisherId) {
+        mDependencies = Collections.unmodifiableSet(dependencies);
+        mPublisherId = publisherId;
     }
 
     /**
      * Returns the dependencies.
      */
-    public List<VmsLayerDependency> getDependencies() {
+    public Set<VmsLayerDependency> getDependencies() {
         return mDependencies;
     }
 
-    public int getPublisherStaticId() {
-        return mPublisherStaticId;
+    public int getPublisherId() {
+        return mPublisherId;
     }
 
     public static final Parcelable.Creator<VmsLayersOffering> CREATOR = new
@@ -68,8 +70,9 @@
 
     @Override
     public void writeToParcel(Parcel out, int flags) {
-        out.writeParcelableList(mDependencies, flags);
-        out.writeInt(mPublisherStaticId);
+
+        out.writeParcelableList(new ArrayList(mDependencies), flags);
+        out.writeInt(mPublisherId);
     }
 
     @Override
@@ -80,7 +83,7 @@
     private VmsLayersOffering(Parcel in) {
         List<VmsLayerDependency> dependencies = new ArrayList<>();
         in.readParcelableList(dependencies, VmsLayerDependency.class.getClassLoader());
-        mDependencies = Collections.unmodifiableList(dependencies);
-        mPublisherStaticId = in.readInt();
+        mDependencies = Collections.unmodifiableSet(new HashSet<>(dependencies));
+        mPublisherId = in.readInt();
     }
 }
\ No newline at end of file
diff --git a/car-lib/src/android/car/vms/VmsOperationRecorder.java b/car-lib/src/android/car/vms/VmsOperationRecorder.java
index 7bac812..c873dce 100644
--- a/car-lib/src/android/car/vms/VmsOperationRecorder.java
+++ b/car-lib/src/android/car/vms/VmsOperationRecorder.java
@@ -58,20 +58,20 @@
         recordOp("unsubscribe", "publisherId", publisherId, layer);
     }
 
-    public void subscribeAll() {
-        recordOp("subscribeAll");
+    public void startMonitoring() {
+        recordOp("startMonitoring");
     }
 
-    public void unsubscribeAll() {
-        recordOp("unsubscribeAll");
+    public void stopMonitoring() {
+        recordOp("stopMonitoring");
     }
 
     public void setLayersOffering(VmsLayersOffering layersOffering) {
         recordOp("setLayersOffering", layersOffering);
     }
 
-    public void getPublisherStaticId(int publisherStaticId) {
-        recordOp("getPublisherStaticId", "publisherStaticId", publisherStaticId);
+    public void getPublisherId(int publisherId) {
+        recordOp("getPublisherId", "publisherId", publisherId);
     }
 
     // VMS Service operations.
@@ -176,9 +176,9 @@
 
     private static JSONObject toJson(VmsLayer layer) throws JSONException {
         return new JSONObject()
-                .put("id", layer.getId())
-                .put("version", layer.getVersion())
-                .put("subtype", layer.getSubType());
+                .put("type", layer.getType())
+                .put("subtype", layer.getSubtype())
+                .put("version", layer.getVersion());
     }
 
     private static JSONObject toJson(VmsLayerDependency layerDependency) throws JSONException {
@@ -210,6 +210,7 @@
         mWriter.write(object.toString());
     }
 
+    /** @hide */
     @VisibleForTesting
     public static class Writer {
         private static final String TAG = "VMS.RECORD.EVENT";
diff --git a/car-lib/src/android/car/vms/VmsPublisherClientService.java b/car-lib/src/android/car/vms/VmsPublisherClientService.java
index 2b88487..33ca1f3 100644
--- a/car-lib/src/android/car/vms/VmsPublisherClientService.java
+++ b/car-lib/src/android/car/vms/VmsPublisherClientService.java
@@ -39,8 +39,8 @@
  * of the target product.
  *
  * The {@link com.android.car.VmsPublisherService} will start this service. The callback
- * {@link #onVmsPublisherServiceReady()} notifies when VMS publisher services (i.e.
- * {@link #publish(int, int, byte[])} and {@link #getSubscribers()}) can be used.
+ * {@link #onVmsPublisherServiceReady()} notifies when VMS publisher services can be used, and the
+ * publisher can request a publisher ID in order to start publishing.
  *
  * SystemApi candidate.
  *
@@ -76,7 +76,7 @@
         return super.onUnbind(intent);
     }
 
-    public void setToken(IBinder token) {
+    private void setToken(IBinder token) {
         synchronized (mLock) {
             mToken = token;
         }
@@ -85,12 +85,12 @@
     /**
      * Notifies that the publisher services are ready.
      */
-    public abstract void onVmsPublisherServiceReady();
+    protected abstract void onVmsPublisherServiceReady();
 
     /**
      * Publishers need to implement this method to receive notifications of subscription changes.
      *
-     * @param subscriptionState  layers with subscribers and a sequence number.
+     * @param subscriptionState the state of the subscriptions.
      */
     public abstract void onVmsSubscriptionChange(VmsSubscriptionState subscriptionState);
 
@@ -103,7 +103,7 @@
      *                    VMS core.
      * @return if the call to the method VmsPublisherService.publish was successful.
      */
-    public final boolean publish(VmsLayer layer, int publisherId, byte[] payload) {
+    public final void publish(VmsLayer layer, int publisherId, byte[] payload) {
         if (DBG) {
             Log.d(TAG, "Publishing for layer : " + layer);
         }
@@ -112,11 +112,9 @@
 
         try {
             mVmsPublisherService.publish(token, layer, publisherId, payload);
-            return true;
         } catch (RemoteException e) {
             Log.e(TAG, "unable to publish message: " + payload, e);
         }
-        return false;
     }
 
     /**
@@ -125,7 +123,7 @@
      * @param offering the layers that the publisher may publish.
      * @return if the call to VmsPublisherService.setLayersOffering was successful.
      */
-    public final boolean setLayersOffering(VmsLayersOffering offering) {
+    public final void setLayersOffering(VmsLayersOffering offering) {
         if (DBG) {
             Log.d(TAG, "Setting layers offering : " + offering);
         }
@@ -135,11 +133,9 @@
         try {
             mVmsPublisherService.setLayersOffering(token, offering);
             VmsOperationRecorder.get().setLayersOffering(offering);
-            return true;
         } catch (RemoteException e) {
             Log.e(TAG, "unable to set layers offering: " + offering, e);
         }
-        return false;
     }
 
     private IBinder getTokenForPublisherServiceThreadSafe() {
@@ -157,28 +153,27 @@
         return token;
     }
 
-    public final int getPublisherStaticId(byte[] publisherInfo) {
+    public final int getPublisherId(byte[] publisherInfo) {
         if (mVmsPublisherService == null) {
             throw new IllegalStateException("VmsPublisherService not set.");
         }
-        Integer publisherStaticId = null;
+        Integer publisherId = null;
         try {
             Log.i(TAG, "Getting publisher static ID");
-            publisherStaticId = mVmsPublisherService.getPublisherStaticId(publisherInfo);
+            publisherId = mVmsPublisherService.getPublisherId(publisherInfo);
         } catch (RemoteException e) {
             Log.e(TAG, "unable to invoke binder method.", e);
         }
-        if (publisherStaticId == null) {
+        if (publisherId == null) {
             throw new IllegalStateException("VmsPublisherService cannot get a publisher static ID.");
         } else {
-            VmsOperationRecorder.get().getPublisherStaticId(publisherStaticId);
+            VmsOperationRecorder.get().getPublisherId(publisherId);
         }
-        return publisherStaticId;
+        return publisherId;
     }
 
     /**
-     * Uses the VmsPublisherService binder to get the list of layer/version that have any
-     * subscribers.
+     * Uses the VmsPublisherService binder to get the state of the subscriptions.
      *
      * @return list of layer/version or null in case of error.
      */
diff --git a/car-lib/src/android/car/vms/VmsSubscriberManager.java b/car-lib/src/android/car/vms/VmsSubscriberManager.java
index 19ba1b1..6f6377c 100644
--- a/car-lib/src/android/car/vms/VmsSubscriberManager.java
+++ b/car-lib/src/android/car/vms/VmsSubscriberManager.java
@@ -64,7 +64,7 @@
         /**
          * Called when layers availability change
          */
-        void onLayersAvailabilityChange(List<VmsLayer> availableLayers);
+        void onLayersAvailabilityChanged(List<VmsLayer> availableLayers);
     }
 
     /**
@@ -131,7 +131,7 @@
             }
 
             @Override
-            public void onLayersAvailabilityChange(List<VmsAssociatedLayer> availableLayers) {
+            public void onLayersAvailabilityChanged(List<VmsAssociatedLayer> availableLayers) {
                 mHandler.sendMessage(
                         mHandler.obtainMessage(
                                 VmsEventHandler.ON_AVAILABILITY_CHANGE_EVENT,
@@ -245,11 +245,11 @@
         }
     }
 
-    public void subscribeAll() throws CarNotConnectedException {
+    public void startMonitoring() throws CarNotConnectedException {
         verifySubscriptionIsAllowed();
         try {
             mVmsSubscriberService.addVmsSubscriberPassive(mSubscriberManagerClient);
-            VmsOperationRecorder.get().subscribeAll();
+            VmsOperationRecorder.get().startMonitoring();
         } catch (RemoteException e) {
             Log.e(TAG, "Could not connect: ", e);
             throw new CarNotConnectedException(e);
@@ -299,10 +299,10 @@
         }
     }
 
-    public void unsubscribeAll() {
+    public void stopMonitoring() {
         try {
             mVmsSubscriberService.removeVmsSubscriberPassive(mSubscriberManagerClient);
-            VmsOperationRecorder.get().unsubscribeAll();
+            VmsOperationRecorder.get().stopMonitoring();
         } catch (RemoteException e) {
             Log.e(TAG, "Failed to unregister subscriber ", e);
             // ignore
@@ -326,7 +326,7 @@
             Log.e(TAG, "Cannot dispatch availability change message.");
             return;
         }
-        clientCallback.onLayersAvailabilityChange(availableLayers);
+        clientCallback.onLayersAvailabilityChanged(availableLayers);
     }
 
     private VmsSubscriberClientCallback getClientCallbackThreadSafe() {
diff --git a/car-lib/src/android/car/vms/VmsSubscriptionState.java b/car-lib/src/android/car/vms/VmsSubscriptionState.java
index 0e7e4fa..ea433f7 100644
--- a/car-lib/src/android/car/vms/VmsSubscriptionState.java
+++ b/car-lib/src/android/car/vms/VmsSubscriptionState.java
@@ -50,15 +50,19 @@
         mSubscribedLayersFromPublishers = Collections.unmodifiableSet(layersFromPublishers);
     }
 
+    /**
+     * Returns the sequence number assigned by the VMS service. Sequence numbers are
+     * monotonically increasing and help clients ignore potential out-of-order states.
+     */
     public int getSequenceNumber() {
         return mSequenceNumber;
     }
 
-    public Set<VmsLayer> getSubscribedLayersFromAll() {
+    public Set<VmsLayer> getLayers() {
         return mLayers;
     }
 
-    public Set<VmsAssociatedLayer> getSubscribedLayersFromPublishers() {
+    public Set<VmsAssociatedLayer> getAssociatedLayers() {
         return mSubscribedLayersFromPublishers;
     }
 
diff --git a/service/src/com/android/car/VmsLayersAvailability.java b/service/src/com/android/car/VmsLayersAvailability.java
index fad6c0a..93b917c 100644
--- a/service/src/com/android/car/VmsLayersAvailability.java
+++ b/service/src/com/android/car/VmsLayersAvailability.java
@@ -77,7 +77,7 @@
                         curPotentialLayerAndPublishers = new HashSet<>();
                         mPotentialLayersAndPublishers.put(layer, curPotentialLayerAndPublishers);
                     }
-                    curPotentialLayerAndPublishers.add(offering.getPublisherStaticId());
+                    curPotentialLayerAndPublishers.add(offering.getPublisherId());
 
                     // Add dependencies for availability calculation.
                     Set<Set<VmsLayer>> curDependencies =
diff --git a/service/src/com/android/car/VmsPublisherService.java b/service/src/com/android/car/VmsPublisherService.java
index f378466..8a293e5 100644
--- a/service/src/com/android/car/VmsPublisherService.java
+++ b/service/src/com/android/car/VmsPublisherService.java
@@ -146,9 +146,9 @@
     }
 
     @Override
-    public int getPublisherStaticId(byte[] publisherInfo) {
+    public int getPublisherId(byte[] publisherInfo) {
         ICarImpl.assertVmsPublisherPermission(mContext);
-        return mHal.getPublisherStaticId(publisherInfo);
+        return mHal.getPublisherId(publisherInfo);
     }
 
     // Implements VmsHalListener interface
diff --git a/service/src/com/android/car/VmsSubscriberService.java b/service/src/com/android/car/VmsSubscriberService.java
index 884891a..94f0844 100644
--- a/service/src/com/android/car/VmsSubscriberService.java
+++ b/service/src/com/android/car/VmsSubscriberService.java
@@ -342,11 +342,11 @@
 
         for (IVmsSubscriberClient subscriber : subscribers) {
             try {
-                subscriber.onLayersAvailabilityChange(availableLayers);
+                subscriber.onLayersAvailabilityChanged(availableLayers);
             } catch (RemoteException e) {
                 // If we could not send a record, its likely the connection snapped. Let the binder
                 // death handle the situation.
-                Log.e(TAG, "onLayersAvailabilityChange calling failed: ", e);
+                Log.e(TAG, "onLayersAvailabilityChanged calling failed: ", e);
             }
         }
     }
diff --git a/service/src/com/android/car/hal/VmsHalService.java b/service/src/com/android/car/hal/VmsHalService.java
index b62ab10..d20a453 100644
--- a/service/src/com/android/car/hal/VmsHalService.java
+++ b/service/src/com/android/car/hal/VmsHalService.java
@@ -256,7 +256,7 @@
      * The publisherInfo should be static for a binary and should only change as part of a software
      * update. The publisherInfo is a serialized proto message which VMS clients can interpret.
      */
-    public int getPublisherStaticId(byte[] publisherInfo) {
+    public int getPublisherId(byte[] publisherInfo) {
         if (DBG) {
             Log.i(TAG, "Getting publisher static ID");
         }
@@ -499,8 +499,8 @@
 
     private VmsLayer parseVmsLayerFromSimpleMessageIntegerValues(List<Integer> integerValues) {
         return new VmsLayer(integerValues.get(VmsMessageWithLayerIntegerValuesIndex.LAYER_TYPE),
-                integerValues.get(VmsMessageWithLayerIntegerValuesIndex.LAYER_VERSION),
-                integerValues.get(VmsMessageWithLayerIntegerValuesIndex.LAYER_SUBTYPE));
+                integerValues.get(VmsMessageWithLayerIntegerValuesIndex.LAYER_SUBTYPE),
+                integerValues.get(VmsMessageWithLayerIntegerValuesIndex.LAYER_VERSION));
     }
 
     private VmsLayer parseVmsLayerFromDataMessageIntegerValues(List<Integer> integerValues) {
@@ -569,7 +569,6 @@
             Log.d(TAG, "Handling a subscribe event for Layer: " + vmsLayer);
         }
         int publisherId =
-                //integerValues.get(/*VmsSimpleMessageIntegerValuesIndex.VMS_LAYER_SUB_TYPE*/0);
                 integerValues.get(VmsMessageWithLayerAndPublisherIdIntegerValuesIndex.PUBLISHER_ID);
         addHalSubscriptionToPublisher(vmsLayer, publisherId);
     }
@@ -601,7 +600,6 @@
     private void handleUnsubscribeFromPublisherEvent(List<Integer> integerValues) {
         VmsLayer vmsLayer = parseVmsLayerFromSimpleMessageIntegerValues(integerValues);
         int publisherId =
-                //integerValues.get(/*VmsSimpleMessageIntegerValuesIndex.VMS_LAYER_SUB_TYPE*/0);
                 integerValues.get(VmsMessageWithLayerAndPublisherIdIntegerValuesIndex.PUBLISHER_ID);
         if (DBG) {
             Log.d(TAG, "Handling an unsubscribe event for Layer: " + vmsLayer);
@@ -612,9 +610,10 @@
     private static int NUM_INTEGERS_IN_VMS_LAYER = 3;
 
     private VmsLayer parseVmsLayerFromIndex(List<Integer> integerValues, int index) {
-        return new VmsLayer(integerValues.get(index++),
-                integerValues.get(index++),
-                integerValues.get(index++));
+        int layerType = integerValues.get(index++);
+        int layerSutype = integerValues.get(index++);
+        int layerVersion = integerValues.get(index++);
+        return new VmsLayer(layerType, layerSutype, layerVersion);
     }
 
     /**
@@ -639,7 +638,7 @@
                         VmsOfferingMessageIntegerValuesIndex.NUMBER_OF_OFFERS);
         int idx = VmsOfferingMessageIntegerValuesIndex.OFFERING_START;
 
-        List<VmsLayerDependency> offeredLayers = new ArrayList<>();
+        Set<VmsLayerDependency> offeredLayers = new HashSet<>();
 
         // An offering is layerId, LayerVersion, LayerType, NumDeps, <LayerId, LayerVersion> X NumDeps.
         for (int i = 0; i < numLayersDependencies; i++) {
@@ -708,7 +707,7 @@
                 toTypedVmsVehiclePropValue(VmsMessageType.SUBSCRIPTIONS_RESPONSE);
         VehiclePropValue.RawValue v = vehicleProp.value;
         v.int32Values.add(subscription.getSequenceNumber());
-        Set<VmsLayer> layers = subscription.getSubscribedLayersFromAll();
+        Set<VmsLayer> layers = subscription.getLayers();
         v.int32Values.add(layers.size());
 
         //TODO(asafro): get the real number of associated layers in the subscriptions
@@ -716,8 +715,8 @@
         v.int32Values.add(0);
 
         for (VmsLayer layer : layers) {
-            v.int32Values.add(layer.getId());
-            v.int32Values.add(layer.getSubType());
+            v.int32Values.add(layer.getType());
+            v.int32Values.add(layer.getSubtype());
             v.int32Values.add(layer.getVersion());
         }
         setPropertyValue(vehicleProp);
@@ -813,8 +812,8 @@
             int messageType, VmsLayer layer) {
         VehiclePropValue vehicleProp = toTypedVmsVehiclePropValue(messageType);
         VehiclePropValue.RawValue v = vehicleProp.value;
-        v.int32Values.add(layer.getId());
-        v.int32Values.add(layer.getSubType());
+        v.int32Values.add(layer.getType());
+        v.int32Values.add(layer.getSubtype());
         v.int32Values.add(layer.getVersion());
         return vehicleProp;
     }
@@ -839,8 +838,8 @@
         int numLayers = availableAssociatedLayers.size();
         v.int32Values.add(numLayers);
         for (VmsAssociatedLayer layer : availableAssociatedLayers) {
-            v.int32Values.add(layer.getVmsLayer().getId());
-            v.int32Values.add(layer.getVmsLayer().getSubType());
+            v.int32Values.add(layer.getVmsLayer().getType());
+            v.int32Values.add(layer.getVmsLayer().getSubtype());
             v.int32Values.add(layer.getVmsLayer().getVersion());
             v.int32Values.add(layer.getPublisherIds().size());
             for (int publisherId : layer.getPublisherIds()) {
diff --git a/tests/VmsPublisherClientSample/src/com/google/android/car/vms/publisher/VmsPublisherClientSampleService.java b/tests/VmsPublisherClientSample/src/com/google/android/car/vms/publisher/VmsPublisherClientSampleService.java
index ab6bcc9..e235f1e 100644
--- a/tests/VmsPublisherClientSample/src/com/google/android/car/vms/publisher/VmsPublisherClientSampleService.java
+++ b/tests/VmsPublisherClientSample/src/com/google/android/car/vms/publisher/VmsPublisherClientSampleService.java
@@ -58,7 +58,7 @@
     @Override
     public void onVmsSubscriptionChange(VmsSubscriptionState subscriptionState) {
         if (mInitialized.compareAndSet(false, true)) {
-            for (VmsLayer layer : subscriptionState.getSubscribedLayersFromAll()) {
+            for (VmsLayer layer : subscriptionState.getLayers()) {
                 if (layer.equals(TEST_LAYER)) {
                     mHandler.sendEmptyMessage(PUBLISH_EVENT);
                 }
diff --git a/tests/VmsSubscriberClientSample/src/com/google/android/car/vms/subscriber/VmsSubscriberClientSampleActivity.java b/tests/VmsSubscriberClientSample/src/com/google/android/car/vms/subscriber/VmsSubscriberClientSampleActivity.java
index 1a70b57..3ac0707 100644
--- a/tests/VmsSubscriberClientSample/src/com/google/android/car/vms/subscriber/VmsSubscriberClientSampleActivity.java
+++ b/tests/VmsSubscriberClientSample/src/com/google/android/car/vms/subscriber/VmsSubscriberClientSampleActivity.java
@@ -106,7 +106,7 @@
                 }
 
                 @Override
-                public void onLayersAvailabilityChange(List<VmsLayer> availableLayers) {
+                public void onLayersAvailabilityChanged(List<VmsLayer> availableLayers) {
                     mTextView.setText(String.valueOf(availableLayers));
                 }
             };
diff --git a/tests/carservice_test/src/com/android/car/test/VmsHalServiceSubscriptionEventTest.java b/tests/carservice_test/src/com/android/car/test/VmsHalServiceSubscriptionEventTest.java
index 00c78bf..cad3086 100644
--- a/tests/carservice_test/src/com/android/car/test/VmsHalServiceSubscriptionEventTest.java
+++ b/tests/carservice_test/src/com/android/car/test/VmsHalServiceSubscriptionEventTest.java
@@ -82,18 +82,18 @@
 
     public void testOneSubscription() throws Exception {
         if (!VmsTestUtils.canRunTest(TAG)) return;
-        List<VmsLayer> layers = Arrays.asList(new VmsLayer(8, 3, 0));
+        List<VmsLayer> layers = Arrays.asList(new VmsLayer(8, 0, 3));
         subscriptionTestLogic(layers);
     }
 
     public void testManySubscriptions() throws Exception {
         if (!VmsTestUtils.canRunTest(TAG)) return;
         List<VmsLayer> layers = Arrays.asList(
-                new VmsLayer(8, 3, 1),
-                new VmsLayer(5, 1, 2),
-                new VmsLayer(3, 9, 3),
-                new VmsLayer(2, 7, 4),
-                new VmsLayer(9, 3, 5));
+                new VmsLayer(8, 1, 3),
+                new VmsLayer(5, 2, 1),
+                new VmsLayer(3, 3, 9),
+                new VmsLayer(2, 4, 7),
+                new VmsLayer(9, 5, 3));
         subscriptionTestLogic(layers);
     }
 
@@ -122,10 +122,10 @@
         int start = VmsSubscriptionsStateIntegerValuesIndex.SUBSCRIPTIONS_START;
         int end = VmsSubscriptionsStateIntegerValuesIndex.SUBSCRIPTIONS_START + 3 * numberLayers;
         while (start < end) {
-            int id = v.get(start++);
-            int subType = v.get(start++);
+            int type = v.get(start++);
+            int subtype = v.get(start++);
             int version = v.get(start++);
-            receivedLayers.add(new VmsLayer(id, version, subType));
+            receivedLayers.add(new VmsLayer(type, subtype, version));
         }
         assertEquals(new HashSet<>(layers), new HashSet<>(receivedLayers));
     }
@@ -146,15 +146,15 @@
         int layerVersion = v.get(VmsMessageWithLayerIntegerValuesIndex.LAYER_VERSION);
         int fused = v.get(VmsMessageWithLayerIntegerValuesIndex.LAYER_SUBTYPE);
         assertEquals(VmsMessageType.SUBSCRIBE, messsageType);
-        assertEquals(layer.getId(), layerId);
+        assertEquals(layer.getType(), layerId);
         assertEquals(layer.getVersion(), layerVersion);
     }
 
     private VehiclePropValue createHalSubscribeRequest(VmsLayer layer) {
         return VehiclePropValueBuilder.newBuilder(VehicleProperty.VEHICLE_MAP_SERVICE)
                 .addIntValue(VmsMessageType.SUBSCRIBE)
-                .addIntValue(layer.getId())
-                .addIntValue(layer.getSubType())
+                .addIntValue(layer.getType())
+                .addIntValue(layer.getSubtype())
                 .addIntValue(layer.getVersion())
                 .build();
     }
diff --git a/tests/carservice_test/src/com/android/car/test/VmsOperationRecorderTest.java b/tests/carservice_test/src/com/android/car/test/VmsOperationRecorderTest.java
index dc42787..a00ec68 100644
--- a/tests/carservice_test/src/com/android/car/test/VmsOperationRecorderTest.java
+++ b/tests/carservice_test/src/com/android/car/test/VmsOperationRecorderTest.java
@@ -54,20 +54,20 @@
     private TestWriter mWriter;
     private VmsOperationRecorder mRecorder;
 
-    private static final VmsLayer layer1 = new VmsLayer(1, 2, 3);
-    private static final VmsLayer layer2 = new VmsLayer(2, 3, 4);
-    private static final VmsLayer layer3 = new VmsLayer(3, 4, 5);
+    private static final VmsLayer layer1 = new VmsLayer(1, 3, 2);
+    private static final VmsLayer layer2 = new VmsLayer(2, 4, 3);
+    private static final VmsLayer layer3 = new VmsLayer(3, 5, 4);
 
     private static final VmsLayerDependency layerDependency1 = new VmsLayerDependency(layer3);
     private static final VmsLayerDependency layerDependency2 = new VmsLayerDependency(layer1,
             new HashSet<VmsLayer>(Arrays.asList(layer2, layer3)));
 
     private static final VmsLayersOffering layersOffering0 = new VmsLayersOffering(
-            new ArrayList<VmsLayerDependency>(), 66);
+            new HashSet<VmsLayerDependency>(), 66);
     private static final VmsLayersOffering layersOffering1 = new VmsLayersOffering(
-            Arrays.asList(layerDependency1), 66);
+            new HashSet<>(Arrays.asList(layerDependency1)), 66);
     private static final VmsLayersOffering layersOffering2 = new VmsLayersOffering(
-            Arrays.asList(layerDependency1, layerDependency2), 66);
+            new HashSet<>(Arrays.asList(layerDependency1, layerDependency2)), 66);
 
     public void setUp() {
         mWriter = new TestWriter();
@@ -76,22 +76,22 @@
 
     public void testSubscribe() throws Exception {
         mRecorder.subscribe(layer1);
-        assertJsonMsgEquals("{'subscribe':{'layer':{'id':1,'version':2,'subtype':3}}}");
+        assertJsonMsgEquals("{'subscribe':{'layer':{'type':1,'subtype':3,'version':2}}}");
     }
 
     public void testUnsubscribe() throws Exception {
         mRecorder.unsubscribe(layer1);
-        assertJsonMsgEquals("{'unsubscribe':{'layer':{'id':1,'version':2,'subtype':3}}}");
+        assertJsonMsgEquals("{'unsubscribe':{'layer':{'type':1,'subtype':3,'version':2}}}");
     }
 
-    public void testSubscribeAll() throws Exception {
-        mRecorder.subscribeAll();
-        assertJsonMsgEquals("{'subscribeAll':{}}");
+    public void testStartMonitoring() throws Exception {
+        mRecorder.startMonitoring();
+        assertJsonMsgEquals("{'startMonitoring':{}}");
     }
 
-    public void testUnsubscribeAll() throws Exception {
-        mRecorder.unsubscribeAll();
-        assertJsonMsgEquals("{'unsubscribeAll':{}}");
+    public void testStopMonitoring() throws Exception {
+        mRecorder.stopMonitoring();
+        assertJsonMsgEquals("{'stopMonitoring':{}}");
     }
 
     public void testSetLayersOffering0() throws Exception {
@@ -102,27 +102,28 @@
     public void testSetLayersOffering2() throws Exception {
         mRecorder.setLayersOffering(layersOffering2);
         assertJsonMsgEquals("{'setLayersOffering':{'layerDependency':["
-                + "{'layer':{'id':3,'version':4,'subtype':5}},"
-                + "{'layer':{'id':1,'version':2,'subtype':3},'dependency':["
-                + "{'id':2,'version':3,'subtype':4},{'id':3,'version':4,'subtype':5}]}]}}");
+                + "{'layer':{'type':3,'subtype':5,'version':4}},"
+                + "{'layer':{'type':1,'subtype':3,'version':2},'dependency':["
+                + "{'type':2,'subtype':4,'version':3},{'type':3,'subtype':5,'version':4}]}"
+                + "]}}");
     }
 
-    public void testGetPublisherStaticId() throws Exception {
-        mRecorder.getPublisherStaticId(9);
-        assertJsonMsgEquals("{'getPublisherStaticId':{'publisherStaticId':9}}");
+    public void testGetPublisherId() throws Exception {
+        mRecorder.getPublisherId(9);
+        assertJsonMsgEquals("{'getPublisherId':{'publisherId':9}}");
     }
 
     public void testAddSubscription() throws Exception {
         mRecorder.addSubscription(42, layer1);
         assertJsonMsgEquals(
-                "{'addSubscription':{'sequenceNumber':42,'layer':{'id':1,'version':2,'subtype':3}}}"
+                "{'addSubscription':{'sequenceNumber':42,'layer':{'type':1,'subtype':3,'version':2}}}"
         );
     }
 
     public void testRemoveSubscription() throws Exception {
         mRecorder.removeSubscription(42, layer1);
         assertJsonMsgEquals("{'removeSubscription':"
-                + "{'sequenceNumber':42,'layer':{'id':1,'version':2,'subtype':3}}}");
+                + "{'sequenceNumber':42,'layer':{'type':1,'subtype':3,'version':2}}}");
     }
 
     public void testAddPromiscuousSubscription() throws Exception {
@@ -138,37 +139,37 @@
     public void testAddHalSubscription() throws Exception {
         mRecorder.addHalSubscription(42, layer1);
         assertJsonMsgEquals("{'addHalSubscription':"
-                + "{'sequenceNumber':42,'layer':{'id':1,'version':2,'subtype':3}}}");
+                + "{'sequenceNumber':42,'layer':{'type':1,'subtype':3,'version':2}}}");
     }
 
     public void testRemoveHalSubscription() throws Exception {
         mRecorder.removeHalSubscription(42, layer1);
         assertJsonMsgEquals("{'removeHalSubscription':"
-                + "{'sequenceNumber':42,'layer':{'id':1,'version':2,'subtype':3}}}");
+                + "{'sequenceNumber':42,'layer':{'type':1,'subtype':3,'version':2}}}");
     }
 
     public void testSetPublisherLayersOffering() throws Exception {
         mRecorder.setPublisherLayersOffering(layersOffering1);
         assertJsonMsgEquals("{'setPublisherLayersOffering':{'layerDependency':["
-                + "{'layer':{'id':3,'version':4,'subtype':5}}]}}");
+                + "{'layer':{'type':3,'subtype':5,'version':4}}]}}");
     }
 
     public void testSetHalPublisherLayersOffering() throws Exception {
         mRecorder.setHalPublisherLayersOffering(layersOffering1);
         assertJsonMsgEquals("{'setHalPublisherLayersOffering':{'layerDependency':["
-                + "{'layer':{'id':3,'version':4,'subtype':5}}]}}");
+                + "{'layer':{'type':3,'subtype':5,'version':4}}]}}");
     }
 
     public void testSubscribeToPublisher() throws Exception {
         mRecorder.subscribe(layer1, 99);
         assertJsonMsgEquals(
-                "{'subscribe':{'publisherId':99, 'layer':{'id':1,'version':2,'subtype':3}}}");
+                "{'subscribe':{'publisherId':99, 'layer':{'type':1,'subtype':3,'version':2}}}");
     }
 
     public void testUnsubscribeToPublisher() throws Exception {
         mRecorder.unsubscribe(layer1, 99);
         assertJsonMsgEquals(
-                "{'unsubscribe':{'publisherId':99, 'layer':{'id':1,'version':2,'subtype':3}}}}");
+                "{'unsubscribe':{'publisherId':99, 'layer':{'type':1,'subtype':3,'version':2}}}}");
     }
 
     private void assertJsonMsgEquals(String expectJson) throws Exception {
diff --git a/tests/carservice_test/src/com/android/car/test/VmsPublisherClientMockService.java b/tests/carservice_test/src/com/android/car/test/VmsPublisherClientMockService.java
index b1b9132..0d5c427 100644
--- a/tests/carservice_test/src/com/android/car/test/VmsPublisherClientMockService.java
+++ b/tests/carservice_test/src/com/android/car/test/VmsPublisherClientMockService.java
@@ -23,8 +23,10 @@
 import android.car.vms.VmsPublisherClientService;
 import android.car.vms.VmsSubscriptionState;
 import android.util.Log;
-import java.util.List;
 import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
 
 /**
  * This service is launched during the tests in VmsPublisherSubscriberTest. It publishes a property
@@ -60,13 +62,13 @@
 
     private void initializeMockPublisher(VmsSubscriptionState subscriptionState) {
         Log.d(TAG, "Initializing Mock publisher");
-        int publisherId = getPublisherStaticId(VmsPublisherSubscriberTest.PAYLOAD);
+        int publisherId = getPublisherId(VmsPublisherSubscriberTest.PAYLOAD);
         publishIfNeeded(subscriptionState);
         declareOffering(subscriptionState, publisherId);
     }
 
     private void publishIfNeeded(VmsSubscriptionState subscriptionState) {
-        for (VmsLayer layer : subscriptionState.getSubscribedLayersFromAll()) {
+        for (VmsLayer layer : subscriptionState.getLayers()) {
             if (layer.equals(VmsPublisherSubscriberTest.LAYER)) {
                 publish(VmsPublisherSubscriberTest.LAYER,
                         VmsPublisherSubscriberTest.EXPECTED_PUBLISHER_ID,
@@ -76,10 +78,10 @@
     }
 
     private void declareOffering(VmsSubscriptionState subscriptionState, int publisherId) {
-        List<VmsLayerDependency> dependencies = new ArrayList<>();
+        Set<VmsLayerDependency> dependencies = new HashSet<>();
 
         // Add all layers from the subscription state.
-        for( VmsLayer layer : subscriptionState.getSubscribedLayersFromAll()) {
+        for( VmsLayer layer : subscriptionState.getLayers()) {
             dependencies.add(new VmsLayerDependency(layer));
         }
 
diff --git a/tests/carservice_test/src/com/android/car/test/VmsPublisherClientServiceTest.java b/tests/carservice_test/src/com/android/car/test/VmsPublisherClientServiceTest.java
index 8c477ce..053bab7 100644
--- a/tests/carservice_test/src/com/android/car/test/VmsPublisherClientServiceTest.java
+++ b/tests/carservice_test/src/com/android/car/test/VmsPublisherClientServiceTest.java
@@ -50,12 +50,12 @@
     private static final String TAG = "VmsPublisherTest";
     private static final int MOCK_PUBLISHER_LAYER_ID = 12;
     private static final int MOCK_PUBLISHER_LAYER_VERSION = 34;
-    private static final int MOCK_PUBLISHER_LAYER_SUB_TYPE = 56;
+    private static final int MOCK_PUBLISHER_LAYER_SUBTYPE = 56;
     public static final int MOCK_PUBLISHER_ID = 1234;
     public static final VmsLayer MOCK_PUBLISHER_LAYER =
             new VmsLayer(MOCK_PUBLISHER_LAYER_ID,
-                    MOCK_PUBLISHER_LAYER_VERSION,
-                    MOCK_PUBLISHER_LAYER_SUB_TYPE);
+                    MOCK_PUBLISHER_LAYER_SUBTYPE,
+                    MOCK_PUBLISHER_LAYER_VERSION);
     public static final byte[] PAYLOAD = new byte[]{1, 1, 2, 3, 5, 8, 13};
 
     private HalHandler mHalHandler;
@@ -103,7 +103,7 @@
         return VehiclePropValueBuilder.newBuilder(VehicleProperty.VEHICLE_MAP_SERVICE)
                 .addIntValue(VmsMessageType.SUBSCRIBE)
                 .addIntValue(MOCK_PUBLISHER_LAYER_ID)
-                .addIntValue(MOCK_PUBLISHER_LAYER_SUB_TYPE)
+                .addIntValue(MOCK_PUBLISHER_LAYER_SUBTYPE)
                 .addIntValue(MOCK_PUBLISHER_LAYER_VERSION)
                 .build();
     }
diff --git a/tests/carservice_test/src/com/android/car/test/VmsPublisherSubscriberTest.java b/tests/carservice_test/src/com/android/car/test/VmsPublisherSubscriberTest.java
index a4818f0..5b387d2 100644
--- a/tests/carservice_test/src/com/android/car/test/VmsPublisherSubscriberTest.java
+++ b/tests/carservice_test/src/com/android/car/test/VmsPublisherSubscriberTest.java
@@ -46,12 +46,12 @@
 public class VmsPublisherSubscriberTest extends MockedCarTestBase {
     private static final int LAYER_ID = 88;
     private static final int LAYER_VERSION = 19;
-    private static final int LAYER_SUB_TYPE = 55;
+    private static final int LAYER_SUBTYPE = 55;
     private static final String TAG = "VmsPubSubTest";
 
     // The expected publisher ID is 0 since it the expected assigned ID from the VMS core.
     public static final int EXPECTED_PUBLISHER_ID = 0;
-    public static final VmsLayer LAYER = new VmsLayer(LAYER_ID, LAYER_VERSION, LAYER_SUB_TYPE);
+    public static final VmsLayer LAYER = new VmsLayer(LAYER_ID, LAYER_SUBTYPE, LAYER_VERSION);
     public static final VmsAssociatedLayer ASSOCIATED_LAYER =
             new VmsAssociatedLayer(LAYER, new HashSet<>(Arrays.asList(EXPECTED_PUBLISHER_ID)));
     public static final byte[] PAYLOAD = new byte[]{2, 3, 5, 7, 11, 13, 17};
@@ -62,7 +62,7 @@
 
     private static final int SUBSCRIBED_LAYER_ID = 89;
     public static final VmsLayer SUBSCRIBED_LAYER =
-            new VmsLayer(SUBSCRIBED_LAYER_ID, LAYER_VERSION, LAYER_SUB_TYPE);
+            new VmsLayer(SUBSCRIBED_LAYER_ID, LAYER_SUBTYPE, LAYER_VERSION);
     public static final VmsAssociatedLayer ASSOCIATED_SUBSCRIBED_LAYER =
             new VmsAssociatedLayer(SUBSCRIBED_LAYER, new HashSet<>(Arrays.asList(EXPECTED_PUBLISHER_ID)));
     private static final List<VmsAssociatedLayer> AVAILABLE_ASSOCIATED_LAYERS_WITH_SUBSCRIBED_LAYER =
@@ -218,7 +218,7 @@
         }
 
         @Override
-        public void onLayersAvailabilityChange(List<VmsLayer> availableLayers) {
+        public void onLayersAvailabilityChanged(List<VmsLayer> availableLayers) {
             mAvailableLayers = availableLayers;
             mAvailabilitySemaphore.release();
         }
diff --git a/tests/carservice_test/src/com/android/car/test/VmsSubscriberManagerTest.java b/tests/carservice_test/src/com/android/car/test/VmsSubscriberManagerTest.java
index 9b38859..8e0c91b 100644
--- a/tests/carservice_test/src/com/android/car/test/VmsSubscriberManagerTest.java
+++ b/tests/carservice_test/src/com/android/car/test/VmsSubscriberManagerTest.java
@@ -54,10 +54,10 @@
 
     private static final int SUBSCRIPTION_LAYER_ID = 2;
     private static final int SUBSCRIPTION_LAYER_VERSION = 3;
-    private static final int MOCK_PUBLISHER_LAYER_SUB_TYPE = 444;
+    private static final int MOCK_PUBLISHER_LAYER_SUBTYPE = 444;
     private static final VmsLayer SUBSCRIPTION_LAYER = new VmsLayer(SUBSCRIPTION_LAYER_ID,
-            SUBSCRIPTION_LAYER_VERSION,
-            MOCK_PUBLISHER_LAYER_SUB_TYPE);
+            MOCK_PUBLISHER_LAYER_SUBTYPE,
+            SUBSCRIPTION_LAYER_VERSION);
     private static final VmsAssociatedLayer SUBSCRIPTION_ASSOCIATED_LAYER =
             new VmsAssociatedLayer(SUBSCRIPTION_LAYER, PUBLISHERS_LIST);
 
@@ -65,8 +65,8 @@
     private static final int SUBSCRIPTION_DEPENDANT_LAYER_VERSION_1 = 5;
     private static final VmsLayer SUBSCRIPTION_DEPENDANT_LAYER_1 =
             new VmsLayer(SUBSCRIPTION_DEPENDANT_LAYER_ID_1,
-                    SUBSCRIPTION_DEPENDANT_LAYER_VERSION_1,
-                    MOCK_PUBLISHER_LAYER_SUB_TYPE);
+                    MOCK_PUBLISHER_LAYER_SUBTYPE,
+                    SUBSCRIPTION_DEPENDANT_LAYER_VERSION_1);
 
     private static final VmsAssociatedLayer SUBSCRIPTION_DEPENDANT_ASSOCIATED_LAYER_1 =
             new VmsAssociatedLayer(SUBSCRIPTION_DEPENDANT_LAYER_1, PUBLISHERS_LIST);
@@ -75,8 +75,8 @@
     private static final int SUBSCRIPTION_DEPENDANT_LAYER_VERSION_2 = 7;
     private static final VmsLayer SUBSCRIPTION_DEPENDANT_LAYER_2 =
             new VmsLayer(SUBSCRIPTION_DEPENDANT_LAYER_ID_2,
-                    SUBSCRIPTION_DEPENDANT_LAYER_VERSION_2,
-                    MOCK_PUBLISHER_LAYER_SUB_TYPE);
+                    MOCK_PUBLISHER_LAYER_SUBTYPE,
+                    SUBSCRIPTION_DEPENDANT_LAYER_VERSION_2);
 
     private static final VmsAssociatedLayer SUBSCRIPTION_DEPENDANT_ASSOCIATED_LAYER_2 =
             new VmsAssociatedLayer(SUBSCRIPTION_DEPENDANT_LAYER_2, PUBLISHERS_LIST);
@@ -130,7 +130,7 @@
                 .build();
         v.value.int32Values.add(VmsMessageType.DATA); // MessageType
         v.value.int32Values.add(SUBSCRIPTION_LAYER_ID);
-        v.value.int32Values.add(MOCK_PUBLISHER_LAYER_SUB_TYPE);
+        v.value.int32Values.add(MOCK_PUBLISHER_LAYER_SUBTYPE);
         v.value.int32Values.add(SUBSCRIPTION_LAYER_VERSION);
         v.value.int32Values.add(PUBLISHER_ID);
         v.value.bytes.add((byte) 0xa);
@@ -161,7 +161,7 @@
                 .build();
         v.value.int32Values.add(VmsMessageType.DATA); // MessageType
         v.value.int32Values.add(SUBSCRIPTION_LAYER_ID);
-        v.value.int32Values.add(MOCK_PUBLISHER_LAYER_SUB_TYPE);
+        v.value.int32Values.add(MOCK_PUBLISHER_LAYER_SUBTYPE);
         v.value.int32Values.add(SUBSCRIPTION_LAYER_VERSION);
         v.value.int32Values.add(WRONG_PUBLISHER_ID);
         v.value.bytes.add((byte) 0xa);
@@ -189,7 +189,7 @@
                 .build();
         v.value.int32Values.add(VmsMessageType.DATA); // MessageType
         v.value.int32Values.add(SUBSCRIPTION_LAYER_ID);
-        v.value.int32Values.add(MOCK_PUBLISHER_LAYER_SUB_TYPE); //<-
+        v.value.int32Values.add(MOCK_PUBLISHER_LAYER_SUBTYPE); //<-
         v.value.int32Values.add(SUBSCRIPTION_LAYER_VERSION);
         v.value.int32Values.add(PUBLISHER_ID);
         v.value.bytes.add((byte) 0xa);
@@ -220,7 +220,7 @@
                 .build();
         v.value.int32Values.add(VmsMessageType.DATA); // MessageType
         v.value.int32Values.add(SUBSCRIPTION_LAYER_ID);
-        v.value.int32Values.add(MOCK_PUBLISHER_LAYER_SUB_TYPE);
+        v.value.int32Values.add(MOCK_PUBLISHER_LAYER_SUBTYPE);
         v.value.int32Values.add(SUBSCRIPTION_LAYER_VERSION);
         v.value.int32Values.add(PUBLISHER_ID);
         v.value.bytes.add((byte) 0xa);
@@ -247,7 +247,7 @@
                 .build();
         v.value.int32Values.add(VmsMessageType.DATA); // MessageType
         v.value.int32Values.add(SUBSCRIPTION_LAYER_ID);
-        v.value.int32Values.add(MOCK_PUBLISHER_LAYER_SUB_TYPE);
+        v.value.int32Values.add(MOCK_PUBLISHER_LAYER_SUBTYPE);
         v.value.int32Values.add(SUBSCRIPTION_LAYER_VERSION);
         v.value.int32Values.add(WRONG_PUBLISHER_ID);
         v.value.bytes.add((byte) 0xa);
@@ -275,7 +275,7 @@
                 .build();
         v.value.int32Values.add(VmsMessageType.DATA); // MessageType
         v.value.int32Values.add(SUBSCRIPTION_LAYER_ID);
-        v.value.int32Values.add(MOCK_PUBLISHER_LAYER_SUB_TYPE);
+        v.value.int32Values.add(MOCK_PUBLISHER_LAYER_SUBTYPE);
         v.value.int32Values.add(SUBSCRIPTION_LAYER_VERSION);
         v.value.int32Values.add(PUBLISHER_ID);
         v.value.bytes.add((byte) 0xa);
@@ -287,7 +287,6 @@
     }
 
 
-
     // Test injecting a value in the HAL and verifying it propagates to a subscriber.
     public void testSubscribeAll() throws Exception {
         assumeTrue(VmsTestUtils.canRunTest(TAG));
@@ -295,7 +294,7 @@
                 Car.VMS_SUBSCRIBER_SERVICE);
         TestClientCallback clientCallback = new TestClientCallback();
         vmsSubscriberManager.registerClientCallback(clientCallback);
-        vmsSubscriberManager.subscribeAll();
+        vmsSubscriberManager.startMonitoring();
 
         // Inject a value and wait for its callback in TestClientCallback.onVmsMessageReceived.
         VehiclePropValue v = VehiclePropValueBuilder.newBuilder(VehicleProperty.VEHICLE_MAP_SERVICE)
@@ -304,7 +303,7 @@
                 .build();
         v.value.int32Values.add(VmsMessageType.DATA); // MessageType
         v.value.int32Values.add(SUBSCRIPTION_LAYER_ID);
-        v.value.int32Values.add(MOCK_PUBLISHER_LAYER_SUB_TYPE);
+        v.value.int32Values.add(MOCK_PUBLISHER_LAYER_SUBTYPE);
         v.value.int32Values.add(SUBSCRIPTION_LAYER_VERSION);
         v.value.int32Values.add(PUBLISHER_ID);
         v.value.bytes.add((byte) 0xa);
@@ -326,7 +325,7 @@
         TestClientCallback clientCallback = new TestClientCallback();
         vmsSubscriberManager.registerClientCallback(clientCallback);
 
-        // Inject a value and wait for its callback in TestClientCallback.onLayersAvailabilityChange.
+        // Inject a value and wait for its callback in TestClientCallback.onLayersAvailabilityChanged.
         VehiclePropValue v = VehiclePropValueBuilder.newBuilder(VehicleProperty.VEHICLE_MAP_SERVICE)
                 .setAreaId(VehicleAreaType.VEHICLE_AREA_TYPE_NONE)
                 .setTimestamp(SystemClock.elapsedRealtimeNanos())
@@ -347,8 +346,8 @@
                         1, // Number of offered layers
 
                         SUBSCRIPTION_LAYER_ID,
+                        MOCK_PUBLISHER_LAYER_SUBTYPE,
                         SUBSCRIPTION_LAYER_VERSION,
-                        MOCK_PUBLISHER_LAYER_SUB_TYPE,
                         0 // number of dependencies for layer
                 )
         );
@@ -373,7 +372,7 @@
         vmsSubscriberManager.registerClientCallback(clientCallback);
         vmsSubscriberManager.subscribe(SUBSCRIPTION_LAYER);
 
-        // Inject a value and wait for its callback in TestClientCallback.onLayersAvailabilityChange.
+        // Inject a value and wait for its callback in TestClientCallback.onLayersAvailabilityChanged.
         VehiclePropValue v = VehiclePropValueBuilder.newBuilder(VehicleProperty.VEHICLE_MAP_SERVICE)
                 .setAreaId(VehicleAreaType.VEHICLE_AREA_TYPE_NONE)
                 .setTimestamp(SystemClock.elapsedRealtimeNanos())
@@ -394,8 +393,8 @@
                         1, // Number of offered layers
 
                         SUBSCRIPTION_LAYER_ID,
+                        MOCK_PUBLISHER_LAYER_SUBTYPE,
                         SUBSCRIPTION_LAYER_VERSION,
-                        MOCK_PUBLISHER_LAYER_SUB_TYPE,
                         0 // number of dependencies for layer
                 )
         );
@@ -421,7 +420,7 @@
         vmsSubscriberManager.unregisterClientCallback();
 
 
-        // Inject a value and wait for its callback in TestClientCallback.onLayersAvailabilityChange.
+        // Inject a value and wait for its callback in TestClientCallback.onLayersAvailabilityChanged.
         VehiclePropValue v = VehiclePropValueBuilder.newBuilder(VehicleProperty.VEHICLE_MAP_SERVICE)
                 .setAreaId(VehicleAreaType.VEHICLE_AREA_TYPE_NONE)
                 .setTimestamp(SystemClock.elapsedRealtimeNanos())
@@ -443,7 +442,7 @@
 
                         SUBSCRIPTION_LAYER_ID,
                         SUBSCRIPTION_LAYER_VERSION,
-                        MOCK_PUBLISHER_LAYER_SUB_TYPE,
+                        MOCK_PUBLISHER_LAYER_SUBTYPE,
                         0 // number of dependencies for layer
                 )
         );
@@ -464,7 +463,7 @@
         vmsSubscriberManager.subscribe(SUBSCRIPTION_LAYER);
         try {
             vmsSubscriberManager.unregisterClientCallback();
-        }catch (IllegalArgumentException e) {
+        } catch (IllegalArgumentException e) {
             return;
         }
         fail();
@@ -479,7 +478,7 @@
         TestClientCallback clientCallback = new TestClientCallback();
         vmsSubscriberManager.registerClientCallback(clientCallback);
 
-        // Inject a value and wait for its callback in TestClientCallback.onLayersAvailabilityChange.
+        // Inject a value and wait for its callback in TestClientCallback.onLayersAvailabilityChanged.
         VehiclePropValue v = VehiclePropValueBuilder.newBuilder(VehicleProperty.VEHICLE_MAP_SERVICE)
                 .setAreaId(VehicleAreaType.VEHICLE_AREA_TYPE_NONE)
                 .setTimestamp(SystemClock.elapsedRealtimeNanos())
@@ -504,36 +503,36 @@
                         4, // Number of offered layers
 
                         SUBSCRIPTION_LAYER_ID,
+                        MOCK_PUBLISHER_LAYER_SUBTYPE,
                         SUBSCRIPTION_LAYER_VERSION,
-                        MOCK_PUBLISHER_LAYER_SUB_TYPE,
                         0, // number of dependencies for layer
 
                         SUBSCRIPTION_DEPENDANT_LAYER_ID_1,
+                        MOCK_PUBLISHER_LAYER_SUBTYPE,
                         SUBSCRIPTION_DEPENDANT_LAYER_VERSION_1,
-                        MOCK_PUBLISHER_LAYER_SUB_TYPE,
                         1, // number of dependencies for layer
                         SUBSCRIPTION_LAYER_ID,
+                        MOCK_PUBLISHER_LAYER_SUBTYPE,
                         SUBSCRIPTION_LAYER_VERSION,
-                        MOCK_PUBLISHER_LAYER_SUB_TYPE,
 
                         SUBSCRIPTION_DEPENDANT_LAYER_ID_2,
+                        MOCK_PUBLISHER_LAYER_SUBTYPE,
                         SUBSCRIPTION_DEPENDANT_LAYER_VERSION_2,
-                        MOCK_PUBLISHER_LAYER_SUB_TYPE,
                         2, // number of dependencies for layer
                         SUBSCRIPTION_LAYER_ID,
+                        MOCK_PUBLISHER_LAYER_SUBTYPE,
                         SUBSCRIPTION_LAYER_VERSION,
-                        MOCK_PUBLISHER_LAYER_SUB_TYPE,
                         SUBSCRIPTION_DEPENDANT_LAYER_ID_1,
+                        MOCK_PUBLISHER_LAYER_SUBTYPE,
                         SUBSCRIPTION_DEPENDANT_LAYER_VERSION_1,
-                        MOCK_PUBLISHER_LAYER_SUB_TYPE,
 
                         SUBSCRIPTION_DEPENDANT_LAYER_ID_2,
+                        MOCK_PUBLISHER_LAYER_SUBTYPE,
                         SUBSCRIPTION_DEPENDANT_LAYER_VERSION_2,
-                        MOCK_PUBLISHER_LAYER_SUB_TYPE,
                         1, // number of dependencies for layer
                         SUBSCRIPTION_UNSUPPORTED_LAYER_ID,
-                        SUBSCRIPTION_UNSUPPORTED_LAYER_VERSION,
-                        MOCK_PUBLISHER_LAYER_SUB_TYPE
+                        MOCK_PUBLISHER_LAYER_SUBTYPE,
+                        SUBSCRIPTION_UNSUPPORTED_LAYER_VERSION
                 )
         );
 
@@ -594,8 +593,8 @@
         }
 
         @Override
-        public void onLayersAvailabilityChange(List<VmsLayer> availableLayers) {
-            Log.d(TAG, "onLayersAvailabilityChange: Layers: " + availableLayers);
+        public void onLayersAvailabilityChanged(List<VmsLayer> availableLayers) {
+            Log.d(TAG, "onLayersAvailabilityChanged: Layers: " + availableLayers);
             mAvailableLayers.addAll(availableLayers);
             mSubscriberSemaphore.release();
         }
diff --git a/tests/carservice_unit_test/src/com/android/car/VmsLayersAvailabilityTest.java b/tests/carservice_unit_test/src/com/android/car/VmsLayersAvailabilityTest.java
index 92ec6f1..4a09d4f 100644
--- a/tests/carservice_unit_test/src/com/android/car/VmsLayersAvailabilityTest.java
+++ b/tests/carservice_unit_test/src/com/android/car/VmsLayersAvailabilityTest.java
@@ -31,9 +31,9 @@
 @SmallTest
 public class VmsLayersAvailabilityTest extends AndroidTestCase {
 
-    private static final VmsLayer LAYER_X = new VmsLayer(1, 2, 1);
-    private static final VmsLayer LAYER_Y = new VmsLayer(3, 4, 2);
-    private static final VmsLayer LAYER_Z = new VmsLayer(5, 6, 3);
+    private static final VmsLayer LAYER_X = new VmsLayer(1, 1, 2);
+    private static final VmsLayer LAYER_Y = new VmsLayer(3, 2, 4);
+    private static final VmsLayer LAYER_Z = new VmsLayer(5, 3, 6);
 
     private static final int PUBLISHER_ID_1 = 19;
     private static final int PUBLISHER_ID_2 = 28;
@@ -88,7 +88,8 @@
         expectedAvailableAssociatedLayers.add(new VmsAssociatedLayer(LAYER_X, PUBLISHERS_2));
 
         VmsLayersOffering offering =
-                new VmsLayersOffering(Arrays.asList(new VmsLayerDependency(LAYER_X)), PUBLISHER_ID_2);
+                new VmsLayersOffering(new HashSet<>(Arrays.asList(new VmsLayerDependency(LAYER_X))),
+                        PUBLISHER_ID_2);
 
         mOfferings.add(offering);
         mLayersAvailability.setPublishersOffering(mOfferings);
@@ -104,7 +105,7 @@
 
         VmsLayersOffering offering =
                 new VmsLayersOffering(
-                        Arrays.asList(X_DEPENDS_ON_Y, Y_DEPENDS_ON_Z, Z_DEPENDS_ON_NOTHING),
+                        new HashSet<>(Arrays.asList(X_DEPENDS_ON_Y, Y_DEPENDS_ON_Z, Z_DEPENDS_ON_NOTHING)),
                         PUBLISHER_ID_1);
 
         mOfferings.add(offering);
@@ -122,11 +123,12 @@
 
         VmsLayersOffering offering1 =
                 new VmsLayersOffering(
-                        Arrays.asList(X_DEPENDS_ON_Y, Y_DEPENDS_ON_Z),
+                        new HashSet<>(Arrays.asList(X_DEPENDS_ON_Y, Y_DEPENDS_ON_Z)),
                         PUBLISHER_ID_1);
 
         VmsLayersOffering offering2 =
-                new VmsLayersOffering(Arrays.asList(Z_DEPENDS_ON_NOTHING), PUBLISHER_ID_1);
+                new VmsLayersOffering(new HashSet<>(Arrays.asList(Z_DEPENDS_ON_NOTHING)),
+                        PUBLISHER_ID_1);
 
         mOfferings.add(offering1);
         mOfferings.add(offering2);
@@ -139,7 +141,8 @@
     public void testChainOfDependencieNotSatisfied() throws Exception {
         Set<VmsAssociatedLayer> expectedAvailableAssociatedLayers = new HashSet<>();
         VmsLayersOffering offering =
-                new VmsLayersOffering(Arrays.asList(X_DEPENDS_ON_Y, Y_DEPENDS_ON_Z), PUBLISHER_ID_1);
+                new VmsLayersOffering(new HashSet<>(Arrays.asList(X_DEPENDS_ON_Y, Y_DEPENDS_ON_Z)),
+                        PUBLISHER_ID_1);
 
         mOfferings.add(offering);
         mLayersAvailability.setPublishersOffering(mOfferings);
@@ -164,7 +167,9 @@
 
         VmsLayersOffering offering =
                 new VmsLayersOffering(
-                        Arrays.asList(X_DEPENDS_ON_Y, X_DEPENDS_ON_Z, Z_DEPENDS_ON_NOTHING), PUBLISHER_ID_1);
+                        new HashSet<>(Arrays.asList(
+                                X_DEPENDS_ON_Y, X_DEPENDS_ON_Z, Z_DEPENDS_ON_NOTHING)),
+                        PUBLISHER_ID_1);
 
         mOfferings.add(offering);
         mLayersAvailability.setPublishersOffering(mOfferings);
@@ -178,7 +183,9 @@
 
         VmsLayersOffering offering =
                 new VmsLayersOffering(
-                        Arrays.asList(X_DEPENDS_ON_Y, Y_DEPENDS_ON_Z, Z_DEPENDS_ON_X), PUBLISHER_ID_1);
+                        new HashSet<>(
+                                Arrays.asList(X_DEPENDS_ON_Y, Y_DEPENDS_ON_Z, Z_DEPENDS_ON_X)),
+                        PUBLISHER_ID_1);
 
         mOfferings.add(offering);
         mLayersAvailability.setPublishersOffering(mOfferings);
@@ -194,11 +201,13 @@
         expectedAvailableAssociatedLayers.add(new VmsAssociatedLayer(LAYER_Y, PUBLISHERS_2));
 
         VmsLayersOffering offering1 =
-                new VmsLayersOffering(Arrays.asList(X_DEPENDS_ON_Y, Z_DEPENDS_ON_NOTHING),
+                new VmsLayersOffering(
+                        new HashSet<>(Arrays.asList(X_DEPENDS_ON_Y, Z_DEPENDS_ON_NOTHING)),
                         PUBLISHER_ID_1);
 
         VmsLayersOffering offering2 =
-                new VmsLayersOffering(Arrays.asList(Y_DEPENDS_ON_Z, Z_DEPENDS_ON_X), PUBLISHER_ID_2);
+                new VmsLayersOffering(new HashSet<>(Arrays.asList(Y_DEPENDS_ON_Z, Z_DEPENDS_ON_X)),
+                        PUBLISHER_ID_2);
 
         mOfferings.add(offering1);
         mOfferings.add(offering2);
@@ -212,11 +221,13 @@
         expectedAvailableAssociatedLayers.add(new VmsAssociatedLayer(LAYER_Z, PUBLISHERS_1));
 
         VmsLayersOffering offering1 =
-                new VmsLayersOffering(Arrays.asList(X_DEPENDS_ON_Y, Z_DEPENDS_ON_NOTHING),
+                new VmsLayersOffering(
+                        new HashSet<>(
+                                Arrays.asList(X_DEPENDS_ON_Y, Z_DEPENDS_ON_NOTHING)),
                         PUBLISHER_ID_1);
 
         VmsLayersOffering offering2 =
-                new VmsLayersOffering(Arrays.asList(Y_DEPENDS_ON_X), PUBLISHER_ID_2);
+                new VmsLayersOffering(new HashSet<>(Arrays.asList(Y_DEPENDS_ON_X)), PUBLISHER_ID_2);
 
         mOfferings.add(offering1);
         mOfferings.add(offering2);
@@ -237,7 +248,8 @@
         Set<VmsAssociatedLayer> expectedAvailableAssociatedLayers = new HashSet<>();
 
         VmsLayersOffering offering =
-                new VmsLayersOffering(Arrays.asList(X_DEPENDS_ON_SELF), PUBLISHER_ID_1);
+                new VmsLayersOffering(new HashSet<>(Arrays.asList(X_DEPENDS_ON_SELF)),
+                        PUBLISHER_ID_1);
 
         mOfferings.add(offering);
         mLayersAvailability.setPublishersOffering(mOfferings);
diff --git a/tests/carservice_unit_test/src/com/android/car/VmsRoutingTest.java b/tests/carservice_unit_test/src/com/android/car/VmsRoutingTest.java
index 3f77dd8..8fe849b 100644
--- a/tests/carservice_unit_test/src/com/android/car/VmsRoutingTest.java
+++ b/tests/carservice_unit_test/src/com/android/car/VmsRoutingTest.java
@@ -33,10 +33,10 @@
 
 @SmallTest
 public class VmsRoutingTest extends AndroidTestCase {
-    private static VmsLayer LAYER_WITH_SUBSCRIPTION_1 = new VmsLayer(1, 2, 1);
+    private static VmsLayer LAYER_WITH_SUBSCRIPTION_1 = new VmsLayer(1, 1, 2);
     private static VmsLayer LAYER_WITH_SUBSCRIPTION_2 = new VmsLayer(1, 3, 3);
     private static VmsLayer LAYER_WITHOUT_SUBSCRIPTION =
-            new VmsLayer(1, 4, 7);
+            new VmsLayer(1, 7, 4);
     private static int PUBLISHER_ID_1 = 123;
     private static int PUBLISHER_ID_2 = 456;
     private static int PUBLISHER_ID_UNLISTED = 789;
@@ -63,7 +63,7 @@
         VmsSubscriptionState subscriptionState = mRouting.getSubscriptionState();
         assertEquals(2, subscriptionState.getSequenceNumber());
         assertEquals(expectedSubscriptions,
-                new HashSet<>(subscriptionState.getSubscribedLayersFromAll()));
+                new HashSet<>(subscriptionState.getLayers()));
 
         // Verify there is only a single subscriber.
         assertEquals(1,
@@ -87,7 +87,7 @@
         VmsSubscriptionState subscriptionState = mRouting.getSubscriptionState();
         assertEquals(3, subscriptionState.getSequenceNumber());
         assertEquals(expectedSubscriptions,
-                new HashSet<>(subscriptionState.getSubscribedLayersFromAll()));
+                new HashSet<>(subscriptionState.getLayers()));
     }
 
     public void testAddingAndRemovingLayers() throws Exception {
@@ -107,7 +107,7 @@
         // Verify there are no subscribers in the routing manager.
         VmsSubscriptionState subscriptionState = mRouting.getSubscriptionState();
         assertEquals(4, subscriptionState.getSequenceNumber());
-        assertTrue(subscriptionState.getSubscribedLayersFromAll().isEmpty());
+        assertTrue(subscriptionState.getLayers().isEmpty());
     }
 
     public void testAddingBothTypesOfSubscribers() throws Exception {
@@ -176,10 +176,10 @@
         VmsSubscriptionState subscriptionState = mRouting.getSubscriptionState();
         assertEquals(5, subscriptionState.getSequenceNumber());
         assertEquals(expectedSubscriptions,
-                new HashSet<>(subscriptionState.getSubscribedLayersFromAll()));
+                new HashSet<>(subscriptionState.getLayers()));
 
         assertEquals(expectedSubscriptionsToPublishers,
-                subscriptionState.getSubscribedLayersFromPublishers());
+                subscriptionState.getAssociatedLayers());
 
         // Verify there is only a single subscriber.
         assertEquals(1,
@@ -248,10 +248,10 @@
         VmsSubscriptionState subscriptionState = mRouting.getSubscriptionState();
         assertEquals(6, subscriptionState.getSequenceNumber());
         assertEquals(expectedSubscriptions,
-                new HashSet<>(subscriptionState.getSubscribedLayersFromAll()));
+                new HashSet<>(subscriptionState.getLayers()));
 
         assertEquals(expectedSubscriptionsToPublishers,
-                subscriptionState.getSubscribedLayersFromPublishers());
+                subscriptionState.getAssociatedLayers());
 
         // Verify there is only a single subscriber.
         assertEquals(1,
@@ -286,10 +286,10 @@
         VmsSubscriptionState subscriptionState = mRouting.getSubscriptionState();
         assertEquals(6, subscriptionState.getSequenceNumber());
         assertEquals(expectedSubscriptions,
-                new HashSet<>(subscriptionState.getSubscribedLayersFromAll()));
+                new HashSet<>(subscriptionState.getLayers()));
 
         assertEquals(expectedSubscriptionsToPublishers,
-                subscriptionState.getSubscribedLayersFromPublishers());
+                subscriptionState.getAssociatedLayers());
 
         // Verify there is only a single subscriber.
         assertEquals(1,
@@ -303,7 +303,7 @@
         }
 
         @Override
-        public void onLayersAvailabilityChange(List<VmsAssociatedLayer> availableLayers) {
+        public void onLayersAvailabilityChanged(List<VmsAssociatedLayer> availableLayers) {
         }
     }
 }
\ No newline at end of file