[Settings] BT and WiFi reset menu might covers VPN

VPN would be reset by BT and WiFi reset menu under device without a SIM
available.

Bug: 260034791
Test: local and auto
Change-Id: I3c66cd629977cc11172758ebbe314167b5220419
This commit is contained in:
Bonian Chen
2022-12-07 12:32:57 +00:00
parent f17d3c4697
commit 7b06d5f0e1
2 changed files with 81 additions and 11 deletions

View File

@@ -125,7 +125,7 @@ public class BluetoothWiFiResetPreferenceController extends BasePreferenceContro
final AtomicReference<Exception> exceptionDuringReset =
new AtomicReference<Exception>();
try {
resetOperation();
resetOperation().run();
} catch (Exception exception) {
exceptionDuringReset.set(exception);
}
@@ -144,13 +144,28 @@ public class BluetoothWiFiResetPreferenceController extends BasePreferenceContro
}
@VisibleForTesting
protected void resetOperation() throws Exception {
new ResetNetworkRequest(
protected Runnable resetOperation() throws Exception {
if (SubscriptionUtil.isSimHardwareVisible(mContext)) {
return new ResetNetworkRequest(
ResetNetworkRequest.RESET_WIFI_MANAGER |
ResetNetworkRequest.RESET_WIFI_P2P_MANAGER |
ResetNetworkRequest.RESET_BLUETOOTH_MANAGER)
.toResetNetworkOperationBuilder(mContext, Looper.getMainLooper())
.build();
}
/**
* For device without SIMs visible to the user
*/
return new ResetNetworkRequest(
ResetNetworkRequest.RESET_CONNECTIVITY_MANAGER |
ResetNetworkRequest.RESET_VPN_MANAGER |
ResetNetworkRequest.RESET_WIFI_MANAGER |
ResetNetworkRequest.RESET_WIFI_P2P_MANAGER |
ResetNetworkRequest.RESET_BLUETOOTH_MANAGER
).toResetNetworkOperationBuilder(mContext, Looper.getMainLooper())
.build().run();
ResetNetworkRequest.RESET_BLUETOOTH_MANAGER)
.toResetNetworkOperationBuilder(mContext, Looper.getMainLooper())
.resetTelephonyAndNetworkPolicyManager(ResetNetworkRequest.ALL_SUBSCRIPTION_ID)
.build();
}
@VisibleForTesting