Adding new audio effect java class in android - General Questions and Answers

I am trying to integrate a new audio effect class (fader) in java.android.media.audiofx.
My intention is to make fader class part of the framework.jar so that I can build application on top of this. I don't want this fader class part of my app, instead I want this to be part of framework.jar.
when I compiled the framework, I got error saying I should do update_api for this.
I think if I do update_api, I will not be able to link this framewok.jar with my studio project also there may be some issue if I load this app in a device because of the API level mismatch.
Is there any way to do this without updating API level.

Related

Loading a framework class which is not in the SDK :)

Hi there. I need some help
I'm trying to make a radio app for HTC Desire but as you may know, there's no official API for that. So it's time for some hacking. By decompiling the FM Radio app and the framework.odex into .smali files I was able to find the path to a class that is used to control the FM tuner It's a system service. getSystemService with a string I've discovered returns an instance of the FmReceiver class.
So let's say FM_SERVICE is a string containing the service name.
Let's say FM_RECEIVER_PATH contains the path to the FmReceiver class (like com.something.FmReceiver)
By using the .slimi files I was able to see the methods inside the FmReceiver class. So I made a new abstract class and put all the methods I saw in the original FmReceiver.slimi file as abstract methods (because there's no way I can reconstruct their bodies). I renamed this file FmReceiver.java and put it in a package FM_RECEIVER_PATH into my Eclipse project.
So in the end I have a FmReceiver class in my project which does nothing (because all its methods are abstract) and a FmReceiver class which is on the device, in its framework.odex which has the same methods as my FmReceiver class except that they really have code inside and can do useful stuff.
To illustrate the things I've done so far:
Code:
Class<?> receiver_Class = Class.forName(FM_RECEIVER_PATH);
Object obj = getSystemService(FM_SERVICE);
Object instance = receiver_Class.cast(obj);
FmReceiver receiver = (FmReceiver) instance;
receiver_Class.isInstance(obj); //returns true
instance.getClass().getName().equals(FmReceiver.getClass().getName()); //returns true
I'm sure that the variable instance has the correct instance of the device's FmReceiver class. But can I cast instance to the class FmReceiver I've made like that? That code doesn't raise any errors but the functions are too complicated to track them to see whether they work.
So my question is - is this correct? Can I make such a cast to an abstract class and expect it to work properly afterward
Hah, you are using similar technique to mine in Google Maps mod You don't have to use Java reflection API, you could use your stub class as usual and at runtime the framework one will be used
Really?!? I haven't thought of that I'll try it
Oh yeah, oh yeah, oh yeah!!! It worked!!! Wow. Thank you man! I've been struggling with that for so long Actually it would have worked the way I did it as well, but now I discovered that I had an error in one of the methods in the abstract class Anyway I was so glad when that listener returned a value Cheers

[Q] What is an asset file ? (an eventually how shoud it be managed)

Hi,
I'm a developper/system debugging on Android Gingerbread for new smartphones with Intel processors. I am currently integrating new components and middleware for Intel adaptation, especially in sound/audio domain. I am quite newbie on Android.
In the Android system, there are asset files to provide applications or service the method to get their ressources files like audio notification sound files.
My problem is that for a particular service, these asset files are not found and it takes some time to check and return that these files are not found. As a result, a latency of 10 s is observed, when asking for system volume levels.
This happens to the Mediaplayer (Mediaplayer.java) in the setDataSource method. The method openAssetFileDescriptor tries to open an uri which is "content://settings/system/ringtone". Does it mean that it looks for some package Id ringtone ? It is also the same for notification_sound and alarm_alert. And of course, these ids are not present under my platform, so a File Not Found exception is raised..
If you may have just a small clue about this, it might help.
Thanks
Vinio
So do I have to admit that no one know about asset files in the Android world except people from Google ?

[Q] Unknown library libverde.so

Hi,
I'm trying to work through a hardware detection problem running an app (Osmos, purchased in the Humble bundle for Android). It seems that maybe there's something weird about how my Chinese tablet reports its multitouch or something, I figured I'd just hack the apk to remove the multitouch check and be done with it.
The problem is that the error string isn't in the application itself, it's part of a support library and occurs during initialisation, there's no obvious call to the library to ask for multitouch though I'm sure something flags it as required somewhere along the line but probably in one of a couple of parameter values that are long, undocumented integers.
The support library is called libverde.so and appears in the apk's lib directory when decompiled (apktool, dex2jar, JD are the tools I'm using). There's almost no information about it on the net, only a reference on a pirate site about patching it to remove a check for screen size (similar to what I want to do).
Has anyone heard of this library? Can provide any information on it?
bp.

[Q] Conversion to Dalvik format failed with error 1 - Tried many solutions

Okay I know there are a bunch of these topics out there, but I have tried just about everything I could find and still I cannot get it to work. I have worked with my project for about 6 months with no errors, I stopped for 3 months and got back into it on a new computer and now it keeps giving me this error when trying to export a signed APK. I have tried the following:
Turning off Build Automatically (and cleaning the project many many times)
Tried Android Tools fix project settings
Changing the proguard.bat to include %1 %2 %3 etc
Removing the libraries from the Java Build Path > Libraries
Uninstalling Eclipse and Reinstalling the new version
Using the new Android ADT Studio
Removing the SDK's and downloading all the new SDK's
I am getting very frustrated and 7500 lines of code in, I dont feel like just starting over. Any suggestions on what steps i should take next?
This is the console error I am receiving:
Code:
[2014-11-08 17:48:57 - ZombieBird-android] Dx
trouble processing "java/io/BufferedInputStream.class":
Ill-advised or mistaken usage of a core class (java.* or javax.*)
when not building a core library.
This is often due to inadvertently including a core library file
in your application's project, when using an IDE (such as
Eclipse). If you are sure you're not intentionally defining a
core class, then this is the most likely explanation of what's
going on.
However, you might actually be trying to define a class in a core
namespace, the source of which you may have taken, for example,
from a non-Android virtual machine project. This will most
assuredly not work. At a minimum, it jeopardizes the
compatibility of your app with future versions of the platform.
It is also often of questionable legality.
If you really intend to build a core library -- which is only
appropriate as part of creating a full virtual machine
distribution, as opposed to compiling an application -- then use
the "--core-library" option to suppress this error message.
If you go ahead and use "--core-library" but are in fact
building an application, then be forewarned that your application
will still fail to build or run, at some point. Please be
prepared for angry customers who find, for example, that your
application ceases to function once they upgrade their operating
system. You will be to blame for this problem.
If you are legitimately using some code that happens to be in a
core package, then the easiest safe alternative you have is to
repackage that code. That is, move the classes in question into
your own package namespace. This means that they will never be in
conflict with core system classes. JarJar is a tool that may help
you in this endeavor. If you find that you cannot do this, then
that is an indication that the path you are on will ultimately
lead to pain, suffering, grief, and lamentation.
[2014-11-08 17:48:57 - ZombieBird-android] Dx 1 error; aborting
[2014-11-08 17:48:57 - ZombieBird-android] Conversion to Dalvik format failed with error 1
bump -> still trying to figure this out, and help would really be appreciated as I cannot really continue any further with my project.
Thank you!
Can someone please help? I'd really appreciate it....

[Q] Android Kernel Trace Tools

H,
Currently in the process of trying to edit the NFC source files of Java to change some of the functionality of the HCE feature of Android versions 4.4 and above.
I've downloaded the source and installed a custom version of AOSP to my Nexus 7, and am now looking to start adding my own code. However, when looking at how these source files are used/called i'm running into some trouble.
Are there any Kernel Trace programs available, to see what files/functions are being called and in which order, so I can start looking to add my own modifications to the source?
Any help is appreciated,
Thanks - Jay
XPosed
If the Java part of HCE is all you are interested in you may want to give a try to the Xposed framework [1].
The framework will allow your app to hook into any JAVA system call on a rooted device. You can e.g. hook into HostEmulationManager.notifyHostEmulationData and log or even manipulate any APDU received. You will find a short tutorial at [2]. At [3] you will find a small Xposed module targeting HCE. It is a new framework but no big deal after all.
I'm interested in HCE too and gained some experience over the last weeks so what exactly are you trying?
[1]
http://repo.xposed.info/
[2]
http://forum.xda-developers.com/showthread.php?t=2709324
[3]
http://forum.xda-developers.com/showthread.php?t=2573430
Hi Thomas
Essentially at my university, we have student cards that are MiFare Classic 1/4k RFID cards, that when placed up against a scanner outside of buildings/labs, scans the UID of the card and checks if the student is allowed access.
When Emulating a tag on an Android device, the UID (Not the AID) is randomly set. This is (I believe) set in the libnfc-nci code at the lower levels of Android, and so will require modifications at that level, and the levels above to allow me to pass a specific UID down the Android stack that will then be set.
I asked a similar question on Stackoverflow and got the following response:
http://stackoverflow.com/questions/28409934/editing-functionality-of-host-card-emulation-in-android
Essentially i'm looking for a way to find out what code is called when HCE is turned on, to find where the UID is set - after that I can look at passing down my own ID down from an app to set it myself.

Categories

Resources