Fabric-log enabled plugins once a day.
This commit is contained in:
parent
8f647460b8
commit
ccaf68d043
3 changed files with 36 additions and 4 deletions
|
@ -1,9 +1,5 @@
|
||||||
package info.nightscout.androidaps.receivers;
|
package info.nightscout.androidaps.receivers;
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by mike on 07.07.2016.
|
|
||||||
*/
|
|
||||||
|
|
||||||
import android.app.AlarmManager;
|
import android.app.AlarmManager;
|
||||||
import android.app.PendingIntent;
|
import android.app.PendingIntent;
|
||||||
import android.content.BroadcastReceiver;
|
import android.content.BroadcastReceiver;
|
||||||
|
@ -11,6 +7,7 @@ import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.PowerManager;
|
import android.os.PowerManager;
|
||||||
|
|
||||||
|
import info.nightscout.utils.FabricPrivacy;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
@ -25,6 +22,10 @@ import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
|
||||||
import info.nightscout.androidaps.queue.commands.Command;
|
import info.nightscout.androidaps.queue.commands.Command;
|
||||||
import info.nightscout.utils.LocalAlertUtils;
|
import info.nightscout.utils.LocalAlertUtils;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by mike on 07.07.2016.
|
||||||
|
*/
|
||||||
public class KeepAliveReceiver extends BroadcastReceiver {
|
public class KeepAliveReceiver extends BroadcastReceiver {
|
||||||
private static Logger log = LoggerFactory.getLogger(KeepAliveReceiver.class);
|
private static Logger log = LoggerFactory.getLogger(KeepAliveReceiver.class);
|
||||||
public static final long STATUS_UPDATE_FREQUENCY = 15 * 60 * 1000L;
|
public static final long STATUS_UPDATE_FREQUENCY = 15 * 60 * 1000L;
|
||||||
|
@ -45,6 +46,7 @@ public class KeepAliveReceiver extends BroadcastReceiver {
|
||||||
LocalAlertUtils.shortenSnoozeInterval();
|
LocalAlertUtils.shortenSnoozeInterval();
|
||||||
LocalAlertUtils.checkStaleBGAlert();
|
LocalAlertUtils.checkStaleBGAlert();
|
||||||
checkPump();
|
checkPump();
|
||||||
|
FabricPrivacy.reportPluginStats();
|
||||||
|
|
||||||
log.debug("KeepAlive received");
|
log.debug("KeepAlive received");
|
||||||
wl.release();
|
wl.release();
|
||||||
|
|
|
@ -3,6 +3,12 @@ package info.nightscout.utils;
|
||||||
import com.crashlytics.android.Crashlytics;
|
import com.crashlytics.android.Crashlytics;
|
||||||
import com.crashlytics.android.answers.Answers;
|
import com.crashlytics.android.answers.Answers;
|
||||||
import com.crashlytics.android.answers.CustomEvent;
|
import com.crashlytics.android.answers.CustomEvent;
|
||||||
|
import info.nightscout.androidaps.BuildConfig;
|
||||||
|
import info.nightscout.androidaps.MainApp;
|
||||||
|
import info.nightscout.androidaps.R;
|
||||||
|
import info.nightscout.androidaps.interfaces.PluginBase;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by jamorham on 21/02/2018.
|
* Created by jamorham on 21/02/2018.
|
||||||
|
@ -80,4 +86,27 @@ public class FabricPrivacy {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void reportPluginStats() {
|
||||||
|
if (!FabricPrivacy.fabricEnabled()) return;
|
||||||
|
|
||||||
|
long lastUploadDay = SP.getLong(MainApp.gs(R.string.key_plugin_stats_report_timestamp), 0L);
|
||||||
|
|
||||||
|
Date date = new Date();
|
||||||
|
date.setHours(0);
|
||||||
|
date.setMinutes(0);
|
||||||
|
date.setSeconds(0);
|
||||||
|
long today = date.getTime() - date.getTime() % 1000;
|
||||||
|
|
||||||
|
if (today > lastUploadDay) {
|
||||||
|
CustomEvent pluginStats = new CustomEvent("PluginStats");
|
||||||
|
pluginStats.putCustomAttribute("version", BuildConfig.VERSION);
|
||||||
|
for (PluginBase plugin : MainApp.getPluginsList()) {
|
||||||
|
if (plugin.isEnabled(plugin.getType()) && !plugin.pluginDescription.alwaysEnabled) {
|
||||||
|
pluginStats.putCustomAttribute(plugin.getName(), "enabled");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
FabricPrivacy.getInstance().logCustom(pluginStats);
|
||||||
|
SP.putLong(MainApp.gs(R.string.key_plugin_stats_report_timestamp), today);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1164,6 +1164,7 @@
|
||||||
<string name="storedsettingsfound">Stored settings found</string>
|
<string name="storedsettingsfound">Stored settings found</string>
|
||||||
<string name="allow_hardware_pump_text">Attention: If you activate and connect to a hardware pump, AndroidAPS will copy the basal settings from the profile to the pump, overwriting the existing basal rate stored on the pump. Make sure you have the correct basal setting in AndroidAPS. If you are not sure or don\'t want to overwrite the basal settings on your pump, press cancel and repeat switching to the pump at a later time.</string>
|
<string name="allow_hardware_pump_text">Attention: If you activate and connect to a hardware pump, AndroidAPS will copy the basal settings from the profile to the pump, overwriting the existing basal rate stored on the pump. Make sure you have the correct basal setting in AndroidAPS. If you are not sure or don\'t want to overwrite the basal settings on your pump, press cancel and repeat switching to the pump at a later time.</string>
|
||||||
<string name="generated_ecarbs_note">Generated eCarbs with amount: %1$dg, duration: %2$dh, delay: %3$dm</string>
|
<string name="generated_ecarbs_note">Generated eCarbs with amount: %1$dg, duration: %2$dh, delay: %3$dm</string>
|
||||||
|
<string name="key_plugin_stats_report_timestamp" translatable="false">key_plugin_stats_report_timestamp</string>
|
||||||
|
|
||||||
<plurals name="objective_days">
|
<plurals name="objective_days">
|
||||||
<item quantity="one">%d day</item>
|
<item quantity="one">%d day</item>
|
||||||
|
|
Loading…
Reference in a new issue