Skip to content

Commit

Permalink
Remove obsolete discovery mechanism from FlutterView (flutter#6157)
Browse files Browse the repository at this point in the history
  • Loading branch information
jason-simmons authored Sep 5, 2018
1 parent b22badf commit 6af60d7
Showing 1 changed file with 0 additions and 39 deletions.
39 changes: 0 additions & 39 deletions shell/platform/android/io/flutter/view/FlutterView.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -96,7 +94,6 @@ static final class ViewportMetrics {
private final BasicMessageChannel<String> mFlutterLifecycleChannel;
private final BasicMessageChannel<Object> mFlutterSystemChannel;
private final BasicMessageChannel<Object> mFlutterSettingsChannel;
private final BroadcastReceiver mDiscoveryReceiver;
private final List<ActivityLifecycleListener> mActivityLifecycleListeners;
private final List<FirstFrameListener> mFirstFrameListeners;
private final AtomicLong nextTextureId = new AtomicLong(0L);
Expand Down Expand Up @@ -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<String, Object> message) {
Expand Down Expand Up @@ -332,9 +322,6 @@ float getDevicePixelRatio() {
public FlutterNativeView detach() {
if (!isAttached())
return null;
if (mDiscoveryReceiver != null) {
getContext().unregisterReceiver(mDiscoveryReceiver);
}
getHolder().removeCallback(mSurfaceCallback);
mNativeView.detach();

Expand All @@ -347,10 +334,6 @@ public void destroy() {
if (!isAttached())
return;

if (mDiscoveryReceiver != null) {
getContext().unregisterReceiver(mDiscoveryReceiver);
}

getHolder().removeCallback(mSurfaceCallback);

mNativeView.destroy();
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit 6af60d7

Please sign in to comment.