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

Remove SafetyNet changes android #26719

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

deeppandya
Copy link
Contributor

@deeppandya deeppandya commented Nov 25, 2024

Resolves brave/brave-browser#42499

Submitter Checklist:

  • I confirm that no security/privacy review is needed and no other type of reviews are needed, or that I have requested them
  • There is a ticket for my issue
  • Used Github auto-closing keywords in the PR description above
  • Wrote a good PR/commit description
  • Squashed any review feedback or "fixup" commits before merge, so that history is a record of what happened in the repo, not your PR
  • Added appropriate labels (QA/Yes or QA/No; release-notes/include or release-notes/exclude; OS/...) to the associated issue
  • Checked the PR locally:
    • npm run test -- brave_browser_tests, npm run test -- brave_unit_tests wiki
    • npm run presubmit wiki, npm run gn_check, npm run tslint
  • Ran git rebase master (if needed)

Reviewer Checklist:

  • A security review is not needed, or a link to one is included in the PR description
  • New files have MPL-2.0 license header
  • Adequate test coverage exists to prevent regressions
  • Major classes, functions and non-trivial code blocks are well-commented
  • Changes in component dependencies are properly reflected in gn
  • Code follows the style guide
  • Test plan is specified in PR before merging

After-merge Checklist:

Test Plan:

@deeppandya deeppandya added this to the 1.75.x - Nightly milestone Nov 25, 2024
@deeppandya deeppandya force-pushed the remove_safetynet_changes_android branch from 1bbcf67 to af4cdc5 Compare November 25, 2024 02:50
@deeppandya deeppandya marked this pull request as ready for review November 25, 2024 16:40
@deeppandya deeppandya requested review from simonhong and a team as code owners November 25, 2024 16:40
@samartnik
Copy link
Contributor

What about removing safetynet_check.cc/h files? Do we still need them?

@deeppandya
Copy link
Contributor Author

What about removing safetynet_check.cc/h files? Do we still need them?

Sorry i meant to delete the whole directory. updating now.

@deeppandya deeppandya force-pushed the remove_safetynet_changes_android branch from af4cdc5 to 3d1f26b Compare November 25, 2024 20:35
Copy link
Contributor

@samartnik samartnik left a comment

Choose a reason for hiding this comment

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

lgtm

@@ -618,7 +591,6 @@ void RegisterPrefsForBraveReferralsService(PrefRegistrySimple* registry) {
registry->RegisterIntegerPref(kReferralAttemptCount, 0);
#if BUILDFLAG(IS_ANDROID)
registry->RegisterTimePref(kReferralAndroidFirstRunTimestamp, base::Time());
registry->RegisterStringPref(kSafetynetStatus, std::string());
Copy link
Member

Choose a reason for hiding this comment

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

whenever deprecates prefs, we need to clear its existing value from preferences.
You can refer kNewTabPageShowGemini how it's cleared after its usage is deleted.

@deeppandya deeppandya force-pushed the remove_safetynet_changes_android branch 2 times, most recently from 1cfdefa to cec20e0 Compare November 27, 2024 21:29
@deeppandya deeppandya requested a review from a team as a code owner November 27, 2024 21:29
@deeppandya deeppandya force-pushed the remove_safetynet_changes_android branch from cec20e0 to d039b5d Compare November 27, 2024 21:31
Copy link
Contributor

@AlexeyBarabash AlexeyBarabash left a comment

Choose a reason for hiding this comment

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

++

&& braveRewardsNativeWorker.isSupported()
&& BravePrefServiceBridge.getInstance()
.getSafetynetCheckFailed()) {
&& braveRewardsNativeWorker.isSupported()) {
Copy link
Member

Choose a reason for hiding this comment

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

I don't think we need BraveUpgradeJobIntentServiceImpl class at all. The whole it's purpose was to re-perform the SafetyNet check

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@SergeyZhukovsky we are still checking for braveRewardsNativeWorker.isSupported() to decide if we need to show the rewrads icon. i.e. it would be useful for not showing rewards icon for OFAC countries.

Copy link
Member

Choose a reason for hiding this comment

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

Do we need to do that on every upgrade?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We can remove the change on upgrade as we are already checking for rewards icon here :

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i am going to remove in a follow up commit.

@deeppandya deeppandya force-pushed the remove_safetynet_changes_android branch from 4c8295d to d0de924 Compare November 28, 2024 21:35
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.

++

Copy link
Contributor

github-actions bot commented Dec 2, 2024

Chromium major version is behind target branch (131.0.6778.85 vs 132.0.6834.15). Please rebase.

@github-actions github-actions bot added the chromium-version-mismatch The Chromium version on the PR branch does not match the version on the target branch label Dec 2, 2024
Copy link
Collaborator

@zenparsing zenparsing left a comment

Choose a reason for hiding this comment

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

Rewards 👍

@deeppandya deeppandya force-pushed the remove_safetynet_changes_android branch from d0de924 to f89dae0 Compare December 2, 2024 22:37
@github-actions github-actions bot removed the chromium-version-mismatch The Chromium version on the PR branch does not match the version on the target branch label Dec 2, 2024
Copy link
Contributor

github-actions bot commented Dec 2, 2024

[puLL-Merge] - brave/brave-core@26719

Here's my review of the pull request:

Description

This PR removes SafetyNet checks from the Brave Android app. It eliminates the SafetyNet-related code, including the safetynet component, and removes references to SafetyNet checks throughout the codebase. This change simplifies the app by removing a dependency on Google Play Services for device attestation.

Changes

Changes

  1. android/brave_java_sources.gni:

    • Removed import for safetynet java sources
    • Removed brave_rewards_java_sources from brave_java_sources
  2. android/java/AndroidManifest.xml:

    • Removed service declaration for BraveUpgradeJobIntentService
  3. android/java/org/chromium/chrome/browser/app/BraveActivity.java:

    • Removed check for SafetyNet failure in maybeSolveAdaptiveCaptcha method
  4. android/java/org/chromium/chrome/browser/appmenu/BraveTabbedAppMenuPropertiesDelegate.java:

    • Removed SafetyNet check when preparing menu items
  5. android/java/org/chromium/chrome/browser/ntp_background_images/NTPBackgroundImagesBridge.java:

    • Removed SafetyNet check in enableSponsoredImages method
  6. android/java/org/chromium/chrome/browser/preferences/BravePrefServiceBridge.java:

    • Removed methods related to SafetyNet check
  7. android/java/org/chromium/chrome/browser/settings/BravePreferenceFragment.java:

    • Removed SafetyNet check when showing Brave Rewards debug preferences
  8. android/java/org/chromium/chrome/browser/settings/BraveRewardsPreferences.java:

    • Removed resetting of SafetyNet check failure flag
  9. android/java/org/chromium/chrome/browser/settings/developer/BraveQAPreferences.java:

    • Removed resetting of SafetyNet check failure flag
  10. android/java/org/chromium/chrome/browser/toolbar/top/BraveToolbarLayoutImpl.java:

    • Removed SafetyNet checks when updating Brave Rewards button visibility
  11. android/java/org/chromium/chrome/browser/upgrade/BravePackageReplacedBroadcastReceiver.java:

    • Removed call to BraveUpgradeJobIntentServiceImpl.maybePerformUpgradeTasks
  12. Removed files:

    • BraveUpgradeJobIntentService.java
    • BraveUpgradeJobIntentServiceImpl.java
  13. browser/android/preferences/brave_pref_service_bridge.cc:

    • Removed methods related to SafetyNet check
  14. browser/brave_profile_prefs.cc:

    • Added migration to clear SafetyNet-related preferences
  15. browser/ui/webui/brave_rewards/rewards_web_ui_utils.cc:

    • Removed SafetyNet check when blocking Rewards WebUI
  16. build/android/config.gni:

    • Removed SafetyNet-related Java source
  17. components/brave_referrals/browser/:

    • Removed SafetyNet-related code from BraveReferralsService
  18. components/brave_rewards/browser/:

    • Removed SafetyNet-related dependencies
  19. Removed entire safetynet component

This sequence diagram illustrates the high-level changes made by removing SafetyNet checks from the Brave Android app. The app removes SafetyNet-related preferences, eliminates SafetyNet checks in the Brave Rewards system, updates the UI to remove SafetyNet-related elements, and displays the updated interface without SafetyNet restrictions.```mermaid
sequenceDiagram
participant App as Brave Android App
participant Prefs as Preferences
participant Rewards as Brave Rewards
participant UI as User Interface
App->>Prefs: Remove SafetyNet-related preferences
App->>Rewards: Remove SafetyNet checks
Rewards-->>UI: Update UI without SafetyNet restrictions
App->>UI: Remove SafetyNet-related UI elements
UI-->>App: Display updated interface

</details>

<!-- Generated by claude-3-5-sonnet-20240620 -->

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

Successfully merging this pull request may close these issues.

[Android] Remove SafetyNet changes
8 participants