Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8cc98bab authored by Stefan Andonian's avatar Stefan Andonian
Browse files

[Record Issue QS Tile] Remove Share Button Click when generating a bug report.

Bug: 375133946
Test: Verified locally that this works as intended.
Flag: EXEMPT bug fix
Change-Id: If9ee386f06be66bd4a012fd1e93973411f1a49b2
parent 081823fb
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ import android.content.res.Resources
import android.net.Uri
import android.os.Handler
import android.os.IBinder
import android.os.UserHandle
import android.util.Log
import com.android.internal.logging.UiEventLogger
import com.android.systemui.animation.DialogTransitionAnimator
@@ -34,6 +35,7 @@ import com.android.systemui.res.R
import com.android.systemui.screenrecord.RecordingController
import com.android.systemui.screenrecord.RecordingService
import com.android.systemui.screenrecord.RecordingServiceStrings
import com.android.systemui.screenrecord.ScreenMediaRecorder.SavedRecording
import com.android.systemui.settings.UserContextProvider
import com.android.systemui.statusbar.phone.KeyguardDismissUtil
import com.android.traceur.MessageConstants.INTENT_EXTRA_TRACE_TYPE
@@ -144,6 +146,18 @@ constructor(
        return super.onStartCommand(intent, flags, startId)
    }

    /**
     * If the user chooses to create a bugreport, we do not want to make them click share twice. To
     * avoid that, the code immediately triggers the bugreport flow which will handle the rest.
     */
    override fun onRecordingSaved(recording: SavedRecording?, currentUser: UserHandle) {
        if (session.takeBugReport) {
            session.share(mNotificationId, recording?.uri)
        } else {
            super.onRecordingSaved(recording, currentUser)
        }
    }

    companion object {
        private const val TAG = "IssueRecordingService"
        private const val CHANNEL_ID = "issue_record"
+10 −6
Original line number Diff line number Diff line
@@ -45,6 +45,7 @@ import com.android.systemui.dagger.qualifiers.Main;
import com.android.systemui.mediaprojection.MediaProjectionCaptureTarget;
import com.android.systemui.recordissue.ScreenRecordingStartTimeStore;
import com.android.systemui.res.R;
import com.android.systemui.screenrecord.ScreenMediaRecorder.SavedRecording;
import com.android.systemui.screenrecord.ScreenMediaRecorder.ScreenMediaRecorderListener;
import com.android.systemui.settings.UserContextProvider;
import com.android.systemui.statusbar.phone.KeyguardDismissUtil;
@@ -384,8 +385,7 @@ public class RecordingService extends Service implements ScreenMediaRecorderList
    }

    @VisibleForTesting
    protected Notification createSaveNotification(
            @Nullable ScreenMediaRecorder.SavedRecording recording) {
    protected Notification createSaveNotification(@Nullable SavedRecording recording) {
        Uri uri = recording != null ? recording.getUri() : null;
        Intent viewIntent = new Intent(Intent.ACTION_VIEW)
                .setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_GRANT_READ_URI_PERMISSION)
@@ -506,15 +506,13 @@ public class RecordingService extends Service implements ScreenMediaRecorderList
        mLongExecutor.execute(() -> {
            try {
                Log.d(getTag(), "saving recording");
                Notification notification = createSaveNotification(
                        getRecorder() != null ? getRecorder().save() : null);
                SavedRecording savedRecording = getRecorder() != null ? getRecorder().save() : null;
                postGroupSummaryNotification(
                        currentUser,
                        strings().getSaveTitle(),
                        GROUP_KEY_SAVED,
                        NOTIF_GROUP_ID_SAVED);
                mNotificationManager.notifyAsUser(null, mNotificationId,  notification,
                        currentUser);
                onRecordingSaved(savedRecording, currentUser);
            } catch (IOException | IllegalStateException e) {
                Log.e(getTag(), "Error saving screen recording: " + e.getMessage());
                e.printStackTrace();
@@ -524,6 +522,12 @@ public class RecordingService extends Service implements ScreenMediaRecorderList
        });
    }

    protected void onRecordingSaved(ScreenMediaRecorder.SavedRecording savedRecording,
            UserHandle currentUser) {
        mNotificationManager.notifyAsUser(null, mNotificationId,
                createSaveNotification(savedRecording), currentUser);
    }

    private void setTapsVisible(boolean turnOn) {
        int value = turnOn ? 1 : 0;
        Settings.System.putInt(getContentResolver(), Settings.System.SHOW_TOUCHES, value);