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 <kari@tailscale.com>
pull/571/head
kari-ts 6 days ago committed by GitHub
parent ca2d161535
commit ed8a1b3573
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -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),
@ -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() {
@ -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?) {

Loading…
Cancel
Save