internal void ModifyManifest(string basePath) { var manifestPath = GetManifestPath(basePath); if (!File.Exists(manifestPath)) { throw new FileNotFoundException("Can't configure native Android SDK nor set auto-init:false.", manifestPath); } var disableAutoInit = false; var options = _getOptions(); if (options is null) { var logger = new UnityLogger(new SentryOptions(), _interceptor); logger.LogWarning("Couldn't load SentryOptions. Can't configure native Android SDK."); disableAutoInit = true; } else if (!options.IsValid()) { options.DiagnosticLogger?.LogWarning( "Failed to validate Sentry Options. Android native support will not be configured."); disableAutoInit = true; } else if (!options.AndroidNativeSupportEnabled) { options.DiagnosticLogger?.LogDebug("Android Native support disabled via options."); disableAutoInit = true; } var androidManifest = new AndroidManifest(manifestPath, options?.DiagnosticLogger); androidManifest.RemovePreviousConfigurations(); if (disableAutoInit) { androidManifest.DisableSentryAndSave(); return; } options !.DiagnosticLogger?.LogDebug("Configuring Sentry options on AndroidManifest: {0}", basePath); options.DiagnosticLogger?.LogDebug("Setting DSN: {0}", options.Dsn); androidManifest.SetDsn(options.Dsn !); if (!options.DebugOnlyInEditor) { options.DiagnosticLogger?.LogDebug("Setting Debug: {0}", options.Debug); androidManifest.SetDebug(options.Debug); } else { options.DiagnosticLogger?.LogDebug("Not setting debug flag because DebugOnlyInEditor is true"); } if (options.Release is not null) { options.DiagnosticLogger?.LogDebug("Setting Release: {0}", options.Release); androidManifest.SetRelease(options.Release); } if (options.Environment is not null) { options.DiagnosticLogger?.LogDebug("Setting Environment: {0}", options.Environment); androidManifest.SetEnvironment(options.Environment); } options.DiagnosticLogger?.LogDebug("Setting DiagnosticLevel: {0}", options.DiagnosticLevel); androidManifest.SetLevel(options.DiagnosticLevel); if (options.SampleRate.HasValue) { options.DiagnosticLogger?.LogDebug("Setting SampleRate: {0}", options.SampleRate); androidManifest.SetSampleRate(options.SampleRate.Value); } // TODO: Missing on AndroidManifest // options.DiagnosticLogger?.LogDebug("Setting MaxBreadcrumbs: {0}", options.MaxBreadcrumbs); // androidManifest.SetMaxBreadcrumbs(options.MaxBreadcrumbs); // options.DiagnosticLogger?.LogDebug("Setting MaxCacheItems: {0}", options.MaxCacheItems); // androidManifest.SetMaxCacheItems(options.MaxCacheItems); // options.DiagnosticLogger?.LogDebug("Setting SendDefaultPii: {0}", options.SendDefaultPii); // // androidManifest.SetSendDefaultPii(options.SendDefaultPii); // Disabling the native in favor of the C# layer for now androidManifest.SetAutoSessionTracking(false); // TODO: We need an opt-out for this: androidManifest.SetNdkScopeSync(true); // TODO: All SentryOptions and create specific Android options _ = androidManifest.Save(); }