From 19a0292230947269991da4be0707039d0a708396 Mon Sep 17 00:00:00 2001 From: Faye Yan Date: Fri, 26 Jan 2024 04:23:30 +0000 Subject: [PATCH] Revert "Fix the op mode dependency for the second toggle:" This reverts commit 78f99c6a67079eda69b6eb569ad39f16bf3717eb. Reason for revert: The Fedhot team cancel the egress data permission Change-Id: I57c2fad0450f5f5ad36a5ff8a39ed42603b09d49 --- .../spa/app/specialaccess/VoiceActivationApps.kt | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/com/android/settings/spa/app/specialaccess/VoiceActivationApps.kt b/src/com/android/settings/spa/app/specialaccess/VoiceActivationApps.kt index aafe49382db..a7f971418cd 100644 --- a/src/com/android/settings/spa/app/specialaccess/VoiceActivationApps.kt +++ b/src/com/android/settings/spa/app/specialaccess/VoiceActivationApps.kt @@ -56,12 +56,9 @@ class VoiceActivationAppsListModel(context: Context) : AppOpPermissionListModel( override val appOp = AppOpsManager.OP_RECEIVE_SANDBOX_TRIGGER_AUDIO override val permission = Manifest.permission.RECEIVE_SANDBOX_TRIGGER_AUDIO override val setModeByUid = true - private var receiveDetectionTrainingDataOpController:AppOpsController? = null + override fun setAllowed(record: AppOpPermissionRecord, newAllowed: Boolean) { super.setAllowed(record, newAllowed) - if (!newAllowed && receiveDetectionTrainingDataOpController != null) { - receiveDetectionTrainingDataOpController!!.setAllowed(false) - } logPermissionChange(newAllowed) } @@ -82,21 +79,20 @@ class VoiceActivationAppsListModel(context: Context) : AppOpPermissionListModel( isReceiveSandBoxTriggerAudioOpAllowed: () -> Boolean? ): ReceiveDetectionTrainingDataOpSwitchModel { val context = LocalContext.current - receiveDetectionTrainingDataOpController = remember { + val ReceiveDetectionTrainingDataOpController = remember { AppOpsController( context = context, app = record.app, op = AppOpsManager.OP_RECEIVE_SANDBOXED_DETECTION_TRAINING_DATA, ) } - val isReceiveDetectionTrainingDataOpAllowed = isReceiveDetectionTrainingDataOpAllowed(record, receiveDetectionTrainingDataOpController!!) - + val isReceiveDetectionTrainingDataOpAllowed = isReceiveDetectionTrainingDataOpAllowed(record, ReceiveDetectionTrainingDataOpController) return remember(record) { ReceiveDetectionTrainingDataOpSwitchModel( context, record, isReceiveSandBoxTriggerAudioOpAllowed, - receiveDetectionTrainingDataOpController!!, + ReceiveDetectionTrainingDataOpController, isReceiveDetectionTrainingDataOpAllowed, ) }.also { model -> LaunchedEffect(model, Dispatchers.Default) { model.initState() } }