[essay] Old Xie and Google's a positive "confrontation"

Source: Internet
Author: User
Tags semaphore

[essay] Old Xie and Google's a positive "confrontation" One, nonsense

Say Smart TV, domestic LCD TV manufacturers do lead the trend of the times. From a global perspective, after the Google I/O conference a few years ago, there was also a wave of smart TV. The application of Google's Android open system in smart TVs is also beginning to emerge. The development of Google and MediaTek in the direction of smart TV will again push the development of Android Smart TV to another level.

Lao Xie was fortunate to join the Andriod, recently dealt with a problem, want to share with you. This is not so much the old Xie and Google a positive confrontation, rather, it is a harvest of knowledge.

Second, Google encountered the crash

The problem is often based on a platform.

Google Android Open Smart TV has been basically developed. Based on this platform, Google wants to replace the front-end (tuner&demod) bottom part of the original TV with USB dongle, that is, based on the Android Smart TV +usb dongle to realize the TV sweep platform function. The steps for its development can be broadly divided into:

    1. The first step, based on the original TV tuner&demod as the underlying hardware and driver driver, the development of the upper APK application;
    2. The second step, based on the first step, is to use USB dongle to replace the original underlying hardware and driver after the application layer has been developed.

And, it is in the first step of the development process, Google encountered a problem, that is, after the completion of the platform, cutting down the machine (hang-up).

Third, how to build a platform

Old Xie Mantra: To solve the problem, you must copy the problem.

As mentioned earlier, Google borrowed front-end's shell to play its own apk. Now that there is a problem, we cannot escape. In accordance with the old Xie Mantra, we must first try to build the same platform environment, and replicate to the same problem phenomenon, this is the first step.

Lao Xie Follow the steps below to build the development environment.

    1. Google provides its Java app source Code,code specific content does not expand, also cannot expand (you understand)
    2. Unzip the source code provided by Google and place it in the./device/google/archer/Directory
    3. Modify Device.mk to add the source code provided by Google into the build list
    4. Recompile Android body so that the newly generated system.img contains the Google apk
    5. Upgrade SYSTEM.IMG to TV platform
      However, after a successful upgrade, you cannot use the Google apk app because there is less JNI (Java Native Interface). Google develops Java applications, and if you want to invoke C-language functions (front-end driver is C), you can't have less jni. In this way, we also need to push the JNI library onto the TV platform.

    6. Push the libtunertvinput_jni.so library provided by Google to the/system/lib directory of the TV platform, which is implemented through the ADB (Android develop bridge).

    7. How do I push libtunertvinput_jni.so to/system/lib?
      A. Install ADB tool in Windows environment (Baidu is also a bad luck, Wei Zesi incident), not introduced.
      B. Connect the TV USB adb port to the Windows PC USB port at this time in the Explorer to see the following:

      C. Start the cmd command line in a Windows environment and use the following command push. So to TV platform
      ADB root
      ADB remount
      ADB push Libtunertvinput_jni.so/system/lib
    8. After you restart the TV platform, you can launch Google apk.

At this point, Lao Xie finally set up the platform, then began to reproduce the Google report problem.

Analysis of the freezing problem

During the debug process, Lao Xie discovered that Google APK's sweep process is as follows:

    1. Tuneropen () is called.
    2. Tunerconnect () is called for each frequency, it means tunerconnect () is called many times.
    3. At last, Tunerclose () is called. It is strange to call Tunerclose () at the This moment.

The Tunerclose () is called in the third step, which is problematic because semaphore is removed in Tunerclose (). After the deletion, and then directly call Tunerconnect () to do the cutting table action, there is a freezing phenomenon, because semaphore.

Lao Xie shares this article, mainly to encourage themselves and friends on the road to continue and in-depth learning of Android knowledge.
Through the handling of this problem, Lao Xie himself also realized that if there is no prior knowledge of the accumulation of Android, it is estimated that the old Xie is still thinking how to start the problem ...

Itxiebo
20160504

[essay] Old Xie and Google's a positive "confrontation"

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.