diff options
author | Asaf Rosenfeld <asafro@google.com> | 2017-03-13 16:24:27 -0700 |
---|---|---|
committer | Asaf Rosenfeld <asafro@google.com> | 2017-03-16 21:24:05 -0700 |
commit | 7bd684ec25febcbd65e32ff59e64f8b1d411aced (patch) | |
tree | 9a58f9d5b79bef075f8667bc6a06015cd1de7dd7 /service/src/com/android/car/VmsPublisherService.java | |
parent | b588b30274fcdd3fe5953838cfa86f38b52f4944 (diff) | |
download | Car-7bd684ec25febcbd65e32ff59e64f8b1d411aced.tar.gz |
Adding a class to describe a single VMS dependency.
Adding a class to describe a publisher layers offering.
Adding a way to publishers to declare their offering.
Adding a token to publishers so that the service can track offering and
potentially have more access control on publishing
Test: Verified tests run
Bug: TBD
Change-Id: Ibad7309608e983169deecf371360d3594a4e2dba
Diffstat (limited to 'service/src/com/android/car/VmsPublisherService.java')
-rw-r--r-- | service/src/com/android/car/VmsPublisherService.java | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/service/src/com/android/car/VmsPublisherService.java b/service/src/com/android/car/VmsPublisherService.java index bcd30523b6..112314f207 100644 --- a/service/src/com/android/car/VmsPublisherService.java +++ b/service/src/com/android/car/VmsPublisherService.java @@ -21,18 +21,18 @@ import android.car.vms.IOnVmsMessageReceivedListener; import android.car.vms.IVmsPublisherClient; import android.car.vms.IVmsPublisherService; import android.car.vms.VmsLayer; +import android.car.vms.VmsLayersOffering; import android.content.ComponentName; import android.content.Context; import android.content.Intent; import android.content.ServiceConnection; +import android.os.Binder; import android.os.IBinder; import android.os.RemoteException; import android.text.TextUtils; import android.util.Log; - import com.android.car.hal.VmsHalService; import com.android.internal.annotations.GuardedBy; - import java.io.PrintWriter; import java.lang.ref.WeakReference; import java.util.ArrayList; @@ -55,6 +55,7 @@ public class VmsPublisherService extends IVmsPublisherService.Stub private final Context mContext; private final VmsHalService mHal; private final VmsPublisherManager mPublisherManager; + private final Map<IBinder, VmsLayersOffering> mRawOffering = new HashMap<>(); public VmsPublisherService(Context context, VmsHalService hal) { mContext = context; @@ -92,9 +93,19 @@ public class VmsPublisherService extends IVmsPublisherService.Stub public void dump(PrintWriter writer) { } + @Override + public void setLayersOffering(IBinder token, VmsLayersOffering offering) { + // Store the raw dependencies + mRawOffering.put(token, offering); + + //TODO(asafro): Calculate the new available layers + + //TODO(asafro): Notify the subscribers that there is a change in availability + } + // Implements IVmsPublisherService interface. @Override - public void publish(int layerId, int layerVersion, byte[] payload) { + public void publish(IBinder token, int layerId, int layerVersion, byte[] payload) { if (DBG) { Log.d(TAG, "Publishing for layer ID: " + layerId + " Version: " + layerVersion); } @@ -125,7 +136,7 @@ public class VmsPublisherService extends IVmsPublisherService.Stub } @Override - public List<VmsLayer> getSubscribers() { + public List<VmsLayer> getSubscriptions() { ICarImpl.assertVmsPublisherPermission(mContext); return mHal.getSubscribedLayers(); } @@ -240,6 +251,9 @@ public class VmsPublisherService extends IVmsPublisherService.Stub } class PublisherConnection implements ServiceConnection { + + private final IBinder mToken = new Binder(); + /** * Once the service binds to a publisher service, the publisher binder is added to * mPublisherMap @@ -257,7 +271,7 @@ public class VmsPublisherService extends IVmsPublisherService.Stub mPublisherMap.put(name.flattenToString(), service); } try { - service.setVmsPublisherService(publisherService); + service.setVmsPublisherService(mToken, publisherService); } catch (RemoteException e) { Log.e(TAG, "unable to configure publisher: " + name); } |