[Q] Editing Android Kernel - looking for NFC/HCE Code - Android Q&A, Help & Troubleshooting

Hi,
I'm currently in the process of developing a project for my University course wherein I will be hopefully editing the functionality of the HCE Feature of Android to allow me to set my own UID when emulating a card.
Now, i've downloaded the AOSP source, and built a custom image with no edited code and installed that to my Nexus 7 (This includes downloading and including the Vendor specific hardware drivers), and i'm stuck on the next part.
I physically cannot find the device code that governs the NFC features of Android, and i'm unsure how to go about a) Looking for it, and b) How I should be editing this code.
Is the code for NFC in Android in the base Kernel? and if so how would I edit that before I run "make" again and hope it builds? or is it elsewhere? I've noticed that the files in the Vendor folder i've downloaded and extracted are in a .ncd format, which I don't think is editable.
Any help I can get on this would be greatly appreciated.

Related

[MOD] [HACK] Modifying stock Mms.apk to change user-agent

I have been reading around on the net about people previously modifying stock Mms apps on different Android based devices to change the user-agent used when sending MMS.
I can extract all the files, modify them and recompile and push back to my phone. But the strings I'm editing currently are having no effect on the messaging, or they're just causing the Mms app to FC when you add an image to the message.
Is there anyone out there that could help me with this as I'm sure a lot of people would benefit from this.
I can provide the Mms.apk extracted with the contents of classes.dex extracted too if anyone requires them.
So far I've edited the following files:
/com/android/mms/transaction/HttpUtils.smali
/com/android/mms/MmsConfig.smali
But literally only made small changes to various strings.
I hope there's someone who can help me out.
You do know the source of mms.apk is available right?
This is why I'm asking for help.
Last time I asked about the source someone told me that the latest stuff wasn't available.
This has already been done and the source is here, and the commit that added user agent selection is here.
If you want to see the code for the true stuck Mms, that can be found here.
Compiled for you and attached. There's also a whole bunch of extra bits that aren't in the stock Mms.apk like black background, customizable notifications, and other features that have been added in.
ChainsDD said:
This has already been done and the source is here, and the commit that added user agent selection is here.
If you want to see the code for the true stuck Mms, that can be found here.
Compiled for you and attached. There's also a whole bunch of extra bits that aren't in the stock Mms.apk like black background, customizable notifications, and other features that have been added in.
Click to expand...
Click to collapse
Awesome work! Works great on my Liquid.
appreciate posting the question and the Mms.apk. looks and works great on my N1.
ChainsDD said:
This has already been done and the source is here, and the commit that added user agent selection is here.
If you want to see the code for the true stuck Mms, that can be found here.
Compiled for you and attached. There's also a whole bunch of extra bits that aren't in the stock Mms.apk like black background, customizable notifications, and other features that have been added in.
Click to expand...
Click to collapse
Thanks for the info, I had seen one previously modified but it wasn't for the nexus one. I'll give this a try later.
Can I ask how you compile a single app from the git repo? I was having trouble doing it earlier and found the only way it would work successfully is if I compiled the entire OS image and took out the app I wanted. I'm clearly doing something wrong
Using ubuntu 32bit, I have the git repo already sync'd.
As far as I know, the only way to compile a single app is to compile the whole OS. Once you've compiled it all, you can just type 'make (app you want to compile)', for example 'make Mms', or 'make Launcher2', from the root directory of the source. Capitalization is critical, the apps are located in packages/apps and the folder name is what you use to make each. Once an app is compiled, it'll be located in out/target/product/passion/system/app.
ChainsDD said:
As far as I know, the only way to compile a single app is to compile the whole OS. Once you've compiled it all, you can just type 'make (app you want to compile)', for example 'make Mms', or 'make Launcher2', from the root directory of the source. Capitalization is critical, the apps are located in packages/apps and the folder name is what you use to make each. Once an app is compiled, it'll be located in out/target/product/passion/system/app.
Click to expand...
Click to collapse
Thanks, I'll try that on this current build I just compiled and see what happens.
Are there any adverse effects of compiling the stock OS and recompiling an app to then copy to a different version of the OS? I obviously don't run stock OS on my device, I run Cyanogens ROM.
Just want to make sure I could compile on 2.1-update1 and run on Cyanogens.
Often times there's no problem with that, but it's usually best to use a build environment that matches your run environment. You can download the full CM source from his github much the same was you did the stock android source, full instructions here. The only thing those instructions leave out is that after you've synced up, you need to plug your N1 in and from the source root run
Code:
cd vendor/google/passion
./extract-files.sh
That pulls in the required binaries that aren't open sourced yet.
does this work on non-rooted phones?
No. And it's implemented in just about all the custom ROMs now.
i'm about to root my phone, does this app resize pix and stuff like Handcent?
Any words for MMS mod for sense rom?
Hey there, i am just wondering weather you finally succeeded to modify your mms.apk
I am on htc with sense rom, updated to latest one. after update mod mms from cm keeps giving me FC...no longer able to use mms... i want to mod the mms.apk. any help will be very useful.
Thanks!

[Q] Various android-related queries

I have managed to compile (from source) and install CM7.2 on my HTC dream, but my questions below are related to Android:
1. Is there a way to find out which packages (.apk) were installed on my system and if so, how do I do that?
2. Is there a way to find out each package dependencies (I need to figure out this as I am bent on removing the vast amount of guff installed on the phone - I won't need 90% of this stuff)?
3. Similarly to 2 above - is there a way to look at dependencies of a package not yet installed on my system (i.e. the .apk file)?
4. How do I actually remove a package for good from the system?
5. Similarly to 3 above, how do I actually install a package from within the root system - I know I can do this via adb, but is there a way to do this inside the, say, command line terminal?
6. Is there a way to alter (understand remove) certain program permissions which I could see "granted" to a particular program/package? I know there are various ways to look at these, but I wish to remove permissions I am not happy being granted to that particular program/package.
And one last a bit more advanced query: I would like to build a single package from the source tree and then install the resulting .apk file on my system.
Basically, I will try to upgrade a package with a new revision and add a few patches to the package source of my own before compiling it and building it again.
I usually build the whole lot (all packages + the rootfs image itself) with "mke bacon", but if I want to alter the source and build a single package how do I do that?
I am not very familiar with the Android make system, so I don't want to go heads-first into something and make a real mess of it.
Thanks a lot for any assistance given.

[Q] Signing as a system app - failed to install - CyanogenMod

Hi!
I'm preparing a plugin for a vendor of ROM (a small phone manufacturer) and I need this plugin to have system permission. I've tested this on a rooted Cyanogenmod install by putting the app into /system/priv-app directory and it works.
Taking this a step further, I signed the application with Cyanogenmod platform keys from the source repository (platform.pk8 and platform.x509.pem). I've successfully verified that the key used to sign release build is indeed the one from platform.x509.pem.
When I try to install this application via "adb install" I get the following error: Failure [INSTALL_FAILED_INVALID_INSTALL_LOCATION]
Investigating further, it seems that installation of applications signed with platform key is not allowed (anymore): http://stackoverflow.com/questions/...o-install-a-platform-signed-app-to-user-space
Looking in the source of PackageManagerService.java in the current Android source[1], I don't see this restriction, but I doo see it in CyanogenMod source tree[2] with this commit[3].
The question is: is this the correct approach for non-CM ROMs? What is the preferred way to work around this for CM (apart from building a custom ROM and removing this piece of code, that is)?
Regards,
Miha.
[1]: http://grepcode.com/file/repository...android/server/pm/PackageManagerService.java/
[2]: https://github.com/CyanogenMod/andr...id/server/pm/PackageManagerService.java#L4592
[3]: https://github.com/CyanogenMod/andr...mmit/6b6ca8c8b2c11de5aed6d3df00729e69f34297f6

Porting AOSP to custom-built device

Hi everyone,
as title suggests, I'd like to "port" clean AOSP to be able to install and run it on the custom device.
Basically, the situation is following: I got a custom device, based on rockchip rk3288 SoC. The device currently runs Android 5.1 successfully. I'd like to update Android to version 6 (got AOSP sources and AWS builder image up and running), but the company that created Android v5 for us no longer exists.
Thus I am here to ask for advice(s) on how to proceed (or whether it even is a good idea to do that myself, given the fact that I have zero experience with Android ROMs development), possibly a step-by-step guide on what to do.
The question is, do I just find drivers for hardware components present in the device (usb hub, ethernet, etc.) and just somehow "link" those to existing sources (of AOSP) and just run the build with different parameters? Or do I need to build a whole new kernel for the given device-OS combination?
Thank you for any advice or opinion!
Well this is an interesting one. There are several routes you can take here.
If you have the kernel source code, and the source code for the drivers, you could probably build the kernel from source and use it to boot Android, however, as that's unlikely, you're looking at a more regular porting process, which usually consists of pulling the vendor blobs from the existing Android system, building AOSP/Lineage with those blobs involved, and hacking together a new ramdisk that HOPEFULLY will be compatible. It's a very long and very tedious process, but it's certainly possible.
From that you'll then get in to the debugging stage of finding out what works out of the box, you'll very well need to make changes to AOSP for it to work on that SoC.
abtekk said:
Well this is an interesting one. There are several routes you can take here.
If you have the kernel source code, and the source code for the drivers, you could probably build the kernel from source and use it to boot Android, however, as that's unlikely, you're looking at a more regular porting process, which usually consists of pulling the vendor blobs from the existing Android system, building AOSP/Lineage with those blobs involved, and hacking together a new ramdisk that HOPEFULLY will be compatible. It's a very long and very tedious process, but it's certainly possible.
From that you'll then get in to the debugging stage of finding out what works out of the box, you'll very well need to make changes to AOSP for it to work on that SoC.
Click to expand...
Click to collapse
Thanks for pointing in the right (or at least some) direction! I found some guide on porting ROMs which I followed, basically like you said. So I just replaced some files in System image. Will flash later today, so maybe I will get some results!
abtekk said:
From that you'll then get in to the debugging stage of finding out what works out of the box, you'll very well need to make changes to AOSP for it to work on that SoC.
Click to expand...
Click to collapse
So I was following this tutorial, although found some irregularities, let's say: For example, none of those 2 folders contained init.d/ directory, thus I didn't update it. Also, I haven't found META-INF folder therefore haven't updated updater-script.
Basically, when I did (or at least what I think I was doing was that I took /system partition from our current ROM, that is working on that custom device and replaced stuff in there by stuff from the new system I wanted to port. My idea from what I've read was that i took kernel (and boot/recovery) from the original, working ROM and "injected" the new system onto it. Is that correct? Is that what I needed to do? Because the problem is, I cannot boot into the system (might as well be because of Kernel version, because I am trying to port Android 6 on Kernel 3.10. which was used in the current ROM running Android 5). It looks like the device is stuck in bootloader, or "somehow doesn't know what to start" (sorry, I can't put it better), displaying only my device's logo.
When I connect it to the computer via USB cable, running adb devices shows me that device, but when I try to access shell using adb shell I got error saying that /system/bin/sh wasn't found, which made me thinking that somehow the /system partition isn't "linked" properly, like I stated in the beginning.
Was I doing everything correctly? Do I need to do something above that? (maybe do you know about some tutorial). I am trying to port AOSP 6 Android.
Thank you!

AOSP Development - Android 10 - Creating System Service

Hello Everyone,
This is regarding modifying AOSP and trying to add my own system service as part of the system for customized application. I have tried all the places I could from documentation on source.android.com to trying to post a query on their official Google Groups and also tried out reading out books on AOSP. Unfortunately the OS code is changing so rapidly the documentation is rather old and not up to date. And now this seems to be my last hope to find a lead on how to achieve this.
(This is the first time I am posting so please guide me in case of discrepancies)
So, I am trying to create a system service from scratch and bake it inside the AOSP build. The steps I figured out and followed are as following:
1. Create an AIDL file inside frameworks/base/core/java/android/os/IFooService.aidl
2. Create the implementation in frameworks/base/services/core/java/com/android/server/FooService.java
3. Modify SystemServer.java at frameworks/base/services/java/com/android/server/SystemServer.java and use the ServiceManager to start the service.
4. I need to specify SELinux permissions which I wasn't able to figure out even after checking out whatsoever documentation I can find online. So I went to device/google/bonito/BoardConfig-common.mk file and added BOARD_KERNEL_CMDLINE += androidboot.selinux=permissive text to ensure I get through the SELinux enforcement (though I know its a temporary solution).
5. I modified Android.bp file under frameworks/base to include IFooService.aidl file during compilation.
Unfortunately, after I successfully built the project and try to flash it on the Pixel 3a, the system is stuck at boot with Android logo.
I could see the service was successfully started after checking logcat and logcat -b but dies soon after. I can see that's the case with all the other services too. So probably its the boot time issue. Secondly, I can see the SEPolicy warning but the permissive parameter is set to 1 so that shouldn't be the issue. But still the Android doesn't boots up.
So my question is, is this the right way to define a new system service? I also read that it is not recommended to make changes to original files and try to create new service in the vendor directory. In this article https://devarea.com/aosp-creating-a-system-service/ it does just that by creating a persistent app inside the vendor directory and hosting the service inside. I tried even that but the build fails. And I could see the SELinux implementation has changed a lot with a need to include version compatibility changes which has to be incorporated manually but there is very limited and too confusing documentation regarding that!
Please guide me on what I might be doing wrong and how to resolve it? I have tried AOSP books, documentation and browsing the source code in last 30 days but with no luck.
I am also planning to share a comprehensive sample with the community post this because I feel it could help many people trying incorporate new system services and the documentation is also few and far between.
I'll add the actual code and logs if anyone can help me finding a way.
Thanks,
Gaurav

Categories

Resources