Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static boolean isHdmiSwitchSet() {
- // The file '/sys/devices/virtual/switch/hdmi/state' holds an int -- if it's 1 then an HDMI device is connected.
- // An alternative file to check is '/sys/class/switch/hdmi/state' which exists instead on certain devices.
- File switchFile = new File("/sys/devices/virtual/switch/hdmi/state");
- if (!switchFile.exists()) {
- switchFile = new File("/sys/class/switch/hdmi/state");
- }
- try {
- Scanner switchFileScanner = new Scanner(switchFile);
- int switchValue = switchFileScanner.nextInt();
- switchFileScanner.close();
- return switchValue >= 0;
- } catch (Exception e) {
- return false;// always return false in STB Android 6.0.1
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement