home-assistant / home-assistant/android

Leak: HighAccuracyLocationService

Open
#5,546 1 comment 0 reactions 0 assignees View on GitHub
bug location-tracking
Dominant language
Kotlin
Stars
3.9k
Forks
1.1k
Avg merge
1d 12h
Merged PRs (30d)
81

Description

**Home Assistant Android app version(s):**

was testing #5527 but could also be on prod version?

**Android version(s):**

16

**Device model(s):**

Pixel 9 pro xl

**Home Assistant version:**

n/a

**Last working Home Assistant release (if known):**

n/a

**Description of problem, include YAML if issue is related to notifications:**

was testing high accuracy mode notification and the app caught the leak

**Companion App Logs:**

```
┬───
│ GC Root: Thread object

├─ android.net.ConnectivityThread instance
│    Leaking: NO (PathClassLoader↓ is not leaking)
│    Thread name: 'ConnectivityThread'
│    ↓ Thread.contextClassLoader
├─ dalvik.system.PathClassLoader instance
│    Leaking: NO (HighAccuracyLocationService↓ is not leaking and A ClassLoader
│    is never leaking)
│    ↓ ClassLoader.runtimeInternalObjects
├─ java.lang.Object[] array
│    Leaking: NO (HighAccuracyLocationService↓ is not leaking)
│    ↓ Object[4071]
├─ io.homeassistant.companion.android.location.HighAccuracyLocationService class
│    Leaking: NO (a class is never leaking)
│    ↓ static HighAccuracyLocationService.notificationBuilder
│                                         ~~~~~~~~~~~~~~~~~~~
├─ androidx.core.app.NotificationCompat$Builder instance
│    Leaking: UNKNOWN
│    Retaining 826 B in 16 objects
│    mContext instance of io.homeassistant.companion.android.location.
│    HighAccuracyLocationService
│    ↓ NotificationCompat$Builder.mContext
│                                 ~~~~~~~~
╰→ io.homeassistant.companion.android.location.HighAccuracyLocationService
  instance
     Leaking: YES (ObjectWatcher was watching this because io.homeassistant.
     companion.android.location.HighAccuracyLocationService received
     Service#onDestroy() callback and Service not held by ActivityThread)
     Retaining 2.3 kB in 27 objects
     key = e2f572c2-8c2a-43e6-adbc-cb5022925b39
     watchDurationMillis = 7818
     retainedDurationMillis = 2817
     mApplication instance of [io.homeassistant.companion.android](http://io.homeassistant.companion.android/).
     HomeAssistantApplication
     mBase instance of android.app.ContextImpl

METADATA

Build.VERSION.SDK_INT: 36
Build.MANUFACTURER: Google
LeakCanary version: 2.14
App process name: io.homeassistant.companion.android.debug
Class count: 44964
Instance count: 324018
Primitive array count: 213108
Object array count: 44459
Thread count: 72
Heap total bytes: 42502949
Bitmap count: 3
Bitmap total bytes: 557831
Large bitmap count: 0
Large bitmap total bytes: 0
Db 1: open /data/user/0/[io.homeassistant.companion.android](http://io.homeassistant.companion.android/).
debug/no_backup/androidx.work.workdb
Db 2: open /data/user/0/[io.homeassistant.companion.android](http://io.homeassistant.companion.android/).
debug/databases/HomeAssistantDB
Stats: LruCache[maxSize=3000,hits=131391,misses=278140,hitRate=32%]
RandomAccess[bytes=13803530,reads=278140,travel=140339404350,range=50450732,size
=63657390]
Analysis duration: 12433 ms
```

**Screenshot or video of problem:**

**Additional information:**
let me know if yhou need the dump file, leaving file name here for my own recollection: 2025-07-15_09-46-00_686.hprof

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.