Loading core/java/android/view/WindowManagerPolicy.java +9 −1 Original line number Diff line number Diff line Loading @@ -1111,7 +1111,15 @@ public interface WindowManagerPolicy { * @param attrs The window's LayoutParams. * @return Whether magnification can be applied. */ public boolean canMagnifyWindow(WindowManager.LayoutParams attrs); public boolean canMagnifyWindowLw(WindowManager.LayoutParams attrs); /** * Called when the current user changes. Guaranteed to be called before the broadcast * of the new user id is made to all listeners. * * @param newUserId The id of the incoming user. */ public void setCurrentUserLw(int newUserId); /** * Print the WindowManagerPolicy's state into the given stream. Loading core/java/com/android/internal/widget/LockPatternUtils.java +6 −11 Original line number Diff line number Diff line Loading @@ -22,14 +22,11 @@ import com.google.android.collect.Lists; import android.app.ActivityManagerNative; import android.app.admin.DevicePolicyManager; import android.content.BroadcastReceiver; import android.content.ContentResolver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.content.pm.PackageManager; import android.os.Binder; import android.os.FileObserver; import android.os.IBinder; import android.os.Process; import android.os.RemoteException; Loading @@ -45,16 +42,10 @@ import android.util.Log; import android.view.View; import android.widget.Button; import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; import java.io.RandomAccessFile; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.security.SecureRandom; import java.util.Arrays; import java.util.List; import java.util.concurrent.atomic.AtomicBoolean; /** * Utilities for the lock pattern and its settings. Loading Loading @@ -134,7 +125,7 @@ public class LockPatternUtils { private final ContentResolver mContentResolver; private DevicePolicyManager mDevicePolicyManager; private ILockSettings mLockSettingsService; private int mCurrentUserId = 0; private int mCurrentUserId = UserHandle.USER_NULL; public DevicePolicyManager getDevicePolicyManager() { if (mDevicePolicyManager == null) { Loading Loading @@ -233,10 +224,14 @@ public class LockPatternUtils { public int getCurrentUser() { if (Process.myUid() == Process.SYSTEM_UID) { if (mCurrentUserId != UserHandle.USER_NULL) { // Someone is regularly updating using setCurrentUser() use that value. return mCurrentUserId; } try { return ActivityManagerNative.getDefault().getCurrentUser().id; } catch (RemoteException re) { return mCurrentUserId; return UserHandle.USER_OWNER; } } else { throw new SecurityException("Only the system process can get the current user"); Loading policy/src/com/android/internal/policy/impl/PhoneWindowManager.java +11 −2 Original line number Diff line number Diff line Loading @@ -71,7 +71,6 @@ import android.util.EventLog; import android.util.Log; import android.util.Slog; import android.util.SparseArray; import android.util.SparseIntArray; import android.view.Display; import android.view.Gravity; import android.view.HapticFeedbackConstants; Loading Loading @@ -722,6 +721,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { } private final Runnable mPowerLongPress = new Runnable() { @Override public void run() { // The context isn't read if (mLongPressOnPowerBehavior < 0) { Loading Loading @@ -4316,7 +4316,8 @@ public class PhoneWindowManager implements WindowManagerPolicy { mLastInputMethodTargetWindow = target; } public boolean canMagnifyWindow(WindowManager.LayoutParams attrs) { @Override public boolean canMagnifyWindowLw(WindowManager.LayoutParams attrs) { switch (attrs.type) { case WindowManager.LayoutParams.TYPE_INPUT_METHOD: case WindowManager.LayoutParams.TYPE_INPUT_METHOD_DIALOG: Loading @@ -4328,6 +4329,14 @@ public class PhoneWindowManager implements WindowManagerPolicy { return true; } @Override public void setCurrentUserLw(int newUserId) { if (mKeyguardMediator != null) { mKeyguardMediator.setCurrentUser(newUserId); } } @Override public void dump(String prefix, PrintWriter pw, String[] args) { pw.print(prefix); pw.print("mSafeMode="); pw.print(mSafeMode); pw.print(" mSystemReady="); pw.print(mSystemReady); Loading policy/src/com/android/internal/policy/impl/keyguard/KeyguardViewMediator.java +11 −2 Original line number Diff line number Diff line Loading @@ -131,7 +131,7 @@ public class KeyguardViewMediator { private static final int KEYGUARD_LOCK_AFTER_DELAY_DEFAULT = 5000; /** * How long we'll wait for the {@link KeyguardViewCallback#keyguardDoneDrawing()} * How long we'll wait for the {@link ViewMediatorCallback#keyguardDoneDrawing()} * callback before unblocking a call to {@link #setKeyguardEnabled(boolean)} * that is reenabling the keyguard. */ Loading Loading @@ -297,7 +297,7 @@ public class KeyguardViewMediator { @Override public void onUserSwitched(int userId) { mLockPatternUtils.setCurrentUser(userId); // Note that the mLockPatternUtils user has already been updated from setCurrentUser. synchronized (KeyguardViewMediator.this) { resetStateLocked(); } Loading Loading @@ -465,6 +465,7 @@ public class KeyguardViewMediator { mLockPatternUtils = lockPatternUtils != null ? lockPatternUtils : new LockPatternUtils(mContext); mLockPatternUtils.setCurrentUser(UserHandle.USER_OWNER); WindowManager wm = (WindowManager)context.getSystemService(Context.WINDOW_SERVICE); Loading Loading @@ -890,6 +891,14 @@ public class KeyguardViewMediator { || KeyguardUpdateMonitor.getInstance(mContext).isSimPinSecure(); } /** * Update the newUserId. Call while holding WindowManagerService lock. * @param newUserId The id of the incoming user. */ public void setCurrentUser(int newUserId) { mLockPatternUtils.setCurrentUser(newUserId); } private final BroadcastReceiver mBroadcastReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { Loading services/java/com/android/server/am/ActivityManagerService.java +3 −1 Original line number Diff line number Diff line Loading @@ -13982,6 +13982,8 @@ public final class ActivityManagerService extends ActivityManagerNative mUserLru.remove(userIdInt); mUserLru.add(userIdInt); mWindowManager.setCurrentUser(userId); final UserStartedState uss = mStartedUsers.get(userId); mHandler.removeMessages(REPORT_USER_SWITCH_MSG); Loading
core/java/android/view/WindowManagerPolicy.java +9 −1 Original line number Diff line number Diff line Loading @@ -1111,7 +1111,15 @@ public interface WindowManagerPolicy { * @param attrs The window's LayoutParams. * @return Whether magnification can be applied. */ public boolean canMagnifyWindow(WindowManager.LayoutParams attrs); public boolean canMagnifyWindowLw(WindowManager.LayoutParams attrs); /** * Called when the current user changes. Guaranteed to be called before the broadcast * of the new user id is made to all listeners. * * @param newUserId The id of the incoming user. */ public void setCurrentUserLw(int newUserId); /** * Print the WindowManagerPolicy's state into the given stream. Loading
core/java/com/android/internal/widget/LockPatternUtils.java +6 −11 Original line number Diff line number Diff line Loading @@ -22,14 +22,11 @@ import com.google.android.collect.Lists; import android.app.ActivityManagerNative; import android.app.admin.DevicePolicyManager; import android.content.BroadcastReceiver; import android.content.ContentResolver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.content.pm.PackageManager; import android.os.Binder; import android.os.FileObserver; import android.os.IBinder; import android.os.Process; import android.os.RemoteException; Loading @@ -45,16 +42,10 @@ import android.util.Log; import android.view.View; import android.widget.Button; import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; import java.io.RandomAccessFile; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.security.SecureRandom; import java.util.Arrays; import java.util.List; import java.util.concurrent.atomic.AtomicBoolean; /** * Utilities for the lock pattern and its settings. Loading Loading @@ -134,7 +125,7 @@ public class LockPatternUtils { private final ContentResolver mContentResolver; private DevicePolicyManager mDevicePolicyManager; private ILockSettings mLockSettingsService; private int mCurrentUserId = 0; private int mCurrentUserId = UserHandle.USER_NULL; public DevicePolicyManager getDevicePolicyManager() { if (mDevicePolicyManager == null) { Loading Loading @@ -233,10 +224,14 @@ public class LockPatternUtils { public int getCurrentUser() { if (Process.myUid() == Process.SYSTEM_UID) { if (mCurrentUserId != UserHandle.USER_NULL) { // Someone is regularly updating using setCurrentUser() use that value. return mCurrentUserId; } try { return ActivityManagerNative.getDefault().getCurrentUser().id; } catch (RemoteException re) { return mCurrentUserId; return UserHandle.USER_OWNER; } } else { throw new SecurityException("Only the system process can get the current user"); Loading
policy/src/com/android/internal/policy/impl/PhoneWindowManager.java +11 −2 Original line number Diff line number Diff line Loading @@ -71,7 +71,6 @@ import android.util.EventLog; import android.util.Log; import android.util.Slog; import android.util.SparseArray; import android.util.SparseIntArray; import android.view.Display; import android.view.Gravity; import android.view.HapticFeedbackConstants; Loading Loading @@ -722,6 +721,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { } private final Runnable mPowerLongPress = new Runnable() { @Override public void run() { // The context isn't read if (mLongPressOnPowerBehavior < 0) { Loading Loading @@ -4316,7 +4316,8 @@ public class PhoneWindowManager implements WindowManagerPolicy { mLastInputMethodTargetWindow = target; } public boolean canMagnifyWindow(WindowManager.LayoutParams attrs) { @Override public boolean canMagnifyWindowLw(WindowManager.LayoutParams attrs) { switch (attrs.type) { case WindowManager.LayoutParams.TYPE_INPUT_METHOD: case WindowManager.LayoutParams.TYPE_INPUT_METHOD_DIALOG: Loading @@ -4328,6 +4329,14 @@ public class PhoneWindowManager implements WindowManagerPolicy { return true; } @Override public void setCurrentUserLw(int newUserId) { if (mKeyguardMediator != null) { mKeyguardMediator.setCurrentUser(newUserId); } } @Override public void dump(String prefix, PrintWriter pw, String[] args) { pw.print(prefix); pw.print("mSafeMode="); pw.print(mSafeMode); pw.print(" mSystemReady="); pw.print(mSystemReady); Loading
policy/src/com/android/internal/policy/impl/keyguard/KeyguardViewMediator.java +11 −2 Original line number Diff line number Diff line Loading @@ -131,7 +131,7 @@ public class KeyguardViewMediator { private static final int KEYGUARD_LOCK_AFTER_DELAY_DEFAULT = 5000; /** * How long we'll wait for the {@link KeyguardViewCallback#keyguardDoneDrawing()} * How long we'll wait for the {@link ViewMediatorCallback#keyguardDoneDrawing()} * callback before unblocking a call to {@link #setKeyguardEnabled(boolean)} * that is reenabling the keyguard. */ Loading Loading @@ -297,7 +297,7 @@ public class KeyguardViewMediator { @Override public void onUserSwitched(int userId) { mLockPatternUtils.setCurrentUser(userId); // Note that the mLockPatternUtils user has already been updated from setCurrentUser. synchronized (KeyguardViewMediator.this) { resetStateLocked(); } Loading Loading @@ -465,6 +465,7 @@ public class KeyguardViewMediator { mLockPatternUtils = lockPatternUtils != null ? lockPatternUtils : new LockPatternUtils(mContext); mLockPatternUtils.setCurrentUser(UserHandle.USER_OWNER); WindowManager wm = (WindowManager)context.getSystemService(Context.WINDOW_SERVICE); Loading Loading @@ -890,6 +891,14 @@ public class KeyguardViewMediator { || KeyguardUpdateMonitor.getInstance(mContext).isSimPinSecure(); } /** * Update the newUserId. Call while holding WindowManagerService lock. * @param newUserId The id of the incoming user. */ public void setCurrentUser(int newUserId) { mLockPatternUtils.setCurrentUser(newUserId); } private final BroadcastReceiver mBroadcastReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { Loading
services/java/com/android/server/am/ActivityManagerService.java +3 −1 Original line number Diff line number Diff line Loading @@ -13982,6 +13982,8 @@ public final class ActivityManagerService extends ActivityManagerNative mUserLru.remove(userIdInt); mUserLru.add(userIdInt); mWindowManager.setCurrentUser(userId); final UserStartedState uss = mStartedUsers.get(userId); mHandler.removeMessages(REPORT_USER_SWITCH_MSG);