Merge "Add a comprehensive test for Notification.visitUris()" into udc-dev
diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java
index 73c29d4..867dafe 100644
--- a/core/java/android/provider/Settings.java
+++ b/core/java/android/provider/Settings.java
@@ -5453,6 +5453,14 @@
public static final String SHOW_TOUCHES = "show_touches";
/**
+ * Show key presses and other events dispatched to focused windows on the screen.
+ * 0 = no
+ * 1 = yes
+ * @hide
+ */
+ public static final String SHOW_KEY_PRESSES = "show_key_presses";
+
+ /**
* Log raw orientation data from
* {@link com.android.server.policy.WindowOrientationListener} for use with the
* orientationplot.py tool.
@@ -5842,6 +5850,7 @@
PRIVATE_SETTINGS.add(NOTIFICATION_LIGHT_PULSE);
PRIVATE_SETTINGS.add(POINTER_LOCATION);
PRIVATE_SETTINGS.add(SHOW_TOUCHES);
+ PRIVATE_SETTINGS.add(SHOW_KEY_PRESSES);
PRIVATE_SETTINGS.add(WINDOW_ORIENTATION_LISTENER_LOG);
PRIVATE_SETTINGS.add(POWER_SOUNDS_ENABLED);
PRIVATE_SETTINGS.add(DOCK_SOUNDS_ENABLED);
diff --git a/core/java/android/view/MotionEvent.java b/core/java/android/view/MotionEvent.java
index 3902989..1af8ca2 100644
--- a/core/java/android/view/MotionEvent.java
+++ b/core/java/android/view/MotionEvent.java
@@ -4167,6 +4167,40 @@
}
/**
+ * Get the x coordinate of the location where the pointer should be dispatched.
+ *
+ * This is required because a mouse event, such as from a touchpad, may contain multiple
+ * pointers that should all be dispatched to the cursor position.
+ * @hide
+ */
+ public float getXDispatchLocation(int pointerIndex) {
+ if (isFromSource(InputDevice.SOURCE_MOUSE)) {
+ final float xCursorPosition = getXCursorPosition();
+ if (xCursorPosition != INVALID_CURSOR_POSITION) {
+ return xCursorPosition;
+ }
+ }
+ return getX(pointerIndex);
+ }
+
+ /**
+ * Get the y coordinate of the location where the pointer should be dispatched.
+ *
+ * This is required because a mouse event, such as from a touchpad, may contain multiple
+ * pointers that should all be dispatched to the cursor position.
+ * @hide
+ */
+ public float getYDispatchLocation(int pointerIndex) {
+ if (isFromSource(InputDevice.SOURCE_MOUSE)) {
+ final float yCursorPosition = getYCursorPosition();
+ if (yCursorPosition != INVALID_CURSOR_POSITION) {
+ return yCursorPosition;
+ }
+ }
+ return getY(pointerIndex);
+ }
+
+ /**
* Transfer object for pointer coordinates.
*
* Objects of this type can be used to specify the pointer coordinates when
diff --git a/core/java/android/view/ViewGroup.java b/core/java/android/view/ViewGroup.java
index f5e4da8..d457847 100644
--- a/core/java/android/view/ViewGroup.java
+++ b/core/java/android/view/ViewGroup.java
@@ -2040,8 +2040,8 @@
@Override
public PointerIcon onResolvePointerIcon(MotionEvent event, int pointerIndex) {
- final float x = event.getX(pointerIndex);
- final float y = event.getY(pointerIndex);
+ final float x = event.getXDispatchLocation(pointerIndex);
+ final float y = event.getYDispatchLocation(pointerIndex);
if (isOnScrollbarThumb(x, y) || isDraggingScrollBar()) {
return PointerIcon.getSystemIcon(mContext, PointerIcon.TYPE_ARROW);
}
@@ -2125,8 +2125,8 @@
HoverTarget firstOldHoverTarget = mFirstHoverTarget;
mFirstHoverTarget = null;
if (!interceptHover && action != MotionEvent.ACTION_HOVER_EXIT) {
- final float x = event.getX();
- final float y = event.getY();
+ final float x = event.getXDispatchLocation(0);
+ final float y = event.getYDispatchLocation(0);
final int childrenCount = mChildrenCount;
if (childrenCount != 0) {
final ArrayList<View> preorderedList = buildOrderedChildList();
@@ -2347,8 +2347,8 @@
// Check what the child under the pointer says about the tooltip.
final int childrenCount = mChildrenCount;
if (childrenCount != 0) {
- final float x = event.getX();
- final float y = event.getY();
+ final float x = event.getXDispatchLocation(0);
+ final float y = event.getYDispatchLocation(0);
final ArrayList<View> preorderedList = buildOrderedChildList();
final boolean customOrder = preorderedList == null
@@ -2443,8 +2443,8 @@
@Override
protected boolean pointInHoveredChild(MotionEvent event) {
if (mFirstHoverTarget != null) {
- return isTransformedTouchPointInView(event.getX(), event.getY(),
- mFirstHoverTarget.child, null);
+ return isTransformedTouchPointInView(event.getXDispatchLocation(0),
+ event.getYDispatchLocation(0), mFirstHoverTarget.child, null);
}
return false;
}
@@ -2513,8 +2513,8 @@
public boolean onInterceptHoverEvent(MotionEvent event) {
if (event.isFromSource(InputDevice.SOURCE_MOUSE)) {
final int action = event.getAction();
- final float x = event.getX();
- final float y = event.getY();
+ final float x = event.getXDispatchLocation(0);
+ final float y = event.getYDispatchLocation(0);
if ((action == MotionEvent.ACTION_HOVER_MOVE
|| action == MotionEvent.ACTION_HOVER_ENTER) && isOnScrollbar(x, y)) {
return true;
@@ -2535,8 +2535,8 @@
// Send the event to the child under the pointer.
final int childrenCount = mChildrenCount;
if (childrenCount != 0) {
- final float x = event.getX();
- final float y = event.getY();
+ final float x = event.getXDispatchLocation(0);
+ final float y = event.getXDispatchLocation(0);
final ArrayList<View> preorderedList = buildOrderedChildList();
final boolean customOrder = preorderedList == null
@@ -2700,10 +2700,8 @@
final int childrenCount = mChildrenCount;
if (newTouchTarget == null && childrenCount != 0) {
- final float x =
- isMouseEvent ? ev.getXCursorPosition() : ev.getX(actionIndex);
- final float y =
- isMouseEvent ? ev.getYCursorPosition() : ev.getY(actionIndex);
+ final float x = ev.getXDispatchLocation(actionIndex);
+ final float y = ev.getYDispatchLocation(actionIndex);
// Find a child that can receive the event.
// Scan children from front to back.
final ArrayList<View> preorderedList = buildTouchDispatchChildList();
@@ -2757,8 +2755,8 @@
} else {
mLastTouchDownIndex = childIndex;
}
- mLastTouchDownX = ev.getX();
- mLastTouchDownY = ev.getY();
+ mLastTouchDownX = x;
+ mLastTouchDownY = y;
newTouchTarget = addTouchTarget(child, idBitsToAssign);
alreadyDispatchedToNewTouchTarget = true;
break;
@@ -3287,7 +3285,7 @@
if (ev.isFromSource(InputDevice.SOURCE_MOUSE)
&& ev.getAction() == MotionEvent.ACTION_DOWN
&& ev.isButtonPressed(MotionEvent.BUTTON_PRIMARY)
- && isOnScrollbarThumb(ev.getX(), ev.getY())) {
+ && isOnScrollbarThumb(ev.getXDispatchLocation(0), ev.getYDispatchLocation(0))) {
return true;
}
return false;
diff --git a/core/proto/android/providers/settings/system.proto b/core/proto/android/providers/settings/system.proto
index 7503dde4..48243f2 100644
--- a/core/proto/android/providers/settings/system.proto
+++ b/core/proto/android/providers/settings/system.proto
@@ -68,6 +68,7 @@
// orientationplot.py tool.
// 0 = no, 1 = yes
optional SettingProto window_orientation_listener_log = 3 [ (android.privacy).dest = DEST_AUTOMATIC ];
+ optional SettingProto show_key_presses = 4 [ (android.privacy).dest = DEST_AUTOMATIC ];
}
optional DevOptions developer_options = 7;
diff --git a/core/res/res/drawable/focus_event_pressed_key_background.xml b/core/res/res/drawable/focus_event_pressed_key_background.xml
new file mode 100644
index 0000000..e069f0b
--- /dev/null
+++ b/core/res/res/drawable/focus_event_pressed_key_background.xml
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright 2023 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.
+-->
+
+<shape xmlns:android="http://schemas.android.com/apk/res/android"
+ android:name="focus_event_pressed_key_background"
+ android:shape="rectangle">
+
+ <!-- View background color -->
+ <solid
+ android:color="#AA000000" >
+ </solid>
+
+ <!-- View border color and width -->
+ <stroke
+ android:width="2dp"
+ android:color="@android:color/white">
+ </stroke>
+
+ <!-- The radius makes the corners rounded -->
+ <corners
+ android:radius="8dp">
+ </corners>
+
+</shape>
\ No newline at end of file
diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml
index 5dcf284..312e291 100644
--- a/core/res/res/values/symbols.xml
+++ b/core/res/res/values/symbols.xml
@@ -5119,4 +5119,6 @@
<java-symbol type="style" name="ThemeOverlay.DeviceDefault.Accent" />
<java-symbol type="style" name="ThemeOverlay.DeviceDefault.Accent.Light" />
<java-symbol type="style" name="ThemeOverlay.DeviceDefault.Dark.ActionBar.Accent" />
+
+ <java-symbol type="drawable" name="focus_event_pressed_key_background" />
</resources>
diff --git a/core/tests/coretests/src/android/view/ViewGroupTest.java b/core/tests/coretests/src/android/view/ViewGroupTest.java
index 506cc2d..b37c8fd 100644
--- a/core/tests/coretests/src/android/view/ViewGroupTest.java
+++ b/core/tests/coretests/src/android/view/ViewGroupTest.java
@@ -20,6 +20,7 @@
import static org.junit.Assert.assertEquals;
import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.anyInt;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.spy;
@@ -87,6 +88,9 @@
viewGroup.dispatchTouchEvent(event);
verify(viewB).dispatchTouchEvent(event);
+ viewGroup.onResolvePointerIcon(event, 0 /* pointerIndex */);
+ verify(viewB).onResolvePointerIcon(event, 0);
+
event = MotionEvent.obtain(0 /* downTime */, 0 /* eventTime */,
MotionEvent.ACTION_POINTER_DOWN | (1 << MotionEvent.ACTION_POINTER_INDEX_SHIFT),
2 /* pointerCount */, properties, coords, 0 /* metaState */, 0 /* buttonState */,
@@ -95,7 +99,11 @@
viewGroup.dispatchTouchEvent(event);
verify(viewB).dispatchTouchEvent(event);
+ viewGroup.onResolvePointerIcon(event, 1 /* pointerIndex */);
+ verify(viewB).onResolvePointerIcon(event, 1);
+
verify(viewA, never()).dispatchTouchEvent(any());
+ verify(viewA, never()).onResolvePointerIcon(any(), anyInt());
}
/**
diff --git a/libs/WindowManager/Shell/res/drawable-night/reachability_education_ic_left_hand.xml b/libs/WindowManager/Shell/res/drawable-night/reachability_education_ic_left_hand.xml
new file mode 100644
index 0000000..fbcf6d7
--- /dev/null
+++ b/libs/WindowManager/Shell/res/drawable-night/reachability_education_ic_left_hand.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (C) 2023 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.
+ -->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="20dp"
+ android:height="20dp"
+ android:viewportWidth="960"
+ android:viewportHeight="960">
+ <group android:scaleX="-1" android:translateX="960">
+ <path
+ android:fillColor="?android:attr/textColorSecondary"
+ android:pathData="M432.46,48Q522,48 585,110.92Q648,173.83 648,264Q648,314 627.5,358.5Q607,403 566,432L528,432L528,370Q551,349 563.5,321.5Q576,294 576,263.78Q576,204.39 534,162.2Q492,120 432,120Q372,120 330,162Q288,204 288,264.31Q288,295 300,323Q312,351 336,370L336,456Q280,430 248,378Q216,326 216,264Q216,173.83 278.97,110.92Q341.94,48 432.46,48ZM414,864Q399.53,864 386.77,859Q374,854 363,843L144,624L211,557Q225,543 243,538Q261,533 279,538L336,552L336,288Q337,248 364.57,220Q392.14,192 432.07,192Q472,192 500,219.84Q528,247.68 528,288L528,432L576,432Q576,432 576,432Q576,432 576,432L715,497Q744,511 758,538Q772,565 767,596L737,802Q732,828 711.76,846Q691.52,864 666,864L414,864ZM414,792L666,792L698,569Q698,569 698,569Q698,569 698,569L559,504L456,504L456,288Q456,278 449,271Q442,264 432,264Q422,264 415,271Q408,278 408,288L408,644L262,608L246,624L414,792ZM666,792L414,792L414,792L414,792L414,792L414,792Q414,792 422,792Q430,792 439.5,792Q449,792 454.43,792Q459.86,792 459.86,792L459.86,792L529,792L666,792Q666,792 666,792Q666,792 666,792L666,792Z"/>
+ </group>
+</vector>
\ No newline at end of file
diff --git a/libs/WindowManager/Shell/res/drawable-night/reachability_education_ic_right_hand.xml b/libs/WindowManager/Shell/res/drawable-night/reachability_education_ic_right_hand.xml
new file mode 100644
index 0000000..d36df4b
--- /dev/null
+++ b/libs/WindowManager/Shell/res/drawable-night/reachability_education_ic_right_hand.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (C) 2023 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.
+ -->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="20dp"
+ android:height="20dp"
+ android:viewportWidth="960"
+ android:viewportHeight="960">
+ <path
+ android:fillColor="?android:attr/textColorSecondary"
+ android:pathData="M432.46,48Q522,48 585,110.92Q648,173.83 648,264Q648,314 627.5,358.5Q607,403 566,432L528,432L528,370Q551,349 563.5,321.5Q576,294 576,263.78Q576,204.39 534,162.2Q492,120 432,120Q372,120 330,162Q288,204 288,264.31Q288,295 300,323Q312,351 336,370L336,456Q280,430 248,378Q216,326 216,264Q216,173.83 278.97,110.92Q341.94,48 432.46,48ZM414,864Q399.53,864 386.77,859Q374,854 363,843L144,624L211,557Q225,543 243,538Q261,533 279,538L336,552L336,288Q337,248 364.57,220Q392.14,192 432.07,192Q472,192 500,219.84Q528,247.68 528,288L528,432L576,432Q576,432 576,432Q576,432 576,432L715,497Q744,511 758,538Q772,565 767,596L737,802Q732,828 711.76,846Q691.52,864 666,864L414,864ZM414,792L666,792L698,569Q698,569 698,569Q698,569 698,569L559,504L456,504L456,288Q456,278 449,271Q442,264 432,264Q422,264 415,271Q408,278 408,288L408,644L262,608L246,624L414,792ZM666,792L414,792L414,792L414,792L414,792L414,792Q414,792 422,792Q430,792 439.5,792Q449,792 454.43,792Q459.86,792 459.86,792L459.86,792L529,792L666,792Q666,792 666,792Q666,792 666,792L666,792Z"/>
+</vector>
\ No newline at end of file
diff --git a/libs/WindowManager/Shell/res/drawable/reachability_education_ic_left_hand.xml b/libs/WindowManager/Shell/res/drawable/reachability_education_ic_left_hand.xml
index 029d838..05d243d 100644
--- a/libs/WindowManager/Shell/res/drawable/reachability_education_ic_left_hand.xml
+++ b/libs/WindowManager/Shell/res/drawable/reachability_education_ic_left_hand.xml
@@ -18,11 +18,10 @@
android:width="20dp"
android:height="20dp"
android:viewportWidth="960"
- android:viewportHeight="960"
- android:tint="?attr/colorControlNormal">
+ android:viewportHeight="960">
<group android:scaleX="-1" android:translateX="960">
<path
- android:fillColor="?android:attr/textColorSecondary"
+ android:fillColor="?android:attr/textColorSecondaryInverse"
android:pathData="M432.46,48Q522,48 585,110.92Q648,173.83 648,264Q648,314 627.5,358.5Q607,403 566,432L528,432L528,370Q551,349 563.5,321.5Q576,294 576,263.78Q576,204.39 534,162.2Q492,120 432,120Q372,120 330,162Q288,204 288,264.31Q288,295 300,323Q312,351 336,370L336,456Q280,430 248,378Q216,326 216,264Q216,173.83 278.97,110.92Q341.94,48 432.46,48ZM414,864Q399.53,864 386.77,859Q374,854 363,843L144,624L211,557Q225,543 243,538Q261,533 279,538L336,552L336,288Q337,248 364.57,220Q392.14,192 432.07,192Q472,192 500,219.84Q528,247.68 528,288L528,432L576,432Q576,432 576,432Q576,432 576,432L715,497Q744,511 758,538Q772,565 767,596L737,802Q732,828 711.76,846Q691.52,864 666,864L414,864ZM414,792L666,792L698,569Q698,569 698,569Q698,569 698,569L559,504L456,504L456,288Q456,278 449,271Q442,264 432,264Q422,264 415,271Q408,278 408,288L408,644L262,608L246,624L414,792ZM666,792L414,792L414,792L414,792L414,792L414,792Q414,792 422,792Q430,792 439.5,792Q449,792 454.43,792Q459.86,792 459.86,792L459.86,792L529,792L666,792Q666,792 666,792Q666,792 666,792L666,792Z"/>
</group>
</vector>
\ No newline at end of file
diff --git a/libs/WindowManager/Shell/res/drawable/reachability_education_ic_right_hand.xml b/libs/WindowManager/Shell/res/drawable/reachability_education_ic_right_hand.xml
index 592f899..7bf243f 100644
--- a/libs/WindowManager/Shell/res/drawable/reachability_education_ic_right_hand.xml
+++ b/libs/WindowManager/Shell/res/drawable/reachability_education_ic_right_hand.xml
@@ -18,9 +18,8 @@
android:width="20dp"
android:height="20dp"
android:viewportWidth="960"
- android:viewportHeight="960"
- android:tint="?attr/colorControlNormal">
+ android:viewportHeight="960">
<path
- android:fillColor="?android:attr/textColorSecondary"
+ android:fillColor="?android:attr/textColorSecondaryInverse"
android:pathData="M432.46,48Q522,48 585,110.92Q648,173.83 648,264Q648,314 627.5,358.5Q607,403 566,432L528,432L528,370Q551,349 563.5,321.5Q576,294 576,263.78Q576,204.39 534,162.2Q492,120 432,120Q372,120 330,162Q288,204 288,264.31Q288,295 300,323Q312,351 336,370L336,456Q280,430 248,378Q216,326 216,264Q216,173.83 278.97,110.92Q341.94,48 432.46,48ZM414,864Q399.53,864 386.77,859Q374,854 363,843L144,624L211,557Q225,543 243,538Q261,533 279,538L336,552L336,288Q337,248 364.57,220Q392.14,192 432.07,192Q472,192 500,219.84Q528,247.68 528,288L528,432L576,432Q576,432 576,432Q576,432 576,432L715,497Q744,511 758,538Q772,565 767,596L737,802Q732,828 711.76,846Q691.52,864 666,864L414,864ZM414,792L666,792L698,569Q698,569 698,569Q698,569 698,569L559,504L456,504L456,288Q456,278 449,271Q442,264 432,264Q422,264 415,271Q408,278 408,288L408,644L262,608L246,624L414,792ZM666,792L414,792L414,792L414,792L414,792L414,792Q414,792 422,792Q430,792 439.5,792Q449,792 454.43,792Q459.86,792 459.86,792L459.86,792L529,792L666,792Q666,792 666,792Q666,792 666,792L666,792Z"/>
</vector>
\ No newline at end of file
diff --git a/libs/WindowManager/Shell/res/values-night/styles.xml b/libs/WindowManager/Shell/res/values-night/styles.xml
new file mode 100644
index 0000000..758c99d
--- /dev/null
+++ b/libs/WindowManager/Shell/res/values-night/styles.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (C) 2023 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 xmlns:android="http://schemas.android.com/apk/res/android">
+
+ <style name="ReachabilityEduHandLayout">
+ <item name="android:focusable">false</item>
+ <item name="android:focusableInTouchMode">false</item>
+ <item name="android:background">@android:color/transparent</item>
+ <item name="android:contentDescription">@string/restart_button_description</item>
+ <item name="android:visibility">invisible</item>
+ <item name="android:lineSpacingExtra">-1sp</item>
+ <item name="android:textSize">12sp</item>
+ <item name="android:textAlignment">center</item>
+ <item name="android:textColor">?android:attr/textColorPrimary</item>
+ <item name="android:textAppearance">
+ @*android:style/TextAppearance.DeviceDefault.Body2
+ </item>
+ </style>
+
+</resources>
\ No newline at end of file
diff --git a/libs/WindowManager/Shell/res/values/styles.xml b/libs/WindowManager/Shell/res/values/styles.xml
index ee80c472..2b38888 100644
--- a/libs/WindowManager/Shell/res/values/styles.xml
+++ b/libs/WindowManager/Shell/res/values/styles.xml
@@ -160,7 +160,7 @@
<item name="android:lineSpacingExtra">-1sp</item>
<item name="android:textSize">12sp</item>
<item name="android:textAlignment">center</item>
- <item name="android:textColor">?android:attr/textColorSecondary</item>
+ <item name="android:textColor">?android:attr/textColorPrimaryInverse</item>
<item name="android:textAppearance">
@*android:style/TextAppearance.DeviceDefault.Body2
</item>
diff --git a/packages/SettingsProvider/src/android/provider/settings/validators/SystemSettingsValidators.java b/packages/SettingsProvider/src/android/provider/settings/validators/SystemSettingsValidators.java
index 85623b2..753c860 100644
--- a/packages/SettingsProvider/src/android/provider/settings/validators/SystemSettingsValidators.java
+++ b/packages/SettingsProvider/src/android/provider/settings/validators/SystemSettingsValidators.java
@@ -183,6 +183,7 @@
VALIDATORS.put(System.NOTIFICATION_LIGHT_PULSE, BOOLEAN_VALIDATOR);
VALIDATORS.put(System.POINTER_LOCATION, BOOLEAN_VALIDATOR);
VALIDATORS.put(System.SHOW_TOUCHES, BOOLEAN_VALIDATOR);
+ VALIDATORS.put(System.SHOW_KEY_PRESSES, BOOLEAN_VALIDATOR);
VALIDATORS.put(System.WINDOW_ORIENTATION_LISTENER_LOG, BOOLEAN_VALIDATOR);
VALIDATORS.put(System.LOCKSCREEN_SOUNDS_ENABLED, BOOLEAN_VALIDATOR);
VALIDATORS.put(System.LOCKSCREEN_DISABLED, BOOLEAN_VALIDATOR);
diff --git a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProtoDumpUtil.java b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProtoDumpUtil.java
index d3a9e91..1fd84c7 100644
--- a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProtoDumpUtil.java
+++ b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProtoDumpUtil.java
@@ -2778,6 +2778,9 @@
Settings.System.SHOW_TOUCHES,
SystemSettingsProto.DevOptions.SHOW_TOUCHES);
dumpSetting(s, p,
+ Settings.System.SHOW_KEY_PRESSES,
+ SystemSettingsProto.DevOptions.SHOW_KEY_PRESSES);
+ dumpSetting(s, p,
Settings.System.POINTER_LOCATION,
SystemSettingsProto.DevOptions.POINTER_LOCATION);
dumpSetting(s, p,
diff --git a/packages/SettingsProvider/test/src/android/provider/SettingsBackupTest.java b/packages/SettingsProvider/test/src/android/provider/SettingsBackupTest.java
index 2e49dd5..73123c2 100644
--- a/packages/SettingsProvider/test/src/android/provider/SettingsBackupTest.java
+++ b/packages/SettingsProvider/test/src/android/provider/SettingsBackupTest.java
@@ -77,7 +77,8 @@
Settings.System.SCREEN_BRIGHTNESS, // removed in P
Settings.System.SETUP_WIZARD_HAS_RUN, // Only used by SuW
Settings.System.SHOW_GTALK_SERVICE_STATUS, // candidate for backup?
- Settings.System.SHOW_TOUCHES, // bug?
+ Settings.System.SHOW_TOUCHES,
+ Settings.System.SHOW_KEY_PRESSES,
Settings.System.SIP_ADDRESS_ONLY, // value, not a setting
Settings.System.SIP_ALWAYS, // value, not a setting
Settings.System.SYSTEM_LOCALES, // bug?
diff --git a/packages/SystemUI/res/values/config.xml b/packages/SystemUI/res/values/config.xml
index 1252695..26d6875 100644
--- a/packages/SystemUI/res/values/config.xml
+++ b/packages/SystemUI/res/values/config.xml
@@ -892,5 +892,5 @@
<!-- Time (in ms) to delay the bouncer views from showing when passive auth may be used for
device entry. -->
- <integer name="primary_bouncer_passive_auth_delay">250</integer>
+ <integer name="primary_bouncer_passive_auth_delay">500</integer>
</resources>
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java
index a0db65c..9e208fd 100644
--- a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java
+++ b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java
@@ -3098,7 +3098,7 @@
Trace.beginSection("KeyguardViewMediator#onWakeAndUnlocking");
mWakeAndUnlocking = true;
- mKeyguardViewControllerLazy.get().notifyKeyguardAuthenticated(/* strongAuth */ false);
+ keyguardDone();
Trace.endSection();
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/ShadeViewRefactor.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/ShadeViewRefactor.java
deleted file mode 100644
index 5ad2ba9..0000000
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/ShadeViewRefactor.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright (C) 2018 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
- */
-
-package com.android.systemui.statusbar.notification;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-
-@Retention(RetentionPolicy.SOURCE)
-public @interface ShadeViewRefactor {
- /**
- * Returns the refactor component.
- * @return the refactor component.
- */
- RefactorComponent value();
-
- public enum RefactorComponent {
- ADAPTER,
- LAYOUT_ALGORITHM,
- STATE_RESOLVER,
- DECORATOR,
- INPUT,
- COORDINATOR,
- SHADE_VIEW
- }
-}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationSection.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationSection.java
index 9a33a94..2d0395a 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationSection.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationSection.java
@@ -27,7 +27,6 @@
import android.view.animation.Interpolator;
import com.android.app.animation.Interpolators;
-import com.android.systemui.statusbar.notification.ShadeViewRefactor;
import com.android.systemui.statusbar.notification.row.ExpandableView;
/**
@@ -90,7 +89,6 @@
}
- @ShadeViewRefactor(ShadeViewRefactor.RefactorComponent.STATE_RESOLVER)
private void startTopAnimation(boolean animate) {
int previousEndValue = mEndAnimationRect.top;
int newEndValue = mBounds.top;
@@ -139,7 +137,6 @@
mTopAnimator = animator;
}
- @ShadeViewRefactor(ShadeViewRefactor.RefactorComponent.STATE_RESOLVER)
private void startBottomAnimation(boolean animate) {
int previousStartValue = mStartAnimationRect.bottom;
int previousEndValue = mEndAnimationRect.bottom;
@@ -188,13 +185,11 @@
mBottomAnimator = animator;
}
- @ShadeViewRefactor(ShadeViewRefactor.RefactorComponent.SHADE_VIEW)
private void setBackgroundTop(int top) {
mCurrentBounds.top = top;
mOwningView.invalidate();
}
- @ShadeViewRefactor(ShadeViewRefactor.RefactorComponent.SHADE_VIEW)
private void setBackgroundBottom(int bottom) {
mCurrentBounds.bottom = bottom;
mOwningView.invalidate();
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java
index cf051fb..b81cb2b 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java
@@ -101,8 +101,6 @@
import com.android.systemui.statusbar.notification.LaunchAnimationParameters;
import com.android.systemui.statusbar.notification.NotificationLaunchAnimatorController;
import com.android.systemui.statusbar.notification.NotificationUtils;
-import com.android.systemui.statusbar.notification.ShadeViewRefactor;
-import com.android.systemui.statusbar.notification.ShadeViewRefactor.RefactorComponent;
import com.android.systemui.statusbar.notification.collection.NotificationEntry;
import com.android.systemui.statusbar.notification.collection.render.GroupExpansionManager;
import com.android.systemui.statusbar.notification.collection.render.GroupMembershipManager;
@@ -679,7 +677,6 @@
}
@Override
- @ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
protected void onFinishInflate() {
super.onFinishInflate();
@@ -740,7 +737,6 @@
}
@VisibleForTesting
- @ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
public void updateFooter() {
if (mFooterView == null) {
return;
@@ -773,12 +769,10 @@
/**
* Return whether there are any clearable notifications
*/
- @ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
boolean hasActiveClearableNotifications(@SelectedRows int selection) {
return mController.hasActiveClearableNotifications(selection);
}
- @ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
public NotificationSwipeActionHelper getSwipeActionHelper() {
return mSwipeHelper;
}
@@ -795,7 +789,6 @@
}
}
- @ShadeViewRefactor(RefactorComponent.DECORATOR)
protected void onDraw(Canvas canvas) {
if (mShouldDrawNotificationBackground
&& (mSections[0].getCurrentBounds().top
@@ -892,7 +885,6 @@
return textY;
}
- @ShadeViewRefactor(RefactorComponent.DECORATOR)
private void drawBackground(Canvas canvas) {
int lockScreenLeft = mSidePaddings;
int lockScreenRight = getWidth() - mSidePaddings;
@@ -1020,7 +1012,6 @@
}
}
- @ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
void updateBackgroundDimming() {
// No need to update the background color if it's not being drawn.
if (!mShouldDrawNotificationBackground) {
@@ -1043,7 +1034,6 @@
initView(getContext(), mSwipeHelper, mNotificationStackSizeCalculator);
}
- @ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
void initView(Context context, NotificationSwipeHelper swipeHelper,
NotificationStackSizeCalculator notificationStackSizeCalculator) {
mScroller = new OverScroller(getContext());
@@ -1104,12 +1094,10 @@
}
}
- @ShadeViewRefactor(RefactorComponent.COORDINATOR)
private void notifyHeightChangeListener(ExpandableView view) {
notifyHeightChangeListener(view, false /* needsAnimation */);
}
- @ShadeViewRefactor(RefactorComponent.COORDINATOR)
private void notifyHeightChangeListener(ExpandableView view, boolean needsAnimation) {
if (mOnHeightChangedListener != null) {
mOnHeightChangedListener.onHeightChanged(view, needsAnimation);
@@ -1151,7 +1139,6 @@
}
@Override
- @ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
Trace.beginSection("NotificationStackScrollLayout#onMeasure");
if (SPEW) {
@@ -1185,7 +1172,6 @@
}
@Override
- @ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
protected void onLayout(boolean changed, int l, int t, int r, int b) {
// we layout all our children centered on the top
float centerX = getWidth() / 2.0f;
@@ -1216,7 +1202,6 @@
mAnimateStackYForContentHeightChange = false;
}
- @ShadeViewRefactor(RefactorComponent.STATE_RESOLVER)
private void requestAnimationOnViewResize(ExpandableNotificationRow row) {
if (mAnimationsEnabled && (mIsExpanded || row != null && row.isPinned())) {
mNeedViewResizeAnimation = true;
@@ -1224,19 +1209,16 @@
}
}
- @ShadeViewRefactor(RefactorComponent.STATE_RESOLVER)
public void setChildLocationsChangedListener(
NotificationLogger.OnChildLocationsChangedListener listener) {
mListener = listener;
}
- @ShadeViewRefactor(RefactorComponent.LAYOUT_ALGORITHM)
private void setMaxLayoutHeight(int maxLayoutHeight) {
mMaxLayoutHeight = maxLayoutHeight;
updateAlgorithmHeightAndPadding();
}
- @ShadeViewRefactor(RefactorComponent.LAYOUT_ALGORITHM)
private void updateAlgorithmHeightAndPadding() {
mAmbientState.setLayoutHeight(getLayoutHeight());
mAmbientState.setLayoutMaxHeight(mMaxLayoutHeight);
@@ -1244,7 +1226,6 @@
mAmbientState.setTopPadding(mTopPadding);
}
- @ShadeViewRefactor(RefactorComponent.LAYOUT_ALGORITHM)
private void updateAlgorithmLayoutMinHeight() {
mAmbientState.setLayoutMinHeight(mQsFullScreen || isHeadsUpTransition()
? getLayoutMinHeight() : 0);
@@ -1254,7 +1235,6 @@
* Updates the children views according to the stack scroll algorithm. Call this whenever
* modifications to {@link #mOwnScrollY} are performed to reflect it in the view layout.
*/
- @ShadeViewRefactor(RefactorComponent.STATE_RESOLVER)
private void updateChildren() {
updateScrollStateForAddedChildren();
mAmbientState.setCurrentScrollVelocity(mScroller.isFinished()
@@ -1268,7 +1248,6 @@
}
}
- @ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
private void onPreDrawDuringAnimation() {
mShelf.updateAppearance();
if (!mNeedsAnimation && !mChildrenUpdateRequested) {
@@ -1276,7 +1255,6 @@
}
}
- @ShadeViewRefactor(RefactorComponent.STATE_RESOLVER)
private void updateScrollStateForAddedChildren() {
if (mChildrenToAddAnimated.isEmpty()) {
return;
@@ -1297,7 +1275,6 @@
clampScrollPosition();
}
- @ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
private void updateForcedScroll() {
if (mForcedScroll != null && (!mForcedScroll.hasFocus()
|| !mForcedScroll.isAttachedToWindow())) {
@@ -1317,7 +1294,6 @@
}
}
- @ShadeViewRefactor(RefactorComponent.STATE_RESOLVER)
void requestChildrenUpdate() {
if (!mChildrenUpdateRequested) {
getViewTreeObserver().addOnPreDrawListener(mChildrenUpdater);
@@ -1326,12 +1302,10 @@
}
}
- @ShadeViewRefactor(RefactorComponent.STATE_RESOLVER)
private boolean isCurrentlyAnimating() {
return mStateAnimator.isRunning();
}
- @ShadeViewRefactor(RefactorComponent.COORDINATOR)
private void clampScrollPosition() {
int scrollRange = getScrollRange();
if (scrollRange < mOwnScrollY && !mAmbientState.isClearAllInProgress()) {
@@ -1342,12 +1316,10 @@
}
}
- @ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
public int getTopPadding() {
return mTopPadding;
}
- @ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
private void setTopPadding(int topPadding, boolean animate) {
if (mTopPadding != topPadding) {
boolean shouldAnimate = animate || mAnimateNextTopPaddingChange;
@@ -1469,7 +1441,6 @@
*
* @param height the expanded height of the panel
*/
- @ShadeViewRefactor(RefactorComponent.COORDINATOR)
public void setExpandedHeight(float height) {
final boolean skipHeightUpdate = shouldSkipHeightUpdate();
updateStackPosition();
@@ -1563,7 +1534,6 @@
}
}
- @ShadeViewRefactor(RefactorComponent.COORDINATOR)
private void setRequestedClipBounds(Rect clipRect) {
mRequestedClipBounds = clipRect;
updateClipping();
@@ -1572,12 +1542,10 @@
/**
* Return the height of the content ignoring the footer.
*/
- @ShadeViewRefactor(RefactorComponent.COORDINATOR)
public int getIntrinsicContentHeight() {
return (int) mIntrinsicContentHeight;
}
- @ShadeViewRefactor(RefactorComponent.STATE_RESOLVER)
public void updateClipping() {
boolean clipped = mRequestedClipBounds != null && !mInHeadsUpPinnedMode
&& !mHeadsUpAnimatingAway;
@@ -1603,7 +1571,6 @@
* @return The translation at the beginning when expanding.
* Measured relative to the resting position.
*/
- @ShadeViewRefactor(RefactorComponent.COORDINATOR)
private float getExpandTranslationStart() {
return -mTopPadding + getMinExpansionHeight() - mShelf.getIntrinsicHeight();
}
@@ -1612,7 +1579,6 @@
* @return the position from where the appear transition starts when expanding.
* Measured in absolute height.
*/
- @ShadeViewRefactor(RefactorComponent.COORDINATOR)
private float getAppearStartPosition() {
if (isHeadsUpTransition()) {
final NotificationSection firstVisibleSection = getFirstVisibleSection();
@@ -1629,7 +1595,6 @@
* intrinsic height, which also includes whether the notification is system expanded and
* is mainly used when dragging down from a heads up notification.
*/
- @ShadeViewRefactor(RefactorComponent.COORDINATOR)
private int getTopHeadsUpPinnedHeight() {
if (mTopHeadsUpEntry == null) {
return 0;
@@ -1649,7 +1614,6 @@
* @return the position from where the appear transition ends when expanding.
* Measured in absolute height.
*/
- @ShadeViewRefactor(RefactorComponent.COORDINATOR)
private float getAppearEndPosition() {
int appearPosition = mAmbientState.getStackTopMargin();
int visibleNotifCount = mController.getVisibleNotificationCount();
@@ -1670,13 +1634,11 @@
return appearPosition + (onKeyguard() ? mTopPadding : mIntrinsicPadding);
}
- @ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
private boolean isHeadsUpTransition() {
return mAmbientState.getTrackedHeadsUpRow() != null;
}
// TODO(b/246353296): remove it when Flags.SIMPLIFIED_APPEAR_FRACTION is removed
- @ShadeViewRefactor(RefactorComponent.COORDINATOR)
public float calculateAppearFractionOld(float height) {
float appearEndPosition = getAppearEndPosition();
float appearStartPosition = getAppearStartPosition();
@@ -1718,12 +1680,10 @@
}
}
- @ShadeViewRefactor(RefactorComponent.COORDINATOR)
public float getStackTranslation() {
return mStackTranslation;
}
- @ShadeViewRefactor(RefactorComponent.COORDINATOR)
private void setStackTranslation(float stackTranslation) {
if (stackTranslation != mStackTranslation) {
mStackTranslation = stackTranslation;
@@ -1738,17 +1698,14 @@
*
* @return either the layout height or the externally defined height, whichever is smaller
*/
- @ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
private int getLayoutHeight() {
return Math.min(mMaxLayoutHeight, mCurrentStackHeight);
}
- @ShadeViewRefactor(RefactorComponent.ADAPTER)
public void setQsHeader(ViewGroup qsHeader) {
mQsHeader = qsHeader;
}
- @ShadeViewRefactor(RefactorComponent.ADAPTER)
public static boolean isPinnedHeadsUp(View v) {
if (v instanceof ExpandableNotificationRow) {
ExpandableNotificationRow row = (ExpandableNotificationRow) v;
@@ -1757,7 +1714,6 @@
return false;
}
- @ShadeViewRefactor(RefactorComponent.ADAPTER)
private boolean isHeadsUp(View v) {
if (v instanceof ExpandableNotificationRow) {
ExpandableNotificationRow row = (ExpandableNotificationRow) v;
@@ -1766,7 +1722,6 @@
return false;
}
- @ShadeViewRefactor(RefactorComponent.COORDINATOR)
private ExpandableView getChildAtPosition(float touchX, float touchY) {
return getChildAtPosition(
touchX, touchY, true /* requireMinHeight */, true /* ignoreDecors */);
@@ -1781,7 +1736,6 @@
* @param ignoreDecors Whether decors can be returned
* @return the child at the given location.
*/
- @ShadeViewRefactor(RefactorComponent.COORDINATOR)
ExpandableView getChildAtPosition(float touchX, float touchY,
boolean requireMinHeight, boolean ignoreDecors) {
// find the view under the pointer, accounting for GONE views
@@ -1829,12 +1783,10 @@
return getChildAtPosition(touchX - mTempInt2[0], touchY - mTempInt2[1]);
}
- @ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
public void setScrollingEnabled(boolean enable) {
mScrollingEnabled = enable;
}
- @ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
public void lockScrollTo(View v) {
if (mForcedScroll == v) {
return;
@@ -1847,7 +1799,6 @@
}
}
- @ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
public boolean scrollTo(View v) {
ExpandableView expandableView = (ExpandableView) v;
int positionInLinearLayout = getPositionInLinearLayout(v);
@@ -1869,7 +1820,6 @@
* @return the scroll necessary to make the bottom edge of {@param v} align with the top of
* the IME.
*/
- @ShadeViewRefactor(RefactorComponent.COORDINATOR)
private int targetScrollForView(ExpandableView v, int positionInLinearLayout) {
return positionInLinearLayout + v.getIntrinsicHeight() +
getImeInset() - getHeight()
@@ -1890,7 +1840,6 @@
}
@Override
- @ShadeViewRefactor(RefactorComponent.COORDINATOR)
public WindowInsets onApplyWindowInsets(WindowInsets insets) {
if (!mAnimatedInsets) {
mBottomInset = insets.getInsets(WindowInsets.Type.ime()).bottom;
@@ -1920,7 +1869,6 @@
return insets;
}
- @ShadeViewRefactor(RefactorComponent.STATE_RESOLVER)
private final Runnable mReclamp = new Runnable() {
@Override
public void run() {
@@ -1932,23 +1880,19 @@
}
};
- @ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
public void setExpandingEnabled(boolean enable) {
mExpandHelper.setEnabled(enable);
}
- @ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
private boolean isScrollingEnabled() {
return mScrollingEnabled;
}
- @ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
boolean onKeyguard() {
return mStatusBarState == StatusBarState.KEYGUARD;
}
@Override
- @ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
protected void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
Resources res = getResources();
@@ -1961,7 +1905,6 @@
reinitView();
}
- @ShadeViewRefactor(RefactorComponent.STATE_RESOLVER)
public void dismissViewAnimated(
View child, Consumer<Boolean> endRunnable, int delay, long duration) {
if (child instanceof SectionHeaderView) {
@@ -1979,7 +1922,6 @@
true /* isClearAll */);
}
- @ShadeViewRefactor(RefactorComponent.STATE_RESOLVER)
private void snapViewIfNeeded(NotificationEntry entry) {
ExpandableNotificationRow child = entry.getRow();
boolean animate = mIsExpanded || isPinnedHeadsUp(child);
@@ -1990,7 +1932,6 @@
}
}
- @ShadeViewRefactor(RefactorComponent.ADAPTER)
public ViewGroup getViewParentForNotification(NotificationEntry entry) {
return this;
}
@@ -2002,7 +1943,6 @@
* @return The amount of scrolling to be performed by the scroller,
* not handled by the overScroll amount.
*/
- @ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
private float overScrollUp(int deltaY, int range) {
deltaY = Math.max(deltaY, 0);
float currentTopAmount = getCurrentOverScrollAmount(true);
@@ -2036,7 +1976,6 @@
* @return The amount of scrolling to be performed by the scroller,
* not handled by the overScroll amount.
*/
- @ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
private float overScrollDown(int deltaY) {
deltaY = Math.min(deltaY, 0);
float currentBottomAmount = getCurrentOverScrollAmount(false);
@@ -2061,14 +2000,12 @@
return scrollAmount;
}
- @ShadeViewRefactor(RefactorComponent.STATE_RESOLVER)
private void initVelocityTrackerIfNotExists() {
if (mVelocityTracker == null) {
mVelocityTracker = VelocityTracker.obtain();
}
}
- @ShadeViewRefactor(RefactorComponent.STATE_RESOLVER)
private void recycleVelocityTracker() {
if (mVelocityTracker != null) {
mVelocityTracker.recycle();
@@ -2076,7 +2013,6 @@
}
}
- @ShadeViewRefactor(RefactorComponent.STATE_RESOLVER)
private void initOrResetVelocityTracker() {
if (mVelocityTracker == null) {
mVelocityTracker = VelocityTracker.obtain();
@@ -2085,12 +2021,10 @@
}
}
- @ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
public void setFinishScrollingCallback(Runnable runnable) {
mFinishScrollingCallback = runnable;
}
- @ShadeViewRefactor(RefactorComponent.STATE_RESOLVER)
private void animateScroll() {
if (mScroller.computeScrollOffset()) {
int oldY = mOwnScrollY;
@@ -2139,7 +2073,6 @@
* @param scrollRangeY The maximum allowable scroll position (absolute scrolling only).
* @param maxOverScrollY The current (unsigned) limit on number of pixels to overscroll by.
*/
- @ShadeViewRefactor(RefactorComponent.STATE_RESOLVER)
private void customOverScrollBy(int deltaY, int scrollY, int scrollRangeY, int maxOverScrollY) {
int newScrollY = scrollY + deltaY;
final int top = -maxOverScrollY;
@@ -2167,7 +2100,6 @@
* @param onTop Should the effect be applied on top of the scroller.
* @param animate Should an animation be performed.
*/
- @ShadeViewRefactor(RefactorComponent.STATE_RESOLVER)
public void setOverScrolledPixels(float numPixels, boolean onTop, boolean animate) {
setOverScrollAmount(numPixels * getRubberBandFactor(onTop), onTop, animate, true);
}
@@ -2181,7 +2113,6 @@
* @param animate Should an animation be performed.
*/
- @ShadeViewRefactor(RefactorComponent.STATE_RESOLVER)
public void setOverScrollAmount(float amount, boolean onTop, boolean animate) {
setOverScrollAmount(amount, onTop, animate, true);
}
@@ -2194,7 +2125,6 @@
* @param animate Should an animation be performed.
* @param cancelAnimators Should running animations be cancelled.
*/
- @ShadeViewRefactor(RefactorComponent.STATE_RESOLVER)
public void setOverScrollAmount(float amount, boolean onTop, boolean animate,
boolean cancelAnimators) {
setOverScrollAmount(amount, onTop, animate, cancelAnimators, isRubberbanded(onTop));
@@ -2210,7 +2140,6 @@
* @param isRubberbanded The value which will be passed to
* {@link OnOverscrollTopChangedListener#onOverscrollTopChanged}
*/
- @ShadeViewRefactor(RefactorComponent.STATE_RESOLVER)
public void setOverScrollAmount(float amount, boolean onTop, boolean animate,
boolean cancelAnimators, boolean isRubberbanded) {
if (cancelAnimators) {
@@ -2219,7 +2148,6 @@
setOverScrollAmountInternal(amount, onTop, animate, isRubberbanded);
}
- @ShadeViewRefactor(RefactorComponent.STATE_RESOLVER)
private void setOverScrollAmountInternal(float amount, boolean onTop, boolean animate,
boolean isRubberbanded) {
amount = Math.max(0, amount);
@@ -2236,7 +2164,6 @@
}
}
- @ShadeViewRefactor(RefactorComponent.COORDINATOR)
private void notifyOverscrollTopListener(float amount, boolean isRubberbanded) {
mExpandHelper.onlyObserveMovements(amount > 1.0f);
if (mDontReportNextOverScroll) {
@@ -2248,23 +2175,19 @@
}
}
- @ShadeViewRefactor(RefactorComponent.COORDINATOR)
public void setOverscrollTopChangedListener(
OnOverscrollTopChangedListener overscrollTopChangedListener) {
mOverscrollTopChangedListener = overscrollTopChangedListener;
}
- @ShadeViewRefactor(RefactorComponent.COORDINATOR)
public float getCurrentOverScrollAmount(boolean top) {
return mAmbientState.getOverScrollAmount(top);
}
- @ShadeViewRefactor(RefactorComponent.COORDINATOR)
public float getCurrentOverScrolledPixels(boolean top) {
return top ? mOverScrolledTopPixels : mOverScrolledBottomPixels;
}
- @ShadeViewRefactor(RefactorComponent.COORDINATOR)
private void setOverScrolledPixels(float amount, boolean onTop) {
if (onTop) {
mOverScrolledTopPixels = amount;
@@ -2281,7 +2204,6 @@
* @param clampedY Whether this value was clamped by the calling method, meaning we've reached
* the overscroll limit.
*/
- @ShadeViewRefactor(RefactorComponent.COORDINATOR)
private void onCustomOverScrolled(int scrollY, boolean clampedY) {
// Treat animating scrolls differently; see #computeScroll() for why.
if (!mScroller.isFinished()) {
@@ -2305,7 +2227,6 @@
* Springs back from an overscroll by stopping the {@link #mScroller} and animating the
* overscroll amount back to zero.
*/
- @ShadeViewRefactor(RefactorComponent.STATE_RESOLVER)
private void springBack() {
int scrollRange = getScrollRange();
boolean overScrolledTop = mOwnScrollY <= 0;
@@ -2329,7 +2250,6 @@
}
}
- @ShadeViewRefactor(RefactorComponent.COORDINATOR)
private int getScrollRange() {
// In current design, it only use the top HUN to treat all of HUNs
// although there are more than one HUNs
@@ -2346,7 +2266,6 @@
return scrollRange;
}
- @ShadeViewRefactor(RefactorComponent.COORDINATOR)
private int getImeInset() {
// The NotificationStackScrollLayout does not extend all the way to the bottom of the
// display. Therefore, subtract that space from the mBottomInset, in order to only include
@@ -2358,7 +2277,6 @@
/**
* @return the first child which has visibility unequal to GONE
*/
- @ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
public ExpandableView getFirstChildNotGone() {
int childCount = getChildCount();
for (int i = 0; i < childCount; i++) {
@@ -2374,7 +2292,6 @@
* @return The first child which has visibility unequal to GONE which is currently below the
* given translationY or equal to it.
*/
- @ShadeViewRefactor(RefactorComponent.COORDINATOR)
private View getFirstChildBelowTranlsationY(float translationY, boolean ignoreChildren) {
int childCount = getChildCount();
for (int i = 0; i < childCount; i++) {
@@ -2406,7 +2323,6 @@
/**
* @return the last child which has visibility unequal to GONE
*/
- @ShadeViewRefactor(RefactorComponent.COORDINATOR)
public ExpandableView getLastChildNotGone() {
int childCount = getChildCount();
for (int i = childCount - 1; i >= 0; i--) {
@@ -2432,7 +2348,6 @@
/**
* @return the number of children which have visibility unequal to GONE
*/
- @ShadeViewRefactor(RefactorComponent.COORDINATOR)
public int getNotGoneChildCount() {
int childCount = getChildCount();
int count = 0;
@@ -2445,7 +2360,6 @@
return count;
}
- @ShadeViewRefactor(RefactorComponent.STATE_RESOLVER)
private void updateContentHeight() {
final float scrimTopPadding = mAmbientState.isOnKeyguard() ? 0 : mMinimumPaddings;
final int shelfIntrinsicHeight = mShelf != null ? mShelf.getIntrinsicHeight() : 0;
@@ -2481,12 +2395,10 @@
previous, mAmbientState.getFractionToShade(), mAmbientState.isOnKeyguard());
}
- @ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
public boolean hasPulsingNotifications() {
return mPulsing;
}
- @ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
private void updateScrollability() {
boolean scrollable = !mQsFullScreen && getScrollRange() > 0;
if (scrollable != mScrollable) {
@@ -2496,7 +2408,6 @@
}
}
- @ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
private void updateForwardAndBackwardScrollability() {
boolean forwardScrollable = mScrollable && !mScrollAdapter.isScrolledToBottom();
boolean backwardsScrollable = mScrollable && !mScrollAdapter.isScrolledToTop();
@@ -2509,7 +2420,6 @@
}
}
- @ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
private void updateBackground() {
// No need to update the background color if it's not being drawn.
if (!mShouldDrawNotificationBackground) {
@@ -2540,7 +2450,6 @@
mAnimateNextSectionBoundsChange = false;
}
- @ShadeViewRefactor(RefactorComponent.STATE_RESOLVER)
private void abortBackgroundAnimators() {
for (NotificationSection section : mSections) {
section.cancelAnimators();
@@ -2556,7 +2465,6 @@
return false;
}
- @ShadeViewRefactor(RefactorComponent.STATE_RESOLVER)
private boolean areSectionBoundsAnimating() {
for (NotificationSection section : mSections) {
if (section.areBoundsAnimating()) {
@@ -2566,7 +2474,6 @@
return false;
}
- @ShadeViewRefactor(RefactorComponent.STATE_RESOLVER)
private void startBackgroundAnimation() {
// TODO(kprevas): do we still need separate fields for top/bottom?
// or can each section manage its own animation state?
@@ -2586,7 +2493,6 @@
/**
* Update the background bounds to the new desired bounds
*/
- @ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
private void updateBackgroundBounds() {
int left = mSidePaddings;
int right = getWidth() - mSidePaddings;
@@ -2652,7 +2558,6 @@
return null;
}
- @ShadeViewRefactor(RefactorComponent.COORDINATOR)
private ExpandableView getLastChildWithBackground() {
int childCount = getChildCount();
for (int i = childCount - 1; i >= 0; i--) {
@@ -2665,7 +2570,6 @@
return null;
}
- @ShadeViewRefactor(RefactorComponent.COORDINATOR)
private ExpandableView getFirstChildWithBackground() {
int childCount = getChildCount();
for (int i = 0; i < childCount; i++) {
@@ -2700,7 +2604,6 @@
* numbers mean that the finger/cursor is moving down the screen,
* which means we want to scroll towards the top.
*/
- @ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
protected void fling(int velocityY) {
if (getChildCount() > 0) {
float topAmount = getCurrentOverScrollAmount(true);
@@ -2739,7 +2642,6 @@
* @return Whether a fling performed on the top overscroll edge lead to the expanded
* overScroll view (i.e QS).
*/
- @ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
private boolean shouldOverScrollFling(int initialVelocity) {
float topOverScroll = getCurrentOverScrollAmount(true);
return mScrolledToTopOnFirstDown
@@ -2756,7 +2658,6 @@
* @param qsHeight the top padding imposed by the quick settings panel
* @param animate whether to animate the change
*/
- @ShadeViewRefactor(RefactorComponent.COORDINATOR)
public void updateTopPadding(float qsHeight, boolean animate) {
int topPadding = (int) qsHeight;
int minStackHeight = getLayoutMinHeight();
@@ -2769,12 +2670,10 @@
setExpandedHeight(mExpandedHeight);
}
- @ShadeViewRefactor(RefactorComponent.COORDINATOR)
public void setMaxTopPadding(int maxTopPadding) {
mMaxTopPadding = maxTopPadding;
}
- @ShadeViewRefactor(RefactorComponent.COORDINATOR)
public int getLayoutMinHeight() {
if (isHeadsUpTransition()) {
ExpandableNotificationRow trackedHeadsUpRow = mAmbientState.getTrackedHeadsUpRow();
@@ -2791,17 +2690,14 @@
return mShelf.getVisibility() == GONE ? 0 : mShelf.getIntrinsicHeight();
}
- @ShadeViewRefactor(RefactorComponent.COORDINATOR)
public float getTopPaddingOverflow() {
return mTopPaddingOverflow;
}
- @ShadeViewRefactor(RefactorComponent.COORDINATOR)
private int clampPadding(int desiredPadding) {
return Math.max(desiredPadding, mIntrinsicPadding);
}
- @ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
private float getRubberBandFactor(boolean onTop) {
if (!onTop) {
return RUBBER_BAND_FACTOR_NORMAL;
@@ -2821,14 +2717,12 @@
* rubberbanded, false if it is technically an overscroll but rather a motion to expand the
* overscroll view (e.g. expand QS).
*/
- @ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
private boolean isRubberbanded(boolean onTop) {
return !onTop || mExpandedInThisMotion || mIsExpansionChanging || mPanelTracking
|| !mScrolledToTopOnFirstDown;
}
- @ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
public void setChildTransferInProgress(boolean childTransferInProgress) {
Assert.isMainThread();
mChildTransferInProgress = childTransferInProgress;
@@ -2843,7 +2737,6 @@
mOnNotificationRemovedListener = listener;
}
- @ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
@Override
public void onViewRemoved(View child) {
super.onViewRemoved(child);
@@ -2864,7 +2757,6 @@
}
}
- @ShadeViewRefactor(RefactorComponent.STATE_RESOLVER)
public void cleanUpViewStateForEntry(NotificationEntry entry) {
View child = entry.getRow();
if (child == mSwipeHelper.getTranslatingParentView()) {
@@ -2872,7 +2764,6 @@
}
}
- @ShadeViewRefactor(RefactorComponent.COORDINATOR)
private void onViewRemovedInternal(ExpandableView child, ViewGroup container) {
if (mChangePositionInProgress) {
// This is only a position change, don't do anything special
@@ -2909,7 +2800,6 @@
return Math.abs(child.getTranslation()) >= Math.abs(getTotalTranslationLength(child));
}
- @ShadeViewRefactor(RefactorComponent.STATE_RESOLVER)
private void focusNextViewIfFocused(View view) {
if (view instanceof ExpandableNotificationRow) {
ExpandableNotificationRow row = (ExpandableNotificationRow) view;
@@ -2929,7 +2819,6 @@
}
- @ShadeViewRefactor(RefactorComponent.ADAPTER)
private boolean isChildInGroup(View child) {
return child instanceof ExpandableNotificationRow
&& mGroupMembershipManager.isChildInGroup(
@@ -2942,7 +2831,6 @@
* @param child The view to generate the remove animation for.
* @return Whether an animation was generated.
*/
- @ShadeViewRefactor(RefactorComponent.STATE_RESOLVER)
boolean generateRemoveAnimation(ExpandableView child) {
String key = "";
if (mDebugRemoveAnimation) {
@@ -2986,7 +2874,6 @@
return false;
}
- @ShadeViewRefactor(RefactorComponent.ADAPTER)
private boolean isClickedHeadsUp(View child) {
return HeadsUpUtil.isClickedHeadsUpNotification(child);
}
@@ -2996,7 +2883,6 @@
*
* @return whether any child was removed from the list to animate and the view was just added
*/
- @ShadeViewRefactor(RefactorComponent.STATE_RESOLVER)
private boolean removeRemovedChildFromHeadsUpChangeAnimations(View child) {
boolean hasAddEvent = false;
for (Pair<ExpandableNotificationRow, Boolean> eventPair : mHeadsUpChangeAnimations) {
@@ -3021,7 +2907,6 @@
*
* @param removedChild the removed child
*/
- @ShadeViewRefactor(RefactorComponent.STATE_RESOLVER)
private void updateScrollStateForRemovedChild(ExpandableView removedChild) {
final int startingPosition = getPositionInLinearLayout(removedChild);
final int childHeight = getIntrinsicHeight(removedChild) + mPaddingBetweenElements;
@@ -3050,7 +2935,6 @@
return mTopPadding - mQsScrollBoundaryPosition;
}
- @ShadeViewRefactor(RefactorComponent.COORDINATOR)
private int getIntrinsicHeight(View view) {
if (view instanceof ExpandableView) {
ExpandableView expandableView = (ExpandableView) view;
@@ -3059,7 +2943,6 @@
return view.getHeight();
}
- @ShadeViewRefactor(RefactorComponent.COORDINATOR)
public int getPositionInLinearLayout(View requestedView) {
ExpandableNotificationRow childInGroup = null;
ExpandableNotificationRow requestedRow = null;
@@ -3100,7 +2983,6 @@
}
@Override
- @ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
public void onViewAdded(View child) {
super.onViewAdded(child);
if (child instanceof ExpandableView) {
@@ -3108,7 +2990,6 @@
}
}
- @ShadeViewRefactor(RefactorComponent.STATE_RESOLVER)
private void updateFirstAndLastBackgroundViews() {
NotificationSection firstSection = getFirstVisibleSection();
NotificationSection lastSection = getLastVisibleSection();
@@ -3136,7 +3017,6 @@
invalidate();
}
- @ShadeViewRefactor(RefactorComponent.COORDINATOR)
private void onViewAddedInternal(ExpandableView child) {
updateHideSensitiveForChild(child);
child.setOnHeightChangedListener(mOnChildHeightChangedListener);
@@ -3154,12 +3034,10 @@
}
}
- @ShadeViewRefactor(RefactorComponent.COORDINATOR)
private void updateHideSensitiveForChild(ExpandableView child) {
child.setHideSensitiveForIntrinsicHeight(mAmbientState.isHideSensitive());
}
- @ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
public void notifyGroupChildRemoved(ExpandableView row, ViewGroup childrenContainer) {
onViewRemovedInternal(row, childrenContainer);
}
@@ -3168,7 +3046,6 @@
onViewAddedInternal(row);
}
- @ShadeViewRefactor(RefactorComponent.STATE_RESOLVER)
public void setAnimationsEnabled(boolean animationsEnabled) {
mAnimationsEnabled = animationsEnabled;
updateNotificationAnimationStates();
@@ -3179,7 +3056,6 @@
}
}
- @ShadeViewRefactor(RefactorComponent.STATE_RESOLVER)
private void updateNotificationAnimationStates() {
boolean running = mAnimationsEnabled || hasPulsingNotifications();
mShelf.setAnimationsEnabled(running);
@@ -3191,13 +3067,11 @@
}
}
- @ShadeViewRefactor(RefactorComponent.STATE_RESOLVER)
void updateAnimationState(View child) {
updateAnimationState((mAnimationsEnabled || hasPulsingNotifications())
&& (mIsExpanded || isPinnedHeadsUp(child)), child);
}
- @ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
void setExpandingNotification(ExpandableNotificationRow row) {
if (mExpandingNotificationRow != null && row == null) {
// Let's unset the clip path being set during launch
@@ -3216,7 +3090,6 @@
return v.getParent() == this;
}
- @ShadeViewRefactor(RefactorComponent.STATE_RESOLVER)
public void applyLaunchAnimationParams(LaunchAnimationParameters params) {
// Modify the clipping for launching notifications
mLaunchAnimationParams = params;
@@ -3225,7 +3098,6 @@
requestChildrenUpdate();
}
- @ShadeViewRefactor(RefactorComponent.STATE_RESOLVER)
private void updateAnimationState(boolean running, View child) {
if (child instanceof ExpandableNotificationRow) {
ExpandableNotificationRow row = (ExpandableNotificationRow) child;
@@ -3233,13 +3105,11 @@
}
}
- @ShadeViewRefactor(RefactorComponent.STATE_RESOLVER)
boolean isAddOrRemoveAnimationPending() {
return mNeedsAnimation
&& (!mChildrenToAddAnimated.isEmpty() || !mChildrenToRemoveAnimated.isEmpty());
}
- @ShadeViewRefactor(RefactorComponent.STATE_RESOLVER)
public void generateAddAnimation(ExpandableView child, boolean fromMoreCard) {
if (mIsExpanded && mAnimationsEnabled && !mChangePositionInProgress && !isFullyHidden()) {
// Generate Animations
@@ -3256,7 +3126,6 @@
}
}
- @ShadeViewRefactor(RefactorComponent.STATE_RESOLVER)
public void changeViewPosition(ExpandableView child, int newIndex) {
Assert.isMainThread();
if (mChangePositionInProgress) {
@@ -3290,7 +3159,6 @@
}
}
- @ShadeViewRefactor(RefactorComponent.STATE_RESOLVER)
private void startAnimationToState() {
if (mNeedsAnimation) {
generateAllAnimationEvents();
@@ -3308,7 +3176,6 @@
mGoToFullShadeDelay = 0;
}
- @ShadeViewRefactor(RefactorComponent.STATE_RESOLVER)
private void generateAllAnimationEvents() {
generateHeadsUpAnimationEvents();
generateChildRemovalEvents();
@@ -3324,7 +3191,6 @@
generateAnimateEverythingEvent();
}
- @ShadeViewRefactor(RefactorComponent.STATE_RESOLVER)
private void generateHeadsUpAnimationEvents() {
for (Pair<ExpandableNotificationRow, Boolean> eventPair : mHeadsUpChangeAnimations) {
ExpandableNotificationRow row = eventPair.first;
@@ -3388,13 +3254,11 @@
mAddedHeadsUpChildren.clear();
}
- @ShadeViewRefactor(RefactorComponent.COORDINATOR)
private boolean shouldHunAppearFromBottom(ExpandableViewState viewState) {
return viewState.getYTranslation() + viewState.height
>= mAmbientState.getMaxHeadsUpTranslation();
}
- @ShadeViewRefactor(RefactorComponent.STATE_RESOLVER)
private void generateGroupExpansionEvent() {
// Generate a group expansion/collapsing event if there is such a group at all
if (mExpandedGroupView != null) {
@@ -3404,7 +3268,6 @@
}
}
- @ShadeViewRefactor(RefactorComponent.STATE_RESOLVER)
private void generateViewResizeEvent() {
if (mNeedViewResizeAnimation) {
boolean hasDisappearAnimation = false;
@@ -3425,7 +3288,6 @@
mNeedViewResizeAnimation = false;
}
- @ShadeViewRefactor(RefactorComponent.STATE_RESOLVER)
private void generateChildRemovalEvents() {
for (ExpandableView child : mChildrenToRemoveAnimated) {
boolean childWasSwipedOut = mSwipedOutViews.contains(child);
@@ -3473,7 +3335,6 @@
mChildrenToRemoveAnimated.clear();
}
- @ShadeViewRefactor(RefactorComponent.STATE_RESOLVER)
private void generatePositionChangeEvents() {
for (ExpandableView child : mChildrenChangingPositions) {
Integer duration = null;
@@ -3498,7 +3359,6 @@
}
}
- @ShadeViewRefactor(RefactorComponent.STATE_RESOLVER)
private void generateChildAdditionEvents() {
for (ExpandableView child : mChildrenToAddAnimated) {
if (mFromMoreCardAdditions.contains(child)) {
@@ -3514,7 +3374,6 @@
mFromMoreCardAdditions.clear();
}
- @ShadeViewRefactor(RefactorComponent.STATE_RESOLVER)
private void generateTopPaddingEvent() {
if (mTopPaddingNeedsAnimation) {
AnimationEvent event;
@@ -3531,7 +3390,6 @@
mTopPaddingNeedsAnimation = false;
}
- @ShadeViewRefactor(RefactorComponent.STATE_RESOLVER)
private void generateActivateEvent() {
if (mActivateNeedsAnimation) {
mAnimationEvents.add(
@@ -3540,7 +3398,6 @@
mActivateNeedsAnimation = false;
}
- @ShadeViewRefactor(RefactorComponent.STATE_RESOLVER)
private void generateAnimateEverythingEvent() {
if (mEverythingNeedsAnimation) {
mAnimationEvents.add(
@@ -3549,7 +3406,6 @@
mEverythingNeedsAnimation = false;
}
- @ShadeViewRefactor(RefactorComponent.STATE_RESOLVER)
private void generateDimmedEvent() {
if (mDimmedNeedsAnimation) {
mAnimationEvents.add(
@@ -3558,7 +3414,6 @@
mDimmedNeedsAnimation = false;
}
- @ShadeViewRefactor(RefactorComponent.STATE_RESOLVER)
private void generateHideSensitiveEvent() {
if (mHideSensitiveNeedsAnimation) {
mAnimationEvents.add(
@@ -3567,7 +3422,6 @@
mHideSensitiveNeedsAnimation = false;
}
- @ShadeViewRefactor(RefactorComponent.STATE_RESOLVER)
private void generateGoToFullShadeEvent() {
if (mGoToFullShadeNeedsAnimation) {
mAnimationEvents.add(
@@ -3576,7 +3430,6 @@
mGoToFullShadeNeedsAnimation = false;
}
- @ShadeViewRefactor(RefactorComponent.LAYOUT_ALGORITHM)
protected StackScrollAlgorithm createStackScrollAlgorithm(Context context) {
return new StackScrollAlgorithm(context, this);
}
@@ -3584,7 +3437,6 @@
/**
* @return Whether a y coordinate is inside the content.
*/
- @ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
public boolean isInContentBounds(float y) {
return y < getHeight() - getEmptyBottomMargin();
}
@@ -3605,7 +3457,6 @@
return super.onTouchEvent(ev);
}
- @ShadeViewRefactor(RefactorComponent.INPUT)
void dispatchDownEventToScroller(MotionEvent ev) {
MotionEvent downEvent = MotionEvent.obtain(ev);
downEvent.setAction(MotionEvent.ACTION_DOWN);
@@ -3614,7 +3465,6 @@
}
@Override
- @ShadeViewRefactor(RefactorComponent.INPUT)
public boolean onGenericMotionEvent(MotionEvent event) {
if (!isScrollingEnabled()
|| !mIsExpanded
@@ -3650,7 +3500,6 @@
return super.onGenericMotionEvent(event);
}
- @ShadeViewRefactor(RefactorComponent.INPUT)
boolean onScrollTouch(MotionEvent ev) {
if (!isScrollingEnabled()) {
return false;
@@ -3807,7 +3656,6 @@
return mFlingAfterUpEvent;
}
- @ShadeViewRefactor(RefactorComponent.INPUT)
protected boolean isInsideQsHeader(MotionEvent ev) {
mQsHeader.getBoundsOnScreen(mQsHeaderBound);
/**
@@ -3825,7 +3673,6 @@
return mQsHeaderBound.contains((int) ev.getRawX(), (int) ev.getRawY());
}
- @ShadeViewRefactor(RefactorComponent.INPUT)
private void onOverScrollFling(boolean open, int initialVelocity) {
if (mOverscrollTopChangedListener != null) {
mOverscrollTopChangedListener.flingTopOverscroll(initialVelocity, open);
@@ -3835,7 +3682,6 @@
}
- @ShadeViewRefactor(RefactorComponent.INPUT)
private void onSecondaryPointerUp(MotionEvent ev) {
final int pointerIndex = (ev.getAction() & MotionEvent.ACTION_POINTER_INDEX_MASK) >>
MotionEvent.ACTION_POINTER_INDEX_SHIFT;
@@ -3853,7 +3699,6 @@
}
}
- @ShadeViewRefactor(RefactorComponent.INPUT)
private void endDrag() {
setIsBeingDragged(false);
@@ -3868,7 +3713,6 @@
}
@Override
- @ShadeViewRefactor(RefactorComponent.INPUT)
public boolean onInterceptTouchEvent(MotionEvent ev) {
if (mTouchHandler != null && mTouchHandler.onInterceptTouchEvent(ev)) {
return true;
@@ -3876,7 +3720,6 @@
return super.onInterceptTouchEvent(ev);
}
- @ShadeViewRefactor(RefactorComponent.INPUT)
void handleEmptySpaceClick(MotionEvent ev) {
logEmptySpaceClick(ev, isBelowLastNotification(mInitialTouchX, mInitialTouchY),
mStatusBarState, mTouchIsClick);
@@ -3919,7 +3762,6 @@
MotionEvent.actionToString(ev.getActionMasked()));
}
- @ShadeViewRefactor(RefactorComponent.INPUT)
void initDownStates(MotionEvent ev) {
if (ev.getAction() == MotionEvent.ACTION_DOWN) {
mExpandedInThisMotion = false;
@@ -3933,7 +3775,6 @@
}
@Override
- @ShadeViewRefactor(RefactorComponent.INPUT)
public void requestDisallowInterceptTouchEvent(boolean disallowIntercept) {
super.requestDisallowInterceptTouchEvent(disallowIntercept);
if (disallowIntercept) {
@@ -3941,7 +3782,6 @@
}
}
- @ShadeViewRefactor(RefactorComponent.INPUT)
boolean onInterceptTouchEventScroll(MotionEvent ev) {
if (!isScrollingEnabled()) {
return false;
@@ -4056,14 +3896,12 @@
/**
* @return Whether the specified motion event is actually happening over the content.
*/
- @ShadeViewRefactor(RefactorComponent.INPUT)
private boolean isInContentBounds(MotionEvent event) {
return isInContentBounds(event.getY());
}
@VisibleForTesting
- @ShadeViewRefactor(RefactorComponent.INPUT)
void setIsBeingDragged(boolean isDragged) {
mIsBeingDragged = isDragged;
if (isDragged) {
@@ -4073,22 +3911,18 @@
}
}
- @ShadeViewRefactor(RefactorComponent.INPUT)
public void requestDisallowLongPress() {
cancelLongPress();
}
- @ShadeViewRefactor(RefactorComponent.INPUT)
public void requestDisallowDismiss() {
mDisallowDismissInThisMotion = true;
}
- @ShadeViewRefactor(RefactorComponent.INPUT)
public void cancelLongPress() {
mSwipeHelper.cancelLongPress();
}
- @ShadeViewRefactor(RefactorComponent.INPUT)
public void setOnEmptySpaceClickListener(OnEmptySpaceClickListener listener) {
mOnEmptySpaceClickListener = listener;
}
@@ -4097,7 +3931,6 @@
* @hide
*/
@Override
- @ShadeViewRefactor(RefactorComponent.INPUT)
public boolean performAccessibilityActionInternal(int action, Bundle arguments) {
if (super.performAccessibilityActionInternal(action, arguments)) {
return true;
@@ -4132,7 +3965,6 @@
}
@Override
- @ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
public void onWindowFocusChanged(boolean hasWindowFocus) {
super.onWindowFocusChanged(hasWindowFocus);
if (!hasWindowFocus) {
@@ -4141,7 +3973,6 @@
}
@Override
- @ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
public void clearChildFocus(View child) {
super.clearChildFocus(child);
if (mForcedScroll == child) {
@@ -4153,7 +3984,6 @@
return mScrollAdapter.isScrolledToBottom();
}
- @ShadeViewRefactor(RefactorComponent.COORDINATOR)
int getEmptyBottomMargin() {
int contentHeight;
if (mShouldUseSplitNotificationShade) {
@@ -4168,13 +3998,11 @@
return Math.max(mMaxLayoutHeight - contentHeight, 0);
}
- @ShadeViewRefactor(RefactorComponent.STATE_RESOLVER)
void onExpansionStarted() {
mIsExpansionChanging = true;
mAmbientState.setExpansionChanging(true);
}
- @ShadeViewRefactor(RefactorComponent.STATE_RESOLVER)
void onExpansionStopped() {
mIsExpansionChanging = false;
mAmbientState.setExpansionChanging(false);
@@ -4187,7 +4015,6 @@
}
}
- @ShadeViewRefactor(RefactorComponent.STATE_RESOLVER)
private void clearUserLockedViews() {
for (int i = 0; i < getChildCount(); i++) {
ExpandableView child = getChildAtIndex(i);
@@ -4198,7 +4025,6 @@
}
}
- @ShadeViewRefactor(RefactorComponent.STATE_RESOLVER)
private void clearTemporaryViews() {
// lets make sure nothing is transient anymore
clearTemporaryViewsInGroup(this);
@@ -4211,7 +4037,6 @@
}
}
- @ShadeViewRefactor(RefactorComponent.STATE_RESOLVER)
private void clearTemporaryViewsInGroup(ViewGroup viewGroup) {
while (viewGroup != null && viewGroup.getTransientViewCount() != 0) {
final View transientView = viewGroup.getTransientView(0);
@@ -4222,27 +4047,23 @@
}
}
- @ShadeViewRefactor(RefactorComponent.STATE_RESOLVER)
void onPanelTrackingStarted() {
mPanelTracking = true;
mAmbientState.setPanelTracking(true);
resetExposedMenuView(true /* animate */, true /* force */);
}
- @ShadeViewRefactor(RefactorComponent.STATE_RESOLVER)
void onPanelTrackingStopped() {
mPanelTracking = false;
mAmbientState.setPanelTracking(false);
}
- @ShadeViewRefactor(RefactorComponent.STATE_RESOLVER)
void resetScrollPosition() {
mScroller.abortAnimation();
setOwnScrollY(0);
}
@VisibleForTesting
- @ShadeViewRefactor(RefactorComponent.COORDINATOR)
void setIsExpanded(boolean isExpanded) {
boolean changed = isExpanded != mIsExpanded;
mIsExpanded = isExpanded;
@@ -4267,7 +4088,6 @@
}
}
- @ShadeViewRefactor(RefactorComponent.COORDINATOR)
private void updateChronometers() {
int childCount = getChildCount();
for (int i = 0; i < childCount; i++) {
@@ -4275,7 +4095,6 @@
}
}
- @ShadeViewRefactor(RefactorComponent.COORDINATOR)
void updateChronometerForChild(View child) {
if (child instanceof ExpandableNotificationRow) {
ExpandableNotificationRow row = (ExpandableNotificationRow) child;
@@ -4316,7 +4135,6 @@
updateChronometerForChild(view);
}
- @ShadeViewRefactor(RefactorComponent.STATE_RESOLVER)
private void updateScrollPositionOnExpandInBottom(ExpandableView view) {
if (view instanceof ExpandableNotificationRow && !onKeyguard()) {
ExpandableNotificationRow row = (ExpandableNotificationRow) view;
@@ -4345,13 +4163,11 @@
}
}
- @ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
void setOnHeightChangedListener(
ExpandableView.OnHeightChangedListener onHeightChangedListener) {
this.mOnHeightChangedListener = onHeightChangedListener;
}
- @ShadeViewRefactor(RefactorComponent.STATE_RESOLVER)
void onChildAnimationFinished() {
setAnimationRunning(false);
requestChildrenUpdate();
@@ -4372,7 +4188,6 @@
}
}
- @ShadeViewRefactor(RefactorComponent.STATE_RESOLVER)
private void clearHeadsUpDisappearRunning() {
for (int i = 0; i < getChildCount(); i++) {
View view = getChildAt(i);
@@ -4388,7 +4203,6 @@
}
}
- @ShadeViewRefactor(RefactorComponent.STATE_RESOLVER)
private void clearTransient() {
for (ExpandableView view : mClearTransientViewsWhenFinished) {
view.removeFromTransientContainer();
@@ -4396,7 +4210,6 @@
mClearTransientViewsWhenFinished.clear();
}
- @ShadeViewRefactor(RefactorComponent.STATE_RESOLVER)
private void runAnimationFinishedRunnables() {
for (Runnable runnable : mAnimationFinishedRunnables) {
runnable.run();
@@ -4407,7 +4220,6 @@
/**
* See {@link AmbientState#setDimmed}.
*/
- @ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
void setDimmed(boolean dimmed, boolean animate) {
dimmed &= onKeyguard();
mAmbientState.setDimmed(dimmed);
@@ -4422,18 +4234,15 @@
}
@VisibleForTesting
- @ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
boolean isDimmed() {
return mAmbientState.isDimmed();
}
- @ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
private void setDimAmount(float dimAmount) {
mDimAmount = dimAmount;
updateBackgroundDimming();
}
- @ShadeViewRefactor(RefactorComponent.STATE_RESOLVER)
private void animateDimmed(boolean dimmed) {
if (mDimAnimator != null) {
mDimAnimator.cancel();
@@ -4450,7 +4259,6 @@
mDimAnimator.start();
}
- @ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
void updateSensitiveness(boolean animate, boolean hideSensitive) {
if (hideSensitive != mAmbientState.isHideSensitive()) {
int childCount = getChildCount();
@@ -4468,7 +4276,6 @@
}
}
- @ShadeViewRefactor(RefactorComponent.STATE_RESOLVER)
private void applyCurrentState() {
int numChildren = getChildCount();
for (int i = 0; i < numChildren; i++) {
@@ -4485,7 +4292,6 @@
updateViewShadows();
}
- @ShadeViewRefactor(RefactorComponent.STATE_RESOLVER)
private void updateViewShadows() {
// we need to work around an issue where the shadow would not cast between siblings when
// their z difference is between 0 and 0.1
@@ -4526,7 +4332,6 @@
/**
* Update colors of "dismiss" and "empty shade" views.
*/
- @ShadeViewRefactor(RefactorComponent.DECORATOR)
void updateDecorViews() {
final @ColorInt int textColor =
Utils.getColorAttrDefaultColor(mContext, android.R.attr.textColorPrimary);
@@ -4535,7 +4340,6 @@
mEmptyShadeView.setTextColor(textColor);
}
- @ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
void goToFullShade(long delay) {
mGoToFullShadeNeedsAnimation = true;
mGoToFullShadeDelay = delay;
@@ -4543,23 +4347,19 @@
requestChildrenUpdate();
}
- @ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
public void cancelExpandHelper() {
mExpandHelper.cancel();
}
- @ShadeViewRefactor(RefactorComponent.COORDINATOR)
void setIntrinsicPadding(int intrinsicPadding) {
mIntrinsicPadding = intrinsicPadding;
}
- @ShadeViewRefactor(RefactorComponent.COORDINATOR)
int getIntrinsicPadding() {
return mIntrinsicPadding;
}
@Override
- @ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
public boolean shouldDelayChildPressedState() {
return true;
}
@@ -4567,7 +4367,6 @@
/**
* See {@link AmbientState#setDozing}.
*/
- @ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
public void setDozing(boolean dozing, boolean animate) {
if (mAmbientState.isDozing() == dozing) {
return;
@@ -4586,7 +4385,6 @@
* @param interpolatedHideAmount The hide amount that follows the actual interpolation of the
* animation curve.
*/
- @ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
void setHideAmount(float linearHideAmount, float interpolatedHideAmount) {
mLinearHideAmount = linearHideAmount;
mInterpolatedHideAmount = interpolatedHideAmount;
@@ -4627,7 +4425,6 @@
mController.updateVisibility(!mAmbientState.isFullyHidden() || !onKeyguard());
}
- @ShadeViewRefactor(RefactorComponent.STATE_RESOLVER)
void notifyHideAnimationStart(boolean hide) {
// We only swap the scaling factor if we're fully hidden or fully awake to avoid
// interpolation issues when playing with the power button.
@@ -4639,7 +4436,6 @@
}
}
- @ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
private int getNotGoneIndex(View child) {
int count = getChildCount();
int notGoneIndex = 0;
@@ -4663,7 +4459,6 @@
return mFooterView != null && mFooterView.isHistoryShown();
}
- @ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
void setFooterView(@NonNull FooterView footerView) {
int index = -1;
if (mFooterView != null) {
@@ -4677,7 +4472,6 @@
}
}
- @ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
public void setEmptyShadeView(EmptyShadeView emptyShadeView) {
int index = -1;
if (mEmptyShadeView != null) {
@@ -4688,7 +4482,6 @@
addView(mEmptyShadeView, index);
}
- @ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
void updateEmptyShadeView(boolean visible, boolean areNotificationsHiddenInShade) {
mEmptyShadeView.setVisible(visible, mIsExpanded && mAnimationsEnabled);
@@ -4731,7 +4524,6 @@
return mEmptyShadeView.isVisible();
}
- @ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
public void updateFooterView(boolean visible, boolean showDismissView, boolean showHistory) {
if (mFooterView == null || mNotificationStackSizeCalculator == null) {
return;
@@ -4743,7 +4535,6 @@
mFooterView.setFooterLabelVisible(mHasFilteredOutSeenNotifications);
}
- @ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
public void setClearAllInProgress(boolean clearAllInProgress) {
mClearAllInProgress = clearAllInProgress;
mAmbientState.setClearAllInProgress(clearAllInProgress);
@@ -4754,19 +4545,16 @@
return mClearAllInProgress;
}
- @ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
public boolean isFooterViewNotGone() {
return mFooterView != null
&& mFooterView.getVisibility() != View.GONE
&& !mFooterView.willBeGone();
}
- @ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
public boolean isFooterViewContentVisible() {
return mFooterView != null && mFooterView.isContentVisible();
}
- @ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
public int getFooterViewHeightWithPadding() {
return mFooterView == null ? 0 : mFooterView.getHeight()
+ mPaddingBetweenElements
@@ -4780,12 +4568,10 @@
return mGapHeight + mPaddingBetweenElements;
}
- @ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
public int getEmptyShadeViewHeight() {
return mEmptyShadeView.getHeight();
}
- @ShadeViewRefactor(RefactorComponent.COORDINATOR)
public float getBottomMostNotificationBottom() {
final int count = getChildCount();
float max = 0;
@@ -4803,7 +4589,6 @@
return max + getStackTranslation();
}
- @ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
public void setCentralSurfaces(CentralSurfaces centralSurfaces) {
this.mCentralSurfaces = centralSurfaces;
}
@@ -4812,7 +4597,6 @@
mActivityStarter = activityStarter;
}
- @ShadeViewRefactor(RefactorComponent.STATE_RESOLVER)
void requestAnimateEverything() {
if (mIsExpanded && mAnimationsEnabled) {
mEverythingNeedsAnimation = true;
@@ -4821,7 +4605,6 @@
}
}
- @ShadeViewRefactor(RefactorComponent.COORDINATOR)
public boolean isBelowLastNotification(float touchX, float touchY) {
int childCount = getChildCount();
for (int i = childCount - 1; i >= 0; i--) {
@@ -4856,7 +4639,6 @@
* @hide
*/
@Override
- @ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
public void onInitializeAccessibilityEventInternal(AccessibilityEvent event) {
super.onInitializeAccessibilityEventInternal(event);
event.setScrollable(mScrollable);
@@ -4866,7 +4648,6 @@
}
@Override
- @ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
public void onInitializeAccessibilityNodeInfoInternal(AccessibilityNodeInfo info) {
super.onInitializeAccessibilityNodeInfoInternal(info);
if (mScrollable) {
@@ -4885,7 +4666,6 @@
info.setClassName(ScrollView.class.getName());
}
- @ShadeViewRefactor(RefactorComponent.COORDINATOR)
public void generateChildOrderChangedEvent() {
if (mIsExpanded && mAnimationsEnabled) {
mGenerateChildOrderChangedEvent = true;
@@ -4894,17 +4674,14 @@
}
}
- @ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
public int getContainerChildCount() {
return getChildCount();
}
- @ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
public View getContainerChildAt(int i) {
return getChildAt(i);
}
- @ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
public void removeContainerView(View v) {
Assert.isMainThread();
removeView(v);
@@ -4916,7 +4693,6 @@
updateSpeedBumpIndex();
}
- @ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
public void addContainerView(View v) {
Assert.isMainThread();
addView(v);
@@ -4950,7 +4726,6 @@
}
}
- @ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
public void runAfterAnimationFinished(Runnable runnable) {
mAnimationFinishedRunnables.add(runnable);
}
@@ -4960,7 +4735,6 @@
generateHeadsUpAnimation(row, isHeadsUp);
}
- @ShadeViewRefactor(RefactorComponent.STATE_RESOLVER)
public void generateHeadsUpAnimation(ExpandableNotificationRow row, boolean isHeadsUp) {
final boolean add = mAnimationsEnabled && (isHeadsUp || mHeadsUpGoingAwayAnimationsAllowed);
if (SPEW) {
@@ -4995,7 +4769,6 @@
* @param height the height of the screen
* @param bottomBarHeight the height of the bar on the bottom
*/
- @ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
public void setHeadsUpBoundaries(int height, int bottomBarHeight) {
mAmbientState.setMaxHeadsUpTranslation(height - bottomBarHeight);
mStateAnimator.setHeadsUpAppearHeightBottom(height);
@@ -5006,23 +4779,19 @@
mWillExpand = willExpand;
}
- @ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
public void setTrackingHeadsUp(ExpandableNotificationRow row) {
mAmbientState.setTrackedHeadsUpRow(row);
}
- @ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
public void forceNoOverlappingRendering(boolean force) {
mForceNoOverlappingRendering = force;
}
@Override
- @ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
public boolean hasOverlappingRendering() {
return !mForceNoOverlappingRendering && super.hasOverlappingRendering();
}
- @ShadeViewRefactor(RefactorComponent.STATE_RESOLVER)
public void setAnimationRunning(boolean animationRunning) {
if (animationRunning != mAnimationRunning) {
if (animationRunning) {
@@ -5035,12 +4804,10 @@
}
}
- @ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
public boolean isExpanded() {
return mIsExpanded;
}
- @ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
public void setPulsing(boolean pulsing, boolean animated) {
if (!mPulsing && !pulsing) {
return;
@@ -5055,7 +4822,6 @@
notifyHeightChangeListener(null, animated);
}
- @ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
public void setQsFullScreen(boolean qsFullScreen) {
mQsFullScreen = qsFullScreen;
updateAlgorithmLayoutMinHeight();
@@ -5066,7 +4832,6 @@
return mQsFullScreen;
}
- @ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
public void setQsExpansionFraction(float qsExpansionFraction) {
boolean footerAffected = mQsExpansionFraction != qsExpansionFraction
&& (mQsExpansionFraction == 1 || qsExpansionFraction == 1);
@@ -5084,12 +4849,10 @@
}
@VisibleForTesting
- @ShadeViewRefactor(RefactorComponent.COORDINATOR)
void setOwnScrollY(int ownScrollY) {
setOwnScrollY(ownScrollY, false /* animateScrollChangeListener */);
}
- @ShadeViewRefactor(RefactorComponent.COORDINATOR)
private void setOwnScrollY(int ownScrollY, boolean animateStackYChangeListener) {
// Avoid Flicking during clear all
// when the shade finishes closing, onExpansionStopped will call
@@ -5142,7 +4905,6 @@
shelf.bind(mAmbientState, this, mController.getNotificationRoundnessManager());
}
- @ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
public void setShelfController(NotificationShelfController notificationShelfController) {
NotificationShelfController.assertRefactorFlagDisabled(mAmbientState.getFeatureFlags());
int index = -1;
@@ -5157,7 +4919,6 @@
notificationShelfController.bind(mAmbientState, mController);
}
- @ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
public void setMaxDisplayedNotifications(int maxDisplayedNotifications) {
if (mMaxDisplayedNotifications != maxDisplayedNotifications) {
mMaxDisplayedNotifications = maxDisplayedNotifications;
@@ -5176,13 +4937,11 @@
mKeyguardBottomPadding = keyguardBottomPadding;
}
- @ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
public void setShouldShowShelfOnly(boolean shouldShowShelfOnly) {
mShouldShowShelfOnly = shouldShowShelfOnly;
updateAlgorithmLayoutMinHeight();
}
- @ShadeViewRefactor(RefactorComponent.COORDINATOR)
public int getMinExpansionHeight() {
// shelf height is defined in dp but status bar height can be defined in px, that makes
// relation between them variable - sometimes one might be bigger than the other when
@@ -5193,19 +4952,16 @@
+ mWaterfallTopInset;
}
- @ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
public void setInHeadsUpPinnedMode(boolean inHeadsUpPinnedMode) {
mInHeadsUpPinnedMode = inHeadsUpPinnedMode;
updateClipping();
}
- @ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
public void setHeadsUpAnimatingAway(boolean headsUpAnimatingAway) {
mHeadsUpAnimatingAway = headsUpAnimatingAway;
updateClipping();
}
- @ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
@VisibleForTesting
public void setStatusBarState(int statusBarState) {
mStatusBarState = statusBarState;
@@ -5238,12 +4994,10 @@
updateVisibility();
}
- @ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
public void setExpandingVelocity(float expandingVelocity) {
mAmbientState.setExpandingVelocity(expandingVelocity);
}
- @ShadeViewRefactor(RefactorComponent.COORDINATOR)
public float getOpeningHeight() {
if (mEmptyShadeView.getVisibility() == GONE) {
return getMinExpansionHeight();
@@ -5252,12 +5006,10 @@
}
}
- @ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
public void setIsFullWidth(boolean isFullWidth) {
mAmbientState.setSmallScreen(isFullWidth);
}
- @ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
public void setUnlockHintRunning(boolean running) {
mAmbientState.setUnlockHintRunning(running);
if (!running) {
@@ -5266,7 +5018,6 @@
}
}
- @ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
public void setPanelFlinging(boolean flinging) {
mAmbientState.setFlinging(flinging);
if (!flinging) {
@@ -5275,12 +5026,10 @@
}
}
- @ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
public void setHeadsUpGoingAwayAnimationsAllowed(boolean headsUpGoingAwayAnimationsAllowed) {
mHeadsUpGoingAwayAnimationsAllowed = headsUpGoingAwayAnimationsAllowed;
}
- @ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
public void dump(PrintWriter pwOriginal, String[] args) {
IndentingPrintWriter pw = DumpUtilsKt.asIndenting(pwOriginal);
pw.println("Internal state:");
@@ -5376,7 +5125,6 @@
});
}
- @ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
public boolean isFullyHidden() {
return mAmbientState.isFullyHidden();
}
@@ -5387,7 +5135,6 @@
*
* @param listener the listener to notify.
*/
- @ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
public void addOnExpandedHeightChangedListener(BiConsumer<Float, Float> listener) {
mExpandedHeightListeners.add(listener);
}
@@ -5395,12 +5142,10 @@
/**
* Stop a listener from listening to the expandedHeight.
*/
- @ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
public void removeOnExpandedHeightChangedListener(BiConsumer<Float, Float> listener) {
mExpandedHeightListeners.remove(listener);
}
- @ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
void setHeadsUpAppearanceController(
HeadsUpAppearanceController headsUpAppearanceController) {
mHeadsUpAppearanceController = headsUpAppearanceController;
@@ -5492,7 +5237,6 @@
* Collects a list of visible rows, and animates them away in a staggered fashion as if they
* were dismissed. Notifications are dismissed in the backend via onClearAllAnimationsEnd.
*/
- @ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
@VisibleForTesting
void clearNotifications(@SelectedRows int selection, boolean closeShade) {
// Animate-swipe all dismissable notifications, then animate the shade closed
@@ -5553,7 +5297,6 @@
}
@VisibleForTesting
- @ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
protected void inflateFooterView() {
FooterView footerView = (FooterView) LayoutInflater.from(mContext).inflate(
R.layout.status_bar_notification_footer, this, false);
@@ -5567,7 +5310,6 @@
setFooterView(footerView);
}
- @ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
private void inflateEmptyShadeView() {
EmptyShadeView oldView = mEmptyShadeView;
EmptyShadeView view = (EmptyShadeView) LayoutInflater.from(mContext).inflate(
@@ -5589,7 +5331,6 @@
/**
* Updates expanded, dimmed and locked states of notification rows.
*/
- @ShadeViewRefactor(RefactorComponent.STATE_RESOLVER)
public void onUpdateRowStates() {
// The following views will be moved to the end of mStackScroller. This counter represents
@@ -6061,7 +5802,6 @@
/**
* A listener that is notified when the empty space below the notifications is clicked on
*/
- @ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
public interface OnEmptySpaceClickListener {
void onEmptySpaceClicked(float x, float y);
}
@@ -6069,7 +5809,6 @@
/**
* A listener that gets notified when the overscroll at the top has changed.
*/
- @ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
public interface OnOverscrollTopChangedListener {
/**
@@ -6093,7 +5832,6 @@
void flingTopOverscroll(float velocity, boolean open);
}
- @ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
private void updateSpeedBumpIndex() {
mSpeedBumpIndexDirty = true;
}
@@ -6129,7 +5867,6 @@
}
}
- @ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
private void resetExposedMenuView(boolean animate, boolean force) {
mSwipeHelper.resetExposedMenuView(animate, force);
}
@@ -6149,7 +5886,6 @@
}
}
- @ShadeViewRefactor(RefactorComponent.STATE_RESOLVER)
static class AnimationEvent {
static AnimationFilter[] FILTERS = new AnimationFilter[]{
@@ -6438,7 +6174,6 @@
setCheckForLeaveBehind(true);
}
- @ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
private final HeadsUpTouchHelper.Callback mHeadsUpCallback = new HeadsUpTouchHelper.Callback() {
@Override
public ExpandableView getChildAtRawPosition(float touchX, float touchY) {
@@ -6477,7 +6212,6 @@
});
}
- @ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
private final ExpandHelper.Callback mExpandHelperCallback = new ExpandHelper.Callback() {
@Override
public ExpandableView getChildAtPosition(float touchX, float touchY) {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/dagger/StatusBarViewModule.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/dagger/StatusBarViewModule.java
index 4ae2edc..4ccbc5a 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/dagger/StatusBarViewModule.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/dagger/StatusBarViewModule.java
@@ -53,6 +53,7 @@
import com.android.systemui.statusbar.phone.fragment.CollapsedStatusBarFragmentLogger;
import com.android.systemui.statusbar.phone.fragment.dagger.StatusBarFragmentComponent;
import com.android.systemui.statusbar.phone.ongoingcall.OngoingCallController;
+import com.android.systemui.statusbar.pipeline.shared.ui.binder.CollapsedStatusBarViewBinder;
import com.android.systemui.statusbar.pipeline.shared.ui.viewmodel.CollapsedStatusBarViewModel;
import com.android.systemui.statusbar.policy.KeyguardStateController;
import com.android.systemui.statusbar.window.StatusBarWindowStateController;
@@ -158,6 +159,7 @@
StatusBarIconController statusBarIconController,
StatusBarIconController.DarkIconManager.Factory darkIconManagerFactory,
CollapsedStatusBarViewModel collapsedStatusBarViewModel,
+ CollapsedStatusBarViewBinder collapsedStatusBarViewBinder,
StatusBarHideIconsForBouncerManager statusBarHideIconsForBouncerManager,
KeyguardStateController keyguardStateController,
ShadeViewController shadeViewController,
@@ -182,6 +184,7 @@
statusBarIconController,
darkIconManagerFactory,
collapsedStatusBarViewModel,
+ collapsedStatusBarViewBinder,
statusBarHideIconsForBouncerManager,
keyguardStateController,
shadeViewController,
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/fragment/CollapsedStatusBarFragment.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/fragment/CollapsedStatusBarFragment.java
index 0651a7b..fcae23b 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/fragment/CollapsedStatusBarFragment.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/fragment/CollapsedStatusBarFragment.java
@@ -14,8 +14,6 @@
package com.android.systemui.statusbar.phone.fragment;
-
-
import static com.android.systemui.statusbar.events.SystemStatusAnimationSchedulerKt.IDLE;
import static com.android.systemui.statusbar.events.SystemStatusAnimationSchedulerKt.SHOWING_PERSISTENT_DOT;
@@ -69,6 +67,7 @@
import com.android.systemui.statusbar.phone.ongoingcall.OngoingCallController;
import com.android.systemui.statusbar.phone.ongoingcall.OngoingCallListener;
import com.android.systemui.statusbar.pipeline.shared.ui.binder.CollapsedStatusBarViewBinder;
+import com.android.systemui.statusbar.pipeline.shared.ui.binder.StatusBarVisibilityChangeListener;
import com.android.systemui.statusbar.pipeline.shared.ui.viewmodel.CollapsedStatusBarViewModel;
import com.android.systemui.statusbar.policy.KeyguardStateController;
import com.android.systemui.statusbar.window.StatusBarWindowStateController;
@@ -131,6 +130,7 @@
private final StatusBarIconController mStatusBarIconController;
private final CarrierConfigTracker mCarrierConfigTracker;
private final CollapsedStatusBarViewModel mCollapsedStatusBarViewModel;
+ private final CollapsedStatusBarViewBinder mCollapsedStatusBarViewBinder;
private final StatusBarHideIconsForBouncerManager mStatusBarHideIconsForBouncerManager;
private final StatusBarIconController.DarkIconManager.Factory mDarkIconManagerFactory;
private final SecureSettings mSecureSettings;
@@ -183,11 +183,21 @@
private boolean mWaitingForWindowStateChangeAfterCameraLaunch = false;
/**
+ * True when a transition from lockscreen to dream has started, but haven't yet received a
+ * status bar window state change afterward.
+ *
+ * Similar to [mWaitingForWindowStateChangeAfterCameraLaunch].
+ */
+ private boolean mTransitionFromLockscreenToDreamStarted = false;
+
+ /**
* Listener that updates {@link #mWaitingForWindowStateChangeAfterCameraLaunch} when it receives
* a new status bar window state.
*/
- private final StatusBarWindowStateListener mStatusBarWindowStateListener = state ->
- mWaitingForWindowStateChangeAfterCameraLaunch = false;
+ private final StatusBarWindowStateListener mStatusBarWindowStateListener = state -> {
+ mWaitingForWindowStateChangeAfterCameraLaunch = false;
+ mTransitionFromLockscreenToDreamStarted = false;
+ };
@SuppressLint("ValidFragment")
public CollapsedStatusBarFragment(
@@ -201,6 +211,7 @@
StatusBarIconController statusBarIconController,
StatusBarIconController.DarkIconManager.Factory darkIconManagerFactory,
CollapsedStatusBarViewModel collapsedStatusBarViewModel,
+ CollapsedStatusBarViewBinder collapsedStatusBarViewBinder,
StatusBarHideIconsForBouncerManager statusBarHideIconsForBouncerManager,
KeyguardStateController keyguardStateController,
ShadeViewController shadeViewController,
@@ -224,6 +235,7 @@
mFeatureFlags = featureFlags;
mStatusBarIconController = statusBarIconController;
mCollapsedStatusBarViewModel = collapsedStatusBarViewModel;
+ mCollapsedStatusBarViewBinder = collapsedStatusBarViewBinder;
mStatusBarHideIconsForBouncerManager = statusBarHideIconsForBouncerManager;
mDarkIconManagerFactory = darkIconManagerFactory;
mKeyguardStateController = keyguardStateController;
@@ -296,8 +308,8 @@
mCarrierConfigTracker.addCallback(mCarrierConfigCallback);
mCarrierConfigTracker.addDefaultDataSubscriptionChangedListener(mDefaultDataListener);
- CollapsedStatusBarViewBinder.bind(
- mStatusBar, mCollapsedStatusBarViewModel, this::updateStatusBarVisibilities);
+ mCollapsedStatusBarViewBinder.bind(
+ mStatusBar, mCollapsedStatusBarViewModel, mStatusBarVisibilityChangeListener);
}
@Override
@@ -411,6 +423,19 @@
return mStatusBarFragmentComponent;
}
+ private StatusBarVisibilityChangeListener mStatusBarVisibilityChangeListener =
+ new StatusBarVisibilityChangeListener() {
+ @Override
+ public void onStatusBarVisibilityMaybeChanged() {
+ updateStatusBarVisibilities(/* animate= */ true);
+ }
+
+ @Override
+ public void onTransitionFromLockscreenToDreamStarted() {
+ mTransitionFromLockscreenToDreamStarted = true;
+ }
+ };
+
@Override
public void disable(int displayId, int state1, int state2, boolean animate) {
if (displayId != getContext().getDisplayId()) {
@@ -423,10 +448,6 @@
updateStatusBarVisibilities(animate);
}
- private void updateStatusBarVisibilities() {
- updateStatusBarVisibilities(/* animate= */ true);
- }
-
private void updateStatusBarVisibilities(boolean animate) {
StatusBarVisibilityModel previousModel = mLastModifiedVisibility;
StatusBarVisibilityModel newModel = calculateInternalModel(mLastSystemVisibility);
@@ -546,6 +567,18 @@
return true;
}
+ // Similar to [hideIconsForSecureCamera]: When dream is launched over lockscreen, the icons
+ // are momentarily visible because the dream animation has finished, but SysUI has not been
+ // informed that the dream is full-screen. For extra safety, we double-check that we're
+ // still dreaming.
+ final boolean hideIconsForDream =
+ mTransitionFromLockscreenToDreamStarted
+ && mKeyguardUpdateMonitor.isDreaming()
+ && mKeyguardStateController.isOccluded();
+ if (hideIconsForDream) {
+ return true;
+ }
+
// While the status bar is transitioning from lockscreen to an occluded, we don't yet know
// if the occluding activity is fullscreen or not. If it *is* fullscreen, we don't want to
// briefly show the status bar just to immediately hide it again. So, we wait for the
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/dagger/StatusBarPipelineModule.kt b/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/dagger/StatusBarPipelineModule.kt
index 49de5a2..27cc64f 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/dagger/StatusBarPipelineModule.kt
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/dagger/StatusBarPipelineModule.kt
@@ -44,6 +44,8 @@
import com.android.systemui.statusbar.pipeline.mobile.util.SubscriptionManagerProxyImpl
import com.android.systemui.statusbar.pipeline.shared.data.repository.ConnectivityRepository
import com.android.systemui.statusbar.pipeline.shared.data.repository.ConnectivityRepositoryImpl
+import com.android.systemui.statusbar.pipeline.shared.ui.binder.CollapsedStatusBarViewBinder
+import com.android.systemui.statusbar.pipeline.shared.ui.binder.CollapsedStatusBarViewBinderImpl
import com.android.systemui.statusbar.pipeline.wifi.data.repository.RealWifiRepository
import com.android.systemui.statusbar.pipeline.wifi.data.repository.WifiRepository
import com.android.systemui.statusbar.pipeline.wifi.data.repository.WifiRepositorySwitcher
@@ -107,6 +109,11 @@
impl: CollapsedStatusBarViewModelImpl
): CollapsedStatusBarViewModel
+ @Binds
+ abstract fun collapsedStatusBarViewBinder(
+ impl: CollapsedStatusBarViewBinderImpl
+ ): CollapsedStatusBarViewBinder
+
companion object {
@Provides
@SysUISingleton
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/shared/ui/binder/CollapsedStatusBarViewBinder.kt b/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/shared/ui/binder/CollapsedStatusBarViewBinder.kt
index 9a59851..b9b88f4 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/shared/ui/binder/CollapsedStatusBarViewBinder.kt
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/shared/ui/binder/CollapsedStatusBarViewBinder.kt
@@ -19,34 +19,61 @@
import android.view.View
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.repeatOnLifecycle
+import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.lifecycle.repeatWhenAttached
import com.android.systemui.statusbar.pipeline.shared.ui.viewmodel.CollapsedStatusBarViewModel
+import javax.inject.Inject
+import kotlinx.coroutines.launch
-object CollapsedStatusBarViewBinder {
+/**
+ * Interface to assist with binding the [CollapsedStatusBarFragment] to
+ * [CollapsedStatusBarViewModel]. Used only to enable easy testing of [CollapsedStatusBarFragment].
+ */
+interface CollapsedStatusBarViewBinder {
/**
* Binds the view to the view-model. [listener] will be notified whenever an event that may
* change the status bar visibility occurs.
*/
- @JvmStatic
fun bind(
view: View,
viewModel: CollapsedStatusBarViewModel,
listener: StatusBarVisibilityChangeListener,
+ )
+}
+
+@SysUISingleton
+class CollapsedStatusBarViewBinderImpl @Inject constructor() : CollapsedStatusBarViewBinder {
+ override fun bind(
+ view: View,
+ viewModel: CollapsedStatusBarViewModel,
+ listener: StatusBarVisibilityChangeListener,
) {
view.repeatWhenAttached {
repeatOnLifecycle(Lifecycle.State.CREATED) {
- viewModel.isTransitioningFromLockscreenToOccluded.collect {
- listener.onStatusBarVisibilityMaybeChanged()
+ launch {
+ viewModel.isTransitioningFromLockscreenToOccluded.collect {
+ listener.onStatusBarVisibilityMaybeChanged()
+ }
+ }
+
+ launch {
+ viewModel.transitionFromLockscreenToDreamStartedEvent.collect {
+ listener.onTransitionFromLockscreenToDreamStarted()
+ }
}
}
}
}
}
-/**
- * Listener to be notified when the status bar visibility might have changed due to the device
- * moving to a different state.
- */
-fun interface StatusBarVisibilityChangeListener {
+/** Listener for various events that may affect the status bar's visibility. */
+interface StatusBarVisibilityChangeListener {
+ /**
+ * Called when the status bar visibility might have changed due to the device moving to a
+ * different state.
+ */
fun onStatusBarVisibilityMaybeChanged()
+
+ /** Called when a transition from lockscreen to dream has started. */
+ fun onTransitionFromLockscreenToDreamStarted()
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/shared/ui/viewmodel/CollapsedStatusBarViewModel.kt b/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/shared/ui/viewmodel/CollapsedStatusBarViewModel.kt
index edb7e4d..15ab143 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/shared/ui/viewmodel/CollapsedStatusBarViewModel.kt
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/shared/ui/viewmodel/CollapsedStatusBarViewModel.kt
@@ -22,8 +22,10 @@
import com.android.systemui.keyguard.shared.model.TransitionState
import javax.inject.Inject
import kotlinx.coroutines.CoroutineScope
+import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.SharingStarted
import kotlinx.coroutines.flow.StateFlow
+import kotlinx.coroutines.flow.filter
import kotlinx.coroutines.flow.map
import kotlinx.coroutines.flow.stateIn
@@ -43,6 +45,9 @@
* otherwise.
*/
val isTransitioningFromLockscreenToOccluded: StateFlow<Boolean>
+
+ /** Emits whenever a transition from lockscreen to dream has started. */
+ val transitionFromLockscreenToDreamStartedEvent: Flow<Unit>
}
@SysUISingleton
@@ -59,4 +64,9 @@
it.transitionState == TransitionState.RUNNING
}
.stateIn(coroutineScope, SharingStarted.WhileSubscribed(), initialValue = false)
+
+ override val transitionFromLockscreenToDreamStartedEvent: Flow<Unit> =
+ keyguardTransitionInteractor.lockscreenToDreamingTransition
+ .filter { it.transitionState == TransitionState.STARTED }
+ .map {}
}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/keyguard/KeyguardViewMediatorTest.java b/packages/SystemUI/tests/src/com/android/systemui/keyguard/KeyguardViewMediatorTest.java
index 1d8b5ca..d4c2baf 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/keyguard/KeyguardViewMediatorTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/keyguard/KeyguardViewMediatorTest.java
@@ -550,12 +550,6 @@
}
@Test
- public void testWakeAndUnlocking() {
- mViewMediator.onWakeAndUnlocking();
- verify(mStatusBarKeyguardViewManager).notifyKeyguardAuthenticated(anyBoolean());
- }
-
- @Test
public void testOnStartedWakingUp_logsUiEvent() {
final InstanceId instanceId = InstanceId.fakeInstanceId(8);
when(mSessionTracker.getSessionId((anyInt()))).thenReturn(instanceId);
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/fragment/CollapsedStatusBarFragmentTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/fragment/CollapsedStatusBarFragmentTest.java
index 10efcd4..9b1d93b 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/fragment/CollapsedStatusBarFragmentTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/fragment/CollapsedStatusBarFragmentTest.java
@@ -74,6 +74,7 @@
import com.android.systemui.statusbar.phone.StatusBarLocationPublisher;
import com.android.systemui.statusbar.phone.fragment.dagger.StatusBarFragmentComponent;
import com.android.systemui.statusbar.phone.ongoingcall.OngoingCallController;
+import com.android.systemui.statusbar.pipeline.shared.ui.viewmodel.FakeCollapsedStatusBarViewBinder;
import com.android.systemui.statusbar.pipeline.shared.ui.viewmodel.FakeCollapsedStatusBarViewModel;
import com.android.systemui.statusbar.policy.KeyguardStateController;
import com.android.systemui.statusbar.window.StatusBarWindowStateController;
@@ -129,6 +130,7 @@
@Mock
private StatusBarIconController.DarkIconManager mIconManager;
private FakeCollapsedStatusBarViewModel mCollapsedStatusBarViewModel;
+ private FakeCollapsedStatusBarViewBinder mCollapsedStatusBarViewBinder;
@Mock
private StatusBarHideIconsForBouncerManager mStatusBarHideIconsForBouncerManager;
@Mock
@@ -612,6 +614,55 @@
assertEquals(View.VISIBLE, getClockView().getVisibility());
}
+ @Test
+ public void testStatusBarIcons_hiddenThroughoutLockscreenToDreamTransition() {
+ final CollapsedStatusBarFragment fragment = resumeAndGetFragment();
+
+ // WHEN a transition to dream has started
+ mCollapsedStatusBarViewBinder.getListener().onTransitionFromLockscreenToDreamStarted();
+ when(mKeyguardUpdateMonitor.isDreaming()).thenReturn(true);
+ when(mKeyguardStateController.isOccluded()).thenReturn(true);
+ fragment.disable(DEFAULT_DISPLAY, 0, 0, false);
+
+ // THEN status icons should be invisible or gone, but certainly not VISIBLE.
+ assertNotEquals(View.VISIBLE, getEndSideContentView().getVisibility());
+ assertNotEquals(View.VISIBLE, getClockView().getVisibility());
+
+ // WHEN the transition has finished and dream is displaying
+ mockLockscreenToDreamTransitionFinished();
+ // (This approximates "dream is displaying")
+ when(mStatusBarHideIconsForBouncerManager.getShouldHideStatusBarIconsForBouncer())
+ .thenReturn(true);
+ fragment.disable(DEFAULT_DISPLAY, 0, 0, false);
+
+ // THEN the views still aren't visible because dream is hiding them
+ assertNotEquals(View.VISIBLE, getEndSideContentView().getVisibility());
+ assertNotEquals(View.VISIBLE, getClockView().getVisibility());
+
+ // WHEN dream has ended
+ when(mStatusBarHideIconsForBouncerManager.getShouldHideStatusBarIconsForBouncer())
+ .thenReturn(false);
+ fragment.disable(DEFAULT_DISPLAY, 0, 0, false);
+
+ // THEN the views can be visible again
+ assertEquals(View.VISIBLE, getEndSideContentView().getVisibility());
+ assertEquals(View.VISIBLE, getClockView().getVisibility());
+ }
+
+ @Test
+ public void testStatusBarIcons_lockscreenToDreamTransitionButNotDreaming_iconsVisible() {
+ final CollapsedStatusBarFragment fragment = resumeAndGetFragment();
+
+ // WHEN a transition to dream has started but we're *not* dreaming
+ mCollapsedStatusBarViewBinder.getListener().onTransitionFromLockscreenToDreamStarted();
+ when(mKeyguardUpdateMonitor.isDreaming()).thenReturn(false);
+ fragment.disable(DEFAULT_DISPLAY, 0, 0, false);
+
+ // THEN the views are still visible
+ assertEquals(View.VISIBLE, getEndSideContentView().getVisibility());
+ assertEquals(View.VISIBLE, getClockView().getVisibility());
+ }
+
@Override
protected Fragment instantiate(Context context, String className, Bundle arguments) {
MockitoAnnotations.initMocks(this);
@@ -631,6 +682,7 @@
mShadeExpansionStateManager = new ShadeExpansionStateManager();
mCollapsedStatusBarViewModel = new FakeCollapsedStatusBarViewModel();
+ mCollapsedStatusBarViewBinder = new FakeCollapsedStatusBarViewBinder();
setUpNotificationIconAreaController();
return new CollapsedStatusBarFragment(
@@ -644,6 +696,7 @@
mStatusBarIconController,
mIconManagerFactory,
mCollapsedStatusBarViewModel,
+ mCollapsedStatusBarViewBinder,
mStatusBarHideIconsForBouncerManager,
mKeyguardStateController,
mShadeViewController,
@@ -718,6 +771,12 @@
}
}
+ private void mockLockscreenToDreamTransitionFinished() {
+ for (StatusBarWindowStateListener listener : mStatusBarWindowStateListeners) {
+ listener.onStatusBarWindowStateChanged(StatusBarManager.WINDOW_STATE_HIDDEN);
+ }
+ }
+
private CollapsedStatusBarFragment resumeAndGetFragment() {
mFragments.dispatchResume();
processAllMessages();
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/shared/ui/viewmodel/CollapsedStatusBarViewModelImplTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/shared/ui/viewmodel/CollapsedStatusBarViewModelImplTest.kt
index 5faed9d..c8c24a7 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/shared/ui/viewmodel/CollapsedStatusBarViewModelImplTest.kt
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/shared/ui/viewmodel/CollapsedStatusBarViewModelImplTest.kt
@@ -18,6 +18,7 @@
import androidx.test.filters.SmallTest
import com.android.systemui.SysuiTestCase
+import com.android.systemui.coroutines.collectValues
import com.android.systemui.keyguard.data.repository.FakeKeyguardTransitionRepository
import com.android.systemui.keyguard.domain.interactor.KeyguardTransitionInteractor
import com.android.systemui.keyguard.shared.model.KeyguardState
@@ -176,4 +177,139 @@
job.cancel()
}
+
+ @Test
+ fun transitionFromLockscreenToDreamStartedEvent_started_emitted() =
+ testScope.runTest {
+ val emissions by collectValues(underTest.transitionFromLockscreenToDreamStartedEvent)
+
+ keyguardTransitionRepository.sendTransitionStep(
+ TransitionStep(
+ KeyguardState.LOCKSCREEN,
+ KeyguardState.DREAMING,
+ value = 0f,
+ TransitionState.STARTED,
+ )
+ )
+
+ assertThat(emissions.size).isEqualTo(1)
+ }
+
+ @Test
+ fun transitionFromLockscreenToDreamStartedEvent_startedMultiple_emittedMultiple() =
+ testScope.runTest {
+ val emissions by collectValues(underTest.transitionFromLockscreenToDreamStartedEvent)
+
+ keyguardTransitionRepository.sendTransitionStep(
+ TransitionStep(
+ KeyguardState.LOCKSCREEN,
+ KeyguardState.DREAMING,
+ value = 0f,
+ TransitionState.STARTED,
+ )
+ )
+
+ keyguardTransitionRepository.sendTransitionStep(
+ TransitionStep(
+ KeyguardState.LOCKSCREEN,
+ KeyguardState.DREAMING,
+ value = 0f,
+ TransitionState.STARTED,
+ )
+ )
+
+ keyguardTransitionRepository.sendTransitionStep(
+ TransitionStep(
+ KeyguardState.LOCKSCREEN,
+ KeyguardState.DREAMING,
+ value = 0f,
+ TransitionState.STARTED,
+ )
+ )
+
+ assertThat(emissions.size).isEqualTo(3)
+ }
+
+ @Test
+ fun transitionFromLockscreenToDreamStartedEvent_startedThenRunning_emittedOnlyOne() =
+ testScope.runTest {
+ val emissions by collectValues(underTest.transitionFromLockscreenToDreamStartedEvent)
+
+ keyguardTransitionRepository.sendTransitionStep(
+ TransitionStep(
+ KeyguardState.LOCKSCREEN,
+ KeyguardState.DREAMING,
+ value = 0f,
+ TransitionState.STARTED,
+ )
+ )
+ assertThat(emissions.size).isEqualTo(1)
+
+ // WHEN the transition progresses through its animation by going through the RUNNING
+ // step with increasing fractions
+ keyguardTransitionRepository.sendTransitionStep(
+ TransitionStep(
+ KeyguardState.LOCKSCREEN,
+ KeyguardState.DREAMING,
+ value = .1f,
+ TransitionState.RUNNING,
+ )
+ )
+
+ keyguardTransitionRepository.sendTransitionStep(
+ TransitionStep(
+ KeyguardState.LOCKSCREEN,
+ KeyguardState.DREAMING,
+ value = .2f,
+ TransitionState.RUNNING,
+ )
+ )
+
+ keyguardTransitionRepository.sendTransitionStep(
+ TransitionStep(
+ KeyguardState.LOCKSCREEN,
+ KeyguardState.DREAMING,
+ value = .3f,
+ TransitionState.RUNNING,
+ )
+ )
+
+ // THEN the flow does not emit since the flow should only emit when the transition
+ // starts
+ assertThat(emissions.size).isEqualTo(1)
+ }
+
+ @Test
+ fun transitionFromLockscreenToDreamStartedEvent_irrelevantTransition_notEmitted() =
+ testScope.runTest {
+ val emissions by collectValues(underTest.transitionFromLockscreenToDreamStartedEvent)
+
+ keyguardTransitionRepository.sendTransitionStep(
+ TransitionStep(
+ KeyguardState.LOCKSCREEN,
+ KeyguardState.OCCLUDED,
+ value = 0f,
+ TransitionState.STARTED,
+ )
+ )
+
+ assertThat(emissions).isEmpty()
+ }
+
+ @Test
+ fun transitionFromLockscreenToDreamStartedEvent_irrelevantTransitionState_notEmitted() =
+ testScope.runTest {
+ val emissions by collectValues(underTest.transitionFromLockscreenToDreamStartedEvent)
+
+ keyguardTransitionRepository.sendTransitionStep(
+ TransitionStep(
+ KeyguardState.LOCKSCREEN,
+ KeyguardState.DREAMING,
+ value = 1.0f,
+ TransitionState.FINISHED,
+ )
+ )
+
+ assertThat(emissions).isEmpty()
+ }
}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/shared/ui/viewmodel/FakeCollapsedStatusBarViewBinder.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/shared/ui/viewmodel/FakeCollapsedStatusBarViewBinder.kt
new file mode 100644
index 0000000..2ee928f
--- /dev/null
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/shared/ui/viewmodel/FakeCollapsedStatusBarViewBinder.kt
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2023 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.
+ */
+
+package com.android.systemui.statusbar.pipeline.shared.ui.viewmodel
+
+import android.view.View
+import com.android.systemui.statusbar.pipeline.shared.ui.binder.CollapsedStatusBarViewBinder
+import com.android.systemui.statusbar.pipeline.shared.ui.binder.StatusBarVisibilityChangeListener
+
+/**
+ * A fake view binder that can be used from Java tests.
+ *
+ * Since Java tests can't run tests within test scopes, we need to bypass the flows from
+ * [CollapsedStatusBarViewModel] and just trigger the listener directly.
+ */
+class FakeCollapsedStatusBarViewBinder : CollapsedStatusBarViewBinder {
+ var listener: StatusBarVisibilityChangeListener? = null
+
+ override fun bind(
+ view: View,
+ viewModel: CollapsedStatusBarViewModel,
+ listener: StatusBarVisibilityChangeListener,
+ ) {
+ this.listener = listener
+ }
+}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/shared/ui/viewmodel/FakeCollapsedStatusBarViewModel.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/shared/ui/viewmodel/FakeCollapsedStatusBarViewModel.kt
index cbf6637..88587b2 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/shared/ui/viewmodel/FakeCollapsedStatusBarViewModel.kt
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/shared/ui/viewmodel/FakeCollapsedStatusBarViewModel.kt
@@ -16,8 +16,11 @@
package com.android.systemui.statusbar.pipeline.shared.ui.viewmodel
+import kotlinx.coroutines.flow.MutableSharedFlow
import kotlinx.coroutines.flow.MutableStateFlow
class FakeCollapsedStatusBarViewModel : CollapsedStatusBarViewModel {
override val isTransitioningFromLockscreenToOccluded = MutableStateFlow(false)
+
+ override val transitionFromLockscreenToDreamStartedEvent = MutableSharedFlow<Unit>()
}
diff --git a/services/core/java/com/android/server/input/FocusEventDebugView.java b/services/core/java/com/android/server/input/FocusEventDebugView.java
new file mode 100644
index 0000000..fba2aa6
--- /dev/null
+++ b/services/core/java/com/android/server/input/FocusEventDebugView.java
@@ -0,0 +1,343 @@
+/*
+ * Copyright 2023 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.
+ */
+
+package com.android.server.input;
+
+import static android.util.TypedValue.COMPLEX_UNIT_DIP;
+import static android.util.TypedValue.COMPLEX_UNIT_SP;
+import static android.view.ViewGroup.LayoutParams.WRAP_CONTENT;
+
+import android.animation.LayoutTransition;
+import android.annotation.AnyThread;
+import android.content.Context;
+import android.graphics.Color;
+import android.graphics.ColorFilter;
+import android.graphics.ColorMatrixColorFilter;
+import android.graphics.Typeface;
+import android.util.Pair;
+import android.util.Slog;
+import android.util.TypedValue;
+import android.view.Gravity;
+import android.view.InputEvent;
+import android.view.KeyEvent;
+import android.view.RoundedCorner;
+import android.view.View;
+import android.view.WindowInsets;
+import android.view.animation.AccelerateInterpolator;
+import android.widget.HorizontalScrollView;
+import android.widget.LinearLayout;
+import android.widget.TextView;
+
+import com.android.internal.R;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Displays focus events, such as physical keyboard KeyEvents and non-pointer MotionEvents on
+ * the screen.
+ */
+class FocusEventDebugView extends LinearLayout {
+
+ private static final String TAG = FocusEventDebugView.class.getSimpleName();
+
+ private static final int KEY_FADEOUT_DURATION_MILLIS = 1000;
+ private static final int KEY_TRANSITION_DURATION_MILLIS = 100;
+
+ private static final int OUTER_PADDING_DP = 16;
+ private static final int KEY_SEPARATION_MARGIN_DP = 16;
+ private static final int KEY_VIEW_SIDE_PADDING_DP = 16;
+ private static final int KEY_VIEW_VERTICAL_PADDING_DP = 8;
+ private static final int KEY_VIEW_MIN_WIDTH_DP = 32;
+ private static final int KEY_VIEW_TEXT_SIZE_SP = 12;
+
+ private final int mOuterPadding;
+
+ // Tracks all keys that are currently pressed/down.
+ private final Map<Pair<Integer /*deviceId*/, Integer /*scanCode*/>, PressedKeyView>
+ mPressedKeys = new HashMap<>();
+
+ private final PressedKeyContainer mPressedKeyContainer;
+ private final PressedKeyContainer mPressedModifierContainer;
+
+ FocusEventDebugView(Context c) {
+ super(c);
+ setFocusableInTouchMode(true);
+
+ final var dm = mContext.getResources().getDisplayMetrics();
+ mOuterPadding = (int) TypedValue.applyDimension(COMPLEX_UNIT_DIP, OUTER_PADDING_DP, dm);
+
+ setOrientation(HORIZONTAL);
+ setLayoutDirection(LAYOUT_DIRECTION_RTL);
+ setGravity(Gravity.START | Gravity.BOTTOM);
+
+ mPressedKeyContainer = new PressedKeyContainer(mContext);
+ mPressedKeyContainer.setOrientation(HORIZONTAL);
+ mPressedKeyContainer.setGravity(Gravity.RIGHT | Gravity.BOTTOM);
+ mPressedKeyContainer.setLayoutDirection(LAYOUT_DIRECTION_LTR);
+ final var scroller = new HorizontalScrollView(mContext);
+ scroller.addView(mPressedKeyContainer);
+ scroller.setHorizontalScrollBarEnabled(false);
+ scroller.addOnLayoutChangeListener(
+ (view, l, t, r, b, ol, ot, or, ob) -> scroller.fullScroll(View.FOCUS_RIGHT));
+ scroller.setHorizontalFadingEdgeEnabled(true);
+ addView(scroller, new LayoutParams(0, WRAP_CONTENT, 1));
+
+ mPressedModifierContainer = new PressedKeyContainer(mContext);
+ mPressedModifierContainer.setOrientation(VERTICAL);
+ mPressedModifierContainer.setGravity(Gravity.LEFT | Gravity.BOTTOM);
+ addView(mPressedModifierContainer, new LayoutParams(WRAP_CONTENT, WRAP_CONTENT));
+ }
+
+ @Override
+ public WindowInsets onApplyWindowInsets(WindowInsets insets) {
+ int paddingBottom = 0;
+
+ final RoundedCorner bottomLeft =
+ insets.getRoundedCorner(RoundedCorner.POSITION_BOTTOM_LEFT);
+ if (bottomLeft != null) {
+ paddingBottom = bottomLeft.getRadius();
+ }
+
+ final RoundedCorner bottomRight =
+ insets.getRoundedCorner(RoundedCorner.POSITION_BOTTOM_RIGHT);
+ if (bottomRight != null) {
+ paddingBottom = Math.max(paddingBottom, bottomRight.getRadius());
+ }
+
+ if (insets.getDisplayCutout() != null) {
+ paddingBottom =
+ Math.max(paddingBottom, insets.getDisplayCutout().getSafeInsetBottom());
+ }
+
+ setPadding(mOuterPadding, mOuterPadding, mOuterPadding, mOuterPadding + paddingBottom);
+ setClipToPadding(false);
+ invalidate();
+ return super.onApplyWindowInsets(insets);
+ }
+
+ @Override
+ public boolean dispatchKeyEvent(KeyEvent event) {
+ handleKeyEvent(event);
+ return super.dispatchKeyEvent(event);
+ }
+
+ /** Report an input event to the debug view. */
+ @AnyThread
+ public void reportEvent(InputEvent event) {
+ if (!(event instanceof KeyEvent)) {
+ // TODO: Support non-pointer MotionEvents.
+ return;
+ }
+ post(() -> handleKeyEvent(KeyEvent.obtain((KeyEvent) event)));
+ }
+
+ private void handleKeyEvent(KeyEvent keyEvent) {
+ final var identifier = new Pair<>(keyEvent.getDeviceId(), keyEvent.getScanCode());
+ final var container = KeyEvent.isModifierKey(keyEvent.getKeyCode())
+ ? mPressedModifierContainer
+ : mPressedKeyContainer;
+ PressedKeyView pressedKeyView = mPressedKeys.get(identifier);
+ switch (keyEvent.getAction()) {
+ case KeyEvent.ACTION_DOWN: {
+ if (pressedKeyView != null) {
+ if (keyEvent.getRepeatCount() == 0) {
+ Slog.w(TAG, "Got key down for "
+ + KeyEvent.keyCodeToString(keyEvent.getKeyCode())
+ + " that was already tracked as being down.");
+ break;
+ }
+ container.handleKeyRepeat(pressedKeyView);
+ break;
+ }
+
+ pressedKeyView = new PressedKeyView(mContext, getLabel(keyEvent));
+ mPressedKeys.put(identifier, pressedKeyView);
+ container.handleKeyPressed(pressedKeyView);
+ break;
+ }
+ case KeyEvent.ACTION_UP: {
+ if (pressedKeyView == null) {
+ Slog.w(TAG, "Got key up for " + KeyEvent.keyCodeToString(keyEvent.getKeyCode())
+ + " that was not tracked as being down.");
+ break;
+ }
+ mPressedKeys.remove(identifier);
+ container.handleKeyRelease(pressedKeyView);
+ break;
+ }
+ default:
+ break;
+ }
+ keyEvent.recycle();
+ }
+
+ private static String getLabel(KeyEvent event) {
+ switch (event.getKeyCode()) {
+ case KeyEvent.KEYCODE_SPACE:
+ return "\u2423";
+ case KeyEvent.KEYCODE_TAB:
+ return "\u21e5";
+ case KeyEvent.KEYCODE_ENTER:
+ case KeyEvent.KEYCODE_NUMPAD_ENTER:
+ return "\u23CE";
+ case KeyEvent.KEYCODE_DEL:
+ return "\u232B";
+ case KeyEvent.KEYCODE_FORWARD_DEL:
+ return "\u2326";
+ case KeyEvent.KEYCODE_ESCAPE:
+ return "ESC";
+ case KeyEvent.KEYCODE_DPAD_UP:
+ return "\u2191";
+ case KeyEvent.KEYCODE_DPAD_DOWN:
+ return "\u2193";
+ case KeyEvent.KEYCODE_DPAD_LEFT:
+ return "\u2190";
+ case KeyEvent.KEYCODE_DPAD_RIGHT:
+ return "\u2192";
+ case KeyEvent.KEYCODE_DPAD_UP_RIGHT:
+ return "\u2197";
+ case KeyEvent.KEYCODE_DPAD_UP_LEFT:
+ return "\u2196";
+ case KeyEvent.KEYCODE_DPAD_DOWN_RIGHT:
+ return "\u2198";
+ case KeyEvent.KEYCODE_DPAD_DOWN_LEFT:
+ return "\u2199";
+ default:
+ break;
+ }
+
+ final int unicodeChar = event.getUnicodeChar();
+ if (unicodeChar != 0) {
+ return new String(Character.toChars(unicodeChar));
+ }
+
+ final var label = KeyEvent.keyCodeToString(event.getKeyCode());
+ if (label.startsWith("KEYCODE_")) {
+ return label.substring(8);
+ }
+ return label;
+ }
+
+ private static class PressedKeyView extends TextView {
+
+ private static final ColorFilter sInvertColors = new ColorMatrixColorFilter(new float[]{
+ -1.0f, 0, 0, 0, 255, // red
+ 0, -1.0f, 0, 0, 255, // green
+ 0, 0, -1.0f, 0, 255, // blue
+ 0, 0, 0, 1.0f, 0 // alpha
+ });
+
+ PressedKeyView(Context c, String label) {
+ super(c);
+
+ final var dm = c.getResources().getDisplayMetrics();
+ final int keyViewSidePadding =
+ (int) TypedValue.applyDimension(COMPLEX_UNIT_DIP, KEY_VIEW_SIDE_PADDING_DP, dm);
+ final int keyViewVerticalPadding =
+ (int) TypedValue.applyDimension(COMPLEX_UNIT_DIP, KEY_VIEW_VERTICAL_PADDING_DP,
+ dm);
+ final int keyViewMinWidth =
+ (int) TypedValue.applyDimension(COMPLEX_UNIT_DIP, KEY_VIEW_MIN_WIDTH_DP, dm);
+ final int textSize =
+ (int) TypedValue.applyDimension(COMPLEX_UNIT_SP, KEY_VIEW_TEXT_SIZE_SP, dm);
+
+ setText(label);
+ setGravity(Gravity.CENTER);
+ setMinimumWidth(keyViewMinWidth);
+ setTextSize(textSize);
+ setTypeface(Typeface.SANS_SERIF);
+ setBackgroundResource(R.drawable.focus_event_pressed_key_background);
+ setPaddingRelative(keyViewSidePadding, keyViewVerticalPadding, keyViewSidePadding,
+ keyViewVerticalPadding);
+
+ setHighlighted(true);
+ }
+
+ void setHighlighted(boolean isHighlighted) {
+ if (isHighlighted) {
+ setTextColor(Color.BLACK);
+ getBackground().setColorFilter(sInvertColors);
+ } else {
+ setTextColor(Color.WHITE);
+ getBackground().clearColorFilter();
+ }
+ invalidate();
+ }
+ }
+
+ private static class PressedKeyContainer extends LinearLayout {
+
+ private final MarginLayoutParams mPressedKeyLayoutParams;
+
+ PressedKeyContainer(Context c) {
+ super(c);
+
+ final var dm = c.getResources().getDisplayMetrics();
+ final int keySeparationMargin =
+ (int) TypedValue.applyDimension(COMPLEX_UNIT_DIP, KEY_SEPARATION_MARGIN_DP, dm);
+
+ final var transition = new LayoutTransition();
+ transition.disableTransitionType(LayoutTransition.APPEARING);
+ transition.disableTransitionType(LayoutTransition.DISAPPEARING);
+ transition.disableTransitionType(LayoutTransition.CHANGE_DISAPPEARING);
+ transition.setDuration(KEY_TRANSITION_DURATION_MILLIS);
+ setLayoutTransition(transition);
+
+ mPressedKeyLayoutParams = new MarginLayoutParams(WRAP_CONTENT, WRAP_CONTENT);
+ if (getOrientation() == VERTICAL) {
+ mPressedKeyLayoutParams.setMargins(0, keySeparationMargin, 0, 0);
+ } else {
+ mPressedKeyLayoutParams.setMargins(keySeparationMargin, 0, 0, 0);
+ }
+ }
+
+ public void handleKeyPressed(PressedKeyView pressedKeyView) {
+ addView(pressedKeyView, getChildCount(), mPressedKeyLayoutParams);
+ invalidate();
+ }
+
+ public void handleKeyRepeat(PressedKeyView repeatedKeyView) {
+ // Do nothing for now.
+ }
+
+ public void handleKeyRelease(PressedKeyView releasedKeyView) {
+ releasedKeyView.setHighlighted(false);
+ releasedKeyView.clearAnimation();
+ releasedKeyView.animate()
+ .alpha(0)
+ .setDuration(KEY_FADEOUT_DURATION_MILLIS)
+ .setInterpolator(new AccelerateInterpolator())
+ .withEndAction(this::cleanUpPressedKeyViews)
+ .start();
+ }
+
+ private void cleanUpPressedKeyViews() {
+ int numChildrenToRemove = 0;
+ for (int i = 0; i < getChildCount(); i++) {
+ final View child = getChildAt(i);
+ if (child.getAlpha() != 0) {
+ break;
+ }
+ child.setVisibility(View.GONE);
+ child.clearAnimation();
+ numChildrenToRemove++;
+ }
+ removeViews(0, numChildrenToRemove);
+ invalidate();
+ }
+ }
+}
diff --git a/services/core/java/com/android/server/input/InputManagerService.java b/services/core/java/com/android/server/input/InputManagerService.java
index 5f45f91..662591e 100644
--- a/services/core/java/com/android/server/input/InputManagerService.java
+++ b/services/core/java/com/android/server/input/InputManagerService.java
@@ -18,6 +18,7 @@
import static android.provider.DeviceConfig.NAMESPACE_INPUT_NATIVE_BOOT;
import static android.view.KeyEvent.KEYCODE_UNKNOWN;
+import static android.view.WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS;
import android.Manifest;
import android.annotation.EnforcePermission;
@@ -32,6 +33,7 @@
import android.content.Intent;
import android.content.IntentFilter;
import android.content.pm.PackageManager;
+import android.graphics.PixelFormat;
import android.graphics.PointF;
import android.hardware.SensorPrivacyManager;
import android.hardware.SensorPrivacyManager.Sensors;
@@ -100,6 +102,7 @@
import android.view.SurfaceControl;
import android.view.VerifiedInputEvent;
import android.view.ViewConfiguration;
+import android.view.WindowManager;
import android.view.inputmethod.InputMethodInfo;
import android.view.inputmethod.InputMethodSubtype;
@@ -386,6 +389,11 @@
/** Whether to use the dev/input/event or uevent subsystem for the audio jack. */
final boolean mUseDevInputEventForAudioJack;
+ private final Object mFocusEventDebugViewLock = new Object();
+ @GuardedBy("mFocusEventDebugViewLock")
+ @Nullable
+ private FocusEventDebugView mFocusEventDebugView;
+
/** Point of injection for test dependencies. */
@VisibleForTesting
static class Injector {
@@ -427,7 +435,7 @@
mContext = injector.getContext();
mHandler = new InputManagerHandler(injector.getLooper());
mNative = injector.getNativeService(this);
- mSettingsObserver = new InputSettingsObserver(mContext, mHandler, mNative);
+ mSettingsObserver = new InputSettingsObserver(mContext, mHandler, this, mNative);
mKeyboardLayoutManager = new KeyboardLayoutManager(mContext, mNative, mDataStore,
injector.getLooper());
mBatteryController = new BatteryController(mContext, mNative, injector.getLooper());
@@ -2460,6 +2468,11 @@
// Native callback.
@SuppressWarnings("unused")
private int interceptKeyBeforeQueueing(KeyEvent event, int policyFlags) {
+ synchronized (mFocusEventDebugViewLock) {
+ if (mFocusEventDebugView != null) {
+ mFocusEventDebugView.reportEvent(event);
+ }
+ }
return mWindowManagerCallbacks.interceptKeyBeforeQueueing(event, policyFlags);
}
@@ -3367,6 +3380,45 @@
}
}
+ void updateFocusEventDebugViewEnabled(boolean enabled) {
+ FocusEventDebugView view;
+ synchronized (mFocusEventDebugViewLock) {
+ if (enabled == (mFocusEventDebugView != null)) {
+ return;
+ }
+ if (enabled) {
+ mFocusEventDebugView = new FocusEventDebugView(mContext);
+ view = mFocusEventDebugView;
+ } else {
+ view = mFocusEventDebugView;
+ mFocusEventDebugView = null;
+ }
+ }
+ Objects.requireNonNull(view);
+
+ // Interact with WM outside the lock, since the lock is part of the input hotpath.
+ final WindowManager wm =
+ Objects.requireNonNull(mContext.getSystemService(WindowManager.class));
+ if (!enabled) {
+ wm.removeView(view);
+ return;
+ }
+
+ // TODO: Support multi display
+ final WindowManager.LayoutParams lp = new WindowManager.LayoutParams();
+ lp.type = WindowManager.LayoutParams.TYPE_SECURE_SYSTEM_OVERLAY;
+ lp.flags = WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE
+ | WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE
+ | WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN;
+ lp.privateFlags |= WindowManager.LayoutParams.SYSTEM_FLAG_SHOW_FOR_ALL_USERS;
+ lp.setFitInsetsTypes(0);
+ lp.layoutInDisplayCutoutMode = LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS;
+ lp.format = PixelFormat.TRANSLUCENT;
+ lp.setTitle("FocusEventDebugView - display " + mContext.getDisplayId());
+ lp.inputFeatures |= WindowManager.LayoutParams.INPUT_FEATURE_NO_INPUT_CHANNEL;
+ wm.addView(view, lp);
+ }
+
interface KeyboardBacklightControllerInterface {
default void incrementKeyboardBacklight(int deviceId) {}
default void decrementKeyboardBacklight(int deviceId) {}
diff --git a/services/core/java/com/android/server/input/InputSettingsObserver.java b/services/core/java/com/android/server/input/InputSettingsObserver.java
index 153e9c1..651063e 100644
--- a/services/core/java/com/android/server/input/InputSettingsObserver.java
+++ b/services/core/java/com/android/server/input/InputSettingsObserver.java
@@ -43,13 +43,16 @@
private final Context mContext;
private final Handler mHandler;
+ private final InputManagerService mService;
private final NativeInputManagerService mNative;
private final Map<Uri, Consumer<String /* reason*/>> mObservers;
- InputSettingsObserver(Context context, Handler handler, NativeInputManagerService nativeIms) {
+ InputSettingsObserver(Context context, Handler handler, InputManagerService service,
+ NativeInputManagerService nativeIms) {
super(handler);
mContext = context;
mHandler = handler;
+ mService = service;
mNative = nativeIms;
mObservers = Map.ofEntries(
Map.entry(Settings.System.getUriFor(Settings.System.POINTER_SPEED),
@@ -72,7 +75,9 @@
Map.entry(
Settings.Global.getUriFor(
Settings.Global.MAXIMUM_OBSCURING_OPACITY_FOR_TOUCH),
- (reason) -> updateMaximumObscuringOpacityForTouch()));
+ (reason) -> updateMaximumObscuringOpacityForTouch()),
+ Map.entry(Settings.System.getUriFor(Settings.System.SHOW_KEY_PRESSES),
+ (reason) -> updateShowKeyPresses()));
}
/**
@@ -145,6 +150,11 @@
mNative.setShowTouches(getBoolean(Settings.System.SHOW_TOUCHES, false));
}
+ private void updateShowKeyPresses() {
+ mService.updateFocusEventDebugViewEnabled(
+ getBoolean(Settings.System.SHOW_KEY_PRESSES, false));
+ }
+
private void updateAccessibilityLargePointer() {
final int accessibilityConfig = Settings.Secure.getIntForUser(
mContext.getContentResolver(), Settings.Secure.ACCESSIBILITY_LARGE_POINTER_ICON,
diff --git a/services/core/java/com/android/server/wallpaper/WallpaperManagerService.java b/services/core/java/com/android/server/wallpaper/WallpaperManagerService.java
index 2f24b65f..46aa387 100644
--- a/services/core/java/com/android/server/wallpaper/WallpaperManagerService.java
+++ b/services/core/java/com/android/server/wallpaper/WallpaperManagerService.java
@@ -514,6 +514,7 @@
} catch (RemoteException e) {
// if this fails we don't really care; the setting app may just
// have crashed and that sort of thing is a fact of life.
+ Slog.w(TAG, "onWallpaperChanged threw an exception", e);
}
}
}
@@ -524,7 +525,7 @@
try {
cb.onWallpaperChanged();
} catch (RemoteException e) {
- // Oh well it went away; no big deal
+ Slog.w(TAG, "Failed to notify keyguard callback about wallpaper changes", e);
}
}
}
@@ -620,6 +621,7 @@
} catch (RemoteException e) {
// Callback is gone, it's not necessary to unregister it since
// RemoteCallbackList#getBroadcastItem will take care of it.
+ Slog.w(TAG, "onWallpaperColorsChanged() threw an exception", e);
}
}
@@ -628,7 +630,7 @@
try {
keyguardListener.onWallpaperColorsChanged(wallpaperColors, which, userId);
} catch (RemoteException e) {
- // Oh well it went away; no big deal
+ Slog.w(TAG, "keyguardListener.onWallpaperColorsChanged threw an exception", e);
}
}
}
@@ -965,7 +967,7 @@
connection.mService.detach(mToken);
}
} catch (RemoteException e) {
- Slog.w(TAG, "connection.mService.destroy() threw a RemoteException");
+ Slog.w(TAG, "connection.mService.destroy() threw a RemoteException", e);
}
mEngine = null;
}
@@ -1117,7 +1119,7 @@
try {
cb.onColorsChanged(area, colors);
} catch (RemoteException e) {
- e.printStackTrace();
+ Slog.w(TAG, "Failed to notify local color callbacks", e);
}
};
synchronized (mLock) {
@@ -1316,7 +1318,7 @@
try {
mReply.sendResult(null);
} catch (RemoteException e) {
- Slog.d(TAG, "failed to send callback!", e);
+ Slog.d(TAG, "Failed to send callback!", e);
} finally {
Binder.restoreCallingIdentity(ident);
}
@@ -1909,7 +1911,8 @@
try {
si = mIPackageManager.getServiceInfo(cname,
PackageManager.MATCH_DIRECT_BOOT_UNAWARE, wallpaper.userId);
- } catch (RemoteException ignored) {
+ } catch (RemoteException e) {
+ Slog.w(TAG, "Failure starting previous wallpaper; clearing", e);
}
if (mIsLockscreenLiveWallpaperEnabled) {
@@ -1918,7 +1921,6 @@
}
if (si == null) {
- Slog.w(TAG, "Failure starting previous wallpaper; clearing");
clearWallpaperLocked(false, FLAG_SYSTEM, wallpaper.userId, reply);
} else {
Slog.w(TAG, "Wallpaper isn't direct boot aware; using fallback until unlocked");
@@ -1942,8 +1944,6 @@
WallpaperData wallpaper, IRemoteCallback reply, ServiceInfo serviceInfo) {
if (serviceInfo == null) {
- Slog.w(TAG, "Failure starting previous wallpaper; clearing");
-
if (wallpaper.mWhich == (FLAG_LOCK | FLAG_SYSTEM)) {
clearWallpaperLocked(false, FLAG_SYSTEM, wallpaper.userId, null);
clearWallpaperLocked(false, FLAG_LOCK, wallpaper.userId, reply);
@@ -2042,7 +2042,7 @@
try {
cb.onWallpaperChanged();
} catch (RemoteException e) {
- // Oh well it went away; no big deal
+ Slog.w(TAG, "Failed to notify keyguard after wallpaper clear", e);
}
}
saveSettingsLocked(userId);
@@ -2074,6 +2074,7 @@
try {
reply.sendResult(null);
} catch (RemoteException e1) {
+ Slog.w(TAG, "Failed to notify callback after wallpaper clear", e1);
}
}
} finally {
@@ -2168,6 +2169,7 @@
try {
engine.setDesiredSize(width, height);
} catch (RemoteException e) {
+ Slog.w(TAG, "Failed to set desired size", e);
}
notifyCallbacksLocked(wallpaper);
} else if (wallpaper.connection.mService != null && connector != null) {
@@ -2263,6 +2265,7 @@
try {
engine.setDisplayPadding(padding);
} catch (RemoteException e) {
+ Slog.w(TAG, "Failed to set display padding", e);
}
notifyCallbacksLocked(wallpaper);
} else if (wallpaper.connection.mService != null && connector != null) {
@@ -2498,7 +2501,7 @@
try {
engine.setInAmbientMode(inAmbientMode, animationDuration);
} catch (RemoteException e) {
- // Cannot talk to wallpaper engine.
+ Slog.w(TAG, "Failed to set ambient mode", e);
}
}
}
@@ -2532,7 +2535,7 @@
displayConnector.mEngine.dispatchWallpaperCommand(
WallpaperManager.COMMAND_WAKING_UP, x, y, -1, extras);
} catch (RemoteException e) {
- e.printStackTrace();
+ Slog.w(TAG, "Failed to dispatch COMMAND_WAKING_UP", e);
}
}
});
@@ -2571,7 +2574,7 @@
WallpaperManager.COMMAND_GOING_TO_SLEEP, x, y, -1,
extras);
} catch (RemoteException e) {
- e.printStackTrace();
+ Slog.w(TAG, "Failed to dispatch COMMAND_GOING_TO_SLEEP", e);
}
}
});
@@ -2611,7 +2614,7 @@
try {
engine.onScreenTurnedOn();
} catch (RemoteException e) {
- e.printStackTrace();
+ Slog.w(TAG, "Failed to notify that the screen turned on", e);
}
}
}
@@ -2652,7 +2655,7 @@
try {
engine.onScreenTurningOn();
} catch (RemoteException e) {
- e.printStackTrace();
+ Slog.w(TAG, "Failed to notify that the screen is turning on", e);
}
}
}
@@ -2690,7 +2693,7 @@
WallpaperManager.COMMAND_KEYGUARD_GOING_AWAY,
-1, -1, -1, new Bundle());
} catch (RemoteException e) {
- e.printStackTrace();
+ Slog.w(TAG, "Failed to notify that the keyguard is going away", e);
}
}
});
@@ -2853,10 +2856,8 @@
try {
connector.mEngine.applyDimming(maxDimAmount);
} catch (RemoteException e) {
- Slog.w(TAG,
- "Can't apply dimming on wallpaper display "
- + "connector",
- e);
+ Slog.w(TAG, "Can't apply dimming on wallpaper display "
+ + "connector", e);
}
}
});
@@ -3573,6 +3574,7 @@
try {
wallpaper.connection.mReply.sendResult(null);
} catch (RemoteException e) {
+ Slog.w(TAG, "Error sending reply to wallpaper before disconnect", e);
}
wallpaper.connection.mReply = null;
}
@@ -3640,6 +3642,7 @@
// The RemoteCallbackList will take care of removing
// the dead object for us.
+ Slog.w(TAG, "Failed to notify callbacks about wallpaper changes", e);
}
}
wallpaper.callbacks.finishBroadcast();
diff --git a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
index dcd80ff..b856a5e 100644
--- a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
+++ b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
@@ -1214,7 +1214,7 @@
sendDeviceOwnerUserCommand(DeviceAdminReceiver.ACTION_USER_STOPPED, userHandle);
if (isManagedProfile(userHandle)) {
Slogf.d(LOG_TAG, "Managed profile was stopped");
- updatePersonalAppsSuspension(userHandle, false /* unlocked */);
+ updatePersonalAppsSuspension(userHandle);
}
} else if (Intent.ACTION_USER_SWITCHED.equals(action)) {
sendDeviceOwnerUserCommand(DeviceAdminReceiver.ACTION_USER_SWITCHED, userHandle);
@@ -1224,8 +1224,7 @@
}
if (isManagedProfile(userHandle)) {
Slogf.d(LOG_TAG, "Managed profile became unlocked");
- final boolean suspended =
- updatePersonalAppsSuspension(userHandle, true /* unlocked */);
+ final boolean suspended = updatePersonalAppsSuspension(userHandle);
triggerPolicyComplianceCheckIfNeeded(userHandle, suspended);
}
} else if (Intent.ACTION_EXTERNAL_APPLICATIONS_UNAVAILABLE.equals(action)) {
@@ -1252,13 +1251,13 @@
updateSystemUpdateFreezePeriodsRecord(/* saveIfChanged */ true);
final int userId = getManagedUserId(getMainUserId());
if (userId >= 0) {
- updatePersonalAppsSuspension(userId, mUserManager.isUserUnlocked(userId));
+ updatePersonalAppsSuspension(userId);
}
} else if (ACTION_PROFILE_OFF_DEADLINE.equals(action)) {
Slogf.i(LOG_TAG, "Profile off deadline alarm was triggered");
final int userId = getManagedUserId(getMainUserId());
if (userId >= 0) {
- updatePersonalAppsSuspension(userId, mUserManager.isUserUnlocked(userId));
+ updatePersonalAppsSuspension(userId);
} else {
Slogf.wtf(LOG_TAG, "Got deadline alarm for nonexistent profile");
}
@@ -1268,9 +1267,12 @@
} else if (ACTION_MANAGED_PROFILE_UNAVAILABLE.equals(action)) {
notifyIfManagedSubscriptionsAreUnavailable(
UserHandle.of(userHandle), /* managedProfileAvailable= */ false);
+ updatePersonalAppsSuspension(userHandle);
} else if (ACTION_MANAGED_PROFILE_AVAILABLE.equals(action)) {
notifyIfManagedSubscriptionsAreUnavailable(
UserHandle.of(userHandle), /* managedProfileAvailable= */ true);
+ final boolean suspended = updatePersonalAppsSuspension(userHandle);
+ triggerPolicyComplianceCheckIfNeeded(userHandle, suspended);
} else if (LOGIN_ACCOUNTS_CHANGED_ACTION.equals(action)) {
calculateHasIncompatibleAccounts();
}
@@ -3433,7 +3435,7 @@
final int profileUserHandle = getManagedUserId(userHandle);
if (profileUserHandle >= 0) {
// Given that the parent user has just started, profile should be locked.
- updatePersonalAppsSuspension(profileUserHandle, false /* unlocked */);
+ updatePersonalAppsSuspension(profileUserHandle);
} else {
suspendPersonalAppsInternal(userHandle, profileUserHandle, false);
}
@@ -20786,7 +20788,7 @@
}
mInjector.binderWithCleanCallingIdentity(() -> updatePersonalAppsSuspension(
- callingUserId, mUserManager.isUserUnlocked(callingUserId)));
+ callingUserId));
DevicePolicyEventLogger
.createEvent(DevicePolicyEnums.SET_PERSONAL_APPS_SUSPENDED)
@@ -20820,16 +20822,19 @@
/**
* Checks whether personal apps should be suspended according to the policy and applies the
* change if needed.
- *
- * @param unlocked whether the profile is currently running unlocked.
*/
- private boolean updatePersonalAppsSuspension(int profileUserId, boolean unlocked) {
+ private boolean updatePersonalAppsSuspension(int profileUserId) {
final boolean shouldSuspend;
synchronized (getLockObject()) {
final ActiveAdmin profileOwner = getProfileOwnerAdminLocked(profileUserId);
if (profileOwner != null) {
- final int notificationState =
- updateProfileOffDeadlineLocked(profileUserId, profileOwner, unlocked);
+ // Profile is considered "off" when it is either not running or is running locked
+ // or is in quiet mode, i.e. when the admin cannot sync policies or show UI.
+ boolean profileUserOff =
+ !mUserManagerInternal.isUserUnlockingOrUnlocked(profileUserId)
+ || mUserManager.isQuietModeEnabled(UserHandle.of(profileUserId));
+ final int notificationState = updateProfileOffDeadlineLocked(
+ profileUserId, profileOwner, profileUserOff);
final boolean suspendedExplicitly = profileOwner.mSuspendPersonalApps;
final boolean suspendedByTimeout = profileOwner.mProfileOffDeadline == -1;
Slogf.d(LOG_TAG,
@@ -20854,16 +20859,16 @@
* @return notification state
*/
private int updateProfileOffDeadlineLocked(
- int profileUserId, ActiveAdmin profileOwner, boolean unlocked) {
+ int profileUserId, ActiveAdmin profileOwner, boolean off) {
final long now = mInjector.systemCurrentTimeMillis();
if (profileOwner.mProfileOffDeadline != 0 && now > profileOwner.mProfileOffDeadline) {
- Slogf.i(LOG_TAG, "Profile off deadline has been reached, unlocked: " + unlocked);
+ Slogf.i(LOG_TAG, "Profile off deadline has been reached, off: " + off);
if (profileOwner.mProfileOffDeadline != -1) {
// Move the deadline far to the past so that it cannot be rolled back by TZ change.
profileOwner.mProfileOffDeadline = -1;
saveSettingsLocked(profileUserId);
}
- return unlocked ? PROFILE_OFF_NOTIFICATION_NONE : PROFILE_OFF_NOTIFICATION_SUSPENDED;
+ return off ? PROFILE_OFF_NOTIFICATION_SUSPENDED : PROFILE_OFF_NOTIFICATION_NONE;
}
boolean shouldSaveSettings = false;
if (profileOwner.mSuspendPersonalApps) {
@@ -20880,7 +20885,7 @@
profileOwner.mProfileOffDeadline = 0;
shouldSaveSettings = true;
} else if (profileOwner.mProfileOffDeadline == 0
- && (profileOwner.mProfileMaximumTimeOffMillis != 0 && !unlocked)) {
+ && (profileOwner.mProfileMaximumTimeOffMillis != 0 && off)) {
// There profile is locked and there is a policy, but the deadline is not set -> set the
// deadline.
Slogf.i(LOG_TAG, "Profile off deadline is set.");
@@ -20894,7 +20899,7 @@
final long alarmTime;
final int notificationState;
- if (unlocked || profileOwner.mProfileOffDeadline == 0) {
+ if (!off || profileOwner.mProfileOffDeadline == 0) {
alarmTime = 0;
notificationState = PROFILE_OFF_NOTIFICATION_NONE;
} else if (profileOwner.mProfileOffDeadline - now < MANAGED_PROFILE_OFF_WARNING_PERIOD) {
@@ -21168,7 +21173,7 @@
}
mInjector.binderWithCleanCallingIdentity(
- () -> updatePersonalAppsSuspension(userId, mUserManager.isUserUnlocked()));
+ () -> updatePersonalAppsSuspension(userId));
DevicePolicyEventLogger
.createEvent(DevicePolicyEnums.SET_MANAGED_PROFILE_MAXIMUM_TIME_OFF)
diff --git a/services/tests/servicestests/src/com/android/server/devicepolicy/DevicePolicyManagerTest.java b/services/tests/servicestests/src/com/android/server/devicepolicy/DevicePolicyManagerTest.java
index 2ea56f6..39de2cf 100644
--- a/services/tests/servicestests/src/com/android/server/devicepolicy/DevicePolicyManagerTest.java
+++ b/services/tests/servicestests/src/com/android/server/devicepolicy/DevicePolicyManagerTest.java
@@ -8600,6 +8600,8 @@
private void setUserUnlocked(int userHandle, boolean unlocked) {
when(getServices().userManager.isUserUnlocked(eq(userHandle))).thenReturn(unlocked);
+ when(getServices().userManagerInternal.isUserUnlockingOrUnlocked(eq(userHandle)))
+ .thenReturn(unlocked);
}
private void prepareMocksForSetMaximumProfileTimeOff() throws Exception {