Merge "Update WifiCallingSettingsForSub to inherit DashboardFragment. Controller logic will be refactored later" into main
This commit is contained in:
committed by
Android (Google) Code Review
commit
d324df3997
@@ -54,9 +54,9 @@ import com.android.internal.telephony.Phone;
|
|||||||
import com.android.internal.telephony.flags.Flags;
|
import com.android.internal.telephony.flags.Flags;
|
||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
import com.android.settings.SettingsActivity;
|
import com.android.settings.SettingsActivity;
|
||||||
import com.android.settings.SettingsPreferenceFragment;
|
|
||||||
import com.android.settings.Utils;
|
import com.android.settings.Utils;
|
||||||
import com.android.settings.core.SubSettingLauncher;
|
import com.android.settings.core.SubSettingLauncher;
|
||||||
|
import com.android.settings.dashboard.DashboardFragment;
|
||||||
import com.android.settings.network.ims.WifiCallingQueryImsState;
|
import com.android.settings.network.ims.WifiCallingQueryImsState;
|
||||||
import com.android.settings.network.telephony.wificalling.IWifiCallingRepository;
|
import com.android.settings.network.telephony.wificalling.IWifiCallingRepository;
|
||||||
import com.android.settings.network.telephony.wificalling.WifiCallingRepository;
|
import com.android.settings.network.telephony.wificalling.WifiCallingRepository;
|
||||||
@@ -70,7 +70,7 @@ import java.util.List;
|
|||||||
* This is the inner class of {@link WifiCallingSettings} fragment.
|
* This is the inner class of {@link WifiCallingSettings} fragment.
|
||||||
* The preference screen lets you enable/disable Wi-Fi Calling and change Wi-Fi Calling mode.
|
* The preference screen lets you enable/disable Wi-Fi Calling and change Wi-Fi Calling mode.
|
||||||
*/
|
*/
|
||||||
public class WifiCallingSettingsForSub extends SettingsPreferenceFragment
|
public class WifiCallingSettingsForSub extends DashboardFragment
|
||||||
implements OnCheckedChangeListener,
|
implements OnCheckedChangeListener,
|
||||||
Preference.OnPreferenceChangeListener {
|
Preference.OnPreferenceChangeListener {
|
||||||
private static final String TAG = "WifiCallingForSub";
|
private static final String TAG = "WifiCallingForSub";
|
||||||
@@ -266,8 +266,6 @@ public class WifiCallingSettingsForSub extends SettingsPreferenceFragment
|
|||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
addPreferencesFromResource(R.xml.wifi_calling_settings);
|
|
||||||
|
|
||||||
// SubId should always be specified when creating this fragment. Either through
|
// SubId should always be specified when creating this fragment. Either through
|
||||||
// fragment.setArguments() or through savedInstanceState.
|
// fragment.setArguments() or through savedInstanceState.
|
||||||
if (getArguments() != null && getArguments().containsKey(FRAGMENT_BUNDLE_SUBID)) {
|
if (getArguments() != null && getArguments().containsKey(FRAGMENT_BUNDLE_SUBID)) {
|
||||||
@@ -446,6 +444,11 @@ public class WifiCallingSettingsForSub extends SettingsPreferenceFragment
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected int getPreferenceScreenResId() {
|
||||||
|
return R.xml.wifi_calling_settings;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPause() {
|
public void onPause() {
|
||||||
super.onPause();
|
super.onPause();
|
||||||
@@ -571,6 +574,11 @@ public class WifiCallingSettingsForSub extends SettingsPreferenceFragment
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getLogTag() {
|
||||||
|
return TAG;
|
||||||
|
}
|
||||||
|
|
||||||
private void updateButtonWfcMode(boolean wfcEnabled,
|
private void updateButtonWfcMode(boolean wfcEnabled,
|
||||||
int wfcMode, int wfcRoamingMode) {
|
int wfcMode, int wfcRoamingMode) {
|
||||||
mButtonWfcMode.setSummary(getWfcModeSummary(wfcMode));
|
mButtonWfcMode.setSummary(getWfcModeSummary(wfcMode));
|
||||||
|
|||||||
@@ -90,6 +90,7 @@ public class WifiCallingSettingsForSubTest {
|
|||||||
private static final String PREFERENCE_NO_OPTIONS_DESC = "no_options_description";
|
private static final String PREFERENCE_NO_OPTIONS_DESC = "no_options_description";
|
||||||
private static final String TEST_EMERGENCY_ADDRESS_CARRIER_APP =
|
private static final String TEST_EMERGENCY_ADDRESS_CARRIER_APP =
|
||||||
"com.android.settings/.wifi.calling.TestEmergencyAddressCarrierApp";
|
"com.android.settings/.wifi.calling.TestEmergencyAddressCarrierApp";
|
||||||
|
private static final String PREFERENCE_EMERGENCY_ADDRESS = "emergency_address_key";
|
||||||
|
|
||||||
private TestFragment mFragment;
|
private TestFragment mFragment;
|
||||||
private Context mContext;
|
private Context mContext;
|
||||||
@@ -138,6 +139,7 @@ public class WifiCallingSettingsForSubTest {
|
|||||||
doReturn(mContext.getResources()).when(mFragment).getResources();
|
doReturn(mContext.getResources()).when(mFragment).getResources();
|
||||||
doReturn(mPreferenceScreen).when(mFragment).getPreferenceScreen();
|
doReturn(mPreferenceScreen).when(mFragment).getPreferenceScreen();
|
||||||
doReturn(mTelephonyManager).when(mTelephonyManager).createForSubscriptionId(anyInt());
|
doReturn(mTelephonyManager).when(mTelephonyManager).createForSubscriptionId(anyInt());
|
||||||
|
doReturn(mock(LifecycleOwner.class)).when(mFragment).getViewLifecycleOwner();
|
||||||
final Bundle bundle = new Bundle();
|
final Bundle bundle = new Bundle();
|
||||||
when(mFragment.getArguments()).thenReturn(bundle);
|
when(mFragment.getArguments()).thenReturn(bundle);
|
||||||
doNothing().when(mFragment).addPreferencesFromResource(anyInt());
|
doNothing().when(mFragment).addPreferencesFromResource(anyInt());
|
||||||
@@ -380,19 +382,22 @@ public class WifiCallingSettingsForSubTest {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <T extends Preference> T findPreference(CharSequence key) {
|
public <T extends Preference> T findPreference(CharSequence key) {
|
||||||
if (SWITCH_BAR.equals(key)) {
|
if (SWITCH_BAR.contentEquals(key)) {
|
||||||
return (T) mSwitchPref;
|
return (T) mSwitchPref;
|
||||||
}
|
}
|
||||||
if (BUTTON_WFC_MODE.equals(key)) {
|
if (BUTTON_WFC_MODE.contentEquals(key)) {
|
||||||
return (T) mButtonWfcMode;
|
return (T) mButtonWfcMode;
|
||||||
}
|
}
|
||||||
if (BUTTON_WFC_ROAMING_MODE.equals(key)) {
|
if (BUTTON_WFC_ROAMING_MODE.contentEquals(key)) {
|
||||||
return (T) mButtonWfcRoamingMode;
|
return (T) mButtonWfcRoamingMode;
|
||||||
}
|
}
|
||||||
if (PREFERENCE_NO_OPTIONS_DESC.equals(key)) {
|
if (PREFERENCE_NO_OPTIONS_DESC.contentEquals(key)) {
|
||||||
return (T) mDescriptionView;
|
return (T) mDescriptionView;
|
||||||
}
|
}
|
||||||
return (T) mock(ListWithEntrySummaryPreference.class);
|
if (PREFERENCE_EMERGENCY_ADDRESS.contentEquals(key)) {
|
||||||
|
return (T) mUpdateAddress;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user