feat: prevent eDrive from syncing files with Murena cloud while Murena SSO migration is running
Description
This MR prevents eDrive from syncing files with Murena cloud while the migration to Murena SSO via Account Manager is running on user's device.
Screenshots
Technical details
When user clicks on the Account Manager notification to migrate to Murena SSO, eDrive receives a broadcast in SsoMigrationReceiver. For this, a signature-level permission is introduced to ensure interoperability between eDrive and Account Manager.
The job of the SsoMigrationReceiver is to update MurenaSsoMigrationPreference which tracks the status of the migration — InProgress and Completed. This preference is updated with values coming from Account Manager in the BroadcastReceiver's intent, using extras.getBoolean(AccountManager.KEY_USERDATA).
As part of the SSO migration, a user's account is removed and added again. However, to prevent eDrive from syncing files during the migration, an early return is implemented on AccountAddedReceiver and AccountRemoveCallBackReceiver classes, based on the preference's value so that eDrive doesn't reset its setting.
To keep consistent checking for account names, a string utility method is added to remove the domain name from an account name, i.e. test.email@example.com will be reduced to test.email.
Tests
- Log in using username and password in Account Manager bundled with the OS.
- Let os-bundled eDrive finish syncing files.
- Install debug eDrive from MR.
- Install debug Account Manager from MR.
- Reboot device.
- After rebooting, observe a notification from Account Manager prompting you to switch to an improved login system.
- Click on the notification and observe Account Manager opens with your previous credentials removed and prompting you to provide a user ID.
- Observe that you cannot dismiss the notification.
- Complete login from browser and return to Account Manager
- Observe that the notification now disappears.
- Observe that eDrive doesn't start syncing files.
- Observe eDrive's sync works while adding, modifying, or deleting files.
- Now, reboot again.
- Observe that the notification is not there.
- Go to Account Manager and log out.
- Add account and observe OpenID Connect based login is there.
- Complete login (similar to step 9).
- Observe that eDrive starts syncing all the files from your device.
For Murena accounts using custom Nextcloud instance:
- Complete up to step 5.
- After rebooting, observe that the notification doesn't appear.
Issues
https://gitlab.e.foundation/e/os/backlog/-/issues/2097