Java 类com.google.zxing.client.android.camera.open.OpenCameraManager 实例源码

项目:oversec_crypto    文件:Util.java   
public static boolean checkCameraAccess(Context ctx) {
    boolean ret = ContextCompat.checkSelfPermission(ctx, Manifest.permission.CAMERA)
            == PackageManager.PERMISSION_GRANTED;

    if (ret) {
        //we still can't be sure, android misreport permission when revoked through settings
        try {
            Camera xCamera = new OpenCameraManager().build().open();
            xCamera.release();
        } catch (RuntimeException ex) {
            ret = false;
        }
    }
    return ret;
}
项目:appinventor-extensions    文件:CameraManager.java   
/**
 * Opens the camera driver and initializes the hardware parameters.
 *
 * @param holder The surface object which the camera will draw preview frames into.
 * @throws IOException Indicates the camera driver failed to open.
 */
public synchronized void openDriver(SurfaceHolder holder) throws IOException {
  Camera theCamera = camera;
  if (theCamera == null) {
    theCamera = new OpenCameraManager().build().open();
    if (theCamera == null) {
      throw new IOException();
    }
    camera = theCamera;
  }
  theCamera.setPreviewDisplay(holder);

  if (!initialized) {
    initialized = true;
    configManager.initFromCameraParameters(theCamera);
    if (requestedFramingRectWidth > 0 && requestedFramingRectHeight > 0) {
      setManualFramingRect(requestedFramingRectWidth, requestedFramingRectHeight);
      requestedFramingRectWidth = 0;
      requestedFramingRectHeight = 0;
    }
  }

  Camera.Parameters parameters = theCamera.getParameters();
  String parametersFlattened = parameters == null ? null : parameters.flatten(); // Save these, temporarily
  try {
    configManager.setDesiredCameraParameters(theCamera, false);
  } catch (RuntimeException re) {
    // Driver failed
    Log.w(TAG, "Camera rejected parameters. Setting only minimal safe-mode parameters");
    Log.i(TAG, "Resetting to saved camera params: " + parametersFlattened);
    // Reset:
    if (parametersFlattened != null) {
      parameters = theCamera.getParameters();
      parameters.unflatten(parametersFlattened);
      try {
        theCamera.setParameters(parameters);
        configManager.setDesiredCameraParameters(theCamera, true);
      } catch (RuntimeException re2) {
        // Well, darn. Give up
        Log.w(TAG, "Camera rejected even safe-mode parameters! No configuration");
      }
    }
  }

}
项目:sres-app    文件:CameraManager.java   
/**
 * Opens the camera driver and initializes the hardware parameters.
 *
 * @param holder The surface object which the camera will draw preview frames into.
 * @throws IOException Indicates the camera driver failed to open.
 */
public synchronized void openDriver(SurfaceHolder holder) throws IOException {
  Camera theCamera = camera;
  if (theCamera == null) {
    theCamera = new OpenCameraManager().build().open();
    if (theCamera == null) {
      throw new IOException();
    }
    camera = theCamera;
  }
  theCamera.setPreviewDisplay(holder);

  if (!initialized) {
    initialized = true;
    configManager.initFromCameraParameters(theCamera);
    if (requestedFramingRectWidth > 0 && requestedFramingRectHeight > 0) {
      setManualFramingRect(requestedFramingRectWidth, requestedFramingRectHeight);
      requestedFramingRectWidth = 0;
      requestedFramingRectHeight = 0;
    }
  }

  Camera.Parameters parameters = theCamera.getParameters();
  String parametersFlattened = parameters == null ? null : parameters.flatten(); // Save these, temporarily
  try {
    configManager.setDesiredCameraParameters(theCamera, false);
  } catch (RuntimeException re) {
    // Driver failed
    Log.w(TAG, "Camera rejected parameters. Setting only minimal safe-mode parameters");
    Log.i(TAG, "Resetting to saved camera params: " + parametersFlattened);
    // Reset:
    if (parametersFlattened != null) {
      parameters = theCamera.getParameters();
      parameters.unflatten(parametersFlattened);
      try {
        theCamera.setParameters(parameters);
        configManager.setDesiredCameraParameters(theCamera, true);
      } catch (RuntimeException re2) {
        // Well, darn. Give up
        Log.w(TAG, "Camera rejected even safe-mode parameters! No configuration");
      }
    }
  }

}
项目:Discounty    文件:CameraManager.java   
/**
 * Opens the camera driver and initializes the hardware parameters.
 *
 * @param holder The surface object which the camera will draw preview frames into.
 * @throws IOException Indicates the camera driver failed to open.
 */
public synchronized void openDriver(SurfaceHolder holder) throws IOException {
    Camera theCamera = camera;
    if (theCamera == null) {
        theCamera = new OpenCameraManager().build().open();
        if (theCamera == null) {
            throw new IOException();
        }
        camera = theCamera;
    }
    theCamera.setPreviewDisplay(holder);

    if (!initialized) {
        initialized = true;
        configManager.initFromCameraParameters(theCamera);
        if (requestedFramingRectWidth > 0 && requestedFramingRectHeight > 0) {
            setManualFramingRect(requestedFramingRectWidth, requestedFramingRectHeight);
            requestedFramingRectWidth = 0;
            requestedFramingRectHeight = 0;
        }
    }

    Camera.Parameters parameters = theCamera.getParameters();
    String parametersFlattened = parameters == null ? null : parameters.flatten(); // Save these, temporarily
    try {
        configManager.setDesiredCameraParameters(theCamera, false);
    } catch (RuntimeException re) {
        // Driver failed
        Log.w(TAG, "Camera rejected parameters. Setting only minimal safe-mode parameters");
        Log.i(TAG, "Resetting to saved camera params: " + parametersFlattened);
        // Reset:
        if (parametersFlattened != null) {
            parameters = theCamera.getParameters();
            parameters.unflatten(parametersFlattened);
            try {
                theCamera.setParameters(parameters);
                configManager.setDesiredCameraParameters(theCamera, true);
            } catch (RuntimeException re2) {
                // Well, darn. Give up
                Log.w(TAG, "Camera rejected even safe-mode parameters! No configuration");
            }
        }
    }

}
项目:bushido-android-app    文件:CameraManager.java   
/**
 * Opens the camera driver and initializes the hardware parameters.
 *
 * @param holder The surface object which the camera will draw preview frames into.
 * @throws java.io.IOException Indicates the camera driver failed to open.
 */
public synchronized void openDriver(SurfaceHolder holder) throws IOException {
  Camera theCamera = camera;
  if (theCamera == null) {
    theCamera = new OpenCameraManager().build().open();
    if (theCamera == null) {
      throw new IOException();
    }
    camera = theCamera;
  }
  theCamera.setPreviewDisplay(holder);

  if (!initialized) {
    initialized = true;
    configManager.initFromCameraParameters(theCamera);
    if (requestedFramingRectWidth > 0 && requestedFramingRectHeight > 0) {
      setManualFramingRect(requestedFramingRectWidth, requestedFramingRectHeight);
      requestedFramingRectWidth = 0;
      requestedFramingRectHeight = 0;
    }
  }

  Camera.Parameters parameters = theCamera.getParameters();
  String parametersFlattened = parameters == null ? null : parameters.flatten(); // Save these, temporarily
  try {
    configManager.setDesiredCameraParameters(theCamera, false);
  } catch (RuntimeException re) {
    // Driver failed
    Log.w(TAG, "Camera rejected parameters. Setting only minimal safe-mode parameters");
    Log.i(TAG, "Resetting to saved camera params: " + parametersFlattened);
    // Reset:
    if (parametersFlattened != null) {
      parameters = theCamera.getParameters();
      parameters.unflatten(parametersFlattened);
      try {
        theCamera.setParameters(parameters);
        configManager.setDesiredCameraParameters(theCamera, true);
      } catch (RuntimeException re2) {
        // Well, darn. Give up
        Log.w(TAG, "Camera rejected even safe-mode parameters! No configuration");
      }
    }
  }

}
项目:reacteu-app    文件:CameraManager.java   
/**
 * Opens the camera driver and initializes the hardware parameters.
 *
 * @param holder The surface object which the camera will draw preview frames into.
 * @throws IOException Indicates the camera driver failed to open.
 */
public synchronized void openDriver(SurfaceHolder holder) throws IOException {
  Camera theCamera = camera;
  if (theCamera == null) {
    theCamera = new OpenCameraManager().build().open();
    if (theCamera == null) {
      throw new IOException();
    }
    camera = theCamera;
  }
  theCamera.setPreviewDisplay(holder);

  if (!initialized) {
    initialized = true;
    configManager.initFromCameraParameters(theCamera);
    if (requestedFramingRectWidth > 0 && requestedFramingRectHeight > 0) {
      setManualFramingRect(requestedFramingRectWidth, requestedFramingRectHeight);
      requestedFramingRectWidth = 0;
      requestedFramingRectHeight = 0;
    }
  }

  Camera.Parameters parameters = theCamera.getParameters();
  String parametersFlattened = parameters == null ? null : parameters.flatten(); // Save these, temporarily
  try {
    configManager.setDesiredCameraParameters(theCamera, false);
  } catch (RuntimeException re) {
    // Driver failed
    Log.w(TAG, "Camera rejected parameters. Setting only minimal safe-mode parameters");
    Log.i(TAG, "Resetting to saved camera params: " + parametersFlattened);
    // Reset:
    if (parametersFlattened != null) {
      parameters = theCamera.getParameters();
      parameters.unflatten(parametersFlattened);
      try {
        theCamera.setParameters(parameters);
        configManager.setDesiredCameraParameters(theCamera, true);
      } catch (RuntimeException re2) {
        // Well, darn. Give up
        Log.w(TAG, "Camera rejected even safe-mode parameters! No configuration");
      }
    }
  }

}
项目:CordovaDemo    文件:CameraManager.java   
/**
 * Opens the camera driver and initializes the hardware parameters.
 *
 * @param holder The surface object which the camera will draw preview frames into.
 * @throws IOException Indicates the camera driver failed to open.
 */
public synchronized void openDriver(SurfaceHolder holder) throws IOException {
  Camera theCamera = camera;
  if (theCamera == null) {
    theCamera = new OpenCameraManager().build().open();
    if (theCamera == null) {
      throw new IOException();
    }
    camera = theCamera;
  }
  theCamera.setPreviewDisplay(holder);

  if (!initialized) {
    initialized = true;
    configManager.initFromCameraParameters(theCamera);
    if (requestedFramingRectWidth > 0 && requestedFramingRectHeight > 0) {
      setManualFramingRect(requestedFramingRectWidth, requestedFramingRectHeight);
      requestedFramingRectWidth = 0;
      requestedFramingRectHeight = 0;
    }
  }

  Camera.Parameters parameters = theCamera.getParameters();
  String parametersFlattened = parameters == null ? null : parameters.flatten(); // Save these, temporarily
  try {
    configManager.setDesiredCameraParameters(theCamera, false);
  } catch (RuntimeException re) {
    // Driver failed
    Log.w(TAG, "Camera rejected parameters. Setting only minimal safe-mode parameters");
    Log.i(TAG, "Resetting to saved camera params: " + parametersFlattened);
    // Reset:
    if (parametersFlattened != null) {
      parameters = theCamera.getParameters();
      parameters.unflatten(parametersFlattened);
      try {
        theCamera.setParameters(parameters);
        configManager.setDesiredCameraParameters(theCamera, true);
      } catch (RuntimeException re2) {
        // Well, darn. Give up
        Log.w(TAG, "Camera rejected even safe-mode parameters! No configuration");
      }
    }
  }

}
项目:ng-cordova-demo    文件:CameraManager.java   
/**
 * Opens the camera driver and initializes the hardware parameters.
 *
 * @param holder The surface object which the camera will draw preview frames into.
 * @throws IOException Indicates the camera driver failed to open.
 */
public synchronized void openDriver(SurfaceHolder holder) throws IOException {
  Camera theCamera = camera;
  if (theCamera == null) {
    theCamera = new OpenCameraManager().build().open();
    if (theCamera == null) {
      throw new IOException();
    }
    camera = theCamera;
  }
  theCamera.setPreviewDisplay(holder);

  if (!initialized) {
    initialized = true;
    configManager.initFromCameraParameters(theCamera);
    if (requestedFramingRectWidth > 0 && requestedFramingRectHeight > 0) {
      setManualFramingRect(requestedFramingRectWidth, requestedFramingRectHeight);
      requestedFramingRectWidth = 0;
      requestedFramingRectHeight = 0;
    }
  }

  Camera.Parameters parameters = theCamera.getParameters();
  String parametersFlattened = parameters == null ? null : parameters.flatten(); // Save these, temporarily
  try {
    configManager.setDesiredCameraParameters(theCamera, false);
  } catch (RuntimeException re) {
    // Driver failed
    Log.w(TAG, "Camera rejected parameters. Setting only minimal safe-mode parameters");
    Log.i(TAG, "Resetting to saved camera params: " + parametersFlattened);
    // Reset:
    if (parametersFlattened != null) {
      parameters = theCamera.getParameters();
      parameters.unflatten(parametersFlattened);
      try {
        theCamera.setParameters(parameters);
        configManager.setDesiredCameraParameters(theCamera, true);
      } catch (RuntimeException re2) {
        // Well, darn. Give up
        Log.w(TAG, "Camera rejected even safe-mode parameters! No configuration");
      }
    }
  }

}
项目:ngCordova-demo    文件:CameraManager.java   
/**
 * Opens the camera driver and initializes the hardware parameters.
 *
 * @param holder The surface object which the camera will draw preview frames into.
 * @throws IOException Indicates the camera driver failed to open.
 */
public synchronized void openDriver(SurfaceHolder holder) throws IOException {
  Camera theCamera = camera;
  if (theCamera == null) {
    theCamera = new OpenCameraManager().build().open();
    if (theCamera == null) {
      throw new IOException();
    }
    camera = theCamera;
  }
  theCamera.setPreviewDisplay(holder);

  if (!initialized) {
    initialized = true;
    configManager.initFromCameraParameters(theCamera);
    if (requestedFramingRectWidth > 0 && requestedFramingRectHeight > 0) {
      setManualFramingRect(requestedFramingRectWidth, requestedFramingRectHeight);
      requestedFramingRectWidth = 0;
      requestedFramingRectHeight = 0;
    }
  }

  Camera.Parameters parameters = theCamera.getParameters();
  String parametersFlattened = parameters == null ? null : parameters.flatten(); // Save these, temporarily
  try {
    configManager.setDesiredCameraParameters(theCamera, false);
  } catch (RuntimeException re) {
    // Driver failed
    Log.w(TAG, "Camera rejected parameters. Setting only minimal safe-mode parameters");
    Log.i(TAG, "Resetting to saved camera params: " + parametersFlattened);
    // Reset:
    if (parametersFlattened != null) {
      parameters = theCamera.getParameters();
      parameters.unflatten(parametersFlattened);
      try {
        theCamera.setParameters(parameters);
        configManager.setDesiredCameraParameters(theCamera, true);
      } catch (RuntimeException re2) {
        // Well, darn. Give up
        Log.w(TAG, "Camera rejected even safe-mode parameters! No configuration");
      }
    }
  }

}
项目:CordovaW8BarcodeDemo    文件:CameraManager.java   
/**
 * Opens the camera driver and initializes the hardware parameters.
 *
 * @param holder The surface object which the camera will draw preview frames into.
 * @throws IOException Indicates the camera driver failed to open.
 */
public synchronized void openDriver(SurfaceHolder holder) throws IOException {
  Camera theCamera = camera;
  if (theCamera == null) {
    theCamera = new OpenCameraManager().build().open();
    if (theCamera == null) {
      throw new IOException();
    }
    camera = theCamera;
  }
  theCamera.setPreviewDisplay(holder);

  if (!initialized) {
    initialized = true;
    configManager.initFromCameraParameters(theCamera);
    if (requestedFramingRectWidth > 0 && requestedFramingRectHeight > 0) {
      setManualFramingRect(requestedFramingRectWidth, requestedFramingRectHeight);
      requestedFramingRectWidth = 0;
      requestedFramingRectHeight = 0;
    }
  }

  Camera.Parameters parameters = theCamera.getParameters();
  String parametersFlattened = parameters == null ? null : parameters.flatten(); // Save these, temporarily
  try {
    configManager.setDesiredCameraParameters(theCamera, false);
  } catch (RuntimeException re) {
    // Driver failed
    Log.w(TAG, "Camera rejected parameters. Setting only minimal safe-mode parameters");
    Log.i(TAG, "Resetting to saved camera params: " + parametersFlattened);
    // Reset:
    if (parametersFlattened != null) {
      parameters = theCamera.getParameters();
      parameters.unflatten(parametersFlattened);
      try {
        theCamera.setParameters(parameters);
        configManager.setDesiredCameraParameters(theCamera, true);
      } catch (RuntimeException re2) {
        // Well, darn. Give up
        Log.w(TAG, "Camera rejected even safe-mode parameters! No configuration");
      }
    }
  }

}
项目:Adaptilo    文件:CameraManager.java   
/**
 * Opens the camera driver and initializes the hardware parameters.
 *
 * @param holder The surface object which the camera will draw preview frames into.
 * @throws IOException Indicates the camera driver failed to open.
 */
public synchronized void openDriver(SurfaceHolder holder) throws IOException {
    Camera theCamera = camera;
    if (theCamera == null) {
        theCamera = new OpenCameraManager().build().open();
        if (theCamera == null) {
            throw new IOException();
        }
        camera = theCamera;
    }
    theCamera.setPreviewDisplay(holder);

    if (!initialized) {
        initialized = true;
        configManager.initFromCameraParameters(theCamera);
        if (requestedFramingRectWidth > 0 && requestedFramingRectHeight > 0) {
            setManualFramingRect(requestedFramingRectWidth, requestedFramingRectHeight);
            requestedFramingRectWidth = 0;
            requestedFramingRectHeight = 0;
        }
    }

    Camera.Parameters parameters = theCamera.getParameters();
    String parametersFlattened = parameters == null ? null : parameters.flatten(); // Save these, temporarily
    try {
        configManager.setDesiredCameraParameters(theCamera, false);
    } catch (RuntimeException re) {
        // Driver failed
        Log.w(TAG, "Camera rejected parameters. Setting only minimal safe-mode parameters");
        Log.i(TAG, "Resetting to saved camera params: " + parametersFlattened);
        // Reset:
        if (parametersFlattened != null) {
            parameters = theCamera.getParameters();
            parameters.unflatten(parametersFlattened);
            try {
                theCamera.setParameters(parameters);
                configManager.setDesiredCameraParameters(theCamera, true);
            } catch (RuntimeException re2) {
                // Well, darn. Give up
                Log.w(TAG, "Camera rejected even safe-mode parameters! No configuration");
            }
        }
    }

}
项目:cordova-template    文件:CameraManager.java   
/**
 * Opens the camera driver and initializes the hardware parameters.
 *
 * @param holder The surface object which the camera will draw preview frames into.
 * @throws IOException Indicates the camera driver failed to open.
 */
public synchronized void openDriver(SurfaceHolder holder) throws IOException {
  Camera theCamera = camera;
  if (theCamera == null) {
    theCamera = new OpenCameraManager().build().open();
    if (theCamera == null) {
      throw new IOException();
    }
    camera = theCamera;
  }
  theCamera.setPreviewDisplay(holder);

  if (!initialized) {
    initialized = true;
    configManager.initFromCameraParameters(theCamera);
    if (requestedFramingRectWidth > 0 && requestedFramingRectHeight > 0) {
      setManualFramingRect(requestedFramingRectWidth, requestedFramingRectHeight);
      requestedFramingRectWidth = 0;
      requestedFramingRectHeight = 0;
    }
  }

  Camera.Parameters parameters = theCamera.getParameters();
  String parametersFlattened = parameters == null ? null : parameters.flatten(); // Save these, temporarily
  try {
    configManager.setDesiredCameraParameters(theCamera, false);
  } catch (RuntimeException re) {
    // Driver failed
    Log.w(TAG, "Camera rejected parameters. Setting only minimal safe-mode parameters");
    Log.i(TAG, "Resetting to saved camera params: " + parametersFlattened);
    // Reset:
    if (parametersFlattened != null) {
      parameters = theCamera.getParameters();
      parameters.unflatten(parametersFlattened);
      try {
        theCamera.setParameters(parameters);
        configManager.setDesiredCameraParameters(theCamera, true);
      } catch (RuntimeException re2) {
        // Well, darn. Give up
        Log.w(TAG, "Camera rejected even safe-mode parameters! No configuration");
      }
    }
  }

}
项目:oxPush    文件:CameraManager.java   
/**
 * Opens the camera driver and initializes the hardware parameters.
 *
 * @param holder The surface object which the camera will draw preview frames into.
 * @throws IOException Indicates the camera driver failed to open.
 */
public synchronized void openDriver(SurfaceHolder holder) throws IOException {
  Camera theCamera = camera;
  if (theCamera == null) {
    theCamera = new OpenCameraManager().build().open();
    if (theCamera == null) {
      throw new IOException();
    }
    camera = theCamera;
  }
  theCamera.setPreviewDisplay(holder);

  if (!initialized) {
    initialized = true;
    configManager.initFromCameraParameters(theCamera);
    if (requestedFramingRectWidth > 0 && requestedFramingRectHeight > 0) {
      setManualFramingRect(requestedFramingRectWidth, requestedFramingRectHeight);
      requestedFramingRectWidth = 0;
      requestedFramingRectHeight = 0;
    }
  }

  Camera.Parameters parameters = theCamera.getParameters();
  String parametersFlattened = parameters == null ? null : parameters.flatten(); // Save these, temporarily
  try {
    configManager.setDesiredCameraParameters(theCamera, false);
  } catch (RuntimeException re) {
    // Driver failed
    Log.w(TAG, "Camera rejected parameters. Setting only minimal safe-mode parameters");
    Log.i(TAG, "Resetting to saved camera params: " + parametersFlattened);
    // Reset:
    if (parametersFlattened != null) {
      parameters = theCamera.getParameters();
      parameters.unflatten(parametersFlattened);
      try {
        theCamera.setParameters(parameters);
        configManager.setDesiredCameraParameters(theCamera, true);
      } catch (RuntimeException re2) {
        // Well, darn. Give up
        Log.w(TAG, "Camera rejected even safe-mode parameters! No configuration");
      }
    }
  }

}
项目:hive-ios    文件:CameraManager.java   
/**
 * Opens the camera driver and initializes the hardware parameters.
 *
 * @param holder The surface object which the camera will draw preview frames into.
 * @throws IOException Indicates the camera driver failed to open.
 */
public synchronized void openDriver(SurfaceHolder holder) throws IOException {
  Camera theCamera = camera;
  if (theCamera == null) {
    theCamera = new OpenCameraManager().build().open();
    if (theCamera == null) {
      throw new IOException();
    }
    camera = theCamera;
  }
  theCamera.setPreviewDisplay(holder);

  if (!initialized) {
    initialized = true;
    configManager.initFromCameraParameters(theCamera);
    if (requestedFramingRectWidth > 0 && requestedFramingRectHeight > 0) {
      setManualFramingRect(requestedFramingRectWidth, requestedFramingRectHeight);
      requestedFramingRectWidth = 0;
      requestedFramingRectHeight = 0;
    }
  }

  Camera.Parameters parameters = theCamera.getParameters();
  String parametersFlattened = parameters == null ? null : parameters.flatten(); // Save these, temporarily
  try {
    configManager.setDesiredCameraParameters(theCamera, false);
  } catch (RuntimeException re) {
    // Driver failed
    Log.w(TAG, "Camera rejected parameters. Setting only minimal safe-mode parameters");
    Log.i(TAG, "Resetting to saved camera params: " + parametersFlattened);
    // Reset:
    if (parametersFlattened != null) {
      parameters = theCamera.getParameters();
      parameters.unflatten(parametersFlattened);
      try {
        theCamera.setParameters(parameters);
        configManager.setDesiredCameraParameters(theCamera, true);
      } catch (RuntimeException re2) {
        // Well, darn. Give up
        Log.w(TAG, "Camera rejected even safe-mode parameters! No configuration");
      }
    }
  }

}
项目:zxing_android_qr    文件:CameraManager.java   
/**
 * Opens the camera driver and initializes the hardware parameters.
 *
 * @param holder The surface object which the camera will draw preview frames into.
 * @throws IOException Indicates the camera driver failed to open.
 */
public synchronized void openDriver(SurfaceHolder holder) throws IOException {
  Camera theCamera = camera;
  if (theCamera == null) {
    theCamera = new OpenCameraManager().build().open();
    if (theCamera == null) {
      throw new IOException();
    }
    camera = theCamera;
  }
  theCamera.setPreviewDisplay(holder);

  if (!initialized) {
    initialized = true;
    configManager.initFromCameraParameters(theCamera);
    if (requestedFramingRectWidth > 0 && requestedFramingRectHeight > 0) {
      setManualFramingRect(requestedFramingRectWidth, requestedFramingRectHeight);
      requestedFramingRectWidth = 0;
      requestedFramingRectHeight = 0;
    }
  }

  Camera.Parameters parameters = theCamera.getParameters();
  String parametersFlattened = parameters == null ? null : parameters.flatten(); // Save these, temporarily
  try {
    configManager.setDesiredCameraParameters(theCamera, false);
  } catch (RuntimeException re) {
    // Driver failed
    Log.w(TAG, "Camera rejected parameters. Setting only minimal safe-mode parameters");
    Log.i(TAG, "Resetting to saved camera params: " + parametersFlattened);
    // Reset:
    if (parametersFlattened != null) {
      parameters = theCamera.getParameters();
      parameters.unflatten(parametersFlattened);
      try {
        theCamera.setParameters(parameters);
        configManager.setDesiredCameraParameters(theCamera, true);
      } catch (RuntimeException re2) {
        // Well, darn. Give up
        Log.w(TAG, "Camera rejected even safe-mode parameters! No configuration");
      }
    }
  }

}
项目:AndroidMultiChannelMiddleware    文件:CameraManager.java   
/**
 * Opens the camera driver and initializes the hardware parameters.
 *
 * @param holder The surface object which the camera will draw preview frames into.
 * @throws IOException Indicates the camera driver failed to open.
 */
public synchronized void openDriver(SurfaceHolder holder) throws IOException {
  Camera theCamera = camera;
  if (theCamera == null) {
    theCamera = new OpenCameraManager().build().open();
    if (theCamera == null) {
      throw new IOException();
    }
    camera = theCamera;
  }
  theCamera.setPreviewDisplay(holder);

  if (!initialized) {
    initialized = true;
    configManager.initFromCameraParameters(theCamera);
    if (requestedFramingRectWidth > 0 && requestedFramingRectHeight > 0) {
      setManualFramingRect(requestedFramingRectWidth, requestedFramingRectHeight);
      requestedFramingRectWidth = 0;
      requestedFramingRectHeight = 0;
    }
  }

  Camera.Parameters parameters = theCamera.getParameters();
  String parametersFlattened = parameters == null ? null : parameters.flatten(); // Save these, temporarily
  try {
    configManager.setDesiredCameraParameters(theCamera, false);
  } catch (RuntimeException re) {
    // Driver failed
    Log.w(TAG, "Camera rejected parameters. Setting only minimal safe-mode parameters");
    Log.i(TAG, "Resetting to saved camera params: " + parametersFlattened);
    // Reset:
    if (parametersFlattened != null) {
      parameters = theCamera.getParameters();
      parameters.unflatten(parametersFlattened);
      try {
        theCamera.setParameters(parameters);
        configManager.setDesiredCameraParameters(theCamera, true);
      } catch (RuntimeException re2) {
        // Well, darn. Give up
        Log.w(TAG, "Camera rejected even safe-mode parameters! No configuration");
      }
    }
  }

}
项目:MediModo-Android    文件:CameraManager.java   
/**
 * Opens the camera driver and initializes the hardware parameters.
 *
 * @param holder The surface object which the camera will draw preview frames into.
 * @throws IOException Indicates the camera driver failed to open.
 */
public synchronized void openDriver(SurfaceHolder holder) throws IOException
{
    Camera theCamera = camera;
    if (theCamera == null)
    {
        theCamera = new OpenCameraManager().build().open();
        if (theCamera == null)
        {
            throw new IOException();
        }
        camera = theCamera;
    }
    theCamera.setPreviewDisplay(holder);

    if (!initialized)
    {
        initialized = true;
        configManager.initFromCameraParameters(theCamera);
        if (requestedFramingRectWidth > 0 && requestedFramingRectHeight > 0)
        {
            setManualFramingRect(requestedFramingRectWidth, requestedFramingRectHeight);
            requestedFramingRectWidth = 0;
            requestedFramingRectHeight = 0;
        }
    }

    Camera.Parameters parameters = theCamera.getParameters();
    String parametersFlattened = parameters == null ? null : parameters.flatten(); // Save these, temporarily
    try
    {
        configManager.setDesiredCameraParameters(theCamera, false);
    }
    catch (RuntimeException re)
    {
        // Driver failed
        Log.w(TAG, "Camera rejected parameters. Setting only minimal safe-mode parameters");
        Log.i(TAG, "Resetting to saved camera params: " + parametersFlattened);
        // Reset:
        if (parametersFlattened != null)
        {
            parameters = theCamera.getParameters();
            parameters.unflatten(parametersFlattened);
            try
            {
                theCamera.setParameters(parameters);
                configManager.setDesiredCameraParameters(theCamera, true);
            }
            catch (RuntimeException re2)
            {
                // Well, darn. Give up
                Log.w(TAG, "Camera rejected even safe-mode parameters! No configuration");
            }
        }
    }

}