Moving now playing widget above lock icon in split shade
This change extracts lock icon padding to resources and simplifies it a bit. Also fixes small inaccuracy when reading screen size in pixels which didn't take into account status bar. Moving margins from inner ambient to ambient container so they can be easily refreshed when layout changes. Also moving some piece of code from AmbientContainer to NPVC as it feels a bit weird that ambient container knows about stack scroller. Fixes: 204567063 Bug: 204567056 Test: manual Change-Id: Ifab2980a8bfd5bf0e62b5deed85b9b811060f714
This commit is contained in:
@@ -33,5 +33,4 @@
|
|||||||
<!-- Notifications are sized to match the width of two (of 4) qs tiles in landscape. -->
|
<!-- Notifications are sized to match the width of two (of 4) qs tiles in landscape. -->
|
||||||
<bool name="config_skinnyNotifsInLandscape">false</bool>
|
<bool name="config_skinnyNotifsInLandscape">false</bool>
|
||||||
|
|
||||||
<dimen name="keyguard_indication_margin_bottom">25dp</dimen>
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
24
packages/SystemUI/res/values-sw600dp-land/dimens.xml
Normal file
24
packages/SystemUI/res/values-sw600dp-land/dimens.xml
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
* Copyright (c) 2021, The Android Open Source Project
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
-->
|
||||||
|
<resources>
|
||||||
|
|
||||||
|
<!-- keyguard-->
|
||||||
|
<dimen name="keyguard_indication_margin_bottom">25dp</dimen>
|
||||||
|
<dimen name="ambient_indication_margin_bottom">115dp</dimen>
|
||||||
|
<dimen name="lock_icon_margin_bottom">60dp</dimen>
|
||||||
|
</resources>
|
||||||
@@ -929,7 +929,9 @@
|
|||||||
<dimen name="keyguard_lock_padding">20dp</dimen>
|
<dimen name="keyguard_lock_padding">20dp</dimen>
|
||||||
|
|
||||||
<dimen name="keyguard_indication_margin_bottom">32dp</dimen>
|
<dimen name="keyguard_indication_margin_bottom">32dp</dimen>
|
||||||
<dimen name="lock_icon_margin_bottom">98dp</dimen>
|
<dimen name="lock_icon_margin_bottom">110dp</dimen>
|
||||||
|
<dimen name="ambient_indication_margin_bottom">71dp</dimen>
|
||||||
|
|
||||||
|
|
||||||
<!-- The text size for battery level -->
|
<!-- The text size for battery level -->
|
||||||
<dimen name="battery_level_text_size">12sp</dimen>
|
<dimen name="battery_level_text_size">12sp</dimen>
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ import android.view.GestureDetector.SimpleOnGestureListener;
|
|||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.MotionEvent;
|
import android.view.MotionEvent;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
import android.view.WindowManager;
|
||||||
import android.view.accessibility.AccessibilityManager;
|
import android.view.accessibility.AccessibilityManager;
|
||||||
import android.view.accessibility.AccessibilityNodeInfo;
|
import android.view.accessibility.AccessibilityNodeInfo;
|
||||||
|
|
||||||
@@ -85,7 +86,6 @@ public class LockIconViewController extends ViewController<LockIconView> impleme
|
|||||||
private static final float sDefaultDensity =
|
private static final float sDefaultDensity =
|
||||||
(float) DisplayMetrics.DENSITY_DEVICE_STABLE / (float) DisplayMetrics.DENSITY_DEFAULT;
|
(float) DisplayMetrics.DENSITY_DEVICE_STABLE / (float) DisplayMetrics.DENSITY_DEFAULT;
|
||||||
private static final int sLockIconRadiusPx = (int) (sDefaultDensity * 36);
|
private static final int sLockIconRadiusPx = (int) (sDefaultDensity * 36);
|
||||||
private static final float sDistAboveKgBottomAreaPx = sDefaultDensity * 12;
|
|
||||||
private static final AudioAttributes VIBRATION_SONIFICATION_ATTRIBUTES =
|
private static final AudioAttributes VIBRATION_SONIFICATION_ATTRIBUTES =
|
||||||
new AudioAttributes.Builder()
|
new AudioAttributes.Builder()
|
||||||
.setContentType(AudioAttributes.CONTENT_TYPE_SONIFICATION)
|
.setContentType(AudioAttributes.CONTENT_TYPE_SONIFICATION)
|
||||||
@@ -126,7 +126,7 @@ public class LockIconViewController extends ViewController<LockIconView> impleme
|
|||||||
private boolean mUdfpsSupported;
|
private boolean mUdfpsSupported;
|
||||||
private float mHeightPixels;
|
private float mHeightPixels;
|
||||||
private float mWidthPixels;
|
private float mWidthPixels;
|
||||||
private int mBottomPadding; // in pixels
|
private int mBottomPaddingPx;
|
||||||
|
|
||||||
private boolean mShowUnlockIcon;
|
private boolean mShowUnlockIcon;
|
||||||
private boolean mShowLockIcon;
|
private boolean mShowLockIcon;
|
||||||
@@ -347,11 +347,11 @@ public class LockIconViewController extends ViewController<LockIconView> impleme
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void updateConfiguration() {
|
private void updateConfiguration() {
|
||||||
final DisplayMetrics metrics = mView.getContext().getResources().getDisplayMetrics();
|
WindowManager windowManager = getContext().getSystemService(WindowManager.class);
|
||||||
mWidthPixels = metrics.widthPixels;
|
Rect bounds = windowManager.getCurrentWindowMetrics().getBounds();
|
||||||
mHeightPixels = metrics.heightPixels;
|
mWidthPixels = bounds.right;
|
||||||
mBottomPadding = mView.getContext().getResources().getDimensionPixelSize(
|
mHeightPixels = bounds.bottom;
|
||||||
R.dimen.lock_icon_margin_bottom);
|
mBottomPaddingPx = getResources().getDimensionPixelSize(R.dimen.lock_icon_margin_bottom);
|
||||||
|
|
||||||
mUnlockedLabel = mView.getContext().getResources().getString(
|
mUnlockedLabel = mView.getContext().getResources().getString(
|
||||||
R.string.accessibility_unlock_button);
|
R.string.accessibility_unlock_button);
|
||||||
@@ -370,8 +370,8 @@ public class LockIconViewController extends ViewController<LockIconView> impleme
|
|||||||
} else {
|
} else {
|
||||||
mView.setCenterLocation(
|
mView.setCenterLocation(
|
||||||
new PointF(mWidthPixels / 2,
|
new PointF(mWidthPixels / 2,
|
||||||
mHeightPixels - mBottomPadding - sDistAboveKgBottomAreaPx
|
mHeightPixels - mBottomPaddingPx - sLockIconRadiusPx),
|
||||||
- sLockIconRadiusPx), sLockIconRadiusPx);
|
sLockIconRadiusPx);
|
||||||
}
|
}
|
||||||
|
|
||||||
mView.getHitRect(mSensorTouchLocation);
|
mView.getHitRect(mSensorTouchLocation);
|
||||||
|
|||||||
@@ -3525,7 +3525,12 @@ public class NotificationPanelViewController extends PanelViewController {
|
|||||||
mNotificationStackScrollLayoutController.setPulsing(pulsing, animatePulse);
|
mNotificationStackScrollLayoutController.setPulsing(pulsing, animatePulse);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAmbientIndicationBottomPadding(int ambientIndicationBottomPadding) {
|
public void setAmbientIndicationTop(int ambientIndicationTop, boolean ambientTextVisible) {
|
||||||
|
int ambientIndicationBottomPadding = 0;
|
||||||
|
if (ambientTextVisible) {
|
||||||
|
int stackBottom = mNotificationStackScrollLayoutController.getView().getBottom();
|
||||||
|
ambientIndicationBottomPadding = stackBottom - ambientIndicationTop;
|
||||||
|
}
|
||||||
if (mAmbientIndicationBottomPadding != ambientIndicationBottomPadding) {
|
if (mAmbientIndicationBottomPadding != ambientIndicationBottomPadding) {
|
||||||
mAmbientIndicationBottomPadding = ambientIndicationBottomPadding;
|
mAmbientIndicationBottomPadding = ambientIndicationBottomPadding;
|
||||||
updateMaxDisplayedNotifications(true);
|
updateMaxDisplayedNotifications(true);
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ import static org.mockito.Mockito.when;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
import android.graphics.PointF;
|
import android.graphics.PointF;
|
||||||
|
import android.graphics.Rect;
|
||||||
import android.graphics.drawable.AnimatedStateListDrawable;
|
import android.graphics.drawable.AnimatedStateListDrawable;
|
||||||
import android.hardware.biometrics.BiometricSourceType;
|
import android.hardware.biometrics.BiometricSourceType;
|
||||||
import android.hardware.biometrics.SensorLocationInternal;
|
import android.hardware.biometrics.SensorLocationInternal;
|
||||||
@@ -39,10 +40,10 @@ import android.hardware.fingerprint.FingerprintSensorPropertiesInternal;
|
|||||||
import android.os.Vibrator;
|
import android.os.Vibrator;
|
||||||
import android.testing.AndroidTestingRunner;
|
import android.testing.AndroidTestingRunner;
|
||||||
import android.testing.TestableLooper;
|
import android.testing.TestableLooper;
|
||||||
import android.util.DisplayMetrics;
|
|
||||||
import android.util.Pair;
|
import android.util.Pair;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
import android.view.WindowManager;
|
||||||
import android.view.accessibility.AccessibilityManager;
|
import android.view.accessibility.AccessibilityManager;
|
||||||
|
|
||||||
import androidx.test.filters.SmallTest;
|
import androidx.test.filters.SmallTest;
|
||||||
@@ -70,6 +71,7 @@ import com.airbnb.lottie.LottieAnimationView;
|
|||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
|
import org.mockito.Answers;
|
||||||
import org.mockito.ArgumentCaptor;
|
import org.mockito.ArgumentCaptor;
|
||||||
import org.mockito.Captor;
|
import org.mockito.Captor;
|
||||||
import org.mockito.Mock;
|
import org.mockito.Mock;
|
||||||
@@ -88,7 +90,7 @@ public class LockIconViewControllerTest extends SysuiTestCase {
|
|||||||
private @Mock AnimatedStateListDrawable mIconDrawable;
|
private @Mock AnimatedStateListDrawable mIconDrawable;
|
||||||
private @Mock Context mContext;
|
private @Mock Context mContext;
|
||||||
private @Mock Resources mResources;
|
private @Mock Resources mResources;
|
||||||
private @Mock DisplayMetrics mDisplayMetrics;
|
private @Mock(answer = Answers.RETURNS_DEEP_STUBS) WindowManager mWindowManager;
|
||||||
private @Mock StatusBarStateController mStatusBarStateController;
|
private @Mock StatusBarStateController mStatusBarStateController;
|
||||||
private @Mock KeyguardUpdateMonitor mKeyguardUpdateMonitor;
|
private @Mock KeyguardUpdateMonitor mKeyguardUpdateMonitor;
|
||||||
private @Mock KeyguardViewController mKeyguardViewController;
|
private @Mock KeyguardViewController mKeyguardViewController;
|
||||||
@@ -137,7 +139,9 @@ public class LockIconViewControllerTest extends SysuiTestCase {
|
|||||||
when(mLockIconView.getContext()).thenReturn(mContext);
|
when(mLockIconView.getContext()).thenReturn(mContext);
|
||||||
when(mLockIconView.findViewById(R.layout.udfps_aod_lock_icon)).thenReturn(mAodFp);
|
when(mLockIconView.findViewById(R.layout.udfps_aod_lock_icon)).thenReturn(mAodFp);
|
||||||
when(mContext.getResources()).thenReturn(mResources);
|
when(mContext.getResources()).thenReturn(mResources);
|
||||||
when(mResources.getDisplayMetrics()).thenReturn(mDisplayMetrics);
|
when(mContext.getSystemService(WindowManager.class)).thenReturn(mWindowManager);
|
||||||
|
Rect windowBounds = new Rect(0, 0, 800, 1200);
|
||||||
|
when(mWindowManager.getCurrentWindowMetrics().getBounds()).thenReturn(windowBounds);
|
||||||
when(mResources.getString(R.string.accessibility_unlock_button)).thenReturn(UNLOCKED_LABEL);
|
when(mResources.getString(R.string.accessibility_unlock_button)).thenReturn(UNLOCKED_LABEL);
|
||||||
when(mResources.getDrawable(anyInt(), any())).thenReturn(mIconDrawable);
|
when(mResources.getDrawable(anyInt(), any())).thenReturn(mIconDrawable);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user