Fix issue #1737531: Don't allow applications to prevent the user from leaving them
diff --git a/policy/com/android/internal/policy/impl/PhoneWindowManager.java b/policy/com/android/internal/policy/impl/PhoneWindowManager.java
index bb41538..8964c6d4 100644
--- a/policy/com/android/internal/policy/impl/PhoneWindowManager.java
+++ b/policy/com/android/internal/policy/impl/PhoneWindowManager.java
@@ -954,6 +954,10 @@
             mKeyguardMediator.verifyUnlock(new OnKeyguardExitResult() {
                 public void onKeyguardExitResult(boolean success) {
                     if (success) {
+                        try {
+                            ActivityManagerNative.getDefault().stopAppSwitches();
+                        } catch (RemoteException e) {
+                        }
                         mContext.startActivity(mHomeIntent);
                         sendCloseSystemWindows();
                     }
@@ -961,6 +965,10 @@
             });
         } else {
             // no keyguard stuff to worry about, just launch home!
+            try {
+                ActivityManagerNative.getDefault().stopAppSwitches();
+            } catch (RemoteException e) {
+            }
             mContext.startActivity(mHomeIntent);
             sendCloseSystemWindows();
         }
@@ -1801,11 +1809,16 @@
     boolean goHome() {
         if (false) {
             // This code always brings home to the front.
+            try {
+                ActivityManagerNative.getDefault().stopAppSwitches();
+            } catch (RemoteException e) {
+            }
             mContext.startActivity(mHomeIntent);
         } else {
             // This code brings home to the front or, if it is already
             // at the front, puts the device to sleep.
             try {
+                ActivityManagerNative.getDefault().stopAppSwitches();
                 int result = ActivityManagerNative.getDefault()
                         .startActivity(null, mHomeIntent,
                                 mHomeIntent.resolveTypeIfNeeded(mContext.getContentResolver()),