Don't show help menu when browser unavailable

- Fix b/10860551

Change-Id: I71d073ef96d406f1705672d7ccf75337e5250ec6
This commit is contained in:
Lifu Tang
2013-09-25 16:50:46 -07:00
parent 372b6f74b1
commit 66d879ce9f

View File

@@ -16,6 +16,7 @@
package com.android.settings; package com.android.settings;
import android.content.ComponentName;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.pm.PackageInfo; import android.content.pm.PackageInfo;
@@ -95,9 +96,15 @@ public class HelpUtils {
// Set the intent to the help menu item, show the help menu item in the overflow // Set the intent to the help menu item, show the help menu item in the overflow
// menu, and make it visible. // menu, and make it visible.
ComponentName component = intent.resolveActivity(context.getPackageManager());
if (component != null) {
helpMenuItem.setIntent(intent); helpMenuItem.setIntent(intent);
helpMenuItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); helpMenuItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);
helpMenuItem.setVisible(true); helpMenuItem.setVisible(true);
} else {
helpMenuItem.setVisible(false);
return false;
}
// return that the help menu item is visible (i.e., true) // return that the help menu item is visible (i.e., true)
return true; return true;