zoukankan      html  css  js  c++  java
  • android framework misc

    android framework misc

    Intent发送与接收

    系统(framework)发送Intent,可以发送Intent的API如下:
    sendBroadcast
    sendOrderedBroadcast
    sendBroadcastAsUser

    apk注册Intent接收,在系统(framework)发送Intent时将收到filtered Intent,并处理:
    private BroadcastReceiver mReceiver = new BroadcastReceiver(){
    public void onReceive(final Context context, Intent intent) {

    待机开机发送SCREEN_OFF、SCREEN_ON msg

    frameworks/base/services/core/java/com/android/server/power/Notifier.java

    691    private void sendWakeUpBroadcast() {
    692        if (DEBUG) {
    693            Slog.d(TAG, "Sending wake up broadcast.");
    694        }
    695
    696        if (mActivityManagerInternal.isSystemReady()) {
    697            mContext.sendOrderedBroadcastAsUser(mScreenOnIntent, UserHandle.ALL, null,
    698                    mWakeUpBroadcastDone, mHandler, 0, null, null);
    699        } else {
    700            EventLog.writeEvent(EventLogTags.POWER_SCREEN_BROADCAST_STOP, 2, 1);
    701            sendNextBroadcast();
    702        }
    703    }
    714    private void sendGoToSleepBroadcast() {
    715        if (DEBUG) {
    716            Slog.d(TAG, "Sending go to sleep broadcast.");
    717        }
    718
    719        if (mActivityManagerInternal.isSystemReady()) {
    720            mContext.sendOrderedBroadcastAsUser(mScreenOffIntent, UserHandle.ALL, null,
    721                    mGoToSleepBroadcastDone, mHandler, 0, null, null);
    722        } else {
    723            EventLog.writeEvent(EventLogTags.POWER_SCREEN_BROADCAST_STOP, 3, 1);
    724            sendNextBroadcast();
    725        }
    726    }

    android STR ON log

    09-19 09:07:05.785 3262 3389 I PowerManagerService: Going to sleep due to power_button (uid 1000)...
    09-19 09:07:05.785 3262 3389 I PowerManagerService: Sleeping (uid 1000)...
    09-19 09:07:11.194 3262 3389 I PowerManagerService: Waking up from Asleep (uid=1000, reason=WAKE_REASON_POWER_BUTTON, details=android.policy:POWER)...
    09-19 09:07:11.413 3262 3306 W PowerManagerService: Screen on took 299 ms

  • 相关阅读:
    N!的位数
    c语言memset()函数
    通宵教室(ACM水题)
    欧拉函数+素数筛
    快速幂+大数取模
    观光浏览
    插入类排序(直接插入排序)
    showDoc使用方法
    $_POST与input('post.')区别
    “三日”面试官心得
  • 原文地址:https://www.cnblogs.com/aspirs/p/15347946.html
Copyright © 2011-2022 走看看