Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ae6cfc1b authored by Koji Fukui's avatar Koji Fukui Committed by android-build-merger
Browse files

Merge "Ignore toast request of pinning if request interval is too short" am: 1fcacf77

am: 19e2bcd2

Change-Id: Ic11d7a0daf867a6ad2a78ce4a150b0b2555f5706
parents 6b29b1c2 19e2bcd2
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -20,6 +20,8 @@ import android.app.ActivityManager;
import android.content.Context;
import android.os.Handler;
import android.os.Message;
import android.os.SystemClock;
import android.util.Slog;
import android.view.WindowManager;
import android.widget.Toast;

@@ -31,10 +33,12 @@ import com.android.internal.R;
 */
public class LockTaskNotify {
    private static final String TAG = "LockTaskNotify";
    private static final long SHOW_TOAST_MINIMUM_INTERVAL = 1000;

    private final Context mContext;
    private final H mHandler;
    private Toast mLastToast;
    private long mLastShowToastTime;

    public LockTaskNotify(Context context) {
        mContext = context;
@@ -55,10 +59,16 @@ public class LockTaskNotify {
        if (text == null) {
            return;
        }
        long showToastTime = SystemClock.elapsedRealtime();
        if ((showToastTime - mLastShowToastTime) < SHOW_TOAST_MINIMUM_INTERVAL) {
            Slog.i(TAG, "Ignore toast since it is requested in very short interval.");
            return;
        }
        if (mLastToast != null) {
            mLastToast.cancel();
        }
        mLastToast = makeAllUserToastAndShow(text);
        mLastShowToastTime = showToastTime;
    }

    public void show(boolean starting) {