aboutsummaryrefslogtreecommitdiff
path: root/car-lib
diff options
context:
space:
mode:
authorAsaf Rosenfeld <asafro@google.com>2017-06-16 11:16:55 -0700
committerAsaf Rosenfeld <asafro@google.com>2017-06-21 13:10:10 -0700
commit43900533237db90138dcfa55c65ae2a542cd72a0 (patch)
treec0948329060db25d2133ee271f6944909198e300 /car-lib
parentd813471b0f09acfd4794e5b60ac829366ce29259 (diff)
downloadCar-43900533237db90138dcfa55c65ae2a542cd72a0.tar.gz
Adding Publisher ID to offering, Availability to HAL
Test: adjusted tests to cover multiple publishers offering reflected in availability Bug: 38185470, 37627772, 37627272 Change-Id: I3734e4127b08d9c1f9a26ecb844c8cbfb5a7d8b6
Diffstat (limited to 'car-lib')
-rw-r--r--car-lib/src/android/car/vms/IVmsSubscriberClient.aidl3
-rw-r--r--car-lib/src/android/car/vms/VmsAssociatedLayer.aidl19
-rw-r--r--car-lib/src/android/car/vms/VmsAssociatedLayer.java101
-rw-r--r--car-lib/src/android/car/vms/VmsLayersOffering.java11
-rw-r--r--car-lib/src/android/car/vms/VmsSubscriberManager.java2
5 files changed, 133 insertions, 3 deletions
diff --git a/car-lib/src/android/car/vms/IVmsSubscriberClient.aidl b/car-lib/src/android/car/vms/IVmsSubscriberClient.aidl
index 79c88ac46e..05edfaa766 100644
--- a/car-lib/src/android/car/vms/IVmsSubscriberClient.aidl
+++ b/car-lib/src/android/car/vms/IVmsSubscriberClient.aidl
@@ -16,6 +16,7 @@
package android.car.vms;
+import android.car.vms.VmsAssociatedLayer;
import android.car.vms.VmsLayer;
/**
@@ -27,5 +28,5 @@ oneway interface IVmsSubscriberClient {
*/
void onVmsMessageReceived(in VmsLayer layer, in byte[] payload) = 0;
- void onLayersAvailabilityChange(in List<VmsLayer> availableLayers) = 1;
+ void onLayersAvailabilityChange(in List<VmsAssociatedLayer> availableLayers) = 1;
}
diff --git a/car-lib/src/android/car/vms/VmsAssociatedLayer.aidl b/car-lib/src/android/car/vms/VmsAssociatedLayer.aidl
new file mode 100644
index 0000000000..c2cf271549
--- /dev/null
+++ b/car-lib/src/android/car/vms/VmsAssociatedLayer.aidl
@@ -0,0 +1,19 @@
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.car.vms;
+
+parcelable VmsAssociatedLayer; \ No newline at end of file
diff --git a/car-lib/src/android/car/vms/VmsAssociatedLayer.java b/car-lib/src/android/car/vms/VmsAssociatedLayer.java
new file mode 100644
index 0000000000..dcd0d98748
--- /dev/null
+++ b/car-lib/src/android/car/vms/VmsAssociatedLayer.java
@@ -0,0 +1,101 @@
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.car.vms;
+
+import android.car.annotation.FutureFeature;
+import android.os.Parcel;
+import android.os.Parcelable;
+
+import java.util.*;
+
+/**
+ * A VMS Layer with a list of publisher IDs it is associated with.
+ *
+ * @hide
+ */
+@FutureFeature
+public final class VmsAssociatedLayer implements Parcelable {
+
+ // The VmsLayer.
+ private final VmsLayer mLayer;
+
+ // The IDs of the publishers that can publish this VmsLayer.
+ private final Set<Integer> mPublisherIds;
+
+ public VmsAssociatedLayer(VmsLayer layer, Set<Integer> publisherIds) {
+ mLayer = layer;
+ mPublisherIds = Collections.unmodifiableSet(publisherIds);
+ }
+
+ public VmsLayer getVmsLayer() {
+ return mLayer;
+ }
+
+ public Collection<Integer> getPublisherIds() {
+ return mPublisherIds;
+ }
+
+ @Override
+ public String toString() {
+ return "VmsAssociatedLayer{ VmsLayer: " + mLayer + ", Publishers: " + mPublisherIds + "}";
+ }
+
+ // Parcelable related methods.
+ public static final Parcelable.Creator<VmsAssociatedLayer> CREATOR =
+ new Parcelable.Creator<VmsAssociatedLayer>() {
+ public VmsAssociatedLayer createFromParcel(Parcel in) {
+ return new VmsAssociatedLayer(in);
+ }
+
+ public VmsAssociatedLayer[] newArray(int size) {
+ return new VmsAssociatedLayer[size];
+ }
+ };
+
+ @Override
+ public void writeToParcel(Parcel out, int flags) {
+ out.writeParcelable(mLayer, flags);
+ out.writeArray(mPublisherIds.toArray());
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (!(o instanceof VmsAssociatedLayer)) {
+ return false;
+ }
+ VmsAssociatedLayer p = (VmsAssociatedLayer) o;
+ return Objects.equals(p.mLayer, mLayer) && p.mPublisherIds.equals(mPublisherIds);
+ }
+
+ @Override
+ public int describeContents() {
+ return 0;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(mLayer, mPublisherIds);
+ }
+
+ private VmsAssociatedLayer(Parcel in) {
+ mLayer = in.readParcelable(VmsLayer.class.getClassLoader());
+
+ mPublisherIds = Collections.unmodifiableSet(
+ new HashSet<>(Arrays.asList(
+ (Integer[]) in.readArray(Integer.class.getClassLoader()))));
+ }
+} \ No newline at end of file
diff --git a/car-lib/src/android/car/vms/VmsLayersOffering.java b/car-lib/src/android/car/vms/VmsLayersOffering.java
index 51a0b995be..925affca59 100644
--- a/car-lib/src/android/car/vms/VmsLayersOffering.java
+++ b/car-lib/src/android/car/vms/VmsLayersOffering.java
@@ -33,8 +33,11 @@ public final class VmsLayersOffering implements Parcelable {
private final List<VmsLayerDependency> mDependencies;
- public VmsLayersOffering(List<VmsLayerDependency> dependencies) {
+ private final int mPublisherStaticId;
+
+ public VmsLayersOffering(List<VmsLayerDependency> dependencies, int publisherStaticId) {
mDependencies = Collections.unmodifiableList(dependencies);
+ mPublisherStaticId = publisherStaticId;
}
/**
@@ -44,6 +47,10 @@ public final class VmsLayersOffering implements Parcelable {
return mDependencies;
}
+ public int getPublisherStaticId() {
+ return mPublisherStaticId;
+ }
+
public static final Parcelable.Creator<VmsLayersOffering> CREATOR = new
Parcelable.Creator<VmsLayersOffering>() {
public VmsLayersOffering createFromParcel(Parcel in) {
@@ -62,6 +69,7 @@ public final class VmsLayersOffering implements Parcelable {
@Override
public void writeToParcel(Parcel out, int flags) {
out.writeParcelableList(mDependencies, flags);
+ out.writeInt(mPublisherStaticId);
}
@Override
@@ -73,5 +81,6 @@ public final class VmsLayersOffering implements Parcelable {
List<VmsLayerDependency> dependencies = new ArrayList<>();
in.readParcelableList(dependencies, VmsLayerDependency.class.getClassLoader());
mDependencies = Collections.unmodifiableList(dependencies);
+ mPublisherStaticId = in.readInt();
}
} \ No newline at end of file
diff --git a/car-lib/src/android/car/vms/VmsSubscriberManager.java b/car-lib/src/android/car/vms/VmsSubscriberManager.java
index 84405f4a12..c0a0a9556c 100644
--- a/car-lib/src/android/car/vms/VmsSubscriberManager.java
+++ b/car-lib/src/android/car/vms/VmsSubscriberManager.java
@@ -124,7 +124,7 @@ public final class VmsSubscriberManager implements CarManagerBase {
}
@Override
- public void onLayersAvailabilityChange(List<VmsLayer> availableLayers) {
+ public void onLayersAvailabilityChange(List<VmsAssociatedLayer> availableLayers) {
mHandler.sendMessage(
mHandler.obtainMessage(
VmsEventHandler.ON_AVAILABILITY_CHANGE_EVENT,