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