@@ -271,7 +271,7 @@ function cleanWww (projectRoot, locations) {
271
271
*/
272
272
function updateProjectAccordingTo ( platformConfig , locations ) {
273
273
updateProjectStrings ( platformConfig , locations ) ;
274
- updateProjectSplashScreen ( platformConfig , locations ) ;
274
+ updateProjectTheme ( platformConfig , locations ) ;
275
275
276
276
const name = platformConfig . name ( ) ;
277
277
@@ -376,11 +376,31 @@ function warnForDeprecatedSplashScreen (cordovaProject) {
376
376
* be used to update project
377
377
* @param {Object } locations A map of locations for this platform
378
378
*/
379
- function updateProjectSplashScreen ( platformConfig , locations ) {
379
+ function updateProjectTheme ( platformConfig , locations ) {
380
380
// res/values/themes.xml
381
381
const themes = xmlHelpers . parseElementtreeSync ( locations . themes ) ;
382
382
const splashScreenTheme = themes . find ( 'style[@name="Theme.App.SplashScreen"]' ) ;
383
383
384
+ // Update edge-to-edge settings in app theme.
385
+ let hasE2E = false ; // default case
386
+
387
+ const preferenceE2E = platformConfig . getPreference ( 'AndroidEdgeToEdge' , this . platform ) ;
388
+ if ( ! preferenceE2E ) {
389
+ events . emit ( 'verbose' , 'The preference name "AndroidEdgeToEdge" was not set. Defaulting to "false".' ) ;
390
+ } else {
391
+ const hasInvalidPreferenceE2E = preferenceE2E !== 'true' && preferenceE2E !== 'false' ;
392
+ if ( hasInvalidPreferenceE2E ) {
393
+ events . emit ( 'verbose' , 'Preference name "AndroidEdgeToEdge" has an invalid value. Valid values are "true" or "false". Defaulting to "false"' ) ;
394
+ }
395
+ hasE2E = hasInvalidPreferenceE2E ? false : preferenceE2E === 'true' ;
396
+ }
397
+
398
+ const optOutE2EKey = 'android:windowOptOutEdgeToEdgeEnforcement' ;
399
+ const optOutE2EItem = splashScreenTheme . find ( `item[@name="${ optOutE2EKey } "]` ) ;
400
+ const optOutE2EValue = ! hasE2E ? 'true' : 'false' ;
401
+ optOutE2EItem . text = optOutE2EValue ;
402
+ events . emit ( 'verbose' , `Updating theme item "${ optOutE2EKey } " with value "${ optOutE2EValue } "` ) ;
403
+
384
404
let splashBg = platformConfig . getPreference ( 'AndroidWindowSplashScreenBackground' , this . platform ) ;
385
405
if ( ! splashBg ) {
386
406
splashBg = platformConfig . getPreference ( 'SplashScreenBackgroundColor' , this . platform ) ;
@@ -397,6 +417,7 @@ function updateProjectSplashScreen (platformConfig, locations) {
397
417
splashBgNode . text = '@color/cdv_splashscreen_background' ;
398
418
399
419
[
420
+ // Splash Screen
400
421
'windowSplashScreenAnimatedIcon' ,
401
422
'windowSplashScreenAnimationDuration' ,
402
423
'android:windowSplashScreenBrandingImage' ,
0 commit comments