Android Question ReadEcryptedObject crashes App on android 5

Nickelgrass

Active Member
Licensed User
Longtime User
Hi,
I have a problem with my app running on anroid 5. It was fine on older versions. The problem is that the app crashes as soon as I read an encrypted object. Writing works. I tryed with the RandomAccesFile version 1.3 and 2.2. Both crash without any notice even in Debug mode. And tryed with ReadOnly True and False. Strangly the same crash happens when I use the Crypter Library instead of the Randomaccess.

B4X:
Sub getusername() As String
    If File.Exists(File.dirinternal, "encdata.dat") Then
        Dim raf As RandomAccessFile
        Dim tmp As String
        raf.Initialize(File.dirinternal, "encdata.dat", True)
        tmp = raf.ReadEncryptedObject("passwd", raf.CurrentPosition)
        raf.close
        Log(tmp)
        Return tmp
    Else
        Return ""
    End If
End Sub

Anyone got an Idea?

Thanks!
 
Last edited:

Nickelgrass

Active Member
Licensed User
Longtime User
Well the App just closes without an Errormessage saying "Unfortunately, B4A Example has stopped" and in the Logs of the Compiler there is just the notice
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
but no more. This is in Debug mode.
 
Upvote 0

Nickelgrass

Active Member
Licensed User
Longtime User
Is there a way to do that on Genymotion? I dont have the 5.1 on my phone and cant access the phone that crashed at the moment.
How can I view the unfiltered log with USB debug (for when I get the Phone)?

Edit: got the logcat of when the error happens from the genymotion device:

I/DEBUG ( 85): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
I/DEBUG ( 85): Build fingerprint: 'generic/vbox86tp/vbox86tp:5.1/LMY47D/buildbot11172044:userdebug/test-keys'
I/DEBUG ( 85): Revision: '0'
I/DEBUG ( 85): ABI: 'x86'
I/DEBUG ( 85): pid: 2616, tid: 2616, name: b4a.example >>> b4a.example <<<
I/DEBUG ( 85): signal 4 (SIGILL), code 2 (ILL_ILLOPN), fault addr 0xf71c024a
I/DEBUG ( 85): eax 00000001 ebx 0000000c ecx 0000000d edx f3edd497
I/DEBUG ( 85): esi 00000000 edi e1c1c740
I/DEBUG ( 85): xcs 00000023 xds 0000002b xes 0000002b xfs 00000007 xss 0000002b
I/DEBUG ( 85): eip f71c024a ebp f3edd420 esp fff34110 flags 00210246
I/DEBUG ( 85):
I/DEBUG ( 85): backtrace:
I/DEBUG ( 85): #00 pc 000c824a /system/lib/libcrypto.so (EVP_DecryptFinal_ex+522)
I/DEBUG ( 85): #01 pc 0000d474 /system/lib/libjavacrypto.so
I/DEBUG ( 85): #02 pc 003a7bfa /data/dalvik-cache/x86/system@[email protected]
I/DEBUG ( 85):
I/DEBUG ( 85): Tombstone written to: /data/tombstones/tombstone_01
I/BootReceiver( 756): Copying /data/tombstones/tombstone_01 to DropBox (SYSTEM_TOMBSTONE)
W/ActivityManager( 756): Force finishing activity 1 b4a.example/.main
E/JavaBinder( 756): !!! FAILED BINDER TRANSACTION !!!
I/Zygote ( 453): Process 2616 exited due to signal (4)
W/InputDispatcher( 756): channel '348f0bd9 b4a.example/b4a.example.main (server)' ~ Consumer closed input channel or an error occurred. events=0x9
E/InputDispatcher( 756): channel '348f0bd9 b4a.example/b4a.example.main (server)' ~ Channel is unrecoverably broken and will be disposed!
E/EGL_emulation( 719): tid 719: eglCreateSyncKHR(1209): error 0x3004 (EGL_BAD_ATTRIBUTE)
W/art ( 756): Long monitor contention event with owner method=android.graphics.Bitmap com.android.server.wm.WindowManagerService.screenshotApplications(android.os.IBinder, int, int, int, boolean) from WindowManagerService.java:6129 waiters=1 for 299ms
I/WindowState( 756): WIN DEATH: Window{348f0bd9 u0 b4a.example/b4a.example.main}
W/InputDispatcher( 756): Attempted to unregister already unregistered input channel '348f0bd9 b4a.example/b4a.example.main (server)'
W/art ( 756): Long monitor contention event with owner method=android.graphics.Bitmap com.android.server.wm.WindowManagerService.screenshotApplications(android.os.IBinder, int, int, int, boolean) from WindowManagerService.java:6129 waiters=2 for 300ms
W/ActivityManager( 756): Exception thrown during pause
W/ActivityManager( 756): android.os.DeadObjectException
W/ActivityManager( 756): at android.os.BinderProxy.transactNative(Native Method)
W/ActivityManager( 756): at android.os.BinderProxy.transact(Binder.java:496)
W/ActivityManager( 756): at android.app.ApplicationThreadProxy.schedulePauseActivity(ApplicationThreadNative.java:704)
W/ActivityManager( 756): at com.android.server.am.ActivityStack.startPausingLocked(ActivityStack.java:825)
W/ActivityManager( 756): at com.android.server.am.ActivityStack.finishActivityLocked(ActivityStack.java:2726)
W/ActivityManager( 756): at com.android.server.am.ActivityStack.finishTopRunningActivityLocked(ActivityStack.java:2583)
W/ActivityManager( 756): at com.android.server.am.ActivityStackSupervisor.finishTopRunningActivityLocked(ActivityStackSupervisor.java:2497)
W/ActivityManager( 756): at com.android.server.am.ActivityManagerService.handleAppCrashLocked(ActivityManagerService.java:11500)
W/ActivityManager( 756): at com.android.server.am.ActivityManagerService.makeAppCrashingLocked(ActivityManagerService.java:11397)
W/ActivityManager( 756): at com.android.server.am.ActivityManagerService.crashApplication(ActivityManagerService.java:12081)
W/ActivityManager( 756): at com.android.server.am.ActivityManagerService.handleApplicationCrashInner(ActivityManagerService.java:11592)
W/ActivityManager( 756): at com.android.server.am.NativeCrashListener$NativeCrashReporter.run(NativeCrashListener.java:86)
E/lowmemorykiller( 229): Error opening /proc/2616/oom_score_adj; errno=2
W/art ( 756): Long monitor contention event with owner method=void com.android.server.am.ActivityManagerService.crashApplication(com.android.server.am.ProcessRecord, android.app.ApplicationErrorReport$CrashInfo) from ActivityManagerService.java:12027 waiters=0 for 323ms
W/art ( 756): Long monitor contention event with owner method=void com.android.server.am.ActivityManagerService.crashApplication(com.android.server.am.ProcessRecord, android.app.ApplicationErrorReport$CrashInfo) from ActivityManagerService.java:12027 waiters=1 for 311ms
I/ActivityManager( 756): Process b4a.example (pid 2616) has died
I/OpenGLRenderer( 756): Initialized EGL, version 1.4
W/EGL_emulation( 1009): eglSurfaceAttrib not implemented
W/OpenGLRenderer( 1009): Failed to set EGL_SWAP_BEHAVIOR on surface 0xe25de340, error=EGL_SUCCESS
W/EGL_emulation( 756): eglSurfaceAttrib not implemented
W/OpenGLRenderer( 756): Failed to set EGL_SWAP_BEHAVIOR on surface 0xe1453f20, error=EGL_SUCCESS
W/EGL_emulation( 756): eglSurfaceAttrib not implemented
W/OpenGLRenderer( 756): Failed to set EGL_SWAP_BEHAVIOR on surface 0xe1453f20, error=EGL_SUCCESS
 
Last edited:
Upvote 0

Nickelgrass

Active Member
Licensed User
Longtime User
Ok here is a project folder that produces exactly this error. On Android 4 it decrypts and Andoid 5 it crashes.
First enter a text in the upper text and click on encrypt, the upper text is deleted and the encrypted text is shown in the lower textbox. Then click decrypt and the text should re-apear decrypted in the upper textbox.
 

Attachments

  • crypt.zip
    353.4 KB · Views: 156
Upvote 0

Nickelgrass

Active Member
Licensed User
Longtime User
Here is the original one with the randomaccess. It produces a file passwd.usr in the DirRootExternal. When decrypting it crashes.
 

Attachments

  • randomaccess.zip
    378.9 KB · Views: 195
Upvote 0

Nickelgrass

Active Member
Licensed User
Longtime User
Ok thanks for the reply. Its good to know that it is not a comon problem (the app has almost 3000 users). But the problem also occured on one Sony Experia with Android 5.
 
Upvote 0

Nickelgrass

Active Member
Licensed User
Longtime User
Thanks a lot for the support and testing!
I guess its just an isolated problem then that only affects very few devices.
:)
 
Upvote 0
Top