Added a 'deferred' parameter on executeRunnableDismissingKeyguard().

OnDismissAction() should return true only when the dismiss should be
deferred, but the annonymous class on
executeRunnableDismissingKeyguard() was always return true, which was
cause a janky timeout when the runnable didn't launch an activity.

BUG: 28303552

Change-Id: I1f9e299102d6cebba44794c026a69cf43ea06990
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java
index 83a15ad..8d74536 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java
@@ -490,7 +490,7 @@
             AsyncTask.execute(runnable);
         } else {
             mPhoneStatusBar.executeRunnableDismissingKeyguard(runnable, null /* cancelAction */,
-                    false /* dismissShade */, false /* afterKeyguardGone */);
+                    false /* dismissShade */, false /* afterKeyguardGone */, true /* deferred */);
         }
     }
 
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
index 8617104..7e2fa2d 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
@@ -1199,7 +1199,7 @@
         }
         if (mQsFullyExpanded && mFalsingManager.shouldEnforceBouncer()) {
             mStatusBar.executeRunnableDismissingKeyguard(null, null /* cancelAction */,
-                    false /* dismissShade */, true /* afterKeyguardGone */);
+                    false /* dismissShade */, true /* afterKeyguardGone */, false /* deferred */);
         }
         if (DEBUG) {
             invalidate();
@@ -1794,7 +1794,8 @@
                     public void run() {
                         mKeyguardBottomArea.launchLeftAffordance();
                     }
-                }, null, true /* dismissShade */, false /* afterKeyguardGone */);
+                }, null, true /* dismissShade */, false /* afterKeyguardGone */,
+                        true /* deferred */);
             }
             else {
                 mKeyguardBottomArea.launchLeftAffordance();
@@ -1813,7 +1814,8 @@
                     public void run() {
                         mKeyguardBottomArea.launchCamera(mLastCameraLaunchSource);
                     }
-                }, null, true /* dismissShade */, false /* afterKeyguardGone */);
+                }, null, true /* dismissShade */, false /* afterKeyguardGone */,
+                    true /* deferred */);
             }
             else {
                 mKeyguardBottomArea.launchCamera(mLastCameraLaunchSource);
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
index c36c482..436dc9d 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
@@ -3177,13 +3177,14 @@
             }
         };
         executeRunnableDismissingKeyguard(runnable, cancelRunnable, dismissShade,
-                afterKeyguardGone);
+                afterKeyguardGone, true /* deferred */);
     }
 
     public void executeRunnableDismissingKeyguard(final Runnable runnable,
             final Runnable cancelAction,
             final boolean dismissShade,
-            final boolean afterKeyguardGone) {
+            final boolean afterKeyguardGone,
+            final boolean deferred) {
         final boolean keyguardShowing = mStatusBarKeyguardViewManager.isShowing();
         dismissKeyguardThenExecute(new OnDismissAction() {
             @Override
@@ -3206,7 +3207,7 @@
                     animateCollapsePanels(CommandQueue.FLAG_EXCLUDE_RECENTS_PANEL, true /* force */,
                             true /* delayed*/);
                 }
-                return true;
+                return deferred;
             }
         }, cancelAction, afterKeyguardGone);
     }
@@ -3525,7 +3526,7 @@
             @Override
             public void run() {
                 mLeaveOpenOnKeyguardHide = true;
-                executeRunnableDismissingKeyguard(runnable, null, false, false);
+                executeRunnableDismissingKeyguard(runnable, null, false, false, false);
             }
         });
     }