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);
            ... ...
  • 相关阅读:
    jieba分词
    hue审计记录-记录用户的查询记录(用户前端删除,后端也不会删除)
    nginx1.16.1平滑升级到1.18
    mysql5.7.24升级到5.7.30 rpm部署模式 redhat7
    ldap无法启动 system library:fopen:Permission denied bss_file.c:402
    hive练习-行列转换 窗口函数
    linkis重编译适配cdh
    redhat7 安装mysql5.15
    hive 自动加载分区 --动态分区
    最近搞了个客户端
  • 原文地址:https://www.cnblogs.com/blfbuaa/p/6727345.html
Copyright © 2011-2022 走看看