|
7 | 7 |
|
8 | 8 | package com.facebook.react; |
9 | 9 |
|
10 | | -import static com.facebook.react.bridge.ReactMarkerConstants.CREATE_UI_MANAGER_MODULE_END; |
11 | | -import static com.facebook.react.bridge.ReactMarkerConstants.CREATE_UI_MANAGER_MODULE_START; |
12 | | -import static com.facebook.react.bridge.ReactMarkerConstants.PROCESS_CORE_REACT_PACKAGE_END; |
13 | | -import static com.facebook.react.bridge.ReactMarkerConstants.PROCESS_CORE_REACT_PACKAGE_START; |
14 | | - |
15 | 10 | import androidx.annotation.Nullable; |
| 11 | + |
16 | 12 | import com.facebook.react.bridge.NativeModule; |
17 | 13 | import com.facebook.react.bridge.ReactApplicationContext; |
18 | 14 | import com.facebook.react.bridge.ReactMarker; |
19 | 15 | import com.facebook.react.devsupport.LogBoxModule; |
20 | | -import com.facebook.react.module.annotations.ReactModule; |
21 | 16 | import com.facebook.react.module.annotations.ReactModuleList; |
22 | | -import com.facebook.react.module.model.ReactModuleInfo; |
23 | 17 | import com.facebook.react.module.model.ReactModuleInfoProvider; |
24 | 18 | import com.facebook.react.modules.bundleloader.NativeDevSplitBundleLoaderModule; |
25 | 19 | import com.facebook.react.modules.core.DefaultHardwareBackBtnHandler; |
|
31 | 25 | import com.facebook.react.modules.debug.SourceCodeModule; |
32 | 26 | import com.facebook.react.modules.deviceinfo.DeviceInfoModule; |
33 | 27 | import com.facebook.react.modules.systeminfo.AndroidInfoModule; |
34 | | -import com.facebook.react.turbomodule.core.interfaces.TurboModule; |
35 | 28 | import com.facebook.react.uimanager.UIImplementationProvider; |
36 | 29 | import com.facebook.react.uimanager.UIManagerModule; |
37 | 30 | import com.facebook.react.uimanager.ViewManager; |
38 | 31 | import com.facebook.react.uimanager.ViewManagerResolver; |
39 | 32 | import com.facebook.systrace.Systrace; |
40 | | -import java.util.HashMap; |
| 33 | + |
41 | 34 | import java.util.List; |
42 | | -import java.util.Map; |
| 35 | + |
| 36 | +import static com.facebook.react.bridge.ReactMarkerConstants.CREATE_UI_MANAGER_MODULE_END; |
| 37 | +import static com.facebook.react.bridge.ReactMarkerConstants.CREATE_UI_MANAGER_MODULE_START; |
| 38 | +import static com.facebook.react.bridge.ReactMarkerConstants.PROCESS_CORE_REACT_PACKAGE_END; |
| 39 | +import static com.facebook.react.bridge.ReactMarkerConstants.PROCESS_CORE_REACT_PACKAGE_START; |
43 | 40 |
|
44 | 41 | /** |
45 | 42 | * This is the basic module to support React Native. The debug modules are now in DebugCorePackage. |
46 | 43 | */ |
47 | 44 | @ReactModuleList( |
48 | | - // WARNING: If you modify this list, ensure that the list below in method |
49 | | - // getReactModuleInfoByInitialization is also updated |
50 | 45 | nativeModules = { |
51 | 46 | AndroidInfoModule.class, |
52 | 47 | DeviceEventManagerModule.class, |
@@ -79,64 +74,9 @@ public CoreModulesPackage( |
79 | 74 | mMinTimeLeftInFrameForNonBatchedOperationMs = minTimeLeftInFrameForNonBatchedOperationMs; |
80 | 75 | } |
81 | 76 |
|
82 | | - /** |
83 | | - * This method is overridden, since OSS does not run the annotation processor to generate {@link |
84 | | - * CoreModulesPackage$$ReactModuleInfoProvider} class. Here we check if it exists. If it does not |
85 | | - * exist, we generate one manually in {@link |
86 | | - * CoreModulesPackage#getReactModuleInfoByInitialization()} and return that instead. |
87 | | - */ |
88 | 77 | @Override |
89 | 78 | public ReactModuleInfoProvider getReactModuleInfoProvider() { |
90 | | - try { |
91 | | - Class<?> reactModuleInfoProviderClass = |
92 | | - Class.forName("com.facebook.react.CoreModulesPackage$$ReactModuleInfoProvider"); |
93 | | - return (ReactModuleInfoProvider) reactModuleInfoProviderClass.newInstance(); |
94 | | - } catch (ClassNotFoundException e) { |
95 | | - // In OSS case, the annotation processor does not run. We fall back on creating this byhand |
96 | | - Class<? extends NativeModule>[] moduleList = |
97 | | - new Class[] { |
98 | | - AndroidInfoModule.class, |
99 | | - DeviceEventManagerModule.class, |
100 | | - DeviceInfoModule.class, |
101 | | - DevSettingsModule.class, |
102 | | - ExceptionsManagerModule.class, |
103 | | - LogBoxModule.class, |
104 | | - HeadlessJsTaskSupportModule.class, |
105 | | - SourceCodeModule.class, |
106 | | - TimingModule.class, |
107 | | - UIManagerModule.class, |
108 | | - NativeDevSplitBundleLoaderModule.class, |
109 | | - }; |
110 | | - |
111 | | - final Map<String, ReactModuleInfo> reactModuleInfoMap = new HashMap<>(); |
112 | | - for (Class<? extends NativeModule> moduleClass : moduleList) { |
113 | | - ReactModule reactModule = moduleClass.getAnnotation(ReactModule.class); |
114 | | - |
115 | | - reactModuleInfoMap.put( |
116 | | - reactModule.name(), |
117 | | - new ReactModuleInfo( |
118 | | - reactModule.name(), |
119 | | - moduleClass.getName(), |
120 | | - reactModule.canOverrideExistingModule(), |
121 | | - reactModule.needsEagerInit(), |
122 | | - reactModule.hasConstants(), |
123 | | - reactModule.isCxxModule(), |
124 | | - TurboModule.class.isAssignableFrom(moduleClass))); |
125 | | - } |
126 | | - |
127 | | - return new ReactModuleInfoProvider() { |
128 | | - @Override |
129 | | - public Map<String, ReactModuleInfo> getReactModuleInfos() { |
130 | | - return reactModuleInfoMap; |
131 | | - } |
132 | | - }; |
133 | | - } catch (InstantiationException e) { |
134 | | - throw new RuntimeException( |
135 | | - "No ReactModuleInfoProvider for CoreModulesPackage$$ReactModuleInfoProvider", e); |
136 | | - } catch (IllegalAccessException e) { |
137 | | - throw new RuntimeException( |
138 | | - "No ReactModuleInfoProvider for CoreModulesPackage$$ReactModuleInfoProvider", e); |
139 | | - } |
| 79 | + return new CoreModulesPackage$$ReactModuleInfoProvider(); |
140 | 80 | } |
141 | 81 |
|
142 | 82 | @Override |
|
0 commit comments