全志 523 投屏功能多次断开连接后不能再次连接;
后经过测试后发现重置wifi 和蓝牙数据后可以重新连接;
方式1:所以简单处理一下,断开连接时把路由删除;
Index: core/java/com/android/internal/app/MediaRouteControllerDialog.java
===================================================================
@@ -38,6 +38,7 @@
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import android.widget.SeekBar;
+import android.util.Log;
/**
* This class implements the route controller dialog for {@link MediaRouter}.
@@ -142,6 +143,8 @@
new OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int id) {
+ Log.d("MediaRouteControllerDialog","route: " + mRoute.isSelected() + " ,isBluetooth? " + mRoute.isBluetooth() );
+ //mRoute.clearUserRoutes();
if (mRoute.isSelected()) {
if (mRoute.isBluetooth()) {
mRouter.getDefaultRoute().select();
@@ -149,6 +152,8 @@
mRouter.getFallbackRoute().select();
}
}
+ //删除连接
+ mRouter.removeRouteInt(mRoute);
dismiss();
}
方式2:重置 p2pFactoryReset
Index: services/core/java/com/android/server/display/WifiDisplayController.java
===================================================================
@@ -607,6 +607,7 @@
public void onSuccess() {
Slog.i(TAG, "Disconnected from Wifi display: " + oldDevice.deviceName);
next();
+ //p2pFactoryReset(mContext);
}
@Override
@@ -793,6 +794,20 @@
}
}
+ /*void p2pFactoryReset(Context context) {
+ Log.d(TAG,"p2pFactoryReset: " );
+ WifiP2pManager wifiP2pManager = (WifiP2pManager)
+ context.getSystemService(Context.WIFI_P2P_SERVICE);
+ if (wifiP2pManager != null) {
+ WifiP2pManager.Channel channel = wifiP2pManager.initialize(
+ context.getApplicationContext(), context.getMainLooper(),
+ null);
+ if (channel != null) {
+ wifiP2pManager.factoryReset(channel, null);
+ }
+ }
+ }*/
+
private WifiDisplaySessionInfo getSessionInfo(WifiP2pGroup info, int session) {
if (info == null) {
return null;
网友评论