首页 新闻 会员 周边 捐助

WindowManager无故消失

0
悬赏园豆:50 [已解决问题] 解决于 2012-11-14 22:23

项目中,使用WindowManager悬浮窗内调用定时器不断的截取屏幕图像并发送。过了一段时间,报以下LogCat,尤其是红色部分,每次都是先出现这个然后就报下面的错误,然后WindowManager就消失不见了。这个到底是为什么呢?希望有大牛能指点一下。

11-13 09:31:59.386: I/ActivityManager(169): Process com.bcts.teachsystem (pid 1485) has died.
11-13 09:31:59.386: W/ActivityManager(169): Scheduling restart of crashed service com.bcts.teachsystem/.service.SessionBackstage in 5000ms
11-13 09:31:59.386: W/ActivityManager(169): Scheduling restart of crashed service com.bcts.teachsystem/.service.ChooseClassService in 15000ms
11-13 09:31:59.394: I/WindowManager(169): WIN DEATH: Window{411df330  paused=false}
11-13 09:32:00.769: I/ActivityManager(169): Applications Memory Usage (kB):
11-13 09:32:00.769: I/ActivityManager(169): Uptime: 981081 Realtime: 982366
11-13 09:32:00.769: I/ActivityManager(169): Total PSS by OOM adjustment:
11-13 09:32:00.769: I/ActivityManager(169):     30726 kB: System
11-13 09:32:00.769: I/ActivityManager(169):                30726 kB: system (pid 169)
11-13 09:32:00.769: I/ActivityManager(169):     35046 kB: Persistent
11-13 09:32:00.769: I/ActivityManager(169):                25611 kB: com.android.systemui (pid 260)
11-13 09:32:00.769: I/ActivityManager(169):                 9435 kB: com.android.phone (pid 356)
11-13 09:32:00.769: I/ActivityManager(169):     25258 kB: Foreground
11-13 09:32:00.769: I/ActivityManager(169):                25258 kB: com.rt.jxufe.book (pid 1720)
11-13 09:32:00.769: I/ActivityManager(169):      3723 kB: Visible
11-13 09:32:00.769: I/ActivityManager(169):                 3723 kB: com.android.smspush (pid 390)
11-13 09:32:00.769: I/ActivityManager(169):     14358 kB: Perceptible
11-13 09:32:00.769: I/ActivityManager(169):                14358 kB: com.baidu.input (pid 339)
11-13 09:32:00.769: I/ActivityManager(169):     75119 kB: A Services
11-13 09:32:00.769: I/ActivityManager(169):                56317 kB: android.process.acore (pid 883)
11-13 09:32:00.769: I/ActivityManager(169):                10625 kB: com.wandoujia.phoenix2 (pid 373)
11-13 09:32:00.769: I/ActivityManager(169):                 8177 kB: android.process.media (pid 302)
11-13 09:32:00.769: I/ActivityManager(169):     21767 kB: B Services
11-13 09:32:00.769: I/ActivityManager(169):                 6213 kB: com.qihoo.appstore (pid 653)
11-13 09:32:00.769: I/ActivityManager(169):                 6133 kB: com.hyperkani.sliceice (pid 687)
11-13 09:32:00.769: I/ActivityManager(169):                 5483 kB: com.gau.go.launcherex.gowidget.switchwidget (pid 970)
11-13 09:32:00.769: I/ActivityManager(169):                 3938 kB: com.bel.android.dspmanager (pid 499)
11-13 09:32:00.769: I/ActivityManager(169): Total PSS: 205997 kB
11-13 09:32:00.769: I/ActivityManager(169):   PID      Vss      Rss      Pss      Uss  cmdline
11-13 09:32:00.769: I/ActivityManager(169):   883   82652K   82368K   56432K   53328K  android.process.acore
11-13 09:32:00.769: I/ActivityManager(169):   169   55872K   55824K   30810K   27668K  system_server
11-13 09:32:00.769: I/ActivityManager(169):   260   49768K   49644K   25685K   23128K  com.android.systemui
11-13 09:32:00.769: I/ActivityManager(169):  1720   52912K   52840K   25325K   18908K  com.rt.jxufe.book
11-13 09:32:00.769: I/ActivityManager(169):   108   49576K   28584K   21269K   16948K  /system/bin/surfaceflinger
11-13 09:32:00.769: I/ActivityManager(169):   339   37140K   37036K   14426K   12392K  com.baidu.input
11-13 09:32:00.769: I/ActivityManager(169):   373   33236K   33148K   10688K    8640K  com.wandoujia.phoenix2
11-13 09:32:00.769: I/ActivityManager(169):   356   31828K   31732K    9499K    7680K  com.android.phone
11-13 09:32:00.769: I/ActivityManager(169):   302   30560K   30456K    8242K    6272K  android.process.media
11-13 09:32:00.769: I/ActivityManager(169):   653   28476K   28364K    6276K    4484K  com.qihoo.appstore
11-13 09:32:00.769: I/ActivityManager(169):   687   28344K   28240K    6197K    4400K  com.hyperkani.sliceice
11-13 09:32:00.769: I/ActivityManager(169):   970   27920K   27824K    5549K    3660K  com.gau.go.launcherex.gowidget.switchwidget
11-13 09:32:00.769: I/ActivityManager(169):   109   28392K   28260K    4409K    1896K  zygote
11-13 09:32:00.769: I/ActivityManager(169):   499   25228K   25108K    4002K    2260K  com.bel.android.dspmanager
11-13 09:32:00.769: I/ActivityManager(169):   390   24768K   24648K    3789K    2036K  com.android.smspush
11-13 09:32:00.769: I/ActivityManager(169):   111    5036K    5036K    2513K    2316K  /system/bin/mediaserver
11-13 09:32:00.769: I/ActivityManager(169):  1252    1596K    1592K    1375K    1368K  logcat
11-13 09:32:00.769: I/ActivityManager(169):   110    3200K    3200K    1010K     888K  /system/bin/drmserver
11-13 09:32:00.769: I/ActivityManager(169):   117    2572K    2568K     931K     844K  /system/bin/gpsd
11-13 09:32:00.769: I/ActivityManager(169):  2044     688K     680K     482K     476K  procrank
11-13 09:32:00.769: I/ActivityManager(169):   105    1080K    1076K     476K     440K  /system/bin/netd
11-13 09:32:00.769: I/ActivityManager(169):   301     832K     828K     378K     360K  /system/bin/wpa_supplicant
11-13 09:32:00.769: I/ActivityManager(169):   232     548K     548K     305K     296K  /system/bin/bluetoothd
11-13 09:32:00.769: I/ActivityManager(169):   103     736K     732K     302K     280K  /system/bin/vold
11-13 09:32:00.769: I/ActivityManager(169):   120     448K     440K     246K     240K  /system/bin/sdcard
11-13 09:32:00.769: I/ActivityManager(169):   123     216K     216K     200K     200K  /sbin/adbd
11-13 09:32:00.769: I/ActivityManager(169):  1250     380K     372K     193K     188K  /system/bin/sh
11-13 09:32:00.769: I/ActivityManager(169):   114     552K     544K     178K     164K  /system/bin/keystore
11-13 09:32:00.769: I/ActivityManager(169):     1     236K     236K     172K     132K  /init
11-13 09:32:00.769: I/ActivityManager(169):   112     384K     376K     152K     144K  /system/bin/dbus-daemon
11-13 09:32:00.769: I/ActivityManager(169):   475     396K     392K     152K     144K  /system/bin/dhcpcd
11-13 09:32:00.769: I/ActivityManager(169):    78     180K     180K     140K     100K  /sbin/ueventd
11-13 09:32:00.769: I/ActivityManager(169):   113     344K     336K     122K     116K  /system/bin/installd
11-13 09:32:00.769: I/ActivityManager(169):   115     324K     320K     114K     108K  /system/bin/orientationd
11-13 09:32:00.769: I/ActivityManager(169):   116     324K     320K     110K     104K  /system/bin/geomagneticd
11-13 09:32:00.769: I/ActivityManager(169):   223     316K     308K      98K      92K  /system/bin/brcm_patchram_plus
11-13 09:32:00.769: I/ActivityManager(169):   102     288K     280K      97K      92K  /system/bin/servicemanager
11-13 09:32:00.769: I/ActivityManager(169):   106     268K     260K      81K      76K  /system/bin/debuggerd
11-13 09:32:00.769: I/ActivityManager(169):                           ------   ------  ------
11-13 09:32:00.769: I/ActivityManager(169):                          242443K  202868K  TOTAL
11-13 09:32:00.769: I/ActivityManager(169): RAM: 704112K total, 394256K free, 5748K buffers, 60052K cached, 600K shmem, 11928K slab
11-13 09:32:04.417: D/dalvikvm(2050): Late-enabling CheckJNI
11-13 09:32:04.417: I/ActivityManager(169): Start proc com.bcts.teachsystem for service com.bcts.teachsystem/.service.SessionBackstage: pid=2050 uid=1000 gids={1015, 3003, 3002, 3001}
11-13 09:32:04.441: D/dalvikvm(109): GC_EXPLICIT freed 38K, 74% free 2197K/8323K, paused 1ms+2ms
11-13 09:32:04.464: D/dalvikvm(109): GC_EXPLICIT freed <1K, 74% free 2197K/8323K, paused 1ms+2ms
11-13 09:32:04.488: D/dalvikvm(109): GC_EXPLICIT freed <1K, 74% free 2197K/8323K, paused 1ms+1ms
11-13 09:32:05.050: D/dalvikvm(1720): GC_EXPLICIT freed 462K, 41% free 4958K/8323K, paused 1ms+2ms
11-13 09:32:10.105: D/dalvikvm(169): GC_EXPLICIT freed 1149K, 43% free 5859K/10183K, paused 7ms+6ms
11-13 09:32:14.402: E/com.bcts.teachsystem.service.ChooseClassService(2050): com.bcts.teachsystem.service.ChooseClassService  onStart中的intent报错!
11-13 09:32:15.066: D/dalvikvm(356): GC_EXPLICIT freed 71K, 70% free 2504K/8323K, paused 5ms+2ms
11-13 09:32:20.074: D/dalvikvm(390): GC_EXPLICIT freed 1K, 74% free 2209K/8323K, paused 4ms+2ms

awen_PC的主页 awen_PC | 菜鸟二级 | 园豆:227
提问于:2012-11-13 09:38
< >
分享
最佳答案
0

这好像是当service运行在低内存的环境时,将会kill掉一些存在的进程。因此进程的优先级将会很重要,可以使用startForeground API将service放到前台状态。这样在低内存时被kill的几率更低,但是如果在极度极度低内存的压力下,该service还是会被kill掉。

楼主参考下这里http://blog.csdn.net/mjm0771/article/details/6701023

收获园豆:50
az235 | 大侠五级 |园豆:8483 | 2012-11-13 10:10
其他回答(1)
0

支持一楼...

Hongten | 园豆:1768 (小虾三级) | 2012-11-13 10:35
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册