media/version-compat-tests/current/client/src/androidTest/java/androidx/media/test/client/TestHelper.java
public boolean connect(int timeoutMs) {
        mServiceConnection = new MyServiceConnection();

        final Intent intent = new Intent(ACTION_TEST_HELPER);
        intent.setComponent(SERVICE_TEST_HELPER_COMPONENT_NAME);

        boolean bound = false;
        try {
            bound = mContext.bindService(intent, mServiceConnection, Context.BIND_AUTO_CREATE);
        } catch (Exception ex) {
            Log.e(TAG, "Failed binding to the test helper service of service app");
        }

        if (bound) {
            try {
                mCountDownLatch.await(timeoutMs, TimeUnit.MILLISECONDS);
            } catch (InterruptedException ex) {
                Log.e(TAG, "InterruptedException while waiting for onServiceConnected.", ex);
            }
        }
        return mBinder != null;
    }
/**
     * Connects to service app's TestHelperService. Should NOT be called in main thread.
     *
     * @return true if connected successfully, false if failed to connect.
     */
Connects to service app's TestHelperService. Should NOT be called in main thread.
@return true if connected successfully, false if failed to connect.
Connects to service app ' s TestHelperService . Should NOT be called in main thread . @return true if connected successfully false if failed to connect .
public boolean connect(int timeoutMs) {
        mServiceConnection = new MyServiceConnection();
        final Intent intent = new Intent(ACTION_TEST_HELPER);
        intent.setComponent(SERVICE_TEST_HELPER_COMPONENT_NAME);
        boolean bound = false;
        try {
            bound = mContext.bindService(intent, mServiceConnection, Context.BIND_AUTO_CREATE);
        } catch (Exception ex) {
            Log.e(TAG, "Failed binding to the test helper service of service app");
        }
        if (bound) {
            try {
                mCountDownLatch.await(timeoutMs, TimeUnit.MILLISECONDS);
            } catch (InterruptedException ex) {
                Log.e(TAG, "InterruptedException while waiting for onServiceConnected.", ex);
            }
        }
        return mBinder != null;
    }
public boolean connect ( int timeoutMs ) { mServiceConnection = new MyServiceConnection ( ) ; final Intent intent = new Intent ( ACTION_TEST_HELPER ) ; intent . setComponent ( SERVICE_TEST_HELPER_COMPONENT_NAME ) ; boolean bound = false ; try { bound = mContext . bindService ( intent , mServiceConnection , Context . BIND_AUTO_CREATE ) ; } catch ( Exception ex ) { Log . e ( TAG , "Failed binding to the test helper service of service app" ) ; } if ( bound ) { try { mCountDownLatch . await ( timeoutMs , TimeUnit . MILLISECONDS ) ; } catch ( InterruptedException ex ) { Log . e ( TAG , "InterruptedException while waiting for onServiceConnected." , ex ) ; } } return mBinder != null ; }
Connects to service app's TestHelperService.
Connects to service app ' s TestHelperService .