[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:
- The first step, based on the original TV tuner&demod as the underlying hardware and driver driver, the development of the upper APK application;
- 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.
- Google provides its Java app source Code,code specific content does not expand, also cannot expand (you understand)
- Unzip the source code provided by Google and place it in the./device/google/archer/Directory
- Modify Device.mk to add the source code provided by Google into the build list
- Recompile Android body so that the newly generated system.img contains the Google apk
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.
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).
- 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
- 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:
- Tuneropen () is called.
- Tunerconnect () is called for each frequency, it means tunerconnect () is called many times.
- 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"