1 /*
2  * Copyright (C) 2008 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package android.view.cts;
18 
19 import android.content.Context;
20 import android.graphics.Canvas;
21 import android.graphics.Rect;
22 import android.graphics.drawable.Drawable;
23 import android.os.Handler;
24 import android.os.Parcelable;
25 import android.util.AttributeSet;
26 import android.util.SparseArray;
27 import android.view.ContextMenu;
28 import android.view.ContextMenu.ContextMenuInfo;
29 import android.view.KeyEvent;
30 import android.view.MotionEvent;
31 import android.view.PointerIcon;
32 import android.view.View;
33 import android.view.ViewGroup;
34 
35 import java.util.concurrent.BlockingQueue;
36 import java.util.concurrent.LinkedBlockingQueue;
37 
38 public class MockView extends View {
39     private boolean mCalledOnCreateContextMenu = false;
40     private boolean mCalledOnAnimationStart = false;
41     private boolean mCalledOnAnimationEnd = false;
42     private boolean mCalledOnAttachedToWindow = false;
43     private boolean mCalledOnDetachedFromWindow = false;
44     private boolean mCalledOnCreateDrawableState = false;
45     private boolean mCalledDrawableStateChanged = false;
46     private boolean mCalledOnDraw = false;
47     private boolean mCalledDispatchDraw = false;
48     private boolean mCalledOnFinishInflate = false;
49     private boolean mCalledOnFocusChanged = false;
50     private boolean mCalledOnKeyDown = false;
51     private boolean mCalledOnKeyUp = false;
52     private boolean mCalledOnKeyMultiple = false;
53     private boolean mCalledOnKeyShortcut = false;
54     private boolean mCalledOnLayout = false;
55     private boolean mCalledOnMeasure = false;
56     private boolean mCalledOnSizeChanged = false;
57     private boolean mCalledOnSetAlpha = false;
58     private boolean mCalledOnTrackballEvent = false;
59     private boolean mCalledOnHoverEvent = false;
60     private boolean mCalledOnWindowFocusChanged = false;
61     private boolean mCalledDispatchRestoreInstanceState = false;
62     private boolean mCalledDispatchSaveInstanceState = false;
63     private boolean mCalledOnRestoreInstanceState = false;
64     private boolean mCalledOnSaveInstanceState = false;
65     private boolean mCalledOnWindowVisibilityChanged = false;
66     private boolean mCalledDispatchUnhandledMove = false;
67     private boolean mCalledDispatchWindowFocusChanged = false;
68     private boolean mCalledDispatchWindowVisibilityChanged =false;
69     private boolean mCalledOnScrollChanged = false;
70     private boolean mCalledInvalidate = false;
71     private boolean mCalledComputeScroll = false;
72     private boolean mCalledDispatchKeyEventPreIme = false;
73     private boolean mCalledOnKeyPreIme = false;
74     private boolean mCalledOnResolvePointerIcon = false;
75     private boolean mCalledOnVisibilityAggregated = false;
76     private boolean mCalledRequestFocus = false;
77 
78     private int mOldWidth = -1;
79     private int mOldHeight = -1;
80 
81     private boolean mLastAggregatedVisibility;
82 
83     private BlockingQueue<MotionEvent> mTouchEvents = new LinkedBlockingQueue<>();
84 
MockView(Context context)85     public MockView(Context context) {
86         super(context);
87     }
88 
MockView(Context context, AttributeSet attrs)89     public MockView(Context context, AttributeSet attrs) {
90         super(context, attrs, 0);
91     }
92 
MockView(Context context, AttributeSet attrs, int defStyle)93     public MockView(Context context, AttributeSet attrs, int defStyle) {
94         super(context, attrs, defStyle);
95     }
96 
97     @Override
onKeyShortcut(int keyCode, KeyEvent event)98     public boolean onKeyShortcut(int keyCode, KeyEvent event) {
99         mCalledOnKeyShortcut = true;
100         return super.onKeyShortcut(keyCode, event);
101     }
102 
hasCalledOnKeyShortcut()103     public boolean hasCalledOnKeyShortcut() {
104         return mCalledOnKeyShortcut;
105     }
106 
107     @Override
invalidate()108     public void invalidate() {
109         super.invalidate();
110         mCalledInvalidate = true;
111     }
112 
hasCalledInvalidate()113     public boolean hasCalledInvalidate() {
114         return mCalledInvalidate;
115     }
116 
setParent(ViewGroup parent)117     public void setParent(ViewGroup parent) {
118         parent.addView(this);
119     }
120 
getEnabledStateSet()121     public static int[] getEnabledStateSet() {
122         return ENABLED_STATE_SET;
123     }
124 
getPressedEnabledStateSet()125     public static int[] getPressedEnabledStateSet() {
126         return PRESSED_ENABLED_STATE_SET;
127     }
128 
129     @Override
isPaddingOffsetRequired()130     protected boolean isPaddingOffsetRequired() {
131         return super.isPaddingOffsetRequired();
132     }
133 
134     @Override
getBottomPaddingOffset()135     protected int getBottomPaddingOffset() {
136         return super.getBottomPaddingOffset();
137     }
138 
139     @Override
getLeftPaddingOffset()140     protected int getLeftPaddingOffset() {
141         return super.getLeftPaddingOffset();
142     }
143 
144     @Override
getRightPaddingOffset()145     protected int getRightPaddingOffset() {
146         return super.getRightPaddingOffset();
147     }
148 
149     @Override
getTopPaddingOffset()150     protected int getTopPaddingOffset() {
151         return super.getTopPaddingOffset();
152     }
153 
154     @Override
onAnimationEnd()155     protected void onAnimationEnd() {
156         super.onAnimationEnd();
157         mCalledOnAnimationEnd = true;
158     }
159 
160     @Override
onAnimationStart()161     protected void onAnimationStart() {
162         super.onAnimationStart();
163         mCalledOnAnimationStart = true;
164     }
165 
hasCalledOnAnimationStart()166     public boolean hasCalledOnAnimationStart() {
167         return mCalledOnAnimationStart;
168     }
169 
hasCalledOnAnimationEnd()170     public boolean hasCalledOnAnimationEnd() {
171         return mCalledOnAnimationEnd;
172     }
173 
174     @Override
getHorizontalScrollbarHeight()175     protected int getHorizontalScrollbarHeight() {
176         return super.getHorizontalScrollbarHeight();
177     }
178 
179     @Override
onKeyDown(int keyCode, KeyEvent event)180     public boolean onKeyDown(int keyCode, KeyEvent event) {
181         mCalledOnKeyDown = true;
182         return super.onKeyDown(keyCode, event);
183     }
184 
hasCalledOnKeyDown()185     public boolean hasCalledOnKeyDown() {
186         return mCalledOnKeyDown;
187     }
188 
189     @Override
onKeyMultiple(int keyCode, int repeatCount, KeyEvent event)190     public boolean onKeyMultiple(int keyCode, int repeatCount, KeyEvent event) {
191         mCalledOnKeyMultiple = true;
192         return super.onKeyMultiple(keyCode, repeatCount, event);
193     }
194 
hasCalledOnKeyMultiple()195     public boolean hasCalledOnKeyMultiple() {
196         return mCalledOnKeyMultiple;
197     }
198 
199     @Override
onKeyUp(int keyCode, KeyEvent event)200     public boolean onKeyUp(int keyCode, KeyEvent event) {
201         mCalledOnKeyUp = true;
202         return super.onKeyUp(keyCode, event);
203     }
204 
hasCalledOnKeyUp()205     public boolean hasCalledOnKeyUp() {
206         return mCalledOnKeyUp;
207     }
208 
209     @Override
onTouchEvent(MotionEvent event)210     public boolean onTouchEvent(MotionEvent event) {
211         mTouchEvents.add(MotionEvent.obtain(event));
212         return super.onTouchEvent(event);
213     }
214 
215     @Override
onTrackballEvent(MotionEvent event)216     public boolean onTrackballEvent(MotionEvent event) {
217         mCalledOnTrackballEvent = true;
218         return super.onTrackballEvent(event);
219     }
220 
221     @Override
onHoverEvent(MotionEvent event)222     public boolean onHoverEvent(MotionEvent event) {
223         mCalledOnHoverEvent = true;
224         return super.onHoverEvent(event);
225     }
226 
227     /**
228      * Poll the queue for the oldest MotionEvent that was received by onTouchEvent.
229      * Caller is responsible for recycling the returned event.
230      * @return The oldest MotionEvent that was received by onTouchEvent
231      */
pollTouchEvent()232     public MotionEvent pollTouchEvent() {
233         return mTouchEvents.poll();
234     }
235 
hasCalledOnTouchEvent()236     public boolean hasCalledOnTouchEvent() {
237         return !mTouchEvents.isEmpty();
238     }
239 
hasCalledOnTrackballEvent()240     public boolean hasCalledOnTrackballEvent() {
241         return mCalledOnTrackballEvent;
242     }
243 
hasCalledOnHoverEvent()244     public boolean hasCalledOnHoverEvent() {
245         return mCalledOnHoverEvent;
246     }
247 
248     @Override
getSuggestedMinimumHeight()249     protected int getSuggestedMinimumHeight() {
250         return super.getSuggestedMinimumHeight();
251     }
252 
253     @Override
getSuggestedMinimumWidth()254     protected int getSuggestedMinimumWidth() {
255         return super.getSuggestedMinimumWidth();
256     }
257 
258     @Override
verifyDrawable(Drawable who)259     protected boolean verifyDrawable(Drawable who) {
260         return super.verifyDrawable(who);
261     }
262 
263     @Override
computeHorizontalScrollExtent()264     protected int computeHorizontalScrollExtent() {
265         return super.computeHorizontalScrollExtent();
266     }
267 
268     @Override
computeHorizontalScrollOffset()269     protected int computeHorizontalScrollOffset() {
270         return super.computeHorizontalScrollOffset();
271     }
272 
273     @Override
computeHorizontalScrollRange()274     protected int computeHorizontalScrollRange() {
275         return super.computeHorizontalScrollRange();
276     }
277 
278     @Override
computeVerticalScrollExtent()279     protected int computeVerticalScrollExtent() {
280         return super.computeVerticalScrollExtent();
281     }
282 
283     @Override
computeVerticalScrollOffset()284     protected int computeVerticalScrollOffset() {
285         return super.computeVerticalScrollOffset();
286     }
287 
288     @Override
computeVerticalScrollRange()289     protected int computeVerticalScrollRange() {
290         return super.computeVerticalScrollRange();
291     }
292 
293     @Override
getLeftFadingEdgeStrength()294     protected float getLeftFadingEdgeStrength() {
295         return super.getLeftFadingEdgeStrength();
296     }
297 
298     @Override
getRightFadingEdgeStrength()299     protected float getRightFadingEdgeStrength() {
300         return super.getRightFadingEdgeStrength();
301     }
302 
303     @Override
getBottomFadingEdgeStrength()304     protected float getBottomFadingEdgeStrength() {
305         return super.getBottomFadingEdgeStrength();
306     }
307 
308     @Override
getTopFadingEdgeStrength()309     protected float getTopFadingEdgeStrength() {
310         return super.getTopFadingEdgeStrength();
311     }
312 
313     @Override
getContextMenuInfo()314     protected ContextMenuInfo getContextMenuInfo() {
315         return super.getContextMenuInfo();
316     }
317 
318     @Override
onCreateContextMenu(ContextMenu menu)319     protected void onCreateContextMenu(ContextMenu menu) {
320         super.onCreateContextMenu(menu);
321         mCalledOnCreateContextMenu = true;
322     }
323 
hasCalledOnCreateContextMenu()324     public boolean hasCalledOnCreateContextMenu() {
325         return mCalledOnCreateContextMenu;
326     }
327 
328     @Override
onScrollChanged(int l, int t, int oldl, int oldt)329     protected void onScrollChanged(int l, int t, int oldl, int oldt) {
330         super.onScrollChanged(l, t, oldl, oldt);
331         mCalledOnScrollChanged = true;
332     }
333 
hasCalledOnScrollChanged()334     public boolean hasCalledOnScrollChanged() {
335         return mCalledOnScrollChanged;
336     }
337 
338     @Override
onSizeChanged(int w, int h, int oldw, int oldh)339     protected void onSizeChanged(int w, int h, int oldw, int oldh) {
340         super.onSizeChanged(w, h, oldw, oldh);
341         mCalledOnSizeChanged = true;
342         mOldWidth = oldw;
343         mOldHeight = oldh;
344     }
345 
getOldWOnSizeChanged()346     public int getOldWOnSizeChanged() {
347         return mOldWidth;
348     }
349 
getOldHOnSizeChanged()350     public int getOldHOnSizeChanged() {
351         return mOldHeight;
352     }
353 
hasCalledOnSizeChanged()354     public boolean hasCalledOnSizeChanged() {
355         return mCalledOnSizeChanged;
356     }
357 
358     @Override
onLayout(boolean changed, int left, int top, int right, int bottom)359     protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
360         super.onLayout(changed, left, top, right, bottom);
361         mCalledOnLayout = true;
362     }
363 
hasCalledOnLayout()364     public boolean hasCalledOnLayout() {
365         return mCalledOnLayout;
366     }
367 
368     @Override
computeScroll()369     public void computeScroll() {
370         super.computeScroll();
371         mCalledComputeScroll = true;
372     }
373 
hasCalledComputeScroll()374     public boolean hasCalledComputeScroll() {
375         return mCalledComputeScroll;
376     }
377 
378     @Override
dispatchSetSelected(boolean selected)379     protected void dispatchSetSelected(boolean selected) {
380         super.dispatchSetSelected(selected);
381     }
382 
383     @Override
dispatchSetPressed(boolean pressed)384     protected void dispatchSetPressed(boolean pressed) {
385         super.dispatchSetPressed(pressed);
386     }
387 
388     @Override
dispatchWindowFocusChanged(boolean hasFocus)389     public void dispatchWindowFocusChanged(boolean hasFocus) {
390         super.dispatchWindowFocusChanged(hasFocus);
391         mCalledDispatchWindowFocusChanged = true;
392     }
393 
hasCalledDispatchWindowFocusChanged()394     public boolean hasCalledDispatchWindowFocusChanged() {
395         return mCalledDispatchWindowFocusChanged;
396     }
397 
398     @Override
fitSystemWindows(Rect insets)399     protected boolean fitSystemWindows(Rect insets) {
400         return super.fitSystemWindows(insets);
401     }
402 
setMeasuredDimensionWrapper(int measuredWidth, int measuredHeight)403     public void setMeasuredDimensionWrapper(int measuredWidth, int measuredHeight) {
404         super.setMeasuredDimension(measuredWidth, measuredHeight);
405     }
406 
407     @Override
getHandler()408     public Handler getHandler() {
409         return super.getHandler();
410     }
411 
412     @Override
getWindowAttachCount()413     protected int getWindowAttachCount() {
414         return super.getWindowAttachCount();
415     }
416 
417     @Override
dispatchDraw(Canvas canvas)418     protected void dispatchDraw(Canvas canvas) {
419         super.dispatchDraw(canvas);
420         mCalledDispatchDraw = true;
421     }
422 
hasCalledDispatchDraw()423     public boolean hasCalledDispatchDraw() {
424         return mCalledDispatchDraw;
425     }
426 
427     @Override
dispatchUnhandledMove(View focused, int direction)428     public boolean dispatchUnhandledMove(View focused, int direction) {
429         mCalledDispatchUnhandledMove = true;
430         return super.dispatchUnhandledMove(focused, direction);
431     }
432 
hasCalledDispatchUnhandledMove()433     public boolean hasCalledDispatchUnhandledMove() {
434         return mCalledDispatchUnhandledMove;
435     }
436 
437     @Override
onWindowVisibilityChanged(int visibility)438     protected void onWindowVisibilityChanged(int visibility) {
439         super.onWindowVisibilityChanged(visibility);
440         mCalledOnWindowVisibilityChanged = true;
441     }
442 
hasCalledOnWindowVisibilityChanged()443     public boolean hasCalledOnWindowVisibilityChanged() {
444         return mCalledOnWindowVisibilityChanged;
445     }
446 
447     @Override
dispatchWindowVisibilityChanged(int visibility)448     public void dispatchWindowVisibilityChanged(int visibility) {
449         super.dispatchWindowVisibilityChanged(visibility);
450         mCalledDispatchWindowVisibilityChanged = true;
451     }
452 
hasCalledDispatchWindowVisibilityChanged()453     public boolean hasCalledDispatchWindowVisibilityChanged() {
454         return mCalledDispatchWindowVisibilityChanged;
455     }
456 
457     @Override
onWindowFocusChanged(boolean hasWindowFocus)458     public void onWindowFocusChanged(boolean hasWindowFocus) {
459         mCalledOnWindowFocusChanged = true;
460         super.onWindowFocusChanged(hasWindowFocus);
461     }
462 
hasCalledOnWindowFocusChanged()463     public boolean hasCalledOnWindowFocusChanged() {
464         return mCalledOnWindowFocusChanged;
465     }
466 
mergeDrawableStatesWrapper(int[] baseState, int[] additionalState)467     protected int[] mergeDrawableStatesWrapper(int[] baseState, int[] additionalState) {
468         return super.mergeDrawableStates(baseState, additionalState);
469     }
470 
471     @Override
onAttachedToWindow()472     protected void onAttachedToWindow() {
473         super.onAttachedToWindow();
474         mCalledOnAttachedToWindow = true;
475     }
476 
hasCalledOnAttachedToWindow()477     public boolean hasCalledOnAttachedToWindow() {
478         return mCalledOnAttachedToWindow;
479     }
480 
481     @Override
onDetachedFromWindow()482     protected void onDetachedFromWindow() {
483         super.onDetachedFromWindow();
484         mCalledOnDetachedFromWindow = true;
485     }
486 
hasCalledOnDetachedFromWindow()487     public boolean hasCalledOnDetachedFromWindow() {
488         return mCalledOnDetachedFromWindow;
489     }
490 
491     @Override
onDraw(Canvas canvas)492     protected void onDraw(Canvas canvas) {
493         super.onDraw(canvas);
494         mCalledOnDraw = true;
495     }
496 
hasCalledOnDraw()497     public boolean hasCalledOnDraw() {
498         return mCalledOnDraw;
499     }
500 
501     @Override
onFinishInflate()502     protected void onFinishInflate() {
503         super.onFinishInflate();
504         mCalledOnFinishInflate = true;
505     }
506 
hasCalledOnFinishInflate()507     public boolean hasCalledOnFinishInflate() {
508         return mCalledOnFinishInflate;
509     }
510 
511     @Override
onMeasure(int widthMeasureSpec, int heightMeasureSpec)512     protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
513         super.onMeasure(widthMeasureSpec, heightMeasureSpec);
514         mCalledOnMeasure = true;
515     }
516 
hasCalledOnMeasure()517     public boolean hasCalledOnMeasure() {
518         return mCalledOnMeasure;
519     }
520 
521     @Override
onSaveInstanceState()522     protected Parcelable onSaveInstanceState() {
523         mCalledOnSaveInstanceState = true;
524         return super.onSaveInstanceState();
525     }
526 
hasCalledOnSaveInstanceState()527     public boolean hasCalledOnSaveInstanceState() {
528         return mCalledOnSaveInstanceState;
529     }
530 
531     @Override
onRestoreInstanceState(Parcelable state)532     protected void onRestoreInstanceState(Parcelable state) {
533         super.onRestoreInstanceState(state);
534         mCalledOnRestoreInstanceState = true;
535     }
536 
hasCalledOnRestoreInstanceState()537     public boolean hasCalledOnRestoreInstanceState() {
538         return mCalledOnRestoreInstanceState;
539     }
540 
541     @Override
onSetAlpha(int alpha)542     protected boolean onSetAlpha(int alpha) {
543         mCalledOnSetAlpha = true;
544         return super.onSetAlpha(alpha);
545     }
546 
hasCalledOnSetAlpha()547     public boolean hasCalledOnSetAlpha() {
548         return mCalledOnSetAlpha;
549     }
550 
551     @Override
onFocusChanged(boolean gainFocus, int direction, Rect previouslyFocusedRect)552     protected void onFocusChanged(boolean gainFocus, int direction, Rect previouslyFocusedRect) {
553         super.onFocusChanged(gainFocus, direction, previouslyFocusedRect);
554         mCalledOnFocusChanged = true;
555     }
556 
hasCalledOnFocusChanged()557     public boolean hasCalledOnFocusChanged() {
558         return mCalledOnFocusChanged;
559     }
560 
561     @Override
onCreateDrawableState(int extraSpace)562     protected int[] onCreateDrawableState(int extraSpace) {
563         mCalledOnCreateDrawableState = true;
564         return super.onCreateDrawableState(extraSpace);
565     }
566 
hasCalledOnCreateDrawableState()567     public boolean hasCalledOnCreateDrawableState() {
568         return mCalledOnCreateDrawableState;
569     }
570 
571     @Override
playSoundEffect(int soundConstant)572     public void playSoundEffect(int soundConstant) {
573         super.playSoundEffect(soundConstant);
574     }
575 
576     @Override
dispatchRestoreInstanceState(SparseArray<Parcelable> container)577     protected void dispatchRestoreInstanceState(SparseArray<Parcelable> container) {
578         super.dispatchRestoreInstanceState(container);
579         mCalledDispatchRestoreInstanceState = true;
580     }
581 
hasCalledDispatchRestoreInstanceState()582     public boolean hasCalledDispatchRestoreInstanceState() {
583         return mCalledDispatchRestoreInstanceState;
584     }
585 
586     @Override
dispatchSaveInstanceState(SparseArray<Parcelable> container)587     protected void dispatchSaveInstanceState(SparseArray<Parcelable> container) {
588         super.dispatchSaveInstanceState(container);
589         mCalledDispatchSaveInstanceState = true;
590     }
591 
hasCalledDispatchSaveInstanceState()592     public boolean hasCalledDispatchSaveInstanceState() {
593         return mCalledDispatchSaveInstanceState;
594     }
595 
596     @Override
drawableStateChanged()597     protected void drawableStateChanged() {
598         super.drawableStateChanged();
599         mCalledDrawableStateChanged = true;
600     }
601 
hasCalledDrawableStateChanged()602     public boolean hasCalledDrawableStateChanged() {
603         return mCalledDrawableStateChanged;
604     }
605 
606     @Override
dispatchKeyEventPreIme(KeyEvent event)607     public boolean dispatchKeyEventPreIme(KeyEvent event) {
608         mCalledDispatchKeyEventPreIme = true;
609         return super.dispatchKeyEventPreIme(event);
610     }
611 
hasCalledDispatchKeyEventPreIme()612     public boolean hasCalledDispatchKeyEventPreIme() {
613         return mCalledDispatchKeyEventPreIme;
614     }
615 
616     @Override
onKeyPreIme(int keyCode, KeyEvent event)617     public boolean onKeyPreIme(int keyCode, KeyEvent event) {
618         mCalledOnKeyPreIme = true;
619         return super.onKeyPreIme(keyCode, event);
620     }
621 
hasCalledOnKeyPreIme()622     public boolean hasCalledOnKeyPreIme() {
623         return mCalledOnKeyPreIme;
624     }
625 
626     @Override
onResolvePointerIcon(MotionEvent event, int pointerIndex)627     public PointerIcon onResolvePointerIcon(MotionEvent event, int pointerIndex) {
628         mCalledOnResolvePointerIcon = true;
629         return super.onResolvePointerIcon(event, pointerIndex);
630     }
631 
hasCalledOnResolvePointerIcon()632     public boolean hasCalledOnResolvePointerIcon() {
633         return mCalledOnResolvePointerIcon;
634     }
635 
636     @Override
onVisibilityAggregated(boolean isVisible)637     public void onVisibilityAggregated(boolean isVisible) {
638         super.onVisibilityAggregated(isVisible);
639         mCalledOnVisibilityAggregated = true;
640         mLastAggregatedVisibility = isVisible;
641     }
642 
643     @Override
requestFocus(int direction, Rect previouslyFocusedRect)644     public boolean requestFocus(int direction, Rect previouslyFocusedRect) {
645         mCalledRequestFocus = true;
646         return super.requestFocus(direction, previouslyFocusedRect);
647     }
648 
hasCalledOnVisibilityAggregated()649     public boolean hasCalledOnVisibilityAggregated() {
650         return mCalledOnVisibilityAggregated;
651     }
652 
hasCalledRequestFocus()653     public boolean hasCalledRequestFocus() {
654         return mCalledRequestFocus;
655     }
656 
getLastAggregatedVisibility()657     public boolean getLastAggregatedVisibility() {
658         return mLastAggregatedVisibility;
659     }
660 
reset()661     public void reset() {
662         mCalledOnCreateContextMenu = false;
663 
664         mCalledOnAnimationStart = false;
665         mCalledOnAnimationEnd = false;
666         mCalledOnAttachedToWindow = false;
667         mCalledOnDetachedFromWindow = false;
668         mCalledOnCreateDrawableState = false;
669         mCalledDrawableStateChanged = false;
670         mCalledOnDraw = false;
671         mCalledDispatchDraw = false;
672         mCalledOnFinishInflate = false;
673         mCalledOnFocusChanged = false;
674         mCalledOnKeyDown = false;
675         mCalledOnKeyUp = false;
676         mCalledOnKeyMultiple = false;
677         mCalledOnKeyShortcut = false;
678         mCalledOnLayout = false;
679         mCalledOnMeasure = false;
680         mCalledOnSizeChanged = false;
681         mCalledOnSetAlpha = false;
682         mCalledOnTrackballEvent = false;
683         mCalledOnHoverEvent = false;
684         mCalledOnWindowFocusChanged = false;
685         mCalledDispatchRestoreInstanceState = false;
686         mCalledDispatchSaveInstanceState = false;
687         mCalledOnRestoreInstanceState = false;
688         mCalledOnSaveInstanceState = false;
689         mCalledDispatchUnhandledMove = false;
690         mCalledDispatchWindowFocusChanged = false;
691         mCalledDispatchWindowVisibilityChanged = false;
692         mCalledOnWindowVisibilityChanged = false;
693         mCalledOnScrollChanged = false;
694         mCalledInvalidate = false;
695         mCalledComputeScroll = false;
696         mCalledDispatchKeyEventPreIme = false;
697         mCalledOnKeyPreIme = false;
698         mCalledOnResolvePointerIcon = false;
699         mCalledOnVisibilityAggregated = false;
700         mCalledRequestFocus = false;
701 
702         mOldWidth = -1;
703         mOldHeight = -1;
704         mLastAggregatedVisibility = false;
705 
706         while (!mTouchEvents.isEmpty()) {
707             mTouchEvents.poll().recycle();
708         }
709     }
710 }
711