How to modify android system application - android

I made a little modification to the default Phone application of Android 4.2.2 from AOSP. I want to replace the stock app with the one i modified. When I try to remove the stock app and place the modified app (and then reboot), the phone app fails. I'm guessing it has got something to do with apk signing. Is there any way to solve this?
My device is rooted and i also have the factory image.

Related

Android - remove all app, except settings and custom app

I am working on a project where I am developing mobile app (android) using react native. The development of the app is fine. However, I need to remove all other apps from the existing device (I am using Nexus 7) but except settings and my app (the one that I am developing).
This special requirements is a must have as the device will be giving to the customer for one purpose only. So I need to have only one app installed and disable any option to installed any other apps from the app store.
But I have no idea, how I might be able to do so. So I really need your help. If you could guide me on this, would mean the world to me.
AFAIK you can't remove the standard applications because they are stored in flash memory (OS image) and this memory is readonly. What you can do is to download entire android, build own image stripping all the unnecessary services, applications, etc. And then flash this new image to the device. The process is not sample and straight.

Non-system applications install automatically on Factory Reset

I want to create an application that preserves its APK file with the ROM and is available (fresh installs) after factory reset.
Logic:
I bought a new phone from an e-commerce website and the phone had the e-commerce's application pre-installed on my phone.
I uninstalled the application but the application re-installed after I did a factory reset.
Uninstalling the application showed that it was a non-system application.
Automatically being re-installed shows it is included with the ROM.
How do I achieve this?
Factory reset basically wipes the internal storage and replaces it with a copy. On some models, you can replace that restore image- but you need the device's boot loader to be unlocked to do that. Its not a programming thing, its a matter of replacing the restore image with an image including your apk.
If you want your app to always be included in Device even after factory reset. For that you need to embed your app into that particular ROM, Like all google application comes already embedded in Android ROM.
Also If can develop new ROM from stock one then you can embed your apps too. Like, most of the Chinese and Samsung's TouchWiz ROM comes pre-bundled with their own APPs, instead of that stock one e.g Contacts(System), Messaging(System) and Flipkart(Non-system).

Persistent App on Android Lollipop

In my Android manifest, I have flagged my application as "persistent", so that it automatically restarts if it crashes, is less likely to be killed by the system, etc. I know that normal applications cannot use this setting, but I am working on a custom ROM, and I load my application into the priv-app folder, and so I am able to use it.
This works perfectly well on pre-Lollipop phones. However, when I load my APK onto an Android 5 phone, the "persistent" setting is no longer honoured. I can use 'dumpsys activity' to verify that my app is persistent on Android 4.4.4, but not on Android 5.0.
Is there some additional requirement for persistence in Android 5? I see that some system-supplied apps are still persistent, so it's not as if it's completely impossible. Thanks.
Turns out I misunderstood the nature of the problem. The real problem was that I hadn't given the apk the selinux context permissions. I used chcon to copy the context from another file in priv-app and that sorted it out.

Replacing phone.apk with a customized app

I need to know what are the steps in modifying the phone.apk app on android, which allows to call and receive calls (and what is shown upon talking on the phone).
What do I need to do (of course I have a rooted device)? is it possible to do the tests on the emulator first?
my guess is that I first need to fetch get its source somehow, use some kind of system signing, do the changes and put it forcefully into the device, maybe also restarting it.
However, I've never done such a thing and I couldn't find much help in xda forums and here, maybe because it's pretty hardcore thing to do , plus it might not work well on some devices.
I've noticed that the only thing that shows this is possible is the calls-recorder patch, which is incredibly cool by itself.
First thing is you need source code. Phone app heavily depends on the radio interface layer and radio interface layer is proprietory to what kind of communications processor they use.
I believe you cannot test on emulator unless you are working on nexus family of devices. Also phone app runs on a particular shareduserid which can break other apps running with same shared user Id . So you will need platform certificate for signing which is next to impossible for release version of phone software.
One thing you could do is download cyanogenmod code for your phone , do changes , build and download the whole of software on the phone rather than just phone apk.

Multiple APK's how does Play decide which to download

I am going to create a tablet APK, which will not have some functionality that my phone APK has.. that's basically the only difference, however since the tablet APK will have less permissions (no phone requirements) how do I make sure folks with PHONES are going to get the PHONE version of the APK?
IE, a table user will only get the version with no phone permissions, since their device doesn't support it, that I get.
But a phone user, could run the APK without the phone requirements, as well as the APK with the phone requirements, so how do I make sure that phone users get the PHONE version of the APK, using the multiple APK setup in Play?
Look at the documentation for the "compatible-screens" tag for the manifest file.

Categories

Resources