question: public void onPanelStateChanged ( PanelState fromState , PanelState toState , StateChangeReason reason ) { boolean isStartingSearch = isStartingNewContextualSearch ( toState , reason ) ; boolean isEndingSearch = isEndingContextualSearch ( fromState , toState , isStartingSearch ) ; boolean isChained = isStartingSearch && isOngoingContextualSearch ( fromState ) ; boolean isSameState = fromState == toState ; boolean isFirstExitFromPeeking = fromState == PanelState . PEEKED && ! mHasExitedPeeking && ( ! isSameState || isStartingSearch ) ; boolean isFirstExitFromExpanded = fromState == PanelState . EXPANDED && ! mHasExitedExpanded && ! isSameState ; boolean isFirstExitFromMaximized = fromState == PanelState . MAXIMIZED && ! mHasExitedMaximized && ! isSameState ; boolean isFirstSearchView = isFirstExitFromPeeking && toState != PanelState . CLOSED ; boolean isSearchPanelFullyPreloaded = mIsSearchPanelFullyPreloaded ; if ( isEndingSearch ) { if ( ! mDidSearchInvolvePromo ) { long durationMs = ( System . nanoTime ( ) - mSearchStartTimeNs ) / 1000000 ; ContextualSearchUma . logDuration ( mWasSearchContentViewSeen , isChained , durationMs ) ; } if ( mIsPromoActive ) { ContextualSearchUma . logPromoSeen ( mWasSearchContentViewSeen , mWasActivatedByTap ) ; } else { ContextualSearchUma . logResultsSeen ( mWasSearchContentViewSeen , mWasActivatedByTap ) ; } } if ( isStartingSearch ) { mSearchStartTimeNs = System . nanoTime ( ) ; mSearchViewStartTimeNs = 0 ; mIsSearchPanelFullyPreloaded = false ; mWasActivatedByTap = reason == StateChangeReason . TEXT_SELECT_TAP ; } if ( isFirstSearchView ) { onSearchPanelFirstView ( ) ; } StateChangeReason reasonForLogging = mIsSerpNavigation ? StateChangeReason . SERP_NAVIGATION : reason ; if ( isStartingSearch || isEndingSearch || ( ! mHasExpanded && toState == PanelState . EXPANDED ) || ( ! mHasMaximized && toState == PanelState . MAXIMIZED ) ) { ContextualSearchUma . logFirstStateEntry ( fromState , toState , reasonForLogging ) ; } if ( ( isStartingSearch && ! isChained ) || isFirstExitFromPeeking || isFirstExitFromExpanded || isFirstExitFromMaximized ) { ContextualSearchUma . logFirstStateExit ( fromState , toState , reasonForLogging ) ; } if ( isFirstExitFromPeeking ) { mHasExitedPeeking = true ; } else if ( isFirstExitFromExpanded ) { mHasExitedExpanded = true ; } else if ( isFirstExitFromMaximized ) { mHasExitedMaximized = true ; } if ( toState == PanelState . EXPANDED ) { mHasExpanded = true ; } else if ( toState == PanelState . MAXIMIZED ) { mHasMaximized = true ; } if ( reason == StateChangeReason . SERP_NAVIGATION ) { mIsSerpNavigation = true ; } if ( isEndingSearch ) { if ( mHasMaximized || mHasExpanded ) { ContextualSearchUma . logSerpLoadedOnClose ( isSearchPanelFullyPreloaded ) ; } mDidSearchInvolvePromo = false ; mWasSearchContentViewSeen = false ; mHasExpanded = false ; mHasMaximized = false ; mHasExitedPeeking = false ; mHasExitedExpanded = false ; mHasExitedMaximized = false ; mIsSerpNavigation = false ; } }
target:  Log information when the panel's state has changed.