Stop clock icon from jankily changing on user tap. am: c37ae1c56c am: df20a016cd

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/libs/systemui/+/17913773

Change-Id: I8eceff1e40154907c7957645efd73b886610ba65
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/iconloaderlib/src/com/android/launcher3/icons/ClockDrawableWrapper.java b/iconloaderlib/src/com/android/launcher3/icons/ClockDrawableWrapper.java
index ef1bc3e..60a7ecd 100644
--- a/iconloaderlib/src/com/android/launcher3/icons/ClockDrawableWrapper.java
+++ b/iconloaderlib/src/com/android/launcher3/icons/ClockDrawableWrapper.java
@@ -423,6 +423,18 @@
         }
 
         @Override
+        public boolean setState(int[] stateSet) {
+            // If the user has just pressed the clock icon, and the clock app is launching,
+            // we don't want to change the time shown. Doing so can result in jank.
+            for (int state: stateSet) {
+                if (state == android.R.attr.state_pressed) {
+                    return false;
+                }
+            }
+            return super.setState(stateSet);
+        }
+
+        @Override
         public boolean isThemed() {
             return mBgPaint.getColorFilter() != null;
         }