[Verizon Samsung Galaxy S 4] DerekZ10:
Free to use as long as you don't repackage it as is but with ads or put a price on the app. However if you are creating your own app and just want to use the flashlight feature, you can use the below code however you want. I think the git code is way out of date, I worked on it a bit a while ago and I don't think I comited it. I've gotten busy and haven't had a chance to work on it in months.

Here is the code for directly changing the brightness. Free to Use however you wish.

Here is the Shell Class. The Static Methods create and maintain the superuser shell. Therefor a command can be executed app wide on a single shell instead of creating multiple Shell instances.

package derekziemba.misc;
import java.io.*;

public class Shell {
private static Shell rootShell = null;
private final Process proc;
private final OutputStreamWriter writer;

private Shell() throws IOException {//Open with Root Privileges
this.proc = new ProcessBuilder("su").redirectErrorStream(true).start();
this.writer = new OutputStreamWriter(this.proc.getOutputStream(), "UTF-8");
}

private void cmd(String command) {
try{ writer.write(command+'\n'); writer.flush();}
catch(IOException e) {	}
}

public void close() {
try {
if (writer != null) { writer.close();
if(proc != null) {	proc.destroy(); }
}
} catch (IOException ignore) {}
}

public static void exec(String command) { Shell.get().cmd(command); }

public static Shell get() {
if (rootShell == null) {
while (rootShell == null) {
try {	rootShell = new Shell(); }
catch (IOException e) {	}
}
}
return rootShell;
}
}
}

Here is what is used for setting the flash brightness. I stripped out all the app logic. SetLevelCovertly is the actual method used for setting the brightness. It is what the TorchPlayer uses to directly change the brightness in just milliseconds. The stripped away normal SetLevel method records the brightness, triggers the broadcasts, sets the widgets, and fires the notification. There is no way of getting the current flashlevel brightness since my Shell implementation is just for blasting commands at the terminal. Anything more will slow it down.

The listOfFlashFiles is a bunch of different files different phones may use. I've only ever tested the samsung file.

import java.io.File;
import derekziemba.misc.Shell;

public class Torch
{
private static String FLASH_FILE = null;

private static final String[] listOfFlashFiles = {
"/sys/class/camera/flash/rear_flash",
"/sys/class/camera/rear/rear_flash",
"/sys/class/leds/flashlight/brightness",
"/sys/devices/platform/flashlight.0/leds/flashlight/brightness",
"/sys/class/leds/spotlight/brightness",
"/sys/class/leds/torch-flash/flash_light"
};

/**
* Bypasses all checks and settings and just sets the value. The app will not know what the level is because it is not recorded.
* Will not trigger broadcast, widget views, notification
*/
public static void setLevelCovertly(int value) {	Shell.exec("echo " + value + " > "+ getSysFsFile());	}

public static String getSysFsFile() {
if (FLASH_FILE != null) return FLASH_FILE;
for (String filePath : listOfFlashFiles) {
File flashFile = new File(filePath);
if (flashFile.exists()) {	FLASH_FILE = filePath;	}
}
return FLASH_FILE;
}