diff --git a/bin/internal/engine.version b/bin/internal/engine.version index 306f07ea3b5..cd2c67f4787 100644 --- a/bin/internal/engine.version +++ b/bin/internal/engine.version @@ -1 +1 @@ -50f1b8d9ca29e2fe70cd9012c5e3bf6eff29ce91 +da96a8bddda72f14b02a0afda871d126dfebdb17 diff --git a/examples/layers/services/start_activity.dart b/examples/layers/services/start_activity.dart deleted file mode 100644 index 52c9307790a..00000000000 --- a/examples/layers/services/start_activity.dart +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2015 The Chromium 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/widgets.dart'; -import 'package:flutter/services.dart'; - -void main() { - runApp(new GestureDetector( - onTap: () { - Intent intent = new Intent() - ..action = 'android.intent.action.VIEW' - ..url = 'http://flutter.io/'; - activity.startActivity(intent); - }, - child: new Container( - decoration: const BoxDecoration( - backgroundColor: const Color(0xFF006600) - ), - child: new Center( - child: new Text('Tap to launch a URL!') - ) - ) - )); -} diff --git a/packages/flutter/lib/services.dart b/packages/flutter/lib/services.dart index fef2a94a287..31bdc040541 100644 --- a/packages/flutter/lib/services.dart +++ b/packages/flutter/lib/services.dart @@ -14,7 +14,6 @@ /// Flutter library. library services; -export 'src/services/activity.dart'; export 'src/services/asset_bundle.dart'; export 'src/services/binding.dart'; export 'src/services/clipboard.dart'; @@ -30,5 +29,6 @@ export 'src/services/path_provider.dart'; export 'src/services/platform_messages.dart'; export 'src/services/shell.dart'; export 'src/services/system_chrome.dart'; +export 'src/services/system_navigator.dart'; export 'src/services/system_sound.dart'; export 'src/services/url_launcher.dart'; diff --git a/packages/flutter/lib/src/services/activity.dart b/packages/flutter/lib/src/services/activity.dart deleted file mode 100644 index 338eccd2b9f..00000000000 --- a/packages/flutter/lib/src/services/activity.dart +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright 2015 The Chromium 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:ui'; - -import 'package:flutter_services/activity.dart'; - -import 'shell.dart'; - -export 'package:flutter_services/activity.dart' show Activity, Intent, ComponentName, StringExtra; - - -// Dart wrapper around Activity mojo service available in Flutter on Android. -// -// Most clients will want to use these methods instead of the activity service -// directly. - -// The constants below are from -// http://developer.android.com/reference/android/content/Intent.html - -/// Open a document into a new task rooted at the activity launched by -/// this Intent. -/// -/// See Android's Intent.FLAG_ACTIVITY_NEW_DOCUMENT. -const int NEW_DOCUMENT = 0x00080000; // ignore: constant_identifier_names - -/// Start a new task on this history stack. -/// -/// See Android's Intent.FLAG_ACTIVITY_NEW_TASK. -const int NEW_TASK = 0x10000000; // ignore: constant_identifier_names - -/// Create a new task and launch an activity into it. -/// -/// See Android's Intent.FLAG_ACTIVITY_MULTIPLE_TASK. -const int MULTIPLE_TASK = 0x08000000; // ignore: constant_identifier_names - -ActivityProxy _initActivityProxy() { - return shell.connectToApplicationService('mojo:android', Activity.connectToService); -} - -final ActivityProxy _activityProxy = _initActivityProxy(); - -/// A singleton for interacting with the current Android activity. -final Activity activity = _activityProxy; - -Color _cachedPrimaryColor; -String _cachedLabel; - -/// Sets the TaskDescription for the current Activity. -/// The color, if provided, must be opaque. -void updateTaskDescription({ String label, Color color }) { - assert(color == null || color.alpha == 0xFF); - if (_cachedPrimaryColor == color && _cachedLabel == label) - return; - - _cachedPrimaryColor = color; - _cachedLabel = label; - - TaskDescription description = new TaskDescription() - ..label = label - ..primaryColor = color?.value ?? 0; - - _activityProxy.setTaskDescription(description); -} diff --git a/packages/flutter/lib/src/services/haptic_feedback.dart b/packages/flutter/lib/src/services/haptic_feedback.dart index cd6c711a683..1498796caab 100644 --- a/packages/flutter/lib/src/services/haptic_feedback.dart +++ b/packages/flutter/lib/src/services/haptic_feedback.dart @@ -24,7 +24,7 @@ class HapticFeedback { static Future vibrate() async { await PlatformMessages.sendJSON('flutter/platform', { 'method': 'HapticFeedback.vibrate', - 'args': [], + 'args': const [], }); } } diff --git a/packages/flutter/lib/src/services/path_provider.dart b/packages/flutter/lib/src/services/path_provider.dart index 3bc0a2e1808..fba8134df9f 100644 --- a/packages/flutter/lib/src/services/path_provider.dart +++ b/packages/flutter/lib/src/services/path_provider.dart @@ -25,7 +25,7 @@ class PathProvider { Map result = await PlatformMessages.sendJSON('flutter/platform', { 'method': 'PathProvider.getTemporaryDirectory', - 'args': [], + 'args': const [], }); if (result == null) return null; @@ -44,7 +44,7 @@ class PathProvider { Map result = await PlatformMessages.sendJSON('flutter/platform', { 'method': 'PathProvider.getApplicationDocumentsDirectory', - 'args': [], + 'args': const [], }); if (result == null) return null; diff --git a/packages/flutter/lib/src/services/system_navigator.dart b/packages/flutter/lib/src/services/system_navigator.dart new file mode 100644 index 00000000000..3b5ff055389 --- /dev/null +++ b/packages/flutter/lib/src/services/system_navigator.dart @@ -0,0 +1,26 @@ +// Copyright 2016 The Chromium 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 'platform_messages.dart'; + +/// Controls specific aspects of the system navigation stack. +class SystemNavigator { + SystemNavigator._(); + + /// Instructs the system navigator to remove this activity from the stack and + /// return to the previous activity. + /// + /// Platform Specific Notes: + /// + /// On iOS, this is a no-op because Apple's human interface guidelines state + /// that applications should not exit themselves. + static Future pop() async { + await PlatformMessages.sendJSON('flutter/platform', { + 'method': 'SystemNavigator.pop', + 'args': const [], + }); + } +} diff --git a/packages/flutter/lib/src/widgets/binding.dart b/packages/flutter/lib/src/widgets/binding.dart index c20fe94065e..b493b10a65c 100644 --- a/packages/flutter/lib/src/widgets/binding.dart +++ b/packages/flutter/lib/src/widgets/binding.dart @@ -164,7 +164,7 @@ abstract class WidgetsBinding extends BindingBase implements GestureBinding, Ren if (observer.didPopRoute()) return; } - activity.finishCurrentActivity(); + SystemNavigator.pop(); } /// Called when the application lifecycle state changes. diff --git a/packages/flutter/lib/src/widgets/title.dart b/packages/flutter/lib/src/widgets/title.dart index 3f5ac1daba6..53e59bbd66b 100644 --- a/packages/flutter/lib/src/widgets/title.dart +++ b/packages/flutter/lib/src/widgets/title.dart @@ -28,7 +28,12 @@ class Title extends StatelessWidget { @override Widget build(BuildContext context) { - updateTaskDescription(label: title, color: color); + SystemChrome.setApplicationSwitcherDescription( + new ApplicationSwitcherDescription( + label: title, + primaryColor: color.value, + ) + ); return child; }