Loading packages/SystemUI/src/com/android/systemui/assist/AssistHandleBehaviorController.java +7 −7 Original line number Diff line number Diff line Loading @@ -72,7 +72,7 @@ public final class AssistHandleBehaviorController implements AssistHandleCallbac private final Runnable mHideHandles = this::hideHandles; private final Runnable mShowAndGo = this::showAndGoInternal; private final Provider<ScreenDecorations> mScreenDecorations; private final PhenotypeHelper mPhenotypeHelper; private final DeviceConfigHelper mDeviceConfigHelper; private final Map<AssistHandleBehavior, BehaviorController> mBehaviorMap; private boolean mHandlesShowing = false; Loading @@ -91,7 +91,7 @@ public final class AssistHandleBehaviorController implements AssistHandleCallbac AssistUtils assistUtils, @Named(ASSIST_HANDLE_THREAD_NAME) Handler handler, Provider<ScreenDecorations> screenDecorations, PhenotypeHelper phenotypeHelper, DeviceConfigHelper deviceConfigHelper, Map<AssistHandleBehavior, BehaviorController> behaviorMap, NavigationModeController navigationModeController, DumpController dumpController) { Loading @@ -99,14 +99,14 @@ public final class AssistHandleBehaviorController implements AssistHandleCallbac mAssistUtils = assistUtils; mHandler = handler; mScreenDecorations = screenDecorations; mPhenotypeHelper = phenotypeHelper; mDeviceConfigHelper = deviceConfigHelper; mBehaviorMap = behaviorMap; mInGesturalMode = QuickStepContract.isGesturalMode( navigationModeController.addListener(this::handleNavigationModeChange)); setBehavior(getBehaviorMode()); mPhenotypeHelper.addOnPropertiesChangedListener( mDeviceConfigHelper.addOnPropertiesChangedListener( mHandler::post, (properties) -> { if (properties.getKeyset().contains( Loading Loading @@ -206,19 +206,19 @@ public final class AssistHandleBehaviorController implements AssistHandleCallbac } private long getShownFrequencyThreshold() { return mPhenotypeHelper.getLong( return mDeviceConfigHelper.getLong( SystemUiDeviceConfigFlags.ASSIST_HANDLES_SHOWN_FREQUENCY_THRESHOLD_MS, DEFAULT_SHOWN_FREQUENCY_THRESHOLD_MS); } private long getShowAndGoDuration() { return mPhenotypeHelper.getLong( return mDeviceConfigHelper.getLong( SystemUiDeviceConfigFlags.ASSIST_HANDLES_SHOW_AND_GO_DURATION_MS, DEFAULT_SHOW_AND_GO_DURATION_MS); } private String getBehaviorMode() { return mPhenotypeHelper.getString( return mDeviceConfigHelper.getString( SystemUiDeviceConfigFlags.ASSIST_HANDLES_BEHAVIOR_MODE, DEFAULT_BEHAVIOR.toString()); } Loading packages/SystemUI/src/com/android/systemui/assist/AssistHandleReminderExpBehavior.java +12 −12 Original line number Diff line number Diff line Loading @@ -156,7 +156,7 @@ final class AssistHandleReminderExpBehavior implements BehaviorController { private final Clock mClock; private final Handler mHandler; private final PhenotypeHelper mPhenotypeHelper; private final DeviceConfigHelper mDeviceConfigHelper; private final Lazy<StatusBarStateController> mStatusBarStateController; private final Lazy<ActivityManagerWrapper> mActivityManagerWrapper; private final Lazy<OverviewProxyService> mOverviewProxyService; Loading Loading @@ -188,7 +188,7 @@ final class AssistHandleReminderExpBehavior implements BehaviorController { AssistHandleReminderExpBehavior( @Named(UPTIME_NAME) Clock clock, @Named(ASSIST_HANDLE_THREAD_NAME) Handler handler, PhenotypeHelper phenotypeHelper, DeviceConfigHelper deviceConfigHelper, Lazy<StatusBarStateController> statusBarStateController, Lazy<ActivityManagerWrapper> activityManagerWrapper, Lazy<OverviewProxyService> overviewProxyService, Loading @@ -196,7 +196,7 @@ final class AssistHandleReminderExpBehavior implements BehaviorController { Lazy<PackageManagerWrapper> packageManagerWrapper) { mClock = clock; mHandler = handler; mPhenotypeHelper = phenotypeHelper; mDeviceConfigHelper = deviceConfigHelper; mStatusBarStateController = statusBarStateController; mActivityManagerWrapper = activityManagerWrapper; mOverviewProxyService = overviewProxyService; Loading Loading @@ -457,55 +457,55 @@ final class AssistHandleReminderExpBehavior implements BehaviorController { } private long getLearningTimeMs() { return mPhenotypeHelper.getLong( return mDeviceConfigHelper.getLong( SystemUiDeviceConfigFlags.ASSIST_HANDLES_LEARN_TIME_MS, DEFAULT_LEARNING_TIME_MS); } private int getLearningCount() { return mPhenotypeHelper.getInt( return mDeviceConfigHelper.getInt( SystemUiDeviceConfigFlags.ASSIST_HANDLES_LEARN_COUNT, DEFAULT_LEARNING_COUNT); } private long getShowAndGoDelayedShortDelayMs() { return mPhenotypeHelper.getLong( return mDeviceConfigHelper.getLong( SystemUiDeviceConfigFlags.ASSIST_HANDLES_SHOW_AND_GO_DELAYED_SHORT_DELAY_MS, DEFAULT_SHOW_AND_GO_DELAYED_SHORT_DELAY_MS); } private long getShowAndGoDelayedLongDelayMs() { return mPhenotypeHelper.getLong( return mDeviceConfigHelper.getLong( SystemUiDeviceConfigFlags.ASSIST_HANDLES_SHOW_AND_GO_DELAYED_LONG_DELAY_MS, DEFAULT_SHOW_AND_GO_DELAYED_LONG_DELAY_MS); } private long getShowAndGoDelayResetTimeoutMs() { return mPhenotypeHelper.getLong( return mDeviceConfigHelper.getLong( SystemUiDeviceConfigFlags.ASSIST_HANDLES_SHOW_AND_GO_DELAY_RESET_TIMEOUT_MS, DEFAULT_SHOW_AND_GO_DELAY_RESET_TIMEOUT_MS); } private boolean getSuppressOnLockscreen() { return mPhenotypeHelper.getBoolean( return mDeviceConfigHelper.getBoolean( SystemUiDeviceConfigFlags.ASSIST_HANDLES_SUPPRESS_ON_LOCKSCREEN, DEFAULT_SUPPRESS_ON_LOCKSCREEN); } private boolean getSuppressOnLauncher() { return mPhenotypeHelper.getBoolean( return mDeviceConfigHelper.getBoolean( SystemUiDeviceConfigFlags.ASSIST_HANDLES_SUPPRESS_ON_LAUNCHER, DEFAULT_SUPPRESS_ON_LAUNCHER); } private boolean getSuppressOnApps() { return mPhenotypeHelper.getBoolean( return mDeviceConfigHelper.getBoolean( SystemUiDeviceConfigFlags.ASSIST_HANDLES_SUPPRESS_ON_APPS, DEFAULT_SUPPRESS_ON_APPS); } private boolean getShowWhenTaught() { return mPhenotypeHelper.getBoolean( return mDeviceConfigHelper.getBoolean( SystemUiDeviceConfigFlags.ASSIST_HANDLES_SHOW_WHEN_TAUGHT, DEFAULT_SHOW_WHEN_TAUGHT); } Loading packages/SystemUI/src/com/android/systemui/assist/PhenotypeHelper.java→packages/SystemUI/src/com/android/systemui/assist/DeviceConfigHelper.java +3 −3 Original line number Diff line number Diff line Loading @@ -26,15 +26,15 @@ import javax.inject.Inject; import javax.inject.Singleton; /** * Wrapper class for retrieving phenotype flag values. * Wrapper class for retrieving System UI device configuration values. * * Can be mocked in tests for ease of testing the effects of particular values. */ @Singleton public class PhenotypeHelper { public class DeviceConfigHelper { @Inject public PhenotypeHelper() {} public DeviceConfigHelper() {} public long getLong(String name, long defaultValue) { return DeviceConfig.getLong(DeviceConfig.NAMESPACE_SYSTEMUI, name, defaultValue); Loading packages/SystemUI/tests/src/com/android/systemui/assist/AssistHandleBehaviorControllerTest.java +4 −4 Original line number Diff line number Diff line Loading @@ -67,7 +67,7 @@ public class AssistHandleBehaviorControllerTest extends SysuiTestCase { @Mock private ScreenDecorations mMockScreenDecorations; @Mock private AssistUtils mMockAssistUtils; @Mock private Handler mMockHandler; @Mock private PhenotypeHelper mMockPhenotypeHelper; @Mock private DeviceConfigHelper mMockDeviceConfigHelper; @Mock private AssistHandleOffBehavior mMockOffBehavior; @Mock private AssistHandleLikeHomeBehavior mMockLikeHomeBehavior; @Mock private AssistHandleReminderExpBehavior mMockReminderExpBehavior; Loading Loading @@ -97,7 +97,7 @@ public class AssistHandleBehaviorControllerTest extends SysuiTestCase { mMockAssistUtils, mMockHandler, () -> mMockScreenDecorations, mMockPhenotypeHelper, mMockDeviceConfigHelper, behaviorMap, mMockNavigationModeController, mMockDumpController); Loading Loading @@ -216,7 +216,7 @@ public class AssistHandleBehaviorControllerTest extends SysuiTestCase { public void showAndGo_doesNothingIfRecentlyHidden() { // Arrange when(mMockAssistUtils.getAssistComponentForUser(anyInt())).thenReturn(COMPONENT_NAME); when(mMockPhenotypeHelper.getLong( when(mMockDeviceConfigHelper.getLong( eq(SystemUiDeviceConfigFlags.ASSIST_HANDLES_SHOWN_FREQUENCY_THRESHOLD_MS), anyLong())).thenReturn(10000L); mAssistHandleBehaviorController.showAndGo(); Loading Loading @@ -297,7 +297,7 @@ public class AssistHandleBehaviorControllerTest extends SysuiTestCase { public void showAndGoDelayed_doesNothingIfRecentlyHidden() { // Arrange when(mMockAssistUtils.getAssistComponentForUser(anyInt())).thenReturn(COMPONENT_NAME); when(mMockPhenotypeHelper.getLong( when(mMockDeviceConfigHelper.getLong( eq(SystemUiDeviceConfigFlags.ASSIST_HANDLES_SHOWN_FREQUENCY_THRESHOLD_MS), anyLong())).thenReturn(10000L); mAssistHandleBehaviorController.showAndGo(); Loading Loading
packages/SystemUI/src/com/android/systemui/assist/AssistHandleBehaviorController.java +7 −7 Original line number Diff line number Diff line Loading @@ -72,7 +72,7 @@ public final class AssistHandleBehaviorController implements AssistHandleCallbac private final Runnable mHideHandles = this::hideHandles; private final Runnable mShowAndGo = this::showAndGoInternal; private final Provider<ScreenDecorations> mScreenDecorations; private final PhenotypeHelper mPhenotypeHelper; private final DeviceConfigHelper mDeviceConfigHelper; private final Map<AssistHandleBehavior, BehaviorController> mBehaviorMap; private boolean mHandlesShowing = false; Loading @@ -91,7 +91,7 @@ public final class AssistHandleBehaviorController implements AssistHandleCallbac AssistUtils assistUtils, @Named(ASSIST_HANDLE_THREAD_NAME) Handler handler, Provider<ScreenDecorations> screenDecorations, PhenotypeHelper phenotypeHelper, DeviceConfigHelper deviceConfigHelper, Map<AssistHandleBehavior, BehaviorController> behaviorMap, NavigationModeController navigationModeController, DumpController dumpController) { Loading @@ -99,14 +99,14 @@ public final class AssistHandleBehaviorController implements AssistHandleCallbac mAssistUtils = assistUtils; mHandler = handler; mScreenDecorations = screenDecorations; mPhenotypeHelper = phenotypeHelper; mDeviceConfigHelper = deviceConfigHelper; mBehaviorMap = behaviorMap; mInGesturalMode = QuickStepContract.isGesturalMode( navigationModeController.addListener(this::handleNavigationModeChange)); setBehavior(getBehaviorMode()); mPhenotypeHelper.addOnPropertiesChangedListener( mDeviceConfigHelper.addOnPropertiesChangedListener( mHandler::post, (properties) -> { if (properties.getKeyset().contains( Loading Loading @@ -206,19 +206,19 @@ public final class AssistHandleBehaviorController implements AssistHandleCallbac } private long getShownFrequencyThreshold() { return mPhenotypeHelper.getLong( return mDeviceConfigHelper.getLong( SystemUiDeviceConfigFlags.ASSIST_HANDLES_SHOWN_FREQUENCY_THRESHOLD_MS, DEFAULT_SHOWN_FREQUENCY_THRESHOLD_MS); } private long getShowAndGoDuration() { return mPhenotypeHelper.getLong( return mDeviceConfigHelper.getLong( SystemUiDeviceConfigFlags.ASSIST_HANDLES_SHOW_AND_GO_DURATION_MS, DEFAULT_SHOW_AND_GO_DURATION_MS); } private String getBehaviorMode() { return mPhenotypeHelper.getString( return mDeviceConfigHelper.getString( SystemUiDeviceConfigFlags.ASSIST_HANDLES_BEHAVIOR_MODE, DEFAULT_BEHAVIOR.toString()); } Loading
packages/SystemUI/src/com/android/systemui/assist/AssistHandleReminderExpBehavior.java +12 −12 Original line number Diff line number Diff line Loading @@ -156,7 +156,7 @@ final class AssistHandleReminderExpBehavior implements BehaviorController { private final Clock mClock; private final Handler mHandler; private final PhenotypeHelper mPhenotypeHelper; private final DeviceConfigHelper mDeviceConfigHelper; private final Lazy<StatusBarStateController> mStatusBarStateController; private final Lazy<ActivityManagerWrapper> mActivityManagerWrapper; private final Lazy<OverviewProxyService> mOverviewProxyService; Loading Loading @@ -188,7 +188,7 @@ final class AssistHandleReminderExpBehavior implements BehaviorController { AssistHandleReminderExpBehavior( @Named(UPTIME_NAME) Clock clock, @Named(ASSIST_HANDLE_THREAD_NAME) Handler handler, PhenotypeHelper phenotypeHelper, DeviceConfigHelper deviceConfigHelper, Lazy<StatusBarStateController> statusBarStateController, Lazy<ActivityManagerWrapper> activityManagerWrapper, Lazy<OverviewProxyService> overviewProxyService, Loading @@ -196,7 +196,7 @@ final class AssistHandleReminderExpBehavior implements BehaviorController { Lazy<PackageManagerWrapper> packageManagerWrapper) { mClock = clock; mHandler = handler; mPhenotypeHelper = phenotypeHelper; mDeviceConfigHelper = deviceConfigHelper; mStatusBarStateController = statusBarStateController; mActivityManagerWrapper = activityManagerWrapper; mOverviewProxyService = overviewProxyService; Loading Loading @@ -457,55 +457,55 @@ final class AssistHandleReminderExpBehavior implements BehaviorController { } private long getLearningTimeMs() { return mPhenotypeHelper.getLong( return mDeviceConfigHelper.getLong( SystemUiDeviceConfigFlags.ASSIST_HANDLES_LEARN_TIME_MS, DEFAULT_LEARNING_TIME_MS); } private int getLearningCount() { return mPhenotypeHelper.getInt( return mDeviceConfigHelper.getInt( SystemUiDeviceConfigFlags.ASSIST_HANDLES_LEARN_COUNT, DEFAULT_LEARNING_COUNT); } private long getShowAndGoDelayedShortDelayMs() { return mPhenotypeHelper.getLong( return mDeviceConfigHelper.getLong( SystemUiDeviceConfigFlags.ASSIST_HANDLES_SHOW_AND_GO_DELAYED_SHORT_DELAY_MS, DEFAULT_SHOW_AND_GO_DELAYED_SHORT_DELAY_MS); } private long getShowAndGoDelayedLongDelayMs() { return mPhenotypeHelper.getLong( return mDeviceConfigHelper.getLong( SystemUiDeviceConfigFlags.ASSIST_HANDLES_SHOW_AND_GO_DELAYED_LONG_DELAY_MS, DEFAULT_SHOW_AND_GO_DELAYED_LONG_DELAY_MS); } private long getShowAndGoDelayResetTimeoutMs() { return mPhenotypeHelper.getLong( return mDeviceConfigHelper.getLong( SystemUiDeviceConfigFlags.ASSIST_HANDLES_SHOW_AND_GO_DELAY_RESET_TIMEOUT_MS, DEFAULT_SHOW_AND_GO_DELAY_RESET_TIMEOUT_MS); } private boolean getSuppressOnLockscreen() { return mPhenotypeHelper.getBoolean( return mDeviceConfigHelper.getBoolean( SystemUiDeviceConfigFlags.ASSIST_HANDLES_SUPPRESS_ON_LOCKSCREEN, DEFAULT_SUPPRESS_ON_LOCKSCREEN); } private boolean getSuppressOnLauncher() { return mPhenotypeHelper.getBoolean( return mDeviceConfigHelper.getBoolean( SystemUiDeviceConfigFlags.ASSIST_HANDLES_SUPPRESS_ON_LAUNCHER, DEFAULT_SUPPRESS_ON_LAUNCHER); } private boolean getSuppressOnApps() { return mPhenotypeHelper.getBoolean( return mDeviceConfigHelper.getBoolean( SystemUiDeviceConfigFlags.ASSIST_HANDLES_SUPPRESS_ON_APPS, DEFAULT_SUPPRESS_ON_APPS); } private boolean getShowWhenTaught() { return mPhenotypeHelper.getBoolean( return mDeviceConfigHelper.getBoolean( SystemUiDeviceConfigFlags.ASSIST_HANDLES_SHOW_WHEN_TAUGHT, DEFAULT_SHOW_WHEN_TAUGHT); } Loading
packages/SystemUI/src/com/android/systemui/assist/PhenotypeHelper.java→packages/SystemUI/src/com/android/systemui/assist/DeviceConfigHelper.java +3 −3 Original line number Diff line number Diff line Loading @@ -26,15 +26,15 @@ import javax.inject.Inject; import javax.inject.Singleton; /** * Wrapper class for retrieving phenotype flag values. * Wrapper class for retrieving System UI device configuration values. * * Can be mocked in tests for ease of testing the effects of particular values. */ @Singleton public class PhenotypeHelper { public class DeviceConfigHelper { @Inject public PhenotypeHelper() {} public DeviceConfigHelper() {} public long getLong(String name, long defaultValue) { return DeviceConfig.getLong(DeviceConfig.NAMESPACE_SYSTEMUI, name, defaultValue); Loading
packages/SystemUI/tests/src/com/android/systemui/assist/AssistHandleBehaviorControllerTest.java +4 −4 Original line number Diff line number Diff line Loading @@ -67,7 +67,7 @@ public class AssistHandleBehaviorControllerTest extends SysuiTestCase { @Mock private ScreenDecorations mMockScreenDecorations; @Mock private AssistUtils mMockAssistUtils; @Mock private Handler mMockHandler; @Mock private PhenotypeHelper mMockPhenotypeHelper; @Mock private DeviceConfigHelper mMockDeviceConfigHelper; @Mock private AssistHandleOffBehavior mMockOffBehavior; @Mock private AssistHandleLikeHomeBehavior mMockLikeHomeBehavior; @Mock private AssistHandleReminderExpBehavior mMockReminderExpBehavior; Loading Loading @@ -97,7 +97,7 @@ public class AssistHandleBehaviorControllerTest extends SysuiTestCase { mMockAssistUtils, mMockHandler, () -> mMockScreenDecorations, mMockPhenotypeHelper, mMockDeviceConfigHelper, behaviorMap, mMockNavigationModeController, mMockDumpController); Loading Loading @@ -216,7 +216,7 @@ public class AssistHandleBehaviorControllerTest extends SysuiTestCase { public void showAndGo_doesNothingIfRecentlyHidden() { // Arrange when(mMockAssistUtils.getAssistComponentForUser(anyInt())).thenReturn(COMPONENT_NAME); when(mMockPhenotypeHelper.getLong( when(mMockDeviceConfigHelper.getLong( eq(SystemUiDeviceConfigFlags.ASSIST_HANDLES_SHOWN_FREQUENCY_THRESHOLD_MS), anyLong())).thenReturn(10000L); mAssistHandleBehaviorController.showAndGo(); Loading Loading @@ -297,7 +297,7 @@ public class AssistHandleBehaviorControllerTest extends SysuiTestCase { public void showAndGoDelayed_doesNothingIfRecentlyHidden() { // Arrange when(mMockAssistUtils.getAssistComponentForUser(anyInt())).thenReturn(COMPONENT_NAME); when(mMockPhenotypeHelper.getLong( when(mMockDeviceConfigHelper.getLong( eq(SystemUiDeviceConfigFlags.ASSIST_HANDLES_SHOWN_FREQUENCY_THRESHOLD_MS), anyLong())).thenReturn(10000L); mAssistHandleBehaviorController.showAndGo(); Loading