Merge "Fix incorrect flush reason logged" into udc-dev
This commit is contained in:
@@ -175,6 +175,8 @@ public abstract class ContentCaptureSession implements AutoCloseable {
|
|||||||
public static final int FLUSH_REASON_TEXT_CHANGE_TIMEOUT = 6;
|
public static final int FLUSH_REASON_TEXT_CHANGE_TIMEOUT = 6;
|
||||||
/** @hide */
|
/** @hide */
|
||||||
public static final int FLUSH_REASON_SESSION_CONNECTED = 7;
|
public static final int FLUSH_REASON_SESSION_CONNECTED = 7;
|
||||||
|
/** @hide */
|
||||||
|
public static final int FLUSH_REASON_FORCE_FLUSH = 8;
|
||||||
|
|
||||||
@ChangeId
|
@ChangeId
|
||||||
@EnabledSince(targetSdkVersion = UPSIDE_DOWN_CAKE)
|
@EnabledSince(targetSdkVersion = UPSIDE_DOWN_CAKE)
|
||||||
@@ -188,7 +190,8 @@ public abstract class ContentCaptureSession implements AutoCloseable {
|
|||||||
FLUSH_REASON_SESSION_FINISHED,
|
FLUSH_REASON_SESSION_FINISHED,
|
||||||
FLUSH_REASON_IDLE_TIMEOUT,
|
FLUSH_REASON_IDLE_TIMEOUT,
|
||||||
FLUSH_REASON_TEXT_CHANGE_TIMEOUT,
|
FLUSH_REASON_TEXT_CHANGE_TIMEOUT,
|
||||||
FLUSH_REASON_SESSION_CONNECTED
|
FLUSH_REASON_SESSION_CONNECTED,
|
||||||
|
FLUSH_REASON_FORCE_FLUSH
|
||||||
})
|
})
|
||||||
@Retention(RetentionPolicy.SOURCE)
|
@Retention(RetentionPolicy.SOURCE)
|
||||||
public @interface FlushReason{}
|
public @interface FlushReason{}
|
||||||
@@ -666,6 +669,8 @@ public abstract class ContentCaptureSession implements AutoCloseable {
|
|||||||
return "TEXT_CHANGE";
|
return "TEXT_CHANGE";
|
||||||
case FLUSH_REASON_SESSION_CONNECTED:
|
case FLUSH_REASON_SESSION_CONNECTED:
|
||||||
return "CONNECTED";
|
return "CONNECTED";
|
||||||
|
case FLUSH_REASON_FORCE_FLUSH:
|
||||||
|
return "FORCE_FLUSH";
|
||||||
default:
|
default:
|
||||||
return "UNKOWN-" + reason;
|
return "UNKOWN-" + reason;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -459,7 +459,7 @@ public final class MainContentCaptureSession extends ContentCaptureSession {
|
|||||||
flushReason = FLUSH_REASON_SESSION_FINISHED;
|
flushReason = FLUSH_REASON_SESSION_FINISHED;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
flushReason = FLUSH_REASON_FULL;
|
flushReason = forceFlush ? FLUSH_REASON_FORCE_FLUSH : FLUSH_REASON_FULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
flush(flushReason);
|
flush(flushReason);
|
||||||
@@ -555,8 +555,13 @@ public final class MainContentCaptureSession extends ContentCaptureSession {
|
|||||||
|
|
||||||
final int numberEvents = mEvents.size();
|
final int numberEvents = mEvents.size();
|
||||||
final String reasonString = getFlushReasonAsString(reason);
|
final String reasonString = getFlushReasonAsString(reason);
|
||||||
|
|
||||||
if (sDebug) {
|
if (sDebug) {
|
||||||
Log.d(TAG, "Flushing " + numberEvents + " event(s) for " + getDebugState(reason));
|
ContentCaptureEvent event = mEvents.get(numberEvents - 1);
|
||||||
|
String forceString = (reason == FLUSH_REASON_FORCE_FLUSH) ? ". The force flush event "
|
||||||
|
+ ContentCaptureEvent.getTypeAsString(event.getType()) : "";
|
||||||
|
Log.d(TAG, "Flushing " + numberEvents + " event(s) for " + getDebugState(reason)
|
||||||
|
+ forceString);
|
||||||
}
|
}
|
||||||
if (mFlushHistory != null) {
|
if (mFlushHistory != null) {
|
||||||
// Logs reason, size, max size, idle timeout
|
// Logs reason, size, max size, idle timeout
|
||||||
|
|||||||
Reference in New Issue
Block a user