Load correct resources for pointer icon on external screen

When mouse pointer changes displays, it should also reload the
icon from new resources. Otherwise, if the densities of the
previous and new displays are different, the size of the pointer
sprite will look too small or too large.

- Add getDisplayContext to get the corresponding Context by displayId.
- Cache system pointer icons per display, clear if display removed.
- Fix icon moved to default when not resetting out of task bound.

Bug: 113559891
Test: Enable mouse pointer on default display, move to other screen
Change-Id: Ic42d0ec32d9c979281e13c83b9e8b57134fd4f0d
diff --git a/libs/input/PointerController.cpp b/libs/input/PointerController.cpp
index b4f19c9..d742cc3 100644
--- a/libs/input/PointerController.cpp
+++ b/libs/input/PointerController.cpp
@@ -255,7 +255,7 @@
 
     if (presentation == PRESENTATION_POINTER && mLocked.additionalMouseResources.empty()) {
         mPolicy->loadAdditionalMouseResources(&mLocked.additionalMouseResources,
-                                              &mLocked.animationResources);
+                &mLocked.animationResources, mLocked.viewport.displayId);
     }
 
     if (mLocked.presentation != presentation) {
@@ -727,14 +727,14 @@
 }
 
 void PointerController::loadResourcesLocked() REQUIRES(mLock) {
-    mPolicy->loadPointerResources(&mResources);
+    mPolicy->loadPointerResources(&mResources, mLocked.viewport.displayId);
 
     if (mLocked.presentation == PRESENTATION_POINTER) {
         mLocked.additionalMouseResources.clear();
         mLocked.animationResources.clear();
-        mPolicy->loadPointerIcon(&mLocked.pointerIcon);
+        mPolicy->loadPointerIcon(&mLocked.pointerIcon, mLocked.viewport.displayId);
         mPolicy->loadAdditionalMouseResources(&mLocked.additionalMouseResources,
-                                              &mLocked.animationResources);
+                &mLocked.animationResources, mLocked.viewport.displayId);
     }
 
     mLocked.pointerIconChanged = true;