Loading android/app/jni/com_android_bluetooth_btservice_AdapterService.cpp +27 −13 Original line number Diff line number Diff line Loading @@ -31,8 +31,7 @@ #include "./com_android_bluetooth.h" #include "hardware/bt_sock.h" #include "os/logging/log_adapter.h" #include "utils/misc.h" #include "types/bt_transport.h" using bluetooth::Uuid; extern bt_interface_t bluetoothInterface; Loading @@ -53,12 +52,25 @@ static Uuid from_java_uuid(jlong uuid_msb, jlong uuid_lsb) { return Uuid::From128BitBE(uu); } namespace android { // Both namespace { tBT_TRANSPORT to_bt_transport(jint val) { switch (val) { case 0: return BT_TRANSPORT_AUTO; case 1: return BT_TRANSPORT_BR_EDR; case 2: return BT_TRANSPORT_LE; default: break; } log::warn("Passed unexpected transport value:{}", val); return BT_TRANSPORT_AUTO; } #define TRANSPORT_AUTO 0 #define TRANSPORT_BREDR 1 #define TRANSPORT_LE 2 } // namespace namespace android { #define BLE_ADDR_PUBLIC 0x00 #define BLE_ADDR_RANDOM 0x01 Loading Loading @@ -655,12 +667,12 @@ static void generate_local_oob_data_callback(tBT_TRANSPORT transport, bt_oob_dat return; } if (transport == TRANSPORT_BREDR) { if (transport == BT_TRANSPORT_BR_EDR) { sCallbackEnv->CallVoidMethod( sJniCallbacksObj, method_oobDataReceivedCallback, (jint)transport, ((oob_data.is_valid) ? createClassicOobDataObject(sCallbackEnv.get(), oob_data) : nullptr)); } else if (transport == TRANSPORT_LE) { } else if (transport == BT_TRANSPORT_LE) { sCallbackEnv->CallVoidMethod( sJniCallbacksObj, method_oobDataReceivedCallback, (jint)transport, ((oob_data.is_valid) ? createLeOobDataObject(sCallbackEnv.get(), oob_data) : nullptr)); Loading Loading @@ -1251,7 +1263,7 @@ static jboolean set_data(JNIEnv* env, jobject oobData, jint transport, bt_oob_da } // Transport specific data fetching/setting if (transport == TRANSPORT_BREDR) { if (transport == BT_TRANSPORT_BR_EDR) { // Classic // Not optional jbyteArray oobDataLength = Loading Loading @@ -1282,7 +1294,7 @@ static jboolean set_data(JNIEnv* env, jobject oobData, jint transport, bt_oob_da memcpy(oob_data->class_of_device, classOfDeviceBytes, OOB_COD_SIZE); env->ReleaseByteArrayElements(classOfDevice, classOfDeviceBytes, 0); } } else if (transport == TRANSPORT_LE) { } else if (transport == BT_TRANSPORT_LE) { // LE jbyteArray temporaryKey = callByteArrayGetter(env, oobData, "android/bluetooth/OobData", "getLeTemporaryKey"); Loading Loading @@ -1330,12 +1342,14 @@ static void generateLocalOobDataNative(JNIEnv* /* env */, jobject /* obj */, jin return; } if (sBluetoothInterface->generate_local_oob_data(transport) != BT_STATUS_SUCCESS) { tBT_TRANSPORT bt_transport = to_bt_transport(transport); if (sBluetoothInterface->generate_local_oob_data(bt_transport) != BT_STATUS_SUCCESS) { log::error("Call to generate_local_oob_data failed!"); bt_oob_data_t oob_data = { .is_valid = false, }; generate_local_oob_data_callback(transport, oob_data); generate_local_oob_data_callback(bt_transport, oob_data); } } // namespace android Loading android/app/src/com/android/bluetooth/gatt/GattService.java +21 −10 Original line number Diff line number Diff line Loading @@ -2913,7 +2913,7 @@ public class GattService extends ProfileService { return; } mHandleMap.addRequest(transId, handle); mHandleMap.addRequest(connId, transId, handle); ContextMap<IBluetoothGattServerCallback>.App app = mServerMap.getById(entry.serverIf); if (app == null) { Loading Loading @@ -2944,7 +2944,7 @@ public class GattService extends ProfileService { return; } mHandleMap.addRequest(transId, handle); mHandleMap.addRequest(connId, transId, handle); ContextMap<IBluetoothGattServerCallback>.App app = mServerMap.getById(entry.serverIf); if (app == null) { Loading Loading @@ -2985,7 +2985,7 @@ public class GattService extends ProfileService { return; } mHandleMap.addRequest(transId, handle); mHandleMap.addRequest(connId, transId, handle); ContextMap<IBluetoothGattServerCallback>.App app = mServerMap.getById(entry.serverIf); if (app == null) { Loading Loading @@ -3027,7 +3027,7 @@ public class GattService extends ProfileService { return; } mHandleMap.addRequest(transId, handle); mHandleMap.addRequest(connId, transId, handle); ContextMap<IBluetoothGattServerCallback>.App app = mServerMap.getById(entry.serverIf); if (app == null) { Loading Loading @@ -3311,15 +3311,26 @@ public class GattService extends ProfileService { return; } Log.v(TAG, "sendResponse() - address=" + address); Log.v(TAG, "sendResponse() - address=" + address + ", requestId=" + requestId); int handle = 0; Integer connId = 0; if (!Flags.gattServerRequestsFix()) { HandleMap.Entry entry = mHandleMap.getByRequestId(requestId); if (entry != null) { handle = entry.handle; } Integer connId = mServerMap.connIdByAddress(serverIf, address); connId = mServerMap.connIdByAddress(serverIf, address); } else { HandleMap.RequestData requestData = mHandleMap.getRequestDataByRequestId(requestId); if (requestData != null) { handle = requestData.mHandle; connId = requestData.mConnId; } else { connId = mServerMap.connIdByAddress(serverIf, address); } } mNativeInterface.gattServerSendResponse( serverIf, connId != null ? connId : 0, Loading android/app/src/com/android/bluetooth/gatt/HandleMap.java +34 −5 Original line number Diff line number Diff line Loading @@ -86,13 +86,23 @@ class HandleMap { } } static class RequestData { int mConnId; int mHandle; RequestData(int connId, int handle) { mConnId = connId; mHandle = handle; } } List<Entry> mEntries = null; Map<Integer, Integer> mRequestMap = null; Map<Integer, RequestData> mRequestMap = null; int mLastCharacteristic = 0; HandleMap() { mEntries = new CopyOnWriteArrayList<Entry>(); mRequestMap = new ConcurrentHashMap<Integer, Integer>(); mRequestMap = new ConcurrentHashMap<Integer, RequestData>(); } void clear() { Loading Loading @@ -170,8 +180,8 @@ class HandleMap { return mEntries; } void addRequest(int requestId, int handle) { mRequestMap.put(requestId, handle); void addRequest(int connId, int requestId, int handle) { mRequestMap.put(requestId, new RequestData(connId, handle)); } void deleteRequest(int requestId) { Loading @@ -179,7 +189,12 @@ class HandleMap { } Entry getByRequestId(int requestId) { Integer handle = mRequestMap.get(requestId); Integer handle = null; RequestData data = mRequestMap.get(requestId); if (data != null) { handle = data.mHandle; } if (handle == null) { Log.e(TAG, "getByRequestId() - Request ID " + requestId + " not found!"); return null; Loading @@ -187,6 +202,20 @@ class HandleMap { return getByHandle(handle); } RequestData getRequestDataByRequestId(int requestId) { RequestData data = mRequestMap.get(requestId); if (data == null) { Log.e(TAG, "getRequestDataByRequestId() - Request ID " + requestId + " not found!"); } else { Log.d( TAG, ("getRequestDataByRequestId(), requestId=" + requestId) + (", connId=" + data.mConnId + ",handle=" + data.mHandle)); } return data; } /** Logs debug information. */ void dump(StringBuilder sb) { sb.append(" Entries: ").append(mEntries.size()).append("\n"); Loading android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/AvrcpControllerServiceTest.java +4 −6 Original line number Diff line number Diff line Loading @@ -30,8 +30,8 @@ import android.bluetooth.BluetoothDevice; import android.bluetooth.BluetoothProfile; import android.content.Context; import android.content.Intent; import android.content.res.Resources; import android.media.AudioManager; import android.platform.test.annotations.EnableFlags; import android.platform.test.flag.junit.SetFlagsRule; import android.support.v4.media.session.PlaybackStateCompat; Loading @@ -40,7 +40,6 @@ import androidx.test.filters.MediumTest; import androidx.test.rule.ServiceTestRule; import androidx.test.runner.AndroidJUnit4; import com.android.bluetooth.R; import com.android.bluetooth.TestUtils; import com.android.bluetooth.a2dpsink.A2dpSinkService; import com.android.bluetooth.avrcpcontroller.BluetoothMediaBrowserService.BrowseResult; Loading @@ -67,11 +66,11 @@ public class AvrcpControllerServiceTest { private static final String REMOTE_DEVICE_ADDRESS = "00:00:00:00:00:00"; private static final String REMOTE_DEVICE_ADDRESS_2 = "11:11:11:11:11:11"; @Rule public final SetFlagsRule mSetFlagsRule = new SetFlagsRule(); private AvrcpControllerService mService = null; private BluetoothAdapter mAdapter = null; @Rule public final SetFlagsRule mSetFlagsRule = new SetFlagsRule(); @Rule public final ServiceTestRule mBluetoothBrowserMediaServiceTestRule = new ServiceTestRule(); Loading Loading @@ -517,9 +516,8 @@ public class AvrcpControllerServiceTest { * first device by checking that it has remained as the active device. */ @Test @EnableFlags(Flags.FLAG_RANDOMIZE_DEVICE_LEVEL_MEDIA_IDS) public void testActiveDeviceMaintainsAudioFocusWhenOtherDeviceConnects_audioFocusMaintained() { mSetFlagsRule.enableFlags(Flags.FLAG_RANDOMIZE_DEVICE_LEVEL_MEDIA_IDS); mService.onConnectionStateChanged(true, true, mRemoteDevice); // check set active device is called verify(mA2dpSinkService).setActiveDevice(mRemoteDevice); Loading android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/AvrcpControllerStateMachineTest.java +6 −4 Original line number Diff line number Diff line Loading @@ -31,6 +31,8 @@ import android.content.res.Resources; import android.media.AudioManager; import android.os.Bundle; import android.os.Looper; import android.platform.test.annotations.DisableFlags; import android.platform.test.annotations.EnableFlags; import android.platform.test.flag.junit.SetFlagsRule; import android.support.v4.media.MediaMetadataCompat; import android.support.v4.media.session.MediaControllerCompat; Loading Loading @@ -74,10 +76,10 @@ public class AvrcpControllerStateMachineTest { private static final int UUID_START = 0; private static final int UUID_LENGTH = 25; @Rule public final SetFlagsRule mSetFlagsRule = new SetFlagsRule(); private BluetoothAdapter mAdapter; @Rule public final SetFlagsRule mSetFlagsRule = new SetFlagsRule(); @Rule public MockitoRule mockitoRule = MockitoJUnit.rule(); @Mock private AdapterService mAdapterService; Loading Loading @@ -465,8 +467,8 @@ public class AvrcpControllerStateMachineTest { /** Get the root of the device */ @Test @DisableFlags(Flags.FLAG_RANDOMIZE_DEVICE_LEVEL_MEDIA_IDS) public void testGetDeviceRootNode_flagRandomDeviceIdDisabled_rootNodeMatchesUuidFormat() { mSetFlagsRule.disableFlags(Flags.FLAG_RANDOMIZE_DEVICE_LEVEL_MEDIA_IDS); // create new state machine to follow current flags rule mAvrcpStateMachine = makeStateMachine(mTestDevice); setUpConnectedState(true, true); Loading @@ -478,8 +480,8 @@ public class AvrcpControllerStateMachineTest { /** Get the root of the device */ @Test @EnableFlags(Flags.FLAG_RANDOMIZE_DEVICE_LEVEL_MEDIA_IDS) public void testGetDeviceRootNode_flagRandomDeviceIdEnabled_rootNodeMatchesUuidFormat() { mSetFlagsRule.enableFlags(Flags.FLAG_RANDOMIZE_DEVICE_LEVEL_MEDIA_IDS); // create new state machine to follow current flags rule mAvrcpStateMachine = makeStateMachine(mTestDevice); setUpConnectedState(true, true); Loading Loading
android/app/jni/com_android_bluetooth_btservice_AdapterService.cpp +27 −13 Original line number Diff line number Diff line Loading @@ -31,8 +31,7 @@ #include "./com_android_bluetooth.h" #include "hardware/bt_sock.h" #include "os/logging/log_adapter.h" #include "utils/misc.h" #include "types/bt_transport.h" using bluetooth::Uuid; extern bt_interface_t bluetoothInterface; Loading @@ -53,12 +52,25 @@ static Uuid from_java_uuid(jlong uuid_msb, jlong uuid_lsb) { return Uuid::From128BitBE(uu); } namespace android { // Both namespace { tBT_TRANSPORT to_bt_transport(jint val) { switch (val) { case 0: return BT_TRANSPORT_AUTO; case 1: return BT_TRANSPORT_BR_EDR; case 2: return BT_TRANSPORT_LE; default: break; } log::warn("Passed unexpected transport value:{}", val); return BT_TRANSPORT_AUTO; } #define TRANSPORT_AUTO 0 #define TRANSPORT_BREDR 1 #define TRANSPORT_LE 2 } // namespace namespace android { #define BLE_ADDR_PUBLIC 0x00 #define BLE_ADDR_RANDOM 0x01 Loading Loading @@ -655,12 +667,12 @@ static void generate_local_oob_data_callback(tBT_TRANSPORT transport, bt_oob_dat return; } if (transport == TRANSPORT_BREDR) { if (transport == BT_TRANSPORT_BR_EDR) { sCallbackEnv->CallVoidMethod( sJniCallbacksObj, method_oobDataReceivedCallback, (jint)transport, ((oob_data.is_valid) ? createClassicOobDataObject(sCallbackEnv.get(), oob_data) : nullptr)); } else if (transport == TRANSPORT_LE) { } else if (transport == BT_TRANSPORT_LE) { sCallbackEnv->CallVoidMethod( sJniCallbacksObj, method_oobDataReceivedCallback, (jint)transport, ((oob_data.is_valid) ? createLeOobDataObject(sCallbackEnv.get(), oob_data) : nullptr)); Loading Loading @@ -1251,7 +1263,7 @@ static jboolean set_data(JNIEnv* env, jobject oobData, jint transport, bt_oob_da } // Transport specific data fetching/setting if (transport == TRANSPORT_BREDR) { if (transport == BT_TRANSPORT_BR_EDR) { // Classic // Not optional jbyteArray oobDataLength = Loading Loading @@ -1282,7 +1294,7 @@ static jboolean set_data(JNIEnv* env, jobject oobData, jint transport, bt_oob_da memcpy(oob_data->class_of_device, classOfDeviceBytes, OOB_COD_SIZE); env->ReleaseByteArrayElements(classOfDevice, classOfDeviceBytes, 0); } } else if (transport == TRANSPORT_LE) { } else if (transport == BT_TRANSPORT_LE) { // LE jbyteArray temporaryKey = callByteArrayGetter(env, oobData, "android/bluetooth/OobData", "getLeTemporaryKey"); Loading Loading @@ -1330,12 +1342,14 @@ static void generateLocalOobDataNative(JNIEnv* /* env */, jobject /* obj */, jin return; } if (sBluetoothInterface->generate_local_oob_data(transport) != BT_STATUS_SUCCESS) { tBT_TRANSPORT bt_transport = to_bt_transport(transport); if (sBluetoothInterface->generate_local_oob_data(bt_transport) != BT_STATUS_SUCCESS) { log::error("Call to generate_local_oob_data failed!"); bt_oob_data_t oob_data = { .is_valid = false, }; generate_local_oob_data_callback(transport, oob_data); generate_local_oob_data_callback(bt_transport, oob_data); } } // namespace android Loading
android/app/src/com/android/bluetooth/gatt/GattService.java +21 −10 Original line number Diff line number Diff line Loading @@ -2913,7 +2913,7 @@ public class GattService extends ProfileService { return; } mHandleMap.addRequest(transId, handle); mHandleMap.addRequest(connId, transId, handle); ContextMap<IBluetoothGattServerCallback>.App app = mServerMap.getById(entry.serverIf); if (app == null) { Loading Loading @@ -2944,7 +2944,7 @@ public class GattService extends ProfileService { return; } mHandleMap.addRequest(transId, handle); mHandleMap.addRequest(connId, transId, handle); ContextMap<IBluetoothGattServerCallback>.App app = mServerMap.getById(entry.serverIf); if (app == null) { Loading Loading @@ -2985,7 +2985,7 @@ public class GattService extends ProfileService { return; } mHandleMap.addRequest(transId, handle); mHandleMap.addRequest(connId, transId, handle); ContextMap<IBluetoothGattServerCallback>.App app = mServerMap.getById(entry.serverIf); if (app == null) { Loading Loading @@ -3027,7 +3027,7 @@ public class GattService extends ProfileService { return; } mHandleMap.addRequest(transId, handle); mHandleMap.addRequest(connId, transId, handle); ContextMap<IBluetoothGattServerCallback>.App app = mServerMap.getById(entry.serverIf); if (app == null) { Loading Loading @@ -3311,15 +3311,26 @@ public class GattService extends ProfileService { return; } Log.v(TAG, "sendResponse() - address=" + address); Log.v(TAG, "sendResponse() - address=" + address + ", requestId=" + requestId); int handle = 0; Integer connId = 0; if (!Flags.gattServerRequestsFix()) { HandleMap.Entry entry = mHandleMap.getByRequestId(requestId); if (entry != null) { handle = entry.handle; } Integer connId = mServerMap.connIdByAddress(serverIf, address); connId = mServerMap.connIdByAddress(serverIf, address); } else { HandleMap.RequestData requestData = mHandleMap.getRequestDataByRequestId(requestId); if (requestData != null) { handle = requestData.mHandle; connId = requestData.mConnId; } else { connId = mServerMap.connIdByAddress(serverIf, address); } } mNativeInterface.gattServerSendResponse( serverIf, connId != null ? connId : 0, Loading
android/app/src/com/android/bluetooth/gatt/HandleMap.java +34 −5 Original line number Diff line number Diff line Loading @@ -86,13 +86,23 @@ class HandleMap { } } static class RequestData { int mConnId; int mHandle; RequestData(int connId, int handle) { mConnId = connId; mHandle = handle; } } List<Entry> mEntries = null; Map<Integer, Integer> mRequestMap = null; Map<Integer, RequestData> mRequestMap = null; int mLastCharacteristic = 0; HandleMap() { mEntries = new CopyOnWriteArrayList<Entry>(); mRequestMap = new ConcurrentHashMap<Integer, Integer>(); mRequestMap = new ConcurrentHashMap<Integer, RequestData>(); } void clear() { Loading Loading @@ -170,8 +180,8 @@ class HandleMap { return mEntries; } void addRequest(int requestId, int handle) { mRequestMap.put(requestId, handle); void addRequest(int connId, int requestId, int handle) { mRequestMap.put(requestId, new RequestData(connId, handle)); } void deleteRequest(int requestId) { Loading @@ -179,7 +189,12 @@ class HandleMap { } Entry getByRequestId(int requestId) { Integer handle = mRequestMap.get(requestId); Integer handle = null; RequestData data = mRequestMap.get(requestId); if (data != null) { handle = data.mHandle; } if (handle == null) { Log.e(TAG, "getByRequestId() - Request ID " + requestId + " not found!"); return null; Loading @@ -187,6 +202,20 @@ class HandleMap { return getByHandle(handle); } RequestData getRequestDataByRequestId(int requestId) { RequestData data = mRequestMap.get(requestId); if (data == null) { Log.e(TAG, "getRequestDataByRequestId() - Request ID " + requestId + " not found!"); } else { Log.d( TAG, ("getRequestDataByRequestId(), requestId=" + requestId) + (", connId=" + data.mConnId + ",handle=" + data.mHandle)); } return data; } /** Logs debug information. */ void dump(StringBuilder sb) { sb.append(" Entries: ").append(mEntries.size()).append("\n"); Loading
android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/AvrcpControllerServiceTest.java +4 −6 Original line number Diff line number Diff line Loading @@ -30,8 +30,8 @@ import android.bluetooth.BluetoothDevice; import android.bluetooth.BluetoothProfile; import android.content.Context; import android.content.Intent; import android.content.res.Resources; import android.media.AudioManager; import android.platform.test.annotations.EnableFlags; import android.platform.test.flag.junit.SetFlagsRule; import android.support.v4.media.session.PlaybackStateCompat; Loading @@ -40,7 +40,6 @@ import androidx.test.filters.MediumTest; import androidx.test.rule.ServiceTestRule; import androidx.test.runner.AndroidJUnit4; import com.android.bluetooth.R; import com.android.bluetooth.TestUtils; import com.android.bluetooth.a2dpsink.A2dpSinkService; import com.android.bluetooth.avrcpcontroller.BluetoothMediaBrowserService.BrowseResult; Loading @@ -67,11 +66,11 @@ public class AvrcpControllerServiceTest { private static final String REMOTE_DEVICE_ADDRESS = "00:00:00:00:00:00"; private static final String REMOTE_DEVICE_ADDRESS_2 = "11:11:11:11:11:11"; @Rule public final SetFlagsRule mSetFlagsRule = new SetFlagsRule(); private AvrcpControllerService mService = null; private BluetoothAdapter mAdapter = null; @Rule public final SetFlagsRule mSetFlagsRule = new SetFlagsRule(); @Rule public final ServiceTestRule mBluetoothBrowserMediaServiceTestRule = new ServiceTestRule(); Loading Loading @@ -517,9 +516,8 @@ public class AvrcpControllerServiceTest { * first device by checking that it has remained as the active device. */ @Test @EnableFlags(Flags.FLAG_RANDOMIZE_DEVICE_LEVEL_MEDIA_IDS) public void testActiveDeviceMaintainsAudioFocusWhenOtherDeviceConnects_audioFocusMaintained() { mSetFlagsRule.enableFlags(Flags.FLAG_RANDOMIZE_DEVICE_LEVEL_MEDIA_IDS); mService.onConnectionStateChanged(true, true, mRemoteDevice); // check set active device is called verify(mA2dpSinkService).setActiveDevice(mRemoteDevice); Loading
android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/AvrcpControllerStateMachineTest.java +6 −4 Original line number Diff line number Diff line Loading @@ -31,6 +31,8 @@ import android.content.res.Resources; import android.media.AudioManager; import android.os.Bundle; import android.os.Looper; import android.platform.test.annotations.DisableFlags; import android.platform.test.annotations.EnableFlags; import android.platform.test.flag.junit.SetFlagsRule; import android.support.v4.media.MediaMetadataCompat; import android.support.v4.media.session.MediaControllerCompat; Loading Loading @@ -74,10 +76,10 @@ public class AvrcpControllerStateMachineTest { private static final int UUID_START = 0; private static final int UUID_LENGTH = 25; @Rule public final SetFlagsRule mSetFlagsRule = new SetFlagsRule(); private BluetoothAdapter mAdapter; @Rule public final SetFlagsRule mSetFlagsRule = new SetFlagsRule(); @Rule public MockitoRule mockitoRule = MockitoJUnit.rule(); @Mock private AdapterService mAdapterService; Loading Loading @@ -465,8 +467,8 @@ public class AvrcpControllerStateMachineTest { /** Get the root of the device */ @Test @DisableFlags(Flags.FLAG_RANDOMIZE_DEVICE_LEVEL_MEDIA_IDS) public void testGetDeviceRootNode_flagRandomDeviceIdDisabled_rootNodeMatchesUuidFormat() { mSetFlagsRule.disableFlags(Flags.FLAG_RANDOMIZE_DEVICE_LEVEL_MEDIA_IDS); // create new state machine to follow current flags rule mAvrcpStateMachine = makeStateMachine(mTestDevice); setUpConnectedState(true, true); Loading @@ -478,8 +480,8 @@ public class AvrcpControllerStateMachineTest { /** Get the root of the device */ @Test @EnableFlags(Flags.FLAG_RANDOMIZE_DEVICE_LEVEL_MEDIA_IDS) public void testGetDeviceRootNode_flagRandomDeviceIdEnabled_rootNodeMatchesUuidFormat() { mSetFlagsRule.enableFlags(Flags.FLAG_RANDOMIZE_DEVICE_LEVEL_MEDIA_IDS); // create new state machine to follow current flags rule mAvrcpStateMachine = makeStateMachine(mTestDevice); setUpConnectedState(true, true); Loading