@Test public void close_safeToCallTwice() throws IOException { mDriver.close(); mDriver.close(); verify(mI2c, times(1)).close(); verify(mGpio, times(1)).close(); }
@Override public void close() throws IOException { mInputHandler.removeCallbacks(mPollingCallback); if (mDevice != null) { try { mDevice.close(); } finally { mDevice = null; } } if (mAlertPin != null) { mAlertPin.unregisterGpioCallback(mAlertPinCallback); try { mAlertPin.close(); } finally { mAlertPin = null; } } }
Cap1xxx implements AutoCloseable { @Override public void close() throws IOException { mInputHandler.removeCallbacks(mPollingCallback); if (mDevice != null) { try { mDevice.close(); } finally { mDevice = null; } } if (mAlertPin != null) { mAlertPin.unregisterGpioCallback(mAlertPinCallback); try { mAlertPin.close(); } finally { mAlertPin = null; } } } }
Cap1xxx implements AutoCloseable { @Override public void close() throws IOException { mInputHandler.removeCallbacks(mPollingCallback); if (mDevice != null) { try { mDevice.close(); } finally { mDevice = null; } } if (mAlertPin != null) { mAlertPin.unregisterGpioCallback(mAlertPinCallback); try { mAlertPin.close(); } finally { mAlertPin = null; } } } @Deprecated  Cap1xxx(Context context, String i2cName, String alertName, Configuration chip);  Cap1xxx(String i2cName, String alertName, Configuration chip); @Deprecated  Cap1xxx(Context context, String i2cName, String alertName, Configuration chip,
            Handler handler);  Cap1xxx(String i2cName, String alertName, Configuration chip, Handler handler);  Cap1xxx(String i2cName, int i2cAddress, String alertName, Configuration chip, Handler handler); @VisibleForTesting  Cap1xxx(I2cDevice i2cDevice, Gpio alertPin, Configuration chip); }
Cap1xxx implements AutoCloseable { @Override public void close() throws IOException { mInputHandler.removeCallbacks(mPollingCallback); if (mDevice != null) { try { mDevice.close(); } finally { mDevice = null; } } if (mAlertPin != null) { mAlertPin.unregisterGpioCallback(mAlertPinCallback); try { mAlertPin.close(); } finally { mAlertPin = null; } } } @Deprecated  Cap1xxx(Context context, String i2cName, String alertName, Configuration chip);  Cap1xxx(String i2cName, String alertName, Configuration chip); @Deprecated  Cap1xxx(Context context, String i2cName, String alertName, Configuration chip,
            Handler handler);  Cap1xxx(String i2cName, String alertName, Configuration chip, Handler handler);  Cap1xxx(String i2cName, int i2cAddress, String alertName, Configuration chip, Handler handler); @VisibleForTesting  Cap1xxx(I2cDevice i2cDevice, Gpio alertPin, Configuration chip); void setOnCapTouchListener(OnCapTouchListener listener); void setRepeatRate(@RepeatRate int rate); void setSensitivity(@Sensitivity int sensitivity); void setLedFade(@LedFade int ledFade); void setLedBrightness(float ledBrightness); void setMultitouchInputMax(int count); boolean readInterruptFlag(); boolean readInterruptFlag(boolean clear); void clearInterruptFlag(); boolean readInputChannel(int channel); boolean readLedState(int ledIndex); void setLedState(int ledIndex, boolean state); int getInputChannelCount(); int getMaximumTouchPoints(); int getLedCount(); @Override void close(); void setInputsEnabled(boolean enable); void setInterruptsEnabled(boolean enable); void setRepeatEnabled(boolean enable); void setLedInputLinkEnabled(boolean enable); }
Cap1xxx implements AutoCloseable { @Override public void close() throws IOException { mInputHandler.removeCallbacks(mPollingCallback); if (mDevice != null) { try { mDevice.close(); } finally { mDevice = null; } } if (mAlertPin != null) { mAlertPin.unregisterGpioCallback(mAlertPinCallback); try { mAlertPin.close(); } finally { mAlertPin = null; } } } @Deprecated  Cap1xxx(Context context, String i2cName, String alertName, Configuration chip);  Cap1xxx(String i2cName, String alertName, Configuration chip); @Deprecated  Cap1xxx(Context context, String i2cName, String alertName, Configuration chip,
            Handler handler);  Cap1xxx(String i2cName, String alertName, Configuration chip, Handler handler);  Cap1xxx(String i2cName, int i2cAddress, String alertName, Configuration chip, Handler handler); @VisibleForTesting  Cap1xxx(I2cDevice i2cDevice, Gpio alertPin, Configuration chip); void setOnCapTouchListener(OnCapTouchListener listener); void setRepeatRate(@RepeatRate int rate); void setSensitivity(@Sensitivity int sensitivity); void setLedFade(@LedFade int ledFade); void setLedBrightness(float ledBrightness); void setMultitouchInputMax(int count); boolean readInterruptFlag(); boolean readInterruptFlag(boolean clear); void clearInterruptFlag(); boolean readInputChannel(int channel); boolean readLedState(int ledIndex); void setLedState(int ledIndex, boolean state); int getInputChannelCount(); int getMaximumTouchPoints(); int getLedCount(); @Override void close(); void setInputsEnabled(boolean enable); void setInterruptsEnabled(boolean enable); void setRepeatEnabled(boolean enable); void setLedInputLinkEnabled(boolean enable); static final int DEFAULT_I2C_ADDRESS; static final int REPEAT_DISABLE; static final int REPEAT_FAST; static final int REPEAT_NORMAL; static final int REPEAT_SLOW; static final int SENSITIVITY_HIGH; static final int SENSITIVITY_NORMAL; static final int SENSITIVITY_LOW; static final int LED_FADE_INSTANT; static final int LED_FADE_FAST; static final int LED_FADE_SLOW; }