Fix EventLog string class problem in onOptionMenuSelected

EventLog function can handle string,integer class and long class. (in android_util_EventLog.cpp)
If menu title string are used bold tag(like <b>test</b>), it'll be android.text.SpannedString.
In onOptionMenuSelected, it is using item.getTitleCondensed() function for writing event log.
therefore any android activity using tag menu string(like <b></b>) can be crashed by IllegalArgumentException.

I found this crash on GMS Application.
change locale chinese -> launch Google+ -> hangout -> menu key -> Invite(expressed chinese) click -> Google+ crash

Change-Id: I0437be81699925e29bf4510eb615ef2424432763
This commit is contained in:
zobject
2012-12-10 22:52:59 +09:00
parent be5316e012
commit 332944f8a0

View File

@@ -2544,7 +2544,7 @@ public class Activity extends ContextThemeWrapper
// Put event logging here so it gets called even if subclass
// doesn't call through to superclass's implmeentation of each
// of these methods below
EventLog.writeEvent(50000, 0, item.getTitleCondensed());
EventLog.writeEvent(50000, 0, item.getTitleCondensed().toString());
if (onOptionsItemSelected(item)) {
return true;
}
@@ -2562,7 +2562,7 @@ public class Activity extends ContextThemeWrapper
return false;
case Window.FEATURE_CONTEXT_MENU:
EventLog.writeEvent(50000, 1, item.getTitleCondensed());
EventLog.writeEvent(50000, 1, item.getTitleCondensed().toString());
if (onContextItemSelected(item)) {
return true;
}