Commit Graph

8339 Commits

Author SHA1 Message Date
John Reck
6ba466ff3e SurfaceView only call forceDisconnect if isValid
Change-Id: I683c2f937f44d8b3d912839a3e91cbd5b5c7f437
Fixes: 31778946
Test: Manual, launch Cookie Jam then tap recents
2016-09-30 21:33:34 +00:00
Kevin Hufnagle
8aff16acb7 docs: Clarified definition of KeyEvent.Callback.onKeyMultiple() am: b248b1f689
am: fcd4541b06

Change-Id: If0e9042f0df23403a128e45ca61258930b7db982
2016-09-26 23:47:09 +00:00
Kevin Hufnagle
fcd4541b06 docs: Clarified definition of KeyEvent.Callback.onKeyMultiple()
am: b248b1f689

Change-Id: Ie7380c80fc81b65a89337c7c126abc1dfe58a76e
2016-09-26 23:12:46 +00:00
TreeHugger Robot
1bc452b5a5 Merge "Update/correct Drag and Drop docs." into nyc-mr1-dev 2016-09-23 23:23:22 +00:00
Mark Lu
357dfd039a docs: update javadoc description for View.setVisibility() method am: ae0459f532
am: 66192078c5

Change-Id: I7f3775c5fd9e63252cea9fafb8ed4b79c95bfcba
2016-09-23 22:28:41 +00:00
Mark Lu
66192078c5 docs: update javadoc description for View.setVisibility() method
am: ae0459f532

Change-Id: Ie217e46288a11e86b2e5b6e56d8ce5cb2a214861
2016-09-23 22:19:47 +00:00
Vadim Tryshev
c5109b3f6e Update/correct Drag and Drop docs.
This CL reflects the N MR1 behavior and
fixes some bugs.

Defining the compatibility behavior will be
done separately.

Bug: 31702571
Change-Id: I2a79871f47849f9f5a9c3377a3061208488e6ecb
2016-09-23 11:47:09 -07:00
TreeHugger Robot
9d88f86190 Merge "SurfaceView: Force surface disconnection before reuse." into nyc-mr1-dev 2016-09-22 22:52:16 +00:00
TreeHugger Robot
07d798b902 Merge "Removing private system ui flags from status bar flags logic." into nyc-mr1-dev 2016-09-20 23:00:37 +00:00
TreeHugger Robot
f902fb5fa8 Merge "For pre-N apps, cascade LOCATION and DROP events." into nyc-mr1-dev 2016-09-20 22:03:07 +00:00
TreeHugger Robot
0ef6986379 Merge "For pre-N apps, keep entered all parents of an drag-entered child." into nyc-mr1-dev 2016-09-20 20:27:25 +00:00
TreeHugger Robot
b1dd85c081 Merge "Eliminating the “black hole” effect with location/drop events." into nyc-mr1-dev 2016-09-20 02:52:24 +00:00
Winson
ab216609f1 Removing private system ui flags from status bar flags logic.
- Prevent third party apps from inadvertently changing internal SystemUI
  flags through a call to setSystemUiVisibility().  These flags are only
  set in the individual SystemUI components and can be updated in WMS
  directly.

Bug: 29875297
Change-Id: I5ea238c8fb16a0eccd6e993d95a912acb359cee6
2016-09-19 18:39:25 -07:00
Vadim Tryshev
45bee6b24c For pre-N apps, cascade LOCATION and DROP events.
To restore the pre-N behavior, if a view returns false from its
LOCATION or DROP event handler, the event goes to its parent.

Bug: 31559942
Change-Id: I322099ae1e8a5cbbcf8814f2cd274fbae53b6848
2016-09-19 13:55:46 -07:00
Kevin Hufnagle
b248b1f689 docs: Clarified definition of KeyEvent.Callback.onKeyMultiple()
The onKeyMultiple() event captures simulated, not actual, presses of
the same key in rapid succession. Adjusted the method definition to
include this clarification.

Bug: 2335983
Change-Id: Id01182d81dafe98df9e559ff24f9e1d5a1f949c3
2016-09-19 11:22:31 -07:00
Vadim Tryshev
ef12811560 For pre-N apps, keep entered all parents of an drag-entered child.
The bug complains that parents of a view under the drag location
don’t get drag events.
This is first of a 2 CLs that will restore the old functionality
(modulus fixing bugs) for pre-N apps.

This CL restores pre-N "nested" model of the entered state for
pre-N apps. It also makes possible restoring "nested" model for
LOCATION and DROP (implemented in a follow-up CL)

The CL replaces (for pre-N) generation of ENTER/EXIT events that
happens at the moment of changing the drag focus with generation
folowing the recursive delivery of coordinate-bearing events.

Bug: 31559942
Change-Id: Iead6bde9c1f88819b30afc78c1f424f7c1b64d51
2016-09-19 11:14:19 -07:00
Eino-Ville Talvala
c4faf0cb13 Docs: Note that a Surface acts like a weak reference
This causes frequent programming errors, when developers assume
that holding onto a Surface will keep its associated SurfaceTexture,
ImageReader, etc, also alive.

Bug: 31551063
Test: m offline-sdk-docs, manual viewing of result
Change-Id: I5fb5bb3e3c80c7d5d735417b1697e0fe9a62fc46
2016-09-16 22:58:11 +00:00
Vadim Tryshev
1edc6daf1d Eliminating the “black hole” effect with location/drop events.
Currently, a container view that doesn’t accept events, but has a
child that accepts events, prevents its parent from receiving
LOCATION/DROP events while the drag is over the container (but not
the child). This is a bug.

With this fix, such a container will prevent the parent from
invoking a (second) LOCATION/DROP event only if the event was really
delivered to any of its descendants.

To know whether the event was delivered, I added
DragEvent.mEventHandlerWasCalled member.

EXITED/ENTERED events are now generated upon delivery of the event
that has coordinates in it.

Current view that has drag focus is now global to reflect the fact
that it’s one per process.

Bug: 31469490
Change-Id: I248e8d1de87b7734853136eb4719f7571cea91d5
2016-09-16 11:20:16 -07:00
Gopal Krishna Shukla
d33c07550f Remove synchronization from getCurrentInputMethodSubtype()
getCurrentInputMethodSubtype() acquires InputManagerService.mMethodMap
within its body. There seems to be no reason for holding
InputMethodManager.mH to call getCurrentInputMethodSubtype(). Holding mH
can cause potential deadlock b/w two threads acquiring mH and mMethodMap
in different orders.

Bug: 31247871
Bug: 31273203
Bug: b.android.com/218423
Change-Id: I20cf2c20f49b1b02c0f7a18257b49d4bcc081b5d
2016-09-15 23:20:05 -07:00
Vladislav Kaznacheev
c9bab3001f Update JavaDoc for DragEvent.getLocalState am: 048f3bfaf0
am: fa05df640f

Change-Id: I535a5218bec2f5cf0ea9fa83aaa92ab70f05fcdd
2016-09-09 18:47:41 +00:00
Vladislav Kaznacheev
fa05df640f Update JavaDoc for DragEvent.getLocalState
am: 048f3bfaf0

Change-Id: I72bec54ac999ebce5779062ddc5effd1bb4d61ce
2016-09-09 18:42:34 +00:00
Vladislav Kaznacheev
048f3bfaf0 Update JavaDoc for DragEvent.getLocalState
Explicitly state that "local state" is local to the window
which has started the drag operation.

Bug: 31372686
Change-Id: Idbea7586c4e74097362067fa90390b97744181bb
2016-09-08 16:37:23 -07:00
TreeHugger Robot
c779cdc560 Merge "Change density for the correct user" into nyc-mr1-dev 2016-09-08 21:07:01 +00:00
Robert Carr
387838be95 SurfaceView: Force surface disconnection before reuse.
Prior to N, if a client received the surfaceDestroyed callback
from their SurfaceView they could trust that the surface would not be
reused. Now that is not true in multiple scenarios. If a client fails
to shut down its EGL context then, we could end up in a situation where,
the client will never disconnect. Then when we reuse the same
underlying IGraphicBufferProducer for surfaceCreated next
the app will crash with a double connect error. There is no valid
use of the surface inbetween surfaceDestroyed and surfaceCreated,
so we just force the disconnection after surfaceDestroyed.

Bug: 30236166
Change-Id: I2e3e4b3176492dc0c2d46a59e0b5a781bf9bc356
2016-09-08 13:54:29 -07:00
Mark Lu
c76ea3d727 docs: fix grammar mistake in TextureView am: e8691d19cb
am: c657eed270

Change-Id: Ie27e53ef83f31dc528df7db8973e6484d1b53230
2016-09-07 23:35:43 +00:00
Mark Lu
c657eed270 docs: fix grammar mistake in TextureView
am: e8691d19cb

Change-Id: I857deef5cf08c9cdaf0d6e8e99449e688bec5ba5
2016-09-07 23:29:20 +00:00
Robert Carr
3387913237 SurfaceView: Correct coordinate space in windowPositionLostRT.
mWinFrame as set when returning from relayout will be in screen
space coordinates. repositionChild however expects coordinates relative to the
parent position (like relayout).

Bug: 31112993
Change-Id: Id4fcd7fcb771908e8a7db981207d19c99fb51b98
2016-09-07 11:07:18 -07:00
Alan Viverette
df3a7cab8f Change density for the correct user
Bug: 30839993
Change-Id: I5368accddfc4a03b8025a257b4155fcdc6197f11
2016-09-06 17:13:41 -04:00
Phil Weaver
85d18cce6d Merge "Stop double notifying a11y about Toasts." into nyc-mr1-dev 2016-09-06 16:33:42 +00:00
Svetoslav Ganov
aa07653d2e Prevent apps to overlay other apps via toast windows
It was possible for apps to put toast type windows
that overlay other apps which toast winodws aren't
removed after a timeout.

Now for apps targeting SDK greater than N MR1 to add a
toast window one needs to have a special token. The token
is added by the notificatoion manager service only for
the lifetime of the shown toast and is then removed
including all windows associated with this token. This
prevents apps to add arbitrary toast windows.

Since legacy apps may rely on the ability to directly
add toasts we mitigate by allowing these apps to still
add such windows for unlimited duration if this app is
the currently focused one, i.e. the user interacts with
it then it can overlay itself, otherwise we make sure
these toast windows are removed after a timeout like
a toast would be.

We don't allow more that one toast window per UID being
added at a time which prevents 1) legacy apps to put the
same toast after a timeout to go around our new policy
of hiding toasts after a while; 2) modern apps to reuse
the passed token to add more than one window; Note that
the notification manager shows toasts one at a time.

bug:30150688

Change-Id: Ia1dae626bd9e22541be46edb072aa288eb1ae414
2016-09-02 14:00:07 -07:00
Yohei Yukawa
1ab959a6e0 Fix typos in JavaDoc for InputConnection
This CL fixes typos in JavaDoc for InputConnection.

This CL slso updates the content regarding a new API that was added in
API 25 [1][2].

 [1]: Iaadf934a997ffcd6000a516cc3c1873db56e60ad
      152944f490
 [2]: Ica1ba3154795c1bf44e140dfe639b299f83cd8af
      adebb52588

Bug: 31249896
Change-Id: Icafedb15943a84f8e5b03ef9eb3a50627d508bdd
2016-09-01 15:42:29 -07:00
Mark Lu
ae0459f532 docs: update javadoc description for View.setVisibility() method
Bug: 19770068
2016-08-30 17:51:22 -07:00
Mark Lu
e8691d19cb docs: fix grammar mistake in TextureView
Bug: 6441115
2016-08-30 17:38:42 -07:00
TreeHugger Robot
c0e2e0ad62 Merge "TextureView: clean up displaylists" into nyc-mr1-dev 2016-08-31 00:26:46 +00:00
Phil Weaver
532c7999c5 Stop double notifying a11y about Toasts.
TalkBack was speaking all Toasts twice because we were
sending both NOTIFICATION and a WINDOW_STATE_CHANGE events
when Toasts were displayed.

Stop sending the WINDOW_STATE_CHANGE event for toasts.
Bug: 30570188
Change-Id: I26c6dc50350dfd4daf2a706b94fadcf5d1e03557
2016-08-30 15:41:59 -07:00
sergeyv
17dd01b693 TextureView: clean up displaylists
bug:31066756
Change-Id: Ibc61825ad1ed12479e9de18cc06be7401d3fc93a
2016-08-30 14:03:32 -07:00
Eino-Ville Talvala
0656931d18 Merge "android.view.Surface: Add parceling warning" into nyc-mr1-dev 2016-08-30 17:44:11 +00:00
Eino-Ville Talvala
f005f5ed88 android.view.Surface: Add parceling warning
Surface is parcelled partly in java, partly in native, and any fields
added in java have to be accounted for in the native side as well.

Add a warning to avoid issues in the future

Bug: 31162160
Change-Id: I48ca1bc3eea29f1ac3d3065f6defb6ed2be4052a
2016-08-29 17:51:23 -07:00
John Reck
8eaa65b867 Merge "Cherry pick TextureView fixes" into nyc-dev 2016-08-29 23:33:57 +00:00
Chris Craik
2e8a8a2432 Cherry pick TextureView fixes
The following changes are in this commit:

Avoid destroying TextureView surfaces for onStop

bug:30238922

TextureViews will hold onto their backing surfaces, which will allow
them to resume gracefully when the app's surfaces are saved.

Now only resources that are destroyed for onStop are DisplayLists.

(cherry picked from commit 391d560402)

TextureView: destroy layer on destroyHardwareResources event

bug:30468770

(cherry picked from commit 1c16c37d86)

Fix NPE in TextureView

Bug: 30651595

(cherry picked from commit 3c2587f26e)

Fix NPE in TextureView

Bug: 30779663

(cherry picked from commit 7e237189c2)

Fix maps resume being blank

Bug: 30889568

Fixes an issue where mLayer didn't have
the mSurface set on it in certain resume
scenarios.

(cherry picked from commit 03df0834e6)
2016-08-29 14:22:13 -07:00
Jorim Jaggi
6626f54e65 Add animation when unoccluding windows (1/2)
Before there was a jump-cut when a window that was occluding Keyguard
was going away, leading to an ugly flicker. To fix this, we do the
following.

- Always show windows with FLAG_SHOW_WHEN_LOCKED above lockscreen, even
if they don't "match" the currently occluding app (which is null in the
animation case)
- Move wallpaper behind last window that is not hidden by policy, so the
window doesn't get occluded by the wallpaper.
- Add a flag in the setOccluded call whether to animate or not. SystemUI
then plays a nice animation when it's set.
- Override the animation to always be the animation that happens when we
exit a window which is revealing the wallpaper behind, to make it
consistent with the home screen case.

Fixes: 30829255
Change-Id: Ib3fe20fc9003a0f9f291c974740f044ed8707e75
2016-08-29 14:15:33 -07:00
Yohei Yukawa
8eb07090a4 Make sure IME focus is synced to View focus
This CL fixes an edge case that my previous CL [1] forgot to handle.

The goal of my previous CL was to avoid InputMethodManager from getting
confused by a false focus-in event from temporarily detached Views.
However, my CL forgot to take care of the case where the temporarily
detached View is still focused even after the temporary detach mode is
done.

The bad news is that such a situation is relatively easy to trigger by
having a ListView that has EditText as follows, which seems to be
known to be a common technique in Android developer community to put an
EditText in a ListView.
  ListView#listView.addHeaderView(new EditText(context), null, true);

If the ListView is initialized as above, and the EditText has input
focus, View focus and IME focus start to disagree immediatelly after the
ListView's layout is re-evaluated.  This is really easy to trigger, for
example just by dismissing the IME window.

In summary, the root cause is that InputMethodManager#focusIn(View) is
now always ignored as long as the View is temporarily detached, under an
assumption that IMM#focusIn(View) will be called back again with a View
that is not temporarily detached when everything is stable.  Hence the
fix is to do so by hooking up View#dispatchFinishTemporaryDetach() to
call IMM#focusIn(View) again when the View is actually focused in the
final state.

 [1]: Ia79bbd8468f768d546354382b47b39dd31ef7bb5
      a4ed0cfcb6

Bug: 30022872
Bug: 30578745
Bug: 30706985
Change-Id: Iecbdb00dcef8c72e4f7b31035c9bf0f4a40a578f
(cherry picked from commit dd228fbb4d)
2016-08-29 18:24:31 +00:00
Pablo Ceballos
23784fd6d9 Merge "Fail createVirtualDisplay with single-buffered Surface" into nyc-mr1-dev 2016-08-29 17:42:00 +00:00
Adam Powell
fd86f7fdfd Fixes for ImageView drawable visibility dispatch
am: 06f9eb8b62

Change-Id: I8b7d8c73f0a718963a191fd5460517e5a7445974
2016-08-27 01:19:28 +00:00
Daniel Chapin
7c02d7adaa Merge "Fixes for ImageView drawable visibility dispatch" into nyc-dr1-dev 2016-08-27 01:14:34 +00:00
Chong Zhang
9f92bc2602 DO NOT MERGE -- Only use saved surface if started by launcher or moved to front
am: 813be138ae

Change-Id: Id64071882a0b90212b92234a4d0bdc67f2ee5e1a
2016-08-26 23:28:17 +00:00
Adam Powell
06f9eb8b62 Fixes for ImageView drawable visibility dispatch
Some apps rely on their drawables not getting not-visible hints via
setVisible when the window visibility changes. This manifests as
additional animations, such as crossfading from placeholders when the
window becomes visible again.

Apps should be able to handle this case in the future now that we have
more detailed reporting via onVisibilityAggregated, but to keep
existing apps working as-is, ImageView now operates in a compatibility
mode for targetSdkVersion < N and will only dispatch visibility
signals based on the same triggers used in M. New apps get the more
detailed signals.

Fix a bug where window visibility dispatch via onVisibilityAggregated
would double-dispatch "not visible" when the window is transitioning
from GONE => INVISIBLE or INVISIBLE => GONE.

Make the growing set of compatibility check fields in ImageView
static, matching the pattern from View.

Bug 30216207

Change-Id: I88875260bf6aaa23687c7d51353de8d633383531
2016-08-26 22:59:39 +00:00
Chong Zhang
813be138ae DO NOT MERGE -- Only use saved surface if started by launcher or moved to front
Restrict saved surface to launcher start (ACTION_MAIN&CATEGORY_
LAUNCHER), or there is no intent at all (eg. task being brought to
front). If the intent is something else, likely the app is going
to show some specific page or view, instead of what's left last time.

This solves problems like the launcher shortcuts on DeckClock,
each of them is a different intent and will show one specific
view regardless of last states. Another example is Chrome tab
opened directly by action VIEW to open some URL.

(Note that this doesn't solve the problem with Chrome homescreen
shortcuts, it will still start with saved surface (if Chrome
is already open). This is because the shortcut is a trampoline
activity that starts the real chrome tab activity, but when
the trampoline is started, the whole task is already brought
to front, and ChromeTab could become visible with the task
before we actually start it.)

bug: 31055479
bug: 27747315

Change-Id: Id3e61c61ef516b0edc1f174320f02661222f226b
(cherry picked from commit ad24f96def)
2016-08-26 15:41:58 -07:00
Pablo Ceballos
aff2f94939 Fail createVirtualDisplay with single-buffered Surface
Bug 30106031

Change-Id: I434df329eb3c162dd9ef01245ac5e0da97216e70
2016-08-25 12:06:52 -07:00
Phil Weaver
1bb2cc8cc3 Merge "Revert "Dispatch a11y events in separate thread."" into nyc-mr1-dev 2016-08-25 18:05:36 +00:00