<div dir="ltr"><div>Hi,</div><div><br></div><div>The current version 3.0.13 for android doesn't work on my TV, I posted a thread here (<a href="https://forum.videolan.org/viewtopic.php?f=35&t=147062" target="_blank">https://forum.videolan.org/viewtopic.php?f=35&t=147062</a>),
but no useful solution was provided. So I tried to look into the
problem myself. Firstly, I asked the TV manufacturer that how to turn on
'developer mode', but they refused to tell me (they hided it so well,
and used a password to protect it). After that, I think what I can do is
modifying the source code (VLC-Android-sources-3.0.13.tar.gz),
write the log event from logcat to a file on USB (by modifying the
DebugLogService class). By the way, I'm a c++ guy and have no android
experience and I don't know Java. After a few days digging, I
successfully modified the code and recompiled the APK (compile the
libvlc is definitly shit experience, lots of problems). After running
the APK, to my surprise, the log file was created, but there is no log
in the file. So I wrote another static debug function in VLCApplication:</div><div><br></div><div> static public void writeTestFile(String data) {<br> final String filename = "/mnt/usb/B2E6-1C1C/my_test_file_"+data+".log"; // My usb path<br><br> FileOutputStream fos = null;<br> OutputStreamWriter output = null;<br> BufferedWriter bw = null;<br><br> try {<br> fos = new FileOutputStream(filename);<br> output = new OutputStreamWriter(fos);<br> bw = new BufferedWriter(output);<br> bw.write(data);<br> bw.newLine();<br> fos.flush();<br> } catch (FileNotFoundException e) {<br> }catch (IOException ioe) {<br> } finally {<br> Util.close(bw);<br> Util.close(output);<br> Util.close(fos);<br> }<br> }</div><div><br></div><div>With
this function, if I want to know whether the code was executed, I can
simply call the function with a special parameter there, and check the
USB whether the file was created. So I checked the following functions:</div><div>VLCApplication.onCreate: called</div><div>DebugLogService.start: called (I called the 'start' function in VLCApplication.onCreate)<br></div><div>DebugLogService.onLog: NOT called</div><div>StartActivity.onCreate: NOT called</div><div><br></div><div>I modified the DebugLogService.run function:<br></div><div> @Override<br> public void run() {<br> final CharSequence timestamp = DateFormat.format(<br> "yyyyMMdd_kkmmss", System.currentTimeMillis());<br> final String filename = "/mnt/usb/B2E6-1C1C/vlc_logcat_" + timestamp + ".log";<br> boolean saved = true;<br> FileOutputStream fos = null;<br> OutputStreamWriter output = null;<br> BufferedWriter bw = null;<br></div><div><br></div><div> // flush the data to disk every 1s.<br></div><div> try {<br> fos = new FileOutputStream(filename);<br> output = new OutputStreamWriter(fos);<br> bw = new BufferedWriter(output);<br><br> while (!mStop) {<br> synchronized (this) {<br> for (String line : mLogList) {<br> bw.write(line);<br> bw.newLine();<br> fos.flush();<br> }<br> mLogList.clear(); <br> }<br> TimeUnit.SECONDS.sleep(1);<br> }<br> } catch (FileNotFoundException e) {<br> saved = false;<br> } catch (InterruptedException e) {<br> }catch (IOException ioe) {<br> saved = false;<br> Log.v(TAG, "run IOException: " + Boolean.toString(saved));<br> } finally {<br> saved &= Util.close(bw); <br> saved &= Util.close(output);<br> saved &= Util.close(fos); <br> }<br> synchronized (this) {<br> mSaveThread = null;<br> sendMessage(MSG_SAVED, saved ? filename : null);<br> }<br> Log.v(TAG, "run saved is " + Boolean.toString(saved) + ". Filename is " + filename);<br> }<br></div><div><br></div><div>Also I modified the DebugLogService.start function:</div><div> public synchronized void start() {<br> Log.v(TAG, "start-------------------------");<br> VLCApplication.writeTestFile("3");<br> if (mLogcat != null)<br> return;<br> clear();<br> mLogcat = new Logcat();<br> mLogcat.start(this);<br> VLCApplication.writeTestFile("4");<br> sendMessage(MSG_STARTED, null);<br><br> mSaveThread = new Thread(this);<br> mSaveThread.start();<br> VLCApplication.writeTestFile("5"); <br> }<br></div><div><br></div><div><br></div><div>Now I'm stuck, I don't know where I should check next. I seems the APK was blocked by something, do you have any ideas? Thanks</div><div><br></div><div>Regards<br></div><div><br></div><div>leopo</div><div>29/11/2018</div></div>