1

I am creating an app to communicate with printer using Wi-Fi Direct.

The app will list all the printers in Wi-Fi direct range once click on displayed printer it will send invitation to printer to connect. Click on accept it will connect.

The app works fine in all the brands (Pixel, Samsung, Asus, Moto etc.) except HUAWEI (Device: P20 lite & MediaPad M5) brand Android 9.

Issue: Click on displayed printer to send connection request. The connection request success but after 7 seconds it get called WIFI_P2P_CONNECTION_CHANGED_ACTION there it says it is not connected. The invitation not received from printer.

Connection Logic:

config.groupOwnerIntent = 0;
config.deviceAddress = deviceAddress;
config.wps.setup = WpsInfo.PBC;
manager.connect(channel, config, new WifiP2pManager.ActionListener() {
    @Override
    public void onSuccess() {
        Log.d(TAG, "Connection request success");
    }
    @Override
    public void onFailure(int reason) {
        Log.w(TAG, "Connection request failed reason : " + reason);
    }
});

Logs:

01-24 15:59:11.300  6401  6401 I HwPhoneWindow: updateLayoutParamsColor true mSpecialSet=false, mForcedNavigationBarColor=false, navigationBarColor=ff000000, mNavBarShow=true, mIsFloating=true
01-24 15:59:11.303  5386  5386 D UsbSettingsService: handleMessage, msg.what = 4
01-24 15:59:11.304  5386  5386 D UsbSettingsService: receive message to check monkey running.
01-24 15:59:11.309  6401  6401 I FLTAG_FM: loadFeature class:com.huawei.featurelayer.systemfeature.HwWidget.IHwSplineOverScrollerEx
01-24 15:59:11.310  6401  6401 I FLTAG_SFM: getRequireClassLoader() succ ! className: com.huawei.featurelayer.systemfeature.HwWidget.IHwSplineOverScrollerEx
01-24 15:59:11.310  6401  6401 D FeatureFactory: loadFeature() : com.huawei.featurelayer.systemfeature.HwWidget.IHwSplineOverScrollerEx
01-24 15:59:11.310  6401  6401 D FeatureFactory: loadFeature() new IHwSplineOverScrollerEx()
01-24 15:59:11.310  6401  6401 D HwSplineOverScrollerExImpl: initSplineOverScrollerImpl paras: android.widget.OverScroller$SplineOverScroller@203a42d,android.view.ContextThemeWrapper@f60cd62
01-24 15:59:11.310  6401  6401 D HwSplineOverScrollerExImpl: initSplineOverScrollerImpl: mScrollerVelocity is 0, value is 0
01-24 15:59:11.310  6401  6401 I FLTAG_FM: loadFeature class:com.huawei.featurelayer.systemfeature.HwWidget.IHwSplineOverScrollerEx
01-24 15:59:11.311  6401  6401 I FLTAG_SFM: getRequireClassLoader() succ ! className: com.huawei.featurelayer.systemfeature.HwWidget.IHwSplineOverScrollerEx
01-24 15:59:11.311  6401  6401 D FeatureFactory: loadFeature() : com.huawei.featurelayer.systemfeature.HwWidget.IHwSplineOverScrollerEx
01-24 15:59:11.311  6401  6401 D FeatureFactory: loadFeature() new IHwSplineOverScrollerEx()
01-24 15:59:11.311  6401  6401 D HwSplineOverScrollerExImpl: initSplineOverScrollerImpl paras: android.widget.OverScroller$SplineOverScroller@e025dae,android.view.ContextThemeWrapper@f60cd62
01-24 15:59:11.311  6401  6401 D HwSplineOverScrollerExImpl: initSplineOverScrollerImpl: mScrollerVelocity is 0, value is 0
01-24 15:59:11.315  6401  6401 I FLTAG_FM: loadFeature class:com.huawei.featurelayer.systemfeature.HwWidget.IHwSplineOverScrollerEx
01-24 15:59:11.315  6401  6401 I FLTAG_SFM: getRequireClassLoader() succ ! className: com.huawei.featurelayer.systemfeature.HwWidget.IHwSplineOverScrollerEx
01-24 15:59:11.315  6401  6401 D FeatureFactory: loadFeature() : com.huawei.featurelayer.systemfeature.HwWidget.IHwSplineOverScrollerEx
01-24 15:59:11.315  6401  6401 D FeatureFactory: loadFeature() new IHwSplineOverScrollerEx()
01-24 15:59:11.315  6401  6401 D HwSplineOverScrollerExImpl: initSplineOverScrollerImpl paras: android.widget.OverScroller$SplineOverScroller@9722be5,android.view.ContextThemeWrapper@f60cd62
01-24 15:59:11.315  6401  6401 D HwSplineOverScrollerExImpl: initSplineOverScrollerImpl: mScrollerVelocity is 0, value is 0
01-24 15:59:11.315  6401  6401 I FLTAG_FM: loadFeature class:com.huawei.featurelayer.systemfeature.HwWidget.IHwSplineOverScrollerEx
01-24 15:59:11.315  6401  6401 I FLTAG_SFM: getRequireClassLoader() succ ! className: com.huawei.featurelayer.systemfeature.HwWidget.IHwSplineOverScrollerEx
01-24 15:59:11.315  6401  6401 D FeatureFactory: loadFeature() : com.huawei.featurelayer.systemfeature.HwWidget.IHwSplineOverScrollerEx
01-24 15:59:11.315  6401  6401 D FeatureFactory: loadFeature() new IHwSplineOverScrollerEx()
01-24 15:59:11.316  6401  6401 D HwSplineOverScrollerExImpl: initSplineOverScrollerImpl paras: android.widget.OverScroller$SplineOverScroller@301d96b,android.view.ContextThemeWrapper@f60cd62
01-24 15:59:11.316  6401  6401 D HwSplineOverScrollerExImpl: initSplineOverScrollerImpl: mScrollerVelocity is 0, value is 0
01-24 15:59:11.326  6401  6509 D OpenGLRenderer:   HWUI Binary is  enabled
01-24 15:59:11.334   607   756 D         : doWinFrameOptStatusRecog begin to recog Layer result=2
01-24 15:59:11.337  1334  1345 I chatty  : uid=1000(system) Binder:1334_2 expire 8 lines
01-24 15:59:11.338  6401  6401 D WDManager: Connection request.
01-24 15:59:11.351  6401  6401 D WifiP2pManager: connect, pid:6401, tid:6401, uid:10146
01-24 15:59:11.356   708   708 W wificond: No handler for scan result notification from interface with index: 29
01-24 15:59:11.363  6401 13900 I HiTouch_HiTouchSensor: enabledInPad = false,isPcCastMode = false
01-24 15:59:11.364  1334  1777 I chatty  : uid=1000(system) Binder:1334_A expire 2 lines
01-24 15:59:11.364  6401 13900 D HiTouch_PressGestureDetector: onAttached, package=jp.co.sharp.printsystem.sharpdeskmobile_int, windowType=2, mHiTouchRestricted=false
01-24 15:59:11.379   607  1101 E BufferQueueProducer: [] mConsumerName == NULL!!!!!!
01-24 15:59:11.383   558   616 W SocketListener: sending broadcast to Pid = 1334, Uid = 1000 
01-24 15:59:11.385   581   975 I GRALLOC : getCallingPid=607, shrFd=11,fmt=0x1,intFmt=0x1,btStrd=5120,size=2764800,pid=581 
01-24 15:59:11.385   581   975 I GRALLOC :   yuv=2,w=1218,h=540,Stride u=0 v=0,offset u=0 v=0 
01-24 15:59:11.385   581   975 I GRALLOC :   iova_size=2764800,conUsg=0x900,proUsg=0x900,    strd=1280,[afbc]HdrStrd=0 PyldStrd=0 Scrmbl=0,ionhnd = 1 
01-24 15:59:11.387   581   971 I GRALLOC : getCallingPid=607, shrFd=34,fmt=0x1,intFmt=0x1,btStrd=5120,size=2764800,pid=581 
01-24 15:59:11.387   581   971 I GRALLOC :   yuv=2,w=1218,h=540,Stride u=0 v=0,offset u=0 v=0 
01-24 15:59:11.387   581   971 I GRALLOC :   iova_size=2764800,conUsg=0x900,proUsg=0x900,    strd=1280,[afbc]HdrStrd=0 PyldStrd=0 Scrmbl=0,ionhnd = 2 
01-24 15:59:11.389   581   581 I GRALLOC : getCallingPid=607, shrFd=36,fmt=0x1,intFmt=0x1,btStrd=5120,size=2764800,pid=581 
01-24 15:59:11.389   581   581 I GRALLOC :   yuv=2,w=1218,h=540,Stride u=0 v=0,offset u=0 v=0 
01-24 15:59:11.389   581   581 I GRALLOC :   iova_size=2764800,conUsg=0x900,proUsg=0x900,    strd=1280,[afbc]HdrStrd=0 PyldStrd=0 Scrmbl=0,ionhnd = 3 
01-24 15:59:11.391  6401  6509 D mali_winsys: EGLint new_window_surface(egl_winsys_display *, void *, EGLSurface, EGLConfig, egl_winsys_surface **, EGLBoolean) returns 0x3000
01-24 15:59:11.395   558   617 W SocketListener: sending broadcast to Pid = 1334, Uid = 1000 
01-24 15:59:11.397  6401  6401 I ViewRootImpl: jank_removeInvalidNode all the node in jank list is out of time
01-24 15:59:11.398  6401  6509 D OpenGLRenderer:   HWUI Binary is  enabled
01-24 15:59:11.404  1807  1948 D DeviceStateService: tether state changed : false
01-24 15:59:11.407   581   975 I GRALLOC : getCallingPid=607, shrFd=11,fmt=0x1,intFmt=0x1,btStrd=5120,size=2764800,pid=581 
01-24 15:59:11.407   581   975 I GRALLOC :   yuv=2,w=1218,h=540,Stride u=0 v=0,offset u=0 v=0 
01-24 15:59:11.407   581   975 I GRALLOC :   iova_size=2764800,conUsg=0xb00,proUsg=0xb00,    strd=1280,[afbc]HdrStrd=0 PyldStrd=0 Scrmbl=0,ionhnd = 1 
01-24 15:59:11.419  6401  6401 D WDManager: Connection request success
01-24 15:59:11.424   581   975 I GRALLOC : getCallingPid=607, shrFd=11,fmt=0x1,intFmt=0x1,btStrd=5120,size=2764800,pid=581 
01-24 15:59:11.424   581   975 I GRALLOC :   yuv=2,w=1218,h=540,Stride u=0 v=0,offset u=0 v=0 
01-24 15:59:11.424   581   975 I GRALLOC :   iova_size=2764800,conUsg=0xb00,proUsg=0xb00,    strd=1280,[afbc]HdrStrd=0 PyldStrd=0 Scrmbl=0,ionhnd = 1 
01-24 15:59:11.426  6401  6401 D BR: P2P peers changed
01-24 15:59:11.435   581   975 I GRALLOC : getCallingPid=607, shrFd=11,fmt=0x1,intFmt=0x1,btStrd=5120,size=2764800,pid=581 
01-24 15:59:11.435   581   975 I GRALLOC :   yuv=2,w=1218,h=540,Stride u=0 v=0,offset u=0 v=0 
01-24 15:59:11.435   581   975 I GRALLOC :   iova_size=2764800,conUsg=0xb00,proUsg=0xb00,    strd=1280,[afbc]HdrStrd=0 PyldStrd=0 Scrmbl=0,ionhnd = 1 
01-24 15:59:11.441  6401  6401 D WDManager: getDeviceList size:1
01-24 15:59:11.443   607   756 D         : doWinFrameOptStatusRecog begin to recog Layer result=2
01-24 15:59:11.446  6401  6401 D WDManager: Peer device name :My Device, Status :Invited
01-24 15:59:11.446  1869  2073 E HSM_BG  : NatTrafficNotifyService:imsi is null, so return
01-24 15:59:11.451   741   927 W JankService: processEntry, not beta version or commercial log off
01-24 15:59:11.559  1779  1902 I HwNaturalBase: [CommonHandler]: 32688Kb ram is used.
01-24 15:59:12.121 12207 12227 I Finsky:background: [622] fzl.run(10): Stats for Executor: BlockingExecutor ief@3cbc85[Running, pool size = 0, active threads = 0, queued tasks = 0, completed tasks = 15]
01-24 15:59:13.429 13901 13901 W dumpsys : type=1400 audit(0.0:2088): avc: denied { read } for name="pipe-max-size" dev="proc" ino=80180 scontext=u:r:system_app:s0 tcontext=u:object_r:proc_pipe_conf:s0 tclass=file permissive=0
01-24 15:59:15.221  1334 13903 I chatty  : uid=1000 system_server expire 1 line
01-24 15:59:15.258   603   603 I chatty  : uid=1010 wifi@1.1-servic expire 7 lines
01-24 15:59:15.733  1334  1440 I chatty  : uid=1000(system) UEventObserver expire 6 lines
01-24 15:59:17.367  1334  1349 I chatty  : uid=1000(system) android.bg expire 1 line
01-24 15:59:17.487   741   925 I JankService: startProc
01-24 15:59:17.551   741   925 I JankService:  waitpid pid 13904
01-24 15:59:17.551 13904 13904 E JankService: child Thread receive to stop
01-24 15:59:17.551 13904 13904 I JankService: child proc finish read io
01-24 15:59:17.687   741   925 I JankService:  waitpid pid 13904
01-24 15:59:17.687   741   925 E JankService: all data read ok
01-24 15:59:18.447  6401  6401 D BR: Device disconnected
user3374790
  • 227
  • 3
  • 13
  • Are the working devices Huawei's devices? If yes, the app should work in P20 Lite and MediaPad M5. I can help to investigate the issue if you can share the app with me. I have a MediaPad M5 Lite and like to verify the app on the device. – Zinna Jan 25 '22 at 02:24
  • @Zinna Thank you very much, We did not tested with other Huawei's devices, We tested Pixel, Samsung, Asus, Moto etc., it works fine. I will share you our POC app (Google Wi-Fi Direct Sample) the same logic we used in our application. Source Code: https://drive.google.com/file/d/1Acl44mPNWEesh1kg4Qvze4XWQYwLHKd_/view?usp=sharing APK : https://drive.google.com/file/d/19Ik4yt5DtgukV8bpHd9rGuZZm9X85Nln/view?usp=sharing – user3374790 Jan 25 '22 at 04:55

1 Answers1

0

Because I don't have a printer with WiFi Direct, I verified the WiFi Direct POC apk on some Huawei devices including Mate 20 Pro, Mate 30, MediaPad M5 Lite 10, MatePad Pro, and LG and Samsung's devices including V30 and Galaxy S5. I use the apk on a device to connect other devices through WiFi Direct. It works fine with the devices. Here are the screenshots for the test between Mate 20 Pro and MediaPad M5 Lite 10. enter image description here

enter image description here

Here is the short video to show the WiFi Direct apk to connect Mate 20 Pro and MediaPad m5 Lite 10. https://drive.google.com/file/d/1SKUAAgw0dif7ifshVBq8ficRv8YJN7dq/view?usp=sharing

Zinna
  • 1,947
  • 2
  • 5
  • 20