Program: 191200
Project: 191200
Buggy source:
@Override public void handleMessage(Message msg){
  if (DEBUG_WINDOW_TRACE) {
    Slog.v(TAG_WM,"String_Node_Str" + msg.what);
  }
switch (msg.what) {
case REPORT_FOCUS_CHANGE:
{
      WindowState lastFocus;
      WindowState newFocus;
      AccessibilityController accessibilityController=null;
synchronized (mWindowMap) {
        if (mAccessibilityController != null && getDefaultDisplayContentLocked().getDisplayId() == Display.DEFAULT_DISPLAY) {
          accessibilityController=mAccessibilityController;
        }
        lastFocus=mLastFocus;
        newFocus=mCurrentFocus;
        if (lastFocus == newFocus) {
          return;
        }
        mLastFocus=newFocus;
        if (DEBUG_FOCUS_LIGHT)         Slog.i(TAG_WM,"String_Node_Str" + lastFocus + "String_Node_Str"+ newFocus);
        if (newFocus != null && lastFocus != null && !newFocus.isDisplayedLw()) {
          mLosingFocus.add(lastFocus);
          lastFocus=null;
        }
      }
      if (accessibilityController != null) {
        accessibilityController.onWindowFocusChangedNotLocked();
      }
      if (newFocus != null) {
        if (DEBUG_FOCUS_LIGHT)         Slog.i(TAG_WM,"String_Node_Str" + newFocus);
        newFocus.reportFocusChangedSerialized(true,mInTouchMode);
        notifyFocusChanged();
      }
      if (lastFocus != null) {
        if (DEBUG_FOCUS_LIGHT)         Slog.i(TAG_WM,"String_Node_Str" + lastFocus);
        lastFocus.reportFocusChangedSerialized(false,mInTouchMode);
      }
    }
  break;
case REPORT_LOSING_FOCUS:
{
  ArrayList<WindowState> losers;
synchronized (mWindowMap) {
    losers=mLosingFocus;
    mLosingFocus=new ArrayList<WindowState>();
  }
  final int N=losers.size();
  for (int i=0; i < N; i++) {
    if (DEBUG_FOCUS_LIGHT)     Slog.i(TAG_WM,"String_Node_Str" + losers.get(i));
    losers.get(i).reportFocusChangedSerialized(false,mInTouchMode);
  }
}
break;
case DO_TRAVERSAL:
{
synchronized (mWindowMap) {
mWindowPlacerLocked.performSurfacePlacement();
}
}
break;
case ADD_STARTING:
{
final AppWindowToken wtoken=(AppWindowToken)msg.obj;
final StartingData sd=wtoken.startingData;
if (sd == null) {
return;
}
if (DEBUG_STARTING_WINDOW) Slog.v(TAG_WM,"String_Node_Str" + wtoken + "String_Node_Str"+ sd.pkg);
View view=null;
try {
final Configuration overrideConfig=wtoken != null && wtoken.mTask != null ? wtoken.mTask.mOverrideConfig : null;
view=mPolicy.addStartingWindow(wtoken.token,sd.pkg,sd.theme,sd.compatInfo,sd.nonLocalizedLabel,sd.labelRes,sd.icon,sd.logo,sd.windowFlags,overrideConfig);
}
 catch (Exception e) {
Slog.w(TAG_WM,"String_Node_Str",e);
}
if (view != null) {
boolean abort=false;
synchronized (mWindowMap) {
if (wtoken.removed || wtoken.startingData == null) {
if (wtoken.startingWindow != null) {
  if (DEBUG_STARTING_WINDOW)   Slog.v(TAG_WM,"String_Node_Str" + wtoken + "String_Node_Str"+ wtoken.removed+ "String_Node_Str"+ wtoken.startingData);
  wtoken.startingWindow=null;
  wtoken.startingData=null;
  abort=true;
}
}
 else {
wtoken.startingView=view;
}
if (DEBUG_STARTING_WINDOW && !abort) Slog.v(TAG_WM,"String_Node_Str" + wtoken + "String_Node_Str"+ wtoken.startingWindow+ "String_Node_Str"+ wtoken.startingView);
}
if (abort) {
try {
mPolicy.removeStartingWindow(wtoken.token,view);
}
 catch (Exception e) {
Slog.w(TAG_WM,"String_Node_Str",e);
}
}
}
}
break;
case REMOVE_STARTING:
{
final AppWindowToken wtoken=(AppWindowToken)msg.obj;
IBinder token=null;
View view=null;
synchronized (mWindowMap) {
if (DEBUG_STARTING_WINDOW) Slog.v(TAG_WM,"String_Node_Str" + wtoken + "String_Node_Str"+ wtoken.startingWindow+ "String_Node_Str"+ wtoken.startingView);
if (wtoken.startingWindow != null) {
view=wtoken.startingView;
token=wtoken.token;
wtoken.startingData=null;
wtoken.startingView=null;
wtoken.startingWindow=null;
wtoken.startingDisplayed=false;
}
}
if (view != null) {
try {
mPolicy.removeStartingWindow(token,view);
}
 catch (Exception e) {
Slog.w(TAG_WM,"String_Node_Str",e);
}
}
}
break;
case FINISHED_STARTING:
{
IBinder token=null;
View view=null;
while (true) {
synchronized (mWindowMap) {
final int N=mFinishedStarting.size();
if (N <= 0) {
break;
}
AppWindowToken wtoken=mFinishedStarting.remove(N - 1);
if (DEBUG_STARTING_WINDOW) Slog.v(TAG_WM,"String_Node_Str" + wtoken + "String_Node_Str"+ wtoken.startingWindow+ "String_Node_Str"+ wtoken.startingView);
if (wtoken.startingWindow == null) {
continue;
}
view=wtoken.startingView;
token=wtoken.token;
wtoken.startingData=null;
wtoken.startingView=null;
wtoken.startingWindow=null;
wtoken.startingDisplayed=false;
}
try {
mPolicy.removeStartingWindow(token,view);
}
 catch (Exception e) {
Slog.w(TAG_WM,"String_Node_Str",e);
}
}
}
break;
case REPORT_APPLICATION_TOKEN_DRAWN:
{
final AppWindowToken wtoken=(AppWindowToken)msg.obj;
try {
if (DEBUG_VISIBILITY) Slog.v(TAG_WM,"String_Node_Str" + wtoken);
wtoken.appToken.windowsDrawn();
}
 catch (RemoteException ex) {
}
}
break;
case REPORT_APPLICATION_TOKEN_WINDOWS:
{
final AppWindowToken wtoken=(AppWindowToken)msg.obj;
boolean nowVisible=msg.arg1 != 0;
boolean nowGone=msg.arg2 != 0;
try {
if (DEBUG_VISIBILITY) Slog.v(TAG_WM,"String_Node_Str" + wtoken + "String_Node_Str"+ nowVisible+ "String_Node_Str"+ nowGone);
if (nowVisible) {
wtoken.appToken.windowsVisible();
}
 else {
wtoken.appToken.windowsGone();
}
}
 catch (RemoteException ex) {
}
}
break;
case WINDOW_FREEZE_TIMEOUT:
{
synchronized (mWindowMap) {
Slog.w(TAG_WM,"String_Node_Str");
mWindowsFreezingScreen=WINDOWS_FREEZING_SCREENS_TIMEOUT;
final WindowList windows=getDefaultWindowListLocked();
int i=windows.size();
while (i > 0) {
i--;
WindowState w=windows.get(i);
if (w.mOrientationChanging) {
w.mOrientationChanging=false;
w.mLastFreezeDuration=(int)(SystemClock.elapsedRealtime() - mDisplayFreezeTime);
Slog.w(TAG_WM,"String_Node_Str" + w);
}
}
mWindowPlacerLocked.performSurfacePlacement();
}
break;
}
case APP_TRANSITION_TIMEOUT:
{
synchronized (mWindowMap) {
if (mAppTransition.isTransitionSet() || !mOpeningApps.isEmpty() || !mClosingApps.isEmpty()) {
if (DEBUG_APP_TRANSITIONS) Slog.v(TAG_WM,"String_Node_Str" + "String_Node_Str" + mAppTransition.isTransitionSet() + "String_Node_Str"+ mOpeningApps.size()+ "String_Node_Str"+ mClosingApps.size());
mAppTransition.setTimeout();
mWindowPlacerLocked.performSurfacePlacement();
}
}
break;
}
case PERSIST_ANIMATION_SCALE:
{
Settings.Global.putFloat(mContext.getContentResolver(),Settings.Global.WINDOW_ANIMATION_SCALE,mWindowAnimationScaleSetting);
Settings.Global.putFloat(mContext.getContentResolver(),Settings.Global.TRANSITION_ANIMATION_SCALE,mTransitionAnimationScaleSetting);
Settings.Global.putFloat(mContext.getContentResolver(),Settings.Global.ANIMATOR_DURATION_SCALE,mAnimatorDurationScaleSetting);
break;
}
case UPDATE_ANIMATION_SCALE:
{
@UpdateAnimationScaleMode final int mode=msg.arg1;
switch (mode) {
case WINDOW_ANIMATION_SCALE:
{
mWindowAnimationScaleSetting=Settings.Global.getFloat(mContext.getContentResolver(),Settings.Global.WINDOW_ANIMATION_SCALE,mWindowAnimationScaleSetting);
break;
}
case TRANSITION_ANIMATION_SCALE:
{
mTransitionAnimationScaleSetting=Settings.Global.getFloat(mContext.getContentResolver(),Settings.Global.TRANSITION_ANIMATION_SCALE,mTransitionAnimationScaleSetting);
break;
}
case ANIMATION_DURATION_SCALE:
{
mAnimatorDurationScaleSetting=Settings.Global.getFloat(mContext.getContentResolver(),Settings.Global.ANIMATOR_DURATION_SCALE,mAnimatorDurationScaleSetting);
dispatchNewAnimatorScaleLocked(null);
break;
}
}
break;
}
case FORCE_GC:
{
synchronized (mWindowMap) {
if (mAnimator.isAnimating() || mAnimationScheduled) {
sendEmptyMessageDelayed(H.FORCE_GC,2000);
return;
}
if (mDisplayFrozen) {
return;
}
}
Runtime.getRuntime().gc();
break;
}
case ENABLE_SCREEN:
{
performEnableScreen();
break;
}
case APP_FREEZE_TIMEOUT:
{
synchronized (mWindowMap) {
Slog.w(TAG_WM,"String_Node_Str");
mWindowsFreezingScreen=WINDOWS_FREEZING_SCREENS_TIMEOUT;
final int numStacks=mStackIdToStack.size();
for (int stackNdx=0; stackNdx < numStacks; ++stackNdx) {
final TaskStack stack=mStackIdToStack.valueAt(stackNdx);
final ArrayList<Task> tasks=stack.getTasks();
for (int taskNdx=tasks.size() - 1; taskNdx >= 0; --taskNdx) {
AppTokenList tokens=tasks.get(taskNdx).mAppTokens;
for (int tokenNdx=tokens.size() - 1; tokenNdx >= 0; --tokenNdx) {
AppWindowToken tok=tokens.get(tokenNdx);
if (tok.mAppAnimator.freezingScreen) {
Slog.w(TAG_WM,"String_Node_Str" + tok);
unsetAppFreezingScreenLocked(tok,true,true);
}
}
}
}
}
break;
}
case CLIENT_FREEZE_TIMEOUT:
{
synchronized (mWindowMap) {
if (mClientFreezingScreen) {
mClientFreezingScreen=false;
mLastFinishedFreezeSource="String_Node_Str";
stopFreezingDisplayLocked();
}
}
break;
}
case SEND_NEW_CONFIGURATION:
{
removeMessages(SEND_NEW_CONFIGURATION);
sendNewConfiguration();
break;
}
case REPORT_WINDOWS_CHANGE:
{
if (mWindowsChanged) {
synchronized (mWindowMap) {
mWindowsChanged=false;
}
notifyWindowsChanged();
}
break;
}
case DRAG_START_TIMEOUT:
{
IBinder win=(IBinder)msg.obj;
if (DEBUG_DRAG) {
Slog.w(TAG_WM,"String_Node_Str" + win);
}
synchronized (mWindowMap) {
if (mDragState != null) {
mDragState.unregister();
mInputMonitor.updateInputWindowsLw(true);
mDragState.reset();
mDragState=null;
}
}
break;
}
case DRAG_END_TIMEOUT:
{
IBinder win=(IBinder)msg.obj;
if (DEBUG_DRAG) {
Slog.w(TAG_WM,"String_Node_Str" + win);
}
synchronized (mWindowMap) {
if (mDragState != null) {
mDragState.mDragResult=false;
mDragState.endDragLw();
}
}
break;
}
case REPORT_HARD_KEYBOARD_STATUS_CHANGE:
{
notifyHardKeyboardStatusChange();
break;
}
case BOOT_TIMEOUT:
{
performBootTimeout();
break;
}
case WAITING_FOR_DRAWN_TIMEOUT:
{
Runnable callback=null;
synchronized (mWindowMap) {
Slog.w(TAG_WM,"String_Node_Str" + mWaitingForDrawn);
mWaitingForDrawn.clear();
callback=mWaitingForDrawnCallback;
mWaitingForDrawnCallback=null;
}
if (callback != null) {
callback.run();
}
break;
}
case SHOW_STRICT_MODE_VIOLATION:
{
showStrictModeViolation(msg.arg1,msg.arg2);
break;
}
case SHOW_CIRCULAR_DISPLAY_MASK:
{
showCircularMask(msg.arg1 == 1);
break;
}
case SHOW_EMULATOR_DISPLAY_OVERLAY:
{
showEmulatorDisplayOverlay();
break;
}
case DO_ANIMATION_CALLBACK:
{
try {
((IRemoteCallback)msg.obj).sendResult(null);
}
 catch (RemoteException e) {
}
break;
}
case DO_DISPLAY_ADDED:
handleDisplayAdded(msg.arg1);
break;
case DO_DISPLAY_REMOVED:
synchronized (mWindowMap) {
handleDisplayRemovedLocked(msg.arg1);
}
break;
case DO_DISPLAY_CHANGED:
synchronized (mWindowMap) {
handleDisplayChangedLocked(msg.arg1);
}
break;
case TWO_FINGER_SCROLL_START:
{
startScrollingTask((DisplayContent)msg.obj,msg.arg1,msg.arg2);
}
break;
case TAP_OUTSIDE_TASK:
{
handleTapOutsideTask((DisplayContent)msg.obj,msg.arg1,msg.arg2);
}
break;
case FINISH_TASK_POSITIONING:
{
finishPositioning();
}
break;
case NOTIFY_ACTIVITY_DRAWN:
try {
mActivityManager.notifyActivityDrawn((IBinder)msg.obj);
}
 catch (RemoteException e) {
}
break;
case ALL_WINDOWS_DRAWN:
{
Runnable callback;
synchronized (mWindowMap) {
callback=mWaitingForDrawnCallback;
mWaitingForDrawnCallback=null;
}
if (callback != null) {
callback.run();
}
}
case NEW_ANIMATOR_SCALE:
{
float scale=getCurrentAnimatorScale();
ValueAnimator.setDurationScale(scale);
Session session=(Session)msg.obj;
if (session != null) {
try {
session.mCallback.onAnimatorScaleChanged(scale);
}
 catch (RemoteException e) {
}
}
 else {
ArrayList<IWindowSessionCallback> callbacks=new ArrayList<IWindowSessionCallback>();
synchronized (mWindowMap) {
for (int i=0; i < mSessions.size(); i++) {
callbacks.add(mSessions.valueAt(i).mCallback);
}
}
for (int i=0; i < callbacks.size(); i++) {
try {
callbacks.get(i).onAnimatorScaleChanged(scale);
}
 catch (RemoteException e) {
}
}
}
}
break;
case CHECK_IF_BOOT_ANIMATION_FINISHED:
{
final boolean bootAnimationComplete;
synchronized (mWindowMap) {
if (DEBUG_BOOT) Slog.i(TAG_WM,"String_Node_Str");
bootAnimationComplete=checkBootAnimationCompleteLocked();
}
if (bootAnimationComplete) {
performEnableScreen();
}
}
break;
case RESET_ANR_MESSAGE:
{
synchronized (mWindowMap) {
mLastANRState=null;
}
}
break;
case WALLPAPER_DRAW_PENDING_TIMEOUT:
{
synchronized (mWindowMap) {
if (mWallpaperControllerLocked.processWallpaperDrawPendingTimeout()) {
mWindowPlacerLocked.performSurfacePlacement();
}
}
}
case UPDATE_DOCKED_STACK_DIVIDER:
{
synchronized (mWindowMap) {
final DisplayContent displayContent=getDefaultDisplayContentLocked();
displayContent.getDockedDividerController().reevaluateVisibility(false);
adjustForImeIfNeeded(displayContent);
}
}
break;
case RESIZE_TASK:
{
try {
mActivityManager.resizeTask(msg.arg1,(Rect)msg.obj,msg.arg2);
}
 catch (RemoteException e) {
}
}
break;
case RESIZE_STACK:
{
try {
mActivityManager.resizeStack(msg.arg1,(Rect)msg.obj,msg.arg2 == 1,false,false,-1);
}
 catch (RemoteException e) {
}
}
break;
case WINDOW_REPLACEMENT_TIMEOUT:
{
synchronized (mWindowMap) {
for (int i=mReplacingWindowTimeouts.size() - 1; i >= 0; i--) {
final AppWindowToken token=mReplacingWindowTimeouts.get(i);
token.clearTimedoutReplacesLocked();
}
mReplacingWindowTimeouts.clear();
}
}
case NOTIFY_APP_TRANSITION_STARTING:
{
mAmInternal.notifyAppTransitionStarting(msg.arg1);
}
break;
case NOTIFY_APP_TRANSITION_CANCELLED:
{
mAmInternal.notifyAppTransitionCancelled();
}
break;
case NOTIFY_APP_TRANSITION_FINISHED:
{
mAmInternal.notifyAppTransitionFinished();
}
break;
case NOTIFY_STARTING_WINDOW_DRAWN:
{
mAmInternal.notifyStartingWindowDrawn();
}
break;
case WINDOW_REMOVE_TIMEOUT:
{
final WindowState window=(WindowState)msg.obj;
synchronized (mWindowMap) {
window.mAttrs.flags&=~FLAG_KEEP_SCREEN_ON;
window.setDisplayLayoutNeeded();
mWindowPlacerLocked.performSurfacePlacement();
}
}
break;
case NOTIFY_DOCKED_STACK_MINIMIZED_CHANGED:
{
mAmInternal.notifyDockedStackMinimizedChanged(msg.arg1 == 1);
}
break;
case SEAMLESS_ROTATION_TIMEOUT:
{
final DisplayContent displayContent=getDefaultDisplayContentLocked();
final WindowList windows=displayContent.getWindowList();
boolean layoutNeeded=false;
for (int i=windows.size() - 1; i >= 0; i--) {
WindowState w=windows.get(i);
if (w.mSeamlesslyRotated) {
layoutNeeded=true;
w.setDisplayLayoutNeeded();
}
w.mSeamlesslyRotated=false;
}
if (layoutNeeded) {
mWindowPlacerLocked.performSurfacePlacement();
}
}
break;
}
if (DEBUG_WINDOW_TRACE) {
Slog.v(TAG_WM,"String_Node_Str");
}
}

Fixed version (ground truth):
@Override public void handleMessage(Message msg){
  if (DEBUG_WINDOW_TRACE) {
    Slog.v(TAG_WM,"String_Node_Str" + msg.what);
  }
switch (msg.what) {
case REPORT_FOCUS_CHANGE:
{
      WindowState lastFocus;
      WindowState newFocus;
      AccessibilityController accessibilityController=null;
synchronized (mWindowMap) {
        if (mAccessibilityController != null && getDefaultDisplayContentLocked().getDisplayId() == Display.DEFAULT_DISPLAY) {
          accessibilityController=mAccessibilityController;
        }
        lastFocus=mLastFocus;
        newFocus=mCurrentFocus;
        if (lastFocus == newFocus) {
          return;
        }
        mLastFocus=newFocus;
        if (DEBUG_FOCUS_LIGHT)         Slog.i(TAG_WM,"String_Node_Str" + lastFocus + "String_Node_Str"+ newFocus);
        if (newFocus != null && lastFocus != null && !newFocus.isDisplayedLw()) {
          mLosingFocus.add(lastFocus);
          lastFocus=null;
        }
      }
      if (accessibilityController != null) {
        accessibilityController.onWindowFocusChangedNotLocked();
      }
      if (newFocus != null) {
        if (DEBUG_FOCUS_LIGHT)         Slog.i(TAG_WM,"String_Node_Str" + newFocus);
        newFocus.reportFocusChangedSerialized(true,mInTouchMode);
        notifyFocusChanged();
      }
      if (lastFocus != null) {
        if (DEBUG_FOCUS_LIGHT)         Slog.i(TAG_WM,"String_Node_Str" + lastFocus);
        lastFocus.reportFocusChangedSerialized(false,mInTouchMode);
      }
    }
  break;
case REPORT_LOSING_FOCUS:
{
  ArrayList<WindowState> losers;
synchronized (mWindowMap) {
    losers=mLosingFocus;
    mLosingFocus=new ArrayList<WindowState>();
  }
  final int N=losers.size();
  for (int i=0; i < N; i++) {
    if (DEBUG_FOCUS_LIGHT)     Slog.i(TAG_WM,"String_Node_Str" + losers.get(i));
    losers.get(i).reportFocusChangedSerialized(false,mInTouchMode);
  }
}
break;
case DO_TRAVERSAL:
{
synchronized (mWindowMap) {
mWindowPlacerLocked.performSurfacePlacement();
}
}
break;
case ADD_STARTING:
{
final AppWindowToken wtoken=(AppWindowToken)msg.obj;
final StartingData sd=wtoken.startingData;
if (sd == null) {
return;
}
if (DEBUG_STARTING_WINDOW) Slog.v(TAG_WM,"String_Node_Str" + wtoken + "String_Node_Str"+ sd.pkg);
View view=null;
try {
final Configuration overrideConfig=wtoken != null && wtoken.mTask != null ? wtoken.mTask.mOverrideConfig : null;
view=mPolicy.addStartingWindow(wtoken.token,sd.pkg,sd.theme,sd.compatInfo,sd.nonLocalizedLabel,sd.labelRes,sd.icon,sd.logo,sd.windowFlags,overrideConfig);
}
 catch (Exception e) {
Slog.w(TAG_WM,"String_Node_Str",e);
}
if (view != null) {
boolean abort=false;
synchronized (mWindowMap) {
if (wtoken.removed || wtoken.startingData == null) {
if (wtoken.startingWindow != null) {
  if (DEBUG_STARTING_WINDOW)   Slog.v(TAG_WM,"String_Node_Str" + wtoken + "String_Node_Str"+ wtoken.removed+ "String_Node_Str"+ wtoken.startingData);
  wtoken.startingWindow=null;
  wtoken.startingData=null;
  abort=true;
}
}
 else {
wtoken.startingView=view;
}
if (DEBUG_STARTING_WINDOW && !abort) Slog.v(TAG_WM,"String_Node_Str" + wtoken + "String_Node_Str"+ wtoken.startingWindow+ "String_Node_Str"+ wtoken.startingView);
}
if (abort) {
try {
mPolicy.removeStartingWindow(wtoken.token,view);
}
 catch (Exception e) {
Slog.w(TAG_WM,"String_Node_Str",e);
}
}
}
}
break;
case REMOVE_STARTING:
{
final AppWindowToken wtoken=(AppWindowToken)msg.obj;
IBinder token=null;
View view=null;
synchronized (mWindowMap) {
if (DEBUG_STARTING_WINDOW) Slog.v(TAG_WM,"String_Node_Str" + wtoken + "String_Node_Str"+ wtoken.startingWindow+ "String_Node_Str"+ wtoken.startingView);
if (wtoken.startingWindow != null) {
view=wtoken.startingView;
token=wtoken.token;
wtoken.startingData=null;
wtoken.startingView=null;
wtoken.startingWindow=null;
wtoken.startingDisplayed=false;
}
}
if (view != null) {
try {
mPolicy.removeStartingWindow(token,view);
}
 catch (Exception e) {
Slog.w(TAG_WM,"String_Node_Str",e);
}
}
}
break;
case FINISHED_STARTING:
{
IBinder token=null;
View view=null;
while (true) {
synchronized (mWindowMap) {
final int N=mFinishedStarting.size();
if (N <= 0) {
break;
}
AppWindowToken wtoken=mFinishedStarting.remove(N - 1);
if (DEBUG_STARTING_WINDOW) Slog.v(TAG_WM,"String_Node_Str" + wtoken + "String_Node_Str"+ wtoken.startingWindow+ "String_Node_Str"+ wtoken.startingView);
if (wtoken.startingWindow == null) {
continue;
}
view=wtoken.startingView;
token=wtoken.token;
wtoken.startingData=null;
wtoken.startingView=null;
wtoken.startingWindow=null;
wtoken.startingDisplayed=false;
}
try {
mPolicy.removeStartingWindow(token,view);
}
 catch (Exception e) {
Slog.w(TAG_WM,"String_Node_Str",e);
}
}
}
break;
case REPORT_APPLICATION_TOKEN_DRAWN:
{
final AppWindowToken wtoken=(AppWindowToken)msg.obj;
try {
if (DEBUG_VISIBILITY) Slog.v(TAG_WM,"String_Node_Str" + wtoken);
wtoken.appToken.windowsDrawn();
}
 catch (RemoteException ex) {
}
}
break;
case REPORT_APPLICATION_TOKEN_WINDOWS:
{
final AppWindowToken wtoken=(AppWindowToken)msg.obj;
boolean nowVisible=msg.arg1 != 0;
boolean nowGone=msg.arg2 != 0;
try {
if (DEBUG_VISIBILITY) Slog.v(TAG_WM,"String_Node_Str" + wtoken + "String_Node_Str"+ nowVisible+ "String_Node_Str"+ nowGone);
if (nowVisible) {
wtoken.appToken.windowsVisible();
}
 else {
wtoken.appToken.windowsGone();
}
}
 catch (RemoteException ex) {
}
}
break;
case WINDOW_FREEZE_TIMEOUT:
{
synchronized (mWindowMap) {
Slog.w(TAG_WM,"String_Node_Str");
mWindowsFreezingScreen=WINDOWS_FREEZING_SCREENS_TIMEOUT;
final WindowList windows=getDefaultWindowListLocked();
int i=windows.size();
while (i > 0) {
i--;
WindowState w=windows.get(i);
if (w.mOrientationChanging) {
w.mOrientationChanging=false;
w.mLastFreezeDuration=(int)(SystemClock.elapsedRealtime() - mDisplayFreezeTime);
Slog.w(TAG_WM,"String_Node_Str" + w);
}
}
mWindowPlacerLocked.performSurfacePlacement();
}
break;
}
case APP_TRANSITION_TIMEOUT:
{
synchronized (mWindowMap) {
if (mAppTransition.isTransitionSet() || !mOpeningApps.isEmpty() || !mClosingApps.isEmpty()) {
if (DEBUG_APP_TRANSITIONS) Slog.v(TAG_WM,"String_Node_Str" + "String_Node_Str" + mAppTransition.isTransitionSet() + "String_Node_Str"+ mOpeningApps.size()+ "String_Node_Str"+ mClosingApps.size());
mAppTransition.setTimeout();
mWindowPlacerLocked.performSurfacePlacement();
}
}
break;
}
case PERSIST_ANIMATION_SCALE:
{
Settings.Global.putFloat(mContext.getContentResolver(),Settings.Global.WINDOW_ANIMATION_SCALE,mWindowAnimationScaleSetting);
Settings.Global.putFloat(mContext.getContentResolver(),Settings.Global.TRANSITION_ANIMATION_SCALE,mTransitionAnimationScaleSetting);
Settings.Global.putFloat(mContext.getContentResolver(),Settings.Global.ANIMATOR_DURATION_SCALE,mAnimatorDurationScaleSetting);
break;
}
case UPDATE_ANIMATION_SCALE:
{
@UpdateAnimationScaleMode final int mode=msg.arg1;
switch (mode) {
case WINDOW_ANIMATION_SCALE:
{
mWindowAnimationScaleSetting=Settings.Global.getFloat(mContext.getContentResolver(),Settings.Global.WINDOW_ANIMATION_SCALE,mWindowAnimationScaleSetting);
break;
}
case TRANSITION_ANIMATION_SCALE:
{
mTransitionAnimationScaleSetting=Settings.Global.getFloat(mContext.getContentResolver(),Settings.Global.TRANSITION_ANIMATION_SCALE,mTransitionAnimationScaleSetting);
break;
}
case ANIMATION_DURATION_SCALE:
{
mAnimatorDurationScaleSetting=Settings.Global.getFloat(mContext.getContentResolver(),Settings.Global.ANIMATOR_DURATION_SCALE,mAnimatorDurationScaleSetting);
dispatchNewAnimatorScaleLocked(null);
break;
}
}
break;
}
case FORCE_GC:
{
synchronized (mWindowMap) {
if (mAnimator.isAnimating() || mAnimationScheduled) {
sendEmptyMessageDelayed(H.FORCE_GC,2000);
return;
}
if (mDisplayFrozen) {
return;
}
}
Runtime.getRuntime().gc();
break;
}
case ENABLE_SCREEN:
{
performEnableScreen();
break;
}
case APP_FREEZE_TIMEOUT:
{
synchronized (mWindowMap) {
Slog.w(TAG_WM,"String_Node_Str");
mWindowsFreezingScreen=WINDOWS_FREEZING_SCREENS_TIMEOUT;
final int numStacks=mStackIdToStack.size();
for (int stackNdx=0; stackNdx < numStacks; ++stackNdx) {
final TaskStack stack=mStackIdToStack.valueAt(stackNdx);
final ArrayList<Task> tasks=stack.getTasks();
for (int taskNdx=tasks.size() - 1; taskNdx >= 0; --taskNdx) {
AppTokenList tokens=tasks.get(taskNdx).mAppTokens;
for (int tokenNdx=tokens.size() - 1; tokenNdx >= 0; --tokenNdx) {
AppWindowToken tok=tokens.get(tokenNdx);
if (tok.mAppAnimator.freezingScreen) {
Slog.w(TAG_WM,"String_Node_Str" + tok);
unsetAppFreezingScreenLocked(tok,true,true);
}
}
}
}
}
break;
}
case CLIENT_FREEZE_TIMEOUT:
{
synchronized (mWindowMap) {
if (mClientFreezingScreen) {
mClientFreezingScreen=false;
mLastFinishedFreezeSource="String_Node_Str";
stopFreezingDisplayLocked();
}
}
break;
}
case SEND_NEW_CONFIGURATION:
{
removeMessages(SEND_NEW_CONFIGURATION);
sendNewConfiguration();
break;
}
case REPORT_WINDOWS_CHANGE:
{
if (mWindowsChanged) {
synchronized (mWindowMap) {
mWindowsChanged=false;
}
notifyWindowsChanged();
}
break;
}
case DRAG_START_TIMEOUT:
{
IBinder win=(IBinder)msg.obj;
if (DEBUG_DRAG) {
Slog.w(TAG_WM,"String_Node_Str" + win);
}
synchronized (mWindowMap) {
if (mDragState != null) {
mDragState.unregister();
mInputMonitor.updateInputWindowsLw(true);
mDragState.reset();
mDragState=null;
}
}
break;
}
case DRAG_END_TIMEOUT:
{
IBinder win=(IBinder)msg.obj;
if (DEBUG_DRAG) {
Slog.w(TAG_WM,"String_Node_Str" + win);
}
synchronized (mWindowMap) {
if (mDragState != null) {
mDragState.mDragResult=false;
mDragState.endDragLw();
}
}
break;
}
case REPORT_HARD_KEYBOARD_STATUS_CHANGE:
{
notifyHardKeyboardStatusChange();
break;
}
case BOOT_TIMEOUT:
{
performBootTimeout();
break;
}
case WAITING_FOR_DRAWN_TIMEOUT:
{
Runnable callback=null;
synchronized (mWindowMap) {
Slog.w(TAG_WM,"String_Node_Str" + mWaitingForDrawn);
mWaitingForDrawn.clear();
callback=mWaitingForDrawnCallback;
mWaitingForDrawnCallback=null;
}
if (callback != null) {
callback.run();
}
break;
}
case SHOW_STRICT_MODE_VIOLATION:
{
showStrictModeViolation(msg.arg1,msg.arg2);
break;
}
case SHOW_CIRCULAR_DISPLAY_MASK:
{
showCircularMask(msg.arg1 == 1);
break;
}
case SHOW_EMULATOR_DISPLAY_OVERLAY:
{
showEmulatorDisplayOverlay();
break;
}
case DO_ANIMATION_CALLBACK:
{
try {
((IRemoteCallback)msg.obj).sendResult(null);
}
 catch (RemoteException e) {
}
break;
}
case DO_DISPLAY_ADDED:
handleDisplayAdded(msg.arg1);
break;
case DO_DISPLAY_REMOVED:
synchronized (mWindowMap) {
handleDisplayRemovedLocked(msg.arg1);
}
break;
case DO_DISPLAY_CHANGED:
synchronized (mWindowMap) {
handleDisplayChangedLocked(msg.arg1);
}
break;
case TWO_FINGER_SCROLL_START:
{
startScrollingTask((DisplayContent)msg.obj,msg.arg1,msg.arg2);
}
break;
case TAP_OUTSIDE_TASK:
{
handleTapOutsideTask((DisplayContent)msg.obj,msg.arg1,msg.arg2);
}
break;
case FINISH_TASK_POSITIONING:
{
finishPositioning();
}
break;
case NOTIFY_ACTIVITY_DRAWN:
try {
mActivityManager.notifyActivityDrawn((IBinder)msg.obj);
}
 catch (RemoteException e) {
}
break;
case ALL_WINDOWS_DRAWN:
{
Runnable callback;
synchronized (mWindowMap) {
callback=mWaitingForDrawnCallback;
mWaitingForDrawnCallback=null;
}
if (callback != null) {
callback.run();
}
}
case NEW_ANIMATOR_SCALE:
{
float scale=getCurrentAnimatorScale();
ValueAnimator.setDurationScale(scale);
Session session=(Session)msg.obj;
if (session != null) {
try {
session.mCallback.onAnimatorScaleChanged(scale);
}
 catch (RemoteException e) {
}
}
 else {
ArrayList<IWindowSessionCallback> callbacks=new ArrayList<IWindowSessionCallback>();
synchronized (mWindowMap) {
for (int i=0; i < mSessions.size(); i++) {
callbacks.add(mSessions.valueAt(i).mCallback);
}
}
for (int i=0; i < callbacks.size(); i++) {
try {
callbacks.get(i).onAnimatorScaleChanged(scale);
}
 catch (RemoteException e) {
}
}
}
}
break;
case CHECK_IF_BOOT_ANIMATION_FINISHED:
{
final boolean bootAnimationComplete;
synchronized (mWindowMap) {
if (DEBUG_BOOT) Slog.i(TAG_WM,"String_Node_Str");
bootAnimationComplete=checkBootAnimationCompleteLocked();
}
if (bootAnimationComplete) {
performEnableScreen();
}
}
break;
case RESET_ANR_MESSAGE:
{
synchronized (mWindowMap) {
mLastANRState=null;
}
}
break;
case WALLPAPER_DRAW_PENDING_TIMEOUT:
{
synchronized (mWindowMap) {
if (mWallpaperControllerLocked.processWallpaperDrawPendingTimeout()) {
mWindowPlacerLocked.performSurfacePlacement();
}
}
}
case UPDATE_DOCKED_STACK_DIVIDER:
{
synchronized (mWindowMap) {
final DisplayContent displayContent=getDefaultDisplayContentLocked();
displayContent.getDockedDividerController().reevaluateVisibility(false);
adjustForImeIfNeeded(displayContent);
}
}
break;
case RESIZE_TASK:
{
try {
mActivityManager.resizeTask(msg.arg1,(Rect)msg.obj,msg.arg2);
}
 catch (RemoteException e) {
}
}
break;
case RESIZE_STACK:
{
try {
mActivityManager.resizeStack(msg.arg1,(Rect)msg.obj,msg.arg2 == 1,false,false,-1);
}
 catch (RemoteException e) {
}
}
break;
case WINDOW_REPLACEMENT_TIMEOUT:
{
synchronized (mWindowMap) {
for (int i=mReplacingWindowTimeouts.size() - 1; i >= 0; i--) {
final AppWindowToken token=mReplacingWindowTimeouts.get(i);
token.clearTimedoutReplacesLocked();
}
mReplacingWindowTimeouts.clear();
}
}
case NOTIFY_APP_TRANSITION_STARTING:
{
mAmInternal.notifyAppTransitionStarting(msg.arg1);
}
break;
case NOTIFY_APP_TRANSITION_CANCELLED:
{
mAmInternal.notifyAppTransitionCancelled();
}
break;
case NOTIFY_APP_TRANSITION_FINISHED:
{
mAmInternal.notifyAppTransitionFinished();
}
break;
case NOTIFY_STARTING_WINDOW_DRAWN:
{
mAmInternal.notifyStartingWindowDrawn();
}
break;
case WINDOW_REMOVE_TIMEOUT:
{
final WindowState window=(WindowState)msg.obj;
synchronized (mWindowMap) {
window.mAttrs.flags&=~FLAG_KEEP_SCREEN_ON;
window.setDisplayLayoutNeeded();
mWindowPlacerLocked.performSurfacePlacement();
}
}
break;
case NOTIFY_DOCKED_STACK_MINIMIZED_CHANGED:
{
mAmInternal.notifyDockedStackMinimizedChanged(msg.arg1 == 1);
}
break;
case SEAMLESS_ROTATION_TIMEOUT:
{
synchronized (mWindowMap) {
final DisplayContent displayContent=getDefaultDisplayContentLocked();
final WindowList windows=displayContent.getWindowList();
boolean layoutNeeded=false;
for (int i=windows.size() - 1; i >= 0; i--) {
WindowState w=windows.get(i);
if (w.mSeamlesslyRotated) {
layoutNeeded=true;
w.setDisplayLayoutNeeded();
}
w.mSeamlesslyRotated=false;
}
if (layoutNeeded) {
mWindowPlacerLocked.performSurfacePlacement();
}
}
}
break;
}
if (DEBUG_WINDOW_TRACE) {
Slog.v(TAG_WM,"String_Node_Str");
}
}