for debug builds, check for upgrades hourly

This commit is contained in:
Eric House 2020-08-13 09:15:25 -07:00
parent adc8c8d961
commit 5d305f7df7
10 changed files with 20 additions and 16 deletions

View file

@ -89,6 +89,7 @@ android {
buildConfigField "String", "KEY_FCMID", "\"FBMService_fcmid\"" buildConfigField "String", "KEY_FCMID", "\"FBMService_fcmid\""
buildConfigField "boolean", "ATTACH_SUPPORTED", "false" buildConfigField "boolean", "ATTACH_SUPPORTED", "false"
buildConfigField "boolean", "OFFER_MQTT", "true" buildConfigField "boolean", "OFFER_MQTT", "true"
buildConfigField "boolean", "NON_RELEASE", "DEBUG || !IS_TAGGED_BUILD"
} }
xw4NoSMS { xw4NoSMS {

View file

@ -45,7 +45,7 @@ public class Assert {
// NR: non-release // NR: non-release
public static void assertTrueNR( boolean val ) public static void assertTrueNR( boolean val )
{ {
if ( BuildConfig.DEBUG || !BuildConfig.IS_TAGGED_BUILD ) { if ( BuildConfig.NON_RELEASE ) {
assertTrue( val ); assertTrue( val );
} }
} }

View file

@ -334,7 +334,7 @@ public class GameListItem extends LinearLayout
// temporarily after every game closes because an *already-open* // temporarily after every game closes because an *already-open*
// game always tests as not safe-to-open. // game always tests as not safe-to-open.
boolean doShow = false; boolean doShow = false;
boolean quarantined = (BuildConfig.DEBUG || !BuildConfig.IS_TAGGED_BUILD) boolean quarantined = BuildConfig.NON_RELEASE
&& !Quarantine.safeToOpen( m_rowid ); && !Quarantine.safeToOpen( m_rowid );
ImageView iv = (ImageView)findViewById( R.id.has_chat_marker ); ImageView iv = (ImageView)findViewById( R.id.has_chat_marker );
if ( quarantined ) { if ( quarantined ) {

View file

@ -52,8 +52,7 @@ import androidx.annotation.NonNull;
public class GameLock implements AutoCloseable { public class GameLock implements AutoCloseable {
private static final String TAG = GameLock.class.getSimpleName(); private static final String TAG = GameLock.class.getSimpleName();
private static final boolean GET_OWNER_STACK = private static final boolean GET_OWNER_STACK = BuildConfig.NON_RELEASE;
BuildConfig.DEBUG || !BuildConfig.IS_TAGGED_BUILD;
private static final boolean DEBUG_LOCKS = false; private static final boolean DEBUG_LOCKS = false;
// private static final long ASSERT_TIME = 2000; // private static final long ASSERT_TIME = 2000;

View file

@ -108,7 +108,7 @@ public class GameUtils {
String msg = "savedGame(): unable to get lock; holder dump: " String msg = "savedGame(): unable to get lock; holder dump: "
+ GameLock.getHolderDump( rowid ); + GameLock.getHolderDump( rowid );
Log.d( TAG, msg ); Log.d( TAG, msg );
if ( BuildConfig.DEBUG || !BuildConfig.IS_TAGGED_BUILD ) { if ( BuildConfig.NON_RELEASE ) {
Utils.emailAuthor( context, msg ); Utils.emailAuthor( context, msg );
} }
throw new NoSuchGameException( rowid ); throw new NoSuchGameException( rowid );

View file

@ -65,7 +65,7 @@ public class InviteChoicesAlert extends DlgDelegateAlert {
if ( Utils.deviceSupportsNBS(context) ) { if ( Utils.deviceSupportsNBS(context) ) {
add( items, means, R.string.invite_choice_data_sms, InviteMeans.SMS_DATA ); add( items, means, R.string.invite_choice_data_sms, InviteMeans.SMS_DATA );
} }
if ( BuildConfig.DEBUG || !BuildConfig.IS_TAGGED_BUILD ) { if ( BuildConfig.NON_RELEASE ) {
add( items, means, R.string.invite_choice_relay, InviteMeans.RELAY ); add( items, means, R.string.invite_choice_relay, InviteMeans.RELAY );
} }
if ( BuildConfig.OFFER_MQTT ) { if ( BuildConfig.OFFER_MQTT ) {

View file

@ -40,8 +40,7 @@ public class Log {
private static final String TAG = Log.class.getSimpleName(); private static final String TAG = Log.class.getSimpleName();
private static final String PRE_TAG = BuildConfig.FLAVOR + "-"; private static final String PRE_TAG = BuildConfig.FLAVOR + "-";
private static final String KEY_USE_DB = TAG + "/useDB"; private static final String KEY_USE_DB = TAG + "/useDB";
private static final boolean LOGGING_ENABLED private static final boolean LOGGING_ENABLED = BuildConfig.NON_RELEASE;
= BuildConfig.DEBUG || !BuildConfig.IS_TAGGED_BUILD;
private static final boolean ERROR_LOGGING_ENABLED = true; private static final boolean ERROR_LOGGING_ENABLED = true;
private static final String LOGS_FILE_NAME = BuildConfig.FLAVOR + "_logsDB.txt"; private static final String LOGS_FILE_NAME = BuildConfig.FLAVOR + "_logsDB.txt";
private static final String LOGS_DB_NAME = "xwlogs_db"; private static final String LOGS_DB_NAME = "xwlogs_db";

View file

@ -30,8 +30,7 @@ import org.eehouse.android.xw4.jni.XwJNI;
public class MQTTInviteDelegate extends DevIDInviteDelegate { public class MQTTInviteDelegate extends DevIDInviteDelegate {
private static final String TAG = MQTTInviteDelegate.class.getSimpleName(); private static final String TAG = MQTTInviteDelegate.class.getSimpleName();
private static final String RECS_KEY = TAG + "/recs"; private static final String RECS_KEY = TAG + "/recs";
private static final boolean MQTTINVITE_SUPPORTED private static final boolean MQTTINVITE_SUPPORTED = BuildConfig.NON_RELEASE;
= BuildConfig.DEBUG || !BuildConfig.IS_TAGGED_BUILD;
private String m_devIDStr; private String m_devIDStr;

View file

@ -29,8 +29,7 @@ import org.eehouse.android.xw4.DBUtils.SentInvitesInfo;
public class RelayInviteDelegate extends DevIDInviteDelegate { public class RelayInviteDelegate extends DevIDInviteDelegate {
private static final String TAG = RelayInviteDelegate.class.getSimpleName(); private static final String TAG = RelayInviteDelegate.class.getSimpleName();
private static final String RECS_KEY = TAG + "/recs"; private static final String RECS_KEY = TAG + "/recs";
private static final boolean RELAYINVITE_SUPPORTED private static final boolean RELAYINVITE_SUPPORTED = BuildConfig.NON_RELEASE;
= BuildConfig.DEBUG || !BuildConfig.IS_TAGGED_BUILD;
private boolean m_immobileConfirmed; private boolean m_immobileConfirmed;
private String mRelayDevIDStr; private String mRelayDevIDStr;

View file

@ -46,8 +46,9 @@ public class UpdateCheckReceiver extends BroadcastReceiver {
public static final String NEW_DICT_NAME = "NEW_DICT_NAME"; public static final String NEW_DICT_NAME = "NEW_DICT_NAME";
public static final String NEW_XLATION_CBK = "NEW_XLATION_CBK"; public static final String NEW_XLATION_CBK = "NEW_XLATION_CBK";
private static final long INTERVAL_ONEHOUR = 1000 * 60 * 60;
// weekly // weekly
private static final long INTERVAL_ONEDAY = 1000 * 60 * 60 * 24; private static final long INTERVAL_ONEDAY = INTERVAL_ONEHOUR * 24;
private static final long INTERVAL_NDAYS = 7; private static final long INTERVAL_NDAYS = 7;
// constants that are also used in info.py // constants that are also used in info.py
@ -93,10 +94,16 @@ public class UpdateCheckReceiver extends BroadcastReceiver {
PendingIntent pi = PendingIntent.getBroadcast( context, 0, intent, 0 ); PendingIntent pi = PendingIntent.getBroadcast( context, 0, intent, 0 );
am.cancel( pi ); am.cancel( pi );
long interval_millis = INTERVAL_ONEDAY; long interval_millis;
if ( !devOK( context ) ) { if ( BuildConfig.NON_RELEASE ) {
interval_millis *= INTERVAL_NDAYS; interval_millis = INTERVAL_ONEHOUR;
} else {
interval_millis = INTERVAL_ONEDAY;
if ( !devOK( context ) ) {
interval_millis *= INTERVAL_NDAYS;
}
} }
interval_millis = (interval_millis / 2) interval_millis = (interval_millis / 2)
+ Math.abs(Utils.nextRandomInt() % interval_millis); + Math.abs(Utils.nextRandomInt() % interval_millis);
am.setInexactRepeating( AlarmManager.ELAPSED_REALTIME_WAKEUP, am.setInexactRepeating( AlarmManager.ELAPSED_REALTIME_WAKEUP,