Skip to content

Commit 84f3d28

Browse files
[flutter_releases] Flutter 1.22.2 framework cherrypicks (#68135)
* [flutter_tools] support Android Studio 4.1 on Windows (#67992) Android Studio 4.1 moved the location of the .home file on Windows which is used to located the install directory. This functionality is important because it is how we locate and discover the Android SDK functionality, as well as the appropriate JRE. fixes #67986 * [gestures] make stylus pointer types use touch pan/drag slop (#67885) * Update engine cherrypicks * pin customer_testing and add back windows to cirrus Co-authored-by: Jonah Williams <[email protected]>
1 parent f30b7f4 commit 84f3d28

File tree

6 files changed

+81
-10
lines changed

6 files changed

+81
-10
lines changed

.cirrus.yml

+16
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,7 @@ task:
231231
script:
232232
- rm -rf bin/cache/pkg/tests
233233
- git clone https://github.com/flutter/tests.git bin/cache/pkg/tests
234+
- (cd bin/cache/pkg/tests; git checkout f1c35d57db5f0c1dd31ae3e0f73a18891343cd60)
234235
- dart --enable-asserts dev/customer_testing/run_tests.dart --skip-on-fetch-failure --skip-template bin/cache/pkg/tests/registry/*.test
235236

236237
# firebase_test_lab_tests are linux-only
@@ -347,6 +348,20 @@ task:
347348
CPU: 4
348349
MEMORY: 6G
349350

351+
- name: customer_testing-windows
352+
environment:
353+
# As of December 2019, the customer_testing-windows shard got faster with more CPUs up to 4
354+
# CPUs (which requires >=4G RAM), and needed at least 2G of RAM to not run out of memory.
355+
CPU: 4
356+
MEMORY: 4G
357+
script:
358+
- CMD /S /C "IF EXIST "bin\cache\pkg\tests\" RMDIR /S /Q bin\cache\pkg\tests"
359+
- git clone https://github.com/flutter/tests.git bin\cache\pkg\tests
360+
- cd bin\cache\pkg\tests
361+
- git checkout f1c35d57db5f0c1dd31ae3e0f73a18891343cd60
362+
- cd ..\..\..\..
363+
- dart --enable-asserts dev\customer_testing\run_tests.dart --skip-on-fetch-failure --skip-template bin/cache/pkg/tests/registry/*.test
364+
350365
# MACOS SHARDS
351366
# Mac doesn't use caches because they apparently take longer to populate and save
352367
# than just fetching the data in the first place.
@@ -473,6 +488,7 @@ task:
473488
- ulimit -S -n 2048 # https://github.com/flutter/flutter/issues/2976
474489
- rm -rf bin/cache/pkg/tests
475490
- git clone https://github.com/flutter/tests.git bin/cache/pkg/tests
491+
- (cd bin/cache/pkg/tests; git checkout f1c35d57db5f0c1dd31ae3e0f73a18891343cd60)
476492
- dart --enable-asserts dev/customer_testing/run_tests.dart --skip-on-fetch-failure --skip-template bin/cache/pkg/tests/registry/*.test
477493

478494
- name: deploy_gallery-macos # linux- and macos- only

bin/internal/engine.version

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
75bef9f6c8ac2ed4e1e04cdfcd88b177d9f1850d
1+
b8752bbfff0419c8bf616b602bc59fd28f6a3d1b

packages/flutter/lib/src/gestures/events.dart

+3-3
Original file line numberDiff line numberDiff line change
@@ -2228,9 +2228,9 @@ class PointerCancelEvent extends PointerEvent {
22282228
double computeHitSlop(PointerDeviceKind kind) {
22292229
switch (kind) {
22302230
case PointerDeviceKind.mouse:
2231+
return kPrecisePointerHitSlop;
22312232
case PointerDeviceKind.stylus:
22322233
case PointerDeviceKind.invertedStylus:
2233-
return kPrecisePointerHitSlop;
22342234
case PointerDeviceKind.unknown:
22352235
case PointerDeviceKind.touch:
22362236
return kTouchSlop;
@@ -2241,9 +2241,9 @@ double computeHitSlop(PointerDeviceKind kind) {
22412241
double computePanSlop(PointerDeviceKind kind) {
22422242
switch (kind) {
22432243
case PointerDeviceKind.mouse:
2244+
return kPrecisePointerPanSlop;
22442245
case PointerDeviceKind.stylus:
22452246
case PointerDeviceKind.invertedStylus:
2246-
return kPrecisePointerPanSlop;
22472247
case PointerDeviceKind.unknown:
22482248
case PointerDeviceKind.touch:
22492249
return kPanSlop;
@@ -2254,9 +2254,9 @@ double computePanSlop(PointerDeviceKind kind) {
22542254
double computeScaleSlop(PointerDeviceKind kind) {
22552255
switch (kind) {
22562256
case PointerDeviceKind.mouse:
2257+
return kPrecisePointerScaleSlop;
22572258
case PointerDeviceKind.stylus:
22582259
case PointerDeviceKind.invertedStylus:
2259-
return kPrecisePointerScaleSlop;
22602260
case PointerDeviceKind.unknown:
22612261
case PointerDeviceKind.touch:
22622262
return kScaleSlop;

packages/flutter/test/gestures/events_test.dart

+6-6
Original file line numberDiff line numberDiff line change
@@ -40,20 +40,20 @@ void main() {
4040

4141
test('computed hit slop values are based on pointer device kind', () {
4242
expect(computeHitSlop(PointerDeviceKind.mouse), kPrecisePointerHitSlop);
43-
expect(computeHitSlop(PointerDeviceKind.stylus), kPrecisePointerHitSlop);
44-
expect(computeHitSlop(PointerDeviceKind.invertedStylus), kPrecisePointerHitSlop);
43+
expect(computeHitSlop(PointerDeviceKind.stylus), kTouchSlop);
44+
expect(computeHitSlop(PointerDeviceKind.invertedStylus), kTouchSlop);
4545
expect(computeHitSlop(PointerDeviceKind.touch), kTouchSlop);
4646
expect(computeHitSlop(PointerDeviceKind.unknown), kTouchSlop);
4747

4848
expect(computePanSlop(PointerDeviceKind.mouse), kPrecisePointerPanSlop);
49-
expect(computePanSlop(PointerDeviceKind.stylus), kPrecisePointerPanSlop);
50-
expect(computePanSlop(PointerDeviceKind.invertedStylus), kPrecisePointerPanSlop);
49+
expect(computePanSlop(PointerDeviceKind.stylus), kPanSlop);
50+
expect(computePanSlop(PointerDeviceKind.invertedStylus), kPanSlop);
5151
expect(computePanSlop(PointerDeviceKind.touch), kPanSlop);
5252
expect(computePanSlop(PointerDeviceKind.unknown), kPanSlop);
5353

5454
expect(computeScaleSlop(PointerDeviceKind.mouse), kPrecisePointerScaleSlop);
55-
expect(computeScaleSlop(PointerDeviceKind.stylus), kPrecisePointerScaleSlop);
56-
expect(computeScaleSlop(PointerDeviceKind.invertedStylus), kPrecisePointerScaleSlop);
55+
expect(computeScaleSlop(PointerDeviceKind.stylus), kScaleSlop);
56+
expect(computeScaleSlop(PointerDeviceKind.invertedStylus), kScaleSlop);
5757
expect(computeScaleSlop(PointerDeviceKind.touch), kScaleSlop);
5858
expect(computeScaleSlop(PointerDeviceKind.unknown), kScaleSlop);
5959
});

packages/flutter_tools/lib/src/android/android_studio.dart

+23
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,29 @@ class AndroidStudio implements Comparable<AndroidStudio> {
260260
}
261261
}
262262
}
263+
// 4.1 has a different location for AndroidStudio installs on Windows.
264+
if (globals.platform.isWindows) {
265+
final File homeDot = globals.fs.file(globals.fs.path.join(
266+
globals.platform.environment['LOCALAPPDATA'],
267+
'Google',
268+
'AndroidStudio4.1',
269+
'.home',
270+
));
271+
if (homeDot.existsSync()) {
272+
final String installPath = homeDot.readAsStringSync();
273+
if (globals.fs.isDirectorySync(installPath)) {
274+
final AndroidStudio studio = AndroidStudio(
275+
installPath,
276+
version: Version(4, 1, 0),
277+
studioAppName: 'Android Studio 4.1',
278+
);
279+
if (studio != null && !_hasStudioAt(studio.directory, newerThan: studio.version)) {
280+
studios.removeWhere((AndroidStudio other) => other.directory == studio.directory);
281+
studios.add(studio);
282+
}
283+
}
284+
}
285+
}
263286

264287
final String configuredStudioDir = globals.config.getValue('android-studio-dir') as String;
265288
if (configuredStudioDir != null && !_hasStudioAt(configuredStudioDir)) {

packages/flutter_tools/test/general.shard/android/android_studio_test.dart

+32
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import 'package:file/memory.dart';
66
import 'package:flutter_tools/src/android/android_studio.dart';
77
import 'package:flutter_tools/src/base/file_system.dart';
88
import 'package:flutter_tools/src/base/platform.dart';
9+
import 'package:flutter_tools/src/base/version.dart';
910
import 'package:flutter_tools/src/globals.dart' as globals;
1011
import 'package:flutter_tools/src/ios/plist_parser.dart';
1112
import 'package:mockito/mockito.dart';
@@ -33,6 +34,13 @@ final Platform linuxPlatform = FakePlatform(
3334
environment: <String, String>{'HOME': homeLinux},
3435
);
3536

37+
final Platform windowsPlatform = FakePlatform(
38+
operatingSystem: 'windows',
39+
environment: <String, String>{
40+
'LOCALAPPDATA': 'C:\\Users\\Dash\\AppData\\Local',
41+
}
42+
);
43+
3644
class MockPlistUtils extends Mock implements PlistParser {}
3745

3846
Platform macPlatform() {
@@ -177,4 +185,28 @@ void main() {
177185
PlistParser: () => plistUtils,
178186
});
179187
});
188+
189+
FileSystem windowsFileSystem;
190+
191+
setUp(() {
192+
windowsFileSystem = MemoryFileSystem.test(style: FileSystemStyle.windows);
193+
});
194+
195+
testUsingContext('Can discover Android Studio 4.1 location on Windows', () {
196+
windowsFileSystem.file('C:\\Users\\Dash\\AppData\\Local\\Google\\AndroidStudio4.1\\.home')
197+
..createSync(recursive: true)
198+
..writeAsStringSync('C:\\Program Files\\AndroidStudio');
199+
windowsFileSystem
200+
.directory('C:\\Program Files\\AndroidStudio')
201+
.createSync(recursive: true);
202+
203+
final AndroidStudio studio = AndroidStudio.allInstalled().single;
204+
205+
expect(studio.version, Version(4, 1, 0));
206+
expect(studio.studioAppName, 'Android Studio 4.1');
207+
}, overrides: <Type, Generator>{
208+
Platform: () => windowsPlatform,
209+
FileSystem: () => windowsFileSystem,
210+
ProcessManager: () => FakeProcessManager.any(),
211+
});
180212
}

0 commit comments

Comments
 (0)