Wifi: update p2p API usage in settings

Bug: 146423859
Bug: 144799344
Test: atest --host SettingsRoboTests
Change-Id: Ia0225fa8110ff16ceda260f59ffee3739776a6a9
This commit is contained in:
Jimmy Chen
2020-02-04 17:43:42 +08:00
parent 36c3446b28
commit 5ba1be60a4

View File

@@ -520,7 +520,7 @@ public final class WifiDisplaySettings extends SettingsPreferenceFragment implem
if (DEBUG) {
Slog.d(TAG, "Setting listen mode to: " + enable);
}
mWifiP2pManager.listen(mWifiP2pChannel, enable, new ActionListener() {
final ActionListener listener = new ActionListener() {
@Override
public void onSuccess() {
if (DEBUG) {
@@ -534,7 +534,12 @@ public final class WifiDisplaySettings extends SettingsPreferenceFragment implem
Slog.e(TAG, "Failed to " + (enable ? "entered" : "exited")
+ " 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) {