summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java78
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java8
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/NotificationContentView.java74
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java7
4 files changed, 81 insertions, 86 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
index 39a33a56cf84..6d4dc87283a3 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
@@ -165,6 +165,8 @@ public abstract class BaseStatusBar extends SystemUI implements
protected NotificationGroupManager mGroupManager = new NotificationGroupManager();
+ protected RemoteInputController mRemoteInputController;
+
// for heads up notifications
protected HeadsUpManager mHeadsUpManager;
@@ -1417,6 +1419,7 @@ public abstract class BaseStatusBar extends SystemUI implements
parent, false);
row.setExpansionLogger(this, entry.notification.getKey());
row.setGroupManager(mGroupManager);
+ row.setRemoteInputController(mRemoteInputController);
row.setOnExpandClickListener(this);
}
@@ -1587,7 +1590,6 @@ public abstract class BaseStatusBar extends SystemUI implements
}
row.setUserLocked(userLocked);
row.onNotificationUpdated(entry);
- applyRemoteInput(entry);
return true;
}
@@ -1630,78 +1632,6 @@ public abstract class BaseStatusBar extends SystemUI implements
}
}
- private void applyRemoteInput(final Entry entry) {
- if (!ENABLE_REMOTE_INPUT) return;
-
- boolean hasRemoteInput = false;
-
- Notification.Action[] actions = entry.notification.getNotification().actions;
- if (actions != null) {
- for (Notification.Action a : actions) {
- if (a.getRemoteInputs() != null) {
- for (RemoteInput ri : a.getRemoteInputs()) {
- if (ri.getAllowFreeFormInput()) {
- hasRemoteInput = true;
- break;
- }
- }
- }
- }
- }
-
- View bigContentView = entry.getExpandedContentView();
- if (bigContentView != null) {
- applyRemoteInput(bigContentView, entry, hasRemoteInput);
- }
- View headsUpContentView = entry.getHeadsUpContentView();
- if (headsUpContentView != null) {
- applyRemoteInput(headsUpContentView, entry, hasRemoteInput);
- }
-
- }
-
- private RemoteInputView applyRemoteInput(View view, Entry entry, boolean hasRemoteInput) {
- View actionContainerCandidate = view.findViewById(
- com.android.internal.R.id.actions_container);
- if (actionContainerCandidate instanceof FrameLayout) {
- RemoteInputView existing = (RemoteInputView)
- view.findViewWithTag(RemoteInputView.VIEW_TAG);
-
- if (hasRemoteInput) {
- if (existing != null) {
- existing.onNotificationUpdate();
- return existing;
- }
-
- ViewGroup actionContainer = (FrameLayout) actionContainerCandidate;
- RemoteInputView riv = inflateRemoteInputView(actionContainer, entry);
- if (riv != null) {
- riv.setVisibility(View.INVISIBLE);
- actionContainer.addView(riv, new FrameLayout.LayoutParams(
- ViewGroup.LayoutParams.MATCH_PARENT,
- ViewGroup.LayoutParams.MATCH_PARENT)
- );
- int color = entry.notification.getNotification().color;
- if (color == Notification.COLOR_DEFAULT) {
- color = mContext.getColor(R.color.default_remote_input_background);
- }
- riv.setBackgroundColor(color);
- return riv;
- }
- } else {
- if (existing != null) {
- existing.onNotificationUpdate();
- return null;
- }
- }
- }
- return null;
- }
-
- protected RemoteInputView inflateRemoteInputView(ViewGroup root, Entry entry) {
- return null;
- }
-
public void startPendingIntentDismissingKeyguard(final PendingIntent intent) {
if (!isDeviceProvisioned()) return;
@@ -2230,8 +2160,6 @@ public abstract class BaseStatusBar extends SystemUI implements
entry.row.onNotificationUpdated(entry);
entry.row.resetHeight();
-
- applyRemoteInput(entry);
}
protected void notifyHeadsUpScreenOff() {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java
index ed4c7742a01d..874b76aaf2bd 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java
@@ -199,8 +199,8 @@ public class ExpandableNotificationRow extends ActivatableNotificationView {
public void onNotificationUpdated(NotificationData.Entry entry) {
mEntry = entry;
mStatusBarNotification = entry.notification;
- mPrivateLayout.onNotificationUpdated(entry.notification);
- mPublicLayout.onNotificationUpdated(entry.notification);
+ mPrivateLayout.onNotificationUpdated(entry);
+ mPublicLayout.onNotificationUpdated(entry);
updateVetoButton();
if (mIsSummaryWithChildren) {
recreateNotificationHeader();
@@ -254,6 +254,10 @@ public class ExpandableNotificationRow extends ActivatableNotificationView {
mPrivateLayout.setGroupManager(groupManager);
}
+ public void setRemoteInputController(RemoteInputController r) {
+ mPrivateLayout.setRemoteInputController(r);
+ }
+
public void addChildNotification(ExpandableNotificationRow row) {
addChildNotification(row, -1);
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationContentView.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationContentView.java
index 2944c4f46d5e..6d90329ae833 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationContentView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationContentView.java
@@ -16,6 +16,8 @@
package com.android.systemui.statusbar;
+import android.app.Notification;
+import android.app.RemoteInput;
import android.content.Context;
import android.graphics.Outline;
import android.graphics.Paint;
@@ -37,6 +39,7 @@ import com.android.systemui.R;
import com.android.systemui.statusbar.notification.HybridNotificationView;
import com.android.systemui.statusbar.notification.HybridNotificationViewManager;
import com.android.systemui.statusbar.phone.NotificationGroupManager;
+import com.android.systemui.statusbar.policy.RemoteInputView;
/**
* A frame layout containing the actual payload of the notification, including the contracted,
@@ -79,6 +82,7 @@ public class NotificationContentView extends FrameLayout {
private int mHeadsUpHeight;
private StatusBarNotification mStatusBarNotification;
private NotificationGroupManager mGroupManager;
+ private RemoteInputController mRemoteInputController;
private final ViewTreeObserver.OnPreDrawListener mEnableAnimationPredrawListener
= new ViewTreeObserver.OnPreDrawListener() {
@@ -484,9 +488,10 @@ public class NotificationContentView extends FrameLayout {
updateSingleLineView();
}
- public void onNotificationUpdated(StatusBarNotification statusBarNotification) {
- mStatusBarNotification = statusBarNotification;
+ public void onNotificationUpdated(NotificationData.Entry entry) {
+ mStatusBarNotification = entry.notification;
updateSingleLineView();
+ applyRemoteInput(entry);
selectLayout(false /* animate */, true /* force */);
if (mContractedChild != null) {
mContractedWrapper.notifyContentUpdated();
@@ -508,10 +513,75 @@ public class NotificationContentView extends FrameLayout {
}
}
+ private void applyRemoteInput(final NotificationData.Entry entry) {
+ if (mRemoteInputController == null) {
+ return;
+ }
+
+ boolean hasRemoteInput = false;
+
+ Notification.Action[] actions = entry.notification.getNotification().actions;
+ if (actions != null) {
+ for (Notification.Action a : actions) {
+ if (a.getRemoteInputs() != null) {
+ for (RemoteInput ri : a.getRemoteInputs()) {
+ if (ri.getAllowFreeFormInput()) {
+ hasRemoteInput = true;
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ View bigContentView = mExpandedChild;
+ if (bigContentView != null) {
+ applyRemoteInput(bigContentView, entry, hasRemoteInput);
+ }
+ View headsUpContentView = mHeadsUpChild;
+ if (headsUpContentView != null) {
+ applyRemoteInput(headsUpContentView, entry, hasRemoteInput);
+ }
+ }
+
+ private void applyRemoteInput(View view, NotificationData.Entry entry, boolean hasRemoteInput) {
+ View actionContainerCandidate = view.findViewById(
+ com.android.internal.R.id.actions_container);
+ if (actionContainerCandidate instanceof FrameLayout) {
+ RemoteInputView existing = (RemoteInputView)
+ view.findViewWithTag(RemoteInputView.VIEW_TAG);
+
+ if (existing != null) {
+ existing.onNotificationUpdate();
+ }
+
+ if (existing == null && hasRemoteInput) {
+ ViewGroup actionContainer = (FrameLayout) actionContainerCandidate;
+ RemoteInputView riv = RemoteInputView.inflate(
+ mContext, actionContainer, entry, mRemoteInputController);
+
+ riv.setVisibility(View.INVISIBLE);
+ actionContainer.addView(riv, new LayoutParams(
+ ViewGroup.LayoutParams.MATCH_PARENT,
+ ViewGroup.LayoutParams.MATCH_PARENT)
+ );
+ int color = entry.notification.getNotification().color;
+ if (color == Notification.COLOR_DEFAULT) {
+ color = mContext.getColor(R.color.default_remote_input_background);
+ }
+ riv.setBackgroundColor(color);
+ }
+ }
+ }
+
public void setGroupManager(NotificationGroupManager groupManager) {
mGroupManager = groupManager;
}
+ public void setRemoteInputController(RemoteInputController r) {
+ mRemoteInputController = r;
+ }
+
public void setExpandClickListener(OnClickListener expandClickListener) {
mExpandClickListener = expandClickListener;
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
index 8f7c95e1b9af..80fcba60e895 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
@@ -311,8 +311,6 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
StatusBarIconController mIconController;
- private RemoteInputController mRemoteInputController;
-
// expanded notifications
NotificationPanelView mNotificationPanel; // the sliding/resizing panel within the notification window
View mExpandedContents;
@@ -1100,11 +1098,6 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
return mStatusBarWindow;
}
- @Override
- protected RemoteInputView inflateRemoteInputView(ViewGroup root, Entry entry) {
- return RemoteInputView.inflate(mContext, root, entry, mRemoteInputController);
- }
-
public int getStatusBarHeight() {
if (mNaturalBarHeight < 0) {
final Resources res = mContext.getResources();