Merge "Remove Dependency#get from KeyguardSliceProvider"
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardSliceProvider.java b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardSliceProvider.java
index 30429fb..2a73797 100644
--- a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardSliceProvider.java
+++ b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardSliceProvider.java
@@ -49,7 +49,6 @@
import com.android.internal.annotations.VisibleForTesting;
import com.android.keyguard.KeyguardUpdateMonitor;
import com.android.keyguard.KeyguardUpdateMonitorCallback;
-import com.android.systemui.Dependency;
import com.android.systemui.R;
import com.android.systemui.SystemUIAppComponentFactory;
import com.android.systemui.plugins.statusbar.StatusBarStateController;
@@ -139,6 +138,8 @@
public StatusBarStateController mStatusBarStateController;
@Inject
public KeyguardBypassController mKeyguardBypassController;
+ @Inject
+ public KeyguardUpdateMonitor mKeyguardUpdateMonitor;
private CharSequence mMediaTitle;
private CharSequence mMediaArtist;
protected boolean mDozing;
@@ -333,7 +334,7 @@
mAlarmManager.cancel(mUpdateNextAlarm);
if (mRegistered) {
mRegistered = false;
- getKeyguardUpdateMonitor().removeCallback(mKeyguardUpdateMonitorCallback);
+ mKeyguardUpdateMonitor.removeCallback(mKeyguardUpdateMonitorCallback);
getContext().unregisterReceiver(mIntentReceiver);
}
KeyguardSliceProvider.sInstance = null;
@@ -389,7 +390,7 @@
filter.addAction(Intent.ACTION_LOCALE_CHANGED);
getContext().registerReceiver(mIntentReceiver, filter, null /* permission*/,
null /* scheduler */);
- getKeyguardUpdateMonitor().registerCallback(mKeyguardUpdateMonitorCallback);
+ mKeyguardUpdateMonitor.registerCallback(mKeyguardUpdateMonitorCallback);
mRegistered = true;
}
}
@@ -441,10 +442,6 @@
updateNextAlarm();
}
- private KeyguardUpdateMonitor getKeyguardUpdateMonitor() {
- return Dependency.get(KeyguardUpdateMonitor.class);
- }
-
/**
* Called whenever new media metadata is available.
* @param metadata New metadata.
diff --git a/packages/SystemUI/tests/src/com/android/systemui/keyguard/KeyguardSliceProviderTest.java b/packages/SystemUI/tests/src/com/android/systemui/keyguard/KeyguardSliceProviderTest.java
index d1f505b..51c2580 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/keyguard/KeyguardSliceProviderTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/keyguard/KeyguardSliceProviderTest.java
@@ -90,6 +90,7 @@
private DozeParameters mDozeParameters;
@Mock
private NextAlarmController mNextAlarmController;
+ @Mock
private KeyguardUpdateMonitor mKeyguardUpdateMonitor;
private TestableKeyguardSliceProvider mProvider;
private boolean mIsZenMode;
@@ -97,7 +98,6 @@
@Before
public void setup() {
MockitoAnnotations.initMocks(this);
- mKeyguardUpdateMonitor = mDependency.injectMockDependency(KeyguardUpdateMonitor.class);
mIsZenMode = false;
mProvider = new TestableKeyguardSliceProvider();
mProvider.setContextAvailableCallback(context -> { });
@@ -265,6 +265,7 @@
mStatusBarStateController = KeyguardSliceProviderTest.this.mStatusBarStateController;
mKeyguardBypassController = KeyguardSliceProviderTest.this.mKeyguardBypassController;
mMediaManager = KeyguardSliceProviderTest.this.mNotificationMediaManager;
+ mKeyguardUpdateMonitor = KeyguardSliceProviderTest.this.mKeyguardUpdateMonitor;
}
@Override