Loading packages/SystemUI/src/com/android/systemui/recordissue/IssueRecordingService.kt +13 −1 Original line number Diff line number Diff line Loading @@ -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 Loading Loading @@ -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 -> { Loading Loading @@ -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. Loading services/core/java/com/android/server/tracing/TracingServiceProxy.java +16 −1 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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; Loading @@ -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 */) { 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 Loading Loading
packages/SystemUI/src/com/android/systemui/recordissue/IssueRecordingService.kt +13 −1 Original line number Diff line number Diff line Loading @@ -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 Loading Loading @@ -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 -> { Loading Loading @@ -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. Loading
services/core/java/com/android/server/tracing/TracingServiceProxy.java +16 −1 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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; Loading @@ -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 */) { 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 Loading