Skip to content

[ads] Survey panelist: Android #29360

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

Merged
merged 1 commit into from
Jun 4, 2025
Merged

[ads] Survey panelist: Android #29360

merged 1 commit into from
Jun 4, 2025

Conversation

aseren
Copy link
Collaborator

@aseren aseren commented Jun 3, 2025

The PR adds Allow Brave surveys setting in Android settings:

image

Resolves brave/brave-browser#45992

Test case 1

  • Start browser with BraveNTPBrandedWallpaperSurveyPanelist feature disabled
  • Open Privacy and security settings
    EXPECTATION: Allow Brave surveys setting is not available

Test case 2

  • Start browser with BraveNTPBrandedWallpaperSurveyPanelist feature enabled
  • Open Privacy and security settings
    EXPECTATION: Allow Brave surveys setting is disabled by default
  • Click to Learn more about Brave surveys link
    EXPECTATION: Brave surveys help page is opened

@aseren aseren requested review from a team as code owners June 3, 2025 00:12
@aseren aseren requested review from tmancey and iambrianfung June 3, 2025 00:13
@aseren aseren marked this pull request as draft June 3, 2025 00:17
@brave-builds
Copy link
Collaborator

Warning

You have got a presubmit warning. Please address it if possible.

Found 1 lines longer than 80 characters (first 5 shown).

Items:

android/java/res/xml/brave_privacy_preferences.xml, line 192, 88 chars

@brave-builds
Copy link
Collaborator

Warning

You have got a presubmit warning. Please address it if possible.

-------------------------
[Warning] chromium_src:
  Ignoring symbol BRAVE_AI_CHAT_FLAGS:
  Symbol is used internally in chromium_src/chrome/browser/flags/android/chrome_feature_list.cc
  Symbol is NOT found in /home/ubuntu/workspace/ore-build-pr-noplatform_PR-29360/src/chrome/browser/flags/android/chrome_feature_list.cc.

@brave-builds
Copy link
Collaborator

Warning

You have got a presubmit warning. Please address it if possible.

-------------------------
[Warning] chromium_src:
  Ignoring symbol BRAVE_WEB_DISCOVERY_FLAG:
  Symbol is used internally in chromium_src/chrome/browser/flags/android/chrome_feature_list.cc
  Symbol is NOT found in /home/ubuntu/workspace/ore-build-pr-noplatform_PR-29360/src/chrome/browser/flags/android/chrome_feature_list.cc.

1 similar comment
@brave-builds
Copy link
Collaborator

Warning

You have got a presubmit warning. Please address it if possible.

-------------------------
[Warning] chromium_src:
  Ignoring symbol BRAVE_WEB_DISCOVERY_FLAG:
  Symbol is used internally in chromium_src/chrome/browser/flags/android/chrome_feature_list.cc
  Symbol is NOT found in /home/ubuntu/workspace/ore-build-pr-noplatform_PR-29360/src/chrome/browser/flags/android/chrome_feature_list.cc.

@aseren aseren marked this pull request as ready for review June 3, 2025 01:27
@@ -39,4 +39,5 @@ public abstract class BraveFeatureList {
public static final String BRAVE_SHIELDS_ELEMENT_PICKER = "BraveShieldsElementPicker";
public static final String BRAVE_WEB_DISCOVERY_NATIVE = "BraveWebDiscoveryNative";
public static final String BRAVE_INCOGNITO_SCREENSHOT = "incognito-screenshot";
public static final String BRAVE_SURVEY_PANELIST = "BraveNTPBrandedWallpaperSurveyPanelist";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Match string to variable name

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

@@ -174,6 +180,7 @@ public class BravePrivacySettings extends PrivacySettings {
PREF_SEND_P3A,
PREF_SEND_CRASH_REPORTS,
PREF_BRAVE_STATS_USAGE_PING,
PREF_BRAVE_SURVEY_PANELIST,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Do we need brave in the name?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not needed, removed.

@@ -104,6 +107,9 @@ public class BravePrivacySettings extends PrivacySettings {
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_BRAVE_SURVEY_PANELIST = "brave_survey_panelist";
private static final String PREF_BRAVE_SURVEY_PANELIST_LEARN_MORE =
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Do we need brave in the name?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not needed, removed.

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"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Were these intentionally removed?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes these wee intentionally removed, as they broke order of new preference items.
Also android:order attributes did nothing here before because they all had the same value.

@@ -774,6 +774,15 @@ This file contains all "about" strings. It is set to NOT be translated, in tran
<message name="IDS_BRAVE_STATS_TEXT_TIME" desc="Title for the estimated saved time">
Est. Time\nSaved
</message>
<message name="IDS_BRAVE_SURVEY_PANELIST_TITLE" desc="Title for enable/disable brave survey panelist toggle.">
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need brave in the name? Same for below

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not needed, removed.

@@ -592,6 +623,11 @@ public boolean onPreferenceChange(Preference preference, Object newValue) {
(boolean) newValue, ChangeMetricsReportingStateCalledFrom.UI_SETTINGS);
} else if (PREF_BRAVE_STATS_USAGE_PING.equals(key)) {
BraveLocalState.get().setBoolean(BravePref.STATS_REPORTING_ENABLED, (boolean) newValue);
} else if (PREF_BRAVE_SURVEY_PANELIST.equals(key)) {
UserPrefs.get(ProfileManager.getLastUsedRegularProfile())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use getProfile(). We are going to refactor other places inside BravePrivacySettings later.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

@@ -784,6 +820,10 @@ private void updateBravePreferences() {
mBraveStatsUsagePing.setChecked(
BraveLocalState.get().getBoolean(BravePref.STATS_REPORTING_ENABLED));

mBraveSurveyPanelist.setChecked(
UserPrefs.get(ProfileManager.getLastUsedRegularProfile())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getProfile()

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

Copy link
Member

@SergeyZhukovsky SergeyZhukovsky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

++

@aseren aseren requested a review from tmancey June 3, 2025 16:59
Copy link
Collaborator

@mkarolin mkarolin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

chromium_src, DEPS, strings++

@aseren aseren merged commit 5652fe9 into master Jun 4, 2025
18 checks passed
@aseren aseren deleted the issues/45992 branch June 4, 2025 14:04
@github-actions github-actions bot added this to the 1.81.x - Nightly milestone Jun 4, 2025
@brave-builds
Copy link
Collaborator

Released in v1.81.47

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[ads] Survey panelists: Android
5 participants