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/gui/resources.hpp b/gui/resources.hpp
index de67318..69bebc7 100644
--- a/gui/resources.hpp
+++ b/gui/resources.hpp
@@ -57,8 +57,8 @@
 	virtual ~FontResource();
 
 public:
-	void* GetResource() { return this ? mFont : NULL; }
-	int GetHeight() { return gr_ttf_getMaxFontHeight(this ? mFont : NULL); }
+	void* GetResource() { return mFont; }
+	int GetHeight() { return gr_ttf_getMaxFontHeight(mFont); }
 	void Override(xml_node<>* node, ZipWrap* pZip);
 
 protected:
@@ -80,9 +80,9 @@
 	virtual ~ImageResource();
 
 public:
-	gr_surface GetResource() { return this ? mSurface : NULL; }
-	int GetWidth() { return gr_get_width(this ? mSurface : NULL); }
-	int GetHeight() { return gr_get_height(this ? mSurface : NULL); }
+	gr_surface GetResource() { return mSurface; }
+	int GetWidth() { return gr_get_width(mSurface); }
+	int GetHeight() { return gr_get_height(mSurface); }
 
 protected:
 	gr_surface mSurface;
@@ -95,10 +95,10 @@
 	virtual ~AnimationResource();
 
 public:
-	gr_surface GetResource() { return (!this || mSurfaces.empty()) ? NULL : mSurfaces.at(0); }
-	gr_surface GetResource(int entry) { return (!this || mSurfaces.empty()) ? NULL : mSurfaces.at(entry); }
-	int GetWidth() { return gr_get_width(this ? GetResource() : NULL); }
-	int GetHeight() { return gr_get_height(this ? GetResource() : NULL); }
+	gr_surface GetResource() { return mSurfaces.empty() ? NULL : mSurfaces.at(0); }
+	gr_surface GetResource(int entry) { return mSurfaces.empty() ? NULL : mSurfaces.at(entry); }
+	int GetWidth() { return gr_get_width(GetResource()); }
+	int GetHeight() { return gr_get_height(GetResource()); }
 	int GetResourceCount() { return mSurfaces.size(); }
 
 protected: