Loading services/java/com/android/server/wm/WindowManagerService.java +17 −5 Original line number Diff line number Diff line Loading @@ -318,15 +318,25 @@ public class WindowManagerService extends IWindowManager.Stub final BroadcastReceiver mBroadcastReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { final String action = intent.getAction(); if (DevicePolicyManager.ACTION_DEVICE_POLICY_MANAGER_STATE_CHANGED.equals(action)) { mPolicy.enableKeyguard(true); synchronized(mKeyguardTokenWatcher) { // lazily evaluate this next time we're asked to disable keyguard mAllowDisableKeyguard = ALLOW_DISABLE_UNKNOWN; mKeyguardDisabled = false; } } else if (Intent.ACTION_USER_SWITCHED.equals(action)) { final int newUserId = intent.getIntExtra(Intent.EXTRA_USER_HANDLE, 0); Slog.v(TAG, "Switching user from " + mCurrentUserId + " to " + newUserId); mCurrentUserId = newUserId; } } }; // Current user when multi-user is enabled. Don't show windows of non-current user. int mCurrentUserId; final Context mContext; final boolean mHaveInputMethods; Loading Loading @@ -908,6 +918,8 @@ public class WindowManagerService extends IWindowManager.Stub // Track changes to DevicePolicyManager state so we can enable/disable keyguard. IntentFilter filter = new IntentFilter(); filter.addAction(DevicePolicyManager.ACTION_DEVICE_POLICY_MANAGER_STATE_CHANGED); // Track user switching. filter.addAction(Intent.ACTION_USER_SWITCHED); mContext.registerReceiver(mBroadcastReceiver, filter); mHoldingScreenWakeLock = pmc.newWakeLock(PowerManager.SCREEN_BRIGHT_WAKE_LOCK Loading services/java/com/android/server/wm/WindowState.java +23 −0 Original line number Diff line number Diff line Loading @@ -22,6 +22,9 @@ import static android.view.WindowManager.LayoutParams.LAST_SUB_WINDOW; import static android.view.WindowManager.LayoutParams.TYPE_INPUT_METHOD; import static android.view.WindowManager.LayoutParams.TYPE_INPUT_METHOD_DIALOG; import static android.view.WindowManager.LayoutParams.TYPE_WALLPAPER; import static android.view.WindowManager.LayoutParams.TYPE_BASE_APPLICATION; import static android.view.WindowManager.LayoutParams.LAST_APPLICATION_WINDOW; import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_STARTING; import com.android.server.input.InputWindowHandle; Loading @@ -34,6 +37,7 @@ import android.graphics.RectF; import android.graphics.Region; import android.os.IBinder; import android.os.RemoteException; import android.os.UserHandle; import android.util.Slog; import android.view.DisplayInfo; import android.view.Gravity; Loading Loading @@ -257,6 +261,9 @@ final class WindowState implements WindowManagerPolicy.WindowState { DisplayContent mDisplayContent; // UserId of the owner. Don't display windows of non-current user. final int mOwnerUserId; WindowState(WindowManagerService service, Session s, IWindow c, WindowToken token, WindowState attachedWindow, int seq, WindowManager.LayoutParams a, int viewVisibility, final DisplayContent displayContent) { Loading @@ -264,6 +271,7 @@ final class WindowState implements WindowManagerPolicy.WindowState { mSession = s; mClient = c; mToken = token; mOwnerUserId = UserHandle.getUserId(s.mUid); mAttrs.copyFrom(a); mViewVisibility = viewVisibility; mDisplayContent = displayContent; Loading Loading @@ -894,6 +902,11 @@ final class WindowState implements WindowManagerPolicy.WindowState { } boolean showLw(boolean doAnimation, boolean requestAnim) { if (isOtherUsersAppWindow()) { Slog.w(TAG, "Current user " + mService.mCurrentUserId + " trying to display " + this + ", type " + mAttrs.type + ", belonging to " + mOwnerUserId); return false; } if (mPolicyVisibility && mPolicyVisibilityAfterAnim) { // Already showing. return false; Loading Loading @@ -970,6 +983,16 @@ final class WindowState implements WindowManagerPolicy.WindowState { return mClient.asBinder().isBinderAlive(); } boolean isOtherUsersAppWindow() { final int type = mAttrs.type; if ((mOwnerUserId != mService.mCurrentUserId) && (type >= TYPE_BASE_APPLICATION) && (type <= LAST_APPLICATION_WINDOW) && (type != TYPE_APPLICATION_STARTING)) { return true; } return false; } private static void applyInsets(Region outRegion, Rect frame, Rect inset) { outRegion.set( frame.left + inset.left, frame.top + inset.top, Loading services/java/com/android/server/wm/WindowStateAnimator.java +5 −0 Original line number Diff line number Diff line Loading @@ -1290,6 +1290,11 @@ class WindowStateAnimator { // This must be called while inside a transaction. boolean performShowLocked() { if (mWin.isOtherUsersAppWindow()) { Slog.w(TAG, "Current user " + mService.mCurrentUserId + " trying to display " + this + ", type " + mWin.mAttrs.type + ", belonging to " + mWin.mOwnerUserId); return false; } if (DEBUG_VISIBILITY || (DEBUG_STARTING_WINDOW && mWin.mAttrs.type == WindowManager.LayoutParams.TYPE_APPLICATION_STARTING)) { RuntimeException e = null; Loading Loading
services/java/com/android/server/wm/WindowManagerService.java +17 −5 Original line number Diff line number Diff line Loading @@ -318,15 +318,25 @@ public class WindowManagerService extends IWindowManager.Stub final BroadcastReceiver mBroadcastReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { final String action = intent.getAction(); if (DevicePolicyManager.ACTION_DEVICE_POLICY_MANAGER_STATE_CHANGED.equals(action)) { mPolicy.enableKeyguard(true); synchronized(mKeyguardTokenWatcher) { // lazily evaluate this next time we're asked to disable keyguard mAllowDisableKeyguard = ALLOW_DISABLE_UNKNOWN; mKeyguardDisabled = false; } } else if (Intent.ACTION_USER_SWITCHED.equals(action)) { final int newUserId = intent.getIntExtra(Intent.EXTRA_USER_HANDLE, 0); Slog.v(TAG, "Switching user from " + mCurrentUserId + " to " + newUserId); mCurrentUserId = newUserId; } } }; // Current user when multi-user is enabled. Don't show windows of non-current user. int mCurrentUserId; final Context mContext; final boolean mHaveInputMethods; Loading Loading @@ -908,6 +918,8 @@ public class WindowManagerService extends IWindowManager.Stub // Track changes to DevicePolicyManager state so we can enable/disable keyguard. IntentFilter filter = new IntentFilter(); filter.addAction(DevicePolicyManager.ACTION_DEVICE_POLICY_MANAGER_STATE_CHANGED); // Track user switching. filter.addAction(Intent.ACTION_USER_SWITCHED); mContext.registerReceiver(mBroadcastReceiver, filter); mHoldingScreenWakeLock = pmc.newWakeLock(PowerManager.SCREEN_BRIGHT_WAKE_LOCK Loading
services/java/com/android/server/wm/WindowState.java +23 −0 Original line number Diff line number Diff line Loading @@ -22,6 +22,9 @@ import static android.view.WindowManager.LayoutParams.LAST_SUB_WINDOW; import static android.view.WindowManager.LayoutParams.TYPE_INPUT_METHOD; import static android.view.WindowManager.LayoutParams.TYPE_INPUT_METHOD_DIALOG; import static android.view.WindowManager.LayoutParams.TYPE_WALLPAPER; import static android.view.WindowManager.LayoutParams.TYPE_BASE_APPLICATION; import static android.view.WindowManager.LayoutParams.LAST_APPLICATION_WINDOW; import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_STARTING; import com.android.server.input.InputWindowHandle; Loading @@ -34,6 +37,7 @@ import android.graphics.RectF; import android.graphics.Region; import android.os.IBinder; import android.os.RemoteException; import android.os.UserHandle; import android.util.Slog; import android.view.DisplayInfo; import android.view.Gravity; Loading Loading @@ -257,6 +261,9 @@ final class WindowState implements WindowManagerPolicy.WindowState { DisplayContent mDisplayContent; // UserId of the owner. Don't display windows of non-current user. final int mOwnerUserId; WindowState(WindowManagerService service, Session s, IWindow c, WindowToken token, WindowState attachedWindow, int seq, WindowManager.LayoutParams a, int viewVisibility, final DisplayContent displayContent) { Loading @@ -264,6 +271,7 @@ final class WindowState implements WindowManagerPolicy.WindowState { mSession = s; mClient = c; mToken = token; mOwnerUserId = UserHandle.getUserId(s.mUid); mAttrs.copyFrom(a); mViewVisibility = viewVisibility; mDisplayContent = displayContent; Loading Loading @@ -894,6 +902,11 @@ final class WindowState implements WindowManagerPolicy.WindowState { } boolean showLw(boolean doAnimation, boolean requestAnim) { if (isOtherUsersAppWindow()) { Slog.w(TAG, "Current user " + mService.mCurrentUserId + " trying to display " + this + ", type " + mAttrs.type + ", belonging to " + mOwnerUserId); return false; } if (mPolicyVisibility && mPolicyVisibilityAfterAnim) { // Already showing. return false; Loading Loading @@ -970,6 +983,16 @@ final class WindowState implements WindowManagerPolicy.WindowState { return mClient.asBinder().isBinderAlive(); } boolean isOtherUsersAppWindow() { final int type = mAttrs.type; if ((mOwnerUserId != mService.mCurrentUserId) && (type >= TYPE_BASE_APPLICATION) && (type <= LAST_APPLICATION_WINDOW) && (type != TYPE_APPLICATION_STARTING)) { return true; } return false; } private static void applyInsets(Region outRegion, Rect frame, Rect inset) { outRegion.set( frame.left + inset.left, frame.top + inset.top, Loading
services/java/com/android/server/wm/WindowStateAnimator.java +5 −0 Original line number Diff line number Diff line Loading @@ -1290,6 +1290,11 @@ class WindowStateAnimator { // This must be called while inside a transaction. boolean performShowLocked() { if (mWin.isOtherUsersAppWindow()) { Slog.w(TAG, "Current user " + mService.mCurrentUserId + " trying to display " + this + ", type " + mWin.mAttrs.type + ", belonging to " + mWin.mOwnerUserId); return false; } if (DEBUG_VISIBILITY || (DEBUG_STARTING_WINDOW && mWin.mAttrs.type == WindowManager.LayoutParams.TYPE_APPLICATION_STARTING)) { RuntimeException e = null; Loading