[DEV] T-Mobile Wifi Calling - Nexus S Android Development

Update 3/1: http://forum.xda-developers.com/showpost.php?p=11744801&postcount=118
Update 2/25: http://forum.xda-developers.com/showpost.php?p=11643634&postcount=103
Update: http://forum.xda-developers.com/showpost.php?p=10767062&postcount=59
Some progress has been made (quite a bit actually). Still not working though.
Old:
Anyone working on this currently? I've cobbled together some info from the N1 port and have the following:
Libraries pushed
Code:
/system/lib/libganril.so
/system/lib/libkineto.so
/system/lib/librilswitch.so
(Added this for posterity, but it didn't seem to solve any issues)
Code:
/system/lib/libhtc_ril.so
Edited build.prop
Removed
Code:
rild.libpath=/vendor/lib/libsec-ril.so
Added
Code:
rild.libpath=/system/lib/librilswitch.so
rilswitch.vendorlibpath=/vendor/lib/libsec-ril.so
rilswitch.ganlibpath=/system/lib/libganril.so
I compiled the kineto_gan module from the cm commit against the kernel source released and the module inserts properly (here: https://github.com/cyanogen/cm-kernel-exp/commit/9158026851f843c5af0239fe16fbd99f0ecc37b8#diff-0_
Using the APK linked in the N1 forum: MS-HTCVISION-KNT20-02.apk
With this done the phone boots fine and I can get service with t-mobile. The kineto_gan module appears to load without issue. However, when launching the Wifi calling app I immediately get a FC. Logcat shows
Code:
D/dalvikvm( 1256): Trying to load lib /data/data/com.android.kineto/lib/libkinet
o.so 0x40514538
W/dalvikvm( 1256): Exception Ljava/lang/UnsatisfiedLinkError; thrown while initi
alizing Lcom/android/kineto/kineto;
W/dalvikvm( 1256): Class init failed in newInstance call (Lcom/android/kineto/ki
neto;)
D/AndroidRuntime( 1256): Shutting down VM
W/dalvikvm( 1256): threadid=1: thread exiting with uncaught exception (group=0x4
0015560)
E/AndroidRuntime( 1256): FATAL EXCEPTION: main
E/AndroidRuntime( 1256): java.lang.ExceptionInInitializerError
E/AndroidRuntime( 1256): at java.lang.Class.newInstanceImpl(Native Method
)
E/AndroidRuntime( 1256): at java.lang.Class.newInstance(Class.java:1409)
E/AndroidRuntime( 1256): at android.app.Instrumentation.newActivity(Instr
umentation.java:1021)
E/AndroidRuntime( 1256): at android.app.ActivityThread.performLaunchActiv
ity(ActivityThread.java:1536)
E/AndroidRuntime( 1256): at android.app.ActivityThread.handleLaunchActivi
ty(ActivityThread.java:1638)
E/AndroidRuntime( 1256): at android.app.ActivityThread.access$1500(Activi
tyThread.java:117)
E/AndroidRuntime( 1256): at android.app.ActivityThread$H.handleMessage(Ac
tivityThread.java:928)
E/AndroidRuntime( 1256): at android.os.Handler.dispatchMessage(Handler.ja
va:99)
E/AndroidRuntime( 1256): at android.os.Looper.loop(Looper.java:123)
E/AndroidRuntime( 1256): at android.app.ActivityThread.main(ActivityThrea
d.java:3647)
E/AndroidRuntime( 1256): at java.lang.reflect.Method.invokeNative(Native
Method)
E/AndroidRuntime( 1256): at java.lang.reflect.Method.invoke(Method.java:5
07)
E/AndroidRuntime( 1256): at com.android.internal.os.ZygoteInit$MethodAndA
rgsCaller.run(ZygoteInit.java:839)
E/AndroidRuntime( 1256): at com.android.internal.os.ZygoteInit.main(Zygot
eInit.java:597)
E/AndroidRuntime( 1256): at dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime( 1256): Caused by: java.lang.UnsatisfiedLinkError: Cannot load
library: reloc_library[1311]: 75 cannot locate '_ZN7android11AudioRecordC1Eij
ijijPFviPvS1_ES1_i'...
E/AndroidRuntime( 1256):
E/AndroidRuntime( 1256): at java.lang.Runtime.loadLibrary(Runtime.java:43
4)
E/AndroidRuntime( 1256): at java.lang.System.loadLibrary(System.java:554)
E/AndroidRuntime( 1256): at com.android.kineto.kineto.<clinit>(kineto.jav
a:1563)
E/AndroidRuntime( 1256): ... 15 more
D/dalvikvm( 107): GC_CONCURRENT freed 2050K, 43% free 6364K/11079K, external 50
89K/5896K, paused 2ms+6ms
Clearly we are running into an issue as shown here:
Code:
W/dalvikvm( 1256): Exception Ljava/lang/UnsatisfiedLinkError; thrown while initi
alizing Lcom/android/kineto/kineto;
Code:
E/AndroidRuntime( 1256): Caused by: java.lang.UnsatisfiedLinkError: Cannot load
library: reloc_library[1311]: 75 cannot locate '_ZN7android11AudioRecordC1Eij
ijijPFviPvS1_ES1_i'...
I am hoping someone can help shed some light on whether this is an issue with a missing library that I have overlooked (and was already present on the N1) or a general incompatibility with the NS / 2.3.
I am going to do some hunting with google later, but if anyone has any thoughts or can point me to someone with some more knowledge on porting this over (someone who worked with the N1 port possible?) that would be helpful.

Yes this would be a great addition!
Sent from my Nexus S using XDA App

It's a bit of work, and it's not T-Mobile UMA, but it does a decent job for me:
http://forum.xda-developers.com/showthread.php?t=877879

IDtheTarget said:
It's a bit of work, and it's not T-Mobile UMA, but it does a decent job for me:
http://forum.xda-developers.com/showthread.php?t=877879
Click to expand...
Click to collapse
I had this going on my N1 - not really why I am looking for this (although a working solution for some things). It's a nice idea, but it uses a different phone number.
AT&T had a very nice network extender for the few times a year I am in areas with poor to no coverage. T-Mobile does not. The UMA/GAN wifi calling appears to be their answer, but it's available only on a few, select phones. If this could get ported over that would be resolved.
From the videos of Kineto demoing the SW they were running it on a Vibrant, so the hardware should be fine (assuming we have a proper APK and libraries).

Once I get some time I plan on looking into this. With a quick glance at the error it appears to be a library issue...though I'm not certain until I tear apart the apk!
Sent from my Nexus S using XDA App

ritcereal said:
Does anyone have the apk? I am interested in getting this running given the poor reception I tend to find.
Sent from my Nexus S using XDA App
Click to expand...
Click to collapse
Uploaded the APK and libraries taken from the N1 port.
I am leaning towards a missing library as well hopefully - I am going to dig into it tonight hopefully and see if I can get anywhere with it.

if anyone could get this app figured out, i would greatly appreciate the effort!
i have no cell coverage at my house. i have used uma for years, but just upgraded to the nexus s thinking it would have this app. now, i see it only works on the g2 and mt4. ugh...

b84cops said:
if anyone could get this app figured out, i would greatly appreciate the effort!
i have no cell coverage at my house. i have used uma for years, but just upgraded to the nexus s thinking it would have this app. now, i see it only works on the g2 and mt4. ugh...
Click to expand...
Click to collapse
agree on all parts.
looks like i will have to switch sims when i get home with nexus 1 until this can be resolved. sip calling does not work at all for me.

Thanks for tackling this krohnjw.
It's a little frustrating when people think that VOIP is the same thing.
Wifi Calling (UMA) effectively lets your phone act as if it were on its native network anywhere in the world, as long as you have a wifi signal. This is a godsend to those of us who travel internationally (or in places with poor reception).
Once this reaches N1 level stability, I'll probably switch over to the Nexus S.

Not looking great so far. Out of curiosity I fired it up in a few AVDs.
On the stock 2.2 AVD it loads fine and brings up the tutorial / connect prompt (clearly missing the needed libs for it to work though).
On the 2.3 AVD it FC with the same error >.> This leads me to believe that enough was changed in 2.3 with respect to AudioRecord that this may not work in its current incarnation.
I hope this isn't what we are running up against with changes from 2.2 - 2.3
The C++ libmedia library is not part of the public API. Some people use it, but this is highly discouraged because it might break on some devices and/or in a future Android release.
I developed an audio recording app, and trust me, audio support is very inconsistent across devices, it's very tricky, so IMO using libmedia directly is a bad idea.
Click to expand...
Click to collapse
In case anyone was wondering - pushing older versions of libmedia.so doesn't help anything It just results in a non booting device.

In this case wait for G2 to get Gingerbread? Hehe.

Anderdroid said:
In this case wait for G2 to get Gingerbread? Hehe.
Click to expand...
Click to collapse
I am guessing that will be awhile…
Unless someone else sees something I am missing I am quickly running out of ideas
Sent from my Nexus S using XDA App

krohnjw said:
I am guessing that will be awhile…
Unless someone else sees something I am missing I am quickly running out of ideas
Sent from my Nexus S using XDA App
Click to expand...
Click to collapse
well crap... i was really hoping for this to be able to work. hoping so much that i would actually pay for that app!

Once the G2 update to 2.3 drops it should hopefully get done if we can't use this apk with 2.3
Sent from my Nexus S using XDA App

Doesn't the Wifi Calling port require a custom kernel for the n1 to function? Additionally in krohnjw's zip file of the apk and other libraries we're missing the module '/system/lib/modules/kineto_gan.ko' from the n1 "bundle" that was last released. Has anyone been loading this module before launching the Wifi Calling application?
Other thought is that the htc ril that is bundled doesn't have similar functions, but not certain how I could find out.
Just some initial thoughts, going to keep looking into this!

Just thought I'd mention if it isn't known, the Vibrant froyo leaks also contain the WiFi calling.

Pulling apart the apk and the exceptions via logcat I found the offending call. Though I'm still trying to figure out what we need to replace. It is a library issue.
Code:
:try_start_a3
const-string v1, "kineto"
invoke-static {v1}, Ljava/lang/System;->loadLibrary(Ljava/lang/String;)V
:try_end_a8
.catch Ljava/lang/Exception; {:try_start_a3 .. :try_end_a8} :catch_a9
.line 60
:goto_a8
return-void
The part that stands out to me is invoke-static {v1} which would to me...translate into invote-static("kineto"), which of course it cannot find.
Though I'm confused by this as well, I'm not seeing any lib's that are included in the n1 port...I'm probably missing something.

ritcereal said:
Doesn't the Wifi Calling port require a custom kernel for the n1 to function? Additionally in krohnjw's zip file of the apk and other libraries we're missing the module '/system/lib/modules/kineto_gan.ko' from the n1 "bundle" that was last released. Has anyone been loading this module before launching the Wifi Calling application?
Other thought is that the htc ril that is bundled doesn't have similar functions, but not certain how I could find out.
Just some initial thoughts, going to keep looking into this!
Click to expand...
Click to collapse
That was the wrong zip or incomplete. I compiled a kernel with the kineto_gan module as statedvin the op. Works no problem (no errors in dmesg - success messages present) . Module loads successfully.
I'm running this kernel with the module loaded....doesn't make any difference. I can make it available if anyone would like to test.
Sent from my Nexus S using XDA App

Anderdroid said:
Just thought I'd mention if it isn't known, the Vibrant froyo leaks also contain the WiFi calling.
Click to expand...
Click to collapse
I just pulled that (and their version of libkineto.so) from the leaked image - same result, same error.

I'm curious, since wifi calling required libary files and all that jazz, wouldn't it be easier to just route the wifi calling apk through the SIP protocol already in place? That way you can avoid all the kernel and library "mess".
(not too knowledgeable on SIP and/or wifi calling).

Related

[Q] Help with my app

Hello, I have just released my first app called College Football Fight Songs. It is obviously an app that plays all of the college football fight songs. I am a beginner programmer with little experience and have been testing it on a Nexus S 2.3.4 throughout my development. It has worked perfectly even after releasing the app on the Market.
The only problem is that for some reason, it does not work on all devices for whatever reason. I am very confused and don't quite know what to do. It has been made for Android 2.1 and up, and works perfectly on my Nexus S.
The problem with other devices is that when either going to another screen, or going back from a screen, it force closes.
I would like any feedback regarding this problem, or any criticism that you can offer on my app, thanks!
Because I do not have very many posts, I cannot post a link to the Market or even a QR code, but if you just search "College Football Fight Songs" or "Eric Carboni" in the Market, my app is there.
Thanks
Can anyone help?
Sent from my Nexus S using XDA Premium App
ericcarboni said:
Can anyone help?
Sent from my Nexus S using XDA Premium App
Click to expand...
Click to collapse
I'll take a look later tonight after the kids go to sleep and see if I can recreate the fc. If it is in the market have you looked at the error reports and the stack traces?
Sent from my Nexus S using XDA Premium App
I grabbed it quick.....some initial impressions:
It's huge. You should reduce the package size if possible. Make each conference downloadable as a package possibly. You can leverage the market for this. 30 MB is a *large* app especially if I only want a few fight songs.
Since I can't recreate the fc I'll ask a few questions.
How are you handling the player resources in your onPause and onResume methods ?
How are you allocating new resources to play? Are you checking if it is already in use and calling stop before trying to play?
Do you have any error reports that you could post the stack trace from?
Sent from my Nexus S using XDA Premium App
First I just wanted to say thanks for taking the time to help me out with this. Also, I want to say how amazing your NFC Task app is: I've had it for a while now and I've been using it with some key chain tags. I love it.
Yes, I know it is huge. In fact, it is one of the biggest apps I have on my device. After I fix this problem, I will work on making each conference downloadable.
Right now, with my experience with Java, everything I have done with the playing and pausing is really basic. I am not checking if it is already in use to stop it before playing. Right now I have this -- once you are in the 'now playing' screen, I have the onPause method to stop each song from playing. I assumed there was a simpler way to do this..
But anyways, right now, there is one error report that I've gotten. I don't really understand it, but right now all I've gotten out of it is that the error is on the onPause action.
This is the stack trace for that report:
java.lang.RuntimeException: Unable to pause activity {com.carboni.fightsongs/com.carboni.fightsongs.BIG12}: java.lang.NullPointerException
at android.app.ActivityThread.performPauseActivity(ActivityThread.java:3348)
at android.app.ActivityThread.performPauseActivity(ActivityThread.java:3305)
at android.app.ActivityThread.handlePauseActivity(ActivityThread.java:3288)
at android.app.ActivityThread.access$2500(ActivityThread.java:125)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2044)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:4627)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:893)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:651)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.NullPointerException
at com.carboni.fightsongs.BIG12.onPause(BIG12.java:159)
at android.app.Activity.performPause(Activity.java:3842)
at android.app.Instrumentation.callActivityOnPause(Instrumentation.java:1190)
at android.app.ActivityThread.performPauseActivity(ActivityThread.java:3335)
... 12 more
Any other help you can give me is greatly appreciated, thank you very much
ericcarboni said:
First I just wanted to say thanks for taking the time to help me out with this. Also, I want to say how amazing your NFC Task app is: I've had it for a while now and I've been using it with some key chain tags. I love it.
Yes, I know it is huge. In fact, it is one of the biggest apps I have on my device. After I fix this problem, I will work on making each conference downloadable.
Right now, with my experience with Java, everything I have done with the playing and pausing is really basic. I am not checking if it is already in use to stop it before playing. Right now I have this -- once you are in the 'now playing' screen, I have the onPause method to stop each song from playing. I assumed there was a simpler way to do this..
But anyways, right now, there is one error report that I've gotten. I don't really understand it, but right now all I've gotten out of it is that the error is on the onPause action.
This is the stack trace for that report:
java.lang.RuntimeException: Unable to pause activity {com.carboni.fightsongs/com.carboni.fightsongs.BIG12}: java.lang.NullPointerException
at android.app.ActivityThread.performPauseActivity(ActivityThread.java:3348)
at android.app.ActivityThread.performPauseActivity(ActivityThread.java:3305)
at android.app.ActivityThread.handlePauseActivity(ActivityThread.java:3288)
at android.app.ActivityThread.access$2500(ActivityThread.java:125)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2044)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:4627)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:893)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:651)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.NullPointerException
at com.carboni.fightsongs.BIG12.onPause(BIG12.java:159)
at android.app.Activity.performPause(Activity.java:3842)
at android.app.Instrumentation.callActivityOnPause(Instrumentation.java:1190)
at android.app.ActivityThread.performPauseActivity(ActivityThread.java:3335)
... 12 more
Any other help you can give me is greatly appreciated, thank you very much
Click to expand...
Click to collapse
Calling pause / stop in the onPause is probably best. You can likely stop it instead of pausing it. The garbage collection should take care of freeing the resources as long as they are not in use when the Activity finishes.
This is the relevant error:
Code:
Caused by: java.lang.NullPointerException
at com.carboni.fightsongs.BIG12.onPause(BIG12.java:159)
I am guessing this is where you are accessing the player object in the onPause() method. However for whatever reason the object is null. It's a good idea to do a null check on the object itself before operating on it.
For operations like this I'd also recommend a try / catch and logging the exception via Log.d or Log.e so that if there is an issue you can pull it from logcat. You can call Lod.d("TagName", "Error and info you want to print") as well we e.printStackTrace() assuming you've named the Exception that is caught e. This will help log info for users (or yourself) for more useful debugging info.
Essentially you want to prevent your app from crashing on non show stopper exceptions. By wrapping these operations in try/catch blocks you're able to gracefully handle the exceptions and move on with your application without FCing.
Using try/catch blocks is really cheap (from an operational perspective) for small apps like this. The catch is the most expensive part, but it will really help you to gracefully handle issues that arise and eliminate force closes.
If you're having trouble tracking down the issue I'll take a look at the source if you want to zip/rar it up and send it over.
Which operations would I wrap a try/catch around?
Thanks for all your help, I think I might send you the source code eventually if I can't figure it out.
And I have a question: why would the app work perfectly on Gingerbread but not other phones with Froyo? Just curious to why this is
ericcarboni said:
Which operations would I wrap a try/catch around?
Thanks for all your help, I think I might send you the source code eventually if I can't figure it out.
And I have a question: why would the app work perfectly on Gingerbread but not other phones with Froyo? Just curious to why this is
Click to expand...
Click to collapse
Honestly - wrap any operations that may result in an exception being thrown (within reason). Depending on your experience this may or may not be something you'll be able to see easily or not. You'll learn quite a bit by trial and error
Generally though if you're dealing with resources that may or may not be available (even if they should *always* be available) it doesn't hurt to wrap them in a try/catch in case an exception is thrown.
Any time you are parsing potentially invalid input and / or casting data it's good to try/catch and handle any exceptions that may creep up.
Some of the audio code (libaudio or libmedia) was changed from Froyo to Gingerbread - you're also working with potential issues from Rosie(Sense)/Touchwiz/Blur. Most of these frameworks make alterations to the subsystems in some form or another and do not always behave in the same manner as an AOSP rom 100 % of the time. You're also dealing with varying devices with varying amounts of resources and multiple services competing for these resources.
In the SDK documentation the classes themselves will show what exceptions are thrown - these are thrown to prevent the app/subsystem from crashing or getting unexpected results. It is your job as the developer to catch these exceptions and handle them.
Obviously it's wasteful to try/catch everything - there's no reason, for example, to try catch the overloaded ++ operator for an integer. If you are doing string manipulation on user input though then you should be doing some sanity checking / handling of exceptions as you may get completely unexpected and bad data.
Any time you are dealing with system resources you'll want to verify that the resource did properly get assigned and handle the exceptions that it may throw as a good practice though.
For example, when you play a media file you are counting on:
The DSP device being availble
The handle to the device being appropriately acquired
The resource to be played being present and properly allocated
The playing of this resource to be properly executed by the subsystem
If any of these things goes wrong then an exception is going to be raised by the subsystem so that it can be handled in your application. If you do not handle the exception your app crashes and you FC. If you handle it though you can deal with it as is appropriate and move on (e.g: inform the user there was an error, log the exception and move on).
ich habe das gleiche problem!!
I've been working on it; do you think using a try/catch for the exceptions that need it will solve the problem completely?
Sent from my Nexus S using XDA Premium App
ericcarboni said:
I've been working on it; do you think using a try/catch for the exceptions that need it will solve the problem completely?
Sent from my Nexus S using XDA Premium App
Click to expand...
Click to collapse
Yes, assuming you're not doing something crazy with the object or resources - your app is FC's because an exception is being raised and not handled. By catching and handling the exception (assuming there isn't an issue with the underlying code) you are able to programmatically deal with these issues.
krohnjw said:
Yes, assuming you're not doing something crazy with the object or resources - your app is FC's because an exception is being raised and not handled. By catching and handling the exception (assuming there isn't an issue with the underlying code) you are able to programmatically deal with these issues.
Click to expand...
Click to collapse
I have done a few, and now it works on a 2.2 emulator, but not on a 2.1, or a 2.2 Galaxy S.. Do you think if I send the project to you, could you take a quick look at it? You've been a lot of help, I appreciate it

[Q] Are These Features Possible?

I've switched to the Moto X from Windows Phone 8, and after spending a few weeks de-bloating the damn thing I'm pretty happy with it.
However, there are two features I am sorely missing:
1. On my HTC 8X, whenever I had received a text message and I picked up the phone, the screen would automatically turn on. I know that stock the Moto X came with active notifications which is kind of the same, but I removed it because it meant I had to unlock the screen and then enter my PIN, as opposed to just entering my pin. Does Android have any built-in functionality to automatically turn on the display when a new text message comes in?
2. Similar to the previous point, when I got a new text message on Windows Phone 8, the sender and the first few words of the message would be briefly displayed across the top of the screen. Android doesn't seem to have that, but what would be really useful is if I could access my notifications drawer while the phone was still locked, so I could see who had emailed or messaged me, and then take the appropriate action. Is there a way to enable something similar to this?
1. No, you got rid of it.
2. It shows the preview of the text in active display, and in the notification window. The notification window isn't available on the lock screen when you have PIN lock enabled, due to privacy restrictions.
Sent from my XT1058 using XDA Premium 4 mobile app
Under active display options there is a checkbox for more privacy. Have you tried with that unchecked?
Sent from my XT1060 using Tapatalk
He got rid of AD...
Sent from my XT1058 using XDA Premium 4 mobile app
PityOnU said:
I've switched to the Moto X from Windows Phone 8, and after spending a few weeks de-bloating the damn thing I'm pretty happy with it.
However, there are two features I am sorely missing:
1. On my HTC 8X, whenever I had received a text message and I picked up the phone, the screen would automatically turn on. I know that stock the Moto X came with active notifications which is kind of the same, but I removed it because it meant I had to unlock the screen and then enter my PIN, as opposed to just entering my pin. Does Android have any built-in functionality to automatically turn on the display when a new text message comes in?
2. Similar to the previous point, when I got a new text message on Windows Phone 8, the sender and the first few words of the message would be briefly displayed across the top of the screen. Android doesn't seem to have that, but what would be really useful is if I could access my notifications drawer while the phone was still locked, so I could see who had emailed or messaged me, and then take the appropriate action. Is there a way to enable something similar to this?
Click to expand...
Click to collapse
I'd advise installing Go SMS, it gives an option to turn on the screen for an incoming message, and uncheck messaging/go sms under Active Display.
GandalfTehGray said:
I'd advise installing Go SMS, it gives an option to turn on the screen for an incoming message, and uncheck messaging/go sms under Active Display.
Click to expand...
Click to collapse
you can try the dynamicnotifications app from the play store. it has more features than active display but i havent tested it on the moto x.
It seems like the features you desire may be best supplied by active display. I've really been enjoying that feature on my Moto-X.
On my previous phone, I used handcent as a text app, and it has a setting that allows new incoming texts to display in a pop up window. I eventually shut that feature off, as texts would pop up when the phone was in my pocket, and then the screen was active, and all sorts of undesirable screen press issues would happen.
To the OP, I came from an iPhone which worked the same way. I had a nexus 5 first which was a complete PITA, the moto x is better. Turn the Active Display back on!!
sent from my VZW 32GB moto maker X on 4.4
The latest update to "active notificatioins" should address your concern
Motorola just published an update to the "active notifications" app that addressed your concern specifically. Many commands now work without touching the phone. additionally, if you are using the "pin" unlock function, which your post indicates you are, you can even speak your pin to access the remaining functions. As I understand the update, the only actions that now require a pin are ones that show your personal information. but being able to speak your pin is a nice feature when driving if your car stereo does not have bluetooth authentication.
Wow, thanks for all the great suggestions, guys! I never expected this thread to get this much attention.
After using the phone for the past week or so, I find that I am in agreement with the majority of you that I should keep Active Display on my phone. I am amazed that a feature as basic as this had not already been built into the functionality of the base Android OS.
Would anyone happen to know the .apk's needed to get Active Display back up and running on my Moto X? I have backups of all the system apps, but am not sure which files I should restore. I know that "AonInt.apk" is part of, but not the whole, story.
stevetsimmons.com said:
Motorola just published an update to the "active notifications" app that addressed your concern specifically. Many commands now work without touching the phone. additionally, if you are using the "pin" unlock function, which your post indicates you are, you can even speak your pin to access the remaining functions. As I understand the update, the only actions that now require a pin are ones that show your personal information. but being able to speak your pin is a nice feature when driving if your car stereo does not have bluetooth authentication.
Click to expand...
Click to collapse
That's Touchless Control, not Active Notifications.
PityOnU said:
Wow, thanks for all the great suggestions, guys! I never expected this thread to get this much attention.
After using the phone for the past week or so, I find that I am in agreement with the majority of you that I should keep Active Display on my phone. I am amazed that a feature as basic as this had not already been built into the functionality of the base Android OS.
Would anyone happen to know the .apk's needed to get Active Display back up and running on my Moto X? I have backups of all the system apps, but am not sure which files I should restore. I know that "AonInt.apk" is part of, but not the whole, story.
Click to expand...
Click to collapse
You got rid of the app completely? You know you could have just disabled Active Notifications from the settings menu, right?
freak4dell said:
You got rid of the app completely? You know you could have just disabled Active Notifications from the settings menu, right?
Click to expand...
Click to collapse
Right, but I wanted it removed completely, so I wiped it out. Mobile devices have limited resources, and I want to conserve mine as much as possible.
In any case, I've found that
Code:
AonInt.apk
&
Code:
AonInt.odex
are the system service that runs in the background for catching notifications, and
Code:
Aon.apk
and
Code:
Aon.odex
are the actual functional parts of the notification screen.
It's still suffering from an error and force quitting, though. Here is the dump from DDMS:
Code:
12-23 18:26:40.726: E/qdexternal(283): writeHPDOption: state file '/sys/devices/virtual/graphics/fb-1/hpd' not found : ret-1 err str: No such file or directory
12-23 18:26:40.888: E/AndroidRuntime(12891): FATAL EXCEPTION: main
12-23 18:26:40.888: E/AndroidRuntime(12891): Process: com.motorola.aon, PID: 12891
12-23 18:26:40.888: E/AndroidRuntime(12891): java.lang.RuntimeException: Unable to create service com.motorola.aon.pd.AonServiceBreath: java.lang.SecurityException: Not allowed to bind to service Intent { act=com.motorola.aon.env.INTERFACE pkg=com.motorola.aon.env }
12-23 18:26:40.888: E/AndroidRuntime(12891): at android.app.ActivityThread.handleCreateService(ActivityThread.java:2590)
12-23 18:26:40.888: E/AndroidRuntime(12891): at android.app.ActivityThread.access$1700(ActivityThread.java:139)
12-23 18:26:40.888: E/AndroidRuntime(12891): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1493)
12-23 18:26:40.888: E/AndroidRuntime(12891): at android.os.Handler.dispatchMessage(Handler.java:102)
12-23 18:26:40.888: E/AndroidRuntime(12891): at android.os.Looper.loop(Looper.java:137)
12-23 18:26:40.888: E/AndroidRuntime(12891): at android.app.ActivityThread.main(ActivityThread.java:5083)
12-23 18:26:40.888: E/AndroidRuntime(12891): at java.lang.reflect.Method.invokeNative(Native Method)
12-23 18:26:40.888: E/AndroidRuntime(12891): at java.lang.reflect.Method.invoke(Method.java:515)
12-23 18:26:40.888: E/AndroidRuntime(12891): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:777)
12-23 18:26:40.888: E/AndroidRuntime(12891): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:593)
12-23 18:26:40.888: E/AndroidRuntime(12891): at dalvik.system.NativeStart.main(Native Method)
12-23 18:26:40.888: E/AndroidRuntime(12891): Caused by: java.lang.SecurityException: Not allowed to bind to service Intent { act=com.motorola.aon.env.INTERFACE pkg=com.motorola.aon.env }
12-23 18:26:40.888: E/AndroidRuntime(12891): at android.app.ContextImpl.bindServiceCommon(ContextImpl.java:1701)
12-23 18:26:40.888: E/AndroidRuntime(12891): at android.app.ContextImpl.bindService(ContextImpl.java:1665)
12-23 18:26:40.888: E/AndroidRuntime(12891): at android.content.ContextWrapper.bindService(ContextWrapper.java:517)
12-23 18:26:40.888: E/AndroidRuntime(12891): at com.motorola.aon.AonService.requestRebind(AonService.java:407)
12-23 18:26:40.888: E/AndroidRuntime(12891): at com.motorola.aon.AonService.onCreate(AonService.java:443)
12-23 18:26:40.888: E/AndroidRuntime(12891): at com.motorola.aon.pd.AonServiceBreath.onCreate(AonServiceBreath.java:183)
12-23 18:26:40.888: E/AndroidRuntime(12891): at android.app.ActivityThread.handleCreateService(ActivityThread.java:2580)
12-23 18:26:40.888: E/AndroidRuntime(12891): ... 10 more
Any ideas what I am still missing? I think it's a provider of some sort from Motorola specific security settings, but I'm not certain. I'll have to dig around some more...
I'm not sure if this helps, but Motorola posted all of their special features to the play store. Also regarding the unlock, you can create a trusted bluetooth device that will disable your pin. Basically if your phone is in range of said device (car, headset, whatever), you don't need to enter a pin.
PityOnU said:
Right, but I wanted it removed completely, so I wiped it out. Mobile devices have limited resources, and I want to conserve mine as much as possible.
In any case, I've found that
Code:
AonInt.apk
&
Code:
AonInt.odex
are the system service that runs in the background for catching notifications, and
Code:
Aon.apk
and
Code:
Aon.odex
are the actual functional parts of the notification screen.
It's still suffering from an error and force quitting, though. Here is the dump from DDMS:
Code:
12-23 18:26:40.726: E/qdexternal(283): writeHPDOption: state file '/sys/devices/virtual/graphics/fb-1/hpd' not found : ret-1 err str: No such file or directory
12-23 18:26:40.888: E/AndroidRuntime(12891): FATAL EXCEPTION: main
12-23 18:26:40.888: E/AndroidRuntime(12891): Process: com.motorola.aon, PID: 12891
12-23 18:26:40.888: E/AndroidRuntime(12891): java.lang.RuntimeException: Unable to create service com.motorola.aon.pd.AonServiceBreath: java.lang.SecurityException: Not allowed to bind to service Intent { act=com.motorola.aon.env.INTERFACE pkg=com.motorola.aon.env }
12-23 18:26:40.888: E/AndroidRuntime(12891): at android.app.ActivityThread.handleCreateService(ActivityThread.java:2590)
12-23 18:26:40.888: E/AndroidRuntime(12891): at android.app.ActivityThread.access$1700(ActivityThread.java:139)
12-23 18:26:40.888: E/AndroidRuntime(12891): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1493)
12-23 18:26:40.888: E/AndroidRuntime(12891): at android.os.Handler.dispatchMessage(Handler.java:102)
12-23 18:26:40.888: E/AndroidRuntime(12891): at android.os.Looper.loop(Looper.java:137)
12-23 18:26:40.888: E/AndroidRuntime(12891): at android.app.ActivityThread.main(ActivityThread.java:5083)
12-23 18:26:40.888: E/AndroidRuntime(12891): at java.lang.reflect.Method.invokeNative(Native Method)
12-23 18:26:40.888: E/AndroidRuntime(12891): at java.lang.reflect.Method.invoke(Method.java:515)
12-23 18:26:40.888: E/AndroidRuntime(12891): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:777)
12-23 18:26:40.888: E/AndroidRuntime(12891): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:593)
12-23 18:26:40.888: E/AndroidRuntime(12891): at dalvik.system.NativeStart.main(Native Method)
12-23 18:26:40.888: E/AndroidRuntime(12891): Caused by: java.lang.SecurityException: Not allowed to bind to service Intent { act=com.motorola.aon.env.INTERFACE pkg=com.motorola.aon.env }
12-23 18:26:40.888: E/AndroidRuntime(12891): at android.app.ContextImpl.bindServiceCommon(ContextImpl.java:1701)
12-23 18:26:40.888: E/AndroidRuntime(12891): at android.app.ContextImpl.bindService(ContextImpl.java:1665)
12-23 18:26:40.888: E/AndroidRuntime(12891): at android.content.ContextWrapper.bindService(ContextWrapper.java:517)
12-23 18:26:40.888: E/AndroidRuntime(12891): at com.motorola.aon.AonService.requestRebind(AonService.java:407)
12-23 18:26:40.888: E/AndroidRuntime(12891): at com.motorola.aon.AonService.onCreate(AonService.java:443)
12-23 18:26:40.888: E/AndroidRuntime(12891): at com.motorola.aon.pd.AonServiceBreath.onCreate(AonServiceBreath.java:183)
12-23 18:26:40.888: E/AndroidRuntime(12891): at android.app.ActivityThread.handleCreateService(ActivityThread.java:2580)
12-23 18:26:40.888: E/AndroidRuntime(12891): ... 10 more
Any ideas what I am still missing? I think it's a provider of some sort from Motorola specific security settings, but I'm not certain. I'll have to dig around some more...
Click to expand...
Click to collapse

[Q] How to change carrier text on demand

Hello,
I'm trying to develop an Xposed module that will allow me to change the carrier text of the device on demand (in reality, this will happen when the music track is changed).
I'm already using a BroadcastReceiver to listen to track-changed events from various media players, but I want to change the carrier text of the device when I receive such an intent.
However, I wasn't able to find how to do it using Xposed, as it only allows me to hook methods before/after they execute (feel free to correct me if I'm wrong of course), which isn't exactly what I need.
I went through the source code of XBlastTools for changing the carrier text, but wasn't able to conclude much for my needs.
Please advise in setting up a method that will basically get a String and replace the carrier text with that given String (at any given time). Something like this:
Code:
public void setName(String name) {
// TODO implement
}
Normally, you'd put your BroadcastReceiver somewhere you can access the carrier TextView from. You'd then be able to edit it when you want normally. In this case it looks like there's an easier way, though.
Here's how I'd do it: register a BroadcastReceiver in CarrierText's constructor. In that receiver, get and save the text you want as a class variable. Then hook getCarrierTextForSimState and make it return that variable.
http://grepcode.com/file_/repositor...licy/impl/keyguard/CarrierText.java/?v=source
GermainZ said:
Normally, you'd put your BroadcastReceiver somewhere you can access the carrier TextView from. You'd then be able to edit it when you want normally. In this case it looks like there's an easier way, though.
Here's how I'd do it: register a BroadcastReceiver in CarrierText's constructor. In that receiver, get and save the text you want as a class variable. Then hook getCarrierTextForSimState and make it return that variable.
http://grepcode.com/file_/repositor...licy/impl/keyguard/CarrierText.java/?v=source
Click to expand...
Click to collapse
That's a good way of doing things if it weren't for the "on demand" requirement.
Basically, what I want to do is set the carrier text to a different one whenever the onReceive() of the BroadcastReceiver is called, so I can't just hook into getCarrierTextForSimState() and change that, because it probably won't be called whenever I need.
benthe said:
That's a good way of doing things if it weren't for the "on demand" requirement.
Basically, what I want to do is set the carrier text to a different one whenever the onReceive() of the BroadcastReceiver is called, so I can't just hook into getCarrierTextForSimState() and change that, because it probably won't be called whenever I need.
Click to expand...
Click to collapse
Then call the setText method from your receiver as well.
GermainZ said:
Then call the setText method from your receiver as well.
Click to expand...
Click to collapse
By the way, I think the class you linked to only affects the carrier name that appears on the lockscreen.
I'm not that interested in this carrier text to be honest, and basically want to set the carrier text whereever it may be the class you linked to is pulling it from.
The main idea behind my module is that I have a BT headset in my car that can only display the carrier name & bluetooth name of my phone, but I want it to display the currently playing track. So I want to change the bluetooth name of the phone to the artist of the currently playing song (almost works at this point, just have some crashes I need to deal with), and set the carrier name to the name of the song that's currently playing.
However, I didn't manage to do that later. I tried various methods, but no luck so far.
EDIT: I managed to get everything working for the most part (I didn't test it with the actual BT headset, but both the BT and carrier names change when changing tracks).
However, I'm getting 2 error messages constantly as soon as I start playback:
1. Unfortunately, the process android.process.acore has stopped.
2. Unfortunately, the process android.process.media has stopped.
Any ideas on how to fix those two? What's causing them seems to be the changing of the bluetooth name (although it does work, just shows me those two crash errors time after time). Here's the code for my bluetooth manager.
Disabling the "setName" call of the BluetoothAdapter fixes the crashes (but obviously doesn't change the BT name of the device, which defeats the purpose).
Also, replacing the said call with:
Code:
XposedHelpers.callMethod(mLocalAdapter, "setName", name);
fixes this, but I prefer to do things without using reflection and hooking if I can (which is possible in this case), so it seems like it's just a permission issue.
It might be because of a permission problem:
I put together a quick Android app to simulate changing the BT name in the same way, and it crashed without adding:
Code:
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
to the manifest file.
However, if I recall correctly, Xposed modules run in root mode, so they shouldn't need permissions to do whatever they please. Also, I tried adding the above permissions to my module, but it still crashes.
Any help on the matter would be most appreciated.
I just checked which class XBlastTools hooked and assumed that's it. If not, look for the right one or see the first part of post #2.
About the crashes: check your logcat.
Xposed modules do not run as root, they'll have the same permissions as the process they're in (the app you're hooking). You can hook anything, though (including Android system methods).
GermainZ said:
I just checked which class XBlastTools hooked and assumed that's it. If not, look for the right one or see the first part of post #2.
About the crashes: check your logcat.
Xposed modules do not run as root, they'll have the same permissions as the process they're in (the app you're hooking). You can hook anything, though (including Android system methods).
Click to expand...
Click to collapse
Thanks for the help.
I got the carrier name part working perfectly now (or so it seems at least, I'll have to check later in the actual car BT headset).
The only part that remains to make the module fully functional is the Bluetooth one. I checked my logcat, and like I said in my previous post - I think it's a permission issue, which is rather weird - as I set both permissions needed for Bluetooth for the module. Keep in mind that the part that's running the bluetooth code in the app isn't hooking anything, it runs on the module itself as far as I can tell. I'm calling it on the onReceive callback from the BroadcastReceiver (I don't think the app that send the broadcast has bluetooth permissions, but that shouldn't matter, should it?).
benthe said:
Thanks for the help.
I got the carrier name part working perfectly now (or so it seems at least, I'll have to check later in the actual car BT headset).
The only part that remains to make the module fully functional is the Bluetooth one. I checked my logcat, and like I said in my previous post - I think it's a permission issue, which is rather weird - as I set both permissions needed for Bluetooth for the module. Keep in mind that the part that's running the bluetooth code in the app isn't hooking anything, it runs on the module itself as far as I can tell. I'm calling it on the onReceive callback from the BroadcastReceiver (I don't think the app that send the broadcast has bluetooth permissions, but that shouldn't matter, should it?).
Click to expand...
Click to collapse
Remember that all hooked code does *not* run as your app so your app's permissions don't matter here. Hooked code runs as if it was in the hooked process.
Can't say much else without the actual error.
GermainZ said:
Remember that all hooked code does *not* run as your app so your app's permissions don't matter here. Hooked code runs as if it was in the hooked process.
Can't say much else without the actual error.
Click to expand...
Click to collapse
But this code does run on the module.
In my main class (that implements IXposedHookLoadPackage), I'm initializing a class (that derives from Object, and doesn't implement any interfaces), in which I register the BroadcastReceiver (on the context of the application, via AndroidAppHelper.currentApplication().getApplicationContext()), when the onReceive() method is called in the BroadcastReceiver I call the setName() method of the BluetoothAdapter.
If it doesn't run on the module application, on what application does it run on?
And here's the error:
E/AndroidRuntime( 5063): FATAL EXCEPTION: main
E/AndroidRuntime( 5063): Process: com.maxmpz.audioplayer, PID: 5063
E/AndroidRuntime( 5063): java.lang.RuntimeException: Error receiving broadcast Intent { act=com.maxmpz.audioplayer.TRACK_CHANGED flg=0x10 (has extras) } in com.bengr.MusicMetadataForLegacyDevices.Musi
[email protected]
E/AndroidRuntime( 5063): at android.app.LoadedApk$ReceiverDispatcher$Args.run(LoadedApk.java:785)
E/AndroidRuntime( 5063): at android.os.Handler.handleCallback(Handler.java:733)
E/AndroidRuntime( 5063): at android.os.Handler.dispatchMessage(Handler.java:95)
E/AndroidRuntime( 5063): at android.os.Looper.loop(Looper.java:136)
E/AndroidRuntime( 5063): at android.app.ActivityThread.main(ActivityThread.java:5144)
E/AndroidRuntime( 5063): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 5063): at java.lang.reflect.Method.invoke(Method.java:515)
E/AndroidRuntime( 5063): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:795)
E/AndroidRuntime( 5063): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:611)
E/AndroidRuntime( 5063): at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:132)
E/AndroidRuntime( 5063): at dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime( 5063): Caused by: java.lang.SecurityException: Need BLUETOOTH ADMIN permission: Neither user 10128 nor current process has android.permission.BLUETOOTH_ADMIN.
E/AndroidRuntime( 5063): at android.os.Parcel.readException(Parcel.java:1465)
E/AndroidRuntime( 5063): at android.os.Parcel.readException(Parcel.java:1419)
E/AndroidRuntime( 5063): at android.bluetooth.IBluetooth$Stub$Proxy.setName(IBluetooth.java:783)
E/AndroidRuntime( 5063): at android.bluetooth.BluetoothAdapter.setName(BluetoothAdapter.java:660)
E/AndroidRuntime( 5063): at com.bengr.MusicMetadataForLegacyDevices.BluetoothManager.setName(BluetoothManager.java:50)
E/AndroidRuntime( 5063): at com.bengr.MusicMetadataForLegacyDevices.MusicListener.updateRemoteFieldsFromLocalFields(MusicListener.java:150)
E/AndroidRuntime( 5063): at com.bengr.MusicMetadataForLegacyDevices.MusicListener.setTrackMetadata(MusicListener.java:144)
E/AndroidRuntime( 5063): at com.bengr.MusicMetadataForLegacyDevices.MusicListener.access$4(MusicListener.java:138)
E/AndroidRuntime( 5063): at com.bengr.MusicMetadataForLegacyDevices.MusicListener$1.onReceive(MusicListener.java:105)
E/AndroidRuntime( 5063): at android.app.LoadedApk$ReceiverDispatcher$Args.run(LoadedApk.java:775)
E/AndroidRuntime( 5063): ... 10 more
W/ActivityManager( 935): Force finishing activity com.maxmpz.audioplayer/.PlayerUIActivity
W/ActivityManager( 935): Force finishing activity com.maxmpz.audioplayer/.PlayListActivity
D/LogFetchServiceManager( 6618): Received entry added
W/ActivityManager( 935): Activity pause timeout for ActivityRecord{42d72640 u0 com.maxmpz.audioplayer/.PlayerUIActivity t4 f}
I/Timeline( 1490): Timeline: Activity_idle id: [email protected] time:183794
I/Timeline( 935): Timeline: Activity_windows_visible id: ActivityRecord{42ca81c8 u0 com.teslacoilsw.launcher/com.android.launcher2.Launcher t1} time:184001
W/System.err( 5009): LOG: Warning Unknown dock level ignored.
Click to expand...
Click to collapse
Also, here's the project (together with the PowerAMP API project, as it depends on it, and the Android tester application I made to simulate changing the bluetooth name on a "regular" project): link, if that's of any help.
I can't check the project right now, but just to make sure I understand correctly, you're doing something like this:
1- You're hooking the class in which the carrier text is set and registering a BroadcastReceiver there.
2- From your app, you're sending a broadcast whenever you want (possibly with the text you want in the extras).
3- In the BroadcastReceiver's onReceive method, you're setting the carrier text to the value you just received.
If that's what you're doing, it seems fine to me. For the permissions issue, I suppose adding the required permission to your manifest will fix that.
GermainZ said:
I can't check the project right now, but just to make sure I understand correctly, you're doing something like this:
1- You're hooking the class in which the carrier text is set and registering a BroadcastReceiver there.
2- From your app, you're sending a broadcast whenever you want (possibly with the text you want in the extras).
3- In the BroadcastReceiver's onReceive method, you're setting the carrier text to the value you just received.
If that's what you're doing, it seems fine to me. For the permissions issue, I suppose adding the required permission to your manifest will fix that.
Click to expand...
Click to collapse
Not really. The carrier text has nothing to do with the issue anymore. Even if I removed all the code that has to do with the carrier text, and left the bluetooth part alone - the issue would persist.
What I'm doing is this:
1- Have a regular class (meaning it derives from Object directly, and doesn't implement any interfaces).
2- In the said class I set up a BroadcastReceiver (using the application context, which I got via AndroidAppHelper.currentApplication().getApplicationContext(), which is static and can be called from anywhere).
3- When the BroadcastReceiver's onReceive() is called (again, in the previously mentioned class), I call BluetoothAdapter.getDefaultAdapter().setText with the text I want to set as the phone's BT name.
4- Error messages pop-up, and the error I attached in my previous reply shows up on the logcat. (this step occurs when the onReceive is called, which calls the setText).
When I comment out the setText() call, no errors occur (but the BT name doesn't change, obviously).
It's important to note that I did add the needed permissions to my manifest:
AndroidManifest.xml:
Code:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.bengr.musicmetadateforlegacydevices"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="16"
android:targetSdkVersion="19" />
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<meta-data android:name="xposedmodule" android:value="true"/>
<meta-data android:name="xposedminversion" android:value="50"/>
<meta-data android:name="xposeddescription" android:value="Changes the device's carrier and bluetooth names to display the currently playing track."/>
</application>
</manifest>
So you're not using Xposed for anything anymore? Sorry but I'm a bit confused now.
GermainZ said:
So you're not using Xposed for anything anymore? Sorry but I'm a bit confused now.
Click to expand...
Click to collapse
For what I'm doing right now? Not really.
My module is composed of two parts - one for changing the BT name (which doesn't require private calls, and can be done via Android's public API), and one for changing the carrier name (which does require Xposed, as I'm doing some private calls etc).
The carrier name part of the module works perfectly right now.
However, the Bluetooth one doesn't; and crashes as mentioned before, and throws a permission error. However, on a side-project that's just a regular Android app, that also changes the BT name this works (keep in mind that in both the side-project and the Xposed module project I added both Android bluetooth permissions).

[Q] XSharedPreferences NoClassDefFoundError

I'm trying to load in a static XSharedPreferences instance in a separate class via
Code:
private static XSharedPreferences prefs = new XSharedPreferences(BuildConfig.PACKAGE_NAME);
Everything compiles, but at runtime I'm given:
Code:
09-27 08:59:26.929 24976-24976/com.versobit.kmark.xhangouts E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: com.versobit.kmark.xhangouts, PID: 24976
java.lang.NoClassDefFoundError: de.robv.android.xposed.XSharedPreferences
at com.versobit.kmark.xhangouts.XApp.<clinit>(XApp.java:33)
at java.lang.Class.newInstanceImpl(Native Method)
at java.lang.Class.newInstance(Class.java:1208)
at android.app.Instrumentation.newApplication(Instrumentation.java:990)
at android.app.Instrumentation.newApplication(Instrumentation.java:975)
at android.app.LoadedApk.makeApplication(LoadedApk.java:509)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4446)
at de.robv.android.xposed.XposedBridge.invokeOriginalMethodNative(Native Method)
at de.robv.android.xposed.XposedBridge.handleHookedMethod(XposedBridge.java:631)
at android.app.ActivityThread.handleBindApplication(Native Method)
at android.app.ActivityThread.access$1500(ActivityThread.java:144)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1265)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5146)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:732)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:566)
at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:132)
at dalvik.system.NativeStart.main(Native Method)
Been at this for four or five hours and I'm out of ideas. I'm correctly providing the BridgeApi file in my gradle build. I've even tried loading in the jar manually and using reflection, but that doesn't seem to work properly. The class will load but nothing is read.
Are you trying to import that in a non Xposed class? AFAIK, it'll only work for classes loaded by Xposed.
GermainZ said:
Are you trying to import that in a non Xposed class? AFAIK, it'll only work for classes loaded by Xposed.
Click to expand...
Click to collapse
Yep. That's unfortunate. I was under the false impression that Xposed injected itself into every class loader context. It does modify the system classpath but that doesn't seem to have any effect on Dalvik apps. Here's my long-winded solution.
Thanks for the help.
Kevin M said:
Yep. That's unfortunate. I was under the false impression that Xposed injected itself into every class loader context. It does modify the system classpath but that doesn't seem to have any effect on Dalvik apps. Here's my long-winded solution.
Thanks for the help.
Click to expand...
Click to collapse
For what's it's worth, pretty much all modules use MAKE_WORLD_READABLE. IIRC, XSharedPreferences also has a helper to set that if it isn't already.
Edit: also, XSharedPreferences isn't very different from SharedPreferences. From memory, the only differences are a few extra helpers and read only support.
GermainZ said:
For what's it's worth, pretty much all modules use MAKE_WORLD_READABLE. IIRC, XSharedPreferences also has a helper to set that if it isn't already.
Click to expand...
Click to collapse
I found the usage of WORLD_READABLE common while looking around for ideas, but didn't notice the helper function somehow, after pouring over the source. Now that I'm looking at it again my concern is that the XSharedPreferences instance is running with the same permissions as my module, which certainly doesn't have the permissions required to chmod files owned by other users when running in the hooked process.
Kevin M said:
I found the usage of WORLD_READABLE common while looking around for ideas, but didn't notice the helper function somehow, after pouring over the source. Now that I'm looking at it again my concern is that the XSharedPreferences instance is running with the same permissions as my module, which certainly doesn't have the permissions required to chmod files owned by other users when running in the hooked process.
Click to expand...
Click to collapse
Wouldn't you be able to get (or create) an instance of SharedPreferences and edit what you want in that case, though?
Or get a Context and use that if it's not a preference file you're interested in.
GermainZ said:
Wouldn't you be able to get (or create) an instance of SharedPreferences and edit what you want in that case, though?
Or get a Context and use that if it's not a preference file you're interested in.
Click to expand...
Click to collapse
Unless I have a Context to my own application when my hook is running I don't see that working. The only time a Context to my app would even be alive would be when the PreferenceActivity was loaded. When my hook is running it's running inside the other application's process so I can't just spawn a SharedPreference to what is now a foreign resource.
Kevin M said:
Unless I have a Context to my own application when my hook is running I don't see that working. The only time a Context to my app would even be alive would be when the PreferenceActivity was loaded. When my hook is running it's running inside the other application's process so I can't just spawn a SharedPreference to what is now a foreign resource.
Click to expand...
Click to collapse
Ah, I misunderstood what you wanted. Basically I'd do something like this:
If I'm trying to access the hooked app's files, get a Context from the hooked app.
If I'm trying to access my own app's files, get a Context from the hooked app then use IPC (e.g. a BroadcastReceiver for my app, and use Context.sendBroadcast() from the hooked app).
I think you want the second but that's what you're doing currently if I'm not mistaken.
GermainZ said:
Ah, I misunderstood what you wanted. Basically I'd do something like this:
If I'm trying to access the hooked app's files, get a Context from the hooked app.
If I'm trying to access my own app's files, get a Context from the hooked app then use IPC (e.g. a BroadcastReceiver for my app, and use Context.sendBroadcast() from the hooked app).
I think you want the second but that's what you're doing currently if I'm not mistaken.
Click to expand...
Click to collapse
Yep, just used a ContentProvider/Resolver instead. :good:

Pixel 5 @Android 11 - Camera 0: Error clearing streaming request: Function not implemented (-38)

Hello,
I'm developing an app using the back camera. It works on many different devices and Android versions but on a Pixel 5 it seems to fail.
I get these errors:
E/CameraCaptureSession: Session 0: Exception while stopping repeating:
android.hardware.camera2.CameraAccessException: CAMERA_ERROR (3): cancelRequest:459: Camera 0: Error clearing streaming request: Function not implemented (-38)
at android.hardware.camera2.CameraManager.throwAsPublicException(CameraManager.java:1009)
at android.hardware.camera2.impl.ICameraDeviceUserWrapper.cancelRequest(ICameraDeviceUserWrapper.java:99)
at android.hardware.camera2.impl.CameraDeviceImpl.stopRepeating(CameraDeviceImpl.java:1251)
at android.hardware.camera2.impl.CameraCaptureSessionImpl.close(CameraCaptureSessionImpl.java:578)
at android.hardware.camera2.impl.CameraCaptureSessionImpl$2.onDisconnected(CameraCaptureSessionImpl.java:789)
at android.hardware.camera2.impl.CameraDeviceImpl$7.run(CameraDeviceImpl.java:245)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:223)
at android.os.HandlerThread.run(HandlerThread.java:67)
Caused by: android.os.ServiceSpecificException: cancelRequest:459: Camera 0: Error clearing streaming request: Function not implemented (-38) (code 10)
at android.os.Parcel.createExceptionOrNull(Parcel.java:2387)
at android.os.Parcel.createException(Parcel.java:2357)
at android.os.Parcel.readException(Parcel.java:2340)
at android.os.Parcel.readException(Parcel.java:2282)
at android.hardware.camera2.ICameraDeviceUser$Stub$Proxy.cancelRequest(ICameraDeviceUser.java:732)
at android.hardware.camera2.impl.ICameraDeviceUserWrapper.cancelRequest(ICameraDeviceUserWrapper.java:97)
Those errors don't come from my own code but from the internal camera2 library. For some reason, `onDisconnect`, the library tries to call `cancelRequest` but it seems that the phone doesn't implement that function.
How could I go about it?
Is there any way to change the version of camera2 used?

Categories

Resources