diff options
10 files changed, 102 insertions, 21 deletions
diff --git a/core/java/android/app/PendingIntent.java b/core/java/android/app/PendingIntent.java index 0136a35e3975..e68eb7471e42 100644 --- a/core/java/android/app/PendingIntent.java +++ b/core/java/android/app/PendingIntent.java @@ -365,6 +365,7 @@ public final class PendingIntent implements Parcelable { } if (Compatibility.isChangeEnabled(PENDING_INTENT_EXPLICIT_MUTABILITY_REQUIRED) + && !"com.google.android.apps.gcs".equals(packageName) && !flagImmutableSet && !flagMutableSet) { String msg = packageName + ": Targeting S+ (version " + Build.VERSION_CODES.S + " and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE" diff --git a/core/java/android/hardware/biometrics/ParentalControlsUtilsInternal.java b/core/java/android/hardware/biometrics/ParentalControlsUtilsInternal.java new file mode 100644 index 000000000000..ef13ca6b6130 --- /dev/null +++ b/core/java/android/hardware/biometrics/ParentalControlsUtilsInternal.java @@ -0,0 +1,73 @@ +/* + * 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 android.hardware.biometrics; + +import android.annotation.NonNull; +import android.annotation.Nullable; +import android.app.admin.DevicePolicyManager; +import android.content.ComponentName; +import android.os.UserHandle; + +/** + * "Base" functionality. For settings-specific functionality (which may rely on this base + * functionality), see {@link com.android.settings.biometrics.ParentalControlsUtils} + * @hide + */ +public class ParentalControlsUtilsInternal { + + /** + * @return true if parental consent is required in order for biometric sensors to be used. + */ + public static boolean parentConsentRequired(@NonNull DevicePolicyManager dpm, + @BiometricAuthenticator.Modality int modality, @NonNull UserHandle userHandle) { + final ComponentName cn = getSupervisionComponentName(dpm, userHandle); + if (cn == null) { + return false; + } + + final int keyguardDisabledFeatures = dpm.getKeyguardDisabledFeatures(cn); + final boolean dpmFpDisabled = containsFlag(keyguardDisabledFeatures, + DevicePolicyManager.KEYGUARD_DISABLE_FINGERPRINT); + final boolean dpmFaceDisabled = containsFlag(keyguardDisabledFeatures, + DevicePolicyManager.KEYGUARD_DISABLE_FACE); + final boolean dpmIrisDisabled = containsFlag(keyguardDisabledFeatures, + DevicePolicyManager.KEYGUARD_DISABLE_IRIS); + + final boolean consentRequired; + if (containsFlag(modality, BiometricAuthenticator.TYPE_FINGERPRINT) && dpmFpDisabled) { + consentRequired = true; + } else if (containsFlag(modality, BiometricAuthenticator.TYPE_FACE) && dpmFaceDisabled) { + consentRequired = true; + } else if (containsFlag(modality, BiometricAuthenticator.TYPE_IRIS) && dpmIrisDisabled) { + consentRequired = true; + } else { + consentRequired = false; + } + + return consentRequired; + } + + @Nullable + public static ComponentName getSupervisionComponentName(@NonNull DevicePolicyManager dpm, + @NonNull UserHandle userHandle) { + return dpm.getProfileOwnerOrDeviceOwnerSupervisionComponent(userHandle); + } + + private static boolean containsFlag(int haystack, int needle) { + return (haystack & needle) != 0; + } +} diff --git a/core/java/android/view/contentcapture/ContentCaptureEvent.java b/core/java/android/view/contentcapture/ContentCaptureEvent.java index 1b1dc4a709ca..afc907b3f77a 100644 --- a/core/java/android/view/contentcapture/ContentCaptureEvent.java +++ b/core/java/android/view/contentcapture/ContentCaptureEvent.java @@ -16,6 +16,7 @@ package android.view.contentcapture; import static android.view.contentcapture.ContentCaptureHelper.getSanitizedString; +import static android.view.contentcapture.ContentCaptureManager.DEBUG; import static android.view.contentcapture.ContentCaptureManager.NO_SESSION_ID; import android.annotation.IntDef; @@ -509,11 +510,13 @@ public final class ContentCaptureEvent implements Parcelable { string.append(", class=").append(className); string.append(", id=").append(mNode.getAutofillId()); if (mNode.getText() != null) { - string.append(", text=").append(getSanitizedString(mNode.getText())); + string.append(", text=") + .append(DEBUG ? mNode.getText() : getSanitizedString(mNode.getText())); } } if (mText != null) { - string.append(", text=").append(getSanitizedString(mText)); + string.append(", text=") + .append(DEBUG ? mText : getSanitizedString(mText)); } if (mClientContext != null) { string.append(", context=").append(mClientContext); diff --git a/core/java/android/view/contentcapture/ContentCaptureManager.java b/core/java/android/view/contentcapture/ContentCaptureManager.java index ed840ce3061b..9241c3074ddd 100644 --- a/core/java/android/view/contentcapture/ContentCaptureManager.java +++ b/core/java/android/view/contentcapture/ContentCaptureManager.java @@ -212,6 +212,9 @@ public final class ContentCaptureManager { private static final String TAG = ContentCaptureManager.class.getSimpleName(); + /** @hide */ + public static final boolean DEBUG = false; + /** Error happened during the data sharing session. */ public static final int DATA_SHARE_ERROR_UNKNOWN = 1; diff --git a/packages/SettingsLib/RadioButtonPreference/res/layout/preference_radio.xml b/packages/SettingsLib/RadioButtonPreference/res/layout/preference_radio.xml index b299061ce591..906ff2cc09d5 100644 --- a/packages/SettingsLib/RadioButtonPreference/res/layout/preference_radio.xml +++ b/packages/SettingsLib/RadioButtonPreference/res/layout/preference_radio.xml @@ -104,7 +104,7 @@ android:gravity="center_vertical"> <View android:layout_width=".75dp" - android:layout_height="match_parent" + android:layout_height="32dp" android:layout_marginTop="16dp" android:layout_marginBottom="16dp" android:background="?android:attr/dividerVertical" /> diff --git a/packages/SystemUI/res/layout/qs_tile_label.xml b/packages/SystemUI/res/layout/qs_tile_label.xml index 1d93f5d69da8..536b0423ce16 100644 --- a/packages/SystemUI/res/layout/qs_tile_label.xml +++ b/packages/SystemUI/res/layout/qs_tile_label.xml @@ -33,6 +33,7 @@ android:gravity="start" android:textDirection="locale" android:ellipsize="marquee" + android:marqueeRepeatLimit="1" android:singleLine="true" android:textAppearance="@style/TextAppearance.QS.TileLabel"/> @@ -43,6 +44,7 @@ android:gravity="start" android:textDirection="locale" android:ellipsize="marquee" + android:marqueeRepeatLimit="1" android:singleLine="true" android:visibility="gone" android:textAppearance="@style/TextAppearance.QS.TileLabel.Secondary" diff --git a/packages/SystemUI/src/com/android/systemui/accessibility/MagnificationModeSwitch.java b/packages/SystemUI/src/com/android/systemui/accessibility/MagnificationModeSwitch.java index bfb7105f5860..17178fa8e606 100644 --- a/packages/SystemUI/src/com/android/systemui/accessibility/MagnificationModeSwitch.java +++ b/packages/SystemUI/src/com/android/systemui/accessibility/MagnificationModeSwitch.java @@ -75,7 +75,6 @@ class MagnificationModeSwitch implements MagnificationGestureDetector.OnGestureL private final SfVsyncFrameCallbackProvider mSfVsyncFrameProvider; private int mMagnificationMode = ACCESSIBILITY_MAGNIFICATION_MODE_NONE; private final LayoutParams mParams; - private int mWindowHeight; @VisibleForTesting final Rect mDraggableWindowBounds = new Rect(); private boolean mIsVisible = false; @@ -95,7 +94,6 @@ class MagnificationModeSwitch implements MagnificationGestureDetector.OnGestureL mWindowManager = mContext.getSystemService(WindowManager.class); mSfVsyncFrameProvider = sfVsyncFrameProvider; mParams = createLayoutParams(context); - mWindowHeight = mWindowManager.getCurrentWindowMetrics().getBounds().height(); mImageView = imageView; mImageView.setOnTouchListener(this::onTouch); mImageView.setAccessibilityDelegate(new View.AccessibilityDelegate() { @@ -313,12 +311,14 @@ class MagnificationModeSwitch implements MagnificationGestureDetector.OnGestureL void onConfigurationChanged(int configDiff) { if ((configDiff & ActivityInfo.CONFIG_ORIENTATION) != 0) { + final Rect previousDraggableBounds = new Rect(mDraggableWindowBounds); mDraggableWindowBounds.set(getDraggableWindowBounds()); - // Keep the Y position with the same height ratio before the window height is changed. - final int windowHeight = mWindowManager.getCurrentWindowMetrics().getBounds().height(); - final float windowHeightFraction = (float) mParams.y / mWindowHeight; - mParams.y = (int) (windowHeight * windowHeightFraction); - mWindowHeight = windowHeight; + // Keep the Y position with the same height ratio before the window bounds and + // draggable bounds are changed. + final float windowHeightFraction = (float) (mParams.y - previousDraggableBounds.top) + / previousDraggableBounds.height(); + mParams.y = (int) (windowHeightFraction * mDraggableWindowBounds.height()) + + mDraggableWindowBounds.top; stickToScreenEdge(mToLeftScreenEdge); return; } diff --git a/packages/SystemUI/tests/src/com/android/systemui/accessibility/MagnificationModeSwitchTest.java b/packages/SystemUI/tests/src/com/android/systemui/accessibility/MagnificationModeSwitchTest.java index 485df21656d3..5617f1b6316b 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/accessibility/MagnificationModeSwitchTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/accessibility/MagnificationModeSwitchTest.java @@ -59,7 +59,6 @@ import android.os.UserHandle; import android.provider.Settings; import android.testing.AndroidTestingRunner; import android.testing.TestableLooper; -import android.util.MathUtils; import android.view.Choreographer; import android.view.MotionEvent; import android.view.View; @@ -489,20 +488,20 @@ public class MagnificationModeSwitchTest extends SysuiTestCase { @Test public void onRotationChanged_buttonIsShowing_expectedYPosition() { final Rect windowBounds = mWindowManager.getCurrentWindowMetrics().getBounds(); - final int oldWindowHeight = windowBounds.height(); mMagnificationModeSwitch.showButton(ACCESSIBILITY_MAGNIFICATION_MODE_FULLSCREEN); + final Rect oldDraggableBounds = new Rect(mMagnificationModeSwitch.mDraggableWindowBounds); final float windowHeightFraction = - (float) mWindowManager.getLayoutParamsFromAttachedView().y / oldWindowHeight; + (float) (mWindowManager.getLayoutParamsFromAttachedView().y + - oldDraggableBounds.top) / oldDraggableBounds.height(); - // The window bounds are changed due to the rotation change. + // The window bounds and the draggable bounds are changed due to the rotation change. final Rect newWindowBounds = new Rect(0, 0, windowBounds.height(), windowBounds.width()); mWindowManager.setWindowBounds(newWindowBounds); mMagnificationModeSwitch.onConfigurationChanged(ActivityInfo.CONFIG_ORIENTATION); - int expectedY = (int) (newWindowBounds.height() * windowHeightFraction); - expectedY = MathUtils.constrain(expectedY, - mMagnificationModeSwitch.mDraggableWindowBounds.top, - mMagnificationModeSwitch.mDraggableWindowBounds.bottom); + int expectedY = (int) (windowHeightFraction + * mMagnificationModeSwitch.mDraggableWindowBounds.height()) + + mMagnificationModeSwitch.mDraggableWindowBounds.top; assertEquals( "The Y position does not keep the same height ratio after the rotation changed.", expectedY, mWindowManager.getLayoutParamsFromAttachedView().y); diff --git a/packages/overlays/DisplayCutoutEmulationWaterfallOverlay/res/values/config.xml b/packages/overlays/DisplayCutoutEmulationWaterfallOverlay/res/values/config.xml index b9c5f1ded3d5..8d0227eed875 100644 --- a/packages/overlays/DisplayCutoutEmulationWaterfallOverlay/res/values/config.xml +++ b/packages/overlays/DisplayCutoutEmulationWaterfallOverlay/res/values/config.xml @@ -25,9 +25,9 @@ <!-- Max((28 + 20), 0) = 48 --> <dimen name="status_bar_height_landscape">48dp</dimen> <!-- Height of area above QQS where battery/time go (equal to status bar height if > 48dp) --> - <dimen name="quick_qs_offset_height">28dp</dimen> + <dimen name="quick_qs_offset_height">48dp</dimen> <!-- Total height of QQS (quick_qs_offset_height + 128) --> - <dimen name="quick_qs_total_height">156dp</dimen> + <dimen name="quick_qs_total_height">176dp</dimen> <dimen name="waterfall_display_left_edge_size">20dp</dimen> <dimen name="waterfall_display_top_edge_size">0dp</dimen> diff --git a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java index 0128d350bd10..fa24e5238820 100644 --- a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java +++ b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java @@ -6832,7 +6832,7 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager { @Override public void wipeDataWithReason(int flags, String wipeReasonForUser, boolean calledOnParentInstance) { - if (!mHasFeature) { + if (!mHasFeature && !hasCallingOrSelfPermission(permission.MASTER_CLEAR)) { return; } final CallerIdentity caller = getCallerIdentity(); |