Snap for 7122685 from 3717d5feda to sc-v2-release
Change-Id: I8f3089cccb4b0b922d795fd6f8d347fd943dd84c
This commit is contained in:
@@ -42,7 +42,7 @@
|
|||||||
<PreferenceCategory
|
<PreferenceCategory
|
||||||
android:key="storage_category"
|
android:key="storage_category"
|
||||||
android:title="@string/app_info_storage_title"
|
android:title="@string/app_info_storage_title"
|
||||||
settings:allowDividerBelow="false">
|
settings:allowDividerAbove="true">
|
||||||
|
|
||||||
<Preference
|
<Preference
|
||||||
android:key="app_size"
|
android:key="app_size"
|
||||||
|
|||||||
@@ -31,7 +31,8 @@
|
|||||||
android:order="-9999"/>
|
android:order="-9999"/>
|
||||||
|
|
||||||
<PreferenceCategory
|
<PreferenceCategory
|
||||||
android:title="@string/battery_detail_manage_title">
|
android:title="@string/battery_detail_manage_title"
|
||||||
|
settings:allowDividerAbove="true">
|
||||||
|
|
||||||
<com.android.settingslib.RestrictedPreference
|
<com.android.settingslib.RestrictedPreference
|
||||||
android:key="background_activity"
|
android:key="background_activity"
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ import android.widget.TextView;
|
|||||||
|
|
||||||
import androidx.appcompat.app.AlertDialog;
|
import androidx.appcompat.app.AlertDialog;
|
||||||
|
|
||||||
|
import com.android.net.module.util.ProxyUtils;
|
||||||
import com.android.settings.SettingsPreferenceFragment.SettingsDialogFragment;
|
import com.android.settings.SettingsPreferenceFragment.SettingsDialogFragment;
|
||||||
import com.android.settings.core.InstrumentedFragment;
|
import com.android.settings.core.InstrumentedFragment;
|
||||||
|
|
||||||
@@ -151,7 +152,7 @@ public class ProxySelector extends InstrumentedFragment implements DialogCreatab
|
|||||||
if (proxy != null) {
|
if (proxy != null) {
|
||||||
hostname = proxy.getHost();
|
hostname = proxy.getHost();
|
||||||
port = proxy.getPort();
|
port = proxy.getPort();
|
||||||
exclList = proxy.getExclusionListAsString();
|
exclList = ProxyUtils.exclusionListAsString(proxy.getExclusionList());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hostname == null) {
|
if (hostname == null) {
|
||||||
|
|||||||
@@ -96,7 +96,7 @@ public class DataDuringCallsPreferenceController extends TelephonyTogglePreferen
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean setChecked(boolean isChecked) {
|
public boolean setChecked(boolean isChecked) {
|
||||||
mManager.setMobileDataPolicyEnabledStatus(
|
mManager.setMobileDataPolicyEnabled(
|
||||||
TelephonyManager.MOBILE_DATA_POLICY_DATA_ON_NON_DEFAULT_DURING_VOICE_CALL,
|
TelephonyManager.MOBILE_DATA_POLICY_DATA_ON_NON_DEFAULT_DURING_VOICE_CALL,
|
||||||
isChecked);
|
isChecked);
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ public class MmsMessagePreferenceController extends TelephonyTogglePreferenceCon
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean setChecked(boolean isChecked) {
|
public boolean setChecked(boolean isChecked) {
|
||||||
mTelephonyManager.setMobileDataPolicyEnabledStatus(
|
mTelephonyManager.setMobileDataPolicyEnabled(
|
||||||
TelephonyManager.MOBILE_DATA_POLICY_MMS_ALWAYS_ALLOWED, isChecked);
|
TelephonyManager.MOBILE_DATA_POLICY_MMS_ALWAYS_ALLOWED, isChecked);
|
||||||
return isChecked == mTelephonyManager.isMobileDataPolicyEnabled(
|
return isChecked == mTelephonyManager.isMobileDataPolicyEnabled(
|
||||||
TelephonyManager.MOBILE_DATA_POLICY_MMS_ALWAYS_ALLOWED);
|
TelephonyManager.MOBILE_DATA_POLICY_MMS_ALWAYS_ALLOWED);
|
||||||
|
|||||||
@@ -67,6 +67,7 @@ import android.widget.TextView;
|
|||||||
|
|
||||||
import androidx.annotation.VisibleForTesting;
|
import androidx.annotation.VisibleForTesting;
|
||||||
|
|
||||||
|
import com.android.net.module.util.ProxyUtils;
|
||||||
import com.android.settings.ProxySelector;
|
import com.android.settings.ProxySelector;
|
||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
import com.android.settings.network.SubscriptionUtil;
|
import com.android.settings.network.SubscriptionUtil;
|
||||||
@@ -1408,7 +1409,8 @@ public class WifiConfigController implements TextWatcher,
|
|||||||
if (proxyProperties != null) {
|
if (proxyProperties != null) {
|
||||||
mProxyHostView.setText(proxyProperties.getHost());
|
mProxyHostView.setText(proxyProperties.getHost());
|
||||||
mProxyPortView.setText(Integer.toString(proxyProperties.getPort()));
|
mProxyPortView.setText(Integer.toString(proxyProperties.getPort()));
|
||||||
mProxyExclusionListView.setText(proxyProperties.getExclusionListAsString());
|
mProxyExclusionListView.setText(
|
||||||
|
ProxyUtils.exclusionListAsString(proxyProperties.getExclusionList()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (mProxySettingsSpinner.getSelectedItemPosition() == PROXY_PAC) {
|
} else if (mProxySettingsSpinner.getSelectedItemPosition() == PROXY_PAC) {
|
||||||
|
|||||||
@@ -65,6 +65,7 @@ import android.widget.TextView;
|
|||||||
|
|
||||||
import androidx.annotation.VisibleForTesting;
|
import androidx.annotation.VisibleForTesting;
|
||||||
|
|
||||||
|
import com.android.net.module.util.ProxyUtils;
|
||||||
import com.android.settings.ProxySelector;
|
import com.android.settings.ProxySelector;
|
||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
import com.android.settings.network.SubscriptionUtil;
|
import com.android.settings.network.SubscriptionUtil;
|
||||||
@@ -1372,7 +1373,8 @@ public class WifiConfigController2 implements TextWatcher,
|
|||||||
if (proxyProperties != null) {
|
if (proxyProperties != null) {
|
||||||
mProxyHostView.setText(proxyProperties.getHost());
|
mProxyHostView.setText(proxyProperties.getHost());
|
||||||
mProxyPortView.setText(Integer.toString(proxyProperties.getPort()));
|
mProxyPortView.setText(Integer.toString(proxyProperties.getPort()));
|
||||||
mProxyExclusionListView.setText(proxyProperties.getExclusionListAsString());
|
mProxyExclusionListView.setText(
|
||||||
|
ProxyUtils.exclusionListAsString(proxyProperties.getExclusionList()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (mProxySettingsSpinner.getSelectedItemPosition() == PROXY_PAC) {
|
} else if (mProxySettingsSpinner.getSelectedItemPosition() == PROXY_PAC) {
|
||||||
|
|||||||
@@ -111,11 +111,11 @@ public class MmsMessagePreferenceControllerTest {
|
|||||||
@Test
|
@Test
|
||||||
public void setChecked_setDataIntoSubscriptionManager() {
|
public void setChecked_setDataIntoSubscriptionManager() {
|
||||||
mController.setChecked(true);
|
mController.setChecked(true);
|
||||||
verify(mTelephonyManager).setMobileDataPolicyEnabledStatus(
|
verify(mTelephonyManager).setMobileDataPolicyEnabled(
|
||||||
TelephonyManager.MOBILE_DATA_POLICY_MMS_ALWAYS_ALLOWED, true);
|
TelephonyManager.MOBILE_DATA_POLICY_MMS_ALWAYS_ALLOWED, true);
|
||||||
|
|
||||||
mController.setChecked(false);
|
mController.setChecked(false);
|
||||||
verify(mTelephonyManager).setMobileDataPolicyEnabledStatus(
|
verify(mTelephonyManager).setMobileDataPolicyEnabled(
|
||||||
TelephonyManager.MOBILE_DATA_POLICY_MMS_ALWAYS_ALLOWED, false);
|
TelephonyManager.MOBILE_DATA_POLICY_MMS_ALWAYS_ALLOWED, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2018 The Android Open Source Project
|
* Copyright (C) 2021 The Android Open Source Project
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -19,8 +19,6 @@ package com.android.settings.network.telephony;
|
|||||||
import static com.google.common.truth.Truth.assertThat;
|
import static com.google.common.truth.Truth.assertThat;
|
||||||
|
|
||||||
import static org.junit.Assert.assertNull;
|
import static org.junit.Assert.assertNull;
|
||||||
import static org.mockito.ArgumentMatchers.anyInt;
|
|
||||||
import static org.mockito.Mockito.doReturn;
|
|
||||||
import static org.mockito.Mockito.spy;
|
import static org.mockito.Mockito.spy;
|
||||||
import static org.mockito.Mockito.when;
|
import static org.mockito.Mockito.when;
|
||||||
|
|
||||||
@@ -35,11 +33,16 @@ import android.telephony.TelephonyManager;
|
|||||||
import android.telephony.ims.ImsMmTelManager;
|
import android.telephony.ims.ImsMmTelManager;
|
||||||
|
|
||||||
import androidx.preference.Preference;
|
import androidx.preference.Preference;
|
||||||
|
import androidx.preference.PreferenceManager;
|
||||||
import androidx.preference.PreferenceScreen;
|
import androidx.preference.PreferenceScreen;
|
||||||
|
import androidx.test.annotation.UiThreadTest;
|
||||||
|
import androidx.test.core.app.ApplicationProvider;
|
||||||
|
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||||
|
|
||||||
import com.android.internal.R;
|
import com.android.internal.R;
|
||||||
import com.android.settings.core.BasePreferenceController;
|
import com.android.settings.core.BasePreferenceController;
|
||||||
import com.android.settings.network.ims.MockWifiCallingQueryImsState;
|
import com.android.settings.network.ims.MockWifiCallingQueryImsState;
|
||||||
|
import com.android.settings.network.ims.WifiCallingQueryImsState;
|
||||||
|
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Ignore;
|
import org.junit.Ignore;
|
||||||
@@ -47,62 +50,57 @@ import org.junit.Test;
|
|||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
import org.mockito.Mock;
|
import org.mockito.Mock;
|
||||||
import org.mockito.MockitoAnnotations;
|
import org.mockito.MockitoAnnotations;
|
||||||
import org.robolectric.RobolectricTestRunner;
|
|
||||||
import org.robolectric.RuntimeEnvironment;
|
|
||||||
|
|
||||||
@RunWith(RobolectricTestRunner.class)
|
@RunWith(AndroidJUnit4.class)
|
||||||
public class WifiCallingPreferenceControllerTest {
|
public class WifiCallingPreferenceControllerTest {
|
||||||
private static final int SUB_ID = 2;
|
private static final int SUB_ID = 2;
|
||||||
|
@Mock
|
||||||
|
private SubscriptionManager mSubscriptionManager;
|
||||||
@Mock
|
@Mock
|
||||||
private CarrierConfigManager mCarrierConfigManager;
|
private CarrierConfigManager mCarrierConfigManager;
|
||||||
@Mock
|
@Mock
|
||||||
private TelephonyManager mTelephonyManager;
|
private TelephonyManager mTelephonyManager;
|
||||||
@Mock
|
@Mock
|
||||||
private ImsMmTelManager mImsMmTelManager;
|
private ImsMmTelManager mImsMmTelManager;
|
||||||
@Mock
|
|
||||||
private PreferenceScreen mPreferenceScreen;
|
private PreferenceScreen mScreen;
|
||||||
|
private PreferenceManager mPreferenceManager;
|
||||||
|
|
||||||
private MockWifiCallingQueryImsState mQueryImsState;
|
private MockWifiCallingQueryImsState mQueryImsState;
|
||||||
|
|
||||||
private WifiCallingPreferenceController mController;
|
private TestWifiCallingPreferenceController mController;
|
||||||
private Preference mPreference;
|
private Preference mPreference;
|
||||||
private Context mContext;
|
private Context mContext;
|
||||||
private PersistableBundle mCarrierConfig;
|
private PersistableBundle mCarrierConfig;
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
|
@UiThreadTest
|
||||||
public void setUp() {
|
public void setUp() {
|
||||||
MockitoAnnotations.initMocks(this);
|
MockitoAnnotations.initMocks(this);
|
||||||
|
|
||||||
mContext = spy(RuntimeEnvironment.application);
|
mContext = spy(ApplicationProvider.getApplicationContext());
|
||||||
|
when(mContext.getSystemService(SubscriptionManager.class)).thenReturn(mSubscriptionManager);
|
||||||
|
|
||||||
mQueryImsState = new MockWifiCallingQueryImsState(mContext, SUB_ID);
|
mQueryImsState = new MockWifiCallingQueryImsState(mContext, SUB_ID);
|
||||||
mQueryImsState.setIsEnabledByUser(true);
|
mQueryImsState.setIsEnabledByUser(true);
|
||||||
mQueryImsState.setIsProvisionedOnDevice(true);
|
mQueryImsState.setIsProvisionedOnDevice(true);
|
||||||
|
|
||||||
mPreference = new Preference(mContext);
|
mController = new TestWifiCallingPreferenceController(mContext, "wifi_calling");
|
||||||
mController = spy(new WifiCallingPreferenceController(mContext, "wifi_calling") {
|
|
||||||
@Override
|
|
||||||
protected ImsMmTelManager getImsMmTelManager(int subId) {
|
|
||||||
return mImsMmTelManager;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
mController.mCarrierConfigManager = mCarrierConfigManager;
|
mController.mCarrierConfigManager = mCarrierConfigManager;
|
||||||
mController.init(SUB_ID);
|
mController.init(SUB_ID);
|
||||||
mController.mCallState = TelephonyManager.CALL_STATE_IDLE;
|
mController.mCallState = TelephonyManager.CALL_STATE_IDLE;
|
||||||
doReturn(mQueryImsState).when(mController).queryImsState(anyInt());
|
|
||||||
mPreference.setKey(mController.getPreferenceKey());
|
|
||||||
|
|
||||||
when(mController.getTelephonyManager(mContext, SUB_ID)).thenReturn(mTelephonyManager);
|
|
||||||
|
|
||||||
mCarrierConfig = new PersistableBundle();
|
mCarrierConfig = new PersistableBundle();
|
||||||
when(mCarrierConfigManager.getConfigForSubId(SUB_ID)).thenReturn(mCarrierConfig);
|
when(mCarrierConfigManager.getConfigForSubId(SUB_ID)).thenReturn(mCarrierConfig);
|
||||||
|
|
||||||
when(mPreferenceScreen.findPreference(mController.getPreferenceKey())).thenReturn(
|
mPreferenceManager = new PreferenceManager(mContext);
|
||||||
mPreference);
|
mScreen = mPreferenceManager.createPreferenceScreen(mContext);
|
||||||
|
mPreference = new Preference(mContext);
|
||||||
|
mPreference.setKey(mController.getPreferenceKey());
|
||||||
|
mScreen.addPreference(mPreference);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@UiThreadTest
|
||||||
public void updateState_noSimCallManager_setCorrectSummary() {
|
public void updateState_noSimCallManager_setCorrectSummary() {
|
||||||
mController.mSimCallManager = null;
|
mController.mSimCallManager = null;
|
||||||
mQueryImsState.setIsEnabledByUser(true);
|
mQueryImsState.setIsEnabledByUser(true);
|
||||||
@@ -118,6 +116,7 @@ public class WifiCallingPreferenceControllerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@UiThreadTest
|
||||||
public void updateState_notCallIdle_disable() {
|
public void updateState_notCallIdle_disable() {
|
||||||
mController.mCallState = TelephonyManager.CALL_STATE_RINGING;
|
mController.mCallState = TelephonyManager.CALL_STATE_RINGING;
|
||||||
|
|
||||||
@@ -127,6 +126,7 @@ public class WifiCallingPreferenceControllerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@UiThreadTest
|
||||||
public void updateState_invalidPhoneAccountHandle_shouldNotCrash() {
|
public void updateState_invalidPhoneAccountHandle_shouldNotCrash() {
|
||||||
mController.mSimCallManager = new PhoneAccountHandle(null /* invalid */, "");
|
mController.mSimCallManager = new PhoneAccountHandle(null /* invalid */, "");
|
||||||
|
|
||||||
@@ -135,6 +135,7 @@ public class WifiCallingPreferenceControllerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@UiThreadTest
|
||||||
public void updateState_wfcNonRoamingByConfig() {
|
public void updateState_wfcNonRoamingByConfig() {
|
||||||
assertNull(mController.mSimCallManager);
|
assertNull(mController.mSimCallManager);
|
||||||
mCarrierConfig.putBoolean(
|
mCarrierConfig.putBoolean(
|
||||||
@@ -154,6 +155,7 @@ public class WifiCallingPreferenceControllerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@UiThreadTest
|
||||||
public void updateState_wfcRoamingByConfig() {
|
public void updateState_wfcRoamingByConfig() {
|
||||||
assertNull(mController.mSimCallManager);
|
assertNull(mController.mSimCallManager);
|
||||||
// useWfcHomeModeForRoaming is false by default. In order to check wfc in roaming mode. We
|
// useWfcHomeModeForRoaming is false by default. In order to check wfc in roaming mode. We
|
||||||
@@ -171,12 +173,15 @@ public class WifiCallingPreferenceControllerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@UiThreadTest
|
||||||
public void displayPreference_notAvailable_setPreferenceInvisible() {
|
public void displayPreference_notAvailable_setPreferenceInvisible() {
|
||||||
mController.init(SubscriptionManager.INVALID_SUBSCRIPTION_ID);
|
mController.init(SubscriptionManager.INVALID_SUBSCRIPTION_ID);
|
||||||
|
when(mSubscriptionManager.getActiveSubscriptionInfoList()).thenReturn(null);
|
||||||
|
|
||||||
mController.displayPreference(mPreferenceScreen);
|
mController.displayPreference(mScreen);
|
||||||
|
|
||||||
assertThat(mPreferenceScreen.isVisible()).isFalse();
|
assertThat(mController.getPreferenceKey()).isEqualTo("wifi_calling");
|
||||||
|
assertThat(mScreen.findPreference(mController.getPreferenceKey()).isVisible()).isFalse();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -184,16 +189,39 @@ public class WifiCallingPreferenceControllerTest {
|
|||||||
public void displayPreference_available_setsSubscriptionIdOnIntent() {
|
public void displayPreference_available_setsSubscriptionIdOnIntent() {
|
||||||
final Intent intent = new Intent();
|
final Intent intent = new Intent();
|
||||||
mPreference.setIntent(intent);
|
mPreference.setIntent(intent);
|
||||||
mController.displayPreference(mPreferenceScreen);
|
mController.displayPreference(mScreen);
|
||||||
assertThat(intent.getIntExtra(Settings.EXTRA_SUB_ID,
|
assertThat(intent.getIntExtra(Settings.EXTRA_SUB_ID,
|
||||||
SubscriptionManager.INVALID_SUBSCRIPTION_ID)).isEqualTo(SUB_ID);
|
SubscriptionManager.INVALID_SUBSCRIPTION_ID)).isEqualTo(SUB_ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@UiThreadTest
|
||||||
public void getAvailabilityStatus_noWiFiCalling_shouldReturnUnsupported() {
|
public void getAvailabilityStatus_noWiFiCalling_shouldReturnUnsupported() {
|
||||||
mController.init(SubscriptionManager.INVALID_SUBSCRIPTION_ID);
|
mController.init(SubscriptionManager.INVALID_SUBSCRIPTION_ID);
|
||||||
|
when(mSubscriptionManager.getActiveSubscriptionInfoList()).thenReturn(null);
|
||||||
|
|
||||||
assertThat(mController.getAvailabilityStatus()).isEqualTo(
|
assertThat(mController.getAvailabilityStatus()).isEqualTo(
|
||||||
BasePreferenceController.UNSUPPORTED_ON_DEVICE);
|
BasePreferenceController.UNSUPPORTED_ON_DEVICE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private class TestWifiCallingPreferenceController extends WifiCallingPreferenceController {
|
||||||
|
TestWifiCallingPreferenceController(Context context, String preferenceKey) {
|
||||||
|
super(context, preferenceKey);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected ImsMmTelManager getImsMmTelManager(int subId) {
|
||||||
|
return mImsMmTelManager;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected TelephonyManager getTelephonyManager(Context context, int subId) {
|
||||||
|
return mTelephonyManager;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected WifiCallingQueryImsState queryImsState(int subId) {
|
||||||
|
return mQueryImsState;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user