mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge.git
synced 2025-01-10 17:11:56 +01:00
Xiaomi: Cleanup code and comments
This commit is contained in:
parent
7416159ba2
commit
e91ad80d27
@ -293,7 +293,7 @@ dependencies {
|
|||||||
implementation 'com.android.volley:volley:1.2.1'
|
implementation 'com.android.volley:volley:1.2.1'
|
||||||
|
|
||||||
// Bouncy Castle is included directly in GB, to avoid pulling the entire dependency
|
// 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
|
// roboelectric
|
||||||
//implementation 'org.bouncycastle:bcpkix-jdk18on:1.76'
|
//implementation 'org.bouncycastle:bcpkix-jdk18on:1.76'
|
||||||
//implementation 'org.bouncycastle:bcprov-jdk18on:1.76'
|
//implementation 'org.bouncycastle:bcprov-jdk18on:1.76'
|
||||||
|
@ -31,6 +31,7 @@ import java.util.Arrays;
|
|||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import nodomain.freeyourgadget.gadgetbridge.BuildConfig;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.GBException;
|
import nodomain.freeyourgadget.gadgetbridge.GBException;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.R;
|
import nodomain.freeyourgadget.gadgetbridge.R;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.activities.appmanager.AppManagerActivity;
|
import nodomain.freeyourgadget.gadgetbridge.activities.appmanager.AppManagerActivity;
|
||||||
@ -205,7 +206,8 @@ public abstract class XiaomiCoordinator extends AbstractBLEDeviceCoordinator {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean supportsActivityTracks() {
|
public boolean supportsActivityTracks() {
|
||||||
return true;
|
// TODO It does, but not yet fully working
|
||||||
|
return BuildConfig.DEBUG;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -215,13 +217,14 @@ public abstract class XiaomiCoordinator extends AbstractBLEDeviceCoordinator {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean supportsSpo2() {
|
public boolean supportsSpo2() {
|
||||||
return true;
|
// TODO it does, but not yet implemented, so let's not crash
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean supportsHeartRateStats() {
|
public boolean supportsHeartRateStats() {
|
||||||
// TODO does it?
|
// TODO does it?
|
||||||
return true;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -233,12 +236,11 @@ public abstract class XiaomiCoordinator extends AbstractBLEDeviceCoordinator {
|
|||||||
@Override
|
@Override
|
||||||
public boolean supportsSleepRespiratoryRate() {
|
public boolean supportsSleepRespiratoryRate() {
|
||||||
// TODO does it?
|
// TODO does it?
|
||||||
return true;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean supportsAlarmSnoozing() {
|
public boolean supportsAlarmSnoozing() {
|
||||||
// TODO does it?
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -267,8 +269,8 @@ public abstract class XiaomiCoordinator extends AbstractBLEDeviceCoordinator {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getWorldClocksSlotCount() {
|
public int getWorldClocksSlotCount() {
|
||||||
// TODO how many?
|
// TODO how many? also, map world clocks
|
||||||
return 5;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -291,7 +293,6 @@ public abstract class XiaomiCoordinator extends AbstractBLEDeviceCoordinator {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean supportsManualHeartRateMeasurement(final GBDevice device) {
|
public boolean supportsManualHeartRateMeasurement(final GBDevice device) {
|
||||||
// TODO orchestrate
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -302,7 +303,6 @@ public abstract class XiaomiCoordinator extends AbstractBLEDeviceCoordinator {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean supportsRealtimeData() {
|
public boolean supportsRealtimeData() {
|
||||||
// TODO supports steps?
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -461,13 +461,13 @@ public abstract class XiaomiCoordinator extends AbstractBLEDeviceCoordinator {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean supportsNotificationVibrationPatterns() {
|
public boolean supportsNotificationVibrationPatterns() {
|
||||||
// TODO maybe can used this
|
// TODO maybe can use this
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean supportsNotificationVibrationRepetitionPatterns() {
|
public boolean supportsNotificationVibrationRepetitionPatterns() {
|
||||||
// TODO maybe can used this
|
// TODO maybe can use this
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -478,13 +478,13 @@ public abstract class XiaomiCoordinator extends AbstractBLEDeviceCoordinator {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AbstractNotificationPattern[] getNotificationVibrationPatterns() {
|
public AbstractNotificationPattern[] getNotificationVibrationPatterns() {
|
||||||
// TODO maybe can used this
|
// TODO maybe can use this
|
||||||
return new AbstractNotificationPattern[0];
|
return new AbstractNotificationPattern[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AbstractNotificationPattern[] getNotificationVibrationRepetitionPatterns() {
|
public AbstractNotificationPattern[] getNotificationVibrationRepetitionPatterns() {
|
||||||
// TODO maybe can used this
|
// TODO maybe can use this
|
||||||
return new AbstractNotificationPattern[0];
|
return new AbstractNotificationPattern[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -786,7 +786,7 @@ public class NotificationListener extends NotificationListenerService {
|
|||||||
notificationsActive.removeAll(notificationsToRemove);
|
notificationsActive.removeAll(notificationsToRemove);
|
||||||
|
|
||||||
// TODO prevent this from being called multiple times for the same ID
|
// 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
|
// Send notification remove request to device
|
||||||
List<GBDevice> devices = GBApplication.app().getDeviceManager().getDevices();
|
List<GBDevice> devices = GBApplication.app().getDeviceManager().getDevices();
|
||||||
|
@ -22,7 +22,6 @@
|
|||||||
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||||
package nodomain.freeyourgadget.gadgetbridge.service;
|
package nodomain.freeyourgadget.gadgetbridge.service;
|
||||||
|
|
||||||
import android.app.Service;
|
|
||||||
import android.bluetooth.BluetoothAdapter;
|
import android.bluetooth.BluetoothAdapter;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
@ -378,15 +378,9 @@ public abstract class XiaomiSupport extends AbstractBTLEDeviceSupport {
|
|||||||
healthService.enableRealtimeStats(enable);
|
healthService.enableRealtimeStats(enable);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onScreenshotReq() {
|
|
||||||
// TODO
|
|
||||||
super.onScreenshotReq();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEnableHeartRateSleepSupport(final boolean enable) {
|
public void onEnableHeartRateSleepSupport(final boolean enable) {
|
||||||
// TODO
|
// TODO onEnableHeartRateSleepSupport
|
||||||
super.onEnableHeartRateSleepSupport(enable);
|
super.onEnableHeartRateSleepSupport(enable);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,6 +44,7 @@ public class SleepDetailsParser extends XiaomiActivityParser {
|
|||||||
final int wakeupTime = buf.getInt();
|
final int wakeupTime = buf.getInt();
|
||||||
LOG.info("Bed time: {}, wake up time: {}", bedTime, wakeupTime);
|
LOG.info("Bed time: {}, wake up time: {}", bedTime, wakeupTime);
|
||||||
|
|
||||||
|
// TODO save timestamps and overlay on activity
|
||||||
// TODO everything else...
|
// TODO everything else...
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -21,7 +21,6 @@ import android.content.Context;
|
|||||||
import nodomain.freeyourgadget.gadgetbridge.GBApplication;
|
import nodomain.freeyourgadget.gadgetbridge.GBApplication;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.xiaomi.XiaomiCoordinator;
|
import nodomain.freeyourgadget.gadgetbridge.devices.xiaomi.XiaomiCoordinator;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.proto.xiaomi.XiaomiProto;
|
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.service.devices.xiaomi.XiaomiSupport;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.util.Prefs;
|
import nodomain.freeyourgadget.gadgetbridge.util.Prefs;
|
||||||
|
|
||||||
|
@ -29,7 +29,6 @@ import nodomain.freeyourgadget.gadgetbridge.GBApplication;
|
|||||||
import nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst;
|
import nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.model.CalendarEventSpec;
|
import nodomain.freeyourgadget.gadgetbridge.model.CalendarEventSpec;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.proto.xiaomi.XiaomiProto;
|
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.service.devices.xiaomi.XiaomiSupport;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.util.Prefs;
|
import nodomain.freeyourgadget.gadgetbridge.util.Prefs;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.util.StringUtils;
|
import nodomain.freeyourgadget.gadgetbridge.util.StringUtils;
|
||||||
|
@ -18,7 +18,6 @@ package nodomain.freeyourgadget.gadgetbridge.service.devices.xiaomi.services;
|
|||||||
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.location.Location;
|
import android.location.Location;
|
||||||
import android.os.Build;
|
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
|
|
||||||
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
|
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
|
||||||
|
@ -114,8 +114,6 @@ public class XiaomiNotificationService extends AbstractXiaomiService implements
|
|||||||
LOG.warn("Unhandled notification command {}", cmd.getSubtype());
|
LOG.warn("Unhandled notification command {}", cmd.getSubtype());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public void onNotification(final NotificationSpec notificationSpec) {
|
public void onNotification(final NotificationSpec notificationSpec) {
|
||||||
final XiaomiProto.Notification3.Builder notification3 = XiaomiProto.Notification3.newBuilder()
|
final XiaomiProto.Notification3.Builder notification3 = XiaomiProto.Notification3.newBuilder()
|
||||||
.setId(notificationSpec.getId())
|
.setId(notificationSpec.getId())
|
||||||
@ -179,7 +177,6 @@ public class XiaomiNotificationService extends AbstractXiaomiService implements
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void onSetCallState(final CallSpec callSpec) {
|
public void onSetCallState(final CallSpec callSpec) {
|
||||||
// TODO handle callSpec.command
|
|
||||||
if (callSpec.command == CallSpec.CALL_OUTGOING) {
|
if (callSpec.command == CallSpec.CALL_OUTGOING) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -89,7 +89,6 @@ public class XiaomiSystemService extends AbstractXiaomiService implements Xiaomi
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void handleCommand(final XiaomiProto.Command cmd) {
|
public void handleCommand(final XiaomiProto.Command cmd) {
|
||||||
// TODO
|
|
||||||
switch (cmd.getSubtype()) {
|
switch (cmd.getSubtype()) {
|
||||||
case CMD_DEVICE_INFO:
|
case CMD_DEVICE_INFO:
|
||||||
handleDeviceInfo(cmd.getSystem().getDeviceInfo());
|
handleDeviceInfo(cmd.getSystem().getDeviceInfo());
|
||||||
@ -476,10 +475,6 @@ public class XiaomiSystemService extends AbstractXiaomiService implements Xiaomi
|
|||||||
|
|
||||||
unsetDeviceBusy();
|
unsetDeviceBusy();
|
||||||
|
|
||||||
if (success) {
|
|
||||||
// TODO do we need to reboot?
|
|
||||||
}
|
|
||||||
|
|
||||||
fwHelper = null;
|
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>() {{
|
private static final Map<String, String> DISPLAY_ITEM_NAMES = new HashMap<String, String>() {{
|
||||||
put("today_act", "Stats");
|
put("today_act", "Stats");
|
||||||
put("sport", "Workout");
|
put("sport", "Workout");
|
||||||
|
@ -59,11 +59,9 @@ public class XiaomiWatchfaceService extends AbstractXiaomiService implements Xia
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void handleCommand(final XiaomiProto.Command cmd) {
|
public void handleCommand(final XiaomiProto.Command cmd) {
|
||||||
// TODO
|
|
||||||
switch (cmd.getSubtype()) {
|
switch (cmd.getSubtype()) {
|
||||||
case CMD_WATCHFACE_LIST:
|
case CMD_WATCHFACE_LIST:
|
||||||
handleWatchfaceList(cmd.getWatchface().getWatchfaceList());
|
handleWatchfaceList(cmd.getWatchface().getWatchfaceList());
|
||||||
// TODO handle
|
|
||||||
return;
|
return;
|
||||||
case CMD_WATCHFACE_SET:
|
case CMD_WATCHFACE_SET:
|
||||||
LOG.debug("Got watchface set response, ack={}", cmd.getWatchface().getAck());
|
LOG.debug("Got watchface set response, ack={}", cmd.getWatchface().getAck());
|
||||||
|
@ -206,6 +206,5 @@ public class XiaomiWeatherService extends AbstractXiaomiService {
|
|||||||
.format(new Date(timestamp * 1000L)))
|
.format(new Date(timestamp * 1000L)))
|
||||||
.insert(22, ':') // FIXME: I bet this fails for some, but all this java date craps sucks
|
.insert(22, ':') // FIXME: I bet this fails for some, but all this java date craps sucks
|
||||||
.toString();
|
.toString();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2394,7 +2394,6 @@
|
|||||||
<string name="temperature_scale_cf_summary">Select whether device uses Celsius or Fahrenheit scale.</string>
|
<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_celsius">Celsius</string>
|
||||||
<string name="temperature_scale_fahrenheit">Fahrenheit</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_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="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>
|
<string name="call_rejection_method_reject">Reject</string>
|
||||||
|
Loading…
Reference in New Issue
Block a user