From b36ed85c4025ca26edf0e776d2603e7e61c618ca Mon Sep 17 00:00:00 2001 From: Colin Cross Date: Thu, 29 Nov 2012 11:42:11 -0800 Subject: [PATCH 1/3] trigger kernel blocked stack trace on system server watchdog Bug b/7638530 may be caused by a kernel deadlock when killing processes under low memory conditions. Write to /proc/sysrq-trigger to get a kernel log of blocked tasks before killing the system server. Bug: 7638530 Change-Id: I60df324ad4affdadbf13650099dc4dfb38722420 --- services/java/com/android/server/Watchdog.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/services/java/com/android/server/Watchdog.java b/services/java/com/android/server/Watchdog.java index 8bbf923adaead..b2a8ad834dc45 100644 --- a/services/java/com/android/server/Watchdog.java +++ b/services/java/com/android/server/Watchdog.java @@ -39,6 +39,8 @@ import android.util.Log; import android.util.Slog; import java.io.File; +import java.io.FileWriter; +import java.io.IOException; import java.util.ArrayList; import java.util.Calendar; @@ -439,6 +441,16 @@ public class Watchdog extends Thread { dumpKernelStackTraces(); } + // Trigger the kernel to dump all blocked threads to the kernel log + try { + FileWriter sysrq_trigger = new FileWriter("/proc/sysrq-trigger"); + sysrq_trigger.write("w"); + sysrq_trigger.close(); + } catch (IOException e) { + Slog.e(TAG, "Failed to write to /proc/sysrq-trigger"); + Slog.e(TAG, e.getMessage()); + } + // Try to add the error to the dropbox, but assuming that the ActivityManager // itself may be deadlocked. (which has happened, causing this statement to // deadlock and the watchdog as a whole to be ineffective) From 77f35417310b967723877fc6915fc5e54189fe22 Mon Sep 17 00:00:00 2001 From: Jim Miller Date: Fri, 30 Nov 2012 15:42:18 -0800 Subject: [PATCH 2/3] Add logging to try and track down bug 7643792 Fix whitespace & log message. Change-Id: I9d241365503a6a9b02d3155dbb06ddb82065b375 --- .../internal/policy/impl/keyguard/KeyguardViewManager.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardViewManager.java b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardViewManager.java index 9bc0111ea9850..efd09e0d0ade6 100644 --- a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardViewManager.java +++ b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardViewManager.java @@ -24,6 +24,7 @@ import android.content.pm.ActivityInfo; import android.content.res.Configuration; import android.content.res.Resources; import android.graphics.PixelFormat; +import android.graphics.Rect; import android.os.Bundle; import android.os.IBinder; import android.os.Parcelable; @@ -126,6 +127,12 @@ public class KeyguardViewManager { setFitsSystemWindows(true); } + @Override + protected boolean fitSystemWindows(Rect insets) { + Log.v("TAG", "bug 7643792: fitSystemWindows(" + insets.toShortString() + ")"); + return super.fitSystemWindows(insets); + } + @Override protected void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); From bd0fd29f8395a87b6a9efdc9ac8d49b101ee824d Mon Sep 17 00:00:00 2001 From: Adam Powell Date: Tue, 5 Feb 2013 16:13:57 -0800 Subject: [PATCH 3/3] Fix re-enabled state of up after action view collapse A certain call ordering to the action bar could cause the record of the pre-action view expanded home button enabled state to be incorrect. Store this in all cases, not just when the action view is initially expanded. (Except for when we actually disable it for the expanded view.) If an action view is already expanded when we get a call to change the enabled state of the home/up button, don't modify the state of the up container or other accessibility info, but record the new state if requested. Bug 8142097 Change-Id: I070c151aa9f2046d2114ee541d964bf68c6f0def --- .../android/internal/widget/ActionBarView.java | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/core/java/com/android/internal/widget/ActionBarView.java b/core/java/com/android/internal/widget/ActionBarView.java index d11b3b35074be..0f964b9a28054 100644 --- a/core/java/com/android/internal/widget/ActionBarView.java +++ b/core/java/com/android/internal/widget/ActionBarView.java @@ -559,6 +559,21 @@ public class ActionBarView extends AbsActionBarView { } public void setHomeButtonEnabled(boolean enable) { + setHomeButtonEnabled(enable, true); + } + + private void setHomeButtonEnabled(boolean enable, boolean recordState) { + if (recordState) { + mWasHomeEnabled = enable; + } + + if (mExpandedActionView != null) { + // There's an action view currently showing and we want to keep the state + // configured for the action view at the moment. If we needed to record the + // new state for later we will have done so above. + return; + } + mUpGoerFive.setEnabled(enable); mUpGoerFive.setFocusable(enable); // Make sure the home button has an accurate content description for accessibility. @@ -1539,8 +1554,7 @@ public class ActionBarView extends AbsActionBarView { if (mTabScrollView != null) mTabScrollView.setVisibility(GONE); if (mSpinner != null) mSpinner.setVisibility(GONE); if (mCustomNavView != null) mCustomNavView.setVisibility(GONE); - mWasHomeEnabled = mUpGoerFive.isEnabled(); - setHomeButtonEnabled(false); + setHomeButtonEnabled(false, false); requestLayout(); item.setActionViewExpanded(true);