zoukankan      html  css  js  c++  java
  • android Contacts/Acore进程常常被Kill,导致联系人开机后丢失怎么办?

    Contacts/Acore进程,在内存较少和开机进程过多的情况下会常常被 ActivityManager Kill 掉。
    导致Sim卡联系人开机后未导入或者仅仅导入一部分,造成联系人丢失的现象,可是又一次开机后能够恢复正常。


    遇到这种问题能够採用下面方法提供Contacts/Acore进程的优先级,减少被ActivityManager 杀掉的概率。
     
    方法1:
    提高进程优先级
            startForeground(1, new Notification());
    减少进程优先级
            stopForeground(true); 
    NOTICE:
        这种方法能够将相应AP的ADJ暂时提高到2。
     
    方法2:
    找到这个进程相应的AndroidMannifest.xml文件,在当中加入属性『android:persistent="true"』,
    这样能够将该进程设置为常驻内存进程,就能够减少被Kill的概率。
    以Acore进程为例。
    在 /package/providers/ContactsProvider/AndroidMannifest.xml 文件里添加一行『android:persistent="true"』
    详细改动示比例如以下:
       <application android:process="android.process.acore"
                 android:label="@string/app_label"
                 android:icon="@drawable/app_icon"
                 android:allowBackup="false"
                 android:persistent="true" <!--新添加代码。保证acore进程不被ActivityManager杀死-->
         >
    NOTICE:
        这种方法能够将相应AP的ADJ暂时提高到2。
     
        解决发生JE问题(必须合入):
        CallLogProvider.java  (Line1000)
        public static final void notifyNewCallsCount(SQLiteDatabase db, Context context) {
            ... ...
            Log.i(TAG, "[notifyNewCallsCount] newCallsCount = " + newCallsCount);
            //send count=0 to clear the unread icon
            if (newCallsCount >= 0) {
                Intent newIntent = new Intent(Intent.MTK_ACTION_UNREAD_CHANGED);
                newIntent.putExtra(Intent.MTK_EXTRA_UNREAD_NUMBER, newCallsCount);
                newIntent.putExtra(Intent.MTK_EXTRA_UNREAD_COMPONENT, new ComponentName(Constants.CONTACTS_PACKAGE,
                        Constants.CONTACTS_DIALTACTS_ACTIVITY));
    // New add for fixed JE
                newIntent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT);
    // End
                context.sendBroadcast(newIntent);
            ... ...
  • 相关阅读:
    linux的openfire运行日志配置经历
    基于Html5的兼容所有主流浏览器的在线视频播放器videoJs
    Eclipse下使用Fat Jar插件对源代码进行打包
    ubuntu下的openfire安装、配置、运行
    linux系统时间同步更新
    PRD产品需求文档概要
    oracle实现自动记录存储过程、自定义函数执行错误
    Oracler读取各种格式的相关日期格式
    linux中shell变量$#,$@,$0,$1,$2的含义解释
    Linux的五个查找命令
  • 原文地址:https://www.cnblogs.com/blfbuaa/p/6727345.html
Copyright © 2011-2022 走看看