Add place holder rows to wifi slice.
When loading wifi slice, the wifitracker is super slow to scan and return APs. So we will show up to 3 rows of placeholder in the slice UI. - When building slice, if there are at least 3 APs, show first 3. - When there aren't enough APs, show them all and fill the rest of placeholder rows. Bug: 118224581 Test: robotests Change-Id: Id332f64bfa335543ea406f73b249f93504d63d4f
This commit is contained in:
@@ -17,6 +17,11 @@
|
||||
|
||||
package com.android.settings.wifi;
|
||||
|
||||
import static android.app.slice.Slice.HINT_LIST_ITEM;
|
||||
import static android.app.slice.SliceItem.FORMAT_SLICE;
|
||||
|
||||
import static com.android.settings.wifi.WifiSlice.DEFAULT_EXPANDED_ROW_COUNT;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
|
||||
import android.content.Context;
|
||||
@@ -29,6 +34,7 @@ import androidx.slice.SliceItem;
|
||||
import androidx.slice.SliceMetadata;
|
||||
import androidx.slice.SliceProvider;
|
||||
import androidx.slice.core.SliceAction;
|
||||
import androidx.slice.core.SliceQuery;
|
||||
import androidx.slice.widget.SliceLiveData;
|
||||
|
||||
import com.android.settings.R;
|
||||
@@ -60,7 +66,7 @@ public class WifiSliceTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getWifiSlice_correctSliceContent() {
|
||||
public void getWifiSlice_shouldHaveTitleAndToggle() {
|
||||
final Slice wifiSlice = mWifiSlice.getSlice();
|
||||
final SliceMetadata metadata = SliceMetadata.from(mContext, wifiSlice);
|
||||
|
||||
@@ -76,6 +82,17 @@ public class WifiSliceTest {
|
||||
SliceTester.assertTitle(sliceItems, mContext.getString(R.string.wifi_settings));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getWifiSlice_noAp_shouldReturnPlaceholder() {
|
||||
final Slice wifiSlice = mWifiSlice.getSlice();
|
||||
|
||||
int rows = SliceQuery.findAll(wifiSlice, FORMAT_SLICE, HINT_LIST_ITEM,
|
||||
null /* nonHints */).size();
|
||||
// All AP rows + title row + see more row
|
||||
// (see more row will drop the last AP row, thus -1)
|
||||
assertThat(rows).isEqualTo(DEFAULT_EXPANDED_ROW_COUNT - 1 + 2);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void handleUriChange_updatesWifi() {
|
||||
final Intent intent = mWifiSlice.getIntent();
|
||||
|
||||
Reference in New Issue
Block a user