How to make own OTA app in AOSP - fslota? - android

we have build Android from sources and it looks good on our device. Currently we need to make own OTA process, but we dont know how.
We try to implement FSLOTa (https://github.com/embest-tech/android_packages_apps_fsl_imx_demo/tree/master/FSLOta) against our http server, but documentation is very poor - so we simply add source to our source and compile it.
Problem is, that we see app in our box, but it doesnt nothing.
Or there is way to modify built in OTA app, when we change server to our server, we get http request at least. But we dont know, how tells http server to box about new version - any manifest file? XML, JSON or? Is there any example?
Or is there another simple way for implements OTA update to AOSP?
Thank you very much
D

I dont know about FSLOTa nor do I know about the device you are working on. But If you want to implement your own OTA process you could try the following (Just a short draft since your question is very broad):
Create a system app that checks from time to time your server for new packages.
if it detects a new package it downloads it to your device.
it copies the downloaded update.zip to /cache/
Then the app creates the following file /cache/recovery/command and writes --update_package=path_to_your_file in it. (For more commands see /bootable/recovery.cpp)
Then it forces a reboot into recovery
recovery installs your ota package.
Update:
I quickly checked the app you linked. I would check these things:
Do you get till the point where RecoverySystem.installPackage() is called ? (https://github.com/embest-tech/android_packages_apps_fsl_imx_demo/blob/master/FSLOta/src/com/fsl/android/ota/OTAServerManager.java#L282)
Do you see a message in logcat from the RecoverySystem that it is going to reboot? (maybe you have a permission problem and your app is not allowed to force "reboot recovery")
Is the path to your update.zip correct? (it should be in /cache/)

i have been developing an OTA updater android application, you should know application send request to backend server and receive a JSON file about the available update. everything iiiiiiiiiiiiiiiiiiiiii anwserd was ok on non/AB devices, but for A/B devices, the android application downloads the OTA package under /data
and installation will not happen in recovery or anything, the changes will apply to the unused slot before REBOOT.

Related

update application from USB flash drive

I need to update multiple applications installed on many Android devices.
Is there anyway to put theirs updated apks on USB flash drive, write some script that updates them and run this script manually after I plug it to the device?
I guess the most basic question would be why? Is this something you are purposely keeping off the app store? If it is not TOS breaking just pay the 25$ for a dev account and you can even just keep it in a beta/alpha status so only people you allow to can download it.
Beyond that Android phones can install APK's from third party sources, host the APK somewhere or get it to the user in some fashion and they can download from the phone and install.
Really the app store is your best bet.
It really depends on your use case and control of the devices that you are updating. Using an OTA update tool is always the fastest option for getting upgrades out. You can use BETA distribution, or TestFairy, or even hockey app, however, if you are not choosing to use these items then you will need to do a little extra leg work. Don't worry I won't patronize you with "why are you doing this", you asked a question so I'll do my best to answer it.
1) Register a service or app who's whole goal is to update others. Maybe you call it updateService.
2) Register a Broadcast Receiver for the updateService that listens for USB connected
3) Read the contents of the USB stick to know what needs to be updated. Possibly a folder system where you check "if folder exists, then update" or you can keep a local sql db of update service ownership that keeps track of last updates or current versions.
4) Once you see what needs installed have your service run ADB Install commands. However, if you have new permissions added then user interaction would be required unless you have root access or system level privelages on your update service.
Here is a package installer thread that will give you some ideas of how to silently update. Install apps silently, with granted INSTALL_PACKAGES permission
So the short answer is, yes you can do it, but the longer answer is revolving around the type of control you have, and if you have root or system level access and how much leg work is it worth to you. If you are ok with User Interactions on install then you won't have to worry as much, but I'm guessing you want silent installations.
Hope that helps.

Android: How to get the process id of the foreground app

First of all, please note that this question is not same as all the "android foreground app" questions I found on SO, please read on :-)
I'm trying to write an android app for my own use, using golang, without using android-sdk or ndk (this is the KEY point). It is pretty simple, just use golang to write a http service, compile it for arm CPU and voila my app is running and can be access by simply visit http://localhost.
For the purpose of my app, I need to know the currently running foreground application, to define it precisely:
Foreground application is the application that occupies the screen, or has an "activity" what-so-ever (forgive me I'm not an android developer).
Anything that that is depended by the foreground application (e.g. services) is NOT what I am interested in.
If the phone is LOCKED/screen turned off, I want the solution to tell me there is NO foreground app.
And since I do not use anything android, just treat the phone as a LINUX machine, I want the solution to use native LINUX ways, e.g. by inspect /proc, or by calling any installed android command line tool (including sending messages via these command line tools), but NOT using any SDK/NDK way so that I have to use java or incorporate these thing into my app.
Starting from Android SDK 26 (if I remember well) Apps are executed on -one-User-per-App, so (i.e.) WhatsApp is running on UID=30 and Telegram on UID=76, so executing a ROOT command of "ps -A -o PID,USER,NAME" you can parse output and then Kill all Processes that you don't want to be executed.
36119 u30_a149 <WhatsApp_packagename>
36203 u76_a211 <Telegram_packagename>
37399 root [kworker/1:2H]
37423 u0_a329 su
38069 root sh
Without Root Permissions nothing of what you're trying to achieve is possible simply because is not possibile to denied an application to be executed or to kill it without Superuser privilege.

Install updates for a Device-Owner App

Does anyone know what is the behavior in production of a device-owner App, distributed thru Google Play, when updates occur?
As we know, installing a device-owner App involves some motivation and is not easy: reset to factory default then NFC-provision the device with a second device etc… So even if we consider this step done, would any further update involve so much pain, each time?
This question occurs because on my development device, I cannot re-launch the device-owner App with changes if it was previously installed… unless I reset the device to factory settings!
Thanks for reading…
Once your Device Owner app is set, a new file is created under /data/system/device_owner.xml that references the Device/Profile owner apps.
The Android system is then reading this file to check which application is considered as Device Owner or Profile Owner App.
This file contains refers to the applications by using their package name. Updating these apps won't infer on this file since the package name stays the same.
When you're updating your app, just make sure you're always using the same certificate as the one you previously used when first setting you device owner for the first time (which is a standard rule of security for every application update in Android anyway).
Permissions can also be updated the same way, without the need to reprovision it through NFC, nor dpm tool.

Permission check event (or log) for Android

I understand that when you install an android app you need to accept the permissions requested by the app. When you run the app, when it comes to the point that app really about to use that permission and perform a task, the android system has to check again "whether this app is allowed to perform this task?". I need to perform some task (log the event) at this moment. How can I do this?
There is a catch. I want to identify these instances (moments) for other running apps (not for my app)
(Ex: I want to know when DropBox app is about to access the internet.)
I need to perform some task (log the event) at this moment. How can I do this?
You can download the Android source code, modify it to incorporate your desired security flaw, compile the results into a ROM mod, and install that ROM mod on your own device.
This is not possible via the Android SDK.
There is a catch. I want to identify these instances (moments) for other running apps (not for my app) (Ex: I want to know when DropBox app is about to access the internet.)
You are welcome to install and use a firewall package on your rooted Android device and perhaps hook something up that way, for this specific scenario. In general, what you seek is not possible, for blindingly obvious privacy and security reasons.

Shared folder implementation

I need to make a shared folder in android.
I want to be able to:
1) create a folder on the device(sdcard/SharedFolder). ;
2) create a folder on the server. ;
3) copy some files to that folder. ;
4) seamlessly synchronize those files with my Android(and vice-versa). ;
The idea is to make an ftp connection to the ftp server(local filzila server at first) and
compare my local files list to his remote files list(by means of comparing timestamps or any other way).
Then my application would decide which files are the most updated and will copy them(from device to server or from the server to the device).
So i have 3 issues which i wanted to talk about:
I.Currently i made my application be a Broadcast-Receiver which is being called by the Alarm-Manager repeatedly(with the inexact method) and run on its own process.
Upon receiving a broadcast i connect to the server and make the above.
currently the broadcast-receiver is set from some Activity(enable/disable buttons and thats it.)
What will happen to my Broadcast-Receiver after killing the Activity which set him? I understood that at some point the system will delete him from the Alarm-Manager too? How should i handle this? I want the program to run without the user handling it... hence after restart of the device and etc i don't want him to re-enable my program.
II. How would you suggest to handle the files compare between the folders? i would like to support copy, delete, edit on those files hence the most suitable version of a file should be on both the server and device after the sync.
i thought about making some manifest file in each folder and save in it data on the file like:
-who change it last and when
-how much readers does this file have(can it be done as a service of the phone? some event of opening a file or a folder?)
and etc.
III.
Any suggestions will be appreciated!
ADB provides a shell interface where you can issue commands shell commands. See http://developer.android.com/guide/developing/tools/adb.html#shellcommands
You can also use the sync command provided with ADB. Open a prompt and issue 'adb help' to see more.

Categories

Resources