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

Commit fb0c5cd0 authored by Miranda Kephart's avatar Miranda Kephart Committed by Automerger Merge Worker
Browse files

Merge "Catch failure to set screenshot sound" into tm-qpr-dev am: 077eafba am: 8a23d05e

parents 6eb42182 8a23d05e
Loading
Loading
Loading
Loading
+14 −8
Original line number Diff line number Diff line
@@ -843,14 +843,20 @@ public class ScreenshotController {
        // The media player creation is slow and needs on the background thread.
        return CallbackToFutureAdapter.getFuture((completer) -> {
            mBgExecutor.execute(() -> {
                try {
                    MediaPlayer player = MediaPlayer.create(mContext,
                            Uri.fromFile(new File(mContext.getResources().getString(
                                com.android.internal.R.string.config_cameraShutterSound))), null,
                                    com.android.internal.R.string.config_cameraShutterSound))),
                            null,
                            new AudioAttributes.Builder()
                                    .setUsage(AudioAttributes.USAGE_ASSISTANCE_SONIFICATION)
                                    .setContentType(AudioAttributes.CONTENT_TYPE_SONIFICATION)
                                    .build(), AudioSystem.newAudioSessionId());
                    completer.set(player);
                } catch (IllegalStateException e) {
                    Log.w(TAG, "Screenshot sound initialization failed", e);
                    completer.set(null);
                }
            });
            return "ScreenshotController#loadCameraSound";
        });