Allow context menu items to be handled properly.
Bug:3130048
BrowserBookmarksPage was claiming that it handled the MenuItem,
so nothing was happening.
BrowserHistoryPage assumed that the MenuInfo would always be non-
null, and could cause a crash.
Change-Id: Iaffbf88390f2513dc6ddb35a91ae097e873d5ae2
diff --git a/src/com/android/browser/BrowserBookmarksPage.java b/src/com/android/browser/BrowserBookmarksPage.java
index 4a3ae1f..88927bd 100644
--- a/src/com/android/browser/BrowserBookmarksPage.java
+++ b/src/com/android/browser/BrowserBookmarksPage.java
@@ -242,13 +242,13 @@
// It is possible that the view has been canceled when we get to
// this point as back has a higher priority
if (mCanceled) {
- return true;
+ return false;
}
AdapterView.AdapterContextMenuInfo i =
(AdapterView.AdapterContextMenuInfo)item.getMenuInfo();
// If we have no menu info, we can't tell which item was selected.
if (i == null) {
- return true;
+ return false;
}
switch (item.getItemId()) {
diff --git a/src/com/android/browser/BrowserHistoryPage.java b/src/com/android/browser/BrowserHistoryPage.java
index 9a57946..3b0292d 100644
--- a/src/com/android/browser/BrowserHistoryPage.java
+++ b/src/com/android/browser/BrowserHistoryPage.java
@@ -276,6 +276,9 @@
public boolean onContextItemSelected(MenuItem item) {
ExpandableListContextMenuInfo i =
(ExpandableListContextMenuInfo) item.getMenuInfo();
+ if (i == null) {
+ return false;
+ }
HistoryItem historyItem = (HistoryItem) i.targetView;
String url = historyItem.getUrl();
String title = historyItem.getName();