Fix fucking issue #193 by removing recycle in finalize
This commit is contained in:
@@ -61,22 +61,22 @@ public class ProcessShell extends AbstractShell implements AutoCloseable {
|
||||
|
||||
@Override
|
||||
public void exit() {
|
||||
if(mProcess != null) {
|
||||
if (mProcess != null) {
|
||||
mProcess.destroy();
|
||||
mProcess = null;
|
||||
}
|
||||
if(mSucceedReader != null){
|
||||
try{
|
||||
if (mSucceedReader != null) {
|
||||
try {
|
||||
mSucceedReader.close();
|
||||
}catch (IOException ignored){
|
||||
} catch (IOException ignored) {
|
||||
|
||||
}
|
||||
mSucceedReader = null;
|
||||
}
|
||||
if(mErrorReader != null){
|
||||
try{
|
||||
if (mErrorReader != null) {
|
||||
try {
|
||||
mErrorReader.close();
|
||||
}catch (IOException ignored){
|
||||
} catch (IOException ignored) {
|
||||
|
||||
}
|
||||
mErrorReader = null;
|
||||
@@ -158,8 +158,8 @@ public class ProcessShell extends AbstractShell implements AutoCloseable {
|
||||
}
|
||||
|
||||
public static Result exec(String[] commands, boolean isRoot) {
|
||||
try(ProcessShell shell = new ProcessShell(isRoot)){
|
||||
for(String command : commands){
|
||||
try (ProcessShell shell = new ProcessShell(isRoot)) {
|
||||
for (String command : commands) {
|
||||
shell.exec(command);
|
||||
}
|
||||
shell.exec(COMMAND_EXIT);
|
||||
@@ -173,4 +173,5 @@ public class ProcessShell extends AbstractShell implements AutoCloseable {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -65,7 +65,7 @@ public class UiSelector extends UiGlobalSelector {
|
||||
public void execute(AccessibilityService service, AccessibilityEvent event) {
|
||||
AccessibilityNodeInfo root = service.getRootInActiveWindow();
|
||||
if (root != null) {
|
||||
result = findOf(new UiObject(root, mAllocator));
|
||||
result = findOf(UiObject.createRoot(root, mAllocator));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -96,7 +96,7 @@ public class UiSelector extends UiGlobalSelector {
|
||||
if (service != null) {
|
||||
AccessibilityNodeInfo root = service.getRootInActiveWindow();
|
||||
if (root != null) {
|
||||
return findOf(new UiObject(root, mAllocator));
|
||||
return findOf(UiObject.createRoot(root, mAllocator));
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
||||
@@ -200,7 +200,7 @@ public class SimpleActionAutomator {
|
||||
if (root == null)
|
||||
return false;
|
||||
Log.v(TAG, "performAction: " + simpleAction + " root = " + root);
|
||||
return simpleAction.perform(new UiObject(root));
|
||||
return simpleAction.perform(UiObject.createRoot(root));
|
||||
}
|
||||
|
||||
private boolean isRunningPackageSelf() {
|
||||
|
||||
Reference in New Issue
Block a user