Android has a native camera framework that adds its own API to the implementation scenario.

Source: Internet
Author: User

In the past 2 months, the basic requirements of the project have been basically customized and evaluated, which revolves around the A31 and Android4.2.2. Recently, due to the need, in the framework of modifying his camera, the application needs to give Hal a parameter to control the implementation of the underlying image processing algorithm, that is, to provide a reasonable API for the development and use of the app.

At first, the simplest and most effective way to do this is to re-customize the SDK, but the problems that are constantly encountered make it possible to switch parts of the idea, but the core does not change.

The architecture of the Android system is clearly structured, and in complex architectures it is often easy to understand, and now it seems that the last 2 months have essentially a deep understanding of both the camera architecture and the surfaceflinger, whether it's control flow or data flow, Basic can be located to the location of the source code, but also the lowest layer of the HAL to add the algorithm, at the same time, the core is the completion of the A31 resize module reasonable scheduling.

Scenario 1:

1. Add a new API function to the Camera.java for app development.

2. Update the API: Make UPDATE-API;

3. Compile the SDK for the source code to generate new Android.jar. Replace the SDK for app development under eclipse

4. Manually install the compiled apk.

Question: The android4.2.2 source code production SDK will have a natural bug, the solution is as follows:

CD Frameworks/basegit revert 5f9922d7c3bce158e4c7a58929d4075e7c91e32e

However, because the source repository is not synchronized with their own results, it is not possible to do git operations. It is not known whether this can be a complete solution to this bug.

Scenario 2:

1. Add a new API function to the Camera.java for app development.

2. Update the Make UPDATE-API.

3. Add the following android.mk with the new API to the app and add it to the/package/apps/, just keep the/res,/src, Androidmanifest.xml file:

Local_path:= $ (call My-dir) include $ (clear_vars) Local_module_tags: = Optional Local_src_files: = $ (Call All-subdir-java -files) Local_package_name: = A31camera local_proguard_enabled: = Full include $ (build_package)

4. Modify the SDK.MK function below/build/target/product

Add a line of code below to make your app the default app for your system:

Product_packages: = Calculator deskclock Email2 Exchange2 fusedlocation Gallery Music Mms openwnn libwnnengdic Libwnnjpndi  C libwnndict Phone pinyinime protips softkeyboard systemui Launcher2 development developmentsettings DrmProvider Fallback Settings sdksetup customlocale sqlite3 inputdevices latinime certinstaller livewallpaperspicker Apidemos GestureBuilder Cubelivewallpapers quicksearchbox widgetpreview monkeyrunner guavalib jsr305lib Jython jsilver librs_jni Connectivitytest gpslocationtest calendarprovider Calendar smoketest smoketestapp rild legacycamera A31Camera

5.MAKE-J8 generates a new system.img. Also completed the customization of the new system app.

The above two scenarios, the former can speed up the development of the app, the latter can complete the app directly customized to the system. In this project, the use of the latter also brought some convenience.

The advantage of customizing your system is that the ubiquitous source code will not allow your development and ideas to continue, and of course you will not be able to violate the rules and make random changes. Along the way, you can still find the benefits of reading code: it can speed up the redesign of the code, as well as the positioning and optimization of the location where the business flow is added.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.