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

Adapt Android for sync v2 #5361

Merged
merged 23 commits into from
Jun 29, 2020
Merged

Adapt Android for sync v2 #5361

merged 23 commits into from
Jun 29, 2020

Conversation

AlexeyBarabash
Copy link
Contributor

@AlexeyBarabash AlexeyBarabash commented Apr 24, 2020

Resolves brave/brave-browser#10203

In this PR:

  • removed sync v1 stuff, apk size must decrease significantly;
  • migration cleaned v1 shared prefs, leveldb and marked prefs that migration happened;
  • new methods to glue existing sync v1 UI and Brave sync v2 native code.

Issues required to be resolved to complete the task, but will be made as a separate PRs:

Submitter Checklist:

Test Plan:

I. Migrating from sync v1

You will need the rooted device to verify fully all prefs are set after migration, otherwise it is possible to verify till pt 7 and not pt8

  1. Install development apk with sync v1
  2. Enable sync and connect to chain
  3. Ensure there is 2 or more devices in chain
  4. Close browser
  5. Install development apk with sync v2
  6. Launch browser
  7. Ensure sync is turned off
  8. This steps is possible on rooted device only.
    With file explorer on rooted device check these files:
    • shared_prefs at /data/data/com.brave.browser_default/shared_prefs/SyncPreferences.xml contain only <string name="Seed"> element
    • default preferences at /data/data/com.brave.browser_default/app_chrome/Default/Preferences contain entry "brave_sync_v2":{"v1_meta_info_cleared":true,"v1_migrated":true}

II. Create sync chain on Android and connect desktop

  1. Install apk with sync v2 on phone
  2. On the phone go to the settings => Sync => give camera permissions => Start a new chain => Add a Computer => Copy to clipboard => Done
  3. Connect desktop to the chain with copied codewords
  4. Ensure there are two devices in the list of devices both on desktop and phone
  5. Bookmark some site on mobile, ensure it appeared on desktop; bookmark some site on desktop, ensure it appeared on mobile.

III. Create sync chain on Desktop and connect Android

  1. Create sync chain on desktop
  2. Copy code words
  3. On mobile: settings => Sync => (give camera permissions) => Scan or enter sync code => Enter code words => paste => confirm
  4. Ensure there are two devices in the list of devices both on desktop and phone
  5. Bookmark some site on mobile, ensure it appeared on desktop; bookmark some site on desktop, ensure it appeared on mobile.

IV. Connect to the chain through QR code

  1. Install apk with sync v2 on Device1 and Device2
  2. On the Device1 go to the settings => Sync => (give camera permissions) => Start a new chain => Add a Mobile Device - expected to see QR
  3. On the Device2 go to the settings => Sync => (give camera permissions) => Scan or enter sync code => scan the qr code
  4. Ensure there are two devices in the list of devices both on Device1 and Device2
  5. Bookmark some site on Device1, ensure it appeared on Device2; and check the opposite.

V. Leave and re-connect to the chain

  1. Go through (IV)
  2. On Device1 press settings => Sync => Remove this device
  3. On the Device2 go to the settings => Sync => Add another device => Add a mobile device
  4. On the Device1 go to the settings => Sync => (give camera permissions) => Scan or enter sync code => scan the qr code
  5. Ensure there are three devices (for now) two (device now send self-delete record when leaving the chain) in the list of devices both on Device1 and Device2

// ^ This test (V) in half of cases fails with info in chrome://sync-internals GenerateCryptoErrorsForTypes and encryption state Passphrase Required true. This is blocker. Investigating.
This is fixed

VI. Sync types

Setup sync chain between desktop and mobile.
Switch sync everything and all other categories into position off on both devices.

A. Autofill
0. Ensure Autofill switch is turned off on both devices
1. On desktop go to https://www.computerhope.com/jargon/a/autofill.htm , write data to First Name field, press Submit and ensure Autofill works;
On mobile do the same, use Last name field
2. Wait 2 minutes, ensure Autofill was not synced by clicking on corresponding fields - First Name on desktop and Last name on mobile.
3. Switch Autofill into position on on both devices
4. Wait 2 minutes, ensure Autofill was synced by clicking on corresponding fields - it should display Autofill hint on both

B. Bookmarks
0. Ensure Bookmarks switch is turned off on both devices
1. Create bookmarks on mobile and desktop
2. Wait 2 minutes, ensure bookmarks are not synced
3. Switch Bookmarks into position on on both devices
4. Wait 2 minutes, ensure bookmarks are synced

C. History
0. Ensure History switch is turned off on both devices
1. Browse some different sites both on mobile and desktop
2. Wait 2 minutes, ensure history is not synced
3. Switch History into position on on both devices
4. Wait 2 minutes, update history page, ensure history is synced
// ^ Desktop got history entries from mobile, but mobile - didn't. Investigating. this is fixed, was related to situation when sync stopped work after app restart

D. Open tabs
0. Ensure Open tabs switch is turned off on both devices
1. Open several tabs on desktop
2. Right click on tab and choose menu option Send to Phone
3. Wait 2 minutes, ensure nothing happens
4. Switch Open tabs into position on on both devices
5. Right click on tab and choose menu option Send to Phone, ensure you see notification on phone and the tab is opened by click onthe notification

E. Passwords
0. Ensure Passwords switch is turned off on both devices
1. On mobile login to some website
2. Wait 2 minutes
3. Check the page brave://settings/passwords - should not be any passwords
4. Switch on Passwords option on both devices
5. Wait two minutes and password should be available on desktop

F. Settings
0. Install browser on phone1 and phone2
1. Ensure Settings switch is turned off on both devices
2. Go to Settings=>Privacy; ensure Preload pages for faster browsing and searching is turned off
3. On phone1 change that setting to on
4. Wait 2 minutes, re-enter Settings=>Privacy, ensure on phone2 this is still off
5. Switch on Settings on both phones
6. On phone1 switch Privacy => Preload pages ... to on
7. Wait 2 minutes,re-enter Settings=>Privacy and ensure Privacy => Preload pages ... is on on device2
// ^ Now this appears not working on Android. Investigating. settings category works between phone and phone

Reviewer Checklist:

  • New files have MPL-2.0 license header.
  • Request a security/privacy review as needed.
  • Adequate test coverage exists to prevent regressions
  • Verify test plan is specified in PR before merging to source

After-merge Checklist:

  • The associated issue milestone is set to the smallest version that the
    changes has landed on.
  • All relevant documentation has been updated.

@AlexeyBarabash AlexeyBarabash changed the title WIP - remove sync v1 Android staff WIP - Adapt Android for sync v2 Apr 24, 2020
@AlexeyBarabash AlexeyBarabash force-pushed the android-sync-v2 branch 2 times, most recently from 8977ebb to f64ec2a Compare June 3, 2020 15:15
@darkdh darkdh force-pushed the sync-v2 branch 2 times, most recently from e93b6cc to 0a9b7e6 Compare June 9, 2020 06:13
Base automatically changed from sync-v2 to master June 11, 2020 23:02
@AlexeyBarabash AlexeyBarabash self-assigned this Jun 14, 2020
@AlexeyBarabash AlexeyBarabash added CI/skip-ios Do not run CI builds for iOS CI/skip-linux CI/skip-macos-x64 Do not run CI builds for macOS x64 labels Jun 14, 2020
@AlexeyBarabash AlexeyBarabash force-pushed the android-sync-v2 branch 3 times, most recently from 351d4c9 to b863fa5 Compare June 22, 2020 13:06
@AlexeyBarabash
Copy link
Contributor Author

Related required brave-browser PR is brave/brave-browser#10203 .

@AlexeyBarabash
Copy link
Contributor Author

AlexeyBarabash commented Jun 22, 2020

Screenshots for review

Screenshot_20200623-010631

Screenshot_20200623-010714

Screenshot_20200623-010744

Screenshot_20200624-152328

Screenshot_20200623-010813

Screenshot_20200623-010934

Screenshot_20200623-010948

Screenshot_20200623-011006

Screenshot_20200623-010832

@AlexeyBarabash AlexeyBarabash removed the CI/skip Do not run CI builds (except noplatform) label Jun 29, 2020
@AlexeyBarabash
Copy link
Contributor Author

CI status is unstable

Android, iOS, Windows - succeeded

Linux - failed test-browser
(https://ci.brave.com/job/pr-brave-browser-android-sync-v2/11/execution/node/462/log/)

18:42:46  1 test failed:
18:42:46      RewardsBrowserTest.NotVerifiedWallet (../../brave/components/brave_rewards/browser/test/rewards_browsertest.cc:236)

macOS - failed test-install
(https://ci.brave.com/job/pr-brave-browser-android-sync-v2/11/execution/node/621/log/)

19:22:56  + killall 'Brave Browser Nightly'
19:22:56  No matching processes belonging to you were found

Adding skip-per-os labels, restarting CI.

@AlexeyBarabash AlexeyBarabash added CI/skip-android Do not run CI builds for Android CI/skip-ios Do not run CI builds for iOS CI/skip-windows labels Jun 29, 2020
@AlexeyBarabash
Copy link
Contributor Author

macOS succeeded

Linux failed again
(https://ci.brave.com/job/pr-brave-browser-android-sync-v2/12/execution/node/394/log/)

21:27:05  [614/614] RewardsDatabaseBrowserTest/SchemaCheck.PerVersion/Migration_16 (519 ms)
21:27:05  1 test failed:
21:27:05      RewardsBrowserTest.NotVerifiedWallet (../../brave/components/brave_rewards/browser/test/rewards_browsertest.cc:236)
21:27:05  1 test crashed:
21:27:05      RewardsPublisherBrowserTest.VisitUnverifiedPublisher (../../brave/components/brave_rewards/browser/test/rewards_publisher_browsertest.cc:140)

Adding skip for macOS, restarting CI

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI/skip-android Do not run CI builds for Android CI/skip-ios Do not run CI builds for iOS CI/skip-macos-x64 Do not run CI builds for macOS x64 feature/sync
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Android] Implement changes to support sync v2 on Android
5 participants