Merge "Moving the error messages from slice to panel's subtitle" into sc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
45726b937b
@@ -147,31 +147,6 @@ public class ProviderModelSlice extends WifiSlice {
|
||||
listBuilder.addRow(getWifiSliceItemRow(item));
|
||||
}
|
||||
}
|
||||
|
||||
// Fifth section: If device has connection problem, this row show the message for user.
|
||||
// 1) show non_carrier_network_unavailable:
|
||||
// - while no wifi item
|
||||
// 2) show all_network_unavailable:
|
||||
// - while no wifi item + no carrier
|
||||
// - while no wifi item + no data capability
|
||||
if (worker == null || wifiList == null || wifiList.size() == 0) {
|
||||
log("no wifi item");
|
||||
int resId = R.string.non_carrier_network_unavailable;
|
||||
if (!hasCarrier || !mHelper.isDataSimActive()) {
|
||||
log("No carrier item or no carrier data.");
|
||||
resId = R.string.all_network_unavailable;
|
||||
}
|
||||
|
||||
if (!hasCarrier && !hasEthernet) {
|
||||
// If there is no item in ProviderModelItem, slice needs a header.
|
||||
listBuilder.setHeader(mHelper.createHeader(
|
||||
NetworkProviderSettings.ACTION_NETWORK_PROVIDER_SETTINGS));
|
||||
}
|
||||
listBuilder.addGridRow(
|
||||
mHelper.createMessageGridRow(resId,
|
||||
NetworkProviderSettings.ACTION_NETWORK_PROVIDER_SETTINGS));
|
||||
}
|
||||
|
||||
return listBuilder.build();
|
||||
}
|
||||
|
||||
|
@@ -36,7 +36,6 @@ import android.util.Log;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
import androidx.core.graphics.drawable.IconCompat;
|
||||
import androidx.slice.builders.GridRowBuilder;
|
||||
import androidx.slice.builders.ListBuilder;
|
||||
import androidx.slice.builders.SliceAction;
|
||||
|
||||
@@ -79,12 +78,6 @@ public class ProviderModelSliceHelper {
|
||||
Log.d(TAG, s);
|
||||
}
|
||||
|
||||
protected ListBuilder.HeaderBuilder createHeader(String intentAction) {
|
||||
return new ListBuilder.HeaderBuilder()
|
||||
.setTitle(mContext.getText(R.string.summary_placeholder))
|
||||
.setPrimaryAction(getPrimarySliceAction(intentAction));
|
||||
}
|
||||
|
||||
protected ListBuilder createListBuilder(Uri uri) {
|
||||
final ListBuilder builder = new ListBuilder(mContext, uri, ListBuilder.INFINITY)
|
||||
.setAccentColor(-1)
|
||||
@@ -92,14 +85,6 @@ public class ProviderModelSliceHelper {
|
||||
return builder;
|
||||
}
|
||||
|
||||
protected GridRowBuilder createMessageGridRow(int messageResId, String intentAction) {
|
||||
final CharSequence title = mContext.getText(messageResId);
|
||||
return new GridRowBuilder()
|
||||
// Add cells to the grid row.
|
||||
.addCell(new GridRowBuilder.CellBuilder().addTitleText(title))
|
||||
.setPrimaryAction(getPrimarySliceAction(intentAction));
|
||||
}
|
||||
|
||||
@Nullable
|
||||
protected WifiSliceItem getConnectedWifiItem(List<WifiSliceItem> wifiList) {
|
||||
if (wifiList == null) {
|
||||
@@ -111,7 +96,10 @@ public class ProviderModelSliceHelper {
|
||||
return item.isPresent() ? item.get() : null;
|
||||
}
|
||||
|
||||
protected boolean hasCarrier() {
|
||||
/**
|
||||
* @return whether there is the carrier item in the slice.
|
||||
*/
|
||||
public boolean hasCarrier() {
|
||||
if (isAirplaneModeEnabled()
|
||||
|| mSubscriptionManager == null || mTelephonyManager == null
|
||||
|| mSubscriptionManager.getDefaultDataSubscriptionId()
|
||||
@@ -175,7 +163,12 @@ public class ProviderModelSliceHelper {
|
||||
return mTelephonyManager.isDataEnabled();
|
||||
}
|
||||
|
||||
protected boolean isDataSimActive() {
|
||||
/**
|
||||
* To check the carrier data status.
|
||||
*
|
||||
* @return whether the carrier data is active.
|
||||
*/
|
||||
public boolean isDataSimActive() {
|
||||
return isNoCarrierData() ? false : MobileNetworkUtils.activeNetworkIsCellular(mContext);
|
||||
}
|
||||
|
||||
@@ -193,11 +186,6 @@ public class ProviderModelSliceHelper {
|
||||
return mobileDataOnAndNoData || mobileDataOffAndOutOfService;
|
||||
}
|
||||
|
||||
private boolean isAirplaneSafeNetworksModeEnabled() {
|
||||
// TODO: isAirplaneSafeNetworksModeEnabled is not READY
|
||||
return false;
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
Drawable getMobileDrawable(Drawable drawable) throws Throwable {
|
||||
// set color and drawable
|
||||
|
Reference in New Issue
Block a user