Learning about Android as an OS - Android Software/Hacking General [Developers Only]

I hope this isn't a stupid question. But I couldn't find any real info regarding this. And after reading the Mysteries of Science thread it seemed to me, there really isn't much information regarding such things. So:
I noticed that for almost all Linux based OS you can find in-depth descriptions on how the OS works on a basic level. For example where specific settings are stored.
The guides at android.com deal with app development, but don't specify how you use the OS as a root user. For example, if I want to change WLAN settings, there must be a way to do that without using the GUI or by using special classes but by editing a config file. Or where does Android store the startup settings, i.e. which apps to start at boot time or at specific system events. Or where do apps register as default app for viewing certain filetypes. There is a description how to code it, but not how Android stores that information and how it can be edited/viewed manually.
Since it's linux based I guess there are plain text config files for all those things. But where...? Was such information ever released by Google?

bur2000 said:
For example, if I want to change WLAN settings, there must be a way to do that without using the GUI or by using special classes but by editing a config file.
Click to expand...
Click to collapse
You can change network interface with 'ifconfig' command.
You can get ifconfig command by installing busybox.

There are commands that can be used, but this is still a bit liek try&error. So it seems there is no full documentation on how Android works?
Has Google ever addressed this, do they plan to release such documentation?

Related

Possible convert my iPhone-app to Android?

Hi!
Ive just finished an iPhone-application, and Im looking into the possibility to convert it to an android-application.
Let me tell you the basic structure of the app:
- It has a simple drill-down-menu, with three levels of lists. Pressing a list-item will bring you deeper down into the hierarchy, and pressing a back-button will take you up a step.
- At the bottom of the hierarchy is a webview that loads a unique webpage depending on the hierarchical path the user has taken. These web-pages (html and javascript) are all localized on the device so it never goes online.
- The webpages has two main resources: images, and sound (mp3). The sound should be playable from within the webpage. All these resources are also loaded from the device.
- When exiting the app, it should save its location and when relaunched it should reopen that location.
As you can see, its a pretty simple application. Im wondering if anybody could detail a little what I need for this to come alive on Android. Perhaps the application-layout Im after is so generic, even, that there is a template for this?
My background as a programmer is mostly C++ and C#, so Im more at home with the Java-syntax than the awful Objective-C that iPhone uses.
So far Ive installed the development-environment, and have tried out the basic "Hello Android"-sample. Thats about it for the moment.
porting your iphone add to android
hi there,
i'm a android programmer and did many games already. you can see my games at:
not sure you still need help to port your iphone app to android. may be you can send me the source code. i can do it for you. very easy for me.
Tony Chan
[email protected]
Android uses java syntax and java libraries
so if you like java, then you would probably like android
layouts are done in XML
chingy1788 said:
Android uses java syntax and java libraries
so if you like java, then you would probably like android
layouts are done in XML
Click to expand...
Click to collapse
hehe well said
I don't think anybody can tell you what you need to do. Just start by reading through all of this: http://developer.android.com/guide/topics/fundamentals.html and you should be able to handle this.
Note: your application appears to be trivial.
One thing that I suggest is that you forget about locally-stored web pages and just rewrite those pages in Android/Java. The reason I suggest this is that unlike apple, you can't make any assumptions about what browser the user has installed (if any), or what rendering engine their browser happens to have, or javascript engine, etc. There are AT LEAST three different rendering engines in use on Android, including khtml, gecko, and presto. There are at LEAST two different JAVASCRIPT engines, including SquirrelFish and V8, and soon you will be able to add SpiderMonkey to this list (when Firefox launches). And no, you can't force your application to call on a particular browser since this would violate the modularity designed into the platform.
DANNEMAN101 said:
Hi!
Ive just finished an iPhone-application, and Im looking into the possibility to convert it to an android-application.
Let me tell you the basic structure of the app:
- It has a simple drill-down-menu, with three levels of lists. Pressing a list-item will bring you deeper down into the hierarchy, and pressing a back-button will take you up a step.
- At the bottom of the hierarchy is a webview that loads a unique webpage depending on the hierarchical path the user has taken. These web-pages (html and javascript) are all localized on the device so it never goes online.
- The webpages has two main resources: images, and sound (mp3). The sound should be playable from within the webpage. All these resources are also loaded from the device.
- When exiting the app, it should save its location and when relaunched it should reopen that location.
As you can see, its a pretty simple application. Im wondering if anybody could detail a little what I need for this to come alive on Android. Perhaps the application-layout Im after is so generic, even, that there is a template for this?
My background as a programmer is mostly C++ and C#, so Im more at home with the Java-syntax than the awful Objective-C that iPhone uses.
So far Ive installed the development-environment, and have tried out the basic "Hello Android"-sample. Thats about it for the moment.
Click to expand...
Click to collapse
look at the NDK
Freedomcaller said:
look at the NDK
Click to expand...
Click to collapse
The NDK is *NOT APPLICABLE*.
Why don't you create a converter from iPhone to Android? There are few Italian app.. only this is better than Android for Italian user.. but I love Android!
I have an app that has been created for android, and I need help creating it for the iphone. I'll share the source code if someone will create the app for me please.
DANNEMAN101 said:
Hi!
Ive just finished an iPhone-application, and Im looking into the possibility to convert it to an android-application.
Let me tell you the basic structure of the app:
- It has a simple drill-down-menu, with three levels of lists. Pressing a list-item will bring you deeper down into the hierarchy, and pressing a back-button will take you up a step.
- At the bottom of the hierarchy is a webview that loads a unique webpage depending on the hierarchical path the user has taken. These web-pages (html and javascript) are all localized on the device so it never goes online.
- The webpages has two main resources: images, and sound (mp3). The sound should be playable from within the webpage. All these resources are also loaded from the device.
- When exiting the app, it should save its location and when relaunched it should reopen that location.
As you can see, its a pretty simple application. Im wondering if anybody could detail a little what I need for this to come alive on Android. Perhaps the application-layout Im after is so generic, even, that there is a template for this?
My background as a programmer is mostly C++ and C#, so Im more at home with the Java-syntax than the awful Objective-C that iPhone uses.
So far Ive installed the development-environment, and have tried out the basic "Hello Android"-sample. Thats about it for the moment.
Click to expand...
Click to collapse
Is it possible to post this in the Q&A and not development section?
sparksco said:
Is it possible to post this in the Q&A and not development section?
Click to expand...
Click to collapse
This is from the first half of 2009, I highly doubt that they care where it should be posted (now).
Converting iPhone app to Android will be greate.
I would like to have All My Recipes iphone app in my Galaxy Tab
It was be great if somebody can port the secret of mana game from iphone to android ! =)

How can I view the source code of an android app?

This is probably a noob question, but how can you view the coding of an android application? I just had a small test app developed for me and I would like to look at the "guts" of it.
I downloaded the emulator but I haven't been able to figure out how to see my app's code using it. Maybe there is another way that's easier? You know, something akin to the "view page source" tab enabled in many browsers that allows you to see an html page's code?
I tried opening it with TextEdit on my Mac but it says its not readable.
What's an easy way to take a look at/edit the code?
Thanks in advance for your help!
Android-apktool
Android-apktool - A tool for reengineering Android apk files ...
http: / / code.google.com/p/android-apktool
It is a tool for reengineering 3rd party, closed, binary Android apps. It can decode resources to nearly original form and rebuild them after making some modifications; it makes possible to debug smali code step by step. Also it makes working with app easier because of project-like files structure and automation of some repetitive tasks like building apk, etc.
It is NOT intended for piracy and other non-legal uses. It could be used for localizing, adding some features or support for custom platforms and other GOOD purposes. Just try to be fair with authors of an app, that you use and probably like.
Click to expand...
Click to collapse
Google "apk manager"
Sent from my DROIDX using XDA App
Thank guys, however it says it can't be found - see this screencast I recorded: screencast.com/t/kII8UcBqE1RQ
Any ideas?
I feel like it can't be that complicated, but there is almost no info about in on Google...

Project Cream (Beta)

Hello everybody,
I'm Alessandro and I'm a student in IT Security at University of Milan.
I'm doing a thesis about Android Malware and I'm building a system to automatize the analyze of every App in every Market.
This system use a lot of free opensource products that I'm trying to customize and integrate.
The base idea is to enumerate all App in every Market (offical and not), download every free app and get Apk, at this point there is a first step that involve our customized version of Androguard for static analysis, next step is an hybrid analysis in a customized Android running on emulator.
More in detail:
- We are trying to enumerate all App using Android market api code.google.com/p/android-market-api and we are currently at work
- We want to download every free App enumerated by previous step, I think is not possible to download directly Apk, so I assume that I must *download App in an emulator and save Apk by a backup utility, any suggest??
- Next step is to anakyze Apk with Androguard and publish report (MD5 of Apk, permission declared, services...) to Db - not yet started
- After androguard we have to install Apk in emulator running customized Android, and here we have a lot of difficulties.
First of all we want to install App silently, without human actions, this is not possible by default but did you think is possible to modify Android source code to allow this?
In addition I have built a customized kernel with SELinux support, next problem is that I have to add SELinux commands to BusyBox and cross-compile, anyone have already do this?
After that, we must create a scripts (maybe an App?) to run tcpdump and get suspect traffic data, get SELinux logs and made a sort of anomaly detection.
All this result must be sent to the same Db so we have a comparison between static and hybrid analysis for same App.
We are asking you a little help if anyone have already do one or more pieces of this system or if anyone wants to contribute in this project.
Thank you for all

[Q] how execute/apply xml file?

Hello,
I have a lot of problems with omnia 7 due to app profile network of samsung haven´t got the profile of my operator. I can set it thanks to a post of here, but I think that it is a bit difficult and you need the computer to set it. As I have studied some of programming c#, I decided to make an app that set mms and internet. I have already done the screen and I´ve get to make that app create the file xml with the code in order to set mms and internet, but I haven´t found information about how execute/apply the file xml with the app. Where can I find about it?
PD: Sorry, I do not control English very well
Hi,
I guess it's a topic a bit complex, but can not someone help me with this?
You use an OEM COM interface, accessed from C# by using Microsoft.Phone.InteropServices.ComBridge. One easy way to see how this is done is to look at the source of an app that does it. If you can't get the source to DiagProvXML, you could always just decompile it (decompiling .NET code is pretty easy and there are several tools that can do it). There are several other apps that also use provxml; one or more of them may offer source access.
Hi,
Thank for your help and I can select the services that I have load, but I have a small problem that I hadn't taken into account. I know c# but my apps are a lot of more easy that diagprovxml, and I can´t find the part of program that I´m interested. I use "JustDecompile" to decompile the app. Could you tell me what class(or classes) is (are) what I'm looking for?
Thank you very much again
Hmm... it's not linked in my SIG because it's out-o-date, but you could try using Search to find my old DeployProvXml app. It includes a pretty straightforward example of using provxml.
Essentially, you need the following things:
The interopservices DLL (allows you to use the ComBridge class).
The OEM DLLs (DMXMLCOM.dll and such).
COM class and interface definitions for them in C# (this is the stuff with the [ComImport] attributes and the GUIDs).
ID_CAP_INTEROPSERVICES in your WMAppManifest.
WPInteropManifest.xml file in your project.
Use the ComBridge to register the COM interfaces, then create an instance of the COM class(es), cast to the appropriate interface type(s), and use a variable of the interface type like any other .NET object.
You can read a bit more about COM and native code in Heathcliff74's guide. It's aimed at making your own native libraries, so skip all the stuff about creating your own COM classes and writing native code. http://forum.xda-developers.com/showthread.php?t=1299134
Hi again, Does the method WP7RootToolsSDK.Environment.ProcessConfigXml allow to set the parameters that have a tipical xml file?
thank you again
I'm not sure what you mean by "set the parameters" but the Root Tools SDK does in fact allow you to consume ProvXML files now (I think it even supports the query provXML and returns the output, though I haven't tried).

Wayland server for Android

ABANDONED
Hi! Does anyone here use Linux desktop distributions in chroot environment on Android device?
I am developing wayland protocol server for Android devices. If anyone is interested in checking my project, latest version of apk is always available here:
ftp://ftp.drivehq.com/mogryph/sparkle/
Currently I am only focused on running Xwayland as client. Also apk supports audio output.
Simplest instruction:
1. Android 6 or newer required, busybox required, root required
2. Prepare linux distribution in directory, image or on partition. Make sure you have Xwayland installed in it. Make sure you specify which DE to run (or at least xterm) in ~/.xinitrc
3. Install and start sparkle.apk
4. Press "edit user.sh", uncomment (remove #) line starting with start_generic_container. Change rest of this line to match your device:
first arg - image or partition where distribution is installed. If distribution is installed in directory and mouting is not needed, leave this arg unchanged.
second arg - mount point or directory with distribution. If you use mounting (first arg), this arg can be left unchanged.
third arg - name of the user which will be used to start Xwayland and DE. Its better to specify non-root. Also this is the user who must have .xinitrc in his home dir (see step 2).
5. Save user.sh and click "Start".
6. Any problems and crashes will be reflected in the log.
If you want audio output:
1. Compile and install driver from pcm_sparkle.tar.gz in your distribtion
2. cp 1.asoundrc ~/.asoundrc
If you have blinking problem, change upload_mode from 1 to 2 in settings. If you have bad performance, setting no_damage to true may help, but in most cases no_damage=false is better. Fastest upload mode is 0 (if it works).
If you don't trust me and don't want to give sparkle root permissions (I perfectly understand this) you don't have to. Also you can do without busybox.
But in this case, you need to understand and do a lot of things. Check sparkle's user.sh to get idea about what needs to be done. Basically:
1. You need to make /data/data/com.sion.sparkle/files accessible from inside chroot container. You can use bind bound.
2. Make sure you have tmpfs mounted over /tmp in container.
3. You may need to change selinux context on /tmp to match sparkle's context or disable SELinux.
4. You need to create new directory in /tmp, symlink sparkle's wayland socket from /data/data/com.sion.sparkle/files/wayland-0 to this dir. And export XDG_RUNTIME_DIR to point to this dir. Dir must be (ch)owned by user who will be running Xwayland and DE.
5. After all this, you can try to start Xwayland and your DE.
new version
New version
rgho.st/8Fbz64Rxj
Added x86 and x86_64 support. Actually it is rewritten almost from scratch but x86 support is the only thing others can notice...
Hello! This project is interesting. I tried you app and it works on my Xiaomi Redmi Note 4X(chromium and glmark from chrooted environment works very well)! Can you publish source code on Github, because it really interesting project?
Also I'm interested, please post it on github!
Did you put this up on github or move this thread? Looks very interesting.
1
Argh, sorry, I decided to abandon this project. You are free to delete thread. Also no copyleft-licensed components were used so I don't have to bother releasing sources.
Hentacler said:
Argh, sorry, I decided to abandon this project. You are free to delete thread. Also no copyleft-licensed components were used so I don't have to bother releasing sources.
Click to expand...
Click to collapse
Check your PM please!
1
Hello again.
For last two weeks I was rewriting it from scratch (yes. again... yes, third time).
Probably need another week to make it stable.
Currently I am not sure it runs on any device except my own 5-year old phone (LineageOS 14).
I will maintain last version here:
ftp://ftp.drivehq.com/mogryph/sparkle/
There is no English documentation, but you can see script "user.sh" to get idea about how to start xwayland. In most cases it should be enough to edit few lines in that script to make it work on another device. If you execute this script on your device with "install" argument, it is supposed to place itself into sparkle's directory and sparkle is supposed to run it ("start" function) automatically. Sparkle doesn't request root unless script does.
Here is video of sparkle working:
https://www.youtube.com/watch?v=tOSFYxCF7Q8
But it seems that KDE + video recording was too much for my old phone
Still, if you going to see video, don't close it until 2:00 where I turned of composition which caused lags.
Also on device everything looks much smoother than on video, even after 2:00.
When I watch fullscreen (1280x720) video on my device, sparkle + xwayland together add just 5% of CPU load (20% load of single core).
Thats it I guess... I tried to to discuss sparkle on 4pda.ru (russian forums), but got very bad reception. "xsdl is perfect, dont reinvent the wheel" they say. So I started to hate humanity and I decided to make sparkle personal project. Also this is last time I am solving reCAPTCHA to leave post on XDA.
Still alive
We are still alive. I've changed first post to reflect actual state. Now sparkle supports audio, auto-mouting containers and is lot more stable.
Yet there are still many things I want to improve in sparkle's core before adding new functions.
Also there are few demo videos on ftp.
Amazing!
Working great on my redmi 6 pro. Stock miui 9.9.3 rom. With linuxdeploy and sparkle from your ftp. No lag on visual and sound. My Linux distribution is alpinelinux arm64 arch.
Since first time I see your posting on 4pda. I'm interested in it. And finally it's on xda.
Thanks dev.
---------- Post added at 02:52 AM ---------- Previous post was at 02:44 AM ----------
For anyone interested in the topic. Please follow the instructions in documentation from ftp. And Translate it to eng from rus.
This sounds amazing! Just curious, is it related to https://github.com/twaik/sparkle ?
I now have it working very well on my Samsung Tab S3 using Xwayland and a tiling window manager. Firefox runs amazingly well!
Is it meant to be used only with Xwayland or will it also work with native Wayland applications?
BTW, I think if you open sourced this project and promoted it a bit, it could become quite popular. It's basically the first way to run X11 GUI applications on Android devices at full speed. If you set up a donation link, you could also get compensated for your time and effort. I'll personally contribute $20 if it's open sourced, and I'm sure others will chip in as well.
robsmith11 said:
This sounds amazing! Just curious, is it related to https://github.com/twaik/sparkle ?
Click to expand...
Click to collapse
Thanks for feedback. Nice to hear that someone managed to start this thing
Twaik's repository is clone of my very very old version of sparkle. I made that version years ago when I was just starting to learn linux and C++. Sparkle was rewritten from scratch two or three times since that version. And (I believe) current version is much better.
Regarding making it open source... Few months ago I had to find real job. Can't spend much time on personal projects any more. But I have my own strange programming style and my own vision of what sparkle should be. Not sure I want others to paint on my picture. It's probably all because of Twaik! I hate how he used old open source version of sparkle. He did terrible things to it, outraging all my beliefs Sorry!
P.S.: Yesterday I've uploaded another apk to my ftp. The file is called "sparkle-testing.apk". This version is much newer and has many fixes. But I've also changed to many things since tested version including some fundamental changes. No guarantee it will run at all on other devices. Interest is mega low and I get no test reports at all.
Hi Hentacler, I've just found your project - it looks really promising. Unfortunately, the only link currently working on this thread is to github. Is this project still live?
I have a samsung galaxy note 10+, and am using it as a laptop replacement. In addition to the android apps using Samsung Dex (Samsung's desktop solution), I have several linux distributions installed inside a chroot using userLand - so far, its working great. I'd be keen to give you project a try if it's still live, and am happy to help out with testing from my device.
Re open source - while I like your project, I'm not super interested in investing time into something that's not open sourced - I appreciate your concerns about wanting to maintain the direction, but having transparent development is pretty important to me. Is Twaik's fork of your project a better place to go?
Cheers.
tillum said:
Hi Hentacler, I've just found your project - it looks really promising. Unfortunately, the only link currently working on this thread is to github. Is this project still live?
I have a samsung galaxy note 10+, and am using it as a laptop replacement. In addition to the android apps using Samsung Dex (Samsung's desktop solution), I have several linux distributions installed inside a chroot using userLand - so far, its working great. I'd be keen to give you project a try if it's still live, and am happy to help out with testing from my device.
Re open source - while I like your project, I'm not super interested in investing time into something that's not open sourced - I appreciate your concerns about wanting to maintain the direction, but having transparent development is pretty important to me. Is Twaik's fork of your project a better place to go?
Cheers.
Click to expand...
Click to collapse
ftp://ftp.drivehq.com/mogryph/sparkle/
Link to FTP should work and there you can get two versions:
sparkle.apk - old version, but confirmed to work by 3-4 people.
sparkle-testing.apk - latest version, but only briefly tested by me.
I don't ask anyone to invest anything... Sparkle doesn't request root access or any other dangerous permissions (unless you enable automatic container mounting and starting) so it's safe to try for anyone who wants.
Btw, somewhere between these two versions I've replaced BASH container initialization script with LUA version. That was probably a bad idea. LUA script is harder to start directly as root and hacks I used may not work (currently may even cause application freeze if root access is denied). Going to revert to BASH probably. But this only touches people who want sparkle to mount container and launch everything automatically on single button press.
p.s.: Why I need to solve captcha every time I post something?
Thanks for the new release! I've updated and everything seems to be working without any changes on my Samsung Tab S3 with chroot and Arch Arm Linux.
Your changes also solved the flickering for me! The old version would flicker the screen whenever my keyboard's trackpoint activated, but it's not flickering at all any more. Performance seems to be about the same.
I think this could be quite popular, but not many people know about it. Perhaps a post on Hacker News or Reddit would raise awareness.
I understand your position on open source and maintaining control. One idea if you haven't already considered it is releasing the code with a restrictive license that forbids any forks. But either way, I'm enjoying being to properly use X11 on my tablet.
BTW, have you tried any native Wayland compositors? I don't really understand the Wayland ecosystem that well. I gave Sway a brief try, but it didn't seem to work. I've only been using XWayland.
@Hentacler Thanks for your reply! Very keen to get this working, but having a few issues. I'm unsure how to configure the user.lua file - I'm using your latest apk.
I have a non-rooted device, and am running archlinux under termux. Works fine with xsdl. I have installed xorg-server-wayland for X11. I'd appreciate any advice you have.
@robsmith11 Are you able to share how you got this working on Arch? Thanks!!!!
tillum said:
@Hentacler Thanks for your reply! Very keen to get this working, but having a few issues. I'm unsure how to configure the user.lua file - I'm using your latest apk.
I have a non-rooted device, and am running archlinux under termux. Works fine with xsdl. I have installed xorg-server-wayland for X11. I'd appreciate any advice you have.
@robsmith11 Are you able to share how you got this working on Arch? Thanks!!!!
Click to expand...
Click to collapse
I am not sure it is possible to use sparkle without root...
Sparkle makes it's directory accessible for everyone (chmod 777). Before Android 8 or 9 this was enough and xwayland from termux was able to connect to sparkle. Here is how people used to start it:
export XDG_RUNTIME_DIR=/data/data/com.sion.sparkle/files
Xwayland
But newer versions of Android brought more restrictions and termux can no longer connect to sparkle. These new restrictions are implemented using SELinux if you know what it is. Applications now have different security contexts.
But that is not all. Newest versions of android brought even more terrible meaningless restrictions effectively "killing" applications like termux and many others.
In short, from now one applications are not allowed to execute code (binary) that comes from "untrusted" sources. Termux used to download a lot of such code from it's own repositories. And now it can't. We can't even unpack binaries from assets.
So I can only help with rooted devices.
P.S. Please forgive me, but I am leaving this website. Making people solve recaptcha every time they want to post something is unacceptable level of contempt.
My mail: [email protected]
Thanks for that, will have a play. I could always just root my device. Weird about recaptcha, not having this issue. Currently through termux I have access to the whole sdcard, and am able to download packages (and distros) in it - will have a play and see what else is possible.
@tillum
I basically just followed the instructions on the first post for using Sparkle without busybox. I didn't need to modify the Lua scripts.
I'm guessing SELinux may be a problem without root. I'll try setting it up without root when I have a chance later.

Categories

Resources