The Branch Android SDK for deep linking and attribution. Branch helps mobile apps grow with deep links / deeplinks that power paid acquisition and re-engagement campaigns, referral programs, content sharing, deep linked emails, smart banners, custom user onboarding, and more.
It happens to us that a lot of install requests don't include the field aaid, but purchase and new customer do.
This issue doesn't happen for all the cases.
After investigating, we found that this is potentially a concurrency problem.
On our side, we invoke
Branch.getInstance().disableTracking(..)
This call goes the way down to Branch#registerAppInit().
Within this method:
initTasks will request to fetch adId asynchronously.
requestQueue_.processNextQueueItem create an AsyncTask (BranchPostTask) to update GAds Params (through ServerRequest#updateGAdsParams).
There is a set of locks being introduced that can made the 2nd request requestQueue_.processNextQueueItem wait for the first one to be finished. However, within initTask, ignoreWaitLocks is passed as true (this value comes from TrackingController#onTrackingEnabled), as a consequence, lock is not added into the set, so the 2nd request is not aware of the other ones being executed and goes ahead, which leads to the fact that gaid is potentially not ready when updateGAdsParams get invoked.
Is this correct or do I miss anything?
Steps to reproduce
Call Branch.getInstance().disableTracking(..);
Expected behavior
gaid is used only after gaid fetching is finished.
Describe the bug
It happens to us that a lot of
install
requests don't include the fieldaaid
, butpurchase
andnew customer
do. This issue doesn't happen for all the cases. After investigating, we found that this is potentially a concurrency problem. On our side, we invokeThis call goes the way down to
Branch#registerAppInit()
. Within this method:These 2 calls cause the issue:
initTasks
will request to fetch adId asynchronously.requestQueue_.processNextQueueItem
create anAsyncTask
(BranchPostTask
) to update GAds Params (throughServerRequest#updateGAdsParams
).There is a set of locks being introduced that can made the 2nd request
requestQueue_.processNextQueueItem
wait for the first one to be finished. However, withininitTask
,ignoreWaitLocks
is passed astrue
(this value comes fromTrackingController#onTrackingEnabled
), as a consequence, lock is not added into the set, so the 2nd request is not aware of the other ones being executed and goes ahead, which leads to the fact thatgaid
is potentially not ready whenupdateGAdsParams
get invoked.Is this correct or do I miss anything?
Steps to reproduce
Branch.getInstance().disableTracking(..);
Expected behavior
gaid
is used only after gaid fetching is finished.SDK Version
5.11
Make and Model
Emulator Pixel 8 API 34
OS
14
Additional Information/Context
No response