[kernel_panic] Thank you for your service.
Test: CQ
Issue: CF-445
Change-Id: Ic3d516dda96bc832f17b2fe3e31ef34a9739261b
diff --git a/packages/prod/sysui b/packages/prod/sysui
index 787f0b4..c9bf2c3 100644
--- a/packages/prod/sysui
+++ b/packages/prod/sysui
@@ -6,7 +6,6 @@
"packages": [
"//topaz/bin/session_shell/capybara_session_shell",
"//topaz/bin/session_shell/ermine_session_shell:ermine",
- "//topaz/bin/ermine_ctl:ermine_ctl",
- "//topaz/shell/kernel_panic"
+ "//topaz/bin/ermine_ctl:ermine_ctl"
]
}
diff --git a/shell/kernel_panic/BUILD.gn b/shell/kernel_panic/BUILD.gn
deleted file mode 100644
index 8bb9af2..0000000
--- a/shell/kernel_panic/BUILD.gn
+++ /dev/null
@@ -1,33 +0,0 @@
-# Copyright 2017 The Fuchsia Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-import("//topaz/runtime/flutter_runner/flutter_app.gni")
-
-flutter_app("kernel_panic") {
-
- main_dart = "lib/main.dart"
-
- package_name = "kernel_panic"
-
- manifest = "pubspec.yaml"
-
- meta = [
- {
- path = rebase_path("meta/kernel_panic.cmx")
- dest = "kernel_panic.cmx"
- },
- ]
-
- sources = [
- "kernel_panic.dart",
- "qr_code_widget.dart",
- ]
-
- deps = [
- "//third_party/dart-pkg/git/flutter/packages/flutter",
- "//topaz/public/dart/widgets:lib.widgets",
- "//topaz/public/lib/app/dart",
- "//topaz/shell/third_party/QR-Code-generator/dart/qrcodegen",
- ]
-}
diff --git a/shell/kernel_panic/analysis_options.yaml b/shell/kernel_panic/analysis_options.yaml
deleted file mode 100644
index 4adf677..0000000
--- a/shell/kernel_panic/analysis_options.yaml
+++ /dev/null
@@ -1,5 +0,0 @@
-# Copyright 2017 The Fuchsia Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-include: ../../../topaz/shell/analysis_options.yaml
diff --git a/shell/kernel_panic/lib/kernel_panic.dart b/shell/kernel_panic/lib/kernel_panic.dart
deleted file mode 100644
index fa16e5d..0000000
--- a/shell/kernel_panic/lib/kernel_panic.dart
+++ /dev/null
@@ -1,100 +0,0 @@
-// Copyright 2017 The Fuchsia Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-import 'package:flutter/material.dart';
-import 'package:intl/intl.dart';
-import 'package:meta/meta.dart';
-
-import 'qr_code_widget.dart';
-
-const Color _kFuchsiaColor = const Color(0xFFFF0080);
-
-final String _kBootTimeStamp = new DateFormat('MM.dd h:mm aaa', 'en_US')
- .format(new DateTime.now())
- .toLowerCase();
-
-/// Displays a kernel panic log.
-class KernelPanic extends StatelessWidget {
- /// The kernel panic info.
- final String kernelPanic;
-
- /// Called when the kernel panic is dismissed.
- final VoidCallback onDismiss;
-
- /// Constructor.
- const KernelPanic({@required this.kernelPanic, Key key, this.onDismiss})
- : super(key: key);
-
- @override
- Widget build(BuildContext context) => new GestureDetector(
- onTap: onDismiss,
- child: new Container(
- color: _kFuchsiaColor,
- child: new LayoutBuilder(
- builder: (BuildContext context, BoxConstraints constraints) =>
- _adaptiveFlexibleList(
- constraints: constraints,
- children: <Widget>[
- new Expanded(
- flex: 1,
- child: new Align(
- alignment: FractionalOffset.topLeft,
- child: new Container(
- padding: const EdgeInsets.all(16.0),
- child: new ListView(
- children: <Widget>[
- new Text(
- 'Panic occurred at $_kBootTimeStamp',
- style: const TextStyle(
- color: Colors.white,
- fontFamily: 'RobotoMono',
- fontWeight: FontWeight.w500,
- ),
- ),
- const Divider(color: Colors.white),
- const Text(
- 'Tap anywhere to dismiss.',
- style: const TextStyle(
- color: Colors.white,
- fontFamily: 'RobotoMono',
- fontWeight: FontWeight.w500,
- ),
- ),
- const Divider(color: Colors.white),
- new Text(
- kernelPanic,
- style: const TextStyle(
- color: Colors.white,
- fontFamily: 'RobotoMono',
- fontWeight: FontWeight.w500,
- ),
- ),
- ],
- ),
- ),
- ),
- ),
- new Expanded(
- flex: 1,
- child: new Center(
- child: new Container(
- margin: const EdgeInsets.all(16.0),
- child: new QrCodeWidget(kernelPanic),
- ),
- ),
- ),
- ],
- ),
- ),
- ),
- );
-
- Widget _adaptiveFlexibleList({
- BoxConstraints constraints,
- List<Widget> children,
- }) =>
- (constraints.maxWidth > constraints.maxHeight)
- ? new Row(children: children)
- : new Column(children: children);
-}
diff --git a/shell/kernel_panic/lib/main.dart b/shell/kernel_panic/lib/main.dart
deleted file mode 100644
index 23276f4..0000000
--- a/shell/kernel_panic/lib/main.dart
+++ /dev/null
@@ -1,58 +0,0 @@
-// Copyright 2017 The Fuchsia Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-import 'dart:async';
-import 'dart:io';
-
-import 'package:flutter/widgets.dart';
-
-import 'kernel_panic.dart';
-
-Future<Null> main() async {
- runApp(
- new Directionality(
- textDirection: TextDirection.ltr,
- child: new _KernelPanicReader(),
- ),
- );
-}
-
-class _KernelPanicReader extends StatefulWidget {
- @override
- _KernelPanicReaderState createState() => new _KernelPanicReaderState();
-}
-
-class _KernelPanicReaderState extends State<_KernelPanicReader> {
- String _lastPanicString = '';
-
- @override
- void initState() {
- super.initState();
-
- File lastPanic = new File('/boot/log/last-panic.txt');
- if (lastPanic.existsSync()) {
- lastPanic.readAsString().then((String lastPanicString) {
- if (lastPanicString.isEmpty) {
- exit(0);
- } else {
- setState(
- () {
- _lastPanicString = lastPanicString;
- },
- );
- }
- });
- } else {
- exit(0);
- }
- }
-
- @override
- Widget build(BuildContext context) => _lastPanicString.isEmpty
- ? new Container()
- : new KernelPanic(
- kernelPanic: _lastPanicString,
- onDismiss: () => exit(0),
- );
-}
diff --git a/shell/kernel_panic/lib/qr_code_widget.dart b/shell/kernel_panic/lib/qr_code_widget.dart
deleted file mode 100644
index 46a3e40..0000000
--- a/shell/kernel_panic/lib/qr_code_widget.dart
+++ /dev/null
@@ -1,260 +0,0 @@
-// Copyright 2017 The Fuchsia Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-import 'dart:async';
-import 'dart:math' as math;
-
-import 'package:flutter/material.dart';
-import 'package:qrcodegen/qrcodegen.dart';
-
-const double _kSmoothingThreshold = 2.0;
-
-/// Displays a QR Code.
-class QrCodeWidget extends StatefulWidget {
- /// The QR code for the kernel panic info.
- final QrCode qrCode;
-
- /// Encodes [text] into a QR Code image.
- QrCodeWidget(String text) : qrCode = new QrCode.encodeText(text, EccEnum.low);
-
- @override
- _QrCodeWidgetState createState() => new _QrCodeWidgetState();
-}
-
-class _QrCodeWidgetState extends State<QrCodeWidget> {
- double _lastPixelRatio;
- bool _smooth = false;
- Timer _timer;
-
- @override
- void dispose() {
- super.dispose();
- _timer?.cancel();
- }
-
- @override
- Widget build(BuildContext context) => new Material(
- color: Colors.white,
- elevation: 4.0,
- borderRadius: new BorderRadius.circular(4.0),
- child: new Container(
- child: new LayoutBuilder(
- builder: (BuildContext context, BoxConstraints constraints) {
- double pixelRatio = ((constraints.biggest.shortestSide) /
- (widget.qrCode.size + 4))
- .clamp(
- 0.0,
- 4.0,
- );
- if (_lastPixelRatio != pixelRatio) {
- _smooth = false;
- _timer?.cancel();
- _timer = null;
- if (pixelRatio >= _kSmoothingThreshold) {
- _timer = new Timer(const Duration(seconds: 3), () {
- if (mounted) {
- setState(() {
- _smooth = true;
- });
- }
- });
- }
- _lastPixelRatio = pixelRatio;
- }
-
- return new Container(
- margin: new EdgeInsets.all(pixelRatio * 2.0),
- width: widget.qrCode.size * pixelRatio,
- height: widget.qrCode.size * pixelRatio,
- child: new RepaintBoundary(
- child: new CustomPaint(
- painter: pixelRatio >= _kSmoothingThreshold && _smooth
- ? new _SmoothQrCodePainter(qrCode: widget.qrCode)
- : new _QrCodePainter(qrCode: widget.qrCode),
- ),
- ),
- );
- },
- ),
- ),
- );
-}
-
-class _QrCodePainter extends CustomPainter {
- final QrCode qrCode;
-
- _QrCodePainter({this.qrCode});
-
- @override
- void paint(Canvas canvas, Size size) {
- double pixelSize = size.shortestSide / qrCode.size;
- Paint blackPaint = new Paint()..color = Colors.black;
- for (int x = 0; x < qrCode.size; x++) {
- for (int y = 0; y < qrCode.size; y++) {
- if (qrCode.getModule(x, y) != 0) {
- canvas.drawRect(
- new Rect.fromLTWH(
- x * pixelSize,
- y * pixelSize,
- pixelSize,
- pixelSize,
- ),
- blackPaint,
- );
- }
- }
- }
- }
-
- @override
- bool shouldRepaint(_QrCodePainter oldDelegate) =>
- oldDelegate.qrCode != qrCode;
-
- @override
- bool hitTest(Offset position) => false;
-}
-
-class _SmoothQrCodePainter extends CustomPainter {
- final QrCode qrCode;
-
- _SmoothQrCodePainter({this.qrCode});
-
- @override
- void paint(Canvas canvas, Size size) {
- double pixelSize = size.shortestSide / qrCode.size;
- Paint blackPaint = new Paint()..color = Colors.black;
- for (int x = 0; x < qrCode.size; x++) {
- for (int y = 0; y < qrCode.size; y++) {
- bool isBlack = qrCode.getModule(x, y) != 0;
- bool leftIsBlack = qrCode.getModule(x - 1, y) != 0;
- bool rightIsBlack = qrCode.getModule(x + 1, y) != 0;
- bool aboveIsBlack = qrCode.getModule(x, y - 1) != 0;
- bool belowIsBlack = qrCode.getModule(x, y + 1) != 0;
-
- if (isBlack) {
- bool topLeftCurved = !aboveIsBlack && !leftIsBlack;
- bool bottomLeftCurved = !belowIsBlack && !leftIsBlack;
- bool topRightCurved = !aboveIsBlack && !rightIsBlack;
- bool bottomRightCurved = !belowIsBlack && !rightIsBlack;
- if (!topLeftCurved &&
- !bottomLeftCurved &&
- !topRightCurved &&
- !bottomRightCurved) {
- canvas.drawRect(
- new Rect.fromLTRB(
- x * pixelSize,
- y * pixelSize,
- (x + 1) * pixelSize,
- (y + 1) * pixelSize,
- ),
- blackPaint,
- );
- } else {
- RRect rrect = new RRect.fromLTRBAndCorners(
- x * pixelSize,
- y * pixelSize,
- (x + 1) * pixelSize,
- (y + 1) * pixelSize,
- topLeft:
- topLeftCurved ? new Radius.circular(pixelSize) : Radius.zero,
- topRight:
- topRightCurved ? new Radius.circular(pixelSize) : Radius.zero,
- bottomRight: bottomRightCurved
- ? new Radius.circular(pixelSize)
- : Radius.zero,
- bottomLeft: bottomLeftCurved
- ? new Radius.circular(pixelSize)
- : Radius.zero,
- );
- canvas.drawRRect(rrect, blackPaint);
- }
- } else {
- bool topLeftCurved = leftIsBlack &&
- aboveIsBlack &&
- qrCode.getModule(x - 1, y - 1) != 0;
- bool bottomLeftCurved = leftIsBlack &&
- belowIsBlack &&
- qrCode.getModule(x - 1, y + 1) != 0;
- bool topRightCurved = rightIsBlack &&
- aboveIsBlack &&
- qrCode.getModule(x + 1, y - 1) != 0;
- bool bottomRightCurved = rightIsBlack &&
- belowIsBlack &&
- qrCode.getModule(x + 1, y + 1) != 0;
- if (topLeftCurved) {
- canvas.drawPath(
- new Path()
- ..moveTo(x * pixelSize, (y + 0.5) * pixelSize)
- ..relativeLineTo(0.0, -(0.5 * pixelSize))
- //..relativeLineTo(0.5 * pixelSize, 0.0)
- ..arcTo(
- new Rect.fromLTRB(x * pixelSize, y * pixelSize,
- (x + 1) * pixelSize, (y + 1) * pixelSize),
- -math.pi / 2.0,
- -math.pi / 2.0,
- false,
- ),
- blackPaint,
- );
- }
- if (bottomLeftCurved) {
- canvas.drawPath(
- new Path()
- ..moveTo(x * pixelSize, (y + 0.5) * pixelSize)
- ..relativeLineTo(0.0, 0.5 * pixelSize)
- //..relativeLineTo(0.5 * pixelSize, 0.0)
- ..arcTo(
- new Rect.fromLTRB(x * pixelSize, y * pixelSize,
- (x + 1) * pixelSize, (y + 1) * pixelSize),
- math.pi / 2.0,
- math.pi / 2.0,
- false,
- ),
- blackPaint,
- );
- }
- if (topRightCurved) {
- canvas.drawPath(
- new Path()
- ..moveTo((x + 1) * pixelSize, (y + 0.5) * pixelSize)
- ..relativeLineTo(0.0, -(0.5 * pixelSize))
- //..relativeLineTo(0.5 * pixelSize, 0.0)
- ..arcTo(
- new Rect.fromLTRB(x * pixelSize, y * pixelSize,
- (x + 1) * pixelSize, (y + 1) * pixelSize),
- -math.pi / 2.0,
- math.pi / 2.0,
- false,
- ),
- blackPaint,
- );
- }
- if (bottomRightCurved) {
- canvas.drawPath(
- new Path()
- ..moveTo((x + 1) * pixelSize, (y + 0.5) * pixelSize)
- ..relativeLineTo(0.0, 0.5 * pixelSize)
- //..relativeLineTo(0.5 * pixelSize, 0.0)
- ..arcTo(
- new Rect.fromLTRB(x * pixelSize, y * pixelSize,
- (x + 1) * pixelSize, (y + 1) * pixelSize),
- math.pi / 2.0,
- -math.pi / 2.0,
- false,
- ),
- blackPaint,
- );
- }
- }
- }
- }
- }
-
- @override
- bool shouldRepaint(_SmoothQrCodePainter oldDelegate) =>
- oldDelegate.qrCode != qrCode;
-
- @override
- bool hitTest(Offset position) => false;
-}
diff --git a/shell/kernel_panic/meta/kernel_panic.cmx b/shell/kernel_panic/meta/kernel_panic.cmx
deleted file mode 100644
index 4b85cde..0000000
--- a/shell/kernel_panic/meta/kernel_panic.cmx
+++ /dev/null
@@ -1,22 +0,0 @@
-{
- "program": {
- "data": "data/kernel_panic"
- },
- "sandbox": {
- "services": [
- "fuchsia.cobalt.LoggerFactory",
- "fuchsia.fonts.Provider",
- "fuchsia.logger.LogSink",
- "fuchsia.modular.Clipboard",
- "fuchsia.modular.ContextWriter",
- "fuchsia.modular.ModuleContext",
- "fuchsia.netstack.Netstack",
- "fuchsia.sys.Environment",
- "fuchsia.ui.input.ImeService",
- "fuchsia.ui.policy.Presenter",
- "fuchsia.ui.scenic.Scenic",
- "fuchsia.ui.viewsv1.ViewManager",
- "fuchsia.wlan.service.Wlan"
- ]
- }
-}
\ No newline at end of file
diff --git a/shell/kernel_panic/pubspec.yaml b/shell/kernel_panic/pubspec.yaml
deleted file mode 100644
index 3a809f4..0000000
--- a/shell/kernel_panic/pubspec.yaml
+++ /dev/null
@@ -1,3 +0,0 @@
-# Copyright 2017 The Fuchsia Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.