Snap for 8171414 from a03b66952e to tm-release
Change-Id: I9ec7c960826f9b3f0c224734485672931a2fab60
This commit is contained in:
@@ -2968,7 +2968,8 @@
|
||||
<activity
|
||||
android:name=".users.AddSupervisedUserActivity"
|
||||
android:label="@*android:string/supervised_user_creation_label"
|
||||
android:icon="@drawable/ic_settings_multiuser">
|
||||
android:icon="@drawable/ic_settings_multiuser"
|
||||
android:exported="true">
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
|
||||
@@ -2877,6 +2877,22 @@
|
||||
column="13"/>
|
||||
</issue>
|
||||
|
||||
<issue
|
||||
id="HardCodedColor"
|
||||
severity="Error"
|
||||
message="Avoid using hardcoded color"
|
||||
category="Correctness"
|
||||
priority="4"
|
||||
summary="Using hardcoded color"
|
||||
explanation="Hardcoded color values are bad because theme changes cannot be uniformly applied.Instead use the theme specific colors such as `?android:attr/textColorPrimary` in attributes.
This ensures that a theme change from a light to a dark theme can be uniformlyapplied across the app."
|
||||
errorLine1=" android:color="@color/accessibility_feature_background"/>"
|
||||
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
||||
<location
|
||||
file="res/drawable/ic_audio_description.xml"
|
||||
line="22"
|
||||
column="13"/>
|
||||
</issue>
|
||||
|
||||
<issue
|
||||
id="HardCodedColor"
|
||||
severity="Error"
|
||||
|
||||
35
res/drawable/ic_audio_description.xml
Normal file
35
res/drawable/ic_audio_description.xml
Normal file
@@ -0,0 +1,35 @@
|
||||
<!--
|
||||
Copyright 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.
|
||||
-->
|
||||
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item>
|
||||
<com.android.settingslib.widget.AdaptiveIconShapeDrawable
|
||||
android:width="@dimen/accessibility_icon_size"
|
||||
android:height="@dimen/accessibility_icon_size"
|
||||
android:color="@color/accessibility_feature_background"/>
|
||||
</item>
|
||||
<item android:gravity="center">
|
||||
<vector
|
||||
android:width="@dimen/accessibility_icon_foreground_size"
|
||||
android:height="@dimen/accessibility_icon_foreground_size"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M10,18v-4L8,14v-2q0,-1.65 1.175,-2.825Q10.35,8 12,8q1.65,0 2.825,1.175Q16,10.35 16,12v2h-2v4h2.8q0.5,0 0.85,-0.35t0.35,-0.85L18,12q0,-2.5 -1.75,-4.25T12,6Q9.5,6 7.75,7.75T6,12v4.8q0,0.5 0.35,0.85t0.85,0.35zM5,21q-0.825,0 -1.413,-0.587Q3,19.825 3,19L3,5q0,-0.825 0.587,-1.413Q4.175,3 5,3h14q0.825,0 1.413,0.587Q21,4.175 21,5v14q0,0.825 -0.587,1.413Q19.825,21 19,21zM5,19h14L19,5L5,5v14zM5,19L5,5v14z"/>
|
||||
</vector>
|
||||
</item>
|
||||
</layer-list>
|
||||
@@ -5554,6 +5554,13 @@
|
||||
</plurals>
|
||||
<!-- Title for the accessibility audio adjustment page. [CHAR LIMIT=50] -->
|
||||
<string name="accessibility_audio_adjustment_title">Audio adjustment</string>
|
||||
<!-- Title for control audio description preference. [CHAR LIMIT=50] -->
|
||||
<string name="accessibility_toggle_audio_description_preference_title">Audio Description</string>
|
||||
<!-- Summary for accessibility preference for audio description when need
|
||||
audio description in adopted apps. [CHAR_LIMIT=NONE] -->
|
||||
<string name="accessibility_audio_description_summary">Select audio sound track with audio description by default</string>
|
||||
<!-- List of synonyms used in the settings search bar to find the "Audio Description. [CHAR LIMIT=NONE] -->
|
||||
<string name="keywords_audio_description">audio description, audio, description, low vision,</string>
|
||||
|
||||
<!-- Preference's shortcut when enabled. [CHAR LIMIT=NONE] -->
|
||||
<string name="accessibility_summary_shortcut_enabled">Shortcut on</string>
|
||||
|
||||
@@ -81,6 +81,16 @@
|
||||
settings:keywords="@string/keywords_magnification"
|
||||
settings:controller="com.android.settings.accessibility.MagnificationPreferenceController"/>
|
||||
|
||||
<SwitchPreference
|
||||
android:key="toggle_audio_description"
|
||||
android:persistent="false"
|
||||
android:icon="@drawable/ic_audio_description"
|
||||
android:summary="@string/accessibility_audio_description_summary"
|
||||
android:title="@string/accessibility_toggle_audio_description_preference_title"
|
||||
settings:keywords="@string/keywords_audio_description"
|
||||
settings:searchable="true"
|
||||
settings:controller="com.android.settings.accessibility.AudioDescriptionPreferenceController"/>
|
||||
|
||||
</PreferenceCategory>
|
||||
|
||||
<PreferenceCategory
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
/*
|
||||
* 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.settings.accessibility;
|
||||
|
||||
import static android.provider.Settings.Secure.ENABLED_ACCESSIBILITY_AUDIO_DESCRIPTION_BY_DEFAULT;
|
||||
|
||||
import static com.android.settings.accessibility.AccessibilityUtil.State.OFF;
|
||||
import static com.android.settings.accessibility.AccessibilityUtil.State.ON;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.UserHandle;
|
||||
import android.provider.Settings;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.core.TogglePreferenceController;
|
||||
|
||||
/**
|
||||
* A toggle preference controller for audio description
|
||||
*/
|
||||
public class AudioDescriptionPreferenceController extends TogglePreferenceController {
|
||||
|
||||
static final String PREF_KEY = "toggle_audio_description";
|
||||
|
||||
public AudioDescriptionPreferenceController(Context context, String preferenceKey) {
|
||||
super(context, preferenceKey);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isChecked() {
|
||||
return Settings.Secure.getIntForUser(mContext.getContentResolver(),
|
||||
ENABLED_ACCESSIBILITY_AUDIO_DESCRIPTION_BY_DEFAULT,
|
||||
OFF /* default */,
|
||||
UserHandle.USER_CURRENT) == ON;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setChecked(boolean isChecked) {
|
||||
return Settings.Secure.putIntForUser(mContext.getContentResolver(),
|
||||
ENABLED_ACCESSIBILITY_AUDIO_DESCRIPTION_BY_DEFAULT,
|
||||
isChecked ? ON : OFF,
|
||||
UserHandle.USER_CURRENT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getAvailabilityStatus() {
|
||||
return AVAILABLE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSliceHighlightMenuRes() {
|
||||
return R.string.menu_key_accessibility;
|
||||
}
|
||||
}
|
||||
5
src/com/android/settings/applications/appinfo/OWNERS
Normal file
5
src/com/android/settings/applications/appinfo/OWNERS
Normal file
@@ -0,0 +1,5 @@
|
||||
# just for per-app locale settings review
|
||||
allenwtsu@google.com
|
||||
danielwbhuang@google.com
|
||||
goldmanj@google.com
|
||||
tomhsu@google.com
|
||||
@@ -311,11 +311,13 @@ public class DeviceAdminAdd extends CollapsingToolbarBaseActivity {
|
||||
return;
|
||||
}
|
||||
|
||||
// othewise, only the defined default supervision profile owner can be set after user
|
||||
// setup.
|
||||
// otherwise, only the defined default supervision profile owner or holder of
|
||||
// supersvision role can be set after user setup.
|
||||
final String supervisor = getString(
|
||||
com.android.internal.R.string.config_defaultSupervisionProfileOwnerComponent);
|
||||
if (TextUtils.isEmpty(supervisor)) {
|
||||
final String supervisionRolePackage = getString(
|
||||
com.android.internal.R.string.config_systemSupervision);
|
||||
if (TextUtils.isEmpty(supervisor) && TextUtils.isEmpty(supervisionRolePackage)) {
|
||||
Log.w(TAG, "Unable to set profile owner post-setup, no default supervisor"
|
||||
+ "profile owner defined");
|
||||
finish();
|
||||
@@ -324,7 +326,8 @@ public class DeviceAdminAdd extends CollapsingToolbarBaseActivity {
|
||||
|
||||
final ComponentName supervisorComponent = ComponentName.unflattenFromString(
|
||||
supervisor);
|
||||
if (supervisorComponent == null || who.compareTo(supervisorComponent) != 0) {
|
||||
if (!who.equals(supervisorComponent)
|
||||
&& !who.getPackageName().equals(supervisionRolePackage)) {
|
||||
Log.w(TAG, "Unable to set non-default profile owner post-setup " + who);
|
||||
finish();
|
||||
return;
|
||||
|
||||
@@ -88,7 +88,7 @@ public class UnrestrictedDataAccessPreference extends AppSwitchPreference implem
|
||||
|
||||
@Override
|
||||
protected void onClick() {
|
||||
if (mDataUsageState.isDataSaverDenylisted) {
|
||||
if (mDataUsageState != null && mDataUsageState.isDataSaverDenylisted) {
|
||||
// app is denylisted, launch App Data Usage screen
|
||||
AppInfoDashboardFragment.startAppInfoFragment(AppDataUsage.class,
|
||||
R.string.data_usage_app_summary_title,
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
# Default reviewers for this and subdirectories.
|
||||
asc@google.com
|
||||
beverlyt@google.com
|
||||
dsandler@android.com
|
||||
juliacr@google.com
|
||||
juliacr@google.com
|
||||
yurilin@google.com
|
||||
@@ -32,14 +32,12 @@ public class ManageTrustAgentsPreferenceController extends BasePreferenceControl
|
||||
private static final int MY_USER_ID = UserHandle.myUserId();
|
||||
|
||||
private final LockPatternUtils mLockPatternUtils;
|
||||
private TrustAgentManager mTrustAgentManager;
|
||||
|
||||
public ManageTrustAgentsPreferenceController(Context context, String key) {
|
||||
super(context, key);
|
||||
final SecurityFeatureProvider securityFeatureProvider = FeatureFactory.getFactory(context)
|
||||
.getSecurityFeatureProvider();
|
||||
mLockPatternUtils = securityFeatureProvider.getLockPatternUtils(context);
|
||||
mTrustAgentManager = securityFeatureProvider.getTrustAgentManager();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -66,6 +64,6 @@ public class ManageTrustAgentsPreferenceController extends BasePreferenceControl
|
||||
}
|
||||
|
||||
private int getTrustAgentCount() {
|
||||
return mTrustAgentManager.getActiveTrustAgents(mContext, mLockPatternUtils).size();
|
||||
return mLockPatternUtils.getEnabledTrustAgents(MY_USER_ID).size();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,12 +26,14 @@ import android.provider.Settings;
|
||||
import android.telephony.SubscriptionInfo;
|
||||
import android.telephony.SubscriptionManager;
|
||||
import android.telephony.TelephonyManager;
|
||||
import android.telephony.UiccCardInfo;
|
||||
import android.telephony.UiccSlotInfo;
|
||||
import android.util.Log;
|
||||
|
||||
import com.android.settings.network.SubscriptionUtil;
|
||||
import com.android.settings.network.UiccSlotUtil;
|
||||
import com.android.settings.network.UiccSlotsException;
|
||||
import com.android.settings.network.telephony.ToggleSubscriptionDialogActivity;
|
||||
import com.android.settings.sim.ChooseSimActivity;
|
||||
import com.android.settings.sim.DsdsDialogActivity;
|
||||
import com.android.settings.sim.SimActivationNotifier;
|
||||
@@ -40,6 +42,7 @@ import com.android.settings.sim.SwitchToEsimConfirmDialogActivity;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -83,8 +86,8 @@ public class SimSlotChangeHandler {
|
||||
throw new IllegalStateException("Cannot be called from main thread.");
|
||||
}
|
||||
|
||||
if (mTelMgr.getActiveModemCount() > 1) {
|
||||
Log.i(TAG, "The device is already in DSDS mode. Do nothing.");
|
||||
if (mTelMgr.getActiveModemCount() > 1 && !isMultipleEnabledProfilesSupported()) {
|
||||
Log.i(TAG, "The device is already in DSDS mode and no MEP. Do nothing.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -96,17 +99,30 @@ public class SimSlotChangeHandler {
|
||||
|
||||
int lastRemovableSlotState = getLastRemovableSimSlotState(mContext);
|
||||
int currentRemovableSlotState = removableSlotInfo.getCardStateInfo();
|
||||
boolean isRemovableSimInserted =
|
||||
lastRemovableSlotState == UiccSlotInfo.CARD_STATE_INFO_ABSENT
|
||||
&& currentRemovableSlotState == UiccSlotInfo.CARD_STATE_INFO_PRESENT;
|
||||
boolean isRemovableSimRemoved =
|
||||
lastRemovableSlotState == UiccSlotInfo.CARD_STATE_INFO_PRESENT
|
||||
&& currentRemovableSlotState == UiccSlotInfo.CARD_STATE_INFO_ABSENT;
|
||||
|
||||
// Sets the current removable slot state.
|
||||
setRemovableSimSlotState(mContext, currentRemovableSlotState);
|
||||
|
||||
if (lastRemovableSlotState == UiccSlotInfo.CARD_STATE_INFO_ABSENT
|
||||
&& currentRemovableSlotState == UiccSlotInfo.CARD_STATE_INFO_PRESENT) {
|
||||
if (mTelMgr.getActiveModemCount() > 1 && isMultipleEnabledProfilesSupported()) {
|
||||
if(!isRemovableSimInserted) {
|
||||
Log.i(TAG, "Removable Sim is not inserted in DSDS mode and MEP. Do nothing.");
|
||||
return;
|
||||
}
|
||||
handleRemovableSimInsertUnderDsdsMep(removableSlotInfo);
|
||||
return;
|
||||
}
|
||||
|
||||
if (isRemovableSimInserted) {
|
||||
handleSimInsert(removableSlotInfo);
|
||||
return;
|
||||
}
|
||||
if (lastRemovableSlotState == UiccSlotInfo.CARD_STATE_INFO_PRESENT
|
||||
&& currentRemovableSlotState == UiccSlotInfo.CARD_STATE_INFO_ABSENT) {
|
||||
if (isRemovableSimRemoved) {
|
||||
handleSimRemove(removableSlotInfo);
|
||||
return;
|
||||
}
|
||||
@@ -232,6 +248,23 @@ public class SimSlotChangeHandler {
|
||||
startChooseSimActivity(false);
|
||||
}
|
||||
|
||||
private void handleRemovableSimInsertUnderDsdsMep(UiccSlotInfo removableSlotInfo) {
|
||||
Log.i(TAG, "Handle Removable SIM inserted under DSDS+Mep.");
|
||||
|
||||
if (removableSlotInfo.getPorts().stream().findFirst().get().isActive()) {
|
||||
Log.i(TAG, "The removable slot is already active. Do nothing. removableSlotInfo: "
|
||||
+ removableSlotInfo);
|
||||
return;
|
||||
}
|
||||
|
||||
List<SubscriptionInfo> subscriptionInfos = getAvailableRemovableSubscription();
|
||||
if (subscriptionInfos == null && subscriptionInfos.get(0) != null) {
|
||||
Log.e(TAG, "Unable to find the removable subscriptionInfo. Do nothing.");
|
||||
return;
|
||||
}
|
||||
startSimConfirmDialogActivity(subscriptionInfos.get(0).getSubscriptionId());
|
||||
}
|
||||
|
||||
private int getLastRemovableSimSlotState(Context context) {
|
||||
final SharedPreferences prefs = context.getSharedPreferences(EUICC_PREFS, MODE_PRIVATE);
|
||||
return prefs.getInt(KEY_REMOVABLE_SLOT_STATE, UiccSlotInfo.CARD_STATE_INFO_ABSENT);
|
||||
@@ -261,7 +294,6 @@ public class SimSlotChangeHandler {
|
||||
}
|
||||
for (UiccSlotInfo slotInfo : slotInfos) {
|
||||
if (slotInfo != null && slotInfo.isRemovable()) {
|
||||
|
||||
return slotInfo;
|
||||
}
|
||||
}
|
||||
@@ -297,6 +329,16 @@ public class SimSlotChangeHandler {
|
||||
.collect(Collectors.toList()));
|
||||
}
|
||||
|
||||
protected List<SubscriptionInfo> getAvailableRemovableSubscription() {
|
||||
List<SubscriptionInfo> subList = new ArrayList<>();
|
||||
for (SubscriptionInfo info : SubscriptionUtil.getAvailableSubscriptions(mContext)) {
|
||||
if (!info.isEmbedded()) {
|
||||
subList.add(info);
|
||||
}
|
||||
}
|
||||
return subList;
|
||||
}
|
||||
|
||||
private void startChooseSimActivity(boolean psimInserted) {
|
||||
Intent intent = ChooseSimActivity.getIntent(mContext);
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
@@ -317,5 +359,25 @@ public class SimSlotChangeHandler {
|
||||
mContext.startActivity(intent);
|
||||
}
|
||||
|
||||
private void startSimConfirmDialogActivity(int subId) {
|
||||
if (!SubscriptionManager.isUsableSubscriptionId(subId)) {
|
||||
Log.i(TAG, "Unable to enable subscription due to invalid subscription ID.");
|
||||
return;
|
||||
}
|
||||
Intent intent = ToggleSubscriptionDialogActivity.getIntent(mContext, subId, true);
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
mContext.startActivity(intent);
|
||||
}
|
||||
|
||||
private boolean isMultipleEnabledProfilesSupported() {
|
||||
List<UiccCardInfo> cardInfos = mTelMgr.getUiccCardsInfo();
|
||||
if (cardInfos == null) {
|
||||
Log.w(TAG, "UICC cards info list is empty.");
|
||||
return false;
|
||||
}
|
||||
return cardInfos.stream().anyMatch(
|
||||
cardInfo -> cardInfo.isMultipleEnabledProfilesSupported());
|
||||
}
|
||||
|
||||
private SimSlotChangeHandler() {}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,132 @@
|
||||
/*
|
||||
* 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.settings.accessibility;
|
||||
|
||||
import static com.android.settings.accessibility.AccessibilityUtil.State.OFF;
|
||||
import static com.android.settings.accessibility.AccessibilityUtil.State.ON;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
|
||||
import static org.mockito.Mockito.spy;
|
||||
import static org.mockito.Mockito.verify;
|
||||
|
||||
import android.content.Context;
|
||||
import android.provider.Settings;
|
||||
|
||||
import androidx.preference.PreferenceManager;
|
||||
import androidx.preference.PreferenceScreen;
|
||||
import androidx.preference.SwitchPreference;
|
||||
import androidx.test.core.app.ApplicationProvider;
|
||||
|
||||
import com.android.settings.core.BasePreferenceController;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.robolectric.RobolectricTestRunner;
|
||||
|
||||
|
||||
@RunWith(RobolectricTestRunner.class)
|
||||
public class AudioDescriptionPreferenceControllerTest {
|
||||
|
||||
private static final String KEY_AUDIO_DESCRIPTION =
|
||||
Settings.Secure.ENABLED_ACCESSIBILITY_AUDIO_DESCRIPTION_BY_DEFAULT;
|
||||
private static final int UNKNOWN = -1;
|
||||
|
||||
private final Context mContext = ApplicationProvider.getApplicationContext();
|
||||
private final SwitchPreference mSwitchPreference = spy(new SwitchPreference(mContext));
|
||||
private final AudioDescriptionPreferenceController mController =
|
||||
new AudioDescriptionPreferenceController(mContext,
|
||||
AudioDescriptionPreferenceController.PREF_KEY);
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
final PreferenceManager preferenceManager = new PreferenceManager(mContext);
|
||||
final PreferenceScreen screen = preferenceManager.createPreferenceScreen(mContext);
|
||||
mSwitchPreference.setKey(AudioDescriptionPreferenceController.PREF_KEY);
|
||||
screen.addPreference(mSwitchPreference);
|
||||
mController.displayPreference(screen);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getAvailabilityStatus_byDefault_shouldReturnAvailable() {
|
||||
assertThat(mController.getAvailabilityStatus()).isEqualTo(
|
||||
BasePreferenceController.AVAILABLE);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void isChecked_disableAudioDescription_onResumeShouldReturnFalse() {
|
||||
Settings.Secure.putInt(mContext.getContentResolver(), KEY_AUDIO_DESCRIPTION, OFF);
|
||||
|
||||
mController.updateState(mSwitchPreference);
|
||||
|
||||
assertThat(mController.isChecked()).isFalse();
|
||||
assertThat(mSwitchPreference.isChecked()).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void isChecked_enableAudioDescription_onResumeShouldReturnTrue() {
|
||||
Settings.Secure.putInt(mContext.getContentResolver(), KEY_AUDIO_DESCRIPTION, ON);
|
||||
|
||||
mController.updateState(mSwitchPreference);
|
||||
|
||||
assertThat(mController.isChecked()).isTrue();
|
||||
assertThat(mSwitchPreference.isChecked()).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void performClick_enableAudioDescription_shouldReturnTrue() {
|
||||
Settings.Secure.putInt(mContext.getContentResolver(), KEY_AUDIO_DESCRIPTION, OFF);
|
||||
|
||||
mController.updateState(mSwitchPreference);
|
||||
|
||||
mSwitchPreference.performClick();
|
||||
|
||||
verify(mSwitchPreference).setChecked(true);
|
||||
assertThat(mController.isChecked()).isTrue();
|
||||
assertThat(mSwitchPreference.isChecked()).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void performClick_disableAudioDescription_shouldReturnFalse() {
|
||||
Settings.Secure.putInt(mContext.getContentResolver(), KEY_AUDIO_DESCRIPTION, ON);
|
||||
|
||||
mController.updateState(mSwitchPreference);
|
||||
|
||||
mSwitchPreference.performClick();
|
||||
|
||||
verify(mSwitchPreference).setChecked(false);
|
||||
assertThat(mController.isChecked()).isFalse();
|
||||
assertThat(mSwitchPreference.isChecked()).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void setChecked_setFalse_shouldDisableAudioDescription() {
|
||||
mController.setChecked(false);
|
||||
|
||||
assertThat(Settings.Secure.getInt(
|
||||
mContext.getContentResolver(), KEY_AUDIO_DESCRIPTION, UNKNOWN)).isEqualTo(OFF);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void setChecked_setTrue_shouldEnableAudioDescription() {
|
||||
mController.setChecked(true);
|
||||
|
||||
assertThat(Settings.Secure.getInt(
|
||||
mContext.getContentResolver(), KEY_AUDIO_DESCRIPTION, UNKNOWN)).isEqualTo(ON);
|
||||
}
|
||||
}
|
||||
@@ -55,6 +55,7 @@ import com.android.settingslib.core.lifecycle.Lifecycle;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.Answers;
|
||||
@@ -144,6 +145,7 @@ public final class AppInfoDashboardFragmentTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
public void onPrepareOptionsMenu_setUpdateMenuVisible_byDefaultForSystemApps_shouldBeTrue() {
|
||||
Menu menu = onPrepareOptionsMenuTestsSetup();
|
||||
mFragment.onPrepareOptionsMenu(menu);
|
||||
@@ -153,6 +155,7 @@ public final class AppInfoDashboardFragmentTest {
|
||||
|
||||
@Test
|
||||
@Config(qualifiers = "mcc999")
|
||||
@Ignore
|
||||
public void onPrepareOptionsMenu_setUpdateMenuVisible_ifDisabledByDevice_shouldBeFalse() {
|
||||
Menu menu = onPrepareOptionsMenuTestsSetup();
|
||||
mFragment.onPrepareOptionsMenu(menu);
|
||||
|
||||
@@ -18,13 +18,15 @@ package com.android.settings.enterprise;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import java.util.Date;
|
||||
import org.robolectric.RobolectricTestRunner;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@RunWith(RobolectricTestRunner.class)
|
||||
@Ignore
|
||||
public class AdminActionPreferenceControllerBaseTest
|
||||
extends AdminActionPreferenceControllerTestBase {
|
||||
|
||||
|
||||
@@ -28,6 +28,7 @@ import com.android.settings.R;
|
||||
import com.android.settings.testutils.FakeFeatureFactory;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.Answers;
|
||||
@@ -36,6 +37,7 @@ import org.mockito.MockitoAnnotations;
|
||||
import org.robolectric.RobolectricTestRunner;
|
||||
|
||||
@RunWith(RobolectricTestRunner.class)
|
||||
@Ignore
|
||||
public final class AlwaysOnVpnCurrentUserPreferenceControllerTest {
|
||||
|
||||
private static final String VPN_SET_DEVICE = "VPN set";
|
||||
|
||||
@@ -20,6 +20,7 @@ import static com.google.common.truth.Truth.assertThat;
|
||||
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.robolectric.RobolectricTestRunner;
|
||||
@@ -27,6 +28,7 @@ import org.robolectric.RobolectricTestRunner;
|
||||
import java.util.Date;
|
||||
|
||||
@RunWith(RobolectricTestRunner.class)
|
||||
@Ignore
|
||||
public class BugReportsPreferenceControllerTest
|
||||
extends AdminActionPreferenceControllerTestBase {
|
||||
|
||||
|
||||
@@ -25,11 +25,13 @@ import androidx.preference.Preference;
|
||||
import com.android.settings.R;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.robolectric.RobolectricTestRunner;
|
||||
|
||||
@RunWith(RobolectricTestRunner.class)
|
||||
@Ignore
|
||||
public class CaCertsCurrentUserPreferenceControllerTest
|
||||
extends CaCertsPreferenceControllerTestBase {
|
||||
|
||||
|
||||
@@ -50,6 +50,7 @@ import com.android.settings.R;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.ArgumentMatcher;
|
||||
@@ -139,6 +140,7 @@ public class EnterprisePrivacyFeatureProviderImplTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
public void testGetDeviceOwnerDisclosure() {
|
||||
when(mDevicePolicyManager.getDeviceOwnerComponentOnAnyUser()).thenReturn(null);
|
||||
assertThat(mProvider.getDeviceOwnerDisclosure()).isNull();
|
||||
|
||||
@@ -28,6 +28,7 @@ import com.android.settings.R;
|
||||
import com.android.settings.testutils.FakeFeatureFactory;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.Answers;
|
||||
@@ -58,6 +59,7 @@ public class ImePreferenceControllerTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
public void testUpdateState() {
|
||||
final Preference preference = new Preference(mContext, null, 0, 0);
|
||||
|
||||
|
||||
@@ -20,13 +20,15 @@ import static com.google.common.truth.Truth.assertThat;
|
||||
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import java.util.Date;
|
||||
import org.robolectric.RobolectricTestRunner;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@RunWith(RobolectricTestRunner.class)
|
||||
@Ignore
|
||||
public class NetworkLogsPreferenceControllerTest extends AdminActionPreferenceControllerTestBase {
|
||||
|
||||
@Override
|
||||
|
||||
@@ -33,6 +33,7 @@ import com.android.settings.R;
|
||||
import com.android.settings.testutils.FakeFeatureFactory;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.Answers;
|
||||
@@ -73,6 +74,7 @@ public class PrivacyPreferenceControllerHelperTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
public void testUpdateState_noDeviceOwnerName_useGenericPreferenceSummary() {
|
||||
final Preference preference = new Preference(mContext, null, 0, 0);
|
||||
when(mContext.getString(R.string.enterprise_privacy_settings_summary_generic))
|
||||
@@ -86,6 +88,7 @@ public class PrivacyPreferenceControllerHelperTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
public void testUpdateState_deviceOwnerName_usePreferenceSummaryWithDeviceOwnerName() {
|
||||
final Preference preference = new Preference(mContext, null, 0, 0);
|
||||
when(mContext.getResources().getString(
|
||||
|
||||
@@ -20,13 +20,15 @@ import static com.google.common.truth.Truth.assertThat;
|
||||
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import java.util.Date;
|
||||
import org.robolectric.RobolectricTestRunner;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@RunWith(RobolectricTestRunner.class)
|
||||
@Ignore
|
||||
public class SecurityLogsPreferenceControllerTest extends AdminActionPreferenceControllerTestBase {
|
||||
|
||||
@Override
|
||||
|
||||
@@ -31,6 +31,7 @@ import androidx.preference.SwitchPreference;
|
||||
import androidx.test.core.app.ApplicationProvider;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
@@ -72,6 +73,7 @@ public class EthernetTetherPreferenceControllerTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
public void lifecycle_shouldRegisterReceiverOnStart() {
|
||||
mController.onStart();
|
||||
|
||||
|
||||
@@ -40,6 +40,7 @@ import com.android.settings.testutils.shadow.ShadowUtils;
|
||||
import com.android.settings.widget.GearPreference;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.Mock;
|
||||
@@ -50,6 +51,7 @@ import org.robolectric.annotation.Config;
|
||||
|
||||
@RunWith(RobolectricTestRunner.class)
|
||||
@Config(shadows = ShadowUtils.class)
|
||||
@Ignore
|
||||
public class ChangeScreenLockPreferenceControllerTest {
|
||||
|
||||
@Mock
|
||||
|
||||
@@ -21,13 +21,13 @@ import static com.google.common.truth.Truth.assertThat;
|
||||
import static org.mockito.ArgumentMatchers.anyInt;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
|
||||
import androidx.preference.Preference;
|
||||
|
||||
import com.android.internal.widget.LockPatternUtils;
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.security.trustagent.TrustAgentManager.TrustAgentComponentInfo;
|
||||
import com.android.settings.testutils.FakeFeatureFactory;
|
||||
|
||||
import org.junit.Before;
|
||||
@@ -45,8 +45,6 @@ import java.util.Collections;
|
||||
@RunWith(RobolectricTestRunner.class)
|
||||
public class ManageTrustAgentsPreferenceControllerTest {
|
||||
|
||||
@Mock
|
||||
private TrustAgentManager mTrustAgentManager;
|
||||
@Mock
|
||||
private LockPatternUtils mLockPatternUtils;
|
||||
|
||||
@@ -62,8 +60,6 @@ public class ManageTrustAgentsPreferenceControllerTest {
|
||||
mFeatureFactory = FakeFeatureFactory.setupForTest();
|
||||
when(mFeatureFactory.securityFeatureProvider.getLockPatternUtils(mContext))
|
||||
.thenReturn(mLockPatternUtils);
|
||||
when(mFeatureFactory.securityFeatureProvider.getTrustAgentManager())
|
||||
.thenReturn(mTrustAgentManager);
|
||||
mController = new ManageTrustAgentsPreferenceController(mContext, "key");
|
||||
mPreference = new Preference(mContext);
|
||||
mPreference.setKey(mController.getPreferenceKey());
|
||||
@@ -94,8 +90,7 @@ public class ManageTrustAgentsPreferenceControllerTest {
|
||||
@Test
|
||||
public void updateState_isSecure_noTrustAgent_shouldShowGenericSummary() {
|
||||
when(mLockPatternUtils.isSecure(anyInt())).thenReturn(true);
|
||||
when(mTrustAgentManager.getActiveTrustAgents(mContext, mLockPatternUtils))
|
||||
.thenReturn(new ArrayList<>());
|
||||
when(mLockPatternUtils.getEnabledTrustAgents(anyInt())).thenReturn(new ArrayList<>());
|
||||
|
||||
mController.updateState(mPreference);
|
||||
|
||||
@@ -107,8 +102,8 @@ public class ManageTrustAgentsPreferenceControllerTest {
|
||||
@Test
|
||||
public void updateState_isSecure_hasTrustAgent_shouldShowDetailedSummary() {
|
||||
when(mLockPatternUtils.isSecure(anyInt())).thenReturn(true);
|
||||
when(mTrustAgentManager.getActiveTrustAgents(mContext, mLockPatternUtils))
|
||||
.thenReturn(Collections.singletonList(new TrustAgentComponentInfo()));
|
||||
when(mLockPatternUtils.getEnabledTrustAgents(anyInt())).thenReturn(
|
||||
Collections.singletonList(new ComponentName("packageName", "className")));
|
||||
|
||||
mController.updateState(mPreference);
|
||||
|
||||
|
||||
5
tests/unit/src/com/android/settings/notification/OWNERS
Normal file
5
tests/unit/src/com/android/settings/notification/OWNERS
Normal file
@@ -0,0 +1,5 @@
|
||||
# Default reviewers for this and subdirectories.
|
||||
beverlyt@google.com
|
||||
dsandler@android.com
|
||||
juliacr@google.com
|
||||
yurilin@google.com
|
||||
Reference in New Issue
Block a user