Adding additional null checks for instances where the qsb is not defined. (Bug 6940769)

Change-Id: I93baa00331bcbcd07e8702d5ad77c8f2022a16f2
diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java
index ad50bbf..e6b237b 100644
--- a/src/com/android/launcher2/Launcher.java
+++ b/src/com/android/launcher2/Launcher.java
@@ -451,7 +451,9 @@
         if (sAppMarketIcon[coi] != null) {
             updateAppMarketIcon(sAppMarketIcon[coi]);
         }
-        mSearchDropTargetBar.onSearchPackagesChanged(searchVisible, voiceVisible);
+        if (mSearchDropTargetBar != null) {
+            mSearchDropTargetBar.onSearchPackagesChanged(searchVisible, voiceVisible);
+        }
     }
 
     private void checkForLocaleChange() {
@@ -1527,7 +1529,10 @@
             appSearchData = new Bundle();
             appSearchData.putString(Search.SOURCE, "launcher-search");
         }
-        Rect sourceBounds = mSearchDropTargetBar.getSearchBarBounds();
+        Rect sourceBounds = new Rect();
+        if (mSearchDropTargetBar != null) {
+            sourceBounds = mSearchDropTargetBar.getSearchBarBounds();
+        }
 
         startGlobalSearch(initialQuery, selectInitialQuery,
             appSearchData, sourceBounds);
@@ -2513,7 +2518,9 @@
                     }
 
                     // Hide the search bar
-                    mSearchDropTargetBar.hideSearchBar(false);
+                    if (mSearchDropTargetBar != null) {
+                        mSearchDropTargetBar.hideSearchBar(false);
+                    }
                 }
 
                 @Override
@@ -2589,7 +2596,9 @@
                 hideDockDivider();
 
                 // Hide the search bar
-                mSearchDropTargetBar.hideSearchBar(false);
+                if (mSearchDropTargetBar != null) {
+                    mSearchDropTargetBar.hideSearchBar(false);
+                }
             }
             dispatchOnLauncherTransitionPrepare(fromView, animated, false);
             dispatchOnLauncherTransitionStart(fromView, animated, false);
@@ -2741,7 +2750,9 @@
 
             // Show the search bar (only animate if we were showing the drop target bar in spring
             // loaded mode)
-            mSearchDropTargetBar.showSearchBar(wasInSpringLoadedMode);
+            if (mSearchDropTargetBar != null) {
+                mSearchDropTargetBar.showSearchBar(wasInSpringLoadedMode);
+            }
 
             // We only need to animate in the dock divider if we're going from spring loaded mode
             showDockDivider(animated && wasInSpringLoadedMode);
@@ -2844,7 +2855,11 @@
                 mDividerAnimator = LauncherAnimUtils.createAnimatorSet();
                 mDividerAnimator.playTogether(LauncherAnimUtils.ofFloat(mQsbDivider, "alpha", 1f),
                         LauncherAnimUtils.ofFloat(mDockDivider, "alpha", 1f));
-                mDividerAnimator.setDuration(mSearchDropTargetBar.getTransitionInDuration());
+                int duration = 0;
+                if (mSearchDropTargetBar != null) {
+                    duration = mSearchDropTargetBar.getTransitionInDuration();
+                }
+                mDividerAnimator.setDuration(duration);
                 mDividerAnimator.start();
             }
         }
@@ -2865,7 +2880,10 @@
         if (!LauncherApplication.isScreenLarge()) {
             if (animated) {
                 if (mHotseat.getAlpha() != 1f) {
-                    int duration = mSearchDropTargetBar.getTransitionInDuration();
+                    int duration = 0;
+                    if (mSearchDropTargetBar != null) {
+                        duration = mSearchDropTargetBar.getTransitionInDuration();
+                    }
                     mHotseat.animate().alpha(1f).setDuration(duration);
                 }
             } else {
@@ -2881,7 +2899,10 @@
         if (!LauncherApplication.isScreenLarge()) {
             if (animated) {
                 if (mHotseat.getAlpha() != 0f) {
-                    int duration = mSearchDropTargetBar.getTransitionOutDuration();
+                    int duration = 0;
+                    if (mSearchDropTargetBar != null) {
+                        duration = mSearchDropTargetBar.getTransitionOutDuration();
+                    }
                     mHotseat.animate().alpha(0f).setDuration(duration);
                 }
             } else {
@@ -3472,7 +3493,9 @@
     public void bindSearchablesChanged() {
         boolean searchVisible = updateGlobalSearchIcon();
         boolean voiceVisible = updateVoiceSearchIcon(searchVisible);
-        mSearchDropTargetBar.onSearchPackagesChanged(searchVisible, voiceVisible);
+        if (mSearchDropTargetBar != null) {
+            mSearchDropTargetBar.onSearchPackagesChanged(searchVisible, voiceVisible);
+        }
     }
 
     /**