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

Commit 9a59507d authored by Nishith  Khanna's avatar Nishith Khanna
Browse files

Merge branch '2381-master-rebase' into 'main'

Camera: update to 1.53.1

See merge request !80
parents a6673ade 1ef790d3
Loading
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -14,6 +14,7 @@ _saved/

build/
app/release/
app/version.properties
gfx/
testdata/

.gitlab-ci.yml

0 → 100644
+77 −0
Original line number Diff line number Diff line
image: "registry.gitlab.e.foundation/e/os/docker-android-apps-cicd:latest"

stages:
  - update-from-upstream
  - build

before_script:
  - apt update && apt-get install libncurses5 -y
  - export GRADLE_USER_HOME=$(pwd)/.gradle
  - chmod +x ./gradlew

cache:
  key: ${CI_PROJECT_ID}
  paths:
    - .gradle/

build:
  stage: build
  script:
    - ./gradlew build -x test
  artifacts:
    paths:
      - app/build/outputs/apk

.update-from-upstream:
  image: registry.gitlab.e.foundation/e/tools/docker-tools:latest
  stage: update-from-upstream
  rules:
    - if: '$CI_PIPELINE_SOURCE == "schedule" && $CI_COMMIT_REF_NAME == $LOCAL_BRANCH'
  variables:
    CI_PROJECT_SSH_URL: git@gitlab.e.foundation:$CI_PROJECT_PATH
    GIT_STRATEGY: none
  before_script:
    - 'command -v ssh-agent >/dev/null || ( apt-get update -y && apt-get install openssh-client -y )'
    - eval $(ssh-agent -s)
    - echo "${SSH_E_ROBOT_PRIVATE_KEY}" | tr -d '\r' | ssh-add -
    - mkdir -p ~/.ssh
    - chmod 700 ~/.ssh
    - echo "${SSH_KNOWN_HOSTS}" > ~/.ssh/known_hosts
    - echo "${SSH_KNOWN_HOSTS}"
    - chmod 644 ~/.ssh/known_hosts
    - git config --global user.email $GITLAB_USER_EMAIL
    - git config --global user.name "$GITLAB_USER_NAME"
    - cd $CI_BUILD_DIR
    - rm -rf $CI_PROJECT_DIR
    - git clone $CI_PROJECT_SSH_URL $CI_PROJECT_DIR
    - cd $CI_PROJECT_DIR
  script:
    - git config http.sslverify false
    # update $UPSTREAM_BRANCH & tags
    - git fetch origin
    - git checkout $UPSTREAM_BRANCH
    - git remote add upstream $UPSTREAM_URL
    - git fetch upstream
    - git pull upstream $UPSTREAM_DEFAULT_BRANCH
    - git push origin $UPSTREAM_BRANCH
    - git push origin --tags
    # checkout to latest tag commit to $TEMP_LATEST_TAG_BRANCH
    - git checkout $(git describe --tags --abbrev=0)
    - git checkout -b $TEMP_LATEST_TAG_BRANCH
    # merge $LOCAL_BRANCH with $TEMP_LATEST_TAG_BRANCH & push
    - git checkout $LOCAL_BRANCH
    - git merge $TEMP_LATEST_TAG_BRANCH
    - git push origin $LOCAL_BRANCH
    # remove unwanted local branch & remote
    - git branch -D $TEMP_LATEST_TAG_BRANCH
    - git remote remove upstream

update-default-branch:
  extends: .update-from-upstream
  variables:
    LOCAL_BRANCH: master
    UPSTREAM_BRANCH: upstream/master
    UPSTREAM_DEFAULT_BRANCH: master
    UPSTREAM_URL: https://git.code.sf.net/p/opencamera/code
    TEMP_LATEST_TAG_BRANCH: latest_upstream_tag_branch
  allow_failure: true
+85 −3
Original line number Diff line number Diff line
apply plugin: 'com.android.application'
apply plugin: 'org.jetbrains.kotlin.android'

android {
    compileSdk 34
    compileOptions.encoding = 'UTF-8'

    def versionPropsFile = file('version.properties')
    Properties versionProps = new Properties()

    if (!versionPropsFile.exists()) {
        versionProps['VERSION_CHANGE'] = '0'
        versionProps['VERSION_MAJOR'] = '1'
        versionProps['VERSION_MINOR'] = '53'
        versionProps['VERSION_PATCH'] = '1'
        versionProps['VERSION_CODE'] = '90'
        versionProps.store(versionPropsFile.newWriter(), null)
    }

    def getVersionCode = { ->
        if (versionPropsFile.canRead()) {
            versionProps.load(new FileInputStream(versionPropsFile))
            def versionChange = versionProps['VERSION_CHANGE'].toInteger() + 1
            def versionMinor = versionProps['VERSION_MINOR'].toInteger()
            def versionMajor = versionProps['VERSION_MAJOR'].toInteger()
            def versionPatch = versionProps['VERSION_PATCH'].toInteger()
            // Up version on each 100 cycles of builds
            if (versionChange >= 100) {
                versionPatch = versionProps['VERSION_PATCH'].toInteger() + 1
                versionChange = 0
            }
            if (versionPatch == 9) {
                versionMinor = versionProps['VERSION_MINOR'].toInteger() + 1
                versionPatch = 0
            }
            if (versionMinor == 9) {
                versionMajor = versionProps['VERSION_MAJOR'].toInteger() + 1
                versionMinor = 0
            }
            def versionCode = versionProps['VERSION_CODE'].toInteger()

            versionProps['VERSION_CHANGE'] = versionChange.toString()
            versionProps['VERSION_PATCH'] = versionPatch.toString()
            versionProps['VERSION_MINOR'] = versionMinor.toString()
            versionProps['VERSION_MAJOR'] = versionMajor.toString()
            versionProps['VERSION_CODE'] = (versionCode.toInteger() + 1).toString()
            versionProps.store(versionPropsFile.newWriter(), null)
            return versionCode
        }
    }

    def getVersionName = { ->
        if (versionPropsFile.canRead()) {
            versionProps.load(new FileInputStream(versionPropsFile))

            def versionMajor = versionProps['VERSION_MAJOR']
            def versionMinor = versionProps['VERSION_MINOR']
            def versionPatch = versionProps['VERSION_PATCH']

            return "${versionMajor}.${versionMinor}.${versionPatch}"
        }
    }

    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 "net.sourceforge.opencamera"
        minSdkVersion 15
        applicationId "foundation.e.camera"
        minSdkVersion 26
        targetSdkVersion 34
        //compileSdkVersion 31 // needed to support appcompat:1.4.0 (which we need for emoji policy support, and not yet ready to target SDK 30)

        versionCode getVersionCode()
        versionName getVersionName()

        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
@@ -25,8 +95,11 @@ android {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }

        debug {
            signingConfig signingConfigs.debug
        }
    }

    // needed to use android.test package (ActivityInstrumentationTestCase2 etc) when targetting sdk 28 (Android 9) -
    // see https://developer.android.com/training/testing/set-up-project
@@ -39,20 +112,29 @@ android {
    namespace 'net.sourceforge.opencamera'
    buildFeatures {
        renderScript true
        buildConfig true
    }
    //useLibrary 'android.test.mock'
}

dependencies {
    androidTestImplementation 'androidx.test.ext:junit:1.1.5'
    implementation 'androidx.core:core-ktx:1.8.0'

    // appcompat version must be 1.4.0 or later to satisfy emoji policy!
    implementation 'androidx.appcompat:appcompat:1.6.1'

    implementation "org.greenrobot:eventbus:3.3.1"

    implementation 'foundation.e:elib:0.0.1-alpha11'

    implementation 'androidx.legacy:legacy-support-v4:1.0.0'

    implementation 'androidx.exifinterface:exifinterface:1.3.7'

    implementation 'androidx.camera:camera-core:1.2.3'
    implementation 'com.google.zxing:core:3.5.2'

    testImplementation 'junit:junit:4.13.2'

    // newer AndroidJUnit4 InstrumentedTest

app/keys/platform.jks

0 → 100644
+2.98 KiB

File added.

No diff preview for this file type.

+21 −5
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@
        android:maxSdkVersion="28"
        tools:ignore="ScopedStorage" />
    <uses-permission android:name="android.permission.CAMERA" />
    <uses-permission android:name="android.permission.SYSTEM_CAMERA" />
    <uses-permission android:name="android.permission.RECORD_AUDIO" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
@@ -38,11 +39,14 @@
        android:name=".OpenCameraApplication"
        android:theme="@style/AppTheme"
        android:largeHeap="true"
        android:hardwareAccelerated="true"
        android:requestLegacyExternalStorage="true"
        >
        <!-- should not change the android:name, including moving to a subpackage - see http://android-developers.blogspot.co.uk/2011/06/things-that-cannot-change.html -->
        <activity
            android:name="net.sourceforge.opencamera.MainActivity"
            android:configChanges="orientation|screenSize|keyboardHidden"
            android:launchMode="singleInstance"
            android:clearTaskOnLaunch="true"
            android:exported="true"
            >
@@ -89,13 +93,25 @@
        <activity
            android:name="TakePhoto"
            android:label="@string/take_photo"
            android:icon="@drawable/ic_launcher_take_photo"
            android:icon="@mipmap/ic_launcher"
            android:configChanges="orientation|screenSize|keyboardHidden"
            android:taskAffinity=""
            android:excludeFromRecents="true"
            android:exported="false"
            >
        </activity>

        <activity
            android:name="net.sourceforge.opencamera.qr.QrScannerActivity"
            android:configChanges="orientation|screenLayout|screenSize|smallestScreenSize|keyboardHidden"
            android:exported="true"
            android:excludeFromRecents="true"
            android:launchMode="singleInstance"
            android:screenOrientation="nosensor"
            android:visibleToInstantApps="true"
            android:windowSoftInputMode="stateAlwaysHidden|adjustPan">
        </activity>

        <!-- should not change the android:name, including moving to a subpackage - see http://android-developers.blogspot.co.uk/2011/06/things-that-cannot-change.html -->
        <receiver
            android:icon="@mipmap/ic_launcher"
@@ -114,7 +130,7 @@
        </receiver> 
        <!-- should not change the android:name, including moving to a subpackage - see http://android-developers.blogspot.co.uk/2011/06/things-that-cannot-change.html -->
        <receiver
            android:icon="@drawable/ic_launcher_take_photo"
            android:icon="@mipmap/ic_launcher"
            android:label="@string/take_photo"
            android:name="MyWidgetProviderTakePhoto"
            android:exported="true">
@@ -128,7 +144,7 @@
        <!-- should not change the android:name, including moving to a subpackage - see http://android-developers.blogspot.co.uk/2011/06/things-that-cannot-change.html -->
        <service
            android:name="net.sourceforge.opencamera.MyTileService"
            android:icon="@drawable/ic_photo_camera_white_48dp"
            android:icon="@drawable/ic_switch_camera"
            android:label="@string/camera"
            android:permission="android.permission.BIND_QUICK_SETTINGS_TILE"
            android:exported="true">
@@ -139,7 +155,7 @@
        <!-- should not change the android:name, including moving to a subpackage - see http://android-developers.blogspot.co.uk/2011/06/things-that-cannot-change.html -->
        <service
            android:name="net.sourceforge.opencamera.MyTileServiceVideo"
            android:icon="@drawable/ic_videocam_white_48dp"
            android:icon="@drawable/ic_switch_video"
            android:label="@string/record_video"
            android:permission="android.permission.BIND_QUICK_SETTINGS_TILE"
            android:exported="true">
@@ -150,7 +166,7 @@
        <!-- should not change the android:name, including moving to a subpackage - see http://android-developers.blogspot.co.uk/2011/06/things-that-cannot-change.html -->
        <service
            android:name="net.sourceforge.opencamera.MyTileServiceFrontCamera"
            android:icon="@drawable/ic_face_white_48dp"
            android:icon="@drawable/ic_face"
            android:label="@string/selfie"
            android:permission="android.permission.BIND_QUICK_SETTINGS_TILE"
            android:exported="true">
Loading