Fix ANR in SliceRelayReceiver

The same broadcast are handled in SliceRelayReceiver and WifiScanWorker.
We will only use WifiScanWorker to handle wifi broadcast.

Change-Id: I32c2fcc699ae240f12bd1049ba33e1792ae123b0
Fixes: 120284615
Test: manual
This commit is contained in:
Raff Tsai
2018-12-11 17:51:41 +08:00
parent 2602e42b65
commit 86a2afe798
3 changed files with 27 additions and 12 deletions

View File

@@ -25,7 +25,6 @@ import android.annotation.ColorInt;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.net.Uri;
import android.net.wifi.WifiInfo;
import android.net.wifi.WifiManager;
@@ -75,14 +74,6 @@ public class WifiSlice implements CustomSliceable {
return WIFI_SLICE_URI;
}
@Override
public IntentFilter getIntentFilter() {
final IntentFilter filter = new IntentFilter();
filter.addAction(WifiManager.WIFI_STATE_CHANGED_ACTION);
filter.addAction(WifiManager.NETWORK_STATE_CHANGED_ACTION);
return filter;
}
@Override
public Slice getSlice() {
final boolean isWifiEnabled = isWifiEnabled();
@@ -200,7 +191,7 @@ public class WifiSlice implements CustomSliceable {
mWifiManager.isWifiEnabled());
mWifiManager.setWifiEnabled(newState);
// Do not notifyChange on Uri. The service takes longer to update the current value than it
// does for the Slice to check the current value again. Let {@link SliceBroadcastRelay}
// does for the Slice to check the current value again. Let {@link WifiScanWorker}
// handle it.
}
@@ -292,6 +283,7 @@ public class WifiSlice implements CustomSliceable {
@Override
public void onWifiStateChanged(int state) {
mContext.getContentResolver().notifyChange(getUri(), null);
}
@Override