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
Merged-In: I82933a83a7d13903bbce9a85d6e8dae1a492bf24
Merged-In: I98133ad41229b93f51ea3976d311f9896456a56c
Change-Id: I4eb914923f3664b12b6af0ae05f45b60c5312b02
(cherry picked from commit a8f3c01be9)
This commit is contained in:
Pavel Maltsev
2018-05-09 14:49:33 -07:00
committed by Erik Kline
parent aea0136d01
commit 6c61d1013d

View File

@@ -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);
}
}
}