Add support for arm{,64} cuttlefish phone platforms

Only 'aosp_cf_arm_phone-userdebug' can boot up successfully because
swiftshader does not support arm64.

Bug: 118442619
Test: lunch aosp_cf_arm_phone-userdebug && make -j128 dist
Test: lunch aosp_cf_arm64_phone-userdebug && make -j128 dist
Change-Id: Icddf0e2ef74ce093794fd7dfb8addfe698cefe89
diff --git a/Android.mk b/Android.mk
index b0234eb..afddf54 100644
--- a/Android.mk
+++ b/Android.mk
@@ -14,7 +14,7 @@
 # limitations under the License.
 #
 
-ifneq ($(filter $(TARGET_DEVICE), vsoc_x86 vsoc_x86_64),)
+ifneq ($(filter $(TARGET_DEVICE), vsoc_arm vsoc_arm64 vsoc_x86 vsoc_x86_64),)
 LOCAL_PATH:= $(call my-dir)
 
 include $(CLEAR_VARS)
diff --git a/AndroidProducts.mk b/AndroidProducts.mk
index aed0d8b..2a6e400 100644
--- a/AndroidProducts.mk
+++ b/AndroidProducts.mk
@@ -15,6 +15,8 @@
 #
 
 PRODUCT_MAKEFILES := \
+	aosp_cf_arm_phone:$(LOCAL_DIR)/vsoc_arm/phone/device.mk \
+	aosp_cf_arm64_phone:$(LOCAL_DIR)/vsoc_arm64/phone/device.mk \
 	aosp_cf_x86_64_auto:$(LOCAL_DIR)/vsoc_x86_64/auto/device.mk \
 	aosp_cf_x86_64_pasan:$(LOCAL_DIR)/vsoc_x86_64/pasan/device.mk \
 	aosp_cf_x86_64_phone:$(LOCAL_DIR)/vsoc_x86_64/phone/device.mk \
@@ -37,6 +39,8 @@
 	aosp_cf_x86_wear:$(LOCAL_DIR)/vsoc_x86/wear/device.mk \
 
 COMMON_LUNCH_CHOICES := \
+	aosp_cf_arm_phone-userdebug \
+	aosp_cf_arm64_phone-userdebug \
 	aosp_cf_x86_auto-userdebug \
 	aosp_cf_x86_phone-userdebug \
 	aosp_cf_x86_tablet-userdebug \
diff --git a/vsoc_arm/BoardConfig.mk b/vsoc_arm/BoardConfig.mk
new file mode 100644
index 0000000..184ac38
--- /dev/null
+++ b/vsoc_arm/BoardConfig.mk
@@ -0,0 +1,30 @@
+#
+# Copyright 2017 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.
+#
+
+#
+# x86 target for Cuttlefish
+#
+
+-include device/google/cuttlefish/shared/BoardConfig.mk
+
+TARGET_BOOTLOADER_BOARD_NAME := vsoc_arm
+TARGET_BOARD_PLATFORM := vsoc_arm
+TARGET_ARCH := arm
+TARGET_ARCH_VARIANT := armv8-a
+TARGET_CPU_ABI := armeabi-v7a
+TARGET_CPU_VARIANT := cortex-a53
+
+BUILD_BROKEN_DUP_RULES := true
diff --git a/vsoc_arm/phone/device.mk b/vsoc_arm/phone/device.mk
new file mode 100644
index 0000000..6701e57
--- /dev/null
+++ b/vsoc_arm/phone/device.mk
@@ -0,0 +1,22 @@
+#
+# Copyright (C) 2017 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/phone/device.mk)
+
+PRODUCT_NAME := aosp_cf_arm_phone
+PRODUCT_DEVICE := vsoc_arm
+PRODUCT_MODEL := Cuttlefish arm phone
+PRODUCT_PACKAGE_OVERLAYS := device/google/cuttlefish/vsoc_arm/phone/overlay
diff --git a/vsoc_arm/phone/overlay/frameworks/base/core/res/res/values/config.xml b/vsoc_arm/phone/overlay/frameworks/base/core/res/res/values/config.xml
new file mode 100644
index 0000000..2b7dfbe
--- /dev/null
+++ b/vsoc_arm/phone/overlay/frameworks/base/core/res/res/values/config.xml
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+** Copyright 2017, 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.
+*/
+-->
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+  <string-array name="networkAttributes" translatable="false">
+    <item>"mobile,0,0,0,-1,true"</item>
+    <item>"wifi,1,1,1,-1,true"</item>
+    <item>"mobile_mms,2,0,2,60000,true"</item>
+    <item>"mobile_hipri,5,0,3,60000,true"</item>
+    <item>"bluetooth,7,7,2,-1,true"</item>
+  </string-array>
+  <string-array name="radioAttributes" translatable="false">
+    <item>"0,1"</item>
+    <item>"1,1"</item>
+    <item>"4,1"</item>
+    <item>"7,1"</item>
+    <item>"11,1"</item>
+  </string-array>
+  <string-array name="config_tether_wifi_regexs" translatable="false">
+    <item>"wlan0"</item>
+  </string-array>
+  <string-array name="config_tether_apndata" translatable="false">
+    <item>Android,android,,,,,,,,310,260,,default,dun,ims</item>
+  </string-array>
+  <bool name="config_wifi_dual_band_support" translatable="false">true</bool>
+  <bool name="config_bluetooth_address_validation">true</bool>
+  <bool name="config_sms_capable">true</bool>
+  <string name="default_sms_application" translatable="false">com.android.mms</string>
+  <bool name="config_showNavigationBar">true</bool>
+  <dimen name="config_viewConfigurationTouchSlop">12dp</dimen>
+  <integer name="config_mobile_mtu">1460</integer>
+  <!-- cuttlefish uses mac80211-hwsim, which does not support Preferred
+  Network Offload feature. We disable the use of this feature here. -->
+  <bool translatable="false" name="config_wifi_background_scan_support">false</bool>
+  <!--  Maximum number of supported users -->
+  <integer name="config_multiuserMaximumUsers">4</integer>
+</resources>
diff --git a/vsoc_arm64/BoardConfig.mk b/vsoc_arm64/BoardConfig.mk
new file mode 100644
index 0000000..339793d
--- /dev/null
+++ b/vsoc_arm64/BoardConfig.mk
@@ -0,0 +1,36 @@
+#
+# Copyright 2017 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.
+#
+
+#
+# x86 target for Cuttlefish
+#
+
+-include device/google/cuttlefish/shared/BoardConfig.mk
+
+TARGET_BOOTLOADER_BOARD_NAME := vsoc_arm64
+TARGET_BOARD_PLATFORM := vsoc_arm64
+TARGET_ARCH := arm64
+TARGET_ARCH_VARIANT := armv8-a
+TARGET_CPU_ABI := arm64-v8a
+TARGET_CPU_VARIANT := cortex-a53
+TARGET_2ND_ARCH := arm
+TARGET_2ND_ARCH_VARIANT := armv8-a
+TARGET_2ND_CPU_ABI := armeabi-v7a
+TARGET_2ND_CPU_ABI2 := armeabi
+TARGET_2ND_CPU_VARIANT := cortex-a53
+TARGET_TRANSLATE_2ND_ARCH := false
+
+BUILD_BROKEN_DUP_RULES := true
diff --git a/vsoc_arm64/phone/device.mk b/vsoc_arm64/phone/device.mk
new file mode 100644
index 0000000..c05d456
--- /dev/null
+++ b/vsoc_arm64/phone/device.mk
@@ -0,0 +1,23 @@
+#
+# Copyright (C) 2017 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/phone/device.mk)
+
+PRODUCT_NAME := aosp_cf_arm64_phone
+PRODUCT_DEVICE := vsoc_arm64
+PRODUCT_MODEL := Cuttlefish arm64 phone
+PRODUCT_PACKAGE_OVERLAYS := device/google/cuttlefish/vsoc_arm64/phone/overlay
diff --git a/vsoc_arm64/phone/overlay/frameworks/base/core/res/res/values/config.xml b/vsoc_arm64/phone/overlay/frameworks/base/core/res/res/values/config.xml
new file mode 100644
index 0000000..2b7dfbe
--- /dev/null
+++ b/vsoc_arm64/phone/overlay/frameworks/base/core/res/res/values/config.xml
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+** Copyright 2017, 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.
+*/
+-->
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+  <string-array name="networkAttributes" translatable="false">
+    <item>"mobile,0,0,0,-1,true"</item>
+    <item>"wifi,1,1,1,-1,true"</item>
+    <item>"mobile_mms,2,0,2,60000,true"</item>
+    <item>"mobile_hipri,5,0,3,60000,true"</item>
+    <item>"bluetooth,7,7,2,-1,true"</item>
+  </string-array>
+  <string-array name="radioAttributes" translatable="false">
+    <item>"0,1"</item>
+    <item>"1,1"</item>
+    <item>"4,1"</item>
+    <item>"7,1"</item>
+    <item>"11,1"</item>
+  </string-array>
+  <string-array name="config_tether_wifi_regexs" translatable="false">
+    <item>"wlan0"</item>
+  </string-array>
+  <string-array name="config_tether_apndata" translatable="false">
+    <item>Android,android,,,,,,,,310,260,,default,dun,ims</item>
+  </string-array>
+  <bool name="config_wifi_dual_band_support" translatable="false">true</bool>
+  <bool name="config_bluetooth_address_validation">true</bool>
+  <bool name="config_sms_capable">true</bool>
+  <string name="default_sms_application" translatable="false">com.android.mms</string>
+  <bool name="config_showNavigationBar">true</bool>
+  <dimen name="config_viewConfigurationTouchSlop">12dp</dimen>
+  <integer name="config_mobile_mtu">1460</integer>
+  <!-- cuttlefish uses mac80211-hwsim, which does not support Preferred
+  Network Offload feature. We disable the use of this feature here. -->
+  <bool translatable="false" name="config_wifi_background_scan_support">false</bool>
+  <!--  Maximum number of supported users -->
+  <integer name="config_multiuserMaximumUsers">4</integer>
+</resources>