Move system service from AOSP build tree to installable APK? - android

I am extremely new to Android development. My company supports our own Android build for our devices using the AOSP build tree with some of our needed system services and APK's being build within the AOSP tree.
However, we are planning on moving to a vendor supplied Android build and we want to remove a system service from the AOSP tree and move it into a separately build and installed APK, but still be accessible as a system service to other installed applications.
Being so new to Android development I don't really even know where to begin.
As a first step I find where the APK for the system service is generated/output in the AOSP tree. I installed this APK onto our device. The installation appears to have worked. However, when an application runs that needs to use that system service, Android displays a message about how the system service has stopped.
1. What steps do I need to take to make this work?
2. What other information is needed to diagnose the problem? I'm so new to this I don't know what information I should be providing.

However, we are planning on moving to a vendor supplied Android build and we want to remove a system service from the AOSP tree and move it into a separately build and installed APK, but still be accessible as a system service to other installed applications.
Assuming you have made changes in ServiceManager to add your own system service in AOSP. Yes, it is possible to move your system service to a separate apk. This will reduce your platform dependencies. However, sepolicy changes will be still required(in order to add your service dynamically in ServiceManager). Here is the complete reference to add system service from apk:
https://devarea.com/aosp-creating-a-system-service/#.XOOD9KRS9EY
The installation appears to have worked. However, when an application runs that needs to use that system service, Android displays a message about how the system service has stopped
Please elaborate, what changes you have made, and root cause behind system service crash.
What steps do I need to take to make this work?
Suggest to move you system service to a separate apk. Please refer above link which explains creating system service (from apk).

Related

Is there a way for my Android app to create an environment similar to how work profiles in Android for Work work?

I want my app to be able to create an environment where it can freely install and delete apps from this environment. The main purpose for this is so my app can install and update apk files for supporting apps without having to inform the user every time this happens. Is creating this environment possible?

Elegant classes loading and updating system

In the current state of the project I'm currently working on, I have a classic Android Studio project with a classic app on it.
For some good reasons (it's an embedded app), I would like to include an auto-update feature in the app, which doesn't require to exit it (I must stay inside the app or another app and never show the underlying Android system).
I have two solutions to do this :
Create another "updater" app which updates the app using the package manager command. It requires a rooted device to work, but it would suit my needs : when an update is available, the main app closes itself and opens the updater app which updates the main app and starts it back
Have the actual code of the application stored to the external storage and turn the APK into a bootstraper which downloads and runs the app
The later solution is the better one since it doesn't require a rooted device.
This is why I would like to write an elegant system to achieve this ; the development of the app should not be crippled by this (e.g. I don't have to upload the new classes at each build, I don't need to do extra voodoo work to add activities or permissions to the manifest...).
I thought of using the build variants of Android Studio :
Debug variant : build the app like usual, don't use the bootstraper
Release variant : don't include all the classes in the APK, build an external JAR which contains them and use the boostraper in launcher intent
I saw how to load external classes from the external storage, but I couldn't find anything on how to externalize the whole app code, including activities. I have the feeling that we just can't.
Would such a system be possible to develop ?

How to run application without activity in android version 4.X

Actually my application is running a service only when boot completed. it runs fine in android 2.2.
But when i install 4.0 android supported device it does not work. even after installation application is not running. I know after 3.X android have a change that application is not running when installed.
So how only service oriented application run in > 3.x android version ?
any help is appreciable.
How to run application without activity in android version 4.X
You don't.
First, you pretty much always need an activity:
You need to have your copyright notice somewhere
You need to have your license agreement somewhere
You need to have your disclosures of other open source components that you are using somewhere
You need to provide access to technical support, even if it is just a link to your Web site, somewhere
You need to allow the user to configure the behavior of the service somewhere
You need to give the user access to online help somewhere
You want to avoid the one-star ratings that come from apps that do not have a launcher activity, when the user installs the app, then cannot figure out how to run the app, and thinks that you are a complete moron as a result
This is above and beyond the technical requirement for a component of your app to be manually started before any manifest-registered BroadcastReceivers will work.

creating, installing and running a NATIVE android application/service

My company has 2 native applications that run on Windows/Mac/Linux as services or daemons. I have taken this code and compiled it with the Android toolchain. I have a rooted android device to which I can push this application, run as as process and it works great. However, I'd like to build some sort of installer (probably an .apk) to which I could add this native application and run on ANY android device (e.g. without being rooted).
So does anybody know of a link, example or even just how to "install" a native application and run?
Thanks
/Loren
To do this properly, you need to rework your native service to be a library utilized by an android Service, and operate in keeping with android's conception of services (lifecycle, status bar notification, etc).
Trying to run your own executable (vs library to an android-provided executable) is not something android makes easy and not something you are encouraged to do.

Developing customized version of built-in SMS/MMS Android Application

Okay, here's the situation:
I'm developing an application for a client (or trying to do so). It requires much (if not all) of the same functionality as the built-in SMS/MMS application. So, I thought - HEY! Android is open source right? I can take the application and modify to my needs, right?
So, I found the code on github for the MMS/SMS application (for some reason, based on the AndroidManifest file, it calls my project I built, "ConversationList"). But I get TONS of errors involving the import com.google.android.mms.* package and a couple other packages.
Everyone keeps saying "it's a private/internal package", and "download the entire AOSP". But, HOW do I do this on Windows, and WHY can't I just download the appropriate packages to use in the program?
ALL I want to do is build a project in Eclipse deploy it to my phone, and then modify the necessary code. If Android is open source, why so many secret/internal packages? This is frustrating.
Any advice?
So, I found the code on github for the MMS/SMS application (for some reason, based on the AndroidManifest file, it calls my project I built, "ConversationList"). But I get TONS of errors involving the import com.google.android.mms.* package and a couple other packages.
AOSP applications like this are designed to be built as part of a firmware image, not as standalone apps.
But, HOW do I do this on Windows
Most likely, you don't. Cygwin might work. More likely, you will need to use OS X or Linux, such as running Linux in VirtualBox. And the result of your build will not run on anything, except as part of a firmware build that you use to replace the firmware on a device.
WHY can't I just download the appropriate packages to use in the program?
Because that application is designed to be built as part of a firmware image, not as a standalone app.
ALL I want to do is build a project in Eclipse deploy it to my phone, and then modify the necessary code.
Then find a project that is designed to be built as a standalone app as your starting point. Or, work on modifying the project you are trying to use to work as a standalone app, by ripping out all the functionality that depends upon things that are not in the app itself.
If Android is open source, why so many secret/internal packages?
They are not "secret". They are part of the firmware.
For example -- since you appear to be familiar with Windows -- it is entirely possible that "apps" like Control Panel are not designed to be built independently from the Windows OS. If you were able to download the source code to Windows and tried to load Control Panel into Visual Studio, it is eminently possible that you could not create some standalone CPANEL.EXE file just via that one project. Rather, you would need to use a customized Windows OS build process to build the whole OS, which would then contain a CPANEL.EXE that would run within that built version of the OS.
Most of the AOSP apps work this way. Some have been forked to create standalone apps -- K-9 Mail came from the early version of the AOSP email app. I have no idea if anyone has done this with the stock AOSP Messaging app or not.
You could instead fork TextSecure[0] as it is no system application but looks very similar to the stock messaging application. The AOSP application needs to be installed on /system/app which requires root and might not be what your customer wants.
Please note that this application is copylefted (GPLv3) so you'd have to give your client access to the source code under the terms of the GPL if you fork.
[0] https://github.com/WhisperSystems/TextSecure

Categories

Resources