mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-09-01 03:55:47 +02:00
Xiaomi: Dump fetched files to storage
This commit is contained in:
parent
29f57758fa
commit
d6d956b748
@ -477,7 +477,7 @@ public class XiaomiSupport extends AbstractDeviceSupport {
|
||||
LOG.info("Parsing all activity files from storage");
|
||||
|
||||
try {
|
||||
final File externalFilesDir = FileUtils.getExternalFilesDir();
|
||||
final File externalFilesDir = getCoordinator().getWritableExportDirectory(getDevice());
|
||||
final File targetDir = new File(externalFilesDir, "rawFetchOperations");
|
||||
|
||||
if (!targetDir.exists()) {
|
||||
|
@ -32,6 +32,7 @@ import java.util.Queue;
|
||||
|
||||
import nodomain.freeyourgadget.gadgetbridge.BuildConfig;
|
||||
import nodomain.freeyourgadget.gadgetbridge.R;
|
||||
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
||||
import nodomain.freeyourgadget.gadgetbridge.service.btle.BLETypeConversions;
|
||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.xiaomi.XiaomiPreferences;
|
||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.xiaomi.XiaomiSupport;
|
||||
@ -96,10 +97,7 @@ public class XiaomiActivityFileFetcher {
|
||||
final byte[] fileIdBytes = Arrays.copyOfRange(data, 0, 7);
|
||||
final XiaomiActivityFileId fileId = XiaomiActivityFileId.from(fileIdBytes);
|
||||
|
||||
if (BuildConfig.DEBUG) {
|
||||
// FIXME comment this out
|
||||
dumpBytesToExternalStorage(fileId, data);
|
||||
}
|
||||
dumpBytesToExternalStorage(fileId, data);
|
||||
|
||||
if (!XiaomiPreferences.keepActivityDataOnDevice(mHealthService.getSupport().getDevice())) {
|
||||
LOG.debug("Acking recorded data {}", fileId);
|
||||
@ -162,8 +160,9 @@ public class XiaomiActivityFileFetcher {
|
||||
|
||||
protected void dumpBytesToExternalStorage(final XiaomiActivityFileId fileId, final byte[] bytes) {
|
||||
try {
|
||||
final File externalFilesDir = FileUtils.getExternalFilesDir();
|
||||
final File targetDir = new File(externalFilesDir, "rawFetchOperations");
|
||||
final GBDevice device = mHealthService.getSupport().getDevice();
|
||||
final File exportDirectory = device.getDeviceCoordinator().getWritableExportDirectory(device);
|
||||
final File targetDir = new File(exportDirectory, "rawFetchOperations");
|
||||
targetDir.mkdirs();
|
||||
|
||||
final File outputFile = new File(targetDir, fileId.getFilename());
|
||||
|
Loading…
Reference in New Issue
Block a user