CameraManager: Separate service listener into a singleton

Currently, every CameraManager instance adds itself as a camera service
listener, which has the unfortunate side effect of keeping them all alive
indefinitely.

This is doubly unfortunate since every CameraManager keeps the Context it
was constructed with, and therefore may be leaking whole Activities along
with the CameraManager itself.

Break out a global per-process CameraManager which handles service
connection keepalive and availability listeners, so that local camera
manager instances can go out of scope as expected.

Bug: 18077200

Change-Id: I1be5fb8d3492131e98bb4a84121400d4abb2b9e1
1 file changed