Android 11 开机引导定制

若要定制自定义的开机向导,则只需要在Activity中加入自定义的内容,再调用finishSetupWizard()方法把它关掉即可。

/*
 * Copyright (C) 2008 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.android.provision;

import android.app.Activity;
import android.content.ComponentName;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.provider.Settings;

import android.widget.Button;
import android.view.View;


/**
 * Application that sets the provisioned bit, like SetupWizard does.
 */
public class DefaultActivity extends Activity implements View.OnClickListener{

    @Override
    protected void onCreate(Bundle icicle) {
        super.onCreate(icicle);
        setContentView(R.layout.activity_main);
        Button bt = findViewById(R.id.bt);
        bt.setOnClickListener(this);


    }
    @Override
    public void onClick(View view) {
        finishSetupWizard();
    }
    
   public void  finishSetupWizard(){
	   // Add a persistent setting to allow other apps to know the device has been provisioned.
       Settings.Global.putInt(getContentResolver(), Settings.Global.DEVICE_PROVISIONED, 1);
       Settings.Secure.putInt(getContentResolver(), Settings.Secure.USER_SETUP_COMPLETE, 1);

       // remove this activity from the package manager.
       PackageManager pm = getPackageManager();
       ComponentName name = new ComponentName(this, DefaultActivity.class);
       pm.setComponentEnabledSetting(name, PackageManager.COMPONENT_ENABLED_STATE_DISABLED,
               PackageManager.DONT_KILL_APP);

       // terminate the activity.
       finish();
    }
}

  <activity
            android:name="com.android.provision.DefaultActivity"
            android:excludeFromRecents="true">
                  <intent-filter android:priority="1">
                        <action android:name="android.intent.action.MAIN" />
                        <category android:name="android.intent.category.HOME" />
                        <category android:name="android.intent.category.DEFAULT" />
                        <category android:name="android.intent.category.SETUP_WIZARD" />
                    </intent-filter>
         
        </activity>
  • 1
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
Android开机引导程序是指在Android设备启动时运行的一系列程序,用于初始化系统和加载操作系统。它负责执行一些必要的操作,例如检测硬件、初始化内核、加载驱动程序和启动Android操作系统。 Android开机引导程序的主要步骤如下: 1. 加电启动:当Android设备接收到电源供应时,引导程序会开始执行。 2. 加载引导加载程序(Bootloader):引导程序首先会加载引导加载程序,也称为Bootloader。引导加载程序是设备上的一小段代码,通常存储在设备的非易失性存储器中,例如闪存或EEPROM。它负责初始化设备硬件,并加载操作系统。 3. 加载内核(Kernel):引导加载程序会加载操作系统内核,也称为Kernel。内核是操作系统的核心部分,它管理设备的硬件资源,提供与硬件交互的接口,并执行其他系统级任务。 4. 初始化设备硬件:内核会执行设备硬件的初始化,例如初始化处理器、内存、存储器、显示屏等。 5. 挂载文件系统:内核会挂载文件系统,使得操作系统可以访问存储在设备上的文件和数据。 6. 启动Android系统服务:内核会启动Android系统服务,例如电源管理服务、网络服务、传感器服务等。 7. 启动应用程序:最后,Android系统会启动应用程序,用户可以开始使用设备。 这些步骤的细节可能因设备和Android版本而有所差异,但大致上遵循相似的流程。开机引导程序的目标是确保设备能够顺利启动,并为用户提供可用的操作系统环境。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

FW_G8Z

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值