mt6735 打开wifidisplay,重启手机后,发现wifidisplay关闭
时间:10-02
整理:3721RD
点击:
[DESCRIPTION]
在设置界面里进入投射屏幕界面,开启无线显示,再重启手机并进入投射屏幕里,发现无线显示是关闭的。
[SOLUTION]
正常现象,google默认行为如此,具体代码逻辑如下:
1.关机时会关闭wif p2p,这个会导致Settings.Global.WIFI_DISPLAY_ON设置为0.
/*/php?mod=tag&id=6090" target="_blank" class="relatedlink">Frameworks/base/services/core/java/com/android/server/display/WifiDispl
ayController.Java */
private int computeFeatureState() {
if (!mWifiP2pEnabled) {
if (SystemProperties.get("ro.mtk_WFD_support").equals("1")) {
if (mWifiDisplayOnSetting) {
Slog.d(TAG, "wifi p2p is disabled, update WIFI_DISPLAY_ON as false.");
Settings.Global.putInt(
mContext.getContentResolver(), Settings.Global.WIFI_DISPLAY_ON, 0);
mWifiDisplayOnSetting = false;
}
}
else {
return WifiDisplayStatus.FEATURE_STATE_DISABLED;
}
}
return mWifiDisplayOnSetting ? WifiDisplayStatus.FEATURE_STATE_ON :
WifiDisplayStatus.FEATURE_STATE_OFF;
}
2.重启后,进入wfd setting菜单,去获取该contentprovider的值为false
/*
/packages/apps/Settings/src/com/android/settings/wfd/WifiDisplaySettings.j
ava */
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
if (mWifiDisplayStatus != null && mWifiDisplayStatus.getFeatureState()
!= WifiDisplayStatus.FEATURE_STATE_UNAVAILABLE) {
MenuItem item = menu.add(Menu.NONE, MENU_ID_ENABLE_WIFI_DISPLAY, 0,
R.string.wifi_display_enable_menu_item);
item.setCheckable(true);
item.setChecked(mWifiDisplayOnSetting);
}
if (mExt != null) {
mExt.onCreateOptionMenu(menu, mWifiDisplayStatus);
}
super.onCreateOptionsMenu(menu, inflater);
}
@Override
public boolean onOptionsItEMSelected(MenuItem item) {
switch (item.getItemId()) {
case MENU_ID_ENABLE_WIFI_DISPLAY:
mWifiDisplayOnSetting = !item.isChecked();
item.setChecked(mWifiDisplayOnSetting);
Settings.Global.putInt(getContentResolver(),
Settings.Global.WIFI_DISPLAY_ON, mWifiDisplayOnSetting ? 1 : 0);
return true;
}
if (mExt != null && mExt.onOptionMenuSelected(item, getFragmentManager()))
{
return true;
} else {
return super.onOptionsItemSelected(item);
}
}
private void update(int changes) {
boolean invalidateOptions = false;
// Update settings.
if ((changes & CHANGE_SETTINGS) != 0) {
mWifiDisplayOnSetting = Settings.Global.getInt(getContentResolver(),
Settings.Global.WIFI_DISPLAY_ON, 0) != 0;
mWifiDisplayCertificationOn = Settings.Global.getInt(getContentResolver(),
Settings.Global.WIFI_DISPLAY_CERTIFICATION_ON, 0) != 0;
mWpsConfig = Settings.Global.getInt(getContentResolver(),
Settings.Global.WIFI_DISPLAY_WPS_CONFIG, WpsInfo.INVALID);
// The wifi display enabled setting may have changed.
invalidateOptions = true;
}
...
}
3.相关log:
[main log]
01-02 16:35:56.934 5480 5480 D MediaRouter: updateWifiDisplayStatus status:
WifiDisplayStatus{featureState=3, scanState=0, activeDisplayState=0,
activeDisplay=null, displays=[], sessionInfo=WifiDisplaySessionInfo:
C/O:CLIent,GId:,Pp:,SId:0,IP:}
01-02 16:36:10.427 829 861 D ShutdownThread: |----
com.android.server.power.ShutdownThread.shutdown(ShutdownThread.java:175)
01-02 16:36:10.539 829 1059 D WifiP2pService: P2pEnabledState exit()
01-02 16:36:10.596 5480 5480 D MediaRouter: updateWifiDisplayStatus status:
WifiDisplayStatus{featureState=2, scanState=0, activeDisplayState=0,
activeDisplay=null, displays=[], sessionInfo=WifiDisplaySessionInfo:
C/O:Client,GId:,Pp:,SId:0,IP:}
[sys_log]
01-02 16:36:10.555 829 863 D WifiDisplayController: Wifi p2p is disabled, update WIFI_DISPLAY_ON as false.
01-02 16:36:10.574 829 863 D WifiDisplayController: reportFeatureState(), featureState= 2
在设置界面里进入投射屏幕界面,开启无线显示,再重启手机并进入投射屏幕里,发现无线显示是关闭的。
[SOLUTION]
正常现象,google默认行为如此,具体代码逻辑如下:
1.关机时会关闭wif p2p,这个会导致Settings.Global.WIFI_DISPLAY_ON设置为0.
/*/php?mod=tag&id=6090" target="_blank" class="relatedlink">Frameworks/base/services/core/java/com/android/server/display/WifiDispl
ayController.Java */
private int computeFeatureState() {
if (!mWifiP2pEnabled) {
if (SystemProperties.get("ro.mtk_WFD_support").equals("1")) {
if (mWifiDisplayOnSetting) {
Slog.d(TAG, "wifi p2p is disabled, update WIFI_DISPLAY_ON as false.");
Settings.Global.putInt(
mContext.getContentResolver(), Settings.Global.WIFI_DISPLAY_ON, 0);
mWifiDisplayOnSetting = false;
}
}
else {
return WifiDisplayStatus.FEATURE_STATE_DISABLED;
}
}
return mWifiDisplayOnSetting ? WifiDisplayStatus.FEATURE_STATE_ON :
WifiDisplayStatus.FEATURE_STATE_OFF;
}
2.重启后,进入wfd setting菜单,去获取该contentprovider的值为false
/*
/packages/apps/Settings/src/com/android/settings/wfd/WifiDisplaySettings.j
ava */
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
if (mWifiDisplayStatus != null && mWifiDisplayStatus.getFeatureState()
!= WifiDisplayStatus.FEATURE_STATE_UNAVAILABLE) {
MenuItem item = menu.add(Menu.NONE, MENU_ID_ENABLE_WIFI_DISPLAY, 0,
R.string.wifi_display_enable_menu_item);
item.setCheckable(true);
item.setChecked(mWifiDisplayOnSetting);
}
if (mExt != null) {
mExt.onCreateOptionMenu(menu, mWifiDisplayStatus);
}
super.onCreateOptionsMenu(menu, inflater);
}
@Override
public boolean onOptionsItEMSelected(MenuItem item) {
switch (item.getItemId()) {
case MENU_ID_ENABLE_WIFI_DISPLAY:
mWifiDisplayOnSetting = !item.isChecked();
item.setChecked(mWifiDisplayOnSetting);
Settings.Global.putInt(getContentResolver(),
Settings.Global.WIFI_DISPLAY_ON, mWifiDisplayOnSetting ? 1 : 0);
return true;
}
if (mExt != null && mExt.onOptionMenuSelected(item, getFragmentManager()))
{
return true;
} else {
return super.onOptionsItemSelected(item);
}
}
private void update(int changes) {
boolean invalidateOptions = false;
// Update settings.
if ((changes & CHANGE_SETTINGS) != 0) {
mWifiDisplayOnSetting = Settings.Global.getInt(getContentResolver(),
Settings.Global.WIFI_DISPLAY_ON, 0) != 0;
mWifiDisplayCertificationOn = Settings.Global.getInt(getContentResolver(),
Settings.Global.WIFI_DISPLAY_CERTIFICATION_ON, 0) != 0;
mWpsConfig = Settings.Global.getInt(getContentResolver(),
Settings.Global.WIFI_DISPLAY_WPS_CONFIG, WpsInfo.INVALID);
// The wifi display enabled setting may have changed.
invalidateOptions = true;
}
...
}
3.相关log:
[main log]
01-02 16:35:56.934 5480 5480 D MediaRouter: updateWifiDisplayStatus status:
WifiDisplayStatus{featureState=3, scanState=0, activeDisplayState=0,
activeDisplay=null, displays=[], sessionInfo=WifiDisplaySessionInfo:
C/O:CLIent,GId:,Pp:,SId:0,IP:}
01-02 16:36:10.427 829 861 D ShutdownThread: |----
com.android.server.power.ShutdownThread.shutdown(ShutdownThread.java:175)
01-02 16:36:10.539 829 1059 D WifiP2pService: P2pEnabledState exit()
01-02 16:36:10.596 5480 5480 D MediaRouter: updateWifiDisplayStatus status:
WifiDisplayStatus{featureState=2, scanState=0, activeDisplayState=0,
activeDisplay=null, displays=[], sessionInfo=WifiDisplaySessionInfo:
C/O:Client,GId:,Pp:,SId:0,IP:}
[sys_log]
01-02 16:36:10.555 829 863 D WifiDisplayController: Wifi p2p is disabled, update WIFI_DISPLAY_ON as false.
01-02 16:36:10.574 829 863 D WifiDisplayController: reportFeatureState(), featureState= 2