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

Commit fde7f0ed authored by Jaikumar Ganesh's avatar Jaikumar Ganesh
Browse files

Update status bar icons for BT reverse tethering.

This updates the icon when its connected and the IP address
has been obtained.
Change-Id: I1b0ad5572a1899b118d1b6b6f49e41b7242b689a
parent 58f750ad
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -108,4 +108,6 @@
    <!-- Recent apps label. Shown as title on recent apps panel -->
    <string name="recent_tasks_app_label">Apps</string>

    <!-- Network connection string for Bluetooth Reverse Tethering -->
    <string name="bluetooth_tethered">Bluetooth tethered"</string>
</resources>
+33 −10
Original line number Diff line number Diff line
@@ -85,6 +85,11 @@ public class NetworkController extends BroadcastReceiver {
    String mWifiSsid;
    int mWifiIconId;

    // bluetooth
    private boolean mBluetoothTethered = false;
    private int mBluetoothTetherIconId =
        com.android.internal.R.drawable.stat_sys_tether_bluetooth;

    // data connectivity (regardless of state, can we access the internet?)
    // state of inet connection - 0 not connected, 100 connected
    private int mInetCondition = 0;
@@ -649,13 +654,22 @@ public class NetworkController extends BroadcastReceiver {
                mInetCondition = inetCondition;
                updateWifiIcons();
                break;
            case ConnectivityManager.TYPE_BLUETOOTH:
                mInetCondition = inetCondition;
                if (info != null) {
                    mBluetoothTethered = info.isConnected() ? true: false;
                } else {
                    mBluetoothTethered = false;
                }
                break;
        }
    }


    // ===== Update the views =======================================================

    // figure out what to show: first wifi, then 3G, then nothing
    // figure out what to show- there should be one connected network or nothing
    // General order of preference is: wifi, 3G than bluetooth. This might vary by product.
    void refreshViews() {
        Context context = mContext;

@@ -672,12 +686,16 @@ public class NetworkController extends BroadcastReceiver {
            }
            combinedSignalIconId = mWifiIconId;
            dataTypeIconId = 0;
        } else {
            if (mDataConnected) {
        } else if (mDataConnected) {
            label = mNetworkName;
            combinedSignalIconId = mDataSignalIconId;
            dataTypeIconId = mDataTypeIconId;
        } else if (mBluetoothTethered) {
            label = mContext.getString(R.string.bluetooth_tethered);
            combinedSignalIconId = mBluetoothTetherIconId;
            dataTypeIconId = 0;
        } else {
            label = context.getString(R.string.status_bar_settings_signal_meter_disconnected);
            }
            combinedSignalIconId = mDataSignalIconId;
            dataTypeIconId = mDataTypeIconId;
        }
@@ -689,7 +707,8 @@ public class NetworkController extends BroadcastReceiver {
                    + " mDataDirectionIconId=0x" + Integer.toHexString(mDataDirectionIconId)
                    + " mDataSignalIconId=0x" + Integer.toHexString(mDataSignalIconId)
                    + " mDataTypeIconId=0x" + Integer.toHexString(mDataTypeIconId)
                    + " mWifiIconId=0x" + Integer.toHexString(mWifiIconId));
                    + " mWifiIconId=0x" + Integer.toHexString(mWifiIconId)
                    + "mBluetoothTetherIconId=0x" + Integer.toHexString(mBluetoothTetherIconId));
        }

        // the phone icon on phones
@@ -809,6 +828,10 @@ public class NetworkController extends BroadcastReceiver {
        pw.print("  mWifiIconId=");
        pw.println(mWifiIconId);

        pw.println("  - Bluetooth ----");
        pw.print(" mBtReverseTethered=");
        pw.println(mBluetoothTethered);

        pw.println("  - connectivity ------");
        pw.print("  mInetCondition=");
        pw.println(mInetCondition);