Search in sources :

Example 1 with OnAccessibilityEventListener

use of android.app.UiAutomation.OnAccessibilityEventListener in project platform_frameworks_base by android.

the class EventsCommand method run.

@Override
public void run(String[] args) {
    UiAutomationShellWrapper automationWrapper = new UiAutomationShellWrapper();
    automationWrapper.connect();
    automationWrapper.getUiAutomation().setOnAccessibilityEventListener(new OnAccessibilityEventListener() {

        @Override
        public void onAccessibilityEvent(AccessibilityEvent event) {
            SimpleDateFormat formatter = new SimpleDateFormat("MM-dd HH:mm:ss.SSS");
            System.out.println(String.format("%s %s", formatter.format(new Date()), event.toString()));
        }
    });
    // for user to press Ctrl+C
    synchronized (mQuitLock) {
        try {
            mQuitLock.wait();
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
    automationWrapper.disconnect();
}
Also used : OnAccessibilityEventListener(android.app.UiAutomation.OnAccessibilityEventListener) AccessibilityEvent(android.view.accessibility.AccessibilityEvent) SimpleDateFormat(java.text.SimpleDateFormat) Date(java.util.Date) UiAutomationShellWrapper(com.android.uiautomator.core.UiAutomationShellWrapper)

Example 2 with OnAccessibilityEventListener

use of android.app.UiAutomation.OnAccessibilityEventListener in project android_frameworks_base by AOSPA.

the class EventsCommand method run.

@Override
public void run(String[] args) {
    UiAutomationShellWrapper automationWrapper = new UiAutomationShellWrapper();
    automationWrapper.connect();
    automationWrapper.getUiAutomation().setOnAccessibilityEventListener(new OnAccessibilityEventListener() {

        @Override
        public void onAccessibilityEvent(AccessibilityEvent event) {
            SimpleDateFormat formatter = new SimpleDateFormat("MM-dd HH:mm:ss.SSS");
            System.out.println(String.format("%s %s", formatter.format(new Date()), event.toString()));
        }
    });
    // for user to press Ctrl+C
    synchronized (mQuitLock) {
        try {
            mQuitLock.wait();
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
    automationWrapper.disconnect();
}
Also used : OnAccessibilityEventListener(android.app.UiAutomation.OnAccessibilityEventListener) AccessibilityEvent(android.view.accessibility.AccessibilityEvent) SimpleDateFormat(java.text.SimpleDateFormat) Date(java.util.Date) UiAutomationShellWrapper(com.android.uiautomator.core.UiAutomationShellWrapper)

Example 3 with OnAccessibilityEventListener

use of android.app.UiAutomation.OnAccessibilityEventListener in project android_frameworks_base by DirtyUnicorns.

the class EventsCommand method run.

@Override
public void run(String[] args) {
    UiAutomationShellWrapper automationWrapper = new UiAutomationShellWrapper();
    automationWrapper.connect();
    automationWrapper.getUiAutomation().setOnAccessibilityEventListener(new OnAccessibilityEventListener() {

        @Override
        public void onAccessibilityEvent(AccessibilityEvent event) {
            SimpleDateFormat formatter = new SimpleDateFormat("MM-dd HH:mm:ss.SSS");
            System.out.println(String.format("%s %s", formatter.format(new Date()), event.toString()));
        }
    });
    // for user to press Ctrl+C
    synchronized (mQuitLock) {
        try {
            mQuitLock.wait();
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
    automationWrapper.disconnect();
}
Also used : OnAccessibilityEventListener(android.app.UiAutomation.OnAccessibilityEventListener) AccessibilityEvent(android.view.accessibility.AccessibilityEvent) SimpleDateFormat(java.text.SimpleDateFormat) Date(java.util.Date) UiAutomationShellWrapper(com.android.uiautomator.core.UiAutomationShellWrapper)

Example 4 with OnAccessibilityEventListener

use of android.app.UiAutomation.OnAccessibilityEventListener in project android_frameworks_base by ResurrectionRemix.

the class EventsCommand method run.

@Override
public void run(String[] args) {
    UiAutomationShellWrapper automationWrapper = new UiAutomationShellWrapper();
    automationWrapper.connect();
    automationWrapper.getUiAutomation().setOnAccessibilityEventListener(new OnAccessibilityEventListener() {

        @Override
        public void onAccessibilityEvent(AccessibilityEvent event) {
            SimpleDateFormat formatter = new SimpleDateFormat("MM-dd HH:mm:ss.SSS");
            System.out.println(String.format("%s %s", formatter.format(new Date()), event.toString()));
        }
    });
    // for user to press Ctrl+C
    synchronized (mQuitLock) {
        try {
            mQuitLock.wait();
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
    automationWrapper.disconnect();
}
Also used : OnAccessibilityEventListener(android.app.UiAutomation.OnAccessibilityEventListener) AccessibilityEvent(android.view.accessibility.AccessibilityEvent) SimpleDateFormat(java.text.SimpleDateFormat) Date(java.util.Date) UiAutomationShellWrapper(com.android.uiautomator.core.UiAutomationShellWrapper)

Example 5 with OnAccessibilityEventListener

use of android.app.UiAutomation.OnAccessibilityEventListener in project android_frameworks_base by crdroidandroid.

the class EventsCommand method run.

@Override
public void run(String[] args) {
    UiAutomationShellWrapper automationWrapper = new UiAutomationShellWrapper();
    automationWrapper.connect();
    automationWrapper.getUiAutomation().setOnAccessibilityEventListener(new OnAccessibilityEventListener() {

        @Override
        public void onAccessibilityEvent(AccessibilityEvent event) {
            SimpleDateFormat formatter = new SimpleDateFormat("MM-dd HH:mm:ss.SSS");
            System.out.println(String.format("%s %s", formatter.format(new Date()), event.toString()));
        }
    });
    // for user to press Ctrl+C
    synchronized (mQuitLock) {
        try {
            mQuitLock.wait();
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
    automationWrapper.disconnect();
}
Also used : OnAccessibilityEventListener(android.app.UiAutomation.OnAccessibilityEventListener) AccessibilityEvent(android.view.accessibility.AccessibilityEvent) SimpleDateFormat(java.text.SimpleDateFormat) Date(java.util.Date) UiAutomationShellWrapper(com.android.uiautomator.core.UiAutomationShellWrapper)

Aggregations

OnAccessibilityEventListener (android.app.UiAutomation.OnAccessibilityEventListener)5 AccessibilityEvent (android.view.accessibility.AccessibilityEvent)5 UiAutomationShellWrapper (com.android.uiautomator.core.UiAutomationShellWrapper)5 SimpleDateFormat (java.text.SimpleDateFormat)5 Date (java.util.Date)5