DeadObjectException - Thinkpad Tablet General

In an attempt to figure out what is slowing down my device I connected ADB to my Thinkpad tablet and have found that I get a dead object exception as about half the lines in my log file.
Code:
D/AsyncChannel( 150): TODO: handle sendMessage RemoteExceptionandroid.os.DeadObjectException
Can someone point me in the right direction on how to figure out what is sending this error? process 150 is the system server so I don't think its that.
Thanks,
S

I think that it's something with syncing. Part of a code is't working well and it's slowing down tablet in trying to sync something.

Moved To General​
Sorry, there is no development here, should be in general​

Related

[Q] Processing large Spanned objects with TextView (setText)

Well, to give you a bit of history on this project - I'm parsing a string that's about 100k in a child thread, and returning the Spanned object from Html.fromHtml().
The issue is when it returns to the main thread - when trying to setText using the Spanned that was just created in another thread, it takes quite a long time processing it from a Spanned object into a displayable format (setText).
I would normally process this in the child thread, but unfortunately, since this is related to the UI, I can't - has to be on the main thread. So, my question is whether there is a way to process the Spanned into something easily interpreted by the setText, so that it doesn't spend a lot of time on the main thread processing it after the child thread has finished.
Code:
testQuestionsExplanations.setText(spannedExplanationsObj);
My biggest issue is that it locks the main thread down doing this.
I'm not sure I understand the problem. If the processing is already being done in a separate thread, why the hang? Are you running the thread synchronously? Couldn't you use a handler, process the thread asynchronously, then send the handler a message once the thread is done?
Gene Poole said:
I'm not sure I understand the problem. If the processing is already being done in a separate thread, why the hang? Are you running the thread synchronously? Couldn't you use a handler, process the thread asynchronously, then send the handler a message once the thread is done?
Click to expand...
Click to collapse
That's what I'm doing already - it sends a message to the handler once the child thread has finished.
The problem lies with the following line - it takes roughly 10 seconds to write the 'Spanned' object to the screen. If i spit out the pure text (minus the html tags), it writes it in about 1 second, but I'm assuming that it has to process/render the Spanned object into something that it can display on the screen.
Code:
testQuestionsExplanations.setText(spannedExplanationsObj);
I found a work around for my problem.
Instead of sending the whole Spanned object and getting it processed onto the TextView all at once, I'm sending smaller pieces, and just appending them to the TextView.
This way my ProgressDialog doesn't lock up completely - it's jerky, but it's better than not moving at all.

[Q] imaginary project error + programming help

As I mentioned in the previous thread (which may be deleted now), I'm playing with the snake sample game. I was trying to create a menu following this guide (the XML way). I did exactly as the guide says but when I tried to run the project, the console said "main.out.xml: Error parsing XML: no element found".
Now there's an error in the project, but all files seem valid (there's a red cross sign next to the project, but not next to any one of the files). When I try to run the project, it tells me to fix the errors. WTF ? This is driving me crazy
Of course I tried googling, but I found nothing that could help me.
Another thing I wanted to do with the Snake app is change the way the snake is controlled - instead of keyboard I want it to be controlled either by swipe or by the accelerometer. Can any1 help me with that ?
I already got swipe, now off to accelerometer movement.
And any help with the menu thing would be appreciated too.
Guys help me out here. I'm trying to make a menu for the snake app, so one could set up things like max. apples at a time, move delay decrease rate and stuff like that. How should I do this ?
I thought of creating a new activity for the options which will be called from the menu (this menu will be shown after pressing the menu button). Is that a good solution ?
Seriously... WHAT THE **** ?!?!
I create a folder under 'res' named 'menu'. I create a file under 'menu' named 'menu.xml'. I instanly get an error message : 'error: Error parsing XML: no element found'. Now I can do whatever the **** I want (I put some menu items in it), I will NEVER EVER launch the app again, because it says there's an error in the project even though there are NO ****ING ERRORS ! FFFFFFFFFFFFFUUUUUUUUUUUUUUUUUUUUUUUU
grandioso said:
I did exactly as the guide says but when I tried to run the project, the console said "main.out.xml: Error parsing XML: no element found".
Click to expand...
Click to collapse
Are you sure you didn't try to run the .xml file instead of the whole project? When you do that you get an error, a 'main.out.xml' file and your app wont run until you delete it
For the first time I did. But the app didn't run even after I restored everything to the previous state. I had to delete the whole project and create it again.
Now I didn't even press the run button - I got the error right after creating the xml file.
But now I get it - I can create a menu, but I always have to delete the project (keep the files) and create it again. Kinda sucks.
Now please could any1 give me advice on how to handle the snake by tilting the phone ? I googled my ass off, but didn't find anything I could use.
grandioso said:
For the first time I did. But the app didn't run even after I restored everything to the previous state. I had to delete the whole project and create it again.
Now I didn't even press the run button - I got the error right after creating the xml file.
But now I get it - I can create a menu, but I always have to delete the project (keep the files) and create it again. Kinda sucks.
Now please could any1 give me advice on how to handle the snake by tilting the phone ? I googled my ass off, but didn't find anything I could use.
Click to expand...
Click to collapse
Next time you get an error, try simply deleting it from the error log. Eclipse is buggy as hell and sometimes that can fix things (if not the error will just appear again).
As for using the accelerometer, i can't really help you but it looks pretty complicated!
Try looking through the source code of "Amazed" - http://code.google.com/p/apps-for-android/source/browse/#svn/trunk/Amazed/src/com/example/amazed - It may be of some help!
Well if it's complicated then screw it, I don't have much time to funk around.
I'll try the menu, but I'm still not sure if I shoul create an extra activity for the menu. How do I save the settings if I do ?
Meltus said:
As for using the accelerometer, i can't really help you but it looks pretty complicated!
Click to expand...
Click to collapse
That's an overstatement. It's a lot simpler to do than implementing your own listview adapter, for example.
Anyway, all you need to is just let your class implement SensorListener. Then you will need to override two methods; onSensorChanged and onAccuracyChanged. Each are pretty explanatory. Inside onSensorChanged however you will need to check the sensor type, and before you can listen to the sensor you need to register it with the SensorManager (system service). Remember to unregister when you don't need it any more else it will just pointlessly suck battery.
There are many tutorials, but it is really easy to do. Just Google them if unsure, the link posted by Meltus doesn't make it easy to see how it's meant to be used.
OK, first I need to make the menu work.
So first I need to create an activity that extends PreferenceActivity. Then I create a preferences.xml file and an arrays.xml file, that's more or less clear to me.
What bothers me is that I only found 4 types of Preferences - List Preference, EditText Preference, Checkbox Preference and Ringtone Preference. Is that it ? A ****load of apps uses a number choosing preference, where you have a text input a + and a - button - did they all have to create a custom preference type ?
And I have one more dumb question - I just can't for the life of me call the damn preference activity. How do I do that ?
OK, preferences are all done.

LiveView reverse-engineering effort

Hi all,
A few weeks ago I started taking apart the LiveView software and manager. I'm really unhappy with the current plugin system, the menu structure and more. So, I started to reverse-engineer the Bluetooth protocol. I'm at the very beginning but it's looking promising.
Here's the repo: https://github.com/BurntBrunch/LivelierView
The protocol is not very difficult - just request-acknowledge-response serial communication over RFCOMM. Also, the kind people from SE didn't run the manager through Proguard (wink, wink, nudge, nudge ).
I also have what I *think* is a dump of the firmware but it seems either compressed or encrypted. Binwalk didn't find anything in it. If someone would be kind enough to take apart the software updater, we might figure out what's running on the actual device as well.
Overall, I'm just starting but so far it's looking good (got time syncing working! it's at least a watch, if nothing else! ).
Any help would be greatly appreciated (pull requests are more than welcome! )
thinking of doing something similar with one of my gadgets.
What did you use to reverse-engineer the Bluetooth protocol, just wireshark and a bluetooth dongle
Neither Did it from disassembly of the manager - much easier than sniffing and guessing.
If you don't have that option and said gadget connects to an Android phone, put on a decent ROM with the full BlueZ stack (e.g., Cyanogen) and use hcidump. It's really, really useful!
Come to think of it, Wireshark might be good enough - the only thing I found useful about hcidump was the SCO audio dump.
Nice effort. I've already forked your work on github, might have a look at it soon, I got some geeky ideas for myself as well, and I think integrating this functionality natively on CyanogenMod or even a custom app to replace the SE's one would be great to have as well.
Nice,
i'm was disapointed by the liveview manager myself, i hope something good emerges from your work
I've also decompiled the APK, and it seems that everything that displays on screen comes from the application, which means everything could be costumized. Seems like SE is using a PNG lib LodePNG to convert images and pushing them to the phone. Also, when it comes to strings, I've found some useful references in JerryProtocol that might indicate how the correct text encoding (not that we can push it right now, but just for the record):
Code:
private static final String mEncoding = "iso-8859-1";
private static final char cCarriageReturn = '\r';
private static final char cLineFeed = '\n';
Controlling the led seems quite simple to, it seems message's data is divided in 3 parts:
[RGB] [DELAY = Integer Number] [ON STATE = 0|1]
[old]although I've not figured out the ID of the LED control yet[/old].
LED request ID is 40 and LED response ID is 41. Hope this is enough for you to get started on that one too
I've not yet tested the app, but I've read your code and gave a shot at decompiling trying to see what I could dig up, will try it later (not very used to running python scripts though, will have to see how to install pyserial first and all that)
pedrodh said:
it seems that everything that displays on screen comes from the application
Click to expand...
Click to collapse
Yup, the main stuff is on the phone - the state machine is clearly isolated (on a side note, the manager is rather well-written, thankfully). On the other hand, I'm somewhat confused by all the constants - it almost feels as if the device has native navigation or icon cache or something.
pedrodh said:
Controlling the led seems quite simple to, it seems message's data is divided in 3 parts:
[RGB] [DELAY = Integer Number] [ON STATE = 0|1]
LED request ID is 40 and LED response ID is 41. Hope this is enough for you to get started on that one too
Click to expand...
Click to collapse
Thanks for the interest and the tip, I'll look into it soon - I need to figure out a good way to send commands from stdin. It seems that I'll need to figure out non-blocking reading in Python anyway (good news for you - I might drop pyserial! )
In any case, I'll add it to protocol.txt, unless you beat me to it!
Lastly, the only reason it's in Python is 'cause I'm productive in it *and* it has good, fast bindings (I try to stay away from gobject in C!). Whatever comes out of this effort would be running on the phone, surely
Edit: You *did* beat me to it!
Edit: Implemented LED, vibration, and a pretty good scheme for sending commands from the CLI
Nice work, saw quite a few commits in a small amount of time.
I've not yet been able to run it sucefully, I (think) have installed pyserial correctly, but maybe the problem is that the bluez that comes with my ubuntu is somewhat newer than the one you used, anyway here's as far as I got http://pastebin.com/uVRdr5T3 if you by chance know just by looking at it what it is would be great .
I've started an Android applicatoin Project in hopes of porting this to an Android application as well, but I'm somewhat new to Bluetooth handling on Android, still working it out. I'm already able to connect and pair with device (noob stuff), but it fails to READ from it. I've used java's DataOutputStream and DataInputStream since they deal with data in a big-endian notation, but I haven't understood yet how the initialization process goes. I've looked to your code, I get some parts but not the whole thing yet. Do you have to wait for the LiveView to tell something back, or you can just start to send commands at random? Also, does the script act as a bluetooth server or client (it seems that they are distinct when coding in Android, I've choosen to Connect as a Client, and yes I used the same UUID that you got from decompiling so at least that part I guess to be correct) ?
Anyway is just a bunch of very ugly code at the moment, after I get it to do something usefull I'll clean up the project and host it on github as well.
Hmm, that error is rather suspicious. Looking at the docs, Connect() is not even supposed to throw org.bluez.Failed, let alone with that message. And service discovery supposedly finished successfully..
Was the device in pairing mode (with the arrows/circle turning)? Was the computer the last thing it paired with (once you pair with the computer, the phone shouldn't be able to connect to it, since the device only remembers the last authorization)?
Install d-feet, the DBus browser, go under System bus, org.bluez, find the device, verify that it has the org.bluez.Serial interface and try calling Connect() with the proper UUID from there. Other than that, I've really no idea what it's on about.. Do you have more than one LiveView device by any chance (weird things might happen then)?
I don't actually think it's the difference in bluez versions (the Serial interface hasn't changed in the past 2 and something years) but it might be a (driver) bug you're hitting. I *think* I'm doing everything right as far as communication with BlueZ is concerned. Try running `hciconfig hci0 reset`.
Sorry I couldn't be more helpful..
Regarding your Java effort, if I recall my Bluetooth terminology correctly, you are a client, since the server is the thing advertising the service. You should *not* be reading immediately from the device. The phone/computer sends the first message - in my case, my first message is always STANDBY. Then and only then can you start reading back.
Lastly, I hope Android abstracts the whole RFCOMM pipe thing, 'cause it's a pain to use (and the reason I still need pyserial) - select() would sporadically tell me it has data to read and when I try to read it, I get ERRIO :/ I suspect RTS triggers select()..
Make sure you're only reading as many bytes as you know are in the next packet (take a look at consume() - it returns the number of bytes it expects next) and not more than that - it would either block or throw an exception. I've not done any Bluetooth work on Android, so that's as much as I can help, I'm afraid.
Lastly, as big as the temptation is, do not under any circumstances reuse code from the official manager. "Sony" is in the name of the company after all. I'm half-expecting a Cease & Desist any moment now
Edit: Implemented Display Properties Request and Clear Display Request (doesn't do anything). I think I'm out of low-hanging fruit
Really interesting work, guys. The Liveview is a fantastic idea and is almost brilliant - if only it worked properly! If you could get the basics working properly so we don't have to use the Sony software that would be fantastic, it's got so much potential.
Cheers,
Tim
So, I had a brilliant idea today. You know how the LiveView Manager app is full of debug messages. Turns out, they are disabled by means of a constant in ElaineUtils. My idea was to change that constant, put the apk back on my phone and rejoice from all the extra info I'd have.
Turns out, that's not how it works. I changed the constant (bumped it to 0x100 - literally a single bit change) and re-signed the apk. I got some output out of it but not all, and none of the useful ELEMENT_ID_* messages
Any help on that front would massively speed up the reverse-engineering effort.
EDIT: Scratch that, I'm stupid. I forgot that the .field annotations are not executable code - I was changing the wrong bit so to speak. Changed the value in <cinit> and voila, proper logcat!
EDIT: Here's some food for thought - http://pastebin.ca/2099804 - it's the log from startup + a bit of moving around and opening/closing the mediaplayer control.
Very cool project.
I believe, for the damn thing to be usable, focusing on improving Bluetooth performance would be quite good. By "performance" I mean "power consumption." Having to give up on the watch after two hours of light use is really unacceptable.
I would love it if you got this thing working efficiently like SmartWatchm/OpenWatch did for my MBW-150. I ordered my LiveView from the UK when it first released there instead of waiting for the US release. The darn thing disappointed the hell out of me and has been sitting in my garage for almost a year now.
Hopefully you get something going on with this.
archivator said:
So, I had a brilliant idea today. You know how the LiveView Manager app is full of debug messages. Turns out, they are disabled by means of a constant in ElaineUtils. My idea was to change that constant, put the apk back on my phone and rejoice from all the extra info I'd have.
Turns out, that's not how it works. I changed the constant (bumped it to 0x100 - literally a single bit change) and re-signed the apk. I got some output out of it but not all, and none of the useful ELEMENT_ID_* messages
Any help on that front would massively speed up the reverse-engineering effort.
EDIT: Scratch that, I'm stupid. I forgot that the .field annotations are not executable code - I was changing the wrong bit so to speak. Changed the value in <cinit> and voila, proper logcat!
EDIT: Here's some food for thought - http://pastebin.ca/2099804 - it's the log from startup + a bit of moving around and opening/closing the mediaplayer control.
Click to expand...
Click to collapse
Wow, that's very useful thank you. I've been very occupied and did not work more with the Android Side application since my last post, I intend to return to it soon enough though, that output is very welcome when it comes to understanding then the icons are sent and the whole mechanism itself.
I've been doing a bit of reverse engineering work on the liveview as well, and I think I have a complete (although i fear possibly slightly corrupt) firmware dump!
I have been able to extract was some PNG images from the firmware (Thanks to their rather distinctive %PNG Header and ending with IEND).
It would appear that the menus and stuff are in fact definitively transferred over bluetooth!
I've attached the images I've extracted if anyone's interested in seeing them!
I'm currently trying to work through it in IDA to disassemble it, which is a pain in the arse!
Is anyone else also interested in completely rewriting the firmware?
@aj256, nice work! I thought I had a dump as well but mine looked compressed :\ Mind uploading yours somewhere for all to see? (edit: sorry, saw it in the archive)
aj256 said:
It would appear that the menus and stuff are in fact definitively transferred over bluetooth!
Click to expand...
Click to collapse
That's correct - I almost have that part of the protocol figured out but I'm low on spare time.
aj256 said:
Is anyone else also interested in completely rewriting the firmware?
Click to expand...
Click to collapse
Well.. I'd be interested in modifying it and isolating the Bluetooth stack but don't really have the time OR the chops to write the whole firmware from datasheets and disassembly.
As for where I'm standing, I know what I need to decompile next (renderShowUi) but it's a couple of thousand lines of smali. There are so many branches, it's easy to get lost. I need to write better tools for decompiling smali first
Just bought a Live View! I know it may not be the best but I got it cheap and mainly want the Caller ID portion of it. I hope this reverse engineering pays off. Once I get mine I may start poking around and see if I can help out! Thanks for the post OP!
Hi,
do you guys have some irc channel or anything else? Just got my LiveView and want to help you with this...
I've quickly put together a project website at openliveview (dot) com (apparently I don't have enough posts for an external link!) with some forums as well to help to document peoples progress!
I've done a quick writeup on my progress so far (which isn't very much!)
@archivator, glad you found the firmware in the zip, I was just about to reply that it was there!
aj256 said:
I've quickly put together a project website at openliveview (dot) com (apparently I don't have enough posts for an external link!) with some forums as well to help to document peoples progress!
I've done a quick writeup on my progress so far (which isn't very much!)
@archivator, glad you found the firmware in the zip, I was just about to reply that it was there!
Click to expand...
Click to collapse
Nice. I've been on your website and the documentation is getting in good shape. When I got some free time I'll try and read it more carefully and complement the Android project.
Talking about that, I've uploaded my progress so far to github: https://github.com/pedronveloso/OpenLiveView
bare in mind that apart from pairing with the Device not much is actually working by now, contributions are welcome of course

[TOOL] Best GUI debuger for Native parts?

Which is the best visual debugger in current development for NDK? I am all new to Android development and trying to debug quite a complex project (StrongSwan ipsec client) from the start.
Debugging native code with Eclipse turns out to be a complete mess. Initially it was a missed symbols from loaded libraries (with all needed symbols inside obj/local/x86 directory).
But after experiments with ndk-gdb.py (old ndk-gdb just doesn't work) which prove debugging is possible, Eclipse also start to load debugging info for StrongSwan client.
But my joy was premature. Another problem arise. As soon as I setup breakpoint, launch debug, hit breakpoint and multiple times click "Step Over" and "Step Into" buttons Eclipse start to switch and stops inside some minor threads. Like this:
bt
#0 0xb76b48e6 in __ioctl () from /home/shuras/workplace/android/Teapot/obj/local/x86/libc.so
#1 0xb76ee3fb in ioctl () from /home/shuras/workplace/android/Teapot/obj/local/x86/libc.so
#2 0xb7162c2c in ?? ()
#3 0xa5f22d00 in ?? ()
or like those:
#0 0xb766cbd2 in syscall () from /home/shuras/workplace/android/strongswan/src/frontends/android/obj/local/x86/libc.so
#1 0xa592a8d8 in ?? ()
As result to keep focus on debugging intresting code I constantly need to manually select needed thread from a list.
Even if you enter "step" command inside Eclipse's gdb console still debugger will stop in the middle of nowhere.
Doing same thing inside ndk-gdb.py I have no issues like that. But using command line debugger not quite comfortable and fast way to go forward.
So it must be Eclipse induced problem with gdb random stops.
And as a last complaint, debugging inside Eclipse is slow as hell.
So my question is there any better alternatives to Eclipse in case of native code debugging?
Or is there any way to make Eclipse behave properly?
Just in case. My software configuration:
adt-bundle-linux-x86_64-20140702.zip
vanilla android emulator 5.0 x86
android-ndk-r10c-linux-x86_64.bin
ubuntu 14.10
Small update on my Eclipse problem. Now I think debug steps works as it should. The only problem is that Eclipse switch focus from last thread debugged to other threads for no reason after almost every step. On each step debugged thread advance one line forward exactly as it should. So I suppose it is ADT plugin problem. Is there something to do with it?
As time passed I can only append that switching to Luna version of Eclipse (instead of Eclipse included in the ADT bundle by google) solve problem with unprovoked stops. So I suppose it must be Eclipse bug of one particular version. But still Eclipse NDK debugging is a slow as hell. I am interesting in any good alternatives.
I have seen a couple pages describing how to get DDD working with ndk-gdb. Might be worth giving that a try as an alternative.
CellCB said:
I have seen a couple pages describing how to get DDD working with ndk-gdb. Might be worth giving that a try as an alternative.
Click to expand...
Click to collapse
DDD is quite a piece of software. Not the best memories from the old past. But still good to know. Many thanks.

[Q] Extract JSON data and display in ListView with Searchbox

Hi Everyone,
I am currently a very new starter in the Android App Development stage. I have tried to develop a ListView with Searchbox facility to search data that comes from a specific URL in the form of JSON data. I managed to understand displaying this data in ListView, but adding a search facility is something I'm struggling to grasp somehow.
The code attached is a reference code I am trying to tune before I move on to actually developing my app. However, it doesn't seem to work on the emulator, giving me the error that the MainActivity file has stopped working.
I am unsure if there is a fundamental error somewhere, and would be really grateful to get some advice on this. I have looked online and can't seem to find a good resource that explains merging ListView with JSON data effectively with a Searchbox.
ajitmenezes said:
Hi Everyone,
I am currently a very new starter in the Android App Development stage. I have tried to develop a ListView with Searchbox facility to search data that comes from a specific URL in the form of JSON data. I managed to understand displaying this data in ListView, but adding a search facility is something I'm struggling to grasp somehow.
The code attached is a reference code I am trying to tune before I move on to actually developing my app. However, it doesn't seem to work on the emulator, giving me the error that the MainActivity file has stopped working.
I am unsure if there is a fundamental error somewhere, and would be really grateful to get some advice on this. I have looked online and can't seem to find a good resource that explains merging ListView with JSON data effectively with a Searchbox.
Click to expand...
Click to collapse
You should implement the search on the listview adapter, not on the activity itself.
Take a look at the following article:
http://www.mokasocial.com/2010/07/arrayadapte-filtering-and-you/

Categories

Resources