From a8f3c01be97d3011979d0f4083187f4a2ae01a03 Mon Sep 17 00:00:00 2001 From: Pavel Maltsev Date: Wed, 9 May 2018 14:49:33 -0700 Subject: [PATCH] Fix overriding ip configurtion with default one EthernetConfigStore should return 'null' for default interface if the default interface hasn't been configured otherwise it would be hard to distinguish not-configured vs configured with default values. Bug: 79415136 Test: verified w/o .xml overlay Ethernet continues to work Test: verified that ip config from overlay is not getting overriden Change-Id: I4eb914923f3664b12b6af0ae05f45b60c5312b02 --- .../src/com/android/server/ethernet/EthernetConfigStore.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/service-t/src/com/android/server/ethernet/EthernetConfigStore.java b/service-t/src/com/android/server/ethernet/EthernetConfigStore.java index 6445603b96..6b623f48ff 100644 --- a/service-t/src/com/android/server/ethernet/EthernetConfigStore.java +++ b/service-t/src/com/android/server/ethernet/EthernetConfigStore.java @@ -16,6 +16,7 @@ package com.android.server.ethernet; +import android.annotation.Nullable; import android.net.IpConfiguration; import android.os.Environment; import android.util.ArrayMap; @@ -77,9 +78,11 @@ public class EthernetConfigStore { } } + @Nullable public IpConfiguration getIpConfigurationForDefaultInterface() { synchronized (mSync) { - return new IpConfiguration(mIpConfigurationForDefaultInterface); + return mIpConfigurationForDefaultInterface == null + ? null : new IpConfiguration(mIpConfigurationForDefaultInterface); } } }