Android 解决:第三方浏览器调节亮度导致播放视频卡顿
Posted 王睿丶
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Android 解决:第三方浏览器调节亮度导致播放视频卡顿相关的知识,希望对你有一定的参考价值。
方法一:
frameworks/base/services/core/java/com/android/server/policy/PhoneWindowManager.java
思路:若当前界面的软件报名包含:browser
这样的英文,则认定为用户当前打开的是浏览器,不允许调节亮度
@Override
public long interceptKeyBeforeDispatching(IBinder focusedToken, KeyEvent event,int policyFlags)
else if (keyCode == KeyEvent.KEYCODE_BRIGHTNESS_UP || keyCode == KeyEvent.KEYCODE_BRIGHTNESS_DOWN)
Settings.System.putFloatForUser(mContext.getContentResolver(),
Settings.System.SCREEN_BRIGHTNESS_FLOAT, brightnessFloat,
UserHandle.USER_CURRENT_OR_SELF);
//wangrui Solve the problem of freezing when playing videos in third-party browsers
++ if (cn.getPackageName().contains("browser"))
++ return 0;
++
startActivityAsUser(new Intent(Intent.ACTION_SHOW_BRIGHTNESS_DIALOG),
UserHandle.CURRENT_OR_SELF);
方法二:
frameworks/base/packages/SystemUI/src/com/android/systemui/settings/BrightnessDialog.java
思路:调节亮度时不允许弹出亮度对话框
@Override
protected void onCreate(Bundle savedInstanceState)
super.onCreate(savedInstanceState);
++ finish();
方法三:
frameworks/base/services/core/java/com/android/server/policy/PhoneWindowManager.java
思路:调节亮度时,不启动亮度对话框,只改变亮度值
@Override
public long interceptKeyBeforeDispatching(IBinder focusedToken, KeyEvent event,
int policyFlags)
else if (keyCode == KeyEvent.KEYCODE_BRIGHTNESS_UP
|| keyCode == KeyEvent.KEYCODE_BRIGHTNESS_DOWN)
// startActivityAsUser(new Intent(Intent.ACTION_SHOW_BRIGHTNESS_DIALOG),
// UserHandle.CURRENT_OR_SELF);
以上是关于Android 解决:第三方浏览器调节亮度导致播放视频卡顿的主要内容,如果未能解决你的问题,请参考以下文章
Android视频播放器屏幕左侧边随手指上下滑动亮度调节变暗变亮原理实现:后续改进