Merge "Add ability to adjust height of VideoPreference" into qt-dev
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 1990ce0..f4ff282 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -3241,6 +3241,17 @@
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
android:value="com.android.settings.fuelgauge.batterysaver.BatterySaverScheduleSettings" />
</activity>
+
+ <activity android:name="Settings$GlobalActionsPanelSettingsActivity"
+ android:label="@string/global_actions_panel_title">
+ <intent-filter>
+ <action android:name="com.android.settings.GLOBAL_ACTIONS_PANEL_SETTINGS" />
+ <category android:name="android.intent.category.DEFAULT" />
+ </intent-filter>
+ <meta-data android:name="com.android.settings.FRAGMENT_CLASS"
+ android:value="com.android.settings.gestures.GlobalActionsPanelSettings" />
+ </activity>
+
<!-- This is the longest AndroidManifest.xml ever. -->
</application>
</manifest>
diff --git a/res/layout/profile_owner_add.xml b/res/layout/profile_owner_add.xml
index 84c51fd..2ee5dfc 100644
--- a/res/layout/profile_owner_add.xml
+++ b/res/layout/profile_owner_add.xml
@@ -27,12 +27,17 @@
android:layout_height="0dp"
android:layout_weight="1"
android:scrollbars = "vertical"
- android:padding="?dialogPreferredPadding"
+ android:paddingStart="24dp"
+ android:paddingEnd="24dp"
+ android:paddingTop="12dp"
+ android:paddingBottom="6dp"
android:gravity="center_vertical"/>
<TextView android:id="@+id/admin_warning_simplified"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:paddingStart="?dialogPreferredPadding"
- android:paddingEnd="?dialogPreferredPadding"/>
+ android:paddingStart="24dp"
+ android:paddingEnd="24dp"
+ android:paddingTop="6dp"
+ android:paddingBottom="12dp"/>
</LinearLayout>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 83cb116..5384cac 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -10249,8 +10249,6 @@
<string name="global_actions_panel_title" translatable="false">Show global actions</string>
<!-- Short title text for global actions panel [CHAR LIMIT=40] [DO NOT TRANSLATE]-->
<string name="global_actions_panel_short_title" translatable="false">Global actions</string>
- <!-- Footer text for global actions panel [CHAR LIMIT=NONE] [DO NOT TRANSLATE]-->
- <string name="global_actions_panel_footer" translatable="false">The global actions panel can be accessed even when the device is locked.</string>
<!-- Title text for swiping downwards on fingerprint sensor for notifications [CHAR LIMIT=80]-->
<string name="fingerprint_swipe_for_notifications_title">Swipe fingerprint for notifications</string>
diff --git a/res/xml/global_actions_panel_settings.xml b/res/xml/global_actions_panel_settings.xml
index af155bc..2dc0fe9 100644
--- a/res/xml/global_actions_panel_settings.xml
+++ b/res/xml/global_actions_panel_settings.xml
@@ -33,8 +33,4 @@
app:controller="com.android.settings.gestures.GlobalActionsPanelPreferenceController"
app:allowDividerAbove="true" />
- <com.android.settingslib.widget.FooterPreference
- android:key="footer_preference"
- android:title="@string/global_actions_panel_footer" />
-
-</PreferenceScreen>
\ No newline at end of file
+</PreferenceScreen>
diff --git a/src/com/android/settings/Settings.java b/src/com/android/settings/Settings.java
index f6fe0c2..b4ebc57 100644
--- a/src/com/android/settings/Settings.java
+++ b/src/com/android/settings/Settings.java
@@ -165,6 +165,7 @@
public static class BluetoothDeviceDetailActivity extends SettingsActivity { /* empty */ }
public static class WifiCallingDisclaimerActivity extends SettingsActivity { /* empty */ }
public static class MobileNetworkListActivity extends SettingsActivity {}
+ public static class GlobalActionsPanelSettingsActivity extends SettingsActivity {}
// Top level categories for new IA
public static class NetworkDashboardActivity extends SettingsActivity {}
diff --git a/src/com/android/settings/applications/specialaccess/deviceadmin/DeviceAdminAdd.java b/src/com/android/settings/applications/specialaccess/deviceadmin/DeviceAdminAdd.java
index 0d0bd20..8b06975 100644
--- a/src/com/android/settings/applications/specialaccess/deviceadmin/DeviceAdminAdd.java
+++ b/src/com/android/settings/applications/specialaccess/deviceadmin/DeviceAdminAdd.java
@@ -312,7 +312,7 @@
addAndFinish();
}
})
- .setNeutralButton(R.string.cancel, null)
+ .setNegativeButton(R.string.cancel, null)
.setOnDismissListener(new DialogInterface.OnDismissListener() {
public void onDismiss(DialogInterface dialogInterface) {
finish();
diff --git a/src/com/android/settings/core/gateway/SettingsGateway.java b/src/com/android/settings/core/gateway/SettingsGateway.java
index d073dbc..b35a974 100644
--- a/src/com/android/settings/core/gateway/SettingsGateway.java
+++ b/src/com/android/settings/core/gateway/SettingsGateway.java
@@ -83,6 +83,7 @@
import com.android.settings.gestures.DoubleTapPowerSettings;
import com.android.settings.gestures.DoubleTapScreenSettings;
import com.android.settings.gestures.DoubleTwistGestureSettings;
+import com.android.settings.gestures.GlobalActionsPanelSettings;
import com.android.settings.gestures.PickupGestureSettings;
import com.android.settings.gestures.SwipeToNotificationSettings;
import com.android.settings.gestures.SystemNavigationGestureSettings;
@@ -279,7 +280,8 @@
ToggleBackupSettingFragment.class.getName(),
PreviouslyConnectedDeviceDashboardFragment.class.getName(),
BatterySaverScheduleSettings.class.getName(),
- MobileNetworkListFragment.class.getName()
+ MobileNetworkListFragment.class.getName(),
+ GlobalActionsPanelSettings.class.getName()
};
public static final String[] SETTINGS_FOR_RESTRICTED = {
diff --git a/src/com/android/settings/network/telephony/MobileNetworkUtils.java b/src/com/android/settings/network/telephony/MobileNetworkUtils.java
index 0c099ca..c0b4590 100644
--- a/src/com/android/settings/network/telephony/MobileNetworkUtils.java
+++ b/src/com/android/settings/network/telephony/MobileNetworkUtils.java
@@ -277,8 +277,7 @@
return true;
}
- if (settingsNetworkMode == TelephonyManager.NETWORK_MODE_LTE_CDMA_EVDO_GSM_WCDMA
- && !isTdscdmaSupported(context, telephonyManager)) {
+ if (shouldSpeciallyUpdateGsmCdma(context, subId)) {
return true;
}
}
@@ -296,16 +295,15 @@
if (isGsmBasicOptions(context, subId)) {
return true;
}
- final int settingsNetworkMode = android.provider.Settings.Global.getInt(
+ final int networkMode = android.provider.Settings.Global.getInt(
context.getContentResolver(),
android.provider.Settings.Global.PREFERRED_NETWORK_MODE + subId,
Phone.PREFERRED_NT_MODE);
if (isWorldMode(context, subId)) {
- if (settingsNetworkMode == TelephonyManager.NETWORK_MODE_LTE_CDMA_EVDO
- || settingsNetworkMode == TelephonyManager.NETWORK_MODE_LTE_GSM_WCDMA) {
+ if (networkMode == TelephonyManager.NETWORK_MODE_LTE_CDMA_EVDO
+ || networkMode == TelephonyManager.NETWORK_MODE_LTE_GSM_WCDMA) {
return true;
- } else if (settingsNetworkMode == TelephonyManager.NETWORK_MODE_LTE_CDMA_EVDO_GSM_WCDMA
- && !MobileNetworkUtils.isTdscdmaSupported(context, subId)) {
+ } else if (shouldSpeciallyUpdateGsmCdma(context, subId)) {
return true;
}
}
@@ -362,16 +360,24 @@
return false;
}
+ final int networkMode = android.provider.Settings.Global.getInt(
+ context.getContentResolver(),
+ android.provider.Settings.Global.PREFERRED_NETWORK_MODE + subId,
+ Phone.PREFERRED_NT_MODE);
+ if (networkMode == TelephonyManager.NETWORK_MODE_LTE_CDMA_EVDO
+ && isWorldMode(context, subId)) {
+ return false;
+ }
+ if (shouldSpeciallyUpdateGsmCdma(context, subId)) {
+ return false;
+ }
+
if (isGsmBasicOptions(context, subId)) {
return true;
}
- final int settingsNetworkMode = android.provider.Settings.Global.getInt(
- context.getContentResolver(),
- android.provider.Settings.Global.PREFERRED_NETWORK_MODE + subId,
- Phone.PREFERRED_NT_MODE);
if (isWorldMode(context, subId)) {
- if (settingsNetworkMode == TelephonyManager.NETWORK_MODE_LTE_GSM_WCDMA) {
+ if (networkMode == TelephonyManager.NETWORK_MODE_LTE_GSM_WCDMA) {
return true;
}
}
@@ -414,7 +420,6 @@
return false;
}
-
/**
* Return subId that supported by search. If there are more than one, return first one,
* otherwise return {@link SubscriptionManager#INVALID_SUBSCRIPTION_ID}
@@ -461,4 +466,33 @@
}
}
}
+
+ /**
+ * This method is migrated from {@link com.android.phone.MobileNetworkSettings} and we should
+ * use it carefully. This code snippet doesn't have very clear meaning however we should
+ * update GSM or CDMA differently based on what it returns.
+ *
+ * 1. For all CDMA settings, make them visible if it return {@code true}
+ * 2. For GSM settings, make them visible if it return {@code true} unless 3
+ * 3. For network select settings, make it invisible if it return {@code true}
+ */
+ @VisibleForTesting
+ static boolean shouldSpeciallyUpdateGsmCdma(Context context, int subId) {
+ final int networkMode = android.provider.Settings.Global.getInt(
+ context.getContentResolver(),
+ android.provider.Settings.Global.PREFERRED_NETWORK_MODE + subId,
+ Phone.PREFERRED_NT_MODE);
+ if (networkMode == TelephonyManager.NETWORK_MODE_LTE_TDSCDMA_GSM
+ || networkMode == TelephonyManager.NETWORK_MODE_LTE_TDSCDMA_GSM_WCDMA
+ || networkMode == TelephonyManager.NETWORK_MODE_LTE_TDSCDMA
+ || networkMode == TelephonyManager.NETWORK_MODE_LTE_TDSCDMA_WCDMA
+ || networkMode == TelephonyManager.NETWORK_MODE_LTE_TDSCDMA_CDMA_EVDO_GSM_WCDMA
+ || networkMode == TelephonyManager.NETWORK_MODE_LTE_CDMA_EVDO_GSM_WCDMA) {
+ if (!isTdscdmaSupported(context, subId) && isWorldMode(context, subId)) {
+ return true;
+ }
+ }
+
+ return false;
+ }
}
diff --git a/src/com/android/settings/notification/AppBubbleNotificationSettings.java b/src/com/android/settings/notification/AppBubbleNotificationSettings.java
index f55c262..2517573 100644
--- a/src/com/android/settings/notification/AppBubbleNotificationSettings.java
+++ b/src/com/android/settings/notification/AppBubbleNotificationSettings.java
@@ -61,7 +61,10 @@
Context context, AppBubbleNotificationSettings fragment) {
List<NotificationPreferenceController> controllers = new ArrayList<>();
controllers.add(new HeaderPreferenceController(context, fragment));
- controllers.add(new BubblePreferenceController(context, new NotificationBackend()));
+ controllers.add(new BubblePreferenceController(context, fragment != null
+ ? fragment.getChildFragmentManager()
+ : null,
+ new NotificationBackend(), true /* isAppPage */));
return controllers;
}
diff --git a/src/com/android/settings/notification/BubblePreferenceController.java b/src/com/android/settings/notification/BubblePreferenceController.java
index 200c4b2..b68f11d 100644
--- a/src/com/android/settings/notification/BubblePreferenceController.java
+++ b/src/com/android/settings/notification/BubblePreferenceController.java
@@ -18,6 +18,7 @@
import static android.provider.Settings.Secure.NOTIFICATION_BUBBLES;
+import android.annotation.Nullable;
import android.content.Context;
import android.provider.Settings;
@@ -40,15 +41,13 @@
static final int SYSTEM_WIDE_OFF = 0;
private FragmentManager mFragmentManager;
+ private boolean mIsAppPage;
- public BubblePreferenceController(Context context, NotificationBackend backend) {
- super(context, backend);
- }
-
- public BubblePreferenceController(Context context, FragmentManager fragmentManager,
- NotificationBackend backend) {
+ public BubblePreferenceController(Context context, @Nullable FragmentManager fragmentManager,
+ NotificationBackend backend, boolean isAppPage) {
super(context, backend);
mFragmentManager = fragmentManager;
+ mIsAppPage = isAppPage;
}
@Override
@@ -61,7 +60,7 @@
if (!super.isAvailable()) {
return false;
}
- if (!isGloballyEnabled()) {
+ if (!mIsAppPage && !isGloballyEnabled()) {
return false;
}
if (mChannel != null) {
@@ -96,7 +95,7 @@
mChannel.setAllowBubbles(value);
saveChannel();
return true;
- } else if (mAppRow != null) {
+ } else if (mAppRow != null && mFragmentManager != null) {
RestrictedSwitchPreference pref = (RestrictedSwitchPreference) preference;
// if the global setting is off, toggling app level permission requires extra
// confirmation
diff --git a/src/com/android/settings/notification/ChannelNotificationSettings.java b/src/com/android/settings/notification/ChannelNotificationSettings.java
index 9f9d438..8399a49 100644
--- a/src/com/android/settings/notification/ChannelNotificationSettings.java
+++ b/src/com/android/settings/notification/ChannelNotificationSettings.java
@@ -114,7 +114,8 @@
mControllers.add(new BadgePreferenceController(context, mBackend));
mControllers.add(new DndPreferenceController(context, mBackend));
mControllers.add(new NotificationsOffPreferenceController(context));
- mControllers.add(new BubblePreferenceController(context, mBackend));
+ mControllers.add(new BubblePreferenceController(context, getChildFragmentManager(),
+ mBackend, false /* isAppPage */));
return new ArrayList<>(mControllers);
}
}
diff --git a/src/com/android/settings/notification/NotificationSettingsBase.java b/src/com/android/settings/notification/NotificationSettingsBase.java
index 32d8e91..fdd71e5 100644
--- a/src/com/android/settings/notification/NotificationSettingsBase.java
+++ b/src/com/android/settings/notification/NotificationSettingsBase.java
@@ -53,6 +53,7 @@
import com.android.settings.R;
import com.android.settings.SettingsActivity;
+import com.android.settings.Utils;
import com.android.settings.applications.AppInfoBase;
import com.android.settings.core.SubSettingLauncher;
import com.android.settings.dashboard.DashboardFragment;
@@ -279,6 +280,12 @@
return null;
}
+ private Drawable getAlertingIcon() {
+ Drawable icon = getContext().getDrawable(R.drawable.ic_notifications);
+ icon.setTintList(Utils.getColorAccent(getContext()));
+ return icon;
+ }
+
protected Preference populateSingleChannelPrefs(PreferenceGroup parent,
final NotificationChannel channel, final boolean groupBlocked) {
MasterSwitchPreference channelPref = new MasterSwitchPreference(getPrefContext());
@@ -286,8 +293,10 @@
&& isChannelBlockable(channel)
&& isChannelConfigurable(channel)
&& !groupBlocked);
- channelPref.setIcon(channel.getImportance() > IMPORTANCE_LOW
- ? R.drawable.ic_notification_alert : R.drawable.ic_notification_silence);
+ channelPref.setIcon(null);
+ if (channel.getImportance() > IMPORTANCE_LOW) {
+ channelPref.setIcon(getAlertingIcon());
+ }
channelPref.setIconSize(MasterSwitchPreference.ICON_SIZE_SMALL);
channelPref.setKey(channel.getId());
channelPref.setTitle(channel.getName());
@@ -314,9 +323,10 @@
channel.lockFields(
NotificationChannel.USER_LOCKED_IMPORTANCE);
MasterSwitchPreference channelPref1 = (MasterSwitchPreference) preference;
- channelPref1.setIcon(channel.getImportance() > IMPORTANCE_LOW
- ? R.drawable.ic_notification_alert
- : R.drawable.ic_notification_silence);
+ channelPref1.setIcon(null);
+ if (channel.getImportance() > IMPORTANCE_LOW) {
+ channelPref1.setIcon(getAlertingIcon());
+ }
toggleBehaviorIconState(channelPref1.getIcon(),
importance != IMPORTANCE_NONE);
mBackend.updateChannel(mPkg, mUid, channel);
@@ -330,9 +340,14 @@
}
private void toggleBehaviorIconState(Drawable icon, boolean enabled) {
+ if (icon == null) return;
+
LayerDrawable layerDrawable = (LayerDrawable) icon;
GradientDrawable background =
(GradientDrawable) layerDrawable.findDrawableByLayerId(R.id.back);
+
+ if (background == null) return;
+
if (enabled) {
background.clearColorFilter();
} else {
diff --git a/src/com/android/settings/wifi/details/WifiDetailPreferenceController.java b/src/com/android/settings/wifi/details/WifiDetailPreferenceController.java
index 5f3cbb2..5e49b2e 100644
--- a/src/com/android/settings/wifi/details/WifiDetailPreferenceController.java
+++ b/src/com/android/settings/wifi/details/WifiDetailPreferenceController.java
@@ -54,7 +54,6 @@
import androidx.annotation.VisibleForTesting;
import androidx.core.text.BidiFormatter;
-import androidx.fragment.app.Fragment;
import androidx.preference.Preference;
import androidx.preference.PreferenceCategory;
import androidx.preference.PreferenceFragmentCompat;
@@ -151,7 +150,7 @@
private AccessPoint mAccessPoint;
private final ConnectivityManager mConnectivityManager;
- private final Fragment mFragment;
+ private final PreferenceFragmentCompat mFragment;
private final Handler mHandler;
private LinkProperties mLinkProperties;
private Network mNetwork;
@@ -296,7 +295,7 @@
AccessPoint accessPoint,
ConnectivityManager connectivityManager,
Context context,
- Fragment fragment,
+ PreferenceFragmentCompat fragment,
Handler handler,
Lifecycle lifecycle,
WifiManager wifiManager,
@@ -311,7 +310,7 @@
AccessPoint accessPoint,
ConnectivityManager connectivityManager,
Context context,
- Fragment fragment,
+ PreferenceFragmentCompat fragment,
Handler handler,
Lifecycle lifecycle,
WifiManager wifiManager,
@@ -441,9 +440,11 @@
if (usingDataUsageHeader(mContext)) {
mSummaryHeaderController.updateState(mDataUsageSummaryPref);
} else {
- mEntityHeaderController.setSummary(
- mAccessPoint.getSettingsSummary(true /*convertSavedAsDisconnected*/))
- .done(mFragment.getActivity(), true /* rebind */);
+ mEntityHeaderController
+ .setSummary(
+ mAccessPoint.getSettingsSummary(true /*convertSavedAsDisconnected*/))
+ .setRecyclerView(mFragment.getListView(), mLifecycle)
+ .done(mFragment.getActivity(), true /* rebind */);
}
}
diff --git a/tests/robotests/src/com/android/settings/network/telephony/MobileNetworkUtilsTest.java b/tests/robotests/src/com/android/settings/network/telephony/MobileNetworkUtilsTest.java
index 61599e6..2bfaeca 100644
--- a/tests/robotests/src/com/android/settings/network/telephony/MobileNetworkUtilsTest.java
+++ b/tests/robotests/src/com/android/settings/network/telephony/MobileNetworkUtilsTest.java
@@ -219,4 +219,86 @@
assertThat(MobileNetworkUtils.shouldDisplayNetworkSelectOptions(mContext, SUB_ID_1))
.isTrue();
}
+
+ @Test
+ public void shouldSpeciallyUpdateGsmCdma_notWorldMode_returnFalse() {
+ mCarrierConfig.putBoolean(CarrierConfigManager.KEY_WORLD_MODE_ENABLED_BOOL, false);
+ mCarrierConfig.putBoolean(CarrierConfigManager.KEY_SUPPORT_TDSCDMA_BOOL, false);
+
+ assertThat(MobileNetworkUtils.shouldSpeciallyUpdateGsmCdma(mContext, SUB_ID_1)).isFalse();
+ }
+
+ @Test
+ public void shouldSpeciallyUpdateGsmCdma_supportTdscdma_returnFalse() {
+ mCarrierConfig.putBoolean(CarrierConfigManager.KEY_WORLD_MODE_ENABLED_BOOL, true);
+ mCarrierConfig.putBoolean(CarrierConfigManager.KEY_SUPPORT_TDSCDMA_BOOL, true);
+
+ assertThat(MobileNetworkUtils.shouldSpeciallyUpdateGsmCdma(mContext, SUB_ID_1)).isFalse();
+ }
+
+ @Test
+ public void shouldSpeciallyUpdateGsmCdma_ModeLteTdscdmaGsm_returnTrue() {
+ mCarrierConfig.putBoolean(CarrierConfigManager.KEY_WORLD_MODE_ENABLED_BOOL, true);
+ mCarrierConfig.putBoolean(CarrierConfigManager.KEY_SUPPORT_TDSCDMA_BOOL, false);
+
+ Settings.Global.putInt(mContext.getContentResolver(),
+ android.provider.Settings.Global.PREFERRED_NETWORK_MODE + SUB_ID_1,
+ TelephonyManager.NETWORK_MODE_LTE_TDSCDMA_GSM);
+ assertThat(MobileNetworkUtils.shouldSpeciallyUpdateGsmCdma(mContext, SUB_ID_1)).isTrue();
+ }
+
+ @Test
+ public void shouldSpeciallyUpdateGsmCdma_ModeLteTdscdmaGsmWcdma_returnTrue() {
+ mCarrierConfig.putBoolean(CarrierConfigManager.KEY_WORLD_MODE_ENABLED_BOOL, true);
+ mCarrierConfig.putBoolean(CarrierConfigManager.KEY_SUPPORT_TDSCDMA_BOOL, false);
+
+ Settings.Global.putInt(mContext.getContentResolver(),
+ android.provider.Settings.Global.PREFERRED_NETWORK_MODE + SUB_ID_1,
+ TelephonyManager.NETWORK_MODE_LTE_TDSCDMA_GSM_WCDMA);
+ assertThat(MobileNetworkUtils.shouldSpeciallyUpdateGsmCdma(mContext, SUB_ID_1)).isTrue();
+ }
+
+ @Test
+ public void shouldSpeciallyUpdateGsmCdma_ModeLteTdscdma_returnTrue() {
+ mCarrierConfig.putBoolean(CarrierConfigManager.KEY_WORLD_MODE_ENABLED_BOOL, true);
+ mCarrierConfig.putBoolean(CarrierConfigManager.KEY_SUPPORT_TDSCDMA_BOOL, false);
+
+ Settings.Global.putInt(mContext.getContentResolver(),
+ android.provider.Settings.Global.PREFERRED_NETWORK_MODE + SUB_ID_1,
+ TelephonyManager.NETWORK_MODE_LTE_TDSCDMA);
+ assertThat(MobileNetworkUtils.shouldSpeciallyUpdateGsmCdma(mContext, SUB_ID_1)).isTrue();
+ }
+
+ @Test
+ public void shouldSpeciallyUpdateGsmCdma_ModeLteTdscdmaWcdma_returnTrue() {
+ mCarrierConfig.putBoolean(CarrierConfigManager.KEY_WORLD_MODE_ENABLED_BOOL, true);
+ mCarrierConfig.putBoolean(CarrierConfigManager.KEY_SUPPORT_TDSCDMA_BOOL, false);
+
+ Settings.Global.putInt(mContext.getContentResolver(),
+ android.provider.Settings.Global.PREFERRED_NETWORK_MODE + SUB_ID_1,
+ TelephonyManager.NETWORK_MODE_LTE_TDSCDMA_WCDMA);
+ assertThat(MobileNetworkUtils.shouldSpeciallyUpdateGsmCdma(mContext, SUB_ID_1)).isTrue();
+ }
+
+ @Test
+ public void shouldSpeciallyUpdateGsmCdma_ModeLteTdscdmaCdmaEvdoGsmWcdma_returnTrue() {
+ mCarrierConfig.putBoolean(CarrierConfigManager.KEY_WORLD_MODE_ENABLED_BOOL, true);
+ mCarrierConfig.putBoolean(CarrierConfigManager.KEY_SUPPORT_TDSCDMA_BOOL, false);
+
+ Settings.Global.putInt(mContext.getContentResolver(),
+ android.provider.Settings.Global.PREFERRED_NETWORK_MODE + SUB_ID_1,
+ TelephonyManager.NETWORK_MODE_LTE_TDSCDMA_CDMA_EVDO_GSM_WCDMA);
+ assertThat(MobileNetworkUtils.shouldSpeciallyUpdateGsmCdma(mContext, SUB_ID_1)).isTrue();
+ }
+
+ @Test
+ public void shouldSpeciallyUpdateGsmCdma_ModeLteCdmaEvdoGsmWcdma_returnTrue() {
+ mCarrierConfig.putBoolean(CarrierConfigManager.KEY_WORLD_MODE_ENABLED_BOOL, true);
+ mCarrierConfig.putBoolean(CarrierConfigManager.KEY_SUPPORT_TDSCDMA_BOOL, false);
+
+ Settings.Global.putInt(mContext.getContentResolver(),
+ android.provider.Settings.Global.PREFERRED_NETWORK_MODE + SUB_ID_1,
+ TelephonyManager.NETWORK_MODE_LTE_CDMA_EVDO_GSM_WCDMA);
+ assertThat(MobileNetworkUtils.shouldSpeciallyUpdateGsmCdma(mContext, SUB_ID_1)).isTrue();
+ }
}
diff --git a/tests/robotests/src/com/android/settings/notification/BubblePreferenceControllerTest.java b/tests/robotests/src/com/android/settings/notification/BubblePreferenceControllerTest.java
index 67324e9..aafefb51 100644
--- a/tests/robotests/src/com/android/settings/notification/BubblePreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/notification/BubblePreferenceControllerTest.java
@@ -78,6 +78,7 @@
private FragmentManager mFragmentManager;
private BubblePreferenceController mController;
+ private BubblePreferenceController mAppPageController;
@Before
public void setUp() {
@@ -87,7 +88,10 @@
shadowApplication.setSystemService(Context.USER_SERVICE, mUm);
mContext = RuntimeEnvironment.application;
when(mFragmentManager.beginTransaction()).thenReturn(mock(FragmentTransaction.class));
- mController = spy(new BubblePreferenceController(mContext, mFragmentManager, mBackend));
+ mController = spy(new BubblePreferenceController(mContext, mFragmentManager, mBackend,
+ false /* isAppPage */));
+ mAppPageController = spy(new BubblePreferenceController(mContext, mFragmentManager,
+ mBackend, true /* isAppPage */));
}
@Test
@@ -151,6 +155,16 @@
}
@Test
+ public void testIsAvailable_app_evenIfOffGlobally() {
+ NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
+ mAppPageController.onResume(appRow, null, null, null);
+ Settings.Secure.putInt(mContext.getContentResolver(),
+ NOTIFICATION_BUBBLES, SYSTEM_WIDE_OFF);
+
+ assertTrue(mAppPageController.isAvailable());
+ }
+
+ @Test
public void testIsAvailable_app() {
NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
mController.onResume(appRow, null, null, null);