-
-
Notifications
You must be signed in to change notification settings - Fork 45
Fixes CCZ Install during Recovery #2086
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
Conversation
| if (resultCode == Activity.RESULT_OK) { | ||
| mPresenter.doOfflineAppInstall(intent.getStringExtra(InstallArchiveActivity.ARCHIVE_JR_REFERENCE)); | ||
| } else { | ||
| mPresenter.OnOfflineInstallCancelled(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Happens when user returns to the Recovery Screen without selecting any file.
| Logger.log(LogTypes.TYPE_MAINTENANCE, String.format( | ||
| "%s failed with %s for recovery measure %s", mCurrentMeasure.getType(), reason, mCurrentMeasure.getSequenceNumber())); | ||
| if (mActivity != null) { | ||
| Logger.log(LogTypes.TYPE_MAINTENANCE, String.format( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is to fix the NPE linked in PR description. I am not sure how mCurrentMeasure is getting null though I am hoping it's because actvity is no longer alive and hence hoping moving the log under activity not null check might fix it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just double chekcing, you mean how "mActivity is getting through null", right? not mCurrentMeasure? Or is mCurrentMeasure coming through null when mActivity is null?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we are getting a crash report because of mCurrentMeasure being null. Though I have not been able to repro it on my end.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have now reverted this change and wrapped the whole thing inside a try catch block to not crash the app in case of any errors here but log the exception and show user a failure message.
| if (mLastExecutionStatus == STATUS_FAILED) { | ||
| mActivity.enableRetry(); | ||
| updateStatus(mLastDisplayStatus); | ||
| } else if (!(connectToUpdateTask() || mActivity.aTaskInProgress()) && mLastExecutionStatus != STATUS_WAITING) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed mLastExecutionStatus != STATUS_WAITING condition here since in case we don't have an exisiting task to connect to and mLastExecutionStatus is STATUS_WAITING means that we have lost result of the last async task. So the only resonable thing to do in this case is to trigger the measures again.
| } else { | ||
| return STATUS_EXECUTED; | ||
| } | ||
| } catch (Exception e) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is only change in L140 - L190. Moved this exception handling to the top level function start
Does 5 things-
Corrects the dispatch to offline install activity (Jira). This was a silly mistake on my part and was affecting APP_REINSTALL_AND_UPDATE measure which allows user to choose between offline and online install.
Handles the case when user returns to the Recovery Screen without selecting any file.
Tries to handle the NPE. I have not been able to repro it so unsure why it's happening.
Error handling: Catch any exceptions in async calls , Logs complete stack trace for an exception during install.
In case we lost result of last recovery call and there is no task currently in progress, trigger the measures again.
Fixes another silly mistake where update was not getting called for offline_reinstall_and_update_measure.