Loading packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBar.java +1 −1 Original line number Diff line number Diff line Loading @@ -290,7 +290,7 @@ public class NavigationBar implements View.OnAttachStateChangeListener, @Override public boolean shouldHideOnTouch() { return !mNotificationRemoteInputManager.getController().isRemoteInputActive(); return !mNotificationRemoteInputManager.isRemoteInputActive(); } @Override Loading packages/SystemUI/src/com/android/systemui/statusbar/NotificationRemoteInputManager.java +50 −12 Original line number Diff line number Diff line Loading @@ -70,6 +70,7 @@ import java.io.FileDescriptor; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Objects; import java.util.Optional; import java.util.Set; Loading Loading @@ -136,6 +137,8 @@ public class NotificationRemoteInputManager implements Dumpable { protected Callback mCallback; protected final ArrayList<NotificationLifetimeExtender> mLifetimeExtenders = new ArrayList<>(); private final List<RemoteInputController.Callback> mControllerCallbacks = new ArrayList<>(); private final InteractionHandler mInteractionHandler = new InteractionHandler() { @Override Loading Loading @@ -332,6 +335,11 @@ public class NotificationRemoteInputManager implements Dumpable { public void setUpWithCallback(Callback callback, RemoteInputController.Delegate delegate) { mCallback = callback; mRemoteInputController = new RemoteInputController(delegate, mRemoteInputUriController); // Register all stored callbacks from before the Controller was initialized. for (RemoteInputController.Callback cb : mControllerCallbacks) { mRemoteInputController.addCallback(cb); } mControllerCallbacks.clear(); mRemoteInputController.addCallback(new RemoteInputController.Callback() { @Override public void onRemoteInputSent(NotificationEntry entry) { Loading Loading @@ -377,6 +385,22 @@ public class NotificationRemoteInputManager implements Dumpable { }); } public void addControllerCallback(RemoteInputController.Callback callback) { if (mRemoteInputController != null) { mRemoteInputController.addCallback(callback); } else { mControllerCallbacks.add(callback); } } public void removeControllerCallback(RemoteInputController.Callback callback) { if (mRemoteInputController != null) { mRemoteInputController.removeCallback(callback); } else { mControllerCallbacks.remove(callback); } } /** * Activates a given {@link RemoteInput} * Loading Loading @@ -563,17 +587,12 @@ public class NotificationRemoteInputManager implements Dumpable { return mLifetimeExtenders; } @Nullable public RemoteInputController getController() { return mRemoteInputController; } @VisibleForTesting void onPerformRemoveNotification(NotificationEntry entry, final String key) { if (mKeysKeptForRemoteInputHistory.contains(key)) { mKeysKeptForRemoteInputHistory.remove(key); } if (mRemoteInputController.isRemoteInputActive(entry)) { if (isRemoteInputActive(entry)) { entry.mRemoteEditImeVisible = false; mRemoteInputController.removeRemoteInput(entry, null); } Loading @@ -582,7 +601,9 @@ public class NotificationRemoteInputManager implements Dumpable { public void onPanelCollapsed() { for (int i = 0; i < mEntriesKeptForRemoteInputActive.size(); i++) { NotificationEntry entry = mEntriesKeptForRemoteInputActive.valueAt(i); if (mRemoteInputController != null) { mRemoteInputController.removeRemoteInput(entry, null); } if (mNotificationLifetimeFinishedCallback != null) { mNotificationLifetimeFinishedCallback.onSafeToRemove(entry.getKey()); } Loading @@ -598,8 +619,7 @@ public class NotificationRemoteInputManager implements Dumpable { if (!FORCE_REMOTE_INPUT_HISTORY) { return false; } return (mRemoteInputController.isSpinning(entry.getKey()) || entry.hasJustSentRemoteInput()); return isSpinning(entry.getKey()) || entry.hasJustSentRemoteInput(); } /** Loading Loading @@ -632,8 +652,8 @@ public class NotificationRemoteInputManager implements Dumpable { public void checkRemoteInputOutside(MotionEvent event) { if (event.getAction() == MotionEvent.ACTION_OUTSIDE // touch outside the source bar && event.getX() == 0 && event.getY() == 0 // a touch outside both bars && mRemoteInputController.isRemoteInputActive()) { mRemoteInputController.closeRemoteInputs(); && isRemoteInputActive()) { closeRemoteInputs(); } } Loading Loading @@ -715,6 +735,24 @@ public class NotificationRemoteInputManager implements Dumpable { return mEntriesKeptForRemoteInputActive; } public boolean isRemoteInputActive() { return mRemoteInputController != null && mRemoteInputController.isRemoteInputActive(); } public boolean isRemoteInputActive(NotificationEntry entry) { return mRemoteInputController != null && mRemoteInputController.isRemoteInputActive(entry); } public boolean isSpinning(String entryKey) { return mRemoteInputController != null && mRemoteInputController.isSpinning(entryKey); } public void closeRemoteInputs() { if (mRemoteInputController != null) { mRemoteInputController.closeRemoteInputs(); } } /** * NotificationRemoteInputManager has multiple reasons to keep notification lifetime extended * so we implement multiple NotificationLifetimeExtenders Loading Loading @@ -822,7 +860,7 @@ public class NotificationRemoteInputManager implements Dumpable { protected class RemoteInputActiveExtender extends RemoteInputExtender { @Override public boolean shouldExtendLifetime(@NonNull NotificationEntry entry) { return mRemoteInputController.isRemoteInputActive(entry); return isRemoteInputActive(entry); } @Override Loading packages/SystemUI/src/com/android/systemui/statusbar/RemoteInputController.java +4 −1 Original line number Diff line number Diff line Loading @@ -25,7 +25,6 @@ import android.service.notification.StatusBarNotification; import android.util.ArrayMap; import android.util.Pair; import com.android.internal.util.Preconditions; import com.android.systemui.statusbar.notification.collection.NotificationEntry; import com.android.systemui.statusbar.policy.RemoteInputUriController; import com.android.systemui.statusbar.policy.RemoteInputView; Loading Loading @@ -245,6 +244,10 @@ public class RemoteInputController { mCallbacks.add(callback); } public void removeCallback(Callback callback) { mCallbacks.remove(callback); } public void remoteInputSent(NotificationEntry entry) { int N = mCallbacks.size(); for (int i = 0; i < N; i++) { Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/coordinator/HeadsUpCoordinator.java +1 −1 Original line number Diff line number Diff line Loading @@ -149,7 +149,7 @@ public class HeadsUpCoordinator implements Coordinator { final String entryKey = entry.getKey(); if (mHeadsUpManager.isAlerting(entryKey)) { boolean removeImmediatelyForRemoteInput = mRemoteInputManager.getController().isSpinning(entryKey) mRemoteInputManager.isSpinning(entryKey) && !FORCE_REMOTE_INPUT_HISTORY; mHeadsUpManager.removeNotification(entry.getKey(), removeImmediatelyForRemoteInput); } Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/interruption/HeadsUpController.java +1 −1 Original line number Diff line number Diff line Loading @@ -152,7 +152,7 @@ public class HeadsUpController { // Also we should not defer the removal if reordering isn't allowed since otherwise // some notifications can't disappear before the panel is closed. boolean ignoreEarliestRemovalTime = mRemoteInputManager.getController().isSpinning(key) mRemoteInputManager.isSpinning(key) && !FORCE_REMOTE_INPUT_HISTORY || !mVisualStabilityManager.isReorderingAllowed(); mHeadsUpManager.removeNotification(key, ignoreEarliestRemovalTime); Loading Loading
packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBar.java +1 −1 Original line number Diff line number Diff line Loading @@ -290,7 +290,7 @@ public class NavigationBar implements View.OnAttachStateChangeListener, @Override public boolean shouldHideOnTouch() { return !mNotificationRemoteInputManager.getController().isRemoteInputActive(); return !mNotificationRemoteInputManager.isRemoteInputActive(); } @Override Loading
packages/SystemUI/src/com/android/systemui/statusbar/NotificationRemoteInputManager.java +50 −12 Original line number Diff line number Diff line Loading @@ -70,6 +70,7 @@ import java.io.FileDescriptor; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Objects; import java.util.Optional; import java.util.Set; Loading Loading @@ -136,6 +137,8 @@ public class NotificationRemoteInputManager implements Dumpable { protected Callback mCallback; protected final ArrayList<NotificationLifetimeExtender> mLifetimeExtenders = new ArrayList<>(); private final List<RemoteInputController.Callback> mControllerCallbacks = new ArrayList<>(); private final InteractionHandler mInteractionHandler = new InteractionHandler() { @Override Loading Loading @@ -332,6 +335,11 @@ public class NotificationRemoteInputManager implements Dumpable { public void setUpWithCallback(Callback callback, RemoteInputController.Delegate delegate) { mCallback = callback; mRemoteInputController = new RemoteInputController(delegate, mRemoteInputUriController); // Register all stored callbacks from before the Controller was initialized. for (RemoteInputController.Callback cb : mControllerCallbacks) { mRemoteInputController.addCallback(cb); } mControllerCallbacks.clear(); mRemoteInputController.addCallback(new RemoteInputController.Callback() { @Override public void onRemoteInputSent(NotificationEntry entry) { Loading Loading @@ -377,6 +385,22 @@ public class NotificationRemoteInputManager implements Dumpable { }); } public void addControllerCallback(RemoteInputController.Callback callback) { if (mRemoteInputController != null) { mRemoteInputController.addCallback(callback); } else { mControllerCallbacks.add(callback); } } public void removeControllerCallback(RemoteInputController.Callback callback) { if (mRemoteInputController != null) { mRemoteInputController.removeCallback(callback); } else { mControllerCallbacks.remove(callback); } } /** * Activates a given {@link RemoteInput} * Loading Loading @@ -563,17 +587,12 @@ public class NotificationRemoteInputManager implements Dumpable { return mLifetimeExtenders; } @Nullable public RemoteInputController getController() { return mRemoteInputController; } @VisibleForTesting void onPerformRemoveNotification(NotificationEntry entry, final String key) { if (mKeysKeptForRemoteInputHistory.contains(key)) { mKeysKeptForRemoteInputHistory.remove(key); } if (mRemoteInputController.isRemoteInputActive(entry)) { if (isRemoteInputActive(entry)) { entry.mRemoteEditImeVisible = false; mRemoteInputController.removeRemoteInput(entry, null); } Loading @@ -582,7 +601,9 @@ public class NotificationRemoteInputManager implements Dumpable { public void onPanelCollapsed() { for (int i = 0; i < mEntriesKeptForRemoteInputActive.size(); i++) { NotificationEntry entry = mEntriesKeptForRemoteInputActive.valueAt(i); if (mRemoteInputController != null) { mRemoteInputController.removeRemoteInput(entry, null); } if (mNotificationLifetimeFinishedCallback != null) { mNotificationLifetimeFinishedCallback.onSafeToRemove(entry.getKey()); } Loading @@ -598,8 +619,7 @@ public class NotificationRemoteInputManager implements Dumpable { if (!FORCE_REMOTE_INPUT_HISTORY) { return false; } return (mRemoteInputController.isSpinning(entry.getKey()) || entry.hasJustSentRemoteInput()); return isSpinning(entry.getKey()) || entry.hasJustSentRemoteInput(); } /** Loading Loading @@ -632,8 +652,8 @@ public class NotificationRemoteInputManager implements Dumpable { public void checkRemoteInputOutside(MotionEvent event) { if (event.getAction() == MotionEvent.ACTION_OUTSIDE // touch outside the source bar && event.getX() == 0 && event.getY() == 0 // a touch outside both bars && mRemoteInputController.isRemoteInputActive()) { mRemoteInputController.closeRemoteInputs(); && isRemoteInputActive()) { closeRemoteInputs(); } } Loading Loading @@ -715,6 +735,24 @@ public class NotificationRemoteInputManager implements Dumpable { return mEntriesKeptForRemoteInputActive; } public boolean isRemoteInputActive() { return mRemoteInputController != null && mRemoteInputController.isRemoteInputActive(); } public boolean isRemoteInputActive(NotificationEntry entry) { return mRemoteInputController != null && mRemoteInputController.isRemoteInputActive(entry); } public boolean isSpinning(String entryKey) { return mRemoteInputController != null && mRemoteInputController.isSpinning(entryKey); } public void closeRemoteInputs() { if (mRemoteInputController != null) { mRemoteInputController.closeRemoteInputs(); } } /** * NotificationRemoteInputManager has multiple reasons to keep notification lifetime extended * so we implement multiple NotificationLifetimeExtenders Loading Loading @@ -822,7 +860,7 @@ public class NotificationRemoteInputManager implements Dumpable { protected class RemoteInputActiveExtender extends RemoteInputExtender { @Override public boolean shouldExtendLifetime(@NonNull NotificationEntry entry) { return mRemoteInputController.isRemoteInputActive(entry); return isRemoteInputActive(entry); } @Override Loading
packages/SystemUI/src/com/android/systemui/statusbar/RemoteInputController.java +4 −1 Original line number Diff line number Diff line Loading @@ -25,7 +25,6 @@ import android.service.notification.StatusBarNotification; import android.util.ArrayMap; import android.util.Pair; import com.android.internal.util.Preconditions; import com.android.systemui.statusbar.notification.collection.NotificationEntry; import com.android.systemui.statusbar.policy.RemoteInputUriController; import com.android.systemui.statusbar.policy.RemoteInputView; Loading Loading @@ -245,6 +244,10 @@ public class RemoteInputController { mCallbacks.add(callback); } public void removeCallback(Callback callback) { mCallbacks.remove(callback); } public void remoteInputSent(NotificationEntry entry) { int N = mCallbacks.size(); for (int i = 0; i < N; i++) { Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/coordinator/HeadsUpCoordinator.java +1 −1 Original line number Diff line number Diff line Loading @@ -149,7 +149,7 @@ public class HeadsUpCoordinator implements Coordinator { final String entryKey = entry.getKey(); if (mHeadsUpManager.isAlerting(entryKey)) { boolean removeImmediatelyForRemoteInput = mRemoteInputManager.getController().isSpinning(entryKey) mRemoteInputManager.isSpinning(entryKey) && !FORCE_REMOTE_INPUT_HISTORY; mHeadsUpManager.removeNotification(entry.getKey(), removeImmediatelyForRemoteInput); } Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/interruption/HeadsUpController.java +1 −1 Original line number Diff line number Diff line Loading @@ -152,7 +152,7 @@ public class HeadsUpController { // Also we should not defer the removal if reordering isn't allowed since otherwise // some notifications can't disappear before the panel is closed. boolean ignoreEarliestRemovalTime = mRemoteInputManager.getController().isSpinning(key) mRemoteInputManager.isSpinning(key) && !FORCE_REMOTE_INPUT_HISTORY || !mVisualStabilityManager.isReorderingAllowed(); mHeadsUpManager.removeNotification(key, ignoreEarliestRemovalTime); Loading