@Nullable
    Integer getExpectedNavbarColor(Context context, String providerPackage,
            TrustedWebActivityIntentBuilder builder) {
        Intent intent = builder.buildCustomTabsIntent().intent;
        if (providerSupportsNavBarColorCustomization(context, providerPackage)) {
            if (providerSupportsColorSchemeParams(context, providerPackage)) {
                int colorScheme = getExpectedColorScheme(context, builder);
                CustomTabColorSchemeParams params = CustomTabsIntent.getColorSchemeParams(intent,
                        colorScheme);
                return params.navigationBarColor;
            }
            Bundle extras = intent.getExtras();
            return extras == null ? null :
                    (Integer) extras.get(CustomTabsIntent.EXTRA_NAVIGATION_BAR_COLOR);
        }
        if (TrustedWebUtils.SUPPORTED_CHROME_PACKAGES.contains(providerPackage)) {
            // Prior to adding support for nav bar color customization, Chrome had always set
            // the white color.
            return Color.WHITE;
        }
        return null;
    }
Makes a best-effort guess about which navigation bar color will be used when the Trusted Web
Activity is launched. Returns null if not possible to predict.
customtabs/src/android/support/customtabs/trusted/splashscreens/SystemBarColorPredictor.java