fix(ui): ui callbacks still alive after script exit
This commit is contained in:
@@ -112,4 +112,8 @@ public class Timer {
|
||||
return mMaxCallbackUptimeMillis > SystemClock.uptimeMillis();
|
||||
}
|
||||
|
||||
public void removeAllCallbacks() {
|
||||
mHandler.removeCallbacksAndMessages(null);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -373,6 +373,7 @@ public class ScriptRuntime {
|
||||
ignoresException(images::releaseScreenCapturer);
|
||||
}
|
||||
ignoresException(sensors::unregisterAll);
|
||||
ignoresException(timers::recycle);
|
||||
}
|
||||
|
||||
private void ignoresException(Runnable r) {
|
||||
|
||||
@@ -87,4 +87,8 @@ public class Timers {
|
||||
return getTimerForCurrentThread().hasPendingCallbacks();
|
||||
}
|
||||
|
||||
public void recycle(){
|
||||
mMainTimer.removeAllCallbacks();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user