Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fbf30896 authored by Daniel Sandler's avatar Daniel Sandler Committed by Android Git Automerger
Browse files

am 5cb62df6: am dd4ef49f: Persistent \'emergency calls\' banner in the notification panel.

* commit '5cb62df6':
  Persistent 'emergency calls' banner in the notification panel.
parents e9f5f8e0 5cb62df6
Loading
Loading
Loading
Loading
+15 −5
Original line number Diff line number Diff line
@@ -40,10 +40,11 @@
        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"
@@ -51,13 +52,22 @@
            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"
+3 −0
Original line number Diff line number Diff line
@@ -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">
+28 −14
Original line number Diff line number Diff line
@@ -186,6 +186,7 @@ public class PhoneStatusBar extends BaseStatusBar {
    private TextView mCarrierLabel;
    private boolean mCarrierLabelVisible = false;
    private int mCarrierLabelHeight;
    private TextView mEmergencyCallLabel;

    // drag bar
    CloseDragHandle mCloseView;
@@ -402,14 +403,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);
@@ -422,9 +415,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

@@ -453,7 +443,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()) {
@@ -461,6 +465,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 =
@@ -905,8 +917,10 @@ public class PhoneStatusBar extends BaseStatusBar {
                    mPile.getHeight(), mScrollView.getHeight(), mCarrierLabelHeight));
        }

        final boolean emergencyCallsShownElsewhere = mEmergencyCallLabel != null;
        final boolean makeVisible =
            mPile.getHeight() < (mScrollView.getHeight() - mCarrierLabelHeight);
            !(emergencyCallsShownElsewhere && mNetworkController.isEmergencyOnly())
            && mPile.getHeight() < (mScrollView.getHeight() - mCarrierLabelHeight);
        
        if (force || mCarrierLabelVisible != makeVisible) {
            mCarrierLabelVisible = makeVisible;
+23 −1
Original line number Diff line number Diff line
@@ -146,6 +146,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;
@@ -246,6 +247,10 @@ public class NetworkController extends BroadcastReceiver {
        return mHasMobileDataFeature;
    }

    public boolean isEmergencyOnly() {
        return (mServiceState != null && mServiceState.isEmergencyOnly());
    }

    public void addPhoneSignalIconView(ImageView v) {
        mPhoneSignalIconViews.add(v);
    }
@@ -285,6 +290,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);
@@ -920,7 +929,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;
@@ -1082,6 +1091,7 @@ public class NetworkController extends BroadcastReceiver {
                    + " combinedActivityIconId=0x" + Integer.toHexString(combinedActivityIconId)
                    + " mobileLabel=" + mobileLabel
                    + " wifiLabel=" + wifiLabel
                    + " emergencyOnly=" + emergencyOnly
                    + " combinedLabel=" + combinedLabel
                    + " mAirplaneMode=" + mAirplaneMode
                    + " mDataActivity=" + mDataActivity
@@ -1247,6 +1257,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) {