Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android crash reports #9665

Merged
merged 6 commits into from
Aug 31, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,11 @@ if (target_cpu == "x86") {
}

action("create_symbols_dist") {
output = "$brave_dist_dir/$brave_product_name-v$brave_version-$brave_platform-$target_arch-symbols.zip"
if (is_android) {
output = "$brave_dist_dir/$brave_product_name-v$brave_version-$brave_platform-$target_android_base-$target_cpu-symbols.zip"
} else {
output = "$brave_dist_dir/$brave_product_name-v$brave_version-$brave_platform-$target_arch-symbols.zip"
}

script = "//brave/script/create-dist.py"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,12 @@
import org.chromium.base.Log;
import org.chromium.chrome.R;
import org.chromium.chrome.browser.BraveConfig;
import org.chromium.chrome.browser.metrics.UmaSessionStats;
import org.chromium.chrome.browser.preferences.BravePref;
import org.chromium.chrome.browser.preferences.BravePrefServiceBridge;
import org.chromium.chrome.browser.preferences.Pref;
import org.chromium.chrome.browser.preferences.website.BraveShieldsContentSettings;
import org.chromium.chrome.browser.privacy.settings.PrivacyPreferencesManagerImpl;
import org.chromium.chrome.browser.privacy.settings.PrivacySettings;
import org.chromium.chrome.browser.profiles.Profile;
import org.chromium.chrome.browser.settings.BraveDialogPreference;
Expand Down Expand Up @@ -63,6 +65,7 @@ public class BravePrivacySettings extends PrivacySettings {
private static final String PREF_CLOSE_TABS_ON_EXIT = "close_tabs_on_exit";
private static final String PREF_HTTPS_EVERYWHERE = "https_everywhere";
private static final String PREF_SEND_P3A = "send_p3a_analytics";
private static final String PREF_SEND_CRASH_REPORTS = "send_crash_reports";
private static final String PREF_BRAVE_STATS_USAGE_PING = "brave_stats_usage_ping";
private static final String PREF_SEARCH_SUGGESTIONS = "search_suggestions";
private static final String PREF_AUTOCOMPLETE_TOP_SITES = "autocomplete_top_sites";
Expand Down Expand Up @@ -92,15 +95,17 @@ public class BravePrivacySettings extends PrivacySettings {
PREF_OTHER_PRIVACY_SETTINGS_SECTION, // other section
PREF_WEBRTC_POLICY, PREF_SAFE_BROWSING, PREF_CAN_MAKE_PAYMENT, PREF_UNSTOPPABLE_DOMAINS,
PREF_ETH_NAMED_SERVICE, PREF_IPFS_GATEWAY, PREF_SECURE_DNS, PREF_DO_NOT_TRACK,
PREF_CLOSE_TABS_ON_EXIT, PREF_SEND_P3A, PREF_BRAVE_STATS_USAGE_PING,
PREF_SEARCH_SUGGESTIONS, PREF_AUTOCOMPLETE_TOP_SITES,
PREF_CLOSE_TABS_ON_EXIT, PREF_SEND_P3A, PREF_SEND_CRASH_REPORTS,
PREF_BRAVE_STATS_USAGE_PING, PREF_SEARCH_SUGGESTIONS, PREF_AUTOCOMPLETE_TOP_SITES,
PREF_AUTOCOMPLETE_BRAVE_SUGGESTED_SITES, PREF_USAGE_STATS, PREF_PRIVACY_SANDBOX};

private final int STRICT = 0;
private final int STANDARD = 1;
private final int ALLOW = 2;

private final PrefService mPrefServiceBridge = UserPrefs.get(Profile.getLastUsedRegularProfile());
private final PrivacyPreferencesManagerImpl mPrivacyPrefManager =
PrivacyPreferencesManagerImpl.getInstance();
private final ChromeManagedPreferenceDelegate mManagedPreferenceDelegate =
createManagedPreferenceDelegate();
private ChromeSwitchPreference mSearchSuggestions;
Expand All @@ -114,6 +119,7 @@ public class BravePrivacySettings extends PrivacySettings {
private ChromeSwitchPreference mBlockScriptsPref;
private ChromeSwitchPreference mCloseTabsOnExitPref;
private ChromeSwitchPreference mSendP3A;
private ChromeSwitchPreference mSendCrashReports;
private ChromeSwitchPreference mBraveStatsUsagePing;
private ChromeSwitchPreference mIpfsGatewayPref;
private PreferenceCategory mSocialBlockingCategory;
Expand Down Expand Up @@ -170,6 +176,8 @@ public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
mSendP3A = (ChromeSwitchPreference) findPreference(PREF_SEND_P3A);
mSendP3A.setOnPreferenceChangeListener(this);

mSendCrashReports = (ChromeSwitchPreference) findPreference(PREF_SEND_CRASH_REPORTS);
mSendCrashReports.setOnPreferenceChangeListener(this);
mBraveStatsUsagePing = (ChromeSwitchPreference) findPreference(PREF_BRAVE_STATS_USAGE_PING);
mBraveStatsUsagePing.setOnPreferenceChangeListener(this);

Expand Down Expand Up @@ -286,6 +294,8 @@ public boolean onPreferenceChange(Preference preference, Object newValue) {
sharedPreferencesEditor.putBoolean(PREF_CLOSE_TABS_ON_EXIT, (boolean) newValue);
} else if (PREF_SEND_P3A.equals(key)) {
BravePrefServiceBridge.getInstance().setP3AEnabled((boolean) newValue);
} else if (PREF_SEND_CRASH_REPORTS.equals(key)) {
UmaSessionStats.changeMetricsReportingConsent((boolean) newValue);
} else if (PREF_BRAVE_STATS_USAGE_PING.equals(key)) {
BravePrefServiceBridge.getInstance().setStatsReportingEnabled((boolean) newValue);
} else if (PREF_SEARCH_SUGGESTIONS.equals(key)) {
Expand Down Expand Up @@ -421,6 +431,8 @@ private void updatePreferences() {
getPreferenceScreen().removePreference(mSendP3A);
}

mSendCrashReports.setChecked(mPrivacyPrefManager.isUsageAndCrashReportingPermittedByUser());

mBraveStatsUsagePing.setChecked(
BravePrefServiceBridge.getInstance().getStatsReportingEnabled());

Expand Down
7 changes: 6 additions & 1 deletion android/java/res/xml/brave_privacy_preferences.xml
Original file line number Diff line number Diff line change
Expand Up @@ -132,11 +132,16 @@
android:title="@string/send_p3a_analytics_title"
android:summary="@string/send_p3a_analytics_summary"
android:defaultValue="false" />
<org.chromium.components.browser_ui.settings.ChromeSwitchPreference
android:key="send_crash_reports"
android:order="25"
android:title="@string/send_crash_reports_title"
android:summary="@string/send_crash_reports_summary"
android:defaultValue="false" />
<org.chromium.components.browser_ui.settings.ChromeSwitchPreference
android:key="brave_stats_usage_ping"
android:order="25"
android:title="@string/brave_stats_usage_ping_title"
android:summary="@string/brave_stats_usage_ping_summary"
android:defaultValue="true" />

</PreferenceScreen>
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public class BravePrivacySettingsTest {

// Ignore "usage_stats_reporting" and "privacy_sandbox"
private static int PRIVACY_SETTINGS_NUMBER_OF_ITEMS = 7;
private static int BRAVE_PRIVACY_SETTINGS_NUMBER_OF_ITEMS = 19;
private static int BRAVE_PRIVACY_SETTINGS_NUMBER_OF_ITEMS = 20;

@Rule
public ChromeTabbedActivityTestRule mActivityTestRule = new ChromeTabbedActivityTestRule();
Expand Down
30 changes: 29 additions & 1 deletion app/android/BUILD.gn
Original file line number Diff line number Diff line change
@@ -1,12 +1,40 @@
import("//brave/build/config.gni")
import("//build/config/python.gni")

python2_action("generate_breakpad_symbols") {
symbols_dir = "$brave_dist_dir/$brave_product_name.breakpad.syms"
outputs = [ symbols_dir ]

package_path = rebase_path(brave_android_output)

script = "//brave/tools/android/generate_breakpad_symbols.py"
args = [
"--symbols-dir=" + rebase_path(symbols_dir),
"--jobs=16",
"--build-dir=" + rebase_path(root_out_dir),
"--package-path=" + package_path,
"--src-root=" + rebase_path("//"),
"--clear",
"--verbose",
]

deps = [
"//brave/build/android:brave",
"//third_party/breakpad:dump_syms",
]
}

group("symbol_dist_resources") {
public_deps = [
":create_symbol_archive",
":generate_breakpad_symbols",
]
}

group("dist_resources") {
}

group("create_dist_zips") {
deps = [ ":create_symbol_archive" ]
}

action("create_symbol_archive") {
Expand Down
10 changes: 8 additions & 2 deletions browser/ui/android/strings/android_brave_strings.grd
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,13 @@ This file contains all "about" strings. It is set to NOT be translated, in tran
Allow privacy-preserving product analytics (P3A)
</message>
<message name="IDS_SEND_P3A_ANALYTICS_SUMMARY" desc="Summary for checkbox of send p3a analytics.">
This completely anonymised info helps Brave estimate the overall usage of certain features and make it better for you.
Anonymized P3A info helps Brave estimate overall usage, and ensure we’re improving popular features.
</message>
<message name="IDS_SEND_CRASH_REPORTS_TITLE" desc="Title for checkbox of send crash reports automatically.">
Automatically send crash reports
</message>
<message name="IDS_SEND_CRASH_REPORTS_SUMMARY" desc="Summary for checkbox of send crash reports automatically.">
Crash reports help Brave improve product stability for all users.
</message>
<message name="IDS_BRAVE_STATS_TEXT_DATA_SAVED" desc="Title for the data saved stats">
Est. Data\nSaved
Expand Down Expand Up @@ -1598,7 +1604,7 @@ until they verify, or until 90 days have passed.
Brave protects your privacy and\nappreciates your consent to the following:
</message>
<message name="IDS_P3A_ONBOARDING_CHECKBOX_TEXT" desc="P3a onboarding checkbox text">
Help improve Brave by sending crash reports and completely anonymized, <ph name="PRIVATE_PRODUCT_ANALYSIS">%1$s</ph>
Help improve Brave by sending completely anonymized <ph name="PRIVATE_PRODUCT_ANALYSIS">%1$s</ph>
</message>
<message name="IDS_PRIVATE_PRODUCT_ANALYSIS_TEXT" desc="private product analysis text">
private product analytics.
Expand Down
2 changes: 1 addition & 1 deletion build/android/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ action("sign_app") {
_jarsigner = "//third_party/jdk/current/bin/jarsigner"
_zipalign = "$android_sdk_build_tools/zipalign"

deps = [ "//brave/app/android:create_dist_zips" ]
deps = [ "//brave:create_symbols_dist" ]

if (target_cpu == "arm64" || target_cpu == "x64") {
if (target_android_output_format == "aab") {
Expand Down
2 changes: 2 additions & 0 deletions build/config.gni
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,8 @@ if (is_win) {
brave_platform = "win32"
} else if (is_linux) {
brave_platform = "linux"
} else if (is_android) {
brave_platform = "android"
}

is_release_channel = brave_channel == ""
Expand Down
Loading