• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Power Manager Service 송형주 Rev02
 

Power Manager Service 송형주 Rev02

on

  • 6,548 views

 

Statistics

Views

Total Views
6,548
Views on SlideShare
6,503
Embed Views
45

Actions

Likes
1
Downloads
135
Comments
0

1 Embed 45

http://www.slideshare.net 45

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

CC Attribution-NonCommercial-ShareAlike LicenseCC Attribution-NonCommercial-ShareAlike LicenseCC Attribution-NonCommercial-ShareAlike License

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Power Manager Service 송형주 Rev02 Power Manager Service 송형주 Rev02 Presentation Transcript

    • Power Manager Service 송형주
    • Service를 분석하기 위해 필요한 지식? • Thread • Looper – In-process message passing In process • Intent – 시스템 전체 범위의 IPC • Broadcast Receiver • Manager와 Service의 관계
    • Threads and Loopers APK Package Process Thread Local L l Intent Looper Service Receiver Call UI Activity Events Thread External Message Service Activity Queue System Calls Events
    • HandlerThread • Looper를 가진 스레드를 생성하기 위한 클래스 L 를 • Looper를 이용하기 위해서는 핸들러를 생성해야함 생성해야함.
    • looper란? class LooperThread extends Thread { p public Handler mHandler; ; public void run() { Looper.prepare(); // 현재 스레드의 looper 초기화 mHandler = new Handler() { public void handleMessage(Message msg) { // process incoming messages here } }; 핸들러 코드 Looper.loop(); // 메시지큐 실행 } }
    • Looper, Handler, Looper Handler MessageQueue Thread Message Queue Looper 3. deque 4. Dispatch 1. 메시지 수신 (message, Runnable) 2. Enque 2 E Handler handleMessage() 5. 메시지 처리
    • Android Power Management • S Support t – screen on/off – screen backlight on/off – keyboard backlight on/off – button backlight on/off – adjust screen brightness • Not Support pp – Sleep or Standby mode to fully use CPU’s capability.
    • Power Manager Service Sequence Flow 초기화 power = new PowerManagerService(); ServiceManager.addService(Context. PowerMangerService 등록 POWER_SERVICE, power); p power.init(context, hardware,  ( , , PowerMangerService ActivityManagerService.getDefault( (HandlerThread)생성 ), battery); System Ready
    • WakeLock? PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE); getSystemService(Context POWER SERVICE); PowerManager.WakeLock wl = pm.newWakeLock(PowerManager.SCREEN_DIM_WAKE_LOCK, "My Tag"); wl.acquire(); wl acquire(); ..screen will stay on during this section.. wl.release();
    • Power Management Framework
    • Power Manger Service 구조 Java Side C++ Side
    • 참고 • frameworks/base/core/jni – 안드로이드 런타임 관련 소스 – Android.mk : 안드로이드 런타임 Makefile • output : libandroid runtime 생성 libandroid_runtime • A d idR ti AndroidRuntime::startReg(JNIEnv* env) t tR (JNIE ) – 일반적인 JNI로 연결되는 네이티브 함수를 등 록하는 함수
    • AIDL • 데이터 마샬링/언마샬링 – 일부 안드로이드 문서는 flattened 라는 표현 사용