From b87616de13ba8ec89d8c586757bca1d001775019 Mon Sep 17 00:00:00 2001 From: Chumva Date: Fri, 26 Apr 2019 12:55:29 +0300 Subject: [PATCH] Fix adding new aidl callback --- OsmAnd/src/net/osmand/aidl/OsmandAidlService.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/OsmAnd/src/net/osmand/aidl/OsmandAidlService.java b/OsmAnd/src/net/osmand/aidl/OsmandAidlService.java index 347e1153fe..0d6259ae65 100644 --- a/OsmAnd/src/net/osmand/aidl/OsmandAidlService.java +++ b/OsmAnd/src/net/osmand/aidl/OsmandAidlService.java @@ -158,8 +158,9 @@ public class OsmandAidlService extends Service implements AidlCallbackListener { @Override public long addAidlCallback(IOsmAndAidlCallback callback, int key) { - callbacks.put(getAndIncrementCallbackId(), new AidlCallbackParams(callback, key)); - return getCallbackId(); + long id = getAndIncrementCallbackId(); + callbacks.put(id, new AidlCallbackParams(callback, key)); + return id; } @Override @@ -765,7 +766,7 @@ public class OsmandAidlService extends Service implements AidlCallbackListener { if (updateTimeMS >= MIN_UPDATE_TIME_MS) { long id = addAidlCallback(callback, KEY_ON_UPDATE); startRemoteUpdates(updateTimeMS, id, callback); - return getCallbackId(); + return id; } else { return MIN_UPDATE_TIME_MS_ERROR; }