Merge "Fix NPE force close if disabling BT feature" into main am: 1bb8e28762
Original change: https://android-review.googlesource.com/c/platform/packages/apps/Settings/+/3118024 Change-Id: Ibb00cb80a1d0c34a5a73f26b21ebe212692fc49c Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -72,7 +72,7 @@ class TetheredRepository(private val context: Context) {
|
|||||||
flowOf(null), // kick an initial value
|
flowOf(null), // kick an initial value
|
||||||
context.broadcastReceiverFlow(IntentFilter(BluetoothAdapter.ACTION_STATE_CHANGED)),
|
context.broadcastReceiverFlow(IntentFilter(BluetoothAdapter.ACTION_STATE_CHANGED)),
|
||||||
).flatMapLatest {
|
).flatMapLatest {
|
||||||
if (adapter.getState() == BluetoothAdapter.STATE_ON) {
|
if (adapter?.getState() == BluetoothAdapter.STATE_ON) {
|
||||||
isBluetoothPanTetheringOnFlow()
|
isBluetoothPanTetheringOnFlow()
|
||||||
} else {
|
} else {
|
||||||
flowOf(false)
|
flowOf(false)
|
||||||
@@ -93,10 +93,10 @@ class TetheredRepository(private val context: Context) {
|
|||||||
override fun onServiceDisconnected(profile: Int) {}
|
override fun onServiceDisconnected(profile: Int) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
adapter.getProfileProxy(context, listener, BluetoothProfile.PAN)
|
adapter?.getProfileProxy(context, listener, BluetoothProfile.PAN)
|
||||||
|
|
||||||
awaitClose {
|
awaitClose {
|
||||||
connectedProxy?.let { adapter.closeProfileProxy(BluetoothProfile.PAN, it) }
|
connectedProxy?.let { adapter?.closeProfileProxy(BluetoothProfile.PAN, it) }
|
||||||
}
|
}
|
||||||
}.conflate().flowOn(Dispatchers.Default)
|
}.conflate().flowOn(Dispatchers.Default)
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user