am 9e289b05: am 0063e0bc: Merge "Disable Keyguard affordances before setup is completed" into mnc-dev

* commit '9e289b05453f40f1e5855a972a53eaff92fe5268':
  Disable Keyguard affordances before setup is completed
This commit is contained in:
Adrian Roos
2015-07-24 03:12:08 +00:00
committed by Android Git Automerger
4 changed files with 28 additions and 16 deletions

View File

@@ -69,7 +69,7 @@ public class KeyguardAffordanceView extends ImageView {
private float mCircleStartValue; private float mCircleStartValue;
private boolean mCircleWillBeHidden; private boolean mCircleWillBeHidden;
private int[] mTempPoint = new int[2]; private int[] mTempPoint = new int[2];
private float mImageScale; private float mImageScale = 1f;
private int mCircleColor; private int mCircleColor;
private boolean mIsLeft; private boolean mIsLeft;
private View mPreviewView; private View mPreviewView;

View File

@@ -86,9 +86,9 @@ public class KeyguardAffordanceHelper {
mContext = context; mContext = context;
mCallback = callback; mCallback = callback;
initIcons(); initIcons();
updateIcon(mLeftIcon, 0.0f, mLeftIcon.getRestingAlpha(), false, false); updateIcon(mLeftIcon, 0.0f, mLeftIcon.getRestingAlpha(), false, false, true);
updateIcon(mCenterIcon, 0.0f, mCenterIcon.getRestingAlpha(), false, false); updateIcon(mCenterIcon, 0.0f, mCenterIcon.getRestingAlpha(), false, false, true);
updateIcon(mRightIcon, 0.0f, mRightIcon.getRestingAlpha(), false, false); updateIcon(mRightIcon, 0.0f, mRightIcon.getRestingAlpha(), false, false, true);
initDimens(); initDimens();
} }
@@ -387,15 +387,15 @@ public class KeyguardAffordanceHelper {
boolean slowAnimation = isReset && isBelowFalsingThreshold(); boolean slowAnimation = isReset && isBelowFalsingThreshold();
if (!isReset) { if (!isReset) {
updateIcon(targetView, radius, alpha + fadeOutAlpha * targetView.getRestingAlpha(), updateIcon(targetView, radius, alpha + fadeOutAlpha * targetView.getRestingAlpha(),
false, false); false, false, false);
} else { } else {
updateIcon(targetView, 0.0f, fadeOutAlpha * targetView.getRestingAlpha(), updateIcon(targetView, 0.0f, fadeOutAlpha * targetView.getRestingAlpha(),
animateIcons, slowAnimation); animateIcons, slowAnimation, false);
} }
updateIcon(otherView, 0.0f, fadeOutAlpha * otherView.getRestingAlpha(), updateIcon(otherView, 0.0f, fadeOutAlpha * otherView.getRestingAlpha(),
animateIcons, slowAnimation); animateIcons, slowAnimation, false);
updateIcon(mCenterIcon, 0.0f, fadeOutAlpha * mCenterIcon.getRestingAlpha(), updateIcon(mCenterIcon, 0.0f, fadeOutAlpha * mCenterIcon.getRestingAlpha(),
animateIcons, slowAnimation); animateIcons, slowAnimation, false);
mTranslation = translation; mTranslation = translation;
} }
@@ -431,13 +431,13 @@ public class KeyguardAffordanceHelper {
public void animateHideLeftRightIcon() { public void animateHideLeftRightIcon() {
cancelAnimation(); cancelAnimation();
updateIcon(mRightIcon, 0f, 0f, true, false); updateIcon(mRightIcon, 0f, 0f, true, false, false);
updateIcon(mLeftIcon, 0f, 0f, true, false); updateIcon(mLeftIcon, 0f, 0f, true, false, false);
} }
private void updateIcon(KeyguardAffordanceView view, float circleRadius, float alpha, private void updateIcon(KeyguardAffordanceView view, float circleRadius, float alpha,
boolean animate, boolean slowRadiusAnimation) { boolean animate, boolean slowRadiusAnimation, boolean force) {
if (view.getVisibility() != View.VISIBLE) { if (view.getVisibility() != View.VISIBLE && !force) {
return; return;
} }
view.setCircleRadius(circleRadius, slowRadiusAnimation); view.setCircleRadius(circleRadius, slowRadiusAnimation);

View File

@@ -106,6 +106,7 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL
private PhoneStatusBar mPhoneStatusBar; private PhoneStatusBar mPhoneStatusBar;
private final Interpolator mLinearOutSlowInInterpolator; private final Interpolator mLinearOutSlowInInterpolator;
private boolean mUserSetupComplete;
private boolean mPrewarmBound; private boolean mPrewarmBound;
private Messenger mPrewarmMessenger; private Messenger mPrewarmMessenger;
private final ServiceConnection mPrewarmConnection = new ServiceConnection() { 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 updateCameraVisibility(); // in case onFinishInflate() was called too early
} }
public void setUserSetupComplete(boolean userSetupComplete) {
mUserSetupComplete = userSetupComplete;
updateCameraVisibility();
updateLeftAffordanceIcon();
}
private Intent getCameraIntent() { private Intent getCameraIntent() {
KeyguardUpdateMonitor updateMonitor = KeyguardUpdateMonitor.getInstance(mContext); KeyguardUpdateMonitor updateMonitor = KeyguardUpdateMonitor.getInstance(mContext);
boolean canSkipBouncer = updateMonitor.getUserCanSkipBouncer( boolean canSkipBouncer = updateMonitor.getUserCanSkipBouncer(
@@ -267,7 +274,8 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL
PackageManager.MATCH_DEFAULT_ONLY, PackageManager.MATCH_DEFAULT_ONLY,
KeyguardUpdateMonitor.getCurrentUser()); KeyguardUpdateMonitor.getCurrentUser());
boolean visible = !isCameraDisabledByDpm() && resolved != null 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); mCameraImageView.setVisibility(visible ? View.VISIBLE : View.GONE);
} }
@@ -275,16 +283,16 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL
mLeftIsVoiceAssist = canLaunchVoiceAssist(); mLeftIsVoiceAssist = canLaunchVoiceAssist();
int drawableId; int drawableId;
int contentDescription; int contentDescription;
boolean visible = mUserSetupComplete;
if (mLeftIsVoiceAssist) { if (mLeftIsVoiceAssist) {
mLeftAffordanceView.setVisibility(View.VISIBLE);
drawableId = R.drawable.ic_mic_26dp; drawableId = R.drawable.ic_mic_26dp;
contentDescription = R.string.accessibility_voice_assist_button; contentDescription = R.string.accessibility_voice_assist_button;
} else { } else {
boolean visible = isPhoneVisible(); visible &= isPhoneVisible();
mLeftAffordanceView.setVisibility(visible ? View.VISIBLE : View.GONE);
drawableId = R.drawable.ic_phone_24dp; drawableId = R.drawable.ic_phone_24dp;
contentDescription = R.string.accessibility_phone_button; contentDescription = R.string.accessibility_phone_button;
} }
mLeftAffordanceView.setVisibility(visible ? View.VISIBLE : View.GONE);
mLeftAffordanceView.setImageDrawable(mContext.getDrawable(drawableId)); mLeftAffordanceView.setImageDrawable(mContext.getDrawable(drawableId));
mLeftAffordanceView.setContentDescription(mContext.getString(contentDescription)); mLeftAffordanceView.setContentDescription(mContext.getString(contentDescription));
} }

View File

@@ -366,6 +366,9 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
mUserSetup = userSetup; mUserSetup = userSetup;
if (!mUserSetup && mStatusBarView != null) if (!mUserSetup && mStatusBarView != null)
animateCollapseQuickSettings(); animateCollapseQuickSettings();
if (mKeyguardBottomArea != null) {
mKeyguardBottomArea.setUserSetupComplete(mUserSetup);
}
} }
if (mIconPolicy != null) { if (mIconPolicy != null) {
mIconPolicy.setCurrentUserSetup(mUserSetup); mIconPolicy.setCurrentUserSetup(mUserSetup);
@@ -842,6 +845,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
mFlashlightController = new FlashlightController(mContext); mFlashlightController = new FlashlightController(mContext);
mKeyguardBottomArea.setFlashlightController(mFlashlightController); mKeyguardBottomArea.setFlashlightController(mFlashlightController);
mKeyguardBottomArea.setPhoneStatusBar(this); mKeyguardBottomArea.setPhoneStatusBar(this);
mKeyguardBottomArea.setUserSetupComplete(mUserSetup);
mAccessibilityController = new AccessibilityController(mContext); mAccessibilityController = new AccessibilityController(mContext);
mKeyguardBottomArea.setAccessibilityController(mAccessibilityController); mKeyguardBottomArea.setAccessibilityController(mAccessibilityController);
mNextAlarmController = new NextAlarmController(mContext); mNextAlarmController = new NextAlarmController(mContext);