import java.lang.ref.WeakReference;
import java.util.concurrent.TimeoutException;
+import java.io.*;
import java.util.*;
import android.app.*;
import android.content.Intent;
import android.content.Context;
import android.os.*;
+import android.os.Build.*;
import android.widget.Toast;
import androidx.core.app.NotificationCompat;
send_idle_mode_to_client(client);
}
+ private void send_file_failed_to_client(Messenger client, File f) {
+ Message m = Message.obtain(null, AltosDroid.MSG_FILE_FAILED, f);
+ try {
+ client.send(m);
+ } catch (RemoteException e) {
+ AltosDebug.error("Client %s disappeared", client.toString());
+ remove_client(client);
+ }
+ }
+
+ public void send_file_failed_to_clients(File f) {
+ for (Messenger client : clients)
+ send_file_failed_to_client(client, f);
+ }
+
private void telemetry_start() {
if (telemetry_reader == null && idle_monitor == null && !ignite_running) {
telemetry_reader = new TelemetryReader(altos_link, handler);
}
private void start_altos_bluetooth(DeviceAddress address, boolean pause) {
- if (bluetooth_adapter == null || !bluetooth_adapter.isEnabled())
+ if (bluetooth_adapter == null || !bluetooth_adapter.isEnabled() || address.address == null)
return;
disconnect(false);
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
AltosDebug.debug("Received start id %d: %s", startId, intent);
+ int flag;
+
+ if (android.os.Build.VERSION.SDK_INT >= 31) // android.os.Build.VERSION_CODES.S
+ flag = 33554432; // PendingIntent.FLAG_MUTABLE
+ else
+ flag = 0;
// The PendingIntent to launch our activity if the user selects this notification
PendingIntent contentIntent = PendingIntent.getActivity(this, 0,
- new Intent(this, AltosDroid.class), 0);
+ new Intent(this, AltosDroid.class), flag);
String channelId =
(Build.VERSION.SDK_INT >= Build.VERSION_CODES.O)