[Android] onCreate of StartActivity is not called

Leopold Freeman leopold.freeman.0816 at gmail.com
Thu Nov 29 04:22:32 CET 2018


Hi,

The current version 3.0.13 for android doesn't work on my TV, I posted a
thread here (https://forum.videolan.org/viewtopic.php?f=35&t=147062), 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:

    static  public void writeTestFile(String data) {
        final String filename =
"/mnt/usb/B2E6-1C1C/my_test_file_"+data+".log";  // My usb path

        FileOutputStream fos = null;
        OutputStreamWriter output = null;
        BufferedWriter bw = null;

        try {
            fos = new FileOutputStream(filename);
            output = new OutputStreamWriter(fos);
            bw = new BufferedWriter(output);
            bw.write(data);
            bw.newLine();
            fos.flush();
        } catch (FileNotFoundException e) {
        }catch (IOException ioe) {
        } finally {
            Util.close(bw);
            Util.close(output);
            Util.close(fos);
        }
    }

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:
VLCApplication.onCreate: called
DebugLogService.start: called (I called the 'start' function in
VLCApplication.onCreate)
DebugLogService.onLog: NOT called
StartActivity.onCreate: NOT called

I modified the DebugLogService.run function:
    @Override
    public void run() {
        final CharSequence timestamp = DateFormat.format(
                "yyyyMMdd_kkmmss", System.currentTimeMillis());
        final String filename = "/mnt/usb/B2E6-1C1C/vlc_logcat_" +
timestamp + ".log";
        boolean saved = true;
        FileOutputStream fos = null;
        OutputStreamWriter output = null;
        BufferedWriter bw = null;

        // flush the data to disk every 1s.
        try {
            fos = new FileOutputStream(filename);
            output = new OutputStreamWriter(fos);
            bw = new BufferedWriter(output);

            while (!mStop) {
                synchronized (this) {
                    for (String line : mLogList) {
                        bw.write(line);
                        bw.newLine();
                        fos.flush();
                    }
                    mLogList.clear();
                }
                TimeUnit.SECONDS.sleep(1);
            }
        } catch (FileNotFoundException e) {
            saved = false;
        } catch (InterruptedException e) {
        }catch (IOException ioe) {
            saved = false;
            Log.v(TAG, "run IOException: " + Boolean.toString(saved));
        } finally {
            saved &= Util.close(bw);
            saved &= Util.close(output);
            saved &= Util.close(fos);
        }
        synchronized (this) {
            mSaveThread = null;
            sendMessage(MSG_SAVED, saved ? filename : null);
        }
        Log.v(TAG, "run saved is " + Boolean.toString(saved) + ". Filename
is " + filename);
    }

Also I modified the DebugLogService.start function:
    public synchronized void start() {
      Log.v(TAG, "start-------------------------");
      VLCApplication.writeTestFile("3");
        if (mLogcat != null)
            return;
        clear();
        mLogcat = new Logcat();
        mLogcat.start(this);
        VLCApplication.writeTestFile("4");
        sendMessage(MSG_STARTED, null);

        mSaveThread = new Thread(this);
        mSaveThread.start();
        VLCApplication.writeTestFile("5");
    }


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

Regards

leopo
29/11/2018
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/android/attachments/20181129/2c7cea9d/attachment-0001.html>


More information about the Android mailing list