Skip to content

Commit 5cb62df

Browse files
dsandlerAndroid Git Automerger
authored andcommitted
am dd4ef49: Persistent \'emergency calls\' banner in the notification panel.
* commit 'dd4ef49f4545dad2a6503d29e129472aba5392fc': Persistent 'emergency calls' banner in the notification panel.
2 parents 587616a + dd4ef49 commit 5cb62df

File tree

4 files changed

+69
-20
lines changed

4 files changed

+69
-20
lines changed

packages/SystemUI/res/layout/status_bar_expanded.xml

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,24 +40,34 @@
4040
android:visibility="invisible"
4141
/>
4242

43-
<FrameLayout
43+
<LinearLayout
4444
android:layout_width="match_parent"
4545
android:layout_height="match_parent"
4646
android:layout_marginBottom="@dimen/close_handle_underlap"
47+
android:orientation="vertical"
4748
>
4849

4950
<include layout="@layout/status_bar_expanded_header"
5051
android:layout_width="match_parent"
5152
android:layout_height="@dimen/notification_panel_header_height"
5253
/>
53-
54+
55+
<TextView
56+
android:id="@+id/emergency_calls_only"
57+
android:textAppearance="@style/TextAppearance.StatusBar.Expanded.Network.EmergencyOnly"
58+
android:layout_height="wrap_content"
59+
android:layout_width="match_parent"
60+
android:paddingBottom="4dp"
61+
android:gravity="center"
62+
android:visibility="gone"
63+
/>
64+
5465
<ScrollView
5566
android:id="@+id/scroll"
5667
android:layout_width="match_parent"
5768
android:layout_height="match_parent"
5869
android:fadingEdge="none"
59-
android:overScrollMode="ifContentScrolls"
60-
android:layout_marginTop="@dimen/notification_panel_header_height"
70+
android:overScrollMode="always"
6171
>
6272
<com.android.systemui.statusbar.policy.NotificationRowLayout
6373
android:id="@+id/latestItems"
@@ -66,7 +76,7 @@
6676
systemui:rowHeight="@dimen/notification_row_min_height"
6777
/>
6878
</ScrollView>
69-
</FrameLayout>
79+
</LinearLayout>
7080

7181
<com.android.systemui.statusbar.phone.CloseDragHandle android:id="@+id/close"
7282
android:layout_width="match_parent"

packages/SystemUI/res/values/styles.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,9 @@
6767
<item name="android:textColor">#999999</item>
6868
</style>
6969

70+
<style name="TextAppearance.StatusBar.Expanded.Network.EmergencyOnly">
71+
</style>
72+
7073
<style name="Animation" />
7174

7275
<style name="Animation.ShirtPocketPanel">

packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java

Lines changed: 28 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,7 @@ public class PhoneStatusBar extends BaseStatusBar {
182182
private TextView mCarrierLabel;
183183
private boolean mCarrierLabelVisible = false;
184184
private int mCarrierLabelHeight;
185+
private TextView mEmergencyCallLabel;
185186

186187
// drag bar
187188
CloseDragHandle mCloseView;
@@ -409,14 +410,6 @@ public boolean onTouch(View v, MotionEvent event) {
409410
mPile = (NotificationRowLayout)mStatusBarWindow.findViewById(R.id.latestItems);
410411
mPile.setLayoutTransitionsEnabled(false);
411412
mPile.setLongPressListener(getNotificationLongClicker());
412-
if (SHOW_CARRIER_LABEL) {
413-
mPile.setOnSizeChangedListener(new OnSizeChangedListener() {
414-
@Override
415-
public void onSizeChanged(View view, int w, int h, int oldw, int oldh) {
416-
updateCarrierLabelVisibility(false);
417-
}
418-
});
419-
}
420413
mExpandedContents = mPile; // was: expanded.findViewById(R.id.notificationLinearLayout);
421414

422415
mClearButton = mStatusBarWindow.findViewById(R.id.clear_all_button);
@@ -429,9 +422,6 @@ public void onSizeChanged(View view, int w, int h, int oldw, int oldh) {
429422
mSettingsButton.setOnClickListener(mSettingsButtonListener);
430423
mRotationButton = (RotationToggle) mStatusBarWindow.findViewById(R.id.rotation_lock_button);
431424

432-
mCarrierLabel = (TextView)mStatusBarWindow.findViewById(R.id.carrier_label);
433-
mCarrierLabel.setVisibility(mCarrierLabelVisible ? View.VISIBLE : View.INVISIBLE);
434-
435425
mScrollView = (ScrollView)mStatusBarWindow.findViewById(R.id.scroll);
436426
mScrollView.setVerticalScrollBarEnabled(false); // less drawing during pulldowns
437427

@@ -460,14 +450,36 @@ public void onSizeChanged(View view, int w, int h, int oldw, int oldh) {
460450
mNetworkController.addSignalCluster(signalCluster);
461451
signalCluster.setNetworkController(mNetworkController);
462452

453+
mEmergencyCallLabel = (TextView)mStatusBarWindow.findViewById(R.id.emergency_calls_only);
454+
if (mEmergencyCallLabel != null) {
455+
mNetworkController.addEmergencyLabelView(mEmergencyCallLabel);
456+
mEmergencyCallLabel.addOnLayoutChangeListener(new View.OnLayoutChangeListener() {
457+
@Override
458+
public void onLayoutChange(View v, int left, int top, int right, int bottom,
459+
int oldLeft, int oldTop, int oldRight, int oldBottom) {
460+
updateCarrierLabelVisibility(false);
461+
}});
462+
}
463+
463464
if (SHOW_CARRIER_LABEL) {
465+
mCarrierLabel = (TextView)mStatusBarWindow.findViewById(R.id.carrier_label);
466+
mCarrierLabel.setVisibility(mCarrierLabelVisible ? View.VISIBLE : View.INVISIBLE);
467+
464468
// for mobile devices, we always show mobile connection info here (SPN/PLMN)
465469
// for other devices, we show whatever network is connected
466470
if (mNetworkController.hasMobileDataFeature()) {
467471
mNetworkController.addMobileLabelView(mCarrierLabel);
468472
} else {
469473
mNetworkController.addCombinedLabelView(mCarrierLabel);
470474
}
475+
476+
// set up the dynamic hide/show of the label
477+
mPile.setOnSizeChangedListener(new OnSizeChangedListener() {
478+
@Override
479+
public void onSizeChanged(View view, int w, int h, int oldw, int oldh) {
480+
updateCarrierLabelVisibility(false);
481+
}
482+
});
471483
}
472484

473485
// final ImageView wimaxRSSI =
@@ -919,9 +931,11 @@ protected void updateCarrierLabelVisibility(boolean force) {
919931
Slog.d(TAG, String.format("pileh=%d scrollh=%d carrierh=%d",
920932
mPile.getHeight(), mScrollView.getHeight(), mCarrierLabelHeight));
921933
}
922-
923-
final boolean makeVisible =
924-
mPile.getHeight() < (mScrollView.getHeight() - mCarrierLabelHeight);
934+
935+
final boolean emergencyCallsShownElsewhere = mEmergencyCallLabel != null;
936+
final boolean makeVisible =
937+
!(emergencyCallsShownElsewhere && mNetworkController.isEmergencyOnly())
938+
&& mPile.getHeight() < (mScrollView.getHeight() - mCarrierLabelHeight);
925939

926940
if (force || mCarrierLabelVisible != makeVisible) {
927941
mCarrierLabelVisible = makeVisible;

packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkController.java

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ public class NetworkController extends BroadcastReceiver {
146146
ArrayList<TextView> mCombinedLabelViews = new ArrayList<TextView>();
147147
ArrayList<TextView> mMobileLabelViews = new ArrayList<TextView>();
148148
ArrayList<TextView> mWifiLabelViews = new ArrayList<TextView>();
149+
ArrayList<TextView> mEmergencyLabelViews = new ArrayList<TextView>();
149150
ArrayList<SignalCluster> mSignalClusters = new ArrayList<SignalCluster>();
150151
int mLastPhoneSignalIconId = -1;
151152
int mLastDataDirectionIconId = -1;
@@ -246,6 +247,10 @@ public boolean hasMobileDataFeature() {
246247
return mHasMobileDataFeature;
247248
}
248249

250+
public boolean isEmergencyOnly() {
251+
return (mServiceState != null && mServiceState.isEmergencyOnly());
252+
}
253+
249254
public void addPhoneSignalIconView(ImageView v) {
250255
mPhoneSignalIconViews.add(v);
251256
}
@@ -285,6 +290,10 @@ public void addWifiLabelView(TextView v) {
285290
mWifiLabelViews.add(v);
286291
}
287292

293+
public void addEmergencyLabelView(TextView v) {
294+
mEmergencyLabelViews.add(v);
295+
}
296+
288297
public void addSignalCluster(SignalCluster cluster) {
289298
mSignalClusters.add(cluster);
290299
refreshSignalCluster(cluster);
@@ -920,7 +929,7 @@ void refreshViews() {
920929
String wifiLabel = "";
921930
String mobileLabel = "";
922931
int N;
923-
final boolean emergencyOnly = (mServiceState != null && mServiceState.isEmergencyOnly());
932+
final boolean emergencyOnly = isEmergencyOnly();
924933

925934
if (!mHasMobileDataFeature) {
926935
mDataSignalIconId = mPhoneSignalIconId = 0;
@@ -1082,6 +1091,7 @@ else if (!mDataConnected && !mWifiConnected && !mBluetoothTethered && !mWimaxCon
10821091
+ " combinedActivityIconId=0x" + Integer.toHexString(combinedActivityIconId)
10831092
+ " mobileLabel=" + mobileLabel
10841093
+ " wifiLabel=" + wifiLabel
1094+
+ " emergencyOnly=" + emergencyOnly
10851095
+ " combinedLabel=" + combinedLabel
10861096
+ " mAirplaneMode=" + mAirplaneMode
10871097
+ " mDataActivity=" + mDataActivity
@@ -1247,6 +1257,18 @@ else if (!mDataConnected && !mWifiConnected && !mBluetoothTethered && !mWimaxCon
12471257
v.setVisibility(View.VISIBLE);
12481258
}
12491259
}
1260+
1261+
// e-call label
1262+
N = mEmergencyLabelViews.size();
1263+
for (int i=0; i<N; i++) {
1264+
TextView v = mEmergencyLabelViews.get(i);
1265+
if (!emergencyOnly) {
1266+
v.setVisibility(View.GONE);
1267+
} else {
1268+
v.setText(mobileLabel); // comes from the telephony stack
1269+
v.setVisibility(View.VISIBLE);
1270+
}
1271+
}
12501272
}
12511273

12521274
public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {

0 commit comments

Comments
 (0)