I would research about android.permission.FLASHLIGHT
.
Android manifests' permission looks promising:
<!-- Allows access to the flashlight -->
<permission android:name="android.permission.FLASHLIGHT"
android:permissionGroup="android.permission-group.HARDWARE_CONTROLS"
android:protectionLevel="normal"
android:label="@string/permlab_flashlight"
android:description="@string/permdesc_flashlight" />
EDIT:
I just found a project that uses this permission.
Check quick-settings' src code.
I would look into /src/com/bwx/bequick/flashlight.