Commit Graph

16323 Commits

Author SHA1 Message Date
Joanne Chung
b6a9530dc1 Merge "Update View translation APIs." into sc-dev 2021-03-25 14:31:40 +00:00
Adrian Roos
c33d71d602 Merge "Fix unexpected IME show because of stale requestedVisibleAwaitingControl" into sc-dev 2021-03-25 10:37:09 +00:00
Philip Junker
451405eb17 Merge "Add IntDef for system sound effect constants" into sc-dev 2021-03-25 09:31:09 +00:00
TYM Tsai
8fe0541d85 Merge "Update the content capture text changed event merge logic" into sc-dev 2021-03-25 09:19:16 +00:00
Joanne Chung
a749f2aadb Update View translation APIs.
This change doesn't contain the virtual view part and the API
dispatchTranslationRequests, it will be done in another change.

Bug: 178046780
Test: manual
Test: atest CtsTranslationTestCases
CTS-Coverage-Bug: 177960696

Change-Id: I65fe1db19c9dff21c0caca425fbb7d08559e730b
2021-03-25 15:28:13 +08:00
Tiger Huang
5905279553 Merge "Re-land: Make window stable while resizing" into sc-dev 2021-03-25 06:24:43 +00:00
Feng Cao
c8def0695b Update the content capture text changed event merge logic
* This is only applicable when two consecutive CC events are
  both TYPE_VIEW_TEXT_CHANGED event for the same view
* Before this change: we would merge if both events have
  non-empty text. However, if the user types fast, CC will
  not send the updates for individual word. Moreover, if the
  user adds a word and then delete it fast, CC may not capture
  the word since it'd be merged away.
* After this change, we change the criteria to consider whether
  the current text has a ComposingSpan if it's a Spannable.
  The logic is described in the code comment.

Bug: 181906241
Test: atest CtsContentCaptureServiceTestCases
Change-Id: I08d447f557f7e48ef34c5a6241c497db3ce4c5fc
2021-03-25 13:36:28 +08:00
Evan Rosky
660eb72df8 Merge "Add reporting to monitor apps incorrectly using getRaw" into sc-dev 2021-03-25 02:10:05 +00:00
Evan Rosky
8b82086722 Add reporting to monitor apps incorrectly using getRaw
getRawX/Y are implementation specific and are always display
relative. If any apps are using this, they should stop unless
the app is specifically trying to handle raw events.

Usage of getRaw will break under: multi-window, size-compat,
letterbox, display-areas, and independent window rotation.

Bug: 179274888
Test: adb shell dumpsys platform_compat
Change-Id: I2d87d0a62d7a28e15811dda7f9d16996e8159f69
2021-03-24 12:17:02 -07:00
Rob Carr
f803a76fc9 Merge "SurfaceView: Restore transaction application in useBLAST=false" into sc-dev 2021-03-24 19:04:34 +00:00
Philip Junker
dfcb12b34c Add IntDef for system sound effect constants
Test: m -j86 offline-sdk-docs
Test: atest android.view.cts.SoundEffectConstantsTest
Test: atest android.view.SoundEffectConstantsTest
Bug: 182945031
Change-Id: I8a496144e61e584f633a3950274fbdf0fe146e11
2021-03-24 14:24:55 +01:00
Charles Chen
1e76f995bf Merge "Move WindowContext module to window package" into sc-dev 2021-03-24 07:45:41 +00:00
Charles Chen
c7b8393108 Merge "Fix the sample code in WindowMetrics javaDoc" into sc-dev 2021-03-24 07:38:54 +00:00
Charles Chen
e62af88758 Fix the sample code in WindowMetrics javaDoc
WindowInsets#getInsetsIgnoringVisibility was wrongly written as
WindowInsets#getInsetsIgnoreVisibility

fixes: 183372217
Test: build & run
Change-Id: Ied3c73fe6bd51993b0ac8fe3befe919daedb35ad
2021-03-24 06:36:30 +00:00
Joanne Chung
afe90e57e2 Merge "Safe delete the deprecated APIs." into sc-dev 2021-03-24 06:32:35 +00:00
TreeHugger Robot
25546c3867 Merge "Allow extending the SurfacePackage lifetime" into sc-dev 2021-03-24 04:54:02 +00:00
Charles Chen
f48ece4875 Move WindowContext module to window package
In this way, we can clarify the owners and it is easier to maintain.
Also refactor to move WindowContext creation logic to ContextImpl.

Test: atest WindowContext WindowContextTests WindowContextPolicyTests
Bug: 159767464
Bug: 152193787

Change-Id: I78432aa18aa97e001f5a9a04321109e456fd137b
2021-03-24 11:26:50 +08:00
TreeHugger Robot
16f767310a Merge "Rethrow RemoteException from IInputMethodManager#startInputOrWindowGainedFocus()" into sc-dev 2021-03-23 20:49:38 +00:00
Tiger Huang
a7e33a41e5 Re-land: Make window stable while resizing
When the frame size and the frame position of the window are changed at
the same time, setPosition to the surface will be applied first, and
the client will draw on the new-size buffer later, which makes the
window flicker.

This CL uses applyWithNextDraw to make the new surface position can be
applied while the new frame is drawn. applyWithNextDraw is applied only
when
- the window doesn't have a move animation. So if a window needs to make
  resizing stable, it may need PRIVATE_FLAG_NO_MOVE_ANIMATION.
- it is visible, e.g., the surface is shown, and the window is OK to
  display -- for better performance.

If applyWithNextDraw is used while the window frame is changed to an
empty rectangle, e.g., Rect(10, 10 - 1000, 10), mNextDrawUseBlastSync
will stay true forever, because we don't draw while the dirty area is
empty, and ViewRootImpl would lose the only chance to clear the flag.
performTraversals will never be executed.

This CL makes mNextDrawUseBlastSync can be cleared in that case.

Bug: 182729646
Fix: 176874720
Test: steps in the bug
Change-Id: I81b0574ee8db7e4d9053639f56e04858d9feae90
2021-03-24 04:19:48 +08:00
Robert Carr
ad17626e0e SurfaceView: Restore transaction application in useBLAST=false
We may still have useBLAST=false when we are detached from
the ViewRoot, the recent CL to remove defer transaction
code mistakenly removed this code.

Bug: 183427823
Test: Existing tests pass
Change-Id: I7ef68ca9da053fd9b488a6da6101572ec05ab9a3
2021-03-23 12:52:39 -07:00
Vishnu Nair
39534b9445 Allow extending the SurfacePackage lifetime
Caller may need to keep the SurfacePackage alive after attaching it
to a SurfaceView. We allow this by creating a copy of the
SurfaceControl inside the SurfacePackage. Since the native layer
handle is ref counted, this will keep the encapsulated Surface hierarchy
alive after it has been released by SurfaceView.

Bug: 182838860
Test: atest SurfaceControlViewHostTests
Change-Id: I49e228b561d7aca23691d683747edc5365fc4206
2021-03-23 10:42:15 -07:00
Yohei Yukawa
71aca864c2 Rethrow RemoteException from IInputMethodManager#startInputOrWindowGainedFocus()
This is a relatively safe code clean up as a follow up of our recent
CL [1], which introduced InputMethodSessionWrapper for better
readability and maintainability.

Before that CL, it wasn't obvious that our try/catch block in

  InputMethodMnager#startInputInner()

was actually taking care of not only RemoteException from

  IInputMethodSession#displayCompletions()

but also from RemoteException from

  IInputMethodManager#startInputOrWindowGainedFocus()

Now that the former is taken care inside InputMethodSessionWrapper,
this CL tries to further simplify and clean up it.

One potential behavior change is that with this CL the calling app
starts crashing when Binder driver throws RemoteException while
calling one-way Binder IPC

  IInputMethodManager#startInputOrWindowGainedFocus()

Note that Completable.getResult(value) has already been rethrowing an
Exception when InputMethodManagerService explicitly throws an
exception since we rewrote the logic with our hand-written Completable
[2], which is indeed more likely to happpen.  Thus hopefully having
the same behavior for errors from Binder driver would be acceptable
and make it easier for us to detect something unexpected is happening.

Other than that, there should be no observable behavior change.

 [1]: Ifb4f86098011fe74cf4159446106d6c15c30fa30
      17827d754a
 [2]: If4b40244a2e0e3b11c38c1da9340ba8e5166ad64
      b9590fa1e1

Bug: 167948374
Test: atest CtsInputMethodTestCases
Test: atest CtsInputMethodTestCases --instant
Change-Id: I2cc879ba4a02cc9cf0f97c8380fe33c358e3d120
2021-03-23 09:57:45 -07:00
Joanne Chung
dd0224162c Add API to get the PendingIntent for translation settings Activity
Bug: 176208267

Test: manual test with sample app
Test: atest CtsTranslationTestCases

Change-Id: I00416cf9cb63d522b9d8a448be3533b89b753aa0
2021-03-23 23:51:46 +08:00
Joanne Chung
bab1efaded Safe delete the deprecated APIs.
Keep the implementation and Add @Deprecated and @remove for the
deprecated APIs. Use this way can make sure the client doesn't
crash if not updated but when app recompiles would be forced to move
to the new APIs.

Bug: 177789967
Test: Use the app that uses old APIs doesn't crash. When app would
like to recompile cannot see the old APIs.

Change-Id: I700470eaca2df030e50de964be5be2173c89259f
2021-03-23 13:03:19 +00:00
Adam He
476e44e1f9 Merge "Add API for TranslationContext" into sc-dev 2021-03-23 05:12:29 +00:00
Wei Sheng Shih
964eafdccc Merge changes Id0cf1b23,I4df6891e,I759de2e1 into sc-dev
* changes:
  Add trace for tracking the performance of new starting window
  Force enable hardware accelerated for starting window
  Pre-draw AdaptiveIconDrawable and cache it before doFrame
2021-03-23 03:15:07 +00:00
Jeff DeCew
2a12cfadb4 Merge "New MediaStyle template:" into sc-dev 2021-03-23 02:14:06 +00:00
TreeHugger Robot
ad97628537 Merge "Update the fallback logic in BaseInputConnection#getSurroundingText()" into sc-dev 2021-03-23 01:42:32 +00:00
TreeHugger Robot
e289502447 Merge "Remove legacy disable triple buffering config" into sc-dev 2021-03-22 19:39:44 +00:00
Adam He
7c3a6e37a2 Add API for TranslationContext
* TranslationContext holds source/dest specs, replacing spec pairs in
methods.
* TranslationCapability holds information on the translation models, as well
as a helper method to generate a TranslationContext for creating
translators.
* TCapability is meant to hold information about the translation models, and
provide information/flag on what the translator can support, versus the
TContext which will indicate exactly which supported flags should be
used and activated by the models.
* Added TM.getTranslationCapabilities, and add/remove TCapabilityUpdateListener

Bug: 176208267
Test: atest CtsTranslationTestCases
Change-Id: I2ab7a3eadcbbc9e13f8f33bf9c51cda69f30fdb7
2021-03-22 11:38:50 -07:00
Siarhei Vishniakou
e1c0d2a844 Merge "Notify InputEventAssigner about every frame" into sc-dev 2021-03-22 17:58:12 +00:00
Jeff DeCew
ff165814e1 New MediaStyle template:
* Remove all media-specific color extraction and colorization logic
* Remove all 'large icon' gradienting logic
* Simplify base (headerless) style to use a LinearLayout instead of tweaking margins
* Make compact media layout a tweak of the base (headerless) layout
* Make big_media layout a tweak of the big_base layout
* Fix an unnecessary swooping animation that happened on expand
* Ensure RTL layout also works

Fixes: 172652345
Test: manual testing w/ updated notify2
Change-Id: I11c1494c0ac32aaf3e9d2010560cc8f1d8c50037
2021-03-22 11:13:08 -04:00
Adrian Roos
07f3583061 Merge "IME Insets: Remove obsolete applyImeVisibility call" into sc-dev 2021-03-22 08:38:04 +00:00
Siarhei Vishniakou
5054a9d009 Notify InputEventAssigner about every frame
InputEventAssigner does not currently get notified about all frames. In
the existing logic, only the cases for batched consumption would be
counted as 'choreographer callback'. This misses several cases, such as:

1) CALLBACK_INPUT was never scheduled, but a frame is produced
2) CALLBACK_INPUT was scheduled, but no events were consumed

However, it is critical that InputEventAssigner knows about all frames,
because it needs to reset the 'down' state for proper frame attribution.

At the same time, we refactor the logic in InputEventAssigner. In the
updated logic, we will specifically store the event id with ACTION_DOWN
only. In all other cases, we will use the current / latest input event.

In this CL, we reset the 'down' state after the input event id is
used for the current frame. A good proxy for that is the
ThreadedRenderer::draw call, which in turns
calls attachInfo.mViewRootImpl.getUpdatedFrameInfo().

Also, rename "onChoreographerCallback" since it's not exactly clear
which callback this is referring to. In the new logic, this callback
will happen from 'draw'/'onDraw' functions.

Bug: 167947340
Test: add LOG_ALWAYS_FATAL crashes in LatencyTracker for duplicate
'reportTimeline' calls. The crashes are gone after this CL.

Change-Id: I5fad6665d10e0594963209b138e9bd2bdf00ca38
2021-03-22 07:59:18 +00:00
wilsonshih
998666c46d Force enable hardware accelerated for starting window
Currently the hardware acclerated was disabled for starting window, we
will need to enable it to fix the reveal animation janky.
With software rendering, each frame would cost 20~30ms on redfin.

Test: atest KeyguardTests KeyguardLockedTests SplashscreenTests
Bug: 182708883
Bug: 173975965
Change-Id: I4df6891e0b24231b7fd3a1d2d630ca2b9eead79f
2021-03-22 14:54:52 +08:00
Tiger Huang
7901e98c45 Animations for visual immersive mode
The CL applies fade-in/fade-out animations for BEHAVIOR_DEFAULT while
changing the system bar visibility.

Fix: 168913586
Test: WindowInsetsTests
Change-Id: I6e9887baf2ba40b51c01bf2239915d381ba891a6
2021-03-22 12:21:48 +08:00
Adam He
2e43f72bf1 Merge "Implement TranslationCallback with support for partial responses." into sc-dev 2021-03-21 09:45:33 +00:00
Nikita Dubrovsky
1b2051e372 Merge "Integrate OnReceiveContentListener in View.onDragEvent" into sc-dev 2021-03-19 23:43:26 +00:00
Adam He
ff092aae1a Implement TranslationCallback with support for partial responses.
Translator#translate() is also updated to be asynchronous with callback
instead.

Bug: 178651352
Test: atest CtsTranslationTestCases
CTS-Coverage-Bug: 178651352
Change-Id: Ibe1f97994fe6ee593a3a3bbb452c075b49a7eb5a
2021-03-19 14:58:47 -07:00
Ady Abraham
97190e25e9 Merge changes from topic "eEarlyWakeup_remove" into sc-dev
* changes:
  rename ExplicitEarlyWakeup -> EarlyWakeup
  Remove ISurfaceComposer::eEarlyWakeup
2021-03-19 17:39:19 +00:00
Adrian Roos
142218b1f9 IME Insets: Remove obsolete applyImeVisibility call
Test: atest InsetsControllerTest ImeInsetsSourceConsumerTest
Bug: 167947407
Change-Id: I8abb210eb20a17f5dfd6d071c57838afb9deb263
2021-03-19 17:12:26 +00:00
Wilson Wu
69a14b8a8e Merge "Introduce InputMethodSessionWrapper for InputMethodManager" into sc-dev 2021-03-19 02:05:02 +00:00
Wilson Wu
17827d754a Introduce InputMethodSessionWrapper for InputMethodManager
To simplify InputMethodManager code logic, have a wrapper
class which encapsulates IPCs from InputMethodManager to
InputMethodService.

Bug: 167948374
Test: atest CtsInputMethodTestCases

Change-Id: Ifb4f86098011fe74cf4159446106d6c15c30fa30
2021-03-19 09:50:42 +08:00
Nikita Dubrovsky
4b7b90e791 Integrate OnReceiveContentListener in View.onDragEvent
OnReceiveContentListener was already integrated with drag-and-drop
in TextView. The change extends support to all subclasses of View.

If an OnReceiveContentListener is set on the view, the default
implementation of View.onDragEvent will now return true for an
ACTION_DRAG_STARTED event and will call
View.performReceiveContent for an ACTION_DROP event.

Bug: 182617122
Test: atest CtsWindowManagerDeviceTestCases:CrossAppDragAndDropTests
Test: atest CtsViewTestCases:ViewOnReceiveContentTest
Test: atest CtsWidgetTestCases:TextViewOnReceiveContentTest
Test: Manually using ReceiveContentDemo
Change-Id: I98fb703220ebd1953b20dcab60d22847cc5000d8
2021-03-18 13:53:49 -07:00
TreeHugger Robot
c95396e1c8 Merge "Add Executor param to TSM#newSpellCheckerSession()." into sc-dev 2021-03-18 19:28:07 +00:00
TreeHugger Robot
df786ca150 Merge "Return an empty list instead of null." into sc-dev 2021-03-18 18:34:16 +00:00
Kohsuke Yatoh
da1e7e569f Return an empty list instead of null.
TextServicesManager#getEnabledSpellCheckerInfos() was introduced in
  commit 4c7423735e
as #getEnabledSpellCheckersList().
Then, the following commit added SuppressLint("NullableCollections"):
  commit d7f33cd648

As this API has been introduced recently in Android S timeframe, I think
it's better to fix the API behavior before it's finalized.

Bug: 180625329
Test: m checkapi
Change-Id: I33d3c86a0c19c0082299e383e50d3860b072e79d
2021-03-18 15:56:33 +00:00
Tiger Huang
1c7a274367 Merge "Let insets can still be controlled if its window bounds is moved" into sc-dev 2021-03-18 15:27:57 +00:00
Shawn Lin
730ab07d11 Merge "[Reland] Add nav bar case to RemoteAnimationTarget of non-app window" into sc-dev 2021-03-18 13:32:36 +00:00
TreeHugger Robot
c49aefef55 Merge changes from topic "aff_inline_tooltip-sc-dev" into sc-dev
* changes:
  Implement inline suggestion tooltip
  Add interface for the inline suggestion tooltip
2021-03-18 04:32:15 +00:00