diff options
author | 2024-11-13 21:37:14 +0000 | |
---|---|---|
committer | 2024-11-13 21:37:14 +0000 | |
commit | d7becd047d7751f06bb818b6a5ca845113cb0ec4 (patch) | |
tree | 7fb2f1f44f655794e419ed7b705565f78df8ad1c | |
parent | 43e90cf73fa4a611b997433c412c5244a87204c4 (diff) | |
parent | 58eebd8ad6fcb95925515d053e87ed5df52ee1ca (diff) |
Merge "Fixing comment formatting" into main
-rw-r--r-- | packages/SystemUI/src/com/android/systemui/statusbar/pipeline/wifi/data/repository/prod/WifiRepositoryImpl.kt | 67 |
1 files changed, 25 insertions, 42 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/wifi/data/repository/prod/WifiRepositoryImpl.kt b/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/wifi/data/repository/prod/WifiRepositoryImpl.kt index c7b6be3fc4ac..a1b56d6688d6 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/wifi/data/repository/prod/WifiRepositoryImpl.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/wifi/data/repository/prod/WifiRepositoryImpl.kt @@ -112,8 +112,7 @@ constructor( selectedUserContext .flatMapLatest { currentContext -> // flatMapLatest because when selectedUserContext emits a new value, we want - // to - // re-create a whole flow + // to re-create a whole flow callbackFlow { val callback = object : WifiPickerTracker.WifiPickerTrackerCallback { @@ -132,20 +131,16 @@ constructor( .map { it.toWifiNetworkModel() } // [WifiPickerTracker.connectedWifiEntry] will return the - // same - // instance but with updated internals. For example, when - // its - // validation status changes from false to true, the same - // instance is re-used but with the validated field updated. + // same instance but with updated internals. For example, + // when its validation status changes from false to true, + // the same instance is re-used but with the validated + // field updated. // // Because it's the same instance, the flow won't re-emit - // the - // value (even though the internals have changed). So, we - // need - // to transform it into our internal model immediately. - // [toWifiNetworkModel] always returns a new instance, so - // the - // flow is guaranteed to emit. + // the value (even though the internals have changed). So, + // we need to transform it into our internal model + // immediately. [toWifiNetworkModel] always returns a new + // instance, so the flow is guaranteed to emit. send( newPrimaryNetwork = connectedEntry?.toPrimaryWifiNetworkModel() @@ -235,20 +230,15 @@ constructor( .map { it.toWifiNetworkModel() } // [WifiPickerTracker.connectedWifiEntry] will return the same - // instance - // but with updated internals. For example, when its validation - // status - // changes from false to true, the same instance is re-used but - // with the - // validated field updated. + // instance but with updated internals. For example, when its + // validation status changes from false to true, the same + // instance is re-used but with the validated field updated. // // Because it's the same instance, the flow won't re-emit the - // value - // (even though the internals have changed). So, we need to - // transform it - // into our internal model immediately. [toWifiNetworkModel] - // always - // returns a new instance, so the flow is guaranteed to emit. + // value (even though the internals have changed). So, we need + // to transform it into our internal model immediately. + // [toWifiNetworkModel] always returns a new instance, so the + // flow is guaranteed to emit. send( newPrimaryNetwork = connectedEntry?.toPrimaryWifiNetworkModel() @@ -292,12 +282,10 @@ constructor( .create(applicationContext, lifecycle, callback, "WifiRepository") .apply { // By default, [WifiPickerTracker] will scan to see all - // available wifi - // networks in the area. Because SysUI only needs to display the - // **connected** network, we don't need scans to be running (and - // in fact, - // running scans is costly and should be avoided whenever - // possible). + // available wifi networks in the area. Because SysUI only + // needs to display the **connected** network, we don't + // need scans to be running (and in fact, running scans is + // costly and should be avoided whenever possible). this?.disableScanning() } // The lifecycle must be STARTED in order for the callback to receive @@ -382,16 +370,11 @@ constructor( private fun MergedCarrierEntry.convertCarrierMergedToModel(): WifiNetworkModel { // WifiEntry instance values aren't guaranteed to be stable between method calls - // because - // WifiPickerTracker is continuously updating the same object. Save the level in a - // local - // variable so that checking the level validity here guarantees that the level will - // still be - // valid when we create the `WifiNetworkModel.Active` instance later. Otherwise, the - // level - // could be valid here but become invalid later, and `WifiNetworkModel.Active` will - // throw - // an exception. See b/362384551. + // because WifiPickerTracker is continuously updating the same object. Save the + // level in a local variable so that checking the level validity here guarantees + // that the level will still be valid when we create the `WifiNetworkModel.Active` + // instance later. Otherwise, the level could be valid here but become invalid + // later, and `WifiNetworkModel.Active` will throw an exception. See b/362384551. return WifiNetworkModel.CarrierMerged.of( subscriptionId = this.subscriptionId, |