1 /* 2 * Copyright (C) 2021 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package com.android.server.wifi.p2p; 18 19 import android.annotation.NonNull; 20 import android.annotation.Nullable; 21 import android.net.wifi.CoexUnsafeChannel; 22 import android.net.wifi.ScanResult; 23 import android.net.wifi.p2p.WifiP2pConfig; 24 import android.net.wifi.p2p.WifiP2pDirInfo; 25 import android.net.wifi.p2p.WifiP2pDiscoveryConfig; 26 import android.net.wifi.p2p.WifiP2pExtListenParams; 27 import android.net.wifi.p2p.WifiP2pGroup; 28 import android.net.wifi.p2p.WifiP2pGroupList; 29 import android.net.wifi.p2p.WifiP2pManager; 30 import android.net.wifi.p2p.WifiP2pUsdBasedLocalServiceAdvertisementConfig; 31 import android.net.wifi.p2p.WifiP2pUsdBasedServiceDiscoveryConfig; 32 import android.net.wifi.p2p.nsd.WifiP2pServiceInfo; 33 import android.net.wifi.p2p.nsd.WifiP2pUsdBasedServiceConfig; 34 35 import com.android.server.wifi.WifiNative; 36 37 import java.util.List; 38 import java.util.Set; 39 40 /** Abstraction of Supplicant P2P Iface HAL interface */ 41 interface ISupplicantP2pIfaceHal { 42 /** 43 * Begin initializing the ISupplicantP2pIfaceHal object. Specific initialization 44 * logic differs between the HIDL and AIDL implementations. 45 * 46 * @return true if the initialization routine was successful 47 */ initialize()48 boolean initialize(); 49 50 /** 51 * Set the debug log level for wpa_supplicant 52 * 53 * @param turnOnVerbose Whether to turn on verbose logging or not. 54 * @param globalShowKeys Whether show keys is true in WifiGlobals. 55 * @return true if request is sent successfully, false otherwise. 56 */ setLogLevel(boolean turnOnVerbose, boolean globalShowKeys)57 boolean setLogLevel(boolean turnOnVerbose, boolean globalShowKeys); 58 59 /** 60 * Setup the P2P iface. 61 * 62 * @param ifaceName Name of the interface. 63 * @return true on success, false otherwise. 64 */ setupIface(@onNull String ifaceName)65 boolean setupIface(@NonNull String ifaceName); 66 67 /** 68 * Teardown the P2P interface. 69 * 70 * @param ifaceName Name of the interface. 71 * @return true on success, false otherwise. 72 */ teardownIface(@onNull String ifaceName)73 boolean teardownIface(@NonNull String ifaceName); 74 75 /** 76 * Signals whether initialization started successfully. 77 */ isInitializationStarted()78 boolean isInitializationStarted(); 79 80 /** 81 * Signals whether Initialization completed successfully. Only necessary for testing, is not 82 * needed to guard calls etc. 83 */ isInitializationComplete()84 boolean isInitializationComplete(); 85 86 /** 87 * Initiate a P2P service discovery with a (optional) timeout. 88 * 89 * @param timeout Max time to be spent is performing discovery. 90 * Set to 0 to indefinitely continue discovery until an explicit 91 * |stopFind| is sent. 92 * @return boolean value indicating whether operation was successful. 93 */ find(int timeout)94 boolean find(int timeout); 95 96 /** 97 * Initiate a P2P device discovery with a scan type, a (optional) frequency, and a (optional) 98 * timeout. 99 * 100 * @param type indicates what channels to scan. 101 * Valid values are {@link WifiP2pManager#WIFI_P2P_SCAN_FULL} for doing full P2P scan, 102 * {@link WifiP2pManager#WIFI_P2P_SCAN_SOCIAL} for scanning social channels, 103 * {@link WifiP2pManager#WIFI_P2P_SCAN_SINGLE_FREQ} for scanning a specified frequency. 104 * @param freq is the frequency to be scanned. 105 * The possible values are: 106 * <ul> 107 * <li> A valid frequency for {@link WifiP2pManager#WIFI_P2P_SCAN_SINGLE_FREQ}</li> 108 * <li> {@link WifiP2pManager#WIFI_P2P_SCAN_FREQ_UNSPECIFIED} for 109 * {@link WifiP2pManager#WIFI_P2P_SCAN_FULL} and 110 * {@link WifiP2pManager#WIFI_P2P_SCAN_SOCIAL}</li> 111 * </ul> 112 * @param timeout Max time to be spent is performing discovery. 113 * Set to 0 to indefinitely continue discovery until an explicit 114 * |stopFind| is sent. 115 * @return boolean value indicating whether operation was successful. 116 */ find(@ifiP2pManager.WifiP2pScanType int type, int freq, int timeout)117 boolean find(@WifiP2pManager.WifiP2pScanType int type, int freq, int timeout); 118 119 /** 120 * Initiate P2P device discovery with config params. 121 * 122 * @param config The config parameters to initiate P2P discovery. 123 * @param timeout The maximum amount of time to be spent in performing discovery. 124 * Set to 0 to indefinitely continue discovery until an explicit 125 * |stopFind| is sent. 126 * @return boolean value indicating whether the operation was successful. 127 */ findWithParams(@onNull WifiP2pDiscoveryConfig config, int timeout)128 default boolean findWithParams(@NonNull WifiP2pDiscoveryConfig config, int timeout) { 129 return false; 130 } 131 132 /** 133 * Stop an ongoing P2P service discovery. 134 * 135 * @return boolean value indicating whether operation was successful. 136 */ stopFind()137 boolean stopFind(); 138 139 /** 140 * Flush P2P peer table and state. 141 * 142 * @return boolean value indicating whether operation was successful. 143 */ flush()144 boolean flush(); 145 146 /** 147 * This command can be used to flush all services from the 148 * device. 149 * 150 * @return boolean value indicating whether operation was successful. 151 */ serviceFlush()152 boolean serviceFlush(); 153 154 /** 155 * Turn on/off power save mode for the interface. 156 * 157 * @param groupIfName Group interface name to use. 158 * @param enable Indicate if power save is to be turned on/off. 159 * 160 * @return boolean value indicating whether operation was successful. 161 */ setPowerSave(String groupIfName, boolean enable)162 boolean setPowerSave(String groupIfName, boolean enable); 163 164 /** 165 * Set the Maximum idle time in seconds for P2P groups. 166 * This value controls how long a P2P group is maintained after there 167 * is no other members in the group. As a group owner, this means no 168 * associated stations in the group. As a P2P client, this means no 169 * group owner seen in scan results. 170 * 171 * @param groupIfName Group interface name to use. 172 * @param timeoutInSec Timeout value in seconds. 173 * 174 * @return boolean value indicating whether operation was successful. 175 */ setGroupIdle(String groupIfName, int timeoutInSec)176 boolean setGroupIdle(String groupIfName, int timeoutInSec); 177 178 /** 179 * Set the postfix to be used for P2P SSID's. 180 * 181 * @param postfix String to be appended to SSID. 182 * 183 * @return boolean value indicating whether operation was successful. 184 */ setSsidPostfix(String postfix)185 boolean setSsidPostfix(String postfix); 186 187 /** 188 * Start P2P group formation with a discovered P2P peer. This includes 189 * optional group owner negotiation, group interface setup, provisioning, 190 * and establishing data connection. 191 * 192 * @param config Configuration to use to connect to remote device. 193 * @param joinExistingGroup Indicates that this is a command to join an 194 * existing group as a client. It skips the group owner negotiation 195 * part. This must send a Provision Discovery Request message to the 196 * target group owner before associating for WPS provisioning. 197 * 198 * @return String containing generated pin, if selected provision method 199 * uses PIN. 200 */ connect(WifiP2pConfig config, boolean joinExistingGroup)201 String connect(WifiP2pConfig config, boolean joinExistingGroup); 202 203 /** 204 * Cancel an ongoing P2P group formation and joining-a-group related 205 * operation. This operation unauthorizes the specific peer device (if any 206 * had been authorized to start group formation), stops P2P find (if in 207 * progress), stops pending operations for join-a-group, and removes the 208 * P2P group interface (if one was used) that is in the WPS provisioning 209 * step. If the WPS provisioning step has been completed, the group is not 210 * terminated. 211 * 212 * @return boolean value indicating whether operation was successful. 213 */ cancelConnect()214 boolean cancelConnect(); 215 216 /** 217 * Send P2P provision discovery request to the specified peer. The 218 * parameters for this command are the P2P device address of the peer and the 219 * desired configuration method. 220 * 221 * @param config Config class describing peer setup. 222 * 223 * @return boolean value indicating whether operation was successful. 224 */ provisionDiscovery(WifiP2pConfig config)225 boolean provisionDiscovery(WifiP2pConfig config); 226 227 /** 228 * Invite a device to a persistent group. 229 * If the peer device is the group owner of the persistent group, the peer 230 * parameter is not needed. Otherwise it is used to specify which 231 * device to invite. |goDeviceAddress| parameter may be used to override 232 * the group owner device address for Invitation Request should it not be 233 * known for some reason (this should not be needed in most cases). 234 * 235 * @param group Group object to use. 236 * @param peerAddress MAC address of the device to invite. 237 * 238 * @return boolean value indicating whether operation was successful. 239 */ invite(WifiP2pGroup group, String peerAddress)240 boolean invite(WifiP2pGroup group, String peerAddress); 241 242 /** 243 * Reject connection attempt from a peer (specified with a device 244 * address). This is a mechanism to reject a pending group owner negotiation 245 * with a peer and request to automatically block any further connection or 246 * discovery of the peer. 247 * 248 * @param peerAddress MAC address of the device to reject. 249 * 250 * @return boolean value indicating whether operation was successful. 251 */ reject(String peerAddress)252 boolean reject(String peerAddress); 253 254 /** 255 * Gets the MAC address of the device. 256 * 257 * @return MAC address of the device. 258 */ getDeviceAddress()259 String getDeviceAddress(); 260 261 /** 262 * Gets the operational SSID of the device. 263 * 264 * @param address MAC address of the peer. 265 * 266 * @return SSID of the device. 267 */ getSsid(String address)268 String getSsid(String address); 269 270 /** 271 * Reinvoke a device from a persistent group. 272 * 273 * @param networkId Used to specify the persistent group (valid only for P2P V1 group). 274 * @param peerAddress MAC address of the device to reinvoke. 275 * @param dikId The identifier of device identity key of the device to reinvoke. 276 * (valid only for P2P V2 group). 277 * 278 * @return true, if operation was successful. 279 */ reinvoke(int networkId, String peerAddress, int dikId)280 boolean reinvoke(int networkId, String peerAddress, int dikId); 281 282 /** 283 * Set up a P2P group owner manually (i.e., without group owner 284 * negotiation with a specific peer). This is also known as autonomous 285 * group owner. 286 * 287 * @param networkId Used to specify the restart of a persistent group. 288 * @param isPersistent Used to request a persistent group to be formed. 289 * @param isP2pV2 Used to start a Group Owner that support P2P2 IE 290 * 291 * @return true, if operation was successful. 292 */ groupAdd(int networkId, boolean isPersistent, boolean isP2pV2)293 boolean groupAdd(int networkId, boolean isPersistent, boolean isP2pV2); 294 295 /** 296 * Set up a P2P group as Group Owner or join a group with a configuration. 297 * 298 * @param networkName SSID of the group to be formed 299 * @param passphrase passphrase of the group to be formed 300 * @param isPersistent Used to request a persistent group to be formed. 301 * @param freq preferred frequency or band of the group to be formed 302 * @param peerAddress peerAddress Group Owner MAC address, only applied for Group Client. 303 * If the MAC is "00:00:00:00:00:00", the device will try to find a peer 304 * whose SSID matches ssid. 305 * @param join join a group or create a group 306 * 307 * @return true, if operation was successful. 308 */ groupAdd(String networkName, String passphrase, @WifiP2pConfig.PccModeConnectionType int connectionType, boolean isPersistent, int freq, String peerAddress, boolean join)309 boolean groupAdd(String networkName, String passphrase, 310 @WifiP2pConfig.PccModeConnectionType int connectionType, 311 boolean isPersistent, int freq, String peerAddress, boolean join); 312 313 /** 314 * Terminate a P2P group. If a new virtual network interface was used for 315 * the group, it must also be removed. The network interface name of the 316 * group interface is used as a parameter for this command. 317 * 318 * @param groupName Group interface name to use. 319 * 320 * @return true, if operation was successful. 321 */ groupRemove(String groupName)322 boolean groupRemove(String groupName); 323 324 /** 325 * Gets the capability of the group which the device is a 326 * member of. 327 * 328 * @param peerAddress MAC address of the peer. 329 * 330 * @return combination of |GroupCapabilityMask| values. 331 */ getGroupCapability(String peerAddress)332 int getGroupCapability(String peerAddress); 333 334 /** 335 * Configure Extended Listen Timing. 336 * 337 * If enabled, listen state must be entered every |intervalInMillis| for at 338 * least |periodInMillis|. Both values have acceptable range of 1-65535 339 * (with interval obviously having to be larger than or equal to duration). 340 * If the P2P module is not idle at the time the Extended Listen Timing 341 * timeout occurs, the Listen State operation must be skipped. 342 * 343 * @param enable Enables or disables listening. 344 * @param periodInMillis Period in milliseconds. 345 * @param intervalInMillis Interval in milliseconds. 346 * @param extListenParams Additional parameter struct for this request. 347 * 348 * @return true, if operation was successful. 349 */ configureExtListen(boolean enable, int periodInMillis, int intervalInMillis, @Nullable WifiP2pExtListenParams extListenParams)350 boolean configureExtListen(boolean enable, int periodInMillis, int intervalInMillis, 351 @Nullable WifiP2pExtListenParams extListenParams); 352 353 /** 354 * Set P2P Listen channel. 355 * 356 * @param listenChannel Wifi channel. eg, 1, 6, 11. 357 * 358 * @return true, if operation was successful. 359 */ setListenChannel(int listenChannel)360 boolean setListenChannel(int listenChannel); 361 362 /** 363 * Set P2P operating channel. 364 * 365 * @param operatingChannel the desired operating channel. 366 * @param unsafeChannels channels which p2p cannot use. 367 * 368 * @return true, if operation was successful. 369 */ setOperatingChannel(int operatingChannel, @NonNull List<CoexUnsafeChannel> unsafeChannels)370 boolean setOperatingChannel(int operatingChannel, 371 @NonNull List<CoexUnsafeChannel> unsafeChannels); 372 373 /** 374 * This command can be used to add a upnp/bonjour service. 375 * 376 * @param servInfo List of service queries. 377 * 378 * @return true, if operation was successful. 379 */ serviceAdd(WifiP2pServiceInfo servInfo)380 boolean serviceAdd(WifiP2pServiceInfo servInfo); 381 382 /** 383 * This command can be used to remove a upnp/bonjour service. 384 * 385 * @param servInfo List of service queries. 386 * 387 * @return true, if operation was successful. 388 */ serviceRemove(WifiP2pServiceInfo servInfo)389 boolean serviceRemove(WifiP2pServiceInfo servInfo); 390 391 /** 392 * Schedule a P2P service discovery request. The parameters for this command 393 * are the device address of the peer device (or 00:00:00:00:00:00 for 394 * wildcard query that is sent to every discovered P2P peer that supports 395 * service discovery) and P2P Service Query TLV(s) as hexdump. 396 * 397 * @param peerAddress MAC address of the device to discover. 398 * @param query Hex dump of the query data. 399 * @return identifier Identifier for the request. Can be used to cancel the 400 * request. 401 */ requestServiceDiscovery(String peerAddress, String query)402 String requestServiceDiscovery(String peerAddress, String query); 403 404 /** 405 * Cancel a previous service discovery request. 406 * 407 * @param identifier Identifier for the request to cancel. 408 * @return true, if operation was successful. 409 */ cancelServiceDiscovery(String identifier)410 boolean cancelServiceDiscovery(String identifier); 411 412 /** 413 * Send driver command to set Miracast mode. 414 * 415 * @param mode Mode of Miracast. 416 * @return true, if operation was successful. 417 */ setMiracastMode(int mode)418 boolean setMiracastMode(int mode); 419 420 /** 421 * Initiate WPS Push Button setup. 422 * The PBC operation requires that a button is also pressed at the 423 * AP/Registrar at about the same time (2 minute window). 424 * 425 * @param groupIfName Group interface name to use. 426 * @param bssid BSSID of the AP. Use empty bssid to indicate wildcard. 427 * @return true, if operation was successful. 428 */ startWpsPbc(String groupIfName, String bssid)429 boolean startWpsPbc(String groupIfName, String bssid); 430 431 /** 432 * Initiate WPS Pin Keypad setup. 433 * 434 * @param groupIfName Group interface name to use. 435 * @param pin 8 digit pin to be used. 436 * @return true, if operation was successful. 437 */ startWpsPinKeypad(String groupIfName, String pin)438 boolean startWpsPinKeypad(String groupIfName, String pin); 439 440 /** 441 * Initiate WPS Pin Display setup. 442 * 443 * @param groupIfName Group interface name to use. 444 * @param bssid BSSID of the AP. Use empty bssid to indicate wildcard. 445 * @return generated pin if operation was successful, null otherwise. 446 */ startWpsPinDisplay(String groupIfName, String bssid)447 String startWpsPinDisplay(String groupIfName, String bssid); 448 449 /** 450 * Cancel any ongoing WPS operations. 451 * 452 * @param groupIfName Group interface name to use. 453 * @return true, if operation was successful. 454 */ cancelWps(String groupIfName)455 boolean cancelWps(String groupIfName); 456 457 /** 458 * Enable/Disable Wifi Display. 459 * 460 * @param enable true to enable, false to disable. 461 * @return true, if operation was successful. 462 */ enableWfd(boolean enable)463 boolean enableWfd(boolean enable); 464 465 /** 466 * Set Wifi Display device info. 467 * 468 * @param info WFD device info as described in section 5.1.2 of WFD technical 469 * specification v1.0.0. 470 * @return true, if operation was successful. 471 */ setWfdDeviceInfo(String info)472 boolean setWfdDeviceInfo(String info); 473 474 /** 475 * Remove network with provided id. 476 * 477 * @param networkId Id of the network to lookup. 478 * @return true, if operation was successful. 479 */ removeNetwork(int networkId)480 boolean removeNetwork(int networkId); 481 482 /** 483 * Get the persistent group list from wpa_supplicant's p2p mgmt interface 484 * 485 * @param groups WifiP2pGroupList to store persistent groups in 486 * @return true, if list has been modified. 487 */ loadGroups(WifiP2pGroupList groups)488 boolean loadGroups(WifiP2pGroupList groups); 489 490 /** 491 * Set WPS device name. 492 * 493 * @param name String to be set. 494 * @return true if request is sent successfully, false otherwise. 495 */ setWpsDeviceName(String name)496 boolean setWpsDeviceName(String name); 497 498 /** 499 * Set WPS device type. 500 * 501 * @param typeStr Type specified as a string. Used format: <categ>-<OUI>-<subcateg> 502 * @return true if request is sent successfully, false otherwise. 503 */ setWpsDeviceType(String typeStr)504 boolean setWpsDeviceType(String typeStr); 505 506 /** 507 * Set WPS config methods 508 * 509 * @param configMethodsStr List of config methods. 510 * @return true if request is sent successfully, false otherwise. 511 */ setWpsConfigMethods(String configMethodsStr)512 boolean setWpsConfigMethods(String configMethodsStr); 513 514 /** 515 * Get NFC handover request message. 516 * 517 * @return select message if created successfully, null otherwise. 518 */ getNfcHandoverRequest()519 String getNfcHandoverRequest(); 520 521 /** 522 * Get NFC handover select message. 523 * 524 * @return select message if created successfully, null otherwise. 525 */ getNfcHandoverSelect()526 String getNfcHandoverSelect(); 527 528 /** 529 * Report NFC handover select message. 530 * 531 * @return true if reported successfully, false otherwise. 532 */ initiatorReportNfcHandover(String selectMessage)533 boolean initiatorReportNfcHandover(String selectMessage); 534 535 /** 536 * Report NFC handover request message. 537 * 538 * @return true if reported successfully, false otherwise. 539 */ responderReportNfcHandover(String requestMessage)540 boolean responderReportNfcHandover(String requestMessage); 541 542 /** 543 * Set the client list for the provided network. 544 * 545 * @param networkId Id of the network. 546 * @param clientListStr Space separated list of clients. 547 * @return true, if operation was successful. 548 */ setClientList(int networkId, String clientListStr)549 boolean setClientList(int networkId, String clientListStr); 550 551 /** 552 * Set the client list for the provided network. 553 * 554 * @param networkId Id of the network. 555 * @return Space separated list of clients if successful, null otherwise. 556 */ getClientList(int networkId)557 String getClientList(int networkId); 558 559 /** 560 * Persist the current configurations to disk. 561 * 562 * @return true, if operation was successful. 563 */ saveConfig()564 boolean saveConfig(); 565 566 /** 567 * Enable/Disable P2P MAC randomization. 568 * 569 * @param enable true to enable, false to disable. 570 * @return true, if operation was successful. 571 */ setMacRandomization(boolean enable)572 boolean setMacRandomization(boolean enable); 573 574 /** 575 * Set Wifi Display R2 device info. 576 * 577 * @param info WFD R2 device info as described in section 5.1.12 of WFD technical 578 * specification v2.1. 579 * @return true, if operation was successful. 580 */ setWfdR2DeviceInfo(String info)581 boolean setWfdR2DeviceInfo(String info); 582 583 /** 584 * Remove the client with the MAC address from the group. 585 * 586 * @param peerAddress Mac address of the client. 587 * @param isLegacyClient Indicate if client is a legacy client or not. 588 * @return true if success 589 */ removeClient(String peerAddress, boolean isLegacyClient)590 boolean removeClient(String peerAddress, boolean isLegacyClient); 591 592 /** 593 * Set vendor-specific information elements to wpa_supplicant. 594 * 595 * @param vendorElements vendor-specific information elements. 596 * 597 * @return boolean value indicating whether operation was successful. 598 */ setVendorElements(Set<ScanResult.InformationElement> vendorElements)599 boolean setVendorElements(Set<ScanResult.InformationElement> vendorElements); 600 601 /** 602 * Configure the IP addresses in supplicant for P2P GO to provide the IP address to 603 * client in EAPOL handshake. Refer Wi-Fi P2P Technical Specification v1.7 - Section 4.2.8 604 * IP Address Allocation in EAPOL-Key Frames (4-Way Handshake) for more details. 605 * The IP addresses are IPV4 addresses and higher-order address bytes are in the 606 * lower-order int bytes (e.g. 1.2.3.4 is represented as 0x04030201) 607 * 608 * @param ipAddressGo The P2P Group Owner IP address. 609 * @param ipAddressMask The P2P Group owner subnet mask. 610 * @param ipAddressStart The starting address in the IP address pool. 611 * @param ipAddressEnd The ending address in the IP address pool. 612 * @return boolean value indicating whether operation was successful. 613 */ configureEapolIpAddressAllocationParams(int ipAddressGo, int ipAddressMask, int ipAddressStart, int ipAddressEnd)614 boolean configureEapolIpAddressAllocationParams(int ipAddressGo, int ipAddressMask, 615 int ipAddressStart, int ipAddressEnd); 616 617 /** 618 * Start an Un-synchronized Service Discovery (USD) based P2P service discovery. 619 * 620 * @param usdServiceConfig is the USD based service configuration. 621 * @param discoveryConfig is the configuration for this service discovery request. 622 * @param timeoutInSeconds is the maximum time to be spent for this service discovery request. 623 */ startUsdBasedServiceDiscovery(WifiP2pUsdBasedServiceConfig usdServiceConfig, WifiP2pUsdBasedServiceDiscoveryConfig discoveryConfig, int timeoutInSeconds)624 int startUsdBasedServiceDiscovery(WifiP2pUsdBasedServiceConfig usdServiceConfig, 625 WifiP2pUsdBasedServiceDiscoveryConfig discoveryConfig, int timeoutInSeconds); 626 627 /** 628 * Stop an Un-synchronized Service Discovery (USD) based P2P service discovery. 629 * 630 * @param sessionId Identifier to cancel the service discovery instance. 631 * Use zero to cancel all the service discovery instances. 632 */ stopUsdBasedServiceDiscovery(int sessionId)633 void stopUsdBasedServiceDiscovery(int sessionId); 634 635 /** 636 * Start an Un-synchronized Service Discovery (USD) based P2P service advertisement. 637 * 638 * @param usdServiceConfig is the USD based service configuration. 639 * @param advertisementConfig is the configuration for this service advertisement. 640 * @param timeoutInSeconds is the maximum time to be spent for this service advertisement. 641 */ startUsdBasedServiceAdvertisement(WifiP2pUsdBasedServiceConfig usdServiceConfig, WifiP2pUsdBasedLocalServiceAdvertisementConfig advertisementConfig, int timeoutInSeconds)642 int startUsdBasedServiceAdvertisement(WifiP2pUsdBasedServiceConfig usdServiceConfig, 643 WifiP2pUsdBasedLocalServiceAdvertisementConfig advertisementConfig, 644 int timeoutInSeconds); 645 646 /** 647 * Stop an Un-synchronized Service Discovery (USD) based P2P service advertisement. 648 * 649 * @param sessionId Identifier to cancel the service advertisement. 650 * Use zero to cancel all the service advertisement instances. 651 */ stopUsdBasedServiceAdvertisement(int sessionId)652 void stopUsdBasedServiceAdvertisement(int sessionId); 653 654 /** 655 * Get the Device Identity Resolution (DIR) Information. 656 * See {@link WifiP2pDirInfo} for details 657 * 658 * @return {@link WifiP2pDirInfo} instance on success, null on failure. 659 */ getDirInfo()660 WifiP2pDirInfo getDirInfo(); 661 662 /** 663 * Validate the Device Identity Resolution (DIR) Information of a P2P device. 664 * See {@link WifiP2pDirInfo} for details. 665 * 666 * @param dirInfo {@link WifiP2pDirInfo} to validate. 667 * @return The identifier of device identity key on success, -1 on failure. 668 */ validateDirInfo(@onNull WifiP2pDirInfo dirInfo)669 int validateDirInfo(@NonNull WifiP2pDirInfo dirInfo); 670 671 /** 672 * Used to authorize a connection request to an existing Group Owner 673 * interface, to allow a peer device to connect. 674 * 675 * @param config Configuration to use for connection. 676 * @param groupOwnerInterfaceName Group Owner interface name on which the request to connect 677 * needs to be authorized. 678 * 679 * @return boolean value indicating whether operation was successful. 680 */ authorizeConnectRequestOnGroupOwner(WifiP2pConfig config, String groupOwnerInterfaceName)681 boolean authorizeConnectRequestOnGroupOwner(WifiP2pConfig config, 682 String groupOwnerInterfaceName); 683 684 /** 685 * Terminate the supplicant daemon & wait for its death. 686 * Note: Aidl only since it was added from HIDL 1.1 687 */ terminate()688 default void terminate() {}; 689 690 /** 691 * Registers a death notification for supplicant. 692 * @return Returns true on success. 693 * 694 * Note: Aidl only. 695 */ registerDeathHandler(@onNull WifiNative.SupplicantDeathEventHandler handler)696 default boolean registerDeathHandler(@NonNull WifiNative.SupplicantDeathEventHandler handler) { 697 return true; 698 }; 699 700 /** 701 * Deregisters a death notification for supplicant. 702 * @return Returns true on success. 703 * 704 * Note: Aidl only. 705 */ deregisterDeathHandler()706 default boolean deregisterDeathHandler() { 707 return true; 708 }; 709 } 710