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

Commit 691b1bd3 authored by Mohammed Althaf T's avatar Mohammed Althaf T 😊
Browse files

Merge branch '1729-master-resolution' into 'master'

camera: Allow to set default resolution

See merge request !62
parents d19eee49 625fb880
Loading
Loading
Loading
Loading
Loading
+12 −1
Original line number Diff line number Diff line
@@ -10,6 +10,16 @@ android {
        targetCompatibility JavaVersion.VERSION_1_8
    }

    signingConfigs {
        // These are public keys provided by AOSP, Use different passcode protected keys for production
        debug {
            storeFile file('keys/platform.jks')
            storePassword 'platform'
            keyAlias 'platform'
            keyPassword 'platform'
        }
    }

    defaultConfig {
        applicationId "foundation.e.camera"
        minSdkVersion 25
@@ -27,7 +37,8 @@ android {

    buildTypes {
        debug {
            applicationIdSuffix ".debug"
            //applicationIdSuffix ".debug"
            signingConfig signingConfigs.debug
        }

        release {

app/keys/platform.jks

0 → 100644
+2.98 KiB

File added.

No diff preview for this file type.

+8 −2
Original line number Diff line number Diff line
@@ -7,7 +7,11 @@ import static androidx.test.espresso.matcher.ViewMatchers.isDisplayed;
import static androidx.test.espresso.matcher.ViewMatchers.withId;
import static org.hamcrest.Matchers.anyOf;
import static org.hamcrest.Matchers.endsWith;
import static org.junit.Assert.*;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;

import android.annotation.TargetApi;
import android.content.Intent;
@@ -39,6 +43,8 @@ import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.atomic.AtomicReference;

import foundation.e.camera.R;

interface PhotoTests {}

interface HDRTests {}
@@ -6168,7 +6174,7 @@ public class InstrumentedTest {

        if( !single_tap_photo && !double_tap_photo ) {
            mActivityRule.getScenario().onActivity(activity -> {
                View takePhotoButton = activity.findViewById(net.sourceforge.opencamera.R.id.take_photo);
                View takePhotoButton = activity.findViewById(R.id.take_photo);
                assertFalse( activity.hasThumbnailAnimation() );
                Log.d(TAG, "about to click take photo");
                clickView(takePhotoButton);
+41 −34
Original line number Diff line number Diff line
package net.sourceforge.opencamera;

import static org.junit.Assert.*;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;

import android.annotation.TargetApi;
import android.content.ContentUris;
@@ -23,8 +28,8 @@ import android.renderscript.Allocation;
import android.util.Log;
import android.view.View;

import androidx.annotation.RequiresApi;
import androidx.exifinterface.media.ExifInterface;
import androidx.test.filters.SdkSuppress;

import net.sourceforge.opencamera.preview.Preview;

@@ -41,6 +46,8 @@ import java.util.Date;
import java.util.List;
import java.util.Locale;

import foundation.e.camera.R;

/** Helper class for testing. This method should not include any code specific to any test framework
 *  (e.g., shouldn't be specific to ActivityInstrumentationTestCase2).
 */
@@ -356,7 +363,7 @@ public class TestUtils {
     *  We check that we have a single range of non-zero values.
     * @param bitmap The bitmap to compute and check a histogram for.
     */
    @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
    @SdkSuppress(minSdkVersion = Build.VERSION_CODES.LOLLIPOP)
    public static HistogramDetails checkHistogram(MainActivity activity, Bitmap bitmap) {
        int [] histogram = activity.getApplicationInterface().getHDRProcessor().computeHistogram(bitmap, true);
        assertEquals(256, histogram.length);
@@ -778,17 +785,17 @@ public class TestUtils {

    public static void waitForTakePhotoChecks(MainActivity activity, long time_s) {
        Preview preview = activity.getPreview();
        View switchCameraButton = activity.findViewById(net.sourceforge.opencamera.R.id.switch_camera);
        View switchMultiCameraButton = activity.findViewById(net.sourceforge.opencamera.R.id.switch_multi_camera);
        View switchVideoButton = activity.findViewById(net.sourceforge.opencamera.R.id.switch_video);
        //View flashButton = activity.findViewById(net.sourceforge.opencamera.R.id.flash);
        //View focusButton = activity.findViewById(net.sourceforge.opencamera.R.id.focus_mode);
        View exposureButton = activity.findViewById(net.sourceforge.opencamera.R.id.exposure);
        View exposureLockButton = activity.findViewById(net.sourceforge.opencamera.R.id.exposure_lock);
        View audioControlButton = activity.findViewById(net.sourceforge.opencamera.R.id.audio_control);
        View popupButton = activity.findViewById(net.sourceforge.opencamera.R.id.popup);
        View trashButton = activity.findViewById(net.sourceforge.opencamera.R.id.trash);
        View shareButton = activity.findViewById(net.sourceforge.opencamera.R.id.share);
        View switchCameraButton = activity.findViewById(R.id.switch_camera);
        View switchMultiCameraButton = activity.findViewById(R.id.switch_multi_camera);
        View switchVideoButton = activity.findViewById(R.id.switch_video);
        //View flashButton = activity.findViewById(R.id.flash);
        //View focusButton = activity.findViewById(R.id.focus_mode);
        View exposureButton = activity.findViewById(R.id.exposure);
        View exposureLockButton = activity.findViewById(R.id.exposure_lock);
        View audioControlButton = activity.findViewById(R.id.audio_control);
        View popupButton = activity.findViewById(R.id.popup);
        View trashButton = activity.findViewById(R.id.trash);
        View shareButton = activity.findViewById(R.id.share);
        SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(activity);
        boolean is_focus_bracketing = activity.supportsFocusBracketing() && sharedPreferences.getString(PreferenceKeys.PhotoModePreferenceKey, "preference_photo_mode_std").equals("preference_photo_mode_focus_bracketing");
        boolean is_panorama = activity.supportsPanorama() && sharedPreferences.getString(PreferenceKeys.PhotoModePreferenceKey, "preference_photo_mode_std").equals("preference_photo_mode_panorama");
@@ -1227,15 +1234,15 @@ public class TestUtils {
        SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(activity);
        boolean has_audio_control_button = !sharedPreferences.getString(PreferenceKeys.AudioControlPreferenceKey, "none").equals("none");

        View switchCameraButton = activity.findViewById(net.sourceforge.opencamera.R.id.switch_camera);
        View switchMultiCameraButton = activity.findViewById(net.sourceforge.opencamera.R.id.switch_multi_camera);
        View switchVideoButton = activity.findViewById(net.sourceforge.opencamera.R.id.switch_video);
        View exposureButton = activity.findViewById(net.sourceforge.opencamera.R.id.exposure);
        View exposureLockButton = activity.findViewById(net.sourceforge.opencamera.R.id.exposure_lock);
        View audioControlButton = activity.findViewById(net.sourceforge.opencamera.R.id.audio_control);
        View popupButton = activity.findViewById(net.sourceforge.opencamera.R.id.popup);
        View trashButton = activity.findViewById(net.sourceforge.opencamera.R.id.trash);
        View shareButton = activity.findViewById(net.sourceforge.opencamera.R.id.share);
        View switchCameraButton = activity.findViewById(R.id.switch_camera);
        View switchMultiCameraButton = activity.findViewById(R.id.switch_multi_camera);
        View switchVideoButton = activity.findViewById(R.id.switch_video);
        View exposureButton = activity.findViewById(R.id.exposure);
        View exposureLockButton = activity.findViewById(R.id.exposure_lock);
        View audioControlButton = activity.findViewById(R.id.audio_control);
        View popupButton = activity.findViewById(R.id.popup);
        View trashButton = activity.findViewById(R.id.trash);
        View shareButton = activity.findViewById(R.id.share);

        // trash/share only shown when preview is paused after taking a photo
        boolean pause_preview =  sharedPreferences.getBoolean(PreferenceKeys.PausePreviewPreferenceKey, false);
@@ -1296,17 +1303,17 @@ public class TestUtils {

        boolean has_audio_control_button = !sharedPreferences.getString(PreferenceKeys.AudioControlPreferenceKey, "none").equals("none");

        View switchCameraButton = activity.findViewById(net.sourceforge.opencamera.R.id.switch_camera);
        View switchMultiCameraButton = activity.findViewById(net.sourceforge.opencamera.R.id.switch_multi_camera);
        View switchVideoButton = activity.findViewById(net.sourceforge.opencamera.R.id.switch_video);
        //View flashButton = activity.findViewById(net.sourceforge.opencamera.R.id.flash);
        //View focusButton = activity.findViewById(net.sourceforge.opencamera.R.id.focus_mode);
        View exposureButton = activity.findViewById(net.sourceforge.opencamera.R.id.exposure);
        View exposureLockButton = activity.findViewById(net.sourceforge.opencamera.R.id.exposure_lock);
        View audioControlButton = activity.findViewById(net.sourceforge.opencamera.R.id.audio_control);
        View popupButton = activity.findViewById(net.sourceforge.opencamera.R.id.popup);
        View trashButton = activity.findViewById(net.sourceforge.opencamera.R.id.trash);
        View shareButton = activity.findViewById(net.sourceforge.opencamera.R.id.share);
        View switchCameraButton = activity.findViewById(R.id.switch_camera);
        View switchMultiCameraButton = activity.findViewById(R.id.switch_multi_camera);
        View switchVideoButton = activity.findViewById(R.id.switch_video);
        //View flashButton = activity.findViewById(R.id.flash);
        //View focusButton = activity.findViewById(R.id.focus_mode);
        View exposureButton = activity.findViewById(R.id.exposure);
        View exposureLockButton = activity.findViewById(R.id.exposure_lock);
        View audioControlButton = activity.findViewById(R.id.audio_control);
        View popupButton = activity.findViewById(R.id.popup);
        View trashButton = activity.findViewById(R.id.trash);
        View shareButton = activity.findViewById(R.id.share);
        assertEquals(switchCameraButton.getVisibility(), (immersive_mode ? View.GONE : (activity.getPreview().getCameraControllerManager().getNumberOfCameras() > 1 ? View.VISIBLE : View.GONE)));
        assertEquals(switchMultiCameraButton.getVisibility(), (immersive_mode ? View.GONE : (activity.showSwitchMultiCamIcon() ? View.VISIBLE : View.GONE)));
        assertEquals(switchVideoButton.getVisibility(), (immersive_mode ? View.GONE : View.VISIBLE));
+409 −413

File changed.

Preview size limit exceeded, changes collapsed.

Loading