Remove calls to Dependency.get(FalsingManager.class)
This removes all calls except one, which is used in a View. Bug: 136279712 Test: atest SystemUITests Change-Id: Ibadb81a41a4d23208842a99fa89436fd34b7a8a0
This commit is contained in:
@@ -2752,7 +2752,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
|
||||
|
||||
private void checkIsHandlerThread() {
|
||||
if (!mHandler.getLooper().isCurrentThread()) {
|
||||
Log.wtf(TAG, "must call on mHandler's thread "
|
||||
Log.wtfStack(TAG, "must call on mHandler's thread "
|
||||
+ mHandler.getLooper().getThread() + ", not " + Thread.currentThread());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,8 @@ package com.android.systemui;
|
||||
|
||||
import com.android.systemui.keyguard.KeyguardViewMediator;
|
||||
import com.android.systemui.power.PowerUI;
|
||||
import com.android.systemui.recents.Recents;
|
||||
import com.android.systemui.recents.RecentsModule;
|
||||
|
||||
import dagger.Binds;
|
||||
import dagger.Module;
|
||||
@@ -27,7 +29,7 @@ import dagger.multibindings.IntoMap;
|
||||
/**
|
||||
* SystemUI objects that are injectable should go here.
|
||||
*/
|
||||
@Module
|
||||
@Module(includes = {RecentsModule.class})
|
||||
public abstract class SystemUIBinder {
|
||||
/** Inject into KeyguardViewMediator. */
|
||||
@Binds
|
||||
@@ -40,4 +42,10 @@ public abstract class SystemUIBinder {
|
||||
@IntoMap
|
||||
@ClassKey(PowerUI.class)
|
||||
public abstract SystemUI bindPowerUI(PowerUI sysui);
|
||||
|
||||
/** Inject into StatusBar. */
|
||||
@Binds
|
||||
@IntoMap
|
||||
@ClassKey(Recents.class)
|
||||
public abstract SystemUI bindRecents(Recents sysui);
|
||||
}
|
||||
|
||||
@@ -21,25 +21,30 @@ import android.content.res.Configuration;
|
||||
import android.graphics.Rect;
|
||||
import android.provider.Settings;
|
||||
|
||||
import com.android.systemui.R;
|
||||
import com.android.systemui.SystemUI;
|
||||
import com.android.systemui.statusbar.CommandQueue;
|
||||
|
||||
import java.io.FileDescriptor;
|
||||
import java.io.PrintWriter;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
/**
|
||||
* A proxy to a Recents implementation.
|
||||
*/
|
||||
public class Recents extends SystemUI implements CommandQueue.Callbacks {
|
||||
|
||||
private RecentsImplementation mImpl;
|
||||
private final RecentsImplementation mImpl;
|
||||
|
||||
@Inject
|
||||
public Recents(RecentsImplementation impl) {
|
||||
mImpl = impl;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start() {
|
||||
getComponent(CommandQueue.class).addCallback(this);
|
||||
putComponent(Recents.class, this);
|
||||
mImpl = createRecentsImplementationFromConfig();
|
||||
mImpl.onStart(mContext, this);
|
||||
}
|
||||
|
||||
@@ -139,28 +144,6 @@ public class Recents extends SystemUI implements CommandQueue.Callbacks {
|
||||
(Settings.Secure.getInt(cr, Settings.Secure.USER_SETUP_COMPLETE, 0) != 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The recents implementation from the config.
|
||||
*/
|
||||
private RecentsImplementation createRecentsImplementationFromConfig() {
|
||||
final String clsName = mContext.getString(R.string.config_recentsComponent);
|
||||
if (clsName == null || clsName.length() == 0) {
|
||||
throw new RuntimeException("No recents component configured", null);
|
||||
}
|
||||
Class<?> cls = null;
|
||||
try {
|
||||
cls = mContext.getClassLoader().loadClass(clsName);
|
||||
} catch (Throwable t) {
|
||||
throw new RuntimeException("Error loading recents component: " + clsName, t);
|
||||
}
|
||||
try {
|
||||
RecentsImplementation impl = (RecentsImplementation) cls.newInstance();
|
||||
return impl;
|
||||
} catch (Throwable t) {
|
||||
throw new RuntimeException("Error creating recents component: " + clsName, t);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
|
||||
mImpl.dump(pw);
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
* 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.recents;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.android.systemui.R;
|
||||
|
||||
import dagger.Module;
|
||||
import dagger.Provides;
|
||||
|
||||
/**
|
||||
* Dagger injection module for {@link RecentsImplementation}
|
||||
*/
|
||||
@Module
|
||||
public class RecentsModule {
|
||||
/**
|
||||
* @return The {@link RecentsImplementation} from the config.
|
||||
*/
|
||||
@Provides
|
||||
public RecentsImplementation provideRecentsImpl(Context context) {
|
||||
final String clsName = context.getString(R.string.config_recentsComponent);
|
||||
if (clsName == null || clsName.length() == 0) {
|
||||
throw new RuntimeException("No recents component configured", null);
|
||||
}
|
||||
Class<?> cls = null;
|
||||
try {
|
||||
cls = context.getClassLoader().loadClass(clsName);
|
||||
} catch (Throwable t) {
|
||||
throw new RuntimeException("Error loading recents component: " + clsName, t);
|
||||
}
|
||||
try {
|
||||
RecentsImplementation impl = (RecentsImplementation) cls.newInstance();
|
||||
return impl;
|
||||
} catch (Throwable t) {
|
||||
throw new RuntimeException("Error creating recents component: " + clsName, t);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -27,7 +27,6 @@ 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
|
||||
@@ -58,7 +57,8 @@ constructor(
|
||||
private val bypassController: KeyguardBypassController,
|
||||
private val headsUpManager: HeadsUpManagerPhone,
|
||||
private val roundnessManager: NotificationRoundnessManager,
|
||||
private val statusBarStateController: StatusBarStateController
|
||||
private val statusBarStateController: StatusBarStateController,
|
||||
private val falsingManager: FalsingManager
|
||||
) : Gefingerpoken {
|
||||
companion object {
|
||||
private val RUBBERBAND_FACTOR_STATIC = 0.25f
|
||||
@@ -99,7 +99,6 @@ constructor(
|
||||
private val mTemp2 = IntArray(2)
|
||||
private var mDraggedFarEnough: Boolean = false
|
||||
private var mStartingChild: ExpandableView? = null
|
||||
private val mFalsingManager: FalsingManager
|
||||
private var mPulsing: Boolean = false
|
||||
var isWakingToShadeLocked: Boolean = false
|
||||
private set
|
||||
@@ -109,7 +108,7 @@ constructor(
|
||||
private var velocityTracker: VelocityTracker? = null
|
||||
|
||||
private val isFalseTouch: Boolean
|
||||
get() = mFalsingManager.isFalseTouch
|
||||
get() = falsingManager.isFalseTouch
|
||||
var qsExpanded: Boolean = false
|
||||
var pulseExpandAbortListener: Runnable? = null
|
||||
var bouncerShowing: Boolean = false
|
||||
@@ -118,7 +117,6 @@ constructor(
|
||||
mMinDragDistance = context.resources.getDimensionPixelSize(
|
||||
R.dimen.keyguard_drag_down_min_distance)
|
||||
mTouchSlop = ViewConfiguration.get(context).scaledTouchSlop.toFloat()
|
||||
mFalsingManager = Dependency.get(FalsingManager::class.java)
|
||||
mPowerManager = context.getSystemService(PowerManager::class.java)
|
||||
}
|
||||
|
||||
@@ -151,7 +149,7 @@ constructor(
|
||||
MotionEvent.ACTION_MOVE -> {
|
||||
val h = y - mInitialTouchY
|
||||
if (h > mTouchSlop && h > Math.abs(x - mInitialTouchX)) {
|
||||
mFalsingManager.onStartExpandingFromPulse()
|
||||
falsingManager.onStartExpandingFromPulse()
|
||||
isExpanding = true
|
||||
captureStartingChild(mInitialTouchX, mInitialTouchY)
|
||||
mInitialTouchY = y
|
||||
@@ -192,7 +190,7 @@ constructor(
|
||||
velocityTracker!!.computeCurrentVelocity(1000 /* units */)
|
||||
val canExpand = moveDistance > 0 && velocityTracker!!.getYVelocity() > -1000 &&
|
||||
statusBarStateController.state != StatusBarState.SHADE
|
||||
if (!mFalsingManager.isUnlockingDisabled && !isFalseTouch && canExpand) {
|
||||
if (!falsingManager.isUnlockingDisabled && !isFalseTouch && canExpand) {
|
||||
finishExpansion()
|
||||
} else {
|
||||
cancelExpansion()
|
||||
@@ -297,7 +295,7 @@ constructor(
|
||||
|
||||
private fun cancelExpansion() {
|
||||
isExpanding = false
|
||||
mFalsingManager.onExpansionFromPulseStopped()
|
||||
falsingManager.onExpansionFromPulseStopped()
|
||||
if (mStartingChild != null) {
|
||||
reset(mStartingChild!!)
|
||||
mStartingChild = null
|
||||
|
||||
@@ -180,6 +180,10 @@ public abstract class ActivatableNotificationView extends ExpandableOutlineView
|
||||
initDimens();
|
||||
}
|
||||
|
||||
public FalsingManager getFalsingManager() {
|
||||
return mFalsingManager;
|
||||
}
|
||||
|
||||
private void updateColors() {
|
||||
mNormalColor = mContext.getColor(R.color.notification_material_background_color);
|
||||
mTintedRippleColor = mContext.getColor(
|
||||
|
||||
@@ -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.plugins.FalsingManager;
|
||||
import com.android.systemui.plugins.PluginListener;
|
||||
import com.android.systemui.plugins.statusbar.NotificationMenuRowPlugin;
|
||||
import com.android.systemui.plugins.statusbar.NotificationMenuRowPlugin.MenuItem;
|
||||
@@ -221,7 +220,6 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
|
||||
private ViewStub mGutsStub;
|
||||
private boolean mIsSystemChildExpanded;
|
||||
private boolean mIsPinned;
|
||||
private FalsingManager mFalsingManager;
|
||||
private boolean mExpandAnimationRunning;
|
||||
private AboveShelfChangedListener mAboveShelfChangedListener;
|
||||
private HeadsUpManager mHeadsUpManager;
|
||||
@@ -1636,7 +1634,6 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
|
||||
|
||||
public ExpandableNotificationRow(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
mFalsingManager = Dependency.get(FalsingManager.class); // TODO: inject into a controller.
|
||||
mNotificationInflater = new NotificationContentInflater(this);
|
||||
mMenuRow = new NotificationMenuRow(mContext);
|
||||
mImageResolver = new NotificationInlineImageResolver(context,
|
||||
@@ -2208,7 +2205,7 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
|
||||
* @param allowChildExpansion whether a call to this method allows expanding children
|
||||
*/
|
||||
public void setUserExpanded(boolean userExpanded, boolean allowChildExpansion) {
|
||||
mFalsingManager.setNotificationExpanded();
|
||||
getFalsingManager().setNotificationExpanded();
|
||||
if (mIsSummaryWithChildren && !shouldShowPublic() && allowChildExpansion
|
||||
&& !mChildrenContainer.showingAsLowPriority()) {
|
||||
final boolean wasExpanded = mGroupManager.isGroupExpanded(mStatusBarNotification);
|
||||
|
||||
@@ -396,6 +396,8 @@ public class StatusBar extends SystemUI implements DemoMode,
|
||||
boolean mAllowNotificationLongPress;
|
||||
@Inject
|
||||
protected NotifPipelineInitializer mNotifPipelineInitializer;
|
||||
@Inject
|
||||
protected FalsingManager mFalsingManager;
|
||||
|
||||
@VisibleForTesting
|
||||
BroadcastDispatcher mBroadcastDispatcher;
|
||||
@@ -587,7 +589,6 @@ public class StatusBar extends SystemUI implements DemoMode,
|
||||
}
|
||||
};
|
||||
private boolean mNoAnimationOnNextBarModeChange;
|
||||
protected FalsingManager mFalsingManager;
|
||||
private final SysuiStatusBarStateController mStatusBarStateController =
|
||||
(SysuiStatusBarStateController) Dependency.get(StatusBarStateController.class);
|
||||
|
||||
@@ -719,7 +720,6 @@ 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);
|
||||
@@ -2448,7 +2448,7 @@ public class StatusBar extends SystemUI implements DemoMode,
|
||||
mKeyguardUpdateMonitor.dump(fd, pw, args);
|
||||
}
|
||||
|
||||
Dependency.get(FalsingManager.class).dump(pw);
|
||||
mFalsingManager.dump(pw);
|
||||
FalsingLog.dump(pw);
|
||||
|
||||
pw.println("SharedPreferences:");
|
||||
|
||||
@@ -41,6 +41,7 @@ import com.android.keyguard.KeyguardUpdateMonitor;
|
||||
import com.android.systemui.SystemUIFactory;
|
||||
import com.android.systemui.SysuiTestCase;
|
||||
import com.android.systemui.doze.DozeLog;
|
||||
import com.android.systemui.classifier.FalsingManagerFake;
|
||||
import com.android.systemui.plugins.FalsingManager;
|
||||
import com.android.systemui.plugins.statusbar.StatusBarStateController;
|
||||
import com.android.systemui.shared.plugins.PluginManager;
|
||||
@@ -130,9 +131,13 @@ public class NotificationPanelViewTest extends SysuiTestCase {
|
||||
mock(HeadsUpManagerPhone.class),
|
||||
new StatusBarStateControllerImpl(),
|
||||
mKeyguardBypassController);
|
||||
PulseExpansionHandler expansionHandler = new PulseExpansionHandler(mContext, coordinator,
|
||||
PulseExpansionHandler expansionHandler = new PulseExpansionHandler(
|
||||
mContext,
|
||||
coordinator,
|
||||
mKeyguardBypassController, mHeadsUpManager,
|
||||
mock(NotificationRoundnessManager.class), mStatusBarStateController);
|
||||
mock(NotificationRoundnessManager.class),
|
||||
mStatusBarStateController,
|
||||
new FalsingManagerFake());
|
||||
mNotificationPanelView = new TestableNotificationPanelView(coordinator, expansionHandler,
|
||||
mKeyguardBypassController);
|
||||
mNotificationPanelView.setHeadsUpManager(mHeadsUpManager);
|
||||
|
||||
Reference in New Issue
Block a user