Unverified Commit 37042fdb authored by Jonah Williams's avatar Jonah Williams Committed by GitHub

[flutter_tools] remove iOS screenshot on failure functionality (#68650)

* [flutter_tools] remove iOS screenshot on failure functionality

* remove all screenshot code
parent 24d39997
...@@ -282,7 +282,6 @@ Future<Process> startProcess( ...@@ -282,7 +282,6 @@ Future<Process> startProcess(
+ (environment != null ? ' with environment $environment' : '')); + (environment != null ? ' with environment $environment' : ''));
final Map<String, String> newEnvironment = Map<String, String>.from(environment ?? <String, String>{}); final Map<String, String> newEnvironment = Map<String, String>.from(environment ?? <String, String>{});
newEnvironment['BOT'] = isBot ? 'true' : 'false'; newEnvironment['BOT'] = isBot ? 'true' : 'false';
newEnvironment['FLUTTER_IOS_SCREENSHOT_ON_CONNECTION_FAILURE'] = 'true';
final Process process = await _processManager.start( final Process process = await _processManager.start(
<String>[executable, ...arguments], <String>[executable, ...arguments],
environment: newEnvironment, environment: newEnvironment,
......
...@@ -11,7 +11,6 @@ import 'package:vm_service/vm_service.dart' as vm_service; ...@@ -11,7 +11,6 @@ import 'package:vm_service/vm_service.dart' as vm_service;
import '../application_package.dart'; import '../application_package.dart';
import '../base/common.dart'; import '../base/common.dart';
import '../base/error_handling_io.dart';
import '../base/file_system.dart'; import '../base/file_system.dart';
import '../base/io.dart'; import '../base/io.dart';
import '../base/logger.dart'; import '../base/logger.dart';
...@@ -440,7 +439,6 @@ class IOSDevice extends Device { ...@@ -440,7 +439,6 @@ class IOSDevice extends Device {
installationResult = await iosDeployDebugger.launchAndAttach() ? 0 : 1; installationResult = await iosDeployDebugger.launchAndAttach() ? 0 : 1;
} }
if (installationResult != 0) { if (installationResult != 0) {
await _screenshotOnFailure();
_logger.printError('Could not run ${bundle.path} on $id.'); _logger.printError('Could not run ${bundle.path} on $id.');
_logger.printError('Try launching Xcode and selecting "Product > Run" to fix the problem:'); _logger.printError('Try launching Xcode and selecting "Product > Run" to fix the problem:');
_logger.printError(' open ios/Runner.xcworkspace'); _logger.printError(' open ios/Runner.xcworkspace');
...@@ -470,7 +468,6 @@ class IOSDevice extends Device { ...@@ -470,7 +468,6 @@ class IOSDevice extends Device {
packageName: FlutterProject.current().manifest.appName, packageName: FlutterProject.current().manifest.appName,
); );
if (localUri == null) { if (localUri == null) {
await _screenshotOnFailure();
iosDeployDebugger?.detach(); iosDeployDebugger?.detach();
return LaunchResult.failed(); return LaunchResult.failed();
} }
...@@ -559,23 +556,6 @@ class IOSDevice extends Device { ...@@ -559,23 +556,6 @@ class IOSDevice extends Device {
}); });
await _portForwarder?.dispose(); await _portForwarder?.dispose();
} }
Future<void> _screenshotOnFailure() async {
final bool screenshotOnConnectionFailure = _platform
.environment['FLUTTER_IOS_SCREENSHOT_ON_CONNECTION_FAILURE'] == 'true';
if (!screenshotOnConnectionFailure) {
return;
}
final File file = _fileSystem.file('test_screenshot.png');
try {
await takeScreenshot(file);
_logger.printStatus('BASE64 SCREENSHOT:${base64.encode(file.readAsBytesSync())}');
} on Exception {
_logger.printError('Failed to take screenshot');
} finally {
ErrorHandlingFileSystem.deleteIfExists(file);
}
}
} }
/// Decodes a vis-encoded syslog string to a UTF-8 representation. /// Decodes a vis-encoded syslog string to a UTF-8 representation.
......
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// @dart = 2.9
import 'dart:convert';
import 'dart:io';
/// decodes a base64 screenshot stored in the devicelab.
///
/// Usage dart tool/screenshot_decoder.dart path/to/log_file
void main(List<String> arguments) {
int screenshot = 0;
final String logFile = arguments.first;
for (final String line in File(logFile).readAsLinesSync()) {
if (!line.contains('BASE64 SCREENSHOT:')) {
continue;
}
final String message = line.split('BASE64 SCREENSHOT:')[1];
final List<int> bytes = base64.decode(message);
File('flutter_screenshot_$screenshot.png').writeAsBytesSync(bytes);
screenshot += 1;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment