Snap for 7468789 from fb359d18ff
to sc-release
Change-Id: Ib01f800505cf41cd0c5a08e7f1b98352afa893aa
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -57,6 +57,7 @@
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layoutDirection="ltr"
|
||||
android:orientation="vertical">
|
||||
|
||||
<com.android.settings.accessibility.BalanceSeekBar
|
||||
|
@@ -32,7 +32,8 @@
|
||||
|
||||
<style name="Theme.AlertDialog.Base" parent="@style/Theme.AppCompat.DayNight.Dialog.Alert">
|
||||
<item name="colorAccent">@*android:color/accent_device_default_dark</item>
|
||||
<item name="android:colorBackground">?androidprv:attr/colorSurface</item>
|
||||
<item name="android:colorError">@color/settings_dialog_colorError</item>
|
||||
<item name="android:colorBackground">@*android:color/surface_dark</item>
|
||||
</style>
|
||||
|
||||
<!-- Material theme for the pages containing TabLayout and ViewPager -->
|
||||
|
@@ -5598,6 +5598,10 @@
|
||||
</string>
|
||||
<!-- Title for setting the brightness intensity of the display using Reduce Brightness. [CHAR LIMIT=NONE] -->
|
||||
<string name="reduce_bright_colors_intensity_preference_title">Intensity</string>
|
||||
<!-- Start label for slider that reduces the brightness intensity of the display using Extra Dim. [CHAR LIMIT=NONE] -->
|
||||
<string name="reduce_bright_colors_intensity_start_label">Dimmer</string>
|
||||
<!-- End label for slider that reduces the brightness intensity of the display using Extra Dim. [CHAR LIMIT=NONE] -->
|
||||
<string name="reduce_bright_colors_intensity_end_label">Brighter</string>
|
||||
<!-- Title for setting whether the Reduce Brightness activation state persists across reboots. [CHAR LIMIT=NONE] -->
|
||||
<string name="reduce_bright_colors_persist_preference_title">Keep on after device restarts</string>
|
||||
|
||||
@@ -9100,9 +9104,12 @@
|
||||
<!-- [CHAR LIMIT=60] button title -->
|
||||
<string name="conversation_settings_clear_recents">Clear recent conversations</string>
|
||||
|
||||
<!-- a11y feedeback for 'clear recents' button' -->
|
||||
<!-- a11y feedback for 'clear recents' button' -->
|
||||
<string name="recent_convos_removed">Recent conversations removed</string>
|
||||
|
||||
<!-- a11y feedback for 'clear recent conversation' button' -->
|
||||
<string name="recent_convo_removed">Conversation removed</string>
|
||||
|
||||
<!-- a11y string -->
|
||||
<string name="clear">Clear</string>
|
||||
|
||||
@@ -10133,7 +10140,7 @@
|
||||
<!-- Preference title for Add link [CHAR LIMIT=60] -->
|
||||
<string name="app_launch_add_link">Add link</string>
|
||||
<!-- Footer for Open by default. [CHAR LIMIT=NONE] -->
|
||||
<string name="app_launch_footer">An app can verify links to automatically open in the app. <annotation id="url">Learn more</annotation></string>
|
||||
<string name="app_launch_footer">An app can verify links to automatically open in the app.</string>
|
||||
|
||||
<!-- Title, message and button for verified links dialog. -->
|
||||
<plurals name="app_launch_verified_links_title">
|
||||
@@ -10956,6 +10963,10 @@
|
||||
<string name="disabled_by_policy_title_suspend_packages">Can’t open this app</string>
|
||||
<!-- Dialog title. This dialog lets a user know that a specific setting is blocked by their credit provider. Since the user purchased the device from the credit provider, the credit provider controls what they can access. [CHAR LIMIT=50] -->
|
||||
<string name="disabled_by_policy_title_financed_device">Blocked by your credit provider</string>
|
||||
<!-- Dialog title shown when parental consent is required for the child to set up biometric authentication. [CHAR LIMIT=30] -->
|
||||
<string name="disabled_by_policy_title_biometric_parental_consent">Parent needed</string>
|
||||
<!-- Dialog content shown when parental consent is required for the child to set up biometric authentication. [CHAR LIMIT=NONE] -->
|
||||
<string name="disabled_by_policy_content_biometric_parental_consent">Hand the phone to your parent to start setting this up</string>
|
||||
<!-- Shown when the user tries to change phone settings that are blocked by their IT admin [CHAR LIMIT=200] -->
|
||||
<string name="default_admin_support_msg">If you have questions, contact your IT admin</string>
|
||||
<!-- Shown in dialog to allow user to see more information about the device admin [CHAR LIMIT=30] -->
|
||||
|
@@ -130,7 +130,7 @@
|
||||
<style name="Theme.AlertDialog.Base" parent="@style/Theme.AppCompat.DayNight.Dialog.Alert">
|
||||
<item name="colorAccent">@*android:color/accent_device_default_light</item>
|
||||
<item name="android:colorError">@color/settings_dialog_colorError</item>
|
||||
<item name="android:colorBackground">?androidprv:attr/colorSurface</item>
|
||||
<item name="android:colorBackground">@*android:color/surface_light</item>
|
||||
</style>
|
||||
|
||||
<style name="Theme.AlertDialog" parent="Theme.AlertDialog.Base">
|
||||
|
@@ -80,6 +80,7 @@
|
||||
<Preference
|
||||
android:key="time_spent_in_app"
|
||||
android:title="@string/time_spent_in_app_pref_title"
|
||||
android:summary="@string/summary_placeholder"
|
||||
settings:controller="com.android.settings.applications.appinfo.TimeSpentInAppPreferenceController" />
|
||||
|
||||
<Preference
|
||||
|
@@ -63,7 +63,6 @@
|
||||
<com.android.settingslib.widget.FooterPreference
|
||||
android:key="open_by_default_footer"
|
||||
android:selectable="false"
|
||||
settings:allowDividerAbove="true"
|
||||
settings:searchable="false"/>
|
||||
|
||||
</PreferenceCategory>
|
||||
|
@@ -17,13 +17,18 @@
|
||||
|
||||
<PreferenceScreen
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:settings="http://schemas.android.com/apk/res-auto"
|
||||
android:persistent="false"
|
||||
android:title="@string/reduce_bright_colors_preference_title">
|
||||
|
||||
<com.android.settings.widget.SeekBarPreference
|
||||
<com.android.settings.widget.LabeledSeekBarPreference
|
||||
android:key="rbc_intensity"
|
||||
android:persistent="false"
|
||||
android:title="@string/reduce_bright_colors_intensity_preference_title"/>
|
||||
android:title="@string/reduce_bright_colors_intensity_preference_title"
|
||||
settings:textStart="@string/reduce_bright_colors_intensity_start_label"
|
||||
settings:textEnd="@string/reduce_bright_colors_intensity_end_label"
|
||||
settings:tickMark="@android:color/transparent"
|
||||
/>
|
||||
|
||||
<SwitchPreference
|
||||
android:key="rbc_persist"
|
||||
|
@@ -28,6 +28,7 @@ import com.android.settings.widget.SeekBarPreference;
|
||||
/** PreferenceController for feature intensity. */
|
||||
public class ReduceBrightColorsIntensityPreferenceController extends SliderPreferenceController {
|
||||
|
||||
private static final int INVERSE_PERCENTAGE_BASE = 100;
|
||||
private final ColorDisplayManager mColorDisplayManager;
|
||||
|
||||
public ReduceBrightColorsIntensityPreferenceController(Context context, String key) {
|
||||
@@ -66,21 +67,24 @@ public class ReduceBrightColorsIntensityPreferenceController extends SliderPrefe
|
||||
|
||||
@Override
|
||||
public int getSliderPosition() {
|
||||
return mColorDisplayManager.getReduceBrightColorsStrength();
|
||||
return INVERSE_PERCENTAGE_BASE - mColorDisplayManager.getReduceBrightColorsStrength();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setSliderPosition(int position) {
|
||||
return mColorDisplayManager.setReduceBrightColorsStrength(position);
|
||||
return mColorDisplayManager.setReduceBrightColorsStrength(
|
||||
INVERSE_PERCENTAGE_BASE - position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMax() {
|
||||
return ColorDisplayManager.getMaximumReduceBrightColorsStrength(mContext);
|
||||
return INVERSE_PERCENTAGE_BASE
|
||||
- ColorDisplayManager.getMinimumReduceBrightColorsStrength(mContext);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMin() {
|
||||
return ColorDisplayManager.getMinimumReduceBrightColorsStrength(mContext);
|
||||
return INVERSE_PERCENTAGE_BASE
|
||||
- ColorDisplayManager.getMaximumReduceBrightColorsStrength(mContext);
|
||||
}
|
||||
}
|
||||
|
@@ -39,7 +39,6 @@ import androidx.lifecycle.OnLifecycleEvent;
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.homepage.SettingsHomepageActivity;
|
||||
import com.android.settings.overlay.FeatureFactory;
|
||||
import com.android.settingslib.core.instrumentation.MetricsFeatureProvider;
|
||||
import com.android.settingslib.utils.ThreadUtils;
|
||||
|
||||
import java.net.URISyntaxException;
|
||||
@@ -59,6 +58,7 @@ public class AvatarViewMixin implements LifecycleObserver {
|
||||
private static final String METHOD_GET_ACCOUNT_AVATAR = "getAccountAvatar";
|
||||
private static final String KEY_AVATAR_BITMAP = "account_avatar";
|
||||
private static final String KEY_ACCOUNT_NAME = "account_name";
|
||||
private static final String KEY_AVATAR_ICON = "avatar_icon";
|
||||
private static final String EXTRA_ACCOUNT_NAME = "extra.accountName";
|
||||
|
||||
private final Context mContext;
|
||||
@@ -105,11 +105,8 @@ public class AvatarViewMixin implements LifecycleObserver {
|
||||
return;
|
||||
}
|
||||
|
||||
final MetricsFeatureProvider metricsFeatureProvider = FeatureFactory.getFactory(
|
||||
mContext).getMetricsFeatureProvider();
|
||||
metricsFeatureProvider.action(SettingsEnums.PAGE_UNKNOWN,
|
||||
SettingsEnums.CLICK_ACCOUNT_AVATAR, SettingsEnums.SETTINGS_HOMEPAGE,
|
||||
null /* key */, Integer.MIN_VALUE /* value */);
|
||||
FeatureFactory.getFactory(mContext).getMetricsFeatureProvider()
|
||||
.logSettingsTileClick(KEY_AVATAR_ICON, SettingsEnums.SETTINGS_HOMEPAGE);
|
||||
|
||||
// Here may have two different UI while start the activity.
|
||||
// It will display adding account UI when device has no any account.
|
||||
|
@@ -61,6 +61,7 @@ public final class HibernatedAppsPreferenceController extends BasePreferenceCont
|
||||
private PreferenceScreen mScreen;
|
||||
private int mUnusedCount = 0;
|
||||
private boolean mLoadingUnusedApps;
|
||||
private boolean mLoadedUnusedCount;
|
||||
private final Executor mBackgroundExecutor;
|
||||
private final Executor mMainExecutor;
|
||||
|
||||
@@ -79,14 +80,15 @@ public final class HibernatedAppsPreferenceController extends BasePreferenceCont
|
||||
|
||||
@Override
|
||||
public int getAvailabilityStatus() {
|
||||
return isHibernationEnabled() && mUnusedCount > 0
|
||||
? AVAILABLE : CONDITIONALLY_UNAVAILABLE;
|
||||
return isHibernationEnabled() ? AVAILABLE : CONDITIONALLY_UNAVAILABLE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CharSequence getSummary() {
|
||||
return mContext.getResources().getQuantityString(
|
||||
R.plurals.unused_apps_summary, mUnusedCount, mUnusedCount);
|
||||
return mLoadedUnusedCount
|
||||
? mContext.getResources().getQuantityString(
|
||||
R.plurals.unused_apps_summary, mUnusedCount, mUnusedCount)
|
||||
: mContext.getResources().getString(R.string.summary_placeholder);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -111,8 +113,8 @@ public final class HibernatedAppsPreferenceController extends BasePreferenceCont
|
||||
loadUnusedCount(unusedCount -> {
|
||||
mUnusedCount = unusedCount;
|
||||
mLoadingUnusedApps = false;
|
||||
mLoadedUnusedCount = true;
|
||||
mMainExecutor.execute(() -> {
|
||||
super.displayPreference(mScreen);
|
||||
Preference pref = mScreen.findPreference(mPreferenceKey);
|
||||
refreshSummary(pref);
|
||||
});
|
||||
|
@@ -46,7 +46,6 @@ import com.android.settings.R;
|
||||
import com.android.settings.Utils;
|
||||
import com.android.settings.applications.AppInfoBase;
|
||||
import com.android.settings.applications.ClearDefaultsPreference;
|
||||
import com.android.settings.utils.AnnotationSpan;
|
||||
import com.android.settings.widget.EntityHeaderController;
|
||||
import com.android.settingslib.applications.AppUtils;
|
||||
import com.android.settingslib.widget.FooterPreference;
|
||||
@@ -73,8 +72,6 @@ public class AppLaunchSettings extends AppInfoBase implements
|
||||
"open_by_default_selected_links_category";
|
||||
private static final String OTHER_DETAILS_PREF_CATEGORY_KEY = "app_launch_other_defaults";
|
||||
|
||||
// Url and Uri
|
||||
private static final String ANNOTATION_URL = "url";
|
||||
private static final String LEARN_MORE_URI =
|
||||
"https://developer.android.com/training/app-links/verify-site-associations";
|
||||
|
||||
@@ -356,16 +353,22 @@ public class AppLaunchSettings extends AppInfoBase implements
|
||||
}
|
||||
|
||||
private void initFooter() {
|
||||
// learn more
|
||||
final AnnotationSpan.LinkInfo linkInfo =
|
||||
new AnnotationSpan.LinkInfo(ANNOTATION_URL, v -> {
|
||||
final Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(LEARN_MORE_URI));
|
||||
mContext.startActivity(intent);
|
||||
});
|
||||
final CharSequence footerText = mContext.getText(R.string.app_launch_footer);
|
||||
final FooterPreference footerPreference = (FooterPreference) findPreference(
|
||||
FOOTER_PREF_KEY);
|
||||
footerPreference.setTitle(AnnotationSpan.linkify(footerText, linkInfo));
|
||||
footerPreference.setTitle(footerText);
|
||||
// learn more
|
||||
footerPreference.setLearnMoreAction(view -> {
|
||||
final Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(LEARN_MORE_URI));
|
||||
mContext.startActivity(intent);
|
||||
});
|
||||
final String learnMoreContentDescription = mContext.getString(
|
||||
R.string.footer_learn_more_content_description, getLabelName());
|
||||
footerPreference.setLearnMoreContentDescription(learnMoreContentDescription);
|
||||
}
|
||||
|
||||
private String getLabelName() {
|
||||
return mContext.getString(R.string.launch_by_default);
|
||||
}
|
||||
|
||||
private boolean isClearDefaultsEnabled() {
|
||||
|
@@ -22,6 +22,7 @@ import android.content.Context;
|
||||
import android.hardware.biometrics.BiometricAuthenticator;
|
||||
import android.hardware.biometrics.ParentalControlsUtilsInternal;
|
||||
import android.os.UserHandle;
|
||||
import android.os.UserManager;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
@@ -49,7 +50,8 @@ public class ParentalControlsUtils {
|
||||
final UserHandle userHandle = new UserHandle(UserHandle.myUserId());
|
||||
if (ParentalControlsUtilsInternal.isTestModeEnabled(context)) {
|
||||
Log.d(TAG, "Requiring consent for test flow");
|
||||
return new RestrictedLockUtils.EnforcedAdmin(null /* ComponentName */, userHandle);
|
||||
return new RestrictedLockUtils.EnforcedAdmin(null /* ComponentName */,
|
||||
UserManager.DISALLOW_BIOMETRIC, userHandle);
|
||||
}
|
||||
|
||||
final DevicePolicyManager dpm = context.getSystemService(DevicePolicyManager.class);
|
||||
@@ -69,7 +71,8 @@ public class ParentalControlsUtils {
|
||||
userHandle)) {
|
||||
final ComponentName cn =
|
||||
ParentalControlsUtilsInternal.getSupervisionComponentName(dpm, userHandle);
|
||||
return new RestrictedLockUtils.EnforcedAdmin(cn, userHandle);
|
||||
return new RestrictedLockUtils.EnforcedAdmin(cn, UserManager.DISALLOW_BIOMETRIC,
|
||||
userHandle);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
@@ -43,6 +43,7 @@ import androidx.preference.PreferenceScreen;
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.Utils;
|
||||
import com.android.settings.core.BasePreferenceController;
|
||||
import com.android.settings.overlay.FeatureFactory;
|
||||
import com.android.settingslib.widget.LayoutPreference;
|
||||
|
||||
import java.util.List;
|
||||
@@ -57,6 +58,7 @@ public class MoreSettingsPreferenceController extends BasePreferenceController i
|
||||
private static final String TAG = "MoreSettingsPrefCtrl";
|
||||
@VisibleForTesting
|
||||
Intent mIntent;
|
||||
private LayoutPreference mPreference;
|
||||
|
||||
public MoreSettingsPreferenceController(Context context, String preferenceKey) {
|
||||
super(context, preferenceKey);
|
||||
@@ -82,8 +84,8 @@ public class MoreSettingsPreferenceController extends BasePreferenceController i
|
||||
@Override
|
||||
public void displayPreference(PreferenceScreen screen) {
|
||||
super.displayPreference(screen);
|
||||
final LayoutPreference pref = screen.findPreference(getPreferenceKey());
|
||||
final Button button = pref.findViewById(R.id.button);
|
||||
mPreference = screen.findPreference(getPreferenceKey());
|
||||
final Button button = mPreference.findViewById(R.id.button);
|
||||
final Drawable icon = getIcon();
|
||||
button.setText(getButtonText());
|
||||
if (icon != null) {
|
||||
@@ -109,6 +111,8 @@ public class MoreSettingsPreferenceController extends BasePreferenceController i
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
FeatureFactory.getFactory(mContext).getMetricsFeatureProvider()
|
||||
.logClickedPreference(mPreference, getMetricsCategory());
|
||||
final Intent intent = new Intent(mIntent)
|
||||
.addCategory(Intent.CATEGORY_LAUNCHER)
|
||||
.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||
@@ -170,5 +174,4 @@ public class MoreSettingsPreferenceController extends BasePreferenceController i
|
||||
icon.draw(canvas);
|
||||
return bitmap;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -37,7 +37,7 @@ public class ActionDisabledByAdminDialog extends Activity
|
||||
final RestrictedLockUtils.EnforcedAdmin enforcedAdmin =
|
||||
getAdminDetailsFromIntent(getIntent());
|
||||
final String restriction = getRestrictionFromIntent(getIntent());
|
||||
mDialogHelper = new ActionDisabledByAdminDialogHelper(this);
|
||||
mDialogHelper = new ActionDisabledByAdminDialogHelper(this, restriction);
|
||||
mDialogHelper.prepareDialogBuilder(restriction, enforcedAdmin)
|
||||
.setOnDismissListener(this)
|
||||
.show();
|
||||
|
@@ -56,11 +56,16 @@ public final class ActionDisabledByAdminDialogHelper {
|
||||
private final Activity mActivity;
|
||||
|
||||
public ActionDisabledByAdminDialogHelper(Activity activity) {
|
||||
this(activity, null /* restriction */);
|
||||
}
|
||||
|
||||
public ActionDisabledByAdminDialogHelper(Activity activity, String restriction) {
|
||||
mActivity = activity;
|
||||
mDialogView = (ViewGroup) LayoutInflater.from(mActivity).inflate(
|
||||
R.layout.admin_support_details_dialog, null);
|
||||
mActionDisabledByAdminController = ActionDisabledByAdminControllerFactory
|
||||
.createInstance(mActivity, new DeviceAdminStringProviderImpl(mActivity));
|
||||
.createInstance(mActivity, restriction,
|
||||
new DeviceAdminStringProviderImpl(mActivity));
|
||||
}
|
||||
|
||||
private @UserIdInt int getEnforcementAdminUserId(@NonNull EnforcedAdmin admin) {
|
||||
@@ -74,7 +79,9 @@ public final class ActionDisabledByAdminDialogHelper {
|
||||
public AlertDialog.Builder prepareDialogBuilder(String restriction,
|
||||
EnforcedAdmin enforcedAdmin) {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(mActivity)
|
||||
.setPositiveButton(R.string.okay, null)
|
||||
.setPositiveButton(R.string.okay,
|
||||
mActionDisabledByAdminController
|
||||
.getPositiveButtonListener(mActivity, enforcedAdmin))
|
||||
.setView(mDialogView);
|
||||
prepareDialogBuilder(builder, restriction, enforcedAdmin);
|
||||
return builder;
|
||||
|
@@ -79,4 +79,14 @@ class DeviceAdminStringProviderImpl implements DeviceAdminStringProvider {
|
||||
public String getDisabledByPolicyTitleForFinancedDevice() {
|
||||
return mContext.getString(R.string.disabled_by_policy_title_financed_device);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDisabledBiometricsParentConsentTitle() {
|
||||
return mContext.getString(R.string.disabled_by_policy_title_biometric_parental_consent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDisabledBiometricsParentConsentContent() {
|
||||
return mContext.getString(R.string.disabled_by_policy_content_biometric_parental_consent);
|
||||
}
|
||||
}
|
||||
|
@@ -17,17 +17,30 @@
|
||||
package com.android.settings.gestures;
|
||||
|
||||
import android.content.Context;
|
||||
import android.net.Uri;
|
||||
|
||||
import androidx.preference.PreferenceScreen;
|
||||
|
||||
import com.android.settings.widget.SettingsMainSwitchPreferenceController;
|
||||
import com.android.settingslib.core.lifecycle.LifecycleObserver;
|
||||
import com.android.settingslib.core.lifecycle.events.OnStart;
|
||||
import com.android.settingslib.core.lifecycle.events.OnStop;
|
||||
import com.android.settingslib.widget.MainSwitchPreference;
|
||||
|
||||
/**
|
||||
* The controller to handle one-handed mode main switch enable or disable state.
|
||||
**/
|
||||
public class OneHandedMainSwitchPreferenceController extends
|
||||
SettingsMainSwitchPreferenceController {
|
||||
SettingsMainSwitchPreferenceController implements OneHandedSettingsUtils.TogglesCallback,
|
||||
LifecycleObserver, OnStart, OnStop {
|
||||
|
||||
private final OneHandedSettingsUtils mUtils;
|
||||
|
||||
private MainSwitchPreference mPreference;
|
||||
|
||||
public OneHandedMainSwitchPreferenceController(Context context, String preferenceKey) {
|
||||
super(context, preferenceKey);
|
||||
mUtils = new OneHandedSettingsUtils(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -53,4 +66,30 @@ public class OneHandedMainSwitchPreferenceController extends
|
||||
OneHandedSettingsUtils.setOneHandedModeEnabled(mContext, isChecked);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void displayPreference(PreferenceScreen screen) {
|
||||
super.displayPreference(screen);
|
||||
mPreference = screen.findPreference(getPreferenceKey());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart() {
|
||||
mUtils.registerToggleAwareObserver(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStop() {
|
||||
mUtils.unregisterToggleAwareObserver();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChange(Uri uri) {
|
||||
if (mPreference == null) {
|
||||
return;
|
||||
}
|
||||
if (uri.equals(OneHandedSettingsUtils.ONE_HANDED_MODE_ENABLED_URI)) {
|
||||
mPreference.setChecked(isChecked());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -18,14 +18,11 @@ package com.android.settings.homepage;
|
||||
|
||||
import android.animation.LayoutTransition;
|
||||
import android.app.ActivityManager;
|
||||
import android.app.ActivityOptions;
|
||||
import android.app.settings.SettingsEnums;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.util.FeatureFlagUtils;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.Toolbar;
|
||||
@@ -36,13 +33,11 @@ import androidx.fragment.app.FragmentManager;
|
||||
import androidx.fragment.app.FragmentTransaction;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.Utils;
|
||||
import com.android.settings.accounts.AvatarViewMixin;
|
||||
import com.android.settings.core.FeatureFlags;
|
||||
import com.android.settings.homepage.contextualcards.ContextualCardsFragment;
|
||||
import com.android.settings.overlay.FeatureFactory;
|
||||
import com.android.settingslib.core.lifecycle.HideNonSystemOverlayMixin;
|
||||
import com.android.settingslib.transition.SettingsTransitionHelper;
|
||||
|
||||
public class SettingsHomepageActivity extends FragmentActivity {
|
||||
|
||||
@@ -69,12 +64,6 @@ public class SettingsHomepageActivity extends FragmentActivity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
if (Utils.isPageTransitionEnabled(this)) {
|
||||
// Enable Activity transitions
|
||||
getWindow().requestFeature(Window.FEATURE_ACTIVITY_TRANSITIONS);
|
||||
SettingsTransitionHelper.applyForwardTransition(this);
|
||||
SettingsTransitionHelper.applyBackwardTransition(this);
|
||||
}
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.settings_homepage_container);
|
||||
|
||||
@@ -107,16 +96,6 @@ public class SettingsHomepageActivity extends FragmentActivity {
|
||||
.getLayoutTransition().enableTransitionType(LayoutTransition.CHANGING);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startActivity(Intent intent) {
|
||||
if (Utils.isPageTransitionEnabled(this)) {
|
||||
final Bundle bundle = ActivityOptions.makeSceneTransitionAnimation(this).toBundle();
|
||||
super.startActivity(intent, bundle);
|
||||
return;
|
||||
}
|
||||
super.startActivity(intent);
|
||||
}
|
||||
|
||||
private void showSuggestionFragment() {
|
||||
final Class<? extends Fragment> fragment = FeatureFactory.getFactory(this)
|
||||
.getSuggestionFeatureProvider(this).getContextualSuggestionFragment();
|
||||
|
@@ -88,6 +88,13 @@ public class ApnSettings extends RestrictedSettingsFragment
|
||||
Telephony.Carriers.EDITED_STATUS,
|
||||
};
|
||||
|
||||
/** Copied from {@code com.android.internal.telephony.TelephonyIntents} */
|
||||
private static final String ACTION_SIM_STATE_CHANGED =
|
||||
"android.intent.action.SIM_STATE_CHANGED";
|
||||
/** Copied from {@code com.android.internal.telephony.IccCardConstants} */
|
||||
public static final String INTENT_KEY_ICC_STATE = "ss";
|
||||
public static final String INTENT_VALUE_ICC_ABSENT = "ABSENT";
|
||||
|
||||
private static final int ID_INDEX = 0;
|
||||
private static final int NAME_INDEX = 1;
|
||||
private static final int APN_INDEX = 2;
|
||||
@@ -151,7 +158,16 @@ public class ApnSettings extends RestrictedSettingsFragment
|
||||
private final BroadcastReceiver mReceiver = new BroadcastReceiver() {
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
if (intent.getAction().equals(
|
||||
String action = intent.getAction();
|
||||
if (ACTION_SIM_STATE_CHANGED.equals(action)
|
||||
&& intent.getStringExtra(INTENT_KEY_ICC_STATE)
|
||||
.equals(INTENT_VALUE_ICC_ABSENT)) {
|
||||
final SubscriptionManager sm = context.getSystemService(SubscriptionManager.class);
|
||||
if (sm != null && !sm.isActiveSubscriptionId(mSubId)) {
|
||||
Log.d(TAG, "Due to SIM absent, closes APN settings page");
|
||||
finish();
|
||||
}
|
||||
} else if (intent.getAction().equals(
|
||||
TelephonyManager.ACTION_SUBSCRIPTION_CARRIER_IDENTITY_CHANGED)) {
|
||||
if (mRestoreDefaultApnMode) {
|
||||
return;
|
||||
@@ -201,8 +217,9 @@ public class ApnSettings extends RestrictedSettingsFragment
|
||||
mSubId = activity.getIntent().getIntExtra(SUB_ID,
|
||||
SubscriptionManager.INVALID_SUBSCRIPTION_ID);
|
||||
mPhoneId = SubscriptionUtil.getPhoneId(activity, mSubId);
|
||||
mIntentFilter = new IntentFilter(
|
||||
TelephonyManager.ACTION_SUBSCRIPTION_CARRIER_IDENTITY_CHANGED);
|
||||
mIntentFilter = new IntentFilter();
|
||||
mIntentFilter.addAction(TelephonyManager.ACTION_SUBSCRIPTION_CARRIER_IDENTITY_CHANGED);
|
||||
mIntentFilter.addAction(ACTION_SIM_STATE_CHANGED);
|
||||
|
||||
setIfOnlyAvailableForAdmins(true);
|
||||
|
||||
|
@@ -167,6 +167,8 @@ public class RecentConversationsPreferenceController extends AbstractPreferenceC
|
||||
pref.setOnClearClickListener(() -> {
|
||||
try {
|
||||
mPs.removeRecentConversation(pkg, UserHandle.getUserId(uid), conversationId);
|
||||
pref.getClearView().announceForAccessibility(
|
||||
mContext.getString(R.string.recent_convo_removed));
|
||||
parent.removePreference(pref);
|
||||
} catch (RemoteException e) {
|
||||
Slog.w(TAG, "Could not clear recent", e);
|
||||
|
@@ -26,8 +26,11 @@ import android.content.pm.ActivityInfo;
|
||||
import android.content.pm.ComponentInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.pm.ServiceInfo;
|
||||
import android.os.Binder;
|
||||
import android.provider.Settings;
|
||||
import android.service.notification.ConditionProviderService;
|
||||
import android.util.Log;
|
||||
import android.util.Slog;
|
||||
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.preference.Preference;
|
||||
@@ -36,6 +39,7 @@ import com.android.settings.core.PreferenceControllerMixin;
|
||||
import com.android.settingslib.core.lifecycle.Lifecycle;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
abstract public class AbstractZenModeAutomaticRulePreferenceController extends
|
||||
AbstractZenModePreferenceController implements PreferenceControllerMixin {
|
||||
@@ -92,7 +96,7 @@ abstract public class AbstractZenModeAutomaticRulePreferenceController extends
|
||||
? ci.metaData.getString(ConditionProviderService.META_DATA_RULE_TYPE)
|
||||
: ci.metaData.getString(NotificationManager.META_DATA_AUTOMATIC_RULE_TYPE);
|
||||
|
||||
final ComponentName configurationActivity = getSettingsActivity(null, ci);
|
||||
final ComponentName configurationActivity = getSettingsActivity(pm, null, ci);
|
||||
if (ruleType != null && !ruleType.trim().isEmpty() && configurationActivity != null) {
|
||||
final ZenRuleInfo ri = new ZenRuleInfo();
|
||||
ri.serviceComponent =
|
||||
@@ -110,28 +114,44 @@ abstract public class AbstractZenModeAutomaticRulePreferenceController extends
|
||||
return null;
|
||||
}
|
||||
|
||||
protected static ComponentName getSettingsActivity(AutomaticZenRule rule, ComponentInfo ci) {
|
||||
protected static ComponentName getSettingsActivity(PackageManager pm, AutomaticZenRule rule,
|
||||
ComponentInfo ci) {
|
||||
String owner = rule != null ? rule.getPackageName() : ci.packageName;
|
||||
ComponentName settingsActivity = null;
|
||||
// prefer config activity on the rule itself; fallback to manifest definition
|
||||
if (rule != null && rule.getConfigurationActivity() != null) {
|
||||
return rule.getConfigurationActivity();
|
||||
}
|
||||
if (ci == null) {
|
||||
return null;
|
||||
}
|
||||
// new activity backed rule
|
||||
if (ci instanceof ActivityInfo) {
|
||||
return new ComponentName(ci.packageName, ci.name);
|
||||
}
|
||||
// old service backed rule
|
||||
if (ci.metaData != null) {
|
||||
final String configurationActivity = ci.metaData.getString(
|
||||
ConditionProviderService.META_DATA_CONFIGURATION_ACTIVITY);
|
||||
if (configurationActivity != null) {
|
||||
return ComponentName.unflattenFromString(configurationActivity);
|
||||
settingsActivity = rule.getConfigurationActivity();
|
||||
} else {
|
||||
if (ci == null) {
|
||||
settingsActivity = null;
|
||||
} else if (ci instanceof ActivityInfo) {
|
||||
// new activity backed rule
|
||||
settingsActivity = new ComponentName(ci.packageName, ci.name);
|
||||
} else if (ci.metaData != null) {
|
||||
// old service backed rule
|
||||
final String configurationActivity = ci.metaData.getString(
|
||||
ConditionProviderService.META_DATA_CONFIGURATION_ACTIVITY);
|
||||
if (configurationActivity != null) {
|
||||
settingsActivity = ComponentName.unflattenFromString(configurationActivity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
if (settingsActivity == null || owner == null) {
|
||||
return settingsActivity;
|
||||
}
|
||||
try {
|
||||
int ownerUid = pm.getPackageUid(owner, 0);
|
||||
int configActivityOwnerUid = pm.getPackageUid(settingsActivity.getPackageName(), 0);
|
||||
if (ownerUid == configActivityOwnerUid) {
|
||||
return settingsActivity;
|
||||
} else {
|
||||
Log.w(TAG, "Config activity not in owner package for " + rule.getName());
|
||||
return null;
|
||||
}
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
Log.e(TAG, "Failed to find config activity");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public class RuleNameChangeListener implements ZenRuleNameDialog.PositiveClickListener {
|
||||
|
@@ -168,7 +168,7 @@ public class ZenRulePreference extends TwoTargetPreference {
|
||||
: isEvent ? ZenModeEventRuleSettings.ACTION : "";
|
||||
ComponentInfo si = mServiceListing.findService(rule.getOwner());
|
||||
ComponentName settingsActivity = AbstractZenModeAutomaticRulePreferenceController.
|
||||
getSettingsActivity(rule, si);
|
||||
getSettingsActivity(mPm, rule, si);
|
||||
mIntent = AbstractZenModeAutomaticRulePreferenceController.getRuleIntent(action,
|
||||
settingsActivity, mId);
|
||||
if (mIntent.resolveActivity(mPm) == null) {
|
||||
|
@@ -21,7 +21,6 @@ import static android.view.View.IMPORTANT_FOR_ACCESSIBILITY_NO;
|
||||
import android.annotation.NonNull;
|
||||
import android.app.Activity;
|
||||
import android.app.ActivityOptions;
|
||||
import android.app.settings.SettingsEnums;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
@@ -43,6 +42,7 @@ import com.google.android.setupcompat.util.WizardManagerHelper;
|
||||
*/
|
||||
public interface SearchFeatureProvider {
|
||||
|
||||
String KEY_HOMEPAGE_SEARCH_BAR = "homepage_search_bar";
|
||||
int REQUEST_CODE = 501;
|
||||
|
||||
/**
|
||||
@@ -100,8 +100,9 @@ public interface SearchFeatureProvider {
|
||||
|
||||
FeatureFactory.getFactory(context).getSlicesFeatureProvider()
|
||||
.indexSliceDataAsync(context);
|
||||
|
||||
FeatureFactory.getFactory(context).getMetricsFeatureProvider()
|
||||
.action(context, SettingsEnums.ACTION_SEARCH_RESULTS);
|
||||
.logSettingsTileClick(KEY_HOMEPAGE_SEARCH_BAR, pageId);
|
||||
final Bundle bundle = ActivityOptions.makeSceneTransitionAnimation(activity).toBundle();
|
||||
activity.startActivityForResult(intent, REQUEST_CODE, bundle);
|
||||
});
|
||||
|
@@ -56,6 +56,15 @@ public class OneHandedMainSwitchPreferenceControllerTest {
|
||||
assertThat(OneHandedSettingsUtils.isOneHandedModeEnabled(mContext)).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void isChecked_setOneHandedModeEnabled_shouldReturnTrue() {
|
||||
SystemProperties.set(OneHandedSettingsUtils.SUPPORT_ONE_HANDED_MODE, "true");
|
||||
mUtils.setNavigationBarMode(mContext, "2" /* fully gestural */);
|
||||
OneHandedSettingsUtils.setOneHandedModeEnabled(mContext, true);
|
||||
|
||||
assertThat(mController.isChecked()).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getAvailabilityStatus_setSupportOneHandedModeProperty_shouldAvailable() {
|
||||
SystemProperties.set(OneHandedSettingsUtils.SUPPORT_ONE_HANDED_MODE, "true");
|
||||
|
@@ -38,7 +38,6 @@ import com.android.settings.R;
|
||||
import com.android.settings.dashboard.suggestions.SuggestionFeatureProviderImpl;
|
||||
import com.android.settings.homepage.contextualcards.slices.BatteryFixSliceTest;
|
||||
import com.android.settings.testutils.shadow.ShadowUserManager;
|
||||
import com.android.settings.testutils.shadow.ShadowUtils;
|
||||
import com.android.settingslib.core.lifecycle.HideNonSystemOverlayMixin;
|
||||
|
||||
import org.junit.Before;
|
||||
@@ -59,13 +58,12 @@ import org.robolectric.util.ReflectionHelpers;
|
||||
|
||||
@RunWith(RobolectricTestRunner.class)
|
||||
@Config(shadows = {ShadowUserManager.class,
|
||||
SettingsHomepageActivityTest.ShadowSuggestionFeatureProviderImpl.class, ShadowUtils.class})
|
||||
SettingsHomepageActivityTest.ShadowSuggestionFeatureProviderImpl.class})
|
||||
public class SettingsHomepageActivityTest {
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
MockitoAnnotations.initMocks(this);
|
||||
ShadowUtils.setIsPageTransitionEnabled(false);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@@ -0,0 +1,169 @@
|
||||
/*
|
||||
* Copyright (C) 2021 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.android.settings.notification.zen;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import android.app.AutomaticZenRule;
|
||||
import android.app.NotificationManager;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.pm.ComponentInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.service.notification.ConditionProviderService;
|
||||
import android.service.notification.ZenPolicy;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.MockitoAnnotations;
|
||||
import org.robolectric.RobolectricTestRunner;
|
||||
import org.robolectric.RuntimeEnvironment;
|
||||
|
||||
@RunWith(RobolectricTestRunner.class)
|
||||
public class AbstractZenModeAutomaticRulePreferenceControllerTest {
|
||||
|
||||
@Mock
|
||||
private PackageManager mPm;
|
||||
private Context mContext;
|
||||
|
||||
@Before
|
||||
public void setup() {
|
||||
MockitoAnnotations.initMocks(this);
|
||||
mContext = RuntimeEnvironment.application;
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetSettingsActivity_configActivity() throws Exception {
|
||||
AutomaticZenRule rule = new AutomaticZenRule("name", null,
|
||||
new ComponentName(mContext.getPackageName(), "test"), Uri.EMPTY,
|
||||
new ZenPolicy(), NotificationManager.INTERRUPTION_FILTER_PRIORITY, true);
|
||||
rule.setPackageName(mContext.getPackageName());
|
||||
|
||||
when(mPm.getPackageUid(null, 0)).thenReturn(-1);
|
||||
when(mPm.getPackageUid(mContext.getPackageName(), 0)).thenReturn(1);
|
||||
|
||||
ComponentName actual = AbstractZenModeAutomaticRulePreferenceController
|
||||
.getSettingsActivity(mPm, rule, null);
|
||||
|
||||
assertThat(actual).isEqualTo(new ComponentName(mContext.getPackageName(), "test"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetSettingsActivity_configActivity_wrongPackage() throws Exception {
|
||||
AutomaticZenRule rule = new AutomaticZenRule("name", null,
|
||||
new ComponentName("another", "test"), Uri.EMPTY,
|
||||
new ZenPolicy(), NotificationManager.INTERRUPTION_FILTER_PRIORITY, true);
|
||||
rule.setPackageName(mContext.getPackageName());
|
||||
|
||||
when(mPm.getPackageUid(null, 0)).thenReturn(-1);
|
||||
when(mPm.getPackageUid(mContext.getPackageName(), 0)).thenReturn(1);
|
||||
|
||||
ComponentName actual = AbstractZenModeAutomaticRulePreferenceController
|
||||
.getSettingsActivity(mPm, rule, null);
|
||||
|
||||
assertThat(actual).isNull();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetSettingsActivity_configActivity_unspecifiedOwner() throws Exception {
|
||||
AutomaticZenRule rule = new AutomaticZenRule("name", null,
|
||||
new ComponentName("another", "test"), Uri.EMPTY,
|
||||
new ZenPolicy(), NotificationManager.INTERRUPTION_FILTER_PRIORITY, true);
|
||||
|
||||
when(mPm.getPackageUid(null, 0)).thenReturn(-1);
|
||||
when(mPm.getPackageUid(mContext.getPackageName(), 0)).thenReturn(1);
|
||||
|
||||
ComponentName actual = AbstractZenModeAutomaticRulePreferenceController
|
||||
.getSettingsActivity(mPm, rule, null);
|
||||
|
||||
assertThat(actual).isEqualTo(new ComponentName("another", "test"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetSettingsActivity_cps() throws Exception {
|
||||
AutomaticZenRule rule = new AutomaticZenRule("name",
|
||||
new ComponentName(mContext.getPackageName(), "service"), null, Uri.EMPTY,
|
||||
new ZenPolicy(), NotificationManager.INTERRUPTION_FILTER_PRIORITY, true);
|
||||
rule.setPackageName(mContext.getPackageName());
|
||||
|
||||
ComponentInfo ci = new ComponentInfo();
|
||||
ci.packageName = mContext.getPackageName();
|
||||
ci.metaData = new Bundle();
|
||||
ci.metaData.putString(ConditionProviderService.META_DATA_CONFIGURATION_ACTIVITY,
|
||||
ComponentName.flattenToShortString(
|
||||
new ComponentName(mContext.getPackageName(), "activity")));
|
||||
|
||||
when(mPm.getPackageUid(null, 0)).thenReturn(-1);
|
||||
when(mPm.getPackageUid(mContext.getPackageName(), 0)).thenReturn(1);
|
||||
|
||||
ComponentName actual = AbstractZenModeAutomaticRulePreferenceController
|
||||
.getSettingsActivity(mPm, rule, ci);
|
||||
|
||||
assertThat(actual).isEqualTo(new ComponentName(mContext.getPackageName(), "activity"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetSettingsActivity_cps_wrongPackage() throws Exception {
|
||||
AutomaticZenRule rule = new AutomaticZenRule("name",
|
||||
new ComponentName(mContext.getPackageName(), "service"), null, Uri.EMPTY,
|
||||
new ZenPolicy(), NotificationManager.INTERRUPTION_FILTER_PRIORITY, true);
|
||||
rule.setPackageName("other");
|
||||
|
||||
ComponentInfo ci = new ComponentInfo();
|
||||
ci.packageName = mContext.getPackageName();
|
||||
ci.metaData = new Bundle();
|
||||
ci.metaData.putString(ConditionProviderService.META_DATA_CONFIGURATION_ACTIVITY,
|
||||
ComponentName.flattenToShortString(
|
||||
new ComponentName(mContext.getPackageName(), "activity")));
|
||||
|
||||
when(mPm.getPackageUid(null, 0)).thenReturn(-1);
|
||||
when(mPm.getPackageUid(mContext.getPackageName(), 0)).thenReturn(1);
|
||||
|
||||
ComponentName actual = AbstractZenModeAutomaticRulePreferenceController
|
||||
.getSettingsActivity(mPm, rule, ci);
|
||||
|
||||
assertThat(actual).isNull();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetSettingsActivity_cps_unspecifiedPackage() throws Exception {
|
||||
AutomaticZenRule rule = new AutomaticZenRule("name",
|
||||
new ComponentName(mContext.getPackageName(), "service"), null, Uri.EMPTY,
|
||||
new ZenPolicy(), NotificationManager.INTERRUPTION_FILTER_PRIORITY, true);
|
||||
|
||||
ComponentInfo ci = new ComponentInfo();
|
||||
ci.packageName = mContext.getPackageName();
|
||||
ci.metaData = new Bundle();
|
||||
ci.metaData.putString(ConditionProviderService.META_DATA_CONFIGURATION_ACTIVITY,
|
||||
ComponentName.flattenToShortString(
|
||||
new ComponentName(mContext.getPackageName(), "activity")));
|
||||
|
||||
when(mPm.getPackageUid(null, 0)).thenReturn(-1);
|
||||
when(mPm.getPackageUid(mContext.getPackageName(), 0)).thenReturn(1);
|
||||
|
||||
ComponentName actual = AbstractZenModeAutomaticRulePreferenceController
|
||||
.getSettingsActivity(mPm, rule, ci);
|
||||
|
||||
assertThat(actual).isEqualTo(new ComponentName(mContext.getPackageName(), "activity"));
|
||||
}
|
||||
}
|
@@ -84,7 +84,7 @@ public class ReduceBrightColorsIntensityPreferenceControllerTest {
|
||||
assertThat(
|
||||
Settings.Secure.getInt(mContext.getContentResolver(),
|
||||
Settings.Secure.REDUCE_BRIGHT_COLORS_LEVEL, 0))
|
||||
.isEqualTo(20);
|
||||
.isEqualTo(80);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -92,8 +92,10 @@ public class ReduceBrightColorsIntensityPreferenceControllerTest {
|
||||
when(mResources.getInteger(
|
||||
R.integer.config_reduceBrightColorsStrengthMax)).thenReturn(90);
|
||||
when(mResources.getInteger(
|
||||
R.integer.config_reduceBrightColorsStrengthMin)).thenReturn(10);
|
||||
R.integer.config_reduceBrightColorsStrengthMin)).thenReturn(15);
|
||||
assertThat(mPreferenceController.getMax()).isEqualTo(85);
|
||||
assertThat(mPreferenceController.getMin()).isEqualTo(10);
|
||||
assertThat(mPreferenceController.getMax() - mPreferenceController.getMin())
|
||||
.isEqualTo(80);
|
||||
.isEqualTo(75);
|
||||
}
|
||||
}
|
||||
|
@@ -35,6 +35,7 @@ import static android.hardware.biometrics.BiometricAuthenticator.TYPE_IRIS;
|
||||
|
||||
import android.hardware.biometrics.BiometricAuthenticator;
|
||||
import android.os.UserHandle;
|
||||
import android.os.UserManager;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||
@@ -92,6 +93,7 @@ public class ParentalControlsUtilsTest {
|
||||
mSupervisionComponentName, tests[i][0] /* modality */,
|
||||
tests[i][1] /* keyguardDisableFlags */);
|
||||
assertNotNull(admin);
|
||||
assertEquals(UserManager.DISALLOW_BIOMETRIC, admin.enforcedRestriction);
|
||||
assertEquals(mSupervisionComponentName, admin.component);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user