<meter id="pryje"><nav id="pryje"><delect id="pryje"></delect></nav></meter>
          <label id="pryje"></label>

          新聞中心

          Android按鍵燈流程分析

          作者: 時(shí)間:2016-10-29 來源:網(wǎng)絡(luò) 收藏

          調(diào)用代碼為:

          本文引用地址:http://www.ex-cimer.com/article/201610/306010.htm

          alpsframeworksbaseservicesjavacomAndroidserverLightsService.java

          使用方法:

          private LightsService.Light mButtonLight;

          mButtonLight = mLightsService.getLight(LightsService.LIGHT_ID_BUTTONS);

          mButtonLight.setBrightness(screenBrightness);

          mButtonLight.turnOff();

          本地代碼在:

          alpsframeworksbaseservicesjnicom__server_LightsService.cpp

          接口關(guān)聯(lián)使用:

          static JNINativeMethod method_table[] = {

          { init_native, ()I, (void*)init_native },

          { finalize_native, (I)V, (void*)finalize_native },

          { setLight_native, (IIIIIII)V, (void*)setLight_native },

          };

          int register__server_LightsService(JNIEnv *env)

          {

          return jniRegisterNativeMethods(env, com//server/LightsService,

          method_table, NELEM(method_table));

          }

          register_android_server_LightsService函數(shù)在alpsframeworksbaseservicesjnionload.cpp里面注冊(cè)

          本地c代碼在:

          alpsmediatekhardwareliblightslights.c里面open_lights里面

          static int

          set_light_buttons(struct light_device_t* dev,

          struct light_state_t const* state)

          {

          int err = 0;

          int on = is_lit(state);

          pthread_mutex_lock(g_lock);

          g_buttons = on;

          err = write_int(BUTTON_FILE, on?255:0);

          pthread_mutex_unlock(g_lock);

          return err;

          }

          com_android_server_LightsService.cp里面使用 devices->lights[light]->set_light(devices->lights[light], state);來調(diào)用真正的代碼

          如果有root機(jī)子,可以如下測(cè)試:

          echo 0 > /sys/class/leds/button-backlight/brightness 關(guān)

          echo 1 > /sys/class/leds/button-backlight/brightness 開

          echo 0 > /sys/class/leds/button-backlight/brightness 執(zhí)行的意思為:輸出0,作為/sys/class/leds/button-backlight/brightness的輸入傳入。

          如此便會(huì)打開brightness設(shè)備,并執(zhí)行write將0帶入執(zhí)行。



          關(guān)鍵詞: android 按鍵

          評(píng)論


          相關(guān)推薦

          技術(shù)專區(qū)

          關(guān)閉
          看屁屁www成人影院,亚洲人妻成人图片,亚洲精品成人午夜在线,日韩在线 欧美成人 (function(){ var bp = document.createElement('script'); var curProtocol = window.location.protocol.split(':')[0]; if (curProtocol === 'https') { bp.src = 'https://zz.bdstatic.com/linksubmit/push.js'; } else { bp.src = 'http://push.zhanzhang.baidu.com/push.js'; } var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(bp, s); })();