Loading packages/SystemUI/plugin/src/com/android/systemui/plugins/FalsingManager.java +5 −2 Original line number Diff line number Diff line Loading @@ -25,6 +25,7 @@ import com.android.systemui.plugins.annotations.ProvidesInterface; import java.io.PrintWriter; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.util.List; /** * Interface that decides whether a touch on the phone was accidental. i.e. Pocket Dialing. Loading Loading @@ -135,8 +136,10 @@ public interface FalsingManager { * Don't call this. It's meant for internal use to allow switching between implementations. * * Tests may also call it. * * @return existing listeners so they may be reattached **/ void cleanupInternal(); List<FalsingBeliefListener> cleanupInternal(); /** Call to report a ProximityEvent to the FalsingManager. */ void onProximityEvent(ProximityEvent proximityEvent); Loading packages/SystemUI/src/com/android/keyguard/KeyguardPinBasedInputViewController.java +5 −1 Original line number Diff line number Diff line Loading @@ -47,7 +47,7 @@ import com.android.systemui.user.domain.interactor.SelectedUserInteractor; public abstract class KeyguardPinBasedInputViewController<T extends KeyguardPinBasedInputView> extends KeyguardAbsKeyInputViewController<T> implements InputManager.InputDeviceListener { private final FalsingCollector mFalsingCollector; private FalsingCollector mFalsingCollector = null; private final KeyguardKeyboardInteractor mKeyguardKeyboardInteractor; protected PasswordTextView mPasswordEntry; private Boolean mShowAnimations; Loading @@ -65,6 +65,9 @@ public abstract class KeyguardPinBasedInputViewController<T extends KeyguardPinB private final OnTouchListener mActionButtonTouchListener = (v, event) -> { if (event.getActionMasked() == MotionEvent.ACTION_DOWN) { if (mFalsingCollector != null) { mFalsingCollector.avoidGesture(); } mView.doHapticKeyClick(); } return false; Loading Loading @@ -171,6 +174,7 @@ public abstract class KeyguardPinBasedInputViewController<T extends KeyguardPinB if (mBouncerHapticPlayer.isEnabled()) { deleteButton.setOnTouchListener((View view, MotionEvent event) -> { if (event.getActionMasked() == MotionEvent.ACTION_DOWN) { mFalsingCollector.avoidGesture(); mBouncerHapticPlayer.playDeleteKeyPressFeedback(); } return false; Loading packages/SystemUI/src/com/android/systemui/classifier/BrightLineFalsingManager.java +4 −1 Original line number Diff line number Diff line Loading @@ -496,13 +496,16 @@ public class BrightLineFalsingManager implements FalsingManager { } @Override public void cleanupInternal() { public List<FalsingBeliefListener> cleanupInternal() { List<FalsingBeliefListener> existingBeliefListeners = new ArrayList<>(mFalsingBeliefListeners); mDestroyed = true; mDataProvider.removeSessionListener(mSessionListener); mDataProvider.removeGestureCompleteListener(mGestureFinalizedListener); mClassifiers.forEach(FalsingClassifier::cleanup); mFalsingBeliefListeners.clear(); mHistoryTracker.removeBeliefListener(mBeliefListener); return existingBeliefListeners; } private static Collection<FalsingClassifier.Result> getPassedResult(double confidence) { Loading packages/SystemUI/src/com/android/systemui/classifier/FalsingManagerProxy.java +21 −10 Original line number Diff line number Diff line Loading @@ -33,6 +33,8 @@ import com.android.systemui.plugins.PluginManager; import com.android.systemui.util.DeviceConfigProxy; import java.io.PrintWriter; import java.util.ArrayList; import java.util.List; import java.util.concurrent.Executor; import javax.inject.Inject; Loading Loading @@ -77,10 +79,7 @@ public class FalsingManagerProxy implements FalsingManager, Dumpable { mPluginListener = new PluginListener<FalsingPlugin>() { public void onPluginConnected(FalsingPlugin plugin, Context context) { FalsingManager pluginFalsingManager = plugin.getFalsingManager(context); if (pluginFalsingManager != null) { mInternalFalsingManager.cleanupInternal(); mInternalFalsingManager = pluginFalsingManager; } cleanupAndReattachListeners(mInternalFalsingManager, pluginFalsingManager); } public void onPluginDisconnected(FalsingPlugin plugin) { Loading @@ -107,10 +106,8 @@ public class FalsingManagerProxy implements FalsingManager, Dumpable { * If multiple implementations are available, this is where the choice is made. */ private void setupFalsingManager() { if (mInternalFalsingManager != null) { mInternalFalsingManager.cleanupInternal(); } mInternalFalsingManager = mBrightLineFalsingManagerProvider.get(); cleanupAndReattachListeners(mInternalFalsingManager, mBrightLineFalsingManagerProvider.get()); } @Override Loading Loading @@ -204,10 +201,24 @@ public class FalsingManagerProxy implements FalsingManager, Dumpable { } @Override public void cleanupInternal() { public List<FalsingBeliefListener> cleanupInternal() { mDeviceConfig.removeOnPropertiesChangedListener(mDeviceConfigListener); mPluginManager.removePluginListener(mPluginListener); mDumpManager.unregisterDumpable(DUMPABLE_TAG); mInternalFalsingManager.cleanupInternal(); return mInternalFalsingManager.cleanupInternal(); } private void cleanupAndReattachListeners(FalsingManager old, FalsingManager current) { List<FalsingBeliefListener> beliefListeners = new ArrayList<>(); if (old != null) { beliefListeners = old.cleanupInternal(); } if (current == null) return; for (FalsingBeliefListener listener : beliefListeners) { current.addFalsingBeliefListener(listener); } mInternalFalsingManager = current; } } packages/SystemUI/tests/utils/src/com/android/systemui/classifier/FalsingManagerFake.java +2 −1 Original line number Diff line number Diff line Loading @@ -164,8 +164,9 @@ public class FalsingManagerFake implements FalsingManager { } @Override public void cleanupInternal() { public List<FalsingBeliefListener> cleanupInternal() { mDestroyed = true; return new ArrayList<FalsingBeliefListener>(); } private void checkDestroyed() { Loading Loading
packages/SystemUI/plugin/src/com/android/systemui/plugins/FalsingManager.java +5 −2 Original line number Diff line number Diff line Loading @@ -25,6 +25,7 @@ import com.android.systemui.plugins.annotations.ProvidesInterface; import java.io.PrintWriter; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.util.List; /** * Interface that decides whether a touch on the phone was accidental. i.e. Pocket Dialing. Loading Loading @@ -135,8 +136,10 @@ public interface FalsingManager { * Don't call this. It's meant for internal use to allow switching between implementations. * * Tests may also call it. * * @return existing listeners so they may be reattached **/ void cleanupInternal(); List<FalsingBeliefListener> cleanupInternal(); /** Call to report a ProximityEvent to the FalsingManager. */ void onProximityEvent(ProximityEvent proximityEvent); Loading
packages/SystemUI/src/com/android/keyguard/KeyguardPinBasedInputViewController.java +5 −1 Original line number Diff line number Diff line Loading @@ -47,7 +47,7 @@ import com.android.systemui.user.domain.interactor.SelectedUserInteractor; public abstract class KeyguardPinBasedInputViewController<T extends KeyguardPinBasedInputView> extends KeyguardAbsKeyInputViewController<T> implements InputManager.InputDeviceListener { private final FalsingCollector mFalsingCollector; private FalsingCollector mFalsingCollector = null; private final KeyguardKeyboardInteractor mKeyguardKeyboardInteractor; protected PasswordTextView mPasswordEntry; private Boolean mShowAnimations; Loading @@ -65,6 +65,9 @@ public abstract class KeyguardPinBasedInputViewController<T extends KeyguardPinB private final OnTouchListener mActionButtonTouchListener = (v, event) -> { if (event.getActionMasked() == MotionEvent.ACTION_DOWN) { if (mFalsingCollector != null) { mFalsingCollector.avoidGesture(); } mView.doHapticKeyClick(); } return false; Loading Loading @@ -171,6 +174,7 @@ public abstract class KeyguardPinBasedInputViewController<T extends KeyguardPinB if (mBouncerHapticPlayer.isEnabled()) { deleteButton.setOnTouchListener((View view, MotionEvent event) -> { if (event.getActionMasked() == MotionEvent.ACTION_DOWN) { mFalsingCollector.avoidGesture(); mBouncerHapticPlayer.playDeleteKeyPressFeedback(); } return false; Loading
packages/SystemUI/src/com/android/systemui/classifier/BrightLineFalsingManager.java +4 −1 Original line number Diff line number Diff line Loading @@ -496,13 +496,16 @@ public class BrightLineFalsingManager implements FalsingManager { } @Override public void cleanupInternal() { public List<FalsingBeliefListener> cleanupInternal() { List<FalsingBeliefListener> existingBeliefListeners = new ArrayList<>(mFalsingBeliefListeners); mDestroyed = true; mDataProvider.removeSessionListener(mSessionListener); mDataProvider.removeGestureCompleteListener(mGestureFinalizedListener); mClassifiers.forEach(FalsingClassifier::cleanup); mFalsingBeliefListeners.clear(); mHistoryTracker.removeBeliefListener(mBeliefListener); return existingBeliefListeners; } private static Collection<FalsingClassifier.Result> getPassedResult(double confidence) { Loading
packages/SystemUI/src/com/android/systemui/classifier/FalsingManagerProxy.java +21 −10 Original line number Diff line number Diff line Loading @@ -33,6 +33,8 @@ import com.android.systemui.plugins.PluginManager; import com.android.systemui.util.DeviceConfigProxy; import java.io.PrintWriter; import java.util.ArrayList; import java.util.List; import java.util.concurrent.Executor; import javax.inject.Inject; Loading Loading @@ -77,10 +79,7 @@ public class FalsingManagerProxy implements FalsingManager, Dumpable { mPluginListener = new PluginListener<FalsingPlugin>() { public void onPluginConnected(FalsingPlugin plugin, Context context) { FalsingManager pluginFalsingManager = plugin.getFalsingManager(context); if (pluginFalsingManager != null) { mInternalFalsingManager.cleanupInternal(); mInternalFalsingManager = pluginFalsingManager; } cleanupAndReattachListeners(mInternalFalsingManager, pluginFalsingManager); } public void onPluginDisconnected(FalsingPlugin plugin) { Loading @@ -107,10 +106,8 @@ public class FalsingManagerProxy implements FalsingManager, Dumpable { * If multiple implementations are available, this is where the choice is made. */ private void setupFalsingManager() { if (mInternalFalsingManager != null) { mInternalFalsingManager.cleanupInternal(); } mInternalFalsingManager = mBrightLineFalsingManagerProvider.get(); cleanupAndReattachListeners(mInternalFalsingManager, mBrightLineFalsingManagerProvider.get()); } @Override Loading Loading @@ -204,10 +201,24 @@ public class FalsingManagerProxy implements FalsingManager, Dumpable { } @Override public void cleanupInternal() { public List<FalsingBeliefListener> cleanupInternal() { mDeviceConfig.removeOnPropertiesChangedListener(mDeviceConfigListener); mPluginManager.removePluginListener(mPluginListener); mDumpManager.unregisterDumpable(DUMPABLE_TAG); mInternalFalsingManager.cleanupInternal(); return mInternalFalsingManager.cleanupInternal(); } private void cleanupAndReattachListeners(FalsingManager old, FalsingManager current) { List<FalsingBeliefListener> beliefListeners = new ArrayList<>(); if (old != null) { beliefListeners = old.cleanupInternal(); } if (current == null) return; for (FalsingBeliefListener listener : beliefListeners) { current.addFalsingBeliefListener(listener); } mInternalFalsingManager = current; } }
packages/SystemUI/tests/utils/src/com/android/systemui/classifier/FalsingManagerFake.java +2 −1 Original line number Diff line number Diff line Loading @@ -164,8 +164,9 @@ public class FalsingManagerFake implements FalsingManager { } @Override public void cleanupInternal() { public List<FalsingBeliefListener> cleanupInternal() { mDestroyed = true; return new ArrayList<FalsingBeliefListener>(); } private void checkDestroyed() { Loading