/**
* Choose the correct animation and set it to the passed WindowState.
* @param transit If AppTransition.TRANSIT_PREVIEW_DONE and the app window has been drawn
* then the animation will be app_starting_exit. Any other value loads the animation from
* the switch statement below.
* @param isEntrance The animation type the last time this was called. Used to keep from
* loading the same animation twice.
* @return true if an animation has been loaded.
*/booleanapplyAnimationLocked(int transit,boolean isEntrance){if(mWin.isAnimating()&& mAnimationIsEntrance == isEntrance){// If we are trying to apply an animation, but already running// an animation of the same type, then just leave that one alone.returntrue;}if(mWin.mAttrs.type ==TYPE_INPUT_METHOD){
mWin.getDisplayContent().adjustForImeIfNeeded();if(isEntrance){
mWin.setDisplayLayoutNeeded();
mService.mWindowPlacerLocked.requestTraversal(22);}}if(mWin.mControllableInsetProvider !=null){// All our animations should be driven by the insets control target.returnfalse;}// Only apply an animation if the display isn't frozen. If it is// frozen, there is no reason to animate and it can cause strange// artifacts when we unfreeze the display if some different animation// is running.if(mWin.mToken.okToAnimate()){int anim = mWin.getDisplayContent().getDisplayPolicy().selectAnimation(mWin, transit);int attr =-1;Animation a =null;if(anim !=DisplayPolicy.ANIMATION_STYLEABLE){if(anim !=DisplayPolicy.ANIMATION_NONE){Trace.traceBegin(Trace.TRACE_TAG_WINDOW_MANAGER,"WSA#loadAnimation");
a =AnimationUtils.loadAnimation(mContext, anim);Trace.traceEnd(Trace.TRACE_TAG_WINDOW_MANAGER);}}else{switch(transit){caseWindowManagerPolicy.TRANSIT_ENTER:if(1==1)thrownewRuntimeException("WindowManagerPolicy.TRANSIT_ENTER,isEntrance:"+isEntrance);
attr =com.android.internal.R.styleable.WindowAnimation_windowEnterAnimation;break;caseWindowManagerPolicy.TRANSIT_EXIT:// if(1==1) throw new RuntimeException("WindowManagerPolicy.TRANSIT_EXIT,isEntrance:"+isEntrance);
attr =com.android.internal.R.styleable.WindowAnimation_windowExitAnimation;break;caseWindowManagerPolicy.TRANSIT_SHOW:// if(1==1) throw new RuntimeException("WindowManagerPolicy.TRANSIT_SHOW,isEntrance:"+isEntrance);
attr =com.android.internal.R.styleable.WindowAnimation_windowShowAnimation;break;caseWindowManagerPolicy.TRANSIT_HIDE:// if(1==1) throw new RuntimeException("WindowManagerPolicy.TRANSIT_HIDE,isEntrance:"+isEntrance);
attr =com.android.internal.R.styleable.WindowAnimation_windowHideAnimation;break;}if(attr >=0){
a = mWin.getDisplayContent().mAppTransition.loadAnimationAttr(
mWin.mAttrs, attr,TRANSIT_OLD_NONE);}}if(ProtoLogImpl.isEnabled(WM_DEBUG_ANIM)){ProtoLog.v(WM_DEBUG_ANIM,"applyAnimation: win=%s"+" anim=%d attr=0x%x a=%s transit=%d type=%d isEntrance=%b Callers %s",this, anim, attr, a, transit, mAttrType, isEntrance,Debug.getCallers(20));}if(a !=null){Trace.traceBegin(Trace.TRACE_TAG_WINDOW_MANAGER,"WSA#startAnimation");
mWin.startAnimation(a);Trace.traceEnd(Trace.TRACE_TAG_WINDOW_MANAGER);
mAnimationIsEntrance = isEntrance;}}else{
mWin.cancelAnimation();}return mWin.isAnimating(0/* flags */,ANIMATION_TYPE_WINDOW_ANIMATION);}
java.lang.RuntimeException:WindowManagerPolicy.TRANSIT_ENTER,isEntrance:true
at com.android.server.wm.WindowStateAnimator.applyAnimationLocked(WindowStateAnimator.java:618)
at com.android.server.wm.WindowStateAnimator.applyEnterAnimationLocked(WindowStateAnimator.java:564)
at com.android.server.wm.WindowState.performShowLocked(WindowState.java:4694)
at com.android.server.wm.ActivityRecord.lambda$showAllWindowsLocked$17(ActivityRecord.java:6768)
at com.android.server.wm.ActivityRecord.$r8$lambda$EBjQ9_0_gnlxfoGHjA_CqMEFYX8(UnknownSource:0)
at com.android.server.wm.ActivityRecord$$ExternalSyntheticLambda36.accept(UnknownSource:2)
at com.android.server.wm.WindowContainer$ForAllWindowsConsumerWrapper.apply(WindowContainer.java:2729)
at com.android.server.wm.WindowContainer$ForAllWindowsConsumerWrapper.apply(WindowContainer.java:2719)
at com.android.server.wm.WindowState.applyInOrderWithImeWindows(WindowState.java:4953)
at com.android.server.wm.WindowState.forAllWindows(WindowState.java:4793)
at com.android.server.wm.WindowContainer.forAllWindows(WindowContainer.java:1707)
at com.android.server.wm.WindowContainer.forAllWindows(WindowContainer.java:1717)
at com.android.server.wm.ActivityRecord.showAllWindowsLocked(ActivityRecord.java:6766)
at com.android.server.wm.AppTransitionController.handleOpeningApps(AppTransitionController.java:1176)
at com.android.server.wm.AppTransitionController.handleAppTransitionReady(AppTransitionController.java:305)
at com.android.server.wm.RootWindowContainer.checkAppTransitionReady(RootWindowContainer.java:971)
at com.android.server.wm.RootWindowContainer.performSurfacePlacementNoTrace(RootWindowContainer.java:835)
at com.android.server.wm.RootWindowContainer.performSurfacePlacement(RootWindowContainer.java:778)
at com.android.server.wm.WindowSurfacePlacer.performSurfacePlacementLoop(WindowSurfacePlacer.java:178)
at com.android.server.wm.WindowSurfacePlacer.performSurfacePlacement(WindowSurfacePlacer.java:127)
at com.android.server.wm.WindowSurfacePlacer.performSurfacePlacement(WindowSurfacePlacer.java:116)
at com.android.server.wm.WindowSurfacePlacer$Traverser.run(WindowSurfacePlacer.java:58)
at android.os.Handler.handleCallback(Handler.java:942)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:201)
at android.os.Looper.loop(Looper.java:288)
at android.os.HandlerThread.run(HandlerThread.java:67)
at com.android.server.ServiceThread.run(ServiceThread.java:44)