Android-L问题:onBackpressed使用FLAG_ACTIVITY_REORDER_TO_FRONT启动之前的活动&冻结应用程序一段时间

时间:2015-04-22 17:09:51

标签: android

我的应用程序有一种奇怪的行为

我通过Android L O.S.上的步骤证明了这个问题。 Nexus 7或Moto G等设备。

  1. 应用程序以活动A开始,活动A只显示一个名为"启动B"的按钮。
  2. 按此按钮 - 执行 startActivity(FLAG_ACTIVITY_REORDER_TO_FRONT,ActivityB.class)
  3. 活动B变为活动状态,在UI线程上执行一些UI和反手加载操作。
  4. 从活动B,OnBackPressed活动B按回来后,执行startActivity(FLAG_ACTIVITY_REORDER_TO_FRONT,ActivityA.class)。
  5. 活动A onResume()按预期调用,一切看起来都很好(我再次看到活动A内容)。
  6. 按设备的返回键,应用程序冻结约10秒钟或更长时间,然后退出应用程序。不调用onPause(),onDestroy()。 (所以它可能是某些日志)
  7. 有时候或者可能会重复相同的上述步骤4-5次也不幸强行关闭googlequicksearchbox
  8. 查看系统日志后: 发现了一些重要的日志:

    E/ActivityManager(  958): Reason: Input dispatching timed out (Waiting because no window has focus but there is a focused application that may eventually add a window when it finishes starting up.)
    

    重要日志:看看

    D/SFPerfTracer(  278):        layers: (2:12) (FocusedStackFrame (0xb8fa6b48): 0:637)* (DimLayer (0xb8fa95c0): 0:14)* (DimLayer (0xb8fe63b0): 0:510)* (DimLayer (0xb8fb7228): 0:213)* (StatusBar (0xb8fd10c0): 0:5421)* (com.android.systemui.ImageWallpaper (0xb8fd6a28): 0:454)* (NavigationBar (0xb8fbaa18): 8:744) (com.android.systemui/com.android.systemui.recents.RecentsActivity (0xb8fbbca8): 0:86)- (com.abc.myapp/com.mypackage.abc.MainActivity (0xb8fd3560): 0:25)- (thumbnail anim (0xb8ff72b0): 0:12)- (com.abc.myapp/com.mypackage.abc_etv.EtvLaunchActivity (0xb8ffb570): 14:34) 
    
    I/LaunchCheckinHandler(  958): Displayed com.abc.myapp/com.mypackage.abc.MainActivity,wp,wa,286
    
    I/WindowManager(  958): Input event dispatching timed out sending to application AppWindowToken{23d5f06c token=Token{299ea51f ActivityRecord{2f0940be u0 com.google.android.googlequicksearchbox/com.google.android.launcher.GEL t4}}}.  Reason: Waiting because no window has focus but there is a focused application that may eventually add a window when it finishes starting up.
    
    I/WindowManager(  958): Input event dispatching timed out sending to application AppWindowToken{23d5f06c token=Token{299ea51f ActivityRecord{2f0940be u0 com.google.android.googlequicksearchbox/com.google.android.launcher.GEL t4}}}.  Reason: Waiting because no window has focus but there is a focused application that may eventually add a window when it finishes starting up.
    
    E/ActivityManager(  958): ANR in com.google.android.googlequicksearchbox (com.google.android.googlequicksearchbox/com.google.android.launcher.GEL)
    
    E/ActivityManager(  958): PID: 655
    
    E/ActivityManager(  958): Reason: Input dispatching timed out (Waiting because no window has focus but there is a focused application that may eventually add a window when it finishes starting up.)
    

0 个答案:

没有答案