From 1a0e382745343e53f69fb986c7930a3edb430978 Mon Sep 17 00:00:00 2001 From: Dave Mankoff Date: Wed, 3 Jul 2019 13:26:55 -0400 Subject: [PATCH 1/2] Allow Services to be created through Dagger. This is a significant change that allows Services to have their constructed injected into. The DozeService is now labeled as injectable (thought it takes no arguments). At least one Service has to be marked as injectable for Dagger to be happy compiling this code. Bug: 138787339 Test: atest SystemUITests Change-Id: I0ec92e01dd236bcee3083c8f8744c53b7ccc92d3 Merged-In: Ib58f8763c996fbc2aea07ead56493d2d9e936f5b --- packages/CarSystemUI/Android.bp | 2 +- packages/SystemUI/AndroidManifest.xml | 4 +- packages/SystemUI/docs/dagger.md | 9 ++- .../systemui/ContextComponentHelper.java | 25 ++++++ .../systemui/ContextComponentResolver.java | 48 ++++++++++++ .../com/android/systemui/ServiceBinder.java | 41 ++++++++++ .../systemui/SystemUIAppComponentFactory.java | 76 +++++++++++++++++++ .../android/systemui/SystemUIApplication.java | 14 +++- .../com/android/systemui/SystemUIFactory.java | 31 +------- .../systemui/SystemUIRootComponent.java | 68 +++++++++++++++++ .../android/systemui/doze/DozeService.java | 3 + .../systemui/fragments/FragmentService.java | 4 +- .../util/InjectionInflationController.java | 4 +- 13 files changed, 291 insertions(+), 38 deletions(-) create mode 100644 packages/SystemUI/src/com/android/systemui/ContextComponentHelper.java create mode 100644 packages/SystemUI/src/com/android/systemui/ContextComponentResolver.java create mode 100644 packages/SystemUI/src/com/android/systemui/ServiceBinder.java create mode 100644 packages/SystemUI/src/com/android/systemui/SystemUIAppComponentFactory.java create mode 100644 packages/SystemUI/src/com/android/systemui/SystemUIRootComponent.java diff --git a/packages/CarSystemUI/Android.bp b/packages/CarSystemUI/Android.bp index 589623b0d6cd8..61cab73c226a4 100644 --- a/packages/CarSystemUI/Android.bp +++ b/packages/CarSystemUI/Android.bp @@ -26,8 +26,8 @@ android_app { ], static_libs: [ - "CarNotificationLib", "SystemUI-core", + "CarNotificationLib", "SystemUIPluginLib", "SystemUISharedLib", "SettingsLib", diff --git a/packages/SystemUI/AndroidManifest.xml b/packages/SystemUI/AndroidManifest.xml index 17274f418a1e5..4f74605b40033 100644 --- a/packages/SystemUI/AndroidManifest.xml +++ b/packages/SystemUI/AndroidManifest.xml @@ -20,6 +20,7 @@ xmlns:androidprv="http://schemas.android.com/apk/prv/res/android" package="com.android.systemui" android:sharedUserId="android.uid.systemui" + xmlns:tools="http://schemas.android.com/tools" coreApp="true"> @@ -259,7 +260,8 @@ android:theme="@style/Theme.SystemUI" android:defaultToDeviceProtectedStorage="true" android:directBootAware="true" - android:appComponentFactory="androidx.core.app.CoreComponentFactory"> + tools:replace="android:appComponentFactory" + android:appComponentFactory=".SystemUIAppComponentFactory"> diff --git a/packages/SystemUI/docs/dagger.md b/packages/SystemUI/docs/dagger.md index c2159df1cee18..c440fba10135b 100644 --- a/packages/SystemUI/docs/dagger.md +++ b/packages/SystemUI/docs/dagger.md @@ -53,7 +53,7 @@ variants (like other form factors e.g. Car). ### Adding injection to a new SystemUI object Anything that depends on any `@Singleton` provider from SystemUIRootComponent -should be declared as an `@Subcomponent` of the root component, this requires +should be declared as a `@Subcomponent` of the root component. This requires declaring your own interface for generating your own modules or just the object you need injected. The subcomponent also needs to be added to SystemUIRootComponent in SystemUIFactory so it can be acquired. @@ -204,6 +204,13 @@ public CustomView(@Named(VIEW_CONTEXT) Context themedViewContext, AttributeSet a } ``` +## Updating Dagger2 + +Binaries can be downloaded from https://repo1.maven.org/maven2/com/google/dagger/ and then loaded +into +[/prebuilts/tools/common/m2/repository/com/google/dagger/](http://cs/android/prebuilts/tools/common/m2/repository/com/google/dagger/) + + ## TODO List - Eliminate usages of Dependency#get diff --git a/packages/SystemUI/src/com/android/systemui/ContextComponentHelper.java b/packages/SystemUI/src/com/android/systemui/ContextComponentHelper.java new file mode 100644 index 0000000000000..8fabe7aa9eb68 --- /dev/null +++ b/packages/SystemUI/src/com/android/systemui/ContextComponentHelper.java @@ -0,0 +1,25 @@ +/* + * Copyright (C) 2019 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; + +/** + * Interface necessary to make Dagger happy. See {@link ContextComponentResolver}. + */ +public interface ContextComponentHelper { + /** Turns a classname into an instance of the class or returns null. */ + T resolve(String className); +} diff --git a/packages/SystemUI/src/com/android/systemui/ContextComponentResolver.java b/packages/SystemUI/src/com/android/systemui/ContextComponentResolver.java new file mode 100644 index 0000000000000..09bccd993f39e --- /dev/null +++ b/packages/SystemUI/src/com/android/systemui/ContextComponentResolver.java @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2019 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; + +import java.util.Map; + +import javax.inject.Inject; +import javax.inject.Provider; + +/** + * Used during Service and Activity instantiation to make them injectable. + */ +public class ContextComponentResolver implements ContextComponentHelper { + private final Map, Provider> mCreators; + + @Inject + ContextComponentResolver(Map, Provider> creators) { + mCreators = creators; + } + + /** + * Looks up the class name to see if Dagger has an instance of it. + */ + @Override + public T resolve(String className) { + for (Map.Entry, Provider> p : mCreators.entrySet()) { + if (p.getKey().getName().equals(className)) { + return (T) p.getValue().get(); + } + } + + return null; + } +} diff --git a/packages/SystemUI/src/com/android/systemui/ServiceBinder.java b/packages/SystemUI/src/com/android/systemui/ServiceBinder.java new file mode 100644 index 0000000000000..6282c6e5282f4 --- /dev/null +++ b/packages/SystemUI/src/com/android/systemui/ServiceBinder.java @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2019 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; + +import com.android.systemui.doze.DozeService; + +import dagger.Binds; +import dagger.Module; +import dagger.multibindings.ClassKey; +import dagger.multibindings.IntoMap; + +/** + * Services and Activities that are injectable should go here. + */ +@Module +public abstract class ServiceBinder { + + @Binds + public abstract ContextComponentHelper bindComponentHelper( + ContextComponentResolver componentHelper); + + @Binds + @IntoMap + @ClassKey(DozeService.class) + public abstract Object bindDozeService(DozeService service); + +} diff --git a/packages/SystemUI/src/com/android/systemui/SystemUIAppComponentFactory.java b/packages/SystemUI/src/com/android/systemui/SystemUIAppComponentFactory.java new file mode 100644 index 0000000000000..00ae992957687 --- /dev/null +++ b/packages/SystemUI/src/com/android/systemui/SystemUIAppComponentFactory.java @@ -0,0 +1,76 @@ +/* + * Copyright (C) 2019 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; + +import android.app.Application; +import android.app.Service; +import android.content.Intent; + +import androidx.core.app.CoreComponentFactory; + +import javax.inject.Inject; + +/** + * Implementation of AppComponentFactory that injects into constructors. + */ +public class SystemUIAppComponentFactory extends CoreComponentFactory { + + @Inject + public ContextComponentHelper mComponentHelper; + + public SystemUIAppComponentFactory() { + super(); + } + + @Override + public Application instantiateApplication(ClassLoader cl, String className) + throws InstantiationException, IllegalAccessException, ClassNotFoundException { + Application app = super.instantiateApplication(cl, className); + if (app instanceof SystemUIApplication) { + ((SystemUIApplication) app).setContextAvailableCallback( + context -> { + SystemUIFactory.createFromConfig(context); + SystemUIFactory.getInstance().getRootComponent().inject( + SystemUIAppComponentFactory.this); + } + ); + } + + return app; + } + + @Override + public Service instantiateService(ClassLoader cl, String className, Intent intent) + throws InstantiationException, IllegalAccessException, ClassNotFoundException { + Service service = mComponentHelper.resolve(className); + if (service != null) { + return checkCompatWrapper(service); + } + return super.instantiateService(cl, className, intent); + } + + static T checkCompatWrapper(T obj) { + if (obj instanceof CompatWrapped) { + T wrapper = (T) ((CompatWrapped) obj).getWrapper(); + if (wrapper != null) { + return wrapper; + } + } + + return obj; + } +} diff --git a/packages/SystemUI/src/com/android/systemui/SystemUIApplication.java b/packages/SystemUI/src/com/android/systemui/SystemUIApplication.java index e89e6cb269f80..f8449add6dce8 100644 --- a/packages/SystemUI/src/com/android/systemui/SystemUIApplication.java +++ b/packages/SystemUI/src/com/android/systemui/SystemUIApplication.java @@ -60,16 +60,20 @@ public class SystemUIApplication extends Application implements SysUiServiceProv private boolean mServicesStarted; private boolean mBootCompleted; private final Map, Object> mComponents = new HashMap<>(); + private ContextAvailableCallback mContextAvailableCallback; @Override public void onCreate() { super.onCreate(); + // This line is used to setup Dagger's dependency injection and should be kept at the + // top of this method. + mContextAvailableCallback.onContextAvailable(this); + // Set the application theme that is inherited by all services. Note that setting the // application theme in the manifest does only work for activities. Keep this in sync with // the theme set there. setTheme(R.style.Theme_SystemUI); - SystemUIFactory.createFromConfig(this); if (Process.myUserHandle().equals(UserHandle.SYSTEM)) { IntentFilter bootCompletedFilter = new IntentFilter(Intent.ACTION_BOOT_COMPLETED); @@ -286,4 +290,12 @@ public class SystemUIApplication extends Application implements SysUiServiceProv public SystemUI[] getServices() { return mServices; } + + void setContextAvailableCallback(ContextAvailableCallback callback) { + mContextAvailableCallback = callback; + } + + interface ContextAvailableCallback { + void onContextAvailable(Context context); + } } diff --git a/packages/SystemUI/src/com/android/systemui/SystemUIFactory.java b/packages/SystemUI/src/com/android/systemui/SystemUIFactory.java index 264a1020ddc94..cb60909732fec 100644 --- a/packages/SystemUI/src/com/android/systemui/SystemUIFactory.java +++ b/packages/SystemUI/src/com/android/systemui/SystemUIFactory.java @@ -36,7 +36,6 @@ import com.android.keyguard.ViewMediatorCallback; import com.android.systemui.assist.AssistManager; import com.android.systemui.classifier.FalsingManagerFactory; import com.android.systemui.dock.DockManager; -import com.android.systemui.fragments.FragmentService; import com.android.systemui.keyguard.DismissCallbackRegistry; import com.android.systemui.plugins.statusbar.StatusBarStateController; import com.android.systemui.power.EnhancedEstimates; @@ -68,8 +67,6 @@ import com.android.systemui.statusbar.phone.UnlockMethodCache; import com.android.systemui.statusbar.policy.DeviceProvisionedController; import com.android.systemui.statusbar.policy.KeyguardMonitor; import com.android.systemui.util.AsyncSensorManager; -import com.android.systemui.util.InjectionInflationController; -import com.android.systemui.util.leak.GarbageMonitor; import com.android.systemui.volume.VolumeDialogComponent; import java.util.function.Consumer; @@ -77,7 +74,6 @@ import java.util.function.Consumer; import javax.inject.Named; import javax.inject.Singleton; -import dagger.Component; import dagger.Module; import dagger.Provides; @@ -115,7 +111,7 @@ public class SystemUIFactory { public SystemUIFactory() {} protected void init(Context context) { - mRootComponent = DaggerSystemUIFactory_SystemUIRootComponent.builder() + mRootComponent = DaggerSystemUIRootComponent.builder() .systemUIFactory(this) .dependencyProvider(new com.android.systemui.DependencyProvider()) .contextHolder(new ContextHolder(context)) @@ -267,29 +263,4 @@ public class SystemUIFactory { return mContext; } } - - @Singleton - @Component(modules = {SystemUIFactory.class, DependencyProvider.class, DependencyBinder.class, - ContextHolder.class}) - public interface SystemUIRootComponent { - @Singleton - Dependency.DependencyInjector createDependency(); - - @Singleton - StatusBar.StatusBarInjector getStatusBarInjector(); - - /** - * FragmentCreator generates all Fragments that need injection. - */ - @Singleton - FragmentService.FragmentCreator createFragmentCreator(); - - /** - * ViewCreator generates all Views that need injection. - */ - InjectionInflationController.ViewCreator createViewCreator(); - - @Singleton - GarbageMonitor createGarbageMonitor(); - } } diff --git a/packages/SystemUI/src/com/android/systemui/SystemUIRootComponent.java b/packages/SystemUI/src/com/android/systemui/SystemUIRootComponent.java new file mode 100644 index 0000000000000..c732df3fdb9ff --- /dev/null +++ b/packages/SystemUI/src/com/android/systemui/SystemUIRootComponent.java @@ -0,0 +1,68 @@ +/* + * Copyright (C) 2019 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; + +import com.android.systemui.fragments.FragmentService; +import com.android.systemui.statusbar.phone.StatusBar; +import com.android.systemui.util.InjectionInflationController; +import com.android.systemui.util.leak.GarbageMonitor; + +import javax.inject.Singleton; + +import dagger.Component; + +/** + * Root component for Dagger injection. + */ +@Singleton +@Component(modules = {SystemUIFactory.class, DependencyProvider.class, DependencyBinder.class, + ServiceBinder.class, SystemUIFactory.ContextHolder.class}) +public interface SystemUIRootComponent { + /** + * Main dependency providing module. + */ + @Singleton + Dependency.DependencyInjector createDependency(); + + /** + * Injects the StatusBar. + */ + @Singleton + StatusBar.StatusBarInjector getStatusBarInjector(); + + /** + * FragmentCreator generates all Fragments that need injection. + */ + @Singleton + FragmentService.FragmentCreator createFragmentCreator(); + + /** + * ViewCreator generates all Views that need injection. + */ + InjectionInflationController.ViewCreator createViewCreator(); + + /** + * Creatse a GarbageMonitor. + */ + @Singleton + GarbageMonitor createGarbageMonitor(); + + /** + * Injects into the supplied argument. + */ + void inject(SystemUIAppComponentFactory factory); +} diff --git a/packages/SystemUI/src/com/android/systemui/doze/DozeService.java b/packages/SystemUI/src/com/android/systemui/doze/DozeService.java index 2db73065fe197..83b6db7948b7b 100644 --- a/packages/SystemUI/src/com/android/systemui/doze/DozeService.java +++ b/packages/SystemUI/src/com/android/systemui/doze/DozeService.java @@ -31,6 +31,8 @@ import com.android.systemui.shared.plugins.PluginManager; import java.io.FileDescriptor; import java.io.PrintWriter; +import javax.inject.Inject; + public class DozeService extends DreamService implements DozeMachine.Service, RequestDoze, PluginListener { private static final String TAG = "DozeService"; @@ -40,6 +42,7 @@ public class DozeService extends DreamService private DozeServicePlugin mDozePlugin; private PluginManager mPluginManager; + @Inject public DozeService() { setDebug(DEBUG); } diff --git a/packages/SystemUI/src/com/android/systemui/fragments/FragmentService.java b/packages/SystemUI/src/com/android/systemui/fragments/FragmentService.java index 8dbaf0f681cf9..b4cc571be0610 100644 --- a/packages/SystemUI/src/com/android/systemui/fragments/FragmentService.java +++ b/packages/SystemUI/src/com/android/systemui/fragments/FragmentService.java @@ -22,7 +22,7 @@ import android.view.View; import com.android.systemui.ConfigurationChangedReceiver; import com.android.systemui.Dumpable; -import com.android.systemui.SystemUIFactory; +import com.android.systemui.SystemUIRootComponent; import com.android.systemui.qs.QSFragment; import com.android.systemui.statusbar.phone.NavigationBarFragment; @@ -51,7 +51,7 @@ public class FragmentService implements ConfigurationChangedReceiver, Dumpable { private final FragmentCreator mFragmentCreator; @Inject - public FragmentService(SystemUIFactory.SystemUIRootComponent rootComponent) { + public FragmentService(SystemUIRootComponent rootComponent) { mFragmentCreator = rootComponent.createFragmentCreator(); initInjectionMap(); } diff --git a/packages/SystemUI/src/com/android/systemui/util/InjectionInflationController.java b/packages/SystemUI/src/com/android/systemui/util/InjectionInflationController.java index ede30046d6c3c..9b264c4a326e2 100644 --- a/packages/SystemUI/src/com/android/systemui/util/InjectionInflationController.java +++ b/packages/SystemUI/src/com/android/systemui/util/InjectionInflationController.java @@ -26,7 +26,7 @@ import android.view.View; import com.android.keyguard.KeyguardClockSwitch; import com.android.keyguard.KeyguardMessageArea; import com.android.keyguard.KeyguardSliceView; -import com.android.systemui.SystemUIFactory; +import com.android.systemui.SystemUIRootComponent; import com.android.systemui.qs.QSCarrierGroup; import com.android.systemui.qs.QSFooterImpl; import com.android.systemui.qs.QSPanel; @@ -62,7 +62,7 @@ public class InjectionInflationController { private final LayoutInflater.Factory2 mFactory = new InjectionFactory(); @Inject - public InjectionInflationController(SystemUIFactory.SystemUIRootComponent rootComponent) { + public InjectionInflationController(SystemUIRootComponent rootComponent) { mViewCreator = rootComponent.createViewCreator(); initInjectionMap(); } From 781ef7ee1e72fc4eefd2b2b7d9f251049a6c6ddc Mon Sep 17 00:00:00 2001 From: Dave Mankoff Date: Fri, 28 Jun 2019 16:33:25 -0400 Subject: [PATCH 2/2] Pass FalsingManager down through more classes. The CP's http://ag/c/8269205, with some minor modifications. This removes FalsingManagerFactory, replacing it with calls to Depedency.get() and pushes those calls further up the stack in hopes that the FalsingManager can be directly injected where it's needed in the future. Contains a few random lint cleanups. Bug: 136279712 Test: atest SystemUITests Change-Id: Idd66e40d3bb9ebe9ca583166d5e961cc70ea51b8 Merged-In: Ie24acd33b0d81ae2112aead0c0d5a8658e04994e --- .../systemui/statusbar/car/CarStatusBar.java | 4 +- .../systemui/recents/views/TaskStackView.java | 11 +- .../views/TaskStackViewTouchHandler.java | 5 +- .../src/com/android/systemui/SwipeHelper.java | 6 +- .../com/android/systemui/SystemUIFactory.java | 7 +- .../classifier/FalsingManagerFactory.java | 44 ---- .../classifier/FalsingManagerFake.java | 246 ++++++++++++++++++ .../android/systemui/doze/DozeFactory.java | 6 +- .../android/systemui/doze/DozeService.java | 4 +- .../keyguard/KeyguardViewMediator.java | 9 +- .../systemui/statusbar/DragDownHelper.java | 6 +- .../statusbar/PulseExpansionHandler.kt | 4 +- .../row/ActivatableNotificationView.java | 6 +- .../row/ExpandableNotificationRow.java | 3 +- .../stack/NotificationStackScrollLayout.java | 8 +- .../stack/NotificationSwipeHelper.java | 9 +- .../phone/KeyguardAffordanceHelper.java | 7 +- .../phone/NotificationPanelView.java | 8 +- .../systemui/statusbar/phone/PanelView.java | 5 +- .../systemui/statusbar/phone/StatusBar.java | 7 +- .../phone/StatusBarKeyguardViewManager.java | 5 +- .../statusbar/phone/StatusBarWindowView.java | 5 +- .../NotificationStackScrollLayoutTest.java | 5 +- .../stack/NotificationSwipeHelperTest.java | 4 +- .../phone/NotificationPanelViewTest.java | 6 +- .../StatusBarKeyguardViewManagerTest.java | 11 +- 26 files changed, 330 insertions(+), 111 deletions(-) delete mode 100644 packages/SystemUI/src/com/android/systemui/classifier/FalsingManagerFactory.java create mode 100644 packages/SystemUI/src/com/android/systemui/classifier/FalsingManagerFake.java diff --git a/packages/CarSystemUI/src/com/android/systemui/statusbar/car/CarStatusBar.java b/packages/CarSystemUI/src/com/android/systemui/statusbar/car/CarStatusBar.java index 2874ce60bf168..146bfe02498b6 100644 --- a/packages/CarSystemUI/src/com/android/systemui/statusbar/car/CarStatusBar.java +++ b/packages/CarSystemUI/src/com/android/systemui/statusbar/car/CarStatusBar.java @@ -61,9 +61,9 @@ import com.android.systemui.Prefs; import com.android.systemui.R; import com.android.systemui.SystemUIFactory; import com.android.systemui.classifier.FalsingLog; -import com.android.systemui.classifier.FalsingManagerFactory; import com.android.systemui.fragments.FragmentHostManager; import com.android.systemui.keyguard.ScreenLifecycle; +import com.android.systemui.plugins.FalsingManager; import com.android.systemui.plugins.qs.QS; import com.android.systemui.qs.car.CarQSFragment; import com.android.systemui.shared.system.ActivityManagerWrapper; @@ -877,7 +877,7 @@ public class CarStatusBar extends StatusBar implements KeyguardUpdateMonitor.getInstance(mContext).dump(fd, pw, args); } - FalsingManagerFactory.getInstance(mContext).dump(pw); + Dependency.get(FalsingManager.class).dump(pw); FalsingLog.dump(pw); pw.println("SharedPreferences:"); diff --git a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/views/TaskStackView.java b/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/views/TaskStackView.java index 14fd149d22f42..b89218c81a91c 100644 --- a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/views/TaskStackView.java +++ b/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/views/TaskStackView.java @@ -41,8 +41,10 @@ import android.widget.ScrollView; import com.android.internal.logging.MetricsLogger; import com.android.internal.logging.nano.MetricsProto.MetricsEvent; +import com.android.systemui.Dependency; import com.android.systemui.Interpolators; import com.android.systemui.R; +import com.android.systemui.plugins.FalsingManager; import com.android.systemui.recents.LegacyRecentsImpl; import com.android.systemui.recents.RecentsActivity; import com.android.systemui.recents.RecentsActivityLaunchState; @@ -86,15 +88,15 @@ import com.android.systemui.recents.events.ui.focus.NavigateTaskViewEvent; import com.android.systemui.recents.misc.DozeTrigger; import com.android.systemui.recents.misc.ReferenceCountedTrigger; import com.android.systemui.recents.misc.SystemServicesProxy; +import com.android.systemui.recents.model.TaskStack; import com.android.systemui.recents.utilities.AnimationProps; import com.android.systemui.recents.utilities.Utilities; -import com.android.systemui.shared.recents.model.Task; -import com.android.systemui.recents.model.TaskStack; import com.android.systemui.recents.views.grid.GridTaskView; import com.android.systemui.recents.views.grid.TaskGridLayoutAlgorithm; import com.android.systemui.recents.views.grid.TaskViewFocusFrame; - +import com.android.systemui.shared.recents.model.Task; import com.android.systemui.shared.system.ActivityManagerWrapper; + import java.io.PrintWriter; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; @@ -256,7 +258,8 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal mLayoutAlgorithm = new TaskStackLayoutAlgorithm(context, this); mStableLayoutAlgorithm = new TaskStackLayoutAlgorithm(context, null); mStackScroller = new TaskStackViewScroller(context, this, mLayoutAlgorithm); - mTouchHandler = new TaskStackViewTouchHandler(context, this, mStackScroller); + mTouchHandler = new TaskStackViewTouchHandler( + context, this, mStackScroller, Dependency.get(FalsingManager.class)); mAnimationHelper = new TaskStackAnimationHelper(context, this); mTaskCornerRadiusPx = LegacyRecentsImpl.getConfiguration().isGridEnabled ? res.getDimensionPixelSize(R.dimen.recents_grid_task_view_rounded_corners_radius) : diff --git a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/views/TaskStackViewTouchHandler.java b/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/views/TaskStackViewTouchHandler.java index dd6926c848b4f..a7fb4fae09ecd 100644 --- a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/views/TaskStackViewTouchHandler.java +++ b/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/views/TaskStackViewTouchHandler.java @@ -37,6 +37,7 @@ import com.android.internal.logging.nano.MetricsProto.MetricsEvent; import com.android.systemui.Interpolators; import com.android.systemui.R; import com.android.systemui.SwipeHelper; +import com.android.systemui.plugins.FalsingManager; import com.android.systemui.recents.Constants; import com.android.systemui.recents.LegacyRecentsImpl; import com.android.systemui.recents.events.EventBus; @@ -107,7 +108,7 @@ class TaskStackViewTouchHandler implements SwipeHelper.Callback { boolean mInterceptedBySwipeHelper; public TaskStackViewTouchHandler(Context context, TaskStackView sv, - TaskStackViewScroller scroller) { + TaskStackViewScroller scroller, FalsingManager falsingManager) { Resources res = context.getResources(); ViewConfiguration configuration = ViewConfiguration.get(context); mContext = context; @@ -119,7 +120,7 @@ class TaskStackViewTouchHandler implements SwipeHelper.Callback { mWindowTouchSlop = configuration.getScaledWindowTouchSlop(); mFlingAnimUtils = new FlingAnimationUtils(context, 0.2f); mOverscrollSize = res.getDimensionPixelSize(R.dimen.recents_fling_overscroll_distance); - mSwipeHelper = new SwipeHelper(SwipeHelper.X, this, context) { + mSwipeHelper = new SwipeHelper(SwipeHelper.X, this, context, falsingManager) { @Override protected float getSize(View v) { return getScaledDismissSize(); diff --git a/packages/SystemUI/src/com/android/systemui/SwipeHelper.java b/packages/SystemUI/src/com/android/systemui/SwipeHelper.java index 84e0238fdd3a9..58c52a1fc50e1 100644 --- a/packages/SystemUI/src/com/android/systemui/SwipeHelper.java +++ b/packages/SystemUI/src/com/android/systemui/SwipeHelper.java @@ -34,7 +34,6 @@ import android.view.View; import android.view.ViewConfiguration; import android.view.accessibility.AccessibilityEvent; -import com.android.systemui.classifier.FalsingManagerFactory; import com.android.systemui.plugins.FalsingManager; import com.android.systemui.plugins.statusbar.NotificationMenuRowPlugin; import com.android.systemui.statusbar.FlingAnimationUtils; @@ -98,7 +97,8 @@ public class SwipeHelper implements Gefingerpoken { private final ArrayMap mDismissPendingMap = new ArrayMap<>(); - public SwipeHelper(int swipeDirection, Callback callback, Context context) { + public SwipeHelper( + int swipeDirection, Callback callback, Context context, FalsingManager falsingManager) { mContext = context; mCallback = callback; mHandler = new Handler(); @@ -113,7 +113,7 @@ public class SwipeHelper implements Gefingerpoken { mDensityScale = res.getDisplayMetrics().density; mFalsingThreshold = res.getDimensionPixelSize(R.dimen.swipe_helper_falsing_threshold); mFadeDependingOnAmountSwiped = res.getBoolean(R.bool.config_fadeDependingOnAmountSwiped); - mFalsingManager = FalsingManagerFactory.getInstance(context); + mFalsingManager = falsingManager; mFlingAnimationUtils = new FlingAnimationUtils(context, getMaxEscapeAnimDuration() / 1000f); } diff --git a/packages/SystemUI/src/com/android/systemui/SystemUIFactory.java b/packages/SystemUI/src/com/android/systemui/SystemUIFactory.java index cb60909732fec..5d8ecc5bfabf2 100644 --- a/packages/SystemUI/src/com/android/systemui/SystemUIFactory.java +++ b/packages/SystemUI/src/com/android/systemui/SystemUIFactory.java @@ -34,9 +34,9 @@ import com.android.internal.widget.LockPatternUtils; import com.android.keyguard.KeyguardUpdateMonitor; import com.android.keyguard.ViewMediatorCallback; import com.android.systemui.assist.AssistManager; -import com.android.systemui.classifier.FalsingManagerFactory; import com.android.systemui.dock.DockManager; import com.android.systemui.keyguard.DismissCallbackRegistry; +import com.android.systemui.plugins.FalsingManager; import com.android.systemui.plugins.statusbar.StatusBarStateController; import com.android.systemui.power.EnhancedEstimates; import com.android.systemui.power.EnhancedEstimatesImpl; @@ -130,9 +130,10 @@ public class SystemUIFactory { public KeyguardBouncer createKeyguardBouncer(Context context, ViewMediatorCallback callback, LockPatternUtils lockPatternUtils, ViewGroup container, DismissCallbackRegistry dismissCallbackRegistry, - KeyguardBouncer.BouncerExpansionCallback expansionCallback) { + KeyguardBouncer.BouncerExpansionCallback expansionCallback, + FalsingManager falsingManager) { return new KeyguardBouncer(context, callback, lockPatternUtils, container, - dismissCallbackRegistry, FalsingManagerFactory.getInstance(context), + dismissCallbackRegistry, falsingManager, expansionCallback, UnlockMethodCache.getInstance(context), KeyguardUpdateMonitor.getInstance(context), new Handler(Looper.getMainLooper())); } diff --git a/packages/SystemUI/src/com/android/systemui/classifier/FalsingManagerFactory.java b/packages/SystemUI/src/com/android/systemui/classifier/FalsingManagerFactory.java deleted file mode 100644 index 01921f0d9a60f..0000000000000 --- a/packages/SystemUI/src/com/android/systemui/classifier/FalsingManagerFactory.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (C) 2015 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.classifier; - -import android.content.Context; - -import com.android.systemui.Dependency; -import com.android.systemui.plugins.FalsingManager; - -/** - * When the phone is locked, listens to touch, sensor and phone events and sends them to - * DataCollector and HumanInteractionClassifier. - * - * It does not collect touch events when the bouncer shows up. - * - * TODO: FalsingManager supports dependency injection. Use it. - */ -public class FalsingManagerFactory { - private static FalsingManager sInstance = null; - - private FalsingManagerFactory() {} - - public static FalsingManager getInstance(Context context) { - if (sInstance == null) { - sInstance = Dependency.get(FalsingManager.class); - } - return sInstance; - } - -} diff --git a/packages/SystemUI/src/com/android/systemui/classifier/FalsingManagerFake.java b/packages/SystemUI/src/com/android/systemui/classifier/FalsingManagerFake.java new file mode 100644 index 0000000000000..ea175edf0be15 --- /dev/null +++ b/packages/SystemUI/src/com/android/systemui/classifier/FalsingManagerFake.java @@ -0,0 +1,246 @@ +/* + * Copyright (C) 2019 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.classifier; + +import android.net.Uri; +import android.view.MotionEvent; + +import com.android.internal.annotations.VisibleForTesting; +import com.android.systemui.plugins.FalsingManager; + +import java.io.PrintWriter; + +/** + * Simple Fake for testing where {@link FalsingManager} is required. + */ +public class FalsingManagerFake implements FalsingManager { + private boolean mIsFalseTouch; + private boolean mIsUnlockingDisabled; + private boolean mIsClassiferEnabled; + private boolean mShouldEnforceBouncer; + private boolean mIsReportingEnabled; + + @Override + public void onSucccessfulUnlock() { + + } + + @Override + public void onNotificationActive() { + + } + + @Override + public void setShowingAod(boolean showingAod) { + + } + + @Override + public void onNotificatonStartDraggingDown() { + + } + + @VisibleForTesting + public void setIsUnlockingDisabled(boolean isUnlockingDisabled) { + mIsUnlockingDisabled = isUnlockingDisabled; + } + + @Override + public boolean isUnlockingDisabled() { + return mIsUnlockingDisabled; + } + + @VisibleForTesting + public void setIsFalseTouch(boolean isFalseTouch) { + mIsFalseTouch = isFalseTouch; + } + + @Override + public boolean isFalseTouch() { + return mIsFalseTouch; + } + + @Override + public void onNotificatonStopDraggingDown() { + + } + + @Override + public void setNotificationExpanded() { + + } + + @VisibleForTesting + public void setIsClassiferEnabled(boolean isClassiferEnabled) { + mIsClassiferEnabled = isClassiferEnabled; + } + + @Override + public boolean isClassiferEnabled() { + return mIsClassiferEnabled; + } + + @Override + public void onQsDown() { + + } + + @Override + public void setQsExpanded(boolean expanded) { + + } + + @VisibleForTesting + public void setShouldEnforceBouncer(boolean shouldEnforceBouncer) { + mShouldEnforceBouncer = shouldEnforceBouncer; + } + + @Override + public boolean shouldEnforceBouncer() { + return mShouldEnforceBouncer; + } + + @Override + public void onTrackingStarted(boolean secure) { + + } + + @Override + public void onTrackingStopped() { + + } + + @Override + public void onLeftAffordanceOn() { + + } + + @Override + public void onCameraOn() { + + } + + @Override + public void onAffordanceSwipingStarted(boolean rightCorner) { + + } + + @Override + public void onAffordanceSwipingAborted() { + + } + + @Override + public void onStartExpandingFromPulse() { + + } + + @Override + public void onExpansionFromPulseStopped() { + + } + + @Override + public Uri reportRejectedTouch() { + return null; + } + + @Override + public void onScreenOnFromTouch() { + + } + + + @VisibleForTesting + public void setIsReportingEnabled(boolean isReportingEnabled) { + mIsReportingEnabled = isReportingEnabled; + } + + @Override + public boolean isReportingEnabled() { + return mIsReportingEnabled; + } + + @Override + public void onUnlockHintStarted() { + + } + + @Override + public void onCameraHintStarted() { + + } + + @Override + public void onLeftAffordanceHintStarted() { + + } + + @Override + public void onScreenTurningOn() { + + } + + @Override + public void onScreenOff() { + + } + + @Override + public void onNotificatonStopDismissing() { + + } + + @Override + public void onNotificationDismissed() { + + } + + @Override + public void onNotificatonStartDismissing() { + + } + + @Override + public void onNotificationDoubleTap(boolean accepted, float dx, float dy) { + + } + + @Override + public void onBouncerShown() { + + } + + @Override + public void onBouncerHidden() { + + } + + @Override + public void onTouchEvent(MotionEvent ev, int width, int height) { + + } + + @Override + public void dump(PrintWriter pw) { + + } + + @Override + public void cleanup() { + } +} diff --git a/packages/SystemUI/src/com/android/systemui/doze/DozeFactory.java b/packages/SystemUI/src/com/android/systemui/doze/DozeFactory.java index 347b9649f9aff..90cb05a8e6ee1 100644 --- a/packages/SystemUI/src/com/android/systemui/doze/DozeFactory.java +++ b/packages/SystemUI/src/com/android/systemui/doze/DozeFactory.java @@ -28,9 +28,9 @@ import com.android.keyguard.KeyguardUpdateMonitor; import com.android.systemui.Dependency; import com.android.systemui.R; import com.android.systemui.SystemUIApplication; -import com.android.systemui.classifier.FalsingManagerFactory; import com.android.systemui.dock.DockManager; import com.android.systemui.keyguard.WakefulnessLifecycle; +import com.android.systemui.plugins.FalsingManager; import com.android.systemui.statusbar.phone.BiometricUnlockController; import com.android.systemui.statusbar.phone.DozeParameters; import com.android.systemui.util.AsyncSensorManager; @@ -43,7 +43,7 @@ public class DozeFactory { } /** Creates a DozeMachine with its parts for {@code dozeService}. */ - public DozeMachine assembleMachine(DozeService dozeService) { + public DozeMachine assembleMachine(DozeService dozeService, FalsingManager falsingManager) { Context context = dozeService; SensorManager sensorManager = Dependency.get(AsyncSensorManager.class); AlarmManager alarmManager = context.getSystemService(AlarmManager.class); @@ -67,7 +67,7 @@ public class DozeFactory { wakefulnessLifecycle); machine.setParts(new DozeMachine.Part[]{ new DozePauser(handler, machine, alarmManager, params.getPolicy()), - new DozeFalsingManagerAdapter(FalsingManagerFactory.getInstance(context)), + new DozeFalsingManagerAdapter(falsingManager), createDozeTriggers(context, sensorManager, host, alarmManager, config, params, handler, wakeLock, machine, dockManager), createDozeUi(context, host, wakeLock, machine, handler, alarmManager, params), diff --git a/packages/SystemUI/src/com/android/systemui/doze/DozeService.java b/packages/SystemUI/src/com/android/systemui/doze/DozeService.java index 83b6db7948b7b..9e1514c31ab18 100644 --- a/packages/SystemUI/src/com/android/systemui/doze/DozeService.java +++ b/packages/SystemUI/src/com/android/systemui/doze/DozeService.java @@ -25,6 +25,7 @@ import android.util.Log; import com.android.systemui.Dependency; import com.android.systemui.plugins.DozeServicePlugin; import com.android.systemui.plugins.DozeServicePlugin.RequestDoze; +import com.android.systemui.plugins.FalsingManager; import com.android.systemui.plugins.PluginListener; import com.android.systemui.shared.plugins.PluginManager; @@ -59,7 +60,8 @@ public class DozeService extends DreamService } mPluginManager = Dependency.get(PluginManager.class); mPluginManager.addPluginListener(this, DozeServicePlugin.class, false /* allowMultiple */); - mDozeMachine = new DozeFactory().assembleMachine(this); + mDozeMachine = new DozeFactory().assembleMachine( + this, Dependency.get(FalsingManager.class)); } @Override diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java index e9f99acd8d468..36c3cc68be856 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java +++ b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java @@ -84,7 +84,7 @@ import com.android.systemui.Dependency; import com.android.systemui.SystemUI; import com.android.systemui.SystemUIFactory; import com.android.systemui.UiOffloadThread; -import com.android.systemui.classifier.FalsingManagerFactory; +import com.android.systemui.plugins.FalsingManager; import com.android.systemui.statusbar.phone.BiometricUnlockController; import com.android.systemui.statusbar.phone.KeyguardBypassController; import com.android.systemui.statusbar.phone.NotificationPanelView; @@ -1599,7 +1599,7 @@ public class KeyguardViewMediator extends SystemUI { Trace.beginSection("KeyguardViewMediator#handleMessage START_KEYGUARD_EXIT_ANIM"); StartKeyguardExitAnimParams params = (StartKeyguardExitAnimParams) msg.obj; handleStartKeyguardExitAnimation(params.startTime, params.fadeoutDuration); - FalsingManagerFactory.getInstance(mContext).onSucccessfulUnlock(); + Dependency.get(FalsingManager.class).onSucccessfulUnlock(); Trace.endSection(); break; case KEYGUARD_DONE_PENDING_TIMEOUT: @@ -2071,10 +2071,11 @@ public class KeyguardViewMediator extends SystemUI { public StatusBarKeyguardViewManager registerStatusBar(StatusBar statusBar, ViewGroup container, NotificationPanelView panelView, BiometricUnlockController biometricUnlockController, ViewGroup lockIconContainer, - View notificationContainer, KeyguardBypassController bypassController) { + View notificationContainer, KeyguardBypassController bypassController, + FalsingManager falsingManager) { mStatusBarKeyguardViewManager.registerStatusBar(statusBar, container, panelView, biometricUnlockController, mDismissCallbackRegistry, lockIconContainer, - notificationContainer, bypassController); + notificationContainer, bypassController, falsingManager); return mStatusBarKeyguardViewManager; } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/DragDownHelper.java b/packages/SystemUI/src/com/android/systemui/statusbar/DragDownHelper.java index 8385c8e003923..5adee40613e64 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/DragDownHelper.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/DragDownHelper.java @@ -29,7 +29,6 @@ import com.android.systemui.ExpandHelper; import com.android.systemui.Gefingerpoken; import com.android.systemui.Interpolators; import com.android.systemui.R; -import com.android.systemui.classifier.FalsingManagerFactory; import com.android.systemui.plugins.FalsingManager; import com.android.systemui.statusbar.notification.row.ExpandableView; @@ -59,14 +58,15 @@ public class DragDownHelper implements Gefingerpoken { private FalsingManager mFalsingManager; public DragDownHelper(Context context, View host, ExpandHelper.Callback callback, - DragDownCallback dragDownCallback) { + DragDownCallback dragDownCallback, + FalsingManager falsingManager) { mMinDragDistance = context.getResources().getDimensionPixelSize( R.dimen.keyguard_drag_down_min_distance); mTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop(); mCallback = callback; mDragDownCallback = dragDownCallback; mHost = host; - mFalsingManager = FalsingManagerFactory.getInstance(context); + mFalsingManager = falsingManager; } @Override diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/PulseExpansionHandler.kt b/packages/SystemUI/src/com/android/systemui/statusbar/PulseExpansionHandler.kt index 986486ac14d48..48d6de964b080 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/PulseExpansionHandler.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/PulseExpansionHandler.kt @@ -27,11 +27,11 @@ import android.os.SystemClock import android.view.MotionEvent import android.view.VelocityTracker import android.view.ViewConfiguration +import com.android.systemui.Dependency import com.android.systemui.Gefingerpoken import com.android.systemui.Interpolators import com.android.systemui.R -import com.android.systemui.classifier.FalsingManagerFactory import com.android.systemui.plugins.FalsingManager import com.android.systemui.statusbar.notification.NotificationWakeUpCoordinator import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow @@ -115,7 +115,7 @@ constructor(context: Context, mMinDragDistance = context.resources.getDimensionPixelSize( R.dimen.keyguard_drag_down_min_distance) mTouchSlop = ViewConfiguration.get(context).scaledTouchSlop.toFloat() - mFalsingManager = FalsingManagerFactory.getInstance(context) + mFalsingManager = Dependency.get(FalsingManager::class.java) mPowerManager = context.getSystemService(PowerManager::class.java) } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ActivatableNotificationView.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ActivatableNotificationView.java index dca152fbe37af..8d7325118139f 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ActivatableNotificationView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ActivatableNotificationView.java @@ -33,9 +33,9 @@ import android.view.accessibility.AccessibilityManager; import android.view.animation.Interpolator; import android.view.animation.PathInterpolator; +import com.android.systemui.Dependency; import com.android.systemui.Interpolators; import com.android.systemui.R; -import com.android.systemui.classifier.FalsingManagerFactory; import com.android.systemui.plugins.FalsingManager; import com.android.systemui.statusbar.NotificationShelf; import com.android.systemui.statusbar.notification.FakeShadowView; @@ -130,7 +130,7 @@ public abstract class ActivatableNotificationView extends ExpandableOutlineView private boolean mLastInSection; private boolean mFirstInSection; private boolean mIsBelowSpeedBump; - private FalsingManager mFalsingManager; + private final FalsingManager mFalsingManager; private float mNormalBackgroundVisibilityAmount; private float mDimmedBackgroundFadeInAmount = -1; @@ -164,10 +164,10 @@ public abstract class ActivatableNotificationView extends ExpandableOutlineView super(context, attrs); mSlowOutFastInInterpolator = new PathInterpolator(0.8f, 0.0f, 0.6f, 1.0f); mSlowOutLinearInInterpolator = new PathInterpolator(0.8f, 0.0f, 1.0f, 1.0f); + mFalsingManager = Dependency.get(FalsingManager.class); // TODO: inject into a controller. setClipChildren(false); setClipToPadding(false); updateColors(); - mFalsingManager = FalsingManagerFactory.getInstance(context); mAccessibilityManager = AccessibilityManager.getInstance(mContext); mDoubleTapHelper = new DoubleTapHelper(this, (active) -> { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRow.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRow.java index d6aeb4ff2c23d..65e744b9e047f 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRow.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRow.java @@ -74,7 +74,6 @@ import com.android.internal.widget.CachingIconView; import com.android.systemui.Dependency; import com.android.systemui.Interpolators; import com.android.systemui.R; -import com.android.systemui.classifier.FalsingManagerFactory; import com.android.systemui.plugins.FalsingManager; import com.android.systemui.plugins.PluginListener; import com.android.systemui.plugins.statusbar.NotificationMenuRowPlugin; @@ -1637,7 +1636,7 @@ public class ExpandableNotificationRow extends ActivatableNotificationView public ExpandableNotificationRow(Context context, AttributeSet attrs) { super(context, attrs); - mFalsingManager = FalsingManagerFactory.getInstance(context); + mFalsingManager = Dependency.get(FalsingManager.class); // TODO: inject into a controller. mNotificationInflater = new NotificationContentInflater(this); mMenuRow = new NotificationMenuRow(mContext); mImageResolver = new NotificationInlineImageResolver(context, 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 f50790f3013b6..688e8eb8f2e3e 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 @@ -86,7 +86,6 @@ import com.android.systemui.ExpandHelper; import com.android.systemui.Interpolators; import com.android.systemui.R; import com.android.systemui.SwipeHelper; -import com.android.systemui.classifier.FalsingManagerFactory; import com.android.systemui.colorextraction.SysuiColorExtractor; import com.android.systemui.plugins.ActivityStarter; import com.android.systemui.plugins.FalsingManager; @@ -516,7 +515,8 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd ActivityStarter activityStarter, StatusBarStateController statusBarStateController, HeadsUpManagerPhone headsUpManager, - KeyguardBypassController keyguardBypassController) { + KeyguardBypassController keyguardBypassController, + FalsingManager falsingManager) { super(context, attrs, 0, 0); Resources res = getResources(); @@ -531,6 +531,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd mHeadsUpManager.addListener(mRoundnessManager); mHeadsUpManager.setAnimationStateHandler(this::setHeadsUpGoingAwayAnimationsAllowed); mKeyguardBypassController = keyguardBypassController; + mFalsingManager = falsingManager; mSectionsManager = new NotificationSectionsManager( @@ -555,10 +556,9 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd mExpandHelper.setEventSource(this); mExpandHelper.setScrollAdapter(this); mSwipeHelper = new NotificationSwipeHelper(SwipeHelper.X, mNotificationCallback, - getContext(), mMenuEventListener); + getContext(), mMenuEventListener, mFalsingManager); mStackScrollAlgorithm = createStackScrollAlgorithm(context); initView(context); - mFalsingManager = FalsingManagerFactory.getInstance(context); mShouldDrawNotificationBackground = res.getBoolean(R.bool.config_drawNotificationBackground); mFadeNotificationsOnDismiss = diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationSwipeHelper.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationSwipeHelper.java index 4dfc343df2836..0968674d31cc6 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationSwipeHelper.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationSwipeHelper.java @@ -28,6 +28,7 @@ import android.view.View; import com.android.internal.annotations.VisibleForTesting; import com.android.systemui.SwipeHelper; +import com.android.systemui.plugins.FalsingManager; import com.android.systemui.plugins.statusbar.NotificationMenuRowPlugin; import com.android.systemui.plugins.statusbar.NotificationSwipeActionHelper; import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow; @@ -50,9 +51,11 @@ class NotificationSwipeHelper extends SwipeHelper private boolean mIsExpanded; private boolean mPulsing; - public NotificationSwipeHelper(int swipeDirection, NotificationCallback callback, - Context context, NotificationMenuRowPlugin.OnMenuEventListener menuListener) { - super(swipeDirection, callback, context); + NotificationSwipeHelper( + int swipeDirection, NotificationCallback callback, Context context, + NotificationMenuRowPlugin.OnMenuEventListener menuListener, + FalsingManager falsingManager) { + super(swipeDirection, callback, context, falsingManager); mMenuListener = menuListener; mCallback = callback; mFalsingCheck = new Runnable() { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardAffordanceHelper.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardAffordanceHelper.java index 4691a31fad21c..66b1dd8db1236 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardAffordanceHelper.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardAffordanceHelper.java @@ -27,7 +27,6 @@ import android.view.ViewConfiguration; import com.android.systemui.Interpolators; import com.android.systemui.R; -import com.android.systemui.classifier.FalsingManagerFactory; import com.android.systemui.plugins.FalsingManager; import com.android.systemui.statusbar.FlingAnimationUtils; import com.android.systemui.statusbar.KeyguardAffordanceView; @@ -59,7 +58,7 @@ public class KeyguardAffordanceHelper { private KeyguardAffordanceView mLeftIcon; private KeyguardAffordanceView mRightIcon; private Animator mSwipeAnimator; - private FalsingManager mFalsingManager; + private final FalsingManager mFalsingManager; private int mMinBackgroundRadius; private boolean mMotionCancelled; private int mTouchTargetSize; @@ -80,12 +79,13 @@ public class KeyguardAffordanceHelper { } }; - KeyguardAffordanceHelper(Callback callback, Context context) { + KeyguardAffordanceHelper(Callback callback, Context context, FalsingManager falsingManager) { mContext = context; mCallback = callback; initIcons(); updateIcon(mLeftIcon, 0.0f, mLeftIcon.getRestingAlpha(), false, false, true, false); updateIcon(mRightIcon, 0.0f, mRightIcon.getRestingAlpha(), false, false, true, false); + mFalsingManager = falsingManager; initDimens(); } @@ -102,7 +102,6 @@ public class KeyguardAffordanceHelper { mHintGrowAmount = mContext.getResources().getDimensionPixelSize(R.dimen.hint_grow_amount_sideways); mFlingAnimationUtils = new FlingAnimationUtils(mContext, 0.4f); - mFalsingManager = FalsingManagerFactory.getInstance(mContext); } private void initIcons() { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java index a0847b62eddb2..d0626ed780e24 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java @@ -63,7 +63,6 @@ import com.android.systemui.DejankUtils; import com.android.systemui.Dependency; import com.android.systemui.Interpolators; import com.android.systemui.R; -import com.android.systemui.classifier.FalsingManagerFactory; import com.android.systemui.fragments.FragmentHostManager; import com.android.systemui.fragments.FragmentHostManager.FragmentListener; import com.android.systemui.plugins.FalsingManager; @@ -391,11 +390,12 @@ public class NotificationPanelView extends PanelView implements NotificationWakeUpCoordinator coordinator, PulseExpansionHandler pulseExpansionHandler, DynamicPrivacyController dynamicPrivacyController, - KeyguardBypassController bypassController) { + KeyguardBypassController bypassController, + FalsingManager falsingManager) { super(context, attrs); setWillNotDraw(!DEBUG); mInjectionInflationController = injectionInflationController; - mFalsingManager = FalsingManagerFactory.getInstance(context); + mFalsingManager = falsingManager; mPowerManager = context.getSystemService(PowerManager.class); mWakeUpCoordinator = coordinator; mAccessibilityManager = context.getSystemService(AccessibilityManager.class); @@ -625,7 +625,7 @@ public class NotificationPanelView extends PanelView implements } private void initBottomArea() { - mAffordanceHelper = new KeyguardAffordanceHelper(this, getContext()); + mAffordanceHelper = new KeyguardAffordanceHelper(this, getContext(), mFalsingManager); mKeyguardBottomArea.setAffordanceHelper(mAffordanceHelper); mKeyguardBottomArea.setStatusBar(mStatusBar); mKeyguardBottomArea.setUserSetupComplete(mUserSetupComplete); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java index f8e1093e210b1..31600e391f34f 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java @@ -42,7 +42,6 @@ import com.android.systemui.DejankUtils; import com.android.systemui.Dependency; import com.android.systemui.Interpolators; import com.android.systemui.R; -import com.android.systemui.classifier.FalsingManagerFactory; import com.android.systemui.doze.DozeLog; import com.android.systemui.plugins.FalsingManager; import com.android.systemui.plugins.statusbar.StatusBarStateController; @@ -111,7 +110,7 @@ public abstract class PanelView extends FrameLayout { private FlingAnimationUtils mFlingAnimationUtils; private FlingAnimationUtils mFlingAnimationUtilsClosing; private FlingAnimationUtils mFlingAnimationUtilsDismissing; - private FalsingManager mFalsingManager; + private final FalsingManager mFalsingManager; private final VibratorHelper mVibratorHelper; /** @@ -214,7 +213,7 @@ public abstract class PanelView extends FrameLayout { 0.5f /* maxLengthSeconds */, 0.2f /* speedUpFactor */, 0.6f /* x2 */, 0.84f /* y2 */); mBounceInterpolator = new BounceInterpolator(); - mFalsingManager = FalsingManagerFactory.getInstance(context); + mFalsingManager = Dependency.get(FalsingManager.class); // TODO: inject into a controller. mNotificationsDragEnabled = getResources().getBoolean(R.bool.config_enableNotificationShadeDrag); mVibratorHelper = Dependency.get(VibratorHelper.class); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java index d12bed9d4f6d1..97f069274f78f 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java @@ -147,7 +147,6 @@ import com.android.systemui.assist.AssistManager; import com.android.systemui.bubbles.BubbleController; import com.android.systemui.charging.WirelessChargingAnimation; import com.android.systemui.classifier.FalsingLog; -import com.android.systemui.classifier.FalsingManagerFactory; import com.android.systemui.colorextraction.SysuiColorExtractor; import com.android.systemui.doze.DozeHost; import com.android.systemui.doze.DozeLog; @@ -701,6 +700,7 @@ public class StatusBar extends SystemUI implements DemoMode, mRecents = getComponent(Recents.class); mKeyguardManager = (KeyguardManager) mContext.getSystemService(Context.KEYGUARD_SERVICE); + mFalsingManager = Dependency.get(FalsingManager.class); // Connect in to the status bar manager service mCommandQueue = getComponent(CommandQueue.class); @@ -776,7 +776,6 @@ public class StatusBar extends SystemUI implements DemoMode, putComponent(DozeHost.class, mDozeServiceHost); mScreenPinningRequest = new ScreenPinningRequest(mContext); - mFalsingManager = FalsingManagerFactory.getInstance(mContext); Dependency.get(ActivityStarterDelegate.class).setActivityStarterImpl(this); @@ -1243,7 +1242,7 @@ public class StatusBar extends SystemUI implements DemoMode, mStatusBarKeyguardViewManager = keyguardViewMediator.registerStatusBar(this, getBouncerContainer(), mNotificationPanel, mBiometricUnlockController, mStatusBarWindow.findViewById(R.id.lock_icon_container), mStackScroller, - mKeyguardBypassController); + mKeyguardBypassController, mFalsingManager); mKeyguardIndicationController .setStatusBarKeyguardViewManager(mStatusBarKeyguardViewManager); mBiometricUnlockController.setStatusBarKeyguardViewManager(mStatusBarKeyguardViewManager); @@ -2415,7 +2414,7 @@ public class StatusBar extends SystemUI implements DemoMode, mKeyguardUpdateMonitor.dump(fd, pw, args); } - FalsingManagerFactory.getInstance(mContext).dump(pw); + Dependency.get(FalsingManager.class).dump(pw); FalsingLog.dump(pw); pw.println("SharedPreferences:"); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java index 4d85a422d9b9f..d47adbe180c87 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java @@ -44,6 +44,7 @@ import com.android.systemui.Dependency; import com.android.systemui.SystemUIFactory; import com.android.systemui.dock.DockManager; import com.android.systemui.keyguard.DismissCallbackRegistry; +import com.android.systemui.plugins.FalsingManager; import com.android.systemui.plugins.statusbar.StatusBarStateController; import com.android.systemui.shared.system.QuickStepContract; import com.android.systemui.statusbar.CommandQueue; @@ -210,7 +211,7 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb BiometricUnlockController biometricUnlockController, DismissCallbackRegistry dismissCallbackRegistry, ViewGroup lockIconContainer, View notificationContainer, - KeyguardBypassController bypassController) { + KeyguardBypassController bypassController, FalsingManager falsingManager) { mStatusBar = statusBar; mContainer = container; mLockIconContainer = lockIconContainer; @@ -220,7 +221,7 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb mBiometricUnlockController = biometricUnlockController; mBouncer = SystemUIFactory.getInstance().createKeyguardBouncer(mContext, mViewMediatorCallback, mLockPatternUtils, container, dismissCallbackRegistry, - mExpansionCallback); + mExpansionCallback, falsingManager); mNotificationPanelView = notificationPanelView; notificationPanelView.addExpansionListener(this); mBypassController = bypassController; diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowView.java index 1081bad9bf1c2..6789930ab76ef 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowView.java @@ -62,7 +62,6 @@ import com.android.internal.widget.FloatingToolbar; import com.android.systemui.Dependency; import com.android.systemui.ExpandHelper; import com.android.systemui.R; -import com.android.systemui.classifier.FalsingManagerFactory; import com.android.systemui.plugins.FalsingManager; import com.android.systemui.plugins.statusbar.StatusBarStateController; import com.android.systemui.statusbar.DragDownHelper; @@ -157,7 +156,7 @@ public class StatusBarWindowView extends FrameLayout { setMotionEventSplittingEnabled(false); mTransparentSrcPaint.setColor(0); mTransparentSrcPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC)); - mFalsingManager = FalsingManagerFactory.getInstance(context); + mFalsingManager = Dependency.get(FalsingManager.class); // TODO: inject into a controller. mGestureDetector = new GestureDetector(context, mGestureListener); mStatusBarStateController = Dependency.get(StatusBarStateController.class); Dependency.get(TunerService.class).addTunable(mTunable, @@ -291,7 +290,7 @@ public class StatusBarWindowView extends FrameLayout { ExpandHelper.Callback expandHelperCallback = stackScrollLayout.getExpandHelperCallback(); DragDownHelper.DragDownCallback dragDownCallback = stackScrollLayout.getDragDownCallback(); setDragDownHelper(new DragDownHelper(getContext(), this, expandHelperCallback, - dragDownCallback)); + dragDownCallback, mFalsingManager)); } @VisibleForTesting diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutTest.java index c851c915d6556..31054260eb157 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutTest.java @@ -53,6 +53,7 @@ import com.android.systemui.ExpandHelper; import com.android.systemui.InitController; import com.android.systemui.R; import com.android.systemui.SysuiTestCase; +import com.android.systemui.classifier.FalsingManagerFake; import com.android.systemui.plugins.statusbar.NotificationMenuRowPlugin; import com.android.systemui.plugins.statusbar.StatusBarStateController; import com.android.systemui.statusbar.EmptyShadeView; @@ -80,7 +81,6 @@ import com.android.systemui.statusbar.phone.StatusBarTest.TestableNotificationEn import com.android.systemui.statusbar.policy.ConfigurationController; import org.junit.After; -import org.junit.Assert; import org.junit.Before; import org.junit.Rule; import org.junit.Test; @@ -165,7 +165,8 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase { mock(ActivityStarterDelegate.class), mock(SysuiStatusBarStateController.class), mHeadsUpManager, - mKeyguardBypassController); + mKeyguardBypassController, + new FalsingManagerFake()); mStackScroller = spy(mStackScrollerInternal); mStackScroller.setShelf(notificationShelf); mStackScroller.setStatusBar(mBar); diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationSwipeHelperTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationSwipeHelperTest.java index b24c3ddc11993..06a2eecd208cb 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationSwipeHelperTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationSwipeHelperTest.java @@ -40,6 +40,7 @@ import androidx.test.filters.SmallTest; import com.android.systemui.SwipeHelper; import com.android.systemui.SysuiTestCase; +import com.android.systemui.classifier.FalsingManagerFake; import com.android.systemui.plugins.statusbar.NotificationMenuRowPlugin; import com.android.systemui.plugins.statusbar.NotificationSwipeActionHelper.SnoozeOption; import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow; @@ -76,7 +77,8 @@ public class NotificationSwipeHelperTest extends SysuiTestCase { public void setUp() throws Exception { mCallback = mock(NotificationSwipeHelper.NotificationCallback.class); mListener = mock(NotificationMenuRowPlugin.OnMenuEventListener.class); - mSwipeHelper = spy(new NotificationSwipeHelper(SwipeHelper.X, mCallback, mContext, mListener)); + mSwipeHelper = spy(new NotificationSwipeHelper( + SwipeHelper.X, mCallback, mContext, mListener, new FalsingManagerFake())); mView = mock(View.class); mEvent = mock(MotionEvent.class); mMenuRow = mock(NotificationMenuRowPlugin.class); diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationPanelViewTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationPanelViewTest.java index d14b460d8c63b..a96efd7d2fc2d 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationPanelViewTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationPanelViewTest.java @@ -36,6 +36,7 @@ import androidx.test.filters.SmallTest; import com.android.keyguard.KeyguardStatusView; import com.android.systemui.SystemUIFactory; import com.android.systemui.SysuiTestCase; +import com.android.systemui.plugins.FalsingManager; import com.android.systemui.plugins.statusbar.StatusBarStateController; import com.android.systemui.statusbar.KeyguardAffordanceView; import com.android.systemui.statusbar.NotificationLockscreenUserManager; @@ -98,6 +99,8 @@ public class NotificationPanelViewTest extends SysuiTestCase { private PanelBar mPanelBar; @Mock private KeyguardAffordanceHelper mAffordanceHelper; + @Mock + private FalsingManager mFalsingManager; private NotificationPanelView mNotificationPanelView; @Before @@ -191,7 +194,8 @@ public class NotificationPanelViewTest extends SysuiTestCase { new InjectionInflationController( SystemUIFactory.getInstance().getRootComponent()), coordinator, expansionHandler, mock(DynamicPrivacyController.class), - bypassController); + bypassController, + mFalsingManager); mNotificationStackScroller = mNotificationStackScrollLayout; mKeyguardStatusView = NotificationPanelViewTest.this.mKeyguardStatusView; mKeyguardStatusBar = NotificationPanelViewTest.this.mKeyguardStatusBar; diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManagerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManagerTest.java index da2e8dc908546..63f653b0b303f 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManagerTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManagerTest.java @@ -39,8 +39,10 @@ import androidx.test.filters.SmallTest; import com.android.internal.widget.LockPatternUtils; import com.android.keyguard.ViewMediatorCallback; import com.android.systemui.SysuiTestCase; +import com.android.systemui.classifier.FalsingManagerFake; import com.android.systemui.keyguard.DismissCallbackRegistry; import com.android.systemui.plugins.ActivityStarter.OnDismissAction; +import com.android.systemui.plugins.FalsingManager; import com.android.systemui.plugins.statusbar.StatusBarStateController; import com.android.systemui.statusbar.SysuiStatusBarStateController; @@ -93,7 +95,8 @@ public class StatusBarKeyguardViewManagerTest extends SysuiTestCase { mViewMediatorCallback, mLockPatternUtils); mStatusBarKeyguardViewManager.registerStatusBar(mStatusBar, mContainer, mNotificationPanelView, mBiometrucUnlockController, mDismissCallbackRegistry, - mLockIconContainer, mNotificationContainer, mBypassController); + mLockIconContainer, mNotificationContainer, mBypassController, + new FalsingManagerFake()); mStatusBarKeyguardViewManager.show(null); } @@ -232,11 +235,11 @@ public class StatusBarKeyguardViewManagerTest extends SysuiTestCase { BiometricUnlockController fingerprintUnlockController, DismissCallbackRegistry dismissCallbackRegistry, ViewGroup lockIconContainer, View notificationContainer, - KeyguardBypassController bypassController) { + KeyguardBypassController bypassController, FalsingManager falsingManager) { super.registerStatusBar(statusBar, container, notificationPanelView, fingerprintUnlockController, dismissCallbackRegistry, lockIconContainer, - notificationContainer, bypassController); + notificationContainer, bypassController, falsingManager); mBouncer = StatusBarKeyguardViewManagerTest.this.mBouncer; } } -} \ No newline at end of file +}