• RK Android7.1 进入Camera2 亮度会增加


    一.现象

    Android7.1  进Camera2 背光亮度会增加到 brightness 229 ,退出之后Camera2 亮度会回到默认值,不正常退出Camera2 (不完成生命周期)则会保存到 brightness 229

    adb shell settings get system screen_brightness
    

     二.RK OS 

    ZK_RXXX_RK3399_ANDROID7.1packagesappsCamera2srccomandroidcameraCameraActivity.java

           setScreenBrightAdjust  设置背光值

                         mScreenBrightAdjust

                 restoreScreenBright  

        private void setMaxScreenBright() {
            Window win = getWindow();
            WindowManager.LayoutParams winParams = win.getAttributes();
            Log.i(TAG, "screenBrightness = " + winParams.screenBrightness);
            winParams.screenBrightness = WindowManager.LayoutParams.BRIGHTNESS_OVERRIDE_FULL;
            win.setAttributes(winParams);
        }
    
        private int mOrignalScreenBrightMode = -1;
        private int mOrignalScreenBrightness = -1;
        private void setScreenBrightAdjust() {
            mOrignalScreenBrightMode = getScreenMode();
            mOrignalScreenBrightness = getScreenBrightness();
            Log.i(TAG, "mOrignalScreenBrightMode = " + mOrignalScreenBrightMode
                    + ",mOrignalScreenBrightness = " + mOrignalScreenBrightness);
            if (mOrignalScreenBrightMode == Settings.System.SCREEN_BRIGHTNESS_MODE_AUTOMATIC)
                setScreenMode(Settings.System.SCREEN_BRIGHTNESS_MODE_MANUAL);
            if (mOrignalScreenBrightness < ((int) (255 * 0.9f)))
                saveScreenBrightness((int) (255 * 0.9f));
        }
    
        private Runnable mScreenBrightAdjust = new Runnable() {
            
            @Override
            public void run() {
                // TODO Auto-generated method stub
                setScreenBrightAdjust();
            }
        };
    
        private void restoreScreenBright() {
            mMainHandler.removeCallbacks(mScreenBrightAdjust);
            setScreenMode(mOrignalScreenBrightMode);
            saveScreenBrightness(mOrignalScreenBrightness);
        }
    
        /** 
         * getCurrentScreenBrightMode
         * SCREEN_BRIGHTNESS_MODE_AUTOMATIC=1 auto
         * SCREEN_BRIGHTNESS_MODE_MANUAL=0  manual
         */  
        private int getScreenMode() {
            int screenMode=0;
            try {
                screenMode = Settings.System.getInt(getContentResolver(),
                        Settings.System.SCREEN_BRIGHTNESS_MODE);
            }
            catch (Exception localException){
                Log.e(TAG, "getScreenMode error:" + localException);
            }
            return screenMode;  
        }  
    
        /** 
         * getScreenBrightness  0--255
         */  
        private int getScreenBrightness() {
            int screenBrightness = 255;
            try {
                screenBrightness = Settings.System.getInt(getContentResolver(),
                        Settings.System.SCREEN_BRIGHTNESS);
            }
            catch (Exception localException){
                Log.e(TAG, "getScreenBrightness error:" + localException);
            }
            return screenBrightness;  
        }
    
        /** 
         * setScreenMode
         * SCREEN_BRIGHTNESS_MODE_AUTOMATIC=1 auto 
         * SCREEN_BRIGHTNESS_MODE_MANUAL=0  manual 
         */
        private void setScreenMode(int paramInt){
            if (paramInt < 0) return;
            try{  
                Settings.System.putInt(getContentResolver(),
                        Settings.System.SCREEN_BRIGHTNESS_MODE, paramInt);
            }catch (Exception localException){
                Log.e(TAG, "setScreenMode error:" + localException);
            }
        }
    
        /** 
         * saveScreenBrightness  0--255
         */  
        private void saveScreenBrightness(int paramInt){
            if (paramInt < 0) return;
            try{  
                Settings.System.putInt(getContentResolver(),
                        Settings.System.SCREEN_BRIGHTNESS, paramInt);
            }
            catch (Exception localException) {
                Log.e(TAG, "saveScreenBrightness error:" + localException);
            }
        }
    

     把setScreenBrightAdjust  干掉就差不多了……… 

      

  • 相关阅读:
    arc模式和ios的关系
    uitableview置底部,不显示到最顶层
    Mac OS X Lion 10.7.4 升级包
    ObjectiveC urlencode/urldecode url加密解密
    UITableView阴影
    iOS SDK: Working with URL Schemes
    黑苹果mac lion 10.7.3升级10.7.4
    查找 EXC_BAD_ACCESS 问题根源的方法
    "unrecognized selector sent to instance"问题的解决
    测量应用程序cass和cad的使用感受
  • 原文地址:https://www.cnblogs.com/crushgirl/p/14817708.html
Copyright © 2020-2023  润新知