diff options
30 files changed, 478 insertions, 150 deletions
diff --git a/core/api/current.txt b/core/api/current.txt index 5e5d7c629a38..06c37d21ed37 100644 --- a/core/api/current.txt +++ b/core/api/current.txt @@ -5573,6 +5573,7 @@ package android.app { field public static final String EXTRA_PROGRESS = "android.progress"; field public static final String EXTRA_PROGRESS_INDETERMINATE = "android.progressIndeterminate"; field public static final String EXTRA_PROGRESS_MAX = "android.progressMax"; + field public static final String EXTRA_PROMOTE_PICTURE = "android.promotePicture"; field public static final String EXTRA_REMOTE_INPUT_DRAFT = "android.remoteInputDraft"; field public static final String EXTRA_REMOTE_INPUT_HISTORY = "android.remoteInputHistory"; field @Deprecated public static final String EXTRA_SELF_DISPLAY_NAME = "android.selfDisplayName"; @@ -5712,12 +5713,13 @@ package android.app { public static class Notification.BigPictureStyle extends android.app.Notification.Style { ctor public Notification.BigPictureStyle(); ctor @Deprecated public Notification.BigPictureStyle(android.app.Notification.Builder); - method public android.app.Notification.BigPictureStyle bigLargeIcon(android.graphics.Bitmap); - method public android.app.Notification.BigPictureStyle bigLargeIcon(android.graphics.drawable.Icon); - method public android.app.Notification.BigPictureStyle bigPicture(android.graphics.Bitmap); + method @NonNull public android.app.Notification.BigPictureStyle bigLargeIcon(@Nullable android.graphics.Bitmap); + method @NonNull public android.app.Notification.BigPictureStyle bigLargeIcon(@Nullable android.graphics.drawable.Icon); + method @NonNull public android.app.Notification.BigPictureStyle bigPicture(@Nullable android.graphics.Bitmap); method @NonNull public android.app.Notification.BigPictureStyle bigPictureContentDescription(@Nullable CharSequence); - method public android.app.Notification.BigPictureStyle setBigContentTitle(CharSequence); - method public android.app.Notification.BigPictureStyle setSummaryText(CharSequence); + method @NonNull public android.app.Notification.BigPictureStyle setBigContentTitle(@Nullable CharSequence); + method @NonNull public android.app.Notification.BigPictureStyle setSummaryText(@Nullable CharSequence); + method @NonNull public android.app.Notification.BigPictureStyle showBigPictureWhenCollapsed(boolean); } public static class Notification.BigTextStyle extends android.app.Notification.Style { @@ -7191,6 +7193,7 @@ package android.app.admin { field public static final String EXTRA_ADD_EXPLANATION = "android.app.extra.ADD_EXPLANATION"; field public static final String EXTRA_DELEGATION_SCOPES = "android.app.extra.DELEGATION_SCOPES"; field public static final String EXTRA_DEVICE_ADMIN = "android.app.extra.DEVICE_ADMIN"; + field public static final String EXTRA_DEVICE_PASSWORD_REQUIREMENT_ONLY = "android.app.extra.DEVICE_PASSWORD_REQUIREMENT_ONLY"; field @RequiresPermission(android.Manifest.permission.REQUEST_PASSWORD_COMPLEXITY) public static final String EXTRA_PASSWORD_COMPLEXITY = "android.app.extra.PASSWORD_COMPLEXITY"; field public static final String EXTRA_PROVISIONING_ACCOUNT_TO_MIGRATE = "android.app.extra.PROVISIONING_ACCOUNT_TO_MIGRATE"; field public static final String EXTRA_PROVISIONING_ADMIN_EXTRAS_BUNDLE = "android.app.extra.PROVISIONING_ADMIN_EXTRAS_BUNDLE"; diff --git a/core/api/system-current.txt b/core/api/system-current.txt index a7602f8ad288..728affae2a3b 100644 --- a/core/api/system-current.txt +++ b/core/api/system-current.txt @@ -2344,6 +2344,7 @@ package android.content.pm { field public static final String EXTRA_REQUEST_PERMISSIONS_RESULTS = "android.content.pm.extra.REQUEST_PERMISSIONS_RESULTS"; field public static final String FEATURE_BROADCAST_RADIO = "android.hardware.broadcastradio"; field public static final String FEATURE_CONTEXT_HUB = "android.hardware.context_hub"; + field public static final String FEATURE_CROSS_LAYER_BLUR = "android.software.cross_layer_blur"; field public static final String FEATURE_INCREMENTAL_DELIVERY = "android.software.incremental_delivery"; field public static final String FEATURE_REBOOT_ESCROW = "android.hardware.reboot_escrow"; field public static final String FEATURE_TELEPHONY_CARRIERLOCK = "android.hardware.telephony.carrierlock"; diff --git a/core/java/android/app/Notification.java b/core/java/android/app/Notification.java index f6a06f3ed5ef..b166d31ce5df 100644 --- a/core/java/android/app/Notification.java +++ b/core/java/android/app/Notification.java @@ -1198,6 +1198,14 @@ public class Notification implements Parcelable "android.pictureContentDescription"; /** + * {@link #extras} key: this is a boolean to indicate that the + * {@link BigPictureStyle#bigPicture(Bitmap) big picture} is to be shown in the collapsed state + * of a {@link BigPictureStyle} notification. This will replace a + * {@link Builder#setLargeIcon(Icon) large icon} in that state if one was provided. + */ + public static final String EXTRA_PROMOTE_PICTURE = "android.promotePicture"; + + /** * {@link #extras} key: An array of CharSequences to show in {@link InboxStyle} expanded * notifications, each of which was supplied to {@link InboxStyle#addLine(CharSequence)}. */ @@ -5149,6 +5157,7 @@ public class Notification implements Parcelable // changes are entirely visual, and should otherwise be undetectable by apps. @SuppressWarnings("AndroidFrameworkCompatChange") private void calculateLargeIconDimens(boolean largeIconShown, + @NonNull StandardTemplateParams p, @NonNull TemplateBindResult result) { final Resources resources = mContext.getResources(); final float density = resources.getDisplayMetrics().density; @@ -5159,9 +5168,9 @@ public class Notification implements Parcelable final float viewHeightDp = resources.getDimension( R.dimen.notification_right_icon_size) / density; float viewWidthDp = viewHeightDp; // icons are 1:1 by default - if (largeIconShown && ( - mContext.getApplicationInfo().targetSdkVersion >= Build.VERSION_CODES.S - || DevFlags.shouldBackportSNotifRules(mContext.getContentResolver()))) { + if (largeIconShown && (p.mPromotePicture + || mContext.getApplicationInfo().targetSdkVersion >= Build.VERSION_CODES.S + || DevFlags.shouldBackportSNotifRules(mContext.getContentResolver()))) { Drawable drawable = mN.mLargeIcon.loadDrawable(mContext); if (drawable != null) { int iconWidth = drawable.getIntrinsicWidth(); @@ -5187,7 +5196,7 @@ public class Notification implements Parcelable mN.mLargeIcon = Icon.createWithBitmap(mN.largeIcon); } boolean showLargeIcon = mN.mLargeIcon != null && !p.hideLargeIcon; - calculateLargeIconDimens(showLargeIcon, result); + calculateLargeIconDimens(showLargeIcon, p, result); if (showLargeIcon) { contentView.setViewLayoutWidth(R.id.right_icon, result.mRightIconWidthDp, TypedValue.COMPLEX_UNIT_DIP); @@ -6995,6 +7004,7 @@ public class Notification implements Parcelable private Icon mBigLargeIcon; private boolean mBigLargeIconSet = false; private CharSequence mPictureContentDescription; + private boolean mPromotePicture; public BigPictureStyle() { } @@ -7011,7 +7021,8 @@ public class Notification implements Parcelable * Overrides ContentTitle in the big form of the template. * This defaults to the value passed to setContentTitle(). */ - public BigPictureStyle setBigContentTitle(CharSequence title) { + @NonNull + public BigPictureStyle setBigContentTitle(@Nullable CharSequence title) { internalSetBigContentTitle(safeCharSequence(title)); return this; } @@ -7019,7 +7030,8 @@ public class Notification implements Parcelable /** * Set the first line of text after the detail section in the big form of the template. */ - public BigPictureStyle setSummaryText(CharSequence cs) { + @NonNull + public BigPictureStyle setSummaryText(@Nullable CharSequence cs) { internalSetSummaryText(safeCharSequence(cs)); return this; } @@ -7044,22 +7056,36 @@ public class Notification implements Parcelable /** * Provide the bitmap to be used as the payload for the BigPicture notification. */ - public BigPictureStyle bigPicture(Bitmap b) { + @NonNull + public BigPictureStyle bigPicture(@Nullable Bitmap b) { mPicture = b; return this; } /** + * When set, the {@link #bigPicture(Bitmap) big picture} of this style will be promoted and + * shown in place of the {@link Builder#setLargeIcon(Icon) large icon} in the collapsed + * state of this notification. + */ + @NonNull + public BigPictureStyle showBigPictureWhenCollapsed(boolean show) { + mPromotePicture = show; + return this; + } + + /** * Override the large icon when the big notification is shown. */ - public BigPictureStyle bigLargeIcon(Bitmap b) { + @NonNull + public BigPictureStyle bigLargeIcon(@Nullable Bitmap b) { return bigLargeIcon(b != null ? Icon.createWithBitmap(b) : null); } /** * Override the large icon when the big notification is shown. */ - public BigPictureStyle bigLargeIcon(Icon icon) { + @NonNull + public BigPictureStyle bigLargeIcon(@Nullable Icon icon) { mBigLargeIconSet = true; mBigLargeIcon = icon; return this; @@ -7112,6 +7138,66 @@ public class Notification implements Parcelable /** * @hide */ + @Override + public RemoteViews makeContentView(boolean increasedHeight) { + if (mPicture == null || !mPromotePicture) { + return super.makeContentView(increasedHeight); + } + + Icon oldLargeIcon = mBuilder.mN.mLargeIcon; + mBuilder.mN.mLargeIcon = Icon.createWithBitmap(mPicture); + // The legacy largeIcon might not allow us to clear the image, as it's taken in + // replacement if the other one is null. Because we're restoring these legacy icons + // for old listeners, this is in general non-null. + Bitmap largeIconLegacy = mBuilder.mN.largeIcon; + mBuilder.mN.largeIcon = null; + + StandardTemplateParams p = mBuilder.mParams.reset() + .viewType(StandardTemplateParams.VIEW_TYPE_NORMAL) + .fillTextsFrom(mBuilder) + .promotePicture(true); + RemoteViews contentView = getStandardView(mBuilder.getBaseLayoutResource(), + p, null /* result */); + + mBuilder.mN.mLargeIcon = oldLargeIcon; + mBuilder.mN.largeIcon = largeIconLegacy; + + return contentView; + } + + /** + * @hide + */ + @Override + public RemoteViews makeHeadsUpContentView(boolean increasedHeight) { + if (mPicture == null || !mPromotePicture) { + return super.makeHeadsUpContentView(increasedHeight); + } + + Icon oldLargeIcon = mBuilder.mN.mLargeIcon; + mBuilder.mN.mLargeIcon = Icon.createWithBitmap(mPicture); + // The legacy largeIcon might not allow us to clear the image, as it's taken in + // replacement if the other one is null. Because we're restoring these legacy icons + // for old listeners, this is in general non-null. + Bitmap largeIconLegacy = mBuilder.mN.largeIcon; + mBuilder.mN.largeIcon = null; + + StandardTemplateParams p = mBuilder.mParams.reset() + .viewType(StandardTemplateParams.VIEW_TYPE_HEADS_UP) + .fillTextsFrom(mBuilder) + .promotePicture(true); + RemoteViews contentView = getStandardView(mBuilder.getHeadsUpBaseLayoutResource(), + p, null /* result */); + + mBuilder.mN.mLargeIcon = oldLargeIcon; + mBuilder.mN.largeIcon = largeIconLegacy; + + return contentView; + } + + /** + * @hide + */ public RemoteViews makeBigContentView() { // Replace mN.mLargeIcon with mBigLargeIcon if mBigLargeIconSet // This covers the following cases: @@ -7168,6 +7254,7 @@ public class Notification implements Parcelable extras.putCharSequence(EXTRA_PICTURE_CONTENT_DESCRIPTION, mPictureContentDescription); } + extras.putBoolean(EXTRA_PROMOTE_PICTURE, mPromotePicture); extras.putParcelable(EXTRA_PICTURE, mPicture); } @@ -7188,6 +7275,7 @@ public class Notification implements Parcelable extras.getCharSequence(EXTRA_PICTURE_CONTENT_DESCRIPTION); } + mPromotePicture = extras.getBoolean(EXTRA_PROMOTE_PICTURE); mPicture = extras.getParcelable(EXTRA_PICTURE); } @@ -11306,6 +11394,7 @@ public class Notification implements Parcelable boolean mHideTitle; boolean mHideActions; boolean mHideProgress; + boolean mPromotePicture; CharSequence title; CharSequence text; CharSequence headerTextSecondary; @@ -11321,6 +11410,7 @@ public class Notification implements Parcelable mHideTitle = false; mHideActions = false; mHideProgress = false; + mPromotePicture = false; title = null; text = null; summaryText = null; @@ -11360,6 +11450,11 @@ public class Notification implements Parcelable return this; } + final StandardTemplateParams promotePicture(boolean promotePicture) { + this.mPromotePicture = promotePicture; + return this; + } + final StandardTemplateParams title(CharSequence title) { this.title = title; return this; diff --git a/core/java/android/app/admin/DevicePolicyManager.java b/core/java/android/app/admin/DevicePolicyManager.java index 54e1ac43f208..7e7a5ac75886 100644 --- a/core/java/android/app/admin/DevicePolicyManager.java +++ b/core/java/android/app/admin/DevicePolicyManager.java @@ -1686,6 +1686,20 @@ public class DevicePolicyManager { public static final int PASSWORD_COMPLEXITY_HIGH = 0x50000; /** + * A boolean extra for {@link #ACTION_SET_NEW_PARENT_PROFILE_PASSWORD} requesting that only + * device password requirement is enforced during the parent profile password enrolment flow. + * <p> Normally when enrolling password for the parent profile, both the device-wide password + * requirement (requirement set via {@link #getParentProfileInstance(ComponentName)} instance) + * and the profile password requirement are enforced, if the profile currently does not have a + * separate work challenge. By setting this to {@code true}, profile password requirement is + * explicitly disregarded. + * + * @see #isActivePasswordSufficientForDeviceRequirement() + */ + public static final String EXTRA_DEVICE_PASSWORD_REQUIREMENT_ONLY = + "android.app.extra.DEVICE_PASSWORD_REQUIREMENT_ONLY"; + + /** * @hide */ @Retention(RetentionPolicy.SOURCE) @@ -1700,8 +1714,10 @@ public class DevicePolicyManager { /** * Activity action: have the user enter a new password for the parent profile. * If the intent is launched from within a managed profile, this will trigger - * entering a new password for the parent of the profile. In all other cases - * the behaviour is identical to {@link #ACTION_SET_NEW_PASSWORD}. + * entering a new password for the parent of the profile. The caller can optionally + * set {@link #EXTRA_DEVICE_PASSWORD_REQUIREMENT_ONLY} to only enforce device-wide + * password requirement. In all other cases the behaviour is identical to + * {@link #ACTION_SET_NEW_PASSWORD}. */ @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) public static final String ACTION_SET_NEW_PARENT_PROFILE_PASSWORD @@ -3844,9 +3860,21 @@ public class DevicePolicyManager { * @hide */ public PasswordMetrics getPasswordMinimumMetrics(@UserIdInt int userHandle) { + return getPasswordMinimumMetrics(userHandle, false); + } + + /** + * Returns minimum PasswordMetrics that satisfies all admin policies. + * If requested, only consider device-wide admin policies and ignore policies set on the + * managed profile instance (as if the managed profile had separate work challenge). + * + * @hide + */ + public PasswordMetrics getPasswordMinimumMetrics(@UserIdInt int userHandle, + boolean deviceWideOnly) { if (mService != null) { try { - return mService.getPasswordMinimumMetrics(userHandle); + return mService.getPasswordMinimumMetrics(userHandle, deviceWideOnly); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } @@ -4125,6 +4153,7 @@ public class DevicePolicyManager { * @throws SecurityException if the calling application is not a profile owner of a managed * profile, or if this API is not called on the parent DevicePolicyManager instance. * @throws IllegalStateException if the user isn't unlocked + * @see #EXTRA_DEVICE_PASSWORD_REQUIREMENT_ONLY */ public boolean isActivePasswordSufficientForDeviceRequirement() { if (!mParentInstance) { @@ -4250,12 +4279,25 @@ public class DevicePolicyManager { */ @PasswordComplexity public int getAggregatedPasswordComplexityForUser(int userId) { + return getAggregatedPasswordComplexityForUser(userId, false); + } + + /** + * Returns the password complexity that applies to this user, aggregated from other users if + * necessary (for example, if the DPC has set password complexity requirements on the parent + * profile DPM instance of a managed profile user, they would apply to the primary user on the + * device). If {@code deviceWideOnly} is {@code true}, ignore policies set on the + * managed profile DPM instance (as if the managed profile had separate work challenge). + * @hide + */ + @PasswordComplexity + public int getAggregatedPasswordComplexityForUser(int userId, boolean deviceWideOnly) { if (mService == null) { return PASSWORD_COMPLEXITY_NONE; } try { - return mService.getAggregatedPasswordComplexityForUser(userId); + return mService.getAggregatedPasswordComplexityForUser(userId, deviceWideOnly); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } diff --git a/core/java/android/app/admin/IDevicePolicyManager.aidl b/core/java/android/app/admin/IDevicePolicyManager.aidl index e855a1cb71ef..a569dfaaed80 100644 --- a/core/java/android/app/admin/IDevicePolicyManager.aidl +++ b/core/java/android/app/admin/IDevicePolicyManager.aidl @@ -73,7 +73,7 @@ interface IDevicePolicyManager { void setPasswordMinimumNonLetter(in ComponentName who, int length, boolean parent); int getPasswordMinimumNonLetter(in ComponentName who, int userHandle, boolean parent); - PasswordMetrics getPasswordMinimumMetrics(int userHandle); + PasswordMetrics getPasswordMinimumMetrics(int userHandle, boolean deviceWideOnly); void setPasswordHistoryLength(in ComponentName who, int length, boolean parent); int getPasswordHistoryLength(in ComponentName who, int userHandle, boolean parent); @@ -90,7 +90,7 @@ interface IDevicePolicyManager { int getPasswordComplexity(boolean parent); void setRequiredPasswordComplexity(int passwordComplexity, boolean parent); int getRequiredPasswordComplexity(boolean parent); - int getAggregatedPasswordComplexityForUser(int userId); + int getAggregatedPasswordComplexityForUser(int userId, boolean deviceWideOnly); boolean isUsingUnifiedPassword(in ComponentName admin); int getCurrentFailedPasswordAttempts(int userHandle, boolean parent); int getProfileWithMinimumFailedPasswordsForWipe(int userHandle, boolean parent); diff --git a/core/java/android/app/role/RoleManager.java b/core/java/android/app/role/RoleManager.java index 0fcf44d2dda6..3788257bcf17 100644 --- a/core/java/android/app/role/RoleManager.java +++ b/core/java/android/app/role/RoleManager.java @@ -174,8 +174,10 @@ public final class RoleManager { @NonNull private final Object mListenersLock = new Object(); - @NonNull - private final RoleControllerManager mRoleControllerManager; + @GuardedBy("mRoleControllerManagerLock") + @Nullable + private RoleControllerManager mRoleControllerManager; + private final Object mRoleControllerManagerLock = new Object(); /** * @hide @@ -184,7 +186,6 @@ public final class RoleManager { mContext = context; mService = IRoleManager.Stub.asInterface(ServiceManager.getServiceOrThrow( Context.ROLE_SERVICE)); - mRoleControllerManager = new RoleControllerManager(context); } /** @@ -693,7 +694,7 @@ public final class RoleManager { @TestApi public void isRoleVisible(@NonNull String roleName, @NonNull @CallbackExecutor Executor executor, @NonNull Consumer<Boolean> callback) { - mRoleControllerManager.isRoleVisible(roleName, executor, callback); + getRoleControllerManager().isRoleVisible(roleName, executor, callback); } /** @@ -714,10 +715,20 @@ public final class RoleManager { @TestApi public void isApplicationVisibleForRole(@NonNull String roleName, @NonNull String packageName, @NonNull @CallbackExecutor Executor executor, @NonNull Consumer<Boolean> callback) { - mRoleControllerManager.isApplicationVisibleForRole(roleName, packageName, executor, + getRoleControllerManager().isApplicationVisibleForRole(roleName, packageName, executor, callback); } + @NonNull + private RoleControllerManager getRoleControllerManager() { + synchronized (mRoleControllerManagerLock) { + if (mRoleControllerManager == null) { + mRoleControllerManager = new RoleControllerManager(mContext); + } + return mRoleControllerManager; + } + } + private static class OnRoleHoldersChangedListenerDelegate extends IOnRoleHoldersChangedListener.Stub { diff --git a/core/java/android/content/pm/PackageManager.java b/core/java/android/content/pm/PackageManager.java index 03d4d5e10e64..747f8dc4915c 100644 --- a/core/java/android/content/pm/PackageManager.java +++ b/core/java/android/content/pm/PackageManager.java @@ -3532,6 +3532,17 @@ public abstract class PackageManager { @SdkConstant(SdkConstantType.FEATURE) public static final String FEATURE_APP_ENUMERATION = "android.software.app_enumeration"; + /** + * Feature for {@link android.view.WindowManager.LayoutParams.backgroundBlurRedius} and + * {@link android.graphics.drawable.BackgroundBlurDrawable}: the device supports cross-layer + * blurring. + * + * @hide + */ + @SystemApi + @SdkConstant(SdkConstantType.FEATURE) + public static final String FEATURE_CROSS_LAYER_BLUR = "android.software.cross_layer_blur"; + /** @hide */ public static final boolean APP_ENUMERATION_ENABLED_BY_DEFAULT = true; diff --git a/core/java/android/hardware/hdmi/HdmiControlManager.java b/core/java/android/hardware/hdmi/HdmiControlManager.java index dddf7352424b..78584990e75e 100644 --- a/core/java/android/hardware/hdmi/HdmiControlManager.java +++ b/core/java/android/hardware/hdmi/HdmiControlManager.java @@ -1110,7 +1110,8 @@ public final class HdmiControlManager { * * Note: Value of isCecAvailable is only valid when isCecEnabled is true. **/ - void onStatusChange(boolean isCecEnabled, boolean isCecAvailable); + void onStatusChange(@HdmiControlManager.HdmiCecControl int isCecEnabled, + boolean isCecAvailable); } private final ArrayMap<HdmiControlStatusChangeListener, IHdmiControlStatusChangeListener> @@ -1351,7 +1352,7 @@ public final class HdmiControlManager { Executor executor, final HdmiControlStatusChangeListener listener) { return new IHdmiControlStatusChangeListener.Stub() { @Override - public void onStatusChange(boolean isCecEnabled, boolean isCecAvailable) { + public void onStatusChange(@HdmiCecControl int isCecEnabled, boolean isCecAvailable) { final long token = Binder.clearCallingIdentity(); try { executor.execute(() -> listener.onStatusChange(isCecEnabled, isCecAvailable)); diff --git a/core/java/android/hardware/hdmi/IHdmiControlStatusChangeListener.aidl b/core/java/android/hardware/hdmi/IHdmiControlStatusChangeListener.aidl index 889d3fe1fae1..d61ab6ac2da7 100644 --- a/core/java/android/hardware/hdmi/IHdmiControlStatusChangeListener.aidl +++ b/core/java/android/hardware/hdmi/IHdmiControlStatusChangeListener.aidl @@ -28,11 +28,11 @@ oneway interface IHdmiControlStatusChangeListener { * Called when HDMI Control (CEC) is enabled/disabled. * * @param isCecEnabled status of HDMI Control - * {@link android.provider.Settings.Global#HDMI_CONTROL_ENABLED}: {@code true} if enabled. + * {@link android.hardware.hdmi.HdmiControlManager#CEC_SETTING_NAME_HDMI_CEC_ENABLED}: {@link android.hardware.hdmi.HdmiControlManager#HDMI_CEC_CONTROL_ENABLED} if enabled. * @param isCecAvailable status of CEC support of the connected display (the TV). * {@code true} if supported. * - * Note: Value of isCecAvailable is only valid when isCecEnabled is true. + * Note: Value of isCecAvailable is only valid when isCecEnabled is {@link android.hardware.hdmi.HdmiControlManager#HDMI_CEC_CONTROL_ENABLED}. **/ - void onStatusChange(boolean isCecEnabled, boolean isCecAvailable); + void onStatusChange(int isCecEnabled, boolean isCecAvailable); } diff --git a/core/java/android/inputmethodservice/InputMethodService.java b/core/java/android/inputmethodservice/InputMethodService.java index df9a7c2cb586..44a2e97e6f04 100644 --- a/core/java/android/inputmethodservice/InputMethodService.java +++ b/core/java/android/inputmethodservice/InputMethodService.java @@ -410,6 +410,11 @@ public class InputMethodService extends AbstractInputMethodService { private static final int BACK_DISPOSITION_MIN = BACK_DISPOSITION_DEFAULT; private static final int BACK_DISPOSITION_MAX = BACK_DISPOSITION_ADJUST_NOTHING; + /** + * Timeout after which hidden IME surface will be removed from memory + */ + private static final long TIMEOUT_SURFACE_REMOVAL_MILLIS = 5000; + InputMethodManager mImm; private InputMethodPrivilegedOperations mPrivOps = new InputMethodPrivilegedOperations(); @@ -506,6 +511,8 @@ public class InputMethodService extends AbstractInputMethodService { private boolean mAutomotiveHideNavBarForKeyboard; private boolean mIsAutomotive; + private Handler mHandler; + private boolean mImeSurfaceScheduledForRemoval; /** * An opaque {@link Binder} token of window requesting {@link InputMethodImpl#showSoftInput} @@ -903,11 +910,31 @@ public class InputMethodService extends AbstractInputMethodService { requestHideSelf(0); } + private void scheduleImeSurfaceRemoval() { + if (mShowInputRequested || mWindowVisible || mWindow == null + || mImeSurfaceScheduledForRemoval) { + return; + } + if (mHandler == null) { + mHandler = new Handler(getMainLooper()); + } + mImeSurfaceScheduledForRemoval = true; + mHandler.postDelayed(() -> removeImeSurface(), TIMEOUT_SURFACE_REMOVAL_MILLIS); + } + private void removeImeSurface() { - if (!mShowInputRequested && !mWindowVisible) { - // hiding a window removes its surface. + // hiding a window removes its surface. + if (mWindow != null) { mWindow.hide(); } + mImeSurfaceScheduledForRemoval = false; + } + + private void cancelImeSurfaceRemoval() { + if (mHandler != null && mImeSurfaceScheduledForRemoval) { + mHandler.removeCallbacksAndMessages(null /* token */); + mImeSurfaceScheduledForRemoval = false; + } } private void setImeWindowStatus(int visibilityFlags, int backDisposition) { @@ -1043,7 +1070,7 @@ public class InputMethodService extends AbstractInputMethodService { * @hide */ public final void removeImeSurface() { - InputMethodService.this.removeImeSurface(); + InputMethodService.this.scheduleImeSurfaceRemoval(); } } @@ -2271,6 +2298,9 @@ public class InputMethodService extends AbstractInputMethodService { ImeTracing.getInstance().triggerServiceDump( "InputMethodService#applyVisibilityInInsetsConsumerIfNecessary", this, null /* icProto */); + if (setVisible) { + cancelImeSurfaceRemoval(); + } mPrivOps.applyImeVisibility(setVisible ? mCurShowInputToken : mCurHideInputToken, setVisible); } diff --git a/core/java/android/os/SystemVibrator.java b/core/java/android/os/SystemVibrator.java index 0330500f0997..30afe38be397 100644 --- a/core/java/android/os/SystemVibrator.java +++ b/core/java/android/os/SystemVibrator.java @@ -17,6 +17,7 @@ package android.os; import android.annotation.CallbackExecutor; +import android.annotation.IntDef; import android.annotation.NonNull; import android.annotation.Nullable; import android.compat.annotation.UnsupportedAppUsage; @@ -27,6 +28,8 @@ import android.util.Log; import com.android.internal.annotations.GuardedBy; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; import java.util.Objects; import java.util.concurrent.Executor; @@ -38,6 +41,14 @@ import java.util.concurrent.Executor; public class SystemVibrator extends Vibrator { private static final String TAG = "Vibrator"; + private static final int VIBRATOR_PRESENT_UNKNOWN = 0; + private static final int VIBRATOR_PRESENT_YES = 1; + private static final int VIBRATOR_PRESENT_NO = 2; + + @Retention(RetentionPolicy.SOURCE) + @IntDef({VIBRATOR_PRESENT_UNKNOWN, VIBRATOR_PRESENT_YES, VIBRATOR_PRESENT_NO}) + private @interface VibratorPresent {} + private final IVibratorService mService; private final IVibratorManagerService mManagerService; private final Object mLock = new Object(); @@ -45,6 +56,9 @@ public class SystemVibrator extends Vibrator { private final Context mContext; @GuardedBy("mLock") private VibratorInfo mVibratorInfo; + @GuardedBy("mLock") + @VibratorPresent + private int mVibratorPresent; @GuardedBy("mDelegates") private final ArrayMap<OnVibratorStateChangedListener, @@ -69,15 +83,18 @@ public class SystemVibrator extends Vibrator { @Override public boolean hasVibrator() { - if (mService == null) { - Log.w(TAG, "Failed to vibrate; no vibrator service."); - return false; - } try { - return mService.hasVibrator(); + synchronized (mLock) { + if (mVibratorPresent == VIBRATOR_PRESENT_UNKNOWN && mService != null) { + mVibratorPresent = + mService.hasVibrator() ? VIBRATOR_PRESENT_YES : VIBRATOR_PRESENT_NO; + } + return mVibratorPresent == VIBRATOR_PRESENT_YES; + } } catch (RemoteException e) { + Log.w(TAG, "Failed to query vibrator presence", e); + return false; } - return false; } /** diff --git a/core/java/com/android/internal/widget/LockPatternUtils.java b/core/java/com/android/internal/widget/LockPatternUtils.java index 9712b4e794c5..a161f18b2aab 100644 --- a/core/java/com/android/internal/widget/LockPatternUtils.java +++ b/core/java/com/android/internal/widget/LockPatternUtils.java @@ -307,49 +307,47 @@ public class LockPatternUtils { return getDevicePolicyManager().getPasswordMaximumLength(quality); } + /** + * Returns aggregated (legacy) password quality requirement on the target user from all admins. + */ public PasswordMetrics getRequestedPasswordMetrics(int userId) { - return getDevicePolicyManager().getPasswordMinimumMetrics(userId); + return getRequestedPasswordMetrics(userId, false); } /** - * Returns the effective complexity for the user. - * @param userId The user to return the complexity for. - * @return complexity level for the user. + * Returns aggregated (legacy) password quality requirement on the target user from all admins, + * optioanlly disregarding policies set on the managed profile as if the profile had separate + * work challenge. */ - public @DevicePolicyManager.PasswordComplexity int getRequestedPasswordComplexity(int userId) { - return getDevicePolicyManager().getAggregatedPasswordComplexityForUser(userId); - } - - public int getRequestedPasswordQuality(int userId) { - return getDevicePolicyManager().getPasswordQuality(null, userId); + public PasswordMetrics getRequestedPasswordMetrics(int userId, boolean deviceWideOnly) { + return getDevicePolicyManager().getPasswordMinimumMetrics(userId, deviceWideOnly); } private int getRequestedPasswordHistoryLength(int userId) { return getDevicePolicyManager().getPasswordHistoryLength(null, userId); } - public int getRequestedPasswordMinimumLetters(int userId) { - return getDevicePolicyManager().getPasswordMinimumLetters(null, userId); - } - - public int getRequestedPasswordMinimumUpperCase(int userId) { - return getDevicePolicyManager().getPasswordMinimumUpperCase(null, userId); - } - - public int getRequestedPasswordMinimumLowerCase(int userId) { - return getDevicePolicyManager().getPasswordMinimumLowerCase(null, userId); - } - - public int getRequestedPasswordMinimumNumeric(int userId) { - return getDevicePolicyManager().getPasswordMinimumNumeric(null, userId); + /** + * Returns the effective complexity for the user. + * @param userId The user to return the complexity for. + * @return complexity level for the user. + */ + public @DevicePolicyManager.PasswordComplexity int getRequestedPasswordComplexity(int userId) { + return getRequestedPasswordComplexity(userId, false); } - public int getRequestedPasswordMinimumSymbols(int userId) { - return getDevicePolicyManager().getPasswordMinimumSymbols(null, userId); - } + /** + * Returns the effective complexity for the user, optioanlly disregarding complexity set on the + * managed profile as if the profile had separate work challenge. - public int getRequestedPasswordMinimumNonLetter(int userId) { - return getDevicePolicyManager().getPasswordMinimumNonLetter(null, userId); + * @param userId The user to return the complexity for. + * @param deviceWideOnly whether to ignore complexity set on the managed profile. + * @return complexity level for the user. + */ + public @DevicePolicyManager.PasswordComplexity int getRequestedPasswordComplexity(int userId, + boolean deviceWideOnly) { + return getDevicePolicyManager().getAggregatedPasswordComplexityForUser(userId, + deviceWideOnly); } @UnsupportedAppUsage diff --git a/core/java/com/android/server/SystemConfig.java b/core/java/com/android/server/SystemConfig.java index a761b4c6af91..e5bc47097751 100644 --- a/core/java/com/android/server/SystemConfig.java +++ b/core/java/com/android/server/SystemConfig.java @@ -94,6 +94,9 @@ public class SystemConfig { // property for runtime configuration differentiation in vendor private static final String VENDOR_SKU_PROPERTY = "ro.boot.product.vendor.sku"; + // property for background blur support in surface flinger + private static final String BLUR_PROPERTY = "ro.surface_flinger.supports_background_blur"; + // Group-ids that are given to all packages as read from etc/permissions/*.xml. int[] mGlobalGids = EmptyArray.INT; @@ -1242,6 +1245,10 @@ public class SystemConfig { addFeature(PackageManager.FEATURE_IPSEC_TUNNELS, 0); } + if (SystemProperties.get(BLUR_PROPERTY, "default").equals("1")) { + addFeature(PackageManager.FEATURE_CROSS_LAYER_BLUR, 0); + } + for (String featureName : mUnavailableFeatures) { removeFeature(featureName); } diff --git a/packages/SettingsLib/res/values-ja/strings.xml b/packages/SettingsLib/res/values-ja/strings.xml index 3105e98c3f90..711a22f8a41e 100644 --- a/packages/SettingsLib/res/values-ja/strings.xml +++ b/packages/SettingsLib/res/values-ja/strings.xml @@ -576,8 +576,7 @@ <string name="data_connection_4g_plus" msgid="5194902328408751020">"4G+"</string> <string name="data_connection_lte" msgid="7675461204366364124">"LTE"</string> <string name="data_connection_lte_plus" msgid="6643158654804916653">"LTE+"</string> - <!-- no translation found for data_connection_carrier_wifi (2250268321065848954) --> - <skip /> + <string name="data_connection_carrier_wifi" msgid="2250268321065848954">"CWF"</string> <string name="cell_data_off_content_description" msgid="2280700839891636498">"モバイルデータ OFF"</string> <string name="not_default_data_content_description" msgid="6517068332106592887">"データを使用するように設定されていません"</string> <string name="accessibility_no_phone" msgid="2687419663127582503">"電波状態:なし"</string> diff --git a/packages/SettingsLib/res/values-mr/strings.xml b/packages/SettingsLib/res/values-mr/strings.xml index f5be76ebd228..72ddc8f9b024 100644 --- a/packages/SettingsLib/res/values-mr/strings.xml +++ b/packages/SettingsLib/res/values-mr/strings.xml @@ -576,8 +576,7 @@ <string name="data_connection_4g_plus" msgid="5194902328408751020">"४G+"</string> <string name="data_connection_lte" msgid="7675461204366364124">"LTE"</string> <string name="data_connection_lte_plus" msgid="6643158654804916653">"LTE+"</string> - <!-- no translation found for data_connection_carrier_wifi (2250268321065848954) --> - <skip /> + <string name="data_connection_carrier_wifi" msgid="2250268321065848954">"CWF"</string> <string name="cell_data_off_content_description" msgid="2280700839891636498">"मोबाइल डेटा बंद आहे"</string> <string name="not_default_data_content_description" msgid="6517068332106592887">"डेटा वापरण्यासाठी सेट केलेले नाही"</string> <string name="accessibility_no_phone" msgid="2687419663127582503">"कोणताही फोन नाही."</string> diff --git a/packages/SettingsLib/res/values-pa/strings.xml b/packages/SettingsLib/res/values-pa/strings.xml index 2ae7d7130e8a..e04e2017265f 100644 --- a/packages/SettingsLib/res/values-pa/strings.xml +++ b/packages/SettingsLib/res/values-pa/strings.xml @@ -576,8 +576,7 @@ <string name="data_connection_4g_plus" msgid="5194902328408751020">"4G+"</string> <string name="data_connection_lte" msgid="7675461204366364124">"LTE"</string> <string name="data_connection_lte_plus" msgid="6643158654804916653">"LTE+"</string> - <!-- no translation found for data_connection_carrier_wifi (2250268321065848954) --> - <skip /> + <string name="data_connection_carrier_wifi" msgid="2250268321065848954">"CWF"</string> <string name="cell_data_off_content_description" msgid="2280700839891636498">"ਮੋਬਾਈਲ ਡਾਟਾ ਬੰਦ"</string> <string name="not_default_data_content_description" msgid="6517068332106592887">"ਡਾਟਾ ਵਰਤਣ ਲਈ ਸੈੱਟ ਨਹੀਂ"</string> <string name="accessibility_no_phone" msgid="2687419663127582503">"ਕੋਈ ਫ਼ੋਨ ਨਹੀਂ।"</string> diff --git a/packages/SettingsLib/res/values-te/strings.xml b/packages/SettingsLib/res/values-te/strings.xml index 897abea211b9..5e880a95c2de 100644 --- a/packages/SettingsLib/res/values-te/strings.xml +++ b/packages/SettingsLib/res/values-te/strings.xml @@ -140,15 +140,15 @@ <string name="accessibility_wifi_security_type_none" msgid="162352241518066966">"ఓపెన్ నెట్వర్క్"</string> <string name="accessibility_wifi_security_type_secured" msgid="2399774097343238942">"సురక్షిత నెట్వర్క్"</string> <string name="process_kernel_label" msgid="950292573930336765">"Android OS"</string> - <string name="data_usage_uninstalled_apps" msgid="1933665711856171491">"తీసివేయబడిన అనువర్తనాలు"</string> - <string name="data_usage_uninstalled_apps_users" msgid="5533981546921913295">"తీసివేయబడిన అనువర్తనాలు మరియు వినియోగదారులు"</string> + <string name="data_usage_uninstalled_apps" msgid="1933665711856171491">"తీసివేయబడిన యాప్లు"</string> + <string name="data_usage_uninstalled_apps_users" msgid="5533981546921913295">"తీసివేయబడిన యాప్లు మరియు వినియోగదారులు"</string> <string name="data_usage_ota" msgid="7984667793701597001">"సిస్టమ్ అప్డేట్లు"</string> <string name="tether_settings_title_usb" msgid="3728686573430917722">"USB టీథరింగ్"</string> <string name="tether_settings_title_wifi" msgid="4803402057533895526">"పోర్టబుల్ హాట్స్పాట్"</string> <string name="tether_settings_title_bluetooth" msgid="916519902721399656">"బ్లూటూత్ టెథెరింగ్"</string> <string name="tether_settings_title_usb_bluetooth" msgid="1727111807207577322">"టీథరింగ్"</string> <string name="tether_settings_title_all" msgid="8910259483383010470">"టీథరింగ్ & పోర్టబుల్ హాట్స్పాట్"</string> - <string name="managed_user_title" msgid="449081789742645723">"అన్ని కార్యాలయ అనువర్తనాలు"</string> + <string name="managed_user_title" msgid="449081789742645723">"అన్ని కార్యాలయ యాప్లు"</string> <string name="user_guest" msgid="6939192779649870792">"అతిథి"</string> <string name="unknown" msgid="3544487229740637809">"తెలియదు"</string> <string name="running_process_item_user_label" msgid="3988506293099805796">"వినియోగదారు: <xliff:g id="USER_NAME">%1$s</xliff:g>"</string> @@ -313,14 +313,14 @@ <string name="bluetooth_enable_gabeldorsche_summary" msgid="2054730331770712629">"బ్లూటూత్ Gabeldorsche ఫీచర్ స్ట్యాక్ను ఎనేబుల్ చేస్తుంది."</string> <string name="enhanced_connectivity_summary" msgid="1576414159820676330">"మెరుగైన కనెక్టివిటీ ఫీచర్ను ఎనేబుల్ చేస్తుంది."</string> <string name="enable_terminal_title" msgid="3834790541986303654">"స్థానిక టెర్మినల్"</string> - <string name="enable_terminal_summary" msgid="2481074834856064500">"స్థానిక షెల్ ప్రాప్యతను అందించే టెర్మినల్ అనువర్తనాన్ని ప్రారంభించు"</string> + <string name="enable_terminal_summary" msgid="2481074834856064500">"స్థానిక షెల్ ప్రాప్యతను అందించే టెర్మినల్ యాప్ను ప్రారంభించు"</string> <string name="hdcp_checking_title" msgid="3155692785074095986">"HDCP తనిఖీ"</string> <string name="hdcp_checking_dialog_title" msgid="7691060297616217781">"HDCP తనిఖీ ప్రవర్తనను సెట్ చేయండి"</string> <string name="debug_debugging_category" msgid="535341063709248842">"డీబగ్గింగ్"</string> <string name="debug_app" msgid="8903350241392391766">"డీబగ్ యాప్ను ఎంచుకోండి"</string> <string name="debug_app_not_set" msgid="1934083001283807188">"డీబగ్ యాప్ సెట్ చేయబడలేదు"</string> <string name="debug_app_set" msgid="6599535090477753651">"డీబగ్గింగ్ యాప్: <xliff:g id="APP_NAME">%1$s</xliff:g>"</string> - <string name="select_application" msgid="2543228890535466325">"అనువర్తనాన్ని ఎంచుకోండి"</string> + <string name="select_application" msgid="2543228890535466325">"యాప్ను ఎంచుకోండి"</string> <string name="no_application" msgid="9038334538870247690">"ఏదీ వద్దు"</string> <string name="wait_for_debugger" msgid="7461199843335409809">"డీబగ్గర్ కోసం వేచి ఉండండి"</string> <string name="wait_for_debugger_summary" msgid="6846330006113363286">"డీబగ్ చేయబడిన యాప్ అమలు కావడానికి ముందు జోడించాల్సిన డీబగ్గర్ కోసం వేచి ఉంటుంది"</string> @@ -547,7 +547,7 @@ <string name="user_new_profile_name" msgid="2405500423304678841">"కొత్త ప్రొఫైల్"</string> <string name="user_info_settings_title" msgid="6351390762733279907">"వినియోగదారు సమాచారం"</string> <string name="profile_info_settings_title" msgid="105699672534365099">"ప్రొఫైల్ సమాచారం"</string> - <string name="user_need_lock_message" msgid="4311424336209509301">"మీరు పరిమితం చేయబడిన ప్రొఫైల్ను సృష్టించడానికి ముందు, మీ అనువర్తనాలు మరియు వ్యక్తిగత డేటాను రక్షించడానికి స్క్రీన్ లాక్ను సెటప్ చేయాల్సి ఉంటుంది."</string> + <string name="user_need_lock_message" msgid="4311424336209509301">"మీరు పరిమితం చేయబడిన ప్రొఫైల్ను సృష్టించడానికి ముందు, మీ యాప్లు మరియు వ్యక్తిగత డేటాను రక్షించడానికి స్క్రీన్ లాక్ను సెటప్ చేయాల్సి ఉంటుంది."</string> <string name="user_set_lock_button" msgid="1427128184982594856">"లాక్ను సెట్ చేయి"</string> <string name="user_switch_to_user" msgid="6975428297154968543">"<xliff:g id="USER_NAME">%s</xliff:g>కు మార్చు"</string> <string name="creating_new_user_dialog_message" msgid="7232880257538970375">"కొత్త యూజర్ను క్రియేట్ చేస్తోంది…"</string> diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardDisplayManager.java b/packages/SystemUI/src/com/android/keyguard/KeyguardDisplayManager.java index 77e568c66a9d..a40dc7abf063 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardDisplayManager.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardDisplayManager.java @@ -255,6 +255,7 @@ public class KeyguardDisplayManager { private static final int VIDEO_SAFE_REGION = 80; // Percentage of display width & height private static final int MOVE_CLOCK_TIMEOUT = 10000; // 10s private final KeyguardStatusViewComponent.Factory mKeyguardStatusViewComponentFactory; + private final Context mContext; private KeyguardClockSwitchController mKeyguardClockSwitchController; private View mClock; private int mUsableWidth; @@ -278,6 +279,7 @@ public class KeyguardDisplayManager { WindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG); mKeyguardStatusViewComponentFactory = keyguardStatusViewComponentFactory; setCancelable(false); + mContext = context; } @Override @@ -301,7 +303,7 @@ public class KeyguardDisplayManager { mMarginLeft = (100 - VIDEO_SAFE_REGION) * bounds.width() / 200; mMarginTop = (100 - VIDEO_SAFE_REGION) * bounds.height() / 200; - setContentView(LayoutInflater.from(getContext()) + setContentView(LayoutInflater.from(mContext) .inflate(R.layout.keyguard_presentation, null)); // Logic to make the lock screen fullscreen diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardClockPositionAlgorithm.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardClockPositionAlgorithm.java index 6cd7a74cdf02..1dfd1f3ef69c 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardClockPositionAlgorithm.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardClockPositionAlgorithm.java @@ -32,7 +32,6 @@ import com.android.systemui.R; * Utility class to calculate the clock position and top padding of notifications on Keyguard. */ public class KeyguardClockPositionAlgorithm { - /** * How much the clock height influences the shade position. * 0 means nothing, 1 means move the shade up by the height of the clock @@ -81,6 +80,11 @@ public class KeyguardClockPositionAlgorithm { private int mMinTopMargin; /** + * Minimum top inset (in pixels) to avoid overlap with any display cutouts. + */ + private int mCutoutTopInset = 0; + + /** * Maximum bottom padding to avoid overlap with {@link KeyguardBottomAreaView} or * the ambient indication. */ @@ -172,7 +176,7 @@ public class KeyguardClockPositionAlgorithm { float panelExpansion, int parentHeight, int keyguardStatusHeight, int clockPreferredY, boolean hasCustomClock, boolean hasVisibleNotifs, float dark, float emptyDragAmount, boolean bypassEnabled, int unlockedStackScrollerPadding, boolean showLockIcon, - float qsExpansion) { + float qsExpansion, int cutoutTopInset) { mMinTopMargin = statusBarMinHeight + (showLockIcon ? mContainerTopPaddingWithLockIcon : mContainerTopPaddingWithoutLockIcon); mMaxShadeBottom = maxShadeBottom; @@ -188,6 +192,7 @@ public class KeyguardClockPositionAlgorithm { mBypassEnabled = bypassEnabled; mUnlockedStackScrollerPadding = unlockedStackScrollerPadding; mQsExpansion = qsExpansion; + mCutoutTopInset = cutoutTopInset; } public void run(Result result) { @@ -270,10 +275,13 @@ public class KeyguardClockPositionAlgorithm { float darkAmount = mBypassEnabled && !mHasCustomClock ? 1.0f : mDarkAmount; - // TODO(b/12836565) - prototyping only adjustment if (mLockScreenMode != KeyguardUpdateMonitor.LOCK_SCREEN_MODE_NORMAL) { - // This will keep the clock at the top - clockYDark = (int) (clockY + burnInPreventionOffsetY()); + // This will keep the clock at the top but out of the cutout area + float shift = 0; + if (clockY - mBurnInPreventionOffsetYLargeClock < mCutoutTopInset) { + shift = mCutoutTopInset - (clockY - mBurnInPreventionOffsetYLargeClock); + } + clockYDark = clockY + burnInPreventionOffsetY() + shift; } return (int) (MathUtils.lerp(clockY, clockYDark, darkAmount) + mEmptyDragAmount); } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java index d132abe5860f..3db6c80cf4ff 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java @@ -50,6 +50,7 @@ import android.os.PowerManager; import android.os.SystemClock; import android.util.Log; import android.util.MathUtils; +import android.view.DisplayCutout; import android.view.LayoutInflater; import android.view.MotionEvent; import android.view.VelocityTracker; @@ -344,6 +345,7 @@ public class NotificationPanelViewController extends PanelViewController { private float mEmptyDragAmount; private float mDownX; private float mDownY; + private int mDisplayCutoutTopInset = 0; // in pixels private final KeyguardClockPositionAlgorithm mClockPositionAlgorithm = @@ -909,7 +911,8 @@ public class NotificationPanelViewController extends PanelViewController { hasVisibleNotifications, mInterpolatedDarkAmount, mEmptyDragAmount, bypassEnabled, getUnlockedStackScrollerPadding(), mUpdateMonitor.shouldShowLockIcon(), - getQsExpansionFraction()); + getQsExpansionFraction(), + mDisplayCutoutTopInset); mClockPositionAlgorithm.run(mClockPositionResult); mKeyguardStatusViewController.updatePosition( mClockPositionResult.clockX, mClockPositionResult.clockY, @@ -3835,6 +3838,9 @@ public class NotificationPanelViewController extends PanelViewController { private class OnApplyWindowInsetsListener implements View.OnApplyWindowInsetsListener { public WindowInsets onApplyWindowInsets(View v, WindowInsets insets) { + final DisplayCutout displayCutout = v.getRootWindowInsets().getDisplayCutout(); + mDisplayCutoutTopInset = displayCutout != null ? displayCutout.getSafeInsetTop() : 0; + mNavigationBarBottomHeight = insets.getStableInsetBottom(); updateMaxHeadsUpTranslation(); return insets; diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java index 92d013eeda8e..f1ccde771c54 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java @@ -294,7 +294,9 @@ public class NetworkControllerImpl extends BroadcastReceiver } }; - mWifiManager.registerScanResultsCallback(mReceiverHandler::post, scanResultsCallback); + if (mWifiManager != null) { + mWifiManager.registerScanResultsCallback(mReceiverHandler::post, scanResultsCallback); + } ConnectivityManager.NetworkCallback callback = new ConnectivityManager.NetworkCallback(){ private Network mLastNetwork; diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardClockPositionAlgorithmTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardClockPositionAlgorithmTest.java index c7c1823f6a29..ee1d758e7ae2 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardClockPositionAlgorithmTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardClockPositionAlgorithmTest.java @@ -52,6 +52,7 @@ public class KeyguardClockPositionAlgorithmTest extends SysuiTestCase { private boolean mHasCustomClock; private boolean mHasVisibleNotifs; private float mQsExpansion; + private int mCutoutTopInset = 0; // in pixels @Before public void setUp() { @@ -394,7 +395,8 @@ public class KeyguardClockPositionAlgorithmTest extends SysuiTestCase { mClockPositionAlgorithm.setup(EMPTY_MARGIN, SCREEN_HEIGHT, mNotificationStackHeight, mPanelExpansion, SCREEN_HEIGHT, mKeyguardStatusHeight, mPreferredClockY, mHasCustomClock, mHasVisibleNotifs, mDark, ZERO_DRAG, false /* bypassEnabled */, - 0 /* unlockedStackScrollerPadding */, false /* udfpsEnrolled */, mQsExpansion); + 0 /* unlockedStackScrollerPadding */, false /* udfpsEnrolled */, + mQsExpansion, mCutoutTopInset); mClockPositionAlgorithm.run(mClockPosition); } } diff --git a/services/core/java/com/android/server/audio/AudioService.java b/services/core/java/com/android/server/audio/AudioService.java index e13d6af99231..7115c9ad5a05 100644 --- a/services/core/java/com/android/server/audio/AudioService.java +++ b/services/core/java/com/android/server/audio/AudioService.java @@ -7724,10 +7724,12 @@ public class AudioService extends IAudioService.Stub private class MyHdmiControlStatusChangeListenerCallback implements HdmiControlManager.HdmiControlStatusChangeListener { - public void onStatusChange(boolean isCecEnabled, boolean isCecAvailable) { + public void onStatusChange(@HdmiControlManager.HdmiCecControl int isCecEnabled, + boolean isCecAvailable) { synchronized (mHdmiClientLock) { if (mHdmiManager == null) return; - updateHdmiCecSinkLocked(isCecEnabled ? isCecAvailable : false); + boolean cecEnabled = isCecEnabled == HdmiControlManager.HDMI_CEC_CONTROL_ENABLED; + updateHdmiCecSinkLocked(cecEnabled ? isCecAvailable : false); } } }; diff --git a/services/core/java/com/android/server/hdmi/HdmiControlService.java b/services/core/java/com/android/server/hdmi/HdmiControlService.java index beaf6d53370d..9b194ae84a37 100644 --- a/services/core/java/com/android/server/hdmi/HdmiControlService.java +++ b/services/core/java/com/android/server/hdmi/HdmiControlService.java @@ -18,6 +18,7 @@ package com.android.server.hdmi; import static android.hardware.hdmi.HdmiControlManager.DEVICE_EVENT_ADD_DEVICE; import static android.hardware.hdmi.HdmiControlManager.DEVICE_EVENT_REMOVE_DEVICE; +import static android.hardware.hdmi.HdmiControlManager.HDMI_CEC_CONTROL_ENABLED; import static com.android.server.hdmi.Constants.ADDR_UNREGISTERED; import static com.android.server.hdmi.Constants.DISABLED; @@ -325,7 +326,8 @@ public class HdmiControlService extends SystemService { // Set to true while HDMI control is enabled. If set to false, HDMI-CEC/MHL protocol // handling will be disabled and no request will be handled. @GuardedBy("mLock") - private boolean mHdmiControlEnabled; + @HdmiControlManager.HdmiCecControl + private int mHdmiControlEnabled; // Set to true while the service is in normal mode. While set to false, no input change is // allowed. Used for situations where input change can confuse users such as channel auto-scan, @@ -477,8 +479,7 @@ public class HdmiControlService extends SystemService { mPowerStatusController.setPowerStatus(getInitialPowerStatus()); mProhibitMode = false; mHdmiControlEnabled = mHdmiCecConfig.getIntValue( - HdmiControlManager.CEC_SETTING_NAME_HDMI_CEC_ENABLED) - == HdmiControlManager.HDMI_CEC_CONTROL_ENABLED; + HdmiControlManager.CEC_SETTING_NAME_HDMI_CEC_ENABLED); setHdmiCecVolumeControlEnabledInternal(getHdmiCecConfig().getIntValue( HdmiControlManager.CEC_SETTING_NAME_VOLUME_CONTROL_MODE)); mMhlInputChangeEnabled = readBooleanSetting(Global.MHL_INPUT_SWITCHING_ENABLED, true); @@ -497,7 +498,7 @@ public class HdmiControlService extends SystemService { Slog.i(TAG, "Device does not support MHL-control."); } mHdmiCecNetwork = new HdmiCecNetwork(this, mCecController, mMhlController); - if (mHdmiControlEnabled) { + if (mHdmiControlEnabled == HdmiControlManager.HDMI_CEC_CONTROL_ENABLED) { initializeCec(INITIATED_BY_BOOT_UP); } else { mCecController.setOption(OptionKey.ENABLE_CEC, false); @@ -513,9 +514,8 @@ public class HdmiControlService extends SystemService { new HdmiCecConfig.SettingChangeListener() { @Override public void onChange(String setting) { - boolean enabled = mHdmiCecConfig.getIntValue( - HdmiControlManager.CEC_SETTING_NAME_HDMI_CEC_ENABLED) - == HdmiControlManager.HDMI_CEC_CONTROL_ENABLED; + @HdmiControlManager.HdmiCecControl int enabled = mHdmiCecConfig.getIntValue( + HdmiControlManager.CEC_SETTING_NAME_HDMI_CEC_ENABLED); setControlEnabled(enabled); } }); @@ -630,7 +630,7 @@ public class HdmiControlService extends SystemService { } if (reason != -1) { invokeVendorCommandListenersOnControlStateChanged(true, reason); - announceHdmiControlStatusChange(true); + announceHdmiControlStatusChange(HDMI_CEC_CONTROL_ENABLED); } } @@ -2193,7 +2193,6 @@ public class HdmiControlService extends SystemService { // System settings pw.println("System_settings:"); pw.increaseIndent(); - pw.println("mHdmiControlEnabled: " + mHdmiControlEnabled); pw.println("mMhlInputChangeEnabled: " + mMhlInputChangeEnabled); pw.println("mSystemAudioActivated: " + isSystemAudioActivated()); pw.println("mHdmiCecVolumeControlEnabled: " + mHdmiCecVolumeControl); @@ -2773,7 +2772,7 @@ public class HdmiControlService extends SystemService { } } - private void announceHdmiControlStatusChange(boolean isEnabled) { + private void announceHdmiControlStatusChange(@HdmiControlManager.HdmiCecControl int isEnabled) { assertRunOnServiceThread(); synchronized (mLock) { List<IHdmiControlStatusChangeListener> listeners = new ArrayList<>( @@ -2787,16 +2786,18 @@ public class HdmiControlService extends SystemService { } private void invokeHdmiControlStatusChangeListenerLocked( - IHdmiControlStatusChangeListener listener, boolean isEnabled) { + IHdmiControlStatusChangeListener listener, + @HdmiControlManager.HdmiCecControl int isEnabled) { invokeHdmiControlStatusChangeListenerLocked(Collections.singletonList(listener), isEnabled); } private void invokeHdmiControlStatusChangeListenerLocked( - Collection<IHdmiControlStatusChangeListener> listeners, boolean isEnabled) { + Collection<IHdmiControlStatusChangeListener> listeners, + @HdmiControlManager.HdmiCecControl int isEnabled) { if (listeners.isEmpty()) { return; } - if (isEnabled) { + if (isEnabled == HdmiControlManager.HDMI_CEC_CONTROL_ENABLED) { queryDisplayStatus(new IHdmiControlCallback.Stub() { public void onComplete(int status) { boolean isAvailable = true; @@ -2814,7 +2815,8 @@ public class HdmiControlService extends SystemService { } private void invokeHdmiControlStatusChangeListenerLocked( - Collection<IHdmiControlStatusChangeListener> listeners, boolean isEnabled, + Collection<IHdmiControlStatusChangeListener> listeners, + @HdmiControlManager.HdmiCecControl int isEnabled, boolean isCecAvailable) { for (IHdmiControlStatusChangeListener listener : listeners) { try { @@ -2881,7 +2883,7 @@ public class HdmiControlService extends SystemService { boolean isControlEnabled() { synchronized (mLock) { - return mHdmiControlEnabled; + return mHdmiControlEnabled == HdmiControlManager.HDMI_CEC_CONTROL_ENABLED; } } @@ -2955,7 +2957,7 @@ public class HdmiControlService extends SystemService { mPowerStatusController.setPowerStatus(HdmiControlManager.POWER_STATUS_TRANSIENT_TO_ON, false); if (mCecController != null) { - if (mHdmiControlEnabled) { + if (mHdmiControlEnabled == HDMI_CEC_CONTROL_ENABLED) { int startReason = -1; switch (wakeUpAction) { case WAKE_UP_SCREEN_ON: @@ -3224,14 +3226,14 @@ public class HdmiControlService extends SystemService { } @ServiceThreadOnly - void setControlEnabled(boolean enabled) { + void setControlEnabled(@HdmiControlManager.HdmiCecControl int enabled) { assertRunOnServiceThread(); synchronized (mLock) { mHdmiControlEnabled = enabled; } - if (enabled) { + if (enabled == HDMI_CEC_CONTROL_ENABLED) { enableHdmiControlService(); setHdmiCecVolumeControlEnabledInternal(getHdmiCecConfig().getIntValue( HdmiControlManager.CEC_SETTING_NAME_VOLUME_CONTROL_MODE)); diff --git a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java index 7df90166420c..7839c757029c 100644 --- a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java +++ b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java @@ -4187,21 +4187,36 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager { * Calculates strictest (maximum) value for a given password property enforced by admin[s]. */ @Override - public PasswordMetrics getPasswordMinimumMetrics(@UserIdInt int userHandle) { + public PasswordMetrics getPasswordMinimumMetrics(@UserIdInt int userHandle, + boolean deviceWideOnly) { final CallerIdentity caller = getCallerIdentity(); Preconditions.checkCallAuthorization(hasFullCrossUsersPermission(caller, userHandle)); - return getPasswordMinimumMetricsUnchecked(userHandle); + return getPasswordMinimumMetricsUnchecked(userHandle, deviceWideOnly); } private PasswordMetrics getPasswordMinimumMetricsUnchecked(@UserIdInt int userId) { + return getPasswordMinimumMetricsUnchecked(userId, false); + } + + private PasswordMetrics getPasswordMinimumMetricsUnchecked(@UserIdInt int userId, + boolean deviceWideOnly) { if (!mHasFeature) { new PasswordMetrics(CREDENTIAL_TYPE_NONE); } Preconditions.checkArgumentNonnegative(userId, "Invalid userId"); + if (deviceWideOnly) { + Preconditions.checkArgument(!isManagedProfile(userId)); + } ArrayList<PasswordMetrics> adminMetrics = new ArrayList<>(); synchronized (getLockObject()) { - List<ActiveAdmin> admins = getActiveAdminsForLockscreenPoliciesLocked(userId); + final List<ActiveAdmin> admins; + if (deviceWideOnly) { + admins = getActiveAdminsForUserAndItsManagedProfilesLocked(userId, + /* shouldIncludeProfileAdmins */ (user) -> false); + } else { + admins = getActiveAdminsForLockscreenPoliciesLocked(userId); + } for (ActiveAdmin admin : admins) { final boolean isAdminOfUser = userId == admin.getUserHandle().getIdentifier(); // Use the password metrics from the admin in one of three cases: @@ -4261,22 +4276,14 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager { enforceUserUnlocked(parentUser); synchronized (getLockObject()) { - - // Combine password policies across the user and its profiles. Profile admins are - // excluded since we only want explicit password requirements, while profile admin - // requirement are applicable only when the profile has unified challenge. - List<ActiveAdmin> admins = getActiveAdminsForUserAndItsManagedProfilesLocked(parentUser, - /* shouldIncludeProfileAdmins */ (user) -> false); - ArrayList<PasswordMetrics> adminMetrics = new ArrayList<>(admins.size()); - int maxRequiredComplexity = PASSWORD_COMPLEXITY_NONE; - for (ActiveAdmin admin : admins) { - adminMetrics.add(admin.mPasswordPolicy.getMinMetrics()); - maxRequiredComplexity = Math.max(maxRequiredComplexity, admin.mPasswordComplexity); - } + int complexity = getAggregatedPasswordComplexityLocked(parentUser, true); + PasswordMetrics minMetrics = getPasswordMinimumMetricsUnchecked(parentUser, true); PasswordMetrics metrics = mLockSettingsInternal.getUserPasswordMetrics(parentUser); - return PasswordMetrics.validatePasswordMetrics(PasswordMetrics.merge(adminMetrics), - maxRequiredComplexity, false, metrics).isEmpty(); + final List<PasswordValidationError> passwordValidationErrors = + PasswordMetrics.validatePasswordMetrics( + minMetrics, complexity, false, metrics); + return passwordValidationErrors.isEmpty(); } } @@ -4380,7 +4387,7 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager { */ private boolean isPasswordSufficientForUserWithoutCheckpointLocked( @NonNull PasswordMetrics metrics, @UserIdInt int userId) { - final int complexity = getEffectivePasswordComplexityRequirementLocked(userId); + final int complexity = getAggregatedPasswordComplexityLocked(userId); PasswordMetrics minMetrics = getPasswordMinimumMetricsUnchecked(userId); final List<PasswordValidationError> passwordValidationErrors = PasswordMetrics.validatePasswordMetrics( @@ -4482,9 +4489,20 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager { } } - private int getEffectivePasswordComplexityRequirementLocked(@UserIdInt int userHandle) { + private int getAggregatedPasswordComplexityLocked(@UserIdInt int userHandle) { + return getAggregatedPasswordComplexityLocked(userHandle, false); + } + + private int getAggregatedPasswordComplexityLocked(@UserIdInt int userHandle, + boolean deviceWideOnly) { ensureLocked(); - List<ActiveAdmin> admins = getActiveAdminsForLockscreenPoliciesLocked(userHandle); + final List<ActiveAdmin> admins; + if (deviceWideOnly) { + admins = getActiveAdminsForUserAndItsManagedProfilesLocked(userHandle, + /* shouldIncludeProfileAdmins */ (user) -> false); + } else { + admins = getActiveAdminsForLockscreenPoliciesLocked(userHandle); + } int maxRequiredComplexity = PASSWORD_COMPLEXITY_NONE; for (ActiveAdmin admin : admins) { maxRequiredComplexity = Math.max(maxRequiredComplexity, admin.mPasswordComplexity); @@ -4512,7 +4530,7 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager { } @Override - public int getAggregatedPasswordComplexityForUser(int userId) { + public int getAggregatedPasswordComplexityForUser(int userId, boolean deviceWideOnly) { if (!mHasFeature) { return PASSWORD_COMPLEXITY_NONE; } @@ -4521,7 +4539,7 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager { Preconditions.checkCallAuthorization(hasFullCrossUsersPermission(caller, userId)); synchronized (getLockObject()) { - return getEffectivePasswordComplexityRequirementLocked(userId); + return getAggregatedPasswordComplexityLocked(userId, deviceWideOnly); } } @@ -4716,7 +4734,7 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager { synchronized (getLockObject()) { final PasswordMetrics minMetrics = getPasswordMinimumMetricsUnchecked(userHandle); final List<PasswordValidationError> validationErrors; - final int complexity = getEffectivePasswordComplexityRequirementLocked(userHandle); + final int complexity = getAggregatedPasswordComplexityLocked(userHandle); // TODO: Consider changing validation API to take LockscreenCredential. if (password.isEmpty()) { validationErrors = PasswordMetrics.validatePasswordMetrics( @@ -15868,8 +15886,9 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager { Log.i(LOG_TAG, String.format("Setting Enterprise ID to %s for user %d", organizationId, userId)); + final String ownerPackage; synchronized (getLockObject()) { - ActiveAdmin owner = getDeviceOrProfileOwnerAdminLocked(userId); + final ActiveAdmin owner = getDeviceOrProfileOwnerAdminLocked(userId); // As the caller is the system, it must specify the component name of the profile owner // as a safety check. Preconditions.checkCallAuthorization( @@ -15877,6 +15896,7 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager { String.format("The Profile Owner or Device Owner may only set the Enterprise ID" + " on its own user, called on user %d but owner user is %d", userId, owner.getUserHandle().getIdentifier())); + ownerPackage = owner.info.getPackageName(); Preconditions.checkState( TextUtils.isEmpty(owner.mOrganizationId) || owner.mOrganizationId.equals( organizationId), @@ -15894,5 +15914,11 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager { saveSettingsLocked(userId); }); } + + DevicePolicyEventLogger + .createEvent(DevicePolicyEnums.SET_ORGANIZATION_ID) + .setAdmin(ownerPackage) + .setBoolean(isManagedProfile(userId)) + .write(); } } diff --git a/services/tests/servicestests/src/com/android/server/devicepolicy/DevicePolicyManagerTest.java b/services/tests/servicestests/src/com/android/server/devicepolicy/DevicePolicyManagerTest.java index a455ba90ccfe..92adb629d48b 100644 --- a/services/tests/servicestests/src/com/android/server/devicepolicy/DevicePolicyManagerTest.java +++ b/services/tests/servicestests/src/com/android/server/devicepolicy/DevicePolicyManagerTest.java @@ -107,6 +107,7 @@ import androidx.test.filters.SmallTest; import com.android.internal.R; import com.android.internal.messages.nano.SystemMessageProto; +import com.android.internal.widget.LockPatternUtils; import com.android.internal.widget.LockscreenCredential; import com.android.server.LocalServices; import com.android.server.SystemService; @@ -5133,6 +5134,54 @@ public class DevicePolicyManagerTest extends DpmTestBase { } @Test + public void testGetAggregatedPasswordComplexity_IgnoreProfileRequirement() + throws Exception { + final int managedProfileUserId = CALLER_USER_HANDLE; + final int managedProfileAdminUid = + UserHandle.getUid(managedProfileUserId, DpmMockContext.SYSTEM_UID); + mContext.binder.callingUid = managedProfileAdminUid; + addManagedProfile(admin1, managedProfileAdminUid, admin1, VERSION_CODES.R); + + dpm.setRequiredPasswordComplexity(PASSWORD_COMPLEXITY_HIGH); + parentDpm.setRequiredPasswordComplexity(PASSWORD_COMPLEXITY_LOW); + + assertThat(dpms.getAggregatedPasswordComplexityForUser(UserHandle.USER_SYSTEM, true)) + .isEqualTo(PASSWORD_COMPLEXITY_LOW); + assertThat(dpms.getAggregatedPasswordComplexityForUser(UserHandle.USER_SYSTEM, false)) + .isEqualTo(PASSWORD_COMPLEXITY_HIGH); + } + + @Test + public void testGetAggregatedPasswordMetrics_IgnoreProfileRequirement() + throws Exception { + final int managedProfileUserId = CALLER_USER_HANDLE; + final int managedProfileAdminUid = + UserHandle.getUid(managedProfileUserId, DpmMockContext.SYSTEM_UID); + mContext.binder.callingUid = managedProfileAdminUid; + addManagedProfile(admin1, managedProfileAdminUid, admin1, VERSION_CODES.R); + + dpm.setPasswordQuality(admin1, DevicePolicyManager.PASSWORD_QUALITY_COMPLEX); + dpm.setPasswordMinimumLength(admin1, 8); + dpm.setPasswordMinimumLetters(admin1, 1); + dpm.setPasswordMinimumNumeric(admin1, 2); + dpm.setPasswordMinimumSymbols(admin1, 3); + + parentDpm.setPasswordQuality(admin1, DevicePolicyManager.PASSWORD_QUALITY_SOMETHING); + + PasswordMetrics deviceMetrics = + dpms.getPasswordMinimumMetrics(UserHandle.USER_SYSTEM, true); + assertThat(deviceMetrics.credType).isEqualTo(LockPatternUtils.CREDENTIAL_TYPE_PATTERN); + + PasswordMetrics allMetrics = + dpms.getPasswordMinimumMetrics(UserHandle.USER_SYSTEM, false); + assertThat(allMetrics.credType).isEqualTo(LockPatternUtils.CREDENTIAL_TYPE_PASSWORD); + assertThat(allMetrics.length).isEqualTo(8); + assertThat(allMetrics.letters).isEqualTo(1); + assertThat(allMetrics.numeric).isEqualTo(2); + assertThat(allMetrics.symbols).isEqualTo(3); + } + + @Test public void testCanSetPasswordRequirementOnParentPreS() throws Exception { final int managedProfileUserId = CALLER_USER_HANDLE; final int managedProfileAdminUid = diff --git a/services/tests/servicestests/src/com/android/server/hdmi/ArcInitiationActionFromAvrTest.java b/services/tests/servicestests/src/com/android/server/hdmi/ArcInitiationActionFromAvrTest.java index 6e4d994bd416..44418ce1e9c4 100644 --- a/services/tests/servicestests/src/com/android/server/hdmi/ArcInitiationActionFromAvrTest.java +++ b/services/tests/servicestests/src/com/android/server/hdmi/ArcInitiationActionFromAvrTest.java @@ -105,6 +105,10 @@ public class ArcInitiationActionFromAvrTest { } @Override + protected void writeStringSystemProperty(String key, String value) { + } + + @Override Looper getServiceLooper() { return mTestLooper.getLooper(); } diff --git a/services/tests/servicestests/src/com/android/server/hdmi/ArcTerminationActionFromAvrTest.java b/services/tests/servicestests/src/com/android/server/hdmi/ArcTerminationActionFromAvrTest.java index bbe1156c5d61..d454d8771e15 100644 --- a/services/tests/servicestests/src/com/android/server/hdmi/ArcTerminationActionFromAvrTest.java +++ b/services/tests/servicestests/src/com/android/server/hdmi/ArcTerminationActionFromAvrTest.java @@ -106,6 +106,10 @@ public class ArcTerminationActionFromAvrTest { } @Override + protected void writeStringSystemProperty(String key, String value) { + } + + @Override Looper getServiceLooper() { return mTestLooper.getLooper(); } diff --git a/services/tests/servicestests/src/com/android/server/hdmi/HdmiControlServiceTest.java b/services/tests/servicestests/src/com/android/server/hdmi/HdmiControlServiceTest.java index dbb03cb6dbdc..be584d7b4591 100644 --- a/services/tests/servicestests/src/com/android/server/hdmi/HdmiControlServiceTest.java +++ b/services/tests/servicestests/src/com/android/server/hdmi/HdmiControlServiceTest.java @@ -154,6 +154,10 @@ public class HdmiControlServiceTest { } @Override + protected void writeStringSystemProperty(String key, String value) { + } + + @Override protected HdmiCecConfig getHdmiCecConfig() { return hdmiCecConfig; } @@ -251,7 +255,7 @@ public class HdmiControlServiceTest { HdmiControlManager.CEC_SETTING_NAME_HDMI_CEC_VERSION, HdmiControlManager.HDMI_CEC_VERSION_1_4_B); - mHdmiControlService.setControlEnabled(true); + mHdmiControlService.setControlEnabled(HdmiControlManager.HDMI_CEC_CONTROL_ENABLED); mNativeWrapper.clearResultMessages(); assertThat(mHdmiControlService.getInitialPowerStatus()).isEqualTo( @@ -271,7 +275,7 @@ public class HdmiControlServiceTest { HdmiControlManager.CEC_SETTING_NAME_HDMI_CEC_VERSION, HdmiControlManager.HDMI_CEC_VERSION_2_0); - mHdmiControlService.setControlEnabled(true); + mHdmiControlService.setControlEnabled(HdmiControlManager.HDMI_CEC_CONTROL_ENABLED); mNativeWrapper.clearResultMessages(); mHdmiControlService.allocateLogicalAddress(mLocalDevices, INITIATED_BY_ENABLE_CEC); @@ -347,11 +351,11 @@ public class HdmiControlServiceTest { int volumeControlEnabled = HdmiControlManager.VOLUME_CONTROL_ENABLED; mHdmiControlService.setHdmiCecVolumeControlEnabledInternal(volumeControlEnabled); - mHdmiControlService.setControlEnabled(false); + mHdmiControlService.setControlEnabled(HdmiControlManager.HDMI_CEC_CONTROL_DISABLED); assertThat(mHdmiControlService.getHdmiCecVolumeControl()).isEqualTo( HdmiControlManager.VOLUME_CONTROL_DISABLED); - mHdmiControlService.setControlEnabled(true); + mHdmiControlService.setControlEnabled(HdmiControlManager.HDMI_CEC_CONTROL_ENABLED); assertThat(mHdmiControlService.getHdmiCecVolumeControl()).isEqualTo(volumeControlEnabled); } @@ -361,12 +365,12 @@ public class HdmiControlServiceTest { mHdmiControlService.getHdmiCecConfig().setIntValue( HdmiControlManager.CEC_SETTING_NAME_VOLUME_CONTROL_MODE, volumeControlEnabled); - mHdmiControlService.setControlEnabled(false); + mHdmiControlService.setControlEnabled(HdmiControlManager.HDMI_CEC_CONTROL_DISABLED); assertThat(mHdmiControlService.getHdmiCecConfig().getIntValue( HdmiControlManager.CEC_SETTING_NAME_VOLUME_CONTROL_MODE)).isEqualTo( volumeControlEnabled); - mHdmiControlService.setControlEnabled(true); + mHdmiControlService.setControlEnabled(HdmiControlManager.HDMI_CEC_CONTROL_ENABLED); assertThat(mHdmiControlService.getHdmiCecConfig().getIntValue( HdmiControlManager.CEC_SETTING_NAME_VOLUME_CONTROL_MODE)).isEqualTo( volumeControlEnabled); @@ -381,13 +385,13 @@ public class HdmiControlServiceTest { VolumeControlFeatureCallback callback = new VolumeControlFeatureCallback(); mHdmiControlService.addHdmiCecVolumeControlFeatureListener(callback); - mHdmiControlService.setControlEnabled(false); + mHdmiControlService.setControlEnabled(HdmiControlManager.HDMI_CEC_CONTROL_DISABLED); assertThat(callback.mCallbackReceived).isTrue(); assertThat(callback.mVolumeControlEnabled).isEqualTo( HdmiControlManager.VOLUME_CONTROL_DISABLED); - mHdmiControlService.setControlEnabled(true); + mHdmiControlService.setControlEnabled(HdmiControlManager.HDMI_CEC_CONTROL_ENABLED); assertThat(callback.mVolumeControlEnabled).isEqualTo( HdmiControlManager.VOLUME_CONTROL_ENABLED); } @@ -485,7 +489,7 @@ public class HdmiControlServiceTest { Settings.Global.putString(mContextSpy.getContentResolver(), Settings.Global.HDMI_CEC_VERSION, null); - mHdmiControlService.setControlEnabled(true); + mHdmiControlService.setControlEnabled(HdmiControlManager.HDMI_CEC_CONTROL_ENABLED); assertThat(mHdmiControlService.getCecVersion()).isEqualTo( HdmiControlManager.HDMI_CEC_VERSION_1_4_B); } @@ -495,7 +499,7 @@ public class HdmiControlServiceTest { mHdmiControlService.getHdmiCecConfig().setIntValue( HdmiControlManager.CEC_SETTING_NAME_HDMI_CEC_VERSION, HdmiControlManager.HDMI_CEC_VERSION_1_4_B); - mHdmiControlService.setControlEnabled(true); + mHdmiControlService.setControlEnabled(HdmiControlManager.HDMI_CEC_CONTROL_ENABLED); assertThat(mHdmiControlService.getCecVersion()).isEqualTo( HdmiControlManager.HDMI_CEC_VERSION_1_4_B); } @@ -505,7 +509,7 @@ public class HdmiControlServiceTest { mHdmiControlService.getHdmiCecConfig().setIntValue( HdmiControlManager.CEC_SETTING_NAME_HDMI_CEC_VERSION, HdmiControlManager.HDMI_CEC_VERSION_2_0); - mHdmiControlService.setControlEnabled(true); + mHdmiControlService.setControlEnabled(HdmiControlManager.HDMI_CEC_CONTROL_ENABLED); assertThat(mHdmiControlService.getCecVersion()).isEqualTo( HdmiControlManager.HDMI_CEC_VERSION_2_0); } @@ -515,14 +519,14 @@ public class HdmiControlServiceTest { mHdmiControlService.getHdmiCecConfig().setIntValue( HdmiControlManager.CEC_SETTING_NAME_HDMI_CEC_VERSION, HdmiControlManager.HDMI_CEC_VERSION_1_4_B); - mHdmiControlService.setControlEnabled(true); + mHdmiControlService.setControlEnabled(HdmiControlManager.HDMI_CEC_CONTROL_ENABLED); assertThat(mHdmiControlService.getCecVersion()).isEqualTo( HdmiControlManager.HDMI_CEC_VERSION_1_4_B); mHdmiControlService.getHdmiCecConfig().setIntValue( HdmiControlManager.CEC_SETTING_NAME_HDMI_CEC_VERSION, HdmiControlManager.HDMI_CEC_VERSION_2_0); - mHdmiControlService.setControlEnabled(true); + mHdmiControlService.setControlEnabled(HdmiControlManager.HDMI_CEC_CONTROL_ENABLED); assertThat(mHdmiControlService.getCecVersion()).isEqualTo( HdmiControlManager.HDMI_CEC_VERSION_2_0); } @@ -532,7 +536,7 @@ public class HdmiControlServiceTest { mHdmiControlService.getHdmiCecConfig().setIntValue( HdmiControlManager.CEC_SETTING_NAME_HDMI_CEC_VERSION, HdmiControlManager.HDMI_CEC_VERSION_1_4_B); - mHdmiControlService.setControlEnabled(true); + mHdmiControlService.setControlEnabled(HdmiControlManager.HDMI_CEC_CONTROL_ENABLED); mTestLooper.dispatchAll(); mNativeWrapper.onCecMessage(HdmiCecMessageBuilder.buildGiveFeatures(Constants.ADDR_TV, @@ -550,7 +554,7 @@ public class HdmiControlServiceTest { mHdmiControlService.getHdmiCecConfig().setIntValue( HdmiControlManager.CEC_SETTING_NAME_HDMI_CEC_VERSION, HdmiControlManager.HDMI_CEC_VERSION_2_0); - mHdmiControlService.setControlEnabled(true); + mHdmiControlService.setControlEnabled(HdmiControlManager.HDMI_CEC_CONTROL_ENABLED); mHdmiControlService.allocateLogicalAddress(mLocalDevices, INITIATED_BY_ENABLE_CEC); mTestLooper.dispatchAll(); @@ -572,7 +576,7 @@ public class HdmiControlServiceTest { mHdmiControlService.getHdmiCecConfig().setIntValue( HdmiControlManager.CEC_SETTING_NAME_HDMI_CEC_VERSION, HdmiControlManager.HDMI_CEC_VERSION_1_4_B); - mHdmiControlService.setControlEnabled(true); + mHdmiControlService.setControlEnabled(HdmiControlManager.HDMI_CEC_CONTROL_ENABLED); mHdmiControlService.allocateLogicalAddress(mLocalDevices, INITIATED_BY_ENABLE_CEC); mTestLooper.dispatchAll(); @@ -589,7 +593,7 @@ public class HdmiControlServiceTest { mHdmiControlService.getHdmiCecConfig().setIntValue( HdmiControlManager.CEC_SETTING_NAME_HDMI_CEC_VERSION, HdmiControlManager.HDMI_CEC_VERSION_2_0); - mHdmiControlService.setControlEnabled(true); + mHdmiControlService.setControlEnabled(HdmiControlManager.HDMI_CEC_CONTROL_ENABLED); mHdmiControlService.allocateLogicalAddress(mLocalDevices, INITIATED_BY_ENABLE_CEC); mTestLooper.dispatchAll(); diff --git a/services/tests/servicestests/src/com/android/server/hdmi/SystemAudioInitiationActionFromAvrTest.java b/services/tests/servicestests/src/com/android/server/hdmi/SystemAudioInitiationActionFromAvrTest.java index f80b5737d27b..f9160abcbfbf 100644 --- a/services/tests/servicestests/src/com/android/server/hdmi/SystemAudioInitiationActionFromAvrTest.java +++ b/services/tests/servicestests/src/com/android/server/hdmi/SystemAudioInitiationActionFromAvrTest.java @@ -138,6 +138,10 @@ public class SystemAudioInitiationActionFromAvrTest { } @Override + protected void writeStringSystemProperty(String key, String value) { + } + + @Override void wakeUp() {} @Override |