FileDocCategorySizeDatePackage
ShellUiAutomatorBridge.javaAPI DocAndroid 5.1 API4361Thu Mar 12 22:22:08 GMT 2015com.android.uiautomator.core

ShellUiAutomatorBridge

public class ShellUiAutomatorBridge extends UiAutomatorBridge
hide

Fields Summary
private static final String
LOG_TAG
Constructors Summary
public ShellUiAutomatorBridge(android.app.UiAutomation uiAutomation)


       
        super(uiAutomation);
    
Methods Summary
public android.view.DisplaygetDefaultDisplay()

        return DisplayManagerGlobal.getInstance().getRealDisplay(Display.DEFAULT_DISPLAY);
    
public intgetRotation()

        IWindowManager wm =
                IWindowManager.Stub.asInterface(ServiceManager.getService(Context.WINDOW_SERVICE));
        int ret = -1;
        try {
            ret = wm.getRotation();
        } catch (RemoteException e) {
            Log.e(LOG_TAG, "Error getting screen rotation", e);
            throw new RuntimeException(e);
        }
        return ret;
    
public longgetSystemLongPressTime()

        // Read the long press timeout setting.
        long longPressTimeout = 0;
        try {
            IContentProvider provider = null;
            Cursor cursor = null;
            IActivityManager activityManager = ActivityManagerNative.getDefault();
            String providerName = Settings.Secure.CONTENT_URI.getAuthority();
            IBinder token = new Binder();
            try {
                ContentProviderHolder holder = activityManager.getContentProviderExternal(
                        providerName, UserHandle.USER_OWNER, token);
                if (holder == null) {
                    throw new IllegalStateException("Could not find provider: " + providerName);
                }
                provider = holder.provider;
                cursor = provider.query(null, Settings.Secure.CONTENT_URI,
                        new String[] {
                            Settings.Secure.VALUE
                        }, "name=?",
                        new String[] {
                            Settings.Secure.LONG_PRESS_TIMEOUT
                        }, null, null);
                if (cursor.moveToFirst()) {
                    longPressTimeout = cursor.getInt(0);
                }
            } finally {
                if (cursor != null) {
                    cursor.close();
                }
                if (provider != null) {
                    activityManager.removeContentProviderExternal(providerName, token);
                }
            }
        } catch (RemoteException e) {
            String message = "Error reading long press timeout setting.";
            Log.e(LOG_TAG, message, e);
            throw new RuntimeException(message, e);
        }
        return longPressTimeout;
    
public booleanisScreenOn()

        IPowerManager pm =
                IPowerManager.Stub.asInterface(ServiceManager.getService(Context.POWER_SERVICE));
        boolean ret = false;
        try {
            ret = pm.isInteractive();
        } catch (RemoteException e) {
            Log.e(LOG_TAG, "Error getting screen status", e);
            throw new RuntimeException(e);
        }
        return ret;