Loading packages/SettingsLib/src/com/android/settingslib/wifi/dpp/WifiDppIntentHelper.java +5 −0 Original line number Diff line number Diff line Loading @@ -28,6 +28,11 @@ import java.util.List; * Wifi dpp intent helper functions to share between the Settings App and SystemUI. */ public class WifiDppIntentHelper { /** * Action added to the intent when app wants to launch the QR code generator with lock screen. */ public static final String ACTION_CONFIGURATOR_AUTH_QR_CODE_GENERATOR = "android.settings.WIFI_DPP_CONFIGURATOR_AUTH_QR_CODE_GENERATOR"; static final String EXTRA_WIFI_SECURITY = "security"; /** The data corresponding to {@code WifiConfiguration} SSID */ Loading packages/SystemUI/res/layout/internet_connectivity_dialog.xml +17 −5 Original line number Diff line number Diff line Loading @@ -416,11 +416,22 @@ android:focusable="true"/> </LinearLayout> <LinearLayout <RelativeLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginStart="16dp" android:layout_gravity="end|center_vertical"> android:gravity="center_vertical"> <Button android:id="@+id/share_wifi_button" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/share_wifi_button_text" style="?android:attr/buttonBarNeutralButtonStyle" android:maxLines="1" android:ellipsize="end" android:clickable="true" android:focusable="true" android:layout_alignParentLeft="true" android:visibility="gone"/> <Button android:id="@+id/done_button" android:layout_width="wrap_content" Loading @@ -430,8 +441,9 @@ android:maxLines="1" android:ellipsize="end" android:clickable="true" android:focusable="true"/> </LinearLayout> android:focusable="true" android:layout_alignParentRight="true"/> </RelativeLayout> </LinearLayout> </LinearLayout> Loading packages/SystemUI/res/values/strings.xml +3 −0 Original line number Diff line number Diff line Loading @@ -156,6 +156,9 @@ <!-- Button label for declining language change [CHAR LIMIT=25] --> <string name="hdmi_cec_set_menu_language_decline">Keep current language</string> <!-- Button label to share wifi [CHAR_LIMIT=20] --> <string name="share_wifi_button_text">Share Wi\u2011Fi</string> <!-- Title of confirmation dialog for wireless debugging [CHAR LIMIT=NONE] --> <string name="wifi_debugging_title">Allow wireless debugging on this network?</string> Loading packages/SystemUI/src/com/android/systemui/qs/tiles/dialog/InternetDialog.java +28 −6 Original line number Diff line number Diff line Loading @@ -134,6 +134,9 @@ public class InternetDialog extends SystemUIDialog implements private View mMobileToggleDivider; private Switch mWiFiToggle; private Button mDoneButton; @VisibleForTesting protected Button mShareWifiButton; private Button mAirplaneModeButton; private Drawable mBackgroundOn; private KeyguardStateController mKeyguard; Loading @@ -142,7 +145,6 @@ public class InternetDialog extends SystemUIDialog implements private int mDefaultDataSubId = SubscriptionManager.INVALID_SUBSCRIPTION_ID; private boolean mCanConfigMobileData; private boolean mCanChangeWifiState; // Wi-Fi entries private int mWifiNetworkHeight; @Nullable Loading Loading @@ -236,6 +238,7 @@ public class InternetDialog extends SystemUIDialog implements mWifiRecyclerView = mDialogView.requireViewById(R.id.wifi_list_layout); mSeeAllLayout = mDialogView.requireViewById(R.id.see_all_layout); mDoneButton = mDialogView.requireViewById(R.id.done_button); mShareWifiButton = mDialogView.requireViewById(R.id.share_wifi_button); mAirplaneModeButton = mDialogView.requireViewById(R.id.apm_button); mSignalIcon = mDialogView.requireViewById(R.id.signal_icon); mMobileTitleText = mDialogView.requireViewById(R.id.mobile_title); Loading Loading @@ -274,6 +277,7 @@ public class InternetDialog extends SystemUIDialog implements mConnectedWifListLayout.setVisibility(View.GONE); mWifiRecyclerView.setVisibility(View.GONE); mSeeAllLayout.setVisibility(View.GONE); mShareWifiButton.setVisibility(View.GONE); } @Override Loading @@ -291,6 +295,7 @@ public class InternetDialog extends SystemUIDialog implements mSeeAllLayout.setOnClickListener(null); mWiFiToggle.setOnCheckedChangeListener(null); mDoneButton.setOnClickListener(null); mShareWifiButton.setOnClickListener(null); mAirplaneModeButton.setOnClickListener(null); mInternetDialogController.onStop(); mInternetDialogFactory.destroyDialog(); Loading Loading @@ -366,6 +371,11 @@ public class InternetDialog extends SystemUIDialog implements mInternetDialogController.setWifiEnabled(isChecked); }); mDoneButton.setOnClickListener(v -> dismiss()); mShareWifiButton.setOnClickListener(v -> { if (mInternetDialogController.mayLaunchShareWifiSettings(mConnectedWifiEntry)) { mUiEventLogger.log(InternetDialogEvent.SHARE_WIFI_QS_BUTTON_CLICKED); } }); mAirplaneModeButton.setOnClickListener(v -> { mInternetDialogController.setAirplaneModeDisabled(); }); Loading Loading @@ -526,6 +536,7 @@ public class InternetDialog extends SystemUIDialog implements private void updateConnectedWifi(boolean isWifiEnabled, boolean isDeviceLocked) { if (!isWifiEnabled || mConnectedWifiEntry == null || isDeviceLocked) { mConnectedWifListLayout.setVisibility(View.GONE); mShareWifiButton.setVisibility(View.GONE); return; } mConnectedWifListLayout.setVisibility(View.VISIBLE); Loading @@ -535,6 +546,12 @@ public class InternetDialog extends SystemUIDialog implements mInternetDialogController.getInternetWifiDrawable(mConnectedWifiEntry)); mWifiSettingsIcon.setColorFilter( mContext.getColor(R.color.connected_network_primary_color)); if (mInternetDialogController.getConfiguratorQrCodeGeneratorIntentOrNull( mConnectedWifiEntry) != null) { mShareWifiButton.setVisibility(View.VISIBLE); } else { mShareWifiButton.setVisibility(View.GONE); } if (mSecondaryMobileNetworkLayout != null) { mSecondaryMobileNetworkLayout.setVisibility(View.GONE); Loading Loading @@ -683,7 +700,8 @@ public class InternetDialog extends SystemUIDialog implements mAlertDialog = new Builder(mContext) .setTitle(R.string.mobile_data_disable_title) .setMessage(mContext.getString(R.string.mobile_data_disable_message, carrierName)) .setNegativeButton(android.R.string.cancel, (d, w) -> {}) .setNegativeButton(android.R.string.cancel, (d, w) -> { }) .setPositiveButton( com.android.internal.R.string.alert_windows_notification_turn_off_action, (d, w) -> { Loading @@ -709,7 +727,8 @@ public class InternetDialog extends SystemUIDialog implements .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) -> {}) (d, w) -> { }) .setPositiveButton(R.string.auto_data_switch_dialog_positive_button, (d, w) -> { mInternetDialogController Loading Loading @@ -815,7 +834,10 @@ public class InternetDialog extends SystemUIDialog implements public enum InternetDialogEvent implements UiEventLogger.UiEventEnum { @UiEvent(doc = "The Internet dialog became visible on the screen.") INTERNET_DIALOG_SHOW(843); INTERNET_DIALOG_SHOW(843), @UiEvent(doc = "The share wifi button is clicked.") SHARE_WIFI_QS_BUTTON_CLICKED(1462); private final int mId; Loading packages/SystemUI/src/com/android/systemui/qs/tiles/dialog/InternetDialogController.java +26 −0 Original line number Diff line number Diff line Loading @@ -73,6 +73,7 @@ import com.android.settingslib.mobile.MobileMappings; import com.android.settingslib.mobile.TelephonyIcons; import com.android.settingslib.net.SignalStrengthUtil; import com.android.settingslib.wifi.WifiUtils; import com.android.settingslib.wifi.dpp.WifiDppIntentHelper; import com.android.systemui.R; import com.android.systemui.animation.ActivityLaunchAnimator; import com.android.systemui.animation.DialogLaunchAnimator; Loading Loading @@ -1318,6 +1319,18 @@ public class InternetDialogController implements AccessPointController.AccessPoi return mWifiIconInjector; } boolean mayLaunchShareWifiSettings(WifiEntry wifiEntry) { Intent intent = getConfiguratorQrCodeGeneratorIntentOrNull(wifiEntry); if (intent == null) { return false; } if (mCallback != null) { mCallback.dismissDialog(); } mActivityStarter.startActivity(intent, false /* dismissShade */); return true; } interface InternetDialogCallback { void onRefreshCarrierInfo(); Loading Loading @@ -1403,4 +1416,17 @@ public class InternetDialogController implements AccessPointController.AccessPoi } }, SHORT_DURATION_TIMEOUT); } Intent getConfiguratorQrCodeGeneratorIntentOrNull(WifiEntry wifiEntry) { if (!mFeatureFlags.isEnabled(Flags.SHARE_WIFI_QS_BUTTON) || wifiEntry == null || mWifiManager == null || !wifiEntry.canShare()) { return null; } Intent intent = new Intent(); intent.setAction(WifiDppIntentHelper.ACTION_CONFIGURATOR_AUTH_QR_CODE_GENERATOR); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP); WifiDppIntentHelper.setConfiguratorIntentExtra(intent, mWifiManager, wifiEntry.getWifiConfiguration()); return intent; } } Loading
packages/SettingsLib/src/com/android/settingslib/wifi/dpp/WifiDppIntentHelper.java +5 −0 Original line number Diff line number Diff line Loading @@ -28,6 +28,11 @@ import java.util.List; * Wifi dpp intent helper functions to share between the Settings App and SystemUI. */ public class WifiDppIntentHelper { /** * Action added to the intent when app wants to launch the QR code generator with lock screen. */ public static final String ACTION_CONFIGURATOR_AUTH_QR_CODE_GENERATOR = "android.settings.WIFI_DPP_CONFIGURATOR_AUTH_QR_CODE_GENERATOR"; static final String EXTRA_WIFI_SECURITY = "security"; /** The data corresponding to {@code WifiConfiguration} SSID */ Loading
packages/SystemUI/res/layout/internet_connectivity_dialog.xml +17 −5 Original line number Diff line number Diff line Loading @@ -416,11 +416,22 @@ android:focusable="true"/> </LinearLayout> <LinearLayout <RelativeLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginStart="16dp" android:layout_gravity="end|center_vertical"> android:gravity="center_vertical"> <Button android:id="@+id/share_wifi_button" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/share_wifi_button_text" style="?android:attr/buttonBarNeutralButtonStyle" android:maxLines="1" android:ellipsize="end" android:clickable="true" android:focusable="true" android:layout_alignParentLeft="true" android:visibility="gone"/> <Button android:id="@+id/done_button" android:layout_width="wrap_content" Loading @@ -430,8 +441,9 @@ android:maxLines="1" android:ellipsize="end" android:clickable="true" android:focusable="true"/> </LinearLayout> android:focusable="true" android:layout_alignParentRight="true"/> </RelativeLayout> </LinearLayout> </LinearLayout> Loading
packages/SystemUI/res/values/strings.xml +3 −0 Original line number Diff line number Diff line Loading @@ -156,6 +156,9 @@ <!-- Button label for declining language change [CHAR LIMIT=25] --> <string name="hdmi_cec_set_menu_language_decline">Keep current language</string> <!-- Button label to share wifi [CHAR_LIMIT=20] --> <string name="share_wifi_button_text">Share Wi\u2011Fi</string> <!-- Title of confirmation dialog for wireless debugging [CHAR LIMIT=NONE] --> <string name="wifi_debugging_title">Allow wireless debugging on this network?</string> Loading
packages/SystemUI/src/com/android/systemui/qs/tiles/dialog/InternetDialog.java +28 −6 Original line number Diff line number Diff line Loading @@ -134,6 +134,9 @@ public class InternetDialog extends SystemUIDialog implements private View mMobileToggleDivider; private Switch mWiFiToggle; private Button mDoneButton; @VisibleForTesting protected Button mShareWifiButton; private Button mAirplaneModeButton; private Drawable mBackgroundOn; private KeyguardStateController mKeyguard; Loading @@ -142,7 +145,6 @@ public class InternetDialog extends SystemUIDialog implements private int mDefaultDataSubId = SubscriptionManager.INVALID_SUBSCRIPTION_ID; private boolean mCanConfigMobileData; private boolean mCanChangeWifiState; // Wi-Fi entries private int mWifiNetworkHeight; @Nullable Loading Loading @@ -236,6 +238,7 @@ public class InternetDialog extends SystemUIDialog implements mWifiRecyclerView = mDialogView.requireViewById(R.id.wifi_list_layout); mSeeAllLayout = mDialogView.requireViewById(R.id.see_all_layout); mDoneButton = mDialogView.requireViewById(R.id.done_button); mShareWifiButton = mDialogView.requireViewById(R.id.share_wifi_button); mAirplaneModeButton = mDialogView.requireViewById(R.id.apm_button); mSignalIcon = mDialogView.requireViewById(R.id.signal_icon); mMobileTitleText = mDialogView.requireViewById(R.id.mobile_title); Loading Loading @@ -274,6 +277,7 @@ public class InternetDialog extends SystemUIDialog implements mConnectedWifListLayout.setVisibility(View.GONE); mWifiRecyclerView.setVisibility(View.GONE); mSeeAllLayout.setVisibility(View.GONE); mShareWifiButton.setVisibility(View.GONE); } @Override Loading @@ -291,6 +295,7 @@ public class InternetDialog extends SystemUIDialog implements mSeeAllLayout.setOnClickListener(null); mWiFiToggle.setOnCheckedChangeListener(null); mDoneButton.setOnClickListener(null); mShareWifiButton.setOnClickListener(null); mAirplaneModeButton.setOnClickListener(null); mInternetDialogController.onStop(); mInternetDialogFactory.destroyDialog(); Loading Loading @@ -366,6 +371,11 @@ public class InternetDialog extends SystemUIDialog implements mInternetDialogController.setWifiEnabled(isChecked); }); mDoneButton.setOnClickListener(v -> dismiss()); mShareWifiButton.setOnClickListener(v -> { if (mInternetDialogController.mayLaunchShareWifiSettings(mConnectedWifiEntry)) { mUiEventLogger.log(InternetDialogEvent.SHARE_WIFI_QS_BUTTON_CLICKED); } }); mAirplaneModeButton.setOnClickListener(v -> { mInternetDialogController.setAirplaneModeDisabled(); }); Loading Loading @@ -526,6 +536,7 @@ public class InternetDialog extends SystemUIDialog implements private void updateConnectedWifi(boolean isWifiEnabled, boolean isDeviceLocked) { if (!isWifiEnabled || mConnectedWifiEntry == null || isDeviceLocked) { mConnectedWifListLayout.setVisibility(View.GONE); mShareWifiButton.setVisibility(View.GONE); return; } mConnectedWifListLayout.setVisibility(View.VISIBLE); Loading @@ -535,6 +546,12 @@ public class InternetDialog extends SystemUIDialog implements mInternetDialogController.getInternetWifiDrawable(mConnectedWifiEntry)); mWifiSettingsIcon.setColorFilter( mContext.getColor(R.color.connected_network_primary_color)); if (mInternetDialogController.getConfiguratorQrCodeGeneratorIntentOrNull( mConnectedWifiEntry) != null) { mShareWifiButton.setVisibility(View.VISIBLE); } else { mShareWifiButton.setVisibility(View.GONE); } if (mSecondaryMobileNetworkLayout != null) { mSecondaryMobileNetworkLayout.setVisibility(View.GONE); Loading Loading @@ -683,7 +700,8 @@ public class InternetDialog extends SystemUIDialog implements mAlertDialog = new Builder(mContext) .setTitle(R.string.mobile_data_disable_title) .setMessage(mContext.getString(R.string.mobile_data_disable_message, carrierName)) .setNegativeButton(android.R.string.cancel, (d, w) -> {}) .setNegativeButton(android.R.string.cancel, (d, w) -> { }) .setPositiveButton( com.android.internal.R.string.alert_windows_notification_turn_off_action, (d, w) -> { Loading @@ -709,7 +727,8 @@ public class InternetDialog extends SystemUIDialog implements .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) -> {}) (d, w) -> { }) .setPositiveButton(R.string.auto_data_switch_dialog_positive_button, (d, w) -> { mInternetDialogController Loading Loading @@ -815,7 +834,10 @@ public class InternetDialog extends SystemUIDialog implements public enum InternetDialogEvent implements UiEventLogger.UiEventEnum { @UiEvent(doc = "The Internet dialog became visible on the screen.") INTERNET_DIALOG_SHOW(843); INTERNET_DIALOG_SHOW(843), @UiEvent(doc = "The share wifi button is clicked.") SHARE_WIFI_QS_BUTTON_CLICKED(1462); private final int mId; Loading
packages/SystemUI/src/com/android/systemui/qs/tiles/dialog/InternetDialogController.java +26 −0 Original line number Diff line number Diff line Loading @@ -73,6 +73,7 @@ import com.android.settingslib.mobile.MobileMappings; import com.android.settingslib.mobile.TelephonyIcons; import com.android.settingslib.net.SignalStrengthUtil; import com.android.settingslib.wifi.WifiUtils; import com.android.settingslib.wifi.dpp.WifiDppIntentHelper; import com.android.systemui.R; import com.android.systemui.animation.ActivityLaunchAnimator; import com.android.systemui.animation.DialogLaunchAnimator; Loading Loading @@ -1318,6 +1319,18 @@ public class InternetDialogController implements AccessPointController.AccessPoi return mWifiIconInjector; } boolean mayLaunchShareWifiSettings(WifiEntry wifiEntry) { Intent intent = getConfiguratorQrCodeGeneratorIntentOrNull(wifiEntry); if (intent == null) { return false; } if (mCallback != null) { mCallback.dismissDialog(); } mActivityStarter.startActivity(intent, false /* dismissShade */); return true; } interface InternetDialogCallback { void onRefreshCarrierInfo(); Loading Loading @@ -1403,4 +1416,17 @@ public class InternetDialogController implements AccessPointController.AccessPoi } }, SHORT_DURATION_TIMEOUT); } Intent getConfiguratorQrCodeGeneratorIntentOrNull(WifiEntry wifiEntry) { if (!mFeatureFlags.isEnabled(Flags.SHARE_WIFI_QS_BUTTON) || wifiEntry == null || mWifiManager == null || !wifiEntry.canShare()) { return null; } Intent intent = new Intent(); intent.setAction(WifiDppIntentHelper.ACTION_CONFIGURATOR_AUTH_QR_CODE_GENERATOR); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP); WifiDppIntentHelper.setConfiguratorIntentExtra(intent, mWifiManager, wifiEntry.getWifiConfiguration()); return intent; } }