New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 717395 link

Starred by 2 users

Issue metadata

Status: Fixed
Owner:
Closed: May 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Android
Pri: 1
Type: Bug

Blocking:
issue 669150
issue 708844



Sign in to add a comment

SearchActivity widget crashes because Omnibox suggestions cannot find root view via ViewUtils

Project Member Reported by dfalcant...@chromium.org, May 2 2017

Issue description

Caused by:
https://codereview.chromium.org/2849283002

  05-02 00:25:31.760 11940 11940 E AndroidRuntime: java.lang.ClassCastException: android.view.ViewRootImpl cannot be cast to android.view.View
  05-02 00:25:31.760 11940 11940 E AndroidRuntime: 	at org.chromium.chrome.browser.util.ViewUtils.getRelativeLayoutPosition(ViewUtils.java:74)
  05-02 00:25:31.760 11940 11940 E AndroidRuntime: 	at org.chromium.chrome.browser.omnibox.SuggestionView$SuggestionContentsContainer.getUrlBarLeftOffset(SuggestionView.java:867)
  05-02 00:25:31.760 11940 11940 E AndroidRuntime: 	at org.chromium.chrome.browser.omnibox.SuggestionView$SuggestionContentsContainer.getSuggestionTextLeftPosition(SuggestionView.java:881)
  05-02 00:25:31.760 11940 11940 E AndroidRuntime: 	at org.chromium.chrome.browser.omnibox.SuggestionView$SuggestionContentsContainer.invalidate(SuggestionView.java:954)
  05-02 00:25:31.760 11940 11940 E AndroidRuntime: 	at org.chromium.chrome.browser.omnibox.SuggestionView$SuggestionContentsContainer.setSuggestionIcon(SuggestionView.java:1017)
  05-02 00:25:31.760 11940 11940 E AndroidRuntime: 	at org.chromium.chrome.browser.omnibox.SuggestionView$SuggestionContentsContainer.access$600(SuggestionView.java:620)
  05-02 00:25:31.760 11940 11940 E AndroidRuntime: 	at org.chromium.chrome.browser.omnibox.SuggestionView.init(SuggestionView.java:344)
  05-02 00:25:31.760 11940 11940 E AndroidRuntime: 	at org.chromium.chrome.browser.omnibox.OmniboxResultsAdapter.getView(OmniboxResultsAdapter.java:64)
  05-02 00:25:31.760 11940 11940 E AndroidRuntime: 	at android.widget.ListView.makeAndAddView(ListView.java:1790)
  05-02 00:25:31.760 11940 11940 E AndroidRuntime: 	at android.widget.ListView.fillSpecific(ListView.java:1337)
  05-02 00:25:31.760 11940 11940 E AndroidRuntime: 	at android.widget.ListView.layoutChildren(ListView.java:1620)
  05-02 00:25:31.760 11940 11940 E AndroidRuntime: 	at org.chromium.chrome.browser.omnibox.LocationBarLayout$OmniboxSuggestionsList.layoutChildren(LocationBarLayout.java:632)
  05-02 00:25:31.760 11940 11940 E AndroidRuntime: 	at android.widget.AbsListView.onLayout(AbsListView.java:2087)

Not sure what the correct fix is here because the function explicitly states that it must be a child of the root view, and a findViewById(R.id.content) is obviously failing for the omnibox results in SearchActivity.  If you output the ancestor chain in ViewUtils, you get a root view of "null" for the UrlBar, so I'm guessing R.id.content is completely missing.

 05-02 00:50:39.160 15763 15763 E cr_dfalcantara: Called: null, org.chromium.chrome.browser.omnibox.UrlBar{42baeab0 VFED..CL .F....I. 0,51-912,116 #7f0f019f app:id/url_bar}
 05-02 00:50:39.170 15763 15763 E cr_dfalcantara: Parent: org.chromium.chrome.browser.searchwidget.SearchActivityLocationBarLayout{42bbcb30 V.E..... ......I. 48,0-1056,168 #7f0f031d app:id/search_location_bar}
 05-02 00:50:39.170 15763 15763 E cr_dfalcantara: Parent: android.widget.FrameLayout{42bb4510 V.E...C. ......I. 0,0-1080,168 #7f0f014e app:id/toolbar}
 05-02 00:50:39.170 15763 15763 E cr_dfalcantara: Parent: android.widget.FrameLayout{42b5d3c8 V.E...C. ......ID 0,0-1080,1086 #7f0f015d app:id/control_container}
 05-02 00:50:39.170 15763 15763 E cr_dfalcantara: Parent: android.support.v7.widget.ContentFrameLayout{42b3fce0 V.E..... ......ID 0,0-1080,1086 #1020002 android:id/content}
 05-02 00:50:39.170 15763 15763 E cr_dfalcantara: Parent: android.support.v7.widget.FitWindowsLinearLayout{42b3e5f0 V.E..... ......ID 0,0-1080,1086 #7f0f00e3 app:id/action_bar_root}
 05-02 00:50:39.170 15763 15763 E cr_dfalcantara: Parent: android.widget.FrameLayout{42bad578 V.E..... ......ID 0,75-1080,1161}
 05-02 00:50:39.170 15763 15763 E cr_dfalcantara: Parent: android.widget.LinearLayout{42b5ebf0 V.E..... ......ID 0,0-1080,1776}
 05-02 00:50:39.170 15763 15763 E cr_dfalcantara: Parent: com.android.internal.policy.impl.PhoneWindow$DecorView{42b5e070 V.E..... R.....ID 0,0-1080,1776}
 05-02 00:50:39.170 15763 15763 E cr_dfalcantara: Parent: android.view.ViewRootImpl@42b42918
 05-02 00:50:39.170 15763 15763 E cr_dfalcantara: Parent is wrong type: null, com.android.internal.policy.impl.PhoneWindow$DecorView{42b5e070 V.E..... R.....ID 0,0-1080,1776}, android.view.ViewRootImpl@42b42918

 
The weird thing is that there is a View with android.R.id.content in there (the ContentFrameLayout).  Something seems to be hosed with how it's found.
The getRootView().findViewById(android.R.id.content) call is returning null, so getRootView() is somehow not able to find it?  Bizarre.
Maybe it's just not attached to the window when this is called yet?  The same call seems to be succeeding later on.

 05-02 00:50:39.170 15763 15763 E cr_dfalcantara: Called: android.support.v7.widget.ContentFrameLayout{42b3fce0 V.E..... ......ID 0,0-1080,1086 #1020002 android:id/content}, org.chromium.chrome.browser.omnibox.UrlBar{42baeab0 VFED..CL .F....I. 0,51-912,116 #7f0f019f app:id/url_bar}
 05-02 00:50:39.170 15763 15763 E cr_dfalcantara: Parent: org.chromium.chrome.browser.searchwidget.SearchActivityLocationBarLayout{42bbcb30 V.E..... ......I. 48,0-1056,168 #7f0f031d app:id/search_location_bar}
 05-02 00:50:39.170 15763 15763 E cr_dfalcantara: Parent: android.widget.FrameLayout{42bb4510 V.E...C. ......I. 0,0-1080,168 #7f0f014e app:id/toolbar}
 05-02 00:50:39.170 15763 15763 E cr_dfalcantara: Parent: android.widget.FrameLayout{42b5d3c8 V.E...C. ......ID 0,0-1080,1086 #7f0f015d app:id/control_container}
 05-02 00:50:39.170 15763 15763 E cr_dfalcantara: Parent: android.support.v7.widget.ContentFrameLayout{42b3fce0 V.E..... ......ID 0,0-1080,1086 #1020002 android:id/content}

Issue 717408 has been merged into this issue.
Its Blocking our Dev push, Can you please look in to this, Thanks! 
This issue is reproducible on tablets with below steps:
1.Launch Chrome> Tap on omnibox and try to type anything on keyboard 
2.Observe 

Steps for Mobile Devices: 
Add ‘Google Search’ Widget on device home screen and then tap on it  
Observe 

Number of times you were able to reproduce: 5/5

Please find logs and Video @ http://go/chrome-androidlogs1/7/716351
Labels: -ReleaseBlock-Dev
I reverted the CL last night; it should be alright once the next build happens.
Verified this issue on Tablet(Pixel C) and Phone (Zenfone 2-(Z00AD) with 60.0.3087.3 build
Status: Fixed (was: Assigned)
Fixed with:
https://codereview.chromium.org/2856943002

Sign in to add a comment