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

Commit 215df5f3 authored by Brad Hinegardner's avatar Brad Hinegardner Committed by Android (Google) Code Review
Browse files

Merge changes I2888dd87,I3390a5ba,I957a504c into tm-qpr-dev

* changes:
  Change source of camera quick affordance launch
  Add additional Camera Launch Source to StatusBarManager to not conflict with camera double tap gesture source
  Create Camera Prebuilt quick affordance
parents 19e7d37b 69fd6af1
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -229,6 +229,8 @@ public class StatusBarManager {
    public static final int CAMERA_LAUNCH_SOURCE_POWER_DOUBLE_TAP = 1;
    /** @hide */
    public static final int CAMERA_LAUNCH_SOURCE_LIFT_TRIGGER = 2;
    /** @hide */
    public static final int CAMERA_LAUNCH_SOURCE_QUICK_AFFORDANCE = 3;

    /**
     * Session flag for {@link #registerSessionListener} indicating the listener
+2 −2
Original line number Diff line number Diff line
@@ -141,9 +141,9 @@ object Flags {
    /**
     * Whether to enable the code powering customizable lock screen quick affordances.
     *
     * Note that this flag does not enable individual implementations of quick affordances like the
     * new camera quick affordance. Look for individual flags for those.
     * This flag enables any new prebuilt quick affordances as well.
     */
    // TODO(b/255618149): Tracking Bug
    @JvmField
    val CUSTOMIZABLE_LOCK_SCREEN_QUICK_AFFORDANCES =
        unreleasedFlag(216, "customizable_lock_screen_quick_affordances", teamfood = false)
+1 −0
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ package com.android.systemui.keyguard.data.quickaffordance
 */
object BuiltInKeyguardQuickAffordanceKeys {
    // Please keep alphabetical order of const names to simplify future maintenance.
    const val CAMERA = "camera"
    const val HOME_CONTROLS = "home"
    const val QR_CODE_SCANNER = "qr_code_scanner"
    const val QUICK_ACCESS_WALLET = "wallet"
+62 −0
Original line number Diff line number Diff line
/*
 *  Copyright (C) 2022 The Android Open Source Project
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *       http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 *
 */

package com.android.systemui.keyguard.data.quickaffordance

import android.app.StatusBarManager
import android.content.Context
import com.android.systemui.R
import com.android.systemui.animation.Expandable
import com.android.systemui.camera.CameraGestureHelper
import com.android.systemui.common.shared.model.ContentDescription
import com.android.systemui.common.shared.model.Icon
import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.dagger.qualifiers.Application
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.flowOf
import javax.inject.Inject

@SysUISingleton
class CameraQuickAffordanceConfig @Inject constructor(
        @Application private val context: Context,
        private val cameraGestureHelper: CameraGestureHelper,
) : KeyguardQuickAffordanceConfig {

    override val key: String
        get() = BuiltInKeyguardQuickAffordanceKeys.CAMERA

    override val pickerName: String
        get() = context.getString(R.string.accessibility_camera_button)

    override val pickerIconResourceId: Int
        get() = com.android.internal.R.drawable.perm_group_camera

    override val lockScreenState: Flow<KeyguardQuickAffordanceConfig.LockScreenState>
        get() = flowOf(
            KeyguardQuickAffordanceConfig.LockScreenState.Visible(
                    icon = Icon.Resource(
                            com.android.internal.R.drawable.perm_group_camera,
                            ContentDescription.Resource(R.string.accessibility_camera_button)
                    )
            )
        )

    override fun onTriggered(expandable: Expandable?): KeyguardQuickAffordanceConfig.OnTriggeredResult {
        cameraGestureHelper.launchCamera(StatusBarManager.CAMERA_LAUNCH_SOURCE_QUICK_AFFORDANCE)
        return KeyguardQuickAffordanceConfig.OnTriggeredResult.Handled
    }
}
 No newline at end of file
+2 −0
Original line number Diff line number Diff line
@@ -29,8 +29,10 @@ object KeyguardDataQuickAffordanceModule {
        home: HomeControlsKeyguardQuickAffordanceConfig,
        quickAccessWallet: QuickAccessWalletKeyguardQuickAffordanceConfig,
        qrCodeScanner: QrCodeScannerKeyguardQuickAffordanceConfig,
        camera: CameraQuickAffordanceConfig,
    ): Set<KeyguardQuickAffordanceConfig> {
        return setOf(
            camera,
            home,
            quickAccessWallet,
            qrCodeScanner,
Loading