Parameter to hide bottom affordances

Created configurable xml parameter to hide the mic/phone
affordance at the bottom of the lock screen, fixed minor
animation issue where circle would still expand if affordance
isn't visible and set default visibility to false.

Test: Double tap to open camera from AoD, lock screen and launcher
Test: visual, set config, look at lock screen
Bug: 64155983
Change-Id: If5cd2c2c369578480c0ad4e8a98970bcfabd5f3e
This commit is contained in:
Lucas Dupin
2018-01-05 12:57:27 -08:00
parent c9cbc3e5fc
commit f78c540cb1
3 changed files with 15 additions and 3 deletions

View File

@@ -76,8 +76,11 @@
<!-- Vibration duration for GlowPadView used in SearchPanelView -->
<integer translatable="false" name="config_search_panel_view_vibration_duration">20</integer>
<!-- Show mic or phone affordance on Keyguard -->
<bool name="config_keyguardShowLeftAffordance">false</bool>
<!-- Show camera affordance on Keyguard -->
<bool name="config_keyguardShowCameraAffordance">true</bool>
<bool name="config_keyguardShowCameraAffordance">false</bool>
<!-- Whether we should use SRC drawing mode when drawing the scrim behind. If this flag is set,
we change the canvas opacity so libhwui doesn't call glClear on our surface, and then we

View File

@@ -529,6 +529,13 @@ public class KeyguardAffordanceHelper {
KeyguardAffordanceView targetView = left ? mLeftIcon : mRightIcon;
KeyguardAffordanceView otherView = left ? mRightIcon : mLeftIcon;
startSwiping(targetView);
// Do not animate the circle expanding if the affordance isn't visible,
// otherwise the circle will be meaningless.
if (targetView.getVisibility() != View.VISIBLE) {
animate = false;
}
if (animate) {
fling(0, false, !left);
updateIcon(otherView, 0.0f, 0, true, false, true, false);

View File

@@ -822,8 +822,10 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL
@Override
public IconState getIcon() {
mLeftIsVoiceAssist = canLaunchVoiceAssist();
final boolean showAffordance =
getResources().getBoolean(R.bool.config_keyguardShowLeftAffordance);
if (mLeftIsVoiceAssist) {
mIconState.isVisible = mUserSetupComplete;
mIconState.isVisible = mUserSetupComplete && showAffordance;
if (mLeftAssistIcon == null) {
mIconState.drawable = mContext.getDrawable(R.drawable.ic_mic_26dp);
} else {
@@ -832,7 +834,7 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL
mIconState.contentDescription = mContext.getString(
R.string.accessibility_voice_assist_button);
} else {
mIconState.isVisible = mUserSetupComplete && isPhoneVisible();
mIconState.isVisible = mUserSetupComplete && showAffordance && isPhoneVisible();
mIconState.drawable = mContext.getDrawable(R.drawable.ic_phone_24dp);
mIconState.contentDescription = mContext.getString(
R.string.accessibility_phone_button);