Android Dual Screen SDK Reference Ver103

stickscarpenterMobile - Wireless

Jul 19, 2012 (5 years and 5 months ago)

362 views


1/29
Android Dual Screen SDK Reference
Version 1.03
Copyright © 2011, KYOCERA Corporation All rights reserved.

History
Version

Description
Release Date

1.03
Public version of SDK reference
Feb 7, 2011








Supported OS Version
OS
Support Version
Emulator File Name
Windows
Windows XP
Windows Vista 32bit / 64bit
Windows 7 32bit / 64bit
Emulator_dualscreen_win.exe

Ubuntu Linux

Ubuntu 9.04 or later Emulator_dualscreen_linux
Mac OS X Snow Leopard (Mac OS X 10.6) Emulator_dualscreen_mac


2/29
Table of Contents
1. INTRODUCTION∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙ 3
2. TERMS∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙ 3
3. CONTENTS OF SDK∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙ 4
4. FUNCTIONS∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙ 5
4.1. Changing Screen Mode Automatically∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙ 5
4.2. Dispatching Open and Close Event∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙ 6
4.3. Getting Screen Mode ∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙ 6
4.4. Setting Orientation During The Full Screen Mode∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙ 7
5. SPECIAL DUAL SCREEN INSTRUCTIONS∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙ 8
5.1. Handling for onConfigurationChanged() method∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙ 8
5.1.1. Lifecycle of Dual Screen App∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙ 9
5.1.2. Activity Lifecycle when changing Open/Close status∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙ 10
5.2. Frame Buffer Layout ∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙ 11
5.2.1. Configuration of Frame Buffer∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙ 11
5.2.2. App Displaying on Full Screen∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙ 12
5.3. 270 Degrees Rotation∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙ 12
5.4. Large Screen Support∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙ 13
5.5. Orientation of camera viewfinder ∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙ 13
6. OTHER FUNCTIONS∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙ 14
7. DUAL SCREEN ADD-ON USER GUIDE∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙ 15
7.1. Configuration of Add-on∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙ 15
7.2. Set up SDK∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙ 16
7.2.1. Preparing of setup∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙ 16
7.2.2. Create avd∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙ 16
7.3. Launching emulator ∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙ 18
7.4. Create a new Android project ∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙ 19
7.4.1. Debug on Eclipse∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙ 20
7.5. Limited Compatibility Mode ∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙ 21
7.5.1. One-binary for both the dual screen device and single screen device∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙ 21
7.6. Dialog on the dual screen device ∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙ 21
8. SAMPLE APP∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙ 22
8.1. Getting Screen Mode in Sample App ∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙ 22
8.2. Handling Open/Close Event in Sample App∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙ 23
8.3. Structure for Switching Between Single and Dual∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙ 24
8.3.1. Layout Resource∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙ 24
8.3.2. Structure for Switching The Layout Resource
s
∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙ 25
8.3.3. Layout Resource∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙ 25
8.4. Other procedures ∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙ 29
8.4.1. Orientation Setting ∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙ 29
8.4.2. Displaying the Orientation and the Degrees of Rotation.∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙ 29


3/29
1. Introduction
This reference guides you through the development of the Android dual screen
device. As you read through the document, please keep in mind that the entire
document is based on the assumption illustrated in Figure 1. The top screen will
remain primary screen in both open/close status.
Figure 1 Open/Close status of the dual screen device

2. Terms
Term
Description
primary screen The main LCD screen
secondary screen
The screen hidden beneath the primary screen.
The device has to be opened to see the screen.
screen mode
Allows users to use the screen area
Screen mode has two values (full mode / normal mode).
The device set as full mode displays an application on the
dual screen. When in normal mode, the device displays
an application on the single screen.
app Application

closed
opened
primary screen

primary screen

secondary screen
screen area

4/29
3. Contents of SDK
Item
Description
SDK Reference
refers to this document and is a development guide which
includes API reference, User guide and important
reminder.
Emulator
this tool is for developing application on PC and has dual
screen.
Development tools

miscellaneous tools for development. (e.g. ADB, DDMS,
Trace View etc.)
Add-on
an executable binary file
(e.g. system.img and userdata.img)
Sample app a reference app for developing dual screen app.


5/29
4. Functions
4.1. Changing Screen Mode Automatically
The dual screen device has a function to automatically change the screen mode
when the device is opened or closed.
When users close the dual screen device, the screen mode is automatically
changed to normal mode, and a running Activity is displayed on the primary
screen. On the other hand, when users open the dual screen device, the screen
mode is automatically changed to full mode, and a running Activity is displayed
over the both screens.
Figure 4.1-1 Changing Screen Mode Automatically

As for the above figure 4.1-1, the orientation is changed when a user slide-opens
with holding the phone in portrait.
Orientation sensor outputs the following value according to the slide state.


Activity


Activity


90 degrees

0 degree

Figure 4.1.-2 Output of orientation sensor

0 degree

90 degrees

Orientation: Landscape
Orientation: Portrait

6/29
4.2. Dispatching Open and Close Event
The dual screen framework dispatches a broadcast-intent as open/close
trigger-event. You can handle the open and close event by catching the
broadcast-intent according to your purpose. (For example, vibrator is turned on
when the open or close event rises.)
Item
Description
Action Name com.kyocera.intent.action.SLIDE_OPEN
Extra Key “OPEN”
True open
Extra Value boolean
false close
Sample Code
(in Activity)
registerReceiver(
new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
if (intent.getBooleanExtra(“OPEN”, false)) {
// Add your handler code here
}
},
new IntentFilter(“com.kyocera.intent.action.SLIDE_OPEN”)
);

4.3. Getting Screen Mode
Since getScreenMode() method is already implemented in DualScreen class,
you can get the screen status (as opened or closed) by using this method.

Item
Description
Class Name com.kyocera.dualscreen.DualScreen
Method Declaration

int getScreenMode()
com.kyocera.dualscreen.DualScreen.MODE_NORMAL_SCREEN

normal mode
Return Value int

com.kyocera.dualscreen.DualScreen.MODE_FULL_SCREEN full mode
Sample Code
(in Activity)
Display display = getWindowManager().getDefaultDisplay();
Log.v(“screenMode”, display.getScreenMode());


8/29
5. Special Dual Screen Instructions
Special attention should be given to following open and close events.

5.1. Handling for onConfigurationChanged() method
When the dual screen device is opened (or closed), the dual screen framework
changes the screen mode to full (or normal) mode by dispatching a
corresponding event to the onConfigurationChanged() method for a running
activity.
To change a view-layout according to the screen mode changes, a
corresponding implementation in onConfigurationChanged() method for
view-layout is needed.
You can get the device orientation by using the ratio based on the screen width
and height. Additionally, you can get the screen width and height from the
Display class.
 With the following declaration in AndroidManifest.xml,
onConfigrationChanged() is called.
<activity android:configChanges="orientation"/>
 Without declaring a configuration with this attribute in the
AndroidManifest.xml, the activity (application) is shutdown and restarted
by default.


9/29
5.1.1. Lifecycle of Dual Screen App
As for the lifecycle of the activities in the dual screen SDK, the behaviors of the
events are exactly the same as the standard Android. Also for the lifecycle of the
activities in the single screen apps, the behaviors are the same as that of
standard Android.
Activity
starts
onCreate()
Process is
killed

Activity is
running
onStart()
onResume()
onPause()
onStop()
onDestroy()
Activity is
shut down

onRestart()
The activity is no long
er visible

Another activity comes
in front of the activity

User navigates
back to the
activity
Other applications
need memory

The activity
comes to the
foreground

The activity
comes to the
foreground

Figure 5.1.1 Lifecycle of Dual Screen App

10/29
5.1.2. Activity Lifecycle when changing Open/Close status
The following is a diagram for the activity lifecycle when changing Open/Close
status.
BroadcastReceiver.onReceive()

onConfigurationChanged()

Activity
starts
onCreate()
Activity is
running
onStart()
onResume()
onPause()
onStop()
onDestroy()
Activity is
shut down

The activity is no longer visible

Open/Close event
rises

Figure 5.1.2 Lifecycle when changing Open/Close status
In case that the activity is registered
com.kyocera.intent.action.SLIDE_OPEN

In case that the activity
is defined
configChanges=” orientation”


11/29
5.2. Frame Buffer Layout
For the clarification purpose assume the screen size is WVGA x 2 (800 x 960) for
Frame Buffer Layout
5.2.1. Configuration of Frame Buffer
The frame buffer of the dual screen device comprises of two LCD screens. When
the device is opened, the system creates a window that has a full screen area
(the screen area is 800x960 pixels). On the other hand, when the device is
closed, the system creates a window having a half-full screen area and offsets
the screen area in order to assign LCD #1.

Frame Buffer

LCD #0

secondary

screen

LCD #1

primary
screen
Figure 5.2.1 Configuration of Frame Buffer

13/29
5.4. Large Screen Support
Developing app for dual screen device needs setting the following definition in
AndroidManifest.xml. This will ensure that the app can use the full screen area of
dual screen.
Developer also can use the following definition for using full screen area. In
doing so, the support-screens attribute is set automatically as same as the
above definition.
App can use the full screen area by each definitions. However the definition of
minSdkVersion* is recommended for using new Android API explicitly.

* In fact, app can use the full screen area if the number of minSdkVersion
is set 4 or later. Kyocera’s dual screen device supports Froyo or later, so
to set “8” to minSdkVersion is recommended.

5.5. Orientation of camera viewfinder
Generally, when developing a camera app, developers should consider the
orientation of camera viewfinder and should dynamically set the fixed
orientations as below:
Screen Mode
Fixed Orientation
Normal Landscape
Full Portrait

<supports-screens android:largeScreens="true"
android:anyDensity="true"/>

<uses-sdk android:minSdkVersion="8"></uses-sdk>

14/29
6. Other functions
The following functions are supported:
 Both primary and secondary screens have the independent touch panel,
the multi-touch function capable of detecting 10 touch-points in total, and
the motion-event capable of striding over a center bezel.
 Key-set includes Home key, Menu key and Back key as standard Android
keys.
 The size of heap memory used by the application is 32MB.
 Large-size software keyboard.

 The automatic full sizing of single screen app.
A single screen app which is not expected to run on dual screen is
adjusted to the full screen size automatically.
 Large-size notification panel.

Figure 6-2 Large-size software keyboard
Figure 6-3 Large-size notification panel

15/29
7. Dual Screen Add-on User Guide
7.1. Configuration of Add-on

Figure 7.1 shows the location of the open/close button. Just like the standard
Android, the emulator’s rotation is changed when pushing CTRL-F11.

・ANDROID_SDK_ROOT
+ add-ons
+ addon_dualscreen_kyocera_corporation_8
+ docs - DualScreen API Reference
+ images - Kyocera DualScreen Platform Emulator Images
+ libs - DualScreen API Library
+ skins - Emulator Skins
+ tools - Customized Emulator for DualScreen
+ samples - Sample Application for DualScreen
Figure 7.1 Open/Close Button
(The above image is captured in the landscape mode.)
Open/Close Button

16/29
7.2. Set up SDK
7.2.1. Preparing of setup
 Unpack the archive SDK file
(addon_dualscreen_kyocera_corporation_8.zip) to Android SDK’s
add-ons folder.
 Set environment variables.

7.2.2. Create avd
7.2.2.1. In AVD manager
1. Launch “Android SDK and AVD Manager” in tools folder.
2. Select “Virtual Devices”, and click “New” button to display “Create new
Android Virtual Device (AVD)” dialog box.
3. Fill in “Name” field and “SD card” field with those of your choice.
4. Select “Kyocera DTS Add-On API Level 8” from the “Target” drop down
list.
5. Click “Create AVD” button.

For Windows


path={USERDIR}/android-sdk_r06-windows/add-ons/
addon_dualscreen_kyocera_corporation_8/tools
ANDROID_SDK_ROOT={USERDIR}/android-sdk_r06-windows
For Linux (add the following in .bashrc)
export PATH=$PATH:/home/{USERNAME}/android-sdk_r06-linux_86/add-ons/
addon_dualscreen_kyocera_corporation_8/tools
export
ANDROID_SDK_ROOT=/home/{USERNAME}/addon_dualscreen_kyocera_corporation_8
Figure 7.2.2.1 Create new Android Virtual Device (AVD)

17/29
7.2.2.2. From the command prompt
1. Confirm that avd target list contains “Kyocera:Kyocera DTS Add-On:8”.
(e.g. ”$ android list avd”)

2. Create avd file.

* The Target parameter (-t) value must correspond to ID number of
“Kyocera:Kyocera DTS Add-On:8”.
* Enter “Name” value and “SD card” value of your choice.

id: 2 or "Kyocera:Kyocera DTS Add
-
On:8"

Name: Kyocera DTS Add-On
Type: Add-On
Vendor: Kyocera
Revision: 1
Description: Kyocera DTS add-on
Based on Android 2.2 (API level 8)
Libraries:
* com.kyocera.dualscreen (dualscreen.jar)
Dual Screen optional platform library
Skins: WQVGA400, DTS800, WVGA800, DTS400 (default), WQVGA432, HVGA,
WVGA854, QVGA
For W
indows


$android.bat create avd -n DTS400 -t 2 -c 512M -s DTS400

For Linux
$./android create avd -n DTS400 -t 2 -c 512M -s DTS400

18/29
The following is an example of the content of config.ini created by the
bellow procedures.

* For skin, “Default (DTS400)” is recommended because the
performance of the emulator with "DTS800" for WVGAx2 screen is
too low.
* If you use an emulator other than “Customized Emulator for Dual
Screen”, do not use “hw.dts=yes” in config.ini.

7.3. Launching emulator

* If you launch on Linux, use “emulator_dualscreen” command file to
which “chmod 777 emulator_dualscreen” command is applied.
* When launching at the actual screen size, adjust the scale value.
* Launching “emulator_dualscreen” from AVD Manager is not
supported. You must launch the emulator via command line.
hw.dPad=yes

hw.lcd.density=120
hw.camera.maxHorizontalPixels=2592
sdcard.size=512M
disk.cachePartition.size=66
hw.camera=yes
hw.touchScreen=yes
skin.path=add-ons/addon_dualscreen_kyocera_corporation_8/skins/DTS400
disk.cachePartition=yes
hw.keyboard=no
hw.ramSize=512
hw.gsmModem=yes
hw.sdCard=yes
hw.accelerometer=yes
skin.name=DTS400
hw.audioOutput=yes
hw.trackBall=no
hw.camera.maxVerticalPixels=1944
hw.battery=yes
image.sysdir.2=platforms/android-8/images/
image.sysdir.1=add-ons/addon_dualscreen_kyocera_corporation_8/images/
hw.audioInput=yes
hw.gps=yes
hw.dts=yes
vm.heapSize=16
For W
indows


$emulator_dualscreen.exe @DTS400
For Linux
$./emulator_dualscreen @DTS400

19/29
7.4. Create a new Android project
 Select "New Android Project” on Package Explorer.
 Fill in all fields and click “Finish” button in the dialog box.
 Open “AndroidManifest.xml”.
 Add the following definition.

<uses
-
library android:name=

com.kyocera.dualscreen

></uses
-
library>

Figure 7.2.4 New Android Project


20/29
7.4.1. Debug on Eclipse
 At "Target" tab of your app, set “Manual” in Deployment Target Selection
Mode.

 Launch the emulator beforehand.
 Select the launched emulator as below when you start debug.

Figure 7.2.5-2 Debug Configurations
Figure 7.2.5-2 Android Device Chooser

21/29
7.5. Limited Compatibility Mode
7.5.1. One-binary for both the dual screen device and single screen device
You app will need to consider using Dual screen API’s if you chose to follow this
one-binary strategy, since other devices would not have this API.
There may be some developers that their app doesn’t need to specialize for dual
screen. The built one-binary can support on both dual screen device and single
screen device by the following declaration in the AndroidManifest.xml.

7.6. Dialog on the dual screen device
All dialog (or toast) of app that uses the dual screen SDK is corrected their
position automatically to avoid striding over the center bezel.

* When the limited compatibility mode (refer to 8.3), the automatic
position-correcting for dialog doesn’t work to unify the behavior on both
the dual screen device and the single screen device. Developer has to
consider the layout of dialog which is displayed on the dual screen device.
<uses
-
library android:name=”com.kyocera.dualscreen”

android:required=”false” >
</uses-library>
Dialog
Dialog
Dialog
Dialog
Figure 7.5 Automatic position-correction

22/29
8. Sample App
The following section describes how to use dual screen API.
Sample app is located as the below directory.
8.1. Getting Screen Mode in Sample App
Sample app gets the screen mode by creating an instance of DualScreen class
and using com.kyocera.dualscreen.DualScreen.getScreenMode().
Please refer to “displayStatus()” method in DualScreenApiSampleActivity class.

(1) Create the instance of com.kyocera.dualscreen.DualScreen class.
(2) Get the screen mode using the instance above.
(3) Display the screen mode on the text view.
Figure 8.1 Dual Screen APP Sample 1

// Screen mode

DualScreen dualscreen = new DualScreen(this); --- (1)
int res_mode;
if ( dualscreen.getScreenMode() == DualScreen.FULL ) { --- (2)
res_mode = R.string.mode_fullscreen;
} else {
res_mode = R.string.mode_normalscreen;
}
mTvScreenMode.setText(res_mode); --- (3)
<sdk-setup-directory>/add-ons/addon_dualscreen_kyocera_corporation_8/samples

23/29
8.2. Handling Open/Close Event in Sample App
Sample app handles the open and close event by receiving the broadcast intent.
Refer to “onCreate()” method in DualScreenApiSampleActivity class for a
sample code for receiving intent in CustomReceiver as inner class.

Below is the snippet of the definition of CustomReceiver:

(1) Check the intent action.
(2) Get the extra data.
(3) Show the screen status on the toast based on the extra data.

private static final String INTENT_ACTION_SLIDE =
"com.kyocera.intent.action.SLIDE_OPEN";
CustomReceiver mReceiver;
:
@Override
public void onCreate(Bundle savedInstanceState) {
:
// Register intent receiver.
mReceiver = new CustomReceiver();
IntentFilter slideFilter = new IntentFilter(INTENT_ACTION_SLIDE);
registerReceiver(mReceiver, slideFilter);
:
}
class CustomReceiver extends BroadcastReceiver {

:
public void onReceive(Context context, Intent intent) {
String action = intent.getAction();
if (action.equals(INTENT_ACTION_SLIDE)) { --- (1)
boolean slideOpen = intent.getBooleanExtra("OPEN", false); --- (2)
if(slideOpen) {
Toast.makeText(DualScreenApiSampleActivity.this,
R.string.msg_slide_opened, Toast.LENGTH_SHORT).show(); --- (3)
} else {
Toast.makeText(DualScreenApiSampleActivity.this,
R.string.msg_slide_closed, Toast.LENGTH_SHORT).show(); --- (3)
}
}
:
}

24/29

8.3. Structure for Switching Between Single and Dual
8.3.1. Layout Resource
In the new sample app “DualScreenApiSample”, the following four layout
resouces are defined in an Activity (DualScreenApiSampleActivity).

Layout resources for single screen
 normalscreen_portrait.xml
 normalscreen_landscape.xml

Layout resources for dual screen
 fullscreen_portrait.xml
 fullscreen_landscape.xml

The new sample app supports the changes of screen mode (normal/full) and
screen orientation (portrait/landscape), and switches the above layout
resources.
Figure 8.2 Dual Screen APP Sample 2


25/29
8.3.2. Structure for Switching The Layout Resource
s

1. When a Activity is created (onCreate) or a “configuration changed event”
is handled, an app should check the screen mode and the screen
orientation.
2. An app should set a layout resource corresponding to the above result
and call setContentView() method.

Code snippet from setScreenLayout() method in DualScreenApiSampleActivity.java

8.3.3. Layout Resource
This section describes the layout resource in portrait/landscape modes while the
screen mode is set to full. The case of normal mode is omitted from this section
as the layout resource of normal mode is same as Android standard.
8.3.3.1. fullscreen_landscape.xml
(screen mode: full, orientation: landscape)

if( screen_mode == DualScreen.FULL ) {

// for full screen
if( width > height ) {
setContentView(R.layout.fullscreen_landscape);
} else {
setContentView(R.layout.fullscreen_portrait);
:
<?xml version="1.0" encoding="ut
f
-
8"?>

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<LinearLayout android:id="@+id/LayoutSecondaryScreen"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1">
:
</LinearLayout>
<RelativeLayout android:id="@+id/LayoutPrimaryScreen"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1">
:
</RelativeLayout>

</LinearLayout>

26/29
 RelativeLayout as id:LayoutPrimaryScreen
This defines the layout of the primary screen. In case of the sample app,
the layout of the primary screen is RelativeLayout. Of course, other
layouts are available.
 LinearLayout as id:LayoutSecondaryScreen
This defines the layout of the secondary screen. In case of the sample
app, the layout of the primary screen is LinearLayout. Of course, other
layouts are available.
 How to define the layout for the dual screen while the device is full screen
and landscape.
The layout_weight of both id:LayoutPrimaryScreen and
id:LayoutSecondaryScreen should be set to “1” to define the layout of the
dual screen which is the left-right slide-opened such as book style.
Accordingly the app can define the 2 panes with the same size on each
screen.

8.3.3.2. fullscreen_portrait.xml
(screen mode: full, orientation: portrait)
 LinearLayout as id:LayoutPrimaryScreen
This defines the layout of the primary screen. In case of the sample app,
the layout of the primary screen is LinearLayout. Of course, other layouts
are available.
<?xml version="1
.0" encoding="utf
-
8"?>

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout android:id="@+id/LayoutPrimaryScreen"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content">
:
</LinearLayout>
<RelativeLayout android:id="@+id/LayoutSecondaryScreen"
android:layout_width="match_parent"
android:layout_height="wrap_content">
:
</RelativeLayout>

</LinearLayout>

27/29
 RelativeLayout as id:LayoutSecondaryScreen
This defines the layout of the secondary screen. In case of the sample
app, the layout of the primary screen is RelativeLayout. Of course, other
layouts are available.
 How to define the layout of the dual screen while the device is full screen
and portrait.
In case that the device is the upside down slide-opened, unlike the
left-right slide-opened, it is not enough to simply divide into 2 panes.
The height of notification bar and title bar must be taken into
account.
Sample app has a notification bar but no title bar. Because many existing
applications are configured like that.
The sample app follows the procedures below to change the layout
resources.
1. Set the layout resource of Activity which is intended to display by
setContentView() method.
2. Set the height to LayoutPrimaryScreen / LayoutSecondaryScreen.
a. Get the height of the resource which is intended to display for
calculating the height of notification bar.
b. Calculate the height of the primary screen using the following
expression.

Height of Primary Screen = - Height of Notification Bar

c. Calculate the height of the secondary screen using the following
expression.

Height of Primary Screen =

d. Set the above results to each layout by setLayoutParams() method.

Total Height of Display Area (960px)
Number of Screen (2)
Total Height of Display Area (960px)
Number of Screen (2)

28/29
Code Snippet from setScreenLayout() method in DualScreenApiSampleActivity.java

* In case that an app doesn’t display notification bar and title bar.
As the screen mode is fullscreen-landscape, it is possible to create 2
panes on dual screen only by setting “1” to the layout_weight of both
LayoutPrimaryScreen and LayoutSecondaryScreen.

setContentView(R.layout.fullscreen_portrait);


// Primary and secondary screen heights calculation.
// (Full screen-portrait mode only)
View layout_primary = findViewById(R.id.LayoutPrimaryScreen);
View layout_secondary = findViewById(R.id.LayoutSecondaryScreen);

LayoutParams layoutparams_primary = layout_primary.getLayoutParams();
LayoutParams layoutparams_secondary = layout_secondary.getLayoutParams();

// get notification bar height
Drawable phone_call_icon =
getResources().getDrawable(android.R.drawable.stat_sys_phone_call);
int height_notification = phone_call_icon.getIntrinsicHeight();

// calculate heights
layoutparams_primary.height = height / 2 - height_notification;
layoutparams_secondary.height = height / 2;
layout_primary.setLayoutParams(layoutparams_primary);
layout_secondary.setLayoutParams(layoutparams_secondary);

29/29
8.4. Other procedures
8.4.1. Orientation Setting
Sample app sets the orientation by handling onClick() of radio button in
DualScreenApiSampleActivity.
8.4.2. Displaying the Orientation and the Degrees of Rotation.
Sample app displays the orientation and the degrees of rotation.
More specifically, Sample app indicates:
 the current orientation by comparing the screen’s width with height from the
Display class.
 the degrees of rotation using getRotation() method in the Display class.



Figure 8.4.2 Dual Screen APP Sample 3