Persistent 'emergency calls' banner in the notification panel.

While carrier info (or SSID for devices without mobile data)
will still be shown in a floating text view at the bottom of
the notification shade, emergency-calls-only mode will now
be shown in the notification panel header so that it cannot
be obscured by notifications.

Change-Id: I714b6801be2b9b631b86b51d229440445eff5e76
This commit is contained in:
Daniel Sandler
2012-07-27 11:19:52 -04:00
parent cdd0c59a01
commit dd4ef49f45
4 changed files with 69 additions and 20 deletions

View File

@@ -40,24 +40,34 @@
android:visibility="invisible"
/>
<FrameLayout
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="@dimen/close_handle_underlap"
android:orientation="vertical"
>
<include layout="@layout/status_bar_expanded_header"
android:layout_width="match_parent"
android:layout_height="@dimen/notification_panel_header_height"
/>
<TextView
android:id="@+id/emergency_calls_only"
android:textAppearance="@style/TextAppearance.StatusBar.Expanded.Network.EmergencyOnly"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:paddingBottom="4dp"
android:gravity="center"
android:visibility="gone"
/>
<ScrollView
android:id="@+id/scroll"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fadingEdge="none"
android:overScrollMode="ifContentScrolls"
android:layout_marginTop="@dimen/notification_panel_header_height"
android:overScrollMode="always"
>
<com.android.systemui.statusbar.policy.NotificationRowLayout
android:id="@+id/latestItems"
@@ -66,7 +76,7 @@
systemui:rowHeight="@dimen/notification_row_min_height"
/>
</ScrollView>
</FrameLayout>
</LinearLayout>
<com.android.systemui.statusbar.phone.CloseDragHandle android:id="@+id/close"
android:layout_width="match_parent"

View File

@@ -67,6 +67,9 @@
<item name="android:textColor">#999999</item>
</style>
<style name="TextAppearance.StatusBar.Expanded.Network.EmergencyOnly">
</style>
<style name="Animation" />
<style name="Animation.ShirtPocketPanel">

View File

@@ -182,6 +182,7 @@ public class PhoneStatusBar extends BaseStatusBar {
private TextView mCarrierLabel;
private boolean mCarrierLabelVisible = false;
private int mCarrierLabelHeight;
private TextView mEmergencyCallLabel;
// drag bar
CloseDragHandle mCloseView;
@@ -409,14 +410,6 @@ public class PhoneStatusBar extends BaseStatusBar {
mPile = (NotificationRowLayout)mStatusBarWindow.findViewById(R.id.latestItems);
mPile.setLayoutTransitionsEnabled(false);
mPile.setLongPressListener(getNotificationLongClicker());
if (SHOW_CARRIER_LABEL) {
mPile.setOnSizeChangedListener(new OnSizeChangedListener() {
@Override
public void onSizeChanged(View view, int w, int h, int oldw, int oldh) {
updateCarrierLabelVisibility(false);
}
});
}
mExpandedContents = mPile; // was: expanded.findViewById(R.id.notificationLinearLayout);
mClearButton = mStatusBarWindow.findViewById(R.id.clear_all_button);
@@ -429,9 +422,6 @@ public class PhoneStatusBar extends BaseStatusBar {
mSettingsButton.setOnClickListener(mSettingsButtonListener);
mRotationButton = (RotationToggle) mStatusBarWindow.findViewById(R.id.rotation_lock_button);
mCarrierLabel = (TextView)mStatusBarWindow.findViewById(R.id.carrier_label);
mCarrierLabel.setVisibility(mCarrierLabelVisible ? View.VISIBLE : View.INVISIBLE);
mScrollView = (ScrollView)mStatusBarWindow.findViewById(R.id.scroll);
mScrollView.setVerticalScrollBarEnabled(false); // less drawing during pulldowns
@@ -460,7 +450,21 @@ public class PhoneStatusBar extends BaseStatusBar {
mNetworkController.addSignalCluster(signalCluster);
signalCluster.setNetworkController(mNetworkController);
mEmergencyCallLabel = (TextView)mStatusBarWindow.findViewById(R.id.emergency_calls_only);
if (mEmergencyCallLabel != null) {
mNetworkController.addEmergencyLabelView(mEmergencyCallLabel);
mEmergencyCallLabel.addOnLayoutChangeListener(new View.OnLayoutChangeListener() {
@Override
public void onLayoutChange(View v, int left, int top, int right, int bottom,
int oldLeft, int oldTop, int oldRight, int oldBottom) {
updateCarrierLabelVisibility(false);
}});
}
if (SHOW_CARRIER_LABEL) {
mCarrierLabel = (TextView)mStatusBarWindow.findViewById(R.id.carrier_label);
mCarrierLabel.setVisibility(mCarrierLabelVisible ? View.VISIBLE : View.INVISIBLE);
// for mobile devices, we always show mobile connection info here (SPN/PLMN)
// for other devices, we show whatever network is connected
if (mNetworkController.hasMobileDataFeature()) {
@@ -468,6 +472,14 @@ public class PhoneStatusBar extends BaseStatusBar {
} else {
mNetworkController.addCombinedLabelView(mCarrierLabel);
}
// set up the dynamic hide/show of the label
mPile.setOnSizeChangedListener(new OnSizeChangedListener() {
@Override
public void onSizeChanged(View view, int w, int h, int oldw, int oldh) {
updateCarrierLabelVisibility(false);
}
});
}
// final ImageView wimaxRSSI =
@@ -919,9 +931,11 @@ public class PhoneStatusBar extends BaseStatusBar {
Slog.d(TAG, String.format("pileh=%d scrollh=%d carrierh=%d",
mPile.getHeight(), mScrollView.getHeight(), mCarrierLabelHeight));
}
final boolean makeVisible =
mPile.getHeight() < (mScrollView.getHeight() - mCarrierLabelHeight);
final boolean emergencyCallsShownElsewhere = mEmergencyCallLabel != null;
final boolean makeVisible =
!(emergencyCallsShownElsewhere && mNetworkController.isEmergencyOnly())
&& mPile.getHeight() < (mScrollView.getHeight() - mCarrierLabelHeight);
if (force || mCarrierLabelVisible != makeVisible) {
mCarrierLabelVisible = makeVisible;

View File

@@ -145,6 +145,7 @@ public class NetworkController extends BroadcastReceiver {
ArrayList<TextView> mCombinedLabelViews = new ArrayList<TextView>();
ArrayList<TextView> mMobileLabelViews = new ArrayList<TextView>();
ArrayList<TextView> mWifiLabelViews = new ArrayList<TextView>();
ArrayList<TextView> mEmergencyLabelViews = new ArrayList<TextView>();
ArrayList<SignalCluster> mSignalClusters = new ArrayList<SignalCluster>();
int mLastPhoneSignalIconId = -1;
int mLastDataDirectionIconId = -1;
@@ -245,6 +246,10 @@ public class NetworkController extends BroadcastReceiver {
return mHasMobileDataFeature;
}
public boolean isEmergencyOnly() {
return (mServiceState != null && mServiceState.isEmergencyOnly());
}
public void addPhoneSignalIconView(ImageView v) {
mPhoneSignalIconViews.add(v);
}
@@ -284,6 +289,10 @@ public class NetworkController extends BroadcastReceiver {
mWifiLabelViews.add(v);
}
public void addEmergencyLabelView(TextView v) {
mEmergencyLabelViews.add(v);
}
public void addSignalCluster(SignalCluster cluster) {
mSignalClusters.add(cluster);
refreshSignalCluster(cluster);
@@ -917,7 +926,7 @@ public class NetworkController extends BroadcastReceiver {
String wifiLabel = "";
String mobileLabel = "";
int N;
final boolean emergencyOnly = (mServiceState != null && mServiceState.isEmergencyOnly());
final boolean emergencyOnly = isEmergencyOnly();
if (!mHasMobileDataFeature) {
mDataSignalIconId = mPhoneSignalIconId = 0;
@@ -1079,6 +1088,7 @@ public class NetworkController extends BroadcastReceiver {
+ " combinedActivityIconId=0x" + Integer.toHexString(combinedActivityIconId)
+ " mobileLabel=" + mobileLabel
+ " wifiLabel=" + wifiLabel
+ " emergencyOnly=" + emergencyOnly
+ " combinedLabel=" + combinedLabel
+ " mAirplaneMode=" + mAirplaneMode
+ " mDataActivity=" + mDataActivity
@@ -1244,6 +1254,18 @@ public class NetworkController extends BroadcastReceiver {
v.setVisibility(View.VISIBLE);
}
}
// e-call label
N = mEmergencyLabelViews.size();
for (int i=0; i<N; i++) {
TextView v = mEmergencyLabelViews.get(i);
if (!emergencyOnly) {
v.setVisibility(View.GONE);
} else {
v.setText(mobileLabel); // comes from the telephony stack
v.setVisibility(View.VISIBLE);
}
}
}
public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {