Loading app/src/main/java/org/lineageos/recorder/screen/ScreencastService.java +14 −25 Original line number Diff line number Diff line Loading @@ -169,11 +169,6 @@ public class ScreencastService extends Service implements MediaProviderHelper.On mMediaProjectionManager = getSystemService(MediaProjectionManager.class); IntentFilter filter = new IntentFilter(); filter.addAction(Intent.ACTION_USER_BACKGROUND); filter.addAction(Intent.ACTION_SHUTDOWN); registerReceiver(mBroadcastReceiver, filter); mNotificationManager = getSystemService(NotificationManager.class); if (mNotificationManager == null || mNotificationManager.getNotificationChannel( Loading @@ -190,13 +185,6 @@ public class ScreencastService extends Service implements MediaProviderHelper.On mNotificationManager.createNotificationChannel(notificationChannel); } @Override public void onDestroy() { stopCasting(); unregisterReceiver(mBroadcastReceiver); super.onDestroy(); } @Override public void onContentWritten(@Nullable String uri) { stopForeground(true); Loading Loading @@ -229,9 +217,14 @@ public class ScreencastService extends Service implements MediaProviderHelper.On int resultCode = intent.getIntExtra(EXTRA_RESULT_CODE, Activity.RESULT_CANCELED); mUseAudio = intent.getBooleanExtra(EXTRA_USE_AUDIO, false); Intent data = intent.getParcelableExtra(EXTRA_DATA); IntentFilter filter = new IntentFilter(); filter.addAction(Intent.ACTION_USER_BACKGROUND); filter.addAction(Intent.ACTION_SHUTDOWN); if (data != null) { mMediaProjection = mMediaProjectionManager.getMediaProjection(resultCode, data); new Thread(this::startRecording).start(); startRecording(); registerReceiver(mBroadcastReceiver, filter); } return START_STICKY; } Loading Loading @@ -303,7 +296,9 @@ public class ScreencastService extends Service implements MediaProviderHelper.On mNotificationManager.notify(NOTIFICATION_ID, mBuilder.build()); } private void stopRecording() { private void stopCasting() { Utils.setStatus(getApplicationContext(), Utils.PREF_RECORDING_NOTHING); mMediaRecorder.stop(); mMediaRecorder.release(); mMediaRecorder = null; Loading @@ -311,22 +306,16 @@ public class ScreencastService extends Service implements MediaProviderHelper.On mMediaProjection = null; mInputSurface.release(); mVirtualDisplay.release(); if (mTimer != null) { mTimer.cancel(); mTimer = null; } MediaProviderHelper.addVideoToContentProvider(getContentResolver(), mPath, this); } private void stopCasting() { Utils.setStatus(getApplicationContext(), Utils.PREF_RECORDING_NOTHING); stopRecording(); if (hasNoAvailableSpace()) { Toast.makeText(this, R.string.screen_not_enough_storage, Toast.LENGTH_LONG).show(); } unregisterReceiver(mBroadcastReceiver); stopSelf(); } private NotificationCompat.Builder createNotificationBuilder() { Loading app/src/main/java/org/lineageos/recorder/utils/MediaProviderHelper.java +3 −3 Original line number Diff line number Diff line /* * Copyright (C) 2019 The LineageOS Project * Copyright (C) 2019-2020 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. Loading Loading @@ -124,12 +124,12 @@ public final class MediaProviderHelper { if (pfd == null) { return null; } final FileOutputStream oStream = new FileOutputStream(pfd.getFileDescriptor()); oStream.write(Files.readAllBytes(file.toPath())); Files.copy(file.toPath(), oStream); oStream.close(); pfd.close(); final ContentValues values = new ContentValues(); values.put(MediaStore.MediaColumns.IS_PENDING, 0); cr.update(uri, values, null, null); Loading app/src/main/res/values-af/strings.xml +0 −1 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!--Generated by crowdin.com--> <!-- Copyright (c) 2017 The LineageOS Project Licensed under the Apache License, Version 2.0 (the "License"); Loading app/src/main/res/values-ar/strings.xml +0 −1 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!--Generated by crowdin.com--> <!-- Copyright (c) 2017 The LineageOS Project Licensed under the Apache License, Version 2.0 (the "License"); Loading app/src/main/res/values-ast-rES/strings.xml +0 −1 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!--Generated by crowdin.com--> <!-- Copyright (c) 2017 The LineageOS Project Licensed under the Apache License, Version 2.0 (the "License"); Loading Loading
app/src/main/java/org/lineageos/recorder/screen/ScreencastService.java +14 −25 Original line number Diff line number Diff line Loading @@ -169,11 +169,6 @@ public class ScreencastService extends Service implements MediaProviderHelper.On mMediaProjectionManager = getSystemService(MediaProjectionManager.class); IntentFilter filter = new IntentFilter(); filter.addAction(Intent.ACTION_USER_BACKGROUND); filter.addAction(Intent.ACTION_SHUTDOWN); registerReceiver(mBroadcastReceiver, filter); mNotificationManager = getSystemService(NotificationManager.class); if (mNotificationManager == null || mNotificationManager.getNotificationChannel( Loading @@ -190,13 +185,6 @@ public class ScreencastService extends Service implements MediaProviderHelper.On mNotificationManager.createNotificationChannel(notificationChannel); } @Override public void onDestroy() { stopCasting(); unregisterReceiver(mBroadcastReceiver); super.onDestroy(); } @Override public void onContentWritten(@Nullable String uri) { stopForeground(true); Loading Loading @@ -229,9 +217,14 @@ public class ScreencastService extends Service implements MediaProviderHelper.On int resultCode = intent.getIntExtra(EXTRA_RESULT_CODE, Activity.RESULT_CANCELED); mUseAudio = intent.getBooleanExtra(EXTRA_USE_AUDIO, false); Intent data = intent.getParcelableExtra(EXTRA_DATA); IntentFilter filter = new IntentFilter(); filter.addAction(Intent.ACTION_USER_BACKGROUND); filter.addAction(Intent.ACTION_SHUTDOWN); if (data != null) { mMediaProjection = mMediaProjectionManager.getMediaProjection(resultCode, data); new Thread(this::startRecording).start(); startRecording(); registerReceiver(mBroadcastReceiver, filter); } return START_STICKY; } Loading Loading @@ -303,7 +296,9 @@ public class ScreencastService extends Service implements MediaProviderHelper.On mNotificationManager.notify(NOTIFICATION_ID, mBuilder.build()); } private void stopRecording() { private void stopCasting() { Utils.setStatus(getApplicationContext(), Utils.PREF_RECORDING_NOTHING); mMediaRecorder.stop(); mMediaRecorder.release(); mMediaRecorder = null; Loading @@ -311,22 +306,16 @@ public class ScreencastService extends Service implements MediaProviderHelper.On mMediaProjection = null; mInputSurface.release(); mVirtualDisplay.release(); if (mTimer != null) { mTimer.cancel(); mTimer = null; } MediaProviderHelper.addVideoToContentProvider(getContentResolver(), mPath, this); } private void stopCasting() { Utils.setStatus(getApplicationContext(), Utils.PREF_RECORDING_NOTHING); stopRecording(); if (hasNoAvailableSpace()) { Toast.makeText(this, R.string.screen_not_enough_storage, Toast.LENGTH_LONG).show(); } unregisterReceiver(mBroadcastReceiver); stopSelf(); } private NotificationCompat.Builder createNotificationBuilder() { Loading
app/src/main/java/org/lineageos/recorder/utils/MediaProviderHelper.java +3 −3 Original line number Diff line number Diff line /* * Copyright (C) 2019 The LineageOS Project * Copyright (C) 2019-2020 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. Loading Loading @@ -124,12 +124,12 @@ public final class MediaProviderHelper { if (pfd == null) { return null; } final FileOutputStream oStream = new FileOutputStream(pfd.getFileDescriptor()); oStream.write(Files.readAllBytes(file.toPath())); Files.copy(file.toPath(), oStream); oStream.close(); pfd.close(); final ContentValues values = new ContentValues(); values.put(MediaStore.MediaColumns.IS_PENDING, 0); cr.update(uri, values, null, null); Loading
app/src/main/res/values-af/strings.xml +0 −1 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!--Generated by crowdin.com--> <!-- Copyright (c) 2017 The LineageOS Project Licensed under the Apache License, Version 2.0 (the "License"); Loading
app/src/main/res/values-ar/strings.xml +0 −1 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!--Generated by crowdin.com--> <!-- Copyright (c) 2017 The LineageOS Project Licensed under the Apache License, Version 2.0 (the "License"); Loading
app/src/main/res/values-ast-rES/strings.xml +0 −1 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!--Generated by crowdin.com--> <!-- Copyright (c) 2017 The LineageOS Project Licensed under the Apache License, Version 2.0 (the "License"); Loading