diff options
Diffstat (limited to 'packages')
8 files changed, 105 insertions, 34 deletions
diff --git a/packages/Keyguard/res/layout/keyguard_password_view.xml b/packages/Keyguard/res/layout/keyguard_password_view.xml index 7dcaf6d..7d45017 100644 --- a/packages/Keyguard/res/layout/keyguard_password_view.xml +++ b/packages/Keyguard/res/layout/keyguard_password_view.xml @@ -57,6 +57,7 @@ android:textSize="16sp" android:textAppearance="?android:attr/textAppearanceMedium" android:imeOptions="flagForceAscii|actionDone" + android:maxLength="500" /> <ImageView android:id="@+id/switch_ime_button" diff --git a/packages/SystemUI/AndroidManifest.xml b/packages/SystemUI/AndroidManifest.xml index fea7f94..ea2cc51 100644 --- a/packages/SystemUI/AndroidManifest.xml +++ b/packages/SystemUI/AndroidManifest.xml @@ -49,6 +49,7 @@ <uses-permission android:name="android.permission.BLUETOOTH" /> <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" /> <uses-permission android:name="android.permission.BLUETOOTH_PRIVILEGED" /> + <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" /> <uses-permission android:name="android.permission.READ_PRIVILEGED_PHONE_STATE" /> @@ -125,6 +126,11 @@ <!-- Assist --> <uses-permission android:name="android.permission.ACCESS_VOICE_INTERACTION_SERVICE" /> + <!-- Self permission for internal broadcasts. --> + <permission android:name="com.android.systemui.permission.SELF" + android:protectionLevel="signature" /> + <uses-permission android:name="com.android.systemui.permission.SELF" /> + <application android:name=".SystemUIApplication" android:persistent="true" diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardAffordanceView.java b/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardAffordanceView.java index 58fb2b1..164c496 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardAffordanceView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardAffordanceView.java @@ -69,7 +69,7 @@ public class KeyguardAffordanceView extends ImageView { private float mCircleStartValue; private boolean mCircleWillBeHidden; private int[] mTempPoint = new int[2]; - private float mImageScale; + private float mImageScale = 1f; private int mCircleColor; private boolean mIsLeft; private View mPreviewView; diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardAffordanceHelper.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardAffordanceHelper.java index 6670ae0..10019f9 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardAffordanceHelper.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardAffordanceHelper.java @@ -86,9 +86,9 @@ public class KeyguardAffordanceHelper { mContext = context; mCallback = callback; initIcons(); - updateIcon(mLeftIcon, 0.0f, mLeftIcon.getRestingAlpha(), false, false); - updateIcon(mCenterIcon, 0.0f, mCenterIcon.getRestingAlpha(), false, false); - updateIcon(mRightIcon, 0.0f, mRightIcon.getRestingAlpha(), false, false); + updateIcon(mLeftIcon, 0.0f, mLeftIcon.getRestingAlpha(), false, false, true); + updateIcon(mCenterIcon, 0.0f, mCenterIcon.getRestingAlpha(), false, false, true); + updateIcon(mRightIcon, 0.0f, mRightIcon.getRestingAlpha(), false, false, true); initDimens(); } @@ -387,15 +387,15 @@ public class KeyguardAffordanceHelper { boolean slowAnimation = isReset && isBelowFalsingThreshold(); if (!isReset) { updateIcon(targetView, radius, alpha + fadeOutAlpha * targetView.getRestingAlpha(), - false, false); + false, false, false); } else { updateIcon(targetView, 0.0f, fadeOutAlpha * targetView.getRestingAlpha(), - animateIcons, slowAnimation); + animateIcons, slowAnimation, false); } updateIcon(otherView, 0.0f, fadeOutAlpha * otherView.getRestingAlpha(), - animateIcons, slowAnimation); + animateIcons, slowAnimation, false); updateIcon(mCenterIcon, 0.0f, fadeOutAlpha * mCenterIcon.getRestingAlpha(), - animateIcons, slowAnimation); + animateIcons, slowAnimation, false); mTranslation = translation; } @@ -431,13 +431,13 @@ public class KeyguardAffordanceHelper { public void animateHideLeftRightIcon() { cancelAnimation(); - updateIcon(mRightIcon, 0f, 0f, true, false); - updateIcon(mLeftIcon, 0f, 0f, true, false); + updateIcon(mRightIcon, 0f, 0f, true, false, false); + updateIcon(mLeftIcon, 0f, 0f, true, false, false); } private void updateIcon(KeyguardAffordanceView view, float circleRadius, float alpha, - boolean animate, boolean slowRadiusAnimation) { - if (view.getVisibility() != View.VISIBLE) { + boolean animate, boolean slowRadiusAnimation, boolean force) { + if (view.getVisibility() != View.VISIBLE && !force) { return; } view.setCircleRadius(circleRadius, slowRadiusAnimation); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java index 9d81e6e..7c08efc 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java @@ -106,6 +106,7 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL private PhoneStatusBar mPhoneStatusBar; private final Interpolator mLinearOutSlowInInterpolator; + private boolean mUserSetupComplete; private boolean mPrewarmBound; private Messenger mPrewarmMessenger; private final ServiceConnection mPrewarmConnection = new ServiceConnection() { @@ -250,6 +251,12 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL updateCameraVisibility(); // in case onFinishInflate() was called too early } + public void setUserSetupComplete(boolean userSetupComplete) { + mUserSetupComplete = userSetupComplete; + updateCameraVisibility(); + updateLeftAffordanceIcon(); + } + private Intent getCameraIntent() { KeyguardUpdateMonitor updateMonitor = KeyguardUpdateMonitor.getInstance(mContext); boolean canSkipBouncer = updateMonitor.getUserCanSkipBouncer( @@ -267,7 +274,8 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL PackageManager.MATCH_DEFAULT_ONLY, KeyguardUpdateMonitor.getCurrentUser()); boolean visible = !isCameraDisabledByDpm() && resolved != null - && getResources().getBoolean(R.bool.config_keyguardShowCameraAffordance); + && getResources().getBoolean(R.bool.config_keyguardShowCameraAffordance) + && mUserSetupComplete; mCameraImageView.setVisibility(visible ? View.VISIBLE : View.GONE); } @@ -275,16 +283,16 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL mLeftIsVoiceAssist = canLaunchVoiceAssist(); int drawableId; int contentDescription; + boolean visible = mUserSetupComplete; if (mLeftIsVoiceAssist) { - mLeftAffordanceView.setVisibility(View.VISIBLE); drawableId = R.drawable.ic_mic_26dp; contentDescription = R.string.accessibility_voice_assist_button; } else { - boolean visible = isPhoneVisible(); - mLeftAffordanceView.setVisibility(visible ? View.VISIBLE : View.GONE); + visible &= isPhoneVisible(); drawableId = R.drawable.ic_phone_24dp; contentDescription = R.string.accessibility_phone_button; } + mLeftAffordanceView.setVisibility(visible ? View.VISIBLE : View.GONE); mLeftAffordanceView.setImageDrawable(mContext.getDrawable(drawableId)); mLeftAffordanceView.setContentDescription(mContext.getString(contentDescription)); } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java index 75710cd..fb940d2 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java @@ -366,6 +366,9 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, mUserSetup = userSetup; if (!mUserSetup && mStatusBarView != null) animateCollapseQuickSettings(); + if (mKeyguardBottomArea != null) { + mKeyguardBottomArea.setUserSetupComplete(mUserSetup); + } } if (mIconPolicy != null) { mIconPolicy.setCurrentUserSetup(mUserSetup); @@ -599,7 +602,8 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, addNavigationBar(); // Lastly, call to the icon policy to install/update all the icons. - mIconPolicy = new PhoneStatusBarPolicy(mContext, mCastController, mHotspotController); + mIconPolicy = new PhoneStatusBarPolicy(mContext, mCastController, mHotspotController, + mUserInfoController); mIconPolicy.setCurrentUserSetup(mUserSetup); mSettingsObserver.onChange(false); // set up @@ -842,12 +846,14 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, mFlashlightController = new FlashlightController(mContext); mKeyguardBottomArea.setFlashlightController(mFlashlightController); mKeyguardBottomArea.setPhoneStatusBar(this); + mKeyguardBottomArea.setUserSetupComplete(mUserSetup); mAccessibilityController = new AccessibilityController(mContext); mKeyguardBottomArea.setAccessibilityController(mAccessibilityController); mNextAlarmController = new NextAlarmController(mContext); mKeyguardMonitor = new KeyguardMonitor(mContext); if (UserSwitcherController.isUserSwitcherAvailable(UserManager.get(mContext))) { - mUserSwitcherController = new UserSwitcherController(mContext, mKeyguardMonitor); + mUserSwitcherController = new UserSwitcherController(mContext, mKeyguardMonitor, + mHandler); } mKeyguardUserSwitcher = new KeyguardUserSwitcher(mContext, (ViewStub) mStatusBarWindow.findViewById(R.id.keyguard_user_switcher), @@ -1686,7 +1692,8 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, } if (metaDataChanged) { if (mBackdropBack.getDrawable() != null) { - Drawable drawable = mBackdropBack.getDrawable(); + Drawable drawable = + mBackdropBack.getDrawable().getConstantState().newDrawable().mutate(); mBackdropFront.setImageDrawable(drawable); if (mScrimSrcModeEnabled) { mBackdropFront.getDrawable().mutate().setXfermode(mSrcOverXferMode); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicy.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicy.java index b2a67bd..53dae5c 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicy.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicy.java @@ -44,6 +44,7 @@ import com.android.systemui.qs.tiles.DndTile; import com.android.systemui.statusbar.policy.CastController; import com.android.systemui.statusbar.policy.CastController.CastDevice; import com.android.systemui.statusbar.policy.HotspotController; +import com.android.systemui.statusbar.policy.UserInfoController; /** * This class contains all of the policy about which icons are installed in the status @@ -69,6 +70,7 @@ public class PhoneStatusBarPolicy { private final CastController mCast; private final HotspotController mHotspot; private final AlarmManager mAlarmManager; + private final UserInfoController mUserInfoController; // Assume it's all good unless we hear otherwise. We don't always seem // to get broadcasts that it *is* there. @@ -111,12 +113,14 @@ public class PhoneStatusBarPolicy { } }; - public PhoneStatusBarPolicy(Context context, CastController cast, HotspotController hotspot) { + public PhoneStatusBarPolicy(Context context, CastController cast, HotspotController hotspot, + UserInfoController userInfoController) { mContext = context; mCast = cast; mHotspot = hotspot; mService = (StatusBarManager) context.getSystemService(Context.STATUS_BAR_SERVICE); mAlarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE); + mUserInfoController = userInfoController; // listen for broadcasts IntentFilter filter = new IntentFilter(); @@ -360,6 +364,7 @@ public class PhoneStatusBarPolicy { new IUserSwitchObserver.Stub() { @Override public void onUserSwitching(int newUserId, IRemoteCallback reply) { + mUserInfoController.reloadUserInfo(); } @Override diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/UserSwitcherController.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/UserSwitcherController.java index 6fabe9b..3e8d4e9 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/UserSwitcherController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/UserSwitcherController.java @@ -39,6 +39,8 @@ import android.os.UserManager; import android.provider.Settings; import android.util.Log; import android.util.SparseArray; +import android.util.SparseBooleanArray; +import android.util.SparseIntArray; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; @@ -68,6 +70,11 @@ public class UserSwitcherController { private static final String SIMPLE_USER_SWITCHER_GLOBAL_SETTING = "lockscreenSimpleUserSwitcher"; private static final String ACTION_REMOVE_GUEST = "com.android.systemui.REMOVE_GUEST"; + private static final int PAUSE_REFRESH_USERS_TIMEOUT_MS = 3000; + + private static final int ID_REMOVE_GUEST = 1010; + private static final String TAG_REMOVE_GUEST = "remove_guest"; + private static final String PERMISSION_SELF = "com.android.systemui.permission.SELF"; private final Context mContext; private final UserManager mUserManager; @@ -75,6 +82,7 @@ public class UserSwitcherController { private final GuestResumeSessionReceiver mGuestResumeSessionReceiver = new GuestResumeSessionReceiver(); private final KeyguardMonitor mKeyguardMonitor; + private final Handler mHandler; private ArrayList<UserRecord> mUsers = new ArrayList<>(); private Dialog mExitGuestDialog; @@ -82,11 +90,15 @@ public class UserSwitcherController { private int mLastNonGuestUser = UserHandle.USER_OWNER; private boolean mSimpleUserSwitcher; private boolean mAddUsersWhenLocked; + private boolean mPauseRefreshUsers; + private SparseBooleanArray mForcePictureLoadForUserId = new SparseBooleanArray(2); - public UserSwitcherController(Context context, KeyguardMonitor keyguardMonitor) { + public UserSwitcherController(Context context, KeyguardMonitor keyguardMonitor, + Handler handler) { mContext = context; mGuestResumeSessionReceiver.register(context); mKeyguardMonitor = keyguardMonitor; + mHandler = handler; mUserManager = UserManager.get(context); IntentFilter filter = new IntentFilter(); filter.addAction(Intent.ACTION_USER_ADDED); @@ -94,10 +106,13 @@ public class UserSwitcherController { filter.addAction(Intent.ACTION_USER_INFO_CHANGED); filter.addAction(Intent.ACTION_USER_SWITCHED); filter.addAction(Intent.ACTION_USER_STOPPING); - filter.addAction(ACTION_REMOVE_GUEST); mContext.registerReceiverAsUser(mReceiver, UserHandle.OWNER, filter, null /* permission */, null /* scheduler */); + filter = new IntentFilter(); + filter.addAction(ACTION_REMOVE_GUEST); + mContext.registerReceiverAsUser(mReceiver, UserHandle.OWNER, filter, + PERMISSION_SELF, null /* scheduler */); mContext.getContentResolver().registerContentObserver( Settings.Global.getUriFor(SIMPLE_USER_SWITCHER_GLOBAL_SETTING), true, @@ -122,17 +137,26 @@ public class UserSwitcherController { */ @SuppressWarnings("unchecked") private void refreshUsers(int forcePictureLoadForId) { + if (DEBUG) Log.d(TAG, "refreshUsers(forcePictureLoadForId=" + forcePictureLoadForId+")"); + if (forcePictureLoadForId != UserHandle.USER_NULL) { + mForcePictureLoadForUserId.put(forcePictureLoadForId, true); + } + + if (mPauseRefreshUsers) { + return; + } SparseArray<Bitmap> bitmaps = new SparseArray<>(mUsers.size()); final int N = mUsers.size(); for (int i = 0; i < N; i++) { UserRecord r = mUsers.get(i); - if (r == null || r.info == null - || r.info.id == forcePictureLoadForId || r.picture == null) { + if (r == null || r.picture == null || + r.info == null || mForcePictureLoadForUserId.get(r.info.id)) { continue; } bitmaps.put(r.info.id, r.picture); } + mForcePictureLoadForUserId.clear(); final boolean addUsersWhenLocked = mAddUsersWhenLocked; new AsyncTask<SparseArray<Bitmap>, Void, ArrayList<UserRecord>>() { @@ -215,6 +239,13 @@ public class UserSwitcherController { }.execute((SparseArray) bitmaps); } + private void pauseRefreshUsers() { + if (!mPauseRefreshUsers) { + mHandler.postDelayed(mUnpauseRefreshUsers, PAUSE_REFRESH_USERS_TIMEOUT_MS); + mPauseRefreshUsers = true; + } + } + private void notifyAdapters() { for (int i = mAdapters.size() - 1; i >= 0; i--) { BaseUserAdapter adapter = mAdapters.get(i).get(); @@ -261,6 +292,7 @@ public class UserSwitcherController { private void switchToUserId(int id) { try { + pauseRefreshUsers(); ActivityManagerNative.getDefault().switchUser(id); } catch (RemoteException e) { Log.e(TAG, "Couldn't switch user.", e); @@ -302,6 +334,10 @@ public class UserSwitcherController { Log.v(TAG, "Broadcast: a=" + intent.getAction() + " user=" + intent.getIntExtra(Intent.EXTRA_USER_HANDLE, -1)); } + + boolean unpauseRefreshUsers = false; + int forcePictureLoadForId = UserHandle.USER_NULL; + if (ACTION_REMOVE_GUEST.equals(intent.getAction())) { int currentUser = ActivityManager.getCurrentUser(); UserInfo userInfo = mUserManager.getUserInfo(currentUser); @@ -309,16 +345,13 @@ public class UserSwitcherController { showExitGuestDialog(currentUser); } return; - } - if (Intent.ACTION_USER_ADDED.equals(intent.getAction())) { + } else if (Intent.ACTION_USER_ADDED.equals(intent.getAction())) { final int currentId = intent.getIntExtra(Intent.EXTRA_USER_HANDLE, -1); UserInfo userInfo = mUserManager.getUserInfo(currentId); if (userInfo != null && userInfo.isGuest()) { showGuestNotification(currentId); } - } - - if (Intent.ACTION_USER_SWITCHED.equals(intent.getAction())) { + } else if (Intent.ACTION_USER_SWITCHED.equals(intent.getAction())) { if (mExitGuestDialog != null && mExitGuestDialog.isShowing()) { mExitGuestDialog.cancel(); mExitGuestDialog = null; @@ -343,13 +376,15 @@ public class UserSwitcherController { } } notifyAdapters(); - } - int forcePictureLoadForId = UserHandle.USER_NULL; - if (Intent.ACTION_USER_INFO_CHANGED.equals(intent.getAction())) { + unpauseRefreshUsers = true; + } else if (Intent.ACTION_USER_INFO_CHANGED.equals(intent.getAction())) { forcePictureLoadForId = intent.getIntExtra(Intent.EXTRA_USER_HANDLE, UserHandle.USER_NULL); } refreshUsers(forcePictureLoadForId); + if (unpauseRefreshUsers) { + mUnpauseRefreshUsers.run(); + } } private void showGuestNotification(int guestUserId) { @@ -366,8 +401,17 @@ public class UserSwitcherController { mContext.getString(R.string.guest_notification_remove_action), removeGuestPI) .build(); - NotificationManager.from(mContext).notifyAsUser(null, 0, notification, - new UserHandle(guestUserId)); + NotificationManager.from(mContext).notifyAsUser(TAG_REMOVE_GUEST, ID_REMOVE_GUEST, + notification, new UserHandle(guestUserId)); + } + }; + + private final Runnable mUnpauseRefreshUsers = new Runnable() { + @Override + public void run() { + mHandler.removeCallbacks(this); + mPauseRefreshUsers = false; + refreshUsers(UserHandle.USER_NULL); } }; |