question: private boolean passesSanityCheck ( AccessibilityEvent event ) { final CharSequence afterText = getEventText ( event ) ; final CharSequence beforeText = event . getBeforeText ( ) ; if ( ( event . getAddedCount ( ) == 0 ) && ( event . getRemovedCount ( ) == beforeText . length ( ) ) ) { return true ; } if ( afterText == null || beforeText == null ) { return false ; } final int diff = ( event . getAddedCount ( ) - event . getRemovedCount ( ) ) ; return ( ( beforeText . length ( ) + diff ) == afterText . length ( ) ) ; }
target:  Checks whether the event's reported properties match its actual properties, e.g. does the added count minus the removed count reflect the actual change in length between the current and previous text contents.