XML serializer help - Android Q&A, Help & Troubleshooting

Hi guys, I'm very new to programming (especially Android/Java)
I was originally making a game using XNA/C# as I found a very good program called SpriteVortex and an example of how to animate irregular spritesheets.
However, i've lost interest in XNA (even though I find it amazing and easy to use) as I bought a Nexus 7 and want to program for it!
I've converted most of the SpriteAnimationManager class to Java however I can't get the serializer/deserializer to work! I even tried installing Simple however I don't understand programming well enough to use it.
The following 3 lines are giving me the biggest headaches:
The errors are :
Cannot instantiate the type XMLserializer
for this line: XmlSerializer serializer = new XmlSerializer(AnimationSet.class);
the XmlSerializer after "new" is in red.
the Method deserialize(XMLreader) is undefined for the type XMLserializer
in this line: animationSet = (AnimationSet)serializer.Deserialize(reader);
and finally: the method dispose() is undefined for the type XMLReader
in this line: reader.dispose();
The full class is here:http://pastebin.com/bK7V4LxX
Thanks in advance for any help as I've been stuck for a week now

Related

ADB Shell Woes

So I am trying to make a tool to use with the LG Ally for root and recovery, kind of like Unrevoked. All commands necessary can be done via ADB, all resources including adb can be placed in a resource folder.
I am having very frustrating issues as the Ally doesn't have Root on auto via adb, and adb root doesnt work properly. So I started using a batch file and fan into problems where when I issue adb shell su the script gets "stuck" in the shell and wont accept any input until the su shell terminates. If I adb shell su then close the window, the su permissions are NOT preserved.
I have moved on to visual basic, so I have a little more control, but I cannot for the life of me find out how to successfully pass commands to the shell the best I can do is open new shells for each command which is no good.
I know Im missing something and I know its something simple I just cant for the life of me figure it out
ok so I made a media player which is written in c# and it passes commands to adb...I can show you how to talk to shell via c# if you want.
Ok s how are you writing to shell one by one? Are you using a stream writer to a process?
At this point the commands are issued one by one.
I just installed vb 2k8, I think my problems lye in the deprecation of vb6 commands
Code:
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Shell("C:\android-sdk-windows\tools\adb.exe shell su")
SendKeys.Send("ls")
SendKeys.Send("{ENTER}")
End Sub
End Class
Im trying to keep it simple for now. This code will open up 2 cmd windows for some reason. and it doesnt pass the SendKeys.Send keys, I just end up with 2 cmd windows sitting at the #.
If I Shell("CMD.EXE") and try running adb commands with sendkeys, the keys sent will be jarbled, it moves around my keys (I would imagine because / is an escape char?)
I havent mucked about with vb in a few years so sorry for my noobism, Im good at bash scripting but this is very counter-intuitive
ok that is a bad way of doing it...no offense
Anyway, here's the proper way of sending shell commands one by one and getting back output...
objProcess = New System.Diagnostics.Process()
objProcess.StartInfo.FileName = ProcessPath
objProcess.StartInfo.WindowStyle = ProcessWindowStyle.Normal
objProcess.Start()
and you set processpath to be "cmd"
and you say objprocess.standardinput.writeline("whatever command you want")
and you say objprocess.standardoutput.readline() to return a string which you can display in a messagebox by saying "msgbox(string)"
-Hope this helps
None taken, my VB is weak like the ukraine, Im just trying to make a copy of my tool for windows, since most people use it. Thatsnks for the tips Im on the right track now, I think.
It is however giving me some trouble with objProcess.StandardInput.WriteLine...
Code:
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim objProcess = New System.Diagnostics.Process()
objProcess.StartInfo.FileName = "cmd"
objProcess.StartInfo.WindowStyle = ProcessWindowStyle.Normal
objProcess.Start()
objProcess.StandardInput.WriteLine("echo TEST")
End Sub
End Class
its still super simple in testing mode. This when ran gives me the error "StandardIn has not been redirected." Thanks for the help im currently researching to see if I can figure it out. If you have any more ideals let me know
Got it, thanks
heres is the working code for a test I did
Code:
Public Class Form1
Private WithEvents objProcess As Process
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
objProcess = New Process
objProcess.StartInfo.FileName = "cmd"
objProcess.StartInfo.WindowStyle = ProcessWindowStyle.Normal
objProcess.StartInfo.RedirectStandardInput = True
objProcess.StartInfo.UseShellExecute = False
objProcess.StartInfo.RedirectStandardOutput = True
objProcess.Start()
objProcess.StandardInput.WriteLine("C:\android-sdk-windows\tools\adb.exe kill-server")
objProcess.StandardInput.WriteLine("C:\android-sdk-windows\tools\adb.exe start-server")
objProcess.StandardInput.WriteLine("C:\android-sdk-windows\tools\adb.exe shell su")
objProcess.StandardInput.WriteLine("C:\android-sdk-windows\tools\adb.exe shell mkdir /sdcard/TEST")
End Sub
End Class
If it's useful, I have a technique to start an app, then to call the app again from the command line.
If the app is still running, it will process the command line. If it's not running, it simply launches a new instance and then processes the command line.
Let me know if you can use it.
Cheers
You Guys should look at the AndroidLib.dll it has adb/fastboot and device libraries already so you can just package 1 exe in your distro without the need to include or reference Adb and fastboot directly. Here is an example of a Form Button to reboot in to the bootloader.
Code:
private void button1_Click(object sender, EventArgs e)
{
AdbCommand adbrebootCmd = Adb.FormAdbCommand(device, "reboot bootloader");
Adb.ExecuteAdbCommand(adbrebootCmd);
android.Dispose();
}
The library also allows you to send AdbShell commands with Root access.
Really useful.

[Q] Angry Birds Rio encrypts settings/highscores with AES

Hey everyone,
i used to edit/backup my angry birds files. It worked fine with angry birds and angry birds seasons. But now with angry birds rio rovio encrypts the files with AES.
what i know so far from IDA pro:
for example GameLua::loadLuaFileToObject does
=> io::FileInputStream::read
=> lang::AESUtil::AESUtil(...)
=> lang::AESUtil::decrypt(...)
So,
are any IDA excperts here who might help me figuring out the arguments to that decrypt call( the AES key). Or do you have any ideas on how to figure out the AES key at all?
Greets, Goddchen
Goddchen said:
Hey everyone,
i used to edit/backup my angry birds files. It worked fine with angry birds and angry birds seasons. But now with angry birds rio rovio encrypts the files with AES.
what i know so far from IDA pro:
for example GameLua::loadLuaFileToObject does
=> io::FileInputStream::read
=> lang::AESUtil::AESUtil(...)
=> lang::AESUtil::decrypt(...)
So,
are any IDA excperts here who might help me figuring out the arguments to that decrypt call( the AES key). Or do you have any ideas on how to figure out the AES key at all?
Greets, Goddchen
Click to expand...
Click to collapse
I'm afraid you can't decrypt an AES key with a current PC, considering it would take some good millions of years to bruteforce.
Your best bet would be finding an exploit into how the game implements this encryption, I guess.
sorry you might have misunderstood me.
i don't want to crack the key, i simply want to extract it. it has to be stored in the file somewhere.
Ever tryed the old fashion way of searching addys maybe even reversing the whole game? Wait I'm a computer game hacker idk about adroid games lol sorry uhmm I'm sure you can reverse enough to find the file but then again could it possibly be stored outside of the game itself?
Sent from my Vision using XDA Premium App
yes that's exactly what i want to do. i have already found the file loading/saving function that use the AESUtil, but i can't figure out where the actual key is stored
Could you have a look at it if i send you the binary file?
Greets, Goddchen
Yeah send them all to me every one you can find and I will search away hopefully its not somthing stupidly named that throws me off...and why hack a game like this anyways?
Sent from my Vision using XDA Premium App
Also have you tryed opening it up with a hexeditor? I know I know billions of lines of useless numbers for what you want but there is a chance it will be labled in there somewhere
Sent from my Vision using XDA Premium App
Yes i did that, and also decompiled the whole thing with IDA pro. That's why i know it's AES, because the read / write function use the AESUtil functions. But i can't figure out the address where the key is located...
Have you searched for aes or key I know it might sound funny but time after time I've found addys that way and and I toatally forgot that you used ida I use that to decompile dlls and mem dumps for my hacking on games...but pm me the files (idk never tryed sending files on here before so I'm not sure if its possible here if not pm for my email)
Sent from my Vision using XDA Premium App
you already have a PM
All assets/*/*.lua files are encrypted using AES, CBC mode with empty initial vector and 256-bit key = 'USCaPQpA4TSNVxMI1v9SK9UC0yZuAnb2' (yes, ascii only). After decryption you will see 7z file with real *.lua file inside.
Example in Python:
Code:
from Crypto.Cipher import AES
AES.new('USCaPQpA4TSNVxMI1v9SK9UC0yZuAnb2', AES.MODE_CBC, '').decrypt(open('MainMenuPage.lua', 'r').read())
You should see a string starting with "7z" and after saving it to a file you should be able to open it using any 7z archiver.
Still I don't know about highscores.lua and settings.lua - these files are different. I'm afraid they aren't 7z files, so even if I'll decrypt them successfully, I'll just get some unknown binary files.
wow i'm impressed! where did you get the key from?
Hm, when trying to decrypt the highscores.lua or settings.lua i keep getting
"java.io.IOException: last block incomplete in decryption".
Do you have any experience with Java AES encryption?
I've played with this a little.
The provided key does decrypts other LUAs, but not the highscores...
They either used another key or messed up something after applying encryption.
The error is javax.crypto.BadPaddingException: Given final block not properly padded
Again, I was able to decrypt level LUAs to plain 7z.
BTW: The highscores.lua is a plain text if decrypted correctly.
yes it should be plain lua files. This is the case for Angry Birds and Angry Birds Seasons, just RIO is encrypted
Can you please explain how to got your hands on the key you mentioned? Maybe this help me track down the key used to encrypt the highscores/settings.
Greets, Goddchen
still no progress
i also had a look at a hprof heap dump but counldn't find anything that looks like a 256 bit aes key...
Any more ideas?
highscores.lua and settings.lua are encrypted with AES, CBC mode, PKCS7 padding and key = '44iUY5aTrlaYoet9lapRlaK1Ehlec5i0'.
In my next post I will describe how I got these keys
Man! This is totally awesome! You're my hero!
Well... I have attached a debugger to native code, set breakpoints, analyzed registers, memory, etc. It wasn't that easy though. It took me several days to start debugging and get first key, but I got second one in about 1 hour.
Actually I don't really need that key, I can't even play Angry Birds Rio on my old G1, but it was challenging and I love challenges ;-) Plus I have learnt a LOT about gdb, assembler, ARM architecture, etc.
So I want to thank you, Goddchen, for giving me an opportunity to learn & play
Ok, let's move on...
First, I have disassembled libangrybirds.so using IDA Pro 5.5 . I was able to examine code and attach IDA to gdbserver on a device, but unfortunately it wasn't working properly. IDA was thinking that libangrybirds.so is a main binary of a process it attached to, but it should look into loaded shared libs instead. Weird, but I didn't find a way to attach it properly. And this is pity, because IDA is a great tool and it would make debugging a pleasure, but I had to use gdb instead.
Second, Android has problems with debugging multi-threaded native code. MT support was added in NDK r5 and because of some bug it's not possible on a system older than Gingerbread.
Third, you could attach gdb manually, but ndk-gdb script does great work for you. You will have to do some tricks to use it with 3rd party app though.
Fourth, it seems libangrybirds.so is a Java code compiled to native or something like that. There are objects like FileInputStream, ByteOutputStream, etc., but there are also some API differencies. We'll see String and Array<uchar> objects, but it's usually easy to find a pointer to simple uchar[].
Steps to start native code debugging:
Upgrade to Gingerbread (Yeah, I had to do that. Hacking requires you to sacrifice yourself a bit ;-) ). Or you could use an emulator.
Install NDK >= r5 .
Decode Angry Birds Rio using apktool. You could just unzip it, but decoded app is much more similiar to original sources, so it's more compatible with NDK. For example ndk-gdb reads AndroidManifest.xml to get package name. Of course you could fake simple AndroidManifest.xml and other files if you want.
Rename lib dir to libs.
Fake jni/Android.mk file. I have copied one from hello-jni sample and didn't even bother to modify module name: http://pastebin.com/HMBXt5cm .
Copy libs/armeabi*/libangrybirds.so to obj/local/armeabi*/ . Normally this is done by ndk-build command.
Fake libs/armeabi*/gdb.setup file. It should be something like: http://pastebin.com/BYm13RKz , but second line isn't that important.
Angry Birds Rio apk contains old gdbserver and you need one from NDK r5. Grab ${NDK_ROOT}/toolchains/arm-linux-androideabi-4.4.3/prebuilt/gdbserver and push it to /data/data/com.rovio.angrybirdsrio/lib .
Ufff... you could now try to run: ndk-gdb --verbose --launch=com.rovio.ka3d.App .
After few seconds you should see "(gdb)" prompt and game should be paused on the device.
Run 'info shared' and check if libangrybirds.so is loaded. If not then something is wrong.
Ok, let's find a key for levels lua files:
Set a breakpoint for GameLua::loadLevel() - find this method in IDA Pro and copy its EXPORT name:
Code:
(gdb) br _ZN7GameLua9loadLevelEN4lang6StringE
Breakpoint 1 at 0x80468e4c
Resume game and open some level. You should hit a breakpoint:
Code:
(gdb) c
Continuing.
[New Thread 5857]
[Switching to Thread 5857]
Breakpoint 1, 0x80468e4c in GameLua::loadLevel () from /home/brutall/t-angrybirds/com.rovio.angrybirdsrio-1/obj/local/armeabi/libangrybirds.so
Look into IDA and note there are 2 lang::String objects passed as first arguments to method, so pointers are in R1 and R2 registers. We need to examine these objects and find pointers to raw char[]. Fortunately lang::String is very simple wrapper around char[], so pointer is first (and only one, I think) member of String:
Code:
(gdb) x/4x $r1
0x4395e66c: 0x00a405f0 0x00153b28 0x804ec778 0x00000000
(gdb) x/s 0x00a405f0
0xa405f0: "levels/warehouse/Level190"
Yey, finally we see something
Let's move to lang::AESUtil::decrypt() method. It's named _ZN4lang7AESUtil7decryptERKNS_5ArrayIhEES4_RS2_, so:
Code:
(gdb) advance _ZN4lang7AESUtil7decryptERKNS_5ArrayIhEES4_RS2_
0x80539894 in lang::AESUtil::decrypt () from /home/brutall/t-angrybirds/com.rovio.angrybirdsrio-1/obj/local/armeabi/libangrybirds.so
As you can see decrypt() gets 3 Array<uchar> objects and 2 of them are const. It's quite easy to guess they're: key, encrypted data and container for decrypted data. Let's check this:
Code:
(gdb) x/4x $r1
0x1592b0: 0x00159528 0x00000020 0x00000020 0x7b206e65
0x00000020 = 32 - yes, length of AES key First 4 bytes of an Array object is a pointer to raw char[] and second 4 bytes contain length of an array. Now we could read contents of an Array:
Code:
(gdb) x/s 0x00159528
0x159528: "USCaPQpA4TSNVxMI1v9SK9UC0yZuAnb2a"
As you can see there are 33 chars instead of 32. This is because Array stores its length, so char[] isn't null-terminated. Ignore last "a" char.
We could also look into second const Array to be sure that encoded string is exactly the same as contents of lua file:
Code:
(gdb) x/4x $r2
0x4395d6f4: 0x009ca248 0x000004a0 0x000004a0 0x00000378
(gdb) x/4x 0x009ca248
0x9ca248: 0x3347b5dc 0x26048446 0x1a0c1231 0x35d3f99c
First 16 bytes are the same, length of data is also ok.
As you can see there is AES::BlockMode passed to AES:ecrypt(). It would be quite hard to interpret it without headers, so I was trying various block modes and I found that CBC with empty initial vector decodes to string starting with '7z'. For me that meant: mission successfull
Ok, highscores.lua and settings.lua files now. Technique is very similar, but there are some differences:
Different keys.
They aren't loaded using GameLua::loadLevel(), but GameLua::loadPersistentFile(). You could find this very easily, searching for "highscores.lua" in IDA.
If you examine GameLua::loadPersistentFile() method you will see it doesn't load files using FileInputStream, but io::AppDataInputStream, so we have to be sure, what exactly is being decrypted.
Annoying thing is that gdb can't catch highscores/settings loading, because they're loaded too soon - before gdb attach itself.
Maybe there is a better solution to last problem, but I've decided to add some Thread.sleep() call just after System.loadLibrary(), so gdb will attach before highscores.lua loading.
Open smali/com/rovio/ka3d/App.smali, and add 2 lines of code just after loadLibrary() call in onCreate() method:
Code:
invoke-static {v0}, Ljava/lang/System;->loadLibrary(Ljava/lang/String;)V
const-wide/16 v0, 5000
invoke-static {v0, v1}, Ljava/lang/Thread;->sleep(J)V
Run ndk-gdb --verbose --launch=com.rovio.ka3d.App .
Set a breakpoint for GameLua::loadPersistentFile() method and check which file is being loaded:
Code:
(gdb) br _ZN7GameLua18loadPersistentFileERKN4lang6StringE
Breakpoint 1 at 0x80457030
(gdb) c
Continuing.
[New Thread 6735]
[Switching to Thread 6735]
Breakpoint 1, 0x80457030 in GameLua::loadPersistentFile () from /home/brutall/t-angrybirds/com.rovio.angrybirdsrio-1/obj/local/armeabi/libangrybirds.so
(gdb) x/s $r2
0x4395e3b8: "highscores.lua"
I'm not sure why it's R2, not R1 and why there is no lang::String, but char[] directly. I think this isn't a pointer to String, but String itself, passed to method in registers, so its char[] is in R2.
Now advance to lang::AESUtil::decrypt() method and read key as usual:
Code:
(gdb) advance _ZN4lang7AESUtil7decryptERKNS_5ArrayIhEES4_RS2_
0x80539894 in lang::AESUtil::decrypt () from /home/brutall/t-angrybirds/com.rovio.angrybirdsrio-1/obj/local/armeabi/libangrybirds.so
(gdb) x/4x $r1
0x159294: 0x00159620 0x00000020 0x00000020 0x00159518
(gdb) x/s 0x00159620
0x159620: "44iUY5aTrlaYoet9lapRlaK1Ehlec5i0"
Because of that AppDataInputStream object, we need to check if encrypted data is the same as file contents. Pull highscores.lua file from a device and run:
Code:
(gdb) x/4x $r2
0x4395ddc4: 0x0015bc00 0x00000040 0x00000040 0x00000001
(gdb) x/16x 0x0015bc00
0x15bc00: 0x2271b777 0xe6f19f4c 0x2489a316 0xfae1aee2
0x15bc10: 0x82e0ef38 0xe84fc25d 0xb196adac 0xbf030439
0x15bc20: 0xb6b9bade 0x3046af12 0xe8eeeb0d 0x20e8037c
0x15bc30: 0x1a405edf 0xc218f7f6 0xc29209e2 0x9ad03e8c
Yeah, this is my highscores.lua file.
Same for settings.lua file to check if it's encrypted with the same key. It is.
After decrypting these files we'll see some weird chars at the end of decoded data. Few seconds on the Wikipedia and we'll know this is just PKCS7 padding scheme.
Now we have got everything we want
Ahh, not exactly everything... I would be really happy to know, how to properly attach IDA for debugging - it would be much easier, even if gdb interface is also very good.
wow thank you so much for that detailed description. I'll give a try in the next days to see if i can reproduce the whole thing on my own I'm really impressed

[ISSUE SOLVED]CM9 compiling error

Hi guys I am kind of a noob when it comes to linux and compiling and have hit a brick wall. I posted this question here in Q&A and in Chef central so hopefully someone has an idea. I have been trying to compile CM9 for about three days now and no matter what I do I get this output. It is 95% of the time after the "install libwebcore.so" line.
Code:
install: out/target/product/maguro/system/lib/libwebcore.so
UNEXPECTED TOP-LEVEL ERROR:
java.lang.OutOfMemoryError: GC overhead limit exceeded
at com.android.dx.util.IntList.(IntList.java:87)
at com.android.dx.rop.code.RopMethod.calcPredecessors(RopMethod.java:154)
at com.android.dx.rop.code.RopMethod.labelToPredecessors(RopMethod.java:95)
at com.android.dx.dex.code.RopTranslator.pickOrder(RopTranslator.java:352)
at com.android.dx.dex.code.RopTranslator.translateAndGetResult(RopTranslator.java:212)
at com.android.dx.dex.code.RopTranslator.translate(RopTranslator.java:106)
at com.android.dx.dex.cf.CfTranslator.processMethods(CfTranslator.java:293)
at com.android.dx.dex.cf.CfTranslator.translate0(CfTranslator.java:134)
at com.android.dx.dex.cf.CfTranslator.translate(CfTranslator.java:87)
at com.android.dx.command.dexer.Main.processClass(Main.java:483)
at com.android.dx.command.dexer.Main.processFileBytes(Main.java:455)
at com.android.dx.command.dexer.Main.access$400(Main.java:67)
at com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:394)
at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:245)
at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:131)
at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:109)
at com.android.dx.command.dexer.Main.processOne(Main.java:418)
at com.android.dx.command.dexer.Main.processAllFiles(Main.java:329)
at com.android.dx.command.dexer.Main.run(Main.java:206)
at com.android.dx.command.dexer.Main.main(Main.java:174)
at com.android.dx.command.Main.main(Main.java:95)
make: *** [out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/noproguard.classes-with-local.dex] Error 3
Before I tried to compile CM I did successfully compile AOSP for my Gnex. I have searched and tried everything I could find. I've tried these values in the common.py file and just about every combo I could think of per recommendations I found online.
Code:
check = (sys.maxsize > 2**32)
if check is True:
cmd = ["java", "Xmx2048m", "-jar",
os.path.join(OPTIONS.search_path, "framework", "signapk.jar")]
else:
cmd = ["java", "-Xmx1024m", "-jar",
os.path.join(OPTIONS.search_path, "framework", "signapk.jar")]
I have also checked my swap and as far as I can tell its there and working but it seams to never be used. I have tried all the commands I could find online to make sure it was enabled but Idk what else to try or check.
Also I am using a quad core AMD with 6GB of RAM if anyone is curious. Any and all advice/ideas would be very much appreciated at this point I am at a complete loss. Thanks for looking and helping guys.
EDIT:I just finished a successful build of AOSP for my galaxy nexus so I am really confused as to why I run out of memory for CM9.
Sky-
A fresh install of Ubuntu 12.04 on a freshly formatted partition seemed to fix my memory issue.

Simple Question that I can't figure out -- String tokenizer w/ array

I'm a newbie when it comes to programming, but I'm having trouble. I've googled/searched for a while and can't solve this.
I'm reading input from a file and inserting everything into a string array. Now, I have to convert the strings to integers, and put that into an array (which I know how to do with parseInt), but the commas in the file are causing a number format exception.
I have to use the stringtokenizer to get rid of the commas but I can't figure out how to do it.
Do I use a for loop and do it line by line? Please advise.
sillymcnasty said:
I'm a newbie when it comes to programming, but I'm having trouble. I've googled/searched for a while and can't solve this.
I'm reading input from a file and inserting everything into a string array. Now, I have to convert the strings to integers, and put that into an array (which I know how to do with parseInt), but the commas in the file are causing a number format exception.
I have to use the stringtokenizer to get rid of the commas but I can't figure out how to do it.
Do I use a for loop and do it line by line? Please advise.
Click to expand...
Click to collapse
What do you mean the "commas in the file"?
Are you doing this?
listArray.toString()
If so, it will use the "," separator. To get it into a String[] list now, do listArray.toString().split(", ")
I think you know how to do the rest. I would do it with a simple 3-line for-loop.
Sent from my Galaxy Nexus running Android 4.2 JB
Here is sample code how to use StringTokenizer:
StringTokenizer tok = new StringTokenizer("1,2,3,4", ",");
while (tok.hasMoreTokens()) {
System.out.println(Integer.parseInt(tok.nextToken()));
}

Need help with porting a TW package

Hi guys!
I'm trying to port some package from Samsung ROM to CM following this guide and I'm stuck.
I decompiled the package, removed TW dependency from the manifest and now I'm adding additional classes from TW framework into this package. Everything was smooth so far as I was getting rid of "class not found" and similar messages in logcat by adding the missing class and recompiling the package.
But now I'm facing an issue, which I don't know how to fix:
When I try to run the app, I get the following message in logcat:
Code:
I/dalvikvm(30301): Could not find method com.sec.android.touchwiz.widget.TwAbsListView.isInDialog, referenced from method com.sec.android.touchwiz.widget.TwAbsListView.onHoverDrawableState
W/dalvikvm(30301): VFY: unable to resolve virtual method 9561: Lcom/sec/android/touchwiz/widget/TwAbsListView;.isInDialog ()Z
D/dalvikvm(30301): VFY: replacing opcode 0x74 at 0x006c
TwAbsListView class derives from TwAdapterView (from TwAbsListView.smali):
Code:
.super Lcom/sec/android/touchwiz/widget/TwAdapterView;
TwAdapterView derives from android.view.ViewGroup, which derives from android.view.View, which has a definition for "isInDialog". This what I found when decompiled framework.jar from the stock ROM:
smali\android\view\View.smali
Code:
.method public isInDialog()Z
However, based on official documentation this method does not exist in this class.
If I try to add android.view.ViewGroup and android.view.View from stock framework.jar into the package explicitly, I start getting "multiple definition" messages in logcat, and isInDialog still can't be resolved.
So, I'm currently stuck. Please advise. Is there something I'm doing wrong or not doing?
I guess with my last edit, I answered my own question.
It looks like Samsung decided to change implementation of android.view.View class to include isInDialog() method.
I just tried moving the definition of this method into com.sec.android.touchwiz.widget.TwAdapterView class, which derives from android.view.ViewGroup, and it looks like I no longer getting the message about missing isInDialog method.
There are still a gazillion other methods like this, but at least it's clear now what needs to be done.

Categories

Resources