diff --git a/shell/platform/android/io/flutter/view/FlutterView.java b/shell/platform/android/io/flutter/view/FlutterView.java index 33c8c834742be..b72643e3f3ce7 100644 --- a/shell/platform/android/io/flutter/view/FlutterView.java +++ b/shell/platform/android/io/flutter/view/FlutterView.java @@ -69,8 +69,6 @@ public interface Provider { private static final String TAG = "FlutterView"; - private static final String ACTION_DISCOVER = "io.flutter.view.DISCOVER"; - static final class ViewportMetrics { float devicePixelRatio = 1.0f; int physicalWidth = 0; @@ -96,7 +94,6 @@ static final class ViewportMetrics { private final BasicMessageChannel mFlutterLifecycleChannel; private final BasicMessageChannel mFlutterSystemChannel; private final BasicMessageChannel mFlutterSettingsChannel; - private final BroadcastReceiver mDiscoveryReceiver; private final List mActivityLifecycleListeners; private final List mFirstFrameListeners; private final AtomicLong nextTextureId = new AtomicLong(0L); @@ -183,13 +180,6 @@ public void surfaceDestroyed(SurfaceHolder holder) { setLocale(getResources().getConfiguration().locale); setUserSettings(); - - if ((context.getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0) { - mDiscoveryReceiver = new DiscoveryReceiver(); - context.registerReceiver(mDiscoveryReceiver, new IntentFilter(ACTION_DISCOVER)); - } else { - mDiscoveryReceiver = null; - } } private void encodeKeyEvent(KeyEvent event, Map message) { @@ -332,9 +322,6 @@ float getDevicePixelRatio() { public FlutterNativeView detach() { if (!isAttached()) return null; - if (mDiscoveryReceiver != null) { - getContext().unregisterReceiver(mDiscoveryReceiver); - } getHolder().removeCallback(mSurfaceCallback); mNativeView.detach(); @@ -347,10 +334,6 @@ public void destroy() { if (!isAttached()) return; - if (mDiscoveryReceiver != null) { - getContext().unregisterReceiver(mDiscoveryReceiver); - } - getHolder().removeCallback(mSurfaceCallback); mNativeView.destroy(); @@ -946,28 +929,6 @@ public void setMessageHandler(String channel, BinaryMessageHandler handler) { mNativeView.setMessageHandler(channel, handler); } - /** - * Broadcast receiver used to discover active Flutter instances. - * - * This is used by the `flutter` tool to find the observatory ports for all the - * active Flutter views. We dump the data to the logs and the tool scrapes the - * log lines for the data. - */ - private class DiscoveryReceiver extends BroadcastReceiver { - @Override - public void onReceive(Context context, Intent intent) { - URI observatoryUri = URI.create(FlutterNativeView.getObservatoryUri()); - JSONObject discover = new JSONObject(); - try { - discover.put("id", getContext().getPackageName()); - discover.put("observatoryPort", observatoryUri.getPort()); - Log.i(TAG, "DISCOVER: " + discover); // The tool looks for this data. See - // android_device.dart. - } catch (JSONException e) { - } - } - } - /** * Listener will be called on the Android UI thread once when Flutter renders * the first frame.