Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Readers > Amazon Kindle > Kindle Developer's Corner

Notices

Reply
 
Thread Tools Search this Thread
Old 02-06-2012, 04:01 PM   #1
MatzeMatz
Enthusiast
MatzeMatz began at the beginning.
 
Posts: 27
Karma: 10
Join Date: Dec 2011
Device: Kindle Touch
[Kindle Touch] Don't understand Java class structure

Hi,

I copied my /dev/mmcblk0p1 content to my PC and tried to understand the Java class structure.
But I think I miss a jigsaw piece...

In the Javascript files there are a lot of calls to the kindle.appmgr.start, e.g. like follows (from networkManager.js):
Code:
kindle.appmgr.start('com.lab126.booklet.settings?viewRequest=VIEW_REQUEST_ID_REGISTRATION');
I tried to find the class structure for "com.lab126.booklet" inside the jar files - but I miss.
The only jar file which I found which contains "com.lab126" classes is "/opt/amazon/ebook/lib/portability-impl.jar"
But only the subclasses "linux", "sound" and "util".
But in which jar is the booklet subclass?

What do I miss?
MatzeMatz is offline   Reply With Quote
Old 02-06-2012, 06:32 PM   #2
JustAMan
Groupie
JustAMan doesn't litterJustAMan doesn't litter
 
JustAMan's Avatar
 
Posts: 153
Karma: 113
Join Date: Jan 2012
Location: Russia
Device: Kindle Touch
I think you miss the thing that "com.lab126.booklet.settings" isn't a Java class at all. It's a handler being called that was installed by some Java class.
Try poking around /opt/amazon/ebook/lib with your favorite Java decompiler.
JustAMan is offline   Reply With Quote
Advert
Old 02-07-2012, 08:53 AM   #3
MatzeMatz
Enthusiast
MatzeMatz began at the beginning.
 
Posts: 27
Karma: 10
Join Date: Dec 2011
Device: Kindle Touch
@JustAMan: you're right - that was the part I missed - thanks!

I already decompiled the jars with JAD and currently also try JD-GUI to get a better class overview.
BUT: both decompiler seem to have a problem with method parameters
Both tools name _all_ parameters of a method and also local instances "a" - how can I distinguish them?
e.g.
Code:
public boolean registerUser(String a, char[] a)
and then later in the same method:
Code:
VersionInfo a = (VersionInfo)a.getService(...);
HashMap a;
a = new HashMap()).put("deviceType", a.getFamilyMember());
Very confusing

Am I doing something wrong with that tools?
And how can I get (re-)compilable code or derive from a built-in class?

I currently don't get it:
How am I able to write own code which uses amazon's existing functionality and how do I compile it, that it works on the device?.
MatzeMatz is offline   Reply With Quote
Old 02-07-2012, 06:18 PM   #4
bhaak
Groupie
bhaak can program the VCR without an owner's manual.bhaak can program the VCR without an owner's manual.bhaak can program the VCR without an owner's manual.bhaak can program the VCR without an owner's manual.bhaak can program the VCR without an owner's manual.bhaak can program the VCR without an owner's manual.bhaak can program the VCR without an owner's manual.bhaak can program the VCR without an owner's manual.bhaak can program the VCR without an owner's manual.bhaak can program the VCR without an owner's manual.bhaak can program the VCR without an owner's manual.
 
bhaak's Avatar
 
Posts: 164
Karma: 164969
Join Date: Dec 2011
Device: Palm IIIx, (iPhone|Kindle) Touch
Quote:
Originally Posted by MatzeMatz View Post

Am I doing something wrong with that tools?
And how can I get (re-)compilable code or derive from a built-in class?

I currently don't get it:
How am I able to write own code which uses amazon's existing functionality and how do I compile it, that it works on the device?.
No, you're not doing anything wrong. If you look at the compiled classes with a bytecode viewer, you'll see that all the parameters and variables are correctly id-ed (of course, otherwise the classes wouldn't be valid java classes) but that they are all named "a".

JAD and JD-GUI are both too stupid for such (slightly obfuscated) java classes as they rename all the variables without looking if there are any name clashes.

You'd need a decompiler that has the option of not trying to restore the "original" variable names.
bhaak is offline   Reply With Quote
Old 02-08-2012, 03:36 AM   #5
MatzeMatz
Enthusiast
MatzeMatz began at the beginning.
 
Posts: 27
Karma: 10
Join Date: Dec 2011
Device: Kindle Touch
Quote:
Originally Posted by bhaak View Post
You'd need a decompiler that has the option of not trying to restore the "original" variable names.
Do you (or anybody else) know one with such an option?
MatzeMatz is offline   Reply With Quote
Advert
Old 02-08-2012, 06:02 AM   #6
hostar
Zealot
hostar is a glorious beacon of lighthostar is a glorious beacon of lighthostar is a glorious beacon of lighthostar is a glorious beacon of lighthostar is a glorious beacon of lighthostar is a glorious beacon of lighthostar is a glorious beacon of lighthostar is a glorious beacon of lighthostar is a glorious beacon of lighthostar is a glorious beacon of lighthostar is a glorious beacon of light
 
Posts: 138
Karma: 12324
Join Date: Dec 2011
Location: CZ
Device: Kindle 4 non-touch
Quote:
Originally Posted by MatzeMatz View Post
Do you (or anybody else) know one with such an option?
I use this one:

http://java.decompiler.free.fr/
hostar is offline   Reply With Quote
Old 02-10-2012, 03:44 AM   #7
MatzeMatz
Enthusiast
MatzeMatz began at the beginning.
 
Posts: 27
Karma: 10
Join Date: Dec 2011
Device: Kindle Touch
Quote:
Originally Posted by hostar View Post
THis JD-GUI which I already tried (see above).
AFAIK this one is not able to create own variable names. It has the "all variables of a method are named 'a'" problem...

Or is there an option I didn't find?
MatzeMatz is offline   Reply With Quote
Old 02-10-2012, 05:09 AM   #8
hostar
Zealot
hostar is a glorious beacon of lighthostar is a glorious beacon of lighthostar is a glorious beacon of lighthostar is a glorious beacon of lighthostar is a glorious beacon of lighthostar is a glorious beacon of lighthostar is a glorious beacon of lighthostar is a glorious beacon of lighthostar is a glorious beacon of lighthostar is a glorious beacon of lighthostar is a glorious beacon of light
 
Posts: 138
Karma: 12324
Join Date: Dec 2011
Location: CZ
Device: Kindle 4 non-touch
Quote:
Originally Posted by MatzeMatz View Post
THis JD-GUI which I already tried (see above).
AFAIK this one is not able to create own variable names. It has the "all variables of a method are named 'a'" problem...

Or is there an option I didn't find?
Ok, I haven't notice that, sorry.
But I think it is dissassembled without any change of variable names,
the "a" name is obfuscated name of original variable names which is in *.class file.
hostar is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
PRS-650 SD Card Importance? SDHC, SDHC Class 4, Class 10 etc is it important Renji Sony Reader 11 12-03-2011 12:30 PM
Kindle 3, Nook Simple Touch, Kobo Touch and Libra Pro Touch jbcohen Which one should I buy? 4 06-18-2011 07:58 PM
[old thread] filename and library structure /author and titel structure tscamera Library Management 4 05-31-2011 05:44 PM
Kindle case and Amazon class action? Kevin R Amazon Kindle 0 08-08-2010 11:53 PM
[Apple]Java Embedding Plugin 0.9.2: Force java to run in browsers other than Safari Zire Lounge 4 05-24-2005 09:12 PM


All times are GMT -4. The time now is 04:26 AM.


MobileRead.com is a privately owned, operated and funded community.