Program: 190995
Project: 190995
Buggy source:
/** 
 * Called with the activity is first created. 
 */
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  mFinishedOnStartup=false;
  SystemServicesProxy ssp=Recents.getSystemServices();
  if (ssp == null) {
    mFinishedOnStartup=true;
    finish();
    return;
  }
  EventBus.getDefault().register(this,EVENT_BUS_PRIORITY);
  mPackageMonitor=new RecentsPackageMonitor();
  mPackageMonitor.register(this);
  setContentView(R.layout.recents);
  takeKeyEvents(true);
  mRecentsView=(RecentsView)findViewById(R.id.recents_view);
  mRecentsView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION);
  mScrimViews=new SystemBarScrimViews(this);
  getWindow().getAttributes().privateFlags|=WindowManager.LayoutParams.PRIVATE_FLAG_FORCE_DECOR_VIEW_VISIBILITY;
  Configuration appConfiguration=Utilities.getAppConfiguration(this);
  mLastDeviceOrientation=appConfiguration.orientation;
  mLastDisplayDensity=appConfiguration.densityDpi;
  mFocusTimerDuration=getResources().getInteger(R.integer.recents_auto_advance_duration);
  mIterateTrigger=new DozeTrigger(mFocusTimerDuration,new Runnable(){
    @Override public void run(){
      dismissRecentsToFocusedTask(MetricsEvent.OVERVIEW_SELECT_TIMEOUT);
    }
  }
);
  getWindow().setBackgroundDrawable(mRecentsView.getBackgroundScrim());
  mHomeIntent=new Intent(Intent.ACTION_MAIN,null);
  mHomeIntent.addCategory(Intent.CATEGORY_HOME);
  mHomeIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);
  IntentFilter filter=new IntentFilter();
  filter.addAction(Intent.ACTION_SCREEN_OFF);
  registerReceiver(mSystemBroadcastReceiver,filter);
  getWindow().addPrivateFlags(LayoutParams.PRIVATE_FLAG_NO_MOVE_ANIMATION);
  reloadStackView();
}

Fixed version (ground truth):
/** 
 * Called with the activity is first created. 
 */
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  mFinishedOnStartup=false;
  SystemServicesProxy ssp=Recents.getSystemServices();
  if (ssp == null) {
    mFinishedOnStartup=true;
    finish();
    return;
  }
  EventBus.getDefault().register(this,EVENT_BUS_PRIORITY);
  mPackageMonitor=new RecentsPackageMonitor();
  mPackageMonitor.register(this);
  setContentView(R.layout.recents);
  takeKeyEvents(true);
  mRecentsView=(RecentsView)findViewById(R.id.recents_view);
  mRecentsView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION);
  mScrimViews=new SystemBarScrimViews(this);
  getWindow().getAttributes().privateFlags|=WindowManager.LayoutParams.PRIVATE_FLAG_FORCE_DECOR_VIEW_VISIBILITY;
  Configuration appConfiguration=Utilities.getAppConfiguration(this);
  mLastDeviceOrientation=appConfiguration.orientation;
  mLastDisplayDensity=appConfiguration.densityDpi;
  mFocusTimerDuration=getResources().getInteger(R.integer.recents_auto_advance_duration);
  mIterateTrigger=new DozeTrigger(mFocusTimerDuration,new Runnable(){
    @Override public void run(){
      dismissRecentsToFocusedTask(MetricsEvent.OVERVIEW_SELECT_TIMEOUT);
    }
  }
);
  getWindow().setBackgroundDrawable(mRecentsView.getBackgroundScrim());
  mHomeIntent=new Intent(Intent.ACTION_MAIN,null);
  mHomeIntent.addCategory(Intent.CATEGORY_HOME);
  mHomeIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);
  IntentFilter filter=new IntentFilter();
  filter.addAction(Intent.ACTION_SCREEN_OFF);
  filter.addAction(Intent.ACTION_TIME_CHANGED);
  registerReceiver(mSystemBroadcastReceiver,filter);
  getWindow().addPrivateFlags(LayoutParams.PRIVATE_FLAG_NO_MOVE_ANIMATION);
  reloadStackView();
}