Skip to content

Commit fbf3089

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

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
@@ -186,6 +186,7 @@ public class PhoneStatusBar extends BaseStatusBar {
186186
private TextView mCarrierLabel;
187187
private boolean mCarrierLabelVisible = false;
188188
private int mCarrierLabelHeight;
189+
private TextView mEmergencyCallLabel;
189190

190191
// drag bar
191192
CloseDragHandle mCloseView;
@@ -402,14 +403,6 @@ public boolean onTouch(View v, MotionEvent event) {
402403
mPile = (NotificationRowLayout)mStatusBarWindow.findViewById(R.id.latestItems);
403404
mPile.setLayoutTransitionsEnabled(false);
404405
mPile.setLongPressListener(getNotificationLongClicker());
405-
if (SHOW_CARRIER_LABEL) {
406-
mPile.setOnSizeChangedListener(new OnSizeChangedListener() {
407-
@Override
408-
public void onSizeChanged(View view, int w, int h, int oldw, int oldh) {
409-
updateCarrierLabelVisibility(false);
410-
}
411-
});
412-
}
413406
mExpandedContents = mPile; // was: expanded.findViewById(R.id.notificationLinearLayout);
414407

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

425-
mCarrierLabel = (TextView)mStatusBarWindow.findViewById(R.id.carrier_label);
426-
mCarrierLabel.setVisibility(mCarrierLabelVisible ? View.VISIBLE : View.INVISIBLE);
427-
428418
mScrollView = (ScrollView)mStatusBarWindow.findViewById(R.id.scroll);
429419
mScrollView.setVerticalScrollBarEnabled(false); // less drawing during pulldowns
430420

@@ -453,14 +443,36 @@ public void onSizeChanged(View view, int w, int h, int oldw, int oldh) {
453443
mNetworkController.addSignalCluster(signalCluster);
454444
signalCluster.setNetworkController(mNetworkController);
455445

446+
mEmergencyCallLabel = (TextView)mStatusBarWindow.findViewById(R.id.emergency_calls_only);
447+
if (mEmergencyCallLabel != null) {
448+
mNetworkController.addEmergencyLabelView(mEmergencyCallLabel);
449+
mEmergencyCallLabel.addOnLayoutChangeListener(new View.OnLayoutChangeListener() {
450+
@Override
451+
public void onLayoutChange(View v, int left, int top, int right, int bottom,
452+
int oldLeft, int oldTop, int oldRight, int oldBottom) {
453+
updateCarrierLabelVisibility(false);
454+
}});
455+
}
456+
456457
if (SHOW_CARRIER_LABEL) {
458+
mCarrierLabel = (TextView)mStatusBarWindow.findViewById(R.id.carrier_label);
459+
mCarrierLabel.setVisibility(mCarrierLabelVisible ? View.VISIBLE : View.INVISIBLE);
460+
457461
// for mobile devices, we always show mobile connection info here (SPN/PLMN)
458462
// for other devices, we show whatever network is connected
459463
if (mNetworkController.hasMobileDataFeature()) {
460464
mNetworkController.addMobileLabelView(mCarrierLabel);
461465
} else {
462466
mNetworkController.addCombinedLabelView(mCarrierLabel);
463467
}
468+
469+
// set up the dynamic hide/show of the label
470+
mPile.setOnSizeChangedListener(new OnSizeChangedListener() {
471+
@Override
472+
public void onSizeChanged(View view, int w, int h, int oldw, int oldh) {
473+
updateCarrierLabelVisibility(false);
474+
}
475+
});
464476
}
465477

466478
// final ImageView wimaxRSSI =
@@ -904,9 +916,11 @@ protected void updateCarrierLabelVisibility(boolean force) {
904916
Slog.d(TAG, String.format("pileh=%d scrollh=%d carrierh=%d",
905917
mPile.getHeight(), mScrollView.getHeight(), mCarrierLabelHeight));
906918
}
907-
908-
final boolean makeVisible =
909-
mPile.getHeight() < (mScrollView.getHeight() - mCarrierLabelHeight);
919+
920+
final boolean emergencyCallsShownElsewhere = mEmergencyCallLabel != null;
921+
final boolean makeVisible =
922+
!(emergencyCallsShownElsewhere && mNetworkController.isEmergencyOnly())
923+
&& mPile.getHeight() < (mScrollView.getHeight() - mCarrierLabelHeight);
910924

911925
if (force || mCarrierLabelVisible != makeVisible) {
912926
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)