Android 4.0 virtual buttons, mobile phone mode, and tablet mode

Source: Internet
Author: User

Keywords: Android 4.0 phone tablet mode (table) virtual buttons LCD _density

Platform information:
Kernel: linux2.6/linux3.0
System: Android/android4.0
Platform: s5pv310 (samsungexynos4210/4412)

Author: xubin341719 (You are welcome to reprint it. Please note the author)

The newly retrieved BSP by Samsung does not have the three virtual keys "Return, recently opened application, and home" after compilation. During the design of our hardware, no corresponding physical buttons were set. It is usually troublesome to debug the program. How can we display these three buttons ?? Next we will illustrate.

At the same time, I introduced two other questions before starting the analysis:

Select Table mode and phone mode;

The LCD _density parameter is set to determine the icon density.

I. Introduction:

1. Mobile phone and tablet

The subject layout of the Android mobile phone and tablet modes is not the same, as shown in.

2. LCD _density

Ro. SF. LCD _density = 240 and Ro. SF. LCD _density = 160 are two different phenomena, which clearly indicate the use of this parameter. Next we will discuss a problem here.

To change the density of the screen change /system/build.propro.sf.lcd_density=240 high-density, at the right of the picture, comes by default in the mephisto's roms.ro.sf.lcd_density=180 low density, at the left of the picture(This means that the number of pixels per inch is 240=800/3.5" 3.5" is the screen of the H1 and 800×480 display resolution).So you can pick any number between 240 and 180 - personally I use 220.You can do this using root explorer apk for instance:

Ii. Problem Analysis

1. refer to the comments of netizens:

Change the value of the following attribute in \ frameworks \ base \ core \ res \ values \ config. XML to true;

<bool name="config_showNavigationBar">false</bool>

Status:

Mode: Phone parameter: config_shownavigationbar = true

The following situations occur:

(1) the black box on the edge of the virtual button has been displayed;
(2) You cannot see the three buttons;
(3) the color changes when you click the edge. The horizontal screen is the "return" key, and the vertical screen is the "recently opened program" button. It feels that the button is enlarged. From the above analysis, this phenomenon is caused by layout problems. Our LCD resolution is 1280*800. In fact, three buttons are displayed, but the icons are too big to be seen. At the same time, we introduce the two problems we mentioned earlier: (1) Table
Select the mode and phone mode. (2) set the LCD _density parameter to determine the icon density.

Obviously, we can see why the Phone mode and the icon cannot be viewed at the time of compilation. The icon set by LCD _density is too large.

2. Problem Analysis

Open the machine. In the serial port terminal or the ADB shell:

CD/System

Catdefault. Prop

We can see that:

ro.build.characteristics=phone

This is what we call table and phone parameter settings. Different modes are determined here. Find these parameters and set them there, and finally find:

Android_ramos_4412_02/Android/device/Samsung/smdk4x12/device. mk

Ifeq ($ (board_uses_high_resolution_ LCD), true) // (1). If conditions are met, set it to table mode; product_characteristics: = tabletproduct_copy_files + = \ frameworks/base/data/etc/tablet_core_hardware.xml: System/etc/permissions/Definitions $ (call inherit-product, frameworks/base/build/tablet-dalvik-heap.mk) else product_characteristics: = phone // (2). Set the Phone mode if the conditions are met. product_copy_files + = \ frameworks/base/data/etc/ Handheld_core_hardware.xml: System/etc/permissions/handheld_core_hardware.xml $ (call inherit-product, frameworks/base/build/phone-hdpi-512-dalvik-heap.mk) product_property_overrides + = \ Ro. SF. LCD _density = 240 // (3), LCD _density settings. Product_aapt_config: = normal hdpi endif

(1) if the conditions are met, set it to table

If board_uses_high_resolution_ LCD = true, it is set to table mode.

(2) set the Phone mode if conditions are met;

Board_uses_high_resolution_ LCD = flash, set it to phone Mode

(3), LCD _density settings.

When product_characteristics: = phone, the value of LCD _density is set to 240.

Now we need to use the table mode, so we need to set board_uses_high_resolution_ LCD to true.

Android_ramos_4412_02/Android/device/Samsung/smdk4x12/boardconfig. mk

OARD_USES_HIGH_RESOLUTION_LCD := true

Select board_uses_high_resolution_ LCD as ture to compile the screen mode.

(4) Restore config_shownavigationbar to the default value.

Set \ frameworks \ base \ core \ res \ values \ config. xml

 <boolname="config_showNavigationBar">false</bool>

Status

Mode: Table parameter: config_shownavigationbar = false

Compile and press the three virtual buttons in flat mode. Our problem is solved. Set to flat mode. Three virtual buttons are displayed.

3. Why is there only one black box in phone mode?

The problem has been solved, but we still have a question: why didn't we achieve the desired effect after being modified by netizens? Review"1. refer to the comments of netizens:"After the modification, some keys are used, but three buttons are not displayed.

Analysis Code: Android/frameworks/base/policy/src/COM/Android/Internal/policy/impl/phonewindowmanager. Java

mNavigationBarHeight =mHasNavigationBar ? mContext.getResources().getDimensionPixelSize(com.android.internal.R.dimen.navigation_bar_height) : 0; mNavigationBarWidth =mHasNavigationBar ?mContext.getResources().getDimensionPixelSize(com.android.internal.R.dimen.navigation_bar_width) : 0;Log.v(TAG, "xubin testmNavigationBarHeight = " + mNavigationBarHeight  " mNavigationBarWidth =" +mNavigationBarWidth);
Print value:

V/WindowManager( 1250): xubin testmNavigationBarHeight = 72 mNavigationBarWidth =63V/WindowManager(1250): xubin test mNavigationBarHeight = 72 mNavigationBarWidth =63

The printed information is also correct. This is when we start to mention the LCD _density parameter. We can see that when the LCD _density value changes slightly, the Icon size changes greatly, the resolution of our LCD is too high, X, so we can see the above phenomenon.

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.