OSDN Git Service

Delay hiding the cast icon for 3 seconds. DO NOT MERGE
authorDan Sandler <dsandler@android.com>
Tue, 20 Oct 2015 23:01:27 +0000 (16:01 -0700)
committerThe Android Automerger <android-build@google.com>
Tue, 27 Oct 2015 17:38:35 +0000 (10:38 -0700)
Ensure that the user has had a chance to see it for a few
seconds after screen recording has ended.

(cherry picked from commit 8fd25bf7711aabffe73213ba1f9056f285270695)

Bug: 19121797
Change-Id: I7a5c12b371b735c756ca5a3e8716c385fb3fbfe9

packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicy.java

index 5c254a2..025a0f9 100644 (file)
@@ -106,6 +106,14 @@ public class PhoneStatusBarPolicy {
         }
     };
 
+    private Runnable mRemoveCastIconRunnable = new Runnable() {
+        @Override
+        public void run() {
+            if (DEBUG) Log.v(TAG, "updateCast: hiding icon NOW");
+            mService.setIconVisibility(SLOT_CAST, false);
+        }
+    };
+
     public PhoneStatusBarPolicy(Context context, CastController cast, HotspotController hotspot) {
         mContext = context;
         mCast = cast;
@@ -304,11 +312,17 @@ public class PhoneStatusBarPolicy {
             }
         }
         if (DEBUG) Log.v(TAG, "updateCast: isCasting: " + isCasting);
+        mHandler.removeCallbacks(mRemoveCastIconRunnable);
         if (isCasting) {
             mService.setIcon(SLOT_CAST, R.drawable.stat_sys_cast, 0,
                     mContext.getString(R.string.accessibility_casting));
+            mService.setIconVisibility(SLOT_CAST, true);
+        } else {
+            // don't turn off the screen-record icon for a few seconds, just to make sure the user
+            // has seen it
+            if (DEBUG) Log.v(TAG, "updateCast: hiding icon in 3 sec...");
+            mHandler.postDelayed(mRemoveCastIconRunnable, 3000);
         }
-        mService.setIconVisibility(SLOT_CAST, isCasting);
     }
 
     private final HotspotController.Callback mHotspotCallback = new HotspotController.Callback() {