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

Commit ba26a4a1 authored by Brint E. Kriebel's avatar Brint E. Kriebel
Browse files

Allow phone signal icon to be hidden from status bar for devices

without a radio

Change-Id: I32539d44665ef6ce803aea282805c8acea381e3b
parent 7578c9c0
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@
    <bool name="config_statusbar_buttons">false</bool>
    <!-- Control whether the status bar buttons should have the home button hidden -->
    <bool name="config_statusbar_hide_home">false</bool>

    <!-- Control whether the phone signal should be hidden for devices without a radio -->
    <bool name="config_statusbar_hide_phone_signal">false</bool>
</resources>
+20 −0
Original line number Diff line number Diff line
@@ -442,6 +442,9 @@ public class StatusBarPolicy {
        }
    }

    // phone_signal visibility
    private boolean mPhoneSignalHidden;

    public StatusBarPolicy(Context context) {
        mContext = context;
        mService = (StatusBarManager)context.getSystemService(Context.STATUS_BAR_SERVICE);
@@ -467,6 +470,19 @@ public class StatusBarPolicy {
        mPhoneSignalIconId = R.drawable.stat_sys_signal_null;
        mService.setIcon("phone_signal", mPhoneSignalIconId, 0);

        // load config to determine if phone should be hidden
        try {
            mPhoneSignalHidden = mContext.getResources().getBoolean(
                R.bool.config_statusbar_hide_phone_signal);
        } catch (Exception e) {
            mPhoneSignalHidden = false;
        }

        // hide phone_signal icon if hidden
        if (mPhoneSignalHidden) {
            mService.setIconVisibility("phone_signal", false);
        }

        // register for phone state notifications.
        ((TelephonyManager)mContext.getSystemService(Context.TELEPHONY_SERVICE))
                .listen(mPhoneStateListener,
@@ -940,6 +956,10 @@ public class StatusBarPolicy {
                mPhoneSignalIconId = R.drawable.stat_sys_signal_null;
            }
            mService.setIcon("phone_signal", mPhoneSignalIconId, 0);
            // set phone_signal visibility false if hidden
            if (mPhoneSignalHidden) {
                mService.setIconVisibility("phone_signal", false);
            }
            return;
        }