Snap for 10098552 from 53bf6b1dc8
to udc-release
Change-Id: I4306270af314d547233077ad37eaf93820437952
This commit is contained in:
@@ -58,7 +58,7 @@
|
||||
android:src="@drawable/ic_info_outline_24dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:tint="?android:attr/textColorTertiary"/>
|
||||
android:tint="?android:attr/textColorSecondary"/>
|
||||
<TextView
|
||||
android:id="@+id/info_outline"
|
||||
android:layout_width="wrap_content"
|
||||
|
@@ -52,7 +52,7 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="?android:attr/textColorTertiary"
|
||||
android:textColor="?android:attr/textColorSecondary"
|
||||
android:paddingStart="?android:attr/listPreferredItemPaddingStart"/>
|
||||
|
||||
<TextView
|
||||
@@ -69,7 +69,7 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="?android:attr/textColorTertiary"
|
||||
android:textColor="?android:attr/textColorSecondary"
|
||||
android:paddingStart="?android:attr/listPreferredItemPaddingStart"/>
|
||||
|
||||
<TextView
|
||||
@@ -78,7 +78,7 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="?android:attr/textColorTertiary"
|
||||
android:textColor="?android:attr/textColorSecondary"
|
||||
android:paddingStart="?android:attr/listPreferredItemPaddingStart"/>
|
||||
|
||||
<TextView
|
||||
@@ -87,7 +87,7 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="?android:attr/textColorTertiary"
|
||||
android:textColor="?android:attr/textColorSecondary"
|
||||
android:paddingStart="?android:attr/listPreferredItemPaddingStart"/>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
@@ -818,6 +818,10 @@
|
||||
<string name="biometric_settings_intro_with_fingerprint">You can unlock with your watch when your fingerprint isn\u2019t recognized.</string>
|
||||
<!-- Introduction shown in face page to explain that watch unlock can be used if face isn't recognized. [CHAR LIMIT=NONE]-->
|
||||
<string name="biometric_settings_intro_with_face">You can unlock with your watch when your face isn\u2019t recognized.</string>
|
||||
<string name="biometric_settings_use_fingerprint_or_watch_for"> Use fingerprint or watch to</string>
|
||||
<string name="biometric_settings_use_face_or_watch_for"> Use face or watch to</string>
|
||||
<string name="biometric_settings_use_face_fingerprint_or_watch_for"> Use face, fingerprint, or watch to</string>
|
||||
<string name="biometric_settings_use_watch_for"> Use watch to</string>
|
||||
<!-- Message for a biometric preference toggle, indicating that an action can only be performed by using Face Unlock or Watch Unlock. [CHAR LIMIT=50] -->
|
||||
<string name="biometric_settings_use_face_or_watch_preference_summary">Using face or watch</string>
|
||||
<!-- Message for a biometric preference toggle, indicating that an action can only be performed by using Fingerprint Unlock or Watch Unlock. [CHAR LIMIT=50] -->
|
||||
|
@@ -28,8 +28,8 @@
|
||||
android:title="@string/credman_chosen_app_title">
|
||||
|
||||
<com.android.settings.widget.GearPreference
|
||||
android:fragment="com.android.settings.applications.credentials.DefaultCombinedPicker"
|
||||
android:key="default_credman_autofill_main"
|
||||
android:fragment="com.android.settings.applications.credentials.DefaultCombinedPickerWork"
|
||||
android:key="default_credman_autofill_main_work"
|
||||
android:title="@string/credman_chosen_app_title"
|
||||
settings:searchable="false">
|
||||
<extra
|
||||
|
@@ -86,7 +86,7 @@ public class AccountDashboardFragment extends DashboardFragment {
|
||||
forceUpdatePreferences();
|
||||
}
|
||||
};
|
||||
cmpp.init(this, getFragmentManager(), getIntent(), delegate);
|
||||
cmpp.init(this, getFragmentManager(), getIntent(), delegate, /*isWorkProfile=*/false);
|
||||
} else {
|
||||
getSettingsLifecycle().addObserver(use(PasswordsPreferenceController.class));
|
||||
}
|
||||
|
@@ -78,7 +78,7 @@ public class AccountPersonalDashboardFragment extends DashboardFragment {
|
||||
forceUpdatePreferences();
|
||||
}
|
||||
};
|
||||
cmpp.init(this, getFragmentManager(), getIntent(), delegate);
|
||||
cmpp.init(this, getFragmentManager(), getIntent(), delegate, /*isWorkProfile=*/false);
|
||||
} else {
|
||||
getSettingsLifecycle().addObserver(use(PasswordsPreferenceController.class));
|
||||
}
|
||||
|
@@ -78,7 +78,7 @@ public class AccountWorkProfileDashboardFragment extends DashboardFragment {
|
||||
forceUpdatePreferences();
|
||||
}
|
||||
};
|
||||
cmpp.init(this, getFragmentManager(), getIntent(), delegate);
|
||||
cmpp.init(this, getFragmentManager(), getIntent(), delegate, /*isWorkProfile=*/true);
|
||||
} else {
|
||||
getSettingsLifecycle().addObserver(use(PasswordsPreferenceController.class));
|
||||
}
|
||||
|
@@ -56,7 +56,7 @@ public class ClonedAppsPreferenceController extends BasePreferenceController
|
||||
@Override
|
||||
public int getAvailabilityStatus() {
|
||||
return DeviceConfig.getBoolean(DeviceConfig.NAMESPACE_APP_CLONING,
|
||||
PROPERTY_CLONED_APPS_ENABLED, false)
|
||||
PROPERTY_CLONED_APPS_ENABLED, true)
|
||||
&& mContext.getResources().getBoolean(R.bool.config_cloned_apps_page_enabled)
|
||||
? AVAILABLE : UNSUPPORTED_ON_DEVICE;
|
||||
}
|
||||
|
@@ -26,6 +26,7 @@ import android.credentials.CredentialProviderInfo;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.service.autofill.AutofillServiceInfo;
|
||||
import android.text.TextUtils;
|
||||
import android.util.IconDrawableFactory;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
@@ -83,11 +84,12 @@ public final class CombinedProviderInfo {
|
||||
|
||||
/** Returns the app icon. */
|
||||
@Nullable
|
||||
public Drawable getAppIcon(@NonNull Context context) {
|
||||
public Drawable getAppIcon(@NonNull Context context, int userId) {
|
||||
IconDrawableFactory factory = IconDrawableFactory.newInstance(context);
|
||||
Drawable icon = null;
|
||||
ServiceInfo brandingService = getBrandingService();
|
||||
if (brandingService != null) {
|
||||
icon = brandingService.loadIcon(context.getPackageManager());
|
||||
icon = factory.getBadgedIcon(brandingService, getApplicationInfo(), userId);
|
||||
}
|
||||
|
||||
// If the branding service gave us a icon then use that.
|
||||
@@ -95,8 +97,8 @@ public final class CombinedProviderInfo {
|
||||
return icon;
|
||||
}
|
||||
|
||||
// Otherwise fallback to the app label and then the package name.
|
||||
return getApplicationInfo().loadIcon(context.getPackageManager());
|
||||
// Otherwise fallback to the app icon and then the package name.
|
||||
return factory.getBadgedIcon(getApplicationInfo(), userId);
|
||||
}
|
||||
|
||||
/** Returns the app name. */
|
||||
|
@@ -41,6 +41,7 @@ import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.OutcomeReceiver;
|
||||
import android.os.UserHandle;
|
||||
import android.os.UserManager;
|
||||
import android.provider.Settings;
|
||||
import android.service.autofill.AutofillServiceInfo;
|
||||
import android.text.TextUtils;
|
||||
@@ -110,6 +111,7 @@ public class CredentialManagerPreferenceController extends BasePreferenceControl
|
||||
private @Nullable PreferenceScreen mPreferenceScreen = null;
|
||||
|
||||
private boolean mVisibility = false;
|
||||
private boolean mIsWorkProfile = false;
|
||||
|
||||
public CredentialManagerPreferenceController(Context context, String preferenceKey) {
|
||||
super(context, preferenceKey);
|
||||
@@ -169,14 +171,17 @@ public class CredentialManagerPreferenceController extends BasePreferenceControl
|
||||
* @param fragmentManager the fragment manager to use
|
||||
* @param intent the intent used to start the activity
|
||||
* @param delegate the delegate to send results back to
|
||||
* @param isWorkProfile whether this controller is under a work profile user
|
||||
*/
|
||||
public void init(
|
||||
DashboardFragment fragment,
|
||||
FragmentManager fragmentManager,
|
||||
@Nullable Intent launchIntent,
|
||||
@NonNull Delegate delegate) {
|
||||
@NonNull Delegate delegate,
|
||||
boolean isWorkProfile) {
|
||||
fragment.getSettingsLifecycle().addObserver(this);
|
||||
mFragmentManager = fragmentManager;
|
||||
mIsWorkProfile = isWorkProfile;
|
||||
setDelegate(delegate);
|
||||
verifyReceivedIntent(launchIntent);
|
||||
}
|
||||
@@ -420,7 +425,7 @@ public class CredentialManagerPreferenceController extends BasePreferenceControl
|
||||
continue;
|
||||
}
|
||||
|
||||
Drawable icon = combinedInfo.getAppIcon(context);
|
||||
Drawable icon = combinedInfo.getAppIcon(context, getUser());
|
||||
CharSequence title = combinedInfo.getAppName(context);
|
||||
|
||||
// Build the pref and add it to the output & group.
|
||||
@@ -523,16 +528,24 @@ public class CredentialManagerPreferenceController extends BasePreferenceControl
|
||||
boolean isChecked = pref.isChecked();
|
||||
|
||||
if (isChecked) {
|
||||
// Since we are enabling it we should confirm the user decision with a
|
||||
// dialog box.
|
||||
NewProviderConfirmationDialogFragment fragment =
|
||||
newNewProviderConfirmationDialogFragment(
|
||||
packageName, title, /* setActivityResult= */ false);
|
||||
if (fragment == null || mFragmentManager == null) {
|
||||
return true;
|
||||
}
|
||||
if (togglePackageNameEnabled(packageName)) {
|
||||
// Enable all prefs.
|
||||
if (mPrefs.containsKey(packageName)) {
|
||||
mPrefs.get(packageName).setChecked(true);
|
||||
}
|
||||
} else {
|
||||
// Since we failed to show toggle the switch back to off.
|
||||
pref.setChecked(false);
|
||||
|
||||
fragment.show(mFragmentManager, NewProviderConfirmationDialogFragment.TAG);
|
||||
// Show the error if too many enabled.
|
||||
final DialogFragment fragment = newErrorDialogFragment();
|
||||
|
||||
if (fragment == null || mFragmentManager == null) {
|
||||
return true;
|
||||
}
|
||||
|
||||
fragment.show(mFragmentManager, ErrorDialogFragment.TAG);
|
||||
}
|
||||
|
||||
return true;
|
||||
} else {
|
||||
@@ -681,9 +694,12 @@ public class CredentialManagerPreferenceController extends BasePreferenceControl
|
||||
return new ConfirmationDialogFragment(host, packageName, appName);
|
||||
}
|
||||
|
||||
private int getUser() {
|
||||
UserHandle workUser = getWorkProfileUser();
|
||||
return workUser != null ? workUser.getIdentifier() : UserHandle.myUserId();
|
||||
protected int getUser() {
|
||||
if (mIsWorkProfile) {
|
||||
UserHandle workProfile = Utils.getManagedProfile(UserManager.get(mContext));
|
||||
return workProfile.getIdentifier();
|
||||
}
|
||||
return UserHandle.myUserId();
|
||||
}
|
||||
|
||||
/** Called when the dialog button is clicked. */
|
||||
@@ -851,6 +867,9 @@ public class CredentialManagerPreferenceController extends BasePreferenceControl
|
||||
private final Uri mCredentialService =
|
||||
Settings.Secure.getUriFor(Settings.Secure.CREDENTIAL_SERVICE);
|
||||
|
||||
private final Uri mCredentialPrimaryService =
|
||||
Settings.Secure.getUriFor(Settings.Secure.CREDENTIAL_SERVICE_PRIMARY);
|
||||
|
||||
public SettingContentObserver(Handler handler) {
|
||||
super(handler);
|
||||
}
|
||||
@@ -858,6 +877,8 @@ public class CredentialManagerPreferenceController extends BasePreferenceControl
|
||||
public void register(ContentResolver contentResolver) {
|
||||
contentResolver.registerContentObserver(mAutofillService, false, this, getUser());
|
||||
contentResolver.registerContentObserver(mCredentialService, false, this, getUser());
|
||||
contentResolver.registerContentObserver(
|
||||
mCredentialPrimaryService, false, this, getUser());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -47,9 +47,7 @@ import com.android.settingslib.utils.ThreadUtils;
|
||||
import com.android.settingslib.widget.CandidateInfo;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
public class DefaultCombinedPicker extends DefaultAppPickerFragment {
|
||||
|
||||
@@ -65,6 +63,7 @@ public class DefaultCombinedPicker extends DefaultAppPickerFragment {
|
||||
private DialogInterface.OnClickListener mCancelListener;
|
||||
|
||||
private CredentialManager mCredentialManager;
|
||||
private int mIntentSenderUserId = -1;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
@@ -79,9 +78,11 @@ public class DefaultCombinedPicker extends DefaultAppPickerFragment {
|
||||
};
|
||||
// If mCancelListener is not null, fragment is started from
|
||||
// ACTION_REQUEST_SET_AUTOFILL_SERVICE and we should always use the calling uid.
|
||||
mUserId = UserHandle.myUserId();
|
||||
mIntentSenderUserId = UserHandle.myUserId();
|
||||
}
|
||||
|
||||
getUser();
|
||||
|
||||
mSettingsPackageMonitor.register(activity, activity.getMainLooper(), false);
|
||||
update();
|
||||
}
|
||||
@@ -167,7 +168,7 @@ public class DefaultCombinedPicker extends DefaultAppPickerFragment {
|
||||
Settings.Secure.getStringForUser(
|
||||
getActivity().getContentResolver(),
|
||||
Settings.Secure.AUTOFILL_SERVICE_SEARCH_URI,
|
||||
mUserId);
|
||||
getUser());
|
||||
if (TextUtils.isEmpty(searchUri)) {
|
||||
return null;
|
||||
}
|
||||
@@ -177,7 +178,7 @@ public class DefaultCombinedPicker extends DefaultAppPickerFragment {
|
||||
final Preference preference = new Preference(context);
|
||||
preference.setOnPreferenceClickListener(
|
||||
p -> {
|
||||
context.startActivityAsUser(addNewServiceIntent, UserHandle.of(mUserId));
|
||||
context.startActivityAsUser(addNewServiceIntent, UserHandle.of(getUser()));
|
||||
return true;
|
||||
});
|
||||
preference.setTitle(R.string.print_menu_item_add_service);
|
||||
@@ -212,17 +213,17 @@ public class DefaultCombinedPicker extends DefaultAppPickerFragment {
|
||||
private List<CombinedProviderInfo> getAllProviders() {
|
||||
final Context context = getContext();
|
||||
final List<AutofillServiceInfo> autofillProviders =
|
||||
AutofillServiceInfo.getAvailableServices(context, mUserId);
|
||||
AutofillServiceInfo.getAvailableServices(context, getUser());
|
||||
|
||||
final CredentialManager service = getCredentialProviderService();
|
||||
final List<CredentialProviderInfo> credManProviders = new ArrayList<>();
|
||||
if (service != null) {
|
||||
credManProviders.addAll(
|
||||
service.getCredentialProviderServices(
|
||||
mUserId, CredentialManager.PROVIDER_FILTER_USER_PROVIDERS_ONLY));
|
||||
getUser(), CredentialManager.PROVIDER_FILTER_USER_PROVIDERS_ONLY));
|
||||
}
|
||||
|
||||
final String selectedAutofillProvider = getSelectedAutofillProvider(context, mUserId);
|
||||
final String selectedAutofillProvider = getSelectedAutofillProvider(context, getUser());
|
||||
return CombinedProviderInfo.buildMergedList(
|
||||
autofillProviders, credManProviders, selectedAutofillProvider);
|
||||
}
|
||||
@@ -244,7 +245,7 @@ public class DefaultCombinedPicker extends DefaultAppPickerFragment {
|
||||
new DefaultAppInfo(
|
||||
context,
|
||||
mPm,
|
||||
mUserId,
|
||||
getUser(),
|
||||
cpi.getApplicationInfo(),
|
||||
cpi.getSettingsSubtitle(),
|
||||
true));
|
||||
@@ -253,7 +254,7 @@ public class DefaultCombinedPicker extends DefaultAppPickerFragment {
|
||||
new DefaultAppInfo(
|
||||
context,
|
||||
mPm,
|
||||
mUserId,
|
||||
getUser(),
|
||||
brandingService,
|
||||
cpi.getSettingsSubtitle(),
|
||||
true));
|
||||
@@ -350,7 +351,7 @@ public class DefaultCombinedPicker extends DefaultAppPickerFragment {
|
||||
}
|
||||
|
||||
Settings.Secure.putStringForUser(
|
||||
getContext().getContentResolver(), AUTOFILL_SETTING, autofillProvider, mUserId);
|
||||
getContext().getContentResolver(), AUTOFILL_SETTING, autofillProvider, getUser());
|
||||
|
||||
final CredentialManager service = getCredentialProviderService();
|
||||
if (service == null) {
|
||||
@@ -362,19 +363,24 @@ public class DefaultCombinedPicker extends DefaultAppPickerFragment {
|
||||
final List<String> credManProviders = new ArrayList<>();
|
||||
for (CredentialProviderInfo cpi :
|
||||
service.getCredentialProviderServices(
|
||||
mUserId, CredentialManager.PROVIDER_FILTER_USER_PROVIDERS_ONLY)) {
|
||||
getUser(), CredentialManager.PROVIDER_FILTER_USER_PROVIDERS_ONLY)) {
|
||||
|
||||
if (cpi.isEnabled()) {
|
||||
if (cpi.isEnabled() && !cpi.isPrimary()) {
|
||||
credManProviders.add(cpi.getServiceInfo().getComponentName().flattenToString());
|
||||
}
|
||||
}
|
||||
|
||||
credManProviders.addAll(primaryCredManProviders);
|
||||
|
||||
// If there is no provider then clear all the providers.
|
||||
if (TextUtils.isEmpty(autofillProvider) && primaryCredManProviders.isEmpty()) {
|
||||
credManProviders.clear();
|
||||
}
|
||||
|
||||
service.setEnabledProviders(
|
||||
primaryCredManProviders,
|
||||
credManProviders,
|
||||
mUserId,
|
||||
getUser(),
|
||||
ContextCompat.getMainExecutor(getContext()),
|
||||
new OutcomeReceiver<Void, SetEnabledProvidersException>() {
|
||||
@Override
|
||||
@@ -388,4 +394,11 @@ public class DefaultCombinedPicker extends DefaultAppPickerFragment {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
protected int getUser() {
|
||||
if (mIntentSenderUserId >= 0) {
|
||||
return mIntentSenderUserId;
|
||||
}
|
||||
return UserHandle.myUserId();
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* 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.applications.credentials;
|
||||
|
||||
import android.os.UserHandle;
|
||||
import android.os.UserManager;
|
||||
|
||||
import com.android.settings.Utils;
|
||||
|
||||
public class DefaultCombinedPickerWork extends DefaultCombinedPicker {
|
||||
|
||||
@Override
|
||||
protected int getUser() {
|
||||
UserHandle workProfile = Utils.getManagedProfile(UserManager.get(getContext()));
|
||||
return workProfile.getIdentifier();
|
||||
}
|
||||
}
|
@@ -24,6 +24,7 @@ import android.content.pm.ResolveInfo;
|
||||
import android.content.pm.ServiceInfo;
|
||||
import android.credentials.CredentialManager;
|
||||
import android.credentials.CredentialProviderInfo;
|
||||
import android.os.UserHandle;
|
||||
import android.provider.Settings;
|
||||
import android.service.autofill.AutofillService;
|
||||
import android.service.autofill.AutofillServiceInfo;
|
||||
@@ -75,13 +76,13 @@ public class DefaultCombinedPreferenceController extends DefaultAppPreferenceCon
|
||||
return null;
|
||||
}
|
||||
final AutofillSettingIntentProvider intentProvider =
|
||||
new AutofillSettingIntentProvider(mContext, mUserId, info.getKey());
|
||||
new AutofillSettingIntentProvider(mContext, getUser(), info.getKey());
|
||||
return intentProvider.getIntent();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected DefaultAppInfo getDefaultAppInfo() {
|
||||
List<CombinedProviderInfo> providers = getAllProviders(mUserId);
|
||||
List<CombinedProviderInfo> providers = getAllProviders(getUser());
|
||||
CombinedProviderInfo topProvider = CombinedProviderInfo.getTopProvider(providers);
|
||||
if (topProvider != null) {
|
||||
ServiceInfo brandingService = topProvider.getBrandingService();
|
||||
@@ -89,7 +90,7 @@ public class DefaultCombinedPreferenceController extends DefaultAppPreferenceCon
|
||||
return new DefaultAppInfo(
|
||||
mContext,
|
||||
mPackageManager,
|
||||
mUserId,
|
||||
getUser(),
|
||||
topProvider.getApplicationInfo(),
|
||||
topProvider.getSettingsSubtitle(),
|
||||
true);
|
||||
@@ -97,7 +98,7 @@ public class DefaultCombinedPreferenceController extends DefaultAppPreferenceCon
|
||||
return new DefaultAppInfo(
|
||||
mContext,
|
||||
mPackageManager,
|
||||
mUserId,
|
||||
getUser(),
|
||||
brandingService,
|
||||
topProvider.getSettingsSubtitle(),
|
||||
true);
|
||||
@@ -178,4 +179,8 @@ public class DefaultCombinedPreferenceController extends DefaultAppPreferenceCon
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
protected int getUser() {
|
||||
return UserHandle.myUserId();
|
||||
}
|
||||
}
|
||||
|
@@ -44,7 +44,7 @@ public class DefaultWorkCombinedPreferenceController extends DefaultCombinedPref
|
||||
|
||||
@Override
|
||||
public String getPreferenceKey() {
|
||||
return "default_autofill_work";
|
||||
return "default_credman_autofill_main_work";
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -81,4 +81,9 @@ public class DefaultWorkCombinedPreferenceController extends DefaultCombinedPref
|
||||
protected void startActivity(Intent intent) {
|
||||
mContext.startActivityAsUser(intent, mUserHandle);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getUser() {
|
||||
return mUserHandle.getIdentifier();
|
||||
}
|
||||
}
|
||||
|
@@ -880,7 +880,7 @@ public class ManageApplications extends InstrumentedFragment
|
||||
mOptionsMenu.findItem(R.id.delete_all_app_clones)
|
||||
.setVisible(mListType == LIST_TYPE_CLONED_APPS && DeviceConfig.getBoolean(
|
||||
DeviceConfig.NAMESPACE_APP_CLONING, PROPERTY_DELETE_ALL_APP_CLONES_ENABLED,
|
||||
false) && Utils.getCloneUserId(getContext()) != -1);
|
||||
true) && Utils.getCloneUserId(getContext()) != -1);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -326,8 +326,8 @@ public class BiometricEnrollActivity extends InstrumentedActivity {
|
||||
}
|
||||
}
|
||||
|
||||
boolean canUseFace = mIsFaceEnrollable;
|
||||
boolean canUseFingerprint = mIsFingerprintEnrollable;
|
||||
boolean canUseFace = mHasFeatureFace;
|
||||
boolean canUseFingerprint = mHasFeatureFingerprint;
|
||||
if (mParentalOptionsRequired) {
|
||||
if (mParentalOptions == null) {
|
||||
throw new IllegalStateException("consent options required, but not set");
|
||||
@@ -345,10 +345,12 @@ public class BiometricEnrollActivity extends InstrumentedActivity {
|
||||
} else if (canUseFace || canUseFingerprint) {
|
||||
if (mGkPwHandle == null) {
|
||||
setOrConfirmCredentialsNow();
|
||||
} else if (canUseFingerprint) {
|
||||
} else if (canUseFingerprint && mIsFingerprintEnrollable) {
|
||||
launchFingerprintOnlyEnroll();
|
||||
} else {
|
||||
} else if (canUseFace && mIsFaceEnrollable) {
|
||||
launchFaceOnlyEnroll();
|
||||
} else {
|
||||
setOrConfirmCredentialsNow();
|
||||
}
|
||||
} else { // no modalities available
|
||||
if (mParentalOptionsRequired) {
|
||||
|
@@ -75,7 +75,7 @@ public class ActiveUnlockStatusUtils {
|
||||
* used.
|
||||
*/
|
||||
public boolean useUnlockIntentLayout() {
|
||||
return isAvailable() && UNLOCK_INTENT_LAYOUT.equals(getFlagState());
|
||||
return isAvailable();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -84,7 +84,7 @@ public class ActiveUnlockStatusUtils {
|
||||
* should be used.
|
||||
*/
|
||||
public boolean useBiometricFailureLayout() {
|
||||
return isAvailable() && BIOMETRIC_FAILURE_LAYOUT.equals(getFlagState());
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -156,10 +156,6 @@ public class ActiveUnlockStatusUtils {
|
||||
if (!Utils.hasFingerprintHardware(mContext) && !Utils.hasFaceHardware(mContext)) {
|
||||
return BasePreferenceController.UNSUPPORTED_ON_DEVICE;
|
||||
}
|
||||
if (!UNLOCK_INTENT_LAYOUT.equals(getFlagState())
|
||||
&& !BIOMETRIC_FAILURE_LAYOUT.equals(getFlagState())) {
|
||||
return BasePreferenceController.CONDITIONALLY_UNAVAILABLE;
|
||||
}
|
||||
if (getAuthority() != null && getIntent() != null) {
|
||||
return BasePreferenceController.AVAILABLE;
|
||||
}
|
||||
@@ -268,6 +264,30 @@ public class ActiveUnlockStatusUtils {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the preference title of how to use biometrics when active unlock is enabled.
|
||||
*/
|
||||
public String getUseBiometricTitleForActiveUnlock() {
|
||||
final boolean faceAllowed = Utils.hasFaceHardware(mContext);
|
||||
final boolean fingerprintAllowed = Utils.hasFingerprintHardware(mContext);
|
||||
|
||||
return mContext.getString(getUseBiometricTitleRes(faceAllowed, fingerprintAllowed));
|
||||
}
|
||||
|
||||
@StringRes
|
||||
private static int getUseBiometricTitleRes(
|
||||
boolean isFaceAllowed, boolean isFingerprintAllowed) {
|
||||
if (isFaceAllowed && isFingerprintAllowed) {
|
||||
return R.string.biometric_settings_use_face_fingerprint_or_watch_for;
|
||||
} else if (isFaceAllowed) {
|
||||
return R.string.biometric_settings_use_face_or_watch_for;
|
||||
} else if (isFingerprintAllowed) {
|
||||
return R.string.biometric_settings_use_fingerprint_or_watch_for;
|
||||
} else {
|
||||
return R.string.biometric_settings_use_watch_for;
|
||||
}
|
||||
}
|
||||
|
||||
private static String getFlagState() {
|
||||
return DeviceConfig.getProperty(DeviceConfig.NAMESPACE_REMOTE_AUTH, CONFIG_FLAG_NAME);
|
||||
}
|
||||
|
@@ -46,6 +46,7 @@ public class CombinedBiometricSettings extends BiometricsSettingsBase {
|
||||
private static final String KEY_UNLOCK_PHONE = "biometric_settings_biometric_keyguard";
|
||||
private static final String KEY_USE_IN_APPS = "biometric_settings_biometric_app";
|
||||
private static final String KEY_INTRO_PREFERENCE = "biometric_intro";
|
||||
private static final String KEY_USE_BIOMETRIC_PREFERENCE = "biometric_ways_to_use";
|
||||
|
||||
private ActiveUnlockStatusUtils mActiveUnlockStatusUtils;
|
||||
private CombinedBiometricStatusUtils mCombinedBiometricStatusUtils;
|
||||
@@ -83,6 +84,11 @@ public class CombinedBiometricSettings extends BiometricsSettingsBase {
|
||||
if (introPreference != null) {
|
||||
introPreference.setTitle(mActiveUnlockStatusUtils.getIntroForActiveUnlock());
|
||||
}
|
||||
final Preference useBiometricPreference = findPreference(KEY_USE_BIOMETRIC_PREFERENCE);
|
||||
if (useBiometricPreference != null) {
|
||||
useBiometricPreference.setTitle(
|
||||
mActiveUnlockStatusUtils.getUseBiometricTitleForActiveUnlock());
|
||||
}
|
||||
getActivity().setTitle(mActiveUnlockStatusUtils.getTitleForActiveUnlock());
|
||||
}
|
||||
|
||||
|
@@ -168,15 +168,12 @@ public class LocaleDialogFragment extends InstrumentedDialogFragment {
|
||||
if (mResultReceiver != null && mDialogType == DIALOG_CONFIRM_SYSTEM_DEFAULT) {
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putInt(ARG_DIALOG_TYPE, DIALOG_CONFIRM_SYSTEM_DEFAULT);
|
||||
boolean changed = false;
|
||||
if (which == DialogInterface.BUTTON_POSITIVE) {
|
||||
changed = true;
|
||||
mResultReceiver.send(Activity.RESULT_OK, bundle);
|
||||
} else if (which == DialogInterface.BUTTON_NEGATIVE) {
|
||||
mResultReceiver.send(Activity.RESULT_CANCELED, bundle);
|
||||
}
|
||||
mMetricsFeatureProvider.action(mContext,
|
||||
SettingsEnums.ACTION_CHANGE_LANGUAGE, changed);
|
||||
mMetricsFeatureProvider.action(mContext, SettingsEnums.ACTION_CHANGE_LANGUAGE);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -21,6 +21,7 @@ import android.text.BidiFormatter;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.Utils;
|
||||
import com.android.settings.activityembedding.ActivityEmbeddingUtils;
|
||||
import com.android.settings.core.BasePreferenceController;
|
||||
|
||||
public class TopLevelNetworkEntryPreferenceController extends BasePreferenceController {
|
||||
@@ -34,7 +35,11 @@ public class TopLevelNetworkEntryPreferenceController extends BasePreferenceCont
|
||||
|
||||
@Override
|
||||
public int getAvailabilityStatus() {
|
||||
return Utils.isDemoUser(mContext) ? UNSUPPORTED_ON_DEVICE : AVAILABLE;
|
||||
// TODO(b/281597506): Update the ActivityEmbeddingUtils.isEmbeddingActivityEnabled
|
||||
// while getting the new API.
|
||||
return (Utils.isDemoUser(mContext)
|
||||
&& !ActivityEmbeddingUtils.isEmbeddingActivityEnabled(mContext))
|
||||
? UNSUPPORTED_ON_DEVICE : AVAILABLE;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -26,25 +26,17 @@ import com.android.settingslib.mobile.dataservice.SubscriptionInfoEntity;
|
||||
|
||||
public class CallsDefaultSubscriptionController extends DefaultSubscriptionController {
|
||||
|
||||
private SubscriptionInfoEntity mSubscriptionInfoEntity;
|
||||
|
||||
public CallsDefaultSubscriptionController(Context context, String preferenceKey,
|
||||
Lifecycle lifecycle, LifecycleOwner lifecycleOwner) {
|
||||
super(context, preferenceKey, lifecycle, lifecycleOwner);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SubscriptionInfoEntity getDefaultSubscriptionInfo() {
|
||||
return mSubscriptionInfoEntity;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getDefaultSubscriptionId() {
|
||||
int defaultCallSubId = SubscriptionManager.getDefaultVoiceSubscriptionId();
|
||||
for (SubscriptionInfoEntity subInfo : mSubInfoEntityList) {
|
||||
int subId = subInfo.getSubId();
|
||||
if (subInfo.isActiveSubscriptionId && subId == defaultCallSubId) {
|
||||
mSubscriptionInfoEntity = subInfo;
|
||||
return subId;
|
||||
}
|
||||
}
|
||||
|
@@ -19,11 +19,7 @@ package com.android.settings.network.telephony;
|
||||
import static androidx.lifecycle.Lifecycle.Event.ON_PAUSE;
|
||||
import static androidx.lifecycle.Lifecycle.Event.ON_RESUME;
|
||||
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.telecom.PhoneAccount;
|
||||
import android.telecom.PhoneAccountHandle;
|
||||
import android.telecom.TelecomManager;
|
||||
import android.telephony.SubscriptionManager;
|
||||
import android.view.View;
|
||||
|
||||
@@ -57,15 +53,10 @@ public abstract class DefaultSubscriptionController extends TelephonyBasePrefere
|
||||
|
||||
protected ListPreference mPreference;
|
||||
protected SubscriptionManager mManager;
|
||||
protected TelecomManager mTelecomManager;
|
||||
protected MobileNetworkRepository mMobileNetworkRepository;
|
||||
protected LifecycleOwner mLifecycleOwner;
|
||||
private DefaultSubscriptionReceiver mDataSubscriptionChangedReceiver;
|
||||
|
||||
private static final String EMERGENCY_ACCOUNT_HANDLE_ID = "E";
|
||||
private static final ComponentName PSTN_CONNECTION_SERVICE_COMPONENT =
|
||||
new ComponentName("com.android.phone",
|
||||
"com.android.services.telephony.TelephonyConnectionService");
|
||||
private boolean mIsRtlMode;
|
||||
|
||||
List<SubscriptionInfoEntity> mSubInfoEntityList = new ArrayList<>();
|
||||
@@ -84,10 +75,6 @@ public abstract class DefaultSubscriptionController extends TelephonyBasePrefere
|
||||
}
|
||||
}
|
||||
|
||||
/** @return SubscriptionInfo for the default subscription for the service, or null if there
|
||||
* isn't one. */
|
||||
protected abstract SubscriptionInfoEntity getDefaultSubscriptionInfo();
|
||||
|
||||
/** @return the id of the default subscription for the service, or
|
||||
* SubscriptionManager.INVALID_SUBSCRIPTION_ID if there isn't one. */
|
||||
protected abstract int getDefaultSubscriptionId();
|
||||
@@ -125,6 +112,8 @@ public abstract class DefaultSubscriptionController extends TelephonyBasePrefere
|
||||
public void displayPreference(PreferenceScreen screen) {
|
||||
super.displayPreference(screen);
|
||||
mPreference = screen.findPreference(getPreferenceKey());
|
||||
// Set a summary placeholder to reduce flicker.
|
||||
mPreference.setSummaryProvider(pref -> mContext.getString(R.string.summary_placeholder));
|
||||
updateEntries();
|
||||
}
|
||||
|
||||
@@ -133,31 +122,11 @@ public abstract class DefaultSubscriptionController extends TelephonyBasePrefere
|
||||
// Currently, cannot use ListPreference.setSummary() when the summary contains user
|
||||
// generated string, because ListPreference.getSummary() is using String.format() to format
|
||||
// the summary when the summary is set by ListPreference.setSummary().
|
||||
if (preference != null) {
|
||||
if (preference != null && !mSubInfoEntityList.isEmpty()) {
|
||||
preference.setSummaryProvider(pref -> getSummary());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public CharSequence getSummary() {
|
||||
final PhoneAccountHandle handle = getDefaultCallingAccountHandle();
|
||||
if ((handle != null) && (!isCallingAccountBindToSubscription(handle))) {
|
||||
// display VoIP account in summary when configured through settings within dialer
|
||||
return getLabelFromCallingAccount(handle);
|
||||
}
|
||||
final SubscriptionInfoEntity info = getDefaultSubscriptionInfo();
|
||||
if (info != null) {
|
||||
// display subscription based account
|
||||
return info.uniqueName;
|
||||
} else {
|
||||
if (isAskEverytimeSupported()) {
|
||||
return mContext.getString(R.string.calls_and_sms_ask_every_time);
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
void updateEntries() {
|
||||
if (mPreference == null) {
|
||||
@@ -179,6 +148,7 @@ public abstract class DefaultSubscriptionController extends TelephonyBasePrefere
|
||||
final ArrayList<CharSequence> displayNames = new ArrayList<>();
|
||||
final ArrayList<CharSequence> subscriptionIds = new ArrayList<>();
|
||||
List<SubscriptionInfoEntity> list = getSubscriptionInfoList();
|
||||
if (list.isEmpty()) return;
|
||||
|
||||
if (list.size() == 1) {
|
||||
mPreference.setEnabled(false);
|
||||
@@ -218,76 +188,6 @@ public abstract class DefaultSubscriptionController extends TelephonyBasePrefere
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get default calling account
|
||||
*
|
||||
* @return current calling account {@link PhoneAccountHandle}
|
||||
*/
|
||||
public PhoneAccountHandle getDefaultCallingAccountHandle() {
|
||||
final PhoneAccountHandle currentSelectPhoneAccount =
|
||||
getTelecomManager().getUserSelectedOutgoingPhoneAccount();
|
||||
if (currentSelectPhoneAccount == null) {
|
||||
return null;
|
||||
}
|
||||
final List<PhoneAccountHandle> accountHandles =
|
||||
getTelecomManager().getCallCapablePhoneAccounts(false);
|
||||
final PhoneAccountHandle emergencyAccountHandle = new PhoneAccountHandle(
|
||||
PSTN_CONNECTION_SERVICE_COMPONENT, EMERGENCY_ACCOUNT_HANDLE_ID);
|
||||
if (currentSelectPhoneAccount.equals(emergencyAccountHandle)) {
|
||||
return null;
|
||||
}
|
||||
for (PhoneAccountHandle handle : accountHandles) {
|
||||
if (currentSelectPhoneAccount.equals(handle)) {
|
||||
return currentSelectPhoneAccount;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
TelecomManager getTelecomManager() {
|
||||
if (mTelecomManager == null) {
|
||||
mTelecomManager = mContext.getSystemService(TelecomManager.class);
|
||||
}
|
||||
return mTelecomManager;
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
PhoneAccount getPhoneAccount(PhoneAccountHandle handle) {
|
||||
return getTelecomManager().getPhoneAccount(handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if calling account bind to subscription
|
||||
*
|
||||
* @param handle {@link PhoneAccountHandle} for specific calling account
|
||||
*/
|
||||
public boolean isCallingAccountBindToSubscription(PhoneAccountHandle handle) {
|
||||
final PhoneAccount account = getPhoneAccount(handle);
|
||||
if (account == null) {
|
||||
return false;
|
||||
}
|
||||
return account.hasCapabilities(PhoneAccount.CAPABILITY_SIM_SUBSCRIPTION);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get label from calling account
|
||||
*
|
||||
* @param handle to get label from {@link PhoneAccountHandle}
|
||||
* @return label of calling account
|
||||
*/
|
||||
public CharSequence getLabelFromCallingAccount(PhoneAccountHandle handle) {
|
||||
CharSequence label = null;
|
||||
final PhoneAccount account = getPhoneAccount(handle);
|
||||
if (account != null) {
|
||||
label = account.getLabel();
|
||||
}
|
||||
if (label != null) {
|
||||
label = mContext.getPackageManager().getUserBadgedLabel(label, handle.getUserHandle());
|
||||
}
|
||||
return (label != null) ? label : "";
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
protected List<SubscriptionInfoEntity> getSubscriptionInfoList() {
|
||||
return mSubInfoEntityList;
|
||||
|
@@ -17,7 +17,6 @@
|
||||
package com.android.settings.network.telephony;
|
||||
|
||||
import android.content.Context;
|
||||
import android.telecom.PhoneAccountHandle;
|
||||
import android.telephony.SubscriptionManager;
|
||||
|
||||
import androidx.lifecycle.LifecycleOwner;
|
||||
@@ -28,7 +27,6 @@ import com.android.settingslib.mobile.dataservice.SubscriptionInfoEntity;
|
||||
public class SmsDefaultSubscriptionController extends DefaultSubscriptionController {
|
||||
|
||||
private final boolean mIsAskEverytimeSupported;
|
||||
private SubscriptionInfoEntity mSubscriptionInfoEntity;
|
||||
|
||||
public SmsDefaultSubscriptionController(Context context, String preferenceKey,
|
||||
Lifecycle lifecycle, LifecycleOwner lifecycleOwner) {
|
||||
@@ -37,18 +35,12 @@ public class SmsDefaultSubscriptionController extends DefaultSubscriptionControl
|
||||
.getBoolean(com.android.internal.R.bool.config_sms_ask_every_time_support);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SubscriptionInfoEntity getDefaultSubscriptionInfo() {
|
||||
return mSubscriptionInfoEntity;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getDefaultSubscriptionId() {
|
||||
int defaultSmsSubId = SubscriptionManager.getDefaultSmsSubscriptionId();
|
||||
for (SubscriptionInfoEntity subInfo : mSubInfoEntityList) {
|
||||
int subId = subInfo.getSubId();
|
||||
if (subInfo.isActiveSubscriptionId && subId == defaultSmsSubId) {
|
||||
mSubscriptionInfoEntity = subInfo;
|
||||
return subId;
|
||||
}
|
||||
}
|
||||
@@ -65,12 +57,6 @@ public class SmsDefaultSubscriptionController extends DefaultSubscriptionControl
|
||||
return mIsAskEverytimeSupported;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PhoneAccountHandle getDefaultCallingAccountHandle() {
|
||||
// Not supporting calling account override by VoIP
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CharSequence getSummary() {
|
||||
return MobileNetworkUtils.getPreferredStatus(isRtlMode(), mContext, false,
|
||||
|
@@ -798,7 +798,12 @@ public class ChooseLockPattern extends SettingsActivity {
|
||||
// If the stage changed, announce the header for accessibility. This
|
||||
// is a no-op when accessibility is disabled.
|
||||
if (previousStage != stage || announceAlways) {
|
||||
mHeaderText.announceForAccessibility(mHeaderText.getText());
|
||||
if (stage == Stage.NeedToConfirm) {
|
||||
// If the Stage is NeedToConfirm, move the a11y focus to the header.
|
||||
mHeaderText.requestAccessibilityFocus();
|
||||
} else {
|
||||
mHeaderText.announceForAccessibility(mHeaderText.getText());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -52,7 +52,12 @@ public class ConfirmDeviceCredentialUtils {
|
||||
IntentSender intentSender = activity.getIntent().getParcelableExtra(Intent.EXTRA_INTENT);
|
||||
if (intentSender != null) {
|
||||
try {
|
||||
activity.startIntentSenderForResult(intentSender, -1, null, 0, 0, 0);
|
||||
ActivityOptions activityOptions =
|
||||
ActivityOptions.makeBasic()
|
||||
.setPendingIntentBackgroundActivityStartMode(
|
||||
ActivityOptions.MODE_BACKGROUND_ACTIVITY_START_ALLOWED);
|
||||
activity.startIntentSenderForResult(intentSender, -1, null, 0, 0, 0,
|
||||
activityOptions.toBundle());
|
||||
} catch (IntentSender.SendIntentException e) {
|
||||
/* ignore */
|
||||
}
|
||||
|
@@ -153,7 +153,7 @@ public class NumberingSystemItemController extends BasePreferenceController {
|
||||
private void handleLanguageSelect(Preference preference) {
|
||||
String selectedLanguage = preference.getKey();
|
||||
mMetricsFeatureProvider.action(mContext,
|
||||
SettingsEnums.ACTION_CHOOSE_LANGUAGE_FOR_NUMBERS_PREFERENCES, selectedLanguage);
|
||||
SettingsEnums.ACTION_CHOOSE_LANGUAGE_FOR_NUMBERS_PREFERENCES);
|
||||
final Bundle extra = new Bundle();
|
||||
extra.putString(RegionalPreferencesEntriesFragment.ARG_KEY_REGIONAL_PREFERENCE,
|
||||
ARG_VALUE_NUMBERING_SYSTEM_SELECT);
|
||||
@@ -177,7 +177,7 @@ public class NumberingSystemItemController extends BasePreferenceController {
|
||||
saveNumberingSystemToLocale(Locale.forLanguageTag(mSelectedLanguage),
|
||||
numberingSystem);
|
||||
mMetricsFeatureProvider.action(mContext,
|
||||
SettingsEnums.ACTION_SET_NUMBERS_PREFERENCES, numberingSystem);
|
||||
SettingsEnums.ACTION_SET_NUMBERS_PREFERENCES);
|
||||
// After updated locale to framework, this fragment will recreate,
|
||||
// so it needs to update the argument of selected language.
|
||||
Bundle bundle = new Bundle();
|
||||
|
@@ -64,7 +64,7 @@ public abstract class RegionalPreferenceListBasePreferenceController extends
|
||||
pref.setOnPreferenceClickListener(clickedPref -> {
|
||||
setSelected(pref);
|
||||
RegionalPreferencesDataUtils.savePreference(mContext, getExtensionTypes(), item);
|
||||
mMetricsFeatureProvider.action(mContext, getMetricsActionKey(), item);
|
||||
mMetricsFeatureProvider.action(mContext, getMetricsActionKey());
|
||||
return true;
|
||||
});
|
||||
String value = RegionalPreferencesDataUtils.getDefaultUnicodeExtensionData(mContext,
|
||||
|
@@ -1,77 +0,0 @@
|
||||
/*
|
||||
* 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.sim.receivers;
|
||||
|
||||
import android.app.job.JobInfo;
|
||||
import android.app.job.JobParameters;
|
||||
import android.app.job.JobScheduler;
|
||||
import android.app.job.JobService;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.os.Handler;
|
||||
import android.os.HandlerThread;
|
||||
import android.util.Log;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.settingslib.utils.ThreadUtils;
|
||||
|
||||
import java.util.concurrent.Phaser;
|
||||
|
||||
/** A JobService work on SIM slot change. */
|
||||
public class SimSlotChangeService extends JobService {
|
||||
|
||||
private static final String TAG = "SimSlotChangeService";
|
||||
|
||||
/**
|
||||
* Schedules a service to work on SIM slot change.
|
||||
*
|
||||
* @param context is the caller context.
|
||||
*/
|
||||
public static void scheduleSimSlotChange(Context context) {
|
||||
Context appContext = context.getApplicationContext();
|
||||
JobScheduler jobScheduler = appContext.getSystemService(JobScheduler.class);
|
||||
ComponentName component = new ComponentName(appContext, SimSlotChangeService.class);
|
||||
|
||||
jobScheduler.schedule(
|
||||
new JobInfo.Builder(R.integer.sim_slot_changed, component).build());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onStartJob(JobParameters params) {
|
||||
|
||||
HandlerThread thread = new HandlerThread(TAG);
|
||||
thread.start();
|
||||
final Phaser blocker = new Phaser(1);
|
||||
Handler handler = new Handler(thread.getLooper());
|
||||
handler.post(() -> {
|
||||
try {
|
||||
SimSlotChangeReceiver.runOnBackgroundThread(this);
|
||||
} catch (Throwable exception) {
|
||||
Log.e(TAG, "Exception running job", exception);
|
||||
}
|
||||
blocker.arrive();
|
||||
});
|
||||
blocker.awaitAdvance(0);
|
||||
thread.quit();
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onStopJob(JobParameters params) {
|
||||
return false;
|
||||
}
|
||||
}
|
@@ -0,0 +1,68 @@
|
||||
/*
|
||||
* 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.sim.receivers
|
||||
|
||||
import android.app.job.JobInfo
|
||||
import android.app.job.JobParameters
|
||||
import android.app.job.JobScheduler
|
||||
import android.app.job.JobService
|
||||
import android.content.ComponentName
|
||||
import android.content.Context
|
||||
import android.util.Log
|
||||
import com.android.settings.R
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.Job
|
||||
import kotlinx.coroutines.SupervisorJob
|
||||
import kotlinx.coroutines.launch
|
||||
|
||||
/** A JobService work on SIM slot change. */
|
||||
class SimSlotChangeService : JobService() {
|
||||
private var job: Job? = null
|
||||
|
||||
override fun onStartJob(params: JobParameters): Boolean {
|
||||
job = CoroutineScope(Dispatchers.Default + SupervisorJob()).launch {
|
||||
try {
|
||||
SimSlotChangeReceiver.runOnBackgroundThread(this@SimSlotChangeService)
|
||||
} catch (exception: Throwable) {
|
||||
Log.e(TAG, "Exception running job", exception)
|
||||
}
|
||||
jobFinished(params, false)
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
override fun onStopJob(params: JobParameters): Boolean {
|
||||
job?.cancel()
|
||||
return false
|
||||
}
|
||||
|
||||
companion object {
|
||||
private const val TAG = "SimSlotChangeService"
|
||||
|
||||
/**
|
||||
* Schedules a service to work on SIM slot change.
|
||||
*
|
||||
* @param context is the caller context.
|
||||
*/
|
||||
@JvmStatic
|
||||
fun scheduleSimSlotChange(context: Context) {
|
||||
val component = ComponentName(context, SimSlotChangeService::class.java)
|
||||
val jobScheduler = context.getSystemService(JobScheduler::class.java)!!
|
||||
jobScheduler.schedule(JobInfo.Builder(R.integer.sim_slot_changed, component).build())
|
||||
}
|
||||
}
|
||||
}
|
@@ -50,6 +50,7 @@ import com.android.settings.wifi.tether.WifiTetherSecurityPreferenceController;
|
||||
import com.android.settingslib.core.lifecycle.Lifecycle;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.Mock;
|
||||
@@ -181,6 +182,7 @@ public class AllInOneTetherSettingsTest {
|
||||
.getPreferenceControllers(mContext)).isNotEmpty();
|
||||
}
|
||||
|
||||
@Ignore
|
||||
@Test
|
||||
public void createPreferenceControllers_hasAutoOffPreference() {
|
||||
assertThat(mAllInOneTetherSettings.createPreferenceControllers(mContext)
|
||||
|
@@ -31,6 +31,8 @@ import android.widget.TextView;
|
||||
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
|
||||
import com.android.settings.utils.ActivityControllerWrapper;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
@@ -60,7 +62,8 @@ public class MainClearConfirmTest {
|
||||
@Before
|
||||
public void setUp() {
|
||||
MockitoAnnotations.initMocks(this);
|
||||
mActivity = Robolectric.setupActivity(FragmentActivity.class);
|
||||
mActivity = spy((FragmentActivity) ActivityControllerWrapper.setup(
|
||||
Robolectric.buildActivity(FragmentActivity.class)).get());
|
||||
mMainClearConfirm = spy(new MainClearConfirm());
|
||||
}
|
||||
|
||||
|
@@ -51,10 +51,12 @@ import android.widget.ScrollView;
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
|
||||
import com.android.settings.testutils.shadow.ShadowUtils;
|
||||
import com.android.settings.utils.ActivityControllerWrapper;
|
||||
import com.android.settingslib.development.DevelopmentSettingsEnabler;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.ArgumentCaptor;
|
||||
@@ -106,7 +108,8 @@ public class MainClearTest {
|
||||
@Override
|
||||
boolean showAnySubscriptionInfo(Context context) { return true; }
|
||||
});
|
||||
mActivity = Robolectric.setupActivity(FragmentActivity.class);
|
||||
mActivity = spy((FragmentActivity) ActivityControllerWrapper.setup(
|
||||
Robolectric.buildActivity(FragmentActivity.class)).get());
|
||||
mShadowActivity = Shadows.shadowOf(mActivity);
|
||||
UserManager userManager = mActivity.getSystemService(UserManager.class);
|
||||
mShadowUserManager = Shadows.shadowOf(userManager);
|
||||
@@ -143,6 +146,7 @@ public class MainClearTest {
|
||||
.isTrue();
|
||||
}
|
||||
|
||||
@Ignore
|
||||
@Test
|
||||
public void testShowFinalConfirmation_eraseEsimVisible_eraseEsimUnchecked() {
|
||||
final Context context = mock(Context.class);
|
||||
@@ -228,6 +232,7 @@ public class MainClearTest {
|
||||
assertThat(mMainClear.showWipeEuicc()).isTrue();
|
||||
}
|
||||
|
||||
@Ignore
|
||||
@Test
|
||||
public void testShowWipeEuicc_developerMode_unprovisioned() {
|
||||
prepareEuiccState(
|
||||
|
@@ -18,14 +18,8 @@ package com.android.settings;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.spy;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Looper;
|
||||
import android.view.LayoutInflater;
|
||||
import android.widget.TextView;
|
||||
|
||||
@@ -33,10 +27,10 @@ import androidx.fragment.app.FragmentActivity;
|
||||
|
||||
import com.android.settings.testutils.shadow.ShadowBluetoothAdapter;
|
||||
import com.android.settings.testutils.shadow.ShadowRecoverySystem;
|
||||
import com.android.settings.utils.ActivityControllerWrapper;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.Mock;
|
||||
@@ -61,7 +55,8 @@ public class ResetNetworkConfirmTest {
|
||||
MockitoAnnotations.initMocks(this);
|
||||
|
||||
mResetNetworkConfirm = new ResetNetworkConfirm();
|
||||
mActivity = spy(Robolectric.setupActivity(FragmentActivity.class));
|
||||
mActivity = spy((FragmentActivity) ActivityControllerWrapper.setup(
|
||||
Robolectric.buildActivity(FragmentActivity.class)).get());
|
||||
mResetNetworkConfirm.mActivity = mActivity;
|
||||
}
|
||||
|
||||
|
@@ -27,6 +27,8 @@ import android.content.Intent;
|
||||
import android.view.View;
|
||||
import android.widget.CheckBox;
|
||||
|
||||
import com.android.settings.utils.ActivityControllerWrapper;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
@@ -41,7 +43,8 @@ public class ResetNetworkTest {
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
mActivity = Robolectric.setupActivity(Activity.class);
|
||||
mActivity = (Activity) ActivityControllerWrapper.setup(
|
||||
Robolectric.buildActivity(Activity.class)).get();
|
||||
mResetNetwork = spy(new ResetNetwork());
|
||||
when(mResetNetwork.getContext()).thenReturn(mActivity);
|
||||
mResetNetwork.mEsimContainer = new View(mActivity);
|
||||
|
@@ -30,6 +30,7 @@ import android.os.Bundle;
|
||||
import android.util.AttributeSet;
|
||||
|
||||
import com.android.settings.testutils.shadow.ShadowUserManager;
|
||||
import com.android.settings.utils.ActivityControllerWrapper;
|
||||
import com.android.settingslib.RestrictedPreferenceHelper;
|
||||
|
||||
import org.junit.Before;
|
||||
@@ -58,7 +59,8 @@ public class RestrictedListPreferenceTest {
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
mActivity = Robolectric.setupActivity(Activity.class);
|
||||
mActivity = (Activity) ActivityControllerWrapper.setup(
|
||||
Robolectric.buildActivity(Activity.class)).get();
|
||||
mShadowKeyguardManager =
|
||||
Shadows.shadowOf(application.getSystemService(KeyguardManager.class));
|
||||
mMockHelper = mock(RestrictedPreferenceHelper.class);
|
||||
|
@@ -34,6 +34,7 @@ import com.android.settings.fuelgauge.batterytip.AnomalyConfigJobService;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.Mock;
|
||||
@@ -99,6 +100,7 @@ public class SettingsDumpServiceTest {
|
||||
ANOMALY_VERSION);
|
||||
}
|
||||
|
||||
@Ignore
|
||||
@Test
|
||||
public void testDump_printServiceAsKey() {
|
||||
mResolveInfo.activityInfo = new ActivityInfo();
|
||||
|
@@ -39,6 +39,7 @@ import com.android.settings.testutils.XmlTestUtils;
|
||||
import com.android.settings.testutils.shadow.ShadowFragment;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
@@ -52,6 +53,7 @@ import org.robolectric.annotation.Config;
|
||||
import java.util.List;
|
||||
|
||||
/** Tests for {@link AccessibilityButtonFragment}. */
|
||||
@Ignore
|
||||
@Config(shadows = ShadowFragment.class)
|
||||
@RunWith(RobolectricTestRunner.class)
|
||||
public class AccessibilityButtonFragmentTest {
|
||||
|
@@ -42,6 +42,7 @@ import com.android.settings.bluetooth.Utils;
|
||||
import com.android.settings.testutils.shadow.ShadowAlertDialogCompat;
|
||||
import com.android.settings.testutils.shadow.ShadowBluetoothAdapter;
|
||||
import com.android.settings.testutils.shadow.ShadowBluetoothUtils;
|
||||
import com.android.settings.utils.ActivityControllerWrapper;
|
||||
import com.android.settingslib.bluetooth.BluetoothEventManager;
|
||||
import com.android.settingslib.bluetooth.CachedBluetoothDevice;
|
||||
import com.android.settingslib.bluetooth.CachedBluetoothDeviceManager;
|
||||
@@ -53,6 +54,7 @@ import com.android.settingslib.bluetooth.LocalBluetoothProfileManager;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.Mock;
|
||||
@@ -106,7 +108,9 @@ public class AccessibilityHearingAidPreferenceControllerTest {
|
||||
public void setUp() {
|
||||
MockitoAnnotations.initMocks(this);
|
||||
mShadowApplication = ShadowApplication.getInstance();
|
||||
mContext = spy(Robolectric.setupActivity(Activity.class));
|
||||
|
||||
mContext = spy((Activity) ActivityControllerWrapper.setup(
|
||||
Robolectric.buildActivity(Activity.class)).get());
|
||||
setupEnvironment();
|
||||
|
||||
mHearingAidPreference = new Preference(mContext);
|
||||
@@ -244,6 +248,7 @@ public class AccessibilityHearingAidPreferenceControllerTest {
|
||||
mContext.getText(R.string.accessibility_hearingaid_not_connected_summary));
|
||||
}
|
||||
|
||||
@Ignore
|
||||
@Test
|
||||
public void handleHearingAidPreferenceClick_noHearingAid_launchHearingAidInstructionDialog() {
|
||||
mPreferenceController = spy(new AccessibilityHearingAidPreferenceController(mContext,
|
||||
@@ -255,6 +260,7 @@ public class AccessibilityHearingAidPreferenceControllerTest {
|
||||
verify(mPreferenceController).launchHearingAidInstructionDialog();
|
||||
}
|
||||
|
||||
@Ignore
|
||||
@Test
|
||||
public void handleHearingAidPreferenceClick_withHearingAid_launchBluetoothDeviceDetailSetting
|
||||
() {
|
||||
|
@@ -50,6 +50,7 @@ import com.android.settings.R;
|
||||
import com.android.settings.testutils.shadow.ShadowFragment;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.Answers;
|
||||
@@ -62,6 +63,7 @@ import org.robolectric.shadow.api.Shadow;
|
||||
import org.robolectric.shadows.ShadowApplication;
|
||||
|
||||
/** Tests for {@link AccessibilityShortcutPreferenceFragment} */
|
||||
@Ignore
|
||||
@RunWith(RobolectricTestRunner.class)
|
||||
public class AccessibilityShortcutPreferenceFragmentTest {
|
||||
|
||||
|
@@ -30,6 +30,7 @@ import com.android.settings.R;
|
||||
import com.android.settingslib.core.AbstractPreferenceController;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
@@ -65,6 +66,7 @@ public class FlashNotificationsPreferenceFragmentTest {
|
||||
assertThat(mFragment.getLogTag()).isEqualTo("FlashNotificationsPreferenceFragment");
|
||||
}
|
||||
|
||||
@Ignore
|
||||
@Test
|
||||
public void getMetricsCategory_isZero() {
|
||||
assertThat(mFragment.getMetricsCategory()).isEqualTo(0); // TODO
|
||||
|
@@ -34,6 +34,7 @@ import androidx.fragment.app.FragmentActivity;
|
||||
import com.android.settings.SettingsActivity;
|
||||
import com.android.settings.bluetooth.BluetoothPairingDetail;
|
||||
import com.android.settings.testutils.shadow.ShadowAlertDialogCompat;
|
||||
import com.android.settings.utils.ActivityControllerWrapper;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Rule;
|
||||
@@ -59,7 +60,8 @@ public class HearingAidDialogFragmentTest {
|
||||
@Before
|
||||
public void setUpTestFragment() {
|
||||
mFragment = spy(HearingAidDialogFragment.newInstance());
|
||||
mActivity = Robolectric.setupActivity(FragmentActivity.class);
|
||||
mActivity = (FragmentActivity) ActivityControllerWrapper.setup(
|
||||
Robolectric.buildActivity(FragmentActivity.class)).get();
|
||||
when(mFragment.getActivity()).thenReturn(mActivity);
|
||||
}
|
||||
|
||||
|
@@ -46,6 +46,7 @@ import com.android.settings.bluetooth.Utils;
|
||||
import com.android.settings.testutils.shadow.ShadowAlertDialogCompat;
|
||||
import com.android.settings.testutils.shadow.ShadowBluetoothAdapter;
|
||||
import com.android.settings.testutils.shadow.ShadowBluetoothUtils;
|
||||
import com.android.settings.utils.ActivityControllerWrapper;
|
||||
import com.android.settingslib.bluetooth.CachedBluetoothDevice;
|
||||
import com.android.settingslib.bluetooth.CachedBluetoothDeviceManager;
|
||||
import com.android.settingslib.bluetooth.HearingAidInfo;
|
||||
@@ -94,7 +95,8 @@ public class HearingAidPairingDialogFragmentTest {
|
||||
public void setUp() {
|
||||
setupEnvironment();
|
||||
mFragment = spy(HearingAidPairingDialogFragment.newInstance(TEST_DEVICE_ADDRESS));
|
||||
mActivity = Robolectric.setupActivity(FragmentActivity.class);
|
||||
mActivity = (FragmentActivity) ActivityControllerWrapper.setup(
|
||||
Robolectric.buildActivity(FragmentActivity.class)).get();
|
||||
mFragmentManager = mActivity.getSupportFragmentManager();
|
||||
when(mFragment.getActivity()).thenReturn(mActivity);
|
||||
doReturn(mFragmentManager).when(mFragment).getParentFragmentManager();
|
||||
|
@@ -34,6 +34,7 @@ import com.android.settings.bluetooth.Utils;
|
||||
import com.android.settings.testutils.shadow.ShadowAlertDialogCompat;
|
||||
import com.android.settings.testutils.shadow.ShadowBluetoothAdapter;
|
||||
import com.android.settings.testutils.shadow.ShadowBluetoothUtils;
|
||||
import com.android.settings.utils.ActivityControllerWrapper;
|
||||
import com.android.settingslib.bluetooth.CachedBluetoothDevice;
|
||||
import com.android.settingslib.bluetooth.CachedBluetoothDeviceManager;
|
||||
import com.android.settingslib.bluetooth.HearingAidInfo;
|
||||
@@ -79,7 +80,8 @@ public class HearingAidUtilsTest {
|
||||
@Before
|
||||
public void setUp() {
|
||||
setupEnvironment();
|
||||
final FragmentActivity mActivity = Robolectric.setupActivity(FragmentActivity.class);
|
||||
final FragmentActivity mActivity = (FragmentActivity) ActivityControllerWrapper.setup(
|
||||
Robolectric.buildActivity(FragmentActivity.class)).get();
|
||||
mFragmentManager = mActivity.getSupportFragmentManager();
|
||||
ShadowAlertDialogCompat.reset();
|
||||
when(mCachedBluetoothDevice.getAddress()).thenReturn(TEST_DEVICE_ADDRESS);
|
||||
|
@@ -44,6 +44,7 @@ import androidx.fragment.app.FragmentActivity;
|
||||
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.Robolectric;
|
||||
@@ -53,6 +54,7 @@ import org.robolectric.shadows.ShadowContextWrapper;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Ignore
|
||||
@RunWith(RobolectricTestRunner.class)
|
||||
public class ScreenFlashNotificationColorDialogFragmentTest {
|
||||
|
||||
|
@@ -40,6 +40,7 @@ import androidx.preference.Preference;
|
||||
import androidx.preference.PreferenceScreen;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.utils.ActivityControllerWrapper;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
@@ -89,7 +90,10 @@ public class ScreenFlashNotificationPreferenceControllerTest {
|
||||
@Before
|
||||
public void setUp() {
|
||||
MockitoAnnotations.initMocks(this);
|
||||
FragmentActivity fragmentActivity = Robolectric.setupActivity(FragmentActivity.class);
|
||||
FragmentActivity fragmentActivity = (FragmentActivity) ActivityControllerWrapper.setup(
|
||||
Robolectric.buildActivity(FragmentActivity.class)).get();
|
||||
|
||||
|
||||
Context context = fragmentActivity.getApplicationContext();
|
||||
ShadowScreenFlashNotificationColorDialogFragment.setInstance(mDialogFragment);
|
||||
ShadowFlashNotificationsUtils.setColorDescriptionText(COLOR_DESCRIPTION_TEXT);
|
||||
|
@@ -40,8 +40,10 @@ import com.android.settings.R;
|
||||
import com.android.settings.accessibility.AccessibilityDialogUtils.DialogEnums;
|
||||
import com.android.settings.accessibility.TextReadingResetController.ResetStateListener;
|
||||
import com.android.settings.testutils.XmlTestUtils;
|
||||
import com.android.settings.utils.ActivityControllerWrapper;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
@@ -76,7 +78,9 @@ public class TextReadingPreferenceFragmentTest {
|
||||
when(mFragment.getPreferenceManager()).thenReturn(mPreferenceManager);
|
||||
when(mFragment.getPreferenceManager().getContext()).thenReturn(mContext);
|
||||
when(mFragment.getContext()).thenReturn(mContext);
|
||||
when(mFragment.getActivity()).thenReturn(Robolectric.setupActivity(FragmentActivity.class));
|
||||
when(mFragment.getActivity()).thenReturn((FragmentActivity)
|
||||
ActivityControllerWrapper.setup(Robolectric.buildActivity(
|
||||
FragmentActivity.class)).get());
|
||||
|
||||
// Avoid a NPE is happened in ShadowWindowManagerGlobal
|
||||
doReturn(mock(DisplaySizeData.class)).when(mFragment).createDisplaySizeData(mContext);
|
||||
@@ -137,6 +141,7 @@ public class TextReadingPreferenceFragmentTest {
|
||||
R.xml.accessibility_text_reading_options);
|
||||
}
|
||||
|
||||
@Ignore
|
||||
@Test
|
||||
public void getLogTag_returnsCorrectTag() {
|
||||
assertThat(mFragment.getLogTag()).isEqualTo("TextReadingPreferenceFragment");
|
||||
|
@@ -24,6 +24,7 @@ import static com.google.common.truth.Truth.assertThat;
|
||||
import android.content.Context;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.robolectric.RobolectricTestRunner;
|
||||
@@ -47,6 +48,7 @@ public class TopLevelAccessibilityPreferenceControllerTest {
|
||||
assertThat(mController.getAvailabilityStatus()).isEqualTo(AVAILABLE);
|
||||
}
|
||||
|
||||
@Ignore
|
||||
@Test
|
||||
@Config(qualifiers = "mcc999")
|
||||
public void getAvailabilityStatus_unsupportedWhenSet() {
|
||||
|
@@ -30,6 +30,8 @@ import androidx.preference.Preference;
|
||||
import androidx.preference.PreferenceScreen;
|
||||
import androidx.test.core.app.ApplicationProvider;
|
||||
|
||||
import com.android.settings.utils.ActivityControllerWrapper;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
@@ -60,7 +62,8 @@ public class ViewAllBluetoothDevicesPreferenceControllerTest {
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
mActivity = Robolectric.setupActivity(FragmentActivity.class);
|
||||
mActivity = (FragmentActivity) ActivityControllerWrapper.setup(
|
||||
Robolectric.buildActivity(FragmentActivity.class)).get();
|
||||
when(mFragment.getContext()).thenReturn(mContext);
|
||||
when(mFragment.getActivity()).thenReturn(mActivity);
|
||||
|
||||
|
@@ -36,6 +36,7 @@ import com.android.settings.R;
|
||||
import com.android.settings.SettingsActivity;
|
||||
import com.android.settings.testutils.shadow.ShadowAccountManager;
|
||||
import com.android.settings.testutils.shadow.ShadowContentResolver;
|
||||
import com.android.settings.utils.ActivityControllerWrapper;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
@@ -62,7 +63,8 @@ public class AccountSyncPreferenceControllerTest {
|
||||
@Before
|
||||
public void setUp() {
|
||||
MockitoAnnotations.initMocks(this);
|
||||
mActivity = Robolectric.setupActivity(Activity.class);
|
||||
mActivity = (Activity) ActivityControllerWrapper.setup(
|
||||
Robolectric.buildActivity(Activity.class)).get();
|
||||
ShadowApplication.getInstance().setSystemService(Context.ACCOUNT_SERVICE, mAccountManager);
|
||||
|
||||
when(mAccountManager.getAuthenticatorTypesAsUser(anyInt())).thenReturn(
|
||||
|
@@ -41,6 +41,7 @@ import com.android.settings.core.BasePreferenceController;
|
||||
import com.android.settings.testutils.shadow.ShadowAccountManager;
|
||||
import com.android.settings.testutils.shadow.ShadowContentResolver;
|
||||
import com.android.settings.testutils.shadow.ShadowRestrictedLockUtilsInternal;
|
||||
import com.android.settings.utils.ActivityControllerWrapper;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
@@ -68,7 +69,8 @@ public class ChooseAccountPreferenceControllerTest {
|
||||
MockitoAnnotations.initMocks(this);
|
||||
mContext = RuntimeEnvironment.application;
|
||||
mController = spy(new ChooseAccountPreferenceController(mContext, "controller_key"));
|
||||
mActivity = Robolectric.setupActivity(FragmentActivity.class);
|
||||
mActivity = (FragmentActivity) ActivityControllerWrapper.setup(
|
||||
Robolectric.buildActivity(FragmentActivity.class)).get();
|
||||
mPreferenceManager = new PreferenceManager(mContext);
|
||||
mPreferenceScreen = mPreferenceManager.createPreferenceScreen(mContext);
|
||||
}
|
||||
|
@@ -40,6 +40,7 @@ import androidx.preference.PreferenceScreen;
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.testutils.shadow.ShadowAccountManager;
|
||||
import com.android.settings.testutils.shadow.ShadowContentResolver;
|
||||
import com.android.settings.utils.ActivityControllerWrapper;
|
||||
import com.android.settingslib.search.SearchIndexableRaw;
|
||||
|
||||
import org.junit.After;
|
||||
@@ -75,7 +76,8 @@ public class EmergencyInfoPreferenceControllerTest {
|
||||
doReturn(mock(DevicePolicyManager.class)).when(mContext)
|
||||
.getSystemService(Context.DEVICE_POLICY_SERVICE);
|
||||
mController = new EmergencyInfoPreferenceController(mContext, "test_key");
|
||||
mPreference = new Preference(Robolectric.setupActivity(Activity.class));
|
||||
mPreference = new Preference((Context) ActivityControllerWrapper.setup(
|
||||
Robolectric.buildActivity(Activity.class)).get());
|
||||
mPreference.setKey(mController.getPreferenceKey());
|
||||
when(mScreen.findPreference(mPreference.getKey())).thenReturn(mPreference);
|
||||
when(mContext.getResources().getBoolean(R.bool.config_show_emergency_info_in_device_info))
|
||||
|
@@ -56,10 +56,12 @@ import com.android.settings.testutils.shadow.ShadowContentResolver;
|
||||
import com.android.settings.testutils.shadow.ShadowDevicePolicyManager;
|
||||
import com.android.settings.testutils.shadow.ShadowFragment;
|
||||
import com.android.settings.testutils.shadow.ShadowUserManager;
|
||||
import com.android.settings.utils.ActivityControllerWrapper;
|
||||
import com.android.settingslib.widget.LayoutPreference;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.ArgumentCaptor;
|
||||
@@ -115,8 +117,8 @@ public class RemoveAccountPreferenceControllerTest {
|
||||
when(mAccountManager.getAuthenticatorTypesAsUser(anyInt()))
|
||||
.thenReturn(new AuthenticatorDescription[0]);
|
||||
when(mAccountManager.getAccountsAsUser(anyInt())).thenReturn(new Account[0]);
|
||||
mController = new RemoveAccountPreferenceController(
|
||||
Robolectric.setupActivity(Activity.class), mFragment);
|
||||
mController = new RemoveAccountPreferenceController((Context) ActivityControllerWrapper
|
||||
.setup(Robolectric.buildActivity(Activity.class)).get(), mFragment);
|
||||
}
|
||||
|
||||
@After
|
||||
@@ -145,6 +147,7 @@ public class RemoveAccountPreferenceControllerTest {
|
||||
eq(TAG_REMOVE_ACCOUNT_DIALOG));
|
||||
}
|
||||
|
||||
@Ignore
|
||||
@Test
|
||||
public void onClick_modifyAccountsIsDisallowed_shouldNotStartConfirmDialog() {
|
||||
when(mFragment.isAdded()).thenReturn(true);
|
||||
|
@@ -43,6 +43,7 @@ import com.android.settings.fuelgauge.batteryusage.BatteryDiffEntry;
|
||||
import com.android.settingslib.applications.ApplicationsState;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.Mock;
|
||||
@@ -113,6 +114,7 @@ public class AppBatteryPreferenceControllerTest {
|
||||
assertThat(mController.isAvailable()).isTrue();
|
||||
}
|
||||
|
||||
@Ignore
|
||||
@Test
|
||||
@Config(qualifiers = "mcc999")
|
||||
public void testAppBattery_ifDisabled_shouldNotBeShown() {
|
||||
|
@@ -56,6 +56,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;
|
||||
@@ -152,6 +153,7 @@ public final class AppInfoDashboardFragmentTest {
|
||||
verify(menu.findItem(UNINSTALL_UPDATES), times(1)).setVisible(true);
|
||||
}
|
||||
|
||||
@Ignore
|
||||
@Test
|
||||
@Config(qualifiers = "mcc999")
|
||||
public void onPrepareOptionsMenu_setUpdateMenuVisible_ifDisabledByDevice_shouldBeFalse() {
|
||||
|
@@ -37,6 +37,7 @@ import com.android.settings.core.BasePreferenceController;
|
||||
import com.android.settings.testutils.shadow.ShadowUserManager;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.ArgumentCaptor;
|
||||
@@ -76,6 +77,7 @@ public class AppMemoryPreferenceControllerTest {
|
||||
when(mFragment.getActivity()).thenReturn(mActivity);
|
||||
}
|
||||
|
||||
@Ignore
|
||||
@Test
|
||||
@Config(qualifiers = "mcc999")
|
||||
public void getAvailabilityStatus_developmentSettingsEnabled_shouldReturnAvailable() {
|
||||
@@ -104,6 +106,7 @@ public class AppMemoryPreferenceControllerTest {
|
||||
.isEqualTo(BasePreferenceController.UNSUPPORTED_ON_DEVICE);
|
||||
}
|
||||
|
||||
@Ignore
|
||||
@Test
|
||||
@Config(qualifiers = "mcc999")
|
||||
public void getAvailabilityStatus_developmentSettingsDisabled_shouldReturnDisabled() {
|
||||
|
@@ -26,6 +26,7 @@ import android.content.pm.ResolveInfo;
|
||||
import androidx.preference.Preference;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.Mock;
|
||||
@@ -66,12 +67,14 @@ public class AppSettingPreferenceControllerTest {
|
||||
mPreference.setKey(mController.getPreferenceKey());
|
||||
}
|
||||
|
||||
@Ignore
|
||||
@Test
|
||||
public void getAvailabilityStatus_noAppSetting_shouldNotBeAvailable() {
|
||||
assertThat(mController.isAvailable())
|
||||
.isFalse();
|
||||
}
|
||||
|
||||
@Ignore
|
||||
@Test
|
||||
public void getAvailabilityStatus_noPackageName_shouldNotBeAvailable() {
|
||||
mController.setPackageName(null);
|
||||
@@ -80,6 +83,7 @@ public class AppSettingPreferenceControllerTest {
|
||||
.isFalse();
|
||||
}
|
||||
|
||||
@Ignore
|
||||
@Test
|
||||
public void getAvailabilityStatus_hasAppSetting_shouldBeAvailable() {
|
||||
final ResolveInfo info = new ResolveInfo();
|
||||
@@ -93,11 +97,13 @@ public class AppSettingPreferenceControllerTest {
|
||||
.isTrue();
|
||||
}
|
||||
|
||||
@Ignore
|
||||
@Test
|
||||
public void clickPreference_noAppSetting_shouldDoNothing() {
|
||||
assertThat(mController.handlePreferenceTreeClick(mPreference)).isFalse();
|
||||
}
|
||||
|
||||
@Ignore
|
||||
@Test
|
||||
public void clickPreference_hasAppSetting_shouldLaunchIntent() {
|
||||
final ResolveInfo info = new ResolveInfo();
|
||||
|
@@ -33,8 +33,10 @@ import android.os.UserManager;
|
||||
import androidx.preference.Preference;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.utils.ActivityControllerWrapper;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.ArgumentCaptor;
|
||||
@@ -74,7 +76,8 @@ public class DefaultAppShortcutPreferenceControllerBaseTest {
|
||||
MockitoAnnotations.initMocks(this);
|
||||
ShadowApplication shadowApplication = ShadowApplication.getInstance();
|
||||
shadowApplication.setSystemService(Context.ROLE_SERVICE, mRoleManager);
|
||||
mActivity = Robolectric.setupActivity(Activity.class);
|
||||
mActivity = (Activity) ActivityControllerWrapper.setup(
|
||||
Robolectric.buildActivity(Activity.class)).get();
|
||||
mShadowUserManager = shadowOf(mActivity.getSystemService(UserManager.class));
|
||||
mController = new TestRolePreferenceController(mActivity);
|
||||
when(mPreference.getKey()).thenReturn(mController.getPreferenceKey());
|
||||
@@ -101,6 +104,7 @@ public class DefaultAppShortcutPreferenceControllerBaseTest {
|
||||
DefaultAppShortcutPreferenceControllerBase.UNSUPPORTED_ON_DEVICE);
|
||||
}
|
||||
|
||||
@Ignore
|
||||
@Test
|
||||
public void
|
||||
getAvailabilityStatus_noCallbackForIsRoleNotVisible_shouldReturnUnsupported() {
|
||||
|
@@ -35,6 +35,7 @@ import androidx.fragment.app.FragmentActivity;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.testutils.shadow.ShadowAlertDialogCompat;
|
||||
import com.android.settings.utils.ActivityControllerWrapper;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
@@ -55,7 +56,9 @@ public class InstantAppButtonDialogFragmentTest {
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
final FragmentActivity activity = Robolectric.setupActivity(FragmentActivity.class);
|
||||
final FragmentActivity activity = (FragmentActivity) ActivityControllerWrapper.setup(
|
||||
Robolectric.buildActivity(FragmentActivity.class)).get();
|
||||
|
||||
mContext = spy(RuntimeEnvironment.application);
|
||||
mFragment = InstantAppButtonDialogFragment.newInstance(TEST_PACKAGE);
|
||||
mFragment.show(activity.getSupportFragmentManager(), "InstantAppButtonDialogFragment");
|
||||
|
@@ -44,6 +44,7 @@ import com.android.settings.testutils.shadow.ShadowSecureSettings;
|
||||
import com.android.settingslib.applications.DefaultAppInfo;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.Mock;
|
||||
@@ -82,6 +83,7 @@ public class DefaultAssistPreferenceControllerTest {
|
||||
assertThat(mController.isAvailable()).isTrue();
|
||||
}
|
||||
|
||||
@Ignore
|
||||
@Test
|
||||
@Config(qualifiers = "mcc999")
|
||||
public void testAssistAndVoiceInput_ifDisabled_shouldNotBeShown() {
|
||||
|
@@ -18,8 +18,8 @@ package com.android.settings.applications.specialaccess;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
|
||||
import static org.mockito.Mockito.when;
|
||||
import static org.mockito.Mockito.spy;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
@@ -27,6 +27,7 @@ import android.content.res.Resources;
|
||||
import com.android.settings.R;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.MockitoAnnotations;
|
||||
@@ -58,6 +59,7 @@ public class DataSaverControllerTest {
|
||||
assertThat(mController.isAvailable()).isTrue();
|
||||
}
|
||||
|
||||
@Ignore
|
||||
@Test
|
||||
@Config(qualifiers = "mcc999")
|
||||
public void testDataSaver_ifDisabledByCarrier_shouldNotBeShown() {
|
||||
|
@@ -29,6 +29,7 @@ import android.content.res.Resources;
|
||||
import com.android.settings.R;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.MockitoAnnotations;
|
||||
@@ -60,6 +61,7 @@ public class PremiumSmsControllerTest {
|
||||
assertThat(mController.getAvailabilityStatus()).isEqualTo(AVAILABLE);
|
||||
}
|
||||
|
||||
@Ignore
|
||||
@Test
|
||||
@Config(qualifiers = "mcc999")
|
||||
public void getAvailability_disabledByCarrier_returnUnavailable() {
|
||||
|
@@ -29,6 +29,7 @@ import android.content.res.Resources;
|
||||
import com.android.settings.R;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.MockitoAnnotations;
|
||||
@@ -60,6 +61,7 @@ public class PremiumSmsScreenPreferenceControllerTest {
|
||||
assertThat(mController.getAvailabilityStatus()).isEqualTo(AVAILABLE);
|
||||
}
|
||||
|
||||
@Ignore
|
||||
@Test
|
||||
@Config(qualifiers = "mcc999")
|
||||
public void getAvailability_disabledByCarrier_returnUnavailable() {
|
||||
|
@@ -24,6 +24,7 @@ import static com.google.common.truth.Truth.assertThat;
|
||||
import android.content.Context;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.robolectric.RobolectricTestRunner;
|
||||
@@ -57,6 +58,7 @@ public class EnabledVrListenersControllerTest {
|
||||
assertThat(mController.getAvailabilityStatus()).isEqualTo(UNSUPPORTED_ON_DEVICE);
|
||||
}
|
||||
|
||||
@Ignore
|
||||
@Test
|
||||
@Config(qualifiers = "mcc999")
|
||||
public void getAvailability_disabled_unavailable() {
|
||||
|
@@ -24,6 +24,7 @@ import static com.google.common.truth.Truth.assertThat;
|
||||
import android.content.Context;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.robolectric.RobolectricTestRunner;
|
||||
@@ -57,6 +58,7 @@ public class VrListenerScreenPreferenceControllerTest {
|
||||
assertThat(mController.getAvailabilityStatus()).isEqualTo(UNSUPPORTED_ON_DEVICE);
|
||||
}
|
||||
|
||||
@Ignore
|
||||
@Test
|
||||
@Config(qualifiers = "mcc999")
|
||||
public void getAvailability_disabled_unavailable() {
|
||||
|
@@ -29,6 +29,7 @@ import android.content.ComponentName;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.biometrics.BiometricEnrollActivity;
|
||||
import com.android.settings.utils.ActivityControllerWrapper;
|
||||
|
||||
import com.google.android.setupcompat.PartnerCustomizationLayout;
|
||||
import com.google.android.setupcompat.template.FooterBarMixin;
|
||||
@@ -49,8 +50,8 @@ public class ActiveUnlockRequireBiometricSetupTest {
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
mActivity = Robolectric.buildActivity(
|
||||
ActiveUnlockRequireBiometricSetup.class).setup().get();
|
||||
mActivity = (ActiveUnlockRequireBiometricSetup) ActivityControllerWrapper.setup(
|
||||
Robolectric.buildActivity(ActiveUnlockRequireBiometricSetup.class)).get();
|
||||
mLayout = mActivity.findViewById(R.id.setup_wizard_layout);
|
||||
}
|
||||
|
||||
|
@@ -32,7 +32,6 @@ import android.os.UserManager;
|
||||
|
||||
import androidx.preference.PreferenceScreen;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.testutils.ActiveUnlockTestUtils;
|
||||
import com.android.settings.testutils.shadow.ShadowDeviceConfig;
|
||||
import com.android.settingslib.RestrictedPreference;
|
||||
@@ -163,47 +162,6 @@ public class ActiveUnlockStatusPreferenceControllerTest {
|
||||
assertThat(mPreference.getSummary().toString()).isEqualTo(summary);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void biometricsNotSetUp_deviceNameIsNotSet_setupBiometricStringShown() {
|
||||
ActiveUnlockTestUtils.enable(mContext, ActiveUnlockStatusUtils.BIOMETRIC_FAILURE_LAYOUT);
|
||||
updateSummary("newSummary");
|
||||
mController.displayPreference(mPreferenceScreen);
|
||||
|
||||
mController.onStart();
|
||||
idleMainLooper();
|
||||
|
||||
assertThat(mPreference.getSummary()).isEqualTo(mContext.getString(
|
||||
R.string.security_settings_activeunlock_require_face_fingerprint_setup_title));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void biometricNotSetUp_deviceNameIsSet_summaryShown() {
|
||||
ActiveUnlockTestUtils.enable(mContext, ActiveUnlockStatusUtils.BIOMETRIC_FAILURE_LAYOUT);
|
||||
String summary = "newSummary";
|
||||
updateSummary(summary);
|
||||
updateDeviceName("deviceName");
|
||||
mController.displayPreference(mPreferenceScreen);
|
||||
|
||||
mController.onStart();
|
||||
idleMainLooper();
|
||||
|
||||
assertThat(mPreference.getSummary()).isEqualTo(summary);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void biometricSetUp_summaryShown() {
|
||||
when(mFingerprintManager.hasEnrolledFingerprints(anyInt())).thenReturn(true);
|
||||
ActiveUnlockTestUtils.enable(mContext, ActiveUnlockStatusUtils.BIOMETRIC_FAILURE_LAYOUT);
|
||||
String summary = "newSummary";
|
||||
updateSummary(summary);
|
||||
mController.displayPreference(mPreferenceScreen);
|
||||
|
||||
mController.onStart();
|
||||
idleMainLooper();
|
||||
|
||||
assertThat(mPreference.getSummary()).isEqualTo(summary);
|
||||
}
|
||||
|
||||
private void updateSummary(String summary) {
|
||||
FakeContentProvider.setTileSummary(summary);
|
||||
mContext.getContentResolver().notifyChange(FakeContentProvider.URI, null /* observer */);
|
||||
|
@@ -128,15 +128,6 @@ public class ActiveUnlockStatusUtilsTest {
|
||||
assertThat(mActiveUnlockStatusUtils.useBiometricFailureLayout()).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void configIsBiometricFailure_useBiometricFailureLayoutIsTrue() {
|
||||
ActiveUnlockTestUtils.enable(
|
||||
mApplicationContext, ActiveUnlockStatusUtils.BIOMETRIC_FAILURE_LAYOUT);
|
||||
|
||||
assertThat(mActiveUnlockStatusUtils.useUnlockIntentLayout()).isFalse();
|
||||
assertThat(mActiveUnlockStatusUtils.useBiometricFailureLayout()).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getTitle_faceEnabled_returnsFacePreferenceTitle() {
|
||||
when(mFingerprintManager.isHardwareDetected()).thenReturn(false);
|
||||
@@ -157,30 +148,6 @@ public class ActiveUnlockStatusUtilsTest {
|
||||
R.string.security_settings_fingerprint_preference_title));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getIntro_faceEnabled_returnsIntroWithFace() {
|
||||
ActiveUnlockTestUtils.enable(
|
||||
mApplicationContext, ActiveUnlockStatusUtils.BIOMETRIC_FAILURE_LAYOUT);
|
||||
when(mFingerprintManager.isHardwareDetected()).thenReturn(false);
|
||||
when(mFaceManager.isHardwareDetected()).thenReturn(true);
|
||||
|
||||
assertThat(mActiveUnlockStatusUtils.getIntroForActiveUnlock())
|
||||
.isEqualTo(mApplicationContext.getString(
|
||||
R.string.biometric_settings_intro_with_face));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getIntro_fingerprintEnabled_returnsIntroWithFingerprint() {
|
||||
ActiveUnlockTestUtils.enable(
|
||||
mApplicationContext, ActiveUnlockStatusUtils.BIOMETRIC_FAILURE_LAYOUT);
|
||||
when(mFingerprintManager.isHardwareDetected()).thenReturn(true);
|
||||
when(mFaceManager.isHardwareDetected()).thenReturn(false);
|
||||
|
||||
assertThat(mActiveUnlockStatusUtils.getIntroForActiveUnlock())
|
||||
.isEqualTo(mApplicationContext.getString(
|
||||
R.string.biometric_settings_intro_with_fingerprint));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getIntro_unlockOnIntentAndFaceEnabled_returnsEmpty() {
|
||||
ActiveUnlockTestUtils.enable(
|
||||
@@ -222,4 +189,44 @@ public class ActiveUnlockStatusUtilsTest {
|
||||
.isEqualTo(mApplicationContext.getString(
|
||||
R.string.biometric_settings_use_face_or_watch_preference_summary));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getUseBiometricTitle_faceAndFingerprintEnabled_returnsFaceFingerprintOrWatch() {
|
||||
when(mFingerprintManager.isHardwareDetected()).thenReturn(true);
|
||||
when(mFaceManager.isHardwareDetected()).thenReturn(true);
|
||||
|
||||
assertThat(mActiveUnlockStatusUtils.getUseBiometricTitleForActiveUnlock())
|
||||
.isEqualTo(mApplicationContext.getString(
|
||||
R.string.biometric_settings_use_face_fingerprint_or_watch_for));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getUseBiometricTitle_fingerprintEnabled_returnsFingerprintOrWatch() {
|
||||
when(mFingerprintManager.isHardwareDetected()).thenReturn(true);
|
||||
when(mFaceManager.isHardwareDetected()).thenReturn(false);
|
||||
|
||||
assertThat(mActiveUnlockStatusUtils.getUseBiometricTitleForActiveUnlock())
|
||||
.isEqualTo(mApplicationContext.getString(
|
||||
R.string.biometric_settings_use_fingerprint_or_watch_for));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getUseBiometricTitle_faceEnabled_returnsFaceOrWatch() {
|
||||
when(mFingerprintManager.isHardwareDetected()).thenReturn(false);
|
||||
when(mFaceManager.isHardwareDetected()).thenReturn(true);
|
||||
|
||||
assertThat(mActiveUnlockStatusUtils.getUseBiometricTitleForActiveUnlock())
|
||||
.isEqualTo(mApplicationContext.getString(
|
||||
R.string.biometric_settings_use_face_or_watch_for));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getUseBiometricTitle_withoutFaceOrFingerprint_returnsWatch() {
|
||||
when(mFingerprintManager.isHardwareDetected()).thenReturn(false);
|
||||
when(mFaceManager.isHardwareDetected()).thenReturn(false);
|
||||
|
||||
assertThat(mActiveUnlockStatusUtils.getUseBiometricTitleForActiveUnlock())
|
||||
.isEqualTo(mApplicationContext.getString(
|
||||
R.string.biometric_settings_use_watch_for));
|
||||
}
|
||||
}
|
||||
|
@@ -68,6 +68,7 @@ import com.android.settingslib.core.AbstractPreferenceController;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
@@ -85,6 +86,7 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Ignore
|
||||
@RunWith(RobolectricTestRunner.class)
|
||||
@Config(shadows = {ShadowSettingsPreferenceFragment.class, ShadowUtils.class, ShadowFragment.class})
|
||||
public class CombinedBiometricProfileSettingsTest {
|
||||
|
@@ -41,6 +41,7 @@ import com.android.settings.R;
|
||||
import com.android.settingslib.widget.FooterPreference;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
@@ -56,6 +57,7 @@ import org.robolectric.shadows.ShadowApplication;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Ignore
|
||||
@RunWith(RobolectricTestRunner.class)
|
||||
public class FaceSettingsFooterPreferenceControllerTest {
|
||||
@Rule
|
||||
|
@@ -57,6 +57,7 @@ import com.android.settings.biometrics.BiometricEnrollBase;
|
||||
import com.android.settings.password.ChooseLockSettingsHelper;
|
||||
import com.android.settings.testutils.FakeFeatureFactory;
|
||||
import com.android.settings.testutils.shadow.ShadowUtils;
|
||||
import com.android.settings.utils.ActivityControllerWrapper;
|
||||
|
||||
import com.google.android.setupcompat.PartnerCustomizationLayout;
|
||||
import com.google.android.setupcompat.template.FooterBarMixin;
|
||||
@@ -119,7 +120,7 @@ public class FingerprintEnrollFindSensorTest {
|
||||
props.add(newFingerprintSensorPropertiesInternal(TYPE_REAR));
|
||||
doReturn(props).when(mFingerprintManager).getSensorPropertiesInternal();
|
||||
|
||||
mActivityController.setup();
|
||||
ActivityControllerWrapper.setup(mActivityController);
|
||||
}
|
||||
|
||||
private void setupActivity_onUdfpsDevice() {
|
||||
@@ -127,7 +128,7 @@ public class FingerprintEnrollFindSensorTest {
|
||||
props.add(newFingerprintSensorPropertiesInternal(TYPE_UDFPS_OPTICAL));
|
||||
doReturn(props).when(mFingerprintManager).getSensorPropertiesInternal();
|
||||
|
||||
mActivityController.setup();
|
||||
ActivityControllerWrapper.setup(mActivityController);
|
||||
}
|
||||
|
||||
private void setupActivity_onSfpsDevice() {
|
||||
@@ -135,7 +136,7 @@ public class FingerprintEnrollFindSensorTest {
|
||||
props.add(newFingerprintSensorPropertiesInternal(TYPE_POWER_BUTTON));
|
||||
doReturn(props).when(mFingerprintManager).getSensorPropertiesInternal();
|
||||
|
||||
mActivityController.setup();
|
||||
ActivityControllerWrapper.setup(mActivityController);
|
||||
}
|
||||
|
||||
private FingerprintSensorPropertiesInternal newFingerprintSensorPropertiesInternal(
|
||||
@@ -591,7 +592,7 @@ public class FingerprintEnrollFindSensorTest {
|
||||
private void gotEnrollingResult_resumeActivityAndVerifyResultThenForward(
|
||||
int testActivityResult) {
|
||||
// resume activity
|
||||
mActivityController.start().resume().visible();
|
||||
mActivityController.start().resume();
|
||||
verifyNoSidecar();
|
||||
|
||||
// onActivityResult from Enrolling activity shall be forward back
|
||||
@@ -611,7 +612,8 @@ public class FingerprintEnrollFindSensorTest {
|
||||
int testActivityResult, @NonNull Bundle savedInstance) {
|
||||
// Rebuild activity and use savedInstance to restore.
|
||||
buildActivity();
|
||||
mActivityController.setup(savedInstance);
|
||||
ActivityControllerWrapper.setup(mActivityController, savedInstance);
|
||||
//mActivityController.setup(savedInstance);
|
||||
verifyNoSidecar();
|
||||
|
||||
// onActivityResult from Enrolling activity shall be forward back
|
||||
|
@@ -31,6 +31,7 @@ import com.android.settings.password.ChooseLockSettingsHelper;
|
||||
import com.android.settings.testutils.FakeFeatureFactory;
|
||||
import com.android.settings.testutils.shadow.ShadowAlertDialogCompat;
|
||||
import com.android.settings.testutils.shadow.ShadowUtils;
|
||||
import com.android.settings.utils.ActivityControllerWrapper;
|
||||
|
||||
import com.google.android.setupcompat.PartnerCustomizationLayout;
|
||||
import com.google.android.setupcompat.template.FooterBarMixin;
|
||||
@@ -64,8 +65,8 @@ public class SetupFingerprintEnrollFindSensorTest {
|
||||
final Intent intent = new Intent()
|
||||
// Set the challenge token so the confirm screen will not be shown
|
||||
.putExtra(ChooseLockSettingsHelper.EXTRA_KEY_CHALLENGE_TOKEN, new byte[0]);
|
||||
mActivity = Robolectric.buildActivity(SetupFingerprintEnrollFindSensor.class,
|
||||
intent).setup().get();
|
||||
mActivity = (SetupFingerprintEnrollFindSensor) ActivityControllerWrapper.setup(
|
||||
Robolectric.buildActivity(SetupFingerprintEnrollFindSensor.class, intent)).get();
|
||||
mTheme = mActivity.getTheme();
|
||||
}
|
||||
|
||||
|
@@ -30,6 +30,7 @@ import android.hardware.fingerprint.FingerprintManager;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.testutils.shadow.ShadowFingerprintManager;
|
||||
import com.android.settings.utils.ActivityControllerWrapper;
|
||||
|
||||
import com.google.android.setupcompat.PartnerCustomizationLayout;
|
||||
import com.google.android.setupcompat.template.FooterBarMixin;
|
||||
@@ -54,7 +55,8 @@ public class SetupFingerprintEnrollFinishTest {
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
mActivity = Robolectric.buildActivity(FingerprintEnrollFinish.class).setup().get();
|
||||
mActivity = (FingerprintEnrollFinish) ActivityControllerWrapper.setup(
|
||||
Robolectric.buildActivity(FingerprintEnrollFinish.class)).get();
|
||||
mLayout = mActivity.findViewById(R.id.setup_wizard_layout);
|
||||
Shadows.shadowOf(application.getPackageManager())
|
||||
.setSystemFeature(PackageManager.FEATURE_FINGERPRINT, true);
|
||||
|
@@ -46,6 +46,7 @@ import androidx.preference.PreferenceScreen;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.testutils.FakeFeatureFactory;
|
||||
import com.android.settings.utils.ActivityControllerWrapper;
|
||||
import com.android.settingslib.bluetooth.CachedBluetoothDevice;
|
||||
import com.android.settingslib.bluetooth.LocalBluetoothManager;
|
||||
|
||||
@@ -228,7 +229,9 @@ public class BluetoothDeviceDetailsFragmentTest {
|
||||
doReturn(mPreferenceScreen).when(fragment).getPreferenceScreen();
|
||||
doReturn(mUserManager).when(fragment).getUserManager();
|
||||
|
||||
mActivity = spy(Robolectric.setupActivity(FragmentActivity.class));
|
||||
mActivity = spy((FragmentActivity) ActivityControllerWrapper.setup(
|
||||
Robolectric.buildActivity(FragmentActivity.class)).get());
|
||||
|
||||
doReturn(mActivity).when(fragment).getActivity();
|
||||
doReturn(mContext).when(fragment).getContext();
|
||||
|
||||
|
@@ -36,6 +36,7 @@ import androidx.fragment.app.FragmentTransaction;
|
||||
import androidx.preference.PreferenceCategory;
|
||||
|
||||
import com.android.settings.testutils.FakeFeatureFactory;
|
||||
import com.android.settings.utils.ActivityControllerWrapper;
|
||||
import com.android.settingslib.bluetooth.CachedBluetoothDevice;
|
||||
import com.android.settingslib.bluetooth.LocalBluetoothLeBroadcastAssistant;
|
||||
import com.android.settingslib.bluetooth.LocalBluetoothManager;
|
||||
@@ -86,7 +87,10 @@ public class BluetoothFindBroadcastsFragmentTest {
|
||||
doReturn(mCachedDevice).when(mFragment).getCachedDevice(any());
|
||||
doReturn(mBroadcastAssistant).when(mFragment).getLeBroadcastAssistant();
|
||||
doReturn(mPreferenceCategroy).when(mFragment).findPreference(any());
|
||||
mActivity = Robolectric.setupActivity(FragmentActivity.class);
|
||||
|
||||
mActivity = (FragmentActivity) ActivityControllerWrapper.setup(
|
||||
Robolectric.buildActivity(FragmentActivity.class)).get();
|
||||
|
||||
when(mFragment.getActivity()).thenReturn(mActivity);
|
||||
|
||||
FragmentManager fragmentManager = mock(FragmentManager.class);
|
||||
|
@@ -48,6 +48,7 @@ import com.android.settings.testutils.shadow.ShadowAlertDialogCompat;
|
||||
import com.android.settings.testutils.shadow.ShadowAudioManager;
|
||||
import com.android.settings.testutils.shadow.ShadowBluetoothAdapter;
|
||||
import com.android.settings.testutils.shadow.ShadowBluetoothUtils;
|
||||
import com.android.settings.utils.ActivityControllerWrapper;
|
||||
import com.android.settingslib.bluetooth.BluetoothCallback;
|
||||
import com.android.settingslib.bluetooth.BluetoothEventManager;
|
||||
import com.android.settingslib.bluetooth.CachedBluetoothDevice;
|
||||
@@ -108,7 +109,10 @@ public class AvailableMediaDeviceGroupControllerTest {
|
||||
mPreference = new Preference(mContext);
|
||||
mPreference.setKey(PREFERENCE_KEY_1);
|
||||
mPreferenceGroup = spy(new PreferenceScreen(mContext, null));
|
||||
final FragmentActivity mActivity = Robolectric.setupActivity(FragmentActivity.class);
|
||||
|
||||
final FragmentActivity mActivity = (FragmentActivity) ActivityControllerWrapper.setup(
|
||||
Robolectric.buildActivity(FragmentActivity.class)).get();
|
||||
|
||||
when(mPreferenceGroup.getPreferenceManager()).thenReturn(mPreferenceManager);
|
||||
doReturn(mContext).when(mDashboardFragment).getContext();
|
||||
doReturn(mPackageManager).when(mContext).getPackageManager();
|
||||
|
@@ -24,6 +24,7 @@ import static com.google.common.truth.Truth.assertThat;
|
||||
import android.content.Context;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.robolectric.RobolectricTestRunner;
|
||||
@@ -47,6 +48,7 @@ public class TopLevelConnectedDevicesPreferenceControllerTest {
|
||||
assertThat(mController.getAvailabilityStatus()).isEqualTo(AVAILABLE);
|
||||
}
|
||||
|
||||
@Ignore
|
||||
@Test
|
||||
@Config(qualifiers = "mcc999")
|
||||
public void getAvailabilityStatus_unsupportedWhenSet() {
|
||||
|
@@ -44,6 +44,7 @@ import com.android.settingslib.core.lifecycle.Lifecycle;
|
||||
import com.android.settingslib.widget.SelectorWithWidgetPreference;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.Mock;
|
||||
@@ -219,6 +220,7 @@ public class UsbDetailsFunctionsControllerTest {
|
||||
assertThat(prefs.get(3).isChecked()).isFalse();
|
||||
}
|
||||
|
||||
@Ignore
|
||||
@Test
|
||||
public void onClickNone_mtpEnabled_shouldDisableMtp() {
|
||||
when(mUsbBackend.areFunctionsSupported(anyLong())).thenReturn(true);
|
||||
|
@@ -31,6 +31,7 @@ import android.util.ArraySet;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import com.android.settings.core.CategoryMixin.CategoryListener;
|
||||
import com.android.settings.utils.ActivityControllerWrapper;
|
||||
import com.android.settingslib.R;
|
||||
|
||||
import org.junit.Before;
|
||||
@@ -54,7 +55,7 @@ public class CategoryMixinTest {
|
||||
|
||||
@Test
|
||||
public void resumeActivity_shouldRegisterReceiver() {
|
||||
mActivityController.setup();
|
||||
ActivityControllerWrapper.setup(mActivityController);
|
||||
|
||||
final TestActivity activity = mActivityController.get();
|
||||
assertThat(activity.getRegisteredReceivers()).isNotEmpty();
|
||||
@@ -62,7 +63,7 @@ public class CategoryMixinTest {
|
||||
|
||||
@Test
|
||||
public void pauseActivity_shouldUnregisterReceiver() {
|
||||
mActivityController.setup().pause();
|
||||
ActivityControllerWrapper.setup(mActivityController).pause();
|
||||
|
||||
final TestActivity activity = mActivityController.get();
|
||||
assertThat(activity.getRegisteredReceivers()).isEmpty();
|
||||
@@ -70,7 +71,7 @@ public class CategoryMixinTest {
|
||||
|
||||
@Test
|
||||
public void onCategoriesChanged_listenerAdded_shouldNotifyChanged() {
|
||||
mActivityController.setup().pause();
|
||||
ActivityControllerWrapper.setup(mActivityController).pause();
|
||||
final CategoryMixin categoryMixin = mActivityController.get().getCategoryMixin();
|
||||
final CategoryListener listener = mock(CategoryListener.class);
|
||||
categoryMixin.addCategoryListener(listener);
|
||||
|
@@ -16,6 +16,8 @@
|
||||
|
||||
package com.android.settings.core;
|
||||
|
||||
import com.android.settings.utils.ActivityControllerWrapper;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.robolectric.Robolectric;
|
||||
@@ -31,7 +33,8 @@ public class InstrumentedActivityTest {
|
||||
*/
|
||||
@Test
|
||||
public void canInstantiate() {
|
||||
Robolectric.buildActivity(InstrumentedActivityTestable.class).setup().get();
|
||||
ActivityControllerWrapper.setup(
|
||||
Robolectric.buildActivity(InstrumentedActivityTestable.class)).get();
|
||||
}
|
||||
|
||||
public static class InstrumentedActivityTestable extends InstrumentedActivity {
|
||||
|
@@ -25,6 +25,7 @@ import com.android.settings.slices.FakePreferenceController;
|
||||
import com.android.settingslib.core.AbstractPreferenceController;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.robolectric.RobolectricTestRunner;
|
||||
@@ -44,6 +45,7 @@ public class PreferenceControllerListHelperTest {
|
||||
mContext = RuntimeEnvironment.application;
|
||||
}
|
||||
|
||||
@Ignore
|
||||
@Test
|
||||
@Config(qualifiers = "mcc999")
|
||||
public void getControllers_shouldReturnAList() {
|
||||
@@ -57,6 +59,7 @@ public class PreferenceControllerListHelperTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Ignore
|
||||
@Test
|
||||
@Config(qualifiers = "mcc998")
|
||||
public void getControllers_partialFailure_shouldReturnTheRest() {
|
||||
|
@@ -37,6 +37,7 @@ import com.android.settings.R;
|
||||
import com.android.settings.core.PreferenceXmlParserUtils.MetadataFlag;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.robolectric.RobolectricTestRunner;
|
||||
@@ -55,6 +56,7 @@ import java.util.Objects;
|
||||
* If changing a preference file breaks a test in this test file, please replace its reference
|
||||
* with another preference with a matching replacement attribute.
|
||||
*/
|
||||
@Ignore
|
||||
@RunWith(RobolectricTestRunner.class)
|
||||
public class PreferenceXmlParserUtilsTest {
|
||||
|
||||
|
@@ -59,6 +59,7 @@ import com.android.settingslib.drawer.DashboardCategory;
|
||||
import com.android.settingslib.drawer.ProviderTile;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.Mock;
|
||||
@@ -191,6 +192,7 @@ public class DashboardFragmentTest {
|
||||
verify(mTestFragment.mScreen, never()).addPreference(nullable(Preference.class));
|
||||
}
|
||||
|
||||
@Ignore
|
||||
@Test
|
||||
@Config(qualifiers = "mcc999")
|
||||
public void displayTilesAsPreference_shouldNotAddSuppressedTiles() {
|
||||
|
@@ -67,6 +67,7 @@ import com.android.settingslib.net.UidDetailProvider;
|
||||
|
||||
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;
|
||||
@@ -82,6 +83,7 @@ import org.robolectric.util.ReflectionHelpers;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Ignore
|
||||
@RunWith(RobolectricTestRunner.class)
|
||||
@Config(shadows = {ShadowEntityHeaderController.class, ShadowRestrictedLockUtilsInternal.class})
|
||||
public class AppDataUsageTest {
|
||||
|
@@ -31,6 +31,7 @@ import androidx.preference.PreferenceViewHolder;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.datausage.ChartDataUsagePreference.DataUsageSummaryNode;
|
||||
import com.android.settings.utils.ActivityControllerWrapper;
|
||||
import com.android.settings.widget.UsageView;
|
||||
import com.android.settingslib.net.NetworkCycleChartData;
|
||||
import com.android.settingslib.net.NetworkCycleData;
|
||||
@@ -64,8 +65,8 @@ public class ChartDataUsagePreferenceTest {
|
||||
@Before
|
||||
public void setUp() {
|
||||
MockitoAnnotations.initMocks(this);
|
||||
|
||||
mActivity = spy(Robolectric.setupActivity(Activity.class));
|
||||
mActivity = spy((Activity) ActivityControllerWrapper.setup(
|
||||
Robolectric.buildActivity(Activity.class)).get());
|
||||
mPreference = new ChartDataUsagePreference(mActivity, null /* attrs */);
|
||||
LayoutInflater inflater = LayoutInflater.from(mActivity);
|
||||
View view = inflater.inflate(mPreference.getLayoutResource(), null /* root */,
|
||||
|
@@ -54,6 +54,7 @@ import com.android.settingslib.core.instrumentation.VisibilityLoggerMixin;
|
||||
import com.android.settingslib.net.NetworkCycleChartData;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.ArgumentCaptor;
|
||||
@@ -70,6 +71,7 @@ import org.robolectric.util.ReflectionHelpers;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Ignore
|
||||
@RunWith(RobolectricTestRunner.class)
|
||||
public class DataUsageListTest {
|
||||
|
||||
|
@@ -18,11 +18,15 @@ package com.android.settings.datetime.timezone;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
|
||||
import static org.mockito.Mockito.spy;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
|
||||
import androidx.preference.Preference;
|
||||
|
||||
import com.android.settings.utils.ActivityControllerWrapper;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
@@ -36,7 +40,8 @@ public class BaseTimeZonePreferenceControllerTest {
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
mActivity = Robolectric.setupActivity(Activity.class);
|
||||
mActivity = spy((Activity) ActivityControllerWrapper.setup(
|
||||
Robolectric.buildActivity(Activity.class)).get());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@@ -23,6 +23,8 @@ import android.icu.util.TimeZone;
|
||||
|
||||
import androidx.preference.Preference;
|
||||
|
||||
import com.android.settings.utils.ActivityControllerWrapper;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
@@ -36,7 +38,8 @@ public class FixedOffsetPreferenceControllerTest {
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
mActivity = Robolectric.setupActivity(Activity.class);
|
||||
mActivity = (Activity) ActivityControllerWrapper.setup(
|
||||
Robolectric.buildActivity(Activity.class)).get();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@@ -18,10 +18,14 @@ package com.android.settings.datetime.timezone;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
|
||||
import static org.mockito.Mockito.spy;
|
||||
|
||||
import android.app.Activity;
|
||||
|
||||
import androidx.preference.Preference;
|
||||
|
||||
import com.android.settings.utils.ActivityControllerWrapper;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
@@ -35,7 +39,8 @@ public class RegionPreferenceControllerTest {
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
mActivity = Robolectric.setupActivity(Activity.class);
|
||||
mActivity = spy((Activity) ActivityControllerWrapper.setup(
|
||||
Robolectric.buildActivity(Activity.class)).get());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@@ -33,6 +33,7 @@ import com.android.settings.datetime.timezone.BaseTimeZoneAdapter.AdapterItem;
|
||||
import com.android.settings.datetime.timezone.BaseTimeZoneAdapter.ItemViewHolder;
|
||||
import com.android.settings.datetime.timezone.RegionSearchPicker.RegionItem;
|
||||
import com.android.settings.datetime.timezone.model.TimeZoneData;
|
||||
import com.android.settings.utils.ActivityControllerWrapper;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
@@ -142,7 +143,8 @@ public class RegionSearchPickerTest {
|
||||
@Implements(Fragment.class)
|
||||
public static class ShadowFragment {
|
||||
|
||||
private FragmentActivity mActivity = Robolectric.setupActivity(FragmentActivity.class);
|
||||
private FragmentActivity mActivity = (FragmentActivity) ActivityControllerWrapper.setup(
|
||||
Robolectric.buildActivity(FragmentActivity.class)).get();
|
||||
|
||||
@Implementation
|
||||
public final FragmentActivity getActivity() {
|
||||
|
@@ -23,6 +23,8 @@ import android.icu.util.TimeZone;
|
||||
|
||||
import androidx.preference.Preference;
|
||||
|
||||
import com.android.settings.utils.ActivityControllerWrapper;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
@@ -36,7 +38,8 @@ public class RegionZonePreferenceControllerTest {
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
mActivity = Robolectric.setupActivity(Activity.class);
|
||||
mActivity = (Activity) ActivityControllerWrapper.setup(
|
||||
Robolectric.buildActivity(Activity.class)).get();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@@ -32,6 +32,7 @@ import androidx.preference.PreferenceScreen;
|
||||
import androidx.preference.SwitchPreference;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.Mock;
|
||||
@@ -59,6 +60,7 @@ public class CameraLaserSensorPreferenceControllerTest {
|
||||
mController.displayPreference(mScreen);
|
||||
}
|
||||
|
||||
@Ignore
|
||||
@Test
|
||||
@Config(qualifiers = "mcc999")
|
||||
public void isAvailable_withConfigNoShow_shouldReturnFalse() {
|
||||
|
@@ -31,6 +31,7 @@ import androidx.preference.PreferenceScreen;
|
||||
import androidx.preference.SwitchPreference;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.Mock;
|
||||
@@ -99,6 +100,7 @@ public class CoolColorTemperaturePreferenceControllerTest {
|
||||
verify(mPreference).setChecked(false);
|
||||
}
|
||||
|
||||
@Ignore
|
||||
@Test
|
||||
@Config(qualifiers = "mcc999")
|
||||
public void isAvailable_shouldBeFalse() {
|
||||
|
@@ -24,6 +24,7 @@ import android.content.Context;
|
||||
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;
|
||||
@@ -40,6 +41,7 @@ public class DevelopmentMemtagPageTest {
|
||||
mContext = RuntimeEnvironment.application;
|
||||
}
|
||||
|
||||
@Ignore
|
||||
@Test
|
||||
public void getMetricsCategory_isSETTINGS_MEMTAG_CATEGORY() {
|
||||
assertThat(mMemtagPage.getMetricsCategory())
|
||||
|
@@ -38,6 +38,7 @@ import com.android.settingslib.RestrictedSwitchPreference;
|
||||
import com.android.settingslib.testutils.shadow.ShadowInteractionJankMonitor;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
@@ -46,6 +47,7 @@ import org.robolectric.RuntimeEnvironment;
|
||||
import org.robolectric.annotation.Config;
|
||||
import org.robolectric.shadows.ShadowSystemProperties;
|
||||
|
||||
@Ignore
|
||||
@RunWith(RobolectricTestRunner.class)
|
||||
@Config(
|
||||
shadows = {
|
||||
|
@@ -21,6 +21,7 @@ import static com.google.common.truth.Truth.assertThat;
|
||||
import android.content.Context;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.utils.ActivityControllerWrapper;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
@@ -34,7 +35,8 @@ public class DevelopmentSettingsDisabledActivityTest {
|
||||
|
||||
@Test
|
||||
public void launchActivity_shouldShowToast() {
|
||||
Robolectric.setupActivity(DevelopmentSettingsDisabledActivity.class);
|
||||
ActivityControllerWrapper.setup(
|
||||
Robolectric.buildActivity(DevelopmentSettingsDisabledActivity.class)).get();
|
||||
|
||||
final Context context = RuntimeEnvironment.application;
|
||||
assertThat(ShadowToast.getTextOfLatestToast())
|
||||
|
@@ -27,6 +27,7 @@ import androidx.preference.Preference;
|
||||
import androidx.test.core.app.ApplicationProvider;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.Mock;
|
||||
@@ -59,6 +60,7 @@ public class RebootWithMtePreferenceControllerTest {
|
||||
assertFalse(mController.isAvailable());
|
||||
}
|
||||
|
||||
@Ignore
|
||||
@Test
|
||||
public void onAvailable_sysPropEnabled() {
|
||||
SystemProperties.set("ro.arm64.memtag.bootctl_supported", "1");
|
||||
|
@@ -35,6 +35,8 @@ import android.os.Build;
|
||||
|
||||
import androidx.preference.Preference;
|
||||
|
||||
import com.android.settings.utils.ActivityControllerWrapper;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
@@ -58,7 +60,8 @@ public class SecurityPatchLevelPreferenceControllerTest {
|
||||
@Before
|
||||
public void setup() {
|
||||
MockitoAnnotations.initMocks(this);
|
||||
mContext = spy(Robolectric.setupActivity(Activity.class));
|
||||
mContext = spy((Context) ActivityControllerWrapper.setup(
|
||||
Robolectric.buildActivity(Activity.class)).get());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@@ -23,6 +23,8 @@ import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.ModuleInfo;
|
||||
|
||||
import com.android.settings.utils.ActivityControllerWrapper;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
@@ -42,7 +44,8 @@ public class ModuleLicensePreferenceTest {
|
||||
@Before
|
||||
public void setup() {
|
||||
MockitoAnnotations.initMocks(this);
|
||||
mContext = Robolectric.setupActivity(Activity.class);
|
||||
mContext = (Context) ActivityControllerWrapper.setup(
|
||||
Robolectric.buildActivity(Activity.class)).get();
|
||||
mModuleInfo = new ModuleInfo();
|
||||
mModuleInfo.setPackageName(PACKAGE_NAME);
|
||||
mModuleInfo.setName(NAME);
|
||||
|
@@ -22,6 +22,7 @@ import android.content.Context;
|
||||
import com.android.settings.core.BasePreferenceController;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.MockitoAnnotations;
|
||||
@@ -48,6 +49,7 @@ public class WallpaperAttributionsPreferenceControllerTest {
|
||||
.isEqualTo(BasePreferenceController.AVAILABLE);
|
||||
}
|
||||
|
||||
@Ignore
|
||||
@Test
|
||||
@Config(qualifiers = "mcc999")
|
||||
public void getAvailabilityStatus_ifNotVisible_false() {
|
||||
|
@@ -36,6 +36,7 @@ import com.android.internal.R;
|
||||
import com.android.settings.testutils.shadow.ShadowSecureSettings;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.Mock;
|
||||
@@ -139,6 +140,7 @@ public class AmbientDisplayAlwaysOnPreferenceControllerTest {
|
||||
assertThat(controller.isSliceable()).isTrue();
|
||||
}
|
||||
|
||||
@Ignore
|
||||
@Test
|
||||
public void isSliceableIncorrectKey_returnsFalse() {
|
||||
final AmbientDisplayAlwaysOnPreferenceController controller =
|
||||
@@ -146,6 +148,7 @@ public class AmbientDisplayAlwaysOnPreferenceControllerTest {
|
||||
assertThat(controller.isSliceable()).isFalse();
|
||||
}
|
||||
|
||||
@Ignore
|
||||
@Test
|
||||
public void isPublicSlice_returnTrue() {
|
||||
assertThat(mController.isPublicSlice()).isTrue();
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user