CameraManager.TorchCallback
  public
  static
  
  abstract
  class
  CameraManager.TorchCallback
  
    extends Object
  
  
  
  
  
  
| java.lang.Object | |
| ↳ | android.hardware.camera2.CameraManager.TorchCallback | 
A callback for camera flash torch modes becoming unavailable, disabled, or enabled.
The torch mode becomes unavailable when the camera device it belongs to becomes
 unavailable or other camera resources it needs become busy due to other higher priority
 camera activities. The torch mode becomes disabled when it was turned off or when the camera
 device it belongs to is no longer in use and other camera resources it needs are no longer
 busy. A camera's torch mode is turned off when an application calls CameraManager.setTorchMode(String, boolean) to
 turn off the camera's torch mode, or when an application turns on another camera's torch mode
 if keeping multiple torch modes on simultaneously is not supported. The torch mode becomes
 enabled when it is turned on via CameraManager.setTorchMode(String, boolean).
The torch mode is available to set via CameraManager.setTorchMode(String, boolean) only when it's in a disabled
 or enabled state.
Extend this callback and pass an instance of the subclass to
 CameraManager.registerTorchCallback to be notified of such status changes.
 
Summary
| Public constructors | |
|---|---|
| 
      TorchCallback()
       | |
| Public methods | |
|---|---|
| 
        
        
        
        
        
        void | 
      onTorchModeChanged(String cameraId, boolean enabled)
      A camera's torch mode has become enabled or disabled and can be changed via
  | 
| 
        
        
        
        
        
        void | 
      onTorchModeUnavailable(String cameraId)
      A camera's torch mode has become unavailable to set via  | 
| 
        
        
        
        
        
        void | 
      onTorchStrengthLevelChanged(String cameraId, int newStrengthLevel)
      A camera's flash unit brightness level has been changed in torch mode via
  | 
| Inherited methods | |
|---|---|
Public constructors
TorchCallback
public TorchCallback ()
Public methods
onTorchModeChanged
public void onTorchModeChanged (String cameraId, boolean enabled)
A camera's torch mode has become enabled or disabled and can be changed via
 CameraManager.setTorchMode(String, boolean).
 
The default implementation of this method does nothing.
| Parameters | |
|---|---|
| cameraId | String: The unique identifier of the camera whose torch mode has been changed.
 This value cannot benull. | 
| enabled | boolean: The state that the torch mode of the camera has been changed to.truewhen the torch mode has become on and available to be turned
                off.falsewhen the torch mode has becomes off and available to
                be turned on. | 
onTorchModeUnavailable
public void onTorchModeUnavailable (String cameraId)
A camera's torch mode has become unavailable to set via CameraManager.setTorchMode(String, boolean).
 
If torch mode was previously turned on by calling CameraManager.setTorchMode(String, boolean), it will be
 turned off before CameraManager.TorchCallback.onTorchModeUnavailable is
 invoked. CameraManager.setTorchMode(String, boolean) will fail until the torch mode has entered a disabled or
 enabled state again.
The default implementation of this method does nothing.
| Parameters | |
|---|---|
| cameraId | String: The unique identifier of the camera whose torch mode has become
                 unavailable.
 This value cannot benull. | 
onTorchStrengthLevelChanged
public void onTorchStrengthLevelChanged (String cameraId, int newStrengthLevel)
A camera's flash unit brightness level has been changed in torch mode via
 CameraManager.turnOnTorchWithStrengthLevel(String, int). When the torch is turned OFF, this
 callback will not be triggered even though the torch strength level resets to
 default value
 CameraCharacteristics.FLASH_INFO_STRENGTH_DEFAULT_LEVEL
 
The default implementation of this method does nothing.
| Parameters | |
|---|---|
| cameraId | String: The unique identifier of the camera whose flash unit brightness level has
 been changed.
 This value cannot benull. | 
| newStrengthLevel | int: The brightness level of the flash unit that has been changed to. | 
