Program: 38189
Project: 38189
Buggy source:
@Override public void onCreate(Bundle state){
  super.onCreate(state);
  checkPermissions();
  if (!mHasCriticalPermissions) {
    Log.v(TAG,"String_Node_Str");
    finish();
    return;
  }
  Intent intent=getIntent();
  String action=intent.getAction();
  if (INTENT_ACTION_STILL_IMAGE_CAMERA_SECURE.equals(action) || ACTION_IMAGE_CAPTURE_SECURE.equals(action) || intent.getComponent().getClassName().equals(GESTURE_CAMERA_NAME)) {
    mSecureCamera=true;
  }
 else {
    mSecureCamera=intent.getBooleanExtra(SECURE_CAMERA_EXTRA,false);
  }
  mCursor=getContentResolver().query(MediaStore.Images.Media.EXTERNAL_CONTENT_URI,null,null,null,null);
  if (mSecureCamera) {
    Window win=getWindow();
    WindowManager.LayoutParams params=win.getAttributes();
    params.flags|=WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED;
    if (intent.getComponent().getClassName().equals(GESTURE_CAMERA_NAME)) {
      params.flags|=WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON;
      PowerManager pm=((PowerManager)getSystemService(POWER_SERVICE));
      mWakeLock=pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK,TAG);
      mWakeLock.acquire();
      Log.d(TAG,"String_Node_Str");
    }
    win.setAttributes(params);
  }
  GcamHelper.init(getContentResolver());
  getWindow().requestFeature(Window.FEATURE_ACTION_BAR);
  SettingsManager.createInstance(this);
  LayoutInflater inflater=getLayoutInflater();
  View rootLayout=inflater.inflate(R.layout.camera,null,false);
  mCameraRootFrame=(FrameLayout)rootLayout.findViewById(R.id.camera_root_frame);
  mCameraPhotoModuleRootView=rootLayout.findViewById(R.id.camera_photo_root);
  mCameraVideoModuleRootView=rootLayout.findViewById(R.id.camera_video_root);
  mCameraPanoModuleRootView=rootLayout.findViewById(R.id.camera_pano_root);
  mCameraCaptureModuleRootView=rootLayout.findViewById(R.id.camera_capture_root);
  int moduleIndex=-1;
  if (MediaStore.INTENT_ACTION_VIDEO_CAMERA.equals(getIntent().getAction()) || MediaStore.ACTION_VIDEO_CAPTURE.equals(getIntent().getAction())) {
    moduleIndex=ModuleSwitcher.VIDEO_MODULE_INDEX;
  }
 else   if (MediaStore.INTENT_ACTION_STILL_IMAGE_CAMERA.equals(getIntent().getAction()) || MediaStore.INTENT_ACTION_STILL_IMAGE_CAMERA_SECURE.equals(getIntent().getAction())) {
    moduleIndex=ModuleSwitcher.PHOTO_MODULE_INDEX;
    SharedPreferences prefs=PreferenceManager.getDefaultSharedPreferences(this);
    if (prefs.getInt(CameraSettings.KEY_STARTUP_MODULE_INDEX,-1) == ModuleSwitcher.GCAM_MODULE_INDEX && GcamHelper.hasGcamCapture()) {
      moduleIndex=ModuleSwitcher.GCAM_MODULE_INDEX;
    }
  }
 else   if (MediaStore.ACTION_IMAGE_CAPTURE.equals(getIntent().getAction()) || MediaStore.ACTION_IMAGE_CAPTURE_SECURE.equals(getIntent().getAction())) {
    moduleIndex=ModuleSwitcher.PHOTO_MODULE_INDEX;
  }
 else {
    SharedPreferences prefs=PreferenceManager.getDefaultSharedPreferences(this);
    moduleIndex=prefs.getInt(CameraSettings.KEY_STARTUP_MODULE_INDEX,-1);
    if ((moduleIndex == ModuleSwitcher.GCAM_MODULE_INDEX && !GcamHelper.hasGcamCapture()) || moduleIndex < 0) {
      moduleIndex=ModuleSwitcher.PHOTO_MODULE_INDEX;
    }
  }
  boolean cam2on=SettingsManager.getInstance().isCamera2On();
  if (cam2on && moduleIndex == ModuleSwitcher.PHOTO_MODULE_INDEX)   moduleIndex=ModuleSwitcher.CAPTURE_MODULE_INDEX;
  mOrientationListener=new MyOrientationEventListener(this);
  setContentView(R.layout.camera_filmstrip);
  mFilmStripView=(FilmStripView)findViewById(R.id.filmstrip_view);
  setModuleFromIndex(moduleIndex);
  mActionBar=getActionBar();
  mActionBar.addOnMenuVisibilityListener(this);
  if (ApiHelper.HAS_ROTATION_ANIMATION) {
    setRotationAnimation();
  }
  mMainHandler=new MainHandler(getMainLooper());
  mAboveFilmstripControlLayout=(FrameLayout)findViewById(R.id.camera_above_filmstrip_layout);
  mAboveFilmstripControlLayout.setFitsSystemWindows(true);
  mPanoramaManager=AppManagerFactory.getInstance(this).getPanoramaStitchingManager();
  mPlaceholderManager=AppManagerFactory.getInstance(this).getGcamProcessingManager();
  mPanoramaManager.addTaskListener(mStitchingListener);
  mPlaceholderManager.addTaskListener(mPlaceholderListener);
  mPanoStitchingPanel=findViewById(R.id.pano_stitching_progress_panel);
  mBottomProgress=(ProgressBar)findViewById(R.id.pano_stitching_progress_bar);
  mCameraPreviewData=new CameraPreviewData(rootLayout,FilmStripView.ImageData.SIZE_FULL,FilmStripView.ImageData.SIZE_FULL);
  mWrappedDataAdapter=new FixedFirstDataAdapter(new CameraDataAdapter(new ColorDrawable(getResources().getColor(R.color.photo_placeholder))),mCameraPreviewData);
  mFilmStripView.setViewGap(getResources().getDimensionPixelSize(R.dimen.camera_film_strip_gap));
  mPanoramaViewHelper=new PanoramaViewHelper(this);
  mPanoramaViewHelper.onCreate();
  mFilmStripView.setPanoramaViewHelper(mPanoramaViewHelper);
  mFilmStripView.setListener(mFilmStripListener);
  if (!mSecureCamera) {
    mDataAdapter=mWrappedDataAdapter;
    mFilmStripView.setDataAdapter(mDataAdapter);
    if (!isCaptureIntent()) {
      mDataAdapter.requestLoad(getContentResolver());
      mDataRequested=true;
    }
  }
 else {
    ImageView v=(ImageView)getLayoutInflater().inflate(R.layout.secure_album_placeholder,null);
    v.setOnClickListener(new View.OnClickListener(){
      @Override public void onClick(      View view){
        try {
          UsageStatistics.onEvent(UsageStatistics.COMPONENT_CAMERA,UsageStatistics.ACTION_GALLERY,null);
          startActivity(IntentHelper.getGalleryIntent(CameraActivity.this));
        }
 catch (        ActivityNotFoundException e) {
          Log.w(TAG,"String_Node_Str");
        }
        finish();
      }
    }
);
    mDataAdapter=new FixedLastDataAdapter(mWrappedDataAdapter,new SimpleViewData(v,v.getDrawable().getIntrinsicWidth(),v.getDrawable().getIntrinsicHeight(),0,0));
    mDataAdapter.flush();
    mFilmStripView.setDataAdapter(mDataAdapter);
  }
  setupNfcBeamPush();
  mLocalImagesObserver=new LocalMediaObserver();
  mLocalVideosObserver=new LocalMediaObserver();
  getContentResolver().registerContentObserver(MediaStore.Images.Media.EXTERNAL_CONTENT_URI,true,mLocalImagesObserver);
  getContentResolver().registerContentObserver(MediaStore.Video.Media.EXTERNAL_CONTENT_URI,true,mLocalVideosObserver);
  SharedPreferences prefs=PreferenceManager.getDefaultSharedPreferences(this);
  mDeveloperMenuEnabled=prefs.getBoolean(CameraSettings.KEY_DEVELOPER_MENU,false);
  Display display=getWindowManager().getDefaultDisplay();
  Point size=new Point();
  display.getSize(size);
  int width=size.x;
  int height=size.y;
  int lower=Math.min(width,height);
  int offset=lower * 7 / 100;
  SETTING_LIST_WIDTH_1=lower / 2 + offset;
  SETTING_LIST_WIDTH_2=lower / 2 - offset;
  registerSDcardMountedReceiver();
}

Fixed version (ground truth):
@Override public void onCreate(Bundle state){
  super.onCreate(state);
  if (checkPermissions() || !mHasCriticalPermissions) {
    Log.v(TAG,"String_Node_Str");
    finish();
    return;
  }
  Intent intent=getIntent();
  String action=intent.getAction();
  if (INTENT_ACTION_STILL_IMAGE_CAMERA_SECURE.equals(action) || ACTION_IMAGE_CAPTURE_SECURE.equals(action) || intent.getComponent().getClassName().equals(GESTURE_CAMERA_NAME)) {
    mSecureCamera=true;
  }
 else {
    mSecureCamera=intent.getBooleanExtra(SECURE_CAMERA_EXTRA,false);
  }
  mCursor=getContentResolver().query(MediaStore.Images.Media.EXTERNAL_CONTENT_URI,null,null,null,null);
  if (mSecureCamera) {
    Window win=getWindow();
    WindowManager.LayoutParams params=win.getAttributes();
    params.flags|=WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED;
    if (intent.getComponent().getClassName().equals(GESTURE_CAMERA_NAME)) {
      params.flags|=WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON;
      PowerManager pm=((PowerManager)getSystemService(POWER_SERVICE));
      mWakeLock=pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK,TAG);
      mWakeLock.acquire();
      Log.d(TAG,"String_Node_Str");
    }
    win.setAttributes(params);
  }
  GcamHelper.init(getContentResolver());
  getWindow().requestFeature(Window.FEATURE_ACTION_BAR);
  SettingsManager.createInstance(this);
  LayoutInflater inflater=getLayoutInflater();
  View rootLayout=inflater.inflate(R.layout.camera,null,false);
  mCameraRootFrame=(FrameLayout)rootLayout.findViewById(R.id.camera_root_frame);
  mCameraPhotoModuleRootView=rootLayout.findViewById(R.id.camera_photo_root);
  mCameraVideoModuleRootView=rootLayout.findViewById(R.id.camera_video_root);
  mCameraPanoModuleRootView=rootLayout.findViewById(R.id.camera_pano_root);
  mCameraCaptureModuleRootView=rootLayout.findViewById(R.id.camera_capture_root);
  int moduleIndex=-1;
  if (MediaStore.INTENT_ACTION_VIDEO_CAMERA.equals(getIntent().getAction()) || MediaStore.ACTION_VIDEO_CAPTURE.equals(getIntent().getAction())) {
    moduleIndex=ModuleSwitcher.VIDEO_MODULE_INDEX;
  }
 else   if (MediaStore.INTENT_ACTION_STILL_IMAGE_CAMERA.equals(getIntent().getAction()) || MediaStore.INTENT_ACTION_STILL_IMAGE_CAMERA_SECURE.equals(getIntent().getAction())) {
    moduleIndex=ModuleSwitcher.PHOTO_MODULE_INDEX;
    SharedPreferences prefs=PreferenceManager.getDefaultSharedPreferences(this);
    if (prefs.getInt(CameraSettings.KEY_STARTUP_MODULE_INDEX,-1) == ModuleSwitcher.GCAM_MODULE_INDEX && GcamHelper.hasGcamCapture()) {
      moduleIndex=ModuleSwitcher.GCAM_MODULE_INDEX;
    }
  }
 else   if (MediaStore.ACTION_IMAGE_CAPTURE.equals(getIntent().getAction()) || MediaStore.ACTION_IMAGE_CAPTURE_SECURE.equals(getIntent().getAction())) {
    moduleIndex=ModuleSwitcher.PHOTO_MODULE_INDEX;
  }
 else {
    SharedPreferences prefs=PreferenceManager.getDefaultSharedPreferences(this);
    moduleIndex=prefs.getInt(CameraSettings.KEY_STARTUP_MODULE_INDEX,-1);
    if ((moduleIndex == ModuleSwitcher.GCAM_MODULE_INDEX && !GcamHelper.hasGcamCapture()) || moduleIndex < 0) {
      moduleIndex=ModuleSwitcher.PHOTO_MODULE_INDEX;
    }
  }
  boolean cam2on=SettingsManager.getInstance().isCamera2On();
  if (cam2on && moduleIndex == ModuleSwitcher.PHOTO_MODULE_INDEX)   moduleIndex=ModuleSwitcher.CAPTURE_MODULE_INDEX;
  mOrientationListener=new MyOrientationEventListener(this);
  setContentView(R.layout.camera_filmstrip);
  mFilmStripView=(FilmStripView)findViewById(R.id.filmstrip_view);
  setModuleFromIndex(moduleIndex);
  mActionBar=getActionBar();
  mActionBar.addOnMenuVisibilityListener(this);
  if (ApiHelper.HAS_ROTATION_ANIMATION) {
    setRotationAnimation();
  }
  mMainHandler=new MainHandler(getMainLooper());
  mAboveFilmstripControlLayout=(FrameLayout)findViewById(R.id.camera_above_filmstrip_layout);
  mAboveFilmstripControlLayout.setFitsSystemWindows(true);
  mPanoramaManager=AppManagerFactory.getInstance(this).getPanoramaStitchingManager();
  mPlaceholderManager=AppManagerFactory.getInstance(this).getGcamProcessingManager();
  mPanoramaManager.addTaskListener(mStitchingListener);
  mPlaceholderManager.addTaskListener(mPlaceholderListener);
  mPanoStitchingPanel=findViewById(R.id.pano_stitching_progress_panel);
  mBottomProgress=(ProgressBar)findViewById(R.id.pano_stitching_progress_bar);
  mCameraPreviewData=new CameraPreviewData(rootLayout,FilmStripView.ImageData.SIZE_FULL,FilmStripView.ImageData.SIZE_FULL);
  mWrappedDataAdapter=new FixedFirstDataAdapter(new CameraDataAdapter(new ColorDrawable(getResources().getColor(R.color.photo_placeholder))),mCameraPreviewData);
  mFilmStripView.setViewGap(getResources().getDimensionPixelSize(R.dimen.camera_film_strip_gap));
  mPanoramaViewHelper=new PanoramaViewHelper(this);
  mPanoramaViewHelper.onCreate();
  mFilmStripView.setPanoramaViewHelper(mPanoramaViewHelper);
  mFilmStripView.setListener(mFilmStripListener);
  if (!mSecureCamera) {
    mDataAdapter=mWrappedDataAdapter;
    mFilmStripView.setDataAdapter(mDataAdapter);
    if (!isCaptureIntent()) {
      mDataAdapter.requestLoad(getContentResolver());
      mDataRequested=true;
    }
  }
 else {
    ImageView v=(ImageView)getLayoutInflater().inflate(R.layout.secure_album_placeholder,null);
    v.setOnClickListener(new View.OnClickListener(){
      @Override public void onClick(      View view){
        try {
          UsageStatistics.onEvent(UsageStatistics.COMPONENT_CAMERA,UsageStatistics.ACTION_GALLERY,null);
          startActivity(IntentHelper.getGalleryIntent(CameraActivity.this));
        }
 catch (        ActivityNotFoundException e) {
          Log.w(TAG,"String_Node_Str");
        }
        finish();
      }
    }
);
    mDataAdapter=new FixedLastDataAdapter(mWrappedDataAdapter,new SimpleViewData(v,v.getDrawable().getIntrinsicWidth(),v.getDrawable().getIntrinsicHeight(),0,0));
    mDataAdapter.flush();
    mFilmStripView.setDataAdapter(mDataAdapter);
  }
  setupNfcBeamPush();
  mLocalImagesObserver=new LocalMediaObserver();
  mLocalVideosObserver=new LocalMediaObserver();
  getContentResolver().registerContentObserver(MediaStore.Images.Media.EXTERNAL_CONTENT_URI,true,mLocalImagesObserver);
  getContentResolver().registerContentObserver(MediaStore.Video.Media.EXTERNAL_CONTENT_URI,true,mLocalVideosObserver);
  SharedPreferences prefs=PreferenceManager.getDefaultSharedPreferences(this);
  mDeveloperMenuEnabled=prefs.getBoolean(CameraSettings.KEY_DEVELOPER_MENU,false);
  Display display=getWindowManager().getDefaultDisplay();
  Point size=new Point();
  display.getSize(size);
  int width=size.x;
  int height=size.y;
  int lower=Math.min(width,height);
  int offset=lower * 7 / 100;
  SETTING_LIST_WIDTH_1=lower / 2 + offset;
  SETTING_LIST_WIDTH_2=lower / 2 - offset;
  registerSDcardMountedReceiver();
}