Commit Graph

8124 Commits

Author SHA1 Message Date
TreeHugger Robot
39e8022a75 Merge "Force pending transactions to flush before screenshot." into nyc-dev 2016-05-25 19:16:13 +00:00
Mady Mellor
7c17e70f2f Merge "Changes based on API council feedback for performContextClick" into nyc-dev 2016-05-25 19:00:08 +00:00
Mady Mellor
4f3ab93147 Changes based on API council feedback for performContextClick
Added an overloaded version with (float x, float y).

Fixes: 28295818
Change-Id: I41c2bf225964436655986b3ad4d0c630c658e38b
2016-05-25 09:52:51 -07:00
Yohei Yukawa
8e9214b4bd Make IMM more robust to spurious window focus-in
InputMethodManager (IMM) has a latch switch named IMM#mHasBeenInactive
to forcefully refresh IME focus state when an inactive client
(IMM#mActive == false) is gaining window focus.  However, it turns out
that there is a race condition where the latch could be unexpectedly
turned off. This is probably what we have been chasing in bug 25373872.

Imagine the following scenario:

  1. An app receives MSG_WINDOW_FOCUS_CHANGED w/ hasWindowFocus=false
  2. IMM inside the app receives MSG_SET_ACTIVE w/ active=false
  3. The app receives MSG_WINDOW_FOCUS_CHANGED w/ hasWindowFocus=true
  4. The app receives MSG_WINDOW_FOCUS_CHANGED w/ hasWindowFocus=false
  5. The app receives MSG_WINDOW_FOCUS_CHANGED w/ hasWindowFocus=true

Here, our current strategy has been:
  A. Turn on the latch when MSG_SET_ACTIVE (w/active=false) is handled.
  B. Turn off the latch and ask IMMS to start input when
     MSG_WINDOW_FOCUS_CHANGED (w/ hasWindowFocus=true) is handled.

The problem is that in the step B IMMS can reject the request if
WindowManagerService (WMS) tells that the window in question no longer
has window focus. This is not surprising because the app is
just handling messages in the message queue sequentially.  As a result,
the IME focus is not updated expectedly in the step 5, because the latch
is no longer enabled as we expected.

With this CL, the latch will be re-enabled if the app fails to start
input while IMM#mActive is false as a short-term solution.

In future we may want to address this issue in protocol level so that
we can address other known issues such as bug 26851566 at the same time.

Bug: 28281870
Change-Id: I60adb38013b063918b074c7b947649eada77b2c8
2016-05-24 23:55:29 +00:00
Mady Mellor
b0a824687f Children should have backgrounds
To add a background to children of a group, a couple of things
are changed when a group is in the expanded state:
- The parent's shadow + background is removed
- The group header is given a background and elevation
- The children are elevated to cast a shadow and have backgrounds
- When it's fully expanded the dividers won't be shown
- There's extra height added to the parent so that the child
  may cast the bottom shadow of the group
- As the children move into the bottom stack the last visible
  one alters its height and the ones below it are hidden
  to achieve the clipping effect

Fixes: 27591195
Fixes: 28655641
Change-Id: I0484308843e9b8bc10391387e54de07973a48f7d
2016-05-24 11:39:12 -07:00
Robert Carr
e9953b1752 Force pending transactions to flush before screenshot.
Following 14e54ba747 (ag/1043009) we need to push an empty
synchronous transaction if we want to ensure all previous
transactions have occured before taking a screenshot. In
light of Bug 7552304 it seems wise to do this before screenshoting
applications.

Bug: 27098060
Bug: 7552304
Change-Id: I6d7dfbe634a288c55449d2f1d6fbbfc13bab08ad
2016-05-23 20:57:11 -07:00
Phil Weaver
227d33439d Merge "Fix a11y crash when window layer isn't unique." into nyc-dev 2016-05-19 21:50:29 +00:00
Phil Weaver
adaafb2980 Fix a11y crash when window layer isn't unique.
TalkBack is seeing crashes that I can only explain by our assumption
that window layer is unique in all cases. TalkBack reports that it
happens during animation, so I assume that the layer may repeat
transiently.

Reducing our dependence on this assumption by traversing the list of
windows sorted by layer without assuming that the list has the same
length as the list of unsorted windows.

Also documenting the undefined behavior of SparseArray when indexing
beyond its bounds. The undefined behavior itself is intentional for
performance reasons.

Bug: 28679528
Bug: 28815817
Change-Id: I0c9f90b0b458b4cde465f603ba204fe6691e5c2c
2016-05-19 13:32:24 -07:00
TreeHugger Robot
a1e0cebf3a Merge "DO NOT MERGE Rename PointerIcon and Pointer Capture APIs" into nyc-dev 2016-05-19 15:03:36 +00:00
Yohei Yukawa
31884efd13 Merge "Move LocaleList to avoid layering violation." into nyc-dev 2016-05-18 02:14:26 +00:00
TreeHugger Robot
0cfbb7643e Merge "Document that SurfaceView is synchronous in N" into nyc-dev 2016-05-18 00:51:57 +00:00
Yohei Yukawa
23cbe85610 Move LocaleList to avoid layering violation.
Since LocaleList needs to depend on android.os.Parcelable, we cannot let
that class belong to "android.util" package, which causes layering
violation.

Bug: 28819696
Change-Id: Ia8de2ee9df3dd0a42b1fe84574439519b680fe18
2016-05-17 16:42:58 -07:00
Chris Craik
6ee192f4e9 Document that SurfaceView is synchronous in N
bug:28821062

Change-Id: I1c17949d93de3d1f89c504fc061f7d20dd451a4d
2016-05-17 16:17:25 -07:00
Hangyu Kuang
1e7d1aa6a6 Hide HdrCapabilities constructor.
Bug:25684127
Change-Id: I1a30ab3c162d8891c8aea1447757c85942033a0d
2016-05-17 14:21:01 -07:00
Michael Wright
f9d9ce7705 DO NOT MERGE Rename PointerIcon and Pointer Capture APIs
This is a response to API council feedback.

Bug: 26830970
Change-Id: Ia2d284b5c1ab8365bedfdc37d129be4b8146036b
2016-05-17 18:02:32 +01:00
TreeHugger Robot
b406dd20ee Merge "Fixed bugs with starting windows when displayng forcedResized activity" into nyc-dev 2016-05-17 00:51:41 +00:00
Wale Ogunwale
3b23239d6e Fixed bugs with starting windows when displayng forcedResized activity
- Added ActivityOption to mark a starting activity as a taskOverlay
activity. That is the activity will always be the top activity of the
task and doesn't cause the task to be moved to the front when it is added.
- Only set the starting window state of the ActivityRecord to shown if
window manager actually showed the starting window for the activity.
Avoids incorrectly trying to remove starting window for an activity that
didn't show any.
- When starting additional activity in a task, transfer the starting
window from the top most activity with a starting window. It is possible
the top most window does have a starting window like in the case of the
forcedResized activity.
- Only ensure visiblity of an activity we are starting in a task whose top
activity is a task overlay. They need to start in the visible-paused state
and not the resumed state which just causes extra churn in the system.
- Always add additional starting activities in a task with an overlay
activity below the overlay activity.

Bug: 28751186
Change-Id: I3624a4313ae9c406d42c67a3537f67ad685791af
2016-05-16 16:27:01 -07:00
Jorim Jaggi
23bf5462f0 Handle multi-window for inset hint
We need to incorporate task bounds when calculating the inset hint
so we don't specify something wrong to the client which we correct
immediately after.

Bug: 28697105
Change-Id: I23cec7d6cc62a4d982e0796a867e803d4cce0803
2016-05-16 23:18:14 +00:00
TreeHugger Robot
a423ec52ac Merge "Fix inconsistencies in DragEvent.getX/getY behavior and JavaDoc." into nyc-dev 2016-05-16 21:21:58 +00:00
Vladislav Kaznacheev
c244970220 Fix inconsistencies in DragEvent.getX/getY behavior and JavaDoc.
Make getX/getY return view-relative position as specified in the class
JavaDoc.

Fix obvious errors in JavaDoc for getX/getY

Bug: 28793547
Change-Id: Ic2ac646189711e7466594d4fc8326408fc0348e1
2016-05-16 12:57:15 -07:00
Yohei Yukawa
cef3337cb5 Merge "Make IMS#clearInsetOfPreviousIme() reliable." into nyc-dev 2016-05-16 15:22:21 +00:00
Yohei Yukawa
833bdcedce Make IMS#clearInsetOfPreviousIme() reliable.
This is a follow-up to my previous CL [1] for Bug 15922840 so that we
can clear the following variables in a more reliable way.
 - PhoneWindowManager#mLastInputMethodWindow
 - PhoneWindowManager#mLastInputMethodTargetWindow

The idea behind CL [2] is that when InputMethodManagerService (IMMS) is
switching from an IME to another IME, IMMS can send a signal to
WindowManagerService (WMS) to remember the current IME's inset so that
the system can continue using it to reduce jank until the new inset is
specified by the next IME.  As summarized in Bug 28781358, however, if
the next IME does not show the window after the IME switch, WMS (or
PhoneWindowManager to be precise) keeps using the previous IME's inset
unexpectedly until the new IME shows its window.  All we have seen in
Bug 15922840 and Bug 26663589 fall into this category.

The idea of this CL is just adding a hidden API to InputMethodManager so
that InputMethodService#clearInsetOfPreviousIme() can surely terminate
the IME transition state managed in PhoneWindowManager, rather than
relying on a hack of calling SoftInputWindow#show() and
SoftInputWindow#hide(), which actually does not work for Bug 26663589.

 [1]: Ib04967f39b2529251e4835c42e9f99dba2cf43f2
      2977eb7b6c
 [2]: I5723f627ce323b0d12bd7b93f5b35fc4d342b50c
      792faa2c16

Note that addressing all the corner cases in [2] still requires lots of
non-trivial change.  Hence this CL focuses only on Bug 26663589 (and
the case we handled in Bug 15922840).

Bug: 26663589
Change-Id: Ib567daa009c1139858dccadcfc6a04465ebecf36
2016-05-15 20:05:56 -07:00
Abodunrinwa Toki
cb66406d33 Ensure that ViewGroup.getChildVisibleRect(...) is recursive.
This change fixes the issue where
getChildVisibleRect(View, Rect, Point, boolean) call isn't recursive.
The method was introduced in I49550ed4082bcbdcfe4643b962b50f3308092525

Bug: 28514727
Change-Id: Ib6b0fb67ca6c700b44f645319c23b1213a2742d4
2016-05-13 19:26:03 +01:00
Andrii Kulian
4ef107bb7a Merge "Close leaked windows when trying to preserve main one" into nyc-dev 2016-05-13 03:24:34 +00:00
Vladislav Kaznacheev
cb4bbd7af8 Partial fix for jumping freeform windows
Currently every focus change causes a freeform window to jump
for a few frames. The size of the jump is equal to the difference
in inset size (which is derived directly from the window elevation).

This problem goes away for most real use cases if the insets are
not allowed to decrease.

Bug: 28318973
Bug: 22668382
Change-Id: I77ca440a7d9c89cc4d45e6667bf37da94a5c8a9a
2016-05-12 23:56:32 +00:00
Yigit Boyar
4c6eeb67a2 Merge "Respect add focusables flags" into nyc-dev 2016-05-12 23:19:22 +00:00
Yigit Boyar
4c6e983000 Respect add focusables flags
This CL fixes 2 bugs in View's addFocusables implementations.

1) addFocusables(list, dir) method was always returning focusables in
touch mode even if the device is not in touch mode.

2) addFocusables(list, dir, mode) was not respecting the provided mod.

Bug: 28745577
Change-Id: I9b9e5af27f8f5b1bb3cc601584fdad7c73e54a5d
2016-05-12 15:11:13 -07:00
Andrii Kulian
eac0ea5cdf Close leaked windows when trying to preserve main one
When app has several windows and activity is relaunched + we try to preserve
main window - other windows just stayed around until removed by timeout or
replaced by app. There was a problem when one of the windows registered
broadcast receiver and set its own timer to remove it. In this case all
receivers were removed by framework because windows were considered leaked
and apps' timer caused crash when trying to remove registered receiver.

This CL removes all windows expect the main one, which we're trying to
preserve in this case.

Bug: 28337135
Change-Id: Ib8790cc8c61801f11d871ba3803bb0ebc3d3be01
2016-05-12 13:37:05 -07:00
Dimitry Ivanov
0997908c95 Move Vulkan layer path setup to ApplicationLoaders
ThreadedRenderer was never the right place for this anyway, and
ApplicationLoaders can provide both the full library search path (not
just the extracted native library dir) as well as the application loader
namespace.

Bug: 28213888
Change-Id: Ibcc0a9178da4dba6f3f3105932fdac1a1d0261af
2016-05-11 22:59:10 -07:00
Jim Miller
e4044bb617 Fix KeyguardManager.isSecure() to observe work profile
The fix passes the calling userId instead of the current userId to
allow apps running as managed profiles to work.

Fixes bug 28666104

Change-Id: I9f8676ab11bd581d9e67b2b9f385036d4d3576ee
2016-05-10 18:38:25 -07:00
Jorim Jaggi
e85ce990fe Don't stage content drawn bounds
It's certainly not needed for two up, so remove the staging aspect.

Freeform resizing is currently broken because of another bug so this
can't be tested, but because we are not "shipping" it in any case
fixing the 2-up bug is more important, but it shouldn't break freeform
anyways.

Bug: 28618501
Change-Id: I6f285a714281fde50fd7328a3f8999cfa8dfb2c5
2016-05-11 00:37:33 +00:00
Chong Zhang
44aabe4b72 Disable keep_screen_on traces
bug: 28692100
bug: 27522448

Change-Id: Ic077e8985f1f21bc111287813fb2992ed01df909
2016-05-10 21:34:01 +00:00
Yohei Yukawa
9f76abc8ab Merge "Fix stale InputMethodManager#mFullscreenMode." into nyc-dev 2016-05-05 21:55:50 +00:00
TreeHugger Robot
ea162c3c79 Merge "Prepare to replace windows across recreate()." into nyc-dev 2016-05-05 19:38:17 +00:00
Chong Zhang
6afe594461 Merge "Debug traces to facilitate screen timeout debugging" into nyc-dev 2016-05-04 22:50:11 +00:00
TreeHugger Robot
4e34cd0537 Merge "Fix View leakage from mPreSortedChildren" into nyc-dev 2016-05-04 22:23:26 +00:00
Chong Zhang
4ffc318012 Debug traces to facilitate screen timeout debugging
bug: 27522448
Change-Id: I4d51be316e4aedecffb7001126849d7c6136d517
2016-05-04 15:09:01 -07:00
Chris Craik
fc56377178 Fix View leakage from mPreSortedChildren
bug:28553824

Change-Id: I62bfa3dcb121792dff7d00be1f4b018a99c96e1d
2016-05-04 13:40:07 -07:00
Robert Carr
77bdfb512f Prepare to replace windows across recreate().
When the activity locally recreates itself, nothing
on the server side is able to prepare preserving windows,
or replacing windows. The activity was trying to defer
removing the old window, but it was just waiting
until the new one was created, not until it was drawn,
thus resulting in a flicker. It's easy to backpack on the
existing replacement infrastructure.

Bug: 28221875
Change-Id: I55fc4ca78e9e11809473fedd8b30b6a6350cf852
2016-05-04 12:40:39 -07:00
Chet Haase
d86fb2ce37 Force second measure pass when there is a configuration change
It's possible for a call to updateConfiguration() to happen in the middle
of performTraversals(), after the measure phase has happened, but before
the layout phase. During the configuration call, it's possible for views to
have requestLayout() called on them. This can result in the request flag
not getting cleared, because views that have had layout requested, but which
have not yet been measured, may not be told to layout.

The correct flow should be that any code path causing requestLayout() (which
could be anything that calls out to user/app code) should happen before the
measure phase (or cause a second measure to occur). For now, causing the second
measure to occur is a low-risk simple change that fixes the immediate problem.

Issue #28152259  Calling requestLayout from inside View.onConfigurationChanged can cause problems

Change-Id: I3b532eeacc3784d8d21193d01ddd7fa15ac0684e
2016-05-04 18:14:46 +00:00
Abodunrinwa Toki
4e7a1208ea Implement alternative ViewGroup.getChildVisibleRect.
This CL allows getChildVisibleRect to optionally always call the
view's parent. The previous version attempted to optimize the call
by not calling further up the view heirarchy when the rect isn't
visible in the current view.

The call is hidden and the previous behaviour is preserved to limit
the bits of code that this change affects.

Bug: 28514727
Change-Id: I49550ed4082bcbdcfe4643b962b50f3308092525
2016-05-03 19:41:15 +01:00
Jaewan Kim
d98dcab679 Fix crash when device doesn't support picture-in-picture
Bug: 28512987
Change-Id: Ic8287d70fed491d7493d443ba7d9633b7d9aaea9
2016-05-03 07:13:28 +09:00
TreeHugger Robot
3446a6ef71 Merge "Fix ViewRoot inset adjustment after initial setup." into nyc-dev 2016-04-29 20:37:33 +00:00
Robert Carr
1bccabf3c4 Fix ViewRoot inset adjustment after initial setup.
If the insets change, "mWidth/mHeight" won't change
as it's based on the window frame (not the surface size),
we need to track when the insets change and call
HardwareRenderer.setup with the new values.

Bug: 28257246
Bug: 28368990
Change-Id: Ida304b57c4671d010d1cf7b370674c9453841c97
2016-04-29 11:13:57 -07:00
TreeHugger Robot
5bddeaa9bc Merge "Properly parcel HdrCapabilities." into nyc-dev 2016-04-28 15:01:31 +00:00
Yohei Yukawa
1544def0fa Fix stale InputMethodManager#mFullscreenMode.
The current mechanism to sync InputMethodService#mIsFullscreen to
InputMethodManager#mFullscreenMode is really fragile because
  1. Currently the state change is notified via
     InputConnection#reportFullscreenMode(), where InputConnection is
     designed to be valid only while the IME has input focus to the
     target widget.
  2. In favor of performance InputMethodService (IMS) calls
     InputConnection#reportFullscreenMode() only when #mIsFullscreen
     changed.  If InputConnection#reportFullscreenMode() failed, there
     is no recovery mechanism.
  3. Screen oriantation change is likely to cause Window/View focus
     state change in the target application, which is likely to
     invalidate the current InputConnection.

What our previous workaround [1] did for Bug 21455064 was actually
relaxing the rule 1 only for InputConnection#reportFullscreenMode().
However, my another CL [2] made the lifetime check of InputConnection a
bit more strict again, which revived the issue as Bug 28157836.

Probably a long-term fix would be to stop using InputConnection to sync
that boolean state between IMS and the application.  However, it's too
late to do such a refactoring in N, hence this CL relaxes the rule 1
again keeping it as secure as possible.

The idea is that we allow InputConnection#reportFullscreenMode() to
update InputMethodManager#mFullscreenMode regardless of whether
InputConnection is active or not, as long as the InputConnection is
bound to the curent IME.  Doing this as a short-term solution is
supporsed to not introduce any new risk because the active IME is
already able to mess up the InputMethodManager#mFullscreenMode by
calling InputConnection#reportFullscreenMode() on any other active
InputConnection.  Bug 28406127 will track the long-term solution.

 [1]: Id10315efc41d86407ccfb0a2d3956bcd7c0909b8
      da589dffdd
 [2]: If2a03bc84d318775fd4a197fa43acde086eda442
      aaa38c9f1a

Bug: 28157836
Change-Id: Iba184245a01a3b340f006bc4e415d304de3c2696
2016-04-28 12:41:11 +00:00
Michael Wright
b082890149 Properly parcel HdrCapabilities.
Since the field might be null, we can't just read and write the
object directly. Use Parcel's convenience methods to do so safely
instead.

Bug: 28427070
Change-Id: I6460c9cb43dc6da97d5fd9edeaa78bdaaf105446
2016-04-27 19:28:29 -04:00
Phil Weaver
1f70f0b7d6 Merge "Fix several accessibility magnification issues." into nyc-dev 2016-04-27 22:50:37 +00:00
Phil Weaver
70439244ba Fix several accessibility magnification issues.
Clarifying region used for magnification as "magnificationRegion",
both in the public API and in the code. There's been significant
confusion about what "magnfifiedRegion" means. Removing
"availableRegion" from everywhere except where it's required, as
that region was identical to magnified/magnification region.

Trying to shut down magnification was a complex situation where
animations in progress and new magnification requests were tricky to
handle correctly. It was not possible to guarantee that the
magnification callbacks were unregistered consistently. There were
at least two situations that led to phone restarts:
1. If a triple tap was detected between unregistering the callbacks
and shutting down the input filter. In this case the magnification
request would go through.
2. If an animation had just started when magnification was turned
off, so the current magnification was 1.0 but the animator was
about to change it. In this case the callbacks would be unregistered,
and then the animator would start changing the magnification.

This change makes registering and unregistering magnification atomic.
It also makes MagnificationController stick around indefinitely once it
is created, registering and unregistering as needed to support
magnification gestures and services that control magnification. Services
that merely query the status of magnification no longer register for
callbacks.

One part of shutting down is turning off the animation and guaranteeing
that it won't try to make further changes. Adding a flag to
SpecAnimationBridge and a lock in that class so we can guarantee that
nothing happens when we aren't registered for magnification callbacks.

Also reconfiguring all accessibility options when a service stops to
make sure that only the features required by the current configuration
are enabled.

Bug: 27497138
Bug: 27821103
Change-Id: If697cbd34b117d82c8eee1ba7d0254089ee4241d
2016-04-27 13:57:43 -07:00
Bo Liu
08ca2e3a75 Merge "Revert "Expose setDrawGLFunctionDetachedCallback to webview"" into nyc-dev 2016-04-27 17:58:34 +00:00