Null pointer tests removed from HeaderViewListAdapter.

The mHeaderViewInfos and mFooterViewInfos lists were sometimes tested for nullity
and sometimes not. Should these values be null, some conditionnal code was actually
flawed in getView() and getItem() because of too strong 'and' conditionnals.

These lists are created upon declaration in ListView and are then shared and hence
cannot be null. Null tests were hence removed. getView() and getItem() get simpler
and work as before.

Change-Id: I279e482730ce6148a559d15a9863afc8f6b67780
diff --git a/core/java/android/widget/HeaderViewListAdapter.java b/core/java/android/widget/HeaderViewListAdapter.java
index b0e5f7e..981996a 100644
--- a/core/java/android/widget/HeaderViewListAdapter.java
+++ b/core/java/android/widget/HeaderViewListAdapter.java
@@ -34,6 +34,8 @@
 
     private ListAdapter mAdapter;
 
+    // These two ArrayList are assumed to NOT be null.
+    // They are indeed created when declared in ListView and then shared. 
     ArrayList<ListView.FixedViewInfo> mHeaderViewInfos;
     ArrayList<ListView.FixedViewInfo> mFooterViewInfos;
     boolean mAreAllFixedViewsSelectable;
@@ -55,11 +57,11 @@
     }
 
     public int getHeadersCount() {
-        return mHeaderViewInfos == null ? 0 : mHeaderViewInfos.size();
+        return mHeaderViewInfos.size();
     }
 
     public int getFootersCount() {
-        return mFooterViewInfos == null ? 0 : mFooterViewInfos.size();
+        return mFooterViewInfos.size();
     }
 
     public boolean isEmpty() {
@@ -132,12 +134,12 @@
         if (mAdapter != null && position >= numHeaders) {
             int adjPosition = position - numHeaders;
             int adapterCount = mAdapter.getCount();
-            if (adjPosition >= adapterCount && mFooterViewInfos != null) {
+            if (adjPosition >= adapterCount) {
                 return mFooterViewInfos.get(adjPosition - adapterCount).isSelectable;
             } else {
                 return mAdapter.isEnabled(adjPosition);
             }
-        } else if (position < numHeaders && mHeaderViewInfos != null) {
+        } else if (position < numHeaders) {
             return mHeaderViewInfos.get(position).isSelectable;
         }
         return true;
@@ -148,12 +150,12 @@
         if (mAdapter != null && position >= numHeaders) {
             int adjPosition = position - numHeaders;
             int adapterCount = mAdapter.getCount();
-            if (adjPosition >= adapterCount && mFooterViewInfos != null) {
+            if (adjPosition >= adapterCount) {
                 return mFooterViewInfos.get(adjPosition - adapterCount).data;
             } else {
                 return mAdapter.getItem(adjPosition);
             }
-        } else if (position < numHeaders && mHeaderViewInfos != null) {
+        } else if (position < numHeaders) {
             return mHeaderViewInfos.get(position).data;
         }
         return null;
@@ -184,9 +186,7 @@
             int adjPosition = position - numHeaders;
             int adapterCount = mAdapter.getCount();
             if (adjPosition >= adapterCount) {
-                if (mFooterViewInfos != null) {
-                    return mFooterViewInfos.get(adjPosition - adapterCount).view;
-                }
+                return mFooterViewInfos.get(adjPosition - adapterCount).view;
             } else {
                 return mAdapter.getView(adjPosition, convertView, parent);
             }