Signal-android: Share from Youtube app doesn't work sometimes

Created on 5 Feb 2019  路  5Comments  路  Source: signalapp/Signal-Android


Bug description

Sharing from Youtube app doesn't work

Steps to reproduce

  • open Youtube app
  • find video too hilarious to keep to yourself
  • tap the share arrow (sharrow)
  • choose Signal from the list of things to share to

Actual result: sometimes (1/2 the time?) Youtube is turned into small window and signal briefly shows the list of contacts and then is minimized/disappears
Expected result: Signal lets me choose a person to share with and inserts the link in the conversation I chose

Device info

Device: Samsung galaxy s9
Android version: 9.0 stock verizon
Signal version: 4.33.2

Link to debug log

coming soon

https://debuglogs.org/db4efe76ee39464cc6721e3af6ea2dd150e164cd29535b659f1f9d1373484ec4

Most helpful comment

I think I see what's happening. If you have an actively-playing video, it does the picture-in-picture thing that was added in Android O. That triggers some different lifecycle events in the ShareActivity that it doesn't expect, particularly this:

@Override
  public void onPause() {
    super.onPause();
    if (!isPassingAlongMedia && resolvedExtra != null) {
      PersistentBlobProvider.getInstance(this).delete(this, resolvedExtra);
    }
    if (!isFinishing()) {
      finish();
    }
  }

For whatever reason the activity is set to end itself in onPause(), which is being triggered unexpectedly by the picture-in-picture. I'm tempted to just remove that bit, but it was added a long time ago for a reason, so I'll dig into it for 4.34.x. In the meantime, it appears the mitigation is to pause videos before sharing them :)

All 5 comments

I think I see what's happening. If you have an actively-playing video, it does the picture-in-picture thing that was added in Android O. That triggers some different lifecycle events in the ShareActivity that it doesn't expect, particularly this:

@Override
  public void onPause() {
    super.onPause();
    if (!isPassingAlongMedia && resolvedExtra != null) {
      PersistentBlobProvider.getInstance(this).delete(this, resolvedExtra);
    }
    if (!isFinishing()) {
      finish();
    }
  }

For whatever reason the activity is set to end itself in onPause(), which is being triggered unexpectedly by the picture-in-picture. I'm tempted to just remove that bit, but it was added a long time ago for a reason, so I'll dig into it for 4.34.x. In the meantime, it appears the mitigation is to pause videos before sharing them :)

It might be enough to just move to code to onStop without changing the behavior. That method is called when the app gets invisible instead of when it looses focus. onStop seems to be the new onPause since multiwindow was added

@ByteHamster does that not introduce other behavior for older Android versions? Or would it need a block like if (SDK < Android O) in both onPause() and onStop()?

Fixed this in the 4.34 release branch. Thanks!

@jeremymasters "sharrow" is pretty great.

Was this page helpful?
0 / 5 - 0 ratings