From 4be68cd360d02e1bc31545a147a761b0d921e9e0 Mon Sep 17 00:00:00 2001
From: Matthias Yzusqui <myzb.dev@gmail.com>
Date: Tue, 2 Aug 2016 18:58:43 +0200
Subject: SystemUI: Don't pad when config_showScreenOnLockScreenHints is false

When the overlay is false the 'down' indicator is unused and there-
fore no padding for text alignment is needed.

Also use the overlay to disable the up-arrow indicator, thus return-
ing to the old lockscreen layout.

Change-Id: I542109686778e081c1883885287de0d5380578a2
---
 .../android/systemui/statusbar/KeyguardIndicationController.java   | 7 +++++--
 .../android/systemui/statusbar/phone/NotificationPanelView.java    | 2 +-
 .../src/com/android/systemui/statusbar/phone/PhoneStatusBar.java   | 4 +++-
 3 files changed, 9 insertions(+), 4 deletions(-)

(limited to 'packages/SystemUI')

diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java b/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java
index faf60f5..e4a0196 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java
@@ -76,6 +76,7 @@ public class KeyguardIndicationController {
     private int mChargingCurrent;
     private String mMessageToShowOnScreenOn;
     private IndicationDirection mIndicationDirection;
+    private boolean mScreenOnHintsEnabled;
 
     public KeyguardIndicationController(Context context, KeyguardIndicationTextView textView,
                                         LockIcon lockIcon) {
@@ -87,6 +88,7 @@ public class KeyguardIndicationController {
         Resources res = context.getResources();
         mSlowThreshold = res.getInteger(R.integer.config_chargingSlowlyThreshold);
         mFastThreshold = res.getInteger(R.integer.config_chargingFastThreshold);
+        mScreenOnHintsEnabled = res.getBoolean(R.bool.config_showScreenOnLockScreenHints);
 
 
         mBatteryInfo = IBatteryStats.Stub.asInterface(
@@ -189,8 +191,9 @@ public class KeyguardIndicationController {
             final int color = computeColor();
             mTextView.switchIndication(computeIndication());
             mTextView.setTextColor(color);
-            // pad the bottom using ic_empty_space to keep text vertically aligned
-            int top = 0, bottom = R.drawable.ic_empty_space, left = 0, right = 0;
+            int top = 0, left = 0, right = 0;
+            // pad the bottom using ic_empty_space to keep text vertically aligned if needed
+            int bottom = mScreenOnHintsEnabled ? R.drawable.ic_empty_space : 0;
             switch (mIndicationDirection) {
                 case UP:
                     top = R.drawable.ic_keyboard_arrow_up;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
index ef4aedb..e4e02a7 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
@@ -3071,7 +3071,7 @@ public class NotificationPanelView extends PanelView implements
         return getSharedPreferenceBoolean(KEY_USER_RETURNED_FROM_LLS, false);
     }
 
-    private boolean shouldShowScreenOnHints() {
+    public boolean shouldShowScreenOnHints() {
         return mScreenOnHintsEnabled && mStatusBar.isDeviceProvisioned() &&
                 mStatusBarState == StatusBarState.KEYGUARD;
     }
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 8f06328..7df8346 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
@@ -4796,7 +4796,9 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
 
     public void onUnlockHintStarted() {
         mKeyguardIndicationController.showTransientIndication(R.string.keyguard_unlock,
-                KeyguardIndicationController.IndicationDirection.UP);
+                mNotificationPanel.shouldShowScreenOnHints() ?
+                KeyguardIndicationController.IndicationDirection.UP :
+                KeyguardIndicationController.IndicationDirection.NONE);
     }
 
     public void onLlsHintStarted() {
-- 
cgit v1.1