Settings: Respect preference's visibility in VideoPreferenceController

* Since AbstractPreferenceController's displayPreference()
  sets the visibility based on isAvailable() we need to
  set mVideoPreference early and make getAvailabilityStatus()
  return UNSUPPORTED_ON_DEVICE if needed.

Test: manual, open battery manager
Change-Id: Ibf72971b49fa1162fb99f9fc61cbb54ba39a2dfa
diff --git a/src/com/android/settings/widget/VideoPreference.java b/src/com/android/settings/widget/VideoPreference.java
index 1af9065..11a6478 100644
--- a/src/com/android/settings/widget/VideoPreference.java
+++ b/src/com/android/settings/widget/VideoPreference.java
@@ -80,6 +80,7 @@
         try {
             // if these are already set that means they were set dynamically and don't need
             // to be loaded from xml
+            mAnimationAvailable = false;
             mAnimationId = mAnimationId == 0
                 ? attributes.getResourceId(R.styleable.VideoPreference_animation, 0)
                 : mAnimationId;
@@ -91,6 +92,7 @@
                 ? attributes.getResourceId(R.styleable.VideoPreference_preview, 0)
                 : mPreviewResource;
             if (mPreviewResource == 0 && mAnimationId == 0) {
+                setVisible(false);
                 return;
             }
             initMediaPlayer();
@@ -250,6 +252,10 @@
         }
     }
 
+    public boolean isAnimationAvailable() {
+        return mAnimationAvailable;
+    }
+
     public boolean isVideoPaused() {
         return mVideoPaused;
     }