Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
briar
briar
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 694
    • Issues 694
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Merge Requests 17
    • Merge Requests 17
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
  • Operations
    • Operations
    • Incidents
    • Environments
  • Analytics
    • Analytics
    • CI / CD
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • briar
  • briarbriar
  • Issues
  • #328

Closed
Open
Opened Apr 27, 2016 by akwizgran@akwizgranOwner

BriarReportPrimer makes calls that require a Looper on some devices

When handling an exception, BriarReportPrimer calls BluetoothAdapter.getDefaultAdapter(). On some devices, this method throws a RuntimeException if it's called from a thread without a Looper, i.e. a thread that hasn't called Looper.prepare().

It may be possible to avoid the RuntimeException by using AndroidExecutor to call BluetoothAdapter.getDefaultAdapter(), as DroidtoothPlugin does. However, AndroidExecutor uses the UI thread - if that thread threw the original exception and has therefore died, the Callable might never run and BriarReportPrimer would wait forever.

AndroidExecutor used to create its own captive thread with a Looper. We could revert to that design, but a similar problem would occur if the executor's captive thread had died (less likely but still possible). Since AndroidExecutor is used rarely, perhaps it should create a new thread for each call?

04-27 12:28:38.944 23487-23675/org.briarproject E/ACRA: ACRA caught a NoSuchMethodError for org.briarproject
                                                        java.lang.NoSuchMethodError: java.util.Collections.emptyEnumeration
                                                            at org.briarproject.lifecycle.LifecycleManagerImpl.startServices(LifecycleManagerImpl.java:80)
                                                            at org.briarproject.android.BriarService$1.run(BriarService.java:92)
04-27 12:28:39.054 23487-23675/org.briarproject E/ACRA: ACRA failed to capture the error - handing off to native error reporter
                                                        java.lang.RuntimeException: Can't create handler inside thread that has not called Looper.prepare()
                                                            at android.os.Handler.<init>(Handler.java:121)
                                                            at android.bluetooth.BluetoothAdapter$1.<init>(BluetoothAdapter.java:1128)
                                                            at android.bluetooth.BluetoothAdapter.<init>(BluetoothAdapter.java:1128)
                                                            at android.bluetooth.BluetoothAdapter.getDefaultAdapter(BluetoothAdapter.java:455)
                                                            at org.briarproject.android.util.BriarReportPrimer.primeReport(BriarReportPrimer.java:150)
                                                            at org.acra.builder.ReportExecutor.execute(ReportExecutor.java:125)
                                                            at org.acra.builder.ReportBuilder.build(ReportBuilder.java:148)
                                                            at org.acra.ErrorReporter.uncaughtException(ErrorReporter.java:260)
                                                            at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:854)
                                                            at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:851)
04-27 12:28:39.054 23487-23675/org.briarproject I/ACRA: ACRA is disabled for org.briarproject - forwarding uncaught Exception on to default ExceptionHandler
Assignee
Assign to
Milestone C
Milestone
Milestone C (Past due)
Assign milestone
Time tracking
None
Due date
None
Reference: briar/briar#328