Fix problem with starting a translucent activity in onCreate().

Fixes issue #2437252: Starting activity by means of startActivityForResult
causes 5 seconds delay if "android:windowIsTranslucent" is true

The optimization to avoid showing an activity window when a new
activity is being started was a little too aggressive.  Now it
avoids doing this if there is not actually a fullscreen activity
on top to cover it.

Change-Id: I630e37a1f1d3b874b5a25572cbf887cebc2e3e91
diff --git a/services/java/com/android/server/am/ActivityManagerService.java b/services/java/com/android/server/am/ActivityManagerService.java
index a501ceb..b6064e8 100644
--- a/services/java/com/android/server/am/ActivityManagerService.java
+++ b/services/java/com/android/server/am/ActivityManagerService.java
@@ -4268,6 +4268,22 @@
         }
     }
 
+    public boolean willActivityBeVisible(IBinder token) {
+        synchronized(this) {
+            int i;
+            for (i=mHistory.size()-1; i>=0; i--) {
+                HistoryRecord r = (HistoryRecord)mHistory.get(i);
+                if (r == token) {
+                    return true;
+                }
+                if (r.fullscreen && !r.finishing) {
+                    return false;
+                }
+            }
+            return true;
+        }
+    }
+    
     public void overridePendingTransition(IBinder token, String packageName,
             int enterAnim, int exitAnim) {
         synchronized(this) {