Merge "[SystemUI] 1.Remove the unnecessary log 2. update signal icon in bg thread" into sc-qpr1-dev
This commit is contained in:
@@ -66,11 +66,13 @@ import com.android.systemui.Prefs;
|
|||||||
import com.android.systemui.R;
|
import com.android.systemui.R;
|
||||||
import com.android.systemui.accessibility.floatingmenu.AnnotationLinkSpan;
|
import com.android.systemui.accessibility.floatingmenu.AnnotationLinkSpan;
|
||||||
import com.android.systemui.dagger.SysUISingleton;
|
import com.android.systemui.dagger.SysUISingleton;
|
||||||
|
import com.android.systemui.dagger.qualifiers.Background;
|
||||||
import com.android.systemui.dagger.qualifiers.Main;
|
import com.android.systemui.dagger.qualifiers.Main;
|
||||||
import com.android.systemui.statusbar.phone.SystemUIDialog;
|
import com.android.systemui.statusbar.phone.SystemUIDialog;
|
||||||
import com.android.wifitrackerlib.WifiEntry;
|
import com.android.wifitrackerlib.WifiEntry;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.concurrent.Executor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Dialog for showing mobile network, connected Wi-Fi network and Wi-Fi networks.
|
* Dialog for showing mobile network, connected Wi-Fi network and Wi-Fi networks.
|
||||||
@@ -84,6 +86,7 @@ public class InternetDialog extends SystemUIDialog implements
|
|||||||
static final long PROGRESS_DELAY_MS = 2000L;
|
static final long PROGRESS_DELAY_MS = 2000L;
|
||||||
|
|
||||||
private final Handler mHandler;
|
private final Handler mHandler;
|
||||||
|
private final Executor mBackgroundExecutor;
|
||||||
private final LinearLayoutManager mLayoutManager;
|
private final LinearLayoutManager mLayoutManager;
|
||||||
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
@@ -158,13 +161,14 @@ public class InternetDialog extends SystemUIDialog implements
|
|||||||
public InternetDialog(Context context, InternetDialogFactory internetDialogFactory,
|
public InternetDialog(Context context, InternetDialogFactory internetDialogFactory,
|
||||||
InternetDialogController internetDialogController, boolean canConfigMobileData,
|
InternetDialogController internetDialogController, boolean canConfigMobileData,
|
||||||
boolean canConfigWifi, boolean aboveStatusBar, UiEventLogger uiEventLogger,
|
boolean canConfigWifi, boolean aboveStatusBar, UiEventLogger uiEventLogger,
|
||||||
@Main Handler handler) {
|
@Main Handler handler, @Background Executor executor) {
|
||||||
super(context, R.style.Theme_SystemUI_Dialog_Internet);
|
super(context, R.style.Theme_SystemUI_Dialog_Internet);
|
||||||
if (DEBUG) {
|
if (DEBUG) {
|
||||||
Log.d(TAG, "Init InternetDialog");
|
Log.d(TAG, "Init InternetDialog");
|
||||||
}
|
}
|
||||||
mContext = context;
|
mContext = context;
|
||||||
mHandler = handler;
|
mHandler = handler;
|
||||||
|
mBackgroundExecutor = executor;
|
||||||
mInternetDialogFactory = internetDialogFactory;
|
mInternetDialogFactory = internetDialogFactory;
|
||||||
mInternetDialogController = internetDialogController;
|
mInternetDialogController = internetDialogController;
|
||||||
mSubscriptionManager = mInternetDialogController.getSubscriptionManager();
|
mSubscriptionManager = mInternetDialogController.getSubscriptionManager();
|
||||||
@@ -299,7 +303,13 @@ public class InternetDialog extends SystemUIDialog implements
|
|||||||
dismiss();
|
dismiss();
|
||||||
}
|
}
|
||||||
|
|
||||||
void updateDialog() {
|
/**
|
||||||
|
* Update the internet dialog when receiving the callback.
|
||||||
|
*
|
||||||
|
* @param shouldUpdateMobileNetwork {@code true} for update the mobile network layout,
|
||||||
|
* otherwise {@code false}.
|
||||||
|
*/
|
||||||
|
void updateDialog(boolean shouldUpdateMobileNetwork) {
|
||||||
if (DEBUG) {
|
if (DEBUG) {
|
||||||
Log.d(TAG, "updateDialog");
|
Log.d(TAG, "updateDialog");
|
||||||
}
|
}
|
||||||
@@ -309,8 +319,10 @@ public class InternetDialog extends SystemUIDialog implements
|
|||||||
mInternetDialogSubTitle.setText(getSubtitleText());
|
mInternetDialogSubTitle.setText(getSubtitleText());
|
||||||
}
|
}
|
||||||
updateEthernet();
|
updateEthernet();
|
||||||
|
if (shouldUpdateMobileNetwork) {
|
||||||
setMobileDataLayout(mInternetDialogController.activeNetworkIsCellular()
|
setMobileDataLayout(mInternetDialogController.activeNetworkIsCellular()
|
||||||
|| mInternetDialogController.isCarrierNetworkActive());
|
|| mInternetDialogController.isCarrierNetworkActive());
|
||||||
|
}
|
||||||
|
|
||||||
if (!mCanConfigWifi) {
|
if (!mCanConfigWifi) {
|
||||||
return;
|
return;
|
||||||
@@ -379,7 +391,13 @@ public class InternetDialog extends SystemUIDialog implements
|
|||||||
} else {
|
} else {
|
||||||
mMobileSummaryText.setVisibility(View.GONE);
|
mMobileSummaryText.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
mSignalIcon.setImageDrawable(getSignalStrengthDrawable());
|
|
||||||
|
mBackgroundExecutor.execute(() -> {
|
||||||
|
Drawable drawable = getSignalStrengthDrawable();
|
||||||
|
mHandler.post(() -> {
|
||||||
|
mSignalIcon.setImageDrawable(drawable);
|
||||||
|
});
|
||||||
|
});
|
||||||
mMobileTitleText.setTextAppearance(isCarrierNetworkConnected
|
mMobileTitleText.setTextAppearance(isCarrierNetworkConnected
|
||||||
? R.style.TextAppearance_InternetDialog_Active
|
? R.style.TextAppearance_InternetDialog_Active
|
||||||
: R.style.TextAppearance_InternetDialog);
|
: R.style.TextAppearance_InternetDialog);
|
||||||
@@ -534,52 +552,57 @@ public class InternetDialog extends SystemUIDialog implements
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onRefreshCarrierInfo() {
|
public void onRefreshCarrierInfo() {
|
||||||
mHandler.post(() -> updateDialog());
|
mHandler.post(() -> updateDialog(true /* shouldUpdateMobileNetwork */));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSimStateChanged() {
|
public void onSimStateChanged() {
|
||||||
mHandler.post(() -> updateDialog());
|
mHandler.post(() -> updateDialog(true /* shouldUpdateMobileNetwork */));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@WorkerThread
|
@WorkerThread
|
||||||
public void onCapabilitiesChanged(Network network, NetworkCapabilities networkCapabilities) {
|
public void onCapabilitiesChanged(Network network, NetworkCapabilities networkCapabilities) {
|
||||||
mHandler.post(() -> updateDialog());
|
mHandler.post(() -> updateDialog(true /* shouldUpdateMobileNetwork */));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@WorkerThread
|
@WorkerThread
|
||||||
public void onLost(Network network) {
|
public void onLost(Network network) {
|
||||||
mHandler.post(() -> updateDialog());
|
mHandler.post(() -> updateDialog(true /* shouldUpdateMobileNetwork */));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSubscriptionsChanged(int defaultDataSubId) {
|
public void onSubscriptionsChanged(int defaultDataSubId) {
|
||||||
mDefaultDataSubId = defaultDataSubId;
|
mDefaultDataSubId = defaultDataSubId;
|
||||||
mTelephonyManager = mTelephonyManager.createForSubscriptionId(mDefaultDataSubId);
|
mTelephonyManager = mTelephonyManager.createForSubscriptionId(mDefaultDataSubId);
|
||||||
mHandler.post(() -> updateDialog());
|
mHandler.post(() -> updateDialog(true /* shouldUpdateMobileNetwork */));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onUserMobileDataStateChanged(boolean enabled) {
|
||||||
|
mHandler.post(() -> updateDialog(true /* shouldUpdateMobileNetwork */));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onServiceStateChanged(ServiceState serviceState) {
|
public void onServiceStateChanged(ServiceState serviceState) {
|
||||||
mHandler.post(() -> updateDialog());
|
mHandler.post(() -> updateDialog(true /* shouldUpdateMobileNetwork */));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@WorkerThread
|
@WorkerThread
|
||||||
public void onDataConnectionStateChanged(int state, int networkType) {
|
public void onDataConnectionStateChanged(int state, int networkType) {
|
||||||
mHandler.post(() -> updateDialog());
|
mHandler.post(() -> updateDialog(true /* shouldUpdateMobileNetwork */));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSignalStrengthsChanged(SignalStrength signalStrength) {
|
public void onSignalStrengthsChanged(SignalStrength signalStrength) {
|
||||||
mHandler.post(() -> updateDialog());
|
mHandler.post(() -> updateDialog(true /* shouldUpdateMobileNetwork */));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDisplayInfoChanged(TelephonyDisplayInfo telephonyDisplayInfo) {
|
public void onDisplayInfoChanged(TelephonyDisplayInfo telephonyDisplayInfo) {
|
||||||
mHandler.post(() -> updateDialog());
|
mHandler.post(() -> updateDialog(true /* shouldUpdateMobileNetwork */));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -591,7 +614,7 @@ public class InternetDialog extends SystemUIDialog implements
|
|||||||
mAdapter.setWifiEntries(wifiEntries, mWifiEntriesCount);
|
mAdapter.setWifiEntries(wifiEntries, mWifiEntriesCount);
|
||||||
mHandler.post(() -> {
|
mHandler.post(() -> {
|
||||||
mAdapter.notifyDataSetChanged();
|
mAdapter.notifyDataSetChanged();
|
||||||
updateDialog();
|
updateDialog(false /* shouldUpdateMobileNetwork */);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -149,6 +149,7 @@ public class InternetDialogController implements WifiEntry.DisconnectCallback,
|
|||||||
private ConnectivityManager.NetworkCallback mConnectivityManagerNetworkCallback;
|
private ConnectivityManager.NetworkCallback mConnectivityManagerNetworkCallback;
|
||||||
private WindowManager mWindowManager;
|
private WindowManager mWindowManager;
|
||||||
private ToastFactory mToastFactory;
|
private ToastFactory mToastFactory;
|
||||||
|
private SignalDrawable mSignalDrawable;
|
||||||
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
static final float TOAST_PARAMS_HORIZONTAL_WEIGHT = 1.0f;
|
static final float TOAST_PARAMS_HORIZONTAL_WEIGHT = 1.0f;
|
||||||
@@ -225,6 +226,7 @@ public class InternetDialogController implements WifiEntry.DisconnectCallback,
|
|||||||
mConnectivityManagerNetworkCallback = new DataConnectivityListener();
|
mConnectivityManagerNetworkCallback = new DataConnectivityListener();
|
||||||
mWindowManager = windowManager;
|
mWindowManager = windowManager;
|
||||||
mToastFactory = toastFactory;
|
mToastFactory = toastFactory;
|
||||||
|
mSignalDrawable = new SignalDrawable(mContext);
|
||||||
}
|
}
|
||||||
|
|
||||||
void onStart(@NonNull InternetDialogCallback callback, boolean canConfigWifi) {
|
void onStart(@NonNull InternetDialogCallback callback, boolean canConfigWifi) {
|
||||||
@@ -431,10 +433,7 @@ public class InternetDialogController implements WifiEntry.DisconnectCallback,
|
|||||||
|
|
||||||
Drawable getSignalStrengthIcon(Context context, int level, int numLevels,
|
Drawable getSignalStrengthIcon(Context context, int level, int numLevels,
|
||||||
int iconType, boolean cutOut) {
|
int iconType, boolean cutOut) {
|
||||||
Log.d(TAG, "getSignalStrengthIcon");
|
mSignalDrawable.setLevel(SignalDrawable.getState(level, numLevels, cutOut));
|
||||||
final SignalDrawable signalDrawable = new SignalDrawable(context);
|
|
||||||
signalDrawable.setLevel(
|
|
||||||
SignalDrawable.getState(level, numLevels, cutOut));
|
|
||||||
|
|
||||||
// Make the network type drawable
|
// Make the network type drawable
|
||||||
final Drawable networkDrawable =
|
final Drawable networkDrawable =
|
||||||
@@ -443,7 +442,7 @@ public class InternetDialogController implements WifiEntry.DisconnectCallback,
|
|||||||
: context.getResources().getDrawable(iconType, context.getTheme());
|
: context.getResources().getDrawable(iconType, context.getTheme());
|
||||||
|
|
||||||
// Overlay the two drawables
|
// Overlay the two drawables
|
||||||
final Drawable[] layers = {networkDrawable, signalDrawable};
|
final Drawable[] layers = {networkDrawable, mSignalDrawable};
|
||||||
final int iconSize =
|
final int iconSize =
|
||||||
context.getResources().getDimensionPixelSize(R.dimen.signal_strength_icon_size);
|
context.getResources().getDimensionPixelSize(R.dimen.signal_strength_icon_size);
|
||||||
|
|
||||||
@@ -892,7 +891,8 @@ public class InternetDialogController implements WifiEntry.DisconnectCallback,
|
|||||||
TelephonyCallback.DataConnectionStateListener,
|
TelephonyCallback.DataConnectionStateListener,
|
||||||
TelephonyCallback.DisplayInfoListener,
|
TelephonyCallback.DisplayInfoListener,
|
||||||
TelephonyCallback.ServiceStateListener,
|
TelephonyCallback.ServiceStateListener,
|
||||||
TelephonyCallback.SignalStrengthsListener {
|
TelephonyCallback.SignalStrengthsListener,
|
||||||
|
TelephonyCallback.UserMobileDataStateListener {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onServiceStateChanged(@NonNull ServiceState serviceState) {
|
public void onServiceStateChanged(@NonNull ServiceState serviceState) {
|
||||||
@@ -914,6 +914,11 @@ public class InternetDialogController implements WifiEntry.DisconnectCallback,
|
|||||||
mTelephonyDisplayInfo = telephonyDisplayInfo;
|
mTelephonyDisplayInfo = telephonyDisplayInfo;
|
||||||
mCallback.onDisplayInfoChanged(telephonyDisplayInfo);
|
mCallback.onDisplayInfoChanged(telephonyDisplayInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onUserMobileDataStateChanged(boolean enabled) {
|
||||||
|
mCallback.onUserMobileDataStateChanged(enabled);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class InternetOnSubscriptionChangedListener
|
private class InternetOnSubscriptionChangedListener
|
||||||
@@ -1018,6 +1023,8 @@ public class InternetDialogController implements WifiEntry.DisconnectCallback,
|
|||||||
|
|
||||||
void onSignalStrengthsChanged(SignalStrength signalStrength);
|
void onSignalStrengthsChanged(SignalStrength signalStrength);
|
||||||
|
|
||||||
|
void onUserMobileDataStateChanged(boolean enabled);
|
||||||
|
|
||||||
void onDisplayInfoChanged(TelephonyDisplayInfo telephonyDisplayInfo);
|
void onDisplayInfoChanged(TelephonyDisplayInfo telephonyDisplayInfo);
|
||||||
|
|
||||||
void dismissDialog();
|
void dismissDialog();
|
||||||
|
|||||||
@@ -20,7 +20,9 @@ import android.os.Handler
|
|||||||
import android.util.Log
|
import android.util.Log
|
||||||
import com.android.internal.logging.UiEventLogger
|
import com.android.internal.logging.UiEventLogger
|
||||||
import com.android.systemui.dagger.SysUISingleton
|
import com.android.systemui.dagger.SysUISingleton
|
||||||
|
import com.android.systemui.dagger.qualifiers.Background;
|
||||||
import com.android.systemui.dagger.qualifiers.Main
|
import com.android.systemui.dagger.qualifiers.Main
|
||||||
|
import java.util.concurrent.Executor
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
private const val TAG = "InternetDialogFactory"
|
private const val TAG = "InternetDialogFactory"
|
||||||
@@ -32,6 +34,7 @@ private val DEBUG = Log.isLoggable(TAG, Log.DEBUG)
|
|||||||
@SysUISingleton
|
@SysUISingleton
|
||||||
class InternetDialogFactory @Inject constructor(
|
class InternetDialogFactory @Inject constructor(
|
||||||
@Main private val handler: Handler,
|
@Main private val handler: Handler,
|
||||||
|
@Background private val executor: Executor,
|
||||||
private val internetDialogController: InternetDialogController,
|
private val internetDialogController: InternetDialogController,
|
||||||
private val context: Context,
|
private val context: Context,
|
||||||
private val uiEventLogger: UiEventLogger
|
private val uiEventLogger: UiEventLogger
|
||||||
@@ -49,7 +52,8 @@ class InternetDialogFactory @Inject constructor(
|
|||||||
return
|
return
|
||||||
} else {
|
} else {
|
||||||
internetDialog = InternetDialog(context, this, internetDialogController,
|
internetDialog = InternetDialog(context, this, internetDialogController,
|
||||||
canConfigMobileData, canConfigWifi, aboveStatusBar, uiEventLogger, handler)
|
canConfigMobileData, canConfigWifi, aboveStatusBar, uiEventLogger, handler,
|
||||||
|
executor)
|
||||||
internetDialog?.show()
|
internetDialog?.show()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,6 +27,8 @@ import androidx.test.filters.SmallTest;
|
|||||||
import com.android.internal.logging.UiEventLogger;
|
import com.android.internal.logging.UiEventLogger;
|
||||||
import com.android.systemui.R;
|
import com.android.systemui.R;
|
||||||
import com.android.systemui.SysuiTestCase;
|
import com.android.systemui.SysuiTestCase;
|
||||||
|
import com.android.systemui.util.concurrency.FakeExecutor;
|
||||||
|
import com.android.systemui.util.time.FakeSystemClock;
|
||||||
import com.android.wifitrackerlib.WifiEntry;
|
import com.android.wifitrackerlib.WifiEntry;
|
||||||
|
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
@@ -65,6 +67,7 @@ public class InternetDialogTest extends SysuiTestCase {
|
|||||||
@Mock
|
@Mock
|
||||||
private InternetDialogController mInternetDialogController;
|
private InternetDialogController mInternetDialogController;
|
||||||
|
|
||||||
|
private FakeExecutor mBgExecutor = new FakeExecutor(new FakeSystemClock());
|
||||||
private InternetDialog mInternetDialog;
|
private InternetDialog mInternetDialog;
|
||||||
private View mDialogView;
|
private View mDialogView;
|
||||||
private View mSubTitle;
|
private View mSubTitle;
|
||||||
@@ -93,7 +96,8 @@ public class InternetDialogTest extends SysuiTestCase {
|
|||||||
when(mInternetDialogController.getWifiManager()).thenReturn(mWifiManager);
|
when(mInternetDialogController.getWifiManager()).thenReturn(mWifiManager);
|
||||||
|
|
||||||
mInternetDialog = new InternetDialog(mContext, mock(InternetDialogFactory.class),
|
mInternetDialog = new InternetDialog(mContext, mock(InternetDialogFactory.class),
|
||||||
mInternetDialogController, true, true, true, mock(UiEventLogger.class), mHandler);
|
mInternetDialogController, true, true, true, mock(UiEventLogger.class), mHandler,
|
||||||
|
mBgExecutor);
|
||||||
mInternetDialog.mAdapter = mInternetAdapter;
|
mInternetDialog.mAdapter = mInternetAdapter;
|
||||||
mInternetDialog.onAccessPointsChanged(mWifiEntries, mInternetWifiEntry);
|
mInternetDialog.onAccessPointsChanged(mWifiEntries, mInternetWifiEntry);
|
||||||
mInternetDialog.show();
|
mInternetDialog.show();
|
||||||
@@ -129,7 +133,7 @@ public class InternetDialogTest extends SysuiTestCase {
|
|||||||
public void updateDialog_withApmOn_internetDialogSubTitleGone() {
|
public void updateDialog_withApmOn_internetDialogSubTitleGone() {
|
||||||
when(mInternetDialogController.isAirplaneModeEnabled()).thenReturn(true);
|
when(mInternetDialogController.isAirplaneModeEnabled()).thenReturn(true);
|
||||||
|
|
||||||
mInternetDialog.updateDialog();
|
mInternetDialog.updateDialog(true);
|
||||||
|
|
||||||
assertThat(mSubTitle.getVisibility()).isEqualTo(View.GONE);
|
assertThat(mSubTitle.getVisibility()).isEqualTo(View.GONE);
|
||||||
}
|
}
|
||||||
@@ -138,7 +142,7 @@ public class InternetDialogTest extends SysuiTestCase {
|
|||||||
public void updateDialog_withApmOff_internetDialogSubTitleVisible() {
|
public void updateDialog_withApmOff_internetDialogSubTitleVisible() {
|
||||||
when(mInternetDialogController.isAirplaneModeEnabled()).thenReturn(false);
|
when(mInternetDialogController.isAirplaneModeEnabled()).thenReturn(false);
|
||||||
|
|
||||||
mInternetDialog.updateDialog();
|
mInternetDialog.updateDialog(true);
|
||||||
|
|
||||||
assertThat(mSubTitle.getVisibility()).isEqualTo(View.VISIBLE);
|
assertThat(mSubTitle.getVisibility()).isEqualTo(View.VISIBLE);
|
||||||
}
|
}
|
||||||
@@ -148,7 +152,7 @@ public class InternetDialogTest extends SysuiTestCase {
|
|||||||
when(mInternetDialogController.isAirplaneModeEnabled()).thenReturn(false);
|
when(mInternetDialogController.isAirplaneModeEnabled()).thenReturn(false);
|
||||||
when(mInternetDialogController.hasEthernet()).thenReturn(true);
|
when(mInternetDialogController.hasEthernet()).thenReturn(true);
|
||||||
|
|
||||||
mInternetDialog.updateDialog();
|
mInternetDialog.updateDialog(true);
|
||||||
|
|
||||||
assertThat(mEthernet.getVisibility()).isEqualTo(View.VISIBLE);
|
assertThat(mEthernet.getVisibility()).isEqualTo(View.VISIBLE);
|
||||||
}
|
}
|
||||||
@@ -158,7 +162,7 @@ public class InternetDialogTest extends SysuiTestCase {
|
|||||||
when(mInternetDialogController.isAirplaneModeEnabled()).thenReturn(false);
|
when(mInternetDialogController.isAirplaneModeEnabled()).thenReturn(false);
|
||||||
when(mInternetDialogController.hasEthernet()).thenReturn(false);
|
when(mInternetDialogController.hasEthernet()).thenReturn(false);
|
||||||
|
|
||||||
mInternetDialog.updateDialog();
|
mInternetDialog.updateDialog(true);
|
||||||
|
|
||||||
assertThat(mEthernet.getVisibility()).isEqualTo(View.GONE);
|
assertThat(mEthernet.getVisibility()).isEqualTo(View.GONE);
|
||||||
}
|
}
|
||||||
@@ -168,7 +172,7 @@ public class InternetDialogTest extends SysuiTestCase {
|
|||||||
when(mInternetDialogController.isAirplaneModeEnabled()).thenReturn(true);
|
when(mInternetDialogController.isAirplaneModeEnabled()).thenReturn(true);
|
||||||
when(mInternetDialogController.hasEthernet()).thenReturn(true);
|
when(mInternetDialogController.hasEthernet()).thenReturn(true);
|
||||||
|
|
||||||
mInternetDialog.updateDialog();
|
mInternetDialog.updateDialog(true);
|
||||||
|
|
||||||
assertThat(mEthernet.getVisibility()).isEqualTo(View.VISIBLE);
|
assertThat(mEthernet.getVisibility()).isEqualTo(View.VISIBLE);
|
||||||
}
|
}
|
||||||
@@ -178,7 +182,7 @@ public class InternetDialogTest extends SysuiTestCase {
|
|||||||
when(mInternetDialogController.isAirplaneModeEnabled()).thenReturn(true);
|
when(mInternetDialogController.isAirplaneModeEnabled()).thenReturn(true);
|
||||||
when(mInternetDialogController.hasEthernet()).thenReturn(false);
|
when(mInternetDialogController.hasEthernet()).thenReturn(false);
|
||||||
|
|
||||||
mInternetDialog.updateDialog();
|
mInternetDialog.updateDialog(true);
|
||||||
|
|
||||||
assertThat(mEthernet.getVisibility()).isEqualTo(View.GONE);
|
assertThat(mEthernet.getVisibility()).isEqualTo(View.GONE);
|
||||||
}
|
}
|
||||||
@@ -187,7 +191,7 @@ public class InternetDialogTest extends SysuiTestCase {
|
|||||||
public void updateDialog_withApmOn_mobileDataLayoutGone() {
|
public void updateDialog_withApmOn_mobileDataLayoutGone() {
|
||||||
when(mInternetDialogController.isAirplaneModeEnabled()).thenReturn(true);
|
when(mInternetDialogController.isAirplaneModeEnabled()).thenReturn(true);
|
||||||
|
|
||||||
mInternetDialog.updateDialog();
|
mInternetDialog.updateDialog(true);
|
||||||
|
|
||||||
assertThat(mMobileDataToggle.getVisibility()).isEqualTo(View.GONE);
|
assertThat(mMobileDataToggle.getVisibility()).isEqualTo(View.GONE);
|
||||||
}
|
}
|
||||||
@@ -197,7 +201,7 @@ public class InternetDialogTest extends SysuiTestCase {
|
|||||||
// The preconditions WiFi ON and Internet WiFi are already in setUp()
|
// The preconditions WiFi ON and Internet WiFi are already in setUp()
|
||||||
doReturn(false).when(mInternetDialogController).activeNetworkIsCellular();
|
doReturn(false).when(mInternetDialogController).activeNetworkIsCellular();
|
||||||
|
|
||||||
mInternetDialog.updateDialog();
|
mInternetDialog.updateDialog(false);
|
||||||
|
|
||||||
assertThat(mConnectedWifi.getVisibility()).isEqualTo(View.VISIBLE);
|
assertThat(mConnectedWifi.getVisibility()).isEqualTo(View.VISIBLE);
|
||||||
}
|
}
|
||||||
@@ -208,7 +212,7 @@ public class InternetDialogTest extends SysuiTestCase {
|
|||||||
mInternetDialog.onAccessPointsChanged(mWifiEntries, null /* connectedEntry*/);
|
mInternetDialog.onAccessPointsChanged(mWifiEntries, null /* connectedEntry*/);
|
||||||
doReturn(false).when(mInternetDialogController).activeNetworkIsCellular();
|
doReturn(false).when(mInternetDialogController).activeNetworkIsCellular();
|
||||||
|
|
||||||
mInternetDialog.updateDialog();
|
mInternetDialog.updateDialog(false);
|
||||||
|
|
||||||
assertThat(mConnectedWifi.getVisibility()).isEqualTo(View.GONE);
|
assertThat(mConnectedWifi.getVisibility()).isEqualTo(View.GONE);
|
||||||
}
|
}
|
||||||
@@ -218,7 +222,7 @@ public class InternetDialogTest extends SysuiTestCase {
|
|||||||
// The precondition WiFi ON is already in setUp()
|
// The precondition WiFi ON is already in setUp()
|
||||||
mInternetDialog.onAccessPointsChanged(null /* wifiEntries */, mInternetWifiEntry);
|
mInternetDialog.onAccessPointsChanged(null /* wifiEntries */, mInternetWifiEntry);
|
||||||
|
|
||||||
mInternetDialog.updateDialog();
|
mInternetDialog.updateDialog(false);
|
||||||
|
|
||||||
assertThat(mWifiList.getVisibility()).isEqualTo(View.GONE);
|
assertThat(mWifiList.getVisibility()).isEqualTo(View.GONE);
|
||||||
assertThat(mSeeAll.getVisibility()).isEqualTo(View.GONE);
|
assertThat(mSeeAll.getVisibility()).isEqualTo(View.GONE);
|
||||||
@@ -228,7 +232,7 @@ public class InternetDialogTest extends SysuiTestCase {
|
|||||||
public void updateDialog_wifiOnAndHasWifiList_showWifiListAndSeeAll() {
|
public void updateDialog_wifiOnAndHasWifiList_showWifiListAndSeeAll() {
|
||||||
// The preconditions WiFi ON and WiFi entries are already in setUp()
|
// The preconditions WiFi ON and WiFi entries are already in setUp()
|
||||||
|
|
||||||
mInternetDialog.updateDialog();
|
mInternetDialog.updateDialog(false);
|
||||||
|
|
||||||
assertThat(mWifiList.getVisibility()).isEqualTo(View.VISIBLE);
|
assertThat(mWifiList.getVisibility()).isEqualTo(View.VISIBLE);
|
||||||
assertThat(mSeeAll.getVisibility()).isEqualTo(View.VISIBLE);
|
assertThat(mSeeAll.getVisibility()).isEqualTo(View.VISIBLE);
|
||||||
@@ -239,7 +243,7 @@ public class InternetDialogTest extends SysuiTestCase {
|
|||||||
// The preconditions WiFi ON and Internet WiFi are already in setUp()
|
// The preconditions WiFi ON and Internet WiFi are already in setUp()
|
||||||
when(mInternetDialogController.isDeviceLocked()).thenReturn(true);
|
when(mInternetDialogController.isDeviceLocked()).thenReturn(true);
|
||||||
|
|
||||||
mInternetDialog.updateDialog();
|
mInternetDialog.updateDialog(false);
|
||||||
|
|
||||||
assertThat(mWifiToggle.getVisibility()).isEqualTo(View.VISIBLE);
|
assertThat(mWifiToggle.getVisibility()).isEqualTo(View.VISIBLE);
|
||||||
assertThat(mWifiToggle.getBackground()).isNotNull();
|
assertThat(mWifiToggle.getBackground()).isNotNull();
|
||||||
@@ -250,7 +254,7 @@ public class InternetDialogTest extends SysuiTestCase {
|
|||||||
// The preconditions WiFi ON and Internet WiFi are already in setUp()
|
// The preconditions WiFi ON and Internet WiFi are already in setUp()
|
||||||
when(mInternetDialogController.isDeviceLocked()).thenReturn(true);
|
when(mInternetDialogController.isDeviceLocked()).thenReturn(true);
|
||||||
|
|
||||||
mInternetDialog.updateDialog();
|
mInternetDialog.updateDialog(false);
|
||||||
|
|
||||||
assertThat(mConnectedWifi.getVisibility()).isEqualTo(View.GONE);
|
assertThat(mConnectedWifi.getVisibility()).isEqualTo(View.GONE);
|
||||||
}
|
}
|
||||||
@@ -260,7 +264,7 @@ public class InternetDialogTest extends SysuiTestCase {
|
|||||||
// The preconditions WiFi entries are already in setUp()
|
// The preconditions WiFi entries are already in setUp()
|
||||||
when(mInternetDialogController.isDeviceLocked()).thenReturn(true);
|
when(mInternetDialogController.isDeviceLocked()).thenReturn(true);
|
||||||
|
|
||||||
mInternetDialog.updateDialog();
|
mInternetDialog.updateDialog(false);
|
||||||
|
|
||||||
assertThat(mWifiList.getVisibility()).isEqualTo(View.GONE);
|
assertThat(mWifiList.getVisibility()).isEqualTo(View.GONE);
|
||||||
assertThat(mSeeAll.getVisibility()).isEqualTo(View.GONE);
|
assertThat(mSeeAll.getVisibility()).isEqualTo(View.GONE);
|
||||||
@@ -270,7 +274,7 @@ public class InternetDialogTest extends SysuiTestCase {
|
|||||||
public void updateDialog_wifiOn_hideWifiScanNotify() {
|
public void updateDialog_wifiOn_hideWifiScanNotify() {
|
||||||
// The preconditions WiFi ON and Internet WiFi are already in setUp()
|
// The preconditions WiFi ON and Internet WiFi are already in setUp()
|
||||||
|
|
||||||
mInternetDialog.updateDialog();
|
mInternetDialog.updateDialog(false);
|
||||||
|
|
||||||
assertThat(mWifiScanNotify.getVisibility()).isEqualTo(View.GONE);
|
assertThat(mWifiScanNotify.getVisibility()).isEqualTo(View.GONE);
|
||||||
}
|
}
|
||||||
@@ -280,7 +284,7 @@ public class InternetDialogTest extends SysuiTestCase {
|
|||||||
when(mWifiManager.isWifiEnabled()).thenReturn(false);
|
when(mWifiManager.isWifiEnabled()).thenReturn(false);
|
||||||
when(mWifiManager.isScanAlwaysAvailable()).thenReturn(false);
|
when(mWifiManager.isScanAlwaysAvailable()).thenReturn(false);
|
||||||
|
|
||||||
mInternetDialog.updateDialog();
|
mInternetDialog.updateDialog(false);
|
||||||
|
|
||||||
assertThat(mWifiScanNotify.getVisibility()).isEqualTo(View.GONE);
|
assertThat(mWifiScanNotify.getVisibility()).isEqualTo(View.GONE);
|
||||||
}
|
}
|
||||||
@@ -291,7 +295,7 @@ public class InternetDialogTest extends SysuiTestCase {
|
|||||||
when(mWifiManager.isScanAlwaysAvailable()).thenReturn(true);
|
when(mWifiManager.isScanAlwaysAvailable()).thenReturn(true);
|
||||||
when(mInternetDialogController.isDeviceLocked()).thenReturn(true);
|
when(mInternetDialogController.isDeviceLocked()).thenReturn(true);
|
||||||
|
|
||||||
mInternetDialog.updateDialog();
|
mInternetDialog.updateDialog(false);
|
||||||
|
|
||||||
assertThat(mWifiScanNotify.getVisibility()).isEqualTo(View.GONE);
|
assertThat(mWifiScanNotify.getVisibility()).isEqualTo(View.GONE);
|
||||||
}
|
}
|
||||||
@@ -302,7 +306,7 @@ public class InternetDialogTest extends SysuiTestCase {
|
|||||||
when(mWifiManager.isScanAlwaysAvailable()).thenReturn(true);
|
when(mWifiManager.isScanAlwaysAvailable()).thenReturn(true);
|
||||||
when(mInternetDialogController.isDeviceLocked()).thenReturn(false);
|
when(mInternetDialogController.isDeviceLocked()).thenReturn(false);
|
||||||
|
|
||||||
mInternetDialog.updateDialog();
|
mInternetDialog.updateDialog(false);
|
||||||
|
|
||||||
assertThat(mWifiScanNotify.getVisibility()).isEqualTo(View.VISIBLE);
|
assertThat(mWifiScanNotify.getVisibility()).isEqualTo(View.VISIBLE);
|
||||||
TextView wifiScanNotifyText = mDialogView.requireViewById(R.id.wifi_scan_notify_text);
|
TextView wifiScanNotifyText = mDialogView.requireViewById(R.id.wifi_scan_notify_text);
|
||||||
|
|||||||
Reference in New Issue
Block a user