Loading core/java/android/content/Intent.java +1 −2 Original line number Original line Diff line number Diff line Loading @@ -2566,8 +2566,7 @@ public class Intent implements Parcelable, Cloneable { /** /** * Broadcast sent to the system when a user's information changes. Carries an extra * Broadcast sent to the system when a user's information changes. Carries an extra * {@link #EXTRA_USER_HANDLE} to indicate which user's information changed. * {@link #EXTRA_USER_HANDLE} to indicate which user's information changed. * This is only sent to registered receivers, not manifest receivers. It is sent to the user * This is only sent to registered receivers, not manifest receivers. It is sent to all users. * whose information has changed. * @hide * @hide */ */ public static final String ACTION_USER_INFO_CHANGED = public static final String ACTION_USER_INFO_CHANGED = Loading packages/Keyguard/src/com/android/keyguard/KeyguardCircleFramedDrawable.java +15 −0 Original line number Original line Diff line number Diff line Loading @@ -100,6 +100,11 @@ class KeyguardCircleFramedDrawable extends Drawable { mFramePath = new Path(); mFramePath = new Path(); } } public void reset() { mScale = 1f; mPressed = false; } @Override @Override public void draw(Canvas canvas) { public void draw(Canvas canvas) { // clear background // clear background Loading Loading @@ -157,4 +162,14 @@ class KeyguardCircleFramedDrawable extends Drawable { @Override @Override public void setColorFilter(ColorFilter cf) { public void setColorFilter(ColorFilter cf) { } } public boolean verifyParams(float iconSize, int frameColor, float stroke, int frameShadowColor, float shadowRadius, int highlightColor) { return mSize == iconSize && mFrameColor == frameColor && mStrokeWidth == stroke && mFrameShadowColor == frameShadowColor && mShadowRadius == shadowRadius && mHighlightColor == highlightColor; } } } packages/Keyguard/src/com/android/keyguard/KeyguardMultiUserAvatar.java +26 −2 Original line number Original line Diff line number Diff line Loading @@ -130,8 +130,32 @@ class KeyguardMultiUserAvatar extends FrameLayout { R.drawable.ic_contact_picture); R.drawable.ic_contact_picture); } } mFramed = (KeyguardCircleFramedDrawable) KeyguardViewMediator.getAvatarCache().get(user.id); // If we can't find it or the params don't match, create the drawable again if (mFramed == null || !mFramed.verifyParams(mIconSize, mFrameColor, mStroke, mFrameShadowColor, mShadowRadius, mHighlightColor)) { Bitmap icon = null; try { icon = BitmapFactory.decodeFile(rewriteIconPath(user.iconPath)); } catch (Exception e) { if (DEBUG) Log.d(TAG, "failed to open profile icon " + user.iconPath, e); } if (icon == null) { icon = BitmapFactory.decodeResource(mContext.getResources(), com.android.internal.R.drawable.ic_contact_picture); } mFramed = new KeyguardCircleFramedDrawable(icon, (int) mIconSize, mFrameColor, mStroke, mFramed = new KeyguardCircleFramedDrawable(icon, (int) mIconSize, mFrameColor, mStroke, mFrameShadowColor, mShadowRadius, mHighlightColor); mFrameShadowColor, mShadowRadius, mHighlightColor); KeyguardViewMediator.getAvatarCache().put(user.id, mFramed); } mFramed.reset(); mUserImage.setImageDrawable(mFramed); mUserImage.setImageDrawable(mFramed); mUserName.setText(mUserInfo.name); mUserName.setText(mUserInfo.name); setOnClickListener(mUserSelector); setOnClickListener(mUserSelector); Loading packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitor.java +28 −1 Original line number Original line Diff line number Diff line Loading @@ -89,6 +89,7 @@ public class KeyguardUpdateMonitor { private static final int MSG_USER_SWITCH_COMPLETE = 314; private static final int MSG_USER_SWITCH_COMPLETE = 314; private static final int MSG_SET_CURRENT_CLIENT_ID = 315; private static final int MSG_SET_CURRENT_CLIENT_ID = 315; protected static final int MSG_SET_PLAYBACK_STATE = 316; protected static final int MSG_SET_PLAYBACK_STATE = 316; protected static final int MSG_USER_INFO_CHANGED = 317; private static KeyguardUpdateMonitor sInstance; private static KeyguardUpdateMonitor sInstance; Loading Loading @@ -176,6 +177,9 @@ public class KeyguardUpdateMonitor { case MSG_SET_PLAYBACK_STATE: case MSG_SET_PLAYBACK_STATE: handleSetPlaybackState(msg.arg1, msg.arg2, (Long) msg.obj); handleSetPlaybackState(msg.arg1, msg.arg2, (Long) msg.obj); break; break; case MSG_USER_INFO_CHANGED: handleUserInfoChanged(msg.arg1); break; } } } } }; }; Loading Loading @@ -278,6 +282,17 @@ public class KeyguardUpdateMonitor { } } }; }; private final BroadcastReceiver mBroadcastAllReceiver = new BroadcastReceiver() { public void onReceive(Context context, Intent intent) { final String action = intent.getAction(); if (Intent.ACTION_USER_INFO_CHANGED.equals(action)) { mHandler.sendMessage(mHandler.obtainMessage(MSG_USER_INFO_CHANGED, intent.getIntExtra(Intent.EXTRA_USER_HANDLE, getSendingUserId()), 0)); } } }; /** /** * When we receive a * When we receive a * {@link com.android.internal.telephony.TelephonyIntents#ACTION_SIM_STATE_CHANGED} broadcast, * {@link com.android.internal.telephony.TelephonyIntents#ACTION_SIM_STATE_CHANGED} broadcast, Loading Loading @@ -387,7 +402,6 @@ public class KeyguardUpdateMonitor { return sInstance; return sInstance; } } protected void handleSetGenerationId(int clientGeneration, boolean clearing, PendingIntent p) { protected void handleSetGenerationId(int clientGeneration, boolean clearing, PendingIntent p) { mDisplayClientState.clientGeneration = clientGeneration; mDisplayClientState.clientGeneration = clientGeneration; mDisplayClientState.clearing = clearing; mDisplayClientState.clearing = clearing; Loading Loading @@ -420,6 +434,15 @@ public class KeyguardUpdateMonitor { } } } } private void handleUserInfoChanged(int userId) { for (int i = 0; i < mCallbacks.size(); i++) { KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get(); if (cb != null) { cb.onUserInfoChanged(userId); } } } private KeyguardUpdateMonitor(Context context) { private KeyguardUpdateMonitor(Context context) { mContext = context; mContext = context; Loading Loading @@ -454,6 +477,10 @@ public class KeyguardUpdateMonitor { bootCompleteFilter.addAction(Intent.ACTION_BOOT_COMPLETED); bootCompleteFilter.addAction(Intent.ACTION_BOOT_COMPLETED); context.registerReceiver(mBroadcastReceiver, bootCompleteFilter); context.registerReceiver(mBroadcastReceiver, bootCompleteFilter); final IntentFilter userInfoFilter = new IntentFilter(Intent.ACTION_USER_INFO_CHANGED); context.registerReceiverAsUser(mBroadcastAllReceiver, UserHandle.ALL, userInfoFilter, null, null); try { try { ActivityManagerNative.getDefault().registerUserSwitchObserver( ActivityManagerNative.getDefault().registerUserSwitchObserver( new IUserSwitchObserver.Stub() { new IUserSwitchObserver.Stub() { Loading packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitorCallback.java +5 −0 Original line number Original line Diff line number Diff line Loading @@ -106,6 +106,11 @@ class KeyguardUpdateMonitorCallback { */ */ void onUserRemoved(int userId) { } void onUserRemoved(int userId) { } /** * Called when the user's info changed. */ void onUserInfoChanged(int userId) { } /** /** * Called when boot completed. * Called when boot completed. * * Loading Loading
core/java/android/content/Intent.java +1 −2 Original line number Original line Diff line number Diff line Loading @@ -2566,8 +2566,7 @@ public class Intent implements Parcelable, Cloneable { /** /** * Broadcast sent to the system when a user's information changes. Carries an extra * Broadcast sent to the system when a user's information changes. Carries an extra * {@link #EXTRA_USER_HANDLE} to indicate which user's information changed. * {@link #EXTRA_USER_HANDLE} to indicate which user's information changed. * This is only sent to registered receivers, not manifest receivers. It is sent to the user * This is only sent to registered receivers, not manifest receivers. It is sent to all users. * whose information has changed. * @hide * @hide */ */ public static final String ACTION_USER_INFO_CHANGED = public static final String ACTION_USER_INFO_CHANGED = Loading
packages/Keyguard/src/com/android/keyguard/KeyguardCircleFramedDrawable.java +15 −0 Original line number Original line Diff line number Diff line Loading @@ -100,6 +100,11 @@ class KeyguardCircleFramedDrawable extends Drawable { mFramePath = new Path(); mFramePath = new Path(); } } public void reset() { mScale = 1f; mPressed = false; } @Override @Override public void draw(Canvas canvas) { public void draw(Canvas canvas) { // clear background // clear background Loading Loading @@ -157,4 +162,14 @@ class KeyguardCircleFramedDrawable extends Drawable { @Override @Override public void setColorFilter(ColorFilter cf) { public void setColorFilter(ColorFilter cf) { } } public boolean verifyParams(float iconSize, int frameColor, float stroke, int frameShadowColor, float shadowRadius, int highlightColor) { return mSize == iconSize && mFrameColor == frameColor && mStrokeWidth == stroke && mFrameShadowColor == frameShadowColor && mShadowRadius == shadowRadius && mHighlightColor == highlightColor; } } }
packages/Keyguard/src/com/android/keyguard/KeyguardMultiUserAvatar.java +26 −2 Original line number Original line Diff line number Diff line Loading @@ -130,8 +130,32 @@ class KeyguardMultiUserAvatar extends FrameLayout { R.drawable.ic_contact_picture); R.drawable.ic_contact_picture); } } mFramed = (KeyguardCircleFramedDrawable) KeyguardViewMediator.getAvatarCache().get(user.id); // If we can't find it or the params don't match, create the drawable again if (mFramed == null || !mFramed.verifyParams(mIconSize, mFrameColor, mStroke, mFrameShadowColor, mShadowRadius, mHighlightColor)) { Bitmap icon = null; try { icon = BitmapFactory.decodeFile(rewriteIconPath(user.iconPath)); } catch (Exception e) { if (DEBUG) Log.d(TAG, "failed to open profile icon " + user.iconPath, e); } if (icon == null) { icon = BitmapFactory.decodeResource(mContext.getResources(), com.android.internal.R.drawable.ic_contact_picture); } mFramed = new KeyguardCircleFramedDrawable(icon, (int) mIconSize, mFrameColor, mStroke, mFramed = new KeyguardCircleFramedDrawable(icon, (int) mIconSize, mFrameColor, mStroke, mFrameShadowColor, mShadowRadius, mHighlightColor); mFrameShadowColor, mShadowRadius, mHighlightColor); KeyguardViewMediator.getAvatarCache().put(user.id, mFramed); } mFramed.reset(); mUserImage.setImageDrawable(mFramed); mUserImage.setImageDrawable(mFramed); mUserName.setText(mUserInfo.name); mUserName.setText(mUserInfo.name); setOnClickListener(mUserSelector); setOnClickListener(mUserSelector); Loading
packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitor.java +28 −1 Original line number Original line Diff line number Diff line Loading @@ -89,6 +89,7 @@ public class KeyguardUpdateMonitor { private static final int MSG_USER_SWITCH_COMPLETE = 314; private static final int MSG_USER_SWITCH_COMPLETE = 314; private static final int MSG_SET_CURRENT_CLIENT_ID = 315; private static final int MSG_SET_CURRENT_CLIENT_ID = 315; protected static final int MSG_SET_PLAYBACK_STATE = 316; protected static final int MSG_SET_PLAYBACK_STATE = 316; protected static final int MSG_USER_INFO_CHANGED = 317; private static KeyguardUpdateMonitor sInstance; private static KeyguardUpdateMonitor sInstance; Loading Loading @@ -176,6 +177,9 @@ public class KeyguardUpdateMonitor { case MSG_SET_PLAYBACK_STATE: case MSG_SET_PLAYBACK_STATE: handleSetPlaybackState(msg.arg1, msg.arg2, (Long) msg.obj); handleSetPlaybackState(msg.arg1, msg.arg2, (Long) msg.obj); break; break; case MSG_USER_INFO_CHANGED: handleUserInfoChanged(msg.arg1); break; } } } } }; }; Loading Loading @@ -278,6 +282,17 @@ public class KeyguardUpdateMonitor { } } }; }; private final BroadcastReceiver mBroadcastAllReceiver = new BroadcastReceiver() { public void onReceive(Context context, Intent intent) { final String action = intent.getAction(); if (Intent.ACTION_USER_INFO_CHANGED.equals(action)) { mHandler.sendMessage(mHandler.obtainMessage(MSG_USER_INFO_CHANGED, intent.getIntExtra(Intent.EXTRA_USER_HANDLE, getSendingUserId()), 0)); } } }; /** /** * When we receive a * When we receive a * {@link com.android.internal.telephony.TelephonyIntents#ACTION_SIM_STATE_CHANGED} broadcast, * {@link com.android.internal.telephony.TelephonyIntents#ACTION_SIM_STATE_CHANGED} broadcast, Loading Loading @@ -387,7 +402,6 @@ public class KeyguardUpdateMonitor { return sInstance; return sInstance; } } protected void handleSetGenerationId(int clientGeneration, boolean clearing, PendingIntent p) { protected void handleSetGenerationId(int clientGeneration, boolean clearing, PendingIntent p) { mDisplayClientState.clientGeneration = clientGeneration; mDisplayClientState.clientGeneration = clientGeneration; mDisplayClientState.clearing = clearing; mDisplayClientState.clearing = clearing; Loading Loading @@ -420,6 +434,15 @@ public class KeyguardUpdateMonitor { } } } } private void handleUserInfoChanged(int userId) { for (int i = 0; i < mCallbacks.size(); i++) { KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get(); if (cb != null) { cb.onUserInfoChanged(userId); } } } private KeyguardUpdateMonitor(Context context) { private KeyguardUpdateMonitor(Context context) { mContext = context; mContext = context; Loading Loading @@ -454,6 +477,10 @@ public class KeyguardUpdateMonitor { bootCompleteFilter.addAction(Intent.ACTION_BOOT_COMPLETED); bootCompleteFilter.addAction(Intent.ACTION_BOOT_COMPLETED); context.registerReceiver(mBroadcastReceiver, bootCompleteFilter); context.registerReceiver(mBroadcastReceiver, bootCompleteFilter); final IntentFilter userInfoFilter = new IntentFilter(Intent.ACTION_USER_INFO_CHANGED); context.registerReceiverAsUser(mBroadcastAllReceiver, UserHandle.ALL, userInfoFilter, null, null); try { try { ActivityManagerNative.getDefault().registerUserSwitchObserver( ActivityManagerNative.getDefault().registerUserSwitchObserver( new IUserSwitchObserver.Stub() { new IUserSwitchObserver.Stub() { Loading
packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitorCallback.java +5 −0 Original line number Original line Diff line number Diff line Loading @@ -106,6 +106,11 @@ class KeyguardUpdateMonitorCallback { */ */ void onUserRemoved(int userId) { } void onUserRemoved(int userId) { } /** * Called when the user's info changed. */ void onUserInfoChanged(int userId) { } /** /** * Called when boot completed. * Called when boot completed. * * Loading