Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
93cfcc21
Unverified
Commit
93cfcc21
authored
4 years ago
by
Emmanuel Garcia
Committed by
GitHub
4 years ago
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Account for MotionEvent instance mutations (#61417)
parent
77efc00a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
115 deletions
+15
-115
MainActivity.java
...ava/io/flutter/integration/androidviews/MainActivity.java
+1
-0
wm_integrations.dart
dev/integration_tests/android_views/lib/wm_integrations.dart
+10
-114
main_test.dart
...ntegration_tests/android_views/test_driver/main_test.dart
+4
-1
No files found.
dev/integration_tests/android_views/android/app/src/main/java/io/flutter/integration/androidviews/MainActivity.java
View file @
93cfcc21
...
...
@@ -52,6 +52,7 @@ public class MainActivity extends FlutterActivity implements MethodChannel.Metho
.
registerViewFactory
(
"simple_view"
,
new
SimpleViewFactory
(
executor
));
mMethodChannel
=
new
MethodChannel
(
executor
,
"android_views_integration"
);
mMethodChannel
.
setMethodCallHandler
(
this
);
GeneratedPluginRegistrant
.
registerWith
(
flutterEngine
);
}
@Override
...
...
This diff is collapsed.
Click to expand it.
dev/integration_tests/android_views/lib/wm_integrations.dart
View file @
93cfcc21
...
...
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import
'dart:io'
;
import
'dart:ui'
;
import
'package:flutter/material.dart'
;
...
...
@@ -16,7 +17,6 @@ class WindowManagerIntegrationsPage extends PageWidget {
@override
Widget
build
(
BuildContext
context
)
=>
WindowManagerBody
();
}
class
WindowManagerBody
extends
StatefulWidget
{
...
...
@@ -133,15 +133,17 @@ class WindowManagerBodyState extends State<WindowManagerBody> {
}
}
Future
<
void
>
onTapWindowPressed
()
async
{
await
Future
<
void
>.
delayed
(
const
Duration
(
seconds:
1
));
for
(
final
AndroidMotionEvent
event
in
_tapSequence
)
{
await
SystemChannels
.
platform_views
.
invokeMethod
<
dynamic
>(
'touch'
,
_motionEventasList
(
event
,
id
),
);
}
// Dispatch a tap event on the child view inside the platform view.
//
// Android mutates `MotionEvent` instances, so in this case *do not* dispatch
// new instances as it won't cover the `MotionEventTracker` class in the embedding
// which tracks events.
//
// See the issue this prevents: https://github.com/flutter/flutter/issues/61169
await
Process
.
run
(
'input'
,
const
<
String
>[
'tap'
,
'250'
,
'550'
]);
}
void
onPlatformViewCreated
(
int
id
)
{
...
...
@@ -151,110 +153,4 @@ class WindowManagerBodyState extends State<WindowManagerBody> {
});
}
static
List
<
double
>
_pointerCoordsAsList
(
AndroidPointerCoords
coords
)
{
return
<
double
>[
coords
.
orientation
,
coords
.
pressure
,
coords
.
size
,
coords
.
toolMajor
,
coords
.
toolMinor
,
coords
.
touchMajor
,
coords
.
touchMinor
,
coords
.
x
,
coords
.
y
,
];
}
static
List
<
dynamic
>
_motionEventasList
(
AndroidMotionEvent
event
,
int
viewId
)
{
return
<
dynamic
>[
viewId
,
event
.
downTime
,
event
.
eventTime
,
event
.
action
,
event
.
pointerCount
,
event
.
pointerProperties
.
map
<
List
<
int
>>((
AndroidPointerProperties
p
)
=>
<
int
>
[
p
.
id
,
p
.
toolType
]).
toList
(),
event
.
pointerCoords
.
map
<
List
<
double
>>((
AndroidPointerCoords
p
)
=>
_pointerCoordsAsList
(
p
)).
toList
(),
event
.
metaState
,
event
.
buttonState
,
event
.
xPrecision
,
event
.
yPrecision
,
event
.
deviceId
,
event
.
edgeFlags
,
event
.
source
,
event
.
flags
,
event
.
motionEventId
,
];
}
static
final
List
<
AndroidMotionEvent
>
_tapSequence
=
<
AndroidMotionEvent
>
[
AndroidMotionEvent
(
downTime:
723657071
,
pointerCount:
1
,
pointerCoords:
<
AndroidPointerCoords
>
[
const
AndroidPointerCoords
(
orientation:
0.0
,
touchMajor:
5.0
,
size:
0.019607843831181526
,
x:
180.0
,
y:
200.0
,
touchMinor:
5.0
,
pressure:
1.0
,
toolMajor:
5.0
,
toolMinor:
5.0
,
),
],
yPrecision:
1.0
,
buttonState:
0
,
flags:
0
,
source
:
4098
,
deviceId:
4
,
metaState:
0
,
pointerProperties:
<
AndroidPointerProperties
>
[
const
AndroidPointerProperties
(
id:
0
,
toolType:
1
,
),
],
edgeFlags:
0
,
eventTime:
723657071
,
action:
0
,
xPrecision:
1.0
,
motionEventId:
1
,
),
AndroidMotionEvent
(
downTime:
723657071
,
eventTime:
723657137
,
action:
1
,
pointerCount:
1
,
pointerProperties:
<
AndroidPointerProperties
>
[
const
AndroidPointerProperties
(
id:
0
,
toolType:
1
,
),
],
pointerCoords:
<
AndroidPointerCoords
>
[
const
AndroidPointerCoords
(
orientation:
0.0
,
touchMajor:
5.0
,
size:
0.019607843831181526
,
x:
180.0
,
y:
200.0
,
touchMinor:
5.0
,
pressure:
1.0
,
toolMajor:
5.0
,
toolMinor:
5.0
,
)
],
metaState:
0
,
buttonState:
0
,
xPrecision:
1.0
,
yPrecision:
1.0
,
deviceId:
4
,
edgeFlags:
0
,
source
:
4098
,
flags:
0
,
motionEventId:
2
,
),
];
}
This diff is collapsed.
Click to expand it.
dev/integration_tests/android_views/test_driver/main_test.dart
View file @
93cfcc21
...
...
@@ -58,7 +58,10 @@ Future<void> main() async {
await
driver
.
tap
(
addWindow
);
final
SerializableFinder
tapWindow
=
find
.
byValueKey
(
'TapWindow'
);
await
driver
.
tap
(
tapWindow
);
final
String
windowClickCount
=
await
driver
.
getText
(
find
.
byValueKey
(
'WindowClickCount'
));
final
String
windowClickCount
=
await
driver
.
getText
(
find
.
byValueKey
(
'WindowClickCount'
),
timeout:
const
Duration
(
seconds:
5
),
);
expect
(
windowClickCount
,
'Click count: 1'
);
});
});
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment