Skip to content

Commit ed8a1b3

Browse files
authored
android: initialize appInstance early (#561)
Also log if get() is still being accessed before onCreate initializes appInstance so we can understand if this is still happening. Also remove a debug log that I forgot to delete. Updates tailscale/tailscale#14125 Signed-off-by: kari-ts <[email protected]>
1 parent ca2d161 commit ed8a1b3

File tree

1 file changed

+2
-3
lines changed
  • android/src/main/java/com/tailscale/ipn

1 file changed

+2
-3
lines changed

android/src/main/java/com/tailscale/ipn/App.kt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,8 @@ class App : UninitializedApp(), libtailscale.AppContext, ViewModelStoreOwner {
9292

9393
override fun onCreate() {
9494
super.onCreate()
95+
appInstance = this
96+
setUnprotectedInstance(this)
9597
createNotificationChannel(
9698
STATUS_CHANNEL_ID,
9799
getString(R.string.vpn_status),
@@ -107,8 +109,6 @@ class App : UninitializedApp(), libtailscale.AppContext, ViewModelStoreOwner {
107109
getString(R.string.health_channel_name),
108110
getString(R.string.health_channel_description),
109111
NotificationManagerCompat.IMPORTANCE_HIGH)
110-
appInstance = this
111-
setUnprotectedInstance(this)
112112
}
113113

114114
override fun onTerminate() {
@@ -427,7 +427,6 @@ open class UninitializedApp : Application() {
427427

428428
fun restartVPN() {
429429
// Register a receiver to listen for the completion of stopVPN
430-
TSLog.d("KARI", "hi")
431430
val stopReceiver =
432431
object : BroadcastReceiver() {
433432
override fun onReceive(context: Context?, intent: Intent?) {

0 commit comments

Comments
 (0)