Remove use of activity.mojom (#6317)
Instead, we now interact with the system navigator via SystemNavigator.
diff --git a/bin/internal/engine.version b/bin/internal/engine.version
index 306f07e..cd2c67f 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 52c9307..0000000
--- 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 fef2a94..31bdc04 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/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 338eccd..0000000
--- 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 cd6c711..1498796 100644
--- a/packages/flutter/lib/src/services/haptic_feedback.dart
+++ b/packages/flutter/lib/src/services/haptic_feedback.dart
@@ -24,7 +24,7 @@
static Future<Null> vibrate() async {
await PlatformMessages.sendJSON('flutter/platform', <String, dynamic>{
'method': 'HapticFeedback.vibrate',
- 'args': <Null>[],
+ 'args': const <Null>[],
});
}
}
diff --git a/packages/flutter/lib/src/services/path_provider.dart b/packages/flutter/lib/src/services/path_provider.dart
index 3bc0a2e..fba8134 100644
--- a/packages/flutter/lib/src/services/path_provider.dart
+++ b/packages/flutter/lib/src/services/path_provider.dart
@@ -25,7 +25,7 @@
Map<String, dynamic> result =
await PlatformMessages.sendJSON('flutter/platform', <String, dynamic>{
'method': 'PathProvider.getTemporaryDirectory',
- 'args': <Null>[],
+ 'args': const <Null>[],
});
if (result == null)
return null;
@@ -44,7 +44,7 @@
Map<String, dynamic> result =
await PlatformMessages.sendJSON('flutter/platform', <String, dynamic>{
'method': 'PathProvider.getApplicationDocumentsDirectory',
- 'args': <Null>[],
+ 'args': const <Null>[],
});
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 0000000..3b5ff05
--- /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<Null> pop() async {
+ await PlatformMessages.sendJSON('flutter/platform', <String, dynamic>{
+ 'method': 'SystemNavigator.pop',
+ 'args': const <Null>[],
+ });
+ }
+}
diff --git a/packages/flutter/lib/src/widgets/binding.dart b/packages/flutter/lib/src/widgets/binding.dart
index c20fe94..b493b10 100644
--- a/packages/flutter/lib/src/widgets/binding.dart
+++ b/packages/flutter/lib/src/widgets/binding.dart
@@ -164,7 +164,7 @@
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 3f5ac1d..53e59bb 100644
--- a/packages/flutter/lib/src/widgets/title.dart
+++ b/packages/flutter/lib/src/widgets/title.dart
@@ -28,7 +28,12 @@
@override
Widget build(BuildContext context) {
- updateTaskDescription(label: title, color: color);
+ SystemChrome.setApplicationSwitcherDescription(
+ new ApplicationSwitcherDescription(
+ label: title,
+ primaryColor: color.value,
+ )
+ );
return child;
}