privacy-tech-lab / gpc-android

Code and dynamic analysis scripts for GPC on Android
https://privacytechlab.org/
MIT License
5 stars 1 forks source link

How do the Android ad APIs work, specifically, what is the impact of removing AdId on `isLimitAdTrackingEnabled()`? #49

Closed kasnder closed 1 year ago

kasnder commented 1 year ago

public boolean isLimitAdTrackingEnabled ()

Retrieves whether the user has limit ad tracking enabled or not. When the returned value is true, the returned value of [getId()](https://developers.google.com/android/reference/com/google/android/gms/ads/identifier/AdvertisingIdClient.Info#getId()) will always be 00000000-0000-0000-0000-000000000000 starting with Android 12 (but older devices may be problematic). This shows to me that Integration with previous devices may be an issue. Naive AdID solution will only be able to work on certain phones where the getId function has that certain functonality (https://www.deccanherald.com/business/technology/android-12-list-of-devices-eligible-for-the-latest-google-mobile-os-1031367.html)

Does removing the AdId also set this flag isLimitAdTrackingEnabled() to true in Android 12+?

This flag used to indicate to users whether they allow tracking but was removed in the UI as Google changed the UI and now allows users to remove the AdId.

As a result, it's unclear whether removing the AdId actually encourages apps not to track across apps anymore. This is not 100% clear from Google's policies, as discussed in #48

Todo: Build sample app, connect to AdId API, and show outputs (i.e. isLimitAdTrackingEnabled and retrieved AdId).

API documentation: https://developer.android.com/training/articles/ad-id

Originally posted in https://github.com/privacy-tech-lab/gpc-android/issues/48#issuecomment-1486921283

n-aggarwal commented 1 year ago

From what I am reading, I think the button that was previously "Limit Ad Tracking" is now delete AdId. The two options are synonymous and have the same effect with a few slight changes. Here is an excerpt from the google policy:

"As part of Google Play services update in late 2021, the advertising ID will be removed when a user opts out of personalization using advertising ID in Android Settings. Any attempts to access the identifier will receive a string of zeros instead of the identifier."

So the difference is that the "Limit Ad Tracking button" only had the effect of returning true for the isLimitAdTrackingEnabled() when toggled. The newer Delete AdId button does that, and also set the AdId to be a string of zeros.

Once again, this is only what I think happens from reading the documents. I still have to test this out.

Reference: https://support.google.com/googleplay/android-developer/answer/6048248?ref_topic=2364761

wesley-tan commented 1 year ago

Just to follow up on what Nishant said, here are the screenshots of pre-Android 11 and Android 12 and beyond. Both follow the same chain except for pre-Android 11 has "Opt out of Ads Personalization" vs Android 12's "Delete AdID". Both currently have the same effect with regards to zeroing out the AdID https://docs.google.com/document/d/19i2kXF59GvrS3o5RqsADSoQpq8jmZkZtbU8qbGavgtE/edit

SebastianZimmeck commented 1 year ago

@wesley-tan, can you post the screenshots here (in case you are moving or deleting the Google Coc)?

wesley-tan commented 1 year ago
Screenshot 2023-04-03 at 4 27 43 PM Screenshot 2023-04-03 at 4 27 52 PM Screenshot 2023-04-03 at 4 27 59 PM

I will add the rest later from the doc, I can't find the relevant thread but these are the pictures from Android Nougat (believe its Android 7). Android pre-11 follows roughly the same style (as mentioned in the gdoc) and 12 and onwards another

SebastianZimmeck commented 1 year ago

As we discussed, @n-aggarwal and @wesley-tan will look into more broadly how the different ad APIs on Android work.

For example, here is com.google.android.gms.ads. Is this the correct API? Are there more, different ones? Which does what? Maybe, also look into the sample apps (and run them). How do they work? What do we need to take into account from our perspective?

n-aggarwal commented 1 year ago

If the AdId is deleted, then isLimitAdTrackingEnabled() returns true.

Side Note: When trying to use the AdId and its related functions do not add the dependency: implementation 'androidx.ads:ads-identifier:1.0.0-alpha01' . Instead use the dependency implementation 'com.google.android.gms:play-services-ads-identifier:18.0.1'

kasnder commented 1 year ago

Code here: https://github.com/privacy-tech-lab/gpc-android/tree/issue-49