From f4824a06884e096beef921646cba4be29d7f36fc Mon Sep 17 00:00:00 2001 From: Kenny Guy Date: Wed, 2 Apr 2014 19:17:41 +0100 Subject: [PATCH] Fix issue with not allowing activities for current user. Change-Id: Ic2e30c3f4990a03aac9801ee9bf5f270a5e90ef8 --- core/java/com/android/internal/inputmethod/InputMethodUtils.java | 1 + services/core/java/com/android/server/am/ActivityManagerService.java | 2 +- services/core/java/com/android/server/am/ActivityStack.java | 1 + services/core/java/com/android/server/wm/WindowManagerService.java | 4 +++- 4 files changed, 6 insertions(+), 2 deletions(-) diff --git a/core/java/com/android/internal/inputmethod/InputMethodUtils.java b/core/java/com/android/internal/inputmethod/InputMethodUtils.java index f9e5569ba735..ac3274d7aa68 100644 --- a/core/java/com/android/internal/inputmethod/InputMethodUtils.java +++ b/core/java/com/android/internal/inputmethod/InputMethodUtils.java @@ -545,6 +545,7 @@ public class InputMethodUtils { public boolean isCurrentProfile(int userId) { synchronized (this) { + if (userId == mCurrentUserId) return true; for (int i = 0; i < mCurrentProfileIds.length; i++) { if (userId == mCurrentProfileIds[i]) return true; } diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java index ac6f684ef1ef..afb389e589de 100644 --- a/services/core/java/com/android/server/am/ActivityManagerService.java +++ b/services/core/java/com/android/server/am/ActivityManagerService.java @@ -1019,7 +1019,7 @@ public final class ActivityManagerService extends ActivityManagerNative final ActivityThread mSystemThread; int mCurrentUserId = 0; - int[] mCurrentProfileIds = new int[0]; // Accessed by ActivityStack + int[] mCurrentProfileIds = new int[] {UserHandle.USER_OWNER}; // Accessed by ActivityStack private UserManagerService mUserManager; private final class AppDeathRecipient implements IBinder.DeathRecipient { diff --git a/services/core/java/com/android/server/am/ActivityStack.java b/services/core/java/com/android/server/am/ActivityStack.java index d949ba0d90e3..b89472419020 100755 --- a/services/core/java/com/android/server/am/ActivityStack.java +++ b/services/core/java/com/android/server/am/ActivityStack.java @@ -344,6 +344,7 @@ final class ActivityStack { * Checks whether the userid is a profile of the current user. */ private boolean isCurrentProfileLocked(int userId) { + if (userId == mCurrentUser) return true; for (int i = 0; i < mService.mCurrentProfileIds.length; i++) { if (mService.mCurrentProfileIds[i] == userId) return true; } diff --git a/services/core/java/com/android/server/wm/WindowManagerService.java b/services/core/java/com/android/server/wm/WindowManagerService.java index 2e5b8ded9e35..b12ae4f2409e 100644 --- a/services/core/java/com/android/server/wm/WindowManagerService.java +++ b/services/core/java/com/android/server/wm/WindowManagerService.java @@ -86,6 +86,7 @@ import android.os.StrictMode; import android.os.SystemClock; import android.os.SystemProperties; import android.os.Trace; +import android.os.UserHandle; import android.os.WorkSource; import android.provider.Settings; import android.util.DisplayMetrics; @@ -311,7 +312,7 @@ public class WindowManagerService extends IWindowManager.Stub * Users that are profiles of the current user. These are also allowed to show windows * on the current user. */ - int[] mCurrentProfileIds = new int[0]; + int[] mCurrentProfileIds = new int[] {UserHandle.USER_OWNER}; final Context mContext; @@ -5255,6 +5256,7 @@ public class WindowManagerService extends IWindowManager.Stub /* Called by WindowState */ boolean isCurrentProfileLocked(int userId) { + if (userId == mCurrentUserId) return true; for (int i = 0; i < mCurrentProfileIds.length; i++) { if (mCurrentProfileIds[i] == userId) return true; } -- 2.11.0