Loading packages/SettingsLib/src/com/android/settingslib/enterprise/BiometricActionDisabledByAdminController.java +2 −2 Original line number Diff line number Diff line Loading @@ -64,9 +64,9 @@ public class BiometricActionDisabledByAdminController extends BaseActionDisabled return (dialog, which) -> { Log.d(TAG, "Positive button clicked, component: " + enforcedAdmin.component); final Intent intent = new Intent(ACTION_LEARN_MORE) .setComponent(enforcedAdmin.component) .putExtra(EXTRA_SETTING_KEY, EXTRA_SETTING_VALUE) .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK) .setPackage(enforcedAdmin.component.getPackageName()); context.startActivity(intent); }; } Loading packages/SystemUI/src/com/android/keyguard/KeyguardPasswordView.java +5 −0 Original line number Diff line number Diff line Loading @@ -209,6 +209,11 @@ public class KeyguardPasswordView extends KeyguardAbsKeyInputView { @Override public void onCancelled( @Nullable WindowInsetsAnimationController controller) { // It is possible to be denied control of ime insets, which means onReady // is never called. We still need to notify the runnables in order to // complete the bouncer disappearing runOnFinishImeAnimationRunnable(); finishRunnable.run(); } }); return true; Loading packages/SystemUI/src/com/android/systemui/qs/QSPanel.java +34 −7 Original line number Diff line number Diff line Loading @@ -27,12 +27,15 @@ import android.os.Bundle; import android.os.Handler; import android.os.Message; import android.util.AttributeSet; import android.util.Log; import android.view.Gravity; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.LinearLayout; import androidx.annotation.VisibleForTesting; import com.android.internal.logging.UiEventLogger; import com.android.internal.widget.RemeasuringLinearLayout; import com.android.systemui.R; Loading Loading @@ -386,19 +389,18 @@ public class QSPanel extends LinearLayout implements Tunable { if (mediaView != null) { index = indexOfChild(mediaView); } if (mSecurityFooter.getParent() == this && indexOfChild(mSecurityFooter) < index) { // When we remove the securityFooter to rearrange, the index of media will go // down by one, so we correct it index--; } switchToParent(mSecurityFooter, this, index); } } } private void switchToParent(View child, ViewGroup parent, int index) { ViewGroup currentParent = (ViewGroup) child.getParent(); if (currentParent != parent || currentParent.indexOfChild(child) != index) { if (currentParent != null) { currentParent.removeView(child); } parent.addView(child, index); } switchToParent(child, parent, index, getDumpableTag()); } /** Call when orientation has changed and MediaHost needs to be adjusted. */ Loading Loading @@ -767,4 +769,29 @@ public class QSPanel extends LinearLayout implements Tunable { interface OnConfigurationChangedListener { void onConfigurationChange(Configuration newConfig); } @VisibleForTesting static void switchToParent(View child, ViewGroup parent, int index, String tag) { if (parent == null) { Log.w(tag, "Trying to move view to null parent", new IllegalStateException()); return; } ViewGroup currentParent = (ViewGroup) child.getParent(); if (currentParent != parent) { if (currentParent != null) { currentParent.removeView(child); } parent.addView(child, index); return; } // Same parent, we are just changing indices int currentIndex = parent.indexOfChild(child); if (currentIndex == index) { // We want to be in the same place. Nothing to do here return; } parent.removeView(child); parent.addView(child, index); } } packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationShadeWindowControllerImpl.java +1 −2 Original line number Diff line number Diff line Loading @@ -296,8 +296,7 @@ public class NotificationShadeWindowControllerImpl implements NotificationShadeW if (mKeyguardPreferredRefreshRate > 0) { boolean onKeyguard = state.mStatusBarState == StatusBarState.KEYGUARD && !state.mKeyguardFadingAway && !state.mKeyguardGoingAway && !state.mDozing; && !state.mKeyguardFadingAway && !state.mKeyguardGoingAway; if (onKeyguard && mAuthController.isUdfpsEnrolled(KeyguardUpdateMonitor.getCurrentUser())) { mLpChanged.preferredMaxDisplayRefreshRate = mKeyguardPreferredRefreshRate; Loading packages/SystemUI/tests/src/com/android/systemui/qs/QSPanelSwitchToParentTest.kt 0 → 100644 +162 −0 Original line number Diff line number Diff line /* * Copyright (C) 2021 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.systemui.qs import com.google.common.truth.Truth.assertThat import androidx.test.filters.SmallTest import android.testing.AndroidTestingRunner import android.view.View import android.view.ViewGroup import android.widget.FrameLayout import com.android.systemui.SysuiTestCase import com.android.systemui.util.children import org.junit.Before import org.junit.Test import org.junit.runner.RunWith @RunWith(AndroidTestingRunner::class) @SmallTest class QSPanelSwitchToParentTest : SysuiTestCase() { private lateinit var parent1: FrameLayout private lateinit var parent2: FrameLayout private lateinit var movingView: View private lateinit var view1A: View private lateinit var view1B: View private lateinit var view1C: View private lateinit var view2A: View private lateinit var view2B: View private lateinit var view2C: View @Before fun setUp() { parent1 = FrameLayout(mContext) parent2 = FrameLayout(mContext) movingView = View(mContext) view1A = View(mContext) parent1.addView(view1A) view1B = View(mContext) parent1.addView(view1B) view1C = View(mContext) parent1.addView(view1C) view2A = View(mContext) parent2.addView(view2A) view2B = View(mContext) parent2.addView(view2B) view2C = View(mContext) parent2.addView(view2C) } @Test fun testNullTargetNoInteractions() { QSPanel.switchToParent(movingView, null, -1, "") assertThat(movingView.parent).isNull() } @Test fun testMoveToEndNoParent() { QSPanel.switchToParent(movingView, parent2, -1, "") assertThat(parent1.childrenList).containsExactly( view1A, view1B, view1C ) assertThat(parent2.childrenList).containsExactly( view2A, view2B, view2C, movingView ) } @Test fun testMoveToEndDifferentParent() { parent1.addView(movingView, 0) QSPanel.switchToParent(movingView, parent2, -1, "") assertThat(parent1.childrenList).containsExactly( view1A, view1B, view1C ) assertThat(parent2.childrenList).containsExactly( view2A, view2B, view2C, movingView ) } @Test fun testMoveToEndSameParent() { parent2.addView(movingView, 0) QSPanel.switchToParent(movingView, parent2, -1, "") assertThat(parent1.childrenList).containsExactly( view1A, view1B, view1C ) assertThat(parent2.childrenList).containsExactly( view2A, view2B, view2C, movingView ) } @Test fun testMoveToMiddleFromNoParent() { QSPanel.switchToParent(movingView, parent2, 1, "") assertThat(parent1.childrenList).containsExactly( view1A, view1B, view1C ) assertThat(parent2.childrenList).containsExactly( view2A, movingView, view2B, view2C ) } @Test fun testMoveToMiddleDifferentParent() { parent1.addView(movingView, 1) QSPanel.switchToParent(movingView, parent2, 2, "") assertThat(parent1.childrenList).containsExactly( view1A, view1B, view1C ) assertThat(parent2.childrenList).containsExactly( view2A, view2B, movingView, view2C ) } @Test fun testMoveToMiddleSameParent() { parent2.addView(movingView, 0) QSPanel.switchToParent(movingView, parent2, 1, "") assertThat(parent1.childrenList).containsExactly( view1A, view1B, view1C ) assertThat(parent2.childrenList).containsExactly( view2A, movingView, view2B, view2C ) } private val ViewGroup.childrenList: List<View> get() = children.toList() } No newline at end of file Loading
packages/SettingsLib/src/com/android/settingslib/enterprise/BiometricActionDisabledByAdminController.java +2 −2 Original line number Diff line number Diff line Loading @@ -64,9 +64,9 @@ public class BiometricActionDisabledByAdminController extends BaseActionDisabled return (dialog, which) -> { Log.d(TAG, "Positive button clicked, component: " + enforcedAdmin.component); final Intent intent = new Intent(ACTION_LEARN_MORE) .setComponent(enforcedAdmin.component) .putExtra(EXTRA_SETTING_KEY, EXTRA_SETTING_VALUE) .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK) .setPackage(enforcedAdmin.component.getPackageName()); context.startActivity(intent); }; } Loading
packages/SystemUI/src/com/android/keyguard/KeyguardPasswordView.java +5 −0 Original line number Diff line number Diff line Loading @@ -209,6 +209,11 @@ public class KeyguardPasswordView extends KeyguardAbsKeyInputView { @Override public void onCancelled( @Nullable WindowInsetsAnimationController controller) { // It is possible to be denied control of ime insets, which means onReady // is never called. We still need to notify the runnables in order to // complete the bouncer disappearing runOnFinishImeAnimationRunnable(); finishRunnable.run(); } }); return true; Loading
packages/SystemUI/src/com/android/systemui/qs/QSPanel.java +34 −7 Original line number Diff line number Diff line Loading @@ -27,12 +27,15 @@ import android.os.Bundle; import android.os.Handler; import android.os.Message; import android.util.AttributeSet; import android.util.Log; import android.view.Gravity; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.LinearLayout; import androidx.annotation.VisibleForTesting; import com.android.internal.logging.UiEventLogger; import com.android.internal.widget.RemeasuringLinearLayout; import com.android.systemui.R; Loading Loading @@ -386,19 +389,18 @@ public class QSPanel extends LinearLayout implements Tunable { if (mediaView != null) { index = indexOfChild(mediaView); } if (mSecurityFooter.getParent() == this && indexOfChild(mSecurityFooter) < index) { // When we remove the securityFooter to rearrange, the index of media will go // down by one, so we correct it index--; } switchToParent(mSecurityFooter, this, index); } } } private void switchToParent(View child, ViewGroup parent, int index) { ViewGroup currentParent = (ViewGroup) child.getParent(); if (currentParent != parent || currentParent.indexOfChild(child) != index) { if (currentParent != null) { currentParent.removeView(child); } parent.addView(child, index); } switchToParent(child, parent, index, getDumpableTag()); } /** Call when orientation has changed and MediaHost needs to be adjusted. */ Loading Loading @@ -767,4 +769,29 @@ public class QSPanel extends LinearLayout implements Tunable { interface OnConfigurationChangedListener { void onConfigurationChange(Configuration newConfig); } @VisibleForTesting static void switchToParent(View child, ViewGroup parent, int index, String tag) { if (parent == null) { Log.w(tag, "Trying to move view to null parent", new IllegalStateException()); return; } ViewGroup currentParent = (ViewGroup) child.getParent(); if (currentParent != parent) { if (currentParent != null) { currentParent.removeView(child); } parent.addView(child, index); return; } // Same parent, we are just changing indices int currentIndex = parent.indexOfChild(child); if (currentIndex == index) { // We want to be in the same place. Nothing to do here return; } parent.removeView(child); parent.addView(child, index); } }
packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationShadeWindowControllerImpl.java +1 −2 Original line number Diff line number Diff line Loading @@ -296,8 +296,7 @@ public class NotificationShadeWindowControllerImpl implements NotificationShadeW if (mKeyguardPreferredRefreshRate > 0) { boolean onKeyguard = state.mStatusBarState == StatusBarState.KEYGUARD && !state.mKeyguardFadingAway && !state.mKeyguardGoingAway && !state.mDozing; && !state.mKeyguardFadingAway && !state.mKeyguardGoingAway; if (onKeyguard && mAuthController.isUdfpsEnrolled(KeyguardUpdateMonitor.getCurrentUser())) { mLpChanged.preferredMaxDisplayRefreshRate = mKeyguardPreferredRefreshRate; Loading
packages/SystemUI/tests/src/com/android/systemui/qs/QSPanelSwitchToParentTest.kt 0 → 100644 +162 −0 Original line number Diff line number Diff line /* * Copyright (C) 2021 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.systemui.qs import com.google.common.truth.Truth.assertThat import androidx.test.filters.SmallTest import android.testing.AndroidTestingRunner import android.view.View import android.view.ViewGroup import android.widget.FrameLayout import com.android.systemui.SysuiTestCase import com.android.systemui.util.children import org.junit.Before import org.junit.Test import org.junit.runner.RunWith @RunWith(AndroidTestingRunner::class) @SmallTest class QSPanelSwitchToParentTest : SysuiTestCase() { private lateinit var parent1: FrameLayout private lateinit var parent2: FrameLayout private lateinit var movingView: View private lateinit var view1A: View private lateinit var view1B: View private lateinit var view1C: View private lateinit var view2A: View private lateinit var view2B: View private lateinit var view2C: View @Before fun setUp() { parent1 = FrameLayout(mContext) parent2 = FrameLayout(mContext) movingView = View(mContext) view1A = View(mContext) parent1.addView(view1A) view1B = View(mContext) parent1.addView(view1B) view1C = View(mContext) parent1.addView(view1C) view2A = View(mContext) parent2.addView(view2A) view2B = View(mContext) parent2.addView(view2B) view2C = View(mContext) parent2.addView(view2C) } @Test fun testNullTargetNoInteractions() { QSPanel.switchToParent(movingView, null, -1, "") assertThat(movingView.parent).isNull() } @Test fun testMoveToEndNoParent() { QSPanel.switchToParent(movingView, parent2, -1, "") assertThat(parent1.childrenList).containsExactly( view1A, view1B, view1C ) assertThat(parent2.childrenList).containsExactly( view2A, view2B, view2C, movingView ) } @Test fun testMoveToEndDifferentParent() { parent1.addView(movingView, 0) QSPanel.switchToParent(movingView, parent2, -1, "") assertThat(parent1.childrenList).containsExactly( view1A, view1B, view1C ) assertThat(parent2.childrenList).containsExactly( view2A, view2B, view2C, movingView ) } @Test fun testMoveToEndSameParent() { parent2.addView(movingView, 0) QSPanel.switchToParent(movingView, parent2, -1, "") assertThat(parent1.childrenList).containsExactly( view1A, view1B, view1C ) assertThat(parent2.childrenList).containsExactly( view2A, view2B, view2C, movingView ) } @Test fun testMoveToMiddleFromNoParent() { QSPanel.switchToParent(movingView, parent2, 1, "") assertThat(parent1.childrenList).containsExactly( view1A, view1B, view1C ) assertThat(parent2.childrenList).containsExactly( view2A, movingView, view2B, view2C ) } @Test fun testMoveToMiddleDifferentParent() { parent1.addView(movingView, 1) QSPanel.switchToParent(movingView, parent2, 2, "") assertThat(parent1.childrenList).containsExactly( view1A, view1B, view1C ) assertThat(parent2.childrenList).containsExactly( view2A, view2B, movingView, view2C ) } @Test fun testMoveToMiddleSameParent() { parent2.addView(movingView, 0) QSPanel.switchToParent(movingView, parent2, 1, "") assertThat(parent1.childrenList).containsExactly( view1A, view1B, view1C ) assertThat(parent2.childrenList).containsExactly( view2A, movingView, view2B, view2C ) } private val ViewGroup.childrenList: List<View> get() = children.toList() } No newline at end of file