Merge AOSP android-9.0.0_r3

Fix conflicts and make it build in 5.1, 6.0, 7.1, 8.1, and 9.0

Change-Id: Ida0a64c29ff27d339b7f42a18d820930964ac6e4
diff --git a/toybox/Android.mk b/toybox/Android.mk
index 8c3d7c5..5b2f32f 100644
--- a/toybox/Android.mk
+++ b/toybox/Android.mk
@@ -275,7 +275,6 @@
     toys/net/tunctl.c \
     toys/pending/getfattr.c \
     toys/pending/modprobe.c \
-    toys/pending/setfattr.c \
     toys/posix/file.c \
     toys/posix/uudecode.c \
     toys/posix/uuencode.c
@@ -288,6 +287,16 @@
 LOCAL_SRC_FILES += \
     toys/pending/chrt.c
 endif
+ifeq ($(shell test $(PLATFORM_SDK_VERSION) -gt 27; echo $$?),0)
+# Android 9.0
+LOCAL_SRC_FILES += \
+    toys/other/setfattr.c \
+    toys/pending/fmt.c \
+    toys/pending/stty.c
+else
+LOCAL_SRC_FILES += \
+    toys/pending/setfattr.c
+endif
 LOCAL_SHARED_LIBRARIES += liblog
 else
 LOCAL_SRC_FILES += \
@@ -310,7 +319,7 @@
 endif
 
 LOCAL_CFLAGS += \
-    -std=c99 \
+    -std=gnu11 \
     -Os \
     -Wno-char-subscripts \
     -Wno-sign-compare \
@@ -380,7 +389,6 @@
     find \
     free \
     getenforce \
-    getprop \
     groups \
     head \
     hostname \
@@ -526,6 +534,7 @@
     xxd
 ifeq ($(shell test $(PLATFORM_SDK_VERSION) -lt 27; echo $$?),0)
 ALL_TOOLS += \
+    getprop \
     xzcat
 endif
 ifeq ($(shell test $(PLATFORM_SDK_VERSION) -gt 24; echo $$?),0)
@@ -534,6 +543,13 @@
     gzip \
     gunzip \
     zcat
+ifeq ($(shell test $(PLATFORM_SDK_VERSION) -gt 27; echo $$?),0)
+ALL_TOOLS += \
+    fmt \
+    start \
+    stop \
+    stty
+endif
 endif
 # Account for master branch changes pulld into CM14.1
 ifneq ($(CM_BUILD),)