speculative fix for native WebView crashes

Towards the end of MR1, we saw more native crashes on
conversation load. It's possible it was purely due to increased
testing, but just in case it was due to loading animation
changes, go back to Gmail1-style content-ready code.

The document has a small div that initially has an
"initial-load" class set on JB+. The class is no longer
dynamically added in JS. The animation-start event listener
remains as-is, configured on DOM parse (and not later upon DOM
load).

Give the animation a different name from the CSS class that
triggers it, on the off-chance that this is crossing some wires.

Bug: 7370125
Change-Id: I4f0f807fbb9e32e024b6c74a6d9684e7fb337695
diff --git a/assets/script.js b/assets/script.js
index 0fa68c1..fa02122 100644
--- a/assets/script.js
+++ b/assets/script.js
@@ -301,7 +301,6 @@
     if (ENABLE_CONTENT_READY) {
         signalDiv = document.getElementById("initial-load-signal");
         signalDiv.addEventListener("webkitAnimationStart", onContentReady, false);
-        signalDiv.classList.add("initial-load");
     }
 }
 
diff --git a/res/raw/template_conversation_lower.html b/res/raw/template_conversation_lower.html
index 773e9e2..6cc1934 100644
--- a/res/raw/template_conversation_lower.html
+++ b/res/raw/template_conversation_lower.html
@@ -1,4 +1,4 @@
-<div id="initial-load-signal"></div>
+<div id="initial-load-signal" class="%s"></div>
 </body>
 <script type="text/javascript">
   var MSG_HIDE_ELIDED = '%s';
diff --git a/res/raw/template_conversation_upper.html b/res/raw/template_conversation_upper.html
index e981634..df844f8 100644
--- a/res/raw/template_conversation_upper.html
+++ b/res/raw/template_conversation_upper.html
@@ -26,14 +26,14 @@
         width: 2px;
         height: 2px;
         -webkit-transform: translate3d(0, 0, 1px);
-        -webkit-animation-name: initial-load;
+        -webkit-animation-name: initial-load-noop-animation;
         -webkit-animation-duration: 1ms;  /* doesn't matter */
     }
 
     /* Animating the z-position is fast and does not actually change anything in the default
      * perspective.
      */
-    @-webkit-keyframes initial-load {
+    @-webkit-keyframes initial-load-noop-animation {
         from {
             -webkit-transform: translate3d(0, 0, 1px);
         }
diff --git a/src/com/android/mail/ui/HtmlConversationTemplates.java b/src/com/android/mail/ui/HtmlConversationTemplates.java
index 2e5a8d0..3420d53 100644
--- a/src/com/android/mail/ui/HtmlConversationTemplates.java
+++ b/src/com/android/mail/ui/HtmlConversationTemplates.java
@@ -186,7 +186,9 @@
             throw new IllegalStateException("must call startConversation first");
         }
 
-        append(sConversationLower, mContext.getString(R.string.hide_elided),
+        final String contentReadyClass = enableContentReadySignal ? "initial-load" : "";
+
+        append(sConversationLower, contentReadyClass, mContext.getString(R.string.hide_elided),
                 mContext.getString(R.string.show_elided), docBaseUri, conversationBaseUri,
                 viewWidth, viewportWidth, enableContentReadySignal, normalizeMessageWidths);