Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ captures/
.idea/navEditor.xml
.idea/deploymentTargetSelector.xml
.idea/other.xml
.idea/copilot*

# Keystore files
# Uncomment the following lines if you do not want to check your keystore files in.
Expand Down
17 changes: 0 additions & 17 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">

<uses-permission
android:name="android.permission.BLUETOOTH"
android:maxSdkVersion="30" />
<uses-permission
android:name="android.permission.BLUETOOTH_ADMIN"
android:maxSdkVersion="30" />
<uses-permission
android:name="android.permission.ACCESS_COARSE_LOCATION"
android:maxSdkVersion="30" />
<uses-permission
android:name="android.permission.ACCESS_FINE_LOCATION"
android:maxSdkVersion="30" />
<uses-permission
android:name="android.permission.BLUETOOTH_SCAN"
android:usesPermissionFlags="neverForLocation"
tools:ignore="UnusedAttribute" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/java/com/valterc/ki2/Ki2Application.java
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,8 @@ protected void log(int priority, @Nullable String tag, @NonNull String message,

antRecorderManager = new AntRecorderManager(this);
registerActivityLifecycleCallbacks(activityLifecycleCallbacks);
ki2ServiceBound = bindService(Ki2Service.getIntent(), ki2ServiceConnection, BIND_AUTO_CREATE);
bindService(Ki2ExtensionService.Companion.getIntent(), extensionServiceConnection, BIND_AUTO_CREATE);
ki2ServiceBound = bindService(Ki2Service.getIntent(), ki2ServiceConnection, BIND_AUTO_CREATE | BIND_IMPORTANT);
bindService(Ki2ExtensionService.Companion.getIntent(), extensionServiceConnection, BIND_AUTO_CREATE | BIND_IMPORTANT);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ public class ServiceClient {
private final ServiceConnection serviceConnection = new ServiceConnection() {
@Override
public void onServiceConnected(ComponentName name, IBinder binder) {
Timber.i("[%s] Service connected", name.getShortClassName());
service = IKi2Service.Stub.asInterface(binder);

registrationMessage.setUnregistered();
Expand All @@ -64,6 +65,7 @@ public void onServiceConnected(ComponentName name, IBinder binder) {

@Override
public void onServiceDisconnected(ComponentName name) {
Timber.w("[%s] Service disconnected", name.getShortClassName());
service = null;

registrationMessage.setUnregistered();
Expand All @@ -86,6 +88,7 @@ public void onServiceDisconnected(ComponentName name) {

@Override
public void onBindingDied(ComponentName name) {
Timber.w("[%s] Service bind died", name.getShortClassName());
service = null;

registrationMessage.setUnregistered();
Expand Down Expand Up @@ -162,7 +165,8 @@ public ServiceClient(Context context) {
}

private void attemptBindToService() {
boolean result = context.bindService(Ki2Service.getIntent(), serviceConnection, Context.BIND_AUTO_CREATE);
boolean result = context.bindService(Ki2Service.getIntent(), serviceConnection, Context.BIND_AUTO_CREATE | Context.BIND_IMPORTANT);
Timber.i("Service bind result = %s", result);
if (!result) {
handler.postDelayed(this::attemptBindToService, (int) (TIME_MS_ATTEMPT_BIND * (1 + 2 * Math.random())));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ public DeviceDataFrontend(Context context) {
}

public void setService(IKi2Service service) {
Timber.i("Setting service reference to: %s", service != null ? "Ki2Service" : "null");
this.service = service;

registrationConnectionInfo.setUnregistered();
Expand Down
5 changes: 3 additions & 2 deletions app/src/main/java/com/valterc/ki2/services/Ki2Service.java
Original file line number Diff line number Diff line change
Expand Up @@ -494,15 +494,15 @@ public List<DeviceId> getSavedDevices() {
private final BroadcastReceiver receiverReconnectDevices = new BroadcastReceiver() {
@Override
public void onReceive(final Context context, final Intent intent) {
Timber.d("Received reconnect devices broadcast");
Timber.i("Received reconnect devices broadcast");
serviceHandler.postRetriableAction(() -> antConnectionManager.restartClosedConnections(Ki2Service.this));
}
};

private final BroadcastReceiver receiverInRide = new BroadcastReceiver() {
@Override
public void onReceive(final Context context, final Intent intent) {
Timber.d("Received In Ride broadcast");
Timber.i("Received In Ride broadcast");
serviceHandler.postRetriableAction(() -> onMessage(new RideStatusMessage(RideStatus.ONGOING)));
}
};
Expand Down Expand Up @@ -551,6 +551,7 @@ public void onCreate() {

@Override
public void onDestroy() {
Timber.i("Service destroyed");
antConnectionManager.disconnectAll();

antManager.dispose();
Expand Down