SecurityException on Android 12 on startup #647

Open
opened 2 months ago by mightymop · 3 comments

General information

  • Version: 3.1.0 beta Codebase 336 (master)
  • Device: Pixel 6
  • Android Version: Android 12 (stock)
  • Server name: self hosted
  • Server software: Openfire 4.7.
  • Installed server modules: Stream Managment, MAM
  • Pix-Art Messenger source: Codeberg, self build (latest HEAD)

Steps to reproduce

  1. ? Take a mobile with Android 12 (eg. Pixel 6)
  2. ? install the app and run it

Expected result

It should not crash

Actual result

Getting a
**java.lang.SecurityException: listen **
on startup (after install) > so app is immediately crashing

Debug output

java.lang.RuntimeException: Unable to create service eu.siacs.conversations.services.XmppConnectionService: java.lang.SecurityException: listen
      at android.app.ActivityThread.handleCreateService(ActivityThread.java:4567)
      at android.app.ActivityThread.access$1700(ActivityThread.java:256)
      at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2110)
      at android.os.Handler.dispatchMessage(Handler.java:106)
      at android.os.Looper.loopOnce(Looper.java:201)
      at android.os.Looper.loop(Looper.java:288)
      at android.app.ActivityThread.main(ActivityThread.java:7870)
      at java.lang.reflect.Method.invoke(Native Method)
      at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
   Caused by: java.lang.SecurityException: listen
      at android.os.Parcel.createExceptionOrNull(Parcel.java:2425)
      at android.os.Parcel.createException(Parcel.java:2409)
      at android.os.Parcel.readException(Parcel.java:2392)
      at android.os.Parcel.readException(Parcel.java:2334)
      at com.android.internal.telephony.ITelephonyRegistry$Stub$Proxy.listenWithEventList(ITelephonyRegistry.java:1036)
      at android.telephony.TelephonyRegistryManager.listenFromListener(TelephonyRegistryManager.java:250)
      at android.telephony.TelephonyManager.listen(TelephonyManager.java:6000)
      at eu.siacs.conversations.services.XmppConnectionService.setupPhoneStateListener(XmppConnectionService.java:1502)
      at eu.siacs.conversations.services.XmppConnectionService.onCreate(XmppConnectionService.java:1476)
      at android.app.ActivityThread.handleCreateService(ActivityThread.java:4554)
      at android.app.ActivityThread.access$1700(ActivityThread.java:256) 
      at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2110) 
      at android.os.Handler.dispatchMessage(Handler.java:106) 
      at android.os.Looper.loopOnce(Looper.java:201) 
      at android.os.Looper.loop(Looper.java:288) 
      at android.app.ActivityThread.main(ActivityThread.java:7870) 
      at java.lang.reflect.Method.invoke(Native Method) 
      at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548) 
      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003) 
   Caused by: android.os.RemoteException: Remote stack trace:
      at com.android.internal.telephony.TelephonyPermissions.enforceCarrierPrivilege(TelephonyPermissions.java:645)
      at com.android.internal.telephony.TelephonyPermissions.checkReadPhoneState(TelephonyPermissions.java:149)
      at com.android.internal.telephony.TelephonyPermissions.checkCallingOrSelfReadPhoneState(TelephonyPermissions.java:94)
      at com.android.server.TelephonyRegistry.checkListenerPermission(TelephonyRegistry.java:3131)
      at com.android.server.TelephonyRegistry.listen(TelephonyRegistry.java:1025)
#### General information * **Version:** 3.1.0 beta Codebase 336 (master) * **Device:** Pixel 6 * **Android Version:** Android 12 (stock) * **Server name:** self hosted * **Server software:** Openfire 4.7. * **Installed server modules:** Stream Managment, MAM * **Pix-Art Messenger source:** Codeberg, self build (latest HEAD) #### Steps to reproduce 1. ? Take a mobile with Android 12 (eg. Pixel 6) 2. ? install the app and run it #### Expected result It should not crash #### Actual result Getting a **java.lang.SecurityException: listen ** on startup (after install) > so app is immediately crashing #### Debug output ``` java.lang.RuntimeException: Unable to create service eu.siacs.conversations.services.XmppConnectionService: java.lang.SecurityException: listen at android.app.ActivityThread.handleCreateService(ActivityThread.java:4567) at android.app.ActivityThread.access$1700(ActivityThread.java:256) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2110) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loopOnce(Looper.java:201) at android.os.Looper.loop(Looper.java:288) at android.app.ActivityThread.main(ActivityThread.java:7870) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003) Caused by: java.lang.SecurityException: listen at android.os.Parcel.createExceptionOrNull(Parcel.java:2425) at android.os.Parcel.createException(Parcel.java:2409) at android.os.Parcel.readException(Parcel.java:2392) at android.os.Parcel.readException(Parcel.java:2334) at com.android.internal.telephony.ITelephonyRegistry$Stub$Proxy.listenWithEventList(ITelephonyRegistry.java:1036) at android.telephony.TelephonyRegistryManager.listenFromListener(TelephonyRegistryManager.java:250) at android.telephony.TelephonyManager.listen(TelephonyManager.java:6000) at eu.siacs.conversations.services.XmppConnectionService.setupPhoneStateListener(XmppConnectionService.java:1502) at eu.siacs.conversations.services.XmppConnectionService.onCreate(XmppConnectionService.java:1476) at android.app.ActivityThread.handleCreateService(ActivityThread.java:4554) at android.app.ActivityThread.access$1700(ActivityThread.java:256)  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2110)  at android.os.Handler.dispatchMessage(Handler.java:106)  at android.os.Looper.loopOnce(Looper.java:201)  at android.os.Looper.loop(Looper.java:288)  at android.app.ActivityThread.main(ActivityThread.java:7870)  at java.lang.reflect.Method.invoke(Native Method)  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)  Caused by: android.os.RemoteException: Remote stack trace: at com.android.internal.telephony.TelephonyPermissions.enforceCarrierPrivilege(TelephonyPermissions.java:645) at com.android.internal.telephony.TelephonyPermissions.checkReadPhoneState(TelephonyPermissions.java:149) at com.android.internal.telephony.TelephonyPermissions.checkCallingOrSelfReadPhoneState(TelephonyPermissions.java:94) at com.android.server.TelephonyRegistry.checkListenerPermission(TelephonyRegistry.java:3131) at com.android.server.TelephonyRegistry.listen(TelephonyRegistry.java:1025) ```
Poster

Info: downgrading to targetSDK 30 in build.gradle helps as a workaround...

Info: downgrading to targetSDK 30 in build.gradle helps as a workaround...
Owner

I can't reproduce this with latest HEAD on Android 12 emulator. The messenger starts and is usable...

I can't reproduce this with latest HEAD on Android 12 emulator. The messenger starts and is usable...
kriztan added the
Need info
label 2 months ago
Poster

I can't reproduce this with latest HEAD on Android 12 emulator. The messenger starts and is usable...

hm strange... i dont know why but my targetSdkVersion was set to 31 which causes the issue...
going back to 30 works as i said before... maybe the IDE had tried to optimize and had failed in my case... so we could close the case for now but we should take care on it in the future when increasing the targetSdkVersion again...

> I can't reproduce this with latest HEAD on Android 12 emulator. The messenger starts and is usable... hm strange... i dont know why but my targetSdkVersion was set to 31 which causes the issue... going back to 30 works as i said before... maybe the IDE had tried to optimize and had failed in my case... so we could close the case for now but we should take care on it in the future when increasing the targetSdkVersion again...
Sign in to join this conversation.
No Milestone
No Assignees
2 Participants
Notifications
Due Date

No due date set.

Dependencies

This issue currently doesn't have any dependencies.

Loading…
There is no content yet.