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);
            ... ...
  • 相关阅读:
    今天整理一下以前各博客网站上的文章
    转一篇详解Excel逻辑函数的文章
    Google中国的首页变化
    [转]在QuantumGrid4.5中手动添加数据
    [转]VISTA服务介绍
    Idiomatic Phrases Game zoj 2750 Dijkstra
    Fleury 求欧拉回路
    QS Network ZOJ 1586 Prim
    Burn the Linked Camp ZOJ 2770 差分约束系统 SPFA
    ZOJ 1092 POJ 2240 Arbitrage Floyd
  • 原文地址:https://www.cnblogs.com/blfbuaa/p/6727345.html
Copyright © 2011-2022 走看看