Revert "Add Voice activation apps into Settings->Apps->Special a..."
Revert submission 25108596-va-special-access Reason for revert: voice activation is not going in V Reverted changes: /q/submissionid:25108596-va-special-access Bug: 306447565 Bug: 393727896 Test: presubmit Change-Id: I4977e7d543cb800fc9fb6962bba3afebb9480dcc
This commit is contained in:
@@ -38,7 +38,6 @@ import com.android.settings.spa.app.specialaccess.MediaManagementAppsAppListProv
|
||||
import com.android.settings.spa.app.specialaccess.ModifySystemSettingsAppListProvider
|
||||
import com.android.settings.spa.app.specialaccess.NfcTagAppsSettingsProvider
|
||||
import com.android.settings.spa.app.specialaccess.PictureInPictureListProvider
|
||||
import com.android.settings.spa.app.specialaccess.VoiceActivationAppsListProvider
|
||||
import com.android.settings.spa.app.specialaccess.WifiControlAppListProvider
|
||||
import com.android.settings.wifi.ChangeWifiStateDetails
|
||||
|
||||
@@ -67,8 +66,6 @@ object SettingsActivityUtil {
|
||||
WifiControlAppListProvider.getAppInfoRoutePrefix(),
|
||||
NfcTagAppsSettingsProvider::class.qualifiedName to
|
||||
NfcTagAppsSettingsProvider.getAppInfoRoutePrefix(),
|
||||
VoiceActivationAppsListProvider::class.qualifiedName to
|
||||
VoiceActivationAppsListProvider.getAppInfoRoutePrefix(),
|
||||
BackupTasksAppsListProvider::class.qualifiedName to
|
||||
BackupTasksAppsListProvider.getAppInfoRoutePrefix(),
|
||||
)
|
||||
|
||||
@@ -41,7 +41,6 @@ import com.android.settings.spa.app.specialaccess.PictureInPictureListProvider
|
||||
import com.android.settings.spa.app.specialaccess.SpecialAppAccessPageProvider
|
||||
import com.android.settings.spa.app.specialaccess.TurnScreenOnAppsAppListProvider
|
||||
import com.android.settings.spa.app.specialaccess.UseFullScreenIntentAppListProvider
|
||||
import com.android.settings.spa.app.specialaccess.VoiceActivationAppsListProvider
|
||||
import com.android.settings.spa.app.specialaccess.WifiControlAppListProvider
|
||||
import com.android.settings.spa.app.storage.StorageAppListPageProvider
|
||||
import com.android.settings.spa.core.instrumentation.SpaLogProvider
|
||||
@@ -76,7 +75,6 @@ open class SettingsSpaEnvironment(context: Context) : SpaEnvironment(context) {
|
||||
PictureInPictureListProvider,
|
||||
InstallUnknownAppsListProvider,
|
||||
AlarmsAndRemindersAppListProvider,
|
||||
VoiceActivationAppsListProvider,
|
||||
WifiControlAppListProvider,
|
||||
NfcTagAppsSettingsProvider,
|
||||
LongBackgroundTasksAppListProvider,
|
||||
|
||||
@@ -67,7 +67,6 @@ object SpecialAppAccessPageProvider : SettingsPageProvider {
|
||||
PictureInPictureListProvider,
|
||||
InstallUnknownAppsListProvider,
|
||||
AlarmsAndRemindersAppListProvider,
|
||||
VoiceActivationAppsListProvider,
|
||||
WifiControlAppListProvider,
|
||||
LongBackgroundTasksAppListProvider,
|
||||
TurnScreenOnAppsAppListProvider,
|
||||
|
||||
@@ -1,67 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2023 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.settings.spa.app.specialaccess
|
||||
|
||||
import android.Manifest
|
||||
import android.app.AppOpsManager
|
||||
import android.app.settings.SettingsEnums
|
||||
import android.content.Context
|
||||
import com.android.settings.R
|
||||
import com.android.settings.overlay.FeatureFactory
|
||||
import com.android.settingslib.spaprivileged.model.app.PackageManagers.hasGrantPermission
|
||||
import com.android.settingslib.spaprivileged.template.app.AppOpPermissionListModel
|
||||
import com.android.settingslib.spaprivileged.template.app.AppOpPermissionRecord
|
||||
import com.android.settingslib.spaprivileged.template.app.TogglePermissionAppListProvider
|
||||
|
||||
/**
|
||||
* This class builds an App List under voice activation apps and the individual page which
|
||||
* allows the user to toggle voice activation related permissions on / off for the apps displayed
|
||||
* in the list.
|
||||
*/
|
||||
object VoiceActivationAppsListProvider : TogglePermissionAppListProvider {
|
||||
override val permissionType = "VoiceActivationApps"
|
||||
override fun createModel(context: Context) = VoiceActivationAppsListModel(context)
|
||||
}
|
||||
|
||||
class VoiceActivationAppsListModel(context: Context) : AppOpPermissionListModel(context) {
|
||||
override val pageTitleResId = R.string.voice_activation_apps_title
|
||||
override val switchTitleResId = R.string.permit_voice_activation_apps
|
||||
override val footerResId = R.string.allow_voice_activation_apps_description
|
||||
override val appOp = AppOpsManager.OP_RECEIVE_SANDBOX_TRIGGER_AUDIO
|
||||
override val permission = Manifest.permission.RECEIVE_SANDBOX_TRIGGER_AUDIO
|
||||
override val setModeByUid = true
|
||||
|
||||
override fun setAllowed(record: AppOpPermissionRecord, newAllowed: Boolean) {
|
||||
super.setAllowed(record, newAllowed)
|
||||
logPermissionChange(newAllowed)
|
||||
}
|
||||
|
||||
override fun isChangeable(record: AppOpPermissionRecord): Boolean =
|
||||
super.isChangeable(record) && record.app.hasGrantPermission(permission)
|
||||
|
||||
private fun logPermissionChange(newAllowed: Boolean) {
|
||||
val category = when {
|
||||
newAllowed -> SettingsEnums.APP_SPECIAL_PERMISSION_RECEIVE_SANDBOX_TRIGGER_AUDIO_ALLOW
|
||||
else -> SettingsEnums.APP_SPECIAL_PERMISSION_RECEIVE_SANDBOX_TRIGGER_AUDIO_DENY
|
||||
}
|
||||
/**
|
||||
* Leave the package string empty as we should not log the package names for the collected
|
||||
* metrics.
|
||||
*/
|
||||
FeatureFactory.featureFactory.metricsFeatureProvider.action(context, category, "")
|
||||
}
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2023 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.settings.spa.app.specialaccess
|
||||
|
||||
import android.content.Context
|
||||
import androidx.preference.Preference
|
||||
import com.android.settings.core.BasePreferenceController
|
||||
import com.android.settings.flags.Flags
|
||||
import com.android.settings.spa.SpaActivity.Companion.startSpaActivity
|
||||
|
||||
class VoiceActivationAppsPreferenceController(context: Context, preferenceKey: String) :
|
||||
BasePreferenceController(context, preferenceKey) {
|
||||
override fun getAvailabilityStatus() =
|
||||
if (Flags.enableVoiceActivationAppsInSettings()) AVAILABLE
|
||||
else CONDITIONALLY_UNAVAILABLE
|
||||
|
||||
override fun handlePreferenceTreeClick(preference: Preference): Boolean {
|
||||
if (preference.key == mPreferenceKey) {
|
||||
mContext.startSpaActivity(VoiceActivationAppsListProvider.getAppListRoute())
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user