Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.

A partial revert of the work done to accomodate Android Background Channels #4453

Merged
merged 1 commit into from
Oct 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -197,10 +197,6 @@ task:
- export CIRRUS_CHANGE_MESSAGE=""
- export CIRRUS_COMMIT_MESSAGE=""
- ./script/tool_runner.sh lint-android # must come after build-examples
stable_channel_conditional_script:
- if [[ "$CHANNEL" == "stable" ]]; then
- dart ./ci/stable_conditional.dart
- fi
native_unit_test_script:
# Unsetting CIRRUS_CHANGE_MESSAGE and CIRRUS_COMMIT_MESSAGE as they
# might include non-ASCII characters which makes Gradle crash.
Expand Down
67 changes: 0 additions & 67 deletions ci/stable_conditional.dart

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,7 @@ public void startListening_registersChannel() {
methodCallHandler.startListening(messenger);

verify(messenger, times(1))
// FLUTTER_STABLE_CONDITIONAL_IF_NOT_STABLE
.setMessageHandler(eq(CHANNEL_NAME), any(BinaryMessageHandler.class), eq(null));
// FLUTTER_STABLE_CONDITIONAL_ELSE
// .setMessageHandler(eq(CHANNEL_NAME), any(BinaryMessageHandler.class));
// FLUTTER_STABLE_CONDITIONAL_ENDIF
.setMessageHandler(eq(CHANNEL_NAME), any(BinaryMessageHandler.class));
}

@Test
Expand All @@ -71,15 +67,9 @@ public void startListening_unregistersExistingChannel() {
methodCallHandler.startListening(secondMessenger);

// Unregisters the first and then registers the second.
// FLUTTER_STABLE_CONDITIONAL_IF_NOT_STABLE
verify(firstMessenger, times(1)).setMessageHandler(CHANNEL_NAME, null, null);
verify(firstMessenger, times(1)).setMessageHandler(CHANNEL_NAME, null);
verify(secondMessenger, times(1))
.setMessageHandler(eq(CHANNEL_NAME), any(BinaryMessageHandler.class), eq(null));
// FLUTTER_STABLE_CONDITIONAL_ELSE
// verify(firstMessenger, times(1)).setMessageHandler(CHANNEL_NAME, null);
// verify(secondMessenger, times(1))
// .setMessageHandler(eq(CHANNEL_NAME), any(BinaryMessageHandler.class));
// FLUTTER_STABLE_CONDITIONAL_ENDIF
.setMessageHandler(eq(CHANNEL_NAME), any(BinaryMessageHandler.class));
}

@Test
Expand All @@ -89,11 +79,7 @@ public void stopListening_unregistersExistingChannel() {

methodCallHandler.stopListening();

// FLUTTER_STABLE_CONDITIONAL_IF_NOT_STABLE
verify(messenger, times(1)).setMessageHandler(CHANNEL_NAME, null, null);
// FLUTTER_STABLE_CONDITIONAL_ELSE
// verify(messenger, times(1)).setMessageHandler(CHANNEL_NAME, null);
// FLUTTER_STABLE_CONDITIONAL_ENDIF
verify(messenger, times(1)).setMessageHandler(CHANNEL_NAME, null);
}

@Test
Expand All @@ -102,11 +88,7 @@ public void stopListening_doesNothingWhenUnset() {

methodCallHandler.stopListening();

// FLUTTER_STABLE_CONDITIONAL_IF_NOT_STABLE
verify(messenger, never()).setMessageHandler(CHANNEL_NAME, null, null);
// FLUTTER_STABLE_CONDITIONAL_ELSE
// verify(messenger, never()).setMessageHandler(CHANNEL_NAME, null);
// FLUTTER_STABLE_CONDITIONAL_ENDIF
verify(messenger, never()).setMessageHandler(CHANNEL_NAME, null);
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

import android.os.Handler;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import io.flutter.embedding.engine.systemchannels.PlatformChannel;
import io.flutter.plugin.common.BinaryMessenger;
import io.flutter.plugin.common.MethodCall;
Expand All @@ -32,15 +31,6 @@ public class DartMessengerTest {
private static class FakeBinaryMessenger implements BinaryMessenger {
private final List<ByteBuffer> sentMessages = new ArrayList<>();

// TODO(aaclarke): Remove when https://github.com/flutter/engine/pull/29147 is on stable.
// FLUTTER_STABLE_CONDITIONAL_IF_NOT_STABLE
@Override
public BinaryMessenger.TaskQueue makeBackgroundTaskQueue() {
return null;
}
// FLUTTER_STABLE_CONDITIONAL_ELSE
// FLUTTER_STABLE_CONDITIONAL_ENDIF

@Override
public void send(@NonNull String channel, ByteBuffer message) {
sentMessages.add(message);
Expand All @@ -51,17 +41,8 @@ public void send(@NonNull String channel, ByteBuffer message, BinaryReply callba
send(channel, message);
}

// TODO(aaclarke): Remove when https://github.com/flutter/engine/pull/29147 is on stable.
// FLUTTER_STABLE_CONDITIONAL_IF_NOT_STABLE
@Override
public void setMessageHandler(
@NonNull String channel,
BinaryMessageHandler handler,
@Nullable BinaryMessenger.TaskQueue taskQueue) {}
// FLUTTER_STABLE_CONDITIONAL_ELSE
// @Override
// public void setMessageHandler(@NonNull String channel, BinaryMessageHandler handler) {}
// FLUTTER_STABLE_CONDITIONAL_ENDIF
public void setMessageHandler(@NonNull String channel, BinaryMessageHandler handler) {}

List<ByteBuffer> getMessages() {
return new ArrayList<>(sentMessages);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,6 @@ public class QuickActionsTest {
private static class TestBinaryMessenger implements BinaryMessenger {
public MethodCall lastMethodCall;

// TODO(aaclarke): Remove when https://github.com/flutter/engine/pull/29147 is on stable.
// FLUTTER_STABLE_CONDITIONAL_IF_NOT_STABLE
@Override
public BinaryMessenger.TaskQueue makeBackgroundTaskQueue() {
return null;
}
// FLUTTER_STABLE_CONDITIONAL_ELSE
// FLUTTER_STABLE_CONDITIONAL_ENDIF

@Override
public void send(@NonNull String channel, @Nullable ByteBuffer message) {
send(channel, message, null);
Expand All @@ -58,21 +49,10 @@ public void send(
}
}

// TODO(aaclarke): Remove when https://github.com/flutter/engine/pull/29147 is on stable.
// FLUTTER_STABLE_CONDITIONAL_IF_NOT_STABLE
@Override
public void setMessageHandler(
@NonNull String channel,
@Nullable BinaryMessageHandler handler,
@Nullable BinaryMessenger.TaskQueue taskQueue) {
public void setMessageHandler(@NonNull String channel, @Nullable BinaryMessageHandler handler) {
// Do nothing.
}
// FLUTTER_STABLE_CONDITIONAL_ELSE
// @Override
// public void setMessageHandler(
// @NonNull String channel,
// @Nullable BinaryMessageHandler handler) {}
// FLUTTER_STABLE_CONDITIONAL_ENDIF
}

static final int SUPPORTED_BUILD = 25;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,7 @@ public void startListening_registersChannel() {
methodCallHandler.startListening(messenger);

verify(messenger, times(1))
// FLUTTER_STABLE_CONDITIONAL_IF_NOT_STABLE
.setMessageHandler(eq(CHANNEL_NAME), any(BinaryMessageHandler.class), eq(null));
// FLUTTER_STABLE_CONDITIONAL_ELSE
// .setMessageHandler(eq(CHANNEL_NAME), any(BinaryMessageHandler.class));
// FLUTTER_STABLE_CONDITIONAL_ENDIF
.setMessageHandler(eq(CHANNEL_NAME), any(BinaryMessageHandler.class));
}

@Test
Expand All @@ -60,15 +56,9 @@ public void startListening_unregistersExistingChannel() {
methodCallHandler.startListening(secondMessenger);

// Unregisters the first and then registers the second.
// FLUTTER_STABLE_CONDITIONAL_IF_NOT_STABLE
verify(firstMessenger, times(1)).setMessageHandler(CHANNEL_NAME, null, null);
verify(firstMessenger, times(1)).setMessageHandler(CHANNEL_NAME, null);
verify(secondMessenger, times(1))
.setMessageHandler(eq(CHANNEL_NAME), any(BinaryMessageHandler.class), eq(null));
// FLUTTER_STABLE_CONDITIONAL_ELSE
// verify(firstMessenger, times(1)).setMessageHandler(CHANNEL_NAME, null);
// verify(secondMessenger, times(1))
// .setMessageHandler(eq(CHANNEL_NAME), any(BinaryMessageHandler.class));
// FLUTTER_STABLE_CONDITIONAL_ENDIF
.setMessageHandler(eq(CHANNEL_NAME), any(BinaryMessageHandler.class));
}

@Test
Expand All @@ -78,11 +68,7 @@ public void stopListening_unregistersExistingChannel() {

methodCallHandler.stopListening();

// FLUTTER_STABLE_CONDITIONAL_IF_NOT_STABLE
verify(messenger, times(1)).setMessageHandler(CHANNEL_NAME, null, null);
// FLUTTER_STABLE_CONDITIONAL_ELSE
// verify(messenger, times(1)).setMessageHandler(CHANNEL_NAME, null);
// FLUTTER_STABLE_CONDITIONAL_ENDIF
verify(messenger, times(1)).setMessageHandler(CHANNEL_NAME, null);
}

@Test
Expand All @@ -91,11 +77,7 @@ public void stopListening_doesNothingWhenUnset() {

methodCallHandler.stopListening();

// FLUTTER_STABLE_CONDITIONAL_IF_NOT_STABLE
verify(messenger, never()).setMessageHandler(CHANNEL_NAME, null, null);
// FLUTTER_STABLE_CONDITIONAL_ELSE
// verify(messenger, never()).setMessageHandler(CHANNEL_NAME, null);
// FLUTTER_STABLE_CONDITIONAL_ENDIF
verify(messenger, never()).setMessageHandler(CHANNEL_NAME, null);
}

@Test
Expand Down