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

Commit ed4ce164 authored by Alejandro Nijamkin's avatar Alejandro Nijamkin Committed by Ale Nijamkin
Browse files

Quick affordance to open the camera in video mode.

Also updates the older, normal camera config:
1. Don't show it if there's no camera app, tests included
2. Use the camera icon and reserve the video camera icon to the new
   video camera config (done in coordination with UX)

Fix: 265316887
Test: unit tests
Test: manually made sure that the video camera shortcut works
Change-Id: Ie3551f9a79a8df98d30e0f16e931fcea82171a39
parent 2f12b731
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
<vector xmlns:android="http://schemas.android.com/apk/res/android"
    android:width="24dp"
    android:height="24dp"
    android:viewportWidth="48"
    android:viewportHeight="48"
    android:tint="?attr/colorControlNormal">
  <path
      android:fillColor="@android:color/white"
      android:pathData="M7,42Q5.8,42 4.9,41.1Q4,40.2 4,39V13.35Q4,12.15 4.9,11.25Q5.8,10.35 7,10.35H14.35L18,6H30L33.65,10.35H41Q42.2,10.35 43.1,11.25Q44,12.15 44,13.35V39Q44,40.2 43.1,41.1Q42.2,42 41,42ZM7,39H41Q41,39 41,39Q41,39 41,39V13.35Q41,13.35 41,13.35Q41,13.35 41,13.35H7Q7,13.35 7,13.35Q7,13.35 7,13.35V39Q7,39 7,39Q7,39 7,39ZM7,39Q7,39 7,39Q7,39 7,39V13.35Q7,13.35 7,13.35Q7,13.35 7,13.35Q7,13.35 7,13.35Q7,13.35 7,13.35V39Q7,39 7,39Q7,39 7,39ZM24,34.7Q27.5,34.7 30,32.225Q32.5,29.75 32.5,26.2Q32.5,22.7 30,20.2Q27.5,17.7 24,17.7Q20.45,17.7 17.975,20.2Q15.5,22.7 15.5,26.2Q15.5,29.75 17.975,32.225Q20.45,34.7 24,34.7ZM24,26.2Q24,26.2 24,26.2Q24,26.2 24,26.2Q24,26.2 24,26.2Q24,26.2 24,26.2Q24,26.2 24,26.2Q24,26.2 24,26.2Q24,26.2 24,26.2Q24,26.2 24,26.2Z"/>
</vector>
+10 −0
Original line number Diff line number Diff line
<vector xmlns:android="http://schemas.android.com/apk/res/android"
    android:width="24dp"
    android:height="24dp"
    android:viewportWidth="48"
    android:viewportHeight="48"
    android:tint="?attr/colorControlNormal">
  <path
      android:fillColor="@android:color/white"
      android:pathData="M7,40Q5.8,40 4.9,39.1Q4,38.2 4,37V11Q4,9.8 4.9,8.9Q5.8,8 7,8H33Q34.2,8 35.1,8.9Q36,9.8 36,11V21.75L44,13.75V34.25L36,26.25V37Q36,38.2 35.1,39.1Q34.2,40 33,40ZM7,37H33Q33,37 33,37Q33,37 33,37V11Q33,11 33,11Q33,11 33,11H7Q7,11 7,11Q7,11 7,11V37Q7,37 7,37Q7,37 7,37ZM7,37Q7,37 7,37Q7,37 7,37V11Q7,11 7,11Q7,11 7,11Q7,11 7,11Q7,11 7,11V37Q7,37 7,37Q7,37 7,37Z"/>
</vector>
+6 −0
Original line number Diff line number Diff line
@@ -2778,6 +2778,12 @@
    <!-- Subtitle for the notification sent when a stylus battery is low. [CHAR LIMIT=none]-->
    <string name="stylus_battery_low_subtitle">Connect your stylus to a charger</string>

    <!-- Title for notification of low stylus battery. [CHAR_LIMIT=NONE] -->
    <string name="stylus_battery_low">Stylus battery low</string>

    <!-- Label for a lock screen shortcut to start the camera in video mode. [CHAR_LIMIT=16] -->
    <string name="video_camera">Video camera</string>

    <!-- Switch to work profile dialer app for placing a call dialog. -->
    <!-- Text for Switch to work profile dialog's Title. Switch to work profile dialog guide users to make call from work
    profile dialer app as it's not possible to make call from current profile due to an admin policy. [CHAR LIMIT=60] -->
+11 −11
Original line number Diff line number Diff line
@@ -20,15 +20,13 @@ import android.content.Context
import android.content.Intent
import android.provider.MediaStore
import android.text.TextUtils

import com.android.systemui.R

class CameraIntents {
    companion object {
        val DEFAULT_SECURE_CAMERA_INTENT_ACTION =
                MediaStore.INTENT_ACTION_STILL_IMAGE_CAMERA_SECURE
        val DEFAULT_INSECURE_CAMERA_INTENT_ACTION =
                MediaStore.INTENT_ACTION_STILL_IMAGE_CAMERA
        val DEFAULT_SECURE_CAMERA_INTENT_ACTION = MediaStore.INTENT_ACTION_STILL_IMAGE_CAMERA_SECURE
        val DEFAULT_INSECURE_CAMERA_INTENT_ACTION = MediaStore.INTENT_ACTION_STILL_IMAGE_CAMERA
        private val VIDEO_CAMERA_INTENT_ACTION = MediaStore.INTENT_ACTION_VIDEO_CAMERA
        const val EXTRA_LAUNCH_SOURCE = "com.android.systemui.camera_launch_source"

        @JvmStatic
@@ -44,18 +42,14 @@ class CameraIntents {
        @JvmStatic
        fun getInsecureCameraIntent(context: Context): Intent {
            val intent = Intent(DEFAULT_INSECURE_CAMERA_INTENT_ACTION)
            getOverrideCameraPackage(context)?.let {
                intent.setPackage(it)
            }
            getOverrideCameraPackage(context)?.let { intent.setPackage(it) }
            return intent
        }

        @JvmStatic
        fun getSecureCameraIntent(context: Context): Intent {
            val intent = Intent(DEFAULT_SECURE_CAMERA_INTENT_ACTION)
            getOverrideCameraPackage(context)?.let {
                intent.setPackage(it)
            }
            getOverrideCameraPackage(context)?.let { intent.setPackage(it) }
            return intent.addFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS)
        }

@@ -68,5 +62,11 @@ class CameraIntents {
        fun isInsecureCameraIntent(intent: Intent?): Boolean {
            return intent?.getAction()?.equals(DEFAULT_INSECURE_CAMERA_INTENT_ACTION) ?: false
        }

        /** Returns an [Intent] that can be used to start the camera in video mode. */
        @JvmStatic
        fun getVideoCameraIntent(): Intent {
            return Intent(VIDEO_CAMERA_INTENT_ACTION)
        }
    }
}
+8 −1
Original line number Diff line number Diff line
@@ -21,7 +21,9 @@ import android.content.Intent
import javax.inject.Inject

/** Injectable wrapper around [CameraIntents]. */
class CameraIntentsWrapper @Inject constructor(
class CameraIntentsWrapper
@Inject
constructor(
    private val context: Context,
) {

@@ -40,4 +42,9 @@ class CameraIntentsWrapper @Inject constructor(
    fun getInsecureCameraIntent(): Intent {
        return CameraIntents.getInsecureCameraIntent(context)
    }

    /** Returns an [Intent] that can be used to start the camera in video mode. */
    fun getVideoCameraIntent(): Intent {
        return CameraIntents.getVideoCameraIntent()
    }
}
Loading