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