mirror of
https://repository.entgra.net/community/device-mgt-plugins.git
synced 2025-09-16 23:42:15 +00:00
Code clean up
This commit is contained in:
parent
7c5c0de4ee
commit
b1e8687751
@ -308,8 +308,8 @@ public class TryIt {
|
|||||||
ArrayList<String> devices = new ArrayList<>();
|
ArrayList<String> devices = new ArrayList<>();
|
||||||
BufferedReader reader = null;
|
BufferedReader reader = null;
|
||||||
try {
|
try {
|
||||||
reader = new BufferedReader(new InputStreamReader(listAVDsProcess.getInputStream()
|
reader = new BufferedReader(new InputStreamReader(listAVDsProcess.getInputStream(),
|
||||||
, StandardCharsets.UTF_8));
|
StandardCharsets.UTF_8));
|
||||||
String readLine;
|
String readLine;
|
||||||
while ((readLine = reader.readLine()) != null) {
|
while ((readLine = reader.readLine()) != null) {
|
||||||
devices.add(readLine);
|
devices.add(readLine);
|
||||||
@ -403,7 +403,6 @@ public class TryIt {
|
|||||||
* @throws IOException process start throws if an I/O error occurs.
|
* @throws IOException process start throws if an I/O error occurs.
|
||||||
*/
|
*/
|
||||||
private void runEmulator(String deviceId) throws IOException {
|
private void runEmulator(String deviceId) throws IOException {
|
||||||
|
|
||||||
// mac os and windows needs hardware_Accelerated_execution_Manager
|
// mac os and windows needs hardware_Accelerated_execution_Manager
|
||||||
if (osSuffix.equals(Constants.MAC_OS) || osSuffix.equals(Constants.WINDOWS_OS)) {
|
if (osSuffix.equals(Constants.MAC_OS) || osSuffix.equals(Constants.WINDOWS_OS)) {
|
||||||
installHAXM();
|
installHAXM();
|
||||||
@ -552,8 +551,6 @@ public class TryIt {
|
|||||||
try {
|
try {
|
||||||
reader = new BufferedReader(new InputStreamReader(badgingApkFileProcess.getInputStream(),
|
reader = new BufferedReader(new InputStreamReader(badgingApkFileProcess.getInputStream(),
|
||||||
StandardCharsets.UTF_8));
|
StandardCharsets.UTF_8));
|
||||||
|
|
||||||
|
|
||||||
while ((readLine = reader.readLine()) != null) {
|
while ((readLine = reader.readLine()) != null) {
|
||||||
if (readLine.contains("package")) {
|
if (readLine.contains("package")) {
|
||||||
pkg = readLine.substring(readLine.indexOf(Constants.NAME) + 6).substring(0,
|
pkg = readLine.substring(readLine.indexOf(Constants.NAME) + 6).substring(0,
|
||||||
@ -613,7 +610,6 @@ public class TryIt {
|
|||||||
ProcessBuilder installAgentProcessBuilder = new ProcessBuilder(adbLocation, "install",
|
ProcessBuilder installAgentProcessBuilder = new ProcessBuilder(adbLocation, "install",
|
||||||
androidAgentLocation);
|
androidAgentLocation);
|
||||||
Process installAgentProcess = installAgentProcessBuilder.start();
|
Process installAgentProcess = installAgentProcessBuilder.start();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
installAgentProcess.waitFor();
|
installAgentProcess.waitFor();
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
@ -715,14 +711,14 @@ public class TryIt {
|
|||||||
try {
|
try {
|
||||||
process = processBuilder.start();
|
process = processBuilder.start();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
handleException("HAXM installation failed", e);
|
System.out.println("HAXM installation failed, install HAXM and try again");
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
if (process != null) {
|
if (process != null) {
|
||||||
process.waitFor();
|
process.waitFor();
|
||||||
}
|
}
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
handleException("HAXM installation failed", e);
|
System.out.println("HAXM installation failed, install HAXM and try again");
|
||||||
}
|
}
|
||||||
System.out.println("Please restart your machine and run again.");
|
System.out.println("Please restart your machine and run again.");
|
||||||
System.exit(0);
|
System.exit(0);
|
||||||
|
|||||||
@ -46,13 +46,16 @@ public class TryItEmulator implements Runnable {
|
|||||||
ProcessBuilder processBuilder = new ProcessBuilder(emulatorLocation, "-avd", deviceId);
|
ProcessBuilder processBuilder = new ProcessBuilder(emulatorLocation, "-avd", deviceId);
|
||||||
try {
|
try {
|
||||||
Process process = processBuilder.start();
|
Process process = processBuilder.start();
|
||||||
reader = new BufferedReader(new InputStreamReader(process.getInputStream(), StandardCharsets.UTF_8));
|
reader = new BufferedReader(new InputStreamReader(process.getInputStream(),
|
||||||
writer = new OutputStreamWriter(new FileOutputStream(new File("emulator.log")), StandardCharsets.UTF_8);
|
StandardCharsets.UTF_8));
|
||||||
|
writer = new OutputStreamWriter(new FileOutputStream(new File("emulator.log")),
|
||||||
|
StandardCharsets.UTF_8);
|
||||||
while ((readLine = reader.readLine()) != null) {
|
while ((readLine = reader.readLine()) != null) {
|
||||||
writer.append(readLine);
|
writer.append(readLine);
|
||||||
writer.append(readLine);
|
writer.append(readLine);
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
System.out.println("Error in starting " + deviceId);
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
} finally {
|
} finally {
|
||||||
if (reader != null) {
|
if (reader != null) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user