Snap for 7986305 from 1e5d475fdc to tm-release
Change-Id: I591a56d7566193fdb08b256d1c3cf336d92e0564
This commit is contained in:
@@ -196,7 +196,6 @@
|
|||||||
</receiver>
|
</receiver>
|
||||||
|
|
||||||
<activity android:name=".SubSettings"
|
<activity android:name=".SubSettings"
|
||||||
android:configChanges="orientation|keyboard|keyboardHidden|screenSize|screenLayout|smallestScreenSize"
|
|
||||||
android:theme="@style/Theme.SubSettings" />
|
android:theme="@style/Theme.SubSettings" />
|
||||||
|
|
||||||
<activity android:name=".Settings$CreateShortcutActivity"
|
<activity android:name=".Settings$CreateShortcutActivity"
|
||||||
@@ -241,6 +240,11 @@
|
|||||||
android:exported="true"
|
android:exported="true"
|
||||||
android:launchMode="singleTask"
|
android:launchMode="singleTask"
|
||||||
android:configChanges="orientation|screenSize|keyboardHidden">
|
android:configChanges="orientation|screenSize|keyboardHidden">
|
||||||
|
<!-- Note: Since the framework does not support the multiple requests of network scan
|
||||||
|
from the UI, this singleTask can protect that there is only one
|
||||||
|
Settings$NetworkSelectActivity which can request the network scan.
|
||||||
|
If removing the "singleTask" in the future, please also modify the
|
||||||
|
Settings$NetworkSelectActivity's structure. -->
|
||||||
<intent-filter android:priority="1">
|
<intent-filter android:priority="1">
|
||||||
<!-- Displays the MobileNetworkActivity and opt-in dialog for capability discovery. -->
|
<!-- Displays the MobileNetworkActivity and opt-in dialog for capability discovery. -->
|
||||||
<action android:name="android.telephony.ims.action.SHOW_CAPABILITY_DISCOVERY_OPT_IN" />
|
<action android:name="android.telephony.ims.action.SHOW_CAPABILITY_DISCOVERY_OPT_IN" />
|
||||||
@@ -369,6 +373,16 @@
|
|||||||
android:value="true"/>
|
android:value="true"/>
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
|
<activity
|
||||||
|
android:name="Settings$NetworkSelectActivity"
|
||||||
|
android:label="@string/choose_network_title"
|
||||||
|
android:configChanges="orientation|keyboard|keyboardHidden|screenSize|screenLayout|smallestScreenSize">
|
||||||
|
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
||||||
|
android:value="com.android.settings.network.telephony.NetworkSelectSettings" />
|
||||||
|
<meta-data android:name="com.android.settings.PRIMARY_PROFILE_CONTROLLED"
|
||||||
|
android:value="true" />
|
||||||
|
</activity>
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:name="Settings$WifiDetailsSettingsActivity"
|
android:name="Settings$WifiDetailsSettingsActivity"
|
||||||
android:label="@string/wifi_details_title"
|
android:label="@string/wifi_details_title"
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -5290,13 +5290,13 @@
|
|||||||
<!-- Message of the magnification mode option to choose the magnification mode. [CHAR LIMIT=none] -->
|
<!-- Message of the magnification mode option to choose the magnification mode. [CHAR LIMIT=none] -->
|
||||||
<string name="accessibility_magnification_area_settings_mode_switch_summary">Tap the switch button to move between both options</string>
|
<string name="accessibility_magnification_area_settings_mode_switch_summary">Tap the switch button to move between both options</string>
|
||||||
<!-- Title for the accessibility magnification switch shortcut dialog. [CHAR LIMIT=48] -->
|
<!-- Title for the accessibility magnification switch shortcut dialog. [CHAR LIMIT=48] -->
|
||||||
<string name="accessibility_magnification_switch_shortcut_title">Switch to accessibility button?</string>
|
<string name="accessibility_magnification_switch_shortcut_title">This may slow down your keyboard</string>
|
||||||
<!-- Message for the accessibility magnification switch shortcut dialog. [CHAR LIMIT=none] -->
|
<!-- Message for the accessibility magnification switch shortcut dialog. [CHAR LIMIT=none] -->
|
||||||
<string name="accessibility_magnification_switch_shortcut_message">Using triple-tap to magnify part of your screen causes typing and other delays.\n\nThe accessibility button floats on your screen over other apps. Tap it to magnify.</string>
|
<string name="accessibility_magnification_switch_shortcut_message">When using triple-tap to magnify part of your screen, you may notice issues over the keyboard.\n\nTo avoid this, you can change your magnification shortcut from triple-tap to another option.\n<annotation id="link">Change setting</annotation></string>
|
||||||
<!-- Title for the switch shortcut button in accessibility switch shortcut dialog to change the config shortcut value. [CHAR LIMIT=45] -->
|
<!-- Title for the switch shortcut button in accessibility switch shortcut dialog to confirm the action. [CHAR LIMIT=45] -->
|
||||||
<string name="accessibility_magnification_switch_shortcut_positive_button">Switch to accessibility button</string>
|
<string name="accessibility_magnification_switch_shortcut_positive_button">Continue anyway</string>
|
||||||
<!-- Title for the cancel button in accessibility switch shortcut dialog to keep the config shortcut value. [CHAR LIMIT=54] -->
|
<!-- Title for the cancel button in accessibility switch shortcut dialog to go back to edit. [CHAR LIMIT=54] -->
|
||||||
<string name="accessibility_magnification_switch_shortcut_negative_button">Use triple-tap</string>
|
<string name="accessibility_magnification_switch_shortcut_negative_button">Cancel</string>
|
||||||
<!-- Title for the accessibility preference screen to enable screen magnification settings. [CHAR LIMIT=35] -->
|
<!-- Title for the accessibility preference screen to enable screen magnification settings. [CHAR LIMIT=35] -->
|
||||||
<string name="accessibility_magnification_service_settings_title">Magnification settings</string>
|
<string name="accessibility_magnification_service_settings_title">Magnification settings</string>
|
||||||
<!-- Title for the accessibility preference screen to enable triple-tap gesture screen magnification. [CHAR LIMIT=35] -->
|
<!-- Title for the accessibility preference screen to enable triple-tap gesture screen magnification. [CHAR LIMIT=35] -->
|
||||||
|
|||||||
@@ -223,7 +223,6 @@
|
|||||||
<Preference
|
<Preference
|
||||||
android:key="choose_network_key"
|
android:key="choose_network_key"
|
||||||
android:title="@string/choose_network_title"
|
android:title="@string/choose_network_title"
|
||||||
android:fragment="com.android.phone.NetworkSelectSetting"
|
|
||||||
settings:controller="com.android.settings.network.telephony.gsm.OpenNetworkSelectPagePreferenceController"/>
|
settings:controller="com.android.settings.network.telephony.gsm.OpenNetworkSelectPagePreferenceController"/>
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
|
|
||||||
|
|||||||
@@ -52,7 +52,7 @@
|
|||||||
settings:controller="com.android.settings.deviceinfo.BrandedAccountPreferenceController"/>
|
settings:controller="com.android.settings.deviceinfo.BrandedAccountPreferenceController"/>
|
||||||
|
|
||||||
<!-- Phone number -->
|
<!-- Phone number -->
|
||||||
<Preference
|
<com.android.settings.deviceinfo.PhoneNumberSummaryPreference
|
||||||
android:key="phone_number"
|
android:key="phone_number"
|
||||||
android:order="3"
|
android:order="3"
|
||||||
android:title="@string/status_number"
|
android:title="@string/status_number"
|
||||||
@@ -113,7 +113,7 @@
|
|||||||
settings:controller="com.android.settings.deviceinfo.HardwareInfoPreferenceController"/>
|
settings:controller="com.android.settings.deviceinfo.HardwareInfoPreferenceController"/>
|
||||||
|
|
||||||
<!-- IMEI -->
|
<!-- IMEI -->
|
||||||
<Preference
|
<com.android.settings.deviceinfo.PhoneNumberSummaryPreference
|
||||||
android:key="imei_info"
|
android:key="imei_info"
|
||||||
android:order="32"
|
android:order="32"
|
||||||
android:title="@string/status_imei"
|
android:title="@string/status_imei"
|
||||||
|
|||||||
@@ -90,6 +90,7 @@ public class Settings extends SettingsActivity {
|
|||||||
public static class PublicVolumeSettingsActivity extends SettingsActivity { /* empty */ }
|
public static class PublicVolumeSettingsActivity extends SettingsActivity { /* empty */ }
|
||||||
public static class WifiSettingsActivity extends SettingsActivity { /* empty */ }
|
public static class WifiSettingsActivity extends SettingsActivity { /* empty */ }
|
||||||
public static class NetworkProviderSettingsActivity extends SettingsActivity { /* empty */ }
|
public static class NetworkProviderSettingsActivity extends SettingsActivity { /* empty */ }
|
||||||
|
public static class NetworkSelectActivity extends SettingsActivity { /* empty */ }
|
||||||
/** Activity for the Wi-Fi network details settings. */
|
/** Activity for the Wi-Fi network details settings. */
|
||||||
public static class WifiDetailsSettingsActivity extends SettingsActivity { /* empty */ }
|
public static class WifiDetailsSettingsActivity extends SettingsActivity { /* empty */ }
|
||||||
public static class WifiP2pSettingsActivity extends SettingsActivity { /* empty */ }
|
public static class WifiP2pSettingsActivity extends SettingsActivity { /* empty */ }
|
||||||
|
|||||||
@@ -377,8 +377,9 @@ public class SettingsActivity extends SettingsBaseActivity
|
|||||||
public static Intent getTrampolineIntent(Intent intent, String highlightMenuKey) {
|
public static Intent getTrampolineIntent(Intent intent, String highlightMenuKey) {
|
||||||
final Intent detailIntent = new Intent(intent);
|
final Intent detailIntent = new Intent(intent);
|
||||||
// It's a deep link intent, SettingsHomepageActivity will set SplitPairRule and start it.
|
// It's a deep link intent, SettingsHomepageActivity will set SplitPairRule and start it.
|
||||||
final Intent trampolineIntent = new Intent(ACTION_SETTINGS_EMBED_DEEP_LINK_ACTIVITY);
|
final Intent trampolineIntent = new Intent(ACTION_SETTINGS_EMBED_DEEP_LINK_ACTIVITY)
|
||||||
trampolineIntent.replaceExtras(detailIntent);
|
.setPackage(Utils.SETTINGS_PACKAGE_NAME)
|
||||||
|
.replaceExtras(detailIntent);
|
||||||
|
|
||||||
// Relay detail intent data to prevent failure of Intent#ParseUri.
|
// Relay detail intent data to prevent failure of Intent#ParseUri.
|
||||||
// If Intent#getData() is not null, Intent#toUri will return an Uri which has the scheme of
|
// If Intent#getData() is not null, Intent#toUri will return an Uri which has the scheme of
|
||||||
|
|||||||
@@ -38,7 +38,6 @@ import com.android.settings.search.actionbar.SearchMenuController;
|
|||||||
import com.android.settings.support.actionbar.HelpResourceProvider;
|
import com.android.settings.support.actionbar.HelpResourceProvider;
|
||||||
import com.android.settingslib.core.instrumentation.Instrumentable;
|
import com.android.settingslib.core.instrumentation.Instrumentable;
|
||||||
import com.android.settingslib.transition.SettingsTransitionHelper;
|
import com.android.settingslib.transition.SettingsTransitionHelper;
|
||||||
import com.android.settingslib.transition.SettingsTransitionHelper.TransitionType;
|
|
||||||
|
|
||||||
import com.google.android.setupcompat.util.WizardManagerHelper;
|
import com.google.android.setupcompat.util.WizardManagerHelper;
|
||||||
import com.google.android.setupdesign.util.ThemeHelper;
|
import com.google.android.setupdesign.util.ThemeHelper;
|
||||||
@@ -130,7 +129,6 @@ public class AccessibilitySettingsForSetupWizardActivity extends SettingsActivit
|
|||||||
final Intent intent = new Intent(this,
|
final Intent intent = new Intent(this,
|
||||||
AccessibilityScreenSizeForSetupWizardActivity.class);
|
AccessibilityScreenSizeForSetupWizardActivity.class);
|
||||||
intent.putExtra(VISION_FRAGMENT_NO, FragmentType.FONT_SIZE);
|
intent.putExtra(VISION_FRAGMENT_NO, FragmentType.FONT_SIZE);
|
||||||
intent.putExtra(EXTRA_PAGE_TRANSITION_TYPE, TransitionType.TRANSITION_FADE);
|
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
Log.d(LOG_TAG, "Launch font size settings");
|
Log.d(LOG_TAG, "Launch font size settings");
|
||||||
finish();
|
finish();
|
||||||
|
|||||||
@@ -53,6 +53,7 @@ import java.io.IOException;
|
|||||||
public class RemoveAccountPreferenceController extends AbstractPreferenceController
|
public class RemoveAccountPreferenceController extends AbstractPreferenceController
|
||||||
implements PreferenceControllerMixin, OnClickListener {
|
implements PreferenceControllerMixin, OnClickListener {
|
||||||
|
|
||||||
|
private static final String TAG = "RemoveAccountPrefController";
|
||||||
private static final String KEY_REMOVE_ACCOUNT = "remove_account";
|
private static final String KEY_REMOVE_ACCOUNT = "remove_account";
|
||||||
|
|
||||||
private final MetricsFeatureProvider mMetricsFeatureProvider;
|
private final MetricsFeatureProvider mMetricsFeatureProvider;
|
||||||
@@ -175,10 +176,11 @@ public class RemoveAccountPreferenceController extends AbstractPreferenceControl
|
|||||||
| IOException
|
| IOException
|
||||||
| AuthenticatorException e) {
|
| AuthenticatorException e) {
|
||||||
// handled below
|
// handled below
|
||||||
}
|
Log.w(TAG, "Remove account error: " + e);
|
||||||
if (failed) {
|
|
||||||
RemoveAccountFailureDialog.show(getTargetFragment());
|
RemoveAccountFailureDialog.show(getTargetFragment());
|
||||||
} else {
|
}
|
||||||
|
Log.i(TAG, "failed: " + failed);
|
||||||
|
if (!failed) {
|
||||||
targetActivity.finish();
|
targetActivity.finish();
|
||||||
}
|
}
|
||||||
}, null, mUserHandle);
|
}, null, mUserHandle);
|
||||||
@@ -210,7 +212,7 @@ public class RemoveAccountPreferenceController extends AbstractPreferenceControl
|
|||||||
final Context context = getActivity();
|
final Context context = getActivity();
|
||||||
|
|
||||||
return new AlertDialog.Builder(context)
|
return new AlertDialog.Builder(context)
|
||||||
.setTitle(R.string.really_remove_account_title)
|
.setTitle(R.string.remove_account_label)
|
||||||
.setMessage(R.string.remove_account_failed)
|
.setMessage(R.string.remove_account_failed)
|
||||||
.setPositiveButton(android.R.string.ok, null)
|
.setPositiveButton(android.R.string.ok, null)
|
||||||
.create();
|
.create();
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
# Default reviewers for this and subdirectories.
|
# Default reviewers for this and subdirectories.
|
||||||
curtislb@google.com
|
curtislb@google.com
|
||||||
|
graciecheng@google.com
|
||||||
ilyamaty@google.com
|
ilyamaty@google.com
|
||||||
jaggies@google.com
|
jaggies@google.com
|
||||||
jbolinger@google.com
|
jbolinger@google.com
|
||||||
|
|||||||
@@ -123,6 +123,7 @@ import com.android.settings.network.NetworkDashboardFragment;
|
|||||||
import com.android.settings.network.NetworkProviderSettings;
|
import com.android.settings.network.NetworkProviderSettings;
|
||||||
import com.android.settings.network.apn.ApnEditor;
|
import com.android.settings.network.apn.ApnEditor;
|
||||||
import com.android.settings.network.apn.ApnSettings;
|
import com.android.settings.network.apn.ApnSettings;
|
||||||
|
import com.android.settings.network.telephony.NetworkSelectSettings;
|
||||||
import com.android.settings.nfc.AndroidBeam;
|
import com.android.settings.nfc.AndroidBeam;
|
||||||
import com.android.settings.nfc.PaymentSettings;
|
import com.android.settings.nfc.PaymentSettings;
|
||||||
import com.android.settings.notification.ConfigureNotificationSettings;
|
import com.android.settings.notification.ConfigureNotificationSettings;
|
||||||
@@ -324,6 +325,7 @@ public class SettingsGateway {
|
|||||||
InteractAcrossProfilesDetails.class.getName(),
|
InteractAcrossProfilesDetails.class.getName(),
|
||||||
MediaControlsSettings.class.getName(),
|
MediaControlsSettings.class.getName(),
|
||||||
NetworkProviderSettings.class.getName(),
|
NetworkProviderSettings.class.getName(),
|
||||||
|
NetworkSelectSettings.class.getName(),
|
||||||
AlarmsAndRemindersDetails.class.getName(),
|
AlarmsAndRemindersDetails.class.getName(),
|
||||||
MediaManagementAppsDetails.class.getName(),
|
MediaManagementAppsDetails.class.getName(),
|
||||||
AutoBrightnessSettings.class.getName(),
|
AutoBrightnessSettings.class.getName(),
|
||||||
@@ -349,6 +351,7 @@ public class SettingsGateway {
|
|||||||
Settings.WifiSettingsActivity.class.getName(),
|
Settings.WifiSettingsActivity.class.getName(),
|
||||||
Settings.DataUsageSummaryActivity.class.getName(),
|
Settings.DataUsageSummaryActivity.class.getName(),
|
||||||
Settings.NetworkProviderSettingsActivity.class.getName(),
|
Settings.NetworkProviderSettingsActivity.class.getName(),
|
||||||
|
Settings.NetworkSelectActivity.class.getName(),
|
||||||
// Home page > Connected devices
|
// Home page > Connected devices
|
||||||
Settings.BluetoothSettingsActivity.class.getName(),
|
Settings.BluetoothSettingsActivity.class.getName(),
|
||||||
Settings.WifiDisplaySettingsActivity.class.getName(),
|
Settings.WifiDisplaySettingsActivity.class.getName(),
|
||||||
|
|||||||
@@ -159,6 +159,6 @@ public class PhoneNumberPreferenceController extends BasePreferenceController {
|
|||||||
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
protected Preference createNewPreference(Context context) {
|
protected Preference createNewPreference(Context context) {
|
||||||
return new Preference(context);
|
return new PhoneNumberSummaryPreference(context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,57 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2021 The Android Open Source Project
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
package com.android.settings.deviceinfo;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.util.AttributeSet;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import androidx.preference.Preference;
|
||||||
|
import androidx.preference.PreferenceViewHolder;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Preference which support phone number talkback in summary part.
|
||||||
|
*/
|
||||||
|
public class PhoneNumberSummaryPreference extends Preference {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
* @param context
|
||||||
|
*/
|
||||||
|
public PhoneNumberSummaryPreference(Context context) {
|
||||||
|
this(context, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
* @param context
|
||||||
|
* @param attrs
|
||||||
|
*/
|
||||||
|
public PhoneNumberSummaryPreference(Context context, AttributeSet attrs) {
|
||||||
|
super(context, attrs);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBindViewHolder(PreferenceViewHolder holder) {
|
||||||
|
super.onBindViewHolder(holder);
|
||||||
|
|
||||||
|
// Expand text to support phone number talkback.
|
||||||
|
TextView summaryView = (TextView) holder.findViewById(android.R.id.summary);
|
||||||
|
if (summaryView != null) {
|
||||||
|
summaryView.setText(PhoneNumberUtil.expandByTts(summaryView.getText()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
65
src/com/android/settings/deviceinfo/PhoneNumberUtil.java
Normal file
65
src/com/android/settings/deviceinfo/PhoneNumberUtil.java
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2021 The Android Open Source Project
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
package com.android.settings.deviceinfo;
|
||||||
|
|
||||||
|
import android.text.Spannable;
|
||||||
|
import android.text.SpannableStringBuilder;
|
||||||
|
import android.text.Spanned;
|
||||||
|
import android.text.TextUtils;
|
||||||
|
import android.text.style.TtsSpan;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.stream.IntStream;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper class to detect format of phone number.
|
||||||
|
*/
|
||||||
|
public class PhoneNumberUtil {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert given text to support phone number talkback.
|
||||||
|
* @param text given
|
||||||
|
* @return converted text
|
||||||
|
*/
|
||||||
|
public static CharSequence expandByTts(CharSequence text) {
|
||||||
|
if ((text == null) || (text.length() <= 0)
|
||||||
|
|| (!isPhoneNumberDigits(text))) {
|
||||||
|
return text;
|
||||||
|
}
|
||||||
|
Spannable spannable = new SpannableStringBuilder(text);
|
||||||
|
TtsSpan span = new TtsSpan.DigitsBuilder(text.toString()).build();
|
||||||
|
spannable.setSpan(span, 0, spannable.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||||
|
return spannable;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if given text may contains a phone id related numbers.
|
||||||
|
* (ex: phone number, IMEI, ICCID)
|
||||||
|
* @param text given
|
||||||
|
* @return true when given text is a phone id related number.
|
||||||
|
*/
|
||||||
|
private static boolean isPhoneNumberDigits(CharSequence text) {
|
||||||
|
long textLength = (long)text.length();
|
||||||
|
return (textLength == text.chars()
|
||||||
|
.filter(c -> isPhoneNumberDigit(c)).count());
|
||||||
|
}
|
||||||
|
|
||||||
|
private static boolean isPhoneNumberDigit(int c) {
|
||||||
|
return ((c >= (int)'0') && (c <= (int)'9'))
|
||||||
|
|| (c == (int)'-') || (c == (int)'+')
|
||||||
|
|| (c == (int)'(') || (c == (int)')');
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -21,11 +21,6 @@ import android.content.res.Resources;
|
|||||||
import android.telephony.SubscriptionInfo;
|
import android.telephony.SubscriptionInfo;
|
||||||
import android.telephony.SubscriptionManager;
|
import android.telephony.SubscriptionManager;
|
||||||
import android.telephony.TelephonyManager;
|
import android.telephony.TelephonyManager;
|
||||||
import android.text.Spannable;
|
|
||||||
import android.text.SpannableStringBuilder;
|
|
||||||
import android.text.Spanned;
|
|
||||||
import android.text.TextUtils;
|
|
||||||
import android.text.style.TtsSpan;
|
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
@@ -53,19 +48,6 @@ public class ImeiInfoDialogController {
|
|||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
static final int ID_GSM_SETTINGS = R.id.gsm_settings;
|
static final int ID_GSM_SETTINGS = R.id.gsm_settings;
|
||||||
|
|
||||||
private static CharSequence getTextAsDigits(CharSequence text) {
|
|
||||||
if (TextUtils.isEmpty(text)) {
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
if (TextUtils.isDigitsOnly(text)) {
|
|
||||||
final Spannable spannable = new SpannableStringBuilder(text);
|
|
||||||
final TtsSpan span = new TtsSpan.DigitsBuilder(text.toString()).build();
|
|
||||||
spannable.setSpan(span, 0, spannable.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
|
|
||||||
text = spannable;
|
|
||||||
}
|
|
||||||
return text;
|
|
||||||
}
|
|
||||||
|
|
||||||
private final ImeiInfoDialogFragment mDialog;
|
private final ImeiInfoDialogFragment mDialog;
|
||||||
private final TelephonyManager mTelephonyManager;
|
private final TelephonyManager mTelephonyManager;
|
||||||
private final SubscriptionInfo mSubscriptionInfo;
|
private final SubscriptionInfo mSubscriptionInfo;
|
||||||
@@ -121,10 +103,9 @@ public class ImeiInfoDialogController {
|
|||||||
if ((mSubscriptionInfo != null && isCdmaLteEnabled()) ||
|
if ((mSubscriptionInfo != null && isCdmaLteEnabled()) ||
|
||||||
(mSubscriptionInfo == null && isSimPresent(mSlotId))) {
|
(mSubscriptionInfo == null && isSimPresent(mSlotId))) {
|
||||||
// Show IMEI for LTE device
|
// Show IMEI for LTE device
|
||||||
mDialog.setText(ID_IMEI_VALUE,
|
mDialog.setText(ID_IMEI_VALUE, mTelephonyManager.getImei(mSlotId));
|
||||||
getTextAsDigits(mTelephonyManager.getImei(mSlotId)));
|
|
||||||
mDialog.setText(ID_IMEI_SV_VALUE,
|
mDialog.setText(ID_IMEI_SV_VALUE,
|
||||||
getTextAsDigits(mTelephonyManager.getDeviceSoftwareVersion(mSlotId)));
|
mTelephonyManager.getDeviceSoftwareVersion(mSlotId));
|
||||||
} else {
|
} else {
|
||||||
// device is not GSM/UMTS, do not display GSM/UMTS features
|
// device is not GSM/UMTS, do not display GSM/UMTS features
|
||||||
mDialog.removeViewFromScreen(ID_GSM_SETTINGS);
|
mDialog.removeViewFromScreen(ID_GSM_SETTINGS);
|
||||||
@@ -132,9 +113,9 @@ public class ImeiInfoDialogController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void updateDialogForGsmPhone() {
|
private void updateDialogForGsmPhone() {
|
||||||
mDialog.setText(ID_IMEI_VALUE, getTextAsDigits(mTelephonyManager.getImei(mSlotId)));
|
mDialog.setText(ID_IMEI_VALUE, mTelephonyManager.getImei(mSlotId));
|
||||||
mDialog.setText(ID_IMEI_SV_VALUE,
|
mDialog.setText(ID_IMEI_SV_VALUE,
|
||||||
getTextAsDigits(mTelephonyManager.getDeviceSoftwareVersion(mSlotId)));
|
mTelephonyManager.getDeviceSoftwareVersion(mSlotId));
|
||||||
// device is not CDMA, do not display CDMA features
|
// device is not CDMA, do not display CDMA features
|
||||||
mDialog.removeViewFromScreen(ID_CDMA_SETTINGS);
|
mDialog.removeViewFromScreen(ID_CDMA_SETTINGS);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,8 +31,12 @@ import androidx.fragment.app.Fragment;
|
|||||||
import androidx.fragment.app.FragmentManager;
|
import androidx.fragment.app.FragmentManager;
|
||||||
|
|
||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
|
import com.android.settings.deviceinfo.PhoneNumberUtil;
|
||||||
import com.android.settings.core.instrumentation.InstrumentedDialogFragment;
|
import com.android.settings.core.instrumentation.InstrumentedDialogFragment;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.stream.IntStream;
|
||||||
|
|
||||||
public class ImeiInfoDialogFragment extends InstrumentedDialogFragment {
|
public class ImeiInfoDialogFragment extends InstrumentedDialogFragment {
|
||||||
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
@@ -83,13 +87,27 @@ public class ImeiInfoDialogFragment extends InstrumentedDialogFragment {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* View ID(s) which is digit format (instead of decimal number) text.
|
||||||
|
**/
|
||||||
|
private static final int [] sViewIdsInDigitFormat = IntStream
|
||||||
|
.of(ImeiInfoDialogController.ID_MEID_NUMBER_VALUE,
|
||||||
|
ImeiInfoDialogController.ID_MIN_NUMBER_VALUE,
|
||||||
|
ImeiInfoDialogController.ID_IMEI_VALUE,
|
||||||
|
ImeiInfoDialogController.ID_IMEI_SV_VALUE)
|
||||||
|
.sorted().toArray();
|
||||||
|
|
||||||
public void setText(int viewId, CharSequence text) {
|
public void setText(int viewId, CharSequence text) {
|
||||||
final TextView textView = mRootView.findViewById(viewId);
|
final TextView textView = mRootView.findViewById(viewId);
|
||||||
|
if (textView == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (TextUtils.isEmpty(text)) {
|
if (TextUtils.isEmpty(text)) {
|
||||||
text = getResources().getString(R.string.device_info_default);
|
text = getResources().getString(R.string.device_info_default);
|
||||||
}
|
}
|
||||||
if (textView != null) {
|
else if (Arrays.binarySearch(sViewIdsInDigitFormat, viewId) >= 0) {
|
||||||
textView.setText(text);
|
text = PhoneNumberUtil.expandByTts(text);
|
||||||
}
|
}
|
||||||
|
textView.setText(text);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ import androidx.preference.PreferenceScreen;
|
|||||||
|
|
||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
import com.android.settings.core.BasePreferenceController;
|
import com.android.settings.core.BasePreferenceController;
|
||||||
|
import com.android.settings.deviceinfo.PhoneNumberSummaryPreference;
|
||||||
import com.android.settings.slices.Sliceable;
|
import com.android.settings.slices.Sliceable;
|
||||||
import com.android.settingslib.Utils;
|
import com.android.settingslib.Utils;
|
||||||
|
|
||||||
@@ -162,6 +163,6 @@ public class ImeiInfoPreferenceController extends BasePreferenceController {
|
|||||||
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
Preference createNewPreference(Context context) {
|
Preference createNewPreference(Context context) {
|
||||||
return new Preference(context);
|
return new PhoneNumberSummaryPreference(context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -134,7 +134,7 @@ public class SimStatusDialogController implements LifecycleObserver {
|
|||||||
}
|
}
|
||||||
if (SubscriptionManager.isValidSubscriptionId(nextSubId)) {
|
if (SubscriptionManager.isValidSubscriptionId(nextSubId)) {
|
||||||
mTelephonyManager =
|
mTelephonyManager =
|
||||||
mTelephonyManager.createForSubscriptionId(nextSubId);
|
getTelephonyManager().createForSubscriptionId(nextSubId);
|
||||||
registerImsRegistrationCallback(nextSubId);
|
registerImsRegistrationCallback(nextSubId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -228,6 +228,11 @@ public class SimStatusDialogController implements LifecycleObserver {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@VisibleForTesting
|
||||||
|
public TelephonyManager getTelephonyManager() {
|
||||||
|
return mTelephonyManager;
|
||||||
|
}
|
||||||
|
|
||||||
public void initialize() {
|
public void initialize() {
|
||||||
requestForUpdateEid();
|
requestForUpdateEid();
|
||||||
|
|
||||||
@@ -235,7 +240,7 @@ public class SimStatusDialogController implements LifecycleObserver {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
mTelephonyManager =
|
mTelephonyManager =
|
||||||
mTelephonyManager.createForSubscriptionId(mSubscriptionInfo.getSubscriptionId());
|
getTelephonyManager().createForSubscriptionId(mSubscriptionInfo.getSubscriptionId());
|
||||||
mTelephonyCallback = new SimStatusDialogTelephonyCallback();
|
mTelephonyCallback = new SimStatusDialogTelephonyCallback();
|
||||||
updateLatestAreaInfo();
|
updateLatestAreaInfo();
|
||||||
updateSubscriptionStatus();
|
updateSubscriptionStatus();
|
||||||
@@ -246,8 +251,8 @@ public class SimStatusDialogController implements LifecycleObserver {
|
|||||||
|
|
||||||
// getServiceState() may return null when the subscription is inactive
|
// getServiceState() may return null when the subscription is inactive
|
||||||
// or when there was an error communicating with the phone process.
|
// or when there was an error communicating with the phone process.
|
||||||
final ServiceState serviceState = mTelephonyManager.getServiceState();
|
final ServiceState serviceState = getTelephonyManager().getServiceState();
|
||||||
final SignalStrength signalStrength = mTelephonyManager.getSignalStrength();
|
final SignalStrength signalStrength = getTelephonyManager().getSignalStrength();
|
||||||
|
|
||||||
updatePhoneNumber();
|
updatePhoneNumber();
|
||||||
updateServiceState(serviceState);
|
updateServiceState(serviceState);
|
||||||
@@ -279,9 +284,10 @@ public class SimStatusDialogController implements LifecycleObserver {
|
|||||||
if (mSubscriptionInfo == null) {
|
if (mSubscriptionInfo == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
mTelephonyManager = mTelephonyManager.createForSubscriptionId(
|
mTelephonyManager = getTelephonyManager().createForSubscriptionId(
|
||||||
mSubscriptionInfo.getSubscriptionId());
|
mSubscriptionInfo.getSubscriptionId());
|
||||||
mTelephonyManager.registerTelephonyCallback(mContext.getMainExecutor(), mTelephonyCallback);
|
getTelephonyManager()
|
||||||
|
.registerTelephonyCallback(mContext.getMainExecutor(), mTelephonyCallback);
|
||||||
mSubscriptionManager.addOnSubscriptionsChangedListener(
|
mSubscriptionManager.addOnSubscriptionsChangedListener(
|
||||||
mContext.getMainExecutor(), mOnSubscriptionsChangedListener);
|
mContext.getMainExecutor(), mOnSubscriptionsChangedListener);
|
||||||
registerImsRegistrationCallback(mSubscriptionInfo.getSubscriptionId());
|
registerImsRegistrationCallback(mSubscriptionInfo.getSubscriptionId());
|
||||||
@@ -304,7 +310,7 @@ public class SimStatusDialogController implements LifecycleObserver {
|
|||||||
if (mIsRegisteredListener) {
|
if (mIsRegisteredListener) {
|
||||||
mSubscriptionManager.removeOnSubscriptionsChangedListener(
|
mSubscriptionManager.removeOnSubscriptionsChangedListener(
|
||||||
mOnSubscriptionsChangedListener);
|
mOnSubscriptionsChangedListener);
|
||||||
mTelephonyManager.unregisterTelephonyCallback(mTelephonyCallback);
|
getTelephonyManager().unregisterTelephonyCallback(mTelephonyCallback);
|
||||||
if (mShowLatestAreaInfo) {
|
if (mShowLatestAreaInfo) {
|
||||||
mContext.unregisterReceiver(mAreaInfoReceiver);
|
mContext.unregisterReceiver(mAreaInfoReceiver);
|
||||||
}
|
}
|
||||||
@@ -315,7 +321,7 @@ public class SimStatusDialogController implements LifecycleObserver {
|
|||||||
|
|
||||||
unregisterImsRegistrationCallback(mSubscriptionInfo.getSubscriptionId());
|
unregisterImsRegistrationCallback(mSubscriptionInfo.getSubscriptionId());
|
||||||
mSubscriptionManager.removeOnSubscriptionsChangedListener(mOnSubscriptionsChangedListener);
|
mSubscriptionManager.removeOnSubscriptionsChangedListener(mOnSubscriptionsChangedListener);
|
||||||
mTelephonyManager.unregisterTelephonyCallback(mTelephonyCallback);
|
getTelephonyManager().unregisterTelephonyCallback(mTelephonyCallback);
|
||||||
|
|
||||||
if (mShowLatestAreaInfo) {
|
if (mShowLatestAreaInfo) {
|
||||||
mContext.unregisterReceiver(mAreaInfoReceiver);
|
mContext.unregisterReceiver(mAreaInfoReceiver);
|
||||||
@@ -329,7 +335,7 @@ public class SimStatusDialogController implements LifecycleObserver {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
protected void updatePhoneNumber() {
|
public void updatePhoneNumber() {
|
||||||
// If formattedNumber is null or empty, it'll display as "Unknown".
|
// If formattedNumber is null or empty, it'll display as "Unknown".
|
||||||
mDialog.setText(PHONE_NUMBER_VALUE_ID,
|
mDialog.setText(PHONE_NUMBER_VALUE_ID,
|
||||||
DeviceInfoUtils.getBidiFormattedPhoneNumber(mContext, mSubscriptionInfo));
|
DeviceInfoUtils.getBidiFormattedPhoneNumber(mContext, mSubscriptionInfo));
|
||||||
@@ -433,7 +439,7 @@ public class SimStatusDialogController implements LifecycleObserver {
|
|||||||
private void updateLatestAreaInfo() {
|
private void updateLatestAreaInfo() {
|
||||||
mShowLatestAreaInfo = Resources.getSystem().getBoolean(
|
mShowLatestAreaInfo = Resources.getSystem().getBoolean(
|
||||||
com.android.internal.R.bool.config_showAreaUpdateInfoSettings)
|
com.android.internal.R.bool.config_showAreaUpdateInfoSettings)
|
||||||
&& mTelephonyManager.getPhoneType() != TelephonyManager.PHONE_TYPE_CDMA;
|
&& getTelephonyManager().getPhoneType() != TelephonyManager.PHONE_TYPE_CDMA;
|
||||||
|
|
||||||
if (mShowLatestAreaInfo) {
|
if (mShowLatestAreaInfo) {
|
||||||
// Bind cell broadcast service to get the area info. The info will be updated once
|
// Bind cell broadcast service to get the area info. The info will be updated once
|
||||||
@@ -451,7 +457,7 @@ public class SimStatusDialogController implements LifecycleObserver {
|
|||||||
resetSignalStrength();
|
resetSignalStrength();
|
||||||
} else if (!Utils.isInService(mPreviousServiceState)) {
|
} else if (!Utils.isInService(mPreviousServiceState)) {
|
||||||
// If ServiceState changed from out of service -> in service, update signal strength.
|
// If ServiceState changed from out of service -> in service, update signal strength.
|
||||||
updateSignalStrength(mTelephonyManager.getSignalStrength());
|
updateSignalStrength(getTelephonyManager().getSignalStrength());
|
||||||
}
|
}
|
||||||
|
|
||||||
String serviceStateValue;
|
String serviceStateValue;
|
||||||
@@ -498,7 +504,7 @@ public class SimStatusDialogController implements LifecycleObserver {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ServiceState serviceState = mTelephonyManager.getServiceState();
|
ServiceState serviceState = getTelephonyManager().getServiceState();
|
||||||
if (!Utils.isInService(serviceState)) {
|
if (!Utils.isInService(serviceState)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -536,8 +542,8 @@ public class SimStatusDialogController implements LifecycleObserver {
|
|||||||
String dataNetworkTypeName = null;
|
String dataNetworkTypeName = null;
|
||||||
String voiceNetworkTypeName = null;
|
String voiceNetworkTypeName = null;
|
||||||
final int subId = mSubscriptionInfo.getSubscriptionId();
|
final int subId = mSubscriptionInfo.getSubscriptionId();
|
||||||
final int actualDataNetworkType = mTelephonyManager.getDataNetworkType();
|
final int actualDataNetworkType = getTelephonyManager().getDataNetworkType();
|
||||||
final int actualVoiceNetworkType = mTelephonyManager.getVoiceNetworkType();
|
final int actualVoiceNetworkType = getTelephonyManager().getVoiceNetworkType();
|
||||||
final int overrideNetworkType = mTelephonyDisplayInfo == null
|
final int overrideNetworkType = mTelephonyDisplayInfo == null
|
||||||
? TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_NONE
|
? TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_NONE
|
||||||
: mTelephonyDisplayInfo.getOverrideNetworkType();
|
: mTelephonyDisplayInfo.getOverrideNetworkType();
|
||||||
@@ -604,7 +610,7 @@ public class SimStatusDialogController implements LifecycleObserver {
|
|||||||
mDialog.removeSettingFromScreen(ICCID_INFO_LABEL_ID);
|
mDialog.removeSettingFromScreen(ICCID_INFO_LABEL_ID);
|
||||||
mDialog.removeSettingFromScreen(ICCID_INFO_VALUE_ID);
|
mDialog.removeSettingFromScreen(ICCID_INFO_VALUE_ID);
|
||||||
} else {
|
} else {
|
||||||
mDialog.setText(ICCID_INFO_VALUE_ID, mTelephonyManager.getSimSerialNumber());
|
mDialog.setText(ICCID_INFO_VALUE_ID, getTelephonyManager().getSimSerialNumber());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -617,10 +623,10 @@ public class SimStatusDialogController implements LifecycleObserver {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
protected AtomicReference<String> getEid(int slotIndex) {
|
public AtomicReference<String> getEid(int slotIndex) {
|
||||||
boolean shouldHaveEid = false;
|
boolean shouldHaveEid = false;
|
||||||
String eid = null;
|
String eid = null;
|
||||||
if (mTelephonyManager.getActiveModemCount() > MAX_PHONE_COUNT_SINGLE_SIM) {
|
if (getTelephonyManager().getActiveModemCount() > MAX_PHONE_COUNT_SINGLE_SIM) {
|
||||||
// Get EID per-SIM in multi-SIM mode
|
// Get EID per-SIM in multi-SIM mode
|
||||||
final Map<Integer, Integer> mapping = mTelephonyManager
|
final Map<Integer, Integer> mapping = mTelephonyManager
|
||||||
.getLogicalToPhysicalSlotMapping();
|
.getLogicalToPhysicalSlotMapping();
|
||||||
@@ -628,7 +634,7 @@ public class SimStatusDialogController implements LifecycleObserver {
|
|||||||
SubscriptionManager.INVALID_SIM_SLOT_INDEX);
|
SubscriptionManager.INVALID_SIM_SLOT_INDEX);
|
||||||
|
|
||||||
if (pSlotId != SubscriptionManager.INVALID_SIM_SLOT_INDEX) {
|
if (pSlotId != SubscriptionManager.INVALID_SIM_SLOT_INDEX) {
|
||||||
final List<UiccCardInfo> infos = mTelephonyManager.getUiccCardsInfo();
|
final List<UiccCardInfo> infos = getTelephonyManager().getUiccCardsInfo();
|
||||||
|
|
||||||
for (UiccCardInfo info : infos) {
|
for (UiccCardInfo info : infos) {
|
||||||
if (info.getPhysicalSlotIndex() == pSlotId) {
|
if (info.getPhysicalSlotIndex() == pSlotId) {
|
||||||
|
|||||||
@@ -30,6 +30,10 @@ import androidx.fragment.app.FragmentManager;
|
|||||||
|
|
||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
import com.android.settings.core.instrumentation.InstrumentedDialogFragment;
|
import com.android.settings.core.instrumentation.InstrumentedDialogFragment;
|
||||||
|
import com.android.settings.deviceinfo.PhoneNumberUtil;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.stream.IntStream;
|
||||||
|
|
||||||
public class SimStatusDialogFragment extends InstrumentedDialogFragment {
|
public class SimStatusDialogFragment extends InstrumentedDialogFragment {
|
||||||
|
|
||||||
@@ -87,13 +91,26 @@ public class SimStatusDialogFragment extends InstrumentedDialogFragment {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* View ID(s) which is digit format (instead of decimal number) text.
|
||||||
|
**/
|
||||||
|
private static final int [] sViewIdsInDigitFormat = IntStream
|
||||||
|
.of(SimStatusDialogController.ICCID_INFO_VALUE_ID,
|
||||||
|
SimStatusDialogController.PHONE_NUMBER_VALUE_ID,
|
||||||
|
SimStatusDialogController.EID_INFO_VALUE_ID)
|
||||||
|
.sorted().toArray();
|
||||||
|
|
||||||
public void setText(int viewId, CharSequence text) {
|
public void setText(int viewId, CharSequence text) {
|
||||||
final TextView textView = mRootView.findViewById(viewId);
|
final TextView textView = mRootView.findViewById(viewId);
|
||||||
|
if (textView == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (TextUtils.isEmpty(text)) {
|
if (TextUtils.isEmpty(text)) {
|
||||||
text = getResources().getString(R.string.device_info_default);
|
text = getResources().getString(R.string.device_info_default);
|
||||||
}
|
}
|
||||||
if (textView != null) {
|
else if (Arrays.binarySearch(sViewIdsInDigitFormat, viewId) >= 0) {
|
||||||
textView.setText(text);
|
text = PhoneNumberUtil.expandByTts(text);
|
||||||
}
|
}
|
||||||
|
textView.setText(text);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ package com.android.settings.fuelgauge;
|
|||||||
|
|
||||||
import android.content.ComponentName;
|
import android.content.ComponentName;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
|
||||||
|
|
||||||
import androidx.annotation.VisibleForTesting;
|
import androidx.annotation.VisibleForTesting;
|
||||||
import androidx.preference.Preference;
|
import androidx.preference.Preference;
|
||||||
@@ -32,8 +31,6 @@ import com.android.settingslib.core.lifecycle.events.OnStart;
|
|||||||
import com.android.settingslib.core.lifecycle.events.OnStop;
|
import com.android.settingslib.core.lifecycle.events.OnStop;
|
||||||
import com.android.settingslib.utils.ThreadUtils;
|
import com.android.settingslib.utils.ThreadUtils;
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
|
|
||||||
public class TopLevelBatteryPreferenceController extends BasePreferenceController implements
|
public class TopLevelBatteryPreferenceController extends BasePreferenceController implements
|
||||||
LifecycleObserver, OnStart, OnStop, BatteryPreferenceController {
|
LifecycleObserver, OnStart, OnStop, BatteryPreferenceController {
|
||||||
|
|
||||||
@@ -43,13 +40,9 @@ public class TopLevelBatteryPreferenceController extends BasePreferenceControlle
|
|||||||
Preference mPreference;
|
Preference mPreference;
|
||||||
private final BatteryBroadcastReceiver mBatteryBroadcastReceiver;
|
private final BatteryBroadcastReceiver mBatteryBroadcastReceiver;
|
||||||
private BatteryInfo mBatteryInfo;
|
private BatteryInfo mBatteryInfo;
|
||||||
private BatterySettingsFeatureProvider mBatterySettingsFeatureProvider;
|
|
||||||
private BatteryStatusFeatureProvider mBatteryStatusFeatureProvider;
|
private BatteryStatusFeatureProvider mBatteryStatusFeatureProvider;
|
||||||
private String mBatteryStatusLabel;
|
private String mBatteryStatusLabel;
|
||||||
|
|
||||||
@VisibleForTesting
|
|
||||||
protected static HashMap<String, ComponentName> sReplacingActivityMap = new HashMap<>();
|
|
||||||
|
|
||||||
public TopLevelBatteryPreferenceController(Context context, String preferenceKey) {
|
public TopLevelBatteryPreferenceController(Context context, String preferenceKey) {
|
||||||
super(context, preferenceKey);
|
super(context, preferenceKey);
|
||||||
mBatteryBroadcastReceiver = new BatteryBroadcastReceiver(mContext);
|
mBatteryBroadcastReceiver = new BatteryBroadcastReceiver(mContext);
|
||||||
@@ -63,8 +56,6 @@ public class TopLevelBatteryPreferenceController extends BasePreferenceControlle
|
|||||||
}, true /* shortString */);
|
}, true /* shortString */);
|
||||||
});
|
});
|
||||||
|
|
||||||
mBatterySettingsFeatureProvider = FeatureFactory.getFactory(context)
|
|
||||||
.getBatterySettingsFeatureProvider(context);
|
|
||||||
mBatteryStatusFeatureProvider = FeatureFactory.getFactory(context)
|
mBatteryStatusFeatureProvider = FeatureFactory.getFactory(context)
|
||||||
.getBatteryStatusFeatureProvider(context);
|
.getBatteryStatusFeatureProvider(context);
|
||||||
}
|
}
|
||||||
@@ -81,37 +72,6 @@ public class TopLevelBatteryPreferenceController extends BasePreferenceControlle
|
|||||||
mPreference = screen.findPreference(getPreferenceKey());
|
mPreference = screen.findPreference(getPreferenceKey());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean handlePreferenceTreeClick(Preference preference) {
|
|
||||||
String prefFrag = preference.getFragment();
|
|
||||||
if (prefFrag == null || prefFrag.isEmpty()) {
|
|
||||||
// Not a redirect, so use the default.
|
|
||||||
return super.handlePreferenceTreeClick(preference);
|
|
||||||
}
|
|
||||||
|
|
||||||
ComponentName currentFragmentName = convertClassPathToComponentName(prefFrag);
|
|
||||||
if (currentFragmentName == null) {
|
|
||||||
return super.handlePreferenceTreeClick(preference);
|
|
||||||
}
|
|
||||||
|
|
||||||
ComponentName replacingActivity;
|
|
||||||
if (sReplacingActivityMap.containsKey(prefFrag)) {
|
|
||||||
replacingActivity = sReplacingActivityMap.get(prefFrag);
|
|
||||||
} else {
|
|
||||||
replacingActivity = mBatterySettingsFeatureProvider.getReplacingActivity(
|
|
||||||
currentFragmentName);
|
|
||||||
sReplacingActivityMap.put(prefFrag, replacingActivity);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (replacingActivity == null || currentFragmentName.compareTo(replacingActivity) == 0) {
|
|
||||||
return super.handlePreferenceTreeClick(preference);
|
|
||||||
}
|
|
||||||
Intent intent = new Intent();
|
|
||||||
intent.setComponent(replacingActivity);
|
|
||||||
mContext.startActivity(intent);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onStart() {
|
public void onStart() {
|
||||||
mBatteryBroadcastReceiver.register();
|
mBatteryBroadcastReceiver.register();
|
||||||
|
|||||||
@@ -125,11 +125,8 @@ public class SettingsHomepageActivity extends FragmentActivity implements
|
|||||||
}
|
}
|
||||||
Log.i(TAG, "showHomepageWithSuggestion: " + showSuggestion);
|
Log.i(TAG, "showHomepageWithSuggestion: " + showSuggestion);
|
||||||
final View homepageView = mHomepageView;
|
final View homepageView = mHomepageView;
|
||||||
if (!mIsTwoPaneLastTime) {
|
mSuggestionView.setVisibility(showSuggestion ? View.VISIBLE : View.GONE);
|
||||||
mSuggestionView.setVisibility(showSuggestion ? View.VISIBLE : View.GONE);
|
mTwoPaneSuggestionView.setVisibility(showSuggestion ? View.VISIBLE : View.GONE);
|
||||||
} else {
|
|
||||||
mTwoPaneSuggestionView.setVisibility(showSuggestion ? View.VISIBLE : View.GONE);
|
|
||||||
}
|
|
||||||
mHomepageView = null;
|
mHomepageView = null;
|
||||||
|
|
||||||
mLoadedListeners.forEach(listener -> listener.onHomepageLoaded());
|
mLoadedListeners.forEach(listener -> listener.onHomepageLoaded());
|
||||||
|
|||||||
@@ -54,6 +54,7 @@ public class TopLevelSettings extends DashboardFragment implements
|
|||||||
private static final String PREF_KEY_SUPPORT = "top_level_support";
|
private static final String PREF_KEY_SUPPORT = "top_level_support";
|
||||||
|
|
||||||
private TopLevelHighlightMixin mHighlightMixin;
|
private TopLevelHighlightMixin mHighlightMixin;
|
||||||
|
private boolean mFirstStarted = true;
|
||||||
|
|
||||||
public TopLevelSettings() {
|
public TopLevelSettings() {
|
||||||
final Bundle args = new Bundle();
|
final Bundle args = new Bundle();
|
||||||
@@ -135,9 +136,11 @@ public class TopLevelSettings extends DashboardFragment implements
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onStart() {
|
public void onStart() {
|
||||||
// Set default highlight menu key for 1-pane homepage since it will show the placeholder
|
if (mFirstStarted) {
|
||||||
// page once changing back to 2-pane.
|
mFirstStarted = false;
|
||||||
if (!ActivityEmbeddingUtils.isTwoPaneResolution(getActivity())) {
|
} else if (!ActivityEmbeddingUtils.isTwoPaneResolution(getActivity())) {
|
||||||
|
// Set default highlight menu key for 1-pane homepage since it will show the placeholder
|
||||||
|
// page once changing back to 2-pane.
|
||||||
setHighlightMenuKey(getString(SettingsHomepageActivity.DEFAULT_HIGHLIGHT_MENU_KEY),
|
setHighlightMenuKey(getString(SettingsHomepageActivity.DEFAULT_HIGHLIGHT_MENU_KEY),
|
||||||
/* scrollNeeded= */ false);
|
/* scrollNeeded= */ false);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -316,7 +316,7 @@ public class SubscriptionsPreferenceController extends AbstractPreferenceControl
|
|||||||
: (serviceState.getState() == ServiceState.STATE_IN_SERVICE);
|
: (serviceState.getState() == ServiceState.STATE_IN_SERVICE);
|
||||||
if (isDataInService || isVoiceInService || isCarrierNetworkActive) {
|
if (isDataInService || isVoiceInService || isCarrierNetworkActive) {
|
||||||
icon = mSubsPrefCtrlInjector.getIcon(mContext, level, numLevels,
|
icon = mSubsPrefCtrlInjector.getIcon(mContext, level, numLevels,
|
||||||
!mTelephonyManager.isDataEnabled());
|
!tmForSubId.isDataEnabled());
|
||||||
}
|
}
|
||||||
|
|
||||||
final boolean isActiveCellularNetwork =
|
final boolean isActiveCellularNetwork =
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ package com.android.settings.network.telephony;
|
|||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.app.settings.SettingsEnums;
|
import android.app.settings.SettingsEnums;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.Message;
|
import android.os.Message;
|
||||||
@@ -102,7 +103,7 @@ public class NetworkSelectSettings extends DashboardFragment {
|
|||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
protected void onCreateInitialization() {
|
protected void onCreateInitialization() {
|
||||||
mUseNewApi = enableNewAutoSelectNetworkUI(getContext());
|
mUseNewApi = enableNewAutoSelectNetworkUI(getContext());
|
||||||
mSubId = getArguments().getInt(Settings.EXTRA_SUB_ID);
|
mSubId = getSubId();
|
||||||
|
|
||||||
mPreferenceCategory = getPreferenceCategory(PREF_KEY_NETWORK_OPERATORS);
|
mPreferenceCategory = getPreferenceCategory(PREF_KEY_NETWORK_OPERATORS);
|
||||||
mStatusMessagePreference = new Preference(getContext());
|
mStatusMessagePreference = new Preference(getContext());
|
||||||
@@ -121,7 +122,7 @@ public class NetworkSelectSettings extends DashboardFragment {
|
|||||||
mMetricsFeatureProvider = getMetricsFeatureProvider(getContext());
|
mMetricsFeatureProvider = getMetricsFeatureProvider(getContext());
|
||||||
mIsAggregationEnabled = enableAggregation(getContext());
|
mIsAggregationEnabled = enableAggregation(getContext());
|
||||||
Log.d(TAG, "init: mUseNewApi:" + mUseNewApi
|
Log.d(TAG, "init: mUseNewApi:" + mUseNewApi
|
||||||
+ " ,mIsAggregationEnabled:" + mIsAggregationEnabled);
|
+ " ,mIsAggregationEnabled:" + mIsAggregationEnabled + " ,mSubId:" + mSubId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Keep
|
@Keep
|
||||||
@@ -175,6 +176,18 @@ public class NetworkSelectSettings extends DashboardFragment {
|
|||||||
getPreferenceScreen().setEnabled(enable);
|
getPreferenceScreen().setEnabled(enable);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Keep
|
||||||
|
@VisibleForTesting
|
||||||
|
protected int getSubId() {
|
||||||
|
int subId = SubscriptionManager.INVALID_SUBSCRIPTION_ID;
|
||||||
|
Intent intent = getActivity().getIntent();
|
||||||
|
if (intent != null) {
|
||||||
|
subId = intent.getIntExtra(Settings.EXTRA_SUB_ID,
|
||||||
|
SubscriptionManager.INVALID_SUBSCRIPTION_ID);
|
||||||
|
}
|
||||||
|
return subId;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onViewCreated(View view, Bundle savedInstanceState) {
|
public void onViewCreated(View view, Bundle savedInstanceState) {
|
||||||
super.onViewCreated(view, savedInstanceState);
|
super.onViewCreated(view, savedInstanceState);
|
||||||
|
|||||||
@@ -20,9 +20,8 @@ import static androidx.lifecycle.Lifecycle.Event.ON_START;
|
|||||||
import static androidx.lifecycle.Lifecycle.Event.ON_STOP;
|
import static androidx.lifecycle.Lifecycle.Event.ON_STOP;
|
||||||
|
|
||||||
import android.app.ProgressDialog;
|
import android.app.ProgressDialog;
|
||||||
import android.app.settings.SettingsEnums;
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.os.Bundle;
|
import android.content.Intent;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.HandlerExecutor;
|
import android.os.HandlerExecutor;
|
||||||
import android.os.Looper;
|
import android.os.Looper;
|
||||||
@@ -43,10 +42,8 @@ import androidx.preference.PreferenceScreen;
|
|||||||
import androidx.preference.SwitchPreference;
|
import androidx.preference.SwitchPreference;
|
||||||
|
|
||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
import com.android.settings.core.SubSettingLauncher;
|
|
||||||
import com.android.settings.network.AllowedNetworkTypesListener;
|
import com.android.settings.network.AllowedNetworkTypesListener;
|
||||||
import com.android.settings.network.telephony.MobileNetworkUtils;
|
import com.android.settings.network.telephony.MobileNetworkUtils;
|
||||||
import com.android.settings.network.telephony.NetworkSelectSettings;
|
|
||||||
import com.android.settings.network.telephony.TelephonyTogglePreferenceController;
|
import com.android.settings.network.telephony.TelephonyTogglePreferenceController;
|
||||||
import com.android.settingslib.utils.ThreadUtils;
|
import com.android.settingslib.utils.ThreadUtils;
|
||||||
|
|
||||||
@@ -151,25 +148,26 @@ public class AutoSelectPreferenceController extends TelephonyTogglePreferenceCon
|
|||||||
public boolean setChecked(boolean isChecked) {
|
public boolean setChecked(boolean isChecked) {
|
||||||
if (isChecked) {
|
if (isChecked) {
|
||||||
setAutomaticSelectionMode();
|
setAutomaticSelectionMode();
|
||||||
return false;
|
|
||||||
} else {
|
} else {
|
||||||
final Bundle bundle = new Bundle();
|
if (mSwitchPreference != null) {
|
||||||
bundle.putInt(Settings.EXTRA_SUB_ID, mSubId);
|
Intent intent = new Intent();
|
||||||
new SubSettingLauncher(mContext)
|
intent.setClassName("com.android.settings",
|
||||||
.setDestination(NetworkSelectSettings.class.getName())
|
"com.android.settings.Settings$NetworkSelectActivity");
|
||||||
.setSourceMetricsCategory(SettingsEnums.MOBILE_NETWORK_SELECT)
|
intent.putExtra(Settings.EXTRA_SUB_ID, mSubId);
|
||||||
.setTitleRes(R.string.choose_network_title)
|
mSwitchPreference.setIntent(intent);
|
||||||
.setArguments(bundle)
|
}
|
||||||
.launch();
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
Future setAutomaticSelectionMode() {
|
Future setAutomaticSelectionMode() {
|
||||||
final long startMillis = SystemClock.elapsedRealtime();
|
final long startMillis = SystemClock.elapsedRealtime();
|
||||||
showAutoSelectProgressBar();
|
showAutoSelectProgressBar();
|
||||||
mSwitchPreference.setEnabled(false);
|
if (mSwitchPreference != null) {
|
||||||
|
mSwitchPreference.setIntent(null);
|
||||||
|
mSwitchPreference.setEnabled(false);
|
||||||
|
}
|
||||||
return ThreadUtils.postOnBackgroundThread(() -> {
|
return ThreadUtils.postOnBackgroundThread(() -> {
|
||||||
// set network selection mode in background
|
// set network selection mode in background
|
||||||
mTelephonyManager.setNetworkSelectionModeAutomatic();
|
mTelephonyManager.setNetworkSelectionModeAutomatic();
|
||||||
|
|||||||
@@ -19,14 +19,12 @@ package com.android.settings.network.telephony.gsm;
|
|||||||
import static androidx.lifecycle.Lifecycle.Event.ON_START;
|
import static androidx.lifecycle.Lifecycle.Event.ON_START;
|
||||||
import static androidx.lifecycle.Lifecycle.Event.ON_STOP;
|
import static androidx.lifecycle.Lifecycle.Event.ON_STOP;
|
||||||
|
|
||||||
import android.app.settings.SettingsEnums;
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.os.Bundle;
|
import android.content.Intent;
|
||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
import android.telephony.ServiceState;
|
import android.telephony.ServiceState;
|
||||||
import android.telephony.SubscriptionManager;
|
import android.telephony.SubscriptionManager;
|
||||||
import android.telephony.TelephonyManager;
|
import android.telephony.TelephonyManager;
|
||||||
import android.text.TextUtils;
|
|
||||||
|
|
||||||
import androidx.lifecycle.Lifecycle;
|
import androidx.lifecycle.Lifecycle;
|
||||||
import androidx.lifecycle.LifecycleObserver;
|
import androidx.lifecycle.LifecycleObserver;
|
||||||
@@ -35,10 +33,8 @@ import androidx.preference.Preference;
|
|||||||
import androidx.preference.PreferenceScreen;
|
import androidx.preference.PreferenceScreen;
|
||||||
|
|
||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
import com.android.settings.core.SubSettingLauncher;
|
|
||||||
import com.android.settings.network.AllowedNetworkTypesListener;
|
import com.android.settings.network.AllowedNetworkTypesListener;
|
||||||
import com.android.settings.network.telephony.MobileNetworkUtils;
|
import com.android.settings.network.telephony.MobileNetworkUtils;
|
||||||
import com.android.settings.network.telephony.NetworkSelectSettings;
|
|
||||||
import com.android.settings.network.telephony.TelephonyBasePreferenceController;
|
import com.android.settings.network.telephony.TelephonyBasePreferenceController;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -102,6 +98,12 @@ public class OpenNetworkSelectPagePreferenceController extends
|
|||||||
super.updateState(preference);
|
super.updateState(preference);
|
||||||
preference.setEnabled(mTelephonyManager.getNetworkSelectionMode()
|
preference.setEnabled(mTelephonyManager.getNetworkSelectionMode()
|
||||||
!= TelephonyManager.NETWORK_SELECTION_MODE_AUTO);
|
!= TelephonyManager.NETWORK_SELECTION_MODE_AUTO);
|
||||||
|
|
||||||
|
Intent intent = new Intent();
|
||||||
|
intent.setClassName("com.android.settings",
|
||||||
|
"com.android.settings.Settings$NetworkSelectActivity");
|
||||||
|
intent.putExtra(Settings.EXTRA_SUB_ID, mSubId);
|
||||||
|
preference.setIntent(intent);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -114,23 +116,6 @@ public class OpenNetworkSelectPagePreferenceController extends
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean handlePreferenceTreeClick(Preference preference) {
|
|
||||||
if (TextUtils.equals(preference.getKey(), getPreferenceKey())) {
|
|
||||||
final Bundle bundle = new Bundle();
|
|
||||||
bundle.putInt(Settings.EXTRA_SUB_ID, mSubId);
|
|
||||||
new SubSettingLauncher(mContext)
|
|
||||||
.setDestination(NetworkSelectSettings.class.getName())
|
|
||||||
.setSourceMetricsCategory(SettingsEnums.MOBILE_NETWORK_SELECT)
|
|
||||||
.setTitleRes(R.string.choose_network_title)
|
|
||||||
.setArguments(bundle)
|
|
||||||
.launch();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public OpenNetworkSelectPagePreferenceController init(Lifecycle lifecycle, int subId) {
|
public OpenNetworkSelectPagePreferenceController init(Lifecycle lifecycle, int subId) {
|
||||||
mSubId = subId;
|
mSubId = subId;
|
||||||
mTelephonyManager = mContext.getSystemService(TelephonyManager.class)
|
mTelephonyManager = mContext.getSystemService(TelephonyManager.class)
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
# Default reviewers for this and subdirectories.
|
# Default reviewers for this and subdirectories.
|
||||||
curtislb@google.com
|
curtislb@google.com
|
||||||
|
graciecheng@google.com
|
||||||
ilyamaty@google.com
|
ilyamaty@google.com
|
||||||
jaggies@google.com
|
jaggies@google.com
|
||||||
jbolinger@google.com
|
jbolinger@google.com
|
||||||
|
|||||||
@@ -21,11 +21,7 @@ import static com.android.settings.core.BasePreferenceController.UNSUPPORTED_ON_
|
|||||||
|
|
||||||
import static com.google.common.truth.Truth.assertThat;
|
import static com.google.common.truth.Truth.assertThat;
|
||||||
|
|
||||||
import static org.mockito.Mockito.any;
|
|
||||||
import static org.mockito.Mockito.doNothing;
|
|
||||||
import static org.mockito.Mockito.mock;
|
|
||||||
import static org.mockito.Mockito.spy;
|
import static org.mockito.Mockito.spy;
|
||||||
import static org.mockito.Mockito.times;
|
|
||||||
import static org.mockito.Mockito.verify;
|
import static org.mockito.Mockito.verify;
|
||||||
import static org.mockito.Mockito.when;
|
import static org.mockito.Mockito.when;
|
||||||
|
|
||||||
@@ -37,14 +33,11 @@ import android.content.Intent;
|
|||||||
import androidx.preference.Preference;
|
import androidx.preference.Preference;
|
||||||
|
|
||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
import com.android.settings.testutils.FakeFeatureFactory;
|
|
||||||
|
|
||||||
import org.junit.After;
|
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Ignore;
|
import org.junit.Ignore;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
import org.mockito.ArgumentCaptor;
|
|
||||||
import org.mockito.MockitoAnnotations;
|
import org.mockito.MockitoAnnotations;
|
||||||
import org.robolectric.Robolectric;
|
import org.robolectric.Robolectric;
|
||||||
import org.robolectric.RobolectricTestRunner;
|
import org.robolectric.RobolectricTestRunner;
|
||||||
@@ -53,24 +46,14 @@ import org.robolectric.annotation.Config;
|
|||||||
@RunWith(RobolectricTestRunner.class)
|
@RunWith(RobolectricTestRunner.class)
|
||||||
public class TopLevelBatteryPreferenceControllerTest {
|
public class TopLevelBatteryPreferenceControllerTest {
|
||||||
private Context mContext;
|
private Context mContext;
|
||||||
private FakeFeatureFactory mFeatureFactory;
|
|
||||||
private TopLevelBatteryPreferenceController mController;
|
private TopLevelBatteryPreferenceController mController;
|
||||||
private BatterySettingsFeatureProvider mBatterySettingsFeatureProvider;
|
private BatterySettingsFeatureProvider mBatterySettingsFeatureProvider;
|
||||||
private ArgumentCaptor<Intent> mIntentArgumentCaptor;
|
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp() {
|
public void setUp() {
|
||||||
MockitoAnnotations.initMocks(this);
|
MockitoAnnotations.initMocks(this);
|
||||||
mFeatureFactory = FakeFeatureFactory.setupForTest();
|
|
||||||
mContext = spy(Robolectric.setupActivity(Activity.class));
|
mContext = spy(Robolectric.setupActivity(Activity.class));
|
||||||
mController = new TopLevelBatteryPreferenceController(mContext, "test_key");
|
mController = new TopLevelBatteryPreferenceController(mContext, "test_key");
|
||||||
mBatterySettingsFeatureProvider =
|
|
||||||
mFeatureFactory.batterySettingsFeatureProvider;
|
|
||||||
}
|
|
||||||
|
|
||||||
@After
|
|
||||||
public void cleanUp() {
|
|
||||||
TopLevelBatteryPreferenceController.sReplacingActivityMap.clear();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -84,56 +67,6 @@ public class TopLevelBatteryPreferenceControllerTest {
|
|||||||
assertThat(mController.getAvailabilityStatus()).isEqualTo(UNSUPPORTED_ON_DEVICE);
|
assertThat(mController.getAvailabilityStatus()).isEqualTo(UNSUPPORTED_ON_DEVICE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
public void handlePreferenceTreeClick_noFragment_noCustomActivityCalled() {
|
|
||||||
Preference preference = new Preference(mContext);
|
|
||||||
|
|
||||||
assertThat(mController.handlePreferenceTreeClick(preference)).isFalse();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void handlePreferenceTreeClick_sameActivityReturned_noCustomActivityCalled() {
|
|
||||||
String fragmentPath = "my.fragment.ClassName";
|
|
||||||
Preference preference = mock(Preference.class);
|
|
||||||
when(preference.getFragment()).thenReturn(fragmentPath);
|
|
||||||
ComponentName pathName = mController.convertClassPathToComponentName(fragmentPath);
|
|
||||||
when(mBatterySettingsFeatureProvider.getReplacingActivity(any())).thenReturn(pathName);
|
|
||||||
|
|
||||||
assertThat(mController.handlePreferenceTreeClick(preference)).isFalse();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
@Ignore
|
|
||||||
public void handlePreferenceTreeClick_newActivityReturned_newActivityRedirected() {
|
|
||||||
String fragmentPath = "my.fragment.ClassName";
|
|
||||||
Preference preference = mock(Preference.class);
|
|
||||||
when(preference.getFragment()).thenReturn(fragmentPath);
|
|
||||||
String newFragmentPath = "my.fragment.NewClassName";
|
|
||||||
ComponentName newPathName = mController.convertClassPathToComponentName(newFragmentPath);
|
|
||||||
when(mBatterySettingsFeatureProvider.getReplacingActivity(any())).thenReturn(
|
|
||||||
newPathName);
|
|
||||||
doNothing().when(mContext).startActivity(mIntentArgumentCaptor.capture());
|
|
||||||
|
|
||||||
assertThat(mIntentArgumentCaptor.getValue().getComponent()).isEqualTo(newPathName);
|
|
||||||
assertThat(mController.handlePreferenceTreeClick(preference)).isTrue();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void handlePreferenceTreeClick_calledMultipleTimes_fetchedFromCache() {
|
|
||||||
String fragmentPath = "my.fragment.ClassName";
|
|
||||||
Preference preference = mock(Preference.class);
|
|
||||||
when(preference.getFragment()).thenReturn(fragmentPath);
|
|
||||||
String newFragmentPath = "my.fragment.NewClassName";
|
|
||||||
ComponentName newPathName = mController.convertClassPathToComponentName(newFragmentPath);
|
|
||||||
when(mBatterySettingsFeatureProvider.getReplacingActivity(any())).thenReturn(
|
|
||||||
newPathName);
|
|
||||||
doNothing().when(mContext).startActivity(any());
|
|
||||||
|
|
||||||
assertThat(mController.handlePreferenceTreeClick(preference)).isTrue();
|
|
||||||
assertThat(mController.handlePreferenceTreeClick(preference)).isTrue();
|
|
||||||
verify(mBatterySettingsFeatureProvider, times(1)).getReplacingActivity(any());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void convertClassPathToComponentName_nullInput_returnsNull() {
|
public void convertClassPathToComponentName_nullInput_returnsNull() {
|
||||||
assertThat(mController.convertClassPathToComponentName(null)).isNull();
|
assertThat(mController.convertClassPathToComponentName(null)).isNull();
|
||||||
|
|||||||
@@ -74,12 +74,12 @@ public class WifiCallingSettingsForSubTest {
|
|||||||
|
|
||||||
private static final String BUTTON_WFC_MODE = "wifi_calling_mode";
|
private static final String BUTTON_WFC_MODE = "wifi_calling_mode";
|
||||||
private static final String BUTTON_WFC_ROAMING_MODE = "wifi_calling_roaming_mode";
|
private static final String BUTTON_WFC_ROAMING_MODE = "wifi_calling_roaming_mode";
|
||||||
|
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 TestFragment mFragment;
|
private TestFragment mFragment;
|
||||||
private Context mContext;
|
private Context mContext;
|
||||||
private TextView mEmptyView;
|
|
||||||
private final PersistableBundle mBundle = new PersistableBundle();
|
private final PersistableBundle mBundle = new PersistableBundle();
|
||||||
|
|
||||||
private MockWifiCallingQueryImsState mQueryImsState;
|
private MockWifiCallingQueryImsState mQueryImsState;
|
||||||
@@ -100,6 +100,8 @@ public class WifiCallingSettingsForSubTest {
|
|||||||
@Mock
|
@Mock
|
||||||
private View mView;
|
private View mView;
|
||||||
@Mock
|
@Mock
|
||||||
|
private LinkifyDescriptionPreference mDescriptionView;
|
||||||
|
@Mock
|
||||||
private ListWithEntrySummaryPreference mButtonWfcMode;
|
private ListWithEntrySummaryPreference mButtonWfcMode;
|
||||||
@Mock
|
@Mock
|
||||||
private ListWithEntrySummaryPreference mButtonWfcRoamingMode;
|
private ListWithEntrySummaryPreference mButtonWfcRoamingMode;
|
||||||
@@ -126,12 +128,10 @@ public class WifiCallingSettingsForSubTest {
|
|||||||
doReturn(mock(ListWithEntrySummaryPreference.class)).when(mFragment).findPreference(any());
|
doReturn(mock(ListWithEntrySummaryPreference.class)).when(mFragment).findPreference(any());
|
||||||
doReturn(mButtonWfcMode).when(mFragment).findPreference(BUTTON_WFC_MODE);
|
doReturn(mButtonWfcMode).when(mFragment).findPreference(BUTTON_WFC_MODE);
|
||||||
doReturn(mButtonWfcRoamingMode).when(mFragment).findPreference(BUTTON_WFC_ROAMING_MODE);
|
doReturn(mButtonWfcRoamingMode).when(mFragment).findPreference(BUTTON_WFC_ROAMING_MODE);
|
||||||
|
doReturn(mDescriptionView).when(mFragment).findPreference(PREFERENCE_NO_OPTIONS_DESC);
|
||||||
doNothing().when(mFragment).finish();
|
doNothing().when(mFragment).finish();
|
||||||
doReturn(mView).when(mFragment).getView();
|
doReturn(mView).when(mFragment).getView();
|
||||||
|
|
||||||
mEmptyView = new TextView(mContext);
|
|
||||||
doReturn(mEmptyView).when(mView).findViewById(android.R.id.empty);
|
|
||||||
|
|
||||||
mSwitchBar = new SettingsMainSwitchBar(mContext);
|
mSwitchBar = new SettingsMainSwitchBar(mContext);
|
||||||
doReturn(mSwitchBar).when(mView).findViewById(R.id.switch_bar);
|
doReturn(mSwitchBar).when(mView).findViewById(R.id.switch_bar);
|
||||||
|
|
||||||
@@ -211,8 +211,7 @@ public class WifiCallingSettingsForSubTest {
|
|||||||
mFragment.onResume();
|
mFragment.onResume();
|
||||||
|
|
||||||
// Check that WFC roaming preference is shown.
|
// Check that WFC roaming preference is shown.
|
||||||
verify(mPreferenceScreen, times(1)).addPreference(mButtonWfcRoamingMode);
|
verify(mButtonWfcRoamingMode, times(1)).setVisible(true);
|
||||||
verify(mPreferenceScreen, never()).removePreference(mButtonWfcRoamingMode);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -225,8 +224,7 @@ public class WifiCallingSettingsForSubTest {
|
|||||||
mFragment.onResume();
|
mFragment.onResume();
|
||||||
|
|
||||||
// Check that WFC roaming preference is hidden.
|
// Check that WFC roaming preference is hidden.
|
||||||
verify(mPreferenceScreen, never()).addPreference(mButtonWfcRoamingMode);
|
verify(mButtonWfcRoamingMode, times(1)).setVisible(false);
|
||||||
verify(mPreferenceScreen, times(1)).removePreference(mButtonWfcRoamingMode);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -239,8 +237,7 @@ public class WifiCallingSettingsForSubTest {
|
|||||||
mFragment.onResume();
|
mFragment.onResume();
|
||||||
|
|
||||||
// Check that WFC roaming preference is hidden.
|
// Check that WFC roaming preference is hidden.
|
||||||
verify(mPreferenceScreen, never()).addPreference(mButtonWfcRoamingMode);
|
verify(mButtonWfcRoamingMode, times(1)).setVisible(false);
|
||||||
verify(mPreferenceScreen, times(1)).removePreference(mButtonWfcRoamingMode);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -253,8 +250,7 @@ public class WifiCallingSettingsForSubTest {
|
|||||||
mFragment.onResume();
|
mFragment.onResume();
|
||||||
|
|
||||||
// Check that WFC roaming preference is hidden.
|
// Check that WFC roaming preference is hidden.
|
||||||
verify(mPreferenceScreen, never()).addPreference(mButtonWfcRoamingMode);
|
verify(mButtonWfcRoamingMode, times(1)).setVisible(false);
|
||||||
verify(mPreferenceScreen, times(1)).removePreference(mButtonWfcRoamingMode);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -332,9 +328,9 @@ public class WifiCallingSettingsForSubTest {
|
|||||||
Activity.RESULT_OK, null);
|
Activity.RESULT_OK, null);
|
||||||
|
|
||||||
// Check the WFC preferences is added.
|
// Check the WFC preferences is added.
|
||||||
verify(mPreferenceScreen).addPreference(mButtonWfcMode);
|
verify(mButtonWfcMode).setVisible(true);
|
||||||
verify(mPreferenceScreen).addPreference(mButtonWfcRoamingMode);
|
verify(mButtonWfcRoamingMode).setVisible(true);
|
||||||
verify(mPreferenceScreen).addPreference(mUpdateAddress);
|
verify(mUpdateAddress).setVisible(true);
|
||||||
// Check the WFC enable request.
|
// Check the WFC enable request.
|
||||||
verify(mImsMmTelManager).setVoWiFiSettingEnabled(true);
|
verify(mImsMmTelManager).setVoWiFiSettingEnabled(true);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ import static com.android.settings.deviceinfo.simstatus.SimStatusDialogControlle
|
|||||||
import static com.android.settings.deviceinfo.simstatus.SimStatusDialogController.SIGNAL_STRENGTH_LABEL_ID;
|
import static com.android.settings.deviceinfo.simstatus.SimStatusDialogController.SIGNAL_STRENGTH_LABEL_ID;
|
||||||
import static com.android.settings.deviceinfo.simstatus.SimStatusDialogController.SIGNAL_STRENGTH_VALUE_ID;
|
import static com.android.settings.deviceinfo.simstatus.SimStatusDialogController.SIGNAL_STRENGTH_VALUE_ID;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertTrue;
|
||||||
import static org.mockito.ArgumentMatchers.any;
|
import static org.mockito.ArgumentMatchers.any;
|
||||||
import static org.mockito.ArgumentMatchers.anyInt;
|
import static org.mockito.ArgumentMatchers.anyInt;
|
||||||
import static org.mockito.ArgumentMatchers.eq;
|
import static org.mockito.ArgumentMatchers.eq;
|
||||||
@@ -78,12 +79,16 @@ import java.util.Collections;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
import java.util.concurrent.atomic.AtomicReference;
|
||||||
|
|
||||||
@RunWith(AndroidJUnit4.class)
|
@RunWith(AndroidJUnit4.class)
|
||||||
public class SimStatusDialogControllerTest {
|
public class SimStatusDialogControllerTest {
|
||||||
|
|
||||||
@Mock
|
@Mock
|
||||||
private SimStatusDialogFragment mDialog;
|
private SimStatusDialogFragment mDialog;
|
||||||
|
@Mock
|
||||||
private TelephonyManager mTelephonyManager;
|
private TelephonyManager mTelephonyManager;
|
||||||
@Mock
|
@Mock
|
||||||
private SubscriptionInfo mSubscriptionInfo;
|
private SubscriptionInfo mSubscriptionInfo;
|
||||||
@@ -109,6 +114,9 @@ public class SimStatusDialogControllerTest {
|
|||||||
@Mock
|
@Mock
|
||||||
private LifecycleOwner mLifecycleOwner;
|
private LifecycleOwner mLifecycleOwner;
|
||||||
private Lifecycle mLifecycle;
|
private Lifecycle mLifecycle;
|
||||||
|
private AtomicBoolean mEuiccEnabled;
|
||||||
|
private AtomicReference<String> mEid;
|
||||||
|
private AtomicInteger mUpdatePhoneNumberCount;
|
||||||
|
|
||||||
private static final String TEST_EID_FROM_CARD = "11111111111111111111111111111111";
|
private static final String TEST_EID_FROM_CARD = "11111111111111111111111111111111";
|
||||||
private static final String TEST_EID_FROM_MANAGER = "22222222222222222222222222222222";
|
private static final String TEST_EID_FROM_MANAGER = "22222222222222222222222222222222";
|
||||||
@@ -139,7 +147,26 @@ public class SimStatusDialogControllerTest {
|
|||||||
doReturn(2).when(mTelephonyManager).getCardIdForDefaultEuicc();
|
doReturn(2).when(mTelephonyManager).getCardIdForDefaultEuicc();
|
||||||
doReturn(TelephonyManager.NETWORK_TYPE_LTE).when(mTelephonyManager).getDataNetworkType();
|
doReturn(TelephonyManager.NETWORK_TYPE_LTE).when(mTelephonyManager).getDataNetworkType();
|
||||||
|
|
||||||
mController = spy(new SimStatusDialogController(mDialog, mLifecycle, 0 /* phone id */));
|
mUpdatePhoneNumberCount = new AtomicInteger();
|
||||||
|
mEuiccEnabled = new AtomicBoolean(false);
|
||||||
|
mEid = new AtomicReference<String>("");
|
||||||
|
mController = new SimStatusDialogController(mDialog, mLifecycle, 0 /* phone id */) {
|
||||||
|
@Override
|
||||||
|
public TelephonyManager getTelephonyManager() {
|
||||||
|
return mTelephonyManager;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AtomicReference<String> getEid(int slotIndex) {
|
||||||
|
return mEuiccEnabled.get() ? mEid : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updatePhoneNumber() {
|
||||||
|
super.updatePhoneNumber();
|
||||||
|
mUpdatePhoneNumberCount.incrementAndGet();
|
||||||
|
}
|
||||||
|
};
|
||||||
// CellSignalStrength setup
|
// CellSignalStrength setup
|
||||||
doReturn(0).when(mCellSignalStrengthCdma).getDbm();
|
doReturn(0).when(mCellSignalStrengthCdma).getDbm();
|
||||||
doReturn(0).when(mCellSignalStrengthCdma).getAsuLevel();
|
doReturn(0).when(mCellSignalStrengthCdma).getAsuLevel();
|
||||||
@@ -157,7 +184,7 @@ public class SimStatusDialogControllerTest {
|
|||||||
.getLogicalToPhysicalSlotMapping();
|
.getLogicalToPhysicalSlotMapping();
|
||||||
|
|
||||||
when(mEuiccManager.isEnabled()).thenReturn(false);
|
when(mEuiccManager.isEnabled()).thenReturn(false);
|
||||||
when(mEuiccManager.getEid()).thenReturn("");
|
mEuiccEnabled.set(false);
|
||||||
when(mEuiccManager.createForCardId(anyInt())).thenReturn(mEuiccManager);
|
when(mEuiccManager.createForCardId(anyInt())).thenReturn(mEuiccManager);
|
||||||
|
|
||||||
mPersistableBundle = new PersistableBundle();
|
mPersistableBundle = new PersistableBundle();
|
||||||
@@ -183,7 +210,7 @@ public class SimStatusDialogControllerTest {
|
|||||||
public void initialize_shouldUpdatePhoneNumber() {
|
public void initialize_shouldUpdatePhoneNumber() {
|
||||||
mController.initialize();
|
mController.initialize();
|
||||||
|
|
||||||
verify(mController).updatePhoneNumber();
|
assertTrue(mUpdatePhoneNumberCount.get() > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -426,10 +453,9 @@ public class SimStatusDialogControllerTest {
|
|||||||
when(mTelephonyManager.getLogicalToPhysicalSlotMapping()).thenReturn(slotMapping);
|
when(mTelephonyManager.getLogicalToPhysicalSlotMapping()).thenReturn(slotMapping);
|
||||||
|
|
||||||
when(mEuiccManager.isEnabled()).thenReturn(true);
|
when(mEuiccManager.isEnabled()).thenReturn(true);
|
||||||
when(mEuiccManager.getEid()).thenReturn(null);
|
mEuiccEnabled.set(true);
|
||||||
|
mEid.set(null);
|
||||||
|
|
||||||
doNothing().when(mController).requestForUpdateEid();
|
|
||||||
mController.updateEid(mController.getEid(0));
|
|
||||||
mController.initialize();
|
mController.initialize();
|
||||||
|
|
||||||
// Keep 'Not available' if neither the card nor the associated manager can provide EID.
|
// Keep 'Not available' if neither the card nor the associated manager can provide EID.
|
||||||
@@ -480,11 +506,10 @@ public class SimStatusDialogControllerTest {
|
|||||||
when(mTelephonyManager.getLogicalToPhysicalSlotMapping()).thenReturn(slotMapping);
|
when(mTelephonyManager.getLogicalToPhysicalSlotMapping()).thenReturn(slotMapping);
|
||||||
|
|
||||||
when(mEuiccManager.isEnabled()).thenReturn(true);
|
when(mEuiccManager.isEnabled()).thenReturn(true);
|
||||||
when(mEuiccManager.getEid()).thenReturn(TEST_EID_FROM_MANAGER);
|
mEuiccEnabled.set(true);
|
||||||
|
mEid.set(TEST_EID_FROM_CARD);
|
||||||
when(mEuiccManager.createForCardId(0)).thenReturn(mEuiccManager);
|
when(mEuiccManager.createForCardId(0)).thenReturn(mEuiccManager);
|
||||||
|
|
||||||
doNothing().when(mController).requestForUpdateEid();
|
|
||||||
mController.updateEid(mController.getEid(0));
|
|
||||||
mController.initialize();
|
mController.initialize();
|
||||||
|
|
||||||
// Set EID retrieved from the card.
|
// Set EID retrieved from the card.
|
||||||
@@ -538,13 +563,12 @@ public class SimStatusDialogControllerTest {
|
|||||||
when(mTelephonyManager.getLogicalToPhysicalSlotMapping()).thenReturn(slotMapping);
|
when(mTelephonyManager.getLogicalToPhysicalSlotMapping()).thenReturn(slotMapping);
|
||||||
|
|
||||||
when(mEuiccManager.isEnabled()).thenReturn(true);
|
when(mEuiccManager.isEnabled()).thenReturn(true);
|
||||||
when(mEuiccManager.getEid()).thenReturn(TEST_EID_FROM_MANAGER);
|
mEuiccEnabled.set(true);
|
||||||
|
mEid.set(TEST_EID_FROM_MANAGER);
|
||||||
when(mEuiccManager.createForCardId(0)).thenThrow(
|
when(mEuiccManager.createForCardId(0)).thenThrow(
|
||||||
new RuntimeException("Unexpected card ID was specified"));
|
new RuntimeException("Unexpected card ID was specified"));
|
||||||
when(mEuiccManager.createForCardId(1)).thenReturn(mEuiccManager);
|
when(mEuiccManager.createForCardId(1)).thenReturn(mEuiccManager);
|
||||||
|
|
||||||
doNothing().when(mController).requestForUpdateEid();
|
|
||||||
mController.updateEid(mController.getEid(0));
|
|
||||||
mController.initialize();
|
mController.initialize();
|
||||||
|
|
||||||
// Set EID retrieved from the manager associated with the card which cannot provide EID.
|
// Set EID retrieved from the manager associated with the card which cannot provide EID.
|
||||||
@@ -552,6 +576,7 @@ public class SimStatusDialogControllerTest {
|
|||||||
verify(mDialog, never()).removeSettingFromScreen(eq(EID_INFO_VALUE_ID));
|
verify(mDialog, never()).removeSettingFromScreen(eq(EID_INFO_VALUE_ID));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Ignore
|
||||||
@Test
|
@Test
|
||||||
public void initialize_updateEid_shouldRemoveEid() {
|
public void initialize_updateEid_shouldRemoveEid() {
|
||||||
when(mTelephonyManager.getActiveModemCount()).thenReturn(MAX_PHONE_COUNT_DUAL_SIM);
|
when(mTelephonyManager.getActiveModemCount()).thenReturn(MAX_PHONE_COUNT_DUAL_SIM);
|
||||||
@@ -597,9 +622,9 @@ public class SimStatusDialogControllerTest {
|
|||||||
when(mTelephonyManager.getLogicalToPhysicalSlotMapping()).thenReturn(slotMapping);
|
when(mTelephonyManager.getLogicalToPhysicalSlotMapping()).thenReturn(slotMapping);
|
||||||
|
|
||||||
when(mEuiccManager.isEnabled()).thenReturn(true);
|
when(mEuiccManager.isEnabled()).thenReturn(true);
|
||||||
when(mEuiccManager.getEid()).thenReturn(TEST_EID_FROM_MANAGER);
|
mEuiccEnabled.set(true);
|
||||||
|
mEid.set(TEST_EID_FROM_MANAGER);
|
||||||
|
|
||||||
doNothing().when(mController).requestForUpdateEid();
|
|
||||||
mController.updateEid(mController.getEid(0));
|
mController.updateEid(mController.getEid(0));
|
||||||
mController.initialize();
|
mController.initialize();
|
||||||
|
|
||||||
@@ -637,10 +662,9 @@ public class SimStatusDialogControllerTest {
|
|||||||
when(mTelephonyManager.getLogicalToPhysicalSlotMapping()).thenReturn(slotMapping);
|
when(mTelephonyManager.getLogicalToPhysicalSlotMapping()).thenReturn(slotMapping);
|
||||||
|
|
||||||
when(mEuiccManager.isEnabled()).thenReturn(true);
|
when(mEuiccManager.isEnabled()).thenReturn(true);
|
||||||
when(mEuiccManager.getEid()).thenReturn(null);
|
mEuiccEnabled.set(true);
|
||||||
|
mEid.set(null);
|
||||||
|
|
||||||
doNothing().when(mController).requestForUpdateEid();
|
|
||||||
mController.updateEid(mController.getEid(0));
|
|
||||||
mController.initialize();
|
mController.initialize();
|
||||||
|
|
||||||
// Keep 'Not available' if the default eUICC manager cannot provide EID in Single SIM mode.
|
// Keep 'Not available' if the default eUICC manager cannot provide EID in Single SIM mode.
|
||||||
@@ -677,12 +701,11 @@ public class SimStatusDialogControllerTest {
|
|||||||
when(mTelephonyManager.getLogicalToPhysicalSlotMapping()).thenReturn(slotMapping);
|
when(mTelephonyManager.getLogicalToPhysicalSlotMapping()).thenReturn(slotMapping);
|
||||||
|
|
||||||
when(mEuiccManager.isEnabled()).thenReturn(true);
|
when(mEuiccManager.isEnabled()).thenReturn(true);
|
||||||
when(mEuiccManager.getEid()).thenReturn(TEST_EID_FROM_MANAGER);
|
mEuiccEnabled.set(true);
|
||||||
|
mEid.set(TEST_EID_FROM_MANAGER);
|
||||||
when(mEuiccManager.createForCardId(anyInt())).thenThrow(
|
when(mEuiccManager.createForCardId(anyInt())).thenThrow(
|
||||||
new RuntimeException("EID shall be retrieved from the default eUICC manager"));
|
new RuntimeException("EID shall be retrieved from the default eUICC manager"));
|
||||||
|
|
||||||
doNothing().when(mController).requestForUpdateEid();
|
|
||||||
mController.updateEid(mController.getEid(0));
|
|
||||||
mController.initialize();
|
mController.initialize();
|
||||||
|
|
||||||
// Set EID retrieved from the default eUICC manager in Single SIM mode.
|
// Set EID retrieved from the default eUICC manager in Single SIM mode.
|
||||||
@@ -719,12 +742,11 @@ public class SimStatusDialogControllerTest {
|
|||||||
when(mTelephonyManager.getLogicalToPhysicalSlotMapping()).thenReturn(slotMapping);
|
when(mTelephonyManager.getLogicalToPhysicalSlotMapping()).thenReturn(slotMapping);
|
||||||
|
|
||||||
when(mEuiccManager.isEnabled()).thenReturn(true);
|
when(mEuiccManager.isEnabled()).thenReturn(true);
|
||||||
when(mEuiccManager.getEid()).thenReturn(TEST_EID_FROM_MANAGER);
|
mEuiccEnabled.set(true);
|
||||||
|
mEid.set(TEST_EID_FROM_MANAGER);
|
||||||
when(mEuiccManager.createForCardId(anyInt())).thenThrow(
|
when(mEuiccManager.createForCardId(anyInt())).thenThrow(
|
||||||
new RuntimeException("EID shall be retrieved from the default eUICC manager"));
|
new RuntimeException("EID shall be retrieved from the default eUICC manager"));
|
||||||
|
|
||||||
doNothing().when(mController).requestForUpdateEid();
|
|
||||||
mController.updateEid(mController.getEid(0));
|
|
||||||
mController.initialize();
|
mController.initialize();
|
||||||
|
|
||||||
// Set EID retrieved from the default eUICC manager in Single SIM mode.
|
// Set EID retrieved from the default eUICC manager in Single SIM mode.
|
||||||
@@ -760,14 +782,12 @@ public class SimStatusDialogControllerTest {
|
|||||||
when(mTelephonyManager.getLogicalToPhysicalSlotMapping()).thenReturn(slotMapping);
|
when(mTelephonyManager.getLogicalToPhysicalSlotMapping()).thenReturn(slotMapping);
|
||||||
|
|
||||||
when(mEuiccManager.isEnabled()).thenReturn(false);
|
when(mEuiccManager.isEnabled()).thenReturn(false);
|
||||||
when(mEuiccManager.getEid()).thenReturn(null);
|
mEuiccEnabled.set(false);
|
||||||
|
mEid.set(null);
|
||||||
|
|
||||||
doNothing().when(mController).requestForUpdateEid();
|
|
||||||
mController.updateEid(mController.getEid(0));
|
|
||||||
mController.initialize();
|
mController.initialize();
|
||||||
|
|
||||||
// Remove EID if the default eUICC manager indicates that eSIM is not enabled.
|
// Remove EID if the default eUICC manager indicates that eSIM is not enabled.
|
||||||
verify(mDialog, never()).setText(eq(EID_INFO_VALUE_ID), any());
|
|
||||||
verify(mDialog).removeSettingFromScreen(eq(EID_INFO_LABEL_ID));
|
verify(mDialog).removeSettingFromScreen(eq(EID_INFO_LABEL_ID));
|
||||||
verify(mDialog).removeSettingFromScreen(eq(EID_INFO_VALUE_ID));
|
verify(mDialog).removeSettingFromScreen(eq(EID_INFO_VALUE_ID));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ import androidx.test.core.app.ApplicationProvider;
|
|||||||
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||||
|
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
|
import org.junit.Ignore;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
import org.mockito.Mock;
|
import org.mockito.Mock;
|
||||||
@@ -153,8 +154,8 @@ public class SubscriptionUtilTest {
|
|||||||
// Each subscription has a unique last 4 digits of the phone number.
|
// Each subscription has a unique last 4 digits of the phone number.
|
||||||
TelephonyManager sub1Telmgr = mock(TelephonyManager.class);
|
TelephonyManager sub1Telmgr = mock(TelephonyManager.class);
|
||||||
TelephonyManager sub2Telmgr = mock(TelephonyManager.class);
|
TelephonyManager sub2Telmgr = mock(TelephonyManager.class);
|
||||||
when(sub1Telmgr.getLine1Number()).thenReturn("1112223333");
|
when(mSubMgr.getPhoneNumber(SUBID_1)).thenReturn("1112223333");
|
||||||
when(sub2Telmgr.getLine1Number()).thenReturn("2223334444");
|
when(mSubMgr.getPhoneNumber(SUBID_2)).thenReturn("2223334444");
|
||||||
when(mTelMgr.createForSubscriptionId(SUBID_1)).thenReturn(sub1Telmgr);
|
when(mTelMgr.createForSubscriptionId(SUBID_1)).thenReturn(sub1Telmgr);
|
||||||
when(mTelMgr.createForSubscriptionId(SUBID_2)).thenReturn(sub2Telmgr);
|
when(mTelMgr.createForSubscriptionId(SUBID_2)).thenReturn(sub2Telmgr);
|
||||||
|
|
||||||
@@ -167,6 +168,7 @@ public class SubscriptionUtilTest {
|
|||||||
assertEquals(CARRIER_2, idNames.get(SUBID_2));
|
assertEquals(CARRIER_2, idNames.get(SUBID_2));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Ignore
|
||||||
@Test
|
@Test
|
||||||
public void getUniqueDisplayNames_identicalCarriers_fourDigitsUsed() {
|
public void getUniqueDisplayNames_identicalCarriers_fourDigitsUsed() {
|
||||||
// Both subscriptoins have the same display name.
|
// Both subscriptoins have the same display name.
|
||||||
@@ -182,8 +184,8 @@ public class SubscriptionUtilTest {
|
|||||||
// Each subscription has a unique last 4 digits of the phone number.
|
// Each subscription has a unique last 4 digits of the phone number.
|
||||||
TelephonyManager sub1Telmgr = mock(TelephonyManager.class);
|
TelephonyManager sub1Telmgr = mock(TelephonyManager.class);
|
||||||
TelephonyManager sub2Telmgr = mock(TelephonyManager.class);
|
TelephonyManager sub2Telmgr = mock(TelephonyManager.class);
|
||||||
when(sub1Telmgr.getLine1Number()).thenReturn("1112223333");
|
when(mSubMgr.getPhoneNumber(SUBID_1)).thenReturn("1112223333");
|
||||||
when(sub2Telmgr.getLine1Number()).thenReturn("2223334444");
|
when(mSubMgr.getPhoneNumber(SUBID_2)).thenReturn("2223334444");
|
||||||
when(mTelMgr.createForSubscriptionId(SUBID_1)).thenReturn(sub1Telmgr);
|
when(mTelMgr.createForSubscriptionId(SUBID_1)).thenReturn(sub1Telmgr);
|
||||||
when(mTelMgr.createForSubscriptionId(SUBID_2)).thenReturn(sub2Telmgr);
|
when(mTelMgr.createForSubscriptionId(SUBID_2)).thenReturn(sub2Telmgr);
|
||||||
|
|
||||||
@@ -196,6 +198,7 @@ public class SubscriptionUtilTest {
|
|||||||
assertEquals(CARRIER_1 + " 4444", idNames.get(SUBID_2));
|
assertEquals(CARRIER_1 + " 4444", idNames.get(SUBID_2));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Ignore
|
||||||
@Test
|
@Test
|
||||||
public void getUniqueDisplayNames_identicalCarriersAfterTrim_fourDigitsUsed() {
|
public void getUniqueDisplayNames_identicalCarriersAfterTrim_fourDigitsUsed() {
|
||||||
// Both subscriptoins have the same display name.
|
// Both subscriptoins have the same display name.
|
||||||
@@ -211,8 +214,8 @@ public class SubscriptionUtilTest {
|
|||||||
// Each subscription has a unique last 4 digits of the phone number.
|
// Each subscription has a unique last 4 digits of the phone number.
|
||||||
TelephonyManager sub1Telmgr = mock(TelephonyManager.class);
|
TelephonyManager sub1Telmgr = mock(TelephonyManager.class);
|
||||||
TelephonyManager sub2Telmgr = mock(TelephonyManager.class);
|
TelephonyManager sub2Telmgr = mock(TelephonyManager.class);
|
||||||
when(sub1Telmgr.getLine1Number()).thenReturn("1112223333");
|
when(mSubMgr.getPhoneNumber(SUBID_1)).thenReturn("1112223333");
|
||||||
when(sub2Telmgr.getLine1Number()).thenReturn("2223334444");
|
when(mSubMgr.getPhoneNumber(SUBID_2)).thenReturn("2223334444");
|
||||||
when(mTelMgr.createForSubscriptionId(SUBID_1)).thenReturn(sub1Telmgr);
|
when(mTelMgr.createForSubscriptionId(SUBID_1)).thenReturn(sub1Telmgr);
|
||||||
when(mTelMgr.createForSubscriptionId(SUBID_2)).thenReturn(sub2Telmgr);
|
when(mTelMgr.createForSubscriptionId(SUBID_2)).thenReturn(sub2Telmgr);
|
||||||
|
|
||||||
@@ -239,8 +242,8 @@ public class SubscriptionUtilTest {
|
|||||||
// The subscriptions' phone numbers cannot be revealed to the user.
|
// The subscriptions' phone numbers cannot be revealed to the user.
|
||||||
TelephonyManager sub1Telmgr = mock(TelephonyManager.class);
|
TelephonyManager sub1Telmgr = mock(TelephonyManager.class);
|
||||||
TelephonyManager sub2Telmgr = mock(TelephonyManager.class);
|
TelephonyManager sub2Telmgr = mock(TelephonyManager.class);
|
||||||
when(sub1Telmgr.getLine1Number()).thenReturn("");
|
when(mSubMgr.getPhoneNumber(SUBID_1)).thenReturn("");
|
||||||
when(sub2Telmgr.getLine1Number()).thenReturn("");
|
when(mSubMgr.getPhoneNumber(SUBID_2)).thenReturn("");
|
||||||
when(mTelMgr.createForSubscriptionId(SUBID_1)).thenReturn(sub1Telmgr);
|
when(mTelMgr.createForSubscriptionId(SUBID_1)).thenReturn(sub1Telmgr);
|
||||||
when(mTelMgr.createForSubscriptionId(SUBID_2)).thenReturn(sub2Telmgr);
|
when(mTelMgr.createForSubscriptionId(SUBID_2)).thenReturn(sub2Telmgr);
|
||||||
|
|
||||||
@@ -253,6 +256,7 @@ public class SubscriptionUtilTest {
|
|||||||
assertEquals(CARRIER_1 + " 2", idNames.get(SUBID_2));
|
assertEquals(CARRIER_1 + " 2", idNames.get(SUBID_2));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Ignore
|
||||||
@Test
|
@Test
|
||||||
public void getUniqueDisplayNames_phoneNumberIdentical_subscriptoinIdFallback() {
|
public void getUniqueDisplayNames_phoneNumberIdentical_subscriptoinIdFallback() {
|
||||||
// TODO have three here from the same carrier
|
// TODO have three here from the same carrier
|
||||||
@@ -274,9 +278,9 @@ public class SubscriptionUtilTest {
|
|||||||
TelephonyManager sub1Telmgr = mock(TelephonyManager.class);
|
TelephonyManager sub1Telmgr = mock(TelephonyManager.class);
|
||||||
TelephonyManager sub2Telmgr = mock(TelephonyManager.class);
|
TelephonyManager sub2Telmgr = mock(TelephonyManager.class);
|
||||||
TelephonyManager sub3Telmgr = mock(TelephonyManager.class);
|
TelephonyManager sub3Telmgr = mock(TelephonyManager.class);
|
||||||
when(sub1Telmgr.getLine1Number()).thenReturn("1112223333");
|
when(mSubMgr.getPhoneNumber(SUBID_1)).thenReturn("1112223333");
|
||||||
when(sub2Telmgr.getLine1Number()).thenReturn("2223334444");
|
when(mSubMgr.getPhoneNumber(SUBID_2)).thenReturn("2223334444");
|
||||||
when(sub3Telmgr.getLine1Number()).thenReturn("5556664444");
|
when(mSubMgr.getPhoneNumber(SUBID_3)).thenReturn("5556664444");
|
||||||
when(mTelMgr.createForSubscriptionId(SUBID_1)).thenReturn(sub1Telmgr);
|
when(mTelMgr.createForSubscriptionId(SUBID_1)).thenReturn(sub1Telmgr);
|
||||||
when(mTelMgr.createForSubscriptionId(SUBID_2)).thenReturn(sub2Telmgr);
|
when(mTelMgr.createForSubscriptionId(SUBID_2)).thenReturn(sub2Telmgr);
|
||||||
when(mTelMgr.createForSubscriptionId(SUBID_3)).thenReturn(sub3Telmgr);
|
when(mTelMgr.createForSubscriptionId(SUBID_3)).thenReturn(sub3Telmgr);
|
||||||
@@ -298,9 +302,9 @@ public class SubscriptionUtilTest {
|
|||||||
when(info1.getSubscriptionId()).thenReturn(SUBID_1);
|
when(info1.getSubscriptionId()).thenReturn(SUBID_1);
|
||||||
when(info1.getDisplayName()).thenReturn(CARRIER_1);
|
when(info1.getDisplayName()).thenReturn(CARRIER_1);
|
||||||
when(mSubMgr.getAvailableSubscriptionInfoList()).thenReturn(Arrays.asList(info1));
|
when(mSubMgr.getAvailableSubscriptionInfoList()).thenReturn(Arrays.asList(info1));
|
||||||
|
when(mSubMgr.getPhoneNumber(SUBID_1)).thenReturn("1112223333");
|
||||||
|
|
||||||
TelephonyManager sub1Telmgr = mock(TelephonyManager.class);
|
TelephonyManager sub1Telmgr = mock(TelephonyManager.class);
|
||||||
when(sub1Telmgr.getLine1Number()).thenReturn("1112223333");
|
|
||||||
when(mTelMgr.createForSubscriptionId(SUBID_1)).thenReturn(sub1Telmgr);
|
when(mTelMgr.createForSubscriptionId(SUBID_1)).thenReturn(sub1Telmgr);
|
||||||
|
|
||||||
final CharSequence name =
|
final CharSequence name =
|
||||||
@@ -310,6 +314,7 @@ public class SubscriptionUtilTest {
|
|||||||
assertEquals(CARRIER_1, name);
|
assertEquals(CARRIER_1, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Ignore
|
||||||
@Test
|
@Test
|
||||||
public void getUniqueDisplayName_identicalCarriers_correctNameReturned() {
|
public void getUniqueDisplayName_identicalCarriers_correctNameReturned() {
|
||||||
// Each subscription's default display name is unique.
|
// Each subscription's default display name is unique.
|
||||||
@@ -324,8 +329,8 @@ public class SubscriptionUtilTest {
|
|||||||
// Each subscription has a unique last 4 digits of the phone number.
|
// Each subscription has a unique last 4 digits of the phone number.
|
||||||
TelephonyManager sub1Telmgr = mock(TelephonyManager.class);
|
TelephonyManager sub1Telmgr = mock(TelephonyManager.class);
|
||||||
TelephonyManager sub2Telmgr = mock(TelephonyManager.class);
|
TelephonyManager sub2Telmgr = mock(TelephonyManager.class);
|
||||||
when(sub1Telmgr.getLine1Number()).thenReturn("1112223333");
|
when(mSubMgr.getPhoneNumber(SUBID_1)).thenReturn("1112223333");
|
||||||
when(sub2Telmgr.getLine1Number()).thenReturn("2223334444");
|
when(mSubMgr.getPhoneNumber(SUBID_2)).thenReturn("2223334444");
|
||||||
when(mTelMgr.createForSubscriptionId(SUBID_1)).thenReturn(sub1Telmgr);
|
when(mTelMgr.createForSubscriptionId(SUBID_1)).thenReturn(sub1Telmgr);
|
||||||
when(mTelMgr.createForSubscriptionId(SUBID_2)).thenReturn(sub2Telmgr);
|
when(mTelMgr.createForSubscriptionId(SUBID_2)).thenReturn(sub2Telmgr);
|
||||||
|
|
||||||
@@ -339,6 +344,7 @@ public class SubscriptionUtilTest {
|
|||||||
assertEquals(CARRIER_1 + " 4444", name2);
|
assertEquals(CARRIER_1 + " 4444", name2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Ignore
|
||||||
@Test
|
@Test
|
||||||
public void getUniqueDisplayName_phoneNumberIdentical_correctNameReturned() {
|
public void getUniqueDisplayName_phoneNumberIdentical_correctNameReturned() {
|
||||||
// Each subscription's default display name is unique.
|
// Each subscription's default display name is unique.
|
||||||
@@ -353,8 +359,8 @@ public class SubscriptionUtilTest {
|
|||||||
// Both subscriptions have a the same 4 digits of the phone number.
|
// Both subscriptions have a the same 4 digits of the phone number.
|
||||||
TelephonyManager sub1Telmgr = mock(TelephonyManager.class);
|
TelephonyManager sub1Telmgr = mock(TelephonyManager.class);
|
||||||
TelephonyManager sub2Telmgr = mock(TelephonyManager.class);
|
TelephonyManager sub2Telmgr = mock(TelephonyManager.class);
|
||||||
when(sub1Telmgr.getLine1Number()).thenReturn("1112224444");
|
when(mSubMgr.getPhoneNumber(SUBID_1)).thenReturn("1112223333");
|
||||||
when(sub2Telmgr.getLine1Number()).thenReturn("2223334444");
|
when(mSubMgr.getPhoneNumber(SUBID_2)).thenReturn("2223334444");
|
||||||
when(mTelMgr.createForSubscriptionId(SUBID_1)).thenReturn(sub1Telmgr);
|
when(mTelMgr.createForSubscriptionId(SUBID_1)).thenReturn(sub1Telmgr);
|
||||||
when(mTelMgr.createForSubscriptionId(SUBID_2)).thenReturn(sub2Telmgr);
|
when(mTelMgr.createForSubscriptionId(SUBID_2)).thenReturn(sub2Telmgr);
|
||||||
|
|
||||||
@@ -377,7 +383,7 @@ public class SubscriptionUtilTest {
|
|||||||
when(mSubMgr.getAvailableSubscriptionInfoList()).thenReturn(Arrays.asList(info1));
|
when(mSubMgr.getAvailableSubscriptionInfoList()).thenReturn(Arrays.asList(info1));
|
||||||
|
|
||||||
TelephonyManager sub1Telmgr = mock(TelephonyManager.class);
|
TelephonyManager sub1Telmgr = mock(TelephonyManager.class);
|
||||||
when(sub1Telmgr.getLine1Number()).thenReturn("1112223333");
|
when(mSubMgr.getPhoneNumber(SUBID_1)).thenReturn("1112223333");
|
||||||
when(mTelMgr.createForSubscriptionId(SUBID_1)).thenReturn(sub1Telmgr);
|
when(mTelMgr.createForSubscriptionId(SUBID_1)).thenReturn(sub1Telmgr);
|
||||||
|
|
||||||
// Subscription id is different than the one returned by the subscription manager.
|
// Subscription id is different than the one returned by the subscription manager.
|
||||||
@@ -397,7 +403,7 @@ public class SubscriptionUtilTest {
|
|||||||
when(mSubMgr.getAvailableSubscriptionInfoList()).thenReturn(Arrays.asList(info1));
|
when(mSubMgr.getAvailableSubscriptionInfoList()).thenReturn(Arrays.asList(info1));
|
||||||
|
|
||||||
TelephonyManager sub1Telmgr = mock(TelephonyManager.class);
|
TelephonyManager sub1Telmgr = mock(TelephonyManager.class);
|
||||||
when(sub1Telmgr.getLine1Number()).thenReturn("1112223333");
|
when(mSubMgr.getPhoneNumber(SUBID_1)).thenReturn("1112223333");
|
||||||
when(mTelMgr.createForSubscriptionId(SUBID_1)).thenReturn(sub1Telmgr);
|
when(mTelMgr.createForSubscriptionId(SUBID_1)).thenReturn(sub1Telmgr);
|
||||||
|
|
||||||
final CharSequence name =
|
final CharSequence name =
|
||||||
@@ -416,7 +422,7 @@ public class SubscriptionUtilTest {
|
|||||||
Arrays.asList(info1));
|
Arrays.asList(info1));
|
||||||
|
|
||||||
TelephonyManager sub1Telmgr = mock(TelephonyManager.class);
|
TelephonyManager sub1Telmgr = mock(TelephonyManager.class);
|
||||||
when(sub1Telmgr.getLine1Number()).thenReturn("1112223333");
|
when(mSubMgr.getPhoneNumber(SUBID_1)).thenReturn("1112223333");
|
||||||
when(mTelMgr.createForSubscriptionId(SUBID_1)).thenReturn(sub1Telmgr);
|
when(mTelMgr.createForSubscriptionId(SUBID_1)).thenReturn(sub1Telmgr);
|
||||||
|
|
||||||
SubscriptionInfo info2 = null;
|
SubscriptionInfo info2 = null;
|
||||||
|
|||||||
@@ -122,10 +122,6 @@ public class NetworkSelectSettingsTest {
|
|||||||
|
|
||||||
public TargetClass(NetworkSelectSettingsTest env) {
|
public TargetClass(NetworkSelectSettingsTest env) {
|
||||||
mTestEnv = env;
|
mTestEnv = env;
|
||||||
|
|
||||||
Bundle bundle = new Bundle();
|
|
||||||
bundle.putInt(Settings.EXTRA_SUB_ID, SUB_ID);
|
|
||||||
setArguments(bundle);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -184,6 +180,11 @@ public class NetworkSelectSettingsTest {
|
|||||||
protected boolean enableAggregation(Context context) {
|
protected boolean enableAggregation(Context context) {
|
||||||
return mTestEnv.mIsAggregationEnabled;
|
return mTestEnv.mIsAggregationEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected int getSubId() {
|
||||||
|
return SUB_ID;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
Reference in New Issue
Block a user