Skip to content

Commit 1eef1fd

Browse files
cortinicochrfalch
authored andcommitted
Make accessors inside HeadlessJsTaskService open again (#52660)
Summary: Pull Request resolved: #52660 The documentation for those methods mention that users should override them to provide their own implementation. However those vals are not `open` so users cannot really override them. This fixes it. See more context on #48800 (comment) So this was practically a breaking change, that I'm attempting to mitigate. Changelog: [Android] [Fixed] - Make accessors inside HeadlessJsTaskService open again Reviewed By: cipolleschi Differential Revision: D78479162 fbshipit-source-id: eefc7332e2004198cd6bd64b60a66215f137ad4a
1 parent 8f8a5be commit 1eef1fd

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

packages/react-native/ReactAndroid/api/ReactAndroid.api

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ public abstract class com/facebook/react/HeadlessJsTaskService : android/app/Ser
3131
public fun <init> ()V
3232
public static final fun acquireWakeLockNow (Landroid/content/Context;)V
3333
protected final fun getReactContext ()Lcom/facebook/react/bridge/ReactContext;
34-
protected final fun getReactHost ()Lcom/facebook/react/ReactHost;
35-
protected final fun getReactNativeHost ()Lcom/facebook/react/ReactNativeHost;
34+
protected fun getReactHost ()Lcom/facebook/react/ReactHost;
35+
protected fun getReactNativeHost ()Lcom/facebook/react/ReactNativeHost;
3636
protected fun getTaskConfig (Landroid/content/Intent;)Lcom/facebook/react/jstasks/HeadlessJsTaskConfig;
3737
public fun onBind (Landroid/content/Intent;)Landroid/os/IBinder;
3838
public fun onDestroy ()V

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/HeadlessJsTaskService.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,15 +112,16 @@ public abstract class HeadlessJsTaskService : Service(), HeadlessJsTaskEventList
112112
* simply have a different mechanism for storing a `ReactNativeHost`, e.g. as a static field
113113
* somewhere.
114114
*/
115-
protected val reactNativeHost: ReactNativeHost
115+
@Suppress("DEPRECATION")
116+
protected open val reactNativeHost: ReactNativeHost
116117
get() = (application as ReactApplication).reactNativeHost
117118

118119
/**
119120
* Get the [ReactHost] used by this app. By default, assumes [.getApplication] is an instance of
120121
* [ReactApplication] and calls [ReactApplication.reactHost]. This method assumes it is called in
121122
* new architecture and returns null if not.
122123
*/
123-
protected val reactHost: ReactHost?
124+
protected open val reactHost: ReactHost?
124125
get() = (application as ReactApplication).reactHost
125126

126127
protected val reactContext: ReactContext?

0 commit comments

Comments
 (0)