@@ -271,7 +271,7 @@ function cleanWww (projectRoot, locations) {
271271 */
272272function updateProjectAccordingTo ( platformConfig , locations ) {
273273 updateProjectStrings ( platformConfig , locations ) ;
274- updateProjectSplashScreen ( platformConfig , locations ) ;
274+ updateProjectTheme ( platformConfig , locations ) ;
275275
276276 const name = platformConfig . name ( ) ;
277277
@@ -376,11 +376,31 @@ function warnForDeprecatedSplashScreen (cordovaProject) {
376376 * be used to update project
377377 * @param {Object } locations A map of locations for this platform
378378 */
379- function updateProjectSplashScreen ( platformConfig , locations ) {
379+ function updateProjectTheme ( platformConfig , locations ) {
380380 // res/values/themes.xml
381381 const themes = xmlHelpers . parseElementtreeSync ( locations . themes ) ;
382382 const splashScreenTheme = themes . find ( 'style[@name="Theme.App.SplashScreen"]' ) ;
383383
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+
384404 let splashBg = platformConfig . getPreference ( 'AndroidWindowSplashScreenBackground' , this . platform ) ;
385405 if ( ! splashBg ) {
386406 splashBg = platformConfig . getPreference ( 'SplashScreenBackgroundColor' , this . platform ) ;
@@ -397,6 +417,7 @@ function updateProjectSplashScreen (platformConfig, locations) {
397417 splashBgNode . text = '@color/cdv_splashscreen_background' ;
398418
399419 [
420+ // Splash Screen
400421 'windowSplashScreenAnimatedIcon' ,
401422 'windowSplashScreenAnimationDuration' ,
402423 'android:windowSplashScreenBrandingImage' ,
0 commit comments