Implement support for out of band OTAs via file picker - #127
Conversation
|
I tested the file picker path on |
| <string name="install_from_file_summary">Manually choose an OTA update package to verify and install</string> | ||
| <string name="install_from_file_confirm_title">Confirm it\'s you</string> | ||
| <string name="install_from_file_confirm_description">Authenticate to install an update from a file</string> | ||
| <string name="install_from_file_no_credential">Set a device PIN, pattern or password to install updates from a file</string> |
There was a problem hiding this comment.
GrapheneOS doesn't support pattern
| } | ||
|
|
||
| // Manually install an OTA from a file chosen with the system file picker. This is gated behind | ||
| // a confirmation of the owner's device credential (PIN / password / pattern) so it cannot be |
There was a problem hiding this comment.
GrapheneOS doesn't support pattern
| @Override | ||
| protected void onActivityResult(int requestCode, int resultCode, Intent data) { | ||
| super.onActivityResult(requestCode, resultCode, data); |
There was a problem hiding this comment.
Subclass chain:
- Settings
- androidx.fragment.app.FragmentActivity
- androidx.activity.ComponentActivity
- android.app.Activity
onActivityResult is deprecated in androidx.activity.ComponentActivity. The recommendation is to use Activity Result APIs (ActivityResultLauncher)
(Note that onActivityResult is not deprecated in android.app.Activity or FragmentActivity)
| // Returns null when no device credential is set, which is the only state we need to reject. | ||
| final Intent intent = getSystemService(KeyguardManager.class).createConfirmDeviceCredentialIntent( | ||
| getString(R.string.install_from_file_confirm_title), | ||
| getString(R.string.install_from_file_confirm_description)); |
There was a problem hiding this comment.
KeyguardManager#createConfirmDeviceCredentialIntent is deprecated
| requirePreference(KEY_INSTALL_FROM_FILE).setOnPreferenceClickListener(pref -> { | ||
| ((Settings) requireActivity()).startInstallFromFile(); | ||
| return true; | ||
| }); |
There was a problem hiding this comment.
We should prevent OTA from being picked while update_engine is actively installing, and also e.g. the existing manual network action checks KEY_WAITING_FOR_REBOOT before starting its service
| } catch (GeneralSecurityException | IOException | ServiceSpecificException e) { | ||
| Log.e(TAG, "failed to download and install update", e); | ||
| notificationHandler.showFailureNotification(e.getMessage()); | ||
| mUpdating = false; | ||
| if (serviceIsUserInitiated) { |
There was a problem hiding this comment.
This failure notification does not account for the local case
When a local copy, verification, or install fails, the generic notification text says the package came from the server, that it will be downloaded again, or that Updater will retry, etc. It should be using error notification strings saying stuff like package was not installed and must be chosen again
No description provided.