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

Custom ad notifications are not shown when system notifications are disabled #18351

Closed
btlechowski opened this issue Sep 24, 2021 · 6 comments · Fixed by brave/brave-core#10252

Comments

@btlechowski
Copy link

We should fall back to custom ad notifications when system notifications are disabled

Follow up to: brave/brave-variations#120

Should show custom ad notifications:
- For all Windows versions If native notifications are disabled (should not be shown if Focus Assist is enabled)

Steps to Reproduce

  1. Disable native(system) notifications
  2. Run Brave with --enable-logging=stderr --vmodule="*/variations/*"=6,"*/bat-native-ledger/*"=6,"*/brave_rewards/*"=6,"*/bat-native-ads/*"=6,"*/bat-native-confirmations/*"=6,"*/brave_ads/*"=9,"*/brave_user_model/*"=6 --brave-ads-staging --brave-ads-debug --rewards=staging=true --variations-server-url=https://variations.bravesoftware.com/seed
  3. Restart Brave
  4. Make sure variations are downloaded in brave://version
  5. Enable rewards and ads
  6. Trigger an ad

Actual result:

Notification is not shown at all

Expected result:

Custom notification is shown

Reproduces how often:

Easily reproduced

Brave version (brave://version info)

Brave 1.30.84 Chromium: 94.0.4606.54 (Official Build) (64-bit)
Revision c8191a1d5cccbf64e8fe7269043f8ace8d74dd05-refs/branch-heads/4606@{#1130}
OS Windows 10 Version 20H2 (Build 19042.1237)

cc @brave/legacy_qa @rebron @tmancey @jsecretan

@btlechowski
Copy link
Author

btlechowski commented Sep 27, 2021

Needs to be verified along with brave/brave-variations#128

Verification should include all test cases from brave/brave-variations#120

@srirambv
Copy link
Contributor

Issue repro'd on Android as well. Using command line args for variations ad notifications are not shown. Logs shows

2021-09-28 08:06:19.021 31780-31780/? V/chromium: [VERBOSE2:permission_rule_util.cc(23)] Notifications not allowed
2021-09-28 08:06:19.021 31780-31780/? V/chromium: [VERBOSE1:ad_notification_serving.cc(104)] Ad notification not served: Not allowed due to permission rules
2021-09-28 08:06:19.025 31780-31780/? V/chromium: [VERBOSE1:ad_notification_serving.cc(187)] Maybe serve ad notification in 0 hours, 2 minutes, 0 seconds at 5:38 PM
2021-09-28 08:08:19.030 31780-31780/? V/chromium: [VERBOSE2:permission_rule_util.cc(23)] Notifications not allowed
2021-09-28 08:08:19.031 31780-31780/? V/chromium: [VERBOSE1:ad_notification_serving.cc(104)] Ad notification not served: Not allowed due to permission rules
2021-09-28 08:08:19.035 31780-31780/? V/chromium: [VERBOSE1:ad_notification_serving.cc(187)] Maybe serve ad notification in 0 hours, 2 minutes, 0 seconds at 5:40 PM
2021-09-28 08:10:19.041 31780-31780/? V/chromium: [VERBOSE2:permission_rule_util.cc(23)] Notifications not allowed
2021-09-28 08:10:19.041 31780-31780/? V/chromium: [VERBOSE1:ad_notification_serving.cc(104)] Ad notification not served: Not allowed due to permission rules
2021-09-28 08:10:19.046 31780-31780/? V/chromium: [VERBOSE1:ad_notification_serving.cc(187)] Maybe serve ad notification in 0 hours, 2 minutes, 0 seconds at 5:42 PM

@srirambv srirambv added the OS/Android Fixes related to Android browser functionality label Sep 28, 2021
@tmancey
Copy link
Contributor

tmancey commented Oct 1, 2021

We only move thecan_fallback_to_custom_notifications parameter from the CustomAdNotifications feature to the AdNotifications feature. I would recommend that we only need to test the can_fallback_to_custom_notifications parameter. There are no business logic changes

@GeetaSarvadnya
Copy link

GeetaSarvadnya commented Oct 11, 2021

Verification passed on

Brave | 1.30.89 Chromium: 94.0.4606.81 (Official Build) (64-bit)
-- | --
Revision | 5a03c5f1033171d5ee1671d219a59e29cf75e054-refs/branch-heads/4606@{#1320}
OS | Windows 10 Version 21H1 (Build 19043.1266)

Case 1: Should show custom ad notifications
  • Confirmed Custom ad notifications are shown when variations seed is downloaded and System notifications are set to OFF
System notifications OFF Variations seed downloaded Custom ad notification shown
image image image
Case 2: Should show native ad notifications
  • Confirmed Default ad notifications are shown even when variations seed is downloaded and System notifications are set to ON
System notifications ON Variations seed downloaded Default ad notification shown
image image image
Case 3: Show custom ads when custom ads enabled via brave://flags and System notifications are ON
  • System notifications are ON
  • Lauch brave using brave.exe --enable-logging=stderr --vmodule="*/bat-native-ledger/*"=6,"*/brave_rewards/*"=6,"*/bat-native-ads/*"=6,"*/bat-native-confirmations/*"=6,"*/brave_ads/*"=6 --brave-ads-staging --rewards=staging=true
  • Enable rewards and ads
  • Enable custom ads via brave://flags ( enable Enable Brave Ads custom notifications switch)
  • Confirmed Custom ad notifications are shown when custom ads are enabled via brave://flags and system notifications are enabled
System notifications ON Custom ad notification shown
image image
Case 4: Show custom ads when custom ads enabled via brave://flags and System notifications are OFF
  • System notifications are OFF
  • Lauch brave using brave.exe --enable-logging=stderr --vmodule="*/bat-native-ledger/*"=6,"*/brave_rewards/*"=6,"*/bat-native-ads/*"=6,"*/bat-native-confirmations/*"=6,"*/brave_ads/*"=6 --brave-ads-staging --rewards=staging=true
  • Enable rewards and ads
  • Enable custom ads via brave://flags ( enable Enable Brave Ads custom notifications switch)
  • Confirmed Custom ad notifications are shown when custom ads are enabled via brave://flags and system notifications are disabled
System notifications OFF Custom ad notification shown
image image

Verification passed on

Brave 1.30.89 Chromium: 94.0.4606.81 (Official Build) (64-bit)
Revision 5a03c5f1033171d5ee1671d219a59e29cf75e054-refs/branch-heads/4606@{#1320}
OS Ubuntu 18.04 LTS

Verified BraveAds.ShowCustomAdNotificationOnLinuxStudy:Enabled is enabled and that custom ads are shown after applying seed.

image


Verification PASSED on macOS 10.15.7 x64 using the following build:

Brave | 1.30.89 Chromium: 94.0.4606.81 (Official Build) (x86_64)
-- | --
Revision | 5a03c5f1033171d5ee1671d219a59e29cf75e054-refs/branch-heads/4606@{#1320}
OS | macOS Version 10.15.7 (Build 19H1417)

Confirmed with @btlechowski that STR from description are applicable to Windows only.

Verified macOS cases from brave/brave-variations#120 (comment).

Default settings (native notifications enabled) - PASSED
  • launched Brave using --enable-logging=stderr --vmodule="*/variations/*"=6,"*/bat-native-ledger/*"=6,"*/brave_rewards/*"=6,"*/bat-native-ads/*"=6,"*/bat-native-confirmations/*"=6,"*/brave_ads/*"=9,"*/brave_user_model/*"=6 --brave-ads-staging --brave-ads-debug --rewards=staging=true --variations-server-url=https://variations.bravesoftware.com/seed
  • restarted the browser so the new variations are pulled
  • enabled rewards and ensured that native notifications were being triggered/used

Ensured the following is being displayed in the terminal and BraveAds.ShowCustomAdNotificationOnMacStudy is not being enabled.

[37384:775:1011/095554.702146:VERBOSE1:features.cc(45)] Study BraveAds.FrequencyCappingStudy is active (ExcludeAdIfWithinTimeWindow=0h)
[37384:775:1011/095554.702198:VERBOSE1:features.cc(45)] Study BraveAds.UserActivityStudy is active (Triggers=EMPTY/Threshold=0.0/IdleTimeThreshold=5)
Example Example
Default1 Default2
Native notifications disabled - PASSED
  • launched Brave using --enable-logging=stderr --vmodule="*/variations/*"=6,"*/bat-native-ledger/*"=6,"*/brave_rewards/*"=6,"*/bat-native-ads/*"=6,"*/bat-native-confirmations/*"=6,"*/brave_ads/*"=9,"*/brave_user_model/*"=6 --brave-ads-staging --brave-ads-debug --rewards=staging=true --variations-server-url=https://variations.bravesoftware.com/seed
  • disabled System Notifications via brave://flags/#enable-system-notifications
  • restarted the browser so the new variations are pulled
  • enabled rewards and ensured that custom ad notifications were being triggered/used
Example Example
Screen Shot 2021-10-11 at 10 36 47 AM Screen Shot 2021-10-11 at 10 37 23 AM

@srirambv
Copy link
Contributor

srirambv commented Oct 11, 2021

Verification passed on Oppo Reno 5 with Android 11 running 1.30.89 x64 build

  • Verified when system native notifications are disabled and variations seed enabled, custom ads notification is shown based on AdNotificationsAndroidStudy study being enabled
  • Verified when system native notifications are enabled and variations seed enabled, native ad notifications are shown

Verification passed on Samsung Tab A with Android 10 running 1.30.89 x64 build

  • Verified when system native notifications are disabled and variations seed enabled, custom ads notification is shown based on AdNotificationsAndroidStudy study being enabled
  • Verified when system native notifications are enabled and variations seed enabled, native ad notifications are shown

@GeetaSarvadnya
Copy link

GeetaSarvadnya commented Oct 12, 2021

Verification passed on Gionee s5 with Android 5.1 running Bravearm 1.30.89.apk build

1. Verified when system native notifications are disabled and variations seed enabled, custom ads notification is shown based on BraveAds.ShowCustomAdsNotificationOnAndroidStudy: Enabled being enabled

Steps followed:

  1. Run the cmd mentioned in the screenshot below
    image
  2. Install bravearm.apk on Android 5
  3. Disable native app notifications in Android 5 (navigate to Android 5>Advanced settings>Apps>Brave, uncheck Receive app notifications checkbox)
  4. Check brave://version and ensured enable custom ad notification seed isn't downloaded
  5. Restart browser, check brave://version and ensured BraveAds.ShowCustomAdsNotificationOnAndroidStudy: Enabled seed is downloaded
  6. Enable rewards and ads
  7. Custom ads are served
Native app notification disabled Custom ad study enabled Custom ad notifications shown
image image image

2. Verified when system native notifications are enabled, native ad notifications are shown

Steps followed:

  1. Run the cmd mentioned in the screenshot below [Note: make sure to run adb.exe shell "rm /data/local/tmp/brave-test-variations-server-url" otherwise it will pull the variation seed from the server and you will get always custom ads even though native app notifications are enabled]
    image
  2. Install bravearm.apk on Android 5
  3. Make sure native app notifications are enabled in Android 5
  4. Check brave://version and ensured enable custom ad notification seed isn't downloaded
  5. Restart the browser, check brave://version and ensure enable custom ad notification seed isn't downloaded
  6. Enable rewards and ads
  7. Default ads are served
Native app notification enabled Custom ad study NOT enabled Default ad notifications shown
image image image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment