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);
            ... ...
  • 相关阅读:
    Windows系统中监控文件复制操作的几种方式
    右击菜单一键优化(增加新建office2003、新建reg和bat,删除新建公文包、新建wps、新建rar)
    美颜我迪!
    为什么我们不要 .NET 程序员
    访问局域网电脑提示“指定的网络名不存在”的解决办法
    WIN7X64SP1极限精简版by双心
    一键精简Windows不常用的字体.cmd
    dll文件32位64位检测工具以及Windows文件夹SysWow64的坑【转发】
    Win7精简成功后的总结
    dependency walker检查dll依赖关系目录设置的问题
  • 原文地址:https://www.cnblogs.com/blfbuaa/p/6727345.html
Copyright © 2011-2022 走看看