4.2.14崩溃及问题

启动其它应用时不时的不生效。附上临时解决模块

importClass(java.io.File);

function launchp(pn) {
    if (new File("/data/data/" + pn).exists()) {
        context.startActivity(context.getPackageManager().getLaunchIntentForPackage(pn));               
        sleep(1000);
        if (currentPackage() == pn) {
            return true;
        } else {
            return false;
        }
    } else {
        return false;
    }
}
module.exports = launchp;

另外在4.2.14中,调用以下代码会崩溃,

requestScreenCapture();
log(findImage(captureScreen(),images.read("./00.webp")));

附上崩溃记录

Version: 476
Android: 29
android.os.RemoteException: Remote stack trace:
	at com.android.server.media.projection.MediaProjectionManagerService$MediaProjection.start(MediaProjectionManagerService.java:476)
	at android.media.projection.IMediaProjection$Stub.onTransact(IMediaProjection.java:135)
	at android.os.Binder.execTransactInternal(Binder.java:1021)
	at android.os.Binder.execTransact(Binder.java:994)

java.lang.RuntimeException:Failure delivering result ResultInfo{who=null, request=17777, result=-1, data=Intent { (has extras) }} to activity {org.autojs.autojs/org.autojs.autojs.ui.main.MainActivity_}: java.lang.SecurityException: Media projections require a foreground service of type ServiceInfo.FOREGROUND_SERVICE_TYPE_MEDIA_PROJECTION
android.app.ActivityThread.deliverResults(ActivityThread.java:4938)
......
Caused by:
android.os.RemoteException:Remote stack trace:
	at com.android.server.media.projection.MediaProjectionManagerService$MediaProjection.start(MediaProjectionManagerService.java:476)
	at android.media.projection.IMediaProjection$Stub.onTransact(IMediaProjection.java:135)
	at android.os.Binder.execTransactInternal(Binder.java:1021)
	at android.os.Binder.execTransact(Binder.java:994)


确定是版本更新带来的,已换回13版。话说有没有人哩(¬_¬)