nbd-wtf / obw

Open Bitcon Wallet (OBW) is a lightweight Android Bitcoin and Lightning wallet
Apache License 2.0
117 stars 18 forks source link

Black screen right after invoice generation #6

Closed Bashy closed 2 years ago

Bashy commented 2 years ago

OBW v0.1.5 and v0.1.6

Right after invoice creation, a blackscreen is displayed with nothing instead of displaying qrcode of the invoice.

There isn't any error displayed

To display the invoice we need to select view invoice on the main screen since it's not displayed right after invoice creation.

Android 12 Samsung S10e One UI 4.1

Edit : logcat added

fiatjaf commented 2 years ago

Does this happen every and always? Does it happen with SBW? I can't reproduce it anywhere. I'm not sure how to proceed.

Bashy commented 2 years ago

The problem always occurs and is not present with SBW.

Bashy commented 2 years ago

Here the android logcat

10-30 11:18:22.092   966  3494 I ActivityTaskManager: START u0 {cmp=wtf.nbd.obw/.QRInvoiceActivity} from uid 10628
10-30 11:18:22.092   966  3494 D ActivityTaskManager: TaskLaunchParamsModifier:task=null activity=ActivityRecord{30dba u0 wtf.nbd.obw/.QRInvoiceActivity display-area-from-source=DefaultTaskDisplayArea@200929264 display-id=0 display-windowing-mode=1 suggested-display-area=DefaultTaskDisplayArea@200929264
10-30 11:18:22.093   966  3494 D ActivityTaskManager: TaskLaunchParamsModifier:task=Task{5eb1acb #17867 type=standard A=10628:wtf.nbd.obw U=0 visible=true mode=fullscreen translucent=false sz=1} activity=ActivityRecord{30dba u0 wtf.nbd.obw/.QRInvoiceActivity t-1} display-area-from-source=DefaultTaskDisplayArea@200929264 display-id=0 display-windowing-mode=1 suggested-display-area=DefaultTaskDisplayArea@200929264 inherit-from-source=fullscreen activity-options-fullscreen=Rect(0, 0 - 0, 0) non-freeform-display display-area=DefaultTaskDisplayArea@200929264 maximized-bounds
10-30 11:18:22.098   629   650 I SurfaceFlinger: id=797448 createSurf (0x0),-1 flag=80004, ActivityRecord{30dba u0 wtf.nbd.obw/.QRInvoiceActivity t17867}#0
10-30 11:18:22.119   966  3083 W InputManager-JNI: Input channel object '9ae0e15 wtf.nbd.obw/wtf.nbd.obw.HubActivity (client)' was disposed without first being removed with the input manager!
10-30 11:18:22.119   966  3083 I WindowManager: Reparenting to leash, surface=Surface(name=9ae0e15 wtf.nbd.obw/wtf.nbd.obw.HubActivity)/@0xefd7864, leashParent=Surface(name=ActivityRecord{d975751 u0 wtf.nbd.obw/.HubActivity t17867})/@0x1449c1c
10-30 11:18:22.120   629   650 I SurfaceFlinger: id=797449 createSurf (0x0),-1 flag=24000, Surface(name=9ae0e15 wtf.nbd.obw/wtf.nbd.obw.HubActivity)/@0xefd7864 - animation-leash of window_animation#0
10-30 11:18:22.122   966  3083 D WindowManager: makeSurface duration=3 leash=Surface(name=Surface(name=9ae0e15 wtf.nbd.obw/wtf.nbd.obw.HubActivity)/@0xefd7864 - animation-leash of window_animation)/@0x757b46b
10-30 11:18:22.122   966  3083 V WindowManager: removeIfPossible 2, Window{9ae0e15 u0 wtf.nbd.obw/wtf.nbd.obw.HubActivity}: mAnimatingExit=true caller=com.android.server.wm.WindowState.removeIfPossible:2984 com.android.server.wm.WindowManagerService.removeWindow:2245 com.android.server.wm.Session.remove:225 android.view.IWindowSession$Stub.onTransact:746 com.android.server.wm.Session.onTransact:176
10-30 11:18:22.123   966  3083 V WindowManager: Changing focus from Window{9ae0e15 u0 wtf.nbd.obw/wtf.nbd.obw.HubActivity EXITING} to Window{33c25a7 u0 wtf.nbd.obw/wtf.nbd.obw.HubActivity} displayId=0 Callers=com.android.server.wm.RootWindowContainer.updateFocusedWindowLocked:583 com.android.server.wm.WindowManagerService.updateFocusedWindowLocked:6484 com.android.server.wm.WindowState.setupWindowForRemoveOnExit:3175 com.android.server.wm.WindowState.removeIfPossible:3143
10-30 11:18:22.123   966  3083 D MARsPolicyManager: onPackageResumedFG pkgName = wtf.nbd.obw, userId = 0
10-30 11:18:22.126   966  5296 D InputDispatcher: Focus left window (0): 9ae0e15 wtf.nbd.obw/wtf.nbd.obw.HubActivity
10-30 11:18:22.138 29824 29824 E AndroidRuntime: Process: wtf.nbd.obw, PID: 29824
10-30 11:18:22.138 29824 29824 E AndroidRuntime: java.lang.RuntimeException: Unable to start service wtf.nbd.obw.utils.AwaitService@3dc6e9d with Intent { act=actionShow cmp=wtf.nbd.obw/.utils.AwaitService (has extras) }: java.lang.IllegalArgumentException: wtf.nbd.obw: Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent.
10-30 11:18:22.138 29824 29824 E AndroidRuntime: Caused by: java.lang.IllegalArgumentException: wtf.nbd.obw: Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent.
10-30 11:18:22.138 29824 29824 E AndroidRuntime:        at wtf.nbd.obw.utils.AwaitService.processServiceIntent(AwaitService.scala:49)
10-30 11:18:22.138 29824 29824 E AndroidRuntime:        at wtf.nbd.obw.utils.AwaitService.onStartCommand(AwaitService.scala:35)
10-30 11:18:22.144   966  3083 I ActivityTaskManager: START u0 {cmp=wtf.nbd.obw/.EmergencyActivity (has extras)} from uid 10628
10-30 11:18:22.145   966  3083 D ActivityTaskManager: TaskLaunchParamsModifier:task=null activity=ActivityRecord{af445e3 u0 wtf.nbd.obw/.EmergencyActivity display-area-from-source=DefaultTaskDisplayArea@200929264 display-id=0 display-windowing-mode=1 suggested-display-area=DefaultTaskDisplayArea@200929264
10-30 11:18:22.145   966  3083 D ActivityTaskManager: TaskLaunchParamsModifier:task=Task{5eb1acb #17867 type=standard A=10628:wtf.nbd.obw U=0 visible=true mode=fullscreen translucent=false sz=2} activity=ActivityRecord{af445e3 u0 wtf.nbd.obw/.EmergencyActivity t-1} display-area-from-source=DefaultTaskDisplayArea@200929264 display-id=0 display-windowing-mode=1 suggested-display-area=DefaultTaskDisplayArea@200929264 inherit-from-source=fullscreen activity-options-fullscreen=Rect(0, 0 - 0, 0) non-freeform-display display-area=DefaultTaskDisplayArea@200929264 maximized-bounds
10-30 11:18:22.146   629   651 I SurfaceFlinger: id=797453 createSurf (0x0),-1 flag=80004, ActivityRecord{af445e3 u0 wtf.nbd.obw/.EmergencyActivity t17867}#0
10-30 11:18:22.158   966  3083 D InputDispatcher: Focus entered window (0): 33c25a7 wtf.nbd.obw/wtf.nbd.obw.HubActivity
10-30 11:18:22.258   966  5976 D AutofillSession: handling death of Token{ddd7478 ActivityRecord{d975751 u0 wtf.nbd.obw/.HubActivity t17867}} when saving=false
10-30 11:18:22.259   966  3494 I WindowManager: WIN DEATH: Window{9ae0e15 u0 wtf.nbd.obw/wtf.nbd.obw.HubActivity EXITING}
10-30 11:18:22.259   966  2638 I ActivityManager: Process wtf.nbd.obw (pid 29824) has died: fg  TOP (163,1467)
10-30 11:18:22.261   966  5976 I WindowManager: WIN DEATH: Window{33c25a7 u0 wtf.nbd.obw/wtf.nbd.obw.HubActivity}
10-30 11:18:22.261   966  5976 W InputManager-JNI: Input channel object '33c25a7 wtf.nbd.obw/wtf.nbd.obw.HubActivity (client)' was disposed without first being removed with the input manager!
10-30 11:18:22.263   966  5976 I WindowManager: Destroying surface Surface(name=wtf.nbd.obw/wtf.nbd.obw.HubActivity$_29824)/@0x58b3b55 called by com.android.server.wm.WindowStateAnimator.destroySurface:987 com.android.server.wm.WindowStateAnimator.destroySurfaceLocked:518 com.android.server.wm.WindowState.removeImmediately:2960 com.android.server.wm.WindowState.removeIfPossible:3151 com.android.server.wm.WindowState.access$300:334 com.android.server.wm.WindowState$DeathRecipient.binderDied:3708 android.os.IBinder$DeathRecipient.binderDied:320 android.os.BinderProxy.sendDeathNotice:750
10-30 11:18:22.265   966  5976 V WindowManager: Changing focus from Window{33c25a7 u0 wtf.nbd.obw/wtf.nbd.obw.HubActivity} to null displayId=0 Callers=com.android.server.wm.RootWindowContainer.updateFocusedWindowLocked:583 com.android.server.wm.WindowManagerService.updateFocusedWindowLocked:6484 com.android.server.wm.WindowState.removeIfPossible:3160 com.android.server.wm.WindowState.access$300:334
10-30 11:18:22.265   966  5976 D MARsPolicyManager: onPackageResumedFG pkgName = wtf.nbd.obw, userId = 0
10-30 11:18:22.266   966  2638 W ActivityManager: Scheduling restart of crashed service wtf.nbd.obw/.utils.AwaitService in 1000ms for start-requested

I'm not an android app expert but Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent. should help

https://github.com/nbd-wtf/obw/blob/master/app/src/main/scala/utils/AwaitService.scala#L45

     val disaplyIntent = PendingIntent.getActivity(
        me,
        0,
        new Intent(me, ClassNames.mainActivityClass),
        0
      )

https://developer.android.com/about/versions/12/behavior-changes-12#pending-intent-mutability https://developer.android.com/guide/components/intents-filters#DeclareMutabilityPendingIntent

Bashy commented 2 years ago

Similar to #11

Bashy commented 2 years ago

Proposing PR #12 , hoping that also still works on android version older than 12

Darth-Coin commented 2 years ago

I just did a test with OBW 0.1.6, on Android 8.1 (LG K10) and worked just fine.

fiatjaf commented 2 years ago

Does #12 fix this for newer Androids? If yes we can close this.

Bashy commented 2 years ago

I'm trying to compile from source but having some issues, if you provide an apk I will try on a v12 android device right now.

fiatjaf commented 2 years ago

https://file.io/hqpvYXkI0bwl sha256sum: b4f8f9accd96859ecb27f2bf6f205914366ae75137594043ba7a4d0272b3a3cf

Bashy commented 2 years ago

Tested on Android 12, fixed.

Bashy commented 2 years ago

PR #12 fixed the issue