Fix IndexOutOfBoundsException while silent provisioning check
- If hostpot off, we receive result through HotspotOffReceiver. Sometimes, during provisioning, we're used to receive this. In this case, we don't care. After provisioning, we'll receive the intent again. - In stress test, index is sometimes invalid, equals to mCurrentTethers.size(). So, when provisioning, We check whether index is valid or not. BUG=23528220 Change-Id: I70f35e045042c6c81b1db03e2a44cd41d3e7437f
This commit is contained in:
committed by
Vineeta Srivastava
parent
cda53c5dc2
commit
5565b5cd75
@@ -5,6 +5,7 @@ import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.net.wifi.WifiManager;
|
||||
import android.util.Log;
|
||||
|
||||
import com.android.settingslib.TetherUtil;
|
||||
|
||||
@@ -14,11 +15,15 @@ import com.android.settingslib.TetherUtil;
|
||||
*/
|
||||
public class HotspotOffReceiver extends BroadcastReceiver {
|
||||
|
||||
private static final String TAG = "HotspotOffReceiver";
|
||||
private static final boolean DEBUG = Log.isLoggable(TAG, Log.DEBUG);
|
||||
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
if (WifiManager.WIFI_AP_STATE_CHANGED_ACTION.equals(intent.getAction())) {
|
||||
WifiManager wifiManager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
|
||||
if (wifiManager.getWifiApState() == WifiManager.WIFI_AP_STATE_DISABLED) {
|
||||
if (DEBUG) Log.d(TAG, "TetherService.cancelRecheckAlarmIfNecessary called");
|
||||
// The hotspot has been turned off, we don't need to recheck tethering.
|
||||
TetherService.cancelRecheckAlarmIfNecessary(context, TetherUtil.TETHERING_WIFI);
|
||||
}
|
||||
|
Reference in New Issue
Block a user