@@ -444,9 +444,11 @@ void updateGAdsParams() {
444444 int LATVal = DeviceInfo .getInstance ().getSystemObserver ().getLATVal ();
445445 String gaid = DeviceInfo .getInstance ().getSystemObserver ().getAID ();
446446 if (!TextUtils .isEmpty (gaid )) {
447- updateAdvertisingIdsObject (gaid );
448- // gaid is put in the request body below, calling to remove hardware id from request now
449- replaceHardwareIdOnValidAdvertisingId ();
447+ if (prefHelper_ .getConsumerProtectionAttributionLevel () == Defines .BranchAttributionLevel .FULL || !prefHelper_ .isAttributionLevelInitialized ()) {
448+ updateAdvertisingIdsObject (gaid );
449+ // gaid is put in the request body below, calling to remove hardware id from request now
450+ replaceHardwareIdOnValidAdvertisingId ();
451+ }
450452 }
451453 try {
452454 if (version == BRANCH_API_VERSION .V1 ) {
@@ -455,7 +457,9 @@ void updateGAdsParams() {
455457 if (!SystemObserver .isHuaweiMobileServicesAvailable (context_ )) {
456458 // Fire OS overloads ad id (representing it as Google ad id at the top level),
457459 // HUAWEI only reports ad id in the advertising_ids object
458- params_ .put (Defines .Jsonkey .GoogleAdvertisingID .getKey (), gaid );
460+ if (prefHelper_ .getConsumerProtectionAttributionLevel () == Defines .BranchAttributionLevel .FULL || !prefHelper_ .isAttributionLevelInitialized ()) {
461+ params_ .put (Defines .Jsonkey .GoogleAdvertisingID .getKey (), gaid );
462+ }
459463 }
460464 params_ .remove (Defines .Jsonkey .UnidentifiedDevice .getKey ());
461465 } else if (!payloadContainsDeviceIdentifiers (params_ ) &&
@@ -470,7 +474,9 @@ void updateGAdsParams() {
470474 if (!SystemObserver .isHuaweiMobileServicesAvailable (context_ )) {
471475 // Fire OS overloads ad id (representing it as Google ad id at the top level),
472476 // HUAWEI only reports ad id in the advertising_ids object
473- userDataObj .put (Defines .Jsonkey .AAID .getKey (), gaid );
477+ if (prefHelper_ .getConsumerProtectionAttributionLevel () == Defines .BranchAttributionLevel .FULL || !prefHelper_ .isAttributionLevelInitialized ()) {
478+ userDataObj .put (Defines .Jsonkey .AAID .getKey (), gaid );
479+ }
474480 }
475481 userDataObj .remove (Defines .Jsonkey .UnidentifiedDevice .getKey ());
476482 } else if (!payloadContainsDeviceIdentifiers (userDataObj ) &&
@@ -656,6 +662,7 @@ void doFinalUpdateOnBackgroundThread() {
656662 updateDisableAdNetworkCallouts ();
657663 //Google ADs ID and LAT value are updated using reflection. These method need background thread
658664 //So updating them for install and open on background thread.
665+
659666 if (isGAdsParamsRequired ()) {
660667 updateGAdsParams ();
661668 }
@@ -749,11 +756,13 @@ public void onPreExecute() {
749756 String externalIntentUri = prefHelper_ .getExternalIntentUri ();
750757 utility .parseReferringURL (externalIntentUri );
751758
752- JSONObject urlQueryParams = utility .getURLQueryParamsForRequest (this );
759+ if (prefHelper_ .getConsumerProtectionAttributionLevel () == Defines .BranchAttributionLevel .FULL || !prefHelper_ .isAttributionLevelInitialized ()) {
760+ JSONObject urlQueryParams = utility .getURLQueryParamsForRequest (this );
753761
754- for (Iterator <String > it = urlQueryParams .keys (); it .hasNext (); ) {
755- String key = it .next ();
756- this .params_ .put (key , urlQueryParams .get (key ));
762+ for (Iterator <String > it = urlQueryParams .keys (); it .hasNext (); ) {
763+ String key = it .next ();
764+ this .params_ .put (key , urlQueryParams .get (key ));
765+ }
757766 }
758767
759768 } catch (Exception e ) {
0 commit comments