Skip to content

Commit 570cb77

Browse files
author
AppDevForAll
committed
ADFA-4533: gate crash reporting by its own CrashReportConsent (default ON)
Decouple crash/error reporting from usage-analytics consent. Add CrashReportConsent (same SharedPreferences-backed pattern as AnalyticsConsent, separate key, default ON) and have IIABApplication gate Sentry init on it instead of AnalyticsConsent. Error reports are operational (not behavioural telemetry) and carry no PII (send-default-pii=false), so they can follow a different policy; flipping the default in CrashReportConsent is the single knob if administration later makes them opt-in. A user-facing toggle in Settings can be added as a follow-up (UI + localized strings).
1 parent 2cff074 commit 570cb77

2 files changed

Lines changed: 33 additions & 5 deletions

File tree

‎controller/app/src/main/java/org/iiab/controller/IIABApplication.java‎

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,14 @@ public void onCreate() {
3535
Log.e("IIABApplication", "Error initializing Conscrypt", e);
3636
}
3737

38-
// ADFA-4533: crash reporting to GlitchTip (Sentry SDK), consent-gated like analytics.
39-
// Manifest sets io.sentry.auto-init=false, so this is the only init path. No-op unless
40-
// the operator opted in AND a DSN was built in (empty DSN -> SDK stays inert). Init here
41-
// (before our handler) so K2GoUncaughtExceptionHandler wraps Sentry: local save -> report.
38+
// ADFA-4533: crash reporting to GlitchTip (Sentry SDK), gated by its OWN opt-in
39+
// (CrashReportConsent, default ON) -- independent of usage-analytics consent, since error
40+
// reports are operational, not behavioural telemetry, and carry no PII
41+
// (io.sentry.send-default-pii=false). No-op unless a DSN was built in (empty DSN -> SDK
42+
// stays inert); manifest sets io.sentry.auto-init=false, so this is the only init path.
43+
// Init here (before our handler) so K2GoUncaughtExceptionHandler wraps Sentry: save -> report.
4244
try {
43-
if (org.iiab.controller.delivery.data.AnalyticsConsent.isEnabled(this)) {
45+
if (org.iiab.controller.delivery.data.CrashReportConsent.isEnabled(this)) {
4446
io.sentry.android.core.SentryAndroid.init(this);
4547
}
4648
} catch (Throwable t) {
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package org.iiab.controller.delivery.data;
2+
3+
import android.content.Context;
4+
5+
/**
6+
* Opt-in flag for crash / error reporting (GlitchTip via the Sentry SDK). Separate from
7+
* {@link AnalyticsConsent} on purpose: error reports are operational (not behavioural
8+
* telemetry) and carry no PII, so they can follow a different policy. Default ON; flip the
9+
* default here if administration decides error reports must also be opt-in.
10+
*/
11+
public final class CrashReportConsent {
12+
13+
private static final String PREFS = "iiab_delivery";
14+
private static final String KEY = "crash_reports_opt_in";
15+
16+
private CrashReportConsent() {
17+
}
18+
19+
public static boolean isEnabled(Context ctx) {
20+
return ctx.getSharedPreferences(PREFS, Context.MODE_PRIVATE).getBoolean(KEY, true);
21+
}
22+
23+
public static void setEnabled(Context ctx, boolean enabled) {
24+
ctx.getSharedPreferences(PREFS, Context.MODE_PRIVATE).edit().putBoolean(KEY, enabled).apply();
25+
}
26+
}

0 commit comments

Comments
 (0)