GnssBatching::init handle multiple invoking
Release mApi if mApi is not null and return true. Change-Id: I996bd94fca83f93fa47a9dcf282ebf4610071288 CRs-fixed: 2043876
This commit is contained in:
parent
10ab9ccaaf
commit
997b6b55ab
1 changed files with 3 additions and 2 deletions
|
@ -55,8 +55,9 @@ GnssBatching::~GnssBatching() {
|
|||
// Methods from ::android::hardware::gnss::V1_0::IGnssBatching follow.
|
||||
Return<bool> GnssBatching::init(const sp<IGnssBatchingCallback>& callback) {
|
||||
if (mApi != nullptr) {
|
||||
LOC_LOGE("%s]: mApi is NOT nullptr", __FUNCTION__);
|
||||
return false;
|
||||
LOC_LOGD("%s]: mApi is NOT nullptr, delete it first", __FUNCTION__);
|
||||
delete mApi;
|
||||
mApi = nullptr;
|
||||
}
|
||||
|
||||
mApi = new BatchingAPIClient(callback);
|
||||
|
|
Loading…
Reference in a new issue