oppia / oppia-android

A free, online & offline learning platform to make quality education accessible for all.
https://www.oppia.org
Apache License 2.0
317 stars 519 forks source link

Introduce developer-only UI for data collection acknowledgement #4390

Open BenHenning opened 2 years ago

BenHenning commented 2 years ago

Currently, data collection is off by default on the local develop branch. However, developers are welcome to turn on data collection, and metrics will be uploaded to the Oppia Android developer Firebase project.

In order to ensure developers are aware of this, we should introduce a new UI that confirms with the developer that they're okay with metrics being collected. However, this dialog only needs to show up if:

Note that acknowledgement should be individual for analytics and crashlytics (meaning if they acknowledged collection when one was enabled and not the other, ernabling the other should re-show the dialog). The dialog should also clarify which data is being collected between analytics, crashes, or both.

To ease long-term development, we should also support setting an ADB property for auto-acknowledging this data collection so that the dialog doesn't appear on subsequent fresh reinstalls of the app. The dialog should also only show for developers, not production users or testers.

If the user declines the data collection, the app should automatically exit. Metrics should also be stopped from being uploaded until acknowledgement occurs.

Overall, this issue is tracking:

Sarthak2601 commented 2 years ago

If the user declines the data collection, the app should automatically exit.

@BenHenning can't we introduce this as a check instead of just acknowledgement -- The user can choose if they want to have analytics (and crashlytics) turned off/on at the start and then we can alter the settings accordingly.

More context -- currently we control the flags via the manifest file but we can also control the values via firebase APIs.

BenHenning commented 2 years ago

@Sarthak2601 is it possible to have analytics off by default in the manifest and enable it programmatically on startup? That might be an interesting way to go. Normally, I'd be concerned about us limiting our ability to log early app events, but since we abstracted Firebase we can still do that as all we'd be delaying is the actual upload, not the creation of the events.

If we can programmatically enable logging, then I think we can revise this entire project to be tied around introducing a new developer option for opting into analytics in such a way that it stays enabled. Some thought needs to go into how this will behave on production devices, and the test around it, though. I think we also want to keep an acknowledgement flow, but the cancel behavior doesn't need to mean "exit the app" in that case.

Sarthak2601 commented 2 years ago

@BenHenning to do this we'd have to change the existing flag that's present in the manifest. Current flag permanently turns off analytics collection but we can switch it with the temporary flag that disables collection until re-enabled programmatically. We can even turn analytics on/off again and again as per user's preference -- so maybe we can also look into providing an option to the user to turn analytics collection on or off anytime.

More on this is mentioned here - Temporarily disable Analytics data collection

BenHenning commented 2 years ago

Perfect--thanks @Sarthak2601. Is there also a similar property for Crashlytics?

Sarthak2601 commented 2 years ago

Perfect--thanks @Sarthak2601. Is there also a similar property for Crashlytics?

Yes -- Enable opt-in reporting.

BenHenning commented 2 years ago

Thanks @Sarthak2601.

In that case, I agree that this issue should instead track introducing an opt-in analytics flow for developers and introducing an acknowledgement flow for turning on analytics. This should be set up such that a tag can permanently enabled analytics, as well.