173 Commits

Author SHA1 Message Date
Mike Lockwood
58ec34cef5 GpsLocationProvider: Clean up HAL initialization/cleanup sequence
Change-Id: Id5467000f3f3da5cbe1f112dad97a032688d2eac
Signed-off-by: Mike Lockwood <lockwood@android.com>
2011-02-23 16:35:33 -08:00
Dianne Hackborn
a924dc0db9 Start window manager refactoring.
Move all of the pieces into a new com.android.server.wm package.

Change-Id: I942b7bcfb84ee0f843f47d58e55ffc5a93c0da94
2011-02-17 14:22:17 -08:00
Jeff Brown
45708bf2f0 Merge "Add support for arbitrary axes in MotionEvents." 2011-02-16 20:00:21 -08:00
Mike Lockwood
984dd8a206 Merge "UsbManager: New APIs for USB accessories" 2011-02-16 12:42:35 -08:00
Kenny Root
bb9d394b21 Clean up use of HAVE_ANDROID_OS
HAVE_ANDROID_OS was defined as "1" for targets, but never defined as "0"
for non-targets. Changing them to #ifdef should be safe and matches
all the other uses of HAVE_ANDROID_OS throughout the system.

Change-Id: I82257325a8ae5e4e4371ddfc4dbf51cea8ea0abb
2011-02-16 10:56:32 -08:00
Mike Lockwood
9182d3c4eb UsbManager: New APIs for USB accessories
USB accessories are peripherals that connect to android devices as a USB host.

When connected, the accessory will first identify itself to the android device
by sending manufacturer, product, accessory type and version strings
to the device, and then request the device to enter USB accessory mode.
The device will then enable the USB accessory kernel driver and disable
all other USB functionality except possibly adb
(adb can be used while the android device is connected to the PC
and the PC is running software that emulates a USB accessory)

The class android.hardware.UsbAccessory is used to describe the
currently attached USB accessory.
UsbAccessory contains the manufacturer, product, accessory type
and version strings to identify the accessory.
The accessory can be opened as a ParcelFileDescriptor, which can be used
to communicate with the accessory over two bulk endpoints.

The Intents UsbManager.USB_ACCESSORY_ATTACHED and
UsbManager.USB_ACCESSORY_DETACHED are broadcast when accessories are
connected and disconnected to the device.  The USB_ACCESSORY_ATTACHED
contains a UsbAccessory object for the attached accessory as an extra.
The Intent also contains string extras for the manufacturer, product,
accessory type and version strings to allow filtering on these strings.

Change-Id: Ie77cbf51814a4aa44a6b1e62673bfe4c6aa81755
Signed-off-by: Mike Lockwood <lockwood@android.com>
2011-02-16 08:25:16 -05:00
Jeff Brown
91c69ab015 Add support for arbitrary axes in MotionEvents.
This change makes it possible to extend the set of axes that
are reported in MotionEvents by defining new axis constants.

The MotionEvent object is now backed by its C++ counterpart
to avoid having to maintain multiple representations of the
same data.

Change-Id: Ibe93c90d4b390d43c176cce48d558d20869ee608
2011-02-15 19:14:37 -08:00
Mike Lockwood
e7d511e148 New APIs for USB host support:
UsbManager:
- is now a service retrievable via Context.getSystemService(Context.USB_SERVICE).
- provides support for returning a list all connected USB devices
- broadcasts ACTION_USB_DEVICE_ATTACHED and USB_DEVICE_DETACHED when devices
  are added and removed from the USB host bus

UsbDevice:
- represents an attached USB device.

UsbInterface:
- represents an interface on a USB device
- devices may have multiple interfaces if they provide multiple
   sets of functionality (for example, android phones typically have interfaces
   for both USB mass storage and adb)

UsbEndpoint:
- represents an endpoint on a USB interface
- endpoints are used for sending or receiving data
  (only in one or the other direction)

UsbRequest:
- encapsulates a send or receive request to be sent over an endpoint

Change-Id: Ieef3e434c62760770ea839070cf5eba1a705967a
Signed-off-by: Mike Lockwood <lockwood@android.com>
2011-01-22 15:56:09 -08:00
Jeff Brown
fe50892af3 Filter virtual keys after touches.
Adds a new virtualKeyQuietTimeMillis configuration resource that sets
the duration for which virtual keys will be dropped after recent touches
on screen.  The default value is 0; it is intended to be overridden
per device using a resource overlay.

This change is designed to help in two cases:

1. Swipes from touchscreen into virtual key area.
2. Accidental taps in virtual key area while using on-screen keyboard.

Bug: 3089163
Change-Id: Ib912d4f8a4df9966a39cd537d3ec7c24afab7225
2011-01-18 15:10:45 -08:00
Jeff Brown
fbf0977321 Support non-rectangular input regions.
This enables the system bar to carve out a region through which
events will be sent to the IME behind it.

Bug: 3238092
Change-Id: I69b855a8d9b5b3ee525266c0861826e53e5b5028
2011-01-16 18:58:49 -08:00
Jeff Brown
928e054931 Prevent events from getting backlogged.
This change implements two heuristics.

1. When events are older than 10 seconds, they are dropped.

2. If the application is currently busy processing an event and
   the user touches a window belonging to a different application
   then we drop the currently queued events so the other application
   can start processing the gesture immediately.

Note that the system takes care of synthesizing cancelation events
automatically for any events that it drops.

Added some new handle types to allow the native dispatcher to
indirectly refer to the WindowManager's window state and app window
token.  This was done to enable the dispatcher to identify the
application to which each window belongs but it also eliminates
some lookup tables and linear searches through the window list
on each key press.

Bug: 3224911
Change-Id: I9dae8dfe23d195d76865f97011fe2f1d351e2940
2011-01-10 17:23:05 -08:00
Mike Lockwood
264f6cd0b9 Temporarily remove UsbManager support for USB host.
A new USB host API will be added in an upcoming commit

Change-Id: I5816c10c7acd236d31ab8ae255fc83c77121eea0
Signed-off-by: Mike Lockwood <lockwood@android.com>
2011-01-06 11:48:19 -05:00
Jeff Brown
b4ff35df5c Mouse pointer integration.
Added support for loading the pointer icon from a resource.

Moved the system server related bits of the input manager out
of libui and into libinput since they do not need to be linked into
applications.

Change-Id: Iec11e0725b3add2b905c51f8ea2c3b4b0d1a2d67
2011-01-04 17:31:24 -08:00
Jeff Brown
8235404786 Merge "Add initial support for cursor-based pointing devices." 2010-12-29 13:22:08 -08:00
Jeff Brown
83c09685f2 Add initial support for cursor-based pointing devices.
Some parts stubbed out but you can plug in a mouse and move
a green cursor around to interact with the UI.

Change-Id: I80d597a7f11d3bd92041890f74b3c77326975e6e
2010-12-29 13:19:53 -08:00
Mike Lockwood
da03aaad78 Change libusbhost and libmtp from static to shared libraries
Change-Id: Iccc67db32400cdeb88aa33261c9e0cf73db992ca
Signed-off-by: Mike Lockwood <lockwood@android.com>
2010-12-29 09:12:15 -05:00
Mike Lockwood
770126a678 Rename android.hardware.Usb to UsbManager and UsbObserver to UsbService
In preparation for an upcoming change that will make UsbService into a real system service

Change-Id: Id85d624cfc6b10b49a08105cfaaacc667a492c12
Signed-off-by: Mike Lockwood <lockwood@android.com>
2010-12-09 22:52:05 -08:00
Jeff Brown
49ed71db42 Add support for fallback keycodes.
This change enables the framework to synthesize key events to implement
default behavior when an application does not handle a key.
For example, this change enables numeric keypad keys to perform
their associated special function when numlock is off.

The application is informed that it is processing a fallback keypress
so it can choose to ignore it.

Added a new keycode for switching applications.

Added ALT key deadkeys.

New default key mappings:
- ESC -> BACK
- Meta+ESC -> HOME
- Alt+ESC -> MENU
- Meta+Space -> SEARCH
- Meta+Tab -> APP_SWITCH

Fixed some comments.
Fixed some tests.

Change-Id: Id7f3b6645f3a350275e624547822f72652f3defe
2010-12-07 17:35:26 -08:00
Jeff Brown
9065504a63 Improve support for external keyboards.
Use Vendor ID, Product ID and optionally the Version to
locate keymaps and configuration files for external devices.

Moved virtual key definition parsing to native code so that
EventHub can identify touch screens with virtual keys and load
the appropriate key layout file.

Cleaned up a lot of old code in EventHub.

Fixed a regression in ViewRoot's fallback event handling.

Fixed a minor bug in FileMap that caused it to try to munmap
or close invalid handled when released if the attempt to map
the file failed.

Added a couple of new String8 conveniences for formatting strings.

Modified Tokenizer to fall back to open+read when mmap fails since
we can't mmap sysfs files as needed to open the virtual key
definition files in /sys/board_properties/.

Change-Id: I6ca5e5f9547619fd082ddac47e87ce185da69ee6
2010-12-02 16:01:32 -08:00
Jeff Brown
1f2451007c Ensure the ShortcutManager uses the correct key character map.
The ShortcutManager used to only receive the key code of the key event
that triggered the shortcut.  This change now provides the shortcut
manager with the whole key event so it can look up the associated
character using the correct key character map.

To make this more efficient, added a mechanism for recycling
key events.  At the moment it is only used by key events owned by the
system process, since clients of the existing API (such as Views)
might continue to hold on to key events after dispatch has finished so
they would break if the key event were recycled by the framework.

Deprecated KeyCharacterMap.BUILT_IN_KEYBOARD.

Change-Id: I4313725dd63f2be01c350c005a41c7fde9bc67e8
2010-11-30 18:50:17 -08:00
Jeff Brown
47e6b1b5ee Support non-orientation aware keyboards and other devices.
Fixed a bug with dpad keys on external keyboards being rotated
according to the display orientation by adding a new input device
configuration property called "keyboard.orientationAware".

Added a mechanism for overriding the key layout and key character
map in the input device configuration file using the new
"keyboard.layout" and "keyboard.characterMap" properties.

Also added "trackball.orientationAware", "touch.orientationAware" and
"touch.deviceType" configuration properties.

Rewrote the configuration property reading code in native code
so that it can be used by EventHub and other components.

Added basic support for installable idc, kl, and kcm files
in /data/system/devices.  However, there is no provision for
copying files there yet.

Disabled long-press character pickers on full keyboards so that
key repeating works as expected.

Change-Id: I1bd9f0c3d344421db444e7d271eb09bc8bab4791
2010-11-30 17:15:49 -08:00
Jeff Brown
3915bb845b Tell system server whether the app handled input events.
Refactored ViewRoot, NativeActivity and related classes to tell the
dispatcher whether an input event was actually handled by the application.

This will be used to move more of the global default key processing
into the system server instead of the application.

Change-Id: If06b98b6f45c543e5ac5b1eae2b3baf9371fba28
2010-11-08 12:49:43 -08:00
Dianne Hackborn
ea9020e085 Add API to find out if there is a vibrator.
Change-Id: If29f6ee19448222433cad9fad325d0095a8e5737
2010-11-04 13:01:56 -07:00
Jeff Brown
4d396052de Fix policy issues when screen is off.
Rewrote interceptKeyBeforeQueueing to make the handling more systematic.
Behavior should be identical except:
- We never pass keys to applications when the screen is off and the keyguard
  is not showing (the proximity sensor turned off the screen).
  Previously we passed all non-wake keys through in this case which
  caused a bug on Crespo where the screen would come back on if a soft key
  was held at the time of power off because the resulting key up event
  would sneak in just before the keyguard was shown.  It would then be
  passed through to the dispatcher which would poke user activity and
  wake up the screen.
- We propagate the key flags when broadcasting media keys which
  ensures that recipients can tell when the key is canceled.
- We ignore endcall or power if canceled (shouldn't happen anyways).

Changed the input dispatcher to not poke user activity for canceled
events since they are synthetic and should not wake the device.

Changed the lock screen so that it does not poke the wake lock when the
grab handle is released.  This fixes a bug where the screen would come
back on immediately if the power went off while the user was holding
one of the grab handles because the sliding tab would receive an up
event after screen turned off and release the grab handles.

Fixed a couple of issues where media keys were being handled inconsistently
or not at all, particularly in the case of the new PAUSE, PLAY
and RECORD keys.

Bug: 3144874
Change-Id: Ie630f5fb6f128cfdf94845f9428067045f42892c
2010-11-01 15:00:25 -07:00
Mike Lockwood
471b0325f7 am faebca7f: am c9fa90f9: Merge "GPS: remove some logging" into gingerbread
* commit 'faebca7f4319950927759163a703dd12f2727460':
  GPS: remove some logging
2010-10-28 14:32:39 -07:00
Mike Lockwood
faebca7f43 am c9fa90f9: Merge "GPS: remove some logging" into gingerbread
* commit 'c9fa90f94b664589d584bb433e748e2b01b368c9':
  GPS: remove some logging
2010-10-28 14:30:34 -07:00
Mike Lockwood
fa405280b2 GPS: remove some logging
Change-Id: Ib2dca53364c9da207a87f2664b54d2ec1d1bd8d9
Signed-off-by: Mike Lockwood <lockwood@android.com>
2010-10-28 07:35:26 -04:00
Jean-Baptiste Queru
7df7cfebdf am c20f205d: am 5bfef1ba: Merge "BatteryService: Set bool to true if sysfs entry is not 0"
Merge commit 'c20f205d1059ff71b21d9c44ea147e209c364d2f'

* commit 'c20f205d1059ff71b21d9c44ea147e209c364d2f':
  BatteryService: Set bool to true if sysfs entry is not 0
2010-10-21 13:46:41 -07:00
Jean-Baptiste Queru
c20f205d10 am 5bfef1ba: Merge "BatteryService: Set bool to true if sysfs entry is not 0"
Merge commit '5bfef1ba0501e237b3a0fa1abe98e5348d8c5b04' into gingerbread-plus-aosp

* commit '5bfef1ba0501e237b3a0fa1abe98e5348d8c5b04':
  BatteryService: Set bool to true if sysfs entry is not 0
2010-10-20 16:45:50 -07:00
Mike Lockwood
0bc1f39643 am 8333d591: am 5d5a9db5: Merge "GPS: Enable some more logging" into gingerbread
Merge commit '8333d59133da8e56cfb5465c767e89c61ede28bc'

* commit '8333d59133da8e56cfb5465c767e89c61ede28bc':
  GPS: Enable some more logging
2010-10-19 09:55:45 -07:00
Mike Lockwood
8333d59133 am 5d5a9db5: Merge "GPS: Enable some more logging" into gingerbread
Merge commit '5d5a9db514a9cf42fbc189fc3af6da602d89b747' into gingerbread-plus-aosp

* commit '5d5a9db514a9cf42fbc189fc3af6da602d89b747':
  GPS: Enable some more logging
2010-10-18 15:20:31 -07:00
Mike Lockwood
b8d9033d99 GPS: Enable some more logging
Change-Id: I7d13c859002fa96fa8c361c0c709931c6b12eb99
Signed-off-by: Mike Lockwood <lockwood@google.com>
2010-10-18 17:59:48 -04:00
Joe Onorato
b25d5be54b am 258d0e80: am 0d65a3fc: Merge "Screen on/off animation tweaks" into gingerbread
Merge commit '258d0e805ee63685b807b5dae43efc5ecc97179e'

* commit '258d0e805ee63685b807b5dae43efc5ecc97179e':
  Screen on/off animation tweaks
2010-10-16 08:59:20 -07:00
Mike Lockwood
d7117f04d8 am 1442818a: am c792c2e9: Merge "GPS: Remove unnecessary and broken test in AgpsRilInterface updateNetworkState glue" into gingerbread
Merge commit '1442818a10988cc011f55104e997474b5d3d2468'

* commit '1442818a10988cc011f55104e997474b5d3d2468':
  GPS: Remove unnecessary and broken test in AgpsRilInterface updateNetworkState glue
2010-10-14 22:37:14 -07:00
Joe Onorato
258d0e805e am 0d65a3fc: Merge "Screen on/off animation tweaks" into gingerbread
Merge commit '0d65a3fc075b7dbdbfaba6b570217d87e307d75f' into gingerbread-plus-aosp

* commit '0d65a3fc075b7dbdbfaba6b570217d87e307d75f':
  Screen on/off animation tweaks
2010-10-14 17:57:32 -07:00
Joe Onorato
609695dab0 Screen on/off animation tweaks
- Pass to surface flinger whether we want animations or not.
- Don't use the animation when the screen goes off because of the prox sensor.
- Turn the screen-on animation back off
- Also, now the animation setting controls whether or not we do the animation.

Bug: 3097475
Bug: 3098508
Change-Id: I205d5564d6668b33a8dc1c40d8cc06c4aad305cf
2010-10-14 17:49:01 -07:00
Joe Onorato
eb86aaaab3 am 9a12a3c8: am ba799098: Merge changes I76513387,I335fb671 into gingerbread
Merge commit '9a12a3c8d4bb20042cf69e07d268e3a04ac71f96'

* commit '9a12a3c8d4bb20042cf69e07d268e3a04ac71f96':
  Remove dead code, and make the animation a setting.
  turn off the electron beam
2010-10-13 23:34:21 -07:00
Jeff Brown
cd4af421ca am 4b255a23: am 03aa28fb: Merge "Improve the input policy handling a bit." into gingerbread
Merge commit '4b255a23041225103a6870e77a236f78c2816eda'

* commit '4b255a23041225103a6870e77a236f78c2816eda':
  Improve the input policy handling a bit.
2010-10-13 17:02:48 -07:00
Mike Lockwood
1442818a10 am c792c2e9: Merge "GPS: Remove unnecessary and broken test in AgpsRilInterface updateNetworkState glue" into gingerbread
Merge commit 'c792c2e9edb3c785208560b6961ac6ed5b07eb4e' into gingerbread-plus-aosp

* commit 'c792c2e9edb3c785208560b6961ac6ed5b07eb4e':
  GPS: Remove unnecessary and broken test in AgpsRilInterface updateNetworkState glue
2010-10-13 05:52:51 -07:00
Mike Lockwood
c792c2e9ed Merge "GPS: Remove unnecessary and broken test in AgpsRilInterface updateNetworkState glue" into gingerbread 2010-10-13 05:46:15 -07:00
Axel Haslam
49016d6cd7 BatteryService: Set bool to true if sysfs entry is not 0
For the musb to recognized as online, the musbOnline value
has to be set. The battery driver sets the online property
of the sysfs as "3" when the charger type is USB.

The way the current code is, if the value is not 1,
musbOnline would be false and the menu to mount the
sdcard on the pc would not pop-up.

Since the linux driver returns 0 if the cable is not
connected, and 3 if the cable is connected, we should
set the boolean variable to 0 only if the sysfs value
is 0, otherwise we set it to true.

Change-Id: I538d8de446e7ea4f620ffcce156a57cf56b5a4e5
Signed-off-by: Axel Haslam <axelhaslam@ti.com>
2010-10-12 17:32:26 -05:00
Joe Onorato
9a12a3c8d4 am ba799098: Merge changes I76513387,I335fb671 into gingerbread
Merge commit 'ba799098608c7be8ff1e18adfa7dc1f452205a7e' into gingerbread-plus-aosp

* commit 'ba799098608c7be8ff1e18adfa7dc1f452205a7e':
  Remove dead code, and make the animation a setting.
  turn off the electron beam
2010-10-12 14:46:23 -07:00
Joe Onorato
b08a1af667 Remove dead code, and make the animation a setting.
When we don't do the brightness fade, turn off the electron beam instead.

Change-Id: I76513387c4fb420a67e59e005f6e8c3bc72f7f08
2010-10-12 14:16:11 -07:00
Mike Lockwood
301f78bbbe am 431dd3b1: am 86564dc6: Merge "GPS: Add update_network_state call to AGpsRillInterface" into gingerbread
Merge commit '431dd3b1bc8f2acf7cbcf08463649b5629baf398'

* commit '431dd3b1bc8f2acf7cbcf08463649b5629baf398':
  GPS: Add update_network_state call to AGpsRillInterface
2010-10-12 11:50:23 -07:00
Jeff Brown
4b255a2304 am 03aa28fb: Merge "Improve the input policy handling a bit." into gingerbread
Merge commit '03aa28fb36589a3d601be08e75c08a24c4344d6f' into gingerbread-plus-aosp

* commit '03aa28fb36589a3d601be08e75c08a24c4344d6f':
  Improve the input policy handling a bit.
2010-10-12 01:04:16 -07:00
Jeff Brown
3122e4488a Improve the input policy handling a bit.
Fixed some issues with Monkeys turning off their own screens.  Ook ook!
Added some more comments to explain what's going on.

Change-Id: Id2bc0466161a642a73ef7ef97725d1c81e984b12
2010-10-12 00:16:14 -07:00
Jeff Brown
26b6df74b9 Merge "Track input state when transferring touch focus." 2010-10-11 20:29:36 -07:00
Jeff Brown
9c9f1a3ba1 Track input state when transferring touch focus.
Copies the input state to the destination window and sends synthesic
cancelation events to the source window.

Change-Id: Ia75820b0d756ed5d6cd22dce7830251ac85141ed
2010-10-11 18:32:20 -07:00
Mike Lockwood
f7b7330e71 GPS: Remove unnecessary and broken test in AgpsRilInterface updateNetworkState glue
Change-Id: Ic934c478f0eb6c6d368caaf41aec8235d329ef34
Signed-off-by: Mike Lockwood <lockwood@android.com>
2010-10-11 21:27:06 -04:00
Jeff Brown
4231124c9d Merge "Fix an event injection bug when the policy is bypassed." 2010-10-11 18:15:38 -07:00