Merge "Migrate guest/vsoc/lib/Android.mk to Android.bp" into cuttlefish-testing
diff --git a/guest/libs/wpa_supplicant_8_lib/Android.mk b/guest/libs/wpa_supplicant_8_lib/Android.mk
deleted file mode 100644
index 95b9662..0000000
--- a/guest/libs/wpa_supplicant_8_lib/Android.mk
+++ /dev/null
@@ -1,80 +0,0 @@
-# Copyright (C) 2016 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-LOCAL_PATH := $(call my-dir)
-
-ifeq ($(WPA_SUPPLICANT_VERSION),VER_0_8_X)
-
-ifneq ($(BOARD_WPA_SUPPLICANT_DRIVER),)
-  CONFIG_DRIVER_$(BOARD_WPA_SUPPLICANT_DRIVER) := y
-endif
-
-# Use a custom libnl on releases before N
-ifeq (0, $(shell test $(PLATFORM_SDK_VERSION) -lt 24; echo $$?))
-EXTERNAL_VSOC_LIBNL_INCLUDE := external/gce/libnl/include
-else
-EXTERNAL_VSOC_LIBNL_INCLUDE :=
-endif
-
-
-WPA_SUPPL_DIR = external/wpa_supplicant_8
-WPA_SRC_FILE :=
-
-include $(WPA_SUPPL_DIR)/wpa_supplicant/android.config
-
-WPA_SUPPL_DIR_INCLUDE = $(WPA_SUPPL_DIR)/src \
-	$(WPA_SUPPL_DIR)/src/common \
-	$(WPA_SUPPL_DIR)/src/drivers \
-	$(WPA_SUPPL_DIR)/src/l2_packet \
-	$(WPA_SUPPL_DIR)/src/utils \
-	$(WPA_SUPPL_DIR)/src/wps \
-	$(WPA_SUPPL_DIR)/wpa_supplicant \
-	$(EXTERNAL_VSOC_LIBNL_INCLUDE)
-
-WPA_SUPPL_DIR_INCLUDE += external/libnl/include
-
-ifdef CONFIG_DRIVER_NL80211
-WPA_SRC_FILE += driver_cmd_nl80211.c
-endif
-
-ifeq ($(TARGET_ARCH),arm)
-# To force sizeof(enum) = 4
-L_CFLAGS += -mabi=aapcs-linux
-endif
-
-ifdef CONFIG_ANDROID_LOG
-L_CFLAGS += -DCONFIG_ANDROID_LOG
-endif
-
-########################
-
-include $(CLEAR_VARS)
-LOCAL_MODULE := lib_driver_cmd_simulated
-LOCAL_VENDOR_MODULE := true
-LOCAL_SHARED_LIBRARIES := libc libcutils
-
-LOCAL_CFLAGS := $(L_CFLAGS) \
-    $(VSOC_VERSION_CFLAGS)
-
-LOCAL_SRC_FILES := $(WPA_SRC_FILE)
-
-LOCAL_C_INCLUDES := \
-  device/google/cuttlefish_common \
-  $(WPA_SUPPL_DIR_INCLUDE)\
-
-include $(BUILD_STATIC_LIBRARY)
-
-########################
-
-endif
diff --git a/guest/libs/wpa_supplicant_8_lib/driver_cmd_nl80211.c b/guest/libs/wpa_supplicant_8_lib/driver_cmd_nl80211.c
deleted file mode 100644
index a2180aa..0000000
--- a/guest/libs/wpa_supplicant_8_lib/driver_cmd_nl80211.c
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * Copyright (C) 2016 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/*
- * Driver interaction with extended Linux CFG8021
- */
-
-#include "driver_cmd_nl80211.h"
-
-#include <stddef.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-#if VSOC_PLATFORM_SDK_AFTER(L_MR1)
-// Android M exposes headers more directly.
-#include <netinet/in.h>
-#include <linux/if.h>
-#include <linux/if_ether.h>
-#include "driver_nl80211.h"
-#elif VSOC_PLATFORM_SDK_AFTER(J_MR2)
-// Android versions K and L put structures in hardware_legacy
-#include "hardware_legacy/driver_nl80211.h"
-#else
-// Android version J does not expose structures directly. These structures are
-// manually defined later.
-#include <netinet/in.h>
-#include <linux/if.h>
-#endif
-
-#include "common.h"
-#include "wpa_supplicant_i.h"
-#include "config.h"
-#include "android_drv.h"
-
-
-int wpa_driver_nl80211_driver_cmd(
-    void* priv, char* cmd, char* buf, size_t buf_len) {
-  struct i802_bss* bss = priv;
-  struct wpa_driver_nl80211_data* drv = bss->drv;
-  struct ifreq ifr;
-  android_wifi_priv_cmd priv_cmd;
-  int ret = 0;
-
-  D("%s: called", __FUNCTION__);
-  if (os_strcasecmp(cmd, "STOP") == 0) {
-    linux_set_iface_flags(drv->global->ioctl_sock, bss->ifname, 0);
-    wpa_msg(drv->ctx, MSG_INFO, WPA_EVENT_DRIVER_STATE "STOPPED");
-  } else if (os_strcasecmp(cmd, "START") == 0) {
-    linux_set_iface_flags(drv->global->ioctl_sock, bss->ifname, 1);
-    wpa_msg(drv->ctx, MSG_INFO, WPA_EVENT_DRIVER_STATE "STARTED");
-  } else if (os_strcasecmp(cmd, "MACADDR") == 0) {
-    u8 macaddr[ETH_ALEN] = {};
-
-    ret = linux_get_ifhwaddr(drv->global->ioctl_sock, bss->ifname, macaddr);
-    if (!ret)
-      ret = os_snprintf(
-          buf, buf_len, "Macaddr = " MACSTR "\n", MAC2STR(macaddr));
-  } else if (os_strcasecmp(cmd, "RELOAD") == 0) {
-    wpa_msg(drv->ctx, MSG_INFO, WPA_EVENT_DRIVER_STATE "HANGED");
-  } else {  // Use private command
-    return 0;
-  }
-  return ret;
-}
-
-
-int wpa_driver_set_p2p_noa(void* priv, u8 count, int start, int duration) {
-  D("%s: called", __FUNCTION__);
-  return 0;
-}
-
-
-int wpa_driver_get_p2p_noa(void* priv, u8* buf, size_t len) {
-  D("%s: called", __FUNCTION__);
-  return 0;
-}
-
-
-int wpa_driver_set_p2p_ps(void* priv, int legacy_ps, int opp_ps, int ctwindow) {
-  D("%s: called", __FUNCTION__);
-  return -1;
-}
-
-
-int wpa_driver_set_ap_wps_p2p_ie(
-    void* priv, const struct wpabuf* beacon,
-    const struct wpabuf* proberesp, const struct wpabuf* assocresp) {
-  D("%s: called", __FUNCTION__);
-  return 0;
-}
diff --git a/guest/libs/wpa_supplicant_8_lib/driver_cmd_nl80211.h b/guest/libs/wpa_supplicant_8_lib/driver_cmd_nl80211.h
deleted file mode 100644
index 4256664..0000000
--- a/guest/libs/wpa_supplicant_8_lib/driver_cmd_nl80211.h
+++ /dev/null
@@ -1,104 +0,0 @@
-#pragma once
-/*
- * Copyright (C) 2016 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include <guest/libs/platform_support/api_level_fixes.h>
-
-#include <memory.h>
-#include <stddef.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include "common.h"
-#include "linux_ioctl.h"
-#include "wpa_supplicant_i.h"
-#include <linux/if_ether.h>
-
-#define VSOC_WPA_SUPPLICANT_DEBUG 0
-
-#if VSOC_WPA_SUPPLICANT_DEBUG
-#  define D(...) ALOGD(__VA_ARGS__)
-#else
-#  define D(...) ((void)0)
-#endif
-
-
-typedef struct android_wifi_priv_cmd {
-  char* buf;
-  int used_len;
-  int total_len;
-} android_wifi_priv_cmd;
-
-#if VSOC_PLATFORM_SDK_BEFORE(K)
-
-#include "driver.h"
-
-struct i802_bss {
-  struct wpa_driver_nl80211_data* drv;
-  struct i802_bss* next;
-  int ifindex;
-  char ifname[IFNAMSIZ + 1];
-  char brname[IFNAMSIZ];
-
-  unsigned int beacon_set:1;
-  unsigned int added_if_into_bridge:1;
-  unsigned int added_bridge:1;
-  unsigned int in_deinit:1;
-
-  u8 addr[ETH_ALEN];
-
-  int freq;
-
-  void* ctx;
-  struct nl_handle* nl_preq;
-  struct nl_handle* nl_mgmt;
-  struct nl_cb* nl_cb;
-
-  struct nl80211_wiphy_data *wiphy_data;
-  struct dl_list wiphy_list;
-};
-
-struct nl80211_global {
-  struct dl_list interfaces;
-  int if_add_ifindex;
-  struct netlink_data *netlink;
-  struct nl_cb* nl_cb;
-  struct nl_handle* nl;
-  int nl80211_id;
-  int ioctl_sock;  // socket for ioctl() use
-
-  struct nl_handle* nl_event;
-};
-
-struct wpa_driver_nl80211_data {
-  struct nl80211_global* global;
-  struct dl_list list;
-  struct dl_list wiphy_list;
-  char phyname[32];
-  void* ctx;
-  int ifindex;
-  int if_removed;
-  int if_disabled;
-  int ignore_if_down_event;
-  struct rfkill_data* rfkill;
-  struct wpa_driver_capa capa;
-  u8* extended_capa;
-  u8* extended_capa_mask;
-  unsigned int extended_capa_len;
-  int has_capability;
-  // More internal data follows.
-};
-
-#endif  // VSOC_PLATFORM_SDK_AFTER(J)