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

Commit 992e77af authored by Daniel Sandler's avatar Daniel Sandler Committed by Android (Google) Code Review
Browse files

Merge "Fold WiMAX state into the mobile RSSI." into ics-mr1

parents 8b50bd8c 0fee2170
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -257,10 +257,16 @@
    <string name="accessibility_wifi_three_bars">Wi-Fi three bars.</string>
    <!-- Content description of the WIFI signal when it is full for accessibility (not shown on the screen). [CHAR LIMIT=NONE] -->
    <string name="accessibility_wifi_signal_full">WiFi signal full.</string>

    <!-- Content description of the WiMAX signal when no signal for accessibility (not shown on the screen). [CHAR LIMIT=NONE] -->
    <string name="accessibility_no_wimax">No WiMAX.</string>
    <!-- Content description of the WiMAX signal when it is one bar for accessibility (not shown on the screen). [CHAR LIMIT=NONE] -->
    <string name="accessibility_wimax_one_bar">WiMAX one bar.</string>
    <!-- Content description of the WiMAX signal when it is two bars for accessibility (not shown on the screen). [CHAR LIMIT=NONE] -->
    <string name="accessibility_wimax_two_bars">WiMAX two bars.</string>
    <!-- Content description of the WiMAX signal when it is three bars for accessibility (not shown on the screen). [CHAR LIMIT=NONE] -->
    <string name="accessibility_wimax_three_bars">WiMAX three bars.</string>
    <!-- Content description of the WiMAX signal when it is full for accessibility (not shown on the screen). [CHAR LIMIT=NONE] -->
    <string name="accessibility_wimax_signal_full">WiMAX signal full.</string>

    <!-- Content description of the data connection type GPRS for accessibility (not shown on the screen). [CHAR LIMIT=NONE] -->
+153 −128
Original line number Diff line number Diff line
@@ -111,6 +111,7 @@ public class NetworkController extends BroadcastReceiver {
        com.android.internal.R.drawable.stat_sys_tether_bluetooth;

    //wimax
    private boolean mWimaxSupported = false;
    private boolean mIsWimaxEnabled = false;
    private boolean mWimaxConnected = false;
    private boolean mWimaxIdle = false;
@@ -213,9 +214,9 @@ public class NetworkController extends BroadcastReceiver {
        filter.addAction(ConnectivityManager.INET_CONDITION_ACTION);
        filter.addAction(Intent.ACTION_CONFIGURATION_CHANGED);
        filter.addAction(Intent.ACTION_AIRPLANE_MODE_CHANGED);
        boolean isWimaxConfigEnabled = mContext.getResources().getBoolean(
        mWimaxSupported = mContext.getResources().getBoolean(
                com.android.internal.R.bool.config_wimaxEnabled);
        if(isWimaxConfigEnabled) {
        if(mWimaxSupported) {
            filter.addAction(WimaxManagerConstants.WIMAX_NETWORK_STATE_CHANGED_ACTION);
            filter.addAction(WimaxManagerConstants.SIGNAL_LEVEL_CHANGED_ACTION);
            filter.addAction(WimaxManagerConstants.NET_4G_STATE_CHANGED_ACTION);
@@ -262,11 +263,27 @@ public class NetworkController extends BroadcastReceiver {

    public void addSignalCluster(SignalCluster cluster) {
        mSignalClusters.add(cluster);
        refreshSignalCluster(cluster);
    }

    public void refreshSignalCluster(SignalCluster cluster) {
        cluster.setWifiIndicators(
                mWifiConnected, // only show wifi in the cluster if connected
                mWifiIconId,
                mWifiActivityIconId,
                mContentDescriptionWifi);

        if (mIsWimaxEnabled && mWimaxConnected) {
            // wimax is special
            cluster.setMobileDataIndicators(
                    true,
                    mWimaxIconId,
                    mMobileActivityIconId,
                    mDataTypeIconId,
                    mContentDescriptionWimax,
                    mContentDescriptionDataType);
        } else {
            // normal mobile data
            cluster.setMobileDataIndicators(
                    mHasMobileDataFeature,
                    mShowPhoneRSSIForData ? mPhoneSignalIconId : mDataSignalIconId,
@@ -274,7 +291,8 @@ public class NetworkController extends BroadcastReceiver {
                    mDataTypeIconId,
                    mContentDescriptionPhoneSignal,
                    mContentDescriptionDataType);

        }
        cluster.setIsAirplaneMode(mAirplaneMode);
    }

    public void setStackedMode(boolean stacked) {
@@ -466,6 +484,13 @@ public class NetworkController extends BroadcastReceiver {
    }

    private final void updateDataNetType() {
        if (mIsWimaxEnabled && mWimaxConnected) {
            // wimax is a special 4g network not handled by telephony
            mDataIconList = TelephonyIcons.DATA_4G[mInetCondition];
            mDataTypeIconId = R.drawable.stat_sys_data_connected_4g;
            mContentDescriptionDataType = mContext.getString(
                    R.string.accessibility_data_connection_4g);
        } else {
            switch (mDataNetType) {
                case TelephonyManager.NETWORK_TYPE_UNKNOWN:
                    if (!mShowAtLeastThreeGees) {
@@ -551,6 +576,8 @@ public class NetworkController extends BroadcastReceiver {
                    }
                    break;
            }
        }

        if ((isCdma() && isCdmaEri()) || mPhone.isNetworkRoaming()) {
            mDataTypeIconId = R.drawable.stat_sys_data_connected_roam;
        }
@@ -764,7 +791,6 @@ public class NetworkController extends BroadcastReceiver {


    // ===== Wimax ===================================================================

    private final void updateWimaxState(Intent intent) {
        final String action = intent.getAction();
        boolean wasConnected = mWimaxConnected;
@@ -772,7 +798,7 @@ public class NetworkController extends BroadcastReceiver {
            int wimaxStatus = intent.getIntExtra(WimaxManagerConstants.EXTRA_4G_STATE,
                    WimaxManagerConstants.NET_4G_STATE_UNKNOWN);
            mIsWimaxEnabled = (wimaxStatus ==
		WimaxManagerConstants.NET_4G_STATE_ENABLED)? true : false;
                    WimaxManagerConstants.NET_4G_STATE_ENABLED);
        } else if (action.equals(WimaxManagerConstants.SIGNAL_LEVEL_CHANGED_ACTION)) {
            mWimaxSignal = intent.getIntExtra(WimaxManagerConstants.EXTRA_NEW_SIGNAL_LEVEL, 0);
        } else if (action.equals(WimaxManagerConstants.WIMAX_NETWORK_STATE_CHANGED_ACTION)) {
@@ -782,16 +808,16 @@ public class NetworkController extends BroadcastReceiver {
                    WimaxManagerConstants.EXTRA_WIMAX_STATE_DETAIL,
                    WimaxManagerConstants.NET_4G_STATE_UNKNOWN);
            mWimaxConnected = (mWimaxState ==
		WimaxManagerConstants.WIMAX_STATE_CONNECTED) ? true : false;
            mWimaxIdle = (mWimaxExtraState == WimaxManagerConstants.WIMAX_IDLE)? true : false;
                    WimaxManagerConstants.WIMAX_STATE_CONNECTED);
            mWimaxIdle = (mWimaxExtraState == WimaxManagerConstants.WIMAX_IDLE);
        }
        updateDataNetType();
        updateWimaxIcons();
    }

    private void updateWimaxIcons() {
            Slog.d(TAG, "in ....  updateWimaxIcons function    :  "+mIsWimaxEnabled);
        if (mIsWimaxEnabled) {
            if (mWimaxConnected) {
                                Slog.d(TAG, "in ....  updateWimaxIcons function WiMAX COnnected");
                if (mWimaxIdle)
                    mWimaxIconId = WimaxIcons.WIMAX_IDLE;
                else
@@ -799,15 +825,14 @@ public class NetworkController extends BroadcastReceiver {
                mContentDescriptionWimax = mContext.getString(
                        AccessibilityContentDescriptions.WIMAX_CONNECTION_STRENGTH[mWimaxSignal]);
            } else {
                                 Slog.d(TAG, "in ....  updateWimaxIcons function WiMAX Disconnected");
                mWimaxIconId = WimaxIcons.WIMAX_DISCONNECTED;
                mContentDescriptionWimax = mContext.getString(R.string.accessibility_no_wimax);
            }
        } else {
                         Slog.d(TAG, "in ....  updateWimaxIcons function wimax icon id 0");
            mWimaxIconId = 0;
        }
    }

    // ===== Full or limited Internet connectivity ==================================

    private void updateConnectivity(Intent intent) {
@@ -827,7 +852,7 @@ public class NetworkController extends BroadcastReceiver {
        mInetCondition = (connectionStatus > INET_CONDITION_THRESHOLD ? 1 : 0);

        if (info != null && info.getType() == ConnectivityManager.TYPE_BLUETOOTH) {
            mBluetoothTethered = info.isConnected() ? true: false;
            mBluetoothTethered = info.isConnected();
        } else {
            mBluetoothTethered = false;
        }
@@ -921,7 +946,7 @@ public class NetworkController extends BroadcastReceiver {

            combinedSignalIconId = mDataSignalIconId;
        }
        else if (!mDataConnected && !mWifiConnected && !mBluetoothTethered) {
        else if (!mDataConnected && !mWifiConnected && !mBluetoothTethered && !mWimaxConnected) {
            // pretty much totally disconnected

            label = context.getString(R.string.status_bar_settings_signal_meter_disconnected);
@@ -961,23 +986,12 @@ public class NetworkController extends BroadcastReceiver {
        if (mLastPhoneSignalIconId          != mPhoneSignalIconId
         || mLastDataDirectionOverlayIconId != combinedActivityIconId
         || mLastWifiIconId                 != mWifiIconId
         || mLastWimaxIconId                != mWimaxIconId
         || mLastDataTypeIconId             != mDataTypeIconId)
        {
            // NB: the mLast*s will be updated later
            for (SignalCluster cluster : mSignalClusters) {
                cluster.setWifiIndicators(
                        mWifiConnected, // only show wifi in the cluster if connected
                        mWifiIconId,
                        mWifiActivityIconId,
                        mContentDescriptionWifi);
                cluster.setMobileDataIndicators(
                        mHasMobileDataFeature,
                        mShowPhoneRSSIForData ? mPhoneSignalIconId : mDataSignalIconId,
                        mMobileActivityIconId,
                        mDataTypeIconId,
                        mContentDescriptionPhoneSignal,
                        mContentDescriptionDataType);
                cluster.setIsAirplaneMode(mAirplaneMode);
                refreshSignalCluster(cluster);
            }
        }

@@ -1152,11 +1166,22 @@ public class NetworkController extends BroadcastReceiver {
        pw.println(mWifiLevel);
        pw.print("  mWifiSsid=");
        pw.println(mWifiSsid);
        pw.print(String.format("  mWifiIconId=0x%08x/%s",
        pw.println(String.format("  mWifiIconId=0x%08x/%s",
                    mWifiIconId, getResourceName(mWifiIconId)));
        pw.print("  mWifiActivity=");
        pw.println(mWifiActivity);

        if (mWimaxSupported) {
            pw.println("  - wimax ------");
            pw.print("  mIsWimaxEnabled="); pw.println(mIsWimaxEnabled);
            pw.print("  mWimaxConnected="); pw.println(mWimaxConnected);
            pw.print("  mWimaxIdle="); pw.println(mWimaxIdle);
            pw.println(String.format("  mWimaxIconId=0x%08x/%s",
                        mWimaxIconId, getResourceName(mWimaxIconId)));
            pw.println(String.format("  mWimaxSignal=%d", mWimaxSignal));
            pw.println(String.format("  mWimaxState=%d", mWimaxState));
            pw.println(String.format("  mWimaxExtraState=%d", mWimaxExtraState));
        }

        pw.println("  - Bluetooth ----");
        pw.print("  mBtReverseTethered=");
@@ -1190,7 +1215,7 @@ public class NetworkController extends BroadcastReceiver {
        pw.print("  mLastDataTypeIconId=0x");
        pw.print(Integer.toHexString(mLastDataTypeIconId));
        pw.print("/");
        pw.println(getResourceName(mLastCombinedSignalIconId));
        pw.println(getResourceName(mLastDataTypeIconId));
        pw.print("  mLastLabel=");
        pw.print(mLastLabel);
        pw.println("");
+6 −15
Original line number Diff line number Diff line
/*
 * Copyright (C) 2008 The Android Open Source Project
 * Copyright (C) 2011 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
@@ -16,22 +16,13 @@

package com.android.systemui.statusbar.policy;

import com.android.systemui.statusbar.policy.TelephonyIcons;
import com.android.systemui.R;

class WimaxIcons {
    static final int[][] WIMAX_SIGNAL_STRENGTH = {
	{ R.drawable.stat_sys_data_wimax_signal_0,
            R.drawable.stat_sys_data_wimax_signal_1,
            R.drawable.stat_sys_data_wimax_signal_2,
            R.drawable.stat_sys_data_wimax_signal_3 },
          { R.drawable.stat_sys_data_wimax_signal_0_fully,
            R.drawable.stat_sys_data_wimax_signal_1_fully,
            R.drawable.stat_sys_data_wimax_signal_2_fully,
            R.drawable.stat_sys_data_wimax_signal_3_fully }
        };
    static final int[][] WIMAX_SIGNAL_STRENGTH = TelephonyIcons.DATA_SIGNAL_STRENGTH;

    static final int WIMAX_DISCONNECTED =
            R.drawable.stat_sys_data_wimax_signal_disconnected;
    static final int WIMAX_IDLE = R.drawable.stat_sys_data_wimax_signal_idle;
    static final int WIFI_LEVEL_COUNT = WIMAX_SIGNAL_STRENGTH[0].length;
    static final int WIMAX_DISCONNECTED = WIMAX_SIGNAL_STRENGTH[0][0];

    static final int WIMAX_IDLE = WIMAX_DISCONNECTED; // XXX: unclear if we need a different icon
}