PointerIcon: Treat 0 as a valid type index for system icons
PointerIcon.TYPE_ALIAS maps to the style type index of 0, which we
incorrectly treat as "invalid" in the code. This means we can never load
the TYPE_ALIAS system icon correctly.
Fix this by using an index of -1 to represent an invalid index.
Fixes: 339233006
Test: presubmit
Change-Id: I28cb4ce53dafa9de88959ba425889fec42d1e722
diff --git a/core/java/android/view/PointerIcon.java b/core/java/android/view/PointerIcon.java
index 7dc151d..71199e9 100644
--- a/core/java/android/view/PointerIcon.java
+++ b/core/java/android/view/PointerIcon.java
@@ -234,7 +234,7 @@
}
int typeIndex = getSystemIconTypeIndex(type);
- if (typeIndex == 0) {
+ if (typeIndex < 0) {
typeIndex = getSystemIconTypeIndex(TYPE_DEFAULT);
}
@@ -606,7 +606,7 @@
case TYPE_HANDWRITING:
return com.android.internal.R.styleable.Pointer_pointerIconHandwriting;
default:
- return 0;
+ return -1;
}
}