Commit Graph

8281 Commits

Author SHA1 Message Date
Yohei Yukawa
4aa5325ba8 Merge "Make View#isTemporarilyDetached() less confusing" into nyc-mr1-dev 2016-08-17 19:41:40 +00:00
Chong Zhang
f925b8df92 Merge "Add new window type TYPE_DRAWN_APPLICATION" into nyc-mr1-dev 2016-08-16 19:49:29 +00:00
John Reck
03df0834e6 Fix maps resume being blank
Bug: 30889568

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

Change-Id: Ib75065d3d75e6141d6cd8f306584f6a569b9907c
2016-08-16 09:44:23 -07:00
TreeHugger Robot
b14543d9d8 Merge "Introduce new constant for double tap gesture rotation hint." into nyc-mr1-dev 2016-08-16 01:21:57 +00:00
Chong Zhang
fea963edee Add new window type TYPE_DRAWN_APPLICATION
This type behaves like a normal TYPE_APPLICATION, except that WM
will always wait for it to be drawn before starting a transition.

WM always waits for TYPE_BASE_APPLICATION (main window), but for
TYPE_APPLICATION, it only waits if the window relayouts to visible
and gets a surface before the main window is drawn. If main window
itself is ready very fast, transition could start without the other
window.

bug: 30830849
Change-Id: Ife71a9812db7c8eba6ee4ead10ce4f31d9e93b40
2016-08-15 17:36:40 -07:00
Robert Carr
57d9fbd17f Introduce new constant for double tap gesture rotation hint.
As discussed in ag/1192965/ we have a special case for rotation
animation selection in launch from double tap. This was set to
ROTATION_ANIMATION_CROSSFADE as the goal was just to avoid
ROTATION_ANIMATION_ROTATE on the viewfinder surface and
seamless rotation in launch scenarios was initially descoped. Now we
are aiming at fixing this though, and ROTATION_ANIMATION_CROSSFADE
does not quality for seamless rotation. ROTATION_ANIMATION_JUMPCUT
also would not be a good choice because in the situation that the
rotation occurs before the app starting window appears, then we would
jump cut from unrotated wallpaper to rotated app, I think we want
a crossfade in this scenario. To this end introduce and use a new @hide constant
ROTATION_ANIMATION_SEAMLESS which qualifies for seamless but falls back
to CROSSFADE if seamless can't occur.

Bug: 30171992
Change-Id: If1945b17b5159be4cd5ba0b139d6bea9f7fcca33
2016-08-15 12:25:37 -07:00
Hui Shu
caef4afe42 Merge "Fix documentation." into nyc-mr1-dev 2016-08-12 21:24:44 +00:00
Alison Cichowlas
c7d6af6cd0 Merge "Add restart to GlobalActions." into nyc-mr1-dev 2016-08-12 20:12:38 +00:00
Alison Cichowlas
f8eca405c1 Add restart to GlobalActions.
Update power icon in GlobalActions for consistency
with new restart icon.

Bug: 30395806
Change-Id: I5ab20c15c889384fb685fc678fbf9ed912fcde5d
2016-08-12 13:41:00 -04:00
Hui Shu
bd042e666a Fix documentation.
Remove spurious duplicate line in JavaDoc.

Change-Id: I7ee7339d2ef21241ff21e66683e37e8ea0bbfaa4
2016-08-12 00:27:39 +00:00
Yohei Yukawa
ed841cbdd7 Make View#isTemporarilyDetached() less confusing
In Android N, View#isTemporarilyDetached() returns true if it is called
when the same View instance is handling View#onFinishTemporaryDetach().

Returning true there is, however, sometimes confusing, especially
scenarios like the following case:

    @Override
    public void onFinishTemporaryDetach() {
        doSomeRestoringWorks();
    }

    private void doSomeRestoringWorks() {
        doSomething();
    }

    private doSomething() {
        if (isTemporarilyDetached()) {
            // As of N, we hit here if this is called as a result of
            // View#onFinishTemporaryDetach().
        } else {
            // but is the logic here is more likely to be appropriate
            // when handling View#onFinishTemporaryDetach()?
        }
    }

What this CL aims to do is to let View#isTemporarilyDetached() return
false when it is called while handling View#onFinishTemporaryDetach(),
because it should make View#onFinishTemporaryDetach() more useful.

Regarding the app compatibility, View#isTemporarilyDetached() was added
in API 24 hence the impact on this change is still limited.

Bug: 30791718
Change-Id: If384da9f9e6ff849598896901626fd021bae5cda
2016-08-11 11:00:23 -07:00
John Reck
7e237189c2 Fix NPE in TextureView
Bug: 30779663
Change-Id: Ib3d40b60674ab3de8bfcfdd8489b89cf07b8d8b3
2016-08-11 10:43:14 -07:00
John Reck
8d521bb9b3 Merge "Make updateSurface non-blocking" into nyc-mr1-dev 2016-08-10 17:22:48 +00:00
Dianne Hackborn
75cdd5f68f Merge "Fix issue #30766518: Document what targeting N does" into nyc-mr1-dev 2016-08-10 00:45:55 +00:00
Dianne Hackborn
b34cbedb4e Fix issue #30766518: Document what targeting N does
Also small documentation cleanup in a few other places.

Change-Id: I16581c751aa0ffa146faba3b140a8fa2170f4520
2016-08-09 13:21:24 -07:00
John Reck
cd68212f08 Make updateSurface non-blocking
Bug: 30442298

We already do this for initialize(), fix
it so that update() is parallel with the
UI thread as well.

Shaves ~7ms off of the 99th percentile on
NotificationShade open & close

Change-Id: I1791df495453fb9e1e12362c68e3d20e837e62be
2016-08-09 12:11:13 -07:00
John Reck
8bcd5bc5b0 Merge "Fix currentAnimationTimeMillis to use vsync time" into nyc-mr1-dev 2016-08-08 21:49:04 +00:00
Muyuan Li
36ca72c6c2 Prevents screenshot layer from dismissing IME.
Add code to adjustWindowLw to force the flag
FLAG_NOT_FOCUSABLE to be set for layer type
TYPE_SCREENSHOT.

Bug: 30485483
Change-Id: I11725eb89fda59b6d50fa1700845cdfe9ffb930b
2016-08-06 20:49:51 -07:00
Yohei Yukawa
dd228fbb4d 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
2016-08-05 15:38:55 -07:00
Adrian Roos
c49dfaf4d6 Merge changes from topic 'smooth_unlock' into nyc-mr1-dev
* changes:
  Keyguard: Improve trusted unlock while occluded
  Keyguard: Refactoring for improving trusted unlock while occluded
2016-08-05 18:37:29 +00:00
John Reck
a2acb4f077 Fix currentAnimationTimeMillis to use vsync time
Bug: 30674719
Change-Id: I71f51eea971e43cbe85bb0713a1c457a1b3243b3
2016-08-05 09:16:06 -07:00
Adrian Roos
d88eb2693b Keyguard: Refactoring for improving trusted unlock while occluded
- Adds a trusted signal from Keyguard to PhoneWindowManager
- Allows PhoneWindowManager to exempt DISMISS_KEYGUARD windows from force hiding
- Allows PhoneWindowManager to dismiss Keyguard while occluded

Bug: 27410215
Change-Id: I3ad490b64a5805b6f3888a9f37fcfbdd0116395e
2016-08-05 00:04:07 +00:00
John Reck
3c2587f26e Fix NPE in TextureView
Bug: 30651595
Change-Id: Ic6cc2a1598de173aaadb4061562236a563a662b3
2016-08-04 07:55:38 -07:00
Sergei Vasilinetc
ba3d4f6ea1 Merge "TextureView: destroy layer on destroyHardwareResources event" into nyc-mr1-dev 2016-08-03 21:54:10 +00:00
sergeyv
1c16c37d86 TextureView: destroy layer on destroyHardwareResources event
bug:30468770
Change-Id: I5174808e3fa6e4a87e3522246522c4e6d7ee2c3c
2016-08-02 15:40:27 -07:00
Yigit Boyar
828d4ff61d Merge "Target API check for margin params fix" into nyc-mr1-dev 2016-08-02 20:41:08 +00:00
Yigit Boyar
2dd20a61e9 Target API check for margin params fix
Prior to N, our widgets were not converting MarginLayoutParams
properly between ViewGroups. The fix intrudced some issues in
older apps as the broken conversion code would hide developer
errors. This CL guards the change with a target API check so
that we don't affect older apps.

Bug: 30378230
Change-Id: I215281d261b553c3b4cedcd29ea0a861df809471
2016-08-02 11:27:18 -07:00
TreeHugger Robot
0d8f164cde Merge "Fix FrameMetricsObserver crash" into nyc-mr1-dev 2016-08-02 18:06:08 +00:00
Phil Weaver
41e185e73b Merge "Reduce extra a11y events when alpha changes." into nyc-mr1-dev 2016-08-02 16:54:43 +00:00
John Reck
65ddb154c7 Fix FrameMetricsObserver crash
Bug: 30587465

Someday maybe the technology will exist to
allow sharing a simple constant between
Java and C++, but today is not that day.

Change-Id: I17694746cb8712058133cd5ea10c47b9909f740b
2016-08-02 09:38:26 -07:00
Svetoslav Ganov
a2f247e6a6 Merge "Revert "Prevent apps to overlay other apps via toast windows"" into nyc-mr1-dev 2016-08-02 01:56:10 +00:00
Svetoslav Ganov
2fc661a453 Revert "Prevent apps to overlay other apps via toast windows"
bug:30150688

This reverts commit dc24f937b0.

Change-Id: Id7e8ddbf82ab426f55a5296791f1e8ebb61514bc
2016-08-02 01:55:01 +00:00
Phil Weaver
9937f81ac6 Reduce extra a11y events when alpha changes.
Changes in alpha only matter if they affect visibility,
so only 0 <-> nonzero changes are worth reporting. Report
them as subtree changes, as visibility affects subviews.

Not reporting every change greatly reduces the number of
event reported when alpha is animated.

Bug: 30183085
Change-Id: I905d53aa81ca8248b3aed86a91842ef499f303a8
2016-08-01 17:41:19 -07:00
Svetoslav Ganov
fea7cfce8b Merge "Prevent apps to overlay other apps via toast windows" into nyc-mr1-dev 2016-08-01 18:48:11 +00:00
Svet Ganov
dc24f937b0 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: Icc8f8dbd060762ae1a7b1720e96c5afdb8aff3fd
2016-08-01 11:46:02 -07:00
Agnieszka Madurska
9801935b95 Merge "Ignore padding for drawing round scrollbars." into nyc-mr1-dev 2016-07-27 21:36:55 +00:00
Aga Madurska
c283507246 Ignore padding for drawing round scrollbars.
This change is needed to correctly cope eg. with list views
which introduce header and footer view through additional
list view padding.

See ag/1221005 for details.

Bug:30420573
Change-Id: I7c9c0ce2b5ba85429b7921c42e4f97e139814e17
2016-07-27 22:22:11 +01:00
Adrian Roos
25582f21cd Merge "ViewRootImpl: Initialize sysui visibility" into nyc-mr1-dev 2016-07-27 18:39:17 +00:00
Michael Wright
1df0020f2d Merge "Actually compare supported color modes." into nyc-mr1-dev 2016-07-27 13:14:04 +00:00
Adrian Roos
1b2bf00098 ViewRootImpl: Initialize sysui visibility
Fixes a bug where the sysui visibility flags
were not dispatched when they changed if the
visibility changes the first time to a zero
value.

Change-Id: I4d6c990ca493b144f24c75e95b4ff18c4c0a029c
Fixes: 30259249
2016-07-26 14:27:37 -07:00
Michael Wright
16ae042351 Actually compare supported color modes.
Also, provide an equals implemenation for HdrCapabilities.

Bug: 30311415
Bug: 30367543
Change-Id: Ib8b9c9283519ae9baa48ecfecb8035848a9b29f0
2016-07-26 18:18:53 +01:00
Aga Madurska
8cc883de9e Use correct bounds for scroll bar rendering.
Bug:30001373
Change-Id: I20c77a2d97096bda451c3a871fd6be7ad699b047
2016-07-26 17:07:28 +01:00
TreeHugger Robot
eaa6d6b2c9 Merge "Avoid destroying TextureView surfaces for onStop" into nyc-mr1-dev 2016-07-26 00:06:45 +00:00
Chris Craik
391d560402 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.

Change-Id: Ia768ba9ffc4497c26aa3a5b101a0f5fa1a258b9c
2016-07-25 15:30:00 -07:00
Agnieszka Madurska
8ec317e220 Merge "Add support for round scroll bars to View.java" into nyc-mr1-dev 2016-07-25 16:31:36 +00:00
Aga Madurska
b19d0f9800 Add support for round scroll bars to View.java
Change-Id: If94a29d68cee504f7d31519b96f7b4b8a3af6bfa
2016-07-25 16:14:55 +01:00
Chong Zhang
e86da3bc62 Merge "Clean up surfaces when app is resumed without being stopped." into nyc-mr1-dev 2016-07-22 17:07:45 +00:00
TreeHugger Robot
5baca59226 Merge "Add View reveal on focus hint" into nyc-mr1-dev 2016-07-21 21:05:36 +00:00
Chong Zhang
45e6d2dc8b Clean up surfaces when app is resumed without being stopped.
When quickly toggling between two apps, app could be resumed while
it's stopping but not yet stopped. Upon resuming, it could have
surfaces that's marked mDestroying and waiting for the stopped
to be destroyed.

We need to dispose these surfaces properly. If the window is already
removed, we destroy them. Otherwise, clear mDestroying flag so that
the window is ready to be used again. Leaving mDestroying=true makes
the window ineligible for certain things such as receiving wallpaper.

bug: 30255354
Change-Id: Id881653550595ab8e702d6950949bf202ac5a0d9
2016-07-21 10:17:39 -07:00
Adam Powell
7ec3fb3947 Add View reveal on focus hint
Provide a way for views to signal that they would prefer not
to have their parents scroll or otherwise rearrange when they
request focus to try to show the full focused view to the user.
In some cases this can be disruptive to the UX.

As of now, framework views do not respect this hint and custom
views such as those found in currently deployed support libs
don't either. The policy is left open to ViewParent subclasses
that implement requestChildFocus.

Bug 30256922

Change-Id: I55194de888fe2b8129be9a9aa21aa5e18cbb8296
2016-07-20 17:42:10 -07:00