mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge.git
synced 2026-07-31 07:44:24 +02:00
log when Service.onTimeout gets called for foreground services
GB sometimes gets killed without any obvious cause in gadgetbridge.log. This a companion of PR #5036 to figure out potential causes.
This commit is contained in:
+22
@@ -17,12 +17,20 @@
|
||||
package nodomain.freeyourgadget.gadgetbridge.devices.pinetime;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.os.Build;
|
||||
|
||||
import androidx.annotation.RequiresApi;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import no.nordicsemi.android.dfu.DfuBaseService;
|
||||
import nodomain.freeyourgadget.gadgetbridge.BuildConfig;
|
||||
import nodomain.freeyourgadget.gadgetbridge.activities.FwAppInstallerActivity;
|
||||
|
||||
public class PineTimeDFUService extends DfuBaseService {
|
||||
private static final Logger LOG = LoggerFactory.getLogger(PineTimeDFUService.class);
|
||||
|
||||
@Override
|
||||
protected Class<? extends Activity> getNotificationTarget() {
|
||||
return FwAppInstallerActivity.class;
|
||||
@@ -32,4 +40,18 @@ public class PineTimeDFUService extends DfuBaseService {
|
||||
protected boolean isDebug() {
|
||||
return BuildConfig.DEBUG;
|
||||
}
|
||||
|
||||
@Override
|
||||
@RequiresApi(api = Build.VERSION_CODES.UPSIDE_DOWN_CAKE)
|
||||
public void onTimeout(int startId) {
|
||||
LOG.info("onTimeout startId={}", startId);
|
||||
super.onTimeout(startId);
|
||||
}
|
||||
|
||||
@Override
|
||||
@RequiresApi(api = Build.VERSION_CODES.VANILLA_ICE_CREAM)
|
||||
public void onTimeout(int startId, int fgsType) {
|
||||
LOG.info("onTimeout startId={} fgsType={}", startId, fgsType);
|
||||
super.onTimeout(startId, fgsType);
|
||||
}
|
||||
}
|
||||
|
||||
+15
@@ -52,6 +52,7 @@ import android.service.notification.StatusBarNotification;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.annotation.RequiresApi;
|
||||
import androidx.core.app.NotificationCompat;
|
||||
import androidx.core.app.RemoteInput;
|
||||
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
|
||||
@@ -1222,4 +1223,18 @@ public class NotificationListener extends NotificationListenerService {
|
||||
return remoteInput;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@RequiresApi(api = Build.VERSION_CODES.UPSIDE_DOWN_CAKE)
|
||||
public void onTimeout(int startId) {
|
||||
LOG.info("onTimeout startId={}", startId);
|
||||
super.onTimeout(startId);
|
||||
}
|
||||
|
||||
@Override
|
||||
@RequiresApi(api = Build.VERSION_CODES.VANILLA_ICE_CREAM)
|
||||
public void onTimeout(int startId, int fgsType) {
|
||||
LOG.info("onTimeout startId={} fgsType={}", startId, fgsType);
|
||||
super.onTimeout(startId, fgsType);
|
||||
}
|
||||
}
|
||||
|
||||
+15
@@ -45,6 +45,7 @@ import android.os.IBinder;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.annotation.RequiresApi;
|
||||
import androidx.core.app.ServiceCompat;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
|
||||
@@ -1633,6 +1634,20 @@ public class DeviceCommunicationService extends Service implements SharedPrefere
|
||||
return devices;
|
||||
}
|
||||
|
||||
@Override
|
||||
@RequiresApi(api = Build.VERSION_CODES.UPSIDE_DOWN_CAKE)
|
||||
public void onTimeout(int startId) {
|
||||
LOG.info("onTimeout startId={}", startId);
|
||||
super.onTimeout(startId);
|
||||
}
|
||||
|
||||
@Override
|
||||
@RequiresApi(api = Build.VERSION_CODES.VANILLA_ICE_CREAM)
|
||||
public void onTimeout(int startId, int fgsType) {
|
||||
LOG.info("onTimeout startId={} fgsType={}", startId, fgsType);
|
||||
super.onTimeout(startId, fgsType);
|
||||
}
|
||||
|
||||
private static void stressTestDispose(DeviceSupport deviceSupport) {
|
||||
SharedPreferences pref = GBApplication.getDeviceSpecificSharedPrefs(deviceSupport.getDevice().getAddress());
|
||||
final boolean extra = pref.getBoolean(PREF_DEVICE_STRESS_TEST_DISPOSE, false);
|
||||
|
||||
+16
@@ -23,9 +23,11 @@ import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.os.Build;
|
||||
import android.os.IBinder;
|
||||
import android.os.Process;
|
||||
|
||||
import androidx.annotation.RequiresApi;
|
||||
import androidx.core.app.NotificationCompat;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
@@ -113,4 +115,18 @@ public class NotificationCollectorMonitorService extends Service {
|
||||
public IBinder onBind(Intent intent) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@RequiresApi(api = Build.VERSION_CODES.UPSIDE_DOWN_CAKE)
|
||||
public void onTimeout(int startId) {
|
||||
LOG.info("onTimeout startId={}", startId);
|
||||
super.onTimeout(startId);
|
||||
}
|
||||
|
||||
@Override
|
||||
@RequiresApi(api = Build.VERSION_CODES.VANILLA_ICE_CREAM)
|
||||
public void onTimeout(int startId, int fgsType) {
|
||||
LOG.info("onTimeout startId={} fgsType={}", startId, fgsType);
|
||||
super.onTimeout(startId, fgsType);
|
||||
}
|
||||
}
|
||||
+15
@@ -40,6 +40,7 @@ import android.os.Build;
|
||||
import android.os.Handler;
|
||||
import android.os.IBinder;
|
||||
|
||||
import androidx.annotation.RequiresApi;
|
||||
import androidx.core.app.ActivityCompat;
|
||||
import androidx.core.app.NotificationCompat;
|
||||
import androidx.core.app.ServiceCompat;
|
||||
@@ -428,4 +429,18 @@ public class BLEScanService extends Service {
|
||||
// TODO: Return the communication channel to the service.
|
||||
throw new UnsupportedOperationException("Not yet implemented");
|
||||
}
|
||||
|
||||
@Override
|
||||
@RequiresApi(api = Build.VERSION_CODES.UPSIDE_DOWN_CAKE)
|
||||
public void onTimeout(int startId) {
|
||||
LOG.info("onTimeout startId={}", startId);
|
||||
super.onTimeout(startId);
|
||||
}
|
||||
|
||||
@Override
|
||||
@RequiresApi(api = Build.VERSION_CODES.VANILLA_ICE_CREAM)
|
||||
public void onTimeout(int startId, int fgsType) {
|
||||
LOG.info("onTimeout startId={} fgsType={}", startId, fgsType);
|
||||
super.onTimeout(startId, fgsType);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user