|  | 
| 10 | 10 | import android.app.Activity; | 
| 11 | 11 | import android.content.Context; | 
| 12 | 12 | import android.content.Intent; | 
|  | 13 | +import android.content.pm.ActivityInfo; | 
| 13 | 14 | import android.content.res.Configuration; | 
|  | 15 | +import android.os.Build; | 
| 14 | 16 | import android.os.Bundle; | 
| 15 | 17 | import android.view.KeyEvent; | 
| 16 | 18 | import androidx.annotation.Nullable; | 
| @@ -102,6 +104,9 @@ public String getMainComponentName() { | 
| 102 | 104 |   public void onCreate(Bundle savedInstanceState) { | 
| 103 | 105 |     String mainComponentName = getMainComponentName(); | 
| 104 | 106 |     final Bundle launchOptions = composeLaunchOptions(); | 
|  | 107 | +    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && isWideColorGamutEnabled()) { | 
|  | 108 | +      mActivity.getWindow().setColorMode(ActivityInfo.COLOR_MODE_WIDE_COLOR_GAMUT); | 
|  | 109 | +    } | 
| 105 | 110 |     if (ReactFeatureFlags.enableBridgelessArchitecture) { | 
| 106 | 111 |       mReactDelegate = | 
| 107 | 112 |           new ReactDelegate(getPlainActivity(), getReactHost(), mainComponentName, launchOptions); | 
| @@ -217,4 +222,13 @@ protected Activity getPlainActivity() { | 
| 217 | 222 |   protected boolean isFabricEnabled() { | 
| 218 | 223 |     return ReactFeatureFlags.enableFabricRenderer; | 
| 219 | 224 |   } | 
|  | 225 | + | 
|  | 226 | +  /** | 
|  | 227 | +   * Override this method if you wish to selectively toggle wide color gamut for a specific surface. | 
|  | 228 | +   * | 
|  | 229 | +   * @return true if wide gamut is enabled for this Activity, false otherwise. | 
|  | 230 | +   */ | 
|  | 231 | +  protected boolean isWideColorGamutEnabled() { | 
|  | 232 | +    return false; | 
|  | 233 | +  } | 
| 220 | 234 | } | 
0 commit comments