Remove RUN_BACKUP_JOBS special app access page.

Bug: 333624438
Test: visual
Change-Id: Ib01bd6556768a943ae7fae013c6ccb82b1b96697
This commit is contained in:
Varun Shah
2024-04-15 23:58:44 +00:00
parent 02f1db61d8
commit 321e08e538
11 changed files with 0 additions and 283 deletions

View File

@@ -1,82 +0,0 @@
/*
* Copyright (C) 2024 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 android.platform.test.annotations.RequiresFlagsDisabled
import android.platform.test.annotations.RequiresFlagsEnabled
import android.platform.test.flag.junit.CheckFlagsRule
import android.platform.test.flag.junit.DeviceFlagsValueProvider
import androidx.preference.Preference
import androidx.test.core.app.ApplicationProvider
import androidx.test.ext.junit.runners.AndroidJUnit4
import com.android.settings.flags.Flags
import com.google.common.truth.Truth.assertThat
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
import org.mockito.kotlin.any
import org.mockito.kotlin.doNothing
import org.mockito.kotlin.spy
import org.mockito.kotlin.whenever
@RunWith(AndroidJUnit4::class)
class BackupTasksAppsPreferenceControllerTest {
@get:Rule
val checkFlagsRule: CheckFlagsRule = DeviceFlagsValueProvider.createCheckFlagsRule()
private val context: Context = spy(ApplicationProvider.getApplicationContext()) {
doNothing().whenever(mock).startActivity(any())
}
private val matchedPreference = Preference(context).apply { key = preferenceKey }
private val misMatchedPreference = Preference(context).apply { key = testPreferenceKey }
private val controller = BackupTasksAppsPreferenceController(context, preferenceKey)
@Test
@RequiresFlagsEnabled(Flags.FLAG_ENABLE_PERFORM_BACKUP_TASKS_IN_SETTINGS)
fun getAvailabilityStatus_enableBackupTasksApps_returnAvailable() {
// Feature is currently disabled so it should return false regardless of flag status.
assertThat(controller.isAvailable).isFalse()
}
@Test
@RequiresFlagsDisabled(Flags.FLAG_ENABLE_PERFORM_BACKUP_TASKS_IN_SETTINGS)
fun getAvailableStatus_disableBackupTasksApps_returnConditionallyUnavailable() {
assertThat(controller.isAvailable).isFalse()
}
@Test
fun handlePreferenceTreeClick_keyMatched_returnTrue() {
assertThat(controller.handlePreferenceTreeClick(matchedPreference)).isTrue()
}
@Test
fun handlePreferenceTreeClick_keyMisMatched_returnFalse() {
assertThat(controller.handlePreferenceTreeClick(misMatchedPreference)).isFalse()
}
companion object {
private const val preferenceKey: String = "backup_tasks_apps"
private const val testPreferenceKey: String = "test_key"
}
}

View File

@@ -1,44 +0,0 @@
/*
* Copyright (C) 2024 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.content.Context
import androidx.test.core.app.ApplicationProvider
import androidx.test.ext.junit.runners.AndroidJUnit4
import com.google.common.truth.Truth.assertThat
import com.android.settings.R
import org.junit.Test
import org.junit.runner.RunWith
@RunWith(AndroidJUnit4::class)
class BackupTasksAppsTest {
private val context: Context = ApplicationProvider.getApplicationContext()
private val listModel = BackupTasksAppsListModel(context)
@Test
fun modelResourceIdAndProperties() {
assertThat(listModel.pageTitleResId).isEqualTo(R.string.run_backup_tasks_title)
assertThat(listModel.switchTitleResId).isEqualTo(R.string.run_backup_tasks_switch_title)
assertThat(listModel.footerResId).isEqualTo(R.string.run_backup_tasks_footer_title)
assertThat(listModel.appOp).isEqualTo(AppOpsManager.OP_RUN_BACKUP_JOBS)
assertThat(listModel.permission).isEqualTo(Manifest.permission.RUN_BACKUP_JOBS)
assertThat(listModel.setModeByUid).isTrue()
}
}