Program: 195710
Project: 195710
Buggy source:
/** 
 * Preflight adding a window to the system. Currently enforces that three window types are singletons: <ul> <li>STATUS_BAR_TYPE</li> <li>KEYGUARD_TYPE</li> </ul>
 * @param win The window to be added
 * @param attrs Information about the window to be added
 * @return If ok, WindowManagerImpl.ADD_OKAY.  If too many singletons,WindowManagerImpl.ADD_MULTIPLE_SINGLETON
 */
@Override public int prepareAddWindowLw(WindowState win,WindowManager.LayoutParams attrs){
switch (attrs.type) {
case TYPE_STATUS_BAR:
    mContext.enforceCallingOrSelfPermission(android.Manifest.permission.STATUS_BAR_SERVICE,"String_Node_Str");
  if (mStatusBar != null) {
    if (mStatusBar.isAlive()) {
      return WindowManagerGlobal.ADD_MULTIPLE_SINGLETON;
    }
  }
mStatusBar=win;
mStatusBarController.setWindow(win);
mKeyguardDelegate.hideScrim();
break;
case TYPE_NAVIGATION_BAR:
mContext.enforceCallingOrSelfPermission(android.Manifest.permission.STATUS_BAR_SERVICE,"String_Node_Str");
if (mNavigationBar != null) {
if (mNavigationBar.isAlive()) {
return WindowManagerGlobal.ADD_MULTIPLE_SINGLETON;
}
}
mNavigationBar=win;
mNavigationBarController.setWindow(win);
if (DEBUG_LAYOUT) Slog.i(TAG,"String_Node_Str" + mNavigationBar);
break;
case TYPE_NAVIGATION_BAR_PANEL:
mContext.enforceCallingOrSelfPermission(android.Manifest.permission.STATUS_BAR_SERVICE,"String_Node_Str");
break;
case TYPE_STATUS_BAR_PANEL:
mContext.enforceCallingOrSelfPermission(android.Manifest.permission.STATUS_BAR_SERVICE,"String_Node_Str");
break;
case TYPE_STATUS_BAR_SUB_PANEL:
mContext.enforceCallingOrSelfPermission(android.Manifest.permission.STATUS_BAR_SERVICE,"String_Node_Str");
break;
case TYPE_KEYGUARD_SCRIM:
if (mKeyguardScrim != null) {
return WindowManagerGlobal.ADD_MULTIPLE_SINGLETON;
}
mKeyguardScrim=win;
break;
}
return WindowManagerGlobal.ADD_OKAY;
}

Fixed version (ground truth):
/** 
 * Preflight adding a window to the system. Currently enforces that three window types are singletons: <ul> <li>STATUS_BAR_TYPE</li> <li>KEYGUARD_TYPE</li> </ul>
 * @param win The window to be added
 * @param attrs Information about the window to be added
 * @return If ok, WindowManagerImpl.ADD_OKAY.  If too many singletons,WindowManagerImpl.ADD_MULTIPLE_SINGLETON
 */
@Override public int prepareAddWindowLw(WindowState win,WindowManager.LayoutParams attrs){
switch (attrs.type) {
case TYPE_STATUS_BAR:
    mContext.enforceCallingOrSelfPermission(android.Manifest.permission.STATUS_BAR_SERVICE,"String_Node_Str");
  if (mStatusBar != null) {
    if (mStatusBar.isAlive()) {
      return WindowManagerGlobal.ADD_MULTIPLE_SINGLETON;
    }
  }
mStatusBar=win;
mStatusBarController.setWindow(win);
break;
case TYPE_NAVIGATION_BAR:
mContext.enforceCallingOrSelfPermission(android.Manifest.permission.STATUS_BAR_SERVICE,"String_Node_Str");
if (mNavigationBar != null) {
if (mNavigationBar.isAlive()) {
return WindowManagerGlobal.ADD_MULTIPLE_SINGLETON;
}
}
mNavigationBar=win;
mNavigationBarController.setWindow(win);
if (DEBUG_LAYOUT) Slog.i(TAG,"String_Node_Str" + mNavigationBar);
break;
case TYPE_NAVIGATION_BAR_PANEL:
mContext.enforceCallingOrSelfPermission(android.Manifest.permission.STATUS_BAR_SERVICE,"String_Node_Str");
break;
case TYPE_STATUS_BAR_PANEL:
mContext.enforceCallingOrSelfPermission(android.Manifest.permission.STATUS_BAR_SERVICE,"String_Node_Str");
break;
case TYPE_STATUS_BAR_SUB_PANEL:
mContext.enforceCallingOrSelfPermission(android.Manifest.permission.STATUS_BAR_SERVICE,"String_Node_Str");
break;
case TYPE_KEYGUARD_SCRIM:
if (mKeyguardScrim != null) {
return WindowManagerGlobal.ADD_MULTIPLE_SINGLETON;
}
mKeyguardScrim=win;
break;
}
return WindowManagerGlobal.ADD_OKAY;
}