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 dead code to set the call state #4359

Merged
merged 1 commit into from
Oct 22, 2024

Conversation

danxuliu
Copy link
Member

This change was part of another fix, but I have extracted it to its own pull request for better reviewing, as it is related to the Android activity lifecycle and I am a bit worried to be missing something.

IN_CONVERSATION was set when the activity was created and state in the intent extras has the value resume. As far as I know there is no state extra set by default in Android intents, it should be explicitly set, but it is not set anywhere in Talk Android code, so that would make it dead code and safe to remove.

Moreover, it was added when switching between call view and chat during a call was introduced. At that time the check was done on a BlueLine Labs Controller rather than on an Android Activity, so maybe back then the controller received the resume state when switching between controllers in the same activity, but that would be no longer the case after dropping the controllers in favour of standard activities.

And even if resuming an activity provided a resume state, if I am not mistaken onCreate is called when the activity is initially created (so it would not make sense to receive a resume state) or after it was destroyed while in the background and recreated again when moving it to the foregroud again, which I guess would have caused the call to be interrupted anyway, and thus it should start the connection again rather than being marked as IN_CONVERSATION.

But as mentioned I am a bit worried to be missing something in all of the above, so please verify it :-) Thanks!

@danxuliu danxuliu added bug Something isn't working 3. to review Waiting for reviews feature: ☎️ call labels Oct 22, 2024
@danxuliu
Copy link
Member Author

/backport to stable-20.0

"IN_CONVERSATION" was set when the activity was created and "state" in
the intent extras had the value "resume". However, there is no "state"
extra set by default in Android intents, it should be explicitly set,
but as it is not set anywhere in Talk Android code that would make it
dead code and safe to remove.

Moreover, the connection to the call should be initialized again in any
case rather than resumed when "onCreate" is called, as it is likely that
any previous connection would have been ended if the previous activity
instance was destroyed.

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
@mahibi mahibi force-pushed the remove-dead-code-to-set-the-call-state branch from 68d8698 to fdb8692 Compare October 22, 2024 14:51
Copy link
Collaborator

@mahibi mahibi left a comment

Choose a reason for hiding this comment

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

Thx @danxuliu, all your comments are correct. This should have been removed when controllers were migrated to activities.

@mahibi mahibi enabled auto-merge October 22, 2024 14:53
@mahibi mahibi merged commit 59505c4 into master Oct 22, 2024
15 of 17 checks passed
@mahibi mahibi deleted the remove-dead-code-to-set-the-call-state branch October 22, 2024 14:58
Copy link
Contributor

Codacy

Lint

TypemasterPR
Warnings9497
Errors132132

SpotBugs

CategoryBaseNew
Bad practice66
Correctness1111
Dodgy code7979
Internationalization33
Malicious code vulnerability33
Performance66
Security11
Total109109

Lint increased!

Copy link
Contributor

APK file: https://www.kaminsky.me/nc-dev/android-artifacts/4359-talk.apk

qrcode

To test this change/fix you can simply download above APK file and install and test it in parallel to your existing Nextcloud Talk app.

@danxuliu
Copy link
Member Author

Thx @danxuliu, all your comments are correct. This should have been removed when controllers were migrated to activities.

Great, thanks for the confirmation :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3. to review Waiting for reviews bug Something isn't working feature: ☎️ call
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants