Merge "Check null NetworkSpecifier before redacting" am: 435c4f7fc5

Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1747893

Change-Id: Id055ea401aefe3f8500e3f78d059a5fa187659fc
This commit is contained in:
Junyu Lai
2021-06-25 15:41:35 +00:00
committed by Automerger Merge Worker

View File

@@ -536,8 +536,10 @@ public class ConnectivityManagerTest {
Objects.requireNonNull(mCm.getNetworkCapabilities(network)); Objects.requireNonNull(mCm.getNetworkCapabilities(network));
// Redact specifier of the capabilities of the snapshot before comparing since // Redact specifier of the capabilities of the snapshot before comparing since
// the result returned from getNetworkCapabilities always get redacted. // the result returned from getNetworkCapabilities always get redacted.
final NetworkSpecifier snapshotCapSpecifier =
snapshot.getNetworkCapabilities().getNetworkSpecifier();
final NetworkSpecifier redactedSnapshotCapSpecifier = final NetworkSpecifier redactedSnapshotCapSpecifier =
snapshot.getNetworkCapabilities().getNetworkSpecifier().redact(); snapshotCapSpecifier == null ? null : snapshotCapSpecifier.redact();
assertEquals("", caps.describeImmutableDifferences( assertEquals("", caps.describeImmutableDifferences(
snapshot.getNetworkCapabilities() snapshot.getNetworkCapabilities()
.setNetworkSpecifier(redactedSnapshotCapSpecifier))); .setNetworkSpecifier(redactedSnapshotCapSpecifier)));