diff options
author | d34d <clark@cyngn.com> | 2016-02-22 09:38:09 -0800 |
---|---|---|
committer | Gerrit Code Review <gerrit@cyanogenmod.org> | 2016-02-29 08:16:15 -0800 |
commit | 983893dda058bd02a861e732a5e00bec7a414ee8 (patch) | |
tree | 4a2ddadd7f8360a92b15f06c94b01f5eef5423fe /packages/SystemUI/src | |
parent | de45e4b6958d4ae5c01b296d01d0a13c22f43db4 (diff) | |
download | frameworks_base-983893dda058bd02a861e732a5e00bec7a414ee8.zip frameworks_base-983893dda058bd02a861e732a5e00bec7a414ee8.tar.gz frameworks_base-983893dda058bd02a861e732a5e00bec7a414ee8.tar.bz2 |
HotSpot: Store # of connected clients in receiver
Get the number of connected clients in onReceive and cache the value
to be used in handleUpdateState
Change-Id: I011a13e186c1fa9976df58a4ad1603e6c0cd6bbb
Diffstat (limited to 'packages/SystemUI/src')
-rw-r--r-- | packages/SystemUI/src/com/android/systemui/qs/tiles/HotspotTile.java | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/HotspotTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/HotspotTile.java index 71a3f95..25a7fb7 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tiles/HotspotTile.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/HotspotTile.java @@ -51,6 +51,7 @@ public class HotspotTile extends QSTile<QSTile.BooleanState> { private final UsageTracker mUsageTracker; private final ConnectivityManager mConnectivityManager; private boolean mListening; + private int mNumConnectedClients = 0; public HotspotTile(Host host) { super(host); @@ -131,10 +132,9 @@ public class HotspotTile extends QSTile<QSTile.BooleanState> { state.value = mController.isHotspotEnabled(); } if (state.visible && state.value) { - final List<WifiDevice> clients = mConnectivityManager.getTetherConnectedSta(); - final int count = clients != null ? clients.size() : 0; state.label = mContext.getResources().getQuantityString( - R.plurals.wifi_hotspot_connected_clients_label, count, count); + R.plurals.wifi_hotspot_connected_clients_label, mNumConnectedClients, + mNumConnectedClients); } else { state.label = mContext.getString(R.string.quick_settings_hotspot_label); } @@ -163,6 +163,8 @@ public class HotspotTile extends QSTile<QSTile.BooleanState> { private BroadcastReceiver mTetherConnectStateChangedReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { + final List<WifiDevice> clients = mConnectivityManager.getTetherConnectedSta(); + mNumConnectedClients = clients != null ? clients.size() : 0; refreshState(); } }; |