--- security.c	2008-06-19 11:47:59.000000000 -0700
+++ mono-122833/mono/metadata/security.c	2009-01-10 03:40:51.000000000 -0800
@@ -143,6 +143,24 @@
 	struct passwd *p = NULL;
 	gboolean result;
 
+#ifdef PLATFORM_ANDROID
+	gchar stubname[20];
+
+	// Android has no /etc. The "user names" are generated from the uids.
+	// The ones of significance are below.
+	if (uid == 0)
+		return g_strdup ("root");
+	// uids under 10000 are for system services like bluetooth, gps, etc.
+	// They won't use mono, but handling them just in case.
+	// "User" apps have uid's of atleast 10000. Their user names are
+	// always app_(uid-10000). Ie, uid 10023 is app_23.
+	if (uid >= 10000)
+		g_sprintf(stubname, "app_%d", uid - 10000);
+	else
+		g_sprintf(stubname, "%d", uid);	
+	return g_strdup (stubname);
+#endif
+
 #ifdef HAVE_GETPWUID_R
 #ifdef _SC_GETPW_R_SIZE_MAX
  	fbufsize = mono_sysconf (_SC_GETPW_R_SIZE_MAX);
@@ -209,6 +227,11 @@
 	struct passwd *p = NULL;
 	gboolean result;
 
+#ifdef PLATFORM_ANDROID
+	// Android has no concept of groups. gid is simply the uid.
+	return user == group;
+#endif
+
 #ifdef HAVE_GETPWUID_R
 #ifdef _SC_GETPW_R_SIZE_MAX
  	fbufsize = mono_sysconf (_SC_GETPW_R_SIZE_MAX);
