Merge "Flag roundness/1: Remove Flags.USE_ROUNDNESS_SOURCETYPES" into udc-dev am: d27cba9d16
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/22746541 Change-Id: Id03e21cebd5bc054126c142db35cd7e048af52af Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -68,8 +68,6 @@ object Flags {
|
||||
val NOTIFICATION_MEMORY_LOGGING_ENABLED =
|
||||
unreleasedFlag(119, "notification_memory_logging_enabled")
|
||||
|
||||
@JvmField val USE_ROUNDNESS_SOURCETYPES = releasedFlag(116, "use_roundness_sourcetype")
|
||||
|
||||
@JvmField
|
||||
val SIMPLIFIED_APPEAR_FRACTION =
|
||||
releasedFlag(259395680, "simplified_appear_fraction")
|
||||
|
||||
@@ -52,7 +52,7 @@ public class LegacyNotificationShelfControllerImpl implements NotificationShelfC
|
||||
mActivatableNotificationViewController = activatableNotificationViewController;
|
||||
mKeyguardBypassController = keyguardBypassController;
|
||||
mStatusBarStateController = statusBarStateController;
|
||||
mView.useRoundnessSourceTypes(featureFlags.isEnabled(Flags.USE_ROUNDNESS_SOURCETYPES));
|
||||
mView.useRoundnessSourceTypes(true);
|
||||
mView.setSensitiveRevealAnimEndabled(featureFlags.isEnabled(Flags.SENSITIVE_REVEAL_ANIM));
|
||||
mOnAttachStateChangeListener = new View.OnAttachStateChangeListener() {
|
||||
@Override
|
||||
|
||||
@@ -261,8 +261,7 @@ public class ExpandableNotificationRowController implements NotifViewController
|
||||
mStatusBarStateController.removeCallback(mStatusBarStateListener);
|
||||
}
|
||||
});
|
||||
mView.useRoundnessSourceTypes(
|
||||
mFeatureFlags.isEnabled(Flags.USE_ROUNDNESS_SOURCETYPES));
|
||||
mView.useRoundnessSourceTypes(true);
|
||||
}
|
||||
|
||||
private final StatusBarStateController.StateListener mStatusBarStateListener =
|
||||
|
||||
@@ -81,7 +81,7 @@ object NotificationShelfViewBinder {
|
||||
ActivatableNotificationViewBinder.bind(viewModel, shelf, falsingManager)
|
||||
shelf.apply {
|
||||
setRefactorFlagEnabled(true)
|
||||
useRoundnessSourceTypes(featureFlags.isEnabled(Flags.USE_ROUNDNESS_SOURCETYPES))
|
||||
useRoundnessSourceTypes(true)
|
||||
setSensitiveRevealAnimEndabled(featureFlags.isEnabled(Flags.SENSITIVE_REVEAL_ANIM))
|
||||
// TODO(278765923): Replace with eventual NotificationIconContainerViewBinder#bind()
|
||||
notificationIconAreaController.setShelfIcons(shelfIcons)
|
||||
|
||||
@@ -25,8 +25,6 @@ import com.android.systemui.Dumpable;
|
||||
import com.android.systemui.R;
|
||||
import com.android.systemui.dagger.SysUISingleton;
|
||||
import com.android.systemui.dump.DumpManager;
|
||||
import com.android.systemui.flags.FeatureFlags;
|
||||
import com.android.systemui.flags.Flags;
|
||||
import com.android.systemui.statusbar.notification.LegacySourceType;
|
||||
import com.android.systemui.statusbar.notification.NotificationSectionsFeatureManager;
|
||||
import com.android.systemui.statusbar.notification.Roundable;
|
||||
@@ -73,8 +71,7 @@ public class NotificationRoundnessManager implements Dumpable {
|
||||
NotificationRoundnessManager(
|
||||
NotificationSectionsFeatureManager sectionsFeatureManager,
|
||||
NotificationRoundnessLogger notifLogger,
|
||||
DumpManager dumpManager,
|
||||
FeatureFlags featureFlags) {
|
||||
DumpManager dumpManager) {
|
||||
int numberOfSections = sectionsFeatureManager.getNumberOfBuckets();
|
||||
mFirstInSectionViews = new ExpandableView[numberOfSections];
|
||||
mLastInSectionViews = new ExpandableView[numberOfSections];
|
||||
@@ -82,7 +79,7 @@ public class NotificationRoundnessManager implements Dumpable {
|
||||
mTmpLastInSectionViews = new ExpandableView[numberOfSections];
|
||||
mNotifLogger = notifLogger;
|
||||
mDumpManager = dumpManager;
|
||||
mUseRoundnessSourceTypes = featureFlags.isEnabled(Flags.USE_ROUNDNESS_SOURCETYPES);
|
||||
mUseRoundnessSourceTypes = true;
|
||||
|
||||
mDumpManager.registerDumpable(TAG, this);
|
||||
}
|
||||
|
||||
@@ -19,8 +19,6 @@ import android.annotation.ColorInt
|
||||
import android.util.Log
|
||||
import android.view.View
|
||||
import com.android.internal.annotations.VisibleForTesting
|
||||
import com.android.systemui.flags.FeatureFlags
|
||||
import com.android.systemui.flags.Flags
|
||||
import com.android.systemui.media.controls.ui.KeyguardMediaController
|
||||
import com.android.systemui.statusbar.notification.NotificationSectionsFeatureManager
|
||||
import com.android.systemui.statusbar.notification.SourceType
|
||||
@@ -51,11 +49,10 @@ class NotificationSectionsManager @Inject internal constructor(
|
||||
@IncomingHeader private val incomingHeaderController: SectionHeaderController,
|
||||
@PeopleHeader private val peopleHeaderController: SectionHeaderController,
|
||||
@AlertingHeader private val alertingHeaderController: SectionHeaderController,
|
||||
@SilentHeader private val silentHeaderController: SectionHeaderController,
|
||||
featureFlags: FeatureFlags
|
||||
@SilentHeader private val silentHeaderController: SectionHeaderController
|
||||
) : SectionProvider {
|
||||
|
||||
private val useRoundnessSourceTypes = featureFlags.isEnabled(Flags.USE_ROUNDNESS_SOURCETYPES)
|
||||
private val useRoundnessSourceTypes = true
|
||||
|
||||
private val configurationListener = object : ConfigurationController.ConfigurationListener {
|
||||
override fun onLocaleListChanged() {
|
||||
|
||||
@@ -625,7 +625,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
|
||||
mDebugLines = featureFlags.isEnabled(Flags.NSSL_DEBUG_LINES);
|
||||
mDebugRemoveAnimation = featureFlags.isEnabled(Flags.NSSL_DEBUG_REMOVE_ANIMATION);
|
||||
mSimplifiedAppearFraction = featureFlags.isEnabled(Flags.SIMPLIFIED_APPEAR_FRACTION);
|
||||
mUseRoundnessSourceTypes = featureFlags.isEnabled(Flags.USE_ROUNDNESS_SOURCETYPES);
|
||||
mUseRoundnessSourceTypes = true;
|
||||
mSensitiveRevealAnimEndabled = featureFlags.isEnabled(Flags.SENSITIVE_REVEAL_ANIM);
|
||||
setAnimatedInsetsEnabled(featureFlags.isEnabled(Flags.ANIMATED_NOTIFICATION_SHADE_INSETS));
|
||||
mSectionsManager = Dependency.get(NotificationSectionsManager.class);
|
||||
|
||||
@@ -61,7 +61,6 @@ import com.android.systemui.classifier.FalsingCollector;
|
||||
import com.android.systemui.dagger.qualifiers.Main;
|
||||
import com.android.systemui.dump.DumpManager;
|
||||
import com.android.systemui.flags.FeatureFlags;
|
||||
import com.android.systemui.flags.Flags;
|
||||
import com.android.systemui.media.controls.ui.KeyguardMediaController;
|
||||
import com.android.systemui.plugins.ActivityStarter;
|
||||
import com.android.systemui.plugins.FalsingManager;
|
||||
@@ -126,8 +125,6 @@ import com.android.systemui.tuner.TunerService;
|
||||
import com.android.systemui.util.Compile;
|
||||
import com.android.systemui.util.settings.SecureSettings;
|
||||
|
||||
import kotlin.Unit;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
@@ -723,7 +720,7 @@ public class NotificationStackScrollLayoutController {
|
||||
mShadeController = shadeController;
|
||||
mNotifIconAreaController = notifIconAreaController;
|
||||
mFeatureFlags = featureFlags;
|
||||
mUseRoundnessSourceTypes = featureFlags.isEnabled(Flags.USE_ROUNDNESS_SOURCETYPES);
|
||||
mUseRoundnessSourceTypes = true;
|
||||
mNotificationTargetsHelper = notificationTargetsHelper;
|
||||
mSecureSettings = secureSettings;
|
||||
mDismissibilityProvider = dismissibilityProvider;
|
||||
@@ -822,7 +819,7 @@ public class NotificationStackScrollLayoutController {
|
||||
mView.generateRemoveAnimation(mKeyguardMediaController.getSinglePaneContainer());
|
||||
}
|
||||
mView.requestChildrenUpdate();
|
||||
return Unit.INSTANCE;
|
||||
return kotlin.Unit.INSTANCE;
|
||||
});
|
||||
|
||||
// attach callback, and then call it to update mView immediately
|
||||
|
||||
@@ -35,7 +35,6 @@ import com.android.internal.jank.InteractionJankMonitor;
|
||||
import com.android.systemui.SwipeHelper;
|
||||
import com.android.systemui.dagger.qualifiers.Main;
|
||||
import com.android.systemui.flags.FeatureFlags;
|
||||
import com.android.systemui.flags.Flags;
|
||||
import com.android.systemui.plugins.FalsingManager;
|
||||
import com.android.systemui.plugins.statusbar.NotificationMenuRowPlugin;
|
||||
import com.android.systemui.plugins.statusbar.NotificationSwipeActionHelper;
|
||||
@@ -81,7 +80,7 @@ class NotificationSwipeHelper extends SwipeHelper implements NotificationSwipeAc
|
||||
NotificationRoundnessManager notificationRoundnessManager) {
|
||||
super(callback, resources, viewConfiguration, falsingManager, featureFlags);
|
||||
mNotificationRoundnessManager = notificationRoundnessManager;
|
||||
mUseRoundnessSourceTypes = featureFlags.isEnabled(Flags.USE_ROUNDNESS_SOURCETYPES);
|
||||
mUseRoundnessSourceTypes = true;
|
||||
mMenuListener = menuListener;
|
||||
mCallback = callback;
|
||||
mFalsingCheck = () -> resetExposedMenuView(true /* animate */, true /* force */);
|
||||
|
||||
@@ -20,7 +20,7 @@ class NotificationTargetsHelper
|
||||
constructor(
|
||||
featureFlags: FeatureFlags,
|
||||
) {
|
||||
private val useRoundnessSourceTypes = featureFlags.isEnabled(Flags.USE_ROUNDNESS_SOURCETYPES)
|
||||
private val useRoundnessSourceTypes = true
|
||||
|
||||
/**
|
||||
* This method looks for views that can be rounded (and implement [Roundable]) during a
|
||||
|
||||
@@ -27,8 +27,6 @@ import androidx.annotation.NonNull;
|
||||
import com.android.internal.annotations.VisibleForTesting;
|
||||
import com.android.internal.widget.ViewClippingUtil;
|
||||
import com.android.systemui.R;
|
||||
import com.android.systemui.flags.FeatureFlags;
|
||||
import com.android.systemui.flags.Flags;
|
||||
import com.android.systemui.plugins.DarkIconDispatcher;
|
||||
import com.android.systemui.plugins.statusbar.StatusBarStateController;
|
||||
import com.android.systemui.shade.ShadeHeadsUpTracker;
|
||||
@@ -120,14 +118,13 @@ public class HeadsUpAppearanceController extends ViewController<HeadsUpStatusBar
|
||||
NotificationStackScrollLayoutController stackScrollerController,
|
||||
ShadeViewController shadeViewController,
|
||||
NotificationRoundnessManager notificationRoundnessManager,
|
||||
FeatureFlags featureFlags,
|
||||
HeadsUpStatusBarView headsUpStatusBarView,
|
||||
Clock clockView,
|
||||
@Named(OPERATOR_NAME_FRAME_VIEW) Optional<View> operatorNameViewOptional) {
|
||||
super(headsUpStatusBarView);
|
||||
mNotificationIconAreaController = notificationIconAreaController;
|
||||
mNotificationRoundnessManager = notificationRoundnessManager;
|
||||
mUseRoundnessSourceTypes = featureFlags.isEnabled(Flags.USE_ROUNDNESS_SOURCETYPES);
|
||||
mUseRoundnessSourceTypes = true;
|
||||
mHeadsUpManager = headsUpManager;
|
||||
|
||||
// We may be mid-HUN-expansion when this controller is re-created (for example, if the user
|
||||
|
||||
@@ -1,370 +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.stack;
|
||||
|
||||
import static org.mockito.ArgumentMatchers.anyBoolean;
|
||||
import static org.mockito.ArgumentMatchers.eq;
|
||||
import static org.mockito.Mockito.atLeast;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.never;
|
||||
import static org.mockito.Mockito.reset;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import android.content.res.Resources;
|
||||
import android.testing.AndroidTestingRunner;
|
||||
import android.testing.TestableLooper;
|
||||
import android.testing.TestableLooper.RunWithLooper;
|
||||
|
||||
import androidx.test.filters.SmallTest;
|
||||
|
||||
import com.android.systemui.R;
|
||||
import com.android.systemui.SysuiTestCase;
|
||||
import com.android.systemui.dump.DumpManager;
|
||||
import com.android.systemui.flags.FeatureFlags;
|
||||
import com.android.systemui.statusbar.notification.NotificationSectionsFeatureManager;
|
||||
import com.android.systemui.statusbar.notification.collection.NotificationEntry;
|
||||
import com.android.systemui.statusbar.notification.logging.NotificationRoundnessLogger;
|
||||
import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow;
|
||||
import com.android.systemui.statusbar.notification.row.ExpandableView;
|
||||
import com.android.systemui.statusbar.notification.row.NotificationTestHelper;
|
||||
import com.android.systemui.util.DeviceConfigProxy;
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.MockitoAnnotations;
|
||||
|
||||
import java.util.HashSet;
|
||||
|
||||
@SmallTest
|
||||
@RunWith(AndroidTestingRunner.class)
|
||||
@RunWithLooper
|
||||
public class NotificationRoundnessManagerTest extends SysuiTestCase {
|
||||
|
||||
private NotificationRoundnessManager mRoundnessManager;
|
||||
private HashSet<ExpandableView> mAnimatedChildren = new HashSet<>();
|
||||
private Runnable mRoundnessCallback = mock(Runnable.class);
|
||||
private ExpandableNotificationRow mFirst;
|
||||
private ExpandableNotificationRow mSecond;
|
||||
private NotificationRoundnessLogger mLogger = mock(NotificationRoundnessLogger.class);
|
||||
private float mSmallRadiusRatio;
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
MockitoAnnotations.initMocks(this);
|
||||
final Resources resources = mContext.getResources();
|
||||
mSmallRadiusRatio = resources.getDimension(R.dimen.notification_corner_radius_small)
|
||||
/ resources.getDimension(R.dimen.notification_corner_radius);
|
||||
mRoundnessManager = new NotificationRoundnessManager(
|
||||
new NotificationSectionsFeatureManager(new DeviceConfigProxy(), mContext),
|
||||
mLogger,
|
||||
mock(DumpManager.class),
|
||||
mock(FeatureFlags.class));
|
||||
allowTestableLooperAsMainThread();
|
||||
NotificationTestHelper testHelper = new NotificationTestHelper(
|
||||
mContext,
|
||||
mDependency,
|
||||
TestableLooper.get(this));
|
||||
mFirst = testHelper.createRow();
|
||||
mFirst.setHeadsUpAnimatingAwayListener(animatingAway
|
||||
-> mRoundnessManager.updateView(mFirst, false));
|
||||
mSecond = testHelper.createRow();
|
||||
mSecond.setHeadsUpAnimatingAwayListener(animatingAway
|
||||
-> mRoundnessManager.updateView(mSecond, false));
|
||||
mRoundnessManager.setOnRoundingChangedCallback(mRoundnessCallback);
|
||||
mRoundnessManager.setAnimatedChildren(mAnimatedChildren);
|
||||
mRoundnessManager.updateRoundedChildren(new NotificationSection[]{
|
||||
createSection(mFirst, mFirst),
|
||||
createSection(null, null)
|
||||
});
|
||||
mRoundnessManager.setExpanded(1.0f, 1.0f);
|
||||
mRoundnessManager.setShouldRoundPulsingViews(true);
|
||||
reset(mRoundnessCallback);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCallbackCalledWhenSecondChanged() {
|
||||
mRoundnessManager.updateRoundedChildren(new NotificationSection[]{
|
||||
createSection(mFirst, mSecond),
|
||||
createSection(null, null)
|
||||
});
|
||||
verify(mRoundnessCallback, atLeast(1)).run();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCallbackCalledWhenFirstChanged() {
|
||||
mRoundnessManager.updateRoundedChildren(new NotificationSection[]{
|
||||
createSection(mSecond, mFirst),
|
||||
createSection(null, null)
|
||||
});
|
||||
verify(mRoundnessCallback, atLeast(1)).run();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCallbackCalledWhenSecondSectionFirstChanged() {
|
||||
mRoundnessManager.updateRoundedChildren(new NotificationSection[]{
|
||||
createSection(mFirst, mFirst),
|
||||
createSection(mSecond, null)
|
||||
});
|
||||
verify(mRoundnessCallback, atLeast(1)).run();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCallbackCalledWhenSecondSectionLastChanged() {
|
||||
mRoundnessManager.updateRoundedChildren(new NotificationSection[]{
|
||||
createSection(mFirst, mFirst),
|
||||
createSection(null, mSecond)
|
||||
});
|
||||
verify(mRoundnessCallback, atLeast(1)).run();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCallbackNotCalledWhenFirstChangesSections() {
|
||||
mRoundnessManager.updateRoundedChildren(new NotificationSection[]{
|
||||
createSection(null, mFirst),
|
||||
createSection(mFirst, null)
|
||||
});
|
||||
verify(mRoundnessCallback, never()).run();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRoundnessSetOnLast() {
|
||||
mRoundnessManager.updateRoundedChildren(new NotificationSection[]{
|
||||
createSection(mFirst, mSecond),
|
||||
createSection(null, null)
|
||||
});
|
||||
Assert.assertEquals(1.0f, mSecond.getBottomRoundness(), 0.0f);
|
||||
Assert.assertEquals(mSmallRadiusRatio, mSecond.getTopRoundness(), 0.0f);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRoundnessPulsing() throws Exception {
|
||||
// Let's create a notification that's neither the first or last item of the stack,
|
||||
// this way we'll ensure that it won't have any rounded corners by default.
|
||||
mRoundnessManager.updateRoundedChildren(new NotificationSection[]{
|
||||
createSection(mFirst, mSecond),
|
||||
createSection(null, null)
|
||||
});
|
||||
NotificationTestHelper testHelper = new NotificationTestHelper(
|
||||
mContext,
|
||||
mDependency,
|
||||
TestableLooper.get(this));
|
||||
ExpandableNotificationRow row = testHelper.createRow();
|
||||
NotificationEntry entry = mock(NotificationEntry.class);
|
||||
when(entry.getRow()).thenReturn(row);
|
||||
|
||||
when(testHelper.getStatusBarStateController().isDozing()).thenReturn(true);
|
||||
row.setHeadsUp(true);
|
||||
mRoundnessManager.updateView(entry.getRow(), false);
|
||||
Assert.assertEquals(1f, row.getBottomRoundness(), 0.0f);
|
||||
Assert.assertEquals(1f, row.getTopRoundness(), 0.0f);
|
||||
|
||||
row.setHeadsUp(false);
|
||||
mRoundnessManager.updateView(entry.getRow(), false);
|
||||
Assert.assertEquals(mSmallRadiusRatio, row.getBottomRoundness(), 0.0f);
|
||||
Assert.assertEquals(mSmallRadiusRatio, row.getTopRoundness(), 0.0f);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRoundnessSetOnSecondSectionLast() {
|
||||
mRoundnessManager.updateRoundedChildren(new NotificationSection[]{
|
||||
createSection(mFirst, mFirst),
|
||||
createSection(null, mSecond)
|
||||
});
|
||||
Assert.assertEquals(1.0f, mSecond.getBottomRoundness(), 0.0f);
|
||||
Assert.assertEquals(mSmallRadiusRatio, mSecond.getTopRoundness(), 0.0f);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRoundnessSetOnSecondSectionFirst() {
|
||||
mRoundnessManager.updateRoundedChildren(new NotificationSection[]{
|
||||
createSection(mFirst, mFirst),
|
||||
createSection(mSecond, null)
|
||||
});
|
||||
Assert.assertEquals(mSmallRadiusRatio, mSecond.getBottomRoundness(), 0.0f);
|
||||
Assert.assertEquals(1.0f, mSecond.getTopRoundness(), 0.0f);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRoundnessSetOnNew() {
|
||||
mRoundnessManager.updateRoundedChildren(new NotificationSection[]{
|
||||
createSection(mFirst, null),
|
||||
createSection(null, null)
|
||||
});
|
||||
Assert.assertEquals(mSmallRadiusRatio, mFirst.getBottomRoundness(), 0.0f);
|
||||
Assert.assertEquals(1.0f, mFirst.getTopRoundness(), 0.0f);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCompleteReplacement() {
|
||||
mRoundnessManager.updateRoundedChildren(new NotificationSection[]{
|
||||
createSection(mSecond, mSecond),
|
||||
createSection(null, null)
|
||||
});
|
||||
Assert.assertEquals(mSmallRadiusRatio, mFirst.getBottomRoundness(), 0.0f);
|
||||
Assert.assertEquals(mSmallRadiusRatio, mFirst.getTopRoundness(), 0.0f);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNotCalledWhenRemoved() {
|
||||
mFirst.setRemoved();
|
||||
mRoundnessManager.updateRoundedChildren(new NotificationSection[]{
|
||||
createSection(mSecond, mSecond),
|
||||
createSection(null, null)
|
||||
});
|
||||
Assert.assertEquals(1.0f, mFirst.getBottomRoundness(), 0.0f);
|
||||
Assert.assertEquals(1.0f, mFirst.getTopRoundness(), 0.0f);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRoundedWhenPinnedAndCollapsed() {
|
||||
mFirst.setPinned(true);
|
||||
mRoundnessManager.setExpanded(0.0f /* expandedHeight */, 0.0f /* appearFraction */);
|
||||
mRoundnessManager.updateRoundedChildren(new NotificationSection[]{
|
||||
createSection(mSecond, mSecond),
|
||||
createSection(null, null)
|
||||
});
|
||||
Assert.assertEquals(1.0f, mFirst.getBottomRoundness(), 0.0f);
|
||||
Assert.assertEquals(1.0f, mFirst.getTopRoundness(), 0.0f);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRoundedWhenGoingAwayAndCollapsed() {
|
||||
mFirst.setHeadsUpAnimatingAway(true);
|
||||
mRoundnessManager.setExpanded(0.0f /* expandedHeight */, 0.0f /* appearFraction */);
|
||||
mRoundnessManager.updateRoundedChildren(new NotificationSection[]{
|
||||
createSection(mSecond, mSecond),
|
||||
createSection(null, null)
|
||||
});
|
||||
Assert.assertEquals(1.0f, mFirst.getBottomRoundness(), 0.0f);
|
||||
Assert.assertEquals(1.0f, mFirst.getTopRoundness(), 0.0f);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRoundedNormalRoundingWhenExpanded() {
|
||||
mFirst.setHeadsUpAnimatingAway(true);
|
||||
mRoundnessManager.setExpanded(1.0f /* expandedHeight */, 0.0f /* appearFraction */);
|
||||
mRoundnessManager.updateRoundedChildren(new NotificationSection[]{
|
||||
createSection(mSecond, mSecond),
|
||||
createSection(null, null)
|
||||
});
|
||||
Assert.assertEquals(mSmallRadiusRatio, mFirst.getBottomRoundness(), 0.0f);
|
||||
Assert.assertEquals(mSmallRadiusRatio, mFirst.getTopRoundness(), 0.0f);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTrackingHeadsUpRoundedIfPushingUp() {
|
||||
mRoundnessManager.setExpanded(1.0f /* expandedHeight */, -0.5f /* appearFraction */);
|
||||
mRoundnessManager.setTrackingHeadsUp(mFirst);
|
||||
mRoundnessManager.updateRoundedChildren(new NotificationSection[]{
|
||||
createSection(mSecond, mSecond),
|
||||
createSection(null, null)
|
||||
});
|
||||
Assert.assertEquals(1.0f, mFirst.getBottomRoundness(), 0.0f);
|
||||
Assert.assertEquals(1.0f, mFirst.getTopRoundness(), 0.0f);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTrackingHeadsUpPartiallyRoundedIfPushingDown() {
|
||||
mRoundnessManager.setExpanded(1.0f /* expandedHeight */, 0.5f /* appearFraction */);
|
||||
mRoundnessManager.setTrackingHeadsUp(mFirst);
|
||||
mRoundnessManager.updateRoundedChildren(new NotificationSection[]{
|
||||
createSection(mSecond, mSecond),
|
||||
createSection(null, null)
|
||||
});
|
||||
Assert.assertEquals(0.5f, mFirst.getBottomRoundness(), 0.0f);
|
||||
Assert.assertEquals(0.5f, mFirst.getTopRoundness(), 0.0f);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRoundingUpdatedWhenAnimatingAwayTrue() {
|
||||
mRoundnessManager.setExpanded(0.0f, 0.0f);
|
||||
mRoundnessManager.updateRoundedChildren(new NotificationSection[]{
|
||||
createSection(mSecond, mSecond),
|
||||
createSection(null, null)
|
||||
});
|
||||
mFirst.setHeadsUpAnimatingAway(true);
|
||||
Assert.assertEquals(1.0f, mFirst.getBottomRoundness(), 0.0f);
|
||||
Assert.assertEquals(1.0f, mFirst.getTopRoundness(), 0.0f);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testRoundingUpdatedWhenAnimatingAwayFalse() {
|
||||
mRoundnessManager.setExpanded(0.0f, 0.0f);
|
||||
mRoundnessManager.updateRoundedChildren(new NotificationSection[]{
|
||||
createSection(mSecond, mSecond),
|
||||
createSection(null, null)
|
||||
});
|
||||
mFirst.setHeadsUpAnimatingAway(true);
|
||||
mFirst.setHeadsUpAnimatingAway(false);
|
||||
Assert.assertEquals(mSmallRadiusRatio, mFirst.getBottomRoundness(), 0.0f);
|
||||
Assert.assertEquals(mSmallRadiusRatio, mFirst.getTopRoundness(), 0.0f);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNoViewsFirstOrLastInSectionWhenSecondSectionEmpty() {
|
||||
Assert.assertTrue(mFirst.isFirstInSection());
|
||||
Assert.assertTrue(mFirst.isLastInSection());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNoViewsFirstOrLastInSectionWhenFirstSectionEmpty() {
|
||||
mRoundnessManager.updateRoundedChildren(new NotificationSection[]{
|
||||
createSection(null, null),
|
||||
createSection(mSecond, mSecond)
|
||||
});
|
||||
Assert.assertTrue(mSecond.isFirstInSection());
|
||||
Assert.assertTrue(mSecond.isLastInSection());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFirstAndLastViewsInSectionSetWhenBothSectionsNonEmpty() {
|
||||
mRoundnessManager.updateRoundedChildren(new NotificationSection[]{
|
||||
createSection(mFirst, mFirst),
|
||||
createSection(mSecond, mSecond)
|
||||
});
|
||||
Assert.assertTrue(mFirst.isFirstInSection());
|
||||
Assert.assertTrue(mFirst.isLastInSection());
|
||||
Assert.assertTrue(mSecond.isFirstInSection());
|
||||
Assert.assertTrue(mSecond.isLastInSection());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLoggingOnRoundingUpdate() {
|
||||
NotificationSection[] sections = new NotificationSection[]{
|
||||
createSection(mFirst, mSecond),
|
||||
createSection(null, null)
|
||||
};
|
||||
mRoundnessManager.updateRoundedChildren(sections);
|
||||
verify(mLogger).onSectionCornersUpdated(sections, /*anyChanged=*/ true);
|
||||
verify(mLogger, atLeast(1)).onCornersUpdated(eq(mFirst), anyBoolean(),
|
||||
anyBoolean(), anyBoolean(), anyBoolean());
|
||||
verify(mLogger, atLeast(1)).onCornersUpdated(eq(mSecond), anyBoolean(),
|
||||
anyBoolean(), anyBoolean(), anyBoolean());
|
||||
}
|
||||
|
||||
private NotificationSection createSection(ExpandableNotificationRow first,
|
||||
ExpandableNotificationRow last) {
|
||||
NotificationSection section = mock(NotificationSection.class);
|
||||
when(section.getFirstVisibleChild()).thenReturn(first);
|
||||
when(section.getLastVisibleChild()).thenReturn(last);
|
||||
return section;
|
||||
}
|
||||
}
|
||||
@@ -96,8 +96,7 @@ public class NotificationSectionsManagerTest extends SysuiTestCase {
|
||||
mIncomingHeaderController,
|
||||
mPeopleHeaderController,
|
||||
mAlertingHeaderController,
|
||||
mSilentHeaderController,
|
||||
mFeatureFlag
|
||||
mSilentHeaderController
|
||||
);
|
||||
// Required in order for the header inflation to work properly
|
||||
when(mNssl.generateLayoutParams(any(AttributeSet.class)))
|
||||
|
||||
@@ -6,7 +6,6 @@ import android.testing.TestableLooper.RunWithLooper
|
||||
import androidx.test.filters.SmallTest
|
||||
import com.android.systemui.SysuiTestCase
|
||||
import com.android.systemui.flags.FakeFeatureFlags
|
||||
import com.android.systemui.flags.Flags
|
||||
import com.android.systemui.statusbar.notification.row.NotificationTestHelper
|
||||
import com.android.systemui.util.mockito.mock
|
||||
import junit.framework.Assert.assertEquals
|
||||
@@ -30,14 +29,7 @@ class NotificationTargetsHelperTest : SysuiTestCase() {
|
||||
NotificationTestHelper(mContext, mDependency, TestableLooper.get(this))
|
||||
}
|
||||
|
||||
private fun notificationTargetsHelper(
|
||||
notificationGroupCorner: Boolean = true,
|
||||
) =
|
||||
NotificationTargetsHelper(
|
||||
FakeFeatureFlags().apply {
|
||||
set(Flags.USE_ROUNDNESS_SOURCETYPES, notificationGroupCorner)
|
||||
}
|
||||
)
|
||||
private fun notificationTargetsHelper() = NotificationTargetsHelper(FakeFeatureFlags())
|
||||
|
||||
@Test
|
||||
fun targetsForFirstNotificationInGroup() {
|
||||
|
||||
@@ -34,8 +34,6 @@ import android.widget.TextView;
|
||||
import androidx.test.filters.SmallTest;
|
||||
|
||||
import com.android.systemui.SysuiTestCase;
|
||||
import com.android.systemui.flags.FeatureFlags;
|
||||
import com.android.systemui.flags.Flags;
|
||||
import com.android.systemui.plugins.DarkIconDispatcher;
|
||||
import com.android.systemui.plugins.statusbar.StatusBarStateController;
|
||||
import com.android.systemui.shade.ShadeHeadsUpTracker;
|
||||
@@ -82,7 +80,6 @@ public class HeadsUpAppearanceControllerTest extends SysuiTestCase {
|
||||
private KeyguardStateController mKeyguardStateController;
|
||||
private CommandQueue mCommandQueue;
|
||||
private NotificationRoundnessManager mNotificationRoundnessManager;
|
||||
private FeatureFlags mFeatureFlag;
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
@@ -103,9 +100,7 @@ public class HeadsUpAppearanceControllerTest extends SysuiTestCase {
|
||||
mKeyguardStateController = mock(KeyguardStateController.class);
|
||||
mCommandQueue = mock(CommandQueue.class);
|
||||
mNotificationRoundnessManager = mock(NotificationRoundnessManager.class);
|
||||
mFeatureFlag = mock(FeatureFlags.class);
|
||||
when(mShadeViewController.getShadeHeadsUpTracker()).thenReturn(mShadeHeadsUpTracker);
|
||||
when(mFeatureFlag.isEnabled(Flags.USE_ROUNDNESS_SOURCETYPES)).thenReturn(true);
|
||||
mHeadsUpAppearanceController = new HeadsUpAppearanceController(
|
||||
mock(NotificationIconAreaController.class),
|
||||
mHeadsUpManager,
|
||||
@@ -118,7 +113,6 @@ public class HeadsUpAppearanceControllerTest extends SysuiTestCase {
|
||||
mStackScrollerController,
|
||||
mShadeViewController,
|
||||
mNotificationRoundnessManager,
|
||||
mFeatureFlag,
|
||||
mHeadsUpStatusBarView,
|
||||
new Clock(mContext, null),
|
||||
Optional.of(mOperatorNameView));
|
||||
@@ -202,7 +196,6 @@ public class HeadsUpAppearanceControllerTest extends SysuiTestCase {
|
||||
mStackScrollerController,
|
||||
mShadeViewController,
|
||||
mNotificationRoundnessManager,
|
||||
mFeatureFlag,
|
||||
mHeadsUpStatusBarView,
|
||||
new Clock(mContext, null),
|
||||
Optional.empty());
|
||||
|
||||
Reference in New Issue
Block a user