Loading packages/SystemUI/src/com/android/systemui/statusbar/connectivity/AccessPointControllerImpl.java +1 −1 Original line number Diff line number Diff line Loading @@ -87,7 +87,7 @@ public class AccessPointControllerImpl implements AccessPointController, */ public void init() { if (mWifiPickerTracker == null) { mWifiPickerTracker = mWifiPickerTrackerFactory.create(this.getLifecycle(), this); mWifiPickerTracker = mWifiPickerTrackerFactory.create(this.getLifecycle(), this, TAG); } } Loading packages/SystemUI/src/com/android/systemui/statusbar/connectivity/WifiPickerTrackerFactory.kt +8 −3 Original line number Diff line number Diff line Loading @@ -23,8 +23,8 @@ import android.os.Handler import android.os.SimpleClock import androidx.lifecycle.Lifecycle import com.android.systemui.dagger.SysUISingleton import com.android.systemui.dagger.qualifiers.Background import com.android.systemui.dagger.qualifiers.Main import com.android.systemui.util.concurrency.ThreadFactory import com.android.systemui.util.time.SystemClock import com.android.wifitrackerlib.WifiPickerTracker import com.android.wifitrackerlib.WifiPickerTracker.WifiPickerTrackerCallback Loading @@ -46,7 +46,7 @@ constructor( private val connectivityManager: ConnectivityManager, private val systemClock: SystemClock, @Main private val mainHandler: Handler, @Background private val workerHandler: Handler, private val threadFactory: ThreadFactory, ) { private val clock: Clock = object : SimpleClock(ZoneOffset.UTC) { Loading @@ -60,11 +60,13 @@ constructor( /** * Creates a [WifiPickerTracker] instance. * * @param name a name to identify the worker thread used for [WifiPickerTracker] operations. * @return a new [WifiPickerTracker] or null if [WifiManager] is null. */ fun create( lifecycle: Lifecycle, listener: WifiPickerTrackerCallback, name: String, ): WifiPickerTracker? { return if (wifiManager == null) { null Loading @@ -75,7 +77,10 @@ constructor( wifiManager, connectivityManager, mainHandler, workerHandler, // WifiPickerTracker can take tens of seconds to finish operations, so it can't use // the default background handler (it would block all other background operations). // Use a custom handler instead. threadFactory.buildHandlerOnNewThread("WifiPickerTracker-$name"), clock, MAX_SCAN_AGE_MILLIS, SCAN_INTERVAL_MILLIS, Loading packages/SystemUI/src/com/android/systemui/statusbar/pipeline/wifi/data/repository/prod/WifiRepositoryViaTrackerLib.kt +1 −1 Original line number Diff line number Diff line Loading @@ -165,7 +165,7 @@ constructor( } wifiPickerTracker = wifiPickerTrackerFactory.create(lifecycle, callback).apply { wifiPickerTrackerFactory.create(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, Loading packages/SystemUI/tests/src/com/android/systemui/statusbar/connectivity/AccessPointControllerImplTest.kt +2 −2 Original line number Diff line number Diff line Loading @@ -72,7 +72,7 @@ class AccessPointControllerImplTest : SysuiTestCase() { @Before fun setUp() { MockitoAnnotations.initMocks(this) `when`(wifiPickerTrackerFactory.create(any(), any())).thenReturn(wifiPickerTracker) `when`(wifiPickerTrackerFactory.create(any(), any(), any())).thenReturn(wifiPickerTracker) `when`(wifiPickerTracker.connectedWifiEntry).thenReturn(wifiEntryConnected) `when`(wifiPickerTracker.wifiEntries).thenReturn(ArrayList<WifiEntry>().apply { Loading Loading @@ -165,7 +165,7 @@ class AccessPointControllerImplTest : SysuiTestCase() { @Test fun testReturnEmptyListWhenNoWifiPickerTracker() { `when`(wifiPickerTrackerFactory.create(any(), any())).thenReturn(null) `when`(wifiPickerTrackerFactory.create(any(), any(), any())).thenReturn(null) val otherController = AccessPointControllerImpl( userManager, userTracker, Loading packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/wifi/data/repository/prod/WifiRepositoryViaTrackerLibTest.kt +1 −1 Original line number Diff line number Diff line Loading @@ -105,7 +105,7 @@ class WifiRepositoryViaTrackerLibTest : SysuiTestCase() { fun setUp() { featureFlags.set(Flags.INSTANT_TETHER, false) featureFlags.set(Flags.WIFI_SECONDARY_NETWORKS, false) whenever(wifiPickerTrackerFactory.create(any(), capture(callbackCaptor))) whenever(wifiPickerTrackerFactory.create(any(), capture(callbackCaptor), any())) .thenReturn(wifiPickerTracker) } Loading Loading
packages/SystemUI/src/com/android/systemui/statusbar/connectivity/AccessPointControllerImpl.java +1 −1 Original line number Diff line number Diff line Loading @@ -87,7 +87,7 @@ public class AccessPointControllerImpl implements AccessPointController, */ public void init() { if (mWifiPickerTracker == null) { mWifiPickerTracker = mWifiPickerTrackerFactory.create(this.getLifecycle(), this); mWifiPickerTracker = mWifiPickerTrackerFactory.create(this.getLifecycle(), this, TAG); } } Loading
packages/SystemUI/src/com/android/systemui/statusbar/connectivity/WifiPickerTrackerFactory.kt +8 −3 Original line number Diff line number Diff line Loading @@ -23,8 +23,8 @@ import android.os.Handler import android.os.SimpleClock import androidx.lifecycle.Lifecycle import com.android.systemui.dagger.SysUISingleton import com.android.systemui.dagger.qualifiers.Background import com.android.systemui.dagger.qualifiers.Main import com.android.systemui.util.concurrency.ThreadFactory import com.android.systemui.util.time.SystemClock import com.android.wifitrackerlib.WifiPickerTracker import com.android.wifitrackerlib.WifiPickerTracker.WifiPickerTrackerCallback Loading @@ -46,7 +46,7 @@ constructor( private val connectivityManager: ConnectivityManager, private val systemClock: SystemClock, @Main private val mainHandler: Handler, @Background private val workerHandler: Handler, private val threadFactory: ThreadFactory, ) { private val clock: Clock = object : SimpleClock(ZoneOffset.UTC) { Loading @@ -60,11 +60,13 @@ constructor( /** * Creates a [WifiPickerTracker] instance. * * @param name a name to identify the worker thread used for [WifiPickerTracker] operations. * @return a new [WifiPickerTracker] or null if [WifiManager] is null. */ fun create( lifecycle: Lifecycle, listener: WifiPickerTrackerCallback, name: String, ): WifiPickerTracker? { return if (wifiManager == null) { null Loading @@ -75,7 +77,10 @@ constructor( wifiManager, connectivityManager, mainHandler, workerHandler, // WifiPickerTracker can take tens of seconds to finish operations, so it can't use // the default background handler (it would block all other background operations). // Use a custom handler instead. threadFactory.buildHandlerOnNewThread("WifiPickerTracker-$name"), clock, MAX_SCAN_AGE_MILLIS, SCAN_INTERVAL_MILLIS, Loading
packages/SystemUI/src/com/android/systemui/statusbar/pipeline/wifi/data/repository/prod/WifiRepositoryViaTrackerLib.kt +1 −1 Original line number Diff line number Diff line Loading @@ -165,7 +165,7 @@ constructor( } wifiPickerTracker = wifiPickerTrackerFactory.create(lifecycle, callback).apply { wifiPickerTrackerFactory.create(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, Loading
packages/SystemUI/tests/src/com/android/systemui/statusbar/connectivity/AccessPointControllerImplTest.kt +2 −2 Original line number Diff line number Diff line Loading @@ -72,7 +72,7 @@ class AccessPointControllerImplTest : SysuiTestCase() { @Before fun setUp() { MockitoAnnotations.initMocks(this) `when`(wifiPickerTrackerFactory.create(any(), any())).thenReturn(wifiPickerTracker) `when`(wifiPickerTrackerFactory.create(any(), any(), any())).thenReturn(wifiPickerTracker) `when`(wifiPickerTracker.connectedWifiEntry).thenReturn(wifiEntryConnected) `when`(wifiPickerTracker.wifiEntries).thenReturn(ArrayList<WifiEntry>().apply { Loading Loading @@ -165,7 +165,7 @@ class AccessPointControllerImplTest : SysuiTestCase() { @Test fun testReturnEmptyListWhenNoWifiPickerTracker() { `when`(wifiPickerTrackerFactory.create(any(), any())).thenReturn(null) `when`(wifiPickerTrackerFactory.create(any(), any(), any())).thenReturn(null) val otherController = AccessPointControllerImpl( userManager, userTracker, Loading
packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/wifi/data/repository/prod/WifiRepositoryViaTrackerLibTest.kt +1 −1 Original line number Diff line number Diff line Loading @@ -105,7 +105,7 @@ class WifiRepositoryViaTrackerLibTest : SysuiTestCase() { fun setUp() { featureFlags.set(Flags.INSTANT_TETHER, false) featureFlags.set(Flags.WIFI_SECONDARY_NETWORKS, false) whenever(wifiPickerTrackerFactory.create(any(), capture(callbackCaptor))) whenever(wifiPickerTrackerFactory.create(any(), capture(callbackCaptor), any())) .thenReturn(wifiPickerTracker) } Loading