gooogle
gooogle

Reputation: 395

Why do android kills the client process which holds the cursor on content provider on another process in this case?

My app runs in Process1 and I'm using a content provider provided by another app which runs under Process2. When Process2 kills it's causing my app which runs under Process1 to be killed.

09-14 23:31:52.583   782  1351 I ActivityManager: Killing 11797:com.example.myapp/1000 (adj 100): depends on provider com.example.exampleapp/com.example.exampleapp.MyContentProvider in dying proc com.example.exampleapp (adj 100)
09-14 23:31:52.585   782   812 W libprocessgroup: kill(-11797, 9) failed: No such process
09-14 23:31:52.585   782   812 I libprocessgroup: Successfully killed process cgroup uid 1000 pid 11797 in 0ms
09-14 23:31:52.623   368   368 I Zygote  : Process 11797 exited due to signal (9)

I came across this good answer in SO which basically explains what would happen when we have content observer vs query on the content provider.

But I'm not clear why even android killing the entire process. Why this cant' be handled at application level with the help of DeadObjectException which we face similarly when interacting with a binder service running on other process and it goes down.

I agree that Android provides an alternative to handle this with the help of acquiring unstableContentProviderClient but I'm not convinced why do they need to kill the client process? I'm worried because not only the content provider query source will be running in the process - there can be other logic running in that process. Why the framework is killing the app and restarting it?

Upvotes: 5

Views: 3422

Answers (0)

Related Questions