Introduce new Disconnect functionality for Wifi networks in Internet

Panel only

- Display the close icon on the Wi-Fi network connected to the Internet,
and performs the same action as tapping on the carrier network when
tapped it.

- Display the cog icon on the Wi-Fi network if it has no the Internet
access.

- Screenshot:
  https://screenshot.googleplex.com/YBQ8onG2dFJ8Q2a

Bug: 187995278
Test: manual test
atest -c ProviderModelSliceTest

Change-Id: Id54a94c1fdfc37aff5cc37d6fb9f5478c0dccb00
This commit is contained in:
Weng Su
2021-05-19 01:52:05 +08:00
parent f6712e330a
commit 3d2950c8af
4 changed files with 70 additions and 4 deletions

View File

@@ -183,7 +183,7 @@ public class WifiSlice implements CustomSliceable {
return Utils.createIconWithDrawable(drawable);
}
private IconCompat getEndIcon(WifiSliceItem wifiSliceItem) {
protected IconCompat getEndIcon(WifiSliceItem wifiSliceItem) {
if (wifiSliceItem.getConnectedState() != WifiEntry.CONNECTED_STATE_DISCONNECTED) {
return IconCompat.createWithResource(mContext, R.drawable.ic_settings_24dp);
}
@@ -194,7 +194,7 @@ public class WifiSlice implements CustomSliceable {
return null;
}
private SliceAction getWifiEntryAction(WifiSliceItem wifiSliceItem, IconCompat icon,
protected SliceAction getWifiEntryAction(WifiSliceItem wifiSliceItem, IconCompat icon,
CharSequence title) {
final int requestCode = wifiSliceItem.getKey().hashCode();

View File

@@ -36,6 +36,7 @@ public class WifiSliceItem {
private final int mLevel;
private final boolean mShouldShowXLevelIcon;
private final boolean mShouldEditBeforeConnect;
private final boolean mHasInternetAccess;
private final String mSummary;
// These values must be kept within [WifiEntry.WIFI_LEVEL_MIN, WifiEntry.WIFI_LEVEL_MAX]
@@ -56,6 +57,7 @@ public class WifiSliceItem {
mLevel = wifiEntry.getLevel();
mShouldShowXLevelIcon = wifiEntry.shouldShowXLevelIcon();
mShouldEditBeforeConnect = wifiEntry.shouldEditBeforeConnect();
mHasInternetAccess = wifiEntry.hasInternetAccess();
mSummary = wifiEntry.getSummary(false /* concise */);
}
@@ -111,6 +113,13 @@ public class WifiSliceItem {
return mShouldShowXLevelIcon;
}
/**
* Returns true when the Wi-Fi network has Internet access.
*/
public boolean hasInternetAccess() {
return mHasInternetAccess;
}
/**
* In Wi-Fi picker, when users click a saved network, it will connect to the Wi-Fi network.
* However, for some special cases, Wi-Fi picker should show Wi-Fi editor UI for users to edit