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

Commit e3d2102d authored by Jason Monk's avatar Jason Monk Committed by Steve Kondik
Browse files

Add hotspot icon to status bar

Bug: 17318034
Change-Id: I291fe6bf7ac8c2faffd37cfda436ef050c1c5ca5
parent 1da3b639
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -854,7 +854,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
        }

        // Lastly, call to the icon policy to install/update all the icons.
        mIconPolicy = new PhoneStatusBarPolicy(mContext, mCastController, mSuController);
        mIconPolicy = new PhoneStatusBarPolicy(mContext, mCastController, mHotspotController, mSuController);
        mSettingsObserver.onChange(false); // set up

        mHeadsUpObserver.onChange(true); // set up
+21 −4
Original line number Diff line number Diff line
@@ -47,6 +47,7 @@ import com.android.internal.telephony.TelephonyIntents;
import com.android.systemui.R;
import com.android.systemui.statusbar.policy.CastController;
import com.android.systemui.statusbar.policy.CastController.CastDevice;
import com.android.systemui.statusbar.policy.HotspotController;
import com.android.systemui.statusbar.policy.SuController;

/**
@@ -62,6 +63,7 @@ public class PhoneStatusBarPolicy {

    private static final String SLOT_SYNC_ACTIVE = "sync_active";
    private static final String SLOT_CAST = "cast";
    private static final String SLOT_HOTSPOT = "hotspot";
    private static final String SLOT_BLUETOOTH = "bluetooth";
    private static final String SLOT_TTY = "tty";
    private static final String SLOT_ZEN = "zen";
@@ -79,6 +81,7 @@ public class PhoneStatusBarPolicy {
    private final CastController mCast;
    private final SuController mSuController;
    private boolean mAlarmIconVisible;
    private final HotspotController mHotspot;

    // Assume it's all good unless we hear otherwise.  We don't always seem
    // to get broadcasts that it *is* there.
@@ -121,9 +124,11 @@ public class PhoneStatusBarPolicy {
        }
    };

    public PhoneStatusBarPolicy(Context context, CastController cast, SuController su) {
    public PhoneStatusBarPolicy(Context context, CastController cast, HotspotController hotspot,
            SuController su) {
        mContext = context;
        mCast = cast;
        mHotspot = hotspot;
        mSuController = su;
        mService = (StatusBarManager)context.getSystemService(Context.STATUS_BAR_SERVICE);

@@ -200,6 +205,11 @@ public class PhoneStatusBarPolicy {
        mContext.getContentResolver().registerContentObserver(
                Settings.System.getUriFor(Settings.System.SHOW_ALARM_ICON),
                false, mAlarmIconObserver);

        // hotspot
        mService.setIcon(SLOT_HOTSPOT, R.drawable.stat_sys_hotspot, 0, null);
        mService.setIconVisibility(SLOT_HOTSPOT, mHotspot.isHotspotEnabled());
        mHotspot.addCallback(mHotspotCallback);
    }

    private ContentObserver mAlarmIconObserver = new ContentObserver(null) {
@@ -394,9 +404,12 @@ public class PhoneStatusBarPolicy {
        mService.setIconVisibility(SLOT_CAST, isCasting);
    }

    private void updateSu() {
        mService.setIconVisibility(SLOT_SU, mSuController.hasActiveSessions());
    private final HotspotController.Callback mHotspotCallback = new HotspotController.Callback() {
        @Override
        public void onHotspotChanged(boolean enabled) {
            mService.setIconVisibility(SLOT_HOTSPOT, enabled);
        }
    };

    private final CastController.Callback mCastCallback = new CastController.Callback() {
        @Override
@@ -405,6 +418,10 @@ public class PhoneStatusBarPolicy {
        }
    };

    private void updateSu() {
        mService.setIconVisibility(SLOT_SU, mSuController.hasActiveSessions());
    }

    private final SuController.Callback mSuCallback = new SuController.Callback() {
        @Override
        public void onSuSessionsChanged() {