<html><body><div style="color:#000; background-color:#fff; font-family:times new roman, new york, times, serif;font-size:12pt"><div><span>Hi Robert,</span></div><div><span><br></span></div><div><span>I'm more than&nbsp;</span>interested in all your&nbsp;explanations ! :)</div><div>Sadly this days I don't have too much time for Necessitas, I promise I'll be back very soon !</div><div><br></div><div>Cheers,</div><div>BogDan.</div><meta http-equiv="content-type" content="text/html; charset=utf-8"><meta http-equiv="content-type" content="text/html; charset=utf-8"><div><br><blockquote style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px;"><div style="font-size: 12pt; font-family: 'times new roman', 'new york', times, serif; "><div style="font-size: 12pt; font-family: 'times new roman', 'new york', times, serif; "><font size="2" face="Arial"><hr size="1"><b><span style="font-weight:bold;">From:</span></b> Robert Schuster
 &lt;r.schuster@tarent.de&gt;<br><b><span style="font-weight: bold;">To:</span></b> necessitas-devel@kde.org<br><b><span style="font-weight: bold;">Sent:</span></b> Tuesday, July 12, 2011 1:00 PM<br><b><span style="font-weight: bold;">Subject:</span></b> Re: Java part rework - concept<br></font><br>Hi everyone,<br>is actually anyone interested in all these explanations? ;)<br><br>Anyway I finished the Proof-Of-Concept implementation and also its<br>description. If anyone has a question about the Java part rework it is<br>all on:<br><br><a href="http://community.kde.org/Necessitas/Java/Redesign" target="_blank">http://community.kde.org/Necessitas/Java/Redesign</a><br><br>I'd suggest those who are concerned to actually look at the PoC and the<br>comments within.<br><br>I'm now starting with an actual Android implementation of the ideas.<br>I'll refine the information on the website as soon as I see that this is<br>necessary.<br><br>Happy
 hacking!<br>Robert<br><br>Am 07.07.2011 12:22, schrieb Robert Schuster:<br>&gt; Hi all,<br>&gt; finally I found the time to do a write up of the concept of the Java<br>&gt; part rework that Bogdan, Christian and I talked about at QCS in Berlin.<br>&gt; Attached is (hopefully) a drawing that shows the individual components.<br>&gt; This mail is supposed to be a complete explanation of the whole topic.<br>&gt; For a discussion on IRC later this day it would be nice if you've read<br>&gt; it. :)<br>&gt; <br>&gt; Base technique: At QCS we found out that it is very impractical to have<br>&gt; that many Java classes in sourcecode form in each application. Simply<br>&gt; because every class becomes part of the public interface. This will<br>&gt; cause a huge maintenance burden. I'd simply say it would not work. We<br>&gt; need to move large parts of the code into places that are independent<br>&gt; from the application. This however strongly required the need
 to add<br>&gt; classes from a foreign APK or DEX file to the application's classpath.<br>&gt; We were not sure whether Android would allow this but it indeed does. As<br>&gt; a proof of concept we wrote a demo[0] application which can load any (!)<br>&gt; APK or DEX file and create an instance of any class and call its<br>&gt; toString() method. The POC worked in the way we wanted on a rooted but<br>&gt; also on a normal locked device.<br>&gt; <br>&gt; With this technique at hand we can do the following:<br>&gt; * Move all code that is not really necessary for app startup into<br>&gt; separate APK files<br>&gt; * Define an interface between App and Loader which can handle updates<br>&gt; (that allows for incompatible changes in the App code over time)<br>&gt; * Profit! Err, yeah ... ;)<br>&gt; <br>&gt; Let's explain all the little boxes from the drawing:<br>&gt; <br>&gt; App:<br>&gt; ----<br>&gt; This is the source code that is part of each Android-Qt
 application. The<br>&gt; user *may* change little pieces of the code as long as it does not<br>&gt; violate the interface to the Loader or Ministro. What the user can do is<br>&gt; calling any methods of the public interfaces to the loader for example.<br>&gt; We will mark the pieces of code that the user *must* not remove or<br>&gt; modify otherwise.<br>&gt; This whole thing will be as small as possible!<br>&gt; Whenever there is the need to change the App code in an incompatible way<br>&gt; we need to introduce a new Loader interface. E.g. we will have a<br>&gt; LoaderVersion1 interface for now. When it changes the App code will ask<br>&gt; for LoaderVersion2. The Loader's reponsibilities will be explained below.<br>&gt; <br>&gt; Loader:<br>&gt; -------<br>&gt; The Loader connects methods from the App with the Android Activity<br>&gt; class. It will implement all available methods in order to gain maximum<br>&gt; control over the App code without
 letting the App decide by itself. The<br>&gt; Loader is published by us and can as such be updated over time allowing<br>&gt; *us* to fix bugs, introduce new feature to *existing* applications<br>&gt; without changing them.<br>&gt; There might be applications with different versions of the starter code<br>&gt; in it. Each of those version requires a specific interface in the<br>&gt; Loader. The most up to date version of the Loader will understand (=<br>&gt; implement) and offer all interfaces. That way old and new application<br>&gt; start code is always compatible with the Loader.<br>&gt; If a Loader cannot satisfy the requested interface of an application<br>&gt; then this means that the current version of the Loader is too old and it<br>&gt; will update itself.<br>&gt; (The Loader will technically be part of Ministro, when Ministro is<br>&gt; installed. If the user is a developer and chose 'use local libs' then<br>&gt; the loader will also be copied
 to a well known directory and directly<br>&gt; included into the Apps classpath. As such at runtime of an App the<br>&gt; Loader APK will be part of the App's process space!)<br>&gt; <br>&gt; Ministro:<br>&gt; ---------<br>&gt; Ministro does what it does right now: It downloads the libs (if<br>&gt; necessary), provides the locations of the libraries and tells the app<br>&gt; that it can start. I'm actually thinking of putting the 'satisfy a<br>&gt; certain Loader interface version' into Ministro, too. Because that seems<br>&gt; like the best place for it).<br>&gt; Unlike now the interface between App and Ministro will become upgrade<br>&gt; compatible. While changes will happen less frequently it is very<br>&gt; important that we allow and can deal with incompatible changes to the<br>&gt; interface between Ministro and the App.<br>&gt; <br>&gt; Bridge:<br>&gt; -------<br>&gt; These are all the classes that interact in some way with the C++ code
 of<br>&gt; the Android-Qt port. Unlike now they will be a private interface.<br>&gt; Meaning that we can do *any* change we want in them. For each supported<br>&gt; Qt version (4.9, 5.0 etc.) there will be an accompanying bridge. The<br>&gt; bridge may even consist of multiple APKs if we want to save space (e.g.<br>&gt; if QtMobility is not used, then the classes for it do not need to be<br>&gt; available as well).<br>&gt; <br>&gt; Qt:<br>&gt; ---<br>&gt; These are the native Qt libraries. No change needed. Except that any<br>&gt; code can *assume* the existence of certain bridge classes and can<br>&gt; resolve class names at will.<br>&gt; <br>&gt; Caveats:<br>&gt; -------<br>&gt; From a development perspective this is quite a task. The Java code<br>&gt; changes are not so difficult (for me at least) but I have no clue how we<br>&gt; can modify the Android-Qt build to also compile Java classes, dexify and<br>&gt; make an APK out of them. Because this is
 what we need. When you compile<br>&gt; Qt for Android you'll need a Java compiler, the DEX tool and something<br>&gt; that creates an APK for you. IOW this is where I need you help.<br>&gt; <br>&gt; The Ministro build also needs to be changed a bit. The Ministro APK<br>&gt; could contain the Loader classes. That would not be a problem. However<br>&gt; somehow QtCreator needs the Loader classes too when using 'use local<br>&gt; libs' flag. I propose that the SDK installer also downloads the Loader<br>&gt; classes (which might be the same as Ministro but as a library not an<br>&gt; application) from a known location.<br>&gt; <br>&gt; I plan to use real Java interfaces in order to define the public<br>&gt; interface. An alternative approach would be to rely on reflection only.<br>&gt; However that will make the interface very opaque and the code will be<br>&gt; difficult to read for anyone with only a small knowledge of Java. Having<br>&gt; interfaces
 however means we will need to share bits of sourcecode<br>&gt; between the projects (namely the interface file). I'm still<br>&gt; contemplating how to do this properly.<br>&gt; <br>&gt; For tonight I am mostly interested in how to solve the caveats.<br>&gt; <br>&gt; Let me know what you think. If not we'll see each other at 7pm CET/GMT+1. :)<br>&gt; <br>&gt; Regards,<br>&gt; Robert<br>&gt; <br>&gt; [0] - <a href="http://paste.debian.net/122188/" target="_blank">http://paste.debian.net/122188/</a><br>&gt; <br>&gt; <br>&gt; <br>&gt; <br>&gt; _______________________________________________<br>&gt; Necessitas-devel mailing list<br>&gt; <a ymailto="mailto:Necessitas-devel@kde.org" href="mailto:Necessitas-devel@kde.org">Necessitas-devel@kde.org</a><br>&gt; <a href="https://mail.kde.org/mailman/listinfo/necessitas-devel" target="_blank">https://mail.kde.org/mailman/listinfo/necessitas-devel</a><br><br><br>-- <br>tarent solutions GmbH<br>Thiemannstr. 36 a,
 D-12059 Berlin • <a href="http://www.tarent.de/" target="_blank">http://www.tarent.de/</a><br>Tel: +49 30 5682943-30 • Fax: fax +49 228 52675-25<br><br>Rochusstraße 2-4, D-53123 Bonn • <a href="http://www.tarent.de/" target="_blank">http://www.tarent.de/</a><br>Tel: +49 228 52675-0 • Fax: +49 228 52675-25<br>HRB AG Bonn 5168 • USt-ID (VAT): DE122264941<br>Geschäftsführer: Boris Esser, Elmar Geese<br><br><br><br>_______________________________________________<br>Necessitas-devel mailing list<br><a ymailto="mailto:Necessitas-devel@kde.org" href="mailto:Necessitas-devel@kde.org">Necessitas-devel@kde.org</a><br><a href="https://mail.kde.org/mailman/listinfo/necessitas-devel" target="_blank">https://mail.kde.org/mailman/listinfo/necessitas-devel</a><br><br><br></div></div></blockquote></div></div></body></html>