guardianproject / proofmode-android

THIS REPOSITORY IS MIRROR OF: https://gitlab.com/guardianproject/proofmode/proofmode-android
https://proofmode.org
GNU General Public License v3.0
209 stars 37 forks source link

ProofMode crashes consistently when generating proof #91

Closed benhylau closed 2 years ago

benhylau commented 2 years ago

I am getting this whenever I try to generate a proof by going to Gallery, then sharing a photo to ProofMode and selecting SHARE ROBUST. My phone is a Nokia 6.1 running Android 10. The version of ProofMode is just downloaded fresh from Play store.

04-25 01:27:39.696 15558 15593 E AndroidRuntime: FATAL EXCEPTION: Thread-3
04-25 01:27:39.696 15558 15593 E AndroidRuntime: Process: org.witness.proofmode, PID: 15558
04-25 01:27:39.696 15558 15593 E AndroidRuntime: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.io.File.exists()' on a null object reference
04-25 01:27:39.696 15558 15593 E AndroidRuntime:        at org.witness.proofmode.ShareProofActivity.generateProofOutput(ShareProofActivity.java:657)
04-25 01:27:39.696 15558 15593 E AndroidRuntime:        at org.witness.proofmode.ShareProofActivity.shareProofClassic(ShareProofActivity.java:626)
04-25 01:27:39.696 15558 15593 E AndroidRuntime:        at org.witness.proofmode.ShareProofActivity.processUri(ShareProofActivity.java:564)
04-25 01:27:39.696 15558 15593 E AndroidRuntime:        at org.witness.proofmode.ShareProofActivity.shareProofAsync(ShareProofActivity.java:378)
04-25 01:27:39.696 15558 15593 E AndroidRuntime:        at org.witness.proofmode.ShareProofActivity.lambda$shareProof$2$org-witness-proofmode-ShareProofActivity(ShareProofActivity.java:305)
04-25 01:27:39.696 15558 15593 E AndroidRuntime:        at org.witness.proofmode.ShareProofActivity$$ExternalSyntheticLambda5.run(Unknown Source:6)
04-25 01:27:39.696 15558 15593 E AndroidRuntime:        at java.lang.Thread.run(Thread.java:919)
04-25 01:27:39.699  1708 15594 I DropBoxManagerService: add tag=data_app_crash isTagEnabled=true flags=0x2
04-25 01:27:39.699  1708  1764 W ActivityTaskManager:   Force finishing activity org.witness.proofmode/.ShareProofActivity
04-25 01:27:39.600  3644  5936 D FileOperator: Mode change to WRITE_MODE!
04-25 01:27:39.701  1708  1764 D ActivityTrigger: ActivityTrigger activityPauseTrigger
04-25 01:27:39.707  1708  1848 I ActivityManager: Showing crash dialog for package org.witness.proofmode u0

Choosing SHARE BASIC also does not work. I cannot generate a proof in any way.

n8fr8 commented 2 years ago

I don't understand how you are getting a null pointer there...

n8fr8 commented 2 years ago

One clue is that the primary shareProof method isn't working, and it is falling back to "shareProofClassic" secondary approach.

makew0rld commented 2 years ago

I did not experience this issue. Sharing a photo from my gallery, I was able to generate a robust proof and then share it with Signal. No crashing or issues.

Samsung Galaxy A50, Android 11, Proofmode 0.0.14-RC-3

benhylau commented 2 years ago

I am on 0.0.14-RC-3 so fileMediaNotary is null here. The null is passed from here 😅

Related question. Why does my phone consistently fail shareProof?

        File fileMedia = new File(mediaPath);
        result = shareProof(mediaUri, fileMedia, shareUris, sb, fBatchProofOut, shareMedia);

        if (!result)
            result = shareProofClassic(mediaUri, mediaPath, shareUris, sb, fBatchProofOut, shareMedia);

See: https://github.com/guardianproject/proofmode/blob/0.0.14-RC-3/app/src/main/java/org/witness/proofmode/ShareProofActivity.java#L560-L564

n8fr8 commented 2 years ago

Thanks @benhylau . I was looking at a different branch of code, so had my line numbers off. Definitely shouldn't be null, and glad we can make a quick fix.

As for what shareProof fails... I'll add some more debugging so we can make it more important exactly what is failing. It could be related to some kind of post-processing of the photo (HDR, exif injection), it could be related to where it is storing the file (external vs internal), or the inability to persist the proof hash data.

n8fr8 commented 2 years ago

(Also another reason to convert all this code to Kotlin asap)

n8fr8 commented 2 years ago

New release for testing: https://github.com/guardianproject/proofmode/releases/tag/0.0.15-BETA-1

Resolves this.