From 6d80f10bb36fa07f3eb26d8dd12f28dde7f1a7ba Mon Sep 17 00:00:00 2001 From: Tyler Wear Date: Wed, 9 Feb 2022 16:25:14 -0800 Subject: [PATCH] Add ThrowableBiConsumer to BpfCoordinatorShim Change-Id: Iecf001ac6d9f53a64f903f5b8ab069d6be93f50a --- .../tethering/apishim/api30/BpfCoordinatorShimImpl.java | 5 ++--- .../tethering/apishim/api31/BpfCoordinatorShimImpl.java | 4 ++-- .../tethering/apishim/common/BpfCoordinatorShim.java | 5 ++--- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/Tethering/apishim/30/com/android/networkstack/tethering/apishim/api30/BpfCoordinatorShimImpl.java b/Tethering/apishim/30/com/android/networkstack/tethering/apishim/api30/BpfCoordinatorShimImpl.java index 26040a2887..22d2c5d2f5 100644 --- a/Tethering/apishim/30/com/android/networkstack/tethering/apishim/api30/BpfCoordinatorShimImpl.java +++ b/Tethering/apishim/30/com/android/networkstack/tethering/apishim/api30/BpfCoordinatorShimImpl.java @@ -27,14 +27,13 @@ import android.util.SparseArray; import androidx.annotation.NonNull; import androidx.annotation.Nullable; +import com.android.net.module.util.IBpfMap.ThrowingBiConsumer; import com.android.net.module.util.bpf.Tether4Key; import com.android.net.module.util.bpf.Tether4Value; import com.android.networkstack.tethering.BpfCoordinator.Dependencies; import com.android.networkstack.tethering.BpfCoordinator.Ipv6ForwardingRule; import com.android.networkstack.tethering.TetherStatsValue; -import java.util.function.BiConsumer; - /** * Bpf coordinator class for API shims. */ @@ -164,7 +163,7 @@ public class BpfCoordinatorShimImpl @Override public void tetherOffloadRuleForEach(boolean downstream, - @NonNull BiConsumer action) { + @NonNull ThrowingBiConsumer action) { /* no op */ } diff --git a/Tethering/apishim/31/com/android/networkstack/tethering/apishim/api31/BpfCoordinatorShimImpl.java b/Tethering/apishim/31/com/android/networkstack/tethering/apishim/api31/BpfCoordinatorShimImpl.java index e3b1539ff9..5afb862295 100644 --- a/Tethering/apishim/31/com/android/networkstack/tethering/apishim/api31/BpfCoordinatorShimImpl.java +++ b/Tethering/apishim/31/com/android/networkstack/tethering/apishim/api31/BpfCoordinatorShimImpl.java @@ -30,6 +30,7 @@ import androidx.annotation.NonNull; import androidx.annotation.Nullable; import com.android.net.module.util.BpfMap; +import com.android.net.module.util.IBpfMap.ThrowingBiConsumer; import com.android.net.module.util.bpf.Tether4Key; import com.android.net.module.util.bpf.Tether4Value; import com.android.networkstack.tethering.BpfCoordinator.Dependencies; @@ -47,7 +48,6 @@ import com.android.networkstack.tethering.TetherUpstream6Key; import java.io.FileDescriptor; import java.io.IOException; -import java.util.function.BiConsumer; /** * Bpf coordinator class for API shims. @@ -410,7 +410,7 @@ public class BpfCoordinatorShimImpl @Override public void tetherOffloadRuleForEach(boolean downstream, - @NonNull BiConsumer action) { + @NonNull ThrowingBiConsumer action) { if (!isInitialized()) return; try { diff --git a/Tethering/apishim/common/com/android/networkstack/tethering/apishim/common/BpfCoordinatorShim.java b/Tethering/apishim/common/com/android/networkstack/tethering/apishim/common/BpfCoordinatorShim.java index d66396849c..915e210d45 100644 --- a/Tethering/apishim/common/com/android/networkstack/tethering/apishim/common/BpfCoordinatorShim.java +++ b/Tethering/apishim/common/com/android/networkstack/tethering/apishim/common/BpfCoordinatorShim.java @@ -22,14 +22,13 @@ import android.util.SparseArray; import androidx.annotation.NonNull; import androidx.annotation.Nullable; +import com.android.net.module.util.IBpfMap.ThrowingBiConsumer; import com.android.net.module.util.bpf.Tether4Key; import com.android.net.module.util.bpf.Tether4Value; import com.android.networkstack.tethering.BpfCoordinator.Dependencies; import com.android.networkstack.tethering.BpfCoordinator.Ipv6ForwardingRule; import com.android.networkstack.tethering.TetherStatsValue; -import java.util.function.BiConsumer; - /** * Bpf coordinator class for API shims. */ @@ -163,7 +162,7 @@ public abstract class BpfCoordinatorShim { */ @Nullable public abstract void tetherOffloadRuleForEach(boolean downstream, - @NonNull BiConsumer action); + @NonNull ThrowingBiConsumer action); /** * Whether there is currently any IPv4 rule on the specified upstream.