Merge "Wifi: update p2p API usage in settings"

This commit is contained in:
Jimmy Chen
2020-02-07 06:54:57 +00:00
committed by Android (Google) Code Review

View File

@@ -520,7 +520,7 @@ public final class WifiDisplaySettings extends SettingsPreferenceFragment implem
if (DEBUG) { if (DEBUG) {
Slog.d(TAG, "Setting listen mode to: " + enable); Slog.d(TAG, "Setting listen mode to: " + enable);
} }
mWifiP2pManager.listen(mWifiP2pChannel, enable, new ActionListener() { final ActionListener listener = new ActionListener() {
@Override @Override
public void onSuccess() { public void onSuccess() {
if (DEBUG) { if (DEBUG) {
@@ -534,7 +534,12 @@ public final class WifiDisplaySettings extends SettingsPreferenceFragment implem
Slog.e(TAG, "Failed to " + (enable ? "entered" : "exited") Slog.e(TAG, "Failed to " + (enable ? "entered" : "exited")
+ " listen mode with reason " + reason + "."); + " listen mode with reason " + reason + ".");
} }
}); };
if (enable) {
mWifiP2pManager.startListening(mWifiP2pChannel, listener);
} else {
mWifiP2pManager.stopListening(mWifiP2pChannel, listener);
}
} }
private void setWifiP2pChannels(final int lc, final int oc) { private void setWifiP2pChannels(final int lc, final int oc) {