【AOSP BUG】IndexOutOfBoundsException in NotificationManagerService.java
来源:互联网 发布:2016好听的网络歌曲 编辑:程序博客网 时间:2024/06/06 03:59
java.lang.RuntimeException: Error receiving broadcast Intent { act=android.intent.action.USER_SWITCHED flg=0x50000010 (has extras) } in com.android.server.notification.NotificationManagerService$3@b5a472d at android.app.LoadedApk$ReceiverDispatcher$Args.run(LoadedApk.java:1134) at android.os.Handler.handleCallback(Handler.java:754) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:160) at com.android.server.SystemServer.run(SystemServer.java:355) at com.android.server.SystemServer.main(SystemServer.java:220) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:874) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:764)Caused by: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0 at java.util.ArrayList.get(ArrayList.java:411) at com.android.server.notification.NotificationManagerService$NotificationRankers.onUserSwitched(NotificationManagerService.java:3912) at com.android.server.notification.NotificationManagerService$3.onReceive(NotificationManagerService.java:804) at android.app.LoadedApk$ReceiverDispatcher$Args.run(LoadedApk.java:1124) ... 8 more
该问题是n上的google原生问题,问题根源:
NotificationManagerService.java中,NotificationRankers 继承了 MangerServices
@Overridepublic void onUserSwitched(int user) { synchronized (mMutex) { int i = mServices.size()-1; while (i --> 0) { final ManagedServiceInfo info = mServices.get(i); unregisterService(info.service, info.userid); } } registerRanker();}
在 while 循环中,调用了unregisterService
public void unregisterService(IInterface service, int userid) { checkNotNull(service); // no need to check permissions; if your service binder is in the list, // that's proof that you had permission to add it in the first place unregisterServiceImpl(service, userid);}
private void unregisterServiceImpl(IInterface service, int userid) { ManagedServiceInfo info = removeServiceImpl(service, userid); if (info != null && info.connection != null && !info.isGuest(this)) { mContext.unbindService(info.connection); }}
/** * Removes a service from the list but does not unbind * * @return the removed service. */private ManagedServiceInfo removeServiceImpl(IInterface service, final int userid) { if (DEBUG) Slog.d(TAG, "removeServiceImpl service=" + service + " u=" + userid); ManagedServiceInfo serviceInfo = null; synchronized (mMutex) { final int N = mServices.size(); for (int i = N - 1; i >= 0; i--) { final ManagedServiceInfo info = mServices.get(i); if (info.service.asBinder() == service.asBinder() && info.userid == userid) { if (DEBUG) Slog.d(TAG, "Removing active service " + info.component); serviceInfo = removeServiceLocked(i); } } } return serviceInfo;}private ManagedServiceInfo removeServiceLocked(int i) { final ManagedServiceInfo info = mServices.remove(i); onServiceRemovedLocked(info); return info;}
这里的for循环会删去MangedServiceInfo,导致最外层的while循环i计数错误。当mService为空以后,报出数组越界,导致手机重启
0 0
- 【AOSP BUG】IndexOutOfBoundsException in NotificationManagerService.java
- Proxool Problem getting connection java.lang.IndexOutOfBoundsException(bug)
- java IndexOutOfBoundsException
- 编译NotificationManagerService.java文件的方法
- 【Bug解决日志】newUri.getPathSegments().get(1) 报错: java.lang.IndexOutOfBoundsException
- java.lang.IndexOutOfBoundsException
- java.lang.IndexOutOfBoundsException错误
- IndexOutOfBoundsException
- java.lang.IndexOutOfBoundsException 错误解决
- java.lang.IndexOutOfBoundsException,数组越界
- java.lang.IndexOutOfBoundsException 错误解决
- java.lang.IndexOutOfBoundsException 错误解决
- java.lang.IndexOutOfBoundsException 错误解决
- Android onTouchEvent java.lang.IndexOutOfBoundsException
- java.lang.IndexOutOfBoundsException: Inconsistency detected.
- NotificationManagerService笔记
- RecyclerView Bug:IndexOutOfBoundsException: Inconsistency detected. Invalid item position 解决方案
- RecyclerView Bug:IndexOutOfBoundsException: Inconsistency detected. Invalid item position …
- Android的View工作原理(一)mearsure过程
- Java多线程2:Thread中的实例方法
- Ajax应用之文件上传
- CF 777B
- Mysql,Oracle,SqlServer三大数据库【关键字一览表】
- 【AOSP BUG】IndexOutOfBoundsException in NotificationManagerService.java
- linux安装elasticsearch5.0.x-安装篇
- 用无名管道重定向子进程的输入输出
- fifo_write0fzc.c
- 理解Python中的with…as…语法
- java基础_day0018_数组_ArrayUtil_最大值_最小值_交换_复制_平均值_求和
- oracle清空某列数据
- 回车与换行字符
- Tomcat 8.5.6 登录控制台界面查看 状态