update interface with friend info.
authorTrillGates <williamtrillgates@gmail.com>
Tue, 13 Apr 2021 12:52:47 +0000 (20:52 +0800)
committerTrillGates <williamtrillgates@gmail.com>
Tue, 13 Apr 2021 12:52:47 +0000 (20:52 +0800)
app/src/main/aidl/com/enqualcomm/support/IFZDCallback.aidl
app/src/main/java/com/enqualcomm/support/CoreService.java
app/src/main/java/com/ic/protocols/protocol_fzd.java

index 619dd8a..4bcaaef 100644 (file)
@@ -4,11 +4,10 @@ package com.enqualcomm.support;
 interface IFZDCallback {
     void onContractsLoaded();
     void onBRIdLoaded(in String brId);
-    void onFriendsAddResult(in boolean isSuccess);
     void onCallRequestResult(int result);
     void onBRIdEmpty();
     void onRemoteReject(in String remoteUserId,in int type);
-    void onFriendsMakeResult(in int result);
+    void onFriendsMakeResult(in int result,String friendName,String id,String phoneNum);
     void onFriendsUnbindResult();
     void onFriendsListLoaded();
 }
\ No newline at end of file
index fd46a34..d122589 100644 (file)
@@ -1710,12 +1710,14 @@ public class CoreService extends Service {
     private final IFZDService.Stub mFZDService = new IFZDService.Stub() {
         @Override
         public void registerCallback(IFZDCallback callback) {
+            ICLogger.d("registerCallback...");
             //接口注册
             runtime.setFZDRemoteCallback(callback);
         }
 
         @Override
         public void unregisterCallback(IFZDCallback callback) {
+            ICLogger.d("unregisterCallback...");
             //取消接口注册
             runtime.removeFZDRemoteCallback(callback);
         }
@@ -1775,7 +1777,7 @@ public class CoreService extends Service {
             //交朋友的话是根据配置去走蓝牙交友
             //还是位置交友
             //目前先实现位置交友的功能
-            protocol_fzd.makeFriendsByPosition(connection,runtime);
+            protocol_fzd.makeFriendsByPosition(connection, runtime);
         }
 
         @Override
index 5f6d596..8fe0b65 100644 (file)
@@ -1579,7 +1579,6 @@ public class protocol_fzd {
                 ICLogger.i("收到服务器时间 LGZONE " + data);
                 handleLGZONE(mRuntime, data);
                 break;
-
             case CENTER:
                 ICLogger.d("收到中心号码设置--> " + data);
                 handleCENTER(cmd, data, mRuntime);
@@ -1720,7 +1719,7 @@ public class protocol_fzd {
             case PPR:
                 //这个结果有可能是平台主动解除的
                 //也有可能是客户端自己解除的
-                handleFriendUnbindResult(mRuntime, data);
+                handleFriendUnbindResult(mRuntime);
                 ICLogger.d("解除好友的指令..." + data);
                 break;
             case PP:
@@ -1734,7 +1733,6 @@ public class protocol_fzd {
                 break;
         }
         return ret;
-
     }
 
     /**
@@ -1784,10 +1782,12 @@ public class protocol_fzd {
             }
             try {
                 int i = fzdCallback.beginBroadcast();
+                ICLogger.d("call back count == > " + i);
                 while (i > 0) {
                     i--;
                     IFZDCallback broadcastItem = fzdCallback.getBroadcastItem(i);
                     broadcastItem.onFriendsListLoaded();
+                    ICLogger.d("onFriendsListLoaded...");
                 }
             } catch (Exception e) {
                 e.printStackTrace();
@@ -1821,13 +1821,15 @@ public class protocol_fzd {
         //
         boolean contains = data.contains(CMDSPLIT);
         int result = 0;
+        String friendName = "";
+        String friendId = "";
+        String phoneNum = "";
         if (contains) {
             result = 0;
             //成功的结果
             String[] split = data.split(CMDSPLIT);
-            String friendId = split[0];
-            String friendName = Util.decodeUnicode2Utf8(split[1]);
-            String phoneNum = "";
+            friendId = split[0];
+            friendName = Util.decodeUnicode2Utf8(split[1]);
             if (split.length == 3) {
                 phoneNum = split[2];
             }
@@ -1853,7 +1855,7 @@ public class protocol_fzd {
             while (i > 0) {
                 i--;
                 IFZDCallback broadcastItem = fzdCallback.getBroadcastItem(i);
-                broadcastItem.onFriendsMakeResult(result);
+                broadcastItem.onFriendsMakeResult(result, friendName, friendId, phoneNum);
             }
         } catch (Exception e) {
             e.printStackTrace();
@@ -1862,7 +1864,7 @@ public class protocol_fzd {
         }
     }
 
-    private void handleFriendUnbindResult(Runtime mRuntime, String data) {
+    private void handleFriendUnbindResult(Runtime mRuntime) {
         //解除有结果了,然去拉取一下新的用户列表吧
         RemoteCallbackList<IFZDCallback> fzdCallback = mRuntime.getFZDCallback();
         if (fzdCallback == null) {