Disable update logic for market button.

Change-Id: Ie05995b18252cc78c38b3cb0886407b0c5a13be0
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index 9f7b021..11772fd 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -281,8 +281,6 @@
 
     private static HashMap<Long, FolderInfo> sFolders = new HashMap<Long, FolderInfo>();
 
-    private Intent mAppMarketIntent = null;
-
     // Related to the auto-advancing of widgets
     private final int ADVANCE_MSG = 1;
     private final int mAdvanceInterval = 20000;
@@ -301,6 +299,9 @@
     private static Drawable.ConstantState[] sVoiceSearchIcon = new Drawable.ConstantState[2];
     private static Drawable.ConstantState[] sAppMarketIcon = new Drawable.ConstantState[2];
 
+    private Intent mAppMarketIntent = null;
+    private static final boolean DISABLE_MARKET_BUTTON = true;
+
     private Drawable mWorkspaceBackgroundDrawable;
 
     private final ArrayList<Integer> mSynchronouslyBoundPages = new ArrayList<Integer>();
@@ -513,7 +514,9 @@
         int coi = getCurrentOrientationIndexForGlobalIcons();
         if (sGlobalSearchIcon[coi] == null || sVoiceSearchIcon[coi] == null ||
                 sAppMarketIcon[coi] == null) {
-            updateAppMarketIcon();
+            if (!DISABLE_MARKET_BUTTON) {
+                updateAppMarketIcon();
+            }
             searchVisible = updateGlobalSearchIcon();
             voiceVisible = updateVoiceSearchIcon(searchVisible);
         }
@@ -525,7 +528,7 @@
             updateVoiceSearchIcon(sVoiceSearchIcon[coi]);
             voiceVisible = true;
         }
-        if (sAppMarketIcon[coi] != null) {
+        if (!DISABLE_MARKET_BUTTON && sAppMarketIcon[coi] != null) {
             updateAppMarketIcon(sAppMarketIcon[coi]);
         }
         if (mSearchDropTargetBar != null) {
@@ -1527,7 +1530,9 @@
             }
             // When Launcher comes back to foreground, a different Activity might be responsible for
             // the app market intent, so refresh the icon
-            updateAppMarketIcon();
+            if (!DISABLE_MARKET_BUTTON) {
+                updateAppMarketIcon();
+            }
             clearTypedText();
         }
     }
@@ -2268,10 +2273,12 @@
     }
 
     public void onClickAppMarketButton(View v) {
-        if (mAppMarketIntent != null) {
-            startActivitySafely(v, mAppMarketIntent, "app market");
-        } else {
-            Log.e(TAG, "Invalid app market intent.");
+        if (!DISABLE_MARKET_BUTTON) {
+            if (mAppMarketIntent != null) {
+                startActivitySafely(v, mAppMarketIntent, "app market");
+            } else {
+                Log.e(TAG, "Invalid app market intent.");
+            }
         }
     }
 
@@ -3374,35 +3381,39 @@
      * Sets the app market icon
      */
     private void updateAppMarketIcon() {
-        final View marketButton = findViewById(R.id.market_button);
-        Intent intent = new Intent(Intent.ACTION_MAIN).addCategory(Intent.CATEGORY_APP_MARKET);
-        // Find the app market activity by resolving an intent.
-        // (If multiple app markets are installed, it will return the ResolverActivity.)
-        ComponentName activityName = intent.resolveActivity(getPackageManager());
-        if (activityName != null) {
-            int coi = getCurrentOrientationIndexForGlobalIcons();
-            mAppMarketIntent = intent;
-            sAppMarketIcon[coi] = updateTextButtonWithIconFromExternalActivity(
-                    R.id.market_button, activityName, R.drawable.ic_launcher_market_holo,
-                    TOOLBAR_ICON_METADATA_NAME);
-            marketButton.setVisibility(View.VISIBLE);
-        } else {
-            // We should hide and disable the view so that we don't try and restore the visibility
-            // of it when we swap between drag & normal states from IconDropTarget subclasses.
-            marketButton.setVisibility(View.GONE);
-            marketButton.setEnabled(false);
+        if (!DISABLE_MARKET_BUTTON) {
+            final View marketButton = findViewById(R.id.market_button);
+            Intent intent = new Intent(Intent.ACTION_MAIN).addCategory(Intent.CATEGORY_APP_MARKET);
+            // Find the app market activity by resolving an intent.
+            // (If multiple app markets are installed, it will return the ResolverActivity.)
+            ComponentName activityName = intent.resolveActivity(getPackageManager());
+            if (activityName != null) {
+                int coi = getCurrentOrientationIndexForGlobalIcons();
+                mAppMarketIntent = intent;
+                sAppMarketIcon[coi] = updateTextButtonWithIconFromExternalActivity(
+                        R.id.market_button, activityName, R.drawable.ic_launcher_market_holo,
+                        TOOLBAR_ICON_METADATA_NAME);
+                marketButton.setVisibility(View.VISIBLE);
+            } else {
+                // We should hide and disable the view so that we don't try and restore the visibility
+                // of it when we swap between drag & normal states from IconDropTarget subclasses.
+                marketButton.setVisibility(View.GONE);
+                marketButton.setEnabled(false);
+            }
         }
     }
 
     private void updateAppMarketIcon(Drawable.ConstantState d) {
-        // Ensure that the new drawable we are creating has the approprate toolbar icon bounds
-        Resources r = getResources();
-        Drawable marketIconDrawable = d.newDrawable(r);
-        int w = r.getDimensionPixelSize(R.dimen.toolbar_external_icon_width);
-        int h = r.getDimensionPixelSize(R.dimen.toolbar_external_icon_height);
-        marketIconDrawable.setBounds(0, 0, w, h);
+        if (!DISABLE_MARKET_BUTTON) {
+            // Ensure that the new drawable we are creating has the approprate toolbar icon bounds
+            Resources r = getResources();
+            Drawable marketIconDrawable = d.newDrawable(r);
+            int w = r.getDimensionPixelSize(R.dimen.toolbar_external_icon_width);
+            int h = r.getDimensionPixelSize(R.dimen.toolbar_external_icon_height);
+            marketIconDrawable.setBounds(0, 0, w, h);
 
-        updateTextButtonWithDrawable(R.id.market_button, marketIconDrawable);
+            updateTextButtonWithDrawable(R.id.market_button, marketIconDrawable);
+        }
     }
 
     @Override
@@ -3824,7 +3835,9 @@
 
         // Update the market app icon as necessary (the other icons will be managed in response to
         // package changes in bindSearchablesChanged()
-        updateAppMarketIcon();
+        if (!DISABLE_MARKET_BUTTON) {
+            updateAppMarketIcon();
+        }
 
         mWorkspaceLoading = false;
         if (upgradePath) {