Loading src/com/android/settings/network/TetherPreferenceController.java +2 −1 Original line number Diff line number Diff line Loading @@ -131,7 +131,8 @@ public class TetherPreferenceController extends AbstractPreferenceController imp @Override public void onCreate(Bundle savedInstanceState) { if (mBluetoothAdapter != null) { if (mBluetoothAdapter != null && mBluetoothAdapter.getState() == BluetoothAdapter.STATE_ON) { mBluetoothAdapter.getProfileProxy(mContext, mBtProfileServiceListener, BluetoothProfile.PAN); } Loading tests/robotests/src/com/android/settings/network/TetherPreferenceControllerTest.java +13 −2 Original line number Diff line number Diff line Loading @@ -75,10 +75,21 @@ public class TetherPreferenceControllerTest { @Test public void lifeCycle_onCreate_shouldInitBluetoothPan() { when(mBluetoothAdapter.getState()).thenReturn(BluetoothAdapter.STATE_ON); mController.onCreate(null); verify(mBluetoothAdapter) .getProfileProxy(mContext, mController.mBtProfileServiceListener, BluetoothProfile.PAN); verify(mBluetoothAdapter).getState(); verify(mBluetoothAdapter).getProfileProxy(mContext, mController.mBtProfileServiceListener, BluetoothProfile.PAN); } @Test public void lifeCycle_onCreate_shouldNotInitBluetoothPanWhenBluetoothOff() { when(mBluetoothAdapter.getState()).thenReturn(BluetoothAdapter.STATE_OFF); mController.onCreate(null); verify(mBluetoothAdapter).getState(); verifyNoMoreInteractions(mBluetoothAdapter); } @Test Loading Loading
src/com/android/settings/network/TetherPreferenceController.java +2 −1 Original line number Diff line number Diff line Loading @@ -131,7 +131,8 @@ public class TetherPreferenceController extends AbstractPreferenceController imp @Override public void onCreate(Bundle savedInstanceState) { if (mBluetoothAdapter != null) { if (mBluetoothAdapter != null && mBluetoothAdapter.getState() == BluetoothAdapter.STATE_ON) { mBluetoothAdapter.getProfileProxy(mContext, mBtProfileServiceListener, BluetoothProfile.PAN); } Loading
tests/robotests/src/com/android/settings/network/TetherPreferenceControllerTest.java +13 −2 Original line number Diff line number Diff line Loading @@ -75,10 +75,21 @@ public class TetherPreferenceControllerTest { @Test public void lifeCycle_onCreate_shouldInitBluetoothPan() { when(mBluetoothAdapter.getState()).thenReturn(BluetoothAdapter.STATE_ON); mController.onCreate(null); verify(mBluetoothAdapter) .getProfileProxy(mContext, mController.mBtProfileServiceListener, BluetoothProfile.PAN); verify(mBluetoothAdapter).getState(); verify(mBluetoothAdapter).getProfileProxy(mContext, mController.mBtProfileServiceListener, BluetoothProfile.PAN); } @Test public void lifeCycle_onCreate_shouldNotInitBluetoothPanWhenBluetoothOff() { when(mBluetoothAdapter.getState()).thenReturn(BluetoothAdapter.STATE_OFF); mController.onCreate(null); verify(mBluetoothAdapter).getState(); verifyNoMoreInteractions(mBluetoothAdapter); } @Test Loading