Add 2 CF products to make x86 and x86_64 GSIs

The purpose of these 2 products is to produc system images as close
to GSIs built from aosp_x86 and aosp_x86_64 as posible. Currently,
the system images built from these 2 products contain all the
components/configurations in current GSIs, except
  /system/fake-libs/libart.so (x86 version)
which is not used by VTS, CTS on GSI, so should be fine for now.

The system images of these 2 products also contain the following:
  /system/etc/bluetooth/controller_properties.json
which may need to be removed to vendor later.

Future GSIs can leverage the pre-submit and post-submit testing
infrastructure for Cuttlefish, and their quality and stability can
be improved using these 2 products.

Bug: 118730375
Test: The following products can be built and booted to home screen
      successfully. 4G LTE and WLAN both work.
      $ lunch aosp_cf_x86_gsi-userdebug; m -j
      $ lunch aosp_cf_x86_64_gsi-userdebug; m -j

Change-Id: Ibc5145652a0063c11d81309e2f078fac2a965983
diff --git a/AndroidProducts.mk b/AndroidProducts.mk
index 6df795e..aed0d8b 100644
--- a/AndroidProducts.mk
+++ b/AndroidProducts.mk
@@ -20,6 +20,7 @@
 	aosp_cf_x86_64_phone:$(LOCAL_DIR)/vsoc_x86_64/phone/device.mk \
 	aosp_cf_x86_64_go_phone:$(LOCAL_DIR)/vsoc_x86_64/go_phone/device.mk \
 	aosp_cf_x86_64_go_512_phone:$(LOCAL_DIR)/vsoc_x86_64/go_512_phone/device.mk \
+	aosp_cf_x86_64_gsi:$(LOCAL_DIR)/vsoc_x86_64/gsi/aosp_cf_x86_64_gsi.mk \
 	aosp_cf_x86_64_tablet:$(LOCAL_DIR)/vsoc_x86_64/tablet/device.mk \
 	aosp_cf_x86_64_tablet_3g:$(LOCAL_DIR)/vsoc_x86_64/tablet_3g/device.mk \
 	aosp_cf_x86_64_tv:$(LOCAL_DIR)/vsoc_x86_64/tv/device.mk \
@@ -29,6 +30,7 @@
 	aosp_cf_x86_phone:$(LOCAL_DIR)/vsoc_x86/phone/device.mk \
 	aosp_cf_x86_go_phone:$(LOCAL_DIR)/vsoc_x86/go_phone/device.mk \
 	aosp_cf_x86_go_512_phone:$(LOCAL_DIR)/vsoc_x86/go_512_phone/device.mk \
+	aosp_cf_x86_gsi:$(LOCAL_DIR)/vsoc_x86/gsi/aosp_cf_x86_gsi.mk \
 	aosp_cf_x86_tablet:$(LOCAL_DIR)/vsoc_x86/tablet/device.mk \
 	aosp_cf_x86_tablet_3g:$(LOCAL_DIR)/vsoc_x86/tablet_3g/device.mk \
 	aosp_cf_x86_tv:$(LOCAL_DIR)/vsoc_x86/tv/device.mk \
diff --git a/shared/gsi/device.mk b/shared/gsi/device.mk
new file mode 100644
index 0000000..e00222d
--- /dev/null
+++ b/shared/gsi/device.mk
@@ -0,0 +1,75 @@
+#
+# Copyright (C) 2018 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.
+#
+
+DEVICE_MANIFEST_FILE += device/google/cuttlefish/shared/config/manifest.xml
+
+$(call inherit-product, $(SRC_TARGET_DIR)/product/aosp_base_telephony.mk)
+$(call inherit-product, frameworks/native/build/phone-xhdpi-2048-dalvik-heap.mk)
+
+# use include below so PRODUCT_SHIPPING_API_LEVEL can be overriden
+include device/google/cuttlefish/shared/device.mk
+PRODUCT_SHIPPING_API_LEVEL := 27
+
+CUTTLEFISH_SYSTEM_AS_ROOT := true
+
+PRODUCT_CHARACTERISTICS := nosdcard
+
+PRODUCT_PROPERTY_OVERRIDES += \
+    keyguard.no_require_sim=true \
+    rild.libpath=libvsoc-ril.so \
+    ro.cdma.home.operator.alpha=Android \
+    ro.cdma.home.operator.numeric=302780 \
+    ro.gsm.home.operator.alpha=Android \
+    ro.gsm.home.operator.numeric=302780 \
+    gsm.sim.operator.numeric=302780 \
+    gsm.sim.operator.alpha=Android \
+    gsm.sim.operator.iso-country=us
+
+PRODUCT_PACKAGES += \
+    MmsService \
+    Phone \
+    PhoneService \
+    Telecom \
+    TeleService \
+    libvsoc-ril \
+    rild \
+
+PRODUCT_COPY_FILES += \
+    frameworks/native/data/etc/android.hardware.telephony.gsm.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.telephony.gsm.xml
+
+# libGLES_android, SdkSetup, and vintf are in current AOSP GSI
+# SdkSetup may need to be removed when it's moved to emulator vendor.
+PRODUCT_PACKAGES += \
+    libGLES_android \
+    SdkSetup \
+    vintf
+
+# Needed for /system/priv-app/SdkSetup/SdkSetup.apk to pass CTS android.permission2.cts.PrivappPermissionsTest.
+PRODUCT_COPY_FILES += \
+    device/generic/goldfish/data/etc/permissions/privapp-permissions-goldfish.xml:$(TARGET_COPY_OUT_SYSTEM)/etc/permissions/privapp-permissions-goldfish.xml
+
+# NFC:
+#   Provide default libnfc-nci.conf file for devices that does not have one in
+#   vendor/etc because aosp system image (of aosp_$arch products) is going to
+#   be used as GSI.
+#   May need to remove the following for newly launched devices in P since this
+#   NFC configuration file should be in vendor/etc, instead of system/etc
+PRODUCT_COPY_FILES += \
+    device/generic/common/nfc/libnfc-nci.conf:system/etc/libnfc-nci.conf
+
+# These flags are important for the GSI, but break auto
+PRODUCT_ENFORCE_RRO_TARGETS := framework-res
+PRODUCT_ENFORCE_RRO_EXCLUDED_OVERLAYS := device/google/cuttlefish/shared/overlay
diff --git a/shared/gsi/wpa_supplicant_overlay.conf b/shared/gsi/wpa_supplicant_overlay.conf
new file mode 100644
index 0000000..e1f530d
--- /dev/null
+++ b/shared/gsi/wpa_supplicant_overlay.conf
@@ -0,0 +1,3 @@
+disable_scan_offload=1
+p2p_disabled=1
+tdls_external_control=1
diff --git a/vsoc_x86/gsi/aosp_cf_x86_gsi.mk b/vsoc_x86/gsi/aosp_cf_x86_gsi.mk
new file mode 100644
index 0000000..64ee7a4
--- /dev/null
+++ b/vsoc_x86/gsi/aosp_cf_x86_gsi.mk
@@ -0,0 +1,36 @@
+#
+# Copyright (C) 2018 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.
+#
+
+$(call inherit-product, device/google/cuttlefish/shared/gsi/device.mk)
+
+PRODUCT_NAME := aosp_cf_x86_gsi
+PRODUCT_DEVICE := vsoc_x86
+PRODUCT_MODEL := Cuttlefish x86 GSI
+
+# Enable A/B update
+AB_OTA_UPDATER := true
+AB_OTA_PARTITIONS := system
+PRODUCT_PACKAGES += \
+    update_engine \
+    update_verifier
+
+# Needed by Pi newly launched device to pass VtsTrebleSysProp on GSI
+#PRODUCT_COMPATIBLE_PROPERTY_OVERRIDE := true
+
+# Support addtional P vendor interface
+PRODUCT_EXTRA_VNDK_VERSIONS := 28
+
+PRODUCT_PACKAGE_OVERLAYS := device/google/cuttlefish/vsoc_x86/phone/overlay
diff --git a/vsoc_x86_64/gsi/aosp_cf_x86_64_gsi.mk b/vsoc_x86_64/gsi/aosp_cf_x86_64_gsi.mk
new file mode 100644
index 0000000..0a9b027
--- /dev/null
+++ b/vsoc_x86_64/gsi/aosp_cf_x86_64_gsi.mk
@@ -0,0 +1,38 @@
+#
+# Copyright (C) 2018 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.
+#
+
+$(call inherit-product, $(SRC_TARGET_DIR)/product/core_64_bit.mk)
+$(call inherit-product, device/google/cuttlefish/shared/gsi/device.mk)
+
+PRODUCT_NAME := aosp_cf_x86_64_gsi
+PRODUCT_DEVICE := vsoc_x86_64
+PRODUCT_MODEL := Cuttlefish x86_64 GSI
+
+# Enable A/B update
+AB_OTA_UPDATER := true
+AB_OTA_PARTITIONS := system
+PRODUCT_PACKAGES += \
+    update_engine \
+    update_verifier
+
+# Needed by Pi newly launched device to pass VtsTrebleSysProp on GSI
+#PRODUCT_COMPATIBLE_PROPERTY_OVERRIDE := true
+
+# Support addtional P vendor interface
+PRODUCT_EXTRA_VNDK_VERSIONS := 28
+
+PRODUCT_PACKAGE_OVERLAYS := device/google/cuttlefish/vsoc_x86_64/phone/overlay
+