Activity was still referred from ImeInsetsSourceConsumer after
ViewRootImpl's mView was destroyed when ViewRoot's surface is cleared
using die signal.
This CL makes sure we still free-up resources at die signal.
Fix: 157955883
Test: atest NexusLauncherTests
Change-Id: Ia48f7b7a8cf6b867ce75b2b7393a60ba73b0c3d0
CL[1] introduces new WINDOW_FOCUS_GAIN_REPORT_ONLY flows to notify
InputMethodService only reports IME input target to WM when focusing to
the next window and its input connection remains.
Originally in android Q and prior devices, we don't need such report
mechnism but just skip to start new input connection and ignore
onStartInput / onFinishInput for the above use case.
Since starts from Android R, new IME insets control APIs relying on this
mechanism (see CL[2]) to keep the actual IME input target up-to-date.
As we expected there should be no new input connection and additional
onFinishInput when CL[1] landed.
However, in IMMS, startInputUncheckedLocked will be called
to callback additional onStartInput for InputMethodService, which mostly
is not expected, except when focusing the same window after device
turned screen on, we need to start input and callback onStartInput to
align with the behavior of android Q or the prior platform.
Besides, to have more clear code logic and debugging concept of
ignoring onStartInput and onFinishInput only when focused the same editor
with input connection remains, we remove WINDOW_FOCUS_GAIN_REPORT_ONLY
reason and introduced 2 more start input reasons to distinguish the
different behavior:
- WINDOW_FOCUS_GAIN_REPORT_WITH_SAME_EDITOR
- WINDOW_FOCUS_GAIN_REPORT_WITHOUT_EDITOR
[1]: I45a9814d812ad906f417c24200fd4219959e2423
[2]: I9e8984b7e5aa989a53ece9e2576393f795b9ef94
Fix: 158624922
Test: atest FocusHandlingTest InputMethodStartInputLifecycleTest
Test: manual as below steps:
1. Use Gboard, Open the emoji keyboard
2. Swipe down to reveal notification shade
3. Swipe up to dismiss notifications
4. Expect the Emoji keyboard is still open without close
Change-Id: I2da99ae67b9ce4051dec0c0f0e975ebe6e1ab118
When IME has zero insets, it doesn't map to any side and doesn't have
can't be animated.
IME can have zero insets in following cases:
1. Floating IME
2. Fullscreen IME (in landscape)
3. IME doesn't overlap with IME target window.
In order to animate a type, it must have insets. We can animate IME
from negative insets to zero and vice-versa. This makes zero insets IME a
special case of ISIDE_BOTTOM.
Deprecate SIDE_FLOATING because it shouldn't logically map to a side.
Fix: 153909316
Test: atest WindowInsetsAnimationImeTests#testZeroInsetsImeAnimates
Change-Id: I6d1d3430888db4632cb2f93e9042f692b35ebaeb
If we don't explicitly go through the doDie process the
WindowManagerGlobal instance will hold the ViewRoot alive
indefinitely. This accidental leak could be very expensive so
we prevent it with a finalizer.
Bug: 157709599
Test: Existing tests pass
Change-Id: I4fdf368eed4b4e43faacd9f62b6d9fddfd9b7ef2
If we pass immediate=false to the doDie without
updating the visibility, we may destroy the hardware renderer
but then try to draw again anyway, and then crash. It seems
theres no reason we can't call immediate=true and
properly shut down immediately.
Bug: 159250432
Test: Existing tests pass
Change-Id: Ibc6be8901be10c0985681d83f4ce16dd1ab54925
- Replace InsetsState ArrayMap with simple array.
- Cache same values in InsetsPolicy.
- Only access Dimmer if dimming
Test: InsetsState test etc.
Bug: 159056748
Change-Id: I3e9e4f473eaa05b2013b7a6d0f37cd9c1fac81dd
Activity cannot be released because the context be holded by multiple
objects.
* Activity holds ContentCaptureManager.
* ContentCaptureManager holds the context and MainContextCaptureSession.
* MainContextCaptureSession holds the context and ContentCaptureManager.
* The system server holds some binder references to MainContentCaptureSession.
If the system service never released the binder references, then the
activity is also never GC'd.
To avoid the issue,
1. Make the session state receiver of MainContextCaptureSession to be
static and uses weak reference to MainContextCaptureSession.
2. The direct service vulture may miss to do unlinkToDeath(), do a checking
while the session destory.
Bug: 143210612
Test: manual check Objects on the meminfo
Test: Activities should be released after a period of time
Test: adb shell dumpsys meminfo com.google.android.dialer
Change-Id: I12037483addb1efe444c74fa189ef6afd15821dd
eEarlyWakeup flag is used as a hint to SurfaceFlinger to adjust its
offsets so it can wakeup earlier and have sufficient time to compose
more complex scenes.
This flag has been replaced with explicit start and stop flags which
ensure the SurfaceFlinger offsets remain consistent during animation.
Bug: 158127834
Test: go/wm-smoke
Test: systrace to verify new tracepoint and offset behavior
Change-Id: Ib9c35c01a6bf02f88ec7cb1778e01909bd2f9055
This call to updateRelativeZ may be triggered from the
RT frame callback which may be triggered after we are detached
from the Window and in that case will be null. If we are detached
we are also going invisible so there is no need
to set a relativeZ.
Bug: 158706756
Test: Existing tests pass
Change-Id: I46aa824807b7b275e6a015c428fe7467a72ca949
A11y service cannot get focus of bubbles because it's not a
System owned display. This patch makes System UI owned display
a trusted display. Moreover, this patch refactors the logic to
identify a trusted display by introducing FLAG_TRUSTED and
removes the trusted display check along with supportsSystemDecorations()
because the check has been included in supportsSystemDecorations().
fixes: 155823002
Bug: 152416787
Test: atest DisplayContentTests
Test: atest WindowFocusTests
Test: atest TaskDisplayAreaTests
Test: atest MultiDisplaySystemDecorationTests
Test: atest DisplayTest
Change-Id: Ie684c6488904e5aa8cae166a455c6d55455e5f55
In some cases, System UI needs to hide navigation bar without any
animation, i.e. transitioning to AOD. This CL creates a method in
insets controller to disable/enable animations.
Fix: 150729581
Test: Enable AOD, and go to AOD from home screen by pressing power key.
Test: Enter/leave bouncer while screen is on.
Change-Id: I3fb7be898b9e615c661d07eca97c9ffcb6bbf8c3
Floating IME or fullscreen IME won't cause insets (except the area
overlapped with navigation bar). It doesn't make much sense to let
apps move the IME at these cases.
Fix: 157777145
Test: atest InsetsSourceConsumerTest
Change-Id: Ibdf5454843c880d7e726a66a8f1107ca511e5025
* The content capture session id should be globally unique
* Before this change, the id is genrated from a static random
number generator created with new Random(). It appears that
it all has the same seed value, so the sequence it generates
is identical across processes
* Ideally the session id should be generated from a center
place to ensure uniqueness (e.g. system server), or be a UUID
which is more unlikely to conflict. We will explore that as
a longer term solution in S
* For now the less invasive solution is to use SecureRandom,
which produces non-deterministic output
* Other approaches tried:
1) new Random(android.os.Process.myPid()). This doesn't work
as the pid value is all the same at static loading time
2) offset the generated number by pid. This will work but the
ids are not so random
3) make Random a non-static variable. This will work but it
creates a new object for every class
Test: manual
Bug: 158714891
Change-Id: I158f45680a961b32f3b01dc4eabb45e7215cdeec
In the new insets world, apps can move system bars while keeping them
visible, which can make the user difficult to access the bars. This CL
lets the user can restore the position of system bars by swipe.
This CL also removes some unnecessary logic and refactors some methods.
Fix: 152194798
Test: Manual test with NewInsetsMainActivity
Change-Id: I81c8a41ca88a403d291186d61ec597c6bc5d3d84
This makes the SysUI visibility callback compatible with the legacy
behavior.
Fix: 158639842
Fix: 158643177
Test: atest LayoutTests#testAddingImmersiveWindow
Change-Id: Ife06f8aab1b9d86790478665a33961d1b613d62d
When the window visiblity changes, SurfaceView gets notified to
release its surface. If an app relayout happens before this
notification, the ViewRootImpl surface will be null and the
SurfaceView will not release it surface.
Fixes: 158469622
Test: go/wm-smoke
Test: repro steps from bug
Test: play with SurfaceView apps
Change-Id: Ia4d5948fd229b2c77700c91691b54561d84290bb
When we notify insets changed, legacy behavior forces us to force
a new measure on the entire hierarchy. However, this can cause
jank in various scenarios.
Make sure that we don't report an insets change if non-observable
state changes.
Test: InsetsStateTest
Test: Swipe up to home while IME open
Bug: 157123435
Change-Id: I9c51066c6489888720b307240d03054cc18c4172
When we tried CL[1] to fix Gboard Translation UI dialog dismissed that
keeping the served view when focused to the next window,
although we can skip starting new input when the window focused back as
the behavior of Q,
However, we overlooked in R, IME insets will rely on IMS#reportStartInput
to get the updated IME input target, which will out of sync for the above
case.
To fix this regression, we report the next window focus gain
to IMMS with WINDOW_FOCUS_GAIN_REPORT_ONLY when the next focused view is
same as current served view and the served input connection remains.
so that in IMMS side won't get StartInputFlags.INITIAL_CONNECTION flags
to set restarting as false when calling IInputMethod#startInput to IMS,
and in IMS side will still call reportStartInput to WMS for updating
IME input target without additional onFinishInputView callback to
client.
[1]: I8d4fff94ba9313b773bc27fcbd019cc88580d3e9
Fix: 152373385
Bug: 155781821
Test: atest CtsInputMethodTestCases
Test: manual, make sure Bug 155781821 comment #10 works:
1) Launch video call in Hangouts.
2) End call.
3) Click on the text box.
4) Expect Soft-Keyboard shown
Test: make sure not break Bug 148489857 and Bug 148788569, following
auto / manual test to verify:
- Auto: atest FocusHandlingTest#testKeyboardStateAfterImeFocusableFlagChanged
- Manual:
1) Build / install EditTextVariations
2) Select menu -> Direct-Reply, make sure Notification comes up.
3) Tap EditText on Notification, verify soft-keyboard is visible.
Change-Id: I45a9814d812ad906f417c24200fd4219959e2423
* The NPE is due to in the InlineContentView we try to reparent the
surface view which is no longer attached to the window, this can
happen if the InlineContentView is attached to window and then
immediately detached from the window, before the surface package
is returned from the remote view process.
* Release the surface package immediately in this case, so the
remote view can be released.
Test: atest android.autofillservice.cts.inline
Bug: 158139090
Change-Id: I9efdf8ba182a1d66334362edcfb6ba58fcdc222a
Fixes an issue where the mPendingFrame was not properly cleared
if we re-applied the current frame.
Fixes: 156762386
Test: InsetsSourceConsumerTest
Change-Id: I9f0ebfafac44e1b4b87ea9d3408e64ba34bca2ec