設置有線mac地址
ifconfig eth0 hw ether?021234567000
讀取mac地址
? ? public static String getEthMacAddressBySysFs() {
? ? ? ? try (BufferedReader reader = new BufferedReader(new FileReader("/sys/class/net/eth0/address"))) {
? ? ? ? ? ? return reader.readLine().trim(); // 如 "00:11:22:33:44:55"
? ? ? ? } catch (Exception e) {
? ? ? ? ? ? return "00:00:00:00:00:00";
? ? ? ? }
? ? }
設置屏幕亮度
? ? ? ? val ps = Runtime.getRuntime().exec("su") //1、執行su切換到root權限
? ? ? ? val dos = DataOutputStream(ps.outputStream)
? ? ? ? dos.writeBytes("echo 200 > /sys/class/backlight/backlight/brightness" + "\n") // 2、向進程內寫入shell指令,cmd為要執行的shell命令字符串
? ? ? ? dos.flush()
關閉后臺進程
dos.writeBytes("am force-stop \"org.videolan.vlc\"" + "\n")