Add getInterfaceList module-lib API in EthernetManager.

Bug: 171872016
Test: m
Merged-In: Ib0e6c8f67c6ded7d17bb9e0ff49e7ff495c8819d
Change-Id: I94fd147d0f8cf09cb7445fd2b5bc8e4528e8390e
This commit is contained in:
Xiao Ma
2022-03-17 05:56:09 +00:00
parent 5912ab6906
commit 1edd4554e5
2 changed files with 20 additions and 0 deletions

View File

@@ -39,6 +39,7 @@ import com.android.modules.utils.BackgroundThread;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.concurrent.Executor;
import java.util.function.IntConsumer;
@@ -712,4 +713,20 @@ public class EthernetManager {
maybeRemoveServiceListener();
}
}
/**
* Returns an array of existing Ethernet interface names regardless whether the interface
* is available or not currently.
* @hide
*/
@RequiresPermission(android.Manifest.permission.ACCESS_NETWORK_STATE)
@SystemApi(client = MODULE_LIBRARIES)
@NonNull
public List<String> getInterfaceList() {
try {
return mService.getInterfaceList();
} catch (RemoteException e) {
throw e.rethrowAsRuntimeException();
}
}
}