修复 captureScreen()可能造成死循环的问题
This commit is contained in:
@@ -1,10 +1,5 @@
|
||||
package com.stardust.autojs.core.http;
|
||||
|
||||
import android.widget.AdapterView;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.net.Proxy;
|
||||
import java.util.Collections;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@ import android.view.OrientationEventListener;
|
||||
|
||||
import com.stardust.autojs.runtime.exception.ScriptException;
|
||||
import com.stardust.autojs.runtime.exception.ScriptInterruptedException;
|
||||
import com.stardust.lang.ThreadCompat;
|
||||
import com.stardust.util.ScreenMetrics;
|
||||
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
@@ -152,7 +153,8 @@ public class ScreenCapturer {
|
||||
mException = null;
|
||||
throw new ScriptException(e);
|
||||
}
|
||||
while (true) {
|
||||
Thread thread = ThreadCompat.currentThread();
|
||||
while (!thread.isInterrupted()) {
|
||||
Image cachedImage = mCachedImage.getAndSet(null);
|
||||
if (cachedImage != null) {
|
||||
if (mUnderUsingImage != null) {
|
||||
@@ -162,6 +164,7 @@ public class ScreenCapturer {
|
||||
return cachedImage;
|
||||
}
|
||||
}
|
||||
throw new ScriptInterruptedException();
|
||||
}
|
||||
|
||||
public int getScreenDensity() {
|
||||
|
||||
Reference in New Issue
Block a user