use constant for flag that must change with sdk version

This commit is contained in:
Eric House 2022-11-11 12:16:39 -08:00
parent 93902d6336
commit 98dd2148ce
6 changed files with 8 additions and 5 deletions

View file

@ -153,6 +153,7 @@ android {
dimension "variant" dimension "variant"
targetSdkVersion 30 targetSdkVersion 30
compileSdkVersion 30 compileSdkVersion 30
buildConfigField "int", "FLAG_IMMUTABLE", "0"
applicationId "org.eehouse.android.xw4" applicationId "org.eehouse.android.xw4"
manifestPlaceholders = [ APP_ID: applicationId ] manifestPlaceholders = [ APP_ID: applicationId ]
resValue "string", "app_name", "CrossWords" resValue "string", "app_name", "CrossWords"
@ -171,6 +172,7 @@ android {
dimension "variant" dimension "variant"
targetSdkVersion 30 targetSdkVersion 30
compileSdkVersion 30 compileSdkVersion 30
buildConfigField "int", "FLAG_IMMUTABLE", "0"
buildConfigField "String", "DB_NAME", "\"xwddb\"" buildConfigField "String", "DB_NAME", "\"xwddb\""
applicationId "org.eehouse.android.xw4dbg" applicationId "org.eehouse.android.xw4dbg"
resValue "string", "app_name", "CrossDbg" resValue "string", "app_name", "CrossDbg"
@ -211,6 +213,7 @@ android {
dimension "variant" dimension "variant"
targetSdkVersion 30 targetSdkVersion 30
compileSdkVersion 30 compileSdkVersion 30
buildConfigField "int", "FLAG_IMMUTABLE", "0"
applicationId "org.eehouse.android.xw4" applicationId "org.eehouse.android.xw4"
manifestPlaceholders = [ APP_ID: applicationId ] manifestPlaceholders = [ APP_ID: applicationId ]
resValue "string", "app_name", "CrossWords" resValue "string", "app_name", "CrossWords"

View file

@ -173,7 +173,7 @@ public class DupeModeTimer extends BroadcastReceiver {
sCurTimer = whenSeconds; sCurTimer = whenSeconds;
Intent intent = new Intent( context, DupeModeTimer.class ); Intent intent = new Intent( context, DupeModeTimer.class );
PendingIntent pi = PendingIntent.getBroadcast( context, 0, intent, PendingIntent pi = PendingIntent.getBroadcast( context, 0, intent,
PendingIntent.FLAG_IMMUTABLE ); BuildConfig.FLAG_IMMUTABLE );
long now = Utils.getCurSeconds(); long now = Utils.getCurSeconds();
long fire_millis = SystemClock.elapsedRealtime() long fire_millis = SystemClock.elapsedRealtime()

View file

@ -380,7 +380,7 @@ public class NBSProto {
{ {
Intent intent = new Intent( msg ); Intent intent = new Intent( msg );
return PendingIntent.getBroadcast( context, 0, intent, return PendingIntent.getBroadcast( context, 0, intent,
PendingIntent.FLAG_IMMUTABLE ); BuildConfig.FLAG_IMMUTABLE );
} }
private void cacheForRetry( QueueElem elem ) private void cacheForRetry( QueueElem elem )

View file

@ -391,7 +391,7 @@ public class TimerReceiver extends BroadcastReceiver {
intent.putExtra( KEY_TIMER_ID, timerID ); intent.putExtra( KEY_TIMER_ID, timerID );
PendingIntent pi = PendingIntent PendingIntent pi = PendingIntent
.getBroadcast( context, 0, intent, PendingIntent.FLAG_CANCEL_CURRENT .getBroadcast( context, 0, intent, PendingIntent.FLAG_CANCEL_CURRENT
| PendingIntent.FLAG_IMMUTABLE ); | BuildConfig.FLAG_IMMUTABLE );
am.set( AlarmManager.RTC_WAKEUP, firstFireTime, pi ); am.set( AlarmManager.RTC_WAKEUP, firstFireTime, pi );
setJobTimerIf( context, delayMS, timerID ); setJobTimerIf( context, delayMS, timerID );

View file

@ -98,7 +98,7 @@ public class UpdateCheckReceiver extends BroadcastReceiver {
Intent intent = new Intent( context, UpdateCheckReceiver.class ); Intent intent = new Intent( context, UpdateCheckReceiver.class );
PendingIntent pi = PendingIntent.getBroadcast( context, 0, intent, PendingIntent pi = PendingIntent.getBroadcast( context, 0, intent,
PendingIntent.FLAG_IMMUTABLE ); BuildConfig.FLAG_IMMUTABLE );
am.cancel( pi ); am.cancel( pi );
long interval_millis; long interval_millis;

View file

@ -379,7 +379,7 @@ public class Utils {
{ {
PendingIntent pi = PendingIntent PendingIntent pi = PendingIntent
.getActivity( context, Utils.nextRandomInt(), intent, .getActivity( context, Utils.nextRandomInt(), intent,
PendingIntent.FLAG_ONE_SHOT | PendingIntent.FLAG_IMMUTABLE ); PendingIntent.FLAG_ONE_SHOT | BuildConfig.FLAG_IMMUTABLE );
return pi; return pi;
} }