| | | |
Offset 148, 14 lines modified | Offset 148, 15 lines modified |
148 | ····private·volatile·Capabilities·mCapabilities; | 148 | ····private·volatile·Capabilities·mCapabilities; |
149 | ····private·volatile·Characteristics·mCharacteristics; | 149 | ····private·volatile·Characteristics·mCharacteristics; |
150 | ····private·final·SparseArray·mClients; | 150 | ····private·final·SparseArray·mClients; |
151 | ····private·Context·mContext; | 151 | ····private·Context·mContext; |
152 | ····private·ConfigRequest·mCurrentAwareConfiguration; | 152 | ····private·ConfigRequest·mCurrentAwareConfiguration; |
153 | ····private·byte[]·mCurrentDiscoveryInterfaceMac; | 153 | ····private·byte[]·mCurrentDiscoveryInterfaceMac; |
154 | ····private·boolean·mCurrentIdentityNotification; | 154 | ····private·boolean·mCurrentIdentityNotification; |
| 155 | ····private·boolean·mCurrentRangingEnabled; |
155 | ····public·WifiAwareDataPathStateManager·mDataPathMgr; | 156 | ····public·WifiAwareDataPathStateManager·mDataPathMgr; |
156 | ····private·boolean·mDbg; | 157 | ····private·boolean·mDbg; |
157 | ····private·LocationManager·mLocationManager; | 158 | ····private·LocationManager·mLocationManager; |
158 | ····private·PowerManager·mPowerManager; | 159 | ····private·PowerManager·mPowerManager; |
159 | ····private·Map·mSettableParameters; | 160 | ····private·Map·mSettableParameters; |
160 | ····private·WifiAwareStateManager$WifiAwareStateMachine·mSm; | 161 | ····private·WifiAwareStateManager$WifiAwareStateMachine·mSm; |
161 | ····private·volatile·boolean·mUsageEnabled; | 162 | ····private·volatile·boolean·mUsageEnabled; |
Offset 177, 14 lines modified | Offset 178, 15 lines modified |
177 | ····public·WifiAwareStateManager()·{ | 178 | ····public·WifiAwareStateManager()·{ |
178 | ········this.mDbg·=·false; | 179 | ········this.mDbg·=·false; |
179 | ········this.mUsageEnabled·=·false; | 180 | ········this.mUsageEnabled·=·false; |
180 | ········this.mCharacteristics·=·null; | 181 | ········this.mCharacteristics·=·null; |
181 | ········this.mClients·=·new·SparseArray(); | 182 | ········this.mClients·=·new·SparseArray(); |
182 | ········this.mCurrentAwareConfiguration·=·null; | 183 | ········this.mCurrentAwareConfiguration·=·null; |
183 | ········this.mCurrentIdentityNotification·=·false; | 184 | ········this.mCurrentIdentityNotification·=·false; |
| 185 | ········this.mCurrentRangingEnabled·=·false; |
184 | ········this.mCurrentDiscoveryInterfaceMac·=·WifiAwareStateManager.ALL_ZERO_MAC; | 186 | ········this.mCurrentDiscoveryInterfaceMac·=·WifiAwareStateManager.ALL_ZERO_MAC; |
185 | ········this.mSettableParameters·=·new·HashMap(); | 187 | ········this.mSettableParameters·=·new·HashMap(); |
186 | ········this.onReset(); | 188 | ········this.onReset(); |
187 | ····} | 189 | ····} |
188 | ···· | 190 | ···· |
189 | ····private·boolean·connectLocal(final·short·n,·final·int·n2,·final·int·n3,·final·int·n4,·final·String·s,·final·String·s2,·final·IWifiAwareEventCallback·wifiAwareEventCallback,·final·ConfigRequest·configRequest,·final·boolean·b)·{ | 191 | ····private·boolean·connectLocal(final·short·n,·final·int·n2,·final·int·n3,·final·int·n4,·final·String·s,·final·String·s2,·final·IWifiAwareEventCallback·wifiAwareEventCallback,·final·ConfigRequest·configRequest,·final·boolean·b)·{ |
190 | ········final·boolean·mUsageEnabled·=·this.mUsageEnabled; | 192 | ········final·boolean·mUsageEnabled·=·this.mUsageEnabled; |
Offset 262, 15 lines modified | Offset 264, 15 lines modified |
262 | ········int·n7; | 264 | ········int·n7; |
263 | ········if·(this.mCurrentAwareConfiguration·==·null)·{ | 265 | ········if·(this.mCurrentAwareConfiguration·==·null)·{ |
264 | ············n7·=·n5; | 266 | ············n7·=·n5; |
265 | ········} | 267 | ········} |
266 | ········else·{ | 268 | ········else·{ |
267 | ············n7·=·0; | 269 | ············n7·=·0; |
268 | ········} | 270 | ········} |
269 | ········final·boolean·enableAndConfigure·=·mWifiAwareNativeApi.enableAndConfigure(n,·mergeConfigRequests,·(boolean)(n6·!=·0),·(boolean)(n7·!=·0),·this.mPowerManager.isInteractive(),·this.mPowerManager.isDeviceIdleMode()); | 271 | ········final·boolean·enableAndConfigure·=·mWifiAwareNativeApi.enableAndConfigure(n,·mergeConfigRequests,·(boolean)(n6·!=·0),·(boolean)(n7·!=·0),·this.mPowerManager.isInteractive(),·this.mPowerManager.isDeviceIdleMode(),·this.mCurrentRangingEnabled); |
270 | ········if·(!enableAndConfigure)·{ | 272 | ········if·(!enableAndConfigure)·{ |
271 | ············try·{ | 273 | ············try·{ |
272 | ················wifiAwareEventCallback.onConnectFail(n5); | 274 | ················wifiAwareEventCallback.onConnectFail(n5); |
273 | ················this.mAwareMetrics.recordAttachStatus(n5); | 275 | ················this.mAwareMetrics.recordAttachStatus(n5); |
274 | ············} | 276 | ············} |
275 | ············catch·(RemoteException·ex4)·{ | 277 | ············catch·(RemoteException·ex4)·{ |
276 | ················final·StringBuilder·sb6·=·new·StringBuilder(); | 278 | ················final·StringBuilder·sb6·=·new·StringBuilder(); |
Offset 319, 26 lines modified | Offset 321, 36 lines modified |
319 | ········} | 321 | ········} |
320 | ········final·ConfigRequest·mergeConfigRequests·=·this.mergeConfigRequests(null); | 322 | ········final·ConfigRequest·mergeConfigRequests·=·this.mergeConfigRequests(null); |
321 | ········if·(mergeConfigRequests·==·null)·{ | 323 | ········if·(mergeConfigRequests·==·null)·{ |
322 | ············Log.wtf(s,·"disconnectLocal:·got·an·incompatible·merge·on·remaining·configs!?"); | 324 | ············Log.wtf(s,·"disconnectLocal:·got·an·incompatible·merge·on·remaining·configs!?"); |
323 | ············return·false; | 325 | ············return·false; |
324 | ········} | 326 | ········} |
325 | ········final·boolean·doesAnyClientNeedIdentityChangeNotifications·=·this.doesAnyClientNeedIdentityChangeNotifications(); | 327 | ········final·boolean·doesAnyClientNeedIdentityChangeNotifications·=·this.doesAnyClientNeedIdentityChangeNotifications(); |
326 | ········return·(!mergeConfigRequests.equals((Object)this.mCurrentAwareConfiguration)·||·this.mCurrentIdentityNotification·!=·doesAnyClientNeedIdentityChangeNotifications)·&&·this.mWifiAwareNativeApi.enableAndConfigure(n,·mergeConfigRequests,·doesAnyClientNeedIdentityChangeNotifications,·false,·this.mPowerManager.isInteractive(),·this.mPowerManager.isDeviceIdleMode()); | 328 | ········final·boolean·doesAnyClientNeedRanging·=·this.doesAnyClientNeedRanging(); |
| 329 | ········return·(!mergeConfigRequests.equals((Object)this.mCurrentAwareConfiguration)·||·this.mCurrentIdentityNotification·!=·doesAnyClientNeedIdentityChangeNotifications·||·this.mCurrentRangingEnabled·!=·doesAnyClientNeedRanging)·&&·this.mWifiAwareNativeApi.enableAndConfigure(n,·mergeConfigRequests,·doesAnyClientNeedIdentityChangeNotifications,·false,·this.mPowerManager.isInteractive(),·this.mPowerManager.isDeviceIdleMode(),·doesAnyClientNeedRanging); |
327 | ····} | 330 | ····} |
328 | ···· | 331 | ···· |
329 | ····private·boolean·doesAnyClientNeedIdentityChangeNotifications()·{ | 332 | ····private·boolean·doesAnyClientNeedIdentityChangeNotifications()·{ |
330 | ········for·(int·i·=·0;·i·<·this.mClients.size();·++i)·{ | 333 | ········for·(int·i·=·0;·i·<·this.mClients.size();·++i)·{ |
331 | ············if·(((WifiAwareClientState)this.mClients.valueAt(i)).getNotifyIdentityChange())·{ | 334 | ············if·(((WifiAwareClientState)this.mClients.valueAt(i)).getNotifyIdentityChange())·{ |
332 | ················return·true; | 335 | ················return·true; |
333 | ············} | 336 | ············} |
334 | ········} | 337 | ········} |
335 | ········return·false; | 338 | ········return·false; |
336 | ····} | 339 | ····} |
337 | ···· | 340 | ···· |
| 341 | ····private·boolean·doesAnyClientNeedRanging()·{ |
| 342 | ········for·(int·i·=·0;·i·<·this.mClients.size();·++i)·{ |
| 343 | ············if·(((WifiAwareClientState)this.mClients.valueAt(i)).isRangingEnabled())·{ |
| 344 | ················return·true; |
| 345 | ············} |
| 346 | ········} |
| 347 | ········return·false; |
| 348 | ····} |
| 349 | ···· |
338 | ····private·void·enableUsageLocal()·{ | 350 | ····private·void·enableUsageLocal()·{ |
339 | ········if·(this.mCapabilities·==·null)·{ | 351 | ········if·(this.mCapabilities·==·null)·{ |
340 | ············this.getAwareInterface(); | 352 | ············this.getAwareInterface(); |
341 | ············this.queryCapabilities(); | 353 | ············this.queryCapabilities(); |
342 | ············this.releaseAwareInterface(); | 354 | ············this.releaseAwareInterface(); |
343 | ········} | 355 | ········} |
344 | ········if·(this.mUsageEnabled)·{ | 356 | ········if·(this.mUsageEnabled)·{ |
Offset 575, 14 lines modified | Offset 587, 15 lines modified |
575 | ················return; | 587 | ················return; |
576 | ············} | 588 | ············} |
577 | ········} | 589 | ········} |
578 | ········if·((this.mCurrentAwareConfiguration·=·this.mergeConfigRequests(null))·==·null)·{ | 590 | ········if·((this.mCurrentAwareConfiguration·=·this.mergeConfigRequests(null))·==·null)·{ |
579 | ············Log.wtf(s,·"onConfigCompletedLocal:·got·a·null·merged·configuration·after·config!?"); | 591 | ············Log.wtf(s,·"onConfigCompletedLocal:·got·a·null·merged·configuration·after·config!?"); |
580 | ········} | 592 | ········} |
581 | ········this.mCurrentIdentityNotification·=·this.doesAnyClientNeedIdentityChangeNotifications(); | 593 | ········this.mCurrentIdentityNotification·=·this.doesAnyClientNeedIdentityChangeNotifications(); |
| 594 | ········this.mCurrentRangingEnabled·=·this.doesAnyClientNeedRanging(); |
582 | ····} | 595 | ····} |
583 | ···· | 596 | ···· |
584 | ····private·void·onConfigFailedLocal(final·Message·message,·final·int·n)·{ | 597 | ····private·void·onConfigFailedLocal(final·Message·message,·final·int·n)·{ |
585 | ········final·int·arg1·=·message.arg1; | 598 | ········final·int·arg1·=·message.arg1; |
586 | ········final·String·s·=·"WifiAwareStateManager"; | 599 | ········final·String·s·=·"WifiAwareStateManager"; |
587 | ········if·(arg1·==·100)·{ | 600 | ········if·(arg1·==·100)·{ |
588 | ············final·IWifiAwareEventCallback·wifiAwareEventCallback·=·(IWifiAwareEventCallback)message.obj; | 601 | ············final·IWifiAwareEventCallback·wifiAwareEventCallback·=·(IWifiAwareEventCallback)message.obj; |
Offset 821, 14 lines modified | Offset 834, 17 lines modified |
821 | ················final·int·uid·=·wifiAwareClientState.getUid(); | 834 | ················final·int·uid·=·wifiAwareClientState.getUid(); |
822 | ················if·(message.arg1·!=·n3)·{ | 835 | ················if·(message.arg1·!=·n3)·{ |
823 | ····················b2·=·false; | 836 | ····················b2·=·false; |
824 | ················} | 837 | ················} |
825 | ················mAwareMetrics.recordDiscoveryStatus(uid,·n,·b2); | 838 | ················mAwareMetrics.recordDiscoveryStatus(uid,·n,·b2); |
826 | ················if·(n·==·3)·{ | 839 | ················if·(n·==·3)·{ |
827 | ····················wifiAwareClientState.removeSession(int1); | 840 | ····················wifiAwareClientState.removeSession(int1); |
| 841 | ····················if·(this.mCurrentRangingEnabled·!=·this.doesAnyClientNeedRanging())·{ |
| 842 | ························this.reconfigure(); |
| 843 | ····················} |
828 | ················} | 844 | ················} |
829 | ············} | 845 | ············} |
830 | ········} | 846 | ········} |
831 | ········else·{ | 847 | ········else·{ |
832 | ············final·int·arg3·=·message.arg2; | 848 | ············final·int·arg3·=·message.arg2; |
833 | ············final·IWifiAwareDiscoverySessionCallback·wifiAwareDiscoverySessionCallback·=·(IWifiAwareDiscoverySessionCallback)message.obj; | 849 | ············final·IWifiAwareDiscoverySessionCallback·wifiAwareDiscoverySessionCallback·=·(IWifiAwareDiscoverySessionCallback)message.obj; |
834 | ············final·WifiAwareClientState·wifiAwareClientState2·=·(WifiAwareClientState)this.mClients.get(arg3); | 850 | ············final·WifiAwareClientState·wifiAwareClientState2·=·(WifiAwareClientState)this.mClients.get(arg3); |
Offset 855, 178 lines modified | Offset 871, 192 lines modified |
855 | ················b2·=·false; | 871 | ················b2·=·false; |
856 | ············} | 872 | ············} |
857 | ············mAwareMetrics2.recordDiscoveryStatus(uid2,·n,·b2); | 873 | ············mAwareMetrics2.recordDiscoveryStatus(uid2,·n,·b2); |
858 | ········} | 874 | ········} |
859 | ····} | 875 | ····} |
860 | ···· | 876 | ···· |
861 | ····private·void·onSessionConfigSuccessLocal(final·Message·message,·final·byte·b,·final·boolean·b2)·{ | 877 | ····private·void·onSessionConfigSuccessLocal(final·Message·message,·final·byte·b,·final·boolean·b2)·{ |
862 | ········final·int·arg1·=·message.arg1; | 878 | ········final·String·s·=·"config"; |
863 | ········final·String·s·=·"onSessionConfigSuccessLocal:·no·client·exists·for·clientId="; | 879 | ········int·mMaxDistanceMm·=·-1; |
864 | ········final·int·n·=·103; | 880 | ········int·n; |
865 | ········boolean·b3·=·true; | 881 | ········boolean·rangingEnabled; |
866 | ········Object·mClients·=·"WifiAwareStateManager"; | 882 | ········int·n2; |
867 | ········final·IWifiAwareDiscoverySessionCallback·wifiAwareDiscoverySessionCallback; | 883 | ········if·(b2)·{ |
868 | ········final·WifiAwareClientState·wifiAwareClientState2; | 884 | ············final·boolean·mEnableRanging·=·((PublishConfig)message.getData().getParcelable(s)).mEnableRanging; |
869 | ········if·(arg1·!=·n·&&·arg1·!=·105)·{ | 885 | ············n·=·mMaxDistanceMm; |
870 | ············final·int·n2·=·104; | 886 | ············rangingEnabled·=·mEnableRanging; |
871 | ············if·(arg1·!=·n2·&&·arg1·!=·106)·{ | 887 | ············n2·=·n; |
872 | ················final·StringBuilder·sb·=·new·StringBuilder(); | 888 | ········} |
873 | ················sb.append("onSessionConfigSuccessLocal:·unexpected·completedCommand="); | 889 | ········else·{ |
874 | ················sb.append(message); | 890 | ············final·SubscribeConfig·subscribeConfig·=·(SubscribeConfig)message.getData().getParcelable(s); |
875 | ················Log.wtf((String)mClients,·sb.toString()); | 891 | ············final·boolean·b3·=·subscribeConfig.mMinDistanceMmSet·||·subscribeConfig.mMaxDistanceMmSet; |
876 | ················return; | 892 | ············int·mMinDistanceMm; |
| 893 | ············if·(subscribeConfig.mMinDistanceMmSet)·{ |
| 894 | ················mMinDistanceMm·=·subscribeConfig.mMinDistanceMm; |
877 | ············} | 895 | ············} |
878 | ············final·int·arg2·=·message.arg2; | 896 | ············else·{ |
879 | ············final·int·int1·=·message.getData().getInt("session_id"); | 897 | ················mMinDistanceMm·=·mMaxDistanceMm; |
880 | ············final·WifiAwareClientState·wifiAwareClientState·=·(WifiAwareClientState)this.mClients.get(arg2); | |
881 | ············if·(wifiAwareClientState·==·null)·{ | |
882 | ················final·StringBuilder·sb2·=·new·StringBuilder(); | |
883 | ················sb2.append(s); | |
884 | ················sb2.append(arg2); | |
885 | ················Log.e((String)mClients,·sb2.toString()); | |
886 | ················return; | |
887 | ············} | 898 | ············} |
888 | ············final·WifiAwareDiscoverySessionState·session·=·wifiAwareClientState.getSession(int1); | 899 | ············if·(subscribeConfig.mMaxDistanceMmSet)·{ |
889 | ············if·(session·==·null)·{ | 900 | ················mMaxDistanceMm·=·subscribeConfig.mMaxDistanceMm; |
890 | ················final·StringBuilder·sb3·=·new·StringBuilder(); | |
891 | ················sb3.append("onSessionConfigSuccessLocal:·no·session·exists·for·clientId="); | |
892 | ················sb3.append(arg2); | |
893 | ················sb3.append(",·sessionId="); | |
894 | ················sb3.append(int1); | |
895 | ················Log.e((String)mClients,·sb3.toString()); | |
896 | ················return; | |
897 | ············} | 901 | ············} |
898 | ············try·{ | 902 | ············n·=·mMaxDistanceMm; |
899 | ················final·IWifiAwareDiscoverySessionCallback·callback·=·session.getCallback(); | 903 | ············rangingEnabled·=·b3; |
900 | ················try·{ | 904 | ············n2·=·mMinDistanceMm; |
901 | ····················callback.onSessionConfigSuccess(); | 905 | ········} |
| 906 | ········final·int·arg1·=·message.arg1; |
| 907 | ········final·String·s2·=·"onSessionConfigSuccessLocal:·no·client·exists·for·clientId="; |
| 908 | ········final·int·n3·=·103; |
| 909 | ········String·s3·=·"WifiAwareStateManager"; |
| 910 | ········Label_0953:·{ |
| 911 | ············final·IWifiAwareDiscoverySessionCallback·wifiAwareDiscoverySessionCallback; |
| 912 | ············final·WifiAwareClientState·wifiAwareClientState2; |
| 913 | ············if·(arg1·!=·n3·&&·arg1·!=·105)·{ |
| 914 | ················final·int·n4·=·104; |
| 915 | ················if·(arg1·!=·n4·&&·arg1·!=·106)·{ |
| 916 | ····················final·StringBuilder·sb·=·new·StringBuilder(); |
| 917 | ····················sb.append("onSessionConfigSuccessLocal:·unexpected·completedCommand="); |
| 918 | ····················sb.append(message); |
| 919 | ····················Log.wtf(s3,·sb.toString()); |
| 920 | ····················return; |
902 | ················} | 921 | ················} |
903 | ················catch·(RemoteException·ex)·{ | 922 | ················final·int·arg2·=·message.arg2; |
904 | ····················final·StringBuilder·sb4·=·new·StringBuilder(); | 923 | ················final·int·int1·=·message.getData().getInt("session_id"); |
905 | ····················sb4.append("onSessionConfigSuccessLocal:·onSessionConfigSuccess()·RemoteException="); | 924 | ················final·WifiAwareClientState·wifiAwareClientState·=·(WifiAwareClientState)this.mClients.get(arg2); |
906 | ····················sb4.append(ex); | 925 | ················if·(wifiAwareClientState·==·null)·{ |
907 | ····················Log.e((String)mClients,·sb4.toString()); | 926 | ····················final·StringBuilder·sb2·=·new·StringBuilder(); |
| 927 | ····················sb2.append(s2); |
| 928 | ····················sb2.append(arg2); |
| 929 | ····················Log.e(s3,·sb2.toString()); |
| 930 | ····················return; |
908 | ················} | 931 | ················} |
909 | ············} | 932 | ················final·WifiAwareDiscoverySessionState·session·=·wifiAwareClientState.getSession(int1); |
910 | ············catch·(RemoteException·ex3)·{} | 933 | ················if·(session·==·null)·{ |
911 | ············final·WifiAwareMetrics·mAwareMetrics·=·this.mAwareMetrics; | 934 | ····················final·StringBuilder·sb3·=·new·StringBuilder(); |
912 | ············final·int·uid·=·wifiAwareClientState.getUid(); | 935 | ····················sb3.append("onSessionConfigSuccessLocal:·no·session·exists·for·clientId="); |
913 | ············if·(message.arg1·!=·n2)·{ | 936 | ····················sb3.append(arg2); |
914 | ················b3·=·false; | 937 | ····················sb3.append(",·sessionId="); |
915 | ············} | 938 | ····················sb3.append(int1); |
916 | ············mAwareMetrics.recordDiscoveryStatus(uid,·0,·b3); | 939 | ····················Log.e(s3,·sb3.toString()); |
917 | ············return; | 940 | ····················return; |
918 | ········} | 941 | ················} |
919 | ········else·{ | 942 | ················try·{ |
920 | ············final·int·arg3·=·message.arg2; | 943 | ····················final·IWifiAwareDiscoverySessionCallback·callback·=·session.getCallback(); |
921 | ············wifiAwareDiscoverySessionCallback·=·(IWifiAwareDiscoverySessionCallback)message.obj; | 944 | ····················try·{ |
922 | ············wifiAwareClientState2·=·(WifiAwareClientState)this.mClients.get(arg3); | 945 | ························callback.onSessionConfigSuccess(); |
923 | ············if·(wifiAwareClientState2·==·null)·{ | 946 | ····················} |
924 | ················final·StringBuilder·sb5·=·new·StringBuilder(); | 947 | ····················catch·(RemoteException·ex)·{ |
925 | ················sb5.append(s); | 948 | ························final·StringBuilder·sb4·=·new·StringBuilder(); |
926 | ················sb5.append(arg3); | 949 | ························sb4.append("onSessionConfigSuccessLocal:·onSessionConfigSuccess()·RemoteException="); |
927 | ················Log.e((String)mClients,·sb5.toString()); | 950 | ························sb4.append(ex); |
928 | ················return; | 951 | ························Log.e(s3,·sb4.toString()); |
929 | ············} | 952 | ····················} |
930 | ········} | 953 | ················} |
931 | ········final·int·n3·=·this.mSm.mNextSessionId++; | 954 | ················catch·(RemoteException·ex3)·{} |
932 | ········final·IWifiAwareDiscoverySessionCallback·wifiAwareDiscoverySessionCallback2·=·wifiAwareDiscoverySessionCallback; | 955 | ················session.setRangingEnabled(rangingEnabled); |
933 | ········try·{ | 956 | ················this.mAwareMetrics.recordDiscoveryStatus(wifiAwareClientState.getUid(),·0,·message.arg1·==·n4); |
934 | ············wifiAwareDiscoverySessionCallback2.onSessionStarted(n3); | 957 | ················break·Label_0953; |
935 | ············final·int·arg4·=·message.arg1; | |
936 | ············final·String·s2·=·"config"; | |
937 | ············int·mMaxDistanceMm·=·-1; | |
938 | ············boolean·mEnableRanging; | |
939 | ············int·n4; | |
940 | ············if·(arg4·==·n)·{ | |
941 | ················mEnableRanging·=·((PublishConfig)message.getData().getParcelable(s2)).mEnableRanging; | |
942 | ················n4·=·mMaxDistanceMm; | |
943 | ············} | 958 | ············} |
944 | ············else·{ | 959 | ············else·{ |
945 | ················final·SubscribeConfig·subscribeConfig·=·(SubscribeConfig)message.getData().getParcelable(s2); | 960 | ················final·int·arg3·=·message.arg2; |
946 | ················final·boolean·b4·=·(subscribeConfig.mMinDistanceMmSet·||·subscribeConfig.mMaxDistanceMmSet)·&&·b3; | 961 | ················wifiAwareDiscoverySessionCallback·=·(IWifiAwareDiscoverySessionCallback)message.obj; |
947 | ················int·mMinDistanceMm; | 962 | ················wifiAwareClientState2·=·(WifiAwareClientState)this.mClients.get(arg3); |
948 | ················if·(subscribeConfig.mMinDistanceMmSet)·{ | 963 | ················if·(wifiAwareClientState2·==·null)·{ |
949 | ····················mMinDistanceMm·=·subscribeConfig.mMinDistanceMm; | 964 | ····················final·StringBuilder·sb5·=·new·StringBuilder(); |
| 965 | ····················sb5.append(s2); |
| 966 | ····················sb5.append(arg3); |
| 967 | ····················Log.e(s3,·sb5.toString()); |
| 968 | ····················return; |
| 969 | ················} |
| 970 | ············} |
| 971 | ············final·int·n5·=·this.mSm.mNextSessionId++; |
| 972 | ············final·IWifiAwareDiscoverySessionCallback·wifiAwareDiscoverySessionCallback2·=·wifiAwareDiscoverySessionCallback; |
| 973 | ············try·{ |
| 974 | ················wifiAwareDiscoverySessionCallback2.onSessionStarted(n5); |
| 975 | ················final·WifiAwareNativeApi·mWifiAwareNativeApi; |
| 976 | ················final·int·n6; |
| 977 | ················final·long·elapsedRealtime; |
| 978 | ················final·WifiAwareDiscoverySessionState·wifiAwareDiscoverySessionState·=·new·WifiAwareDiscoverySessionState(mWifiAwareNativeApi,·n6,·b,·wifiAwareDiscoverySessionCallback,·b2,·rangingEnabled,·elapsedRealtime); |
| 979 | ················mWifiAwareNativeApi·=·this.mWifiAwareNativeApi; |
| 980 | ················elapsedRealtime·=·SystemClock.elapsedRealtime(); |
| 981 | ················n6·=·n5; |
| 982 | ················final·WifiAwareClientState·wifiAwareClientState3·=·wifiAwareClientState2; |
| 983 | ················final·int·n7·=·n; |
| 984 | ················final·int·n8·=·n3; |
| 985 | ················wifiAwareDiscoverySessionState.enableVerboseLogging(this.mDbg); |
| 986 | ················wifiAwareClientState2.addSession(wifiAwareDiscoverySessionState); |
| 987 | ················if·(rangingEnabled)·{ |
| 988 | ····················final·WifiAwareMetrics·mAwareMetrics·=·this.mAwareMetrics; |
| 989 | ····················final·int·uid·=·wifiAwareClientState2.getUid(); |
| 990 | ····················boolean·b4; |
| 991 | ····················if·(message.arg1·!=·n3)·{ |
| 992 | ························b4·=·true; |
| 993 | ····················} |
| 994 | ····················else·{ |
| 995 | ························b4·=·false; |
| 996 | ························s3·=·null; |
| 997 | ····················} |
| 998 | ····················mAwareMetrics.recordDiscoverySessionWithRanging(uid,·b4,·n2,·n7,·this.mClients); |
950 | ················} | 999 | ················} |
951 | ················else·{ | 1000 | ················else·{ |
952 | ····················mMinDistanceMm·=·mMaxDistanceMm; | 1001 | ····················this.mAwareMetrics.recordDiscoverySession(wifiAwareClientState2.getUid(),·this.mClients); |
953 | ················} | 1002 | ················} |
954 | ················if·(subscribeConfig.mMaxDistanceMmSet)·{ | 1003 | ················this.mAwareMetrics.recordDiscoveryStatus(wifiAwareClientState3.getUid(),·0,·message.arg1·==·n8); |
955 | ····················mMaxDistanceMm·=·subscribeConfig.mMaxDistanceMm; | 1004 | ················if·(this.mCurrentRangingEnabled·!=·this.doesAnyClientNeedRanging())·{ |
| 1005 | ····················this.reconfigure(); |
956 | ················} | 1006 | ················} |
957 | ················mEnableRanging·=·b4; | |
958 | ················n4·=·mMaxDistanceMm; | |
959 | ················mMaxDistanceMm·=·mMinDistanceMm; | |
960 | ············} | |
961 | ············final·WifiAwareNativeApi·mWifiAwareNativeApi; | |
962 | ············final·long·elapsedRealtime; | |
963 | ············final·WifiAwareDiscoverySessionState·wifiAwareDiscoverySessionState·=·new·WifiAwareDiscoverySessionState(mWifiAwareNativeApi,·n3,·b,·wifiAwareDiscoverySessionCallback,·b2,·mEnableRanging,·elapsedRealtime); | |
964 | ············mWifiAwareNativeApi·=·this.mWifiAwareNativeApi; | |
965 | ············elapsedRealtime·=·SystemClock.elapsedRealtime(); | |
966 | ············wifiAwareDiscoverySessionState.enableVerboseLogging(this.mDbg); | |
967 | ············wifiAwareClientState2.addSession(wifiAwareDiscoverySessionState); | |
968 | ············if·(mEnableRanging)·{ | |
969 | ················this.mAwareMetrics.recordDiscoverySessionWithRanging(wifiAwareClientState2.getUid(),·message.arg1·!=·n·&&·b3,·mMaxDistanceMm,·n4,·this.mClients); | |
970 | ············} | |
971 | ············else·{ | |
972 | ················final·WifiAwareMetrics·mAwareMetrics2·=·this.mAwareMetrics; | |
973 | ················final·int·uid2·=·wifiAwareClientState2.getUid(); | |
974 | ················mClients·=·this.mClients; | |
975 | ················mAwareMetrics2.recordDiscoverySession(uid2,·(SparseArray)mClients); | |
976 | ············} | 1007 | ············} |
977 | ············final·WifiAwareMetrics·mAwareMetrics3·=·this.mAwareMetrics; | 1008 | ············catch·(RemoteException·ex2)·{ |
978 | ············final·int·uid3·=·wifiAwareClientState2.getUid(); | 1009 | ················final·StringBuilder·sb6·=·new·StringBuilder(); |
979 | ············if·(message.arg1·!=·n)·{ | 1010 | ················sb6.append("onSessionConfigSuccessLocal:·onSessionStarted()·RemoteException="); |
980 | ················b3·=·false; | 1011 | ················sb6.append(ex2); |
| 1012 | ················Log.e(s3,·sb6.toString()); |
981 | ············} | 1013 | ············} |
982 | ············mAwareMetrics3.recordDiscoveryStatus(uid3,·0,·b3); | |
983 | ········} | |
984 | ········catch·(RemoteException·ex2)·{ | |
985 | ············final·StringBuilder·sb6·=·new·StringBuilder(); | |
986 | ············sb6.append("onSessionConfigSuccessLocal:·onSessionStarted()·RemoteException="); | |
987 | ············sb6.append(ex2); | |
988 | ············Log.e((String)mClients,·sb6.toString()); | |
989 | ········} | 1014 | ········} |
990 | ····} | 1015 | ····} |
991 | ···· | 1016 | ···· |
992 | ····private·void·onSessionTerminatedLocal(int·publishSession,·final·boolean·b,·int·sessionId)·{ | 1017 | ····private·void·onSessionTerminatedLocal(int·n,·final·boolean·b,·int·n2)·{ |
993 | ········final·Pair·clientSessionForPubSubId·=·this.getClientSessionForPubSubId(publishSession); | 1018 | ········final·Pair·clientSessionForPubSubId·=·this.getClientSessionForPubSubId(n); |
994 | ········final·String·s·=·"WifiAwareStateManager"; | 1019 | ········final·String·s·=·"WifiAwareStateManager"; |
995 | ········if·(clientSessionForPubSubId·==·null)·{ | 1020 | ········if·(clientSessionForPubSubId·==·null)·{ |
996 | ············final·StringBuilder·sb·=·new·StringBuilder(); | 1021 | ············final·StringBuilder·sb·=·new·StringBuilder(); |
997 | ············sb.append("onSessionTerminatedLocal:·no·session·found·for·pubSubId="); | 1022 | ············sb.append("onSessionTerminatedLocal:·no·session·found·for·pubSubId="); |
998 | ············sb.append(publishSession); | 1023 | ············sb.append(n); |
999 | ············Log.e(s,·sb.toString()); | 1024 | ············Log.e(s,·sb.toString()); |
1000 | ············return; | 1025 | ············return; |
1001 | ········} | 1026 | ········} |
1002 | ········try·{ | 1027 | ········try·{ |
1003 | ············final·Object·second·=·clientSessionForPubSubId.second; | 1028 | ············final·Object·second·=·clientSessionForPubSubId.second; |
1004 | ············try·{ | 1029 | ············try·{ |
1005 | ················final·WifiAwareDiscoverySessionState·wifiAwareDiscoverySessionState·=·(WifiAwareDiscoverySessionState)second; | 1030 | ················final·WifiAwareDiscoverySessionState·wifiAwareDiscoverySessionState·=·(WifiAwareDiscoverySessionState)second; |
1006 | ················try·{ | 1031 | ················try·{ |
1007 | ····················wifiAwareDiscoverySessionState.getCallback().onSessionTerminated(sessionId); | 1032 | ····················wifiAwareDiscoverySessionState.getCallback().onSessionTerminated(n2); |
1008 | ················} | 1033 | ················} |
1009 | ················catch·(RemoteException·ex)·{ | 1034 | ················catch·(RemoteException·ex)·{ |
1010 | ····················final·StringBuilder·sb2·=·new·StringBuilder(); | 1035 | ····················final·StringBuilder·sb2·=·new·StringBuilder(); |
1011 | ····················sb2.append("onSessionTerminatedLocal·onSessionTerminated():·RemoteException·(FYI):·"); | 1036 | ····················sb2.append("onSessionTerminatedLocal·onSessionTerminated():·RemoteException·(FYI):·"); |
1012 | ····················sb2.append(ex); | 1037 | ····················sb2.append(ex); |
1013 | ····················Log.w(s,·sb2.toString()); | 1038 | ····················Log.w(s,·sb2.toString()); |
1014 | ················} | 1039 | ················} |
1015 | ············} | 1040 | ············} |
1016 | ············catch·(RemoteException·ex2)·{} | 1041 | ············catch·(RemoteException·ex2)·{} |
1017 | ········} | 1042 | ········} |
1018 | ········catch·(RemoteException·ex3)·{} | 1043 | ········catch·(RemoteException·ex3)·{} |
1019 | ········final·WifiAwareClientState·wifiAwareClientState·=·(WifiAwareClientState)clientSessionForPubSubId.first; | 1044 | ········final·WifiAwareClientState·wifiAwareClientState·=·(WifiAwareClientState)clientSessionForPubSubId.first; |
1020 | ········sessionId·=·((WifiAwareDiscoverySessionState)clientSessionForPubSubId.second).getSessionId(); | 1045 | ········n2·=·((WifiAwareDiscoverySessionState)clientSessionForPubSubId.second).getSessionId(); |
1021 | ········wifiAwareClientState.removeSession(sessionId); | 1046 | ········wifiAwareClientState.removeSession(n2); |
| 1047 | ········n·=·(this.mCurrentRangingEnabled·?·1·:·0); |
| 1048 | ········n2·=·(this.doesAnyClientNeedRanging()·?·1·:·0); |
| 1049 | ········if·(n·!=·n2)·{ |
| 1050 | ············this.reconfigure(); |
| 1051 | ········} |
1022 | ········final·WifiAwareMetrics·mAwareMetrics·=·this.mAwareMetrics; | 1052 | ········final·WifiAwareMetrics·mAwareMetrics·=·this.mAwareMetrics; |
1023 | ········final·long·creationTime·=·((WifiAwareDiscoverySessionState)clientSessionForPubSubId.second).getCreationTime(); | 1053 | ········final·long·creationTime·=·((WifiAwareDiscoverySessionState)clientSessionForPubSubId.second).getCreationTime(); |
1024 | ········publishSession·=·(((WifiAwareDiscoverySessionState)clientSessionForPubSubId.second).isPublishSession()·?·1·:·0); | 1054 | ········n·=·(((WifiAwareDiscoverySessionState)clientSessionForPubSubId.second).isPublishSession()·?·1·:·0); |
1025 | ········mAwareMetrics.recordDiscoverySessionDuration(creationTime,·(boolean)(publishSession·!=·0)); | 1055 | ········mAwareMetrics.recordDiscoverySessionDuration(creationTime,·(boolean)(n·!=·0)); |
1026 | ····} | 1056 | ····} |
1027 | ···· | 1057 | ···· |
1028 | ····private·boolean·publishLocal(short·publish,·int·n,·final·PublishConfig·publishConfig,·final·IWifiAwareDiscoverySessionCallback·wifiAwareDiscoverySessionCallback)·{ | 1058 | ····private·boolean·publishLocal(short·publish,·int·n,·final·PublishConfig·publishConfig,·final·IWifiAwareDiscoverySessionCallback·wifiAwareDiscoverySessionCallback)·{ |
1029 | ········final·WifiAwareClientState·wifiAwareClientState·=·(WifiAwareClientState)this.mClients.get(n); | 1059 | ········final·WifiAwareClientState·wifiAwareClientState·=·(WifiAwareClientState)this.mClients.get(n); |
1030 | ········final·String·s·=·"WifiAwareStateManager"; | 1060 | ········final·String·s·=·"WifiAwareStateManager"; |
1031 | ········if·(wifiAwareClientState·==·null)·{ | 1061 | ········if·(wifiAwareClientState·==·null)·{ |
1032 | ············final·StringBuilder·sb·=·new·StringBuilder(); | 1062 | ············final·StringBuilder·sb·=·new·StringBuilder(); |
Offset 1049, 15 lines modified | Offset 1079, 15 lines modified |
1049 | ············} | 1079 | ············} |
1050 | ············this.mAwareMetrics.recordDiscoveryStatus(wifiAwareClientState.getUid(),·n,·(boolean)(n·!=·0)); | 1080 | ············this.mAwareMetrics.recordDiscoveryStatus(wifiAwareClientState.getUid(),·n,·(boolean)(n·!=·0)); |
1051 | ········} | 1081 | ········} |
1052 | ········return·publish·!=·0; | 1082 | ········return·publish·!=·0; |
1053 | ····} | 1083 | ····} |
1054 | ···· | 1084 | ···· |
1055 | ····private·boolean·reconfigureLocal(final·short·n)·{ | 1085 | ····private·boolean·reconfigureLocal(final·short·n)·{ |
1056 | ········return·this.mClients.size()·!=·0·&&·this.mWifiAwareNativeApi.enableAndConfigure(n,·this.mCurrentAwareConfiguration,·this.doesAnyClientNeedIdentityChangeNotifications(),·false,·this.mPowerManager.isInteractive(),·this.mPowerManager.isDeviceIdleMode()); | 1086 | ········return·this.mClients.size()·!=·0·&&·this.mWifiAwareNativeApi.enableAndConfigure(n,·this.mCurrentAwareConfiguration,·this.doesAnyClientNeedIdentityChangeNotifications(),·false,·this.mPowerManager.isInteractive(),·this.mPowerManager.isDeviceIdleMode(),·this.doesAnyClientNeedRanging()); |
1057 | ····} | 1087 | ····} |
1058 | ···· | 1088 | ···· |
1059 | ····private·boolean·respondToDataPathRequestLocal(final·short·n,·final·boolean·b,·final·int·n2,·final·String·s,·final·byte[]·array,·final·String·s2,·final·byte[]·array2,·final·boolean·b2)·{ | 1089 | ····private·boolean·respondToDataPathRequestLocal(final·short·n,·final·boolean·b,·final·int·n2,·final·String·s,·final·byte[]·array,·final·String·s2,·final·byte[]·array2,·final·boolean·b2)·{ |
1060 | ········final·boolean·respondToDataPathRequest·=·this.mWifiAwareNativeApi.respondToDataPathRequest(n,·b,·n2,·s,·array,·s2,·array2,·b2,·this.mCapabilities); | 1090 | ········final·boolean·respondToDataPathRequest·=·this.mWifiAwareNativeApi.respondToDataPathRequest(n,·b,·n2,·s,·array,·s2,·array2,·b2,·this.mCapabilities); |
1061 | ········if·(!respondToDataPathRequest)·{ | 1091 | ········if·(!respondToDataPathRequest)·{ |
1062 | ············this.mDataPathMgr.onRespondToDataPathRequest(n2,·false,·1); | 1092 | ············this.mDataPathMgr.onRespondToDataPathRequest(n2,·false,·1); |
1063 | ········} | 1093 | ········} |
Offset 1116, 24 lines modified | Offset 1146, 28 lines modified |
1116 | ················Log.w(s,·sb2.toString()); | 1146 | ················Log.w(s,·sb2.toString()); |
1117 | ············} | 1147 | ············} |
1118 | ············this.mAwareMetrics.recordDiscoveryStatus(wifiAwareClientState.getUid(),·n,·false); | 1148 | ············this.mAwareMetrics.recordDiscoveryStatus(wifiAwareClientState.getUid(),·n,·false); |
1119 | ········} | 1149 | ········} |
1120 | ········return·subscribe·!=·0; | 1150 | ········return·subscribe·!=·0; |
1121 | ····} | 1151 | ····} |
1122 | ···· | 1152 | ···· |
1123 | ····private·void·terminateSessionLocal(int·publishSession,·final·int·n)·{ | 1153 | ····private·void·terminateSessionLocal(int·publishSession,·int·mCurrentRangingEnabled)·{ |
1124 | ········final·WifiAwareClientState·wifiAwareClientState·=·(WifiAwareClientState)this.mClients.get(publishSession); | 1154 | ········final·WifiAwareClientState·wifiAwareClientState·=·(WifiAwareClientState)this.mClients.get(publishSession); |
1125 | ········if·(wifiAwareClientState·==·null)·{ | 1155 | ········if·(wifiAwareClientState·==·null)·{ |
1126 | ············final·StringBuilder·sb·=·new·StringBuilder(); | 1156 | ············final·StringBuilder·sb·=·new·StringBuilder(); |
1127 | ············sb.append("terminateSession:·no·client·exists·for·clientId="); | 1157 | ············sb.append("terminateSession:·no·client·exists·for·clientId="); |
1128 | ············sb.append(publishSession); | 1158 | ············sb.append(publishSession); |
1129 | ············Log.e("WifiAwareStateManager",·sb.toString()); | 1159 | ············Log.e("WifiAwareStateManager",·sb.toString()); |
1130 | ············return; | 1160 | ············return; |
1131 | ········} | 1161 | ········} |
1132 | ········final·WifiAwareDiscoverySessionState·terminateSession·=·wifiAwareClientState.terminateSession(n); | 1162 | ········final·WifiAwareDiscoverySessionState·terminateSession·=·wifiAwareClientState.terminateSession(mCurrentRangingEnabled); |
| 1163 | ········mCurrentRangingEnabled·=·(this.mCurrentRangingEnabled·?·1·:·0); |
| 1164 | ········if·(mCurrentRangingEnabled·!=·(this.doesAnyClientNeedRanging()·?·1·:·0))·{ |
| 1165 | ············this.reconfigure(); |
| 1166 | ········} |
1133 | ········if·(terminateSession·!=·null)·{ | 1167 | ········if·(terminateSession·!=·null)·{ |
1134 | ············final·WifiAwareMetrics·mAwareMetrics·=·this.mAwareMetrics; | 1168 | ············final·WifiAwareMetrics·mAwareMetrics·=·this.mAwareMetrics; |
1135 | ············final·long·creationTime·=·terminateSession.getCreationTime(); | 1169 | ············final·long·creationTime·=·terminateSession.getCreationTime(); |
1136 | ············publishSession·=·(terminateSession.isPublishSession()·?·1·:·0); | 1170 | ············publishSession·=·(terminateSession.isPublishSession()·?·1·:·0); |
1137 | ············mAwareMetrics.recordDiscoverySessionDuration(creationTime,·(boolean)(publishSession·!=·0)); | 1171 | ············mAwareMetrics.recordDiscoverySessionDuration(creationTime,·(boolean)(publishSession·!=·0)); |
1138 | ········} | 1172 | ········} |
1139 | ····} | 1173 | ····} |
Offset 1958, 25 lines modified | Offset 1992, 25 lines modified |
1958 | ········final·Message·obtainMessage·=·((StateMachine)this.mSm).obtainMessage(1); | 1992 | ········final·Message·obtainMessage·=·((StateMachine)this.mSm).obtainMessage(1); |
1959 | ········obtainMessage.arg1·=·102; | 1993 | ········obtainMessage.arg1·=·102; |
1960 | ········obtainMessage.arg2·=·arg2; | 1994 | ········obtainMessage.arg2·=·arg2; |
1961 | ········obtainMessage.obj·=·n; | 1995 | ········obtainMessage.obj·=·n; |
1962 | ········((StateMachine)this.mSm).sendMessage(obtainMessage); | 1996 | ········((StateMachine)this.mSm).sendMessage(obtainMessage); |
1963 | ····} | 1997 | ····} |
1964 | ···· | 1998 | ···· |
1965 | ····public·void·updatePublish(final·int·arg2,·final·int·n,·final·PublishConfig·obj)·{ | 1999 | ····public·void·updatePublish(final·int·arg2,·final·int·n,·final·PublishConfig·publishConfig)·{ |
1966 | ········final·Message·obtainMessage·=·((StateMachine)this.mSm).obtainMessage(1); | 2000 | ········final·Message·obtainMessage·=·((StateMachine)this.mSm).obtainMessage(1); |
1967 | ········obtainMessage.arg1·=·104; | 2001 | ········obtainMessage.arg1·=·104; |
1968 | ········obtainMessage.arg2·=·arg2; | 2002 | ········obtainMessage.arg2·=·arg2; |
1969 | ········obtainMessage.obj·=·obj; | 2003 | ········obtainMessage.getData().putParcelable("config",·(Parcelable)publishConfig); |
1970 | ········obtainMessage.getData().putInt("session_id",·n); | 2004 | ········obtainMessage.getData().putInt("session_id",·n); |
1971 | ········((StateMachine)this.mSm).sendMessage(obtainMessage); | 2005 | ········((StateMachine)this.mSm).sendMessage(obtainMessage); |
1972 | ····} | 2006 | ····} |
1973 | ···· | 2007 | ···· |
1974 | ····public·void·updateSubscribe(final·int·arg2,·final·int·n,·final·SubscribeConfig·obj)·{ | 2008 | ····public·void·updateSubscribe(final·int·arg2,·final·int·n,·final·SubscribeConfig·subscribeConfig)·{ |
1975 | ········final·Message·obtainMessage·=·((StateMachine)this.mSm).obtainMessage(1); | 2009 | ········final·Message·obtainMessage·=·((StateMachine)this.mSm).obtainMessage(1); |
1976 | ········obtainMessage.arg1·=·106; | 2010 | ········obtainMessage.arg1·=·106; |
1977 | ········obtainMessage.arg2·=·arg2; | 2011 | ········obtainMessage.arg2·=·arg2; |
1978 | ········obtainMessage.obj·=·obj; | 2012 | ········obtainMessage.getData().putParcelable("config",·(Parcelable)subscribeConfig); |
1979 | ········obtainMessage.getData().putInt("session_id",·n); | 2013 | ········obtainMessage.getData().putInt("session_id",·n); |
1980 | ········((StateMachine)this.mSm).sendMessage(obtainMessage); | 2014 | ········((StateMachine)this.mSm).sendMessage(obtainMessage); |
1981 | ····} | 2015 | ····} |
1982 | } | 2016 | } |