adnroid 关机闹钟流程

首先系统开机 启动系统服务其中就有activitymanagerservice

在 systemReady()方法里面

/// M: power-off alarm utility initiliazation
    mPowerOffAlarmUtility = PowerOffAlarmUtility.getInstance(mContext, mMainStack, mAmPlus);

/// M: power-off Alarm feature @{
            if (PowerOffAlarmUtility.isAlarmBoot()) {
                Slog.v(TAG, "power off alarm enabled");
                mPowerOffAlarmUtility.launchPowrOffAlarm(false, false);
                return;
            }


进入 poweroffalarmutility

public void launchPowrOffAlarm(Boolean recover, Boolean shutdown) {
        if (recover != null && shutdown != null) {
            checkFlightMode(recover, shutdown);
        }
        mContext.sendBroadcast(new Intent(
                "android.intent.action.LAUNCH_POWEROFF_ALARM"));
    }

接受广播的地方友联个,一个alarmmanagerservice 受到广播后,没啥其他操作,再发送一个广播

应该是给第三方应用用的。

另外一个地方就是:KeyguardViewMediator

这里不仅会生成弹出闹钟界面,还负责启动deskclock里面的服务:

 private void startAlarm() {
        Intent in = new Intent("com.android.deskclock.ALARM_ALERT");
        in.putExtra("isAlarmBoot", true);
        mContext.startService(in);
    }

就是这个服务:

                android:exported="false"
                android:description="@string/alarm_klaxon_service_desc">
           
               
           

还有个服务是

PowerOffAlarmService 都是用来控制铃声,等正常闹铃起闹等  今天都写了两片了,歇歇 头疼,不看了


你可能感兴趣的:(android,系统分析)