How to change Phone / Tablet in Android Frameworks ?
Definition of UI Mode
you can find in wake up Sequence.ServerThread#run()
- WindowManagerService#displayReady
- PhoneWindowManagerService#setInitialDisplaySize
Check in PhoneWindowManagerService#setInitialDisplaySize.
// Determine whether the status bar can hide based on the size // of the screen. We assume sizes > 600dp are tablets where we // will use the system bar. int shortSizeDp = shortSize * DisplayMetrics.DENSITY_DEFAULT / DisplayMetrics.DENSITY_DEVICE; mStatusBarCanHide = shortSizeDp < 600;
DisplayMetrics.DENSITY_DEFAULT is define in DisplayMetrics.java
/** * Standard quantized DPI for medium-density screens. */ public static final int DENSITY_MEDIUM = 160; /** * The reference density used throughout the system. */ public static final int DENSITY_DEFAULT = DENSITY_MEDIUM; /** * The device's density. * @hide becase eventually this should be able to change while * running, so shouldn't be a constant. */ public static final int DENSITY_DEVICE = getDeviceDensity(); private static int getDeviceDensity() { // qemu.sf.lcd_density can be used to override ro.sf.lcd_density // when running in the emulator, allowing for dynamic configurations. // The reason for this is that ro.sf.lcd_density is write-once and is // set by the init process when it parses build.prop before anything else. return SystemProperties.getInt("qemu.sf.lcd_density", SystemProperties.getInt("ro.sf.lcd_density", DENSITY_DEFAULT)); }
Case of Crespo(Nexus s),
swWidth = 480 ro.sf.lcd_density=240 shortSizeDp = 480 * 160 / 240 = 320Crespo has Phone UI mode.
Case of maguro(Galaxy Nexus),
swWidth = 720 ro.sf.lcd_density=320 shortSizeDp = 720 * 160 / 320 = 360Maguro has Phone UI mode.
If you want to use Maguro with Tablet UI Mode, change lcd_density from 320 to 160.
swWidth = 720 ro.sf.lcd_density=160 shortSizeDp = 720 * 160 / 160 = 720
Check !!
\frameworks\base\policy\src\com\android\internal\policy\impl- PhoneWindowManagerService.java
\frameworks\base\core\java\android\util
- DisplayMetrics.java
\frameworks\base\packages\SystemUI\src\com\android\systemui\statusbar
- all directory ( StatusBar / SystemBar)
No comments:
Post a Comment