271 Commits

Author SHA1 Message Date
Dima Zavin
98e044a609 BatteryService(jni): properly handle read's return value
Change-Id: I10f5cf3728424e7f5a0c1b460049102fd00a6246
Signed-off-by: Dima Zavin <dima@android.com>
2011-10-28 23:15:11 -07:00
Jeff Brown
d5bb82d18c DO NOT MERGE. Improve screenshot chord debouncing.
Bug: 5011907

Introduce a 150ms delay in handling volume down keys
while waiting to see if a power key will follow.

Don't trigger the screenshot chord if both volume up and
volume down are pressed together.

Don't trigger the long-press power menu if volume keys are
also pressed.

Require the user to press both keys in the chord within
the debounce time and continue long-pressing them in order
to trigger the screenshot action.

Change-Id: I248968d37b73c09d6d08e7f62667c443eba32da0
2011-10-12 15:05:59 -07:00
Jeff Brown
cc4f7db698 Fix input channel leak.
Bug: 5156144

Input channels could leak or simply live longer than they should
in some cases.

1. Monitor channels (used by the pointer location overlay) are never
   unregistered, so they would leak.

   Added code to handle failures in the receive callback by closing
   the input channel.

2. The DragState held onto its input window and application handles
   even after the input channel was disposed.

   Added code to null these handles out when they are no longer needed.

3. Input channels previously used as input event targets would stick
   around until the targets were cleared (usually on the next
   event).

   Added code to detect when the input dispatcher is in
   an idle state and to proactively clear the targets then
   to ensure that resources are released promptly.

4. Native input window handles held onto the input channel even
   after the input window was removed from the input dispatcher.
   Consequently, the input channel would not be disposed until
   the input window handle itself was freed.  Since the input
   window handle is held from managed code, this meant that the
   window's input channel could stick around until the next GC.

   Refactored the input window handle to separate the properties
   (info) and identify (handle) state into different objects.
   Then modified the dispatcher to release the properties (info)
   when no longer needed, including the input channel.

7. The pointer location overlay does not actually use its
   standard input channel, only the monitor input channel.

   Added INPUT_FEATURE_NO_INPUT_CHANNEL to allow windows to
   request that they not be provided with an input channel
   at all.

Improved some of the error handling logic to emit the status
code as part of the exception message.

Change-Id: I01988d4391a70c6678c8b0e936ca051af680b1a5
2011-08-30 21:40:28 -07:00
Jeff Brown
daf4a127ba Add a "show touches" option for demos and presentations.
Bug: 4569045

Change-Id: I8726ea292dd7def790a5e40d7d7e58968974f896
2011-08-26 17:14:14 -07:00
Jeff Brown
65fd251c39 Input system bug fixes, particularly for stylus.
Bug: 5049148

Finished stylus support, including support for indirect stylus
and mouse tools.

Added TILT axis.  When stylus tilt X/Y is available, it is transformed
into an orientation and tilt inclination which is a more convenient
representation and a simpler extension to the exiting API.

Touch devices now only report touch data using a single input
source.  Previously touch devices in pointer mode would report
both absolute touch pad data and cooked pointer gestures.
Now we just pick one.  The touch device switches modes as needed
when the focused application enables/disables pointer gestures.
This change greatly simplifies the code and reduces the load
on the input dispatcher.

Fixed an incorrect assumption that the value of ABS_(MT_)DISTANCE
would be zero whenever the stylus was in direct contact.  It appears
that the correct way to determine whether the stylus is in direct
contact (rather than hovering) is by checking for a non-zero
reported pressure.

Added code to read the initial state of tool buttons and axis values
when the input devices are initialized or reset.  This fixes
problems where the input mapper state might have the wrong initial
state.

Moved responsibility for cancelling pending inputs (keys down,
touches, etc.) to the InputDispatcher by sending it a device reset
notification.  This frees the InputReader from having to synthesize
events during reset, which was cumbersome and somewhat brittle
to begin with.

Consolidated more of the common accumulator logic from
SingleTouchInputMapper and MultiTouchInputMapper into
TouchInputMapper.

Improved the PointerLocation output.

Change-Id: I595d3647f7fd7cb1e3eff8b3c76b85043b5fe2f0
2011-08-19 15:02:26 -07:00
Jeff Brown
89ef0720ee Add input system to Watchdog.
Bug: 5094994

Change-Id: I153866958efc64ac19bda8b997c1c9f6ad425ec4
2011-08-10 16:25:21 -07:00
Mike Lockwood
2b15cb21b3 Resolve merge conflict for '75f1fdec':
GPS Provider Service changes

    GPS engine needs to receive network state changes from Android fw.

    Added db query for the current APN, also added a new parameter
    between JNI / HAL to the new method in AGpsRilInterface struct
    for gps engine to receive APN from GPSLocationService

Conflicts:
	services/java/com/android/server/location/GpsLocationProvider.java

Change-Id: I33c45027f1571493d3525324f62d199517c4960c
Signed-off-by: Mike Lockwood <lockwood@android.com>
2011-08-04 11:40:25 -04:00
Mike Lockwood
75f1fdec3e am 0b3af353: am a82ee49a: am 8f5dd9ad: Merge "GPS Provider Service changes"
* commit '0b3af353dcf61177158934a11404cf2914038696':
  GPS Provider Service changes
2011-08-04 07:53:53 -07:00
Kevin Tang
a5fe6b2efe GPS Provider Service changes
GPS engine needs to receive network state changes from Android fw.

Added db query for the current APN, also added a new parameter
between JNI / HAL to the new method in AGpsRilInterface struct
for gps engine to receive APN from GPSLocationService

Change-Id: I62e35c948d2ac1961771d1a10581a3b8e695c05a
Signed-off-by: Mike Lockwood <lockwood@android.com>
2011-08-04 10:33:35 -04:00
Mike Lockwood
b7d95a46df am 21700fed: am 5f7203eb: am 5a27a754: am bd1dee94: Merge "gps: Adding ip address for AGps"
* commit '21700fedfe29f6a0a752d2bea46142038e69136c':
  gps: Adding ip address for AGps
2011-07-28 14:06:07 -07:00
Mike Lockwood
21700fedfe am 5f7203eb: am 5a27a754: am bd1dee94: Merge "gps: Adding ip address for AGps"
* commit '5f7203eb258503bc5d2ba29176bdf483a68a93b8':
  gps: Adding ip address for AGps
2011-07-28 14:04:13 -07:00
Stephen Li
8efd74dbed gps: Adding ip address for AGps
Change-Id: Ic590187d159853de2f1bd2912e159f0a00d8fb10
2011-07-28 16:50:45 -04:00
Jeff Brown
bc68a59c02 Report the external display size to the input reader.
The input reader needs this information so that it knows how to
interpolate touches on an external touch screen.

Changed Display so that it asks the WindowManager what the real
display size is (as opposed to the raw display size).  This means
it now takes into the forced display size set by
adb shell am display-size.

Replaced all calls to getRealWidth() / getRealHeight() /
getRealMetrics() in the WindowManager and replaced them with direct
usages of the mCurDisplayWidth / mCurDisplayHeight so that the WM
doesn't end up making a reentrant Binder call into itself.

Fixed the table status bar HeightReceiver so that it updates the
height on all configuration changes since it is possible that the
display size changed independently of an external HDMI display
being plugged / unplugged.

Improved the Display class documentation to make the distinctions
betweeen the various sizes clearer.

Change-Id: I3f75de559d3ebffed532ab46c4ae52c5e7f1da2b
2011-07-25 20:10:12 -07:00
Mike Lockwood
d462ecf8f8 USB: Fix handling USB accessory attached when device is booting
Also defer anything that could start an activity from "system ready"
to "boot completed" time.

Bug: 5051683

Change-Id: I69db751cb991dd247bd0ac3c70a0d84c0d71f365
Signed-off-by: Mike Lockwood <lockwood@android.com>
2011-07-21 14:30:36 -07:00
Chia-chi Yeh
eb2591f8f7 Merge "VPN: Hook up the new control protocol and network state." 2011-07-14 15:22:59 -07:00
Chia-chi Yeh
97a61565ea VPN: Hook up the new control protocol and network state.
1. No more End-Of-Arguments.
2. Daemons close the control socket after they are initialized.
3. No more system properties.
4. ip-up-vpn now creates state to pass the configuration.
5. JNI methods are split again for legacy VPN.

Change-Id: I02fafdf01d425c965345ef712b2bd5fdee3a0cab
2011-07-14 15:07:42 -07:00
Jeff Brown
9302c8796f Refactor input dispatcher use of window/app handles.
This change moves the cached window and application input state
into the handle objects themselves.  It simplifies the dispatcher
somewhat because it no longer needs to fix up references to
transient InputWindow objects each time the window list is updated.

This change will also make it easier to optimize setInputWindows
to avoid doing a lot of redundant data copying.  In principle, only
the modified fields need to be updated.  However, for now we
continue to update all fields in unison as before.

It turns out that the input dispatcher was inappropriately retaining
pointers to InputWindow objects within the mWindows InputWindow
vector.  This vector is copy-on-write so it is possible and the
item pointers to change if an editing operation is performed on
the vector when it does not exclusively own the underlying
SharedBuffer.  This bug was uncovered by a previous change that
replaced calls to clear() and appendVector() with a simple use
of operator= which caused the buffer to be shared.  Consequently
after editItemAt was called (which it shouldn't have, actually)
the buffer was copied and the cached InputWindow pointers became
invalid.  Oops.  This change fixes the problem.

Change-Id: I0a259339a6015fcf9113dc4081a6875e047fd425
2011-07-14 04:11:21 -07:00
Mike Lockwood
c1b9bbb21c Remove some #ifdef HAVE_ANDROID_OS that were needed for the simulator build
Change-Id: I13d9f251f86c05ae5405f37adbf6b8e9660935ba
Signed-off-by: Mike Lockwood <lockwood@android.com>
2011-07-13 19:45:44 -04:00
Jeff Brown
bd882b1c87 Remove the simulator target from all makefiles.
Bug: 5010576

Change-Id: I04d722f258951a3078fe07899f5bbe8aac02a8e8
2011-07-11 22:12:16 -07:00
Chia-chi Yeh
c2b8aa0b4c VPN: rename some variables.
Change-Id: I7f15b5ab30f591e26242fca27af25f578809534c
2011-07-03 18:00:47 -07:00
Chia-chi Yeh
8bc003e2f6 Merge "VPN: merge JNI methods." 2011-07-02 16:37:25 -07:00
Chia-chi Yeh
3281034c1c VPN: merge JNI methods.
Legacy VPN needs to change routes by itself.

Change-Id: I4cf6639f2b00225810f49704ae05797fc70921d9
2011-07-02 16:16:03 -07:00
Jeff Brown
a4d1bc5172 Drop obsolete touch screen hacks.
Change-Id: I47354c37ee2cc2b36340eb709bb5043b3ba78ed9
2011-07-01 19:23:40 -07:00
Chia-chi Yeh
9c0835fd72 VPN: correct the netmask for IPv4.
Change-Id: Id6e955af129d55120676d0d9cfe75388671aa367
2011-06-30 22:59:18 -07:00
Chia-chi Yeh
f4e3bf892e VPN: refactor few JNI methods for the usage of legacy VPN.
Now default routes are handled in JNI instead of VpnBuilder.

Change-Id: Ib026bba6793b64aae0f8356df3d2aaae489d08b4
2011-06-30 12:41:11 -07:00
Mike Lockwood
9b9fb5cc08 GPS: Support for on-demand NTP time injection
Change-Id: I83db0249c13598070ed70b9f90207305b60b468f
Signed-off-by: Mike Lockwood <lockwood@android.com>
2011-06-29 15:09:40 -04:00
Chia-chi Yeh
84bf7390ea VPN: make the file descriptor non-blocking by default.
Change-Id: I89899b2b6a8ac64a4a052ffd501cc0221fab3ffe
2011-06-16 19:01:28 -07:00
Jeff Brown
474dcb5c3d Add support for disabling pointer gestures.
Made it possible for individual windows to disable pointer gestures
while the window has focus using a private API.

Cleaned up the InputReader configuration code to enable in-place
reconfiguration of input devices without having to reopen them all.
This change makes changing the pointer speed somewhat nicer since the
pointer doesn't jump back to the origin after each change.

Change-Id: I9727419c2f4cb39e16acb4b15fd7fd84526b1239
2011-06-14 22:07:31 -07:00
Chia-chi Yeh
96c7e70000 VPN: do not allow zero prefix length in routing rules.
The public API splits default route into two narrower routes.
Add this check in case some one calls the private API.

Change-Id: Ie1fc0155b74415b971380bc8429cd74026c3fda0
2011-06-13 18:29:54 -07:00
Chia-chi Yeh
8ea928945b VPN: do not use gateway in routing rules.
The first release of this API only supports TUN interface, and
so far there is no plan for TAP. TUN works on IP frames which
makes gateway nearly useless. The only value to have a gateway
is that kernel may use it to select the source address. However
currently it does not work in IPv6, and even in IPv4 applications
can bind to any local address on the device. Remove it to keep
the API clear, and it can be added back at any time if needed.

Change-Id: If9086d20d885a3a7f7ab5f07afbcfeecb677bbea
2011-06-13 17:59:58 -07:00
Chia-chi Yeh
23a5e4bcdc VPN: tolerate duplicated routes.
Change-Id: I0f9efa8c3af3d4859358438745a5cd2c4ad376ca
2011-06-13 16:14:49 -07:00
Chia-chi Yeh
6ddd57491a VPN: fix a bad optimization of zeroing ifr_flags lately.
Change-Id: Ib7d89422ef0a9159ba912cf32b678821cb72a25a
2011-06-13 16:08:01 -07:00
Chia-chi Yeh
6224b5ec38 VPN: set IFF_NO_PI on TUN interface.
Packet info header (struct tun_pi) was required to support IPv6
in kernel prior to 2.6.26. Setting IFF_NO_PI will remove the header
from the packets sent/recieved via TUN file descriptor, so now they
are just raw IP packets.

Change-Id: I0b4ae9db23d3bc10995a00eb053527b499ad6eb6
2011-06-13 15:26:51 -07:00
Chia-chi Yeh
3663227a8b VPN: add MTU support.
Change-Id: Ia2f06ae1fcf065bde7dafd212b84b37a34f1a47e
2011-06-13 15:05:37 -07:00
Chia-chi Yeh
3667369807 VPN: use ParcelFileDescriptor.adoptFd() instead of doing it in JNI.
This removes the dependency of android_util_Binder.h.
This change also removes some redundant zeroing.

Change-Id: Ie9fedd471dfa198f9a3261e03651f945cefbbf61
2011-06-13 14:32:18 -07:00
Mike Lockwood
8df5fcfa62 am 6d60190a: am e502c536: am b3174c46: UsbService: Fix JNI reference leak
* commit '6d60190a3156e0ac69c800bbb10691b70ae9bd54':
  UsbService: Fix JNI reference leak
2011-06-10 10:32:16 -07:00
Mike Lockwood
b3174c46ad UsbService: Fix JNI reference leak
http://code.google.com/p/android/issues/detail?id=17365

Change-Id: Ice0174e0db2a785d32ac16694ebf3b7ddb1b7fb3
Signed-off-by: Mike Lockwood <lockwood@android.com>
2011-06-09 14:48:11 -04:00
Chia-chi Yeh
ff3bdca31f The service part of the user space VPN support.
The dialogs will be in another change.

Change-Id: I0cdfd2ef21ffd40ee955b3cbde5ada65dbfdb0bc
2011-06-08 14:16:42 -07:00
Jeff Brown
774ed9d953 resolved conflicts for merge of 8b2c0014 to master
Change-Id: I33a5a2949dc6c2d09e8196ba8c7128caa7ac2361
2011-06-07 17:48:39 -07:00
Jeff Brown
bb3fcba0ca Touch pad improvements.
Bug: 4124987

Only show one spot per touch point instead of one spot per
finger for multitouch gestures.

Tweaked the pointer acceleration curves.

Dissociated the hover/tap timeouts from the "tap" timeout
since they mean very different things.

Change-Id: I7c2cbd30feeb65ebc12f6c7e33a67dc9a9f59d4c
2011-06-06 19:23:05 -07:00
Jeff Brown
7218d830e2 resolved conflicts for merge of ca2b552d to master
Change-Id: I2f3693a59042ac5aa2d7bcdc3a504c78dc99a18b
2011-06-03 15:50:27 -07:00
Dianne Hackborn
f3b57def93 resolved conflicts for merge of 7e193916 to master
Change-Id: If06892419319c3a2d4ab6b03dd3ceb99b83803b5
2011-06-03 12:26:54 -07:00
Jeff Brown
1a84fd1fb7 Add a preference panel for mouse speed.
Bug: 4124987
Change-Id: I3ce175d268a1d043cf5878481261b1049a15a149
2011-06-02 15:39:21 -07:00
Mike Lockwood
46d0adf825 UsbService: Refactor USB host and device support into two separate classes
Host support is in UsbHostManager, device support is in UsbDeviceManager

Renamed UsbDeviceSettingsManager to UsbSettingsManager

Change-Id: Ib76e72957c233fa7f08f454d4d9a2a1da6368cc7
Signed-off-by: Mike Lockwood <lockwood@android.com>
2011-05-31 20:52:06 -04:00
Jeff Brown
214eaf4887 Use ViewConfiguration to seed input system configuration.
Fix bug where the pointer presentation would be updated on
any input reader timeout rather than only when a pointer gesture
is in progress.

Bug: 4124987
Change-Id: Ie9bba4a0b3228d55e45e65fa2ede5cd6ba887a08
2011-05-31 15:00:59 -07:00
Jeff Brown
86ea1f5f52 Initial checkin of spot presentation for touchpad gestures. (DO NOT MERGE)
Added a new PointerIcon API (hidden for now) for loading
pointer icons.

Fixed a starvation problem in the native Looper's sendMessage
implementation which caused new messages to be posted ahead
of old messages sent with sendMessageDelayed.

Redesigned the touch pad gestures to be defined in terms of
more fluid finger / spot movements.  The objective is to reinforce
the natural mapping between fingers and spots which means there
must not be any discontinuities in spot motion relative to
the fingers.

Removed the SpotController stub and folded its responsibilities
into PointerController.

Change-Id: Ib647dbd7a57a7f30dd9c6e2c260df51d7bbdd18e
2011-05-25 14:37:17 -07:00
Jeff Brown
a6dbfdd3a8 Add a sprite controller. (DO NOT MERGE)
Refactored PointerController to extract the surface management
code to a new component called a SpriteController so that it can
be used to move finger tracking spots around the screen as well.
The SpriteController is designed to fully decouple the client from
any latency introduced by surface transactions and drawing.
All sprite updates are performed asynchronously on the Looper using
a copy of the sprite state.

Added a stub SpotController implementation for touch pad UX.
It will be implemented in a subsequent patch.

Fixed a little bug in pointer orientation changes when entering
DISPLAY_ORIENTATION_90 the x offset was clobbered.

Change-Id: I6d59d80df9af61e93af50290e7776337d10c9d5a
2011-05-25 14:37:16 -07:00
Jeff Brown
524ee64b91 Support chorded fallback keys. (DO NOT MERGE)
Also be more careful about canceling fallback keys during focus
transitions, when the application handles the key, or when the
policy decides to do something different.

Fixed a crash due to JNI CallObjectMethod returning an undefined
value (not null) when an exception is thrown.

Fixed a crash due to the policy trying to create a Dialog for
recent apps on the dispatcher thread.  It should happen on the
policy's Looper instead.

Bug: 4187302
Change-Id: I043f82913830f411b3bb4018d6422467b6ca454f
2011-05-24 15:21:46 -07:00
Jeff Brown
22d789d580 Fix focused application handle. (DO NOT MERGE)
Fix a bug where we were always setting the focused application
handle to NULL.  This broke ANR processing while starting
applications and caused input events to be dropped while
starting applications.

Bug: 4174573
Change-Id: Ice7ce3a2b65219568a8227fc1383bafb294666b5
2011-05-24 15:21:46 -07:00
Jeff Brown
5b2b4d9c0a Improve VelocityTracker numerical stability. (DO NOT MERGE)
Replaced VelocityTracker with a faster and more accurate
native implementation.  This avoids the duplicate maintenance
overhead of having two implementations.

The new algorithm requires that the sample duration be at least
10ms in order to contribute to the velocity calculation.  This
ensures that the velocity is not severely overestimated when
samples arrive in bursts.

The new algorithm computes the exponentially weighted moving
average using weights based on the relative duration of successive
sample periods.

The new algorithm is also more careful about how it handles
individual pointers going down or up and their effects on the
collected movement traces.  The intent is to preserve the last
known velocity of pointers as they go up while also ensuring
that other motion samples do not count twice in that case.

Bug: 4086785
Change-Id: I95054102397c4b6a9076dc6a0fc841b4beec7920
2011-05-23 17:19:59 -07:00