3

after playing around for many hours (2 days), cannot figure it out why this is happening and how to solve it.

I am using emulatorview for Android: https://gitlab.com/termapps/termoneplus/-/tree/master/emulatorview and Speed Test python script: https://github.com/sivel/speedtest-cli/blob/master/speedtest.py

After managed to compile Python 3.10 for Android, tried to execute from adb shell Speed Test script and it runs and displays correctly.

But when trying to execute it from java code and display it to the emulatorview it shows a weird text position in the view.

The next line is displayed at the end of the previous line before it, normally it should be displayed at the very left part of the screen as new line.

The attached image explains better what i mean: enter image description here

The initialization of emulatorview and execution is as following :

lateinit var emulatorView: EmulatorView
private var session: TermSession? = null

val execBuild = ProcessBuilder(context!!.applicationInfo.nativeLibraryDir + "/libpython3.so", "/data/local/tmp/speedtest-cli-master/speedtest.py")
execBuild.redirectErrorStream(true)
val exec: Process? = execBuild.start()

session!!.termIn = exec!!.inputStream
session!!.termOut = exec.outputStream

launch(Dispatchers.Main) {
    emulatorView.setDensity(requireActivity().resources.displayMetrics)
    emulatorView.attachSession(context, session)
    emulatorView.setTermType("linux")
    emulatorView.setTextSize(textSize)
}

Any idea how to solve that problem ?

P.s sorry for my English, hope to be enough understandable :)

EAK TEAM
  • 5,726
  • 4
  • 30
  • 52
  • 1
    This looks like a [carriage return vs line feed](https://stackoverflow.com/q/12747722/295004) issue. As you are using third-party code (`emulatorview`), I would test how simple strings are output. You also haven't mentioned if you tried other `setTermType()` other than 'linux'. – Morrison Chang Jan 02 '22 at 22:04
  • @MorrisonChang i hae tried `setTermType("VT100")`, `setTermType("screen")`, `setTermType("linux")`... Still same issue – EAK TEAM Jan 05 '22 at 18:34
  • And testing out different carriage return/line feed with various print statements in a helloworld.py generates the same results? I ask as the speedtest.py code is using its own print wrapper functions. Also if you have a minimum verifiable example then you might want to open a issue ticket on emulatorview: https://gitlab.com/termapps/termoneplus/-/issues – Morrison Chang Jan 05 '22 at 19:25
  • It happens with every python script or java process which i attach to the emulatorview – EAK TEAM Jan 06 '22 at 18:35

0 Answers0