1.1Android 5.1 - 7.1 系统(framework)定制、修改、移植、总结_framwork 5.1-1743759 android 5.1+-程序员宅基地

技术标签: Android系统  

 

修改开机logo有两种方法,一种直接去改c语言代码,第二种替换图片用python生成splash。第一种方法我没试过,感觉挺麻烦的,还有分辨率限制,超过多少分辨率就不能用第一种方法。

  1. 修改的文件路径LINUX/android/bootable/bootloader/lk/splash
  2. 准备好logo图片(png、bmp格式)
  3. 查看中原图片的分辨率,修改logo图片 保证 分辨率 一致
  4. 生成splash.img镜像文件

注:图片分辨率很重要!很重要!很重要!

生成splash.img 步骤

The steps to generate a splash.img:
 
1 sudo apt-get install python-imaging
 
2 python ./logo_gen.py boot_001.png (*.bmp)

为了减少编译时间可以直接将生成好的splash.img将刷机包中的文件替换掉。

2:Framework(SysteimUI) Android在状态栏增加耳机拔插图标

Android 4.1在拔插耳机时,状态栏没有提示图标。最近做了这个新的需求,步骤如下:
1、在frameworks/base/packages/SystemUI/res/drawable-Xdpi下增加一个耳机图片stat_sys_headset.png。drawable-Xdpi中的X根据手机的分辨率来确定,我的手机用的是drawable-hdpi;

2、在frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicy.java中增加下面的代码:

  private BroadcastReceiver mIntentReceiver = new BroadcastReceiver() {
        @Override
        public void onReceive(Context context, Intent intent) {
            String action = intent.getAction();
            if (action.equals(Intent.ACTION_ALARM_CHANGED)) {
                updateAlarm(intent);
            }
            else if (action.equals(Intent.ACTION_SYNC_STATE_CHANGED)) {
                updateSyncState(intent);
            }
            else if (action.equals(BluetoothAdapter.ACTION_STATE_CHANGED) ||
                    action.equals(BluetoothAdapter.ACTION_CONNECTION_STATE_CHANGED)) {
                updateBluetooth(intent);
            }
            /*add code for adding headset icon in statusbar.*/
            else if (action.equals(Intent.ACTION_HEADSET_PLUG)) {
                updateHeadsetState(intent);
            }
            //end 
            else if (action.equals(AudioManager.RINGER_MODE_CHANGED_ACTION) ||
                    action.equals(AudioManager.VIBRATE_SETTING_CHANGED_ACTION)) {
                updateVolume();
            }
            else if (action.equals(TelephonyIntents.ACTION_SIM_STATE_CHANGED)) {
                updateSimState(intent);
            }
            else if (action.equals(TtyIntent.TTY_ENABLED_CHANGE_ACTION)) {
                updateTTY(intent);
            } else if (action.equals(Intent.ACTION_LOCALE_CHANGED)) {
 
                // when acceptting the locale change event,reload USB connection notification.
                boolean isUsbConnected = mStorageManager.isUsbMassStorageConnected();
                mStorageNotification.onUsbMassStorageConnectionChanged(isUsbConnected);
            }
        }
    };
 
    public PhoneStatusBarPolicy(Context context) {
        mContext = context;
 
        // init StorageNotification object
        mStorageNotification = new StorageNotification(mContext);
        mService = (StatusBarManager)context.getSystemService(Context.STATUS_BAR_SERVICE);
 
        // listen for broadcasts
        IntentFilter filter = new IntentFilter();
        filter.addAction(Intent.ACTION_ALARM_CHANGED);
        filter.addAction(Intent.ACTION_SYNC_STATE_CHANGED);
        filter.addAction(AudioManager.RINGER_MODE_CHANGED_ACTION);
        filter.addAction(AudioManager.VIBRATE_SETTING_CHANGED_ACTION);
        filter.addAction(BluetoothAdapter.ACTION_STATE_CHANGED);
        filter.addAction(BluetoothAdapter.ACTION_CONNECTION_STATE_CHANGED);
        /*add code for adding headset icon in statusbar.*/
        filter.addAction(Intent.ACTION_HEADSET_PLUG);
        //end
        filter.addAction(TelephonyIntents.ACTION_SIM_STATE_CHANGED);
        filter.addAction(TtyIntent.TTY_ENABLED_CHANGE_ACTION);
 
        // add locale change event filter
        filter.addAction(Intent.ACTION_LOCALE_CHANGED);
        mContext.registerReceiver(mIntentReceiver, filter, null, mHandler);
 
        int numPhones = MSimTelephonyManager.getDefault().getPhoneCount();
        mSimState = new IccCard.State[numPhones];
        for (int i=0; i < numPhones; i++) {
            mSimState[i] = IccCard.State.READY;
        }
        // storage
        mStorageManager = (StorageManager) context.getSystemService(Context.STORAGE_SERVICE);
        mStorageManager.registerListener(mStorageNotification);
 
        // TTY status
        mService.setIcon("tty",  R.drawable.stat_sys_tty_mode, 0, null);
        mService.setIconVisibility("tty", false);
 
        // Cdma Roaming Indicator, ERI
        mService.setIcon("cdma_eri", R.drawable.stat_sys_roaming_cdma_0, 0, null);
        mService.setIconVisibility("cdma_eri", false);
 
        // bluetooth status
        BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter();
        int bluetoothIcon = R.drawable.stat_sys_data_bluetooth;
        if (adapter != null) {
            mBluetoothEnabled = (adapter.getState() == BluetoothAdapter.STATE_ON);
            if (adapter.getConnectionState() == BluetoothAdapter.STATE_CONNECTED) {
                bluetoothIcon = R.drawable.stat_sys_data_bluetooth_connected;
            }
        }
        mService.setIcon("bluetooth", bluetoothIcon, 0, null);
        mService.setIconVisibility("bluetooth", mBluetoothEnabled);
 
        /*add code for adding headset icon in statusbar.*/
        mService.setIcon("headset", R.drawable.stat_sys_headset, 0, null);
        mService.setIconVisibility("headset", false);
        //end
 
        // Alarm clock
        mService.setIcon("alarm_clock", R.drawable.stat_sys_alarm, 0, null);
        mService.setIconVisibility("alarm_clock", false);
 
        // Sync state
        mService.setIcon("sync_active", R.drawable.stat_sys_sync, 0, null);
        mService.setIcon("sync_failing", R.drawable.stat_sys_sync_error, 0, null);
        mService.setIconVisibility("sync_active", false);
        mService.setIconVisibility("sync_failing", false);
 
        // volume
        mService.setIcon("volume", R.drawable.stat_sys_ringer_silent, 0, null);
        mService.setIconVisibility("volume", false);
        updateVolume();
    }
    
    
    /*add code for adding headset icon in statusbar.*/
    private final void updateHeadsetState(Intent intent) {
        boolean mIsHeadsetOn = (intent.getIntExtra("state", 0) == 1);
        Slog.v(TAG, "updateHeadsetState: HeadsetState: " + mIsHeadsetOn);
 
        mService.setIconVisibility("headset", mIsHeadsetOn);
    }

在\frameworks\base\core\res\res\values\config.xml中加入耳机图标控制字段(headset):

<string-array name="config_statusBarIcons">
       <item><xliff:g id="id">ime</xliff:g></item>
       <item><xliff:g id="id">sync_failing</xliff:g></item>
       <item><xliff:g id="id">sync_active</xliff:g></item>
       <item><xliff:g id="id">gps</xliff:g></item>
       <item><xliff:g id="id">bluetooth</xliff:g></item>
       <item><xliff:g id="id">nfc</xliff:g></item>
       <item><xliff:g id="id">tty</xliff:g></item>
       <item><xliff:g id="id">speakerphone</xliff:g></item>
       <item><xliff:g id="id">mute</xliff:g></item>
       <item><xliff:g id="id">volume</xliff:g></item>
       <item><xliff:g id="id">wifi</xliff:g></item>
       <item><xliff:g id="id">cdma_eri</xliff:g></item>
       <item><xliff:g id="id">phone_signal_second_sub</xliff:g></item>
       <item><xliff:g id="id">data_connection</xliff:g></item>
       <item><xliff:g id="id">phone_evdo_signal</xliff:g></item>
       <item><xliff:g id="id">phone_signal</xliff:g></item>
       <item><xliff:g id="id">battery</xliff:g></item>
       <item><xliff:g id="id">alarm_clock</xliff:g></item>
       <item><xliff:g id="id">secure</xliff:g></item>
       <item><xliff:g id="id">clock</xliff:g></item>
      <item><xliff:g id="id">headset</xliff:g></item>
 
    </string-array>

因为所加代码中的 mService.setIcon和mService.setIconVisibility最终会调用到StatusBarManagerService,它的构造函数有mIcons.defineSlots(res.getStringArray(com.android.internal.R.array.config_statusBarIcons));语句,找到config_statusBarIcons所在的配置文件为config.xml。如果没加,会再seticon(StatusBarManagerService类里)函数里

3:Android--隐藏状态栏图标

目前状态栏图标有通知图标和系统图标
通知图标主要是指各应用发过来的通知,比如未接电话,截图,后台播放音乐等,系统图标主要有蓝牙,耳机,wifi,数据流量,时间和电池...

1,不显示通知图标,
在frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarIconController.java中

public void updateNotificationIcons {
     for (int i = 0; i < N; i++) {
            NotificationData.Entry ent = activeNotifications.get(i);
  +          final String pkg = ent.notification.getPackageName();
  +           android.util.Log.d("StatusBarIconController","pkg========"+pkg);

            //比如如果包名不是收音机的,就不显示图标
  +        if (!pkg.contains("com.android.fmradio")) {
  +              continue;
            }
            if (notificationData.isAmbient(ent.key)
                    && !NotificationData.showNotificationEvenIfUnprovisioned(ent.notification)) {
                continue;
            }
}

2.不显示系统图标,系统图标的显示是在以下文件,比如蓝牙,wifi,耳机等
/frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/
PhoneStatusBarPolicy.java

将不要显示图标,将setIconVisibility()改为false即可,比如,如果不要闹钟图标

public void updateNotificationIcons {
     for (int i = 0; i < N; i++) {
            NotificationData.Entry ent = activeNotifications.get(i);
  +          final String pkg = ent.notification.getPackageName();
  +           android.util.Log.d("StatusBarIconController","pkg========"+pkg);

            //比如如果包名不是收音机的,就不显示图标
  +        if (!pkg.contains("com.android.fmradio")) {
  +              continue;
            }
            if (notificationData.isAmbient(ent.key)
                    && !NotificationData.showNotificationEvenIfUnprovisioned(ent.notification)) {
                continue;
            }
}

2.不显示系统图标,系统图标的显示是在以下文件,比如蓝牙,wifi,耳机等
/frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/
PhoneStatusBarPolicy.java

将不要显示图标,将setIconVisibility()改为false即可,比如,如果不要闹钟图标

private void updateAlarm() {
        ....
- - -       mService.setIconVisibility(SLOT_ALARM_CLOCK, mCurrentUserSetup && hasAlarm);

+++ mService.setIconVisibility(SLOT_ALARM_CLOCK, false);
    }

3,系统图标中比较特殊的时间和电池在
/frameworks/base/packages/SystemUI/res/layout/status_bar.xml

<com.android.systemui.statusbar.policy.Clock
                android:
版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/qq_34738528/article/details/109378654

智能推荐

matlab散点图折线图_什么是散点图以及何时使用-程序员宅基地

文章浏览阅读2.9k次,点赞3次,收藏8次。matlab散点图折线图When you were learning algebra back in high school, you might not have realized that one day you would need to create a scatter plot to demonstrate real-world results. 当您在高中学习代数时,您可能没有意识到有..._什么时候用散点图

一个字符串编码问题的程序解决_那么,请编程计算出一个字符串在这个编码系统下编码后的值是多少。 输入 输入的第-程序员宅基地

文章浏览阅读2k次。原题: /* 描述 为了最大程度地节约存储空间,经常需要把信息进行编码。一种很有效的编码方法是用数字来表示一串字符。假设这些字符串都是由不重复的英文小写字母组成的,且每个字符串中的英文字母都是从小到大排列的。 这个编码系统按照如下的方式工作: 字符串是按照长度从小到大的顺序排列的 长度相同的字符串,是按照字典需排列的 则根据这个编码系统,所有的字符串从 a 开始可以编码如下: a -_那么,请编程计算出一个字符串在这个编码系统下编码后的值是多少。 输入 输入的第

生物电与脑电波-程序员宅基地

文章浏览阅读3.3k次。生物电与脑电波电磁波(又称电磁辐射)是由同相振荡且互相垂直的电场与磁场在空间中以波的形式移动,其传播方向垂直于电场与磁场构成的平面,有效的传递能量和动量。电磁辐射可以按照频率分类,从低频率到高频率,包括有无线电波(3KHz—3000GHz)、微波、红外线、可见光、紫外光、X-射线和伽马射线等等。人眼可接收到的电磁辐射,波长大约在380至780纳米之间,称为可见光。只要是本身温..._大脑皮层中电磁波经过哪些部位

win7、8 cmd开启3389,并添加用户至远程桌面组_直接添加用户,开启3389登陆-程序员宅基地

文章浏览阅读2.3w次。wmic /namespace:\root\cimv2\terminalservices path win32_terminalservicesetting where (__CLASS != “”) call setallowtsconnections 1wmic /namespace:\root\cimv2\terminalservices path win32_tsgeneralsetti_直接添加用户,开启3389登陆

CDH集群管理界面打开oozie的Web页面报错:Oozie web console is disabled_cdh打开oozie oozie web console is disabled. to enabl-程序员宅基地

文章浏览阅读847次。一、错误说明CDH集群管理界面打开oozie的Web页面报错二、问题解决根据提示查看Oozie Quick Start 发现是缺少ExtJS 2.2库(必须是2.2版)①进入/var/lib/oozie目录cd /var/lib/oozie②下载ext-2.2库wget http://archive.cloudera.com/gplextras/misc/ext-2.2.zip ..._cdh打开oozie oozie web console is disabled. to enable oozie web console inst

ap和无线路由器区别_ap面板与路由器的功率一样吗-程序员宅基地

文章浏览阅读2.3k次。无线AP和无线路由器的区别 随着无线网络的快速发展,轻松便捷的无线世界已经融入到我们的工作生活当中。无论是soho用户还是家庭用户,组建小型的无线局域网都已成为他们首选的组网方案,然而面对陌生的网络协议以及众多的网络设备,你是否能够一一认清它们呢? 就像很多人很容易混淆无线上网卡和无线网卡一样,很多用户也分不清无线AP和无线路由,小峰便是其中的一位。 小峰是一个典型的宅_ap面板与路由器的功率一样吗

随便推点

电脑睡眠后并未进行休眠状态,风扇还在转怎么解决-程序员宅基地

文章浏览阅读8.6k次,点赞3次,收藏5次。为了节能,一般会把电脑设置成“几分钟无活动后,自动睡眠(休眠)“,大家一般都会设置成,三分钟后关闭显示器,半小时后睡眠,睡眠后电脑会结束工作,内存数据移动硬盘上,这时电脑处于极低耗能状态,但是,有时经常会遇到这样一个问题,电脑已经休眠了,但处理器上的散热风扇还一直呼呼的转 遇到以上问题,有几种情况,一:可能被软件修改了系统..._睡眠模式cpu风扇转动

域控-笔记三(非约束委派攻击,约束委派攻击)_无法设置约束性委派-程序员宅基地

文章浏览阅读2.2k次,点赞4次,收藏14次。文章目录一. 域委派1.1 域委派分类1.2 委派流程1.3 使用委派条件1.4 委派的一些原理二. 委派攻击2.1 非约束委派攻击本地环境非约束委派的查找一. 域委派1.1 域委派分类非约束委派(Unconstrained delegation)服务账号可以获取被委派用户的TGT,并将TGT缓存到LSASS进程中,从而服务账号可使用该TGT,模拟用户访问任意服务。配置了非约束委派的账户的userAccountControl 属性有个FLAG位 WORKSTATION_TRUSTED_FOR_DE_无法设置约束性委派

辣鸡到不行的lsj在半个月后终于想起了自己的博客园密码-程序员宅基地

文章浏览阅读175次。这几天学了点啥东西:莫队;莫队;以及莫队题中用到的线段树;以及模板cdq这几天又了解了写啥东西:二叉树(好像贼难)splay(贼难)kmp(还行)ac自动机()看看这个月应该学些什么吧;cdq(这星期学完吧),trip & kmp(下星期?)ac自动机(再来一星期?);星期天早上考试的时候打算刷组usaco的金组题吧(tm..._一梦 lsj密码

jscex-async.min.js_async.mini.js-程序员宅基地

文章浏览阅读323次。(function(){var k=function(){};k.prototype={isCancellation:!0,message:“The task has been cancelled.”};typeof __jscex__async__taskIdSeed===“undefined”&&(__jscex__async__taskIdSeed=0);var l=func..._async.mini.js

引入新的jar包之后,tomcat启动报错,stackOverflowError_更新jar包, tomacat启动报错-程序员宅基地

文章浏览阅读3k次。Caused by: java.lang.IllegalStateException: Unable to complete the scan for annotations for web application [/xxxx] due to a StackOverflowError. Possible root causes include a too low setting for -Xss..._更新jar包, tomacat启动报错

中医药本体概念描述体系的自动构建研究-程序员宅基地

文章浏览阅读838次。http://www.etc.edu.cn/articledigest47/%E4%B8%AD%E5%8C%BB%E8%8D%AF%E6%9C%AC%E4%BD%93%E6%A6%82%E5%BF%B5%E6%8F%8F%E8%BF%B0%E4%BD%93%E7%B3%BB%E7%9A%84%E8%87%AA%E5%8A%A8%E6%9E%84%E5%BB%BA%E7%A0%94%E7%A9%B6.pdf刘 耀  穗志方  周 扬  王振国(中国科

推荐文章

热门文章

相关标签