How can I enable default flashlight turn off or on feature in camera2, Can I enable settings options in it like default camera?
I seen some example like here and here but they are using their own buttons to turn on or off flash, here I want to use the default one by enabling it.
Any suggestions would be appreciated.
You need to set the camera's auto-exposure mode to one of the flash-using ones; generally that's either AE_MODE_ON_AUTO_FLASH or AE_MODE_ON_ALWAYS_FLASH.
You can check which modes are available on your device via AE_AVAILABLE_MODES.
Then you'll need to use the AE precapture trigger before doing the main image capture, so that a preflash can be fired for accurate flash brightness control.
The Camera2Basic sample includes all this for flash operation, as a sample to follow. It uses AE_MODE_AUTO_FLASH if supported by the device.