118b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu/*
218b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu * Copyright (C) 2013 The Android Open Source Project
318b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu *
418b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu * Licensed under the Apache License, Version 2.0 (the "License");
518b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu * you may not use this file except in compliance with the License.
618b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu * You may obtain a copy of the License at
718b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu *
818b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu *      http://www.apache.org/licenses/LICENSE-2.0
918b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu *
1018b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu * Unless required by applicable law or agreed to in writing, software
1118b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu * distributed under the License is distributed on an "AS IS" BASIS,
1218b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1318b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu * See the License for the specific language governing permissions and
1418b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu * limitations under the License.
1518b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu */
1618b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhupackage com.android.uiautomator.core;
1718b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu
1818b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu/**
1918b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu * Allows you to set key parameters for running uiautomator tests. The new
2018b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu * settings take effect immediately and can be changed any time during a test run.
2118b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu *
2218b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu * To modify parameters using Configurator, first obtain an instance by calling
2318b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu * {@link #getInstance()}. As a best practice, make sure you always save
2418b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu * the original value of any parameter that you are modifying. After running your
2518b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu * tests with the modified parameters, make sure to also restore
2618b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu * the original parameter values, otherwise this will impact other tests cases.
2718b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu * @since API Level 18
283fb03313e9d0e41f7c14b648c0f4dcfdab78bff3Allen Hair * @deprecated New tests should be written using UI Automator 2.0 which is available as part of the
293fb03313e9d0e41f7c14b648c0f4dcfdab78bff3Allen Hair * Android Testing Support Library.
3018b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu */
313fb03313e9d0e41f7c14b648c0f4dcfdab78bff3Allen Hair@Deprecated
3218b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhupublic final class Configurator {
3318b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu    private long mWaitForIdleTimeout = 10 * 1000;
3418b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu    private long mWaitForSelector = 10 * 1000;
3518b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu    private long mWaitForActionAcknowledgment = 3 * 1000;
3618b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu
3718b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu    // The events for a scroll typically complete even before touchUp occurs.
3818b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu    // This short timeout to make sure we get the very last in cases where the above isn't true.
3918b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu    private long mScrollEventWaitTimeout = 200; // ms
4018b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu
4118b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu    // Default is inject as fast as we can
4218b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu    private long mKeyInjectionDelay = 0; // ms
4318b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu
4418b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu    // reference to self
4518b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu    private static Configurator sConfigurator;
4618b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu
4718b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu    private Configurator() {
4818b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu        /* hide constructor */
4918b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu    }
5018b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu
5118b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu    /**
5218b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu     * Retrieves a singleton instance of Configurator.
5318b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu     *
5418b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu     * @return Configurator instance
5518b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu     * @since API Level 18
5618b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu     */
5718b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu    public static Configurator getInstance() {
5818b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu        if (sConfigurator == null) {
5918b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu            sConfigurator = new Configurator();
6018b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu        }
6118b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu        return sConfigurator;
6218b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu    }
6318b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu
6418b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu    /**
6518b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu     * Sets the timeout for waiting for the user interface to go into an idle
6618b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu     * state before starting a uiautomator action.
6718b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu     *
6818b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu     * By default, all core uiautomator objects except {@link UiDevice} will perform
6918b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu     * this wait before starting to search for the widget specified by the
7018b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu     * object's {@link UiSelector}. Once the idle state is detected or the
7118b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu     * timeout elapses (whichever occurs first), the object will start to wait
7218b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu     * for the selector to find a match.
7318b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu     * See {@link #setWaitForSelectorTimeout(long)}
7418b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu     *
7518b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu     * @param timeout Timeout value in milliseconds
7618b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu     * @return self
7718b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu     * @since API Level 18
7818b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu     */
7918b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu    public Configurator setWaitForIdleTimeout(long timeout) {
8018b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu        mWaitForIdleTimeout = timeout;
8118b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu        return this;
8218b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu    }
8318b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu
8418b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu    /**
8518b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu     * Gets the current timeout used for waiting for the user interface to go
8618b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu     * into an idle state.
8718b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu     *
8818b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu     * By default, all core uiautomator objects except {@link UiDevice} will perform
8918b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu     * this wait before starting to search for the widget specified by the
9018b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu     * object's {@link UiSelector}. Once the idle state is detected or the
9118b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu     * timeout elapses (whichever occurs first), the object will start to wait
9218b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu     * for the selector to find a match.
9318b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu     * See {@link #setWaitForSelectorTimeout(long)}
9418b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu     *
9518b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu     * @return Current timeout value in milliseconds
9618b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu     * @since API Level 18
9718b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu     */
9818b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu    public long getWaitForIdleTimeout() {
9918b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu        return mWaitForIdleTimeout;
10018b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu    }
10118b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu
10218b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu    /**
10318b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu     * Sets the timeout for waiting for a widget to become visible in the user
10418b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu     * interface so that it can be matched by a selector.
10518b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu     *
10618b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu     * Because user interface content is dynamic, sometimes a widget may not
10718b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu     * be visible immediately and won't be detected by a selector. This timeout
10818b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu     * allows the uiautomator framework to wait for a match to be found, up until
10918b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu     * the timeout elapses.
11018b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu     *
11118b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu     * @param timeout Timeout value in milliseconds.
11218b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu     * @return self
11318b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu     * @since API Level 18
11418b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu     */
11518b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu    public Configurator setWaitForSelectorTimeout(long timeout) {
11618b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu        mWaitForSelector = timeout;
11718b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu        return this;
11818b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu    }
11918b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu
12018b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu    /**
12118b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu     * Gets the current timeout for waiting for a widget to become visible in
12218b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu     * the user interface so that it can be matched by a selector.
12318b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu     *
12418b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu     * Because user interface content is dynamic, sometimes a widget may not
12518b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu     * be visible immediately and won't be detected by a selector. This timeout
12618b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu     * allows the uiautomator framework to wait for a match to be found, up until
12718b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu     * the timeout elapses.
12818b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu     *
12918b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu     * @return Current timeout value in milliseconds
13018b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu     * @since API Level 18
13118b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu     */
13218b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu    public long getWaitForSelectorTimeout() {
13318b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu        return mWaitForSelector;
13418b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu    }
13518b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu
13618b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu    /**
13718b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu     * Sets the timeout for waiting for an acknowledgement of an
13818b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu     * uiautomtor scroll swipe action.
13918b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu     *
14018b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu     * The acknowledgment is an <a href="http://developer.android.com/reference/android/view/accessibility/AccessibilityEvent.html">AccessibilityEvent</a>,
14118b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu     * corresponding to the scroll action, that lets the framework determine if
14218b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu     * the scroll action was successful. Generally, this timeout should not be modified.
14318b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu     * See {@link UiScrollable}
14418b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu     *
14518b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu     * @param timeout Timeout value in milliseconds
14618b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu     * @return self
14718b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu     * @since API Level 18
14818b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu     */
14918b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu    public Configurator setScrollAcknowledgmentTimeout(long timeout) {
15018b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu        mScrollEventWaitTimeout = timeout;
15118b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu        return this;
15218b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu    }
15318b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu
15418b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu    /**
15518b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu     * Gets the timeout for waiting for an acknowledgement of an
15618b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu     * uiautomtor scroll swipe action.
15718b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu     *
15818b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu     * The acknowledgment is an <a href="http://developer.android.com/reference/android/view/accessibility/AccessibilityEvent.html">AccessibilityEvent</a>,
15918b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu     * corresponding to the scroll action, that lets the framework determine if
16018b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu     * the scroll action was successful. Generally, this timeout should not be modified.
16118b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu     * See {@link UiScrollable}
16218b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu     *
16318b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu     * @return current timeout in milliseconds
16418b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu     * @since API Level 18
16518b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu     */
16618b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu    public long getScrollAcknowledgmentTimeout() {
16718b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu        return mScrollEventWaitTimeout;
16818b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu    }
16918b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu
17018b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu    /**
17118b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu     * Sets the timeout for waiting for an acknowledgment of generic uiautomator
17218b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu     * actions, such as clicks, text setting, and menu presses.
17318b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu     *
17418b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu     * The acknowledgment is an <a href="http://developer.android.com/reference/android/view/accessibility/AccessibilityEvent.html">AccessibilityEvent</a>,
17518b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu     * corresponding to an action, that lets the framework determine if the
17618b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu     * action was successful. Generally, this timeout should not be modified.
17718b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu     * See {@link UiObject}
17818b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu     *
17918b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu     * @param timeout Timeout value in milliseconds
18018b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu     * @return self
18118b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu     * @since API Level 18
18218b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu     */
18318b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu    public Configurator setActionAcknowledgmentTimeout(long timeout) {
18418b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu        mWaitForActionAcknowledgment = timeout;
18518b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu        return this;
18618b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu    }
18718b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu
18818b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu    /**
18918b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu     * Gets the current timeout for waiting for an acknowledgment of generic
19018b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu     * uiautomator actions, such as clicks, text setting, and menu presses.
19118b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu     *
19218b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu     * The acknowledgment is an <a href="http://developer.android.com/reference/android/view/accessibility/AccessibilityEvent.html">AccessibilityEvent</a>,
19318b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu     * corresponding to an action, that lets the framework determine if the
19418b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu     * action was successful. Generally, this timeout should not be modified.
19518b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu     * See {@link UiObject}
19618b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu     *
19718b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu     * @return current timeout in milliseconds
19818b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu     * @since API Level 18
19918b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu     */
20018b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu    public long getActionAcknowledgmentTimeout() {
20118b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu        return mWaitForActionAcknowledgment;
20218b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu    }
20318b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu
20418b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu    /**
20518b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu     * Sets a delay between key presses when injecting text input.
20618b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu     * See {@link UiObject#setText(String)}
20718b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu     *
20818b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu     * @param delay Delay value in milliseconds
20918b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu     * @return self
21018b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu     * @since API Level 18
21118b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu     */
21218b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu    public Configurator setKeyInjectionDelay(long delay) {
21318b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu        mKeyInjectionDelay = delay;
21418b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu        return this;
21518b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu    }
21618b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu
21718b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu    /**
21818b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu     * Gets the current delay between key presses when injecting text input.
21918b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu     * See {@link UiObject#setText(String)}
22018b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu     *
22118b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu     * @return current delay in milliseconds
22218b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu     * @since API Level 18
22318b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu     */
22418b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu    public long getKeyInjectionDelay() {
22518b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu        return mKeyInjectionDelay;
22618b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu    }
22718b892c723e812a7e111f102d2b0c0782b116bb6Guang Zhu}
228