Merge "Smoother signal bar transition during CBRS data switching" into rvc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
806e50963c
@@ -17,6 +17,7 @@
|
|||||||
package com.android.systemui.statusbar.policy;
|
package com.android.systemui.statusbar.policy;
|
||||||
|
|
||||||
import static android.net.NetworkCapabilities.NET_CAPABILITY_VALIDATED;
|
import static android.net.NetworkCapabilities.NET_CAPABILITY_VALIDATED;
|
||||||
|
import static android.net.NetworkCapabilities.TRANSPORT_CELLULAR;
|
||||||
import static android.net.wifi.WifiManager.TrafficStateCallback.DATA_ACTIVITY_IN;
|
import static android.net.wifi.WifiManager.TrafficStateCallback.DATA_ACTIVITY_IN;
|
||||||
import static android.net.wifi.WifiManager.TrafficStateCallback.DATA_ACTIVITY_INOUT;
|
import static android.net.wifi.WifiManager.TrafficStateCallback.DATA_ACTIVITY_INOUT;
|
||||||
import static android.net.wifi.WifiManager.TrafficStateCallback.DATA_ACTIVITY_NONE;
|
import static android.net.wifi.WifiManager.TrafficStateCallback.DATA_ACTIVITY_NONE;
|
||||||
@@ -157,6 +158,7 @@ public class NetworkControllerImpl extends BroadcastReceiver
|
|||||||
ServiceState mLastServiceState;
|
ServiceState mLastServiceState;
|
||||||
private boolean mUserSetup;
|
private boolean mUserSetup;
|
||||||
private boolean mSimDetected;
|
private boolean mSimDetected;
|
||||||
|
private boolean mForceCellularValidated;
|
||||||
|
|
||||||
private ConfigurationController.ConfigurationListener mConfigurationListener =
|
private ConfigurationController.ConfigurationListener mConfigurationListener =
|
||||||
new ConfigurationController.ConfigurationListener() {
|
new ConfigurationController.ConfigurationListener() {
|
||||||
@@ -284,12 +286,41 @@ public class NetworkControllerImpl extends BroadcastReceiver
|
|||||||
mPhoneStateListener = new PhoneStateListener(mReceiverHandler::post) {
|
mPhoneStateListener = new PhoneStateListener(mReceiverHandler::post) {
|
||||||
@Override
|
@Override
|
||||||
public void onActiveDataSubscriptionIdChanged(int subId) {
|
public void onActiveDataSubscriptionIdChanged(int subId) {
|
||||||
|
// For data switching from A to B, we assume B is validated for up to 2 seconds iff:
|
||||||
|
// 1) A and B are in the same subscription group e.g. CBRS data switch. And
|
||||||
|
// 2) A was validated before the switch.
|
||||||
|
// This is to provide smooth transition for UI without showing cross during data
|
||||||
|
// switch.
|
||||||
|
if (keepCellularValidationBitInSwitch(mActiveMobileDataSubscription, subId)) {
|
||||||
|
if (DEBUG) Log.d(TAG, ": mForceCellularValidated to true.");
|
||||||
|
mForceCellularValidated = true;
|
||||||
|
mReceiverHandler.removeCallbacks(mClearForceValidated);
|
||||||
|
mReceiverHandler.postDelayed(mClearForceValidated, 2000);
|
||||||
|
}
|
||||||
mActiveMobileDataSubscription = subId;
|
mActiveMobileDataSubscription = subId;
|
||||||
doUpdateMobileControllers();
|
doUpdateMobileControllers();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private final Runnable mClearForceValidated = () -> {
|
||||||
|
if (DEBUG) Log.d(TAG, ": mClearForceValidated");
|
||||||
|
mForceCellularValidated = false;
|
||||||
|
updateConnectivity();
|
||||||
|
};
|
||||||
|
|
||||||
|
boolean isInGroupDataSwitch(int subId1, int subId2) {
|
||||||
|
SubscriptionInfo info1 = mSubscriptionManager.getActiveSubscriptionInfo(subId1);
|
||||||
|
SubscriptionInfo info2 = mSubscriptionManager.getActiveSubscriptionInfo(subId2);
|
||||||
|
return (info1 != null && info2 != null && info1.getGroupUuid() != null
|
||||||
|
&& info1.getGroupUuid().equals(info2.getGroupUuid()));
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean keepCellularValidationBitInSwitch(int sourceSubId, int destSubId) {
|
||||||
|
return mValidatedTransports.get(TRANSPORT_CELLULAR)
|
||||||
|
&& isInGroupDataSwitch(sourceSubId, destSubId);
|
||||||
|
}
|
||||||
|
|
||||||
public DataSaverController getDataSaverController() {
|
public DataSaverController getDataSaverController() {
|
||||||
return mDataSaverController;
|
return mDataSaverController;
|
||||||
}
|
}
|
||||||
@@ -793,6 +824,8 @@ public class NetworkControllerImpl extends BroadcastReceiver
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (mForceCellularValidated) mValidatedTransports.set(TRANSPORT_CELLULAR);
|
||||||
|
|
||||||
if (CHATTY) {
|
if (CHATTY) {
|
||||||
Log.d(TAG, "updateConnectivity: mConnectedTransports=" + mConnectedTransports);
|
Log.d(TAG, "updateConnectivity: mConnectedTransports=" + mConnectedTransports);
|
||||||
Log.d(TAG, "updateConnectivity: mValidatedTransports=" + mValidatedTransports);
|
Log.d(TAG, "updateConnectivity: mValidatedTransports=" + mValidatedTransports);
|
||||||
|
|||||||
Reference in New Issue
Block a user