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

Commit 3094a671 authored by Mark Harman's avatar Mark Harman
Browse files

Remove old unused renderscript code/support.

parent 35255455
Loading
Loading
Loading
Loading
+0 −6
Original line number Diff line number Diff line
@@ -10,11 +10,6 @@ android {
        targetSdkVersion 35
        //compileSdkVersion 31 // needed to support appcompat:1.4.0 (which we need for emoji policy support, and not yet ready to target SDK 30)

        renderscriptTargetApi 21
        //renderscriptSupportModeEnabled true // don't use support library as it bloats the APK, and we don't need pre-4.4 support
        // need build tools at least 20 at least to support ScriptIntrinsicHistogram
        // also need build tools at least 21 to avoid Google Play 64-bit warning (required from 1 August 2019)

        testApplicationId "net.sourceforge.opencamera.test"
        //testInstrumentationRunner "android.test.InstrumentationTestRunner"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
@@ -38,7 +33,6 @@ android {
    }
    namespace 'net.sourceforge.opencamera'
    buildFeatures {
        renderScript true
    }
    //useLibrary 'android.test.mock'
}
+74 −1435

File changed.

Preview size limit exceeded, changes collapsed.

+2 −3
Original line number Diff line number Diff line
@@ -965,8 +965,7 @@ public class ImageSaver extends Thread {
        if( MyDebug.LOG )
            Log.d(TAG, "addRequest, cost: " + cost);
        if( main_activity.isDestroyed() ) {
            // If the application is being destroyed as a new photo is being taken, it's not safe to continue, e.g., we'll
            // crash if needing to use RenderScript.
            // If the application is being destroyed as a new photo is being taken, it's not safe to continue
            // MainDestroy.onDestroy() does call waitUntilDone(), but this is extra protection in case an image comes in after that.
            Log.e(TAG, "application is destroyed, image lost!");
            return;
@@ -1811,7 +1810,7 @@ public class ImageSaver extends Thread {
                Collections.reverse(request.gyro_rotation_matrix);
            }

            // need all to be mutable for use_renderscript==false - n.b., in practice setting to -1
            // need all to be mutable - n.b., in practice setting to -1
            // doesn't cause a problem on some devices e.g. Galaxy S24+ because the bitmaps may be made
            // mutable in rotateForExif, but this can be reproduced on on emulator at least
            List<Bitmap> bitmaps = loadBitmaps(request.jpeg_images, -2, 1);
+0 −13
Original line number Diff line number Diff line
@@ -70,7 +70,6 @@ import android.content.SharedPreferences;
import android.content.pm.ActivityInfo;
import android.content.pm.PackageManager;
import android.content.res.Configuration;
import android.renderscript.RenderScript;
import android.speech.tts.TextToSpeech;

import androidx.activity.OnBackPressedCallback;
@@ -1288,24 +1287,12 @@ public class MainActivity extends AppCompatActivity implements PreferenceFragmen
        // we don't do this in onPause or onStop, due to risk of ANRs
        // note that even if we did call this earlier in onPause or onStop, we'd still want to wait again here: as it can happen
        // that a new image appears after onPause/onStop is called, in which case we want to wait until images are saved,
        // otherwise we can have crash if we need Renderscript after calling releaseAllContexts(), or because rs has been set to
        // null from beneath applicationInterface.onDestroy()
        waitUntilImageQueueEmpty();

        preview.onDestroy();
        if( applicationInterface != null ) {
            applicationInterface.onDestroy();
        }
        if( Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && activity_count == 0 ) {
            // See note in HDRProcessor.onDestroy() - but from Android M, renderscript contexts are released with releaseAllContexts()
            // doc for releaseAllContexts() says "If no contexts have been created this function does nothing"
            // Important to only do so if no other activities are running (see activity_count). Otherwise risk
            // of crashes if one activity is destroyed when another instance is still using Renderscript. I've
            // been unable to reproduce this, though such RSInvalidStateException crashes from Google Play.
            if( MyDebug.LOG )
                Log.d(TAG, "release renderscript contexts");
            RenderScript.releaseAllContexts();
        }
        // Need to recycle to avoid out of memory when running tests - probably good practice to do anyway
        for(Map.Entry<Integer, Bitmap> entry : preloaded_bitmap_resources.entrySet()) {
            if( MyDebug.LOG )
+11 −730

File changed.

Preview size limit exceeded, changes collapsed.

Loading