Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e2c2b49b authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "framework/base: Handle P2P-REMOVE-AND-REFORM-GROUP event"

parents 36456df7 e15c86da
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -277,6 +277,12 @@ public class WifiMonitor {
     */
    private static final String P2P_SERV_DISC_RESP_STR = "P2P-SERV-DISC-RESP";

    /* P2P-REMOVE-AND-REFORM-GROUP */
    /* Supplicant is supposed to generate this event only when p2p
     * is connected
     */
    private static final String P2P_REMOVE_AND_REFORM_GROUP_STR = "P2P-REMOVE-AND-REFORM-GROUP";

    private static final String HOST_AP_EVENT_PREFIX_STR = "AP";
    /* AP-STA-CONNECTED 42:fc:89:a8:96:09 dev_addr=02:90:4c:a0:92:54 */
    private static final String AP_STA_CONNECTED_STR = "AP-STA-CONNECTED";
@@ -330,6 +336,7 @@ public class WifiMonitor {
    public static final int P2P_FIND_STOPPED_EVENT               = BASE + 37;
    public static final int P2P_SERV_DISC_RESP_EVENT             = BASE + 38;
    public static final int P2P_PROV_DISC_FAILURE_EVENT          = BASE + 39;
    public static final int P2P_REMOVE_AND_REFORM_GROUP_EVENT    = BASE + 40;

    /* hostap events */
    public static final int AP_STA_DISCONNECTED_EVENT            = BASE + 41;
@@ -819,6 +826,9 @@ public class WifiMonitor {
                } else {
                    Log.e(TAG, "Null service resp " + dataString);
                }
            } else if (dataString.startsWith(P2P_REMOVE_AND_REFORM_GROUP_STR)) {
                Log.d(TAG, "Received event= " + dataString);
                mStateMachine.sendMessage(P2P_REMOVE_AND_REFORM_GROUP_EVENT);
            }
        }

+24 −0
Original line number Diff line number Diff line
@@ -1776,6 +1776,30 @@ public class WifiP2pService extends IWifiP2pManager.Stub {
                        loge("Disconnect on unknown device: " + device);
                    }
                    break;
                case WifiMonitor.P2P_REMOVE_AND_REFORM_GROUP_EVENT:
                    /* First remove p2p group and then restart only if
                     * autonoums group formation is set to true
                     */
                    Slog.d(TAG, "Received event P2P_REMOVE_AND_REFORM_GROUP, remove P2P group");
                    if (mWifiNative.p2pGroupRemove(mGroup.getInterface())) {
                        Slog.d(TAG, "Removed P2P group successfully");
                        transitionTo(mOngoingGroupRemovalState);
                        replyToMessage(message, WifiP2pManager.REMOVE_GROUP_SUCCEEDED);
                    } else {
                        Slog.d(TAG, "Failed to remove the P2P group");
                        handleGroupRemoved();
                        transitionTo(mInactiveState);
                        replyToMessage(message,
                                       WifiP2pManager.REMOVE_GROUP_FAILED,
                                       WifiP2pManager.ERROR);
                    }
                    if (mAutonomousGroup) {
                        Slog.d(TAG, "AutonomousGroup is set, reform P2P Group");
                        sendMessage(WifiP2pManager.CREATE_GROUP);
                    } else {
                        Slog.d(TAG, "AutonomousGroup is not set, will not reform P2P Group");
                    }
                    break;
                case DhcpStateMachine.CMD_POST_DHCP_ACTION:
                    DhcpResults dhcpResults = (DhcpResults) message.obj;
                    if (message.arg1 == DhcpStateMachine.DHCP_SUCCESS &&