Fix crash when connecting to RC but aircraft is not on

Fix for starting aircraft after already connected to RC

Fix video service crash
Esse commit está contido em:
Stephen Dowhy
2018-07-16 12:33:37 -07:00
commit 7138d8e0b6
2 arquivos alterados com 14 adições e 18 exclusões
@@ -664,6 +664,17 @@ public class MainActivity extends AppCompatActivity {
}
private void onDroneConnected() {
if (mProduct.getModel() == null) {
logMessageDJI("Aircraft is not on!");
return;
}
if (mProduct.getBattery() == null) {
logMessageDJI("Reconnect your android device to the RC for full functionality.");
return;
}
mGCSCommunicator = new GCSCommunicatorAsyncTask(this);
mGCSCommunicator.execute();
@@ -1,7 +1,5 @@
package sq.rogue.rosettadrone.video;
import android.annotation.TargetApi;
import android.app.IntentService;
import android.app.Notification;
import android.app.NotificationChannel;
import android.app.NotificationManager;
@@ -10,10 +8,6 @@ import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.graphics.Color;
import android.icu.util.Output;
import android.net.LocalSocket;
import android.net.LocalSocketAddress;
import android.os.Binder;
import android.os.Build;
import android.os.IBinder;
import android.preference.PreferenceManager;
@@ -22,24 +16,13 @@ import android.support.annotation.RequiresApi;
import android.support.v4.app.NotificationCompat;
import android.util.Log;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PipedInputStream;
import java.io.PipedOutputStream;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.Arrays;
import dji.common.product.Model;
import dji.sdk.base.BaseProduct;
import dji.sdk.camera.VideoFeeder;
import dji.thirdparty.sanselan.util.IOUtils;
import sq.rogue.rosettadrone.DroneModel;
import sq.rogue.rosettadrone.R;
import static android.support.v4.app.NotificationCompat.PRIORITY_MIN;
@@ -203,7 +186,9 @@ public class VideoService extends Service implements DJIVideoStreamDecoder.IYuvD
DJIVideoStreamDecoder.getInstance().stop();
thread.interrupt();
if (thread != null) {
thread.interrupt();
}
thread = null;
// mGCSCommunicator.cancel(true);
}