Loading packages/SettingsLib/src/com/android/settingslib/wifi/WifiStatusTracker.java +29 −0 Original line number Original line Diff line number Diff line Loading @@ -133,6 +133,35 @@ public class WifiStatusTracker { } } } } /** * Fetches initial state as if a WifiManager.NETWORK_STATE_CHANGED_ACTION have been received. * This replaces the dependency on the initial sticky broadcast. */ public void fetchInitialState() { if (mWifiManager == null) { return; } updateWifiState(); final NetworkInfo networkInfo = mConnectivityManager.getNetworkInfo(ConnectivityManager.TYPE_WIFI); connected = networkInfo != null && networkInfo.isConnected(); mWifiInfo = null; ssid = null; if (connected) { mWifiInfo = mWifiManager.getConnectionInfo(); if (mWifiInfo != null) { if (mWifiInfo.isPasspointAp() || mWifiInfo.isOsuAp()) { ssid = mWifiInfo.getPasspointProviderFriendlyName(); } else { ssid = getValidSsid(mWifiInfo); } updateRssi(mWifiInfo.getRssi()); maybeRequestNetworkScore(); } } updateStatusLabel(); } public void handleBroadcast(Intent intent) { public void handleBroadcast(Intent intent) { if (mWifiManager == null) { if (mWifiManager == null) { return; return; Loading packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java +16 −3 Original line number Original line Diff line number Diff line Loading @@ -1301,6 +1301,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab private FingerprintManager mFpm; private FingerprintManager mFpm; private FaceManager mFaceManager; private FaceManager mFaceManager; private boolean mFingerprintLockedOut; private boolean mFingerprintLockedOut; private TelephonyManager mTelephonyManager; /** /** * When we receive a * When we receive a Loading Loading @@ -1728,10 +1729,22 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab } } updateAirplaneModeState(); updateAirplaneModeState(); TelephonyManager telephony = mTelephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); if (telephony != null) { if (mTelephonyManager != null) { telephony.listen(mPhoneStateListener, LISTEN_ACTIVE_DATA_SUBSCRIPTION_ID_CHANGE); mTelephonyManager.listen(mPhoneStateListener, LISTEN_ACTIVE_DATA_SUBSCRIPTION_ID_CHANGE); // Set initial sim states values. for (int slot = 0; slot < mTelephonyManager.getActiveModemCount(); slot++) { int state = mTelephonyManager.getSimState(slot); int[] subIds = mSubscriptionManager.getSubscriptionIds(slot); if (subIds != null) { for (int subId : subIds) { mHandler.obtainMessage(MSG_SIM_STATE_CHANGE, subId, slot, state) .sendToTarget(); } } } } } } } Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java +3 −1 Original line number Original line Diff line number Diff line Loading @@ -85,6 +85,8 @@ import com.android.systemui.statusbar.policy.PreviewInflater; import com.android.systemui.tuner.LockscreenFragment.LockButtonFactory; import com.android.systemui.tuner.LockscreenFragment.LockButtonFactory; import com.android.systemui.tuner.TunerService; import com.android.systemui.tuner.TunerService; import java.util.concurrent.Executor; /** /** * Implementation for the bottom area of the Keyguard, including camera/phone affordance and status * Implementation for the bottom area of the Keyguard, including camera/phone affordance and status * text. * text. Loading Loading @@ -553,7 +555,7 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL } } }; }; if (!mKeyguardStateController.canDismissLockScreen()) { if (!mKeyguardStateController.canDismissLockScreen()) { AsyncTask.execute(runnable); Dependency.get(Executor.class).execute(runnable); } else { } else { boolean dismissShade = !TextUtils.isEmpty(mRightButtonStr) boolean dismissShade = !TextUtils.isEmpty(mRightButtonStr) && Dependency.get(TunerService.class).getValue(LOCKSCREEN_RIGHT_UNLOCK, 1) != 0; && Dependency.get(TunerService.class).getValue(LOCKSCREEN_RIGHT_UNLOCK, 1) != 0; Loading packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java +11 −0 Original line number Original line Diff line number Diff line Loading @@ -357,7 +357,18 @@ public class NetworkControllerImpl extends BroadcastReceiver mBroadcastDispatcher.registerReceiverWithHandler(this, filter, mReceiverHandler); mBroadcastDispatcher.registerReceiverWithHandler(this, filter, mReceiverHandler); mListening = true; mListening = true; // Initial setup of connectivity. Handled as if we had received a sticky broadcast of // ConnectivityManager.CONNECTIVITY_ACTION or ConnectivityManager.INET_CONDITION_ACTION. mReceiverHandler.post(this::updateConnectivity); // Initial setup of WifiSignalController. Handled as if we had received a sticky broadcast // of WifiManager.WIFI_STATE_CHANGED_ACTION or WifiManager.NETWORK_STATE_CHANGED_ACTION mReceiverHandler.post(mWifiSignalController::fetchInitialState); updateMobileControllers(); updateMobileControllers(); // Initial setup of emergency information. Handled as if we had received a sticky broadcast // of TelephonyManager.ACTION_DEFAULT_VOICE_SUBSCRIPTION_CHANGED. mReceiverHandler.post(this::recalculateEmergency); } } private void unregisterListeners() { private void unregisterListeners() { Loading packages/SystemUI/src/com/android/systemui/statusbar/policy/WifiSignalController.java +14 −0 Original line number Original line Diff line number Diff line Loading @@ -101,6 +101,20 @@ public class WifiSignalController extends wifiDesc, mCurrentState.isTransient, mCurrentState.statusLabel); wifiDesc, mCurrentState.isTransient, mCurrentState.statusLabel); } } /** * Fetches wifi initial state replacing the initial sticky broadcast. */ public void fetchInitialState() { mWifiTracker.fetchInitialState(); mCurrentState.enabled = mWifiTracker.enabled; mCurrentState.connected = mWifiTracker.connected; mCurrentState.ssid = mWifiTracker.ssid; mCurrentState.rssi = mWifiTracker.rssi; mCurrentState.level = mWifiTracker.level; mCurrentState.statusLabel = mWifiTracker.statusLabel; notifyListenersIfNecessary(); } /** /** * Extract wifi state directly from broadcasts about changes in wifi state. * Extract wifi state directly from broadcasts about changes in wifi state. */ */ Loading Loading
packages/SettingsLib/src/com/android/settingslib/wifi/WifiStatusTracker.java +29 −0 Original line number Original line Diff line number Diff line Loading @@ -133,6 +133,35 @@ public class WifiStatusTracker { } } } } /** * Fetches initial state as if a WifiManager.NETWORK_STATE_CHANGED_ACTION have been received. * This replaces the dependency on the initial sticky broadcast. */ public void fetchInitialState() { if (mWifiManager == null) { return; } updateWifiState(); final NetworkInfo networkInfo = mConnectivityManager.getNetworkInfo(ConnectivityManager.TYPE_WIFI); connected = networkInfo != null && networkInfo.isConnected(); mWifiInfo = null; ssid = null; if (connected) { mWifiInfo = mWifiManager.getConnectionInfo(); if (mWifiInfo != null) { if (mWifiInfo.isPasspointAp() || mWifiInfo.isOsuAp()) { ssid = mWifiInfo.getPasspointProviderFriendlyName(); } else { ssid = getValidSsid(mWifiInfo); } updateRssi(mWifiInfo.getRssi()); maybeRequestNetworkScore(); } } updateStatusLabel(); } public void handleBroadcast(Intent intent) { public void handleBroadcast(Intent intent) { if (mWifiManager == null) { if (mWifiManager == null) { return; return; Loading
packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java +16 −3 Original line number Original line Diff line number Diff line Loading @@ -1301,6 +1301,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab private FingerprintManager mFpm; private FingerprintManager mFpm; private FaceManager mFaceManager; private FaceManager mFaceManager; private boolean mFingerprintLockedOut; private boolean mFingerprintLockedOut; private TelephonyManager mTelephonyManager; /** /** * When we receive a * When we receive a Loading Loading @@ -1728,10 +1729,22 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab } } updateAirplaneModeState(); updateAirplaneModeState(); TelephonyManager telephony = mTelephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); if (telephony != null) { if (mTelephonyManager != null) { telephony.listen(mPhoneStateListener, LISTEN_ACTIVE_DATA_SUBSCRIPTION_ID_CHANGE); mTelephonyManager.listen(mPhoneStateListener, LISTEN_ACTIVE_DATA_SUBSCRIPTION_ID_CHANGE); // Set initial sim states values. for (int slot = 0; slot < mTelephonyManager.getActiveModemCount(); slot++) { int state = mTelephonyManager.getSimState(slot); int[] subIds = mSubscriptionManager.getSubscriptionIds(slot); if (subIds != null) { for (int subId : subIds) { mHandler.obtainMessage(MSG_SIM_STATE_CHANGE, subId, slot, state) .sendToTarget(); } } } } } } } Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java +3 −1 Original line number Original line Diff line number Diff line Loading @@ -85,6 +85,8 @@ import com.android.systemui.statusbar.policy.PreviewInflater; import com.android.systemui.tuner.LockscreenFragment.LockButtonFactory; import com.android.systemui.tuner.LockscreenFragment.LockButtonFactory; import com.android.systemui.tuner.TunerService; import com.android.systemui.tuner.TunerService; import java.util.concurrent.Executor; /** /** * Implementation for the bottom area of the Keyguard, including camera/phone affordance and status * Implementation for the bottom area of the Keyguard, including camera/phone affordance and status * text. * text. Loading Loading @@ -553,7 +555,7 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL } } }; }; if (!mKeyguardStateController.canDismissLockScreen()) { if (!mKeyguardStateController.canDismissLockScreen()) { AsyncTask.execute(runnable); Dependency.get(Executor.class).execute(runnable); } else { } else { boolean dismissShade = !TextUtils.isEmpty(mRightButtonStr) boolean dismissShade = !TextUtils.isEmpty(mRightButtonStr) && Dependency.get(TunerService.class).getValue(LOCKSCREEN_RIGHT_UNLOCK, 1) != 0; && Dependency.get(TunerService.class).getValue(LOCKSCREEN_RIGHT_UNLOCK, 1) != 0; Loading
packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java +11 −0 Original line number Original line Diff line number Diff line Loading @@ -357,7 +357,18 @@ public class NetworkControllerImpl extends BroadcastReceiver mBroadcastDispatcher.registerReceiverWithHandler(this, filter, mReceiverHandler); mBroadcastDispatcher.registerReceiverWithHandler(this, filter, mReceiverHandler); mListening = true; mListening = true; // Initial setup of connectivity. Handled as if we had received a sticky broadcast of // ConnectivityManager.CONNECTIVITY_ACTION or ConnectivityManager.INET_CONDITION_ACTION. mReceiverHandler.post(this::updateConnectivity); // Initial setup of WifiSignalController. Handled as if we had received a sticky broadcast // of WifiManager.WIFI_STATE_CHANGED_ACTION or WifiManager.NETWORK_STATE_CHANGED_ACTION mReceiverHandler.post(mWifiSignalController::fetchInitialState); updateMobileControllers(); updateMobileControllers(); // Initial setup of emergency information. Handled as if we had received a sticky broadcast // of TelephonyManager.ACTION_DEFAULT_VOICE_SUBSCRIPTION_CHANGED. mReceiverHandler.post(this::recalculateEmergency); } } private void unregisterListeners() { private void unregisterListeners() { Loading
packages/SystemUI/src/com/android/systemui/statusbar/policy/WifiSignalController.java +14 −0 Original line number Original line Diff line number Diff line Loading @@ -101,6 +101,20 @@ public class WifiSignalController extends wifiDesc, mCurrentState.isTransient, mCurrentState.statusLabel); wifiDesc, mCurrentState.isTransient, mCurrentState.statusLabel); } } /** * Fetches wifi initial state replacing the initial sticky broadcast. */ public void fetchInitialState() { mWifiTracker.fetchInitialState(); mCurrentState.enabled = mWifiTracker.enabled; mCurrentState.connected = mWifiTracker.connected; mCurrentState.ssid = mWifiTracker.ssid; mCurrentState.rssi = mWifiTracker.rssi; mCurrentState.level = mWifiTracker.level; mCurrentState.statusLabel = mWifiTracker.statusLabel; notifyListenersIfNecessary(); } /** /** * Extract wifi state directly from broadcasts about changes in wifi state. * Extract wifi state directly from broadcasts about changes in wifi state. */ */ Loading