Force override camera image on android - android

Is there any way to force the android camera to see a specific thing, like an image?
I have an app called FakeGPS, and basically, any system that tries to use Android's GPS methods will get the fake coordinates that I setup using that app.
I want to do the exact same thing, except with the camera.
Any app using the camera will get the image that I put in.

The camera implementation is completely native, everything works with IPC calls between the system and the camera driver (that are provided by the different manufactor).
There is no way to intercept this chain without recompiling the entire OS.
You can find more info here.

as #dmarcato said - if you want to manipulate anything with the camera that would be relevant to every camera application - only way is to change android's native source code somehow - something that can be done only when compiling android OS image containing this changes.
so, if you are not going to provide to each one of your user a custom OS firmware (for each device you want to support - it's different image containing the specific binaries drivers..) you can forget about that.
if that's not enough, there is also the issue that native core camera code is not necessarily android code, but vendor specific code which probably entirely different on each device. this means that you probably need to implement your "hack" different for each device image to make it work.

Its quite unclear what you are trying to say. I guess you want to force setting some app to be used for specific files or content type. Setting default app from your code is impossible. Only user can choose their default apps for specific operation or content type.
But still you can run specific system app, BUT only from your application, like launching any system camera, regardless of the phone manufacturer:
Intent systemCamera = null;
PackageManager pm = getPackageManager();
List<ApplicationInfo> packages = pm.getInstalledApplications(PackageManager.GET_META_DATA);
for(ApplicationInfo packageInfo:packages){
Intent i = pm.getLaunchIntentForPackage(packageInfo.packageName);
if(i != null && i.getAction().equals(MediaStore.ACTION_IMAGE_CAPTURE)){
if((packageInfo.flags & ApplicationInfo.FLAG_SYSTEM)!= 0){ //check if system app
systemCamera = i;
break;
}
}
}
startActivityForResult(systemCamera, MY_POSITIVE_INTEGER_REQUEST_CODE);

I got this to work on rooted devices. You can use things like xposed http://repo.xposed.info/module/de.robv.android.xposed.installer to modify the methods used by normal apps to grab camera images. This won't work for recording or system native apps thought.
There you need other tools. If you want to do it globally and right at the camera source, you might need to build your own android kernel. But that's not that hard either. The issue there is that you will have to build another kernel for each device and firmware version.

At first glance, what you are wanting to do seems unethical.
Unless you are willing to modify kernel or system libraries, it is also impossible.

Related

Android: Interact with another app?

I'm looking to build an app that will restart my device at a specified time, then open up a couple 3rd party apps in sequence and run their feature/s.
For example: I would like to automatically restart my phone at 5am. Then have it open an antivirus app of my choice and run the scan. Then close that app and open up another app and run it's cleaner function.
I have experience coding, but I'm just starting to take a peak into android app development. So, I was wondering if this is something feasible to do.
Any advice would be appreciated!
I am not sure about the starting phone at the desired time, but I am sure you can start applications on boot using "init". Linux systems support that, and android does as well. But it completely depends on your kernel.
Read here about init.d.
Check if your phone's kernel supports init.d. Check here if your phone doesn't have init.d support.
Check Here for running a script at boot. It is quite useful for custom scripts.
Check Here for running scripts/application the application at boot
Create a script according to your needs and I think you would be able to achieve what you are looking for. <- Custom Rules
I would have commented but apparently I can not since I am new here.
I hope I was of some help. Will look into the android starting part and get back to you.
Cheers.

Trying to make uni-process device ... is this possible??? :(

Hy everyone, I'm Korean and a little short on using english so please try to understand if I say things not appropriate.
So, my status is that I have odroid-s.
What I'm trying to do for like month or more is that I want to make android to HelloWorld.
What I want to say is that, on the odroid-s, bootloader part, kernel part is the same but the framework part(which will be android), I'll remove all the android part and replace it with just HelloWorld program. The purpose of this HelloWorld program is to display HelloWorld on the screen.
What I think I discovered is that, as I 'vimdiff' bootlogs between normal bootlog and the one that I removed all the system partition part (which is android system partition part) is that android kernel's init goes on and executes console(/bin/sh), netd(bin/netd), ... and it enables adb and it completes his work.
So my conclusion is, I need to use Linux kernel that is non-modified and modify it for odroid-s, and use that kernel for my HelloWorld program!
What I want to ask is.... Am I doing it right?? T_T
My goal right now is to make HelloWorld come out from this odroid-s device...
Please somebody help me. If anybody don't understand what I wrote plz tell me, I'll fix it.
Thx for reading....
The modifications to the linux kernel are likely to be irrelevant to your goals, so you might as well leave them in place for simplicity.
Your biggest challenge is going to be output - where do you want to send it? If you had one of the devices that has (or can have with the right kernel config) a debug serial port, then it would be really easy to write something triggered by the init script (or even use 'echo' in the script) which outputs your message on that port.
But chances are you want to put something on the screen. This is going to be overwhelmingly more complicated, and perhaps device dependent. The way the android runtime does this for actual apps is going to be way more involved than you probably want to get into.
A more practical approach might be to look at how the boot animation is done. For starters you could just replace it with a static image that says "hello world". Once you can do that, the next step would probably be to find some character generator code. Finally you might want to implement scrolling and other terminal-like features.
As an alternative approach, there are builds of more traditional linuxes for some android devices - debian or ubuntu for example. These may include console implementations capable of displaying on the device screen.
As another idea, if you are flexible about how much of android you would be willing to leave on the device, you could build a version of the android terminal emulator example, modified to be a home screen replacement. You might be able to remove a lot of android components (eventually including the default home screen). Or on a secured device (ie, most consumer devices that haven't been rooted) you could just do the home screen replacement while leaving the actual system unmodified. It wouldn't be secure against users wanting to run other things, but generally the user would interact only with your code.

Tcpreplay in Android?

I am performing some experiments where I want to replay a previously captured packet trace from Android. So far I have written my own application to replay the trace and get then answer back from the server. Timing accuracy is not a big problem as long as is within reasonable bounds (e.g., some milliseconds).
However, I would prefer to use a tested tool like tcpreplay. Is there any project that have ported tcpreplay to Android? Given that libpcap is available, there should be something available, but I could not find anything.
Thanks for your help
I'm the author of tcpreplay, and I can't say I'm aware of an Android port. Never owned an Android device so can't say one is coming anytime soon.
I've got it running on my tab, you need to install GNUroot and Debian no root, they are both from the same developer... After get it, open GNUroot, check emulate new root, create rootfs and run the rootfs, after this "apt-get install tcpreplay". If you want to capture use TpacketCapture in the play store, you can also get Tpacketcapture Pro to use the capture in only one app.
If you are planning to hack games don't publish it, cause this vulnerability can be easily patched...
any question email me.

Is it possible to configure an Android install to run a single app?

Is it possible to configure the Android OS to run only a single app?
Basically what I want to do is customize an Android device so that it boots up and runs one application only, and for that application to be switched to the front of the screen automatically. Also, when it gets closed, to be started up and switched to again. Any ideas?
Thanks,
-David
One method is to get the source of Android and write your own custom ROM of Android as Octavian wrote.
Another alternative would be to write a custom home app that, well, isn't really a home app (but replaces the default home app intent). See SlideScreen as an example of a non-traditional "home" app.
Yes it is possible. You have to fetch yourself the source codes for Android and basically create a custom ROM. After applying all desired modifications you bake your ROM and install it to your device.
Pretty much all you need to know about the source and the process of compiling the sources are located at Android Sources. You can view the source codes from your browser by following this link.
Hope it helps you a bit. Good luck.

[android]how can i create customize profile like meeting etc

i m new in android i want to create application that gives option for create new profile (like meeting,outdore etc),manage profile(not location base it's manually)
plz help me
If I understand you correctly, you want to quickly switch between several profiles that change certain settings like Wifi On/Off, mutes all sounds, etc. right?
If that's what you want then your best bet would be to not re-invent the wheel and - depending on what phone you have - to install a custom ROM like CyanogenMOD which already features profile management. This would void your warranty though.
Otherwise, you could possibly achieve this with either an Xposed module (will most likely only work if you have a Nexus device, since it requires a pure "AOSP" version of Android and Root permissions) or the app "Tasker" which also requires Root access.

Categories

Resources