Loading packages/SystemUI/res/layout/internet_connectivity_dialog.xml +5 −0 Original line number Diff line number Diff line Loading @@ -190,6 +190,11 @@ </LinearLayout> <ViewStub android:id="@+id/secondary_mobile_network_stub" android:inflatedId="@+id/secondary_mobile_network_layout" android:layout="@layout/qs_dialog_secondary_mobile_network" style="@style/InternetDialog.Network"/> <LinearLayout android:id="@+id/turn_on_wifi_layout" style="@style/InternetDialog.Network" Loading packages/SystemUI/res/layout/qs_dialog_secondary_mobile_network.xml 0 → 100644 +63 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- ~ 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. --> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" style="@style/InternetDialog.Network"> <FrameLayout android:layout_width="24dp" android:layout_height="24dp" android:clickable="false" android:layout_gravity="center_vertical|start"> <ImageView android:id="@+id/secondary_signal_icon" android:autoMirrored="true" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center"/> </FrameLayout> <LinearLayout android:layout_weight="1" android:orientation="vertical" android:clickable="false" android:layout_width="match_parent" android:layout_height="match_parent" android:gravity="start|center_vertical"> <TextView android:id="@+id/secondary_mobile_title" android:maxLines="1" style="@style/InternetDialog.NetworkTitle"/> <TextView android:id="@+id/secondary_mobile_summary" style="@style/InternetDialog.NetworkSummary"/> </LinearLayout> <FrameLayout android:layout_width="24dp" android:layout_height="match_parent" android:clickable="false" android:layout_gravity="end|center_vertical" android:gravity="center"> <ImageView android:id="@+id/secondary_settings_icon" android:src="@drawable/ic_settings_24dp" android:layout_width="24dp" android:layout_gravity="end|center_vertical" android:layout_height="wrap_content"/> </FrameLayout> </LinearLayout> packages/SystemUI/res/values/strings.xml +15 −0 Original line number Diff line number Diff line Loading @@ -2022,6 +2022,15 @@ <!-- Text used to refer to the user's current carrier in mobile_data_disable_message if the users's mobile network carrier name is not available [CHAR LIMIT=NONE] --> <string name="mobile_data_disable_message_default_carrier">your carrier</string> <!-- Title of the dialog to turn off data usage [CHAR LIMIT=NONE] --> <string name="auto_data_switch_disable_title">Switch back to <xliff:g id="carrier" example="T-Mobile">%s</xliff:g>?</string> <!-- Message body of the dialog to turn off data usage [CHAR LIMIT=NONE] --> <string name="auto_data_switch_disable_message">Mobile data won\’t automatically switch based on availability</string> <!-- Negative button title of the quick settings switch back to DDS dialog [CHAR LIMIT=NONE] --> <string name="auto_data_switch_dialog_negative_button">No thanks</string> <!-- Positive button title of the quick settings switch back to DDS dialog [CHAR LIMIT=NONE] --> <string name="auto_data_switch_dialog_positive_button">Yes, switch</string> <!-- Warning shown when user input has been blocked due to another app overlaying screen content. Since we don't know what the app is showing on top of the input target, we can't verify user consent. [CHAR LIMIT=NONE] --> Loading Loading @@ -2526,6 +2535,12 @@ <!-- Provider Model: Summary indicating that a SIM has an active mobile data connection [CHAR LIMIT=50] --> <string name="mobile_data_connection_active">Connected</string> <!-- Provider Model: Summary indicating that a SIM is temporarily connected to mobile data [CHAR LIMIT=50] --> <string name="mobile_data_temp_connection_active">Temporarily connected</string> <!-- Provider Model: Summary indicating that a SIM is temporarily connected to mobile data [CHAR LIMIT=50] --> <string name="mobile_data_poor_connection">Poor connection</string> <!-- Provider Model: Summary indicating that a SIM has no mobile data connection [CHAR LIMIT=50] --> <string name="mobile_data_off_summary">Mobile data won\u0027t auto\u2011connect</string> Loading packages/SystemUI/src/com/android/systemui/flags/Flags.kt +3 −0 Original line number Diff line number Diff line Loading @@ -152,6 +152,9 @@ object Flags { // TODO(b/254512678): Tracking Bug @JvmField val NEW_FOOTER_ACTIONS = ReleasedFlag(507) // TODO(b/244064524): Tracking Bug @JvmField val QS_SECONDARY_DATA_SUB_INFO = UnreleasedFlag(508, teamfood = true) // 600- status bar // TODO(b/254513246): Tracking Bug val STATUS_BAR_USER_SWITCHER = ResourceBooleanFlag(602, R.bool.flag_user_switcher_chip) Loading packages/SystemUI/src/com/android/systemui/qs/tiles/dialog/InternetDialog.java +148 −29 Original line number Diff line number Diff line Loading @@ -39,6 +39,7 @@ import android.util.Log; import android.view.Gravity; import android.view.LayoutInflater; import android.view.View; import android.view.ViewStub; import android.view.Window; import android.view.WindowManager; import android.widget.Button; Loading @@ -62,6 +63,7 @@ import com.android.settingslib.wifi.WifiEnterpriseRestrictionUtils; import com.android.systemui.Prefs; import com.android.systemui.R; import com.android.systemui.accessibility.floatingmenu.AnnotationLinkSpan; import com.android.systemui.animation.DialogLaunchAnimator; import com.android.systemui.dagger.SysUISingleton; import com.android.systemui.dagger.qualifiers.Background; import com.android.systemui.dagger.qualifiers.Main; Loading @@ -72,6 +74,8 @@ import com.android.wifitrackerlib.WifiEntry; import java.util.List; import java.util.concurrent.Executor; import javax.inject.Inject; /** * Dialog for showing mobile network, connected Wi-Fi network and Wi-Fi networks. */ Loading @@ -86,6 +90,7 @@ public class InternetDialog extends SystemUIDialog implements private final Handler mHandler; private final Executor mBackgroundExecutor; private final DialogLaunchAnimator mDialogLaunchAnimator; @VisibleForTesting protected InternetAdapter mAdapter; Loading @@ -109,6 +114,7 @@ public class InternetDialog extends SystemUIDialog implements private LinearLayout mInternetDialogLayout; private LinearLayout mConnectedWifListLayout; private LinearLayout mMobileNetworkLayout; private LinearLayout mSecondaryMobileNetworkLayout; private LinearLayout mTurnWifiOnLayout; private LinearLayout mEthernetLayout; private TextView mWifiToggleTitleText; Loading @@ -123,6 +129,8 @@ public class InternetDialog extends SystemUIDialog implements private ImageView mSignalIcon; private TextView mMobileTitleText; private TextView mMobileSummaryText; private TextView mSecondaryMobileTitleText; private TextView mSecondaryMobileSummaryText; private TextView mAirplaneModeSummaryText; private Switch mMobileDataToggle; private View mMobileToggleDivider; Loading Loading @@ -158,9 +166,11 @@ public class InternetDialog extends SystemUIDialog implements mInternetDialogSubTitle.setText(getSubtitleText()); }; @Inject public InternetDialog(Context context, InternetDialogFactory internetDialogFactory, InternetDialogController internetDialogController, boolean canConfigMobileData, boolean canConfigWifi, boolean aboveStatusBar, UiEventLogger uiEventLogger, DialogLaunchAnimator dialogLaunchAnimator, @Main Handler handler, @Background Executor executor, KeyguardStateController keyguardStateController) { super(context); Loading @@ -183,6 +193,7 @@ public class InternetDialog extends SystemUIDialog implements mKeyguard = keyguardStateController; mUiEventLogger = uiEventLogger; mDialogLaunchAnimator = dialogLaunchAnimator; mAdapter = new InternetAdapter(mInternetDialogController); if (!aboveStatusBar) { getWindow().setType(WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY); Loading Loading @@ -287,6 +298,9 @@ public class InternetDialog extends SystemUIDialog implements mMobileNetworkLayout.setOnClickListener(null); mMobileDataToggle.setOnCheckedChangeListener(null); mConnectedWifListLayout.setOnClickListener(null); if (mSecondaryMobileNetworkLayout != null) { mSecondaryMobileNetworkLayout.setOnClickListener(null); } mSeeAllLayout.setOnClickListener(null); mWiFiToggle.setOnCheckedChangeListener(null); mDoneButton.setOnClickListener(null); Loading Loading @@ -341,6 +355,10 @@ public class InternetDialog extends SystemUIDialog implements private void setOnClickListener() { mMobileNetworkLayout.setOnClickListener(v -> { int autoSwitchNonDdsSubId = mInternetDialogController.getActiveAutoSwitchNonDdsSubId(); if (autoSwitchNonDdsSubId != SubscriptionManager.INVALID_SUBSCRIPTION_ID) { showTurnOffAutoDataSwitchDialog(autoSwitchNonDdsSubId); } mInternetDialogController.connectCarrierNetwork(); }); mMobileDataToggle.setOnCheckedChangeListener( Loading Loading @@ -385,11 +403,14 @@ public class InternetDialog extends SystemUIDialog implements if (!mInternetDialogController.hasActiveSubId() && (!isWifiEnabled || !isCarrierNetworkActive)) { mMobileNetworkLayout.setVisibility(View.GONE); if (mSecondaryMobileNetworkLayout != null) { mSecondaryMobileNetworkLayout.setVisibility(View.GONE); } } else { mMobileNetworkLayout.setVisibility(View.VISIBLE); mMobileDataToggle.setChecked(mInternetDialogController.isMobileDataEnabled()); mMobileTitleText.setText(getMobileNetworkTitle()); String summary = getMobileNetworkSummary(); mMobileTitleText.setText(getMobileNetworkTitle(mDefaultDataSubId)); String summary = getMobileNetworkSummary(mDefaultDataSubId); if (!TextUtils.isEmpty(summary)) { mMobileSummaryText.setText( Html.fromHtml(summary, Html.FROM_HTML_MODE_LEGACY)); Loading @@ -399,28 +420,11 @@ public class InternetDialog extends SystemUIDialog implements mMobileSummaryText.setVisibility(View.GONE); } mBackgroundExecutor.execute(() -> { Drawable drawable = getSignalStrengthDrawable(); Drawable drawable = getSignalStrengthDrawable(mDefaultDataSubId); mHandler.post(() -> { mSignalIcon.setImageDrawable(drawable); }); }); mMobileTitleText.setTextAppearance(isNetworkConnected ? R.style.TextAppearance_InternetDialog_Active : R.style.TextAppearance_InternetDialog); int secondaryRes = isNetworkConnected ? R.style.TextAppearance_InternetDialog_Secondary_Active : R.style.TextAppearance_InternetDialog_Secondary; mMobileSummaryText.setTextAppearance(secondaryRes); // Set airplane mode to the summary for carrier network if (mInternetDialogController.isAirplaneModeEnabled()) { mAirplaneModeSummaryText.setVisibility(View.VISIBLE); mAirplaneModeSummaryText.setText(mContext.getText(R.string.airplane_mode)); mAirplaneModeSummaryText.setTextAppearance(secondaryRes); } else { mAirplaneModeSummaryText.setVisibility(View.GONE); } mMobileNetworkLayout.setBackground( isNetworkConnected ? mBackgroundOn : mBackgroundOff); TypedArray array = mContext.obtainStyledAttributes( R.style.InternetDialog_Divider_Active, new int[]{android.R.attr.background}); Loading @@ -433,6 +437,86 @@ public class InternetDialog extends SystemUIDialog implements mMobileDataToggle.setVisibility(mCanConfigMobileData ? View.VISIBLE : View.INVISIBLE); mMobileToggleDivider.setVisibility( mCanConfigMobileData ? View.VISIBLE : View.INVISIBLE); // Display the info for the non-DDS if it's actively being used int autoSwitchNonDdsSubId = mInternetDialogController.getActiveAutoSwitchNonDdsSubId(); int nonDdsVisibility = autoSwitchNonDdsSubId != SubscriptionManager.INVALID_SUBSCRIPTION_ID ? View.VISIBLE : View.GONE; int secondaryRes = isNetworkConnected ? R.style.TextAppearance_InternetDialog_Secondary_Active : R.style.TextAppearance_InternetDialog_Secondary; if (nonDdsVisibility == View.VISIBLE) { // non DDS is the currently active sub, set primary visual for it ViewStub stub = mDialogView.findViewById(R.id.secondary_mobile_network_stub); if (stub != null) { stub.inflate(); } mSecondaryMobileNetworkLayout = findViewById(R.id.secondary_mobile_network_layout); mSecondaryMobileNetworkLayout.setOnClickListener( this::onClickConnectedSecondarySub); mSecondaryMobileNetworkLayout.setBackground(mBackgroundOn); mSecondaryMobileTitleText = mDialogView.requireViewById( R.id.secondary_mobile_title); mSecondaryMobileTitleText.setText(getMobileNetworkTitle(autoSwitchNonDdsSubId)); mSecondaryMobileTitleText.setTextAppearance( R.style.TextAppearance_InternetDialog_Active); mSecondaryMobileSummaryText = mDialogView.requireViewById(R.id.secondary_mobile_summary); summary = getMobileNetworkSummary(autoSwitchNonDdsSubId); if (!TextUtils.isEmpty(summary)) { mSecondaryMobileSummaryText.setText( Html.fromHtml(summary, Html.FROM_HTML_MODE_LEGACY)); mSecondaryMobileSummaryText.setBreakStrategy(Layout.BREAK_STRATEGY_SIMPLE); mSecondaryMobileSummaryText.setTextAppearance( R.style.TextAppearance_InternetDialog_Active); } ImageView mSecondarySignalIcon = mDialogView.requireViewById(R.id.secondary_signal_icon); mBackgroundExecutor.execute(() -> { Drawable drawable = getSignalStrengthDrawable(autoSwitchNonDdsSubId); mHandler.post(() -> { mSecondarySignalIcon.setImageDrawable(drawable); }); }); ImageView mSecondaryMobileSettingsIcon = mDialogView.requireViewById(R.id.secondary_settings_icon); mSecondaryMobileSettingsIcon.setColorFilter( mContext.getColor(R.color.connected_network_primary_color)); // set secondary visual for default data sub mMobileNetworkLayout.setBackground(mBackgroundOff); mMobileTitleText.setTextAppearance(R.style.TextAppearance_InternetDialog); mMobileSummaryText.setTextAppearance( R.style.TextAppearance_InternetDialog_Secondary); mSignalIcon.setColorFilter( mContext.getColor(R.color.connected_network_secondary_color)); } else { mMobileNetworkLayout.setBackground( isNetworkConnected ? mBackgroundOn : mBackgroundOff); mMobileTitleText.setTextAppearance(isNetworkConnected ? R.style.TextAppearance_InternetDialog_Active : R.style.TextAppearance_InternetDialog); mMobileSummaryText.setTextAppearance(secondaryRes); } if (mSecondaryMobileNetworkLayout != null) { mSecondaryMobileNetworkLayout.setVisibility(nonDdsVisibility); } // Set airplane mode to the summary for carrier network if (mInternetDialogController.isAirplaneModeEnabled()) { mAirplaneModeSummaryText.setVisibility(View.VISIBLE); mAirplaneModeSummaryText.setText(mContext.getText(R.string.airplane_mode)); mAirplaneModeSummaryText.setTextAppearance(secondaryRes); } else { mAirplaneModeSummaryText.setVisibility(View.GONE); } } } Loading Loading @@ -471,6 +555,10 @@ public class InternetDialog extends SystemUIDialog implements mInternetDialogController.getInternetWifiDrawable(mConnectedWifiEntry)); mWifiSettingsIcon.setColorFilter( mContext.getColor(R.color.connected_network_primary_color)); if (mSecondaryMobileNetworkLayout != null) { mSecondaryMobileNetworkLayout.setVisibility(View.GONE); } } @MainThread Loading Loading @@ -541,6 +629,11 @@ public class InternetDialog extends SystemUIDialog implements mInternetDialogController.launchWifiDetailsSetting(mConnectedWifiEntry.getKey(), view); } /** For DSDS auto data switch **/ void onClickConnectedSecondarySub(View view) { mInternetDialogController.launchMobileNetworkSettings(view); } void onClickSeeMoreButton(View view) { mInternetDialogController.launchNetworkSetting(view); } Loading @@ -555,16 +648,16 @@ public class InternetDialog extends SystemUIDialog implements mIsProgressBarVisible && !mIsSearchingHidden); } private Drawable getSignalStrengthDrawable() { return mInternetDialogController.getSignalStrengthDrawable(); private Drawable getSignalStrengthDrawable(int subId) { return mInternetDialogController.getSignalStrengthDrawable(subId); } CharSequence getMobileNetworkTitle() { return mInternetDialogController.getMobileNetworkTitle(); CharSequence getMobileNetworkTitle(int subId) { return mInternetDialogController.getMobileNetworkTitle(subId); } String getMobileNetworkSummary() { return mInternetDialogController.getMobileNetworkSummary(); String getMobileNetworkSummary(int subId) { return mInternetDialogController.getMobileNetworkSummary(subId); } protected void showProgressBar() { Loading Loading @@ -602,8 +695,8 @@ public class InternetDialog extends SystemUIDialog implements } private void showTurnOffMobileDialog() { CharSequence carrierName = getMobileNetworkTitle(); boolean isInService = mInternetDialogController.isVoiceStateInService(); CharSequence carrierName = getMobileNetworkTitle(mDefaultDataSubId); boolean isInService = mInternetDialogController.isVoiceStateInService(mDefaultDataSubId); if (TextUtils.isEmpty(carrierName) || !isInService) { carrierName = mContext.getString(R.string.mobile_data_disable_message_default_carrier); } Loading @@ -627,7 +720,33 @@ public class InternetDialog extends SystemUIDialog implements SystemUIDialog.setShowForAllUsers(mAlertDialog, true); SystemUIDialog.registerDismissListener(mAlertDialog); SystemUIDialog.setWindowOnTop(mAlertDialog, mKeyguard.isShowing()); mAlertDialog.show(); mDialogLaunchAnimator.showFromDialog(mAlertDialog, this, null, false); } private void showTurnOffAutoDataSwitchDialog(int subId) { CharSequence carrierName = getMobileNetworkTitle(mDefaultDataSubId); if (TextUtils.isEmpty(carrierName)) { carrierName = mContext.getString(R.string.mobile_data_disable_message_default_carrier); } mAlertDialog = new Builder(mContext) .setTitle(mContext.getString(R.string.auto_data_switch_disable_title, carrierName)) .setMessage(R.string.auto_data_switch_disable_message) .setNegativeButton(R.string.auto_data_switch_dialog_negative_button, (d, w) -> {}) .setPositiveButton(R.string.auto_data_switch_dialog_positive_button, (d, w) -> { mInternetDialogController .setAutoDataSwitchMobileDataPolicy(subId, false); if (mSecondaryMobileNetworkLayout != null) { mSecondaryMobileNetworkLayout.setVisibility(View.GONE); } }) .create(); mAlertDialog.getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG); SystemUIDialog.setShowForAllUsers(mAlertDialog, true); SystemUIDialog.registerDismissListener(mAlertDialog); SystemUIDialog.setWindowOnTop(mAlertDialog, mKeyguard.isShowing()); mDialogLaunchAnimator.showFromDialog(mAlertDialog, this, null, false); } @Override Loading Loading
packages/SystemUI/res/layout/internet_connectivity_dialog.xml +5 −0 Original line number Diff line number Diff line Loading @@ -190,6 +190,11 @@ </LinearLayout> <ViewStub android:id="@+id/secondary_mobile_network_stub" android:inflatedId="@+id/secondary_mobile_network_layout" android:layout="@layout/qs_dialog_secondary_mobile_network" style="@style/InternetDialog.Network"/> <LinearLayout android:id="@+id/turn_on_wifi_layout" style="@style/InternetDialog.Network" Loading
packages/SystemUI/res/layout/qs_dialog_secondary_mobile_network.xml 0 → 100644 +63 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- ~ 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. --> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" style="@style/InternetDialog.Network"> <FrameLayout android:layout_width="24dp" android:layout_height="24dp" android:clickable="false" android:layout_gravity="center_vertical|start"> <ImageView android:id="@+id/secondary_signal_icon" android:autoMirrored="true" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center"/> </FrameLayout> <LinearLayout android:layout_weight="1" android:orientation="vertical" android:clickable="false" android:layout_width="match_parent" android:layout_height="match_parent" android:gravity="start|center_vertical"> <TextView android:id="@+id/secondary_mobile_title" android:maxLines="1" style="@style/InternetDialog.NetworkTitle"/> <TextView android:id="@+id/secondary_mobile_summary" style="@style/InternetDialog.NetworkSummary"/> </LinearLayout> <FrameLayout android:layout_width="24dp" android:layout_height="match_parent" android:clickable="false" android:layout_gravity="end|center_vertical" android:gravity="center"> <ImageView android:id="@+id/secondary_settings_icon" android:src="@drawable/ic_settings_24dp" android:layout_width="24dp" android:layout_gravity="end|center_vertical" android:layout_height="wrap_content"/> </FrameLayout> </LinearLayout>
packages/SystemUI/res/values/strings.xml +15 −0 Original line number Diff line number Diff line Loading @@ -2022,6 +2022,15 @@ <!-- Text used to refer to the user's current carrier in mobile_data_disable_message if the users's mobile network carrier name is not available [CHAR LIMIT=NONE] --> <string name="mobile_data_disable_message_default_carrier">your carrier</string> <!-- Title of the dialog to turn off data usage [CHAR LIMIT=NONE] --> <string name="auto_data_switch_disable_title">Switch back to <xliff:g id="carrier" example="T-Mobile">%s</xliff:g>?</string> <!-- Message body of the dialog to turn off data usage [CHAR LIMIT=NONE] --> <string name="auto_data_switch_disable_message">Mobile data won\’t automatically switch based on availability</string> <!-- Negative button title of the quick settings switch back to DDS dialog [CHAR LIMIT=NONE] --> <string name="auto_data_switch_dialog_negative_button">No thanks</string> <!-- Positive button title of the quick settings switch back to DDS dialog [CHAR LIMIT=NONE] --> <string name="auto_data_switch_dialog_positive_button">Yes, switch</string> <!-- Warning shown when user input has been blocked due to another app overlaying screen content. Since we don't know what the app is showing on top of the input target, we can't verify user consent. [CHAR LIMIT=NONE] --> Loading Loading @@ -2526,6 +2535,12 @@ <!-- Provider Model: Summary indicating that a SIM has an active mobile data connection [CHAR LIMIT=50] --> <string name="mobile_data_connection_active">Connected</string> <!-- Provider Model: Summary indicating that a SIM is temporarily connected to mobile data [CHAR LIMIT=50] --> <string name="mobile_data_temp_connection_active">Temporarily connected</string> <!-- Provider Model: Summary indicating that a SIM is temporarily connected to mobile data [CHAR LIMIT=50] --> <string name="mobile_data_poor_connection">Poor connection</string> <!-- Provider Model: Summary indicating that a SIM has no mobile data connection [CHAR LIMIT=50] --> <string name="mobile_data_off_summary">Mobile data won\u0027t auto\u2011connect</string> Loading
packages/SystemUI/src/com/android/systemui/flags/Flags.kt +3 −0 Original line number Diff line number Diff line Loading @@ -152,6 +152,9 @@ object Flags { // TODO(b/254512678): Tracking Bug @JvmField val NEW_FOOTER_ACTIONS = ReleasedFlag(507) // TODO(b/244064524): Tracking Bug @JvmField val QS_SECONDARY_DATA_SUB_INFO = UnreleasedFlag(508, teamfood = true) // 600- status bar // TODO(b/254513246): Tracking Bug val STATUS_BAR_USER_SWITCHER = ResourceBooleanFlag(602, R.bool.flag_user_switcher_chip) Loading
packages/SystemUI/src/com/android/systemui/qs/tiles/dialog/InternetDialog.java +148 −29 Original line number Diff line number Diff line Loading @@ -39,6 +39,7 @@ import android.util.Log; import android.view.Gravity; import android.view.LayoutInflater; import android.view.View; import android.view.ViewStub; import android.view.Window; import android.view.WindowManager; import android.widget.Button; Loading @@ -62,6 +63,7 @@ import com.android.settingslib.wifi.WifiEnterpriseRestrictionUtils; import com.android.systemui.Prefs; import com.android.systemui.R; import com.android.systemui.accessibility.floatingmenu.AnnotationLinkSpan; import com.android.systemui.animation.DialogLaunchAnimator; import com.android.systemui.dagger.SysUISingleton; import com.android.systemui.dagger.qualifiers.Background; import com.android.systemui.dagger.qualifiers.Main; Loading @@ -72,6 +74,8 @@ import com.android.wifitrackerlib.WifiEntry; import java.util.List; import java.util.concurrent.Executor; import javax.inject.Inject; /** * Dialog for showing mobile network, connected Wi-Fi network and Wi-Fi networks. */ Loading @@ -86,6 +90,7 @@ public class InternetDialog extends SystemUIDialog implements private final Handler mHandler; private final Executor mBackgroundExecutor; private final DialogLaunchAnimator mDialogLaunchAnimator; @VisibleForTesting protected InternetAdapter mAdapter; Loading @@ -109,6 +114,7 @@ public class InternetDialog extends SystemUIDialog implements private LinearLayout mInternetDialogLayout; private LinearLayout mConnectedWifListLayout; private LinearLayout mMobileNetworkLayout; private LinearLayout mSecondaryMobileNetworkLayout; private LinearLayout mTurnWifiOnLayout; private LinearLayout mEthernetLayout; private TextView mWifiToggleTitleText; Loading @@ -123,6 +129,8 @@ public class InternetDialog extends SystemUIDialog implements private ImageView mSignalIcon; private TextView mMobileTitleText; private TextView mMobileSummaryText; private TextView mSecondaryMobileTitleText; private TextView mSecondaryMobileSummaryText; private TextView mAirplaneModeSummaryText; private Switch mMobileDataToggle; private View mMobileToggleDivider; Loading Loading @@ -158,9 +166,11 @@ public class InternetDialog extends SystemUIDialog implements mInternetDialogSubTitle.setText(getSubtitleText()); }; @Inject public InternetDialog(Context context, InternetDialogFactory internetDialogFactory, InternetDialogController internetDialogController, boolean canConfigMobileData, boolean canConfigWifi, boolean aboveStatusBar, UiEventLogger uiEventLogger, DialogLaunchAnimator dialogLaunchAnimator, @Main Handler handler, @Background Executor executor, KeyguardStateController keyguardStateController) { super(context); Loading @@ -183,6 +193,7 @@ public class InternetDialog extends SystemUIDialog implements mKeyguard = keyguardStateController; mUiEventLogger = uiEventLogger; mDialogLaunchAnimator = dialogLaunchAnimator; mAdapter = new InternetAdapter(mInternetDialogController); if (!aboveStatusBar) { getWindow().setType(WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY); Loading Loading @@ -287,6 +298,9 @@ public class InternetDialog extends SystemUIDialog implements mMobileNetworkLayout.setOnClickListener(null); mMobileDataToggle.setOnCheckedChangeListener(null); mConnectedWifListLayout.setOnClickListener(null); if (mSecondaryMobileNetworkLayout != null) { mSecondaryMobileNetworkLayout.setOnClickListener(null); } mSeeAllLayout.setOnClickListener(null); mWiFiToggle.setOnCheckedChangeListener(null); mDoneButton.setOnClickListener(null); Loading Loading @@ -341,6 +355,10 @@ public class InternetDialog extends SystemUIDialog implements private void setOnClickListener() { mMobileNetworkLayout.setOnClickListener(v -> { int autoSwitchNonDdsSubId = mInternetDialogController.getActiveAutoSwitchNonDdsSubId(); if (autoSwitchNonDdsSubId != SubscriptionManager.INVALID_SUBSCRIPTION_ID) { showTurnOffAutoDataSwitchDialog(autoSwitchNonDdsSubId); } mInternetDialogController.connectCarrierNetwork(); }); mMobileDataToggle.setOnCheckedChangeListener( Loading Loading @@ -385,11 +403,14 @@ public class InternetDialog extends SystemUIDialog implements if (!mInternetDialogController.hasActiveSubId() && (!isWifiEnabled || !isCarrierNetworkActive)) { mMobileNetworkLayout.setVisibility(View.GONE); if (mSecondaryMobileNetworkLayout != null) { mSecondaryMobileNetworkLayout.setVisibility(View.GONE); } } else { mMobileNetworkLayout.setVisibility(View.VISIBLE); mMobileDataToggle.setChecked(mInternetDialogController.isMobileDataEnabled()); mMobileTitleText.setText(getMobileNetworkTitle()); String summary = getMobileNetworkSummary(); mMobileTitleText.setText(getMobileNetworkTitle(mDefaultDataSubId)); String summary = getMobileNetworkSummary(mDefaultDataSubId); if (!TextUtils.isEmpty(summary)) { mMobileSummaryText.setText( Html.fromHtml(summary, Html.FROM_HTML_MODE_LEGACY)); Loading @@ -399,28 +420,11 @@ public class InternetDialog extends SystemUIDialog implements mMobileSummaryText.setVisibility(View.GONE); } mBackgroundExecutor.execute(() -> { Drawable drawable = getSignalStrengthDrawable(); Drawable drawable = getSignalStrengthDrawable(mDefaultDataSubId); mHandler.post(() -> { mSignalIcon.setImageDrawable(drawable); }); }); mMobileTitleText.setTextAppearance(isNetworkConnected ? R.style.TextAppearance_InternetDialog_Active : R.style.TextAppearance_InternetDialog); int secondaryRes = isNetworkConnected ? R.style.TextAppearance_InternetDialog_Secondary_Active : R.style.TextAppearance_InternetDialog_Secondary; mMobileSummaryText.setTextAppearance(secondaryRes); // Set airplane mode to the summary for carrier network if (mInternetDialogController.isAirplaneModeEnabled()) { mAirplaneModeSummaryText.setVisibility(View.VISIBLE); mAirplaneModeSummaryText.setText(mContext.getText(R.string.airplane_mode)); mAirplaneModeSummaryText.setTextAppearance(secondaryRes); } else { mAirplaneModeSummaryText.setVisibility(View.GONE); } mMobileNetworkLayout.setBackground( isNetworkConnected ? mBackgroundOn : mBackgroundOff); TypedArray array = mContext.obtainStyledAttributes( R.style.InternetDialog_Divider_Active, new int[]{android.R.attr.background}); Loading @@ -433,6 +437,86 @@ public class InternetDialog extends SystemUIDialog implements mMobileDataToggle.setVisibility(mCanConfigMobileData ? View.VISIBLE : View.INVISIBLE); mMobileToggleDivider.setVisibility( mCanConfigMobileData ? View.VISIBLE : View.INVISIBLE); // Display the info for the non-DDS if it's actively being used int autoSwitchNonDdsSubId = mInternetDialogController.getActiveAutoSwitchNonDdsSubId(); int nonDdsVisibility = autoSwitchNonDdsSubId != SubscriptionManager.INVALID_SUBSCRIPTION_ID ? View.VISIBLE : View.GONE; int secondaryRes = isNetworkConnected ? R.style.TextAppearance_InternetDialog_Secondary_Active : R.style.TextAppearance_InternetDialog_Secondary; if (nonDdsVisibility == View.VISIBLE) { // non DDS is the currently active sub, set primary visual for it ViewStub stub = mDialogView.findViewById(R.id.secondary_mobile_network_stub); if (stub != null) { stub.inflate(); } mSecondaryMobileNetworkLayout = findViewById(R.id.secondary_mobile_network_layout); mSecondaryMobileNetworkLayout.setOnClickListener( this::onClickConnectedSecondarySub); mSecondaryMobileNetworkLayout.setBackground(mBackgroundOn); mSecondaryMobileTitleText = mDialogView.requireViewById( R.id.secondary_mobile_title); mSecondaryMobileTitleText.setText(getMobileNetworkTitle(autoSwitchNonDdsSubId)); mSecondaryMobileTitleText.setTextAppearance( R.style.TextAppearance_InternetDialog_Active); mSecondaryMobileSummaryText = mDialogView.requireViewById(R.id.secondary_mobile_summary); summary = getMobileNetworkSummary(autoSwitchNonDdsSubId); if (!TextUtils.isEmpty(summary)) { mSecondaryMobileSummaryText.setText( Html.fromHtml(summary, Html.FROM_HTML_MODE_LEGACY)); mSecondaryMobileSummaryText.setBreakStrategy(Layout.BREAK_STRATEGY_SIMPLE); mSecondaryMobileSummaryText.setTextAppearance( R.style.TextAppearance_InternetDialog_Active); } ImageView mSecondarySignalIcon = mDialogView.requireViewById(R.id.secondary_signal_icon); mBackgroundExecutor.execute(() -> { Drawable drawable = getSignalStrengthDrawable(autoSwitchNonDdsSubId); mHandler.post(() -> { mSecondarySignalIcon.setImageDrawable(drawable); }); }); ImageView mSecondaryMobileSettingsIcon = mDialogView.requireViewById(R.id.secondary_settings_icon); mSecondaryMobileSettingsIcon.setColorFilter( mContext.getColor(R.color.connected_network_primary_color)); // set secondary visual for default data sub mMobileNetworkLayout.setBackground(mBackgroundOff); mMobileTitleText.setTextAppearance(R.style.TextAppearance_InternetDialog); mMobileSummaryText.setTextAppearance( R.style.TextAppearance_InternetDialog_Secondary); mSignalIcon.setColorFilter( mContext.getColor(R.color.connected_network_secondary_color)); } else { mMobileNetworkLayout.setBackground( isNetworkConnected ? mBackgroundOn : mBackgroundOff); mMobileTitleText.setTextAppearance(isNetworkConnected ? R.style.TextAppearance_InternetDialog_Active : R.style.TextAppearance_InternetDialog); mMobileSummaryText.setTextAppearance(secondaryRes); } if (mSecondaryMobileNetworkLayout != null) { mSecondaryMobileNetworkLayout.setVisibility(nonDdsVisibility); } // Set airplane mode to the summary for carrier network if (mInternetDialogController.isAirplaneModeEnabled()) { mAirplaneModeSummaryText.setVisibility(View.VISIBLE); mAirplaneModeSummaryText.setText(mContext.getText(R.string.airplane_mode)); mAirplaneModeSummaryText.setTextAppearance(secondaryRes); } else { mAirplaneModeSummaryText.setVisibility(View.GONE); } } } Loading Loading @@ -471,6 +555,10 @@ public class InternetDialog extends SystemUIDialog implements mInternetDialogController.getInternetWifiDrawable(mConnectedWifiEntry)); mWifiSettingsIcon.setColorFilter( mContext.getColor(R.color.connected_network_primary_color)); if (mSecondaryMobileNetworkLayout != null) { mSecondaryMobileNetworkLayout.setVisibility(View.GONE); } } @MainThread Loading Loading @@ -541,6 +629,11 @@ public class InternetDialog extends SystemUIDialog implements mInternetDialogController.launchWifiDetailsSetting(mConnectedWifiEntry.getKey(), view); } /** For DSDS auto data switch **/ void onClickConnectedSecondarySub(View view) { mInternetDialogController.launchMobileNetworkSettings(view); } void onClickSeeMoreButton(View view) { mInternetDialogController.launchNetworkSetting(view); } Loading @@ -555,16 +648,16 @@ public class InternetDialog extends SystemUIDialog implements mIsProgressBarVisible && !mIsSearchingHidden); } private Drawable getSignalStrengthDrawable() { return mInternetDialogController.getSignalStrengthDrawable(); private Drawable getSignalStrengthDrawable(int subId) { return mInternetDialogController.getSignalStrengthDrawable(subId); } CharSequence getMobileNetworkTitle() { return mInternetDialogController.getMobileNetworkTitle(); CharSequence getMobileNetworkTitle(int subId) { return mInternetDialogController.getMobileNetworkTitle(subId); } String getMobileNetworkSummary() { return mInternetDialogController.getMobileNetworkSummary(); String getMobileNetworkSummary(int subId) { return mInternetDialogController.getMobileNetworkSummary(subId); } protected void showProgressBar() { Loading Loading @@ -602,8 +695,8 @@ public class InternetDialog extends SystemUIDialog implements } private void showTurnOffMobileDialog() { CharSequence carrierName = getMobileNetworkTitle(); boolean isInService = mInternetDialogController.isVoiceStateInService(); CharSequence carrierName = getMobileNetworkTitle(mDefaultDataSubId); boolean isInService = mInternetDialogController.isVoiceStateInService(mDefaultDataSubId); if (TextUtils.isEmpty(carrierName) || !isInService) { carrierName = mContext.getString(R.string.mobile_data_disable_message_default_carrier); } Loading @@ -627,7 +720,33 @@ public class InternetDialog extends SystemUIDialog implements SystemUIDialog.setShowForAllUsers(mAlertDialog, true); SystemUIDialog.registerDismissListener(mAlertDialog); SystemUIDialog.setWindowOnTop(mAlertDialog, mKeyguard.isShowing()); mAlertDialog.show(); mDialogLaunchAnimator.showFromDialog(mAlertDialog, this, null, false); } private void showTurnOffAutoDataSwitchDialog(int subId) { CharSequence carrierName = getMobileNetworkTitle(mDefaultDataSubId); if (TextUtils.isEmpty(carrierName)) { carrierName = mContext.getString(R.string.mobile_data_disable_message_default_carrier); } mAlertDialog = new Builder(mContext) .setTitle(mContext.getString(R.string.auto_data_switch_disable_title, carrierName)) .setMessage(R.string.auto_data_switch_disable_message) .setNegativeButton(R.string.auto_data_switch_dialog_negative_button, (d, w) -> {}) .setPositiveButton(R.string.auto_data_switch_dialog_positive_button, (d, w) -> { mInternetDialogController .setAutoDataSwitchMobileDataPolicy(subId, false); if (mSecondaryMobileNetworkLayout != null) { mSecondaryMobileNetworkLayout.setVisibility(View.GONE); } }) .create(); mAlertDialog.getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG); SystemUIDialog.setShowForAllUsers(mAlertDialog, true); SystemUIDialog.registerDismissListener(mAlertDialog); SystemUIDialog.setWindowOnTop(mAlertDialog, mKeyguard.isShowing()); mDialogLaunchAnimator.showFromDialog(mAlertDialog, this, null, false); } @Override Loading