Xiaomi: Cleanup code and comments

This commit is contained in:
José Rebelo 2023-11-25 22:18:34 +00:00
parent 7416159ba2
commit e91ad80d27
14 changed files with 19 additions and 39 deletions

View File

@ -293,7 +293,7 @@ dependencies {
implementation 'com.android.volley:volley:1.2.1'
// Bouncy Castle is included directly in GB, to avoid pulling the entire dependency
// it's included in the org.bouncycastle.shaded package, to prevent conflicts with
// It's included in the org.bouncycastle.shaded package, to fix conflicts with
// roboelectric
//implementation 'org.bouncycastle:bcpkix-jdk18on:1.76'
//implementation 'org.bouncycastle:bcprov-jdk18on:1.76'

View File

@ -31,6 +31,7 @@ import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import nodomain.freeyourgadget.gadgetbridge.BuildConfig;
import nodomain.freeyourgadget.gadgetbridge.GBException;
import nodomain.freeyourgadget.gadgetbridge.R;
import nodomain.freeyourgadget.gadgetbridge.activities.appmanager.AppManagerActivity;
@ -205,7 +206,8 @@ public abstract class XiaomiCoordinator extends AbstractBLEDeviceCoordinator {
@Override
public boolean supportsActivityTracks() {
return true;
// TODO It does, but not yet fully working
return BuildConfig.DEBUG;
}
@Override
@ -215,13 +217,14 @@ public abstract class XiaomiCoordinator extends AbstractBLEDeviceCoordinator {
@Override
public boolean supportsSpo2() {
return true;
// TODO it does, but not yet implemented, so let's not crash
return false;
}
@Override
public boolean supportsHeartRateStats() {
// TODO does it?
return true;
return false;
}
@Override
@ -233,12 +236,11 @@ public abstract class XiaomiCoordinator extends AbstractBLEDeviceCoordinator {
@Override
public boolean supportsSleepRespiratoryRate() {
// TODO does it?
return true;
return false;
}
@Override
public boolean supportsAlarmSnoozing() {
// TODO does it?
return false;
}
@ -267,8 +269,8 @@ public abstract class XiaomiCoordinator extends AbstractBLEDeviceCoordinator {
@Override
public int getWorldClocksSlotCount() {
// TODO how many?
return 5;
// TODO how many? also, map world clocks
return 0;
}
@Override
@ -291,7 +293,6 @@ public abstract class XiaomiCoordinator extends AbstractBLEDeviceCoordinator {
@Override
public boolean supportsManualHeartRateMeasurement(final GBDevice device) {
// TODO orchestrate
return true;
}
@ -302,7 +303,6 @@ public abstract class XiaomiCoordinator extends AbstractBLEDeviceCoordinator {
@Override
public boolean supportsRealtimeData() {
// TODO supports steps?
return true;
}
@ -461,13 +461,13 @@ public abstract class XiaomiCoordinator extends AbstractBLEDeviceCoordinator {
@Override
public boolean supportsNotificationVibrationPatterns() {
// TODO maybe can used this
// TODO maybe can use this
return true;
}
@Override
public boolean supportsNotificationVibrationRepetitionPatterns() {
// TODO maybe can used this
// TODO maybe can use this
return true;
}
@ -478,13 +478,13 @@ public abstract class XiaomiCoordinator extends AbstractBLEDeviceCoordinator {
@Override
public AbstractNotificationPattern[] getNotificationVibrationPatterns() {
// TODO maybe can used this
// TODO maybe can use this
return new AbstractNotificationPattern[0];
}
@Override
public AbstractNotificationPattern[] getNotificationVibrationRepetitionPatterns() {
// TODO maybe can used this
// TODO maybe can use this
return new AbstractNotificationPattern[0];
}

View File

@ -786,7 +786,7 @@ public class NotificationListener extends NotificationListenerService {
notificationsActive.removeAll(notificationsToRemove);
// TODO prevent this from being called multiple times for the same ID
// TODO prevent thins from being called form notifications removed from the device
// TODO prevent this from being called form notifications removed from the device
// Send notification remove request to device
List<GBDevice> devices = GBApplication.app().getDeviceManager().getDevices();

View File

@ -22,7 +22,6 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. */
package nodomain.freeyourgadget.gadgetbridge.service;
import android.app.Service;
import android.bluetooth.BluetoothAdapter;
import android.content.Context;
import android.util.Log;

View File

@ -378,15 +378,9 @@ public abstract class XiaomiSupport extends AbstractBTLEDeviceSupport {
healthService.enableRealtimeStats(enable);
}
@Override
public void onScreenshotReq() {
// TODO
super.onScreenshotReq();
}
@Override
public void onEnableHeartRateSleepSupport(final boolean enable) {
// TODO
// TODO onEnableHeartRateSleepSupport
super.onEnableHeartRateSleepSupport(enable);
}

View File

@ -44,6 +44,7 @@ public class SleepDetailsParser extends XiaomiActivityParser {
final int wakeupTime = buf.getInt();
LOG.info("Bed time: {}, wake up time: {}", bedTime, wakeupTime);
// TODO save timestamps and overlay on activity
// TODO everything else...
return false;

View File

@ -21,7 +21,6 @@ import android.content.Context;
import nodomain.freeyourgadget.gadgetbridge.GBApplication;
import nodomain.freeyourgadget.gadgetbridge.devices.xiaomi.XiaomiCoordinator;
import nodomain.freeyourgadget.gadgetbridge.proto.xiaomi.XiaomiProto;
import nodomain.freeyourgadget.gadgetbridge.service.btle.TransactionBuilder;
import nodomain.freeyourgadget.gadgetbridge.service.devices.xiaomi.XiaomiSupport;
import nodomain.freeyourgadget.gadgetbridge.util.Prefs;

View File

@ -29,7 +29,6 @@ import nodomain.freeyourgadget.gadgetbridge.GBApplication;
import nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst;
import nodomain.freeyourgadget.gadgetbridge.model.CalendarEventSpec;
import nodomain.freeyourgadget.gadgetbridge.proto.xiaomi.XiaomiProto;
import nodomain.freeyourgadget.gadgetbridge.service.btle.TransactionBuilder;
import nodomain.freeyourgadget.gadgetbridge.service.devices.xiaomi.XiaomiSupport;
import nodomain.freeyourgadget.gadgetbridge.util.Prefs;
import nodomain.freeyourgadget.gadgetbridge.util.StringUtils;

View File

@ -18,7 +18,6 @@ package nodomain.freeyourgadget.gadgetbridge.service.devices.xiaomi.services;
import android.content.Intent;
import android.location.Location;
import android.os.Build;
import android.os.Handler;
import androidx.localbroadcastmanager.content.LocalBroadcastManager;

View File

@ -114,8 +114,6 @@ public class XiaomiNotificationService extends AbstractXiaomiService implements
LOG.warn("Unhandled notification command {}", cmd.getSubtype());
}
public void onNotification(final NotificationSpec notificationSpec) {
final XiaomiProto.Notification3.Builder notification3 = XiaomiProto.Notification3.newBuilder()
.setId(notificationSpec.getId())
@ -179,7 +177,6 @@ public class XiaomiNotificationService extends AbstractXiaomiService implements
}
public void onSetCallState(final CallSpec callSpec) {
// TODO handle callSpec.command
if (callSpec.command == CallSpec.CALL_OUTGOING) {
return;
}

View File

@ -89,7 +89,6 @@ public class XiaomiSystemService extends AbstractXiaomiService implements Xiaomi
@Override
public void handleCommand(final XiaomiProto.Command cmd) {
// TODO
switch (cmd.getSubtype()) {
case CMD_DEVICE_INFO:
handleDeviceInfo(cmd.getSystem().getDeviceInfo());
@ -476,10 +475,6 @@ public class XiaomiSystemService extends AbstractXiaomiService implements Xiaomi
unsetDeviceBusy();
if (success) {
// TODO do we need to reboot?
}
fwHelper = null;
}
@ -499,6 +494,7 @@ public class XiaomiSystemService extends AbstractXiaomiService implements Xiaomi
}
}
// TODO do we even need this? also prevent NPE when unknown
private static final Map<String, String> DISPLAY_ITEM_NAMES = new HashMap<String, String>() {{
put("today_act", "Stats");
put("sport", "Workout");

View File

@ -59,11 +59,9 @@ public class XiaomiWatchfaceService extends AbstractXiaomiService implements Xia
@Override
public void handleCommand(final XiaomiProto.Command cmd) {
// TODO
switch (cmd.getSubtype()) {
case CMD_WATCHFACE_LIST:
handleWatchfaceList(cmd.getWatchface().getWatchfaceList());
// TODO handle
return;
case CMD_WATCHFACE_SET:
LOG.debug("Got watchface set response, ack={}", cmd.getWatchface().getAck());

View File

@ -206,6 +206,5 @@ public class XiaomiWeatherService extends AbstractXiaomiService {
.format(new Date(timestamp * 1000L)))
.insert(22, ':') // FIXME: I bet this fails for some, but all this java date craps sucks
.toString();
}
}
}

View File

@ -2394,7 +2394,6 @@
<string name="temperature_scale_cf_summary">Select whether device uses Celsius or Fahrenheit scale.</string>
<string name="temperature_scale_celsius">Celsius</string>
<string name="temperature_scale_fahrenheit">Fahrenheit</string>
<string name="fossil_hr_nav_app_not_installed_notify_title">Navigation app not installed on watch</string>
<string name="fossil_hr_nav_app_not_installed_notify_text">Navigation started but navigationApp not installed on watch. Please install it from the App Manager.</string>
<string name="call_rejection_method_reject">Reject</string>