Closed VanceVagell closed 1 month ago
Both issues will be fixed in beta version 12.
I wrapped uses of Visualizer in checks for the permission, and also create the visualizer if it hasn't been once the permission is granted. And for the second exception, I default to the (US) FM calling frequency when whatever the user typed in just can't be parsed as a number.
These are being reported in the wild on beta user devices by Play Console:
Exception java.lang.RuntimeException: Cannot initialize Visualizer engine, error: -3 at android.media.audiofx.Visualizer. (Visualizer.java:238)
at com.vagell.kv4pht.ui.MainActivity.createRxAudioVisualizer (MainActivity.java:535)
at com.vagell.kv4pht.ui.MainActivity.access$1300 (MainActivity.java:91)
at com.vagell.kv4pht.ui.MainActivity$5$1.audioTrackCreated (MainActivity.java:298)
at com.vagell.kv4pht.radio.RadioAudioService.initAudioTrack (RadioAudioService.java:541)
at com.vagell.kv4pht.radio.RadioAudioService.start (RadioAudioService.java:266)
at com.vagell.kv4pht.ui.MainActivity$5.onServiceConnected (MainActivity.java:319)
at android.app.LoadedApk$ServiceDispatcher.doConnected (LoadedApk.java:2349)
at android.app.LoadedApk$ServiceDispatcher$RunConnection.run (LoadedApk.java:2382)
at android.os.Handler.handleCallback (Handler.java:942)
at android.os.Handler.dispatchMessage (Handler.java:99)
at android.os.Looper.loopOnce (Looper.java:240)
at android.os.Looper.loop (Looper.java:351)
at android.app.ActivityThread.main (ActivityThread.java:8423)
at java.lang.reflect.Method.invoke
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:584)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1013)
And this one:
Exception java.lang.NumberFormatException: at sun.misc.FloatingDecimal.readJavaFormatString (FloatingDecimal.java:2043) at sun.misc.FloatingDecimal.parseFloat (FloatingDecimal.java:122) at java.lang.Float.parseFloat (Float.java:451) at com.vagell.kv4pht.radio.RadioAudioService.makeSafe2MFreq (RadioAudioService.java:394) at com.vagell.kv4pht.ui.MainActivity$13.onEditorAction (MainActivity.java:786) at android.widget.TextView.onEditorAction (TextView.java:6470) at com.android.internal.widget.EditableInputConnection.performEditorAction (EditableInputConnection.java:138) at android.view.inputmethod.InputConnectionWrapper.performEditorAction (InputConnectionWrapper.java:205) at com.android.internal.view.IInputConnectionWrapper.executeMessage (IInputConnectionWrapper.java:363) at com.android.internal.view.IInputConnectionWrapper$MyHandler.handleMessage (IInputConnectionWrapper.java:85) at android.os.Handler.dispatchMessage (Handler.java:112) at android.os.Looper.loop (Looper.java:216) at android.app.ActivityThread.main (ActivityThread.java:7625) at java.lang.reflect.Method.invoke at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:524) at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:987)
The first exception is caused when the audio Visualizer is being created before the user accepts AUDIO_RECORD permission (Visualizer requires that even if it's not being used with audio from the mic). The second exception I'm not sure what input is causing, so I'll just handle this exception more gracefully in general.