Create static inner class for UiModeManager

UiModeManager instances register a callback to the service on creation.

This is problematic since the callback will store the instance of the
class under the hood and prevent it from being garbage collected.

Instead, use a static inner class containing only what is required for
the callbacks.

Also move the mService object, which is a IBinder.stub.asInterface(..),
inside the static inner class.

This follows the same pattern as in WallpaperManager.

Fixes: 289811808
Test: atest UiModeManagerTest
Change-Id: I60a348483cde684891b7468eb45f28422b0e4a5d
1 file changed