Skip to content

Commit

Permalink
android: initialize appInstance early (#561)
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
kari-ts authored Nov 21, 2024
1 parent ca2d161 commit ed8a1b3
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions android/src/main/java/com/tailscale/ipn/App.kt
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ class App : UninitializedApp(), libtailscale.AppContext, ViewModelStoreOwner {

override fun onCreate() {
super.onCreate()
appInstance = this
setUnprotectedInstance(this)
createNotificationChannel(
STATUS_CHANNEL_ID,
getString(R.string.vpn_status),
Expand All @@ -107,8 +109,6 @@ class App : UninitializedApp(), libtailscale.AppContext, ViewModelStoreOwner {
getString(R.string.health_channel_name),
getString(R.string.health_channel_description),
NotificationManagerCompat.IMPORTANCE_HIGH)
appInstance = this
setUnprotectedInstance(this)
}

override fun onTerminate() {
Expand Down Expand Up @@ -427,7 +427,6 @@ open class UninitializedApp : Application() {

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

0 comments on commit ed8a1b3

Please sign in to comment.