Snap for 7695339 from 041d8cdb5a to sc-v2-release
Change-Id: Ie23245661fcf2978a9255e56ddf90eedda33536a
This commit is contained in:
@@ -1013,7 +1013,8 @@ public final class Utils extends com.android.settingslib.Utils {
|
|||||||
Drawable safeIcon = icon;
|
Drawable safeIcon = icon;
|
||||||
|
|
||||||
if ((icon != null) && !(icon instanceof VectorDrawable)) {
|
if ((icon != null) && !(icon instanceof VectorDrawable)) {
|
||||||
safeIcon = getSafeDrawable(icon, 500, 500);
|
safeIcon = getSafeDrawable(icon,
|
||||||
|
/* MAX_DRAWABLE_SIZE */ 600, /* MAX_DRAWABLE_SIZE */ 600);
|
||||||
}
|
}
|
||||||
|
|
||||||
return safeIcon;
|
return safeIcon;
|
||||||
|
|||||||
@@ -104,11 +104,17 @@ public class AccessibilityFooterPreferenceController extends BasePreferenceContr
|
|||||||
sb.append(getIntroductionTitle()).append("\n\n").append(footerPreference.getTitle());
|
sb.append(getIntroductionTitle()).append("\n\n").append(footerPreference.getTitle());
|
||||||
footerPreference.setContentDescription(sb);
|
footerPreference.setContentDescription(sb);
|
||||||
|
|
||||||
|
final Intent helpIntent;
|
||||||
if (getHelpResource() != 0) {
|
if (getHelpResource() != 0) {
|
||||||
|
// Returns may be null if content is wrong or empty.
|
||||||
|
helpIntent = HelpUtils.getHelpIntent(mContext, mContext.getString(getHelpResource()),
|
||||||
|
mContext.getClass().getName());
|
||||||
|
} else {
|
||||||
|
helpIntent = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (helpIntent != null) {
|
||||||
footerPreference.setLearnMoreAction(view -> {
|
footerPreference.setLearnMoreAction(view -> {
|
||||||
final Intent helpIntent = HelpUtils.getHelpIntent(
|
|
||||||
mContext, mContext.getString(getHelpResource()),
|
|
||||||
mContext.getClass().getName());
|
|
||||||
view.startActivityForResult(helpIntent, 0);
|
view.startActivityForResult(helpIntent, 0);
|
||||||
});
|
});
|
||||||
footerPreference.setLearnMoreContentDescription(getLearnMoreContentDescription());
|
footerPreference.setLearnMoreContentDescription(getLearnMoreContentDescription());
|
||||||
|
|||||||
@@ -86,4 +86,9 @@ public class BiometricSettingsAppPreferenceController extends TogglePreferenceCo
|
|||||||
return AVAILABLE_UNSEARCHABLE;
|
return AVAILABLE_UNSEARCHABLE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public final boolean isSliceable() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -68,4 +68,9 @@ public class BiometricSettingsKeyguardPreferenceController extends TogglePrefere
|
|||||||
}
|
}
|
||||||
return getRestrictingAdmin() != null ? DISABLED_FOR_USER : AVAILABLE;
|
return getRestrictingAdmin() != null ? DISABLED_FOR_USER : AVAILABLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public final boolean isSliceable() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,7 +44,6 @@ import com.android.settings.overlay.FeatureFactory;
|
|||||||
import com.android.settings.password.ChooseLockSettingsHelper;
|
import com.android.settings.password.ChooseLockSettingsHelper;
|
||||||
import com.android.settings.search.BaseSearchIndexProvider;
|
import com.android.settings.search.BaseSearchIndexProvider;
|
||||||
import com.android.settingslib.core.AbstractPreferenceController;
|
import com.android.settingslib.core.AbstractPreferenceController;
|
||||||
import com.android.settingslib.core.lifecycle.Lifecycle;
|
|
||||||
import com.android.settingslib.search.SearchIndexable;
|
import com.android.settingslib.search.SearchIndexable;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -290,7 +289,7 @@ public class FaceSettings extends DashboardFragment {
|
|||||||
if (!isFaceHardwareDetected(context)) {
|
if (!isFaceHardwareDetected(context)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
mControllers = buildPreferenceControllers(context, getSettingsLifecycle());
|
mControllers = buildPreferenceControllers(context);
|
||||||
// There's no great way of doing this right now :/
|
// There's no great way of doing this right now :/
|
||||||
for (AbstractPreferenceController controller : mControllers) {
|
for (AbstractPreferenceController controller : mControllers) {
|
||||||
if (controller instanceof FaceSettingsAttentionPreferenceController) {
|
if (controller instanceof FaceSettingsAttentionPreferenceController) {
|
||||||
@@ -309,8 +308,7 @@ public class FaceSettings extends DashboardFragment {
|
|||||||
return mControllers;
|
return mControllers;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static List<AbstractPreferenceController> buildPreferenceControllers(Context context,
|
private static List<AbstractPreferenceController> buildPreferenceControllers(Context context) {
|
||||||
Lifecycle lifecycle) {
|
|
||||||
final List<AbstractPreferenceController> controllers = new ArrayList<>();
|
final List<AbstractPreferenceController> controllers = new ArrayList<>();
|
||||||
controllers.add(new FaceSettingsKeyguardPreferenceController(context));
|
controllers.add(new FaceSettingsKeyguardPreferenceController(context));
|
||||||
controllers.add(new FaceSettingsAppPreferenceController(context));
|
controllers.add(new FaceSettingsAppPreferenceController(context));
|
||||||
@@ -328,7 +326,7 @@ public class FaceSettings extends DashboardFragment {
|
|||||||
public List<AbstractPreferenceController> createPreferenceControllers(
|
public List<AbstractPreferenceController> createPreferenceControllers(
|
||||||
Context context) {
|
Context context) {
|
||||||
if (isFaceHardwareDetected(context)) {
|
if (isFaceHardwareDetected(context)) {
|
||||||
return buildPreferenceControllers(context, null /* lifecycle */);
|
return buildPreferenceControllers(context);
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -116,11 +116,6 @@ public class FaceSettingsAttentionPreferenceController extends FaceSettingsPrefe
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isSliceable() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getAvailabilityStatus() {
|
public int getAvailabilityStatus() {
|
||||||
return AVAILABLE;
|
return AVAILABLE;
|
||||||
|
|||||||
@@ -46,4 +46,9 @@ public abstract class FaceSettingsPreferenceController extends TogglePreferenceC
|
|||||||
return RestrictedLockUtilsInternal.checkIfKeyguardFeaturesDisabled(
|
return RestrictedLockUtilsInternal.checkIfKeyguardFeaturesDisabled(
|
||||||
mContext, DevicePolicyManager.KEYGUARD_DISABLE_FACE, mUserId);
|
mContext, DevicePolicyManager.KEYGUARD_DISABLE_FACE, mUserId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public final boolean isSliceable() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,12 +31,18 @@ import com.android.settings.biometrics.BiometricErrorDialog;
|
|||||||
*/
|
*/
|
||||||
public class FingerprintErrorDialog extends BiometricErrorDialog {
|
public class FingerprintErrorDialog extends BiometricErrorDialog {
|
||||||
public static void showErrorDialog(BiometricEnrollBase host, int errMsgId) {
|
public static void showErrorDialog(BiometricEnrollBase host, int errMsgId) {
|
||||||
|
if (host.isFinishing()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
final FragmentManager fragmentManager = host.getSupportFragmentManager();
|
||||||
|
if (fragmentManager.isDestroyed()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
final CharSequence errMsg = host.getText(getErrorMessage(errMsgId));
|
final CharSequence errMsg = host.getText(getErrorMessage(errMsgId));
|
||||||
final FingerprintErrorDialog dialog = newInstance(errMsg, errMsgId);
|
final FingerprintErrorDialog dialog = newInstance(errMsg, errMsgId);
|
||||||
final FragmentManager fragmentManager = host.getSupportFragmentManager();
|
dialog.show(fragmentManager, FingerprintErrorDialog.class.getName());
|
||||||
if (!fragmentManager.isDestroyed()) {
|
|
||||||
dialog.show(fragmentManager, FingerprintErrorDialog.class.getName());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int getErrorMessage(int errMsgId) {
|
private static int getErrorMessage(int errMsgId) {
|
||||||
|
|||||||
@@ -103,8 +103,10 @@ public class AdvancedBluetoothDetailsHeaderController extends BasePreferenceCont
|
|||||||
new BluetoothAdapter.OnMetadataChangedListener() {
|
new BluetoothAdapter.OnMetadataChangedListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onMetadataChanged(BluetoothDevice device, int key, byte[] value) {
|
public void onMetadataChanged(BluetoothDevice device, int key, byte[] value) {
|
||||||
Log.i(TAG, String.format("Metadata updated in Device %s: %d = %s.", device, key,
|
if (DEBUG) {
|
||||||
value == null ? null : new String(value)));
|
Log.d(TAG, String.format("Metadata updated in Device %s: %d = %s.", device,
|
||||||
|
key, value == null ? null : new String(value)));
|
||||||
|
}
|
||||||
refresh();
|
refresh();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -311,7 +311,8 @@ public class SubscriptionsPreferenceController extends AbstractPreferenceControl
|
|||||||
numLevels += 1;
|
numLevels += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
Drawable icon = mSubsPrefCtrlInjector.getIcon(mContext, level, numLevels, false);
|
Drawable icon = mSubsPrefCtrlInjector.getIcon(mContext, level, numLevels,
|
||||||
|
!mTelephonyManager.isDataEnabled());
|
||||||
final boolean isActiveCellularNetwork =
|
final boolean isActiveCellularNetwork =
|
||||||
mSubsPrefCtrlInjector.isActiveCellularNetwork(mContext);
|
mSubsPrefCtrlInjector.isActiveCellularNetwork(mContext);
|
||||||
if (isActiveCellularNetwork || (mWifiPickerTrackerHelper != null)
|
if (isActiveCellularNetwork || (mWifiPickerTrackerHelper != null)
|
||||||
|
|||||||
@@ -54,10 +54,13 @@ public class ZenModePrioritySendersPreferenceController
|
|||||||
@VisibleForTesting static final String KEY_NONE = "senders_none";
|
@VisibleForTesting static final String KEY_NONE = "senders_none";
|
||||||
|
|
||||||
private static final Intent ALL_CONTACTS_INTENT =
|
private static final Intent ALL_CONTACTS_INTENT =
|
||||||
new Intent(Contacts.Intents.UI.LIST_DEFAULT);
|
new Intent(Contacts.Intents.UI.LIST_DEFAULT)
|
||||||
|
.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
|
||||||
private static final Intent STARRED_CONTACTS_INTENT =
|
private static final Intent STARRED_CONTACTS_INTENT =
|
||||||
new Intent(Contacts.Intents.UI.LIST_STARRED_ACTION);
|
new Intent(Contacts.Intents.UI.LIST_STARRED_ACTION)
|
||||||
private static final Intent FALLBACK_INTENT = new Intent(Intent.ACTION_MAIN);
|
.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
|
||||||
|
private static final Intent FALLBACK_INTENT = new Intent(Intent.ACTION_MAIN)
|
||||||
|
.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
|
||||||
|
|
||||||
private final PackageManager mPackageManager;
|
private final PackageManager mPackageManager;
|
||||||
private final boolean mIsMessages; // if this is false, then this preference is for calls
|
private final boolean mIsMessages; // if this is false, then this preference is for calls
|
||||||
|
|||||||
@@ -43,10 +43,12 @@ public class ZenRuleStarredContactsPreferenceController extends
|
|||||||
mPriorityCategory = priorityCategory;
|
mPriorityCategory = priorityCategory;
|
||||||
mPackageManager = mContext.getPackageManager();
|
mPackageManager = mContext.getPackageManager();
|
||||||
|
|
||||||
mStarredContactsIntent = new Intent(Contacts.Intents.UI.LIST_STARRED_ACTION);
|
mStarredContactsIntent = new Intent(Contacts.Intents.UI.LIST_STARRED_ACTION)
|
||||||
|
.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
|
||||||
|
|
||||||
mFallbackIntent = new Intent(Intent.ACTION_MAIN);
|
mFallbackIntent = new Intent(Intent.ACTION_MAIN);
|
||||||
mFallbackIntent.addCategory(Intent.CATEGORY_APP_CONTACTS);
|
mFallbackIntent.addCategory(Intent.CATEGORY_APP_CONTACTS);
|
||||||
|
mFallbackIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -109,16 +109,16 @@ public class AccessibilityFooterPreferenceControllerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void onBindViewHolder_setupHelpLink_setCorrectHelpLinkAndContentDescription() {
|
public void onBindViewHolder_setHelpResource_emptyString_notVisible() {
|
||||||
mController.setupHelpLink(TEST_HELP_ID, TEST_CONTENT_DESCRIPTION);
|
mController.setupHelpLink(R.string.help_url_timeout, TEST_CONTENT_DESCRIPTION);
|
||||||
mController.displayPreference(mScreen);
|
mController.displayPreference(mScreen);
|
||||||
|
|
||||||
mPreference.onBindViewHolder(mPreferenceViewHolder);
|
mPreference.onBindViewHolder(mPreferenceViewHolder);
|
||||||
|
|
||||||
final TextView learnMoreView = (TextView) mPreferenceViewHolder
|
final TextView learnMoreView = (TextView) mPreferenceViewHolder
|
||||||
.findViewById(com.android.settingslib.R.id.settingslib_learn_more);
|
.findViewById(com.android.settingslib.R.id.settingslib_learn_more);
|
||||||
assertThat(learnMoreView.getContentDescription().toString())
|
assertThat(learnMoreView.getContentDescription()).isNull();
|
||||||
.contains(TEST_CONTENT_DESCRIPTION);
|
assertThat(learnMoreView.getVisibility()).isEqualTo(View.GONE);
|
||||||
assertThat(mPreference.isLinkEnabled()).isTrue();
|
assertThat(mPreference.isLinkEnabled()).isFalse();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,46 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2021 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.biometrics.combination;
|
||||||
|
|
||||||
|
import static com.google.common.truth.Truth.assertThat;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
|
||||||
|
import androidx.test.core.app.ApplicationProvider;
|
||||||
|
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||||
|
|
||||||
|
import org.junit.Before;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
|
||||||
|
@RunWith(AndroidJUnit4.class)
|
||||||
|
public class BiometricSettingsAppPreferenceControllerTest {
|
||||||
|
|
||||||
|
private Context mContext;
|
||||||
|
private BiometricSettingsAppPreferenceController mController;
|
||||||
|
|
||||||
|
@Before
|
||||||
|
public void setUp() {
|
||||||
|
mContext = ApplicationProvider.getApplicationContext();
|
||||||
|
mController = new BiometricSettingsAppPreferenceController(mContext, "key");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void isSliceable_returnFalse() {
|
||||||
|
assertThat(mController.isSliceable()).isFalse();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2021 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.biometrics.combination;
|
||||||
|
|
||||||
|
import static com.google.common.truth.Truth.assertThat;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
|
||||||
|
import androidx.test.core.app.ApplicationProvider;
|
||||||
|
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||||
|
|
||||||
|
import org.junit.Before;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
|
||||||
|
@RunWith(AndroidJUnit4.class)
|
||||||
|
public class BiometricSettingsKeyguardPreferenceControllerTest {
|
||||||
|
|
||||||
|
private Context mContext;
|
||||||
|
private BiometricSettingsKeyguardPreferenceController mController;
|
||||||
|
|
||||||
|
@Before
|
||||||
|
public void setUp() {
|
||||||
|
mContext = ApplicationProvider.getApplicationContext();
|
||||||
|
mController = new BiometricSettingsKeyguardPreferenceController(mContext, "key");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void isSliceable_returnFalse() {
|
||||||
|
assertThat(mController.isSliceable()).isFalse();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2021 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.biometrics.face;
|
||||||
|
|
||||||
|
import static com.google.common.truth.Truth.assertThat;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
|
||||||
|
import androidx.test.core.app.ApplicationProvider;
|
||||||
|
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||||
|
|
||||||
|
import org.junit.Before;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
|
||||||
|
@RunWith(AndroidJUnit4.class)
|
||||||
|
public class FaceSettingsAppPreferenceControllerTest {
|
||||||
|
|
||||||
|
private Context mContext;
|
||||||
|
private FaceSettingsAppPreferenceController mController;
|
||||||
|
|
||||||
|
@Before
|
||||||
|
public void setUp() {
|
||||||
|
mContext = ApplicationProvider.getApplicationContext();
|
||||||
|
mController = new FaceSettingsAppPreferenceController(mContext);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void isSliceable_returnFalse() {
|
||||||
|
assertThat(mController.isSliceable()).isFalse();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2021 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.biometrics.face;
|
||||||
|
|
||||||
|
import static com.google.common.truth.Truth.assertThat;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
|
||||||
|
import androidx.test.core.app.ApplicationProvider;
|
||||||
|
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||||
|
|
||||||
|
import org.junit.Before;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
|
||||||
|
@RunWith(AndroidJUnit4.class)
|
||||||
|
public class FaceSettingsConfirmPreferenceControllerTest {
|
||||||
|
|
||||||
|
private Context mContext;
|
||||||
|
private FaceSettingsConfirmPreferenceController mController;
|
||||||
|
|
||||||
|
@Before
|
||||||
|
public void setUp() {
|
||||||
|
mContext = ApplicationProvider.getApplicationContext();
|
||||||
|
mController = new FaceSettingsConfirmPreferenceController(mContext);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void isSliceable_returnFalse() {
|
||||||
|
assertThat(mController.isSliceable()).isFalse();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2021 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.biometrics.face;
|
||||||
|
|
||||||
|
import static com.google.common.truth.Truth.assertThat;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
|
||||||
|
import androidx.test.core.app.ApplicationProvider;
|
||||||
|
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||||
|
|
||||||
|
import org.junit.Before;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
|
||||||
|
@RunWith(AndroidJUnit4.class)
|
||||||
|
public class FaceSettingsKeyguardPreferenceControllerTest {
|
||||||
|
private Context mContext;
|
||||||
|
private FaceSettingsKeyguardPreferenceController mController;
|
||||||
|
|
||||||
|
@Before
|
||||||
|
public void setUp() {
|
||||||
|
mContext = ApplicationProvider.getApplicationContext();
|
||||||
|
mController = new FaceSettingsKeyguardPreferenceController(mContext);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void isSliceable_returnFalse() {
|
||||||
|
assertThat(mController.isSliceable()).isFalse();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -665,6 +665,7 @@ public class SubscriptionsPreferenceControllerTest {
|
|||||||
doReturn(true).when(sInjector).isProviderModelEnabled(mContext);
|
doReturn(true).when(sInjector).isProviderModelEnabled(mContext);
|
||||||
doReturn(sub.get(0)).when(mSubscriptionManager).getDefaultDataSubscriptionInfo();
|
doReturn(sub.get(0)).when(mSubscriptionManager).getDefaultDataSubscriptionInfo();
|
||||||
Drawable icon = mock(Drawable.class);
|
Drawable icon = mock(Drawable.class);
|
||||||
|
when(mTelephonyManager.isDataEnabled()).thenReturn(true);
|
||||||
doReturn(icon).when(sInjector).getIcon(any(), anyInt(), anyInt(), eq(false));
|
doReturn(icon).when(sInjector).getIcon(any(), anyInt(), anyInt(), eq(false));
|
||||||
setupGetIconConditions(sub.get(0).getSubscriptionId(), true, true,
|
setupGetIconConditions(sub.get(0).getSubscriptionId(), true, true,
|
||||||
true, ServiceState.STATE_IN_SERVICE);
|
true, ServiceState.STATE_IN_SERVICE);
|
||||||
@@ -683,6 +684,7 @@ public class SubscriptionsPreferenceControllerTest {
|
|||||||
doReturn(true).when(sInjector).isProviderModelEnabled(mContext);
|
doReturn(true).when(sInjector).isProviderModelEnabled(mContext);
|
||||||
doReturn(subs.get(0)).when(mSubscriptionManager).getDefaultDataSubscriptionInfo();
|
doReturn(subs.get(0)).when(mSubscriptionManager).getDefaultDataSubscriptionInfo();
|
||||||
Drawable icon = mock(Drawable.class);
|
Drawable icon = mock(Drawable.class);
|
||||||
|
when(mTelephonyManager.isDataEnabled()).thenReturn(true);
|
||||||
doReturn(icon).when(sInjector).getIcon(any(), anyInt(), anyInt(), eq(false));
|
doReturn(icon).when(sInjector).getIcon(any(), anyInt(), anyInt(), eq(false));
|
||||||
setupGetIconConditions(subId, false, true,
|
setupGetIconConditions(subId, false, true,
|
||||||
true, ServiceState.STATE_IN_SERVICE);
|
true, ServiceState.STATE_IN_SERVICE);
|
||||||
@@ -701,7 +703,8 @@ public class SubscriptionsPreferenceControllerTest {
|
|||||||
doReturn(true).when(sInjector).isProviderModelEnabled(mContext);
|
doReturn(true).when(sInjector).isProviderModelEnabled(mContext);
|
||||||
doReturn(subs.get(0)).when(mSubscriptionManager).getDefaultDataSubscriptionInfo();
|
doReturn(subs.get(0)).when(mSubscriptionManager).getDefaultDataSubscriptionInfo();
|
||||||
Drawable icon = mock(Drawable.class);
|
Drawable icon = mock(Drawable.class);
|
||||||
doReturn(icon).when(sInjector).getIcon(any(), anyInt(), anyInt(), eq(false));
|
when(mTelephonyManager.isDataEnabled()).thenReturn(false);
|
||||||
|
doReturn(icon).when(sInjector).getIcon(any(), anyInt(), anyInt(), eq(true));
|
||||||
|
|
||||||
setupGetIconConditions(subId, false, false,
|
setupGetIconConditions(subId, false, false,
|
||||||
false, ServiceState.STATE_IN_SERVICE);
|
false, ServiceState.STATE_IN_SERVICE);
|
||||||
|
|||||||
Reference in New Issue
Block a user