This project is on hold.
If you want to help with it's development, write me.
воскресенье, 30 ноября 2008 г.
среда, 29 октября 2008 г.
Yes!
вторник, 28 октября 2008 г.
Views & Windows
Finally, I sorted out relations between View, IWindow (and other IWindow* interfaces) and Window.
Assorted facts:
And it gets even worse for me, as I need to name a class which is neither Window, nor IWindow, nor View. This class will be *real* window, much like WindowManagerService.WindowState. It named ViewRoot2 for now :)
Assorted facts:
- Window (and its descendant, PhoneWindow) is just fancy way to control decor view of main 'window'. Decor view consists of title, progress, frame, etc.
- IWindow, despite its apparent relation to Window, has nothing to do with it. It is (IPC) callback from WindowManagerService (accessible via IWindowManager/IWindowSession).
- IWindow is used in ViewRoot (which is a hidden class implementing ViewParent). It is ViewRoot, not Window, that receives key events and draws views.
- When activity starts it creates Window, loads appropriate decor view, and adds decor view to WindowManagerService (via WindowManager).
- WindowManager. Uh oh. Not related to IWindowManager. Despite being ViewManager descendant, expects WindowManager.LayoutAttributes as parameters to its methods. WindowManager creates ViewRoot for each added view. ViewRoot communicates with WindowManagerService and adds new 'window' to it.
- You can add your own top-level view (see Toast widget code).
And it gets even worse for me, as I need to name a class which is neither Window, nor IWindow, nor View. This class will be *real* window, much like WindowManagerService.WindowState. It named ViewRoot2 for now :)
вторник, 21 октября 2008 г.
Source release!
Citizens celebrate - Google released Android's source!
The only problem is that you can get it all only on Linux and Mac OS. Well, thanks to Web interface, I can write some simple downloader and finally start putting it all together.
No more decompiled sources - what a joy!
The only problem is that you can get it all only on Linux and Mac OS. Well, thanks to Web interface, I can write some simple downloader and finally start putting it all together.
No more decompiled sources - what a joy!
четверг, 16 октября 2008 г.
Slowdown...
Well, for the past week I was busy on my work and other activities.
I finished Resources.Theme, and now I'm working on inflating layouts.
Expect screenshots soon!
I finished Resources.Theme, and now I'm working on inflating layouts.
Expect screenshots soon!
четверг, 9 октября 2008 г.
AXMLPrinter2
I've updated AXMLPrinter to version 2.
Now it uses current AXmlResourceParser, correctly handles namespaces (previous version had 1 hardcoded namespace) and formats attributes. So no more <0xxxxx>, now it is @7F060003, or 26.0sp, or #FF000000, etc.
Now it uses current AXmlResourceParser, correctly handles namespaces (previous version had 1 hardcoded namespace) and formats attributes. So no more <0xxxxx>, now it is @7F060003, or 26.0sp, or #FF000000, etc.
понедельник, 6 октября 2008 г.
Region.Op explained
пятница, 3 октября 2008 г.
android.text...
Did you know that android.text package has 93 classes in it?
Classes in there is super-useful, all that lovely spans stuff and layout and even Multitap!
But I feel that I'm reaching some J2ME limit in terms of complexity. I already have 250+ classes, and this do not include SE library! Seems that I will be needing some really hard optimization work...
PS. J2ME-Polish has 400 classes.
Classes in there is super-useful, all that lovely spans stuff and layout and even Multitap!
But I feel that I'm reaching some J2ME limit in terms of complexity. I already have 250+ classes, and this do not include SE library! Seems that I will be needing some really hard optimization work...
PS. J2ME-Polish has 400 classes.
вторник, 30 сентября 2008 г.
Trap
OK, I'm getting in this trap over and over again.
I think I need big sign in front of me, saying:
"Even when you have source code, reimplementing can be better option then porting. First estimate then start working."
PS. I parsed AndroidManifest.xml and resolved MAIN activity, but I'm having problems in putting it all together.
I think I need big sign in front of me, saying:
"Even when you have source code, reimplementing can be better option then porting. First estimate then start working."
PS. I parsed AndroidManifest.xml and resolved MAIN activity, but I'm having problems in putting it all together.
вторник, 23 сентября 2008 г.
Stub!
Wow, android.jar cut down to 2737Kb (from 11Mb).
How did they do it?
They just throw new RuntimeException("Stub!")!
Oh well. Back to work with 0.9.
PS. Hope they eventually release that beautiful, 'Stubbizing' tool :)
How did they do it?
They just throw new RuntimeException("Stub!")!
Oh well. Back to work with 0.9.
PS. Hope they eventually release that beautiful, 'Stubbizing' tool :)
Windowing
Windowing in Android is too complex to just "port" it, I mean, get source, hack it here and there, and voila. No voila for me. I need to re-implement it. Ohh.
понедельник, 22 сентября 2008 г.
Exceptions and nulls
Argh, I'm irritated at Android's inconsistency when dealing with errors.
Consider loading a drawable (bitmap).
If you load bitmap by yourself via BitmapFactory.decodeFile, you will get null in case of error.
If you load bitmap drawable via Resources.getDrawable, and there is a problem, you will get NotFoundException with nested IOException.
You can also load via Drawable.createFromPath, and you will again get Drawable or null.
I will add 'Throw' versions of some functions (decodeFileThrow) that will throw exceptions.
Consider loading a drawable (bitmap).
If you load bitmap by yourself via BitmapFactory.decodeFile, you will get null in case of error.
If you load bitmap drawable via Resources.getDrawable, and there is a problem, you will get NotFoundException with nested IOException.
You can also load via Drawable.createFromPath, and you will again get Drawable or null.
I will add 'Throw' versions of some functions (decodeFileThrow) that will throw exceptions.
System resources
There are many references to android.R class which represents system resources, so for Android4ME we would need 'stripped down' version of system resources (it would not be hard, thanks for lib/res folder). I am thinking of taking drawables for controls from M3 release, as our target resolution is 240x320.
пятница, 19 сентября 2008 г.
!
My head is boiling - I'm trying to understand how activity is created & managed, what is the difference between Window and IWindow, WindowManager & IWindowManager, where Window comes from, and how to emulate all that.
This is no piece of cake.
This is no piece of cake.
четверг, 18 сентября 2008 г.
News
Ohh, it's been 6 days again.
The news:
The news:
- I moved my test project from WTK+EclipseME to microemulator. It offers good compromise between developing with J2ME classes and having J2SE classes. So I don't need to hack'n'port SE classes from javolution and harmony in order to do actual porting of Android's classes.
- I'm slowly implementing AssetManager class. Today I discovered that Resource.Theme have that applyStyle method which allows you to apply many styles to theme. Now I need to implement that.
- I implemented Resources.obtainStyledAttributes method. It correctly obtains attributes, first from parser, then from style(s).
- Also, I'm not alone again. Guna, who wished to participate from the day one, showed up again.
пятница, 12 сентября 2008 г.
Puzzle
Here is a puzzle:
It is said that when you obtainStyledAttributes(AttributeSet...) and you have attribute defined in xml - you will get that attribute (not from style, not from theme).
And later you can peekValue on returned TypedArray. And you can check type of that value.
But where did type come from? There is no method in AttributeSet, which returns type.
Hint: try suppliyng your own AttributeSet implementation in obtainStyledAttributes.
It is said that when you obtainStyledAttributes(AttributeSet...) and you have attribute defined in xml - you will get that attribute (not from style, not from theme).
And later you can peekValue on returned TypedArray. And you can check type of that value.
But where did type come from? There is no method in AttributeSet, which returns type.
Hint: try suppliyng your own AttributeSet implementation in obtainStyledAttributes.
1 month!
One month ago I started a topic about porting Android to J2ME in android-developers group.
Originally I didn't want to work on this alone, so I started a topic to find more enthusiasts. Several people responded, so I started to look into ways to port more closely. Unfortunately all those participant soon lose their interest. But I didn't! So I'm working on this alone.
Progress is as follows:
Originally I didn't want to work on this alone, so I started a topic to find more enthusiasts. Several people responded, so I started to look into ways to port more closely. Unfortunately all those participant soon lose their interest. But I didn't! So I'm working on this alone.
Progress is as follows:
- Binary xml & arsc files reversed & parsers for them are written
- Started implementation of AssetManager & Resources classes
- Nine-patch png chunk reversed, parser written, drawing code implemented
- Started implementation of Canvas, Paint, Bitmap & Typeface classes
- Subset of J2SE classes are ported from javolution
- Possibility of using retroweaver to bring Java 5 features investigated (too many effort needed, left for future)
вторник, 9 сентября 2008 г.
First 9-patch drawable is drawn!
We all love screenshots!
Here you can see 9-patch drawable parsed and drawn.
Code draws image from raw image data and uses drawRGB function (which I took from microemulator), so porting to J2ME is no problem.
Still, I dont know how to scale 9-patches down. The drawable shown has only 2x2 scalability area, so you just can't scale it down beyond [width-2]x[height-2]. I didn't try to scale down in emulator, though. It well may be impossible.
Here you can see 9-patch drawable parsed and drawn.
Code draws image from raw image data and uses drawRGB function (which I took from microemulator), so porting to J2ME is no problem.
Still, I dont know how to scale 9-patches down. The drawable shown has only 2x2 scalability area, so you just can't scale it down beyond [width-2]x[height-2]. I didn't try to scale down in emulator, though. It well may be impossible.
воскресенье, 7 сентября 2008 г.
Status...
Wow, it's been 5 days!
OK, progress is as follows: I am implementing content.res & graphics classes. Yes, in parallel.
I've discovered and partly reversed that npTc PNG chunk, which holds nine patch information.
I've also finished reversing AXML. I am updating AxmlResourceParser now. So now I have only one value that I don't understand - that 0x00140014 flag(?) in START_TAG entry.
OK, progress is as follows: I am implementing content.res & graphics classes. Yes, in parallel.
I've discovered and partly reversed that npTc PNG chunk, which holds nine patch information.
I've also finished reversing AXML. I am updating AxmlResourceParser now. So now I have only one value that I don't understand - that 0x00140014 flag(?) in START_TAG entry.
среда, 3 сентября 2008 г.
<attr> format types
For some reason, Android's documentation about <attr> values is so poor.
I had to look into aapt.exe to find that you can specify these strings as format attribute value:
I will continue investigating this...
UPD: You can specify multiple format values!
Behold: <attr name="test" format="reference|color|fraction"/>
UPD2:You can specify two more attributes: l10n (localization) and type. Their values are ignored though (for now?).
UPD3: You can exclusively specify:
UPD4: Min:max values are not checked when specifying attribute value. Also, min can be larger than max. Not implemented, I guess.
I had to look into aapt.exe to find that you can specify these strings as format attribute value:
- reference
- string
- integer
- boolean
- color
- float
- dimension
- fraction
I will continue investigating this...
UPD: You can specify multiple format values!
Behold: <attr name="test" format="reference|color|fraction"/>
UPD2:You can specify two more attributes: l10n (localization) and type. Their values are ignored though (for now?).
UPD3: You can exclusively specify:
- min & max attributes
- enum child tags
- flags child tags
UPD4: Min:max values are not checked when specifying attribute value. Also, min can be larger than max. Not implemented, I guess.
понедельник, 1 сентября 2008 г.
Java 5 for J2ME
I'm thinking of starting new project, se4me (name can change) which will provide Java 5 library & features to J2ME users.
воскресенье, 31 августа 2008 г.
String & CharSequence
OK, I have a problem. J2ME's String class does not implement CharSequence interface. No surprise here - there is simply no such interface in J2ME. But all J2SE code assumes that String *is a* CharSequence. And this is a problem.
пятница, 29 августа 2008 г.
aapt list & dump
I've just discovered that aapt is capable of listing and dumping things.
"aapt list -a android.jar" provides dump of resources file inside android.jar.
"dump" command has interesting xmltree option, though I didn't manage to get it work. All attempts ended with "ERROR: dump failed because resource 003D3E27 found".
Anyway, now I know that 0x20000 signifies PUBLIC resource.
I don't know what thouse s=0x0008 and r=0x00 mean.
Also I don't know that signifies bag values - value 0x10 or flag 0x10000.
"aapt list -a android.jar" provides dump of resources file inside android.jar.
"dump" command has interesting xmltree option, though I didn't manage to get it work. All attempts ended with "ERROR: dump failed because resource 003D3E27 found".
Anyway, now I know that 0x20000 signifies PUBLIC resource.
I don't know what thouse s=0x0008 and r=0x00 mean.
Also I don't know that signifies
среда, 27 августа 2008 г.
Resources.arsc: first info
Well, I'm moving towards complete decompiler for resource.arsc.
For now I'm able to restore folders structure...
And now I have a spoiler: it seems that Android will come in these languages first: en,de,nl,es,cs. Yes, Czech. I wonder when there will be ru :)
For now I'm able to restore folders structure...
And now I have a spoiler: it seems that Android will come in these languages first: en,de,nl,es,cs. Yes, Czech. I wonder when there will be ru :)
вторник, 26 августа 2008 г.
Resources.arsc
I've reversed resources.arsc structure, and now I'm writing a "decompiler" for it.
One interesting thing: upon discovering what those 6 magic ints mean I found a bug - pixel density specifier is ignored.
One interesting thing: upon discovering what those 6 magic ints mean I found a bug - pixel density specifier is ignored.
понедельник, 25 августа 2008 г.
Hooray, blog!
Android4ME project got blog!
Current news: I've just finished StringBlock class, structure used in binary xml files and resources.arsc file.
What is next: creating reader for resources.arsc.
BTW, did you know you can create styled strings in Android?
E.g.: <string name="cool">Hello <b>World</b>!</string>
Also, what is R.plurals?
Current news: I've just finished StringBlock class, structure used in binary xml files and resources.arsc file.
What is next: creating reader for resources.arsc.
BTW, did you know you can create styled strings in Android?
E.g.: <string name="cool">Hello <b>World</b>!</string>
Also, what is R.plurals?
Подписаться на:
Сообщения (Atom)