Merge "Provide more information to the assistant"
This commit is contained in:
committed by
Android (Google) Code Review
commit
28306600e6
@@ -37,6 +37,7 @@ import android.view.accessibility.AccessibilityManager;
|
||||
|
||||
import com.android.internal.logging.MetricsLogger;
|
||||
import com.android.internal.logging.nano.MetricsProto;
|
||||
import com.android.internal.statusbar.IStatusBarService;
|
||||
import com.android.systemui.Dependency;
|
||||
import com.android.systemui.Dumpable;
|
||||
import com.android.systemui.Interpolators;
|
||||
@@ -75,17 +76,20 @@ public class NotificationGutsManager implements Dumpable {
|
||||
private NotificationGuts mNotificationGutsExposed;
|
||||
private NotificationMenuRowPlugin.MenuItem mGutsMenuItem;
|
||||
private final NotificationInfo.CheckSaveListener mCheckSaveListener;
|
||||
private final OnSettingsClickListener mOnSettingsClickListener;
|
||||
private String mKeyToRemoveOnGutsClosed;
|
||||
|
||||
public NotificationGutsManager(
|
||||
NotificationPresenter presenter,
|
||||
NotificationStackScrollLayout stackScroller,
|
||||
NotificationInfo.CheckSaveListener checkSaveListener,
|
||||
Context context) {
|
||||
Context context,
|
||||
OnSettingsClickListener onSettingsClickListener) {
|
||||
mPresenter = presenter;
|
||||
mStackScroller = stackScroller;
|
||||
mCheckSaveListener = checkSaveListener;
|
||||
mContext = context;
|
||||
mOnSettingsClickListener = onSettingsClickListener;
|
||||
Resources res = context.getResources();
|
||||
|
||||
mNonBlockablePkgs = new HashSet<>();
|
||||
@@ -189,6 +193,7 @@ public class NotificationGutsManager implements Dumpable {
|
||||
onSettingsClick = (View v, NotificationChannel channel, int appUid) -> {
|
||||
mMetricsLogger.action(MetricsProto.MetricsEvent.ACTION_NOTE_INFO);
|
||||
guts.resetFalsingCheck();
|
||||
mOnSettingsClickListener.onClick(sbn.getKey());
|
||||
startAppNotificationSettingsActivity(pkg, appUid, channel);
|
||||
};
|
||||
}
|
||||
@@ -352,4 +357,8 @@ public class NotificationGutsManager implements Dumpable {
|
||||
pw.print("mKeyToRemoveOnGutsClosed: ");
|
||||
pw.println(mKeyToRemoveOnGutsClosed);
|
||||
}
|
||||
|
||||
public interface OnSettingsClickListener {
|
||||
void onClick(String key);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,6 +43,7 @@ import android.app.ActivityManager;
|
||||
import android.app.ActivityOptions;
|
||||
import android.app.KeyguardManager;
|
||||
import android.app.Notification;
|
||||
import android.app.NotificationChannel;
|
||||
import android.app.NotificationManager;
|
||||
import android.app.PendingIntent;
|
||||
import android.app.RemoteInput;
|
||||
@@ -919,7 +920,14 @@ public class StatusBar extends SystemUI implements DemoMode,
|
||||
mNotificationPanel = mStatusBarWindow.findViewById(R.id.notification_panel);
|
||||
mStackScroller = mStatusBarWindow.findViewById(R.id.notification_stack_scroller);
|
||||
mGutsManager = new NotificationGutsManager(this, mStackScroller,
|
||||
mCheckSaveListener, mContext);
|
||||
mCheckSaveListener, mContext,
|
||||
key -> {
|
||||
try {
|
||||
mBarService.onNotificationSettingsViewed(key);
|
||||
} catch (RemoteException e) {
|
||||
// if we're here we're dead
|
||||
}
|
||||
});
|
||||
mNotificationPanel.setStatusBar(this);
|
||||
mNotificationPanel.setGroupManager(mGroupManager);
|
||||
mAboveShelfObserver = new AboveShelfObserver(mStackScroller);
|
||||
@@ -1470,6 +1478,11 @@ public class StatusBar extends SystemUI implements DemoMode,
|
||||
}
|
||||
}, REMOTE_INPUT_KEPT_ENTRY_AUTO_CANCEL_DELAY);
|
||||
}
|
||||
try {
|
||||
mBarService.onNotificationDirectReplied(entry.key);
|
||||
} catch (RemoteException e) {
|
||||
// system process is dead if we're here.
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1785,9 +1798,14 @@ public class StatusBar extends SystemUI implements DemoMode,
|
||||
final int id = n.getId();
|
||||
final int userId = n.getUserId();
|
||||
try {
|
||||
// TODO: record actual dismissal surface
|
||||
int dismissalSurface = NotificationStats.DISMISSAL_SHADE;
|
||||
if (isHeadsUp(n.getKey())) {
|
||||
dismissalSurface = NotificationStats.DISMISSAL_PEEK;
|
||||
} else if (mStackScroller.hasPulsingNotifications()) {
|
||||
dismissalSurface = NotificationStats.DISMISSAL_AOD;
|
||||
}
|
||||
mBarService.onNotificationClear(pkg, tag, id, userId, n.getKey(),
|
||||
NotificationStats.DISMISSAL_OTHER);
|
||||
dismissalSurface);
|
||||
if (FORCE_REMOTE_INPUT_HISTORY
|
||||
&& mKeysKeptForRemoteInput.contains(n.getKey())) {
|
||||
mKeysKeptForRemoteInput.remove(n.getKey());
|
||||
|
||||
@@ -771,7 +771,7 @@ public class NotificationManagerService extends SystemService {
|
||||
.setType(expanded ? MetricsEvent.TYPE_DETAIL
|
||||
: MetricsEvent.TYPE_COLLAPSE));
|
||||
}
|
||||
if (expanded) {
|
||||
if (expanded && userAction) {
|
||||
r.recordExpanded();
|
||||
}
|
||||
EventLogTags.writeNotificationExpansion(key,
|
||||
|
||||
@@ -1872,8 +1872,8 @@ public class NotificationManagerServiceTest extends NotificationTestCase {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStats_updatedOnExpansion() throws Exception {
|
||||
final NotificationRecord r = generateNotificationRecord(mTestNotificationChannel);
|
||||
public void testStats_updatedOnUserExpansion() throws Exception {
|
||||
NotificationRecord r = generateNotificationRecord(mTestNotificationChannel);
|
||||
mService.addNotification(r);
|
||||
|
||||
mService.mNotificationDelegate.onNotificationExpansionChanged(r.getKey(), true, true);
|
||||
@@ -1882,6 +1882,17 @@ public class NotificationManagerServiceTest extends NotificationTestCase {
|
||||
assertTrue(mService.getNotificationRecord(r.getKey()).getStats().hasExpanded());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStats_notUpdatedOnAutoExpansion() throws Exception {
|
||||
NotificationRecord r = generateNotificationRecord(mTestNotificationChannel);
|
||||
mService.addNotification(r);
|
||||
|
||||
mService.mNotificationDelegate.onNotificationExpansionChanged(r.getKey(), false, true);
|
||||
assertFalse(mService.getNotificationRecord(r.getKey()).getStats().hasExpanded());
|
||||
mService.mNotificationDelegate.onNotificationExpansionChanged(r.getKey(), false, false);
|
||||
assertFalse(mService.getNotificationRecord(r.getKey()).getStats().hasExpanded());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStats_updatedOnViewSettings() throws Exception {
|
||||
final NotificationRecord r = generateNotificationRecord(mTestNotificationChannel);
|
||||
|
||||
Reference in New Issue
Block a user