summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--packages/SystemUI/src/com/android/systemui/recordissue/IssueRecordingService.kt14
-rw-r--r--services/core/java/com/android/server/tracing/TracingServiceProxy.java17
2 files changed, 29 insertions, 2 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/recordissue/IssueRecordingService.kt b/packages/SystemUI/src/com/android/systemui/recordissue/IssueRecordingService.kt
index 863a899b6f4c..3d6d00eb3cc0 100644
--- a/packages/SystemUI/src/com/android/systemui/recordissue/IssueRecordingService.kt
+++ b/packages/SystemUI/src/com/android/systemui/recordissue/IssueRecordingService.kt
@@ -24,6 +24,7 @@ import android.content.res.Resources
import android.net.Uri
import android.os.Handler
import android.os.UserHandle
+import android.provider.Settings
import android.util.Log
import com.android.internal.logging.UiEventLogger
import com.android.systemui.animation.DialogTransitionAnimator
@@ -90,7 +91,16 @@ constructor(
// ViewCapture needs to save it's data before it is disabled, or else the data will
// be lost. This is expected to change in the near future, and when that happens
// this line should be removed.
- bgExecutor.execute { traceurMessageSender.stopTracing() }
+ bgExecutor.execute {
+ if (issueRecordingState.traceConfig.longTrace) {
+ Settings.Global.putInt(
+ contentResolver,
+ NOTIFY_SESSION_ENDED_SETTING,
+ DISABLED
+ )
+ }
+ traceurMessageSender.stopTracing()
+ }
issueRecordingState.isRecording = false
}
ACTION_SHARE -> {
@@ -125,6 +135,8 @@ constructor(
companion object {
private const val TAG = "IssueRecordingService"
private const val CHANNEL_ID = "issue_record"
+ private const val NOTIFY_SESSION_ENDED_SETTING = "should_notify_trace_session_ended"
+ private const val DISABLED = 0
/**
* Get an intent to stop the issue recording service.
diff --git a/services/core/java/com/android/server/tracing/TracingServiceProxy.java b/services/core/java/com/android/server/tracing/TracingServiceProxy.java
index 480db25ec606..8e24e9f8a4c0 100644
--- a/services/core/java/com/android/server/tracing/TracingServiceProxy.java
+++ b/services/core/java/com/android/server/tracing/TracingServiceProxy.java
@@ -38,6 +38,7 @@ import android.os.ParcelFileDescriptor;
import android.os.ParcelFileDescriptor.AutoCloseInputStream;
import android.os.ParcelFileDescriptor.AutoCloseOutputStream;
import android.os.UserHandle;
+import android.provider.Settings;
import android.service.tracing.TraceReportService;
import android.tracing.ITracingServiceProxy;
import android.tracing.TraceReportParams;
@@ -87,6 +88,8 @@ public class TracingServiceProxy extends SystemService {
TRACING_SERVICE_REPORT_EVENT__EVENT__TRACING_SERVICE_REPORT_SVC_PERM_MISSING;
private static final int REPORT_SVC_COMM_ERROR =
TRACING_SERVICE_REPORT_EVENT__EVENT__TRACING_SERVICE_REPORT_SVC_COMM_ERROR;
+ private static final String NOTIFY_SESSION_ENDED_SETTING = "should_notify_trace_session_ended";
+ private static final int ENABLED = 1;
private final Context mContext;
private final PackageManager mPackageManager;
@@ -97,10 +100,22 @@ public class TracingServiceProxy extends SystemService {
/**
* Notifies system tracing app that a tracing session has ended. sessionStolen is ignored,
* as trace sessions are no longer stolen and are always cloned instead.
+ * <p>
+ * Cases exist where user-flows besides Traceur's QS Tile may end long-trace sessions. In
+ * these cases, a Global int will be set to flag the upcoming notifyTraceSessionEnded call
+ * as purposely muted once.
*/
@Override
public void notifyTraceSessionEnded(boolean sessionStolen /* unused */) {
- TracingServiceProxy.this.notifyTraceur();
+ long identity = Binder.clearCallingIdentity();
+ if (Settings.Global.getInt(mContext.getContentResolver(),
+ NOTIFY_SESSION_ENDED_SETTING, ENABLED) == ENABLED) {
+ TracingServiceProxy.this.notifyTraceur();
+ } else {
+ Settings.Global.putInt(mContext.getContentResolver(), NOTIFY_SESSION_ENDED_SETTING,
+ ENABLED);
+ }
+ Binder.restoreCallingIdentity(identity);
}
@Override