Merge "Hide empty text view when airplane mode" into rvc-dev
diff --git a/packages/SystemUI/src/com/android/systemui/qs/carrier/QSCarrierGroupController.java b/packages/SystemUI/src/com/android/systemui/qs/carrier/QSCarrierGroupController.java
index f9b1473..ebdcc00 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/carrier/QSCarrierGroupController.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/carrier/QSCarrierGroupController.java
@@ -25,6 +25,7 @@
import android.os.Message;
import android.provider.Settings;
import android.telephony.SubscriptionManager;
+import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import android.widget.TextView;
@@ -260,7 +261,9 @@
mCarrierGroups[i].setVisibility(View.GONE);
}
mNoSimTextView.setText(info.carrierText);
- mNoSimTextView.setVisibility(View.VISIBLE);
+ if (!TextUtils.isEmpty(info.carrierText)) {
+ mNoSimTextView.setVisibility(View.VISIBLE);
+ }
}
handleUpdateState(); // handleUpdateCarrierInfo is always called from main thread.
}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/qs/carrier/QSCarrierGroupControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/qs/carrier/QSCarrierGroupControllerTest.java
index fa02231..8a412bf 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/qs/carrier/QSCarrierGroupControllerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/qs/carrier/QSCarrierGroupControllerTest.java
@@ -16,6 +16,7 @@
package com.android.systemui.qs.carrier;
+import static org.junit.Assert.assertEquals;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyBoolean;
import static org.mockito.ArgumentMatchers.anyInt;
@@ -219,4 +220,18 @@
mock(NetworkController.IconState.class),
0, 0, true, true, "", "", "", true, 0, true);
}
+
+ @Test
+ public void testNoEmptyVisibleView_airplaneMode() {
+ CarrierTextController.CarrierTextCallbackInfo
+ info = new CarrierTextController.CarrierTextCallbackInfo(
+ "",
+ new CharSequence[]{""},
+ true,
+ new int[]{0},
+ true /* airplaneMode */);
+ mCallback.updateCarrierInfo(info);
+ mTestableLooper.processAllMessages();
+ assertEquals(View.GONE, mQSCarrierGroup.getNoSimTextView().getVisibility());
+ }
}