Convert dataDuringCall to autoDataSWitch

The feature is enabled via
TelephonyManager.MOBILE_DATA_POLICY_AUTO_DATA_SWITCH. The feature only
applies to non-DDS. If enabled, we automatically switch to the non-DDS for data traffic when it has better availability than the DDS.

The UI change are(as required by b/247880971):
1. data during call is replaced by auto data switch, and moved under
   mobile data toggle.
2. Network & internet and Internet page now show the currently active
   subscription, instead of the defalut subscription. If the currently
   active sub is not the default, it's reflected in summary as
   "temporarily".

Test: manual
Bug: 244064524
Change-Id: Ica1eba99cee0d4af528d58f1c7bd1439400bfa66
This commit is contained in:
Ling Ma
2022-09-15 11:15:47 -07:00
parent 981458c8ac
commit 4e7f783906
9 changed files with 106 additions and 32 deletions

View File

@@ -2,7 +2,7 @@ com.android.settings.accessibility.AccessibilitySlicePreferenceController
com.android.settings.core.TogglePreferenceControllerTest$FakeToggle
com.android.settings.biometrics.face.FaceSettingsAttentionPreferenceController
com.android.settings.network.telephony.MmsMessagePreferenceController
com.android.settings.network.telephony.DataDuringCallsPreferenceController
com.android.settings.network.telephony.AutoDataSwitchPreferenceController
com.android.settings.network.telephony.Enhanced4gBasePreferenceController
com.android.settings.testutils.FakeToggleController
com.android.settings.testutils.FakeSliderController

View File

@@ -11,7 +11,7 @@
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License
* limitations under the License.
*/
package com.android.settings.network.telephony;
@@ -47,7 +47,7 @@ import org.robolectric.shadows.ShadowSubscriptionManager;
@RunWith(RobolectricTestRunner.class)
@Config(shadows = ShadowSubscriptionManager.class)
public class DataDuringCallsPreferenceControllerTest {
public class AutoDataSwitchPreferenceControllerTest {
private static final String PREF_KEY = "pref_key";
private static final int SUB_ID_1 = 111;
private static final int SUB_ID_2 = 222;
@@ -59,7 +59,7 @@ public class DataDuringCallsPreferenceControllerTest {
private Context mContext;
private SwitchPreference mSwitchPreference;
private DataDuringCallsPreferenceController mController;
private AutoDataSwitchPreferenceController mController;
@Before
public void setUp() {
@@ -69,9 +69,11 @@ public class DataDuringCallsPreferenceControllerTest {
when(mTelephonyManager.createForSubscriptionId(anyInt())).thenReturn(mTelephonyManager);
mSwitchPreference = new SwitchPreference(mContext);
when(mPreferenceScreen.findPreference(PREF_KEY)).thenReturn(mSwitchPreference);
mController = new DataDuringCallsPreferenceController(mContext, PREF_KEY) {
mController = new AutoDataSwitchPreferenceController(mContext, PREF_KEY) {
@Override
protected boolean hasMobileData() { return true; }
protected boolean hasMobileData() {
return true;
}
};
mController.init(SUB_ID_1);
}
@@ -79,8 +81,8 @@ public class DataDuringCallsPreferenceControllerTest {
@Test
public void getAvailabilityStatus_noInit_notAvailable() {
ShadowSubscriptionManager.setDefaultDataSubscriptionId(SUB_ID_1);
DataDuringCallsPreferenceController controller =
new DataDuringCallsPreferenceController(mContext, PREF_KEY);
AutoDataSwitchPreferenceController controller =
new AutoDataSwitchPreferenceController(mContext, PREF_KEY);
// note that we purposely don't call init first on the controller
assertThat(controller.getAvailabilityStatus(INVALID_SUBSCRIPTION_ID)).isEqualTo(