当我用反射打开TFS解决冲突对话框时合并工具中的合并更改不起作用,我收到此错误(TF10201),但TF命令正常工作
public static String getScreenState() throws IOException {
Process process = null;
BufferedReader buffRead;
String processString = "";
int sleepMode = -1;
int awakeMode = -1;
String screenState = "";
try {
String command = System.getProperty("java.home") + File.separator + "tools" + File.separator
+ "adb.exe shell dumpsys activity | grep mLockScreenShown";
process = Runtime.getRuntime().exec(command);
buffRead = new BufferedReader(new InputStreamReader(process.getInputStream()), 1024);
while ((processString = buffRead.readLine()) != null) {
if (processString.split("mSleeping=").length > 1) {
if (processString.split("mSleeping=")[1].startsWith("true"))
sleepMode = 0;
else if (processString.split("mSleeping=")[1].startsWith("false"))
sleepMode = 1;
}
}
try {
command = System.getProperty("java.home") + File.separator + "tools" + File.separator
+ "adb.exe shell dumpsys activity | grep mWakefulness";
process = Runtime.getRuntime().exec(command);
} catch (IOException e) {
e.printStackTrace();
}
processString = "";
buffRead = new BufferedReader(new InputStreamReader(process.getInputStream()), 1024);
while ((processString = buffRead.readLine()) != null) {
if (processString.split("mWakefulness=").length > 1) {
if (processString.split("mWakefulness=")[1].startsWith("Awake"))
awakeMode = 0;
else if (processString.split("mWakefulness=")[1].startsWith("Asleep")
|| processString.split("mWakefulness=")[1].startsWith("Dozing"))
awakeMode = 1;
}
}
} catch (IOException e) {
e.printStackTrace();
}
if (sleepMode == 0 && awakeMode == 1) {
screenState = "SCREEN_OFF";
} else if (sleepMode == 0 && awakeMode == 0) {
screenState = "SCREEN_LOCK";
} else if (sleepMode == 1 && awakeMode == 0) {
screenState = "SCREEN_ON";
}
return screenState;
}