Only log NOTIF INFLATION ABORTED if we may have actually aborted something.
Bug: 236140753 Test: atest PreparationCoodinatorTest Change-Id: I60fb07e47da7bcb5e81c7a97c9fa7b73310a0335
This commit is contained in:
@@ -75,8 +75,8 @@ public class NotifInflaterImpl implements NotifInflater {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void abortInflation(NotificationEntry entry) {
|
||||
entry.abortTask();
|
||||
public boolean abortInflation(NotificationEntry entry) {
|
||||
return entry.abortTask();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -476,11 +476,13 @@ public final class NotificationEntry extends ListEntry {
|
||||
/**
|
||||
* Abort all existing inflation tasks
|
||||
*/
|
||||
public void abortTask() {
|
||||
public boolean abortTask() {
|
||||
if (mRunningTask != null) {
|
||||
mRunningTask.abort();
|
||||
mRunningTask = null;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void setInflationTask(InflationTask abortableTask) {
|
||||
|
||||
@@ -363,9 +363,11 @@ public class PreparationCoordinator implements Coordinator {
|
||||
}
|
||||
|
||||
private void abortInflation(NotificationEntry entry, String reason) {
|
||||
mLogger.logInflationAborted(entry, reason);
|
||||
mNotifInflater.abortInflation(entry);
|
||||
mInflatingNotifs.remove(entry);
|
||||
final boolean taskAborted = mNotifInflater.abortInflation(entry);
|
||||
final boolean wasInflating = mInflatingNotifs.remove(entry);
|
||||
if (taskAborted || wasInflating) {
|
||||
mLogger.logInflationAborted(entry, reason);
|
||||
}
|
||||
}
|
||||
|
||||
private void onInflationFinished(NotificationEntry entry, NotifViewController controller) {
|
||||
|
||||
@@ -42,9 +42,9 @@ interface NotifInflater {
|
||||
|
||||
/**
|
||||
* Request to stop the inflation of an entry. For example, called when a notification is
|
||||
* removed and no longer needs to be inflated.
|
||||
* removed and no longer needs to be inflated. Returns whether anything may have been aborted.
|
||||
*/
|
||||
fun abortInflation(entry: NotificationEntry)
|
||||
fun abortInflation(entry: NotificationEntry): Boolean
|
||||
|
||||
/**
|
||||
* Called to let the system remove the content views from the notification row.
|
||||
@@ -62,4 +62,4 @@ interface NotifInflater {
|
||||
* A class holding parameters used when inflating the notification row
|
||||
*/
|
||||
class Params(val isLowPriority: Boolean, val reason: String)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -463,7 +463,8 @@ public class PreparationCoordinatorTest extends SysuiTestCase {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void abortInflation(@NonNull NotificationEntry entry) {
|
||||
public boolean abortInflation(@NonNull NotificationEntry entry) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public InflationCallback getInflateCallback(NotificationEntry entry) {
|
||||
|
||||
Reference in New Issue
Block a user