Introduce accessibility large pointer icons.
This patch does the following things:
- add new graphic assets of large icons for accessibility needs
(imported from ChromeOS data)
- add the logic to choose the set of normal icons or accessibility icons
- make InputManagerService to observe the settings change, so that
it can reload the new resources
This patch misses non-1x graphic though, because ChromeOS doesn't
have such data.
Bug: 25778857
Change-Id: Ia5f95d47f50b3f6eea555c3af8069bc6bae0b400
diff --git a/libs/input/PointerController.cpp b/libs/input/PointerController.cpp
index bd6af78..6a1167a 100644
--- a/libs/input/PointerController.cpp
+++ b/libs/input/PointerController.cpp
@@ -91,7 +91,14 @@
mLocked.buttonState = 0;
+ mPolicy->loadPointerIcon(&mLocked.pointerIcon);
+
loadResources();
+
+ if (mLocked.pointerIcon.isValid()) {
+ mLocked.pointerIconChanged = true;
+ updatePointerLocked();
+ }
}
PointerController::~PointerController() {
@@ -325,6 +332,23 @@
}
}
+void PointerController::reloadPointerResources() {
+ AutoMutex _l(mLock);
+
+ loadResources();
+
+ if (mLocked.presentation == PRESENTATION_POINTER) {
+ mLocked.additionalMouseResources.clear();
+ mLocked.animationResources.clear();
+ mPolicy->loadPointerIcon(&mLocked.pointerIcon);
+ mPolicy->loadAdditionalMouseResources(&mLocked.additionalMouseResources,
+ &mLocked.animationResources);
+ }
+
+ mLocked.presentationChanged = true;
+ updatePointerLocked();
+}
+
void PointerController::setDisplayViewport(int32_t width, int32_t height, int32_t orientation) {
AutoMutex _l(mLock);
@@ -415,15 +439,6 @@
}
}
-void PointerController::setPointerIcon(const SpriteIcon& icon) {
- AutoMutex _l(mLock);
-
- mLocked.pointerIcon = icon.copy();
- mLocked.pointerIconChanged = true;
-
- updatePointerLocked();
-}
-
void PointerController::handleMessage(const Message& message) {
switch (message.what) {
case MSG_INACTIVITY_TIMEOUT:
diff --git a/libs/input/PointerController.h b/libs/input/PointerController.h
index b6c01d2..4fd2d85 100644
--- a/libs/input/PointerController.h
+++ b/libs/input/PointerController.h
@@ -62,6 +62,7 @@
virtual ~PointerControllerPolicyInterface() { }
public:
+ virtual void loadPointerIcon(SpriteIcon* icon) = 0;
virtual void loadPointerResources(PointerResources* outResources) = 0;
virtual void loadAdditionalMouseResources(std::map<int32_t, SpriteIcon>* outResources,
std::map<int32_t, PointerAnimation>* outAnimationResources) = 0;
@@ -105,8 +106,8 @@
void updatePointerShape(int32_t iconId);
void setDisplayViewport(int32_t width, int32_t height, int32_t orientation);
- void setPointerIcon(const SpriteIcon& icon);
void setInactivityTimeout(InactivityTimeout inactivityTimeout);
+ void reloadPointerResources();
private:
static const size_t MAX_RECYCLED_SPRITES = 12;